markdown-flow-ui 0.1.125 → 0.1.126

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 (29) hide show
  1. package/dist/_virtual/index.cjs8.js +1 -1
  2. package/dist/_virtual/index.cjs9.js +1 -1
  3. package/dist/_virtual/index.es8.js +2 -2
  4. package/dist/_virtual/index.es9.js +2 -2
  5. package/dist/components/Slide/Player.cjs.js +1 -1
  6. package/dist/components/Slide/Player.cjs.js.map +1 -1
  7. package/dist/components/Slide/Player.d.ts +2 -0
  8. package/dist/components/Slide/Player.es.js +112 -107
  9. package/dist/components/Slide/Player.es.js.map +1 -1
  10. package/dist/components/Slide/Slide.cjs.js +1 -1
  11. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  12. package/dist/components/Slide/Slide.es.js +167 -165
  13. package/dist/components/Slide/Slide.es.js.map +1 -1
  14. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js +1 -1
  15. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js.map +1 -1
  16. package/dist/components/Slide/useWakePlayerFromIframe.d.ts +3 -1
  17. package/dist/components/Slide/useWakePlayerFromIframe.es.js +42 -39
  18. package/dist/components/Slide/useWakePlayerFromIframe.es.js.map +1 -1
  19. package/dist/components/Slide/utils/playerNavigationContext.cjs.js +2 -0
  20. package/dist/components/Slide/utils/playerNavigationContext.cjs.js.map +1 -0
  21. package/dist/components/Slide/utils/playerNavigationContext.d.ts +7 -0
  22. package/dist/components/Slide/utils/playerNavigationContext.es.js +9 -0
  23. package/dist/components/Slide/utils/playerNavigationContext.es.js.map +1 -0
  24. package/dist/components/Slide/utils/playerNavigationContext.test.d.ts +1 -0
  25. package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
  26. package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  27. package/dist/node_modules/classnames/index.cjs.js +1 -1
  28. package/dist/node_modules/classnames/index.es.js +1 -1
  29. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
2
2
  //# sourceMappingURL=index.cjs8.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
2
2
  //# sourceMappingURL=index.cjs9.js.map
@@ -1,5 +1,5 @@
1
- var r = {};
1
+ var s = { exports: {} };
2
2
  export {
3
- r as __exports
3
+ s as __module
4
4
  };
5
5
  //# sourceMappingURL=index.es8.js.map
@@ -1,5 +1,5 @@
1
- var s = { exports: {} };
1
+ var r = {};
2
2
  export {
3
- s as __module
3
+ r as __exports
4
4
  };
5
5
  //# sourceMappingURL=index.es9.js.map
@@ -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"),tt=require("../../lib/utils.cjs.js"),jt=require("./MobilePlayerSettingsSheet.cjs.js"),Ct=require("./constants.cjs.js"),wt=require("./utils/mobileScreenMode.cjs.js"),Mt=require("./utils/audioCompletion.cjs.js"),Lt=require("./utils/playerKeyboardShortcutContext.cjs.js"),ee=require("./utils/playerKeyboardShortcuts.cjs.js"),At=require("./utils/playbackSource.cjs.js"),Nt=require("./utils/playbackPreference.cjs.js"),vt=require("./utils/playerCustomActions.cjs.js");;/* empty css */const qt=require("../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.js"),Tt=require("../../node_modules/lucide-react/dist/esm/icons/volume-2.cjs.js"),Kt=require("../../node_modules/lucide-react/dist/esm/icons/captions.cjs.js"),Pt=require("../../node_modules/lucide-react/dist/esm/icons/captions-off.cjs.js"),Ut=require("../../node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js"),Ft=require("../../node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js"),Wt=require("../../node_modules/lucide-react/dist/esm/icons/scan-line.cjs.js"),Ot=require("../../node_modules/lucide-react/dist/esm/icons/maximize.cjs.js"),Bt=require("../../node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs.js"),rt=new Map,nt=R=>{if(typeof window>"u"||!R||rt.has(R))return;const j=window.document.createElement("audio");j.preload="auto",j.setAttribute("playsinline","true"),j.src=R,j.load(),rt.set(R,j)},Vt=()=>n.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[n.jsxRuntimeExports.jsx("path",{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",fill:"#0A0A0A"}),n.jsxRuntimeExports.jsx("path",{d:"M12 10H16V24H12V10ZM18 10H22V24H18V10Z",fill:"white"})]}),Ht=()=>n.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[n.jsxRuntimeExports.jsx("path",{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",fill:"#0A0A0A"}),n.jsxRuntimeExports.jsx("path",{d:"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z",fill:"white"})]}),D={fullscreen:"F",next:"→",notes:"N",playback:"Space",previous:"←",subtitle:"C"},$t=(R,j)=>R?`${R} (${j})`:j,Zt=({audioList:R=[],className:j,currentAudioIndex:m=-1,defaultPlaying:b=!0,isPlaybackPaused:v=!1,isAutoAdvanceEnabled:U=!0,useAutoAdvanceToggle:L=!1,onLoadingChange:ke,onPlaybackPreferenceChange:Re,onPlaybackStarted:Ee,onPlaybackTimeChange:te,onSubtitleToggle:X,onPrev:re,onNext:ne,onFullscreen:G,isFullscreen:ge=!1,mobileViewMode:st=wt.DEFAULT_MOBILE_VIEW_MODE,settingsPortalContainer:at,onMobileViewModeChange:_e,onEnded:je,onAutoAdvanceToggle:Ce,onInteractionToggle:ue,hasInteraction:fe=!1,isInteractionOpen:J=!1,isSubtitleEnabled:de=!0,prevDisabled:me=!1,nextDisabled:pe=!1,showControls:ye=!0,enableKeyboardShortcuts:lt=!0,customActions:we,customActionContext:Me,texts:Le,onFocusCapture:Ae,onPointerDown:Ne,...ct})=>{const ot=t.useId(),ve=t.useContext(Lt.PlayerKeyboardShortcutContext),p=t.useRef(null),qe=t.useRef(J),q=t.useRef(null),Te=t.useRef(null),C=t.useRef(0),c=t.useRef(null),se=t.useRef(void 0),A=t.useRef([]),ae=t.useRef(L?U:b),Q=t.useRef(!1),Ke=t.useRef(!1),y=t.useRef(!1),T=t.useRef(null),H=t.useRef(null),x=t.useRef(!1),a=t.useRef(!1),h=t.useRef(null),w=t.useRef(!1),F=t.useRef(null),he=t.useRef(0),K=t.useRef("unknown"),[le,i]=t.useState(b),[Pe,$]=t.useState(!1),W=ve?.ownerId??ot,N=lt&&(ve?.enabled??!0),f=m>=0?R[m]:void 0,O=f?.audioUrl,E=t.useMemo(()=>[...f?.audioSegments??[]].sort((e,r)=>e.segment_index-r.segment_index),[f?.audioSegments]),Ue=t.useMemo(()=>vt.toPlayerCustomActionList(we,Me),[Me,we]),Fe=Ue.length+5,it=t.useMemo(()=>({"--slide-player-mobile-control-count":String(Fe)}),[Fe]),l=t.useMemo(()=>({...Ct.DEFAULT_SLIDE_PLAYER_TEXTS,...Le}),[Le]),be=t.useMemo(()=>f?f.audioKey??`${String(f.sequenceNumber??"none")}:${String(f.audioUrl??"")}`:"none",[f]),ft=L?U:le,We=L?U?l.pauseAutoplayLabel:l.playAutoplayLabel:le?l.pauseLabel:l.playLabel,Oe=ge?l.exitFullscreenLabel:l.enterFullscreenLabel,Z=t.useCallback((e,r,s)=>({ariaKeyShortcuts:N?s:void 0,title:N?$t(e,r):e}),[N]),Be=Z(l.subtitleToggleAriaLabel,D.subtitle,"c"),Ve=Z(l.previousLabel,D.previous,"ArrowLeft"),He=Z(We,D.playback,"Space"),$e=Z(l.nextLabel,D.next,"ArrowRight"),Ze=Z(Oe,D.fullscreen,"f"),ze=Z(l.notesLabel,D.notes,"n"),ce=t.useCallback(()=>{N&&ee.activatePlayerKeyboardShortcutOwner(W)},[W,N]),dt=t.useCallback(e=>{ce(),Ne?.(e)},[ce,Ne]),mt=t.useCallback(e=>{ce(),Ae?.(e)},[ce,Ae]);t.useEffect(()=>{se.current=f},[f]),t.useEffect(()=>{ae.current=L?U:b},[b,U,L]),t.useEffect(()=>{ye||$(!1)},[ye]),t.useEffect(()=>{!qe.current&&J&&$(!1),qe.current=J},[J]),t.useEffect(()=>{A.current=E},[E]),t.useEffect(()=>{const e=f?.audioUrl,r=m>=0?R[m+1]?.audioUrl:void 0;nt(e),nt(r)},[R,f?.audioUrl,m]);const u=t.useCallback((e,r=null)=>{Ke.current===e&&(!e||r===null)||(Ke.current=e,ke?.({loading:e,reason:e?r:null}))},[ke]),B=t.useCallback(e=>{ae.current=e,Re?.(e)},[Re]),I=t.useCallback(()=>L?{shouldContinuePlayback:ae.current}:{shouldContinuePlayback:Nt.shouldKeepPlayingAfterNavigation({defaultPlaying:ae.current,isPausedByUser:y.current})},[L]),Ye=t.useCallback(e=>e instanceof DOMException?e.name==="NotAllowedError"||e.name==="SecurityError":!1,[]),P=t.useCallback(()=>b&&!v&&!y.current&&K.current!=="blocked",[b,v]),De=t.useCallback(e=>e?e.startsWith("data:")?e:`data:audio/mpeg;base64,${e}`:"",[]),Xe=t.useCallback(()=>{const e=c.current;return e==null||e<=0?0:A.current.slice(0,e).reduce((r,s)=>r+Math.max(Number(s.duration_ms??0),0),0)/1e3},[]),V=t.useCallback(e=>e<=0?0:A.current.slice(0,e).reduce((r,s)=>r+Math.max(Number(s.duration_ms??0),0),0),[]),Ge=t.useCallback(()=>{const e=p.current;return e?T.current==="segment"?V(C.current)+Math.max(e.currentTime,0)*1e3:h.current!==null&&e.readyState===0?h.current*1e3:Math.max(e.currentTime,0)*1e3:c.current!=null?V(c.current):0},[V]),S=t.useCallback(e=>{const r=Math.max(e,0);he.current!==r&&(he.current=r,te?.(r))},[te]),o=t.useCallback(()=>{S(Ge())},[Ge,S]),d=t.useCallback(()=>{typeof window>"u"||F.current===null||(window.cancelAnimationFrame(F.current),F.current=null)},[]),Je=t.useCallback(()=>{if(typeof window>"u"||F.current!==null)return;const e=()=>{o();const r=p.current;if(!r||r.paused||r.ended){F.current=null;return}F.current=window.requestAnimationFrame(e)};F.current=window.requestAnimationFrame(e)},[o]),z=t.useCallback(()=>{const e=p.current;e&&(d(),a.current=!1,y.current=!1,Q.current=!1,T.current=null,h.current=null,x.current=!1,w.current=!1,H.current=null,e.pause(),e.removeAttribute("src"),e.load(),q.current=null,C.current=0,c.current=null,S(0),i(!1),u(!1))},[S,d,u]),g=t.useCallback(e=>{const r=p.current;if(!r)return!1;const s=r.play();return s&&typeof s.then=="function"&&s.then(()=>{K.current==="unknown"&&(K.current="auto"),a.current=!1,w.current=!1}).catch(k=>{K.current==="unknown"&&Ye(k)&&(K.current="blocked",a.current=!1,u(!1)),w.current=!1,i(!1)}),!0},[Ye,u]),M=t.useCallback((e,r)=>{const s=p.current,k=A.current[e];if(!s||!k)return!1;const _=De(k.audio_data);C.current=e,c.current=null,x.current=!1,w.current=!0,H.current="segment",S(V(e));const ie=P();a.current=ie,u(!1);const _t=q.current!==_;return T.current="segment",_t&&(s.pause(),s.removeAttribute("src"),s.load(),q.current=_,s.src=_,s.load()),h.current=0,s.readyState>0&&(s.currentTime=0,h.current=null),ie?g(`start-segment:${r}`):(a.current=!1,w.current=!1,s.pause(),i(!1),!0)},[P,De,V,S,g,u]),Y=t.useCallback(e=>{d(),a.current=!1,x.current=!1,w.current=!1,o(),i(!1),u(!1),m>=0&&je?.(m)},[m,je,d,o,u]),oe=t.useCallback(e=>{const r=p.current;return!r||T.current!=="url"||!Mt.hasReachedAudioEnd({currentTimeSeconds:Math.max(r.currentTime,0),durationSeconds:r.duration})?!1:(a.current=!1,r.pause(),Y(e),!0)},[Y]),Qe=t.useCallback(()=>{const e=C.current+1,r=A.current,s=r[e],k=se.current,_=r.some(ie=>ie.is_final);if(s){M(e,"ended");return}if(k?.isAudioStreaming||!_){C.current=e,c.current=e,x.current=!0,a.current=b,S(V(e)),i(!1),u(!0,"waitingForMoreAudio");return}Y("segments-completed")},[b,Y,V,S,M,u]);t.useEffect(()=>{if(Te.current===be)return;Te.current=be,C.current=0,c.current=null,x.current=!1,y.current=!1,Q.current=!1,a.current=!1,w.current=!1,T.current=null,H.current=null,q.current=null,d(),S(0),u(!1);const e=p.current;e&&(e.pause(),e.removeAttribute("src"),e.load(),i(!1))},[m,be,E.length,O,S,d,u]),t.useEffect(()=>{const e=p.current;if(e){if(v){Q.current=!!(se.current&&!y.current&&(!e.paused||a.current||c.current!==null)),a.current=!1,u(!1),e.pause(),i(!1);return}if(!(!Q.current||!se.current||y.current)){if(Q.current=!1,c.current!==null){if(c.current<A.current.length){M(c.current,"external-resume");return}a.current=!0,u(!0,"waitingForMoreAudio");return}if(!q.current&&A.current.length>0){M(Math.min(C.current,A.current.length-1),"external-resume-init");return}e.paused&&(a.current=!0,g("external-resume"))}}},[v,M,g,u]),t.useEffect(()=>{const e=p.current;if(!e)return;if(!f){z();return}if(v){a.current=!1,u(!1),e.pause(),i(!1);return}const r=At.resolveAudioPlaybackSourceType({activeSourceType:T.current,hasAudioUrl:!!O,segmentCount:E.length,preferredSourceType:H.current,waitingSegmentIndex:c.current});if(r&&H.current!==r&&(H.current=r),r==="url"&&O){const s=q.current!==O,k=P();if(s){const _=c.current!==null?Xe():0;e.pause(),e.removeAttribute("src"),e.load(),q.current=O,T.current="url",e.src=O,e.load(),h.current=_,S(_*1e3),e.readyState>0&&(e.currentTime=_,h.current=null)}if(a.current=k,x.current=!1,w.current=!1,u(!1),!k){a.current=!1,e.pause(),i(!1);return}g(s?"sync-url-init":"sync-url");return}if(r==="segment"&&c.current!==null){if(c.current<E.length){if(y.current){i(!1),u(!1);return}M(c.current,"wait-resume");return}x.current=!0,a.current=P(),i(!1),u(P());return}if(r==="segment"&&!E.length){if(f.isAudioStreaming){c.current=C.current,x.current=!0,a.current=P(),i(!1),u(P());return}z();return}if(r==="segment"&&!q.current){M(Math.min(C.current,E.length-1),"effect-init");return}if(r!=="segment"){z();return}if(!b||y.current){a.current=!1,e.pause(),i(!1);return}e.paused&&(a.current=!0,g("sync-paused-retry"))},[f,m,E,O,b,v,P,S,z,M,g,Xe,u]),t.useEffect(()=>z,[z]),t.useEffect(()=>d,[d]);const pt=t.useCallback(()=>{o(),Je(),i(!0),u(!1),Ee?.()},[Ee,Je,o,u]),yt=t.useCallback(()=>{x.current||w.current||(d(),o(),i(!1))},[m,d,o]),ht=t.useCallback(()=>{const e=p.current;e&&h.current!==null&&(e.currentTime=h.current,h.current=null),o(),!oe("canplay-seek-finished")&&(!a.current||!b||g("canplay"))},[m,b,oe,o,g]),bt=t.useCallback(()=>{const e=p.current;e&&h.current!==null&&(e.currentTime=h.current,h.current=null),o(),oe("metadata-seek-finished")},[m,oe,o]),xt=t.useCallback(()=>{o()},[o]),St=t.useCallback(()=>{x.current||u(!0,"loadingAudio")},[u]),kt=t.useCallback(()=>{if(x.current){u(!0,"waitingForMoreAudio");return}u(!0,"loadingAudio")},[u]),Ie=t.useCallback(()=>{o()},[o]),Rt=t.useCallback(()=>{const e=T.current==="url"||A.current.length===0;if(d(),w.current=!1,e){Y("url-ended");return}Qe()},[Y,Qe,d]),Et=t.useCallback(()=>{d(),o(),i(!1),u(!1)},[d,o,u]),gt=t.useCallback(e=>{_e?.(e),$(!1)},[_e]),xe=t.useCallback(()=>{if(L){const r=!U;return B(r),Ce?.(r),!0}const e=p.current;return v||!e||!f?!1:c.current!==null?le?(B(!1),a.current=!1,y.current=!0,c.current=null,x.current=!1,i(!1),u(!1),e.pause(),!0):(B(!0),K.current="manual",y.current=!1,a.current=!0,u(!0,"waitingForMoreAudio"),!0):!e.src&&E.length>0?(B(!0),K.current="manual",y.current=!1,M(Math.min(C.current,E.length-1),"toggle"),!0):e.paused?(B(!0),K.current="manual",y.current=!1,a.current=!0,g("toggle-resume"),!0):(B(!1),a.current=!1,y.current=!0,e.pause(),!0)},[f,E.length,U,v,le,Ce,M,g,u,B,L]);t.useEffect(()=>{if(N)return ee.registerPlayerKeyboardShortcutOwner(W)},[W,N]);const Se=t.useMemo(()=>({fullscreen:()=>G?(G(),!0):!1,interaction:()=>ue?(fe&&ue(),!0):!1,next:()=>ne?(pe||ne(I()),!0):!1,previous:()=>re?(me||re(I()),!0):!1,subtitle:()=>X?(X(),!0):!1,togglePlayback:()=>(xe(),!0)}),[I,fe,pe,G,ue,ne,re,X,me,xe]),et=t.useRef(Se);return t.useEffect(()=>{et.current=Se},[Se]),t.useEffect(()=>{if(!N||typeof document>"u")return;const e=r=>{if(!ee.isActivePlayerKeyboardShortcutOwner(W))return;const s=ee.getPlayerKeyboardShortcutAction(r);if(!s||ee.shouldIgnorePlayerKeyboardShortcutEvent(r,s))return;let k=!1;const _=et.current[s];k=_(),k&&r.preventDefault()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[W,N]),t.useEffect(()=>{te?.(he.current)},[te]),n.jsxRuntimeExports.jsxs("div",{...ct,"data-slide-player-shortcut-owner":W,className:tt.cn("slide-player",j),onFocusCapture:mt,onPointerDown:dt,children:[n.jsxRuntimeExports.jsx("audio",{ref:p,preload:"auto",playsInline:!0,onLoadStart:St,onLoadedMetadata:bt,onCanPlay:ht,onPlay:pt,onPause:yt,onWaiting:kt,onSeeking:Ie,onSeeked:Ie,onTimeUpdate:xt,onEnded:Rt,onError:Et}),ye?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(jt.default,{container:at,labels:{closeSettings:l.closeSettingsLabel,fullscreen:l.fullscreenLabel,nonFullscreen:l.nonFullscreenLabel,screen:l.screenLabel,screenMode:l.screenModeLabel,subtitle:l.subtitleLabel,subtitleToggle:l.subtitleToggleAriaLabel,title:l.settingsTitle},isSubtitleEnabled:de,onClose:()=>$(!1),onOpenChange:$,onSubtitleToggle:X??(()=>{}),onViewModeChange:gt,open:Pe,viewMode:st}),n.jsxRuntimeExports.jsxs("div",{className:"slide-player__controls",style:it,children:[n.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[n.jsxRuntimeExports.jsx("button",{"aria-expanded":Pe,"aria-haspopup":"dialog","aria-label":l.moreOptionsAriaLabel,className:"slide-player__action slide-player__action--mobile-more",onClick:()=>{$(e=>!e)},type:"button",children:n.jsxRuntimeExports.jsx(qt.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":l.volumeAriaLabel,className:"hidden",type:"button",children:n.jsxRuntimeExports.jsx(Tt.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":l.subtitleToggleAriaLabel,"aria-keyshortcuts":Be.ariaKeyShortcuts,"aria-pressed":de,className:"slide-player__action slide-player__action--subtitle",onClick:X,title:Be.title,type:"button",children:de?n.jsxRuntimeExports.jsx(Kt.default,{className:"slide-player__icon",strokeWidth:2.25}):n.jsxRuntimeExports.jsx(Pt.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-keyshortcuts":Ve.ariaKeyShortcuts,"aria-label":l.previousLabel,className:"slide-player__action slide-player__action--prev",disabled:me,onClick:()=>{re?.(I())},title:Ve.title,type:"button",children:n.jsxRuntimeExports.jsx(Ut.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":We,"aria-keyshortcuts":He.ariaKeyShortcuts,className:"slide-player__toggle slide-player__toggle--playback",onClick:()=>{xe()},title:He.title,type:"button",children:ft?n.jsxRuntimeExports.jsx(Vt,{}):n.jsxRuntimeExports.jsx(Ht,{})}),n.jsxRuntimeExports.jsx("button",{"aria-keyshortcuts":$e.ariaKeyShortcuts,"aria-label":l.nextLabel,className:"slide-player__action slide-player__action--next",disabled:pe,onClick:()=>{ne?.(I())},title:$e.title,type:"button",children:n.jsxRuntimeExports.jsx(Ft.default,{className:"slide-player__icon",strokeWidth:2.25})}),G?n.jsxRuntimeExports.jsx("button",{"aria-label":Oe,"aria-keyshortcuts":Ze.ariaKeyShortcuts,className:"slide-player__action slide-player__action--fullscreen",onClick:G,title:Ze.title,type:"button",children:ge?n.jsxRuntimeExports.jsx(Wt.default,{className:"slide-player__icon",strokeWidth:2.25}):n.jsxRuntimeExports.jsx(Ot.default,{className:"slide-player__icon",strokeWidth:2.25})}):null]}),n.jsxRuntimeExports.jsx("div",{className:"slide-player__separator"}),n.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[Ue.map((e,r)=>n.jsxRuntimeExports.jsx(t.Fragment,{children:e},`custom-action-${r}`)),n.jsxRuntimeExports.jsx("button",{"aria-label":l.notesLabel,"aria-keyshortcuts":ze.ariaKeyShortcuts,className:tt.cn("slide-player__action slide-player__action--notes",J&&"slide-player__action--active"),disabled:!fe,onClick:ue,title:ze.title,type:"button",children:n.jsxRuntimeExports.jsx(Bt.default,{className:"slide-player__icon",strokeWidth:2.25})})]})]})]}):null]})},ut=t.memo(Zt);ut.displayName="Player";exports.default=ut;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../../_virtual/jsx-runtime.cjs.js"),t=require("react"),tt=require("../../lib/utils.cjs.js"),Ct=require("./MobilePlayerSettingsSheet.cjs.js"),wt=require("./constants.cjs.js"),Mt=require("./utils/mobileScreenMode.cjs.js"),Lt=require("./utils/audioCompletion.cjs.js"),At=require("./utils/playerKeyboardShortcutContext.cjs.js"),ee=require("./utils/playerKeyboardShortcuts.cjs.js"),Nt=require("./utils/playbackSource.cjs.js"),vt=require("./utils/playbackPreference.cjs.js"),qt=require("./utils/playerCustomActions.cjs.js"),rt=require("./utils/playerNavigationContext.cjs.js");;/* empty css */const Tt=require("../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.js"),Kt=require("../../node_modules/lucide-react/dist/esm/icons/volume-2.cjs.js"),Pt=require("../../node_modules/lucide-react/dist/esm/icons/captions.cjs.js"),Ut=require("../../node_modules/lucide-react/dist/esm/icons/captions-off.cjs.js"),Ft=require("../../node_modules/lucide-react/dist/esm/icons/rotate-ccw.cjs.js"),Wt=require("../../node_modules/lucide-react/dist/esm/icons/rotate-cw.cjs.js"),Ot=require("../../node_modules/lucide-react/dist/esm/icons/scan-line.cjs.js"),Bt=require("../../node_modules/lucide-react/dist/esm/icons/maximize.cjs.js"),Vt=require("../../node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs.js"),nt=new Map,st=R=>{if(typeof window>"u"||!R||nt.has(R))return;const j=window.document.createElement("audio");j.preload="auto",j.setAttribute("playsinline","true"),j.src=R,j.load(),nt.set(R,j)},Ht=()=>n.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[n.jsxRuntimeExports.jsx("path",{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",fill:"#0A0A0A"}),n.jsxRuntimeExports.jsx("path",{d:"M12 10H16V24H12V10ZM18 10H22V24H18V10Z",fill:"white"})]}),$t=()=>n.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",children:[n.jsxRuntimeExports.jsx("path",{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",fill:"#0A0A0A"}),n.jsxRuntimeExports.jsx("path",{d:"M13.3333 10L23.3333 16.6667L13.3333 23.3333V10Z",fill:"white"})]}),D={fullscreen:"F",next:"→",notes:"N",playback:"Space",previous:"←",subtitle:"C"},Zt=(R,j)=>R?`${R} (${j})`:j,zt=({audioList:R=[],className:j,currentAudioIndex:m=-1,defaultPlaying:b=!0,isPlaybackPaused:v=!1,isAutoAdvanceEnabled:U=!0,useAutoAdvanceToggle:L=!1,onLoadingChange:Se,onPlaybackPreferenceChange:Re,onPlaybackStarted:ge,onPlaybackTimeChange:te,onSubtitleToggle:X,onPrev:re,onNext:ne,onFullscreen:G,isFullscreen:Ee=!1,mobileViewMode:at=Mt.DEFAULT_MOBILE_VIEW_MODE,settingsPortalContainer:lt,onMobileViewModeChange:_e,onEnded:je,onAutoAdvanceToggle:Ce,onInteractionToggle:se,hasInteraction:fe=!1,isInteractionOpen:J=!1,isSubtitleEnabled:de=!0,prevDisabled:me=!1,nextDisabled:pe=!1,showControls:ye=!0,enableKeyboardShortcuts:ct=!0,customActions:we,customActionContext:Me,texts:Le,onFocusCapture:Ae,onPointerDown:Ne,...ot})=>{const it=t.useId(),ve=t.useContext(At.PlayerKeyboardShortcutContext),p=t.useRef(null),qe=t.useRef(J),q=t.useRef(null),Te=t.useRef(null),C=t.useRef(0),c=t.useRef(null),ue=t.useRef(void 0),A=t.useRef([]),ae=t.useRef(L?U:b),Q=t.useRef(!1),Ke=t.useRef(!1),y=t.useRef(!1),T=t.useRef(null),H=t.useRef(null),x=t.useRef(!1),a=t.useRef(!1),h=t.useRef(null),w=t.useRef(!1),F=t.useRef(null),he=t.useRef(0),K=t.useRef("unknown"),[le,i]=t.useState(b),[Pe,$]=t.useState(!1),W=ve?.ownerId??it,N=ct&&(ve?.enabled??!0),f=m>=0?R[m]:void 0,O=f?.audioUrl,g=t.useMemo(()=>[...f?.audioSegments??[]].sort((e,r)=>e.segment_index-r.segment_index),[f?.audioSegments]),Ue=t.useMemo(()=>qt.toPlayerCustomActionList(we,Me),[Me,we]),Fe=Ue.length+5,ft=t.useMemo(()=>({"--slide-player-mobile-control-count":String(Fe)}),[Fe]),l=t.useMemo(()=>({...wt.DEFAULT_SLIDE_PLAYER_TEXTS,...Le}),[Le]),be=t.useMemo(()=>f?f.audioKey??`${String(f.sequenceNumber??"none")}:${String(f.audioUrl??"")}`:"none",[f]),dt=L?U:le,We=L?U?l.pauseAutoplayLabel:l.playAutoplayLabel:le?l.pauseLabel:l.playLabel,Oe=Ee?l.exitFullscreenLabel:l.enterFullscreenLabel,Z=t.useCallback((e,r,u)=>({ariaKeyShortcuts:N?u:void 0,title:N?Zt(e,r):e}),[N]),Be=Z(l.subtitleToggleAriaLabel,D.subtitle,"c"),Ve=Z(l.previousLabel,D.previous,"ArrowLeft"),He=Z(We,D.playback,"Space"),$e=Z(l.nextLabel,D.next,"ArrowRight"),Ze=Z(Oe,D.fullscreen,"f"),ze=Z(l.notesLabel,D.notes,"n"),ce=t.useCallback(()=>{N&&ee.activatePlayerKeyboardShortcutOwner(W)},[W,N]),mt=t.useCallback(e=>{ce(),Ne?.(e)},[ce,Ne]),pt=t.useCallback(e=>{ce(),Ae?.(e)},[ce,Ae]);t.useEffect(()=>{ue.current=f},[f]),t.useEffect(()=>{ae.current=L?U:b},[b,U,L]),t.useEffect(()=>{ye||$(!1)},[ye]),t.useEffect(()=>{!qe.current&&J&&$(!1),qe.current=J},[J]),t.useEffect(()=>{A.current=g},[g]),t.useEffect(()=>{const e=f?.audioUrl,r=m>=0?R[m+1]?.audioUrl:void 0;st(e),st(r)},[R,f?.audioUrl,m]);const s=t.useCallback((e,r=null)=>{Ke.current===e&&(!e||r===null)||(Ke.current=e,Se?.({loading:e,reason:e?r:null}))},[Se]),B=t.useCallback(e=>{ae.current=e,Re?.(e)},[Re]),I=t.useCallback(()=>L?{shouldContinuePlayback:ae.current}:{shouldContinuePlayback:vt.shouldKeepPlayingAfterNavigation({defaultPlaying:ae.current,isPausedByUser:y.current})},[L]),Ye=t.useCallback(e=>e instanceof DOMException?e.name==="NotAllowedError"||e.name==="SecurityError":!1,[]),P=t.useCallback(()=>b&&!v&&!y.current&&K.current!=="blocked",[b,v]),De=t.useCallback(e=>e?e.startsWith("data:")?e:`data:audio/mpeg;base64,${e}`:"",[]),Xe=t.useCallback(()=>{const e=c.current;return e==null||e<=0?0:A.current.slice(0,e).reduce((r,u)=>r+Math.max(Number(u.duration_ms??0),0),0)/1e3},[]),V=t.useCallback(e=>e<=0?0:A.current.slice(0,e).reduce((r,u)=>r+Math.max(Number(u.duration_ms??0),0),0),[]),Ge=t.useCallback(()=>{const e=p.current;return e?T.current==="segment"?V(C.current)+Math.max(e.currentTime,0)*1e3:h.current!==null&&e.readyState===0?h.current*1e3:Math.max(e.currentTime,0)*1e3:c.current!=null?V(c.current):0},[V]),k=t.useCallback(e=>{const r=Math.max(e,0);he.current!==r&&(he.current=r,te?.(r))},[te]),o=t.useCallback(()=>{k(Ge())},[Ge,k]),d=t.useCallback(()=>{typeof window>"u"||F.current===null||(window.cancelAnimationFrame(F.current),F.current=null)},[]),Je=t.useCallback(()=>{if(typeof window>"u"||F.current!==null)return;const e=()=>{o();const r=p.current;if(!r||r.paused||r.ended){F.current=null;return}F.current=window.requestAnimationFrame(e)};F.current=window.requestAnimationFrame(e)},[o]),z=t.useCallback(()=>{const e=p.current;e&&(d(),a.current=!1,y.current=!1,Q.current=!1,T.current=null,h.current=null,x.current=!1,w.current=!1,H.current=null,e.pause(),e.removeAttribute("src"),e.load(),q.current=null,C.current=0,c.current=null,k(0),i(!1),s(!1))},[k,d,s]),E=t.useCallback(e=>{const r=p.current;if(!r)return!1;const u=r.play();return u&&typeof u.then=="function"&&u.then(()=>{K.current==="unknown"&&(K.current="auto"),a.current=!1,w.current=!1}).catch(S=>{K.current==="unknown"&&Ye(S)&&(K.current="blocked",a.current=!1,s(!1)),w.current=!1,i(!1)}),!0},[Ye,s]),M=t.useCallback((e,r)=>{const u=p.current,S=A.current[e];if(!u||!S)return!1;const _=De(S.audio_data);C.current=e,c.current=null,x.current=!1,w.current=!0,H.current="segment",k(V(e));const ie=P();a.current=ie,s(!1);const jt=q.current!==_;return T.current="segment",jt&&(u.pause(),u.removeAttribute("src"),u.load(),q.current=_,u.src=_,u.load()),h.current=0,u.readyState>0&&(u.currentTime=0,h.current=null),ie?E(`start-segment:${r}`):(a.current=!1,w.current=!1,u.pause(),i(!1),!0)},[P,De,V,k,E,s]),Y=t.useCallback(e=>{d(),a.current=!1,x.current=!1,w.current=!1,o(),i(!1),s(!1),m>=0&&je?.(m)},[m,je,d,o,s]),oe=t.useCallback(e=>{const r=p.current;return!r||T.current!=="url"||!Lt.hasReachedAudioEnd({currentTimeSeconds:Math.max(r.currentTime,0),durationSeconds:r.duration})?!1:(a.current=!1,r.pause(),Y(e),!0)},[Y]),Qe=t.useCallback(()=>{const e=C.current+1,r=A.current,u=r[e],S=ue.current,_=r.some(ie=>ie.is_final);if(u){M(e,"ended");return}if(S?.isAudioStreaming||!_){C.current=e,c.current=e,x.current=!0,a.current=b,k(V(e)),i(!1),s(!0,"waitingForMoreAudio");return}Y("segments-completed")},[b,Y,V,k,M,s]);t.useEffect(()=>{if(Te.current===be)return;Te.current=be,C.current=0,c.current=null,x.current=!1,y.current=!1,Q.current=!1,a.current=!1,w.current=!1,T.current=null,H.current=null,q.current=null,d(),k(0),s(!1);const e=p.current;e&&(e.pause(),e.removeAttribute("src"),e.load(),i(!1))},[m,be,g.length,O,k,d,s]),t.useEffect(()=>{const e=p.current;if(e){if(v){Q.current=!!(ue.current&&!y.current&&(!e.paused||a.current||c.current!==null)),a.current=!1,s(!1),e.pause(),i(!1);return}if(!(!Q.current||!ue.current||y.current)){if(Q.current=!1,c.current!==null){if(c.current<A.current.length){M(c.current,"external-resume");return}a.current=!0,s(!0,"waitingForMoreAudio");return}if(!q.current&&A.current.length>0){M(Math.min(C.current,A.current.length-1),"external-resume-init");return}e.paused&&(a.current=!0,E("external-resume"))}}},[v,M,E,s]),t.useEffect(()=>{const e=p.current;if(!e)return;if(!f){z();return}if(v){a.current=!1,s(!1),e.pause(),i(!1);return}const r=Nt.resolveAudioPlaybackSourceType({activeSourceType:T.current,hasAudioUrl:!!O,segmentCount:g.length,preferredSourceType:H.current,waitingSegmentIndex:c.current});if(r&&H.current!==r&&(H.current=r),r==="url"&&O){const u=q.current!==O,S=P();if(u){const _=c.current!==null?Xe():0;e.pause(),e.removeAttribute("src"),e.load(),q.current=O,T.current="url",e.src=O,e.load(),h.current=_,k(_*1e3),e.readyState>0&&(e.currentTime=_,h.current=null)}if(a.current=S,x.current=!1,w.current=!1,s(!1),!S){a.current=!1,e.pause(),i(!1);return}E(u?"sync-url-init":"sync-url");return}if(r==="segment"&&c.current!==null){if(c.current<g.length){if(y.current){i(!1),s(!1);return}M(c.current,"wait-resume");return}x.current=!0,a.current=P(),i(!1),s(P());return}if(r==="segment"&&!g.length){if(f.isAudioStreaming){c.current=C.current,x.current=!0,a.current=P(),i(!1),s(P());return}z();return}if(r==="segment"&&!q.current){M(Math.min(C.current,g.length-1),"effect-init");return}if(r!=="segment"){z();return}if(!b||y.current){a.current=!1,e.pause(),i(!1);return}e.paused&&(a.current=!0,E("sync-paused-retry"))},[f,m,g,O,b,v,P,k,z,M,E,Xe,s]),t.useEffect(()=>z,[z]),t.useEffect(()=>d,[d]);const yt=t.useCallback(()=>{o(),Je(),i(!0),s(!1),ge?.()},[ge,Je,o,s]),ht=t.useCallback(()=>{x.current||w.current||(d(),o(),i(!1))},[m,d,o]),bt=t.useCallback(()=>{const e=p.current;e&&h.current!==null&&(e.currentTime=h.current,h.current=null),o(),!oe("canplay-seek-finished")&&(!a.current||!b||E("canplay"))},[m,b,oe,o,E]),xt=t.useCallback(()=>{const e=p.current;e&&h.current!==null&&(e.currentTime=h.current,h.current=null),o(),oe("metadata-seek-finished")},[m,oe,o]),kt=t.useCallback(()=>{o()},[o]),St=t.useCallback(()=>{x.current||s(!0,"loadingAudio")},[s]),Rt=t.useCallback(()=>{if(x.current){s(!0,"waitingForMoreAudio");return}s(!0,"loadingAudio")},[s]),Ie=t.useCallback(()=>{o()},[o]),gt=t.useCallback(()=>{const e=T.current==="url"||A.current.length===0;if(d(),w.current=!1,e){Y("url-ended");return}Qe()},[Y,Qe,d]),Et=t.useCallback(()=>{d(),o(),i(!1),s(!1)},[d,o,s]),_t=t.useCallback(e=>{_e?.(e),$(!1)},[_e]),xe=t.useCallback(()=>{if(L){const r=!U;return B(r),Ce?.(r),!0}const e=p.current;return v||!e||!f?!1:c.current!==null?le?(B(!1),a.current=!1,y.current=!0,c.current=null,x.current=!1,i(!1),s(!1),e.pause(),!0):(B(!0),K.current="manual",y.current=!1,a.current=!0,s(!0,"waitingForMoreAudio"),!0):!e.src&&g.length>0?(B(!0),K.current="manual",y.current=!1,M(Math.min(C.current,g.length-1),"toggle"),!0):e.paused?(B(!0),K.current="manual",y.current=!1,a.current=!0,E("toggle-resume"),!0):(B(!1),a.current=!1,y.current=!0,e.pause(),!0)},[f,g.length,U,v,le,Ce,M,E,s,B,L]);t.useEffect(()=>{if(N)return ee.registerPlayerKeyboardShortcutOwner(W)},[W,N]);const ke=t.useMemo(()=>({fullscreen:()=>G?(G(),!0):!1,interaction:()=>se?(fe&&se(),!0):!1,next:()=>ne?(pe||ne(rt.suppressPlayerControlsWakeAfterNavigation(I())),!0):!1,previous:()=>re?(me||re(rt.suppressPlayerControlsWakeAfterNavigation(I())),!0):!1,subtitle:()=>X?(X(),!0):!1,togglePlayback:()=>(xe(),!0)}),[I,fe,pe,G,se,ne,re,X,me,xe]),et=t.useRef(ke);return t.useEffect(()=>{et.current=ke},[ke]),t.useEffect(()=>{if(!N||typeof document>"u")return;const e=r=>{if(!ee.isActivePlayerKeyboardShortcutOwner(W))return;const u=ee.getPlayerKeyboardShortcutAction(r);if(!u||ee.shouldIgnorePlayerKeyboardShortcutEvent(r,u))return;let S=!1;const _=et.current[u];S=_(),S&&r.preventDefault()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[W,N]),t.useEffect(()=>{te?.(he.current)},[te]),n.jsxRuntimeExports.jsxs("div",{...ot,"data-slide-player-shortcut-owner":W,className:tt.cn("slide-player",j),onFocusCapture:pt,onPointerDown:mt,children:[n.jsxRuntimeExports.jsx("audio",{ref:p,preload:"auto",playsInline:!0,onLoadStart:St,onLoadedMetadata:xt,onCanPlay:bt,onPlay:yt,onPause:ht,onWaiting:Rt,onSeeking:Ie,onSeeked:Ie,onTimeUpdate:kt,onEnded:gt,onError:Et}),ye?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(Ct.default,{container:lt,labels:{closeSettings:l.closeSettingsLabel,fullscreen:l.fullscreenLabel,nonFullscreen:l.nonFullscreenLabel,screen:l.screenLabel,screenMode:l.screenModeLabel,subtitle:l.subtitleLabel,subtitleToggle:l.subtitleToggleAriaLabel,title:l.settingsTitle},isSubtitleEnabled:de,onClose:()=>$(!1),onOpenChange:$,onSubtitleToggle:X??(()=>{}),onViewModeChange:_t,open:Pe,viewMode:at}),n.jsxRuntimeExports.jsxs("div",{className:"slide-player__controls",style:ft,children:[n.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[n.jsxRuntimeExports.jsx("button",{"aria-expanded":Pe,"aria-haspopup":"dialog","aria-label":l.moreOptionsAriaLabel,className:"slide-player__action slide-player__action--mobile-more",onClick:()=>{$(e=>!e)},type:"button",children:n.jsxRuntimeExports.jsx(Tt.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":l.volumeAriaLabel,className:"hidden",type:"button",children:n.jsxRuntimeExports.jsx(Kt.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":l.subtitleToggleAriaLabel,"aria-keyshortcuts":Be.ariaKeyShortcuts,"aria-pressed":de,className:"slide-player__action slide-player__action--subtitle",onClick:X,title:Be.title,type:"button",children:de?n.jsxRuntimeExports.jsx(Pt.default,{className:"slide-player__icon",strokeWidth:2.25}):n.jsxRuntimeExports.jsx(Ut.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-keyshortcuts":Ve.ariaKeyShortcuts,"aria-label":l.previousLabel,className:"slide-player__action slide-player__action--prev",disabled:me,onClick:()=>{re?.(I())},title:Ve.title,type:"button",children:n.jsxRuntimeExports.jsx(Ft.default,{className:"slide-player__icon",strokeWidth:2.25})}),n.jsxRuntimeExports.jsx("button",{"aria-label":We,"aria-keyshortcuts":He.ariaKeyShortcuts,className:"slide-player__toggle slide-player__toggle--playback",onClick:()=>{xe()},title:He.title,type:"button",children:dt?n.jsxRuntimeExports.jsx(Ht,{}):n.jsxRuntimeExports.jsx($t,{})}),n.jsxRuntimeExports.jsx("button",{"aria-keyshortcuts":$e.ariaKeyShortcuts,"aria-label":l.nextLabel,className:"slide-player__action slide-player__action--next",disabled:pe,onClick:()=>{ne?.(I())},title:$e.title,type:"button",children:n.jsxRuntimeExports.jsx(Wt.default,{className:"slide-player__icon",strokeWidth:2.25})}),G?n.jsxRuntimeExports.jsx("button",{"aria-label":Oe,"aria-keyshortcuts":Ze.ariaKeyShortcuts,className:"slide-player__action slide-player__action--fullscreen",onClick:G,title:Ze.title,type:"button",children:Ee?n.jsxRuntimeExports.jsx(Ot.default,{className:"slide-player__icon",strokeWidth:2.25}):n.jsxRuntimeExports.jsx(Bt.default,{className:"slide-player__icon",strokeWidth:2.25})}):null]}),n.jsxRuntimeExports.jsx("div",{className:"slide-player__separator"}),n.jsxRuntimeExports.jsxs("div",{className:"slide-player__group",children:[Ue.map((e,r)=>n.jsxRuntimeExports.jsx(t.Fragment,{children:e},`custom-action-${r}`)),n.jsxRuntimeExports.jsx("button",{"aria-label":l.notesLabel,"aria-keyshortcuts":ze.ariaKeyShortcuts,className:tt.cn("slide-player__action slide-player__action--notes",J&&"slide-player__action--active"),disabled:!fe,onClick:se,title:ze.title,type:"button",children:n.jsxRuntimeExports.jsx(Vt.default,{className:"slide-player__icon",strokeWidth:2.25})})]})]})]}):null]})},ut=t.memo(zt);ut.displayName="Player";exports.default=ut;
2
2
  //# sourceMappingURL=Player.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Player.cjs.js","sources":["../../../src/components/Slide/Player.tsx"],"sourcesContent":["import React, {\n memo,\n useCallback,\n useContext,\n useEffect,\n useId,\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 { hasReachedAudioEnd } from \"./utils/audioCompletion\";\nimport { PlayerKeyboardShortcutContext } from \"./utils/playerKeyboardShortcutContext\";\nimport {\n activatePlayerKeyboardShortcutOwner,\n getPlayerKeyboardShortcutAction,\n isActivePlayerKeyboardShortcutOwner,\n registerPlayerKeyboardShortcutOwner,\n shouldIgnorePlayerKeyboardShortcutEvent,\n type PlayerKeyboardShortcutAction,\n} from \"./utils/playerKeyboardShortcuts\";\nimport {\n resolveAudioPlaybackSourceType,\n type AudioPlaybackSourceType,\n} from \"./utils/playbackSource\";\nimport { shouldKeepPlayingAfterNavigation } from \"./utils/playbackPreference\";\nimport { toPlayerCustomActionList } from \"./utils/playerCustomActions\";\nimport \"./player.css\";\n\nconst audioPreloadElementCache = new Map<string, HTMLAudioElement>();\n\n/**\n * Labels and accessibility text used by the slide player controls.\n *\n * Missing fields fall back to `DEFAULT_SLIDE_PLAYER_TEXTS`; pass a `texts`\n * object when a consumer needs localized control labels or tooltip text.\n *\n * @example\n * ```tsx\n * <Player texts={{ playLabel: \"播放\", nextLabel: \"下一步\" }} />\n * ```\n */\nexport interface SlidePlayerTexts {\n closeSettingsLabel?: string;\n enterFullscreenLabel?: string;\n exitFullscreenLabel?: string;\n moreOptionsAriaLabel?: string;\n nextLabel?: string;\n notesLabel?: string;\n pauseAutoplayLabel?: string;\n pauseLabel?: string;\n playAutoplayLabel?: string;\n playLabel?: string;\n previousLabel?: string;\n screenModeLabel?: string;\n settingsTitle?: string;\n subtitleLabel?: string;\n subtitleToggleAriaLabel?: string;\n volumeAriaLabel?: string;\n screenLabel?: string;\n nonFullscreenLabel?: string;\n fullscreenLabel?: string;\n fullscreenHintText?: string;\n}\n\nexport type SlidePlayerLoadingReason = \"loadingAudio\" | \"waitingForMoreAudio\";\n\nexport interface SlidePlayerNavigationContext {\n shouldContinuePlayback: boolean;\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?: (state: {\n loading: boolean;\n reason: SlidePlayerLoadingReason | null;\n }) => void;\n onPlaybackPreferenceChange?: (playing: boolean) => void;\n onPlaybackStarted?: () => void;\n onPlaybackTimeChange?: (timeMs: number) => void;\n onSubtitleToggle?: () => void;\n onPrev?: (context: SlidePlayerNavigationContext) => void;\n onNext?: (context: SlidePlayerNavigationContext) => 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 /**\n * Enables document-level keyboard shortcuts for existing player actions.\n *\n * Defaults to `true`. Set to `false` when the page should not advertise or\n * handle player shortcuts for this standalone player instance.\n *\n * @example\n * ```tsx\n * <Player enableKeyboardShortcuts={false} />\n * ```\n */\n enableKeyboardShortcuts?: 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_SHORTCUT_LABELS = {\n fullscreen: \"F\",\n next: \"→\",\n notes: \"N\",\n playback: \"Space\",\n previous: \"←\",\n subtitle: \"C\",\n} as const;\n\nconst getShortcutTitle = (label: string | undefined, shortcut: string) =>\n label ? `${label} (${shortcut})` : shortcut;\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 onPlaybackPreferenceChange,\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 enableKeyboardShortcuts = true,\n customActions,\n customActionContext,\n texts,\n onFocusCapture,\n onPointerDown,\n ...props\n}: PlayerProps) => {\n const localKeyboardShortcutOwnerId = useId();\n const keyboardShortcutContext = useContext(PlayerKeyboardShortcutContext);\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 playbackPreferenceRef = useRef(\n useAutoAdvanceToggle ? isAutoAdvanceEnabled : defaultPlaying\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 preferredSourceTypeRef = useRef<AudioPlaybackSourceType | 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 keyboardShortcutOwnerId =\n keyboardShortcutContext?.ownerId ?? localKeyboardShortcutOwnerId;\n const shouldEnableKeyboardShortcuts =\n enableKeyboardShortcuts && (keyboardShortcutContext?.enabled ?? true);\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 ? playerTexts.pauseAutoplayLabel\n : playerTexts.playAutoplayLabel\n : isPlaying\n ? playerTexts.pauseLabel\n : playerTexts.playLabel;\n const fullscreenAriaLabel = isFullscreen\n ? playerTexts.exitFullscreenLabel\n : playerTexts.enterFullscreenLabel;\n const getShortcutMetadata = useCallback(\n (label: string | undefined, shortcutText: string, ariaKey: string) => ({\n ariaKeyShortcuts: shouldEnableKeyboardShortcuts ? ariaKey : undefined,\n title: shouldEnableKeyboardShortcuts\n ? getShortcutTitle(label, shortcutText)\n : label,\n }),\n [shouldEnableKeyboardShortcuts]\n );\n const subtitleShortcutMetadata = getShortcutMetadata(\n playerTexts.subtitleToggleAriaLabel,\n PLAYER_SHORTCUT_LABELS.subtitle,\n \"c\"\n );\n const previousShortcutMetadata = getShortcutMetadata(\n playerTexts.previousLabel,\n PLAYER_SHORTCUT_LABELS.previous,\n \"ArrowLeft\"\n );\n const playbackShortcutMetadata = getShortcutMetadata(\n toggleAriaLabel,\n PLAYER_SHORTCUT_LABELS.playback,\n \"Space\"\n );\n const nextShortcutMetadata = getShortcutMetadata(\n playerTexts.nextLabel,\n PLAYER_SHORTCUT_LABELS.next,\n \"ArrowRight\"\n );\n const fullscreenShortcutMetadata = getShortcutMetadata(\n fullscreenAriaLabel,\n PLAYER_SHORTCUT_LABELS.fullscreen,\n \"f\"\n );\n const notesShortcutMetadata = getShortcutMetadata(\n playerTexts.notesLabel,\n PLAYER_SHORTCUT_LABELS.notes,\n \"n\"\n );\n const activateKeyboardShortcutOwner = useCallback(() => {\n if (!shouldEnableKeyboardShortcuts) {\n return;\n }\n\n activatePlayerKeyboardShortcutOwner(keyboardShortcutOwnerId);\n }, [keyboardShortcutOwnerId, shouldEnableKeyboardShortcuts]);\n\n const handleRootPointerDown = useCallback(\n (event: React.PointerEvent<HTMLDivElement>) => {\n activateKeyboardShortcutOwner();\n onPointerDown?.(event);\n },\n [activateKeyboardShortcutOwner, onPointerDown]\n );\n\n const handleRootFocusCapture = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n activateKeyboardShortcutOwner();\n onFocusCapture?.(event);\n },\n [activateKeyboardShortcutOwner, onFocusCapture]\n );\n\n useEffect(() => {\n currentAudioRef.current = currentAudio;\n }, [currentAudio]);\n\n useEffect(() => {\n playbackPreferenceRef.current = useAutoAdvanceToggle\n ? isAutoAdvanceEnabled\n : defaultPlaying;\n }, [defaultPlaying, isAutoAdvanceEnabled, useAutoAdvanceToggle]);\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, reason: SlidePlayerLoadingReason | null = null) => {\n if (isLoadingRef.current === loading && (!loading || reason === null)) {\n return;\n }\n\n isLoadingRef.current = loading;\n onLoadingChange?.({\n loading,\n reason: loading ? reason : null,\n });\n },\n [onLoadingChange]\n );\n\n const updatePlaybackPreference = useCallback(\n (playing: boolean) => {\n playbackPreferenceRef.current = playing;\n onPlaybackPreferenceChange?.(playing);\n },\n [onPlaybackPreferenceChange]\n );\n\n const getNavigationContext = useCallback((): SlidePlayerNavigationContext => {\n if (useAutoAdvanceToggle) {\n return {\n shouldContinuePlayback: playbackPreferenceRef.current,\n };\n }\n\n return {\n shouldContinuePlayback: shouldKeepPlayingAfterNavigation({\n defaultPlaying: playbackPreferenceRef.current,\n isPausedByUser: isPausedByUserRef.current,\n }),\n };\n }, [useAutoAdvanceToggle]);\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 preferredSourceTypeRef.current = null;\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 preferredSourceTypeRef.current = \"segment\";\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 finishUrlAudioIfSeekedToEnd = useCallback(\n (_reason: string) => {\n const audioElement = audioRef.current;\n\n if (!audioElement || activeSourceTypeRef.current !== \"url\") {\n return false;\n }\n\n if (\n !hasReachedAudioEnd({\n currentTimeSeconds: Math.max(audioElement.currentTime, 0),\n durationSeconds: audioElement.duration,\n })\n ) {\n return false;\n }\n\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n finishAudioItem(_reason);\n return true;\n },\n [finishAudioItem]\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, \"waitingForMoreAudio\");\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 preferredSourceTypeRef.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, \"waitingForMoreAudio\");\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 const resolvedSourceType = resolveAudioPlaybackSourceType({\n activeSourceType: activeSourceTypeRef.current,\n hasAudioUrl: Boolean(currentAudioUrl),\n segmentCount: currentAudioSegments.length,\n preferredSourceType: preferredSourceTypeRef.current,\n waitingSegmentIndex: waitingSegmentIndexRef.current,\n });\n\n if (\n resolvedSourceType &&\n preferredSourceTypeRef.current !== resolvedSourceType\n ) {\n preferredSourceTypeRef.current = resolvedSourceType;\n }\n\n if (resolvedSourceType === \"url\" && currentAudioUrl) {\n const hasNewSrc = audioSrcRef.current !== currentAudioUrl;\n const shouldAutoResume = canStartPlaybackAutomatically();\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 (\n resolvedSourceType === \"segment\" &&\n waitingSegmentIndexRef.current !== null\n ) {\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 (resolvedSourceType === \"segment\" && !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 (resolvedSourceType === \"segment\" && !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 (resolvedSourceType !== \"segment\") {\n resetAudio();\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 (finishUrlAudioIfSeekedToEnd(\"canplay-seek-finished\")) {\n return;\n }\n\n if (!pendingAutoPlayRef.current || !defaultPlaying) {\n return;\n }\n\n tryPlayCurrentAudio(\"canplay\");\n }, [\n currentAudioIndex,\n defaultPlaying,\n finishUrlAudioIfSeekedToEnd,\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\n finishUrlAudioIfSeekedToEnd(\"metadata-seek-finished\");\n }, [currentAudioIndex, finishUrlAudioIfSeekedToEnd, syncPlaybackTime]);\n\n const handleAudioTimeUpdate = useCallback(() => {\n syncPlaybackTime();\n }, [syncPlaybackTime]);\n\n const handleAudioLoadStart = useCallback(() => {\n if (isWaitingForSegmentRef.current) {\n return;\n }\n\n updateLoading(true, \"loadingAudio\");\n }, [updateLoading]);\n\n const handleAudioWaiting = useCallback(() => {\n if (isWaitingForSegmentRef.current) {\n updateLoading(true, \"waitingForMoreAudio\");\n return;\n }\n\n updateLoading(true, \"loadingAudio\");\n }, [updateLoading]);\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 const togglePlayback = useCallback(() => {\n if (useAutoAdvanceToggle) {\n const nextAutoAdvanceEnabled = !isAutoAdvanceEnabled;\n\n updatePlaybackPreference(nextAutoAdvanceEnabled);\n onAutoAdvanceToggle?.(nextAutoAdvanceEnabled);\n return true;\n }\n\n const audioElement = audioRef.current;\n\n if (isPlaybackPaused || !audioElement || !currentAudio) {\n return false;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (isPlaying) {\n updatePlaybackPreference(false);\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 true;\n }\n\n updatePlaybackPreference(true);\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n updateLoading(true, \"waitingForMoreAudio\");\n return true;\n }\n\n if (!audioElement.src && currentAudioSegments.length > 0) {\n updatePlaybackPreference(true);\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 true;\n }\n\n if (audioElement.paused) {\n updatePlaybackPreference(true);\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"toggle-resume\");\n return true;\n }\n\n updatePlaybackPreference(false);\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = true;\n audioElement.pause();\n return true;\n }, [\n currentAudio,\n currentAudioSegments.length,\n isAutoAdvanceEnabled,\n isPlaybackPaused,\n isPlaying,\n onAutoAdvanceToggle,\n startSegmentPlayback,\n tryPlayCurrentAudio,\n updateLoading,\n updatePlaybackPreference,\n useAutoAdvanceToggle,\n ]);\n\n useEffect(() => {\n if (!shouldEnableKeyboardShortcuts) {\n return;\n }\n\n return registerPlayerKeyboardShortcutOwner(keyboardShortcutOwnerId);\n }, [keyboardShortcutOwnerId, shouldEnableKeyboardShortcuts]);\n\n const keyboardShortcutHandlers = useMemo<\n Record<PlayerKeyboardShortcutAction, () => boolean>\n >(\n () => ({\n fullscreen: () => {\n if (!onFullscreen) {\n return false;\n }\n\n onFullscreen();\n return true;\n },\n interaction: () => {\n if (!onInteractionToggle) {\n return false;\n }\n\n if (hasInteraction) {\n onInteractionToggle();\n }\n\n return true;\n },\n next: () => {\n if (!onNext) {\n return false;\n }\n\n if (!nextDisabled) {\n onNext(getNavigationContext());\n }\n\n return true;\n },\n previous: () => {\n if (!onPrev) {\n return false;\n }\n\n if (!prevDisabled) {\n onPrev(getNavigationContext());\n }\n\n return true;\n },\n subtitle: () => {\n if (!onSubtitleToggle) {\n return false;\n }\n\n onSubtitleToggle();\n return true;\n },\n togglePlayback: () => {\n togglePlayback();\n return true;\n },\n }),\n [\n getNavigationContext,\n hasInteraction,\n nextDisabled,\n onFullscreen,\n onInteractionToggle,\n onNext,\n onPrev,\n onSubtitleToggle,\n prevDisabled,\n togglePlayback,\n ]\n );\n const keyboardShortcutHandlersRef = useRef(keyboardShortcutHandlers);\n\n useEffect(() => {\n keyboardShortcutHandlersRef.current = keyboardShortcutHandlers;\n }, [keyboardShortcutHandlers]);\n\n useEffect(() => {\n if (!shouldEnableKeyboardShortcuts || typeof document === \"undefined\") {\n return;\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (!isActivePlayerKeyboardShortcutOwner(keyboardShortcutOwnerId)) {\n return;\n }\n\n const action = getPlayerKeyboardShortcutAction(event);\n\n if (!action || shouldIgnorePlayerKeyboardShortcutEvent(event, action)) {\n return;\n }\n\n let handled = false;\n const handler = keyboardShortcutHandlersRef.current[action];\n\n handled = handler();\n\n if (!handled) {\n return;\n }\n\n event.preventDefault();\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [keyboardShortcutOwnerId, shouldEnableKeyboardShortcuts]);\n\n useEffect(() => {\n onPlaybackTimeChange?.(playbackTimeMsRef.current);\n }, [onPlaybackTimeChange]);\n\n return (\n <div\n {...props}\n data-slide-player-shortcut-owner={keyboardShortcutOwnerId}\n className={cn(\"slide-player\", className)}\n onFocusCapture={handleRootFocusCapture}\n onPointerDown={handleRootPointerDown}\n >\n <audio\n ref={audioRef}\n preload=\"auto\"\n playsInline\n onLoadStart={handleAudioLoadStart}\n onLoadedMetadata={handleLoadedMetadata}\n onCanPlay={handleAudioCanPlay}\n onPlay={handleAudioPlay}\n onPause={handleAudioPause}\n onWaiting={handleAudioWaiting}\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 closeSettings: playerTexts.closeSettingsLabel,\n fullscreen: playerTexts.fullscreenLabel,\n nonFullscreen: playerTexts.nonFullscreenLabel,\n screen: playerTexts.screenLabel,\n screenMode: playerTexts.screenModeLabel,\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={playerTexts.moreOptionsAriaLabel}\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\n aria-label={playerTexts.volumeAriaLabel}\n className=\"hidden\"\n type=\"button\"\n >\n <Volume2 className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label={playerTexts.subtitleToggleAriaLabel}\n aria-keyshortcuts={subtitleShortcutMetadata.ariaKeyShortcuts}\n aria-pressed={isSubtitleEnabled}\n className=\"slide-player__action slide-player__action--subtitle\"\n onClick={onSubtitleToggle}\n title={subtitleShortcutMetadata.title}\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-keyshortcuts={previousShortcutMetadata.ariaKeyShortcuts}\n aria-label={playerTexts.previousLabel}\n className=\"slide-player__action slide-player__action--prev\"\n disabled={prevDisabled}\n onClick={() => {\n onPrev?.(getNavigationContext());\n }}\n title={previousShortcutMetadata.title}\n type=\"button\"\n >\n <RotateCcw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label={toggleAriaLabel}\n aria-keyshortcuts={playbackShortcutMetadata.ariaKeyShortcuts}\n className=\"slide-player__toggle slide-player__toggle--playback\"\n onClick={() => {\n togglePlayback();\n }}\n title={playbackShortcutMetadata.title}\n type=\"button\"\n >\n {isTogglePlaying ? <PauseIcon /> : <PlayIcon />}\n </button>\n <button\n aria-keyshortcuts={nextShortcutMetadata.ariaKeyShortcuts}\n aria-label={playerTexts.nextLabel}\n className=\"slide-player__action slide-player__action--next\"\n disabled={nextDisabled}\n onClick={() => {\n onNext?.(getNavigationContext());\n }}\n title={nextShortcutMetadata.title}\n type=\"button\"\n >\n <RotateCw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n {onFullscreen ? (\n <button\n aria-label={fullscreenAriaLabel}\n aria-keyshortcuts={\n fullscreenShortcutMetadata.ariaKeyShortcuts\n }\n className=\"slide-player__action slide-player__action--fullscreen\"\n onClick={onFullscreen}\n title={fullscreenShortcutMetadata.title}\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={playerTexts.notesLabel}\n aria-keyshortcuts={notesShortcutMetadata.ariaKeyShortcuts}\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 title={notesShortcutMetadata.title}\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_SHORTCUT_LABELS","getShortcutTitle","label","shortcut","Player","audioList","className","currentAudioIndex","defaultPlaying","isPlaybackPaused","isAutoAdvanceEnabled","useAutoAdvanceToggle","onLoadingChange","onPlaybackPreferenceChange","onPlaybackStarted","onPlaybackTimeChange","onSubtitleToggle","onPrev","onNext","onFullscreen","isFullscreen","mobileViewMode","DEFAULT_MOBILE_VIEW_MODE","settingsPortalContainer","onMobileViewModeChange","onEnded","onAutoAdvanceToggle","onInteractionToggle","hasInteraction","isInteractionOpen","isSubtitleEnabled","prevDisabled","nextDisabled","showControls","enableKeyboardShortcuts","customActions","customActionContext","texts","onFocusCapture","onPointerDown","props","localKeyboardShortcutOwnerId","useId","keyboardShortcutContext","useContext","PlayerKeyboardShortcutContext","audioRef","useRef","previousInteractionOpenRef","audioSrcRef","currentAudioKeyRef","currentSegmentIndexRef","waitingSegmentIndexRef","currentAudioRef","currentAudioSegmentsRef","playbackPreferenceRef","wasPlayingBeforeExternalPauseRef","isLoadingRef","isPausedByUserRef","activeSourceTypeRef","preferredSourceTypeRef","isWaitingForSegmentRef","pendingAutoPlayRef","pendingSeekTimeRef","isSwitchingSegmentRef","playbackAnimationFrameRef","playbackTimeMsRef","playbackAccessModeRef","isPlaying","setIsPlaying","useState","isMobileMoreOpen","setIsMobileMoreOpen","keyboardShortcutOwnerId","shouldEnableKeyboardShortcuts","currentAudio","currentAudioUrl","currentAudioSegments","useMemo","prevSegment","nextSegment","customActionList","toPlayerCustomActionList","mobileVisibleActionCount","controlsStyle","playerTexts","DEFAULT_SLIDE_PLAYER_TEXTS","currentAudioKey","isTogglePlaying","toggleAriaLabel","fullscreenAriaLabel","getShortcutMetadata","useCallback","shortcutText","ariaKey","subtitleShortcutMetadata","previousShortcutMetadata","playbackShortcutMetadata","nextShortcutMetadata","fullscreenShortcutMetadata","notesShortcutMetadata","activateKeyboardShortcutOwner","activatePlayerKeyboardShortcutOwner","handleRootPointerDown","event","handleRootFocusCapture","useEffect","currentUrl","nextUrl","updateLoading","loading","reason","updatePlaybackPreference","playing","getNavigationContext","shouldKeepPlayingAfterNavigation","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","finishUrlAudioIfSeekedToEnd","hasReachedAudioEnd","handleSegmentEnded","nextSegmentIndex","segments","activeAudio","hasFinal","resolvedSourceType","resolveAudioPlaybackSourceType","nextSeekTime","handleAudioPlay","handleAudioPause","handleAudioCanPlay","handleLoadedMetadata","handleAudioTimeUpdate","handleAudioLoadStart","handleAudioWaiting","handleAudioSeeking","handleAudioEnded","shouldFinishAsUrl","handleAudioError","handleMobileViewModeChange","nextViewMode","togglePlayback","nextAutoAdvanceEnabled","registerPlayerKeyboardShortcutOwner","keyboardShortcutHandlers","keyboardShortcutHandlersRef","handleKeyDown","isActivePlayerKeyboardShortcutOwner","action","getPlayerKeyboardShortcutAction","shouldIgnorePlayerKeyboardShortcutEvent","handled","handler","cn","Fragment","MobilePlayerSettingsSheet","prevOpen","EllipsisVertical","Volume2","Captions","CaptionsOff","RotateCcw","RotateCw","ScanLine","Maximize","customAction","customActionIndex","React","FilePenLine","MemoizedPlayer","memo"],"mappings":"m3CAoDMA,OAA+B,IA0C/BC,GAAmBC,GAAiB,CAKxC,GAJI,OAAO,OAAW,KAAe,CAACA,GAIlCF,GAAyB,IAAIE,CAAG,EAClC,OAKF,MAAMC,EAAQ,OAAO,SAAS,cAAc,OAAO,EACnDA,EAAM,QAAU,OAChBA,EAAM,aAAa,cAAe,MAAM,EACxCA,EAAM,IAAMD,EACZC,EAAM,KAAA,EAENH,GAAyB,IAAIE,EAAKC,CAAK,CACzC,EAkDMC,GAAY,IAChBC,EAAAA,kBAAAA,KAAC,MAAA,CACC,MAAM,6BACN,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OAEL,SAAA,CAAAC,EAAAA,kBAAAA,IAAC,OAAA,CACC,EAAE,gLACF,KAAK,SAAA,CAAA,EAEPA,EAAAA,kBAAAA,IAAC,OAAA,CAAK,EAAE,yCAAyC,KAAK,OAAA,CAAQ,CAAA,CAAA,CAChE,EAGIC,GAAW,IACfF,EAAAA,kBAAAA,KAAC,MAAA,CACC,MAAM,6BACN,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OAEL,SAAA,CAAAC,EAAAA,kBAAAA,IAAC,OAAA,CACC,EAAE,gLACF,KAAK,SAAA,CAAA,E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,sBACZ,SAAA,CAAAoF,GAAiB,IAAI,CAAC+G,EAAcC,IACnCnM,EAAAA,kBAAAA,IAACoM,EAAM,SAAN,CACE,SAAAF,CAAA,EADkB,iBAAiBC,CAAiB,EAEvD,CACD,EACDnM,EAAAA,kBAAAA,IAAC,SAAA,CACC,aAAYuF,EAAY,WACxB,oBAAmBe,GAAsB,iBACzC,UAAWgF,GAAAA,GACT,mDACAvJ,GAAqB,8BAAA,EAEvB,SAAU,CAACD,GACX,QAASD,GACT,MAAOyE,GAAsB,MAC7B,KAAK,SAEL,SAAAtG,EAAAA,kBAAAA,IAACqM,GAAAA,QAAA,CACC,UAAU,qBACV,YAAa,IAAA,CAAA,CACf,CAAA,CACF,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CACF,EACE,IAAA,CAAA,CAAA,CAGV,EAEMC,GAAiBC,EAAAA,KAAKjM,EAAM,EAElCgM,GAAe,YAAc"}
1
+ {"version":3,"file":"Player.cjs.js","sources":["../../../src/components/Slide/Player.tsx"],"sourcesContent":["import React, {\n memo,\n useCallback,\n useContext,\n useEffect,\n useId,\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 { hasReachedAudioEnd } from \"./utils/audioCompletion\";\nimport { PlayerKeyboardShortcutContext } from \"./utils/playerKeyboardShortcutContext\";\nimport {\n activatePlayerKeyboardShortcutOwner,\n getPlayerKeyboardShortcutAction,\n isActivePlayerKeyboardShortcutOwner,\n registerPlayerKeyboardShortcutOwner,\n shouldIgnorePlayerKeyboardShortcutEvent,\n type PlayerKeyboardShortcutAction,\n} from \"./utils/playerKeyboardShortcuts\";\nimport {\n resolveAudioPlaybackSourceType,\n type AudioPlaybackSourceType,\n} from \"./utils/playbackSource\";\nimport { shouldKeepPlayingAfterNavigation } from \"./utils/playbackPreference\";\nimport { toPlayerCustomActionList } from \"./utils/playerCustomActions\";\nimport { suppressPlayerControlsWakeAfterNavigation } from \"./utils/playerNavigationContext\";\nimport \"./player.css\";\n\nconst audioPreloadElementCache = new Map<string, HTMLAudioElement>();\n\n/**\n * Labels and accessibility text used by the slide player controls.\n *\n * Missing fields fall back to `DEFAULT_SLIDE_PLAYER_TEXTS`; pass a `texts`\n * object when a consumer needs localized control labels or tooltip text.\n *\n * @example\n * ```tsx\n * <Player texts={{ playLabel: \"播放\", nextLabel: \"下一步\" }} />\n * ```\n */\nexport interface SlidePlayerTexts {\n closeSettingsLabel?: string;\n enterFullscreenLabel?: string;\n exitFullscreenLabel?: string;\n moreOptionsAriaLabel?: string;\n nextLabel?: string;\n notesLabel?: string;\n pauseAutoplayLabel?: string;\n pauseLabel?: string;\n playAutoplayLabel?: string;\n playLabel?: string;\n previousLabel?: string;\n screenModeLabel?: string;\n settingsTitle?: string;\n subtitleLabel?: string;\n subtitleToggleAriaLabel?: string;\n volumeAriaLabel?: string;\n screenLabel?: string;\n nonFullscreenLabel?: string;\n fullscreenLabel?: string;\n fullscreenHintText?: string;\n}\n\nexport type SlidePlayerLoadingReason = \"loadingAudio\" | \"waitingForMoreAudio\";\n\nexport interface SlidePlayerNavigationContext {\n shouldContinuePlayback: boolean;\n /** Set false when navigation should not reveal hidden player controls. */\n shouldWakeControls?: boolean;\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?: (state: {\n loading: boolean;\n reason: SlidePlayerLoadingReason | null;\n }) => void;\n onPlaybackPreferenceChange?: (playing: boolean) => void;\n onPlaybackStarted?: () => void;\n onPlaybackTimeChange?: (timeMs: number) => void;\n onSubtitleToggle?: () => void;\n onPrev?: (context: SlidePlayerNavigationContext) => void;\n onNext?: (context: SlidePlayerNavigationContext) => 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 /**\n * Enables document-level keyboard shortcuts for existing player actions.\n *\n * Defaults to `true`. Set to `false` when the page should not advertise or\n * handle player shortcuts for this standalone player instance.\n *\n * @example\n * ```tsx\n * <Player enableKeyboardShortcuts={false} />\n * ```\n */\n enableKeyboardShortcuts?: 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_SHORTCUT_LABELS = {\n fullscreen: \"F\",\n next: \"→\",\n notes: \"N\",\n playback: \"Space\",\n previous: \"←\",\n subtitle: \"C\",\n} as const;\n\nconst getShortcutTitle = (label: string | undefined, shortcut: string) =>\n label ? `${label} (${shortcut})` : shortcut;\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 onPlaybackPreferenceChange,\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 enableKeyboardShortcuts = true,\n customActions,\n customActionContext,\n texts,\n onFocusCapture,\n onPointerDown,\n ...props\n}: PlayerProps) => {\n const localKeyboardShortcutOwnerId = useId();\n const keyboardShortcutContext = useContext(PlayerKeyboardShortcutContext);\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 playbackPreferenceRef = useRef(\n useAutoAdvanceToggle ? isAutoAdvanceEnabled : defaultPlaying\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 preferredSourceTypeRef = useRef<AudioPlaybackSourceType | 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 keyboardShortcutOwnerId =\n keyboardShortcutContext?.ownerId ?? localKeyboardShortcutOwnerId;\n const shouldEnableKeyboardShortcuts =\n enableKeyboardShortcuts && (keyboardShortcutContext?.enabled ?? true);\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 ? playerTexts.pauseAutoplayLabel\n : playerTexts.playAutoplayLabel\n : isPlaying\n ? playerTexts.pauseLabel\n : playerTexts.playLabel;\n const fullscreenAriaLabel = isFullscreen\n ? playerTexts.exitFullscreenLabel\n : playerTexts.enterFullscreenLabel;\n const getShortcutMetadata = useCallback(\n (label: string | undefined, shortcutText: string, ariaKey: string) => ({\n ariaKeyShortcuts: shouldEnableKeyboardShortcuts ? ariaKey : undefined,\n title: shouldEnableKeyboardShortcuts\n ? getShortcutTitle(label, shortcutText)\n : label,\n }),\n [shouldEnableKeyboardShortcuts]\n );\n const subtitleShortcutMetadata = getShortcutMetadata(\n playerTexts.subtitleToggleAriaLabel,\n PLAYER_SHORTCUT_LABELS.subtitle,\n \"c\"\n );\n const previousShortcutMetadata = getShortcutMetadata(\n playerTexts.previousLabel,\n PLAYER_SHORTCUT_LABELS.previous,\n \"ArrowLeft\"\n );\n const playbackShortcutMetadata = getShortcutMetadata(\n toggleAriaLabel,\n PLAYER_SHORTCUT_LABELS.playback,\n \"Space\"\n );\n const nextShortcutMetadata = getShortcutMetadata(\n playerTexts.nextLabel,\n PLAYER_SHORTCUT_LABELS.next,\n \"ArrowRight\"\n );\n const fullscreenShortcutMetadata = getShortcutMetadata(\n fullscreenAriaLabel,\n PLAYER_SHORTCUT_LABELS.fullscreen,\n \"f\"\n );\n const notesShortcutMetadata = getShortcutMetadata(\n playerTexts.notesLabel,\n PLAYER_SHORTCUT_LABELS.notes,\n \"n\"\n );\n const activateKeyboardShortcutOwner = useCallback(() => {\n if (!shouldEnableKeyboardShortcuts) {\n return;\n }\n\n activatePlayerKeyboardShortcutOwner(keyboardShortcutOwnerId);\n }, [keyboardShortcutOwnerId, shouldEnableKeyboardShortcuts]);\n\n const handleRootPointerDown = useCallback(\n (event: React.PointerEvent<HTMLDivElement>) => {\n activateKeyboardShortcutOwner();\n onPointerDown?.(event);\n },\n [activateKeyboardShortcutOwner, onPointerDown]\n );\n\n const handleRootFocusCapture = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n activateKeyboardShortcutOwner();\n onFocusCapture?.(event);\n },\n [activateKeyboardShortcutOwner, onFocusCapture]\n );\n\n useEffect(() => {\n currentAudioRef.current = currentAudio;\n }, [currentAudio]);\n\n useEffect(() => {\n playbackPreferenceRef.current = useAutoAdvanceToggle\n ? isAutoAdvanceEnabled\n : defaultPlaying;\n }, [defaultPlaying, isAutoAdvanceEnabled, useAutoAdvanceToggle]);\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, reason: SlidePlayerLoadingReason | null = null) => {\n if (isLoadingRef.current === loading && (!loading || reason === null)) {\n return;\n }\n\n isLoadingRef.current = loading;\n onLoadingChange?.({\n loading,\n reason: loading ? reason : null,\n });\n },\n [onLoadingChange]\n );\n\n const updatePlaybackPreference = useCallback(\n (playing: boolean) => {\n playbackPreferenceRef.current = playing;\n onPlaybackPreferenceChange?.(playing);\n },\n [onPlaybackPreferenceChange]\n );\n\n const getNavigationContext = useCallback((): SlidePlayerNavigationContext => {\n if (useAutoAdvanceToggle) {\n return {\n shouldContinuePlayback: playbackPreferenceRef.current,\n };\n }\n\n return {\n shouldContinuePlayback: shouldKeepPlayingAfterNavigation({\n defaultPlaying: playbackPreferenceRef.current,\n isPausedByUser: isPausedByUserRef.current,\n }),\n };\n }, [useAutoAdvanceToggle]);\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 preferredSourceTypeRef.current = null;\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 preferredSourceTypeRef.current = \"segment\";\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 finishUrlAudioIfSeekedToEnd = useCallback(\n (_reason: string) => {\n const audioElement = audioRef.current;\n\n if (!audioElement || activeSourceTypeRef.current !== \"url\") {\n return false;\n }\n\n if (\n !hasReachedAudioEnd({\n currentTimeSeconds: Math.max(audioElement.currentTime, 0),\n durationSeconds: audioElement.duration,\n })\n ) {\n return false;\n }\n\n pendingAutoPlayRef.current = false;\n audioElement.pause();\n finishAudioItem(_reason);\n return true;\n },\n [finishAudioItem]\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, \"waitingForMoreAudio\");\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 preferredSourceTypeRef.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, \"waitingForMoreAudio\");\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 const resolvedSourceType = resolveAudioPlaybackSourceType({\n activeSourceType: activeSourceTypeRef.current,\n hasAudioUrl: Boolean(currentAudioUrl),\n segmentCount: currentAudioSegments.length,\n preferredSourceType: preferredSourceTypeRef.current,\n waitingSegmentIndex: waitingSegmentIndexRef.current,\n });\n\n if (\n resolvedSourceType &&\n preferredSourceTypeRef.current !== resolvedSourceType\n ) {\n preferredSourceTypeRef.current = resolvedSourceType;\n }\n\n if (resolvedSourceType === \"url\" && currentAudioUrl) {\n const hasNewSrc = audioSrcRef.current !== currentAudioUrl;\n const shouldAutoResume = canStartPlaybackAutomatically();\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 (\n resolvedSourceType === \"segment\" &&\n waitingSegmentIndexRef.current !== null\n ) {\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 (resolvedSourceType === \"segment\" && !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 (resolvedSourceType === \"segment\" && !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 (resolvedSourceType !== \"segment\") {\n resetAudio();\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 (finishUrlAudioIfSeekedToEnd(\"canplay-seek-finished\")) {\n return;\n }\n\n if (!pendingAutoPlayRef.current || !defaultPlaying) {\n return;\n }\n\n tryPlayCurrentAudio(\"canplay\");\n }, [\n currentAudioIndex,\n defaultPlaying,\n finishUrlAudioIfSeekedToEnd,\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\n finishUrlAudioIfSeekedToEnd(\"metadata-seek-finished\");\n }, [currentAudioIndex, finishUrlAudioIfSeekedToEnd, syncPlaybackTime]);\n\n const handleAudioTimeUpdate = useCallback(() => {\n syncPlaybackTime();\n }, [syncPlaybackTime]);\n\n const handleAudioLoadStart = useCallback(() => {\n if (isWaitingForSegmentRef.current) {\n return;\n }\n\n updateLoading(true, \"loadingAudio\");\n }, [updateLoading]);\n\n const handleAudioWaiting = useCallback(() => {\n if (isWaitingForSegmentRef.current) {\n updateLoading(true, \"waitingForMoreAudio\");\n return;\n }\n\n updateLoading(true, \"loadingAudio\");\n }, [updateLoading]);\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 const togglePlayback = useCallback(() => {\n if (useAutoAdvanceToggle) {\n const nextAutoAdvanceEnabled = !isAutoAdvanceEnabled;\n\n updatePlaybackPreference(nextAutoAdvanceEnabled);\n onAutoAdvanceToggle?.(nextAutoAdvanceEnabled);\n return true;\n }\n\n const audioElement = audioRef.current;\n\n if (isPlaybackPaused || !audioElement || !currentAudio) {\n return false;\n }\n\n if (waitingSegmentIndexRef.current !== null) {\n if (isPlaying) {\n updatePlaybackPreference(false);\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 true;\n }\n\n updatePlaybackPreference(true);\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n updateLoading(true, \"waitingForMoreAudio\");\n return true;\n }\n\n if (!audioElement.src && currentAudioSegments.length > 0) {\n updatePlaybackPreference(true);\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 true;\n }\n\n if (audioElement.paused) {\n updatePlaybackPreference(true);\n playbackAccessModeRef.current = \"manual\";\n isPausedByUserRef.current = false;\n pendingAutoPlayRef.current = true;\n tryPlayCurrentAudio(\"toggle-resume\");\n return true;\n }\n\n updatePlaybackPreference(false);\n pendingAutoPlayRef.current = false;\n isPausedByUserRef.current = true;\n audioElement.pause();\n return true;\n }, [\n currentAudio,\n currentAudioSegments.length,\n isAutoAdvanceEnabled,\n isPlaybackPaused,\n isPlaying,\n onAutoAdvanceToggle,\n startSegmentPlayback,\n tryPlayCurrentAudio,\n updateLoading,\n updatePlaybackPreference,\n useAutoAdvanceToggle,\n ]);\n\n useEffect(() => {\n if (!shouldEnableKeyboardShortcuts) {\n return;\n }\n\n return registerPlayerKeyboardShortcutOwner(keyboardShortcutOwnerId);\n }, [keyboardShortcutOwnerId, shouldEnableKeyboardShortcuts]);\n\n const keyboardShortcutHandlers = useMemo<\n Record<PlayerKeyboardShortcutAction, () => boolean>\n >(\n () => ({\n fullscreen: () => {\n if (!onFullscreen) {\n return false;\n }\n\n onFullscreen();\n return true;\n },\n interaction: () => {\n if (!onInteractionToggle) {\n return false;\n }\n\n if (hasInteraction) {\n onInteractionToggle();\n }\n\n return true;\n },\n next: () => {\n if (!onNext) {\n return false;\n }\n\n if (!nextDisabled) {\n onNext(\n suppressPlayerControlsWakeAfterNavigation(getNavigationContext())\n );\n }\n\n return true;\n },\n previous: () => {\n if (!onPrev) {\n return false;\n }\n\n if (!prevDisabled) {\n onPrev(\n suppressPlayerControlsWakeAfterNavigation(getNavigationContext())\n );\n }\n\n return true;\n },\n subtitle: () => {\n if (!onSubtitleToggle) {\n return false;\n }\n\n onSubtitleToggle();\n return true;\n },\n togglePlayback: () => {\n togglePlayback();\n return true;\n },\n }),\n [\n getNavigationContext,\n hasInteraction,\n nextDisabled,\n onFullscreen,\n onInteractionToggle,\n onNext,\n onPrev,\n onSubtitleToggle,\n prevDisabled,\n togglePlayback,\n ]\n );\n const keyboardShortcutHandlersRef = useRef(keyboardShortcutHandlers);\n\n useEffect(() => {\n keyboardShortcutHandlersRef.current = keyboardShortcutHandlers;\n }, [keyboardShortcutHandlers]);\n\n useEffect(() => {\n if (!shouldEnableKeyboardShortcuts || typeof document === \"undefined\") {\n return;\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (!isActivePlayerKeyboardShortcutOwner(keyboardShortcutOwnerId)) {\n return;\n }\n\n const action = getPlayerKeyboardShortcutAction(event);\n\n if (!action || shouldIgnorePlayerKeyboardShortcutEvent(event, action)) {\n return;\n }\n\n let handled = false;\n const handler = keyboardShortcutHandlersRef.current[action];\n\n handled = handler();\n\n if (!handled) {\n return;\n }\n\n event.preventDefault();\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [keyboardShortcutOwnerId, shouldEnableKeyboardShortcuts]);\n\n useEffect(() => {\n onPlaybackTimeChange?.(playbackTimeMsRef.current);\n }, [onPlaybackTimeChange]);\n\n return (\n <div\n {...props}\n data-slide-player-shortcut-owner={keyboardShortcutOwnerId}\n className={cn(\"slide-player\", className)}\n onFocusCapture={handleRootFocusCapture}\n onPointerDown={handleRootPointerDown}\n >\n <audio\n ref={audioRef}\n preload=\"auto\"\n playsInline\n onLoadStart={handleAudioLoadStart}\n onLoadedMetadata={handleLoadedMetadata}\n onCanPlay={handleAudioCanPlay}\n onPlay={handleAudioPlay}\n onPause={handleAudioPause}\n onWaiting={handleAudioWaiting}\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 closeSettings: playerTexts.closeSettingsLabel,\n fullscreen: playerTexts.fullscreenLabel,\n nonFullscreen: playerTexts.nonFullscreenLabel,\n screen: playerTexts.screenLabel,\n screenMode: playerTexts.screenModeLabel,\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={playerTexts.moreOptionsAriaLabel}\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\n aria-label={playerTexts.volumeAriaLabel}\n className=\"hidden\"\n type=\"button\"\n >\n <Volume2 className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label={playerTexts.subtitleToggleAriaLabel}\n aria-keyshortcuts={subtitleShortcutMetadata.ariaKeyShortcuts}\n aria-pressed={isSubtitleEnabled}\n className=\"slide-player__action slide-player__action--subtitle\"\n onClick={onSubtitleToggle}\n title={subtitleShortcutMetadata.title}\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-keyshortcuts={previousShortcutMetadata.ariaKeyShortcuts}\n aria-label={playerTexts.previousLabel}\n className=\"slide-player__action slide-player__action--prev\"\n disabled={prevDisabled}\n onClick={() => {\n onPrev?.(getNavigationContext());\n }}\n title={previousShortcutMetadata.title}\n type=\"button\"\n >\n <RotateCcw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n <button\n aria-label={toggleAriaLabel}\n aria-keyshortcuts={playbackShortcutMetadata.ariaKeyShortcuts}\n className=\"slide-player__toggle slide-player__toggle--playback\"\n onClick={() => {\n togglePlayback();\n }}\n title={playbackShortcutMetadata.title}\n type=\"button\"\n >\n {isTogglePlaying ? <PauseIcon /> : <PlayIcon />}\n </button>\n <button\n aria-keyshortcuts={nextShortcutMetadata.ariaKeyShortcuts}\n aria-label={playerTexts.nextLabel}\n className=\"slide-player__action slide-player__action--next\"\n disabled={nextDisabled}\n onClick={() => {\n onNext?.(getNavigationContext());\n }}\n title={nextShortcutMetadata.title}\n type=\"button\"\n >\n <RotateCw className=\"slide-player__icon\" strokeWidth={2.25} />\n </button>\n {onFullscreen ? (\n <button\n aria-label={fullscreenAriaLabel}\n aria-keyshortcuts={\n fullscreenShortcutMetadata.ariaKeyShortcuts\n }\n className=\"slide-player__action slide-player__action--fullscreen\"\n onClick={onFullscreen}\n title={fullscreenShortcutMetadata.title}\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={playerTexts.notesLabel}\n aria-keyshortcuts={notesShortcutMetadata.ariaKeyShortcuts}\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 title={notesShortcutMetadata.title}\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_SHORTCUT_LABELS","getShortcutTitle","label","shortcut","Player","audioList","className","currentAudioIndex","defaultPlaying","isPlaybackPaused","isAutoAdvanceEnabled","useAutoAdvanceToggle","onLoadingChange","onPlaybackPreferenceChange","onPlaybackStarted","onPlaybackTimeChange","onSubtitleToggle","onPrev","onNext","onFullscreen","isFullscreen","mobileViewMode","DEFAULT_MOBILE_VIEW_MODE","settingsPortalContainer","onMobileViewModeChange","onEnded","onAutoAdvanceToggle","onInteractionToggle","hasInteraction","isInteractionOpen","isSubtitleEnabled","prevDisabled","nextDisabled","showControls","enableKeyboardShortcuts","customActions","customActionContext","texts","onFocusCapture","onPointerDown","props","localKeyboardShortcutOwnerId","useId","keyboardShortcutContext","useContext","PlayerKeyboardShortcutContext","audioRef","useRef","previousInteractionOpenRef","audioSrcRef","currentAudioKeyRef","currentSegmentIndexRef","waitingSegmentIndexRef","currentAudioRef","currentAudioSegmentsRef","playbackPreferenceRef","wasPlayingBeforeExternalPauseRef","isLoadingRef","isPausedByUserRef","activeSourceTypeRef","preferredSourceTypeRef","isWaitingForSegmentRef","pendingAutoPlayRef","pendingSeekTimeRef","isSwitchingSegmentRef","playbackAnimationFrameRef","playbackTimeMsRef","playbackAccessModeRef","isPlaying","setIsPlaying","useState","isMobileMoreOpen","setIsMobileMoreOpen","keyboardShortcutOwnerId","shouldEnableKeyboardShortcuts","currentAudio","currentAudioUrl","currentAudioSegments","useMemo","prevSegment","nextSegment","customActionList","toPlayerCustomActionList","mobileVisibleActionCount","controlsStyle","playerTexts","DEFAULT_SLIDE_PLAYER_TEXTS","currentAudioKey","isTogglePlaying","toggleAriaLabel","fullscreenAriaLabel","getShortcutMetadata","useCallback","shortcutText","ariaKey","subtitleShortcutMetadata","previousShortcutMetadata","playbackShortcutMetadata","nextShortcutMetadata","fullscreenShortcutMetadata","notesShortcutMetadata","activateKeyboardShortcutOwner","activatePlayerKeyboardShortcutOwner","handleRootPointerDown","event","handleRootFocusCapture","useEffect","currentUrl","nextUrl","updateLoading","loading","reason","updatePlaybackPreference","playing","getNavigationContext","shouldKeepPlayingAfterNavigation","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","finishUrlAudioIfSeekedToEnd","hasReachedAudioEnd","handleSegmentEnded","nextSegmentIndex","segments","activeAudio","hasFinal","resolvedSourceType","resolveAudioPlaybackSourceType","nextSeekTime","handleAudioPlay","handleAudioPause","handleAudioCanPlay","handleLoadedMetadata","handleAudioTimeUpdate","handleAudioLoadStart","handleAudioWaiting","handleAudioSeeking","handleAudioEnded","shouldFinishAsUrl","handleAudioError","handleMobileViewModeChange","nextViewMode","togglePlayback","nextAutoAdvanceEnabled","registerPlayerKeyboardShortcutOwner","keyboardShortcutHandlers","suppressPlayerControlsWakeAfterNavigation","keyboardShortcutHandlersRef","handleKeyDown","isActivePlayerKeyboardShortcutOwner","action","getPlayerKeyboardShortcutAction","shouldIgnorePlayerKeyboardShortcutEvent","handled","handler","cn","Fragment","MobilePlayerSettingsSheet","prevOpen","EllipsisVertical","Volume2","Captions","CaptionsOff","RotateCcw","RotateCw","ScanLine","Maximize","customAction","customActionIndex","React","FilePenLine","MemoizedPlayer","memo"],"mappings":"w6CAqDMA,OAA+B,IA4C/BC,GAAmBC,GAAiB,CAKxC,GAJI,OAAO,OAAW,KAAe,CAACA,GAIlCF,GAAyB,IAAIE,CAAG,EAClC,OAKF,MAAMC,EAAQ,OAAO,SAAS,cAAc,OAAO,EACnDA,EAAM,QAAU,OAChBA,EAAM,aAAa,cAAe,MAAM,EACxCA,EAAM,IAAMD,EACZC,EAAM,KAAA,EAENH,GAAyB,IAAIE,EAAKC,CAAK,CACzC,EAkDMC,GAAY,IAChBC,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AAU,qBAAqB,YAAa,IAAA,CAAM,CAAA,CAAA,EAE7D3K,EACCrB,EAAAA,kBAAAA,IAAC,SAAA,CACC,aAAY4F,GACZ,oBACES,GAA2B,iBAE7B,UAAU,wDACV,QAAShF,EACT,MAAOgF,GAA2B,MAClC,KAAK,SAEJ,SAAA/E,GACCtB,EAAAA,kBAAAA,IAACiM,GAAAA,QAAA,CACC,UAAU,qBACV,YAAa,IAAA,CAAA,EAGfjM,EAAAA,kBAAAA,IAACkM,GAAAA,QAAA,CACC,UAAU,qBACV,YAAa,IAAA,CAAA,CACf,CAAA,EAGF,IAAA,EACN,EAEAlM,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,yBAAA,CAA0B,EAEzCD,EAAAA,kBAAAA,KAAC,MAAA,CAAI,UAAU,sBACZ,SAAA,CAAAoF,GAAiB,IAAI,CAACgH,EAAcC,IACnCpM,EAAAA,kBAAAA,IAACqM,EAAM,SAAN,CACE,SAAAF,CAAA,EADkB,iBAAiBC,CAAiB,EAEvD,CACD,EACDpM,EAAAA,kBAAAA,IAAC,SAAA,CACC,aAAYuF,EAAY,WACxB,oBAAmBe,GAAsB,iBACzC,UAAWiF,GAAAA,GACT,mDACAxJ,GAAqB,8BAAA,EAEvB,SAAU,CAACD,GACX,QAASD,GACT,MAAOyE,GAAsB,MAC7B,KAAK,SAEL,SAAAtG,EAAAA,kBAAAA,IAACsM,GAAAA,QAAA,CACC,UAAU,qBACV,YAAa,IAAA,CAAA,CACf,CAAA,CACF,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CACF,EACE,IAAA,CAAA,CAAA,CAGV,EAEMC,GAAiBC,EAAAA,KAAKlM,EAAM,EAElCiM,GAAe,YAAc"}
@@ -38,6 +38,8 @@ export interface SlidePlayerTexts {
38
38
  export type SlidePlayerLoadingReason = "loadingAudio" | "waitingForMoreAudio";
39
39
  export interface SlidePlayerNavigationContext {
40
40
  shouldContinuePlayback: boolean;
41
+ /** Set false when navigation should not reveal hidden player controls. */
42
+ shouldWakeControls?: boolean;
41
43
  }
42
44
  export type PlayerProps = Omit<React.ComponentProps<"div">, "onEnded"> & {
43
45
  audioList?: SlideAudioItem[];