{% extends "base.html" %}
{% block extra_head %}
<link rel="stylesheet" href="{{ static_url('/static/css/sidebar.css') }}">
<link rel="stylesheet" href="{{ static_url('/static/css/docs.css') }}">
<link rel="stylesheet" href="{{ static_url('/static/css/components-docs.css') }}">
{% endblock %}
{% block content %}
<script>window.DEVPLACE_DOCS = {{ {
    "base": base,
    "loggedIn": user is not none,
    "username": (user.get('username') if user else ''),
    "apiKey": (user.get('api_key') if user else ''),
    "isAdmin": is_admin(user)
} | tojson | safe }};</script>
<div class="docs-layout">
    <aside class="sidebar-card" role="navigation" aria-label="Documentation">
        <div class="sidebar-heading" role="heading" aria-level="2">Documentation</div>
        <form class="docs-search-form" method="get" action="/docs/search.html" role="search">
            <input type="search" name="q" value="{{ search_query|default('', true) }}" placeholder="Search docs…" aria-label="Search documentation" class="docs-search-input">
        </form>
        <div class="sidebar-nav">
            <a href="/docs/search.html" class="sidebar-link {% if current == 'search' %}active{% endif %}">
                <span class="icon">&#x1F50D;</span>
                Search
            </a>
            {% for audience, tiers in nav %}
            <div class="sidebar-heading sidebar-tier" role="heading" aria-level="2">{{ audience }}</div>
            {% for section, section_pages in tiers %}
            <div class="sidebar-heading sidebar-subheading" role="heading" aria-level="3">{{ section }}</div>
            {% for p in section_pages %}
            <a href="/docs/{{ p.slug }}.html" class="sidebar-link sidebar-link-nested {% if p.slug == current %}active{% endif %}">
                <span class="icon">&#x1F4D8;</span>
                {{ p.title }}
            </a>
            {% endfor %}
            {% endfor %}
            {% endfor %}
        </div>
        <div class="sidebar-heading docs-download-heading" role="heading" aria-level="2">Download</div>
        <div class="sidebar-nav">
            <a href="/docs/download.html" class="sidebar-link"><span class="icon">&#x1F4E5;</span> Single HTML</a>
            <a href="/docs/download.md" class="sidebar-link"><span class="icon">&#x1F4DD;</span> Markdown</a>
        </div>
    </aside>
    <article class="docs-main">
        {% if kind == 'search' %}
            {% if search_mode == 'agent' %}
                {% include "docs/_chat.html" %}
            {% else %}
                {% include "docs/_search.html" %}
            {% endif %}
        {% elif kind == 'api' %}
            {% include "docs/_api_page.html" %}
        {% elif prose_html %}
            {{ prose_html | safe }}
        {% else %}
            {% include "docs/" ~ current ~ ".html" %}
        {% endif %}
    </article>
</div>
{% endblock %}
{% block extra_js %}
<script type="module" src="{{ static_url('/static/js/ApiDocs.js') }}"></script>
{% endblock %}
