${this.t('Kua')} ${d.kua ?? ''}
${
d.group
? html`${this.t('{{direction}} group', {
direction: displayOption(locale, 'facing', capitalize(d.group)),
})}`
: nothing
}
${
trigram
? html`${this.t('Trigram')}
${trigram.chinese ?? ''} ${trigram.symbol ?? ''}
${trigram.english ?? ''} ${display(trigram, 'element')}`
: nothing
}
${
trigram?.familyMember
? html`${this.t('Role')}${trigram.familyMember}`
: nothing
}
${'solarYear' in d && typeof d.solarYear === 'number' ? html`${this.t('Year')}${formatDateGrain(locale, String(d.solarYear), 'year')}` : nothing}
${'gender' in d && d.gender ? html`${displayField(locale, 'gender')}${displayOption(locale, 'gender', d.gender)}` : nothing}
${
// The formula reads the Chinese year, which turns in early February, so
// the boundary is what a reader born in January has to check.
'boundaryDate' in d && d.boundaryDate
? html`${this.t('Year boundary')} ${formatDate(locale, d.boundaryDate)}`
: nothing
}
${
'reassigned' in d && d.reassigned
? html`${this.t('Reassigned from {{value}}', {
value: String('rawKua' in d ? (d.rawKua ?? '') : ''),
})}`
: nothing
}
${this.renderBestWorst(d)}
${GRID_ORDER.map((name) => this.renderSector(d, name))}
${this.t('Favourable')}
${this.t('Unfavourable')}
${this.renderSectorRows(d)}
${
'conventions' in d
? renderConventionsCaption(
d.conventions,
this.translator,
this.effectiveLang(),
)
: nothing
}
`;
}
/** The single best and worst sector, which the mansions response names outright. */
private renderBestWorst(d: KuaData) {
// The attribute decides whether the fuller read is drawn and the shape check
// narrows the type under it, so a page that asked for the Kua number alone
// never grows a verdict its endpoint did not return.
if (this.mode !== 'mansions' || !('bestSector' in d)) return nothing;
const locale = this.effectiveLang();
return html`${
d.bestSector
? html`