markdown-flow-ui 0.1.111 → 0.1.112-beta.1
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/_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/assets/markdown-flow-ui.css +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +321 -317
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +48 -44
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.d.ts +1 -0
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js +38 -28
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +28 -26
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.d.ts +8 -1
- package/dist/components/MarkdownFlowEditor/utils.es.js +59 -39
- package/dist/components/MarkdownFlowEditor/utils.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.d.ts +8 -0
- package/dist/components/Slide/Slide.es.js +713 -599
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/Slide.stories.d.ts +13 -0
- package/dist/components/Slide/constants.cjs.js +1 -1
- package/dist/components/Slide/constants.cjs.js.map +1 -1
- package/dist/components/Slide/constants.d.ts +4 -0
- package/dist/components/Slide/constants.es.js +6 -2
- package/dist/components/Slide/constants.es.js.map +1 -1
- package/dist/components/Slide/index.d.ts +2 -1
- package/dist/components/Slide/useSlide.cjs.js.map +1 -1
- package/dist/components/Slide/useSlide.es.js.map +1 -1
- package/dist/components/Slide/utils/streamingNavigation.cjs.js.map +1 -1
- package/dist/components/Slide/utils/streamingNavigation.es.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/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/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/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/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/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/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/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/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/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/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/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/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/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/slide.cjs.js +1 -1
- package/dist/slide.es.js +6 -4
- package/dist/slide.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slide.es.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 { ChevronLeft } from \"lucide-react\";\n\nimport { isSandboxInteractionMessage } from \"../../lib/sandboxInteraction\";\nimport { cn } from \"../../lib/utils\";\nimport LoadingOverlayCard from \"../ui/loading-overlay-card\";\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 {\n isLandscapeViewport as getIsFullscreenPreferredViewport,\n isMobileDevice as getIsMobileDevice,\n subscribeMobileDeviceChange,\n} from \"../../lib/mobileDevice\";\nimport Player from \"./Player\";\nimport SubtitleOverlay from \"./SubtitleOverlay\";\nimport type { PlayerProps, SlidePlayerTexts } from \"./Player\";\nimport { DEFAULT_SLIDE_PLAYER_TEXTS } from \"./constants\";\nimport SlideFullscreenHint from \"./SlideFullscreenHint\";\nimport type { Element } from \"./types\";\nimport useSlide from \"./useSlide\";\nimport useWakePlayerFromIframe from \"./useWakePlayerFromIframe\";\nimport {\n DEFAULT_MOBILE_VIEW_MODE,\n resolveMobileViewModeState,\n type MobileViewMode,\n} from \"./utils/mobileScreenMode\";\nimport { shouldPresentInteractionOverlay } from \"./utils/interactionPlayback\";\nimport { shouldAutoAdvanceIntoAppendedMarker } from \"./utils/appendedMarkerAdvance\";\nimport { getPlaybackSequenceTransition } from \"./utils/playbackSequence\";\nimport {\n getPlayerCustomActionCount,\n resolvePlayerCustomActionElement,\n} from \"./utils/playerCustomActions\";\nimport { createPlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport { shouldUseAutoAdvanceToggle } from \"./utils/playerToggleMode\";\nimport \"./slide.css\";\nexport type {\n Element,\n ElementAudioSegment,\n ElementSubtitleCue,\n SlidePlayerCustomActionContext,\n SlidePlayerCustomActions,\n} from \"./types\";\n\nconst DEFAULT_MARKER_AUTO_ADVANCE_DELAY_MS = 2000;\nconst DEFAULT_INTERACTION_OVERLAY_OPEN_DELAY_MS = 300;\nconst DEFAULT_INTERACTION_OVERLAY_FALLBACK_OFFSET_PX = 160;\nconst DEFAULT_INTERACTION_SUBTITLE_GAP_PX = 16;\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\n extends Pick<\n ContentRenderProps,\n \"confirmButtonText\" | \"copyButtonText\" | \"copiedButtonText\"\n > {\n title?: string;\n}\n\nexport type SlideFullscreenHeader = {\n content?: React.ReactNode;\n backAriaLabel?: string;\n onBack?: () => void;\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>\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 fullscreenHeader?: SlideFullscreenHeader;\n playerCustomActions?: PlayerProps[\"customActions\"];\n playerCustomActionPauseOnActive?: boolean;\n bufferingText?: string;\n interactionTitle?: string;\n interactionTexts?: SlideInteractionTexts;\n playerTexts?: SlidePlayerTexts;\n playerAutoHideDelay?: number;\n markerAutoAdvanceDelay?: number;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n onSend?: (content: OnSendContentParams, element?: Element) => void;\n onPlayerVisibilityChange?: (visible: boolean) => void;\n onMobileViewModeChange?: (viewMode: MobileViewMode) => void;\n onStepChange?: (element: Element | undefined, index: number) => void;\n enableIframeScaling?: boolean;\n}\n\nconst Slide: React.FC<SlideProps> = ({\n elementList = [],\n showPlayer = true,\n playerAlwaysVisible = false,\n playerClassName,\n fullscreenHeader,\n playerCustomActions,\n playerCustomActionPauseOnActive = true,\n bufferingText = \"Buffering...\",\n interactionTitle,\n interactionTexts,\n playerTexts,\n playerAutoHideDelay = 3000,\n markerAutoAdvanceDelay = DEFAULT_MARKER_AUTO_ADVANCE_DELAY_MS,\n interactionDefaultValueOptions,\n onSend,\n onPlayerVisibilityChange,\n onMobileViewModeChange,\n onStepChange,\n enableIframeScaling = true,\n className,\n onPointerDown,\n ...props\n}) => {\n const sectionRef = useRef<HTMLElement | null>(null);\n const viewportRef = useRef<HTMLDivElement | 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 interactionOverlayOpenTimerRef = useRef<number | null>(null);\n const interactionOverlayRef = useRef<HTMLDivElement | null>(null);\n const prevRenderElementKeysRef = useRef<string[]>([]);\n const shouldScrollToBottomRef = useRef(false);\n const pendingInteractionOverlayStepIndexRef = useRef<number | null>(null);\n const playbackResetKeyRef = useRef<string | null>(null);\n const appendedMarkerAdvanceStateRef = useRef({\n markerCount: 0,\n currentIndex: -1,\n canGoNext: false,\n });\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 [isAutoAdvanceEnabled, setIsAutoAdvanceEnabled] = useState(true);\n const [currentAudioKey, setCurrentAudioKey] = useState<string | null>(null);\n const [isAudioLoadingVisible, setIsAudioLoadingVisible] = useState(false);\n const [hasCompletedCurrentStepAudio, setHasCompletedCurrentStepAudio] =\n useState(false);\n const [hasCurrentAudioPlaybackStarted, setHasCurrentAudioPlaybackStarted] =\n useState(false);\n const [isSubtitleEnabled, setIsSubtitleEnabled] = useState(true);\n const [isPlayerCustomActionActive, setIsPlayerCustomActionActive] =\n useState(false);\n const [activeInteractionElement, setActiveInteractionElement] = useState<\n Element | undefined\n >();\n const [isInteractionOverlayOpen, setIsInteractionOverlayOpen] =\n useState(false);\n const [\n interactionOverlaySubtitleOffset,\n setInteractionOverlaySubtitleOffset,\n ] = useState(0);\n const [isBrowserFullscreen, setIsBrowserFullscreen] = useState(false);\n const isMobileDevice = useMemo(() => getIsMobileDevice(), []);\n const [mobileViewMode, setMobileViewMode] = useState<MobileViewMode>(\n DEFAULT_MOBILE_VIEW_MODE\n );\n const [hasManualMobileViewMode, setHasManualMobileViewMode] = useState(false);\n const [isViewportFullscreenPreferred, setIsViewportFullscreenPreferred] =\n useState(() =>\n isMobileDevice ? getIsFullscreenPreferredViewport() : false\n );\n const [isFullscreenHintOpen, setIsFullscreenHintOpen] = useState(false);\n const playbackTimeStore = useMemo(() => createPlaybackTimeStore(), []);\n const {\n effectiveMobileViewMode,\n isImmersiveMobileFullscreen,\n isNativeMobileFullscreen,\n shouldRotateFullscreenViewport,\n } = useMemo(\n () =>\n resolveMobileViewModeState({\n hasManualMobileViewMode,\n isMobileDevice,\n isViewportFullscreenPreferred,\n mobileViewMode,\n }),\n [\n hasManualMobileViewMode,\n isMobileDevice,\n isViewportFullscreenPreferred,\n mobileViewMode,\n ]\n );\n const previousEffectiveMobileViewModeRef = useRef(effectiveMobileViewMode);\n const playerVisible =\n shouldRenderPlayer && (playerAlwaysVisible || isPlayerVisible);\n const shouldShowFullscreenHeader =\n isImmersiveMobileFullscreen && playerVisible;\n const shouldApplyFullscreenViewportPadding =\n isImmersiveMobileFullscreen && playerVisible;\n const shouldShowMobileFullscreenMask =\n isImmersiveMobileFullscreen || isNativeMobileFullscreen;\n const fullscreenHintText =\n playerTexts?.fullscreenHintText ??\n DEFAULT_SLIDE_PLAYER_TEXTS.fullscreenHintText;\n const handleMobileViewModeSelect = useCallback(\n (nextViewMode: MobileViewMode) => {\n setHasManualMobileViewMode(true);\n setMobileViewMode(nextViewMode);\n },\n []\n );\n const handleMobileViewModeReset = useCallback(() => {\n // Clear manual override so the effective mode returns to the default non-fullscreen state.\n setHasManualMobileViewMode(false);\n setMobileViewMode(DEFAULT_MOBILE_VIEW_MODE);\n }, []);\n const handleFullscreenHeaderBack = useCallback(() => {\n handleMobileViewModeReset();\n fullscreenHeader?.onBack?.();\n }, [fullscreenHeader, handleMobileViewModeReset]);\n const handleFullscreenHintClose = useCallback(() => {\n setIsFullscreenHintOpen(false);\n }, []);\n const setPlayerCustomActionActive = useCallback((active: boolean) => {\n setIsPlayerCustomActionActive(active);\n }, []);\n const togglePlayerCustomActionActive = useCallback(() => {\n setIsPlayerCustomActionActive((previous) => !previous);\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 currentAudioItem = useMemo(\n () => (currentAudioIndex >= 0 ? audioList[currentAudioIndex] : undefined),\n [audioList, currentAudioIndex]\n );\n const currentSubtitleCues = currentAudioItem?.element?.subtitle_cues ?? [];\n const currentAudioSequenceStartKey = useMemo(\n () => currentAudioSequenceKeys[0] ?? \"none\",\n [currentAudioSequenceKeys]\n );\n const playerCustomActionContext = useMemo(\n () => ({\n currentElement: resolvePlayerCustomActionElement({\n currentAudioIndex,\n currentAudioSequenceIndexes,\n audioList,\n currentInteractionElement: activeInteractionElement,\n currentStepElement,\n }),\n currentIndex,\n currentStepElement,\n isActive: isPlayerCustomActionActive,\n setActive: setPlayerCustomActionActive,\n toggleActive: togglePlayerCustomActionActive,\n }),\n [\n activeInteractionElement,\n audioList,\n currentAudioIndex,\n currentAudioSequenceIndexes,\n currentIndex,\n currentStepElement,\n isPlayerCustomActionActive,\n setPlayerCustomActionActive,\n togglePlayerCustomActionActive,\n ]\n );\n const playerCustomActionCount = useMemo(\n () =>\n getPlayerCustomActionCount(\n playerCustomActions,\n playerCustomActionContext\n ),\n [playerCustomActionContext, playerCustomActions]\n );\n const interactionOverlayStyle = useMemo(\n () =>\n ({\n \"--slide-player-custom-action-count\": String(playerCustomActionCount),\n \"--slide-player-mobile-control-count\": String(\n playerCustomActionCount + 4\n ),\n }) as React.CSSProperties,\n [playerCustomActionCount]\n );\n const hasAvailableStepAudio = currentAudioSequenceKeys.length > 0;\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 currentPlaybackStartedResetKey = useMemo(\n () =>\n [\n currentPlaybackResetKey,\n currentAudioItem?.audioKey ?? \"none\",\n String(currentAudioIndex),\n ].join(\"|\"),\n [currentAudioIndex, currentAudioItem?.audioKey, currentPlaybackResetKey]\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 const shouldPausePlaybackForCustomAction =\n playerCustomActionPauseOnActive &&\n Boolean(playerCustomActions) &&\n isPlayerCustomActionActive;\n const shouldUseSilentStepAutoAdvanceToggle = useMemo(\n () =>\n shouldUseAutoAdvanceToggle({\n canGoNext,\n currentAudioIndex,\n currentStepHasSpeakableElement,\n hasInteraction: Boolean(currentInteractionElement),\n }),\n [\n canGoNext,\n currentAudioIndex,\n currentInteractionElement,\n currentStepHasSpeakableElement,\n ]\n );\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 clearInteractionOverlayOpenTimer = useCallback(() => {\n if (interactionOverlayOpenTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(interactionOverlayOpenTimerRef.current);\n interactionOverlayOpenTimerRef.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 clearInteractionOverlayOpenTimer();\n setCurrentAudioKey(null);\n playbackTimeStore.reset();\n setIsAudioLoadingVisible(false);\n setHasCompletedCurrentStepAudio(false);\n setHasCurrentAudioPlaybackStarted(false);\n setActiveInteractionElement(undefined);\n setIsInteractionOverlayOpen(false);\n setInteractionOverlaySubtitleOffset(0);\n }, [\n clearAutoAdvanceTimer,\n clearInteractionAutoCloseTimer,\n clearInteractionOverlayOpenTimer,\n playbackTimeStore,\n ]);\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 clearInteractionOverlayOpenTimer();\n setIsInteractionOverlayOpen(false);\n setInteractionOverlaySubtitleOffset(0);\n\n if (startCurrentAudioSequence()) {\n return;\n }\n\n if (canGoNext) {\n goNext();\n }\n }, [\n canGoNext,\n clearInteractionAutoCloseTimer,\n clearInteractionOverlayOpenTimer,\n goNext,\n startCurrentAudioSequence,\n ]);\n\n const scheduleInteractionOverlayOpen = useCallback(\n (interactionElement?: Element) => {\n clearInteractionOverlayOpenTimer();\n\n if (!interactionElement) {\n return;\n }\n\n const openOverlay = () => {\n interactionOverlayOpenTimerRef.current = null;\n setInteractionOverlaySubtitleOffset(\n DEFAULT_INTERACTION_OVERLAY_FALLBACK_OFFSET_PX\n );\n setIsInteractionOverlayOpen(true);\n pendingInteractionOverlayStepIndexRef.current = null;\n };\n\n interactionOverlayOpenTimerRef.current = window.setTimeout(\n openOverlay,\n DEFAULT_INTERACTION_OVERLAY_OPEN_DELAY_MS\n );\n },\n [clearInteractionOverlayOpenTimer]\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 // Reset silent-step autoplay toggle whenever navigation lands on a new step.\n setIsAutoAdvanceEnabled(true);\n\n if (playerCustomActionPauseOnActive) {\n setIsPlayerCustomActionActive(false);\n }\n }, [currentIndex, playerCustomActionPauseOnActive]);\n\n useEffect(() => {\n return () => {\n clearAutoAdvanceTimer();\n clearPlayerHideTimer();\n clearInteractionAutoCloseTimer();\n clearInteractionOverlayOpenTimer();\n };\n }, [\n clearAutoAdvanceTimer,\n clearInteractionAutoCloseTimer,\n clearInteractionOverlayOpenTimer,\n clearPlayerHideTimer,\n ]);\n\n useEffect(() => {\n onPlayerVisibilityChange?.(playerVisible);\n\n return () => {\n onPlayerVisibilityChange?.(false);\n };\n }, [onPlayerVisibilityChange, playerVisible]);\n\n useEffect(() => {\n if (isMobileDevice || mobileViewMode === DEFAULT_MOBILE_VIEW_MODE) {\n return;\n }\n\n setHasManualMobileViewMode(false);\n setMobileViewMode(DEFAULT_MOBILE_VIEW_MODE);\n }, [isMobileDevice, mobileViewMode]);\n\n useEffect(() => {\n if (!isMobileDevice) {\n setIsViewportFullscreenPreferred(false);\n return;\n }\n\n const syncViewportFullscreenPreference = () => {\n setIsViewportFullscreenPreferred(getIsFullscreenPreferredViewport());\n };\n\n syncViewportFullscreenPreference();\n\n return subscribeMobileDeviceChange(syncViewportFullscreenPreference);\n }, [isMobileDevice]);\n\n useEffect(() => {\n onMobileViewModeChange?.(effectiveMobileViewMode);\n }, [effectiveMobileViewMode, onMobileViewModeChange]);\n\n useEffect(() => {\n const previousMode = previousEffectiveMobileViewModeRef.current;\n const hasEnteredFullscreen =\n previousMode !== \"fullscreen\" && effectiveMobileViewMode === \"fullscreen\";\n const shouldShowFullscreenHint =\n hasEnteredFullscreen && !isViewportFullscreenPreferred;\n\n previousEffectiveMobileViewModeRef.current = effectiveMobileViewMode;\n\n if (!isMobileDevice) {\n setIsFullscreenHintOpen(false);\n return;\n }\n\n if (shouldShowFullscreenHint) {\n setIsFullscreenHintOpen(true);\n return;\n }\n\n if (effectiveMobileViewMode !== \"fullscreen\") {\n setIsFullscreenHintOpen(false);\n }\n }, [effectiveMobileViewMode, isMobileDevice, isViewportFullscreenPreferred]);\n\n useEffect(() => {\n onStepChange?.(currentStepElement, currentIndex);\n }, [currentIndex, currentStepElement, onStepChange]);\n\n useEffect(() => {\n const previousState = appendedMarkerAdvanceStateRef.current;\n const shouldAdvanceIntoAppendedMarker = shouldAutoAdvanceIntoAppendedMarker(\n {\n previousMarkerCount: previousState.markerCount,\n nextMarkerCount: slideElementList.length,\n previousIndex: previousState.currentIndex,\n previousCanGoNext: previousState.canGoNext,\n nextCanGoNext: canGoNext,\n currentAudioKey,\n hasCompletedCurrentStepAudio,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n currentInteractionElement,\n isAutoAdvanceEnabled,\n shouldUseSilentStepAutoAdvanceToggle,\n }\n );\n\n appendedMarkerAdvanceStateRef.current = {\n markerCount: slideElementList.length,\n currentIndex,\n canGoNext,\n };\n\n if (!shouldAdvanceIntoAppendedMarker) {\n return;\n }\n\n goNext();\n }, [\n canGoNext,\n currentAudioKey,\n currentIndex,\n currentInteractionElement,\n currentStepHasSpeakableElement,\n goNext,\n hasCompletedCurrentStepAudio,\n hasResolvedCurrentInteraction,\n isAutoAdvanceEnabled,\n shouldUseSilentStepAutoAdvanceToggle,\n slideElementList.length,\n ]);\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 (event.data.eventType !== \"click\") {\n return;\n }\n\n if (!shouldRenderPlayer) {\n return;\n }\n\n // Restore player controls on explicit click/tap without waking on scroll start.\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 { hasPlaybackContextChanged, shouldInitializeAudioSequence } =\n getPlaybackSequenceTransition({\n previousResetKey: playbackResetKeyRef.current,\n nextResetKey: currentPlaybackResetKey,\n currentAudioKey,\n hasCompletedCurrentStepAudio,\n });\n\n playbackResetKeyRef.current = currentPlaybackResetKey;\n\n const shouldOpenInteractionOverlayAfterAudio =\n pendingInteractionOverlayStepIndexRef.current === currentIndex &&\n Boolean(currentInteractionElement);\n const shouldPresentOverlay = shouldPresentInteractionOverlay({\n hasInteraction: Boolean(currentInteractionElement),\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasPlaybackContextChanged,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n });\n\n if (hasPlaybackContextChanged) {\n resetAudioSequence();\n }\n\n if (currentElementList.length === 0 && !currentInteractionElement) {\n return;\n }\n\n if (shouldPausePlaybackForCustomAction) {\n return;\n }\n\n if (currentInteractionElement) {\n setActiveInteractionElement(currentInteractionElement);\n }\n\n if (shouldPresentOverlay) {\n // Delay auto-presenting the overlay so subtitles can settle above it.\n scheduleInteractionOverlayOpen(currentInteractionElement);\n return;\n }\n\n clearInteractionOverlayOpenTimer();\n pendingInteractionOverlayStepIndexRef.current = null;\n\n if (!shouldInitializeAudioSequence) {\n return;\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 if (shouldUseSilentStepAutoAdvanceToggle && !isAutoAdvanceEnabled) {\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 }, markerAutoAdvanceDelay);\n\n return () => {\n clearAutoAdvanceTimer();\n };\n }, [\n canGoNext,\n clearAutoAdvanceTimer,\n currentElementList.length,\n currentInteractionElement,\n currentAudioKey,\n currentPlaybackResetKey,\n currentStepHasSpeakableElement,\n markerAutoAdvanceDelay,\n goNext,\n hasCompletedCurrentStepAudio,\n isAutoAdvanceEnabled,\n hasResolvedCurrentInteraction,\n shouldBlockPlaybackForInteraction,\n clearInteractionOverlayOpenTimer,\n resetAudioSequence,\n scheduleInteractionOverlayOpen,\n startCurrentAudioSequence,\n shouldPausePlaybackForCustomAction,\n shouldUseSilentStepAutoAdvanceToggle,\n ]);\n\n useEffect(() => {\n if (\n shouldPausePlaybackForCustomAction ||\n !currentStepHasSpeakableElement ||\n shouldBlockPlaybackForInteraction\n ) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (hasCompletedCurrentStepAudio) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (hasAvailableStepAudio) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n setIsAudioLoadingVisible(true);\n }, [\n hasAvailableStepAudio,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n shouldPausePlaybackForCustomAction,\n shouldBlockPlaybackForInteraction,\n ]);\n\n useEffect(() => {\n if (currentAudioKey || currentAudioSequenceKeys.length === 0) {\n return;\n }\n\n if (\n shouldPausePlaybackForCustomAction ||\n !currentStepHasSpeakableElement ||\n shouldBlockPlaybackForInteraction\n ) {\n return;\n }\n\n if (hasCompletedCurrentStepAudio) {\n return;\n }\n\n startCurrentAudioSequence();\n }, [\n currentAudioKey,\n currentAudioSequenceKeys,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n shouldPausePlaybackForCustomAction,\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 (currentAudioIndex >= 0) {\n return;\n }\n\n playbackTimeStore.reset();\n }, [currentAudioIndex, playbackTimeStore]);\n\n useEffect(() => {\n setHasCurrentAudioPlaybackStarted(false);\n }, [currentPlaybackStartedResetKey]);\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 const shouldShowInteractionOverlay =\n Boolean(activeInteractionElement) && isInteractionOverlayOpen;\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 // Keep the player icon in sync with the actual fullscreen owner.\n const syncFullscreenState = () => {\n setIsBrowserFullscreen(document.fullscreenElement === sectionRef.current);\n };\n\n syncFullscreenState();\n document.addEventListener(\"fullscreenchange\", syncFullscreenState);\n\n return () => {\n document.removeEventListener(\"fullscreenchange\", syncFullscreenState);\n };\n }, []);\n\n useEffect(() => {\n if (!shouldShowInteractionOverlay) {\n setInteractionOverlaySubtitleOffset(0);\n return;\n }\n\n const interactionOverlayElement = interactionOverlayRef.current;\n\n if (!interactionOverlayElement) {\n return;\n }\n\n const updateSubtitleOffset = () => {\n const overlayHeight = Math.ceil(\n interactionOverlayElement.getBoundingClientRect().height\n );\n\n setInteractionOverlaySubtitleOffset(\n overlayHeight + DEFAULT_INTERACTION_SUBTITLE_GAP_PX\n );\n };\n\n updateSubtitleOffset();\n\n if (typeof ResizeObserver === \"undefined\") {\n return;\n }\n\n const resizeObserver = new ResizeObserver(() => {\n updateSubtitleOffset();\n });\n\n resizeObserver.observe(interactionOverlayElement);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [shouldShowInteractionOverlay]);\n\n useEffect(() => {\n clearInteractionAutoCloseTimer();\n\n if (!isInteractionOverlayOpen || !shouldAutoContinueInteraction) {\n return;\n }\n\n // Auto-close passive interaction markers 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 enableScaling={enableIframeScaling}\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 = useCallback(() => {\n const target = sectionRef.current;\n if (!target) {\n return;\n }\n\n if (document.fullscreenElement === target) {\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 (!currentStepHasSpeakableElement || hasCompletedCurrentStepAudio) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n setIsAudioLoadingVisible(loading);\n },\n [currentStepHasSpeakableElement, hasCompletedCurrentStepAudio]\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 },\n [onPointerDown]\n );\n\n const handleSurfaceClick = useCallback(() => {\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n }, [showPlayerControls]);\n\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(\n \"relative h-full w-full\",\n isMobileDevice && \"slide--mobile-device\",\n isImmersiveMobileFullscreen && \"slide--mobile-landscape\",\n isNativeMobileFullscreen && \"slide--mobile-landscape-native\",\n className\n )}\n onClick={handleSurfaceClick}\n onPointerDown={handleSurfacePointerDown}\n {...props}\n >\n {shouldShowMobileFullscreenMask ? (\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none fixed left-0 top-0 z-[9999] h-[100vh] max-h-[100vh] w-[100vw]\"\n />\n ) : null}\n\n <div\n ref={viewportRef}\n className={cn(\n \"slide__viewport relative h-full min-h-0 w-full\",\n isImmersiveMobileFullscreen && \"slide__viewport--mobile-landscape\",\n isImmersiveMobileFullscreen &&\n !shouldRotateFullscreenViewport &&\n \"slide__viewport--mobile-landscape-native\"\n )}\n >\n {shouldShowFullscreenHeader ? (\n <div className=\"slide-landscape-header\">\n <button\n aria-label={fullscreenHeader?.backAriaLabel ?? \"Back\"}\n className=\"slide-landscape-header__back\"\n onClick={handleFullscreenHeaderBack}\n type=\"button\"\n >\n <ChevronLeft className=\"h-6 w-6 text-white\" strokeWidth={2.25} />\n </button>\n\n {fullscreenHeader?.content ? (\n <div className=\"min-w-0 flex-1 overflow-hidden\">\n {fullscreenHeader.content}\n </div>\n ) : null}\n </div>\n ) : null}\n\n <div\n className={cn(\n \"h-full min-h-0 w-full\",\n shouldApplyFullscreenViewportPadding &&\n \"slide__viewport-content--with-header\",\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 <LoadingOverlayCard\n message={bufferingText}\n className=\"absolute left-1/2 top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2\"\n />\n ) : null}\n\n <SlideFullscreenHint\n onClose={handleFullscreenHintClose}\n open={isFullscreenHintOpen}\n text={fullscreenHintText}\n />\n\n <SubtitleOverlay\n extraBottomOffset={interactionOverlaySubtitleOffset}\n hasPlayerGap={playerVisible}\n isEnabled={isSubtitleEnabled && hasCurrentAudioPlaybackStarted}\n isPlayerHidden={shouldRenderPlayer && !playerVisible}\n playbackTimeStore={playbackTimeStore}\n subtitleCues={currentSubtitleCues}\n />\n\n {shouldShowInteractionOverlay ? (\n <div\n ref={interactionOverlayRef}\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 isPlaybackPaused={shouldPausePlaybackForCustomAction}\n isAutoAdvanceEnabled={isAutoAdvanceEnabled}\n hasInteraction={Boolean(activeInteractionElement)}\n isInteractionOpen={isInteractionOverlayOpen}\n isSubtitleEnabled={isSubtitleEnabled}\n onAutoAdvanceToggle={setIsAutoAdvanceEnabled}\n onLoadingChange={handlePlayerLoadingChange}\n onPlaybackStarted={() => {\n setHasCurrentAudioPlaybackStarted(true);\n }}\n onPlaybackTimeChange={playbackTimeStore.setTime}\n onSubtitleToggle={() => {\n setIsSubtitleEnabled((previousEnabled) => !previousEnabled);\n }}\n nextDisabled={!canGoNext}\n onEnded={handlePlayerEnded}\n onFullscreen={handleFullscreen}\n isFullscreen={isBrowserFullscreen}\n mobileViewMode={effectiveMobileViewMode}\n settingsPortalContainer={viewportRef.current}\n onMobileViewModeChange={handleMobileViewModeSelect}\n onInteractionToggle={handleInteractionToggle}\n onNext={handleNext}\n onPrev={handlePrev}\n prevDisabled={!canGoPrev}\n showControls={playerVisible}\n texts={playerTexts}\n customActionContext={playerCustomActionContext}\n customActions={playerCustomActions}\n useAutoAdvanceToggle={shouldUseSilentStepAutoAdvanceToggle}\n />\n ) : null}\n </div>\n </section>\n );\n};\n\nexport default Slide;\n"],"names":["DEFAULT_MARKER_AUTO_ADVANCE_DELAY_MS","DEFAULT_INTERACTION_OVERLAY_OPEN_DELAY_MS","DEFAULT_INTERACTION_OVERLAY_FALLBACK_OFFSET_PX","DEFAULT_INTERACTION_SUBTITLE_GAP_PX","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","fullscreenHeader","playerCustomActions","playerCustomActionPauseOnActive","bufferingText","interactionTitle","interactionTexts","playerTexts","playerAutoHideDelay","markerAutoAdvanceDelay","interactionDefaultValueOptions","onPlayerVisibilityChange","onMobileViewModeChange","onStepChange","enableIframeScaling","className","onPointerDown","props","sectionRef","useRef","viewportRef","stageLayerRef","lastElementRef","playerHideTimerRef","autoAdvanceTimerRef","interactionAutoCloseTimerRef","interactionOverlayOpenTimerRef","interactionOverlayRef","prevRenderElementKeysRef","shouldScrollToBottomRef","pendingInteractionOverlayStepIndexRef","playbackResetKeyRef","appendedMarkerAdvanceStateRef","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","isAutoAdvanceEnabled","setIsAutoAdvanceEnabled","currentAudioKey","setCurrentAudioKey","isAudioLoadingVisible","setIsAudioLoadingVisible","hasCompletedCurrentStepAudio","setHasCompletedCurrentStepAudio","hasCurrentAudioPlaybackStarted","setHasCurrentAudioPlaybackStarted","isSubtitleEnabled","setIsSubtitleEnabled","isPlayerCustomActionActive","setIsPlayerCustomActionActive","activeInteractionElement","setActiveInteractionElement","isInteractionOverlayOpen","setIsInteractionOverlayOpen","interactionOverlaySubtitleOffset","setInteractionOverlaySubtitleOffset","isBrowserFullscreen","setIsBrowserFullscreen","isMobileDevice","getIsMobileDevice","mobileViewMode","setMobileViewMode","DEFAULT_MOBILE_VIEW_MODE","hasManualMobileViewMode","setHasManualMobileViewMode","isViewportFullscreenPreferred","setIsViewportFullscreenPreferred","getIsFullscreenPreferredViewport","isFullscreenHintOpen","setIsFullscreenHintOpen","playbackTimeStore","createPlaybackTimeStore","effectiveMobileViewMode","isImmersiveMobileFullscreen","isNativeMobileFullscreen","shouldRotateFullscreenViewport","resolveMobileViewModeState","previousEffectiveMobileViewModeRef","playerVisible","shouldShowFullscreenHeader","shouldApplyFullscreenViewportPadding","shouldShowMobileFullscreenMask","fullscreenHintText","DEFAULT_SLIDE_PLAYER_TEXTS","handleMobileViewModeSelect","useCallback","nextViewMode","handleMobileViewModeReset","handleFullscreenHeaderBack","handleFullscreenHintClose","setPlayerCustomActionActive","active","togglePlayerCustomActionActive","previous","mountedStepStates","currentMountedStateIndex","nextMountedStepStates","mountedStateIndexByStep","stepElementList","stepIndex","existingMountedStateIndex","mountedStepState","currentStepKey","currentAudioIndex","audioItem","currentAudioItem","currentSubtitleCues","currentAudioSequenceStartKey","playerCustomActionContext","resolvePlayerCustomActionElement","playerCustomActionCount","getPlayerCustomActionCount","interactionOverlayStyle","hasAvailableStepAudio","currentInteractionResetKey","currentPlaybackResetKey","currentPlaybackStartedResetKey","hasCurrentStepAudioUrl","shouldPausePlaybackForCustomAction","shouldUseSilentStepAutoAdvanceToggle","shouldUseAutoAdvanceToggle","clearPlayerHideTimer","clearInteractionAutoCloseTimer","clearInteractionOverlayOpenTimer","clearAutoAdvanceTimer","resetAudioSequence","startCurrentAudioSequence","nextAudioKey","continueAfterInteraction","scheduleInteractionOverlayOpen","interactionElement","openOverlay","showPlayerControls","enableAutoHide","hasResolvedCurrentInteraction","shouldBlockPlaybackForInteraction","useEffect","syncViewportFullscreenPreference","subscribeMobileDeviceChange","shouldShowFullscreenHint","previousState","shouldAdvanceIntoAppendedMarker","shouldAutoAdvanceIntoAppendedMarker","handleSandboxInteraction","event","isSandboxInteractionMessage","useWakePlayerFromIframe","hasPlaybackContextChanged","shouldInitializeAudioSequence","getPlaybackSequenceTransition","shouldOpenInteractionOverlayAfterAudio","shouldPresentOverlay","shouldPresentInteractionOverlay","interactionDefaults","shouldPreferResolvedInteractionInput","getInteractionDefaultValues","interactionDefaultSelectedValues","getInteractionDefaultSelectedValues","hasResolvedInteractionInput","isInteractionReadonly","shouldAutoContinueInteraction","shouldShowInteractionOverlay","handleInteractionSend","resolvedUserInput","prevElement","syncFullscreenState","interactionOverlayElement","updateSubtitleOffset","overlayHeight","resizeObserver","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","handleSurfaceClick","currentRenderElementKeys","prevKeys","shouldAutoScrollToAppend","key","animationFrameId","targetElement","stageLayerRect","targetRect","nextScrollTop","ChevronLeft","mountedStepStateIndex","LoadingOverlayCard","SlideFullscreenHint","SubtitleOverlay","Player","previousEnabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAMA,KAAuC,KACvCC,KAA4C,KAC5CC,KAAiD,KACjDC,KAAsC,IAiCtCC,KAAyBC;AAAA,EAC7B,CAAC;AAAA,IACC,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,EAAA,MAEXC,gBAAAA,EAAAA,KAAC,OAAA,EAAI,WAAU,kCACb,UAAA;AAAA,IAAAC,gBAAAA,EAAAA,IAAC,OAAA,EAAI,WAAU,oCACb,UAAAA,gBAAAA,EAAAA,IAAC,OAAE,WAAU,mCAAmC,aAAM,EAAA,CACxD;AAAA,IACAA,gBAAAA,EAAAA,IAAC,OAAA,EAAI,WAAU,kCACb,UAAAA,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAAAZ;AAAA,QACA,mBAAAE;AAAA,QACA,kBAAAC;AAAA,QACA,uBAAAC;AAAA,QACA,mBAAAC;AAAA,QACA,gBAAAC;A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d,OAAO7F;AAAA,kBACP,qBAAqB2H;AAAA,kBACrB,eAAehI;AAAA,kBACf,sBAAsB2I;AAAA,gBAAA;AAAA,cAAA,IAEtB;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACN;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"Slide.es.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 { ChevronLeft } from \"lucide-react\";\n\nimport { isSandboxInteractionMessage } from \"../../lib/sandboxInteraction\";\nimport { cn } from \"../../lib/utils\";\nimport LoadingOverlayCard from \"../ui/loading-overlay-card\";\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 {\n isLandscapeViewport as getIsFullscreenPreferredViewport,\n isMobileDevice as getIsMobileDevice,\n subscribeMobileDeviceChange,\n} from \"../../lib/mobileDevice\";\nimport Player from \"./Player\";\nimport SubtitleOverlay from \"./SubtitleOverlay\";\nimport type { PlayerProps, SlidePlayerTexts } from \"./Player\";\nimport {\n DEFAULT_SLIDE_PLAYER_TEXTS,\n DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS,\n SLIDE_ERROR_CODES,\n} from \"./constants\";\nimport SlideFullscreenHint from \"./SlideFullscreenHint\";\nimport type { Element } from \"./types\";\nimport useSlide from \"./useSlide\";\nimport useWakePlayerFromIframe from \"./useWakePlayerFromIframe\";\nimport {\n DEFAULT_MOBILE_VIEW_MODE,\n resolveMobileViewModeState,\n type MobileViewMode,\n} from \"./utils/mobileScreenMode\";\nimport { shouldPresentInteractionOverlay } from \"./utils/interactionPlayback\";\nimport { shouldAutoAdvanceIntoAppendedMarker } from \"./utils/appendedMarkerAdvance\";\nimport { getPlaybackSequenceTransition } from \"./utils/playbackSequence\";\nimport {\n getPlayerCustomActionCount,\n resolvePlayerCustomActionElement,\n} from \"./utils/playerCustomActions\";\nimport { createPlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport { shouldUseAutoAdvanceToggle } from \"./utils/playerToggleMode\";\nimport \"./slide.css\";\nexport type {\n Element,\n ElementAudioSegment,\n ElementSubtitleCue,\n SlidePlayerCustomActionContext,\n SlidePlayerCustomActions,\n} from \"./types\";\n\nconst DEFAULT_MARKER_AUTO_ADVANCE_DELAY_MS = 2000;\nconst DEFAULT_INTERACTION_OVERLAY_OPEN_DELAY_MS = 300;\nconst DEFAULT_INTERACTION_OVERLAY_FALLBACK_OFFSET_PX = 160;\nconst DEFAULT_INTERACTION_SUBTITLE_GAP_PX = 16;\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\n extends Pick<\n ContentRenderProps,\n \"confirmButtonText\" | \"copyButtonText\" | \"copiedButtonText\"\n > {\n title?: string;\n}\n\nexport type SlideErrorCode =\n (typeof SLIDE_ERROR_CODES)[keyof typeof SLIDE_ERROR_CODES];\n\nexport interface SlideErrorContext {\n code: SlideErrorCode;\n}\n\nexport type SlideFullscreenHeader = {\n content?: React.ReactNode;\n backAriaLabel?: string;\n onBack?: () => void;\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>\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\nconst getStreamContentActivityKey = (content: Element[\"content\"]) => {\n if (typeof content === \"string\") {\n return `string:${content.length}:${content.slice(-32)}`;\n }\n\n if (typeof content === \"number\" || typeof content === \"boolean\") {\n return `primitive:${String(content)}`;\n }\n\n if (React.isValidElement(content)) {\n return `element:${String(content.key ?? \"\")}`;\n }\n\n if (Array.isArray(content)) {\n return `array:${content.length}`;\n }\n\n if (content == null) {\n return \"null\";\n }\n\n return `object:${typeof content}`;\n};\n\nconst getStreamAudioSegmentsActivityKey = (\n audioSegments: Element[\"audio_segments\"]\n) =>\n (audioSegments ?? [])\n .map((segment) =>\n [\n String(segment.segment_index ?? \"none\"),\n segment.is_final ? \"1\" : \"0\",\n String(segment.duration_ms ?? 0),\n String(segment.audio_url ?? \"\"),\n String(segment.audio_data?.length ?? 0),\n ].join(\":\")\n )\n .join(\",\");\n\nconst getStreamActivityKey = (elementList: Element[]) =>\n elementList\n .map((element, index) =>\n [\n String(element.sequence_number ?? index),\n String(element.type),\n getStreamContentActivityKey(element.content),\n String(element.audio_url ?? \"\"),\n getStreamAudioSegmentsActivityKey(element.audio_segments),\n element.is_renderable === false ? \"hidden\" : \"visible\",\n element.is_new ? \"new\" : \"stable\",\n element.is_speakable ? \"speakable\" : \"silent\",\n String(element.user_input ?? \"\"),\n element.readonly ? \"readonly\" : \"editable\",\n ].join(\"|\")\n )\n .join(\"||\");\n\nexport interface SlideProps extends React.ComponentProps<\"section\"> {\n elementList?: Element[];\n isStreaming?: boolean;\n showPlayer?: boolean;\n playerAlwaysVisible?: boolean;\n playerClassName?: string;\n fullscreenHeader?: SlideFullscreenHeader;\n playerCustomActions?: PlayerProps[\"customActions\"];\n playerCustomActionPauseOnActive?: boolean;\n bufferingText?: string;\n interactionTitle?: string;\n interactionTexts?: SlideInteractionTexts;\n playerTexts?: SlidePlayerTexts;\n playerAutoHideDelay?: number;\n markerAutoAdvanceDelay?: number;\n streamInactivityTimeoutMs?: number;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n onSend?: (content: OnSendContentParams, element?: Element) => void;\n onPlayerVisibilityChange?: (visible: boolean) => void;\n onMobileViewModeChange?: (viewMode: MobileViewMode) => void;\n onError?: (error: SlideErrorContext) => void;\n onStepChange?: (element: Element | undefined, index: number) => void;\n enableIframeScaling?: boolean;\n}\n\nconst Slide: React.FC<SlideProps> = ({\n elementList = [],\n isStreaming = false,\n showPlayer = true,\n playerAlwaysVisible = false,\n playerClassName,\n fullscreenHeader,\n playerCustomActions,\n playerCustomActionPauseOnActive = true,\n bufferingText = \"Buffering...\",\n interactionTitle,\n interactionTexts,\n playerTexts,\n playerAutoHideDelay = 3000,\n markerAutoAdvanceDelay = DEFAULT_MARKER_AUTO_ADVANCE_DELAY_MS,\n streamInactivityTimeoutMs = DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS,\n interactionDefaultValueOptions,\n onSend,\n onPlayerVisibilityChange,\n onMobileViewModeChange,\n onError,\n onStepChange,\n enableIframeScaling = true,\n className,\n onPointerDown,\n ...props\n}) => {\n const sectionRef = useRef<HTMLElement | null>(null);\n const viewportRef = useRef<HTMLDivElement | 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 interactionOverlayOpenTimerRef = useRef<number | null>(null);\n const streamInactivityTimerRef = useRef<number | null>(null);\n const interactionOverlayRef = useRef<HTMLDivElement | null>(null);\n const prevRenderElementKeysRef = useRef<string[]>([]);\n const lastStreamActivityKeyRef = useRef<string | null>(null);\n const shouldScrollToBottomRef = useRef(false);\n const hasStreamStartedRef = useRef(false);\n const hasStreamInactivityTimedOutRef = useRef(false);\n const pendingInteractionOverlayStepIndexRef = useRef<number | null>(null);\n const playbackResetKeyRef = useRef<string | null>(null);\n const appendedMarkerAdvanceStateRef = useRef({\n markerCount: 0,\n currentIndex: -1,\n canGoNext: false,\n });\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 [isAutoAdvanceEnabled, setIsAutoAdvanceEnabled] = useState(true);\n const [currentAudioKey, setCurrentAudioKey] = useState<string | null>(null);\n const [isAudioLoadingVisible, setIsAudioLoadingVisible] = useState(false);\n const [hasStreamInactivityTimedOut, setHasStreamInactivityTimedOut] =\n useState(false);\n const [hasCompletedCurrentStepAudio, setHasCompletedCurrentStepAudio] =\n useState(false);\n const [hasCurrentAudioPlaybackStarted, setHasCurrentAudioPlaybackStarted] =\n useState(false);\n const [isSubtitleEnabled, setIsSubtitleEnabled] = useState(true);\n const [isPlayerCustomActionActive, setIsPlayerCustomActionActive] =\n useState(false);\n const [activeInteractionElement, setActiveInteractionElement] = useState<\n Element | undefined\n >();\n const [isInteractionOverlayOpen, setIsInteractionOverlayOpen] =\n useState(false);\n const [\n interactionOverlaySubtitleOffset,\n setInteractionOverlaySubtitleOffset,\n ] = useState(0);\n const [isBrowserFullscreen, setIsBrowserFullscreen] = useState(false);\n const isMobileDevice = useMemo(() => getIsMobileDevice(), []);\n const [mobileViewMode, setMobileViewMode] = useState<MobileViewMode>(\n DEFAULT_MOBILE_VIEW_MODE\n );\n const [hasManualMobileViewMode, setHasManualMobileViewMode] = useState(false);\n const [isViewportFullscreenPreferred, setIsViewportFullscreenPreferred] =\n useState(() =>\n isMobileDevice ? getIsFullscreenPreferredViewport() : false\n );\n const [isFullscreenHintOpen, setIsFullscreenHintOpen] = useState(false);\n const playbackTimeStore = useMemo(() => createPlaybackTimeStore(), []);\n const {\n effectiveMobileViewMode,\n isImmersiveMobileFullscreen,\n isNativeMobileFullscreen,\n shouldRotateFullscreenViewport,\n } = useMemo(\n () =>\n resolveMobileViewModeState({\n hasManualMobileViewMode,\n isMobileDevice,\n isViewportFullscreenPreferred,\n mobileViewMode,\n }),\n [\n hasManualMobileViewMode,\n isMobileDevice,\n isViewportFullscreenPreferred,\n mobileViewMode,\n ]\n );\n const previousEffectiveMobileViewModeRef = useRef(effectiveMobileViewMode);\n const playerVisible =\n shouldRenderPlayer && (playerAlwaysVisible || isPlayerVisible);\n const shouldShowFullscreenHeader =\n isImmersiveMobileFullscreen && playerVisible;\n const shouldApplyFullscreenViewportPadding =\n isImmersiveMobileFullscreen && playerVisible;\n const shouldShowMobileFullscreenMask =\n isImmersiveMobileFullscreen || isNativeMobileFullscreen;\n const fullscreenHintText =\n playerTexts?.fullscreenHintText ??\n DEFAULT_SLIDE_PLAYER_TEXTS.fullscreenHintText;\n const streamActivityKey = useMemo(\n () => getStreamActivityKey(elementList),\n [elementList]\n );\n const updateAudioLoadingVisibility = useCallback(\n (\n nextVisible: boolean,\n reason: string,\n detail?: Record<string, unknown>\n ) => {\n // Centralize buffering logs so every visibility toggle reports\n // the caller reason with the same playback context.\n setIsAudioLoadingVisible((previousVisible) => {\n console.log(\"[Slide buffering loading]\", {\n reason,\n previousVisible,\n nextVisible,\n currentIndex,\n currentAudioKey,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n hasStreamInactivityTimedOut,\n isStreaming,\n streamActivityKey,\n ...detail,\n });\n\n return nextVisible;\n });\n },\n [\n currentAudioKey,\n currentIndex,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n hasStreamInactivityTimedOut,\n isStreaming,\n streamActivityKey,\n ]\n );\n const handleMobileViewModeSelect = useCallback(\n (nextViewMode: MobileViewMode) => {\n setHasManualMobileViewMode(true);\n setMobileViewMode(nextViewMode);\n },\n []\n );\n const handleMobileViewModeReset = useCallback(() => {\n // Clear manual override so the effective mode returns to the default non-fullscreen state.\n setHasManualMobileViewMode(false);\n setMobileViewMode(DEFAULT_MOBILE_VIEW_MODE);\n }, []);\n const handleFullscreenHeaderBack = useCallback(() => {\n handleMobileViewModeReset();\n fullscreenHeader?.onBack?.();\n }, [fullscreenHeader, handleMobileViewModeReset]);\n const handleFullscreenHintClose = useCallback(() => {\n setIsFullscreenHintOpen(false);\n }, []);\n const setPlayerCustomActionActive = useCallback((active: boolean) => {\n setIsPlayerCustomActionActive(active);\n }, []);\n const togglePlayerCustomActionActive = useCallback(() => {\n setIsPlayerCustomActionActive((previous) => !previous);\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 currentAudioItem = useMemo(\n () => (currentAudioIndex >= 0 ? audioList[currentAudioIndex] : undefined),\n [audioList, currentAudioIndex]\n );\n const currentSubtitleCues = currentAudioItem?.element?.subtitle_cues ?? [];\n const currentAudioSequenceStartKey = useMemo(\n () => currentAudioSequenceKeys[0] ?? \"none\",\n [currentAudioSequenceKeys]\n );\n const playerCustomActionContext = useMemo(\n () => ({\n currentElement: resolvePlayerCustomActionElement({\n currentAudioIndex,\n currentAudioSequenceIndexes,\n audioList,\n currentInteractionElement: activeInteractionElement,\n currentStepElement,\n }),\n currentIndex,\n currentStepElement,\n isActive: isPlayerCustomActionActive,\n setActive: setPlayerCustomActionActive,\n toggleActive: togglePlayerCustomActionActive,\n }),\n [\n activeInteractionElement,\n audioList,\n currentAudioIndex,\n currentAudioSequenceIndexes,\n currentIndex,\n currentStepElement,\n isPlayerCustomActionActive,\n setPlayerCustomActionActive,\n togglePlayerCustomActionActive,\n ]\n );\n const playerCustomActionCount = useMemo(\n () =>\n getPlayerCustomActionCount(\n playerCustomActions,\n playerCustomActionContext\n ),\n [playerCustomActionContext, playerCustomActions]\n );\n const interactionOverlayStyle = useMemo(\n () =>\n ({\n \"--slide-player-custom-action-count\": String(playerCustomActionCount),\n \"--slide-player-mobile-control-count\": String(\n playerCustomActionCount + 4\n ),\n }) as React.CSSProperties,\n [playerCustomActionCount]\n );\n const hasAvailableStepAudio = currentAudioSequenceKeys.length > 0;\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 currentPlaybackStartedResetKey = useMemo(\n () =>\n [\n currentPlaybackResetKey,\n currentAudioItem?.audioKey ?? \"none\",\n String(currentAudioIndex),\n ].join(\"|\"),\n [currentAudioIndex, currentAudioItem?.audioKey, currentPlaybackResetKey]\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 const shouldPausePlaybackForCustomAction =\n playerCustomActionPauseOnActive &&\n Boolean(playerCustomActions) &&\n isPlayerCustomActionActive;\n const shouldUseSilentStepAutoAdvanceToggle = useMemo(\n () =>\n shouldUseAutoAdvanceToggle({\n canGoNext,\n currentAudioIndex,\n currentStepHasSpeakableElement,\n hasInteraction: Boolean(currentInteractionElement),\n }),\n [\n canGoNext,\n currentAudioIndex,\n currentInteractionElement,\n currentStepHasSpeakableElement,\n ]\n );\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 clearInteractionOverlayOpenTimer = useCallback(() => {\n if (interactionOverlayOpenTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(interactionOverlayOpenTimerRef.current);\n interactionOverlayOpenTimerRef.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 clearStreamInactivityTimer = useCallback(() => {\n if (streamInactivityTimerRef.current === null) {\n return;\n }\n\n window.clearTimeout(streamInactivityTimerRef.current);\n streamInactivityTimerRef.current = null;\n }, []);\n\n const resetAudioSequence = useCallback(() => {\n clearAutoAdvanceTimer();\n clearInteractionAutoCloseTimer();\n clearInteractionOverlayOpenTimer();\n setCurrentAudioKey(null);\n playbackTimeStore.reset();\n updateAudioLoadingVisibility(false, \"reset-audio-sequence\");\n setHasCompletedCurrentStepAudio(false);\n setHasCurrentAudioPlaybackStarted(false);\n setActiveInteractionElement(undefined);\n setIsInteractionOverlayOpen(false);\n setInteractionOverlaySubtitleOffset(0);\n }, [\n clearAutoAdvanceTimer,\n clearInteractionAutoCloseTimer,\n clearInteractionOverlayOpenTimer,\n playbackTimeStore,\n updateAudioLoadingVisibility,\n ]);\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 clearInteractionOverlayOpenTimer();\n setIsInteractionOverlayOpen(false);\n setInteractionOverlaySubtitleOffset(0);\n\n if (startCurrentAudioSequence()) {\n return;\n }\n\n if (canGoNext) {\n goNext();\n }\n }, [\n canGoNext,\n clearInteractionAutoCloseTimer,\n clearInteractionOverlayOpenTimer,\n goNext,\n startCurrentAudioSequence,\n ]);\n\n const scheduleInteractionOverlayOpen = useCallback(\n (interactionElement?: Element) => {\n clearInteractionOverlayOpenTimer();\n\n if (!interactionElement) {\n return;\n }\n\n const openOverlay = () => {\n interactionOverlayOpenTimerRef.current = null;\n setInteractionOverlaySubtitleOffset(\n DEFAULT_INTERACTION_OVERLAY_FALLBACK_OFFSET_PX\n );\n setIsInteractionOverlayOpen(true);\n pendingInteractionOverlayStepIndexRef.current = null;\n };\n\n interactionOverlayOpenTimerRef.current = window.setTimeout(\n openOverlay,\n DEFAULT_INTERACTION_OVERLAY_OPEN_DELAY_MS\n );\n },\n [clearInteractionOverlayOpenTimer]\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 // Reset silent-step autoplay toggle whenever navigation lands on a new step.\n setIsAutoAdvanceEnabled(true);\n\n if (playerCustomActionPauseOnActive) {\n setIsPlayerCustomActionActive(false);\n }\n }, [currentIndex, playerCustomActionPauseOnActive]);\n\n useEffect(() => {\n return () => {\n clearAutoAdvanceTimer();\n clearPlayerHideTimer();\n clearInteractionAutoCloseTimer();\n clearInteractionOverlayOpenTimer();\n clearStreamInactivityTimer();\n };\n }, [\n clearAutoAdvanceTimer,\n clearInteractionAutoCloseTimer,\n clearInteractionOverlayOpenTimer,\n clearPlayerHideTimer,\n clearStreamInactivityTimer,\n ]);\n\n useEffect(() => {\n if (!isStreaming || streamInactivityTimeoutMs <= 0) {\n clearStreamInactivityTimer();\n lastStreamActivityKeyRef.current = null;\n hasStreamStartedRef.current = false;\n hasStreamInactivityTimedOutRef.current = false;\n setHasStreamInactivityTimedOut(false);\n return;\n }\n\n const hasStreamingStarted = !hasStreamStartedRef.current;\n const hasStreamActivityChanged =\n lastStreamActivityKeyRef.current !== streamActivityKey;\n\n hasStreamStartedRef.current = true;\n\n if (hasStreamingStarted || hasStreamActivityChanged) {\n lastStreamActivityKeyRef.current = streamActivityKey;\n\n if (hasStreamInactivityTimedOutRef.current) {\n hasStreamInactivityTimedOutRef.current = false;\n setHasStreamInactivityTimedOut(false);\n }\n }\n\n clearStreamInactivityTimer();\n\n streamInactivityTimerRef.current = window.setTimeout(() => {\n streamInactivityTimerRef.current = null;\n\n if (hasStreamInactivityTimedOutRef.current) {\n return;\n }\n\n hasStreamInactivityTimedOutRef.current = true;\n setHasStreamInactivityTimedOut(true);\n updateAudioLoadingVisibility(false, \"stream-inactivity-timeout\");\n onError?.({\n code: SLIDE_ERROR_CODES.STREAM_INACTIVITY_TIMEOUT,\n });\n }, streamInactivityTimeoutMs);\n\n return () => {\n clearStreamInactivityTimer();\n };\n }, [\n clearStreamInactivityTimer,\n isStreaming,\n onError,\n streamActivityKey,\n streamInactivityTimeoutMs,\n updateAudioLoadingVisibility,\n ]);\n\n useEffect(() => {\n onPlayerVisibilityChange?.(playerVisible);\n\n return () => {\n onPlayerVisibilityChange?.(false);\n };\n }, [onPlayerVisibilityChange, playerVisible]);\n\n useEffect(() => {\n if (isMobileDevice || mobileViewMode === DEFAULT_MOBILE_VIEW_MODE) {\n return;\n }\n\n setHasManualMobileViewMode(false);\n setMobileViewMode(DEFAULT_MOBILE_VIEW_MODE);\n }, [isMobileDevice, mobileViewMode]);\n\n useEffect(() => {\n if (!isMobileDevice) {\n setIsViewportFullscreenPreferred(false);\n return;\n }\n\n const syncViewportFullscreenPreference = () => {\n setIsViewportFullscreenPreferred(getIsFullscreenPreferredViewport());\n };\n\n syncViewportFullscreenPreference();\n\n return subscribeMobileDeviceChange(syncViewportFullscreenPreference);\n }, [isMobileDevice]);\n\n useEffect(() => {\n onMobileViewModeChange?.(effectiveMobileViewMode);\n }, [effectiveMobileViewMode, onMobileViewModeChange]);\n\n useEffect(() => {\n const previousMode = previousEffectiveMobileViewModeRef.current;\n const hasEnteredFullscreen =\n previousMode !== \"fullscreen\" && effectiveMobileViewMode === \"fullscreen\";\n const shouldShowFullscreenHint =\n hasEnteredFullscreen && !isViewportFullscreenPreferred;\n\n previousEffectiveMobileViewModeRef.current = effectiveMobileViewMode;\n\n if (!isMobileDevice) {\n setIsFullscreenHintOpen(false);\n return;\n }\n\n if (shouldShowFullscreenHint) {\n setIsFullscreenHintOpen(true);\n return;\n }\n\n if (effectiveMobileViewMode !== \"fullscreen\") {\n setIsFullscreenHintOpen(false);\n }\n }, [effectiveMobileViewMode, isMobileDevice, isViewportFullscreenPreferred]);\n\n useEffect(() => {\n onStepChange?.(currentStepElement, currentIndex);\n }, [currentIndex, currentStepElement, onStepChange]);\n\n useEffect(() => {\n const previousState = appendedMarkerAdvanceStateRef.current;\n const shouldAdvanceIntoAppendedMarker = shouldAutoAdvanceIntoAppendedMarker(\n {\n previousMarkerCount: previousState.markerCount,\n nextMarkerCount: slideElementList.length,\n previousIndex: previousState.currentIndex,\n previousCanGoNext: previousState.canGoNext,\n nextCanGoNext: canGoNext,\n currentAudioKey,\n hasCompletedCurrentStepAudio,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n currentInteractionElement,\n isAutoAdvanceEnabled,\n shouldUseSilentStepAutoAdvanceToggle,\n }\n );\n\n appendedMarkerAdvanceStateRef.current = {\n markerCount: slideElementList.length,\n currentIndex,\n canGoNext,\n };\n\n if (!shouldAdvanceIntoAppendedMarker) {\n return;\n }\n\n goNext();\n }, [\n canGoNext,\n currentAudioKey,\n currentIndex,\n currentInteractionElement,\n currentStepHasSpeakableElement,\n goNext,\n hasCompletedCurrentStepAudio,\n hasResolvedCurrentInteraction,\n isAutoAdvanceEnabled,\n shouldUseSilentStepAutoAdvanceToggle,\n slideElementList.length,\n ]);\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 (event.data.eventType !== \"click\") {\n return;\n }\n\n if (!shouldRenderPlayer) {\n return;\n }\n\n // Restore player controls on explicit click/tap without waking on scroll start.\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 { hasPlaybackContextChanged, shouldInitializeAudioSequence } =\n getPlaybackSequenceTransition({\n previousResetKey: playbackResetKeyRef.current,\n nextResetKey: currentPlaybackResetKey,\n currentAudioKey,\n hasCompletedCurrentStepAudio,\n });\n\n playbackResetKeyRef.current = currentPlaybackResetKey;\n\n const shouldOpenInteractionOverlayAfterAudio =\n pendingInteractionOverlayStepIndexRef.current === currentIndex &&\n Boolean(currentInteractionElement);\n const shouldPresentOverlay = shouldPresentInteractionOverlay({\n hasInteraction: Boolean(currentInteractionElement),\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasPlaybackContextChanged,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n });\n\n if (hasPlaybackContextChanged) {\n resetAudioSequence();\n }\n\n if (currentElementList.length === 0 && !currentInteractionElement) {\n return;\n }\n\n if (shouldPausePlaybackForCustomAction) {\n return;\n }\n\n if (currentInteractionElement) {\n setActiveInteractionElement(currentInteractionElement);\n }\n\n if (shouldPresentOverlay) {\n // Delay auto-presenting the overlay so subtitles can settle above it.\n scheduleInteractionOverlayOpen(currentInteractionElement);\n return;\n }\n\n clearInteractionOverlayOpenTimer();\n pendingInteractionOverlayStepIndexRef.current = null;\n\n if (!shouldInitializeAudioSequence) {\n return;\n }\n\n if (startCurrentAudioSequence()) {\n return;\n }\n\n if (currentStepHasSpeakableElement) {\n if (hasStreamInactivityTimedOut) {\n updateAudioLoadingVisibility(\n false,\n \"step-wait-suppressed-after-timeout\"\n );\n return;\n }\n\n updateAudioLoadingVisibility(true, \"step-waiting-for-first-audio\");\n return;\n }\n\n if (!canGoNext) {\n return;\n }\n\n if (shouldUseSilentStepAutoAdvanceToggle && !isAutoAdvanceEnabled) {\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 }, markerAutoAdvanceDelay);\n\n return () => {\n clearAutoAdvanceTimer();\n };\n }, [\n canGoNext,\n clearAutoAdvanceTimer,\n currentElementList.length,\n currentInteractionElement,\n currentAudioKey,\n currentPlaybackResetKey,\n currentStepHasSpeakableElement,\n markerAutoAdvanceDelay,\n goNext,\n hasCompletedCurrentStepAudio,\n hasStreamInactivityTimedOut,\n isAutoAdvanceEnabled,\n hasResolvedCurrentInteraction,\n shouldBlockPlaybackForInteraction,\n clearInteractionOverlayOpenTimer,\n resetAudioSequence,\n scheduleInteractionOverlayOpen,\n startCurrentAudioSequence,\n shouldPausePlaybackForCustomAction,\n shouldUseSilentStepAutoAdvanceToggle,\n updateAudioLoadingVisibility,\n ]);\n\n useEffect(() => {\n if (\n hasStreamInactivityTimedOut ||\n shouldPausePlaybackForCustomAction ||\n !currentStepHasSpeakableElement ||\n shouldBlockPlaybackForInteraction\n ) {\n updateAudioLoadingVisibility(false, \"loading-hidden-blocked-state\", {\n shouldPausePlaybackForCustomAction,\n shouldBlockPlaybackForInteraction,\n });\n return;\n }\n\n if (hasCompletedCurrentStepAudio) {\n updateAudioLoadingVisibility(\n false,\n \"loading-hidden-step-audio-completed\"\n );\n return;\n }\n\n if (hasAvailableStepAudio) {\n updateAudioLoadingVisibility(false, \"loading-hidden-audio-available\");\n return;\n }\n\n updateAudioLoadingVisibility(true, \"loading-visible-awaiting-step-audio\");\n }, [\n hasStreamInactivityTimedOut,\n hasAvailableStepAudio,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n shouldPausePlaybackForCustomAction,\n shouldBlockPlaybackForInteraction,\n updateAudioLoadingVisibility,\n ]);\n\n useEffect(() => {\n if (currentAudioKey || currentAudioSequenceKeys.length === 0) {\n return;\n }\n\n if (\n shouldPausePlaybackForCustomAction ||\n !currentStepHasSpeakableElement ||\n shouldBlockPlaybackForInteraction\n ) {\n return;\n }\n\n if (hasCompletedCurrentStepAudio) {\n return;\n }\n\n startCurrentAudioSequence();\n }, [\n currentAudioKey,\n currentAudioSequenceKeys,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n shouldPausePlaybackForCustomAction,\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 (currentAudioIndex >= 0) {\n return;\n }\n\n playbackTimeStore.reset();\n }, [currentAudioIndex, playbackTimeStore]);\n\n useEffect(() => {\n setHasCurrentAudioPlaybackStarted(false);\n }, [currentPlaybackStartedResetKey]);\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 const shouldShowInteractionOverlay =\n Boolean(activeInteractionElement) && isInteractionOverlayOpen;\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 // Keep the player icon in sync with the actual fullscreen owner.\n const syncFullscreenState = () => {\n setIsBrowserFullscreen(document.fullscreenElement === sectionRef.current);\n };\n\n syncFullscreenState();\n document.addEventListener(\"fullscreenchange\", syncFullscreenState);\n\n return () => {\n document.removeEventListener(\"fullscreenchange\", syncFullscreenState);\n };\n }, []);\n\n useEffect(() => {\n if (!shouldShowInteractionOverlay) {\n setInteractionOverlaySubtitleOffset(0);\n return;\n }\n\n const interactionOverlayElement = interactionOverlayRef.current;\n\n if (!interactionOverlayElement) {\n return;\n }\n\n const updateSubtitleOffset = () => {\n const overlayHeight = Math.ceil(\n interactionOverlayElement.getBoundingClientRect().height\n );\n\n setInteractionOverlaySubtitleOffset(\n overlayHeight + DEFAULT_INTERACTION_SUBTITLE_GAP_PX\n );\n };\n\n updateSubtitleOffset();\n\n if (typeof ResizeObserver === \"undefined\") {\n return;\n }\n\n const resizeObserver = new ResizeObserver(() => {\n updateSubtitleOffset();\n });\n\n resizeObserver.observe(interactionOverlayElement);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [shouldShowInteractionOverlay]);\n\n useEffect(() => {\n clearInteractionAutoCloseTimer();\n\n if (!isInteractionOverlayOpen || !shouldAutoContinueInteraction) {\n return;\n }\n\n // Auto-close passive interaction markers 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 enableScaling={enableIframeScaling}\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 = useCallback(() => {\n const target = sectionRef.current;\n if (!target) {\n return;\n }\n\n if (document.fullscreenElement === target) {\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 updateAudioLoadingVisibility(false, \"player-prev\");\n showPlayerControls(true);\n resetAudioSequence();\n goPrev();\n }, [\n goPrev,\n resetAudioSequence,\n showPlayerControls,\n updateAudioLoadingVisibility,\n ]);\n\n const handleNext = useCallback(() => {\n shouldScrollToBottomRef.current = true;\n pendingInteractionOverlayStepIndexRef.current = null;\n setHasPlayerInteracted(true);\n updateAudioLoadingVisibility(false, \"player-next\");\n showPlayerControls(true);\n resetAudioSequence();\n goNext();\n }, [\n goNext,\n resetAudioSequence,\n showPlayerControls,\n updateAudioLoadingVisibility,\n ]);\n\n const handlePlayerLoadingChange = useCallback(\n (loading: boolean) => {\n if (\n hasStreamInactivityTimedOut ||\n !currentStepHasSpeakableElement ||\n hasCompletedCurrentStepAudio\n ) {\n updateAudioLoadingVisibility(false, \"player-loading-change-ignored\", {\n loading,\n });\n return;\n }\n\n updateAudioLoadingVisibility(\n loading,\n loading ? \"player-reported-loading\" : \"player-reported-ready\"\n );\n },\n [\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n hasStreamInactivityTimedOut,\n updateAudioLoadingVisibility,\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 updateAudioLoadingVisibility(false, \"player-ended-step-complete\");\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 updateAudioLoadingVisibility,\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 },\n [onPointerDown]\n );\n\n const handleSurfaceClick = useCallback(() => {\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n }, [showPlayerControls]);\n\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(\n \"relative h-full w-full\",\n isMobileDevice && \"slide--mobile-device\",\n isImmersiveMobileFullscreen && \"slide--mobile-landscape\",\n isNativeMobileFullscreen && \"slide--mobile-landscape-native\",\n className\n )}\n onClick={handleSurfaceClick}\n onPointerDown={handleSurfacePointerDown}\n {...props}\n >\n {shouldShowMobileFullscreenMask ? (\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none fixed left-0 top-0 z-[9999] h-[100vh] max-h-[100vh] w-[100vw]\"\n />\n ) : null}\n\n <div\n ref={viewportRef}\n className={cn(\n \"slide__viewport relative h-full min-h-0 w-full\",\n isImmersiveMobileFullscreen && \"slide__viewport--mobile-landscape\",\n isImmersiveMobileFullscreen &&\n !shouldRotateFullscreenViewport &&\n \"slide__viewport--mobile-landscape-native\"\n )}\n >\n {shouldShowFullscreenHeader ? (\n <div className=\"slide-landscape-header\">\n <button\n aria-label={fullscreenHeader?.backAriaLabel ?? \"Back\"}\n className=\"slide-landscape-header__back\"\n onClick={handleFullscreenHeaderBack}\n type=\"button\"\n >\n <ChevronLeft className=\"h-6 w-6 text-white\" strokeWidth={2.25} />\n </button>\n\n {fullscreenHeader?.content ? (\n <div className=\"min-w-0 flex-1 overflow-hidden\">\n {fullscreenHeader.content}\n </div>\n ) : null}\n </div>\n ) : null}\n\n <div\n className={cn(\n \"h-full min-h-0 w-full\",\n shouldApplyFullscreenViewportPadding &&\n \"slide__viewport-content--with-header\",\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 <LoadingOverlayCard\n message={bufferingText}\n className=\"absolute left-1/2 top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2\"\n />\n ) : null}\n\n <SlideFullscreenHint\n onClose={handleFullscreenHintClose}\n open={isFullscreenHintOpen}\n text={fullscreenHintText}\n />\n\n <SubtitleOverlay\n extraBottomOffset={interactionOverlaySubtitleOffset}\n hasPlayerGap={playerVisible}\n isEnabled={isSubtitleEnabled && hasCurrentAudioPlaybackStarted}\n isPlayerHidden={shouldRenderPlayer && !playerVisible}\n playbackTimeStore={playbackTimeStore}\n subtitleCues={currentSubtitleCues}\n />\n\n {shouldShowInteractionOverlay ? (\n <div\n ref={interactionOverlayRef}\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 isPlaybackPaused={shouldPausePlaybackForCustomAction}\n isAutoAdvanceEnabled={isAutoAdvanceEnabled}\n hasInteraction={Boolean(activeInteractionElement)}\n isInteractionOpen={isInteractionOverlayOpen}\n isSubtitleEnabled={isSubtitleEnabled}\n onAutoAdvanceToggle={setIsAutoAdvanceEnabled}\n onLoadingChange={handlePlayerLoadingChange}\n onPlaybackStarted={() => {\n setHasCurrentAudioPlaybackStarted(true);\n }}\n onPlaybackTimeChange={playbackTimeStore.setTime}\n onSubtitleToggle={() => {\n setIsSubtitleEnabled((previousEnabled) => !previousEnabled);\n }}\n nextDisabled={!canGoNext}\n onEnded={handlePlayerEnded}\n onFullscreen={handleFullscreen}\n isFullscreen={isBrowserFullscreen}\n mobileViewMode={effectiveMobileViewMode}\n settingsPortalContainer={viewportRef.current}\n onMobileViewModeChange={handleMobileViewModeSelect}\n onInteractionToggle={handleInteractionToggle}\n onNext={handleNext}\n onPrev={handlePrev}\n prevDisabled={!canGoPrev}\n showControls={playerVisible}\n texts={playerTexts}\n customActionContext={playerCustomActionContext}\n customActions={playerCustomActions}\n useAutoAdvanceToggle={shouldUseSilentStepAutoAdvanceToggle}\n />\n ) : null}\n </div>\n </section>\n );\n};\n\nexport default Slide;\n"],"names":["DEFAULT_MARKER_AUTO_ADVANCE_DELAY_MS","DEFAULT_INTERACTION_OVERLAY_OPEN_DELAY_MS","DEFAULT_INTERACTION_OVERLAY_FALLBACK_OFFSET_PX","DEFAULT_INTERACTION_SUBTITLE_GAP_PX","InteractionOverlayCard","memo","content","title","defaultButtonText","defaultInputText","defaultSelectedValues","confirmButtonText","copyButtonText","copiedButtonText","onSend","readonly","jsxs","jsx","ContentRender","areStepElementListsEqual","prevElementList","nextElementList","element","index","nextElement","getStreamContentActivityKey","React","getStreamAudioSegmentsActivityKey","audioSegments","segment","getStreamActivityKey","elementList","Slide","isStreaming","showPlayer","playerAlwaysVisible","playerClassName","fullscreenHeader","playerCustomActions","playerCustomActionPauseOnActive","bufferingText","interactionTitle","interactionTexts","playerTexts","playerAutoHideDelay","markerAutoAdvanceDelay","streamInactivityTimeoutMs","DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS","interactionDefaultValueOptions","onPlayerVisibilityChange","onMobileViewModeChange","onError","onStepChange","enableIframeScaling","className","onPointerDown","props","sectionRef","useRef","viewportRef","stageLayerRef","lastElementRef","playerHideTimerRef","autoAdvanceTimerRef","interactionAutoCloseTimerRef","interactionOverlayOpenTimerRef","streamInactivityTimerRef","interactionOverlayRef","prevRenderElementKeysRef","lastStreamActivityKeyRef","shouldScrollToBottomRef","hasStreamStartedRef","hasStreamInactivityTimedOutRef","pendingInteractionOverlayStepIndexRef","playbackResetKeyRef","appendedMarkerAdvanceStateRef","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","isAutoAdvanceEnabled","setIsAutoAdvanceEnabled","currentAudioKey","setCurrentAudioKey","isAudioLoadingVisible","setIsAudioLoadingVisible","hasStreamInactivityTimedOut","setHasStreamInactivityTimedOut","hasCompletedCurrentStepAudio","setHasCompletedCurrentStepAudio","hasCurrentAudioPlaybackStarted","setHasCurrentAudioPlaybackStarted","isSubtitleEnabled","setIsSubtitleEnabled","isPlayerCustomActionActive","setIsPlayerCustomActionActive","activeInteractionElement","setActiveInteractionElement","isInteractionOverlayOpen","setIsInteractionOverlayOpen","interactionOverlaySubtitleOffset","setInteractionOverlaySubtitleOffset","isBrowserFullscreen","setIsBrowserFullscreen","isMobileDevice","getIsMobileDevice","mobileViewMode","setMobileViewMode","DEFAULT_MOBILE_VIEW_MODE","hasManualMobileViewMode","setHasManualMobileViewMode","isViewportFullscreenPreferred","setIsViewportFullscreenPreferred","getIsFullscreenPreferredViewport","isFullscreenHintOpen","setIsFullscreenHintOpen","playbackTimeStore","createPlaybackTimeStore","effectiveMobileViewMode","isImmersiveMobileFullscreen","isNativeMobileFullscreen","shouldRotateFullscreenViewport","resolveMobileViewModeState","previousEffectiveMobileViewModeRef","playerVisible","shouldShowFullscreenHeader","shouldApplyFullscreenViewportPadding","shouldShowMobileFullscreenMask","fullscreenHintText","DEFAULT_SLIDE_PLAYER_TEXTS","streamActivityKey","updateAudioLoadingVisibility","useCallback","nextVisible","reason","detail","previousVisible","handleMobileViewModeSelect","nextViewMode","handleMobileViewModeReset","handleFullscreenHeaderBack","handleFullscreenHintClose","setPlayerCustomActionActive","active","togglePlayerCustomActionActive","previous","mountedStepStates","currentMountedStateIndex","nextMountedStepStates","mountedStateIndexByStep","stepElementList","stepIndex","existingMountedStateIndex","mountedStepState","currentStepKey","currentAudioIndex","audioItem","currentAudioItem","currentSubtitleCues","currentAudioSequenceStartKey","playerCustomActionContext","resolvePlayerCustomActionElement","playerCustomActionCount","getPlayerCustomActionCount","interactionOverlayStyle","hasAvailableStepAudio","currentInteractionResetKey","currentPlaybackResetKey","currentPlaybackStartedResetKey","hasCurrentStepAudioUrl","shouldPausePlaybackForCustomAction","shouldUseSilentStepAutoAdvanceToggle","shouldUseAutoAdvanceToggle","clearPlayerHideTimer","clearInteractionAutoCloseTimer","clearInteractionOverlayOpenTimer","clearAutoAdvanceTimer","clearStreamInactivityTimer","resetAudioSequence","startCurrentAudioSequence","nextAudioKey","continueAfterInteraction","scheduleInteractionOverlayOpen","interactionElement","openOverlay","showPlayerControls","enableAutoHide","hasResolvedCurrentInteraction","shouldBlockPlaybackForInteraction","useEffect","hasStreamingStarted","hasStreamActivityChanged","SLIDE_ERROR_CODES","syncViewportFullscreenPreference","subscribeMobileDeviceChange","shouldShowFullscreenHint","previousState","shouldAdvanceIntoAppendedMarker","shouldAutoAdvanceIntoAppendedMarker","handleSandboxInteraction","event","isSandboxInteractionMessage","useWakePlayerFromIframe","hasPlaybackContextChanged","shouldInitializeAudioSequence","getPlaybackSequenceTransition","shouldOpenInteractionOverlayAfterAudio","shouldPresentOverlay","shouldPresentInteractionOverlay","interactionDefaults","shouldPreferResolvedInteractionInput","getInteractionDefaultValues","interactionDefaultSelectedValues","getInteractionDefaultSelectedValues","hasResolvedInteractionInput","isInteractionReadonly","shouldAutoContinueInteraction","shouldShowInteractionOverlay","handleInteractionSend","resolvedUserInput","prevElement","syncFullscreenState","interactionOverlayElement","updateSubtitleOffset","overlayHeight","resizeObserver","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","handleSurfaceClick","currentRenderElementKeys","prevKeys","shouldAutoScrollToAppend","key","animationFrameId","targetElement","stageLayerRect","targetRect","nextScrollTop","ChevronLeft","mountedStepStateIndex","LoadingOverlayCard","SlideFullscreenHint","SubtitleOverlay","Player","previousEnabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAMA,KAAuC,KACvCC,KAA4C,KAC5CC,KAAiD,KACjDC,KAAsC,IAwCtCC,KAAyBC;AAAA,EAC7B,CAAC;AAAA,IACC,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC,KAAW;AAAA,EAAA,MAEXC,gBAAAA,EAAAA,KAAC,OAAA,EAAI,WAAU,kCACb,UAAA;AAAA,IAAAC,gBAAAA,EAAAA,IAAC,OAAA,EA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,kBACf,cAAc6D;AAAA,kBACd,OAAOtG;AAAA,kBACP,qBAAqB0I;AAAA,kBACrB,eAAe/I;AAAA,kBACf,sBAAsB0J;AAAA,gBAAA;AAAA,cAAA,IAEtB;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACN;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -32,6 +32,18 @@ declare const meta: {
|
|
|
32
32
|
control: "object";
|
|
33
33
|
description: string;
|
|
34
34
|
};
|
|
35
|
+
isStreaming: {
|
|
36
|
+
control: "boolean";
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
streamInactivityTimeoutMs: {
|
|
40
|
+
control: {
|
|
41
|
+
type: "number";
|
|
42
|
+
min: number;
|
|
43
|
+
step: number;
|
|
44
|
+
};
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
35
47
|
onMobileViewModeChange: {
|
|
36
48
|
control: false;
|
|
37
49
|
description: string;
|
|
@@ -102,6 +114,7 @@ export declare const CustomPlayerActionButton: Story;
|
|
|
102
114
|
export declare const FullViewportSlides: Story;
|
|
103
115
|
export declare const FullViewportSingleSlide: Story;
|
|
104
116
|
export declare const FullViewportSingleSlideWithEmptyPpt: Story;
|
|
117
|
+
export declare const StuckSpeakableFixtureSSE: Story;
|
|
105
118
|
export declare const HistorySlides: Story;
|
|
106
119
|
export declare const StreamingSingleIframeSlide: Story;
|
|
107
120
|
export declare const StreamingSpeakableLoadingOnlySlide: Story;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=3e3,t={settingsTitle:"Settings",subtitleLabel:"Subtitles",subtitleToggleAriaLabel:"Toggle subtitles",screenLabel:"Screen",nonFullscreenLabel:"Non-fullscreen",fullscreenLabel:"Fullscreen",fullscreenHintText:"Rotate your screen for the best experience."};exports.DEFAULT_FULLSCREEN_HINT_DURATION_MS=e;exports.DEFAULT_SLIDE_PLAYER_TEXTS=t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=3e3,t=15e3,T={STREAM_INACTIVITY_TIMEOUT:"stream_inactivity_timeout"},_={settingsTitle:"Settings",subtitleLabel:"Subtitles",subtitleToggleAriaLabel:"Toggle subtitles",screenLabel:"Screen",nonFullscreenLabel:"Non-fullscreen",fullscreenLabel:"Fullscreen",fullscreenHintText:"Rotate your screen for the best experience."};exports.DEFAULT_FULLSCREEN_HINT_DURATION_MS=e;exports.DEFAULT_SLIDE_PLAYER_TEXTS=_;exports.DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS=t;exports.SLIDE_ERROR_CODES=T;
|
|
2
2
|
//# sourceMappingURL=constants.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs.js","sources":["../../../src/components/Slide/constants.ts"],"sourcesContent":["export const DEFAULT_FULLSCREEN_HINT_DURATION_MS = 3000;\n\nexport const DEFAULT_SLIDE_PLAYER_TEXTS = {\n settingsTitle: \"Settings\",\n subtitleLabel: \"Subtitles\",\n subtitleToggleAriaLabel: \"Toggle subtitles\",\n screenLabel: \"Screen\",\n nonFullscreenLabel: \"Non-fullscreen\",\n fullscreenLabel: \"Fullscreen\",\n fullscreenHintText: \"Rotate your screen for the best experience.\",\n} as const;\n"],"names":["DEFAULT_FULLSCREEN_HINT_DURATION_MS","DEFAULT_SLIDE_PLAYER_TEXTS"],"mappings":"gFAAO,MAAMA,EAAsC,
|
|
1
|
+
{"version":3,"file":"constants.cjs.js","sources":["../../../src/components/Slide/constants.ts"],"sourcesContent":["export const DEFAULT_FULLSCREEN_HINT_DURATION_MS = 3000;\nexport const DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS = 15000;\nexport const SLIDE_ERROR_CODES = {\n STREAM_INACTIVITY_TIMEOUT: \"stream_inactivity_timeout\",\n} as const;\n\nexport const DEFAULT_SLIDE_PLAYER_TEXTS = {\n settingsTitle: \"Settings\",\n subtitleLabel: \"Subtitles\",\n subtitleToggleAriaLabel: \"Toggle subtitles\",\n screenLabel: \"Screen\",\n nonFullscreenLabel: \"Non-fullscreen\",\n fullscreenLabel: \"Fullscreen\",\n fullscreenHintText: \"Rotate your screen for the best experience.\",\n} as const;\n"],"names":["DEFAULT_FULLSCREEN_HINT_DURATION_MS","DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS","SLIDE_ERROR_CODES","DEFAULT_SLIDE_PLAYER_TEXTS"],"mappings":"gFAAO,MAAMA,EAAsC,IACtCC,EAAuC,KACvCC,EAAoB,CAC/B,0BAA2B,2BAC7B,EAEaC,EAA6B,CACxC,cAAe,WACf,cAAe,YACf,wBAAyB,mBACzB,YAAa,SACb,mBAAoB,iBACpB,gBAAiB,aACjB,mBAAoB,6CACtB"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare const DEFAULT_FULLSCREEN_HINT_DURATION_MS = 3000;
|
|
2
|
+
export declare const DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS = 15000;
|
|
3
|
+
export declare const SLIDE_ERROR_CODES: {
|
|
4
|
+
readonly STREAM_INACTIVITY_TIMEOUT: "stream_inactivity_timeout";
|
|
5
|
+
};
|
|
2
6
|
export declare const DEFAULT_SLIDE_PLAYER_TEXTS: {
|
|
3
7
|
readonly settingsTitle: "Settings";
|
|
4
8
|
readonly subtitleLabel: "Subtitles";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const e = 3e3, l = {
|
|
1
|
+
const e = 3e3, t = 15e3, l = {
|
|
2
|
+
STREAM_INACTIVITY_TIMEOUT: "stream_inactivity_timeout"
|
|
3
|
+
}, s = {
|
|
2
4
|
settingsTitle: "Settings",
|
|
3
5
|
subtitleLabel: "Subtitles",
|
|
4
6
|
subtitleToggleAriaLabel: "Toggle subtitles",
|
|
@@ -9,6 +11,8 @@ const e = 3e3, l = {
|
|
|
9
11
|
};
|
|
10
12
|
export {
|
|
11
13
|
e as DEFAULT_FULLSCREEN_HINT_DURATION_MS,
|
|
12
|
-
|
|
14
|
+
s as DEFAULT_SLIDE_PLAYER_TEXTS,
|
|
15
|
+
t as DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS,
|
|
16
|
+
l as SLIDE_ERROR_CODES
|
|
13
17
|
};
|
|
14
18
|
//# sourceMappingURL=constants.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.es.js","sources":["../../../src/components/Slide/constants.ts"],"sourcesContent":["export const DEFAULT_FULLSCREEN_HINT_DURATION_MS = 3000;\n\nexport const DEFAULT_SLIDE_PLAYER_TEXTS = {\n settingsTitle: \"Settings\",\n subtitleLabel: \"Subtitles\",\n subtitleToggleAriaLabel: \"Toggle subtitles\",\n screenLabel: \"Screen\",\n nonFullscreenLabel: \"Non-fullscreen\",\n fullscreenLabel: \"Fullscreen\",\n fullscreenHintText: \"Rotate your screen for the best experience.\",\n} as const;\n"],"names":["DEFAULT_FULLSCREEN_HINT_DURATION_MS","DEFAULT_SLIDE_PLAYER_TEXTS"],"mappings":"AAAO,MAAMA,IAAsC,
|
|
1
|
+
{"version":3,"file":"constants.es.js","sources":["../../../src/components/Slide/constants.ts"],"sourcesContent":["export const DEFAULT_FULLSCREEN_HINT_DURATION_MS = 3000;\nexport const DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS = 15000;\nexport const SLIDE_ERROR_CODES = {\n STREAM_INACTIVITY_TIMEOUT: \"stream_inactivity_timeout\",\n} as const;\n\nexport const DEFAULT_SLIDE_PLAYER_TEXTS = {\n settingsTitle: \"Settings\",\n subtitleLabel: \"Subtitles\",\n subtitleToggleAriaLabel: \"Toggle subtitles\",\n screenLabel: \"Screen\",\n nonFullscreenLabel: \"Non-fullscreen\",\n fullscreenLabel: \"Fullscreen\",\n fullscreenHintText: \"Rotate your screen for the best experience.\",\n} as const;\n"],"names":["DEFAULT_FULLSCREEN_HINT_DURATION_MS","DEFAULT_STREAM_INACTIVITY_TIMEOUT_MS","SLIDE_ERROR_CODES","DEFAULT_SLIDE_PLAYER_TEXTS"],"mappings":"AAAO,MAAMA,IAAsC,KACtCC,IAAuC,MACvCC,IAAoB;AAAA,EAC/B,2BAA2B;AAC7B,GAEaC,IAA6B;AAAA,EACxC,eAAe;AAAA,EACf,eAAe;AAAA,EACf,yBAAyB;AAAA,EACzB,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,oBAAoB;AACtB;"}
|
|
@@ -5,9 +5,10 @@ import { getInteractionDefaultSelectedValues, getInteractionDefaultValues } from
|
|
|
5
5
|
import { default as useSlide } from './useSlide';
|
|
6
6
|
export default Slide;
|
|
7
7
|
export { Slide, applyDiffElement, applyUnifiedDiff, parseUnifiedDiff, splitDiffContent, Player, useSlide, getInteractionDefaultValues, getInteractionDefaultSelectedValues, };
|
|
8
|
-
export type { SlideInteractionTexts, SlideFullscreenHeader, SlideProps, } from './Slide';
|
|
8
|
+
export type { SlideInteractionTexts, SlideFullscreenHeader, SlideErrorCode, SlideErrorContext, SlideProps, } from './Slide';
|
|
9
9
|
export type { InteractionDefaultResolver, InteractionDefaultResolverParams, InteractionDefaultValueOptions, InteractionDefaultValues, InteractionParseResult, } from '../../lib/interaction-defaults';
|
|
10
10
|
export type { Element, ElementAudioSegment, ElementSubtitleCue, SlidePlayerCustomActionContext, SlidePlayerCustomActions, } from './types';
|
|
11
11
|
export type { PlayerProps, SlidePlayerTexts } from './Player';
|
|
12
12
|
export type { UseSlideResult } from './useSlide';
|
|
13
13
|
export type { MobileViewMode } from './utils/mobileScreenMode';
|
|
14
|
+
export { SLIDE_ERROR_CODES } from './constants';
|