@therealtinhtute/baroiplayer 1.1.0 → 1.2.0

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 (78) hide show
  1. package/dist/core-plugins-By-4-kGs.cjs +2 -0
  2. package/dist/core-plugins-By-4-kGs.cjs.map +1 -0
  3. package/dist/{core-plugins-CROGvQUy.js → core-plugins-DSBWcTuX.js} +444 -309
  4. package/dist/core-plugins-DSBWcTuX.js.map +1 -0
  5. package/dist/core.js +2 -2
  6. package/dist/core.mjs +19 -19
  7. package/dist/{enhanced-components-DUw2KrmQ.js → enhanced-components-B_l3cist.js} +2 -2
  8. package/dist/{enhanced-components-DUw2KrmQ.js.map → enhanced-components-B_l3cist.js.map} +1 -1
  9. package/dist/{enhanced-components-DXBCHU0v.cjs → enhanced-components-BspFs9OO.cjs} +2 -2
  10. package/dist/{enhanced-components-DXBCHU0v.cjs.map → enhanced-components-BspFs9OO.cjs.map} +1 -1
  11. package/dist/hooks-BXwI8QG6.cjs +4 -0
  12. package/dist/hooks-BXwI8QG6.cjs.map +1 -0
  13. package/dist/hooks-Bpi-jDiO.js +1816 -0
  14. package/dist/hooks-Bpi-jDiO.js.map +1 -0
  15. package/dist/index.js +2 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +18 -20
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/{minimal-components-DlRK7Qu_.js → minimal-components-C4z900Ro.js} +297 -298
  20. package/dist/minimal-components-C4z900Ro.js.map +1 -0
  21. package/dist/minimal-components-v4qBp6jv.cjs +2 -0
  22. package/dist/minimal-components-v4qBp6jv.cjs.map +1 -0
  23. package/package.json +1 -1
  24. package/src/components/accessibility/keyboard-help-overlay.tsx +2 -0
  25. package/src/components/enhanced/debug-panel.tsx +1 -1
  26. package/src/components/enhanced/enhanced-media-player.tsx +68 -25
  27. package/src/components/legacy.tsx +6 -6
  28. package/src/components/media-player-video.tsx +5 -12
  29. package/src/components/media-player.tsx +2 -2
  30. package/src/components/ui/enhanced-seek-bar.tsx +2 -2
  31. package/src/components/ui/media-resource-preloader.tsx +21 -23
  32. package/src/components/unified/base-media-player.tsx +22 -10
  33. package/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +58 -38
  34. package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +6 -6
  35. package/src/core/optimization/bundle-optimizer.tsx +26 -27
  36. package/src/core/plugins/__tests__/registry.test.ts +1 -1
  37. package/src/core/plugins/enhanced-plugin-system.ts +26 -8
  38. package/src/core/plugins/registry.ts +319 -92
  39. package/src/core/plugins/types.ts +21 -3
  40. package/src/core/providers/enhanced-hls-provider.ts +11 -40
  41. package/src/core/providers/lazy-provider.tsx +5 -42
  42. package/src/features/media-session/media-session-manager.ts +4 -26
  43. package/src/features/picture-in-picture/pip-manager.ts +2 -2
  44. package/src/features/playlist/playlist-manager.ts +26 -18
  45. package/src/features/subtitles/subtitle-manager.ts +1 -1
  46. package/src/features/subtitles/subtitle-parser.ts +19 -16
  47. package/src/features/thumbnails/thumbnail-generator.ts +12 -5
  48. package/src/hooks/__tests__/currentTime-fix.test.ts +149 -0
  49. package/src/hooks/accessibility/use-accessibility-preferences.ts +1 -1
  50. package/src/hooks/accessibility/use-focus-management.ts +2 -2
  51. package/src/hooks/accessibility/use-keyboard-shortcuts.ts +2 -2
  52. package/src/hooks/accessibility/use-screen-reader.ts +1 -1
  53. package/src/hooks/core/index.ts +1 -1
  54. package/src/hooks/use-buffer-health.ts +1 -1
  55. package/src/hooks/use-enhanced-media-player.ts +107 -9
  56. package/src/hooks/use-focus-trap.tsx +2 -2
  57. package/src/hooks/use-intelligent-preloading.ts +23 -3
  58. package/src/hooks/use-keyboard-shortcuts.ts +2 -2
  59. package/src/hooks/use-media-player.ts +74 -43
  60. package/src/hooks/use-memory-optimization.ts +15 -15
  61. package/src/hooks/use-smart-preload.ts +1 -2
  62. package/src/hooks/useKeyboardShortcuts.ts +34 -2
  63. package/src/hooks/useVideoPlayer.ts +50 -4
  64. package/src/index-legacy.ts +3 -5
  65. package/src/test/accessibility-utils.ts +7 -7
  66. package/src/test/media-mocks.ts +41 -28
  67. package/src/test/setup.ts +22 -4
  68. package/src/types/index.ts +13 -0
  69. package/dist/core-plugins-CROGvQUy.js.map +0 -1
  70. package/dist/core-plugins-DtsHBOtF.cjs +0 -2
  71. package/dist/core-plugins-DtsHBOtF.cjs.map +0 -1
  72. package/dist/hooks-BW-JjVgP.cjs +0 -4
  73. package/dist/hooks-BW-JjVgP.cjs.map +0 -1
  74. package/dist/hooks-CyX6De5M.js +0 -1693
  75. package/dist/hooks-CyX6De5M.js.map +0 -1
  76. package/dist/minimal-components-Bdcpxav5.cjs +0 -2
  77. package/dist/minimal-components-Bdcpxav5.cjs.map +0 -1
  78. package/dist/minimal-components-DlRK7Qu_.js.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("./context-eNS62_ac.cjs"),o=require("react"),x=require("./utils-CFOue_9K.cjs");function Y(...u){return i=>{u.forEach(s=>{typeof s=="function"?s(i):s&&(s.current=i)})}}function W(u,i,s,n){const[t,a]=o.useState(!0),[r,c]=o.useState(!1),[l,p]=o.useState(!1),d=o.useRef(null),v=o.useCallback(()=>{d.current&&clearTimeout(d.current),u&&(d.current=setTimeout(()=>{!r&&!l&&a(!1)},i))},[u,i,r,l]),N=o.useCallback(()=>{a(!0),v()},[v]);o.useEffect(()=>(u?v():a(!0),()=>{d.current&&clearTimeout(d.current)}),[u,v]);const f=o.useCallback(()=>{s&&(c(!0),a(!0))},[s]),R=o.useCallback(()=>{s&&(c(!1),v())},[s,v]),m=o.useCallback(()=>{n&&(p(!0),N())},[n,N]),b=o.useCallback(()=>{n&&(p(!1),v())},[n,v]);return{showControls:t,showControlsTemporarily:N,handleMouseEnter:f,handleMouseLeave:R,handleTouchStart:m,handleTouchEnd:b}}function Q(u){const i=e.useMediaDispatch(),s=e.useMediaSelector(f=>f.isPlaying),n=e.useMediaSelector(f=>f.currentTime),t=e.useMediaSelector(f=>f.duration),a=e.useMediaSelector(f=>f.volume),[r,c]=o.useState(null),[l,p]=o.useState(!1),d=o.useCallback(f=>{if(!u)return;const R=f.touches[0];if(!R)return;const m=Date.now();r&&m-r.time<300?(p(!0),i({type:s?e.MediaActionTypes.PAUSE:e.MediaActionTypes.PLAY})):(c({x:R.clientX,y:R.clientY,time:m}),p(!1))},[u,r,s,i]),v=o.useCallback(f=>{if(!u||!r||l)return;const R=f.touches[0];if(!R)return;const m=R.clientX-r.x,b=R.clientY-r.y;if(Math.abs(m)>Math.abs(b)&&Math.abs(m)>50){const g=m/window.innerWidth*30,M=Math.max(0,Math.min(t,n+g));i({type:e.MediaActionTypes.SEEK,detail:M})}if(Math.abs(b)>Math.abs(m)&&Math.abs(b)>50&&r.x>window.innerWidth/2){const g=-(b/window.innerHeight)*1,M=Math.max(0,Math.min(1,a+g));i({type:e.MediaActionTypes.SET_VOLUME,detail:M})}},[u,r,l,t,n,a,i]),N=o.useCallback(()=>{u&&setTimeout(()=>{c(null),p(!1)},300)},[u]);return{handleTouchStart:d,handleTouchMove:v,handleTouchEnd:N}}const D=function({children:i,className:s,autoHide:n=!0,autoHideDelay:t=3e3,showControlsOnHover:a=!0,showControlsOnTouch:r=!0,enableKeyboardControls:c=!0,enableTouchGestures:l=!0,onPlay:p,onPause:d,onTimeUpdate:v,onVolumeChange:N,onFullscreenChange:f}){const R=e.useMediaContext(),m=e.useMediaDispatch(),b=e.useMediaSelector(o.useCallback(y=>y.isPlaying,[])),g=e.useMediaSelector(o.useCallback(y=>y.isFullscreen,[])),M=e.useMediaSelector(o.useCallback(y=>y.currentTime,[])),C=e.useMediaSelector(o.useCallback(y=>y.volume,[])),h=e.useMediaSelector(o.useCallback(y=>y.error,[])),{showControls:j,showControlsTemporarily:S,handleMouseEnter:k,handleMouseLeave:P,handleTouchStart:E,handleTouchEnd:w}=W(n,t,a,r),{handleTouchStart:A,handleTouchMove:L,handleTouchEnd:z}=Q(l),$=o.useCallback(y=>{E(),A(y)},[E,A]),X=o.useCallback(()=>{w(),z()},[w,z]),G=o.useCallback(()=>{S()},[S]);return o.useEffect(()=>{if(!c)return;const y=T=>{if(!(T.target instanceof HTMLInputElement||T.target instanceof HTMLTextAreaElement))switch(T.code){case"Space":case"KeyK":T.preventDefault(),m({type:b?e.MediaActionTypes.PAUSE:e.MediaActionTypes.PLAY});break;case"KeyF":T.preventDefault(),m({type:g?e.MediaActionTypes.EXIT_FULLSCREEN:e.MediaActionTypes.ENTER_FULLSCREEN});break;case"KeyM":T.preventDefault(),m({type:e.MediaActionTypes.TOGGLE_MUTE});break;case"ArrowLeft":T.preventDefault(),m({type:e.MediaActionTypes.SEEK,detail:Math.max(0,M-10)});break;case"ArrowRight":T.preventDefault(),m({type:e.MediaActionTypes.SEEK,detail:M+10});break;case"ArrowUp":T.preventDefault(),m({type:e.MediaActionTypes.SET_VOLUME,detail:Math.min(1,C+.1)});break;case"ArrowDown":T.preventDefault(),m({type:e.MediaActionTypes.SET_VOLUME,detail:Math.max(0,C-.1)});break}};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[c,m,b,g,M,C]),o.useEffect(()=>{b?p?.():d?.()},[b,p,d]),o.useEffect(()=>{v?.(M)},[M,v]),o.useEffect(()=>{N?.(C)},[C,N]),o.useEffect(()=>{f?.(g)},[g,f]),e.jsxRuntimeExports.jsx("div",{ref:Y(R.rootRef),className:x.cn("relative isolate flex flex-col overflow-hidden rounded-lg bg-black outline-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",g&&"fixed inset-0 z-50 rounded-none",s),"data-state":g?"fullscreen":"inline","data-disabled":h?"":void 0,"data-controls-visible":j?"":void 0,tabIndex:0,onMouseEnter:k,onMouseLeave:P,onTouchStart:$,onTouchMove:L,onTouchEnd:X,onClick:G,children:i})};D.displayName="EnhancedMediaPlayer";const F=function({qualities:i,currentQuality:s,onQualityChange:n,className:t}){const[a,r]=o.useState(!1),c=o.useMemo(()=>i.find(l=>l.id===s)?.label||"Auto",[i,s]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("relative",t),children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!a),className:"flex items-center gap-2 rounded-lg bg-black/50 px-3 py-2 text-white transition-colors hover:bg-black/70","aria-label":"Select quality",children:[e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4",children:e.jsxRuntimeExports.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:c}),e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:x.cn("h-4 w-4 transition-transform",a&&"rotate-180"),children:e.jsxRuntimeExports.jsx("path",{d:"M7 10l5 5 5-5z"})})]}),a&&e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 bottom-full mb-2 min-w-32 rounded-lg border border-white/20 bg-black/90 py-2 backdrop-blur-sm",children:i.map(l=>e.jsxRuntimeExports.jsxs("button",{onClick:()=>{n(l.id),r(!1)},className:x.cn("w-full px-4 py-2 text-left text-sm text-white transition-colors hover:bg-white/10",l.id===s&&"bg-primary/20 text-primary"),children:[l.label,l.bitrate&&e.jsxRuntimeExports.jsxs("span",{className:"ml-2 text-white/60 text-xs",children:["(",Math.round(l.bitrate/1e3),"k)"]})]},l.id))})]})},V=function({subtitles:i,currentSubtitle:s,onSubtitleChange:n,className:t}){const[a,r]=o.useState(!1),c=o.useMemo(()=>s&&i.find(l=>l.id===s)?.label||"Off",[i,s]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("relative",t),children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!a),className:"flex items-center gap-2 rounded-lg bg-black/50 px-3 py-2 text-white transition-colors hover:bg-black/70","aria-label":"Select subtitles",children:[e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4",children:e.jsxRuntimeExports.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM4 12h4v2H4v-2zm10 6H4v-2h10v2zm6 0h-4v-2h4v2zm0-4H10v-2h10v2z"})}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:c}),e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:x.cn("h-4 w-4 transition-transform",a&&"rotate-180"),children:e.jsxRuntimeExports.jsx("path",{d:"M7 10l5 5 5-5z"})})]}),a&&e.jsxRuntimeExports.jsxs("div",{className:"absolute right-0 bottom-full mb-2 min-w-32 rounded-lg border border-white/20 bg-black/90 py-2 backdrop-blur-sm",children:[e.jsxRuntimeExports.jsx("button",{onClick:()=>{n(null),r(!1)},className:x.cn("w-full px-4 py-2 text-left text-sm text-white transition-colors hover:bg-white/10",!s&&"bg-primary/20 text-primary"),children:"Off"}),i.map(l=>e.jsxRuntimeExports.jsx("button",{onClick:()=>{n(l.id),r(!1)},className:x.cn("w-full px-4 py-2 text-left text-sm text-white transition-colors hover:bg-white/10",l.id===s&&"bg-primary/20 text-primary"),children:l.label},l.id))]})]})},I=function({className:i}){const s=e.useMediaDispatch(),n=e.useMediaSelector(l=>l.playbackRate),[t,a]=o.useState(!1),r=[.25,.5,.75,1,1.25,1.5,1.75,2],c=o.useCallback(l=>{s({type:e.MediaActionTypes.SET_PLAYBACK_RATE,detail:l}),a(!1)},[s]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("relative",i),children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>a(!t),className:"flex items-center gap-2 rounded-lg bg-black/50 px-3 py-2 text-white transition-colors hover:bg-black/70","aria-label":"Select playback speed",children:[e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4",children:e.jsxRuntimeExports.jsx("path",{d:"M13,8A4,4 0 0,0 9,12A4,4 0 0,0 13,16A4,4 0 0,0 17,12A4,4 0 0,0 13,8M13,14A2,2 0 0,1 11,12A2,2 0 0,1 13,10A2,2 0 0,1 15,12A2,2 0 0,1 13,14M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4Z"})}),e.jsxRuntimeExports.jsxs("span",{className:"text-sm",children:[n,"x"]}),e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:x.cn("h-4 w-4 transition-transform",t&&"rotate-180"),children:e.jsxRuntimeExports.jsx("path",{d:"M7 10l5 5 5-5z"})})]}),t&&e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 bottom-full mb-2 min-w-20 rounded-lg border border-white/20 bg-black/90 py-2 backdrop-blur-sm",children:r.map(l=>e.jsxRuntimeExports.jsxs("button",{onClick:()=>c(l),className:x.cn("w-full px-4 py-2 text-left text-sm text-white transition-colors hover:bg-white/10",l===n&&"bg-primary/20 text-primary"),children:[l,"x"]},l))})]})},_=function({chapters:i,onChapterSelect:s,className:n}){const t=e.useMediaSelector(r=>r.currentTime),a=o.useMemo(()=>i.find(r=>t>=r.startTime&&t<r.endTime),[i,t]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("rounded-lg border border-white/20 bg-black/90 p-4 backdrop-blur-sm",n),children:[e.jsxRuntimeExports.jsx("h3",{className:"mb-3 font-semibold text-white",children:"Chapters"}),e.jsxRuntimeExports.jsx("div",{className:"max-h-64 space-y-2 overflow-y-auto",children:i.map(r=>e.jsxRuntimeExports.jsxs("button",{onClick:()=>s(r),className:x.cn("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors","hover:bg-white/10",r.id===a?.id&&"border border-primary/30 bg-primary/20"),children:[r.thumbnail&&e.jsxRuntimeExports.jsx("img",{src:r.thumbnail,alt:r.title,className:"h-9 w-16 rounded object-cover"}),e.jsxRuntimeExports.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxRuntimeExports.jsx("div",{className:"truncate font-medium text-white",children:r.title}),e.jsxRuntimeExports.jsxs("div",{className:"text-sm text-white/60",children:[x.formatTime(r.startTime)," - ",x.formatTime(r.endTime)]})]})]},r.id))})]})},H=function({className:i}){const s=e.useMediaDispatch(),n=e.useMediaSelector(a=>a.isPictureInPicture),t=o.useCallback(()=>{s({type:n?e.MediaActionTypes.EXIT_PIP:e.MediaActionTypes.ENTER_PIP})},[s,n]);return e.jsxRuntimeExports.jsx("button",{type:"button",onClick:t,className:x.cn("flex h-10 w-10 items-center justify-center rounded-full text-white","transition-colors hover:bg-white/10",i),"aria-label":n?"Exit Picture-in-Picture":"Enter Picture-in-Picture",children:e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:e.jsxRuntimeExports.jsx("path",{d:"M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14z"})})})},q=Object.freeze(Object.defineProperty({__proto__:null,ChaptersPanel:_,PictureInPictureButton:H,PlaybackSpeedSelector:I,QualitySelector:F,SubtitleSelector:V},Symbol.toStringTag,{value:"Module"})),O=function({className:i,size:s="md"}){const n=e.useMediaDispatch(),t=e.useMediaSelector(p=>p.isPlaying),a=e.useMediaSelector(p=>p.isLoading),r={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12",xl:"h-16 w-16"},c={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-8 w-8"},l=o.useCallback(()=>{n({type:t?e.MediaActionTypes.PAUSE:e.MediaActionTypes.PLAY})},[n,t]);return e.jsxRuntimeExports.jsx("button",{type:"button",onClick:l,disabled:a,className:x.cn("group relative flex items-center justify-center rounded-full bg-white/10 backdrop-blur-sm","border border-white/20 text-white transition-all duration-200","hover:scale-105 hover:bg-white/20 active:scale-95","focus:outline-none focus:ring-2 focus:ring-white/50","disabled:cursor-not-allowed disabled:opacity-50",r[s],i),"aria-label":t?"Pause":"Play",children:a?e.jsxRuntimeExports.jsx("div",{className:x.cn("animate-spin rounded-full border-2 border-white/30 border-t-white",c[s])}):e.jsxRuntimeExports.jsx("div",{className:x.cn("transition-transform duration-200",c[s]),children:t?e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full",children:e.jsxRuntimeExports.jsx("path",{d:"M6 4h4v16H6V4zm8 0h4v16h-4V4z"})}):e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"ml-0.5 h-full w-full",children:e.jsxRuntimeExports.jsx("path",{d:"M8 5v14l11-7z"})})})})},K=function({className:i}){const s=e.useMediaDispatch(),n=e.useMediaSelector(h=>h.currentTime),t=e.useMediaSelector(h=>h.duration),a=e.useMediaSelector(h=>h.buffered),r=e.useMediaSelector(h=>h.previewTime),[c,l]=o.useState(!1),[p,d]=o.useState(null),v=o.useRef(null),N=t>0?n/t*100:0,f=t>0&&r!==null?r/t*100:null,R=o.useMemo(()=>{if(!a||t===0)return[];const h=[];for(let j=0;j<a.length;j++)h.push({start:a.start(j)/t*100,end:a.end(j)/t*100});return h},[a,t]),m=o.useCallback(h=>{if(!v.current)return 0;const j=v.current.getBoundingClientRect();return Math.max(0,Math.min(1,(h-j.left)/j.width))*t},[t]),b=o.useCallback(h=>{if(!c){const j=m(h.clientX);d(j),s({type:e.MediaActionTypes.PREVIEW_TIME,detail:j})}},[c,m,s]),g=o.useCallback(()=>{c||(d(null),s({type:e.MediaActionTypes.CLEAR_PREVIEW}))},[c,s]),M=o.useCallback(h=>{l(!0);const j=m(h.clientX);s({type:e.MediaActionTypes.SEEK,detail:j})},[m,s]),C=o.useCallback(h=>{l(!0);const j=m(h.touches[0]?.clientX||0);s({type:e.MediaActionTypes.SEEK,detail:j})},[m,s]);return o.useEffect(()=>{const h=k=>{if(c){const P=m(k.clientX);s({type:e.MediaActionTypes.SEEK,detail:P})}},j=()=>{l(!1),d(null),s({type:e.MediaActionTypes.CLEAR_PREVIEW})},S=k=>{if(c){const P=m(k.touches[0]?.clientX||0);s({type:e.MediaActionTypes.SEEK,detail:P})}};return c&&(document.addEventListener("mousemove",h),document.addEventListener("mouseup",j),document.addEventListener("touchmove",S),document.addEventListener("touchend",j)),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",j),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",j)}},[c,m,s]),e.jsxRuntimeExports.jsxs("div",{className:x.cn("group relative flex items-center",i),children:[(p!==null||r!==null)&&e.jsxRuntimeExports.jsx("div",{className:"pointer-events-none absolute bottom-full mb-2 rounded bg-black/80 px-2 py-1 text-white text-xs",style:{left:`${f||(p||0)/t*100}%`,transform:"translateX(-50%)"},children:x.formatTime(p||r||0)}),e.jsxRuntimeExports.jsxs("div",{ref:v,className:"relative h-2 w-full cursor-pointer rounded-full bg-white/20 transition-all duration-200 group-hover:h-3",onMouseMove:b,onMouseLeave:g,onMouseDown:M,onTouchStart:C,children:[R.map((h,j)=>e.jsxRuntimeExports.jsx("div",{className:"absolute top-0 h-full rounded-full bg-white/30",style:{left:`${h.start}%`,width:`${h.end-h.start}%`}},j)),e.jsxRuntimeExports.jsx("div",{className:"absolute top-0 h-full rounded-full bg-primary transition-all duration-100",style:{width:`${N}%`}}),f!==null&&e.jsxRuntimeExports.jsx("div",{className:"absolute top-0 h-full w-1 rounded-full bg-white/80",style:{left:`${f}%`}}),e.jsxRuntimeExports.jsx("div",{className:"-translate-y-1/2 absolute top-1/2 h-4 w-4 rounded-full border-2 border-white bg-primary opacity-0 shadow-lg transition-all duration-200 group-hover:opacity-100",style:{left:`${N}%`,transform:"translateX(-50%) translateY(-50%)"}})]})]})},U=function({className:i}){const s=e.useMediaDispatch(),n=e.useMediaSelector(d=>d.volume),t=e.useMediaSelector(d=>d.isMuted),[a,r]=o.useState(!1),c=o.useCallback(()=>{s({type:e.MediaActionTypes.TOGGLE_MUTE})},[s]),l=o.useCallback(d=>{s({type:e.MediaActionTypes.SET_VOLUME,detail:d})},[s]),p=o.useMemo(()=>t||n===0?e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:e.jsxRuntimeExports.jsx("path",{d:"M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"})}):n<.5?e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:e.jsxRuntimeExports.jsx("path",{d:"M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z"})}):e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:e.jsxRuntimeExports.jsx("path",{d:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"})}),[t,n]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("relative flex items-center",i),onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:c,className:"flex h-10 w-10 items-center justify-center rounded-full text-white transition-colors hover:bg-white/10","aria-label":t?"Unmute":"Mute",children:p}),e.jsxRuntimeExports.jsx("div",{className:x.cn("absolute left-full ml-2 flex items-center transition-all duration-200",a?"translate-x-0 opacity-100":"-translate-x-2 pointer-events-none opacity-0"),children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:t?0:n,onChange:d=>l(parseFloat(d.target.value)),className:"slider h-1 w-20 cursor-pointer appearance-none rounded-lg bg-white/20"})})]})},J=function({className:i,size:s="md",skipTime:n=10}){const t=e.useMediaDispatch(),a=e.useMediaSelector(p=>p.currentTime),r={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"},c={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},l=o.useCallback(()=>{const p=Math.max(0,a-n);t({type:e.MediaActionTypes.SEEK,detail:p})},[t,a,n]);return e.jsxRuntimeExports.jsx("button",{type:"button",onClick:l,className:x.cn("group relative flex items-center justify-center rounded-full bg-white/10 backdrop-blur-sm","border border-white/20 text-white transition-all duration-200","hover:scale-105 hover:bg-white/20 active:scale-95","focus:outline-none focus:ring-2 focus:ring-white/50",r[s],i),"aria-label":`Backward ${n} seconds`,title:`Backward ${n}s`,children:e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center transition-transform duration-200",c[s]),children:[e.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full",children:[e.jsxRuntimeExports.jsx("path",{d:"M7 6c.55 0 1 .45 1 1v10c0 .55-.45 1-1 1s-1-.45-1-1V7c0-.55.45-1 1-1zM15.5 7.5c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v9c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-9z"}),e.jsxRuntimeExports.jsx("path",{d:"M5.5 12l7-4.5v9l-7-4.5z",opacity:"0.8"})]}),n&&e.jsxRuntimeExports.jsx("span",{className:"-bottom-1 absolute font-bold text-[10px]",children:n})]})})},Z=function({className:i,size:s="md",skipTime:n=10}){const t=e.useMediaDispatch(),a=e.useMediaSelector(d=>d.currentTime),r=e.useMediaSelector(d=>d.duration),c={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"},l={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},p=o.useCallback(()=>{const d=Math.min(r,a+n);t({type:e.MediaActionTypes.SEEK,detail:d})},[t,a,r,n]);return e.jsxRuntimeExports.jsx("button",{type:"button",onClick:p,className:x.cn("group relative flex items-center justify-center rounded-full bg-white/10 backdrop-blur-sm","border border-white/20 text-white transition-all duration-200","hover:scale-105 hover:bg-white/20 active:scale-95","focus:outline-none focus:ring-2 focus:ring-white/50",c[s],i),"aria-label":`Forward ${n} seconds`,title:`Forward ${n}s`,children:e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center transition-transform duration-200",l[s]),children:[e.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full",children:[e.jsxRuntimeExports.jsx("path",{d:"M17 6c.55 0 1 .45 1 1v10c0 .55-.45 1-1 1s-1-.45-1-1V7c0-.55.45-1 1-1zM8.5 7.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5v9c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5v-9z"}),e.jsxRuntimeExports.jsx("path",{d:"M18.5 12l-7-4.5v9l7-4.5z",opacity:"0.8"})]}),n&&e.jsxRuntimeExports.jsx("span",{className:"-bottom-1 absolute font-bold text-[10px]",children:n})]})})},B=function({variant:i="current",className:s}){const n=e.useMediaSelector(r=>r.currentTime),t=e.useMediaSelector(r=>r.duration),a=o.useMemo(()=>{switch(i){case"current":return x.formatTime(n);case"duration":return x.formatTime(t);case"remaining":return`-${x.formatTime(t-n)}`;default:return x.formatTime(n)}},[i,n,t]);return e.jsxRuntimeExports.jsx("div",{className:x.cn("font-mono text-sm text-white tabular-nums",s),children:a})},ee=function({metrics:i,className:s}){if(!i||process.env.NODE_ENV!=="development")return null;const n=a=>a>=50?"text-green-400":a>=30?"text-yellow-400":"text-red-400",t=a=>a>=5?"text-green-400":a>=2?"text-yellow-400":"text-red-400";return e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center gap-3 font-mono text-xs",s),children:[i.fps!==void 0&&e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center gap-1",n(i.fps)),children:[e.jsxRuntimeExports.jsx("div",{className:"h-2 w-2 rounded-full bg-current"}),e.jsxRuntimeExports.jsxs("span",{children:[i.fps," FPS"]})]}),i.bufferHealth!==void 0&&e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center gap-1",t(i.bufferHealth)),children:[e.jsxRuntimeExports.jsx("div",{className:"h-2 w-2 rounded-full bg-current"}),e.jsxRuntimeExports.jsxs("span",{children:[i.bufferHealth.toFixed(1),"s"]})]}),i.quality!==void 0&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 text-blue-400",children:[e.jsxRuntimeExports.jsx("div",{className:"h-2 w-2 rounded-full bg-current"}),e.jsxRuntimeExports.jsxs("span",{children:[i.quality,"p"]})]})]})},se=function({className:i,showSkipButtons:s=!0,showVolumeControl:n=!0,showTimeDisplay:t=!0,playButtonSize:a="xl",skipButtonSize:r="md",skipTime:c=10,showPerformanceIndicators:l=process.env.NODE_ENV==="development",performanceMetrics:p}){return e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex flex-col gap-4 bg-gradient-to-t from-black/80 to-transparent p-4",i),children:[e.jsxRuntimeExports.jsx(K,{className:"w-full"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[s&&e.jsxRuntimeExports.jsx(J,{size:r,skipTime:c,className:"shrink-0"}),e.jsxRuntimeExports.jsx(O,{size:a,className:"shrink-0"}),s&&e.jsxRuntimeExports.jsx(Z,{size:r,skipTime:c,className:"shrink-0"}),n&&e.jsxRuntimeExports.jsx(U,{className:"shrink-0"}),t&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 font-mono text-sm",children:[e.jsxRuntimeExports.jsx(B,{variant:"current"}),e.jsxRuntimeExports.jsx("span",{className:"text-white/60",children:"/"}),e.jsxRuntimeExports.jsx(B,{variant:"duration"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:l&&e.jsxRuntimeExports.jsx(ee,{metrics:p,className:"text-white/80"})})]})]})},te=({performanceMetrics:u={},preloadingStats:i={},playbackState:s={},hlsMetrics:n={},pluginInfo:t={},debugInfo:a={},className:r,position:c="top-right",defaultCollapsed:l=!1,title:p="BaroiPlayer Debug Panel"})=>{const[d,v]=o.useState(l),[N,f]=o.useState("performance"),R=o.useMemo(()=>{switch(c){case"top-left":return"top-4 left-4";case"top-right":return"top-4 right-4";case"bottom-left":return"bottom-4 left-4";case"bottom-right":return"bottom-4 right-4";default:return"top-4 right-4"}},[c]),m=E=>{if(E===0)return"0 B";const w=1024,A=["B","KB","MB","GB"],L=Math.floor(Math.log(E)/Math.log(w));return parseFloat((E/Math.pow(w,L)).toFixed(2))+" "+A[L]},b=E=>{const w=Math.floor(E/60),A=Math.floor(E%60);return`${w}:${A.toString().padStart(2,"0")}`},g=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"FPS:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 font-mono",children:u.fps||0})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Memory:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[((u.memoryUsage||0)/1024/1024).toFixed(1)," MB"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-yellow-400",children:"Buffer:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[(u.bufferHealth||0).toFixed(2),"s"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-purple-400",children:"Bandwidth:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[m(u.networkBandwidth||0),"/s"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-red-400",children:"Dropped:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[u.droppedFrames||0," frames"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-cyan-400",children:"Decoded:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[u.decodedFrames||0," frames"]})]})]})}),M=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"Status:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 font-mono",children:s.isPlaying?e.jsxRuntimeExports.jsx("span",{className:"text-green-300",children:"Playing"}):e.jsxRuntimeExports.jsx("span",{className:"text-red-300",children:"Paused"})})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Time:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[b(s.currentTime||0)," / ",b(s.duration||0)]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-yellow-400",children:"Volume:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[Math.round((s.volume||0)*100),"%"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-purple-400",children:"Quality:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[s.quality||0,"p"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-red-400",children:"Buffering:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 font-mono",children:s.isBuffering?e.jsxRuntimeExports.jsx("span",{className:"text-yellow-300",children:"Yes"}):e.jsxRuntimeExports.jsx("span",{className:"text-green-300",children:"No"})})]}),s.error&&e.jsxRuntimeExports.jsxs("div",{className:"col-span-2",children:[e.jsxRuntimeExports.jsx("span",{className:"text-red-400",children:"Error:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 break-all font-mono text-red-300 text-xs",children:s.error})]})]})}),C=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"Preloaded:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[i.preloadedItems||0," items"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Engagement:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[(i.engagementScore||0).toFixed(1),"%"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-yellow-400",children:"Queue:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[i.queueLength||0," items"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-purple-400",children:"Hit Rate:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[(i.hitRate||0).toFixed(1),"%"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"col-span-2",children:[e.jsxRuntimeExports.jsx("span",{className:"text-cyan-400",children:"Saved:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 font-mono",children:m(i.totalSaved||0)})]})]})}),h=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"Level:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[n.currentLevel||0," / ",n.availableLevels||0]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Bandwidth:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[m(n.bandwidthEstimate||0),"/s"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-red-400",children:"Dropped:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[n.droppedFrames||0," frames"]})]})]})}),j=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"Total:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[t.pluginCount||0," plugins"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Active:"}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 space-y-1 font-mono text-xs",children:t.activePlugins?.map((E,w)=>e.jsxRuntimeExports.jsxs("div",{className:"text-green-300",children:["• ",E]},w))||e.jsxRuntimeExports.jsx("div",{className:"text-gray-400",children:"None"})})]}),t.loadedPlugins&&t.loadedPlugins.length>t.activePlugins?.length&&e.jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[e.jsxRuntimeExports.jsx("span",{className:"text-yellow-400",children:"Loaded (inactive):"}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 space-y-1 font-mono text-xs",children:t.loadedPlugins.filter(E=>!t.activePlugins?.includes(E)).map((E,w)=>e.jsxRuntimeExports.jsxs("div",{className:"text-yellow-300",children:["• ",E]},w))})]})]})}),S=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(a).map(([E,w])=>e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("span",{className:"text-yellow-400",children:[E,":"]}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 text-gray-300",children:typeof w=="object"?JSON.stringify(w,null,2):String(w)})]},E))})}),k=()=>e.jsxRuntimeExports.jsx("div",{className:"flex space-x-1 border-gray-600 border-b",children:[{id:"performance",label:"Performance"},{id:"hls",label:"HLS"},{id:"plugins",label:"Plugins"},{id:"debug",label:"Debug"}].map(E=>e.jsxRuntimeExports.jsx("button",{onClick:()=>f(E.id),className:x.cn("px-2 py-1 font-medium text-xs transition-colors",N===E.id?"border-blue-400 border-b text-blue-400":"text-gray-400 hover:text-white"),children:E.label},E.id))}),P=()=>{switch(N){case"performance":return e.jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[g(),e.jsxRuntimeExports.jsx("hr",{className:"border-gray-600"}),M(),e.jsxRuntimeExports.jsx("hr",{className:"border-gray-600"}),C()]});case"hls":return h();case"plugins":return j();case"debug":return S();default:return g()}};return process.env.NODE_ENV!=="development"?null:e.jsxRuntimeExports.jsxs("div",{className:x.cn("fixed z-50 min-w-80 max-w-96 rounded-lg border border-gray-700 bg-black/90 p-3 font-mono text-white text-xs backdrop-blur-sm",R,r),children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxRuntimeExports.jsx("h3",{className:"font-bold text-blue-400 text-sm",children:p}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("button",{onClick:()=>v(!d),className:"text-gray-400 transition-colors hover:text-white","aria-label":d?"Expand":"Collapse",children:d?e.jsxRuntimeExports.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsxRuntimeExports.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):e.jsxRuntimeExports.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsxRuntimeExports.jsx("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),d?e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"FPS:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-1 font-mono",children:u.fps||0})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Memory:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-1 font-mono",children:[((u.memoryUsage||0)/1024/1024).toFixed(1),"MB"]})]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[k(),e.jsxRuntimeExports.jsx("div",{className:"mt-3 max-h-64 overflow-y-auto",children:P()})]})]})};exports.ChaptersPanel=_;exports.DebugPanel=te;exports.EnhancedControlBar=se;exports.EnhancedMediaPlayer=D;exports.EnhancedPlayButton=O;exports.EnhancedSeekBar=K;exports.EnhancedTimeDisplay=B;exports.EnhancedVolumeControl=U;exports.PictureInPictureButton=H;exports.PlaybackSpeedSelector=I;exports.QualitySelector=F;exports.SubtitleSelector=V;exports.advancedFeatures=q;
2
- //# sourceMappingURL=enhanced-components-DXBCHU0v.cjs.map
1
+ "use strict";const e=require("./context-eNS62_ac.cjs"),o=require("react"),x=require("./utils-CFOue_9K.cjs");function Y(...u){return i=>{u.forEach(s=>{typeof s=="function"?s(i):s&&(s.current=i)})}}function W(u,i,s,n){const[t,a]=o.useState(!0),[r,c]=o.useState(!1),[l,p]=o.useState(!1),d=o.useRef(null),v=o.useCallback(()=>{d.current&&clearTimeout(d.current),u&&(d.current=setTimeout(()=>{!r&&!l&&a(!1)},i))},[u,i,r,l]),N=o.useCallback(()=>{a(!0),v()},[v]);o.useEffect(()=>(u?v():a(!0),()=>{d.current&&clearTimeout(d.current)}),[u,v]);const f=o.useCallback(()=>{s&&(c(!0),a(!0))},[s]),R=o.useCallback(()=>{s&&(c(!1),v())},[s,v]),m=o.useCallback(()=>{n&&(p(!0),N())},[n,N]),b=o.useCallback(()=>{n&&(p(!1),v())},[n,v]);return{showControls:t,showControlsTemporarily:N,handleMouseEnter:f,handleMouseLeave:R,handleTouchStart:m,handleTouchEnd:b}}function Q(u){const i=e.useMediaDispatch(),s=e.useMediaSelector(f=>f.isPlaying),n=e.useMediaSelector(f=>f.currentTime),t=e.useMediaSelector(f=>f.duration),a=e.useMediaSelector(f=>f.volume),[r,c]=o.useState(null),[l,p]=o.useState(!1),d=o.useCallback(f=>{if(!u)return;const R=f.touches[0];if(!R)return;const m=Date.now();r&&m-r.time<300?(p(!0),i({type:s?e.MediaActionTypes.PAUSE:e.MediaActionTypes.PLAY})):(c({x:R.clientX,y:R.clientY,time:m}),p(!1))},[u,r,s,i]),v=o.useCallback(f=>{if(!u||!r||l)return;const R=f.touches[0];if(!R)return;const m=R.clientX-r.x,b=R.clientY-r.y;if(Math.abs(m)>Math.abs(b)&&Math.abs(m)>50){const g=m/window.innerWidth*30,M=Math.max(0,Math.min(t,n+g));i({type:e.MediaActionTypes.SEEK,detail:M})}if(Math.abs(b)>Math.abs(m)&&Math.abs(b)>50&&r.x>window.innerWidth/2){const g=-(b/window.innerHeight)*1,M=Math.max(0,Math.min(1,a+g));i({type:e.MediaActionTypes.SET_VOLUME,detail:M})}},[u,r,l,t,n,a,i]),N=o.useCallback(()=>{u&&setTimeout(()=>{c(null),p(!1)},300)},[u]);return{handleTouchStart:d,handleTouchMove:v,handleTouchEnd:N}}const D=function({children:i,className:s,autoHide:n=!0,autoHideDelay:t=3e3,showControlsOnHover:a=!0,showControlsOnTouch:r=!0,enableKeyboardControls:c=!0,enableTouchGestures:l=!0,onPlay:p,onPause:d,onTimeUpdate:v,onVolumeChange:N,onFullscreenChange:f}){const R=e.useMediaContext(),m=e.useMediaDispatch(),b=e.useMediaSelector(o.useCallback(y=>y.isPlaying,[])),g=e.useMediaSelector(o.useCallback(y=>y.isFullscreen,[])),M=e.useMediaSelector(o.useCallback(y=>y.currentTime,[])),C=e.useMediaSelector(o.useCallback(y=>y.volume,[])),h=e.useMediaSelector(o.useCallback(y=>y.error,[])),{showControls:j,showControlsTemporarily:S,handleMouseEnter:k,handleMouseLeave:P,handleTouchStart:E,handleTouchEnd:w}=W(n,t,a,r),{handleTouchStart:A,handleTouchMove:L,handleTouchEnd:z}=Q(l),$=o.useCallback(y=>{E(),A(y)},[E,A]),X=o.useCallback(()=>{w(),z()},[w,z]),G=o.useCallback(()=>{S()},[S]);return o.useEffect(()=>{if(!c)return;const y=T=>{if(!(T.target instanceof HTMLInputElement||T.target instanceof HTMLTextAreaElement))switch(T.code){case"Space":case"KeyK":T.preventDefault(),m({type:b?e.MediaActionTypes.PAUSE:e.MediaActionTypes.PLAY});break;case"KeyF":T.preventDefault(),m({type:g?e.MediaActionTypes.EXIT_FULLSCREEN:e.MediaActionTypes.ENTER_FULLSCREEN});break;case"KeyM":T.preventDefault(),m({type:e.MediaActionTypes.TOGGLE_MUTE});break;case"ArrowLeft":T.preventDefault(),m({type:e.MediaActionTypes.SEEK,detail:Math.max(0,M-10)});break;case"ArrowRight":T.preventDefault(),m({type:e.MediaActionTypes.SEEK,detail:M+10});break;case"ArrowUp":T.preventDefault(),m({type:e.MediaActionTypes.SET_VOLUME,detail:Math.min(1,C+.1)});break;case"ArrowDown":T.preventDefault(),m({type:e.MediaActionTypes.SET_VOLUME,detail:Math.max(0,C-.1)});break}};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[c,m,b,g,M,C]),o.useEffect(()=>{b?p?.():d?.()},[b,p,d]),o.useEffect(()=>{v?.(M)},[M,v]),o.useEffect(()=>{N?.(C)},[C,N]),o.useEffect(()=>{f?.(g)},[g,f]),e.jsxRuntimeExports.jsx("div",{ref:Y(R.rootRef),className:x.cn("relative isolate flex flex-col overflow-hidden rounded-lg bg-black outline-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",g&&"fixed inset-0 z-50 rounded-none",s),"data-state":g?"fullscreen":"inline","data-disabled":h?"":void 0,"data-controls-visible":j?"":void 0,tabIndex:0,onMouseEnter:k,onMouseLeave:P,onTouchStart:$,onTouchMove:L,onTouchEnd:X,onClick:G,children:i})};D.displayName="EnhancedMediaPlayer";const F=function({qualities:i,currentQuality:s,onQualityChange:n,className:t}){const[a,r]=o.useState(!1),c=o.useMemo(()=>i.find(l=>l.id===s)?.label||"Auto",[i,s]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("relative",t),children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!a),className:"flex items-center gap-2 rounded-lg bg-black/50 px-3 py-2 text-white transition-colors hover:bg-black/70","aria-label":"Select quality",children:[e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4",children:e.jsxRuntimeExports.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:c}),e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:x.cn("h-4 w-4 transition-transform",a&&"rotate-180"),children:e.jsxRuntimeExports.jsx("path",{d:"M7 10l5 5 5-5z"})})]}),a&&e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 bottom-full mb-2 min-w-32 rounded-lg border border-white/20 bg-black/90 py-2 backdrop-blur-sm",children:i.map(l=>e.jsxRuntimeExports.jsxs("button",{onClick:()=>{n(l.id),r(!1)},className:x.cn("w-full px-4 py-2 text-left text-sm text-white transition-colors hover:bg-white/10",l.id===s&&"bg-primary/20 text-primary"),children:[l.label,l.bitrate&&e.jsxRuntimeExports.jsxs("span",{className:"ml-2 text-white/60 text-xs",children:["(",Math.round(l.bitrate/1e3),"k)"]})]},l.id))})]})},V=function({subtitles:i,currentSubtitle:s,onSubtitleChange:n,className:t}){const[a,r]=o.useState(!1),c=o.useMemo(()=>s&&i.find(l=>l.id===s)?.label||"Off",[i,s]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("relative",t),children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!a),className:"flex items-center gap-2 rounded-lg bg-black/50 px-3 py-2 text-white transition-colors hover:bg-black/70","aria-label":"Select subtitles",children:[e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4",children:e.jsxRuntimeExports.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM4 12h4v2H4v-2zm10 6H4v-2h10v2zm6 0h-4v-2h4v2zm0-4H10v-2h10v2z"})}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:c}),e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:x.cn("h-4 w-4 transition-transform",a&&"rotate-180"),children:e.jsxRuntimeExports.jsx("path",{d:"M7 10l5 5 5-5z"})})]}),a&&e.jsxRuntimeExports.jsxs("div",{className:"absolute right-0 bottom-full mb-2 min-w-32 rounded-lg border border-white/20 bg-black/90 py-2 backdrop-blur-sm",children:[e.jsxRuntimeExports.jsx("button",{onClick:()=>{n(null),r(!1)},className:x.cn("w-full px-4 py-2 text-left text-sm text-white transition-colors hover:bg-white/10",!s&&"bg-primary/20 text-primary"),children:"Off"}),i.map(l=>e.jsxRuntimeExports.jsx("button",{onClick:()=>{n(l.id),r(!1)},className:x.cn("w-full px-4 py-2 text-left text-sm text-white transition-colors hover:bg-white/10",l.id===s&&"bg-primary/20 text-primary"),children:l.label},l.id))]})]})},I=function({className:i}){const s=e.useMediaDispatch(),n=e.useMediaSelector(l=>l.playbackRate),[t,a]=o.useState(!1),r=[.25,.5,.75,1,1.25,1.5,1.75,2],c=o.useCallback(l=>{s({type:e.MediaActionTypes.SET_PLAYBACK_RATE,detail:l}),a(!1)},[s]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("relative",i),children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>a(!t),className:"flex items-center gap-2 rounded-lg bg-black/50 px-3 py-2 text-white transition-colors hover:bg-black/70","aria-label":"Select playback speed",children:[e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4",children:e.jsxRuntimeExports.jsx("path",{d:"M13,8A4,4 0 0,0 9,12A4,4 0 0,0 13,16A4,4 0 0,0 17,12A4,4 0 0,0 13,8M13,14A2,2 0 0,1 11,12A2,2 0 0,1 13,10A2,2 0 0,1 15,12A2,2 0 0,1 13,14M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4Z"})}),e.jsxRuntimeExports.jsxs("span",{className:"text-sm",children:[n,"x"]}),e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:x.cn("h-4 w-4 transition-transform",t&&"rotate-180"),children:e.jsxRuntimeExports.jsx("path",{d:"M7 10l5 5 5-5z"})})]}),t&&e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 bottom-full mb-2 min-w-20 rounded-lg border border-white/20 bg-black/90 py-2 backdrop-blur-sm",children:r.map(l=>e.jsxRuntimeExports.jsxs("button",{onClick:()=>c(l),className:x.cn("w-full px-4 py-2 text-left text-sm text-white transition-colors hover:bg-white/10",l===n&&"bg-primary/20 text-primary"),children:[l,"x"]},l))})]})},_=function({chapters:i,onChapterSelect:s,className:n}){const t=e.useMediaSelector(r=>r.currentTime),a=o.useMemo(()=>i.find(r=>t>=r.startTime&&t<r.endTime),[i,t]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("rounded-lg border border-white/20 bg-black/90 p-4 backdrop-blur-sm",n),children:[e.jsxRuntimeExports.jsx("h3",{className:"mb-3 font-semibold text-white",children:"Chapters"}),e.jsxRuntimeExports.jsx("div",{className:"max-h-64 space-y-2 overflow-y-auto",children:i.map(r=>e.jsxRuntimeExports.jsxs("button",{onClick:()=>s(r),className:x.cn("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors","hover:bg-white/10",r.id===a?.id&&"border border-primary/30 bg-primary/20"),children:[r.thumbnail&&e.jsxRuntimeExports.jsx("img",{src:r.thumbnail,alt:r.title,className:"h-9 w-16 rounded object-cover"}),e.jsxRuntimeExports.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxRuntimeExports.jsx("div",{className:"truncate font-medium text-white",children:r.title}),e.jsxRuntimeExports.jsxs("div",{className:"text-sm text-white/60",children:[x.formatTime(r.startTime)," - ",x.formatTime(r.endTime)]})]})]},r.id))})]})},H=function({className:i}){const s=e.useMediaDispatch(),n=e.useMediaSelector(a=>a.isPictureInPicture),t=o.useCallback(()=>{s({type:n?e.MediaActionTypes.EXIT_PIP:e.MediaActionTypes.ENTER_PIP})},[s,n]);return e.jsxRuntimeExports.jsx("button",{type:"button",onClick:t,className:x.cn("flex h-10 w-10 items-center justify-center rounded-full text-white","transition-colors hover:bg-white/10",i),"aria-label":n?"Exit Picture-in-Picture":"Enter Picture-in-Picture",children:e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:e.jsxRuntimeExports.jsx("path",{d:"M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14z"})})})},q=Object.freeze(Object.defineProperty({__proto__:null,ChaptersPanel:_,PictureInPictureButton:H,PlaybackSpeedSelector:I,QualitySelector:F,SubtitleSelector:V},Symbol.toStringTag,{value:"Module"})),O=function({className:i,size:s="md"}){const n=e.useMediaDispatch(),t=e.useMediaSelector(p=>p.isPlaying),a=e.useMediaSelector(p=>p.isLoading),r={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12",xl:"h-16 w-16"},c={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-8 w-8"},l=o.useCallback(()=>{n({type:t?e.MediaActionTypes.PAUSE:e.MediaActionTypes.PLAY})},[n,t]);return e.jsxRuntimeExports.jsx("button",{type:"button",onClick:l,disabled:a,className:x.cn("group relative flex items-center justify-center rounded-full bg-white/10 backdrop-blur-sm","border border-white/20 text-white transition-all duration-200","hover:scale-105 hover:bg-white/20 active:scale-95","focus:outline-none focus:ring-2 focus:ring-white/50","disabled:cursor-not-allowed disabled:opacity-50",r[s],i),"aria-label":t?"Pause":"Play",children:a?e.jsxRuntimeExports.jsx("div",{className:x.cn("animate-spin rounded-full border-2 border-white/30 border-t-white",c[s])}):e.jsxRuntimeExports.jsx("div",{className:x.cn("transition-transform duration-200",c[s]),children:t?e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full",children:e.jsxRuntimeExports.jsx("path",{d:"M6 4h4v16H6V4zm8 0h4v16h-4V4z"})}):e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"ml-0.5 h-full w-full",children:e.jsxRuntimeExports.jsx("path",{d:"M8 5v14l11-7z"})})})})},K=function({className:i}){const s=e.useMediaDispatch(),n=e.useMediaSelector(h=>h.currentTime),t=e.useMediaSelector(h=>h.duration),a=e.useMediaSelector(h=>h.buffered),r=e.useMediaSelector(h=>h.previewTime),[c,l]=o.useState(!1),[p,d]=o.useState(null),v=o.useRef(null),N=t>0?n/t*100:0,f=t>0&&r!==null?r/t*100:null,R=o.useMemo(()=>{if(!a||t===0)return[];const h=[];for(let j=0;j<a.length;j++)h.push({start:a.start(j)/t*100,end:a.end(j)/t*100});return h},[a,t]),m=o.useCallback(h=>{if(!v.current)return 0;const j=v.current.getBoundingClientRect();return Math.max(0,Math.min(1,(h-j.left)/j.width))*t},[t]),b=o.useCallback(h=>{if(!c){const j=m(h.clientX);d(j),s({type:e.MediaActionTypes.PREVIEW_TIME,detail:j})}},[c,m,s]),g=o.useCallback(()=>{c||(d(null),s({type:e.MediaActionTypes.CLEAR_PREVIEW}))},[c,s]),M=o.useCallback(h=>{l(!0);const j=m(h.clientX);s({type:e.MediaActionTypes.SEEK,detail:j})},[m,s]),C=o.useCallback(h=>{l(!0);const j=m(h.touches[0]?.clientX||0);s({type:e.MediaActionTypes.SEEK,detail:j})},[m,s]);return o.useEffect(()=>{const h=k=>{if(c){const P=m(k.clientX);s({type:e.MediaActionTypes.SEEK,detail:P})}},j=()=>{l(!1),d(null),s({type:e.MediaActionTypes.CLEAR_PREVIEW})},S=k=>{if(c){const P=m(k.touches[0]?.clientX||0);s({type:e.MediaActionTypes.SEEK,detail:P})}};return c&&(document.addEventListener("mousemove",h),document.addEventListener("mouseup",j),document.addEventListener("touchmove",S),document.addEventListener("touchend",j)),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",j),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",j)}},[c,m,s]),e.jsxRuntimeExports.jsxs("div",{className:x.cn("group relative flex items-center",i),children:[(p!==null||r!==null)&&e.jsxRuntimeExports.jsx("div",{className:"pointer-events-none absolute bottom-full mb-2 rounded bg-black/80 px-2 py-1 text-white text-xs",style:{left:`${f||(p||0)/t*100}%`,transform:"translateX(-50%)"},children:x.formatTime(p||r||0)}),e.jsxRuntimeExports.jsxs("div",{ref:v,className:"relative h-2 w-full cursor-pointer rounded-full bg-white/20 transition-all duration-200 group-hover:h-3",onMouseMove:b,onMouseLeave:g,onMouseDown:M,onTouchStart:C,children:[R.map((h,j)=>e.jsxRuntimeExports.jsx("div",{className:"absolute top-0 h-full rounded-full bg-white/30",style:{left:`${h.start}%`,width:`${h.end-h.start}%`}},j)),e.jsxRuntimeExports.jsx("div",{className:"absolute top-0 h-full rounded-full bg-primary transition-all duration-100",style:{width:`${N}%`}}),f!==null&&e.jsxRuntimeExports.jsx("div",{className:"absolute top-0 h-full w-1 rounded-full bg-white/80",style:{left:`${f}%`}}),e.jsxRuntimeExports.jsx("div",{className:"-translate-y-1/2 absolute top-1/2 h-4 w-4 rounded-full border-2 border-white bg-primary opacity-0 shadow-lg transition-all duration-200 group-hover:opacity-100",style:{left:`${N}%`,transform:"translateX(-50%) translateY(-50%)"}})]})]})},U=function({className:i}){const s=e.useMediaDispatch(),n=e.useMediaSelector(d=>d.volume),t=e.useMediaSelector(d=>d.isMuted),[a,r]=o.useState(!1),c=o.useCallback(()=>{s({type:e.MediaActionTypes.TOGGLE_MUTE})},[s]),l=o.useCallback(d=>{s({type:e.MediaActionTypes.SET_VOLUME,detail:d})},[s]),p=o.useMemo(()=>t||n===0?e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:e.jsxRuntimeExports.jsx("path",{d:"M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"})}):n<.5?e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:e.jsxRuntimeExports.jsx("path",{d:"M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z"})}):e.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:e.jsxRuntimeExports.jsx("path",{d:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"})}),[t,n]);return e.jsxRuntimeExports.jsxs("div",{className:x.cn("relative flex items-center",i),onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:c,className:"flex h-10 w-10 items-center justify-center rounded-full text-white transition-colors hover:bg-white/10","aria-label":t?"Unmute":"Mute",children:p}),e.jsxRuntimeExports.jsx("div",{className:x.cn("absolute left-full ml-2 flex items-center transition-all duration-200",a?"translate-x-0 opacity-100":"-translate-x-2 pointer-events-none opacity-0"),children:e.jsxRuntimeExports.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:t?0:n,onChange:d=>l(parseFloat(d.target.value)),className:"slider h-1 w-20 cursor-pointer appearance-none rounded-lg bg-white/20"})})]})},J=function({className:i,size:s="md",skipTime:n=10}){const t=e.useMediaDispatch(),a=e.useMediaSelector(p=>p.currentTime),r={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"},c={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},l=o.useCallback(()=>{const p=Math.max(0,a-n);t({type:e.MediaActionTypes.SEEK,detail:p})},[t,a,n]);return e.jsxRuntimeExports.jsx("button",{type:"button",onClick:l,className:x.cn("group relative flex items-center justify-center rounded-full bg-white/10 backdrop-blur-sm","border border-white/20 text-white transition-all duration-200","hover:scale-105 hover:bg-white/20 active:scale-95","focus:outline-none focus:ring-2 focus:ring-white/50",r[s],i),"aria-label":`Backward ${n} seconds`,title:`Backward ${n}s`,children:e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center transition-transform duration-200",c[s]),children:[e.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full",children:[e.jsxRuntimeExports.jsx("path",{d:"M7 6c.55 0 1 .45 1 1v10c0 .55-.45 1-1 1s-1-.45-1-1V7c0-.55.45-1 1-1zM15.5 7.5c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v9c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-9z"}),e.jsxRuntimeExports.jsx("path",{d:"M5.5 12l7-4.5v9l-7-4.5z",opacity:"0.8"})]}),n&&e.jsxRuntimeExports.jsx("span",{className:"-bottom-1 absolute font-bold text-[10px]",children:n})]})})},Z=function({className:i,size:s="md",skipTime:n=10}){const t=e.useMediaDispatch(),a=e.useMediaSelector(d=>d.currentTime),r=e.useMediaSelector(d=>d.duration),c={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"},l={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},p=o.useCallback(()=>{const d=Math.min(r,a+n);t({type:e.MediaActionTypes.SEEK,detail:d})},[t,a,r,n]);return e.jsxRuntimeExports.jsx("button",{type:"button",onClick:p,className:x.cn("group relative flex items-center justify-center rounded-full bg-white/10 backdrop-blur-sm","border border-white/20 text-white transition-all duration-200","hover:scale-105 hover:bg-white/20 active:scale-95","focus:outline-none focus:ring-2 focus:ring-white/50",c[s],i),"aria-label":`Forward ${n} seconds`,title:`Forward ${n}s`,children:e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center transition-transform duration-200",l[s]),children:[e.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"h-full w-full",children:[e.jsxRuntimeExports.jsx("path",{d:"M17 6c.55 0 1 .45 1 1v10c0 .55-.45 1-1 1s-1-.45-1-1V7c0-.55.45-1 1-1zM8.5 7.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5v9c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5v-9z"}),e.jsxRuntimeExports.jsx("path",{d:"M18.5 12l-7-4.5v9l7-4.5z",opacity:"0.8"})]}),n&&e.jsxRuntimeExports.jsx("span",{className:"-bottom-1 absolute font-bold text-[10px]",children:n})]})})},B=function({variant:i="current",className:s}){const n=e.useMediaSelector(r=>r.currentTime),t=e.useMediaSelector(r=>r.duration),a=o.useMemo(()=>{switch(i){case"current":return x.formatTime(n);case"duration":return x.formatTime(t);case"remaining":return`-${x.formatTime(t-n)}`;default:return x.formatTime(n)}},[i,n,t]);return e.jsxRuntimeExports.jsx("div",{className:x.cn("font-mono text-sm text-white tabular-nums",s),children:a})},ee=function({metrics:i,className:s}){if(!i||process.env.NODE_ENV!=="development")return null;const n=a=>a>=50?"text-green-400":a>=30?"text-yellow-400":"text-red-400",t=a=>a>=5?"text-green-400":a>=2?"text-yellow-400":"text-red-400";return e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center gap-3 font-mono text-xs",s),children:[i.fps!==void 0&&e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center gap-1",n(i.fps)),children:[e.jsxRuntimeExports.jsx("div",{className:"h-2 w-2 rounded-full bg-current"}),e.jsxRuntimeExports.jsxs("span",{children:[i.fps," FPS"]})]}),i.bufferHealth!==void 0&&e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex items-center gap-1",t(i.bufferHealth)),children:[e.jsxRuntimeExports.jsx("div",{className:"h-2 w-2 rounded-full bg-current"}),e.jsxRuntimeExports.jsxs("span",{children:[i.bufferHealth.toFixed(1),"s"]})]}),i.quality!==void 0&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 text-blue-400",children:[e.jsxRuntimeExports.jsx("div",{className:"h-2 w-2 rounded-full bg-current"}),e.jsxRuntimeExports.jsxs("span",{children:[i.quality,"p"]})]})]})},se=function({className:i,showSkipButtons:s=!0,showVolumeControl:n=!0,showTimeDisplay:t=!0,playButtonSize:a="xl",skipButtonSize:r="md",skipTime:c=10,showPerformanceIndicators:l=process.env.NODE_ENV==="development",performanceMetrics:p}){return e.jsxRuntimeExports.jsxs("div",{className:x.cn("flex flex-col gap-4 bg-gradient-to-t from-black/80 to-transparent p-4",i),children:[e.jsxRuntimeExports.jsx(K,{className:"w-full"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[s&&e.jsxRuntimeExports.jsx(J,{size:r,skipTime:c,className:"shrink-0"}),e.jsxRuntimeExports.jsx(O,{size:a,className:"shrink-0"}),s&&e.jsxRuntimeExports.jsx(Z,{size:r,skipTime:c,className:"shrink-0"}),n&&e.jsxRuntimeExports.jsx(U,{className:"shrink-0"}),t&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 font-mono text-sm",children:[e.jsxRuntimeExports.jsx(B,{variant:"current"}),e.jsxRuntimeExports.jsx("span",{className:"text-white/60",children:"/"}),e.jsxRuntimeExports.jsx(B,{variant:"duration"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:l&&e.jsxRuntimeExports.jsx(ee,{metrics:p,className:"text-white/80"})})]})]})},te=({performanceMetrics:u={},preloadingStats:i={},playbackState:s={},hlsMetrics:n={},pluginInfo:t={},debugInfo:a={},className:r,position:c="top-right",defaultCollapsed:l=!1,title:p="BaroiPlayer Debug Panel"})=>{const[d,v]=o.useState(l),[N,f]=o.useState("performance"),R=o.useMemo(()=>{switch(c){case"top-left":return"top-4 left-4";case"top-right":return"top-4 right-4";case"bottom-left":return"bottom-4 left-4";case"bottom-right":return"bottom-4 right-4";default:return"top-4 right-4"}},[c]),m=E=>{if(E===0)return"0 B";const w=1024,A=["B","KB","MB","GB"],L=Math.floor(Math.log(E)/Math.log(w));return parseFloat((E/Math.pow(w,L)).toFixed(2))+" "+A[L]},b=E=>{const w=Math.floor(E/60),A=Math.floor(E%60);return`${w}:${A.toString().padStart(2,"0")}`},g=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"FPS:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 font-mono",children:u.fps||0})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Memory:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[((u.memoryUsage||0)/1024/1024).toFixed(1)," MB"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-yellow-400",children:"Buffer:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[(u.bufferHealth||0).toFixed(2),"s"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-purple-400",children:"Bandwidth:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[m(u.networkBandwidth||0),"/s"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-red-400",children:"Dropped:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[u.droppedFrames||0," frames"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-cyan-400",children:"Decoded:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[u.decodedFrames||0," frames"]})]})]})}),M=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"Status:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 font-mono",children:s.isPlaying?e.jsxRuntimeExports.jsx("span",{className:"text-green-300",children:"Playing"}):e.jsxRuntimeExports.jsx("span",{className:"text-red-300",children:"Paused"})})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Time:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[b(s.currentTime||0)," / ",b(s.duration||0)]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-yellow-400",children:"Volume:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[Math.round((s.volume||0)*100),"%"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-purple-400",children:"Quality:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[s.quality||0,"p"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-red-400",children:"Buffering:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 font-mono",children:s.isBuffering?e.jsxRuntimeExports.jsx("span",{className:"text-yellow-300",children:"Yes"}):e.jsxRuntimeExports.jsx("span",{className:"text-green-300",children:"No"})})]}),s.error&&e.jsxRuntimeExports.jsxs("div",{className:"col-span-2",children:[e.jsxRuntimeExports.jsx("span",{className:"text-red-400",children:"Error:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 break-all font-mono text-red-300 text-xs",children:s.error})]})]})}),C=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"Preloaded:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[i.preloadedItems||0," items"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Engagement:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[(i.engagementScore||0).toFixed(1),"%"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-yellow-400",children:"Queue:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[i.queueLength||0," items"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-purple-400",children:"Hit Rate:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[(i.hitRate||0).toFixed(1),"%"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"col-span-2",children:[e.jsxRuntimeExports.jsx("span",{className:"text-cyan-400",children:"Saved:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 font-mono",children:m(i.totalSaved||0)})]})]})}),h=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"Level:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[n.currentLevel||0," / ",n.availableLevels||0]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Bandwidth:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[m(n.bandwidthEstimate||0),"/s"]})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-red-400",children:"Dropped:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[n.droppedFrames||0," frames"]})]})]})}),j=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsxs("div",{className:"text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"Total:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-2 font-mono",children:[t.pluginCount||0," plugins"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Active:"}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 space-y-1 font-mono text-xs",children:t.activePlugins?.map((E,w)=>e.jsxRuntimeExports.jsxs("div",{className:"text-green-300",children:["• ",E]},w))||e.jsxRuntimeExports.jsx("div",{className:"text-gray-400",children:"None"})})]}),t.loadedPlugins&&t.loadedPlugins.length>(t.activePlugins?.length||0)&&e.jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[e.jsxRuntimeExports.jsx("span",{className:"text-yellow-400",children:"Loaded (inactive):"}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 space-y-1 font-mono text-xs",children:t.loadedPlugins.filter(E=>!t.activePlugins?.includes(E)).map((E,w)=>e.jsxRuntimeExports.jsxs("div",{className:"text-yellow-300",children:["• ",E]},w))})]})]})}),S=()=>e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:e.jsxRuntimeExports.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(a).map(([E,w])=>e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("span",{className:"text-yellow-400",children:[E,":"]}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 text-gray-300",children:typeof w=="object"?JSON.stringify(w,null,2):String(w)})]},E))})}),k=()=>e.jsxRuntimeExports.jsx("div",{className:"flex space-x-1 border-gray-600 border-b",children:[{id:"performance",label:"Performance"},{id:"hls",label:"HLS"},{id:"plugins",label:"Plugins"},{id:"debug",label:"Debug"}].map(E=>e.jsxRuntimeExports.jsx("button",{onClick:()=>f(E.id),className:x.cn("px-2 py-1 font-medium text-xs transition-colors",N===E.id?"border-blue-400 border-b text-blue-400":"text-gray-400 hover:text-white"),children:E.label},E.id))}),P=()=>{switch(N){case"performance":return e.jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[g(),e.jsxRuntimeExports.jsx("hr",{className:"border-gray-600"}),M(),e.jsxRuntimeExports.jsx("hr",{className:"border-gray-600"}),C()]});case"hls":return h();case"plugins":return j();case"debug":return S();default:return g()}};return process.env.NODE_ENV!=="development"?null:e.jsxRuntimeExports.jsxs("div",{className:x.cn("fixed z-50 min-w-80 max-w-96 rounded-lg border border-gray-700 bg-black/90 p-3 font-mono text-white text-xs backdrop-blur-sm",R,r),children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxRuntimeExports.jsx("h3",{className:"font-bold text-blue-400 text-sm",children:p}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("button",{onClick:()=>v(!d),className:"text-gray-400 transition-colors hover:text-white","aria-label":d?"Expand":"Collapse",children:d?e.jsxRuntimeExports.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsxRuntimeExports.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):e.jsxRuntimeExports.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsxRuntimeExports.jsx("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),d?e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-green-400",children:"FPS:"}),e.jsxRuntimeExports.jsx("span",{className:"ml-1 font-mono",children:u.fps||0})]}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-blue-400",children:"Memory:"}),e.jsxRuntimeExports.jsxs("span",{className:"ml-1 font-mono",children:[((u.memoryUsage||0)/1024/1024).toFixed(1),"MB"]})]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[k(),e.jsxRuntimeExports.jsx("div",{className:"mt-3 max-h-64 overflow-y-auto",children:P()})]})]})};exports.ChaptersPanel=_;exports.DebugPanel=te;exports.EnhancedControlBar=se;exports.EnhancedMediaPlayer=D;exports.EnhancedPlayButton=O;exports.EnhancedSeekBar=K;exports.EnhancedTimeDisplay=B;exports.EnhancedVolumeControl=U;exports.PictureInPictureButton=H;exports.PlaybackSpeedSelector=I;exports.QualitySelector=F;exports.SubtitleSelector=V;exports.advancedFeatures=q;
2
+ //# sourceMappingURL=enhanced-components-BspFs9OO.cjs.map