markdown-flow-ui 0.1.108 → 0.1.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/_virtual/index.cjs4.js +1 -1
  2. package/dist/_virtual/index.cjs5.js +1 -1
  3. package/dist/_virtual/index.cjs6.js +1 -1
  4. package/dist/_virtual/index.cjs7.js +1 -1
  5. package/dist/_virtual/index.es4.js +4 -4
  6. package/dist/_virtual/index.es5.js +4 -4
  7. package/dist/_virtual/index.es6.js +2 -5
  8. package/dist/_virtual/index.es6.js.map +1 -1
  9. package/dist/_virtual/index.es7.js +5 -2
  10. package/dist/_virtual/index.es7.js.map +1 -1
  11. package/dist/assets/markdown-flow-ui.css +1 -1
  12. package/dist/components/Slide/MobilePlayerSettingsSheet.cjs.js +1 -1
  13. package/dist/components/Slide/MobilePlayerSettingsSheet.cjs.js.map +1 -1
  14. package/dist/components/Slide/MobilePlayerSettingsSheet.d.ts +5 -1
  15. package/dist/components/Slide/MobilePlayerSettingsSheet.es.js +69 -27
  16. package/dist/components/Slide/MobilePlayerSettingsSheet.es.js.map +1 -1
  17. package/dist/components/Slide/Player.cjs.js +1 -1
  18. package/dist/components/Slide/Player.cjs.js.map +1 -1
  19. package/dist/components/Slide/Player.d.ts +8 -2
  20. package/dist/components/Slide/Player.es.js +357 -262
  21. package/dist/components/Slide/Player.es.js.map +1 -1
  22. package/dist/components/Slide/Slide.cjs.js +1 -1
  23. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  24. package/dist/components/Slide/Slide.d.ts +1 -1
  25. package/dist/components/Slide/Slide.es.js +601 -513
  26. package/dist/components/Slide/Slide.es.js.map +1 -1
  27. package/dist/components/Slide/SubtitleOverlay.cjs.js +2 -0
  28. package/dist/components/Slide/SubtitleOverlay.cjs.js.map +1 -0
  29. package/dist/components/Slide/SubtitleOverlay.d.ts +14 -0
  30. package/dist/components/Slide/SubtitleOverlay.es.js +48 -0
  31. package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -0
  32. package/dist/components/Slide/constants.cjs.js +1 -1
  33. package/dist/components/Slide/constants.cjs.js.map +1 -1
  34. package/dist/components/Slide/constants.d.ts +2 -0
  35. package/dist/components/Slide/constants.es.js +4 -2
  36. package/dist/components/Slide/constants.es.js.map +1 -1
  37. package/dist/components/Slide/index.cjs.js +1 -1
  38. package/dist/components/Slide/index.d.ts +1 -1
  39. package/dist/components/Slide/index.es.js +8 -9
  40. package/dist/components/Slide/index.es.js.map +1 -1
  41. package/dist/components/Slide/types.d.ts +8 -0
  42. package/dist/components/Slide/utils/listenModeElementList.d.ts +12 -1
  43. package/dist/components/Slide/utils/playbackTimeStore.cjs.js +2 -0
  44. package/dist/components/Slide/utils/playbackTimeStore.cjs.js.map +1 -0
  45. package/dist/components/Slide/utils/playbackTimeStore.d.ts +10 -0
  46. package/dist/components/Slide/utils/playbackTimeStore.es.js +31 -0
  47. package/dist/components/Slide/utils/playbackTimeStore.es.js.map +1 -0
  48. package/dist/components/Slide/utils/subtitleCue.cjs.js +3 -0
  49. package/dist/components/Slide/utils/subtitleCue.cjs.js.map +1 -0
  50. package/dist/components/Slide/utils/subtitleCue.d.ts +2 -0
  51. package/dist/components/Slide/utils/subtitleCue.es.js +10 -0
  52. package/dist/components/Slide/utils/subtitleCue.es.js.map +1 -0
  53. package/dist/components/Slide/utils/subtitleCue.test.d.ts +1 -0
  54. package/dist/components/index.d.ts +1 -1
  55. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  56. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  57. package/dist/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
  58. package/dist/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  59. package/dist/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions-off.cjs.js +7 -0
  60. package/dist/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions-off.cjs.js.map +1 -0
  61. package/dist/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions-off.es.js +20 -0
  62. package/dist/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions-off.es.js.map +1 -0
  63. package/dist/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions.cjs.js +7 -0
  64. package/dist/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions.cjs.js.map +1 -0
  65. package/dist/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions.es.js +16 -0
  66. package/dist/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/captions.es.js.map +1 -0
  67. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.cjs.js +1 -1
  68. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.es.js +1 -1
  69. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.cjs.js +1 -1
  70. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  71. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.cjs.js +1 -1
  72. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  73. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.cjs.js +1 -1
  74. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.es.js +1 -1
  75. package/dist/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.cjs.js +1 -1
  76. package/dist/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.es.js +1 -1
  77. package/dist/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
  78. package/dist/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
  79. package/dist/markdown-flow-ui-lib.css +1 -1
  80. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Player.es.js","sources":["../../../src/components/Slide/Player.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n EllipsisVertical,\n FilePenLine,\n Maximize,\n RotateCcw,\n RotateCw,\n ScanLine,\n Volume2,\n} from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\nimport MobilePlayerSettingsSheet from \"./MobilePlayerSettingsSheet\";\nimport { DEFAULT_SLIDE_PLAYER_TEXTS } from \"./constants\";\nimport type { SlideAudioItem } from \"./useSlide\";\nimport type {\n SlidePlayerCustomActionContext,\n SlidePlayerCustomActions,\n} from \"./types\";\nimport {\n DEFAULT_MOBILE_VIEW_MODE,\n type MobileViewMode,\n} from \"./utils/mobileScreenMode\";\nimport { toPlayerCustomActionList } from \"./utils/playerCustomActions\";\nimport \"./player.css\";\n\nconst audioPreloadElementCache = new Map<string, HTMLAudioElement>();\n\nexport interface SlidePlayerTexts {\n settingsTitle?: string;\n screenLabel?: string;\n nonFullscreenLabel?: string;\n fullscreenLabel?: string;\n fullscreenHintText?: string;\n}\n\nconst preloadAudioUrl = (url?: string) => {\n if (typeof window === \"undefined\" || !url) {\n return;\n }\n\n if (audioPreloadElementCache.has(url)) {\n return;\n }\n\n // Use a detached audio element so warm-up follows the same media loading\n // path as the visible player instead of relying on link preload hints.\n const audio = window.document.createElement(\"audio\");\n audio.preload = \"auto\";\n audio.setAttribute(\"playsinline\", \"true\");\n audio.src = url;\n audio.load();\n\n audioPreloadElementCache.set(url, audio);\n};\n\nexport type PlayerProps = Omit<React.ComponentProps<\"div\">, \"onEnded\"> & {\n audioList?: SlideAudioItem[];\n currentAudioIndex?: number;\n defaultPlaying?: boolean;\n isPlaybackPaused?: boolean;\n isAutoAdvanceEnabled?: boolean;\n useAutoAdvanceToggle?: boolean;\n onLoadingChange?: (loading: boolean) => void;\n onPrev?: () => void;\n onNext?: () => void;\n onFullscreen?: () => void;\n isFullscreen?: boolean;\n mobileViewMode?: MobileViewMode;\n settingsPortalContainer?: HTMLElement | null;\n onMobileViewModeChange?: (viewMode: MobileViewMode) => void;\n onEnded?: (audioIndex: number) => void;\n onAutoAdvanceToggle?: (enabled: boolean) => void;\n onInteractionToggle?: () => void;\n hasInteraction?: boolean;\n isInteractionOpen?: boolean;\n prevDisabled?: boolean;\n nextDisabled?: boolean;\n showControls?: boolean;\n customActions?: SlidePlayerCustomActions;\n customActionContext?: SlidePlayerCustomActionContext;\n texts?: SlidePlayerTexts;\n};\n\nconst PauseIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"34\"\n height=\"34\"\n viewBox=\"0 0 34 34\"\n fill=\"none\"\n >\n <path\n d=\"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z\"\n fill=\"#0A0A0A\"\n />\n <path d=\"M12 10H16V24H12V10ZM18 10H22V24H18V10Z\" fill=\"white\" />\n </svg>\n);\n\nconst PlayIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"34\"\n height=\"34\"\n viewBox=\"0 0 34 34\"\n fill=\"none\"\n >\n <path\n d=\"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z\"\n fill=\"#0A0A0A\"\n />\n <path d=\"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z\" fill=\"white\" />\n </svg>\n);\n\nconst Player: React.FC<PlayerProps> = ({\n audioList = [],\n className,\n currentAudioIndex = -1,\n defaultPlaying = true,\n isPlaybackPaused = false,\n isAutoAdvanceEnabled = true,\n useAutoAdvanceToggle = false,\n onLoadingChange,\n onPrev,\n onNext,\n onFullscreen,\n isFullscreen = false,\n mobileViewMode = DEFAULT_MOBILE_VIEW_MODE,\n settingsPortalContainer,\n onMobileViewModeChange,\n onEnded,\n onAutoAdvanceToggle,\n onInteractionToggle,\n hasInteraction = false,\n isInteractionOpen = false,\n prevDisabled = false,\n nextDisabled = false,\n showControls = true,\n customActions,\n customActionContext,\n texts,\n ...props\n}) => {\n const audioRef = useRef<HTMLAudioElement | null>(null);\n const previousInteractionOpenRef = useRef(isInteractionOpen);\n const audioSrcRef = useRef<string | null>(null);\n const currentAudioKeyRef = useRef<string | null>(null);\n const currentSegmentIndexRef = useRef(0);\n const waitingSegmentIndexRef = useRef<number | null>(null);\n const currentAudioRef = useRef<SlideAudioItem | undefined>(undefined);\n const currentAudioSegmentsRef = useRef<\n NonNullable<SlideAudioItem[\"audioSegments\"]>\n >([]);\n const wasPlayingBeforeExternalPauseRef = useRef(false);\n const isLoadingRef = useRef(false);\n const isPausedByUserRef = useRef(false);\n const activeSourceTypeRef = useRef<\"url\" | \"segment\" | null>(null);\n const isWaitingForSegmentRef = useRef(false);\n const pendingAutoPlayRef = useRef(false);\n const pendingSeekTimeRef = useRef<number | null>(null);\n const isSwitchingSegmentRef = useRef(false);\n const playbackAccessModeRef = useRef<\n \"unknown\" | \"auto\" | \"manual\" | \"blocked\"\n >(\"unknown\");\n const [isPlaying, setIsPlaying] = useState(defaultPlaying);\n const [isMobileMoreOpen, setIsMobileMoreOpen] = useState(false);\n const currentAudio =\n currentAudioIndex >= 0 ? audioList[currentAudioIndex] : undefined;\n const currentAudioUrl = currentAudio?.audioUrl;\n const currentAudioSegments = useMemo(\n () =>\n [...(currentAudio?.audioSegments ?? [])].sort(\n (prevSegment, nextSegment) =>\n prevSegment.segment_index - nextSegment.segment_index\n ),\n [currentAudio?.audioSegments]\n );\n const customActionList = useMemo(\n () => toPlayerCustomActionList(customActions, customActionContext),\n [customActionContext, customActions]\n );\n const mobileVisibleActionCount = customActionList.length + 5;\n const controlsStyle = useMemo(\n () =>\n ({\n \"--slide-player-mobile-control-count\": String(mobileVisibleActionCount),\n }) as React.CSSProperties,\n [mobileVisibleActionCount]\n );\n const playerTexts = useMemo(\n () => ({\n ...DEFAULT_SLIDE_PLAYER_TEXTS,\n ...texts,\n }),\n [texts]\n );\n const currentAudioKey = useMemo(() => {\n if (!currentAudio) {\n return \"none\";\n }\n\n return (\n currentAudio.audioKey ??\n `${String(currentAudio.sequenceNumber ?? \"none\")}:${String(currentAudio.audioUrl ?? \"\")}`\n );\n }, [currentAudio]);\n const isTogglePlaying = useAutoAdvanceToggle\n ? isAutoAdvanceEnabled\n : isPlaying;\n const toggleAriaLabel = useAutoAdvanceToggle\n ? isAutoAdvanceEnabled\n ? \"Pause autoplay\"\n : \"Play autoplay\"\n : isPlaying\n ? \"Pause\"\n : \"Play\";\n\n useEffect(() => {\n currentAudioRef.current = currentAudio;\n }, [currentAudio]);\n\n useEffect(() => {\n if (showControls) {\n return;\n }\n\n setIsMobileMoreOpen(false);\n }, [showControls]);\n\n useEffect(() => {\n if (!previousInteractionOpenRef.current && isInteractionOpen) {\n setIsMobileMoreOpen(false);\n }\n\n previousInteractionOpenRef.current = isInteractionOpen;\n }, [isInteractionOpen]);\n\n useEffect(() => {\n currentAudioSegmentsRef.current = currentAudioSegments;\n }, [currentAudioSegments]);\n\n useEffect(() => {\n const currentUrl = currentAudio?.audioUrl;\n const nextUrl =\n currentAudioIndex >= 0\n ? audioList[currentAudioIndex + 1]?.audioUrl\n : undefined;\n\n preloadAudioUrl(currentUrl);\n preloadAudioUrl(nextUrl);\n }, [audioList, currentAudio?.audioUrl, currentAudioIndex]);\n\n const updateLoading = useCallback(\n (loading: boolean) => {\n if (isLoadingRef.current === loading) {\n return;\n }\n\n isLoadingRef.current = loading;\n onLoadingChange?.(loading);\n },\n [onLoadingChange]\n );\n\n const isAutoplayBlockedError = useCallback((error: unknown) => {\n if (!(error instanceof DOMException)) {\n return false;\n }\n\n return error.name === \"NotAllowedError\" || error.name === \"SecurityError\";\n }, []);\n\n const canStartPlaybackAutomatically = useCallback(() => {\n return (\n defaultPlaying &&\n !isPlaybackPaused &&\n !isPausedByUserRef.current &&\n playbackAccessModeRef.current !== \"blocked\"\n );\n }, [defaultPlaying, isPlaybackPaused]);\n\n const getSegmentSrc = useCallback((audioData: string) => {\n if (!audioData) {\n return \"\";\n }\n\n if (audioData.startsWith(\"data:\")) {\n return audioData;\n }\n\n return `data:audio/mpeg;base64,${audioData}`;\n }, []);\n\n const getWaitingSegmentSeekTime = useCallback(() => {\n const waitingSegmentIndex = waitingSegmentIndexRef.current;\n\n if (waitingSegmentIndex == null || waitingSegmentIndex <= 0) {\n return 0;\n }\n\n return (\n currentAudioSegmentsRef.current\n .slice(0, waitingSegmentIndex)\n .reduce(\n (totalDurationMs, segment) =>\n totalDurationMs + Math.max(Number(segment.duration_ms ?? 0), 0),\n 0\n ) / 1000\n );\n }, []);\n\n const resetAudio = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = false;\n wasPlayingBeforeExternalPauseRef.current = false;\n activeSourceTypeRef.current = null;\n pendingSeekTimeRef.current = null;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = null;\n currentSegmentIndexRef.current = 0;\n waitingSegmentIndexRef.current = null;\n setIsPlaying(false);\n updateLoading(false);\n }, [updateLoading]);\n\n const tryPlayCurrentAudio = useCallback(\n (_reason: string) => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return false;\n }\n\n const playPromise = audioElement.play();\n\n if (playPromise && typeof playPromise.then === \"function\") {\n void playPromise\n .then(() => {\n if (playbackAccessModeRef.current === \"unknown\") {\n playbackAccessModeRef.current = \"auto\";\n }\n\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n })\n .catch((error: unknown) => {\n if (\n playbackAccessModeRef.current === \"unknown\" &&\n isAutoplayBlockedError(error)\n ) {\n // Lock autoplay after the first browser rejection.\n playbackAccessModeRef.current = \"blocked\";\n pendingAutoPlayRef.current = false;\n updateLoading(false);\n }\n\n isSwitchingSegmentRef.current = false;\n setIsPlaying(false);\n });\n }\n\n return true;\n },\n [isAutoplayBlockedError, updateLoading]\n );\n\n const startSegmentPlayback = useCallback(\n (segmentIndex: number, _reason: string) => {\n const audioElement = audioRef.current;\n const segment = currentAudioSegmentsRef.current[segmentIndex];\n\n if (!audioElement || !segment) {\n return false;\n }\n\n const nextAudioSrc = getSegmentSrc(segment.audio_data);\n\n currentSegmentIndexRef.current = segmentIndex;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = true;\n const shouldAutoResume = canStartPlaybackAutomatically();\n\n pendingAutoPlayRef.current = shouldAutoResume;\n updateLoading(false);\n\n const hasNewSrc = audioSrcRef.current !== nextAudioSrc;\n\n activeSourceTypeRef.current = \"segment\";\n\n if (hasNewSrc) {\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = nextAudioSrc;\n audioElement.src = nextAudioSrc;\n audioElement.load();\n }\n\n pendingSeekTimeRef.current = 0;\n\n if (audioElement.readyState > 0) {\n audioElement.currentTime = 0;\n pendingSeekTimeRef.current = null;\n }\n\n if (!shouldAutoResume) {\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return true;\n }\n\n return tryPlayCurrentAudio(`start-segment:${_reason}`);\n },\n [\n canStartPlaybackAutomatically,\n getSegmentSrc,\n tryPlayCurrentAudio,\n updateLoading,\n ]\n );\n\n const finishAudioItem = useCallback(\n (_reason?: string) => {\n pendingAutoPlayRef.current = false;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n setIsPlaying(false);\n updateLoading(false);\n\n if (currentAudioIndex >= 0) {\n onEnded?.(currentAudioIndex);\n }\n },\n [currentAudioIndex, onEnded, updateLoading]\n );\n\n const handleSegmentEnded = useCallback(() => {\n const nextSegmentIndex = currentSegmentIndexRef.current + 1;\n const segments = currentAudioSegmentsRef.current;\n const nextSegment = segments[nextSegmentIndex];\n const activeAudio = currentAudioRef.current;\n const hasFinal = segments.some((segment) => segment.is_final);\n\n if (nextSegment) {\n startSegmentPlayback(nextSegmentIndex, \"ended\");\n return;\n }\n\n if (activeAudio?.isAudioStreaming || !hasFinal) {\n currentSegmentIndexRef.current = nextSegmentIndex;\n waitingSegmentIndexRef.current = nextSegmentIndex;\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = defaultPlaying;\n setIsPlaying(false);\n updateLoading(true);\n\n return;\n }\n\n finishAudioItem(\"segments-completed\");\n }, [defaultPlaying, finishAudioItem, startSegmentPlayback, updateLoading]);\n\n useEffect(() => {\n if (currentAudioKeyRef.current === currentAudioKey) {\n return;\n }\n\n currentAudioKeyRef.current = currentAudioKey;\n currentSegmentIndexRef.current = 0;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n isPausedByUserRef.current = false;\n wasPlayingBeforeExternalPauseRef.current = false;\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n activeSourceTypeRef.current = null;\n audioSrcRef.current = null;\n updateLoading(false);\n\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n setIsPlaying(false);\n }, [\n currentAudioIndex,\n currentAudioKey,\n currentAudioSegments.length,\n currentAudioUrl,\n updateLoading,\n ]);\n\n useEffect(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n if (isPlaybackPaused) {\n wasPlayingBeforeExternalPauseRef.current = Boolean(\n currentAudioRef.current &&\n !isPausedByUserRef.current &&\n (!audioElement.paused ||\n pendingAutoPlayRef.current ||\n waitingSegmentIndexRef.current !== null)\n );\n\n pendingAutoPlayRef.current = false;\n updateLoading(false);\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (\n !wasPlayingBeforeExternalPauseRef.current ||\n !currentAudioRef.current ||\n isPausedByUserRef.current\n ) {\n return;\n }\n\n wasPlayingBeforeExternalPauseRef.current = false;\n\n if (waitingSegmentIndexRef.current !== null) {\n if (\n waitingSegmentIndexRef.current < currentAudioSegmentsRef.current.length\n ) {\n startSegmentPlayback(waitingSegmentIndexRef.current, \"external-resume\");\n return;\n }\n\n pendingAutoPlayRef.current = true;\n updateLoading(true);\n return;\n }\n\n if (!audioSrcRef.current && currentAudioSegmentsRef.current.length > 0) {\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegmentsRef.current.length - 1\n ),\n \"external-resume-init\"\n );\n return;\n }\n\n if (!audioElement.paused) {\n return;\n }\n\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"external-resume\");\n }, [\n isPlaybackPaused,\n startSegmentPlayback,\n tryPlayCurrentAudio,\n updateLoading,\n ]);\n\n useEffect(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n if (!currentAudio) {\n resetAudio();\n return;\n }\n\n if (isPlaybackPaused) {\n pendingAutoPlayRef.current = false;\n updateLoading(false);\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (currentAudioUrl) {\n const hasNewSrc = audioSrcRef.current !== currentAudioUrl;\n const shouldAutoResume = canStartPlaybackAutomatically();\n const shouldKeepSegmentSource =\n activeSourceTypeRef.current === \"segment\" &&\n Boolean(audioSrcRef.current) &&\n waitingSegmentIndexRef.current === null;\n\n if (shouldKeepSegmentSource) {\n if (!shouldAutoResume) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (audioElement.paused) {\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"keep-segment-source\");\n }\n\n return;\n }\n\n if (hasNewSrc) {\n const nextSeekTime =\n waitingSegmentIndexRef.current !== null\n ? getWaitingSegmentSeekTime()\n : 0;\n\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = currentAudioUrl;\n activeSourceTypeRef.current = \"url\";\n audioElement.src = currentAudioUrl;\n audioElement.load();\n pendingSeekTimeRef.current = nextSeekTime;\n\n if (audioElement.readyState > 0) {\n audioElement.currentTime = nextSeekTime;\n pendingSeekTimeRef.current = null;\n }\n }\n\n pendingAutoPlayRef.current = shouldAutoResume;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n updateLoading(false);\n\n if (!shouldAutoResume) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n tryPlayCurrentAudio(hasNewSrc ? \"sync-url-init\" : \"sync-url\");\n return;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (waitingSegmentIndexRef.current < currentAudioSegments.length) {\n if (isPausedByUserRef.current) {\n setIsPlaying(false);\n updateLoading(false);\n return;\n }\n\n startSegmentPlayback(waitingSegmentIndexRef.current, \"wait-resume\");\n return;\n }\n\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = canStartPlaybackAutomatically();\n setIsPlaying(false);\n updateLoading(canStartPlaybackAutomatically());\n return;\n }\n\n if (!currentAudioSegments.length) {\n if (currentAudio.isAudioStreaming) {\n waitingSegmentIndexRef.current = currentSegmentIndexRef.current;\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = canStartPlaybackAutomatically();\n setIsPlaying(false);\n updateLoading(canStartPlaybackAutomatically());\n return;\n }\n\n resetAudio();\n return;\n }\n\n if (!audioSrcRef.current) {\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegments.length - 1\n ),\n \"effect-init\"\n );\n return;\n }\n\n if (!defaultPlaying || isPausedByUserRef.current) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (audioElement.paused) {\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"sync-paused-retry\");\n }\n }, [\n currentAudio,\n currentAudioIndex,\n currentAudioSegments,\n currentAudioUrl,\n defaultPlaying,\n isPlaybackPaused,\n canStartPlaybackAutomatically,\n resetAudio,\n startSegmentPlayback,\n tryPlayCurrentAudio,\n getWaitingSegmentSeekTime,\n updateLoading,\n ]);\n\n useEffect(() => resetAudio, [resetAudio]);\n\n const handleAudioPlay = useCallback(() => {\n setIsPlaying(true);\n updateLoading(false);\n }, [updateLoading]);\n\n const handleAudioPause = useCallback(() => {\n if (isWaitingForSegmentRef.current || isSwitchingSegmentRef.current) {\n return;\n }\n\n setIsPlaying(false);\n }, [currentAudioIndex]);\n\n const handleAudioCanPlay = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (audioElement && pendingSeekTimeRef.current !== null) {\n audioElement.currentTime = pendingSeekTimeRef.current;\n pendingSeekTimeRef.current = null;\n }\n\n if (!pendingAutoPlayRef.current || !defaultPlaying) {\n return;\n }\n\n tryPlayCurrentAudio(\"canplay\");\n }, [currentAudioIndex, defaultPlaying, tryPlayCurrentAudio]);\n\n const handleLoadedMetadata = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (audioElement && pendingSeekTimeRef.current !== null) {\n audioElement.currentTime = pendingSeekTimeRef.current;\n pendingSeekTimeRef.current = null;\n }\n }, [currentAudioIndex]);\n\n const handleAudioEnded = useCallback(() => {\n const shouldFinishAsUrl =\n activeSourceTypeRef.current === \"url\" ||\n currentAudioSegmentsRef.current.length === 0;\n\n isSwitchingSegmentRef.current = false;\n\n if (shouldFinishAsUrl) {\n finishAudioItem(\"url-ended\");\n return;\n }\n\n handleSegmentEnded();\n }, [finishAudioItem, handleSegmentEnded]);\n\n const handleAudioError = useCallback(() => {\n setIsPlaying(false);\n updateLoading(false);\n }, [updateLoading]);\n const handleMobileViewModeChange = useCallback(\n (nextViewMode: MobileViewMode) => {\n onMobileViewModeChange?.(nextViewMode);\n setIsMobileMoreOpen(false);\n },\n [onMobileViewModeChange]\n );\n\n return (\n <div className={cn(\"slide-player\", className)} {...props}>\n <audio\n ref={audioRef}\n preload=\"auto\"\n playsInline\n onLoadedMetadata={handleLoadedMetadata}\n onCanPlay={handleAudioCanPlay}\n onPlay={handleAudioPlay}\n onPause={handleAudioPause}\n onEnded={handleAudioEnded}\n onError={handleAudioError}\n />\n\n {showControls ? (\n <>\n <MobilePlayerSettingsSheet\n container={settingsPortalContainer}\n labels={{\n fullscreen: playerTexts.fullscreenLabel,\n nonFullscreen: playerTexts.nonFullscreenLabel,\n screen: playerTexts.screenLabel,\n title: playerTexts.settingsTitle,\n }}\n onClose={() => setIsMobileMoreOpen(false)}\n onOpenChange={setIsMobileMoreOpen}\n onViewModeChange={handleMobileViewModeChange}\n open={isMobileMoreOpen}\n viewMode={mobileViewMode}\n />\n\n <div className=\"slide-player__controls\" style={controlsStyle}>\n <div className=\"slide-player__group\">\n <button\n aria-expanded={isMobileMoreOpen}\n aria-haspopup=\"dialog\"\n aria-label=\"More options\"\n className=\"slide-player__action slide-player__action--mobile-more\"\n onClick={() => {\n setIsMobileMoreOpen((prevOpen) => !prevOpen);\n }}\n type=\"button\"\n >\n <EllipsisVertical\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n </button>\n <button aria-label=\"Volume\" className=\"hidden\" type=\"button\">\n <Volume2 className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label=\"Rewind\"\n className=\"slide-player__action slide-player__action--prev\"\n disabled={prevDisabled}\n onClick={onPrev}\n type=\"button\"\n >\n <RotateCcw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label={toggleAriaLabel}\n className=\"slide-player__toggle slide-player__toggle--playback\"\n onClick={() => {\n if (useAutoAdvanceToggle) {\n onAutoAdvanceToggle?.(!isAutoAdvanceEnabled);\n return;\n }\n\n const audioElement = audioRef.current;\n\n if (isPlaybackPaused || !audioElement || !currentAudio) {\n return;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (isPlaying) {\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = true;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n setIsPlaying(false);\n updateLoading(false);\n audioElement.pause();\n return;\n }\n\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n updateLoading(true);\n return;\n }\n\n if (!audioElement.src && currentAudioSegments.length > 0) {\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegments.length - 1\n ),\n \"toggle\"\n );\n return;\n }\n\n if (audioElement.paused) {\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"toggle-resume\");\n return;\n }\n\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = true;\n audioElement.pause();\n }}\n type=\"button\"\n >\n {isTogglePlaying ? <PauseIcon /> : <PlayIcon />}\n </button>\n <button\n aria-label=\"Forward\"\n className=\"slide-player__action slide-player__action--next\"\n disabled={nextDisabled}\n onClick={onNext}\n type=\"button\"\n >\n <RotateCw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n {onFullscreen ? (\n <button\n aria-label={\n isFullscreen ? \"Exit fullscreen\" : \"Enter fullscreen\"\n }\n className=\"slide-player__action slide-player__action--fullscreen\"\n onClick={onFullscreen}\n type=\"button\"\n >\n {isFullscreen ? (\n <ScanLine\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n ) : (\n <Maximize\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n )}\n </button>\n ) : null}\n </div>\n\n <div className=\"slide-player__separator\" />\n\n <div className=\"slide-player__group\">\n {customActionList.map((customAction, customActionIndex) => (\n <React.Fragment key={`custom-action-${customActionIndex}`}>\n {customAction}\n </React.Fragment>\n ))}\n <button\n aria-label=\"Notes\"\n className={cn(\n \"slide-player__action slide-player__action--notes\",\n isInteractionOpen && \"slide-player__action--active\"\n )}\n disabled={!hasInteraction}\n onClick={onInteractionToggle}\n type=\"button\"\n >\n <FilePenLine\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n </button>\n </div>\n </div>\n </>\n ) : null}\n </div>\n );\n};\n\nexport default Player;\n"],"names":["audioPreloadElementCache","preloadAudioUrl","url","audio","PauseIcon","jsxs","jsx","PlayIcon","Player","audioList","className","currentAudioIndex","defaultPlaying","isPlaybackPaused","isAutoAdvanceEnabled","useAutoAdvanceToggle","onLoadingChange","onPrev","onNext","onFullscreen","isFullscreen","mobileViewMode","DEFAULT_MOBILE_VIEW_MODE","settingsPortalContainer","onMobileViewModeChange","onEnded","onAutoAdvanceToggle","onInteractionToggle","hasInteraction","isInteractionOpen","prevDisabled","nextDisabled","showControls","customActions","customActionContext","texts","props","audioRef","useRef","previousInteractionOpenRef","audioSrcRef","currentAudioKeyRef","currentSegmentIndexRef","waitingSegmentIndexRef","currentAudioRef","currentAudioSegmentsRef","wasPlayingBeforeExternalPauseRef","isLoadingRef","isPausedByUserRef","activeSourceTypeRef","isWaitingForSegmentRef","pendingAutoPlayRef","pendingSeekTimeRef","isSwitchingSegmentRef","playbackAccessModeRef","isPlaying","setIsPlaying","useState","isMobileMoreOpen","setIsMobileMoreOpen","currentAudio","currentAudioUrl","currentAudioSegments","useMemo","prevSegment","nextSegment","customActionList","toPlayerCustomActionList","mobileVisibleActionCount","controlsStyle","playerTexts","DEFAULT_SLIDE_PLAYER_TEXTS","currentAudioKey","isTogglePlaying","toggleAriaLabel","useEffect","currentUrl","nextUrl","updateLoading","useCallback","loading","isAutoplayBlockedError","error","canStartPlaybackAutomatically","getSegmentSrc","audioData","getWaitingSegmentSeekTime","waitingSegmentIndex","totalDurationMs","segment","resetAudio","audioElement","tryPlayCurrentAudio","_reason","playPromise","startSegmentPlayback","segmentIndex","nextAudioSrc","shouldAutoResume","hasNewSrc","finishAudioItem","handleSegmentEnded","nextSegmentIndex","segments","activeAudio","hasFinal","nextSeekTime","handleAudioPlay","handleAudioPause","handleAudioCanPlay","handleLoadedMetadata","handleAudioEnded","shouldFinishAsUrl","handleAudioError","handleMobileViewModeChange","nextViewMode","cn","Fragment","MobilePlayerSettingsSheet","prevOpen","EllipsisVertical","Volume2","RotateCcw","RotateCw","ScanLine","Maximize","customAction","customActionIndex","React","FilePenLine"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAMA,yBAA+B,IAAA,GAU/BC,KAAkB,CAACC,MAAiB;AAKxC,MAJI,OAAO,SAAW,OAAe,CAACA,KAIlCF,GAAyB,IAAIE,CAAG;AAClC;AAKF,QAAMC,IAAQ,OAAO,SA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AU,uBACZ,UAAA;AAAA,UAAA6D,GAAiB,IAAI,CAAC4D,GAAcC,MACnCzH,gBAAAA,EAAAA,IAAC0H,GAAM,UAAN,EACE,UAAAF,EAAA,GADkB,iBAAiBC,CAAiB,EAEvD,CACD;AAAA,UACDzH,gBAAAA,EAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,cAAW;AAAA,cACX,WAAW8G;AAAA,gBACT;AAAA,gBACAvF,KAAqB;AAAA,cAAA;AAAA,cAEvB,UAAU,CAACD;AAAA,cACX,SAASD;AAAA,cACT,MAAK;AAAA,cAEL,UAAArB,gBAAAA,EAAAA;AAAAA,gBAAC2H;AAAA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,aAAa;AAAA,gBAAA;AAAA,cAAA;AAAA,YACf;AAAA,UAAA;AAAA,QACF,EAAA,CACF;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,EAAA,CACF,IACE;AAAA,EAAA,GACN;AAEJ;"}
1
+ {"version":3,"file":"Player.es.js","sources":["../../../src/components/Slide/Player.tsx"],"sourcesContent":["import React, {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n Captions,\n CaptionsOff,\n EllipsisVertical,\n FilePenLine,\n Maximize,\n RotateCcw,\n RotateCw,\n ScanLine,\n Volume2,\n} from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\nimport MobilePlayerSettingsSheet from \"./MobilePlayerSettingsSheet\";\nimport { DEFAULT_SLIDE_PLAYER_TEXTS } from \"./constants\";\nimport type { SlideAudioItem } from \"./useSlide\";\nimport type {\n SlidePlayerCustomActionContext,\n SlidePlayerCustomActions,\n} from \"./types\";\nimport {\n DEFAULT_MOBILE_VIEW_MODE,\n type MobileViewMode,\n} from \"./utils/mobileScreenMode\";\nimport { toPlayerCustomActionList } from \"./utils/playerCustomActions\";\nimport \"./player.css\";\n\nconst audioPreloadElementCache = new Map<string, HTMLAudioElement>();\n\nexport interface SlidePlayerTexts {\n settingsTitle?: string;\n subtitleLabel?: string;\n subtitleToggleAriaLabel?: string;\n screenLabel?: string;\n nonFullscreenLabel?: string;\n fullscreenLabel?: string;\n fullscreenHintText?: string;\n}\n\nconst preloadAudioUrl = (url?: string) => {\n if (typeof window === \"undefined\" || !url) {\n return;\n }\n\n if (audioPreloadElementCache.has(url)) {\n return;\n }\n\n // Use a detached audio element so warm-up follows the same media loading\n // path as the visible player instead of relying on link preload hints.\n const audio = window.document.createElement(\"audio\");\n audio.preload = \"auto\";\n audio.setAttribute(\"playsinline\", \"true\");\n audio.src = url;\n audio.load();\n\n audioPreloadElementCache.set(url, audio);\n};\n\nexport type PlayerProps = Omit<React.ComponentProps<\"div\">, \"onEnded\"> & {\n audioList?: SlideAudioItem[];\n currentAudioIndex?: number;\n defaultPlaying?: boolean;\n isPlaybackPaused?: boolean;\n isAutoAdvanceEnabled?: boolean;\n useAutoAdvanceToggle?: boolean;\n onLoadingChange?: (loading: boolean) => void;\n onPlaybackStarted?: () => void;\n onPlaybackTimeChange?: (timeMs: number) => void;\n onSubtitleToggle?: () => void;\n onPrev?: () => void;\n onNext?: () => void;\n onFullscreen?: () => void;\n isFullscreen?: boolean;\n mobileViewMode?: MobileViewMode;\n settingsPortalContainer?: HTMLElement | null;\n onMobileViewModeChange?: (viewMode: MobileViewMode) => void;\n onEnded?: (audioIndex: number) => void;\n onAutoAdvanceToggle?: (enabled: boolean) => void;\n onInteractionToggle?: () => void;\n hasInteraction?: boolean;\n isInteractionOpen?: boolean;\n isSubtitleEnabled?: boolean;\n prevDisabled?: boolean;\n nextDisabled?: boolean;\n showControls?: boolean;\n customActions?: SlidePlayerCustomActions;\n customActionContext?: SlidePlayerCustomActionContext;\n texts?: SlidePlayerTexts;\n};\n\nconst PauseIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"34\"\n height=\"34\"\n viewBox=\"0 0 34 34\"\n fill=\"none\"\n >\n <path\n d=\"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z\"\n fill=\"#0A0A0A\"\n />\n <path d=\"M12 10H16V24H12V10ZM18 10H22V24H18V10Z\" fill=\"white\" />\n </svg>\n);\n\nconst PlayIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"34\"\n height=\"34\"\n viewBox=\"0 0 34 34\"\n fill=\"none\"\n >\n <path\n d=\"M16.6667 33.3333C25.8714 33.3333 33.3333 25.8714 33.3333 16.6667C33.3333 7.46192 25.8714 0 16.6667 0C7.46192 0 0 7.46192 0 16.6667C0 25.8714 7.46192 33.3333 16.6667 33.3333Z\"\n fill=\"#0A0A0A\"\n />\n <path d=\"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z\" fill=\"white\" />\n </svg>\n);\n\nconst Player = ({\n audioList = [],\n className,\n currentAudioIndex = -1,\n defaultPlaying = true,\n isPlaybackPaused = false,\n isAutoAdvanceEnabled = true,\n useAutoAdvanceToggle = false,\n onLoadingChange,\n onPlaybackStarted,\n onPlaybackTimeChange,\n onSubtitleToggle,\n onPrev,\n onNext,\n onFullscreen,\n isFullscreen = false,\n mobileViewMode = DEFAULT_MOBILE_VIEW_MODE,\n settingsPortalContainer,\n onMobileViewModeChange,\n onEnded,\n onAutoAdvanceToggle,\n onInteractionToggle,\n hasInteraction = false,\n isInteractionOpen = false,\n isSubtitleEnabled = true,\n prevDisabled = false,\n nextDisabled = false,\n showControls = true,\n customActions,\n customActionContext,\n texts,\n ...props\n}: PlayerProps) => {\n const audioRef = useRef<HTMLAudioElement | null>(null);\n const previousInteractionOpenRef = useRef(isInteractionOpen);\n const audioSrcRef = useRef<string | null>(null);\n const currentAudioKeyRef = useRef<string | null>(null);\n const currentSegmentIndexRef = useRef(0);\n const waitingSegmentIndexRef = useRef<number | null>(null);\n const currentAudioRef = useRef<SlideAudioItem | undefined>(undefined);\n const currentAudioSegmentsRef = useRef<\n NonNullable<SlideAudioItem[\"audioSegments\"]>\n >([]);\n const wasPlayingBeforeExternalPauseRef = useRef(false);\n const isLoadingRef = useRef(false);\n const isPausedByUserRef = useRef(false);\n const activeSourceTypeRef = useRef<\"url\" | \"segment\" | null>(null);\n const isWaitingForSegmentRef = useRef(false);\n const pendingAutoPlayRef = useRef(false);\n const pendingSeekTimeRef = useRef<number | null>(null);\n const isSwitchingSegmentRef = useRef(false);\n const playbackAnimationFrameRef = useRef<number | null>(null);\n const playbackTimeMsRef = useRef(0);\n const playbackAccessModeRef = useRef<\n \"unknown\" | \"auto\" | \"manual\" | \"blocked\"\n >(\"unknown\");\n const [isPlaying, setIsPlaying] = useState(defaultPlaying);\n const [isMobileMoreOpen, setIsMobileMoreOpen] = useState(false);\n const currentAudio =\n currentAudioIndex >= 0 ? audioList[currentAudioIndex] : undefined;\n const currentAudioUrl = currentAudio?.audioUrl;\n const currentAudioSegments = useMemo(\n () =>\n [...(currentAudio?.audioSegments ?? [])].sort(\n (prevSegment, nextSegment) =>\n prevSegment.segment_index - nextSegment.segment_index\n ),\n [currentAudio?.audioSegments]\n );\n const customActionList = useMemo(\n () => toPlayerCustomActionList(customActions, customActionContext),\n [customActionContext, customActions]\n );\n const mobileVisibleActionCount = customActionList.length + 5;\n const controlsStyle = useMemo(\n () =>\n ({\n \"--slide-player-mobile-control-count\": String(mobileVisibleActionCount),\n }) as React.CSSProperties,\n [mobileVisibleActionCount]\n );\n const playerTexts = useMemo(\n () => ({\n ...DEFAULT_SLIDE_PLAYER_TEXTS,\n ...texts,\n }),\n [texts]\n );\n const currentAudioKey = useMemo(() => {\n if (!currentAudio) {\n return \"none\";\n }\n\n return (\n currentAudio.audioKey ??\n `${String(currentAudio.sequenceNumber ?? \"none\")}:${String(currentAudio.audioUrl ?? \"\")}`\n );\n }, [currentAudio]);\n const isTogglePlaying = useAutoAdvanceToggle\n ? isAutoAdvanceEnabled\n : isPlaying;\n const toggleAriaLabel = useAutoAdvanceToggle\n ? isAutoAdvanceEnabled\n ? \"Pause autoplay\"\n : \"Play autoplay\"\n : isPlaying\n ? \"Pause\"\n : \"Play\";\n\n useEffect(() => {\n currentAudioRef.current = currentAudio;\n }, [currentAudio]);\n\n useEffect(() => {\n if (showControls) {\n return;\n }\n\n setIsMobileMoreOpen(false);\n }, [showControls]);\n\n useEffect(() => {\n if (!previousInteractionOpenRef.current && isInteractionOpen) {\n setIsMobileMoreOpen(false);\n }\n\n previousInteractionOpenRef.current = isInteractionOpen;\n }, [isInteractionOpen]);\n\n useEffect(() => {\n currentAudioSegmentsRef.current = currentAudioSegments;\n }, [currentAudioSegments]);\n\n useEffect(() => {\n const currentUrl = currentAudio?.audioUrl;\n const nextUrl =\n currentAudioIndex >= 0\n ? audioList[currentAudioIndex + 1]?.audioUrl\n : undefined;\n\n preloadAudioUrl(currentUrl);\n preloadAudioUrl(nextUrl);\n }, [audioList, currentAudio?.audioUrl, currentAudioIndex]);\n\n const updateLoading = useCallback(\n (loading: boolean) => {\n if (isLoadingRef.current === loading) {\n return;\n }\n\n isLoadingRef.current = loading;\n onLoadingChange?.(loading);\n },\n [onLoadingChange]\n );\n\n const isAutoplayBlockedError = useCallback((error: unknown) => {\n if (!(error instanceof DOMException)) {\n return false;\n }\n\n return error.name === \"NotAllowedError\" || error.name === \"SecurityError\";\n }, []);\n\n const canStartPlaybackAutomatically = useCallback(() => {\n return (\n defaultPlaying &&\n !isPlaybackPaused &&\n !isPausedByUserRef.current &&\n playbackAccessModeRef.current !== \"blocked\"\n );\n }, [defaultPlaying, isPlaybackPaused]);\n\n const getSegmentSrc = useCallback((audioData: string) => {\n if (!audioData) {\n return \"\";\n }\n\n if (audioData.startsWith(\"data:\")) {\n return audioData;\n }\n\n return `data:audio/mpeg;base64,${audioData}`;\n }, []);\n\n const getWaitingSegmentSeekTime = useCallback(() => {\n const waitingSegmentIndex = waitingSegmentIndexRef.current;\n\n if (waitingSegmentIndex == null || waitingSegmentIndex <= 0) {\n return 0;\n }\n\n return (\n currentAudioSegmentsRef.current\n .slice(0, waitingSegmentIndex)\n .reduce(\n (totalDurationMs, segment) =>\n totalDurationMs + Math.max(Number(segment.duration_ms ?? 0), 0),\n 0\n ) / 1000\n );\n }, []);\n\n const getSegmentStartTimeMs = useCallback((segmentIndex: number) => {\n if (segmentIndex <= 0) {\n return 0;\n }\n\n return currentAudioSegmentsRef.current\n .slice(0, segmentIndex)\n .reduce(\n (totalDurationMs, segment) =>\n totalDurationMs + Math.max(Number(segment.duration_ms ?? 0), 0),\n 0\n );\n }, []);\n\n const getCurrentPlaybackTimeMs = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return waitingSegmentIndexRef.current != null\n ? getSegmentStartTimeMs(waitingSegmentIndexRef.current)\n : 0;\n }\n\n if (activeSourceTypeRef.current === \"segment\") {\n return (\n getSegmentStartTimeMs(currentSegmentIndexRef.current) +\n Math.max(audioElement.currentTime, 0) * 1000\n );\n }\n\n if (pendingSeekTimeRef.current !== null && audioElement.readyState === 0) {\n return pendingSeekTimeRef.current * 1000;\n }\n\n return Math.max(audioElement.currentTime, 0) * 1000;\n }, [getSegmentStartTimeMs]);\n\n const publishPlaybackTime = useCallback(\n (timeMs: number) => {\n const nextPlaybackTimeMs = Math.max(timeMs, 0);\n\n if (playbackTimeMsRef.current === nextPlaybackTimeMs) {\n return;\n }\n\n playbackTimeMsRef.current = nextPlaybackTimeMs;\n onPlaybackTimeChange?.(nextPlaybackTimeMs);\n },\n [onPlaybackTimeChange]\n );\n\n const syncPlaybackTime = useCallback(() => {\n publishPlaybackTime(getCurrentPlaybackTimeMs());\n }, [getCurrentPlaybackTimeMs, publishPlaybackTime]);\n\n const stopPlaybackTimeLoop = useCallback(() => {\n if (\n typeof window === \"undefined\" ||\n playbackAnimationFrameRef.current === null\n ) {\n return;\n }\n\n window.cancelAnimationFrame(playbackAnimationFrameRef.current);\n playbackAnimationFrameRef.current = null;\n }, []);\n\n const startPlaybackTimeLoop = useCallback(() => {\n if (\n typeof window === \"undefined\" ||\n playbackAnimationFrameRef.current !== null\n ) {\n return;\n }\n\n const updateFrame = () => {\n syncPlaybackTime();\n\n const audioElement = audioRef.current;\n\n if (!audioElement || audioElement.paused || audioElement.ended) {\n playbackAnimationFrameRef.current = null;\n return;\n }\n\n playbackAnimationFrameRef.current =\n window.requestAnimationFrame(updateFrame);\n };\n\n playbackAnimationFrameRef.current =\n window.requestAnimationFrame(updateFrame);\n }, [syncPlaybackTime]);\n\n const resetAudio = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n stopPlaybackTimeLoop();\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = false;\n wasPlayingBeforeExternalPauseRef.current = false;\n activeSourceTypeRef.current = null;\n pendingSeekTimeRef.current = null;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = null;\n currentSegmentIndexRef.current = 0;\n waitingSegmentIndexRef.current = null;\n publishPlaybackTime(0);\n setIsPlaying(false);\n updateLoading(false);\n }, [publishPlaybackTime, stopPlaybackTimeLoop, updateLoading]);\n\n const tryPlayCurrentAudio = useCallback(\n (_reason: string) => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return false;\n }\n\n const playPromise = audioElement.play();\n\n if (playPromise && typeof playPromise.then === \"function\") {\n void playPromise\n .then(() => {\n if (playbackAccessModeRef.current === \"unknown\") {\n playbackAccessModeRef.current = \"auto\";\n }\n\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n })\n .catch((error: unknown) => {\n if (\n playbackAccessModeRef.current === \"unknown\" &&\n isAutoplayBlockedError(error)\n ) {\n // Lock autoplay after the first browser rejection.\n playbackAccessModeRef.current = \"blocked\";\n pendingAutoPlayRef.current = false;\n updateLoading(false);\n }\n\n isSwitchingSegmentRef.current = false;\n setIsPlaying(false);\n });\n }\n\n return true;\n },\n [isAutoplayBlockedError, updateLoading]\n );\n\n const startSegmentPlayback = useCallback(\n (segmentIndex: number, _reason: string) => {\n const audioElement = audioRef.current;\n const segment = currentAudioSegmentsRef.current[segmentIndex];\n\n if (!audioElement || !segment) {\n return false;\n }\n\n const nextAudioSrc = getSegmentSrc(segment.audio_data);\n\n currentSegmentIndexRef.current = segmentIndex;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = true;\n publishPlaybackTime(getSegmentStartTimeMs(segmentIndex));\n const shouldAutoResume = canStartPlaybackAutomatically();\n\n pendingAutoPlayRef.current = shouldAutoResume;\n updateLoading(false);\n\n const hasNewSrc = audioSrcRef.current !== nextAudioSrc;\n\n activeSourceTypeRef.current = \"segment\";\n\n if (hasNewSrc) {\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = nextAudioSrc;\n audioElement.src = nextAudioSrc;\n audioElement.load();\n }\n\n pendingSeekTimeRef.current = 0;\n\n if (audioElement.readyState > 0) {\n audioElement.currentTime = 0;\n pendingSeekTimeRef.current = null;\n }\n\n if (!shouldAutoResume) {\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return true;\n }\n\n return tryPlayCurrentAudio(`start-segment:${_reason}`);\n },\n [\n canStartPlaybackAutomatically,\n getSegmentSrc,\n getSegmentStartTimeMs,\n publishPlaybackTime,\n tryPlayCurrentAudio,\n updateLoading,\n ]\n );\n\n const finishAudioItem = useCallback(\n (_reason?: string) => {\n stopPlaybackTimeLoop();\n pendingAutoPlayRef.current = false;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n syncPlaybackTime();\n setIsPlaying(false);\n updateLoading(false);\n\n if (currentAudioIndex >= 0) {\n onEnded?.(currentAudioIndex);\n }\n },\n [\n currentAudioIndex,\n onEnded,\n stopPlaybackTimeLoop,\n syncPlaybackTime,\n updateLoading,\n ]\n );\n\n const handleSegmentEnded = useCallback(() => {\n const nextSegmentIndex = currentSegmentIndexRef.current + 1;\n const segments = currentAudioSegmentsRef.current;\n const nextSegment = segments[nextSegmentIndex];\n const activeAudio = currentAudioRef.current;\n const hasFinal = segments.some((segment) => segment.is_final);\n\n if (nextSegment) {\n startSegmentPlayback(nextSegmentIndex, \"ended\");\n return;\n }\n\n if (activeAudio?.isAudioStreaming || !hasFinal) {\n currentSegmentIndexRef.current = nextSegmentIndex;\n waitingSegmentIndexRef.current = nextSegmentIndex;\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = defaultPlaying;\n publishPlaybackTime(getSegmentStartTimeMs(nextSegmentIndex));\n setIsPlaying(false);\n updateLoading(true);\n\n return;\n }\n\n finishAudioItem(\"segments-completed\");\n }, [\n defaultPlaying,\n finishAudioItem,\n getSegmentStartTimeMs,\n publishPlaybackTime,\n startSegmentPlayback,\n updateLoading,\n ]);\n\n useEffect(() => {\n if (currentAudioKeyRef.current === currentAudioKey) {\n return;\n }\n\n currentAudioKeyRef.current = currentAudioKey;\n currentSegmentIndexRef.current = 0;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n isPausedByUserRef.current = false;\n wasPlayingBeforeExternalPauseRef.current = false;\n pendingAutoPlayRef.current = false;\n isSwitchingSegmentRef.current = false;\n activeSourceTypeRef.current = null;\n audioSrcRef.current = null;\n stopPlaybackTimeLoop();\n publishPlaybackTime(0);\n updateLoading(false);\n\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n setIsPlaying(false);\n }, [\n currentAudioIndex,\n currentAudioKey,\n currentAudioSegments.length,\n currentAudioUrl,\n publishPlaybackTime,\n stopPlaybackTimeLoop,\n updateLoading,\n ]);\n\n useEffect(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n if (isPlaybackPaused) {\n wasPlayingBeforeExternalPauseRef.current = Boolean(\n currentAudioRef.current &&\n !isPausedByUserRef.current &&\n (!audioElement.paused ||\n pendingAutoPlayRef.current ||\n waitingSegmentIndexRef.current !== null)\n );\n\n pendingAutoPlayRef.current = false;\n updateLoading(false);\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (\n !wasPlayingBeforeExternalPauseRef.current ||\n !currentAudioRef.current ||\n isPausedByUserRef.current\n ) {\n return;\n }\n\n wasPlayingBeforeExternalPauseRef.current = false;\n\n if (waitingSegmentIndexRef.current !== null) {\n if (\n waitingSegmentIndexRef.current < currentAudioSegmentsRef.current.length\n ) {\n startSegmentPlayback(waitingSegmentIndexRef.current, \"external-resume\");\n return;\n }\n\n pendingAutoPlayRef.current = true;\n updateLoading(true);\n return;\n }\n\n if (!audioSrcRef.current && currentAudioSegmentsRef.current.length > 0) {\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegmentsRef.current.length - 1\n ),\n \"external-resume-init\"\n );\n return;\n }\n\n if (!audioElement.paused) {\n return;\n }\n\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"external-resume\");\n }, [\n isPlaybackPaused,\n startSegmentPlayback,\n tryPlayCurrentAudio,\n updateLoading,\n ]);\n\n useEffect(() => {\n const audioElement = audioRef.current;\n\n if (!audioElement) {\n return;\n }\n\n if (!currentAudio) {\n resetAudio();\n return;\n }\n\n if (isPlaybackPaused) {\n pendingAutoPlayRef.current = false;\n updateLoading(false);\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (currentAudioUrl) {\n const hasNewSrc = audioSrcRef.current !== currentAudioUrl;\n const shouldAutoResume = canStartPlaybackAutomatically();\n const shouldKeepSegmentSource =\n activeSourceTypeRef.current === \"segment\" &&\n Boolean(audioSrcRef.current) &&\n waitingSegmentIndexRef.current === null;\n\n if (shouldKeepSegmentSource) {\n if (!shouldAutoResume) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (audioElement.paused) {\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"keep-segment-source\");\n }\n\n return;\n }\n\n if (hasNewSrc) {\n const nextSeekTime =\n waitingSegmentIndexRef.current !== null\n ? getWaitingSegmentSeekTime()\n : 0;\n\n audioElement.pause();\n audioElement.removeAttribute(\"src\");\n audioElement.load();\n audioSrcRef.current = currentAudioUrl;\n activeSourceTypeRef.current = \"url\";\n audioElement.src = currentAudioUrl;\n audioElement.load();\n pendingSeekTimeRef.current = nextSeekTime;\n publishPlaybackTime(nextSeekTime * 1000);\n\n if (audioElement.readyState > 0) {\n audioElement.currentTime = nextSeekTime;\n pendingSeekTimeRef.current = null;\n }\n }\n\n pendingAutoPlayRef.current = shouldAutoResume;\n isWaitingForSegmentRef.current = false;\n isSwitchingSegmentRef.current = false;\n updateLoading(false);\n\n if (!shouldAutoResume) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n tryPlayCurrentAudio(hasNewSrc ? \"sync-url-init\" : \"sync-url\");\n return;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (waitingSegmentIndexRef.current < currentAudioSegments.length) {\n if (isPausedByUserRef.current) {\n setIsPlaying(false);\n updateLoading(false);\n return;\n }\n\n startSegmentPlayback(waitingSegmentIndexRef.current, \"wait-resume\");\n return;\n }\n\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = canStartPlaybackAutomatically();\n setIsPlaying(false);\n updateLoading(canStartPlaybackAutomatically());\n return;\n }\n\n if (!currentAudioSegments.length) {\n if (currentAudio.isAudioStreaming) {\n waitingSegmentIndexRef.current = currentSegmentIndexRef.current;\n isWaitingForSegmentRef.current = true;\n pendingAutoPlayRef.current = canStartPlaybackAutomatically();\n setIsPlaying(false);\n updateLoading(canStartPlaybackAutomatically());\n return;\n }\n\n resetAudio();\n return;\n }\n\n if (!audioSrcRef.current) {\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegments.length - 1\n ),\n \"effect-init\"\n );\n return;\n }\n\n if (!defaultPlaying || isPausedByUserRef.current) {\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n setIsPlaying(false);\n return;\n }\n\n if (audioElement.paused) {\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"sync-paused-retry\");\n }\n }, [\n currentAudio,\n currentAudioIndex,\n currentAudioSegments,\n currentAudioUrl,\n defaultPlaying,\n isPlaybackPaused,\n canStartPlaybackAutomatically,\n publishPlaybackTime,\n resetAudio,\n startSegmentPlayback,\n tryPlayCurrentAudio,\n getWaitingSegmentSeekTime,\n updateLoading,\n ]);\n\n useEffect(() => resetAudio, [resetAudio]);\n\n useEffect(() => stopPlaybackTimeLoop, [stopPlaybackTimeLoop]);\n\n const handleAudioPlay = useCallback(() => {\n syncPlaybackTime();\n startPlaybackTimeLoop();\n setIsPlaying(true);\n updateLoading(false);\n onPlaybackStarted?.();\n }, [\n onPlaybackStarted,\n startPlaybackTimeLoop,\n syncPlaybackTime,\n updateLoading,\n ]);\n\n const handleAudioPause = useCallback(() => {\n if (isWaitingForSegmentRef.current || isSwitchingSegmentRef.current) {\n return;\n }\n\n stopPlaybackTimeLoop();\n syncPlaybackTime();\n setIsPlaying(false);\n }, [currentAudioIndex, stopPlaybackTimeLoop, syncPlaybackTime]);\n\n const handleAudioCanPlay = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (audioElement && pendingSeekTimeRef.current !== null) {\n audioElement.currentTime = pendingSeekTimeRef.current;\n pendingSeekTimeRef.current = null;\n }\n\n syncPlaybackTime();\n\n if (!pendingAutoPlayRef.current || !defaultPlaying) {\n return;\n }\n\n tryPlayCurrentAudio(\"canplay\");\n }, [\n currentAudioIndex,\n defaultPlaying,\n syncPlaybackTime,\n tryPlayCurrentAudio,\n ]);\n\n const handleLoadedMetadata = useCallback(() => {\n const audioElement = audioRef.current;\n\n if (audioElement && pendingSeekTimeRef.current !== null) {\n audioElement.currentTime = pendingSeekTimeRef.current;\n pendingSeekTimeRef.current = null;\n }\n\n syncPlaybackTime();\n }, [currentAudioIndex, syncPlaybackTime]);\n\n const handleAudioTimeUpdate = useCallback(() => {\n syncPlaybackTime();\n }, [syncPlaybackTime]);\n\n const handleAudioSeeking = useCallback(() => {\n syncPlaybackTime();\n }, [syncPlaybackTime]);\n\n const handleAudioEnded = useCallback(() => {\n const shouldFinishAsUrl =\n activeSourceTypeRef.current === \"url\" ||\n currentAudioSegmentsRef.current.length === 0;\n\n stopPlaybackTimeLoop();\n isSwitchingSegmentRef.current = false;\n\n if (shouldFinishAsUrl) {\n finishAudioItem(\"url-ended\");\n return;\n }\n\n handleSegmentEnded();\n }, [finishAudioItem, handleSegmentEnded, stopPlaybackTimeLoop]);\n\n const handleAudioError = useCallback(() => {\n stopPlaybackTimeLoop();\n syncPlaybackTime();\n setIsPlaying(false);\n updateLoading(false);\n }, [stopPlaybackTimeLoop, syncPlaybackTime, updateLoading]);\n const handleMobileViewModeChange = useCallback(\n (nextViewMode: MobileViewMode) => {\n onMobileViewModeChange?.(nextViewMode);\n setIsMobileMoreOpen(false);\n },\n [onMobileViewModeChange]\n );\n\n useEffect(() => {\n onPlaybackTimeChange?.(playbackTimeMsRef.current);\n }, [onPlaybackTimeChange]);\n\n return (\n <div className={cn(\"slide-player\", className)} {...props}>\n <audio\n ref={audioRef}\n preload=\"auto\"\n playsInline\n onLoadedMetadata={handleLoadedMetadata}\n onCanPlay={handleAudioCanPlay}\n onPlay={handleAudioPlay}\n onPause={handleAudioPause}\n onSeeking={handleAudioSeeking}\n onSeeked={handleAudioSeeking}\n onTimeUpdate={handleAudioTimeUpdate}\n onEnded={handleAudioEnded}\n onError={handleAudioError}\n />\n\n {showControls ? (\n <>\n <MobilePlayerSettingsSheet\n container={settingsPortalContainer}\n labels={{\n fullscreen: playerTexts.fullscreenLabel,\n nonFullscreen: playerTexts.nonFullscreenLabel,\n screen: playerTexts.screenLabel,\n subtitle: playerTexts.subtitleLabel,\n subtitleToggle: playerTexts.subtitleToggleAriaLabel,\n title: playerTexts.settingsTitle,\n }}\n isSubtitleEnabled={isSubtitleEnabled}\n onClose={() => setIsMobileMoreOpen(false)}\n onOpenChange={setIsMobileMoreOpen}\n onSubtitleToggle={onSubtitleToggle ?? (() => {})}\n onViewModeChange={handleMobileViewModeChange}\n open={isMobileMoreOpen}\n viewMode={mobileViewMode}\n />\n\n <div className=\"slide-player__controls\" style={controlsStyle}>\n <div className=\"slide-player__group\">\n <button\n aria-expanded={isMobileMoreOpen}\n aria-haspopup=\"dialog\"\n aria-label=\"More options\"\n className=\"slide-player__action slide-player__action--mobile-more\"\n onClick={() => {\n setIsMobileMoreOpen((prevOpen) => !prevOpen);\n }}\n type=\"button\"\n >\n <EllipsisVertical\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n </button>\n <button aria-label=\"Volume\" className=\"hidden\" type=\"button\">\n <Volume2 className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label={playerTexts.subtitleToggleAriaLabel}\n aria-pressed={isSubtitleEnabled}\n className=\"slide-player__action slide-player__action--subtitle\"\n onClick={onSubtitleToggle}\n type=\"button\"\n >\n {isSubtitleEnabled ? (\n <Captions className=\"slide-player__icon\" strokeWidth={2.25} />\n ) : (\n <CaptionsOff\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n )}\n </button>\n <button\n aria-label=\"Rewind\"\n className=\"slide-player__action slide-player__action--prev\"\n disabled={prevDisabled}\n onClick={onPrev}\n type=\"button\"\n >\n <RotateCcw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label={toggleAriaLabel}\n className=\"slide-player__toggle slide-player__toggle--playback\"\n onClick={() => {\n if (useAutoAdvanceToggle) {\n onAutoAdvanceToggle?.(!isAutoAdvanceEnabled);\n return;\n }\n\n const audioElement = audioRef.current;\n\n if (isPlaybackPaused || !audioElement || !currentAudio) {\n return;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (isPlaying) {\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = true;\n waitingSegmentIndexRef.current = null;\n isWaitingForSegmentRef.current = false;\n setIsPlaying(false);\n updateLoading(false);\n audioElement.pause();\n return;\n }\n\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n updateLoading(true);\n return;\n }\n\n if (!audioElement.src && currentAudioSegments.length > 0) {\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n startSegmentPlayback(\n Math.min(\n currentSegmentIndexRef.current,\n currentAudioSegments.length - 1\n ),\n \"toggle\"\n );\n return;\n }\n\n if (audioElement.paused) {\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"toggle-resume\");\n return;\n }\n\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = true;\n audioElement.pause();\n }}\n type=\"button\"\n >\n {isTogglePlaying ? <PauseIcon /> : <PlayIcon />}\n </button>\n <button\n aria-label=\"Forward\"\n className=\"slide-player__action slide-player__action--next\"\n disabled={nextDisabled}\n onClick={onNext}\n type=\"button\"\n >\n <RotateCw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n {onFullscreen ? (\n <button\n aria-label={\n isFullscreen ? \"Exit fullscreen\" : \"Enter fullscreen\"\n }\n className=\"slide-player__action slide-player__action--fullscreen\"\n onClick={onFullscreen}\n type=\"button\"\n >\n {isFullscreen ? (\n <ScanLine\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n ) : (\n <Maximize\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n )}\n </button>\n ) : null}\n </div>\n\n <div className=\"slide-player__separator\" />\n\n <div className=\"slide-player__group\">\n {customActionList.map((customAction, customActionIndex) => (\n <React.Fragment key={`custom-action-${customActionIndex}`}>\n {customAction}\n </React.Fragment>\n ))}\n <button\n aria-label=\"Notes\"\n className={cn(\n \"slide-player__action slide-player__action--notes\",\n isInteractionOpen && \"slide-player__action--active\"\n )}\n disabled={!hasInteraction}\n onClick={onInteractionToggle}\n type=\"button\"\n >\n <FilePenLine\n className=\"slide-player__icon\"\n strokeWidth={2.25}\n />\n </button>\n </div>\n </div>\n </>\n ) : null}\n </div>\n );\n};\n\nconst MemoizedPlayer = memo(Player);\n\nMemoizedPlayer.displayName = \"Player\";\n\nexport default MemoizedPlayer;\n"],"names":["audioPreloadElementCache","preloadAudioUrl","url","audio","PauseIcon","jsxs","jsx","PlayIcon","Player","audioList","className","currentAudioIndex","defaultPlaying","isPlaybackPaused","isAutoAdvanceEnabled","useAutoAdvanceToggle","onLoadingChange","onPlaybackStarted","onPlaybackTimeChange","onSubtitleToggle","onPrev","onNext","onFullscreen","isFullscreen","mobileViewMode","DEFAULT_MOBILE_VIEW_MODE","settingsPortalContainer","onMobileViewModeChange","onEnded","onAutoAdvanceToggle","onInteractionToggle","hasInteraction","isInteractionOpen","isSubtitleEnabled","prevDisabled","nextDisabled","showControls","customActions","customActionContext","texts","props","audioRef","useRef","previousInteractionOpenRef","audioSrcRef","currentAudioKeyRef","currentSegmentIndexRef","waitingSegmentIndexRef","currentAudioRef","currentAudioSegmentsRef","wasPlayingBeforeExternalPauseRef","isLoadingRef","isPausedByUserRef","activeSourceTypeRef","isWaitingForSegmentRef","pendingAutoPlayRef","pendingSeekTimeRef","isSwitchingSegmentRef","playbackAnimationFrameRef","playbackTimeMsRef","playbackAccessModeRef","isPlaying","setIsPlaying","useState","isMobileMoreOpen","setIsMobileMoreOpen","currentAudio","currentAudioUrl","currentAudioSegments","useMemo","prevSegment","nextSegment","customActionList","toPlayerCustomActionList","mobileVisibleActionCount","controlsStyle","playerTexts","DEFAULT_SLIDE_PLAYER_TEXTS","currentAudioKey","isTogglePlaying","toggleAriaLabel","useEffect","currentUrl","nextUrl","updateLoading","useCallback","loading","isAutoplayBlockedError","error","canStartPlaybackAutomatically","getSegmentSrc","audioData","getWaitingSegmentSeekTime","waitingSegmentIndex","totalDurationMs","segment","getSegmentStartTimeMs","segmentIndex","getCurrentPlaybackTimeMs","audioElement","publishPlaybackTime","timeMs","nextPlaybackTimeMs","syncPlaybackTime","stopPlaybackTimeLoop","startPlaybackTimeLoop","updateFrame","resetAudio","tryPlayCurrentAudio","_reason","playPromise","startSegmentPlayback","nextAudioSrc","shouldAutoResume","hasNewSrc","finishAudioItem","handleSegmentEnded","nextSegmentIndex","segments","activeAudio","hasFinal","nextSeekTime","handleAudioPlay","handleAudioPause","handleAudioCanPlay","handleLoadedMetadata","handleAudioTimeUpdate","handleAudioSeeking","handleAudioEnded","shouldFinishAsUrl","handleAudioError","handleMobileViewModeChange","nextViewMode","cn","Fragment","MobilePlayerSettingsSheet","prevOpen","EllipsisVertical","Volume2","Captions","CaptionsOff","RotateCcw","RotateCw","ScanLine","Maximize","customAction","customActionIndex","React","FilePenLine","MemoizedPlayer","memo"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,MAAMA,yBAA+B,IAAA,GAY/BC,KAAkB,CAACC,MAAiB;AAKxC,MAJI,OAAO,SAAW,OAAe,CAACA,KAIlCF,GAAyB,IAAIE,CAAG;AAClC;AAKF,QAAMC,IAAQ,OAAO,SAAS,cAAc,OAAO;AACnD,EAAAA,EAAM,UAAU,QAChBA,EAAM,aAAa,eAAe,MAAM,GACxCA,EAAM,MAAMD,GACZC,EAAM,KAAA,GAENH,GAAyB,IAAIE,GAAKC,CAAK;AACzC,GAkCMC,KAAY,MAChBC,gBAAAA,EAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IAEL,UAAA;AAAA,MAAAC,gBAAAA,EAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,MAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAEPA,gBAAAA,EAAAA,IAAC,QAAA,EAAK,GAAE,0CAAyC,MAAK,QAAA,CAAQ;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AA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,aAAa;AAAA,gBAAA;AAAA,cAAA;AAAA,YACf;AAAA,UAAA,IAGF;AAAA,QAAA,GACN;AAAA,QAEA1I,gBAAAA,EAAAA,IAAC,OAAA,EAAI,WAAU,0BAAA,CAA0B;AAAA,QAEzCD,gBAAAA,EAAAA,KAAC,OAAA,EAAI,WAAU,uBACZ,UAAA;AAAA,UAAAmE,GAAiB,IAAI,CAACyE,GAAcC,MACnC5I,gBAAAA,EAAAA,IAAC6I,GAAM,UAAN,EACE,UAAAF,EAAA,GADkB,iBAAiBC,CAAiB,EAEvD,CACD;AAAA,UACD5I,gBAAAA,EAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,cAAW;AAAA,cACX,WAAW+H;AAAA,gBACT;AAAA,gBACArG,KAAqB;AAAA,cAAA;AAAA,cAEvB,UAAU,CAACD;AAAA,cACX,SAASD;AAAA,cACT,MAAK;AAAA,cAEL,UAAAxB,gBAAAA,EAAAA;AAAAA,gBAAC8I;AAAA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,aAAa;AAAA,gBAAA;AAAA,cAAA;AAAA,YACf;AAAA,UAAA;AAAA,QACF,EAAA,CACF;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,EAAA,CACF,IACE;AAAA,EAAA,GACN;AAEJ,GAEMC,KAAiBC,GAAK9I,EAAM;AAElC6I,GAAe,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../../_virtual/jsx-runtime.cjs.js"),t=require("react"),Gt=require("../../lib/sandboxInteraction.cjs.js"),U=require("../../lib/utils.cjs.js"),Yt=require("../ui/loading-overlay-card.cjs.js"),Xt=require("../ContentRender/ContentRender.cjs.js"),it=require("../ContentRender/IframeSandbox.cjs.js");require("../ui/inputGroup/input-group.cjs.js");const ct=require("../../lib/interaction-defaults.cjs.js"),me=require("../../lib/mobileDevice.cjs.js"),Jt=require("./Player.cjs.js"),Qt=require("./constants.cjs.js"),Zt=require("./SlideFullscreenHint.cjs.js"),en=require("./useSlide.cjs.js"),tn=require("./useWakePlayerFromIframe.cjs.js"),Q=require("./utils/mobileScreenMode.cjs.js"),nn=require("./utils/interactionPlayback.cjs.js"),rn=require("./utils/playbackSequence.cjs.js"),at=require("./utils/playerCustomActions.cjs.js"),sn=require("./utils/playerToggleMode.cjs.js");;/* empty css */const on=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs.js"),ln=2e3,dt=t.memo(({content:T,title:P,defaultButtonText:p,defaultInputText:W,defaultSelectedValues:h,confirmButtonText:F,copyButtonText:$,copiedButtonText:pe,onSend:he,readonly:q=!1})=>n.jsxRuntimeExports.jsxs("div",{className:"slide-player__interaction-card",children:[n.jsxRuntimeExports.jsx("div",{className:"slide-player__interaction-header",children:n.jsxRuntimeExports.jsx("p",{className:"slide-player__interaction-title",children:P})}),n.jsxRuntimeExports.jsx("div",{className:"slide-player__interaction-body",children:n.jsxRuntimeExports.jsx(Xt.default,{content:T,defaultButtonText:p,defaultInputText:W,defaultSelectedValues:h,confirmButtonText:F,copyButtonText:$,copiedButtonText:pe,onSend:he,readonly:q,enableTypewriter:!1,sandboxMode:"content"})}),n.jsxRuntimeExports.jsx("div",{className:"slide-player__interaction-arrow"})]}));dt.displayName="InteractionOverlayCard";const un=(T,P)=>T.length===P.length&&T.every((p,W)=>{const h=P[W];return p.sequence_number===h?.sequence_number&&p.type===h?.type&&p.content===h?.content}),cn=({elementList:T=[],showPlayer:P=!0,playerAlwaysVisible:p=!1,playerClassName:W,fullscreenHeader:h,playerCustomActions:F,playerCustomActionPauseOnActive:$=!0,bufferingText:pe="Buffering...",interactionTitle:he,interactionTexts:q,playerTexts:je,playerAutoHideDelay:xe=3e3,markerAutoAdvanceDelay:ke=ln,interactionDefaultValueOptions:Z,onSend:Te,onPlayerVisibilityChange:ve,onMobileViewModeChange:Pe,onStepChange:Fe,enableIframeScaling:ft=!0,className:mt,onPointerDown:qe,...pt})=>{const ee=t.useRef(null),Be=t.useRef(null),be=t.useRef(null),Le=t.useRef(null),z=t.useRef(null),G=t.useRef(null),Y=t.useRef(null),Ne=t.useRef([]),te=t.useRef(!1),B=t.useRef(null),Ve=t.useRef(null),{currentElementList:y,stepElementLists:Oe,slideElementList:L,currentIndex:c,audioList:f,currentAudioSequenceIndexes:ne,currentStepHasSpeakableElement:x,currentInteractionElement:i,canGoPrev:ht,canGoNext:w,handlePrev:Ke,handleNext:I}=en.default(T),X=t.useMemo(()=>{if(!(c<0))return L[c]},[c,L]),xt=L.filter(e=>e.is_renderable!==!1).length===1,E=P&&(L.length>0||f.length>0||!!i),g=t.useMemo(()=>ne.map(e=>f[e]?.audioKey).filter(e=>!!e),[f,ne]),[De,re]=t.useState(!0),[se,J]=t.useState(!1),[Ee,He]=t.useState(!0),[m,N]=t.useState(null),[vt,v]=t.useState(!1),[A,Ue]=t.useState(!1),[ge,Se]=t.useState(!1),[s,oe]=t.useState(),[le,ue]=t.useState(!1),[bt,Et]=t.useState(!1),S=t.useMemo(()=>me.isMobileDevice(),[]),[ie,ye]=t.useState(Q.DEFAULT_MOBILE_VIEW_MODE),[We,we]=t.useState(!1),[Re,$e]=t.useState(()=>S?me.isLandscapeViewport():!1),[gt,ce]=t.useState(!1),{effectiveMobileViewMode:M,isImmersiveMobileFullscreen:V,isNativeMobileFullscreen:ze,shouldRotateFullscreenViewport:St}=t.useMemo(()=>Q.resolveMobileViewModeState({hasManualMobileViewMode:We,isMobileDevice:S,mobileViewMode:ie}),[We,S,Re,ie]),Ge=t.useRef(M),_=E&&(p||De),yt=V&&_,wt=V&&_,Rt=V||ze,It=je?.fullscreenHintText??Qt.DEFAULT_SLIDE_PLAYER_TEXTS.fullscreenHintText,At=t.useCallback(e=>{we(!0),ye(e)},[]),Ye=t.useCallback(()=>{we(!1),ye(Q.DEFAULT_MOBILE_VIEW_MODE)},[]),Mt=t.useCallback(()=>{Ye(),h?.onBack?.()},[h,Ye]),_t=t.useCallback(()=>{ce(!1)},[]),Xe=t.useCallback(e=>{Se(e)},[]),Je=t.useCallback(()=>{Se(e=>!e)},[]),{mountedStepStates:Ct,currentMountedStateIndex:jt}=t.useMemo(()=>{const e=[],r=new Map;return Oe.forEach((l,a)=>{const o=e.findIndex(u=>un(u.elementList,l));if(o>=0){e[o]?.sourceStepIndexes.push(a),r.set(a,o);return}e.push({elementList:l,sourceStepIndexes:[a]}),r.set(a,e.length-1)}),{mountedStepStates:e,currentMountedStateIndex:c>=0?r.get(c)??-1:-1}},[c,Oe]),Qe=t.useMemo(()=>String(c),[c]),C=t.useMemo(()=>m?f.findIndex(e=>(e.audioKey??"")===m):-1,[f,m]),ae=t.useMemo(()=>g[0]??"none",[g]),Ie=t.useMemo(()=>({currentElement:at.resolvePlayerCustomActionElement({currentAudioIndex:C,currentAudioSequenceIndexes:ne,audioList:f,currentInteractionElement:s,currentStepElement:X}),currentIndex:c,currentStepElement:X,isActive:ge,setActive:Xe,toggleActive:Je}),[s,f,C,ne,c,X,ge,Xe,Je]),Ae=t.useMemo(()=>at.getPlayerCustomActionCount(F,Ie),[Ie,F]),kt=t.useMemo(()=>({"--slide-player-custom-action-count":String(Ae),"--slide-player-mobile-control-count":String(Ae+4)}),[Ae]),Ze=g.length>0,et=t.useMemo(()=>i?`${i.sequence_number??"none"}:${String(i.content??"")}`:"none",[i]),Me=t.useMemo(()=>[Qe,et].join("|"),[et,Qe]),tt=!!t.useMemo(()=>!ae||ae==="none"?"":f.find(r=>r.audioKey===ae)?.audioUrl?.trim()??"",[f,ae]),j=$&&!!F&&ge,_e=t.useMemo(()=>sn.shouldUseAutoAdvanceToggle({canGoNext:w,currentAudioIndex:C,currentStepHasSpeakableElement:x,hasInteraction:!!i}),[w,C,i,x]),k=t.useCallback(()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null)},[]),R=t.useCallback(()=>{Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null)},[]),O=t.useCallback(()=>{G.current!==null&&(window.clearTimeout(G.current),G.current=null)},[]),K=t.useCallback(()=>{O(),R(),N(null),v(!1),Ue(!1),oe(void 0),ue(!1)},[O,R]),D=t.useCallback(()=>{const e=g[0];return e?(N(e),!0):!1},[g]),de=t.useCallback(()=>{R(),ue(!1),!D()&&w&&I()},[w,R,I,D]),d=t.useCallback((e=se)=>{E&&(re(!0),k(),!(p||!e||xe<=0)&&(z.current=window.setTimeout(()=>{re(!1),z.current=null},xe)))},[k,se,p,xe,E]),Ce=!!(i?.readonly||i?.user_input?.trim()),H=!!i&&!Ce;t.useEffect(()=>{He(!0),$&&Se(!1)},[c,$]),t.useEffect(()=>()=>{O(),k(),R()},[O,R,k]),t.useEffect(()=>(ve?.(_),()=>{ve?.(!1)}),[ve,_]),t.useEffect(()=>{S||ie===Q.DEFAULT_MOBILE_VIEW_MODE||(we(!1),ye(Q.DEFAULT_MOBILE_VIEW_MODE))},[S,ie]),t.useEffect(()=>{if(!S){$e(!1);return}const e=()=>{$e(me.isLandscapeViewport())};return e(),me.subscribeMobileDeviceChange(e)},[S]),t.useEffect(()=>{Pe?.(M)},[M,Pe]),t.useEffect(()=>{const l=Ge.current!=="fullscreen"&&M==="fullscreen"&&!Re;if(Ge.current=M,!S){ce(!1);return}if(l){ce(!0);return}M!=="fullscreen"&&ce(!1)},[M,S,Re]),t.useEffect(()=>{Fe?.(X,c)},[c,X,Fe]),t.useEffect(()=>{if(!E){k(),re(!1);return}if(p){k(),re(!0);return}se||d(!0)},[k,se,p,E,d]),t.useEffect(()=>{if(typeof window>"u")return;const e=r=>{r.origin===window.location.origin&&Gt.isSandboxInteractionMessage(r.data)&&r.data.eventType==="click"&&E&&(J(!0),d(!0))};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[E,d]),tn.default({sectionRef:ee,enabled:E,onWake:()=>{J(!0),d(!0)}}),t.useEffect(()=>{const{hasPlaybackContextChanged:e,shouldInitializeAudioSequence:r}=rn.getPlaybackSequenceTransition({previousResetKey:Ve.current,nextResetKey:Me,currentAudioKey:m,hasCompletedCurrentStepAudio:A});Ve.current=Me;const l=B.current===c&&!!i,a=nn.shouldPresentInteractionOverlay({hasInteraction:!!i,shouldBlockPlaybackForInteraction:H,shouldOpenInteractionOverlayAfterAudio:l,hasPlaybackContextChanged:e,hasResolvedCurrentInteraction:Ce,currentStepHasSpeakableElement:x});if(e&&K(),!(y.length===0&&!i)&&!j){if(a){oe(i),ue(!0),B.current=null;return}if(i&&(oe(i),B.current=null),!!r&&!D()){if(x){v(!0);return}if(w&&!(_e&&!Ee))return G.current=window.setTimeout(()=>{G.current=null,I()},ke),()=>{O()}}}},[w,O,y.length,i,m,Me,x,ke,I,A,Ee,Ce,H,K,D,j,_e]),t.useEffect(()=>{if(j||!x||H){v(!1);return}if(A){v(!1);return}if(Ze){v(!1);return}v(!0)},[Ze,x,A,j,H]),t.useEffect(()=>{m||g.length===0||j||!x||H||A||D()},[m,g,x,A,j,H,D]),t.useEffect(()=>{!m||C>=0||N(null)},[C,m]);const nt=t.useMemo(()=>{if(!s)return{};const e=!!s.user_input?.trim();return ct.getInteractionDefaultValues(typeof s.content=="string"?s.content:void 0,s.user_input,e?void 0:Z)},[s,Z]),Tt=t.useMemo(()=>{if(!s)return;const e=!!s.user_input?.trim();return ct.getInteractionDefaultSelectedValues(typeof s.content=="string"?s.content:void 0,s.user_input,e?void 0:Z)},[s,Z]),rt=!!s?.user_input?.trim(),st=!!s?.readonly||rt,ot=st||rt,Pt=t.useCallback(e=>{const l=[...e.selectedValues??[],e.inputText?.trim()??"",e.buttonText?.trim()??""].filter(Boolean).join(", ");oe(a=>!a||!l?a:{...a,user_input:l}),Te?.(e,s),de()},[s,de,Te]);t.useEffect(()=>{const e=()=>{Et(document.fullscreenElement===ee.current)};return e(),document.addEventListener("fullscreenchange",e),()=>{document.removeEventListener("fullscreenchange",e)}},[]),t.useEffect(()=>{if(R(),!(!le||!ot))return Y.current=window.setTimeout(()=>{Y.current=null,de()},2e3),()=>{R()}},[R,de,le,ot]);const Ft=(e,r={})=>e?e.type==="slot"?n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:e.content}):e.type==="html"?n.jsxRuntimeExports.jsx(it.default,{className:"content-render-iframe",hideFullScreen:!0,mode:"blackboard",replaceRootScreenHeightWithFull:r.replaceRootScreenHeightWithFull,type:"sandbox",content:e.content,enableScaling:ft}):n.jsxRuntimeExports.jsx(it.default,{className:"content-render-iframe",hideFullScreen:!0,mode:"blackboard",type:"markdown",content:e.content}):null,qt=(e=[],r=!1)=>{if(e.length===0)return null;const l=e.filter(o=>o.is_renderable!==!1).length,a=e.reduce((o,u,b)=>u.is_renderable!==!1?b:o,-1);return n.jsxRuntimeExports.jsx("div",{className:"slide-stage__content flex w-full flex-col gap-4",children:e.map((o,u)=>{const b=o.type==="html"&&o.is_renderable===!1;return n.jsxRuntimeExports.jsx("div",{ref:r&&u===a?Le:null,"aria-hidden":b||void 0,className:U.cn("w-full shrink-0",l===1&&o.is_renderable!==!1&&"slide-element--single",b?"pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0":o.is_renderable===!1&&"hidden"),children:Ft(o,{replaceRootScreenHeightWithFull:l===1&&o.type==="html"&&o.is_renderable!==!1})},o.sequence_number??`${o.type}-${u}`)})})},Bt=t.useCallback(()=>{const e=ee.current;if(e){if(document.fullscreenElement===e){document.exitFullscreen().catch(()=>{});return}e.requestFullscreen?.().catch(()=>{})}},[]),lt=t.useCallback(()=>{const e=be.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[]),Lt=t.useCallback(()=>{te.current=!0,B.current=null,J(!0),v(!1),d(!0),K(),Ke()},[Ke,K,d]),Nt=t.useCallback(()=>{te.current=!0,B.current=null,J(!0),v(!1),d(!0),K(),I()},[I,K,d]),Vt=t.useCallback(e=>{if(!x||A){v(!1);return}v(e)},[x,A]),Ot=t.useCallback(e=>{const r=f[e]?.audioKey;if(!r||!m||r!==m)return;const l=g.findIndex(u=>u===r);if(l<0){N(null);return}const a=l+1,o=g[a];if(o){N(o);return}if(N(null),Ue(!0),v(!1),w){const u=c+1,b=L[u];tt&&b?.type==="interaction"&&(B.current=u),I()}},[f,w,c,m,g,I,tt,L]),Kt=t.useCallback(()=>{s&&ue(e=>!e)},[s]),ut=t.useCallback(e=>{e.stopPropagation(),_&&d(!0)},[De,d]),Dt=t.useCallback(e=>{qe?.(e)},[qe]),Ht=t.useCallback(()=>{J(!0),d(!0)},[d]),Ut=!!s&&le,fe=t.useMemo(()=>y.map((e,r)=>`${e.sequence_number??`${e.type}-${r}`}:${String(e.is_new??"")}`),[y]);return t.useEffect(()=>{const e=Ne.current,a=(e.length>0&&e.length<fe.length&&e.every((u,b)=>u===fe[b])?y.slice(e.length):[]).some(u=>u.is_new===!1);if(Ne.current=fe,!a)return;const o=window.requestAnimationFrame(()=>{const u=be.current,b=Le.current;if(!u||!b)return;const Wt=u.getBoundingClientRect(),$t=b.getBoundingClientRect(),zt=u.scrollTop+($t.top-Wt.top);u.scrollTo({top:Math.max(zt,0),behavior:"smooth"})});return()=>{window.cancelAnimationFrame(o)}},[y,fe]),t.useEffect(()=>{if(!te.current||(te.current=!1,y.length===0))return;const e=window.requestAnimationFrame(()=>{lt()});return()=>{window.cancelAnimationFrame(e)}},[y,lt]),n.jsxRuntimeExports.jsxs("section",{ref:ee,className:U.cn("relative h-full w-full",S&&"slide--mobile-device",V&&"slide--mobile-landscape",ze&&"slide--mobile-landscape-native",mt),onClick:Ht,onPointerDown:Dt,...pt,children:[Rt?n.jsxRuntimeExports.jsx("div",{"aria-hidden":"true",className:"pointer-events-none fixed left-0 top-0 z-[9999] h-[100vh] max-h-[100vh] w-[100vw]"}):null,n.jsxRuntimeExports.jsxs("div",{ref:Be,className:U.cn("slide__viewport relative h-full min-h-0 w-full",V&&"slide__viewport--mobile-landscape",V&&!St&&"slide__viewport--mobile-landscape-native"),children:[yt?n.jsxRuntimeExports.jsxs("div",{className:"slide-landscape-header",children:[n.jsxRuntimeExports.jsx("button",{"aria-label":h?.backAriaLabel??"Back",className:"slide-landscape-header__back",onClick:Mt,type:"button",children:n.jsxRuntimeExports.jsx(on.default,{className:"h-6 w-6 text-white",strokeWidth:2.25})}),h?.content?n.jsxRuntimeExports.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:h.content}):null]}):null,n.jsxRuntimeExports.jsx("div",{className:U.cn("h-full min-h-0 w-full",wt&&"slide__viewport-content--with-header",xt?"slide-content--single":"grid gap-4"),children:y.length>0?n.jsxRuntimeExports.jsx("div",{className:"slide-stage",children:n.jsxRuntimeExports.jsx("div",{ref:be,className:"slide-stage__layer w-full",children:Ct.map((e,r)=>{const l=r===jt;return n.jsxRuntimeExports.jsx("div",{"aria-hidden":!l||void 0,className:"w-full h-full",style:{display:l?void 0:"none"},children:qt(e.elementList,l)},e.sourceStepIndexes[0]??r)})})}):null}),vt?n.jsxRuntimeExports.jsx(Yt.default,{message:pe,className:"absolute left-1/2 top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2"}):null,n.jsxRuntimeExports.jsx(Zt.default,{onClose:_t,open:gt,text:It}),Ut?n.jsxRuntimeExports.jsx("div",{className:U.cn("slide-interaction-overlay",_&&E?"slide-interaction-overlay--with-player":"slide-interaction-overlay--standalone"),onClick:ut,onPointerDown:ut,style:kt,children:n.jsxRuntimeExports.jsx(dt,{content:String(s?.content??""),defaultButtonText:nt.buttonText??"",defaultInputText:nt.inputText??"",defaultSelectedValues:Tt,confirmButtonText:q?.confirmButtonText,copyButtonText:q?.copyButtonText,copiedButtonText:q?.copiedButtonText,onSend:Pt,readonly:st,title:q?.title??he??"Submit the content below to continue."})}):null,E?n.jsxRuntimeExports.jsx(Jt.default,{audioList:f,className:U.cn("absolute left-1/2 bottom-6 z-[2] -translate-x-1/2",W,!_&&"pointer-events-none opacity-0"),currentAudioIndex:C,defaultPlaying:!0,isPlaybackPaused:j,isAutoAdvanceEnabled:Ee,hasInteraction:!!s,isInteractionOpen:le,onAutoAdvanceToggle:He,onLoadingChange:Vt,nextDisabled:!w,onEnded:Ot,onFullscreen:Bt,isFullscreen:bt,mobileViewMode:M,settingsPortalContainer:Be.current,onMobileViewModeChange:At,onInteractionToggle:Kt,onNext:Nt,onPrev:Lt,prevDisabled:!ht,showControls:_,texts:je,customActionContext:Ie,customActions:F,useAutoAdvanceToggle:_e}):null]})]})};exports.default=cn;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../../_virtual/jsx-runtime.cjs.js"),t=require("react"),cn=require("../../lib/sandboxInteraction.cjs.js"),z=require("../../lib/utils.cjs.js"),an=require("../ui/loading-overlay-card.cjs.js"),dn=require("../ContentRender/ContentRender.cjs.js"),vt=require("../ContentRender/IframeSandbox.cjs.js");require("../ui/inputGroup/input-group.cjs.js");const Et=require("../../lib/interaction-defaults.cjs.js"),be=require("../../lib/mobileDevice.cjs.js"),fn=require("./Player.cjs.js"),mn=require("./SubtitleOverlay.cjs.js"),pn=require("./constants.cjs.js"),hn=require("./SlideFullscreenHint.cjs.js"),xn=require("./useSlide.cjs.js"),bn=require("./useWakePlayerFromIframe.cjs.js"),re=require("./utils/mobileScreenMode.cjs.js"),vn=require("./utils/interactionPlayback.cjs.js"),En=require("./utils/playbackSequence.cjs.js"),St=require("./utils/playerCustomActions.cjs.js"),Sn=require("./utils/playbackTimeStore.cjs.js"),yn=require("./utils/playerToggleMode.cjs.js");;/* empty css */const gn=require("../../markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs.js"),Rn=2e3,In=300,wn=160,An=16,yt=t.memo(({content:P,title:F,defaultButtonText:h,defaultInputText:$,defaultSelectedValues:x,confirmButtonText:O,copyButtonText:Y,copiedButtonText:ve,onSend:Ee,readonly:q=!1})=>r.jsxRuntimeExports.jsxs("div",{className:"slide-player__interaction-card",children:[r.jsxRuntimeExports.jsx("div",{className:"slide-player__interaction-header",children:r.jsxRuntimeExports.jsx("p",{className:"slide-player__interaction-title",children:F})}),r.jsxRuntimeExports.jsx("div",{className:"slide-player__interaction-body",children:r.jsxRuntimeExports.jsx(dn.default,{content:P,defaultButtonText:h,defaultInputText:$,defaultSelectedValues:x,confirmButtonText:O,copyButtonText:Y,copiedButtonText:ve,onSend:Ee,readonly:q,enableTypewriter:!1,sandboxMode:"content"})})]}));yt.displayName="InteractionOverlayCard";const _n=(P,F)=>P.length===F.length&&P.every((h,$)=>{const x=F[$];return h.sequence_number===x?.sequence_number&&h.type===x?.type&&h.content===x?.content}),Cn=({elementList:P=[],showPlayer:F=!0,playerAlwaysVisible:h=!1,playerClassName:$,fullscreenHeader:x,playerCustomActions:O,playerCustomActionPauseOnActive:Y=!0,bufferingText:ve="Buffering...",interactionTitle:Ee,interactionTexts:q,playerTexts:Be,playerAutoHideDelay:Se=3e3,markerAutoAdvanceDelay:Le=Rn,interactionDefaultValueOptions:se,onSend:Ne,onPlayerVisibilityChange:ye,onMobileViewModeChange:Ve,onStepChange:Ke,enableIframeScaling:gt=!0,className:Rt,onPointerDown:De,...It})=>{const oe=t.useRef(null),He=t.useRef(null),ge=t.useRef(null),Ue=t.useRef(null),G=t.useRef(null),X=t.useRef(null),J=t.useRef(null),Q=t.useRef(null),We=t.useRef(null),ze=t.useRef([]),le=t.useRef(!1),B=t.useRef(null),$e=t.useRef(null),{currentElementList:w,stepElementLists:Ye,slideElementList:L,currentIndex:a,audioList:d,currentAudioSequenceIndexes:ue,currentStepHasSpeakableElement:b,currentInteractionElement:c,canGoPrev:wt,canGoNext:A,handlePrev:Ge,handleNext:C}=xn.default(P),Z=t.useMemo(()=>{if(!(a<0))return L[a]},[a,L]),At=L.filter(e=>e.is_renderable!==!1).length===1,v=F&&(L.length>0||d.length>0||!!c),y=t.useMemo(()=>ue.map(e=>d[e]?.audioKey).filter(e=>!!e),[d,ue]),[Xe,ie]=t.useState(!0),[ce,ee]=t.useState(!1),[Re,Je]=t.useState(!0),[p,N]=t.useState(null),[_t,E]=t.useState(!1),[M,Qe]=t.useState(!1),[Ct,Ie]=t.useState(!1),[Ze,Mt]=t.useState(!0),[we,Ae]=t.useState(!1),[s,_e]=t.useState(),[ae,de]=t.useState(!1),[Tt,te]=t.useState(0),[kt,jt]=t.useState(!1),g=t.useMemo(()=>be.isMobileDevice(),[]),[fe,Ce]=t.useState(re.DEFAULT_MOBILE_VIEW_MODE),[et,Me]=t.useState(!1),[Te,tt]=t.useState(()=>g?be.isLandscapeViewport():!1),[Pt,me]=t.useState(!1),V=t.useMemo(()=>Sn.createPlaybackTimeStore(),[]),{effectiveMobileViewMode:T,isImmersiveMobileFullscreen:K,isNativeMobileFullscreen:nt,shouldRotateFullscreenViewport:Ft}=t.useMemo(()=>re.resolveMobileViewModeState({hasManualMobileViewMode:et,isMobileDevice:g,mobileViewMode:fe}),[et,g,Te,fe]),rt=t.useRef(T),R=v&&(h||Xe),Ot=K&&R,qt=K&&R,Bt=K||nt,Lt=Be?.fullscreenHintText??pn.DEFAULT_SLIDE_PLAYER_TEXTS.fullscreenHintText,Nt=t.useCallback(e=>{Me(!0),Ce(e)},[]),st=t.useCallback(()=>{Me(!1),Ce(re.DEFAULT_MOBILE_VIEW_MODE)},[]),Vt=t.useCallback(()=>{st(),x?.onBack?.()},[x,st]),Kt=t.useCallback(()=>{me(!1)},[]),ot=t.useCallback(e=>{Ae(e)},[]),lt=t.useCallback(()=>{Ae(e=>!e)},[]),{mountedStepStates:Dt,currentMountedStateIndex:Ht}=t.useMemo(()=>{const e=[],n=new Map;return Ye.forEach((o,i)=>{const l=e.findIndex(u=>_n(u.elementList,o));if(l>=0){e[l]?.sourceStepIndexes.push(i),n.set(i,l);return}e.push({elementList:o,sourceStepIndexes:[i]}),n.set(i,e.length-1)}),{mountedStepStates:e,currentMountedStateIndex:a>=0?n.get(a)??-1:-1}},[a,Ye]),ut=t.useMemo(()=>String(a),[a]),f=t.useMemo(()=>p?d.findIndex(e=>(e.audioKey??"")===p):-1,[d,p]),ke=t.useMemo(()=>f>=0?d[f]:void 0,[d,f]),Ut=ke?.element?.subtitle_cues??[],pe=t.useMemo(()=>y[0]??"none",[y]),je=t.useMemo(()=>({currentElement:St.resolvePlayerCustomActionElement({currentAudioIndex:f,currentAudioSequenceIndexes:ue,audioList:d,currentInteractionElement:s,currentStepElement:Z}),currentIndex:a,currentStepElement:Z,isActive:we,setActive:ot,toggleActive:lt}),[s,d,f,ue,a,Z,we,ot,lt]),Pe=t.useMemo(()=>St.getPlayerCustomActionCount(O,je),[je,O]),Wt=t.useMemo(()=>({"--slide-player-custom-action-count":String(Pe),"--slide-player-mobile-control-count":String(Pe+4)}),[Pe]),it=y.length>0,ct=t.useMemo(()=>c?`${c.sequence_number??"none"}:${String(c.content??"")}`:"none",[c]),ne=t.useMemo(()=>[ut,ct].join("|"),[ct,ut]),zt=t.useMemo(()=>[ne,ke?.audioKey??"none",String(f)].join("|"),[f,ke?.audioKey,ne]),at=!!t.useMemo(()=>!pe||pe==="none"?"":d.find(n=>n.audioKey===pe)?.audioUrl?.trim()??"",[d,pe]),k=Y&&!!O&&we,Fe=t.useMemo(()=>yn.shouldUseAutoAdvanceToggle({canGoNext:A,currentAudioIndex:f,currentStepHasSpeakableElement:b,hasInteraction:!!c}),[A,f,c,b]),j=t.useCallback(()=>{G.current!==null&&(window.clearTimeout(G.current),G.current=null)},[]),_=t.useCallback(()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},[]),I=t.useCallback(()=>{Q.current!==null&&(window.clearTimeout(Q.current),Q.current=null)},[]),D=t.useCallback(()=>{X.current!==null&&(window.clearTimeout(X.current),X.current=null)},[]),H=t.useCallback(()=>{D(),_(),I(),N(null),V.reset(),E(!1),Qe(!1),Ie(!1),_e(void 0),de(!1),te(0)},[D,_,I,V]),U=t.useCallback(()=>{const e=y[0];return e?(N(e),!0):!1},[y]),he=t.useCallback(()=>{_(),I(),de(!1),te(0),!U()&&A&&C()},[A,_,I,C,U]),dt=t.useCallback(e=>{if(I(),!e)return;const n=()=>{Q.current=null,te(wn),de(!0),B.current=null};Q.current=window.setTimeout(n,In)},[I]),m=t.useCallback((e=ce)=>{v&&(ie(!0),j(),!(h||!e||Se<=0)&&(G.current=window.setTimeout(()=>{ie(!1),G.current=null},Se)))},[j,ce,h,Se,v]),Oe=!!(c?.readonly||c?.user_input?.trim()),W=!!c&&!Oe;t.useEffect(()=>{Je(!0),Y&&Ae(!1)},[a,Y]),t.useEffect(()=>()=>{D(),j(),_(),I()},[D,_,I,j]),t.useEffect(()=>(ye?.(R),()=>{ye?.(!1)}),[ye,R]),t.useEffect(()=>{g||fe===re.DEFAULT_MOBILE_VIEW_MODE||(Me(!1),Ce(re.DEFAULT_MOBILE_VIEW_MODE))},[g,fe]),t.useEffect(()=>{if(!g){tt(!1);return}const e=()=>{tt(be.isLandscapeViewport())};return e(),be.subscribeMobileDeviceChange(e)},[g]),t.useEffect(()=>{Ve?.(T)},[T,Ve]),t.useEffect(()=>{const o=rt.current!=="fullscreen"&&T==="fullscreen"&&!Te;if(rt.current=T,!g){me(!1);return}if(o){me(!0);return}T!=="fullscreen"&&me(!1)},[T,g,Te]),t.useEffect(()=>{Ke?.(Z,a)},[a,Z,Ke]),t.useEffect(()=>{if(!v){j(),ie(!1);return}if(h){j(),ie(!0);return}ce||m(!0)},[j,ce,h,v,m]),t.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.origin===window.location.origin&&cn.isSandboxInteractionMessage(n.data)&&n.data.eventType==="click"&&v&&(ee(!0),m(!0))};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[v,m]),bn.default({sectionRef:oe,enabled:v,onWake:()=>{ee(!0),m(!0)}}),t.useEffect(()=>{const{hasPlaybackContextChanged:e,shouldInitializeAudioSequence:n}=En.getPlaybackSequenceTransition({previousResetKey:$e.current,nextResetKey:ne,currentAudioKey:p,hasCompletedCurrentStepAudio:M});$e.current=ne;const o=B.current===a&&!!c,i=vn.shouldPresentInteractionOverlay({hasInteraction:!!c,shouldBlockPlaybackForInteraction:W,shouldOpenInteractionOverlayAfterAudio:o,hasPlaybackContextChanged:e,hasResolvedCurrentInteraction:Oe,currentStepHasSpeakableElement:b});if(e&&H(),!(w.length===0&&!c)&&!k){if(c&&_e(c),i){dt(c);return}if(I(),B.current=null,!!n&&!U()){if(b){E(!0);return}if(A&&!(Fe&&!Re))return X.current=window.setTimeout(()=>{X.current=null,C()},Le),()=>{D()}}}},[A,D,w.length,c,p,ne,b,Le,C,M,Re,Oe,W,I,H,dt,U,k,Fe]),t.useEffect(()=>{if(k||!b||W){E(!1);return}if(M){E(!1);return}if(it){E(!1);return}E(!0)},[it,b,M,k,W]),t.useEffect(()=>{p||y.length===0||k||!b||W||M||U()},[p,y,b,M,k,W,U]),t.useEffect(()=>{!p||f>=0||N(null)},[f,p]),t.useEffect(()=>{f>=0||V.reset()},[f,V]),t.useEffect(()=>{Ie(!1)},[zt]);const ft=t.useMemo(()=>{if(!s)return{};const e=!!s.user_input?.trim();return Et.getInteractionDefaultValues(typeof s.content=="string"?s.content:void 0,s.user_input,e?void 0:se)},[s,se]),$t=t.useMemo(()=>{if(!s)return;const e=!!s.user_input?.trim();return Et.getInteractionDefaultSelectedValues(typeof s.content=="string"?s.content:void 0,s.user_input,e?void 0:se)},[s,se]),mt=!!s?.user_input?.trim(),pt=!!s?.readonly||mt,ht=pt||mt,qe=!!s&&ae,Yt=t.useCallback(e=>{const o=[...e.selectedValues??[],e.inputText?.trim()??"",e.buttonText?.trim()??""].filter(Boolean).join(", ");_e(i=>!i||!o?i:{...i,user_input:o}),Ne?.(e,s),he()},[s,he,Ne]);t.useEffect(()=>{const e=()=>{jt(document.fullscreenElement===oe.current)};return e(),document.addEventListener("fullscreenchange",e),()=>{document.removeEventListener("fullscreenchange",e)}},[]),t.useEffect(()=>{if(!qe){te(0);return}const e=We.current;if(!e)return;const n=()=>{const i=Math.ceil(e.getBoundingClientRect().height);te(i+An)};if(n(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(()=>{n()});return o.observe(e),()=>{o.disconnect()}},[qe]),t.useEffect(()=>{if(_(),!(!ae||!ht))return J.current=window.setTimeout(()=>{J.current=null,he()},2e3),()=>{_()}},[_,he,ae,ht]);const Gt=(e,n={})=>e?e.type==="slot"?r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:e.content}):e.type==="html"?r.jsxRuntimeExports.jsx(vt.default,{className:"content-render-iframe",hideFullScreen:!0,mode:"blackboard",replaceRootScreenHeightWithFull:n.replaceRootScreenHeightWithFull,type:"sandbox",content:e.content,enableScaling:gt}):r.jsxRuntimeExports.jsx(vt.default,{className:"content-render-iframe",hideFullScreen:!0,mode:"blackboard",type:"markdown",content:e.content}):null,Xt=(e=[],n=!1)=>{if(e.length===0)return null;const o=e.filter(l=>l.is_renderable!==!1).length,i=e.reduce((l,u,S)=>u.is_renderable!==!1?S:l,-1);return r.jsxRuntimeExports.jsx("div",{className:"slide-stage__content flex w-full flex-col gap-4",children:e.map((l,u)=>{const S=l.type==="html"&&l.is_renderable===!1;return r.jsxRuntimeExports.jsx("div",{ref:n&&u===i?Ue:null,"aria-hidden":S||void 0,className:z.cn("w-full shrink-0",o===1&&l.is_renderable!==!1&&"slide-element--single",S?"pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0":l.is_renderable===!1&&"hidden"),children:Gt(l,{replaceRootScreenHeightWithFull:o===1&&l.type==="html"&&l.is_renderable!==!1})},l.sequence_number??`${l.type}-${u}`)})})},Jt=t.useCallback(()=>{const e=oe.current;if(e){if(document.fullscreenElement===e){document.exitFullscreen().catch(()=>{});return}e.requestFullscreen?.().catch(()=>{})}},[]),xt=t.useCallback(()=>{const e=ge.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[]),Qt=t.useCallback(()=>{le.current=!0,B.current=null,ee(!0),E(!1),m(!0),H(),Ge()},[Ge,H,m]),Zt=t.useCallback(()=>{le.current=!0,B.current=null,ee(!0),E(!1),m(!0),H(),C()},[C,H,m]),en=t.useCallback(e=>{if(!b||M){E(!1);return}E(e)},[b,M]),tn=t.useCallback(e=>{const n=d[e]?.audioKey;if(!n||!p||n!==p)return;const o=y.findIndex(u=>u===n);if(o<0){N(null);return}const i=o+1,l=y[i];if(l){N(l);return}if(N(null),Qe(!0),E(!1),A){const u=a+1,S=L[u];at&&S?.type==="interaction"&&(B.current=u),C()}},[d,A,a,p,y,C,at,L]),nn=t.useCallback(()=>{s&&de(e=>!e)},[s]),bt=t.useCallback(e=>{e.stopPropagation(),R&&m(!0)},[Xe,m]),rn=t.useCallback(e=>{De?.(e)},[De]),sn=t.useCallback(()=>{ee(!0),m(!0)},[m]),xe=t.useMemo(()=>w.map((e,n)=>`${e.sequence_number??`${e.type}-${n}`}:${String(e.is_new??"")}`),[w]);return t.useEffect(()=>{const e=ze.current,i=(e.length>0&&e.length<xe.length&&e.every((u,S)=>u===xe[S])?w.slice(e.length):[]).some(u=>u.is_new===!1);if(ze.current=xe,!i)return;const l=window.requestAnimationFrame(()=>{const u=ge.current,S=Ue.current;if(!u||!S)return;const on=u.getBoundingClientRect(),ln=S.getBoundingClientRect(),un=u.scrollTop+(ln.top-on.top);u.scrollTo({top:Math.max(un,0),behavior:"smooth"})});return()=>{window.cancelAnimationFrame(l)}},[w,xe]),t.useEffect(()=>{if(!le.current||(le.current=!1,w.length===0))return;const e=window.requestAnimationFrame(()=>{xt()});return()=>{window.cancelAnimationFrame(e)}},[w,xt]),r.jsxRuntimeExports.jsxs("section",{ref:oe,className:z.cn("relative h-full w-full",g&&"slide--mobile-device",K&&"slide--mobile-landscape",nt&&"slide--mobile-landscape-native",Rt),onClick:sn,onPointerDown:rn,...It,children:[Bt?r.jsxRuntimeExports.jsx("div",{"aria-hidden":"true",className:"pointer-events-none fixed left-0 top-0 z-[9999] h-[100vh] max-h-[100vh] w-[100vw]"}):null,r.jsxRuntimeExports.jsxs("div",{ref:He,className:z.cn("slide__viewport relative h-full min-h-0 w-full",K&&"slide__viewport--mobile-landscape",K&&!Ft&&"slide__viewport--mobile-landscape-native"),children:[Ot?r.jsxRuntimeExports.jsxs("div",{className:"slide-landscape-header",children:[r.jsxRuntimeExports.jsx("button",{"aria-label":x?.backAriaLabel??"Back",className:"slide-landscape-header__back",onClick:Vt,type:"button",children:r.jsxRuntimeExports.jsx(gn.default,{className:"h-6 w-6 text-white",strokeWidth:2.25})}),x?.content?r.jsxRuntimeExports.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:x.content}):null]}):null,r.jsxRuntimeExports.jsx("div",{className:z.cn("h-full min-h-0 w-full",qt&&"slide__viewport-content--with-header",At?"slide-content--single":"grid gap-4"),children:w.length>0?r.jsxRuntimeExports.jsx("div",{className:"slide-stage",children:r.jsxRuntimeExports.jsx("div",{ref:ge,className:"slide-stage__layer w-full",children:Dt.map((e,n)=>{const o=n===Ht;return r.jsxRuntimeExports.jsx("div",{"aria-hidden":!o||void 0,className:"w-full h-full",style:{display:o?void 0:"none"},children:Xt(e.elementList,o)},e.sourceStepIndexes[0]??n)})})}):null}),_t?r.jsxRuntimeExports.jsx(an.default,{message:ve,className:"absolute left-1/2 top-1/2 z-[3] -translate-x-1/2 -translate-y-1/2"}):null,r.jsxRuntimeExports.jsx(hn.default,{onClose:Kt,open:Pt,text:Lt}),r.jsxRuntimeExports.jsx(mn.default,{extraBottomOffset:Tt,hasPlayerGap:R,isEnabled:Ze&&Ct,isPlayerHidden:v&&!R,playbackTimeStore:V,subtitleCues:Ut}),qe?r.jsxRuntimeExports.jsx("div",{ref:We,className:z.cn("slide-interaction-overlay",R&&v?"slide-interaction-overlay--with-player":"slide-interaction-overlay--standalone"),onClick:bt,onPointerDown:bt,style:Wt,children:r.jsxRuntimeExports.jsx(yt,{content:String(s?.content??""),defaultButtonText:ft.buttonText??"",defaultInputText:ft.inputText??"",defaultSelectedValues:$t,confirmButtonText:q?.confirmButtonText,copyButtonText:q?.copyButtonText,copiedButtonText:q?.copiedButtonText,onSend:Yt,readonly:pt,title:q?.title??Ee??"Submit the content below to continue."})}):null,v?r.jsxRuntimeExports.jsx(fn.default,{audioList:d,className:z.cn("absolute left-1/2 bottom-6 z-[2] -translate-x-1/2",$,!R&&"pointer-events-none opacity-0"),currentAudioIndex:f,defaultPlaying:!0,isPlaybackPaused:k,isAutoAdvanceEnabled:Re,hasInteraction:!!s,isInteractionOpen:ae,isSubtitleEnabled:Ze,onAutoAdvanceToggle:Je,onLoadingChange:en,onPlaybackStarted:()=>{Ie(!0)},onPlaybackTimeChange:V.setTime,onSubtitleToggle:()=>{Mt(e=>!e)},nextDisabled:!A,onEnded:tn,onFullscreen:Jt,isFullscreen:kt,mobileViewMode:T,settingsPortalContainer:He.current,onMobileViewModeChange:Nt,onInteractionToggle:nn,onNext:Zt,onPrev:Qt,prevDisabled:!wt,showControls:R,texts:Be,customActionContext:je,customActions:O,useAutoAdvanceToggle:Fe}):null]})]})};exports.default=Cn;
2
2
  //# sourceMappingURL=Slide.cjs.js.map