{% if history %}

{{ t.revision_history }}

{% for item in history["items"] %}
{{ t.revision }} {{ item.revision }} {% if item.revision == history.head %}{{ t.revision_current }}{% endif %} {% if item.restored_from_revision %}{{ t.revision_rollback_badge }}{% endif %}
{% if item.created_at %}{{ item.created_at }}{% else %}{{ t.revision_unknown_time }}{% endif %} {% if item.restored_from_revision %} · {{ t.revision_from }} {{ item.restored_from_revision }}{% endif %} {% if item.created_by %} · {{ t.revision_actor }} {{ item.created_by.type }}:{{ item.created_by.id }}{% endif %}
{% if item.reason %}
{{ item.reason }}
{% endif %}
{% if history.family == "profile" %} {{ t.revision }} {{ item.revision }} {% elif history.family == "topic-memory" %} {{ t.revision }} {{ item.revision }} {% elif history.family == "prompt" %} {{ t.revision }} {{ item.revision }} {% elif history.family == "atomic-memory" %} {{ t.revision }} {{ item.revision }} {% else %} {{ t.revision }} {{ item.revision }} {% endif %} {% if item.revision != history.selected %} {{ t.revision_compare }} {% endif %}
{% else %}
{{ t.revision_empty }}
{% endfor %}
{% if history.next_url %} {% endif %} {% if history.error == "revision_conflict" %}
{{ t.revision_conflict }}
{% elif history.error == "forbidden" %}
{{ t.revision_forbidden }}
{% elif history.error %}
{{ t.revision_rejected }}
{% endif %} {% if history.compare_error %}
{{ t.revision_compare_missing }}
{% endif %} {% if history.rows %}

{{ t.revision_compare }} · {{ history.selected }} / {{ history.compare }}

{% for row in history.rows %}

{{ row.name }}

{% if row.changed %}
{% for line in row.diff %}{% if line.kind == "add" %}+ {% elif line.kind == "remove" %}- {% else %}  {% endif %}{{ line.text }}
{% endfor %}
{% else %}

{{ t.revision_same }}

{% endif %} {% endfor %}
{% endif %} {% if history.selected != history.head %}
{% if return_to %}{% endif %} {% if history.family == "profile" %}{% endif %} {% if history.family not in ["profile", "prompt", "topic-memory"] %} {% endif %} {% if history.family == "topic-memory" %} {% endif %} {% if history.family == "prompt" %} {% endif %}
{% endif %} {% if history.can_rollback and history.selected != history.head and not history.same_content %}
{% if return_to %}{% endif %} {% if history.family == "handoff" %}

{{ t.handoff_rollback_notice }}

{% endif %}
{% elif history.same_content and history.selected != history.head %}
{{ t.revision_same }}
{% endif %}
{% endif %}