markdown-flow-ui 0.1.123 → 0.1.125
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.cjs8.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/components/Slide/MobilePlayerSettingsSheet.cjs.js +1 -1
- package/dist/components/Slide/MobilePlayerSettingsSheet.cjs.js.map +1 -1
- package/dist/components/Slide/MobilePlayerSettingsSheet.d.ts +2 -0
- package/dist/components/Slide/MobilePlayerSettingsSheet.es.js +7 -6
- package/dist/components/Slide/MobilePlayerSettingsSheet.es.js.map +1 -1
- package/dist/components/Slide/Player.cjs.js +1 -1
- package/dist/components/Slide/Player.cjs.js.map +1 -1
- package/dist/components/Slide/Player.d.ts +37 -1
- package/dist/components/Slide/Player.es.js +602 -487
- package/dist/components/Slide/Player.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 +13 -0
- package/dist/components/Slide/Slide.es.js +528 -501
- package/dist/components/Slide/Slide.es.js.map +1 -1
- 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 +13 -0
- package/dist/components/Slide/constants.es.js +13 -0
- package/dist/components/Slide/constants.es.js.map +1 -1
- package/dist/components/Slide/useWakePlayerFromIframe.cjs.js +1 -1
- package/dist/components/Slide/useWakePlayerFromIframe.cjs.js.map +1 -1
- package/dist/components/Slide/useWakePlayerFromIframe.d.ts +12 -1
- package/dist/components/Slide/useWakePlayerFromIframe.es.js +70 -39
- package/dist/components/Slide/useWakePlayerFromIframe.es.js.map +1 -1
- package/dist/components/Slide/utils/playbackPreference.cjs.js +1 -1
- package/dist/components/Slide/utils/playbackPreference.cjs.js.map +1 -1
- package/dist/components/Slide/utils/playbackPreference.d.ts +1 -6
- package/dist/components/Slide/utils/playbackPreference.es.js +4 -9
- package/dist/components/Slide/utils/playbackPreference.es.js.map +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcutContext.cjs.js +2 -0
- package/dist/components/Slide/utils/playerKeyboardShortcutContext.cjs.js.map +1 -0
- package/dist/components/Slide/utils/playerKeyboardShortcutContext.d.ts +5 -0
- package/dist/components/Slide/utils/playerKeyboardShortcutContext.es.js +6 -0
- package/dist/components/Slide/utils/playerKeyboardShortcutContext.es.js.map +1 -0
- package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.js +2 -0
- package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.js.map +1 -0
- package/dist/components/Slide/utils/playerKeyboardShortcuts.d.ts +19 -0
- package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js +58 -0
- package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js.map +1 -0
- package/dist/components/Slide/utils/playerKeyboardShortcuts.test.d.ts +1 -0
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/node_modules/classnames/index.cjs.js +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/cose-base/cose-base.cjs.js +1 -1
- package/dist/node_modules/cose-base/cose-base.cjs.js.map +1 -1
- package/dist/node_modules/cose-base/cose-base.es.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.cjs.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.cjs.js.map +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.es.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs.js.map +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.es.js +1 -1
- package/dist/node_modules/layout-base/layout-base.cjs.js +1 -1
- package/dist/node_modules/layout-base/layout-base.cjs.js.map +1 -1
- package/dist/node_modules/layout-base/layout-base.es.js +1 -1
- package/package.json +2 -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 {\n PlayerProps,\n SlidePlayerNavigationContext,\n SlidePlayerTexts,\n} from \"./Player\";\nimport type { SlidePlayerLoadingReason } from \"./Player\";\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;\nconst DEFAULT_BUFFERING_REASON = \"waitingForAudio\";\n\nexport type SlideBufferingReason = \"waitingForAudio\" | SlidePlayerLoadingReason;\n\nexport type SlideBufferingTextConfig =\n | string\n | Partial<Record<SlideBufferingReason, string>>;\n\nconst DEFAULT_SLIDE_BUFFERING_TEXTS: Record<SlideBufferingReason, string> = {\n waitingForAudio: \"Waiting for current slide audio...\",\n loadingAudio: \"Loading current slide audio...\",\n waitingForMoreAudio: \"Waiting for more current slide audio...\",\n};\n\nconst resolveBufferingTextByReason = (\n bufferingText: SlideBufferingTextConfig,\n reason: SlideBufferingReason\n) => {\n if (typeof bufferingText === \"string\") {\n return bufferingText;\n }\n\n return (\n bufferingText[reason] ??\n bufferingText[DEFAULT_BUFFERING_REASON] ??\n DEFAULT_SLIDE_BUFFERING_TEXTS[reason]\n );\n};\n\nconst shouldShowBufferingOverlay = (\n reason: SlideBufferingReason | null,\n loading: boolean\n) => {\n if (!loading) {\n return false;\n }\n\n // Keep the silent preload/loading phase invisible until audio is actually playable.\n return reason !== \"loadingAudio\";\n};\n\ntype RenderSlideElementOptions = {\n replaceRootScreenHeightWithFull?: boolean;\n};\n\ninterface InteractionOverlayCardProps {\n content: string;\n title: string;\n defaultButtonText?: string;\n defaultInputText?: string;\n defaultSelectedValues?: string[];\n confirmButtonText?: string;\n copyButtonText?: string;\n copiedButtonText?: string;\n onSend?: (content: OnSendContentParams) => void;\n readonly?: boolean;\n}\n\nexport interface SlideInteractionTexts extends Pick<\n ContentRenderProps,\n \"confirmButtonText\" | \"copyButtonText\" | \"copiedButtonText\"\n> {\n title?: string;\n}\n\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 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?: SlideBufferingTextConfig;\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 disableLoadingOverlay?: 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 = DEFAULT_SLIDE_BUFFERING_TEXTS,\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 disableLoadingOverlay = false,\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 [isPlaybackRequested, setIsPlaybackRequested] = useState(true);\n const [isAutoAdvanceEnabled, setIsAutoAdvanceEnabled] = useState(true);\n const [currentAudioKey, setCurrentAudioKey] = useState<string | null>(null);\n const [isAudioLoadingVisible, setIsAudioLoadingVisible] = useState(false);\n const [audioLoadingReason, setAudioLoadingReason] =\n useState<SlideBufferingReason>(DEFAULT_BUFFERING_REASON);\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 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 isDesktopBrowserFullscreen = isBrowserFullscreen && !isMobileDevice;\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 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 setAudioLoadingReason(DEFAULT_BUFFERING_REASON);\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 const handlePlaybackPreferenceChange = useCallback((playing: boolean) => {\n setIsPlaybackRequested(playing);\n setIsAutoAdvanceEnabled(playing);\n }, []);\n\n const syncPlaybackPreferenceBeforeNavigation = useCallback(\n (context?: SlidePlayerNavigationContext) => {\n const shouldContinuePlayback =\n context?.shouldContinuePlayback ?? isPlaybackRequested;\n\n setIsPlaybackRequested(shouldContinuePlayback);\n setIsAutoAdvanceEnabled(shouldContinuePlayback);\n },\n [isPlaybackRequested]\n );\n\n useEffect(() => {\n // Keep silent-step autoplay aligned with the same play/pause preference as audio.\n setIsAutoAdvanceEnabled(isPlaybackRequested);\n\n if (playerCustomActionPauseOnActive) {\n setIsPlayerCustomActionActive(false);\n }\n }, [currentIndex, isPlaybackRequested, 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 previousEffectiveMobileViewModeRef.current = effectiveMobileViewMode;\n }, [effectiveMobileViewMode]);\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 (disableLoadingOverlay) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\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 disableLoadingOverlay,\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 disableLoadingOverlay ||\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 setAudioLoadingReason(\"waitingForAudio\");\n setIsAudioLoadingVisible(true);\n }, [\n hasAvailableStepAudio,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n disableLoadingOverlay,\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 disableLoadingOverlay={disableLoadingOverlay}\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 disableLoadingOverlay={disableLoadingOverlay}\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 (context?: SlidePlayerNavigationContext) => {\n syncPlaybackPreferenceBeforeNavigation(context);\n shouldScrollToBottomRef.current = true;\n pendingInteractionOverlayStepIndexRef.current = null;\n setHasPlayerInteracted(true);\n setIsAudioLoadingVisible(false);\n showPlayerControls(true);\n resetAudioSequence();\n goPrev();\n },\n [\n goPrev,\n resetAudioSequence,\n showPlayerControls,\n syncPlaybackPreferenceBeforeNavigation,\n ]\n );\n\n const handleNext = useCallback(\n (context?: SlidePlayerNavigationContext) => {\n syncPlaybackPreferenceBeforeNavigation(context);\n shouldScrollToBottomRef.current = true;\n pendingInteractionOverlayStepIndexRef.current = null;\n setHasPlayerInteracted(true);\n setIsAudioLoadingVisible(false);\n showPlayerControls(true);\n resetAudioSequence();\n goNext();\n },\n [\n goNext,\n resetAudioSequence,\n showPlayerControls,\n syncPlaybackPreferenceBeforeNavigation,\n ]\n );\n\n const handlePlayerLoadingChange = useCallback(\n ({\n loading,\n reason,\n }: {\n loading: boolean;\n reason: SlidePlayerLoadingReason | null;\n }) => {\n if (disableLoadingOverlay) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (!currentStepHasSpeakableElement || hasCompletedCurrentStepAudio) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (loading && reason) {\n setAudioLoadingReason(reason);\n }\n setIsAudioLoadingVisible(shouldShowBufferingOverlay(reason, loading));\n },\n [\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n disableLoadingOverlay,\n ]\n );\n\n useEffect(() => {\n if (!disableLoadingOverlay) {\n return;\n }\n\n setIsAudioLoadingVisible(false);\n }, [disableLoadingOverlay]);\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 return;\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 isDesktopBrowserFullscreen && \"slide--browser-fullscreen\",\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\n className=\"slide-landscape-header__icon h-6 w-6\"\n strokeWidth={2.25}\n />\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={resolveBufferingTextByReason(\n bufferingText,\n audioLoadingReason\n )}\n className=\"absolute left-1/2 top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2\"\n />\n ) : null}\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 z-[2] -translate-x-1/2\",\n isDesktopBrowserFullscreen ? \"bottom-3\" : \"-bottom-3\",\n playerClassName,\n !playerVisible && \"pointer-events-none opacity-0\"\n )}\n currentAudioIndex={currentAudioIndex}\n defaultPlaying={isPlaybackRequested}\n isPlaybackPaused={shouldPausePlaybackForCustomAction}\n isAutoAdvanceEnabled={isAutoAdvanceEnabled}\n hasInteraction={Boolean(activeInteractionElement)}\n isInteractionOpen={isInteractionOverlayOpen}\n isSubtitleEnabled={isSubtitleEnabled}\n onAutoAdvanceToggle={setIsAutoAdvanceEnabled}\n onLoadingChange={handlePlayerLoadingChange}\n onPlaybackPreferenceChange={handlePlaybackPreferenceChange}\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","DEFAULT_BUFFERING_REASON","DEFAULT_SLIDE_BUFFERING_TEXTS","resolveBufferingTextByReason","bufferingText","reason","shouldShowBufferingOverlay","loading","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","interactionTitle","interactionTexts","playerTexts","playerAutoHideDelay","markerAutoAdvanceDelay","interactionDefaultValueOptions","onPlayerVisibilityChange","onMobileViewModeChange","onStepChange","enableIframeScaling","disableLoadingOverlay","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","isPlaybackRequested","setIsPlaybackRequested","isAutoAdvanceEnabled","setIsAutoAdvanceEnabled","currentAudioKey","setCurrentAudioKey","isAudioLoadingVisible","setIsAudioLoadingVisible","audioLoadingReason","setAudioLoadingReason","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","playbackTimeStore","createPlaybackTimeStore","effectiveMobileViewMode","isImmersiveMobileFullscreen","isNativeMobileFullscreen","shouldRotateFullscreenViewport","resolveMobileViewModeState","previousEffectiveMobileViewModeRef","playerVisible","shouldShowFullscreenHeader","shouldApplyFullscreenViewportPadding","shouldShowMobileFullscreenMask","isDesktopBrowserFullscreen","handleMobileViewModeSelect","useCallback","nextViewMode","handleMobileViewModeReset","handleFullscreenHeaderBack","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","handlePlaybackPreferenceChange","playing","syncPlaybackPreferenceBeforeNavigation","context","shouldContinuePlayback","useEffect","syncViewportFullscreenPreference","subscribeMobileDeviceChange","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","handlePlayerEnded","endedAudioKey","activeSequencePosition","audioSequenceKey","nextSequencePosition","nextStepIndex","nextStepElement","handleInteractionToggle","prevOpen","stopOverlayPropagation","handleSurfacePointerDown","handleSurfaceClick","currentRenderElementKeys","prevKeys","shouldAutoScrollToAppend","key","animationFrameId","targetElement","stageLayerRect","targetRect","nextScrollTop","ChevronLeft","mountedStepStateIndex","LoadingOverlayCard","SubtitleOverlay","Player","previousEnabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAMA,KAAuC,KACvCC,KAA4C,KAC5CC,KAAiD,KACjDC,KAAsC,IACtCC,KAA2B,mBAQ3BC,KAAsE;AAAA,EAC1E,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,qBAAqB;AACvB,GAEMC,KAA+B,CACnCC,GACAC,MAEI,OAAOD,KAAkB,WACpBA,IAIPA,EAAcC,CAAM,KACpBD,EAAcH,EAAwB,KACtCC,GAA8BG,CAAM,GA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d,cAAc7H;AAAA,kBACd,gBAAgBc;AAAA,kBAChB,yBAAyB5E,GAAY;AAAA,kBACrC,wBAAwBuF;AAAA,kBACxB,qBAAqBkH;AAAA,kBACrB,QAAQT;AAAA,kBACR,QAAQD;AAAA,kBACR,cAAc,CAAC1K;AAAA,kBACf,cAAc6D;AAAA,kBACd,OAAOhG;AAAA,kBACP,qBAAqB4H;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 useId,\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 {\n PlayerProps,\n SlidePlayerNavigationContext,\n SlidePlayerTexts,\n} from \"./Player\";\nimport type { SlidePlayerLoadingReason } from \"./Player\";\nimport type { Element } from \"./types\";\nimport useSlide from \"./useSlide\";\nimport useWakePlayerFromIframe from \"./useWakePlayerFromIframe\";\nimport { PlayerKeyboardShortcutContext } from \"./utils/playerKeyboardShortcutContext\";\nimport { activatePlayerKeyboardShortcutOwner } from \"./utils/playerKeyboardShortcuts\";\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;\nconst DEFAULT_BUFFERING_REASON = \"waitingForAudio\";\n\nexport type SlideBufferingReason = \"waitingForAudio\" | SlidePlayerLoadingReason;\n\nexport type SlideBufferingTextConfig =\n | string\n | Partial<Record<SlideBufferingReason, string>>;\n\nconst DEFAULT_SLIDE_BUFFERING_TEXTS: Record<SlideBufferingReason, string> = {\n waitingForAudio: \"Waiting for current slide audio...\",\n loadingAudio: \"Loading current slide audio...\",\n waitingForMoreAudio: \"Waiting for more current slide audio...\",\n};\n\nconst resolveBufferingTextByReason = (\n bufferingText: SlideBufferingTextConfig,\n reason: SlideBufferingReason\n) => {\n if (typeof bufferingText === \"string\") {\n return bufferingText;\n }\n\n return (\n bufferingText[reason] ??\n bufferingText[DEFAULT_BUFFERING_REASON] ??\n DEFAULT_SLIDE_BUFFERING_TEXTS[reason]\n );\n};\n\nconst shouldShowBufferingOverlay = (\n reason: SlideBufferingReason | null,\n loading: boolean\n) => {\n if (!loading) {\n return false;\n }\n\n // Keep the silent preload/loading phase invisible until audio is actually playable.\n return reason !== \"loadingAudio\";\n};\n\ntype RenderSlideElementOptions = {\n replaceRootScreenHeightWithFull?: boolean;\n};\n\ninterface InteractionOverlayCardProps {\n content: string;\n title: string;\n defaultButtonText?: string;\n defaultInputText?: string;\n defaultSelectedValues?: string[];\n confirmButtonText?: string;\n copyButtonText?: string;\n copiedButtonText?: string;\n onSend?: (content: OnSendContentParams) => void;\n readonly?: boolean;\n}\n\nexport interface SlideInteractionTexts extends Pick<\n ContentRenderProps,\n \"confirmButtonText\" | \"copyButtonText\" | \"copiedButtonText\"\n> {\n title?: string;\n}\n\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 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?: SlideBufferingTextConfig;\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 /**\n * Enables keyboard shortcuts for existing player actions.\n *\n * Defaults to `true`. The active slide responds after users click, touch, or\n * focus the slide/player surface; ignored targets include form controls and\n * interaction overlays.\n *\n * @example\n * ```tsx\n * <Slide elementList={slides} enableKeyboardShortcuts={false} />\n * ```\n */\n enableKeyboardShortcuts?: boolean;\n enableIframeScaling?: boolean;\n disableLoadingOverlay?: 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 = DEFAULT_SLIDE_BUFFERING_TEXTS,\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 enableKeyboardShortcuts = true,\n enableIframeScaling = true,\n disableLoadingOverlay = false,\n className,\n onPointerDown,\n onFocusCapture,\n ...props\n}) => {\n const keyboardShortcutOwnerId = useId();\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 keyboardShortcutContextValue = useMemo(\n () => ({\n enabled: enableKeyboardShortcuts,\n ownerId: keyboardShortcutOwnerId,\n }),\n [enableKeyboardShortcuts, keyboardShortcutOwnerId]\n );\n const activateKeyboardShortcutOwner = useCallback(() => {\n if (!enableKeyboardShortcuts || !shouldRenderPlayer) {\n return;\n }\n\n activatePlayerKeyboardShortcutOwner(keyboardShortcutOwnerId);\n }, [enableKeyboardShortcuts, keyboardShortcutOwnerId, shouldRenderPlayer]);\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 [isPlaybackRequested, setIsPlaybackRequested] = useState(true);\n const [isAutoAdvanceEnabled, setIsAutoAdvanceEnabled] = useState(true);\n const [currentAudioKey, setCurrentAudioKey] = useState<string | null>(null);\n const [isAudioLoadingVisible, setIsAudioLoadingVisible] = useState(false);\n const [audioLoadingReason, setAudioLoadingReason] =\n useState<SlideBufferingReason>(DEFAULT_BUFFERING_REASON);\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 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 isDesktopBrowserFullscreen = isBrowserFullscreen && !isMobileDevice;\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 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 setAudioLoadingReason(DEFAULT_BUFFERING_REASON);\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 const handlePlaybackPreferenceChange = useCallback((playing: boolean) => {\n setIsPlaybackRequested(playing);\n }, []);\n\n const syncPlaybackPreferenceBeforeNavigation = useCallback(\n (context?: SlidePlayerNavigationContext) => {\n const shouldContinuePlayback =\n context?.shouldContinuePlayback ?? isPlaybackRequested;\n\n setIsPlaybackRequested(shouldContinuePlayback);\n },\n [isPlaybackRequested]\n );\n\n useEffect(() => {\n // Keep silent-step autoplay aligned with the same play/pause preference as audio.\n setIsAutoAdvanceEnabled(isPlaybackRequested);\n\n if (playerCustomActionPauseOnActive) {\n setIsPlayerCustomActionActive(false);\n }\n }, [currentIndex, isPlaybackRequested, 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 previousEffectiveMobileViewModeRef.current = effectiveMobileViewMode;\n }, [effectiveMobileViewMode]);\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 activateKeyboardShortcutOwner();\n setHasPlayerInteracted(true);\n showPlayerControls(true);\n };\n\n window.addEventListener(\"message\", handleSandboxInteraction);\n\n return () => {\n window.removeEventListener(\"message\", handleSandboxInteraction);\n };\n }, [activateKeyboardShortcutOwner, shouldRenderPlayer, showPlayerControls]);\n\n useWakePlayerFromIframe({\n sectionRef,\n enabled: shouldRenderPlayer,\n keyboardShortcutsEnabled: enableKeyboardShortcuts,\n onWake: () => {\n activateKeyboardShortcutOwner();\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 (disableLoadingOverlay) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\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 disableLoadingOverlay,\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 disableLoadingOverlay ||\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 setAudioLoadingReason(\"waitingForAudio\");\n setIsAudioLoadingVisible(true);\n }, [\n hasAvailableStepAudio,\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n disableLoadingOverlay,\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 disableLoadingOverlay={disableLoadingOverlay}\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 disableLoadingOverlay={disableLoadingOverlay}\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 (context?: SlidePlayerNavigationContext) => {\n syncPlaybackPreferenceBeforeNavigation(context);\n shouldScrollToBottomRef.current = true;\n pendingInteractionOverlayStepIndexRef.current = null;\n setHasPlayerInteracted(true);\n setIsAudioLoadingVisible(false);\n showPlayerControls(true);\n resetAudioSequence();\n goPrev();\n },\n [\n goPrev,\n resetAudioSequence,\n showPlayerControls,\n syncPlaybackPreferenceBeforeNavigation,\n ]\n );\n\n const handleNext = useCallback(\n (context?: SlidePlayerNavigationContext) => {\n syncPlaybackPreferenceBeforeNavigation(context);\n shouldScrollToBottomRef.current = true;\n pendingInteractionOverlayStepIndexRef.current = null;\n setHasPlayerInteracted(true);\n setIsAudioLoadingVisible(false);\n showPlayerControls(true);\n resetAudioSequence();\n goNext();\n },\n [\n goNext,\n resetAudioSequence,\n showPlayerControls,\n syncPlaybackPreferenceBeforeNavigation,\n ]\n );\n\n const handlePlayerLoadingChange = useCallback(\n ({\n loading,\n reason,\n }: {\n loading: boolean;\n reason: SlidePlayerLoadingReason | null;\n }) => {\n if (disableLoadingOverlay) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (!currentStepHasSpeakableElement || hasCompletedCurrentStepAudio) {\n setIsAudioLoadingVisible(false);\n return;\n }\n\n if (loading && reason) {\n setAudioLoadingReason(reason);\n }\n setIsAudioLoadingVisible(shouldShowBufferingOverlay(reason, loading));\n },\n [\n currentStepHasSpeakableElement,\n hasCompletedCurrentStepAudio,\n disableLoadingOverlay,\n ]\n );\n\n useEffect(() => {\n if (!disableLoadingOverlay) {\n return;\n }\n\n setIsAudioLoadingVisible(false);\n }, [disableLoadingOverlay]);\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 return;\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 activateKeyboardShortcutOwner();\n onPointerDown?.(event);\n },\n [activateKeyboardShortcutOwner, onPointerDown]\n );\n\n const handleSurfaceFocusCapture = useCallback(\n (event: React.FocusEvent<HTMLElement>) => {\n activateKeyboardShortcutOwner();\n onFocusCapture?.(event);\n },\n [activateKeyboardShortcutOwner, onFocusCapture]\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 isDesktopBrowserFullscreen && \"slide--browser-fullscreen\",\n isImmersiveMobileFullscreen && \"slide--mobile-landscape\",\n isNativeMobileFullscreen && \"slide--mobile-landscape-native\",\n className\n )}\n onClick={handleSurfaceClick}\n onFocusCapture={handleSurfaceFocusCapture}\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\n className=\"slide-landscape-header__icon h-6 w-6\"\n strokeWidth={2.25}\n />\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={resolveBufferingTextByReason(\n bufferingText,\n audioLoadingReason\n )}\n className=\"absolute left-1/2 top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2\"\n />\n ) : null}\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 data-player-keyboard-shortcuts-ignore=\"true\"\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 <PlayerKeyboardShortcutContext.Provider\n value={keyboardShortcutContextValue}\n >\n <Player\n audioList={audioList}\n className={cn(\n \"absolute left-1/2 z-[2] -translate-x-1/2\",\n isDesktopBrowserFullscreen ? \"bottom-3\" : \"-bottom-3\",\n playerClassName,\n !playerVisible && \"pointer-events-none opacity-0\"\n )}\n currentAudioIndex={currentAudioIndex}\n defaultPlaying={isPlaybackRequested}\n enableKeyboardShortcuts={enableKeyboardShortcuts}\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 onPlaybackPreferenceChange={handlePlaybackPreferenceChange}\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 </PlayerKeyboardShortcutContext.Provider>\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","DEFAULT_BUFFERING_REASON","DEFAULT_SLIDE_BUFFERING_TEXTS","resolveBufferingTextByReason","bufferingText","reason","shouldShowBufferingOverlay","loading","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","interactionTitle","interactionTexts","playerTexts","playerAutoHideDelay","markerAutoAdvanceDelay","interactionDefaultValueOptions","onPlayerVisibilityChange","onMobileViewModeChange","onStepChange","enableKeyboardShortcuts","enableIframeScaling","disableLoadingOverlay","className","onPointerDown","onFocusCapture","props","keyboardShortcutOwnerId","useId","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","keyboardShortcutContextValue","activateKeyboardShortcutOwner","useCallback","activatePlayerKeyboardShortcutOwner","currentAudioSequenceKeys","audioIndex","audioKey","isPlayerVisible","setIsPlayerVisible","useState","hasPlayerInteracted","setHasPlayerInteracted","isPlaybackRequested","setIsPlaybackRequested","isAutoAdvanceEnabled","setIsAutoAdvanceEnabled","currentAudioKey","setCurrentAudioKey","isAudioLoadingVisible","setIsAudioLoadingVisible","audioLoadingReason","setAudioLoadingReason","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","playbackTimeStore","createPlaybackTimeStore","effectiveMobileViewMode","isImmersiveMobileFullscreen","isNativeMobileFullscreen","shouldRotateFullscreenViewport","resolveMobileViewModeState","previousEffectiveMobileViewModeRef","playerVisible","shouldShowFullscreenHeader","shouldApplyFullscreenViewportPadding","shouldShowMobileFullscreenMask","isDesktopBrowserFullscreen","handleMobileViewModeSelect","nextViewMode","handleMobileViewModeReset","handleFullscreenHeaderBack","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","handlePlaybackPreferenceChange","playing","syncPlaybackPreferenceBeforeNavigation","context","shouldContinuePlayback","useEffect","syncViewportFullscreenPreference","subscribeMobileDeviceChange","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","handlePlayerEnded","endedAudioKey","activeSequencePosition","audioSequenceKey","nextSequencePosition","nextStepIndex","nextStepElement","handleInteractionToggle","prevOpen","stopOverlayPropagation","handleSurfacePointerDown","handleSurfaceFocusCapture","handleSurfaceClick","currentRenderElementKeys","prevKeys","shouldAutoScrollToAppend","key","animationFrameId","targetElement","stageLayerRect","targetRect","nextScrollTop","ChevronLeft","mountedStepStateIndex","LoadingOverlayCard","SubtitleOverlay","PlayerKeyboardShortcutContext","Player","previousEnabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAMA,KAAuC,KACvCC,KAA4C,KAC5CC,KAAiD,KACjDC,KAAsC,IACtCC,KAA2B,mBAQ3BC,KAA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AAA,IAEA;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACN;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={settingsTitle:"Settings",subtitleLabel:"Subtitles",subtitleToggleAriaLabel:"Toggle subtitles",screenLabel:"Screen",nonFullscreenLabel:"Non-fullscreen",fullscreenLabel:"Fullscreen",fullscreenHintText:"Rotate your screen for the best experience."};exports.DEFAULT_SLIDE_PLAYER_TEXTS=e;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={closeSettingsLabel:"Close settings",enterFullscreenLabel:"Enter fullscreen",exitFullscreenLabel:"Exit fullscreen",moreOptionsAriaLabel:"More options",nextLabel:"Forward",notesLabel:"Notes",pauseAutoplayLabel:"Pause autoplay",pauseLabel:"Pause",playAutoplayLabel:"Play autoplay",playLabel:"Play",previousLabel:"Rewind",screenModeLabel:"Screen mode",settingsTitle:"Settings",subtitleLabel:"Subtitles",subtitleToggleAriaLabel:"Toggle subtitles",volumeAriaLabel:"Volume",screenLabel:"Screen",nonFullscreenLabel:"Non-fullscreen",fullscreenLabel:"Fullscreen",fullscreenHintText:"Rotate your screen for the best experience."};exports.DEFAULT_SLIDE_PLAYER_TEXTS=e;
|
|
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_SLIDE_PLAYER_TEXTS"],"mappings":"gFAEO,MAAMA,EAA6B,CACxC,cAAe,WACf,cAAe,YACf,wBAAyB,mBACzB,YAAa,SACb,mBAAoB,iBACpB,gBAAiB,aACjB,mBAAoB,6CACtB"}
|
|
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 closeSettingsLabel: \"Close settings\",\n enterFullscreenLabel: \"Enter fullscreen\",\n exitFullscreenLabel: \"Exit fullscreen\",\n moreOptionsAriaLabel: \"More options\",\n nextLabel: \"Forward\",\n notesLabel: \"Notes\",\n pauseAutoplayLabel: \"Pause autoplay\",\n pauseLabel: \"Pause\",\n playAutoplayLabel: \"Play autoplay\",\n playLabel: \"Play\",\n previousLabel: \"Rewind\",\n screenModeLabel: \"Screen mode\",\n settingsTitle: \"Settings\",\n subtitleLabel: \"Subtitles\",\n subtitleToggleAriaLabel: \"Toggle subtitles\",\n volumeAriaLabel: \"Volume\",\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_SLIDE_PLAYER_TEXTS"],"mappings":"gFAEO,MAAMA,EAA6B,CACxC,mBAAoB,iBACpB,qBAAsB,mBACtB,oBAAqB,kBACrB,qBAAsB,eACtB,UAAW,UACX,WAAY,QACZ,mBAAoB,iBACpB,WAAY,QACZ,kBAAmB,gBACnB,UAAW,OACX,cAAe,SACf,gBAAiB,cACjB,cAAe,WACf,cAAe,YACf,wBAAyB,mBACzB,gBAAiB,SACjB,YAAa,SACb,mBAAoB,iBACpB,gBAAiB,aACjB,mBAAoB,6CACtB"}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
export declare const DEFAULT_FULLSCREEN_HINT_DURATION_MS = 3000;
|
|
2
2
|
export declare const DEFAULT_SLIDE_PLAYER_TEXTS: {
|
|
3
|
+
readonly closeSettingsLabel: "Close settings";
|
|
4
|
+
readonly enterFullscreenLabel: "Enter fullscreen";
|
|
5
|
+
readonly exitFullscreenLabel: "Exit fullscreen";
|
|
6
|
+
readonly moreOptionsAriaLabel: "More options";
|
|
7
|
+
readonly nextLabel: "Forward";
|
|
8
|
+
readonly notesLabel: "Notes";
|
|
9
|
+
readonly pauseAutoplayLabel: "Pause autoplay";
|
|
10
|
+
readonly pauseLabel: "Pause";
|
|
11
|
+
readonly playAutoplayLabel: "Play autoplay";
|
|
12
|
+
readonly playLabel: "Play";
|
|
13
|
+
readonly previousLabel: "Rewind";
|
|
14
|
+
readonly screenModeLabel: "Screen mode";
|
|
3
15
|
readonly settingsTitle: "Settings";
|
|
4
16
|
readonly subtitleLabel: "Subtitles";
|
|
5
17
|
readonly subtitleToggleAriaLabel: "Toggle subtitles";
|
|
18
|
+
readonly volumeAriaLabel: "Volume";
|
|
6
19
|
readonly screenLabel: "Screen";
|
|
7
20
|
readonly nonFullscreenLabel: "Non-fullscreen";
|
|
8
21
|
readonly fullscreenLabel: "Fullscreen";
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
const e = {
|
|
2
|
+
closeSettingsLabel: "Close settings",
|
|
3
|
+
enterFullscreenLabel: "Enter fullscreen",
|
|
4
|
+
exitFullscreenLabel: "Exit fullscreen",
|
|
5
|
+
moreOptionsAriaLabel: "More options",
|
|
6
|
+
nextLabel: "Forward",
|
|
7
|
+
notesLabel: "Notes",
|
|
8
|
+
pauseAutoplayLabel: "Pause autoplay",
|
|
9
|
+
pauseLabel: "Pause",
|
|
10
|
+
playAutoplayLabel: "Play autoplay",
|
|
11
|
+
playLabel: "Play",
|
|
12
|
+
previousLabel: "Rewind",
|
|
13
|
+
screenModeLabel: "Screen mode",
|
|
2
14
|
settingsTitle: "Settings",
|
|
3
15
|
subtitleLabel: "Subtitles",
|
|
4
16
|
subtitleToggleAriaLabel: "Toggle subtitles",
|
|
17
|
+
volumeAriaLabel: "Volume",
|
|
5
18
|
screenLabel: "Screen",
|
|
6
19
|
nonFullscreenLabel: "Non-fullscreen",
|
|
7
20
|
fullscreenLabel: "Fullscreen",
|
|
@@ -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_SLIDE_PLAYER_TEXTS"],"mappings":"AAEO,MAAMA,IAA6B;AAAA,EACxC,eAAe;AAAA,EACf,eAAe;AAAA,EACf,yBAAyB;AAAA,EACzB,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,oBAAoB;AACtB;"}
|
|
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 closeSettingsLabel: \"Close settings\",\n enterFullscreenLabel: \"Enter fullscreen\",\n exitFullscreenLabel: \"Exit fullscreen\",\n moreOptionsAriaLabel: \"More options\",\n nextLabel: \"Forward\",\n notesLabel: \"Notes\",\n pauseAutoplayLabel: \"Pause autoplay\",\n pauseLabel: \"Pause\",\n playAutoplayLabel: \"Play autoplay\",\n playLabel: \"Play\",\n previousLabel: \"Rewind\",\n screenModeLabel: \"Screen mode\",\n settingsTitle: \"Settings\",\n subtitleLabel: \"Subtitles\",\n subtitleToggleAriaLabel: \"Toggle subtitles\",\n volumeAriaLabel: \"Volume\",\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_SLIDE_PLAYER_TEXTS"],"mappings":"AAEO,MAAMA,IAA6B;AAAA,EACxC,oBAAoB;AAAA,EACpB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EACtB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,YAAY;AAAA,EACZ,mBAAmB;AAAA,EACnB,WAAW;AAAA,EACX,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,yBAAyB;AAAA,EACzB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,oBAAoB;AACtB;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),m=require("./utils/playerKeyboardShortcuts.cjs.js"),I=({sectionRef:l,enabled:s,keyboardShortcutsEnabled:a=!0,onWake:d})=>{const i=o.useRef(s),f=o.useRef(a),y=o.useRef(d);o.useEffect(()=>{i.current=s},[s]),o.useEffect(()=>{f.current=a},[a]),o.useEffect(()=>{y.current=d},[d]),o.useEffect(()=>{const c=l.current;if(!c)return;const r=new Map,h=()=>{i.current&&y.current()},p=e=>{if(r.has(e))return;const u=()=>{r.get(e)?.cleanup(),r.delete(e),p(e)};e.addEventListener("load",u);const n=e.contentDocument;if(!n){r.set(e,{cleanup:()=>{e.removeEventListener("load",u)}});return}const v=()=>{h()},w=t=>{if(!i.current||!f.current)return;const D=m.getPlayerKeyboardShortcutAction(t);if(m.shouldIgnorePlayerKeyboardShortcutEvent(t,D))return;h();const E=c.ownerDocument.defaultView;if(!E)return;const L=new E.KeyboardEvent("keydown",{altKey:t.altKey,bubbles:!0,cancelable:!0,code:t.code,composed:!0,ctrlKey:t.ctrlKey,key:t.key,location:t.location,metaKey:t.metaKey,repeat:t.repeat,shiftKey:t.shiftKey});c.dispatchEvent(L),L.defaultPrevented&&t.preventDefault()};n.addEventListener("click",v,!0),n.addEventListener("keydown",w),r.set(e,{cleanup:()=>{n.removeEventListener("click",v,!0),n.removeEventListener("keydown",w),e.removeEventListener("load",u)}})},K=()=>{const e=Array.from(c.querySelectorAll("iframe.content-render-iframe"));e.forEach(p),r.forEach((u,n)=>{e.includes(n)||(u.cleanup(),r.delete(n))})},b=new MutationObserver(()=>{K()});return K(),b.observe(c,{childList:!0,subtree:!0}),()=>{b.disconnect(),r.forEach(e=>e.cleanup()),r.clear()}},[l])};exports.default=I;
|
|
2
2
|
//# sourceMappingURL=useWakePlayerFromIframe.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWakePlayerFromIframe.cjs.js","sources":["../../../src/components/Slide/useWakePlayerFromIframe.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\ntype UseWakePlayerFromIframeParams = {\n sectionRef: React.RefObject<HTMLElement | null>;\n enabled: boolean;\n onWake: () => void;\n};\n\nconst useWakePlayerFromIframe = ({\n sectionRef,\n enabled,\n onWake,\n}: UseWakePlayerFromIframeParams) => {\n const enabledRef = useRef(enabled);\n const onWakeRef = useRef(onWake);\n\n useEffect(() => {\n enabledRef.current = enabled;\n }, [enabled]);\n\n useEffect(() => {\n onWakeRef.current = onWake;\n }, [onWake]);\n\n useEffect(() => {\n const sectionElement = sectionRef.current;\n\n if (!sectionElement) {\n return;\n }\n\n const cleanupMap = new Map<\n HTMLIFrameElement,\n {\n cleanup: () => void;\n }\n >();\n\n const restorePlayerControls = () => {\n if (!enabledRef.current) {\n return;\n }\n\n onWakeRef.current();\n };\n\n const bindIframeDocument = (iframeElement: HTMLIFrameElement) => {\n if (cleanupMap.has(iframeElement)) {\n return;\n }\n\n const handleLoad = () => {\n cleanupMap.get(iframeElement)?.cleanup();\n cleanupMap.delete(iframeElement);\n bindIframeDocument(iframeElement);\n };\n\n iframeElement.addEventListener(\"load\", handleLoad);\n\n const iframeDocument = iframeElement.contentDocument;\n\n if (!iframeDocument) {\n cleanupMap.set(iframeElement, {\n cleanup: () => {\n iframeElement.removeEventListener(\"load\", handleLoad);\n },\n });\n return;\n }\n\n const handleIframeDocumentInteraction = () => {\n restorePlayerControls();\n };\n\n iframeDocument.addEventListener(\n \"click\",\n handleIframeDocumentInteraction,\n true\n );\n\n cleanupMap.set(iframeElement, {\n cleanup: () => {\n iframeDocument.removeEventListener(\n \"click\",\n handleIframeDocumentInteraction,\n true\n );\n iframeElement.removeEventListener(\"load\", handleLoad);\n },\n });\n };\n\n const syncIframeBindings = () => {\n const iframeElements = Array.from(\n sectionElement.querySelectorAll<HTMLIFrameElement>(\n \"iframe.content-render-iframe\"\n )\n );\n\n iframeElements.forEach(bindIframeDocument);\n\n cleanupMap.forEach((value, iframeElement) => {\n if (iframeElements.includes(iframeElement)) {\n return;\n }\n\n value.cleanup();\n cleanupMap.delete(iframeElement);\n });\n };\n\n const mutationObserver = new MutationObserver(() => {\n syncIframeBindings();\n });\n\n syncIframeBindings();\n mutationObserver.observe(sectionElement, {\n childList: true,\n subtree: true,\n });\n\n return () => {\n mutationObserver.disconnect();\n cleanupMap.forEach((value) => value.cleanup());\n cleanupMap.clear();\n };\n }, [sectionRef]);\n};\n\nexport default useWakePlayerFromIframe;\n"],"names":["useWakePlayerFromIframe","sectionRef","enabled","onWake","enabledRef","useRef","onWakeRef","useEffect","sectionElement","cleanupMap","restorePlayerControls","bindIframeDocument","iframeElement","handleLoad","iframeDocument","handleIframeDocumentInteraction","syncIframeBindings","iframeElements","value","mutationObserver"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useWakePlayerFromIframe.cjs.js","sources":["../../../src/components/Slide/useWakePlayerFromIframe.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\nimport {\n getPlayerKeyboardShortcutAction,\n shouldIgnorePlayerKeyboardShortcutEvent,\n} from \"./utils/playerKeyboardShortcuts\";\n\ntype UseWakePlayerFromIframeParams = {\n sectionRef: React.RefObject<HTMLElement | null>;\n enabled: boolean;\n keyboardShortcutsEnabled?: boolean;\n onWake: () => void;\n};\n\n/**\n * Restores player controls when users interact inside slide iframes and forwards supported keyboard shortcuts to the host document.\n *\n * @param params - Hook options.\n * @param params.sectionRef - Section element used to scope iframe wake events and host shortcut dispatch.\n * @param params.enabled - Enables or disables iframe wake handling.\n * @param params.keyboardShortcutsEnabled - Enables or disables iframe keyboard shortcut forwarding. Defaults to true.\n * @param params.onWake - Callback invoked when iframe interaction should restore player controls.\n * @returns void\n */\nconst useWakePlayerFromIframe = ({\n sectionRef,\n enabled,\n keyboardShortcutsEnabled = true,\n onWake,\n}: UseWakePlayerFromIframeParams) => {\n const enabledRef = useRef(enabled);\n const keyboardShortcutsEnabledRef = useRef(keyboardShortcutsEnabled);\n const onWakeRef = useRef(onWake);\n\n useEffect(() => {\n enabledRef.current = enabled;\n }, [enabled]);\n\n useEffect(() => {\n keyboardShortcutsEnabledRef.current = keyboardShortcutsEnabled;\n }, [keyboardShortcutsEnabled]);\n\n useEffect(() => {\n onWakeRef.current = onWake;\n }, [onWake]);\n\n useEffect(() => {\n const sectionElement = sectionRef.current;\n\n if (!sectionElement) {\n return;\n }\n\n const cleanupMap = new Map<\n HTMLIFrameElement,\n {\n cleanup: () => void;\n }\n >();\n\n const restorePlayerControls = () => {\n if (!enabledRef.current) {\n return;\n }\n\n onWakeRef.current();\n };\n\n const bindIframeDocument = (iframeElement: HTMLIFrameElement) => {\n if (cleanupMap.has(iframeElement)) {\n return;\n }\n\n const handleLoad = () => {\n cleanupMap.get(iframeElement)?.cleanup();\n cleanupMap.delete(iframeElement);\n bindIframeDocument(iframeElement);\n };\n\n iframeElement.addEventListener(\"load\", handleLoad);\n\n const iframeDocument = iframeElement.contentDocument;\n\n if (!iframeDocument) {\n cleanupMap.set(iframeElement, {\n cleanup: () => {\n iframeElement.removeEventListener(\"load\", handleLoad);\n },\n });\n return;\n }\n\n const handleIframeDocumentInteraction = () => {\n restorePlayerControls();\n };\n\n const handleIframeDocumentKeyDown = (event: KeyboardEvent) => {\n if (!enabledRef.current || !keyboardShortcutsEnabledRef.current) {\n return;\n }\n\n const action = getPlayerKeyboardShortcutAction(event);\n\n if (shouldIgnorePlayerKeyboardShortcutEvent(event, action)) {\n return;\n }\n\n restorePlayerControls();\n\n const hostWindow = sectionElement.ownerDocument.defaultView;\n\n if (!hostWindow) {\n return;\n }\n\n const hostKeyboardEvent = new hostWindow.KeyboardEvent(\"keydown\", {\n altKey: event.altKey,\n bubbles: true,\n cancelable: true,\n code: event.code,\n composed: true,\n ctrlKey: event.ctrlKey,\n key: event.key,\n location: event.location,\n metaKey: event.metaKey,\n repeat: event.repeat,\n shiftKey: event.shiftKey,\n });\n\n sectionElement.dispatchEvent(hostKeyboardEvent);\n\n if (hostKeyboardEvent.defaultPrevented) {\n event.preventDefault();\n }\n };\n\n iframeDocument.addEventListener(\n \"click\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.addEventListener(\"keydown\", handleIframeDocumentKeyDown);\n\n cleanupMap.set(iframeElement, {\n cleanup: () => {\n iframeDocument.removeEventListener(\n \"click\",\n handleIframeDocumentInteraction,\n true\n );\n iframeDocument.removeEventListener(\n \"keydown\",\n handleIframeDocumentKeyDown\n );\n iframeElement.removeEventListener(\"load\", handleLoad);\n },\n });\n };\n\n const syncIframeBindings = () => {\n const iframeElements = Array.from(\n sectionElement.querySelectorAll<HTMLIFrameElement>(\n \"iframe.content-render-iframe\"\n )\n );\n\n iframeElements.forEach(bindIframeDocument);\n\n cleanupMap.forEach((value, iframeElement) => {\n if (iframeElements.includes(iframeElement)) {\n return;\n }\n\n value.cleanup();\n cleanupMap.delete(iframeElement);\n });\n };\n\n const mutationObserver = new MutationObserver(() => {\n syncIframeBindings();\n });\n\n syncIframeBindings();\n mutationObserver.observe(sectionElement, {\n childList: true,\n subtree: true,\n });\n\n return () => {\n mutationObserver.disconnect();\n cleanupMap.forEach((value) => value.cleanup());\n cleanupMap.clear();\n };\n }, [sectionRef]);\n};\n\nexport default useWakePlayerFromIframe;\n"],"names":["useWakePlayerFromIframe","sectionRef","enabled","keyboardShortcutsEnabled","onWake","enabledRef","useRef","keyboardShortcutsEnabledRef","onWakeRef","useEffect","sectionElement","cleanupMap","restorePlayerControls","bindIframeDocument","iframeElement","handleLoad","iframeDocument","handleIframeDocumentInteraction","handleIframeDocumentKeyDown","event","action","getPlayerKeyboardShortcutAction","shouldIgnorePlayerKeyboardShortcutEvent","hostWindow","hostKeyboardEvent","syncIframeBindings","iframeElements","value","mutationObserver"],"mappings":"yLAwBMA,EAA0B,CAAC,CAC/B,WAAAC,EACA,QAAAC,EACA,yBAAAC,EAA2B,GAC3B,OAAAC,CACF,IAAqC,CACnC,MAAMC,EAAaC,EAAAA,OAAOJ,CAAO,EAC3BK,EAA8BD,EAAAA,OAAOH,CAAwB,EAC7DK,EAAYF,EAAAA,OAAOF,CAAM,EAE/BK,EAAAA,UAAU,IAAM,CACdJ,EAAW,QAAUH,CACvB,EAAG,CAACA,CAAO,CAAC,EAEZO,EAAAA,UAAU,IAAM,CACdF,EAA4B,QAAUJ,CACxC,EAAG,CAACA,CAAwB,CAAC,EAE7BM,EAAAA,UAAU,IAAM,CACdD,EAAU,QAAUJ,CACtB,EAAG,CAACA,CAAM,CAAC,EAEXK,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAiBT,EAAW,QAElC,GAAI,CAACS,EACH,OAGF,MAAMC,MAAiB,IAOjBC,EAAwB,IAAM,CAC7BP,EAAW,SAIhBG,EAAU,QAAA,CACZ,EAEMK,EAAsBC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AAiB,MAAM,KAC3BhB,EAAe,iBACb,8BAAA,CACF,EAGFgB,EAAe,QAAQb,CAAkB,EAEzCF,EAAW,QAAQ,CAACgB,EAAOb,IAAkB,CACvCY,EAAe,SAASZ,CAAa,IAIzCa,EAAM,QAAA,EACNhB,EAAW,OAAOG,CAAa,EACjC,CAAC,CACH,EAEMc,EAAmB,IAAI,iBAAiB,IAAM,CAClDH,EAAA,CACF,CAAC,EAED,OAAAA,EAAA,EACAG,EAAiB,QAAQlB,EAAgB,CACvC,UAAW,GACX,QAAS,EAAA,CACV,EAEM,IAAM,CACXkB,EAAiB,WAAA,EACjBjB,EAAW,QAASgB,GAAUA,EAAM,SAAS,EAC7ChB,EAAW,MAAA,CACb,CACF,EAAG,CAACV,CAAU,CAAC,CACjB"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
type UseWakePlayerFromIframeParams = {
|
|
2
2
|
sectionRef: React.RefObject<HTMLElement | null>;
|
|
3
3
|
enabled: boolean;
|
|
4
|
+
keyboardShortcutsEnabled?: boolean;
|
|
4
5
|
onWake: () => void;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Restores player controls when users interact inside slide iframes and forwards supported keyboard shortcuts to the host document.
|
|
9
|
+
*
|
|
10
|
+
* @param params - Hook options.
|
|
11
|
+
* @param params.sectionRef - Section element used to scope iframe wake events and host shortcut dispatch.
|
|
12
|
+
* @param params.enabled - Enables or disables iframe wake handling.
|
|
13
|
+
* @param params.keyboardShortcutsEnabled - Enables or disables iframe keyboard shortcut forwarding. Defaults to true.
|
|
14
|
+
* @param params.onWake - Callback invoked when iframe interaction should restore player controls.
|
|
15
|
+
* @returns void
|
|
16
|
+
*/
|
|
17
|
+
declare const useWakePlayerFromIframe: ({ sectionRef, enabled, keyboardShortcutsEnabled, onWake, }: UseWakePlayerFromIframeParams) => void;
|
|
7
18
|
export default useWakePlayerFromIframe;
|