{confirmAnnouncement}
{#if isQuietware} {#snippet header()}

History

{viewMode === "trash" ? "Recover transcripts within 30 days." : "Search and reopen saved transcripts."}

{/snippet} {#snippet primary()}
{#if trashError && viewMode === "trash"}
trashError = ""}> {trashError}
{/if}
{#if viewMode === "live"} {#if filtered.length === 0}
{:else}
    {#each liveGroups as group (group.key)}
    • {#each group.items as item (item.id)} {@const previewText = quietRowPreview(item)} {@const sourceLabel = quietRowSourceLabel(item)}
    • {#if sourceLabel === "File"}

      {item.title?.trim() || "Untitled"}

      {previewText || "No preview available"}

      {quietRowTime(item.savedAt || item.timestamp)} {#if item.duration}  · {formatDuration(item.duration)} {/if}  · {sourceLabel}

      openViewer(item)}>Open copyItem(item) }, { value: "export", label: "Export markdown", icon: FileDown, onSelect: () => exportMarkdown(item) }, { kind: "separator" as const }, { value: "delete", label: "Move to Trash", icon: Trash2, destructive: true, onSelect: () => removeItem(item) }, ]} > {#snippet trigger()} {/snippet}
    • {/each}
  • {/each}
{/if} {:else} {#if trashLoading && trashItems.length === 0}
Loading trash…
{:else if trashItems.length === 0}
{:else}
    {#each trashItems as item (item.id)} {@const previewText = quietRowPreview(item)} {@const sourceLabel = quietRowSourceLabel(item)}
  • {#if sourceLabel === "File"}

    {item.title?.trim() || "Untitled"}

    {previewText || "No preview available"}

    Deleted {formatTrashTimestamp(item.deleted_at || item.createdAt)} · Auto-purges after 30 days

    restoreFromTrash(item.id)} >{restoringId === item.id ? "Restoring…" : "Restore"}
  • {/each}
{/if} {/if}
{/snippet} {#snippet metadata()}
{history.length} saved · {trashItems.length} in trash · Local only
{/snippet}
{:else}

History

{viewMode === "trash" ? `${trashItems.length} in Trash` : `${history.length} saved`}
{#if viewMode === "live"} {#if history.some((i) => !i.llmTags || i.llmTags.length === 0)} {/if} {#if history.length > 0} {/if} {:else} {/if}
{#if clearAllModalOpen} {/if} {#if viewMode === "live"}
{#if allTags.length > 0}
Tags {#if activeTagFilter} {:else} {#each allTags.slice(0, 7) as t (t.tag)} {/each} {/if}
{/if} {#if selected.size > 0} {/if}
{#if filtered.length === 0} {:else}
{#each visibleItems as { item, top, height, preview } (item.id)}
toggleExpand(item.id)} onkeydown={(e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggleExpand(item.id); } }} role="button" tabindex="0" aria-expanded={expandedId === item.id} > { e.stopPropagation(); toggleSelected(item.id); }} onkeydown={(e) => { if (e.key === " " || e.key === "Enter") e.stopPropagation(); }} /> {#if item.audioPath} {:else}
{/if}

{preview?.text || compactPreviewText(item)}

{#if item.duration} {formatDuration(item.duration)} {/if} {#if item.source && item.source.toLowerCase().includes("file")} {item.date}
{#if expandedId === item.id}
{#if item.audioPath && playingId === item.id}
{formatTime(currentTime)} / {formatTime(duration)} e.stopPropagation()} />
{#each PLAYBACK_SPEEDS as speed} {/each}
{/if} { item.title = e.target.value; }} onblur={() => renameHistoryEntry(item.id, { title: (item.title || "").trim() }).catch(() => {})} onclick={(e) => e.stopPropagation()} data-no-transition />
e.stopPropagation()} role="presentation"> {#each deriveAutoTags(item) as t (t)} {t} {/each} {#each (item.manualTags || []) as t (t)} {t} {/each} {#each (item.llmTags || []) as t (t)} {/each} handleAddTagKey(e, item)} data-no-transition />

{item.text}

{#if item.audioPath && item.segments && item.segments.length > 0} {/if}
{/if}
{/each}
{/if}
{:else}
Trashed items are kept for 30 days, then permanently deleted on next app start.
{#if trashLoading && trashItems.length === 0} {:else if trashError && trashItems.length === 0} {:else if trashItems.length === 0} {:else}
{#each trashItems as item (item.id)}
{item.title || (item.text ? item.text.slice(0, 80) : "Untitled")}
Created {formatTrashTimestamp(item.createdAt)}
{/each}
{/if}
{/if} {/if}