markdown-flow-ui 0.1.100-beta.47 → 0.1.100-beta.49
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.
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
- package/dist/_virtual/index.cjs4.js +1 -1
- package/dist/_virtual/index.cjs5.js +1 -1
- package/dist/_virtual/index.cjs6.js +1 -1
- package/dist/_virtual/index.cjs7.js +1 -1
- package/dist/_virtual/index.es4.js +4 -4
- package/dist/_virtual/index.es5.js +4 -4
- package/dist/_virtual/index.es6.js +2 -5
- package/dist/_virtual/index.es6.js.map +1 -1
- package/dist/_virtual/index.es7.js +5 -2
- package/dist/_virtual/index.es7.js.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.js +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.js.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.es.js +109 -105
- package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs.js +1 -1
- package/dist/components/Slide/Slide.cjs.js.map +1 -1
- package/dist/components/Slide/Slide.es.js +159 -151
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/lib/interaction-defaults.cjs.js +1 -1
- package/dist/lib/interaction-defaults.cjs.js.map +1 -1
- package/dist/lib/interaction-defaults.es.js +84 -58
- package/dist/lib/interaction-defaults.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slide.cjs.js","sources":["../../../src/components/Slide/Slide.tsx"],"sourcesContent":["import React, {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { LoaderCircle } from \"lucide-react\";\n\nimport { isSandboxInteractionMessage } from \"../../lib/sandboxInteraction\";\nimport { cn } from \"../../lib/utils\";\nimport ContentRender from \"../ContentRender\";\nimport type { ContentRenderProps } from \"../ContentRender/ContentRender\";\nimport IframeSandbox from \"../ContentRender/IframeSandbox\";\nimport type { OnSendContentParams } from \"../types\";\nimport {\n getInteractionDefaultSelectedValues,\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport Player from \"./Player\";\nimport type { PlayerProps } from \"./Player\";\nimport type { Element } from \"./types\";\nimport useSlide from \"./useSlide\";\nimport useWakePlayerFromIframe from \"./useWakePlayerFromIframe\";\nimport { getPlayerCustomActionCount } from \"./utils/playerCustomActions\";\nimport \"./slide.css\";\nexport type { Element, ElementAudioSegment } from \"./types\";\n\nconst CHECKPOINT_AUTO_ADVANCE_DELAY_MS = 1000;\n\ntype RenderSlideElementOptions = {\n replaceRootScreenHeightWithFull?: boolean;\n};\n\ninterface InteractionOverlayCardProps {\n content: string;\n title: string;\n defaultButtonText?: string;\n defaultInputText?: string;\n defaultSelectedValues?: string[];\n confirmButtonText?: string;\n copyButtonText?: string;\n copiedButtonText?: string;\n onSend?: (content: OnSendContentParams) => void;\n readonly?: boolean;\n}\n\nexport interface SlideInteractionTexts extends Pick<\n ContentRenderProps,\n \"confirmButtonText\" | \"copyButtonText\" | \"copiedButtonText\"\n> {\n title?: string;\n}\n\nconst InteractionOverlayCard = memo(\n ({\n content,\n title,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n onSend,\n readonly = false,\n }: InteractionOverlayCardProps) => (\n <div className=\"slide-player__interaction-card\">\n <div className=\"slide-player__interaction-header\">\n <p className=\"slide-player__interaction-title\">{title}</p>\n </div>\n <div className=\"slide-player__interaction-body\">\n <ContentRender\n content={content}\n defaultButtonText={defaultButtonText}\n defaultInputText={defaultInputText}\n defaultSelectedValues={defaultSelectedValues}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n onSend={onSend}\n readonly={readonly}\n enableTypewriter={false}\n sandboxMode=\"content\"\n />\n </div>\n <div className=\"slide-player__interaction-arrow\" />\n </div>\n )\n);\n\nInteractionOverlayCard.displayName = \"InteractionOverlayCard\";\n\nconst areStepElementListsEqual = (\n prevElementList: Element[],\n nextElementList: Element[]\n) =>\n prevElementList.length === nextElementList.length &&\n prevElementList.every((element, index) => {\n const nextElement = nextElementList[index];\n\n return (\n element.sequence_number === nextElement?.sequence_number &&\n element.type === nextElement?.type &&\n element.content === nextElement?.content\n );\n });\n\nexport interface SlideProps extends React.ComponentProps<\"section\"> {\n elementList?: Element[];\n showPlayer?: boolean;\n playerAlwaysVisible?: boolean;\n playerClassName?: string;\n playerCustomActions?: PlayerProps[\"customActions\"];\n bufferingText?: string;\n interactionTitle?: string;\n interactionTexts?: SlideInteractionTexts;\n playerAutoHideDelay?: number;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n onSend?: (content: OnSendContentParams, element?: Element) => void;\n onPlayerVisibilityChange?: (visible: boolean) => void;\n onStepChange?: (element: Element | undefined, index: number) => void;\n}\n\nconst Slide: React.FC<SlideProps> = ({\n elementList = [],\n showPlayer = true,\n playerAlwaysVisible = false,\n playerClassName,\n playerCustomActions,\n bufferingText = \"Buffering...\",\n interactionTitle,\n interactionTexts,\n playerAutoHideDelay = 3000,\n interactionDefaultValueOptions,\n onSend,\n onPlayerVisibilityChange,\n onStepChange,\n className,\n onPointerDown,\n ...props\n}) => {\n const sectionRef = useRef<HTMLElement | null>(null);\n const stageLayerRef = useRef<HTMLDivElement | null>(null);\n const lastElementRef = useRef<HTMLDivElement | null>(null);\n const playerHideTimerRef = useRef<number | null>(null);\n const autoAdvanceTimerRef = useRef<number | null>(null);\n const interactionAutoCloseTimerRef = useRef<number | null>(null);\n const prevRenderElementKeysRef = useRef<string[]>([]);\n const shouldScrollToBottomRef = useRef(false);\n const pendingInteractionOverlayStepIndexRef = useRef<number | null>(null);\n const {\n currentElementList,\n stepElementLists,\n slideElementList,\n currentIndex,\n audioList,\n currentAudioSequenceIndexes,\n currentStepHasSpeakableElement,\n currentInteractionElement,\n canGoPrev,\n canGoNext,\n handlePrev: goPrev,\n handleNext: goNext,\n } = useSlide(elementList);\n const currentStepElement = useMemo(() => {\n if (currentIndex < 0) {\n return undefined;\n }\n\n return slideElementList[currentIndex];\n }, [currentIndex, slideElementList]);\n const visibleMarkerCount = slideElementList.filter(\n (element) => element.is_renderable !== false\n ).length;\n const isSingleSlide = visibleMarkerCount === 1;\n const shouldRenderPlayer =\n showPlayer &&\n (slideElementList.length > 0 ||\n audioList.length > 0 ||\n Boolean(currentInteractionElement));\n const currentAudioSequenceKeys = useMemo(\n () =>\n currentAudioSequenceIndexes\n .map((audioIndex) => audioList[audioIndex]?.audioKey)\n .filter((audioKey): audioKey is string => Boolean(audioKey)),\n [audioList, currentAudioSequenceIndexes]\n );\n const [isPlayerVisible, setIsPlayerVisible] = useState(true);\n const [hasPlayerInteracted, setHasPlayerInteracted] = useState(false);\n const [currentAudioKey, setCurrentAudioKey] = useState<string | null>(null);\n const [isAudioLoadingVisible, setIsAudioLoadingVisible] = useState(false);\n const [hasCompletedCurrentStepAudio, setHasCompletedCurrentStepAudio] =\n useState(false);\n const [activeInteractionElement, setActiveInteractionElement] = useState<\n Element | undefined\n >();\n const [isInteractionOverlayOpen, setIsInteractionOverlayOpen] =\n useState(false);\n const playerVisible =\n shouldRenderPlayer && (playerAlwaysVisible || isPlayerVisible);\n const playerCustomActionCount = useMemo(\n () => getPlayerCustomActionCount(playerCustomActions),\n [playerCustomActions]\n );\n const interactionOverlayStyle = useMemo(\n () =>\n ({\n \"--slide-player-custom-action-count\": String(playerCustomActionCount),\n }) as React.CSSProperties,\n [playerCustomActionCount]\n );\n const { mountedStepStates, currentMountedStateIndex } = useMemo(() => {\n const nextMountedStepStates: Array<{\n elementList: Element[];\n sourceStepIndexes: number[];\n }> = [];\n const mountedStateIndexByStep = new Map<number, number>();\n\n stepElementLists.forEach((stepElementList, stepIndex) => {\n const existingMountedStateIndex = nextMountedStepStates.findIndex(\n (mountedStepState) =>\n areStepElementListsEqual(\n mountedStepState.elementList,\n stepElementList\n )\n );\n\n if (existingMountedStateIndex >= 0) {\n nextMountedStepStates[\n existingMountedStateIndex\n ]?.sourceStepIndexes.push(stepIndex);\n mountedStateIndexByStep.set(stepIndex, existingMountedStateIndex);\n return;\n }\n\n nextMountedStepStates.push({\n elementList: stepElementList,\n sourceStepIndexes: [stepIndex],\n });\n mountedStateIndexByStep.set(stepIndex, nextMountedStepStates.length - 1);\n });\n\n return {\n mountedStepStates: nextMountedStepStates,\n currentMountedStateIndex:\n currentIndex >= 0\n ? (mountedStateIndexByStep.get(currentIndex) ?? -1)\n : -1,\n };\n }, [currentIndex, stepElementLists]);\n const currentStepKey = useMemo(() => String(currentIndex), [currentIndex]);\n const currentAudioIndex = useMemo(() => {\n if (!currentAudioKey) {\n return -1;\n }\n\n return audioList.findIndex(\n (audioItem) => (audioItem.audioKey ?? \"\") === currentAudioKey\n );\n }, [audioList, currentAudioKey]);\n const currentAudioSequenceStartKey = useMemo(\n () => currentAudioSequenceKeys[0] ?? \"none\",\n [currentAudioSequenceKeys]\n );\n const currentInteractionResetKey = useMemo(() => {\n if (!currentInteractionElement) {\n return \"none\";\n }\n\n return `${currentInteractionElement.sequence_number ?? \"none\"}:${String(\n currentInteractionElement.content ?? \"\"\n )}`;\n }, [currentInteractionElement]);\n const currentPlaybackResetKey = useMemo(\n () => [currentStepKey, currentInteractionResetKey].join(\"|\"),\n [currentInteractionResetKey, currentStepKey]\n );\n const currentStepAudioUrl = useMemo(() => {\n if (\n !currentAudioSequenceStartKey ||\n currentAudioSequenceStartKey === \"none\"\n ) {\n return \"\";\n }\n\n const currentStepAudioItem = audioList.find(\n (audioItem) => audioItem.audioKey === currentAudioSequenceStartKey\n );\n\n return currentStepAudioItem?.audioUrl?.trim() ?? \"\";\n }, [audioList, currentAudioSequenceStartKey]);\n const hasCurrentStepAudioUrl = Boolean(currentStepAudioUrl);\n\n const clearPlayerHideTimer = useCallback(() => {\n if (playerHideTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(playerHideTimerRef.current);\n playerHideTimerRef.current = null;\n }, []);\n\n const clearInteractionAutoCloseTimer = useCallback(() => {\n if (interactionAutoCloseTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(interactionAutoCloseTimerRef.current);\n interactionAutoCloseTimerRef.current = null;\n }, []);\n\n const clearAutoAdvanceTimer = useCallback(() => {\n if (autoAdvanceTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(autoAdvanceTimerRef.current);\n autoAdvanceTimerRef.current = null;\n }, []);\n\n const resetAudioSequence = useCallback(() => {\n clearAutoAdvanceTimer();\n clearInteractionAutoCloseTimer();\n setCurrentAudioKey(null);\n setIsAudioLoadingVisible(false);\n setHasCompletedCurrentStepAudio(false);\n setActiveInteractionElement(undefined);\n setIsInteractionOverlayOpen(false);\n }, [clearAutoAdvanceTimer, clearInteractionAutoCloseTimer]);\n\n const startCurrentAudioSequence = useCallback(() => {\n const nextAudioKey = currentAudioSequenceKeys[0];\n\n if (!nextAudioKey) {\n return false;\n }\n\n // Start the first audio segment for the current step immediately.\n setCurrentAudioKey(nextAudioKey);\n return true;\n }, [currentAudioSequenceKeys]);\n\n const continueAfterInteraction = useCallback(() => {\n clearInteractionAutoCloseTimer();\n setIsInteractionOverlayOpen(false);\n\n if (startCurrentAudioSequence()) {\n return;\n }\n\n if (canGoNext) {\n goNext();\n }\n }, [\n canGoNext,\n clearInteractionAutoCloseTimer,\n goNext,\n startCurrentAudioSequence,\n ]);\n\n const showPlayerControls = useCallback(\n (enableAutoHide = hasPlayerInteracted) => {\n if (!shouldRenderPlayer) {\n return;\n }\n\n setIsPlayerVisible(true);\n clearPlayerHideTimer();\n\n if (playerAlwaysVisible || !enableAutoHide || playerAutoHideDelay <= 0) {\n return;\n }\n\n playerHideTimerRef.current = window.setTimeout(() => {\n setIsPlayerVisible(false);\n playerHideTimerRef.current = null;\n }, playerAutoHideDelay);\n },\n [\n clearPlayerHideTimer,\n hasPlayerInteracted,\n playerAlwaysVisible,\n playerAutoHideDelay,\n shouldRenderPlayer,\n ]\n );\n\n const hasResolvedCurrentInteraction = Boolean(\n currentInteractionElement?.readonly ||\n currentInteractionElement?.user_input?.trim()\n );\n\n const shouldBlockPlaybackForInteraction =\n Boolean(currentInteractionElement) && !hasResolvedCurrentInteraction;\n\n useEffect(() => {\n return () => {\n clearAutoAdvanceTimer();\n clearPlayerHideTimer();\n clearInteractionAutoCloseTimer();\n };\n }, [\n clearAutoAdvanceTimer,\n clearInteractionAutoCloseTimer,\n clearPlayerHideTimer,\n ]);\n\n useEffect(() => {\n onPlayerVisibilityChange?.(playerVisible);\n\n return () => {\n onPlayerVisibilityChange?.(false);\n };\n }, [onPlayerVisibilityChange, playerVisible]);\n\n useEffect(() => {\n onStepChange?.(currentStepElement, currentIndex);\n }, [currentIndex, currentStepElement, onStepChange]);\n\n useEffect(() => {\n if (!shouldRenderPlayer) {\n clearPlayerHideTimer();\n setIsPlayerVisible(false);\n return;\n }\n\n if (playerAlwaysVisible) {\n clearPlayerHideTimer();\n setIsPlayerVisible(true);\n return;\n }\n\n if (!hasPlayerInteracted) {\n // Keep the initial player visible briefly, then hide it automatically.\n showPlayerControls(true);\n }\n }, [\n clearPlayerHideTimer,\n hasPlayerInteracted,\n playerAlwaysVisible,\n shouldRenderPlayer,\n showPlayerControls,\n ]);\n\n useEffect(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const handleSandboxInteraction = (event: MessageEvent) => {\n if (event.origin !== window.location.origin) {\n return;\n }\n\n if (!isSandboxInteractionMessage(event.data)) {\n return;\n }\n\n if (!shouldRenderPlayer) {\n return;\n }\n\n // Restore player controls without blocking native iframe scrolling.\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n };\n\n window.addEventListener(\"message\", handleSandboxInteraction);\n\n return () => {\n window.removeEventListener(\"message\", handleSandboxInteraction);\n };\n }, [shouldRenderPlayer, showPlayerControls]);\n\n useWakePlayerFromIframe({\n sectionRef,\n enabled: shouldRenderPlayer,\n onWake: () => {\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n },\n });\n\n useEffect(() => {\n const shouldOpenInteractionOverlayAfterAudio =\n pendingInteractionOverlayStepIndexRef.current === currentIndex &&\n Boolean(currentInteractionElement);\n\n resetAudioSequence();\n\n if (currentElementList.length === 0 && !currentInteractionElement) {\n return;\n }\n\n if (\n shouldBlockPlaybackForInteraction ||\n shouldOpenInteractionOverlayAfterAudio\n ) {\n // Show the interaction gate before playing any follow-up audio.\n setActiveInteractionElement(currentInteractionElement);\n setIsInteractionOverlayOpen(true);\n pendingInteractionOverlayStepIndexRef.current = null;\n return;\n }\n\n if (currentInteractionElement) {\n setActiveInteractionElement(currentInteractionElement);\n setIsInteractionOverlayOpen(false);\n pendingInteractionOverlayStepIndexRef.current = null;\n }\n\n if (startCurrentAudioSequence()) {\n return;\n }\n\n if (currentStepHasSpeakableElement) {\n setIsAudioLoadingVisible(true);\n return;\n }\n\n if (!canGoNext) {\n return;\n }\n\n // Auto-advance silent marker-only steps so playback flow does not stall.\n autoAdvanceTimerRef.current = window.setTimeout(() => {\n autoAdvanceTimerRef.current = null;\n goNext();\n }, CHECKPOINT_AUTO_ADVANCE_DELAY_MS);\n\n return () => {\n clearAutoAdvanceTimer();\n };\n }, [\n canGoNext,\n clearAutoAdvanceTimer,\n currentElementList.length,\n currentInteractionElement,\n currentPlaybackResetKey,\n currentStepHasSpeakableElement,\n goNext,\n shouldBlockPlaybackForInteraction,\n resetAudioSequence,\n startCurrentAudioSequence,\n ]);\n\n useEffect(() => {\n if (!currentStepHasSpeakableElement || shouldBlockPlaybackForInteraction) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (hasCompletedCurrentStepAudio) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (currentAudioSequenceKeys.length === 0) {\n setIsAudioLoadingVisible(true);\n }\n }, [\n currentAudioSequenceKeys.length,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n shouldBlockPlaybackForInteraction,\n ]);\n\n useEffect(() => {\n if (currentAudioKey || currentAudioSequenceKeys.length === 0) {\n return;\n }\n\n if (!currentStepHasSpeakableElement || shouldBlockPlaybackForInteraction) {\n return;\n }\n\n if (hasCompletedCurrentStepAudio) {\n return;\n }\n\n startCurrentAudioSequence();\n }, [\n currentAudioKey,\n currentAudioSequenceKeys,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n shouldBlockPlaybackForInteraction,\n startCurrentAudioSequence,\n ]);\n\n useEffect(() => {\n if (!currentAudioKey || currentAudioIndex >= 0) {\n return;\n }\n\n setCurrentAudioKey(null);\n }, [currentAudioIndex, currentAudioKey]);\n\n useEffect(() => {\n if (!hasCurrentStepAudioUrl) {\n return;\n }\n\n // Treat the arrived audio URL as ready and hide the buffering overlay.\n setIsAudioLoadingVisible(false);\n }, [hasCurrentStepAudioUrl]);\n\n const interactionDefaults = useMemo(() => {\n if (!activeInteractionElement) {\n return {};\n }\n\n return getInteractionDefaultValues(\n typeof activeInteractionElement.content === \"string\"\n ? activeInteractionElement.content\n : undefined,\n activeInteractionElement.user_input,\n interactionDefaultValueOptions\n );\n }, [activeInteractionElement, interactionDefaultValueOptions]);\n\n const interactionDefaultSelectedValues = useMemo(() => {\n if (!activeInteractionElement) {\n return undefined;\n }\n\n return getInteractionDefaultSelectedValues(\n typeof activeInteractionElement.content === \"string\"\n ? activeInteractionElement.content\n : undefined,\n activeInteractionElement.user_input,\n interactionDefaultValueOptions\n );\n }, [activeInteractionElement, interactionDefaultValueOptions]);\n\n const hasResolvedInteractionInput = Boolean(\n activeInteractionElement?.user_input?.trim()\n );\n\n const isInteractionReadonly =\n Boolean(activeInteractionElement?.readonly) || hasResolvedInteractionInput;\n const shouldAutoContinueInteraction =\n isInteractionReadonly || hasResolvedInteractionInput;\n\n const handleInteractionSend = useCallback(\n (content: OnSendContentParams) => {\n const submittedValues = [\n ...(content.selectedValues ?? []),\n content.inputText?.trim() ?? \"\",\n content.buttonText?.trim() ?? \"\",\n ].filter(Boolean);\n const resolvedUserInput = submittedValues.join(\", \");\n\n setActiveInteractionElement((prevElement) => {\n if (!prevElement || !resolvedUserInput) {\n return prevElement;\n }\n\n return {\n ...prevElement,\n user_input: resolvedUserInput,\n };\n });\n\n onSend?.(content, activeInteractionElement);\n continueAfterInteraction();\n },\n [activeInteractionElement, continueAfterInteraction, onSend]\n );\n\n useEffect(() => {\n clearInteractionAutoCloseTimer();\n\n if (!isInteractionOverlayOpen || !shouldAutoContinueInteraction) {\n return;\n }\n\n // Auto-close passive interaction checkpoints to keep playback moving.\n interactionAutoCloseTimerRef.current = window.setTimeout(() => {\n interactionAutoCloseTimerRef.current = null;\n\n continueAfterInteraction();\n }, 2000);\n\n return () => {\n clearInteractionAutoCloseTimer();\n };\n }, [\n clearInteractionAutoCloseTimer,\n continueAfterInteraction,\n isInteractionOverlayOpen,\n shouldAutoContinueInteraction,\n ]);\n\n const renderSlideElement = (\n element?: Element,\n options: RenderSlideElementOptions = {}\n ) => {\n if (!element) {\n return null;\n }\n\n if (element.type === \"slot\") {\n return <>{element.content}</>;\n }\n\n if (element.type === \"html\") {\n return (\n <IframeSandbox\n className=\"content-render-iframe\"\n hideFullScreen\n mode=\"blackboard\"\n replaceRootScreenHeightWithFull={\n options.replaceRootScreenHeightWithFull\n }\n type=\"sandbox\"\n content={element.content as string}\n />\n );\n }\n\n return (\n <IframeSandbox\n className=\"content-render-iframe\"\n hideFullScreen\n mode=\"blackboard\"\n type=\"markdown\"\n content={element.content as string}\n />\n );\n };\n\n const renderSlideElementList = (\n elementList: Element[] = [],\n isActiveStep = false\n ) => {\n if (elementList.length === 0) {\n return null;\n }\n\n const visibleElementCount = elementList.filter(\n (element) => element.is_renderable !== false\n ).length;\n const lastVisibleElementIndex = elementList.reduce(\n (lastVisibleIndex, element, index) =>\n element.is_renderable !== false ? index : lastVisibleIndex,\n -1\n );\n\n return (\n <div className=\"slide-stage__content flex w-full flex-col gap-4\">\n {elementList.map((element, index) => {\n const isPreRenderedHtml =\n element.type === \"html\" && element.is_renderable === false;\n\n return (\n <div\n key={element.sequence_number ?? `${element.type}-${index}`}\n ref={\n isActiveStep && index === lastVisibleElementIndex\n ? lastElementRef\n : null\n }\n aria-hidden={isPreRenderedHtml || undefined}\n className={cn(\n \"w-full shrink-0\",\n visibleElementCount === 1 &&\n element.is_renderable !== false &&\n \"slide-element--single\",\n isPreRenderedHtml\n ? \"pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0\"\n : element.is_renderable === false && \"hidden\"\n )}\n >\n {renderSlideElement(element, {\n replaceRootScreenHeightWithFull:\n visibleElementCount === 1 &&\n element.type === \"html\" &&\n element.is_renderable !== false,\n })}\n </div>\n );\n })}\n </div>\n );\n };\n\n const handleFullscreen = () => {\n const target = sectionRef.current;\n if (!target) return;\n\n if (document.fullscreenElement) {\n document.exitFullscreen().catch(() => {});\n return;\n }\n\n target.requestFullscreen?.().catch(() => {});\n };\n\n const scrollStageToBottom = useCallback(() => {\n const stageLayerElement = stageLayerRef.current;\n\n if (!stageLayerElement) {\n return;\n }\n\n // Keep the latest content visible after manual player navigation.\n stageLayerElement.scrollTo({\n top: stageLayerElement.scrollHeight,\n behavior: \"smooth\",\n });\n }, []);\n\n const handlePrev = useCallback(() => {\n shouldScrollToBottomRef.current = true;\n pendingInteractionOverlayStepIndexRef.current = null;\n setHasPlayerInteracted(true);\n setIsAudioLoadingVisible(false);\n showPlayerControls(true);\n resetAudioSequence();\n goPrev();\n }, [goPrev, resetAudioSequence, showPlayerControls]);\n\n const handleNext = useCallback(() => {\n shouldScrollToBottomRef.current = true;\n pendingInteractionOverlayStepIndexRef.current = null;\n setHasPlayerInteracted(true);\n setIsAudioLoadingVisible(false);\n showPlayerControls(true);\n resetAudioSequence();\n goNext();\n }, [goNext, resetAudioSequence, showPlayerControls]);\n\n const handlePlayerLoadingChange = useCallback(\n (loading: boolean) => {\n if (hasCurrentStepAudioUrl) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (!currentStepHasSpeakableElement || hasCompletedCurrentStepAudio) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n setIsAudioLoadingVisible(loading);\n },\n [\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n hasCurrentStepAudioUrl,\n ]\n );\n\n const handlePlayerEnded = useCallback(\n (audioIndex: number) => {\n const endedAudioKey = audioList[audioIndex]?.audioKey;\n\n if (!endedAudioKey || !currentAudioKey) {\n return;\n }\n\n if (endedAudioKey !== currentAudioKey) {\n return;\n }\n\n const activeSequencePosition = currentAudioSequenceKeys.findIndex(\n (audioSequenceKey) => audioSequenceKey === endedAudioKey\n );\n if (activeSequencePosition < 0) {\n setCurrentAudioKey(null);\n return;\n }\n\n const nextSequencePosition = activeSequencePosition + 1;\n const nextAudioKey = currentAudioSequenceKeys[nextSequencePosition];\n\n if (nextAudioKey) {\n setCurrentAudioKey(nextAudioKey);\n return;\n }\n\n setCurrentAudioKey(null);\n setHasCompletedCurrentStepAudio(true);\n setIsAudioLoadingVisible(false);\n\n if (canGoNext) {\n const nextStepIndex = currentIndex + 1;\n const nextStepElement = slideElementList[nextStepIndex];\n\n if (hasCurrentStepAudioUrl && nextStepElement?.type === \"interaction\") {\n pendingInteractionOverlayStepIndexRef.current = nextStepIndex;\n }\n\n goNext();\n }\n },\n [\n audioList,\n canGoNext,\n currentIndex,\n currentAudioKey,\n currentAudioSequenceKeys,\n goNext,\n hasCurrentStepAudioUrl,\n slideElementList,\n ]\n );\n\n const handleInteractionToggle = useCallback(() => {\n if (!activeInteractionElement) {\n return;\n }\n\n setIsInteractionOverlayOpen((prevOpen) => !prevOpen);\n }, [activeInteractionElement]);\n\n const stopOverlayPropagation = useCallback(\n (\n event:\n | React.PointerEvent<HTMLDivElement>\n | React.MouseEvent<HTMLDivElement>\n ) => {\n event.stopPropagation();\n\n // Keep the player visible a bit longer when users interact with the overlay.\n if (playerVisible) {\n showPlayerControls(true);\n }\n },\n [isPlayerVisible, showPlayerControls]\n );\n\n const handleSurfacePointerDown = useCallback(\n (event: React.PointerEvent<HTMLElement>) => {\n onPointerDown?.(event);\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n },\n [onPointerDown, showPlayerControls]\n );\n\n const shouldShowInteractionOverlay =\n Boolean(activeInteractionElement) && isInteractionOverlayOpen;\n const currentRenderElementKeys = useMemo(\n () =>\n currentElementList.map(\n (element, index) =>\n `${element.sequence_number ?? `${element.type}-${index}`}:${String(element.is_new ?? \"\")}`\n ),\n [currentElementList]\n );\n\n useEffect(() => {\n const prevKeys = prevRenderElementKeysRef.current;\n const hasStablePrefix =\n prevKeys.length > 0 &&\n prevKeys.length < currentRenderElementKeys.length &&\n prevKeys.every((key, index) => key === currentRenderElementKeys[index]);\n const appendedElements = hasStablePrefix\n ? currentElementList.slice(prevKeys.length)\n : [];\n const shouldAutoScrollToAppend = appendedElements.some(\n (element) => element.is_new === false\n );\n\n prevRenderElementKeysRef.current = currentRenderElementKeys;\n\n if (!shouldAutoScrollToAppend) {\n return;\n }\n\n const animationFrameId = window.requestAnimationFrame(() => {\n const stageLayerElement = stageLayerRef.current;\n const targetElement = lastElementRef.current;\n\n if (!stageLayerElement || !targetElement) {\n return;\n }\n\n const stageLayerRect = stageLayerElement.getBoundingClientRect();\n const targetRect = targetElement.getBoundingClientRect();\n const nextScrollTop =\n stageLayerElement.scrollTop + (targetRect.top - stageLayerRect.top);\n\n // Keep newly appended content visible when the current slide grows downward.\n stageLayerElement.scrollTo({\n top: Math.max(nextScrollTop, 0),\n behavior: \"smooth\",\n });\n });\n\n return () => {\n window.cancelAnimationFrame(animationFrameId);\n };\n }, [currentElementList, currentRenderElementKeys]);\n\n useEffect(() => {\n if (!shouldScrollToBottomRef.current) {\n return;\n }\n\n shouldScrollToBottomRef.current = false;\n\n if (currentElementList.length === 0) {\n return;\n }\n\n const animationFrameId = window.requestAnimationFrame(() => {\n scrollStageToBottom();\n });\n\n return () => {\n window.cancelAnimationFrame(animationFrameId);\n };\n }, [currentElementList, scrollStageToBottom]);\n\n return (\n <section\n ref={sectionRef}\n className={cn(\"relative h-full w-full\", className)}\n onPointerDown={handleSurfacePointerDown}\n {...props}\n >\n <div\n className={cn(\n \"h-full min-h-0 w-full\",\n isSingleSlide ? \"slide-content--single\" : \"grid gap-4\"\n )}\n >\n {currentElementList.length > 0 ? (\n <div className=\"slide-stage\">\n <div ref={stageLayerRef} className=\"slide-stage__layer w-full\">\n {mountedStepStates.map(\n (mountedStepState, mountedStepStateIndex) => {\n const isActiveStep =\n mountedStepStateIndex === currentMountedStateIndex;\n\n return (\n <div\n key={\n mountedStepState.sourceStepIndexes[0] ??\n mountedStepStateIndex\n }\n aria-hidden={!isActiveStep || undefined}\n className=\"w-full h-full\"\n style={{ display: isActiveStep ? undefined : \"none\" }}\n >\n {renderSlideElementList(\n mountedStepState.elementList,\n isActiveStep\n )}\n </div>\n );\n }\n )}\n </div>\n </div>\n ) : null}\n </div>\n\n {isAudioLoadingVisible ? (\n <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\">\n <LoaderCircle className=\"size-5 animate-spin text-background\" />\n <span>{bufferingText}</span>\n </div>\n ) : null}\n\n {shouldShowInteractionOverlay ? (\n <div\n className={cn(\n \"slide-interaction-overlay\",\n playerVisible && shouldRenderPlayer\n ? \"slide-interaction-overlay--with-player\"\n : \"slide-interaction-overlay--standalone\"\n )}\n onClick={stopOverlayPropagation}\n onPointerDown={stopOverlayPropagation}\n style={interactionOverlayStyle}\n >\n <InteractionOverlayCard\n content={String(activeInteractionElement?.content ?? \"\")}\n defaultButtonText={interactionDefaults.buttonText ?? \"\"}\n defaultInputText={interactionDefaults.inputText ?? \"\"}\n defaultSelectedValues={interactionDefaultSelectedValues}\n confirmButtonText={interactionTexts?.confirmButtonText}\n copyButtonText={interactionTexts?.copyButtonText}\n copiedButtonText={interactionTexts?.copiedButtonText}\n onSend={handleInteractionSend}\n readonly={isInteractionReadonly}\n title={\n interactionTexts?.title ??\n interactionTitle ??\n \"Submit the content below to continue.\"\n }\n />\n </div>\n ) : null}\n\n {shouldRenderPlayer ? (\n <Player\n audioList={audioList}\n className={cn(\n \"absolute left-1/2 bottom-6 z-[2] -translate-x-1/2\",\n playerClassName,\n !playerVisible && \"pointer-events-none opacity-0\"\n )}\n currentAudioIndex={currentAudioIndex}\n defaultPlaying\n hasInteraction={Boolean(activeInteractionElement)}\n isInteractionOpen={isInteractionOverlayOpen}\n onLoadingChange={handlePlayerLoadingChange}\n nextDisabled={!canGoNext}\n onEnded={handlePlayerEnded}\n onFullscreen={handleFullscreen}\n onInteractionToggle={handleInteractionToggle}\n onNext={handleNext}\n onPrev={handlePrev}\n prevDisabled={!canGoPrev}\n showControls={playerVisible}\n customActions={playerCustomActions}\n />\n ) : null}\n </section>\n );\n};\n\nexport default Slide;\n"],"names":["CHECKPOINT_AUTO_ADVANCE_DELAY_MS","InteractionOverlayCard","memo","content","title","defaultButtonText","defaultInputText","defaultSelectedValues","confirmButtonText","copyButtonText","copiedButtonText","onSend","readonly","jsxs","jsx","ContentRender","areStepElementListsEqual","prevElementList","nextElementList","element","index","nextElement","Slide","elementList","showPlayer","playerAlwaysVisible","playerClassName","playerCustomActions","bufferingText","interactionTitle","interactionTexts","playerAutoHideDelay","interactionDefaultValueOptions","onPlayerVisibilityChange","onStepChange","className","onPointerDown","props","sectionRef","useRef","stageLayerRef","lastElementRef","playerHideTimerRef","autoAdvanceTimerRef","interactionAutoCloseTimerRef","prevRenderElementKeysRef","shouldScrollToBottomRef","pendingInteractionOverlayStepIndexRef","currentElementList","stepElementLists","slideElementList","currentIndex","audioList","currentAudioSequenceIndexes","currentStepHasSpeakableElement","currentInteractionElement","canGoPrev","canGoNext","goPrev","goNext","useSlide","currentStepElement","useMemo","isSingleSlide","shouldRenderPlayer","currentAudioSequenceKeys","audioIndex","audioKey","isPlayerVisible","setIsPlayerVisible","useState","hasPlayerInteracted","setHasPlayerInteracted","currentAudioKey","setCurrentAudioKey","isAudioLoadingVisible","setIsAudioLoadingVisible","hasCompletedCurrentStepAudio","setHasCompletedCurrentStepAudio","activeInteractionElement","setActiveInteractionElement","isInteractionOverlayOpen","setIsInteractionOverlayOpen","playerVisible","playerCustomActionCount","getPlayerCustomActionCount","interactionOverlayStyle","mountedStepStates","currentMountedStateIndex","nextMountedStepStates","mountedStateIndexByStep","stepElementList","stepIndex","existingMountedStateIndex","mountedStepState","currentStepKey","currentAudioIndex","audioItem","currentAudioSequenceStartKey","currentInteractionResetKey","currentPlaybackResetKey","hasCurrentStepAudioUrl","clearPlayerHideTimer","useCallback","clearInteractionAutoCloseTimer","clearAutoAdvanceTimer","resetAudioSequence","startCurrentAudioSequence","nextAudioKey","continueAfterInteraction","showPlayerControls","enableAutoHide","hasResolvedCurrentInteraction","shouldBlockPlaybackForInteraction","useEffect","handleSandboxInteraction","event","isSandboxInteractionMessage","useWakePlayerFromIframe","shouldOpenInteractionOverlayAfterAudio","interactionDefaults","getInteractionDefaultValues","interactionDefaultSelectedValues","getInteractionDefaultSelectedValues","hasResolvedInteractionInput","isInteractionReadonly","shouldAutoContinueInteraction","handleInteractionSend","resolvedUserInput","prevElement","renderSlideElement","options","Fragment","IframeSandbox","renderSlideElementList","isActiveStep","visibleElementCount","lastVisibleElementIndex","lastVisibleIndex","isPreRenderedHtml","cn","handleFullscreen","target","scrollStageToBottom","stageLayerElement","handlePrev","handleNext","handlePlayerLoadingChange","loading","handlePlayerEnded","endedAudioKey","activeSequencePosition","audioSequenceKey","nextSequencePosition","nextStepIndex","nextStepElement","handleInteractionToggle","prevOpen","stopOverlayPropagation","handleSurfacePointerDown","shouldShowInteractionOverlay","currentRenderElementKeys","prevKeys","shouldAutoScrollToAppend","key","animationFrameId","targetElement","stageLayerRect","targetRect","nextScrollTop","mountedStepStateIndex","LoaderCircle","Player"],"mappings":"w0BA8BMA,GAAmC,IA0BnCC,GAAyBC,EAAAA,KAC7B,CAAC,CACC,QAAAC,EACA,MAAAC,EACA,kBAAAC,EACA,iBAAAC,EACA,sBAAAC,EACA,kBAAAC,GACA,eAAAC,GACA,iBAAAC,EACA,OAAAC,EACA,SAAAC,EAAW,EAAA,IAEXC,EAAAA,kBAAAA,KAAC,MAAA,CAAI,UAAU,iCACb,SAAA,CAAAC,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,mCACb,SAAAA,EAAAA,kBAAAA,IAAC,KAAE,UAAU,kCAAmC,WAAM,CAAA,CACxD,EACAA,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,iCACb,SAAAA,EAAAA,kBAAAA,IAACC,GAAAA,QAAA,CACC,QAAAZ,EACA,kBAAAE,EACA,iBAAAC,EACA,sBAAAC,EACA,kBAAAC,GACA,eAAAC,GACA,iBAAAC,EACA,OAAAC,EACA,SAAAC,EACA,iBAAkB,GAClB,YAAY,SAAA,CAAA,EAEhB,EACAE,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,iCAAA,CAAkC,CAAA,CAAA,CACnD,CAEJ,EAEAb,GAAuB,YAAc,yBAErC,MAAMe,GAA2B,CAC/BC,EACAC,IAEAD,EAAgB,SAAWC,EAAgB,QAC3CD,EAAgB,MAAM,CAACE,EAASC,IAAU,CACx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AAI,UAAU,4QACb,SAAA,CAAAC,EAAAA,kBAAAA,IAAC6J,GAAAA,QAAA,CAAa,UAAU,qCAAA,CAAsC,EAC9D7J,EAAAA,kBAAAA,IAAC,QAAM,SAAAc,EAAA,CAAc,CAAA,CAAA,CACvB,EACE,KAEHoI,GACClJ,EAAAA,kBAAAA,IAAC,MAAA,CACC,UAAW8H,EAAAA,GACT,4BACAzD,GAAiBnB,EACb,yCACA,uCAAA,EAEN,QAAS8F,GACT,cAAeA,GACf,MAAOxE,GAEP,SAAAxE,EAAAA,kBAAAA,IAACb,GAAA,CACC,QAAS,OAAO8E,GAA0B,SAAW,EAAE,EACvD,kBAAmByC,GAAoB,YAAc,GACrD,iBAAkBA,GAAoB,WAAa,GACnD,sBAAuBE,GACvB,kBAAmB5F,GAAkB,kBACrC,eAAgBA,GAAkB,eAClC,iBAAkBA,GAAkB,iBACpC,OAAQiG,GACR,SAAUF,GACV,MACE/F,GAAkB,OAClBD,IACA,uCAAA,CAAA,CAEJ,CAAA,EAEA,KAEHmC,EACClD,EAAAA,kBAAAA,IAAC8J,GAAAA,QAAA,CACC,UAAAxH,EACA,UAAWwF,EAAAA,GACT,oDACAlH,EACA,CAACyD,GAAiB,+BAAA,EAEpB,kBAAAa,GACA,eAAc,GACd,eAAgB,EAAQjB,EACxB,kBAAmBE,EACnB,gBAAiBkE,GACjB,aAAc,CAAC1F,EACf,QAAS4F,GACT,aAAcR,GACd,oBAAqBe,GACrB,OAAQV,GACR,OAAQD,GACR,aAAc,CAACzF,GACf,aAAc2B,EACd,cAAexD,CAAA,CAAA,EAEf,IAAA,CAAA,CAAA,CAGV"}
|
|
1
|
+
{"version":3,"file":"Slide.cjs.js","sources":["../../../src/components/Slide/Slide.tsx"],"sourcesContent":["import React, {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { LoaderCircle } from \"lucide-react\";\n\nimport { isSandboxInteractionMessage } from \"../../lib/sandboxInteraction\";\nimport { cn } from \"../../lib/utils\";\nimport ContentRender from \"../ContentRender\";\nimport type { ContentRenderProps } from \"../ContentRender/ContentRender\";\nimport IframeSandbox from \"../ContentRender/IframeSandbox\";\nimport type { OnSendContentParams } from \"../types\";\nimport {\n getInteractionDefaultSelectedValues,\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport Player from \"./Player\";\nimport type { PlayerProps } from \"./Player\";\nimport type { Element } from \"./types\";\nimport useSlide from \"./useSlide\";\nimport useWakePlayerFromIframe from \"./useWakePlayerFromIframe\";\nimport { getPlayerCustomActionCount } from \"./utils/playerCustomActions\";\nimport \"./slide.css\";\nexport type { Element, ElementAudioSegment } from \"./types\";\n\nconst CHECKPOINT_AUTO_ADVANCE_DELAY_MS = 1000;\n\ntype RenderSlideElementOptions = {\n replaceRootScreenHeightWithFull?: boolean;\n};\n\ninterface InteractionOverlayCardProps {\n content: string;\n title: string;\n defaultButtonText?: string;\n defaultInputText?: string;\n defaultSelectedValues?: string[];\n confirmButtonText?: string;\n copyButtonText?: string;\n copiedButtonText?: string;\n onSend?: (content: OnSendContentParams) => void;\n readonly?: boolean;\n}\n\nexport interface SlideInteractionTexts extends Pick<\n ContentRenderProps,\n \"confirmButtonText\" | \"copyButtonText\" | \"copiedButtonText\"\n> {\n title?: string;\n}\n\nconst InteractionOverlayCard = memo(\n ({\n content,\n title,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n onSend,\n readonly = false,\n }: InteractionOverlayCardProps) => (\n <div className=\"slide-player__interaction-card\">\n <div className=\"slide-player__interaction-header\">\n <p className=\"slide-player__interaction-title\">{title}</p>\n </div>\n <div className=\"slide-player__interaction-body\">\n <ContentRender\n content={content}\n defaultButtonText={defaultButtonText}\n defaultInputText={defaultInputText}\n defaultSelectedValues={defaultSelectedValues}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n onSend={onSend}\n readonly={readonly}\n enableTypewriter={false}\n sandboxMode=\"content\"\n />\n </div>\n <div className=\"slide-player__interaction-arrow\" />\n </div>\n )\n);\n\nInteractionOverlayCard.displayName = \"InteractionOverlayCard\";\n\nconst areStepElementListsEqual = (\n prevElementList: Element[],\n nextElementList: Element[]\n) =>\n prevElementList.length === nextElementList.length &&\n prevElementList.every((element, index) => {\n const nextElement = nextElementList[index];\n\n return (\n element.sequence_number === nextElement?.sequence_number &&\n element.type === nextElement?.type &&\n element.content === nextElement?.content\n );\n });\n\nexport interface SlideProps extends React.ComponentProps<\"section\"> {\n elementList?: Element[];\n showPlayer?: boolean;\n playerAlwaysVisible?: boolean;\n playerClassName?: string;\n playerCustomActions?: PlayerProps[\"customActions\"];\n bufferingText?: string;\n interactionTitle?: string;\n interactionTexts?: SlideInteractionTexts;\n playerAutoHideDelay?: number;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n onSend?: (content: OnSendContentParams, element?: Element) => void;\n onPlayerVisibilityChange?: (visible: boolean) => void;\n onStepChange?: (element: Element | undefined, index: number) => void;\n}\n\nconst Slide: React.FC<SlideProps> = ({\n elementList = [],\n showPlayer = true,\n playerAlwaysVisible = false,\n playerClassName,\n playerCustomActions,\n bufferingText = \"Buffering...\",\n interactionTitle,\n interactionTexts,\n playerAutoHideDelay = 3000,\n interactionDefaultValueOptions,\n onSend,\n onPlayerVisibilityChange,\n onStepChange,\n className,\n onPointerDown,\n ...props\n}) => {\n const sectionRef = useRef<HTMLElement | null>(null);\n const stageLayerRef = useRef<HTMLDivElement | null>(null);\n const lastElementRef = useRef<HTMLDivElement | null>(null);\n const playerHideTimerRef = useRef<number | null>(null);\n const autoAdvanceTimerRef = useRef<number | null>(null);\n const interactionAutoCloseTimerRef = useRef<number | null>(null);\n const prevRenderElementKeysRef = useRef<string[]>([]);\n const shouldScrollToBottomRef = useRef(false);\n const pendingInteractionOverlayStepIndexRef = useRef<number | null>(null);\n const {\n currentElementList,\n stepElementLists,\n slideElementList,\n currentIndex,\n audioList,\n currentAudioSequenceIndexes,\n currentStepHasSpeakableElement,\n currentInteractionElement,\n canGoPrev,\n canGoNext,\n handlePrev: goPrev,\n handleNext: goNext,\n } = useSlide(elementList);\n const currentStepElement = useMemo(() => {\n if (currentIndex < 0) {\n return undefined;\n }\n\n return slideElementList[currentIndex];\n }, [currentIndex, slideElementList]);\n const visibleMarkerCount = slideElementList.filter(\n (element) => element.is_renderable !== false\n ).length;\n const isSingleSlide = visibleMarkerCount === 1;\n const shouldRenderPlayer =\n showPlayer &&\n (slideElementList.length > 0 ||\n audioList.length > 0 ||\n Boolean(currentInteractionElement));\n const currentAudioSequenceKeys = useMemo(\n () =>\n currentAudioSequenceIndexes\n .map((audioIndex) => audioList[audioIndex]?.audioKey)\n .filter((audioKey): audioKey is string => Boolean(audioKey)),\n [audioList, currentAudioSequenceIndexes]\n );\n const [isPlayerVisible, setIsPlayerVisible] = useState(true);\n const [hasPlayerInteracted, setHasPlayerInteracted] = useState(false);\n const [currentAudioKey, setCurrentAudioKey] = useState<string | null>(null);\n const [isAudioLoadingVisible, setIsAudioLoadingVisible] = useState(false);\n const [hasCompletedCurrentStepAudio, setHasCompletedCurrentStepAudio] =\n useState(false);\n const [activeInteractionElement, setActiveInteractionElement] = useState<\n Element | undefined\n >();\n const [isInteractionOverlayOpen, setIsInteractionOverlayOpen] =\n useState(false);\n const playerVisible =\n shouldRenderPlayer && (playerAlwaysVisible || isPlayerVisible);\n const playerCustomActionCount = useMemo(\n () => getPlayerCustomActionCount(playerCustomActions),\n [playerCustomActions]\n );\n const interactionOverlayStyle = useMemo(\n () =>\n ({\n \"--slide-player-custom-action-count\": String(playerCustomActionCount),\n }) as React.CSSProperties,\n [playerCustomActionCount]\n );\n const { mountedStepStates, currentMountedStateIndex } = useMemo(() => {\n const nextMountedStepStates: Array<{\n elementList: Element[];\n sourceStepIndexes: number[];\n }> = [];\n const mountedStateIndexByStep = new Map<number, number>();\n\n stepElementLists.forEach((stepElementList, stepIndex) => {\n const existingMountedStateIndex = nextMountedStepStates.findIndex(\n (mountedStepState) =>\n areStepElementListsEqual(\n mountedStepState.elementList,\n stepElementList\n )\n );\n\n if (existingMountedStateIndex >= 0) {\n nextMountedStepStates[\n existingMountedStateIndex\n ]?.sourceStepIndexes.push(stepIndex);\n mountedStateIndexByStep.set(stepIndex, existingMountedStateIndex);\n return;\n }\n\n nextMountedStepStates.push({\n elementList: stepElementList,\n sourceStepIndexes: [stepIndex],\n });\n mountedStateIndexByStep.set(stepIndex, nextMountedStepStates.length - 1);\n });\n\n return {\n mountedStepStates: nextMountedStepStates,\n currentMountedStateIndex:\n currentIndex >= 0\n ? (mountedStateIndexByStep.get(currentIndex) ?? -1)\n : -1,\n };\n }, [currentIndex, stepElementLists]);\n const currentStepKey = useMemo(() => String(currentIndex), [currentIndex]);\n const currentAudioIndex = useMemo(() => {\n if (!currentAudioKey) {\n return -1;\n }\n\n return audioList.findIndex(\n (audioItem) => (audioItem.audioKey ?? \"\") === currentAudioKey\n );\n }, [audioList, currentAudioKey]);\n const currentAudioSequenceStartKey = useMemo(\n () => currentAudioSequenceKeys[0] ?? \"none\",\n [currentAudioSequenceKeys]\n );\n const currentInteractionResetKey = useMemo(() => {\n if (!currentInteractionElement) {\n return \"none\";\n }\n\n return `${currentInteractionElement.sequence_number ?? \"none\"}:${String(\n currentInteractionElement.content ?? \"\"\n )}`;\n }, [currentInteractionElement]);\n const currentPlaybackResetKey = useMemo(\n () => [currentStepKey, currentInteractionResetKey].join(\"|\"),\n [currentInteractionResetKey, currentStepKey]\n );\n const currentStepAudioUrl = useMemo(() => {\n if (\n !currentAudioSequenceStartKey ||\n currentAudioSequenceStartKey === \"none\"\n ) {\n return \"\";\n }\n\n const currentStepAudioItem = audioList.find(\n (audioItem) => audioItem.audioKey === currentAudioSequenceStartKey\n );\n\n return currentStepAudioItem?.audioUrl?.trim() ?? \"\";\n }, [audioList, currentAudioSequenceStartKey]);\n const hasCurrentStepAudioUrl = Boolean(currentStepAudioUrl);\n\n const clearPlayerHideTimer = useCallback(() => {\n if (playerHideTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(playerHideTimerRef.current);\n playerHideTimerRef.current = null;\n }, []);\n\n const clearInteractionAutoCloseTimer = useCallback(() => {\n if (interactionAutoCloseTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(interactionAutoCloseTimerRef.current);\n interactionAutoCloseTimerRef.current = null;\n }, []);\n\n const clearAutoAdvanceTimer = useCallback(() => {\n if (autoAdvanceTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(autoAdvanceTimerRef.current);\n autoAdvanceTimerRef.current = null;\n }, []);\n\n const resetAudioSequence = useCallback(() => {\n clearAutoAdvanceTimer();\n clearInteractionAutoCloseTimer();\n setCurrentAudioKey(null);\n setIsAudioLoadingVisible(false);\n setHasCompletedCurrentStepAudio(false);\n setActiveInteractionElement(undefined);\n setIsInteractionOverlayOpen(false);\n }, [clearAutoAdvanceTimer, clearInteractionAutoCloseTimer]);\n\n const startCurrentAudioSequence = useCallback(() => {\n const nextAudioKey = currentAudioSequenceKeys[0];\n\n if (!nextAudioKey) {\n return false;\n }\n\n // Start the first audio segment for the current step immediately.\n setCurrentAudioKey(nextAudioKey);\n return true;\n }, [currentAudioSequenceKeys]);\n\n const continueAfterInteraction = useCallback(() => {\n clearInteractionAutoCloseTimer();\n setIsInteractionOverlayOpen(false);\n\n if (startCurrentAudioSequence()) {\n return;\n }\n\n if (canGoNext) {\n goNext();\n }\n }, [\n canGoNext,\n clearInteractionAutoCloseTimer,\n goNext,\n startCurrentAudioSequence,\n ]);\n\n const showPlayerControls = useCallback(\n (enableAutoHide = hasPlayerInteracted) => {\n if (!shouldRenderPlayer) {\n return;\n }\n\n setIsPlayerVisible(true);\n clearPlayerHideTimer();\n\n if (playerAlwaysVisible || !enableAutoHide || playerAutoHideDelay <= 0) {\n return;\n }\n\n playerHideTimerRef.current = window.setTimeout(() => {\n setIsPlayerVisible(false);\n playerHideTimerRef.current = null;\n }, playerAutoHideDelay);\n },\n [\n clearPlayerHideTimer,\n hasPlayerInteracted,\n playerAlwaysVisible,\n playerAutoHideDelay,\n shouldRenderPlayer,\n ]\n );\n\n const hasResolvedCurrentInteraction = Boolean(\n currentInteractionElement?.readonly ||\n currentInteractionElement?.user_input?.trim()\n );\n\n const shouldBlockPlaybackForInteraction =\n Boolean(currentInteractionElement) && !hasResolvedCurrentInteraction;\n\n useEffect(() => {\n return () => {\n clearAutoAdvanceTimer();\n clearPlayerHideTimer();\n clearInteractionAutoCloseTimer();\n };\n }, [\n clearAutoAdvanceTimer,\n clearInteractionAutoCloseTimer,\n clearPlayerHideTimer,\n ]);\n\n useEffect(() => {\n onPlayerVisibilityChange?.(playerVisible);\n\n return () => {\n onPlayerVisibilityChange?.(false);\n };\n }, [onPlayerVisibilityChange, playerVisible]);\n\n useEffect(() => {\n onStepChange?.(currentStepElement, currentIndex);\n }, [currentIndex, currentStepElement, onStepChange]);\n\n useEffect(() => {\n if (!shouldRenderPlayer) {\n clearPlayerHideTimer();\n setIsPlayerVisible(false);\n return;\n }\n\n if (playerAlwaysVisible) {\n clearPlayerHideTimer();\n setIsPlayerVisible(true);\n return;\n }\n\n if (!hasPlayerInteracted) {\n // Keep the initial player visible briefly, then hide it automatically.\n showPlayerControls(true);\n }\n }, [\n clearPlayerHideTimer,\n hasPlayerInteracted,\n playerAlwaysVisible,\n shouldRenderPlayer,\n showPlayerControls,\n ]);\n\n useEffect(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const handleSandboxInteraction = (event: MessageEvent) => {\n if (event.origin !== window.location.origin) {\n return;\n }\n\n if (!isSandboxInteractionMessage(event.data)) {\n return;\n }\n\n if (!shouldRenderPlayer) {\n return;\n }\n\n // Restore player controls without blocking native iframe scrolling.\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n };\n\n window.addEventListener(\"message\", handleSandboxInteraction);\n\n return () => {\n window.removeEventListener(\"message\", handleSandboxInteraction);\n };\n }, [shouldRenderPlayer, showPlayerControls]);\n\n useWakePlayerFromIframe({\n sectionRef,\n enabled: shouldRenderPlayer,\n onWake: () => {\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n },\n });\n\n useEffect(() => {\n const shouldOpenInteractionOverlayAfterAudio =\n pendingInteractionOverlayStepIndexRef.current === currentIndex &&\n Boolean(currentInteractionElement);\n const shouldPresentInteractionOverlay =\n Boolean(currentInteractionElement) &&\n (shouldBlockPlaybackForInteraction ||\n shouldOpenInteractionOverlayAfterAudio ||\n hasResolvedCurrentInteraction);\n\n resetAudioSequence();\n\n if (currentElementList.length === 0 && !currentInteractionElement) {\n return;\n }\n\n if (shouldPresentInteractionOverlay) {\n // Re-open history interaction checkpoints so manual prev/next still reveals the overlay.\n setActiveInteractionElement(currentInteractionElement);\n setIsInteractionOverlayOpen(true);\n pendingInteractionOverlayStepIndexRef.current = null;\n return;\n }\n\n if (currentInteractionElement) {\n setActiveInteractionElement(currentInteractionElement);\n setIsInteractionOverlayOpen(false);\n pendingInteractionOverlayStepIndexRef.current = null;\n }\n\n if (startCurrentAudioSequence()) {\n return;\n }\n\n if (currentStepHasSpeakableElement) {\n setIsAudioLoadingVisible(true);\n return;\n }\n\n if (!canGoNext) {\n return;\n }\n\n // Auto-advance silent marker-only steps so playback flow does not stall.\n autoAdvanceTimerRef.current = window.setTimeout(() => {\n autoAdvanceTimerRef.current = null;\n goNext();\n }, CHECKPOINT_AUTO_ADVANCE_DELAY_MS);\n\n return () => {\n clearAutoAdvanceTimer();\n };\n }, [\n canGoNext,\n clearAutoAdvanceTimer,\n currentElementList.length,\n currentInteractionElement,\n currentPlaybackResetKey,\n currentStepHasSpeakableElement,\n goNext,\n hasResolvedCurrentInteraction,\n shouldBlockPlaybackForInteraction,\n resetAudioSequence,\n startCurrentAudioSequence,\n ]);\n\n useEffect(() => {\n if (!currentStepHasSpeakableElement || shouldBlockPlaybackForInteraction) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (hasCompletedCurrentStepAudio) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (currentAudioSequenceKeys.length === 0) {\n setIsAudioLoadingVisible(true);\n }\n }, [\n currentAudioSequenceKeys.length,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n shouldBlockPlaybackForInteraction,\n ]);\n\n useEffect(() => {\n if (currentAudioKey || currentAudioSequenceKeys.length === 0) {\n return;\n }\n\n if (!currentStepHasSpeakableElement || shouldBlockPlaybackForInteraction) {\n return;\n }\n\n if (hasCompletedCurrentStepAudio) {\n return;\n }\n\n startCurrentAudioSequence();\n }, [\n currentAudioKey,\n currentAudioSequenceKeys,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n shouldBlockPlaybackForInteraction,\n startCurrentAudioSequence,\n ]);\n\n useEffect(() => {\n if (!currentAudioKey || currentAudioIndex >= 0) {\n return;\n }\n\n setCurrentAudioKey(null);\n }, [currentAudioIndex, currentAudioKey]);\n\n useEffect(() => {\n if (!hasCurrentStepAudioUrl) {\n return;\n }\n\n // Treat the arrived audio URL as ready and hide the buffering overlay.\n setIsAudioLoadingVisible(false);\n }, [hasCurrentStepAudioUrl]);\n\n const interactionDefaults = useMemo(() => {\n if (!activeInteractionElement) {\n return {};\n }\n\n const shouldPreferResolvedInteractionInput = Boolean(\n activeInteractionElement.user_input?.trim()\n );\n\n return getInteractionDefaultValues(\n typeof activeInteractionElement.content === \"string\"\n ? activeInteractionElement.content\n : undefined,\n activeInteractionElement.user_input,\n shouldPreferResolvedInteractionInput\n ? undefined\n : interactionDefaultValueOptions\n );\n }, [activeInteractionElement, interactionDefaultValueOptions]);\n\n const interactionDefaultSelectedValues = useMemo(() => {\n if (!activeInteractionElement) {\n return undefined;\n }\n\n const shouldPreferResolvedInteractionInput = Boolean(\n activeInteractionElement.user_input?.trim()\n );\n\n return getInteractionDefaultSelectedValues(\n typeof activeInteractionElement.content === \"string\"\n ? activeInteractionElement.content\n : undefined,\n activeInteractionElement.user_input,\n shouldPreferResolvedInteractionInput\n ? undefined\n : interactionDefaultValueOptions\n );\n }, [activeInteractionElement, interactionDefaultValueOptions]);\n\n const hasResolvedInteractionInput = Boolean(\n activeInteractionElement?.user_input?.trim()\n );\n\n const isInteractionReadonly =\n Boolean(activeInteractionElement?.readonly) || hasResolvedInteractionInput;\n const shouldAutoContinueInteraction =\n isInteractionReadonly || hasResolvedInteractionInput;\n\n const handleInteractionSend = useCallback(\n (content: OnSendContentParams) => {\n const submittedValues = [\n ...(content.selectedValues ?? []),\n content.inputText?.trim() ?? \"\",\n content.buttonText?.trim() ?? \"\",\n ].filter(Boolean);\n const resolvedUserInput = submittedValues.join(\", \");\n\n setActiveInteractionElement((prevElement) => {\n if (!prevElement || !resolvedUserInput) {\n return prevElement;\n }\n\n return {\n ...prevElement,\n user_input: resolvedUserInput,\n };\n });\n\n onSend?.(content, activeInteractionElement);\n continueAfterInteraction();\n },\n [activeInteractionElement, continueAfterInteraction, onSend]\n );\n\n useEffect(() => {\n clearInteractionAutoCloseTimer();\n\n if (!isInteractionOverlayOpen || !shouldAutoContinueInteraction) {\n return;\n }\n\n // Auto-close passive interaction checkpoints to keep playback moving.\n interactionAutoCloseTimerRef.current = window.setTimeout(() => {\n interactionAutoCloseTimerRef.current = null;\n\n continueAfterInteraction();\n }, 2000);\n\n return () => {\n clearInteractionAutoCloseTimer();\n };\n }, [\n clearInteractionAutoCloseTimer,\n continueAfterInteraction,\n isInteractionOverlayOpen,\n shouldAutoContinueInteraction,\n ]);\n\n const renderSlideElement = (\n element?: Element,\n options: RenderSlideElementOptions = {}\n ) => {\n if (!element) {\n return null;\n }\n\n if (element.type === \"slot\") {\n return <>{element.content}</>;\n }\n\n if (element.type === \"html\") {\n return (\n <IframeSandbox\n className=\"content-render-iframe\"\n hideFullScreen\n mode=\"blackboard\"\n replaceRootScreenHeightWithFull={\n options.replaceRootScreenHeightWithFull\n }\n type=\"sandbox\"\n content={element.content as string}\n />\n );\n }\n\n return (\n <IframeSandbox\n className=\"content-render-iframe\"\n hideFullScreen\n mode=\"blackboard\"\n type=\"markdown\"\n content={element.content as string}\n />\n );\n };\n\n const renderSlideElementList = (\n elementList: Element[] = [],\n isActiveStep = false\n ) => {\n if (elementList.length === 0) {\n return null;\n }\n\n const visibleElementCount = elementList.filter(\n (element) => element.is_renderable !== false\n ).length;\n const lastVisibleElementIndex = elementList.reduce(\n (lastVisibleIndex, element, index) =>\n element.is_renderable !== false ? index : lastVisibleIndex,\n -1\n );\n\n return (\n <div className=\"slide-stage__content flex w-full flex-col gap-4\">\n {elementList.map((element, index) => {\n const isPreRenderedHtml =\n element.type === \"html\" && element.is_renderable === false;\n\n return (\n <div\n key={element.sequence_number ?? `${element.type}-${index}`}\n ref={\n isActiveStep && index === lastVisibleElementIndex\n ? lastElementRef\n : null\n }\n aria-hidden={isPreRenderedHtml || undefined}\n className={cn(\n \"w-full shrink-0\",\n visibleElementCount === 1 &&\n element.is_renderable !== false &&\n \"slide-element--single\",\n isPreRenderedHtml\n ? \"pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0\"\n : element.is_renderable === false && \"hidden\"\n )}\n >\n {renderSlideElement(element, {\n replaceRootScreenHeightWithFull:\n visibleElementCount === 1 &&\n element.type === \"html\" &&\n element.is_renderable !== false,\n })}\n </div>\n );\n })}\n </div>\n );\n };\n\n const handleFullscreen = () => {\n const target = sectionRef.current;\n if (!target) return;\n\n if (document.fullscreenElement) {\n document.exitFullscreen().catch(() => {});\n return;\n }\n\n target.requestFullscreen?.().catch(() => {});\n };\n\n const scrollStageToBottom = useCallback(() => {\n const stageLayerElement = stageLayerRef.current;\n\n if (!stageLayerElement) {\n return;\n }\n\n // Keep the latest content visible after manual player navigation.\n stageLayerElement.scrollTo({\n top: stageLayerElement.scrollHeight,\n behavior: \"smooth\",\n });\n }, []);\n\n const handlePrev = useCallback(() => {\n shouldScrollToBottomRef.current = true;\n pendingInteractionOverlayStepIndexRef.current = null;\n setHasPlayerInteracted(true);\n setIsAudioLoadingVisible(false);\n showPlayerControls(true);\n resetAudioSequence();\n goPrev();\n }, [goPrev, resetAudioSequence, showPlayerControls]);\n\n const handleNext = useCallback(() => {\n shouldScrollToBottomRef.current = true;\n pendingInteractionOverlayStepIndexRef.current = null;\n setHasPlayerInteracted(true);\n setIsAudioLoadingVisible(false);\n showPlayerControls(true);\n resetAudioSequence();\n goNext();\n }, [goNext, resetAudioSequence, showPlayerControls]);\n\n const handlePlayerLoadingChange = useCallback(\n (loading: boolean) => {\n if (hasCurrentStepAudioUrl) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (!currentStepHasSpeakableElement || hasCompletedCurrentStepAudio) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n setIsAudioLoadingVisible(loading);\n },\n [\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n hasCurrentStepAudioUrl,\n ]\n );\n\n const handlePlayerEnded = useCallback(\n (audioIndex: number) => {\n const endedAudioKey = audioList[audioIndex]?.audioKey;\n\n if (!endedAudioKey || !currentAudioKey) {\n return;\n }\n\n if (endedAudioKey !== currentAudioKey) {\n return;\n }\n\n const activeSequencePosition = currentAudioSequenceKeys.findIndex(\n (audioSequenceKey) => audioSequenceKey === endedAudioKey\n );\n if (activeSequencePosition < 0) {\n setCurrentAudioKey(null);\n return;\n }\n\n const nextSequencePosition = activeSequencePosition + 1;\n const nextAudioKey = currentAudioSequenceKeys[nextSequencePosition];\n\n if (nextAudioKey) {\n setCurrentAudioKey(nextAudioKey);\n return;\n }\n\n setCurrentAudioKey(null);\n setHasCompletedCurrentStepAudio(true);\n setIsAudioLoadingVisible(false);\n\n if (canGoNext) {\n const nextStepIndex = currentIndex + 1;\n const nextStepElement = slideElementList[nextStepIndex];\n\n if (hasCurrentStepAudioUrl && nextStepElement?.type === \"interaction\") {\n pendingInteractionOverlayStepIndexRef.current = nextStepIndex;\n }\n\n goNext();\n }\n },\n [\n audioList,\n canGoNext,\n currentIndex,\n currentAudioKey,\n currentAudioSequenceKeys,\n goNext,\n hasCurrentStepAudioUrl,\n slideElementList,\n ]\n );\n\n const handleInteractionToggle = useCallback(() => {\n if (!activeInteractionElement) {\n return;\n }\n\n setIsInteractionOverlayOpen((prevOpen) => !prevOpen);\n }, [activeInteractionElement]);\n\n const stopOverlayPropagation = useCallback(\n (\n event:\n | React.PointerEvent<HTMLDivElement>\n | React.MouseEvent<HTMLDivElement>\n ) => {\n event.stopPropagation();\n\n // Keep the player visible a bit longer when users interact with the overlay.\n if (playerVisible) {\n showPlayerControls(true);\n }\n },\n [isPlayerVisible, showPlayerControls]\n );\n\n const handleSurfacePointerDown = useCallback(\n (event: React.PointerEvent<HTMLElement>) => {\n onPointerDown?.(event);\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n },\n [onPointerDown, showPlayerControls]\n );\n\n const shouldShowInteractionOverlay =\n Boolean(activeInteractionElement) && isInteractionOverlayOpen;\n const currentRenderElementKeys = useMemo(\n () =>\n currentElementList.map(\n (element, index) =>\n `${element.sequence_number ?? `${element.type}-${index}`}:${String(element.is_new ?? \"\")}`\n ),\n [currentElementList]\n );\n\n useEffect(() => {\n const prevKeys = prevRenderElementKeysRef.current;\n const hasStablePrefix =\n prevKeys.length > 0 &&\n prevKeys.length < currentRenderElementKeys.length &&\n prevKeys.every((key, index) => key === currentRenderElementKeys[index]);\n const appendedElements = hasStablePrefix\n ? currentElementList.slice(prevKeys.length)\n : [];\n const shouldAutoScrollToAppend = appendedElements.some(\n (element) => element.is_new === false\n );\n\n prevRenderElementKeysRef.current = currentRenderElementKeys;\n\n if (!shouldAutoScrollToAppend) {\n return;\n }\n\n const animationFrameId = window.requestAnimationFrame(() => {\n const stageLayerElement = stageLayerRef.current;\n const targetElement = lastElementRef.current;\n\n if (!stageLayerElement || !targetElement) {\n return;\n }\n\n const stageLayerRect = stageLayerElement.getBoundingClientRect();\n const targetRect = targetElement.getBoundingClientRect();\n const nextScrollTop =\n stageLayerElement.scrollTop + (targetRect.top - stageLayerRect.top);\n\n // Keep newly appended content visible when the current slide grows downward.\n stageLayerElement.scrollTo({\n top: Math.max(nextScrollTop, 0),\n behavior: \"smooth\",\n });\n });\n\n return () => {\n window.cancelAnimationFrame(animationFrameId);\n };\n }, [currentElementList, currentRenderElementKeys]);\n\n useEffect(() => {\n if (!shouldScrollToBottomRef.current) {\n return;\n }\n\n shouldScrollToBottomRef.current = false;\n\n if (currentElementList.length === 0) {\n return;\n }\n\n const animationFrameId = window.requestAnimationFrame(() => {\n scrollStageToBottom();\n });\n\n return () => {\n window.cancelAnimationFrame(animationFrameId);\n };\n }, [currentElementList, scrollStageToBottom]);\n\n return (\n <section\n ref={sectionRef}\n className={cn(\"relative h-full w-full\", className)}\n onPointerDown={handleSurfacePointerDown}\n {...props}\n >\n <div\n className={cn(\n \"h-full min-h-0 w-full\",\n isSingleSlide ? \"slide-content--single\" : \"grid gap-4\"\n )}\n >\n {currentElementList.length > 0 ? (\n <div className=\"slide-stage\">\n <div ref={stageLayerRef} className=\"slide-stage__layer w-full\">\n {mountedStepStates.map(\n (mountedStepState, mountedStepStateIndex) => {\n const isActiveStep =\n mountedStepStateIndex === currentMountedStateIndex;\n\n return (\n <div\n key={\n mountedStepState.sourceStepIndexes[0] ??\n mountedStepStateIndex\n }\n aria-hidden={!isActiveStep || undefined}\n className=\"w-full h-full\"\n style={{ display: isActiveStep ? undefined : \"none\" }}\n >\n {renderSlideElementList(\n mountedStepState.elementList,\n isActiveStep\n )}\n </div>\n );\n }\n )}\n </div>\n </div>\n ) : null}\n </div>\n\n {isAudioLoadingVisible ? (\n <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\">\n <LoaderCircle className=\"size-5 animate-spin text-background\" />\n <span>{bufferingText}</span>\n </div>\n ) : null}\n\n {shouldShowInteractionOverlay ? (\n <div\n className={cn(\n \"slide-interaction-overlay\",\n playerVisible && shouldRenderPlayer\n ? \"slide-interaction-overlay--with-player\"\n : \"slide-interaction-overlay--standalone\"\n )}\n onClick={stopOverlayPropagation}\n onPointerDown={stopOverlayPropagation}\n style={interactionOverlayStyle}\n >\n <InteractionOverlayCard\n content={String(activeInteractionElement?.content ?? \"\")}\n defaultButtonText={interactionDefaults.buttonText ?? \"\"}\n defaultInputText={interactionDefaults.inputText ?? \"\"}\n defaultSelectedValues={interactionDefaultSelectedValues}\n confirmButtonText={interactionTexts?.confirmButtonText}\n copyButtonText={interactionTexts?.copyButtonText}\n copiedButtonText={interactionTexts?.copiedButtonText}\n onSend={handleInteractionSend}\n readonly={isInteractionReadonly}\n title={\n interactionTexts?.title ??\n interactionTitle ??\n \"Submit the content below to continue.\"\n }\n />\n </div>\n ) : null}\n\n {shouldRenderPlayer ? (\n <Player\n audioList={audioList}\n className={cn(\n \"absolute left-1/2 bottom-6 z-[2] -translate-x-1/2\",\n playerClassName,\n !playerVisible && \"pointer-events-none opacity-0\"\n )}\n currentAudioIndex={currentAudioIndex}\n defaultPlaying\n hasInteraction={Boolean(activeInteractionElement)}\n isInteractionOpen={isInteractionOverlayOpen}\n onLoadingChange={handlePlayerLoadingChange}\n nextDisabled={!canGoNext}\n onEnded={handlePlayerEnded}\n onFullscreen={handleFullscreen}\n onInteractionToggle={handleInteractionToggle}\n onNext={handleNext}\n onPrev={handlePrev}\n prevDisabled={!canGoPrev}\n showControls={playerVisible}\n customActions={playerCustomActions}\n />\n ) : null}\n </section>\n );\n};\n\nexport default Slide;\n"],"names":["CHECKPOINT_AUTO_ADVANCE_DELAY_MS","InteractionOverlayCard","memo","content","title","defaultButtonText","defaultInputText","defaultSelectedValues","confirmButtonText","copyButtonText","copiedButtonText","onSend","readonly","jsxs","jsx","ContentRender","areStepElementListsEqual","prevElementList","nextElementList","element","index","nextElement","Slide","elementList","showPlayer","playerAlwaysVisible","playerClassName","playerCustomActions","bufferingText","interactionTitle","interactionTexts","playerAutoHideDelay","interactionDefaultValueOptions","onPlayerVisibilityChange","onStepChange","className","onPointerDown","props","sectionRef","useRef","stageLayerRef","lastElementRef","playerHideTimerRef","autoAdvanceTimerRef","interactionAutoCloseTimerRef","prevRenderElementKeysRef","shouldScrollToBottomRef","pendingInteractionOverlayStepIndexRef","currentElementList","stepElementLists","slideElementList","currentIndex","audioList","currentAudioSequenceIndexes","currentStepHasSpeakableElement","currentInteractionElement","canGoPrev","canGoNext","goPrev","goNext","useSlide","currentStepElement","useMemo","isSingleSlide","shouldRenderPlayer","currentAudioSequenceKeys","audioIndex","audioKey","isPlayerVisible","setIsPlayerVisible","useState","hasPlayerInteracted","setHasPlayerInteracted","currentAudioKey","setCurrentAudioKey","isAudioLoadingVisible","setIsAudioLoadingVisible","hasCompletedCurrentStepAudio","setHasCompletedCurrentStepAudio","activeInteractionElement","setActiveInteractionElement","isInteractionOverlayOpen","setIsInteractionOverlayOpen","playerVisible","playerCustomActionCount","getPlayerCustomActionCount","interactionOverlayStyle","mountedStepStates","currentMountedStateIndex","nextMountedStepStates","mountedStateIndexByStep","stepElementList","stepIndex","existingMountedStateIndex","mountedStepState","currentStepKey","currentAudioIndex","audioItem","currentAudioSequenceStartKey","currentInteractionResetKey","currentPlaybackResetKey","hasCurrentStepAudioUrl","clearPlayerHideTimer","useCallback","clearInteractionAutoCloseTimer","clearAutoAdvanceTimer","resetAudioSequence","startCurrentAudioSequence","nextAudioKey","continueAfterInteraction","showPlayerControls","enableAutoHide","hasResolvedCurrentInteraction","shouldBlockPlaybackForInteraction","useEffect","handleSandboxInteraction","event","isSandboxInteractionMessage","useWakePlayerFromIframe","shouldOpenInteractionOverlayAfterAudio","shouldPresentInteractionOverlay","interactionDefaults","shouldPreferResolvedInteractionInput","getInteractionDefaultValues","interactionDefaultSelectedValues","getInteractionDefaultSelectedValues","hasResolvedInteractionInput","isInteractionReadonly","shouldAutoContinueInteraction","handleInteractionSend","resolvedUserInput","prevElement","renderSlideElement","options","Fragment","IframeSandbox","renderSlideElementList","isActiveStep","visibleElementCount","lastVisibleElementIndex","lastVisibleIndex","isPreRenderedHtml","cn","handleFullscreen","target","scrollStageToBottom","stageLayerElement","handlePrev","handleNext","handlePlayerLoadingChange","loading","handlePlayerEnded","endedAudioKey","activeSequencePosition","audioSequenceKey","nextSequencePosition","nextStepIndex","nextStepElement","handleInteractionToggle","prevOpen","stopOverlayPropagation","handleSurfacePointerDown","shouldShowInteractionOverlay","currentRenderElementKeys","prevKeys","shouldAutoScrollToAppend","key","animationFrameId","targetElement","stageLayerRect","targetRect","nextScrollTop","mountedStepStateIndex","LoaderCircle","Player"],"mappings":"w0BA8BMA,GAAmC,IA0BnCC,GAAyBC,EAAAA,KAC7B,CAAC,CACC,QAAAC,EACA,MAAAC,EACA,kBAAAC,EACA,iBAAAC,EACA,sBAAAC,EACA,kBAAAC,GACA,eAAAC,GACA,iBAAAC,EACA,OAAAC,EACA,SAAAC,EAAW,EAAA,IAEXC,EAAAA,kBAAAA,KAAC,MAAA,CAAI,UAAU,iCACb,SAAA,CAAAC,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,mCACb,SAAAA,EAAAA,kBAAAA,IAAC,KAAE,UAAU,kCAAmC,WAAM,CAAA,CACxD,EACAA,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,iCACb,SAAAA,EAAAA,kBAAAA,IAACC,GAAAA,QAAA,CACC,QAAAZ,EACA,kBAAAE,EACA,iBAAAC,EACA,sBAAAC,EACA,kBAAAC,GACA,eAAAC,GACA,iBAAAC,EACA,OAAAC,EACA,SAAAC,EACA,iBAAkB,GAClB,YAAY,SAAA,CAAA,EAEhB,EACAE,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,iCAAA,CAAkC,CAAA,CAAA,CACnD,CAEJ,EAEAb,GAAuB,YAAc,yBAErC,MAAMe,GAA2B,CAC/BC,EACAC,IAEAD,EAAgB,SAAWC,EAAgB,QAC3CD,EAAgB,MAAM,CAACE,EAASC,I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