{% if input.branch_dependency is empty %}
{{ inputAdvance('SELECT', {
    name: 'CHOICE',
    titre: input.label,
    listeValue: {'': ''} | merge(input.mapSubform | map((form, key) => key)),
    inputAttr: {
        form: '_none',
    },
    obligatoire: true,
}) }}
{% endif %}

{# This DOM is controlled by InputBanch in global.js #}
<div 
    data-form-branch="{{ input.name |e('html_attr') }}"
    data-form-branch-fullname="{{ input.fullName |e('html_attr') }}"
    {% if input.branch_dependency %}
    {# TODO fallback on CHOICE #}
    data-form-branch-dependency="{{ input.branch_dependency_fullname }}"
    {% endif %}
    data-form-branch-state="unloaded"
    data-form-branch-default="{{ (input.selected ?? '') | e('html_attr') }}"
>
    {% for key, subform in input.mapSubform %}
    <section data-branch-child="{{ key }}">
        {% include 
            input.subform_template 
            ?? input.map_subform_template[ key ] 
            ?? '@GlobalApplication/Input/inputGroup.twig' 
            with {
                input: {
                    type: 'GROUP',
                    listChild: subform,
                },
                subject: subject,
            } only
        %}
    </section>
    {% endfor %}
</div>