@pie-players/pie-tool-annotation-toolbar 0.3.52 → 0.3.53

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.
@@ -217,11 +217,11 @@ function Ue(e, t) {
217
217
  throw e;
218
218
  }
219
219
  var ol = ~(de | bt | ce);
220
- function z(e, t) {
220
+ function B(e, t) {
221
221
  e.f = e.f & ol | t;
222
222
  }
223
223
  function Yr(e) {
224
- (e.f & 512) !== 0 || e.deps === null ? z(e, ce) : z(e, bt);
224
+ (e.f & 512) !== 0 || e.deps === null ? B(e, ce) : B(e, bt);
225
225
  }
226
226
  function Ro(e) {
227
227
  if (e !== null)
@@ -229,7 +229,7 @@ function Ro(e) {
229
229
  (t.f & 2) === 0 || (t.f & 65536) === 0 || (t.f ^= nn, Ro(t.deps));
230
230
  }
231
231
  function $o(e, t, n) {
232
- (e.f & 2048) !== 0 ? t.add(e) : (e.f & 4096) !== 0 && n.add(e), Ro(e.deps), z(e, ce);
232
+ (e.f & 2048) !== 0 ? t.add(e) : (e.f & 4096) !== 0 && n.add(e), Ro(e.deps), B(e, ce);
233
233
  }
234
234
  var sl = !1, dn = !1;
235
235
  function al(e) {
@@ -260,9 +260,9 @@ function f(e, t) {
260
260
  return e.get(A(e, t));
261
261
  }
262
262
  var Po, $n = null, wt = null, C = null, _r = null, X = null, Sr = null, Jt = !1, ir = !1, Ot = null, Ln = null, No = 0;
263
- var ll = 1, Pn = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), Nn = /* @__PURE__ */ new WeakMap(), fn = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), wr = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), Ve = /* @__PURE__ */ new WeakMap(), _n = /* @__PURE__ */ new WeakMap(), Vt = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakSet(), yt = class Wo {
263
+ var ll = 1, Pn = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), Nn = /* @__PURE__ */ new WeakMap(), fn = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), wr = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), Ve = /* @__PURE__ */ new WeakMap(), _n = /* @__PURE__ */ new WeakMap(), Vt = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakSet(), yt = class Wo {
264
264
  constructor() {
265
- Xr(this, B), m(this, "id", ll++), E(this, Pn, !1), m(this, "linked", !0), E(this, ot, null), E(this, et, null), m(this, "async_deriveds", /* @__PURE__ */ new Map()), m(this, "current", /* @__PURE__ */ new Map()), m(this, "previous", /* @__PURE__ */ new Map()), E(this, Nn, /* @__PURE__ */ new Set()), E(this, fn, /* @__PURE__ */ new Set()), E(this, kt, 0), E(this, Qe, /* @__PURE__ */ new Map()), E(this, qt, null), E(this, se, []), E(this, wr, []), E(this, ft, /* @__PURE__ */ new Set()), E(this, Re, /* @__PURE__ */ new Set()), E(this, Ve, /* @__PURE__ */ new Map()), E(this, _n, /* @__PURE__ */ new Set()), m(this, "is_fork", !1), E(this, Vt, !1), wt === null ? $n = wt = this : (w(et, wt, this), w(ot, this, wt)), wt = this;
265
+ Xr(this, D), m(this, "id", ll++), E(this, Pn, !1), m(this, "linked", !0), E(this, ot, null), E(this, et, null), m(this, "async_deriveds", /* @__PURE__ */ new Map()), m(this, "current", /* @__PURE__ */ new Map()), m(this, "previous", /* @__PURE__ */ new Map()), E(this, Nn, /* @__PURE__ */ new Set()), E(this, fn, /* @__PURE__ */ new Set()), E(this, kt, 0), E(this, Qe, /* @__PURE__ */ new Map()), E(this, qt, null), E(this, se, []), E(this, wr, []), E(this, ft, /* @__PURE__ */ new Set()), E(this, Re, /* @__PURE__ */ new Set()), E(this, Ve, /* @__PURE__ */ new Map()), E(this, _n, /* @__PURE__ */ new Set()), m(this, "is_fork", !1), E(this, Vt, !1), wt === null ? $n = wt = this : (w(et, wt, this), w(ot, this, wt)), wt = this;
266
266
  }
267
267
  skip_effect(t) {
268
268
  f(Ve, this).has(t) || f(Ve, this).set(t, {
@@ -275,9 +275,9 @@ var ll = 1, Pn = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap
275
275
  if (r) {
276
276
  f(Ve, this).delete(t);
277
277
  for (var i of r.d)
278
- z(i, de), n(i);
278
+ B(i, de), n(i);
279
279
  for (i of r.m)
280
- z(i, bt), n(i);
280
+ B(i, bt), n(i);
281
281
  }
282
282
  f(_n, this).add(t);
283
283
  }
@@ -292,14 +292,14 @@ var ll = 1, Pn = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap
292
292
  }
293
293
  flush() {
294
294
  try {
295
- ir = !0, C = this, A(B, this, Wn).call(this);
295
+ ir = !0, C = this, A(D, this, Wn).call(this);
296
296
  } finally {
297
297
  No = 0, Sr = null, Ot = null, Ln = null, ir = !1, C = null, X = null, lt.clear();
298
298
  }
299
299
  }
300
300
  discard() {
301
301
  for (const t of f(fn, this)) t(this);
302
- f(fn, this).clear(), A(B, this, Hn).call(this), f(qt, this)?.resolve();
302
+ f(fn, this).clear(), A(D, this, Hn).call(this), f(qt, this)?.resolve();
303
303
  }
304
304
  register_created_effect(t) {
305
305
  f(wr, this).push(t);
@@ -397,43 +397,43 @@ function Mi() {
397
397
  return !1;
398
398
  }
399
399
  function Wn() {
400
- w(Pn, this, !0), No++ > 1e3 && (A(B, this, Hn).call(this), dl());
400
+ w(Pn, this, !0), No++ > 1e3 && (A(D, this, Hn).call(this), dl());
401
401
  for (const a of f(ft, this))
402
- f(Re, this).delete(a), z(a, de), this.schedule(a);
402
+ f(Re, this).delete(a), B(a, de), this.schedule(a);
403
403
  for (const a of f(Re, this))
404
- z(a, bt), this.schedule(a);
404
+ B(a, bt), this.schedule(a);
405
405
  const e = f(se, this);
406
406
  w(se, this, []), this.apply();
407
407
  var t = Ot = [], n = [], r = Ln = [];
408
408
  for (const a of e) try {
409
- A(B, this, Ho).call(this, a, t, n);
409
+ A(D, this, Ho).call(this, a, t, n);
410
410
  } catch (l) {
411
- throw Do(a), A(B, this, Mi).call(this) || this.discard(), l;
411
+ throw Do(a), A(D, this, Mi).call(this) || this.discard(), l;
412
412
  }
413
413
  if (C = null, r.length > 0) {
414
414
  var i = Po.ensure();
415
415
  for (const a of r) i.schedule(a);
416
416
  }
417
- if (Ot = null, Ln = null, A(B, this, Mi).call(this)) {
418
- A(B, this, Ut).call(this, n), A(B, this, Ut).call(this, t);
417
+ if (Ot = null, Ln = null, A(D, this, Mi).call(this)) {
418
+ A(D, this, Ut).call(this, n), A(D, this, Ut).call(this, t);
419
419
  for (const [a, l] of f(Ve, this)) Bo(a, l);
420
- r.length > 0 && A(B, C, Wn).call(C);
420
+ r.length > 0 && A(D, C, Wn).call(C);
421
421
  return;
422
422
  }
423
- const o = A(B, this, cl).call(this);
423
+ const o = A(D, this, cl).call(this);
424
424
  if (o) {
425
- A(B, this, Ut).call(this, n), A(B, this, Ut).call(this, t), A(B, o, ul).call(o, this);
425
+ A(D, this, Ut).call(this, n), A(D, this, Ut).call(this, t), A(D, o, ul).call(o, this);
426
426
  return;
427
427
  }
428
428
  f(ft, this).clear(), f(Re, this).clear();
429
429
  for (const a of f(Nn, this)) a(this);
430
430
  f(Nn, this).clear(), _r = this, Oi(n), Oi(t), _r = null, f(qt, this)?.resolve();
431
431
  var s = C;
432
- if (f(kt, this) === 0 && (f(se, this).length === 0 || s !== null) && (A(B, this, Hn).call(this), $e && (A(B, this, hl).call(this), C = s)), f(se, this).length > 0) if (s !== null) {
432
+ if (f(kt, this) === 0 && (f(se, this).length === 0 || s !== null) && (A(D, this, Hn).call(this), $e && (A(D, this, hl).call(this), C = s)), f(se, this).length > 0) if (s !== null) {
433
433
  const a = s;
434
434
  f(se, a).push(...f(se, this).filter((l) => !f(se, a).includes(l)));
435
435
  } else s = this;
436
- s !== null && A(B, s, Wn).call(s);
436
+ s !== null && A(D, s, Wn).call(s);
437
437
  }
438
438
  function Ho(e, t, n) {
439
439
  e.f ^= ce;
@@ -482,12 +482,12 @@ function ul(e) {
482
482
  if ((i & 2) !== 0) t(s);
483
483
  else {
484
484
  var o = s;
485
- i & 4194320 && !this.async_deriveds.has(o) && (f(Re, this).delete(o), z(o, de), this.schedule(o));
485
+ i & 4194320 && !this.async_deriveds.has(o) && (f(Re, this).delete(o), B(o, de), this.schedule(o));
486
486
  }
487
487
  }
488
488
  };
489
489
  for (const n of this.current.keys()) t(n);
490
- this.oncommit(() => e.discard()), A(B, e, Hn).call(e), C = this, A(B, this, Wn).call(this);
490
+ this.oncommit(() => e.discard()), A(D, e, Hn).call(e), C = this, A(D, this, Wn).call(this);
491
491
  }
492
492
  function Ut(e) {
493
493
  for (var t = 0; t < e.length; t += 1) $o(e[t], f(ft, this), f(Re, this));
@@ -513,7 +513,7 @@ function hl() {
513
513
  e && c.discard();
514
514
  else if (t.length > 0) {
515
515
  if (e) for (const u of f(_n, this)) c.unskip_effect(u, (h) => {
516
- (h.f & 4194320) !== 0 ? c.schedule(h) : A(B, c, Ut).call(c, [h]);
516
+ (h.f & 4194320) !== 0 ? c.schedule(h) : A(D, c, Ut).call(c, [h]);
517
517
  });
518
518
  c.activate();
519
519
  var i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
@@ -524,10 +524,10 @@ function hl() {
524
524
  return d ? d[0] !== h[0] || d[1] !== h[1] : !0;
525
525
  }).map(([u]) => u);
526
526
  if (a.length > 0)
527
- for (const u of f(wr, this)) (u.f & 155648) === 0 && Jr(u, a, o) && ((u.f & 4194320) !== 0 ? (z(u, de), c.schedule(u)) : f(ft, c).add(u));
527
+ for (const u of f(wr, this)) (u.f & 155648) === 0 && Jr(u, a, o) && ((u.f & 4194320) !== 0 ? (B(u, de), c.schedule(u)) : f(ft, c).add(u));
528
528
  if (f(se, c).length > 0 && !f(Vt, c)) {
529
529
  c.apply();
530
- for (var l of f(se, c)) A(B, c, Ho).call(c, l, [], []);
530
+ for (var l of f(se, c)) A(D, c, Ho).call(c, l, [], []);
531
531
  w(se, c, []);
532
532
  }
533
533
  c.deactivate();
@@ -595,7 +595,7 @@ function zo(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 ? zo(i, t, n, r) : (o & 4194320) !== 0 && (o & 2048) === 0 && Jr(i, t, r) && (z(i, de), Qr(i));
598
+ (o & 2) !== 0 ? zo(i, t, n, r) : (o & 4194320) !== 0 && (o & 2048) === 0 && Jr(i, t, r) && (B(i, de), Qr(i));
599
599
  }
600
600
  }
601
601
  function Jr(e, t, n) {
@@ -613,13 +613,13 @@ function Qr(e) {
613
613
  }
614
614
  function Bo(e, t) {
615
615
  if (!((e.f & 32) !== 0 && (e.f & 1024) !== 0)) {
616
- (e.f & 2048) !== 0 ? t.d.push(e) : (e.f & 4096) !== 0 && t.m.push(e), z(e, ce);
616
+ (e.f & 2048) !== 0 ? t.d.push(e) : (e.f & 4096) !== 0 && t.m.push(e), B(e, ce);
617
617
  for (var n = e.first; n !== null; )
618
618
  Bo(n, t), n = n.next;
619
619
  }
620
620
  }
621
621
  function Do(e) {
622
- z(e, ce);
622
+ B(e, ce);
623
623
  for (var t = e.first; t !== null; )
624
624
  Do(t), t = t.next;
625
625
  }
@@ -922,7 +922,7 @@ function ti(e) {
922
922
  function Vo(e) {
923
923
  var t = ti(e);
924
924
  if (!e.equals(t) && (e.wv = us(), (!C?.is_fork || e.deps === null) && (C !== null ? (C.capture(e, t, !0), _r?.capture(e, t, !0)) : e.v = t, e.deps === null))) {
925
- z(e, ce);
925
+ B(e, ce);
926
926
  return;
927
927
  }
928
928
  Le || (X !== null ? (ii() || C?.is_fork) && X.set(e, t) : Yr(e));
@@ -982,7 +982,7 @@ function It(e, t, n = null) {
982
982
  function El() {
983
983
  Go = !1;
984
984
  for (const e of Bn) {
985
- (e.f & 1024) !== 0 && z(e, bt);
985
+ (e.f & 1024) !== 0 && B(e, bt);
986
986
  let t;
987
987
  try {
988
988
  t = on(e);
@@ -1003,7 +1003,7 @@ function Yo(e, t, n) {
1003
1003
  var a = r[s], l = a.f;
1004
1004
  if (!(!i && a === x)) {
1005
1005
  var c = (l & de) === 0;
1006
- if (c && z(a, t), (l & 131072) !== 0) Bn.add(a);
1006
+ if (c && B(a, t), (l & 131072) !== 0) Bn.add(a);
1007
1007
  else if ((l & 2) !== 0) {
1008
1008
  var u = a;
1009
1009
  X?.delete(u), (l & 65536) === 0 && (l & 512 && (x === null || (x.f & 2097152) === 0) && (a.f |= nn), Yo(u, bt, n));
@@ -1261,7 +1261,7 @@ function ii() {
1261
1261
  }
1262
1262
  function Il(e) {
1263
1263
  const t = Ae(8, null);
1264
- return z(t, ce), t.teardown = e, t;
1264
+ return B(t, ce), t.teardown = e, t;
1265
1265
  }
1266
1266
  function Li(e) {
1267
1267
  Ml("$effect");
@@ -1342,7 +1342,7 @@ function Pl(e) {
1342
1342
  }
1343
1343
  function J(e, t = !0) {
1344
1344
  var n = !1;
1345
- (t || (e.f & 262144) !== 0) && e.nodes !== null && e.nodes.end !== null && (Nl(e.nodes.start, e.nodes.end), n = !0), z(e, xi), ai(e, t && !n), tn(e, 0);
1345
+ (t || (e.f & 262144) !== 0) && e.nodes !== null && e.nodes.end !== null && (Nl(e.nodes.start, e.nodes.end), n = !0), B(e, xi), ai(e, t && !n), tn(e, 0);
1346
1346
  var r = e.nodes && e.nodes.t;
1347
1347
  if (r !== null) for (const o of r) o.stop();
1348
1348
  is(e), e.f ^= xi, e.f |= La;
@@ -1391,7 +1391,7 @@ function Dn(e) {
1391
1391
  }
1392
1392
  function as(e, t) {
1393
1393
  if ((e.f & 8192) !== 0) {
1394
- e.f ^= Ur, (e.f & 1024) === 0 && (z(e, de), yt.ensure().schedule(e));
1394
+ e.f ^= Ur, (e.f & 1024) === 0 && (B(e, de), yt.ensure().schedule(e));
1395
1395
  for (var n = e.first; n !== null; ) {
1396
1396
  var r = n.next, i = (n.f & 65536) !== 0 || (n.f & 32) !== 0;
1397
1397
  as(n, i ? t : !1), n = r;
@@ -1443,7 +1443,7 @@ function on(e) {
1443
1443
  var o = n[i];
1444
1444
  if (on(o) && Vo(o), o.wv > e.wv) return !0;
1445
1445
  }
1446
- (t & 512) !== 0 && X === null && z(e, ce);
1446
+ (t & 512) !== 0 && X === null && B(e, ce);
1447
1447
  }
1448
1448
  return !1;
1449
1449
  }
@@ -1452,7 +1452,7 @@ function hs(e, t, n = !0) {
1452
1452
  if (r !== null && !(!$e && Te !== null && Te.has(e)))
1453
1453
  for (var i = 0; i < r.length; i++) {
1454
1454
  var o = r[i];
1455
- (o.f & 2) !== 0 ? hs(o, t, !1) : t === o && (n ? z(o, de) : (o.f & 1024) !== 0 && z(o, bt), Qr(o));
1455
+ (o.f & 2) !== 0 ? hs(o, t, !1) : t === o && (n ? B(o, de) : (o.f & 1024) !== 0 && B(o, bt), Qr(o));
1456
1456
  }
1457
1457
  }
1458
1458
  function ds(e) {
@@ -1510,7 +1510,7 @@ function tn(e, t) {
1510
1510
  function Rt(e) {
1511
1511
  var t = e.f;
1512
1512
  if ((t & 16384) === 0) {
1513
- z(e, ce);
1513
+ B(e, ce);
1514
1514
  var n = x, r = wn;
1515
1515
  if (x = e, wn = !0, 0)
1516
1516
  var i, o;
@@ -3912,7 +3912,7 @@ var Qc = {
3912
3912
  }
3913
3913
  };
3914
3914
  }
3915
- }, D = (e) => e.trim().replace(/\s+/g, " "), Os = () => /[\p{L}]+|\d+(?:\.\d+)?|[±√=+\-*/()²³^×÷≤≥≠≈<>|%°'′\u2062]/gu, Is = (e) => {
3915
+ }, z = (e) => e.trim().replace(/\s+/g, " "), Os = () => /[\p{L}]+|\d+(?:\.\d+)?|[±√=+\-*/()²³^×÷≤≥≠≈<>|%°'′\u2062]/gu, Is = (e) => {
3916
3916
  if (e.hidden || e.tagName?.toLowerCase() === "mjx-assistive-mml" || e.getAttribute("aria-hidden") === "true" || e.hasAttribute("inert")) return !0;
3917
3917
  const t = e.classList;
3918
3918
  if (t?.contains("sr-only") || t?.contains("pie-sr-only") || t?.contains("visually-hidden")) return !0;
@@ -4028,7 +4028,7 @@ var Qc = {
4028
4028
  }
4029
4029
  }, Ls = async (e, t = {}) => {
4030
4030
  if (!e.some((c) => c.type === "math")) return {
4031
- speechText: D(e.map((c) => c.type === "text" ? c.text : c.fallbackText).join(" ")),
4031
+ speechText: z(e.map((c) => c.type === "text" ? c.text : c.fallbackText).join(" ")),
4032
4032
  usedMathSpeech: !1,
4033
4033
  usedFallback: !1
4034
4034
  };
@@ -4041,7 +4041,7 @@ var Qc = {
4041
4041
  }
4042
4042
  try {
4043
4043
  n || (n = await o());
4044
- const u = D(await $s(n, c.mathml, t.language, "none", t.mathSpeech));
4044
+ const u = z(await $s(n, c.mathml, t.language, "none", t.mathSpeech));
4045
4045
  if (u) {
4046
4046
  s.push(u), r = !0;
4047
4047
  continue;
@@ -4051,7 +4051,7 @@ var Qc = {
4051
4051
  i = !0, console.debug("[TTSService] Math speech generation failed; using visible fallback", { message: u instanceof Error ? u.message : String(u) }), s.push(c.fallbackText);
4052
4052
  }
4053
4053
  }
4054
- const a = D(s.join(" "));
4054
+ const a = z(s.join(" "));
4055
4055
  let l;
4056
4056
  return t.produceSsml && n && r && e.length === 1 && e[0].type === "math" && (l = await ou(n, e[0].mathml, t.language, t.mathSpeech) ?? void 0), {
4057
4057
  speechText: a,
@@ -4982,7 +4982,7 @@ var Ru = /* @__PURE__ */ new Set([
4982
4982
  }
4983
4983
  const o = Lu(t);
4984
4984
  return {
4985
- spokenText: D(o.text),
4985
+ spokenText: z(o.text),
4986
4986
  rawToSpokenOffsetMap: o.rawToSpokenOffsetMap,
4987
4987
  unsupportedSemantic: n,
4988
4988
  hasMarkup: r
@@ -5143,7 +5143,7 @@ var Ru = /* @__PURE__ */ new Set([
5143
5143
  const r = e.length / Math.max(1, Math.min(t.length, n.length)), i = e.reduce((o, s) => o + s.score, 0) / e.length / 10;
5144
5144
  return Math.min(1, r * i);
5145
5145
  }, Fs = (e) => {
5146
- const t = Bs(e.speechText), n = D(e.visibleText), r = t.spokenText, i = Nr(r), o = Nr(n), s = t.unsupportedSemantic ? [] : Bu(i, o), a = Du(s, i, o), l = r === n && r.length > 0, c = s.length === 1 && s[0].score === 10 && i.length <= 2 && o.length <= 2, u = t.unsupportedSemantic ? "region-fallback" : l ? "exact-word" : (s.length >= 2 || c) && a >= 0.12 ? "anchor-span" : "region-fallback", h = t.unsupportedSemantic ? "unsupported" : t.hasMarkup ? "raw-ssml" : "plain-spoken-text";
5146
+ const t = Bs(e.speechText), n = z(e.visibleText), r = t.spokenText, i = Nr(r), o = Nr(n), s = t.unsupportedSemantic ? [] : Bu(i, o), a = Du(s, i, o), l = r === n && r.length > 0, c = s.length === 1 && s[0].score === 10 && i.length <= 2 && o.length <= 2, u = t.unsupportedSemantic ? "region-fallback" : l ? "exact-word" : (s.length >= 2 || c) && a >= 0.12 ? "anchor-span" : "region-fallback", h = t.unsupportedSemantic ? "unsupported" : t.hasMarkup ? "raw-ssml" : "plain-spoken-text";
5147
5147
  return {
5148
5148
  speechText: e.speechText,
5149
5149
  spokenText: r,
@@ -5896,7 +5896,7 @@ var Ru = /* @__PURE__ */ new Set([
5896
5896
  if (!Zs(o))
5897
5897
  for (const s of Array.from(o.childNodes)) r(s);
5898
5898
  };
5899
- return r(t.documentElement), D(n.join(" "));
5899
+ return r(t.documentElement), z(n.join(" "));
5900
5900
  }, Ph = (e, t, n) => {
5901
5901
  const r = Xs(n), i = (a) => {
5902
5902
  if (Pt(a, e)) return;
@@ -5910,7 +5910,7 @@ var Ru = /* @__PURE__ */ new Set([
5910
5910
  for (const c of Array.from(l.childNodes)) i(c);
5911
5911
  };
5912
5912
  i(e), na(r);
5913
- const o = D(r.chars.join(""));
5913
+ const o = z(r.chars.join(""));
5914
5914
  if (o) return {
5915
5915
  text: o,
5916
5916
  map: r.map
@@ -5927,7 +5927,7 @@ var Ru = /* @__PURE__ */ new Set([
5927
5927
  const n = Xs(t), r = [];
5928
5928
  let i = 0, o, s = !1;
5929
5929
  const a = () => {
5930
- const u = D(n.chars.slice(i, n.chars.length).join(""));
5930
+ const u = z(n.chars.slice(i, n.chars.length).join(""));
5931
5931
  u && r.push({
5932
5932
  type: "text",
5933
5933
  text: u,
@@ -5948,7 +5948,7 @@ var Ru = /* @__PURE__ */ new Set([
5948
5948
  a();
5949
5949
  const p = Ph(h, d, t);
5950
5950
  $h(n, p);
5951
- const v = D(p.text);
5951
+ const v = z(p.text);
5952
5952
  r.push({
5953
5953
  type: "math",
5954
5954
  mathml: d,
@@ -6006,7 +6006,7 @@ var Ru = /* @__PURE__ */ new Set([
6006
6006
  const t = e.resolveMathSpeech ?? Wh, { visibleText: n } = e, r = [];
6007
6007
  let i = 0;
6008
6008
  const o = (a) => {
6009
- const l = D(a), c = n.indexOf(l, i), u = c >= 0 ? c : i, h = u + l.length;
6009
+ const l = z(a), c = n.indexOf(l, i), u = c >= 0 ? c : i, h = u + l.length;
6010
6010
  return i = h, {
6011
6011
  start: u,
6012
6012
  end: h
@@ -6020,7 +6020,7 @@ var Ru = /* @__PURE__ */ new Set([
6020
6020
  offset: 0
6021
6021
  }] : di(l.text, { locale: e.language });
6022
6022
  for (const v of p) {
6023
- const b = D(v.text);
6023
+ const b = z(v.text);
6024
6024
  if (!b) continue;
6025
6025
  const g = o(b);
6026
6026
  r.push({
@@ -6057,7 +6057,7 @@ var Ru = /* @__PURE__ */ new Set([
6057
6057
  segments: r,
6058
6058
  locale: Hh(e.language),
6059
6059
  visibleText: n,
6060
- plainSpeechText: D(s.join(" "))
6060
+ plainSpeechText: z(s.join(" "))
6061
6061
  };
6062
6062
  }, jh = (e) => (e || "en").split("-")[0].toLowerCase() || "en", qh = "sre-v1", Vh = 256, Dr = (e) => Array.isArray(e) ? `array:[${e.map(Dr).join(",")}]` : e && typeof e == "object" ? `object:{${Object.entries(e).sort(([t], [n]) => t.localeCompare(n)).map(([t, n]) => `${JSON.stringify(t)}:${Dr(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)}`, go = (e, t, n, r) => `${qh}\0${jh(e)}\0${t ? "ssml" : "plain"}\0${Dr(n ?? null)}\0${r}`, Uh = (e = {}) => {
6063
6063
  const t = Math.max(1, e.maxEntries ?? Vh), n = e.resolve ?? ((o, s) => Ls([o], s)), r = /* @__PURE__ */ new Map(), i = (o, s) => {
@@ -6526,7 +6526,7 @@ var Ru = /* @__PURE__ */ new Set([
6526
6526
  })(L || (L = {}));
6527
6527
  var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOffset === t.startOffset && e.endContainer === t.endContainer && e.endOffset === t.endOffset, Td = (e, t) => e === t ? !0 : !e || !t || e.type !== t.type || e.quality !== t.quality ? !1 : e.type === "range" && t.type === "range" ? da(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, _d = class Vr {
6528
6528
  constructor() {
6529
- m(this, "currentProvider", null), m(this, "provider", null), m(this, "highlightCoordinator", null), m(this, "highlightTargetResolverProvider", null), m(this, "catalogResolver", null), m(this, "state", L.IDLE), m(this, "ttsConfig", {}), m(this, "currentText", null), m(this, "currentContentElement", null), m(this, "normalizedToDOM", /* @__PURE__ */ new Map()), m(this, "listeners", /* @__PURE__ */ new Map()), m(this, "lastError", null), m(this, "speakRunId", 0), m(this, "currentBoundaryOffset", 0), m(this, "activeWordBoundaryOffset", 0), m(this, "seekSegments", []), m(this, "sentenceHighlightSegments", []), m(this, "currentSeekSegmentIndex", 0), m(this, "activeSentenceStartOffset", null), m(this, "activeHighlightMode", "word"), m(this, "lastRenderedRegionTarget", null), m(this, "telemetryReporter", null), m(this, "generatedMathSpeechResolver", Uh());
6529
+ m(this, "currentProvider", null), m(this, "provider", null), m(this, "highlightCoordinator", null), m(this, "highlightTargetResolverProvider", null), m(this, "catalogResolver", null), m(this, "state", L.IDLE), m(this, "ttsConfig", {}), m(this, "currentText", null), m(this, "currentContentElement", null), m(this, "normalizedToDOM", /* @__PURE__ */ new Map()), m(this, "listeners", /* @__PURE__ */ new Map()), m(this, "lastError", null), m(this, "speakRunId", 0), m(this, "currentBoundaryOffset", 0), m(this, "activeWordBoundaryOffset", 0), m(this, "seekSegments", []), m(this, "playbackChunks", []), m(this, "sentenceHighlightSegments", []), m(this, "currentSeekSegmentIndex", 0), m(this, "activeSentenceStartOffset", null), m(this, "activeHighlightMode", "word"), m(this, "lastRenderedRegionTarget", null), m(this, "telemetryReporter", null), m(this, "generatedMathSpeechResolver", Uh());
6530
6530
  }
6531
6531
  debugLog(t, n) {
6532
6532
  Vr.debugEnabled && (n === void 0 ? console.debug(t) : console.debug(t, n));
@@ -6901,6 +6901,17 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
6901
6901
  const r = t.playbackSegments.map((i) => i.startOffset).filter((i) => i > 0);
6902
6902
  return this.splitSegmentsAtBoundaries(n, r, t.contentToSpeak);
6903
6903
  }
6904
+ createSeekSegmentsFromSpeechChunks(t) {
6905
+ let n = 0;
6906
+ return t.map((r) => {
6907
+ const i = z(r.plainFallback?.speechText || (this.hasExplicitBreakSemantics(r.speechText) ? r.visibleText : r.speechText) || r.visibleText) || r.visibleText || "", o = {
6908
+ text: i,
6909
+ startOffset: n,
6910
+ pauseMsAfter: 0
6911
+ };
6912
+ return n += Math.max(1, i.length + 1), o;
6913
+ });
6914
+ }
6904
6915
  getCurrentSeekSegmentIndex() {
6905
6916
  if (this.seekSegments.length === 0) return 0;
6906
6917
  let t = 0;
@@ -7000,7 +7011,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7000
7011
  const p = n?.highlightModeOverride || (h ? this.resolveHighlightMode() : "sentence");
7001
7012
  this.activeHighlightMode = p, this.activeWordBoundaryOffset = n?.wordBoundaryOffset || 0;
7002
7013
  const v = this.hasExplicitBreakSemantics(o), b = !!this.currentContentElement && !c && !v && h;
7003
- if (this.seekSegments = v || !h ? [] : b && this.currentContentElement ? this.createSpeechPlan(this.currentContentElement, l) : this.createSeekSegmentsFromText(a), this.sentenceHighlightSegments = v ? [] : this.createSentenceHighlightSegments({
7014
+ if (this.playbackChunks = d?.length ? d : [], this.seekSegments = this.playbackChunks.length ? this.createSeekSegmentsFromSpeechChunks(this.playbackChunks) : v || !h ? [] : b && this.currentContentElement ? this.createSpeechPlan(this.currentContentElement, l) : this.createSeekSegmentsFromText(a), this.sentenceHighlightSegments = v ? [] : this.createSentenceHighlightSegments({
7004
7015
  contentToSpeak: a,
7005
7016
  shouldUsePlan: b,
7006
7017
  playbackSegments: this.seekSegments
@@ -7079,7 +7090,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7079
7090
  }, "updateSettings" in this.provider && typeof this.provider.updateSettings == "function" && await this.provider.updateSettings({ providerOptions: o });
7080
7091
  }
7081
7092
  async resolveSpeechContent(t, n) {
7082
- const r = D(t);
7093
+ const r = z(t);
7083
7094
  if (n?.ignoreCatalogs) return {
7084
7095
  contentToSpeak: r,
7085
7096
  speechText: r,
@@ -7099,7 +7110,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7099
7110
  context: n.catalogContext
7100
7111
  });
7101
7112
  if (o) {
7102
- const s = n?.contentElement && Kt(n.contentElement, this.getTextProcessingOptions(n.language)).visibleText || r, a = D(o.content);
7113
+ const s = n?.contentElement && Kt(n.contentElement, this.getTextProcessingOptions(n.language)).visibleText || r, a = z(o.content);
7103
7114
  return this.debugLog(`[TTSService] Using catalog content for "${n.catalogId}" (${o.language})`), {
7104
7115
  contentToSpeak: o.content,
7105
7116
  speechText: o.content,
@@ -7133,7 +7144,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7133
7144
  if (!this.catalogResolver) return null;
7134
7145
  const i = this.collectCatalogSpeechChunks(t, r);
7135
7146
  if (!i.some((a) => a.sourceElement)) return null;
7136
- const o = D(i.map((a) => a.speechText).join(" ")), s = Kt(t, this.getTextProcessingOptions(r.language)).visibleText || n;
7147
+ const o = z(i.map((a) => a.speechText).join(" ")), s = Kt(t, this.getTextProcessingOptions(r.language)).visibleText || n;
7137
7148
  return {
7138
7149
  contentToSpeak: o,
7139
7150
  speechText: o,
@@ -7151,7 +7162,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7151
7162
  const r = [];
7152
7163
  let i = "";
7153
7164
  const o = () => {
7154
- const u = D(i);
7165
+ const u = z(i);
7155
7166
  i = "", u && r.push({
7156
7167
  speechText: u,
7157
7168
  visibleText: u,
@@ -7169,7 +7180,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7169
7180
  }, a = (u, h) => {
7170
7181
  const d = l(u);
7171
7182
  if (d.length !== 1) return null;
7172
- const p = d[0], v = Kt(p, this.getTextProcessingOptions(n.language)).visibleText || D(p.textContent || ""), b = (g) => D(g).replace(/\s+/g, "");
7183
+ const p = d[0], v = Kt(p, this.getTextProcessingOptions(n.language)).visibleText || z(p.textContent || ""), b = (g) => z(g).replace(/\s+/g, "");
7173
7184
  return b(v) === b(h) ? p : null;
7174
7185
  }, l = (u) => {
7175
7186
  const h = Array.from(u.querySelectorAll("math"));
@@ -7184,7 +7195,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7184
7195
  const h = u, d = s(h);
7185
7196
  if (d) {
7186
7197
  o();
7187
- const p = Kt(h, this.getTextProcessingOptions(n.language)), v = p.visibleText || D(h.textContent || ""), b = Fs({
7198
+ const p = Kt(h, this.getTextProcessingOptions(n.language)), v = p.visibleText || z(h.textContent || ""), b = Fs({
7188
7199
  speechText: d.content,
7189
7200
  visibleText: v
7190
7201
  }), g = a(h, v), y = g ? Vn({
@@ -7196,7 +7207,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7196
7207
  mathElement: S,
7197
7208
  speechText: d.content
7198
7209
  })
7199
- })), N = D(d.content);
7210
+ })), N = z(d.content);
7200
7211
  r.push({
7201
7212
  speechText: d.content,
7202
7213
  visibleText: v,
@@ -7259,7 +7270,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7259
7270
  });
7260
7271
  }
7261
7272
  initializeSpeakTracking(t, n) {
7262
- this.currentText = t, this.currentContentElement = n?.contentElement || null, this.lastError = null, this.currentBoundaryOffset = 0, this.currentSeekSegmentIndex = 0, this.activeSentenceStartOffset = null;
7273
+ this.currentText = t, this.currentContentElement = n?.contentElement || null, this.lastError = null, this.currentBoundaryOffset = 0, this.playbackChunks = [], this.currentSeekSegmentIndex = 0, this.activeSentenceStartOffset = null;
7263
7274
  }
7264
7275
  prepareHighlightsForSpeak(t) {
7265
7276
  if (!this.currentContentElement || !this.highlightCoordinator || (this.buildPositionMap(this.currentContentElement, t.contentToSpeak, t.options?.language), t.highlightMode === "sentence" && t.shouldUsePlan)) return;
@@ -7404,9 +7415,13 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7404
7415
  }
7405
7416
  async executeSpeakPlayback(t) {
7406
7417
  if (t.speechChunks?.length && this.provider) {
7407
- for (const n of t.speechChunks) {
7418
+ for (let n = 0; n < t.speechChunks.length; n++) {
7408
7419
  if (t.runId !== this.speakRunId) return;
7409
- await this.speakCatalogChunk(n, t.runId);
7420
+ this.currentSeekSegmentIndex = n;
7421
+ const r = this.seekSegments[n];
7422
+ r && (this.currentBoundaryOffset = r.startOffset);
7423
+ const i = t.speechChunks[n];
7424
+ await this.speakCatalogChunk(i, t.runId);
7410
7425
  }
7411
7426
  return;
7412
7427
  }
@@ -7418,7 +7433,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7418
7433
  this.provider && await this.provider.speak(t.contentToSpeak);
7419
7434
  }
7420
7435
  clearHighlightsAndTracking() {
7421
- this.highlightCoordinator && this.highlightCoordinator.clearTTS(), this.lastRenderedRegionTarget = null, this.currentContentElement = null, this.normalizedToDOM.clear(), this.currentBoundaryOffset = 0, this.activeWordBoundaryOffset = 0, this.seekSegments = [], this.sentenceHighlightSegments = [], this.currentSeekSegmentIndex = 0, this.activeSentenceStartOffset = null;
7436
+ 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;
7422
7437
  }
7423
7438
  async speakRange(t, n) {
7424
7439
  if (!this.provider) throw new Error("TTS service not initialized");
@@ -7432,7 +7447,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7432
7447
  if (!i) return;
7433
7448
  const o = document.createRange();
7434
7449
  o.selectNodeContents(i), o.setEnd(t.startContainer, t.startOffset);
7435
- const s = o.toString(), a = D(s), l = a.length + (/\s$/.test(s) && a ? 1 : 0);
7450
+ const s = o.toString(), a = z(s), l = a.length + (/\s$/.test(s) && a ? 1 : 0);
7436
7451
  this.debugLog("[TTSService] speakRange offset calculation:", {
7437
7452
  selectedText: r,
7438
7453
  textBeforeRange: s.substring(0, 100),
@@ -7455,19 +7470,27 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7455
7470
  }
7456
7471
  async restartFromSeekIndex(t) {
7457
7472
  if (!this.provider || this.seekSegments.length === 0) return;
7458
- const n = Math.max(0, Math.min(this.seekSegments.length - 1, t));
7473
+ const n = Math.max(0, Math.min(this.seekSegments.length - 1, t)), r = this.playbackChunks.length ? this.playbackChunks.slice(n) : null;
7459
7474
  this.speakRunId += 1, this.provider.onWordBoundary = void 0, this.provider.stop(), this.currentSeekSegmentIndex = n;
7460
- const r = ++this.speakRunId, i = this.seekSegments.slice(n);
7475
+ const i = ++this.speakRunId, o = this.seekSegments.slice(n);
7461
7476
  this.setState(L.PLAYING);
7462
7477
  try {
7463
7478
  if (this.configureWordBoundaryHighlighting({
7464
7479
  highlightMode: this.activeHighlightMode,
7465
7480
  wordBoundaryOffset: this.activeWordBoundaryOffset
7466
- }), await this.speakWithPlan(i, r, { highlightMode: this.activeHighlightMode }), r !== this.speakRunId) return;
7481
+ }), r) for (let s = 0; s < r.length; s++) {
7482
+ if (i !== this.speakRunId) return;
7483
+ const a = n + s;
7484
+ this.currentSeekSegmentIndex = a;
7485
+ const l = this.seekSegments[a];
7486
+ l && (this.currentBoundaryOffset = l.startOffset), await this.speakCatalogChunk(r[s], i);
7487
+ }
7488
+ else await this.speakWithPlan(o, i, { highlightMode: this.activeHighlightMode });
7489
+ if (i !== this.speakRunId) return;
7467
7490
  this.setState(L.IDLE), this.clearHighlightsAndTracking(), this.highlightTargetResolverProvider = null;
7468
- } catch (o) {
7469
- if (r !== this.speakRunId) return;
7470
- throw this.lastError = o instanceof Error ? o.message : String(o), this.setState(L.ERROR), this.clearHighlightsAndTracking(), this.highlightTargetResolverProvider = null, o;
7491
+ } catch (s) {
7492
+ if (i !== this.speakRunId) return;
7493
+ throw this.lastError = s instanceof Error ? s.message : String(s), this.setState(L.ERROR), this.clearHighlightsAndTracking(), this.highlightTargetResolverProvider = null, s;
7471
7494
  }
7472
7495
  }
7473
7496
  async setPlaybackRate(t) {
@@ -7490,7 +7513,7 @@ var da = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
7490
7513
  await this.seekBy(-n);
7491
7514
  }
7492
7515
  stop() {
7493
- this.provider && (this.speakRunId += 1, this.provider.onWordBoundary = void 0, this.provider.stop(), this.highlightTargetResolverProvider = null, this.setState(L.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.sentenceHighlightSegments = [], this.currentSeekSegmentIndex = 0, this.activeSentenceStartOffset = null);
7516
+ this.provider && (this.speakRunId += 1, this.provider.onWordBoundary = void 0, this.provider.stop(), this.highlightTargetResolverProvider = null, this.setState(L.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);
7494
7517
  }
7495
7518
  requestControlHandoff() {
7496
7519
  typeof window > "u" || window.dispatchEvent(new CustomEvent(yd, { detail: { source: "host" } }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-players/pie-tool-annotation-toolbar",
3
- "version": "0.3.52",
3
+ "version": "0.3.53",
4
4
  "type": "module",
5
5
  "description": "Text annotation toolbar with highlighting and underlining for PIE assessment player",
6
6
  "repository": {
@@ -36,8 +36,8 @@
36
36
  "unpkg": "./dist/tool-annotation-toolbar.js",
37
37
  "jsdelivr": "./dist/tool-annotation-toolbar.js",
38
38
  "dependencies": {
39
- "@pie-players/pie-assessment-toolkit": "0.3.52",
40
- "@pie-players/pie-players-shared": "0.3.52"
39
+ "@pie-players/pie-assessment-toolkit": "0.3.53",
40
+ "@pie-players/pie-players-shared": "0.3.53"
41
41
  },
42
42
  "types": "./dist/index.d.ts",
43
43
  "scripts": {