markdown-flow-ui 0.1.100-beta.2 → 0.1.100-beta.21

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 (90) hide show
  1. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.cjs.js +1 -1
  2. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.es.js +1 -1
  3. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.cjs.js +1 -1
  4. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  5. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.cjs.js +1 -1
  6. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  7. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.cjs.js +1 -1
  8. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.es.js +1 -1
  9. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.cjs.js +1 -1
  10. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.es.js +1 -1
  11. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.cjs.js +1 -1
  12. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.es.js +1 -1
  13. package/dist/_virtual/index.cjs3.js +1 -1
  14. package/dist/_virtual/index.cjs4.js +1 -1
  15. package/dist/_virtual/index.es3.js +4 -5
  16. package/dist/_virtual/index.es3.js.map +1 -1
  17. package/dist/_virtual/index.es4.js +5 -4
  18. package/dist/_virtual/index.es4.js.map +1 -1
  19. package/dist/assets/markdown-flow-ui.css +1 -1
  20. package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
  21. package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
  22. package/dist/components/ContentRender/ContentRender.d.ts +13 -10
  23. package/dist/components/ContentRender/ContentRender.es.js +175 -158
  24. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  25. package/dist/components/ContentRender/IframeSandbox.cjs.js +3 -3
  26. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  27. package/dist/components/ContentRender/IframeSandbox.d.ts +1 -0
  28. package/dist/components/ContentRender/IframeSandbox.es.js +331 -202
  29. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  30. package/dist/components/ContentRender/SandboxApp.cjs.js +3 -3
  31. package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
  32. package/dist/components/ContentRender/SandboxApp.d.ts +4 -0
  33. package/dist/components/ContentRender/SandboxApp.es.js +144 -111
  34. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  35. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js +1 -1
  36. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js.map +1 -1
  37. package/dist/components/ContentRender/plugins/CustomVariable.es.js +68 -64
  38. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  39. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
  40. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
  41. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +3 -0
  42. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +19 -16
  43. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  44. package/dist/components/Slide/Player.cjs.js +1 -1
  45. package/dist/components/Slide/Player.cjs.js.map +1 -1
  46. package/dist/components/Slide/Player.d.ts +1 -0
  47. package/dist/components/Slide/Player.es.js +208 -168
  48. package/dist/components/Slide/Player.es.js.map +1 -1
  49. package/dist/components/Slide/Slide.cjs.js +1 -1
  50. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  51. package/dist/components/Slide/Slide.d.ts +13 -0
  52. package/dist/components/Slide/Slide.es.js +374 -255
  53. package/dist/components/Slide/Slide.es.js.map +1 -1
  54. package/dist/components/Slide/Slide.stories.d.ts +21 -1
  55. package/dist/components/Slide/index.d.ts +3 -3
  56. package/dist/components/Slide/types.d.ts +6 -6
  57. package/dist/components/Slide/useSlide.cjs.js +1 -1
  58. package/dist/components/Slide/useSlide.cjs.js.map +1 -1
  59. package/dist/components/Slide/useSlide.d.ts +4 -1
  60. package/dist/components/Slide/useSlide.es.js +115 -81
  61. package/dist/components/Slide/useSlide.es.js.map +1 -1
  62. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js +2 -0
  63. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js.map +1 -0
  64. package/dist/components/Slide/useWakePlayerFromIframe.d.ts +7 -0
  65. package/dist/components/Slide/useWakePlayerFromIframe.es.js +89 -0
  66. package/dist/components/Slide/useWakePlayerFromIframe.es.js.map +1 -0
  67. package/dist/components/index.d.ts +4 -2
  68. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  69. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  70. package/dist/index.cjs.js +1 -1
  71. package/dist/index.es.js +24 -22
  72. package/dist/lib/interaction-defaults.cjs.js +2 -0
  73. package/dist/lib/interaction-defaults.cjs.js.map +1 -0
  74. package/dist/lib/interaction-defaults.es.js +106 -0
  75. package/dist/lib/interaction-defaults.es.js.map +1 -0
  76. package/dist/lib/sandboxInteraction.cjs.js +2 -0
  77. package/dist/lib/sandboxInteraction.cjs.js.map +1 -0
  78. package/dist/lib/sandboxInteraction.d.ts +8 -0
  79. package/dist/lib/sandboxInteraction.es.js +12 -0
  80. package/dist/lib/sandboxInteraction.es.js.map +1 -0
  81. package/dist/markdown-flow-ui-lib.css +1 -1
  82. package/dist/renderer.cjs.js +1 -1
  83. package/dist/renderer.d.ts +5 -3
  84. package/dist/renderer.es.js +18 -16
  85. package/package.json +17 -2
  86. package/dist/components/Slide/interaction-defaults.cjs.js +0 -2
  87. package/dist/components/Slide/interaction-defaults.cjs.js.map +0 -1
  88. package/dist/components/Slide/interaction-defaults.es.js +0 -85
  89. package/dist/components/Slide/interaction-defaults.es.js.map +0 -1
  90. /package/dist/{components/Slide → lib}/interaction-defaults.d.ts +0 -0
@@ -1,34 +1,43 @@
1
1
  import { j as t } from "../../_virtual/jsx-runtime.es.js";
2
- import { memo as Fe, useRef as f, useState as m, useCallback as s, useEffect as S, useMemo as L } from "react";
3
- import { hasBrowserUserActivation as Be } from "../../lib/browserUserActivation.es.js";
4
- import { cn as N } from "../../lib/utils.es.js";
5
- import Oe from "../ContentRender/ContentRender.es.js";
6
- import ce from "../ContentRender/IframeSandbox.es.js";
2
+ import { memo as ot, useRef as w, useMemo as b, useState as h, useCallback as l, useEffect as g } from "react";
3
+ import { hasBrowserUserActivation as st } from "../../lib/browserUserActivation.es.js";
4
+ import { isSandboxInteractionMessage as lt } from "../../lib/sandboxInteraction.es.js";
5
+ import { cn as $ } from "../../lib/utils.es.js";
6
+ import it from "../ContentRender/ContentRender.es.js";
7
+ import Re from "../ContentRender/IframeSandbox.es.js";
7
8
  import "../ui/inputGroup/input-group.es.js";
8
- import { getInteractionDefaultValues as Ve, getInteractionDefaultSelectedValues as ke } from "./interaction-defaults.es.js";
9
- import qe from "./Player.es.js";
10
- import De from "./useSlide.es.js";
9
+ import { getInteractionDefaultValues as at, getInteractionDefaultSelectedValues as ct } from "../../lib/interaction-defaults.es.js";
10
+ import ut from "./Player.es.js";
11
+ import dt from "./useSlide.es.js";
12
+ import ft from "./useWakePlayerFromIframe.es.js";
11
13
  /* empty css */
12
- const He = 1e3, ue = Fe(
14
+ import mt from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js";
15
+ const pt = 1e3, je = ot(
13
16
  ({
14
- content: M,
15
- title: $,
16
- defaultButtonText: K,
17
- defaultInputText: U,
17
+ content: A,
18
+ title: E,
19
+ defaultButtonText: d,
20
+ defaultInputText: F,
18
21
  defaultSelectedValues: _,
19
- onSend: z,
20
- readonly: j = !1
22
+ confirmButtonText: oe,
23
+ copyButtonText: R,
24
+ copiedButtonText: q,
25
+ onSend: j,
26
+ readonly: z = !1
21
27
  }) => /* @__PURE__ */ t.jsxs("div", { className: "slide-player__interaction-card", children: [
22
- /* @__PURE__ */ t.jsx("div", { className: "slide-player__interaction-header", children: /* @__PURE__ */ t.jsx("p", { className: "slide-player__interaction-title", children: $ }) }),
28
+ /* @__PURE__ */ t.jsx("div", { className: "slide-player__interaction-header", children: /* @__PURE__ */ t.jsx("p", { className: "slide-player__interaction-title", children: E }) }),
23
29
  /* @__PURE__ */ t.jsx("div", { className: "slide-player__interaction-body", children: /* @__PURE__ */ t.jsx(
24
- Oe,
30
+ it,
25
31
  {
26
- content: M,
27
- defaultButtonText: K,
28
- defaultInputText: U,
32
+ content: A,
33
+ defaultButtonText: d,
34
+ defaultInputText: F,
29
35
  defaultSelectedValues: _,
30
- onSend: z,
31
- readonly: j,
36
+ confirmButtonText: oe,
37
+ copyButtonText: R,
38
+ copiedButtonText: q,
39
+ onSend: j,
40
+ readonly: z,
32
41
  enableTypewriter: !1,
33
42
  sandboxMode: "content"
34
43
  }
@@ -36,147 +45,247 @@ const He = 1e3, ue = Fe(
36
45
  /* @__PURE__ */ t.jsx("div", { className: "slide-player__interaction-arrow" })
37
46
  ] })
38
47
  );
39
- ue.displayName = "InteractionOverlayCard";
40
- const Ze = ({
41
- elementList: M = [],
42
- showPlayer: $ = !0,
43
- playerClassName: K,
44
- interactionTitle: U,
45
- playerAutoHideDelay: _ = 3e3,
46
- className: z,
47
- onPointerDown: j,
48
- ...de
48
+ je.displayName = "InteractionOverlayCard";
49
+ const ht = (A, E) => A.length === E.length && A.every((d, F) => {
50
+ const _ = E[F];
51
+ return d.sequence_number === _?.sequence_number && d.type === _?.type && d.content === _?.content;
52
+ }), Ct = ({
53
+ elementList: A = [],
54
+ showPlayer: E = !0,
55
+ playerAlwaysVisible: d = !1,
56
+ playerClassName: F,
57
+ bufferingText: _ = "Buffering...",
58
+ interactionTitle: oe,
59
+ interactionTexts: R,
60
+ playerAutoHideDelay: q = 3e3,
61
+ interactionDefaultValueOptions: j,
62
+ onSend: z,
63
+ onPlayerVisibilityChange: se,
64
+ onStepChange: ce,
65
+ className: Ce,
66
+ onPointerDown: ue,
67
+ ...Ne
49
68
  }) => {
50
- const X = f(null), G = f(null), Z = f(null), P = f(null), T = f(null), A = f(null), ee = f([]), C = f(!1), {
51
- currentElementList: o,
52
- slideElementList: Y,
53
- currentIndex: te,
54
- audioList: ne,
55
- currentAudioSequenceIndexes: x,
56
- currentInteractionElement: y,
57
- canGoPrev: fe,
58
- canGoNext: h,
59
- handlePrev: re,
60
- handleNext: u
61
- } = De(M), oe = Y.filter(
62
- (e) => e.is_show !== !1
63
- ).length === 1, d = $ && (oe || ne.length > 0 || !!y), [p, J] = m(!0), [R, me] = m(!1), [he, pe] = m(!1), [xe] = m(() => Be()), ye = xe || he, [ve, F] = m(-1), [B, O] = m(-1), [n, Q] = m(), [E, V] = m(!1), v = s(() => {
64
- P.current !== null && (window.clearTimeout(P.current), P.current = null);
65
- }, []), a = s(() => {
66
- A.current !== null && (window.clearTimeout(A.current), A.current = null);
67
- }, []), g = s(() => {
68
- T.current !== null && (window.clearTimeout(T.current), T.current = null);
69
- }, []), w = s(() => {
70
- g(), a(), F(-1), O(-1), Q(void 0), V(!1);
71
- }, [g, a]), k = s(() => {
72
- const e = x[0];
73
- return typeof e != "number" ? !1 : (O(0), F(e), !0);
74
- }, [x]), q = s(() => {
75
- a(), V(!1), !k() && h && u();
69
+ const le = w(null), ie = w(null), de = w(null), L = w(null), M = w(null), H = w(null), fe = w([]), D = w(!1), {
70
+ currentElementList: x,
71
+ stepElementLists: me,
72
+ slideElementList: V,
73
+ currentIndex: f,
74
+ audioList: pe,
75
+ currentAudioSequenceIndexes: y,
76
+ currentStepHasSpeakableElement: C,
77
+ currentInteractionElement: a,
78
+ canGoPrev: Be,
79
+ canGoNext: P,
80
+ handlePrev: he,
81
+ handleNext: I
82
+ } = dt(A), ge = b(() => {
83
+ if (!(f < 0))
84
+ return V[f];
85
+ }, [f, V]), ke = V.filter(
86
+ (e) => e.is_renderable !== !1
87
+ ).length === 1, m = E && (V.length > 0 || pe.length > 0 || !!a), [xe, W] = h(!0), [U, K] = h(!1), [Fe, ae] = h(!1), [qe] = h(() => st()), Le = qe || Fe, [Me, G] = h(-1), [Y, J] = h(-1), [ye, p] = h(!1), [Q, ve] = h(!1), [r, X] = h(), [Z, O] = h(!1), N = m && (d || xe || ye), { mountedStepStates: He, currentMountedStateIndex: Ke } = b(() => {
88
+ const e = [], n = /* @__PURE__ */ new Map();
89
+ return me.forEach((s, u) => {
90
+ const o = e.findIndex(
91
+ (i) => ht(
92
+ i.elementList,
93
+ s
94
+ )
95
+ );
96
+ if (o >= 0) {
97
+ e[o]?.sourceStepIndexes.push(u), n.set(u, o);
98
+ return;
99
+ }
100
+ e.push({
101
+ elementList: s,
102
+ sourceStepIndexes: [u]
103
+ }), n.set(u, e.length - 1);
104
+ }), {
105
+ mountedStepStates: e,
106
+ currentMountedStateIndex: f >= 0 ? n.get(f) ?? -1 : -1
107
+ };
108
+ }, [f, me]), Se = b(() => String(f), [f]), be = b(
109
+ () => String(y[0] ?? "none"),
110
+ [y]
111
+ ), Ie = b(() => a ? `${a.sequence_number ?? "none"}:${String(
112
+ a.content ?? ""
113
+ )}` : "none", [a]), Oe = b(
114
+ () => [
115
+ Se,
116
+ Ie,
117
+ be
118
+ ].join("|"),
119
+ [be, Ie, Se]
120
+ ), T = l(() => {
121
+ L.current !== null && (window.clearTimeout(L.current), L.current = null);
122
+ }, []), v = l(() => {
123
+ H.current !== null && (window.clearTimeout(H.current), H.current = null);
124
+ }, []), B = l(() => {
125
+ M.current !== null && (window.clearTimeout(M.current), M.current = null);
126
+ }, []), k = l(() => {
127
+ B(), v(), G(-1), J(-1), p(!1), ve(!1), X(void 0), O(!1);
128
+ }, [B, v]), ee = l(() => {
129
+ const e = y[0];
130
+ return typeof e != "number" ? !1 : (J(0), G(e), !0);
131
+ }, [y]), te = l(() => {
132
+ v(), O(!1), !ee() && P && I();
76
133
  }, [
77
- h,
78
- a,
79
- u,
80
- k
81
- ]), b = s(
82
- (e = R) => {
83
- d && (J(!0), v(), !(!e || _ <= 0) && (P.current = window.setTimeout(() => {
84
- J(!1), P.current = null;
85
- }, _)));
134
+ P,
135
+ v,
136
+ I,
137
+ ee
138
+ ]), c = l(
139
+ (e = U) => {
140
+ m && (W(!0), T(), !(d || !e || q <= 0) && (L.current = window.setTimeout(() => {
141
+ W(!1), L.current = null;
142
+ }, q)));
86
143
  },
87
144
  [
88
- v,
89
- R,
90
- _,
91
- d
145
+ T,
146
+ U,
147
+ d,
148
+ q,
149
+ m
92
150
  ]
93
- );
94
- S(() => () => {
95
- g(), v(), a();
151
+ ), $e = !!(a?.readonly || a?.user_input?.trim()), ne = !!a && !$e;
152
+ g(() => () => {
153
+ B(), T(), v();
96
154
  }, [
97
- g,
98
- a,
99
- v
100
- ]), S(() => {
101
- if (!d) {
102
- v(), J(!1);
155
+ B,
156
+ v,
157
+ T
158
+ ]), g(() => (se?.(N), () => {
159
+ se?.(!1);
160
+ }), [se, N]), g(() => {
161
+ ce?.(ge, f);
162
+ }, [f, ge, ce]), g(() => {
163
+ if (!m) {
164
+ T(), W(!1);
165
+ return;
166
+ }
167
+ if (d) {
168
+ T(), W(!0);
103
169
  return;
104
170
  }
105
- R || b(!0);
171
+ U || c(!0);
106
172
  }, [
107
- v,
108
- R,
173
+ T,
174
+ U,
109
175
  d,
110
- b
111
- ]), S(() => {
112
- if (w(), !(o.length === 0 && !y)) {
113
- if (y) {
114
- Q(y), V(!0);
176
+ m,
177
+ c
178
+ ]), g(() => {
179
+ if (typeof window > "u")
180
+ return;
181
+ const e = (n) => {
182
+ n.origin === window.location.origin && lt(n.data) && m && (K(!0), c(!0));
183
+ };
184
+ return window.addEventListener("message", e), () => {
185
+ window.removeEventListener("message", e);
186
+ };
187
+ }, [m, c]), ft({
188
+ sectionRef: le,
189
+ enabled: m,
190
+ onWake: () => {
191
+ K(!0), c(!0);
192
+ }
193
+ }), g(() => {
194
+ if (k(), !(x.length === 0 && !a)) {
195
+ if (ne) {
196
+ X(a), O(!0);
115
197
  return;
116
198
  }
117
- if (!k() && h)
118
- return T.current = window.setTimeout(() => {
119
- T.current = null, u();
120
- }, He), () => {
121
- g();
122
- };
199
+ if (a && (X(a), O(!1)), !ee()) {
200
+ if (C) {
201
+ p(!0);
202
+ return;
203
+ }
204
+ if (P)
205
+ return M.current = window.setTimeout(() => {
206
+ M.current = null, I();
207
+ }, pt), () => {
208
+ B();
209
+ };
210
+ }
211
+ }
212
+ }, [
213
+ P,
214
+ B,
215
+ x.length,
216
+ a,
217
+ Oe,
218
+ C,
219
+ I,
220
+ ne,
221
+ k,
222
+ ee
223
+ ]), g(() => {
224
+ if (!C || ne) {
225
+ p(!1);
226
+ return;
227
+ }
228
+ if (Q) {
229
+ p(!1);
230
+ return;
123
231
  }
232
+ y.length === 0 && p(!0);
124
233
  }, [
125
- h,
126
- g,
127
- o,
128
- y,
129
- u,
130
- w,
131
- k
234
+ y.length,
235
+ C,
236
+ Q,
237
+ ne
132
238
  ]);
133
- const se = L(() => n ? Ve(
134
- typeof n.content == "string" ? n.content : void 0,
135
- n.user_input
136
- ) : {}, [n]), ge = L(() => {
137
- if (n)
138
- return ke(
139
- typeof n.content == "string" ? n.content : void 0,
140
- n.user_input
239
+ const we = b(() => r ? at(
240
+ typeof r.content == "string" ? r.content : void 0,
241
+ r.user_input,
242
+ j
243
+ ) : {}, [r, j]), ze = b(() => {
244
+ if (r)
245
+ return ct(
246
+ typeof r.content == "string" ? r.content : void 0,
247
+ r.user_input,
248
+ j
141
249
  );
142
- }, [n]), W = !!n?.user_input?.trim(), we = s(
250
+ }, [r, j]), _e = !!r?.user_input?.trim(), Pe = !!r?.readonly || _e, Te = Pe || _e, De = l(
143
251
  (e) => {
144
- const i = [
252
+ const s = [
145
253
  ...e.selectedValues ?? [],
146
254
  e.inputText?.trim() ?? "",
147
255
  e.buttonText?.trim() ?? ""
148
256
  ].filter(Boolean).join(", ");
149
- Q((r) => !r || !i ? r : {
150
- ...r,
151
- user_input: i
152
- }), q();
257
+ X((u) => !u || !s ? u : {
258
+ ...u,
259
+ user_input: s
260
+ }), z?.(e, r), te();
153
261
  },
154
- [q]
262
+ [r, te, z]
155
263
  );
156
- S(() => {
157
- if (a(), !(!E || !W))
158
- return A.current = window.setTimeout(() => {
159
- A.current = null, q();
264
+ g(() => {
265
+ if (v(), !(!Z || !Te))
266
+ return H.current = window.setTimeout(() => {
267
+ H.current = null, te();
160
268
  }, 2e3), () => {
161
- a();
269
+ v();
162
270
  };
163
271
  }, [
164
- a,
165
- q,
166
- W,
167
- E
272
+ v,
273
+ te,
274
+ Z,
275
+ Te
168
276
  ]);
169
- const be = (e) => e ? e.type === "slot" ? /* @__PURE__ */ t.jsx(t.Fragment, { children: e.content }) : e.type === "html" ? /* @__PURE__ */ t.jsx(
170
- ce,
277
+ const Ve = (e, n = {}) => e ? e.type === "slot" ? /* @__PURE__ */ t.jsx(t.Fragment, { children: e.content }) : e.type === "html" ? /* @__PURE__ */ t.jsx(
278
+ Re,
171
279
  {
172
280
  className: "content-render-iframe",
173
281
  hideFullScreen: !0,
174
282
  mode: "blackboard",
283
+ replaceRootScreenHeightWithFull: n.replaceRootScreenHeightWithFull,
175
284
  type: "sandbox",
176
285
  content: e.content
177
286
  }
178
287
  ) : /* @__PURE__ */ t.jsx(
179
- ce,
288
+ Re,
180
289
  {
181
290
  className: "content-render-iframe",
182
291
  hideFullScreen: !0,
@@ -184,34 +293,36 @@ const Ze = ({
184
293
  type: "markdown",
185
294
  content: e.content
186
295
  }
187
- ) : null, Ie = (e = []) => {
296
+ ) : null, We = (e = [], n = !1) => {
188
297
  if (e.length === 0)
189
298
  return null;
190
- const c = e.filter(
191
- (r) => r.is_show !== !1
192
- ).length, i = e.reduce(
193
- (r, I, l) => I.is_show !== !1 ? l : r,
299
+ const s = e.filter(
300
+ (o) => o.is_renderable !== !1
301
+ ).length, u = e.reduce(
302
+ (o, i, S) => i.is_renderable !== !1 ? S : o,
194
303
  -1
195
304
  );
196
- return /* @__PURE__ */ t.jsx("div", { className: "slide-stage__content flex w-full flex-col gap-4", children: e.map((r, I) => {
197
- const l = r.type === "html" && r.is_show === !1;
305
+ return /* @__PURE__ */ t.jsx("div", { className: "slide-stage__content flex w-full flex-col gap-4", children: e.map((o, i) => {
306
+ const S = o.type === "html" && o.is_renderable === !1;
198
307
  return /* @__PURE__ */ t.jsx(
199
308
  "div",
200
309
  {
201
- ref: I === i ? Z : null,
202
- "aria-hidden": l || void 0,
203
- className: N(
310
+ ref: n && i === u ? de : null,
311
+ "aria-hidden": S || void 0,
312
+ className: $(
204
313
  "w-full shrink-0",
205
- c === 1 && r.is_show !== !1 && "slide-element--single",
206
- l ? "pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0" : r.is_show === !1 && "hidden"
314
+ s === 1 && o.is_renderable !== !1 && "slide-element--single",
315
+ S ? "pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0" : o.is_renderable === !1 && "hidden"
207
316
  ),
208
- children: be(r)
317
+ children: Ve(o, {
318
+ replaceRootScreenHeightWithFull: s === 1 && o.type === "html" && o.is_renderable !== !1
319
+ })
209
320
  },
210
- r.serial_number ?? `${r.type}-${I}`
321
+ o.sequence_number ?? `${o.type}-${i}`
211
322
  );
212
323
  }) });
213
- }, Se = () => {
214
- const e = X.current;
324
+ }, Ue = () => {
325
+ const e = le.current;
215
326
  if (e) {
216
327
  if (document.fullscreenElement) {
217
328
  document.exitFullscreen().catch(() => {
@@ -221,168 +332,176 @@ const Ze = ({
221
332
  e.requestFullscreen?.().catch(() => {
222
333
  });
223
334
  }
224
- }, le = s(() => {
225
- const e = G.current;
335
+ }, Ae = l(() => {
336
+ const e = ie.current;
226
337
  e && e.scrollTo({
227
338
  top: e.scrollHeight,
228
339
  behavior: "smooth"
229
340
  });
230
- }, []), _e = s(() => {
231
- C.current = !0, w(), re();
232
- }, [re, w]), Pe = s(() => {
233
- C.current = !0, w(), u();
234
- }, [u, w]), Te = s(
341
+ }, []), Ge = l(() => {
342
+ D.current = !0, K(!0), ae(!0), p(!1), c(!0), k(), he();
343
+ }, [he, k, c]), Ye = l(() => {
344
+ D.current = !0, K(!0), ae(!0), p(!1), c(!0), k(), I();
345
+ }, [I, k, c]), Je = l(
346
+ (e) => {
347
+ if (!C || Q) {
348
+ p(!1);
349
+ return;
350
+ }
351
+ p(e);
352
+ },
353
+ [C, Q]
354
+ ), Qe = l(
235
355
  (e) => {
236
- if (B < 0 || x[B] !== e)
356
+ if (Y < 0 || y[Y] !== e)
237
357
  return;
238
- const c = B + 1, i = x[c];
239
- if (typeof i == "number") {
240
- O(c), F(i);
358
+ const n = Y + 1, s = y[n];
359
+ if (typeof s == "number") {
360
+ J(n), G(s);
241
361
  return;
242
362
  }
243
- F(-1), O(-1), h && u();
363
+ G(-1), J(-1), ve(!0), p(!1), P && I();
244
364
  },
245
365
  [
246
- h,
247
- x,
248
- B,
249
- u
366
+ P,
367
+ y,
368
+ Y,
369
+ I
250
370
  ]
251
- ), Ae = s(() => {
252
- n && V((e) => !e);
253
- }, [n]), ie = s(
371
+ ), Xe = l(() => {
372
+ r && O((e) => !e);
373
+ }, [r]), Ee = l(
254
374
  (e) => {
255
- e.stopPropagation(), p && b(!0);
375
+ e.stopPropagation(), N && c(!0);
256
376
  },
257
- [p, b]
258
- ), ae = s(
377
+ [xe, c]
378
+ ), Ze = l(
259
379
  (e) => {
260
- j?.(e), me(!0), b(!0);
380
+ ue?.(e), K(!0), c(!0);
261
381
  },
262
- [j, b]
263
- ), Ee = !!n && E, D = L(
264
- () => o.map(
265
- (e, c) => `${e.serial_number ?? `${e.type}-${c}`}:${e.operation ?? ""}`
382
+ [ue, c]
383
+ ), et = !!r && Z, re = b(
384
+ () => x.map(
385
+ (e, n) => `${e.sequence_number ?? `${e.type}-${n}`}:${String(e.is_new ?? "")}`
266
386
  ),
267
- [o]
268
- ), Ne = L(() => {
269
- const e = Y.slice(te + 1).find((i) => i.type === "html");
270
- return !e || o.some(
271
- (i) => i.serial_number === e.serial_number
272
- ) ? o : [...o, { ...e, is_show: !1 }];
273
- }, [o, te, Y]);
274
- return S(() => {
275
- const e = ee.current, r = (e.length > 0 && e.length < D.length && e.every((l, H) => l === D[H]) ? o.slice(e.length) : []).some(
276
- (l) => l.operation === "append"
387
+ [x]
388
+ );
389
+ return g(() => {
390
+ const e = fe.current, u = (e.length > 0 && e.length < re.length && e.every((i, S) => i === re[S]) ? x.slice(e.length) : []).some(
391
+ (i) => i.is_new === !1
277
392
  );
278
- if (ee.current = D, !r)
393
+ if (fe.current = re, !u)
279
394
  return;
280
- const I = window.requestAnimationFrame(() => {
281
- const l = G.current, H = Z.current;
282
- if (!l || !H)
395
+ const o = window.requestAnimationFrame(() => {
396
+ const i = ie.current, S = de.current;
397
+ if (!i || !S)
283
398
  return;
284
- const je = l.getBoundingClientRect(), Ce = H.getBoundingClientRect(), Re = l.scrollTop + (Ce.top - je.top);
285
- l.scrollTo({
286
- top: Math.max(Re, 0),
399
+ const tt = i.getBoundingClientRect(), nt = S.getBoundingClientRect(), rt = i.scrollTop + (nt.top - tt.top);
400
+ i.scrollTo({
401
+ top: Math.max(rt, 0),
287
402
  behavior: "smooth"
288
403
  });
289
404
  });
290
405
  return () => {
291
- window.cancelAnimationFrame(I);
406
+ window.cancelAnimationFrame(o);
292
407
  };
293
- }, [o, D]), S(() => {
294
- if (!C.current || (C.current = !1, o.length === 0))
408
+ }, [x, re]), g(() => {
409
+ if (!D.current || (D.current = !1, x.length === 0))
295
410
  return;
296
411
  const e = window.requestAnimationFrame(() => {
297
- le();
412
+ Ae();
298
413
  });
299
414
  return () => {
300
415
  window.cancelAnimationFrame(e);
301
416
  };
302
- }, [o, le]), console.log(
303
- "currentElement",
304
- o.at(-1),
305
- o,
306
- d,
307
- p,
308
- x,
309
- y,
310
- n,
311
- E
312
- ), /* @__PURE__ */ t.jsxs(
417
+ }, [x, Ae]), /* @__PURE__ */ t.jsxs(
313
418
  "section",
314
419
  {
315
- ref: X,
316
- className: N("relative h-full w-full", z),
317
- onPointerDown: ae,
318
- ...de,
420
+ ref: le,
421
+ className: $("relative h-full w-full", Ce),
422
+ onPointerDown: Ze,
423
+ ...Ne,
319
424
  children: [
320
- /* @__PURE__ */ t.jsxs(
425
+ /* @__PURE__ */ t.jsx(
321
426
  "div",
322
427
  {
323
- className: N(
428
+ className: $(
324
429
  "h-full min-h-0 w-full",
325
- oe ? "slide-content--single" : "grid gap-4"
430
+ ke ? "slide-content--single" : "grid gap-4"
326
431
  ),
327
- children: [
328
- d && !p ? /* @__PURE__ */ t.jsx(
329
- "button",
330
- {
331
- "aria-label": "Show player controls",
332
- className: "slide-player-hit-area",
333
- onPointerDown: ae,
334
- type: "button"
335
- }
336
- ) : null,
337
- o.length > 0 ? /* @__PURE__ */ t.jsx("div", { className: "slide-stage", children: /* @__PURE__ */ t.jsx("div", { ref: G, className: "slide-stage__layer w-full", children: Ie(Ne) }) }) : null
338
- ]
432
+ children: x.length > 0 ? /* @__PURE__ */ t.jsx("div", { className: "slide-stage", children: /* @__PURE__ */ t.jsx("div", { ref: ie, className: "slide-stage__layer w-full", children: He.map(
433
+ (e, n) => {
434
+ const s = n === Ke;
435
+ return /* @__PURE__ */ t.jsx(
436
+ "div",
437
+ {
438
+ "aria-hidden": !s || void 0,
439
+ className: "w-full h-full",
440
+ style: { display: s ? void 0 : "none" },
441
+ children: We(
442
+ e.elementList,
443
+ s
444
+ )
445
+ },
446
+ e.sourceStepIndexes[0] ?? n
447
+ );
448
+ }
449
+ ) }) }) : null
339
450
  }
340
451
  ),
341
- Ee ? /* @__PURE__ */ t.jsx(
452
+ ye ? /* @__PURE__ */ t.jsxs("div", { className: "pointer-events-none absolute left-1/2 top-1/2 z-[3] flex size-28 -translate-x-1/2 -translate-y-1/2 flex-col items-center justify-center gap-2 rounded-2xl bg-foreground/65 px-3 py-4 text-center text-xs leading-4 font-medium text-background shadow-lg backdrop-blur-sm", children: [
453
+ /* @__PURE__ */ t.jsx(mt, { className: "size-5 animate-spin text-background" }),
454
+ /* @__PURE__ */ t.jsx("span", { children: _ })
455
+ ] }) : null,
456
+ et ? /* @__PURE__ */ t.jsx(
342
457
  "div",
343
458
  {
344
- className: N(
459
+ className: $(
345
460
  "slide-interaction-overlay",
346
- p && d ? "slide-interaction-overlay--with-player" : "slide-interaction-overlay--standalone"
461
+ N && m ? "slide-interaction-overlay--with-player" : "slide-interaction-overlay--standalone"
347
462
  ),
348
- onClick: ie,
349
- onPointerDown: ie,
463
+ onClick: Ee,
464
+ onPointerDown: Ee,
350
465
  children: /* @__PURE__ */ t.jsx(
351
- ue,
466
+ je,
352
467
  {
353
- content: String(n?.content ?? ""),
354
- defaultButtonText: se.buttonText ?? "",
355
- defaultInputText: se.inputText ?? "",
356
- defaultSelectedValues: ge,
357
- onSend: we,
358
- readonly: W,
359
- title: U ?? "Submit the content below to continue."
468
+ content: String(r?.content ?? ""),
469
+ defaultButtonText: we.buttonText ?? "",
470
+ defaultInputText: we.inputText ?? "",
471
+ defaultSelectedValues: ze,
472
+ confirmButtonText: R?.confirmButtonText,
473
+ copyButtonText: R?.copyButtonText,
474
+ copiedButtonText: R?.copiedButtonText,
475
+ onSend: De,
476
+ readonly: Pe,
477
+ title: R?.title ?? oe ?? "Submit the content below to continue."
360
478
  }
361
479
  )
362
480
  }
363
481
  ) : null,
364
- d ? /* @__PURE__ */ t.jsx(
365
- qe,
482
+ m ? /* @__PURE__ */ t.jsx(
483
+ ut,
366
484
  {
367
- audioList: ne,
368
- className: N(
485
+ audioList: pe,
486
+ className: $(
369
487
  "absolute left-1/2 bottom-6 z-[2] -translate-x-1/2",
370
- K,
371
- !p && "pointer-events-none opacity-0"
488
+ F,
489
+ !N && "pointer-events-none opacity-0"
372
490
  ),
373
- currentAudioIndex: ve,
374
- defaultPlaying: ye,
375
- hasInteraction: !!n,
376
- isInteractionOpen: E,
377
- nextDisabled: !h,
378
- onEnded: Te,
379
- onFullscreen: Se,
380
- onInteractionToggle: Ae,
381
- onPlayRequest: () => pe(!0),
382
- onNext: Pe,
383
- onPrev: _e,
384
- prevDisabled: !fe,
385
- showControls: p
491
+ currentAudioIndex: Me,
492
+ defaultPlaying: Le,
493
+ hasInteraction: !!r,
494
+ isInteractionOpen: Z,
495
+ onLoadingChange: Je,
496
+ nextDisabled: !P,
497
+ onEnded: Qe,
498
+ onFullscreen: Ue,
499
+ onInteractionToggle: Xe,
500
+ onPlayRequest: () => ae(!0),
501
+ onNext: Ye,
502
+ onPrev: Ge,
503
+ prevDisabled: !Be,
504
+ showControls: N
386
505
  }
387
506
  ) : null
388
507
  ]
@@ -390,6 +509,6 @@ const Ze = ({
390
509
  );
391
510
  };
392
511
  export {
393
- Ze as default
512
+ Ct as default
394
513
  };
395
514
  //# sourceMappingURL=Slide.es.js.map