Audio Narration
{#if voices.length > 0} {/if}
{#if showVoicePanel && voices.length > 0}
Choose Voice
{#each voices as v (v)}
selectVoice(v)} onkeydown={(e) => e.key === 'Enter' && selectVoice(v)} >
{#if audioStore.voice === v} {/if}
{voiceLabel(v)} {v}
{/each}
{/if} {#if audioStore.isCurrentChapter(slug, chapter)} {#if audioStore.status === 'idle' || audioStore.status === 'error'} {#if audioStore.status === 'error'}

{audioStore.errorMsg || 'Failed to load audio.'}

{/if} {:else if audioStore.status === 'loading'} {:else if audioStore.status === 'generating'}

Generating narration…

{Math.round(audioStore.progress)}%

{:else if audioStore.status === 'ready'}
{#if audioStore.isPlaying} Playing — controls below {:else} Paused — controls below {/if} {formatTime(audioStore.currentTime)} / {formatTime(audioStore.duration)}
{#if nextChapter !== null && nextChapter !== undefined} {/if}
{#if audioStore.autoNext && nextChapter !== null && nextChapter !== undefined}
{#if audioStore.nextStatus === 'prefetching'}
Preparing Ch.{nextChapter}… {Math.round(audioStore.nextProgress)}%
{:else if audioStore.nextStatus === 'prefetched'}

Ch.{nextChapter} ready

{:else if audioStore.nextStatus === 'failed'}

Ch.{nextChapter} will generate on navigate

{/if}
{/if} {/if} {:else if audioStore.active}

Now playing: {audioStore.chapterTitle || `Ch.${audioStore.chapter}`}

{:else} {/if}