@pie-players/pie-tool-line-reader 0.3.60 → 0.3.61

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.
@@ -34,7 +34,7 @@ function Xi() {
34
34
  reject: t
35
35
  };
36
36
  }
37
- var gd = 1 << 24, te = 1024, re = 2048, et = 4096, Sr = 8192, ma = 16384, wr = 32768, Zr = 1 << 25, kr = 65536, vd = 1 << 17, md = 1 << 18, bt = 1 << 19, ya = 1 << 20, Nt = 65536, ei = 1 << 21, ba = 1 << 22, cn = 1 << 23, Ot = /* @__PURE__ */ Symbol("$state"), Ji = /* @__PURE__ */ Symbol("legacy props"), Ta = /* @__PURE__ */ Symbol(""), _a = /* @__PURE__ */ Symbol("proxy path"), Gn = /* @__PURE__ */ Symbol("attributes"), Yn = /* @__PURE__ */ Symbol("class"), Kn = /* @__PURE__ */ Symbol("style"), Jt = /* @__PURE__ */ Symbol("text");
37
+ var gd = 1 << 24, te = 1024, re = 2048, et = 4096, Sr = 8192, ma = 16384, wr = 32768, Zr = 1 << 25, kr = 65536, vd = 1 << 17, md = 1 << 18, yt = 1 << 19, ba = 1 << 20, Nt = 65536, ei = 1 << 21, ya = 1 << 22, cn = 1 << 23, Ot = /* @__PURE__ */ Symbol("$state"), Ji = /* @__PURE__ */ Symbol("legacy props"), Ta = /* @__PURE__ */ Symbol(""), _a = /* @__PURE__ */ Symbol("proxy path"), Gn = /* @__PURE__ */ Symbol("attributes"), Yn = /* @__PURE__ */ Symbol("class"), Kn = /* @__PURE__ */ Symbol("style"), Jt = /* @__PURE__ */ Symbol("text");
38
38
  var wn = new class extends Error {
39
39
  constructor(...t) {
40
40
  super(...t), g(this, "name", "StaleReactionError"), g(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
@@ -55,10 +55,10 @@ function Ea() {
55
55
  function Aa(e) {
56
56
  throw new Error("https://svelte.dev/e/effect_orphan");
57
57
  }
58
- function Ma() {
58
+ function Ca() {
59
59
  throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
60
60
  }
61
- function Ca() {
61
+ function Ma() {
62
62
  throw new Error("https://svelte.dev/e/hydration_failed");
63
63
  }
64
64
  function Oa(e) {
@@ -169,7 +169,7 @@ function ro(e) {
169
169
  var t = L, n = t.e;
170
170
  if (n !== null) {
171
171
  t.e = null;
172
- for (var r of n) Co(r);
172
+ for (var r of n) Mo(r);
173
173
  }
174
174
  return e !== void 0 && (t.x = e), t.i = !0, L = t.p, e ?? {};
175
175
  }
@@ -524,7 +524,7 @@ function Ga() {
524
524
  return f ? f[0] !== h[0] || f[1] !== h[1] : !0;
525
525
  }).map(([u]) => u);
526
526
  if (a.length > 0)
527
- for (const u of d(Qn, this)) (u.f & 155648) === 0 && Mr(u, a, o) && ((u.f & 4194320) !== 0 ? (N(u, re), c.schedule(u)) : d(Je, c).add(u));
527
+ for (const u of d(Qn, this)) (u.f & 155648) === 0 && Cr(u, a, o) && ((u.f & 4194320) !== 0 ? (N(u, re), c.schedule(u)) : d(Je, c).add(u));
528
528
  if (d(Z, c).length > 0 && !d(Et, c)) {
529
529
  c.apply();
530
530
  for (var l of d(Z, c)) k(W, c, fo).call(c, l, [], []);
@@ -561,7 +561,7 @@ function Ya() {
561
561
  var t;
562
562
  }
563
563
  try {
564
- Ma();
564
+ Ca();
565
565
  } catch (n) {
566
566
  Pe(n, Jn);
567
567
  }
@@ -595,20 +595,20 @@ function po(e, t, n, r) {
595
595
  if (!n.has(e) && (n.add(e), e.reactions !== null))
596
596
  for (const i of e.reactions) {
597
597
  const o = i.f;
598
- (o & 2) !== 0 ? po(i, t, n, r) : (o & 4194320) !== 0 && (o & 2048) === 0 && Mr(i, t, r) && (N(i, re), Cr(i));
598
+ (o & 2) !== 0 ? po(i, t, n, r) : (o & 4194320) !== 0 && (o & 2048) === 0 && Cr(i, t, r) && (N(i, re), Mr(i));
599
599
  }
600
600
  }
601
- function Mr(e, t, n) {
601
+ function Cr(e, t, n) {
602
602
  const r = n.get(e);
603
603
  if (r !== void 0) return r;
604
604
  if (e.deps !== null) for (const i of e.deps) {
605
605
  if (sn.call(t, i)) return !0;
606
- if ((i.f & 2) !== 0 && Mr(i, t, n))
606
+ if ((i.f & 2) !== 0 && Cr(i, t, n))
607
607
  return n.set(i, !0), !0;
608
608
  }
609
609
  return n.set(e, !1), !1;
610
610
  }
611
- function Cr(e) {
611
+ function Mr(e) {
612
612
  x.schedule(e);
613
613
  }
614
614
  function go(e, t) {
@@ -633,7 +633,7 @@ function Ka(e) {
633
633
  })));
634
634
  };
635
635
  }
636
- var Xa = kr | bt;
636
+ var Xa = kr | yt;
637
637
  function Ja(e, t, n, r) {
638
638
  new Qa(e, t, n, r);
639
639
  }
@@ -666,8 +666,8 @@ var ae = /* @__PURE__ */ new WeakMap(), er = /* @__PURE__ */ new WeakMap(), de =
666
666
  return !!d(de, this).pending;
667
667
  }
668
668
  update_pending_count(e, t) {
669
- k(j, this, yo).call(this, e, t), T(st, this, d(st, this) + e), !(!d(Ne, this) || d(Yt, this)) && (T(Yt, this, !0), pt(() => {
670
- T(Yt, this, !1), d(Ne, this) && yn(d(Ne, this), d(st, this));
669
+ k(j, this, bo).call(this, e, t), T(st, this, d(st, this) + e), !(!d(Ne, this) || d(Yt, this)) && (T(Yt, this, !0), pt(() => {
670
+ T(Yt, this, !1), d(Ne, this) && bn(d(Ne, this), d(st, this));
671
671
  }));
672
672
  }
673
673
  get_effect_pending() {
@@ -731,11 +731,11 @@ function rr(e) {
731
731
  ge(t), ne(n), ft(r);
732
732
  }
733
733
  }
734
- function yo(e, t) {
734
+ function bo(e, t) {
735
735
  if (!this.has_pending_snippet()) {
736
736
  if (this.parent) {
737
737
  var n;
738
- k(j, n = this.parent, yo).call(n, e, t);
738
+ k(j, n = this.parent, bo).call(n, e, t);
739
739
  }
740
740
  return;
741
741
  }
@@ -805,7 +805,7 @@ function nl(e, t, n, r) {
805
805
  vn();
806
806
  }
807
807
  }
808
- var u = bo();
808
+ var u = yo();
809
809
  if (n.length === 0) {
810
810
  l.then(() => c(t.map(i))).finally(u);
811
811
  return;
@@ -827,7 +827,7 @@ function rl() {
827
827
  function vn(e = !0) {
828
828
  ge(null), ne(null), ft(null), e && x?.deactivate();
829
829
  }
830
- function bo() {
830
+ function yo() {
831
831
  var e = S, t = e.b, n = x, r = !!t?.is_rendered();
832
832
  return t?.update_pending_count(1, n), n.increment(r, e), () => {
833
833
  t?.update_pending_count(-1, n), n.decrement(r, e);
@@ -836,7 +836,7 @@ function bo() {
836
836
  // @__NO_SIDE_EFFECTS__
837
837
  function Lt(e) {
838
838
  var t = 2 | re;
839
- return S !== null && (S.f |= bt), {
839
+ return S !== null && (S.f |= yt), {
840
840
  ctx: L,
841
841
  deps: null,
842
842
  effects: null,
@@ -857,7 +857,7 @@ function il(e, t, n) {
857
857
  let r = S;
858
858
  r === null && ka();
859
859
  var i = void 0, o = Ht(B), s = !A, a = /* @__PURE__ */ new Set();
860
- return bl(() => {
860
+ return yl(() => {
861
861
  var l = S, c = Xi();
862
862
  i = c.promise;
863
863
  try {
@@ -869,13 +869,13 @@ function il(e, t, n) {
869
869
  }
870
870
  var u = x;
871
871
  if (s) {
872
- if ((l.f & 32768) !== 0) var h = bo();
872
+ if ((l.f & 32768) !== 0) var h = yo();
873
873
  if (r.b?.is_rendered()) u.async_deriveds.get(l)?.reject(Kt);
874
874
  else for (const p of a.values()) p.reject(Kt);
875
875
  a.add(c), u.async_deriveds.set(l, c);
876
876
  }
877
877
  const f = (p, m = void 0) => {
878
- h?.(), a.delete(c), m !== Kt && (u.activate(), m ? (o.f |= cn, yn(o, m)) : ((o.f & 8388608) !== 0 && (o.f ^= cn), yn(o, p)), u.deactivate());
878
+ h?.(), a.delete(c), m !== Kt && (u.activate(), m ? (o.f |= cn, bn(o, m)) : ((o.f & 8388608) !== 0 && (o.f ^= cn), bn(o, p)), u.deactivate());
879
879
  };
880
880
  c.promise.then(f, (p) => f(null, p || "unknown"));
881
881
  }), vl(() => {
@@ -965,9 +965,9 @@ function al(e, t = !1, n = !0) {
965
965
  function $(e, t, n = !1) {
966
966
  A !== null && (!se || (A.f & 131072) !== 0) && zt() && (A.f & 4325394) !== 0 && (le === null || !le.has(e)) && Ra();
967
967
  let r = n ? fe(t) : t;
968
- return yn(e, r, hn);
968
+ return bn(e, r, hn);
969
969
  }
970
- function yn(e, t, n = null) {
970
+ function bn(e, t, n = null) {
971
971
  if (!e.equals(t)) {
972
972
  Ge.set(e, ke ? t : e.v);
973
973
  var r = tt.ensure();
@@ -1009,7 +1009,7 @@ function ko(e, t, n) {
1009
1009
  q?.delete(u), (l & 65536) === 0 && (l & 512 && (S === null || (S.f & 2097152) === 0) && (a.f |= Nt), ko(u, et, n));
1010
1010
  } else if (c) {
1011
1011
  var h = a;
1012
- (l & 16) !== 0 && he !== null && he.add(h), n !== null ? n.push(h) : Cr(h);
1012
+ (l & 16) !== 0 && he !== null && he.add(h), n !== null ? n.push(h) : Mr(h);
1013
1013
  }
1014
1014
  }
1015
1015
  }
@@ -1041,8 +1041,8 @@ function fe(e) {
1041
1041
  (!("value" in p) || p.configurable === !1 || p.enumerable === !1 || p.writable === !1) && Ia();
1042
1042
  var m = n.get(f);
1043
1043
  return m === void 0 ? a(() => {
1044
- var y = /* @__PURE__ */ z(p.value, o);
1045
- return n.set(f, y), y;
1044
+ var b = /* @__PURE__ */ z(p.value, o);
1045
+ return n.set(f, b), b;
1046
1046
  }) : $(m, p.value, !0), !0;
1047
1047
  },
1048
1048
  deleteProperty(h, f) {
@@ -1058,13 +1058,13 @@ function fe(e) {
1058
1058
  },
1059
1059
  get(h, f, p) {
1060
1060
  if (f === Ot) return e;
1061
- var m = n.get(f), y = f in h;
1062
- if (m === void 0 && (!y || je(h, f)?.writable) && (m = a(() => {
1063
- var E = /* @__PURE__ */ z(fe(y ? h[f] : B), o);
1061
+ var m = n.get(f), b = f in h;
1062
+ if (m === void 0 && (!b || je(h, f)?.writable) && (m = a(() => {
1063
+ var E = /* @__PURE__ */ z(fe(b ? h[f] : B), o);
1064
1064
  return E;
1065
1065
  }), n.set(f, m)), m !== void 0) {
1066
- var b = v(m);
1067
- return b === B ? void 0 : b;
1066
+ var y = v(m);
1067
+ return y === B ? void 0 : y;
1068
1068
  }
1069
1069
  return Reflect.get(h, f, p);
1070
1070
  },
@@ -1074,11 +1074,11 @@ function fe(e) {
1074
1074
  var m = n.get(f);
1075
1075
  m && (p.value = v(m));
1076
1076
  } else if (p === void 0) {
1077
- var y = n.get(f), b = y?.v;
1078
- if (y !== void 0 && b !== B) return {
1077
+ var b = n.get(f), y = b?.v;
1078
+ if (b !== void 0 && y !== B) return {
1079
1079
  enumerable: !0,
1080
1080
  configurable: !0,
1081
- value: b,
1081
+ value: y,
1082
1082
  writable: !0
1083
1083
  };
1084
1084
  }
@@ -1088,25 +1088,25 @@ function fe(e) {
1088
1088
  if (f === Ot) return !0;
1089
1089
  var p = n.get(f), m = p !== void 0 && p.v !== B || Reflect.has(h, f);
1090
1090
  return (p !== void 0 || S !== null && (!m || je(h, f)?.writable)) && (p === void 0 && (p = a(() => {
1091
- var y = /* @__PURE__ */ z(m ? fe(h[f]) : B, o);
1092
- return y;
1091
+ var b = /* @__PURE__ */ z(m ? fe(h[f]) : B, o);
1092
+ return b;
1093
1093
  }), n.set(f, p)), v(p) === B) ? !1 : m;
1094
1094
  },
1095
1095
  set(h, f, p, m) {
1096
- var y = n.get(f), b = f in h;
1097
- if (r && f === "length") for (var E = p; E < y.v; E += 1) {
1096
+ var b = n.get(f), y = f in h;
1097
+ if (r && f === "length") for (var E = p; E < b.v; E += 1) {
1098
1098
  var R = n.get(E + "");
1099
1099
  R !== void 0 ? $(R, B) : E in h && (R = a(() => /* @__PURE__ */ z(B, o)), n.set(E + "", R));
1100
1100
  }
1101
- if (y === void 0)
1102
- (!b || je(h, f)?.writable) && (y = a(() => /* @__PURE__ */ z(void 0, o)), $(y, fe(p)), n.set(f, y));
1101
+ if (b === void 0)
1102
+ (!y || je(h, f)?.writable) && (b = a(() => /* @__PURE__ */ z(void 0, o)), $(b, fe(p)), n.set(f, b));
1103
1103
  else {
1104
- b = y.v !== B;
1104
+ y = b.v !== B;
1105
1105
  var F = a(() => fe(p));
1106
- $(y, F);
1106
+ $(b, F);
1107
1107
  }
1108
- var M = Reflect.getOwnPropertyDescriptor(h, f);
1109
- if (M?.set && M.set.call(m, p), !b) {
1108
+ var C = Reflect.getOwnPropertyDescriptor(h, f);
1109
+ if (C?.set && C.set.call(m, p), !y) {
1110
1110
  if (r && typeof f == "string") {
1111
1111
  var U = n.get("length"), H = Number(f);
1112
1112
  Number.isInteger(H) && H >= U.v && $(U, H + 1);
@@ -1117,9 +1117,9 @@ function fe(e) {
1117
1117
  },
1118
1118
  ownKeys(h) {
1119
1119
  v(i);
1120
- var f = Reflect.ownKeys(h).filter((y) => {
1121
- var b = n.get(y);
1122
- return b === void 0 || b.v !== B;
1120
+ var f = Reflect.ownKeys(h).filter((b) => {
1121
+ var y = n.get(b);
1122
+ return y === void 0 || y.v !== B;
1123
1123
  });
1124
1124
  for (var [p, m] of n) m.v !== B && !(p in h) && f.push(p);
1125
1125
  return f;
@@ -1204,7 +1204,7 @@ function Rr(e) {
1204
1204
  for (; t !== null && t.nodeType === 3; )
1205
1205
  t.remove(), e.nodeValue += t.nodeValue, t = e.nextSibling;
1206
1206
  }
1207
- function Mo(e) {
1207
+ function Co(e) {
1208
1208
  var t = A, n = S;
1209
1209
  ne(null), ge(null);
1210
1210
  try {
@@ -1263,27 +1263,27 @@ function vl(e) {
1263
1263
  const t = ve(8, null);
1264
1264
  return N(t, te), t.teardown = e, t;
1265
1265
  }
1266
- function Mt(e) {
1266
+ function Ct(e) {
1267
1267
  pl("$effect");
1268
1268
  var t = S.f;
1269
1269
  if (!A && (t & 32) !== 0 && L !== null && !L.i) {
1270
1270
  var n = L;
1271
1271
  (n.e ?? (n.e = [])).push(e);
1272
- } else return Co(e);
1272
+ } else return Mo(e);
1273
1273
  }
1274
- function Co(e) {
1275
- return ve(4 | ya, e);
1274
+ function Mo(e) {
1275
+ return ve(4 | ba, e);
1276
1276
  }
1277
1277
  function ml(e) {
1278
1278
  tt.ensure();
1279
- const t = ve(64 | bt, e);
1279
+ const t = ve(64 | yt, e);
1280
1280
  return () => {
1281
1281
  Y(t);
1282
1282
  };
1283
1283
  }
1284
- function yl(e) {
1284
+ function bl(e) {
1285
1285
  tt.ensure();
1286
- const t = ve(64 | bt, e);
1286
+ const t = ve(64 | yt, e);
1287
1287
  return (n = {}) => new Promise((r) => {
1288
1288
  n.outro ? Bt(t, () => {
1289
1289
  Y(t), r(void 0);
@@ -1293,8 +1293,8 @@ function yl(e) {
1293
1293
  function Oo(e) {
1294
1294
  return ve(4, e);
1295
1295
  }
1296
- function bl(e) {
1297
- return ve(ba | bt, e);
1296
+ function yl(e) {
1297
+ return ve(ya | yt, e);
1298
1298
  }
1299
1299
  function Pr(e, t = 0) {
1300
1300
  return ve(8 | t, e);
@@ -1309,7 +1309,7 @@ function Io(e, t = 0) {
1309
1309
  return n;
1310
1310
  }
1311
1311
  function we(e) {
1312
- return ve(32 | bt, e);
1312
+ return ve(32 | yt, e);
1313
1313
  }
1314
1314
  function $o(e) {
1315
1315
  var t = e.teardown;
@@ -1327,7 +1327,7 @@ function Nr(e, t = !1) {
1327
1327
  var n = e.first;
1328
1328
  for (e.first = e.last = null; n !== null; ) {
1329
1329
  const i = n.ac;
1330
- i !== null && Mo(() => {
1330
+ i !== null && Co(() => {
1331
1331
  i.abort(wn);
1332
1332
  });
1333
1333
  var r = n.next;
@@ -1452,12 +1452,12 @@ function Bo(e, t, n = !0) {
1452
1452
  if (r !== null && !(!_e && le !== null && le.has(e)))
1453
1453
  for (var i = 0; i < r.length; i++) {
1454
1454
  var o = r[i];
1455
- (o.f & 2) !== 0 ? Bo(o, t, !1) : t === o && (n ? N(o, re) : (o.f & 1024) !== 0 && N(o, et), Cr(o));
1455
+ (o.f & 2) !== 0 ? Bo(o, t, !1) : t === o && (n ? N(o, re) : (o.f & 1024) !== 0 && N(o, et), Mr(o));
1456
1456
  }
1457
1457
  }
1458
1458
  function Do(e) {
1459
1459
  var t = G, n = K, r = Q, i = A, o = le, s = L, a = se, l = Ye, c = e.f;
1460
- G = null, K = 0, Q = null, A = (c & 96) === 0 ? e : null, le = null, ft(e.ctx), se = !1, Ye = ++De, e.ac !== null && (Mo(() => {
1460
+ G = null, K = 0, Q = null, A = (c & 96) === 0 ? e : null, le = null, ft(e.ctx), se = !1, Ye = ++De, e.ac !== null && (Co(() => {
1461
1461
  e.ac.abort(wn);
1462
1462
  }), e.ac = null);
1463
1463
  try {
@@ -1471,19 +1471,19 @@ function Do(e) {
1471
1471
  for (f.length = K + G.length, m = 0; m < G.length; m++) f[K + m] = G[m];
1472
1472
  else e.deps = f = G;
1473
1473
  if (Lr() && (e.f & 512) !== 0) for (m = K; m < f.length; m++) {
1474
- var y;
1475
- ((y = f[m]).reactions ?? (y.reactions = [])).push(e);
1474
+ var b;
1475
+ ((b = f[m]).reactions ?? (b.reactions = [])).push(e);
1476
1476
  }
1477
1477
  } else !p && f !== null && K < f.length && (Pt(e, K), f.length = K);
1478
1478
  if (zt() && Q !== null && !se && f !== null && (e.f & 6146) === 0) for (m = 0; m < Q.length; m++) Bo(Q[m], e);
1479
1479
  if (i !== null && i !== e) {
1480
- if (De++, i.deps !== null) for (let b = 0; b < n; b += 1) i.deps[b].rv = De;
1481
- if (t !== null) for (const b of t) b.rv = De;
1480
+ if (De++, i.deps !== null) for (let y = 0; y < n; y += 1) i.deps[y].rv = De;
1481
+ if (t !== null) for (const y of t) y.rv = De;
1482
1482
  Q !== null && (r === null ? r = Q : r.push(...Q));
1483
1483
  }
1484
1484
  return (e.f & 8388608) !== 0 && (e.f ^= cn), h;
1485
- } catch (b) {
1486
- return oo(b);
1485
+ } catch (y) {
1486
+ return oo(y);
1487
1487
  } finally {
1488
1488
  e.f ^= ei, G = t, K = n, Q = r, A = i, le = o, ft(s), se = a, Ye = l;
1489
1489
  }
@@ -1616,15 +1616,15 @@ function vi(e) {
1616
1616
  try {
1617
1617
  var m = o[ct]?.[r];
1618
1618
  m != null && (!o.disabled || e.target === o) && m.call(o, e);
1619
- } catch (y) {
1620
- f ? p.push(y) : f = y;
1619
+ } catch (b) {
1620
+ f ? p.push(b) : f = b;
1621
1621
  }
1622
1622
  if (e.cancelBubble) break;
1623
1623
  s++, o = s < i.length ? i[s] : null;
1624
1624
  }
1625
1625
  if (f) {
1626
- for (let y of p) queueMicrotask(() => {
1627
- throw y;
1626
+ for (let b of p) queueMicrotask(() => {
1627
+ throw b;
1628
1628
  });
1629
1629
  throw f;
1630
1630
  }
@@ -1637,7 +1637,7 @@ var El = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.t
1637
1637
  function Al(e) {
1638
1638
  return El?.createHTML(e) ?? e;
1639
1639
  }
1640
- function Ml(e) {
1640
+ function Cl(e) {
1641
1641
  var t = $r("template");
1642
1642
  return t.innerHTML = Al(e.replaceAll("<!>", "<!---->")), t.content;
1643
1643
  }
@@ -1656,7 +1656,7 @@ function qo(e, t) {
1656
1656
  return () => {
1657
1657
  if (I)
1658
1658
  return ut(O, null), O;
1659
- i === void 0 && (i = Ml(o ? e : "<!>" + e), n || (i = /* @__PURE__ */ vt(i)));
1659
+ i === void 0 && (i = Cl(o ? e : "<!>" + e), n || (i = /* @__PURE__ */ vt(i)));
1660
1660
  var s = r || xo ? document.importNode(i, !0) : i.cloneNode(!0);
1661
1661
  if (n) {
1662
1662
  var a = /* @__PURE__ */ vt(s), l = s.lastChild;
@@ -1665,7 +1665,7 @@ function qo(e, t) {
1665
1665
  return s;
1666
1666
  };
1667
1667
  }
1668
- function Cl() {
1668
+ function Ml() {
1669
1669
  if (I)
1670
1670
  return ut(O, null), O;
1671
1671
  var e = document.createDocumentFragment(), t = document.createComment(""), n = Se();
@@ -1708,7 +1708,7 @@ var Ol = [
1708
1708
  "defer",
1709
1709
  "disablepictureinpicture",
1710
1710
  "disableremoteplayback"
1711
- ], bd = [
1711
+ ], yd = [
1712
1712
  ...Ol,
1713
1713
  "formNoValidate",
1714
1714
  "isMap",
@@ -1772,7 +1772,7 @@ function Pl(e, t) {
1772
1772
  } catch (s) {
1773
1773
  if (s instanceof Error && s.message.split(`
1774
1774
  `).some((a) => a.startsWith("https://svelte.dev/e/"))) throw s;
1775
- return s !== dt && console.warn("Failed to hydrate: ", s), t.recover === !1 && Ca(), ir(), dl(n), lt(!1), Uo(e, t);
1775
+ return s !== dt && console.warn("Failed to hydrate: ", s), t.recover === !1 && Ma(), ir(), dl(n), lt(!1), Uo(e, t);
1776
1776
  } finally {
1777
1777
  lt(r), ce(i);
1778
1778
  }
@@ -1780,7 +1780,7 @@ function Pl(e, t) {
1780
1780
  var Xt = /* @__PURE__ */ new Map();
1781
1781
  function Go(e, { target: t, anchor: n, props: r = {}, events: i, context: o, intro: s = !0, transformError: a }) {
1782
1782
  ir();
1783
- var l = void 0, c = yl(() => {
1783
+ var l = void 0, c = bl(() => {
1784
1784
  var u = n ?? t.appendChild(Se());
1785
1785
  Ja(u, { pending: () => {
1786
1786
  } }, (p) => {
@@ -1792,23 +1792,23 @@ function Go(e, { target: t, anchor: n, props: r = {}, events: i, context: o, int
1792
1792
  }, a);
1793
1793
  var h = /* @__PURE__ */ new Set(), f = (p) => {
1794
1794
  for (var m = 0; m < p.length; m++) {
1795
- var y = p[m];
1796
- if (!h.has(y)) {
1797
- h.add(y);
1798
- var b = $l(y);
1795
+ var b = p[m];
1796
+ if (!h.has(b)) {
1797
+ h.add(b);
1798
+ var y = $l(b);
1799
1799
  for (const F of [t, document]) {
1800
1800
  var E = Xt.get(F);
1801
1801
  E === void 0 && (E = /* @__PURE__ */ new Map(), Xt.set(F, E));
1802
- var R = E.get(y);
1803
- R === void 0 ? (F.addEventListener(y, vi, { passive: b }), E.set(y, 1)) : E.set(y, R + 1);
1802
+ var R = E.get(b);
1803
+ R === void 0 ? (F.addEventListener(b, vi, { passive: y }), E.set(b, 1)) : E.set(b, R + 1);
1804
1804
  }
1805
1805
  }
1806
1806
  }
1807
1807
  };
1808
1808
  return f(ha(Vo)), or.add(f), () => {
1809
- for (var p of h) for (const b of [t, document]) {
1810
- var m = Xt.get(b), y = m.get(p);
1811
- --y == 0 ? (b.removeEventListener(p, vi), m.delete(p), m.size === 0 && Xt.delete(b)) : m.set(p, y);
1809
+ for (var p of h) for (const y of [t, document]) {
1810
+ var m = Xt.get(y), b = m.get(p);
1811
+ --b == 0 ? (y.removeEventListener(p, vi), m.delete(p), m.size === 0 && Xt.delete(y)) : m.set(p, b);
1812
1812
  }
1813
1813
  or.delete(f), u !== n && u.parentNode?.removeChild(u);
1814
1814
  };
@@ -1820,26 +1820,26 @@ function Nl(e, t) {
1820
1820
  const n = sr.get(e);
1821
1821
  return n ? (sr.delete(e), n(t)) : Promise.resolve();
1822
1822
  }
1823
- var be = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), Nn = /* @__PURE__ */ new WeakMap(), Wn = /* @__PURE__ */ new WeakMap(), yi = /* @__PURE__ */ new WeakMap(), Wl = class {
1823
+ var ye = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), Nn = /* @__PURE__ */ new WeakMap(), Wn = /* @__PURE__ */ new WeakMap(), bi = /* @__PURE__ */ new WeakMap(), Wl = class {
1824
1824
  constructor(e, t = !0) {
1825
- g(this, "anchor", void 0), _(this, be, /* @__PURE__ */ new Map()), _(this, Ie, /* @__PURE__ */ new Map()), _(this, ie, /* @__PURE__ */ new Map()), _(this, wt, /* @__PURE__ */ new Set()), _(this, Nn, !0), _(this, Wn, (n) => {
1826
- if (d(be, this).has(n)) {
1827
- var r = d(be, this).get(n), i = d(Ie, this).get(r);
1825
+ g(this, "anchor", void 0), _(this, ye, /* @__PURE__ */ new Map()), _(this, Ie, /* @__PURE__ */ new Map()), _(this, ie, /* @__PURE__ */ new Map()), _(this, wt, /* @__PURE__ */ new Set()), _(this, Nn, !0), _(this, Wn, (n) => {
1826
+ if (d(ye, this).has(n)) {
1827
+ var r = d(ye, this).get(n), i = d(Ie, this).get(r);
1828
1828
  if (i)
1829
1829
  hi(i), d(wt, this).delete(r);
1830
1830
  else {
1831
1831
  var o = d(ie, this).get(r);
1832
1832
  o && (hi(o.effect), d(Ie, this).set(r, o.effect), d(ie, this).delete(r), o.fragment.lastChild.remove(), this.anchor.before(o.fragment), i = o.effect);
1833
1833
  }
1834
- for (const [s, a] of d(be, this)) {
1835
- if (d(be, this).delete(s), s === n) break;
1834
+ for (const [s, a] of d(ye, this)) {
1835
+ if (d(ye, this).delete(s), s === n) break;
1836
1836
  const l = d(ie, this).get(a);
1837
1837
  l && (Y(l.effect), d(ie, this).delete(a));
1838
1838
  }
1839
1839
  for (const [s, a] of d(Ie, this)) {
1840
1840
  if (s === r || d(wt, this).has(s)) continue;
1841
1841
  const l = () => {
1842
- if (Array.from(d(be, this).values()).includes(s)) {
1842
+ if (Array.from(d(ye, this).values()).includes(s)) {
1843
1843
  var c = document.createDocumentFragment();
1844
1844
  No(a, c), c.append(Se()), d(ie, this).set(s, {
1845
1845
  effect: a,
@@ -1851,9 +1851,9 @@ var be = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), ie =
1851
1851
  d(Nn, this) || !i ? (d(wt, this).add(s), Bt(a, l, !1)) : l();
1852
1852
  }
1853
1853
  }
1854
- }), _(this, yi, (n) => {
1855
- d(be, this).delete(n);
1856
- const r = Array.from(d(be, this).values());
1854
+ }), _(this, bi, (n) => {
1855
+ d(ye, this).delete(n);
1856
+ const r = Array.from(d(ye, this).values());
1857
1857
  for (const [i, o] of d(ie, this)) r.includes(i) || (Y(o.effect), d(ie, this).delete(i));
1858
1858
  }), this.anchor = e, T(Nn, this, t);
1859
1859
  }
@@ -1866,16 +1866,16 @@ var be = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), ie =
1866
1866
  fragment: i
1867
1867
  });
1868
1868
  } else d(Ie, this).set(e, we(() => t(this.anchor)));
1869
- if (d(be, this).set(n, e), r) {
1869
+ if (d(ye, this).set(n, e), r) {
1870
1870
  for (const [s, a] of d(Ie, this)) s === e ? n.unskip_effect(a) : n.skip_effect(a);
1871
1871
  for (const [s, a] of d(ie, this)) s === e ? n.unskip_effect(a.effect) : n.skip_effect(a.effect);
1872
- n.oncommit(d(Wn, this)), n.ondiscard(d(yi, this));
1872
+ n.oncommit(d(Wn, this)), n.ondiscard(d(bi, this));
1873
1873
  } else
1874
1874
  I && (this.anchor = O), d(Wn, this).call(this, n);
1875
1875
  }
1876
1876
  };
1877
1877
  function zl(e) {
1878
- L === null && wa("onMount"), Wt && L.l !== null ? Hl(L).m.push(e) : Mt(() => {
1878
+ L === null && wa("onMount"), Wt && L.l !== null ? Hl(L).m.push(e) : Ct(() => {
1879
1879
  const t = xn(e);
1880
1880
  if (typeof t == "function") return t;
1881
1881
  });
@@ -1888,7 +1888,7 @@ function Hl(e) {
1888
1888
  m: []
1889
1889
  });
1890
1890
  }
1891
- function bi(e, t, n = !1) {
1891
+ function yi(e, t, n = !1) {
1892
1892
  var r;
1893
1893
  I && (r = O, xr());
1894
1894
  var i = new Wl(e), o = n ? kr : 0;
@@ -1952,12 +1952,12 @@ function Fl(e, t) {
1952
1952
  var o = !1, s = 0, a = !1, l = [];
1953
1953
  r && l.push(...Object.keys(r).map(zn)), i && l.push(...Object.keys(i).map(zn));
1954
1954
  var c = 0, u = -1;
1955
- const y = e.length;
1956
- for (var h = 0; h < y; h++) {
1955
+ const b = e.length;
1956
+ for (var h = 0; h < b; h++) {
1957
1957
  var f = e[h];
1958
1958
  if (a ? f === "/" && e[h - 1] === "*" && (a = !1) : o ? o === f && (o = !1) : f === "/" && e[h + 1] === "*" ? a = !0 : f === '"' || f === "'" ? o = f : f === "(" ? s++ : f === ")" && s--, !a && o === !1 && s === 0) {
1959
1959
  if (f === ":" && u === -1) u = h;
1960
- else if (f === ";" || h === y - 1) {
1960
+ else if (f === ";" || h === b - 1) {
1961
1961
  if (u !== -1) {
1962
1962
  var p = zn(e.substring(c, u).trim());
1963
1963
  if (!l.includes(p)) {
@@ -2028,21 +2028,21 @@ function Kl(e) {
2028
2028
  }
2029
2029
  return n;
2030
2030
  }
2031
- var Yo, at = /* @__PURE__ */ new WeakMap(), bn = /* @__PURE__ */ new WeakMap(), Bn = /* @__PURE__ */ new WeakMap(), wi = /* @__PURE__ */ new WeakSet(), Ko = class {
2031
+ var Yo, at = /* @__PURE__ */ new WeakMap(), yn = /* @__PURE__ */ new WeakMap(), Bn = /* @__PURE__ */ new WeakMap(), wi = /* @__PURE__ */ new WeakSet(), Ko = class {
2032
2032
  constructor(e) {
2033
- Ar(this, wi), _(this, at, /* @__PURE__ */ new WeakMap()), _(this, bn, void 0), _(this, Bn, void 0), T(Bn, this, e);
2033
+ Ar(this, wi), _(this, at, /* @__PURE__ */ new WeakMap()), _(this, yn, void 0), _(this, Bn, void 0), T(Bn, this, e);
2034
2034
  }
2035
2035
  observe(e, t) {
2036
2036
  var n = d(at, this).get(e) || /* @__PURE__ */ new Set();
2037
2037
  return n.add(t), d(at, this).set(e, n), k(wi, this, Xl).call(this).observe(e, d(Bn, this)), () => {
2038
2038
  var r = d(at, this).get(e);
2039
- r.delete(t), r.size === 0 && (d(at, this).delete(e), d(bn, this).unobserve(e));
2039
+ r.delete(t), r.size === 0 && (d(at, this).delete(e), d(yn, this).unobserve(e));
2040
2040
  };
2041
2041
  }
2042
2042
  };
2043
2043
  Yo = Ko;
2044
2044
  function Xl() {
2045
- return d(bn, this) ?? T(bn, this, new ResizeObserver((e) => {
2045
+ return d(yn, this) ?? T(yn, this, new ResizeObserver((e) => {
2046
2046
  for (var t of e) {
2047
2047
  Yo.entries.set(t.target, t);
2048
2048
  for (var n of d(at, this).get(t.target) || []) n(t);
@@ -2078,31 +2078,31 @@ function ki(e, t, n, r) {
2078
2078
  let h;
2079
2079
  if (o) {
2080
2080
  var f = Ot in e || Ji in e;
2081
- h = je(e, t)?.set ?? (f && t in e ? (M) => e[t] = M : void 0);
2081
+ h = je(e, t)?.set ?? (f && t in e ? (C) => e[t] = C : void 0);
2082
2082
  }
2083
2083
  var p, m = !1;
2084
2084
  o ? [p, m] = ja(() => e[t]) : p = e[t], p === void 0 && r !== void 0 && (p = u(), h && (i && Oa(t), h(p)));
2085
- var y;
2086
- if (i ? y = () => {
2087
- var M = e[t];
2088
- return M === void 0 ? u() : (l = !0, M);
2089
- } : y = () => {
2090
- var M = e[t];
2091
- return M !== void 0 && (a = void 0), M === void 0 ? a : M;
2092
- }, i && (n & 4) === 0) return y;
2085
+ var b;
2086
+ if (i ? b = () => {
2087
+ var C = e[t];
2088
+ return C === void 0 ? u() : (l = !0, C);
2089
+ } : b = () => {
2090
+ var C = e[t];
2091
+ return C !== void 0 && (a = void 0), C === void 0 ? a : C;
2092
+ }, i && (n & 4) === 0) return b;
2093
2093
  if (h) {
2094
- var b = e.$$legacy;
2095
- return (function(M, U) {
2096
- return arguments.length > 0 ? ((!i || !U || b || m) && h(U ? y() : M), M) : y();
2094
+ var y = e.$$legacy;
2095
+ return (function(C, U) {
2096
+ return arguments.length > 0 ? ((!i || !U || y || m) && h(U ? b() : C), C) : b();
2097
2097
  });
2098
2098
  }
2099
- var E = !1, R = ((n & 1) !== 0 ? Lt : To)(() => (E = !1, y()));
2099
+ var E = !1, R = ((n & 1) !== 0 ? Lt : To)(() => (E = !1, b()));
2100
2100
  o && v(R);
2101
2101
  var F = S;
2102
- return (function(M, U) {
2102
+ return (function(C, U) {
2103
2103
  if (arguments.length > 0) {
2104
- const H = U ? v(R) : i && o ? fe(M) : M;
2105
- return $(R, H), E = !0, a !== void 0 && (a = H), M;
2104
+ const H = U ? v(R) : i && o ? fe(C) : C;
2105
+ return $(R, H), E = !0, a !== void 0 && (a = H), C;
2106
2106
  }
2107
2107
  return ke && E || (F.f & 16384) !== 0 ? R.v : v(R);
2108
2108
  });
@@ -2550,7 +2550,7 @@ var Jo = class ar {
2550
2550
  }
2551
2551
  Vt > f && (f = Vt, h = U);
2552
2552
  }
2553
- const p = Math.max(0.24, Math.min(0.85, h * 0.55)), m = Math.max(0.55, Math.min(0.95, h + 0.2)), y = Math.max(0.22, Math.min(0.6, h * 0.45)), b = l, E = this.blend(b, a, m), R = this.contrastRatio(E, a), F = this.relativeLuminance(a) > 0.45 ? [
2553
+ const p = Math.max(0.24, Math.min(0.85, h * 0.55)), m = Math.max(0.55, Math.min(0.95, h + 0.2)), b = Math.max(0.22, Math.min(0.6, h * 0.45)), y = l, E = this.blend(y, a, m), R = this.contrastRatio(E, a), F = this.relativeLuminance(a) > 0.45 ? [
2554
2554
  0,
2555
2555
  0,
2556
2556
  0
@@ -2558,12 +2558,12 @@ var Jo = class ar {
2558
2558
  255,
2559
2559
  255,
2560
2560
  255
2561
- ], M = R >= 1.35 ? b : F;
2561
+ ], C = R >= 1.35 ? y : F;
2562
2562
  return {
2563
2563
  wordHighlight: `rgba(${c[0]}, ${c[1]}, ${c[2]}, ${h})`,
2564
2564
  sentenceHighlight: `rgba(${c[0]}, ${c[1]}, ${c[2]}, ${p})`,
2565
- wordUnderline: `rgba(${M[0]}, ${M[1]}, ${M[2]}, ${m})`,
2566
- wordShadow: `rgba(${M[0]}, ${M[1]}, ${M[2]}, ${y})`
2565
+ wordUnderline: `rgba(${C[0]}, ${C[1]}, ${C[2]}, ${m})`,
2566
+ wordShadow: `rgba(${C[0]}, ${C[1]}, ${C[2]}, ${b})`
2567
2567
  };
2568
2568
  }
2569
2569
  applyAdaptiveTTSStyle(t) {
@@ -2650,6 +2650,116 @@ var Jo = class ar {
2650
2650
  text-underline-offset: 2px;
2651
2651
  color: inherit;
2652
2652
  }
2653
+
2654
+ /* The blocks below cover annotation swatches, print, and reduced motion.
2655
+ They deliberately do NOT retune the TTS layers: applyAdaptiveTTSStyle()
2656
+ writes the pie-tts custom properties inline on documentElement on every
2657
+ paint and on theme change, so a media query that only varies a var()
2658
+ fallback for those can never take effect. Annotation colours have no such
2659
+ adaptive path -- they are fixed swatches a student chose -- so a media
2660
+ query is the only way to adjust them, and each keeps its var() so a host
2661
+ override still wins.
2662
+
2663
+ The names above are spelled without their leading dashes on purpose.
2664
+ check-theme-tokens scans comments, and its token pattern stops at the
2665
+ first non-alphanumeric character, so writing the wildcard form reads as
2666
+ consumption of a shorter token that is not in the registry and fails the
2667
+ check. Spell property names in full, or omit the dashes. */
2668
+
2669
+ @media (prefers-color-scheme: dark) {
2670
+ ::highlight(annotation-yellow) {
2671
+ background-color: var(--pie-annotation-yellow-highlight, rgba(139, 117, 0, 0.6));
2672
+ }
2673
+ ::highlight(annotation-green) {
2674
+ background-color: var(--pie-annotation-green-highlight, rgba(45, 92, 63, 0.6));
2675
+ }
2676
+ ::highlight(annotation-blue) {
2677
+ background-color: var(--pie-annotation-blue-highlight, rgba(0, 102, 170, 0.6));
2678
+ }
2679
+ ::highlight(annotation-pink) {
2680
+ background-color: var(--pie-annotation-pink-highlight, rgba(139, 51, 74, 0.6));
2681
+ }
2682
+ ::highlight(annotation-orange) {
2683
+ background-color: var(--pie-annotation-orange-highlight, rgba(154, 99, 0, 0.6));
2684
+ }
2685
+ ::highlight(annotation-underline) {
2686
+ text-decoration-color: var(--pie-primary, #4da6ff);
2687
+ }
2688
+ }
2689
+
2690
+ /* WCAG 2.2 SC 1.4.11 non-text contrast: a highlight is the only indication
2691
+ that text is annotated, so the swatches saturate and the underline
2692
+ thickens when the user asks for more contrast.
2693
+
2694
+ The value is "more", not "high". The stylesheet this was recovered from
2695
+ used prefers-contrast: high, which is not a valid value for the feature
2696
+ -- the keywords are no-preference, more, less, custom. An invalid query
2697
+ evaluates to "not all", so that block could never have matched in any
2698
+ browser even had the file been loaded. Verified with matchMedia under
2699
+ emulation: "high" stays false where "more" flips true. */
2700
+ @media (prefers-contrast: more) {
2701
+ ::highlight(annotation-yellow) {
2702
+ background-color: var(--pie-annotation-yellow-highlight, rgba(255, 255, 0, 0.7));
2703
+ }
2704
+ ::highlight(annotation-green) {
2705
+ background-color: var(--pie-annotation-green-highlight, rgba(0, 255, 127, 0.7));
2706
+ }
2707
+ ::highlight(annotation-blue) {
2708
+ background-color: var(--pie-annotation-blue-highlight, rgba(0, 191, 255, 0.7));
2709
+ }
2710
+ ::highlight(annotation-pink) {
2711
+ background-color: var(--pie-annotation-pink-highlight, rgba(255, 105, 180, 0.7));
2712
+ }
2713
+ ::highlight(annotation-orange) {
2714
+ background-color: var(--pie-annotation-orange-highlight, rgba(255, 165, 0, 0.85));
2715
+ }
2716
+ ::highlight(annotation-underline) {
2717
+ text-decoration-thickness: 3px;
2718
+ }
2719
+ }
2720
+
2721
+ @media print {
2722
+ /* TTS highlighting is a transient read-along cue, not content. */
2723
+ ::highlight(tts-word),
2724
+ ::highlight(tts-sentence),
2725
+ [data-pie-tts-word-element="true"],
2726
+ [data-pie-tts-sentence-element="true"] {
2727
+ background-color: transparent;
2728
+ text-decoration: none;
2729
+ text-shadow: none;
2730
+ border-bottom: none;
2731
+ }
2732
+
2733
+ /* Annotations are student work and must survive printing, but a fill
2734
+ that reads fine on screen can print as an illegible wash, so each
2735
+ becomes an underline that keeps its colour coding. */
2736
+ ::highlight(annotation-yellow),
2737
+ ::highlight(annotation-green),
2738
+ ::highlight(annotation-blue),
2739
+ ::highlight(annotation-pink),
2740
+ ::highlight(annotation-orange) {
2741
+ background-color: transparent;
2742
+ border-bottom: 2px solid currentColor;
2743
+ }
2744
+ ::highlight(annotation-yellow) { border-bottom-color: #ffeb3b; }
2745
+ ::highlight(annotation-green) { border-bottom-color: #a6e1c5; }
2746
+ ::highlight(annotation-blue) { border-bottom-color: #a7e0f6; }
2747
+ ::highlight(annotation-pink) { border-bottom-color: #ff9fae; }
2748
+ ::highlight(annotation-orange) { border-bottom-color: #ffa500; }
2749
+ ::highlight(annotation-underline) {
2750
+ text-decoration-color: #000;
2751
+ border-bottom: none;
2752
+ }
2753
+ }
2754
+
2755
+ /* text-shadow is a direct property rather than a var(), so unlike the
2756
+ other TTS rules this one is not overridden by the adaptive path. */
2757
+ @media (prefers-reduced-motion: reduce) {
2758
+ ::highlight(tts-word),
2759
+ [data-pie-tts-word-element="true"] {
2760
+ text-shadow: none;
2761
+ }
2762
+ }
2653
2763
  `, document.head.appendChild(t);
2654
2764
  }
2655
2765
  highlightTTSWord(t, n, r) {
@@ -2983,7 +3093,7 @@ function xi(e) {
2983
3093
  if (typeof e.isVisibleInContext != "function") throw new Error(`Invalid tool registration "${e.toolId}": "isVisibleInContext" must be a function.`);
2984
3094
  if (typeof e.renderToolbar != "function") throw new Error(`Invalid tool registration "${e.toolId}": "renderToolbar" must be a function.`);
2985
3095
  }
2986
- var yc = class {
3096
+ var bc = class {
2987
3097
  constructor() {
2988
3098
  g(this, "tools", /* @__PURE__ */ new Map()), g(this, "pnpIndex", /* @__PURE__ */ new Map()), g(this, "componentOverrides", {}), g(this, "moduleLoaders", /* @__PURE__ */ new Map()), g(this, "loadedToolModules", /* @__PURE__ */ new Set()), g(this, "moduleLoadPromises", /* @__PURE__ */ new Map());
2989
3099
  }
@@ -3129,7 +3239,7 @@ var yc = class {
3129
3239
  function es(e) {
3130
3240
  return e.level === "item";
3131
3241
  }
3132
- function bc(e) {
3242
+ function yc(e) {
3133
3243
  return e.level === "passage";
3134
3244
  }
3135
3245
  function Tc(e) {
@@ -3173,7 +3283,7 @@ function Wr(e) {
3173
3283
  }
3174
3284
  return r.filter(Boolean).join(" ").trim();
3175
3285
  }
3176
- if (bc(e)) {
3286
+ if (yc(e)) {
3177
3287
  const t = e.passage;
3178
3288
  if (!t?.config) return "";
3179
3289
  const n = t.config, r = [], i = (l) => l.replace(/<[^>]*>/g, " ").trim();
@@ -3238,7 +3348,7 @@ function _c(e) {
3238
3348
  }
3239
3349
  return !1;
3240
3350
  }
3241
- function Mn(e) {
3351
+ function Cn(e) {
3242
3352
  return Wr(e).trim().length >= 10;
3243
3353
  }
3244
3354
  function Sc(e) {
@@ -3372,7 +3482,7 @@ var Ec = class {
3372
3482
  text: e,
3373
3483
  offset: 0
3374
3484
  }];
3375
- }, ns = (e) => String(e || "").trim().toLowerCase(), Ac = () => ns((typeof navigator < "u" ? navigator.language || navigator.languages?.[0] : "") || "en-US"), Mc = (e, t) => {
3485
+ }, ns = (e) => String(e || "").trim().toLowerCase(), Ac = () => ns((typeof navigator < "u" ? navigator.language || navigator.languages?.[0] : "") || "en-US"), Cc = (e, t) => {
3376
3486
  if (t) {
3377
3487
  const s = e.find((a) => a.name === t);
3378
3488
  if (s) return s;
@@ -3392,7 +3502,7 @@ var Ec = class {
3392
3502
  if (a) return a;
3393
3503
  }
3394
3504
  return e[0] || null;
3395
- }, Cc = (e) => !e.default, rs = class {
3505
+ }, Mc = (e) => !e.default, rs = class {
3396
3506
  constructor() {
3397
3507
  g(this, "providerId", "browser"), g(this, "providerName", "Browser Speech Synthesis"), g(this, "version", "1.0.0");
3398
3508
  }
@@ -3504,8 +3614,8 @@ var Ec = class {
3504
3614
  }
3505
3615
  const o = new SpeechSynthesisUtterance(e);
3506
3616
  this.utterance = o;
3507
- const s = Mc(speechSynthesis.getVoices(), this.config?.voice);
3508
- s && Cc(s) && (o.voice = s), this.config?.rate && (o.rate = this.config.rate), this.config?.pitch && (o.pitch = this.config.pitch);
3617
+ const s = Cc(speechSynthesis.getVoices(), this.config?.voice);
3618
+ s && Mc(s) && (o.voice = s), this.config?.rate && (o.rate = this.config.rate), this.config?.pitch && (o.pitch = this.config.pitch);
3509
3619
  const a = () => {
3510
3620
  this.utterance === o && (this.utterance = null);
3511
3621
  };
@@ -3838,28 +3948,28 @@ var Bc = {
3838
3948
  for (; u; ) {
3839
3949
  const f = u;
3840
3950
  if (f.parentElement && !Tt(f, e)) {
3841
- const p = f.textContent || "", m = p.match(/\S/), y = m ? m[0] : null;
3842
- !o && !s && as(l, y, t) && (r.push(" "), a && n.set(i, a), i++, s = !0);
3843
- for (let b = 0; b < p.length; b++) {
3844
- const E = p[b], R = /\s/.test(E);
3951
+ const p = f.textContent || "", m = p.match(/\S/), b = m ? m[0] : null;
3952
+ !o && !s && as(l, b, t) && (r.push(" "), a && n.set(i, a), i++, s = !0);
3953
+ for (let y = 0; y < p.length; y++) {
3954
+ const E = p[y], R = /\s/.test(E);
3845
3955
  o ? R || (o = !1, r.push(E), n.set(i, {
3846
3956
  node: f,
3847
- offset: b
3957
+ offset: y
3848
3958
  }), a = {
3849
3959
  node: f,
3850
- offset: b
3960
+ offset: y
3851
3961
  }, i++, s = !1, l = E) : R ? (s || (r.push(" "), n.set(i, {
3852
3962
  node: f,
3853
- offset: b
3963
+ offset: y
3854
3964
  }), a = {
3855
3965
  node: f,
3856
- offset: b
3966
+ offset: y
3857
3967
  }, i++), s = !0) : (r.push(E), n.set(i, {
3858
3968
  node: f,
3859
- offset: b
3969
+ offset: y
3860
3970
  }), a = {
3861
3971
  node: f,
3862
- offset: b
3972
+ offset: y
3863
3973
  }, i++, s = !1, l = E);
3864
3974
  }
3865
3975
  }
@@ -3871,13 +3981,13 @@ var Bc = {
3871
3981
  text: h,
3872
3982
  map: n
3873
3983
  };
3874
- }, Vn = null, Mi = Promise.resolve(), Dc = (e) => (e || "en").split("-")[0].toLowerCase() || "en", Fc = async () => (Vn || (Vn = import("./sre-yGY3u7Xp.js").then((e) => /* @__PURE__ */ la(e.default, 1)).then((e) => {
3984
+ }, Vn = null, Ci = Promise.resolve(), Dc = (e) => (e || "en").split("-")[0].toLowerCase() || "en", Fc = async () => (Vn || (Vn = import("./sre-yGY3u7Xp.js").then((e) => /* @__PURE__ */ la(e.default, 1)).then((e) => {
3875
3985
  const t = e.default || e;
3876
3986
  if (!t || typeof t.toSpeech != "function") throw new Error("speech-rule-engine did not expose toSpeech");
3877
3987
  return t;
3878
- })), Vn), jc = (e) => e === "en" ? "clearspeak" : "mathspeak", Ci = (e) => !!e && typeof e == "object" && !Array.isArray(e), Oi = (e) => typeof e == "string" && e.trim() ? e.trim() : void 0, Cn = (e) => {
3879
- if (!Ci(e)) return;
3880
- const t = Oi(e.domain), n = Oi(e.style), r = Ci(e.engineOptions) ? e.engineOptions : void 0;
3988
+ })), Vn), jc = (e) => e === "en" ? "clearspeak" : "mathspeak", Mi = (e) => !!e && typeof e == "object" && !Array.isArray(e), Oi = (e) => typeof e == "string" && e.trim() ? e.trim() : void 0, Mn = (e) => {
3989
+ if (!Mi(e)) return;
3990
+ const t = Oi(e.domain), n = Oi(e.style), r = Mi(e.engineOptions) ? e.engineOptions : void 0;
3881
3991
  if (!(!t && !n && !r))
3882
3992
  return {
3883
3993
  ...t ? { domain: t } : {},
@@ -3885,7 +3995,7 @@ var Bc = {
3885
3995
  ...r ? { engineOptions: r } : {}
3886
3996
  };
3887
3997
  }, Vc = async (e, t, n, r) => {
3888
- const i = Dc(t), o = Cn(r);
3998
+ const i = Dc(t), o = Mn(r);
3889
3999
  await e.setupEngine?.({
3890
4000
  ...o?.engineOptions || {},
3891
4001
  locale: i,
@@ -3895,8 +4005,8 @@ var Bc = {
3895
4005
  markup: n
3896
4006
  }), await e.engineReady?.();
3897
4007
  }, qc = async (e) => {
3898
- const t = Mi.then(e, e);
3899
- return Mi = t.then(() => {
4008
+ const t = Ci.then(e, e);
4009
+ return Ci = t.then(() => {
3900
4010
  }, () => {
3901
4011
  }), t;
3902
4012
  }, ls = async (e, t, n, r, i) => qc(async () => (await Vc(e, n, r, i), e.toSpeech(t))), Uc = (e) => e.replace(/^\s*<\?xml[^>]*\?>\s*/i, ""), Gc = async (e, t, n, r) => {
@@ -4038,7 +4148,7 @@ var Bc = {
4038
4148
  ...n
4039
4149
  });
4040
4150
  }, ur = (e) => e.backend || "browser", hs = (e, t) => t === "polly" || t === "google" ? t : e.serverProvider || e.provider, ds = (e, t) => e.transportMode || (t === "custom" ? "custom" : "pie"), Qc = (e) => {
4041
- const t = ur(e), n = hs(e, t), r = ds(e, n), i = Cn(e.mathSpeech);
4151
+ const t = ur(e), n = hs(e, t), r = ds(e, n), i = Mn(e.mathSpeech);
4042
4152
  return {
4043
4153
  voice: e.defaultVoice,
4044
4154
  rate: e.rate,
@@ -4140,7 +4250,7 @@ var Bc = {
4140
4250
  "speechOutput"
4141
4251
  ],
4142
4252
  isVisibleInContext(e) {
4143
- return Mn(e);
4253
+ return Cn(e);
4144
4254
  },
4145
4255
  renderToolbar(e, t) {
4146
4256
  const n = () => qn(t.toolkitCoordinator?.getToolConfig(this.toolId) || void 0), r = () => rn(n().speedOptions), i = () => fs(n()), o = () => Zc(n()), s = zr(this.toolId, t.scope.level, t.scope.scopeId), a = () => {
@@ -4182,7 +4292,7 @@ var Bc = {
4182
4292
  };
4183
4293
  }
4184
4294
  };
4185
- function Me(e, t) {
4295
+ function Ce(e, t) {
4186
4296
  const n = zr(e, t.scope.level, t.scope.scopeId);
4187
4297
  return {
4188
4298
  fullToolId: n,
@@ -4193,7 +4303,7 @@ function Me(e, t) {
4193
4303
  }
4194
4304
  };
4195
4305
  }
4196
- function Ce(e) {
4306
+ function Me(e) {
4197
4307
  const t = e.isActive();
4198
4308
  e.button.active = t, e.overlay.visible = t, e.onActiveChange?.(t);
4199
4309
  }
@@ -4215,7 +4325,7 @@ var nu = {
4215
4325
  return An(e);
4216
4326
  },
4217
4327
  renderToolbar(e, t) {
4218
- const n = Me(this.toolId, t), r = {
4328
+ const n = Ce(this.toolId, t), r = {
4219
4329
  toolId: this.toolId,
4220
4330
  label: this.name,
4221
4331
  icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
@@ -4233,7 +4343,7 @@ var nu = {
4233
4343
  mount: "after-buttons"
4234
4344
  }],
4235
4345
  sync: () => {
4236
- Ce({
4346
+ Me({
4237
4347
  button: r,
4238
4348
  overlay: o,
4239
4349
  isActive: n.isActive
@@ -4257,7 +4367,7 @@ var nu = {
4257
4367
  return An(e);
4258
4368
  },
4259
4369
  renderToolbar(e, t) {
4260
- const n = Me(this.toolId, t), r = {
4370
+ const n = Ce(this.toolId, t), r = {
4261
4371
  toolId: this.toolId,
4262
4372
  label: this.name,
4263
4373
  icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
@@ -4275,7 +4385,7 @@ var nu = {
4275
4385
  mount: "after-buttons"
4276
4386
  }],
4277
4387
  sync: () => {
4278
- Ce({
4388
+ Me({
4279
4389
  button: r,
4280
4390
  overlay: o,
4281
4391
  isActive: n.isActive
@@ -4300,7 +4410,7 @@ var nu = {
4300
4410
  return _c(e);
4301
4411
  },
4302
4412
  renderToolbar(e, t) {
4303
- const n = Me(this.toolId, t), r = t.componentOverrides ?? {}, i = me(this.toolId, e, t, r);
4413
+ const n = Ce(this.toolId, t), r = t.componentOverrides ?? {}, i = me(this.toolId, e, t, r);
4304
4414
  i.setAttribute("tool-id", n.fullToolId), i.setAttribute("strategy", "strikethrough"), i.setAttribute("button-alignment", "inline");
4305
4415
  const o = {
4306
4416
  toolId: this.toolId,
@@ -4320,7 +4430,7 @@ var nu = {
4320
4430
  mount: "after-buttons"
4321
4431
  }],
4322
4432
  sync: () => {
4323
- Ce({
4433
+ Me({
4324
4434
  button: o,
4325
4435
  overlay: i,
4326
4436
  isActive: n.isActive
@@ -4349,10 +4459,10 @@ var nu = {
4349
4459
  "annotation"
4350
4460
  ],
4351
4461
  isVisibleInContext(e) {
4352
- return Mn(e);
4462
+ return Cn(e);
4353
4463
  },
4354
4464
  renderToolbar(e, t) {
4355
- const n = Me(this.toolId, t), r = {
4465
+ const n = Ce(this.toolId, t), r = {
4356
4466
  toolId: this.toolId,
4357
4467
  label: this.name,
4358
4468
  icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
@@ -4370,7 +4480,7 @@ var nu = {
4370
4480
  mount: "after-buttons"
4371
4481
  }],
4372
4482
  sync: () => {
4373
- Ce({
4483
+ Me({
4374
4484
  button: r,
4375
4485
  overlay: o,
4376
4486
  isActive: n.isActive,
@@ -4401,10 +4511,10 @@ var nu = {
4401
4511
  "trackingGuide"
4402
4512
  ],
4403
4513
  isVisibleInContext(e) {
4404
- return Mn(e);
4514
+ return Cn(e);
4405
4515
  },
4406
4516
  renderToolbar(e, t) {
4407
- const n = Me(this.toolId, t), r = {
4517
+ const n = Ce(this.toolId, t), r = {
4408
4518
  toolId: this.toolId,
4409
4519
  label: this.name,
4410
4520
  icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
@@ -4422,7 +4532,7 @@ var nu = {
4422
4532
  mount: "after-buttons"
4423
4533
  }],
4424
4534
  sync: () => {
4425
- Ce({
4535
+ Me({
4426
4536
  button: r,
4427
4537
  overlay: o,
4428
4538
  isActive: n.isActive
@@ -4449,7 +4559,7 @@ var nu = {
4449
4559
  return !0;
4450
4560
  },
4451
4561
  renderToolbar(e, t) {
4452
- const n = Me(this.toolId, t), r = {
4562
+ const n = Ce(this.toolId, t), r = {
4453
4563
  toolId: this.toolId,
4454
4564
  label: this.name,
4455
4565
  icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
@@ -4477,7 +4587,7 @@ var nu = {
4477
4587
  }
4478
4588
  }],
4479
4589
  sync: () => {
4480
- Ce({
4590
+ Me({
4481
4591
  button: r,
4482
4592
  overlay: o,
4483
4593
  isActive: n.isActive
@@ -4507,10 +4617,10 @@ var nu = {
4507
4617
  "annotation"
4508
4618
  ],
4509
4619
  isVisibleInContext(e) {
4510
- return Mn(e);
4620
+ return Cn(e);
4511
4621
  },
4512
4622
  renderToolbar(e, t) {
4513
- const n = Me(this.toolId, t), r = {
4623
+ const n = Ce(this.toolId, t), r = {
4514
4624
  toolId: this.toolId,
4515
4625
  label: this.name,
4516
4626
  icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
@@ -4528,7 +4638,7 @@ var nu = {
4528
4638
  mount: "after-buttons"
4529
4639
  }],
4530
4640
  sync: () => {
4531
- Ce({
4641
+ Me({
4532
4642
  button: r,
4533
4643
  overlay: o,
4534
4644
  isActive: n.isActive
@@ -4553,7 +4663,7 @@ var nu = {
4553
4663
  return An(e);
4554
4664
  },
4555
4665
  renderToolbar(e, t) {
4556
- const n = Me(this.toolId, t), r = {
4666
+ const n = Ce(this.toolId, t), r = {
4557
4667
  toolId: this.toolId,
4558
4668
  label: this.name,
4559
4669
  icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
@@ -4581,7 +4691,7 @@ var nu = {
4581
4691
  }
4582
4692
  }],
4583
4693
  sync: () => {
4584
- Ce({
4694
+ Me({
4585
4695
  button: r,
4586
4696
  overlay: o,
4587
4697
  isActive: n.isActive
@@ -4605,7 +4715,7 @@ var nu = {
4605
4715
  return Sc(e);
4606
4716
  },
4607
4717
  renderToolbar(e, t) {
4608
- const n = Me(this.toolId, t), r = {
4718
+ const n = Ce(this.toolId, t), r = {
4609
4719
  toolId: this.toolId,
4610
4720
  label: this.name,
4611
4721
  icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
@@ -4633,7 +4743,7 @@ var nu = {
4633
4743
  }
4634
4744
  }],
4635
4745
  sync: () => {
4636
- Ce({
4746
+ Me({
4637
4747
  button: r,
4638
4748
  overlay: o,
4639
4749
  isActive: n.isActive
@@ -4656,7 +4766,7 @@ var nu = {
4656
4766
  uu
4657
4767
  ];
4658
4768
  function du(e = {}) {
4659
- const t = new yc(), n = {
4769
+ const t = new bc(), n = {
4660
4770
  toolTagMap: {
4661
4771
  ...is,
4662
4772
  ...e.toolTagMap || {}
@@ -4802,11 +4912,11 @@ var vu = gu(), Ad = {
4802
4912
  itemGlossary: "itemGlossary",
4803
4913
  tutorialAvailable: "tutorialAvailable"
4804
4914
  }
4805
- }, Md = Object.values(mu).flatMap((e) => Object.values(e)), Cd = Qo("ToolCoordinator"), hr;
4915
+ }, Cd = Object.values(mu).flatMap((e) => Object.values(e)), Md = Qo("ToolCoordinator"), hr;
4806
4916
  (function(e) {
4807
4917
  e[e.BASE = 0] = "BASE", e[e.TOOL = 1e3] = "TOOL", e[e.MODAL = 2e3] = "MODAL", e[e.CONTROL = 3e3] = "CONTROL", e[e.HIGHLIGHT = 4e3] = "HIGHLIGHT";
4808
4918
  })(hr || (hr = {}));
4809
- var yu = /* @__PURE__ */ new Set([
4919
+ var bu = /* @__PURE__ */ new Set([
4810
4920
  "speak",
4811
4921
  "p",
4812
4922
  "s",
@@ -4820,7 +4930,7 @@ var yu = /* @__PURE__ */ new Set([
4820
4930
  char: t[r],
4821
4931
  rawOffset: n === null ? null : n + r
4822
4932
  });
4823
- }, bu = (e, t, n) => {
4933
+ }, yu = (e, t, n) => {
4824
4934
  const r = t.slice(n).match(/^&(quot|apos|lt|gt|nbsp|amp|#160);/i);
4825
4935
  return r ? (on(e, ps(r[0]), n), r[0].length) : 0;
4826
4936
  }, Wi = (e) => {
@@ -4854,7 +4964,7 @@ var yu = /* @__PURE__ */ new Set([
4854
4964
  const s = e[i];
4855
4965
  if (s !== "<") {
4856
4966
  if (s === "&") {
4857
- const f = bu(t, e, i);
4967
+ const f = yu(t, e, i);
4858
4968
  if (f > 0) {
4859
4969
  i += f;
4860
4970
  continue;
@@ -4889,7 +4999,7 @@ var yu = /* @__PURE__ */ new Set([
4889
4999
  i = a + 1;
4890
5000
  continue;
4891
5001
  }
4892
- c && !yu.has(c) && !Ni.has(c) && c !== "break" && c !== "sub" && (n = !0), !u && (c === "p" || c === "s") && Wi(t), i = a + 1;
5002
+ c && !bu.has(c) && !Ni.has(c) && c !== "break" && c !== "sub" && (n = !0), !u && (c === "p" || c === "s") && Wi(t), i = a + 1;
4893
5003
  }
4894
5004
  const o = Tu(t);
4895
5005
  return {
@@ -5027,8 +5137,8 @@ var yu = /* @__PURE__ */ new Set([
5027
5137
  for (let u = 0; u < l; u++) {
5028
5138
  const h = n[u];
5029
5139
  if (h.spokenEndToken <= c.spokenStartToken && h.visibleToken < c.visibleToken) {
5030
- const f = c.spokenStartToken - h.spokenEndToken, p = c.visibleToken - h.visibleToken - 1, m = Math.max(0, Math.abs(f - p) - 2), y = r[u] + c.score - m;
5031
- y > r[l] && (r[l] = y, i[l] = u);
5140
+ const f = c.spokenStartToken - h.spokenEndToken, p = c.visibleToken - h.visibleToken - 1, m = Math.max(0, Math.abs(f - p) - 2), b = r[u] + c.score - m;
5141
+ b > r[l] && (r[l] = b, i[l] = u);
5032
5142
  }
5033
5143
  }
5034
5144
  }
@@ -5067,12 +5177,12 @@ var yu = /* @__PURE__ */ new Set([
5067
5177
  visibleTokens: o,
5068
5178
  rawToSpokenOffsetMap: t.rawToSpokenOffsetMap
5069
5179
  };
5070
- }, Dr = (e, t) => e.find((n) => n.start <= t && t < n.end) || null, ys = (e) => {
5180
+ }, Dr = (e, t) => e.find((n) => n.start <= t && t < n.end) || null, bs = (e) => {
5071
5181
  if (!e || /^<[^>]+>$/.test(e.trim())) return null;
5072
5182
  const t = dr(e)[0];
5073
5183
  return t ? vs.get(t.normalized) || t.normalized : null;
5074
5184
  }, zi = (e, t, n) => {
5075
- const r = ys(n);
5185
+ const r = bs(n);
5076
5186
  if (!t || !r) return !1;
5077
5187
  const i = Dr(e.spokenTokens, t.start);
5078
5188
  return i ? fr(i) === r : !1;
@@ -5100,7 +5210,7 @@ var yu = /* @__PURE__ */ new Set([
5100
5210
  start: t,
5101
5211
  length: Math.min(n, r.end - t)
5102
5212
  } : null;
5103
- }, Mu = (e, t, n = 1, r) => {
5213
+ }, Cu = (e, t, n = 1, r) => {
5104
5214
  if (e.boundaryOffsetMode === "unsupported" || !Number.isFinite(t)) return null;
5105
5215
  const i = Math.max(1, Number.isFinite(n) ? n : 1);
5106
5216
  if (r && /^<[^>]+>$/.test(r.trim())) return null;
@@ -5109,12 +5219,12 @@ var yu = /* @__PURE__ */ new Set([
5109
5219
  if (r) {
5110
5220
  if (zi(e, o, r)) return o;
5111
5221
  if (zi(e, s, r)) return s;
5112
- if (ys(r)) return null;
5222
+ if (bs(r)) return null;
5113
5223
  }
5114
5224
  return o || s;
5115
5225
  }
5116
5226
  return Di(e, t, i) || Bi(e, t, i);
5117
- }, Cu = (e, t) => {
5227
+ }, Mu = (e, t) => {
5118
5228
  if (e.playbackMode === "region-fallback") return null;
5119
5229
  const n = e.anchors.find((o) => o.spokenStart <= t && t < o.spokenEnd);
5120
5230
  if (n) return {
@@ -5165,7 +5275,7 @@ var yu = /* @__PURE__ */ new Set([
5165
5275
  ["⁢", "implicit-multiply"],
5166
5276
  ["⁣", "invisible-separator"],
5167
5277
  ["⁤", "invisible-plus"]
5168
- ]), bs = /* @__PURE__ */ new Map([["2", ["squared"]], ["3", ["cubed"]]]), $u = /* @__PURE__ */ new Map([
5278
+ ]), ys = /* @__PURE__ */ new Map([["2", ["squared"]], ["3", ["cubed"]]]), $u = /* @__PURE__ */ new Map([
5169
5279
  ["msqrt", "radical"],
5170
5280
  ["mroot", "radical"],
5171
5281
  ["msub", "subscript"],
@@ -5175,7 +5285,7 @@ var yu = /* @__PURE__ */ new Set([
5175
5285
  ["munderover", "underoverscript"],
5176
5286
  ["mmultiscripts", "multiscript"],
5177
5287
  ["menclose", "enclosure"]
5178
- ]), Ru = (e) => e.replace(/\s+/g, " ").trim(), Xe = (e) => (e.localName || e.tagName || "").toLowerCase(), Lu = (e) => e.nodeType === Node.ELEMENT_NODE, yt = (e) => Array.from(e.childNodes).filter(Lu), Fr = (e) => Ru(e.textContent || ""), xe = (e, t) => ({
5288
+ ]), Ru = (e) => e.replace(/\s+/g, " ").trim(), Xe = (e) => (e.localName || e.tagName || "").toLowerCase(), Lu = (e) => e.nodeType === Node.ELEMENT_NODE, bt = (e) => Array.from(e.childNodes).filter(Lu), Fr = (e) => Ru(e.textContent || ""), xe = (e, t) => ({
5179
5289
  type: "element-range",
5180
5290
  quality: t,
5181
5291
  element: e
@@ -5195,7 +5305,7 @@ var yu = /* @__PURE__ */ new Set([
5195
5305
  default:
5196
5306
  return "unknown";
5197
5307
  }
5198
- }, Nu = (e, t) => t === "operator" ? e === "−" ? "-" : e : e.toLowerCase(), Wu = (e, t, n) => n === "fraction" ? ["over", "divided by"] : n === "superscript" ? bs.get(e) ?? [] : e === "|" ? ["absolute value"] : t === "operator" ? Ou.get(e) || [] : [], Qe = (e) => {
5308
+ }, Nu = (e, t) => t === "operator" ? e === "−" ? "-" : e : e.toLowerCase(), Wu = (e, t, n) => n === "fraction" ? ["over", "divided by"] : n === "superscript" ? ys.get(e) ?? [] : e === "|" ? ["absolute value"] : t === "operator" ? Ou.get(e) || [] : [], Qe = (e) => {
5199
5309
  const t = e.normalized ?? Nu(e.text, e.kind || "unknown");
5200
5310
  return {
5201
5311
  id: `math-token-${e.state.nextId++}`,
@@ -5212,9 +5322,9 @@ var yu = /* @__PURE__ */ new Set([
5212
5322
  }, Ze = (e, t, n = "tokens") => {
5213
5323
  e[n].push(t);
5214
5324
  }, Ts = (e, t, n) => {
5215
- yt(e).forEach((r, i) => Ee(r, t, `${n}/${Xe(r)}[${i}]`));
5325
+ bt(e).forEach((r, i) => Ee(r, t, `${n}/${Xe(r)}[${i}]`));
5216
5326
  }, zu = (e, t, n) => {
5217
- const r = yt(e);
5327
+ const r = bt(e);
5218
5328
  r[0] && Ee(r[0], t, `${n}/numerator`), Ze(t, Qe({
5219
5329
  state: t,
5220
5330
  kind: "structure",
@@ -5244,12 +5354,12 @@ var yu = /* @__PURE__ */ new Set([
5244
5354
  target: xe(e, "element-range")
5245
5355
  }));
5246
5356
  }, Bu = (e, t, n) => {
5247
- const r = yt(e);
5357
+ const r = bt(e);
5248
5358
  r[0] && Ee(r[0], t, `${n}/base`);
5249
5359
  const i = r[1];
5250
5360
  if (!i) return;
5251
5361
  const o = Fr(i);
5252
- if (bs.has(o)) {
5362
+ if (ys.has(o)) {
5253
5363
  Ze(t, Qe({
5254
5364
  state: t,
5255
5365
  kind: "structure",
@@ -5276,7 +5386,7 @@ var yu = /* @__PURE__ */ new Set([
5276
5386
  }));
5277
5387
  }, Fu = (e, t, n) => {
5278
5388
  let r = 0;
5279
- for (const i of yt(e))
5389
+ for (const i of bt(e))
5280
5390
  (Xe(i) === "mtr" || Xe(i) === "mlabeledtr") && (r++, Ze(t, Qe({
5281
5391
  state: t,
5282
5392
  kind: "layout",
@@ -5308,7 +5418,7 @@ var yu = /* @__PURE__ */ new Set([
5308
5418
  case "annotation-xml":
5309
5419
  return;
5310
5420
  case "semantics": {
5311
- const i = yt(e).find((o) => {
5421
+ const i = bt(e).find((o) => {
5312
5422
  const s = Xe(o);
5313
5423
  return s !== "annotation" && s !== "annotation-xml";
5314
5424
  });
@@ -5338,7 +5448,7 @@ var yu = /* @__PURE__ */ new Set([
5338
5448
  case "mphantom":
5339
5449
  return;
5340
5450
  case "maction": {
5341
- const i = yt(e)[0];
5451
+ const i = bt(e)[0];
5342
5452
  i && Ee(i, t, `${n}/action`);
5343
5453
  return;
5344
5454
  }
@@ -5674,7 +5784,7 @@ var yu = /* @__PURE__ */ new Set([
5674
5784
  lastCharWasWhitespace: !1,
5675
5785
  lastMapped: null,
5676
5786
  options: e
5677
- }), Es = (e) => e.classList?.contains("MathJax") || e.tagName?.toLowerCase() === "mjx-container", As = (e) => e.tagName?.toLowerCase() === "mjx-assistive-mml", Ms = (e) => {
5787
+ }), Es = (e) => e.classList?.contains("MathJax") || e.tagName?.toLowerCase() === "mjx-container", As = (e) => e.tagName?.toLowerCase() === "mjx-assistive-mml", Cs = (e) => {
5678
5788
  const t = e.tagName?.toLowerCase();
5679
5789
  return t === "annotation" || t === "annotation-xml";
5680
5790
  }, dh = (e) => {
@@ -5731,9 +5841,9 @@ var yu = /* @__PURE__ */ new Set([
5731
5841
  n = n.parentElement;
5732
5842
  }
5733
5843
  return r || t;
5734
- }, yh = (e) => !!(typeof e.querySelector == "function" && e.querySelector("math, [data-mathml], .MathJax, mjx-container, mjx-assistive-mml")) || e.tagName?.toLowerCase() === "math" || e.hasAttribute?.("data-mathml") || Es(e), Fe = (e, t, n) => {
5844
+ }, bh = (e) => !!(typeof e.querySelector == "function" && e.querySelector("math, [data-mathml], .MathJax, mjx-container, mjx-assistive-mml")) || e.tagName?.toLowerCase() === "math" || e.hasAttribute?.("data-mathml") || Es(e), Fe = (e, t, n) => {
5735
5845
  /[.,;:!?]/.test(t) && e.chars.length > 0 && e.chars[e.chars.length - 1] === " " && (e.chars.pop(), e.position--, e.map.delete(e.position)), e.chars.push(t), n ? (e.map.set(e.position, n), e.lastMapped = n) : e.lastMapped && e.map.set(e.position, e.lastMapped), e.position++;
5736
- }, Cs = (e, t) => {
5846
+ }, Ms = (e, t) => {
5737
5847
  if (e.inLeadingWhitespace || e.lastCharWasWhitespace || e.chars.length === 0) return !1;
5738
5848
  const n = e.chars[e.chars.length - 1];
5739
5849
  return as(n, t, e.options);
@@ -5756,7 +5866,7 @@ var yu = /* @__PURE__ */ new Set([
5756
5866
  }), e.lastCharWasWhitespace = !0;
5757
5867
  continue;
5758
5868
  }
5759
- !r && Cs(e, o) && Fe(e, " ", {
5869
+ !r && Ms(e, o) && Fe(e, " ", {
5760
5870
  node: t,
5761
5871
  offset: i
5762
5872
  }), Fe(e, o, {
@@ -5764,7 +5874,7 @@ var yu = /* @__PURE__ */ new Set([
5764
5874
  offset: i
5765
5875
  }), r = !0, e.lastCharWasWhitespace = !1;
5766
5876
  }
5767
- }, bh = (e, t) => {
5877
+ }, yh = (e, t) => {
5768
5878
  for (let n = 0; n < t.text.length; n++) {
5769
5879
  const r = t.text[n], i = /\s/.test(r), o = t.map.get(n) || null, s = o?.node || e.lastMapped?.node || null, a = o?.offset ?? e.lastMapped?.offset ?? 0, l = o ? {
5770
5880
  node: o.node,
@@ -5781,7 +5891,7 @@ var yu = /* @__PURE__ */ new Set([
5781
5891
  e.lastCharWasWhitespace || Fe(e, " ", l), e.lastCharWasWhitespace = !0;
5782
5892
  continue;
5783
5893
  }
5784
- n === 0 && Cs(e, r) && Fe(e, " ", l), Fe(e, r, l), e.lastCharWasWhitespace = !1, o ? (e.map.set(e.position - 1, {
5894
+ n === 0 && Ms(e, r) && Fe(e, " ", l), Fe(e, r, l), e.lastCharWasWhitespace = !1, o ? (e.map.set(e.position - 1, {
5785
5895
  node: o.node,
5786
5896
  offset: o.offset
5787
5897
  }), e.lastMapped = {
@@ -5804,7 +5914,7 @@ var yu = /* @__PURE__ */ new Set([
5804
5914
  }
5805
5915
  if (i.nodeType !== 1) return;
5806
5916
  const o = i;
5807
- if (!Ms(o))
5917
+ if (!Cs(o))
5808
5918
  for (const s of Array.from(o.childNodes)) r(s);
5809
5919
  };
5810
5920
  return r(t.documentElement), P(n.join(" "));
@@ -5817,7 +5927,7 @@ var yu = /* @__PURE__ */ new Set([
5817
5927
  }
5818
5928
  if (a.nodeType !== 1) return;
5819
5929
  const l = a;
5820
- if (!(As(l) || Ms(l)))
5930
+ if (!(As(l) || Cs(l)))
5821
5931
  for (const c of Array.from(l.childNodes)) i(c);
5822
5932
  };
5823
5933
  i(e), Is(r);
@@ -5858,7 +5968,7 @@ var yu = /* @__PURE__ */ new Set([
5858
5968
  if (f) {
5859
5969
  a();
5860
5970
  const p = _h(h, f, t);
5861
- bh(n, p);
5971
+ yh(n, p);
5862
5972
  const m = P(p.text);
5863
5973
  r.push({
5864
5974
  type: "math",
@@ -5880,8 +5990,8 @@ var yu = /* @__PURE__ */ new Set([
5880
5990
  chunks: r,
5881
5991
  containsMathMarkup: s
5882
5992
  };
5883
- }, Ct = (e, t) => {
5884
- if (!yh(e)) {
5993
+ }, Mt = (e, t) => {
5994
+ if (!bh(e)) {
5885
5995
  const { text: n, map: r } = Tn(e, t);
5886
5996
  return {
5887
5997
  visibleText: n,
@@ -5913,7 +6023,7 @@ var yu = /* @__PURE__ */ new Set([
5913
6023
  if (e.type !== "text" || !e.sourceElement) return !1;
5914
6024
  const t = e.sourceElement.tagName.toUpperCase(), n = (e.sourceElement.getAttribute("role") || "").toLowerCase();
5915
6025
  return xh.has(t) || Eh.has(n);
5916
- }, Mh = async (e) => {
6026
+ }, Ch = async (e) => {
5917
6027
  const t = e.resolveMathSpeech ?? wh, { visibleText: n } = e, r = [];
5918
6028
  let i = 0;
5919
6029
  const o = (a) => {
@@ -5931,18 +6041,18 @@ var yu = /* @__PURE__ */ new Set([
5931
6041
  offset: 0
5932
6042
  }] : Hr(l.text, { locale: e.language });
5933
6043
  for (const m of p) {
5934
- const y = P(m.text);
5935
- if (!y) continue;
5936
- const b = o(y);
6044
+ const b = P(m.text);
6045
+ if (!b) continue;
6046
+ const y = o(b);
5937
6047
  r.push({
5938
6048
  sourceChunkIndex: a,
5939
6049
  segment: {
5940
6050
  kind: "prose",
5941
- spokenText: y,
5942
- visibleText: y,
5943
- visibleSpan: b
6051
+ spokenText: b,
6052
+ visibleText: b,
6053
+ visibleSpan: y
5944
6054
  }
5945
- }), s.push(y);
6055
+ }), s.push(b);
5946
6056
  }
5947
6057
  continue;
5948
6058
  }
@@ -5970,7 +6080,7 @@ var yu = /* @__PURE__ */ new Set([
5970
6080
  visibleText: n,
5971
6081
  plainSpeechText: P(s.join(" "))
5972
6082
  };
5973
- }, Ch = (e) => (e || "en").split("-")[0].toLowerCase() || "en", Oh = "sre-v1", Ih = 256, mr = (e) => Array.isArray(e) ? `array:[${e.map(mr).join(",")}]` : e && typeof e == "object" ? `object:{${Object.entries(e).sort(([t], [n]) => t.localeCompare(n)).map(([t, n]) => `${JSON.stringify(t)}:${mr(n)}`).join(",")}}` : e === null ? "null:null" : typeof e > "u" ? "undefined:" : typeof e == "function" ? `function:${e.name || "anonymous"}` : typeof e == "symbol" ? `symbol:${String(e)}` : typeof e == "bigint" ? `bigint:${e.toString()}` : typeof e == "number" ? Number.isFinite(e) ? `number:${e}` : `number:${String(e)}` : `${typeof e}:${JSON.stringify(e)}`, ji = (e, t, n, r) => `${Oh}\0${Ch(e)}\0${t ? "ssml" : "plain"}\0${mr(n ?? null)}\0${r}`, $h = (e = {}) => {
6083
+ }, Mh = (e) => (e || "en").split("-")[0].toLowerCase() || "en", Oh = "sre-v1", Ih = 256, mr = (e) => Array.isArray(e) ? `array:[${e.map(mr).join(",")}]` : e && typeof e == "object" ? `object:{${Object.entries(e).sort(([t], [n]) => t.localeCompare(n)).map(([t, n]) => `${JSON.stringify(t)}:${mr(n)}`).join(",")}}` : e === null ? "null:null" : typeof e > "u" ? "undefined:" : typeof e == "function" ? `function:${e.name || "anonymous"}` : typeof e == "symbol" ? `symbol:${String(e)}` : typeof e == "bigint" ? `bigint:${e.toString()}` : typeof e == "number" ? Number.isFinite(e) ? `number:${e}` : `number:${String(e)}` : `${typeof e}:${JSON.stringify(e)}`, ji = (e, t, n, r) => `${Oh}\0${Mh(e)}\0${t ? "ssml" : "plain"}\0${mr(n ?? null)}\0${r}`, $h = (e = {}) => {
5974
6084
  const t = Math.max(1, e.maxEntries ?? Ih), n = e.resolve ?? ((o, s) => cs([o], s)), r = /* @__PURE__ */ new Map(), i = (o, s) => {
5975
6085
  for (r.delete(o), r.set(o, s); r.size > t; ) {
5976
6086
  const a = r.keys().next().value;
@@ -5978,7 +6088,7 @@ var yu = /* @__PURE__ */ new Set([
5978
6088
  }
5979
6089
  };
5980
6090
  return async (o, s) => {
5981
- const a = Cn(s.mathSpeech), l = s.produceSsml === !0, c = ji(s.language, l, a, o.mathml), u = r.get(c);
6091
+ const a = Mn(s.mathSpeech), l = s.produceSsml === !0, c = ji(s.language, l, a, o.mathml), u = r.get(c);
5982
6092
  if (u)
5983
6093
  return r.delete(c), r.set(c, u), u;
5984
6094
  const h = await n(o, {
@@ -6030,7 +6140,7 @@ var yu = /* @__PURE__ */ new Set([
6030
6140
  };
6031
6141
  let r, i;
6032
6142
  if (e.catalogAlignment)
6033
- r = Mu(e.catalogAlignment, t.position, t.length, t.word), i = e.catalogAlignment.spokenText;
6143
+ r = Cu(e.catalogAlignment, t.position, t.length, t.word), i = e.catalogAlignment.spokenText;
6034
6144
  else {
6035
6145
  const o = Lh(e, t);
6036
6146
  r = o.boundary, i = o.spokenText;
@@ -6080,7 +6190,7 @@ var yu = /* @__PURE__ */ new Set([
6080
6190
  ["mn", "mjx-mn"],
6081
6191
  ["mo", "mjx-mo"],
6082
6192
  ["mtext", "mjx-mtext"]
6083
- ]), yr = "mi,mn,mo,mtext", Rs = "mjx-mi,mjx-mn,mjx-mo,mjx-mtext", Ls = [
6193
+ ]), br = "mi,mn,mo,mtext", Rs = "mjx-mi,mjx-mn,mjx-mo,mjx-mtext", Ls = [
6084
6194
  "mjx-mfrac",
6085
6195
  "mjx-msqrt",
6086
6196
  "mjx-mroot",
@@ -6098,7 +6208,7 @@ var yu = /* @__PURE__ */ new Set([
6098
6208
  }, Vi = (e) => !e || On(e) ? !1 : !Tt(e), Ns = (e) => {
6099
6209
  const t = e.getBoundingClientRect?.();
6100
6210
  return !!(t && t.width > 0 && t.height > 0);
6101
- }, br = (e) => {
6211
+ }, yr = (e) => {
6102
6212
  let t = e;
6103
6213
  for (; t; ) {
6104
6214
  if (t.localName?.toLowerCase() === "math") return t;
@@ -6114,9 +6224,9 @@ var yu = /* @__PURE__ */ new Set([
6114
6224
  return !0;
6115
6225
  }, Wh = (e, t) => {
6116
6226
  if (!e || !$s.has(e.localName.toLowerCase()) || t.querySelector(Ls)) return null;
6117
- const n = br(e), r = t.querySelector("mjx-math");
6227
+ const n = yr(e), r = t.querySelector("mjx-math");
6118
6228
  if (!n || !r) return null;
6119
- const i = Array.from(n.querySelectorAll(yr)), o = i.indexOf(e);
6229
+ const i = Array.from(n.querySelectorAll(br)), o = i.indexOf(e);
6120
6230
  if (o < 0) return null;
6121
6231
  const s = Array.from(r.querySelectorAll(Rs));
6122
6232
  if (!Ws(i, s)) return null;
@@ -6126,13 +6236,13 @@ var yu = /* @__PURE__ */ new Set([
6126
6236
  const t = On(e);
6127
6237
  if (t) {
6128
6238
  if (t.querySelector(Ls)) return "expression";
6129
- const r = br(e) ?? e, i = t.querySelector("mjx-math");
6239
+ const r = yr(e) ?? e, i = t.querySelector("mjx-math");
6130
6240
  if (!i) return "expression";
6131
- const o = Array.from(r.querySelectorAll(yr)), s = Array.from(i.querySelectorAll(Rs));
6241
+ const o = Array.from(r.querySelectorAll(br)), s = Array.from(i.querySelectorAll(Rs));
6132
6242
  return Ws(o, s) && s.some((a) => Ns(a)) ? "token" : "expression";
6133
6243
  }
6134
- const n = br(e) ?? e;
6135
- return Array.from(n.querySelectorAll(yr)).some((r) => !Tt(r)) ? "token" : "expression";
6244
+ const n = yr(e) ?? e;
6245
+ return Array.from(n.querySelectorAll(br)).some((r) => !Tt(r)) ? "token" : "expression";
6136
6246
  }, Tr = (e) => {
6137
6247
  const t = Ps(e), n = On(t);
6138
6248
  if (n) {
@@ -6198,7 +6308,7 @@ var yu = /* @__PURE__ */ new Set([
6198
6308
  }
6199
6309
  }, Fh = (e, t) => {
6200
6310
  if (!e.catalogAlignment || t.chunkSpokenStart === null) return null;
6201
- const n = Cu(e.catalogAlignment, t.chunkSpokenStart);
6311
+ const n = Mu(e.catalogAlignment, t.chunkSpokenStart);
6202
6312
  if (!n) return null;
6203
6313
  const r = zs(e.visibleMap, n.start, n.end);
6204
6314
  return r ? {
@@ -6349,7 +6459,7 @@ var yu = /* @__PURE__ */ new Set([
6349
6459
  }
6350
6460
  return r;
6351
6461
  }, td = async (e) => {
6352
- const t = Ct(e.contentRoot, e.textProcessingOptions), n = await Mh({
6462
+ const t = Mt(e.contentRoot, e.textProcessingOptions), n = await Ch({
6353
6463
  chunks: t.chunks,
6354
6464
  visibleText: t.visibleText,
6355
6465
  language: e.language,
@@ -6431,13 +6541,13 @@ var yu = /* @__PURE__ */ new Set([
6431
6541
  }) : void 0,
6432
6542
  plainFallback: Bs(e, t)
6433
6543
  };
6434
- }, id = (e, t = {}) => e.items.map(({ segment: n, anchor: r }) => n.kind === "prose" ? nd(n, r) : t.format === "ssml" && n.ssml ? rd(n, r, n.ssml) : Bs(n, r)), od = "pie-tts-control-handoff", C;
6544
+ }, id = (e, t = {}) => e.items.map(({ segment: n, anchor: r }) => n.kind === "prose" ? nd(n, r) : t.format === "ssml" && n.ssml ? rd(n, r, n.ssml) : Bs(n, r)), od = "pie-tts-control-handoff", M;
6435
6545
  (function(e) {
6436
6546
  e.IDLE = "idle", e.LOADING = "loading", e.PLAYING = "playing", e.PAUSED = "paused", e.ERROR = "error";
6437
- })(C || (C = {}));
6547
+ })(M || (M = {}));
6438
6548
  var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOffset === t.startOffset && e.endContainer === t.endContainer && e.endOffset === t.endOffset, sd = (e, t) => e === t ? !0 : !e || !t || e.type !== t.type || e.quality !== t.quality ? !1 : e.type === "range" && t.type === "range" ? Ds(e.range, t.range) : e.type === "element" && t.type === "element" ? e.element === t.element : e.type === "text-range" && t.type === "text-range" ? e.node === t.node && e.startOffset === t.startOffset && e.endOffset === t.endOffset : !1, ad = class _r {
6439
6549
  constructor() {
6440
- g(this, "currentProvider", null), g(this, "provider", null), g(this, "highlightCoordinator", null), g(this, "highlightTargetResolverProvider", null), g(this, "catalogResolver", null), g(this, "state", C.IDLE), g(this, "ttsConfig", {}), g(this, "currentText", null), g(this, "currentContentElement", null), g(this, "normalizedToDOM", /* @__PURE__ */ new Map()), g(this, "listeners", /* @__PURE__ */ new Map()), g(this, "lastError", null), g(this, "speakRunId", 0), g(this, "currentBoundaryOffset", 0), g(this, "activeWordBoundaryOffset", 0), g(this, "seekSegments", []), g(this, "playbackChunks", []), g(this, "sentenceHighlightSegments", []), g(this, "currentSeekSegmentIndex", 0), g(this, "activeSentenceStartOffset", null), g(this, "activeHighlightMode", "word"), g(this, "lastRenderedRegionTarget", null), g(this, "telemetryReporter", null), g(this, "generatedMathSpeechResolver", $h());
6550
+ g(this, "currentProvider", null), g(this, "provider", null), g(this, "highlightCoordinator", null), g(this, "highlightTargetResolverProvider", null), g(this, "catalogResolver", null), g(this, "state", M.IDLE), g(this, "ttsConfig", {}), g(this, "currentText", null), g(this, "currentContentElement", null), g(this, "normalizedToDOM", /* @__PURE__ */ new Map()), g(this, "listeners", /* @__PURE__ */ new Map()), g(this, "lastError", null), g(this, "speakRunId", 0), g(this, "currentBoundaryOffset", 0), g(this, "activeWordBoundaryOffset", 0), g(this, "seekSegments", []), g(this, "playbackChunks", []), g(this, "sentenceHighlightSegments", []), g(this, "currentSeekSegmentIndex", 0), g(this, "activeSentenceStartOffset", null), g(this, "activeHighlightMode", "word"), g(this, "lastRenderedRegionTarget", null), g(this, "telemetryReporter", null), g(this, "generatedMathSpeechResolver", $h());
6441
6551
  }
6442
6552
  debugLog(t, n) {
6443
6553
  _r.debugEnabled && (n === void 0 ? console.debug(t) : console.debug(t, n));
@@ -6617,7 +6727,7 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
6617
6727
  }
6618
6728
  getMathSpeechOptions() {
6619
6729
  const t = (this.ttsConfig.providerOptions || {}).mathSpeech;
6620
- return Cn(t);
6730
+ return Mn(t);
6621
6731
  }
6622
6732
  buildPositionMap(t, n, r) {
6623
6733
  this.normalizedToDOM.clear();
@@ -6796,10 +6906,10 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
6796
6906
  }
6797
6907
  let u = a;
6798
6908
  for (const h of [...c, l]) {
6799
- const f = r.substring(u, h), p = f.match(/^\s*/)?.[0].length || 0, m = f.match(/\s*$/)?.[0].length || 0, y = u + p, b = h - m;
6800
- b > y && o.push({
6801
- text: r.substring(y, b),
6802
- startOffset: y,
6909
+ const f = r.substring(u, h), p = f.match(/^\s*/)?.[0].length || 0, m = f.match(/\s*$/)?.[0].length || 0, b = u + p, y = h - m;
6910
+ y > b && o.push({
6911
+ text: r.substring(b, y),
6912
+ startOffset: b,
6803
6913
  pauseMsAfter: 0
6804
6914
  }), u = h;
6805
6915
  }
@@ -6921,31 +7031,31 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
6921
7031
  }), this.initializeSpeakTracking(a, n);
6922
7032
  const p = n?.highlightModeOverride || (h ? this.resolveHighlightMode() : "sentence");
6923
7033
  this.activeHighlightMode = p, this.activeWordBoundaryOffset = n?.wordBoundaryOffset || 0;
6924
- const m = this.hasExplicitBreakSemantics(o), y = !!this.currentContentElement && !c && !m && h;
6925
- if (this.playbackChunks = f?.length ? f : [], this.seekSegments = this.playbackChunks.length ? this.createSeekSegmentsFromSpeechChunks(this.playbackChunks) : m || !h ? [] : y && this.currentContentElement ? this.createSpeechPlan(this.currentContentElement, l) : this.createSeekSegmentsFromText(a), this.sentenceHighlightSegments = m ? [] : this.createSentenceHighlightSegments({
7034
+ const m = this.hasExplicitBreakSemantics(o), b = !!this.currentContentElement && !c && !m && h;
7035
+ if (this.playbackChunks = f?.length ? f : [], this.seekSegments = this.playbackChunks.length ? this.createSeekSegmentsFromSpeechChunks(this.playbackChunks) : m || !h ? [] : b && this.currentContentElement ? this.createSpeechPlan(this.currentContentElement, l) : this.createSeekSegmentsFromText(a), this.sentenceHighlightSegments = m ? [] : this.createSentenceHighlightSegments({
6926
7036
  contentToSpeak: a,
6927
- shouldUsePlan: y,
7037
+ shouldUsePlan: b,
6928
7038
  playbackSegments: this.seekSegments
6929
- }), this.setState(C.LOADING), this.prepareHighlightsForSpeak({
7039
+ }), this.setState(M.LOADING), this.prepareHighlightsForSpeak({
6930
7040
  contentToSpeak: a,
6931
7041
  options: n,
6932
7042
  highlightMode: p,
6933
- shouldUsePlan: y
7043
+ shouldUsePlan: b
6934
7044
  }), h ? this.configureWordBoundaryHighlighting({
6935
7045
  highlightMode: p,
6936
7046
  wordBoundaryOffset: n?.wordBoundaryOffset || 0
6937
- }) : this.clearWordBoundaryHighlighting(), this.setState(C.PLAYING), await this.executeSpeakPlayback({
6938
- shouldUsePlan: y,
7047
+ }) : this.clearWordBoundaryHighlighting(), this.setState(M.PLAYING), await this.executeSpeakPlayback({
7048
+ shouldUsePlan: b,
6939
7049
  runId: r,
6940
7050
  highlightMode: p,
6941
7051
  contentToSpeak: s,
6942
7052
  speechChunks: f
6943
7053
  }), r !== this.speakRunId) return;
6944
- this.setState(C.IDLE), this.clearHighlightsAndTracking();
7054
+ this.setState(M.IDLE), this.clearHighlightsAndTracking();
6945
7055
  } catch (i) {
6946
7056
  let o = i;
6947
7057
  if (console.error("TTS error:", o), this.lastError = o instanceof Error ? o.message : String(o), r !== this.speakRunId) return;
6948
- throw this.setState(C.ERROR), this.clearHighlightsAndTracking(), o;
7058
+ throw this.setState(M.ERROR), this.clearHighlightsAndTracking(), o;
6949
7059
  }
6950
7060
  }
6951
7061
  async switchProviderToBrowser(t, n) {
@@ -7021,7 +7131,7 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7021
7131
  context: n.catalogContext
7022
7132
  });
7023
7133
  if (o) {
7024
- const s = n?.contentElement && Ct(n.contentElement, this.getTextProcessingOptions(n.language)).visibleText || r, a = P(o.content);
7134
+ const s = n?.contentElement && Mt(n.contentElement, this.getTextProcessingOptions(n.language)).visibleText || r, a = P(o.content);
7025
7135
  return this.debugLog(`[TTSService] Using catalog content for "${n.catalogId}" (${o.language})`), {
7026
7136
  contentToSpeak: o.content,
7027
7137
  speechText: o.content,
@@ -7055,7 +7165,7 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7055
7165
  if (!this.catalogResolver) return null;
7056
7166
  const i = this.collectCatalogSpeechChunks(t, r);
7057
7167
  if (!i.some((a) => a.sourceElement)) return null;
7058
- const o = P(i.map((a) => a.speechText).join(" ")), s = Ct(t, this.getTextProcessingOptions(r.language)).visibleText || n;
7168
+ const o = P(i.map((a) => a.speechText).join(" ")), s = Mt(t, this.getTextProcessingOptions(r.language)).visibleText || n;
7059
7169
  return {
7060
7170
  contentToSpeak: o,
7061
7171
  speechText: o,
@@ -7091,8 +7201,8 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7091
7201
  }, a = (u, h) => {
7092
7202
  const f = l(u);
7093
7203
  if (f.length !== 1) return null;
7094
- const p = f[0], m = Ct(p, this.getTextProcessingOptions(n.language)).visibleText || P(p.textContent || ""), y = (b) => P(b).replace(/\s+/g, "");
7095
- return y(m) === y(h) ? p : null;
7204
+ const p = f[0], m = Mt(p, this.getTextProcessingOptions(n.language)).visibleText || P(p.textContent || ""), b = (y) => P(y).replace(/\s+/g, "");
7205
+ return b(m) === b(h) ? p : null;
7096
7206
  }, l = (u) => {
7097
7207
  const h = Array.from(u.querySelectorAll("math"));
7098
7208
  return u.localName?.toLowerCase() === "math" ? [u, ...h] : h;
@@ -7106,16 +7216,16 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7106
7216
  const h = u, f = s(h);
7107
7217
  if (f) {
7108
7218
  o();
7109
- const p = Ct(h, this.getTextProcessingOptions(n.language)), m = p.visibleText || P(h.textContent || ""), y = ms({
7219
+ const p = Mt(h, this.getTextProcessingOptions(n.language)), m = p.visibleText || P(h.textContent || ""), b = ms({
7110
7220
  speechText: f.content,
7111
7221
  visibleText: m
7112
- }), b = a(h, m), E = b ? Sn({
7113
- mathElement: b,
7222
+ }), y = a(h, m), E = y ? Sn({
7223
+ mathElement: y,
7114
7224
  speechText: f.content
7115
- }) : void 0, R = E ? void 0 : l(h).map((M) => ({
7116
- element: M,
7225
+ }) : void 0, R = E ? void 0 : l(h).map((C) => ({
7226
+ element: C,
7117
7227
  alignment: Sn({
7118
- mathElement: M,
7228
+ mathElement: C,
7119
7229
  speechText: f.content
7120
7230
  })
7121
7231
  })), F = P(f.content);
@@ -7125,8 +7235,8 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7125
7235
  sourceElement: h,
7126
7236
  regionElement: Hs(h, t),
7127
7237
  speechMatchesVisibleText: F === m,
7128
- playbackMode: y.playbackMode,
7129
- alignment: y,
7238
+ playbackMode: b.playbackMode,
7239
+ alignment: b,
7130
7240
  mathAlignment: E,
7131
7241
  mathAlignments: R,
7132
7242
  visibleMap: p.map
@@ -7371,10 +7481,10 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7371
7481
  });
7372
7482
  }
7373
7483
  pause() {
7374
- this.provider && this.state === C.PLAYING && (this.provider.pause(), this.setState(C.PAUSED));
7484
+ this.provider && this.state === M.PLAYING && (this.provider.pause(), this.setState(M.PAUSED));
7375
7485
  }
7376
7486
  resume() {
7377
- this.provider && this.state === C.PAUSED && (this.provider.resume(), this.setState(C.PLAYING));
7487
+ this.provider && this.state === M.PAUSED && (this.provider.resume(), this.setState(M.PLAYING));
7378
7488
  }
7379
7489
  normalizePlaybackRate(t) {
7380
7490
  return Number.isFinite(t) ? Math.max(0.25, Math.min(4, t)) : 1;
@@ -7384,7 +7494,7 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7384
7494
  const n = Math.max(0, Math.min(this.seekSegments.length - 1, t)), r = this.playbackChunks.length ? this.playbackChunks.slice(n) : null;
7385
7495
  this.speakRunId += 1, this.provider.onWordBoundary = void 0, this.provider.stop(), this.currentSeekSegmentIndex = n;
7386
7496
  const i = ++this.speakRunId, o = this.seekSegments.slice(n);
7387
- this.setState(C.PLAYING);
7497
+ this.setState(M.PLAYING);
7388
7498
  try {
7389
7499
  if (this.configureWordBoundaryHighlighting({
7390
7500
  highlightMode: this.activeHighlightMode,
@@ -7398,18 +7508,18 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7398
7508
  }
7399
7509
  else await this.speakWithPlan(o, i, { highlightMode: this.activeHighlightMode });
7400
7510
  if (i !== this.speakRunId) return;
7401
- this.setState(C.IDLE), this.clearHighlightsAndTracking(), this.highlightTargetResolverProvider = null;
7511
+ this.setState(M.IDLE), this.clearHighlightsAndTracking(), this.highlightTargetResolverProvider = null;
7402
7512
  } catch (s) {
7403
7513
  if (i !== this.speakRunId) return;
7404
- throw this.lastError = s instanceof Error ? s.message : String(s), this.setState(C.ERROR), this.clearHighlightsAndTracking(), this.highlightTargetResolverProvider = null, s;
7514
+ throw this.lastError = s instanceof Error ? s.message : String(s), this.setState(M.ERROR), this.clearHighlightsAndTracking(), this.highlightTargetResolverProvider = null, s;
7405
7515
  }
7406
7516
  }
7407
7517
  async setPlaybackRate(t) {
7408
7518
  const n = this.normalizePlaybackRate(t);
7409
- await this.updateSettings({ rate: n }), !(this.state !== C.PLAYING || !this.currentText || this.seekSegments.length === 0 || this.hasExplicitBreakSemantics(this.currentText)) && await this.restartFromSeekIndex(this.getCurrentSeekSegmentIndex());
7519
+ await this.updateSettings({ rate: n }), !(this.state !== M.PLAYING || !this.currentText || this.seekSegments.length === 0 || this.hasExplicitBreakSemantics(this.currentText)) && await this.restartFromSeekIndex(this.getCurrentSeekSegmentIndex());
7410
7520
  }
7411
7521
  async seekBy(t) {
7412
- if (!this.provider || !this.currentText || this.state !== C.PLAYING && this.state !== C.PAUSED || this.hasExplicitBreakSemantics(this.currentText) || this.seekSegments.length === 0) return;
7522
+ if (!this.provider || !this.currentText || this.state !== M.PLAYING && this.state !== M.PAUSED || this.hasExplicitBreakSemantics(this.currentText) || this.seekSegments.length === 0) return;
7413
7523
  const n = Number.isFinite(t) ? Math.trunc(t) : 0;
7414
7524
  if (n === 0) return;
7415
7525
  const r = this.getCurrentSeekSegmentIndex(), i = Math.max(0, Math.min(this.seekSegments.length - 1, r + n));
@@ -7424,16 +7534,16 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7424
7534
  await this.seekBy(-n);
7425
7535
  }
7426
7536
  stop() {
7427
- this.provider && (this.speakRunId += 1, this.provider.onWordBoundary = void 0, this.provider.stop(), this.highlightTargetResolverProvider = null, this.setState(C.IDLE), this.currentText = null, this.highlightCoordinator && this.highlightCoordinator.clearTTS(), this.lastRenderedRegionTarget = null, this.currentContentElement = null, this.normalizedToDOM.clear(), this.currentBoundaryOffset = 0, this.activeWordBoundaryOffset = 0, this.seekSegments = [], this.playbackChunks = [], this.sentenceHighlightSegments = [], this.currentSeekSegmentIndex = 0, this.activeSentenceStartOffset = null);
7537
+ this.provider && (this.speakRunId += 1, this.provider.onWordBoundary = void 0, this.provider.stop(), this.highlightTargetResolverProvider = null, this.setState(M.IDLE), this.currentText = null, this.highlightCoordinator && this.highlightCoordinator.clearTTS(), this.lastRenderedRegionTarget = null, this.currentContentElement = null, this.normalizedToDOM.clear(), this.currentBoundaryOffset = 0, this.activeWordBoundaryOffset = 0, this.seekSegments = [], this.playbackChunks = [], this.sentenceHighlightSegments = [], this.currentSeekSegmentIndex = 0, this.activeSentenceStartOffset = null);
7428
7538
  }
7429
7539
  requestControlHandoff() {
7430
7540
  typeof window > "u" || window.dispatchEvent(new CustomEvent(od, { detail: { source: "host" } }));
7431
7541
  }
7432
7542
  isPlaying() {
7433
- return this.state === C.PLAYING;
7543
+ return this.state === M.PLAYING;
7434
7544
  }
7435
7545
  isPaused() {
7436
- return this.state === C.PAUSED;
7546
+ return this.state === M.PAUSED;
7437
7547
  }
7438
7548
  getState() {
7439
7549
  return this.state;
@@ -7461,8 +7571,8 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7461
7571
  providerId: "tts",
7462
7572
  previousState: n,
7463
7573
  state: t
7464
- }), t === C.PLAYING) {
7465
- const r = n === C.PAUSED ? "pie-tool-playback-resume" : "pie-tool-playback-start";
7574
+ }), t === M.PLAYING) {
7575
+ const r = n === M.PAUSED ? "pie-tool-playback-resume" : "pie-tool-playback-start";
7466
7576
  this.emitTelemetry(r, {
7467
7577
  toolId: "textToSpeech",
7468
7578
  providerId: "tts",
@@ -7471,7 +7581,7 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7471
7581
  });
7472
7582
  return;
7473
7583
  }
7474
- if (t === C.PAUSED) {
7584
+ if (t === M.PAUSED) {
7475
7585
  this.emitTelemetry("pie-tool-playback-pause", {
7476
7586
  toolId: "textToSpeech",
7477
7587
  providerId: "tts",
@@ -7480,7 +7590,7 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7480
7590
  });
7481
7591
  return;
7482
7592
  }
7483
- if (t === C.ERROR) {
7593
+ if (t === M.ERROR) {
7484
7594
  this.emitTelemetry("pie-tool-playback-error", {
7485
7595
  toolId: "textToSpeech",
7486
7596
  providerId: "tts",
@@ -7490,7 +7600,7 @@ var Ds = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7490
7600
  });
7491
7601
  return;
7492
7602
  }
7493
- t === C.IDLE && (n === C.PLAYING || n === C.PAUSED || n === C.LOADING) && this.emitTelemetry("pie-tool-playback-stop", {
7603
+ t === M.IDLE && (n === M.PLAYING || n === M.PAUSED || n === M.LOADING) && this.emitTelemetry("pie-tool-playback-stop", {
7494
7604
  toolId: "textToSpeech",
7495
7605
  providerId: "tts",
7496
7606
  previousState: n,
@@ -7549,7 +7659,7 @@ function hd(e, t) {
7549
7659
  width: 0,
7550
7660
  height: 0,
7551
7661
  mouseY: 0
7552
- })), m = /* @__PURE__ */ z(""), y = /* @__PURE__ */ z("#ffff00"), b = /* @__PURE__ */ z(0.3), E = /* @__PURE__ */ z("highlight"), R = /* @__PURE__ */ z(!1);
7662
+ })), m = /* @__PURE__ */ z(""), b = /* @__PURE__ */ z("#ffff00"), y = /* @__PURE__ */ z(0.3), E = /* @__PURE__ */ z("highlight"), R = /* @__PURE__ */ z(!1);
7553
7663
  const F = [
7554
7664
  {
7555
7665
  name: "Yellow",
@@ -7571,8 +7681,8 @@ function hd(e, t) {
7571
7681
  name: "Orange",
7572
7682
  value: "#ffa500"
7573
7683
  }
7574
- ], M = 10, U = 10;
7575
- Mt(() => {
7684
+ ], C = 10, U = 10;
7685
+ Ct(() => {
7576
7686
  if (v(o))
7577
7687
  return ac(v(o), (w) => {
7578
7688
  $(s, w, !0);
@@ -7582,11 +7692,11 @@ function hd(e, t) {
7582
7692
  $(m, w, !0), setTimeout(() => $(m, ""), 1e3);
7583
7693
  }
7584
7694
  function jt() {
7585
- const w = (F.findIndex((D) => D.value === v(y)) + 1) % F.length;
7586
- $(y, F[w].value, !0), H(`Color changed to ${F[w].name}`);
7695
+ const w = (F.findIndex((D) => D.value === v(b)) + 1) % F.length;
7696
+ $(b, F[w].value, !0), H(`Color changed to ${F[w].name}`);
7587
7697
  }
7588
7698
  function _t(w) {
7589
- $(b, Math.max(0.1, Math.min(0.9, v(b) + w)), !0), H(`Opacity ${Math.round(v(b) * 100)}%`);
7699
+ $(y, Math.max(0.1, Math.min(0.9, v(y) + w)), !0), H(`Opacity ${Math.round(v(y) * 100)}%`);
7590
7700
  }
7591
7701
  function Vt() {
7592
7702
  $(E, v(E) === "highlight" ? "obscure" : "highlight", !0), H(`Mode changed to ${v(E) === "highlight" ? "highlight" : "masking"}`);
@@ -7624,16 +7734,16 @@ function hd(e, t) {
7624
7734
  let D = !1;
7625
7735
  switch (w.key) {
7626
7736
  case "ArrowUp":
7627
- v(u).y -= M, H(`Moved up to ${Math.round(v(u).y)}`), D = !0;
7737
+ v(u).y -= C, H(`Moved up to ${Math.round(v(u).y)}`), D = !0;
7628
7738
  break;
7629
7739
  case "ArrowDown":
7630
- v(u).y += M, H(`Moved down to ${Math.round(v(u).y)}`), D = !0;
7740
+ v(u).y += C, H(`Moved down to ${Math.round(v(u).y)}`), D = !0;
7631
7741
  break;
7632
7742
  case "ArrowLeft":
7633
- v(u).x -= M, H(`Moved left to ${Math.round(v(u).x)}`), D = !0;
7743
+ v(u).x -= C, H(`Moved left to ${Math.round(v(u).x)}`), D = !0;
7634
7744
  break;
7635
7745
  case "ArrowRight":
7636
- v(u).x += M, H(`Moved right to ${Math.round(v(u).x)}`), D = !0;
7746
+ v(u).x += C, H(`Moved right to ${Math.round(v(u).x)}`), D = !0;
7637
7747
  break;
7638
7748
  case "+":
7639
7749
  case "=":
@@ -7660,16 +7770,16 @@ function hd(e, t) {
7660
7770
  }
7661
7771
  D && w.preventDefault();
7662
7772
  }
7663
- Mt(() => {
7773
+ Ct(() => {
7664
7774
  v(a) && r() && !v(R) && (v(a).registerTool(r(), "Line Reader", void 0, hr.TOOL), $(R, !0));
7665
7775
  }), zl(() => () => {
7666
7776
  v(a) && r() && v(a).unregisterTool(r());
7667
- }), Mt(() => {
7777
+ }), Ct(() => {
7668
7778
  v(a) && v(o) && r() && v(a).updateToolElement(r(), v(o));
7669
- }), Mt(() => {
7779
+ }), Ct(() => {
7670
7780
  n() && v(o) && setTimeout(() => v(o)?.focus(), 100);
7671
7781
  });
7672
- let Us = /* @__PURE__ */ ai(() => v(y) + Math.round(v(b) * 255).toString(16).padStart(2, "0"));
7782
+ let Us = /* @__PURE__ */ ai(() => v(b) + Math.round(v(y) * 255).toString(16).padStart(2, "0"));
7673
7783
  var Gs = {
7674
7784
  get visible() {
7675
7785
  return n();
@@ -7683,26 +7793,26 @@ function hd(e, t) {
7683
7793
  set toolId(w = "lineReader") {
7684
7794
  r(w), Zn();
7685
7795
  }
7686
- }, Vr = Cl(), Ys = Pn(Vr), Ks = (w) => {
7796
+ }, Vr = Ml(), Ys = Pn(Vr), Ks = (w) => {
7687
7797
  var D = cd(), Rn = Pn(D), Xs = ci(Rn, !0);
7688
7798
  ti(Rn);
7689
- var qr = St(Rn, 2), Js = (ye) => {
7799
+ var qr = St(Rn, 2), Js = (be) => {
7690
7800
  var qt = ld(), Gr = Pn(qt), Yr = St(Gr, 2), Kr = St(Yr, 2), Zs = St(Kr, 2);
7691
7801
  ui((ea, ta) => {
7692
7802
  nt(Gr, `height: ${ea ?? ""}px;`), nt(Yr, `top: ${v(u).y + v(h).height / 2}px;`), nt(Kr, `top: ${v(u).y - v(h).height / 2}px; height: ${v(h).height ?? ""}px; width: ${ta ?? ""}px;`), nt(Zs, `top: ${v(u).y - v(h).height / 2}px; height: ${v(h).height ?? ""}px; left: ${v(u).x + v(h).width / 2}px;`);
7693
- }, [() => Math.max(0, v(u).y - v(h).height / 2), () => Math.max(0, v(u).x - v(h).width / 2)]), en(ye, qt);
7803
+ }, [() => Math.max(0, v(u).y - v(h).height / 2), () => Math.max(0, v(u).x - v(h).width / 2)]), en(be, qt);
7694
7804
  };
7695
- bi(qr, (ye) => {
7696
- v(E) === "obscure" && ye(Js);
7805
+ yi(qr, (be) => {
7806
+ v(E) === "obscure" && be(Js);
7697
7807
  });
7698
7808
  var Oe = St(qr, 2);
7699
7809
  let Ur;
7700
7810
  var Qs = ci(Oe);
7701
- Qi(2), ti(Oe), Jl(Oe, (ye) => $(o, ye), () => v(o)), ui((ye, qt) => {
7702
- Ll(Xs, v(m)), Ur = jl(Oe, 1, "pie-tool-line-reader svelte-1a3d6dx", null, Ur, { "pie-tool-line-reader--masking-mode": v(E) === "obscure" }), nt(Oe, `left: ${v(u).x ?? ""}px; top: ${v(u).y ?? ""}px; width: ${v(h).width ?? ""}px; height: ${v(h).height ?? ""}px;`), Gl(Oe, "aria-label", `Line Reader tool. Mode: ${v(E) === "highlight" ? "Highlight" : "Masking"}. Use arrow keys to move, +/- to resize height, C to change color, [ and ] to adjust opacity, M to toggle mode. Current color: ${ye ?? ""}, Opacity: ${qt ?? ""}%`), nt(Qs, `background-color: ${v(Us) ?? ""};`);
7703
- }, [() => F.find((ye) => ye.value === v(y))?.name, () => Math.round(v(b) * 100)]), pi("pointerdown", Oe, Fs), pi("keydown", Oe, qs), en(w, D);
7811
+ Qi(2), ti(Oe), Jl(Oe, (be) => $(o, be), () => v(o)), ui((be, qt) => {
7812
+ Ll(Xs, v(m)), Ur = jl(Oe, 1, "pie-tool-line-reader svelte-1a3d6dx", null, Ur, { "pie-tool-line-reader--masking-mode": v(E) === "obscure" }), nt(Oe, `left: ${v(u).x ?? ""}px; top: ${v(u).y ?? ""}px; width: ${v(h).width ?? ""}px; height: ${v(h).height ?? ""}px;`), Gl(Oe, "aria-label", `Line Reader tool. Mode: ${v(E) === "highlight" ? "Highlight" : "Masking"}. Use arrow keys to move, +/- to resize height, C to change color, [ and ] to adjust opacity, M to toggle mode. Current color: ${be ?? ""}, Opacity: ${qt ?? ""}%`), nt(Qs, `background-color: ${v(Us) ?? ""};`);
7813
+ }, [() => F.find((be) => be.value === v(b))?.name, () => Math.round(v(y) * 100)]), pi("pointerdown", Oe, Fs), pi("keydown", Oe, qs), en(w, D);
7704
7814
  };
7705
- return bi(Ys, (w) => {
7815
+ return yi(Ys, (w) => {
7706
7816
  n() && w(Ks);
7707
7817
  }), en(e, Vr), ro(Gs);
7708
7818
  }