{#each pages as p}
{#each ['header', 'footer'] as const as zone}
{#if !(hfActive === zone && editingPage === p)}
{@const html = zoneHtml(zone, p)}
startEdit(zone, p)}
role="button"
tabindex="-1"
use:patchFields={[p, numPages, html]}
>
{@html html}
{/if}
{/each}
{/each}
{#if hfActive}
{@const box = activeZoneBox(hfActive, editingPage)}
{@const variant = variantFor(editingPage)}
{hfActive === 'header'
? (variant === 'first' ? t().hf.firstPageHeader : variant === 'even' ? t().hf.evenPageHeader : t().hf.headerLabel)
: (variant === 'first' ? t().hf.firstPageFooter : variant === 'even' ? t().hf.evenPageFooter : t().hf.footerLabel)}
{t().hf.insert}
{/if}