{% set node = document %}
{% set document_change = view_object.change_stats.find_change(document) %}

<div class="diff_node_fields">

{# MID field, if permanent, is always printed as-is. It is never marked as modified. #}
{% if document.mid_permanent %}
  <div
    class="diff_node_field"
  >
    {%- with badge_text = "MID" -%}
      {%- include "components/badge/index.jinja" -%}
    {%- endwith -%}
    <span class="sdoc_pre_content">{{ document.reserved_mid }}</span>
  </div>
{% endif %}

{% if document.reserved_uid is not none %}
{% set uid_modified = document.reserved_uid is not none and document_change is not none and document_change.uid_modified %}
<div
  class="diff_node_field"
  {% if uid_modified %}
  modified="{{ side }}"
  {% endif %}
>
  {%- with badge_text = "uid" -%}
    {%- include "components/badge/index.jinja" -%}
  {%- endwith -%}

  {% assert document.reserved_uid is not none %}
  <div
    class="sdoc_pre_content"
  >{{ document.reserved_uid }}</div>
</div>

{% endif %}

{% set title_modified = document_change is not none and document_change.title_modified %}
<div
  class="diff_node_field"
  {% if title_modified %}
  modified="{{ side }}"
  {% endif %}
>
  {%- with badge_text = "title" -%}
    {%- include "components/badge/index.jinja" -%}
  {%- endwith -%}

  <div
    class="sdoc_pre_content"
  >
    {%- if title_modified -%}
      {%- set colored_diff = document_change.get_colored_title_diff(side) -%}
      {# Using a dummy if block to get right of leading and trailing whitespaces #}
      {%- if colored_diff is not none -%}
        {{ colored_diff }}
      {%- else -%}
        {{ document.title }}
      {%- endif -%}
    {%- else -%}
      {{ document.title }}
    {%- endif -%}
  </div>
</div>

</div>
