markdown-flow-ui 0.1.100 → 0.1.101

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