markdown-flow-ui 0.2.25-dev.2 → 0.2.25-dev.4

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,278 +1,273 @@
1
- import { jsxs as He, jsx as u, Fragment as qr } from "react/jsx-runtime";
2
- import { memo as Kr, useMemo as d, useId as Ur, useRef as m, useCallback as r, useState as p, useEffect as s, useLayoutEffect as Bn } from "react";
3
- import { isSandboxInteractionMessage as Hr } from "../../lib/sandboxInteraction.es.js";
4
- import { cn as be } from "../../lib/utils.es.js";
5
- import { useResolvedDirection as Yr } from "../../lib/useResolvedDirection.es.js";
6
- import { getMarkdownFlowDirection as Gr, getMarkdownFlowLanguage as $r } from "../../lib/locale.es.js";
7
- import zr from "../ui/loading-overlay-card.es.js";
8
- import Xr from "../ContentRender/ContentRender.es.js";
9
- import On from "../ContentRender/IframeSandbox.es.js";
1
+ import { jsxs as Ge, jsx as u, Fragment as Ur } from "react/jsx-runtime";
2
+ import { memo as Hr, useMemo as f, useId as Yr, useRef as m, useCallback as r, useState as p, useEffect as s, useLayoutEffect as Gr } from "react";
3
+ import { isSandboxInteractionMessage as $r } from "../../lib/sandboxInteraction.es.js";
4
+ import { cn as we } from "../../lib/utils.es.js";
5
+ import { useResolvedDirection as zr } from "../../lib/useResolvedDirection.es.js";
6
+ import { getMarkdownFlowDirection as Xr, getMarkdownFlowLanguage as Jr } from "../../lib/locale.es.js";
7
+ import Wr from "../ui/loading-overlay-card.es.js";
8
+ import jr from "../ContentRender/ContentRender.es.js";
9
+ import kn from "../ContentRender/IframeSandbox.es.js";
10
10
  import "../ui/inputGroup/input-group.es.js";
11
- import { isMobileDevice as Jr, isLandscapeViewport as Mn, subscribeMobileDeviceChange as Wr } from "../../lib/mobileDevice.es.js";
12
- import jr from "./Player.es.js";
13
- import Qr from "./MarkdownSlideScaling.es.js";
14
- import Zr from "./SubtitleOverlay.es.js";
15
- import eo from "./useSlide.es.js";
16
- import to from "./useWakePlayerFromIframe.es.js";
17
- import { PlayerKeyboardShortcutContext as no } from "./utils/playerKeyboardShortcutContext.es.js";
18
- import { activatePlayerKeyboardShortcutOwner as ro } from "./utils/playerKeyboardShortcuts.es.js";
19
- import { DEFAULT_MOBILE_VIEW_MODE as gt, resolveMobileViewModeState as oo } from "./utils/mobileScreenMode.es.js";
20
- import { shouldRenderInteractionOverlay as io, clampInteractionOverlayDragOffset as kn, shouldPresentInteractionOverlay as lo } from "./utils/interactionPlayback.es.js";
21
- import { resolveMarkdownScalingMode as ao } from "./utils/markdownScaling.es.js";
22
- import { shouldWakePlayerControlsAfterNavigation as Ut } from "./utils/playerNavigationContext.es.js";
23
- import { shouldAutoAdvanceIntoAppendedMarker as so } from "./utils/appendedMarkerAdvance.es.js";
24
- import { resolveRequestedStepNavigation as co } from "./utils/requestedStepNavigation.es.js";
25
- import { resolvePendingStepAudioKey as uo, hasUnplayedStepAudio as fo } from "./utils/stepAudioProgress.es.js";
26
- import { getPlaybackSequenceTransition as mo, shouldStartDefaultAudioSequence as po } from "./utils/playbackSequence.es.js";
27
- import { hasResolvedInteractionElement as yo, canReachSubtitleJumpTarget as Fn } from "./utils/subtitleJumpNavigation.es.js";
28
- import { resolvePlayerCustomActionElement as ho, getPlayerCustomActionCount as go } from "./utils/playerCustomActions.es.js";
29
- import { createPlaybackTimeStore as vo } from "./utils/playbackTimeStore.es.js";
30
- import { resolveSlideInteractionState as So } from "./utils/interactionResolution.es.js";
31
- import { shouldUseAutoAdvanceToggle as Io } from "./utils/playerToggleMode.es.js";
32
- import { DEFAULT_IMAGE_ONLY_VISUAL_READY_TIMEOUT_MS as bo, areImageOnlyStepIframeVisualsReady as Ao } from "./utils/imageOnlyStepVisualReady.es.js";
33
- import { resolveSilentStepAutoAdvanceBehavior as wo } from "./utils/silentStepAutoAdvance.es.js";
34
- import { resolveSlidePlayerVisibility as xo, resolveSlidePlayerLayoutState as Eo } from "./utils/playerVisibility.es.js";
35
- import { getSlideLocaleTexts as Co, DEFAULT_SLIDE_BUFFERING_TEXTS as Po } from "./slideI18n.es.js";
11
+ import { isMobileDevice as Qr, isLandscapeViewport as Fn, subscribeMobileDeviceChange as Zr } from "../../lib/mobileDevice.es.js";
12
+ import eo from "./Player.es.js";
13
+ import to from "./MarkdownSlideScaling.es.js";
14
+ import no from "./SubtitleOverlay.es.js";
15
+ import ro from "./useSlide.es.js";
16
+ import oo from "./useWakePlayerFromIframe.es.js";
17
+ import { PlayerKeyboardShortcutContext as io } from "./utils/playerKeyboardShortcutContext.es.js";
18
+ import { activatePlayerKeyboardShortcutOwner as lo } from "./utils/playerKeyboardShortcuts.es.js";
19
+ import { DEFAULT_MOBILE_VIEW_MODE as St, resolveMobileViewModeState as ao } from "./utils/mobileScreenMode.es.js";
20
+ import { shouldRenderInteractionOverlay as so, clampInteractionOverlayDragOffset as Ln, shouldPresentInteractionOverlay as co } from "./utils/interactionPlayback.es.js";
21
+ import { resolveMarkdownScalingMode as uo } from "./utils/markdownScaling.es.js";
22
+ import { shouldWakePlayerControlsAfterNavigation as Gt } from "./utils/playerNavigationContext.es.js";
23
+ import { shouldAutoAdvanceIntoAppendedMarker as fo } from "./utils/appendedMarkerAdvance.es.js";
24
+ import { resolvePendingStepAudioKey as mo, hasUnplayedStepAudio as po } from "./utils/stepAudioProgress.es.js";
25
+ import { getPlaybackSequenceTransition as yo, shouldStartDefaultAudioSequence as ho } from "./utils/playbackSequence.es.js";
26
+ import { hasResolvedInteractionElement as go, canReachSubtitleJumpTarget as Dn } from "./utils/subtitleJumpNavigation.es.js";
27
+ import { resolvePlayerCustomActionElement as vo, getPlayerCustomActionCount as So } from "./utils/playerCustomActions.es.js";
28
+ import { createPlaybackTimeStore as Io } from "./utils/playbackTimeStore.es.js";
29
+ import { resolveSlideInteractionState as bo } from "./utils/interactionResolution.es.js";
30
+ import { shouldUseAutoAdvanceToggle as Ao } from "./utils/playerToggleMode.es.js";
31
+ import { DEFAULT_IMAGE_ONLY_VISUAL_READY_TIMEOUT_MS as wo, areImageOnlyStepIframeVisualsReady as xo } from "./utils/imageOnlyStepVisualReady.es.js";
32
+ import { resolveSilentStepAutoAdvanceBehavior as Po } from "./utils/silentStepAutoAdvance.es.js";
33
+ import { resolveSlidePlayerVisibility as Co, resolveSlidePlayerLayoutState as Eo } from "./utils/playerVisibility.es.js";
34
+ import { getSlideLocaleTexts as To, DEFAULT_SLIDE_BUFFERING_TEXTS as Ro } from "./slideI18n.es.js";
36
35
  /* empty css */
37
- import Ht from "../../node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js";
38
- import To from "../../node_modules/lucide-react/dist/esm/icons/chevron-left.es.js";
39
- const Ro = 2e3, _o = 300, Oo = 160, Mo = 16, Ln = 3e3, vt = {
36
+ import $t from "../../node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js";
37
+ import _o from "../../node_modules/lucide-react/dist/esm/icons/chevron-left.es.js";
38
+ const Oo = 2e3, Mo = 300, ko = 160, Fo = 16, Nn = 3e3, It = {
40
39
  x: 0,
41
40
  y: 0
42
- }, Gt = 0.5, ko = typeof window > "u" ? s : Bn, Fo = [
41
+ }, Xt = 0.5, Lo = typeof window > "u" ? s : Gr, Do = [
43
42
  "button",
44
43
  "input",
45
44
  "textarea",
46
45
  '[contenteditable=""]',
47
46
  '[contenteditable="true"]',
48
47
  '[contenteditable="plaintext-only"]'
49
- ].join(", "), $t = "waitingForAudio", Lo = ({
48
+ ].join(", "), Jt = "waitingForAudio", No = ({
50
49
  x: c,
51
- y: f
50
+ y: d
52
51
  }) => ({
53
52
  x: Number(c.toFixed(2)),
54
- y: Number(f.toFixed(2))
55
- }), Nn = (c) => Math.abs(c) >= Gt, Dn = (c, f) => Math.abs(c.x - f.x) < Gt && Math.abs(c.y - f.y) < Gt, No = (c, f) => typeof c == "string" ? c : c[f] ?? c[$t] ?? Po[f], Do = (c, f) => typeof c == "string" ? c : {
56
- ...f,
53
+ y: Number(d.toFixed(2))
54
+ }), Bn = (c) => Math.abs(c) >= Xt, Vn = (c, d) => Math.abs(c.x - d.x) < Xt && Math.abs(c.y - d.y) < Xt, Bo = (c, d) => typeof c == "string" ? c : c[d] ?? c[Jt] ?? Ro[d], Vo = (c, d) => typeof c == "string" ? c : {
55
+ ...d,
57
56
  ...c
58
- }, Bo = (c, f) => f ? c !== "loadingAudio" : !1, Vn = Kr(
57
+ }, Ko = (c, d) => d ? c !== "loadingAudio" : !1, Kn = Hr(
59
58
  ({
60
59
  content: c,
61
- title: f,
62
- dragHandleAriaLabel: Y,
63
- locale: Ae,
64
- dir: G,
65
- lang: $,
66
- defaultButtonText: we,
67
- defaultInputText: ie,
68
- defaultSelectedValues: Ye,
69
- confirmButtonText: St,
70
- copyButtonText: z,
71
- copiedButtonText: It,
72
- onSend: xe,
73
- onDragHandlePointerCancel: Ge,
74
- onDragHandlePointerDown: $e,
75
- onDragHandlePointerMove: ze,
60
+ title: d,
61
+ dragHandleAriaLabel: G,
62
+ locale: xe,
63
+ dir: $,
64
+ lang: z,
65
+ defaultButtonText: Pe,
66
+ defaultInputText: ae,
67
+ defaultSelectedValues: $e,
68
+ confirmButtonText: bt,
69
+ copyButtonText: X,
70
+ copiedButtonText: At,
71
+ onSend: Ce,
72
+ onDragHandlePointerCancel: ze,
73
+ onDragHandlePointerDown: Xe,
74
+ onDragHandlePointerMove: Je,
76
75
  onDragHandlePointerUp: Ee,
77
- readonly: Xe = !1
78
- }) => /* @__PURE__ */ He("div", { className: "slide-player__interaction-card", children: [
76
+ readonly: We = !1
77
+ }) => /* @__PURE__ */ Ge("div", { className: "slide-player__interaction-card", children: [
79
78
  /* @__PURE__ */ u(
80
79
  "button",
81
80
  {
82
81
  type: "button",
83
82
  className: "slide-player__interaction-drag-handle",
84
- "aria-label": Y,
85
- onPointerCancel: Ge,
86
- onPointerDown: $e,
87
- onPointerMove: ze,
83
+ "aria-label": G,
84
+ onPointerCancel: ze,
85
+ onPointerDown: Xe,
86
+ onPointerMove: Je,
88
87
  onPointerUp: Ee,
89
- children: /* @__PURE__ */ He("span", { className: "slide-player__interaction-drag-handle-icon", children: [
90
- /* @__PURE__ */ u(Ht, { "aria-hidden": "true" }),
91
- /* @__PURE__ */ u(Ht, { "aria-hidden": "true" }),
92
- /* @__PURE__ */ u(Ht, { "aria-hidden": "true" })
88
+ children: /* @__PURE__ */ Ge("span", { className: "slide-player__interaction-drag-handle-icon", children: [
89
+ /* @__PURE__ */ u($t, { "aria-hidden": "true" }),
90
+ /* @__PURE__ */ u($t, { "aria-hidden": "true" }),
91
+ /* @__PURE__ */ u($t, { "aria-hidden": "true" })
93
92
  ] })
94
93
  }
95
94
  ),
96
- /* @__PURE__ */ u("div", { className: "slide-player__interaction-header", children: /* @__PURE__ */ u("p", { className: "slide-player__interaction-title", children: f }) }),
95
+ /* @__PURE__ */ u("div", { className: "slide-player__interaction-header", children: /* @__PURE__ */ u("p", { className: "slide-player__interaction-title", children: d }) }),
97
96
  /* @__PURE__ */ u("div", { className: "slide-player__interaction-body", children: /* @__PURE__ */ u(
98
- Xr,
97
+ jr,
99
98
  {
100
99
  content: c,
101
- locale: Ae,
102
- dir: G,
103
- lang: $,
104
- defaultButtonText: we,
105
- defaultInputText: ie,
106
- defaultSelectedValues: Ye,
107
- confirmButtonText: St,
108
- copyButtonText: z,
109
- copiedButtonText: It,
110
- onSend: xe,
111
- readonly: Xe,
100
+ locale: xe,
101
+ dir: $,
102
+ lang: z,
103
+ defaultButtonText: Pe,
104
+ defaultInputText: ae,
105
+ defaultSelectedValues: $e,
106
+ confirmButtonText: bt,
107
+ copyButtonText: X,
108
+ copiedButtonText: At,
109
+ onSend: Ce,
110
+ readonly: We,
112
111
  sandboxMode: "content"
113
112
  }
114
113
  ) })
115
114
  ] })
116
115
  );
117
- Vn.displayName = "InteractionOverlayCard";
118
- const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
119
- const G = f[Ae];
120
- return Y.sequence_number === G?.sequence_number && Y.type === G?.type && Y.content === G?.content;
121
- }), Yt = (c) => c instanceof HTMLElement && !!c.closest(Fo), Ci = ({
116
+ Kn.displayName = "InteractionOverlayCard";
117
+ const qo = (c, d) => c.length === d.length && c.every((G, xe) => {
118
+ const $ = d[xe];
119
+ return G.sequence_number === $?.sequence_number && G.type === $?.type && G.content === $?.content;
120
+ }), zt = (c) => c instanceof HTMLElement && !!c.closest(Do), Ei = ({
122
121
  elementList: c = [],
123
- locale: f,
124
- playerEnabled: Y,
125
- playerControlsVisibility: Ae,
126
- playerClassName: G,
127
- fullscreenHeader: $,
128
- playerCustomActions: we,
129
- playerCustomActionPauseOnActive: ie = !0,
130
- bufferingText: Ye,
131
- interactionTitle: St,
132
- interactionTexts: z,
133
- playerTexts: It,
134
- playerAutoHideDelay: xe = 3e3,
135
- markerAutoAdvanceDelay: Ge = Ro,
136
- interactionDefaultValueOptions: $e,
137
- onSend: ze,
122
+ locale: d,
123
+ playerEnabled: G,
124
+ playerControlsVisibility: xe,
125
+ playerClassName: $,
126
+ fullscreenHeader: z,
127
+ playerCustomActions: Pe,
128
+ playerCustomActionPauseOnActive: ae = !0,
129
+ bufferingText: $e,
130
+ interactionTitle: bt,
131
+ interactionTexts: X,
132
+ playerTexts: At,
133
+ playerAutoHideDelay: Ce = 3e3,
134
+ markerAutoAdvanceDelay: ze = Oo,
135
+ interactionDefaultValueOptions: Xe,
136
+ onSend: Je,
138
137
  onPlayerVisibilityChange: Ee,
139
- onMobileViewModeChange: Xe,
140
- onStepChange: zt,
141
- requestedStepIndex: Xt,
142
- enableKeyboardShortcuts: le = !0,
143
- enableIframeScaling: qn = !0,
144
- enableMarkdownScaling: Kn = !0,
138
+ onMobileViewModeChange: We,
139
+ onStepChange: Wt,
140
+ onPlaybackCheckpoint: qn,
141
+ playbackRestoreRequest: q = null,
142
+ enableKeyboardShortcuts: se = !0,
143
+ enableIframeScaling: Un = !0,
144
+ enableMarkdownScaling: Hn = !0,
145
145
  disableLoadingOverlay: F = !1,
146
- className: Un,
147
- dir: Hn,
148
- lang: Yn,
149
- onPointerDown: Jt,
150
- onFocusCapture: Wt,
151
- ...Gn
146
+ className: Yn,
147
+ dir: Gn,
148
+ lang: $n,
149
+ onPointerDown: jt,
150
+ onFocusCapture: Qt,
151
+ ...zn
152
152
  }) => {
153
- const X = Hn ?? Gr(f), Ce = Yn ?? $r(f), q = d(() => Co(f), [f]), $n = d(
154
- () => Do(
155
- Ye,
156
- q.bufferingText
153
+ const J = Gn ?? Xr(d), Te = $n ?? Jr(d), U = f(() => To(d), [d]), Xn = f(
154
+ () => Vo(
155
+ $e,
156
+ U.bufferingText
157
157
  ),
158
- [Ye, q.bufferingText]
158
+ [$e, U.bufferingText]
159
159
  ), {
160
- playerEnabled: zn,
161
- playerControlsVisibility: J
162
- } = xo({
163
- playerEnabled: Y,
164
- playerControlsVisibility: Ae
165
- }), Je = Ur(), ae = m(null), { resolvedDirection: Xn } = Yr(ae, X), bt = m(null), We = m(null), jt = m(null), se = m(null), je = m(!1), Pe = m(null), Qe = m(null), W = m(null), Te = m(null), Re = m(null), ce = m(null), _e = m(null), Qt = m([]), Oe = m(!1), j = m(null), Me = m(null), Zt = m(0), en = m(null), tn = m({
160
+ playerEnabled: Jn,
161
+ playerControlsVisibility: W
162
+ } = Co({
163
+ playerEnabled: G,
164
+ playerControlsVisibility: xe
165
+ }), je = Yr(), ce = m(null), { resolvedDirection: Wn } = zr(ce, J), wt = m(null), Qe = m(null), Zt = m(null), ue = m(null), Ze = m(!1), Re = m(null), et = m(null), j = m(null), _e = m(null), Oe = m(null), de = m(null), Me = m(null), en = m([]), ke = m(!1), Q = m(null), Fe = m(null), tn = m(0), xt = m(null), nn = m({
166
166
  markerCount: 0,
167
167
  currentIndex: -1,
168
168
  canGoNext: !1
169
- }), At = m(!1), {
169
+ }), Pt = m(!1), {
170
170
  currentElementList: T,
171
- stepElementLists: nn,
172
- slideElementList: b,
171
+ stepElementLists: rn,
172
+ slideElementList: E,
173
173
  currentIndex: a,
174
- audioList: v,
175
- audioSlideIndexes: Ze,
176
- currentAudioSequenceIndexes: et,
177
- currentStepHasSpeakableElement: A,
178
- currentInteractionElement: y,
179
- canGoPrev: Jn,
174
+ audioList: y,
175
+ audioSlideIndexes: Z,
176
+ currentAudioSequenceIndexes: tt,
177
+ currentStepHasSpeakableElement: b,
178
+ currentInteractionElement: h,
179
+ canGoPrev: jn,
180
180
  canGoNext: R,
181
- handlePrev: rn,
181
+ handlePrev: on,
182
182
  handleNext: L,
183
- handleGoTo: tt
184
- } = eo(c), nt = m(null), ue = d(
185
- () => co({
186
- currentStepIndex: a,
187
- requestedStepIndex: Xt,
188
- slideStepCount: b.length
189
- }),
190
- [a, Xt, b.length]
191
- ), ke = d(() => {
183
+ handleGoTo: nt
184
+ } = ro(c), Le = f(() => {
192
185
  if (!(a < 0))
193
- return b[a];
194
- }, [a, b]), de = d(
186
+ return E[a];
187
+ }, [a, E]), fe = f(
195
188
  () => T.map(
196
189
  (e, t) => `${e.sequence_number ?? `${e.type}-${t}`}:${String(e.is_new ?? "")}`
197
190
  ),
198
191
  [T]
199
- ), Wn = b.filter(
192
+ ), Qn = E.filter(
200
193
  (e) => e.is_renderable !== !1
201
- ).length === 1, w = zn && (b.length > 0 || v.length > 0 || !!y), jn = d(
194
+ ).length === 1, A = Jn && (E.length > 0 || y.length > 0 || !!h), Zn = f(
202
195
  () => ({
203
- enabled: le,
204
- ownerId: Je
196
+ enabled: se,
197
+ ownerId: je
205
198
  }),
206
- [le, Je]
207
- ), K = r(() => {
208
- !le || !w || ro(Je);
209
- }, [le, Je, w]), _ = d(
210
- () => et.map((e) => v[e]?.audioKey).filter((e) => !!e),
211
- [v, et]
212
- ), [Qn, Fe] = p(!0), [rt, fe] = p(!1), [wt, on] = p(!0), [Le, ln] = p(!0), [E, U] = p(null), [Zn, an] = p(null), [er, x] = p(!1), [tr, xt] = p($t), [O, ot] = p(!1), it = m(/* @__PURE__ */ new Set()), [nr, lt] = p(!1), [sn, rr] = p(!0), [Et, Ct] = p(!1), [S, Pt] = p(), [me, at] = p(!1), [cn, st] = p(!1), [C, Tt] = p(
213
- vt
214
- ), [Rt, _t] = p(!1), [
215
- or,
216
- pe
217
- ] = p(0), [un, ir] = p(!1), D = d(() => Jr(), []), [ct, Ot] = p(
218
- gt
219
- ), [dn, Mt] = p(!1), [lr, fn] = p(
220
- () => D ? Mn() : !1
221
- ), ye = d(() => vo(), []), {
222
- effectiveMobileViewMode: Q,
223
- isImmersiveMobileFullscreen: he,
224
- isNativeMobileFullscreen: mn,
225
- shouldRotateFullscreenViewport: ar
226
- } = d(
227
- () => oo({
228
- hasManualMobileViewMode: dn,
229
- isMobileDevice: D,
230
- mobileViewMode: ct
199
+ [se, je]
200
+ ), H = r(() => {
201
+ !se || !A || lo(je);
202
+ }, [se, je, A]), _ = f(
203
+ () => tt.map((e) => y[e]?.audioKey).filter((e) => !!e),
204
+ [y, tt]
205
+ ), [er, De] = p(!0), [rt, me] = p(!1), [Ct, Et] = p(!0), [Ne, ln] = p(!0), [x, N] = p(null), [ot, an] = p(null), Be = m(
206
+ null
207
+ ), sn = m(null), [tr, cn] = p(null), [nr, w] = p(!1), [rr, Tt] = p(Jt), [O, it] = p(!1), lt = m(/* @__PURE__ */ new Set()), [or, at] = p(!1), [un, ir] = p(!0), [Rt, _t] = p(!1), [S, Ot] = p(), [pe, st] = p(!1), [dn, ct] = p(!1), [P, Mt] = p(
208
+ It
209
+ ), [kt, Ft] = p(!1), [
210
+ lr,
211
+ ye
212
+ ] = p(0), [fn, ar] = p(!1), B = f(() => Qr(), []), [ut, Lt] = p(
213
+ St
214
+ ), [mn, Dt] = p(!1), [sr, pn] = p(
215
+ () => B ? Fn() : !1
216
+ ), he = f(() => Io(), []), {
217
+ effectiveMobileViewMode: ee,
218
+ isImmersiveMobileFullscreen: ge,
219
+ isNativeMobileFullscreen: yn,
220
+ shouldRotateFullscreenViewport: cr
221
+ } = f(
222
+ () => ao({
223
+ hasManualMobileViewMode: mn,
224
+ isMobileDevice: B,
225
+ mobileViewMode: ut
231
226
  }),
232
227
  [
233
- dn,
234
- D,
235
- lr,
236
- ct
228
+ mn,
229
+ B,
230
+ sr,
231
+ ut
237
232
  ]
238
- ), pn = m(Q), {
239
- controlsVisible: B,
240
- layoutReserved: ut
233
+ ), hn = m(ee), {
234
+ controlsVisible: V,
235
+ layoutReserved: dt
241
236
  } = Eo({
242
- isAutoVisible: Qn,
243
- playerControlsVisibility: J,
244
- shouldMountPlayer: w
245
- }), sr = he && B, cr = he && ut, ur = he || mn, yn = un && !D, dr = r(
237
+ isAutoVisible: er,
238
+ playerControlsVisibility: W,
239
+ shouldMountPlayer: A
240
+ }), ur = ge && V, dr = ge && dt, fr = ge || yn, gn = fn && !B, mr = r(
246
241
  (e) => {
247
- Mt(!0), Ot(e);
242
+ Dt(!0), Lt(e);
248
243
  },
249
244
  []
250
- ), hn = r(() => {
251
- Mt(!1), Ot(gt);
252
- }, []), fr = r(() => {
253
- hn(), $?.onBack?.();
254
- }, [$, hn]), M = r(() => {
255
- W.current !== null && (window.clearTimeout(W.current), W.current = null);
245
+ ), vn = r(() => {
246
+ Dt(!1), Lt(St);
247
+ }, []), pr = r(() => {
248
+ vn(), z?.onBack?.();
249
+ }, [z, vn]), M = r(() => {
250
+ j.current !== null && (window.clearTimeout(j.current), j.current = null);
256
251
  }, []), k = r(() => {
257
- Te.current !== null && (window.clearTimeout(Te.current), Te.current = null);
258
- }, []), dt = r(() => {
259
- M(), k(), at(!1), pe(0);
260
- }, [M, k]), ft = r(
252
+ _e.current !== null && (window.clearTimeout(_e.current), _e.current = null);
253
+ }, []), ft = r(() => {
254
+ M(), k(), st(!1), ye(0);
255
+ }, [M, k]), mt = r(
261
256
  (e) => {
262
- e && dt(), Ct(e);
257
+ e && ft(), _t(e);
263
258
  },
264
- [dt]
265
- ), gn = r(() => {
266
- dt(), Ct((e) => !e);
267
- }, [dt]), Z = r(() => {
268
- Tt(
269
- (e) => e.x === vt.x && e.y === vt.y ? e : vt
270
- ), _t(!1), _e.current = null, ce.current = null;
271
- }, []), { mountedStepStates: mr, currentMountedStateIndex: pr } = d(() => {
259
+ [ft]
260
+ ), Sn = r(() => {
261
+ ft(), _t((e) => !e);
262
+ }, [ft]), te = r(() => {
263
+ Mt(
264
+ (e) => e.x === It.x && e.y === It.y ? e : It
265
+ ), Ft(!1), Me.current = null, de.current = null;
266
+ }, []), { mountedStepStates: yr, currentMountedStateIndex: hr } = f(() => {
272
267
  const e = [], t = /* @__PURE__ */ new Map();
273
- return nn.forEach((n, i) => {
268
+ return rn.forEach((n, i) => {
274
269
  const l = e.findIndex(
275
- (o) => Vo(
270
+ (o) => qo(
276
271
  o.elementList,
277
272
  n
278
273
  )
@@ -289,286 +284,304 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
289
284
  mountedStepStates: e,
290
285
  currentMountedStateIndex: a >= 0 ? t.get(a) ?? -1 : -1
291
286
  };
292
- }, [a, nn]), vn = d(() => String(a), [a]), P = d(() => E ? v.findIndex(
293
- (e) => (e.audioKey ?? "") === E
294
- ) : -1, [v, E]), kt = d(
295
- () => P >= 0 ? v[P] : void 0,
296
- [v, P]
297
- ), yr = kt?.element?.subtitle_cues ?? [], mt = d(
287
+ }, [a, rn]), In = f(() => String(a), [a]), C = f(() => x ? y.findIndex(
288
+ (e) => (e.audioKey ?? "") === x
289
+ ) : -1, [y, x]), pt = f(
290
+ () => C >= 0 ? y[C] : void 0,
291
+ [y, C]
292
+ );
293
+ s(() => {
294
+ if (!q || q.id === sn.current)
295
+ return;
296
+ const e = y.findIndex(
297
+ (n) => n.audioKey === q.audioKey
298
+ );
299
+ if (e < 0)
300
+ return;
301
+ const t = Z[e];
302
+ t != null && (sn.current = q.id, Et(!0), N(q.audioKey), Be.current = q, an(q), a !== t && nt(t));
303
+ }, [
304
+ y,
305
+ Z,
306
+ a,
307
+ nt,
308
+ q
309
+ ]);
310
+ const gr = pt?.element?.subtitle_cues ?? [], yt = f(
298
311
  () => _[0] ?? "none",
299
312
  [_]
300
- ), Ft = d(
313
+ ), Nt = f(
301
314
  () => ({
302
- currentElement: ho({
303
- currentAudioIndex: P,
304
- currentAudioSequenceIndexes: et,
305
- audioList: v,
315
+ currentElement: vo({
316
+ currentAudioIndex: C,
317
+ currentAudioSequenceIndexes: tt,
318
+ audioList: y,
306
319
  currentInteractionElement: S,
307
- currentStepElement: ke
320
+ currentStepElement: Le
308
321
  }),
309
322
  currentIndex: a,
310
- currentStepElement: ke,
311
- isActive: Et,
312
- setActive: ft,
313
- toggleActive: gn
323
+ currentStepElement: Le,
324
+ isActive: Rt,
325
+ setActive: mt,
326
+ toggleActive: Sn
314
327
  }),
315
328
  [
316
329
  S,
317
- v,
318
- P,
319
- et,
330
+ y,
331
+ C,
332
+ tt,
320
333
  a,
321
- ke,
322
- Et,
323
- ft,
324
- gn
334
+ Le,
335
+ Rt,
336
+ mt,
337
+ Sn
325
338
  ]
326
- ), pt = d(
327
- () => go(
328
- we,
329
- Ft
339
+ ), ht = f(
340
+ () => So(
341
+ Pe,
342
+ Nt
330
343
  ),
331
- [Ft, we]
332
- ), Lt = pt > 0, Nt = Lt && Et, hr = d(
344
+ [Nt, Pe]
345
+ ), Bt = ht > 0, Vt = Bt && Rt, vr = f(
333
346
  () => ({
334
- "--slide-player-custom-action-count": String(pt),
347
+ "--slide-player-custom-action-count": String(ht),
335
348
  "--slide-player-mobile-control-count": String(
336
- pt + 4
349
+ ht + 4
337
350
  ),
338
- "--slide-interaction-drag-x": `${C.x}px`,
339
- "--slide-interaction-drag-y": `${C.y}px`
351
+ "--slide-interaction-drag-x": `${P.x}px`,
352
+ "--slide-interaction-drag-y": `${P.y}px`
340
353
  }),
341
354
  [
342
- C.x,
343
- C.y,
344
- pt
355
+ P.x,
356
+ P.y,
357
+ ht
345
358
  ]
346
- ), Sn = _.length > 0, In = d(() => y ? `${y.sequence_number ?? "none"}:${String(
347
- y.content ?? ""
348
- )}` : "none", [y]), Ne = d(
349
- () => [vn, In].join("|"),
350
- [In, vn]
351
- ), gr = d(
359
+ ), bn = _.length > 0, An = f(() => h ? `${h.sequence_number ?? "none"}:${String(
360
+ h.content ?? ""
361
+ )}` : "none", [h]), ve = f(
362
+ () => [In, An].join("|"),
363
+ [An, In]
364
+ ), Sr = f(
352
365
  () => [
353
- Ne,
354
- kt?.audioKey ?? "none",
355
- String(P)
366
+ ve,
367
+ pt?.audioKey ?? "none",
368
+ String(C)
356
369
  ].join("|"),
357
- [P, kt?.audioKey, Ne]
358
- ), bn = !!d(() => !mt || mt === "none" ? "" : v.find(
359
- (t) => t.audioKey === mt
360
- )?.audioUrl?.trim() ?? "", [v, mt]), ee = ie && Nt, De = d(
361
- () => Io({
370
+ [C, pt?.audioKey, ve]
371
+ ), wn = !!f(() => !yt || yt === "none" ? "" : y.find(
372
+ (t) => t.audioKey === yt
373
+ )?.audioUrl?.trim() ?? "", [y, yt]), ne = ae && Vt, Ve = f(
374
+ () => Ao({
362
375
  canGoNext: R,
363
- currentAudioIndex: P,
364
- currentStepHasSpeakableElement: A,
365
- hasInteraction: !!y
376
+ currentAudioIndex: C,
377
+ currentStepHasSpeakableElement: b,
378
+ hasInteraction: !!h
366
379
  }),
367
380
  [
368
381
  R,
369
- P,
370
- y,
371
- A
382
+ C,
383
+ h,
384
+ b
372
385
  ]
373
- ), An = d(
374
- () => wo({
386
+ ), xn = f(
387
+ () => Po({
375
388
  currentElementList: T,
376
- currentStepHasSpeakableElement: A,
377
- currentInteractionElement: y,
378
- markerAutoAdvanceDelay: Ge
389
+ currentStepHasSpeakableElement: b,
390
+ currentInteractionElement: h,
391
+ markerAutoAdvanceDelay: ze
379
392
  }),
380
393
  [
381
394
  T,
382
- y,
383
- A,
384
- Ge
395
+ h,
396
+ b,
397
+ ze
385
398
  ]
386
- ), wn = An.delayMs, Be = An.usesImageOnlyDelay, Dt = d(
387
- () => `${a}:${de.join("|")}`,
388
- [a, de]
389
- ), [vr, Sr] = p(null), xn = !Be || vr === Dt, V = r(() => {
390
- se.current !== null && (window.clearTimeout(se.current), se.current = null);
391
- }, []), ge = r(() => {
392
- Pe.current !== null && (window.clearTimeout(Pe.current), Pe.current = null);
393
- }, []), H = r(() => {
394
- Qe.current !== null && (window.clearTimeout(Qe.current), Qe.current = null);
395
- }, []), N = r(
399
+ ), Pn = xn.delayMs, Ke = xn.usesImageOnlyDelay, Kt = f(
400
+ () => `${a}:${fe.join("|")}`,
401
+ [a, fe]
402
+ ), [Ir, br] = p(null), Cn = !Ke || Ir === Kt, K = r(() => {
403
+ ue.current !== null && (window.clearTimeout(ue.current), ue.current = null);
404
+ }, []), Se = r(() => {
405
+ Re.current !== null && (window.clearTimeout(Re.current), Re.current = null);
406
+ }, []), Y = r(() => {
407
+ et.current !== null && (window.clearTimeout(et.current), et.current = null);
408
+ }, []), D = r(
396
409
  (e = {}) => {
397
- ge(), M(), k(), H(), U(null), ye.reset(), x(!1), xt($t), ot(!1), it.current = /* @__PURE__ */ new Set(), lt(!1), an(null), e.preservePendingSubtitleJump || (Me.current = null), Pt(void 0), at(!1), pe(0);
410
+ Se(), M(), k(), Y(), N(null), he.reset(), w(!1), Tt(Jt), it(!1), lt.current = /* @__PURE__ */ new Set(), at(!1), cn(null), e.preservePendingSubtitleJump || (Fe.current = null), Ot(void 0), st(!1), ye(0);
398
411
  },
399
412
  [
400
- ge,
401
- H,
413
+ Se,
414
+ Y,
402
415
  M,
403
416
  k,
404
- ye
417
+ he
405
418
  ]
406
- ), yt = r(
419
+ ), gt = r(
407
420
  (e) => {
408
- Zt.current += 1, an({
421
+ tn.current += 1, cn({
409
422
  ...e,
410
- id: Zt.current
423
+ id: tn.current
411
424
  });
412
425
  },
413
426
  []
414
- ), ve = r(() => {
415
- const e = uo(
427
+ ), Ie = r(() => {
428
+ const e = mo(
416
429
  _,
417
- it.current
430
+ lt.current
418
431
  );
419
- return e ? (U(e), !0) : !1;
420
- }, [_]), Ve = r(() => {
421
- M(), k(), at(!1), pe(0), !ve() && R && L();
432
+ return e ? (N(e), !0) : !1;
433
+ }, [_]), qe = r(() => {
434
+ M(), k(), st(!1), ye(0), !Ie() && R && L();
422
435
  }, [
423
436
  R,
424
437
  M,
425
438
  k,
426
439
  L,
427
- ve
440
+ Ie
428
441
  ]), En = r(
429
442
  (e) => {
430
443
  if (k(), !e)
431
444
  return;
432
445
  const t = () => {
433
- Te.current = null, pe(
434
- Oo
435
- ), at(!0), j.current = null;
446
+ _e.current = null, ye(
447
+ ko
448
+ ), st(!0), Q.current = null;
436
449
  };
437
- Te.current = window.setTimeout(
450
+ _e.current = window.setTimeout(
438
451
  t,
439
- _o
452
+ Mo
440
453
  );
441
454
  },
442
455
  [k]
443
- ), Bt = r(
444
- () => je.current || !!ae.current?.querySelector(".slide-player__controls:hover"),
456
+ ), qt = r(
457
+ () => Ze.current || !!ce.current?.querySelector(".slide-player__controls:hover"),
445
458
  []
446
- ), h = r(
459
+ ), g = r(
447
460
  (e = rt) => {
448
- !w || J === "hidden" || (Fe(!0), V(), !(J === "visible" || !e || xe <= 0 || Bt()) && (se.current = window.setTimeout(() => {
449
- if (Bt()) {
450
- se.current = null;
461
+ !A || W === "hidden" || (De(!0), K(), !(W === "visible" || !e || Ce <= 0 || qt()) && (ue.current = window.setTimeout(() => {
462
+ if (qt()) {
463
+ ue.current = null;
451
464
  return;
452
465
  }
453
- Fe(!1), se.current = null;
454
- }, xe)));
466
+ De(!1), ue.current = null;
467
+ }, Ce)));
455
468
  },
456
469
  [
457
- V,
470
+ K,
458
471
  rt,
459
- Bt,
460
- xe,
461
- J,
462
- w
472
+ qt,
473
+ Ce,
474
+ W,
475
+ A
463
476
  ]
464
- ), qe = !!yo(y), te = !!y && !qe, Ir = r((e) => {
465
- on(e);
466
- }, []), Se = r(
477
+ ), Ue = !!go(h), re = !!h && !Ue, Ar = r((e) => {
478
+ Et(e);
479
+ }, []), be = r(
467
480
  (e) => {
468
- e && on(e.shouldContinuePlayback);
481
+ e && Et(e.shouldContinuePlayback);
469
482
  },
470
483
  []
471
484
  );
472
485
  s(() => {
473
- ln(wt);
474
- }, [a, wt, ie]), s(() => {
475
- ie && ft(!1);
486
+ ln(Ct);
487
+ }, [a, Ct, ae]), s(() => {
488
+ ae && mt(!1);
476
489
  }, [
477
490
  a,
478
- ie,
479
- ft
491
+ ae,
492
+ mt
480
493
  ]), s(() => {
481
- Lt || Ct(!1);
482
- }, [Lt]), s(() => () => {
483
- ge(), H(), V(), M(), k();
494
+ Bt || _t(!1);
495
+ }, [Bt]), s(() => () => {
496
+ Se(), Y(), K(), M(), k();
484
497
  }, [
485
- ge,
486
- H,
498
+ Se,
499
+ Y,
487
500
  M,
488
501
  k,
489
- V
502
+ K
490
503
  ]), s(() => {
491
- if (!Be) {
492
- H();
504
+ if (!Ke) {
505
+ Y();
493
506
  return;
494
507
  }
495
508
  let e = !1, t = null, n = null;
496
509
  const i = () => {
497
510
  n?.(), n = null;
498
511
  }, l = () => {
499
- e || (i(), H(), Sr(Dt));
512
+ e || (i(), Y(), br(Kt));
500
513
  }, o = () => {
501
514
  if (e)
502
515
  return;
503
516
  i();
504
- const g = We.current?.querySelector(
517
+ const v = Qe.current?.querySelector(
505
518
  '[data-active-step="true"]'
506
519
  );
507
- if (!g)
520
+ if (!v)
508
521
  return;
509
522
  const I = Array.from(
510
- g.querySelectorAll("iframe")
523
+ v.querySelectorAll("iframe")
511
524
  );
512
- if (I.length === 0 || Ao(I)) {
525
+ if (I.length === 0 || xo(I)) {
513
526
  l();
514
527
  return;
515
528
  }
516
- const ne = [], Ue = () => {
529
+ const oe = [], Ye = () => {
517
530
  e || (t !== null && window.cancelAnimationFrame(t), t = window.requestAnimationFrame(() => {
518
531
  t = null, o();
519
532
  }));
520
- }, Kt = (re, Ie, oe) => {
521
- re.addEventListener(Ie, oe, { once: !0 }), ne.push(
522
- () => re.removeEventListener(Ie, oe)
533
+ }, Yt = (ie, Ae, le) => {
534
+ ie.addEventListener(Ae, le, { once: !0 }), oe.push(
535
+ () => ie.removeEventListener(Ae, le)
523
536
  );
524
537
  };
525
- I.forEach((re) => {
526
- const Ie = re.contentDocument;
527
- if (!Ie || Ie.readyState !== "complete") {
528
- Kt(re, "load", Ue);
538
+ I.forEach((ie) => {
539
+ const Ae = ie.contentDocument;
540
+ if (!Ae || Ae.readyState !== "complete") {
541
+ Yt(ie, "load", Ye);
529
542
  return;
530
543
  }
531
- Array.from(Ie.images).filter((oe) => !oe.complete).forEach((oe) => {
532
- Kt(oe, "load", Ue), Kt(oe, "error", Ue);
544
+ Array.from(Ae.images).filter((le) => !le.complete).forEach((le) => {
545
+ Yt(le, "load", Ye), Yt(le, "error", Ye);
533
546
  });
534
547
  }), n = () => {
535
- ne.forEach((re) => re());
548
+ oe.forEach((ie) => ie());
536
549
  };
537
550
  };
538
551
  return t = window.requestAnimationFrame(() => {
539
552
  t = null, o();
540
- }), Qe.current = window.setTimeout(() => {
553
+ }), et.current = window.setTimeout(() => {
541
554
  l();
542
- }, bo), () => {
543
- e = !0, i(), H(), t !== null && window.cancelAnimationFrame(t);
555
+ }, wo), () => {
556
+ e = !0, i(), Y(), t !== null && window.cancelAnimationFrame(t);
544
557
  };
545
558
  }, [
546
- H,
559
+ Y,
547
560
  T,
548
561
  a,
549
- Dt,
550
- Be
551
- ]), s(() => (Ee?.(B), () => {
562
+ Kt,
563
+ Ke
564
+ ]), s(() => (Ee?.(V), () => {
552
565
  Ee?.(!1);
553
- }), [Ee, B]), s(() => {
554
- B || (je.current = !1);
555
- }, [B]), s(() => {
556
- D || ct === gt || (Mt(!1), Ot(gt));
557
- }, [D, ct]), s(() => {
558
- if (!D) {
559
- fn(!1);
566
+ }), [Ee, V]), s(() => {
567
+ V || (Ze.current = !1);
568
+ }, [V]), s(() => {
569
+ B || ut === St || (Dt(!1), Lt(St));
570
+ }, [B, ut]), s(() => {
571
+ if (!B) {
572
+ pn(!1);
560
573
  return;
561
574
  }
562
575
  const e = () => {
563
- fn(Mn()), Z();
576
+ pn(Fn()), te();
564
577
  }, t = () => {
565
- Z();
578
+ te();
566
579
  };
567
580
  e(), window.addEventListener("orientationchange", t), window.screen?.orientation?.addEventListener?.(
568
581
  "change",
569
582
  t
570
583
  );
571
- const n = Wr(
584
+ const n = Zr(
572
585
  e
573
586
  );
574
587
  return () => {
@@ -577,286 +590,276 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
577
590
  t
578
591
  );
579
592
  };
580
- }, [D, Z]), s(() => {
581
- Xe?.(Q);
582
- }, [Q, Xe]), s(() => {
583
- pn.current !== Q && Z(), pn.current = Q;
584
- }, [Q, Z]), Bn(() => {
585
- if (!ue) {
586
- nt.current = null;
587
- return;
588
- }
589
- if (!ue.isAvailable) {
590
- nt.current = null;
591
- return;
592
- }
593
- const { targetStepIndex: e } = ue;
594
- nt.current !== e && (nt.current = e, tt(e));
595
- }, [tt, ue]), s(() => {
596
- ue?.isPending || zt?.(ke, a);
597
- }, [
598
- a,
599
- ke,
600
- zt,
601
- ue?.isPending
602
- ]), s(() => {
603
- const e = tn.current, t = so(
593
+ }, [B, te]), s(() => {
594
+ We?.(ee);
595
+ }, [ee, We]), s(() => {
596
+ hn.current !== ee && te(), hn.current = ee;
597
+ }, [ee, te]), s(() => {
598
+ Wt?.(Le, a);
599
+ }, [a, Le, Wt]), s(() => {
600
+ const e = nn.current, t = fo(
604
601
  {
605
602
  previousMarkerCount: e.markerCount,
606
- nextMarkerCount: b.length,
603
+ nextMarkerCount: E.length,
607
604
  previousIndex: e.currentIndex,
608
605
  previousCanGoNext: e.canGoNext,
609
606
  nextCanGoNext: R,
610
- currentAudioKey: E,
607
+ currentAudioKey: x,
611
608
  hasCompletedCurrentStepAudio: O,
612
- hasResolvedCurrentInteraction: qe,
613
- currentStepHasSpeakableElement: A,
614
- currentInteractionElement: y,
615
- isAutoAdvanceEnabled: Le,
616
- shouldUseSilentStepAutoAdvanceToggle: De
609
+ hasResolvedCurrentInteraction: Ue,
610
+ currentStepHasSpeakableElement: b,
611
+ currentInteractionElement: h,
612
+ isAutoAdvanceEnabled: Ne,
613
+ shouldUseSilentStepAutoAdvanceToggle: Ve
617
614
  }
618
615
  );
619
- tn.current = {
620
- markerCount: b.length,
616
+ nn.current = {
617
+ markerCount: E.length,
621
618
  currentIndex: a,
622
619
  canGoNext: R
623
620
  }, t && L();
624
621
  }, [
625
622
  R,
626
- E,
623
+ x,
627
624
  a,
628
- y,
629
- A,
625
+ h,
626
+ b,
630
627
  L,
631
628
  O,
632
- qe,
633
- Le,
634
- De,
635
- b.length
629
+ Ue,
630
+ Ne,
631
+ Ve,
632
+ E.length
636
633
  ]), s(() => {
637
- if (!w || J === "hidden") {
638
- V(), Fe(!1);
634
+ if (!A || W === "hidden") {
635
+ K(), De(!1);
639
636
  return;
640
637
  }
641
- if (J === "visible") {
642
- V(), Fe(!0);
638
+ if (W === "visible") {
639
+ K(), De(!0);
643
640
  return;
644
641
  }
645
- rt || h(!0);
642
+ rt || g(!0);
646
643
  }, [
647
- V,
644
+ K,
648
645
  rt,
649
- J,
650
- w,
651
- h
646
+ W,
647
+ A,
648
+ g
652
649
  ]), s(() => {
653
650
  if (typeof window > "u")
654
651
  return;
655
652
  const e = (t) => {
656
- t.origin === window.location.origin && Hr(t.data) && t.data.eventType === "click" && w && (K(), fe(!0), h(!0));
653
+ t.origin === window.location.origin && $r(t.data) && t.data.eventType === "click" && A && (H(), me(!0), g(!0));
657
654
  };
658
655
  return window.addEventListener("message", e), () => {
659
656
  window.removeEventListener("message", e);
660
657
  };
661
- }, [K, w, h]), to({
662
- sectionRef: ae,
663
- enabled: w,
664
- keyboardShortcutsEnabled: le,
665
- onKeyboardShortcut: K,
658
+ }, [H, A, g]), oo({
659
+ sectionRef: ce,
660
+ enabled: A,
661
+ keyboardShortcutsEnabled: se,
662
+ onKeyboardShortcut: H,
666
663
  onWake: () => {
667
- K(), fe(!0), h(!0);
664
+ H(), me(!0), g(!0);
668
665
  }
669
666
  }), s(() => {
670
- if (!w) {
671
- N();
667
+ if (!A) {
668
+ D();
672
669
  return;
673
670
  }
674
- const { hasPlaybackContextChanged: e, shouldInitializeAudioSequence: t } = mo({
675
- previousResetKey: en.current,
676
- nextResetKey: Ne,
677
- currentAudioKey: E,
671
+ if (Be.current) {
672
+ xt.current = ve;
673
+ return;
674
+ }
675
+ const { hasPlaybackContextChanged: e, shouldInitializeAudioSequence: t } = yo({
676
+ previousResetKey: xt.current,
677
+ nextResetKey: ve,
678
+ currentAudioKey: x,
678
679
  hasCompletedCurrentStepAudio: O
679
680
  });
680
- en.current = Ne;
681
- const n = j.current === a && !!y, i = lo({
682
- hasInteraction: !!y,
683
- shouldBlockPlaybackForInteraction: te,
681
+ xt.current = ve;
682
+ const n = Q.current === a && !!h, i = co({
683
+ hasInteraction: !!h,
684
+ shouldBlockPlaybackForInteraction: re,
684
685
  shouldOpenInteractionOverlayAfterAudio: n,
685
686
  hasPlaybackContextChanged: e,
686
- hasResolvedCurrentInteraction: qe,
687
- currentStepHasSpeakableElement: A,
688
- isPlayerCustomActionActive: Nt
689
- }), l = Me.current, o = l?.slideIndex === a;
690
- if (e && N({
687
+ hasResolvedCurrentInteraction: Ue,
688
+ currentStepHasSpeakableElement: b,
689
+ isPlayerCustomActionActive: Vt
690
+ }), l = Fe.current, o = l?.slideIndex === a;
691
+ if (e && D({
691
692
  preservePendingSubtitleJump: o
692
- }), !(T.length === 0 && !y) && !ee) {
693
- if (l?.slideIndex === a && Fn({
693
+ }), !(T.length === 0 && !h) && !ne) {
694
+ if (l?.slideIndex === a && Dn({
694
695
  currentIndex: a,
695
696
  resolvedCurrentInteractionElement: S,
696
- slideElementList: b,
697
+ slideElementList: E,
697
698
  targetSlideIndex: l.slideIndex
698
699
  })) {
699
- Me.current = null, At.current = !0, U(l.audioKey), yt({
700
+ Fe.current = null, Pt.current = !0, N(l.audioKey), gt({
700
701
  audioIndex: l.audioIndex,
701
702
  timeMs: l.timeMs
702
703
  });
703
704
  return;
704
705
  }
705
- if (y && Pt(y), i) {
706
- En(y);
706
+ if (h && Ot(h), i) {
707
+ En(h);
707
708
  return;
708
709
  }
709
- if (k(), j.current = null, !te && t && !ve()) {
710
- if (A) {
710
+ if (k(), Q.current = null, !re && t && !Ie()) {
711
+ if (b) {
711
712
  if (F) {
712
- x(!1);
713
+ w(!1);
713
714
  return;
714
715
  }
715
- x(!0);
716
+ w(!0);
716
717
  return;
717
718
  }
718
- if (R && !(De && !Le) && !(Be && !xn))
719
- return Pe.current = window.setTimeout(() => {
720
- Pe.current = null, L();
721
- }, wn), () => {
722
- ge();
719
+ if (R && !(Ve && !Ne) && !(Ke && !Cn))
720
+ return Re.current = window.setTimeout(() => {
721
+ Re.current = null, L();
722
+ }, Pn), () => {
723
+ Se();
723
724
  };
724
725
  }
725
726
  }
726
727
  }, [
727
728
  S,
728
729
  R,
729
- ge,
730
+ Se,
730
731
  T.length,
731
732
  a,
732
- y,
733
- E,
734
- Ne,
735
- A,
736
- Be,
737
- xn,
738
- wn,
733
+ h,
734
+ x,
735
+ ve,
736
+ b,
737
+ Ke,
738
+ Cn,
739
+ Pn,
739
740
  L,
740
741
  O,
741
742
  F,
742
- Le,
743
- qe,
744
- Nt,
745
- te,
743
+ Ne,
744
+ Ue,
745
+ Vt,
746
+ re,
746
747
  k,
747
- N,
748
- yt,
748
+ D,
749
+ gt,
749
750
  En,
750
- w,
751
- b,
752
- ve,
753
- ee,
754
- De
751
+ A,
752
+ E,
753
+ Ie,
754
+ ne,
755
+ Ve
755
756
  ]), s(() => {
756
- if (F || ee || !A || te) {
757
- x(!1);
757
+ if (F || ne || !b || re) {
758
+ w(!1);
758
759
  return;
759
760
  }
760
761
  if (O) {
761
- x(!1);
762
+ w(!1);
762
763
  return;
763
764
  }
764
- if (Sn) {
765
- x(!1);
765
+ if (bn) {
766
+ w(!1);
766
767
  return;
767
768
  }
768
- xt("waitingForAudio"), x(!0);
769
+ Tt("waitingForAudio"), w(!0);
769
770
  }, [
770
- Sn,
771
- A,
771
+ bn,
772
+ b,
772
773
  O,
773
774
  F,
774
- ee,
775
- te
775
+ ne,
776
+ re
776
777
  ]), s(() => {
777
- O && fo(
778
+ O && po(
778
779
  _,
779
- it.current
780
- ) && ot(!1);
780
+ lt.current
781
+ ) && it(!1);
781
782
  }, [_, O]), s(() => {
782
- const e = At.current;
783
- At.current = !1, po({
784
- currentAudioKey: E,
783
+ if (Be.current)
784
+ return;
785
+ const e = Pt.current;
786
+ Pt.current = !1, ho({
787
+ currentAudioKey: x,
785
788
  currentAudioSequenceLength: _.length,
786
- currentStepHasSpeakableElement: A,
789
+ currentStepHasSpeakableElement: b,
787
790
  hasCompletedCurrentStepAudio: O,
788
- shouldBlockPlaybackForInteraction: te,
789
- shouldPausePlaybackForCustomAction: ee,
791
+ shouldBlockPlaybackForInteraction: re,
792
+ shouldPausePlaybackForCustomAction: ne,
790
793
  shouldSkipDefaultAudioStart: e
791
- }) && ve();
794
+ }) && Ie();
792
795
  }, [
793
- E,
796
+ x,
794
797
  _,
795
- A,
798
+ b,
796
799
  O,
797
- ee,
798
- te,
799
- ve
800
+ ne,
801
+ re,
802
+ Ie
800
803
  ]), s(() => {
801
- !E || P >= 0 || U(null);
802
- }, [P, E]), s(() => {
803
- P >= 0 || ye.reset();
804
- }, [P, ye]), s(() => {
805
- lt(!1);
806
- }, [gr]);
804
+ !x || C >= 0 || N(null);
805
+ }, [C, x]), s(() => {
806
+ C >= 0 || he.reset();
807
+ }, [C, he]), s(() => {
808
+ at(!1);
809
+ }, [Sr]);
807
810
  const {
808
- interactionDefaults: Cn,
809
- interactionDefaultSelectedValues: br,
810
- hasResolvedInteractionInput: Pn,
811
- isInteractionReadonly: Ar,
812
- shouldAutoContinueInteraction: Tn
813
- } = d(
814
- () => So(S, {
815
- interactionDefaultValueOptions: $e
811
+ interactionDefaults: Tn,
812
+ interactionDefaultSelectedValues: wr,
813
+ hasResolvedInteractionInput: Rn,
814
+ isInteractionReadonly: xr,
815
+ shouldAutoContinueInteraction: _n
816
+ } = f(
817
+ () => bo(S, {
818
+ interactionDefaultValueOptions: Xe
816
819
  }),
817
- [S, $e]
818
- ), wr = !!S?.readonly || Ar, Ke = io({
820
+ [S, Xe]
821
+ ), Pr = !!S?.readonly || xr, He = so({
819
822
  hasActiveInteraction: !!S,
820
- isInteractionOverlayOpen: me
821
- }), xr = r(
823
+ isInteractionOverlayOpen: pe
824
+ }), Cr = r(
822
825
  (e) => {
823
826
  const n = [
824
827
  ...e.selectedValues ?? [],
825
828
  e.inputText?.trim() ?? "",
826
829
  e.buttonText?.trim() ?? ""
827
830
  ].filter(Boolean).join(", ");
828
- Pt((i) => !i || !n ? i : {
831
+ Ot((i) => !i || !n ? i : {
829
832
  ...i,
830
833
  user_input: n
831
- }), ze?.(e, S), Ve();
834
+ }), Je?.(e, S), qe();
832
835
  },
833
- [S, Ve, ze]
836
+ [S, qe, Je]
834
837
  );
835
838
  s(() => {
836
839
  const e = () => {
837
- ir(document.fullscreenElement === ae.current);
840
+ ar(document.fullscreenElement === ce.current);
838
841
  };
839
842
  return e(), document.addEventListener("fullscreenchange", e), () => {
840
843
  document.removeEventListener("fullscreenchange", e);
841
844
  };
842
845
  }, []), s(() => {
843
- S && me || st(!1);
844
- }, [S, me]), s(() => {
845
- Z();
846
- }, [S, Z]), s(() => {
847
- if (!Ke) {
848
- pe(0);
846
+ S && pe || ct(!1);
847
+ }, [S, pe]), s(() => {
848
+ te();
849
+ }, [S, te]), s(() => {
850
+ if (!He) {
851
+ ye(0);
849
852
  return;
850
853
  }
851
- const e = Re.current;
854
+ const e = Oe.current;
852
855
  if (!e)
853
856
  return;
854
857
  const t = () => {
855
858
  const i = Math.ceil(
856
859
  e.getBoundingClientRect().height
857
860
  );
858
- pe(
859
- i + Mo
861
+ ye(
862
+ i + Fo
860
863
  );
861
864
  };
862
865
  if (t(), typeof ResizeObserver > "u")
@@ -867,79 +870,79 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
867
870
  return n.observe(e), () => {
868
871
  n.disconnect();
869
872
  };
870
- }, [Ke]), s(() => {
871
- if (M(), !!me) {
872
- if (Tn)
873
- return W.current = window.setTimeout(() => {
874
- W.current = null, Ve();
875
- }, Ln), () => {
873
+ }, [He]), s(() => {
874
+ if (M(), !!pe) {
875
+ if (_n)
876
+ return j.current = window.setTimeout(() => {
877
+ j.current = null, qe();
878
+ }, Nn), () => {
876
879
  M();
877
880
  };
878
- if (!(cn || !Pn))
879
- return W.current = window.setTimeout(() => {
880
- W.current = null, Ve();
881
- }, Ln), () => {
881
+ if (!(dn || !Rn))
882
+ return j.current = window.setTimeout(() => {
883
+ j.current = null, qe();
884
+ }, Nn), () => {
882
885
  M();
883
886
  };
884
887
  }
885
888
  }, [
886
889
  M,
887
- Ve,
888
- cn,
889
- Pn,
890
- me,
891
- Tn
890
+ qe,
891
+ dn,
892
+ Rn,
893
+ pe,
894
+ _n
892
895
  ]);
893
- const Er = (e, t = {}) => e ? e.type === "slot" ? /* @__PURE__ */ u(qr, { children: e.content }) : e.type === "html" ? /* @__PURE__ */ u(
894
- On,
896
+ const Er = (e, t = {}) => e ? e.type === "slot" ? /* @__PURE__ */ u(Ur, { children: e.content }) : e.type === "html" ? /* @__PURE__ */ u(
897
+ kn,
895
898
  {
896
899
  className: "content-render-iframe",
897
900
  disableLoadingOverlay: F,
898
901
  hideFullScreen: !0,
899
- locale: f,
900
- dir: X,
901
- lang: Ce,
902
+ locale: d,
903
+ dir: J,
904
+ lang: Te,
902
905
  mode: "blackboard",
903
906
  replaceRootScreenHeightWithFull: t.replaceRootScreenHeightWithFull,
904
907
  type: "sandbox",
905
908
  content: e.content,
906
- enableScaling: qn
909
+ enableScaling: Un
907
910
  }
908
911
  ) : /* @__PURE__ */ u(
909
- On,
912
+ kn,
910
913
  {
911
914
  className: "content-render-iframe",
912
915
  disableLoadingOverlay: F,
913
916
  hideFullScreen: !0,
914
- locale: f,
915
- dir: X,
916
- lang: Ce,
917
+ locale: d,
918
+ dir: J,
919
+ lang: Te,
917
920
  mode: "blackboard",
918
921
  type: "markdown",
919
922
  content: e.content
920
923
  }
921
- ) : null, Cr = (e = [], t = !1) => {
924
+ ) : null, Tr = (e = [], t = !1) => {
922
925
  if (e.length === 0)
923
926
  return null;
924
927
  const n = e.filter(
925
928
  (o) => o.is_renderable !== !1
926
- ).length, i = t && Kn ? ao(e) : "disabled", l = e.reduce(
927
- (o, g, I) => g.is_renderable !== !1 ? I : o,
929
+ ).length, i = t && Hn ? uo(e) : "disabled", l = e.reduce(
930
+ (o, v, I) => v.is_renderable !== !1 ? I : o,
928
931
  -1
929
932
  );
930
933
  return /* @__PURE__ */ u(
931
- Qr,
934
+ to,
932
935
  {
933
936
  className: "slide-stage__content flex w-full flex-col gap-4",
934
937
  mode: i,
935
- children: e.map((o, g) => {
938
+ children: e.map((o, v) => {
936
939
  const I = o.type === "html" && o.is_renderable === !1;
937
940
  return /* @__PURE__ */ u(
938
941
  "div",
939
942
  {
940
- ref: t && g === l ? jt : null,
943
+ ref: t && v === l ? Zt : null,
941
944
  "aria-hidden": I || void 0,
942
- className: be(
945
+ className: we(
943
946
  "w-full shrink-0",
944
947
  n === 1 && o.is_renderable !== !1 && "slide-element--single",
945
948
  I ? "pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0" : o.is_renderable === !1 && "hidden"
@@ -948,13 +951,13 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
948
951
  replaceRootScreenHeightWithFull: n === 1 && o.type === "html" && o.is_renderable !== !1
949
952
  })
950
953
  },
951
- o.sequence_number ?? `${o.type}-${g}`
954
+ o.sequence_number ?? `${o.type}-${v}`
952
955
  );
953
956
  })
954
957
  }
955
958
  );
956
- }, Pr = r(() => {
957
- const e = ae.current;
959
+ }, Rr = r(() => {
960
+ const e = ce.current;
958
961
  if (e) {
959
962
  if (document.fullscreenElement === e) {
960
963
  document.exitFullscreen().catch(() => {
@@ -964,136 +967,136 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
964
967
  e.requestFullscreen?.().catch(() => {
965
968
  });
966
969
  }
967
- }, []), Rn = r(() => {
968
- const e = We.current;
970
+ }, []), On = r(() => {
971
+ const e = Qe.current;
969
972
  e && e.scrollTo({
970
973
  top: e.scrollHeight,
971
974
  behavior: "smooth"
972
975
  });
973
- }, []), Vt = r(
974
- (e) => Fn({
976
+ }, []), Ut = r(
977
+ (e) => Dn({
975
978
  currentIndex: a,
976
979
  resolvedCurrentInteractionElement: S,
977
- slideElementList: b,
978
- targetSlideIndex: Ze[e.audioIndex]
980
+ slideElementList: E,
981
+ targetSlideIndex: Z[e.audioIndex]
979
982
  }),
980
983
  [
981
984
  S,
982
- Ze,
985
+ Z,
983
986
  a,
984
- b
987
+ E
985
988
  ]
986
- ), Tr = r(
989
+ ), _r = r(
987
990
  (e, t) => {
988
- const i = v[e.audioIndex]?.audioKey, l = Ze[e.audioIndex];
989
- return !i || l == null || !Vt(e) ? !1 : (Se(t), j.current = null, x(!1), ot(!1), lt(!1), Ut(t) && (fe(!0), h(!0)), l === a ? (Me.current = null, N(), U(i), yt(e), !0) : (Oe.current = !0, N(), Me.current = {
991
+ const i = y[e.audioIndex]?.audioKey, l = Z[e.audioIndex];
992
+ return !i || l == null || !Ut(e) ? !1 : (be(t), Q.current = null, w(!1), it(!1), at(!1), Gt(t) && (me(!0), g(!0)), l === a ? (Fe.current = null, D(), N(i), gt(e), !0) : (ke.current = !0, D(), Fe.current = {
990
993
  audioIndex: e.audioIndex,
991
994
  audioKey: i,
992
995
  slideIndex: l,
993
996
  timeMs: e.timeMs
994
- }, tt(l), !0));
997
+ }, nt(l), !0));
995
998
  },
996
999
  [
997
- v,
998
- Ze,
999
- Vt,
1000
+ y,
1001
+ Z,
1002
+ Ut,
1000
1003
  a,
1001
- tt,
1002
- yt,
1003
- N,
1004
- h,
1005
- Se
1004
+ nt,
1005
+ gt,
1006
+ D,
1007
+ g,
1008
+ be
1006
1009
  ]
1007
- ), Rr = r(
1010
+ ), Or = r(
1008
1011
  (e) => {
1009
- Se(e), Oe.current = !0, j.current = null, x(!1), Ut(e) && (fe(!0), h(!0)), N(), rn();
1012
+ be(e), ke.current = !0, Q.current = null, w(!1), Gt(e) && (me(!0), g(!0)), D(), on();
1010
1013
  },
1011
1014
  [
1012
- rn,
1013
- N,
1014
- h,
1015
- Se
1015
+ on,
1016
+ D,
1017
+ g,
1018
+ be
1016
1019
  ]
1017
- ), _r = r(
1020
+ ), Mr = r(
1018
1021
  (e) => {
1019
- Se(e), Oe.current = !0, j.current = null, x(!1), Ut(e) && (fe(!0), h(!0)), N(), L();
1022
+ be(e), ke.current = !0, Q.current = null, w(!1), Gt(e) && (me(!0), g(!0)), D(), L();
1020
1023
  },
1021
1024
  [
1022
1025
  L,
1023
- N,
1024
- h,
1025
- Se
1026
+ D,
1027
+ g,
1028
+ be
1026
1029
  ]
1027
- ), Or = r(
1030
+ ), kr = r(
1028
1031
  ({
1029
1032
  loading: e,
1030
1033
  reason: t
1031
1034
  }) => {
1032
1035
  if (F) {
1033
- x(!1);
1036
+ w(!1);
1034
1037
  return;
1035
1038
  }
1036
- if (!A || O) {
1037
- x(!1);
1039
+ if (!b || O) {
1040
+ w(!1);
1038
1041
  return;
1039
1042
  }
1040
- e && t && xt(t), x(Bo(t, e));
1043
+ e && t && Tt(t), w(Ko(t, e));
1041
1044
  },
1042
1045
  [
1043
- A,
1046
+ b,
1044
1047
  O,
1045
1048
  F
1046
1049
  ]
1047
1050
  );
1048
1051
  s(() => {
1049
- F && x(!1);
1052
+ F && w(!1);
1050
1053
  }, [F]);
1051
- const Mr = r(
1054
+ const Fr = r(
1052
1055
  (e) => {
1053
- const t = v[e]?.audioKey;
1054
- if (!t || !E || t !== E)
1056
+ const t = y[e]?.audioKey;
1057
+ if (!t || !x || t !== x)
1055
1058
  return;
1056
- it.current.add(t);
1059
+ lt.current.add(t);
1057
1060
  const n = _.findIndex(
1058
1061
  (o) => o === t
1059
1062
  );
1060
1063
  if (n < 0) {
1061
- U(null);
1064
+ N(null);
1062
1065
  return;
1063
1066
  }
1064
1067
  const i = n + 1, l = _[i];
1065
1068
  if (l) {
1066
- U(l);
1069
+ N(l);
1067
1070
  return;
1068
1071
  }
1069
- if (U(null), ot(!0), x(!1), R) {
1070
- const o = a + 1, g = b[o];
1071
- bn && g?.type === "interaction" && (j.current = o), L();
1072
+ if (N(null), it(!0), w(!1), R) {
1073
+ const o = a + 1, v = E[o];
1074
+ wn && v?.type === "interaction" && (Q.current = o), L();
1072
1075
  return;
1073
1076
  }
1074
1077
  },
1075
1078
  [
1076
- v,
1079
+ y,
1077
1080
  R,
1078
1081
  a,
1079
- E,
1082
+ x,
1080
1083
  _,
1081
1084
  L,
1082
- bn,
1083
- b
1085
+ wn,
1086
+ E
1084
1087
  ]
1085
- ), kr = r(() => {
1086
- je.current = !0, V(), w && Fe(!0);
1087
- }, [V, w]), Fr = r(() => {
1088
- je.current = !1, h(!0);
1089
- }, [h]), qt = r(
1088
+ ), Lr = r(() => {
1089
+ Ze.current = !0, K(), A && De(!0);
1090
+ }, [K, A]), Dr = r(() => {
1091
+ Ze.current = !1, g(!0);
1092
+ }, [g]), Ht = r(
1090
1093
  (e) => {
1091
- e.stopPropagation(), B && h(!0);
1094
+ e.stopPropagation(), V && g(!0);
1092
1095
  },
1093
- [B, h]
1094
- ), ht = r(
1096
+ [V, g]
1097
+ ), vt = r(
1095
1098
  (e, t) => {
1096
- const n = bt.current;
1099
+ const n = wt.current;
1097
1100
  if (!n)
1098
1101
  return null;
1099
1102
  const i = e.getBoundingClientRect(), l = n.getBoundingClientRect();
@@ -1106,79 +1109,79 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
1106
1109
  },
1107
1110
  []
1108
1111
  );
1109
- ko(() => {
1110
- const e = Re.current;
1111
- if (!Ke || !e) {
1112
- ce.current = null;
1112
+ Lo(() => {
1113
+ const e = Oe.current;
1114
+ if (!He || !e) {
1115
+ de.current = null;
1113
1116
  return;
1114
1117
  }
1115
- const t = ce.current, n = e.getBoundingClientRect();
1116
- if (!t || Rt) {
1117
- ce.current = {
1118
+ const t = de.current, n = e.getBoundingClientRect();
1119
+ if (!t || kt) {
1120
+ de.current = {
1118
1121
  left: n.left,
1119
1122
  top: n.top
1120
1123
  };
1121
1124
  return;
1122
1125
  }
1123
1126
  const i = t.left - n.left, l = t.top - n.top;
1124
- if (!Nn(i) && !Nn(l)) {
1125
- ce.current = {
1127
+ if (!Bn(i) && !Bn(l)) {
1128
+ de.current = {
1126
1129
  left: n.left,
1127
1130
  top: n.top
1128
1131
  };
1129
1132
  return;
1130
1133
  }
1131
1134
  const o = {
1132
- x: C.x + i,
1133
- y: C.y + l
1134
- }, g = ht(
1135
+ x: P.x + i,
1136
+ y: P.y + l
1137
+ }, v = vt(
1135
1138
  e,
1136
- C
1137
- ), I = Lo(
1138
- g ? kn(o, g) : o
1139
+ P
1140
+ ), I = No(
1141
+ v ? Ln(o, v) : o
1139
1142
  );
1140
- ce.current = {
1141
- left: n.left + I.x - C.x,
1142
- top: n.top + I.y - C.y
1143
- }, Dn(
1143
+ de.current = {
1144
+ left: n.left + I.x - P.x,
1145
+ top: n.top + I.y - P.y
1146
+ }, Vn(
1144
1147
  I,
1145
- C
1146
- ) || Tt(
1147
- (ne) => Dn(ne, I) ? ne : I
1148
+ P
1149
+ ) || Mt(
1150
+ (oe) => Vn(oe, I) ? oe : I
1148
1151
  );
1149
1152
  }, [
1150
- ht,
1151
- C,
1152
- Rt,
1153
- ut,
1154
- Ke
1153
+ vt,
1154
+ P,
1155
+ kt,
1156
+ dt,
1157
+ He
1155
1158
  ]);
1156
- const Lr = r(
1159
+ const Nr = r(
1157
1160
  (e) => {
1158
- if (qt(e), e.button !== 0 || !e.currentTarget.isConnected || !Re.current)
1161
+ if (Ht(e), e.button !== 0 || !e.currentTarget.isConnected || !Oe.current)
1159
1162
  return;
1160
- const t = ht(
1161
- Re.current,
1162
- C
1163
+ const t = vt(
1164
+ Oe.current,
1165
+ P
1163
1166
  );
1164
- t && (e.preventDefault(), e.currentTarget.hasPointerCapture?.(e.pointerId) !== !0 && e.currentTarget.setPointerCapture(e.pointerId), _e.current = {
1167
+ t && (e.preventDefault(), e.currentTarget.hasPointerCapture?.(e.pointerId) !== !0 && e.currentTarget.setPointerCapture(e.pointerId), Me.current = {
1165
1168
  pointerId: e.pointerId,
1166
1169
  startClientX: e.clientX,
1167
1170
  startClientY: e.clientY,
1168
- startOffset: C,
1171
+ startOffset: P,
1169
1172
  bounds: t
1170
- }, _t(!0));
1173
+ }, Ft(!0));
1171
1174
  },
1172
1175
  [
1173
- ht,
1174
- C,
1175
- qt
1176
+ vt,
1177
+ P,
1178
+ Ht
1176
1179
  ]
1177
- ), Nr = r(
1180
+ ), Br = r(
1178
1181
  (e) => {
1179
- const t = _e.current;
1180
- !t || t.pointerId !== e.pointerId || (e.preventDefault(), e.stopPropagation(), Tt(
1181
- kn(
1182
+ const t = Me.current;
1183
+ !t || t.pointerId !== e.pointerId || (e.preventDefault(), e.stopPropagation(), Mt(
1184
+ Ln(
1182
1185
  {
1183
1186
  x: t.startOffset.x + e.clientX - t.startClientX,
1184
1187
  y: t.startOffset.y + e.clientY - t.startClientY
@@ -1188,99 +1191,99 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
1188
1191
  ));
1189
1192
  },
1190
1193
  []
1191
- ), _n = r(
1194
+ ), Mn = r(
1192
1195
  (e) => {
1193
- const t = _e.current;
1194
- !t || t.pointerId !== e.pointerId || (e.stopPropagation(), e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), _e.current = null, _t(!1));
1196
+ const t = Me.current;
1197
+ !t || t.pointerId !== e.pointerId || (e.stopPropagation(), e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), Me.current = null, Ft(!1));
1195
1198
  },
1196
1199
  []
1197
- ), Dr = r(
1200
+ ), Vr = r(
1198
1201
  (e) => {
1199
- K(), Jt?.(e);
1202
+ H(), jt?.(e);
1200
1203
  },
1201
- [K, Jt]
1202
- ), Br = r(
1204
+ [H, jt]
1205
+ ), Kr = r(
1203
1206
  (e) => {
1204
- K(), Wt?.(e);
1207
+ H(), Qt?.(e);
1205
1208
  },
1206
- [K, Wt]
1207
- ), Vr = r(() => {
1208
- fe(!0), h(!0);
1209
- }, [h]);
1209
+ [H, Qt]
1210
+ ), qr = r(() => {
1211
+ me(!0), g(!0);
1212
+ }, [g]);
1210
1213
  return s(() => {
1211
- const e = Qt.current, i = (e.length > 0 && e.length < de.length && e.every((o, g) => o === de[g]) ? T.slice(e.length) : []).some(
1214
+ const e = en.current, i = (e.length > 0 && e.length < fe.length && e.every((o, v) => o === fe[v]) ? T.slice(e.length) : []).some(
1212
1215
  (o) => o.is_new === !1
1213
1216
  );
1214
- if (Qt.current = de, !i)
1217
+ if (en.current = fe, !i)
1215
1218
  return;
1216
1219
  const l = window.requestAnimationFrame(() => {
1217
- const o = We.current, g = jt.current;
1218
- if (!o || !g)
1220
+ const o = Qe.current, v = Zt.current;
1221
+ if (!o || !v)
1219
1222
  return;
1220
- const I = o.getBoundingClientRect(), ne = g.getBoundingClientRect(), Ue = o.scrollTop + (ne.top - I.top);
1223
+ const I = o.getBoundingClientRect(), oe = v.getBoundingClientRect(), Ye = o.scrollTop + (oe.top - I.top);
1221
1224
  o.scrollTo({
1222
- top: Math.max(Ue, 0),
1225
+ top: Math.max(Ye, 0),
1223
1226
  behavior: "smooth"
1224
1227
  });
1225
1228
  });
1226
1229
  return () => {
1227
1230
  window.cancelAnimationFrame(l);
1228
1231
  };
1229
- }, [T, de]), s(() => {
1230
- if (!Oe.current || (Oe.current = !1, T.length === 0))
1232
+ }, [T, fe]), s(() => {
1233
+ if (!ke.current || (ke.current = !1, T.length === 0))
1231
1234
  return;
1232
1235
  const e = window.requestAnimationFrame(() => {
1233
- Rn();
1236
+ On();
1234
1237
  });
1235
1238
  return () => {
1236
1239
  window.cancelAnimationFrame(e);
1237
1240
  };
1238
- }, [T, Rn]), /* @__PURE__ */ He(
1241
+ }, [T, On]), /* @__PURE__ */ Ge(
1239
1242
  "section",
1240
1243
  {
1241
- ref: ae,
1242
- className: be(
1244
+ ref: ce,
1245
+ className: we(
1243
1246
  "relative h-full w-full",
1244
- D && "slide--mobile-device",
1245
- yn && "slide--browser-fullscreen",
1246
- he && "slide--mobile-landscape",
1247
- mn && "slide--mobile-landscape-native",
1248
- Un
1247
+ B && "slide--mobile-device",
1248
+ gn && "slide--browser-fullscreen",
1249
+ ge && "slide--mobile-landscape",
1250
+ yn && "slide--mobile-landscape-native",
1251
+ Yn
1249
1252
  ),
1250
- dir: X,
1251
- lang: Ce,
1252
- onClick: Vr,
1253
- onFocusCapture: Br,
1254
- onPointerDown: Dr,
1255
- ...Gn,
1253
+ dir: J,
1254
+ lang: Te,
1255
+ onClick: qr,
1256
+ onFocusCapture: Kr,
1257
+ onPointerDown: Vr,
1258
+ ...zn,
1256
1259
  children: [
1257
- ur ? /* @__PURE__ */ u(
1260
+ fr ? /* @__PURE__ */ u(
1258
1261
  "div",
1259
1262
  {
1260
1263
  "aria-hidden": "true",
1261
1264
  className: "pointer-events-none fixed left-0 top-0 z-[9999] h-[100vh] max-h-[100vh] w-[100vw]"
1262
1265
  }
1263
1266
  ) : null,
1264
- /* @__PURE__ */ He(
1267
+ /* @__PURE__ */ Ge(
1265
1268
  "div",
1266
1269
  {
1267
- ref: bt,
1268
- className: be(
1270
+ ref: wt,
1271
+ className: we(
1269
1272
  "slide__viewport relative h-full min-h-0 w-full",
1270
- he && "slide__viewport--mobile-landscape",
1271
- he && !ar && "slide__viewport--mobile-landscape-native"
1273
+ ge && "slide__viewport--mobile-landscape",
1274
+ ge && !cr && "slide__viewport--mobile-landscape-native"
1272
1275
  ),
1273
1276
  children: [
1274
- sr ? /* @__PURE__ */ He("div", { className: "slide-landscape-header", children: [
1277
+ ur ? /* @__PURE__ */ Ge("div", { className: "slide-landscape-header", children: [
1275
1278
  /* @__PURE__ */ u(
1276
1279
  "button",
1277
1280
  {
1278
- "aria-label": $?.backAriaLabel ?? q.fullscreenBackAriaLabel,
1281
+ "aria-label": z?.backAriaLabel ?? U.fullscreenBackAriaLabel,
1279
1282
  className: "slide-landscape-header__back",
1280
- onClick: fr,
1283
+ onClick: pr,
1281
1284
  type: "button",
1282
1285
  children: /* @__PURE__ */ u(
1283
- To,
1286
+ _o,
1284
1287
  {
1285
1288
  className: "slide-landscape-header__icon h-6 w-6",
1286
1289
  strokeWidth: 2.25
@@ -1288,19 +1291,19 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
1288
1291
  )
1289
1292
  }
1290
1293
  ),
1291
- $?.content ? /* @__PURE__ */ u("div", { className: "min-w-0 flex-1 overflow-hidden", children: $.content }) : null
1294
+ z?.content ? /* @__PURE__ */ u("div", { className: "min-w-0 flex-1 overflow-hidden", children: z.content }) : null
1292
1295
  ] }) : null,
1293
1296
  /* @__PURE__ */ u(
1294
1297
  "div",
1295
1298
  {
1296
- className: be(
1299
+ className: we(
1297
1300
  "h-full min-h-0 w-full",
1298
- cr && "slide__viewport-content--with-header",
1299
- Wn ? "slide-content--single" : "grid gap-4"
1301
+ dr && "slide__viewport-content--with-header",
1302
+ Qn ? "slide-content--single" : "grid gap-4"
1300
1303
  ),
1301
- children: T.length > 0 ? /* @__PURE__ */ u("div", { className: "slide-stage", children: /* @__PURE__ */ u("div", { ref: We, className: "slide-stage__layer w-full", children: mr.map(
1304
+ children: T.length > 0 ? /* @__PURE__ */ u("div", { className: "slide-stage", children: /* @__PURE__ */ u("div", { ref: Qe, className: "slide-stage__layer w-full", children: yr.map(
1302
1305
  (e, t) => {
1303
- const n = t === pr;
1306
+ const n = t === hr;
1304
1307
  return /* @__PURE__ */ u(
1305
1308
  "div",
1306
1309
  {
@@ -1308,7 +1311,7 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
1308
1311
  "aria-hidden": !n || void 0,
1309
1312
  className: "w-full h-full",
1310
1313
  style: { display: n ? void 0 : "none" },
1311
- children: Cr(
1314
+ children: Tr(
1312
1315
  e.elementList,
1313
1316
  n
1314
1317
  )
@@ -1319,126 +1322,145 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
1319
1322
  ) }) }) : null
1320
1323
  }
1321
1324
  ),
1322
- er ? /* @__PURE__ */ u(
1323
- zr,
1325
+ nr ? /* @__PURE__ */ u(
1326
+ Wr,
1324
1327
  {
1325
- message: No(
1326
- $n,
1327
- tr
1328
+ message: Bo(
1329
+ Xn,
1330
+ rr
1328
1331
  ),
1329
1332
  className: "absolute left-1/2 top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2"
1330
1333
  }
1331
1334
  ) : null,
1332
1335
  /* @__PURE__ */ u(
1333
- Zr,
1336
+ no,
1334
1337
  {
1335
- extraBottomOffset: or,
1336
- hasPlayerGap: ut,
1337
- isEnabled: sn && nr,
1338
- playbackTimeStore: ye,
1339
- subtitleCues: yr
1338
+ extraBottomOffset: lr,
1339
+ hasPlayerGap: dt,
1340
+ isEnabled: un && or,
1341
+ playbackTimeStore: he,
1342
+ subtitleCues: gr
1340
1343
  }
1341
1344
  ),
1342
- Ke ? /* @__PURE__ */ u(
1345
+ He ? /* @__PURE__ */ u(
1343
1346
  "div",
1344
1347
  {
1345
- ref: Re,
1348
+ ref: Oe,
1346
1349
  "data-player-keyboard-shortcuts-ignore": "true",
1347
- className: be(
1350
+ className: we(
1348
1351
  "slide-interaction-overlay",
1349
- ut ? "slide-interaction-overlay--with-player" : "slide-interaction-overlay--standalone",
1350
- Rt && "slide-interaction-overlay--dragging"
1352
+ dt ? "slide-interaction-overlay--with-player" : "slide-interaction-overlay--standalone",
1353
+ kt && "slide-interaction-overlay--dragging"
1351
1354
  ),
1352
- onClick: qt,
1355
+ onClick: Ht,
1353
1356
  onPointerDownCapture: (e) => {
1354
- Yt(e.target) && st(!0);
1357
+ zt(e.target) && ct(!0);
1355
1358
  },
1356
1359
  onFocusCapture: (e) => {
1357
- Yt(e.target) && st(!0);
1360
+ zt(e.target) && ct(!0);
1358
1361
  },
1359
1362
  onInputCapture: (e) => {
1360
- Yt(e.target) && st(!0);
1363
+ zt(e.target) && ct(!0);
1361
1364
  },
1362
- style: hr,
1365
+ style: vr,
1363
1366
  children: /* @__PURE__ */ u(
1364
- Vn,
1367
+ Kn,
1365
1368
  {
1366
- dir: X,
1367
- lang: Ce,
1369
+ dir: J,
1370
+ lang: Te,
1368
1371
  content: String(S?.content ?? ""),
1369
- dragHandleAriaLabel: z?.dragHandleAriaLabel ?? q.interactionTexts.dragHandleAriaLabel,
1370
- locale: f,
1371
- defaultButtonText: Cn.buttonText ?? "",
1372
- defaultInputText: Cn.inputText ?? "",
1373
- defaultSelectedValues: br,
1374
- confirmButtonText: z?.confirmButtonText ?? q.interactionTexts.confirmButtonText,
1375
- copyButtonText: z?.copyButtonText ?? q.interactionTexts.copyButtonText,
1376
- copiedButtonText: z?.copiedButtonText ?? q.interactionTexts.copiedButtonText,
1377
- onSend: xr,
1378
- onDragHandlePointerCancel: _n,
1379
- onDragHandlePointerDown: Lr,
1380
- onDragHandlePointerMove: Nr,
1381
- onDragHandlePointerUp: _n,
1382
- readonly: wr,
1383
- title: z?.title ?? St ?? q.interactionTexts.title
1372
+ dragHandleAriaLabel: X?.dragHandleAriaLabel ?? U.interactionTexts.dragHandleAriaLabel,
1373
+ locale: d,
1374
+ defaultButtonText: Tn.buttonText ?? "",
1375
+ defaultInputText: Tn.inputText ?? "",
1376
+ defaultSelectedValues: wr,
1377
+ confirmButtonText: X?.confirmButtonText ?? U.interactionTexts.confirmButtonText,
1378
+ copyButtonText: X?.copyButtonText ?? U.interactionTexts.copyButtonText,
1379
+ copiedButtonText: X?.copiedButtonText ?? U.interactionTexts.copiedButtonText,
1380
+ onSend: Cr,
1381
+ onDragHandlePointerCancel: Mn,
1382
+ onDragHandlePointerDown: Nr,
1383
+ onDragHandlePointerMove: Br,
1384
+ onDragHandlePointerUp: Mn,
1385
+ readonly: Pr,
1386
+ title: X?.title ?? bt ?? U.interactionTexts.title
1384
1387
  }
1385
1388
  )
1386
1389
  }
1387
1390
  ) : null,
1388
- w ? /* @__PURE__ */ u(
1389
- no.Provider,
1391
+ A ? /* @__PURE__ */ u(
1392
+ io.Provider,
1390
1393
  {
1391
- value: jn,
1394
+ value: Zn,
1392
1395
  children: /* @__PURE__ */ u(
1393
- jr,
1396
+ eo,
1394
1397
  {
1395
- dir: X === "auto" ? Xn : X,
1396
- lang: Ce,
1397
- audioList: v,
1398
- className: be(
1398
+ dir: J === "auto" ? Wn : J,
1399
+ lang: Te,
1400
+ audioList: y,
1401
+ className: we(
1399
1402
  "absolute left-1/2 z-[2] -translate-x-1/2",
1400
- yn ? "bottom-3" : "-bottom-3",
1401
- G,
1402
- !B && "pointer-events-none opacity-0"
1403
+ gn ? "bottom-3" : "-bottom-3",
1404
+ $,
1405
+ !V && "pointer-events-none opacity-0"
1403
1406
  ),
1404
- currentAudioIndex: P,
1405
- defaultPlaying: wt,
1406
- enableKeyboardShortcuts: le,
1407
- isPlaybackPaused: ee,
1408
- isAutoAdvanceEnabled: Le,
1409
- locale: f,
1410
- isInteractionOpen: me,
1411
- isSubtitleEnabled: sn,
1407
+ currentAudioIndex: C,
1408
+ defaultPlaying: Ct,
1409
+ enableKeyboardShortcuts: se,
1410
+ isPlaybackPaused: ne,
1411
+ isAutoAdvanceEnabled: Ne,
1412
+ locale: d,
1413
+ isInteractionOpen: pe,
1414
+ isSubtitleEnabled: un,
1412
1415
  onAutoAdvanceToggle: ln,
1413
- onLoadingChange: Or,
1416
+ onLoadingChange: kr,
1414
1417
  onPlaybackStarted: () => {
1415
- lt(!0);
1418
+ at(!0);
1416
1419
  },
1417
- onPlaybackPreferenceChange: Ir,
1418
- onPlaybackTimeChange: ye.setTime,
1420
+ onPlaybackCheckpoint: ({ audioKey: e, isComplete: t, timeMs: n }) => {
1421
+ const i = y.findIndex(
1422
+ (o) => o.audioKey === e
1423
+ ), l = i >= 0 ? y[i] : void 0;
1424
+ !l?.audioKey || !l.element || qn?.({
1425
+ audioKey: l.audioKey,
1426
+ element: l.element,
1427
+ isComplete: t,
1428
+ stepIndex: Z[i] ?? a,
1429
+ timeMs: n
1430
+ });
1431
+ },
1432
+ onPlaybackPreferenceChange: Ar,
1433
+ onPlaybackTimeChange: he.setTime,
1419
1434
  onSubtitleToggle: () => {
1420
- rr((e) => !e);
1435
+ ir((e) => !e);
1421
1436
  },
1422
1437
  nextDisabled: !R,
1423
- onEnded: Mr,
1424
- onFullscreen: Pr,
1425
- isFullscreen: un,
1426
- mobileViewMode: Q,
1427
- settingsPortalContainer: bt.current,
1428
- onMobileViewModeChange: dr,
1429
- onControlsPointerEnter: kr,
1430
- onControlsPointerLeave: Fr,
1431
- onNext: _r,
1432
- onPrev: Rr,
1433
- onSubtitleJump: Tr,
1434
- canJumpToSubtitleTarget: Vt,
1435
- prevDisabled: !Jn,
1436
- showControls: B,
1437
- subtitleSeekRequest: Zn,
1438
- texts: It,
1439
- customActionContext: Ft,
1440
- customActions: we,
1441
- useAutoAdvanceToggle: De
1438
+ onEnded: Fr,
1439
+ onFullscreen: Rr,
1440
+ isFullscreen: fn,
1441
+ mobileViewMode: ee,
1442
+ settingsPortalContainer: wt.current,
1443
+ onMobileViewModeChange: mr,
1444
+ onControlsPointerEnter: Lr,
1445
+ onControlsPointerLeave: Dr,
1446
+ onNext: Mr,
1447
+ onPrev: Or,
1448
+ onSubtitleJump: _r,
1449
+ canJumpToSubtitleTarget: Ut,
1450
+ prevDisabled: !jn,
1451
+ showControls: V,
1452
+ subtitleSeekRequest: tr,
1453
+ playbackRestoreRequest: ot && ot.audioKey === pt?.audioKey ? {
1454
+ id: ot.id,
1455
+ timeMs: ot.timeMs
1456
+ } : null,
1457
+ onPlaybackRestoreComplete: (e) => {
1458
+ Be.current?.id === e && (Be.current = null, an(null));
1459
+ },
1460
+ texts: At,
1461
+ customActionContext: Nt,
1462
+ customActions: Pe,
1463
+ useAutoAdvanceToggle: Ve
1442
1464
  }
1443
1465
  )
1444
1466
  }
@@ -1451,6 +1473,6 @@ const Vo = (c, f) => c.length === f.length && c.every((Y, Ae) => {
1451
1473
  );
1452
1474
  };
1453
1475
  export {
1454
- Ci as default
1476
+ Ei as default
1455
1477
  };
1456
1478
  //# sourceMappingURL=Slide.es.js.map