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

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 R {
29
+ class Q {
30
30
  constructor(t) {
31
31
  this.otherProperties = t;
32
32
  }
@@ -35,7 +35,7 @@ class R {
35
35
  */
36
36
  static deserialize(t) {
37
37
  if (t)
38
- return new R(t);
38
+ return new Q(t);
39
39
  }
40
40
  /**
41
41
  * Serializes a [Properties] to its RWPM JSON representation.
@@ -50,34 +50,34 @@ class R {
50
50
  const e = Object.assign({}, this.otherProperties);
51
51
  for (const A in t)
52
52
  e[A] = t[A];
53
- return new R(e);
53
+ return new Q(e);
54
54
  }
55
55
  }
56
- Object.defineProperty(R.prototype, "encryption", {
56
+ Object.defineProperty(Q.prototype, "encryption", {
57
57
  get: function() {
58
58
  return xA.deserialize(this.otherProperties.encrypted);
59
59
  }
60
60
  });
61
- var p = /* @__PURE__ */ ((n) => (n.fixed = "fixed", n.reflowable = "reflowable", n))(p || {}), it = /* @__PURE__ */ ((n) => (n.auto = "auto", n.landscape = "landscape", n.portrait = "portrait", n))(it || {}), J = /* @__PURE__ */ ((n) => (n.left = "left", n.right = "right", n.center = "center", n))(J || {}), Ct = /* @__PURE__ */ ((n) => (n.auto = "auto", n.both = "both", n.none = "none", n.landscape = "landscape", n))(Ct || {});
62
- R.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 || {}), yt = /* @__PURE__ */ ((i) => (i.auto = "auto", i.both = "both", i.none = "none", i.landscape = "landscape", i))(yt || {});
62
+ Q.prototype.getContains = function() {
63
63
  return new Set(this.otherProperties.contains || []);
64
64
  };
65
- R.prototype.getLayout = function() {
65
+ Q.prototype.getLayout = function() {
66
66
  return this.otherProperties.layout;
67
67
  };
68
68
  class d {
69
69
  /** Creates a MediaType object. */
70
70
  constructor(t) {
71
- let e, A, i = t.mediaType.replace(/\s/g, "").split(";");
72
- const r = i[0].split("/");
71
+ let e, A, n = t.mediaType.replace(/\s/g, "").split(";");
72
+ const r = n[0].split("/");
73
73
  if (r.length === 2) {
74
74
  if (e = r[0].toLowerCase().trim(), A = r[1].toLowerCase().trim(), e.length === 0 || A.length === 0)
75
75
  throw new Error("Invalid media type");
76
76
  } else
77
77
  throw new Error("Invalid media type");
78
78
  const s = {};
79
- for (let g = 1; g < i.length; g++) {
80
- const m = i[g].split("=");
79
+ for (let g = 1; g < n.length; g++) {
80
+ const m = n[g].split("=");
81
81
  if (m.length === 2) {
82
82
  const M = m[0].toLocaleLowerCase(), B = M === "charset" ? m[1].toUpperCase() : m[1];
83
83
  s[M] = B;
@@ -129,11 +129,11 @@ class d {
129
129
  return !1;
130
130
  const A = new Set(
131
131
  Object.entries(this.parameters).map(([r, s]) => `${r}=${s}`)
132
- ), i = new Set(
132
+ ), n = new Set(
133
133
  Object.entries(e.parameters).map(([r, s]) => `${r}=${s}`)
134
134
  );
135
135
  for (const r of Array.from(A.values()))
136
- if (!i.has(r))
136
+ if (!n.has(r))
137
137
  return !1;
138
138
  return !0;
139
139
  }
@@ -530,7 +530,7 @@ let me = class {
530
530
  getParameters(t) {
531
531
  const e = /\{\??([^}]+)\}/g, A = t.match(e);
532
532
  return A ? new Set(
533
- A.join(",").replace(e, "$1").split(",").map((i) => i.trim())
533
+ A.join(",").replace(e, "$1").split(",").map((n) => n.trim())
534
534
  ) : /* @__PURE__ */ new Set();
535
535
  }
536
536
  /** Expands the URI by replacing the template variables by the given parameters.
@@ -538,34 +538,34 @@ let me = class {
538
538
  * See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
539
539
  */
540
540
  expand(t) {
541
- const e = (i) => i.split(",").map((r) => {
541
+ const e = (n) => n.split(",").map((r) => {
542
542
  const s = t[r];
543
543
  return s ? encodeURIComponent(s) : "";
544
- }).join(","), A = (i) => "?" + i.split(",").map((r) => {
544
+ }).join(","), A = (n) => "?" + n.split(",").map((r) => {
545
545
  const s = r.split("=")[0], o = t[s];
546
546
  return o ? `${s}=${encodeURIComponent(o)}` : "";
547
547
  }).join("&");
548
- return this.uri.replace(/\{(\??)([^}]+)\}/g, (...i) => i[1] ? A(i[2]) : e(i[2]));
548
+ return this.uri.replace(/\{(\??)([^}]+)\}/g, (...n) => n[1] ? A(n[2]) : e(n[2]));
549
549
  }
550
550
  };
551
- function TA(n) {
552
- return n && n instanceof Array ? n : void 0;
551
+ function TA(i) {
552
+ return i && i instanceof Array ? i : void 0;
553
553
  }
554
- function Ke(n) {
555
- return n && typeof n == "string" ? [n] : TA(n);
554
+ function Ke(i) {
555
+ return i && typeof i == "string" ? [i] : TA(i);
556
556
  }
557
- function Me(n) {
558
- return typeof n == "string" ? new Date(n) : void 0;
557
+ function Me(i) {
558
+ return typeof i == "string" ? new Date(i) : void 0;
559
559
  }
560
- function It(n) {
561
- return isNaN(n) ? void 0 : n;
560
+ function It(i) {
561
+ return isNaN(i) ? void 0 : i;
562
562
  }
563
- function D(n) {
564
- return It(n) !== void 0 && Math.sign(n) >= 0 ? n : void 0;
563
+ function D(i) {
564
+ return It(i) !== void 0 && Math.sign(i) >= 0 ? i : void 0;
565
565
  }
566
- function jA(n) {
566
+ function jA(i) {
567
567
  const t = new Array();
568
- return n.forEach((e) => t.push(e)), t;
568
+ return i.forEach((e) => t.push(e)), t;
569
569
  }
570
570
  let H = class qe {
571
571
  /**
@@ -580,7 +580,7 @@ let H = class qe {
580
580
  static deserialize(t) {
581
581
  if (!t)
582
582
  return;
583
- const e = It(t.progression), A = It(t.totalProgression), i = It(t.position), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set([
583
+ const e = It(t.progression), A = It(t.totalProgression), n = It(t.position), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set([
584
584
  "fragment",
585
585
  "fragments",
586
586
  "progression",
@@ -593,7 +593,7 @@ let H = class qe {
593
593
  fragments: Ke(t.fragments || t.fragment),
594
594
  progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
595
595
  totalProgression: A !== void 0 && A >= 0 && A <= 1 ? A : void 0,
596
- position: i !== void 0 && i > 0 ? i : void 0,
596
+ position: n !== void 0 && n > 0 ? n : void 0,
597
597
  otherLocations: r.size === 0 ? void 0 : r
598
598
  });
599
599
  }
@@ -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: R.deserialize(t.properties),
691
+ properties: Q.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 R(t), A;
741
+ return A.properties = A.properties ? (e = A.properties) == null ? void 0 : e.add(t) : new Q(t), A;
742
742
  }
743
743
  /**
744
744
  * Creates a [Locator] from a reading order [Link].
@@ -810,8 +810,8 @@ let fe = class $e {
810
810
  /** Finds all the links matching any of the given media types. */
811
811
  filterByMediaTypes(t) {
812
812
  const e = (A) => {
813
- for (const i of t)
814
- if (A.mediaType.matches(i))
813
+ for (const n of t)
814
+ if (A.mediaType.matches(n))
815
815
  return !0;
816
816
  return !1;
817
817
  };
@@ -881,8 +881,7 @@ let fe = class $e {
881
881
  };
882
882
  return this.charOffset !== void 0 && (t.charOffset = this.charOffset), t;
883
883
  }
884
- };
885
- class te {
884
+ }, DA = class eA {
886
885
  /**
887
886
  * Creates a [DomRange].
888
887
  */
@@ -897,7 +896,7 @@ class te {
897
896
  return;
898
897
  let e = pe.deserialize(t.start);
899
898
  if (e)
900
- return new te({
899
+ return new eA({
901
900
  start: e,
902
901
  end: pe.deserialize(t.end)
903
902
  });
@@ -909,56 +908,56 @@ class te {
909
908
  const t = { start: this.start.serialize() };
910
909
  return this.end && (t.end = this.end.serialize()), t;
911
910
  }
912
- }
911
+ };
913
912
  H.prototype.getCssSelector = function() {
914
- var n;
915
- return (n = this.otherLocations) == null ? void 0 : n.get("cssSelector");
913
+ var i;
914
+ return (i = this.otherLocations) == null ? void 0 : i.get("cssSelector");
916
915
  };
917
916
  H.prototype.getPartialCfi = function() {
918
- var n;
919
- return (n = this.otherLocations) == null ? void 0 : n.get("partialCfi");
917
+ var i;
918
+ return (i = this.otherLocations) == null ? void 0 : i.get("partialCfi");
920
919
  };
921
920
  H.prototype.getDomRange = function() {
922
- var n;
923
- return te.deserialize((n = this.otherLocations) == null ? void 0 : n.get("domRange"));
921
+ var i;
922
+ return DA.deserialize((i = this.otherLocations) == null ? void 0 : i.get("domRange"));
924
923
  };
925
924
  H.prototype.fragmentParameters = function() {
926
925
  return new Map(
927
- this.fragments.map((n) => n.startsWith("#") ? n.slice(1) : n).join("&").split("&").filter((n) => !n.startsWith("#")).map((n) => n.split("=")).filter((n) => n.length === 2).map((n) => [
928
- n[0].trim().toLowerCase(),
929
- n[1].trim()
926
+ this.fragments.map((i) => i.startsWith("#") ? i.slice(1) : i).join("&").split("&").filter((i) => !i.startsWith("#")).map((i) => i.split("=")).filter((i) => i.length === 2).map((i) => [
927
+ i[0].trim().toLowerCase(),
928
+ i[1].trim()
930
929
  ])
931
930
  );
932
931
  };
933
932
  H.prototype.htmlId = function() {
934
933
  if (!this.fragments.length)
935
934
  return;
936
- let n = this.fragments.find((t) => t.length && !t.includes("="));
937
- if (!n) {
935
+ let i = this.fragments.find((t) => t.length && !t.includes("="));
936
+ if (!i) {
938
937
  const t = this.fragmentParameters();
939
- t.has("id") ? n = t.get("id") : t.has("name") && (n = t.get("name"));
938
+ t.has("id") ? i = t.get("id") : t.has("name") && (i = t.get("name"));
940
939
  }
941
- return n != null && n.startsWith("#") ? n.slice(1) : n;
940
+ return i != null && i.startsWith("#") ? i.slice(1) : i;
942
941
  };
943
942
  H.prototype.page = function() {
944
- const n = parseInt(this.fragmentParameters().get("page"));
945
- if (!isNaN(n) && n >= 0)
946
- return n;
943
+ const i = parseInt(this.fragmentParameters().get("page"));
944
+ if (!isNaN(i) && i >= 0)
945
+ return i;
947
946
  };
948
947
  H.prototype.time = function() {
949
- const n = parseInt(this.fragmentParameters().get("t"));
950
- if (!isNaN(n))
951
- return n;
948
+ const i = parseInt(this.fragmentParameters().get("t"));
949
+ if (!isNaN(i))
950
+ return i;
952
951
  };
953
952
  H.prototype.space = function() {
954
- const n = this.fragmentParameters();
955
- if (!n.has("xywh"))
953
+ const i = this.fragmentParameters();
954
+ if (!i.has("xywh"))
956
955
  return;
957
- const t = n.get("xywh").split(",").map((e) => parseInt(e));
956
+ const t = i.get("xywh").split(",").map((e) => parseInt(e));
958
957
  if (t.length === 4 && !t.some(isNaN))
959
958
  return t;
960
959
  };
961
- let DA = class eA {
960
+ let bA = class AA {
962
961
  /** Creates a [Price]. */
963
962
  constructor(t) {
964
963
  this.currency = t.currency, this.value = t.value;
@@ -974,7 +973,7 @@ let DA = class eA {
974
973
  return;
975
974
  let A = D(t.value);
976
975
  if (A !== void 0)
977
- return new eA({ currency: e, value: A });
976
+ return new AA({ currency: e, value: A });
978
977
  }
979
978
  /**
980
979
  * Serializes a [Price] to its RWPM JSON representation.
@@ -982,7 +981,7 @@ let DA = class eA {
982
981
  serialize() {
983
982
  return { currency: this.currency, value: this.value };
984
983
  }
985
- }, bA = class Ft {
984
+ }, vA = class Ft {
986
985
  /** Creates a [Acquisition]. */
987
986
  constructor(t) {
988
987
  this.type = t.type, this.children = t.children;
@@ -1008,7 +1007,8 @@ let DA = class eA {
1008
1007
  const t = { type: this.type };
1009
1008
  return this.children && (t.children = this.children.map((e) => e.serialize())), t;
1010
1009
  }
1011
- }, PA = class AA {
1010
+ };
1011
+ class te {
1012
1012
  /** Creates a [Price]. */
1013
1013
  constructor(t) {
1014
1014
  this.total = t.total, this.position = t.position;
@@ -1018,7 +1018,7 @@ let DA = class eA {
1018
1018
  */
1019
1019
  static deserialize(t) {
1020
1020
  if (t)
1021
- return new AA({
1021
+ return new te({
1022
1022
  total: D(t.total),
1023
1023
  position: D(t.position)
1024
1024
  });
@@ -1030,7 +1030,7 @@ let DA = class eA {
1030
1030
  const t = {};
1031
1031
  return this.total !== void 0 && (t.total = this.total), this.position !== void 0 && (t.position = this.position), t;
1032
1032
  }
1033
- };
1033
+ }
1034
1034
  class ee {
1035
1035
  /** Creates a [Copies]. */
1036
1036
  constructor(t) {
@@ -1054,7 +1054,7 @@ class ee {
1054
1054
  return this.total !== void 0 && (t.total = this.total), this.available !== void 0 && (t.available = this.available), t;
1055
1055
  }
1056
1056
  }
1057
- let vA = class iA {
1057
+ let PA = class iA {
1058
1058
  /** Creates a [Availability]. */
1059
1059
  constructor(t) {
1060
1060
  this.state = t.state, this.since = t.since, this.until = t.until;
@@ -1078,79 +1078,79 @@ let vA = 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
- R.prototype.getNumberOfItems = function() {
1081
+ Q.prototype.getNumberOfItems = function() {
1082
1082
  return D(this.otherProperties.numberOfItems);
1083
1083
  };
1084
- R.prototype.getPrice = function() {
1085
- return DA.deserialize(this.otherProperties.price);
1084
+ Q.prototype.getPrice = function() {
1085
+ return bA.deserialize(this.otherProperties.price);
1086
1086
  };
1087
- R.prototype.getIndirectAcquisitions = function() {
1088
- const n = this.otherProperties.indirectAcquisition;
1089
- if (n && n instanceof Array)
1090
- return n.map((t) => bA.deserialize(t)).filter((t) => t !== void 0);
1087
+ Q.prototype.getIndirectAcquisitions = function() {
1088
+ const i = this.otherProperties.indirectAcquisition;
1089
+ if (i && i instanceof Array)
1090
+ return i.map((t) => vA.deserialize(t)).filter((t) => t !== void 0);
1091
1091
  };
1092
- R.prototype.getHolds = function() {
1093
- return PA.deserialize(this.otherProperties.holds);
1092
+ Q.prototype.getHolds = function() {
1093
+ return te.deserialize(this.otherProperties.holds);
1094
1094
  };
1095
- R.prototype.getCopies = function() {
1095
+ Q.prototype.getCopies = function() {
1096
1096
  return ee.deserialize(this.otherProperties.copies);
1097
1097
  };
1098
- R.prototype.getAvailability = function() {
1099
- return vA.deserialize(this.otherProperties.availability);
1098
+ Q.prototype.getAvailability = function() {
1099
+ return PA.deserialize(this.otherProperties.availability);
1100
1100
  };
1101
- R.prototype.getAuthenticate = function() {
1101
+ Q.prototype.getAuthenticate = function() {
1102
1102
  return X.deserialize(this.otherProperties.authenticate);
1103
1103
  };
1104
- var I = /* @__PURE__ */ ((n) => (n.auto = "auto", n.btt = "btt", n.ltr = "ltr", n.rtl = "rtl", n.ttb = "ttb", n))(I || {});
1105
- R.prototype.getClipped = function() {
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() {
1106
1106
  return this.otherProperties.clipped;
1107
1107
  };
1108
- R.prototype.getFit = function() {
1108
+ Q.prototype.getFit = function() {
1109
1109
  return this.otherProperties.fit;
1110
1110
  };
1111
- R.prototype.getOrientation = function() {
1111
+ Q.prototype.getOrientation = function() {
1112
1112
  return this.otherProperties.orientation;
1113
1113
  };
1114
- R.prototype.getOverflow = function() {
1114
+ Q.prototype.getOverflow = function() {
1115
1115
  return this.otherProperties.overflow;
1116
1116
  };
1117
- R.prototype.getPage = function() {
1117
+ Q.prototype.getPage = function() {
1118
1118
  return this.otherProperties.page || void 0;
1119
1119
  };
1120
- R.prototype.getSpread = function() {
1120
+ Q.prototype.getSpread = function() {
1121
1121
  return this.otherProperties.spread || void 0;
1122
1122
  };
1123
1123
  var K;
1124
- (function(n) {
1125
- n.NONE = "none", n.DESCENDANT = "descendant", n.CHILD = "child";
1124
+ (function(i) {
1125
+ i.NONE = "none", i.DESCENDANT = "descendant", i.CHILD = "child";
1126
1126
  })(K || (K = {}));
1127
- var P;
1128
- (function(n) {
1129
- n.id = "id", n.class = "class", n.tag = "tag", n.attribute = "attribute", n.nthchild = "nthchild", n.nthoftype = "nthoftype";
1130
- })(P || (P = {}));
1127
+ var v;
1128
+ (function(i) {
1129
+ i.id = "id", i.class = "class", i.tag = "tag", i.attribute = "attribute", i.nthchild = "nthchild", i.nthoftype = "nthoftype";
1130
+ })(v || (v = {}));
1131
1131
  const GA = "CssSelectorGenerator";
1132
- function Be(n = "unknown problem", ...t) {
1133
- console.warn(`${GA}: ${n}`, ...t);
1132
+ function Be(i = "unknown problem", ...t) {
1133
+ console.warn(`${GA}: ${i}`, ...t);
1134
1134
  }
1135
- P.id, P.class, P.tag, P.attribute, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY;
1136
- function HA(n) {
1137
- return n instanceof RegExp;
1135
+ v.id, v.class, v.tag, v.attribute, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY;
1136
+ function HA(i) {
1137
+ return i instanceof RegExp;
1138
1138
  }
1139
- function kA(n) {
1140
- return n.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
1139
+ function kA(i) {
1140
+ return i.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
1141
1141
  }
1142
- function JA(n) {
1143
- const t = n.map((e) => {
1142
+ function JA(i) {
1143
+ const t = i.map((e) => {
1144
1144
  if (HA(e))
1145
1145
  return (A) => e.test(A);
1146
1146
  if (typeof e == "function")
1147
1147
  return (A) => {
1148
- const i = e(A);
1149
- return typeof i != "boolean" ? (Be("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : i;
1148
+ const n = e(A);
1149
+ return typeof n != "boolean" ? (Be("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : n;
1150
1150
  };
1151
1151
  if (typeof e == "string") {
1152
1152
  const A = new RegExp("^" + kA(e) + "$");
1153
- return (i) => A.test(i);
1153
+ return (n) => A.test(n);
1154
1154
  }
1155
1155
  return Be("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
1156
1156
  });
@@ -1158,7 +1158,7 @@ function JA(n) {
1158
1158
  }
1159
1159
  const WA = "", LA = " > ", OA = " ";
1160
1160
  K.NONE + "", K.NONE, K.DESCENDANT + "", K.DESCENDANT, K.CHILD + "", K.CHILD;
1161
- P.nthoftype, P.tag, P.id, P.class, P.attribute, P.nthchild;
1161
+ v.nthoftype, v.tag, v.id, v.class, v.attribute, v.nthchild;
1162
1162
  JA([
1163
1163
  "class",
1164
1164
  "id",
@@ -1184,21 +1184,21 @@ class ZA extends XA {
1184
1184
  const KA = `@namespace url(http://www.w3.org/1999/xhtml);@namespace epub url(http://www.idpf.org/2007/ops);@namespace m url(http://www.w3.org/1998/Math/MathML);@namespace svg url(http://www.w3.org/2000/svg);:root{--RS__viewportWidth:100%;--RS__pageGutter:0;--RS__defaultLineLength:40rem;--RS__colGap:0;--RS__colCount:1;--RS__colWidth:100vw}@page{margin:0!important}:root{position:relative;-webkit-column-width:var(--RS__colWidth);-moz-column-width:var(--RS__colWidth);column-width:var(--RS__colWidth);-webkit-column-count:var(--RS__colCount);-moz-column-count:var(--RS__colCount);column-count:var(--RS__colCount);-webkit-column-gap:var(--RS__colGap);-moz-column-gap:var(--RS__colGap);column-gap:var(--RS__colGap);-moz-column-fill:auto;column-fill:auto;width:var(--RS__viewportWidth);height:100vh;max-width:var(--RS__viewportWidth);max-height:100vh;min-width:var(--RS__viewportWidth);min-height:100vh;padding:0!important;margin:0!important;font-size:1rem!important;box-sizing:border-box;-webkit-touch-callout:none}body{width:100%;max-width:var(--RS__defaultLineLength)!important;padding:0 var(--RS__pageGutter)!important;margin:0 auto!important;overflow:hidden;box-sizing:border-box}@supports (overflow: clip){:root{overflow:clip}body{overflow:clip;overflow-clip-margin:content-box}}:root[style*=readium-scroll-on]{-webkit-columns:auto auto!important;-moz-columns:auto auto!important;columns:auto auto!important;width:auto!important;height:auto!important;max-width:none!important;max-height:none!important;min-width:0!important;min-height:0!important}:root[style*=readium-scroll-on] body{max-width:var(--RS__defaultLineLength)!important;overflow:auto}@supports (overflow: clip){:root[style*=readium-scroll-on]{overflow:auto}:root[style*=readium-scroll-on] body{overflow:clip}}:root[style*=readium-night-on]{--RS__selectionTextColor:inherit;--RS__selectionBackgroundColor:#b4d8fe;--RS__visitedColor:#0099E5;--RS__linkColor:#63caff;--RS__textColor:#FEFEFE;--RS__backgroundColor:#000000}:root[style*=readium-night-on] *:not(a){color:inherit!important;background-color:transparent!important;border-color:currentcolor!important}:root[style*=readium-night-on] svg text{fill:currentcolor!important;stroke:none!important}:root[style*=readium-night-on] a:link,:root[style*=readium-night-on] a:link *{color:var(--RS__linkColor)!important}:root[style*=readium-night-on] a:visited,:root[style*=readium-night-on] a:visited *{color:var(--RS__visitedColor)!important}:root[style*=readium-night-on] img[class*=gaiji],:root[style*=readium-night-on] *[epub\\:type~=titlepage] img:only-child,:root[style*=readium-night-on] *[epub|type~=titlepage] img:only-child{-webkit-filter:invert(100%);filter:invert(100%)}:root[style*=readium-sepia-on]{--RS__selectionTextColor:inherit;--RS__selectionBackgroundColor:#b4d8fe;--RS__visitedColor:#551A8B;--RS__linkColor:#0000EE;--RS__textColor:#121212;--RS__backgroundColor:#faf4e8}:root[style*=readium-sepia-on] *:not(a){color:inherit!important;background-color:transparent!important}:root[style*=readium-sepia-on] a:link,:root[style*=readium-sepia-on] a:link *{color:var(--RS__linkColor)}:root[style*=readium-sepia-on] a:visited,:root[style*=readium-sepia-on] a:visited *{color:var(--RS__visitedColor)}@media screen and (-ms-high-contrast: active){:root{color:windowText!important;background-color:window!important}:root :not(#\\#):not(#\\#):not(#\\#),:root :not(#\\#):not(#\\#):not(#\\#) :not(#\\#):not(#\\#):not(#\\#) :root :not(#\\#):not(#\\#):not(#\\#) :not(#\\#):not(#\\#):not(#\\#) :not(#\\#):not(#\\#):not(#\\#){color:inherit!important;background-color:inherit!important}.readiumCSS-mo-active-default{color:highlightText!important;background-color:highlight!important}}@media screen and (-ms-high-contrast: white-on-black){:root[style*=readium-night-on] img[class*=gaiji],:root[style*=readium-night-on] *[epub\\:type~=titlepage] img:only-child,:root[style*=readium-night-on] *[epub|type~=titlepage] img:only-child{-webkit-filter:none!important;filter:none!important}:root[style*=readium-night-on][style*=readium-invert-on] img{-webkit-filter:none!important;filter:none!important}:root[style*=readium-night-on][style*=readium-darken-on][style*=readium-invert-on] img{-webkit-filter:brightness(80%);filter:brightness(80%)}}@media screen and (inverted-colors){:root[style*=readium-night-on] img[class*=gaiji],:root[style*=readium-night-on] *[epub\\:type~=titlepage] img:only-child,:root[style*=readium-night-on] *[epub|type~=titlepage] img:only-child{-webkit-filter:none!important;filter:none!important}:root[style*=readium-night-on][style*=readium-invert-on] img{-webkit-filter:none!important;filter:none!important}:root[style*=readium-night-on][style*=readium-darken-on][style*=readium-invert-on] img{-webkit-filter:brightness(80%);filter:brightness(80%)}}:root[style*=--USER__backgroundColor]{background-color:var(--USER__backgroundColor)!important}:root[style*=--USER__backgroundColor] *{background-color:transparent!important}:root[style*=--USER__textColor]{color:var(--USER__textColor)!important}:root[style*=--USER__textColor] *:not(a){color:inherit!important;background-color:transparent!important;border-color:currentcolor!important}:root[style*=--USER__textColor] svg text{fill:currentcolor!important;stroke:none!important}:root[style*=--USER__linkColor] a:link,:root[style*=--USER__linkColor] a:link *{color:var(--USER__linkColor)!important}:root[style*=--USER__visitedColor] a:visited,:root[style*=--USER__visitedColor] a:visited *{color:var(--USER__visitedColor)!important}:root[style*=--USER__selectionBackgroundColor][style*=--USER__selectionTextColor] ::-moz-selection{color:var(--USER__selectionTextColor)!important;background-color:var(--USER__selectionBackgroundColor)!important}:root[style*=--USER__selectionBackgroundColor][style*=--USER__selectionTextColor] ::selection{color:var(--USER__selectionTextColor)!important;background-color:var(--USER__selectionBackgroundColor)!important}:root[style*=--USER__colCount]{-webkit-column-count:var(--USER__colCount);-moz-column-count:var(--USER__colCount);column-count:var(--USER__colCount);--RS__colWidth:auto}:root[style*="--USER__colCount: 0"],:root[style*="--USER__colCount:0"]{-webkit-column-count:1;-moz-column-count:1;column-count:1}:root[style*="--USER__colCount: 0"],:root[style*="--USER__colCount:0"],:root[style*="--USER__colCount: 1"],:root[style*="--USER__colCount:1"]{--RS__colWidth:100vw}:root[style*=--USER__lineLength] body{max-width:var(--USER__lineLength)!important}:root[style*=--USER__textAlign]{text-align:var(--USER__textAlign)}:root[style*=--USER__textAlign] body,:root[style*=--USER__textAlign] p:not(blockquote p):not(figcaption p):not(hgroup p),:root[style*=--USER__textAlign] li,:root[style*=--USER__textAlign] dd{text-align:var(--USER__textAlign)!important;-moz-text-align-last:auto!important;-epub-text-align-last:auto!important;text-align-last:auto!important}:root[style*=--USER__bodyHyphens]{-webkit-hyphens:var(--USER__bodyHyphens)!important;-moz-hyphens:var(--USER__bodyHyphens)!important;-ms-hyphens:var(--USER__bodyHyphens)!important;-epub-hyphens:var(--USER__bodyHyphens)!important;hyphens:var(--USER__bodyHyphens)!important}:root[style*=--USER__bodyHyphens] body,:root[style*=--USER__bodyHyphens] p,:root[style*=--USER__bodyHyphens] li,:root[style*=--USER__bodyHyphens] div,:root[style*=--USER__bodyHyphens] dd{-webkit-hyphens:inherit;-moz-hyphens:inherit;-ms-hyphens:inherit;-epub-hyphens:inherit;hyphens:inherit}:root[style*=readium-font-on][style*=--USER__fontFamily]{font-family:var(--USER__fontFamily)!important}:root[style*=readium-font-on][style*=--USER__fontFamily] *{font-family:revert!important}:root[style*=readium-font-on][style*=AccessibleDfA]{font-family:AccessibleDfA,Verdana,Tahoma,Trebuchet MS,sans-serif!important}:root[style*=readium-font-on][style*="IA Writer Duospace"]{font-family:IA Writer Duospace,Menlo,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier,monospace!important}:root[style*=readium-font-on][style*=AccessibleDfA],:root[style*=readium-font-on][style*="IA Writer Duospace"],:root[style*=readium-a11y-on]{font-style:normal!important;font-weight:400!important}:root[style*=readium-font-on][style*=AccessibleDfA] *:not(code):not(var):not(kbd):not(samp),:root[style*=readium-font-on][style*="IA Writer Duospace"] *:not(code):not(var):not(kbd):not(samp),:root[style*=readium-a11y-on] *:not(code):not(var):not(kbd):not(samp){font-family:inherit!important;font-style:inherit!important;font-weight:inherit!important}:root[style*=readium-font-on][style*=AccessibleDfA] *,:root[style*=readium-font-on][style*="IA Writer Duospace"] *,:root[style*=readium-a11y-on] *{text-decoration:none!important;font-variant-caps:normal!important;font-variant-numeric:normal!important;font-variant-position:normal!important}:root[style*=readium-font-on][style*=AccessibleDfA] sup,:root[style*=readium-font-on][style*="IA Writer Duospace"] sup,:root[style*=readium-a11y-on] sup,:root[style*=readium-font-on][style*=AccessibleDfA] sub,:root[style*=readium-font-on][style*="IA Writer Duospace"] sub,:root[style*=readium-a11y-on] sub{font-size:1rem!important;vertical-align:baseline!important}:root:not([style*=readium-deprecatedFontSize-on])[style*=--USER__fontSize] body{zoom:var(--USER__fontSize)!important}@supports not (zoom: 1){:root[style*=--USER__fontSize]{font-size:var(--USER__fontSize)!important}}:root[style*=readium-deprecatedFontSize-on][style*=--USER__fontSize]{font-size:var(--USER__fontSize)!important}:root[style*=--USER__lineHeight]{line-height:var(--USER__lineHeight)!important}:root[style*=--USER__lineHeight] body,:root[style*=--USER__lineHeight] p,:root[style*=--USER__lineHeight] li,:root[style*=--USER__lineHeight] div{line-height:inherit}:root[style*=--USER__paraSpacing] p{margin-top:var(--USER__paraSpacing)!important;margin-bottom:var(--USER__paraSpacing)!important}:root[style*=--USER__paraIndent] p{text-indent:var(--USER__paraIndent)!important}:root[style*=--USER__paraIndent] p *,:root[style*=--USER__paraIndent] p:first-letter{text-indent:0!important}:root[style*=--USER__wordSpacing] h1,:root[style*=--USER__wordSpacing] h2,:root[style*=--USER__wordSpacing] h3,:root[style*=--USER__wordSpacing] h4,:root[style*=--USER__wordSpacing] h5,:root[style*=--USER__wordSpacing] h6,:root[style*=--USER__wordSpacing] p,:root[style*=--USER__wordSpacing] li,:root[style*=--USER__wordSpacing] div,:root[style*=--USER__wordSpacing] dt,:root[style*=--USER__wordSpacing] dd{word-spacing:var(--USER__wordSpacing)}:root[style*=--USER__letterSpacing] h1,:root[style*=--USER__letterSpacing] h2,:root[style*=--USER__letterSpacing] h3,:root[style*=--USER__letterSpacing] h4,:root[style*=--USER__letterSpacing] h5,:root[style*=--USER__letterSpacing] h6,:root[style*=--USER__letterSpacing] p,:root[style*=--USER__letterSpacing] li,:root[style*=--USER__letterSpacing] div,:root[style*=--USER__letterSpacing] dt,:root[style*=--USER__letterSpacing] dd{letter-spacing:var(--USER__letterSpacing);font-variant:none}:root[style*=readium-font-on][style*=--USER__fontWeight] body{font-weight:var(--USER__fontWeight)!important}:root[style*=readium-font-on][style*=--USER__fontWeight] b,:root[style*=readium-font-on][style*=--USER__fontWeight] strong{font-weight:bolder}:root[style*=readium-font-on][style*=--USER__fontWidth] body{font-stretch:var(--USER__fontWidth)!important}:root[style*=readium-font-on][style*=--USER__fontOpticalSizing] body{font-optical-sizing:var(--USER__fontOpticalSizing)!important}:root[style*=readium-blend-on] svg,:root[style*=readium-blend-on] img{background-color:transparent!important;mix-blend-mode:multiply!important}:root[style*=--USER__darkenImages] img{-webkit-filter:brightness(var(--USER__darkenImages))!important;filter:brightness(var(--USER__darkenImages))!important}:root[style*=readium-darken-on] img{-webkit-filter:brightness(80%)!important;filter:brightness(80%)!important}:root[style*=--USER__invertImages] img{-webkit-filter:invert(var(--USER__invertImages))!important;filter:invert(var(--USER__invertImages))!important}:root[style*=readium-invert-on] img{-webkit-filter:invert(100%)!important;filter:invert(100%)!important}:root[style*=--USER__darkenImages][style*=--USER__invertImages] img{-webkit-filter:brightness(var(--USER__darkenImages)) invert(var(--USER__invertImages))!important;filter:brightness(var(--USER__darkenImages)) invert(var(--USER__invertImages))!important}:root[style*=readium-darken-on][style*=--USER__invertImages] img{-webkit-filter:brightness(80%) invert(var(--USER__invertImages))!important;filter:brightness(80%) invert(var(--USER__invertImages))!important}:root[style*=--USER__darkenImages][style*=readium-invert-on] img{-webkit-filter:brightness(var(--USER__darkenImages)) invert(100%)!important;filter:brightness(var(--USER__darkenImages)) invert(100%)!important}:root[style*=readium-darken-on][style*=readium-invert-on] img{-webkit-filter:brightness(80%) invert(100%)!important;filter:brightness(80%) invert(100%)!important}:root[style*=--USER__invertGaiji] img[class*=gaiji]{-webkit-filter:invert(var(--USER__invertGaiji))!important;filter:invert(var(--USER__invertGaiji))!important}:root[style*=readium-invertGaiji-on] img[class*=gaiji]{-webkit-filter:invert(100%)!important;filter:invert(100%)!important}:root[style*=readium-normalize-on]{--USER__typeScale:1.2}:root[style*=readium-normalize-on] p,:root[style*=readium-normalize-on] li,:root[style*=readium-normalize-on] div,:root[style*=readium-normalize-on] pre,:root[style*=readium-normalize-on] dd{font-size:1rem!important}:root[style*=readium-normalize-on] h1{font-size:1.75rem!important;font-size:calc(((1rem * var(--USER__typeScale)) * var(--USER__typeScale)) * var(--USER__typeScale))!important}:root[style*=readium-normalize-on] h2{font-size:1.5rem!important;font-size:calc((1rem * var(--USER__typeScale)) * var(--USER__typeScale))!important}:root[style*=readium-normalize-on] h3{font-size:1.25rem!important;font-size:calc(1rem * var(--USER__typeScale))!important}:root[style*=readium-normalize-on] h4,:root[style*=readium-normalize-on] h5,:root[style*=readium-normalize-on] h6{font-size:1rem!important}:root[style*=readium-normalize-on] small{font-size:smaller!important}:root[style*=readium-normalize-on] sub,:root[style*=readium-normalize-on] sup{font-size:67.5%!important}:root[style*=readium-normalize-on][style*=--USER__typeScale] h1{font-size:calc(((1rem * var(--USER__typeScale)) * var(--USER__typeScale)) * var(--USER__typeScale))!important}:root[style*=readium-normalize-on][style*=--USER__typeScale] h2{font-size:calc((1rem * var(--USER__typeScale)) * var(--USER__typeScale))!important}:root[style*=readium-normalize-on][style*=--USER__typeScale] h3{font-size:calc(1rem * var(--USER__typeScale))!important}:root[style*=readium-iPadOSPatch-on] body{-webkit-text-size-adjust:none}:root[style*=readium-iPadOSPatch-on] p,:root[style*=readium-iPadOSPatch-on] h1,:root[style*=readium-iPadOSPatch-on] h2,:root[style*=readium-iPadOSPatch-on] h3,:root[style*=readium-iPadOSPatch-on] h4,:root[style*=readium-iPadOSPatch-on] h5,:root[style*=readium-iPadOSPatch-on] h6,:root[style*=readium-iPadOSPatch-on] li,:root[style*=readium-iPadOSPatch-on] th,:root[style*=readium-iPadOSPatch-on] td,:root[style*=readium-iPadOSPatch-on] dt,:root[style*=readium-iPadOSPatch-on] dd,:root[style*=readium-iPadOSPatch-on] pre,:root[style*=readium-iPadOSPatch-on] address,:root[style*=readium-iPadOSPatch-on] details,:root[style*=readium-iPadOSPatch-on] summary,:root[style*=readium-iPadOSPatch-on] figcaption,:root[style*=readium-iPadOSPatch-on] div:not(:has(p,h1,h2,h3,h4,h5,h6,li,th,td,dt,dd,pre,address,aside,details,figcaption,summary)),:root[style*=readium-iPadOSPatch-on] aside:not(:has(p,h1,h2,h3,h4,h5,h6,li,th,td,dt,dd,pre,address,aside,details,figcaption,summary)){-webkit-text-zoom:reset}:root[style*=readium-iPadOSPatch-on] abbr,:root[style*=readium-iPadOSPatch-on] b,:root[style*=readium-iPadOSPatch-on] bdi,:root[style*=readium-iPadOSPatch-on] bdo,:root[style*=readium-iPadOSPatch-on] cite,:root[style*=readium-iPadOSPatch-on] code,:root[style*=readium-iPadOSPatch-on] dfn,:root[style*=readium-iPadOSPatch-on] em,:root[style*=readium-iPadOSPatch-on] i,:root[style*=readium-iPadOSPatch-on] kbd,:root[style*=readium-iPadOSPatch-on] mark,:root[style*=readium-iPadOSPatch-on] q,:root[style*=readium-iPadOSPatch-on] rp,:root[style*=readium-iPadOSPatch-on] rt,:root[style*=readium-iPadOSPatch-on] ruby,:root[style*=readium-iPadOSPatch-on] s,:root[style*=readium-iPadOSPatch-on] samp,:root[style*=readium-iPadOSPatch-on] small,:root[style*=readium-iPadOSPatch-on] span,:root[style*=readium-iPadOSPatch-on] strong,:root[style*=readium-iPadOSPatch-on] sub,:root[style*=readium-iPadOSPatch-on] sup,:root[style*=readium-iPadOSPatch-on] time,:root[style*=readium-iPadOSPatch-on] u,:root[style*=readium-iPadOSPatch-on] var{-webkit-text-zoom:normal}:root[style*=readium-iPadOSPatch-on] p:not(:has(b,cite,em,i,q,s,small,span,strong)):first-line{-webkit-text-zoom:normal}
1185
1185
  `, qA = `@namespace url(http://www.w3.org/1999/xhtml);@namespace epub url(http://www.idpf.org/2007/ops);@namespace m url(http://www.w3.org/1998/Math/MathML);@namespace svg url(http://www.w3.org/2000/svg);@-ms-viewport{width:device-width}@viewport{width:device-width;zoom:1}:root{--RS__monospaceTf:ui-monospace, "Andale Mono", "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;--RS__humanistTf:Seravek, Calibri, "Gill Sans Nova", Roboto, Ubuntu, "DejaVu Sans", source-sans-pro, sans-serif;--RS__sansTf:-ui-sans-serif, -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", "Arial Nova", "Liberation Sans", Arial, sans-serif;--RS__modernTf:Athelas, Constantia, Charter, "Bitstream Charter", Cambria, "Georgia Pro", Georgia, serif;--RS__oldStyleTf:"Iowan Old Style", Sitka, "Sitka Text", Palatino, "Book Antiqua", "URW Palladio L", P052, serif;--RS__baseFontFamily:var(--RS__oldStyleTf);--RS__lineHeightCompensation:1;--RS__baseLineHeight:calc(1.5 * var(--RS__lineHeightCompensation))}html{font-family:var(--RS__baseFontFamily);line-height:1.6;line-height:var(--RS__baseLineHeight);text-rendering:optimizelegibility}h1,h2,h3{line-height:normal}:lang(ja),:lang(zh),:lang(ko){word-wrap:break-word;-webkit-line-break:strict;-epub-line-break:strict;line-break:strict}math{font-family:"Latin Modern Math","STIX Two Math","XITS Math","STIX Math","Libertinus Math","TeX Gyre Termes Math","TeX Gyre Bonum Math",TeX Gyre Schola,"DejaVu Math TeX Gyre","TeX Gyre Pagella Math","Asana Math","Cambria Math","Lucida Bright Math","Minion Math",STIXGeneral,STIXSizeOneSym,Symbol,Times New Roman,serif}:lang(am){--RS__baseFontFamily:kefa, nyala, roboto, noto, "Noto Sans Ethiopic", serif;--RS__lineHeightCompensation:1.167}:lang(ar){--RS__baseFontFamily:"Geeza Pro", "Arabic Typesetting", roboto, noto, "Noto Naskh Arabic", "Times New Roman", serif}:lang(bn){--RS__baseFontFamily:"Kohinoor Bangla", "Bangla Sangam MN", vrinda, roboto, noto, "Noto Sans Bengali", sans-serif;--RS__lineHeightCompensation:1.067}:lang(bo){--RS__baseFontFamily:kailasa, "Microsoft Himalaya", roboto, noto, "Noto Sans Tibetan", sans-serif}:lang(chr){--RS__baseFontFamily:"Plantagenet Cherokee", roboto, noto, "Noto Sans Cherokee";--RS__lineHeightCompensation:1.167}:lang(fa){--RS__baseFontFamily:"Geeza Pro", "Arabic Typesetting", roboto, noto, "Noto Naskh Arabic", "Times New Roman", serif}:lang(gu){--RS__baseFontFamily:"Gujarati Sangam MN", "Nirmala UI", shruti, roboto, noto, "Noto Sans Gujarati", sans-serif;--RS__lineHeightCompensation:1.167}:lang(he){--RS__baseFontFamily:"New Peninim MT", "Arial Hebrew", gisha, "Times New Roman", roboto, noto, "Noto Sans Hebrew" sans-serif;--RS__lineHeightCompensation:1.1}:lang(hi){--RS__baseFontFamily:"Kohinoor Devanagari", "Devanagari Sangam MN", kokila, "Nirmala UI", roboto, noto, "Noto Sans Devanagari", sans-serif;--RS__lineHeightCompensation:1.1}:lang(hy){--RS__baseFontFamily:mshtakan, sylfaen, roboto, noto, "Noto Serif Armenian", serif}:lang(iu){--RS__baseFontFamily:"Euphemia UCAS", euphemia, roboto, noto, "Noto Sans Canadian Aboriginal", sans-serif}:lang(ja){--RS__baseFontFamily:yugothic, "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo UI", "MS Gothic", roboto, noto, "Noto Sans CJK JP", sans-serif;--RS__lineHeightCompensation:1.167;--RS__serif-ja:"Hiragino Mincho ProN", "Hiragino Mincho Pro", "YuMincho", "BIZ UDPMincho", "Yu Mincho", "MS P明朝", "MS PMincho", serif;--RS__sans-serif-ja:"Hiragino Sans", "Hiragino Kaku Gothic ProN", "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ W3", "YuGothic", "Yu Gothic Medium", "BIZ UDPGothic", "Yu Gothic", "MS Pゴシック", "MS PGothic", sans-serif;--RS__serif-ja-v:"Hiragino Mincho ProN", "Hiragino Mincho Pro", "YuMincho", "BIZ UDMincho", "Yu Mincho", "MS明朝", "MS Mincho", serif;--RS__sans-serif-ja-v:"Hiragino Sans", "Hiragino Kaku Gothic ProN", "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ W3", "YuGothic", "Yu Gothic Medium", "BIZ UDGothic", "Yu Gothic", "MSゴシック", "MS Gothic", sans-serif}:lang(km){--RS__baseFontFamily:"Khmer Sangam MN", "Leelawadee UI", "Khmer UI", roboto, noto, "Noto Sans Khmer", sans-serif;--RS__lineHeightCompensation:1.067}:lang(kn){--RS__baseFontFamily:"Kannada Sangam MN", "Nirmala UI", tunga, roboto, noto, "Noto Sans Kannada", sans-serif;--RS__lineHeightCompensation:1.1}:lang(ko){--RS__baseFontFamily:"Nanum Gothic", "Apple SD Gothic Neo", "Malgun Gothic", roboto, noto, "Noto Sans CJK KR", sans-serif;--RS__lineHeightCompensation:1.167}:lang(lo){--RS__baseFontFamily:"Lao Sangam MN", "Leelawadee UI", "Lao UI", roboto, noto, "Noto Sans Lao", sans-serif}:lang(ml){--RS__baseFontFamily:"Malayalam Sangam MN", "Nirmala UI", kartika, roboto, noto, "Noto Sans Malayalam", sans-serif;--RS__lineHeightCompensation:1.067}:lang(or){--RS__baseFontFamily:"Oriya Sangam MN", "Nirmala UI", kalinga, roboto, noto, "Noto Sans Oriya", sans-serif;--RS__lineHeightCompensation:1.167}:lang(pa){--RS__baseFontFamily:"Gurmukhi MN", "Nirmala UI", kartika, roboto, noto, "Noto Sans Gurmukhi", sans-serif;--RS__lineHeightCompensation:1.1}:lang(si){--RS__baseFontFamily:"Sinhala Sangam MN", "Nirmala UI", "Iskoola Pota", roboto, noto, "Noto Sans Sinhala", sans-serif;--RS__lineHeightCompensation:1.167}:lang(ta){--RS__baseFontFamily:"Tamil Sangam MN", "Nirmala UI", latha, roboto, noto, "Noto Sans Tamil", sans-serif;--RS__lineHeightCompensation:1.067}:lang(te){--RS__baseFontFamily:"Kohinoor Telugu", "Telugu Sangam MN", "Nirmala UI", gautami, roboto, noto, "Noto Sans Telugu", sans-serif}:lang(th){--RS__baseFontFamily:"Thonburi", "Leelawadee UI", "Cordia New", roboto, noto, "Noto Sans Thai", sans-serif;--RS__lineHeightCompensation:1.067}:lang(zh){--RS__baseFontFamily:"方体", "PingFang SC", "黑体", "Heiti SC", "Microsoft JhengHei UI", "Microsoft JhengHei", roboto, noto, "Noto Sans CJK SC", sans-serif;--RS__lineHeightCompensation:1.167}:lang(zh-Hant),:lang(zh-TW){--RS__baseFontFamily:"方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", roboto, noto, "Noto Sans CJK TC", sans-serif;--RS__lineHeightCompensation:1.167}:lang(zh-HK){--RS__baseFontFamily:"方體", "PingFang HK", "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", roboto, noto, "Noto Sans CJK TC", sans-serif;--RS__lineHeightCompensation:1.167}:root{--RS__selectionTextColor:inherit;--RS__selectionBackgroundColor:#b4d8fe;--RS__visitedColor:#551A8B;--RS__linkColor:#0000EE;--RS__textColor:#121212;--RS__backgroundColor:#FFFFFF}:root{color:var(--RS__textColor)!important;background-color:var(--RS__backgroundColor)!important}::-moz-selection{color:var(--RS__selectionTextColor);background-color:var(--RS__selectionBackgroundColor)}::selection{color:var(--RS__selectionTextColor);background-color:var(--RS__selectionBackgroundColor)}@font-face{font-family:AccessibleDfA;font-style:normal;font-weight:400;src:local("AccessibleDfA"),url(./assets/AccessibleDfA-Regular.woff2) format("woff2"),url(./assets/AccessibleDfA-Regular.woff) format("woff")}@font-face{font-family:AccessibleDfA;font-style:normal;font-weight:700;src:local("AccessibleDfA"),url(./assets/AccessibleDfA-Bold.woff2) format("woff2")}@font-face{font-family:AccessibleDfA;font-style:italic;font-weight:400;src:local("AccessibleDfA"),url(./assets/AccessibleDfA-Italic.woff2) format("woff2")}@font-face{font-family:IA Writer Duospace;font-style:normal;font-weight:400;src:local("iAWriterDuospace-Regular"),url(./assets/iAWriterDuospace-Regular.ttf) format("truetype")}body{widows:2;orphans:2}figcaption,th,td{widows:1;orphans:1}h2,h3,h4,h5,h6,dt,hr,caption{-webkit-column-break-after:avoid;page-break-after:avoid;break-after:avoid}h1,h2,h3,h4,h5,h6,dt,figure,tr{-webkit-column-break-inside:avoid;page-break-inside:avoid;break-inside:avoid}body{-webkit-hyphenate-character:"-";-moz-hyphenate-character:"-";-ms-hyphenate-character:"-";hyphenate-character:"-";-webkit-hyphenate-limit-lines:3;-ms-hyphenate-limit-lines:3;hyphenate-limit-lines:3}h1,h2,h3,h4,h5,h6,dt,figcaption,pre,caption,address,center,code,var{-ms-hyphens:none;-moz-hyphens:none;-webkit-hyphens:none;-epub-hyphens:none;hyphens:none}body{font-variant-numeric:oldstyle-nums proportional-nums}:lang(ja) body,:lang(zh) body,:lang(ko) body{font-variant-numeric:lining-nums proportional-nums}h1,h2,h3,h4,h5,h6,dt{font-variant-numeric:lining-nums proportional-nums}table{font-variant-numeric:lining-nums tabular-nums}code,var{font-variant-ligatures:none;font-variant-numeric:lining-nums tabular-nums slashed-zero}rt{font-variant-east-asian:ruby}:lang(ar){font-variant-ligatures:common-ligatures}:lang(ko){font-kerning:normal}hr{color:inherit;border-color:currentcolor}table,th,td{border-color:currentcolor}figure,blockquote{margin:1em 5%}ul,ol{padding-left:5%}dd{margin-left:5%}pre{white-space:pre-wrap;-ms-tab-size:2;-moz-tab-size:2;-webkit-tab-size:2;tab-size:2}abbr[title],acronym[title]{text-decoration:dotted underline}nobr wbr{white-space:normal}ruby>rt,ruby>rp{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}*:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)),*:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)),*:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)),:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) cite,:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) dfn,:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) em,:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) i,:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) cite,:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) dfn,:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) em,:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) i,:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) cite,:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) dfn,:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) em,:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) i{font-style:normal}:lang(ja) a,:lang(zh) a,:lang(ko) a{text-decoration:none}:root{--RS__maxMediaWidth:100%;--RS__maxMediaHeight:95vh;--RS__boxSizingMedia:border-box;--RS__boxSizingTable:border-box}a,a span,span a,h1,h2,h3,h4,h5,h6{word-wrap:break-word}div{max-width:var(--RS__maxMediaWidth)}img,svg|svg,video{object-fit:contain;width:auto;height:auto;max-width:var(--RS__maxMediaWidth);max-height:var(--RS__maxMediaHeight)!important;box-sizing:var(--RS__boxSizingMedia);-webkit-column-break-inside:avoid;page-break-inside:avoid;break-inside:avoid}audio{max-width:100%;-webkit-column-break-inside:avoid;page-break-inside:avoid;break-inside:avoid}table{max-width:var(--RS__maxMediaWidth);box-sizing:var(--RS__boxSizingTable)}
1186
1186
  `, _A = `@namespace url(http://www.w3.org/1999/xhtml);@namespace epub url(http://www.idpf.org/2007/ops);@namespace m url(http://www.w3.org/1998/Math/MathML);@namespace svg url(http://www.w3.org/2000/svg);:root{--RS__compFontFamily:var(--RS__baseFontFamily);--RS__codeFontFamily:var(--RS__monospaceTf);--RS__typeScale:1.125;--RS__baseFontSize:100%;--RS__flowSpacing:1.5rem;--RS__paraSpacing:0;--RS__paraIndent:1em;--RS__linkColor:#0000EE;--RS__visitedColor:#551A8B;--RS__primaryColor:;--RS__secondaryColor:}body{font-size:var(--RS__baseFontSize)}h1,h2,h3,h4,h5,h6{font-family:var(--RS__compFontFamily)}blockquote,figure,p,pre,aside,footer,form,hr{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing)}p{margin-top:var(--RS__paraSpacing);margin-bottom:var(--RS__paraSpacing);text-indent:var(--RS__paraIndent)}h1+p,h2+p,h3+p,h4+p,h5+p,h6+p,hr+p{text-indent:0}pre{font-family:var(--RS__codeFontFamily)}code,kbd,samp,tt{font-family:var(--RS__codeFontFamily)}sub,sup{position:relative;font-size:67.5%;line-height:1}sub{bottom:-.2ex}sup{bottom:0}:link{color:var(--RS__linkColor)}:visited{color:var(--RS__visitedColor)}h1{margin-top:calc(var(--RS__flowSpacing) * 2);margin-bottom:calc(var(--RS__flowSpacing) * 2);font-size:calc(((1em * var(--RS__typeScale)) * var(--RS__typeScale)) * var(--RS__typeScale))}h2{margin-top:calc(var(--RS__flowSpacing) * 2);margin-bottom:var(--RS__flowSpacing);font-size:calc((1em * var(--RS__typeScale)) * var(--RS__typeScale))}h3{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing);font-size:calc(1em * var(--RS__typeScale))}h4{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing);font-size:1em}h5{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing);font-size:1em;font-variant:small-caps}h6{margin-top:var(--RS__flowSpacing);margin-bottom:0;font-size:1em;text-transform:lowercase;font-variant:small-caps}dl,ol,ul{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing)}table{margin:var(--RS__flowSpacing) 0;border:1px solid currentcolor;border-collapse:collapse;empty-cells:show}thead,tbody,tfoot,table>tr{vertical-align:top}th{text-align:left}th,td{padding:4px;border:1px solid currentcolor}
1187
- `, $ = (n, t) => URL.createObjectURL(new Blob([n], { type: t })), nA = (n) => n.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, "").replace(/\s+/g, " "), Pt = (n) => n.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " ").replace(/url\((?!(https?:)?\/\/)("?)\/([^\)]+)/g, `url($2${window.location.origin}/$3`), Ae = (n, t) => {
1188
- const e = n.createElement("script");
1187
+ `, $ = (i, t) => URL.createObjectURL(new Blob([i], { type: t })), nA = (i) => i.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, "").replace(/\s+/g, " "), vt = (i) => i.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " ").replace(/url\((?!(https?:)?\/\/)("?)\/([^\)]+)/g, `url($2${window.location.origin}/$3`), Ae = (i, t) => {
1188
+ const e = i.createElement("script");
1189
1189
  return e.dataset.readium = "true", e.src = t.startsWith("blob:") ? t : $(t, "text/javascript"), e;
1190
- }, vt = (n, t) => {
1191
- const e = n.createElement("link");
1190
+ }, Pt = (i, t) => {
1191
+ const e = i.createElement("link");
1192
1192
  return e.dataset.readium = "true", e.rel = "stylesheet", e.type = "text/css", e.href = t.startsWith("blob:") ? t : $(t, "text/css"), e;
1193
- }, Gt = /* @__PURE__ */ new Map(), ot = (n, t) => {
1194
- if (Gt.has(n))
1195
- return Gt.get(n);
1193
+ }, Gt = /* @__PURE__ */ new Map(), ot = (i, t) => {
1194
+ if (Gt.has(i))
1195
+ return Gt.get(i);
1196
1196
  const e = t();
1197
- return Gt.set(n, e), e;
1198
- }, $A = (n) => Ae(n, ot("css-selector-generator", () => $(
1197
+ return Gt.set(i, e), e;
1198
+ }, $A = (i) => Ae(i, ot("css-selector-generator", () => $(
1199
1199
  '!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports._readium_cssSelectorGenerator=e():t._readium_cssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t,e,n={d:(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};function r(t){return t&&t instanceof Element}function i(t="unknown problem",...e){console.warn(`CssSelectorGenerator: ${t}`,...e)}n.r(o),n.d(o,{default:()=>z,getCssSelector:()=>U}),function(t){t.NONE="none",t.DESCENDANT="descendant",t.CHILD="child"}(t||(t={})),function(t){t.id="id",t.class="class",t.tag="tag",t.attribute="attribute",t.nthchild="nthchild",t.nthoftype="nthoftype"}(e||(e={}));const c={selectors:[e.id,e.class,e.tag,e.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY};function u(t){return t instanceof RegExp}function s(t){return["string","function"].includes(typeof t)||u(t)}function l(t){return Array.isArray(t)?t.filter(s):[]}function a(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function f(t,e){if(a(t))return t.contains(e)||i("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element\'s real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will nto work as intended."),t;const n=e.getRootNode({composed:!1});return a(n)?(n!==document&&i("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),n):e.ownerDocument.querySelector(":root")}function d(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function m(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function p(t){return[].concat(...t)}function h(t){const e=t.map((t=>{if(u(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(i("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return i("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function g(t,e,n){const o=Array.from(f(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function y(t,e){e=null!=e?e:function(t){return t.ownerDocument.querySelector(":root")}(t);const n=[];let o=t;for(;r(o)&&o!==e;)n.push(o),o=o.parentElement;return n}function b(t,e){return m(t.map((t=>y(t,e))))}const N={[t.NONE]:{type:t.NONE,value:""},[t.DESCENDANT]:{type:t.DESCENDANT,value:" > "},[t.CHILD]:{type:t.CHILD,value:" "}},S=new RegExp(["^$","\\\\s"].join("|")),E=new RegExp(["^$"].join("|")),w=[e.nthoftype,e.tag,e.id,e.class,e.attribute,e.nthchild],v=h(["class","id","ng-*"]);function C({nodeName:t}){return`[${t}]`}function O({nodeName:t,nodeValue:e}){return`[${t}=\'${L(e)}\']`}function T(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t},e){const n=e.tagName.toLowerCase();return!(["input","option"].includes(n)&&"value"===t||v(t))}(e,t)));return[...e.map(C),...e.map(O)]}function I(t){return(t.getAttribute("class")||"").trim().split(/\\s+/).filter((t=>!E.test(t))).map((t=>`.${L(t)}`))}function x(t){const e=t.getAttribute("id")||"",n=`#${L(e)}`,o=t.getRootNode({composed:!1});return!S.test(e)&&g([t],n,o)?[n]:[]}function j(t){const e=t.parentNode;if(e){const n=Array.from(e.childNodes).filter(r).indexOf(t);if(n>-1)return[`:nth-child(${n+1})`]}return[]}function A(t){return[L(t.tagName.toLowerCase())]}function D(t){const e=[...new Set(p(t.map(A)))];return 0===e.length||e.length>1?[]:[e[0]]}function $(t){const e=D([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${r+1})`]}return[]}function R(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){const n=[];let o=0,r=k(1);for(;r.length<=t.length&&o<e;)o+=1,n.push(r.map((e=>t[e]))),r=P(r,t.length-1);return n}function P(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return k(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?k(n+1):o}function k(t=1){return Array.from(Array(t).keys())}const _=":".charCodeAt(0).toString(16).toUpperCase(),M=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function L(t=""){var e,n;return null!==(n=null===(e=null===CSS||void 0===CSS?void 0:CSS.escape)||void 0===e?void 0:e.call(CSS,t))&&void 0!==n?n:function(t=""){return t.split("").map((t=>":"===t?`\\\\${_} `:M.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const q={tag:D,id:function(t){return 0===t.length||t.length>1?[]:x(t[0])},class:function(t){return m(t.map(I))},attribute:function(t){return m(t.map(T))},nthchild:function(t){return m(t.map(j))},nthoftype:function(t){return m(t.map($))}},F={tag:A,id:x,class:I,attribute:T,nthchild:j,nthoftype:$};function V(t){return t.includes(e.tag)||t.includes(e.nthoftype)?[...t]:[...t,e.tag]}function Y(t={}){const n=[...w];return t[e.tag]&&t[e.nthoftype]&&n.splice(n.indexOf(e.tag),1),n.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function B(t,e,n="",o){const r=function(t,e){return""===e?t:function(t,e){return[...t.map((t=>e+" "+t)),...t.map((t=>e+" > "+t))]}(t,e)}(function(t,e,n){const o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=h(n),u=h(o);return function(t){const{selectors:e,includeTag:n}=t,o=[].concat(e);return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){var n;return(null!==(n=q[e])&&void 0!==n?n:()=>[])(t)}(t,n),s=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,u),l=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(s,u);return e[n]=r?R(l,{maxResults:i}):l.map((t=>[t])),e}),{})}(t,n),r=function(t,e){return function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?R(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(V):i}(e).map((e=>function(t,e){const n={};return t.forEach((t=>{const o=e[t];o.length>0&&(n[t]=o)})),function(t={}){let e=[];return Object.entries(t).forEach((([t,n])=>{e=n.flatMap((n=>0===e.length?[{[t]:n}]:e.map((e=>Object.assign(Object.assign({},e),{[t]:n})))))})),e}(n).map(Y)}(e,t))).filter((t=>t.length>0))}(o,n),i=p(r);return[...new Set(i)]}(t,o.root,o),n);for(const e of r)if(g(t,e,o.root))return e;return null}function G(t){return{value:t,include:!1}}function W({selectors:t,operator:n}){let o=[...w];t[e.tag]&&t[e.nthoftype]&&(o=o.filter((t=>t!==e.tag)));let r="";return o.forEach((e=>{(t[e]||[]).forEach((({value:t,include:e})=>{e&&(r+=t)}))})),n.value+r}function H(n){return[":root",...y(n).reverse().map((n=>{const o=function(e,n,o=t.NONE){const r={};return n.forEach((t=>{Reflect.set(r,t,function(t,e){return F[e](t)}(e,t).map(G))})),{element:e,operator:N[o],selectors:r}}(n,[e.nthchild],t.DESCENDANT);return o.selectors.nthchild.forEach((t=>{t.include=!0})),o})).map(W)].join("")}function U(t,n={}){const o=function(t){const e=(Array.isArray(t)?t:[t]).filter(r);return[...new Set(e)]}(t),i=function(t,n={}){const o=Object.assign(Object.assign({},c),n);return{selectors:(r=o.selectors,Array.isArray(r)?r.filter((t=>{return n=e,o=t,Object.values(n).includes(o);var n,o})):[]),whitelist:l(o.whitelist),blacklist:l(o.blacklist),root:f(o.root,t),combineWithinSelector:!!o.combineWithinSelector,combineBetweenSelectors:!!o.combineBetweenSelectors,includeTag:!!o.includeTag,maxCombinations:d(o.maxCombinations),maxCandidates:d(o.maxCandidates)};var r}(o[0],n);let u="",s=i.root;function a(){return function(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...b(t,e).map((t=>[t]))];for(const t of r){const e=B(t,0,n,o);if(e)return{foundElements:t,selector:e}}return null}(o,s,u,i)}let m=a();for(;m;){const{foundElements:t,selector:e}=m;if(g(o,e,i.root))return e;s=t[0],u=e,m=a()}return o.length>1?o.map((t=>U(t,i))).join(", "):function(t){return t.map(H).join(", ")}(o)}const z=U;return o})()));',
1200
1200
  "text/javascript"
1201
- ))), ti = (n) => Ae(n, ot("JS-Before", () => $(nA(
1201
+ ))), ti = (i) => Ae(i, ot("JS-Before", () => $(nA(
1202
1202
  `
1203
1203
  window._readium_blockedEvents = [];
1204
1204
  window._readium_blockEvents = true;
@@ -1212,7 +1212,7 @@ const KA = `@namespace url(http://www.w3.org/1999/xhtml);@namespace epub url(htt
1212
1212
  };
1213
1213
  window.addEventListener("DOMContentLoaded", window._readium_eventBlocker, true);
1214
1214
  window.addEventListener("load", window._readium_eventBlocker, true);`
1215
- ), "text/javascript"))), ei = (n) => Ae(n, ot("JS-After", () => $(nA(
1215
+ ), "text/javascript"))), ei = (i) => Ae(i, ot("JS-After", () => $(nA(
1216
1216
  `
1217
1217
  if(window.onload) window.onload = new Proxy(window.onload, {
1218
1218
  apply: function(target, receiver, args) {
@@ -1227,8 +1227,8 @@ const KA = `@namespace url(http://www.w3.org/1999/xhtml);@namespace epub url(htt
1227
1227
  });`
1228
1228
  ), "text/javascript")));
1229
1229
  class rA {
1230
- constructor(t, e, A, i) {
1231
- this.pub = t, this.item = A, this.burl = A.toURL(e) || "", this.cssProperties = i;
1230
+ constructor(t, e, A, n) {
1231
+ this.pub = t, this.item = A, this.burl = A.toURL(e) || "", this.cssProperties = n;
1232
1232
  }
1233
1233
  async build(t = !1) {
1234
1234
  if (this.item.mediaType.isHTML)
@@ -1244,10 +1244,10 @@ class rA {
1244
1244
  const A = new DOMParser().parseFromString(
1245
1245
  e,
1246
1246
  this.item.mediaType.string
1247
- ), i = A.querySelector("parsererror");
1248
- if (i) {
1249
- const r = i.querySelector("div");
1250
- throw new Error(`Failed parsing item ${this.item.href}: ${(r == null ? void 0 : r.textContent) || i.textContent}`);
1247
+ ), n = A.querySelector("parsererror");
1248
+ if (n) {
1249
+ const r = n.querySelector("div");
1250
+ throw new Error(`Failed parsing item ${this.item.href}: ${(r == null ? void 0 : r.textContent) || n.textContent}`);
1251
1251
  }
1252
1252
  return this.finalizeDOM(A, this.burl, this.item.mediaType, t, this.cssProperties);
1253
1253
  }
@@ -1267,17 +1267,17 @@ class rA {
1267
1267
  }
1268
1268
  setProperties(t, e) {
1269
1269
  for (const A in t) {
1270
- const i = t[A];
1271
- i && e.documentElement.style.setProperty(A, i);
1270
+ const n = t[A];
1271
+ n && e.documentElement.style.setProperty(A, n);
1272
1272
  }
1273
1273
  }
1274
- finalizeDOM(t, e, A, i = !1, r) {
1274
+ finalizeDOM(t, e, A, n = !1, r) {
1275
1275
  var o;
1276
1276
  if (!t)
1277
1277
  return "";
1278
- if (!i) {
1279
- const a = vt(t, ot("ReadiumCSS-before", () => $(Pt(qA), "text/css")));
1280
- t.head.firstChild ? t.head.firstChild.before(a) : t.head.appendChild(a), this.hasStyle(t) || a.after(vt(t, ot("ReadiumCSS-default", () => $(Pt(_A), "text/css")))), t.head.appendChild(vt(t, ot("ReadiumCSS-after", () => $(Pt(KA), "text/css")))), r && this.setProperties(r, t);
1278
+ if (!n) {
1279
+ const a = Pt(t, ot("ReadiumCSS-before", () => $(vt(qA), "text/css")));
1280
+ t.head.firstChild ? t.head.firstChild.before(a) : t.head.appendChild(a), this.hasStyle(t) || a.after(Pt(t, ot("ReadiumCSS-default", () => $(vt(_A), "text/css")))), t.head.appendChild(Pt(t, ot("ReadiumCSS-after", () => $(vt(KA), "text/css")))), r && this.setProperties(r, t);
1281
1281
  }
1282
1282
  if (t.body.querySelectorAll("img").forEach((a) => {
1283
1283
  a.setAttribute("fetchpriority", "high");
@@ -1337,22 +1337,22 @@ class ii {
1337
1337
  t.strict && this.send("_unhandled", t);
1338
1338
  return;
1339
1339
  }
1340
- e.forEach((A) => A.cb(t.data, (i) => {
1341
- this.send("_ack", i, t.id);
1340
+ e.forEach((A) => A.cb(t.data, (n) => {
1341
+ this.send("_ack", n, t.id);
1342
1342
  }));
1343
1343
  }
1344
1344
  register(t, e, A) {
1345
- Array.isArray(t) || (t = [t]), t.forEach((i) => {
1346
- const r = this.registrar.get(i);
1345
+ Array.isArray(t) || (t = [t]), t.forEach((n) => {
1346
+ const r = this.registrar.get(n);
1347
1347
  if (r && r.length >= 0) {
1348
1348
  if (r.find((s) => s.module === e))
1349
- throw new Error(`Trying to register another callback for combination of event ${i} and module ${e}`);
1349
+ throw new Error(`Trying to register another callback for combination of event ${n} and module ${e}`);
1350
1350
  r.push({
1351
1351
  cb: A,
1352
1352
  module: e
1353
- }), this.registrar.set(i, r);
1353
+ }), this.registrar.set(n, r);
1354
1354
  } else
1355
- this.registrar.set(i, [{
1355
+ this.registrar.set(n, [{
1356
1356
  cb: A,
1357
1357
  module: e
1358
1358
  }]);
@@ -1360,12 +1360,12 @@ class ii {
1360
1360
  }
1361
1361
  unregister(t, e) {
1362
1362
  Array.isArray(t) || (t = [t]), t.forEach((A) => {
1363
- const i = this.registrar.get(A);
1364
- !i || i.length === 0 || i.splice(i.findIndex((r) => r.module === e), 1);
1363
+ const n = this.registrar.get(A);
1364
+ !n || n.length === 0 || n.splice(n.findIndex((r) => r.module === e), 1);
1365
1365
  });
1366
1366
  }
1367
1367
  unregisterAll(t) {
1368
- this.registrar.forEach((e, A) => this.registrar.set(A, e.filter((i) => i.module !== t)));
1368
+ this.registrar.forEach((e, A) => this.registrar.set(A, e.filter((n) => n.module !== t)));
1369
1369
  }
1370
1370
  log(...t) {
1371
1371
  this.destination ? this.send("log", t) : this.preLog.push(t);
@@ -1376,7 +1376,7 @@ class ii {
1376
1376
  destroy() {
1377
1377
  this.destination = null, this.channelId = "", this.preLog = [], this.registrar.clear(), this.wnd.removeEventListener("message", this.receiver);
1378
1378
  }
1379
- send(t, e, A = void 0, i = []) {
1379
+ send(t, e, A = void 0, n = []) {
1380
1380
  if (!this.destination)
1381
1381
  throw Error("Attempted to send comms message before destination has been initialized");
1382
1382
  const r = {
@@ -1390,12 +1390,12 @@ class ii {
1390
1390
  try {
1391
1391
  this.destination.postMessage(r, {
1392
1392
  targetOrigin: this.origin,
1393
- transfer: i
1393
+ transfer: n
1394
1394
  });
1395
1395
  } catch (s) {
1396
- if (i.length > 0)
1396
+ if (n.length > 0)
1397
1397
  throw s;
1398
- this.destination.postMessage(r, this.origin, i);
1398
+ this.destination.postMessage(r, this.origin, n);
1399
1399
  }
1400
1400
  }
1401
1401
  }
@@ -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 Q {
1430
+ class Y {
1431
1431
  constructor(t) {
1432
1432
  this.otherProperties = t;
1433
1433
  }
@@ -1436,7 +1436,7 @@ class Q {
1436
1436
  */
1437
1437
  static deserialize(t) {
1438
1438
  if (t)
1439
- return new Q(t);
1439
+ return new Y(t);
1440
1440
  }
1441
1441
  /**
1442
1442
  * Serializes a [Properties] to its RWPM JSON representation.
@@ -1451,33 +1451,33 @@ class Q {
1451
1451
  const e = Object.assign({}, this.otherProperties);
1452
1452
  for (const A in t)
1453
1453
  e[A] = t[A];
1454
- return new Q(e);
1454
+ return new Y(e);
1455
1455
  }
1456
1456
  }
1457
- Object.defineProperty(Q.prototype, "encryption", {
1457
+ Object.defineProperty(Y.prototype, "encryption", {
1458
1458
  get: function() {
1459
1459
  return ie.deserialize(this.otherProperties.encrypted);
1460
1460
  }
1461
1461
  });
1462
- Q.prototype.getContains = function() {
1462
+ Y.prototype.getContains = function() {
1463
1463
  return new Set(this.otherProperties.contains || []);
1464
1464
  };
1465
- Q.prototype.getLayout = function() {
1465
+ Y.prototype.getLayout = function() {
1466
1466
  return this.otherProperties.layout;
1467
1467
  };
1468
1468
  class u {
1469
1469
  /** Creates a MediaType object. */
1470
1470
  constructor(t) {
1471
- let e, A, i = t.mediaType.replace(/\s/g, "").split(";");
1472
- const r = i[0].split("/");
1471
+ let e, A, n = t.mediaType.replace(/\s/g, "").split(";");
1472
+ const r = n[0].split("/");
1473
1473
  if (r.length === 2) {
1474
1474
  if (e = r[0].toLowerCase().trim(), A = r[1].toLowerCase().trim(), e.length === 0 || A.length === 0)
1475
1475
  throw new Error("Invalid media type");
1476
1476
  } else
1477
1477
  throw new Error("Invalid media type");
1478
1478
  const s = {};
1479
- for (let g = 1; g < i.length; g++) {
1480
- const m = i[g].split("=");
1479
+ for (let g = 1; g < n.length; g++) {
1480
+ const m = n[g].split("=");
1481
1481
  if (m.length === 2) {
1482
1482
  const M = m[0].toLocaleLowerCase(), B = M === "charset" ? m[1].toUpperCase() : m[1];
1483
1483
  s[M] = B;
@@ -1529,11 +1529,11 @@ class u {
1529
1529
  return !1;
1530
1530
  const A = new Set(
1531
1531
  Object.entries(this.parameters).map(([r, s]) => `${r}=${s}`)
1532
- ), i = new Set(
1532
+ ), n = new Set(
1533
1533
  Object.entries(e.parameters).map(([r, s]) => `${r}=${s}`)
1534
1534
  );
1535
1535
  for (const r of Array.from(A.values()))
1536
- if (!i.has(r))
1536
+ if (!n.has(r))
1537
1537
  return !1;
1538
1538
  return !0;
1539
1539
  }
@@ -1930,7 +1930,7 @@ class we {
1930
1930
  getParameters(t) {
1931
1931
  const e = /\{\??([^}]+)\}/g, A = t.match(e);
1932
1932
  return A ? new Set(
1933
- A.join(",").replace(e, "$1").split(",").map((i) => i.trim())
1933
+ A.join(",").replace(e, "$1").split(",").map((n) => n.trim())
1934
1934
  ) : /* @__PURE__ */ new Set();
1935
1935
  }
1936
1936
  /** Expands the URI by replacing the template variables by the given parameters.
@@ -1938,34 +1938,34 @@ class we {
1938
1938
  * See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
1939
1939
  */
1940
1940
  expand(t) {
1941
- const e = (i) => i.split(",").map((r) => {
1941
+ const e = (n) => n.split(",").map((r) => {
1942
1942
  const s = t[r];
1943
1943
  return s ? encodeURIComponent(s) : "";
1944
- }).join(","), A = (i) => "?" + i.split(",").map((r) => {
1944
+ }).join(","), A = (n) => "?" + n.split(",").map((r) => {
1945
1945
  const s = r.split("=")[0], o = t[s];
1946
1946
  return o ? `${s}=${encodeURIComponent(o)}` : "";
1947
1947
  }).join("&");
1948
- return this.uri.replace(/\{(\??)([^}]+)\}/g, (...i) => i[1] ? A(i[2]) : e(i[2]));
1948
+ return this.uri.replace(/\{(\??)([^}]+)\}/g, (...n) => n[1] ? A(n[2]) : e(n[2]));
1949
1949
  }
1950
1950
  }
1951
- function ni(n) {
1952
- return n && n instanceof Array ? n : void 0;
1951
+ function ni(i) {
1952
+ return i && i instanceof Array ? i : void 0;
1953
1953
  }
1954
- function sA(n) {
1955
- return n && typeof n == "string" ? [n] : ni(n);
1954
+ function sA(i) {
1955
+ return i && typeof i == "string" ? [i] : ni(i);
1956
1956
  }
1957
- function Ie(n) {
1958
- return typeof n == "string" ? new Date(n) : void 0;
1957
+ function Ie(i) {
1958
+ return typeof i == "string" ? new Date(i) : void 0;
1959
1959
  }
1960
- function Ut(n) {
1961
- return isNaN(n) ? void 0 : n;
1960
+ function Ut(i) {
1961
+ return isNaN(i) ? void 0 : i;
1962
1962
  }
1963
- function b(n) {
1964
- return Ut(n) !== void 0 && Math.sign(n) >= 0 ? n : void 0;
1963
+ function b(i) {
1964
+ return Ut(i) !== void 0 && Math.sign(i) >= 0 ? i : void 0;
1965
1965
  }
1966
- function ri(n) {
1966
+ function ri(i) {
1967
1967
  const t = new Array();
1968
- return n.forEach((e) => t.push(e)), t;
1968
+ return i.forEach((e) => t.push(e)), t;
1969
1969
  }
1970
1970
  class N {
1971
1971
  /**
@@ -1980,7 +1980,7 @@ class N {
1980
1980
  static deserialize(t) {
1981
1981
  if (!t)
1982
1982
  return;
1983
- const e = Ut(t.progression), A = Ut(t.totalProgression), i = Ut(t.position), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set([
1983
+ const e = Ut(t.progression), A = Ut(t.totalProgression), n = Ut(t.position), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set([
1984
1984
  "fragment",
1985
1985
  "fragments",
1986
1986
  "progression",
@@ -1993,7 +1993,7 @@ class N {
1993
1993
  fragments: sA(t.fragments || t.fragment),
1994
1994
  progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
1995
1995
  totalProgression: A !== void 0 && A >= 0 && A <= 1 ? A : void 0,
1996
- position: i !== void 0 && i > 0 ? i : void 0,
1996
+ position: n !== void 0 && n > 0 ? n : void 0,
1997
1997
  otherLocations: r.size === 0 ? void 0 : r
1998
1998
  });
1999
1999
  }
@@ -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: Q.deserialize(t.properties),
2092
+ properties: Y.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 Q(t), A;
2142
+ return A.properties = A.properties ? (e = A.properties) == null ? void 0 : e.add(t) : new Y(t), A;
2143
2143
  }
2144
2144
  /**
2145
2145
  * Creates a [Locator] from a reading order [Link].
@@ -2211,8 +2211,8 @@ class Rt {
2211
2211
  /** Finds all the links matching any of the given media types. */
2212
2212
  filterByMediaTypes(t) {
2213
2213
  const e = (A) => {
2214
- for (const i of t)
2215
- if (A.mediaType.matches(i))
2214
+ for (const n of t)
2215
+ if (A.mediaType.matches(n))
2216
2216
  return !0;
2217
2217
  return !1;
2218
2218
  };
@@ -2313,50 +2313,50 @@ class ne {
2313
2313
  }
2314
2314
  }
2315
2315
  N.prototype.getCssSelector = function() {
2316
- var n;
2317
- return (n = this.otherLocations) == null ? void 0 : n.get("cssSelector");
2316
+ var i;
2317
+ return (i = this.otherLocations) == null ? void 0 : i.get("cssSelector");
2318
2318
  };
2319
2319
  N.prototype.getPartialCfi = function() {
2320
- var n;
2321
- return (n = this.otherLocations) == null ? void 0 : n.get("partialCfi");
2320
+ var i;
2321
+ return (i = this.otherLocations) == null ? void 0 : i.get("partialCfi");
2322
2322
  };
2323
2323
  N.prototype.getDomRange = function() {
2324
- var n;
2325
- return ne.deserialize((n = this.otherLocations) == null ? void 0 : n.get("domRange"));
2324
+ var i;
2325
+ return ne.deserialize((i = this.otherLocations) == null ? void 0 : i.get("domRange"));
2326
2326
  };
2327
2327
  N.prototype.fragmentParameters = function() {
2328
2328
  return new Map(
2329
- this.fragments.map((n) => n.startsWith("#") ? n.slice(1) : n).join("&").split("&").filter((n) => !n.startsWith("#")).map((n) => n.split("=")).filter((n) => n.length === 2).map((n) => [
2330
- n[0].trim().toLowerCase(),
2331
- n[1].trim()
2329
+ this.fragments.map((i) => i.startsWith("#") ? i.slice(1) : i).join("&").split("&").filter((i) => !i.startsWith("#")).map((i) => i.split("=")).filter((i) => i.length === 2).map((i) => [
2330
+ i[0].trim().toLowerCase(),
2331
+ i[1].trim()
2332
2332
  ])
2333
2333
  );
2334
2334
  };
2335
2335
  N.prototype.htmlId = function() {
2336
2336
  if (!this.fragments.length)
2337
2337
  return;
2338
- let n = this.fragments.find((t) => t.length && !t.includes("="));
2339
- if (!n) {
2338
+ let i = this.fragments.find((t) => t.length && !t.includes("="));
2339
+ if (!i) {
2340
2340
  const t = this.fragmentParameters();
2341
- t.has("id") ? n = t.get("id") : t.has("name") && (n = t.get("name"));
2341
+ t.has("id") ? i = t.get("id") : t.has("name") && (i = t.get("name"));
2342
2342
  }
2343
- return n != null && n.startsWith("#") ? n.slice(1) : n;
2343
+ return i != null && i.startsWith("#") ? i.slice(1) : i;
2344
2344
  };
2345
2345
  N.prototype.page = function() {
2346
- const n = parseInt(this.fragmentParameters().get("page"));
2347
- if (!isNaN(n) && n >= 0)
2348
- return n;
2346
+ const i = parseInt(this.fragmentParameters().get("page"));
2347
+ if (!isNaN(i) && i >= 0)
2348
+ return i;
2349
2349
  };
2350
2350
  N.prototype.time = function() {
2351
- const n = parseInt(this.fragmentParameters().get("t"));
2352
- if (!isNaN(n))
2353
- return n;
2351
+ const i = parseInt(this.fragmentParameters().get("t"));
2352
+ if (!isNaN(i))
2353
+ return i;
2354
2354
  };
2355
2355
  N.prototype.space = function() {
2356
- const n = this.fragmentParameters();
2357
- if (!n.has("xywh"))
2356
+ const i = this.fragmentParameters();
2357
+ if (!i.has("xywh"))
2358
2358
  return;
2359
- const t = n.get("xywh").split(",").map((e) => parseInt(e));
2359
+ const t = i.get("xywh").split(",").map((e) => parseInt(e));
2360
2360
  if (t.length === 4 && !t.some(isNaN))
2361
2361
  return t;
2362
2362
  };
@@ -2482,85 +2482,85 @@ 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
- Q.prototype.getNumberOfItems = function() {
2485
+ Y.prototype.getNumberOfItems = function() {
2486
2486
  return b(this.otherProperties.numberOfItems);
2487
2487
  };
2488
- Q.prototype.getPrice = function() {
2488
+ Y.prototype.getPrice = function() {
2489
2489
  return re.deserialize(this.otherProperties.price);
2490
2490
  };
2491
- Q.prototype.getIndirectAcquisitions = function() {
2492
- const n = this.otherProperties.indirectAcquisition;
2493
- if (n && n instanceof Array)
2494
- return n.map((t) => Mt.deserialize(t)).filter((t) => t !== void 0);
2491
+ Y.prototype.getIndirectAcquisitions = function() {
2492
+ const i = this.otherProperties.indirectAcquisition;
2493
+ if (i && i instanceof Array)
2494
+ return i.map((t) => Mt.deserialize(t)).filter((t) => t !== void 0);
2495
2495
  };
2496
- Q.prototype.getHolds = function() {
2496
+ Y.prototype.getHolds = function() {
2497
2497
  return se.deserialize(this.otherProperties.holds);
2498
2498
  };
2499
- Q.prototype.getCopies = function() {
2499
+ Y.prototype.getCopies = function() {
2500
2500
  return oe.deserialize(this.otherProperties.copies);
2501
2501
  };
2502
- Q.prototype.getAvailability = function() {
2502
+ Y.prototype.getAvailability = function() {
2503
2503
  return ae.deserialize(this.otherProperties.availability);
2504
2504
  };
2505
- Q.prototype.getAuthenticate = function() {
2505
+ Y.prototype.getAuthenticate = function() {
2506
2506
  return at.deserialize(this.otherProperties.authenticate);
2507
2507
  };
2508
- Q.prototype.getClipped = function() {
2508
+ Y.prototype.getClipped = function() {
2509
2509
  return this.otherProperties.clipped;
2510
2510
  };
2511
- Q.prototype.getFit = function() {
2511
+ Y.prototype.getFit = function() {
2512
2512
  return this.otherProperties.fit;
2513
2513
  };
2514
- Q.prototype.getOrientation = function() {
2514
+ Y.prototype.getOrientation = function() {
2515
2515
  return this.otherProperties.orientation;
2516
2516
  };
2517
- Q.prototype.getOverflow = function() {
2517
+ Y.prototype.getOverflow = function() {
2518
2518
  return this.otherProperties.overflow;
2519
2519
  };
2520
- Q.prototype.getPage = function() {
2520
+ Y.prototype.getPage = function() {
2521
2521
  return this.otherProperties.page || void 0;
2522
2522
  };
2523
- Q.prototype.getSpread = function() {
2523
+ Y.prototype.getSpread = function() {
2524
2524
  return this.otherProperties.spread || void 0;
2525
2525
  };
2526
2526
  var q;
2527
- (function(n) {
2528
- n.NONE = "none", n.DESCENDANT = "descendant", n.CHILD = "child";
2527
+ (function(i) {
2528
+ i.NONE = "none", i.DESCENDANT = "descendant", i.CHILD = "child";
2529
2529
  })(q || (q = {}));
2530
- var v;
2531
- (function(n) {
2532
- n.id = "id", n.class = "class", n.tag = "tag", n.attribute = "attribute", n.nthchild = "nthchild", n.nthoftype = "nthoftype";
2533
- })(v || (v = {}));
2530
+ var P;
2531
+ (function(i) {
2532
+ i.id = "id", i.class = "class", i.tag = "tag", i.attribute = "attribute", i.nthchild = "nthchild", i.nthoftype = "nthoftype";
2533
+ })(P || (P = {}));
2534
2534
  const si = "CssSelectorGenerator";
2535
- function Fe(n = "unknown problem", ...t) {
2536
- console.warn(`${si}: ${n}`, ...t);
2535
+ function Fe(i = "unknown problem", ...t) {
2536
+ console.warn(`${si}: ${i}`, ...t);
2537
2537
  }
2538
- v.id, v.class, v.tag, v.attribute;
2539
- function oi(n) {
2540
- return n instanceof RegExp;
2538
+ P.id, P.class, P.tag, P.attribute;
2539
+ function oi(i) {
2540
+ return i instanceof RegExp;
2541
2541
  }
2542
- function ai(n) {
2543
- return n.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
2542
+ function ai(i) {
2543
+ return i.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
2544
2544
  }
2545
- function hi(n) {
2546
- const t = n.map((e) => {
2545
+ function hi(i) {
2546
+ const t = i.map((e) => {
2547
2547
  if (oi(e))
2548
2548
  return (A) => e.test(A);
2549
2549
  if (typeof e == "function")
2550
2550
  return (A) => {
2551
- const i = e(A);
2552
- return typeof i != "boolean" ? (Fe("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : i;
2551
+ const n = e(A);
2552
+ return typeof n != "boolean" ? (Fe("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : n;
2553
2553
  };
2554
2554
  if (typeof e == "string") {
2555
2555
  const A = new RegExp("^" + ai(e) + "$");
2556
- return (i) => A.test(i);
2556
+ return (n) => A.test(n);
2557
2557
  }
2558
2558
  return Fe("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
2559
2559
  });
2560
2560
  return (e) => t.some((A) => A(e));
2561
2561
  }
2562
2562
  q.NONE + "", q.NONE, q.DESCENDANT + "", q.DESCENDANT, q.CHILD + "", q.CHILD;
2563
- v.nthoftype, v.tag, v.id, v.class, v.attribute, v.nthchild;
2563
+ P.nthoftype, P.tag, P.id, P.class, P.attribute, P.nthchild;
2564
2564
  hi([
2565
2565
  "class",
2566
2566
  "id",
@@ -2569,40 +2569,40 @@ hi([
2569
2569
  ]);
2570
2570
  class Dt {
2571
2571
  }
2572
- function Ue(n) {
2573
- return n.split("").reverse().join("");
2572
+ function Ue(i) {
2573
+ return i.split("").reverse().join("");
2574
2574
  }
2575
- function li(n, t, e) {
2575
+ function li(i, t, e) {
2576
2576
  const A = Ue(t);
2577
- return e.map((i) => {
2578
- const r = Math.max(0, i.end - t.length - i.errors), s = Ue(n.slice(r, i.end));
2577
+ return e.map((n) => {
2578
+ const r = Math.max(0, n.end - t.length - n.errors), s = Ue(i.slice(r, n.end));
2579
2579
  return {
2580
- start: oA(s, A, i.errors).reduce((o, a) => i.end - a.end < o ? i.end - a.end : o, i.end),
2581
- end: i.end,
2582
- errors: i.errors
2580
+ start: oA(s, A, n.errors).reduce((o, a) => n.end - a.end < o ? n.end - a.end : o, n.end),
2581
+ end: n.end,
2582
+ errors: n.errors
2583
2583
  };
2584
2584
  });
2585
2585
  }
2586
- function Ht(n) {
2587
- return (n | -n) >> 31 & 1;
2586
+ function Ht(i) {
2587
+ return (i | -i) >> 31 & 1;
2588
2588
  }
2589
- function ye(n, t, e, A) {
2590
- let i = n.P[e], r = n.M[e];
2591
- const s = A >>> 31, o = t[e] | s, a = o | r, h = (o & i) + i ^ i | o;
2592
- let l = r | ~(h | i), c = i & h;
2593
- const g = Ht(l & n.lastRowMask[e]) - Ht(c & n.lastRowMask[e]);
2594
- return l <<= 1, c <<= 1, c |= s, l |= Ht(A) - s, i = c | ~(a | l), r = l & a, n.P[e] = i, n.M[e] = r, g;
2589
+ function Ce(i, t, e, A) {
2590
+ let n = i.P[e], r = i.M[e];
2591
+ const s = A >>> 31, o = t[e] | s, a = o | r, h = (o & n) + n ^ n | o;
2592
+ let l = r | ~(h | n), c = n & h;
2593
+ const g = Ht(l & i.lastRowMask[e]) - Ht(c & i.lastRowMask[e]);
2594
+ return l <<= 1, c <<= 1, c |= s, l |= Ht(A) - s, n = c | ~(a | l), r = l & a, i.P[e] = n, i.M[e] = r, g;
2595
2595
  }
2596
- function oA(n, t, e) {
2596
+ function oA(i, t, e) {
2597
2597
  if (t.length === 0)
2598
2598
  return [];
2599
2599
  e = Math.min(e, t.length);
2600
- const A = [], i = 32, r = Math.ceil(t.length / i) - 1, s = {
2600
+ const A = [], n = 32, r = Math.ceil(t.length / n) - 1, s = {
2601
2601
  P: new Uint32Array(r + 1),
2602
2602
  M: new Uint32Array(r + 1),
2603
2603
  lastRowMask: new Uint32Array(r + 1)
2604
2604
  };
2605
- s.lastRowMask.fill(1 << 31), s.lastRowMask[r] = 1 << (t.length - 1) % i;
2605
+ s.lastRowMask.fill(1 << 31), s.lastRowMask[r] = 1 << (t.length - 1) % n;
2606
2606
  const o = new Uint32Array(r + 1), a = /* @__PURE__ */ new Map(), h = [];
2607
2607
  for (let g = 0; g < 256; g++)
2608
2608
  h.push(o);
@@ -2614,37 +2614,37 @@ function oA(n, t, e) {
2614
2614
  a.set(m, M), m < h.length && (h[m] = M);
2615
2615
  for (let B = 0; B <= r; B += 1) {
2616
2616
  M[B] = 0;
2617
- for (let E = 0; E < i; E += 1) {
2618
- const f = B * i + E;
2617
+ for (let E = 0; E < n; E += 1) {
2618
+ const f = B * n + E;
2619
2619
  f >= t.length || t.charCodeAt(f) === m && (M[B] |= 1 << E);
2620
2620
  }
2621
2621
  }
2622
2622
  }
2623
- let l = Math.max(0, Math.ceil(e / i) - 1);
2623
+ let l = Math.max(0, Math.ceil(e / n) - 1);
2624
2624
  const c = new Uint32Array(r + 1);
2625
2625
  for (let g = 0; g <= l; g += 1)
2626
- c[g] = (g + 1) * i;
2626
+ c[g] = (g + 1) * n;
2627
2627
  c[r] = t.length;
2628
2628
  for (let g = 0; g <= l; g += 1)
2629
2629
  s.P[g] = -1, s.M[g] = 0;
2630
- for (let g = 0; g < n.length; g += 1) {
2631
- const m = n.charCodeAt(g);
2630
+ for (let g = 0; g < i.length; g += 1) {
2631
+ const m = i.charCodeAt(g);
2632
2632
  let M;
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 = ye(s, M, E, B), c[E] += B;
2636
+ B = Ce(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;
2640
2640
  if (l === r) {
2641
- const f = t.length % i;
2642
- E = f === 0 ? i : f;
2641
+ const f = t.length % n;
2642
+ E = f === 0 ? n : f;
2643
2643
  } else
2644
- E = i;
2645
- c[l] = c[l - 1] + E - B + ye(s, M, l, B);
2644
+ E = n;
2645
+ c[l] = c[l - 1] + E - B + Ce(s, M, l, B);
2646
2646
  } else
2647
- for (; l > 0 && c[l] >= e + i; )
2647
+ for (; l > 0 && c[l] >= e + n; )
2648
2648
  l -= 1;
2649
2649
  l === r && c[l] <= e && (c[l] < e && A.splice(0, A.length), A.push({
2650
2650
  start: -1,
@@ -2654,67 +2654,67 @@ function oA(n, t, e) {
2654
2654
  }
2655
2655
  return A;
2656
2656
  }
2657
- function ci(n, t, e) {
2658
- const A = oA(n, t, e);
2659
- return li(n, t, A);
2657
+ function ci(i, t, e) {
2658
+ const A = oA(i, t, e);
2659
+ return li(i, t, A);
2660
2660
  }
2661
- function aA(n, t, e) {
2661
+ function aA(i, t, e) {
2662
2662
  let A = 0;
2663
- const i = [];
2663
+ const n = [];
2664
2664
  for (; A !== -1; )
2665
- A = n.indexOf(t, A), A !== -1 && (i.push({
2665
+ A = i.indexOf(t, A), A !== -1 && (n.push({
2666
2666
  start: A,
2667
2667
  end: A + t.length,
2668
2668
  errors: 0
2669
2669
  }), A += 1);
2670
- return i.length > 0 ? i : ci(n, t, e);
2670
+ return n.length > 0 ? n : ci(i, t, e);
2671
2671
  }
2672
- function Ce(n, t) {
2673
- return t.length === 0 || n.length === 0 ? 0 : 1 - aA(n, t, t.length)[0].errors / t.length;
2672
+ function ye(i, t) {
2673
+ return t.length === 0 || i.length === 0 ? 0 : 1 - aA(i, t, t.length)[0].errors / t.length;
2674
2674
  }
2675
- function gi(n, t, e = {}) {
2675
+ function gi(i, t, e = {}) {
2676
2676
  if (t.length === 0)
2677
2677
  return null;
2678
- const A = Math.min(256, t.length / 2), i = aA(n, t, A);
2679
- if (i.length === 0)
2678
+ const A = Math.min(256, t.length / 2), n = aA(i, t, A);
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 ? Ce(
2683
- n.slice(
2682
+ const a = 1 - o.errors / t.length, h = e.prefix ? ye(
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 ? Ce(
2689
- n.slice(o.end, o.end + e.suffix.length),
2688
+ ) : 1, l = e.suffix ? ye(
2689
+ i.slice(o.end, o.end + e.suffix.length),
2690
2690
  e.suffix
2691
2691
  ) : 1;
2692
2692
  let c = 1;
2693
- typeof e.hint == "number" && (c = 1 - Math.abs(o.start - e.hint) / n.length);
2693
+ typeof e.hint == "number" && (c = 1 - Math.abs(o.start - e.hint) / i.length);
2694
2694
  const g = 50 * a + 20 * h + 20 * l + 2 * c, m = 50 + 20 + 20 + 2;
2695
2695
  return g / m;
2696
- }, s = i.map((o) => ({
2696
+ }, s = n.map((o) => ({
2697
2697
  start: o.start,
2698
2698
  end: o.end,
2699
2699
  score: r(o)
2700
2700
  }));
2701
2701
  return s.sort((o, a) => a.score - o.score), s[0];
2702
2702
  }
2703
- function Xt(n, t, e) {
2703
+ function Xt(i, t, e) {
2704
2704
  const A = e === 1 ? t : t - 1;
2705
- if (n.charAt(A).trim() !== "")
2705
+ if (i.charAt(A).trim() !== "")
2706
2706
  return t;
2707
- let i, r;
2708
- if (e === 2 ? (i = n.substring(0, t), r = i.trimEnd()) : (i = n.substring(t), r = i.trimStart()), !r.length)
2707
+ let n, r;
2708
+ if (e === 2 ? (n = i.substring(0, t), r = n.trimEnd()) : (n = i.substring(t), r = n.trimStart()), !r.length)
2709
2709
  return -1;
2710
- const s = i.length - r.length;
2710
+ const s = n.length - r.length;
2711
2711
  return e === 2 ? t - s : t + s;
2712
2712
  }
2713
- function Re(n, t) {
2714
- const e = n.commonAncestorContainer.ownerDocument.createNodeIterator(
2715
- n.commonAncestorContainer,
2713
+ function Re(i, t) {
2714
+ const e = i.commonAncestorContainer.ownerDocument.createNodeIterator(
2715
+ i.commonAncestorContainer,
2716
2716
  NodeFilter.SHOW_TEXT
2717
- ), A = t === 1 ? n.startContainer : n.endContainer, i = t === 1 ? n.endContainer : n.startContainer;
2717
+ ), A = t === 1 ? i.startContainer : i.endContainer, n = t === 1 ? i.endContainer : i.startContainer;
2718
2718
  let r = e.nextNode();
2719
2719
  for (; r && r !== A; )
2720
2720
  r = e.nextNode();
@@ -2726,36 +2726,36 @@ function Re(n, t) {
2726
2726
  s = Xt(a, h, t);
2727
2727
  }
2728
2728
  };
2729
- for (; r && s === -1 && r !== i; )
2729
+ for (; r && s === -1 && r !== n; )
2730
2730
  o();
2731
2731
  if (r && s >= 0)
2732
2732
  return { node: r, offset: s };
2733
2733
  throw new RangeError("No text nodes with non-whitespace text found in range");
2734
2734
  }
2735
- function di(n) {
2736
- if (!n.toString().trim().length)
2735
+ function di(i) {
2736
+ if (!i.toString().trim().length)
2737
2737
  throw new RangeError("Range contains no non-whitespace text");
2738
- if (n.startContainer.nodeType !== Node.TEXT_NODE)
2738
+ if (i.startContainer.nodeType !== Node.TEXT_NODE)
2739
2739
  throw new RangeError("Range startContainer is not a text node");
2740
- if (n.endContainer.nodeType !== Node.TEXT_NODE)
2740
+ if (i.endContainer.nodeType !== Node.TEXT_NODE)
2741
2741
  throw new RangeError("Range endContainer is not a text node");
2742
- const t = n.cloneRange();
2742
+ const t = i.cloneRange();
2743
2743
  let e = !1, A = !1;
2744
- const i = {
2744
+ const n = {
2745
2745
  start: Xt(
2746
- n.startContainer.textContent,
2747
- n.startOffset,
2746
+ i.startContainer.textContent,
2747
+ i.startOffset,
2748
2748
  1
2749
2749
  /* Forwards */
2750
2750
  ),
2751
2751
  end: Xt(
2752
- n.endContainer.textContent,
2753
- n.endOffset,
2752
+ i.endContainer.textContent,
2753
+ i.endOffset,
2754
2754
  2
2755
2755
  /* Backwards */
2756
2756
  )
2757
2757
  };
2758
- if (i.start >= 0 && (t.setStart(n.startContainer, i.start), e = !0), i.end > 0 && (t.setEnd(n.endContainer, i.end), A = !0), e && A)
2758
+ if (n.start >= 0 && (t.setStart(i.startContainer, n.start), e = !0), n.end > 0 && (t.setEnd(i.endContainer, n.end), A = !0), e && A)
2759
2759
  return t;
2760
2760
  if (!e) {
2761
2761
  const { node: r, offset: s } = Re(
@@ -2775,36 +2775,36 @@ function di(n) {
2775
2775
  }
2776
2776
  return t;
2777
2777
  }
2778
- function hA(n) {
2778
+ function hA(i) {
2779
2779
  var t;
2780
- switch (n.nodeType) {
2780
+ switch (i.nodeType) {
2781
2781
  case Node.ELEMENT_NODE:
2782
2782
  case Node.TEXT_NODE:
2783
- return ((t = n.textContent) == null ? void 0 : t.length) ?? 0;
2783
+ return ((t = i.textContent) == null ? void 0 : t.length) ?? 0;
2784
2784
  default:
2785
2785
  return 0;
2786
2786
  }
2787
2787
  }
2788
- function Qe(n) {
2789
- let t = n.previousSibling, e = 0;
2788
+ function Qe(i) {
2789
+ let t = i.previousSibling, e = 0;
2790
2790
  for (; t; )
2791
2791
  e += hA(t), t = t.previousSibling;
2792
2792
  return e;
2793
2793
  }
2794
- function lA(n, ...t) {
2794
+ function lA(i, ...t) {
2795
2795
  let e = t.shift();
2796
- const A = n.ownerDocument.createNodeIterator(
2797
- n,
2796
+ const A = i.ownerDocument.createNodeIterator(
2797
+ i,
2798
2798
  NodeFilter.SHOW_TEXT
2799
- ), i = [];
2799
+ ), n = [];
2800
2800
  let r = A.nextNode(), s, o = 0;
2801
2801
  for (; e !== void 0 && r; )
2802
- s = r, o + s.data.length > e ? (i.push({ node: s, offset: e - o }), e = t.shift()) : (r = A.nextNode(), o += s.data.length);
2802
+ s = r, o + s.data.length > e ? (n.push({ node: s, offset: e - o }), e = t.shift()) : (r = A.nextNode(), o += s.data.length);
2803
2803
  for (; e !== void 0 && s && o === e; )
2804
- i.push({ node: s, offset: s.data.length }), e = t.shift();
2804
+ n.push({ node: s, offset: s.data.length }), e = t.shift();
2805
2805
  if (e !== void 0)
2806
2806
  throw new RangeError("Offset exceeds text length");
2807
- return i;
2807
+ return n;
2808
2808
  }
2809
2809
  class O {
2810
2810
  constructor(t, e) {
@@ -2853,10 +2853,10 @@ class O {
2853
2853
  NodeFilter.SHOW_TEXT
2854
2854
  );
2855
2855
  A.currentNode = this.element;
2856
- const i = t.direction === 1, r = i ? A.nextNode() : A.previousNode();
2856
+ const n = t.direction === 1, r = n ? A.nextNode() : A.previousNode();
2857
2857
  if (!r)
2858
2858
  throw e;
2859
- return { node: r, offset: i ? 0 : r.data.length };
2859
+ return { node: r, offset: n ? 0 : r.data.length };
2860
2860
  } else
2861
2861
  throw e;
2862
2862
  }
@@ -2895,8 +2895,8 @@ class O {
2895
2895
  if (e < 0 || e > t.childNodes.length)
2896
2896
  throw new Error("Child node offset is out of range");
2897
2897
  let A = 0;
2898
- for (let i = 0; i < e; i++)
2899
- A += hA(t.childNodes[i]);
2898
+ for (let n = 0; n < e; n++)
2899
+ A += hA(t.childNodes[n]);
2900
2900
  return new O(t, A);
2901
2901
  }
2902
2902
  default:
@@ -3011,15 +3011,15 @@ class zt {
3011
3011
  * Will throw if `range` does not contain any text nodes.
3012
3012
  */
3013
3013
  static fromRange(t, e) {
3014
- const A = t.textContent, i = _.fromRange(e).relativeTo(t), r = i.start.offset, s = i.end.offset, o = 32;
3014
+ const A = t.textContent, n = _.fromRange(e).relativeTo(t), r = n.start.offset, s = n.end.offset, o = 32;
3015
3015
  return new zt(t, A.slice(r, s), {
3016
3016
  prefix: A.slice(Math.max(0, r - o), r),
3017
3017
  suffix: A.slice(s, Math.min(A.length, s + o))
3018
3018
  });
3019
3019
  }
3020
3020
  static fromSelector(t, e) {
3021
- const { prefix: A, suffix: i } = e;
3022
- return new zt(t, e.exact, { prefix: A, suffix: i });
3021
+ const { prefix: A, suffix: n } = e;
3022
+ return new zt(t, e.exact, { prefix: A, suffix: n });
3023
3023
  }
3024
3024
  toSelector() {
3025
3025
  return {
@@ -3042,17 +3042,17 @@ class zt {
3042
3042
  return new Yt(this.root, A.start, A.end);
3043
3043
  }
3044
3044
  }
3045
- function ui(n) {
3046
- const t = n.tagName.toUpperCase();
3045
+ function ui(i) {
3046
+ const t = i.tagName.toUpperCase();
3047
3047
  return t === "IMG" || t === "VIDEO" || t === "AUDIO" || t === "IFRAME" || t === "OBJECT" || t === "EMBED" || t === "CANVAS";
3048
3048
  }
3049
- function he(n, t) {
3049
+ function he(i, t) {
3050
3050
  try {
3051
3051
  const e = t.locations, A = t.text;
3052
3052
  if (A && A.highlight) {
3053
- let i;
3054
- e && e.getCssSelector() && (i = n.querySelector(e.getCssSelector())), i || (i = n.body);
3055
- const r = new zt(i, A.highlight, {
3053
+ let n;
3054
+ e && e.getCssSelector() && (n = i.querySelector(e.getCssSelector())), n || (n = i.body);
3055
+ const r = new zt(n, A.highlight, {
3056
3056
  prefix: A.before,
3057
3057
  suffix: A.after
3058
3058
  });
@@ -3063,15 +3063,15 @@ function he(n, t) {
3063
3063
  }
3064
3064
  }
3065
3065
  if (e) {
3066
- let i = null;
3067
- if (!i && e.getCssSelector() && (i = n.querySelector(e.getCssSelector())), !i && e.fragments) {
3066
+ let n = null;
3067
+ if (!n && e.getCssSelector() && (n = i.querySelector(e.getCssSelector())), !n && e.fragments) {
3068
3068
  for (const r of e.fragments)
3069
- if (i = n.getElementById(r), i)
3069
+ if (n = i.getElementById(r), n)
3070
3070
  break;
3071
3071
  }
3072
- if (i) {
3073
- const r = n.createRange();
3074
- return i.childNodes.length === 0 || ui(i) ? (r.selectNode(i), r) : (r.setStartBefore(i), r.setEndAfter(i), r);
3072
+ if (n) {
3073
+ const r = i.createRange();
3074
+ return n.childNodes.length === 0 || ui(n) ? (r.selectNode(n), r) : (r.setStartBefore(n), r.setEndAfter(n), r);
3075
3075
  }
3076
3076
  }
3077
3077
  } catch (e) {
@@ -3079,12 +3079,12 @@ function he(n, t) {
3079
3079
  }
3080
3080
  return null;
3081
3081
  }
3082
- function mi(n, t) {
3083
- let e = n.getClientRects();
3084
- e.length || n.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (e = n.commonAncestorContainer.getClientRects());
3085
- const A = 1, i = [];
3082
+ function mi(i, t) {
3083
+ let e = i.getClientRects();
3084
+ e.length || i.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (e = i.commonAncestorContainer.getClientRects());
3085
+ const A = 1, n = [];
3086
3086
  for (const h of e)
3087
- i.push({
3087
+ n.push({
3088
3088
  bottom: h.bottom,
3089
3089
  height: h.height,
3090
3090
  left: h.left,
@@ -3093,7 +3093,7 @@ function mi(n, t) {
3093
3093
  width: h.width
3094
3094
  });
3095
3095
  const r = cA(
3096
- i,
3096
+ n,
3097
3097
  A,
3098
3098
  t
3099
3099
  ), s = fi(r, A), o = gA(s), a = 2 * 2;
@@ -3107,15 +3107,15 @@ function mi(n, t) {
3107
3107
  }
3108
3108
  return o;
3109
3109
  }
3110
- function cA(n, t, e) {
3111
- for (let A = 0; A < n.length; A++)
3112
- for (let i = A + 1; i < n.length; i++) {
3113
- const r = n[A], s = n[i];
3110
+ function cA(i, t, e) {
3111
+ for (let A = 0; A < i.length; A++)
3112
+ for (let n = A + 1; n < i.length; n++) {
3113
+ const r = i[A], s = i[n];
3114
3114
  if (r === s)
3115
3115
  continue;
3116
3116
  const o = G(r.top, s.top, t) && G(r.bottom, s.bottom, t), a = G(r.left, s.left, t) && G(r.right, s.right, t);
3117
3117
  if ((a && !e || o && !a) && dA(r, s, t)) {
3118
- const h = n.filter((c) => c !== r && c !== s), l = Mi(r, s);
3118
+ const h = i.filter((c) => c !== r && c !== s), l = Mi(r, s);
3119
3119
  return h.push(l), cA(
3120
3120
  h,
3121
3121
  t,
@@ -3123,153 +3123,153 @@ function cA(n, t, e) {
3123
3123
  );
3124
3124
  }
3125
3125
  }
3126
- return n;
3126
+ return i;
3127
3127
  }
3128
- function Mi(n, t) {
3129
- const e = Math.min(n.left, t.left), A = Math.max(n.right, t.right), i = Math.min(n.top, t.top), r = Math.max(n.bottom, t.bottom);
3128
+ function Mi(i, t) {
3129
+ const e = Math.min(i.left, t.left), A = Math.max(i.right, t.right), n = Math.min(i.top, t.top), r = Math.max(i.bottom, t.bottom);
3130
3130
  return {
3131
3131
  bottom: r,
3132
- height: r - i,
3132
+ height: r - n,
3133
3133
  left: e,
3134
3134
  right: A,
3135
- top: i,
3135
+ top: n,
3136
3136
  width: A - e
3137
3137
  };
3138
3138
  }
3139
- function fi(n, t) {
3140
- const e = new Set(n);
3141
- for (const A of n) {
3139
+ function fi(i, t) {
3140
+ const e = new Set(i);
3141
+ for (const A of i) {
3142
3142
  if (!(A.width > 1 && A.height > 1)) {
3143
3143
  e.delete(A);
3144
3144
  continue;
3145
3145
  }
3146
- for (const i of n)
3147
- if (A !== i && e.has(i) && pi(i, A, t)) {
3146
+ for (const n of i)
3147
+ if (A !== n && e.has(n) && pi(n, A, t)) {
3148
3148
  e.delete(A);
3149
3149
  break;
3150
3150
  }
3151
3151
  }
3152
3152
  return Array.from(e);
3153
3153
  }
3154
- function pi(n, t, e) {
3155
- return wt(n, t.left, t.top, e) && wt(n, t.right, t.top, e) && wt(n, t.left, t.bottom, e) && wt(n, t.right, t.bottom, e);
3154
+ function pi(i, t, e) {
3155
+ return wt(i, t.left, t.top, e) && wt(i, t.right, t.top, e) && wt(i, t.left, t.bottom, e) && wt(i, t.right, t.bottom, e);
3156
3156
  }
3157
- function wt(n, t, e, A) {
3158
- return (n.left < t || G(n.left, t, A)) && (n.right > t || G(n.right, t, A)) && (n.top < e || G(n.top, e, A)) && (n.bottom > e || G(n.bottom, e, A));
3157
+ function wt(i, t, e, A) {
3158
+ return (i.left < t || G(i.left, t, A)) && (i.right > t || G(i.right, t, A)) && (i.top < e || G(i.top, e, A)) && (i.bottom > e || G(i.bottom, e, A));
3159
3159
  }
3160
- function gA(n) {
3161
- for (let t = 0; t < n.length; t++)
3162
- for (let e = t + 1; e < n.length; e++) {
3163
- const A = n[t], i = n[e];
3164
- if (A !== i && dA(A, i, -1)) {
3160
+ function gA(i) {
3161
+ for (let t = 0; t < i.length; t++)
3162
+ for (let e = t + 1; e < i.length; e++) {
3163
+ const A = i[t], n = i[e];
3164
+ if (A !== n && dA(A, n, -1)) {
3165
3165
  let r = [], s;
3166
- const o = Ye(A, i);
3166
+ const o = Ye(A, n);
3167
3167
  if (o.length === 1)
3168
3168
  r = o, s = A;
3169
3169
  else {
3170
- const h = Ye(i, A);
3171
- o.length < h.length ? (r = o, s = A) : (r = h, s = i);
3170
+ const h = Ye(n, A);
3171
+ o.length < h.length ? (r = o, s = A) : (r = h, s = n);
3172
3172
  }
3173
- const a = n.filter((h) => h !== s);
3173
+ const a = i.filter((h) => h !== s);
3174
3174
  return Array.prototype.push.apply(a, r), gA(a);
3175
3175
  }
3176
3176
  }
3177
- return n;
3177
+ return i;
3178
3178
  }
3179
- function Ye(n, t) {
3180
- const e = Bi(t, n);
3179
+ function Ye(i, t) {
3180
+ const e = Bi(t, i);
3181
3181
  if (e.height === 0 || e.width === 0)
3182
- return [n];
3182
+ return [i];
3183
3183
  const A = [];
3184
3184
  {
3185
- const i = {
3186
- bottom: n.bottom,
3185
+ const n = {
3186
+ bottom: i.bottom,
3187
3187
  height: 0,
3188
- left: n.left,
3188
+ left: i.left,
3189
3189
  right: e.left,
3190
- top: n.top,
3190
+ top: i.top,
3191
3191
  width: 0
3192
3192
  };
3193
- i.width = i.right - i.left, i.height = i.bottom - i.top, i.height !== 0 && i.width !== 0 && A.push(i);
3193
+ n.width = n.right - n.left, n.height = n.bottom - n.top, n.height !== 0 && n.width !== 0 && A.push(n);
3194
3194
  }
3195
3195
  {
3196
- const i = {
3196
+ const n = {
3197
3197
  bottom: e.top,
3198
3198
  height: 0,
3199
3199
  left: e.left,
3200
3200
  right: e.right,
3201
- top: n.top,
3201
+ top: i.top,
3202
3202
  width: 0
3203
3203
  };
3204
- i.width = i.right - i.left, i.height = i.bottom - i.top, i.height !== 0 && i.width !== 0 && A.push(i);
3204
+ n.width = n.right - n.left, n.height = n.bottom - n.top, n.height !== 0 && n.width !== 0 && A.push(n);
3205
3205
  }
3206
3206
  {
3207
- const i = {
3208
- bottom: n.bottom,
3207
+ const n = {
3208
+ bottom: i.bottom,
3209
3209
  height: 0,
3210
3210
  left: e.left,
3211
3211
  right: e.right,
3212
3212
  top: e.bottom,
3213
3213
  width: 0
3214
3214
  };
3215
- i.width = i.right - i.left, i.height = i.bottom - i.top, i.height !== 0 && i.width !== 0 && A.push(i);
3215
+ n.width = n.right - n.left, n.height = n.bottom - n.top, n.height !== 0 && n.width !== 0 && A.push(n);
3216
3216
  }
3217
3217
  {
3218
- const i = {
3219
- bottom: n.bottom,
3218
+ const n = {
3219
+ bottom: i.bottom,
3220
3220
  height: 0,
3221
3221
  left: e.right,
3222
- right: n.right,
3223
- top: n.top,
3222
+ right: i.right,
3223
+ top: i.top,
3224
3224
  width: 0
3225
3225
  };
3226
- i.width = i.right - i.left, i.height = i.bottom - i.top, i.height !== 0 && i.width !== 0 && A.push(i);
3226
+ n.width = n.right - n.left, n.height = n.bottom - n.top, n.height !== 0 && n.width !== 0 && A.push(n);
3227
3227
  }
3228
3228
  return A;
3229
3229
  }
3230
- function Bi(n, t) {
3231
- const e = Math.max(n.left, t.left), A = Math.min(n.right, t.right), i = Math.max(n.top, t.top), r = Math.min(n.bottom, t.bottom);
3230
+ function Bi(i, t) {
3231
+ const e = Math.max(i.left, t.left), A = Math.min(i.right, t.right), n = Math.max(i.top, t.top), r = Math.min(i.bottom, t.bottom);
3232
3232
  return {
3233
3233
  bottom: r,
3234
- height: Math.max(0, r - i),
3234
+ height: Math.max(0, r - n),
3235
3235
  left: e,
3236
3236
  right: A,
3237
- top: i,
3237
+ top: n,
3238
3238
  width: Math.max(0, A - e)
3239
3239
  };
3240
3240
  }
3241
- function dA(n, t, e) {
3242
- return (n.left < t.right || e >= 0 && G(n.left, t.right, e)) && (t.left < n.right || e >= 0 && G(t.left, n.right, e)) && (n.top < t.bottom || e >= 0 && G(n.top, t.bottom, e)) && (t.top < n.bottom || e >= 0 && G(t.top, n.bottom, e));
3241
+ function dA(i, t, e) {
3242
+ return (i.left < t.right || e >= 0 && G(i.left, t.right, e)) && (t.left < i.right || e >= 0 && G(t.left, i.right, e)) && (i.top < t.bottom || e >= 0 && G(i.top, t.bottom, e)) && (t.top < i.bottom || e >= 0 && G(t.top, i.bottom, e));
3243
3243
  }
3244
- function G(n, t, e) {
3245
- return Math.abs(n - t) <= e;
3244
+ function G(i, t, e) {
3245
+ return Math.abs(i - t) <= e;
3246
3246
  }
3247
- function uA(n) {
3248
- const t = {}, e = n.document.documentElement.style;
3249
- for (const A in n.document.documentElement.style)
3247
+ function uA(i) {
3248
+ const t = {}, e = i.document.documentElement.style;
3249
+ for (const A in i.document.documentElement.style)
3250
3250
  Object.hasOwn(e, A) && !Number.isNaN(Number.parseInt(A)) && (t[e[A]] = e.getPropertyValue(e[A]));
3251
3251
  return t;
3252
3252
  }
3253
- function Ei(n, t) {
3254
- const e = uA(n);
3253
+ function Ei(i, t) {
3254
+ const e = uA(i);
3255
3255
  Object.keys(e).forEach((A) => {
3256
- t.hasOwnProperty(A) || le(n, A);
3257
- }), Object.entries(t).forEach(([A, i]) => {
3258
- e[A] !== i && Nt(n, A, i);
3256
+ t.hasOwnProperty(A) || le(i, A);
3257
+ }), Object.entries(t).forEach(([A, n]) => {
3258
+ e[A] !== n && Nt(i, A, n);
3259
3259
  });
3260
3260
  }
3261
- function ze(n, t) {
3262
- return n.document.documentElement.style.getPropertyValue(t);
3261
+ function ze(i, t) {
3262
+ return i.document.documentElement.style.getPropertyValue(t);
3263
3263
  }
3264
- function Nt(n, t, e) {
3265
- n.document.documentElement.style.setProperty(t, e);
3264
+ function Nt(i, t, e) {
3265
+ i.document.documentElement.style.setProperty(t, e);
3266
3266
  }
3267
- function le(n, t) {
3268
- n.document.documentElement.style.removeProperty(t);
3267
+ function le(i, t) {
3268
+ i.document.documentElement.style.removeProperty(t);
3269
3269
  }
3270
- const wi = (n) => {
3271
- if (n.startsWith("rgb")) {
3272
- const t = n.match(/rgb\((\d+),\s(\d+),\s(\d+)(?:,\s(\d+))?\)/);
3270
+ const wi = (i) => {
3271
+ if (i.startsWith("rgb")) {
3272
+ const t = i.match(/rgb\((\d+),\s(\d+),\s(\d+)(?:,\s(\d+))?\)/);
3273
3273
  if (t)
3274
3274
  return {
3275
3275
  r: parseInt(t[1], 10),
@@ -3277,8 +3277,8 @@ const wi = (n) => {
3277
3277
  b: parseInt(t[3], 10),
3278
3278
  a: t[4] ? parseInt(t[4], 10) / 255 : 1
3279
3279
  };
3280
- } else if (n.startsWith("#")) {
3281
- const t = n.slice(1);
3280
+ } else if (i.startsWith("#")) {
3281
+ const t = i.slice(1);
3282
3282
  if (t.length === 3 || t.length === 4)
3283
3283
  return {
3284
3284
  r: parseInt(t[0] + t[0], 16) / 255,
@@ -3295,18 +3295,18 @@ const wi = (n) => {
3295
3295
  };
3296
3296
  }
3297
3297
  return { r: 0, g: 0, b: 0, a: 1 };
3298
- }, Ii = (n) => 0.2126 * n.r * n.a + 0.7152 * n.g * n.a + 0.0722 * n.b * n.a, Fi = (n) => {
3299
- const t = wi(n);
3298
+ }, Ii = (i) => 0.2126 * i.r * i.a + 0.7152 * i.g * i.a + 0.0722 * i.b * i.a, Fi = (i) => {
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 yi {
3302
+ class Ci {
3303
3303
  /**
3304
3304
  * Creates a DecorationGroup object
3305
3305
  * @param id Unique HTML ID-adhering name of the group
3306
3306
  * @param name Human-readable name of the group
3307
3307
  */
3308
- constructor(t, e, A, i) {
3309
- this.wnd = t, this.comms = e, this.id = A, this.name = i, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, Ui && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
3308
+ constructor(t, e, A, n) {
3309
+ this.wnd = t, this.comms = e, this.id = A, this.name = n, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, Ui && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
3310
3310
  }
3311
3311
  get activeable() {
3312
3312
  return this.activateable;
@@ -3319,14 +3319,14 @@ class yi {
3319
3319
  * @param decoration Decoration to add
3320
3320
  */
3321
3321
  add(t) {
3322
- var e, A, i, r;
3322
+ var e, A, n, r;
3323
3323
  const s = `${this.id}-${this.lastItemId++}`, o = he(this.wnd.document, t.locator);
3324
3324
  if (!o) {
3325
3325
  this.comms.log("Can't locate DOM range for decoration", t);
3326
3326
  return;
3327
3327
  }
3328
3328
  const a = o.commonAncestorContainer;
3329
- a.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Ne.includes(a.nodeName.toUpperCase()) && ((e = this.notTextFlag) == null || e.set(s, !0)), a.querySelector(Ne.join(", ").toLowerCase()) && ((A = this.notTextFlag) == null || A.set(s, !0)), (((i = a.textContent) == null ? void 0 : i.trim()) || "").length === 0 && ((r = this.notTextFlag) == null || r.set(s, !0)));
3329
+ a.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Ne.includes(a.nodeName.toUpperCase()) && ((e = this.notTextFlag) == null || e.set(s, !0)), a.querySelector(Ne.join(", ").toLowerCase()) && ((A = this.notTextFlag) == null || A.set(s, !0)), (((n = a.textContent) == null ? void 0 : n.trim()) || "").length === 0 && ((r = this.notTextFlag) == null || r.set(s, !0)));
3330
3330
  const h = {
3331
3331
  decoration: t,
3332
3332
  id: s,
@@ -3340,11 +3340,11 @@ class yi {
3340
3340
  */
3341
3341
  remove(t) {
3342
3342
  var e, A;
3343
- const i = this.items.findIndex((s) => s.decoration.id === t);
3344
- if (i < 0)
3343
+ const n = this.items.findIndex((s) => s.decoration.id === t);
3344
+ if (n < 0)
3345
3345
  return;
3346
- const r = this.items[i];
3347
- if (this.items.splice(i, 1), r.clickableElements = void 0, r.container && (r.container.remove(), r.container = void 0), this.experimentalHighlights && !((e = this.notTextFlag) != null && e.has(r.id))) {
3346
+ const r = this.items[n];
3347
+ if (this.items.splice(n, 1), r.clickableElements = void 0, r.container && (r.container.remove(), r.container = void 0), this.experimentalHighlights && !((e = this.notTextFlag) != null && e.has(r.id))) {
3348
3348
  const s = this.wnd.CSS.highlights.get(this.id);
3349
3349
  s == null || s.delete(r.range);
3350
3350
  }
@@ -3373,8 +3373,8 @@ class yi {
3373
3373
  }
3374
3374
  experimentalLayout(t) {
3375
3375
  var e, A;
3376
- const [i, r] = this.requireContainer(!0);
3377
- r.add(t.range), i.innerHTML = `
3376
+ const [n, r] = this.requireContainer(!0);
3377
+ r.add(t.range), n.innerHTML = `
3378
3378
  ::highlight(${this.id}) {
3379
3379
  color: black;
3380
3380
  background-color: ${((A = (e = t.decoration) == null ? void 0 : e.style) == null ? void 0 : A.tint) ?? "yellow"};
@@ -3385,7 +3385,7 @@ class yi {
3385
3385
  * @param item
3386
3386
  */
3387
3387
  layout(t) {
3388
- var e, A, i, r, s;
3388
+ var e, A, n, r, s;
3389
3389
  if (this.experimentalHighlights && !((e = this.notTextFlag) != null && e.has(t.id)))
3390
3390
  return this.experimentalLayout(t);
3391
3391
  const o = this.wnd.document.createElement("div");
@@ -3394,14 +3394,14 @@ class yi {
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, Y) => {
3397
+ ), l = a / (h || 1), c = this.wnd.document.scrollingElement, g = c.scrollLeft, m = c.scrollTop, M = (w, U, z) => {
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 = `${Y.width}px`, w.style.height = `${U.height}px`, w.style.left = `${Y.left + g}px`, w.style.top = `${U.top + m}px`;
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`;
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;
@@ -3415,7 +3415,7 @@ class yi {
3415
3415
  <div
3416
3416
  class="r2-highlight-0"
3417
3417
  style="${[
3418
- `background-color: ${((i = (A = t.decoration) == null ? void 0 : A.style) == null ? void 0 : i.tint) ?? "yellow"} !important`,
3418
+ `background-color: ${((n = (A = t.decoration) == null ? void 0 : A.style) == null ? void 0 : n.tint) ?? "yellow"} !important`,
3419
3419
  //"opacity: 0.3 !important",
3420
3420
  `mix-blend-mode: ${f ? "exclusion" : "multiply"} !important`,
3421
3421
  "opacity: 1 !important",
@@ -3434,10 +3434,10 @@ class yi {
3434
3434
  !0
3435
3435
  // doNotMergeHorizontallyAlignedRects
3436
3436
  );
3437
- w = w.sort((U, Y) => U.top < Y.top ? -1 : U.top > Y.top ? 1 : 0);
3437
+ w = w.sort((U, z) => U.top < z.top ? -1 : U.top > z.top ? 1 : 0);
3438
3438
  for (let U of w) {
3439
- const Y = F.cloneNode(!0);
3440
- Y.style.setProperty("pointer-events", "none"), M(Y, U, B), o.append(Y);
3439
+ const z = F.cloneNode(!0);
3440
+ z.style.setProperty("pointer-events", "none"), M(z, U, B), o.append(z);
3441
3441
  }
3442
3442
  }
3443
3443
  t.container = o, t.clickableElements = Array.from(
@@ -3487,9 +3487,9 @@ const mA = class Zt extends Dt {
3487
3487
  }, 50);
3488
3488
  }
3489
3489
  mount(t, e) {
3490
- return this.wnd = t, e.register("decorate", Zt.moduleName, (A, i) => {
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 yi(
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(
3493
3493
  t,
3494
3494
  e,
3495
3495
  `readium-decoration-${this.lastGroupId++}`,
@@ -3510,7 +3510,7 @@ const mA = class Zt extends Dt {
3510
3510
  s == null || s.update(r.decoration);
3511
3511
  break;
3512
3512
  }
3513
- i(!0);
3513
+ n(!0);
3514
3514
  }), this.resizeObserver = new ResizeObserver(() => t.requestAnimationFrame(() => this.handleResize())), this.resizeObserver.observe(t.document.body), t.addEventListener("orientationchange", this.handleResizer), t.addEventListener("resize", this.handleResizer), e.log("Decorator Mounted"), !0;
3515
3515
  }
3516
3516
  unmount(t, e) {
@@ -3518,7 +3518,7 @@ const mA = class Zt extends Dt {
3518
3518
  }
3519
3519
  };
3520
3520
  mA.moduleName = "decorator";
3521
- let Ci = mA;
3521
+ let yi = mA;
3522
3522
  const Se = "readium-snapper-style", MA = class Kt extends Dt {
3523
3523
  constructor() {
3524
3524
  super(...arguments), this.protected = !1;
@@ -3532,9 +3532,9 @@ const Se = "readium-snapper-style", MA = class Kt extends Dt {
3532
3532
  }
3533
3533
  mount(t, e) {
3534
3534
  const A = t.document.createElement("style");
3535
- return A.dataset.readium = "true", A.id = Se, A.textContent = this.buildStyles(), t.document.head.appendChild(A), e.register("protect", Kt.moduleName, (i, r) => {
3535
+ return A.dataset.readium = "true", A.id = Se, A.textContent = this.buildStyles(), t.document.head.appendChild(A), e.register("protect", Kt.moduleName, (n, r) => {
3536
3536
  this.protected = !0, A.textContent = this.buildStyles(), r(!0);
3537
- }), e.register("unprotect", Kt.moduleName, (i, r) => {
3537
+ }), e.register("unprotect", Kt.moduleName, (n, r) => {
3538
3538
  this.protected = !1, A.textContent = this.buildStyles(), r(!0);
3539
3539
  }), e.log("Snapper Mounted"), !0;
3540
3540
  }
@@ -3545,35 +3545,39 @@ const Se = "readium-snapper-style", MA = class Kt extends Dt {
3545
3545
  };
3546
3546
  MA.moduleName = "snapper";
3547
3547
  let fA = MA;
3548
- function et(n) {
3549
- return n.document.body.dir.toLowerCase() === "rtl";
3548
+ function et(i) {
3549
+ return i.document.body.dir.toLowerCase() === "rtl";
3550
3550
  }
3551
- function pA(n) {
3551
+ function pA(i) {
3552
3552
  return parseInt(
3553
- n.getComputedStyle(
3554
- n.document.documentElement
3553
+ i.getComputedStyle(
3554
+ i.document.documentElement
3555
3555
  ).getPropertyValue("column-count")
3556
3556
  );
3557
3557
  }
3558
- function xe(n) {
3559
- const t = n.document.querySelectorAll("div[id^='readium-virtual-page']");
3558
+ function Ri(i) {
3559
+ const t = getComputedStyle(i), e = parseFloat(t.paddingTop || "0"), A = parseFloat(t.paddingBottom || "0");
3560
+ return i.clientHeight - e - A;
3561
+ }
3562
+ function xe(i) {
3563
+ const t = i.document.querySelectorAll("div[id^='readium-virtual-page']");
3560
3564
  for (const o of t)
3561
3565
  o.remove();
3562
- const e = pA(n), A = n.document.scrollingElement.scrollWidth, i = Math.ceil(A / n.innerWidth) * e, r = Math.round(A / n.innerWidth * e), s = e === 1 ? 0 : i - r;
3566
+ const e = pA(i), A = i.document.scrollingElement.scrollWidth, n = Math.ceil(A / i.innerWidth) * e, r = Math.round(A / i.innerWidth * e), s = e === 1 ? 0 : n - r;
3563
3567
  if (s > 0)
3564
3568
  for (let o = 0; o < s; o++) {
3565
- const a = n.document.createElement("div");
3566
- a.setAttribute("id", `readium-virtual-page-${o}`), a.dataset.readium = "true", a.style.breakBefore = "column", a.innerHTML = "&#8203;", n.document.body.appendChild(a);
3569
+ const a = i.document.createElement("div");
3570
+ a.setAttribute("id", `readium-virtual-page-${o}`), a.dataset.readium = "true", CSS.supports("break-before", "column") ? a.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (a.style.breakInside = "avoid-column"), a.style.height = Ri(i.document.documentElement) + "px"), a.innerHTML = "&#8203;", i.document.body.appendChild(a);
3567
3571
  }
3568
3572
  }
3569
- function Ri(n) {
3570
- return n < 0.5 ? 2 * n * n : -1 + (4 - 2 * n) * n;
3573
+ function Qi(i) {
3574
+ return i < 0.5 ? 2 * i * i : -1 + (4 - 2 * i) * i;
3571
3575
  }
3572
- function x(n) {
3573
- const t = n.getSelection();
3576
+ function x(i) {
3577
+ const t = i.getSelection();
3574
3578
  t && t.removeAllRanges();
3575
3579
  }
3576
- const Qi = [
3580
+ const Yi = [
3577
3581
  "a",
3578
3582
  "audio",
3579
3583
  "button",
@@ -3587,12 +3591,12 @@ const Qi = [
3587
3591
  "textarea",
3588
3592
  "video"
3589
3593
  ];
3590
- function BA(n) {
3594
+ function BA(i) {
3591
3595
  var t;
3592
- return Qi.indexOf(n.nodeName.toLowerCase()) !== -1 || n.hasAttribute("contenteditable") && ((t = n.getAttribute("contenteditable")) == null ? void 0 : t.toLowerCase()) !== "false" ? n : n.parentElement ? BA(n.parentElement) : null;
3596
+ return Yi.indexOf(i.nodeName.toLowerCase()) !== -1 || i.hasAttribute("contenteditable") && ((t = i.getAttribute("contenteditable")) == null ? void 0 : t.toLowerCase()) !== "false" ? i : i.parentElement ? BA(i.parentElement) : null;
3593
3597
  }
3594
- function EA(n, t) {
3595
- const e = wA(n, n.document.body, t), A = n._readium_cssSelectorGenerator.getCssSelector(e, {
3598
+ function EA(i, t) {
3599
+ const e = wA(i, i.document.body, t), A = i._readium_cssSelectorGenerator.getCssSelector(e, {
3596
3600
  selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
3597
3601
  });
3598
3602
  return new tt({
@@ -3608,28 +3612,28 @@ function EA(n, t) {
3608
3612
  })
3609
3613
  });
3610
3614
  }
3611
- function wA(n, t, e) {
3615
+ function wA(i, t, e) {
3612
3616
  for (var A = 0; A < t.children.length; A++) {
3613
- const i = t.children[A];
3614
- if (!Ni(i) && Yi(n, i, e))
3615
- return zi(n, i) ? i : wA(n, i, e);
3617
+ const n = t.children[A];
3618
+ if (!Si(n) && zi(i, n, e))
3619
+ return Ni(i, n) ? n : wA(i, n, e);
3616
3620
  }
3617
3621
  return t;
3618
3622
  }
3619
- function Yi(n, t, e) {
3623
+ function zi(i, t, e) {
3620
3624
  if (t === document.body || t === document.documentElement)
3621
3625
  return !0;
3622
3626
  if (!document || !document.documentElement || !document.body)
3623
3627
  return !1;
3624
3628
  const A = t.getBoundingClientRect();
3625
- return e ? A.bottom > 0 && A.top < n.innerHeight : A.right > 0 && A.left < n.innerWidth;
3629
+ return e ? A.bottom > 0 && A.top < i.innerHeight : A.right > 0 && A.left < i.innerWidth;
3626
3630
  }
3627
- function zi(n, t) {
3631
+ function Ni(i, t) {
3628
3632
  const e = t.getBoundingClientRect();
3629
- return e.top >= 0 && e.left >= 0 && e.bottom <= n.innerHeight && e.right <= n.innerWidth;
3633
+ return e.top >= 0 && e.left >= 0 && e.bottom <= i.innerHeight && e.right <= i.innerWidth;
3630
3634
  }
3631
- function Ni(n) {
3632
- const t = getComputedStyle(n);
3635
+ function Si(i) {
3636
+ const t = getComputedStyle(i);
3633
3637
  if (t) {
3634
3638
  const e = t.getPropertyValue("display");
3635
3639
  if (e != "block" && e != "list-item" || t.getPropertyValue("opacity") === "0")
@@ -3637,7 +3641,7 @@ function Ni(n) {
3637
3641
  }
3638
3642
  return !1;
3639
3643
  }
3640
- const Te = "readium-column-snapper-style", Si = 200, IA = class j extends fA {
3644
+ const Te = "readium-column-snapper-style", xi = 200, IA = class j extends fA {
3641
3645
  constructor() {
3642
3646
  super(...arguments), this.shakeTimeout = 0, this.snappingCancelled = !1, this.alreadyScrollLeft = 0, this.overscroll = 0, this.cachedScrollWidth = 0, this.touchState = 0, this.startingX = void 0, this.endingX = void 0, this.onTouchStarter = this.onTouchStart.bind(this), this.onTouchEnder = this.onTouchEnd.bind(this), this.onWidthChanger = this.onWidthChange.bind(this), this.onTouchMover = this.onTouchMove.bind(this);
3643
3647
  }
@@ -3673,15 +3677,15 @@ const Te = "readium-column-snapper-style", Si = 200, IA = class j extends fA {
3673
3677
  }
3674
3678
  // Snaps the current offset to the page width.
3675
3679
  snapCurrentOffset(t = !1, e = !1) {
3676
- const A = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, i = this.doc(), r = this.dragOffset(), s = pA(this.wnd), o = Math.min(Math.max(0, A), this.cachedScrollWidth), a = et(this.wnd) ? -1 : 1, h = (
3680
+ const A = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, n = this.doc(), r = this.dragOffset(), s = pA(this.wnd), o = Math.min(Math.max(0, A), this.cachedScrollWidth), a = et(this.wnd) ? -1 : 1, h = (
3677
3681
  // The hurdle to overcome in order to change pages
3678
3682
  a * (this.wnd.innerWidth / 3) * (a * r > 0 ? 2 : 1)
3679
3683
  ), l = this.snapOffset(o + h);
3680
3684
  if (t && l !== this.scrollOffset()) {
3681
3685
  this.snappingCancelled = !1;
3682
- const c = (B, E, f, F) => f > F ? E : B + (E - B) * Ri(f / F), g = (
3686
+ const c = (B, E, f, F) => f > F ? E : B + (E - B) * Qi(f / F), g = (
3683
3687
  /*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
3684
- Si * s
3688
+ xi * s
3685
3689
  );
3686
3690
  let m;
3687
3691
  const M = (B) => {
@@ -3689,12 +3693,12 @@ const Te = "readium-column-snapper-style", Si = 200, IA = class j extends fA {
3689
3693
  return;
3690
3694
  m || (m = B);
3691
3695
  const E = B - m, f = c(this.overscroll, 0, E, g), F = c(A, l, E, g);
3692
- i.scrollLeft = F, this.overscroll !== 0 && (i.style.transform = `translate3d(${-f}px, 0px, 0px)`), E < g ? this.wnd.requestAnimationFrame(M) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = l, e || this.reportProgress());
3696
+ n.scrollLeft = F, this.overscroll !== 0 && (n.style.transform = `translate3d(${-f}px, 0px, 0px)`), E < g ? this.wnd.requestAnimationFrame(M) : (this.clearTouches(), n.style.removeProperty("transform"), n.scrollLeft = l, e || this.reportProgress());
3693
3697
  };
3694
3698
  this.wnd.requestAnimationFrame(M);
3695
3699
  } else
3696
- i.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
3697
- i.scrollLeft = l, this.clearTouches(), e || this.reportProgress();
3700
+ n.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
3701
+ n.scrollLeft = l, this.clearTouches(), e || this.reportProgress();
3698
3702
  });
3699
3703
  }
3700
3704
  dragOffset() {
@@ -3787,7 +3791,7 @@ const Te = "readium-column-snapper-style", Si = 200, IA = class j extends fA {
3787
3791
  } else
3788
3792
  t.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
3789
3793
  }), t.frameElement && this.mutationObserver.observe(t.frameElement, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(t.document, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(t.document.documentElement, { attributes: !0, attributeFilter: ["style"] });
3790
- const i = (r) => {
3794
+ const n = (r) => {
3791
3795
  const s = this.doc().scrollLeft;
3792
3796
  return this.doc().scrollLeft = this.snapOffset(r), s !== this.doc().scrollLeft;
3793
3797
  };
@@ -3851,13 +3855,13 @@ const Te = "readium-column-snapper-style", Si = 200, IA = class j extends fA {
3851
3855
  }), e.register("go_prev", j.moduleName, (r, s) => {
3852
3856
  this.wnd.requestAnimationFrame(() => {
3853
3857
  this.cachedScrollWidth = this.doc().scrollWidth;
3854
- const o = t.scrollX - t.innerWidth, a = et(t) ? -(this.cachedScrollWidth - t.innerWidth) : 0, h = i(Math.max(o, a));
3858
+ const o = t.scrollX - t.innerWidth, a = et(t) ? -(this.cachedScrollWidth - t.innerWidth) : 0, h = n(Math.max(o, a));
3855
3859
  h && (this.reportProgress(), x(this.wnd)), s(h);
3856
3860
  });
3857
3861
  }), e.register("go_next", j.moduleName, (r, s) => {
3858
3862
  this.wnd.requestAnimationFrame(() => {
3859
3863
  this.cachedScrollWidth = this.doc().scrollWidth;
3860
- const o = t.scrollX + t.innerWidth, a = et(t) ? 0 : this.cachedScrollWidth - t.innerWidth, h = i(Math.min(o, a));
3864
+ const o = t.scrollX + t.innerWidth, a = et(t) ? 0 : this.cachedScrollWidth - t.innerWidth, h = n(Math.min(o, a));
3861
3865
  h && (this.reportProgress(), x(this.wnd)), s(h);
3862
3866
  });
3863
3867
  }), e.register("unfocus", j.moduleName, (r, s) => {
@@ -3880,8 +3884,8 @@ const Te = "readium-column-snapper-style", Si = 200, IA = class j extends fA {
3880
3884
  }
3881
3885
  };
3882
3886
  IA.moduleName = "column_snapper";
3883
- let xi = IA;
3884
- const je = "readium-scroll-snapper-style", FA = class k extends fA {
3887
+ let Ti = IA;
3888
+ const je = "readium-scroll-snapper-style", FA = class J extends fA {
3885
3889
  constructor() {
3886
3890
  super(...arguments), this.isScrolling = !1, this.handleScroll = () => {
3887
3891
  this.isScrolling || (this.isScrolling = !0, this.wnd.requestAnimationFrame(() => {
@@ -3911,8 +3915,8 @@ const je = "readium-scroll-snapper-style", FA = class k extends fA {
3911
3915
  this.comms.ready && this.handleScroll();
3912
3916
  }), this.resizeObserver.observe(t.document.body), t.addEventListener("scroll", this.handleScroll, {
3913
3917
  passive: !0
3914
- }), e.register("go_progression", k.moduleName, (i, r) => {
3915
- const s = i;
3918
+ }), e.register("go_progression", J.moduleName, (n, r) => {
3919
+ const s = n;
3916
3920
  if (s < 0 || s > 1) {
3917
3921
  e.send("error", {
3918
3922
  message: "go_progression must be given a position from 0.0 to 1.0"
@@ -3922,8 +3926,8 @@ const je = "readium-scroll-snapper-style", FA = class k extends fA {
3922
3926
  this.wnd.requestAnimationFrame(() => {
3923
3927
  this.doc().scrollTop = this.doc().offsetHeight * s, this.reportProgress({ progress: s, reference: this.wnd.innerHeight / this.doc().scrollHeight }), x(this.wnd), r(!0);
3924
3928
  });
3925
- }), e.register("go_id", k.moduleName, (i, r) => {
3926
- const s = t.document.getElementById(i);
3929
+ }), e.register("go_id", J.moduleName, (n, r) => {
3930
+ const s = t.document.getElementById(n);
3927
3931
  if (!s) {
3928
3932
  r(!1);
3929
3933
  return;
@@ -3933,10 +3937,10 @@ const je = "readium-scroll-snapper-style", FA = class k extends fA {
3933
3937
  const o = this.doc().scrollTop / this.doc().offsetHeight;
3934
3938
  this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), x(this.wnd), r(!0);
3935
3939
  });
3936
- }), e.register("go_text", k.moduleName, (i, r) => {
3940
+ }), e.register("go_text", J.moduleName, (n, r) => {
3937
3941
  let s;
3938
- Array.isArray(i) && (i.length > 1 && (s = i[1]), i = i[0]);
3939
- const o = ut.deserialize(i), a = he(this.wnd.document, new tt({
3942
+ Array.isArray(n) && (n.length > 1 && (s = n[1]), n = n[0]);
3943
+ const o = ut.deserialize(n), a = he(this.wnd.document, new tt({
3940
3944
  href: t.location.href,
3941
3945
  type: "text/html",
3942
3946
  text: o,
@@ -3955,40 +3959,40 @@ const je = "readium-scroll-snapper-style", FA = class k extends fA {
3955
3959
  const h = this.doc().scrollTop / this.doc().offsetHeight;
3956
3960
  this.reportProgress({ progress: h, reference: this.wnd.innerHeight / this.doc().scrollHeight }), x(this.wnd), r(!0);
3957
3961
  });
3958
- }), e.register("go_start", k.moduleName, (i, r) => {
3962
+ }), e.register("go_start", J.moduleName, (n, r) => {
3959
3963
  if (this.doc().scrollTop === 0)
3960
3964
  return r(!1);
3961
3965
  this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), r(!0);
3962
- }), e.register("go_end", k.moduleName, (i, r) => {
3966
+ }), e.register("go_end", J.moduleName, (n, r) => {
3963
3967
  if (this.doc().scrollTop === 0)
3964
3968
  return r(!1);
3965
3969
  this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), r(!0);
3966
- }), e.register("unfocus", k.moduleName, (i, r) => {
3970
+ }), e.register("unfocus", J.moduleName, (n, r) => {
3967
3971
  x(this.wnd), r(!0);
3968
3972
  }), e.register([
3969
3973
  "go_next",
3970
3974
  "go_prev"
3971
- ], k.moduleName, (i, r) => r(!1)), e.register("focus", k.moduleName, (i, r) => {
3975
+ ], J.moduleName, (n, r) => r(!1)), e.register("focus", J.moduleName, (n, r) => {
3972
3976
  const s = this.doc().scrollTop / this.doc().offsetHeight;
3973
3977
  this.reportProgress({ progress: s, reference: this.wnd.innerHeight / this.doc().scrollHeight }), r(!0);
3974
- }), e.register("first_visible_locator", k.moduleName, (i, r) => {
3978
+ }), e.register("first_visible_locator", J.moduleName, (n, r) => {
3975
3979
  const s = EA(t, !0);
3976
3980
  this.comms.send("first_visible_locator", s.serialize()), r(!0);
3977
3981
  }), e.log("ScrollSnapper Mounted"), !0;
3978
3982
  }
3979
3983
  unmount(t, e) {
3980
3984
  var A;
3981
- return e.unregisterAll(k.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), (A = t.document.getElementById(je)) == null || A.remove(), e.log("ScrollSnapper Unmounted"), !0;
3985
+ return e.unregisterAll(J.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), (A = t.document.getElementById(je)) == null || A.remove(), e.log("ScrollSnapper Unmounted"), !0;
3982
3986
  }
3983
3987
  };
3984
3988
  FA.moduleName = "scroll_snapper";
3985
- let Ti = FA;
3989
+ let ji = FA;
3986
3990
  class UA extends Dt {
3987
3991
  constructor() {
3988
3992
  super(...arguments), this.pointerMoved = !1, this.onPointerUp = this.onPointUp.bind(this), this.onPointerMove = this.onPointMove.bind(this), this.onPointerDown = this.onPointDown.bind(this), this.onContextMenu = this.onContext.bind(this), this.onClicker = this.onClick.bind(this);
3989
3993
  }
3990
3994
  onPointUp(t) {
3991
- var e, A, i, r, s;
3995
+ var e, A, n, r, s;
3992
3996
  const o = this.wnd.getSelection();
3993
3997
  if (o && ((e = o.toString()) == null ? void 0 : e.length) > 0) {
3994
3998
  const h = (A = o.getRangeAt(0)) == null ? void 0 : A.getClientRects();
@@ -4000,7 +4004,7 @@ class UA extends Dt {
4000
4004
  y: l.y,
4001
4005
  width: l.width,
4002
4006
  height: l.height,
4003
- targetFrameSrc: (r = (i = this.wnd) == null ? void 0 : i.location) == null ? void 0 : r.href
4007
+ targetFrameSrc: (r = (n = this.wnd) == null ? void 0 : n.location) == null ? void 0 : r.href
4004
4008
  };
4005
4009
  this.comms.send("text_selected", c);
4006
4010
  }
@@ -4054,7 +4058,7 @@ class UA extends Dt {
4054
4058
  }
4055
4059
  }
4056
4060
  UA.moduleName = "peripherals";
4057
- const yA = class qt extends Dt {
4061
+ const CA = class qt extends Dt {
4058
4062
  constructor() {
4059
4063
  super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
4060
4064
  }
@@ -4076,11 +4080,11 @@ const yA = class qt extends Dt {
4076
4080
  Reflect.apply(A[1], A[2], A[3]);
4077
4081
  break;
4078
4082
  case 1:
4079
- const i = A[1], r = A[2];
4080
- t.removeEventListener(i.type, t._readium_eventBlocker, !0);
4081
- const s = new Event(i.type, {
4082
- bubbles: i.bubbles,
4083
- cancelable: i.cancelable
4083
+ const n = A[1], r = A[2];
4084
+ t.removeEventListener(n.type, t._readium_eventBlocker, !0);
4085
+ const s = new Event(n.type, {
4086
+ bubbles: n.bubbles,
4087
+ cancelable: n.cancelable
4084
4088
  });
4085
4089
  r ? r.dispatchEvent(s) : t.dispatchEvent(s);
4086
4090
  break;
@@ -4109,8 +4113,8 @@ const yA = class qt extends Dt {
4109
4113
  value: {
4110
4114
  name: "readium-ts-toolkit",
4111
4115
  version: "2.0.0-beta.1",
4112
- hasFeature: (i, r = "") => {
4113
- switch (i) {
4116
+ hasFeature: (n, r = "") => {
4117
+ switch (n) {
4114
4118
  case "dom-manipulation":
4115
4119
  return !0;
4116
4120
  case "layout-changes":
@@ -4131,18 +4135,18 @@ const yA = class qt extends Dt {
4131
4135
  }
4132
4136
  },
4133
4137
  writable: !1
4134
- }), "getAnimations" in t.document && t.document.getAnimations().forEach((i) => {
4135
- i.cancel(), this.allAnimations.add(i);
4136
- }), e.register("activate", qt.moduleName, (i, r) => {
4138
+ }), "getAnimations" in t.document && t.document.getAnimations().forEach((n) => {
4139
+ n.cancel(), this.allAnimations.add(n);
4140
+ }), e.register("activate", qt.moduleName, (n, r) => {
4137
4141
  this.allAnimations.forEach((s) => {
4138
4142
  s.cancel(), s.play();
4139
4143
  }), r(!0);
4140
- }), e.register("unfocus", qt.moduleName, (i, r) => {
4144
+ }), e.register("unfocus", qt.moduleName, (n, r) => {
4141
4145
  this.pauseAllMedia(t), this.allAnimations.forEach((s) => s.pause()), r(!0);
4142
4146
  });
4143
4147
  const A = t.document.querySelectorAll("audio,video");
4144
- for (let i = 0; i < A.length; i++) {
4145
- const r = A[i];
4148
+ for (let n = 0; n < A.length; n++) {
4149
+ const r = A[n];
4146
4150
  r.addEventListener("play", this.onMediaPlayEvent, {
4147
4151
  passive: !0
4148
4152
  }), r.addEventListener("pause", this.onMediaPauseEvent, {
@@ -4155,9 +4159,9 @@ const yA = class qt extends Dt {
4155
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;
4156
4160
  }
4157
4161
  };
4158
- yA.moduleName = "setup";
4159
- let CA = yA;
4160
- const Ve = "readium-viewport", RA = class At extends CA {
4162
+ CA.moduleName = "setup";
4163
+ let yA = CA;
4164
+ const Ve = "readium-viewport", RA = class At extends yA {
4161
4165
  onViewportWidthChanged(t) {
4162
4166
  const e = t.target;
4163
4167
  Nt(e, "--RS__viewportWidth", `${e.innerWidth}px`);
@@ -4171,16 +4175,16 @@ const Ve = "readium-viewport", RA = class At extends CA {
4171
4175
  "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
4172
4176
  ), t.document.head.appendChild(A), t.addEventListener("orientationchange", this.onViewportWidthChanged), t.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
4173
4177
  target: t
4174
- }), e.register("get_properties", At.moduleName, (i, r) => {
4178
+ }), e.register("get_properties", At.moduleName, (n, r) => {
4175
4179
  uA(t), r(!0);
4176
- }), e.register("update_properties", At.moduleName, (i, r) => {
4177
- i["--RS__viewportWidth"] = `${t.innerWidth}px`, Ei(t, i), r(!0);
4178
- }), e.register("set_property", At.moduleName, (i, r) => {
4179
- const s = i;
4180
+ }), e.register("update_properties", At.moduleName, (n, r) => {
4181
+ n["--RS__viewportWidth"] = `${t.innerWidth}px`, Ei(t, n), r(!0);
4182
+ }), e.register("set_property", At.moduleName, (n, r) => {
4183
+ const s = n;
4180
4184
  Nt(t, s[0], s[1]), r(!0);
4181
- }), e.register("remove_property", At.moduleName, (i, r) => {
4182
- le(t, i), r(!0);
4183
- }), e.register("activate", At.moduleName, (i, r) => {
4185
+ }), e.register("remove_property", At.moduleName, (n, r) => {
4186
+ le(t, n), r(!0);
4187
+ }), e.register("activate", At.moduleName, (n, r) => {
4184
4188
  this.unblock(t), r(!0);
4185
4189
  }), e.log("ReflowableSetup Mounted"), !0;
4186
4190
  }
@@ -4190,8 +4194,8 @@ const Ve = "readium-viewport", RA = class At extends CA {
4190
4194
  }
4191
4195
  };
4192
4196
  RA.moduleName = "reflowable_setup";
4193
- let ji = RA;
4194
- const De = "readium-fixed-style", QA = class Z extends CA {
4197
+ let Vi = RA;
4198
+ const De = "readium-fixed-style", QA = class Z extends yA {
4195
4199
  mount(t, e) {
4196
4200
  if (!super.mount(t, e))
4197
4201
  return !1;
@@ -4209,12 +4213,12 @@ const De = "readium-fixed-style", QA = class Z extends CA {
4209
4213
  min-height: 100%;
4210
4214
 
4211
4215
  /*cursor: var() TODO*/
4212
- }`, t.document.head.appendChild(A), e.register("set_property", Z.moduleName, (i, r) => {
4213
- const s = i;
4216
+ }`, t.document.head.appendChild(A), e.register("set_property", Z.moduleName, (n, r) => {
4217
+ const s = n;
4214
4218
  Nt(t, s[0], s[1]), r(!0);
4215
- }), e.register("remove_property", Z.moduleName, (i, r) => {
4216
- le(t, i), r(!0);
4217
- }), e.register("first_visible_locator", Z.moduleName, (i, r) => r(!1)), e.register("unfocus", Z.moduleName, (i, r) => {
4219
+ }), e.register("remove_property", Z.moduleName, (n, r) => {
4220
+ le(t, n), r(!0);
4221
+ }), e.register("first_visible_locator", Z.moduleName, (n, r) => r(!1)), e.register("unfocus", Z.moduleName, (n, r) => {
4218
4222
  x(t), r(!0);
4219
4223
  }), e.register([
4220
4224
  "focus",
@@ -4225,7 +4229,7 @@ const De = "readium-fixed-style", QA = class Z extends CA {
4225
4229
  "go_start",
4226
4230
  "go_text",
4227
4231
  "go_progression"
4228
- ], Z.moduleName, (i, r) => r(!0)), e.register("activate", Z.moduleName, (i, r) => {
4232
+ ], Z.moduleName, (n, r) => r(!0)), e.register("activate", Z.moduleName, (n, r) => {
4229
4233
  this.unblock(t), r(!0);
4230
4234
  }), e.log("FixedSetup Mounted"), !0;
4231
4235
  }
@@ -4235,12 +4239,12 @@ const De = "readium-fixed-style", QA = class Z extends CA {
4235
4239
  }
4236
4240
  };
4237
4241
  QA.moduleName = "fixed_setup";
4238
- let Vi = QA;
4239
- const Di = [
4242
+ let Di = QA;
4243
+ const bi = [
4240
4244
  "fixed_setup",
4241
4245
  "decorator",
4242
4246
  "peripherals"
4243
- ], bi = [
4247
+ ], vi = [
4244
4248
  "reflowable_setup",
4245
4249
  "decorator",
4246
4250
  "peripherals",
@@ -4248,13 +4252,13 @@ const Di = [
4248
4252
  "scroll_snapper"
4249
4253
  ], _t = new Map([
4250
4254
  // All modules go here
4255
+ Di,
4251
4256
  Vi,
4252
- ji,
4253
4257
  UA,
4254
- Ci,
4255
- xi,
4256
- Ti
4257
- ].map((n) => [n.moduleName, n]));
4258
+ yi,
4259
+ Ti,
4260
+ ji
4261
+ ].map((i) => [i.moduleName, i]));
4258
4262
  class St {
4259
4263
  /**
4260
4264
  * @param wnd Window instance to operate on
@@ -4266,11 +4270,11 @@ class St {
4266
4270
  if (A.length) {
4267
4271
  if (typeof t > "u")
4268
4272
  throw Error("Loader is not in a web browser");
4269
- t.parent !== t && this.comms.log("Loader is probably in a frame"), this.loadedModules = A.map((i) => {
4270
- const r = this.loadModule(i);
4273
+ t.parent !== t && this.comms.log("Loader is probably in a frame"), this.loadedModules = A.map((n) => {
4274
+ const r = this.loadModule(n);
4271
4275
  if (r)
4272
4276
  return r.mount(this.wnd, this.comms), r;
4273
- }).filter((i) => i !== void 0);
4277
+ }).filter((n) => n !== void 0);
4274
4278
  }
4275
4279
  }
4276
4280
  loadModule(t) {
@@ -4295,7 +4299,7 @@ class St {
4295
4299
  const e = _t.get(t);
4296
4300
  if (e === void 0)
4297
4301
  return this.comms.log(`Module "${t}" does not exist in the library`), !1;
4298
- const A = this.loadedModules.findIndex((i) => i instanceof e);
4302
+ const A = this.loadedModules.findIndex((n) => n instanceof e);
4299
4303
  return A < 0 ? !1 : (this.loadedModules[A].unmount(this.wnd, this.comms), this.loadedModules.splice(A, 1), !0);
4300
4304
  }
4301
4305
  /**
@@ -4315,8 +4319,8 @@ class $t {
4315
4319
  this.channelId = Ot();
4316
4320
  }
4317
4321
  this.gc = setInterval(() => {
4318
- this.registry.forEach((A, i) => {
4319
- performance.now() - A.time > Pi && (console.warn(i, "event for", A.key, "was never handled!"), this.registry.delete(i));
4322
+ this.registry.forEach((A, n) => {
4323
+ performance.now() - A.time > Pi && (console.warn(n, "event for", A.key, "was never handled!"), this.registry.delete(n));
4320
4324
  });
4321
4325
  }, 5e3), window.addEventListener("message", this.handler), this.send("_ping", void 0);
4322
4326
  }
@@ -4365,7 +4369,7 @@ class $t {
4365
4369
  * Send a message to the window using postMessage-based comms communication
4366
4370
  * @returns Identifier associated with the message
4367
4371
  */
4368
- send(t, e, A, i = !1, r = []) {
4372
+ send(t, e, A, n = !1, r = []) {
4369
4373
  const s = Ot();
4370
4374
  return A && this.registry.set(s, {
4371
4375
  // Add callback to the registry
@@ -4379,7 +4383,7 @@ class $t {
4379
4383
  id: s,
4380
4384
  data: e,
4381
4385
  key: t,
4382
- strict: i
4386
+ strict: n
4383
4387
  },
4384
4388
  "/",
4385
4389
  // Same origin
@@ -4387,13 +4391,13 @@ class $t {
4387
4391
  ), s;
4388
4392
  }
4389
4393
  }
4390
- class vi {
4394
+ class Gi {
4391
4395
  constructor(t) {
4392
4396
  this.hidden = !0, this.destroyed = !1, this.currModules = [], this.frame = document.createElement("iframe"), this.frame.classList.add("readium-navigator-iframe"), this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.opacity = "0", this.frame.style.position = "absolute", this.frame.style.pointerEvents = "none", this.frame.style.transition = "visibility 0s, opacity 0.1s linear", this.source = t;
4393
4397
  }
4394
4398
  async load(t) {
4395
4399
  return new Promise((e, A) => {
4396
- var i;
4400
+ var n;
4397
4401
  if (this.loader) {
4398
4402
  const r = this.frame.contentWindow;
4399
4403
  if ([...this.currModules].sort().join("|") === [...t].sort().join("|")) {
@@ -4403,7 +4407,7 @@ class vi {
4403
4407
  }
4404
4408
  return;
4405
4409
  }
4406
- (i = this.comms) == null || i.halt(), this.loader.destroy(), this.loader = new St(r, t), this.currModules = t, this.comms = void 0;
4410
+ (n = this.comms) == null || n.halt(), this.loader.destroy(), this.loader = new St(r, t), this.currModules = t, this.comms = void 0;
4407
4411
  try {
4408
4412
  e(r);
4409
4413
  } catch {
@@ -4434,8 +4438,8 @@ class vi {
4434
4438
  if (!this.destroyed) {
4435
4439
  if (this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.opacity = "0", this.frame.style.pointerEvents = "none", this.hidden = !0, this.frame.parentElement)
4436
4440
  return this.comms === void 0 || !this.comms.ready ? void 0 : new Promise((e, A) => {
4437
- var i;
4438
- (i = this.comms) == null || i.send("unfocus", void 0, (r) => {
4441
+ var n;
4442
+ (n = this.comms) == null || n.send("unfocus", void 0, (r) => {
4439
4443
  var s;
4440
4444
  (s = this.comms) == null || s.halt(), e();
4441
4445
  });
@@ -4449,8 +4453,8 @@ class vi {
4449
4453
  if (!this.frame.parentElement)
4450
4454
  throw Error("Trying to show frame that is not attached to the DOM");
4451
4455
  return this.comms ? this.comms.resume() : this.comms = new $t(this.frame.contentWindow, this.source), new Promise((e, A) => {
4452
- var i;
4453
- (i = this.comms) == null || i.send("activate", void 0, () => {
4456
+ var n;
4457
+ (n = this.comms) == null || n.send("activate", void 0, () => {
4454
4458
  var r;
4455
4459
  (r = this.comms) == null || r.send("focus", void 0, () => {
4456
4460
  var o;
@@ -4463,8 +4467,8 @@ class vi {
4463
4467
  });
4464
4468
  }
4465
4469
  setCSSProperties(t) {
4466
- var e, A, i;
4467
- this.destroyed || !this.frame.contentWindow || (this.hidden && (this.comms ? (e = this.comms) == null || e.resume() : this.comms = new $t(this.frame.contentWindow, this.source)), (A = this.comms) == null || A.send("update_properties", t), this.hidden && ((i = this.comms) == null || i.halt()));
4470
+ var e, A, n;
4471
+ this.destroyed || !this.frame.contentWindow || (this.hidden && (this.comms ? (e = this.comms) == null || e.resume() : this.comms = new $t(this.frame.contentWindow, this.source)), (A = this.comms) == null || A.send("update_properties", t), this.hidden && ((n = this.comms) == null || n.halt()));
4468
4472
  }
4469
4473
  get iframe() {
4470
4474
  if (this.destroyed)
@@ -4494,8 +4498,8 @@ class vi {
4494
4498
  return this.loader;
4495
4499
  }
4496
4500
  }
4497
- const be = 5, Pe = 3;
4498
- class Gi {
4501
+ const be = 5, ve = 3;
4502
+ class Hi {
4499
4503
  constructor(t, e, A) {
4500
4504
  this.pool = /* @__PURE__ */ new Map(), this.blobs = /* @__PURE__ */ new Map(), this.inprogress = /* @__PURE__ */ new Map(), this.pendingUpdates = /* @__PURE__ */ new Map(), this.container = t, this.positions = e, this.currentCssProperties = A;
4501
4505
  }
@@ -4505,14 +4509,14 @@ class Gi {
4505
4509
  for (; e.value; )
4506
4510
  A.push(e.value), e = t.next();
4507
4511
  A.length > 0 && await Promise.allSettled(A), this.inprogress.clear();
4508
- let i = this.pool.values(), r = i.next();
4512
+ let n = this.pool.values(), r = n.next();
4509
4513
  for (; r.value; )
4510
- await r.value.destroy(), r = i.next();
4514
+ await r.value.destroy(), r = n.next();
4511
4515
  this.pool.clear(), this.blobs.forEach((s) => URL.revokeObjectURL(s)), this.container.childNodes.forEach((s) => {
4512
4516
  (s.nodeType === Node.ELEMENT_NODE || s.nodeType === Node.TEXT_NODE) && s.remove();
4513
4517
  });
4514
4518
  }
4515
- async update(t, e, A, i = !1) {
4519
+ async update(t, e, A, n = !1) {
4516
4520
  let r = this.positions.findIndex((a) => a.locations.position === e.locations.position);
4517
4521
  if (r < 0)
4518
4522
  throw Error(`Locator not found in position list: ${e.locations.position} > ${this.positions.reduce((a, h) => h.locations.position || 0 > a ? h.locations.position || 0 : a, 0)}`);
@@ -4522,23 +4526,23 @@ class Gi {
4522
4526
  var M, B, E;
4523
4527
  const l = [], c = [];
4524
4528
  this.positions.forEach((f, F) => {
4525
- (F > r + be || F < r - be) && (l.includes(f.href) || l.push(f.href)), F < r + Pe && F > r - Pe && (c.includes(f.href) || c.push(f.href));
4529
+ (F > r + be || F < r - be) && (l.includes(f.href) || l.push(f.href)), F < r + ve && F > r - ve && (c.includes(f.href) || c.push(f.href));
4526
4530
  }), l.forEach(async (f) => {
4527
4531
  var F;
4528
4532
  c.includes(f) || this.pool.has(f) && (await ((F = this.pool.get(f)) == null ? void 0 : F.destroy()), this.pool.delete(f), this.pendingUpdates.has(f) && this.pendingUpdates.set(f, { inPool: !1 }));
4529
4533
  }), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((f) => URL.revokeObjectURL(f)), this.blobs.clear()), this.currentBaseURL = t.baseURL;
4530
4534
  const g = async (f) => {
4531
4535
  var U;
4532
- if (i && (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) {
4533
- const Y = this.blobs.get(f);
4534
- Y && (URL.revokeObjectURL(Y), this.blobs.delete(f), this.pendingUpdates.delete(f));
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));
4535
4539
  }
4536
4540
  if (this.pool.has(f)) {
4537
- const Y = this.pool.get(f);
4541
+ const z = this.pool.get(f);
4538
4542
  if (!this.blobs.has(f))
4539
- await Y.destroy(), this.pool.delete(f), this.pendingUpdates.delete(f);
4543
+ await z.destroy(), this.pool.delete(f), this.pendingUpdates.delete(f);
4540
4544
  else {
4541
- await Y.load(A);
4545
+ await z.load(A);
4542
4546
  return;
4543
4547
  }
4544
4548
  }
@@ -4549,7 +4553,7 @@ class Gi {
4549
4553
  const nt = await new rA(t, this.currentBaseURL || "", F, this.currentCssProperties).build();
4550
4554
  this.blobs.set(f, nt);
4551
4555
  }
4552
- const w = new vi(this.blobs.get(f));
4556
+ const w = new Gi(this.blobs.get(f));
4553
4557
  f !== s && await w.hide(), this.container.appendChild(w.iframe), await w.load(A), this.pool.set(f, w);
4554
4558
  };
4555
4559
  try {
@@ -4558,7 +4562,7 @@ class Gi {
4558
4562
  h(f);
4559
4563
  }
4560
4564
  const m = this.pool.get(s);
4561
- if ((m == null ? void 0 : m.source) !== ((M = this._currentFrame) == null ? void 0 : M.source) || i) {
4565
+ if ((m == null ? void 0 : m.source) !== ((M = this._currentFrame) == null ? void 0 : M.source) || n) {
4562
4566
  await ((B = this._currentFrame) == null ? void 0 : B.hide()), m && await m.load(A);
4563
4567
  const f = (((E = e == null ? void 0 : e.locations) == null ? void 0 : E.progression) ?? 0) > 0;
4564
4568
  m && await m.show(f ? e.locations.progression : void 0), this._currentFrame = m;
@@ -4568,12 +4572,12 @@ class Gi {
4568
4572
  this.inprogress.set(s, o), await o, this.inprogress.delete(s);
4569
4573
  }
4570
4574
  setCSSProperties(t) {
4571
- if (!((A, i) => {
4572
- const r = Object.keys(A), s = Object.keys(i);
4575
+ if (!((A, n) => {
4576
+ const r = Object.keys(A), s = Object.keys(n);
4573
4577
  if (r.length !== s.length)
4574
4578
  return !1;
4575
4579
  for (const o of r)
4576
- if (A[o] !== i[o])
4580
+ if (A[o] !== n[o])
4577
4581
  return !1;
4578
4582
  return !0;
4579
4583
  })(this.currentCssProperties || {}, t)) {
@@ -4609,12 +4613,12 @@ class Gi {
4609
4613
  }), t;
4610
4614
  }
4611
4615
  }
4612
- class Hi {
4616
+ class ki {
4613
4617
  constructor(t, e, A) {
4614
4618
  this.currModules = [], this.cachedPage = void 0, this.peripherals = t, this.debugHref = A, this.frame = document.createElement("iframe"), this.frame.classList.add("readium-navigator-iframe"), this.frame.classList.add("blank"), this.frame.scrolling = "no", this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.display = "none", this.frame.style.position = "absolute", this.frame.style.pointerEvents = "none", this.frame.style.transformOrigin = "0 0", this.frame.style.transform = "scale(1)", this.frame.style.background = "#fff", this.frame.style.touchAction = "none", this.frame.dataset.originalHref = A, this.source = "about:blank", this.wrapper = document.createElement("div"), this.wrapper.style.position = "relative", this.wrapper.style.float = this.wrapper.style.cssFloat = e === I.rtl ? "right" : "left", this.wrapper.appendChild(this.frame);
4615
4619
  }
4616
4620
  async load(t, e) {
4617
- return this.source === e && this.loadPromise && [...this.currModules].sort().join("|") === [...t].sort().join("|") ? this.loadPromise : (this.loaded && this.source !== e && this.window.stop(), this.source = e, this.loadPromise = new Promise((A, i) => {
4621
+ return this.source === e && this.loadPromise && [...this.currModules].sort().join("|") === [...t].sort().join("|") ? this.loadPromise : (this.loaded && this.source !== e && this.window.stop(), this.source = e, this.loadPromise = new Promise((A, n) => {
4618
4622
  var r;
4619
4623
  if (this.loader && this.loaded) {
4620
4624
  const s = this.frame.contentWindow;
@@ -4641,7 +4645,7 @@ class Hi {
4641
4645
  }
4642
4646
  }, { once: !0 }), this.frame.addEventListener("error", (s) => {
4643
4647
  try {
4644
- i(s.error), this.loadPromise = void 0;
4648
+ n(s.error), this.loadPromise = void 0;
4645
4649
  } catch {
4646
4650
  }
4647
4651
  }, { once: !0 }), this.frame.style.removeProperty("display"), this.frame.contentWindow.location.replace(this.source);
@@ -4654,9 +4658,9 @@ class Hi {
4654
4658
  );
4655
4659
  if (e) {
4656
4660
  const A = /(\w+) *= *([^\s,]+)/g;
4657
- let i, r = 0, s = 0;
4658
- for (; i = A.exec(e.content); )
4659
- i[1] === "width" ? r = Number.parseFloat(i[2]) : i[1] === "height" && (s = Number.parseFloat(i[2]));
4661
+ let n, r = 0, s = 0;
4662
+ for (; n = A.exec(e.content); )
4663
+ n[1] === "width" ? r = Number.parseFloat(n[2]) : n[1] === "height" && (s = Number.parseFloat(n[2]));
4660
4664
  if (r > 0 && s > 0)
4661
4665
  return { width: r, height: s };
4662
4666
  }
@@ -4672,12 +4676,12 @@ class Hi {
4672
4676
  this.frame.style.height = `${e.height}px`, this.frame.style.width = `${e.width}px`;
4673
4677
  const A = Math.min(this.wrapper.clientWidth / e.width, this.wrapper.clientHeight / e.height);
4674
4678
  this.frame.style.transform = `scale(${A})`;
4675
- const i = this.frame.getBoundingClientRect(), r = this.wrapper.clientHeight - i.height;
4676
- if (this.frame.style.top = `${r / 2}px`, t === J.left) {
4677
- const s = this.wrapper.clientWidth - i.width;
4679
+ const n = this.frame.getBoundingClientRect(), r = this.wrapper.clientHeight - n.height;
4680
+ if (this.frame.style.top = `${r / 2}px`, t === W.left) {
4681
+ const s = this.wrapper.clientWidth - n.width;
4678
4682
  this.frame.style.left = `${s}px`;
4679
- } else if (t === J.center) {
4680
- const s = this.wrapper.clientWidth - i.width;
4683
+ } else if (t === W.center) {
4684
+ const s = this.wrapper.clientWidth - n.width;
4681
4685
  this.frame.style.left = `${s / 2}px`;
4682
4686
  } else
4683
4687
  this.frame.style.left = "0px";
@@ -4690,7 +4694,7 @@ class Hi {
4690
4694
  async unload() {
4691
4695
  var t, e;
4692
4696
  if (this.loaded)
4693
- return this.deselect(), this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.pointerEvents = "none", this.frame.classList.add("blank"), this.frame.classList.remove("loaded"), (t = this.comms) == null || t.halt(), (e = this.loader) == null || e.destroy(), this.comms = void 0, this.frame.blur(), new Promise((A, i) => {
4697
+ return this.deselect(), this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.pointerEvents = "none", this.frame.classList.add("blank"), this.frame.classList.remove("loaded"), (t = this.comms) == null || t.halt(), (e = this.loader) == null || e.destroy(), this.comms = void 0, this.frame.blur(), new Promise((A, n) => {
4694
4698
  this.frame.addEventListener("load", () => {
4695
4699
  try {
4696
4700
  this.showPromise = void 0, A();
@@ -4698,7 +4702,7 @@ class Hi {
4698
4702
  }
4699
4703
  }, { once: !0 }), this.frame.addEventListener("error", (r) => {
4700
4704
  try {
4701
- this.showPromise = void 0, i(r.error);
4705
+ this.showPromise = void 0, n(r.error);
4702
4706
  } catch {
4703
4707
  }
4704
4708
  }, { once: !0 }), this.source = "about:blank", this.frame.contentWindow.location.replace("about:blank"), this.frame.style.display = "none";
@@ -4712,8 +4716,8 @@ class Hi {
4712
4716
  var t;
4713
4717
  if (this.frame.parentElement)
4714
4718
  return this.comms === void 0 ? void 0 : new Promise((e, A) => {
4715
- var i;
4716
- (i = this.comms) == null || i.send("unfocus", void 0, (r) => {
4719
+ var n;
4720
+ (n = this.comms) == null || n.send("unfocus", void 0, (r) => {
4717
4721
  var s;
4718
4722
  (s = this.comms) == null || s.halt(), this.showPromise = void 0, e();
4719
4723
  });
@@ -4730,7 +4734,7 @@ class Hi {
4730
4734
  return;
4731
4735
  }
4732
4736
  return this.showPromise ? (this.cachedPage !== t && (this.update(t), this.cachedPage = t), this.showPromise) : (this.cachedPage = t, this.comms ? this.comms.resume() : this.comms = new $t(this.frame.contentWindow, this.source), this.showPromise = new Promise((e, A) => {
4733
- this.comms.send("focus", void 0, (i) => {
4737
+ this.comms.send("focus", void 0, (n) => {
4734
4738
  this.update(this.cachedPage), e();
4735
4739
  });
4736
4740
  }), this.showPromise);
@@ -4795,13 +4799,13 @@ class Hi {
4795
4799
  */
4796
4800
  class YA {
4797
4801
  constructor() {
4798
- const t = navigator.userAgentData, e = navigator.userAgent, A = (r) => (typeof r == "string" || typeof r == "number") && r ? String(r).replace(/_/g, ".").split(".").map((s) => parseInt(s) || 0) : [], i = (r = "") => {
4802
+ const t = navigator.userAgentData, e = navigator.userAgent, A = (r) => (typeof r == "string" || typeof r == "number") && r ? String(r).replace(/_/g, ".").split(".").map((s) => parseInt(s) || 0) : [], n = (r = "") => {
4799
4803
  if (!r)
4800
4804
  return [];
4801
4805
  const s = new RegExp("^.*" + r + "[ :\\/]?(\\d+([\\._]\\d+)*).*$");
4802
4806
  return s.test(e) ? A(e.replace(s, "$1")) : [];
4803
4807
  };
4804
- this.OS = ((r) => (/(macOS|Mac OS X)/.test(e) ? (/\(iP(hone|od touch);/.test(e) && (r.iOS = i("CPU (?:iPhone )?OS ")), /\(iPad;/.test(e) ? r.iOS = r.iPadOS = i("CPU (?:iPhone )?OS ") : /(macOS|Mac OS X) \d/.test(e) && (document.ontouchend !== void 0 ? r.iOS = r.iPadOS = i() : r.macOS = i("(?:macOS|Mac OS X) "))) : /Windows( NT)? \d/.test(e) ? r.Windows = ((s) => s[0] !== 6 || !s[1] ? s : s[1] === 1 ? [7] : s[1] === 2 ? [8] : [8, 1])(i("Windows(?: NT)?")) : /Android \d/.test(e) ? r.Android = i("Android") : /CrOS/.test(e) ? r.ChromeOS = i() : /X11;/.test(e) && (r.Linux = i()), r))({}), t && t.getHighEntropyValues(["architecture", "model", "platform", "platformVersion", "uaFullVersion"]).then((r) => ((s) => {
4808
+ this.OS = ((r) => (/(macOS|Mac OS X)/.test(e) ? (/\(iP(hone|od touch);/.test(e) && (r.iOS = n("CPU (?:iPhone )?OS ")), /\(iPad;/.test(e) ? r.iOS = r.iPadOS = n("CPU (?:iPhone )?OS ") : /(macOS|Mac OS X) \d/.test(e) && (document.ontouchend !== void 0 ? r.iOS = r.iPadOS = n() : r.macOS = n("(?:macOS|Mac OS X) "))) : /Windows( NT)? \d/.test(e) ? r.Windows = ((s) => s[0] !== 6 || !s[1] ? s : s[1] === 1 ? [7] : s[1] === 2 ? [8] : [8, 1])(n("Windows(?: NT)?")) : /Android \d/.test(e) ? r.Android = n("Android") : /CrOS/.test(e) ? r.ChromeOS = n() : /X11;/.test(e) && (r.Linux = n()), r))({}), t && t.getHighEntropyValues(["architecture", "model", "platform", "platformVersion", "uaFullVersion"]).then((r) => ((s) => {
4805
4809
  const o = r.platform, a = r.platformVersion;
4806
4810
  if (!(!o || !a)) {
4807
4811
  if (/^i(OS|P(hone|od touch))$/.test(o))
@@ -4828,7 +4832,7 @@ class YA {
4828
4832
  const o = t.brands.reduce((a, h) => (a[h.brand] = [h.version * 1], a), {});
4829
4833
  o["Google Chrome"] ? (s = !0, r.Blink = r.Chromium = o.Chromium || [], r.Chrome = o["Google Chrome"]) : o["Microsoft Edge"] ? (s = !0, r.Blink = r.Chromium = o.Chromium || [], r.Edge = o["Microsoft Edge"]) : o.Opera && (s = !0, r.Blink = r.Chromium = o.Chromium || [], r.Opera = o.Opera);
4830
4834
  }
4831
- return s || (/ Gecko\/\d/.test(e) ? (r.Gecko = i("rv"), / Waterfox\/\d/.test(e) ? r.Waterfox = i("Waterfox") : / Firefox\/\d/.test(e) && (r.Firefox = i("Firefox"))) : / Edge\/\d/.test(e) ? (r.EdgeHTML = i("Edge"), r.Edge = r.EdgeHTML) : / Chrom(ium|e)\/\d/.test(e) ? (r.Blink = r.Chromium = ((o) => o[0] ? o : i("Chrome"))(i("Chromium")), / EdgA?\/\d/.test(e) ? r.Edge = ((o) => o[0] ? o : i("Edg"))(i("EdgA")) : / OPR\/\d/.test(e) ? r.Opera = i("OPR") : / Vivaldi\/\d/.test(e) ? r.Vivaldi = i("Vivaldi") : / Silk\/\d/.test(e) ? r.Silk = i("Silk") : / UCBrowser\/\d/.test(e) ? r.UCBrowser = i("UCBrowser") : / Phoebe\/\d/.test(e) ? r.Phoebe = i("Phoebe") : r.Chrome = ((o) => o[0] ? o : r.Chromium)(i("Chrome"))) : / AppleWebKit\/\d/.test(e) ? (r.WebKit = i("AppleWebKit"), / CriOS \d/.test(e) ? r.Chrome = i("CriOS") : / FxiOS \d/.test(e) ? r.Firefox = i("FxiOS") : / EdgiOS\/\d/.test(e) ? r.Edge = i("EdgiOS") : / Version\/\d/.test(e) && (r.Safari = i("Version"))) : / Trident\/\d/.test(e) && (r.Trident = i("Trident"), r.InternetExplorer = ((o) => o[0] ? o : i("MSIE"))(i("rv")))), /[\[; ]FB(AN|_IAB)\//.test(e) && (r.Facebook = i("FBAV")), / Line\/\d/.test(e) && (r.LINE = i("Line")), r;
4835
+ return s || (/ Gecko\/\d/.test(e) ? (r.Gecko = n("rv"), / Waterfox\/\d/.test(e) ? r.Waterfox = n("Waterfox") : / Firefox\/\d/.test(e) && (r.Firefox = n("Firefox"))) : / Edge\/\d/.test(e) ? (r.EdgeHTML = n("Edge"), r.Edge = r.EdgeHTML) : / Chrom(ium|e)\/\d/.test(e) ? (r.Blink = r.Chromium = ((o) => o[0] ? o : n("Chrome"))(n("Chromium")), / EdgA?\/\d/.test(e) ? r.Edge = ((o) => o[0] ? o : n("Edg"))(n("EdgA")) : / OPR\/\d/.test(e) ? r.Opera = n("OPR") : / Vivaldi\/\d/.test(e) ? r.Vivaldi = n("Vivaldi") : / Silk\/\d/.test(e) ? r.Silk = n("Silk") : / UCBrowser\/\d/.test(e) ? r.UCBrowser = n("UCBrowser") : / Phoebe\/\d/.test(e) ? r.Phoebe = n("Phoebe") : r.Chrome = ((o) => o[0] ? o : r.Chromium)(n("Chrome"))) : / AppleWebKit\/\d/.test(e) ? (r.WebKit = n("AppleWebKit"), / CriOS \d/.test(e) ? r.Chrome = n("CriOS") : / FxiOS \d/.test(e) ? r.Firefox = n("FxiOS") : / EdgiOS\/\d/.test(e) ? r.Edge = n("EdgiOS") : / Version\/\d/.test(e) && (r.Safari = n("Version"))) : / Trident\/\d/.test(e) && (r.Trident = n("Trident"), r.InternetExplorer = ((o) => o[0] ? o : n("MSIE"))(n("rv")))), /[\[; ]FB(AN|_IAB)\//.test(e) && (r.Facebook = n("FBAV")), / Line\/\d/.test(e) && (r.LINE = n("Line")), r;
4832
4836
  })({}), this.Env = { get: () => [this.OS, this.UA].reduce((r, s) => {
4833
4837
  for (const o in s)
4834
4838
  s[o] && r.push(o);
@@ -4836,7 +4840,7 @@ class YA {
4836
4840
  }, []) };
4837
4841
  }
4838
4842
  }
4839
- class ki extends YA {
4843
+ class Ji extends YA {
4840
4844
  get iOSRequest() {
4841
4845
  const t = navigator.userAgentData, e = navigator.userAgent;
4842
4846
  if (this.OS.iOS && !this.OS.iPadOS)
@@ -4845,9 +4849,9 @@ class ki extends YA {
4845
4849
  return /\(iPad;/.test(e) || t && /^iPad(OS)?$/.test(t.platform) ? "mobile" : "desktop";
4846
4850
  }
4847
4851
  }
4848
- const kt = new YA(), xt = new ki();
4849
- var Ji = /* @__PURE__ */ ((n) => (n[n.Left = 0] = "Left", n[n.Center = 1] = "Center", n[n.Right = 2] = "Right", n))(Ji || {}), Wi = /* @__PURE__ */ ((n) => (n[n.Top = 0] = "Top", n[n.Middle = 1] = "Middle", n[n.Bottom = 2] = "Bottom", n))(Wi || {});
4850
- class Li {
4852
+ const kt = new YA(), xt = new Ji();
4853
+ var Wi = /* @__PURE__ */ ((i) => (i[i.Left = 0] = "Left", i[i.Center = 1] = "Center", i[i.Right = 2] = "Right", i))(Wi || {}), Li = /* @__PURE__ */ ((i) => (i[i.Top = 0] = "Top", i[i.Middle = 1] = "Middle", i[i.Bottom = 2] = "Bottom", i))(Li || {});
4854
+ class Oi {
4851
4855
  constructor() {
4852
4856
  this.outerWidth = 0, this.outerHeight = 0, this.HTML = document.documentElement, this.Head = document.head, this.Body = document.body;
4853
4857
  }
@@ -4855,21 +4859,21 @@ class Li {
4855
4859
  kt.OS.iOS || (this.outerHeight = window.outerHeight - window.innerHeight, kt.OS.Android && kt.UA.Chrome && window.screen.height > window.innerHeight && (this.outerHeight = (window.screen.height - window.innerHeight) / 1.5), this.outerWidth = window.outerWidth - window.innerWidth);
4856
4860
  }
4857
4861
  getBibiEventCoord(t, e = 0) {
4858
- var i;
4862
+ var n;
4859
4863
  const A = { X: 0, Y: 0 };
4860
- return /^touch/.test(t.type) ? (A.X = t.touches[e].screenX, A.Y = t.touches[e].screenY) : (A.X = t.screenX, A.Y = t.screenY), (((i = t.target.ownerDocument) == null ? void 0 : i.documentElement) || t.target.documentElement) === this.HTML && (A.X -= this.HTML.scrollLeft + this.Body.scrollLeft, A.Y -= this.HTML.scrollTop + this.Body.scrollTop), A.X -= this.outerWidth, A.Y -= this.outerHeight, A;
4864
+ return /^touch/.test(t.type) ? (A.X = t.touches[e].screenX, A.Y = t.touches[e].screenY) : (A.X = t.screenX, A.Y = t.screenY), (((n = t.target.ownerDocument) == null ? void 0 : n.documentElement) || t.target.documentElement) === this.HTML && (A.X -= this.HTML.scrollLeft + this.Body.scrollLeft, A.Y -= this.HTML.scrollTop + this.Body.scrollTop), A.X -= this.outerWidth, A.Y -= this.outerHeight, A;
4861
4865
  }
4862
4866
  getTouchDistance(t) {
4863
4867
  if (t.touches.length !== 2)
4864
4868
  return 0;
4865
- const e = t.touches[0].screenX - this.outerWidth, A = t.touches[0].screenY - this.outerHeight, i = t.touches[1].screenX - this.outerWidth, r = t.touches[1].screenY - this.outerHeight;
4866
- return Math.sqrt(Math.pow(i - e, 2) + Math.pow(r - A, 2));
4869
+ const e = t.touches[0].screenX - this.outerWidth, A = t.touches[0].screenY - this.outerHeight, n = t.touches[1].screenX - this.outerWidth, r = t.touches[1].screenY - this.outerHeight;
4870
+ return Math.sqrt(Math.pow(n - e, 2) + Math.pow(r - A, 2));
4867
4871
  }
4868
4872
  getTouchCenter(t) {
4869
4873
  if (t.touches.length !== 2)
4870
4874
  return null;
4871
- const e = this.HTML.scrollLeft + this.Body.scrollLeft, A = this.HTML.scrollTop + this.Body.scrollTop, i = t.touches[0].screenX - this.outerWidth - e, r = t.touches[0].screenY - this.outerHeight - A, s = t.touches[1].screenX - this.outerWidth - e, o = t.touches[1].screenY - this.outerHeight - A;
4872
- return { X: (i + s) / 2, Y: (r + o) / 2 };
4875
+ const e = this.HTML.scrollLeft + this.Body.scrollLeft, A = this.HTML.scrollTop + this.Body.scrollTop, n = t.touches[0].screenX - this.outerWidth - e, r = t.touches[0].screenY - this.outerHeight - A, s = t.touches[1].screenX - this.outerWidth - e, o = t.touches[1].screenY - this.outerHeight - A;
4876
+ return { X: (n + s) / 2, Y: (r + o) / 2 };
4873
4877
  }
4874
4878
  getBibiEvent(t) {
4875
4879
  if (!t)
@@ -4881,7 +4885,7 @@ class Li {
4881
4885
  };
4882
4886
  const e = this.getBibiEventCoord(t);
4883
4887
  let A = 0.3;
4884
- const i = {
4888
+ const n = {
4885
4889
  X: e.X / window.innerWidth,
4886
4890
  Y: e.Y / window.innerHeight
4887
4891
  };
@@ -4891,15 +4895,15 @@ class Li {
4891
4895
  X: null,
4892
4896
  Y: null
4893
4897
  };
4894
- return i.X < o ? h.X = 0 : a < i.X ? h.X = 2 : h.X = 1, i.Y < r ? h.Y = 0 : s < i.Y ? h.Y = 2 : h.Y = 1, {
4898
+ return n.X < o ? h.X = 0 : a < n.X ? h.X = 2 : h.X = 1, n.Y < r ? h.Y = 0 : s < n.Y ? h.Y = 2 : h.Y = 1, {
4895
4899
  Target: t.target,
4896
4900
  Coord: e,
4897
- Ratio: i,
4901
+ Ratio: n,
4898
4902
  Division: h
4899
4903
  };
4900
4904
  }
4901
4905
  }
4902
- class Oi {
4906
+ class Xi {
4903
4907
  constructor() {
4904
4908
  this._DOM = {
4905
4909
  show: !1,
@@ -4917,8 +4921,8 @@ class Oi {
4917
4921
  return this._DOM;
4918
4922
  }
4919
4923
  }
4920
- const ve = 6, Jt = 1.02, Ge = 50;
4921
- class Xi {
4924
+ const Pe = 6, Jt = 1.02, Ge = 50;
4925
+ class Zi {
4922
4926
  constructor(t, e = !1) {
4923
4927
  this.dragState = 0, this.minimumMoved = !1, this.pan = {
4924
4928
  startX: 0,
@@ -4937,7 +4941,7 @@ class Xi {
4937
4941
  target: { X: 0, Y: 0 },
4938
4942
  touchN: 0,
4939
4943
  startTranslate: { X: 0, Y: 0 }
4940
- }, this._scale = 1, this.scaleDebouncer = 0, this.frameBounds = null, this.debugger = null, this.btouchstartHandler = this.touchstartHandler.bind(this), this.btouchendHandler = this.touchendHandler.bind(this), this.btouchmoveHandler = this.touchmoveHandler.bind(this), this.bdblclickHandler = this.dblclickHandler.bind(this), this.bmousedownHandler = this.mousedownHandler.bind(this), this.bmouseupHandler = this.mouseupHandler.bind(this), this.bmousemoveHandler = this.mousemoveHandler.bind(this), this.moveFrame = 0, this.manager = t, this.coordinator = new Li(), this.attachEvents(), e && (this.debugger = new Oi());
4944
+ }, this._scale = 1, this.scaleDebouncer = 0, this.frameBounds = null, this.debugger = null, this.btouchstartHandler = this.touchstartHandler.bind(this), this.btouchendHandler = this.touchendHandler.bind(this), this.btouchmoveHandler = this.touchmoveHandler.bind(this), this.bdblclickHandler = this.dblclickHandler.bind(this), this.bmousedownHandler = this.mousedownHandler.bind(this), this.bmouseupHandler = this.mouseupHandler.bind(this), this.bmousemoveHandler = this.mousemoveHandler.bind(this), this.moveFrame = 0, this.manager = t, this.coordinator = new Oi(), this.attachEvents(), e && (this.debugger = new Xi());
4941
4945
  }
4942
4946
  get scale() {
4943
4947
  return this._scale;
@@ -4998,7 +5002,7 @@ class Xi {
4998
5002
  * touchstart event handler
4999
5003
  */
5000
5004
  touchstartHandler(t) {
5001
- var i, r;
5005
+ var n, r;
5002
5006
  if (["TEXTAREA", "OPTION", "INPUT", "SELECT"].indexOf(t.target.nodeName) !== -1)
5003
5007
  return;
5004
5008
  switch (t.stopPropagation(), this.frameBounds = this.manager.currentBounds, this.coordinator.refreshOuterPixels(this.frameBounds), t.touches.length) {
@@ -5007,7 +5011,7 @@ class Xi {
5007
5011
  case 2: {
5008
5012
  t.preventDefault(), this.pinch.startDistance = this.coordinator.getTouchDistance(t);
5009
5013
  const s = this.startTouch(t);
5010
- this.pan.startX = s.X, this.pan.startY = s.Y, this.dragState = 2, this.manager.updateBookStyle(!0), this.isScaled ? (this.pinch.target.X -= this.pan.translateX * (this.pinch.startScale / this.scale), this.pinch.target.Y -= this.pan.translateY * (this.pinch.startScale / this.scale), this.pinch.target = { X: 0, Y: 0 }, this.pinch.startScale = 1 / this.scale) : (this.pinch.target = { X: 0, Y: 0 }, this.pinch.startScale = this.scale), this.pinch.startTranslate = { X: this.pan.translateX, Y: this.pan.translateY }, (i = this.debugger) != null && i.show && (this.debugger.DOM.touch2.style.display = "", this.debugger.DOM.center.style.display = "", this.debugger.DOM.pinchTarget.style.display = "");
5014
+ this.pan.startX = s.X, this.pan.startY = s.Y, this.dragState = 2, this.manager.updateBookStyle(!0), this.isScaled ? (this.pinch.target.X -= this.pan.translateX * (this.pinch.startScale / this.scale), this.pinch.target.Y -= this.pan.translateY * (this.pinch.startScale / this.scale), this.pinch.target = { X: 0, Y: 0 }, this.pinch.startScale = 1 / this.scale) : (this.pinch.target = { X: 0, Y: 0 }, this.pinch.startScale = this.scale), this.pinch.startTranslate = { X: this.pan.translateX, Y: this.pan.translateY }, (n = this.debugger) != null && n.show && (this.debugger.DOM.touch2.style.display = "", this.debugger.DOM.center.style.display = "", this.debugger.DOM.pinchTarget.style.display = "");
5011
5015
  return;
5012
5016
  }
5013
5017
  case 1:
@@ -5036,8 +5040,8 @@ class Xi {
5036
5040
  this.pan.endX && !this.isScaled ? (this.pinch.touchN && (this.pan.endX = this.pan.startX), this.updateAfterDrag()) : !this.pinch.touchN && Math.abs(this.pan.overscrollX) > Ge && Math.abs(this.pan.overscrollY) < Ge / 2 && (this.pan.startX = 0, this.pan.endX = -this.pan.overscrollX, this.updateAfterDrag()), this.dragState = 0, this.minimumMoved = !1, this.clearPinch(), (e = this.debugger) != null && e.show && (this.debugger.DOM.center.style.display = "none", this.debugger.DOM.touch1.style.display = "none", this.debugger.DOM.touch2.style.display = "none");
5037
5041
  else if (t.touches.length === 1) {
5038
5042
  this.dragState = 1, t.touches[0].identifier !== this.pan.touchID && (this.pan.touchID = t.touches[0].identifier), (A = this.debugger) != null && A.show && (this.debugger.DOM.center.style.display = "none", this.debugger.DOM.touch2.style.display = "none", this.debugger.DOM.pinchTarget.style.display = "none");
5039
- const i = this.startTouch(t);
5040
- this.pan.startX = i.X, this.pan.startY = i.Y;
5043
+ const n = this.startTouch(t);
5044
+ this.pan.startX = n.X, this.pan.startY = n.Y;
5041
5045
  }
5042
5046
  window.setTimeout(() => {
5043
5047
  this.manager.updateBookStyle(!0), this.dragState === 0 && (this.scale < Jt && (this.pan.translateX = 0, this.pan.translateY = 0), this.clearPan()), this.manager.updateBookStyle(!0);
@@ -5052,13 +5056,13 @@ class Xi {
5052
5056
  const e = this.coordinator.getBibiEventCoord(t);
5053
5057
  Math.abs(this.pan.startY - e.Y) + Math.abs(this.pan.startX - e.X) > 5 && (this.minimumMoved || (this.manager.deselect(), this.minimumMoved = !0), this.dragState < 1 && (this.dragState = 1));
5054
5058
  const A = (s = this.coordinator) == null ? void 0 : s.getTouchDistance(t);
5055
- let i = !1;
5059
+ let n = !1;
5056
5060
  const r = this.scale;
5057
5061
  if (this.dragState === 2 && A) {
5058
5062
  if (this.pinch.touchN++, this.pinch.touchN < 4)
5059
5063
  return;
5060
5064
  let c = A / this.pinch.startDistance * this.scale;
5061
- c >= ve && (c = ve), c <= Jt && (c = 1), this.scale = c, this.pinch.startDistance = A, i = !0;
5065
+ c >= Pe && (c = Pe), c <= Jt && (c = 1), this.scale = c, this.pinch.startDistance = A, n = !0;
5062
5066
  }
5063
5067
  if (this.pan.letItGo === !1 && (this.pan.letItGo = Math.abs(this.pan.startY - e.Y) < Math.abs(this.pan.startX - e.X)), (o = this.debugger) != null && o.show && (this.debugger.DOM.touch1.style.top = `${e.Y - 10}px`, this.debugger.DOM.touch1.style.left = `${e.X - 10}px`, this.debugger.DOM.touch1.innerText = `${e.X.toFixed(2)},${e.Y.toFixed(2)}`), this.dragState > 0 && this.isScaled || this.dragState > 1) {
5064
5068
  if (this.dragState === 1) {
@@ -5083,12 +5087,12 @@ class Xi {
5083
5087
  this.pan.translateX = E, this.pan.translateY = f, (h = this.debugger) != null && h.show && (this.debugger.DOM.pinchTarget.style.left = `${this.pinch.target.X * this.scale / this.pinch.startScale - 5 + this.manager.width / 2}px`, this.debugger.DOM.pinchTarget.style.top = `${this.pinch.target.Y * this.scale / this.pinch.startScale - 5 + this.manager.height / 2}px`, this.debugger.DOM.pinchTarget.innerText = `${(this.pinch.target.X * this.scale / this.pinch.startScale).toFixed(2)},${(this.pinch.target.Y * this.scale / this.pinch.startScale).toFixed(2)}`);
5084
5088
  }
5085
5089
  const c = this.frameBounds.width / 6, g = this.frameBounds.height / 6;
5086
- this.pan.translateX < -c && (this.pan.overscrollX = -(c + this.pan.translateX), this.pan.translateX = -c), this.pan.translateY < -g && (this.pan.overscrollY = -(g + this.pan.translateY), this.pan.translateY = -g), this.pan.translateX > c && (this.pan.overscrollX = c - this.pan.translateX, this.pan.translateX = c), this.pan.translateY > g && (this.pan.overscrollY = g - this.pan.translateY, this.pan.translateY = g), i = !0, (l = this.debugger) != null && l.show && (this.debugger.DOM.stats.innerText = `TX: ${this.pan.translateX.toFixed(2)}
5090
+ this.pan.translateX < -c && (this.pan.overscrollX = -(c + this.pan.translateX), this.pan.translateX = -c), this.pan.translateY < -g && (this.pan.overscrollY = -(g + this.pan.translateY), this.pan.translateY = -g), this.pan.translateX > c && (this.pan.overscrollX = c - this.pan.translateX, this.pan.translateX = c), this.pan.translateY > g && (this.pan.overscrollY = g - this.pan.translateY, this.pan.translateY = g), n = !0, (l = this.debugger) != null && l.show && (this.debugger.DOM.stats.innerText = `TX: ${this.pan.translateX.toFixed(2)}
5087
5091
  TY: ${this.pan.translateY.toFixed(2)}
5088
5092
  Zoom: ${this.scale.toFixed(2)}
5089
5093
  Overscroll: ${this.pan.overscrollX.toFixed(2)},${this.pan.overscrollY.toFixed(2)}`);
5090
5094
  }
5091
- if (i) {
5095
+ if (n) {
5092
5096
  this.manager.updateBookStyle();
5093
5097
  return;
5094
5098
  }
@@ -5140,16 +5144,16 @@ Overscroll: ${this.pan.overscrollX.toFixed(2)},${this.pan.overscrollY.toFixed(2)
5140
5144
  t > 0 && e > this.manager.threshold && this.manager.slength > this.manager.perPage ? this.manager.listener("no_less", void 0) : t < 0 && e > this.manager.threshold && this.manager.slength > this.manager.perPage && this.manager.listener("no_more", void 0), this.manager.slideToCurrent(!0, !0);
5141
5145
  }
5142
5146
  }
5143
- class Zi {
5147
+ class Ki {
5144
5148
  // TODO getter
5145
5149
  constructor(t) {
5146
5150
  this.shift = !0, this.spreads = [], this.nLandscape = 0, this.index(t), this.testShift(t), console.log(`Indexed ${this.spreads.length} spreads for ${t.readingOrder.items.length} items`);
5147
5151
  }
5148
5152
  index(t, e = !1) {
5149
- this.nLandscape = 0, t.readingOrder.items.forEach((A, i) => {
5153
+ this.nLandscape = 0, t.readingOrder.items.forEach((A, n) => {
5150
5154
  var s, o, a, h, l;
5151
- e || (t.readingOrder.items[i] = A.addProperties({
5152
- number: i + 1,
5155
+ e || (t.readingOrder.items[n] = A.addProperties({
5156
+ number: n + 1,
5153
5157
  isImage: ((s = A.type) == null ? void 0 : s.indexOf("image/")) === 0
5154
5158
  }));
5155
5159
  const r = ((o = A.properties) == null ? void 0 : o.getOrientation()) === it.landscape;
@@ -5159,26 +5163,26 @@ class Zi {
5159
5163
  "center"
5160
5164
  ) : (
5161
5165
  // Center it
5162
- ((this.shift ? 0 : 1) + i - this.nLandscape) % 2 ? t.metadata.readingProgression === I.rtl ? "right" : "left" : t.metadata.readingProgression === I.rtl ? "left" : "right"
5166
+ ((this.shift ? 0 : 1) + n - this.nLandscape) % 2 ? t.metadata.readingProgression === I.rtl ? "right" : "left" : t.metadata.readingProgression === I.rtl ? "left" : "right"
5163
5167
  )
5164
5168
  })), (r || (l = A.properties) != null && l.otherProperties.addBlank) && this.nLandscape++;
5165
5169
  }), e && (this.spreads = []), this.buildSpreads(t.readingOrder);
5166
5170
  }
5167
5171
  testShift(t) {
5168
5172
  let e = !1;
5169
- this.spreads.forEach((A, i) => {
5173
+ this.spreads.forEach((A, n) => {
5170
5174
  var o, a, h, l, c;
5171
5175
  if (A.length > 1)
5172
5176
  return;
5173
5177
  const r = A[0], s = (o = r.properties) == null ? void 0 : o.getOrientation();
5174
- i === 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()) === J.center && this.spreads[i - 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()) === 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;
5175
5179
  }), this.shift || this.index(t, !0);
5176
5180
  }
5177
5181
  buildSpreads(t) {
5178
5182
  let e = [];
5179
- t.items.forEach((A, i) => {
5183
+ t.items.forEach((A, n) => {
5180
5184
  var r;
5181
- !i && this.shift ? this.spreads.push([A]) : ((r = A.properties) == null ? void 0 : r.getPage()) === J.center ? (e.length > 0 && this.spreads.push(e), this.spreads.push([A]), e = []) : e.length >= 2 ? (this.spreads.push(e), e = [A]) : e.push(A);
5185
+ !n && this.shift ? this.spreads.push([A]) : ((r = A.properties) == null ? void 0 : r.getPage()) === W.center ? (e.length > 0 && this.spreads.push(e), this.spreads.push([A]), e = []) : e.length >= 2 ? (this.spreads.push(e), e = [A]) : e.push(A);
5182
5186
  }), e.length > 0 && this.spreads.push(e);
5183
5187
  }
5184
5188
  currentSpread(t, e) {
@@ -5188,15 +5192,15 @@ class Zi {
5188
5192
  return this.spreads.find((e) => e.includes(t)) || void 0;
5189
5193
  }
5190
5194
  }
5191
- const He = 8, ke = 5, Ki = 300, qi = 15e3, _i = 250, $i = 150, tn = 500;
5192
- class en {
5195
+ const He = 8, ke = 5, qi = 300, _i = 15e3, $i = 250, tn = 150, en = 500;
5196
+ class An {
5193
5197
  constructor(t, e, A) {
5194
- var i;
5195
- 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 = ((i = A.metadata.getPresentation()) == null ? void 0 : i.spread) || Ct.auto, this.pub.metadata.effectiveReadingProgression !== I.rtl && this.pub.metadata.effectiveReadingProgression !== I.ltr)
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)
5196
5200
  throw Error("Unsupported reading progression for EPUB");
5197
- this.spreader = new Zi(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 Xi(this), this.pub.readingOrder.items.forEach((r) => {
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) => {
5198
5202
  var o, a;
5199
- const s = new Hi(this.peripherals, this.pub.metadata.effectiveReadingProgression, r.href);
5203
+ const s = new ki(this.peripherals, this.pub.metadata.effectiveReadingProgression, r.href);
5200
5204
  this.spineElement.appendChild(s.element), this.pool.set(r.href, s), s.width = 100 / this.length * (((o = r.properties) == null ? void 0 : o.getOrientation()) === it.landscape || (a = r.properties) != null && a.otherProperties.addBlank ? this.perPage : 1), s.height = this.height;
5201
5205
  });
5202
5206
  }
@@ -5214,16 +5218,16 @@ class en {
5214
5218
  */
5215
5219
  resizeHandler(t = !0, e = !0) {
5216
5220
  this.currentSlide + this.perPage > this.length && (this.currentSlide = this.length <= this.perPage ? 0 : this.length - 1), this.containerHeightCached = this.container.clientHeight, this.orientationInternal = -1, this.updateSpineStyle(!0), t && (this.currentSlide = this.reAlign(), this.slideToCurrent(!e, e)), clearTimeout(this.resizeTimeout), this.resizeTimeout = window.setTimeout(() => {
5217
- this.pool.forEach((A, i) => {
5221
+ this.pool.forEach((A, n) => {
5218
5222
  var a, h;
5219
- let r = this.pub.readingOrder.items.findIndex((l) => l.href === i);
5223
+ let r = this.pub.readingOrder.items.findIndex((l) => l.href === n);
5220
5224
  const s = this.pub.readingOrder.items[r];
5221
5225
  if (A.width = 100 / this.length * (((a = s.properties) == null ? void 0 : a.getOrientation()) === it.landscape || (h = s.properties) != null && h.otherProperties.addBlank ? this.perPage : 1), A.height = this.height, !A.loaded)
5222
5226
  return;
5223
5227
  const o = this.spreader.findByLink(s);
5224
5228
  A.update(this.spreadPosition(o, s));
5225
5229
  });
5226
- }, _i);
5230
+ }, $i);
5227
5231
  }
5228
5232
  /**
5229
5233
  * It is important that these values be cached to avoid spamming them on redraws, they are expensive.
@@ -5244,13 +5248,13 @@ class en {
5244
5248
  return 50;
5245
5249
  }
5246
5250
  get portrait() {
5247
- return this.spreadPresentation === Ct.none ? !0 : (this.orientationInternal === -1 && (this.orientationInternal = this.containerHeightCached > this.container.clientWidth ? 1 : 0), this.orientationInternal === 1);
5251
+ return this.spreadPresentation === yt.none ? !0 : (this.orientationInternal === -1 && (this.orientationInternal = this.containerHeightCached > this.container.clientWidth ? 1 : 0), this.orientationInternal === 1);
5248
5252
  }
5249
5253
  updateSpineStyle(t, e = !0) {
5250
5254
  let A = "0";
5251
5255
  this.updateDimensions(), this.perPage > 1 && (A = `${this.width / 2}px`);
5252
- const i = {
5253
- transition: t ? `all ${e ? $i : tn}ms ease-out` : "all 0ms ease-out",
5256
+ const n = {
5257
+ transition: t ? `all ${e ? tn : en}ms ease-out` : "all 0ms ease-out",
5254
5258
  marginRight: this.rtl ? A : "0",
5255
5259
  marginLeft: this.rtl ? "0" : A,
5256
5260
  width: `${this.width / this.perPage * this.length}px`,
@@ -5258,12 +5262,12 @@ class en {
5258
5262
  // Static (should be moved to CSS)
5259
5263
  contain: "content"
5260
5264
  };
5261
- Object.assign(this.spineElement.style, i);
5265
+ Object.assign(this.spineElement.style, n);
5262
5266
  }
5263
5267
  updateBookStyle(t = !1) {
5264
5268
  var e, A;
5265
5269
  if (t) {
5266
- const i = {
5270
+ const n = {
5267
5271
  overflow: "hidden",
5268
5272
  direction: this.pub.metadata.effectiveReadingProgression,
5269
5273
  cursor: "",
@@ -5277,7 +5281,7 @@ class en {
5277
5281
  transition: (e = this.peripherals) != null && e.dragState ? "none" : "transform .15s ease-in-out",
5278
5282
  touchAction: "none"
5279
5283
  };
5280
- Object.assign(this.bookElement.style, i);
5284
+ Object.assign(this.bookElement.style, n);
5281
5285
  }
5282
5286
  this.bookElement.style.transform = `scale(${((A = this.peripherals) == null ? void 0 : A.scale) || 1})` + (this.peripherals ? ` translate3d(${this.peripherals.pan.translateX}px, ${this.peripherals.pan.translateY}px, 0px)` : "");
5283
5287
  }
@@ -5373,9 +5377,9 @@ class en {
5373
5377
  for (; e.value; )
5374
5378
  A.push(e.value), e = t.next();
5375
5379
  A.length > 0 && await Promise.allSettled(A), this.inprogress.clear();
5376
- let i = this.pool.values(), r = i.next();
5380
+ let n = this.pool.values(), r = n.next();
5377
5381
  for (; r.value; )
5378
- await r.value.destroy(), r = i.next();
5382
+ await r.value.destroy(), r = n.next();
5379
5383
  this.pool.clear(), this.blobs.forEach((s) => URL.revokeObjectURL(s)), this.container.childNodes.forEach((s) => {
5380
5384
  (s.nodeType === Node.ELEMENT_NODE || s.nodeType === Node.TEXT_NODE) && s.remove();
5381
5385
  });
@@ -5387,7 +5391,7 @@ class en {
5387
5391
  return t % 2 && !this.single && t++, t;
5388
5392
  }
5389
5393
  spreadPosition(t, e) {
5390
- return this.perPage < 2 || t.length < 2 ? J.center : e.href === t[0].href ? this.rtl ? J.right : J.left : this.rtl ? J.left : J.right;
5394
+ return this.perPage < 2 || t.length < 2 ? W.center : e.href === t[0].href ? this.rtl ? W.right : W.left : this.rtl ? W.left : W.right;
5391
5395
  }
5392
5396
  async waitForItem(t) {
5393
5397
  if (this.inprogress.has(t) && await this.inprogress.get(t), this.delayedShow.has(t)) {
@@ -5401,7 +5405,7 @@ class en {
5401
5405
  e > 0 && clearTimeout(e), this.delayedShow.delete(t);
5402
5406
  }
5403
5407
  }
5404
- async update(t, e, A, i = !1) {
5408
+ async update(t, e, A, n = !1) {
5405
5409
  let r = this.pub.readingOrder.items.findIndex((a) => a.href === e.href);
5406
5410
  if (r < 0)
5407
5411
  throw Error("Href not found in reading order");
@@ -5429,12 +5433,12 @@ class en {
5429
5433
  let w = !1;
5430
5434
  const U = window.setTimeout(async () => {
5431
5435
  this.delayedTimeout.set(M, 0);
5432
- const Y = this.makeSpread(this.reAlign(B)), nt = this.spreadPosition(Y, E), mt = this.pool.get(M);
5436
+ const z = this.makeSpread(this.reAlign(B)), nt = this.spreadPosition(z, E), mt = this.pool.get(M);
5433
5437
  await mt.load(A, this.blobs.get(M)), this.peripherals.isScaled || await mt.show(nt), this.delayedShow.delete(M), w = !0, f();
5434
- }, Ki);
5438
+ }, qi);
5435
5439
  setTimeout(() => {
5436
5440
  !w && this.delayedShow.has(M) && F(`Offscreen load timeout: ${M}`);
5437
- }, qi), this.delayedTimeout.set(M, U);
5441
+ }, _i), this.delayedTimeout.set(M, U);
5438
5442
  }));
5439
5443
  }
5440
5444
  };
@@ -5489,13 +5493,13 @@ class en {
5489
5493
  }), t;
5490
5494
  }
5491
5495
  get currentNumbers() {
5492
- var e, A, i, r;
5496
+ var e, A, n, r;
5493
5497
  if (this.perPage < 2)
5494
5498
  return [(e = this.pub.readingOrder.items[this.currentSlide].properties) == null ? void 0 : e.otherProperties.number];
5495
5499
  const t = this.spreader.currentSpread(this.currentSlide, this.perPage);
5496
5500
  return t.length > 1 ? [
5497
5501
  (A = t[0].properties) == null ? void 0 : A.otherProperties.number,
5498
- (i = t[t.length - 1].properties) == null ? void 0 : i.otherProperties.number
5502
+ (n = t[t.length - 1].properties) == null ? void 0 : n.otherProperties.number
5499
5503
  ] : [(r = t[0].properties) == null ? void 0 : r.otherProperties.number];
5500
5504
  }
5501
5505
  deselect() {
@@ -5503,80 +5507,80 @@ class en {
5503
5507
  (t = this.currentFrames) == null || t.forEach((e) => e == null ? void 0 : e.deselect());
5504
5508
  }
5505
5509
  }
5506
- function W(n) {
5507
- if (typeof n != "string")
5508
- throw new TypeError("Path must be a string. Received " + JSON.stringify(n));
5510
+ function L(i) {
5511
+ if (typeof i != "string")
5512
+ throw new TypeError("Path must be a string. Received " + JSON.stringify(i));
5509
5513
  }
5510
- function Je(n, t) {
5511
- for (var e = "", A = 0, i = -1, r = 0, s, o = 0; o <= n.length; ++o) {
5512
- if (o < n.length)
5513
- s = n.charCodeAt(o);
5514
+ function Je(i, t) {
5515
+ for (var e = "", A = 0, n = -1, r = 0, s, o = 0; o <= i.length; ++o) {
5516
+ if (o < i.length)
5517
+ s = i.charCodeAt(o);
5514
5518
  else {
5515
5519
  if (s === 47)
5516
5520
  break;
5517
5521
  s = 47;
5518
5522
  }
5519
5523
  if (s === 47) {
5520
- if (!(i === o - 1 || r === 1))
5521
- if (i !== o - 1 && r === 2) {
5524
+ if (!(n === o - 1 || r === 1))
5525
+ if (n !== o - 1 && r === 2) {
5522
5526
  if (e.length < 2 || A !== 2 || e.charCodeAt(e.length - 1) !== 46 || e.charCodeAt(e.length - 2) !== 46) {
5523
5527
  if (e.length > 2) {
5524
5528
  var a = e.lastIndexOf("/");
5525
5529
  if (a !== e.length - 1) {
5526
- a === -1 ? (e = "", A = 0) : (e = e.slice(0, a), A = e.length - 1 - e.lastIndexOf("/")), i = o, r = 0;
5530
+ a === -1 ? (e = "", A = 0) : (e = e.slice(0, a), A = e.length - 1 - e.lastIndexOf("/")), n = o, r = 0;
5527
5531
  continue;
5528
5532
  }
5529
5533
  } else if (e.length === 2 || e.length === 1) {
5530
- e = "", A = 0, i = o, r = 0;
5534
+ e = "", A = 0, n = o, r = 0;
5531
5535
  continue;
5532
5536
  }
5533
5537
  }
5534
5538
  t && (e.length > 0 ? e += "/.." : e = "..", A = 2);
5535
5539
  } else
5536
- e.length > 0 ? e += "/" + n.slice(i + 1, o) : e = n.slice(i + 1, o), A = o - i - 1;
5537
- i = o, r = 0;
5540
+ e.length > 0 ? e += "/" + i.slice(n + 1, o) : e = i.slice(n + 1, o), A = o - n - 1;
5541
+ n = o, r = 0;
5538
5542
  } else
5539
5543
  s === 46 && r !== -1 ? ++r : r = -1;
5540
5544
  }
5541
5545
  return e;
5542
5546
  }
5543
- function An(n, t) {
5547
+ function nn(i, t) {
5544
5548
  var e = t.dir || t.root, A = t.base || (t.name || "") + (t.ext || "");
5545
- return e ? e === t.root ? e + A : e + n + A : A;
5549
+ return e ? e === t.root ? e + A : e + i + A : A;
5546
5550
  }
5547
5551
  var ht = {
5548
5552
  // path.resolve([from ...], to)
5549
5553
  resolve: function() {
5550
- for (var t = "", e = !1, A, i = arguments.length - 1; i >= -1 && !e; i--) {
5554
+ for (var t = "", e = !1, A, n = arguments.length - 1; n >= -1 && !e; n--) {
5551
5555
  var r;
5552
- i >= 0 ? r = arguments[i] : (A === void 0 && (A = process.cwd()), r = A), W(r), r.length !== 0 && (t = r + "/" + t, e = r.charCodeAt(0) === 47);
5556
+ n >= 0 ? r = arguments[n] : (A === void 0 && (A = process.cwd()), r = A), L(r), r.length !== 0 && (t = r + "/" + t, e = r.charCodeAt(0) === 47);
5553
5557
  }
5554
5558
  return t = Je(t, !e), e ? t.length > 0 ? "/" + t : "/" : t.length > 0 ? t : ".";
5555
5559
  },
5556
5560
  normalize: function(t) {
5557
- if (W(t), t.length === 0)
5561
+ if (L(t), t.length === 0)
5558
5562
  return ".";
5559
5563
  var e = t.charCodeAt(0) === 47, A = t.charCodeAt(t.length - 1) === 47;
5560
5564
  return t = Je(t, !e), t.length === 0 && !e && (t = "."), t.length > 0 && A && (t += "/"), e ? "/" + t : t;
5561
5565
  },
5562
5566
  isAbsolute: function(t) {
5563
- return W(t), t.length > 0 && t.charCodeAt(0) === 47;
5567
+ return L(t), t.length > 0 && t.charCodeAt(0) === 47;
5564
5568
  },
5565
5569
  join: function() {
5566
5570
  if (arguments.length === 0)
5567
5571
  return ".";
5568
5572
  for (var t, e = 0; e < arguments.length; ++e) {
5569
5573
  var A = arguments[e];
5570
- W(A), A.length > 0 && (t === void 0 ? t = A : t += "/" + A);
5574
+ L(A), A.length > 0 && (t === void 0 ? t = A : t += "/" + A);
5571
5575
  }
5572
5576
  return t === void 0 ? "." : ht.normalize(t);
5573
5577
  },
5574
5578
  relative: function(t, e) {
5575
- if (W(t), W(e), t === e || (t = ht.resolve(t), e = ht.resolve(e), t === e))
5579
+ if (L(t), L(e), t === e || (t = ht.resolve(t), e = ht.resolve(e), t === e))
5576
5580
  return "";
5577
5581
  for (var A = 1; A < t.length && t.charCodeAt(A) === 47; ++A)
5578
5582
  ;
5579
- for (var i = t.length, r = i - A, s = 1; s < e.length && e.charCodeAt(s) === 47; ++s)
5583
+ for (var n = t.length, r = n - A, s = 1; s < e.length && e.charCodeAt(s) === 47; ++s)
5580
5584
  ;
5581
5585
  for (var o = e.length, a = o - s, h = r < a ? r : a, l = -1, c = 0; c <= h; ++c) {
5582
5586
  if (c === h) {
@@ -5595,31 +5599,31 @@ var ht = {
5595
5599
  g === 47 && (l = c);
5596
5600
  }
5597
5601
  var M = "";
5598
- for (c = A + l + 1; c <= i; ++c)
5599
- (c === i || t.charCodeAt(c) === 47) && (M.length === 0 ? M += ".." : M += "/..");
5602
+ for (c = A + l + 1; c <= n; ++c)
5603
+ (c === n || t.charCodeAt(c) === 47) && (M.length === 0 ? M += ".." : M += "/..");
5600
5604
  return M.length > 0 ? M + e.slice(s + l) : (s += l, e.charCodeAt(s) === 47 && ++s, e.slice(s));
5601
5605
  },
5602
5606
  _makeLong: function(t) {
5603
5607
  return t;
5604
5608
  },
5605
5609
  dirname: function(t) {
5606
- if (W(t), t.length === 0)
5610
+ if (L(t), t.length === 0)
5607
5611
  return ".";
5608
- for (var e = t.charCodeAt(0), A = e === 47, i = -1, r = !0, s = t.length - 1; s >= 1; --s)
5612
+ for (var e = t.charCodeAt(0), A = e === 47, n = -1, r = !0, s = t.length - 1; s >= 1; --s)
5609
5613
  if (e = t.charCodeAt(s), e === 47) {
5610
5614
  if (!r) {
5611
- i = s;
5615
+ n = s;
5612
5616
  break;
5613
5617
  }
5614
5618
  } else
5615
5619
  r = !1;
5616
- return i === -1 ? A ? "/" : "." : A && i === 1 ? "//" : t.slice(0, i);
5620
+ return n === -1 ? A ? "/" : "." : A && n === 1 ? "//" : t.slice(0, n);
5617
5621
  },
5618
5622
  basename: function(t, e) {
5619
5623
  if (e !== void 0 && typeof e != "string")
5620
5624
  throw new TypeError('"ext" argument must be a string');
5621
- W(t);
5622
- var A = 0, i = -1, r = !0, s;
5625
+ L(t);
5626
+ var A = 0, n = -1, r = !0, s;
5623
5627
  if (e !== void 0 && e.length > 0 && e.length <= t.length) {
5624
5628
  if (e.length === t.length && e === t)
5625
5629
  return "";
@@ -5632,9 +5636,9 @@ var ht = {
5632
5636
  break;
5633
5637
  }
5634
5638
  } else
5635
- a === -1 && (r = !1, a = s + 1), o >= 0 && (h === e.charCodeAt(o) ? --o === -1 && (i = s) : (o = -1, i = a));
5639
+ a === -1 && (r = !1, a = s + 1), o >= 0 && (h === e.charCodeAt(o) ? --o === -1 && (n = s) : (o = -1, n = a));
5636
5640
  }
5637
- return A === i ? i = a : i === -1 && (i = t.length), t.slice(A, i);
5641
+ return A === n ? n = a : n === -1 && (n = t.length), t.slice(A, n);
5638
5642
  } else {
5639
5643
  for (s = t.length - 1; s >= 0; --s)
5640
5644
  if (t.charCodeAt(s) === 47) {
@@ -5643,13 +5647,13 @@ var ht = {
5643
5647
  break;
5644
5648
  }
5645
5649
  } else
5646
- i === -1 && (r = !1, i = s + 1);
5647
- return i === -1 ? "" : t.slice(A, i);
5650
+ n === -1 && (r = !1, n = s + 1);
5651
+ return n === -1 ? "" : t.slice(A, n);
5648
5652
  }
5649
5653
  },
5650
5654
  extname: function(t) {
5651
- W(t);
5652
- for (var e = -1, A = 0, i = -1, r = !0, s = 0, o = t.length - 1; o >= 0; --o) {
5655
+ L(t);
5656
+ for (var e = -1, A = 0, n = -1, r = !0, s = 0, o = t.length - 1; o >= 0; --o) {
5653
5657
  var a = t.charCodeAt(o);
5654
5658
  if (a === 47) {
5655
5659
  if (!r) {
@@ -5658,24 +5662,24 @@ var ht = {
5658
5662
  }
5659
5663
  continue;
5660
5664
  }
5661
- i === -1 && (r = !1, i = o + 1), a === 46 ? e === -1 ? e = o : s !== 1 && (s = 1) : e !== -1 && (s = -1);
5665
+ n === -1 && (r = !1, n = o + 1), a === 46 ? e === -1 ? e = o : s !== 1 && (s = 1) : e !== -1 && (s = -1);
5662
5666
  }
5663
- return e === -1 || i === -1 || // We saw a non-dot character immediately before the dot
5667
+ return e === -1 || n === -1 || // We saw a non-dot character immediately before the dot
5664
5668
  s === 0 || // The (right-most) trimmed path component is exactly '..'
5665
- s === 1 && e === i - 1 && e === A + 1 ? "" : t.slice(e, i);
5669
+ s === 1 && e === n - 1 && e === A + 1 ? "" : t.slice(e, n);
5666
5670
  },
5667
5671
  format: function(t) {
5668
5672
  if (t === null || typeof t != "object")
5669
5673
  throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof t);
5670
- return An("/", t);
5674
+ return nn("/", t);
5671
5675
  },
5672
5676
  parse: function(t) {
5673
- W(t);
5677
+ L(t);
5674
5678
  var e = { root: "", dir: "", base: "", ext: "", name: "" };
5675
5679
  if (t.length === 0)
5676
5680
  return e;
5677
- var A = t.charCodeAt(0), i = A === 47, r;
5678
- i ? (e.root = "/", r = 1) : r = 0;
5681
+ var A = t.charCodeAt(0), n = A === 47, r;
5682
+ n ? (e.root = "/", r = 1) : r = 0;
5679
5683
  for (var s = -1, o = 0, a = -1, h = !0, l = t.length - 1, c = 0; l >= r; --l) {
5680
5684
  if (A = t.charCodeAt(l), A === 47) {
5681
5685
  if (!h) {
@@ -5688,7 +5692,7 @@ var ht = {
5688
5692
  }
5689
5693
  return s === -1 || a === -1 || // We saw a non-dot character immediately before the dot
5690
5694
  c === 0 || // The (right-most) trimmed path component is exactly '..'
5691
- c === 1 && s === a - 1 && s === o + 1 ? a !== -1 && (o === 0 && i ? e.base = e.name = t.slice(1, a) : e.base = e.name = t.slice(o, a)) : (o === 0 && i ? (e.name = t.slice(1, s), e.base = t.slice(1, a)) : (e.name = t.slice(o, s), e.base = t.slice(o, a)), e.ext = t.slice(s, a)), o > 0 ? e.dir = t.slice(0, o - 1) : i && (e.dir = "/"), e;
5695
+ c === 1 && s === a - 1 && s === o + 1 ? a !== -1 && (o === 0 && n ? e.base = e.name = t.slice(1, a) : e.base = e.name = t.slice(o, a)) : (o === 0 && n ? (e.name = t.slice(1, s), e.base = t.slice(1, a)) : (e.name = t.slice(o, s), e.base = t.slice(o, a)), e.ext = t.slice(s, a)), o > 0 ? e.dir = t.slice(0, o - 1) : n && (e.dir = "/"), e;
5692
5696
  },
5693
5697
  sep: "/",
5694
5698
  delimiter: ":",
@@ -5696,9 +5700,9 @@ var ht = {
5696
5700
  posix: null
5697
5701
  };
5698
5702
  ht.posix = ht;
5699
- var We = ht, pt = /* @__PURE__ */ ((n) => (n.start = "start", n.left = "left", n.right = "right", n.justify = "justify", n))(pt || {}), Bt = /* @__PURE__ */ ((n) => (n.day = "day", n.sepia = "sepia", n.night = "night", n.custom = "custom", n))(Bt || {}), y = /* @__PURE__ */ ((n) => (n.margin = "margin", n.lineLength = "lineLength", n.columns = "columns", n))(y || {});
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 || {});
5700
5704
  const Tt = {
5701
- range: [0.7, 2.5],
5705
+ range: [0.7, 4],
5702
5706
  step: 0.05
5703
5707
  }, jt = {
5704
5708
  range: [100, 1e3],
@@ -5707,43 +5711,43 @@ const Tt = {
5707
5711
  range: [50, 250],
5708
5712
  step: 10
5709
5713
  };
5710
- function nn(n, t) {
5711
- return n == null || t == null || n <= t ? n : void 0;
5714
+ function rn(i, t) {
5715
+ return i == null || t == null || i <= t ? i : void 0;
5712
5716
  }
5713
- function rn(n, t) {
5714
- return n == null || t == null || n >= t ? n : void 0;
5717
+ function sn(i, t) {
5718
+ return i == null || t == null || i >= t ? i : void 0;
5715
5719
  }
5716
- function T(n) {
5717
- return typeof n == "string" ? n : n === null ? null : void 0;
5720
+ function T(i) {
5721
+ return typeof i == "string" ? i : i === null ? null : void 0;
5718
5722
  }
5719
- function z(n) {
5720
- return typeof n == "boolean" || n == null ? n : void 0;
5723
+ function R(i) {
5724
+ return typeof i == "boolean" || i == null ? i : void 0;
5721
5725
  }
5722
- function lt(n, t) {
5723
- if (n !== void 0)
5724
- return n === null ? null : t[n] !== void 0 ? n : void 0;
5726
+ function lt(i, t) {
5727
+ if (i !== void 0)
5728
+ return i === null ? null : t[i] !== void 0 ? i : void 0;
5725
5729
  }
5726
- function ct(n) {
5727
- return typeof n == "boolean" || typeof n == "number" && n >= 0 ? n : n === null ? null : void 0;
5730
+ function ct(i) {
5731
+ return typeof i == "boolean" || typeof i == "number" && i >= 0 ? i : i === null ? null : void 0;
5728
5732
  }
5729
- function C(n) {
5730
- if (n !== void 0)
5731
- return n === null ? null : n < 0 ? void 0 : n;
5733
+ function y(i) {
5734
+ if (i !== void 0)
5735
+ return i === null ? null : i < 0 ? void 0 : i;
5732
5736
  }
5733
- function gt(n, t) {
5734
- if (n === void 0)
5737
+ function gt(i, t) {
5738
+ if (i === void 0)
5735
5739
  return;
5736
- if (n === null)
5740
+ if (i === null)
5737
5741
  return null;
5738
5742
  const e = Math.min(...t), A = Math.max(...t);
5739
- return n >= e && n <= A ? n : void 0;
5743
+ return i >= e && i <= A ? i : void 0;
5740
5744
  }
5741
- function Wt(n, t) {
5742
- return n === void 0 ? t : n;
5745
+ function Wt(i, t) {
5746
+ return i === void 0 ? t : i;
5743
5747
  }
5744
5748
  class Et {
5745
5749
  constructor(t = {}) {
5746
- this.backgroundColor = T(t.backgroundColor), this.blendFilter = z(t.blendFilter), this.constraint = C(t.constraint), this.columnCount = C(t.columnCount), this.darkenFilter = ct(t.darkenFilter), this.deprecatedFontSize = z(t.deprecatedFontSize), this.fontFamily = T(t.fontFamily), this.fontSize = gt(t.fontSize, Tt.range), this.fontSizeNormalize = z(t.fontSizeNormalize), this.fontOpticalSizing = z(t.fontOpticalSizing), this.fontWeight = gt(t.fontWeight, jt.range), this.fontWidth = gt(t.fontWidth, Vt.range), this.hyphens = z(t.hyphens), this.invertFilter = ct(t.invertFilter), this.invertGaijiFilter = ct(t.invertGaijiFilter), this.iPadOSPatch = z(t.iPadOSPatch), this.layoutStrategy = lt(t.layoutStrategy, y), this.letterSpacing = C(t.letterSpacing), this.ligatures = z(t.ligatures), this.lineHeight = C(t.lineHeight), this.linkColor = T(t.linkColor), this.noRuby = z(t.noRuby), this.pageGutter = C(t.pageGutter), this.paragraphIndent = C(t.paragraphIndent), this.paragraphSpacing = C(t.paragraphSpacing), this.scroll = z(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 = z(t.textNormalization), this.theme = lt(t.theme, Bt), this.visitedColor = T(t.visitedColor), this.wordSpacing = C(t.wordSpacing), this.lineLength = C(t.lineLength), this.optimalLineLength = C(t.optimalLineLength), this.maximalLineLength = C(t.maximalLineLength), this.minimalLineLength = C(t.minimalLineLength);
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);
5747
5751
  }
5748
5752
  static serialize(t) {
5749
5753
  const { ...e } = t;
@@ -5764,16 +5768,16 @@ class Et {
5764
5768
  return new Et(e);
5765
5769
  }
5766
5770
  }
5767
- const sn = "'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'URW Palladio L', P052, serif", on = "Athelas, Constantia, Charter, 'Bitstream Charter', Cambria, 'Georgia Pro', Georgia, serif", an = "-ui-sans-serif, -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI', Inter, Roboto, 'Helvetica Neue', 'Arial Nova', 'Liberation Sans', Arial, sans-serif", hn = "Seravek, Calibri, 'Gill Sans Nova', Roboto, Ubuntu, 'DejaVu Sans', source-sans-pro, sans-serif", ln = "ui-monospace, 'Andale Mono', 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace", cn = {
5768
- RS__oldStyleTf: sn,
5769
- RS__modernTf: on,
5770
- RS__sansTf: an,
5771
- RS__humanistTf: hn,
5772
- RS__monospaceTf: ln
5773
- }, gn = 16, Le = cn.RS__oldStyleTf;
5771
+ const on = "'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'URW Palladio L', P052, serif", an = "Athelas, Constantia, Charter, 'Bitstream Charter', Cambria, 'Georgia Pro', Georgia, serif", hn = "-ui-sans-serif, -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI', Inter, Roboto, 'Helvetica Neue', 'Arial Nova', 'Liberation Sans', Arial, sans-serif", ln = "Seravek, Calibri, 'Gill Sans Nova', Roboto, Ubuntu, 'DejaVu Sans', source-sans-pro, sans-serif", cn = "ui-monospace, 'Andale Mono', 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace", gn = {
5772
+ RS__oldStyleTf: on,
5773
+ RS__modernTf: an,
5774
+ RS__sansTf: hn,
5775
+ RS__humanistTf: ln,
5776
+ RS__monospaceTf: cn
5777
+ }, dn = 16, Le = gn.RS__oldStyleTf;
5774
5778
  class ft {
5775
5779
  constructor(t) {
5776
- 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 || gn, 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);
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);
5777
5781
  }
5778
5782
  set minChars(t) {
5779
5783
  t !== this._minChars && (this._minChars = t, this._minDivider = this._minChars && this._minChars < this._optimalChars ? this._optimalChars / this._minChars : this._minChars === null ? null : 1);
@@ -5835,8 +5839,8 @@ class ft {
5835
5839
  static approximateWordSpaces(t, e) {
5836
5840
  let A = 0;
5837
5841
  if (e && e.length >= t) {
5838
- const i = e.match(/([\s]+)/gi);
5839
- A = (i ? i.length : 0) * (t / e.length);
5842
+ const n = e.match(/([\s]+)/gi);
5843
+ A = (n ? n.length : 0) * (t / e.length);
5840
5844
  }
5841
5845
  return A;
5842
5846
  }
@@ -5866,16 +5870,16 @@ class ft {
5866
5870
  if (e.font = `${this._baseFontSize}px ${t}`, this._sample && this._sample.length >= this._optimalChars && (A = this._sample.slice(0, this._optimalChars)), Object.hasOwn(e, "letterSpacing") && Object.hasOwn(e, "wordSpacing"))
5867
5871
  return e.letterSpacing = this._letterSpacing.toString() + "px", e.wordSpacing = this._wordSpacing.toString() + "px", e.measureText(A).width;
5868
5872
  {
5869
- const i = this._letterSpacing * (this._optimalChars - 1), r = this._wordSpacing * ft.approximateWordSpaces(this._optimalChars, this._sample);
5870
- return e.measureText(A).width + i + r;
5873
+ const n = this._letterSpacing * (this._optimalChars - 1), r = this._wordSpacing * ft.approximateWordSpaces(this._optimalChars, this._sample);
5874
+ return e.measureText(A).width + n + r;
5871
5875
  }
5872
5876
  } else
5873
5877
  return this.getLineLengthFallback();
5874
5878
  }
5875
5879
  }
5876
- class dn {
5880
+ class un {
5877
5881
  constructor(t) {
5878
- this.backgroundColor = T(t.backgroundColor) || null, this.blendFilter = z(t.blendFilter) ?? !1, this.constraint = C(t.constraint) || 0, this.columnCount = C(t.columnCount) || null, this.darkenFilter = ct(t.darkenFilter) ?? !1, this.deprecatedFontSize = z(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 = z(t.fontSizeNormalize) ?? !1, this.fontOpticalSizing = z(t.fontOpticalSizing) ?? null, this.fontWeight = gt(t.fontWeight, jt.range) || null, this.fontWidth = gt(t.fontWidth, Vt.range) || null, this.hyphens = z(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 = C(t.letterSpacing) || null, this.ligatures = z(t.ligatures) ?? null, this.lineHeight = C(t.lineHeight) || null, this.linkColor = T(t.linkColor) || null, this.noRuby = z(t.noRuby) ?? !1, this.pageGutter = Wt(C(t.pageGutter), 20), this.paragraphIndent = C(t.paragraphIndent) ?? null, this.paragraphSpacing = C(t.paragraphSpacing) ?? null, this.scroll = z(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 = z(t.textNormalization) ?? !1, this.theme = lt(t.theme, Bt) || null, this.visitedColor = T(t.visitedColor) || null, this.wordSpacing = C(t.wordSpacing) || null, this.lineLength = C(t.lineLength) || null, this.optimalLineLength = C(t.optimalLineLength) || 65, this.maximalLineLength = Wt(rn(t.maximalLineLength, this.lineLength || this.optimalLineLength), 80), this.minimalLineLength = Wt(nn(t.minimalLineLength, this.lineLength || this.optimalLineLength), 40);
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);
5879
5883
  }
5880
5884
  }
5881
5885
  class V {
@@ -5883,9 +5887,9 @@ class V {
5883
5887
  initialValue: t = null,
5884
5888
  effectiveValue: e,
5885
5889
  isEffective: A,
5886
- onChange: i
5890
+ onChange: n
5887
5891
  }) {
5888
- this._value = t, this._effectiveValue = e, this._isEffective = A, this._onChange = i;
5892
+ this._value = t, this._effectiveValue = e, this._isEffective = A, this._onChange = n;
5889
5893
  }
5890
5894
  set value(t) {
5891
5895
  this._value = t, this._onChange(this._value);
@@ -5903,7 +5907,7 @@ class V {
5903
5907
  this._value = null;
5904
5908
  }
5905
5909
  }
5906
- class L extends V {
5910
+ class k extends V {
5907
5911
  set value(t) {
5908
5912
  this._value = t, this._onChange(this._value);
5909
5913
  }
@@ -5928,10 +5932,10 @@ class Lt extends V {
5928
5932
  initialValue: t = null,
5929
5933
  effectiveValue: e,
5930
5934
  isEffective: A,
5931
- onChange: i,
5935
+ onChange: n,
5932
5936
  supportedValues: r
5933
5937
  }) {
5934
- super({ initialValue: t, effectiveValue: e, isEffective: A, onChange: i }), this._supportedValues = r;
5938
+ super({ initialValue: t, effectiveValue: e, isEffective: A, onChange: n }), this._supportedValues = r;
5935
5939
  }
5936
5940
  set value(t) {
5937
5941
  if (t && !this._supportedValues.includes(t))
@@ -5959,11 +5963,11 @@ class S extends V {
5959
5963
  initialValue: t = null,
5960
5964
  effectiveValue: e,
5961
5965
  isEffective: A,
5962
- onChange: i,
5966
+ onChange: n,
5963
5967
  supportedRange: r,
5964
5968
  step: s
5965
5969
  }) {
5966
- super({ initialValue: t, effectiveValue: e, isEffective: A, onChange: i }), this._supportedRange = r, this._step = s, this._decimals = this._step.toString().includes(".") ? this._step.toString().split(".")[1].length : 0;
5970
+ super({ initialValue: t, effectiveValue: e, isEffective: A, onChange: n }), this._supportedRange = r, this._step = s, this._decimals = this._step.toString().includes(".") ? this._step.toString().split(".")[1].length : 0;
5967
5971
  }
5968
5972
  set value(t) {
5969
5973
  if (t && (t < this._supportedRange[0] || t > this._supportedRange[1]))
@@ -6004,18 +6008,18 @@ class S extends V {
6004
6008
  this._value = null;
6005
6009
  }
6006
6010
  }
6007
- const un = "#FFFFFF", mn = "#121212", Mn = "#0000EE", fn = "#551A8B", pn = "#b4d8fe", Bn = "inherit", rt = {
6008
- RS__backgroundColor: un,
6009
- RS__textColor: mn,
6010
- RS__linkColor: Mn,
6011
- RS__visitedColor: fn,
6012
- RS__selectionBackgroundColor: pn,
6013
- RS__selectionTextColor: Bn
6011
+ const mn = "#FFFFFF", Mn = "#121212", fn = "#0000EE", pn = "#551A8B", Bn = "#b4d8fe", En = "inherit", rt = {
6012
+ RS__backgroundColor: mn,
6013
+ RS__textColor: Mn,
6014
+ RS__linkColor: fn,
6015
+ RS__visitedColor: pn,
6016
+ RS__selectionBackgroundColor: Bn,
6017
+ RS__selectionTextColor: En
6014
6018
  };
6015
6019
  class Oe {
6016
6020
  constructor(t, e, A) {
6017
- var i, r;
6018
- this.preferences = t, this.settings = e, this.metadata = A, this.layout = ((r = (i = this.metadata) == null ? void 0 : i.getPresentation()) == null ? void 0 : r.layout) || p.reflowable;
6021
+ var n, r;
6022
+ this.preferences = t, this.settings = e, this.metadata = A, this.layout = ((r = (n = this.metadata) == null ? void 0 : n.getPresentation()) == null ? void 0 : r.layout) || p.reflowable;
6019
6023
  }
6020
6024
  clear() {
6021
6025
  this.preferences = new Et({ optimalLineLength: 65 });
@@ -6034,7 +6038,7 @@ class Oe {
6034
6038
  });
6035
6039
  }
6036
6040
  get blendFilter() {
6037
- return new L({
6041
+ return new k({
6038
6042
  initialValue: this.preferences.blendFilter,
6039
6043
  effectiveValue: this.settings.blendFilter || !1,
6040
6044
  isEffective: this.preferences.blendFilter !== null,
@@ -6076,7 +6080,7 @@ class Oe {
6076
6080
  });
6077
6081
  }
6078
6082
  get deprecatedFontSize() {
6079
- return new L({
6083
+ return new k({
6080
6084
  initialValue: this.preferences.deprecatedFontSize,
6081
6085
  effectiveValue: CSS.supports("zoom", "1") ? this.settings.deprecatedFontSize || !1 : !0,
6082
6086
  isEffective: this.layout === p.reflowable,
@@ -6108,7 +6112,7 @@ class Oe {
6108
6112
  });
6109
6113
  }
6110
6114
  get fontSizeNormalize() {
6111
- return new L({
6115
+ return new k({
6112
6116
  initialValue: this.preferences.fontSizeNormalize,
6113
6117
  effectiveValue: this.settings.fontSizeNormalize || !1,
6114
6118
  isEffective: this.layout === p.reflowable && this.preferences.fontSizeNormalize !== null,
@@ -6118,7 +6122,7 @@ class Oe {
6118
6122
  });
6119
6123
  }
6120
6124
  get fontOpticalSizing() {
6121
- return new L({
6125
+ return new k({
6122
6126
  initialValue: this.preferences.fontOpticalSizing,
6123
6127
  effectiveValue: this.settings.fontOpticalSizing || !0,
6124
6128
  isEffective: this.layout === p.reflowable && this.preferences.fontOpticalSizing !== null,
@@ -6127,6 +6131,16 @@ class Oe {
6127
6131
  }
6128
6132
  });
6129
6133
  }
6134
+ get fontOverride() {
6135
+ return new k({
6136
+ initialValue: this.preferences.fontOverride,
6137
+ effectiveValue: this.settings.fontOverride || !1,
6138
+ isEffective: this.layout === p.reflowable && this.preferences.fontOverride !== null,
6139
+ onChange: (t) => {
6140
+ this.updatePreference("fontOverride", t || null);
6141
+ }
6142
+ });
6143
+ }
6130
6144
  get fontWeight() {
6131
6145
  return new S({
6132
6146
  initialValue: this.preferences.fontWeight,
@@ -6153,7 +6167,7 @@ class Oe {
6153
6167
  }
6154
6168
  get hyphens() {
6155
6169
  var t;
6156
- return new L({
6170
+ return new k({
6157
6171
  initialValue: this.preferences.hyphens,
6158
6172
  effectiveValue: this.settings.hyphens || !1,
6159
6173
  isEffective: this.layout === p.reflowable && ((t = this.metadata) == null ? void 0 : t.effectiveReadingProgression) === I.ltr && this.preferences.hyphens !== null,
@@ -6187,7 +6201,7 @@ class Oe {
6187
6201
  });
6188
6202
  }
6189
6203
  get iPadOSPatch() {
6190
- return new L({
6204
+ return new k({
6191
6205
  initialValue: this.preferences.iPadOSPatch,
6192
6206
  effectiveValue: this.settings.iPadOSPatch || !1,
6193
6207
  isEffective: this.layout === p.reflowable,
@@ -6204,7 +6218,7 @@ class Oe {
6204
6218
  onChange: (t) => {
6205
6219
  this.updatePreference("layoutStrategy", t || null);
6206
6220
  },
6207
- supportedValues: Object.values(y)
6221
+ supportedValues: Object.values(C)
6208
6222
  });
6209
6223
  }
6210
6224
  get letterSpacing() {
@@ -6221,7 +6235,7 @@ class Oe {
6221
6235
  }
6222
6236
  get ligatures() {
6223
6237
  var t, e;
6224
- return new L({
6238
+ return new k({
6225
6239
  initialValue: this.preferences.ligatures,
6226
6240
  effectiveValue: this.settings.ligatures || !0,
6227
6241
  isEffective: this.layout === p.reflowable && ((e = (t = this.metadata) == null ? void 0 : t.languages) == null ? void 0 : e.some((A) => A === "ar" || A === "fa")) && this.preferences.ligatures !== null || !1,
@@ -6290,7 +6304,7 @@ class Oe {
6290
6304
  }
6291
6305
  get noRuby() {
6292
6306
  var t, e;
6293
- return new L({
6307
+ return new k({
6294
6308
  initialValue: this.preferences.noRuby,
6295
6309
  effectiveValue: this.settings.noRuby || !1,
6296
6310
  isEffective: this.layout === p.reflowable && ((e = (t = this.metadata) == null ? void 0 : t.languages) == null ? void 0 : e.includes("ja")) || !1,
@@ -6346,7 +6360,7 @@ class Oe {
6346
6360
  });
6347
6361
  }
6348
6362
  get scroll() {
6349
- return new L({
6363
+ return new k({
6350
6364
  initialValue: this.preferences.scroll,
6351
6365
  effectiveValue: this.settings.scroll || !1,
6352
6366
  isEffective: this.layout === p.reflowable,
@@ -6397,7 +6411,7 @@ class Oe {
6397
6411
  });
6398
6412
  }
6399
6413
  get textNormalization() {
6400
- return new L({
6414
+ return new k({
6401
6415
  initialValue: this.preferences.textNormalization,
6402
6416
  effectiveValue: this.settings.textNormalization || !1,
6403
6417
  isEffective: this.layout === p.reflowable,
@@ -6442,12 +6456,12 @@ class Oe {
6442
6456
  }
6443
6457
  class Xe {
6444
6458
  constructor(t, e) {
6445
- 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.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;
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;
6446
6460
  }
6447
6461
  }
6448
- function yt(n) {
6449
- const t = getComputedStyle(n), e = parseFloat(t.paddingLeft || "0"), A = parseFloat(t.paddingRight || "0");
6450
- return n.clientWidth - e - A;
6462
+ function Ct(i) {
6463
+ const t = getComputedStyle(i), e = parseFloat(t.paddingLeft || "0"), A = parseFloat(t.paddingRight || "0");
6464
+ return i.clientWidth - e - A;
6451
6465
  }
6452
6466
  class zA {
6453
6467
  constructor() {
@@ -6485,7 +6499,7 @@ class NA extends zA {
6485
6499
  return this.a11yNormalize && (t["--USER__a11yNormalize"] = this.toFlag("a11y")), this.appearance && (t["--USER__appearance"] = this.toFlag(this.appearance)), this.backgroundColor && (t["--USER__backgroundColor"] = this.backgroundColor), this.blendFilter && (t["--USER__blendFilter"] = this.toFlag("blend")), this.bodyHyphens && (t["--USER__bodyHyphens"] = this.bodyHyphens), this.colCount && (t["--USER__colCount"] = this.toUnitless(this.colCount)), this.darkenFilter === !0 ? t["--USER__darkenFilter"] = this.toFlag("darken") : typeof this.darkenFilter == "number" && (t["--USER__darkenFilter"] = this.toPercentage(this.darkenFilter)), this.deprecatedFontSize && (t["--USER__fontSizeImplementation"] = this.toFlag("deprecatedFontSize")), this.fontFamily && (t["--USER__fontFamily"] = this.fontFamily), this.fontOpticalSizing != null && (t["--USER__fontOpticalSizing"] = this.fontOpticalSizing), this.fontOverride && (t["--USER__fontOverride"] = this.toFlag("font")), this.fontSize != null && (t["--USER__fontSize"] = this.toPercentage(this.fontSize, !0)), this.fontSizeNormalize && (t["--USER__fontSizeNormalize"] = this.toFlag("normalize")), this.fontWeight != null && (t["--USER__fontWeight"] = this.toUnitless(this.fontWeight)), this.fontWidth != null && (t["--USER__fontWidth"] = typeof this.fontWidth == "string" ? this.fontWidth : this.toUnitless(this.fontWidth)), this.invertFilter === !0 ? t["--USER__invertFilter"] = this.toFlag("invert") : typeof this.invertFilter == "number" && (t["--USER__invertFilter"] = this.toPercentage(this.invertFilter)), this.invertGaijiFilter === !0 ? t["--USER__invertGaiji"] = this.toFlag("invertGaiji") : typeof this.invertGaijiFilter == "number" && (t["--USER__invertGaiji"] = this.toPercentage(this.invertGaijiFilter)), this.iPadOSPatch && (t["--USER__iPadOSPatch"] = this.toFlag("iPadOSPatch")), this.letterSpacing != null && (t["--USER__letterSpacing"] = this.toRem(this.letterSpacing)), this.ligatures && (t["--USER__ligatures"] = this.ligatures), this.lineHeight != null && (t["--USER__lineHeight"] = this.toUnitless(this.lineHeight)), this.lineLength != null && (t["--USER__lineLength"] = this.toPx(this.lineLength)), this.linkColor && (t["--USER__linkColor"] = this.linkColor), this.noRuby && (t["--USER__noRuby"] = this.toFlag("noRuby")), this.paraIndent != null && (t["--USER__paraIndent"] = this.toRem(this.paraIndent)), this.paraSpacing != null && (t["--USER__paraSpacing"] = this.toRem(this.paraSpacing)), this.selectionBackgroundColor && (t["--USER__selectionBackgroundColor"] = this.selectionBackgroundColor), this.selectionTextColor && (t["--USER__selectionTextColor"] = this.selectionTextColor), this.textAlign && (t["--USER__textAlign"] = this.textAlign), this.textColor && (t["--USER__textColor"] = this.textColor), this.view && (t["--USER__view"] = this.toFlag(this.view)), this.visitedColor && (t["--USER__visitedColor"] = this.visitedColor), this.wordSpacing != null && (t["--USER__wordSpacing"] = this.toRem(this.wordSpacing)), t;
6486
6500
  }
6487
6501
  }
6488
- class En extends zA {
6502
+ class wn extends zA {
6489
6503
  constructor(t) {
6490
6504
  super(), this.backgroundColor = t.backgroundColor ?? null, this.baseFontFamily = t.baseFontFamily ?? null, this.baseFontSize = t.baseFontSize ?? null, this.baseLineHeight = t.baseLineHeight ?? null, this.boxSizingMedia = t.boxSizingMedia ?? null, this.boxSizingTable = t.boxSizingTable ?? null, this.colWidth = t.colWidth ?? null, this.colCount = t.colCount ?? null, this.colGap = t.colGap ?? null, this.codeFontFamily = t.codeFontFamily ?? null, this.compFontFamily = t.compFontFamily ?? null, this.defaultLineLength = t.defaultLineLength ?? null, this.flowSpacing = t.flowSpacing ?? null, this.humanistTf = t.humanistTf ?? null, this.linkColor = t.linkColor ?? null, this.maxMediaWidth = t.maxMediaWidth ?? null, this.maxMediaHeight = t.maxMediaHeight ?? null, this.modernTf = t.modernTf ?? null, this.monospaceTf = t.monospaceTf ?? null, this.noVerticalPagination = t.noVerticalPagination ?? null, this.oldStyleTf = t.oldStyleTf ?? null, this.pageGutter = t.pageGutter ?? null, this.paraIndent = t.paraIndent ?? null, this.paraSpacing = t.paraSpacing ?? null, this.primaryColor = t.primaryColor ?? null, this.sansSerifJa = t.sansSerifJa ?? null, this.sansSerifJaV = t.sansSerifJaV ?? null, this.sansTf = t.sansTf ?? null, this.secondaryColor = t.secondaryColor ?? null, this.selectionBackgroundColor = t.selectionBackgroundColor ?? null, this.selectionTextColor = t.selectionTextColor ?? null, this.serifJa = t.serifJa ?? null, this.serifJaV = t.serifJaV ?? null, this.textColor = t.textColor ?? null, this.typeScale = t.typeScale ?? null, this.visitedColor = t.visitedColor ?? null;
6491
6505
  }
@@ -6494,9 +6508,9 @@ class En extends zA {
6494
6508
  return this.backgroundColor && (t["--RS__backgroundColor"] = this.backgroundColor), this.baseFontFamily && (t["--RS__baseFontFamily"] = this.baseFontFamily), this.baseFontSize != null && (t["--RS__baseFontSize"] = this.toRem(this.baseFontSize)), this.baseLineHeight != null && (t["--RS__baseLineHeight"] = this.toUnitless(this.baseLineHeight)), this.boxSizingMedia && (t["--RS__boxSizingMedia"] = this.boxSizingMedia), this.boxSizingTable && (t["--RS__boxSizingTable"] = this.boxSizingTable), this.colWidth != null && (t["--RS__colWidth"] = this.colWidth), this.colCount != null && (t["--RS__colCount"] = this.toUnitless(this.colCount)), this.colGap != null && (t["--RS__colGap"] = this.toPx(this.colGap)), this.codeFontFamily && (t["--RS__codeFontFamily"] = this.codeFontFamily), this.compFontFamily && (t["--RS__compFontFamily"] = this.compFontFamily), this.defaultLineLength != null && (t["--RS__defaultLineLength"] = this.toPx(this.defaultLineLength)), this.flowSpacing != null && (t["--RS__flowSpacing"] = this.toRem(this.flowSpacing)), this.humanistTf && (t["--RS__humanistTf"] = this.humanistTf), this.linkColor && (t["--RS__linkColor"] = this.linkColor), this.maxMediaWidth && (t["--RS__maxMediaWidth"] = this.toVw(this.maxMediaWidth)), this.maxMediaHeight && (t["--RS__maxMediaHeight"] = this.toVh(this.maxMediaHeight)), this.modernTf && (t["--RS__modernTf"] = this.modernTf), this.monospaceTf && (t["--RS__monospaceTf"] = this.monospaceTf), this.noVerticalPagination && (t["--RS__disablePagination"] = this.toFlag("noVerticalPagination")), this.oldStyleTf && (t["--RS__oldStyleTf"] = this.oldStyleTf), this.pageGutter != null && (t["--RS__pageGutter"] = this.toPx(this.pageGutter)), this.paraIndent != null && (t["--RS__paraIndent"] = this.toRem(this.paraIndent)), this.paraSpacing != null && (t["--RS__paraSpacing"] = this.toRem(this.paraSpacing)), this.primaryColor && (t["--RS__primaryColor"] = this.primaryColor), this.sansSerifJa && (t["--RS__sans-serif-ja"] = this.sansSerifJa), this.sansSerifJaV && (t["--RS__sans-serif-ja-v"] = this.sansSerifJaV), this.sansTf && (t["--RS__sansTf"] = this.sansTf), this.secondaryColor && (t["--RS__secondaryColor"] = this.secondaryColor), this.selectionBackgroundColor && (t["--RS__selectionBackgroundColor"] = this.selectionBackgroundColor), this.selectionTextColor && (t["--RS__selectionTextColor"] = this.selectionTextColor), this.serifJa && (t["--RS__serif-ja"] = this.serifJa), this.serifJaV && (t["--RS__serif-ja-v"] = this.serifJaV), this.textColor && (t["--RS__textColor"] = this.textColor), this.typeScale && (t["--RS__typeScale"] = this.toUnitless(this.typeScale)), this.visitedColor && (t["--RS__visitedColor"] = this.visitedColor), t;
6495
6509
  }
6496
6510
  }
6497
- class wn {
6511
+ class In {
6498
6512
  constructor(t) {
6499
- 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);
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);
6500
6514
  }
6501
6515
  update(t) {
6502
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({
@@ -6522,23 +6536,28 @@ class wn {
6522
6536
  deprecatedFontSize: t.deprecatedFontSize,
6523
6537
  fontFamily: t.fontFamily,
6524
6538
  fontOpticalSizing: typeof t.fontOpticalSizing != "boolean" ? null : t.fontOpticalSizing ? "auto" : "none",
6525
- fontOverride: !!(t.textNormalization || t.fontFamily),
6539
+ fontOverride: t.fontOverride !== null ? t.fontOverride : !!(t.textNormalization || t.fontFamily),
6526
6540
  fontSize: t.fontSize,
6527
6541
  fontSizeNormalize: t.fontSizeNormalize,
6528
6542
  fontWeight: t.fontWeight,
6529
6543
  fontWidth: t.fontWidth,
6530
6544
  invertFilter: t.invertFilter,
6545
+ invertGaijiFilter: t.invertGaijiFilter,
6531
6546
  iPadOSPatch: t.iPadOSPatch,
6532
6547
  letterSpacing: t.letterSpacing,
6533
6548
  ligatures: typeof t.ligatures != "boolean" ? null : t.ligatures ? "common-ligatures" : "none",
6534
6549
  lineHeight: t.lineHeight,
6535
6550
  lineLength: e == null ? void 0 : e.effectiveLineLength,
6551
+ linkColor: t.linkColor,
6536
6552
  noRuby: t.noRuby,
6537
6553
  paraIndent: t.paragraphIndent,
6538
6554
  paraSpacing: t.paragraphSpacing,
6555
+ selectionBackgroundColor: t.selectionBackgroundColor,
6556
+ selectionTextColor: t.selectionTextColor,
6539
6557
  textAlign: t.textAlign,
6540
6558
  textColor: t.textColor,
6541
6559
  view: typeof t.scroll != "boolean" ? null : t.scroll ? "scroll" : "paged",
6560
+ visitedColor: t.visitedColor,
6542
6561
  wordSpacing: t.wordSpacing
6543
6562
  };
6544
6563
  this.userProperties = new NA(A);
@@ -6546,14 +6565,14 @@ class wn {
6546
6565
  updateLineLengths(t) {
6547
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);
6548
6567
  }
6549
- updateLayout(t, e, A, i) {
6550
- return A ?? this.userProperties.view === "scroll" ? this.computeScrollLength(t, e) : this.paginate(t, e, i);
6568
+ updateLayout(t, e, A, n) {
6569
+ return A ?? this.userProperties.view === "scroll" ? this.computeScrollLength(t, e) : this.paginate(t, e, n);
6551
6570
  }
6552
6571
  getCompensatedMetrics(t, e) {
6553
- const A = t || this.userProperties.fontSize || 1, i = A < 1 ? this.layoutStrategy === y.margin ? 1 / (A + 3e-3) : 1 / A : e ? A : 1;
6572
+ const A = t || this.userProperties.fontSize || 1, n = A < 1 ? this.layoutStrategy === C.margin ? 1 / (A + 3e-3) : 1 / A : e ? A : 1;
6554
6573
  return {
6555
6574
  zoomFactor: A,
6556
- zoomCompensation: i,
6575
+ zoomCompensation: n,
6557
6576
  optimal: Math.round(this.lineLengths.userLineLength || this.lineLengths.optimalLineLength) * A,
6558
6577
  minimal: this.lineLengths.minimalLineLength !== null ? Math.round(this.lineLengths.minimalLineLength * A) : null,
6559
6578
  maximal: this.lineLengths.maximalLineLength !== null ? Math.round(this.lineLengths.maximalLineLength * A) : null
@@ -6563,8 +6582,8 @@ class wn {
6563
6582
  // TODO: As scroll shows, the effective line-length
6564
6583
  // should be the same as uncompensated when scale >= 1
6565
6584
  paginate(t, e, A) {
6566
- const i = Math.round(yt(this.containerParent) - this.constraint), r = this.getCompensatedMetrics(t, e), s = r.zoomCompensation, o = r.optimal, a = r.minimal, h = r.maximal;
6567
- let l = 1, c = i;
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;
6586
+ let l = 1, c = n;
6568
6587
  if (A === void 0)
6569
6588
  return {
6570
6589
  colCount: void 0,
@@ -6572,67 +6591,67 @@ class wn {
6572
6591
  effectiveLineLength: Math.round(c / l * s)
6573
6592
  };
6574
6593
  if (A === null) {
6575
- if (this.layoutStrategy === y.margin)
6576
- if (i >= o) {
6577
- l = Math.floor(i / o);
6594
+ if (this.layoutStrategy === C.margin)
6595
+ if (n >= o) {
6596
+ l = Math.floor(n / o);
6578
6597
  const g = Math.round(l * (o * s));
6579
- c = Math.min(g, i);
6598
+ c = Math.min(g, n);
6580
6599
  } else
6581
- l = 1, c = i;
6582
- else if (this.layoutStrategy === y.lineLength)
6583
- if (i < o || h === null)
6584
- l = 1, c = i;
6600
+ l = 1, c = n;
6601
+ else if (this.layoutStrategy === C.lineLength)
6602
+ if (n < o || h === null)
6603
+ l = 1, c = n;
6585
6604
  else {
6586
- l = Math.floor(i / o);
6605
+ l = Math.floor(n / o);
6587
6606
  const g = Math.round(l * (h * s));
6588
- c = Math.min(g, i);
6607
+ c = Math.min(g, n);
6589
6608
  }
6590
- else if (this.layoutStrategy === y.columns)
6591
- if (i >= o)
6609
+ else if (this.layoutStrategy === C.columns)
6610
+ if (n >= o)
6592
6611
  if (h === null)
6593
- l = Math.floor(i / o), c = i;
6612
+ l = Math.floor(n / o), c = n;
6594
6613
  else {
6595
- l = Math.floor(i / (a || o));
6614
+ l = Math.floor(n / (a || o));
6596
6615
  const g = Math.round(l * (o * s));
6597
- c = Math.min(g, i);
6616
+ c = Math.min(g, n);
6598
6617
  }
6599
6618
  else
6600
- l = 1, c = i;
6619
+ l = 1, c = n;
6601
6620
  } else if (A > 1) {
6602
6621
  const g = Math.round(A * (a !== null ? a : o));
6603
- if (i >= g) {
6604
- if (l = A, this.layoutStrategy === y.margin) {
6622
+ if (n >= g) {
6623
+ if (l = A, this.layoutStrategy === C.margin) {
6605
6624
  const m = Math.round(l * (o * s));
6606
- c = Math.min(m, i);
6607
- } else if (this.layoutStrategy === y.lineLength || this.layoutStrategy === y.columns) {
6625
+ c = Math.min(m, n);
6626
+ } else if (this.layoutStrategy === C.lineLength || this.layoutStrategy === C.columns) {
6608
6627
  if (h === null)
6609
- c = i;
6628
+ c = n;
6610
6629
  else {
6611
6630
  const m = Math.round(l * (h * s));
6612
- c = Math.min(m, i);
6631
+ c = Math.min(m, n);
6613
6632
  }
6614
- 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.");
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.");
6615
6634
  }
6616
6635
  } else {
6617
- a !== null && i < Math.round(A * a) ? l = Math.floor(i / a) : l = A;
6636
+ a !== null && n < Math.round(A * a) ? l = Math.floor(n / a) : l = A;
6618
6637
  const m = Math.round(l * (o * s));
6619
- c = Math.min(m, i);
6638
+ c = Math.min(m, n);
6620
6639
  }
6621
- } else if (l = 1, i >= o) {
6622
- if (this.layoutStrategy === y.margin) {
6640
+ } else if (l = 1, n >= o) {
6641
+ if (this.layoutStrategy === C.margin) {
6623
6642
  const g = Math.round(o * s);
6624
- c = Math.min(g, i);
6625
- } else if (this.layoutStrategy === y.lineLength || this.layoutStrategy === y.columns) {
6643
+ c = Math.min(g, n);
6644
+ } else if (this.layoutStrategy === C.lineLength || this.layoutStrategy === C.columns) {
6626
6645
  if (h === null)
6627
- c = i;
6646
+ c = n;
6628
6647
  else {
6629
6648
  const g = Math.round(h * s);
6630
- c = Math.min(g, i);
6649
+ c = Math.min(g, n);
6631
6650
  }
6632
- 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.");
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.");
6633
6652
  }
6634
6653
  } else
6635
- c = i;
6654
+ c = n;
6636
6655
  return {
6637
6656
  colCount: l,
6638
6657
  effectiveContainerWidth: c,
@@ -6641,13 +6660,13 @@ class wn {
6641
6660
  }
6642
6661
  // This behaves as paginate where colCount = 1
6643
6662
  computeScrollLength(t, e) {
6644
- const A = Math.round(yt(this.containerParent) - this.constraint), i = this.getCompensatedMetrics(t && (t < 1 || e) ? t : 1, e), r = i.zoomCompensation, s = i.optimal, o = i.maximal;
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;
6645
6664
  let a, h = A, l = Math.round(s * r);
6646
- if (this.layoutStrategy === y.margin) {
6665
+ if (this.layoutStrategy === C.margin) {
6647
6666
  const c = Math.min(Math.round(s * r), A);
6648
6667
  l = e ? c : Math.round(c * r);
6649
- } else if (this.layoutStrategy === y.lineLength || this.layoutStrategy === y.columns)
6650
- if (this.layoutStrategy === y.columns && console.error("Columns strategy is not compatible with scroll. Falling back to lineLength strategy."), o === null)
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)
6651
6670
  l = A;
6652
6671
  else {
6653
6672
  const c = Math.min(Math.round(o * r), A);
@@ -6667,27 +6686,27 @@ class wn {
6667
6686
  this.userProperties.colCount = t.colCount, this.userProperties.lineLength = t.effectiveLineLength, this.effectiveContainerWidth = t.effectiveContainerWidth, this.container.style.width = `${this.effectiveContainerWidth}px`;
6668
6687
  }
6669
6688
  }
6670
- const In = (n) => ({
6671
- frameLoaded: n.frameLoaded || (() => {
6689
+ const Fn = (i) => ({
6690
+ frameLoaded: i.frameLoaded || (() => {
6672
6691
  }),
6673
- positionChanged: n.positionChanged || (() => {
6692
+ positionChanged: i.positionChanged || (() => {
6674
6693
  }),
6675
- tap: n.tap || (() => !1),
6676
- click: n.click || (() => !1),
6677
- zoom: n.zoom || (() => {
6694
+ tap: i.tap || (() => !1),
6695
+ click: i.click || (() => !1),
6696
+ zoom: i.zoom || (() => {
6678
6697
  }),
6679
- miscPointer: n.miscPointer || (() => {
6698
+ miscPointer: i.miscPointer || (() => {
6680
6699
  }),
6681
- customEvent: n.customEvent || (() => {
6700
+ customEvent: i.customEvent || (() => {
6682
6701
  }),
6683
- handleLocator: n.handleLocator || (() => !1),
6684
- textSelected: n.textSelected || (() => {
6702
+ handleLocator: i.handleLocator || (() => !1),
6703
+ textSelected: i.textSelected || (() => {
6685
6704
  })
6686
6705
  });
6687
6706
  class SA extends ZA {
6688
- constructor(t, e, A, i = [], r = void 0, s = { preferences: {}, defaults: {} }) {
6689
- super(), this._preferencesEditor = null, this.pub = e, this.layout = SA.determineLayout(e), this.container = t, this.listeners = In(A), this.currentLocation = r, i.length && (this.positions = i), this._preferences = new Et(s.preferences), this._defaults = new dn(s.defaults), this._settings = new Xe(this._preferences, this._defaults), this._css = new wn({
6690
- rsProperties: new En({}),
6707
+ constructor(t, e, A, n = [], r = void 0, s = { preferences: {}, defaults: {} }) {
6708
+ super(), this._preferencesEditor = null, this.pub = e, this.layout = SA.determineLayout(e), this.container = t, this.listeners = Fn(A), this.currentLocation = r, n.length && (this.positions = n), this._preferences = new Et(s.preferences), this._defaults = new un(s.defaults), this._settings = new Xe(this._preferences, this._defaults), this._css = new In({
6709
+ rsProperties: new wn({}),
6691
6710
  userProperties: new NA({}),
6692
6711
  lineLengths: new ft({
6693
6712
  optimalChars: this._settings.optimalLineLength,
@@ -6711,13 +6730,13 @@ class SA extends ZA {
6711
6730
  async load() {
6712
6731
  var t;
6713
6732
  if ((t = this.positions) != null && t.length || (this.positions = await this.pub.positionsFromManifest()), this.layout === p.fixed)
6714
- this.framePool = new en(this.container, this.positions, this.pub), this.framePool.listener = (e, A) => {
6733
+ this.framePool = new An(this.container, this.positions, this.pub), this.framePool.listener = (e, A) => {
6715
6734
  this.eventListener(e, A);
6716
6735
  };
6717
6736
  else {
6718
6737
  await this.updateCSS(!1);
6719
6738
  const e = this.compileCSSProperties(this._css);
6720
- this.framePool = new Gi(this.container, this.positions, e);
6739
+ this.framePool = new Hi(this.container, this.positions, e);
6721
6740
  }
6722
6741
  this.currentLocation === void 0 && (this.currentLocation = this.positions[0]), await this.resizeHandler(), await this.apply();
6723
6742
  }
@@ -6748,10 +6767,10 @@ class SA extends ZA {
6748
6767
  }
6749
6768
  compileCSSProperties(t) {
6750
6769
  const e = {};
6751
- for (const [A, i] of Object.entries(t.rsProperties.toCSSProperties()))
6752
- e[A] = i;
6753
- for (const [A, i] of Object.entries(t.userProperties.toCSSProperties()))
6754
- e[A] = i;
6770
+ for (const [A, n] of Object.entries(t.rsProperties.toCSSProperties()))
6771
+ e[A] = n;
6772
+ for (const [A, n] of Object.entries(t.userProperties.toCSSProperties()))
6773
+ e[A] = n;
6755
6774
  return e;
6756
6775
  }
6757
6776
  async commitCSS(t) {
@@ -6761,7 +6780,7 @@ class SA extends ZA {
6761
6780
  async resizeHandler() {
6762
6781
  const t = this.container.parentElement || document.documentElement;
6763
6782
  if (this.layout === p.fixed)
6764
- this.container.style.width = `${yt(t) - this._settings.constraint}px`, this.framePool.resizeHandler();
6783
+ this.container.style.width = `${Ct(t) - this._settings.constraint}px`, this.framePool.resizeHandler();
6765
6784
  else {
6766
6785
  const e = this._css.userProperties.colCount, A = this._css.userProperties.lineLength;
6767
6786
  this._css.resizeHandler(), (this._css.userProperties.view !== "scroll" && e !== this._css.userProperties.colCount || A !== this._css.userProperties.lineLength) && await this.commitCSS(this._css);
@@ -6790,7 +6809,7 @@ class SA extends ZA {
6790
6809
  * outside the readium-controller navigator. Be careful!
6791
6810
  */
6792
6811
  eventListener(t, e) {
6793
- var A, i, r, s, o, a;
6812
+ var A, n, r, s, o, a;
6794
6813
  switch (t) {
6795
6814
  case "_pong":
6796
6815
  this.listeners.frameLoaded(this._cframes[0].iframe.contentWindow), this.listeners.positionChanged(this.currentLocation);
@@ -6845,7 +6864,7 @@ class SA extends ZA {
6845
6864
  } else {
6846
6865
  if (this.layout === p.fixed && this.framePool.doNotDisturb && (l.doNotDisturb = !0), this.layout === p.fixed && (this.currentProgression === I.rtl || this.currentProgression === I.ltr) && this.framePool.currentFrames.length > 1) {
6847
6866
  const m = this.framePool.currentFrames;
6848
- l.targetFrameSrc === ((i = m[this.currentProgression === I.rtl ? 0 : 1]) == null ? void 0 : i.source) && (l.x += (((s = (r = m[this.currentProgression === I.rtl ? 1 : 0]) == null ? void 0 : r.iframe.contentWindow) == null ? void 0 : s.innerWidth) ?? 0) * window.devicePixelRatio);
6867
+ l.targetFrameSrc === ((n = m[this.currentProgression === I.rtl ? 0 : 1]) == null ? void 0 : n.source) && (l.x += (((s = (r = m[this.currentProgression === I.rtl ? 1 : 0]) == null ? void 0 : r.iframe.contentWindow) == null ? void 0 : s.innerWidth) ?? 0) * window.devicePixelRatio);
6849
6868
  }
6850
6869
  if (t === "click" ? this.listeners.click(l) : this.listeners.tap(l))
6851
6870
  break;
@@ -6884,7 +6903,7 @@ class SA extends ZA {
6884
6903
  }
6885
6904
  determineModules() {
6886
6905
  let t = Array.from(_t.keys());
6887
- return this.layout === p.fixed ? t.filter((e) => Di.includes(e)) : (t = t.filter((e) => bi.includes(e)), this.readingProgression === I.ttb || this.readingProgression === I.btt ? t = t.filter((e) => e !== "column_snapper") : t = t.filter((e) => e !== "scroll_snapper"), t);
6906
+ return this.layout === p.fixed ? t.filter((e) => bi.includes(e)) : (t = t.filter((e) => vi.includes(e)), this.readingProgression === I.ttb || this.readingProgression === I.btt ? t = t.filter((e) => e !== "column_snapper") : t = t.filter((e) => e !== "scroll_snapper"), t);
6888
6907
  }
6889
6908
  // Start listening to messages from the current iframe
6890
6909
  attachListener() {
@@ -6892,8 +6911,8 @@ class SA extends ZA {
6892
6911
  if (t.length === 0)
6893
6912
  throw Error("no cframe to attach listener to");
6894
6913
  t.forEach((e) => {
6895
- e.msg && (e.msg.listener = (A, i) => {
6896
- this.eventListener(A, i);
6914
+ e.msg && (e.msg.listener = (A, n) => {
6915
+ this.eventListener(A, n);
6897
6916
  });
6898
6917
  });
6899
6918
  }
@@ -6906,7 +6925,7 @@ class SA extends ZA {
6906
6925
  await ((t = this.framePool) == null ? void 0 : t.destroy());
6907
6926
  }
6908
6927
  async changeResource(t) {
6909
- var i, r;
6928
+ var n, r;
6910
6929
  if (t === 0)
6911
6930
  return !1;
6912
6931
  if (this.layout === p.fixed) {
@@ -6942,7 +6961,7 @@ class SA extends ZA {
6942
6961
  Math.min(this.pub.readingOrder.items.length - 1, e + t)
6943
6962
  );
6944
6963
  if (A === e)
6945
- return (r = (i = this._cframes[0]) == null ? void 0 : i.msg) == null || r.send("shake", void 0, async (s) => {
6964
+ return (r = (n = this._cframes[0]) == null ? void 0 : n.msg) == null || r.send("shake", void 0, async (s) => {
6946
6965
  }), !1;
6947
6966
  if (e > A) {
6948
6967
  for (let s = this.positions.length - 1; s >= 0; s--)
@@ -6961,8 +6980,8 @@ class SA extends ZA {
6961
6980
  return await this.apply(), !0;
6962
6981
  }
6963
6982
  findLastPositionInProgressionRange(t, e) {
6964
- const A = t.findLastIndex((i) => {
6965
- const r = i.locations.progression;
6983
+ const A = t.findLastIndex((n) => {
6984
+ const r = n.locations.progression;
6966
6985
  return !!(r && r > Math.min(...e) && r <= Math.max(...e));
6967
6986
  });
6968
6987
  return A !== -1 ? t[A] : void 0;
@@ -6971,16 +6990,16 @@ class SA extends ZA {
6971
6990
  const e = this.positions.filter(
6972
6991
  (r) => r.href === this.currentLocation.href
6973
6992
  );
6974
- let A = this.currentLocation, i;
6993
+ let A = this.currentLocation, n;
6975
6994
  return e.some((r, s) => {
6976
6995
  const o = r.locations.progression ?? 0;
6977
6996
  if (t.progress <= o) {
6978
6997
  A = r;
6979
6998
  const a = e.splice(s + 1, e.length), h = [t.progress, t.progress + t.reference];
6980
- return i = this.findLastPositionInProgressionRange(a, h), !0;
6999
+ return n = this.findLastPositionInProgressionRange(a, h), !0;
6981
7000
  } else
6982
7001
  return !1;
6983
- }), { first: A, last: i };
7002
+ }), { first: A, last: n };
6984
7003
  }
6985
7004
  async syncLocation(t) {
6986
7005
  const e = this.findNearestPositions(t);
@@ -6990,14 +7009,14 @@ class SA extends ZA {
6990
7009
  }), this.lastLocationInView = e.last, this.listeners.positionChanged(this.currentLocation), await this.framePool.update(this.pub, this.currentLocation, this.determineModules());
6991
7010
  }
6992
7011
  goBackward(t, e) {
6993
- var A, i;
6994
- this.layout === p.fixed ? (this.changeResource(-1), e(!0)) : (i = (A = this._cframes[0]) == null ? void 0 : A.msg) == null || i.send("go_prev", void 0, async (r) => {
7012
+ var A, n;
7013
+ this.layout === p.fixed ? (this.changeResource(-1), e(!0)) : (n = (A = this._cframes[0]) == null ? void 0 : A.msg) == null || n.send("go_prev", void 0, async (r) => {
6995
7014
  e(r ? !0 : await this.changeResource(-1));
6996
7015
  });
6997
7016
  }
6998
7017
  goForward(t, e) {
6999
- var A, i;
7000
- this.layout === p.fixed ? (this.changeResource(1), e(!0)) : (i = (A = this._cframes[0]) == null ? void 0 : A.msg) == null || i.send("go_next", void 0, async (r) => {
7018
+ var A, n;
7019
+ this.layout === p.fixed ? (this.changeResource(1), e(!0)) : (n = (A = this._cframes[0]) == null ? void 0 : A.msg) == null || n.send("go_next", void 0, async (r) => {
7001
7020
  e(r ? !0 : await this.changeResource(1));
7002
7021
  });
7003
7022
  }
@@ -7022,25 +7041,25 @@ class SA extends ZA {
7022
7041
  }
7023
7042
  async loadLocator(t, e) {
7024
7043
  var a, h;
7025
- let A = !1, i = typeof t.locations.getCssSelector == "function" && t.locations.getCssSelector();
7044
+ let A = !1, n = typeof t.locations.getCssSelector == "function" && t.locations.getCssSelector();
7026
7045
  if ((a = t.text) != null && a.highlight ? A = await new Promise((l, c) => {
7027
7046
  var g, m;
7028
7047
  this._cframes[0].msg.send(
7029
7048
  "go_text",
7030
- i ? [
7049
+ n ? [
7031
7050
  (g = t.text) == null ? void 0 : g.serialize(),
7032
- i
7051
+ n
7033
7052
  // Include CSS selector if it exists
7034
7053
  ] : (m = t.text) == null ? void 0 : m.serialize(),
7035
7054
  (M) => l(M)
7036
7055
  );
7037
- }) : i && (A = await new Promise((l, c) => {
7056
+ }) : n && (A = await new Promise((l, c) => {
7038
7057
  this._cframes[0].msg.send(
7039
7058
  "go_text",
7040
7059
  [
7041
7060
  "",
7042
7061
  // No text!
7043
- i
7062
+ n
7044
7063
  // Just CSS selector
7045
7064
  ],
7046
7065
  (g) => l(g)
@@ -7062,8 +7081,8 @@ class SA extends ZA {
7062
7081
  }) : A = !0, e(A);
7063
7082
  }
7064
7083
  go(t, e, A) {
7065
- const i = t.href.split("#")[0];
7066
- let r = this.pub.readingOrder.findWithHref(i);
7084
+ const n = t.href.split("#")[0];
7085
+ let r = this.pub.readingOrder.findWithHref(n);
7067
7086
  if (!r)
7068
7087
  return A(this.listeners.handleLocator(t));
7069
7088
  this.currentLocation = this.positions.find((s) => s.href === r.href), this.apply().then(() => this.loadLocator(t, (s) => A(s))).then(() => {
@@ -7074,7 +7093,7 @@ class SA extends ZA {
7074
7093
  return this.go(t.locator, e, A);
7075
7094
  }
7076
7095
  }
7077
- class Un {
7096
+ class Cn {
7078
7097
  constructor(t) {
7079
7098
  var e;
7080
7099
  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(
@@ -7249,35 +7268,35 @@ class Un {
7249
7268
  }
7250
7269
  }
7251
7270
  export {
7252
- L as BooleanPreference,
7271
+ k as BooleanPreference,
7253
7272
  Lt as EnumPreference,
7254
- dn as EpubDefaults,
7273
+ un as EpubDefaults,
7255
7274
  SA as EpubNavigator,
7256
7275
  Et as EpubPreferences,
7257
7276
  Oe as EpubPreferencesEditor,
7258
7277
  Xe as EpubSettings,
7259
- Li as FXLCoordinator,
7260
- Hi as FXLFrameManager,
7261
- en as FXLFramePoolManager,
7262
- Xi as FXLPeripherals,
7263
- Zi as FXLSpreader,
7278
+ Oi as FXLCoordinator,
7279
+ ki as FXLFrameManager,
7280
+ An as FXLFramePoolManager,
7281
+ Zi as FXLPeripherals,
7282
+ Ki as FXLSpreader,
7264
7283
  $t as FrameComms,
7265
- vi as FrameManager,
7266
- Gi as FramePoolManager,
7267
- Ji as HorizontalThird,
7268
- y as LayoutStrategy,
7284
+ Gi as FrameManager,
7285
+ Hi as FramePoolManager,
7286
+ Wi as HorizontalThird,
7287
+ C as LayoutStrategy,
7269
7288
  ft as LineLengths,
7270
7289
  XA as Navigator,
7271
7290
  V as Preference,
7272
- En as RSProperties,
7291
+ wn as RSProperties,
7273
7292
  S as RangePreference,
7274
- wn as ReadiumCSS,
7293
+ In as ReadiumCSS,
7275
7294
  pt as TextAlignment,
7276
7295
  Bt as Theme,
7277
7296
  NA as UserProperties,
7278
- Wi as VerticalThird,
7297
+ Li as VerticalThird,
7279
7298
  ZA as VisualNavigator,
7280
- Un as WebAudioEngine,
7299
+ Cn as WebAudioEngine,
7281
7300
  Tt as fontSizeRangeConfig,
7282
7301
  jt as fontWeightRangeConfig,
7283
7302
  Vt as fontWidthRangeConfig,