markdown-flow-ui 0.1.128-dev.1 → 0.1.128

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.
Files changed (47) hide show
  1. package/dist/assets/markdown-flow-ui.css +1 -1
  2. package/dist/components/Slide/Player.cjs.js +1 -1
  3. package/dist/components/Slide/Player.cjs.js.map +1 -1
  4. package/dist/components/Slide/Player.d.ts +5 -1
  5. package/dist/components/Slide/Player.es.js +615 -465
  6. package/dist/components/Slide/Player.es.js.map +1 -1
  7. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  8. package/dist/components/Slide/Slide.es.js.map +1 -1
  9. package/dist/components/Slide/Slide.stories.d.ts +2 -0
  10. package/dist/components/Slide/SubtitleOverlay.cjs.js.map +1 -1
  11. package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
  12. package/dist/components/Slide/constants.cjs.js +1 -1
  13. package/dist/components/Slide/constants.cjs.js.map +1 -1
  14. package/dist/components/Slide/constants.d.ts +4 -2
  15. package/dist/components/Slide/constants.es.js +4 -2
  16. package/dist/components/Slide/constants.es.js.map +1 -1
  17. package/dist/components/Slide/useSlide.cjs.js.map +1 -1
  18. package/dist/components/Slide/useSlide.es.js.map +1 -1
  19. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.js +1 -1
  20. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.js.map +1 -1
  21. package/dist/components/Slide/utils/playerKeyboardShortcuts.d.ts +1 -1
  22. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js +14 -5
  23. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js.map +1 -1
  24. package/dist/components/Slide/utils/segmentSeek.cjs.js +2 -0
  25. package/dist/components/Slide/utils/segmentSeek.cjs.js.map +1 -0
  26. package/dist/components/Slide/utils/segmentSeek.d.ts +8 -0
  27. package/dist/components/Slide/utils/segmentSeek.es.js +31 -0
  28. package/dist/components/Slide/utils/segmentSeek.es.js.map +1 -0
  29. package/dist/components/Slide/utils/segmentSeek.test.d.ts +1 -0
  30. package/dist/components/Slide/utils/streamingNavigation.cjs.js.map +1 -1
  31. package/dist/components/Slide/utils/streamingNavigation.es.js.map +1 -1
  32. package/dist/components/Slide/utils/subtitleCue.cjs.js +2 -2
  33. package/dist/components/Slide/utils/subtitleCue.cjs.js.map +1 -1
  34. package/dist/components/Slide/utils/subtitleCue.d.ts +10 -0
  35. package/dist/components/Slide/utils/subtitleCue.es.js +59 -5
  36. package/dist/components/Slide/utils/subtitleCue.es.js.map +1 -1
  37. package/dist/lib/interaction-defaults.cjs.js.map +1 -1
  38. package/dist/lib/interaction-defaults.es.js.map +1 -1
  39. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs.js +7 -0
  40. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs.js.map +1 -0
  41. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js +16 -0
  42. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js.map +1 -0
  43. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs.js +7 -0
  44. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs.js.map +1 -0
  45. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js +16 -0
  46. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js.map +1 -0
  47. package/package.json +1 -1
@@ -1,32 +1,36 @@
1
1
  import { j as n } from "../../_virtual/jsx-runtime.es.js";
2
- import Rr, { memo as Er, useId as Cr, useContext as Nr, useRef as c, useState as nr, useMemo as G, useCallback as t, useEffect as m } from "react";
3
- import { cn as ur } from "../../lib/utils.es.js";
4
- import vr from "./MobilePlayerSettingsSheet.es.js";
5
- import { DEFAULT_SLIDE_PLAYER_TEXTS as Tr } from "./constants.es.js";
6
- import { DEFAULT_MOBILE_VIEW_MODE as Kr } from "./utils/mobileScreenMode.es.js";
7
- import { hasReachedAudioEnd as Pr } from "./utils/audioCompletion.es.js";
8
- import { PlayerKeyboardShortcutContext as Ur } from "./utils/playerKeyboardShortcutContext.es.js";
9
- import { activatePlayerKeyboardShortcutOwner as Fr, registerPlayerKeyboardShortcutOwner as Wr, isActivePlayerKeyboardShortcutOwner as Or, getPlayerKeyboardShortcutAction as Br, shouldIgnorePlayerKeyboardShortcutEvent as Vr } from "./utils/playerKeyboardShortcuts.es.js";
10
- import { resolveAudioPlaybackSourceType as Hr } from "./utils/playbackSource.es.js";
11
- import { shouldKeepPlayingAfterNavigation as $r } from "./utils/playbackPreference.es.js";
12
- import { toPlayerCustomActionList as Zr } from "./utils/playerCustomActions.es.js";
13
- import { suppressPlayerControlsWakeAfterNavigation as ar } from "./utils/playerNavigationContext.es.js";
2
+ import Ht, { memo as $t, useId as Zt, useContext as qt, useRef as c, useState as Re, useMemo as Y, useCallback as r, useEffect as y } from "react";
3
+ import { cn as bt } from "../../lib/utils.es.js";
4
+ import zt from "./MobilePlayerSettingsSheet.es.js";
5
+ import { DEFAULT_SLIDE_PLAYER_TEXTS as It } from "./constants.es.js";
6
+ import { DEFAULT_MOBILE_VIEW_MODE as Yt } from "./utils/mobileScreenMode.es.js";
7
+ import { hasReachedAudioEnd as Dt } from "./utils/audioCompletion.es.js";
8
+ import { PlayerKeyboardShortcutContext as Xt } from "./utils/playerKeyboardShortcutContext.es.js";
9
+ import { activatePlayerKeyboardShortcutOwner as Gt, registerPlayerKeyboardShortcutOwner as Qt, isActivePlayerKeyboardShortcutOwner as er, getPlayerKeyboardShortcutAction as tr, shouldIgnorePlayerKeyboardShortcutEvent as rr } from "./utils/playerKeyboardShortcuts.es.js";
10
+ import { resolveAudioPlaybackSourceType as nr } from "./utils/playbackSource.es.js";
11
+ import { shouldKeepPlayingAfterNavigation as ur } from "./utils/playbackPreference.es.js";
12
+ import { toPlayerCustomActionList as sr } from "./utils/playerCustomActions.es.js";
13
+ import { suppressPlayerControlsWakeAfterNavigation as St } from "./utils/playerNavigationContext.es.js";
14
+ import { isPlaybackTimeCoveredBySegments as gt, resolveSegmentSeekTarget as lr } from "./utils/segmentSeek.es.js";
15
+ import { getSubtitleCueJumpTime as ar } from "./utils/subtitleCue.es.js";
14
16
  /* empty css */
15
- import qr from "../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js";
16
- import zr from "../../node_modules/lucide-react/dist/esm/icons/volume-2.es.js";
17
- import Yr from "../../node_modules/lucide-react/dist/esm/icons/captions.es.js";
18
- import Dr from "../../node_modules/lucide-react/dist/esm/icons/captions-off.es.js";
19
- import Xr from "../../node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js";
20
- import Gr from "../../node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js";
21
- import Jr from "../../node_modules/lucide-react/dist/esm/icons/scan-line.es.js";
22
- import Qr from "../../node_modules/lucide-react/dist/esm/icons/maximize.es.js";
23
- import Ir from "../../node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js";
24
- const sr = /* @__PURE__ */ new Map(), lr = (k) => {
25
- if (typeof window > "u" || !k || sr.has(k))
17
+ import ir from "../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js";
18
+ import cr from "../../node_modules/lucide-react/dist/esm/icons/volume-2.es.js";
19
+ import or from "../../node_modules/lucide-react/dist/esm/icons/captions.es.js";
20
+ import fr from "../../node_modules/lucide-react/dist/esm/icons/captions-off.es.js";
21
+ import dr from "../../node_modules/lucide-react/dist/esm/icons/skip-back.es.js";
22
+ import mr from "../../node_modules/lucide-react/dist/esm/icons/rotate-ccw.es.js";
23
+ import pr from "../../node_modules/lucide-react/dist/esm/icons/rotate-cw.es.js";
24
+ import hr from "../../node_modules/lucide-react/dist/esm/icons/skip-forward.es.js";
25
+ import yr from "../../node_modules/lucide-react/dist/esm/icons/scan-line.es.js";
26
+ import br from "../../node_modules/lucide-react/dist/esm/icons/maximize.es.js";
27
+ import Sr from "../../node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js";
28
+ const _t = /* @__PURE__ */ new Map(), xt = (R) => {
29
+ if (typeof window > "u" || !R || _t.has(R))
26
30
  return;
27
- const j = window.document.createElement("audio");
28
- j.preload = "auto", j.setAttribute("playsinline", "true"), j.src = k, j.load(), sr.set(k, j);
29
- }, et = () => /* @__PURE__ */ n.jsxs(
31
+ const N = window.document.createElement("audio");
32
+ N.preload = "auto", N.setAttribute("playsinline", "true"), N.src = R, N.load(), _t.set(R, N);
33
+ }, gr = () => /* @__PURE__ */ n.jsxs(
30
34
  "svg",
31
35
  {
32
36
  xmlns: "http://www.w3.org/2000/svg",
@@ -45,7 +49,7 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
45
49
  /* @__PURE__ */ n.jsx("path", { d: "M12 10H16V24H12V10ZM18 10H22V24H18V10Z", fill: "white" })
46
50
  ]
47
51
  }
48
- ), rt = () => /* @__PURE__ */ n.jsxs(
52
+ ), _r = () => /* @__PURE__ */ n.jsxs(
49
53
  "svg",
50
54
  {
51
55
  xmlns: "http://www.w3.org/2000/svg",
@@ -64,583 +68,693 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
64
68
  /* @__PURE__ */ n.jsx("path", { d: "M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z", fill: "white" })
65
69
  ]
66
70
  }
67
- ), J = {
71
+ ), H = {
68
72
  fullscreen: "F",
69
73
  next: "→",
74
+ nextSubtitle: "Shift+→",
70
75
  notes: "N",
71
76
  playback: "Space",
72
77
  previous: "←",
78
+ previousSubtitle: "Shift+←",
73
79
  subtitle: "C"
74
- }, tt = (k, j) => k ? `${k} (${j})` : j, nt = ({
75
- audioList: k = [],
76
- className: j,
77
- currentAudioIndex: h = -1,
78
- defaultPlaying: g = !0,
79
- isPlaybackPaused: K = !1,
80
- isAutoAdvanceEnabled: O = !0,
81
- useAutoAdvanceToggle: N = !1,
82
- onLoadingChange: xe,
83
- onPlaybackPreferenceChange: ke,
84
- onPlaybackStarted: Me,
85
- onPlaybackTimeChange: ne,
86
- onSubtitleToggle: Q,
87
- onPrev: ue,
88
- onNext: ae,
89
- onFullscreen: I,
90
- isFullscreen: Le = !1,
91
- mobileViewMode: cr = Kr,
92
- settingsPortalContainer: or,
93
- onMobileViewModeChange: Ae,
94
- onEnded: je,
95
- onAutoAdvanceToggle: Re,
96
- onInteractionToggle: se,
97
- hasInteraction: me = !1,
98
- isInteractionOpen: ee = !1,
99
- isSubtitleEnabled: pe = !0,
100
- prevDisabled: he = !1,
101
- nextDisabled: ye = !1,
102
- showControls: be = !0,
103
- enableKeyboardShortcuts: ir = !0,
104
- customActions: Ee,
105
- customActionContext: Ce,
106
- texts: Ne,
107
- onFocusCapture: ve,
108
- onPointerDown: Te,
109
- ...fr
80
+ }, xr = 250, kr = (R, N) => R ? `${R} (${N})` : N, wr = ({
81
+ audioList: R = [],
82
+ className: N,
83
+ currentAudioIndex: k = -1,
84
+ defaultPlaying: L = !0,
85
+ isPlaybackPaused: T = !1,
86
+ isAutoAdvanceEnabled: $ = !0,
87
+ useAutoAdvanceToggle: F = !1,
88
+ onLoadingChange: je,
89
+ onPlaybackPreferenceChange: Ce,
90
+ onPlaybackStarted: Ne,
91
+ onPlaybackTimeChange: ie,
92
+ onSubtitleToggle: ee,
93
+ onPrev: ce,
94
+ onNext: oe,
95
+ onFullscreen: te,
96
+ isFullscreen: Ee = !1,
97
+ mobileViewMode: kt = Yt,
98
+ settingsPortalContainer: wt,
99
+ onMobileViewModeChange: Ke,
100
+ onEnded: Ue,
101
+ onAutoAdvanceToggle: Fe,
102
+ onInteractionToggle: fe,
103
+ hasInteraction: _e = !1,
104
+ isInteractionOpen: re = !1,
105
+ isSubtitleEnabled: xe = !0,
106
+ prevDisabled: ke = !1,
107
+ nextDisabled: we = !1,
108
+ showControls: Me = !0,
109
+ enableKeyboardShortcuts: Mt = !0,
110
+ customActions: We,
111
+ customActionContext: Pe,
112
+ texts: Be,
113
+ onFocusCapture: Oe,
114
+ onPointerDown: Ve,
115
+ ...Lt
110
116
  }) => {
111
- const dr = Cr(), Ke = Nr(Ur), y = c(null), Pe = c(ee), P = c(null), Ue = c(null), R = c(0), o = c(null), le = c(void 0), v = c([]), ce = c(
112
- N ? O : g
113
- ), re = c(!1), Fe = c(!1), b = c(!1), U = c(null), q = c(null), _ = c(!1), s = c(!1), S = c(null), E = c(!1), B = c(null), Se = c(0), F = c("unknown"), [oe, f] = nr(g), [We, z] = nr(!1), V = Ke?.ownerId ?? dr, T = ir && (Ke?.enabled ?? !0), d = h >= 0 ? k[h] : void 0, H = d?.audioUrl, M = G(
114
- () => [...d?.audioSegments ?? []].sort(
115
- (e, r) => e.segment_index - r.segment_index
117
+ const Tt = Zt(), Je = qt(Xt), _ = c(null), He = c(re), E = c(null), $e = c(null), K = c(0), f = c(null), de = c(void 0), j = c([]), ne = c(
118
+ F ? $ : L
119
+ ), ue = c(!1), Ze = c(!1), b = c(!1), U = c(null), Z = c(null), A = c(!1), l = c(!1), S = c(null), C = c(!1), q = c(null), me = c(0), qe = c(() => {
120
+ }), pe = c(null), W = c("unknown"), [he, d] = Re(L), [ze, D] = Re(!1), [X, At] = Re({
121
+ next: !1,
122
+ previous: !1
123
+ }), z = Je?.ownerId ?? Tt, P = Mt && (Je?.enabled ?? !0), o = k >= 0 ? R[k] : void 0, g = o?.audioUrl, w = Y(
124
+ () => [...o?.audioSegments ?? []].sort(
125
+ (e, t) => e.segment_index - t.segment_index
116
126
  ),
117
- [d?.audioSegments]
118
- ), Oe = G(
119
- () => Zr(Ee, Ce),
120
- [Ce, Ee]
121
- ), Be = Oe.length + 5, mr = G(
127
+ [o?.audioSegments]
128
+ ), Ie = Y(
129
+ () => o?.element?.subtitle_cues ?? [],
130
+ [o?.element?.subtitle_cues]
131
+ ), Ye = Y(
132
+ () => sr(We, Pe),
133
+ [Pe, We]
134
+ ), De = Ye.length + 7, vt = Y(
122
135
  () => ({
123
- "--slide-player-mobile-control-count": String(Be)
136
+ "--slide-player-mobile-control-count": String(De)
124
137
  }),
125
- [Be]
126
- ), l = G(
138
+ [De]
139
+ ), a = Y(
127
140
  () => ({
128
- ...Tr,
129
- ...Ne
141
+ ...It,
142
+ ...Be
130
143
  }),
131
- [Ne]
132
- ), ge = G(() => d ? d.audioKey ?? `${String(d.sequenceNumber ?? "none")}:${String(d.audioUrl ?? "")}` : "none", [d]), pr = N ? O : oe, Ve = N ? O ? l.pauseAutoplayLabel : l.playAutoplayLabel : oe ? l.pauseLabel : l.playLabel, He = Le ? l.exitFullscreenLabel : l.enterFullscreenLabel, Y = t(
133
- (e, r, a) => ({
134
- ariaKeyShortcuts: T ? a : void 0,
135
- title: T ? tt(e, r) : e
144
+ [Be]
145
+ ), Le = Y(() => o ? o.audioKey ?? `${String(o.sequenceNumber ?? "none")}:${String(o.audioUrl ?? "")}` : "none", [o]), Rt = F ? $ : he, Xe = F ? $ ? a.pauseAutoplayLabel : a.playAutoplayLabel : he ? a.pauseLabel : a.playLabel, Ge = Ee ? a.exitFullscreenLabel : a.enterFullscreenLabel, O = r(
146
+ (e, t, s) => ({
147
+ ariaKeyShortcuts: P ? s : void 0,
148
+ title: P ? kr(e, t) : e
136
149
  }),
137
- [T]
138
- ), $e = Y(
139
- l.subtitleToggleAriaLabel,
140
- J.subtitle,
150
+ [P]
151
+ ), Qe = O(
152
+ a.subtitleToggleAriaLabel,
153
+ H.subtitle,
141
154
  "c"
142
- ), Ze = Y(
143
- l.previousLabel,
144
- J.previous,
155
+ ), et = O(
156
+ a.previousLabel,
157
+ H.previous,
145
158
  "ArrowLeft"
146
- ), qe = Y(
147
- Ve,
148
- J.playback,
159
+ ), tt = O(
160
+ a.previousSubtitleLabel,
161
+ H.previousSubtitle,
162
+ "Shift+ArrowLeft"
163
+ ), rt = O(
164
+ Xe,
165
+ H.playback,
149
166
  "Space"
150
- ), ze = Y(
151
- l.nextLabel,
152
- J.next,
167
+ ), nt = O(
168
+ a.nextLabel,
169
+ H.next,
153
170
  "ArrowRight"
154
- ), Ye = Y(
155
- He,
156
- J.fullscreen,
171
+ ), ut = O(
172
+ a.nextSubtitleLabel,
173
+ H.nextSubtitle,
174
+ "Shift+ArrowRight"
175
+ ), st = O(
176
+ Ge,
177
+ H.fullscreen,
157
178
  "f"
158
- ), De = Y(
159
- l.notesLabel,
160
- J.notes,
179
+ ), lt = O(
180
+ a.notesLabel,
181
+ H.notes,
161
182
  "n"
162
- ), ie = t(() => {
163
- T && Fr(V);
164
- }, [V, T]), hr = t(
183
+ ), ye = r(() => {
184
+ P && Gt(z);
185
+ }, [z, P]), jt = r(
165
186
  (e) => {
166
- ie(), Te?.(e);
187
+ ye(), Ve?.(e);
167
188
  },
168
- [ie, Te]
169
- ), yr = t(
189
+ [ye, Ve]
190
+ ), Ct = r(
170
191
  (e) => {
171
- ie(), ve?.(e);
192
+ ye(), Oe?.(e);
172
193
  },
173
- [ie, ve]
194
+ [ye, Oe]
174
195
  );
175
- m(() => {
176
- le.current = d;
177
- }, [d]), m(() => {
178
- ce.current = N ? O : g;
179
- }, [g, O, N]), m(() => {
180
- be || z(!1);
181
- }, [be]), m(() => {
182
- !Pe.current && ee && z(!1), Pe.current = ee;
183
- }, [ee]), m(() => {
184
- v.current = M;
185
- }, [M]), m(() => {
186
- const e = d?.audioUrl, r = h >= 0 ? k[h + 1]?.audioUrl : void 0;
187
- lr(e), lr(r);
188
- }, [k, d?.audioUrl, h]);
189
- const u = t(
190
- (e, r = null) => {
191
- Fe.current === e && (!e || r === null) || (Fe.current = e, xe?.({
196
+ y(() => {
197
+ de.current = o;
198
+ }, [o]), y(() => {
199
+ ne.current = F ? $ : L;
200
+ }, [L, $, F]), y(() => {
201
+ Me || D(!1);
202
+ }, [Me]), y(() => {
203
+ !He.current && re && D(!1), He.current = re;
204
+ }, [re]), y(() => {
205
+ j.current = w;
206
+ }, [w]), y(() => {
207
+ const e = o?.audioUrl, t = k >= 0 ? R[k + 1]?.audioUrl : void 0;
208
+ xt(e), xt(t);
209
+ }, [R, o?.audioUrl, k]);
210
+ const u = r(
211
+ (e, t = null) => {
212
+ Ze.current === e && (!e || t === null) || (Ze.current = e, je?.({
192
213
  loading: e,
193
- reason: e ? r : null
214
+ reason: e ? t : null
194
215
  }));
195
216
  },
196
- [xe]
197
- ), $ = t(
217
+ [je]
218
+ ), B = r(
198
219
  (e) => {
199
- ce.current = e, ke?.(e);
220
+ ne.current = e, Ce?.(e);
200
221
  },
201
- [ke]
202
- ), te = t(() => N ? {
203
- shouldContinuePlayback: ce.current
222
+ [Ce]
223
+ ), se = r(() => F ? {
224
+ shouldContinuePlayback: ne.current
204
225
  } : {
205
- shouldContinuePlayback: $r({
206
- defaultPlaying: ce.current,
226
+ shouldContinuePlayback: ur({
227
+ defaultPlaying: ne.current,
207
228
  isPausedByUser: b.current
208
229
  })
209
- }, [N]), Xe = t((e) => e instanceof DOMException ? e.name === "NotAllowedError" || e.name === "SecurityError" : !1, []), W = t(() => g && !K && !b.current && F.current !== "blocked", [g, K]), Ge = t((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), Je = t(() => {
210
- const e = o.current;
211
- return e == null || e <= 0 ? 0 : v.current.slice(0, e).reduce(
212
- (r, a) => r + Math.max(Number(a.duration_ms ?? 0), 0),
230
+ }, [F]), at = r((e) => e instanceof DOMException ? e.name === "NotAllowedError" || e.name === "SecurityError" : !1, []), V = r(() => L && !T && !b.current && W.current !== "blocked", [L, T]), it = r((e) => e ? e.startsWith("data:") ? e : `data:audio/mpeg;base64,${e}` : "", []), ct = r(() => {
231
+ const e = f.current;
232
+ return e == null || e <= 0 ? 0 : j.current.slice(0, e).reduce(
233
+ (t, s) => t + Math.max(Number(s.duration_ms ?? 0), 0),
213
234
  0
214
235
  ) / 1e3;
215
- }, []), Z = t((e) => e <= 0 ? 0 : v.current.slice(0, e).reduce(
216
- (r, a) => r + Math.max(Number(a.duration_ms ?? 0), 0),
236
+ }, []), I = r((e) => e <= 0 ? 0 : j.current.slice(0, e).reduce(
237
+ (t, s) => t + Math.max(Number(s.duration_ms ?? 0), 0),
217
238
  0
218
- ), []), Qe = t(() => {
219
- const e = y.current;
220
- return e ? U.current === "segment" ? Z(R.current) + Math.max(e.currentTime, 0) * 1e3 : S.current !== null && e.readyState === 0 ? S.current * 1e3 : Math.max(e.currentTime, 0) * 1e3 : o.current != null ? Z(o.current) : 0;
221
- }, [Z]), w = t(
239
+ ), []), ot = r(
240
+ (e) => !o || T ? !1 : g ? !0 : gt(w, e),
241
+ [o, w, g, T]
242
+ ), le = r(
243
+ (e, t) => {
244
+ const s = ar({
245
+ currentTimeMs: t,
246
+ direction: e,
247
+ subtitleCues: Ie
248
+ });
249
+ return s === null || !ot(s) ? null : s;
250
+ },
251
+ [ot, Ie]
252
+ ), Te = r(
253
+ (e, t = !1) => {
254
+ const s = Math.max(Number(e), 0);
255
+ if (!t && pe.current !== null && Math.abs(
256
+ s - pe.current
257
+ ) < xr)
258
+ return;
259
+ pe.current = s;
260
+ const i = {
261
+ previous: le("previous", s) !== null,
262
+ next: le("next", s) !== null
263
+ };
264
+ At((p) => p.previous === i.previous && p.next === i.next ? p : i);
265
+ },
266
+ [le]
267
+ );
268
+ y(() => {
269
+ qe.current = Te, Te(me.current, !0);
270
+ }, [Te]);
271
+ const be = r(() => {
272
+ const e = _.current;
273
+ return e ? U.current === "segment" ? I(K.current) + Math.max(e.currentTime, 0) * 1e3 : S.current !== null && e.readyState === 0 ? S.current * 1e3 : Math.max(e.currentTime, 0) * 1e3 : f.current != null ? I(f.current) : 0;
274
+ }, [I]), x = r(
222
275
  (e) => {
223
- const r = Math.max(e, 0);
224
- Se.current !== r && (Se.current = r, ne?.(r));
276
+ const t = Math.max(e, 0);
277
+ me.current !== t && (me.current = t, ie?.(t), qe.current(t));
225
278
  },
226
- [ne]
227
- ), i = t(() => {
228
- w(Qe());
229
- }, [Qe, w]), p = t(() => {
230
- typeof window > "u" || B.current === null || (window.cancelAnimationFrame(B.current), B.current = null);
231
- }, []), Ie = t(() => {
232
- if (typeof window > "u" || B.current !== null)
279
+ [ie]
280
+ ), m = r(() => {
281
+ x(be());
282
+ }, [be, x]), h = r(() => {
283
+ typeof window > "u" || q.current === null || (window.cancelAnimationFrame(q.current), q.current = null);
284
+ }, []), ft = r(() => {
285
+ if (typeof window > "u" || q.current !== null)
233
286
  return;
234
287
  const e = () => {
235
- i();
236
- const r = y.current;
237
- if (!r || r.paused || r.ended) {
238
- B.current = null;
288
+ m();
289
+ const t = _.current;
290
+ if (!t || t.paused || t.ended) {
291
+ q.current = null;
239
292
  return;
240
293
  }
241
- B.current = window.requestAnimationFrame(e);
294
+ q.current = window.requestAnimationFrame(e);
242
295
  };
243
- B.current = window.requestAnimationFrame(e);
244
- }, [i]), D = t(() => {
245
- const e = y.current;
246
- e && (p(), s.current = !1, b.current = !1, re.current = !1, U.current = null, S.current = null, _.current = !1, E.current = !1, q.current = null, e.pause(), e.removeAttribute("src"), e.load(), P.current = null, R.current = 0, o.current = null, w(0), f(!1), u(!1));
247
- }, [w, p, u]), L = t(
296
+ q.current = window.requestAnimationFrame(e);
297
+ }, [m]), G = r(() => {
298
+ const e = _.current;
299
+ e && (h(), l.current = !1, b.current = !1, ue.current = !1, U.current = null, S.current = null, A.current = !1, C.current = !1, Z.current = null, e.pause(), e.removeAttribute("src"), e.load(), E.current = null, K.current = 0, f.current = null, x(0), d(!1), u(!1));
300
+ }, [x, h, u]), M = r(
248
301
  (e) => {
249
- const r = y.current;
250
- if (!r)
302
+ const t = _.current;
303
+ if (!t)
251
304
  return !1;
252
- const a = r.play();
253
- return a && typeof a.then == "function" && a.then(() => {
254
- F.current === "unknown" && (F.current = "auto"), s.current = !1, E.current = !1;
255
- }).catch((x) => {
256
- F.current === "unknown" && Xe(x) && (F.current = "blocked", s.current = !1, u(!1)), E.current = !1, f(!1);
305
+ const s = t.play();
306
+ return s && typeof s.then == "function" && s.then(() => {
307
+ W.current === "unknown" && (W.current = "auto"), l.current = !1, C.current = !1;
308
+ }).catch((i) => {
309
+ W.current === "unknown" && at(i) && (W.current = "blocked", l.current = !1, u(!1)), C.current = !1, d(!1);
257
310
  }), !0;
258
311
  },
259
- [Xe, u]
260
- ), C = t(
261
- (e, r) => {
262
- const a = y.current, x = v.current[e];
263
- if (!a || !x)
312
+ [at, u]
313
+ ), v = r(
314
+ (e, t, s = {}) => {
315
+ const i = _.current, p = j.current[e];
316
+ if (!i || !p)
264
317
  return !1;
265
- const A = Ge(x.audio_data);
266
- R.current = e, o.current = null, _.current = !1, E.current = !0, q.current = "segment", w(Z(e));
267
- const de = W();
268
- s.current = de, u(!1);
269
- const jr = P.current !== A;
270
- return U.current = "segment", jr && (a.pause(), a.removeAttribute("src"), a.load(), P.current = A, a.src = A, a.load()), S.current = 0, a.readyState > 0 && (a.currentTime = 0, S.current = null), de ? L(`start-segment:${r}`) : (s.current = !1, E.current = !1, a.pause(), f(!1), !0);
318
+ const J = it(p.audio_data), ge = Math.max(
319
+ Number(s.seekTimeSeconds ?? 0),
320
+ 0
321
+ );
322
+ K.current = e, f.current = null, A.current = !1, C.current = !0, Z.current = "segment", x(
323
+ I(e) + ge * 1e3
324
+ );
325
+ const yt = s.shouldResume ?? V();
326
+ l.current = yt, u(!1);
327
+ const Jt = E.current !== J;
328
+ return U.current = "segment", Jt && (i.pause(), i.removeAttribute("src"), i.load(), E.current = J, i.src = J, i.load()), S.current = ge, i.readyState > 0 && (i.currentTime = ge, S.current = null), yt ? M(`start-segment:${t}`) : (l.current = !1, C.current = !1, i.pause(), d(!1), !0);
271
329
  },
272
330
  [
273
- W,
274
- Ge,
275
- Z,
276
- w,
277
- L,
331
+ V,
332
+ it,
333
+ I,
334
+ x,
335
+ M,
278
336
  u
279
337
  ]
280
- ), X = t(
338
+ ), dt = r(
281
339
  (e) => {
282
- p(), s.current = !1, _.current = !1, E.current = !1, i(), f(!1), u(!1), h >= 0 && je?.(h);
340
+ const t = _.current;
341
+ if (!t || !o || T)
342
+ return !1;
343
+ const s = Math.max(Number(e), 0), i = !t.paused && !t.ended || l.current || C.current || f.current !== null && ne.current && !b.current, p = gt(
344
+ j.current,
345
+ s
346
+ ) ? lr(
347
+ j.current,
348
+ s
349
+ ) : null;
350
+ if (pe.current = null, h(), l.current = i, u(!1), i && (W.current = "manual", b.current = !1, B(!0)), p && (U.current === "segment" || !g))
351
+ return v(
352
+ p.segmentIndex,
353
+ "subtitle-seek-segment",
354
+ {
355
+ seekTimeSeconds: p.segmentTimeSeconds,
356
+ shouldResume: i
357
+ }
358
+ );
359
+ if (g) {
360
+ const J = s / 1e3;
361
+ return E.current !== g && (t.pause(), t.removeAttribute("src"), t.load(), E.current = g, U.current = "url", Z.current = "url", t.src = g, t.load()), S.current = J, x(s), t.readyState > 0 && (t.currentTime = J, S.current = null), i ? M("subtitle-seek-url") : (l.current = !1, t.pause(), d(!1), !0);
362
+ }
363
+ return !1;
283
364
  },
284
365
  [
366
+ o,
367
+ g,
368
+ T,
369
+ x,
370
+ v,
285
371
  h,
286
- je,
287
- p,
288
- i,
372
+ M,
373
+ u,
374
+ B
375
+ ]
376
+ ), ae = r(
377
+ (e) => {
378
+ const t = le(
379
+ e,
380
+ be()
381
+ );
382
+ return t === null ? !1 : dt(t);
383
+ },
384
+ [
385
+ be,
386
+ le,
387
+ dt
388
+ ]
389
+ ), Q = r(
390
+ (e) => {
391
+ h(), l.current = !1, A.current = !1, C.current = !1, m(), d(!1), u(!1), k >= 0 && Ue?.(k);
392
+ },
393
+ [
394
+ k,
395
+ Ue,
396
+ h,
397
+ m,
289
398
  u
290
399
  ]
291
- ), fe = t(
400
+ ), Se = r(
292
401
  (e) => {
293
- const r = y.current;
294
- return !r || U.current !== "url" || !Pr({
295
- currentTimeSeconds: Math.max(r.currentTime, 0),
296
- durationSeconds: r.duration
297
- }) ? !1 : (s.current = !1, r.pause(), X(e), !0);
402
+ const t = _.current;
403
+ return !t || U.current !== "url" || !Dt({
404
+ currentTimeSeconds: Math.max(t.currentTime, 0),
405
+ durationSeconds: t.duration
406
+ }) ? !1 : (l.current = !1, t.pause(), Q(e), !0);
298
407
  },
299
- [X]
300
- ), er = t(() => {
301
- const e = R.current + 1, r = v.current, a = r[e], x = le.current, A = r.some((de) => de.is_final);
302
- if (a) {
303
- C(e, "ended");
408
+ [Q]
409
+ ), mt = r(() => {
410
+ const e = K.current + 1, t = j.current, s = t[e], i = de.current, p = t.some((J) => J.is_final);
411
+ if (s) {
412
+ v(e, "ended");
304
413
  return;
305
414
  }
306
- if (x?.isAudioStreaming || !A) {
307
- R.current = e, o.current = e, _.current = !0, s.current = g, w(Z(e)), f(!1), u(!0, "waitingForMoreAudio");
415
+ if (i?.isAudioStreaming || !p) {
416
+ K.current = e, f.current = e, A.current = !0, l.current = L, x(I(e)), d(!1), u(!0, "waitingForMoreAudio");
308
417
  return;
309
418
  }
310
- X("segments-completed");
419
+ Q("segments-completed");
311
420
  }, [
312
- g,
313
- X,
314
- Z,
315
- w,
316
- C,
421
+ L,
422
+ Q,
423
+ I,
424
+ x,
425
+ v,
317
426
  u
318
427
  ]);
319
- m(() => {
320
- if (Ue.current === ge)
428
+ y(() => {
429
+ if ($e.current === Le)
321
430
  return;
322
- Ue.current = ge, R.current = 0, o.current = null, _.current = !1, b.current = !1, re.current = !1, s.current = !1, E.current = !1, U.current = null, q.current = null, P.current = null, p(), w(0), u(!1);
323
- const e = y.current;
324
- e && (e.pause(), e.removeAttribute("src"), e.load(), f(!1));
431
+ $e.current = Le, K.current = 0, f.current = null, A.current = !1, b.current = !1, ue.current = !1, l.current = !1, C.current = !1, U.current = null, Z.current = null, E.current = null, h(), x(0), u(!1);
432
+ const e = _.current;
433
+ e && (e.pause(), e.removeAttribute("src"), e.load(), d(!1));
325
434
  }, [
435
+ k,
436
+ Le,
437
+ w.length,
438
+ g,
439
+ x,
326
440
  h,
327
- ge,
328
- M.length,
329
- H,
330
- w,
331
- p,
332
441
  u
333
- ]), m(() => {
334
- const e = y.current;
442
+ ]), y(() => {
443
+ const e = _.current;
335
444
  if (e) {
336
- if (K) {
337
- re.current = !!(le.current && !b.current && (!e.paused || s.current || o.current !== null)), s.current = !1, u(!1), e.pause(), f(!1);
445
+ if (T) {
446
+ ue.current = !!(de.current && !b.current && (!e.paused || l.current || f.current !== null)), l.current = !1, u(!1), e.pause(), d(!1);
338
447
  return;
339
448
  }
340
- if (!(!re.current || !le.current || b.current)) {
341
- if (re.current = !1, o.current !== null) {
342
- if (o.current < v.current.length) {
343
- C(o.current, "external-resume");
449
+ if (!(!ue.current || !de.current || b.current)) {
450
+ if (ue.current = !1, f.current !== null) {
451
+ if (f.current < j.current.length) {
452
+ v(f.current, "external-resume");
344
453
  return;
345
454
  }
346
- s.current = !0, u(!0, "waitingForMoreAudio");
455
+ l.current = !0, u(!0, "waitingForMoreAudio");
347
456
  return;
348
457
  }
349
- if (!P.current && v.current.length > 0) {
350
- C(
458
+ if (!E.current && j.current.length > 0) {
459
+ v(
351
460
  Math.min(
352
- R.current,
353
- v.current.length - 1
461
+ K.current,
462
+ j.current.length - 1
354
463
  ),
355
464
  "external-resume-init"
356
465
  );
357
466
  return;
358
467
  }
359
- e.paused && (s.current = !0, L("external-resume"));
468
+ e.paused && (l.current = !0, M("external-resume"));
360
469
  }
361
470
  }
362
471
  }, [
363
- K,
364
- C,
365
- L,
472
+ T,
473
+ v,
474
+ M,
366
475
  u
367
- ]), m(() => {
368
- const e = y.current;
476
+ ]), y(() => {
477
+ const e = _.current;
369
478
  if (!e)
370
479
  return;
371
- if (!d) {
372
- D();
480
+ if (!o) {
481
+ G();
373
482
  return;
374
483
  }
375
- if (K) {
376
- s.current = !1, u(!1), e.pause(), f(!1);
484
+ if (T) {
485
+ l.current = !1, u(!1), e.pause(), d(!1);
377
486
  return;
378
487
  }
379
- const r = Hr({
488
+ const t = nr({
380
489
  activeSourceType: U.current,
381
- hasAudioUrl: !!H,
382
- segmentCount: M.length,
383
- preferredSourceType: q.current,
384
- waitingSegmentIndex: o.current
490
+ hasAudioUrl: !!g,
491
+ segmentCount: w.length,
492
+ preferredSourceType: Z.current,
493
+ waitingSegmentIndex: f.current
385
494
  });
386
- if (r && q.current !== r && (q.current = r), r === "url" && H) {
387
- const a = P.current !== H, x = W();
388
- if (a) {
389
- const A = o.current !== null ? Je() : 0;
390
- e.pause(), e.removeAttribute("src"), e.load(), P.current = H, U.current = "url", e.src = H, e.load(), S.current = A, w(A * 1e3), e.readyState > 0 && (e.currentTime = A, S.current = null);
495
+ if (t && Z.current !== t && (Z.current = t), t === "url" && g) {
496
+ const s = E.current !== g, i = V();
497
+ if (s) {
498
+ const p = f.current !== null ? ct() : 0;
499
+ e.pause(), e.removeAttribute("src"), e.load(), E.current = g, U.current = "url", e.src = g, e.load(), S.current = p, x(p * 1e3), e.readyState > 0 && (e.currentTime = p, S.current = null);
391
500
  }
392
- if (s.current = x, _.current = !1, E.current = !1, u(!1), !x) {
393
- s.current = !1, e.pause(), f(!1);
501
+ if (l.current = i, A.current = !1, C.current = !1, u(!1), !i) {
502
+ l.current = !1, e.pause(), d(!1);
394
503
  return;
395
504
  }
396
- L(a ? "sync-url-init" : "sync-url");
505
+ M(s ? "sync-url-init" : "sync-url");
397
506
  return;
398
507
  }
399
- if (r === "segment" && o.current !== null) {
400
- if (o.current < M.length) {
508
+ if (t === "segment" && f.current !== null) {
509
+ if (f.current < w.length) {
401
510
  if (b.current) {
402
- f(!1), u(!1);
511
+ d(!1), u(!1);
403
512
  return;
404
513
  }
405
- C(o.current, "wait-resume");
514
+ v(f.current, "wait-resume");
406
515
  return;
407
516
  }
408
- _.current = !0, s.current = W(), f(!1), u(W());
517
+ A.current = !0, l.current = V(), d(!1), u(V());
409
518
  return;
410
519
  }
411
- if (r === "segment" && !M.length) {
412
- if (d.isAudioStreaming) {
413
- o.current = R.current, _.current = !0, s.current = W(), f(!1), u(W());
520
+ if (t === "segment" && !w.length) {
521
+ if (o.isAudioStreaming) {
522
+ f.current = K.current, A.current = !0, l.current = V(), d(!1), u(V());
414
523
  return;
415
524
  }
416
- D();
525
+ G();
417
526
  return;
418
527
  }
419
- if (r === "segment" && !P.current) {
420
- C(
528
+ if (t === "segment" && !E.current) {
529
+ v(
421
530
  Math.min(
422
- R.current,
423
- M.length - 1
531
+ K.current,
532
+ w.length - 1
424
533
  ),
425
534
  "effect-init"
426
535
  );
427
536
  return;
428
537
  }
429
- if (r !== "segment") {
430
- D();
538
+ if (t !== "segment") {
539
+ G();
431
540
  return;
432
541
  }
433
- if (!g || b.current) {
434
- s.current = !1, e.pause(), f(!1);
542
+ if (!L || b.current) {
543
+ l.current = !1, e.pause(), d(!1);
435
544
  return;
436
545
  }
437
- e.paused && (s.current = !0, L("sync-paused-retry"));
546
+ e.paused && (l.current = !0, M("sync-paused-retry"));
438
547
  }, [
439
- d,
440
- h,
441
- M,
442
- H,
443
- g,
444
- K,
445
- W,
548
+ o,
549
+ k,
446
550
  w,
447
- D,
448
- C,
551
+ g,
449
552
  L,
450
- Je,
553
+ T,
554
+ V,
555
+ x,
556
+ G,
557
+ v,
558
+ M,
559
+ ct,
451
560
  u
452
- ]), m(() => D, [D]), m(() => p, [p]);
453
- const br = t(() => {
454
- i(), Ie(), f(!0), u(!1), Me?.();
561
+ ]), y(() => G, [G]), y(() => h, [h]);
562
+ const Nt = r(() => {
563
+ m(), ft(), d(!0), u(!1), Ne?.();
455
564
  }, [
456
- Me,
457
- Ie,
458
- i,
565
+ Ne,
566
+ ft,
567
+ m,
459
568
  u
460
- ]), Sr = t(() => {
461
- _.current || E.current || (p(), i(), f(!1));
462
- }, [h, p, i]), gr = t(() => {
463
- const e = y.current;
464
- e && S.current !== null && (e.currentTime = S.current, S.current = null), i(), !fe("canplay-seek-finished") && (!s.current || !g || L("canplay"));
569
+ ]), Et = r(() => {
570
+ A.current || C.current || (h(), m(), d(!1));
571
+ }, [k, h, m]), Kt = r(() => {
572
+ const e = _.current;
573
+ e && S.current !== null && (e.currentTime = S.current, S.current = null), m(), !Se("canplay-seek-finished") && (!l.current || !L || M("canplay"));
465
574
  }, [
466
- h,
467
- g,
468
- fe,
469
- i,
470
- L
471
- ]), _r = t(() => {
472
- const e = y.current;
473
- e && S.current !== null && (e.currentTime = S.current, S.current = null), i(), fe("metadata-seek-finished");
474
- }, [h, fe, i]), wr = t(() => {
475
- i();
476
- }, [i]), xr = t(() => {
477
- _.current || u(!0, "loadingAudio");
478
- }, [u]), kr = t(() => {
479
- if (_.current) {
575
+ k,
576
+ L,
577
+ Se,
578
+ m,
579
+ M
580
+ ]), Ut = r(() => {
581
+ const e = _.current;
582
+ e && S.current !== null && (e.currentTime = S.current, S.current = null), m(), Se("metadata-seek-finished");
583
+ }, [k, Se, m]), Ft = r(() => {
584
+ m();
585
+ }, [m]), Wt = r(() => {
586
+ A.current || u(!0, "loadingAudio");
587
+ }, [u]), Pt = r(() => {
588
+ if (A.current) {
480
589
  u(!0, "waitingForMoreAudio");
481
590
  return;
482
591
  }
483
592
  u(!0, "loadingAudio");
484
- }, [u]), rr = t(() => {
485
- i();
486
- }, [i]), Mr = t(() => {
487
- const e = U.current === "url" || v.current.length === 0;
488
- if (p(), E.current = !1, e) {
489
- X("url-ended");
593
+ }, [u]), pt = r(() => {
594
+ m();
595
+ }, [m]), Bt = r(() => {
596
+ const e = U.current === "url" || j.current.length === 0;
597
+ if (h(), C.current = !1, e) {
598
+ Q("url-ended");
490
599
  return;
491
600
  }
492
- er();
493
- }, [X, er, p]), Lr = t(() => {
494
- p(), i(), f(!1), u(!1);
495
- }, [p, i, u]), Ar = t(
601
+ mt();
602
+ }, [Q, mt, h]), Ot = r(() => {
603
+ h(), m(), d(!1), u(!1);
604
+ }, [h, m, u]), Vt = r(
496
605
  (e) => {
497
- Ae?.(e), z(!1);
606
+ Ke?.(e), D(!1);
498
607
  },
499
- [Ae]
500
- ), _e = t(() => {
501
- if (N) {
502
- const r = !O;
503
- return $(r), Re?.(r), !0;
608
+ [Ke]
609
+ ), Ae = r(() => {
610
+ if (F) {
611
+ const t = !$;
612
+ return B(t), Fe?.(t), !0;
504
613
  }
505
- const e = y.current;
506
- return K || !e || !d ? !1 : o.current !== null ? oe ? ($(!1), s.current = !1, b.current = !0, o.current = null, _.current = !1, f(!1), u(!1), e.pause(), !0) : ($(!0), F.current = "manual", b.current = !1, s.current = !0, u(!0, "waitingForMoreAudio"), !0) : !e.src && M.length > 0 ? ($(!0), F.current = "manual", b.current = !1, C(
614
+ const e = _.current;
615
+ return T || !e || !o ? !1 : f.current !== null ? he ? (B(!1), l.current = !1, b.current = !0, f.current = null, A.current = !1, d(!1), u(!1), e.pause(), !0) : (B(!0), W.current = "manual", b.current = !1, l.current = !0, u(!0, "waitingForMoreAudio"), !0) : !e.src && w.length > 0 ? (B(!0), W.current = "manual", b.current = !1, v(
507
616
  Math.min(
508
- R.current,
509
- M.length - 1
617
+ K.current,
618
+ w.length - 1
510
619
  ),
511
620
  "toggle"
512
- ), !0) : e.paused ? ($(!0), F.current = "manual", b.current = !1, s.current = !0, L("toggle-resume"), !0) : ($(!1), s.current = !1, b.current = !0, e.pause(), !0);
621
+ ), !0) : e.paused ? (B(!0), W.current = "manual", b.current = !1, l.current = !0, M("toggle-resume"), !0) : (B(!1), l.current = !1, b.current = !0, e.pause(), !0);
513
622
  }, [
514
- d,
515
- M.length,
516
- O,
517
- K,
518
- oe,
519
- Re,
520
- C,
521
- L,
522
- u,
623
+ o,
624
+ w.length,
523
625
  $,
524
- N
626
+ T,
627
+ he,
628
+ Fe,
629
+ v,
630
+ M,
631
+ u,
632
+ B,
633
+ F
525
634
  ]);
526
- m(() => {
527
- if (T)
528
- return Wr(V);
529
- }, [V, T]);
530
- const we = G(
635
+ y(() => {
636
+ if (P)
637
+ return Qt(z);
638
+ }, [z, P]);
639
+ const ve = Y(
531
640
  () => ({
532
- fullscreen: () => I ? (I(), !0) : !1,
533
- interaction: () => se ? (me && se(), !0) : !1,
534
- next: () => ae ? (ye || ae(
535
- ar(te())
641
+ fullscreen: () => te ? (te(), !0) : !1,
642
+ interaction: () => fe ? (_e && fe(), !0) : !1,
643
+ next: () => oe ? (we || oe(
644
+ St(se())
536
645
  ), !0) : !1,
537
- previous: () => ue ? (he || ue(
538
- ar(te())
646
+ nextSubtitle: () => X.next ? ae("next") : !0,
647
+ previous: () => ce ? (ke || ce(
648
+ St(se())
539
649
  ), !0) : !1,
540
- subtitle: () => Q ? (Q(), !0) : !1,
541
- togglePlayback: () => (_e(), !0)
650
+ previousSubtitle: () => X.previous ? ae("previous") : !0,
651
+ subtitle: () => ee ? (ee(), !0) : !1,
652
+ togglePlayback: () => (Ae(), !0)
542
653
  }),
543
654
  [
544
- te,
545
- me,
546
- ye,
547
- I,
548
655
  se,
656
+ _e,
549
657
  ae,
550
- ue,
551
- Q,
552
- he,
553
- _e
658
+ we,
659
+ te,
660
+ fe,
661
+ oe,
662
+ ce,
663
+ ee,
664
+ ke,
665
+ X.next,
666
+ X.previous,
667
+ Ae
554
668
  ]
555
- ), tr = c(we);
556
- return m(() => {
557
- tr.current = we;
558
- }, [we]), m(() => {
559
- if (!T || typeof document > "u")
669
+ ), ht = c(ve);
670
+ return y(() => {
671
+ ht.current = ve;
672
+ }, [ve]), y(() => {
673
+ if (!P || typeof document > "u")
560
674
  return;
561
- const e = (r) => {
562
- if (!Or(V))
675
+ const e = (t) => {
676
+ if (!er(z))
563
677
  return;
564
- const a = Br(r);
565
- if (!a || Vr(r, a))
678
+ const s = tr(t);
679
+ if (!s || rr(t, s))
566
680
  return;
567
- let x = !1;
568
- const A = tr.current[a];
569
- x = A(), x && r.preventDefault();
681
+ let i = !1;
682
+ const p = ht.current[s];
683
+ i = p(), i && t.preventDefault();
570
684
  };
571
685
  return document.addEventListener("keydown", e), () => {
572
686
  document.removeEventListener("keydown", e);
573
687
  };
574
- }, [V, T]), m(() => {
575
- ne?.(Se.current);
576
- }, [ne]), /* @__PURE__ */ n.jsxs(
688
+ }, [z, P]), y(() => {
689
+ ie?.(me.current);
690
+ }, [ie]), /* @__PURE__ */ n.jsxs(
577
691
  "div",
578
692
  {
579
- ...fr,
580
- "data-slide-player-shortcut-owner": V,
581
- className: ur("slide-player", j),
582
- onFocusCapture: yr,
583
- onPointerDown: hr,
693
+ ...Lt,
694
+ "data-slide-player-shortcut-owner": z,
695
+ className: bt("slide-player", N),
696
+ onFocusCapture: Ct,
697
+ onPointerDown: jt,
584
698
  children: [
585
699
  /* @__PURE__ */ n.jsx(
586
700
  "audio",
587
701
  {
588
- ref: y,
702
+ ref: _,
589
703
  preload: "auto",
590
704
  playsInline: !0,
591
- onLoadStart: xr,
592
- onLoadedMetadata: _r,
593
- onCanPlay: gr,
594
- onPlay: br,
595
- onPause: Sr,
596
- onWaiting: kr,
597
- onSeeking: rr,
598
- onSeeked: rr,
599
- onTimeUpdate: wr,
600
- onEnded: Mr,
601
- onError: Lr
705
+ onLoadStart: Wt,
706
+ onLoadedMetadata: Ut,
707
+ onCanPlay: Kt,
708
+ onPlay: Nt,
709
+ onPause: Et,
710
+ onWaiting: Pt,
711
+ onSeeking: pt,
712
+ onSeeked: pt,
713
+ onTimeUpdate: Ft,
714
+ onEnded: Bt,
715
+ onError: Ot
602
716
  }
603
717
  ),
604
- be ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
718
+ Me ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
605
719
  /* @__PURE__ */ n.jsx(
606
- vr,
720
+ zt,
607
721
  {
608
- container: or,
722
+ container: wt,
609
723
  labels: {
610
- closeSettings: l.closeSettingsLabel,
611
- fullscreen: l.fullscreenLabel,
612
- nonFullscreen: l.nonFullscreenLabel,
613
- screen: l.screenLabel,
614
- screenMode: l.screenModeLabel,
615
- subtitle: l.subtitleLabel,
616
- subtitleToggle: l.subtitleToggleAriaLabel,
617
- title: l.settingsTitle
724
+ closeSettings: a.closeSettingsLabel,
725
+ fullscreen: a.fullscreenLabel,
726
+ nonFullscreen: a.nonFullscreenLabel,
727
+ screen: a.screenLabel,
728
+ screenMode: a.screenModeLabel,
729
+ subtitle: a.subtitleLabel,
730
+ subtitleToggle: a.subtitleToggleAriaLabel,
731
+ title: a.settingsTitle
618
732
  },
619
- isSubtitleEnabled: pe,
620
- onClose: () => z(!1),
621
- onOpenChange: z,
622
- onSubtitleToggle: Q ?? (() => {
733
+ isSubtitleEnabled: xe,
734
+ onClose: () => D(!1),
735
+ onOpenChange: D,
736
+ onSubtitleToggle: ee ?? (() => {
623
737
  }),
624
- onViewModeChange: Ar,
625
- open: We,
626
- viewMode: cr
738
+ onViewModeChange: Vt,
739
+ open: ze,
740
+ viewMode: kt
627
741
  }
628
742
  ),
629
- /* @__PURE__ */ n.jsxs("div", { className: "slide-player__controls", style: mr, children: [
743
+ /* @__PURE__ */ n.jsxs("div", { className: "slide-player__controls", style: vt, children: [
630
744
  /* @__PURE__ */ n.jsxs("div", { className: "slide-player__group", children: [
631
745
  /* @__PURE__ */ n.jsx(
632
746
  "button",
633
747
  {
634
- "aria-expanded": We,
748
+ "aria-expanded": ze,
635
749
  "aria-haspopup": "dialog",
636
- "aria-label": l.moreOptionsAriaLabel,
750
+ "aria-label": a.moreOptionsAriaLabel,
637
751
  className: "slide-player__action slide-player__action--mobile-more",
638
752
  onClick: () => {
639
- z((e) => !e);
753
+ D((e) => !e);
640
754
  },
641
755
  type: "button",
642
756
  children: /* @__PURE__ */ n.jsx(
643
- qr,
757
+ ir,
644
758
  {
645
759
  className: "slide-player__icon",
646
760
  strokeWidth: 2.25
@@ -651,24 +765,24 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
651
765
  /* @__PURE__ */ n.jsx(
652
766
  "button",
653
767
  {
654
- "aria-label": l.volumeAriaLabel,
768
+ "aria-label": a.volumeAriaLabel,
655
769
  className: "hidden",
656
770
  type: "button",
657
- children: /* @__PURE__ */ n.jsx(zr, { className: "slide-player__icon", strokeWidth: 2.25 })
771
+ children: /* @__PURE__ */ n.jsx(cr, { className: "slide-player__icon", strokeWidth: 2.25 })
658
772
  }
659
773
  ),
660
774
  /* @__PURE__ */ n.jsx(
661
775
  "button",
662
776
  {
663
- "aria-label": l.subtitleToggleAriaLabel,
664
- "aria-keyshortcuts": $e.ariaKeyShortcuts,
665
- "aria-pressed": pe,
777
+ "aria-label": a.subtitleToggleAriaLabel,
778
+ "aria-keyshortcuts": Qe.ariaKeyShortcuts,
779
+ "aria-pressed": xe,
666
780
  className: "slide-player__action slide-player__action--subtitle",
667
- onClick: Q,
668
- title: $e.title,
781
+ onClick: ee,
782
+ title: Qe.title,
669
783
  type: "button",
670
- children: pe ? /* @__PURE__ */ n.jsx(Yr, { className: "slide-player__icon", strokeWidth: 2.25 }) : /* @__PURE__ */ n.jsx(
671
- Dr,
784
+ children: xe ? /* @__PURE__ */ n.jsx(or, { className: "slide-player__icon", strokeWidth: 2.25 }) : /* @__PURE__ */ n.jsx(
785
+ fr,
672
786
  {
673
787
  className: "slide-player__icon",
674
788
  strokeWidth: 2.25
@@ -679,64 +793,100 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
679
793
  /* @__PURE__ */ n.jsx(
680
794
  "button",
681
795
  {
682
- "aria-keyshortcuts": Ze.ariaKeyShortcuts,
683
- "aria-label": l.previousLabel,
796
+ "aria-keyshortcuts": tt.ariaKeyShortcuts,
797
+ "aria-label": a.previousSubtitleLabel,
798
+ className: "slide-player__action slide-player__action--prev-subtitle",
799
+ disabled: !X.previous,
800
+ onClick: () => {
801
+ ae("previous");
802
+ },
803
+ title: tt.title,
804
+ type: "button",
805
+ children: /* @__PURE__ */ n.jsx(dr, { className: "slide-player__icon", strokeWidth: 2.25 })
806
+ }
807
+ ),
808
+ /* @__PURE__ */ n.jsx(
809
+ "button",
810
+ {
811
+ "aria-keyshortcuts": et.ariaKeyShortcuts,
812
+ "aria-label": a.previousLabel,
684
813
  className: "slide-player__action slide-player__action--prev",
685
- disabled: he,
814
+ disabled: ke,
686
815
  onClick: () => {
687
- ue?.(te());
816
+ ce?.(se());
688
817
  },
689
- title: Ze.title,
818
+ title: et.title,
690
819
  type: "button",
691
- children: /* @__PURE__ */ n.jsx(Xr, { className: "slide-player__icon", strokeWidth: 2.25 })
820
+ children: /* @__PURE__ */ n.jsx(mr, { className: "slide-player__icon", strokeWidth: 2.25 })
692
821
  }
693
822
  ),
694
823
  /* @__PURE__ */ n.jsx(
695
824
  "button",
696
825
  {
697
- "aria-label": Ve,
698
- "aria-keyshortcuts": qe.ariaKeyShortcuts,
826
+ "aria-label": Xe,
827
+ "aria-keyshortcuts": rt.ariaKeyShortcuts,
699
828
  className: "slide-player__toggle slide-player__toggle--playback",
700
829
  onClick: () => {
701
- _e();
830
+ Ae();
702
831
  },
703
- title: qe.title,
832
+ title: rt.title,
704
833
  type: "button",
705
- children: pr ? /* @__PURE__ */ n.jsx(et, {}) : /* @__PURE__ */ n.jsx(rt, {})
834
+ children: Rt ? /* @__PURE__ */ n.jsx(gr, {}) : /* @__PURE__ */ n.jsx(_r, {})
706
835
  }
707
836
  ),
708
837
  /* @__PURE__ */ n.jsx(
709
838
  "button",
710
839
  {
711
- "aria-keyshortcuts": ze.ariaKeyShortcuts,
712
- "aria-label": l.nextLabel,
840
+ "aria-keyshortcuts": nt.ariaKeyShortcuts,
841
+ "aria-label": a.nextLabel,
713
842
  className: "slide-player__action slide-player__action--next",
714
- disabled: ye,
843
+ disabled: we,
715
844
  onClick: () => {
716
- ae?.(te());
845
+ oe?.(se());
717
846
  },
718
- title: ze.title,
847
+ title: nt.title,
719
848
  type: "button",
720
- children: /* @__PURE__ */ n.jsx(Gr, { className: "slide-player__icon", strokeWidth: 2.25 })
849
+ children: /* @__PURE__ */ n.jsx(pr, { className: "slide-player__icon", strokeWidth: 2.25 })
850
+ }
851
+ ),
852
+ /* @__PURE__ */ n.jsx(
853
+ "button",
854
+ {
855
+ "aria-keyshortcuts": ut.ariaKeyShortcuts,
856
+ "aria-label": a.nextSubtitleLabel,
857
+ className: "slide-player__action slide-player__action--next-subtitle",
858
+ disabled: !X.next,
859
+ onClick: () => {
860
+ ae("next");
861
+ },
862
+ title: ut.title,
863
+ type: "button",
864
+ children: /* @__PURE__ */ n.jsx(
865
+ hr,
866
+ {
867
+ className: "slide-player__icon",
868
+ strokeWidth: 2.25
869
+ }
870
+ )
721
871
  }
722
872
  ),
723
- I ? /* @__PURE__ */ n.jsx(
873
+ te ? /* @__PURE__ */ n.jsx(
724
874
  "button",
725
875
  {
726
- "aria-label": He,
727
- "aria-keyshortcuts": Ye.ariaKeyShortcuts,
876
+ "aria-label": Ge,
877
+ "aria-keyshortcuts": st.ariaKeyShortcuts,
728
878
  className: "slide-player__action slide-player__action--fullscreen",
729
- onClick: I,
730
- title: Ye.title,
879
+ onClick: te,
880
+ title: st.title,
731
881
  type: "button",
732
- children: Le ? /* @__PURE__ */ n.jsx(
733
- Jr,
882
+ children: Ee ? /* @__PURE__ */ n.jsx(
883
+ yr,
734
884
  {
735
885
  className: "slide-player__icon",
736
886
  strokeWidth: 2.25
737
887
  }
738
888
  ) : /* @__PURE__ */ n.jsx(
739
- Qr,
889
+ br,
740
890
  {
741
891
  className: "slide-player__icon",
742
892
  strokeWidth: 2.25
@@ -747,22 +897,22 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
747
897
  ] }),
748
898
  /* @__PURE__ */ n.jsx("div", { className: "slide-player__separator" }),
749
899
  /* @__PURE__ */ n.jsxs("div", { className: "slide-player__group", children: [
750
- Oe.map((e, r) => /* @__PURE__ */ n.jsx(Rr.Fragment, { children: e }, `custom-action-${r}`)),
900
+ Ye.map((e, t) => /* @__PURE__ */ n.jsx(Ht.Fragment, { children: e }, `custom-action-${t}`)),
751
901
  /* @__PURE__ */ n.jsx(
752
902
  "button",
753
903
  {
754
- "aria-label": l.notesLabel,
755
- "aria-keyshortcuts": De.ariaKeyShortcuts,
756
- className: ur(
904
+ "aria-label": a.notesLabel,
905
+ "aria-keyshortcuts": lt.ariaKeyShortcuts,
906
+ className: bt(
757
907
  "slide-player__action slide-player__action--notes",
758
- ee && "slide-player__action--active"
908
+ re && "slide-player__action--active"
759
909
  ),
760
- disabled: !me,
761
- onClick: se,
762
- title: De.title,
910
+ disabled: !_e,
911
+ onClick: fe,
912
+ title: lt.title,
763
913
  type: "button",
764
914
  children: /* @__PURE__ */ n.jsx(
765
- Ir,
915
+ Sr,
766
916
  {
767
917
  className: "slide-player__icon",
768
918
  strokeWidth: 2.25
@@ -776,9 +926,9 @@ const sr = /* @__PURE__ */ new Map(), lr = (k) => {
776
926
  ]
777
927
  }
778
928
  );
779
- }, ut = Er(nt);
780
- ut.displayName = "Player";
929
+ }, Mr = $t(wr);
930
+ Mr.displayName = "Player";
781
931
  export {
782
- ut as default
932
+ Mr as default
783
933
  };
784
934
  //# sourceMappingURL=Player.es.js.map