PageSourceSearch

https://sokapal.ai/assets/MatchPodcastPlayer-BSeYEMmg.js

js sokapal.ai collected 2026-10-05 15:16:44 UTC 9,722 bytes, 1 lines download raw bytes

1import{r as e,j as t}from"./vendor-react-DbsVTsKS.js";import{d as s,t as r,ag as a}from"./index-Dirtnqiz.js";import{j as i,F as o,G as n,o as l,J as c,K as d,O as x}from"./vendor-ui-B_XW8Pya.js";import"./vendor-i18n-DiTKF2NC.js";import"./vendor-charts-CG7l663-.js";import"./vendor-otel-B3hnpEUX.js";import"./app-constants-D3ojol5R.js";import"./vendor-virtuoso-CT6D0QVj.js";import"./vendor-markdown-CiT-VfZw.js";const u=({audioUrl:u,title:h="Match Podcast",matchInfo:b=null,variant:p="full",podcastType:m="prematch",className:g="",onPlay:f=null,onPause:y=null,onEnded:j=null,onExpandedChange:v=null})=>{const{isDarkMode:N}=s(),k=e.useRef(null),{createCounter:w,createHistogram:C}=r("podcast-player"),z=e.useMemo(()=>w("podcast_plays",{description:"Number of podcast play events",unit:"plays"}),[w]),P=e.useMemo(()=>w("podcast_pauses",{description:"Number of podcast pause events",unit:"pauses"}),[w]),$=e.useMemo(()=>w("podcast_skips",{description:"Number of podcast skip events",unit:"skips"}),[w]),M=e.useMemo(()=>C("podcast_listen_duration",{description:"Duration of podcast listening sessions",unit:"seconds"}),[C]),_=e.useMemo(()=>C("podcast_completion_percentage",{description:"Percentage of podcast completed",unit:"percent"}),[C]),S=e.useRef(null),R=e.useRef(0),[D,T]=e.useState(!1),[B,E]=e.useState(!1),[U,W]=e.useState(!1),[F,A]=e.useState(0),[G,H]=e.useState(0),[I,J]=e.useState(null),K=e.useRef(D),L=e.useRef(F),O=e.useRef(G),V=e.useRef(j);e.useEffect(()=>{K.current=D,L.current=F,O.current=G,V.current=j}),e.useEffect(()=>{if(!u)return;return a.subscribe(u,e=>{const t=K.current;if(e.isPlaying&&!t)S.current=Date.now(),R.current=e.currentTime,z(1,{podcast_type:m,variant:p,has_match_info:!!b});else if(!e.isPlaying&&t){if(S.current){const e=(Date.now()-S.current)/1e3;M(e,{podcast_type:m,variant:p}),S.current=null}P(1,{podcast_type:m,variant:p})}T(e.isPlaying),E(e.isLoading),A(e.currentTime),H(e.duration),J(e.error)},e=>{var t;const s=O.current,r=L.current;if(s>0&&_(r/s*100,{podcast_type:m,variant:p}),S.current){const e=(Date.now()-S.current)/1e3;M(e,{podcast_type:m,variant:p,completed:!0}),S.current=null}null==(t=V.current)||t.call(V,e)})},[u,m,p,b,z,P,M,_]);const X=async()=>{u&&await a.togglePlayPause(u)},q=e=>{if(!G)return;const t=k.current.getBoundingClientRect(),s=(e.clientX-t.left)/t.width*G;a.seekTo(s)},Q=e=>{$(1,{direction:e>0?"forward":"backward",seconds:Math.abs(e),podcast_type:m,variant:p}),a.skip(e)},Y=()=>{const e=!U;W(e),a.setMuted(e)},Z=e=>{if(!e||isNaN(e))return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`},ee=G>0?F/G*100:0;if(!u)return t.jsx("div",{className:`p-3 bg-gray-50 border border-gray-200 rounded-lg ${g}`,children:t.jsx("div",{className:"text-center text-gray-500 text-sm",children:"🎧 Podcast not available for this match"})});const te="postmatch"===m?{iconColor:N?"text-green-400":"text-green-600",hoverBg:N?"hover:bg-green-900/30":"hover:bg-green-50",accentColor:"border-green-500",badge:"✓",tooltip:"Post-Match Analysis"}:{iconColor:N?"text-blue-400":"text-blue-600",hoverBg:N?"hover:bg-blue-900/30":"hover:bg-blue-50",accentColor:"border-blue-500",badge:"◐",tooltip:"Pre-Match Preview"};return"minimal"===p?t.jsxs("div",{className:`relative podcast-player-container ${g}`,children:[t.jsxs("div",{className:"relative",children:[t.jsx("button",{onClick:e=>{e.stopPropagation(),X()},disabled:B||I,className:`p-1 rounded-sm transition-colors border ${D?`${te.accentColor} border-2`:N?"border-gray-600":"border-gray-300"} ${te.hoverBg} disabled:opacity-50`,title:`${D?"Pause":"Play"} ${te.tooltip}`,children:B?t.jsx(i,{size:18,className:`animate-spin ${te.iconColor}`}):D?t.jsx(o,{size:18,className:te.iconColor}):t.jsx(n,{size:18,className:te.iconColor})}),t.jsx("span",{className:"absolute -top-1 -right-1 text-[8px] w-3 h-3 flex items-center justify-center rounded-full "+("postmatch"===m?N?"bg-green-500 text-white":"bg-green-600 text-white":N?"bg-blue-500 text-white":"bg-blue-600 text-white"),title:te.tooltip,children:te.badge})]}),D&&t.jsxs("div",{className:"absolute top-1/2 left-full ml-2 -translate-y-1/2 z-50 flex items-center gap-1.5 rounded-lg shadow-xl border-2 px-2 py-1.5 "+(N?"bg-gray-800 border-gray-600":"bg-white border-gray-300"),children:[t.jsx("button",{onClick:e=>{e.stopPropagation(),Q(-10)},disabled:!G,className:`flex-shrink-0 w-7 h-7 rounded-md disabled:opacity-50 transition-all font-bold ${N?"text-gray-200 hover:text-white hover:bg-gray-700 border border-gray-600":"text-gray-700 hover:text-gray-900 hover:bg-gray-100 border border-gray-400"}
1 flex items-center justify-center`,title:"Skip back 10 seconds",children:t.jsx(l,{size:14,strokeWidth:2.5})}),t.jsx("div",{className:"w-28 h-3 rounded-full cursor-pointer border flex-shrink-0 "+(N?"bg-gray-700 border-gray-600":"bg-gray-200 border-gray-300"),onClick:q,ref:k,children:t.jsx("div",{className:"h-full bg-blue-500 rounded-full transition-all duration-100 shadow-sm",style:{width:`${ee}%`}})}),t.jsx("button",{onClick:e=>{e.stopPropagation(),Q(10)},disabled:!G,className:`flex-shrink-0 w-7 h-7 rounded-md disabled:opacity-50 transition-all font-bold ${N?"text-gray-200 hover:text-white hover:bg-gray-700 border border-gray-600":"text-gray-700 hover:text-gray-900 hover:bg-gray-100 border border-gray-400"} flex items-center justify-center`,title:"Skip forward 10 seconds",children:t.jsx(c,{size:14,strokeWidth:2.5})}),t.jsx("button",{onClick:e=>{e.stopPropagation(),Y()},className:`flex-shrink-0 w-7 h-7 rounded-md transition-all font-bold ${N?"text-gray-200 hover:text-white hover:bg-gray-700 border border-gray-600":"text-gray-700 hover:text-gray-900 hover:bg-gray-100 border border-gray-400"} flex items-center justify-center`,title:U?"Unmute":"Mute",children:U?t.jsx(d,{size:14,strokeWidth:2.5}):t.jsx(x,{size:14,strokeWidth:2.5})}),t.jsxs("span",{className:"text-[10px] font-bold min-w-[42px] text-center flex-shrink-0 "+(N?"text-gray-200":"text-gray-800"),children:[Z(F)," / ",Z(G)]}),I&&t.jsx("span",{className:"text-red-500 text-xs",children:"⚠️"})]})]}):"compact"===p?t.jsxs("div",{className:`flex items-center space-x-2 p-2 bg-white border border-gray-200 rounded-md shadow-sm ${g}`,children:[t.jsx("button",{onClick:X,disabled:B||I,className:"flex-shrink-0 w-6 h-6 bg-blue-500 hover:bg-blue-600 disabled:bg-gray-400 text-white rounded-full flex items-center justify-center transition-colors",children:B?t.jsx(i,{size:10,className:"animate-spin"}):D?t.jsx(o,{size:10}):t.jsx(n,{size:10,className:"ml-0.5"})}),t.jsx("button",{onClick:()=>Q(-10),disabled:!G,className:"flex-shrink-0 w-5 h-5 text-gray-400 hover:text-gray-600 disabled:opacity-50 transition-colors flex items-center justify-center",title:"Skip back 10 seconds",children:t.jsx(l,{size:10})}),t.jsx("div",{className:"flex-1 h-1 bg-gray-200 rounded-full cursor-pointer",onClick:q,ref:k,children:t.jsx("div",{className:"h-full bg-blue-500 rounded-full transition-all duration-100",style:{width:`${ee}%`}})}),t.jsx("button",{onClick:()=>Q(10),disabled:!G,className:"flex-shrink-0 w-5 h-5 text-gray-400 hover:text-gray-600 disabled:opacity-50 transition-colors flex items-center justify-center",title:"Skip forward 10 seconds",children:t.jsx(c,{size:10})}),t.jsx("button",{onClick:Y,className:"flex-shrink-0 w-5 h-5 text-gray-400 hover:text-gray-600 transition-colors flex items-center justify-center",title:U?"Unmute":"Mute",children:U?t.jsx(d,{size:10}):t.jsx(x,{size:10})}),t.jsx("span",{className:"text-xs text-gray-600 min-w-[30px] text-center flex-shrink-0",children:Z(F)}),I&&t.jsx("div",{className:"text-red-500 text-xs flex-shrink-0",children:"⚠️"})]}):t.jsx("div",{className:`bg-white border border-gray-200 rounded-lg shadow-sm ${g}`,children:t.jsx("div",{className:"px-3 py-3",children:I?t.jsxs("div",{className:"text-center text-red-500 text-sm py-2",children:[t.jsxs("p",{className:"text-xs",children:["⚠️ ",I]}),t.jsx("button",{onClick:()=>{J(null),u&&a.play(u)},className:"mt-1 text-blue-500 hover:text-blue-600 text-xs underline",children:"Try again"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-1.5",children:[t.jsx("div",{className:"w-full h-1.5 bg-gray-200 rounded-full cursor-pointer",onClick:q,ref:k,children:t.jsx("div",{className:"h-full bg-blue-500 rounded-full transition-all duration-100",style:{width:`${ee}%`}})}),t.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mt-1",children:[t.jsx("span",{children:Z(F)}),t.jsx("span",{children:Z(G)})]})]}),t.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[t.jsxs("button",{onClick:()=>Q(-10),disabled:!G,className:"p-1.5 text-gray-400 hover:text-gray-600 disabled:opacity-50 transition-colors flex flex-col items-center",title:"Skip back 10 seconds",children:[t.jsx(l,{size:16}),t.jsx("span",{className:"text-xs mt-0.5",children:"10s"})]}),t.jsx("button",{onClick:X,disabled:B,className:"w-10 h-10 bg-blue-500 hover:bg-blue-600 disabled:bg-gray-400 text-white rounded-full flex items-center justify-center transition-colors",children:B?t.jsx(i,{size:18,className:"animate-spin"}):D?t.jsx(o,{size:18}):t.jsx(n,{size:18,className:"ml-0.5"})}),t.jsxs("button",{onClick:()=>Q(10),disabled:!G,className:"p-1.5 text-gray-400 hover:text-gray-600 disabled:opacity-50 transition-colors flex flex-col items-center",title:"Skip forward 10 seconds",children:[t.jsx(c,{size:16}),t.jsx("span",{className:"text-xs mt-0.5",children:"10s"})]}),t.jsxs("button",{onClick:Y,className:"p-1.5 text-gray-400 hover:text-gray-600 transition-colors flex flex-col items-center",title:U?"Unmute":"Mute",children:[U?t.jsx(d,{size:16}):t.jsx(x,{size:16}),t.jsx("span",{className:"text-xs mt-0.5",children:U?"Muted":"Vol"})]})]})]})})})};export{u as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.