<div class="modal-body invite-modal">
  {{#if model.error}}
    <div class="alert alert-error">
      <button class="close" data-dismiss="alert">×</button>
      {{errorMessage}}
    </div>
  {{/if}}
  {{#if model.finished}}
    {{{successMessage}}}
  {{else}}
    <label>{{inviteInstructions}}</label>
    {{#if allowExistingMembers}}
      {{#if isPrivateTopic}}
        {{user-selector single="true"
                        allowAny=true
                        excludeCurrentUser="true"
                        usernames=emailOrUsername
                        allowedUsers="true"
                        topicId=topicId
                        placeholderKey=placeholderKey}}
      {{else}}
        {{user-selector
            single="true"
            allowAny=true
            excludeCurrentUser="true"
            includeMentionableGroups="true"
            hasGroups=hasGroups
            usernames=emailOrUsername
            placeholderKey=placeholderKey}}
      {{/if}}
    {{else}}
      {{text-field value=emailOrUsername placeholderKey="topic.invite_reply.email_placeholder"}}
    {{/if}}
    {{#if showGroups}}
      <label><span class={{showGroupsClass}}>{{i18n 'topic.automatically_add_to_groups'}}</span></label>
      {{group-selector groupFinder=groupFinder groupNames=model.groupNames placeholderKey="topic.invite_private.group_name"}}
    {{/if}}

    {{#if showCustomMessage}}
      <br><label><span class='optional'>{{i18n 'invite.custom_message'}}</span> <a {{action "showCustomMessageBox"}}>{{i18n 'invite.custom_message_link'}}</a>.</label>
      {{#if hasCustomMessage}}{{textarea value=customMessage placeholder=customMessagePlaceholder}}{{/if}}
    {{/if}}

  {{/if}}
</div>
<div class="modal-footer">
  {{#if model.finished}}
    {{d-button class="btn-primary" action="closeModal" label="close"}}
  {{else}}
    {{d-button icon=inviteIcon action="createInvite" class="btn-primary" disabled=disabled label=buttonTitle}}
    {{#if showCopyInviteButton}}
      {{d-button icon="link" action="generateInvitelink" class="btn-primary" disabled=disabledCopyLink label='user.invited.generate_link'}}
    {{/if}}
  {{/if}}
</div>
