@readium/speech 0.9.0 → 0.9.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/build/index.js CHANGED
@@ -14,7 +14,7 @@ const U = (t) => {
14
14
  n[1]?.toUpperCase()
15
15
  ];
16
16
  }
17
- }, ne = {
17
+ }, re = {
18
18
  ar: {
19
19
  defaultRegion: "SA",
20
20
  availableRegions: [
@@ -421,14 +421,14 @@ async function qa(t) {
421
421
  };
422
422
  }
423
423
  }
424
- function Er(t) {
424
+ function xr(t) {
425
425
  return sn.has(t) || sn.set(t, qa(t)), sn.get(t);
426
426
  }
427
427
  const za = ["veryLow", "low", "normal", "high", "veryHigh"], ja = ["android", "apple"], Va = (t) => ({
428
428
  ...t,
429
429
  quality: t.quality?.filter((e) => za.includes(e)),
430
430
  localizedName: t.localizedName && ja.includes(t.localizedName) ? t.localizedName : void 0
431
- }), et = {
431
+ }), tt = {
432
432
  cmn: "cmn",
433
433
  "cmn-CN": "cmn-CN",
434
434
  "cmn-TW": "cmn-TW",
@@ -447,13 +447,13 @@ const za = ["veryLow", "low", "normal", "high", "veryHigh"], ja = ["android", "a
447
447
  const [n, r] = e.split("-");
448
448
  e = `${n.toLowerCase()}-${r.toUpperCase()}`;
449
449
  }
450
- return et[e] || e;
450
+ return tt[e] || e;
451
451
  }, On = async (t) => {
452
452
  if (!t) return [];
453
453
  try {
454
454
  const e = J(t);
455
455
  try {
456
- const r = await Er(e);
456
+ const r = await xr(e);
457
457
  if (r?.voices?.length)
458
458
  return r.voices;
459
459
  } catch (r) {
@@ -462,7 +462,7 @@ const za = ["veryLow", "low", "normal", "high", "veryHigh"], ja = ["android", "a
462
462
  const [n] = U(e);
463
463
  if (n !== e)
464
464
  try {
465
- const r = await Er(n);
465
+ const r = await xr(n);
466
466
  if (r?.voices?.length)
467
467
  return r.voices;
468
468
  } catch (r) {
@@ -481,39 +481,39 @@ const za = ["veryLow", "low", "normal", "high", "veryHigh"], ja = ["android", "a
481
481
  } catch {
482
482
  return t.toUpperCase();
483
483
  }
484
- }, Cr = (t) => {
484
+ }, Er = (t) => {
485
485
  if (!t) return "";
486
486
  try {
487
- const e = J(t), n = ne[e];
487
+ const e = J(t), n = re[e];
488
488
  if (n?.testUtterance)
489
489
  return n.testUtterance;
490
- if (e in et) {
491
- const i = et[e];
492
- if (i && ne[i]?.testUtterance)
493
- return ne[i].testUtterance;
490
+ if (e in tt) {
491
+ const i = tt[e];
492
+ if (i && re[i]?.testUtterance)
493
+ return re[i].testUtterance;
494
494
  }
495
495
  const [r] = U(e);
496
- return r !== e && ne[r]?.testUtterance ? ne[r].testUtterance : "";
496
+ return r !== e && re[r]?.testUtterance ? re[r].testUtterance : "";
497
497
  } catch (e) {
498
498
  return console.error(`Error in getTestUtterance for ${t}:`, e), "";
499
499
  }
500
500
  }, Ht = (t) => {
501
501
  if (!t) return "";
502
502
  try {
503
- const e = J(t), n = ne[e];
503
+ const e = J(t), n = re[e];
504
504
  if (n?.defaultRegion)
505
505
  return `${e}-${n.defaultRegion}`;
506
- if (e in et) {
507
- const i = et[e];
506
+ if (e in tt) {
507
+ const i = tt[e];
508
508
  if (i) {
509
- const s = ne[i];
509
+ const s = re[i];
510
510
  if (s?.defaultRegion)
511
511
  return `${i}-${s.defaultRegion}`;
512
512
  }
513
513
  }
514
514
  const [r] = U(e);
515
515
  if (r !== e) {
516
- const i = ne[r];
516
+ const i = re[r];
517
517
  if (i?.defaultRegion)
518
518
  return `${r}-${i.defaultRegion}`;
519
519
  }
@@ -531,7 +531,7 @@ const za = ["veryLow", "low", "normal", "high", "veryHigh"], ja = ["android", "a
531
531
  }
532
532
  return Array.from(n.entries()).map(([i, s]) => {
533
533
  const o = new Set(
534
- ne[i]?.availableRegions || []
534
+ re[i]?.availableRegions || []
535
535
  ), a = Array.from(s), c = Array.from(e).filter(
536
536
  (u) => o.has(u) && !a.includes(u)
537
537
  ), l = Array.from(/* @__PURE__ */ new Set([...a, ...c])).sort((u, h) => {
@@ -651,7 +651,7 @@ const za = ["veryLow", "low", "normal", "high", "veryHigh"], ja = ["android", "a
651
651
  (n) => t.includes(n.name) || e && n.nativeID?.some((r) => e.includes(r)) || n.altNames?.some((r) => t.includes(r))
652
652
  ), Nn = (t, e) => Za.voices.some(
653
653
  (n) => t.includes(n.name)
654
- ) || e === "veryLow", kr = (t) => t?.length ? t.filter((e) => !(e.isNovelty || Rn(e.name, e.voiceURI))) : [], Or = (t) => t?.length ? t.filter((e) => !Nn(e.name, e.quality)) : [], eo = { ar: { normal: "محسن", high: "استثنائي" }, ca: { normal: "millorada", high: "prèmium" }, "cmn-CN": { normal: "优化音质", high: "高音质" }, "cmn-TW": { normal: "增強音質", high: "高音質" }, cs: { normal: "vylepšená verze", high: "prémiový" }, da: { normal: "forbedret", high: "høj kvalitet" }, de: { normal: "erweitert", high: "premium" }, el: { normal: "βελτιωμένη", high: "υψηλής ποιότητας" }, en: { normal: "Enhanced", high: "Premium" }, es: { normal: "mejorada", high: "premium" }, fi: { normal: "parannettu", high: "korkealaatuinen" }, fr: { normal: "premium", high: "de qualité" }, he: { normal: "משופר", high: "פרימיום" }, hi: { normal: "बेहतर", high: "प्रीमियम" }, hr: { normal: "poboljšani", high: "vrhunski" }, hu: { normal: "továbbfejlesztett", high: "prémium" }, id: { normal: "Ditingkatkan", high: "Premium" }, it: { normal: "ottimizzata", high: "premium" }, ja: { normal: "拡張", high: "プレミアム" }, ko: { normal: "고품질", high: "프리미엄" }, ms: { normal: "Dipertingkat", high: "Premium" }, nb: { normal: "forbedret", high: "premium" }, nl: { normal: "verbeterd", high: "premium" }, pl: { normal: "rozszerzony", high: "premium" }, pt: { normal: "melhorada", high: "premium" }, ro: { normal: "îmbunătățită", high: "premium" }, ru: { normal: "улучшенный", high: "высшее качество" }, sk: { normal: "vylepšený", high: "prémiový" }, sl: { normal: "izboljšano", high: "prvovrsten" }, sv: { normal: "förbättrad", high: "premium" }, th: { normal: "คุณภาพสูง", high: "คุณภาพสูง" }, tr: { normal: "Geliştirilmiş", high: "Yüksek Kaliteli" }, uk: { normal: "вдосконалений", high: "високої якості" }, vi: { normal: "Nâng cao", high: "Cao cấp" } }, to = {
654
+ ) || e === "veryLow", Cr = (t) => t?.length ? t.filter((e) => !(e.isNovelty || Rn(e.name, e.voiceURI))) : [], kr = (t) => t?.length ? t.filter((e) => !Nn(e.name, e.quality)) : [], eo = { ar: { normal: "محسن", high: "استثنائي" }, ca: { normal: "millorada", high: "prèmium" }, "cmn-CN": { normal: "优化音质", high: "高音质" }, "cmn-TW": { normal: "增強音質", high: "高音質" }, cs: { normal: "vylepšená verze", high: "prémiový" }, da: { normal: "forbedret", high: "høj kvalitet" }, de: { normal: "erweitert", high: "premium" }, el: { normal: "βελτιωμένη", high: "υψηλής ποιότητας" }, en: { normal: "Enhanced", high: "Premium" }, es: { normal: "mejorada", high: "premium" }, fi: { normal: "parannettu", high: "korkealaatuinen" }, fr: { normal: "premium", high: "de qualité" }, he: { normal: "משופר", high: "פרימיום" }, hi: { normal: "बेहतर", high: "प्रीमियम" }, hr: { normal: "poboljšani", high: "vrhunski" }, hu: { normal: "továbbfejlesztett", high: "prémium" }, id: { normal: "Ditingkatkan", high: "Premium" }, it: { normal: "ottimizzata", high: "premium" }, ja: { normal: "拡張", high: "プレミアム" }, ko: { normal: "고품질", high: "프리미엄" }, ms: { normal: "Dipertingkat", high: "Premium" }, nb: { normal: "forbedret", high: "premium" }, nl: { normal: "verbeterd", high: "premium" }, pl: { normal: "rozszerzony", high: "premium" }, pt: { normal: "melhorada", high: "premium" }, ro: { normal: "îmbunătățită", high: "premium" }, ru: { normal: "улучшенный", high: "высшее качество" }, sk: { normal: "vylepšený", high: "prémiový" }, sl: { normal: "izboljšano", high: "prvovrsten" }, sv: { normal: "förbättrad", high: "premium" }, th: { normal: "คุณภาพสูง", high: "คุณภาพสูง" }, tr: { normal: "Geliştirilmiş", high: "Yüksek Kaliteli" }, uk: { normal: "вдосконалений", high: "високої якості" }, vi: { normal: "Nâng cao", high: "Cao cấp" } }, to = {
655
655
  quality: eo
656
656
  }, Dn = {
657
657
  apple: to.quality
@@ -691,7 +691,7 @@ const za = ["veryLow", "low", "normal", "high", "veryHigh"], ja = ["android", "a
691
691
  values: ["premium"],
692
692
  quality: "high"
693
693
  }
694
- }, Ar = (t) => {
694
+ }, Or = (t) => {
695
695
  if (!t) return;
696
696
  const n = t.toLowerCase().split(/[._-]/);
697
697
  for (const r of Object.values(io))
@@ -852,11 +852,11 @@ class L {
852
852
  * @private
853
853
  */
854
854
  inferVoiceQuality(e, n, r) {
855
- const i = e.voiceURI ? Ar(e.voiceURI) : void 0;
855
+ const i = e.voiceURI ? Or(e.voiceURI) : void 0;
856
856
  if (i) return i;
857
857
  if (n?.nativeID && Array.isArray(n.nativeID))
858
858
  for (const s of n.nativeID) {
859
- const o = Ar(s);
859
+ const o = Or(s);
860
860
  if (o) return o;
861
861
  }
862
862
  if (n?.localizedName && e.voiceURI && e.lang) {
@@ -911,11 +911,11 @@ class L {
911
911
  */
912
912
  getTestUtterance(e) {
913
913
  if (!e) return "";
914
- const n = Cr(e);
914
+ const n = Er(e);
915
915
  if (n) return n;
916
916
  const [r] = L.extractLangRegionFromBCP47(e);
917
917
  if (r && r !== e) {
918
- const i = Cr(r);
918
+ const i = Er(r);
919
919
  if (i) return i;
920
920
  }
921
921
  return "";
@@ -1100,7 +1100,7 @@ class L {
1100
1100
  }
1101
1101
  return i.offlineOnly && (r = r.filter((s) => s.offlineAvailability === !0)), i.provider && (r = r.filter(
1102
1102
  (s) => s.provider?.toLowerCase() === i.provider?.toLowerCase()
1103
- )), i.excludeNovelty && (r = kr(r)), i.excludeVeryLowQuality && (r = Or(r)), i.removeDuplicates && (r = this.removeDuplicates(r)), r;
1103
+ )), i.excludeNovelty && (r = Cr(r)), i.excludeVeryLowQuality && (r = kr(r)), i.removeDuplicates && (r = this.removeDuplicates(r)), r;
1104
1104
  }
1105
1105
  /**
1106
1106
  * Filter out novelty voices
@@ -1109,7 +1109,7 @@ class L {
1109
1109
  */
1110
1110
  filterOutNoveltyVoices(e) {
1111
1111
  const n = e ?? this.voices;
1112
- return kr(n);
1112
+ return Cr(n);
1113
1113
  }
1114
1114
  /**
1115
1115
  * Filter out very low quality voices
@@ -1118,7 +1118,7 @@ class L {
1118
1118
  */
1119
1119
  filterOutVeryLowQualityVoices(e) {
1120
1120
  const n = e ?? this.voices;
1121
- return Or(n);
1121
+ return kr(n);
1122
1122
  }
1123
1123
  /**
1124
1124
  * Sort voices by quality, respecting JSON name order, then alphabetically for undefined/null quality
@@ -1261,17 +1261,17 @@ let Kt = class {
1261
1261
  this.listeners.clear();
1262
1262
  }
1263
1263
  };
1264
- const Ct = (t, e) => Math.min(Math.max(t, 0), Math.max(e - 1, 0));
1264
+ const kt = (t, e) => Math.min(Math.max(t, 0), Math.max(e - 1, 0));
1265
1265
  function pe(t, e, n, r) {
1266
1266
  return Number.isFinite(t) ? Math.max(e, Math.min(n, t)) : r;
1267
1267
  }
1268
1268
  function po(t) {
1269
1269
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1270
1270
  }
1271
- var an, Tr;
1271
+ var an, Ar;
1272
1272
  function mo() {
1273
- if (Tr) return an;
1274
- Tr = 1, an = e;
1273
+ if (Ar) return an;
1274
+ Ar = 1, an = e;
1275
1275
  function t(r) {
1276
1276
  return r instanceof Buffer ? Buffer.from(r) : new r.constructor(r.buffer.slice(), r.byteOffset, r.length);
1277
1277
  }
@@ -1327,16 +1327,16 @@ function mo() {
1327
1327
  function c(h, d) {
1328
1328
  const g = Object.keys(h), p = new Array(g.length);
1329
1329
  for (let m = 0; m < g.length; m++) {
1330
- const b = g[m], x = h[b];
1331
- if (typeof x != "object" || x === null)
1332
- p[b] = x;
1333
- else if (x.constructor !== Object && (a = o.get(x.constructor)))
1334
- p[b] = a(x, d);
1335
- else if (ArrayBuffer.isView(x))
1336
- p[b] = t(x);
1330
+ const b = g[m], w = h[b];
1331
+ if (typeof w != "object" || w === null)
1332
+ p[b] = w;
1333
+ else if (w.constructor !== Object && (a = o.get(w.constructor)))
1334
+ p[b] = a(w, d);
1335
+ else if (ArrayBuffer.isView(w))
1336
+ p[b] = t(w);
1337
1337
  else {
1338
- const A = i.indexOf(x);
1339
- A !== -1 ? p[b] = s[A] : p[b] = d(x);
1338
+ const O = i.indexOf(w);
1339
+ O !== -1 ? p[b] = s[O] : p[b] = d(w);
1340
1340
  }
1341
1341
  }
1342
1342
  return p;
@@ -1406,7 +1406,7 @@ function bo(t) {
1406
1406
  function we(t) {
1407
1407
  return Number.isSafeInteger(t) && t >= 0;
1408
1408
  }
1409
- function se(t) {
1409
+ function ae(t) {
1410
1410
  return t != null;
1411
1411
  }
1412
1412
  function So(t, e) {
@@ -1427,9 +1427,9 @@ var ko = Object.prototype, Oo = ko.toString;
1427
1427
  function Ao(t) {
1428
1428
  return Oo.call(t);
1429
1429
  }
1430
- var To = "[object Null]", Ro = "[object Undefined]", Rr = Le ? Le.toStringTag : void 0;
1430
+ var To = "[object Null]", Ro = "[object Undefined]", Tr = Le ? Le.toStringTag : void 0;
1431
1431
  function es(t) {
1432
- return t == null ? t === void 0 ? Ro : To : Rr && Rr in Object(t) ? Co(t) : Ao(t);
1432
+ return t == null ? t === void 0 ? Ro : To : Tr && Tr in Object(t) ? Co(t) : Ao(t);
1433
1433
  }
1434
1434
  function ts(t) {
1435
1435
  return t != null && typeof t == "object";
@@ -1443,14 +1443,14 @@ function Io(t, e) {
1443
1443
  i[n] = e(t[n], n, t);
1444
1444
  return i;
1445
1445
  }
1446
- var Fo = Array.isArray, Nr = Le ? Le.prototype : void 0, Dr = Nr ? Nr.toString : void 0;
1446
+ var Fo = Array.isArray, Rr = Le ? Le.prototype : void 0, Nr = Rr ? Rr.toString : void 0;
1447
1447
  function er(t) {
1448
1448
  if (typeof t == "string")
1449
1449
  return t;
1450
1450
  if (Fo(t))
1451
1451
  return Io(t, er) + "";
1452
1452
  if (Do(t))
1453
- return Dr ? Dr.call(t) : "";
1453
+ return Nr ? Nr.call(t) : "";
1454
1454
  var e = t + "";
1455
1455
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
1456
1456
  }
@@ -1478,12 +1478,12 @@ function is(t) {
1478
1478
  var e = es(t);
1479
1479
  return e == Uo || e == qo || e == Bo || e == zo;
1480
1480
  }
1481
- var on = Zn["__core-js_shared__"], Ir = (function() {
1481
+ var on = Zn["__core-js_shared__"], Dr = (function() {
1482
1482
  var t = /[^.]+$/.exec(on && on.keys && on.keys.IE_PROTO || "");
1483
1483
  return t ? "Symbol(src)_1." + t : "";
1484
1484
  })();
1485
1485
  function jo(t) {
1486
- return !!Ir && Ir in t;
1486
+ return !!Dr && Dr in t;
1487
1487
  }
1488
1488
  var Vo = Function.prototype, Mo = Vo.toString;
1489
1489
  function Ho(t) {
@@ -1546,14 +1546,14 @@ function al(t) {
1546
1546
  return t;
1547
1547
  };
1548
1548
  }
1549
- var Fr = (function() {
1549
+ var Ir = (function() {
1550
1550
  try {
1551
1551
  var t = tr(Object, "defineProperty");
1552
1552
  return t({}, "", {}), t;
1553
1553
  } catch {
1554
1554
  }
1555
- })(), ol = Fr ? function(t, e) {
1556
- return Fr(t, "toString", {
1555
+ })(), ol = Ir ? function(t, e) {
1556
+ return Ir(t, "toString", {
1557
1557
  configurable: !0,
1558
1558
  enumerable: !1,
1559
1559
  value: al(e),
@@ -1585,10 +1585,10 @@ function dl(t, e) {
1585
1585
  function fl(t, e) {
1586
1586
  return t === e || t !== t && e !== e;
1587
1587
  }
1588
- var Lr = Math.max;
1588
+ var Fr = Math.max;
1589
1589
  function gl(t, e, n) {
1590
- return e = Lr(e === void 0 ? t.length - 1 : e, 0), function() {
1591
- for (var r = arguments, i = -1, s = Lr(r.length - e, 0), o = Array(s); ++i < s; )
1590
+ return e = Fr(e === void 0 ? t.length - 1 : e, 0), function() {
1591
+ for (var r = arguments, i = -1, s = Fr(r.length - e, 0), o = Array(s); ++i < s; )
1592
1592
  o[i] = r[e + i];
1593
1593
  i = -1;
1594
1594
  for (var a = Array(e + 1); ++i < e; )
@@ -1606,9 +1606,9 @@ function yl(t) {
1606
1606
  function bl(t) {
1607
1607
  return t != null && yl(t.length) && !is(t);
1608
1608
  }
1609
- var tt = tr(Object, "create");
1609
+ var nt = tr(Object, "create");
1610
1610
  function Sl() {
1611
- this.__data__ = tt ? tt(null) : {}, this.size = 0;
1611
+ this.__data__ = nt ? nt(null) : {}, this.size = 0;
1612
1612
  }
1613
1613
  function vl(t) {
1614
1614
  var e = this.has(t) && delete this.__data__[t];
@@ -1617,7 +1617,7 @@ function vl(t) {
1617
1617
  var wl = "__lodash_hash_undefined__", xl = Object.prototype, El = xl.hasOwnProperty;
1618
1618
  function Cl(t) {
1619
1619
  var e = this.__data__;
1620
- if (tt) {
1620
+ if (nt) {
1621
1621
  var n = e[t];
1622
1622
  return n === wl ? void 0 : n;
1623
1623
  }
@@ -1626,12 +1626,12 @@ function Cl(t) {
1626
1626
  var kl = Object.prototype, Ol = kl.hasOwnProperty;
1627
1627
  function Al(t) {
1628
1628
  var e = this.__data__;
1629
- return tt ? e[t] !== void 0 : Ol.call(e, t);
1629
+ return nt ? e[t] !== void 0 : Ol.call(e, t);
1630
1630
  }
1631
1631
  var Tl = "__lodash_hash_undefined__";
1632
1632
  function Rl(t, e) {
1633
1633
  var n = this.__data__;
1634
- return this.size += this.has(t) ? 0 : 1, n[t] = tt && e === void 0 ? Tl : e, this;
1634
+ return this.size += this.has(t) ? 0 : 1, n[t] = nt && e === void 0 ? Tl : e, this;
1635
1635
  }
1636
1636
  function me(t) {
1637
1637
  var e = -1, n = t == null ? 0 : t.length;
@@ -1752,7 +1752,7 @@ var ss = "\\ud800-\\udfff", rc = "\\u0300-\\u036f", ic = "\\ufe20-\\ufe2f", sc =
1752
1752
  function pc(t) {
1753
1753
  return t.match(gc) || [];
1754
1754
  }
1755
- function Pr(t) {
1755
+ function Lr(t) {
1756
1756
  return tc(t) ? pc(t) : nc(t);
1757
1757
  }
1758
1758
  var mc = "__lodash_hash_undefined__";
@@ -1803,12 +1803,12 @@ function Cc(t, e) {
1803
1803
  ;
1804
1804
  return n;
1805
1805
  }
1806
- function $r(t, e, n) {
1806
+ function Pr(t, e, n) {
1807
1807
  if (t = Ml(t), t && e === void 0)
1808
1808
  return _o(t);
1809
1809
  if (!t || !(e = er(e)))
1810
1810
  return t;
1811
- var r = Pr(t), i = Pr(e), s = Cc(r, i), o = Ec(r, i) + 1;
1811
+ var r = Lr(t), i = Lr(e), s = Cc(r, i), o = Ec(r, i) + 1;
1812
1812
  return Wl(r, s, o).join("");
1813
1813
  }
1814
1814
  var kc = pl(function(t, e) {
@@ -1882,7 +1882,7 @@ var Tc = {
1882
1882
  }, Nc = $e($e({}, Pe), { all: Pe.html5 }), Dc = {
1883
1883
  scope: "body",
1884
1884
  level: "all"
1885
- }, cn = /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g, un = /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g, _r = {
1885
+ }, cn = /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g, un = /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g, $r = {
1886
1886
  xml: {
1887
1887
  strict: cn,
1888
1888
  attribute: un,
@@ -1898,7 +1898,7 @@ var Tc = {
1898
1898
  attribute: un,
1899
1899
  body: ln.html5
1900
1900
  }
1901
- }, Ic = $e($e({}, _r), { all: _r.html5 }), hs = String.fromCharCode, Fc = hs(65533);
1901
+ }, Ic = $e($e({}, $r), { all: $r.html5 }), hs = String.fromCharCode, Fc = hs(65533);
1902
1902
  function Lc(t, e, n, r) {
1903
1903
  var i = t, s = t[t.length - 1];
1904
1904
  if (n && s === "=")
@@ -1916,7 +1916,7 @@ function Lc(t, e, n, r) {
1916
1916
  }
1917
1917
  return i;
1918
1918
  }
1919
- function Br(t, e) {
1919
+ function _r(t, e) {
1920
1920
  var n = e === void 0 ? Dc : e, r = n.level, i = r === void 0 ? "all" : r, s = n.scope, o = s === void 0 ? i === "xml" ? "strict" : "body" : s;
1921
1921
  if (!t)
1922
1922
  return "";
@@ -1934,7 +1934,7 @@ function Dt(t, e) {
1934
1934
  let s = t.length ** 2, o = 0;
1935
1935
  return Array.from(t).sort((a, c) => (n.progressFn && (o += 1, n.progressFn(Math.floor(o * 100 / s))), a[0] === c[0] ? a[1] < c[1] ? -1 : a[1] > c[1] ? 1 : 0 : a[0] < c[0] ? -1 : 1));
1936
1936
  }
1937
- var Ur = { mergeType: 1, progressFn: null, joinRangesThatTouchEdges: !0 };
1937
+ var Br = { mergeType: 1, progressFn: null, joinRangesThatTouchEdges: !0 };
1938
1938
  function $c(t, e) {
1939
1939
  function n(l) {
1940
1940
  return !!l && typeof l == "object" && !Array.isArray(l);
@@ -1942,13 +1942,13 @@ function $c(t, e) {
1942
1942
  if (!Array.isArray(t) || !t.length) return null;
1943
1943
  let r;
1944
1944
  if (e) if (n(e)) {
1945
- if (r = { ...Ur, ...e }, r.progressFn && n(r.progressFn) && !Object.keys(r.progressFn).length) r.progressFn = null;
1945
+ if (r = { ...Br, ...e }, r.progressFn && n(r.progressFn) && !Object.keys(r.progressFn).length) r.progressFn = null;
1946
1946
  else if (r.progressFn && typeof r.progressFn != "function") throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof r.progressFn}", equal to ${JSON.stringify(r.progressFn, null, 4)}`);
1947
1947
  if (![1, 2, "1", "2"].includes(r.mergeType)) throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof r.mergeType}", equal to ${JSON.stringify(r.mergeType, null, 4)}`);
1948
1948
  if (typeof r.joinRangesThatTouchEdges != "boolean") throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof r.joinRangesThatTouchEdges}", equal to ${JSON.stringify(r.joinRangesThatTouchEdges, null, 4)}`);
1949
1949
  } else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
1950
1950
  ${JSON.stringify(e, null, 4)} (type ${typeof e})`);
1951
- else r = { ...Ur };
1951
+ else r = { ...Br };
1952
1952
  let i = t.filter((l) => Array.isArray(l)).map((l) => [...l]).filter((l) => l[2] !== void 0 || l[0] !== l[1]), s, o, a;
1953
1953
  r.progressFn ? s = Dt(i, { progressFn: (l) => {
1954
1954
  a = Math.floor(l / 5), a !== o && (o = a, r.progressFn(a));
@@ -1957,12 +1957,12 @@ ${JSON.stringify(e, null, 4)} (type ${typeof e})`);
1957
1957
  for (let l = c; l > 0; l--) r.progressFn && (a = Math.floor((1 - l / c) * 78) + 21, a !== o && a > o && (o = a, r.progressFn(a))), (s[l][0] <= s[l - 1][0] || !r.joinRangesThatTouchEdges && s[l][0] < s[l - 1][1] || r.joinRangesThatTouchEdges && s[l][0] <= s[l - 1][1]) && (s[l - 1][0] = Math.min(s[l][0], s[l - 1][0]), s[l - 1][1] = Math.max(s[l][1], s[l - 1][1]), s[l][2] !== void 0 && (s[l - 1][0] >= s[l][0] || s[l - 1][1] <= s[l][1]) && s[l - 1][2] !== null && (s[l][2] === null && s[l - 1][2] !== null ? s[l - 1][2] = null : s[l - 1][2] != null ? +r.mergeType == 2 && s[l - 1][0] === s[l][0] ? s[l - 1][2] = s[l][2] : s[l - 1][2] += s[l][2] : s[l - 1][2] = s[l][2]), s.splice(l, 1), l = s.length);
1958
1958
  return s.length ? s : null;
1959
1959
  }
1960
- var _c = {}, Bc = _c.NODE_ENV === "production", qr = "Invariant failed";
1960
+ var _c = {}, Bc = _c.NODE_ENV === "production", Ur = "Invariant failed";
1961
1961
  function Uc(t, e) {
1962
1962
  if (!t) {
1963
1963
  if (Bc)
1964
- throw new Error(qr);
1965
- var n = qr;
1964
+ throw new Error(Ur);
1965
+ var n = Ur;
1966
1966
  throw new Error(n);
1967
1967
  }
1968
1968
  }
@@ -2032,7 +2032,7 @@ function hn(t, e = 1) {
2032
2032
  }
2033
2033
  return t;
2034
2034
  }
2035
- var zr = { mergeType: 1, progressFn: null, joinRangesThatTouchEdges: !0 };
2035
+ var qr = { mergeType: 1, progressFn: null, joinRangesThatTouchEdges: !0 };
2036
2036
  function zc(t, e) {
2037
2037
  function n(l) {
2038
2038
  return !!l && typeof l == "object" && !Array.isArray(l);
@@ -2040,13 +2040,13 @@ function zc(t, e) {
2040
2040
  if (!Array.isArray(t) || !t.length) return null;
2041
2041
  let r;
2042
2042
  if (e) if (n(e)) {
2043
- if (r = { ...zr, ...e }, r.progressFn && n(r.progressFn) && !Object.keys(r.progressFn).length) r.progressFn = null;
2043
+ if (r = { ...qr, ...e }, r.progressFn && n(r.progressFn) && !Object.keys(r.progressFn).length) r.progressFn = null;
2044
2044
  else if (r.progressFn && typeof r.progressFn != "function") throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof r.progressFn}", equal to ${JSON.stringify(r.progressFn, null, 4)}`);
2045
2045
  if (![1, 2, "1", "2"].includes(r.mergeType)) throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof r.mergeType}", equal to ${JSON.stringify(r.mergeType, null, 4)}`);
2046
2046
  if (typeof r.joinRangesThatTouchEdges != "boolean") throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof r.joinRangesThatTouchEdges}", equal to ${JSON.stringify(r.joinRangesThatTouchEdges, null, 4)}`);
2047
2047
  } else throw new Error(`ranges-merge: [THROW_ID_03] the second input argument must be a plain object. It was given as:
2048
2048
  ${JSON.stringify(e, null, 4)} (type ${typeof e})`);
2049
- else r = { ...zr };
2049
+ else r = { ...qr };
2050
2050
  let i = t.filter((l) => Array.isArray(l)).map((l) => [...l]).filter((l) => l[2] !== void 0 || l[0] !== l[1]), s, o, a;
2051
2051
  r.progressFn ? s = Dt(i, { progressFn: (l) => {
2052
2052
  a = Math.floor(l / 5), a !== o && (o = a, r.progressFn != null && r.progressFn(a));
@@ -2067,7 +2067,7 @@ var jc = { limitToBeAddedWhitespace: !1, limitLinebreaksCount: 1, mergeType: 1 }
2067
2067
  opts;
2068
2068
  add(e, n, r) {
2069
2069
  if (e == null && n == null) return;
2070
- if (se(e) && !se(n)) {
2070
+ if (ae(e) && !ae(n)) {
2071
2071
  if (Array.isArray(e)) {
2072
2072
  if (e.length) {
2073
2073
  if (e.some((o) => Array.isArray(o))) {
@@ -2081,13 +2081,13 @@ var jc = { limitToBeAddedWhitespace: !1, limitLinebreaksCount: 1, mergeType: 1 }
2081
2081
  return;
2082
2082
  }
2083
2083
  throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(e, null, 0)}) but second-one, "to" is not (${JSON.stringify(n, null, 0)})`);
2084
- } else if (!se(e) && se(n)) throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(n, null, 0)}) but first-one, "from" is not (${JSON.stringify(e, null, 0)})`);
2084
+ } else if (!ae(e) && ae(n)) throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(n, null, 0)}) but first-one, "from" is not (${JSON.stringify(e, null, 0)})`);
2085
2085
  let i = +e, s = +n;
2086
2086
  if (we(i) && we(s)) {
2087
- if (se(r) && !ke(r) && !bo(r)) throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof r}, equal to:
2087
+ if (ae(r) && !ke(r) && !bo(r)) throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof r}, equal to:
2088
2088
  ${JSON.stringify(r, null, 4)}`);
2089
- if (se(this.ranges) && Array.isArray(this.last()) && i === this.last()[1]) {
2090
- if (this.last()[1] = s, this.last()[2], this.last()[2] !== null && se(r)) {
2089
+ if (ae(this.ranges) && Array.isArray(this.last()) && i === this.last()[1]) {
2090
+ if (this.last()[1] = s, this.last()[2], this.last()[2] !== null && ae(r)) {
2091
2091
  let o = this.last()[2] && this.last()[2].length && (!this.opts?.mergeType || this.opts.mergeType === 1) ? `${this.last()[2]}${r}` : r;
2092
2092
  this.opts.limitToBeAddedWhitespace && (o = hn(o, this.opts.limitLinebreaksCount)), ke(o) && !o.length || (this.last()[2] = o);
2093
2093
  }
@@ -2102,7 +2102,7 @@ ${JSON.stringify(r, null, 4)}`);
2102
2102
  this.add(e, n, r);
2103
2103
  }
2104
2104
  current() {
2105
- return Array.isArray(this.ranges) && this.ranges.length ? (this.ranges = zc(this.ranges, { mergeType: this.opts.mergeType }), this.ranges && this.opts.limitToBeAddedWhitespace ? this.ranges.map((e) => se(e[2]) ? [e[0], e[1], hn(e[2], this.opts.limitLinebreaksCount)] : e) : this.ranges) : null;
2105
+ return Array.isArray(this.ranges) && this.ranges.length ? (this.ranges = zc(this.ranges, { mergeType: this.opts.mergeType }), this.ranges && this.opts.limitToBeAddedWhitespace ? this.ranges.map((e) => ae(e[2]) ? [e[0], e[1], hn(e[2], this.opts.limitLinebreaksCount)] : e) : this.ranges) : null;
2106
2106
  }
2107
2107
  wipe() {
2108
2108
  this.ranges = [];
@@ -2134,55 +2134,55 @@ function Y(t, e = 0) {
2134
2134
  function Hc(t) {
2135
2135
  return /[-_A-Za-z0-9]/.test(t);
2136
2136
  }
2137
- function jr(t, e) {
2137
+ function zr(t, e) {
2138
2138
  if (!t) return [];
2139
2139
  if (Array.isArray(t)) return t.filter((n) => typeof n == "string" && n.trim());
2140
2140
  if (typeof t == "string") return t.trim() ? [t] : [];
2141
2141
  throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_05] ${e} must be array containing zero or more strings or something falsey. Currently it's equal to: ${t}, that a type of ${typeof t}.`);
2142
2142
  }
2143
- function dt(t, e, n, r) {
2143
+ function ft(t, e, n, r) {
2144
2144
  for (let i = e, s = t.length; i < s; i++) {
2145
2145
  if (t.startsWith(n, i)) return !0;
2146
2146
  if (t.startsWith(r, i)) return !1;
2147
2147
  }
2148
2148
  return !1;
2149
2149
  }
2150
- function Vr(t, e, n) {
2151
- return t?.quotes, t?.quotes?.value && dt(e, n + 1, t.quotes.value, ">"), t?.quotes?.next, dt(e, t?.quotes?.next - 1, t?.quotes?.value, ">"), !t?.quotes || !dt(e, n + 1, t.quotes.value, ">") && t?.quotes?.next !== -1 && dt(e, t?.quotes?.next - 1, t?.quotes?.value, ">");
2150
+ function jr(t, e, n) {
2151
+ return t?.quotes, t?.quotes?.value && ft(e, n + 1, t.quotes.value, ">"), t?.quotes?.next, ft(e, t?.quotes?.next - 1, t?.quotes?.value, ">"), !t?.quotes || !ft(e, n + 1, t.quotes.value, ">") && t?.quotes?.next !== -1 && ft(e, t?.quotes?.next - 1, t?.quotes?.value, ">");
2152
2152
  }
2153
2153
  function Wc(t, e) {
2154
2154
  return (e.match(new RegExp(t, "g")) || []).length;
2155
2155
  }
2156
- var Ve = /* @__PURE__ */ new Set(["!doctype", "abbr", "address", "area", "article", "aside", "audio", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "doctype", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "math", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "param", "picture", "pre", "progress", "rb", "rp", "rt", "rtc", "ruby", "samp", "script", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "ul", "var", "video", "wbr", "xml"]), fn = /* @__PURE__ */ new Set(["a", "b", "i", "p", "q", "s", "u"]), gn = /* @__PURE__ */ new Set([".", ",", ";", "!", "?"]), Mr = /* @__PURE__ */ new Set([".", ",", "?", ";", ")", "…", '"', "»"]), Gc = /* @__PURE__ */ new Set(["a", "abbr", "acronym", "audio", "b", "bdi", "bdo", "big", "button", "canvas", "cite", "code", "data", "datalist", "del", "dfn", "em", "embed", "i", "iframe", "input", "ins", "kbd", "label", "map", "mark", "meter", "noscript", "object", "output", "picture", "progress", "q", "ruby", "s", "samp", "select", "slot", "small", "span", "strong", "sub", "sup", "svg", "template", "textarea", "time", "u", "tt", "var", "video", "wbr"]), Hr = { ignoreTags: [], ignoreTagsWithTheirContents: [], onlyStripTags: [], stripTogetherWithTheirContents: ["script", "style", "xml"], skipHtmlDecoding: !1, trimOnlySpaces: !1, stripRecognisedHTMLOnly: !1, dumpLinkHrefsNearby: { enabled: !1, putOnNewLine: !1, wrapHeads: "", wrapTails: "" }, ignoreIndentations: !1, cb: null, reportProgressFunc: null, reportProgressFuncFrom: 0, reportProgressFuncTo: 100 };
2156
+ var Ve = /* @__PURE__ */ new Set(["!doctype", "abbr", "address", "area", "article", "aside", "audio", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "doctype", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "math", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "param", "picture", "pre", "progress", "rb", "rp", "rt", "rtc", "ruby", "samp", "script", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "ul", "var", "video", "wbr", "xml"]), fn = /* @__PURE__ */ new Set(["a", "b", "i", "p", "q", "s", "u"]), gn = /* @__PURE__ */ new Set([".", ",", ";", "!", "?"]), Vr = /* @__PURE__ */ new Set([".", ",", "?", ";", ")", "…", '"', "»"]), Gc = /* @__PURE__ */ new Set(["a", "abbr", "acronym", "audio", "b", "bdi", "bdo", "big", "button", "canvas", "cite", "code", "data", "datalist", "del", "dfn", "em", "embed", "i", "iframe", "input", "ins", "kbd", "label", "map", "mark", "meter", "noscript", "object", "output", "picture", "progress", "q", "ruby", "s", "samp", "select", "slot", "small", "span", "strong", "sub", "sup", "svg", "template", "textarea", "time", "u", "tt", "var", "video", "wbr"]), Mr = { ignoreTags: [], ignoreTagsWithTheirContents: [], onlyStripTags: [], stripTogetherWithTheirContents: ["script", "style", "xml"], skipHtmlDecoding: !1, trimOnlySpaces: !1, stripRecognisedHTMLOnly: !1, dumpLinkHrefsNearby: { enabled: !1, putOnNewLine: !1, wrapHeads: "", wrapTails: "" }, ignoreIndentations: !1, cb: null, reportProgressFunc: null, reportProgressFuncFrom: 0, reportProgressFuncTo: 100 };
2157
2157
  function ds(t, e) {
2158
2158
  let n = Date.now(), r = [], i = [], s = [], o = [], a = {};
2159
2159
  function c() {
2160
2160
  a = { attributes: [] };
2161
2161
  }
2162
2162
  c();
2163
- let l = null, u = null, h = null, d = !1, g = {}, p = { tagName: "", hrefValue: "", openingTagEnds: void 0 }, m = "", b = !1, x = null, A = !0;
2163
+ let l = null, u = null, h = null, d = !1, g = {}, p = { tagName: "", hrefValue: "", openingTagEnds: void 0 }, m = "", b = !1, w = null, O = !0;
2164
2164
  function S(f, v, C) {
2165
2165
  if (Array.isArray(v.stripTogetherWithTheirContents) && (v.stripTogetherWithTheirContents.includes(a.name) || v.stripTogetherWithTheirContents.includes("*"))) if (a.slashPresent && Array.isArray(r) && r.some((E) => E.name === a.name)) {
2166
2166
  for (let E = r.length; E--; ) if (r[E].name === a.name) {
2167
2167
  o = o.filter(([N, B]) => (N < r[E].lastOpeningBracketAt || N >= f + 1) && (B <= r[E].lastOpeningBracketAt || B > f + 1));
2168
- let F = f + 1;
2169
- a.lastClosingBracketAt && (F = a.lastClosingBracketAt + 1), o.push([r[E].lastOpeningBracketAt, F]), Mr.has(t[f]) && v.cb ? v.cb({ tag: a, deleteFrom: r[E].lastOpeningBracketAt, deleteTo: f + 1, insert: null, rangesArr: C, proposedReturn: [r[E].lastOpeningBracketAt, f, null] }) : v.cb && v.cb({ tag: a, deleteFrom: r[E].lastOpeningBracketAt, deleteTo: f, insert: "", rangesArr: C, proposedReturn: [r[E].lastOpeningBracketAt, f, ""] }), r.splice(E, 1);
2168
+ let I = f + 1;
2169
+ a.lastClosingBracketAt && (I = a.lastClosingBracketAt + 1), o.push([r[E].lastOpeningBracketAt, I]), Vr.has(t[f]) && v.cb ? v.cb({ tag: a, deleteFrom: r[E].lastOpeningBracketAt, deleteTo: f + 1, insert: null, rangesArr: C, proposedReturn: [r[E].lastOpeningBracketAt, f, null] }) : v.cb && v.cb({ tag: a, deleteFrom: r[E].lastOpeningBracketAt, deleteTo: f, insert: "", rangesArr: C, proposedReturn: [r[E].lastOpeningBracketAt, f, ""] }), r.splice(E, 1);
2170
2170
  break;
2171
2171
  }
2172
2172
  } else a.slashPresent || r.push(a);
2173
- else Array.isArray(v.ignoreTagsWithTheirContents) && X(f, v, a) && (A = !1);
2173
+ else Array.isArray(v.ignoreTagsWithTheirContents) && X(f, v, a) && (O = !1);
2174
2174
  }
2175
- function w(f, v, C, E, F, N) {
2175
+ function x(f, v, C, E, I, N) {
2176
2176
  if (Array.isArray(k.current()) && typeof C == "number" && k.current()[0][0] === 0 && k.current()[0][1] >= C) return "";
2177
2177
  if (t.length === E && N && !y?.dumpLinkHrefsNearby?.enabled) return null;
2178
2178
  let B = "";
2179
- if (Number.isInteger(C) && C < F && (B += f.slice(C, F)), Number.isInteger(E) && E > N + 1) {
2179
+ if (Number.isInteger(C) && C < I && (B += f.slice(C, I)), Number.isInteger(E) && E > N + 1) {
2180
2180
  let Z = f.slice(N + 1, E);
2181
2181
  E && !Y(t, E - 1) && (Z = Z.trimEnd()), Z.includes(`
2182
- `) && I(E, f) ? B += " " : B += Z;
2182
+ `) && F(E, f) ? B += " " : B += Z;
2183
2183
  }
2184
- let ve = !Mr.has(f[v]), wr = f[E - 1] !== ">" || !f[C].trim(), xr = !['"', "("].includes(f[F - 1]), Ba = ![";", ".", ":", "!"].includes(f[v]);
2185
- if ((ve || wr && xr && Ba) && (wr || xr) && f[v] !== "!" && (!Gc.has(a.name) || typeof C == "number" && C < F || typeof E == "number" && E > N + 1)) {
2184
+ let ve = !Vr.has(f[v]), vr = f[E - 1] !== ">" || !f[C].trim(), wr = !['"', "("].includes(f[I - 1]), Ba = ![";", ".", ":", "!"].includes(f[v]);
2185
+ if ((ve || vr && wr && Ba) && (vr || wr) && f[v] !== "!" && (!Gc.has(a.name) || typeof C == "number" && C < I || typeof E == "number" && E > N + 1)) {
2186
2186
  let Z = B.match(/\n/g);
2187
2187
  return Array.isArray(Z) && Z.length ? Z.length === 1 ? `
2188
2188
  ` : Z.length === 2 ? `
@@ -2194,7 +2194,7 @@ function ds(t, e) {
2194
2194
  }
2195
2195
  return "";
2196
2196
  }
2197
- function T(f, v) {
2197
+ function R(f, v) {
2198
2198
  if (f.dumpLinkHrefsNearby?.enabled && p.tagName && p.tagName === a.name && a.lastOpeningBracketAt && (p.openingTagEnds && a.lastOpeningBracketAt > p.openingTagEnds || !p.openingTagEnds) && (b = !0), b) {
2199
2199
  let C = f.dumpLinkHrefsNearby?.putOnNewLine ? `
2200
2200
 
@@ -2202,7 +2202,7 @@ function ds(t, e) {
2202
2202
  m = `${C}${p.hrefValue}`, (typeof v != "number" || Y(t, v - 1)) && (m += C);
2203
2203
  }
2204
2204
  }
2205
- function I(f, v) {
2205
+ function F(f, v) {
2206
2206
  return v ? v[f] === "<" && v[f + 1] !== "%" : t[f] === "<" && t[f + 1] !== "%";
2207
2207
  }
2208
2208
  function P(f) {
@@ -2210,8 +2210,8 @@ function ds(t, e) {
2210
2210
  }
2211
2211
  function X(f, v, C) {
2212
2212
  if (v.ignoreTagsWithTheirContents.includes("*")) return !0;
2213
- let E = t.indexOf(`<${C.name}`, f), F = t.indexOf(`</${C.name}`, f);
2214
- return !C.slashPresent && F === -1 || C.slashPresent && !i.some((N) => N.name === C.name) || F > -1 && E > -1 && E < F ? !1 : v.ignoreTagsWithTheirContents.includes(C.name);
2213
+ let E = t.indexOf(`<${C.name}`, f), I = t.indexOf(`</${C.name}`, f);
2214
+ return !C.slashPresent && I === -1 || C.slashPresent && !i.some((N) => N.name === C.name) || I > -1 && E > -1 && E < I ? !1 : v.ignoreTagsWithTheirContents.includes(C.name);
2215
2215
  }
2216
2216
  if (typeof t != "string") throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_01] Input must be string! Currently it's: ${(typeof t).toLowerCase()}, equal to:
2217
2217
  ${JSON.stringify(t, null, 4)}`);
@@ -2223,25 +2223,25 @@ ${JSON.stringify(e, null, 4)}`);
2223
2223
  function V() {
2224
2224
  b && (p = { tagName: "", hrefValue: "", openingTagEnds: void 0 }, b = !1);
2225
2225
  }
2226
- let y = { ...Hr, ...e, dumpLinkHrefsNearby: Object.assign({}, Hr.dumpLinkHrefsNearby, e?.dumpLinkHrefsNearby) };
2226
+ let y = { ...Mr, ...e, dumpLinkHrefsNearby: Object.assign({}, Mr.dumpLinkHrefsNearby, e?.dumpLinkHrefsNearby) };
2227
2227
  if (So(y, "returnRangesOnly")) throw new TypeError("string-strip-html/stripHtml(): [THROW_ID_05] The Optional Options Object's key returnRangesOnly has been removed from the API since v.5 release.");
2228
2228
  if (y.reportProgressFunc) {
2229
2229
  if (typeof y.reportProgressFuncFrom != "number") throw new Error(`string-strip-html/stripHtml(): [THROW_ID_06] The Optional Options Object's key reportProgressFuncFrom, callback function's "from" range, should be a number but it was given as type ${typeof y.reportProgressFuncFrom}, equal to ${JSON.stringify(y.reportProgressFuncFrom, null, 4)}`);
2230
2230
  if (typeof y.reportProgressFuncTo != "number") throw new Error(`string-strip-html/stripHtml(): [THROW_ID_07] The Optional Options Object's key reportProgressFuncTo, callback function's "to" range, should be a number but it was given as type ${typeof y.reportProgressFuncTo}, equal to ${JSON.stringify(y.reportProgressFuncTo, null, 4)}`);
2231
2231
  }
2232
- y.ignoreTags = jr(y.ignoreTags, "resolvedOpts.ignoreTags"), y.onlyStripTags = jr(y.onlyStripTags, "resolvedOpts.onlyStripTags");
2233
- let ht = !!y.onlyStripTags.length;
2232
+ y.ignoreTags = zr(y.ignoreTags, "resolvedOpts.ignoreTags"), y.onlyStripTags = zr(y.onlyStripTags, "resolvedOpts.onlyStripTags");
2233
+ let dt = !!y.onlyStripTags.length;
2234
2234
  y.onlyStripTags.length && y.ignoreTags.length && (y.onlyStripTags = kc(y.onlyStripTags, ...y.ignoreTags)), y.stripTogetherWithTheirContents ? typeof y.stripTogetherWithTheirContents == "string" && y.stripTogetherWithTheirContents.length && (y.stripTogetherWithTheirContents = [y.stripTogetherWithTheirContents]) : y.stripTogetherWithTheirContents = [];
2235
- let ce = {};
2236
- if (y.stripTogetherWithTheirContents && Array.isArray(y.stripTogetherWithTheirContents) && y.stripTogetherWithTheirContents.length && !y.stripTogetherWithTheirContents.every((f, v) => typeof f != "string" ? (ce.el = f, ce.i = v, !1) : !0)) throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_08] Optional Options Object's key stripTogetherWithTheirContents was set to contain not just string elements! For example, element at index ${ce.i} has a value ${ce.el} which is not string but ${(typeof ce.el).toLowerCase()}.`);
2235
+ let ue = {};
2236
+ if (y.stripTogetherWithTheirContents && Array.isArray(y.stripTogetherWithTheirContents) && y.stripTogetherWithTheirContents.length && !y.stripTogetherWithTheirContents.every((f, v) => typeof f != "string" ? (ue.el = f, ue.i = v, !1) : !0)) throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_08] Optional Options Object's key stripTogetherWithTheirContents was set to contain not just string elements! For example, element at index ${ue.i} has a value ${ue.el} which is not string but ${(typeof ue.el).toLowerCase()}.`);
2237
2237
  y.cb || (y.cb = ({ rangesArr: f, proposedReturn: v }) => {
2238
2238
  v && f.push(...v);
2239
2239
  });
2240
2240
  let k = new Vc({ limitToBeAddedWhitespace: !0, limitLinebreaksCount: 2 });
2241
- if (!y.skipHtmlDecoding) for (; t !== Br(t, { scope: "strict" }); ) t = Br(t, { scope: "strict" });
2241
+ if (!y.skipHtmlDecoding) for (; t !== _r(t, { scope: "strict" }); ) t = _r(t, { scope: "strict" });
2242
2242
  let _ = !1, G = !1, z = 0, H = 0, q = t.length, Se = Math.floor(q / 2);
2243
2243
  for (let f = 0; f < q; f++) {
2244
- if (y.reportProgressFunc && (q > 1e3 && q < 2e3 ? f === Se && y.reportProgressFunc(Math.floor((y.reportProgressFuncTo - y.reportProgressFuncFrom) / 2)) : q >= 2e3 && (z = y.reportProgressFuncFrom + Math.floor(f / q * (y.reportProgressFuncTo - y.reportProgressFuncFrom)), z !== H && (H = z, y.reportProgressFunc(z)))), Object.keys(a).length > 1 && a.lastClosingBracketAt && a.lastClosingBracketAt < f && t[f] !== " " && x === null && (x = f), !_ && t[f] === "%" && t[f - 1] === "{" && t.includes("%}", f + 1)) {
2244
+ if (y.reportProgressFunc && (q > 1e3 && q < 2e3 ? f === Se && y.reportProgressFunc(Math.floor((y.reportProgressFuncTo - y.reportProgressFuncFrom) / 2)) : q >= 2e3 && (z = y.reportProgressFuncFrom + Math.floor(f / q * (y.reportProgressFuncTo - y.reportProgressFuncFrom)), z !== H && (H = z, y.reportProgressFunc(z)))), Object.keys(a).length > 1 && a.lastClosingBracketAt && a.lastClosingBracketAt < f && t[f] !== " " && w === null && (w = f), !_ && t[f] === "%" && t[f - 1] === "{" && t.includes("%}", f + 1)) {
2245
2245
  h = null;
2246
2246
  let v = t.indexOf("%}", f) - 1;
2247
2247
  if (v > f) {
@@ -2252,16 +2252,16 @@ ${JSON.stringify(e, null, 4)}`);
2252
2252
  if (!_ && P(f) && (!a || Object.keys(a).length < 2) && f > 1) {
2253
2253
  for (let v = f; v--; ) if (t[v - 1] === void 0 || P(v)) {
2254
2254
  let C = t[v - 1] === void 0 ? v : v + 1, E = t.slice(C, f + 1) || "";
2255
- if ((E.includes("/>") || E.includes("/ >") || E.includes('="') || E.includes("='")) && t !== `<${$r(E.trim(), "/>")}>` && [...Ve].some((F) => $r(E.trim().split(/\s+/).filter((N) => N.trim()).filter((N, B) => B === 0), "/>").toLowerCase() === F) && ds(`<${E.trim()}>`, y).result === "") {
2255
+ if ((E.includes("/>") || E.includes("/ >") || E.includes('="') || E.includes("='")) && t !== `<${Pr(E.trim(), "/>")}>` && [...Ve].some((I) => Pr(E.trim().split(/\s+/).filter((N) => N.trim()).filter((N, B) => B === 0), "/>").toLowerCase() === I) && ds(`<${E.trim()}>`, y).result === "") {
2256
2256
  (!s.length || s[s.length - 1][0] !== a.lastOpeningBracketAt) && s.push([C, f + 1]), (!o.length || o[o.length - 1][0] !== a.lastOpeningBracketAt) && o.push([C, f + 1]);
2257
- let F = w(t, f, C, f + 1, C, f + 1), N = f + 1;
2257
+ let I = x(t, f, C, f + 1, C, f + 1), N = f + 1;
2258
2258
  if (t[N] && !t[N].trim()) {
2259
2259
  for (let B = N; B < q; B++) if (t[B].trim()) {
2260
2260
  N = B;
2261
2261
  break;
2262
2262
  }
2263
2263
  }
2264
- y.cb({ tag: a, deleteFrom: C, deleteTo: N, insert: F, rangesArr: k, proposedReturn: [C, N, F] });
2264
+ y.cb({ tag: a, deleteFrom: C, deleteTo: N, insert: I, rangesArr: k, proposedReturn: [C, N, I] });
2265
2265
  }
2266
2266
  break;
2267
2267
  }
@@ -2280,22 +2280,22 @@ ${JSON.stringify(e, null, 4)}`);
2280
2280
  a = {};
2281
2281
  continue;
2282
2282
  }
2283
- if (typeof a.name == "string" && a.name.toLowerCase() === "doctype" && (G = !0), I(f)) {
2284
- T(y);
2285
- let v = w(t, f, a.leftOuterWhitespace, f, a.lastOpeningBracketAt, f);
2283
+ if (typeof a.name == "string" && a.name.toLowerCase() === "doctype" && (G = !0), F(f)) {
2284
+ R(y);
2285
+ let v = x(t, f, a.leftOuterWhitespace, f, a.lastOpeningBracketAt, f);
2286
2286
  (y.stripTogetherWithTheirContents.includes(a.name) || y.stripTogetherWithTheirContents.includes("*")) && (o = o.filter(([C, E]) => !(C === a.leftOuterWhitespace && E === f))), y.cb({ tag: a, deleteFrom: a.leftOuterWhitespace, deleteTo: f, insert: `${v}${m}${v}`, rangesArr: k, proposedReturn: [a.leftOuterWhitespace, f, `${v}${m}${v}`] }), V(), S(f, y, k);
2287
2287
  }
2288
2288
  }
2289
- if (a.quotes?.start && a.quotes.start < f && !a.quotes.end && g.nameEnds && g.equalsAt && !g.valueStarts && (g.valueStarts = f), !a.quotes && g.nameEnds && t[f] === "=" && !g.valueStarts && !g.equalsAt && (g.equalsAt = f), !a.quotes && g.nameStarts && g.nameEnds && !g.valueStarts && t[f].trim() && t[f] !== "=" && (a.attributes.push(g), g = {}), !a.quotes && g.nameStarts && !g.nameEnds && (G && `'"`.includes(t[g.nameStarts]) ? g.nameStarts < f && t[f] === t[g.nameStarts] && (g.nameEnds = f + 1, g.name = t.slice(g.nameStarts, g.nameEnds)) : t[f].trim() ? t[f] === "=" ? g.equalsAt || (g.nameEnds = f, g.equalsAt = f, g.name = t.slice(g.nameStarts, g.nameEnds)) : t[f] === "/" || P(f) ? (g.nameEnds = f, g.name = t.slice(g.nameStarts, g.nameEnds), a.attributes.push(g), g = {}) : I(f) && (g.nameEnds = f, g.name = t.slice(g.nameStarts, g.nameEnds), a.attributes.push(g), g = {}) : (g.nameEnds = f, g.name = t.slice(g.nameStarts, g.nameEnds))), !a.quotes && a.nameEnds < f && !t[f - 1].trim() && t[f].trim() && !"<>/!".includes(t[f]) && !g.nameStarts && !a.lastClosingBracketAt && (g.nameStarts = f), a.lastOpeningBracketAt !== null && a.lastOpeningBracketAt < f && t[f] === "/" && a.onlyPlausible && (a.onlyPlausible = !1), a.lastOpeningBracketAt !== null && a.lastOpeningBracketAt < f && t[f] !== "/" && (a.onlyPlausible === void 0 && ((!t[f].trim() || I(f)) && !a.slashPresent ? a.onlyPlausible = !0 : a.onlyPlausible = !1), t[f].trim() && a.nameStarts === void 0 && !I(f) && t[f] !== "/" && !P(f) && t[f] !== "!" && (a.nameStarts = f, a.nameContainsLetters = !1)), a.nameStarts && !a.quotes && typeof t[f] == "string" && t[f].toLowerCase() !== t[f].toUpperCase() && (a.nameContainsLetters = !0), P(f) && (Vr(a, t, f) || a.quotes.value && typeof a.lastOpeningBracketAt == "number" && Wc(a.quotes.value, t.slice(a.lastOpeningBracketAt, f)) % 2 === 1 && !t.slice(a.lastOpeningBracketAt + 1, f).includes("<") && !t.slice(a.lastOpeningBracketAt + 1, f).includes(">")) && a.lastOpeningBracketAt !== void 0 && (a.lastClosingBracketAt = f, x = null, Object.keys(g).length && (a.attributes.push(g), g = {}), y.dumpLinkHrefsNearby?.enabled && p.tagName && !p.openingTagEnds && (p.openingTagEnds = f)), (!G || t[f] === ">") && a.lastOpeningBracketAt !== void 0) {
2289
+ if (a.quotes?.start && a.quotes.start < f && !a.quotes.end && g.nameEnds && g.equalsAt && !g.valueStarts && (g.valueStarts = f), !a.quotes && g.nameEnds && t[f] === "=" && !g.valueStarts && !g.equalsAt && (g.equalsAt = f), !a.quotes && g.nameStarts && g.nameEnds && !g.valueStarts && t[f].trim() && t[f] !== "=" && (a.attributes.push(g), g = {}), !a.quotes && g.nameStarts && !g.nameEnds && (G && `'"`.includes(t[g.nameStarts]) ? g.nameStarts < f && t[f] === t[g.nameStarts] && (g.nameEnds = f + 1, g.name = t.slice(g.nameStarts, g.nameEnds)) : t[f].trim() ? t[f] === "=" ? g.equalsAt || (g.nameEnds = f, g.equalsAt = f, g.name = t.slice(g.nameStarts, g.nameEnds)) : t[f] === "/" || P(f) ? (g.nameEnds = f, g.name = t.slice(g.nameStarts, g.nameEnds), a.attributes.push(g), g = {}) : F(f) && (g.nameEnds = f, g.name = t.slice(g.nameStarts, g.nameEnds), a.attributes.push(g), g = {}) : (g.nameEnds = f, g.name = t.slice(g.nameStarts, g.nameEnds))), !a.quotes && a.nameEnds < f && !t[f - 1].trim() && t[f].trim() && !"<>/!".includes(t[f]) && !g.nameStarts && !a.lastClosingBracketAt && (g.nameStarts = f), a.lastOpeningBracketAt !== null && a.lastOpeningBracketAt < f && t[f] === "/" && a.onlyPlausible && (a.onlyPlausible = !1), a.lastOpeningBracketAt !== null && a.lastOpeningBracketAt < f && t[f] !== "/" && (a.onlyPlausible === void 0 && ((!t[f].trim() || F(f)) && !a.slashPresent ? a.onlyPlausible = !0 : a.onlyPlausible = !1), t[f].trim() && a.nameStarts === void 0 && !F(f) && t[f] !== "/" && !P(f) && t[f] !== "!" && (a.nameStarts = f, a.nameContainsLetters = !1)), a.nameStarts && !a.quotes && typeof t[f] == "string" && t[f].toLowerCase() !== t[f].toUpperCase() && (a.nameContainsLetters = !0), P(f) && (jr(a, t, f) || a.quotes.value && typeof a.lastOpeningBracketAt == "number" && Wc(a.quotes.value, t.slice(a.lastOpeningBracketAt, f)) % 2 === 1 && !t.slice(a.lastOpeningBracketAt + 1, f).includes("<") && !t.slice(a.lastOpeningBracketAt + 1, f).includes(">")) && a.lastOpeningBracketAt !== void 0 && (a.lastClosingBracketAt = f, w = null, Object.keys(g).length && (a.attributes.push(g), g = {}), y.dumpLinkHrefsNearby?.enabled && p.tagName && !p.openingTagEnds && (p.openingTagEnds = f)), (!G || t[f] === ">") && a.lastOpeningBracketAt !== void 0) {
2290
2290
  if (a.lastClosingBracketAt === void 0) {
2291
- if (a.lastOpeningBracketAt < f && !I(f) && (t[f + 1] === void 0 || I(f + 1) && !a?.quotes?.value) && a.nameContainsLetters && typeof a.nameStarts == "number") {
2291
+ if (a.lastOpeningBracketAt < f && !F(f) && (t[f + 1] === void 0 || F(f + 1) && !a?.quotes?.value) && a.nameContainsLetters && typeof a.nameStarts == "number") {
2292
2292
  if (a.name = t.slice(a.nameStarts, a.nameEnds || f + 1).toLowerCase(), (!s.length || s[s.length - 1][0] !== a.lastOpeningBracketAt) && s.push([a.lastOpeningBracketAt, f + 1]), y.ignoreTags.includes(a.name) || X(f, y, a) || !Ve.has(a.name) && (a.onlyPlausible || y.stripRecognisedHTMLOnly)) {
2293
2293
  a = {}, g = {};
2294
2294
  continue;
2295
2295
  }
2296
2296
  if ((Ve.has(a.name) || fn.has(a.name)) && (a.onlyPlausible === !1 || a.onlyPlausible === !0 && a.attributes.length) || t[f + 1] === void 0) {
2297
- T(y);
2298
- let v = w(t, f, a.leftOuterWhitespace, f + 1, a.lastOpeningBracketAt, a.lastClosingBracketAt);
2297
+ R(y);
2298
+ let v = x(t, f, a.leftOuterWhitespace, f + 1, a.lastOpeningBracketAt, a.lastClosingBracketAt);
2299
2299
  _ && a.name === "script" && a.slashPresent && (_ = !1);
2300
2300
  let C;
2301
2301
  v === null || m === null ? C = null : C = `${v}${m}${v}`, y.cb({ tag: a, deleteFrom: a.leftOuterWhitespace, deleteTo: f + 1, insert: C, rangesArr: k, proposedReturn: [a.leftOuterWhitespace, f + 1, C] }), V(), S(f, y, k);
@@ -2309,26 +2309,26 @@ ${JSON.stringify(e, null, 4)}`);
2309
2309
  } else if (f > a.lastClosingBracketAt && t[f].trim() || t[f + 1] === void 0 || y.ignoreIndentations && `\r
2310
2310
  `.includes(t[f])) {
2311
2311
  let v = a.lastClosingBracketAt === f ? f + 1 : f;
2312
- y.trimOnlySpaces && v === q - 1 && x !== null && x < f && (v = x), (!s.length || s[s.length - 1][0] !== a.lastOpeningBracketAt) && s.push([a.lastOpeningBracketAt, a.lastClosingBracketAt + 1]);
2312
+ y.trimOnlySpaces && v === q - 1 && w !== null && w < f && (v = w), (!s.length || s[s.length - 1][0] !== a.lastOpeningBracketAt) && s.push([a.lastOpeningBracketAt, a.lastClosingBracketAt + 1]);
2313
2313
  let C = y.ignoreTags.includes(a.name), E = X(f, y, a);
2314
- if (!A || y.stripRecognisedHTMLOnly && typeof a.name == "string" && !Ve.has(a.name.toLowerCase()) && !fn.has(a.name.toLowerCase()) || !ht && (C || E) || ht && !y.onlyStripTags.includes(a.name) || y.ignoreTagsWithTheirContents.includes(a.name)) {
2314
+ if (!O || y.stripRecognisedHTMLOnly && typeof a.name == "string" && !Ve.has(a.name.toLowerCase()) && !fn.has(a.name.toLowerCase()) || !dt && (C || E) || dt && !y.onlyStripTags.includes(a.name) || y.ignoreTagsWithTheirContents.includes(a.name)) {
2315
2315
  if (E) if (a.slashPresent) {
2316
- for (let F = i.length; F--; ) if (i[F].name === a.name) {
2317
- i.splice(F, 1);
2316
+ for (let I = i.length; I--; ) if (i[I].name === a.name) {
2317
+ i.splice(I, 1);
2318
2318
  break;
2319
2319
  }
2320
- i.length || (A = !0);
2321
- } else A && (A = !1), i.push(a);
2320
+ i.length || (O = !0);
2321
+ } else O && (O = !1), i.push(a);
2322
2322
  y.cb({ tag: a, deleteFrom: null, deleteTo: null, insert: null, rangesArr: k, proposedReturn: null }), a = {}, g = {};
2323
- } else if (!a.onlyPlausible || a.attributes.length === 0 && a.name && (Ve.has(a.name.toLowerCase()) || fn.has(a.name.toLowerCase())) || a.attributes?.some((F) => F.equalsAt)) {
2323
+ } else if (!a.onlyPlausible || a.attributes.length === 0 && a.name && (Ve.has(a.name.toLowerCase()) || fn.has(a.name.toLowerCase())) || a.attributes?.some((I) => I.equalsAt)) {
2324
2324
  (!o.length || o[o.length - 1][0] !== a.lastOpeningBracketAt) && o.push([a.lastOpeningBracketAt, a.lastClosingBracketAt + 1]);
2325
- let F = w(t, f, a.leftOuterWhitespace, v, a.lastOpeningBracketAt, a.lastClosingBracketAt);
2326
- m = "", b = !1, T(y, v);
2325
+ let I = x(t, f, a.leftOuterWhitespace, v, a.lastOpeningBracketAt, a.lastClosingBracketAt);
2326
+ m = "", b = !1, R(y, v);
2327
2327
  let N;
2328
- typeof m == "string" && m.length ? (N = `${F}${m}${F === `
2328
+ typeof m == "string" && m.length ? (N = `${I}${m}${I === `
2329
2329
 
2330
2330
  ` ? `
2331
- ` : F}`, v === a.lastClosingBracketAt + 1 && (!t[v] || !gn.has(t[v])) && (N += " "), a.leftOuterWhitespace === a.lastOpeningBracketAt && k.last() && k.last()[1] < a.lastOpeningBracketAt && (!y?.dumpLinkHrefsNearby?.putOnNewLine || !gn.has(t[v])) && (N = " " + N)) : N = F, N !== null && (a.leftOuterWhitespace === 0 || !Y(t, v - 1)) && (!y.dumpLinkHrefsNearby?.enabled || a.name !== "a") && (N = void 0);
2331
+ ` : I}`, v === a.lastClosingBracketAt + 1 && (!t[v] || !gn.has(t[v])) && (N += " "), a.leftOuterWhitespace === a.lastOpeningBracketAt && k.last() && k.last()[1] < a.lastOpeningBracketAt && (!y?.dumpLinkHrefsNearby?.putOnNewLine || !gn.has(t[v])) && (N = " " + N)) : N = I, N !== null && (a.leftOuterWhitespace === 0 || !Y(t, v - 1)) && (!y.dumpLinkHrefsNearby?.enabled || a.name !== "a") && (N = void 0);
2332
2332
  let B = 0;
2333
2333
  if (b && gn.has(t[v])) {
2334
2334
  y.dumpLinkHrefsNearby?.putOnNewLine && (N = `${t[v]}${N || ""}`);
@@ -2342,10 +2342,10 @@ ${JSON.stringify(e, null, 4)}`);
2342
2342
  }
2343
2343
  G && (G = !1);
2344
2344
  }
2345
- if ((!_ || t[f] === "<" && Y(t, Y(t, f)) && t[Y(t, f)] === "/" && t.startsWith("script", Y(t, Y(t, f)))) && I(f) && !I(f - 1) && !`'"`.includes(t[f + 1]) && (!`'"`.includes(t[f + 2]) || /\w/.test(t[f + 1])) && !(t[f + 1] === "c" && t[f + 2] === ":") && !(t[f + 1] === "f" && t[f + 2] === "m" && t[f + 3] === "t" && t[f + 4] === ":") && !(t[f + 1] === "s" && t[f + 2] === "q" && t[f + 3] === "l" && t[f + 4] === ":") && !(t[f + 1] === "x" && t[f + 2] === ":") && !(t[f + 1] === "f" && t[f + 2] === "n" && t[f + 3] === ":") && Vr(a, t, f)) {
2345
+ if ((!_ || t[f] === "<" && Y(t, Y(t, f)) && t[Y(t, f)] === "/" && t.startsWith("script", Y(t, Y(t, f)))) && F(f) && !F(f - 1) && !`'"`.includes(t[f + 1]) && (!`'"`.includes(t[f + 2]) || /\w/.test(t[f + 1])) && !(t[f + 1] === "c" && t[f + 2] === ":") && !(t[f + 1] === "f" && t[f + 2] === "m" && t[f + 3] === "t" && t[f + 4] === ":") && !(t[f + 1] === "s" && t[f + 2] === "q" && t[f + 3] === "l" && t[f + 4] === ":") && !(t[f + 1] === "x" && t[f + 2] === ":") && !(t[f + 1] === "f" && t[f + 2] === "n" && t[f + 3] === ":") && jr(a, t, f)) {
2346
2346
  if (P(Y(t, f))) continue;
2347
2347
  if (a.nameEnds && a.nameEnds < f && !a.lastClosingBracketAt && (a.onlyPlausible === !0 && a.attributes?.length || a.onlyPlausible === !1)) {
2348
- let v = w(t, f, a.leftOuterWhitespace, f, a.lastOpeningBracketAt, f);
2348
+ let v = x(t, f, a.leftOuterWhitespace, f, a.lastOpeningBracketAt, f);
2349
2349
  y.cb({ tag: a, deleteFrom: a.leftOuterWhitespace, deleteTo: f, insert: v, rangesArr: k, proposedReturn: [a.leftOuterWhitespace, f, v] }), S(f, y, k), a = {}, g = {};
2350
2350
  }
2351
2351
  if (a.lastOpeningBracketAt !== void 0 && a.onlyPlausible && a.name && !a.quotes && (a.lastOpeningBracketAt = void 0, a.name = void 0, a.onlyPlausible = !1), (a.lastOpeningBracketAt === void 0 || !a.onlyPlausible) && !a.quotes && (a.lastOpeningBracketAt = f, a.slashPresent = !1, a.attributes = [], l === null ? a.leftOuterWhitespace = f : y.trimOnlySpaces && l === 0 ? a.leftOuterWhitespace = u || f : a.leftOuterWhitespace = l, `${t[f + 1]}${t[f + 2]}${t[f + 3]}` == "!--" || `${t[f + 1]}${t[f + 2]}${t[f + 3]}${t[f + 4]}${t[f + 5]}${t[f + 6]}${t[f + 7]}${t[f + 8]}` == "![CDATA[")) {
@@ -2353,16 +2353,16 @@ ${JSON.stringify(e, null, 4)}`);
2353
2353
  t[f + 2] === "-" && (v = !1);
2354
2354
  let C;
2355
2355
  for (let E = f; E < q; E++) if ((!C && v && `${t[E - 2]}${t[E - 1]}${t[E]}` == "]]>" || !v && `${t[E - 2]}${t[E - 1]}${t[E]}` == "-->") && (C = E), C && (C < E && t[E].trim() || t[E + 1] === void 0)) {
2356
- let F = E;
2357
- (t[E + 1] === void 0 && !t[E].trim() || t[E] === ">") && (F += 1), (!s.length || s[s.length - 1][0] !== a.lastOpeningBracketAt) && s.push([a.lastOpeningBracketAt, C + 1]), (!o.length || o[o.length - 1][0] !== a.lastOpeningBracketAt) && o.push([a.lastOpeningBracketAt, C + 1]);
2358
- let N = w(t, E, a.leftOuterWhitespace, F, a.lastOpeningBracketAt, C);
2359
- y.cb({ tag: a, deleteFrom: a.leftOuterWhitespace, deleteTo: F, insert: N, rangesArr: k, proposedReturn: [a.leftOuterWhitespace, F, N] }), f = E - 1, t[E] === ">" && (f = E), a = {}, g = {};
2356
+ let I = E;
2357
+ (t[E + 1] === void 0 && !t[E].trim() || t[E] === ">") && (I += 1), (!s.length || s[s.length - 1][0] !== a.lastOpeningBracketAt) && s.push([a.lastOpeningBracketAt, C + 1]), (!o.length || o[o.length - 1][0] !== a.lastOpeningBracketAt) && o.push([a.lastOpeningBracketAt, C + 1]);
2358
+ let N = x(t, E, a.leftOuterWhitespace, I, a.lastOpeningBracketAt, C);
2359
+ y.cb({ tag: a, deleteFrom: a.leftOuterWhitespace, deleteTo: I, insert: N, rangesArr: k, proposedReturn: [a.leftOuterWhitespace, I, N] }), f = E - 1, t[E] === ">" && (f = E), a = {}, g = {};
2360
2360
  break;
2361
2361
  }
2362
2362
  }
2363
2363
  }
2364
2364
  !t[f].trim() || t[f].charCodeAt(0) === 847 ? (l === null && (l = f, a.lastOpeningBracketAt !== void 0 && a.lastOpeningBracketAt < f && a.nameStarts && a.nameStarts < a.lastOpeningBracketAt && f === a.lastOpeningBracketAt + 1 && !r.some((v) => v.name === a.name) && (a.onlyPlausible = !0, a.name = void 0, a.nameStarts = void 0)), (t[f] === `
2365
- ` || t[f] === "\r") && (h = f, d && (d = !1))) : (l !== null && (!a.quotes && g.equalsAt > l - 1 && g.nameEnds && g.equalsAt > g.nameEnds && t[f] !== '"' && t[f] !== "'" && (In(g) && a.attributes.push(g), g = {}, a.equalsSpottedAt = void 0), l = null), d || (d = !0, A && !_ && typeof h == "number" && f && h < f - 1 && (t.slice(h + 1, f).trim() ? h = null : y.ignoreIndentations || k.push([h + 1, f])))), t[f] === " " ? u === null && (u = f) : u !== null && (u = null), a.name === "script" && (_ = !a.slashPresent);
2365
+ ` || t[f] === "\r") && (h = f, d && (d = !1))) : (l !== null && (!a.quotes && g.equalsAt > l - 1 && g.nameEnds && g.equalsAt > g.nameEnds && t[f] !== '"' && t[f] !== "'" && (In(g) && a.attributes.push(g), g = {}, a.equalsSpottedAt = void 0), l = null), d || (d = !0, O && !_ && typeof h == "number" && f && h < f - 1 && (t.slice(h + 1, f).trim() ? h = null : y.ignoreIndentations || k.push([h + 1, f])))), t[f] === " " ? u === null && (u = f) : u !== null && (u = null), a.name === "script" && (_ = !a.slashPresent);
2366
2366
  }
2367
2367
  if (t && !y.ignoreIndentations && (y.trimOnlySpaces && t[0] === " " || !y.trimOnlySpaces && !t[0].trim())) for (let f = 0; f < q; f++) if (y.trimOnlySpaces && t[f] !== " " || !y.trimOnlySpaces && t[f].trim()) {
2368
2368
  k.push([0, f]);
@@ -2383,7 +2383,7 @@ ${JSON.stringify(e, null, 4)}`);
2383
2383
  }
2384
2384
  return { log: { timeTakenInMilliseconds: Date.now() - n }, result: qc(t, k.current()), ranges: k.current(), allTagLocations: s, filteredTagLocations: o };
2385
2385
  }
2386
- class Wr {
2386
+ class Hr {
2387
2387
  speechSynthesis;
2388
2388
  speechSynthesisUtterance;
2389
2389
  currentVoice = null;
@@ -2530,7 +2530,7 @@ class Wr {
2530
2530
  }
2531
2531
  // Queue Management
2532
2532
  loadUtterances(e, n) {
2533
- this.currentUtterances = this.toPlainText(e), this.currentUtteranceIndex = Ct(n ?? 0, e.length), this.warmLanguageVoiceCache(this.currentUtterances), this.playbackState = "ready", this.emitEvent({ type: "ready" });
2533
+ this.currentUtterances = this.toPlainText(e), this.currentUtteranceIndex = kt(n ?? 0, e.length), this.warmLanguageVoiceCache(this.currentUtterances), this.playbackState = "ready", this.emitEvent({ type: "ready" });
2534
2534
  }
2535
2535
  // Voice Configuration
2536
2536
  async setVoice(e) {
@@ -2722,16 +2722,16 @@ class Wr {
2722
2722
  this.stop(), this.stopResumeInfinity(), this.events.clear(), this.currentUtterances = [], this.currentVoice = null, this.voices = [], this.defaultVoice = null, this.languageVoiceCache.clear(), this.warmingLanguages.clear(), this.initialized = !1;
2723
2723
  }
2724
2724
  }
2725
- class Xg {
2725
+ class Yg {
2726
2726
  id = "webspeech";
2727
2727
  name = "Web Speech API";
2728
2728
  voiceEngine = null;
2729
2729
  // No cache to bypass here — local API, no network cost to re-checking.
2730
2730
  async getVoices() {
2731
- return this.voiceEngine || (this.voiceEngine = new Wr(), await this.voiceEngine.initialize()), this.voiceEngine.getAvailableVoices();
2731
+ return this.voiceEngine || (this.voiceEngine = new Hr(), await this.voiceEngine.initialize()), this.voiceEngine.getAvailableVoices();
2732
2732
  }
2733
2733
  async createEngine(e) {
2734
- const n = new Wr();
2734
+ const n = new Hr();
2735
2735
  return await n.initialize(), e && await n.setVoice(e), n;
2736
2736
  }
2737
2737
  async destroy() {
@@ -2853,7 +2853,7 @@ function ps(t, e) {
2853
2853
  controls: e
2854
2854
  };
2855
2855
  }
2856
- class nt extends Error {
2856
+ class rt extends Error {
2857
2857
  status;
2858
2858
  type;
2859
2859
  title;
@@ -2862,7 +2862,7 @@ class nt extends Error {
2862
2862
  super(e), this.name = "SpeechServerError", this.status = n.status, this.type = n.type, this.title = n.title, this.instance = n.instance;
2863
2863
  }
2864
2864
  }
2865
- class ms extends nt {
2865
+ class ms extends rt {
2866
2866
  constructor(e) {
2867
2867
  super(e, { status: 408, type: "https://readium.org/speech-server/error#stall", title: "Synthesis Stalled" }), this.name = "SpeechServerStallError";
2868
2868
  }
@@ -2881,7 +2881,7 @@ async function Ye(t) {
2881
2881
  if ((t.headers.get("content-type") ?? "").includes("application/problem+json"))
2882
2882
  try {
2883
2883
  const n = await t.json();
2884
- return new nt(n.detail || n.title || `Request failed with status ${t.status}`, {
2884
+ return new rt(n.detail || n.title || `Request failed with status ${t.status}`, {
2885
2885
  status: n.status ?? t.status,
2886
2886
  type: n.type,
2887
2887
  title: n.title,
@@ -2889,7 +2889,7 @@ async function Ye(t) {
2889
2889
  });
2890
2890
  } catch {
2891
2891
  }
2892
- return new nt(`Request failed with status ${t.status}`, { status: t.status });
2892
+ return new rt(`Request failed with status ${t.status}`, { status: t.status });
2893
2893
  }
2894
2894
  const uu = 3, hu = 400;
2895
2895
  function du(t) {
@@ -2901,11 +2901,11 @@ function du(t) {
2901
2901
  function fu(t) {
2902
2902
  return pe(t, 0.25, 4, 1);
2903
2903
  }
2904
- function ft(t) {
2904
+ function gt(t) {
2905
2905
  return t?.plain ?? t?.ssml ?? void 0;
2906
2906
  }
2907
- function Gr(t) {
2908
- return t instanceof ms ? { message: t.message, status: t.status, type: t.type, title: t.title, instance: t.instance, recoverable: !0 } : t instanceof nt ? { message: t.message, status: t.status, type: t.type, title: t.title, instance: t.instance, recoverable: !1 } : t instanceof ys ? { message: t.message, recoverable: !1 } : t instanceof bs ? { message: t.message, recoverable: !0 } : t instanceof Error ? { message: t.message, recoverable: !1 } : { message: String(t), recoverable: !1 };
2907
+ function Wr(t) {
2908
+ return t instanceof ms ? { message: t.message, status: t.status, type: t.type, title: t.title, instance: t.instance, recoverable: !0 } : t instanceof rt ? { message: t.message, status: t.status, type: t.type, title: t.title, instance: t.instance, recoverable: !1 } : t instanceof ys ? { message: t.message, recoverable: !1 } : t instanceof bs ? { message: t.message, recoverable: !0 } : t instanceof Error ? { message: t.message, recoverable: !1 } : { message: String(t), recoverable: !1 };
2909
2909
  }
2910
2910
  class gu {
2911
2911
  endpoints;
@@ -2962,13 +2962,13 @@ class gu {
2962
2962
  }
2963
2963
  }
2964
2964
  loadUtterances(e, n) {
2965
- this.abortLiveControllers(), this.clearPrefetchCache(), this.currentUtterances = e, this.currentUtteranceIndex = Ct(n ?? 0, e.length), this.setState("loading"), this.bufferUntilReady(++this.loadGeneration);
2965
+ this.abortLiveControllers(), this.clearPrefetchCache(), this.currentUtterances = e, this.currentUtteranceIndex = kt(n ?? 0, e.length), this.setState("loading"), this.bufferUntilReady(++this.loadGeneration);
2966
2966
  }
2967
2967
  // Buffers enough utterances ahead of currentUtteranceIndex to cover readyBufferChars before
2968
2968
  // declaring "ready", so playback doesn't catch up to an empty prefetch cache right away —
2969
2969
  // starting from wherever playback will actually resume, not always utterance 0.
2970
2970
  async bufferUntilReady(e) {
2971
- const n = Ct(this.currentUtteranceIndex, this.currentUtterances.length), r = Math.min(this.indexCoveringChars(this.readyBufferChars, n), n + this.prefetchWindow), i = [];
2971
+ const n = kt(this.currentUtteranceIndex, this.currentUtterances.length), r = Math.min(this.indexCoveringChars(this.readyBufferChars, n), n + this.prefetchWindow), i = [];
2972
2972
  for (let s = n; s <= r; s++) {
2973
2973
  this.queuePrefetch(s);
2974
2974
  const o = this.prefetchCache.get(s);
@@ -2983,10 +2983,10 @@ class gu {
2983
2983
  indexCoveringChars(e, n) {
2984
2984
  if (this.currentUtterances.length === 0)
2985
2985
  return -1;
2986
- const r = Ct(n, this.currentUtterances.length);
2986
+ const r = kt(n, this.currentUtterances.length);
2987
2987
  let i = 0;
2988
2988
  for (let s = r; s < this.currentUtterances.length; s++)
2989
- if (i += (ft(this.currentUtterances[s]) ?? "").length, i >= e)
2989
+ if (i += (gt(this.currentUtterances[s]) ?? "").length, i >= e)
2990
2990
  return s;
2991
2991
  return this.currentUtterances.length - 1;
2992
2992
  }
@@ -3068,7 +3068,7 @@ class gu {
3068
3068
  return;
3069
3069
  this.isSpeakingInternal = !1, this.setState("idle"), this.emitEvent({
3070
3070
  type: "error",
3071
- detail: Gr(r)
3071
+ detail: Wr(r)
3072
3072
  });
3073
3073
  }
3074
3074
  }
@@ -3115,13 +3115,13 @@ class gu {
3115
3115
  this.liveControllers.forEach((e) => e.abort()), this.liveControllers.clear();
3116
3116
  }
3117
3117
  async synthesizeStream(e, n) {
3118
- const r = this.currentUtterances[e], i = !r.plain && !!r.ssml, s = this.speakInContentLanguage ? r.language : void 0, o = ft(r) ?? "", a = ft(this.currentUtterances[e - 1]), c = ft(this.currentUtterances[e + 1]), l = await this.getServiceInfo(), u = au(l.output, this.formatOptions, this.canPlayType), h = navigator.connection, d = cu(u, this.formatOptions.adaptBitrateToNetwork ?? !1, h);
3118
+ const r = this.currentUtterances[e], i = !r.plain && !!r.ssml, s = this.speakInContentLanguage ? r.language : void 0, o = gt(r) ?? "", a = gt(this.currentUtterances[e - 1]), c = gt(this.currentUtterances[e + 1]), l = await this.getServiceInfo(), u = au(l.output, this.formatOptions, this.canPlayType), h = navigator.connection, d = cu(u, this.formatOptions.adaptBitrateToNetwork ?? !1, h);
3119
3119
  if (o.length <= l.limits.maxTextLength) {
3120
- const x = new AbortController();
3121
- return (n ? this.activeControllers : this.liveControllers).add(x), [{ promise: this.synthesizeChunk(r, o, 0, i, s, a, c, u, d, x), controller: x }];
3120
+ const w = new AbortController();
3121
+ return (n ? this.activeControllers : this.liveControllers).add(w), [{ promise: this.synthesizeChunk(r, o, 0, i, s, a, c, u, d, w), controller: w }];
3122
3122
  }
3123
3123
  if (this.overLengthText === "error")
3124
- throw new nt(
3124
+ throw new rt(
3125
3125
  `Text exceeds this server's maximum length of ${l.limits.maxTextLength} characters`,
3126
3126
  {
3127
3127
  status: 413,
@@ -3131,13 +3131,13 @@ class gu {
3131
3131
  );
3132
3132
  const g = Math.min(l.limits.maxTextLength, this.readyBufferChars), p = i ? tu(o, g) : Zc(o, g), m = [];
3133
3133
  let b = Promise.resolve();
3134
- for (let x = 0; x < p.length; x++) {
3135
- const A = x === 0 ? a : p[x - 1].text, S = x === p.length - 1 ? c : p[x + 1].text, w = p[x], T = new AbortController();
3136
- (n ? this.activeControllers : this.liveControllers).add(T);
3137
- const I = b.then(
3138
- () => this.synthesizeChunk(r, w.text, w.offset, i, s, A, S, u, d, T)
3134
+ for (let w = 0; w < p.length; w++) {
3135
+ const O = w === 0 ? a : p[w - 1].text, S = w === p.length - 1 ? c : p[w + 1].text, x = p[w], R = new AbortController();
3136
+ (n ? this.activeControllers : this.liveControllers).add(R);
3137
+ const F = b.then(
3138
+ () => this.synthesizeChunk(r, x.text, x.offset, i, s, O, S, u, d, R)
3139
3139
  );
3140
- m.push({ promise: I, controller: T }), b = I;
3140
+ m.push({ promise: F, controller: R }), b = F;
3141
3141
  }
3142
3142
  return m;
3143
3143
  }
@@ -3218,7 +3218,7 @@ class gu {
3218
3218
  const g = Math.max(0, (c - i.currentTime) * 1e3);
3219
3219
  d = await this.awaitWithStallDeadline(e[h].promise, e[h].controller, g);
3220
3220
  } catch (g) {
3221
- n === this.speakGeneration && this.emitEvent({ type: "error", detail: Gr(g) });
3221
+ n === this.speakGeneration && this.emitEvent({ type: "error", detail: Wr(g) });
3222
3222
  return;
3223
3223
  }
3224
3224
  if (n !== this.speakGeneration)
@@ -3354,7 +3354,7 @@ class gu {
3354
3354
  this.stop(), await this.audioContext?.close(), this.audioContext = null, this.masterGain = null, this.events.clear(), this.currentUtterances = [], this.currentVoice = null, this.voices = [];
3355
3355
  }
3356
3356
  }
3357
- class Yg {
3357
+ class Qg {
3358
3358
  id = "speech-server";
3359
3359
  name = "Readium Speech Server";
3360
3360
  options;
@@ -3640,7 +3640,7 @@ class bu {
3640
3640
  this.teardownEpoch++, this.healthCheckTimer !== null && (clearTimeout(this.healthCheckTimer), this.healthCheckTimer = null), this.unbindActiveEngine?.(), this.events.clear(), await this.activeEngine.destroy();
3641
3641
  }
3642
3642
  }
3643
- class Qg {
3643
+ class Zg {
3644
3644
  id = "fallback";
3645
3645
  name = "Fallback";
3646
3646
  primary;
@@ -3697,7 +3697,7 @@ function xe(t) {
3697
3697
  return e ? new DOMRect(d, h, p, g) : new DOMRect(h, d, g, p);
3698
3698
  } };
3699
3699
  }
3700
- function Kr(t, e) {
3700
+ function Gr(t, e) {
3701
3701
  return t.document.documentElement.style.getPropertyValue(e);
3702
3702
  }
3703
3703
  function xu(t) {
@@ -3706,11 +3706,11 @@ function xu(t) {
3706
3706
  function Eu(t) {
3707
3707
  return t && typeof t == "string" ? [t] : xu(t);
3708
3708
  }
3709
- function kt(t) {
3709
+ function Ot(t) {
3710
3710
  return isNaN(t) ? void 0 : t;
3711
3711
  }
3712
3712
  function pn(t) {
3713
- return kt(t) !== void 0 && Math.sign(t) >= 0 ? t : void 0;
3713
+ return Ot(t) !== void 0 && Math.sign(t) >= 0 ? t : void 0;
3714
3714
  }
3715
3715
  let It = class Ss {
3716
3716
  constructor(e) {
@@ -3740,26 +3740,26 @@ let It = class Ss {
3740
3740
  const e = { start: this.start.serialize() };
3741
3741
  return this.end && (e.end = this.end.serialize()), e;
3742
3742
  }
3743
- }, gt = null, mn = null, Me = 0;
3743
+ }, pt = null, mn = null, Me = 0;
3744
3744
  const Oe = { r: 255, g: 255, b: 255, a: 1 }, Ee = /* @__PURE__ */ new Map(), Cu = () => {
3745
- if (!gt) if (typeof OffscreenCanvas < "u") gt = new OffscreenCanvas(5, 5), mn = gt.getContext("2d", { willReadFrequently: !0, desynchronized: !0 });
3745
+ if (!pt) if (typeof OffscreenCanvas < "u") pt = new OffscreenCanvas(5, 5), mn = pt.getContext("2d", { willReadFrequently: !0, desynchronized: !0 });
3746
3746
  else {
3747
3747
  const t = document.createElement("canvas");
3748
- t.width = 5, t.height = 5, gt = t, mn = t.getContext("2d", { willReadFrequently: !0, desynchronized: !0 });
3748
+ t.width = 5, t.height = 5, pt = t, mn = t.getContext("2d", { willReadFrequently: !0, desynchronized: !0 });
3749
3749
  }
3750
3750
  return mn;
3751
3751
  }, ku = (t) => {
3752
3752
  if (!t) return !0;
3753
3753
  const e = t.trim().toLowerCase();
3754
3754
  return e.startsWith("var(") || ["transparent", "currentcolor", "inherit", "initial", "revert", "unset", "revert-layer"].includes(e) ? !0 : ["linear-gradient", "radial-gradient", "conic-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "repeating-conic-gradient"].some((n) => e.includes(n));
3755
- }, pt = (t, e) => {
3755
+ }, mt = (t, e) => {
3756
3756
  console.warn(`[Decorator] Could not parse color: "${t}". ${e} Falling back to ${JSON.stringify(Oe)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`);
3757
3757
  }, ye = (t, e = null) => {
3758
3758
  const n = e ? `${t}|${e}` : t, r = Ee.get(n);
3759
3759
  if (r !== void 0) return r ?? Oe;
3760
- if (ku(t)) return pt(t, "Unsupported color format or special value."), Ee.set(n, null), Oe;
3760
+ if (ku(t)) return mt(t, "Unsupported color format or special value."), Ee.set(n, null), Oe;
3761
3761
  const i = Cu();
3762
- if (!i) return pt(t, "Could not get canvas context."), Ee.set(n, null), Oe;
3762
+ if (!i) return mt(t, "Could not get canvas context."), Ee.set(n, null), Oe;
3763
3763
  try {
3764
3764
  Me === 0 && i.clearRect(0, 0, 5, 5);
3765
3765
  const s = Me % 5, o = Math.floor(Me / 5);
@@ -3767,11 +3767,11 @@ const Oe = { r: 255, g: 255, b: 255, a: 1 }, Ee = /* @__PURE__ */ new Map(), Cu
3767
3767
  const a = i.getImageData(s, o, 1, 1);
3768
3768
  Me = (Me + 1) % 25;
3769
3769
  const [c, l, u, h] = a.data;
3770
- if (h === 0) return pt(t, "Fully transparent color."), Ee.set(n, null), Oe;
3770
+ if (h === 0) return mt(t, "Fully transparent color."), Ee.set(n, null), Oe;
3771
3771
  const d = { r: c, g: l, b: u, a: h / 255 };
3772
3772
  return Ee.set(n, d), d;
3773
3773
  } catch (s) {
3774
- return pt(t, `Error: ${s instanceof Error ? s.message : String(s)}`), Ee.set(n, null), Oe;
3774
+ return mt(t, `Error: ${s instanceof Error ? s.message : String(s)}`), Ee.set(n, null), Oe;
3775
3775
  }
3776
3776
  }, yn = (t) => {
3777
3777
  const e = t / 255;
@@ -3785,7 +3785,7 @@ const Oe = { r: 255, g: 255, b: 255, a: 1 }, Ee = /* @__PURE__ */ new Map(), Cu
3785
3785
  }, xs = (t, e = null) => {
3786
3786
  const n = ye(t, e), r = Ft(n, { r: 255, g: 255, b: 255, a: 1 }), i = Ft(n, { r: 0, g: 0, b: 0, a: 1 });
3787
3787
  return r > i;
3788
- }, Jr = (t, e = null) => xs(t, e) ? "white" : "black", Ou = (t) => {
3788
+ }, Kr = (t, e = null) => xs(t, e) ? "white" : "black", Ou = (t) => {
3789
3789
  const e = t.a !== void 0 ? t.a : 1;
3790
3790
  return `rgba(${Math.round(t.r)}, ${Math.round(t.g)}, ${Math.round(t.b)}, ${e})`;
3791
3791
  }, Au = (t, e) => ({ r: Math.min(255, t.r + (255 - t.r) * e), g: Math.min(255, t.g + (255 - t.g) * e), b: Math.min(255, t.b + (255 - t.b) * e), a: t.a ?? 1 }), Tu = (t, e) => ({ r: Math.max(0, t.r * (1 - e)), g: Math.max(0, t.g * (1 - e)), b: Math.max(0, t.b * (1 - e)), a: t.a ?? 1 }), Ce = (t, e = null, n = 3) => {
@@ -3839,12 +3839,12 @@ let ks = class {
3839
3839
  };
3840
3840
  const Nu = new ks();
3841
3841
  new Ru();
3842
- const Xr = ":~:text=";
3842
+ const Jr = ":~:text=";
3843
3843
  function Du(t) {
3844
3844
  if (!t) return;
3845
- const e = t.indexOf(Xr);
3845
+ const e = t.indexOf(Jr);
3846
3846
  if (e === -1) return;
3847
- const n = t.slice(e + Xr.length).split("&")[0];
3847
+ const n = t.slice(e + Jr.length).split("&")[0];
3848
3848
  if (n) try {
3849
3849
  let r = n.split(",");
3850
3850
  const i = { textStart: "" };
@@ -3860,13 +3860,13 @@ const Os = ["ADDRESS", "ARTICLE", "ASIDE", "BLOCKQUOTE", "BR", "DETAILS", "DIALO
3860
3860
  if (t.prefix) {
3861
3861
  const o = Je(t.prefix, i);
3862
3862
  if (o == null) break;
3863
- mt(i, o.startContainer, o.startOffset);
3863
+ yt(i, o.startContainer, o.startOffset);
3864
3864
  const a = e.createRange();
3865
3865
  if (a.setStart(o.endContainer, o.endOffset), a.setEnd(i.endContainer, i.endOffset), Ts(a), a.collapsed || (s = Je(t.textStart, a), s == null)) break;
3866
3866
  if (s.compareBoundaryPoints(Range.START_TO_START, a) !== 0) continue;
3867
3867
  } else {
3868
3868
  if (s = Je(t.textStart, i), s == null) break;
3869
- mt(i, s.startContainer, s.startOffset);
3869
+ yt(i, s.startContainer, s.startOffset);
3870
3870
  }
3871
3871
  if (t.textEnd) {
3872
3872
  const o = e.createRange();
@@ -3875,8 +3875,8 @@ const Os = ["ADDRESS", "ARTICLE", "ASIDE", "BLOCKQUOTE", "BR", "DETAILS", "DIALO
3875
3875
  for (; !o.collapsed && r.length < 2; ) {
3876
3876
  const c = Je(t.textEnd, o);
3877
3877
  if (c == null) break;
3878
- if (mt(o, c.startContainer, c.startOffset), s.setEnd(c.endContainer, c.endOffset), t.suffix) {
3879
- const l = Yr(t.suffix, s, i, e);
3878
+ if (yt(o, c.startContainer, c.startOffset), s.setEnd(c.endContainer, c.endOffset), t.suffix) {
3879
+ const l = Xr(t.suffix, s, i, e);
3880
3880
  if (l === te.NO_SUFFIX_MATCH) break;
3881
3881
  if (l === te.SUFFIX_MATCH) {
3882
3882
  a = !0, r.push(s.cloneRange());
@@ -3886,21 +3886,21 @@ const Os = ["ADDRESS", "ARTICLE", "ASIDE", "BLOCKQUOTE", "BR", "DETAILS", "DIALO
3886
3886
  }
3887
3887
  if (!a) break;
3888
3888
  } else if (t.suffix) {
3889
- const o = Yr(t.suffix, s, i, e);
3889
+ const o = Xr(t.suffix, s, i, e);
3890
3890
  if (o === te.NO_SUFFIX_MATCH) break;
3891
3891
  if (o === te.SUFFIX_MATCH) {
3892
- r.push(s.cloneRange()), mt(i, i.startContainer, i.startOffset);
3892
+ r.push(s.cloneRange()), yt(i, i.startContainer, i.startOffset);
3893
3893
  continue;
3894
3894
  } else if (o === te.MISPLACED_SUFFIX) continue;
3895
3895
  } else r.push(s.cloneRange());
3896
3896
  }
3897
3897
  return r;
3898
- }, te = { NO_SUFFIX_MATCH: 0, SUFFIX_MATCH: 1, MISPLACED_SUFFIX: 2 }, Yr = (t, e, n, r) => {
3898
+ }, te = { NO_SUFFIX_MATCH: 0, SUFFIX_MATCH: 1, MISPLACED_SUFFIX: 2 }, Xr = (t, e, n, r) => {
3899
3899
  const i = r.createRange();
3900
3900
  i.setStart(e.endContainer, e.endOffset), i.setEnd(n.endContainer, n.endOffset), Ts(i);
3901
3901
  const s = Je(t, i);
3902
3902
  return s == null ? te.NO_SUFFIX_MATCH : s.compareBoundaryPoints(Range.START_TO_START, i) !== 0 ? te.MISPLACED_SUFFIX : te.SUFFIX_MATCH;
3903
- }, mt = (t, e, n) => {
3903
+ }, yt = (t, e, n) => {
3904
3904
  try {
3905
3905
  t.setStart(e, n + 1);
3906
3906
  } catch {
@@ -3953,14 +3953,14 @@ const Je = (t, e) => {
3953
3953
  }
3954
3954
  }, Bu = (t, e, n, r) => {
3955
3955
  if (!t || !e || !(n || []).length) return;
3956
- const i = n[0] === e.startContainer ? e.startOffset : 0, s = ae($u(n, i, void 0)), o = ae(t);
3956
+ const i = n[0] === e.startContainer ? e.startOffset : 0, s = oe($u(n, i, void 0)), o = oe(t);
3957
3957
  let a = 0, c, l;
3958
3958
  for (; a < s.length; ) {
3959
3959
  const u = s.indexOf(o, a);
3960
3960
  if (u === -1) return;
3961
3961
  if (Uu(s, u, o.length, r)) {
3962
- const h = ae(n[0].data.slice(0, i)).length;
3963
- c = Qr(h + u, n, !1), l = Qr(h + u + o.length, n, !0);
3962
+ const h = oe(n[0].data.slice(0, i)).length;
3963
+ c = Yr(h + u, n, !1), l = Yr(h + u + o.length, n, !0);
3964
3964
  }
3965
3965
  if (c != null && l != null) {
3966
3966
  const h = new Range();
@@ -3968,25 +3968,25 @@ const Je = (t, e) => {
3968
3968
  }
3969
3969
  a = u + 1;
3970
3970
  }
3971
- }, Qr = (t, e, n) => {
3971
+ }, Yr = (t, e, n) => {
3972
3972
  let r = 0, i;
3973
3973
  for (let s = 0; s < e.length; s++) {
3974
3974
  const o = e[s];
3975
- i || (i = ae(o.data));
3975
+ i || (i = oe(o.data));
3976
3976
  let a = r + i.length;
3977
3977
  if (n && (a += 1), a > t) {
3978
3978
  const c = t - r;
3979
3979
  let l = Math.min(t - r, o.data.length);
3980
3980
  const u = n ? i.substring(0, c) : i.substring(c);
3981
- let h = ae(n ? o.data.substring(0, l) : o.data.substring(l));
3981
+ let h = oe(n ? o.data.substring(0, l) : o.data.substring(l));
3982
3982
  const d = (n ? -1 : 1) * (u.length > h.length ? -1 : 1);
3983
3983
  for (; l >= 0 && l <= o.data.length; ) {
3984
3984
  if (h.length === u.length) return { node: o, offset: l };
3985
- l += d, h = ae(n ? o.data.substring(0, l) : o.data.substring(l));
3985
+ l += d, h = oe(n ? o.data.substring(0, l) : o.data.substring(l));
3986
3986
  }
3987
3987
  }
3988
3988
  if (r += i.length, s + 1 < e.length) {
3989
- const c = ae(e[s + 1].data);
3989
+ const c = oe(e[s + 1].data);
3990
3990
  i.slice(-1) === " " && c.slice(0, 1) === " " && (r -= 1), i = c;
3991
3991
  }
3992
3992
  }
@@ -3999,7 +3999,7 @@ const Je = (t, e) => {
3999
3999
  if (a && a.isWordLike && a.index != o) return !1;
4000
4000
  } else if (t[e].match(Ke) && (++e, --n, !n) || t[e + n - 1].match(Ke) && (--n, !n) || e !== 0 && !t[e - 1].match(Ke) || e + n !== t.length && !t[e + n].match(Ke)) return !1;
4001
4001
  return !0;
4002
- }, ae = (t) => (t || "").normalize("NFKD").replace(/\s+/g, " ").replace(/[\u0300-\u036f]/g, "").toLowerCase(), Ds = (t) => {
4002
+ }, oe = (t) => (t || "").normalize("NFKD").replace(/\s+/g, " ").replace(/[\u0300-\u036f]/g, "").toLowerCase(), Ds = (t) => {
4003
4003
  if (Intl.Segmenter) {
4004
4004
  const e = t?.documentElement?.lang || t?.defaultView?.navigator?.language || void 0;
4005
4005
  return new Intl.Segmenter(e, { granularity: "word" });
@@ -4022,54 +4022,54 @@ const Je = (t, e) => {
4022
4022
  if (n !== null) return n;
4023
4023
  const r = t.parentNode();
4024
4024
  return r !== null && e.add(r), r;
4025
- }, D = { BLOCK_ELEMENTS: Os, BOUNDARY_CHARS: Ke, NON_BOUNDARY_CHARS: Iu, acceptNodeIfVisibleInRange: Ns, normalizeString: ae, makeNewSegmenter: Ds, forwardTraverse: Is, backwardTraverse: qu, makeTextNodeWalker: Rs, isNodeVisible: ar }, zu = 300, Fs = 20, ju = 1, Zr = 3, ei = 1;
4025
+ }, D = { BLOCK_ELEMENTS: Os, BOUNDARY_CHARS: Ke, NON_BOUNDARY_CHARS: Iu, acceptNodeIfVisibleInRange: Ns, normalizeString: oe, makeNewSegmenter: Ds, forwardTraverse: Is, backwardTraverse: qu, makeTextNodeWalker: Rs, isNodeVisible: ar }, zu = 300, Fs = 20, ju = 1, Qr = 3, Zr = 1;
4026
4026
  let Vu = 500, Ls;
4027
4027
  class Ps extends Error {
4028
4028
  constructor() {
4029
4029
  super(...arguments), this.isTimeout = !0;
4030
4030
  }
4031
4031
  }
4032
- const he = { SUCCESS: 0, INVALID_SELECTION: 1, AMBIGUOUS: 2, TIMEOUT: 3, EXECUTION_FAILED: 4 }, Mu = (t, e = Date.now()) => {
4032
+ const de = { SUCCESS: 0, INVALID_SELECTION: 1, AMBIGUOUS: 2, TIMEOUT: 3, EXECUTION_FAILED: 4 }, Mu = (t, e = Date.now()) => {
4033
4033
  try {
4034
4034
  return Hu(t, e);
4035
4035
  } catch (n) {
4036
- return n instanceof Ps ? { status: he.TIMEOUT } : { status: he.EXECUTION_FAILED };
4036
+ return n instanceof Ps ? { status: de.TIMEOUT } : { status: de.EXECUTION_FAILED };
4037
4037
  }
4038
4038
  }, Hu = (t, e) => {
4039
4039
  Gu(e);
4040
4040
  const n = t.startContainer.ownerDocument, r = Wu(n);
4041
4041
  eh(t), rh(t);
4042
4042
  const i = t.cloneRange();
4043
- if (th(t), t.collapsed) return { status: he.INVALID_SELECTION };
4043
+ if (th(t), t.collapsed) return { status: de.INVALID_SELECTION };
4044
4044
  let s;
4045
4045
  if (Ju(t)) {
4046
4046
  const h = D.normalizeString(t.toString()), d = { textStart: h };
4047
- if (h.length >= Fs && _s(d, n, r)) return { status: he.SUCCESS, fragment: d };
4047
+ if (h.length >= Fs && _s(d, n, r)) return { status: de.SUCCESS, fragment: d };
4048
4048
  s = new bn(n, r).setExactTextMatch(h);
4049
4049
  } else {
4050
- const h = ti(t), d = ni(t);
4050
+ const h = ei(t), d = ti(t);
4051
4051
  h && d ? s = new bn(n, r).setStartAndEndSearchSpace(h, d) : s = new bn(n, r).setSharedSearchSpace(t.toString().trim());
4052
4052
  }
4053
4053
  const o = n.createRange();
4054
4054
  o.selectNodeContents(r);
4055
4055
  const a = o.cloneRange();
4056
4056
  o.setEnd(i.startContainer, i.startOffset), a.setStart(i.endContainer, i.endOffset);
4057
- const c = ni(o), l = ti(a);
4057
+ const c = ti(o), l = ei(a);
4058
4058
  (c || l) && s.setPrefixAndSuffixSearchSpace(c, l), s.useSegmenter(D.makeNewSegmenter(n));
4059
4059
  let u = !1;
4060
4060
  do {
4061
4061
  M(), u = s.embiggen();
4062
4062
  const h = s.tryToMakeUniqueFragment();
4063
- if (h != null) return { status: he.SUCCESS, fragment: h };
4063
+ if (h != null) return { status: de.SUCCESS, fragment: h };
4064
4064
  } while (u);
4065
- return { status: he.AMBIGUOUS };
4065
+ return { status: de.AMBIGUOUS };
4066
4066
  }, Wu = (t) => t.querySelector("body") ?? t.documentElement, M = () => {
4067
4067
  const t = Date.now() - Ls;
4068
4068
  if (t > Vu) throw new Ps(`Fragment generation timed out after ${t} ms.`);
4069
4069
  }, Gu = (t) => {
4070
4070
  Ls = t;
4071
- }, ti = (t) => {
4072
- let e = lt(t);
4071
+ }, ei = (t) => {
4072
+ let e = ct(t);
4073
4073
  const n = be(e, t.endContainer);
4074
4074
  if (!n) return;
4075
4075
  const r = /* @__PURE__ */ new Set();
@@ -4079,7 +4079,7 @@ const he = { SUCCESS: 0, INVALID_SELECTION: 1, AMBIGUOUS: 2, TIMEOUT: 3, EXECUTI
4079
4079
  if (M(), e.contains?.(i) ? o.setStartAfter(e) : o.setStartBefore(e), s.appendNode(e), s.textInBlock !== null) return s.textInBlock;
4080
4080
  e = D.forwardTraverse(n, r);
4081
4081
  }
4082
- }, ni = (t) => {
4082
+ }, ti = (t) => {
4083
4083
  let e = Qt(t);
4084
4084
  const n = be(e, t.startContainer);
4085
4085
  if (!n) return;
@@ -4169,25 +4169,25 @@ let bn = class {
4169
4169
  return this.numIterations++, e || n;
4170
4170
  }
4171
4171
  setStartAndEndSearchSpace(e, n) {
4172
- return this.startSearchSpace = e, this.endSearchSpace = n, this.backwardsEndSearchSpace = Ot(n), this.startOffset = 0, this.endOffset = n.length, this.mode = this.Mode.ALL_PARTS, this;
4172
+ return this.startSearchSpace = e, this.endSearchSpace = n, this.backwardsEndSearchSpace = At(n), this.startOffset = 0, this.endOffset = n.length, this.mode = this.Mode.ALL_PARTS, this;
4173
4173
  }
4174
4174
  setSharedSearchSpace(e) {
4175
- return this.sharedSearchSpace = e, this.backwardsSharedSearchSpace = Ot(e), this.startOffset = 0, this.endOffset = e.length, this.mode = this.Mode.SHARED_START_AND_END, this;
4175
+ return this.sharedSearchSpace = e, this.backwardsSharedSearchSpace = At(e), this.startOffset = 0, this.endOffset = e.length, this.mode = this.Mode.SHARED_START_AND_END, this;
4176
4176
  }
4177
4177
  setExactTextMatch(e) {
4178
4178
  return this.exactTextMatch = e, this.mode = this.Mode.CONTEXT_ONLY, this;
4179
4179
  }
4180
4180
  setPrefixAndSuffixSearchSpace(e, n) {
4181
- return e && (this.prefixSearchSpace = e, this.backwardsPrefixSearchSpace = Ot(e), this.prefixOffset = e.length), n && (this.suffixSearchSpace = n, this.suffixOffset = 0), this;
4181
+ return e && (this.prefixSearchSpace = e, this.backwardsPrefixSearchSpace = At(e), this.prefixOffset = e.length), n && (this.suffixSearchSpace = n, this.suffixOffset = 0), this;
4182
4182
  }
4183
4183
  useSegmenter(e) {
4184
4184
  return e == null ? this : (this.mode === this.Mode.ALL_PARTS ? (this.startSegments = e.segment(this.startSearchSpace), this.endSegments = e.segment(this.endSearchSpace)) : this.mode === this.Mode.SHARED_START_AND_END && (this.sharedSegments = e.segment(this.sharedSearchSpace)), this.prefixSearchSpace && (this.prefixSegments = e.segment(this.prefixSearchSpace)), this.suffixSearchSpace && (this.suffixSegments = e.segment(this.suffixSearchSpace)), this);
4185
4185
  }
4186
4186
  getNumberOfContextWordsToAdd() {
4187
- return this.backwardsPrefixOffset() === 0 && this.suffixOffset === 0 ? Zr : ei;
4187
+ return this.backwardsPrefixOffset() === 0 && this.suffixOffset === 0 ? Qr : Zr;
4188
4188
  }
4189
4189
  getNumberOfRangeWordsToAdd() {
4190
- return this.startOffset === 0 && this.backwardsEndOffset() === 0 ? Zr : ei;
4190
+ return this.startOffset === 0 && this.backwardsEndOffset() === 0 ? Qr : Zr;
4191
4191
  }
4192
4192
  getNextOffsetForwards(e, n, r) {
4193
4193
  let i = e.containing(n);
@@ -4256,7 +4256,7 @@ class $s {
4256
4256
  }
4257
4257
  appendNode(e) {
4258
4258
  if (this.textInBlock !== null) return;
4259
- if (le(e)) {
4259
+ if (ce(e)) {
4260
4260
  this.textFound ? (this.isForwardTraversal || this.textNodes.reverse(), this.textInBlock = this.textNodes.map((r) => r.textContent).join("").trim()) : this.textNodes = [];
4261
4261
  return;
4262
4262
  }
@@ -4270,14 +4270,14 @@ class $s {
4270
4270
  return e === this.searchRange.startContainer && this.searchRange.startOffset !== 0 && (n = this.searchRange.startOffset), e === this.searchRange.endContainer && this.searchRange.endOffset !== i && (r = this.searchRange.endOffset), n !== null || r !== null ? { textContent: (e.textContent ?? "").substring(n ?? 0, r ?? i) } : e;
4271
4271
  }
4272
4272
  }
4273
- const _s = (t, e, n) => As(t, e, n).length === 1, Ot = (t) => [...t || ""].reverse().join(""), Ju = (t) => t.toString().length > zu ? !1 : !Qu(t), lt = (t) => {
4273
+ const _s = (t, e, n) => As(t, e, n).length === 1, At = (t) => [...t || ""].reverse().join(""), Ju = (t) => t.toString().length > zu ? !1 : !Qu(t), ct = (t) => {
4274
4274
  let e = t.startContainer;
4275
4275
  return e.nodeType == Node.ELEMENT_NODE && t.startOffset < e.childNodes.length && (e = e.childNodes[t.startOffset]), e;
4276
4276
  }, Qt = (t) => {
4277
4277
  let e = t.endContainer;
4278
4278
  return e.nodeType == Node.ELEMENT_NODE && t.endOffset > 0 && (e = e.childNodes[t.endOffset - 1]), e;
4279
4279
  }, Xu = (t) => {
4280
- const e = lt(t);
4280
+ const e = ct(t);
4281
4281
  if (or(e) && D.isNodeVisible(e)) return e;
4282
4282
  const n = D.makeTextNodeWalker(t);
4283
4283
  return n.currentNode = e, n.nextNode();
@@ -4288,20 +4288,20 @@ const _s = (t, e, n) => As(t, e, n).length === 1, Ot = (t) => [...t || ""].rever
4288
4288
  return n.currentNode = e, D.backwardTraverse(n, /* @__PURE__ */ new Set());
4289
4289
  }, Qu = (t) => {
4290
4290
  const e = t.cloneRange();
4291
- let n = lt(e);
4291
+ let n = ct(e);
4292
4292
  const r = be(n);
4293
4293
  if (!r) return !1;
4294
4294
  const i = /* @__PURE__ */ new Set();
4295
4295
  for (; !e.collapsed && n != null; ) {
4296
- if (le(n)) return !0;
4296
+ if (ce(n)) return !0;
4297
4297
  n != null && e.setStartAfter(n), n = D.forwardTraverse(r, i), M();
4298
4298
  }
4299
4299
  return !1;
4300
- }, ri = (t, e) => {
4300
+ }, ni = (t, e) => {
4301
4301
  if (t.nodeType !== Node.TEXT_NODE) return -1;
4302
4302
  const n = t, r = e ?? n.data.length;
4303
4303
  if (r < n.data.length && D.BOUNDARY_CHARS.test(n.data[r])) return r;
4304
- const i = n.data.substring(0, r), s = Ot(i).search(D.BOUNDARY_CHARS);
4304
+ const i = n.data.substring(0, r), s = At(i).search(D.BOUNDARY_CHARS);
4305
4305
  return s !== -1 ? r - s : -1;
4306
4306
  }, Zu = (t, e) => {
4307
4307
  if (t.nodeType !== Node.TEXT_NODE) return -1;
@@ -4313,32 +4313,32 @@ const _s = (t, e, n) => As(t, e, n).length === 1, Ot = (t) => [...t || ""].rever
4313
4313
  if (!t) return;
4314
4314
  let n = t;
4315
4315
  const r = e ?? t;
4316
- for (; !n.contains?.(r) || !le(n); ) n.parentNode && (n = n.parentNode);
4316
+ for (; !n.contains?.(r) || !ce(n); ) n.parentNode && (n = n.parentNode);
4317
4317
  const i = (n.ownerDocument ?? n).createTreeWalker(n, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, { acceptNode: (s) => D.acceptNodeIfVisibleInRange(s) });
4318
4318
  return i.currentNode = t, i;
4319
4319
  }, eh = (t) => {
4320
4320
  const e = D.makeNewSegmenter(t.startContainer.ownerDocument ?? void 0);
4321
4321
  if (e) {
4322
- const n = lt(t);
4322
+ const n = ct(t);
4323
4323
  n !== t.startContainer && t.setStartBefore(n), Bs(e, !1, t);
4324
4324
  } else {
4325
- const n = ri(t.startContainer, t.startOffset);
4325
+ const n = ni(t.startContainer, t.startOffset);
4326
4326
  if (n !== -1) {
4327
4327
  t.setStart(t.startContainer, n);
4328
4328
  return;
4329
4329
  }
4330
- if (le(t.startContainer) && t.startOffset === 0) return;
4330
+ if (ce(t.startContainer) && t.startOffset === 0) return;
4331
4331
  const r = be(t.startContainer);
4332
4332
  if (!r) return;
4333
4333
  const i = /* @__PURE__ */ new Set();
4334
4334
  let s = D.backwardTraverse(r, i);
4335
4335
  for (; s != null; ) {
4336
- const o = ri(s);
4336
+ const o = ni(s);
4337
4337
  if (o !== -1) {
4338
4338
  t.setStart(s, o);
4339
4339
  return;
4340
4340
  }
4341
- if (le(s)) {
4341
+ if (ce(s)) {
4342
4342
  s.contains?.(t.startContainer) ? t.setStart(s, 0) : t.setStartAfter(s);
4343
4343
  return;
4344
4344
  }
@@ -4351,7 +4351,7 @@ const _s = (t, e, n) => As(t, e, n).length === 1, Ot = (t) => [...t || ""].rever
4351
4351
  t.collapse();
4352
4352
  return;
4353
4353
  }
4354
- lt(t) !== e && t.setStart(e, 0);
4354
+ ct(t) !== e && t.setStart(e, 0);
4355
4355
  const n = Qt(t), r = Yu(t);
4356
4356
  n !== r && t.setEnd(r, (r.textContent ?? "").length);
4357
4357
  }, Bs = (t, e, n) => {
@@ -4385,7 +4385,7 @@ const _s = (t, e, n) => As(t, e, n).length === 1, Ot = (t) => [...t || ""].rever
4385
4385
  if (!n) return;
4386
4386
  const r = /* @__PURE__ */ new Set();
4387
4387
  let i = D.backwardTraverse(n, r);
4388
- for (; i != null && !le(i); ) M(), i.nodeType === Node.TEXT_NODE && e.push(i), i = D.backwardTraverse(n, r);
4388
+ for (; i != null && !ce(i); ) M(), i.nodeType === Node.TEXT_NODE && e.push(i), i = D.backwardTraverse(n, r);
4389
4389
  e.reverse();
4390
4390
  const s = [];
4391
4391
  if (t.nodeType === Node.TEXT_NODE) s.push(t);
@@ -4399,7 +4399,7 @@ const _s = (t, e, n) => As(t, e, n).length === 1, Ot = (t) => [...t || ""].rever
4399
4399
  if (!a) return;
4400
4400
  const c = /* @__PURE__ */ new Set([t]);
4401
4401
  let l = D.forwardTraverse(a, c);
4402
- for (; l != null && !le(l); ) M(), l.nodeType === Node.TEXT_NODE && o.push(l), l = D.forwardTraverse(a, c);
4402
+ for (; l != null && !ce(l); ) M(), l.nodeType === Node.TEXT_NODE && o.push(l), l = D.forwardTraverse(a, c);
4403
4403
  return { preNodes: e, innerNodes: s, postNodes: o };
4404
4404
  }, rh = (t) => {
4405
4405
  const e = D.makeNewSegmenter(t.endContainer.ownerDocument ?? void 0);
@@ -4419,7 +4419,7 @@ const _s = (t, e, n) => As(t, e, n).length === 1, Ot = (t) => [...t || ""].rever
4419
4419
  t.setEnd(r, o);
4420
4420
  return;
4421
4421
  }
4422
- if (le(r)) {
4422
+ if (ce(r)) {
4423
4423
  r.contains?.(t.endContainer) ? t.setEnd(r, r.childNodes.length) : t.setEndBefore(r);
4424
4424
  return;
4425
4425
  }
@@ -4427,7 +4427,7 @@ const _s = (t, e, n) => As(t, e, n).length === 1, Ot = (t) => [...t || ""].rever
4427
4427
  }
4428
4428
  t.collapse();
4429
4429
  }
4430
- }, le = (t) => t.nodeType === Node.ELEMENT_NODE && (D.BLOCK_ELEMENTS.includes(t.tagName.toUpperCase()) || t.tagName.toUpperCase() === "HTML" || t.tagName.toUpperCase() === "BODY"), or = (t) => t.nodeType === Node.TEXT_NODE;
4430
+ }, ce = (t) => t.nodeType === Node.ELEMENT_NODE && (D.BLOCK_ELEMENTS.includes(t.tagName.toUpperCase()) || t.tagName.toUpperCase() === "HTML" || t.tagName.toUpperCase() === "BODY"), or = (t) => t.nodeType === Node.TEXT_NODE;
4431
4431
  function _n(t) {
4432
4432
  return t.otherLocations?.get("cssSelector");
4433
4433
  }
@@ -4446,7 +4446,7 @@ let Ae = class Us {
4446
4446
  }
4447
4447
  static deserialize(e) {
4448
4448
  if (!e) return;
4449
- const n = kt(e.progression), r = kt(e.totalProgression), i = kt(e.position), s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(["fragment", "fragments", "progression", "totalProgression", "position", "otherLocations"]);
4449
+ const n = Ot(e.progression), r = Ot(e.totalProgression), i = Ot(e.position), s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(["fragment", "fragments", "progression", "totalProgression", "position", "otherLocations"]);
4450
4450
  return Object.entries(e).forEach(([a, c]) => {
4451
4451
  o.has(a) || s.set(a, c);
4452
4452
  }), e.otherLocations instanceof Map && e.otherLocations.forEach((a, c) => s.set(c, a)), new Us({ fragments: Eu(e.fragments || e.fragment), progression: n !== void 0 && n >= 0 && n <= 1 ? n : void 0, totalProgression: r !== void 0 && r >= 0 && r <= 1 ? r : void 0, position: i !== void 0 && i > 0 ? i : void 0, otherLocations: s.size === 0 ? void 0 : s });
@@ -4484,20 +4484,20 @@ let Ae = class Us {
4484
4484
  return new Bn({ href: this.href, type: this.type, title: this.title, text: this.text, locations: new Ae({ ...this.locations, ...e }) });
4485
4485
  }
4486
4486
  };
4487
- function ii(t) {
4487
+ function ri(t) {
4488
4488
  return t.split("").reverse().join("");
4489
4489
  }
4490
4490
  function ah(t, e, n) {
4491
- const r = ii(e);
4491
+ const r = ri(e);
4492
4492
  return n.map((i) => {
4493
- const s = Math.max(0, i.end - e.length - i.errors), o = ii(t.slice(s, i.end));
4493
+ const s = Math.max(0, i.end - e.length - i.errors), o = ri(t.slice(s, i.end));
4494
4494
  return { start: Vs(o, r, i.errors).reduce((a, c) => i.end - c.end < a ? i.end - c.end : a, i.end), end: i.end, errors: i.errors };
4495
4495
  });
4496
4496
  }
4497
4497
  function Sn(t) {
4498
4498
  return (t | -t) >> 31 & 1;
4499
4499
  }
4500
- function si(t, e, n, r) {
4500
+ function ii(t, e, n, r) {
4501
4501
  let i = t.P[n], s = t.M[n];
4502
4502
  const o = r >>> 31, a = e[n] | o, c = a | s, l = (a & i) + i ^ i | a;
4503
4503
  let u = s | ~(l | i), h = i & l;
@@ -4519,8 +4519,8 @@ function Vs(t, e, n) {
4519
4519
  for (let m = 0; m <= s; m += 1) {
4520
4520
  p[m] = 0;
4521
4521
  for (let b = 0; b < i; b += 1) {
4522
- const x = m * i + b;
4523
- x >= e.length || e.charCodeAt(x) === g && (p[m] |= 1 << b);
4522
+ const w = m * i + b;
4523
+ w >= e.length || e.charCodeAt(w) === g && (p[m] |= 1 << b);
4524
4524
  }
4525
4525
  }
4526
4526
  }
@@ -4534,15 +4534,15 @@ function Vs(t, e, n) {
4534
4534
  let p;
4535
4535
  g < l.length ? p = l[g] : (p = c.get(g), typeof p > "u" && (p = a));
4536
4536
  let m = 0;
4537
- for (let b = 0; b <= u; b += 1) m = si(o, p, b, m), h[b] += m;
4537
+ for (let b = 0; b <= u; b += 1) m = ii(o, p, b, m), h[b] += m;
4538
4538
  if (h[u] - m <= n && u < s && (p[u + 1] & 1 || m < 0)) {
4539
4539
  u += 1, o.P[u] = -1, o.M[u] = 0;
4540
4540
  let b;
4541
4541
  if (u === s) {
4542
- const x = e.length % i;
4543
- b = x === 0 ? i : x;
4542
+ const w = e.length % i;
4543
+ b = w === 0 ? i : w;
4544
4544
  } else b = i;
4545
- h[u] = h[u - 1] + b - m + si(o, p, u, m);
4545
+ h[u] = h[u - 1] + b - m + ii(o, p, u, m);
4546
4546
  } else for (; u > 0 && h[u] >= n + i; ) u -= 1;
4547
4547
  u === s && h[u] <= n && (h[u] < n && r.splice(0, r.length), r.push({ start: -1, end: d + 1, errors: h[u] }), n = h[u]);
4548
4548
  }
@@ -4558,7 +4558,7 @@ function Ms(t, e, n) {
4558
4558
  for (; r !== -1; ) r = t.indexOf(e, r), r !== -1 && (i.push({ start: r, end: r + e.length, errors: 0 }), r += 1);
4559
4559
  return i.length > 0 ? i : oh(t, e, n);
4560
4560
  }
4561
- function ai(t, e) {
4561
+ function si(t, e) {
4562
4562
  return e.length === 0 || t.length === 0 ? 0 : 1 - Ms(t, e, e.length)[0].errors / e.length;
4563
4563
  }
4564
4564
  function lh(t, e, n = {}) {
@@ -4566,7 +4566,7 @@ function lh(t, e, n = {}) {
4566
4566
  const r = Math.min(256, e.length / 2), i = Ms(t, e, r);
4567
4567
  if (i.length === 0) return null;
4568
4568
  const s = (a) => {
4569
- const c = 1 - a.errors / e.length, l = n.prefix ? ai(t.slice(Math.max(0, a.start - n.prefix.length), a.start), n.prefix) : 1, u = n.suffix ? ai(t.slice(a.end, a.end + n.suffix.length), n.suffix) : 1;
4569
+ const c = 1 - a.errors / e.length, l = n.prefix ? si(t.slice(Math.max(0, a.start - n.prefix.length), a.start), n.prefix) : 1, u = n.suffix ? si(t.slice(a.end, a.end + n.suffix.length), n.suffix) : 1;
4570
4570
  let h = 1;
4571
4571
  return typeof n.hint == "number" && (h = 1 - Math.abs(a.start - n.hint) / t.length), (50 * c + 20 * l + 20 * u + 2 * h) / 92;
4572
4572
  }, o = i.map((a) => ({ start: a.start, end: a.end, score: s(a) }));
@@ -4580,7 +4580,7 @@ function Un(t, e, n) {
4580
4580
  const o = i.length - s.length;
4581
4581
  return n === 2 ? e - o : e + o;
4582
4582
  }
4583
- function oi(t, e) {
4583
+ function ai(t, e) {
4584
4584
  const n = t.commonAncestorContainer.ownerDocument.createNodeIterator(t.commonAncestorContainer, NodeFilter.SHOW_TEXT), r = e === 1 ? t.startContainer : t.endContainer, i = e === 1 ? t.endContainer : t.startContainer;
4585
4585
  let s = n.nextNode();
4586
4586
  for (; s && s !== r; ) s = n.nextNode();
@@ -4605,11 +4605,11 @@ function ch(t) {
4605
4605
  const i = { start: Un(t.startContainer.textContent, t.startOffset, 1), end: Un(t.endContainer.textContent, t.endOffset, 2) };
4606
4606
  if (i.start >= 0 && (e.setStart(t.startContainer, i.start), n = !0), i.end > 0 && (e.setEnd(t.endContainer, i.end), r = !0), n && r) return e;
4607
4607
  if (!n) {
4608
- const { node: s, offset: o } = oi(e, 1);
4608
+ const { node: s, offset: o } = ai(e, 1);
4609
4609
  s && o >= 0 && e.setStart(s, o);
4610
4610
  }
4611
4611
  if (!r) {
4612
- const { node: s, offset: o } = oi(e, 2);
4612
+ const { node: s, offset: o } = ai(e, 2);
4613
4613
  s && o > 0 && e.setEnd(s, o);
4614
4614
  }
4615
4615
  return e;
@@ -4623,7 +4623,7 @@ function Hs(t) {
4623
4623
  return 0;
4624
4624
  }
4625
4625
  }
4626
- function li(t) {
4626
+ function oi(t) {
4627
4627
  let e = t.previousSibling, n = 0;
4628
4628
  for (; e; ) n += Hs(e), e = e.previousSibling;
4629
4629
  return n;
@@ -4637,7 +4637,7 @@ function Ws(t, ...e) {
4637
4637
  if (n !== void 0) throw new RangeError("Offset exceeds text length");
4638
4638
  return i;
4639
4639
  }
4640
- let yt = class Te {
4640
+ let bt = class Te {
4641
4641
  constructor(e, n) {
4642
4642
  if (n < 0) throw new Error("Offset is invalid");
4643
4643
  this.element = e, this.offset = n;
@@ -4645,7 +4645,7 @@ let yt = class Te {
4645
4645
  relativeTo(e) {
4646
4646
  if (!e.contains(this.element)) throw new Error("Parent is not an ancestor of current element");
4647
4647
  let n = this.element, r = this.offset;
4648
- for (; n !== e; ) r += li(n), n = n.parentElement;
4648
+ for (; n !== e; ) r += oi(n), n = n.parentElement;
4649
4649
  return new Te(n, r);
4650
4650
  }
4651
4651
  resolve(e = {}) {
@@ -4676,7 +4676,7 @@ let yt = class Te {
4676
4676
  case Node.TEXT_NODE: {
4677
4677
  if (n < 0 || n > e.data.length) throw new Error("Text node offset is out of range");
4678
4678
  if (!e.parentElement) throw new Error("Text node has no parent");
4679
- const r = li(e) + n;
4679
+ const r = oi(e) + n;
4680
4680
  return new Te(e.parentElement, r);
4681
4681
  }
4682
4682
  case Node.ELEMENT_NODE: {
@@ -4703,11 +4703,11 @@ let yt = class Te {
4703
4703
  return r.setStart(e.node, e.offset), r.setEnd(n.node, n.offset), r;
4704
4704
  }
4705
4705
  static fromRange(e) {
4706
- const n = yt.fromPoint(e.startContainer, e.startOffset), r = yt.fromPoint(e.endContainer, e.endOffset);
4706
+ const n = bt.fromPoint(e.startContainer, e.startOffset), r = bt.fromPoint(e.endContainer, e.endOffset);
4707
4707
  return new Xe(n, r);
4708
4708
  }
4709
4709
  static fromOffsets(e, n, r) {
4710
- return new Xe(new yt(e, n), new yt(e, r));
4710
+ return new Xe(new bt(e, n), new bt(e, r));
4711
4711
  }
4712
4712
  static trimmedRange(e) {
4713
4713
  return ch(Xe.fromRange(e).toRange());
@@ -4757,7 +4757,7 @@ function dh(t) {
4757
4757
  const e = t.tagName.toUpperCase();
4758
4758
  return e === "IMG" || e === "VIDEO" || e === "AUDIO" || e === "IFRAME" || e === "OBJECT" || e === "EMBED" || e === "CANVAS";
4759
4759
  }
4760
- function ci(t, e) {
4760
+ function li(t, e) {
4761
4761
  const n = e && _n(e);
4762
4762
  let r = null;
4763
4763
  if (n) try {
@@ -4767,7 +4767,7 @@ function ci(t, e) {
4767
4767
  }
4768
4768
  return r ?? t.body ?? t.documentElement;
4769
4769
  }
4770
- function ui(t, e) {
4770
+ function ci(t, e) {
4771
4771
  let n;
4772
4772
  try {
4773
4773
  n = t.querySelector(e.cssSelector);
@@ -4788,7 +4788,7 @@ function fh(t, e) {
4788
4788
  if (n) {
4789
4789
  const i = ih(n);
4790
4790
  if (i) {
4791
- const s = ui(t, i.start), o = i.end ? ui(t, i.end) : s;
4791
+ const s = ci(t, i.start), o = i.end ? ci(t, i.end) : s;
4792
4792
  if (s && o) try {
4793
4793
  const a = t.createRange();
4794
4794
  return s.offset !== void 0 ? a.setStart(s.node, s.offset) : a.setStartBefore(s.node), o.offset !== void 0 ? a.setEnd(o.node, o.offset) : a.setEndBefore(o.node), a;
@@ -4800,12 +4800,12 @@ function fh(t, e) {
4800
4800
  if (n) {
4801
4801
  const i = sh(n);
4802
4802
  if (i) {
4803
- const s = ci(t, n), o = As(i, t, s);
4803
+ const s = li(t, n), o = As(i, t, s);
4804
4804
  if (o.length > 0) return o[0];
4805
4805
  }
4806
4806
  }
4807
4807
  if (r && r.highlight) {
4808
- const i = ci(t, n), s = new hh(i, r.highlight, { prefix: r.before, suffix: r.after });
4808
+ const i = li(t, n), s = new hh(i, r.highlight, { prefix: r.before, suffix: r.after });
4809
4809
  try {
4810
4810
  return s.toRange();
4811
4811
  } catch {
@@ -4898,9 +4898,9 @@ function mh(t, e) {
4898
4898
  return Array.from(n);
4899
4899
  }
4900
4900
  function yh(t, e, n) {
4901
- return oe(t, e.left, e.top, n) && oe(t, e.right, e.top, n) && oe(t, e.left, e.bottom, n) && oe(t, e.right, e.bottom, n);
4901
+ return le(t, e.left, e.top, n) && le(t, e.right, e.top, n) && le(t, e.left, e.bottom, n) && le(t, e.right, e.bottom, n);
4902
4902
  }
4903
- function oe(t, e, n, r) {
4903
+ function le(t, e, n, r) {
4904
4904
  return (t.left < e || W(t.left, e, r)) && (t.right > e || W(t.right, e, r)) && (t.top < n || W(t.top, n, r)) && (t.bottom > n || W(t.bottom, n, r));
4905
4905
  }
4906
4906
  function Ks(t) {
@@ -4908,10 +4908,10 @@ function Ks(t) {
4908
4908
  const r = t[e], i = t[n];
4909
4909
  if (r !== i && Js(r, i, -1)) {
4910
4910
  let s = [], o;
4911
- const a = hi(r, i);
4911
+ const a = ui(r, i);
4912
4912
  if (a.length === 1) s = a, o = r;
4913
4913
  else {
4914
- const l = hi(i, r);
4914
+ const l = ui(i, r);
4915
4915
  a.length < l.length ? (s = a, o = r) : (s = l, o = i);
4916
4916
  }
4917
4917
  const c = t.filter((l) => l !== o);
@@ -4920,7 +4920,7 @@ function Ks(t) {
4920
4920
  }
4921
4921
  return t;
4922
4922
  }
4923
- function hi(t, e) {
4923
+ function ui(t, e) {
4924
4924
  const n = bh(e, t);
4925
4925
  if (n.height === 0 || n.width === 0) return [t];
4926
4926
  const r = [];
@@ -4952,16 +4952,16 @@ function Js(t, e, n) {
4952
4952
  function W(t, e, n) {
4953
4953
  return Math.abs(t - e) <= n;
4954
4954
  }
4955
- const di = ["div", "span", "p", "br", "hr", "b", "i", "em", "strong", "s", "u", "mark", "small", "sub", "sup", "abbr", "cite", "code", "data", "dfn", "kbd", "q", "samp", "time", "var", "blockquote", "pre", "svg", "g", "path", "circle", "ellipse", "rect", "line", "polygon", "polyline", "text", "tspan", "defs", "use"], Sh = /^on/i, vh = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "xlink:href"]), wh = /^\s*(javascript|data):/i;
4955
+ const hi = ["div", "span", "p", "br", "hr", "b", "i", "em", "strong", "s", "u", "mark", "small", "sub", "sup", "abbr", "cite", "code", "data", "dfn", "kbd", "q", "samp", "time", "var", "blockquote", "pre", "svg", "g", "path", "circle", "ellipse", "rect", "line", "polygon", "polyline", "text", "tspan", "defs", "use"], Sh = /^on/i, vh = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "xlink:href"]), wh = /^\s*(javascript|data):/i;
4956
4956
  function xh(t, e) {
4957
4957
  const n = t.document.createElement("div");
4958
4958
  if ("Sanitizer" in t && typeof n.setHTML == "function") try {
4959
- const i = new t.Sanitizer({ allowElements: di });
4959
+ const i = new t.Sanitizer({ allowElements: hi });
4960
4960
  return n.setHTML(e, { sanitizer: i }), n.firstElementChild;
4961
4961
  } catch {
4962
4962
  }
4963
4963
  const r = t.document.implementation.createHTMLDocument("");
4964
- for (r.body.innerHTML = e, Eh(r.body, new Set(di)); r.body.firstChild; ) n.appendChild(t.document.adoptNode(r.body.firstChild));
4964
+ for (r.body.innerHTML = e, Eh(r.body, new Set(hi)); r.body.firstChild; ) n.appendChild(t.document.adoptNode(r.body.firstChild));
4965
4965
  return n.firstElementChild;
4966
4966
  }
4967
4967
  function Eh(t, e) {
@@ -4976,18 +4976,18 @@ function Eh(t, e) {
4976
4976
  }
4977
4977
  function vn(t) {
4978
4978
  switch (t) {
4979
- case R.Mask:
4979
+ case T.Mask:
4980
4980
  return "rgba(255, 255, 255, 0.5)";
4981
- case R.Highlight:
4982
- case R.HighlightUnderline:
4981
+ case T.Highlight:
4982
+ case T.HighlightUnderline:
4983
4983
  return "#FFFF00";
4984
4984
  default:
4985
4985
  return "#FF0000";
4986
4986
  }
4987
4987
  }
4988
- const R = { Highlight: "highlight", HighlightUnderline: "highlightUnderline", Underline: "underline", Strikethrough: "strikethrough", Outline: "outline", TextColor: "textColor", Mask: "mask", Template: "template" };
4988
+ const T = { Highlight: "highlight", HighlightUnderline: "highlightUnderline", Underline: "underline", Strikethrough: "strikethrough", Outline: "outline", TextColor: "textColor", Mask: "mask", Template: "template" };
4989
4989
  var Ch = ((t) => (t.Wrap = "wrap", t.Viewport = "viewport", t.Bounds = "bounds", t.Page = "page", t))(Ch || {}), kh = ((t) => (t.Boxes = "boxes", t.Bounds = "bounds", t))(kh || {});
4990
- const Oh = () => "Highlight" in window, fi = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
4990
+ const Oh = () => "Highlight" in window, di = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
4991
4991
  class Ah {
4992
4992
  constructor(e, n, r, i) {
4993
4993
  this.wnd = e, this.comms = n, this.id = r, this.name = i, this.items = [], this.lastItemId = 0, this.container = void 0, this._activatable = !1, this._hoverable = !1, this.hoveredItem = void 0, this.experimentalHighlights = !1, this._tintSubKeys = /* @__PURE__ */ new Map(), this._subKeyCounter = 0, this.maskSvg = void 0, this.shadowHost = void 0, this.shadowRoot = void 0, this.currentRender = 0, Oh() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map()), this.activationHandler = this.handleActivation.bind(this), this.wnd.document.addEventListener("pointerup", this.activationHandler), this.hoverHandler = this.handleHover.bind(this), this.wnd.document.addEventListener("pointermove", this.hoverHandler);
@@ -5017,7 +5017,7 @@ class Ah {
5017
5017
  return;
5018
5018
  }
5019
5019
  const i = r.commonAncestorContainer;
5020
- if (i.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (fi.includes(i.nodeName.toUpperCase()) && this.notTextFlag?.set(n, !0), r.cloneContents().querySelector(fi.join(", ").toLowerCase()) && this.notTextFlag?.set(n, !0), (i.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(n, !0)), this.experimentalHighlights && !this.notTextFlag?.has(n)) {
5020
+ if (i.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (di.includes(i.nodeName.toUpperCase()) && this.notTextFlag?.set(n, !0), r.cloneContents().querySelector(di.join(", ").toLowerCase()) && this.notTextFlag?.set(n, !0), (i.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(n, !0)), this.experimentalHighlights && !this.notTextFlag?.has(n)) {
5021
5021
  const o = (a) => {
5022
5022
  for (; a && a.nodeType === Node.ELEMENT_NODE; ) {
5023
5023
  if (a.namespaceURI?.includes("svg")) return !0;
@@ -5029,7 +5029,7 @@ class Ah {
5029
5029
  }
5030
5030
  if (this.experimentalHighlights) {
5031
5031
  const { type: o } = e.style, { layout: a, width: c, expand: l } = e.style;
5032
- o !== R.TextColor && (o === R.Outline || o === R.Template || o === R.Mask || a !== void 0 && a !== "boxes" || c !== void 0 && c !== "wrap" || l) && this.notTextFlag?.set(n, !0);
5032
+ o !== T.TextColor && (o === T.Outline || o === T.Template || o === T.Mask || a !== void 0 && a !== "boxes" || c !== void 0 && c !== "wrap" || l) && this.notTextFlag?.set(n, !0);
5033
5033
  }
5034
5034
  const s = { decoration: e, id: n, range: r, hitRects: [], clickableElements: void 0, container: void 0 };
5035
5035
  this.items.push(s), this.layout(s), s.hitRects = this.clientRectsToDocCoords(He(s.range, !1, !1, (s.decoration.style.expand ?? 0) + this.hitGap())), this.renderLayout([s]);
@@ -5037,7 +5037,7 @@ class Ah {
5037
5037
  remove(e) {
5038
5038
  const n = this.items.findIndex((s) => s.decoration.id === e);
5039
5039
  if (n < 0) return;
5040
- const r = this.items[n], i = r.decoration.style?.type === R.Mask;
5040
+ const r = this.items[n], i = r.decoration.style?.type === T.Mask;
5041
5041
  if (this.items.splice(n, 1), r.clickableElements = void 0, r.container && (r.container.remove(), r.container = void 0), this.experimentalHighlights && !this.notTextFlag?.has(r.id) && r.highlightSubKey) {
5042
5042
  const s = this.wnd.CSS.highlights;
5043
5043
  s.get(r.highlightSubKey)?.delete(r.range), this.items.some((a) => a.highlightSubKey === r.highlightSubKey) || s.delete(r.highlightSubKey);
@@ -5076,14 +5076,14 @@ class Ah {
5076
5076
  const { docX: n, docY: r } = this.pointerToDocCoords(e), i = this.wnd.devicePixelRatio;
5077
5077
  for (const s of this.items) {
5078
5078
  let o;
5079
- if (s.decoration.style.type === R.Template) for (const a of s.clickableElements ?? []) {
5079
+ if (s.decoration.style.type === T.Template) for (const a of s.clickableElements ?? []) {
5080
5080
  const c = a.getBoundingClientRect();
5081
- if (oe(c, e.clientX, e.clientY, 0)) {
5081
+ if (le(c, e.clientX, e.clientY, 0)) {
5082
5082
  o = c;
5083
5083
  break;
5084
5084
  }
5085
5085
  }
5086
- else for (const a of s.hitRects) if (oe(a, n, r, 0)) {
5086
+ else for (const a of s.hitRects) if (le(a, n, r, 0)) {
5087
5087
  o = s.range.getBoundingClientRect();
5088
5088
  break;
5089
5089
  }
@@ -5098,14 +5098,14 @@ class Ah {
5098
5098
  const { docX: n, docY: r } = this.pointerToDocCoords(e), i = this.wnd.devicePixelRatio;
5099
5099
  let s, o;
5100
5100
  for (const a of this.items) {
5101
- if (a.decoration.style.type === R.Template) for (const c of a.clickableElements ?? []) {
5101
+ if (a.decoration.style.type === T.Template) for (const c of a.clickableElements ?? []) {
5102
5102
  const l = c.getBoundingClientRect();
5103
- if (oe(l, e.clientX, e.clientY, 0)) {
5103
+ if (le(l, e.clientX, e.clientY, 0)) {
5104
5104
  s = a, o = l;
5105
5105
  break;
5106
5106
  }
5107
5107
  }
5108
- else for (const c of a.hitRects) if (oe(c, n, r, 0)) {
5108
+ else for (const c of a.hitRects) if (le(c, n, r, 0)) {
5109
5109
  s = a, o = a.range.getBoundingClientRect();
5110
5110
  break;
5111
5111
  }
@@ -5133,7 +5133,7 @@ class Ah {
5133
5133
  const n = [], r = xe(this.wnd);
5134
5134
  this.items.forEach((i) => {
5135
5135
  if (!(this.experimentalHighlights && !this.notTextFlag?.has(i.id))) {
5136
- if (i.decoration.style?.type === R.Mask) {
5136
+ if (i.decoration.style?.type === T.Mask) {
5137
5137
  e = !0;
5138
5138
  return;
5139
5139
  }
@@ -5142,68 +5142,68 @@ class Ah {
5142
5142
  }), n.length && this.renderLayout(n), e && this.updateSharedMask();
5143
5143
  }
5144
5144
  experimentalLayout(e) {
5145
- const n = this.requireContainer(!0), r = this.wnd.CSS.highlights, i = e.decoration.style, s = i.type ?? R.Highlight, o = i.tint ?? vn(s), a = i.width, c = i.layout, l = this._getSubKey(s, o);
5145
+ const n = this.requireContainer(!0), r = this.wnd.CSS.highlights, i = e.decoration.style, s = i.type ?? T.Highlight, o = i.tint ?? vn(s), a = i.width, c = i.layout, l = this._getSubKey(s, o);
5146
5146
  e.highlightSubKey && (r.get(e.highlightSubKey)?.delete(e.range), e.highlightSubKey !== l && !this.items.some((m) => m !== e && m.highlightSubKey === e.highlightSubKey) && r.delete(e.highlightSubKey)), e.highlightSubKey = l;
5147
5147
  let u;
5148
5148
  r.has(l) ? u = r.get(l) : (u = new this.wnd.Highlight(), r.set(l, u));
5149
5149
  const h = (m, b) => this.wnd.document.caretPositionFromPoint?.(m, b) ?? null;
5150
- if (s === R.TextColor && (c === "bounds" || a === "bounds" || a === "page")) {
5150
+ if (s === T.TextColor && (c === "bounds" || a === "bounds" || a === "page")) {
5151
5151
  const m = xe(this.wnd);
5152
5152
  if (m.isVertical) console.warn("Vertical writing detected: caretPositionFromPoint has known bugs, falling back to original range"), u.add(e.range);
5153
5153
  else {
5154
5154
  const b = e.range.getBoundingClientRect();
5155
- let x, A;
5156
- a === "page" ? (x = Math.floor(m.inlineStart(b) / m.pageInlineSize) * m.pageInlineSize, A = m.pageInlineSize) : (x = m.inlineStart(b), A = m.inlineSize(b));
5157
- const S = h(x, m.blockStart(b) + 1), w = h(x + A, m.blockStart(b) + m.blockSize(b) - 1);
5158
- if (S && w) {
5159
- const T = this.wnd.document.createRange();
5160
- T.setStart(S.offsetNode, S.offset), T.setEnd(w.offsetNode, w.offset), u.add(T), e.range = T;
5155
+ let w, O;
5156
+ a === "page" ? (w = Math.floor(m.inlineStart(b) / m.pageInlineSize) * m.pageInlineSize, O = m.pageInlineSize) : (w = m.inlineStart(b), O = m.inlineSize(b));
5157
+ const S = h(w, m.blockStart(b) + 1), x = h(w + O, m.blockStart(b) + m.blockSize(b) - 1);
5158
+ if (S && x) {
5159
+ const R = this.wnd.document.createRange();
5160
+ R.setStart(S.offsetNode, S.offset), R.setEnd(x.offsetNode, x.offset), u.add(R), e.range = R;
5161
5161
  } else u.add(e.range);
5162
5162
  }
5163
5163
  } else u.add(e.range);
5164
5164
  const d = this.getBackgroundColor(), g = i.enforceContrast !== !1 ? Ce(o, d) : o;
5165
5165
  let p;
5166
5166
  switch (s) {
5167
- case R.Underline:
5167
+ case T.Underline:
5168
5168
  p = `::highlight(${l}) {
5169
5169
  text-decoration: underline;
5170
5170
  text-decoration-color: ${g};
5171
5171
  text-decoration-thickness: 0.1em;
5172
5172
  }`;
5173
5173
  break;
5174
- case R.Strikethrough:
5174
+ case T.Strikethrough:
5175
5175
  p = `::highlight(${l}) {
5176
5176
  text-decoration: line-through;
5177
5177
  text-decoration-color: ${g};
5178
5178
  text-decoration-thickness: 0.1em;
5179
5179
  }`;
5180
5180
  break;
5181
- case R.Outline:
5181
+ case T.Outline:
5182
5182
  p = `::highlight(${l}) {
5183
5183
  outline: 2px solid ${g};
5184
5184
  outline-offset: 1px;
5185
5185
  }`;
5186
5186
  break;
5187
- case R.TextColor:
5187
+ case T.TextColor:
5188
5188
  p = `::highlight(${l}) {
5189
5189
  color: ${g};
5190
5190
  }`;
5191
5191
  break;
5192
- case R.HighlightUnderline: {
5193
- const { r: m, g: b, b: x } = ye(g), A = `rgba(${m}, ${b}, ${x}, 0.3)`;
5192
+ case T.HighlightUnderline: {
5193
+ const { r: m, g: b, b: w } = ye(g), O = `rgba(${m}, ${b}, ${w}, 0.3)`;
5194
5194
  p = `::highlight(${l}) {
5195
- color: ${Jr(g, d)};
5196
- background-color: ${A};
5195
+ color: ${Kr(g, d)};
5196
+ background-color: ${O};
5197
5197
  text-decoration: underline;
5198
5198
  text-decoration-color: ${g};
5199
5199
  text-decoration-thickness: 0.1em;
5200
5200
  }`;
5201
5201
  break;
5202
5202
  }
5203
- case R.Highlight:
5203
+ case T.Highlight:
5204
5204
  default:
5205
5205
  p = `::highlight(${l}) {
5206
- color: ${Jr(g, d)};
5206
+ color: ${Kr(g, d)};
5207
5207
  background-color: ${g};
5208
5208
  }`;
5209
5209
  }
@@ -5243,7 +5243,7 @@ class Ah {
5243
5243
  }
5244
5244
  computeOverlayRects(e, n, r, i) {
5245
5245
  if (e.decoration?.style?.layout === "bounds") return [i ? { left: r.left - i, right: r.right + i, top: r.top - i, bottom: r.bottom + i, width: r.width + i * 2, height: r.height + i * 2 } : r];
5246
- const s = e.decoration.style.type, o = s === R.Underline || s === R.Strikethrough, a = s === R.Strikethrough, c = o ? gh(e.range, ["rt", "rp"]) : e.range;
5246
+ const s = e.decoration.style.type, o = s === T.Underline || s === T.Strikethrough, a = s === T.Strikethrough, c = o ? gh(e.range, ["rt", "rp"]) : e.range;
5247
5247
  let l = He(c, !0, n.isVertical, o ? 0 : i);
5248
5248
  return l = l.sort((u, h) => n.isVertical ? (n.isVertLR ? 1 : -1) * (u.left - h.left) : u.top - h.top), l.map((u) => {
5249
5249
  let h = u;
@@ -5257,12 +5257,12 @@ class Ah {
5257
5257
  repositionItem(e, n) {
5258
5258
  if (!e.container) return !0;
5259
5259
  const r = e.decoration.style;
5260
- if (r.type !== R.Template) {
5261
- const u = r.type ?? R.Highlight;
5262
- if (u === R.TextColor || u === R.Mask) return !0;
5260
+ if (r.type !== T.Template) {
5261
+ const u = r.type ?? T.Highlight;
5262
+ if (u === T.TextColor || u === T.Mask) return !0;
5263
5263
  }
5264
5264
  const i = 1 / this.effectiveZoom(), s = r.expand ?? 0, o = e.range.getBoundingClientRect(), a = (() => {
5265
- if (r.type !== R.Outline) return 0;
5265
+ if (r.type !== T.Outline) return 0;
5266
5266
  const u = r.width;
5267
5267
  return u === "page" || u === "viewport" ? 3 : 0;
5268
5268
  })(), c = this.computeOverlayRects(e, n, o, s), l = Array.from(e.container.children);
@@ -5273,12 +5273,12 @@ class Ah {
5273
5273
  const n = this.wnd.document.createElement("div");
5274
5274
  n.setAttribute("id", e.id), n.dataset.highlightId = e.decoration.id, n.style.setProperty("pointer-events", "none");
5275
5275
  const r = xe(this.wnd), i = 1 / this.effectiveZoom(), s = e.decoration.style.expand ?? 0, o = e.range.getBoundingClientRect(), a = e.decoration.style, c = (() => {
5276
- if (a.type !== R.Outline) return 0;
5276
+ if (a.type !== T.Outline) return 0;
5277
5277
  const h = a.width;
5278
5278
  return h === "page" || h === "viewport" ? 3 : 0;
5279
5279
  })();
5280
5280
  let l;
5281
- if (a.type === R.Template) {
5281
+ if (a.type === T.Template) {
5282
5282
  a.stylesheet && this.injectCustomStylesheet(a.stylesheet);
5283
5283
  const h = xh(this.wnd, a.element);
5284
5284
  if (!h) {
@@ -5287,37 +5287,37 @@ class Ah {
5287
5287
  }
5288
5288
  h.style.setProperty("pointer-events", "none"), l = h;
5289
5289
  } else {
5290
- const h = a, d = h.type ?? R.Highlight, g = h.tint ?? vn(d);
5291
- if (d === R.TextColor) {
5290
+ const h = a, d = h.type ?? T.Highlight, g = h.tint ?? vn(d);
5291
+ if (d === T.TextColor) {
5292
5292
  e.container = n, e.clickableElements = [];
5293
5293
  return;
5294
5294
  }
5295
- if (d === R.Mask) {
5295
+ if (d === T.Mask) {
5296
5296
  e.container = n, e.clickableElements = [], this.updateSharedMask();
5297
5297
  return;
5298
5298
  }
5299
- const p = this.getCurrentDarkMode(), m = this.getBackgroundColor(), b = h.enforceContrast !== !1, x = (() => {
5299
+ const p = this.getCurrentDarkMode(), m = this.getBackgroundColor(), b = h.enforceContrast !== !1, w = (() => {
5300
5300
  switch (d) {
5301
- case R.Underline: {
5302
- const S = b ? Ce(g, m) : g, w = h.layout === "bounds", [T, I] = r.isVertical ? ["border-right", "border-left"] : ["border-bottom", "border-top"];
5303
- return [w ? `${I}: 0.1em solid ${S} !important` : null, `${T}: 0.1em solid ${S} !important`, "background-color: transparent !important", "box-sizing: border-box !important"].filter(Boolean).join("; ");
5301
+ case T.Underline: {
5302
+ const S = b ? Ce(g, m) : g, x = h.layout === "bounds", [R, F] = r.isVertical ? ["border-right", "border-left"] : ["border-bottom", "border-top"];
5303
+ return [x ? `${F}: 0.1em solid ${S} !important` : null, `${R}: 0.1em solid ${S} !important`, "background-color: transparent !important", "box-sizing: border-box !important"].filter(Boolean).join("; ");
5304
5304
  }
5305
- case R.Strikethrough: {
5305
+ case T.Strikethrough: {
5306
5306
  const S = b ? Ce(g, m) : g;
5307
5307
  return h.layout === "bounds" ? [`background: repeating-linear-gradient(-45deg, transparent, transparent 19px, ${S} 19px, ${S} 20px) !important`, "background-color: transparent !important", "box-sizing: border-box !important"].join("; ") : [`background-color: ${S} !important`, "box-sizing: border-box !important"].join("; ");
5308
5308
  }
5309
- case R.Outline:
5309
+ case T.Outline:
5310
5310
  return [`outline: 2px solid ${b ? Ce(g, m) : g} !important`, "outline-offset: 1px !important", "background-color: transparent !important", "box-sizing: border-box !important"].join("; ");
5311
- case R.HighlightUnderline: {
5312
- const S = b ? Ce(g, m) : g, { r: w, g: T, b: I } = ye(S), P = `rgba(${w}, ${T}, ${I}, 0.3)`, X = h.layout === "bounds", [V, y] = r.isVertical ? ["border-right", "border-left"] : ["border-bottom", "border-top"];
5311
+ case T.HighlightUnderline: {
5312
+ const S = b ? Ce(g, m) : g, { r: x, g: R, b: F } = ye(S), P = `rgba(${x}, ${R}, ${F}, 0.3)`, X = h.layout === "bounds", [V, y] = r.isVertical ? ["border-right", "border-left"] : ["border-bottom", "border-top"];
5313
5313
  return [`background-color: ${P} !important`, X ? `${y}: 0.1em solid ${S} !important` : null, `${V}: 0.1em solid ${S} !important`, "box-sizing: border-box !important"].filter(Boolean).join("; ");
5314
5314
  }
5315
- case R.Highlight:
5315
+ case T.Highlight:
5316
5316
  default:
5317
5317
  return [`background-color: ${b ? Ce(g, m) : g} !important`, `mix-blend-mode: ${p ? "exclusion" : "multiply"} !important`, "opacity: 1 !important", "box-sizing: border-box !important", "transform: translateZ(0) !important"].join("; ");
5318
5318
  }
5319
- })(), A = this.wnd.document.createElement("template");
5320
- A.innerHTML = `<div data-readium="true" class="readium-${d}" style="${x}"></div>`.trim(), l = A.content.firstElementChild;
5319
+ })(), O = this.wnd.document.createElement("template");
5320
+ O.innerHTML = `<div data-readium="true" class="readium-${d}" style="${w}"></div>`.trim(), l = O.content.firstElementChild;
5321
5321
  }
5322
5322
  const u = this.computeOverlayRects(e, r, o, s);
5323
5323
  for (const h of u) {
@@ -5339,41 +5339,41 @@ class Ah {
5339
5339
  return this.container || (this.shadowRoot || (this.shadowHost = this.wnd.document.createElement("div"), this.shadowHost.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none", this.wnd.document.body.appendChild(this.shadowHost), this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" })), this.container = this.wnd.document.createElement("div"), this.container.setAttribute("id", this.id), this.container.dataset.group = this.name, this.container.dataset.readium = "true", this.container.style.setProperty("pointer-events", "none"), this.container.style.display = "contents", this.shadowRoot.appendChild(this.container)), this.container;
5340
5340
  }
5341
5341
  getCurrentDarkMode() {
5342
- return Kr(this.wnd, "--USER__appearance") === "readium-night-on" || xs(this.getBackgroundColor());
5342
+ return Gr(this.wnd, "--USER__appearance") === "readium-night-on" || xs(this.getBackgroundColor());
5343
5343
  }
5344
5344
  getBackgroundColor() {
5345
- return Kr(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color");
5345
+ return Gr(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color");
5346
5346
  }
5347
5347
  updateSharedMask() {
5348
- const e = this.items.filter((d) => d.decoration.style?.type === R.Mask);
5348
+ const e = this.items.filter((d) => d.decoration.style?.type === T.Mask);
5349
5349
  if (e.length === 0) {
5350
5350
  this.maskSvg && (this.maskSvg.remove(), this.maskSvg = void 0), this.shadowHost && !this.container && (this.shadowHost.remove(), this.shadowRoot = void 0, this.shadowHost = void 0);
5351
5351
  return;
5352
5352
  }
5353
5353
  const n = xe(this.wnd), r = 1 / this.effectiveZoom(), i = this.wnd.document.documentElement, s = i.scrollWidth, o = i.scrollHeight, a = [];
5354
5354
  for (const d of e) {
5355
- const g = d.decoration.style, p = g.layout ?? "boxes", m = g.width ?? "wrap", b = g.expand ?? 0, x = d.range.getBoundingClientRect(), A = p === "bounds" ? [b ? { left: x.left - b, top: x.top - b, right: x.right + b, bottom: x.bottom + b, width: x.width + b * 2, height: x.height + b * 2 } : x] : He(d.range, !1, !1, b);
5356
- for (const S of A) {
5357
- let w;
5355
+ const g = d.decoration.style, p = g.layout ?? "boxes", m = g.width ?? "wrap", b = g.expand ?? 0, w = d.range.getBoundingClientRect(), O = p === "bounds" ? [b ? { left: w.left - b, top: w.top - b, right: w.right + b, bottom: w.bottom + b, width: w.width + b * 2, height: w.height + b * 2 } : w] : He(d.range, !1, !1, b);
5356
+ for (const S of O) {
5357
+ let x;
5358
5358
  switch (m) {
5359
5359
  case "viewport": {
5360
- const T = Math.floor(n.inlineStart(S) / n.viewportInlineSize) * n.viewportInlineSize;
5361
- w = n.toRect(T, n.blockStart(S), n.viewportInlineSize, n.blockSize(S));
5360
+ const R = Math.floor(n.inlineStart(S) / n.viewportInlineSize) * n.viewportInlineSize;
5361
+ x = n.toRect(R, n.blockStart(S), n.viewportInlineSize, n.blockSize(S));
5362
5362
  break;
5363
5363
  }
5364
5364
  case "page": {
5365
- const T = Math.floor(n.inlineStart(S) / n.pageInlineSize) * n.pageInlineSize;
5366
- w = n.toRect(T, n.blockStart(S), n.pageInlineSize, n.blockSize(S));
5365
+ const R = Math.floor(n.inlineStart(S) / n.pageInlineSize) * n.pageInlineSize;
5366
+ x = n.toRect(R, n.blockStart(S), n.pageInlineSize, n.blockSize(S));
5367
5367
  break;
5368
5368
  }
5369
5369
  case "bounds": {
5370
- w = n.toRect(n.inlineStart(x), n.blockStart(S), n.inlineSize(x), n.blockSize(S));
5370
+ x = n.toRect(n.inlineStart(w), n.blockStart(S), n.inlineSize(w), n.blockSize(S));
5371
5371
  break;
5372
5372
  }
5373
5373
  default:
5374
- w = n.toRect(n.inlineStart(S), n.blockStart(S), n.inlineSize(S), n.blockSize(S));
5374
+ x = n.toRect(n.inlineStart(S), n.blockStart(S), n.inlineSize(S), n.blockSize(S));
5375
5375
  }
5376
- a.push(w);
5376
+ a.push(x);
5377
5377
  }
5378
5378
  }
5379
5379
  const c = [`M0 0 H${s} V${o} H0 Z`, ...a.map((d) => {
@@ -5394,7 +5394,7 @@ class Ah {
5394
5394
  u && u.setAttribute("d", c);
5395
5395
  const h = this.maskSvg.querySelector("rect");
5396
5396
  if (h) {
5397
- const d = e[0].decoration.style.tint, g = d ?? this.getBackgroundColor() ?? vn(R.Mask), p = d ? "1" : "0.5";
5397
+ const d = e[0].decoration.style.tint, g = d ?? this.getBackgroundColor() ?? vn(T.Mask), p = d ? "1" : "0.5";
5398
5398
  h.setAttribute("x", "0"), h.setAttribute("y", "0"), h.setAttribute("width", String(s)), h.setAttribute("height", String(o)), h.setAttribute("fill", g), h.setAttribute("fill-opacity", p);
5399
5399
  }
5400
5400
  }
@@ -5485,28 +5485,28 @@ const Xs = class Re extends Su {
5485
5485
  };
5486
5486
  Xs.moduleName = "decorator";
5487
5487
  let Th = Xs;
5488
- const Rh = new Set(Object.values(R));
5488
+ const Rh = new Set(Object.values(T));
5489
5489
  function Nh(t, e) {
5490
- return t === R.TextColor ? typeof window < "u" && "Highlight" in window : Rh.has(t) ? !0 : !!e?.[t];
5490
+ return t === T.TextColor ? typeof window < "u" && "Highlight" in window : Rh.has(t) ? !0 : !!e?.[t];
5491
5491
  }
5492
- function gi(t, e) {
5492
+ function fi(t, e) {
5493
5493
  const { style: n } = t;
5494
- if (n.type === R.Template) {
5494
+ if (n.type === T.Template) {
5495
5495
  const r = n;
5496
- return { ...t, style: { ...r, element: pi(r, t) } };
5496
+ return { ...t, style: { ...r, element: gi(r, t) } };
5497
5497
  }
5498
5498
  if (n.type && e?.[n.type]) {
5499
5499
  const r = e[n.type];
5500
- return { ...t, style: { type: R.Template, layout: r.layout, width: r.width, stylesheet: r.stylesheet, element: pi(r, t) } };
5500
+ return { ...t, style: { type: T.Template, layout: r.layout, width: r.width, stylesheet: r.stylesheet, element: gi(r, t) } };
5501
5501
  }
5502
5502
  return t;
5503
5503
  }
5504
- function pi(t, e) {
5504
+ function gi(t, e) {
5505
5505
  return typeof t.element == "function" ? t.element(e) : t.element;
5506
5506
  }
5507
5507
  function Dh(t, e) {
5508
5508
  if (t.type !== e.type) return !1;
5509
- if (t.type === R.Template) {
5509
+ if (t.type === T.Template) {
5510
5510
  const i = t, s = e;
5511
5511
  return i.layout === s.layout && i.width === s.width && i.stylesheet === s.stylesheet;
5512
5512
  }
@@ -5623,9 +5623,9 @@ class $h {
5623
5623
  const r = this._decorations.get(n) ?? [], i = new Map(r.map((c) => [c.id, c])), s = new Map(e.map((c) => [c.id, c]));
5624
5624
  for (const [c, l] of i) {
5625
5625
  const u = s.get(c);
5626
- u ? Ih(l, u) || this.host.send("decorate", { group: n, action: "update", decoration: gi(u, this._config.decorationTemplates) }) : this.host.send("decorate", { group: n, action: "remove", decoration: { id: c } });
5626
+ u ? Ih(l, u) || this.host.send("decorate", { group: n, action: "update", decoration: fi(u, this._config.decorationTemplates) }) : this.host.send("decorate", { group: n, action: "remove", decoration: { id: c } });
5627
5627
  }
5628
- for (const [c, l] of s) i.has(c) || this.host.send("decorate", { group: n, action: "add", decoration: gi(l, this._config.decorationTemplates) });
5628
+ for (const [c, l] of s) i.has(c) || this.host.send("decorate", { group: n, action: "add", decoration: fi(l, this._config.decorationTemplates) });
5629
5629
  this._decorations.set(n, e);
5630
5630
  const o = this._activationState.get(n);
5631
5631
  o !== void 0 && this.host.send("decoration_activatable", { group: n, activatable: o });
@@ -5691,11 +5691,11 @@ class Uh extends $h {
5691
5691
  super.destroy(), this.decorator.unmount(this.wnd, this.channel.frame), this.channel.frame.destroy();
5692
5692
  }
5693
5693
  }
5694
- function rp(t = window, e = {}) {
5694
+ function ip(t = window, e = {}) {
5695
5695
  const n = new Fh(), r = new Th();
5696
5696
  return r.mount(t, n.frame), new Uh(n, t, r, e);
5697
5697
  }
5698
- class ip {
5698
+ class sp {
5699
5699
  providers = /* @__PURE__ */ new Map();
5700
5700
  register(e) {
5701
5701
  if (this.providers.has(e.id))
@@ -5735,7 +5735,7 @@ class ip {
5735
5735
  return n;
5736
5736
  }
5737
5737
  }
5738
- const Lt = { range: [0, 5e3], step: 100 }, Pt = { range: [0.1, 10], step: 0.1 }, $t = { range: [0, 2], step: 0.1 }, _t = { range: [0, 1], step: 0.05 }, lr = ["none", "few", "some", "most", "custom"], cr = ["none", "block-level", "always"], ur = ["plain", "ssml"], hr = ["none", "utterance", "block"], mi = [
5738
+ const Lt = { range: [0, 5e3], step: 100 }, Pt = { range: [0.1, 10], step: 0.1 }, $t = { range: [0, 2], step: 0.1 }, _t = { range: [0, 1], step: 0.05 }, lr = ["none", "few", "some", "most", "custom"], cr = ["none", "block-level", "always"], ur = ["plain", "ssml"], hr = ["none", "utterance", "block"], pi = [
5739
5739
  "format",
5740
5740
  "inlineContextualization",
5741
5741
  "verbosity",
@@ -5746,16 +5746,16 @@ const Lt = { range: [0, 5e3], step: 100 }, Pt = { range: [0.1, 10], step: 0.1 },
5746
5746
  function dr(t) {
5747
5747
  return t == null || typeof t == "boolean" ? t : void 0;
5748
5748
  }
5749
- function re(t, e) {
5749
+ function ie(t, e) {
5750
5750
  return t == null || e.includes(t) ? t : void 0;
5751
5751
  }
5752
- function ie(t, e) {
5752
+ function se(t, e) {
5753
5753
  if (t == null) return t;
5754
5754
  if (typeof t != "number" || Number.isNaN(t)) return;
5755
5755
  const n = Math.min(...e), r = Math.max(...e);
5756
5756
  return t >= n && t <= r ? t : void 0;
5757
5757
  }
5758
- function rt(t) {
5758
+ function it(t) {
5759
5759
  return t == null || Array.isArray(t) && t.every((e) => typeof e == "string") ? t : void 0;
5760
5760
  }
5761
5761
  class qh {
@@ -5771,10 +5771,10 @@ class qh {
5771
5771
  pitch;
5772
5772
  volume;
5773
5773
  constructor(e = {}) {
5774
- this.format = re(e.format, ur) ?? "plain", this.inlineContextualization = dr(e.inlineContextualization) ?? !1, this.verbosity = re(e.verbosity, lr) ?? "few", this.skip = rt(e.skip) ?? [], this.contextualize = rt(e.contextualize) ?? [], this.language = re(e.language, cr) ?? "block-level", this.pauseDuration = ie(e.pauseDuration, Lt.range) ?? 300, this.autoPause = re(e.autoPause, hr) ?? "none", this.rate = ie(e.rate, Pt.range) ?? 1, this.pitch = ie(e.pitch, $t.range) ?? 1, this.volume = ie(e.volume, _t.range) ?? 1;
5774
+ this.format = ie(e.format, ur) ?? "plain", this.inlineContextualization = dr(e.inlineContextualization) ?? !1, this.verbosity = ie(e.verbosity, lr) ?? "few", this.skip = it(e.skip) ?? [], this.contextualize = it(e.contextualize) ?? [], this.language = ie(e.language, cr) ?? "block-level", this.pauseDuration = se(e.pauseDuration, Lt.range) ?? 300, this.autoPause = ie(e.autoPause, hr) ?? "none", this.rate = se(e.rate, Pt.range) ?? 1, this.pitch = se(e.pitch, $t.range) ?? 1, this.volume = se(e.volume, _t.range) ?? 1;
5775
5775
  }
5776
5776
  }
5777
- class it {
5777
+ class st {
5778
5778
  format;
5779
5779
  inlineContextualization;
5780
5780
  verbosity;
@@ -5787,13 +5787,13 @@ class it {
5787
5787
  pitch;
5788
5788
  volume;
5789
5789
  constructor(e = {}) {
5790
- this.format = re(e.format, ur), this.inlineContextualization = dr(e.inlineContextualization), this.verbosity = re(e.verbosity, lr), this.skip = rt(e.skip), this.contextualize = rt(e.contextualize), this.language = re(e.language, cr), this.pauseDuration = ie(e.pauseDuration, Lt.range), this.autoPause = re(e.autoPause, hr), this.rate = ie(e.rate, Pt.range), this.pitch = ie(e.pitch, $t.range), this.volume = ie(e.volume, _t.range);
5790
+ this.format = ie(e.format, ur), this.inlineContextualization = dr(e.inlineContextualization), this.verbosity = ie(e.verbosity, lr), this.skip = it(e.skip), this.contextualize = it(e.contextualize), this.language = ie(e.language, cr), this.pauseDuration = se(e.pauseDuration, Lt.range), this.autoPause = ie(e.autoPause, hr), this.rate = se(e.rate, Pt.range), this.pitch = se(e.pitch, $t.range), this.volume = se(e.volume, _t.range);
5791
5791
  }
5792
5792
  merging(e) {
5793
5793
  const n = { ...this };
5794
5794
  for (const r of Object.keys(e))
5795
5795
  e[r] !== void 0 && (n[r] = e[r]);
5796
- return new it(n);
5796
+ return new st(n);
5797
5797
  }
5798
5798
  }
5799
5799
  class Zt {
@@ -5825,7 +5825,7 @@ class Zt {
5825
5825
  this._value = null, this._onChange(this._value);
5826
5826
  }
5827
5827
  }
5828
- class bt extends Zt {
5828
+ class St extends Zt {
5829
5829
  _supportedValues;
5830
5830
  constructor({
5831
5831
  initialValue: e = null,
@@ -5837,7 +5837,7 @@ class bt extends Zt {
5837
5837
  super({ initialValue: e, effectiveValue: n, isEffective: r, onChange: i }), this._supportedValues = s;
5838
5838
  }
5839
5839
  set value(e) {
5840
- if (e != null && re(e, this._supportedValues) === void 0)
5840
+ if (e != null && ie(e, this._supportedValues) === void 0)
5841
5841
  throw new Error(`Value '${String(e)}' is not in the supported values for this preference.`);
5842
5842
  this._value = e, this._onChange(this._value);
5843
5843
  }
@@ -5858,9 +5858,9 @@ class zh extends Zt {
5858
5858
  return this._value;
5859
5859
  }
5860
5860
  }
5861
- class yi extends Zt {
5861
+ class mi extends Zt {
5862
5862
  set value(e) {
5863
- if (e != null && rt(e) === void 0)
5863
+ if (e != null && it(e) === void 0)
5864
5864
  throw new Error(`Value '${String(e)}' is not an array of strings.`);
5865
5865
  this._value = e, this._onChange(this._value);
5866
5866
  }
@@ -5868,7 +5868,7 @@ class yi extends Zt {
5868
5868
  return this._value;
5869
5869
  }
5870
5870
  }
5871
- class St extends Zt {
5871
+ class vt extends Zt {
5872
5872
  _supportedRange;
5873
5873
  _step;
5874
5874
  _decimals;
@@ -5883,7 +5883,7 @@ class St extends Zt {
5883
5883
  super({ initialValue: e, effectiveValue: n, isEffective: r, onChange: i }), this._supportedRange = s, this._step = o, this._decimals = this._step.toString().includes(".") ? this._step.toString().split(".")[1].length : 0;
5884
5884
  }
5885
5885
  set value(e) {
5886
- if (e != null && ie(e, this._supportedRange) === void 0)
5886
+ if (e != null && se(e, this._supportedRange) === void 0)
5887
5887
  throw new Error(`Value '${String(e)}' is out of the supported range for this preference.`);
5888
5888
  this._value = e, this._onChange(this._value);
5889
5889
  }
@@ -5912,7 +5912,7 @@ class St extends Zt {
5912
5912
  return e.toString();
5913
5913
  }
5914
5914
  }
5915
- class bi {
5915
+ class yi {
5916
5916
  preferences;
5917
5917
  settings;
5918
5918
  // Cloned rather than aliased: edits made through this editor's setters
@@ -5920,12 +5920,12 @@ class bi {
5920
5920
  // once explicitly passed to submitPreferences() — discarding the editor
5921
5921
  // without submitting must leave the navigator untouched.
5922
5922
  constructor(e, n) {
5923
- this.preferences = new it({ ...e }), this.settings = n;
5923
+ this.preferences = new st({ ...e }), this.settings = n;
5924
5924
  }
5925
5925
  // Explicit `null`s, not `undefined` — merging() skips `undefined` fields,
5926
5926
  // so only `null` actually clears them once submitted.
5927
5927
  clear() {
5928
- this.preferences = new it({
5928
+ this.preferences = new st({
5929
5929
  format: null,
5930
5930
  inlineContextualization: null,
5931
5931
  verbosity: null,
@@ -5943,7 +5943,7 @@ class bi {
5943
5943
  this.preferences[e] = n;
5944
5944
  }
5945
5945
  get format() {
5946
- return new bt({
5946
+ return new St({
5947
5947
  initialValue: this.preferences.format,
5948
5948
  effectiveValue: this.settings.format,
5949
5949
  isEffective: this.preferences.format != null,
@@ -5960,7 +5960,7 @@ class bi {
5960
5960
  });
5961
5961
  }
5962
5962
  get verbosity() {
5963
- return new bt({
5963
+ return new St({
5964
5964
  initialValue: this.preferences.verbosity,
5965
5965
  effectiveValue: this.settings.verbosity,
5966
5966
  isEffective: this.preferences.verbosity != null,
@@ -5969,7 +5969,7 @@ class bi {
5969
5969
  });
5970
5970
  }
5971
5971
  get skip() {
5972
- return new yi({
5972
+ return new mi({
5973
5973
  initialValue: this.preferences.skip,
5974
5974
  effectiveValue: this.settings.skip,
5975
5975
  isEffective: this.preferences.skip != null,
@@ -5977,7 +5977,7 @@ class bi {
5977
5977
  });
5978
5978
  }
5979
5979
  get contextualize() {
5980
- return new yi({
5980
+ return new mi({
5981
5981
  initialValue: this.preferences.contextualize,
5982
5982
  effectiveValue: this.settings.contextualize,
5983
5983
  isEffective: this.preferences.contextualize != null,
@@ -5985,7 +5985,7 @@ class bi {
5985
5985
  });
5986
5986
  }
5987
5987
  get language() {
5988
- return new bt({
5988
+ return new St({
5989
5989
  initialValue: this.preferences.language,
5990
5990
  effectiveValue: this.settings.language,
5991
5991
  isEffective: this.preferences.language != null,
@@ -5994,7 +5994,7 @@ class bi {
5994
5994
  });
5995
5995
  }
5996
5996
  get pauseDuration() {
5997
- return new St({
5997
+ return new vt({
5998
5998
  initialValue: this.preferences.pauseDuration,
5999
5999
  effectiveValue: this.settings.pauseDuration,
6000
6000
  isEffective: this.preferences.pauseDuration != null,
@@ -6004,7 +6004,7 @@ class bi {
6004
6004
  });
6005
6005
  }
6006
6006
  get autoPause() {
6007
- return new bt({
6007
+ return new St({
6008
6008
  initialValue: this.preferences.autoPause,
6009
6009
  effectiveValue: this.settings.autoPause,
6010
6010
  isEffective: this.preferences.autoPause != null,
@@ -6013,7 +6013,7 @@ class bi {
6013
6013
  });
6014
6014
  }
6015
6015
  get rate() {
6016
- return new St({
6016
+ return new vt({
6017
6017
  initialValue: this.preferences.rate,
6018
6018
  effectiveValue: this.settings.rate,
6019
6019
  isEffective: this.preferences.rate != null,
@@ -6023,7 +6023,7 @@ class bi {
6023
6023
  });
6024
6024
  }
6025
6025
  get pitch() {
6026
- return new St({
6026
+ return new vt({
6027
6027
  initialValue: this.preferences.pitch,
6028
6028
  effectiveValue: this.settings.pitch,
6029
6029
  isEffective: this.preferences.pitch != null,
@@ -6033,7 +6033,7 @@ class bi {
6033
6033
  });
6034
6034
  }
6035
6035
  get volume() {
6036
- return new St({
6036
+ return new vt({
6037
6037
  initialValue: this.preferences.volume,
6038
6038
  effectiveValue: this.settings.volume,
6039
6039
  isEffective: this.preferences.volume != null,
@@ -6105,62 +6105,68 @@ const Qs = ["audio", "figure", "image", "math", "table", "video"], Zs = [
6105
6105
  ], Vh = {
6106
6106
  none: /* @__PURE__ */ new Set([
6107
6107
  "aside",
6108
+ "audio",
6108
6109
  "bibliography",
6110
+ "biblioref",
6111
+ "cell",
6112
+ "columnheader",
6113
+ "details",
6109
6114
  "endnotes",
6115
+ "figure",
6110
6116
  "footnote",
6111
- "noteref",
6112
- "pullquote",
6113
- "pagebreak",
6114
- "details",
6115
- "columnheader",
6116
- "rowheader",
6117
- "row",
6118
- "cell",
6119
- "audio",
6117
+ "glossary",
6120
6118
  "image",
6121
- "figure",
6122
- "video",
6123
- "table",
6124
6119
  "landmarks",
6125
6120
  "loa",
6126
6121
  "loi",
6127
6122
  "lot",
6128
6123
  "lov",
6129
- "toc"
6124
+ "noteref",
6125
+ "pagebreak",
6126
+ "pullquote",
6127
+ "row",
6128
+ "rowheader",
6129
+ "table",
6130
+ "toc",
6131
+ "video"
6130
6132
  ]),
6131
6133
  few: /* @__PURE__ */ new Set([
6132
6134
  "aside",
6133
6135
  "bibliography",
6136
+ "biblioref",
6137
+ "cell",
6138
+ "columnheader",
6139
+ "details",
6134
6140
  "endnotes",
6135
6141
  "footnote",
6136
- "noteref",
6137
- "pullquote",
6138
- "pagebreak",
6139
- "details",
6140
- "columnheader",
6141
- "rowheader",
6142
- "row",
6143
- "cell",
6142
+ "glossary",
6144
6143
  "landmarks",
6145
6144
  "loa",
6146
6145
  "loi",
6147
6146
  "lot",
6148
6147
  "lov",
6148
+ "noteref",
6149
+ "pagebreak",
6150
+ "pullquote",
6151
+ "row",
6152
+ "rowheader",
6149
6153
  "toc"
6150
6154
  ]),
6151
6155
  some: /* @__PURE__ */ new Set([
6152
6156
  "aside",
6153
6157
  "bibliography",
6158
+ "biblioref",
6154
6159
  "endnotes",
6155
6160
  "footnote",
6156
- "noteref",
6157
- "pullquote",
6158
- "pagebreak",
6161
+ "glossary",
6159
6162
  "landmarks",
6160
6163
  "loa",
6161
6164
  "loi",
6162
6165
  "lot",
6163
6166
  "lov",
6167
+ "noteref",
6168
+ "pagebreak",
6169
+ "pullquote",
6164
6170
  "toc"
6165
6171
  ]),
6166
6172
  most: /* @__PURE__ */ new Set(["landmarks", "loa", "loi", "lot", "lov", "toc"])
@@ -6172,18 +6178,18 @@ const Qs = ["audio", "figure", "image", "math", "table", "video"], Zs = [
6172
6178
  }, Vn = {
6173
6179
  table: { few: "inline", some: "block", most: "block" }
6174
6180
  };
6175
- function vt(t) {
6181
+ function wt(t) {
6176
6182
  const e = {};
6177
6183
  for (const n of Object.keys(Vn))
6178
6184
  e[n] = Vn[n]?.[t] ?? "inline";
6179
6185
  return e;
6180
6186
  }
6181
6187
  const Hh = {
6182
- none: vt("none"),
6183
- few: vt("few"),
6184
- some: vt("some"),
6185
- most: vt("most")
6186
- }, sp = Object.keys(Vn);
6188
+ none: wt("none"),
6189
+ few: wt("few"),
6190
+ some: wt("some"),
6191
+ most: wt("most")
6192
+ }, ap = Object.keys(Vn);
6187
6193
  function Wh(t, e) {
6188
6194
  const n = t === "custom" ? {} : Hh[t];
6189
6195
  if (!e) return n;
@@ -6194,7 +6200,7 @@ function Wh(t, e) {
6194
6200
  }
6195
6201
  return r;
6196
6202
  }
6197
- class Si {
6203
+ class bi {
6198
6204
  format;
6199
6205
  inlineContextualization;
6200
6206
  verbosity;
@@ -6210,29 +6216,29 @@ class Si {
6210
6216
  this.format = e.format ?? n.format, this.inlineContextualization = e.inlineContextualization ?? n.inlineContextualization, this.verbosity = e.verbosity ?? n.verbosity, this.verbosity === "custom" ? (this.skip = e.skip ?? n.skip, this.contextualize = e.contextualize ?? n.contextualize) : (this.skip = [...Vh[this.verbosity]], this.contextualize = [...Mh[this.verbosity]]), this.language = e.language ?? n.language, this.pauseDuration = e.pauseDuration ?? n.pauseDuration, this.autoPause = e.autoPause ?? n.autoPause, this.rate = e.rate ?? n.rate, this.pitch = e.pitch ?? n.pitch, this.volume = e.volume ?? n.volume;
6211
6217
  }
6212
6218
  }
6213
- const O = (t) => typeof t == "string", We = () => {
6219
+ const A = (t) => typeof t == "string", We = () => {
6214
6220
  let t, e;
6215
6221
  const n = new Promise((r, i) => {
6216
6222
  t = r, e = i;
6217
6223
  });
6218
6224
  return n.resolve = t, n.reject = e, n;
6219
- }, vi = (t) => t == null ? "" : String(t), Gh = (t, e, n) => {
6225
+ }, Si = (t) => t == null ? "" : String(t), Gh = (t, e, n) => {
6220
6226
  t.forEach((r) => {
6221
6227
  e[r] && (n[r] = e[r]);
6222
6228
  });
6223
- }, Kh = /###/g, wi = (t) => t && t.includes("###") ? t.replace(Kh, ".") : t, xi = (t) => !t || O(t), Qe = (t, e, n) => {
6224
- const r = O(e) ? e.split(".") : e;
6229
+ }, Kh = /###/g, vi = (t) => t && t.includes("###") ? t.replace(Kh, ".") : t, wi = (t) => !t || A(t), Qe = (t, e, n) => {
6230
+ const r = A(e) ? e.split(".") : e;
6225
6231
  let i = 0;
6226
6232
  for (; i < r.length - 1; ) {
6227
- if (xi(t)) return {};
6228
- const s = wi(r[i]);
6233
+ if (wi(t)) return {};
6234
+ const s = vi(r[i]);
6229
6235
  !t[s] && n && (t[s] = new n()), Object.prototype.hasOwnProperty.call(t, s) ? t = t[s] : t = {}, ++i;
6230
6236
  }
6231
- return xi(t) ? {} : {
6237
+ return wi(t) ? {} : {
6232
6238
  obj: t,
6233
- k: wi(r[i])
6239
+ k: vi(r[i])
6234
6240
  };
6235
- }, Ei = (t, e, n) => {
6241
+ }, xi = (t, e, n) => {
6236
6242
  const {
6237
6243
  obj: r,
6238
6244
  k: i
@@ -6263,7 +6269,7 @@ const O = (t) => typeof t == "string", We = () => {
6263
6269
  return r !== void 0 ? r : Bt(e, n);
6264
6270
  }, ea = (t, e, n) => {
6265
6271
  for (const r in e)
6266
- r !== "__proto__" && r !== "constructor" && (Object.prototype.hasOwnProperty.call(t, r) ? O(t[r]) || t[r] instanceof String || O(e[r]) || e[r] instanceof String ? n && (t[r] = e[r]) : ea(t[r], e[r], n) : t[r] = e[r]);
6272
+ r !== "__proto__" && r !== "constructor" && (Object.prototype.hasOwnProperty.call(t, r) ? A(t[r]) || t[r] instanceof String || A(e[r]) || e[r] instanceof String ? n && (t[r] = e[r]) : ea(t[r], e[r], n) : t[r] = e[r]);
6267
6273
  return t;
6268
6274
  }, ee = (t) => t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), Yh = {
6269
6275
  "&": "&amp;",
@@ -6272,7 +6278,7 @@ const O = (t) => typeof t == "string", We = () => {
6272
6278
  '"': "&quot;",
6273
6279
  "'": "&#39;",
6274
6280
  "/": "&#x2F;"
6275
- }, Qh = (t) => O(t) ? t.replace(/[&<>"'\/]/g, (e) => Yh[e]) : t;
6281
+ }, Qh = (t) => A(t) ? t.replace(/[&<>"'\/]/g, (e) => Yh[e]) : t;
6276
6282
  class Zh {
6277
6283
  constructor(e) {
6278
6284
  this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
@@ -6316,7 +6322,7 @@ const ed = [" ", ",", "?", "!", ";"], td = new Zh(20), nd = (t, e, n) => {
6316
6322
  i = o;
6317
6323
  }
6318
6324
  return i;
6319
- }, st = (t) => t?.replace(/_/g, "-"), rd = {
6325
+ }, at = (t) => t?.replace(/_/g, "-"), rd = {
6320
6326
  type: "logger",
6321
6327
  log(t) {
6322
6328
  this.output("log", t);
@@ -6351,7 +6357,7 @@ class Ut {
6351
6357
  return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
6352
6358
  }
6353
6359
  forward(e, n, r, i) {
6354
- return i && !this.debug ? null : (e = e.map((s) => O(s) ? s.replace(/[\r\n\x00-\x1F\x7F]/g, " ") : s), O(e[0]) && (e[0] = `${r}${this.prefix} ${e[0]}`), this.logger[n](e));
6360
+ return i && !this.debug ? null : (e = e.map((s) => A(s) ? s.replace(/[\r\n\x00-\x1F\x7F]/g, " ") : s), A(e[0]) && (e[0] = `${r}${this.prefix} ${e[0]}`), this.logger[n](e));
6355
6361
  }
6356
6362
  create(e) {
6357
6363
  return new Ut(this.logger, {
@@ -6400,7 +6406,7 @@ class en {
6400
6406
  });
6401
6407
  }
6402
6408
  }
6403
- class Ci extends en {
6409
+ class Ei extends en {
6404
6410
  constructor(e, n = {
6405
6411
  ns: ["translation"],
6406
6412
  defaultNS: "translation"
@@ -6417,22 +6423,22 @@ class Ci extends en {
6417
6423
  getResource(e, n, r, i = {}) {
6418
6424
  const s = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, o = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
6419
6425
  let a;
6420
- e.includes(".") ? a = e.split(".") : (a = [e, n], r && (Array.isArray(r) ? a.push(...r) : O(r) && s ? a.push(...r.split(s)) : a.push(r)));
6426
+ e.includes(".") ? a = e.split(".") : (a = [e, n], r && (Array.isArray(r) ? a.push(...r) : A(r) && s ? a.push(...r.split(s)) : a.push(r)));
6421
6427
  const c = Bt(this.data, a);
6422
- return !c && !n && !r && e.includes(".") && (e = a[0], n = a[1], r = a.slice(2).join(".")), c || !o || !O(r) ? c : Mn(this.data?.[e]?.[n], r, s);
6428
+ return !c && !n && !r && e.includes(".") && (e = a[0], n = a[1], r = a.slice(2).join(".")), c || !o || !A(r) ? c : Mn(this.data?.[e]?.[n], r, s);
6423
6429
  }
6424
6430
  addResource(e, n, r, i, s = {
6425
6431
  silent: !1
6426
6432
  }) {
6427
6433
  const o = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator;
6428
6434
  let a = [e, n];
6429
- r && (a = a.concat(o ? r.split(o) : r)), e.includes(".") && (a = e.split("."), i = n, n = a[1]), this.addNamespaces(n), Ei(this.data, a, i), s.silent || this.emit("added", e, n, r, i);
6435
+ r && (a = a.concat(o ? r.split(o) : r)), e.includes(".") && (a = e.split("."), i = n, n = a[1]), this.addNamespaces(n), xi(this.data, a, i), s.silent || this.emit("added", e, n, r, i);
6430
6436
  }
6431
6437
  addResources(e, n, r, i = {
6432
6438
  silent: !1
6433
6439
  }) {
6434
6440
  for (const s in r)
6435
- (O(r[s]) || Array.isArray(r[s])) && this.addResource(e, n, s, r[s], {
6441
+ (A(r[s]) || Array.isArray(r[s])) && this.addResource(e, n, s, r[s], {
6436
6442
  silent: !0
6437
6443
  });
6438
6444
  i.silent || this.emit("added", e, n, r);
@@ -6447,7 +6453,7 @@ class Ci extends en {
6447
6453
  o.skipCopy || (r = JSON.parse(JSON.stringify(r))), i ? ea(c, r, s) : c = {
6448
6454
  ...c,
6449
6455
  ...r
6450
- }, Ei(this.data, a, c), o.silent || this.emit("added", e, n, r);
6456
+ }, xi(this.data, a, c), o.silent || this.emit("added", e, n, r);
6451
6457
  }
6452
6458
  removeResourceBundle(e, n) {
6453
6459
  this.hasResourceBundle(e, n) && delete this.data[e][n], this.removeNamespaces(n), this.emit("removed", e, n);
@@ -6497,7 +6503,7 @@ function Ie(t, e) {
6497
6503
  }
6498
6504
  return n.join(r);
6499
6505
  }
6500
- const wn = (t) => !O(t) && typeof t != "boolean" && typeof t != "number";
6506
+ const wn = (t) => !A(t) && typeof t != "boolean" && typeof t != "number";
6501
6507
  class qt extends en {
6502
6508
  constructor(e, n = {}) {
6503
6509
  super(), Gh(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = n, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = Q.create("translator"), this.checkedLoadedFor = {};
@@ -6528,14 +6534,14 @@ class qt extends en {
6528
6534
  if (c && c.length > 0)
6529
6535
  return {
6530
6536
  key: e,
6531
- namespaces: O(s) ? [s] : s
6537
+ namespaces: A(s) ? [s] : s
6532
6538
  };
6533
6539
  const l = e.split(r);
6534
6540
  (r !== i || r === i && this.options.ns.includes(l[0])) && (s = l.shift()), e = l.join(i);
6535
6541
  }
6536
6542
  return {
6537
6543
  key: e,
6538
- namespaces: O(s) ? [s] : s
6544
+ namespaces: A(s) ? [s] : s
6539
6545
  };
6540
6546
  }
6541
6547
  translate(e, n, r) {
@@ -6577,13 +6583,13 @@ class qt extends en {
6577
6583
  } : a;
6578
6584
  const g = this.resolve(e, i);
6579
6585
  let p = g?.res;
6580
- const m = g?.usedKey || a, b = g?.exactUsedKey || a, x = ["[object Number]", "[object Function]", "[object RegExp]"], A = i.joinArrays !== void 0 ? i.joinArrays : this.options.joinArrays, S = !this.i18nFormat || this.i18nFormat.handleAsObject, w = i.count !== void 0 && !O(i.count), T = qt.hasDefaultValue(i), I = w ? this.pluralResolver.getSuffix(h, i.count, i) : "", P = i.ordinal && w ? this.pluralResolver.getSuffix(h, i.count, {
6586
+ const m = g?.usedKey || a, b = g?.exactUsedKey || a, w = ["[object Number]", "[object Function]", "[object RegExp]"], O = i.joinArrays !== void 0 ? i.joinArrays : this.options.joinArrays, S = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !A(i.count), R = qt.hasDefaultValue(i), F = x ? this.pluralResolver.getSuffix(h, i.count, i) : "", P = i.ordinal && x ? this.pluralResolver.getSuffix(h, i.count, {
6581
6587
  ordinal: !1
6582
- }) : "", X = w && !i.ordinal && i.count === 0, V = X && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${I}`] || i[`defaultValue${P}`] || i.defaultValue;
6588
+ }) : "", X = x && !i.ordinal && i.count === 0, V = X && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${F}`] || i[`defaultValue${P}`] || i.defaultValue;
6583
6589
  let y = p;
6584
- S && !p && T && (y = V);
6585
- const ht = wn(y), ce = Object.prototype.toString.apply(y);
6586
- if (S && y && ht && !x.includes(ce) && !(O(A) && Array.isArray(y))) {
6590
+ S && !p && R && (y = V);
6591
+ const dt = wn(y), ue = Object.prototype.toString.apply(y);
6592
+ if (S && y && dt && !w.includes(ue) && !(A(O) && Array.isArray(y))) {
6587
6593
  if (!i.returnObjects && !this.options.returnObjects) {
6588
6594
  this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
6589
6595
  const k = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, y, {
@@ -6597,7 +6603,7 @@ class qt extends en {
6597
6603
  for (const z in y)
6598
6604
  if (Object.prototype.hasOwnProperty.call(y, z)) {
6599
6605
  const H = `${G}${o}${z}`;
6600
- T && !p ? _[z] = this.translate(H, {
6606
+ R && !p ? _[z] = this.translate(H, {
6601
6607
  ...i,
6602
6608
  defaultValue: wn(V) ? V[z] : void 0,
6603
6609
  joinArrays: !1,
@@ -6610,14 +6616,14 @@ class qt extends en {
6610
6616
  }
6611
6617
  p = _;
6612
6618
  }
6613
- } else if (S && O(A) && Array.isArray(p))
6614
- p = p.join(A), p && (p = this.extendTranslation(p, e, i, r));
6619
+ } else if (S && A(O) && Array.isArray(p))
6620
+ p = p.join(O), p && (p = this.extendTranslation(p, e, i, r));
6615
6621
  else {
6616
6622
  let k = !1, _ = !1;
6617
- !this.isValidLookup(p) && T && (k = !0, p = V), this.isValidLookup(p) || (_ = !0, p = a);
6618
- const z = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && _ ? void 0 : p, H = T && V !== p && this.options.updateMissing;
6623
+ !this.isValidLookup(p) && R && (k = !0, p = V), this.isValidLookup(p) || (_ = !0, p = a);
6624
+ const z = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && _ ? void 0 : p, H = R && V !== p && this.options.updateMissing;
6619
6625
  if (_ || k || H) {
6620
- if (this.logger.log(H ? "updateKey" : "missingKey", h, l, w && !H ? `${a}${this.pluralResolver.getSuffix(h, i.count, i)}` : a, H ? V : p), o) {
6626
+ if (this.logger.log(H ? "updateKey" : "missingKey", h, l, x && !H ? `${a}${this.pluralResolver.getSuffix(h, i.count, i)}` : a, H ? V : p), o) {
6621
6627
  const f = this.resolve(a, {
6622
6628
  ...i,
6623
6629
  keySeparator: !1
@@ -6631,10 +6637,10 @@ class qt extends en {
6631
6637
  q.push(Se[f]);
6632
6638
  else this.options.saveMissingTo === "all" ? q = this.languageUtils.toResolveHierarchy(i.lng || this.language) : q.push(i.lng || this.language);
6633
6639
  const K = (f, v, C) => {
6634
- const E = T && C !== p ? C : z;
6640
+ const E = R && C !== p ? C : z;
6635
6641
  this.options.missingKeyHandler ? this.options.missingKeyHandler(f, l, v, E, H, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(f, l, v, E, H, i), this.emit("missingKey", f, l, v, p);
6636
6642
  };
6637
- this.options.saveMissing && (this.options.saveMissingPlurals && w ? q.forEach((f) => {
6643
+ this.options.saveMissing && (this.options.saveMissingPlurals && x ? q.forEach((f) => {
6638
6644
  const v = this.pluralResolver.getSuffixes(f, i);
6639
6645
  X && i[`defaultValue${this.options.pluralSeparator}zero`] && !v.includes(`${this.options.pluralSeparator}zero`) && v.push(`${this.options.pluralSeparator}zero`), v.forEach((C) => {
6640
6646
  K([f], a + C, i[`defaultValue${C}`] || V);
@@ -6661,13 +6667,13 @@ class qt extends en {
6661
6667
  ...r.interpolation
6662
6668
  }
6663
6669
  });
6664
- const c = O(e) && (r?.interpolation?.skipOnVariables !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
6670
+ const c = A(e) && (r?.interpolation?.skipOnVariables !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
6665
6671
  let l;
6666
6672
  if (c) {
6667
6673
  const h = e.match(this.interpolator.nestingRegexp);
6668
6674
  l = h && h.length;
6669
6675
  }
6670
- let u = r.replace && !O(r.replace) ? r.replace : r;
6676
+ let u = r.replace && !A(r.replace) ? r.replace : r;
6671
6677
  if (this.options.interpolation.defaultVariables && (u = {
6672
6678
  ...this.options.interpolation.defaultVariables,
6673
6679
  ...u
@@ -6677,7 +6683,7 @@ class qt extends en {
6677
6683
  }
6678
6684
  !r.lng && i && i.res && (r.lng = this.language || i.usedLng), r.nest !== !1 && (e = this.interpolator.nest(e, (...h) => s?.[0] === h[0] && !r.context ? (this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`), null) : this.translate(...h, n), r)), r.interpolation && this.interpolator.reset();
6679
6685
  }
6680
- const o = r.postProcess || this.options.postProcess, a = O(o) ? [o] : o;
6686
+ const o = r.postProcess || this.options.postProcess, a = A(o) ? [o] : o;
6681
6687
  return e != null && a?.length && r.applyPostProcessor !== !1 && (e = ta.handle(a, e, n, this.options && this.options.postProcessPassResolved ? {
6682
6688
  i18nResolved: {
6683
6689
  ...i,
@@ -6688,7 +6694,7 @@ class qt extends en {
6688
6694
  }
6689
6695
  resolve(e, n = {}) {
6690
6696
  let r, i, s, o, a;
6691
- return O(e) && (e = [e]), Array.isArray(e) && (e = e.map((c) => typeof c == "function" ? Ie(c, {
6697
+ return A(e) && (e = [e]), Array.isArray(e) && (e = e.map((c) => typeof c == "function" ? Ie(c, {
6692
6698
  ...this.options,
6693
6699
  ...n
6694
6700
  }) : c)), e.forEach((c) => {
@@ -6697,26 +6703,26 @@ class qt extends en {
6697
6703
  i = u;
6698
6704
  let h = l.namespaces;
6699
6705
  this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
6700
- const d = n.count !== void 0 && !O(n.count), g = d && !n.ordinal && n.count === 0, p = n.context !== void 0 && (O(n.context) || typeof n.context == "number") && n.context !== "", m = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng);
6706
+ const d = n.count !== void 0 && !A(n.count), g = d && !n.ordinal && n.count === 0, p = n.context !== void 0 && (A(n.context) || typeof n.context == "number") && n.context !== "", m = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng);
6701
6707
  h.forEach((b) => {
6702
- this.isValidLookup(r) || (a = b, !this.checkedLoadedFor[`${m[0]}-${b}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(a) && (this.checkedLoadedFor[`${m[0]}-${b}`] = !0, this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((x) => {
6708
+ this.isValidLookup(r) || (a = b, !this.checkedLoadedFor[`${m[0]}-${b}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(a) && (this.checkedLoadedFor[`${m[0]}-${b}`] = !0, this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((w) => {
6703
6709
  if (this.isValidLookup(r)) return;
6704
- o = x;
6705
- const A = [u];
6710
+ o = w;
6711
+ const O = [u];
6706
6712
  if (this.i18nFormat?.addLookupKeys)
6707
- this.i18nFormat.addLookupKeys(A, u, x, b, n);
6713
+ this.i18nFormat.addLookupKeys(O, u, w, b, n);
6708
6714
  else {
6709
- let w;
6710
- d && (w = this.pluralResolver.getSuffix(x, n.count, n));
6711
- const T = `${this.options.pluralSeparator}zero`, I = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
6712
- if (d && (n.ordinal && w.startsWith(I) && A.push(u + w.replace(I, this.options.pluralSeparator)), A.push(u + w), g && A.push(u + T)), p) {
6715
+ let x;
6716
+ d && (x = this.pluralResolver.getSuffix(w, n.count, n));
6717
+ const R = `${this.options.pluralSeparator}zero`, F = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
6718
+ if (d && (n.ordinal && x.startsWith(F) && O.push(u + x.replace(F, this.options.pluralSeparator)), O.push(u + x), g && O.push(u + R)), p) {
6713
6719
  const P = `${u}${this.options.contextSeparator || "_"}${n.context}`;
6714
- A.push(P), d && (n.ordinal && w.startsWith(I) && A.push(P + w.replace(I, this.options.pluralSeparator)), A.push(P + w), g && A.push(P + T));
6720
+ O.push(P), d && (n.ordinal && x.startsWith(F) && O.push(P + x.replace(F, this.options.pluralSeparator)), O.push(P + x), g && O.push(P + R));
6715
6721
  }
6716
6722
  }
6717
6723
  let S;
6718
- for (; S = A.pop(); )
6719
- this.isValidLookup(r) || (s = S, r = this.getResource(x, b, S, n));
6724
+ for (; S = O.pop(); )
6725
+ this.isValidLookup(r) || (s = S, r = this.getResource(w, b, S, n));
6720
6726
  }));
6721
6727
  });
6722
6728
  }), {
@@ -6734,7 +6740,7 @@ class qt extends en {
6734
6740
  return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, n, r, i) : this.resourceStore.getResource(e, n, r, i);
6735
6741
  }
6736
6742
  getUsedParamsDetails(e = {}) {
6737
- const n = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], r = e.replace && !O(e.replace);
6743
+ const n = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], r = e.replace && !A(e.replace);
6738
6744
  let i = r ? e.replace : e;
6739
6745
  if (r && typeof e.count < "u" && (i = {
6740
6746
  ...i,
@@ -6759,7 +6765,7 @@ class qt extends en {
6759
6765
  return !1;
6760
6766
  }
6761
6767
  }
6762
- class ki {
6768
+ class Ci {
6763
6769
  constructor(e) {
6764
6770
  this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = Q.create("languageUtils"), this.resolveHierarchyCache = {};
6765
6771
  }
@@ -6767,17 +6773,17 @@ class ki {
6767
6773
  this.resolveHierarchyCache = {};
6768
6774
  }
6769
6775
  getScriptPartFromCode(e) {
6770
- if (e = st(e), !e || !e.includes("-")) return null;
6776
+ if (e = at(e), !e || !e.includes("-")) return null;
6771
6777
  const n = e.split("-");
6772
6778
  return n.length === 2 || (n.pop(), n[n.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(n.join("-"));
6773
6779
  }
6774
6780
  getLanguagePartFromCode(e) {
6775
- if (e = st(e), !e || !e.includes("-")) return e;
6781
+ if (e = at(e), !e || !e.includes("-")) return e;
6776
6782
  const n = e.split("-");
6777
6783
  return this.formatLanguageCode(n[0]);
6778
6784
  }
6779
6785
  formatLanguageCode(e) {
6780
- if (O(e) && e.includes("-")) {
6786
+ if (A(e) && e.includes("-")) {
6781
6787
  let n;
6782
6788
  try {
6783
6789
  n = Intl.getCanonicalLocales(e)[0];
@@ -6808,7 +6814,7 @@ class ki {
6808
6814
  }
6809
6815
  getFallbackCodes(e, n) {
6810
6816
  if (!e) return [];
6811
- if (typeof e == "function" && (e = e(n)), O(e) && (e = [e]), Array.isArray(e)) return e;
6817
+ if (typeof e == "function" && (e = e(n)), A(e) && (e = [e]), Array.isArray(e)) return e;
6812
6818
  if (!n) return e.default || [];
6813
6819
  let r = e[n];
6814
6820
  return r || (r = e[this.getScriptPartFromCode(n)]), r || (r = e[this.formatLanguageCode(n)]), r || (r = e[this.getLanguagePartFromCode(n)]), r || (r = e.default), r || [];
@@ -6816,7 +6822,7 @@ class ki {
6816
6822
  toResolveHierarchy(e, n) {
6817
6823
  const r = this.options.fallbackLng, i = Array.isArray(r) ? r.join("|") : r;
6818
6824
  i !== this._cachedFallbackLng && (this.resolveHierarchyCache = {}, this._cachedFallbackLng = i);
6819
- const s = n === void 0 || n === !1 || O(n), o = n === void 0 && typeof this.options.fallbackLng == "function", a = O(e) && s && !o;
6825
+ const s = n === void 0 || n === !1 || A(n), o = n === void 0 && typeof this.options.fallbackLng == "function", a = A(e) && s && !o;
6820
6826
  let c = null;
6821
6827
  if (a) {
6822
6828
  let d;
@@ -6829,19 +6835,19 @@ class ki {
6829
6835
  const l = this.getFallbackCodes((n === !1 ? [] : n) || this.options.fallbackLng || [], e), u = [], h = (d) => {
6830
6836
  d && (this.isSupportedCode(d) ? u.push(d) : this.logger.warn(`rejecting language code not found in supportedLngs: ${d}`));
6831
6837
  };
6832
- return O(e) && (e.includes("-") || e.includes("_")) ? (this.options.load !== "languageOnly" && h(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && h(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && h(this.getLanguagePartFromCode(e))) : O(e) && h(this.formatLanguageCode(e)), l.forEach((d) => {
6838
+ return A(e) && (e.includes("-") || e.includes("_")) ? (this.options.load !== "languageOnly" && h(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && h(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && h(this.getLanguagePartFromCode(e))) : A(e) && h(this.formatLanguageCode(e)), l.forEach((d) => {
6833
6839
  u.includes(d) || h(this.formatLanguageCode(d));
6834
6840
  }), c !== null ? (this.resolveHierarchyCache[c] = u, u.slice()) : u;
6835
6841
  }
6836
6842
  }
6837
- const Oi = {
6843
+ const ki = {
6838
6844
  zero: 0,
6839
6845
  one: 1,
6840
6846
  two: 2,
6841
6847
  few: 3,
6842
6848
  many: 4,
6843
6849
  other: 5
6844
- }, Ai = {
6850
+ }, Oi = {
6845
6851
  select: (t) => t === 1 ? "one" : "other",
6846
6852
  resolvedOptions: () => ({
6847
6853
  pluralCategories: ["one", "other"]
@@ -6855,7 +6861,7 @@ class sd {
6855
6861
  this.pluralRulesCache = {};
6856
6862
  }
6857
6863
  getRule(e, n = {}) {
6858
- const r = st(e === "dev" ? "en" : e), i = n.ordinal ? "ordinal" : "cardinal", s = JSON.stringify({
6864
+ const r = at(e === "dev" ? "en" : e), i = n.ordinal ? "ordinal" : "cardinal", s = JSON.stringify({
6859
6865
  cleanedCode: r,
6860
6866
  type: i
6861
6867
  });
@@ -6868,8 +6874,8 @@ class sd {
6868
6874
  });
6869
6875
  } catch {
6870
6876
  if (typeof Intl > "u")
6871
- return this.logger.error("No Intl support, please use an Intl polyfill!"), Ai;
6872
- if (!e.match(/-|_/)) return Ai;
6877
+ return this.logger.error("No Intl support, please use an Intl polyfill!"), Oi;
6878
+ if (!e.match(/-|_/)) return Oi;
6873
6879
  const c = this.languageUtils.getLanguagePartFromCode(e);
6874
6880
  o = this.getRule(c, n);
6875
6881
  }
@@ -6884,18 +6890,18 @@ class sd {
6884
6890
  }
6885
6891
  getSuffixes(e, n = {}) {
6886
6892
  let r = this.getRule(e, n);
6887
- return r || (r = this.getRule("dev", n)), r ? r.resolvedOptions().pluralCategories.sort((i, s) => Oi[i] - Oi[s]).map((i) => `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
6893
+ return r || (r = this.getRule("dev", n)), r ? r.resolvedOptions().pluralCategories.sort((i, s) => ki[i] - ki[s]).map((i) => `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
6888
6894
  }
6889
6895
  getSuffix(e, n, r = {}) {
6890
6896
  const i = this.getRule(e, r);
6891
6897
  return i ? `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(n)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", n, r));
6892
6898
  }
6893
6899
  }
6894
- const Ti = (t, e, n, r = ".", i = !0) => {
6900
+ const Ai = (t, e, n, r = ".", i = !0) => {
6895
6901
  let s = Xh(t, e, n);
6896
- return !s && i && O(n) && (s = Mn(t, n, r), s === void 0 && (s = Mn(e, n, r))), s;
6902
+ return !s && i && A(n) && (s = Mn(t, n, r), s === void 0 && (s = Mn(e, n, r))), s;
6897
6903
  }, ad = (t) => t.replace(/\$/g, "$$$$");
6898
- class Ri {
6904
+ class Ti {
6899
6905
  constructor(e = {}) {
6900
6906
  this.logger = Q.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((n) => n), this.init(e);
6901
6907
  }
@@ -6919,10 +6925,10 @@ class Ri {
6919
6925
  nestingSuffix: p,
6920
6926
  nestingSuffixEscaped: m,
6921
6927
  nestingOptionsSeparator: b,
6922
- maxReplaces: x,
6923
- alwaysFormat: A
6928
+ maxReplaces: w,
6929
+ alwaysFormat: O
6924
6930
  } = e.interpolation;
6925
- this.escape = n !== void 0 ? n : Qh, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? ee(s) : o || "{{", this.suffix = a ? ee(a) : c || "}}", this.formatSeparator = l || ",", this.unescapePrefix = u ? "" : h ? ee(h) : "-", this.unescapeSuffix = this.unescapePrefix ? "" : u ? ee(u) : "", this.nestingPrefix = d ? ee(d) : g || ee("$t("), this.nestingSuffix = p ? ee(p) : m || ee(")"), this.nestingOptionsSeparator = b || ",", this.maxReplaces = x || 1e3, this.alwaysFormat = A !== void 0 ? A : !1, this.resetRegExp();
6931
+ this.escape = n !== void 0 ? n : Qh, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = s ? ee(s) : o || "{{", this.suffix = a ? ee(a) : c || "}}", this.formatSeparator = l || ",", this.unescapePrefix = u ? "" : h ? ee(h) : "-", this.unescapeSuffix = this.unescapePrefix ? "" : u ? ee(u) : "", this.nestingPrefix = d ? ee(d) : g || ee("$t("), this.nestingSuffix = p ? ee(p) : m || ee(")"), this.nestingOptionsSeparator = b || ",", this.maxReplaces = w || 1e3, this.alwaysFormat = O !== void 0 ? O : !1, this.resetRegExp();
6926
6932
  }
6927
6933
  reset() {
6928
6934
  this.options && this.init(this.options);
@@ -6935,15 +6941,15 @@ class Ri {
6935
6941
  let s, o, a;
6936
6942
  const c = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, l = (g) => {
6937
6943
  if (!g.includes(this.formatSeparator)) {
6938
- const x = Ti(n, c, g, this.options.keySeparator, this.options.ignoreJSONStructure);
6939
- return this.alwaysFormat ? this.format(x, void 0, r, {
6944
+ const w = Ai(n, c, g, this.options.keySeparator, this.options.ignoreJSONStructure);
6945
+ return this.alwaysFormat ? this.format(w, void 0, r, {
6940
6946
  ...i,
6941
6947
  ...n,
6942
6948
  interpolationkey: g
6943
- }) : x;
6949
+ }) : w;
6944
6950
  }
6945
6951
  const p = g.split(this.formatSeparator), m = p.shift().trim(), b = p.join(this.formatSeparator).trim();
6946
- return this.format(Ti(n, c, m, this.options.keySeparator, this.options.ignoreJSONStructure), b, r, {
6952
+ return this.format(Ai(n, c, m, this.options.keySeparator, this.options.ignoreJSONStructure), b, r, {
6947
6953
  ...i,
6948
6954
  ...n,
6949
6955
  interpolationkey: m
@@ -6963,7 +6969,7 @@ class Ri {
6963
6969
  if (o = l(p), o === void 0)
6964
6970
  if (typeof u == "function") {
6965
6971
  const b = u(e, s, i);
6966
- o = O(b) ? b : "";
6972
+ o = A(b) ? b : "";
6967
6973
  } else if (i && Object.prototype.hasOwnProperty.call(i, p))
6968
6974
  o = "";
6969
6975
  else if (h) {
@@ -6971,7 +6977,7 @@ class Ri {
6971
6977
  continue;
6972
6978
  } else
6973
6979
  this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), o = "";
6974
- else !O(o) && !this.useRawValueToEscape && (o = vi(o));
6980
+ else !A(o) && !this.useRawValueToEscape && (o = Si(o));
6975
6981
  const m = g.safeValue(o);
6976
6982
  if (e = e.replace(s[0], ad(m)), h ? (g.regex.lastIndex += m.length, g.regex.lastIndex -= s[0].length) : g.regex.lastIndex = 0, a++, a >= this.maxReplaces)
6977
6983
  break;
@@ -7002,10 +7008,10 @@ class Ri {
7002
7008
  let c = [];
7003
7009
  o = {
7004
7010
  ...r
7005
- }, o = o.replace && !O(o.replace) ? o.replace : o, o.applyPostProcessor = !1, delete o.defaultValue;
7011
+ }, o = o.replace && !A(o.replace) ? o.replace : o, o.applyPostProcessor = !1, delete o.defaultValue;
7006
7012
  const l = /{.*}/s.test(i[1]) ? i[1].lastIndexOf("}") + 1 : i[1].indexOf(this.formatSeparator);
7007
- if (l !== -1 && (c = i[1].slice(l).split(this.formatSeparator).map((u) => u.trim()).filter(Boolean), i[1] = i[1].slice(0, l)), s = n(a.call(this, i[1].trim(), o), o), s && i[0] === e && !O(s)) return s;
7008
- O(s) || (s = vi(s)), s || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), s = ""), c.length && (s = c.reduce((u, h) => this.format(u, h, r.lng, {
7013
+ if (l !== -1 && (c = i[1].slice(l).split(this.formatSeparator).map((u) => u.trim()).filter(Boolean), i[1] = i[1].slice(0, l)), s = n(a.call(this, i[1].trim(), o), o), s && i[0] === e && !A(s)) return s;
7014
+ A(s) || (s = Si(s)), s || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), s = ""), c.length && (s = c.reduce((u, h) => this.format(u, h, r.lng, {
7009
7015
  ...r,
7010
7016
  interpolationkey: i[1].trim()
7011
7017
  }), s.trim())), e = e.replace(i[0], s), this.regexp.lastIndex = 0;
@@ -7031,7 +7037,7 @@ const od = (t) => {
7031
7037
  formatName: e,
7032
7038
  formatOptions: n
7033
7039
  };
7034
- }, Ni = (t) => {
7040
+ }, Ri = (t) => {
7035
7041
  const e = {};
7036
7042
  return (n, r, i) => {
7037
7043
  let s = i;
@@ -7041,9 +7047,9 @@ const od = (t) => {
7041
7047
  });
7042
7048
  const o = r + JSON.stringify(s);
7043
7049
  let a = e[o];
7044
- return a || (a = t(st(r), i), e[o] = a), a(n);
7050
+ return a || (a = t(at(r), i), e[o] = a), a(n);
7045
7051
  };
7046
- }, ld = (t) => (e, n, r) => t(st(n), r)(e);
7052
+ }, ld = (t) => (e, n, r) => t(at(n), r)(e);
7047
7053
  class cd {
7048
7054
  constructor(e = {}) {
7049
7055
  this.logger = Q.create("formatter"), this.options = e, this.init(e);
@@ -7052,7 +7058,7 @@ class cd {
7052
7058
  interpolation: {}
7053
7059
  }) {
7054
7060
  this.formatSeparator = n.interpolation.formatSeparator || ",";
7055
- const r = n.cacheInBuiltFormats ? Ni : ld;
7061
+ const r = n.cacheInBuiltFormats ? Ri : ld;
7056
7062
  this.formats = {
7057
7063
  number: r((i, s) => {
7058
7064
  const o = new Intl.NumberFormat(i, {
@@ -7091,7 +7097,7 @@ class cd {
7091
7097
  this.formats[e.toLowerCase().trim()] = n;
7092
7098
  }
7093
7099
  addCached(e, n) {
7094
- this.formats[e.toLowerCase().trim()] = Ni(n);
7100
+ this.formats[e.toLowerCase().trim()] = Ri(n);
7095
7101
  }
7096
7102
  format(e, n, r, i = {}) {
7097
7103
  if (!n || e == null) return e;
@@ -7211,7 +7217,7 @@ class hd extends en {
7211
7217
  prepareLoading(e, n, r = {}, i) {
7212
7218
  if (!this.backend)
7213
7219
  return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
7214
- O(e) && (e = this.languageUtils.toResolveHierarchy(e)), O(n) && (n = [n]);
7220
+ A(e) && (e = this.languageUtils.toResolveHierarchy(e)), A(n) && (n = [n]);
7215
7221
  const s = this.queueLoad(e, n, r, i);
7216
7222
  if (!s.toLoad.length)
7217
7223
  return s.pending.length || i(), null;
@@ -7294,7 +7300,7 @@ const xn = () => ({
7294
7300
  appendNamespaceToCIMode: !1,
7295
7301
  overloadTranslationOptionHandler: (t) => {
7296
7302
  let e = {};
7297
- if (typeof t[1] == "object" && (e = t[1]), O(t[1]) && (e.defaultValue = t[1]), O(t[2]) && (e.tDescription = t[2]), typeof t[2] == "object" || typeof t[3] == "object") {
7303
+ if (typeof t[1] == "object" && (e = t[1]), A(t[1]) && (e.defaultValue = t[1]), A(t[2]) && (e.tDescription = t[2]), typeof t[2] == "object" || typeof t[3] == "object") {
7298
7304
  const n = t[3] || t[2];
7299
7305
  Object.keys(n).forEach((r) => {
7300
7306
  e[r] = n[r];
@@ -7315,7 +7321,7 @@ const xn = () => ({
7315
7321
  skipOnVariables: !0
7316
7322
  },
7317
7323
  cacheInBuiltFormats: !0
7318
- }), Di = (t) => (O(t.ns) && (t.ns = [t.ns]), O(t.fallbackLng) && (t.fallbackLng = [t.fallbackLng]), O(t.fallbackNS) && (t.fallbackNS = [t.fallbackNS]), t.supportedLngs && !t.supportedLngs.includes("cimode") && (t.supportedLngs = t.supportedLngs.concat(["cimode"])), t), wt = () => {
7324
+ }), Ni = (t) => (A(t.ns) && (t.ns = [t.ns]), A(t.fallbackLng) && (t.fallbackLng = [t.fallbackLng]), A(t.fallbackNS) && (t.fallbackNS = [t.fallbackNS]), t.supportedLngs && !t.supportedLngs.includes("cimode") && (t.supportedLngs = t.supportedLngs.concat(["cimode"])), t), xt = () => {
7319
7325
  }, dd = (t) => {
7320
7326
  Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach((n) => {
7321
7327
  typeof t[n] == "function" && (t[n] = t[n].bind(t));
@@ -7323,7 +7329,7 @@ const xn = () => ({
7323
7329
  };
7324
7330
  class Ze extends en {
7325
7331
  constructor(e = {}, n) {
7326
- if (super(), this.options = Di(e), this.services = {}, this.logger = Q, this.modules = {
7332
+ if (super(), this.options = Ni(e), this.services = {}, this.logger = Q, this.modules = {
7327
7333
  external: []
7328
7334
  }, dd(this), n && !this.isInitialized && !e.isClone) {
7329
7335
  if (!this.options.initAsync)
@@ -7334,12 +7340,12 @@ class Ze extends en {
7334
7340
  }
7335
7341
  }
7336
7342
  init(e = {}, n) {
7337
- this.isInitializing = !0, typeof e == "function" && (n = e, e = {}), e.defaultNS == null && e.ns && (O(e.ns) ? e.defaultNS = e.ns : e.ns.includes("translation") || (e.defaultNS = e.ns[0]));
7343
+ this.isInitializing = !0, typeof e == "function" && (n = e, e = {}), e.defaultNS == null && e.ns && (A(e.ns) ? e.defaultNS = e.ns : e.ns.includes("translation") || (e.defaultNS = e.ns[0]));
7338
7344
  const r = xn();
7339
7345
  this.options = {
7340
7346
  ...r,
7341
7347
  ...this.options,
7342
- ...Di(e)
7348
+ ...Ni(e)
7343
7349
  }, this.options.interpolation = {
7344
7350
  ...r.interpolation,
7345
7351
  ...this.options.interpolation
@@ -7349,12 +7355,12 @@ class Ze extends en {
7349
7355
  this.modules.logger ? Q.init(i(this.modules.logger), this.options) : Q.init(null, this.options);
7350
7356
  let l;
7351
7357
  this.modules.formatter ? l = this.modules.formatter : l = cd;
7352
- const u = new ki(this.options);
7353
- this.store = new Ci(this.options.resources, this.options);
7358
+ const u = new Ci(this.options);
7359
+ this.store = new Ei(this.options.resources, this.options);
7354
7360
  const h = this.services;
7355
7361
  h.logger = Q, h.resourceStore = this.store, h.languageUtils = u, h.pluralResolver = new sd(u, {
7356
7362
  prepend: this.options.pluralSeparator
7357
- }), l && (h.formatter = i(l), h.formatter.init && h.formatter.init(h, this.options), this.options.interpolation.format = h.formatter.format.bind(h.formatter)), h.interpolator = new Ri(this.options), h.utils = {
7363
+ }), l && (h.formatter = i(l), h.formatter.init && h.formatter.init(h, this.options), this.options.interpolation.format = h.formatter.format.bind(h.formatter)), h.interpolator = new Ti(this.options), h.utils = {
7358
7364
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
7359
7365
  }, h.backendConnector = new hd(i(this.modules.backend), h.resourceStore, h, this.options), h.backendConnector.on("*", (d, ...g) => {
7360
7366
  this.emit(d, ...g);
@@ -7364,7 +7370,7 @@ class Ze extends en {
7364
7370
  d.init && d.init(this);
7365
7371
  });
7366
7372
  }
7367
- if (this.format = this.options.interpolation.format, n || (n = wt), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
7373
+ if (this.format = this.options.interpolation.format, n || (n = xt), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
7368
7374
  const l = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
7369
7375
  l.length > 0 && l[0] !== "dev" && (this.options.lng = l[0]);
7370
7376
  }
@@ -7382,9 +7388,9 @@ class Ze extends en {
7382
7388
  };
7383
7389
  return this.options.resources || !this.options.initAsync ? c() : setTimeout(c, 0), a;
7384
7390
  }
7385
- loadResources(e, n = wt) {
7391
+ loadResources(e, n = xt) {
7386
7392
  let r = n;
7387
- const i = O(e) ? e : this.language;
7393
+ const i = A(e) ? e : this.language;
7388
7394
  if (typeof e == "function" && (r = e), !this.options.resources || this.options.partialBundledLanguages) {
7389
7395
  if (i?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return r();
7390
7396
  const s = [], o = (a) => {
@@ -7401,7 +7407,7 @@ class Ze extends en {
7401
7407
  }
7402
7408
  reloadResources(e, n, r) {
7403
7409
  const i = We();
7404
- return typeof e == "function" && (r = e, e = void 0), typeof n == "function" && (r = n, n = void 0), e || (e = this.languages), n || (n = this.options.ns), r || (r = wt), this.services.backendConnector.reload(e, n, (s) => {
7410
+ return typeof e == "function" && (r = e, e = void 0), typeof n == "function" && (r = n, n = void 0), e || (e = this.languages), n || (n = this.options.ns), r || (r = xt), this.services.backendConnector.reload(e, n, (s) => {
7405
7411
  i.resolve(), r(s);
7406
7412
  }), i;
7407
7413
  }
@@ -7432,7 +7438,7 @@ class Ze extends en {
7432
7438
  c ? this.isLanguageChangingTo === e && (i(c), this.translator.changeLanguage(c), this.isLanguageChangingTo = void 0, this.emit("languageChanged", c), this.logger.log("languageChanged", c)) : this.isLanguageChangingTo = void 0, r.resolve((...l) => this.t(...l)), n && n(a, (...l) => this.t(...l));
7433
7439
  }, o = (a) => {
7434
7440
  !e && !a && this.services.languageDetector && (a = []);
7435
- const c = O(a) ? a : a && a[0], l = this.store.hasLanguageSomeTranslations(c) ? c : this.services.languageUtils.getBestMatchFromCodes(O(a) ? [a] : a);
7441
+ const c = A(a) ? a : a && a[0], l = this.store.hasLanguageSomeTranslations(c) ? c : this.services.languageUtils.getBestMatchFromCodes(A(a) ? [a] : a);
7436
7442
  l && (this.language || i(l), this.translator.language || this.translator.changeLanguage(l), this.services.languageDetector?.cacheUserLanguage?.(l)), this.loadResources(l, (u) => {
7437
7443
  s(u, l);
7438
7444
  });
@@ -7456,7 +7462,7 @@ class Ze extends en {
7456
7462
  let p;
7457
7463
  return u.keyPrefix && Array.isArray(a) ? p = a.map((m) => (typeof m == "function" && (m = Ie(m, d)), `${u.keyPrefix}${g}${m}`)) : (typeof a == "function" && (a = Ie(a, d)), p = u.keyPrefix ? `${u.keyPrefix}${g}${a}` : a), this.t(p, u);
7458
7464
  };
7459
- return O(e) ? o.lng = e : o.lngs = e, o.ns = n, o.keyPrefix = r, o;
7465
+ return A(e) ? o.lng = e : o.lngs = e, o.ns = n, o.keyPrefix = r, o;
7460
7466
  }
7461
7467
  t(...e) {
7462
7468
  return this.translator?.translate(...e);
@@ -7486,7 +7492,7 @@ class Ze extends en {
7486
7492
  }
7487
7493
  loadNamespaces(e, n) {
7488
7494
  const r = We();
7489
- return this.options.ns ? (O(e) && (e = [e]), e.forEach((i) => {
7495
+ return this.options.ns ? (A(e) && (e = [e]), e.forEach((i) => {
7490
7496
  this.options.ns.includes(i) || this.options.ns.push(i);
7491
7497
  }), this.loadResources((i) => {
7492
7498
  r.resolve(), n && n(i);
@@ -7494,7 +7500,7 @@ class Ze extends en {
7494
7500
  }
7495
7501
  loadLanguages(e, n) {
7496
7502
  const r = We();
7497
- O(e) && (e = [e]);
7503
+ A(e) && (e = [e]);
7498
7504
  const i = this.options.preload || [], s = e.filter((o) => !i.includes(o) && this.services.languageUtils.isSupportedCode(o));
7499
7505
  return s.length ? (this.options.preload = i.concat(s), this.loadResources((o) => {
7500
7506
  r.resolve(), n && n(o);
@@ -7510,14 +7516,14 @@ class Ze extends en {
7510
7516
  }
7511
7517
  } catch {
7512
7518
  }
7513
- const n = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], r = this.services?.languageUtils || new ki(xn());
7519
+ const n = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], r = this.services?.languageUtils || new Ci(xn());
7514
7520
  return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : n.includes(r.getLanguagePartFromCode(e)) || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
7515
7521
  }
7516
7522
  static createInstance(e = {}, n) {
7517
7523
  const r = new Ze(e, n);
7518
7524
  return r.createInstance = Ze.createInstance, r;
7519
7525
  }
7520
- cloneInstance(e = {}, n = wt) {
7526
+ cloneInstance(e = {}, n = xt) {
7521
7527
  const r = e.forkResourceStore;
7522
7528
  r && delete e.forkResourceStore;
7523
7529
  const i = {
@@ -7537,7 +7543,7 @@ class Ze extends en {
7537
7543
  }, c[l] = Object.keys(c[l]).reduce((u, h) => (u[h] = {
7538
7544
  ...c[l][h]
7539
7545
  }, u), c[l]), c), {});
7540
- s.store = new Ci(a, i), s.services.resourceStore = s.store;
7546
+ s.store = new Ei(a, i), s.services.resourceStore = s.store;
7541
7547
  }
7542
7548
  if (e.interpolation) {
7543
7549
  const c = {
@@ -7548,7 +7554,7 @@ class Ze extends en {
7548
7554
  ...i,
7549
7555
  interpolation: c
7550
7556
  };
7551
- s.services.interpolator = new Ri(l);
7557
+ s.services.interpolator = new Ti(l);
7552
7558
  }
7553
7559
  return s.translator = new qt(s.services, i), s.translator.on("*", (a, ...c) => {
7554
7560
  s.emit(a, ...c);
@@ -7581,11 +7587,11 @@ j.setDefaultNamespace;
7581
7587
  j.hasLoadedNamespace;
7582
7588
  j.loadNamespaces;
7583
7589
  j.loadLanguages;
7584
- function ct(t) {
7590
+ function ut(t) {
7585
7591
  return t.plain === "" && t.ssml === "" && t.language === "";
7586
7592
  }
7587
7593
  function fd(t) {
7588
- if (!t || ct(t)) return;
7594
+ if (!t || ut(t)) return;
7589
7595
  if (t.ssml === "" && t.language === "") return t.plain;
7590
7596
  const e = { language: t.language };
7591
7597
  return t.plain !== "" && (e.plain = t.plain), t.ssml !== "" && (e.ssml = t.ssml), e;
@@ -7632,12 +7638,12 @@ function vd(t) {
7632
7638
  }
7633
7639
  }
7634
7640
  const Jn = ":~:text=";
7635
- function xt(t) {
7641
+ function Et(t) {
7636
7642
  return encodeURIComponent(t).replace(/-/g, "%2D");
7637
7643
  }
7638
7644
  function ra(t) {
7639
7645
  let e = "";
7640
- return t.prefix && (e += `${xt(t.prefix)}-,`), e += xt(t.textStart), t.textEnd && (e += `,${xt(t.textEnd)}`), t.suffix && (e += `,-${xt(t.suffix)}`), `${Jn}${e}`;
7646
+ return t.prefix && (e += `${Et(t.prefix)}-,`), e += Et(t.textStart), t.textEnd && (e += `,${Et(t.textEnd)}`), t.suffix && (e += `,-${Et(t.suffix)}`), `${Jn}${e}`;
7641
7647
  }
7642
7648
  function wd(t) {
7643
7649
  if (!t) return;
@@ -7653,7 +7659,7 @@ function wd(t) {
7653
7659
  return;
7654
7660
  }
7655
7661
  }
7656
- function Ii(t) {
7662
+ function Di(t) {
7657
7663
  const e = t?.textref;
7658
7664
  if (!e) return;
7659
7665
  const n = e.indexOf(":~:"), r = n === -1 ? e : e.slice(0, n);
@@ -7673,14 +7679,14 @@ function Ii(t) {
7673
7679
  }
7674
7680
  const xd = { contextualizations: { abstract: { block: { start: "Start of the abstract.", end: "End of the abstract." } }, acknowledgments: { block: { start: "Start of the acknowledgments.", end: "End of the acknowledgments." } }, afterword: { block: { start: "Start of the afterword.", end: "End of the afterword." } }, appendix: { block: { start: "Start of the appendix.", end: "End of the appendix." } }, aside: { block: { start: "Start of the aside.", end: "End of the aside." } }, audio: { inline: { labelled: "Audio with a label: {{ description }}", unlabelled: "Audio with no label." } }, bibliography: { block: { start: "Start of the bibliography.", end: "End of the bibliography." } }, blockquote: { inline: "Blockquote." }, cell: { inline: { withHeader: "{{ header }}: {{ value }}", withoutHeader: "{{ value }}" } }, chapter: { block: { start: "Start of the chapter.", end: "End of the chapter." } }, colophon: { inline: "Colophon." }, complementary: { block: { start: "Start of the complementary content.", end: "End of the complementary content." } }, conclusion: { block: { start: "Start of the conclusion.", end: "End of the conclusion." } }, cover: { inline: { labelled: "Cover with a label: {{ description }}", unlabelled: "Cover with no label." } }, credit: { inline: "Credit." }, credits: { block: { start: "Start of the credits.", end: "End of the credits." } }, dedication: { inline: "Dedication." }, definition: { inline: "Definition." }, details: { block: { start: "Start of the disclosure.", end: "End of the disclosure." } }, endnotes: { block: { start: "Start of the endnotes.", end: "End of the endnotes." } }, epigraph: { inline: "Epigraph." }, epilogue: { block: { start: "Start of the epilogue.", end: "End of the epilogue." } }, errata: { block: { start: "Start of the errata.", end: "End of the errata." } }, example: { block: { start: "Start of the example.", end: "End of the example." } }, figure: { inline: "Figure: {{ description }}" }, footnote: { block: { start: "Start of the footnote.", end: "End of the footnote." } }, foreword: { block: { start: "Start of the foreword.", end: "End of the foreword." } }, glossary: { block: { start: "Start of the glossary.", end: "End of the glossary." } }, heading1: { inline: "Heading level 1." }, heading2: { inline: "Heading level 2." }, heading3: { inline: "Heading level 3." }, heading4: { inline: "Heading level 4." }, heading5: { inline: "Heading level 5." }, heading6: { inline: "Heading level 6." }, image: { inline: { labelled: "Image with a label: {{ description }}", unlabelled: "Image with no label." } }, index: { block: { start: "Start of the index.", end: "End of the index." } }, introduction: { block: { start: "Start of the introduction.", end: "End of the introduction." } }, list: { block: { start: "Start of the list.", end: "End of the list." } }, listItem: { inline: "List item." }, math: { inline: { labelled: "{{ description }}", unlabelled: "Math formula with no label." } }, notice: { inline: "Notice." }, pagebreak: { inline: "Pagebreak." }, pagelist: { block: { start: "Start of the page list.", end: "End of the page list." } }, part: { inline: "Part." }, preface: { block: { start: "Start of the preface.", end: "End of the preface." } }, prologue: { block: { start: "Start of the prologue.", end: "End of the prologue." } }, pullquote: { inline: "Pullquote." }, qna: { block: { start: "Start of the questions and answers.", end: "End of the questions and answers." } }, row: { inline: "Row: {{ count }}" }, rowheader: { inline: { withHeader: "{{ header }}: {{ value }}", withoutHeader: "{{ value }}" } }, separator: { inline: "Separator." }, subtitle: { inline: "Subtitle." }, summary: { inline: "Summary." }, table: { block: { end: "End of the table.", start: { labelled: "Table: {{ description }}. {{ lines }}. {{ columns }}.", unlabelled: "Table. {{ lines }}. {{ columns }}." } }, inline: { labelled: "Table: {{ description }}. {{ lines }}. {{ columns }}.", unlabelled: "Table. {{ lines }}. {{ columns }}." }, parts: { columns_one: "1 column", columns_other: "{{ count }} columns", lines_one: "1 line", lines_other: "{{ count }} lines" } }, term: { inline: "Term." }, tip: { inline: "Tip." }, video: { inline: { labelled: "Video with a label: {{ description }}", unlabelled: "Video with no label." } } } }, Ed = {
7675
7681
  speech: xd
7676
- }, ia = Ed.speech.contextualizations, Fi = { en: ia }, Cd = {};
7682
+ }, ia = Ed.speech.contextualizations, Ii = { en: ia }, Cd = {};
7677
7683
  async function kd(t) {
7678
- const e = Fi[t];
7684
+ const e = Ii[t];
7679
7685
  if (e) return e;
7680
7686
  const n = Cd[t];
7681
7687
  if (!n) return ia;
7682
7688
  const r = (await n()).speech.contextualizations;
7683
- return Fi[t] = r, r;
7689
+ return Ii[t] = r, r;
7684
7690
  }
7685
7691
  const Od = /<lang xml:lang="[^"]*">([\s\S]*?)<\/lang>/g;
7686
7692
  function sa(t) {
@@ -7713,7 +7719,7 @@ const aa = /<lang xml:lang="([^"]*)">([\s\S]*?)<\/lang>/g;
7713
7719
  function oa(t) {
7714
7720
  return new RegExp(aa).test(t);
7715
7721
  }
7716
- function Li(t) {
7722
+ function Fi(t) {
7717
7723
  return t.replace(/<[^>]+>/g, "").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/ {2,}/g, " ");
7718
7724
  }
7719
7725
  const Nd = new RegExp(
@@ -7752,12 +7758,12 @@ function la(t, e) {
7752
7758
  let r = 0;
7753
7759
  for (const s of t.matchAll(aa))
7754
7760
  n.push({
7755
- tokens: Cn(Li(t.slice(r, s.index))),
7761
+ tokens: Cn(Fi(t.slice(r, s.index))),
7756
7762
  language: e,
7757
7763
  tagged: !1
7758
7764
  }), n.push({ tokens: Cn(tn(s[2])), language: s[1], tagged: !0 }), r = s.index + s[0].length;
7759
7765
  n.push({
7760
- tokens: Cn(Li(t.slice(r))),
7766
+ tokens: Cn(Fi(t.slice(r))),
7761
7767
  language: e,
7762
7768
  tagged: !1
7763
7769
  });
@@ -7784,16 +7790,18 @@ function Pd(t) {
7784
7790
  const r = t.slice(n).trim();
7785
7791
  return r && e.push({ ssml: r }), e;
7786
7792
  }
7787
- const ap = [
7793
+ const op = [
7788
7794
  "aside",
7789
7795
  "audio",
7790
7796
  "bibliography",
7797
+ "biblioref",
7791
7798
  "cell",
7792
7799
  "columnheader",
7793
7800
  "details",
7794
7801
  "endnotes",
7795
7802
  "figure",
7796
7803
  "footnote",
7804
+ "glossary",
7797
7805
  "image",
7798
7806
  "landmarks",
7799
7807
  "loa",
@@ -7894,21 +7902,21 @@ function jd(t) {
7894
7902
  });
7895
7903
  }), { lines: t.length, columns: r, rowNumbers: e, cellHeaders: n };
7896
7904
  }
7897
- const Vd = new Set($d), Md = new Set(Bd), Hd = new Set(Ud), gr = new Set(qd), Wd = new Set(zd);
7898
- function at(t, e, n, r) {
7905
+ const Li = new Set($d), Vd = new Set(Bd), Md = new Set(Ud), gr = new Set(qd), Hd = new Set(zd);
7906
+ function ot(t, e, n, r) {
7899
7907
  const i = n ? `${e}.${n}` : void 0;
7900
7908
  if (i && t.i18n.exists(i)) return t.i18n.t(i, r);
7901
7909
  if (t.i18n.exists(e)) return t.i18n.t(e, r);
7902
7910
  }
7903
- function de(t, e) {
7911
+ function fe(t, e) {
7904
7912
  return e === "ssml" ? { ssml: zt(t), synthetic: !0 } : { plain: t, synthetic: !0 };
7905
7913
  }
7906
- function fe(t, e, n, r) {
7914
+ function ne(t, e, n, r) {
7907
7915
  t.push(...r);
7908
7916
  for (let i = 0; i < r.length; i++) e.push(n);
7909
7917
  }
7910
- function ha(t, e, n, r, i, s, o) {
7911
- o ? (i.some((a) => n.blockStarts.has(a)) && n.blockStarts.add(o), fe(t, e, s[0] ?? r, [o])) : (t.push(...i), e.push(...s));
7918
+ function Wd(t, e, n, r, i, s, o) {
7919
+ o ? (i.some((a) => n.blockStarts.has(a)) && n.blockStarts.add(o), ne(t, e, s[0] ?? r, [o])) : (t.push(...i), e.push(...s));
7912
7920
  }
7913
7921
  function pr(t, e) {
7914
7922
  return gr.has(t) ? !0 : e.contextualize.has(t);
@@ -7922,26 +7930,26 @@ function Gd(t, e, n) {
7922
7930
  function Pi(t, e, n, r, i, s, o, a) {
7923
7931
  if (!pr(i, r)) return;
7924
7932
  if ((r.i18n.exists(`${i}.block.start`) || r.i18n.exists(`${i}.block.end`)) && r.contextualizationShapes[i] !== "inline") {
7925
- const l = s === "before" ? `${i}.block.start` : `${i}.block.end`, u = at(r, l, o, a);
7926
- u && fe(t, e, n, [de(u, r.format)]);
7933
+ const l = s === "before" ? `${i}.block.start` : `${i}.block.end`, u = ot(r, l, o, a);
7934
+ u && ne(t, e, n, [fe(u, r.format)]);
7927
7935
  return;
7928
7936
  }
7929
7937
  if (s === "before") {
7930
- const l = at(r, `${i}.inline`, o, a);
7938
+ const l = ot(r, `${i}.inline`, o, a);
7931
7939
  if (l) {
7932
- const u = de(l, r.format);
7940
+ const u = fe(l, r.format);
7933
7941
  if (gr.has(i) && (delete u.synthetic, r.language !== "none")) {
7934
7942
  const h = typeof n.text == "object" ? n.text.language : void 0;
7935
7943
  h && (u.language = h);
7936
7944
  }
7937
- fe(t, e, n, [u]);
7945
+ ne(t, e, n, [u]);
7938
7946
  }
7939
7947
  }
7940
7948
  }
7941
7949
  function $i(t, e) {
7942
7950
  return e.size > 0 && t.some((n) => e.has(n));
7943
7951
  }
7944
- function mr(t, e) {
7952
+ function ha(t, e) {
7945
7953
  let n, r = !1;
7946
7954
  const i = [];
7947
7955
  for (const a of t) {
@@ -7961,11 +7969,11 @@ function mr(t, e) {
7961
7969
  function Kd(t, e) {
7962
7970
  const n = fr(t.text), r = n ? da(n, e.format, e.language) : [];
7963
7971
  if (!e.contextualize.has("pagebreak")) return r;
7964
- const i = e.i18n.exists("pagebreak.block.start") ? "pagebreak.block.start" : "pagebreak.inline", s = at(e, i);
7972
+ const i = e.i18n.exists("pagebreak.block.start") ? "pagebreak.block.start" : "pagebreak.inline", s = ot(e, i);
7965
7973
  if (s === void 0) return r;
7966
- const o = de(s, e.format);
7974
+ const o = fe(s, e.format);
7967
7975
  if (r.length === 0) return [o];
7968
- const a = mr([o, ...r], e.format);
7976
+ const a = ha([o, ...r], e.format);
7969
7977
  return a ? (a.plain !== void 0 && (a.plain += "."), a.ssml !== void 0 && (a.ssml += "."), [a]) : [o, ...r];
7970
7978
  }
7971
7979
  function da(t, e, n) {
@@ -7978,7 +7986,7 @@ function da(t, e, n) {
7978
7986
  return t.language && (r.language = t.language), e === "ssml" ? r.ssml = t.ssml ?? zt(t.plain ?? "") : r.plain = t.plain ?? tn(t.ssml ?? ""), (n === "block-level" || n === "none") && (r.ssml && (r.ssml = sa(r.ssml)), n === "none" && delete r.language), [r];
7979
7987
  }
7980
7988
  function Jd(t) {
7981
- return (t.role ?? []).some((e) => Md.has(e));
7989
+ return (t.role ?? []).some((e) => Vd.has(e));
7982
7990
  }
7983
7991
  function Xd(t, e, n, r, i, s) {
7984
7992
  const o = typeof t.text == "object" ? t.text.language : void 0, a = new Map((t.children ?? []).map((d) => [d.id, d])), c = [], l = [], u = [];
@@ -8000,8 +8008,8 @@ function Xd(t, e, n, r, i, s) {
8000
8008
  const g = {};
8001
8009
  o && (g.language = o), i.format === "ssml" ? g.ssml = d.ssml : g.plain = tn(d.ssml), (i.language === "block-level" || i.language === "none") && (g.ssml && (g.ssml = sa(g.ssml)), i.language === "none" && delete g.language), c.push(g), l.push(t);
8002
8010
  }
8003
- const h = c.length > 1 ? mr(c, i.format) : void 0;
8004
- return ha(n, r, i, t, c, l, h), u;
8011
+ const h = c.length > 1 ? ha(c, i.format) : void 0;
8012
+ return Wd(n, r, i, t, c, l, h), u;
8005
8013
  }
8006
8014
  function _i(t, e, n, r) {
8007
8015
  const i = `${e}.parts.${n}`;
@@ -8044,10 +8052,10 @@ function Ui(t, e, n) {
8044
8052
  function fa(t, e, n, r, i) {
8045
8053
  const s = t.role ?? [];
8046
8054
  if ($i(s, r.skip)) return;
8047
- const o = s.some((d) => Vd.has(d)), a = o && !i, c = e.length, l = s.filter(
8055
+ const o = s.some((d) => Li.has(d)), a = o && !i, c = e.length, l = s.filter(
8048
8056
  (d) => d !== "footnote" && d !== "pagebreak" && !Gd(d, s, r)
8049
- ), u = s.some((d) => Hd.has(d) && r.contextualize.has(d)), h = s.includes("table") && t.description !== void 0 && !u;
8050
- h && fe(e, n, t, [de(t.description, r.format)]);
8057
+ ), u = s.some((d) => Md.has(d) && r.contextualize.has(d)), h = s.includes("table") && t.description !== void 0 && !u;
8058
+ h && ne(e, n, t, [fe(t.description, r.format)]);
8051
8059
  for (const d of l) {
8052
8060
  if (d === "figure" && t.description === void 0) continue;
8053
8061
  const { variantKey: g, params: p } = Ui(d, t, r);
@@ -8058,47 +8066,47 @@ function fa(t, e, n, r, i) {
8058
8066
  const g = d.role ?? [];
8059
8067
  if (!$i(g, r.skip))
8060
8068
  if (g.includes("footnote")) {
8061
- const p = [], m = [];
8062
- ue([d], p, m, r, i);
8063
- const b = r.contextualize.has("footnote"), x = r.i18n.exists("footnote.block.start") || r.i18n.exists("footnote.block.end"), A = b ? at(r, x ? "footnote.block.start" : "footnote.inline") : void 0, S = b && (A !== void 0 || x), w = [], T = [];
8064
- if (A !== void 0 && (w.push(de(A, r.format)), T.push(d)), w.push(...p), T.push(...m), S && x) {
8065
- const P = at(r, "footnote.block.end");
8066
- P !== void 0 && (w.push(de(P, r.format)), T.push(d));
8069
+ const p = r.contextualize.has("footnote"), m = r.i18n.exists("footnote.block.start") || r.i18n.exists("footnote.block.end"), b = g.some((O) => Li.has(O)) && !i && !r.inlineContextualization, w = e.length;
8070
+ if (p) {
8071
+ const O = ot(r, m ? "footnote.block.start" : "footnote.inline");
8072
+ O !== void 0 && ne(e, n, d, [fe(O, r.format)]);
8073
+ }
8074
+ if (he([d], e, n, r, i || b), b && e.length > w && r.blockStarts.add(e[w]), p && m) {
8075
+ const O = ot(r, "footnote.block.end");
8076
+ O !== void 0 && ne(e, n, d, [fe(O, r.format)]);
8067
8077
  }
8068
- const I = S && w.length > 1 ? mr(w, r.format) : void 0;
8069
- ha(e, n, r, d, w, T, I);
8070
8078
  } else
8071
- ue([d], e, n, r, i);
8079
+ he([d], e, n, r, i);
8072
8080
  }
8073
- else if (!s.some((d) => Wd.has(d))) {
8081
+ else if (!s.some((d) => Hd.has(d))) {
8074
8082
  const d = typeof t.text == "object" ? t.text.ssml : void 0;
8075
8083
  if (d && Ld(d)) {
8076
8084
  const g = Xd(t, d, e, n, r, i);
8077
8085
  if (g.length > 0) {
8078
8086
  const p = i || o && e.length > c;
8079
- ue(g, e, n, r, p);
8087
+ he(g, e, n, r, p);
8080
8088
  }
8081
8089
  } else if (s.includes("pagebreak")) {
8082
- if (fe(e, n, t, Kd(t, r)), t.children) {
8090
+ if (ne(e, n, t, Kd(t, r)), t.children) {
8083
8091
  const g = i || o && e.length > c;
8084
- ue(t.children, e, n, r, g);
8092
+ he(t.children, e, n, r, g);
8085
8093
  }
8086
8094
  } else {
8087
8095
  const p = s.some((m) => gr.has(m) && pr(m, r)) ? void 0 : fr(t.text);
8088
- if (p && fe(e, n, t, da(p, r.format, r.language)), t.children) {
8096
+ if (p && ne(e, n, t, da(p, r.format, r.language)), t.children) {
8089
8097
  const m = i || o && e.length > c;
8090
- ue(t.children, e, n, r, m);
8098
+ he(t.children, e, n, r, m);
8091
8099
  }
8092
8100
  }
8093
8101
  }
8094
- a && e.length > c && r.blockStarts.add(e[c]), t.description !== void 0 && !u && !h && fe(e, n, t, [de(t.description, r.format)]);
8102
+ a && e.length > c && r.blockStarts.add(e[c]), t.description !== void 0 && !u && !h && ne(e, n, t, [fe(t.description, r.format)]);
8095
8103
  for (const d of l) {
8096
8104
  if (d === "figure" && t.description === void 0) continue;
8097
8105
  const { variantKey: g, params: p } = Ui(d, t, r);
8098
8106
  Pi(e, n, t, r, d, "after", g, p);
8099
8107
  }
8100
8108
  }
8101
- function ue(t, e, n, r, i) {
8109
+ function he(t, e, n, r, i) {
8102
8110
  t.forEach((s, o) => fa(s, e, n, r, o === 0 ? i : !1));
8103
8111
  }
8104
8112
  function Zd(t, e) {
@@ -8143,33 +8151,33 @@ async function pa(t) {
8143
8151
  tableCellHeaders: /* @__PURE__ */ new Map()
8144
8152
  };
8145
8153
  }
8146
- async function op(t, e) {
8154
+ async function lp(t, e) {
8147
8155
  const n = [], r = [];
8148
- return ue(t, n, r, await pa(e), !1), ma(n, r, yr(t));
8156
+ return he(t, n, r, await pa(e), !1), ma(n, r, mr(t));
8149
8157
  }
8150
8158
  async function tf(t, e) {
8151
8159
  const n = [], r = [], i = await pa(e);
8152
- ue(t, n, r, i, !1);
8160
+ he(t, n, r, i, !1);
8153
8161
  const s = n.map((o) => i.blockStarts.has(o));
8154
- return { utterances: ma(n, r, yr(t)), sources: r, blockStarts: s };
8162
+ return { utterances: ma(n, r, mr(t)), sources: r, blockStarts: s };
8155
8163
  }
8156
- function yr(t, e = [], n = /* @__PURE__ */ new Map()) {
8164
+ function mr(t, e = [], n = /* @__PURE__ */ new Map()) {
8157
8165
  for (const r of t)
8158
- n.set(r, e), r.children && yr(r.children, [r, ...e], n);
8166
+ n.set(r, e), r.children && mr(r.children, [r, ...e], n);
8159
8167
  return n;
8160
8168
  }
8161
8169
  function ma(t, e, n) {
8162
8170
  return t.map((r, i) => {
8163
8171
  const s = e[i];
8164
- let o = Ii(s);
8172
+ let o = Di(s);
8165
8173
  if (!o && s) {
8166
8174
  for (const a of n.get(s) ?? [])
8167
- if (o = Ii(a), o) break;
8175
+ if (o = Di(a), o) break;
8168
8176
  }
8169
8177
  return o ? { ...r, locate: o } : r;
8170
8178
  });
8171
8179
  }
8172
- class lp {
8180
+ class cp {
8173
8181
  engine;
8174
8182
  contentQueue = [];
8175
8183
  events = new Kt();
@@ -8204,7 +8212,7 @@ class lp {
8204
8212
  // Index to speak() on the next play() when autoPause has stopped playback between utterances.
8205
8213
  pendingAutoPauseIndex = null;
8206
8214
  constructor(e, n = {}) {
8207
- this.engine = e, this._defaults = new qh(n.defaults), this._preferences = new it(n.preferences), this._settings = new Si(this._preferences, this._defaults), this.contextualizationOverrides = n.contextualizationOverrides, this.setupEngineListeners(), this.applyEngineParameters(), this.initializeEngine();
8215
+ this.engine = e, this._defaults = new qh(n.defaults), this._preferences = new st(n.preferences), this._settings = new bi(this._preferences, this._defaults), this.contextualizationOverrides = n.contextualizationOverrides, this.setupEngineListeners(), this.applyEngineParameters(), this.initializeEngine();
8208
8216
  }
8209
8217
  // Unlike pauseDuration/autoPause (read live off settings), the engine owns rate/pitch/volume and must be pushed.
8210
8218
  applyEngineParameters() {
@@ -8401,16 +8409,16 @@ class lp {
8401
8409
  return this._settings;
8402
8410
  }
8403
8411
  get preferencesEditor() {
8404
- return this._preferencesEditor === null && (this._preferencesEditor = new bi(this._preferences, this.settings)), this._preferencesEditor;
8412
+ return this._preferencesEditor === null && (this._preferencesEditor = new yi(this._preferences, this.settings)), this._preferencesEditor;
8405
8413
  }
8406
8414
  async submitPreferences(e) {
8407
- !this.source && mi.some((n) => e[n] !== void 0) && console.warn(
8415
+ !this.source && pi.some((n) => e[n] !== void 0) && console.warn(
8408
8416
  "submitPreferences(): extraction-affecting preferences (format, inlineContextualization, verbosity, skip, contextualize, language) have no effect on content loaded via loadContent() — use loadGndContent() to re-extract on submission."
8409
8417
  ), this._preferences = this._preferences.merging(e), await this.applyPreferences();
8410
8418
  }
8411
8419
  async applyPreferences() {
8412
8420
  const e = this._settings;
8413
- this._settings = new Si(this._preferences, this._defaults), this.applyEngineParameters(), this._preferencesEditor !== null && (this._preferencesEditor = new bi(this._preferences, this._settings)), mi.some((n) => !this.sameSettingValue(e[n], this._settings[n])) && await this.reextract();
8421
+ this._settings = new bi(this._preferences, this._defaults), this.applyEngineParameters(), this._preferencesEditor !== null && (this._preferencesEditor = new yi(this._preferences, this._settings)), pi.some((n) => !this.sameSettingValue(e[n], this._settings[n])) && await this.reextract();
8414
8422
  }
8415
8423
  // Arrays (skip/contextualize) compare as sets, not by reference.
8416
8424
  sameSettingValue(e, n) {
@@ -8608,15 +8616,15 @@ function cf(t) {
8608
8616
  function uf(t, e, n) {
8609
8617
  return af.has(e) || n.some((r) => of.has(r));
8610
8618
  }
8611
- function At(t, e) {
8619
+ function Tt(t, e) {
8612
8620
  const n = t.getAttribute("role");
8613
8621
  return n ? n.split(/\s+/).filter(Boolean).includes(e) : !1;
8614
8622
  }
8615
8623
  function hf(t) {
8616
- return t.tagName.toLowerCase() === "table" || At(t, "table") || At(t, "grid") || At(t, "treegrid");
8624
+ return t.tagName.toLowerCase() === "table" || Tt(t, "table") || Tt(t, "grid") || Tt(t, "treegrid");
8617
8625
  }
8618
8626
  function df(t) {
8619
- return t.tagName.toLowerCase() === "tr" || At(t, "row");
8627
+ return t.tagName.toLowerCase() === "tr" || Tt(t, "row");
8620
8628
  }
8621
8629
  function ff(t) {
8622
8630
  let e = null;
@@ -8652,7 +8660,7 @@ function ba(t) {
8652
8660
  const { attrRoles: e, presentational: n } = ya(t);
8653
8661
  return e.length > 0 || n;
8654
8662
  }
8655
- function Tt(t) {
8663
+ function et(t) {
8656
8664
  const e = [], n = (o) => {
8657
8665
  e.includes(o) || e.push(o);
8658
8666
  }, { attrRoles: r, presentational: i } = ya(t), s = t.tagName.toLowerCase();
@@ -8784,15 +8792,15 @@ const bf = /* @__PURE__ */ new Set([
8784
8792
  "rtc"
8785
8793
  ]), Sf = ["math", "separator"];
8786
8794
  function Yn(t) {
8787
- return t.role?.some((e) => Sf.includes(e)) ? !1 : !t.audioref && !t.imgref && !t.textref && !t.videoref && (!t.text || ct(t.text)) && !(t.children && t.children.length > 0) && !t.description;
8795
+ return t.role?.some((e) => Sf.includes(e)) ? !1 : !t.audioref && !t.imgref && !t.textref && !t.videoref && (!t.text || ut(t.text)) && !(t.children && t.children.length > 0) && !t.description;
8788
8796
  }
8789
8797
  function vf(t) {
8790
- return !t.audioref && !t.imgref && !t.textref && !t.videoref && (!t.text || ct(t.text)) && !!(t.children && t.children.length > 0) && !(t.role && t.role.length > 0) && !t.id;
8798
+ return !t.audioref && !t.imgref && !t.textref && !t.videoref && (!t.text || ut(t.text)) && !!(t.children && t.children.length > 0) && !(t.role && t.role.length > 0) && !t.id;
8791
8799
  }
8792
8800
  function wf(t) {
8793
8801
  return !(t.role && t.role.length > 0) && !t.id && !t.textref && !t.imgref && !t.audioref && !t.videoref;
8794
8802
  }
8795
- class Et {
8803
+ class Ct {
8796
8804
  el;
8797
8805
  object = {};
8798
8806
  children = [];
@@ -8813,7 +8821,7 @@ class Et {
8813
8821
  const r = e.children[0];
8814
8822
  r.role?.length && e.role.every((i) => r.role.includes(i)) && delete e.role;
8815
8823
  }
8816
- if ((!e.text || ct(e.text)) && e.children?.length === 1) {
8824
+ if ((!e.text || ut(e.text)) && e.children?.length === 1) {
8817
8825
  const r = e.children[0];
8818
8826
  wf(r) && (r.text && (e.text = r.text), e.children = r.children);
8819
8827
  }
@@ -8927,7 +8935,7 @@ function Of(t) {
8927
8935
  function wa(t) {
8928
8936
  return typeof t == "object" && t !== null && t.nodeType === Node.ELEMENT_NODE;
8929
8937
  }
8930
- const ot = {
8938
+ const lt = {
8931
8939
  NONE: "",
8932
8940
  DESCENDANT: " ",
8933
8941
  CHILD: " > "
@@ -8996,7 +9004,7 @@ function Ea(t, e) {
8996
9004
  if (Hi(t))
8997
9005
  return t.contains(e) || jt("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 not work as intended."), t;
8998
9006
  const n = e.getRootNode({ composed: !1 });
8999
- return Hi(n) ? (n.nodeType !== Node.DOCUMENT_NODE && jt("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) : Sr(e);
9007
+ return Hi(n) ? (n.nodeType !== Node.DOCUMENT_NODE && jt("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) : br(e);
9000
9008
  }
9001
9009
  function kn(t) {
9002
9010
  return typeof t == "number" ? t : Number.POSITIVE_INFINITY;
@@ -9018,7 +9026,7 @@ function Ff(t, e = {}) {
9018
9026
  ignoreGeneratedClassNames: Ge(n.ignoreGeneratedClassNames)
9019
9027
  };
9020
9028
  }
9021
- function ut(t = []) {
9029
+ function ht(t = []) {
9022
9030
  const [e = [], ...n] = t;
9023
9031
  return n.length === 0 ? e : n.reduce((r, i) => {
9024
9032
  const s = new Set(i);
@@ -9048,7 +9056,7 @@ function Vt(t) {
9048
9056
  });
9049
9057
  return (n) => e.some((r) => r(n));
9050
9058
  }
9051
- function br(t, e, n) {
9059
+ function yr(t, e, n) {
9052
9060
  const r = Ea(n, t[0]).querySelectorAll(e);
9053
9061
  if (r.length !== t.length)
9054
9062
  return !1;
@@ -9056,7 +9064,7 @@ function br(t, e, n) {
9056
9064
  return t.every((s) => i.has(s));
9057
9065
  }
9058
9066
  function Ca(t, e) {
9059
- e = e ?? Sr(t);
9067
+ e = e ?? br(t);
9060
9068
  const n = [];
9061
9069
  let r = t;
9062
9070
  for (; r && r !== e; )
@@ -9064,12 +9072,12 @@ function Ca(t, e) {
9064
9072
  return n;
9065
9073
  }
9066
9074
  function $f(t, e) {
9067
- return ut(t.map((n) => Ca(n, e)));
9075
+ return ht(t.map((n) => Ca(n, e)));
9068
9076
  }
9069
9077
  function _f(t) {
9070
9078
  return typeof t == "object" && t !== null && "nodeType" in t && t.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in t;
9071
9079
  }
9072
- function Sr(t) {
9080
+ function br(t) {
9073
9081
  return t.ownerDocument.querySelector(":root");
9074
9082
  }
9075
9083
  const ka = ", ", Bf = new RegExp([
@@ -9118,7 +9126,7 @@ function Aa(t, e) {
9118
9126
  }
9119
9127
  function Hf(t, e) {
9120
9128
  const n = t.map((r) => Aa(r));
9121
- return ut(n);
9129
+ return ht(n);
9122
9130
  }
9123
9131
  const Wf = /^[a-z_-]{3,}$/i, Gf = /[bcdfghjklmnpqrstvwxyz]{4,}/i;
9124
9132
  function Kf(t) {
@@ -9147,12 +9155,12 @@ function Ta(t, e) {
9147
9155
  }
9148
9156
  function Jf(t, e) {
9149
9157
  const n = t.map((r) => Ta(r, e));
9150
- return ut(n);
9158
+ return ht(n);
9151
9159
  }
9152
9160
  function Ra(t, e) {
9153
9161
  var n;
9154
9162
  const r = (n = t.getAttribute("id")) !== null && n !== void 0 ? n : "", i = `#${Be(r)}`, s = t.getRootNode({ composed: !1 });
9155
- return !Bf.test(r) && br([t], i, s) ? [i] : [];
9163
+ return !Bf.test(r) && yr([t], i, s) ? [i] : [];
9156
9164
  }
9157
9165
  function Xf(t, e) {
9158
9166
  return t.length === 0 || t.length > 1 ? [] : Ra(t[0]);
@@ -9167,7 +9175,7 @@ function Na(t, e) {
9167
9175
  return [];
9168
9176
  }
9169
9177
  function Yf(t, e) {
9170
- return ut(t.map((n) => Na(n)));
9178
+ return ht(t.map((n) => Na(n)));
9171
9179
  }
9172
9180
  function Da(t, e) {
9173
9181
  return [
@@ -9192,7 +9200,7 @@ function Fa(t, e) {
9192
9200
  return [];
9193
9201
  }
9194
9202
  function Qf(t, e) {
9195
- return ut(t.map((n) => Fa(n)));
9203
+ return ht(t.map((n) => Fa(n)));
9196
9204
  }
9197
9205
  function* La(t = [], { maxResults: e = Number.POSITIVE_INFINITY } = {}) {
9198
9206
  let n = 0, r = Pa(1);
@@ -9345,8 +9353,8 @@ function bg(t = {}) {
9345
9353
  }
9346
9354
  function Sg(t, e) {
9347
9355
  return [
9348
- ...t.map((n) => e + ot.DESCENDANT + n),
9349
- ...t.map((n) => e + ot.CHILD + n)
9356
+ ...t.map((n) => e + lt.DESCENDANT + n),
9357
+ ...t.map((n) => e + lt.CHILD + n)
9350
9358
  ];
9351
9359
  }
9352
9360
  function* vg(t, e) {
@@ -9359,7 +9367,7 @@ function* vg(t, e) {
9359
9367
  function* wg(t, e, n = "", r, i = rn()) {
9360
9368
  const s = hg(t, r, i);
9361
9369
  for (const o of vg(s, n))
9362
- br(t, o, e) && (yield o);
9370
+ yr(t, o, e) && (yield o);
9363
9371
  }
9364
9372
  function* xg(t, e, n = "", r, i = rn()) {
9365
9373
  if (t.length === 0)
@@ -9382,7 +9390,7 @@ function* Eg({ elements: t, root: e, rootSelector: n = "", options: r }) {
9382
9390
  let c = !1;
9383
9391
  for (const l of xg(t, i, s, r, a)) {
9384
9392
  const { foundElements: u, selector: h } = l;
9385
- if (c = !0, br(t, h, e))
9393
+ if (c = !0, yr(t, h, e))
9386
9394
  yield h;
9387
9395
  else {
9388
9396
  i = u[0], s = h;
@@ -9403,7 +9411,7 @@ function kg(t) {
9403
9411
  include: !1
9404
9412
  };
9405
9413
  }
9406
- function Og(t, e, n = ot.NONE) {
9414
+ function Og(t, e, n = lt.NONE) {
9407
9415
  const r = {};
9408
9416
  return e.forEach((i) => {
9409
9417
  Reflect.set(r, i, og(t, i).map(kg));
@@ -9431,7 +9439,7 @@ function Tg(t, e) {
9431
9439
  o,
9432
9440
  [$.nthchild],
9433
9441
  // do not use child combinator for the first element in ShadowRoot
9434
- r && a === 0 ? ot.NONE : ot.CHILD
9442
+ r && a === 0 ? lt.NONE : lt.CHILD
9435
9443
  );
9436
9444
  return ((c = l.selectors.nthchild) !== null && c !== void 0 ? c : []).forEach((u) => {
9437
9445
  u.include = !0;
@@ -9456,7 +9464,7 @@ function $a(t, e = {}) {
9456
9464
  }
9457
9465
  function* Dg(t, e = {}) {
9458
9466
  var n;
9459
- const r = Cg(t), i = Ff(r[0], e), s = (n = i.root) !== null && n !== void 0 ? n : Sr(r[0]);
9467
+ const r = Cg(t), i = Ff(r[0], e), s = (n = i.root) !== null && n !== void 0 ? n : br(r[0]);
9460
9468
  let o = 0;
9461
9469
  for (const c of Eg({
9462
9470
  elements: r,
@@ -9474,7 +9482,7 @@ function* Dg(t, e = {}) {
9474
9482
  const a = e.root !== void 0;
9475
9483
  yield Rg(r, i.useScope || a ? s : void 0);
9476
9484
  }
9477
- function vr(t, e) {
9485
+ function Sr(t, e) {
9478
9486
  const n = t.getAttribute("id");
9479
9487
  return n ? `#${CSS.escape(n)}` : $a(t, { root: e?.documentElement ?? void 0 }) ?? void 0;
9480
9488
  }
@@ -9494,7 +9502,7 @@ function Fg(t, e) {
9494
9502
  function Gi(t, e, n, r) {
9495
9503
  const i = t.parentElement;
9496
9504
  if (!i) return;
9497
- const s = r && i === r.el ? r.selector : vr(i, n);
9505
+ const s = r && i === r.el ? r.selector : Sr(i, n);
9498
9506
  if (s)
9499
9507
  return { cssSelector: s, textNodeIndex: Fg(i, t), charOffset: e };
9500
9508
  }
@@ -9506,7 +9514,7 @@ function Lg(t, e, n) {
9506
9514
  }
9507
9515
  function Pg(t) {
9508
9516
  const e = Mu(t);
9509
- return e.status === he.SUCCESS ? e.fragment : void 0;
9517
+ return e.status === de.SUCCESS ? e.fragment : void 0;
9510
9518
  }
9511
9519
  function Ki(t) {
9512
9520
  if (t === !0) return (e) => e.length > 0;
@@ -9541,10 +9549,15 @@ class Bg {
9541
9549
  return this.claimed.has(e) ? !1 : (this.claimed.add(e), !0);
9542
9550
  }
9543
9551
  }
9544
- function Ug(t, e, n) {
9552
+ function Ug(t) {
9553
+ for (let e = t.parentElement; e; e = e.parentElement)
9554
+ if (et(e).includes("endnotes")) return !0;
9555
+ return !1;
9556
+ }
9557
+ function qg(t, e, n) {
9545
9558
  const r = [], i = (s, o) => {
9546
9559
  const a = s.getAttribute("id");
9547
- if (a && !e.has(a) && e.set(a, s), o = o || s.getAttribute("aria-hidden") === "true" || s.hasAttribute("hidden"), !o && s.tagName.toLowerCase() === "a" && Tt(s).includes("noteref")) {
9560
+ if (a && !e.has(a) && e.set(a, s), o = o || s.getAttribute("aria-hidden") === "true" || s.hasAttribute("hidden"), !o && s.tagName.toLowerCase() === "a" && et(s).includes("noteref")) {
9548
9561
  const l = s.getAttribute("href") ?? "";
9549
9562
  l.startsWith("#") && r.push({ id: l.slice(1), ref: s });
9550
9563
  }
@@ -9553,21 +9566,21 @@ function Ug(t, e, n) {
9553
9566
  i(t, !1);
9554
9567
  for (const s of r) {
9555
9568
  const o = e.get(s.id);
9556
- o && (va(o, s.ref) || n.add(o));
9569
+ o && (va(o, s.ref) || Ug(o) || n.add(o));
9557
9570
  }
9558
9571
  }
9559
- function qg(t, e, n, r) {
9572
+ function zg(t, e, n, r) {
9560
9573
  const i = { role: r }, s = (e.getAttribute("title") ?? "").trim();
9561
9574
  s ? i.text = { plain: s, ssml: "", language: "" } : n && (i.text = { plain: n.plain ?? "", ssml: n.ssml ?? "", language: n.language });
9562
- const o = !!(i.text && !ct(i.text)), a = !t.xmlParsed && (Ef(e) || o && e.firstChild !== null);
9575
+ const o = !!(i.text && !ut(i.text)), a = !t.xmlParsed && (Ef(e) || o && e.firstChild !== null);
9563
9576
  if (!o && !a) {
9564
9577
  const u = nn(e);
9565
9578
  u && (i.text = { plain: u, ssml: "", language: "" });
9566
9579
  }
9567
- const c = vr(e, t.docRoot), l = _a(c);
9580
+ const c = Sr(e, t.docRoot), l = _a(c);
9568
9581
  return l && (i.textref = l), t.placeholder(e, "pagebreak", i), a;
9569
9582
  }
9570
- function zg(t, e, n) {
9583
+ function jg(t, e, n) {
9571
9584
  const r = { role: n }, i = nn(e);
9572
9585
  i && (r.text = { plain: i, ssml: "", language: "" });
9573
9586
  const s = e.getAttribute("href") ?? "";
@@ -9586,7 +9599,7 @@ function zg(t, e, n) {
9586
9599
  }
9587
9600
  !r.children && s && (r.children = [{ textref: s }]), t.placeholder(e, "noteref", r, o || void 0);
9588
9601
  }
9589
- function jg(t, e, n, r) {
9602
+ function Vg(t, e, n, r) {
9590
9603
  const i = {};
9591
9604
  if (n.length > 0 && (i.role = n), r)
9592
9605
  i.text = { plain: r.plain ?? "", ssml: r.ssml ?? "", language: r.language };
@@ -9597,9 +9610,9 @@ function jg(t, e, n, r) {
9597
9610
  const s = e.getAttribute("href");
9598
9611
  s && (i.textref = s), t.placeholder(e, n[0] ?? "link", i);
9599
9612
  }
9600
- const Vg = 3, Mg = 1, Hg = /* @__PURE__ */ new Set(["summary", "dfn", "span"]);
9613
+ const Mg = 3, Hg = 1, Wg = /* @__PURE__ */ new Set(["summary", "dfn", "span"]);
9601
9614
  function Ji(t, e) {
9602
- return Hg.has(t) && e.length > 0 ? !0 : !kf(t);
9615
+ return Wg.has(t) && e.length > 0 ? !0 : !kf(t);
9603
9616
  }
9604
9617
  class Mt {
9605
9618
  xmlParsed;
@@ -9616,7 +9629,7 @@ class Mt {
9616
9629
  // see TextrefOptions.textFragment in options.ts.
9617
9630
  textFragmentEnabled = !1;
9618
9631
  docRoot = null;
9619
- root = new Et();
9632
+ root = new Ct();
9620
9633
  current = this.root;
9621
9634
  // Captions whose text was already folded into a table's `description` —
9622
9635
  // only these specific elements go silent, not the whole table (rows/cells
@@ -9651,7 +9664,7 @@ class Mt {
9651
9664
  return r.ids = this.ids, r.suppressed = this.suppressed, r.idAlloc = this.idAlloc, r.noterefDepth = this.noterefDepth + n, r.allowNode = e, r.docRoot = this.docRoot, r.selectorPredicate = this.selectorPredicate, r.domRangeEnabled = this.domRangeEnabled, r.textFragmentEnabled = this.textFragmentEnabled, r;
9652
9665
  }
9653
9666
  prescan(e) {
9654
- Ug(e, this.ids, this.suppressed);
9667
+ qg(e, this.ids, this.suppressed);
9655
9668
  }
9656
9669
  // Converts root itself — used when root is meaningful content in its own
9657
9670
  // right (e.g. a footnote element referenced by a noteref), not just a
@@ -9674,18 +9687,18 @@ class Mt {
9674
9687
  // An explicit-role descendant is content in its own right and skips
9675
9688
  // inherited `noText` — except `caption`, always the already-folded source.
9676
9689
  descend(e, n) {
9677
- const r = new Et();
9690
+ const r = new Ct();
9678
9691
  r.el = e, r.noText = this.foldedCaptions.has(e) || (!ba(e) || n.includes("caption")) && this.current.noText, this.current.children.push(r), this.current = r;
9679
9692
  }
9680
9693
  appendChild(e) {
9681
9694
  e.noText = this.current.noText, this.current.children.push(e);
9682
9695
  }
9683
9696
  walk(e) {
9684
- if (e.nodeType === Vg) {
9697
+ if (e.nodeType === Mg) {
9685
9698
  this.text(e);
9686
9699
  return;
9687
9700
  }
9688
- if (e.nodeType !== Mg) return;
9701
+ if (e.nodeType !== Hg) return;
9689
9702
  const n = e, r = this.current, i = this.head(n);
9690
9703
  if (!i)
9691
9704
  for (let s = n.firstChild; s; s = s.nextSibling) this.walk(s);
@@ -9698,17 +9711,17 @@ class Mt {
9698
9711
  if (bf.has(n) || this.suppressed.has(e) && e !== this.allowNode) return !0;
9699
9712
  const [r, i] = pf(e);
9700
9713
  if (!i && e !== this.allowNode) return !0;
9701
- const s = Tt(e);
9714
+ const s = et(e);
9702
9715
  if ((n === "img" || n === "svg") && (s.includes("presentation") || r === null && e.hasAttribute("alt") && e.getAttribute("alt").trim() === ""))
9703
9716
  return !0;
9704
9717
  if (n === "br")
9705
9718
  return this.current.noText || (this.closeSegment(), this.segments.push({ kind: "break" }), this.flowEndsWithSpace = !0), !0;
9706
9719
  if (s.includes("pagebreak"))
9707
- return !qg(this, e, r, s);
9720
+ return !zg(this, e, r, s);
9708
9721
  if (n === "a" && s.includes("noteref") && e.getAttribute("href"))
9709
- return zg(this, e, s), !0;
9722
+ return jg(this, e, s), !0;
9710
9723
  if (n === "a" && e.getAttribute("href"))
9711
- return jg(this, e, s, r), !0;
9724
+ return Vg(this, e, s, r), !0;
9712
9725
  if (n === "img") {
9713
9726
  const c = { role: s }, l = e.getAttribute("src");
9714
9727
  return l && (c.imgref = l), r && (c.description = r.plain), this.placeholder(e, "image", c), !0;
@@ -9753,12 +9766,12 @@ class Mt {
9753
9766
  // of speaking that child separately.
9754
9767
  implicitCaptionOf(e) {
9755
9768
  for (let n = e.firstElementChild; n; n = n.nextElementSibling)
9756
- if (Tt(n).includes("caption") && !n.getAttribute("aria-labelledby")) return n;
9769
+ if (et(n).includes("caption") && !n.getAttribute("aria-labelledby")) return n;
9757
9770
  return null;
9758
9771
  }
9759
9772
  tail(e, n, r) {
9760
9773
  if (n) return;
9761
- const i = e.tagName.toLowerCase(), s = Tt(e);
9774
+ const i = e.tagName.toLowerCase(), s = et(e);
9762
9775
  Ji(i, s) && (this.flushText(), this.selectorPredicate?.(s) && this.applyTextref(e), this.current = r);
9763
9776
  }
9764
9777
  // Sets cur.textref to a reference for el: the base id-or-selector
@@ -9771,7 +9784,7 @@ class Mt {
9771
9784
  // generate a fragment from) — each an independent option, applied in this
9772
9785
  // fixed order regardless of which others are also enabled.
9773
9786
  applyTextref(e) {
9774
- const n = this.current.object, r = vr(e, this.docRoot);
9787
+ const n = this.current.object, r = Sr(e, this.docRoot);
9775
9788
  if (n.textref = _a(r), this.domRangeEnabled && this.lastFlowRange) {
9776
9789
  const i = r ? { el: e, selector: r } : void 0, s = Lg(this.lastFlowRange, this.docRoot, i);
9777
9790
  s && (n.textref = Sd(s));
@@ -9818,7 +9831,7 @@ class Mt {
9818
9831
  }
9819
9832
  placeholder(e, n, r, i) {
9820
9833
  if (Yn(r)) return;
9821
- const s = new Et();
9834
+ const s = new Ct();
9822
9835
  if (s.el = e, s.object = r, this.current.noText) {
9823
9836
  this.appendChild(s);
9824
9837
  return;
@@ -9842,12 +9855,12 @@ class Mt {
9842
9855
  continue;
9843
9856
  }
9844
9857
  if (S.kind === "text") {
9845
- const w = S.text.replace(/^\s+/, "");
9846
- if (w === "") {
9858
+ const x = S.text.replace(/^\s+/, "");
9859
+ if (x === "") {
9847
9860
  e = e.slice(1);
9848
9861
  continue;
9849
9862
  }
9850
- e = [{ ...S, text: w }, ...e.slice(1)];
9863
+ e = [{ ...S, text: x }, ...e.slice(1)];
9851
9864
  }
9852
9865
  break;
9853
9866
  }
@@ -9858,12 +9871,12 @@ class Mt {
9858
9871
  continue;
9859
9872
  }
9860
9873
  if (S.kind === "text") {
9861
- const w = S.text.replace(/\s+$/, "");
9862
- if (w === "") {
9874
+ const x = S.text.replace(/\s+$/, "");
9875
+ if (x === "") {
9863
9876
  e = e.slice(0, -1);
9864
9877
  continue;
9865
9878
  }
9866
- e = [...e.slice(0, -1), { ...S, text: w }];
9879
+ e = [...e.slice(0, -1), { ...S, text: x }];
9867
9880
  }
9868
9881
  break;
9869
9882
  }
@@ -9874,8 +9887,8 @@ class Mt {
9874
9887
  const c = [];
9875
9888
  for (const S of e)
9876
9889
  if (S.kind === "text" && S.text.trim() !== "") {
9877
- const w = S.ctx.lang;
9878
- c.includes(w) || c.push(w);
9890
+ const x = S.ctx.lang;
9891
+ c.includes(x) || c.push(x);
9879
9892
  }
9880
9893
  let l = Vi(this.current.el ?? null);
9881
9894
  c.length === 1 && c[0] !== "" && (l = c[0]);
@@ -9888,55 +9901,55 @@ class Mt {
9888
9901
  if (u && l === "" && (l = "en"), u)
9889
9902
  for (const S of e) {
9890
9903
  if (S.kind !== "placeholder") continue;
9891
- let w = S.candidateID;
9892
- (!w || !this.idAlloc.claim(w)) && (w = this.idAlloc.allocate(S.tag, (T) => this.ids.has(T))), S.child.object.id = w;
9904
+ let x = S.candidateID;
9905
+ (!x || !this.idAlloc.claim(x)) && (x = this.idAlloc.allocate(S.tag, (R) => this.ids.has(R))), S.child.object.id = x;
9893
9906
  }
9894
9907
  let h = "", d = !1, g = !1, p = !1, m = !1;
9895
9908
  for (const S of e)
9896
9909
  if (S.kind === "text") {
9897
- const w = S.text.startsWith(" "), T = S.text.replace(/^ +| +$/g, "");
9898
- if (T === "") {
9910
+ const x = S.text.startsWith(" "), R = S.text.replace(/^ +| +$/g, "");
9911
+ if (R === "") {
9899
9912
  m = !0;
9900
9913
  continue;
9901
9914
  }
9902
- let I = !1;
9915
+ let F = !1;
9903
9916
  if (h.length > 0) {
9904
- const P = d || m || w;
9905
- g ? I = !0 : p ? I = P && !Yt(T) : I = P;
9917
+ const P = d || m || x;
9918
+ g ? F = !0 : p ? F = P && !Yt(R) : F = P;
9906
9919
  }
9907
- I && (h += " "), h += T, d = S.text.endsWith(" "), g = !1, p = !1, m = !1;
9920
+ F && (h += " "), h += R, d = S.text.endsWith(" "), g = !1, p = !1, m = !1;
9908
9921
  } else S.kind === "break" ? g = !0 : S.kind === "placeholder" && (p = !0);
9909
9922
  const b = e.some((S) => S.kind === "placeholder");
9910
9923
  this.lastFlowText = h.trim();
9911
- const x = {
9924
+ const w = {
9912
9925
  plain: u && !b ? "" : h.trim(),
9913
9926
  ssml: "",
9914
9927
  language: l
9915
9928
  };
9916
9929
  if (u) {
9917
9930
  let S = "";
9918
- for (const w of e)
9919
- if (w.kind === "text") {
9920
- let T = w.ctx.tag, I = w.ctx.attrs;
9921
- if (w.ctx.lang !== l && w.ctx.lang !== "" && (T = "lang", I = void 0), T) {
9922
- S += `<${T}`;
9923
- for (const [P, X] of Object.entries(I ?? {}))
9931
+ for (const x of e)
9932
+ if (x.kind === "text") {
9933
+ let R = x.ctx.tag, F = x.ctx.attrs;
9934
+ if (x.ctx.lang !== l && x.ctx.lang !== "" && (R = "lang", F = void 0), R) {
9935
+ S += `<${R}`;
9936
+ for (const [P, X] of Object.entries(F ?? {}))
9924
9937
  S += ` ${P}="${En(X)}"`;
9925
- w.ctx.lang !== l && w.ctx.lang !== "" && (S += ` xml:lang="${En(w.ctx.lang)}"`), S += `>${zt(w.text)}</${T}>`;
9938
+ x.ctx.lang !== l && x.ctx.lang !== "" && (S += ` xml:lang="${En(x.ctx.lang)}"`), S += `>${zt(x.text)}</${R}>`;
9926
9939
  } else
9927
- S += zt(w.text);
9928
- } else w.kind === "break" ? S += "<break/>" : w.kind === "placeholder" && (S += `<readium:${w.tag} id="${En(w.child.object.id)}" />`);
9929
- x.ssml = S;
9940
+ S += zt(x.text);
9941
+ } else x.kind === "break" ? S += "<break/>" : x.kind === "placeholder" && (S += `<readium:${x.tag} id="${En(x.child.object.id)}" />`);
9942
+ w.ssml = S;
9930
9943
  }
9931
- const A = new Et();
9932
- A.object = { text: x };
9944
+ const O = new Ct();
9945
+ O.object = { text: w };
9933
9946
  for (const S of n)
9934
- A.children.push(S);
9935
- this.appendChild(A), r && s && (this.lastFlowRange = { first: [r, i], last: [s, o] });
9947
+ O.children.push(S);
9948
+ this.appendChild(O), r && s && (this.lastFlowRange = { first: [r, i], last: [s, o] });
9936
9949
  }
9937
9950
  }
9938
- const Wg = /<body[\s>]/i;
9939
- function Gg(t, e, n) {
9951
+ const Gg = /<body[\s>]/i;
9952
+ function Kg(t, e, n) {
9940
9953
  const { predicate: r, domRange: i, textFragment: s } = _g(n?.textrefs);
9941
9954
  if (typeof t != "string") {
9942
9955
  const u = e ?? (t.ownerDocument.contentType === "text/html" ? "text/html" : "application/xhtml+xml"), h = new Mt(u === "application/xhtml+xml");
@@ -9945,49 +9958,49 @@ function Gg(t, e, n) {
9945
9958
  const o = e ?? Of(t), a = new DOMParser().parseFromString(t, o), c = new Mt(o === "application/xhtml+xml");
9946
9959
  c.selectorPredicate = r, c.textFragmentEnabled = s, c.docRoot = a;
9947
9960
  const l = a.querySelector("body");
9948
- return l && !Wg.test(t) ? c.convertChildren(l) : c.convert(l ?? a.documentElement), c.result();
9961
+ return l && !Gg.test(t) ? c.convertChildren(l) : c.convert(l ?? a.documentElement), c.result();
9949
9962
  }
9950
- function cp(t, e, n) {
9951
- return { guided: Gg(t, e, n) };
9963
+ function up(t, e, n) {
9964
+ return { guided: Kg(t, e, n) };
9952
9965
  }
9953
9966
  export {
9954
9967
  Rh as BUILTIN_DECORATION_TYPES,
9955
9968
  zh as BooleanPreference,
9956
9969
  $h as DecorationController,
9957
9970
  kh as DecorationLayout,
9958
- R as DecorationStyleType,
9971
+ T as DecorationStyleType,
9959
9972
  Ch as DecorationWidth,
9960
9973
  Th as Decorator,
9961
9974
  Fh as DirectCommsChannel,
9962
9975
  Lh as DirectCommsFrame,
9963
9976
  Ph as DirectCommsHost,
9964
- bt as EnumPreference,
9965
- Qg as FallbackEngineProvider,
9977
+ St as EnumPreference,
9978
+ Zg as FallbackEngineProvider,
9966
9979
  bu as FallbackSpeechEngine,
9967
9980
  js as Locator,
9968
9981
  Ae as LocatorLocations,
9969
9982
  qs as LocatorText,
9970
9983
  Zt as Preference,
9971
- St as RangePreference,
9984
+ vt as RangePreference,
9972
9985
  Uh as ReadiumSpeechDecorationController,
9973
- lp as ReadiumSpeechNavigator,
9974
- ip as ReadiumSpeechProviderRegistry,
9986
+ cp as ReadiumSpeechNavigator,
9987
+ sp as ReadiumSpeechProviderRegistry,
9975
9988
  qh as SpeechDefaults,
9976
- it as SpeechPreferences,
9977
- bi as SpeechPreferencesEditor,
9989
+ st as SpeechPreferences,
9990
+ yi as SpeechPreferencesEditor,
9978
9991
  ys as SpeechServerAudioDecodeError,
9979
9992
  gu as SpeechServerEngine,
9980
- Yg as SpeechServerEngineProvider,
9981
- nt as SpeechServerError,
9993
+ Qg as SpeechServerEngineProvider,
9994
+ rt as SpeechServerError,
9982
9995
  bs as SpeechServerNetworkError,
9983
9996
  ms as SpeechServerStallError,
9984
- Si as SpeechSettings,
9985
- yi as StringArrayPreference,
9986
- Wr as WebSpeechEngine,
9987
- Xg as WebSpeechEngineProvider,
9997
+ bi as SpeechSettings,
9998
+ mi as StringArrayPreference,
9999
+ Hr as WebSpeechEngine,
10000
+ Yg as WebSpeechEngineProvider,
9988
10001
  L as WebSpeechVoiceManager,
9989
10002
  $d as blockLevelRoles,
9990
- et as chineseVariantMap,
10003
+ tt as chineseVariantMap,
9991
10004
  Zc as chunkPlainText,
9992
10005
  tu as chunkSsmlText,
9993
10006
  Hh as contextualizationShapesAtVerbosity,
@@ -9995,23 +10008,23 @@ export {
9995
10008
  Bh as createLocator,
9996
10009
  bd as decodeCssSelectorFragment,
9997
10010
  vd as decodeDomRangeFragment,
9998
- Ii as decodeTextref,
10011
+ Di as decodeTextref,
9999
10012
  Ih as decorationsEqual,
10000
10013
  ia as defaultContextualizations,
10001
10014
  yd as encodeCssSelectorFragment,
10002
10015
  Sd as encodeDomRangeFragment,
10003
- op as extractUtterances,
10016
+ lp as extractUtterances,
10004
10017
  pu as isRecoverableFailure,
10005
- cp as makeGnd,
10018
+ up as makeGnd,
10006
10019
  ps as mapServerVoice,
10007
10020
  ru as mimeTypeForFormat,
10008
- Gg as parseMarkup,
10009
- gi as resolveDecorationForWire,
10021
+ Kg as parseMarkup,
10022
+ fi as resolveDecorationForWire,
10010
10023
  cu as selectBitrate,
10011
10024
  au as selectFormat,
10012
- rp as setupDecorations,
10013
- sp as shapeableRoles,
10014
- ap as skippableRoles,
10025
+ ip as setupDecorations,
10026
+ ap as shapeableRoles,
10027
+ op as skippableRoles,
10015
10028
  Vh as skippedAtVerbosity,
10016
10029
  Nh as supportsDecorationStyle,
10017
10030
  Ye as toSpeechServerError