{% if not disabled or not multiselect %}
<input
    class="textinput"
    id="{{ route_name }}__textinput"
    autocomplete="off"
    type="text"
    onkeydown="return phac_aspc_autocomplete_keydown_handler(event)"
    onblur="return phac_aspc_autocomplete_blur_handler(event, '{{ route_name|escapejs }}', {{ multiselect|yesno:'false,true' }})"
    hx-get="{% url route_name method='items' %}"
    hx-trigger="click,input delay:250ms"
    hx-include="#{{ route_name }}"
    hx-target="#{{ route_name }}__items"
    hx-vals="js:{search: document.getElementById('{{ route_name|escapejs }}__textinput').value}"
    hx-swap="outerHTML"
    {% if indicator %}
    hx-indicator="#{{ route_name }}__container .htmx-indicator"
    {% endif %}
    {% if disabled %}
    disabled
    {% endif %}
    {% if placeholder and selected_items|length == 0 %}
    placeholder="{{ placeholder }}"
    {% endif %}
    {% if not multiselect and selected_items|length == 1 %}
    value="{{ selected_items.0.label }}"
    {% endif %}
    {% if required and selected_items|length == 0 %}
    required
    {% endif %}
    {% if swap_oob %}
    hx-swap-oob="outerHTML:#{{ route_name }}__textinput"
    {% endif %}
>
{% endif %}