{#if mode === "categories"}
{#if show_legend}
{#each Object.entries(_color_map) as [category, color], i}
handle_mouseover(category)}
on:focus={() => handle_mouseover(category)}
on:mouseout={() => handle_mouseout()}
on:blur={() => handle_mouseout()}
class="category-label"
style={"background-color:" + color.secondary}
>
{category}
{/each}
{/if}
{#each value as [text, category], i}
{#each splitTextByNewline(text) as line, j}
{#if line.trim() !== ""}
{
dispatch("select", {
index: i,
value: [text, category],
});
}}
>
{line}
{#if !show_legend && category !== null}
{category}
{/if}
{/if}
{#if j < splitTextByNewline(text).length - 1}
{/if}
{/each}
{/each}
{:else}
{#if show_legend}
-1
0
+1
{/if}
{#each value as [text, _score]}
{@const score = typeof _score === "string" ? parseInt(_score) : _score}
{text}
{/each}
{/if}