{%- block doctype -%}
<!DOCTYPE html>
{%- endblock %}
{%- set reldelim1 = reldelim1 is not defined and ' &#187;' or reldelim1 %}
{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and
                                                 (sidebars != []) %}
{# URL root should never be #, then all links are fragments #}
{%- if not embedded and docstitle %}
    {%- set titlesuffix = " &#8212; "|safe + docstitle|e %}
{%- else %}
    {%- set titlesuffix = "" %}
{%- endif %}

{%- macro sidebar() %}
            {%- if render_sidebar %}
            <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
                <div class="header">
                    <div class="internal">
                        <a href="{{ pathto(root_doc)|e }}">
                            {%- if logo_url %}
                                <img src="{{ logo_url|e }}" alt="Logo"/>
                            {%- endif %}
                            index
                        </a>
                    </div>
                    <div class="external">
                        <a href="{{ github_url }}">
                            <img src="{{ pathto('_static/images/github-mark-white.png', 1) }}"/>
                        </a>
                    </div>
                </div>
                <div class="sphinxsidebarwrapper">
                    {%- if sidebars != None %}
                        {#- new style sidebar: explicitly include/exclude templates #}
                        {%- for sidebartemplate in sidebars %}
                        {%- include sidebartemplate %}
                        {%- endfor %}
                    {%- else %}
                        {#- old style sidebars: using blocks -- should be deprecated #}
                        {%- block sidebartoc %}
                        {%- include "localtoc.html" %}
                        {%- endblock %}
                        {%- block sidebarrel %}
                        {%- include "relations.html" %}
                        {%- endblock %}
                        {%- block sidebarsourcelink %}
                        {%- include "sourcelink.html" %}
                        {%- endblock %}
                        {%- if customsidebar %}
                        {%- include customsidebar %}
                        {%- endif %}
                        {%- block sidebarsearch %}
                        {%- include "searchbox.html" %}
                        {%- endblock %}
                    {%- endif %}
                </div>
                {%- block sidebarextra %}{%- endblock %}
            </div>
            {%- endif %}
{%- endmacro %}

{%- macro script() %}
        {%- for js in script_files %}
        {{ js_tag(js) }}
        {%- endfor %}
{%- endmacro %}

{%- macro css() %}
        {%- for css in css_files %}
            {%- if css|attr("filename") %}
        {{ css_tag(css) }}
            {%- else %}
        <link rel="stylesheet" href="{{ pathto(css, 1)|e }}" type="text/css" />
            {%- endif %}
        {%- endfor %}
{%- endmacro %}

{%- if html_tag %}
{{ html_tag }}
{%- else %}
<html{% if language is not none %} lang="{{ language }}"{% endif %}>
{%- endif %}
    <head>
        <meta charset="{{ encoding }}" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        {{- metatags }}
        {%- block htmltitle %}
        <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
        {%- endblock %}
        {%- block css %}
        {{- css() }}
        {%- endblock %}
        {%- if not embedded %}
        {%- block scripts %}
        {{- script() }}
        {%- endblock %}
        {%- if pageurl %}
        <link rel="canonical" href="{{ pageurl|e }}" />
        {%- endif %}
        {%- if use_opensearch %}
        <link rel="search" type="application/opensearchdescription+xml"
                    title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
                    href="{{ pathto('_static/opensearch.xml', 1) }}"/>
        {%- endif %}
        {%- if favicon_url %}
        <link rel="icon" href="{{ favicon_url|e }}"/>
        {%- endif %}
        {%- endif %}
{%- block linktags %}
        {%- if hasdoc('about') %}
        <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
        {%- endif %}
        {%- if hasdoc('genindex') %}
        <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
        {%- endif %}
        {%- if hasdoc('search') %}
        <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
        {%- endif %}
        {%- if hasdoc('copyright') %}
        <link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
        {%- endif %}
        {%- if next %}
        <link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
        {%- endif %}
        {%- if prev %}
        <link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
        {%- endif %}
{%- endblock %}
{%- block extrahead %} {% endblock %}
    </head>
    {%- block body_tag %}<body>{% endblock %}
{%- block header %}{% endblock %}

{%- block content %}
    {%- block sidebar1 %} {# possible location for sidebar #} {% endblock %}
        <div class="document">
    {%- block document %}
            <div class="documentwrapper">
            {%- if render_sidebar %}
                <div class="bodywrapper">
            {%- endif %}
                    <div class="body" role="main">
                        {% block body %} {% endblock %}
                        <div class="clearer"></div>
                    </div>
            {%- if render_sidebar %}
                </div>
            {%- endif %}
            </div>
    {%- endblock %}

    {%- block sidebar2 %}{{ sidebar() }}{% endblock %}
            <div class="clearer"></div>
        </div>
{%- endblock %}

{%- macro copyright_block() %}
    {%- if hasdoc('copyright') %}
        {%- set copyright_prefix = '<a href="' + pathto('copyright') + '">' + _('Copyright') + '</a>' -%}
    {%- else %}
        {%- set copyright_prefix = _('Copyright') %}
    {%- endif %}
    {%- if copyright is iterable and copyright is not string %}
        {% for copyright_line in copyright %}
            {% trans trimmed copyright_prefix=copyright_prefix, copyright=copyright_line|e %}
                &#169; {{ copyright_prefix }} {{ copyright }}.
            {% endtrans %}
            {%- if not loop.last %}<br/>{%- endif %}
        {% endfor %}
    {%- else %}
        {% trans trimmed copyright_prefix=copyright_prefix, copyright=copyright|e %}
            &#169; {{ copyright_prefix }} {{ copyright }}.
        {% endtrans %}
    {%- endif %}
{%- endmacro %}
    </body>
    <script>
document.querySelectorAll('.sphinxsidebarwrapper li').forEach(
        (li) => {
                li.addEventListener(
                        'click',
                        (event) => {
                                // remove "current" from all siblings
                                const element = event.target.closest('li');
                                element.closest('ul').querySelectorAll('li').forEach(
                                        (element) => {
                                                element = element.classList.remove('current');
                                        }
                                );
                                element.classList.toggle('current');
                        }
                )
        }
);
    </script>
</html>