{#each timeline as op}
{#if op.type === "lifecycle"}
{#if op.state.status === "open"}
{:else}
{/if}
{#if op.state.status === "closed"}
closed issue as {op.state.reason}
{:else if op.state.status === "open"}
reopened issue
{/if}
{formatTimestamp(op.timestamp)}
{:else if op.type === "label"}
{#if op.previous && op.previous.type === op.type}
{@const changed = itemDiff(op.previous?.labels ?? [], op.labels)}
{#if changed.added.length || changed.removed.length}
{#if changed.added.length}
added {pluralize("label", changed.removed.length)}
{#each changed.added as label}
{label}
{/each}
{/if}
{#if changed.removed.length}
removed {pluralize("label", changed.removed.length)}
{#each changed.removed as label}
{label}
{/each}
{/if}
{/if}
{:else}
added {pluralize("label", op.labels.length)}
{#each op.labels as label}
{label}
{/each}
{/if}
{formatTimestamp(op.timestamp)}
{:else if op.type === "assign"}
{#if op.previous && op.previous.type === op.type}
{@const changed = itemDiff
(
op.previous?.assignees ?? [],
op.assignees,
)}
{#if changed.added.length || changed.removed.length}
{#if changed.added.length}
assigned
{#each changed.added as assignee}
{/each}
{/if}
{#if changed.removed.length}
unassigned
{#each changed.removed as assignee}
{/each}
{/if}
{/if}
{:else}
assigned
{#each op.assignees as assignee}
{/each}
{/if}
{formatTimestamp(op.timestamp)}
{:else if op.type === "edit"}
{#if op.previous && op.previous.type === op.type}
changed title
{op.previous.title}
-> {op.title}
{formatTimestamp(op.timestamp)}
{/if}
{:else if op.type === "comment"}
{#if op.id === activity[0].id}
opened issue
{formatTimestamp(op.timestamp)}
{:else}
{/if}
{/if}
{/each}