markdown-flow-ui 0.2.26-dev.8 → 0.2.26

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.
@@ -1,5 +1,5 @@
1
1
  import { jsxs as H, jsx as s, Fragment as jt } from "react/jsx-runtime";
2
- import wr, { memo as Tr, useId as vr, useContext as kr, useRef as a, useState as Ye, useMemo as ce, useCallback as u, useEffect as m } from "react";
2
+ import wr, { memo as Tr, useId as vr, useContext as kr, useRef as a, useState as Pe, useMemo as ce, useCallback as u, useEffect as m } from "react";
3
3
  import { getMarkdownFlowDirection as Lr, getMarkdownFlowLanguage as Cr } from "../../lib/locale.es.js";
4
4
  import { useDetachedLanguage as Ar } from "../../lib/useDetachedLanguage.es.js";
5
5
  import { useResolvedDirection as xr } from "../../lib/useResolvedDirection.es.js";
@@ -15,28 +15,28 @@ import { shouldKeepPlayingAfterNavigation as Hr } from "./utils/playbackPreferen
15
15
  import { toPlayerCustomActionList as Dr } from "./utils/playerCustomActions.es.js";
16
16
  import { suppressPlayerControlsWakeAfterNavigation as Qe } from "./utils/playerNavigationContext.es.js";
17
17
  import { isPlaybackTimeCoveredBySegments as Xe, resolveSegmentSeekTarget as zt } from "./utils/segmentSeek.es.js";
18
- import { getSortedAudioSegments as Gt } from "./utils/audioSegments.es.js";
19
- import { getSubtitleCueJumpTarget as Jr, shouldClearSubtitleCueJumpTarget as Pr } from "./utils/subtitleCue.es.js";
18
+ import { getSortedAudioSegments as Yt } from "./utils/audioSegments.es.js";
19
+ import { getSubtitleCueJumpTarget as Jr, shouldClearSubtitleCueJumpTarget as Zr } from "./utils/subtitleCue.es.js";
20
20
  /* empty css */
21
- import Zr from "../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js";
21
+ import Gr from "../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js";
22
22
  import jr from "../../node_modules/lucide-react/dist/esm/icons/volume-2.es.js";
23
23
  import zr from "../../node_modules/lucide-react/dist/esm/icons/skip-back.es.js";
24
- import Gr from "../../node_modules/lucide-react/dist/esm/icons/skip-forward.es.js";
25
- import Yr from "../../node_modules/lucide-react/dist/esm/icons/rewind.es.js";
24
+ import Yr from "../../node_modules/lucide-react/dist/esm/icons/skip-forward.es.js";
25
+ import Pr from "../../node_modules/lucide-react/dist/esm/icons/rewind.es.js";
26
26
  import Qr from "../../node_modules/lucide-react/dist/esm/icons/fast-forward.es.js";
27
27
  import Xr from "../../node_modules/lucide-react/dist/esm/icons/captions.es.js";
28
28
  import qr from "../../node_modules/lucide-react/dist/esm/icons/captions-off.es.js";
29
29
  import en from "../../node_modules/lucide-react/dist/esm/icons/scan-line.es.js";
30
30
  import tn from "../../node_modules/lucide-react/dist/esm/icons/maximize.es.js";
31
31
  import rn from "../../node_modules/lucide-react/dist/esm/icons/loader-circle.es.js";
32
- const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
33
- if (typeof window > "u" || !d || Yt.has(d))
32
+ const Pt = /* @__PURE__ */ new Map(), Qt = (d) => {
33
+ if (typeof window > "u" || !d || Pt.has(d))
34
34
  return;
35
35
  const p = window.document.createElement("audio");
36
- p.preload = "auto", p.setAttribute("playsinline", "true"), p.src = d, p.load(), Yt.set(d, p);
37
- }, nn = (d, p) => p !== null && p.audioList === d && p.subtitleCueLists.length === d.length && d.every((i, w) => {
38
- const T = i.element?.subtitle_cues;
39
- return p.subtitleCueLists[w] === T && p.subtitleCueLengths[w] === (T?.length ?? 0);
36
+ p.preload = "auto", p.setAttribute("playsinline", "true"), p.src = d, p.load(), Pt.set(d, p);
37
+ }, nn = (d, p) => p !== null && p.audioList === d && p.subtitleCueLists.length === d.length && d.every((i, T) => {
38
+ const v = i.element?.subtitle_cues;
39
+ return p.subtitleCueLists[T] === v && p.subtitleCueLengths[T] === (v?.length ?? 0);
40
40
  }), un = (d) => {
41
41
  const p = d.map(
42
42
  (i) => i.element?.subtitle_cues
@@ -100,16 +100,16 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
100
100
  audioList: d = [],
101
101
  className: p,
102
102
  currentAudioIndex: i = -1,
103
- defaultPlaying: w = !0,
104
- isPlaybackPaused: T = !1,
105
- isAutoAdvanceEnabled: G = !0,
103
+ defaultPlaying: T = !0,
104
+ isPlaybackPaused: v = !1,
105
+ isAutoAdvanceEnabled: Y = !0,
106
106
  useAutoAdvanceToggle: R = !1,
107
107
  onLoadingChange: qe,
108
108
  onPlaybackPreferenceChange: et,
109
109
  onPlaybackStarted: tt,
110
110
  onPlaybackTimeChange: be,
111
111
  onPlaybackCheckpoint: ne,
112
- playbackRestoreRequest: _ = null,
112
+ playbackRestoreRequest: M = null,
113
113
  onPlaybackRestoreComplete: oe,
114
114
  onSubtitleToggle: fe,
115
115
  onPrev: _e,
@@ -132,7 +132,7 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
132
132
  showControls: Ie = !0,
133
133
  onControlsPointerEnter: er,
134
134
  onControlsPointerLeave: tr,
135
- slideProgress: v = null,
135
+ slideProgress: g = null,
136
136
  enableKeyboardShortcuts: rr = !0,
137
137
  subtitleSeekRequest: D = null,
138
138
  customActions: at,
@@ -143,14 +143,14 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
143
143
  onPointerDown: ot,
144
144
  ...Ve
145
145
  }) => {
146
- const $e = Ve.dir ?? Lr(ve), ft = Ve.lang ?? Cr(ve), nr = vr(), dt = kr(Wr), g = a(null), mt = a(null), pt = a(null), { resolvedDirection: ht, readDirection: gt } = xr(g, $e), ke = ht === "rtl", ur = Ar(g, ft), St = a(Te), O = a(null), Le = a(null), F = a(0), h = a(null), me = a(void 0), k = a([]), pe = a(
147
- R ? G : w
148
- ), he = a(!1), yt = a(!1), L = a(!1), B = a(null), Y = a(null), E = a(!1), c = a(!1), N = a(null), U = a(!1), Q = a(null), Ce = a(0), bt = a(() => {
149
- }), Ae = a(null), ge = a(null), _t = a(null), X = a(null), Mt = a(0), He = a(!1), De = a(!1), wt = a(ne), Tt = a(() => 0), vt = a(null), I = a("unknown"), [xe, S] = Ye(w), [kt, ue] = Ye(!1), [le, lr] = Ye({
146
+ const $e = Ve.dir ?? Lr(ve), ft = Ve.lang ?? Cr(ve), nr = vr(), dt = kr(Wr), S = a(null), mt = a(null), pt = a(null), { resolvedDirection: ht, readDirection: gt } = xr(S, $e), ke = ht === "rtl", ur = Ar(S, ft), St = a(Te), O = a(null), Le = a(null), F = a(0), h = a(null), me = a(void 0), k = a([]), pe = a(
147
+ R ? Y : T
148
+ ), he = a(!1), yt = a(!1), L = a(!1), B = a(null), P = a(null), E = a(!1), c = a(!1), N = a(null), U = a(!1), Q = a(null), Ce = a(0), bt = a(() => {
149
+ }), Ae = a(null), ge = a(null), _t = a(null), X = a(null), Mt = a(0), He = a(!1), De = a(!1), wt = a(ne), Tt = a(() => 0), vt = a(null), I = a("unknown"), [xe, y] = Pe(T), [kt, ue] = Pe(!1), [le, lr] = Pe({
150
150
  next: !1,
151
151
  previous: !1
152
152
  }), q = dt?.ownerId ?? nr, V = rr && (dt?.enabled ?? !0), f = i >= 0 ? d[i] : void 0, A = f?.audioUrl, Lt = f?.audioSegments, ar = Lt?.length ?? 0, W = ce(
153
- () => Gt(f),
153
+ () => Yt(f),
154
154
  [f, ar, Lt]
155
155
  );
156
156
  let Ne = vt.current;
@@ -169,7 +169,7 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
169
169
  ...st
170
170
  }),
171
171
  [ve, st]
172
- ), Pe = ce(() => f ? f.audioKey ?? `${String(f.sequenceNumber ?? "none")}:${String(f.audioUrl ?? "")}` : "none", [f]), sr = R ? G : xe, xt = R ? G ? o.pauseAutoplayLabel : o.playAutoplayLabel : xe ? o.pauseLabel : o.playLabel, Nt = rt ? o.exitFullscreenLabel : o.enterFullscreenLabel, ee = u(
172
+ ), Ze = ce(() => f ? f.audioKey ?? `${String(f.sequenceNumber ?? "none")}:${String(f.audioUrl ?? "")}` : "none", [f]), sr = R ? Y : xe, xt = R ? Y ? o.pauseAutoplayLabel : o.playAutoplayLabel : xe ? o.pauseLabel : o.playLabel, Nt = rt ? o.exitFullscreenLabel : o.enterFullscreenLabel, ee = u(
173
173
  (e, t, r) => ({
174
174
  ariaKeyShortcuts: V ? r : void 0,
175
175
  title: V ? on(e, t) : e
@@ -219,8 +219,8 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
219
219
  m(() => {
220
220
  me.current = f;
221
221
  }, [f]), m(() => {
222
- pe.current = R ? G : w;
223
- }, [w, G, R]), m(() => {
222
+ pe.current = R ? Y : T;
223
+ }, [T, Y, R]), m(() => {
224
224
  Ie || ue(!1);
225
225
  }, [Ie]), m(() => {
226
226
  !St.current && Te && ue(!1), St.current = Te;
@@ -257,8 +257,8 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
257
257
  behavior: "smooth",
258
258
  left: t.offsetLeft - e.clientWidth / 2 + t.clientWidth / 2
259
259
  });
260
- }, [v?.currentIndex]);
261
- const Ot = u((e) => e instanceof DOMException ? e.name === "NotAllowedError" || e.name === "SecurityError" : !1, []), P = u(() => w && !T && !L.current && I.current !== "blocked", [w, T]), It = u((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), Vt = u(() => {
260
+ }, [g?.currentIndex]);
261
+ const Ot = u((e) => e instanceof DOMException ? e.name === "NotAllowedError" || e.name === "SecurityError" : !1, []), Z = u(() => T && !v && !L.current && I.current !== "blocked", [T, v]), It = u((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), Vt = u(() => {
262
262
  const e = h.current;
263
263
  return e == null || e <= 0 ? 0 : k.current.slice(0, e).reduce(
264
264
  (t, r) => t + Math.max(Number(r.duration_ms ?? 0), 0),
@@ -268,11 +268,11 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
268
268
  (t, r) => t + Math.max(Number(r.duration_ms ?? 0), 0),
269
269
  0
270
270
  ), []), Ke = u(
271
- (e, t) => !e || T ? !1 : e.audioUrl ? !0 : Xe(
272
- Gt(e),
271
+ (e, t) => !e || v ? !1 : e.audioUrl ? !0 : Xe(
272
+ Yt(e),
273
273
  t
274
274
  ),
275
- [T]
275
+ [v]
276
276
  ), Se = u(
277
277
  (e, t, r = {}) => {
278
278
  const n = Jr({
@@ -295,7 +295,7 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
295
295
  we,
296
296
  Ct
297
297
  ]
298
- ), Ze = u(
298
+ ), Ge = u(
299
299
  (e, t = !1) => {
300
300
  const r = Math.max(Number(e), 0);
301
301
  if (!t && Ae.current !== null && Math.abs(
@@ -307,35 +307,35 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
307
307
  previous: Se("previous", r) !== null,
308
308
  next: Se("next", r) !== null
309
309
  };
310
- lr((b) => b.previous === n.previous && b.next === n.next ? b : n);
310
+ lr((_) => _.previous === n.previous && _.next === n.next ? _ : n);
311
311
  },
312
312
  [Se]
313
313
  );
314
314
  m(() => {
315
- bt.current = Ze, Ze(Ce.current, !0);
316
- }, [Ze]);
317
- const Z = u(() => {
318
- const e = g.current;
315
+ bt.current = Ge, Ge(Ce.current, !0);
316
+ }, [Ge]);
317
+ const G = u(() => {
318
+ const e = S.current;
319
319
  return e ? B.current === "segment" ? te(F.current) + Math.max(e.currentTime, 0) * 1e3 : N.current !== null && e.readyState === 0 ? N.current * 1e3 : Math.max(e.currentTime, 0) * 1e3 : h.current != null ? te(h.current) : 0;
320
320
  }, [te]);
321
321
  m(() => {
322
322
  wt.current = ne;
323
323
  }, [ne]), m(() => {
324
- Tt.current = Z;
325
- }, [Z]);
324
+ Tt.current = G;
325
+ }, [G]);
326
326
  const K = u(
327
327
  (e) => {
328
328
  const t = Math.max(e, 0);
329
- Ce.current !== t && (Ce.current = t, Pr({
329
+ Ce.current !== t && (Ce.current = t, Zr({
330
330
  currentAudioIndex: i,
331
331
  currentTimeMs: t,
332
332
  target: ge.current
333
333
  }) && (ge.current = null), be?.(t), bt.current(t));
334
334
  },
335
335
  [i, be]
336
- ), y = u(() => {
337
- K(Z());
338
- }, [Z, K]), j = u(
336
+ ), b = u(() => {
337
+ K(G());
338
+ }, [G, K]), j = u(
339
339
  (e = !1, t = !1) => {
340
340
  const r = Le.current;
341
341
  if (!ne || !r)
@@ -344,10 +344,10 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
344
344
  !e && n - Mt.current < 5e3 || (Mt.current = n, He.current = t, ne({
345
345
  audioKey: r,
346
346
  isComplete: t,
347
- timeMs: Z()
347
+ timeMs: G()
348
348
  }));
349
349
  },
350
- [Z, ne]
350
+ [G, ne]
351
351
  );
352
352
  m(
353
353
  () => () => {
@@ -361,14 +361,14 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
361
361
  ), m(() => {
362
362
  He.current = !1;
363
363
  }, [i]);
364
- const M = u(() => {
364
+ const w = u(() => {
365
365
  typeof window > "u" || Q.current === null || (window.cancelAnimationFrame(Q.current), Q.current = null);
366
366
  }, []), $t = u(() => {
367
367
  if (typeof window > "u" || Q.current !== null)
368
368
  return;
369
369
  const e = () => {
370
- y();
371
- const t = g.current;
370
+ b();
371
+ const t = S.current;
372
372
  if (!t || t.paused || t.ended) {
373
373
  Q.current = null;
374
374
  return;
@@ -376,41 +376,41 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
376
376
  Q.current = window.requestAnimationFrame(e);
377
377
  };
378
378
  Q.current = window.requestAnimationFrame(e);
379
- }, [y]), ae = u(() => {
380
- const e = g.current;
381
- e && (M(), c.current = !1, L.current = !1, he.current = !1, B.current = null, N.current = null, E.current = !1, U.current = !1, Y.current = null, e.pause(), e.removeAttribute("src"), e.load(), O.current = null, F.current = 0, h.current = null, K(0), S(!1), l(!1));
382
- }, [K, M, l]), C = u(
379
+ }, [b]), ae = u(() => {
380
+ const e = S.current;
381
+ e && (w(), c.current = !1, L.current = !1, he.current = !1, B.current = null, N.current = null, E.current = !1, U.current = !1, P.current = null, e.pause(), e.removeAttribute("src"), e.load(), O.current = null, F.current = 0, h.current = null, K(0), y(!1), l(!1));
382
+ }, [K, w, l]), C = u(
383
383
  (e) => {
384
- const t = g.current;
384
+ const t = S.current;
385
385
  if (!t)
386
386
  return !1;
387
387
  const r = t.play();
388
388
  return r && typeof r.then == "function" && r.then(() => {
389
389
  I.current === "unknown" && (I.current = "auto"), c.current = !1, U.current = !1;
390
390
  }).catch((n) => {
391
- I.current === "unknown" && Ot(n) && (I.current = "blocked", c.current = !1, l(!1)), U.current = !1, S(!1);
391
+ I.current === "unknown" && Ot(n) && (I.current = "blocked", c.current = !1, l(!1)), U.current = !1, y(!1);
392
392
  }), !0;
393
393
  },
394
394
  [Ot, l]
395
395
  ), x = u(
396
396
  (e, t, r = {}) => {
397
- const n = g.current, b = k.current[e];
398
- if (!n || !b)
397
+ const n = S.current, _ = k.current[e];
398
+ if (!n || !_)
399
399
  return !1;
400
- const re = It(b.audio_data), Ge = Math.max(
400
+ const re = It(_.audio_data), Ye = Math.max(
401
401
  Number(r.seekTimeSeconds ?? 0),
402
402
  0
403
403
  );
404
- F.current = e, h.current = null, E.current = !1, U.current = !0, Y.current = "segment", K(
405
- te(e) + Ge * 1e3
404
+ F.current = e, h.current = null, E.current = !1, U.current = !0, P.current = "segment", K(
405
+ te(e) + Ye * 1e3
406
406
  );
407
- const Zt = r.shouldResume ?? P();
408
- c.current = Zt, l(!1);
407
+ const Gt = r.shouldResume ?? Z();
408
+ c.current = Gt, l(!1);
409
409
  const Mr = O.current !== re;
410
- return B.current = "segment", Mr && (n.pause(), n.removeAttribute("src"), n.load(), O.current = re, n.src = re, n.load()), N.current = Ge, n.readyState > 0 && (n.currentTime = Ge, N.current = null), Zt ? C(`start-segment:${t}`) : (c.current = !1, U.current = !1, n.pause(), S(!1), !0);
410
+ return B.current = "segment", Mr && (n.pause(), n.removeAttribute("src"), n.load(), O.current = re, n.src = re, n.load()), N.current = Ye, n.readyState > 0 && (n.currentTime = Ye, N.current = null), Gt ? C(`start-segment:${t}`) : (c.current = !1, U.current = !1, n.pause(), y(!1), !0);
411
411
  },
412
412
  [
413
- P,
413
+ Z,
414
414
  It,
415
415
  te,
416
416
  K,
@@ -419,48 +419,48 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
419
419
  ]
420
420
  ), ie = u(
421
421
  (e, t) => {
422
- const r = g.current;
422
+ const r = S.current;
423
423
  if (!r)
424
424
  return !1;
425
425
  const n = Math.max(Number(t), 0) / 1e3;
426
- return O.current !== e && (r.pause(), r.removeAttribute("src"), r.load(), O.current = e, B.current = "url", Y.current = "url", r.src = e, r.load()), N.current = n, K(n * 1e3), r.readyState > 0 && (r.currentTime = n, N.current = null), !0;
426
+ return O.current !== e && (r.pause(), r.removeAttribute("src"), r.load(), O.current = e, B.current = "url", P.current = "url", r.src = e, r.load()), N.current = n, K(n * 1e3), r.readyState > 0 && (r.currentTime = n, N.current = null), !0;
427
427
  },
428
428
  [K]
429
429
  ), Fe = u(
430
430
  (e) => {
431
- const t = g.current;
432
- if (!t || !f || T)
431
+ const t = S.current;
432
+ if (!t || !f || v)
433
433
  return !1;
434
- const r = Math.max(Number(e), 0), n = !t.paused && !t.ended || c.current || U.current || h.current !== null && pe.current && !L.current, b = Xe(
434
+ const r = Math.max(Number(e), 0), n = !t.paused && !t.ended || c.current || U.current || h.current !== null && pe.current && !L.current, _ = Xe(
435
435
  k.current,
436
436
  r
437
437
  ) ? zt(
438
438
  k.current,
439
439
  r
440
440
  ) : null;
441
- return Ae.current = null, M(), c.current = n, l(!1), n && (I.current = "manual", L.current = !1, $(!0)), b && (B.current === "segment" || !A) ? x(
442
- b.segmentIndex,
441
+ return Ae.current = null, w(), c.current = n, l(!1), n && (I.current = "manual", L.current = !1, $(!0)), _ && (B.current === "segment" || !A) ? x(
442
+ _.segmentIndex,
443
443
  "subtitle-seek-segment",
444
444
  {
445
- seekTimeSeconds: b.segmentTimeSeconds,
445
+ seekTimeSeconds: _.segmentTimeSeconds,
446
446
  shouldResume: n
447
447
  }
448
- ) : A && ie(A, r) ? n ? C("subtitle-seek-url") : (c.current = !1, t.pause(), S(!1), !0) : !1;
448
+ ) : A && ie(A, r) ? n ? C("subtitle-seek-url") : (c.current = !1, t.pause(), y(!1), !0) : !1;
449
449
  },
450
450
  [
451
451
  f,
452
452
  A,
453
- T,
453
+ v,
454
454
  ie,
455
455
  x,
456
- M,
456
+ w,
457
457
  C,
458
458
  l,
459
459
  $
460
460
  ]
461
461
  ), Ht = u(
462
462
  (e) => {
463
- if (!g.current || !f)
463
+ if (!S.current || !f)
464
464
  return !1;
465
465
  const r = Math.max(Number(e), 0), n = Xe(
466
466
  k.current,
@@ -486,7 +486,7 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
486
486
  (e) => {
487
487
  const t = Se(
488
488
  e,
489
- Z(),
489
+ G(),
490
490
  {
491
491
  excludeTarget: e === "previous" ? ge.current : null
492
492
  }
@@ -505,7 +505,7 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
505
505
  },
506
506
  [
507
507
  i,
508
- Z,
508
+ G,
509
509
  J,
510
510
  Se,
511
511
  we,
@@ -513,18 +513,18 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
513
513
  ]
514
514
  ), se = u(
515
515
  (e) => {
516
- M(), c.current = !1, E.current = !1, U.current = !1, y(), S(!1), l(!1), i >= 0 && ut?.(i);
516
+ w(), c.current = !1, E.current = !1, U.current = !1, b(), y(!1), l(!1), i >= 0 && ut?.(i);
517
517
  },
518
518
  [
519
519
  i,
520
520
  ut,
521
- M,
522
- y,
521
+ w,
522
+ b,
523
523
  l
524
524
  ]
525
525
  ), Ue = u(
526
526
  (e) => {
527
- const t = g.current;
527
+ const t = S.current;
528
528
  return !t || B.current !== "url" || !Ur({
529
529
  currentTimeSeconds: Math.max(t.currentTime, 0),
530
530
  durationSeconds: t.duration
@@ -532,18 +532,18 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
532
532
  },
533
533
  [se]
534
534
  ), Dt = u(() => {
535
- const e = F.current + 1, t = k.current, r = t[e], n = me.current, b = t.some((re) => re.is_final);
535
+ const e = F.current + 1, t = k.current, r = t[e], n = me.current, _ = t.some((re) => re.is_final);
536
536
  if (r) {
537
537
  x(e, "ended");
538
538
  return;
539
539
  }
540
- if (n?.isAudioStreaming || !b) {
541
- F.current = e, h.current = e, E.current = !0, c.current = w, K(te(e)), S(!1), l(!0, "waitingForMoreAudio");
540
+ if (n?.isAudioStreaming || !_) {
541
+ F.current = e, h.current = e, E.current = !0, c.current = T, K(te(e)), y(!1), l(!0, "waitingForMoreAudio");
542
542
  return;
543
543
  }
544
544
  se("segments-completed");
545
545
  }, [
546
- w,
546
+ T,
547
547
  se,
548
548
  te,
549
549
  K,
@@ -551,25 +551,25 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
551
551
  l
552
552
  ]);
553
553
  m(() => {
554
- if (Le.current === Pe)
554
+ if (Le.current === Ze)
555
555
  return;
556
- j(!0), Le.current = Pe, F.current = 0, h.current = null, E.current = !1, L.current = !1, he.current = !1, c.current = !1, U.current = !1, B.current = null, Y.current = null, O.current = null, M(), K(0), l(!1);
557
- const e = g.current;
558
- e && (De.current = !0, e.pause(), e.removeAttribute("src"), e.load(), De.current = !1, S(!1));
556
+ j(!0), Le.current = Ze, F.current = 0, h.current = null, E.current = !1, L.current = !1, he.current = !1, c.current = !1, U.current = !1, B.current = null, P.current = null, O.current = null, w(), K(0), l(!1);
557
+ const e = S.current;
558
+ e && (De.current = !0, e.pause(), e.removeAttribute("src"), e.load(), De.current = !1, y(!1));
559
559
  }, [
560
560
  i,
561
- Pe,
561
+ Ze,
562
562
  W.length,
563
563
  A,
564
564
  j,
565
565
  K,
566
- M,
566
+ w,
567
567
  l
568
568
  ]), m(() => {
569
- const e = g.current;
569
+ const e = S.current;
570
570
  if (e) {
571
- if (T) {
572
- he.current = !!(me.current && !L.current && (!e.paused || c.current || h.current !== null)), c.current = !1, l(!1), e.pause(), S(!1);
571
+ if (v) {
572
+ he.current = !!(me.current && !L.current && (!e.paused || c.current || h.current !== null)), c.current = !1, l(!1), e.pause(), y(!1);
573
573
  return;
574
574
  }
575
575
  if (!(!he.current || !me.current || L.current)) {
@@ -595,39 +595,39 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
595
595
  }
596
596
  }
597
597
  }, [
598
- T,
598
+ v,
599
599
  x,
600
600
  C,
601
601
  l
602
602
  ]), m(() => {
603
- const e = g.current;
603
+ const e = S.current;
604
604
  if (!e)
605
605
  return;
606
606
  if (!f) {
607
607
  ae();
608
608
  return;
609
609
  }
610
- if (_ && _.id !== X.current)
610
+ if (M && M.id !== X.current)
611
611
  return;
612
- if (T) {
613
- c.current = !1, l(!1), e.pause(), S(!1);
612
+ if (v) {
613
+ c.current = !1, l(!1), e.pause(), y(!1);
614
614
  return;
615
615
  }
616
616
  const t = $r({
617
617
  activeSourceType: B.current,
618
618
  hasAudioUrl: !!A,
619
619
  segmentCount: W.length,
620
- preferredSourceType: Y.current,
620
+ preferredSourceType: P.current,
621
621
  waitingSegmentIndex: h.current
622
622
  });
623
- if (t && Y.current !== t && (Y.current = t), t === "url" && A) {
624
- const r = O.current !== A, n = P();
623
+ if (t && P.current !== t && (P.current = t), t === "url" && A) {
624
+ const r = O.current !== A, n = Z();
625
625
  if (r) {
626
- const b = h.current !== null ? Vt() : 0;
627
- ie(A, b * 1e3);
626
+ const _ = h.current !== null ? Vt() : 0;
627
+ ie(A, _ * 1e3);
628
628
  }
629
629
  if (c.current = n, E.current = !1, U.current = !1, l(!1), !n) {
630
- c.current = !1, e.pause(), S(!1);
630
+ c.current = !1, e.pause(), y(!1);
631
631
  return;
632
632
  }
633
633
  C(r ? "sync-url-init" : "sync-url");
@@ -636,18 +636,18 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
636
636
  if (t === "segment" && h.current !== null) {
637
637
  if (h.current < W.length) {
638
638
  if (L.current) {
639
- S(!1), l(!1);
639
+ y(!1), l(!1);
640
640
  return;
641
641
  }
642
642
  x(h.current, "wait-resume");
643
643
  return;
644
644
  }
645
- E.current = !0, c.current = P(), S(!1), l(P());
645
+ E.current = !0, c.current = Z(), y(!1), l(Z());
646
646
  return;
647
647
  }
648
648
  if (t === "segment" && !W.length) {
649
649
  if (f.isAudioStreaming) {
650
- h.current = F.current, E.current = !0, c.current = P(), S(!1), l(P());
650
+ h.current = F.current, E.current = !0, c.current = Z(), y(!1), l(Z());
651
651
  return;
652
652
  }
653
653
  ae();
@@ -667,8 +667,8 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
667
667
  ae();
668
668
  return;
669
669
  }
670
- if (!w || L.current) {
671
- c.current = !1, e.pause(), S(!1);
670
+ if (!T || L.current) {
671
+ c.current = !1, e.pause(), y(!1);
672
672
  return;
673
673
  }
674
674
  e.paused && (c.current = !0, C("sync-paused-retry"));
@@ -677,10 +677,10 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
677
677
  i,
678
678
  W,
679
679
  A,
680
- w,
681
680
  T,
682
- _,
683
- P,
681
+ v,
682
+ M,
683
+ Z,
684
684
  ae,
685
685
  ie,
686
686
  x,
@@ -699,24 +699,24 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
699
699
  Fe,
700
700
  D
701
701
  ]), m(() => {
702
- if (!(!_ || _.id === X.current || i < 0)) {
703
- if (Ht(_.timeMs)) {
704
- X.current = _.id, oe?.(_.id);
702
+ if (!(!M || M.id === X.current || i < 0)) {
703
+ if (Ht(M.timeMs)) {
704
+ X.current = M.id, oe?.(M.id);
705
705
  return;
706
706
  }
707
- f?.isAudioStreaming || (X.current = _.id, oe?.(_.id));
707
+ f?.isAudioStreaming || (X.current = M.id, oe?.(M.id));
708
708
  }
709
709
  }, [
710
710
  f?.isAudioStreaming,
711
711
  i,
712
712
  oe,
713
- _,
713
+ M,
714
714
  Ht
715
715
  ]), m(() => {
716
- if (!_ || _.id === X.current || i < 0 || !f?.isAudioStreaming)
716
+ if (!M || M.id === X.current || i < 0 || !f?.isAudioStreaming)
717
717
  return;
718
718
  const e = window.setTimeout(() => {
719
- _.id !== X.current && (X.current = _.id, oe?.(_.id));
719
+ M.id !== X.current && (X.current = M.id, oe?.(M.id));
720
720
  }, cn);
721
721
  return () => {
722
722
  window.clearTimeout(e);
@@ -725,32 +725,32 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
725
725
  f?.isAudioStreaming,
726
726
  i,
727
727
  oe,
728
- _
729
- ]), m(() => ae, [ae]), m(() => M, [M]);
728
+ M
729
+ ]), m(() => ae, [ae]), m(() => w, [w]);
730
730
  const fr = u(() => {
731
- y(), $t(), S(!0), l(!1), tt?.();
731
+ b(), $t(), y(!0), l(!1), tt?.();
732
732
  }, [
733
733
  tt,
734
734
  $t,
735
- y,
735
+ b,
736
736
  l
737
737
  ]), dr = u(() => {
738
- De.current || E.current || U.current || (M(), y(), j(!0), S(!1));
739
- }, [j, M, y]), mr = u(() => {
740
- const e = g.current;
741
- e && N.current !== null && (e.currentTime = N.current, N.current = null), y(), !Ue("canplay-seek-finished") && (!c.current || !w || C("canplay"));
738
+ De.current || E.current || U.current || (w(), b(), j(!0), y(!1));
739
+ }, [j, w, b]), mr = u(() => {
740
+ const e = S.current;
741
+ e && N.current !== null && (e.currentTime = N.current, N.current = null), b(), !Ue("canplay-seek-finished") && (!c.current || !T || C("canplay"));
742
742
  }, [
743
743
  i,
744
- w,
744
+ T,
745
745
  Ue,
746
- y,
746
+ b,
747
747
  C
748
748
  ]), pr = u(() => {
749
- const e = g.current;
750
- e && N.current !== null && (e.currentTime = N.current, N.current = null), y(), Ue("metadata-seek-finished");
751
- }, [i, Ue, y]), hr = u(() => {
752
- y(), j();
753
- }, [j, y]), gr = u(() => {
749
+ const e = S.current;
750
+ e && N.current !== null && (e.currentTime = N.current, N.current = null), b(), Ue("metadata-seek-finished");
751
+ }, [i, Ue, b]), hr = u(() => {
752
+ b(), j();
753
+ }, [j, b]), gr = u(() => {
754
754
  E.current || l(!0, "loadingAudio");
755
755
  }, [l]), Sr = u(() => {
756
756
  if (E.current) {
@@ -759,15 +759,15 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
759
759
  }
760
760
  l(!0, "loadingAudio");
761
761
  }, [l]), Jt = u(() => {
762
- y();
763
- }, [y]), yr = u(() => {
762
+ b();
763
+ }, [b]), yr = u(() => {
764
764
  const e = me.current, t = B.current === "url" || k.current.length === 0, r = !!k.current[F.current + 1], n = k.current.some(
765
765
  (re) => re.is_final
766
- ), b = !!e?.isAudioStreaming;
766
+ ), _ = !!e?.isAudioStreaming;
767
767
  if (j(
768
768
  !0,
769
- t || !b && !r && n
770
- ), M(), U.current = !1, t) {
769
+ t || !_ && !r && n
770
+ ), w(), U.current = !1, t) {
771
771
  se("url-ended");
772
772
  return;
773
773
  }
@@ -776,21 +776,21 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
776
776
  j,
777
777
  se,
778
778
  Dt,
779
- M
779
+ w
780
780
  ]), br = u(() => {
781
- M(), y(), S(!1), l(!1);
782
- }, [M, y, l]), _r = u(
781
+ w(), b(), y(!1), l(!1);
782
+ }, [w, b, l]), _r = u(
783
783
  (e) => {
784
784
  nt?.(e), ue(!1);
785
785
  },
786
786
  [nt]
787
787
  ), je = u(() => {
788
788
  if (R) {
789
- const t = !G;
789
+ const t = !Y;
790
790
  return $(t), lt?.(t), !0;
791
791
  }
792
- const e = g.current;
793
- return T || !e || !f ? !1 : h.current !== null ? xe ? ($(!1), c.current = !1, L.current = !0, h.current = null, E.current = !1, S(!1), l(!1), e.pause(), !0) : ($(!0), I.current = "manual", L.current = !1, c.current = !0, l(!0, "waitingForMoreAudio"), !0) : !e.src && W.length > 0 ? ($(!0), I.current = "manual", L.current = !1, x(
792
+ const e = S.current;
793
+ return v || !e || !f ? !1 : h.current !== null ? xe ? ($(!1), c.current = !1, L.current = !0, h.current = null, E.current = !1, y(!1), l(!1), e.pause(), !0) : ($(!0), I.current = "manual", L.current = !1, c.current = !0, l(!0, "waitingForMoreAudio"), !0) : !e.src && W.length > 0 ? ($(!0), I.current = "manual", L.current = !1, x(
794
794
  Math.min(
795
795
  F.current,
796
796
  W.length - 1
@@ -800,8 +800,8 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
800
800
  }, [
801
801
  f,
802
802
  W.length,
803
- G,
804
- T,
803
+ Y,
804
+ v,
805
805
  xe,
806
806
  lt,
807
807
  x,
@@ -841,9 +841,9 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
841
841
  le.previous,
842
842
  je
843
843
  ]
844
- ), Pt = a(ze);
844
+ ), Zt = a(ze);
845
845
  return m(() => {
846
- Pt.current = ze;
846
+ Zt.current = ze;
847
847
  }, [ze]), m(() => {
848
848
  if (!V || typeof document > "u")
849
849
  return;
@@ -854,8 +854,8 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
854
854
  if (!r || Vr(t, r))
855
855
  return;
856
856
  let n = !1;
857
- const b = Pt.current[r];
858
- n = b(), n && t.preventDefault();
857
+ const _ = Zt.current[r];
858
+ n = _(), n && t.preventDefault();
859
859
  };
860
860
  return document.addEventListener("keydown", e), () => {
861
861
  document.removeEventListener("keydown", e);
@@ -869,14 +869,18 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
869
869
  dir: $e,
870
870
  lang: ft,
871
871
  "data-slide-player-shortcut-owner": q,
872
- className: Nr("slide-player", p),
872
+ className: Nr(
873
+ "slide-player",
874
+ g && (g.totalSteps > 1 || g.isGenerating) && "slide-player--with-slide-progress",
875
+ p
876
+ ),
873
877
  onFocusCapture: or,
874
878
  onPointerDown: cr,
875
879
  children: [
876
880
  /* @__PURE__ */ s(
877
881
  "audio",
878
882
  {
879
- ref: g,
883
+ ref: S,
880
884
  preload: "auto",
881
885
  playsInline: !0,
882
886
  onLoadStart: gr,
@@ -940,7 +944,7 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
940
944
  },
941
945
  type: "button",
942
946
  children: /* @__PURE__ */ s(
943
- Zr,
947
+ Gr,
944
948
  {
945
949
  className: "slide-player__icon",
946
950
  strokeWidth: 2.25
@@ -999,7 +1003,7 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
999
1003
  title: Wt.title,
1000
1004
  type: "button",
1001
1005
  children: /* @__PURE__ */ s(
1002
- Gr,
1006
+ Yr,
1003
1007
  {
1004
1008
  className: "slide-player__icon",
1005
1009
  strokeWidth: 2.25
@@ -1019,7 +1023,7 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
1019
1023
  },
1020
1024
  title: Ft.title,
1021
1025
  type: "button",
1022
- children: /* @__PURE__ */ s(Yr, { className: "slide-player__icon", strokeWidth: 2.25 })
1026
+ children: /* @__PURE__ */ s(Pr, { className: "slide-player__icon", strokeWidth: 2.25 })
1023
1027
  }
1024
1028
  ),
1025
1029
  /* @__PURE__ */ s(
@@ -1094,10 +1098,10 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
1094
1098
  ]
1095
1099
  }
1096
1100
  ),
1097
- v && (v.totalSteps > 1 || v.isGenerating) ? /* @__PURE__ */ H(
1101
+ g && (g.totalSteps > 1 || g.isGenerating) ? /* @__PURE__ */ H(
1098
1102
  "div",
1099
1103
  {
1100
- "aria-label": v.ariaLabel,
1104
+ "aria-label": g.ariaLabel,
1101
1105
  className: "slide-player__slide-progress",
1102
1106
  role: "navigation",
1103
1107
  children: [
@@ -1107,19 +1111,19 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
1107
1111
  className: "slide-player__slide-progress-viewport",
1108
1112
  ref: mt,
1109
1113
  children: /* @__PURE__ */ s("div", { className: "slide-player__slide-progress-track", children: Array.from(
1110
- { length: v.totalSteps },
1114
+ { length: g.totalSteps },
1111
1115
  (e, t) => /* @__PURE__ */ s(
1112
1116
  "button",
1113
1117
  {
1114
- "aria-current": t === v.currentIndex ? "step" : void 0,
1115
- "aria-label": `${v.ariaLabel} ${t + 1}`,
1118
+ "aria-current": t === g.currentIndex ? "step" : void 0,
1119
+ "aria-label": `${g.ariaLabel} ${t + 1}`,
1116
1120
  className: "slide-player__slide-progress-segment",
1117
- "data-state": t < v.currentIndex ? "completed" : t === v.currentIndex ? "current" : "upcoming",
1118
- onClick: () => v.onNavigate?.(
1121
+ "data-state": t < g.currentIndex ? "completed" : t === g.currentIndex ? "current" : "upcoming",
1122
+ onClick: () => g.onNavigate?.(
1119
1123
  t,
1120
1124
  J()
1121
1125
  ),
1122
- ref: t === v.currentIndex ? pt : void 0,
1126
+ ref: t === g.currentIndex ? pt : void 0,
1123
1127
  type: "button"
1124
1128
  },
1125
1129
  t
@@ -1130,12 +1134,12 @@ const Yt = /* @__PURE__ */ new Map(), Qt = (d) => {
1130
1134
  /* @__PURE__ */ H(
1131
1135
  "span",
1132
1136
  {
1133
- "aria-hidden": !v.isGenerating,
1137
+ "aria-hidden": !g.isGenerating,
1134
1138
  className: "slide-player__slide-progress-generating",
1135
- "data-visible": v.isGenerating ? "true" : "false",
1139
+ "data-visible": g.isGenerating ? "true" : "false",
1136
1140
  children: [
1137
1141
  /* @__PURE__ */ s(rn, { "aria-hidden": "true" }),
1138
- v.generatingLabel
1142
+ g.generatingLabel
1139
1143
  ]
1140
1144
  }
1141
1145
  )