{#if musicPlayerConfig.enable} {#if showError}
{errorMessage}
{/if}
{#if showPlaylist}
{i18n(Key.playlist)}
{#each playlist as song, index}
playSong(index)} onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); playSong(index); } }} role="button" tabindex="0" aria-label="播放 {song.title} - {song.artist}">
{#if index === currentIndex && isPlaying}
{:else if index === currentIndex}
{:else}
{index + 1}
{/if}
{song.title}
{song.artist}
{/each}
{/if}
{ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleCollapse(); } }} role="button" tabindex="0" aria-label={i18n(Key.musicExpand)}> {#if isLoading}
{:else if isPlaying}
{:else}
{/if}
{currentSong.title}
{currentSong.artist}
{formatTime(currentTime)} / {formatTime(duration)}
{ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); const rect = progressBar?.getBoundingClientRect(); if (rect) { const percent = 0.5; const newTime = percent * duration; if (audio) { audio.currentTime = newTime; currentTime = newTime; } } } }} role="slider" tabindex="0" aria-label={i18n(Key.musicProgress)} aria-valuemin="0" aria-valuemax="100" aria-valuenow={duration > 0 ? (currentTime / duration * 100) : 0}>
{#if isLoading}
{:else if isPlaying}
{:else}
{/if}
0} class:btn-plain={isRepeating === 0} onclick={toggleRepeat}> {#if isRepeating === 1}
{:else if isRepeating === 2}
{:else}
{/if}
{#if isMuted || volume === 0}
{:else if volume < 0.5}
{:else}
{/if}
{ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); if (e.key === 'Enter') toggleMute(); } }} role="slider" tabindex="0" aria-label={i18n(Key.musicVolume)} aria-valuemin="0" aria-valuemax="100" aria-valuenow={volume * 100}>
{/if}