{# -*- engine: jinja -*- #}
<div class="Box m-3">
    <div class="Box-header d-flex flex-space-between">
    </div>
    <div style="overflow-x: auto;">
        <table class="text-mono text-small" style="width:100%;">
            <tr>
                <th class="p-2">Line</th>
                <th class="p-2">Branch</th>
                {% if not EXCLUDE_CONDITIONS %}
                <th class="p-2">Condition</th>
                {% endif %}
                {% if SHOW_DECISION %}
                <th class="p-2">Decision</th>
                {% endif %}
                {% if not EXCLUDE_CALLS %}
                <th class="p-2">Call</th>
                {% endif %}
                <th class="p-2">Exec</th>
                <th class="p-2 text-left" style="width: 100%;">Source</th>
            </tr>
            {% if info.single_page %}
            {%  set anchor_prefix = html_filename + "|" %}
            {% else %}
            {%  set anchor_prefix = '' %}
            {% endif %}
            {% for row in source_lines %}
            <tr>
                <td class="text-right src linenos"><a class="normal" id="{{ anchor_prefix }}l{{row.lineno}}" href="#l{{row.lineno}}">{{row.lineno}}</a></td>
                <td class="text-right src linenos ws-unset">
                    {% if row.linebranch %}
                    <details class="normal details-overlay">
                        <summary>{{row.linebranch.taken}}/{{row.linebranch.total}}</summary>
                        <div class="text-left position-absolute color-bg-subtle p-3 mt-2" style="z-index: 1;">
                            {% for branch in row.linebranch.branches %}
                            {% if branch.excluded %}
                            <div class="color-excluded-branch">&ndash; Branch {{branch.name}} excluded.</div>
                            {% elif branch.taken %}
                            <div class="color-taken-branch">&check; Branch {{branch.name}} taken {{branch.count}} times.</div>
                            {% else %}
                            <div class="color-fg-danger">&cross; Branch {{branch.name}} not taken.</div>
                            {% endif%}
                            {% endfor %}
                        </div>
                    </details>
                    {% endif %}
                </td>
                {% if not EXCLUDE_CONDITIONS %}
                <td class="text-right src linenos ws-unset">
                    {% if row.linecondition %}
                    <details class="normal details-overlay">
                        <summary>{% if row.linecondition %}{{row.linecondition.covered}}/{{row.linecondition.count}}{% endif %}</summary>
                        <div class="text-left position-absolute color-bg-subtle p-3 mt-2" style="z-index: 1;">
                            {% for condition in row.linecondition.condition %}
                            {% if condition.not_covered_true and condition.not_covered_false %}
                            <div class="color-fg-danger">&cross; {% if condition.name is not none %}Condition {{condition.name}}: {% endif %}Not covered.</div>
                            {% elif condition.not_covered_true %}
                            <div class="color-fg-danger">&cross; {% if condition.name is not none %}Condition {{condition.name}}: {% endif %}True not covered.</div>
                            {% elif condition.not_covered_false %}
                            <div class="color-fg-danger">&cross; {% if condition.name is not none %}Condition {{condition.name}}: {% endif %}False not covered.</div>
                            {% else %}
                            <div class="color-taken-branch">&check; {% if condition.name is not none %}Condition {{condition.name}}: {% endif %}Fully covered.</div>
                            {% endif%}
                            {% endfor %}
                        </div>
                    </details>
                    {% endif %}
                </td>
                {% endif %}
                {% if SHOW_DECISION %}
                <td class="text-right src linenos ws-unset">
                    {% if row.linedecision %}
                    <details class="normal details-overlay">
                        <summary>{% if row.linedecision %}{{row.linedecision.taken}}/{{row.linedecision.total}}{% endif %}</summary>
                        <div class="text-left position-absolute color-bg-subtle p-3 mt-2" style="z-index: 1;">
                            {% for decision in row.linedecision.decisions %}
                            {% if decision.uncheckable %}
                            <div>? Decision couldn't be analyzed.</div>
                            {% elif decision.taken %}
                            <div class="color-taken-decision">&check; Decision '{{decision.name}}' taken {{decision.count}} times.</div>
                            {% else %}
                            <div class="color-fg-danger">&cross; Decision '{{decision.name}}' not taken.</div>
                            {% endif %}
                            {% endfor %}

                        </div>
                    </details>
                    {% endif %}
                </td>
                {% endif %}
                {% if not EXCLUDE_CALLS %}
                <td class="text-right src linenos ws-unset">
                    {% if row.linecall %}
                    <details class="normal details-overlay">
                        <summary>{% if row.linecall %}{{row.linecall.invoked}}/{{row.linecall.total}}{% endif %}</summary>
                        <div class="text-left position-absolute color-bg-subtle p-3 mt-2" style="z-index: 1;">
                            {% for call in row.linecall.calls %}
                            {% if call.invoked %}
                            <div class="color-invoked-call">&check; Call {{call.name}} invoked.</div>
                            {% else %}
                            <div class="color-fg-danger">&cross; Call {{call.name}} not invoked.</div>
                            {% endif%}
                            {% endfor %}
                        </div>
                    </details>
                    {% endif %}
                </td>
                {% endif %}
                <td class="src {{row.covclass}} pr-2 pl-2 color-fg-muted text-right">{% if ( row.covclass == 'uncoveredLine' ) %}&cross;{% elif ( row.covclass == 'excludedLine' ) %}&minus;{% else %}{{row.linecount}}{% endif %}</td>
                <td class="src {{row.covclass}}">{{row.source}}</td>
            </tr>
            {% endfor %}

        </table>
    </div>
</div>
