{%- if not embedded is defined -%}
    {%- set embedded = False -%}
{%- endif -%}
<div class="small">
    {%- if entity.private -%}
        <p>{%- trans -%}This information is unavailable to protect people's privacy.{%- endtrans -%}</p>
    {%- else -%}
        {% if entity.gender.plugin().id != 'unknown' %}
            <p class="m-0">{{ entity.gender.plugin().label | localize | html_lang }}</p>
        {% endif %}
        {% set alternative_names = (entity.names | select('public') | list)[1:] %}
        {%- if alternative_names -%}
            {% set ns = namespace(formatted_alternative_names = []) %}
            {% for entity in alternative_names %}
                {% set formatted_alternative_name %}{% include 'entity/label--person-name.html.j2' %}{% endset %}
                {% do ns.formatted_alternative_names.append(formatted_alternative_name) %}
            {% endfor %}
            {%- set formatted_alternative_names = ns.formatted_alternative_names | join(', ') %}
            <span class="aka">{%- trans names = formatted_alternative_names -%}Also known as {{ names }}{%- endtrans -%}</span>
        {%- endif -%}
        {% set events = entity.presences | selectattr('role', 'role_plugin', 'subject') | map(attribute='event') | reject('none') | select('public') | list %}
        {% set ns = namespace(birth_indicators=[]) %}
        {% for event in events %}
            {% if event.event_type.plugin().id == 'birth' or event.event_type.plugin().indicates == 'birth' %}
                {% do ns.birth_indicators.append(event) %}
            {% endif %}
        {% endfor %}
        {%- if ns.birth_indicators | length -%}
            {% set birth_indicator = ns.birth_indicators | first %}
            {%- set formatted_start -%}
                {%- with event = birth_indicator -%}
                    {%- include 'entity/event-dimensions.html.j2' -%}
                {%- endwith -%}
            {%- endset -%}
        {%- endif -%}
        {% set ns = namespace(death_indicators=[]) %}
        {% for event in events %}
            {% if event.event_type.plugin().id == 'death' or event.event_type.plugin().indicates == 'death' %}
                {% do ns.death_indicators.append(event) %}
            {% endif %}
        {% endfor %}
        {%- if ns.death_indicators | length -%}
            {% set death_indicator = ns.death_indicators | first %}
            {%- set formatted_end -%}
                {%- with event = death_indicator -%}
                    {%- include 'entity/event-dimensions.html.j2' -%}
                {%- endwith -%}
            {%- endset -%}
        {%- endif -%}
        {%- if ns.death_indicators | length -%}
            {% set death_indicator = ns.death_indicators | first %}
            {%- set formatted_end -%}
                {%- with event = death_indicator -%}
                    {%- include 'entity/event-dimensions.html.j2' -%}
                {%- endwith -%}
            {%- endset -%}
        {%- endif -%}
        {%- if formatted_start is defined and formatted_start or formatted_end is defined and formatted_end -%}
            <dl class="d-table">
                {%- if formatted_start is defined and formatted_start -%}
                    <div class="d-table-row">
                        <dt class="d-table-cell pe-2">
                            {{ birth_indicator.event_type.plugin().label | localize | html_lang }}
                        </dt>
                        <dd class="d-table-cell">
                            {{ formatted_start }}
                        </dd>
                    </div>
                {%- endif -%}
                {%- if formatted_end is defined and formatted_end -%}
                    <div class="d-table-row">
                        <dt class="d-table-cell pe-2">
                            {{ death_indicator.event_type.plugin().label | localize | html_lang }}
                        </dt>
                        <dd class="d-table-cell">
                            {{ formatted_end }}
                        </dd>
                    </div>
                {%- endif -%}
            </dl>
        {%- endif -%}
    {%- endif -%}
</div>
