<div class="chat-to-topic-selector">
  <div class="radios">
    <label class="radio-label" for="move-to-new-topic">
      <RadioButton
        @id="move-to-new-topic"
        @name="move-to-entity"
        @value={{this.newTopicSelection}}
        @selection={{this.selection}}
      />
      <b>{{i18n "topic.split_topic.radio_label"}}</b>
    </label>

    <label class="radio-label" for="move-to-existing-topic">
      <RadioButton
        @id="move-to-existing-topic"
        @name="move-to-entity"
        @value={{this.existingTopicSelection}}
        @selection={{this.selection}}
      />
      <b>{{i18n "topic.merge_topic.radio_label"}}</b>
    </label>

    {{#if this.allowNewMessage}}
      <label class="radio-label" for="move-to-new-message">
        <RadioButton
          @id="move-to-new-message"
          @name="move-to-entity"
          @value={{this.newMessageSelection}}
          @selection={{this.selection}}
        />
        <b>{{i18n "topic.move_to_new_message.radio_label"}}</b>
      </label>
    {{/if}}
  </div>

  {{#if this.newTopic}}
    <p>{{this.newTopicInstruction}}</p>

    <form>
      <label for="split-topic-name">
        {{i18n "topic.split_topic.topic_name"}}
      </label>

      <TextField
        @value={{this.topicTitle}}
        @placeholderKey="composer.title_placeholder"
        @id="split-topic-name"
      />

      <label>{{i18n "categories.category"}}</label>

      <CategoryChooser
        @id="new-topic-category-selector"
        @value={{this.categoryId}}
        @class="small"
        @onChange={{action (mut this.categoryId)}}
      />

      {{#if this.canAddTags}}
        <label>{{i18n "tagging.tags"}}</label>
        <TagChooser
          @tags={{this.tags}}
          @filterable={{true}}
          @categoryId={{this.categoryId}}
        />
      {{/if}}
    </form>
  {{/if}}

  {{#if this.existingTopic}}
    <p>{{this.existingTopicInstruction}}</p>
    <form>
      <ChooseTopic @selectedTopicId={{this.selectedTopicId}} />
    </form>
  {{/if}}

  {{#if (and this.allowNewMessage this.newMessage)}}
    <p>{{this.newMessageInstruction}}</p>

    <form>
      <label for="split-message-title">
        {{i18n "topic.move_to_new_message.message_title"}}
      </label>

      <TextField
        @value={{this.topicTitle}}
        @placeholderKey="composer.title_placeholder"
        @id="split-message-title"
      />

      {{#if this.canTagMessages}}
        <label>{{i18n "tagging.tags"}}</label>
        <TagChooser @tags={{this.tags}} @filterable={{true}} />
      {{/if}}
    </form>
  {{/if}}
</div>