{# Add version selector This generates a version selector similar to the rtd
version selector using the data exposed by `sphinx-multiversion` through
current, latest_version and versions. It uses the same classes and ids as the
version picker provided by the theme for use with readthedocs.io The css styling
can be found in `css/version-selector.css`. The template doesn't fail when the
needed data isn't provided but the result doesn't work as expected. #}

<div
    id="furo-readthedocs-versions"
    class="rst-versions"
    data-toggle="rst-versions"
    role="note"
    aria-label="{{ _('Versions') }}"
    tabindex="0"
>
    {# this element shows the current version and is visible by default It hides
    on hover while the element below becomes appears in its place. #}
    <span class="rst-current-version" data-toggle="rst-current-version">
        {# git icon indicating the version selector #}
        <i class="bi bi-git"></i>
        {# show current version; prepend `v` in case of branches #} {% if not
        current or not current.name.startswith("v") %} v: {% endif %} {{
        current.name if current else "undefined" }}
    </span>
    {% if revisions %} {# This item lists the available versions grouped into
    branches and tags. The item is hidden by default but appears when the user
    hovers over the version selector. #}
    <div class="rst-other-versions">
        {% if tags %} {# List of tags #}
        <dl>
            <dt>
                <i class="bi bi-tags-fill version-header"></i>{{ _('Tags') }}
            </dt>
            {% for item in tags %}
            <dd><a href="../{{ item.name }}/index.html">{{ item.name }}</a></dd>
            {% endfor %}
        </dl>
        {% endif %} {% if branches %} {# List of branches #}
        <dl>
            <dt><i class="bi bi-git version-header"></i>{{ _('Branches') }}</dt>
            {% for item in branches %}
            <dd><a href="../{{ item.name }}/index.html">{{ item.name }}</a></dd>
            {% endfor %}
        </dl>
        {% endif %}
    </div>
    {% endif %}
</div>
