- Deleted apps/web/src/utils/optimisticStoreUpdates.ts (unused file) - File was unused - no imports found in codebase - Mutations already use React Query's onMutate pattern - No TypeScript errors after deletion - Actions 4.4.1.2 and 4.4.1.3 complete
2 lines
40 KiB
JavaScript
2 lines
40 KiB
JavaScript
import{r as d,l as M,j as t,c as h,M as F,L as X,P as ee,a as te,S as re,b as ne,V as ae,d as se,e as ie,C as le,X as oe,T as ue,R as ce,f as de,g as H,h as G,E as me,W as he,i as ge,D as fe,k as xe,B as pe,m as be}from"./chunk-m7Vgm5hx.js";import{c as ye,p as ve}from"./chunk-Dj70Y9U3.js";const U=ye()(ve((r,e)=>({currentTrack:null,isPlaying:!1,currentTime:0,duration:0,volume:100,muted:!1,queue:[],currentIndex:-1,repeat:"off",shuffle:!1,play:n=>{if(!n){r({isPlaying:!0});return}const{queue:s}=e(),l=s.findIndex(a=>a.id===n.id);if(l>=0)r({currentTrack:n,currentIndex:l,isPlaying:!0,currentTime:0});else{const a=[...s,n];r({currentTrack:n,currentIndex:a.length-1,queue:a,isPlaying:!0,currentTime:0})}},pause:()=>{r({isPlaying:!1})},resume:()=>{r({isPlaying:!0})},stop:()=>{r({isPlaying:!1,currentTime:0})},next:()=>{const{queue:n,currentIndex:s,repeat:l,shuffle:a}=e();if(n.length===0)return;let o=s;if(a)o=Math.floor(Math.random()*n.length);else if(s<n.length-1)o=s+1;else if(l==="playlist")o=0;else return;o!==s&&o<n.length&&r({currentIndex:o,currentTrack:n[o],currentTime:0,isPlaying:!0})},previous:()=>{const{queue:n,currentIndex:s}=e();if(n.length===0||s<=0)return;const l=s-1;r({currentIndex:l,currentTrack:n[l],currentTime:0,isPlaying:!0})},seek:n=>{const{duration:s}=e(),l=Math.max(0,Math.min(n,s||0));r({currentTime:l})},setCurrentTime:n=>{const{duration:s}=e(),l=Math.max(0,Math.min(n,s||0));r({currentTime:l})},setDuration:n=>{r({duration:Math.max(0,n)})},setVolume:n=>{const s=Math.max(0,Math.min(100,n));r({volume:s})},toggleMute:()=>{r({muted:!e().muted})},toggleShuffle:()=>{r({shuffle:!e().shuffle})},setRepeat:n=>{r({repeat:n})},addToQueue:n=>{const{queue:s}=e(),l=[...s,...n];r({queue:l})},removeFromQueue:n=>{const{queue:s,currentIndex:l}=e();if(n<0||n>=s.length)return;const a=s.filter((i,c)=>c!==n);let o=l;if(n<l)o=l-1;else if(n===l)if(a.length>0){o=Math.min(o,a.length-1),r({queue:a,currentIndex:o,currentTrack:a[o]||null,isPlaying:a[o]?e().isPlaying:!1});return}else{o=-1,r({queue:a,currentIndex:o,currentTrack:null,isPlaying:!1});return}r({queue:a,currentIndex:o})},reorderQueue:(n,s)=>{const{queue:l,currentIndex:a}=e();if(n<0||n>=l.length||s<0||s>=l.length||n===s)return;const o=[...l],[i]=o.splice(n,1);o.splice(s,0,i);let c=a;n===a?c=s:n<a&&s>=a?c=a-1:n>a&&s<=a&&(c=a+1),r({queue:o,currentIndex:c})},clearQueue:()=>{r({queue:[],currentIndex:-1,currentTrack:null,isPlaying:!1,currentTime:0})}}),{name:"player-storage",partialize:r=>({volume:r.volume,muted:r.muted,repeat:r.repeat,shuffle:r.shuffle,queue:r.queue,currentIndex:r.currentIndex,currentTrack:r.currentTrack})}));function z(r){if(isNaN(r)||!isFinite(r)||r<0)return"0:00";const e=Math.floor(r/60),n=Math.floor(r%60);return`${e}:${n.toString().padStart(2,"0")}`}function O(r,e){return!e||e===0?0:r/e*100}function ke(r){return r?!!(r.id&&r.title&&r.url):!1}class we{audioElement=null;timeUpdateCallback=null;durationChangeCallback=null;endedCallback=null;errorCallback=null;playCallback=null;pauseCallback=null;initialize(e){this.audioElement=e,this.setupEventListeners()}setupEventListeners(){this.audioElement&&(this.audioElement.addEventListener("timeupdate",this.handleTimeUpdate),this.audioElement.addEventListener("loadedmetadata",this.handleLoadedMetadata),this.audioElement.addEventListener("durationchange",this.handleDurationChange),this.audioElement.addEventListener("ended",this.handleEnded),this.audioElement.addEventListener("error",this.handleError),this.audioElement.addEventListener("play",this.handlePlay),this.audioElement.addEventListener("pause",this.handlePause))}cleanup(){this.audioElement&&(this.audioElement.removeEventListener("timeupdate",this.handleTimeUpdate),this.audioElement.removeEventListener("loadedmetadata",this.handleLoadedMetadata),this.audioElement.removeEventListener("durationchange",this.handleDurationChange),this.audioElement.removeEventListener("ended",this.handleEnded),this.audioElement.removeEventListener("error",this.handleError),this.audioElement.removeEventListener("play",this.handlePlay),this.audioElement.removeEventListener("pause",this.handlePause),this.audioElement=null)}async loadTrack(e){if(!this.audioElement)throw new Error("Audio element not initialized");if(!e){this.audioElement.src="";return}if(!ke(e))throw new Error("Invalid track");this.audioElement.src=e.url,this.audioElement.load()}async play(){if(!this.audioElement)throw new Error("Audio element not initialized");try{await this.audioElement.play()}catch(e){throw new Error(`Failed to play audio: ${e}`)}}pause(){if(!this.audioElement)throw new Error("Audio element not initialized");this.audioElement.pause()}stop(){if(!this.audioElement)throw new Error("Audio element not initialized");this.audioElement.pause(),this.audioElement.currentTime=0}seek(e){if(!this.audioElement)throw new Error("Audio element not initialized");const n=this.audioElement.duration||0,s=Math.max(0,Math.min(e,n));this.audioElement.currentTime=s}setVolume(e){if(!this.audioElement)throw new Error("Audio element not initialized");const n=Math.max(0,Math.min(1,e));this.audioElement.volume=n}setMuted(e){if(!this.audioElement)throw new Error("Audio element not initialized");this.audioElement.muted=e}getCurrentTime(){return this.audioElement&&this.audioElement.currentTime||0}getDuration(){return this.audioElement&&this.audioElement.duration||0}getVolume(){return this.audioElement?this.audioElement.volume:1}isPlaying(){return this.audioElement?!this.audioElement.paused&&!this.audioElement.ended:!1}isMuted(){return this.audioElement?this.audioElement.muted:!1}handleTimeUpdate=()=>{this.timeUpdateCallback&&this.audioElement&&this.timeUpdateCallback(this.audioElement.currentTime)};handleLoadedMetadata=()=>{this.durationChangeCallback&&this.audioElement&&this.durationChangeCallback(this.audioElement.duration)};handleDurationChange=()=>{this.durationChangeCallback&&this.audioElement&&this.durationChangeCallback(this.audioElement.duration)};handleEnded=()=>{this.endedCallback&&this.endedCallback()};handleError=()=>{if(this.errorCallback&&this.audioElement){const e=new Error(this.audioElement.error?.message||"Unknown audio error");this.errorCallback(e)}};handlePlay=()=>{this.playCallback&&this.playCallback()};handlePause=()=>{this.pauseCallback&&this.pauseCallback()};onTimeUpdate(e){this.timeUpdateCallback=e}onDurationChange(e){this.durationChangeCallback=e}onEnded(e){this.endedCallback=e}onError(e){this.errorCallback=e}onPlay(e){this.playCallback=e}onPause(e){this.pauseCallback=e}}const f=new we;function K(r){const e=U(),n=d.useRef(null),s=r?.current||n.current;d.useEffect(()=>{if(s)return f.initialize(s),()=>{f.cleanup()}},[s]),d.useEffect(()=>{if(!s)return;const u=e.muted?0:e.volume/100;f.setVolume(u),f.setMuted(e.muted)},[s,e.volume,e.muted]),d.useEffect(()=>{if(!s)return;(async()=>{try{await f.loadTrack(e.currentTrack)}catch(g){M.error("Failed to load track:",{error:g})}})()},[s,e.currentTrack]),d.useEffect(()=>{if(!s)return;(async()=>{try{e.isPlaying?await f.play():f.pause()}catch(g){M.error("Failed to sync playback:",{error:g}),e.pause()}})()},[s,e.isPlaying,e]),d.useEffect(()=>{if(s)return f.onTimeUpdate(u=>{e.setCurrentTime(u)}),f.onDurationChange(u=>{e.setDuration(u)}),f.onEnded(()=>{e.repeat==="track"?(f.seek(0),f.play().catch(u=>M.error("Failed to reply track:",{error:u}))):e.next()}),f.onError(u=>{M.error("Audio playback error:",{error:u}),e.pause()}),f.onPlay(()=>{e.isPlaying||e.resume()}),f.onPause(()=>{e.isPlaying&&e.pause()}),()=>{f.onTimeUpdate(null),f.onDurationChange(null),f.onEnded(null),f.onError(null),f.onPlay(null),f.onPause(null)}},[s,e]);const l=d.useCallback(async u=>{if(e.play(u),u&&s)try{await f.loadTrack(u),await f.play()}catch(g){M.error("Failed to play track:",{error:g}),e.pause()}},[e,s]),a=d.useCallback(()=>{e.pause(),s&&f.pause()},[e,s]),o=d.useCallback(async()=>{if(e.resume(),s)try{await f.play()}catch(u){M.error("Failed to resume playback:",{error:u}),e.pause()}},[e,s]),i=d.useCallback(()=>{e.stop(),s&&f.stop()},[e,s]),c=d.useCallback(u=>{e.seek(u),s&&f.seek(u)},[e,s]),m=d.useCallback(u=>{if(e.setVolume(u),s){const g=e.muted?0:u/100;f.setVolume(g)}},[e,s]),x=d.useCallback(()=>{e.toggleMute(),s&&f.setMuted(!e.muted)},[e,s]);return{currentTrack:e.currentTrack,isPlaying:e.isPlaying,currentTime:e.currentTime,duration:e.duration,volume:e.volume,muted:e.muted,queue:e.queue,currentIndex:e.currentIndex,repeat:e.repeat,shuffle:e.shuffle,play:l,pause:a,resume:o,stop:i,next:e.next,previous:e.previous,seek:c,setVolume:m,toggleMute:x,toggleShuffle:e.toggleShuffle,setRepeat:e.setRepeat,addToQueue:e.addToQueue,clearQueue:e.clearQueue}}function D({track:r,className:e,showCover:n=!0,showMetadata:s=!0,coverSize:l="md"}){if(!r)return t.jsxs("div",{className:h("flex items-center gap-3 text-gray-500 dark:text-gray-400",e),children:[t.jsx(F,{className:"h-5 w-5","aria-hidden":"true"}),t.jsx("span",{children:"Aucune piste sélectionnée"})]});const a={sm:"h-12 w-12",md:"h-16 w-16",lg:"h-24 w-24"};return t.jsxs("div",{className:h("flex items-center gap-3",e),children:[n&&t.jsx("div",{className:"flex-shrink-0",children:r.cover?t.jsx("img",{src:r.cover,alt:`Cover de ${r.title}`,className:h(a[l],"rounded-lg object-cover bg-gray-200 dark:bg-gray-700")}):t.jsx("div",{className:h(a[l],"rounded-lg bg-gray-200 dark:bg-gray-700 flex items-center justify-center"),children:t.jsx(F,{className:h(l==="sm"?"h-6 w-6":l==="lg"?"h-12 w-12":"h-8 w-8","text-gray-400 dark:text-gray-500"),"aria-hidden":"true"})})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-white truncate",title:r.title,children:r.title}),r.artist&&t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 truncate",title:r.artist,children:r.artist}),s&&t.jsxs("div",{className:"flex items-center gap-2 mt-1 text-xs text-gray-500 dark:text-gray-500",children:[r.album&&t.jsx("span",{className:"truncate",title:r.album,children:r.album}),r.album&&r.genre&&t.jsx("span",{className:"text-gray-400 dark:text-gray-600",children:"•"}),r.genre&&t.jsx("span",{className:"truncate",title:r.genre,children:r.genre})]})]})]})}function V({isPlaying:r,isLoading:e=!1,size:n="md",variant:s="default",className:l,disabled:a,onClick:o,...i}){const c={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"},m={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},x={default:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500 dark:bg-blue-500 dark:hover:bg-blue-600",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500 dark:text-gray-300 dark:hover:bg-gray-800",outline:"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus:ring-gray-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"},u=g=>{a||e||o?.(g)};return t.jsx("button",{type:"button",className:h("rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",c[n],x[s],(a||e)&&"opacity-50 cursor-not-allowed",l),disabled:a||e,onClick:u,"aria-label":r?"Mettre en pause":"Lire","aria-busy":e,...i,children:e?t.jsxs(t.Fragment,{children:[t.jsx(X,{className:h(m[n],"animate-spin"),"aria-hidden":"true"}),t.jsx("span",{className:"sr-only",children:"Chargement..."})]}):r?t.jsxs(t.Fragment,{children:[t.jsx(ee,{className:m[n],"aria-hidden":"true"}),t.jsx("span",{className:"sr-only",children:"Mettre en pause"})]}):t.jsxs(t.Fragment,{children:[t.jsx(te,{className:h(m[n],"ml-0.5"),"aria-hidden":"true"}),t.jsx("span",{className:"sr-only",children:"Lire"})]})})}function I({onNext:r,onPrevious:e,canGoNext:n,canGoPrevious:s,size:l="md",variant:a="ghost",className:o,disabled:i=!1}){const c={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"},m={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},x={default:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500 dark:bg-blue-500 dark:hover:bg-blue-600",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500 dark:text-gray-300 dark:hover:bg-gray-800",outline:"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus:ring-gray-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"},u=i||!s,g=i||!n;return t.jsxs("div",{className:h("flex items-center gap-2",o),children:[t.jsxs("button",{type:"button",onClick:e,disabled:u,className:h("rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",c[l],x[a],u&&"opacity-50 cursor-not-allowed"),"aria-label":"Piste précédente","aria-disabled":u,children:[t.jsx(re,{className:m[l],"aria-hidden":"true"}),t.jsx("span",{className:"sr-only",children:"Piste précédente"})]}),t.jsxs("button",{type:"button",onClick:r,disabled:g,className:h("rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",c[l],x[a],g&&"opacity-50 cursor-not-allowed"),"aria-label":"Piste suivante","aria-disabled":g,children:[t.jsx(ne,{className:m[l],"aria-hidden":"true"}),t.jsx("span",{className:"sr-only",children:"Piste suivante"})]})]})}function J({currentTime:r,duration:e,onSeek:n,className:s,disabled:l=!1,showTooltip:a=!0}){const[o,i]=d.useState(!1),[c,m]=d.useState(null),[x,u]=d.useState(0),g=d.useRef(null),N=Math.min(100,O(r,e)),k=o&&c!==null?Math.min(100,O(c,e)):N,v=d.useCallback(p=>{if(!g.current)return 0;const y=g.current.getBoundingClientRect(),C=p-y.left;return Math.max(0,Math.min(1,C/y.width))*e},[e]),S=d.useCallback(p=>{if(l)return;i(!0);const y=v(p.clientX);m(y),n(y)},[l,v,n]),j=d.useCallback(p=>{if(!o||l)return;const y=v(p.clientX);m(y),n(y)},[o,l,v,n]),w=d.useCallback(()=>{o&&(i(!1),m(null))},[o]),E=d.useCallback(p=>{if(l||!a)return;const y=v(p.clientX);m(y)},[l,a,v]),P=d.useCallback(p=>{if(l||!a||o)return;const y=v(p.clientX);if(m(y),g.current){const C=g.current.getBoundingClientRect(),R=p.clientX-C.left,A=Math.max(0,Math.min(1,R/C.width));u(A*100)}},[l,a,o,v]),T=d.useCallback(()=>{o||m(null)},[o]);d.useEffect(()=>{if(o)return document.addEventListener("mousemove",j),document.addEventListener("mouseup",w),()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",w)}},[o,j,w]);const L=p=>{if(isNaN(p)||!isFinite(p)||p<0)return"0:00";const y=Math.floor(p/60),C=Math.floor(p%60);return`${y}:${C.toString().padStart(2,"0")}`},b=c!==null?c:r;return t.jsxs("div",{ref:g,className:h("relative w-full h-2 group cursor-pointer",l&&"cursor-not-allowed opacity-50",s),onMouseDown:S,onMouseEnter:E,onMouseMove:P,onMouseLeave:T,role:"slider","aria-label":"Progression de la lecture","aria-valuemin":0,"aria-valuemax":e,"aria-valuenow":r,"aria-disabled":l,children:[t.jsx("div",{className:"absolute inset-0 bg-gray-200 dark:bg-gray-700 rounded-full"}),t.jsx("div",{className:h("absolute left-0 top-0 h-full bg-blue-600 dark:bg-blue-500 rounded-full transition-all",o&&"bg-blue-700 dark:bg-blue-600"),style:{width:`${k}%`}}),c!==null&&!l&&t.jsx("div",{className:"absolute top-0 h-full w-0.5 bg-blue-800 dark:bg-blue-400 opacity-50",style:{left:`${k}%`}}),t.jsx("div",{className:h("absolute top-1/2 -translate-y-1/2 w-4 h-4 bg-blue-600 dark:bg-blue-500 rounded-full","opacity-0 group-hover:opacity-100 transition-opacity",o&&"opacity-100",l&&"opacity-0"),style:{left:`calc(${k}% - 8px)`}}),a&&c!==null&&!l&&t.jsx("div",{className:"absolute bottom-full mb-2 px-2 py-1 bg-gray-900 dark:bg-gray-800 text-white text-xs rounded pointer-events-none whitespace-nowrap",style:{left:`${x}%`,transform:"translateX(-50%)"},children:L(b)})]})}function _({volume:r,muted:e,onVolumeChange:n,onMuteToggle:s,className:l,disabled:a=!1,showValue:o=!1,showSlider:i=!0}){const[c,m]=d.useState(!1),x=d.useRef(null),u=e?0:r,g=d.useCallback(w=>{if(!x.current)return r;const E=x.current.getBoundingClientRect(),P=w-E.left,T=Math.max(0,Math.min(1,P/E.width));return Math.round(T*100)},[r]),N=d.useCallback(w=>{if(a)return;m(!0);const E=g(w.clientX);n(E)},[a,g,n]),k=d.useCallback(w=>{if(!c||a)return;const E=g(w.clientX);n(E)},[c,a,g,n]),v=d.useCallback(()=>{c&&m(!1)},[c]);d.useEffect(()=>{if(c)return document.addEventListener("mousemove",k),document.addEventListener("mouseup",v),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",v)}},[c,k,v]);const S=()=>e||u===0?t.jsx(ae,{className:"h-5 w-5","aria-hidden":"true"}):u<50?t.jsx(se,{className:"h-5 w-5","aria-hidden":"true"}):t.jsx(ie,{className:"h-5 w-5","aria-hidden":"true"}),j=()=>e?"Volume muet":`Volume: ${r}%`;return t.jsxs("div",{className:h("flex items-center gap-2",l),children:[t.jsxs("button",{type:"button",onClick:s,disabled:a,className:h("rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 h-10 w-10","bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500 dark:text-gray-300 dark:hover:bg-gray-800",a&&"opacity-50 cursor-not-allowed"),"aria-label":j(),"aria-pressed":e,"aria-disabled":a,title:j(),children:[S(),t.jsx("span",{className:"sr-only",children:j()})]}),i&&t.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[t.jsxs("div",{ref:x,className:h("relative w-full h-2 group cursor-pointer",a&&"cursor-not-allowed opacity-50"),onMouseDown:N,role:"slider","aria-label":"Volume","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":u,"aria-disabled":a,children:[t.jsx("div",{className:"absolute inset-0 bg-gray-200 dark:bg-gray-700 rounded-full"}),t.jsx("div",{className:h("absolute left-0 top-0 h-full bg-blue-600 dark:bg-blue-500 rounded-full transition-all",c&&"bg-blue-700 dark:bg-blue-600"),style:{width:`${u}%`}}),t.jsx("div",{className:h("absolute top-1/2 -translate-y-1/2 w-4 h-4 bg-blue-600 dark:bg-blue-500 rounded-full","opacity-0 group-hover:opacity-100 transition-opacity",c&&"opacity-100",a&&"opacity-0"),style:{left:`calc(${u}% - 8px)`}})]}),o&&t.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400 min-w-[3ch] text-right","aria-label":`Volume: ${r}%`,children:e?"Mute":`${r}%`})]})]})}function Ee({isVisible:r,onToggle:e,onClose:n,className:s,position:l="bottom"}){const a=K();if(!r||!a.currentTrack)return null;const o=()=>{a.isPlaying?a.pause():a.resume()},i=a.queue.length>0&&a.currentIndex<a.queue.length-1,c=a.queue.length>0&&a.currentIndex>0;return t.jsx("div",{className:h("fixed left-0 right-0 z-50 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-800 shadow-lg","transition-transform duration-300 ease-in-out",l==="bottom"?"bottom-0":"top-0",s),role:"region","aria-label":"Mini lecteur audio",children:t.jsx("div",{className:"container mx-auto px-4 py-2",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(D,{track:a.currentTrack,showCover:!0,coverSize:"sm",showMetadata:!1,className:"p-0"})}),t.jsx("div",{className:"hidden md:flex flex-1 max-w-xs",children:t.jsx(J,{currentTime:a.currentTime,duration:a.duration,onSeek:a.seek,className:"h-1",showTooltip:!1})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(I,{onNext:a.next,onPrevious:a.previous,canGoNext:i,canGoPrevious:c,size:"sm",variant:"ghost",disabled:!a.currentTrack}),t.jsx(V,{isPlaying:a.isPlaying,onClick:o,size:"sm",variant:"default"}),t.jsx("div",{className:"hidden sm:block",children:t.jsx(_,{volume:a.volume,muted:a.muted,onVolumeChange:a.setVolume,onMuteToggle:a.toggleMute,showValue:!1,showSlider:!0})}),t.jsxs("button",{type:"button",onClick:e,className:h("p-2 rounded-lg text-gray-600 dark:text-gray-400","hover:bg-gray-100 dark:hover:bg-gray-800","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","transition-colors"),"aria-label":"Agrandir le lecteur",title:"Agrandir le lecteur",children:[t.jsx(le,{className:"h-5 w-5","aria-hidden":"true"}),t.jsx("span",{className:"sr-only",children:"Agrandir le lecteur"})]}),n&&t.jsxs("button",{type:"button",onClick:n,className:h("p-2 rounded-lg text-gray-600 dark:text-gray-400","hover:bg-gray-100 dark:hover:bg-gray-800","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","transition-colors"),"aria-label":"Fermer le mini lecteur",title:"Fermer le mini lecteur",children:[t.jsx(oe,{className:"h-5 w-5","aria-hidden":"true"}),t.jsx("span",{className:"sr-only",children:"Fermer le mini lecteur"})]})]})]})})})}const je={WS:"/ws"},Ue={SEARCH:"Ctrl+K",NEW_MESSAGE:"Ctrl+N",PLAY_PAUSE:"Space",NEXT_TRACK:"Ctrl+Right",PREVIOUS_TRACK:"Ctrl+Left",VOLUME_UP:"Ctrl+Up",VOLUME_DOWN:"Ctrl+Down",MUTE:"Ctrl+M",HELP:"?",ESCAPE:"Escape"};class Ne{ws=null;config;isConnected=!1;pingInterval=null;stateInterval=null;reconnectAttempts=0;maxReconnectAttempts=5;reconnectTimer=null;constructor(e){this.config=e}connect(){this.ws&&this.disconnect();const e=new URL(`${je.WS}/ws`);e.searchParams.append("token",this.config.token),e.searchParams.append("session_id",this.config.sessionId),this.log("Connecting to WebSocket...",{url:e.toString()});try{this.ws=new WebSocket(e.toString()),this.setupEventListeners()}catch(n){this.handleError(n instanceof Error?n:new Error("WebSocket creation failed"))}}disconnect(){this.log("Disconnecting..."),this.stopHealthCheck(),this.stopStateReporting(),this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.onopen=null,this.ws.onclose=null,this.ws.onerror=null,this.ws.onmessage=null,this.ws.close(),this.ws=null),this.isConnected=!1}setupEventListeners(){this.ws&&(this.ws.onopen=()=>{this.log("WebSocket connected"),this.isConnected=!0,this.reconnectAttempts=0,this.startStateReporting()},this.ws.onclose=e=>{this.log("WebSocket closed",{code:e.code,reason:e.reason}),this.isConnected=!1,this.stopStateReporting(),this.attemptReconnect()},this.ws.onerror=e=>{this.log("WebSocket error",e)},this.ws.onmessage=e=>{try{const n=JSON.parse(e.data);this.handleMessage(n)}catch(n){this.log("Failed to parse message",{data:e.data,error:n})}})}handleMessage(e){switch(this.log("Received message",e),e.type){case"SyncInit":this.handleSyncInit(e);break;case"SyncPing":this.handleSyncPing(e);break;case"SyncAdjustment":this.handleSyncAdjustment(e);break;case"SyncStable":this.handleSyncStable(e);break;case"error":this.log("Server error",e),this.config.onError&&this.config.onError(new Error(e.message));break;default:this.log("Unknown message type",e)}}handleSyncInit(e){this.log("Initializing Sync",e);const s=this.config.getPlayerState().playbackPositionMs-e.position_ms;Math.abs(s)>2e3&&(this.log("Large initial drift, applying immediate correction",{drift:s}),this.config.applyAdjustment(-s))}handleSyncPing(e){const n={type:"SyncPong",ping_id:e.ping_id,client_timestamp_ms:Date.now()};this.send(n)}handleSyncAdjustment(e){this.log("Applying adjustment",{drift:e.drift_ms}),this.config.applyAdjustment(e.drift_ms)}handleSyncStable(e){this.log("Sync Stable"),this.config.onStable&&this.config.onStable()}startStateReporting(){this.stopStateReporting(),this.stateInterval=window.setInterval(()=>{if(!this.isConnected)return;const e=this.config.getPlayerState(),n={type:"SyncClientState",position_ms:e.playbackPositionMs,client_timestamp_ms:e.clientTimestampMs};this.send(n)},1e3)}stopStateReporting(){this.stateInterval&&(window.clearInterval(this.stateInterval),this.stateInterval=null)}send(e){!this.ws||this.ws.readyState!==WebSocket.OPEN||this.ws.send(JSON.stringify(e))}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){const n=new Error("Max reconnect attempts reached");this.handleError(n);return}this.reconnectAttempts++;const e=Math.min(1e3*Math.pow(2,this.reconnectAttempts),1e4);this.log(`Reconnecting in ${e}ms... (Attempt ${this.reconnectAttempts})`),this.reconnectTimer=window.setTimeout(()=>{this.connect()},e)}handleError(e){this.log("SyncClient Error",e),this.config.onError&&this.config.onError(e)}log(e,n){this.config.onDebug&&this.config.onDebug(e,n)}stopHealthCheck(){this.pingInterval&&(window.clearInterval(this.pingInterval),this.pingInterval=null)}}function Ce(r){const[e,n]=d.useState(!1),s=d.useRef(null),l=ue.getAccessToken();return d.useEffect(()=>{if(!r.sessionId||!r.trackId||!l){s.current&&(s.current.disconnect(),s.current=null,n(!1));return}const a=new Ne({token:l,sessionId:r.sessionId,trackId:r.trackId,getPlayerState:()=>({playbackPositionMs:f.getCurrentTime()*1e3,clientTimestampMs:Date.now()}),applyAdjustment:o=>{if(Math.abs(o)>100){const c=f.getCurrentTime(),m=o/1e3,x=c-m;f.seek(x)}},onStable:()=>{n(!0)},onDebug:(o,i)=>{},onError:o=>{M.error("[useStreamSync] Error:",{error:o}),n(!1)}});return a.connect(),s.current=a,()=>{a.disconnect(),s.current=null,n(!1)}},[r.sessionId,r.trackId,l]),{isSynced:e}}const Se=5,Te=5;function Me(r,e={}){const{enabled:n=!0,seekStep:s=Se,volumeStep:l=Te,preventDefault:a=!0}=e,o=d.useCallback(i=>{if(!n)return;const c=i.target;if(!(c&&(c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable===!0)))switch(i.code){case"Space":{a&&i.preventDefault(),r.isPlaying?r.pause():r.resume();break}case"ArrowLeft":{a&&i.preventDefault();const m=Math.max(0,r.currentTime-s);r.seek(m);break}case"ArrowRight":{a&&i.preventDefault();const m=Math.min(r.duration||0,r.currentTime+s);r.seek(m);break}case"ArrowUp":{a&&i.preventDefault();const m=Math.min(100,r.volume+l);r.setVolume(m);break}case"ArrowDown":{a&&i.preventDefault();const m=Math.max(0,r.volume-l);r.setVolume(m);break}}},[n,a,s,l,r.isPlaying,r.currentTime,r.duration,r.volume,r.pause,r.resume,r.seek,r.setVolume]);d.useEffect(()=>{if(n)return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}},[n,o])}function Pe({currentTime:r,duration:e,className:n,showSeparator:s=!0,separator:l=" / "}){const a=z(r),o=z(e);return t.jsxs("div",{className:h("flex items-center text-sm text-gray-600 dark:text-gray-400",n),role:"timer","aria-live":"polite","aria-atomic":"true",children:[t.jsx("span",{"aria-label":`Temps actuel: ${a}`,children:a}),s&&t.jsx("span",{className:"mx-1","aria-hidden":"true",children:l}),t.jsx("span",{"aria-label":`Durée totale: ${o}`,children:o})]})}function Le({repeat:r,shuffle:e,onRepeatChange:n,onShuffleToggle:s,className:l,disabled:a=!1,size:o="md",variant:i="ghost"}){const c={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"},m={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},x={default:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500 dark:bg-blue-500 dark:hover:bg-blue-600",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500 dark:text-gray-300 dark:hover:bg-gray-800",outline:"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus:ring-gray-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"},u=()=>{a||n(r==="off"?"track":r==="track"?"playlist":"off")},g=()=>{switch(r){case"track":return"Répéter la piste";case"playlist":return"Répéter la playlist";default:return"Répéter désactivé"}},N=()=>{switch(r){case"track":return"Répéter la piste (actif)";case"playlist":return"Répéter la playlist (actif)";default:return"Répéter désactivé"}};return t.jsxs("div",{className:h("flex items-center gap-2",l),children:[t.jsxs("button",{type:"button",onClick:u,disabled:a,className:h("rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 relative",c[o],x[i],r!=="off"&&"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",a&&"opacity-50 cursor-not-allowed"),"aria-label":N(),"aria-pressed":r!=="off","aria-disabled":a,title:g(),children:[t.jsx(ce,{className:h(m[o],r==="track"&&"fill-current"),"aria-hidden":"true"}),r==="playlist"&&t.jsx("span",{className:"absolute bottom-0 right-0 text-[8px] font-bold leading-none bg-blue-700 dark:bg-blue-600 rounded-full w-3 h-3 flex items-center justify-center","aria-hidden":"true",children:"1"}),t.jsx("span",{className:"sr-only",children:g()})]}),t.jsxs("button",{type:"button",onClick:s,disabled:a,className:h("rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",c[o],x[i],e&&"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",a&&"opacity-50 cursor-not-allowed"),"aria-label":e?"Mélanger activé":"Mélanger désactivé","aria-pressed":e,"aria-disabled":a,title:e?"Mélanger activé":"Mélanger désactivé",children:[t.jsx(de,{className:h(m[o],e&&"fill-current"),"aria-hidden":"true"}),t.jsx("span",{className:"sr-only",children:e?"Mélanger activé":"Mélanger désactivé"})]})]})}const $=[{value:"auto",label:"Auto",description:"Qualité automatique"},{value:"low",label:"Faible",description:"128 kbps"},{value:"medium",label:"Moyenne",description:"192 kbps"},{value:"high",label:"Haute",description:"320 kbps"},{value:"lossless",label:"Sans perte",description:"FLAC / WAV"}];function Re({currentQuality:r,availableQualities:e,onQualityChange:n,className:s,disabled:l=!1}){const[a,o]=d.useState(!1),i=d.useRef(null),c=e?$.filter(u=>e.includes(u.value)):$,m=c.find(u=>u.value===r)||c[0];d.useEffect(()=>{const u=g=>{i.current&&!i.current.contains(g.target)&&o(!1)};if(a)return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[a]);const x=u=>{n(u),o(!1)};return t.jsxs("div",{ref:i,className:h("relative",s),children:[t.jsxs("button",{type:"button",onClick:()=>!l&&o(!a),disabled:l,className:h("flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg","bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600","text-gray-700 dark:text-gray-300","hover:bg-gray-50 dark:hover:bg-gray-700","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors"),"aria-label":`Qualité audio: ${m.label}`,"aria-expanded":a,"aria-haspopup":"listbox","aria-disabled":l,children:[t.jsx("span",{children:m.label}),t.jsx(H,{className:h("h-4 w-4 transition-transform",a&&"transform rotate-180"),"aria-hidden":"true"})]}),a&&!l&&t.jsx("div",{className:"absolute z-50 mt-1 w-48 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg shadow-lg",role:"listbox",children:c.map(u=>t.jsxs("button",{type:"button",onClick:()=>x(u.value),className:h("w-full flex items-center justify-between px-4 py-2 text-sm text-left","hover:bg-gray-100 dark:hover:bg-gray-700","focus:outline-none focus:bg-gray-100 dark:focus:bg-gray-700","transition-colors",r===u.value&&"bg-blue-50 dark:bg-blue-900/20"),role:"option","aria-selected":r===u.value,children:[t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:u.label}),u.description&&t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:u.description})]}),r===u.value&&t.jsx(G,{className:"h-4 w-4 text-blue-600 dark:text-blue-400","aria-hidden":"true"})]},u.value))})]})}const q=[{value:.5,label:"0.5x"},{value:.75,label:"0.75x"},{value:1,label:"1x"},{value:1.25,label:"1.25x"},{value:1.5,label:"1.5x"},{value:1.75,label:"1.75x"},{value:2,label:"2x"}];function Ie({currentSpeed:r,onSpeedChange:e,className:n,disabled:s=!1,availableSpeeds:l}){const[a,o]=d.useState(!1),i=d.useRef(null),c=l?q.filter(u=>l.includes(u.value)):q,m=c.find(u=>u.value===r)||c.find(u=>u.value===1)||c[0];d.useEffect(()=>{const u=g=>{i.current&&!i.current.contains(g.target)&&o(!1)};if(a)return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[a]);const x=u=>{e(u),o(!1)};return t.jsxs("div",{ref:i,className:h("relative",n),children:[t.jsxs("button",{type:"button",onClick:()=>!s&&o(!a),disabled:s,className:h("flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg","bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600","text-gray-700 dark:text-gray-300","hover:bg-gray-50 dark:hover:bg-gray-700","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors"),"aria-label":`Vitesse de lecture: ${m.label}`,"aria-expanded":a,"aria-haspopup":"listbox","aria-disabled":s,title:`Vitesse: ${m.label}`,children:[t.jsx("span",{children:m.label}),t.jsx(H,{className:h("h-4 w-4 transition-transform",a&&"transform rotate-180"),"aria-hidden":"true"})]}),a&&!s&&t.jsx("div",{className:"absolute z-50 mt-1 w-32 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg shadow-lg",role:"listbox",children:c.map(u=>t.jsxs("button",{type:"button",onClick:()=>x(u.value),className:h("w-full flex items-center justify-between px-4 py-2 text-sm text-left","hover:bg-gray-100 dark:hover:bg-gray-700","focus:outline-none focus:bg-gray-100 dark:focus:bg-gray-700","transition-colors",r===u.value&&"bg-blue-50 dark:bg-blue-900/20"),role:"option","aria-selected":r===u.value,children:[t.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:u.label}),r===u.value&&t.jsx(G,{className:"h-4 w-4 text-blue-600 dark:text-blue-400","aria-hidden":"true"})]},u.value))})]})}const Q={network:"Erreur de connexion. Vérifiez votre connexion internet.",decode:"Erreur de décodage audio. Le fichier est peut-être corrompu.",source:"Erreur de source audio. Le fichier est introuvable ou inaccessible.",abort:"Chargement annulé.",unknown:"Une erreur est survenue lors de la lecture."};function Y(r){if(!r)return"unknown";const e=r.message.toLowerCase(),n=r.name.toLowerCase();return e.includes("network")||e.includes("fetch")||n==="networkerror"?"network":e.includes("decode")||n==="decodeerror"?"decode":e.includes("source")||e.includes("not found")||n==="notfounderror"?"source":e.includes("abort")||n==="aborterror"?"abort":"unknown"}function Ae(r,e){const n=e||Y(r);return Q[n]||Q.unknown}function B({error:r,errorType:e,onRetry:n,className:s,showRetry:l=!0,retryLabel:a="Réessayer"}){if(!r)return null;const o=e||Y(r),i=Ae(r,e),c=new Error(i);return r.stack&&(c.stack=r.stack),t.jsx("div",{className:h("w-full",s),children:t.jsx(me,{error:c,variant:"card",severity:"error",title:"Erreur de lecture",context:{action:"playing audio",resource:"player",errorType:o},onRetry:l&&n?n:void 0,showDetails:!1,dismissible:!1})})}function W({isLoading:r,message:e="Chargement...",size:n="md",className:s,fullScreen:l=!1}){if(!r)return null;const a={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"},o={sm:"text-xs",md:"text-sm",lg:"text-base"},i=l?"fixed inset-0 flex items-center justify-center bg-black/50 dark:bg-black/70 z-50":"flex items-center justify-center p-4";return t.jsxs("div",{className:h(i,s),role:"status","aria-live":"polite","aria-label":e,children:[t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(X,{className:h(a[n],"animate-spin text-blue-600 dark:text-blue-400"),"aria-hidden":"true"}),e&&t.jsx("p",{className:h(o[n],"text-gray-700 dark:text-gray-300 text-center"),children:e})]}),t.jsx("span",{className:"sr-only",children:e})]})}const Z=d.forwardRef(({label:r,variant:e="cyan",icon:n,size:s="md",dot:l,count:a,children:o,className:i,...c},m)=>{const u={default:"cyan",primary:"cyan",success:"lime",warning:"gold",error:"magenta",secondary:"magenta"}[e]||e,g={cyan:"bg-kodo-cyan/10 text-kodo-cyan border-kodo-cyan/30",magenta:"bg-kodo-magenta/10 text-kodo-magenta border-kodo-magenta/30",lime:"bg-kodo-lime/10 text-kodo-lime border-kodo-lime/30",gold:"bg-kodo-gold/10 text-kodo-gold border-kodo-gold/30",terminal:"bg-kodo-terminal/10 text-kodo-terminal border-kodo-terminal/30 font-mono"},N={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-0.5 text-[10px]",lg:"px-3 py-1 text-xs"},k=r||o,v=u;return t.jsxs("span",{ref:m,className:h("inline-flex items-center gap-1.5 rounded-full font-bold uppercase tracking-widest border",g[v]||g.cyan,N[s],i),...c,children:[l&&t.jsx("span",{className:"w-3 h-3 rounded-full bg-current"}),n&&t.jsx("span",{className:"w-3 h-3",children:n}),k,a!==void 0&&a>0&&t.jsx("span",{className:"ml-1 px-1.5 py-0.5 rounded-full bg-current/20 text-[10px]",children:a})]})});Z.displayName="Badge";function De({className:r,autoPlay:e=!1,preload:n="metadata",showQualitySelector:s=!0,showSpeedControl:l=!0,compact:a=!1}){const o=d.useRef(null),i=K(o),[c,m]=d.useState(null),[x,u]=d.useState(!1),[g,N]=d.useState("auto"),[k,v]=d.useState(1),S=U(b=>b.currentTrack),j=S?.id?`session_${S.id}`:null,{isSynced:w}=Ce({sessionId:j,trackId:S?.id??null});Me(i,{enabled:!0,seekStep:5,volumeStep:5}),d.useEffect(()=>{const b=o.current;if(!b)return;b.preload=n,b.autoplay=e;const p=()=>{const A=new Error("Erreur de lecture audio");m(A),u(!1)},y=()=>{u(!0),m(null)},C=()=>{u(!1),m(null)},R=()=>{b&&(b.playbackRate=k)};return b.addEventListener("error",p),b.addEventListener("loadstart",y),b.addEventListener("canplay",C),R(),()=>{b.removeEventListener("error",p),b.removeEventListener("loadstart",y),b.removeEventListener("canplay",C)}},[n,e,k]),d.useEffect(()=>{const b=o.current;b&&(b.playbackRate=k)},[k]);const E=()=>{i.isPlaying?i.pause():i.resume()},P=()=>{m(null),i.currentTrack&&i.play(i.currentTrack)},T=i.queue.length>0&&i.currentIndex<i.queue.length-1,L=i.queue.length>0&&i.currentIndex>0;return a?t.jsxs("div",{className:h("flex items-center gap-4 p-4",r),"data-testid":"audio-player",children:[t.jsx("audio",{ref:o,"data-testid":"audio-element",style:{display:"none"},preload:n,autoPlay:e}),c&&t.jsx(B,{error:c,onRetry:P}),x&&t.jsx(W,{isLoading:x,size:"sm"}),i.currentTrack&&!c&&!x&&t.jsxs(t.Fragment,{children:[t.jsx(D,{track:i.currentTrack,showCover:!0,coverSize:"sm",showMetadata:!1}),t.jsx(V,{isPlaying:i.isPlaying,onClick:E,size:"sm"}),t.jsx(I,{onNext:i.next,onPrevious:i.previous,canGoNext:T,canGoPrevious:L,size:"sm"}),t.jsx(_,{volume:i.volume,muted:i.muted,onVolumeChange:i.setVolume,onMuteToggle:i.toggleMute,showValue:!1})]}),!i.currentTrack&&!c&&t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Aucune piste sélectionnée"})]}):t.jsxs("div",{className:h("bg-white dark:bg-gray-900 rounded-lg shadow-lg p-6",r),"data-testid":"audio-player",children:[t.jsx("audio",{ref:o,"data-testid":"audio-element",style:{display:"none"},preload:n,autoPlay:e}),c&&t.jsx("div",{className:"mb-4",children:t.jsx(B,{error:c,onRetry:P})}),x&&t.jsx("div",{className:"mb-4",children:t.jsx(W,{isLoading:x,message:"Chargement de la piste..."})}),i.currentTrack&&!c&&!x&&t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{children:t.jsx(D,{track:i.currentTrack,showCover:!0,coverSize:"lg",showMetadata:!0})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{currentTime:i.currentTime,duration:i.duration,onSeek:i.seek,showTooltip:!0}),t.jsx("div",{className:"flex items-center justify-between",children:t.jsx(Pe,{currentTime:i.currentTime,duration:i.duration})})]}),t.jsxs("div",{className:"flex items-center justify-center gap-4",children:[t.jsx(Le,{repeat:i.repeat,shuffle:i.shuffle,onRepeatChange:i.setRepeat,onShuffleToggle:i.toggleShuffle,size:"md"}),t.jsx(I,{onNext:i.next,onPrevious:i.previous,canGoNext:T,canGoPrevious:L,size:"md"}),t.jsx(V,{isPlaying:i.isPlaying,onClick:E,size:"lg",variant:"default"}),t.jsx(I,{onNext:i.next,onPrevious:i.previous,canGoNext:T,canGoPrevious:L,size:"md"}),t.jsx(_,{volume:i.volume,muted:i.muted,onVolumeChange:i.setVolume,onMuteToggle:i.toggleMute,showValue:!0,showSlider:!0})]}),(s||l)&&t.jsxs("div",{className:"flex items-center justify-between gap-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(Z,{variant:w?"success":"default",className:h("gap-1",!w&&"text-gray-500"),children:[w?t.jsx(he,{className:"h-3 w-3"}):t.jsx(ge,{className:"h-3 w-3"}),t.jsx("span",{className:"text-xs",children:w?"Sync":"Local"})]}),j&&!w&&t.jsx("span",{className:"text-xs text-muted-foreground hidden lg:inline",children:"Connecting to session..."})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[l&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Vitesse:"}),t.jsx(Ie,{currentSpeed:k,onSpeedChange:v})]}),s&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Qualité:"}),t.jsx(Re,{currentQuality:g,onQualityChange:N})]})]})]})]}),!i.currentTrack&&!c&&!x&&t.jsxs("div",{className:"text-center py-12",children:[t.jsx("div",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Aucune piste sélectionnée"}),t.jsx("div",{className:"text-sm text-gray-400 dark:text-gray-500",children:"Sélectionnez une piste pour commencer la lecture"})]})]})}function Fe(){const r=U(s=>s.currentTrack),[e,n]=d.useState(!1);return r?t.jsxs(t.Fragment,{children:[t.jsx(Ee,{isVisible:!e,onToggle:()=>n(!0),className:"border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60"}),t.jsx(fe,{open:e,onOpenChange:n,children:t.jsx(xe,{className:"max-w-4xl h-[80vh] p-0 overflow-hidden border-none bg-transparent shadow-none sm:rounded-xl",children:t.jsxs("div",{className:"relative w-full h-full bg-background rounded-xl overflow-y-auto border shadow-2xl",children:[t.jsx("div",{className:"absolute top-4 right-4 z-50",children:t.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>n(!1),children:t.jsx(be,{className:"h-5 w-5"})})}),t.jsx(De,{className:"h-full border-none shadow-none",compact:!1})]})})})]}):null}export{Z as B,Fe as G,Ue as K,U as u};
|
|
//# sourceMappingURL=chunk-CSrBv2n5.js.map
|