{#if _citations.length > 0}
{#if _citations.length <= 3} {#each _citations as citation, idx}
{ showCitationModal = true; selectedCitation = citation; }} > {#if _citations.every((c) => c.distances !== undefined)}
{idx + 1}
{/if}
{citation.source.name}
{/each} {:else}
{$i18n.t('References from')}
{#if _citations.length > 1 && _citations .slice(0, 2) .reduce((acc, citation) => acc + citation.source.name.length, 0) <= 50} {#each _citations.slice(0, 2) as citation, idx}
{ showCitationModal = true; selectedCitation = citation; }} > {#if _citations.every((c) => c.distances !== undefined)}
{idx + 1}
{/if}
{citation.source.name}
{#if idx === 0}
,
{/if}
{/each} {:else} {#each _citations.slice(0, 1) as citation, idx}
{ showCitationModal = true; selectedCitation = citation; }} > {#if _citations.every((c) => c.distances !== undefined)}
{idx + 1}
{/if}
{citation.source.name}
{/each} {/if}
{$i18n.t('and')}
{_citations.length - (_citations.length > 1 && _citations .slice(0, 2) .reduce((acc, citation) => acc + citation.source.name.length, 0) <= 50 ? 2 : 1)}
{$i18n.t('more')}
{#if isCollapsibleOpen}
{:else}
{/if}
{#each _citations as citation, idx}
{ showCitationModal = true; selectedCitation = citation; }} > {#if _citations.every((c) => c.distances !== undefined)}
{idx + 1}
{/if}
{citation.source.name}
{/each}
{/if}
{/if}