{#snippet amounts( sums: Money[], big: boolean )} {#each sums as sum, i (sum.code)} {#if i > 0} + {/if} {fmt(sum.code, sum.amount, 0)} {/each} {/snippet}
{#if lead} {@render lead()} {:else if !model.loading}

{#if facts.count > 0} {@render amounts(facts.sums, true)} {when} · {counted(facts.count, noun)} {#if facts.median} · median {fmt(facts.median.code, facts.median.amount, 0)} {/if} {#if perWeek !== null} · {formatNumber(perWeek, perWeek < 10 ? 1 : 0)} per week {/if} {:else} Nothing {when} {#if model.history.last} · last {formatDate(model.history.last)} {/if} {/if}

{/if} {#if !model.loading && main}

{#if lead} {#if facts.count > 0} {@render amounts(facts.sums, false)} {when} · {:else} nothing {when} · {/if} {/if} {#if typicals.length > 0} typical month {@render amounts( typicals.map((n) => ({ amount: n.typical, code: n.code })), false )} {#if main.projected !== null} · on pace for {isApprox(main.code) ? "" : "≈"} {fmt(main.code, main.projected, 0)}, {:else if main.ratio !== null} · {/if} {#if main.ratio !== null} {versusText(main.ratio)} {/if} {:else if model.typicalMonths.length > 0} in {active} of the last {model.typicalMonths.length} {model.typicalMonths.length === 1 ? "month" : "months"} {/if}

{/if}