"""
Terminal override tables keyed by canonical terminal software name.

This code generated by python wcwidth using ucs-detect project data.
"""
# pylint: skip-file
from __future__ import annotations
{%- for category in categories %}
{%- set varname = category.variable_name -%}
{%- set shared_sets = category.shared_sets -%}
{%- set terminal_refs = category.terminal_refs -%}
{%- set set_terminals = category.set_terminals -%}
{%- if shared_sets %}
{%- for hash_key, overrides in shared_sets | dictsort %}
{%- set terminals = set_terminals.get(hash_key, ()) %}

# For terminals: {{ terminals | join(', ') }}
_SET_{{ varname }}_{{ hash_key | upper }}: dict[str, tuple[tuple[int, int], ...]] = {
{%- for direction, ranges in overrides.items() %}
{%- if ranges %}
    '{{ direction }}': (
{%- for hex_start, hex_end, txt_description in ranges %}
        ({{ hex_start }}, {{ hex_end }},),  # {{ txt_description }}
{%- endfor %}
    ),
{%- endif %}
{%- endfor %}
}
{%- endfor %}
{%- endif %}

{{ varname }}: dict[str, dict[str, tuple[tuple[int, int], ...]]] = {
{%- for term_name, hash_key in terminal_refs | dictsort %}
    '{{ term_name }}': _SET_{{ varname }}_{{ hash_key | upper }},
{%- endfor %}
}

{%- endfor %}

__all__ = [{% for category in categories %}'{{ category.variable_name }}'{% if not loop.last %}, {% endif %}{% endfor %}]
