<div class="trace trace-as-html">
    <div class="trace-details">
        <div class="trace-head">
            <span class="sf-toggle" data-toggle-selector="#trace-html-{{ index }}" data-toggle-initial="{{ expand ? 'display' }}">
                <h3 class="trace-class">
                    <span class="icon icon-close">{{ include('@Twig/images/icon-minus-square-o.svg') }}</span>
                    <span class="icon icon-open">{{ include('@Twig/images/icon-plus-square-o.svg') }}</span>

                    <span class="trace-namespace">
                        {{ exception.class|split('\\')|slice(0, -1)|join('\\') }}
                        {{- exception.class|split('\\')|length > 1 ? '\\' }}
                    </span>
                    {{ exception.class|split('\\')|last }}
                </h3>

                {% if exception.message is not empty and index > 1 %}
                    <p class="break-long-words trace-message">{{ exception.message }}</p>
                {% endif %}
            </span>
        </div>

        <div id="trace-html-{{ index }}" class="sf-toggle-content">
        {% set _is_first_user_code = true %}
        {% for i, trace in exception.trace %}
            {% set _is_vendor_trace = trace.file is not empty and ('/vendor/' in trace.file or '/var/cache/' in trace.file) %}
            {% set _display_code_snippet = _is_first_user_code and not _is_vendor_trace %}
            {% if _display_code_snippet %}{% set _is_first_user_code = false %}{% endif %}
            <div class="trace-line {{ _is_vendor_trace ? 'trace-from-vendor' }}">
                {{ include('@Twig/Exception/trace.html.twig', { prefix: index, i: i, trace: trace, style: _is_vendor_trace ? 'compact' : _display_code_snippet ? 'expanded' }, with_context = false) }}
            </div>
        {% endfor %}
        </div>
    </div>
</div>
