{{#if categories}}
  <table class="category-list {{if showTopics "with-topics"}}">
    <thead>
      <tr>
        <th class="category"><span aria-role="heading" aria-level="2" id="categories-only-category">{{i18n "categories.category"}}</span></th>
        <th class="topics">{{i18n "categories.topics"}}</th>
        {{#if showTopics}}
          <th class="latest">{{i18n "categories.latest"}}</th>
        {{/if}}
      </tr>
    </thead>
    <tbody aria-labelledby="categories-only-category">
      {{#each categories as |c|}}
        {{plugin-outlet name="category-list-above-each-category" connectorTagName="" tagName="" args=(hash category=c)}}
        <tr data-category-id={{c.id}} data-notification-level={{c.notificationLevelString}} class="{{if c.description_excerpt "has-description" "no-description"}} {{if c.uploaded_logo.url "has-logo" "no-logo"}}">
          <td class="category {{if c.isMuted "muted"}} {{if noCategoryStyle "no-category-style"}}" style={{unless noCategoryStyle (border-color c.color)}}>
            {{category-title-link category=c}}
            {{#unless c.isMuted}}
              {{#if c.description_excerpt}}
                <div class="category-description">
                  {{dir-span c.description_excerpt}}
                </div>
              {{/if}}
              {{#if c.isGrandParent}}
                <table class="category-list subcategories-with-subcategories">
                  <tbody>
                    {{#each c.subcategories as |subcategory|}}
                      <tr data-category-id={{subcategory.id}} data-notification-level={{subcategory.notificationLevelString}} class="{{if subcategory.description_excerpt "has-description" "no-description"}} {{if subcategory.uploaded_logo.url "has-logo" "no-logo"}}">
                        <td class="category" style={{border-color subcategory.color}}>
                          {{category-title-link tagName="h4" category=subcategory}}
                          {{#if subcategory.description_excerpt}}
                            <div class="category-description subcategory-description">
                              {{dir-span subcategory.description_excerpt}}
                            </div>
                          {{/if}}
                          {{#if subcategory.subcategories}}
                            <div class="subcategories">
                              {{#each subcategory.subcategories as |subsubcategory|}}
                                {{#unless subsubcategory.isMuted}}
                                  <span class="subcategory">
                                    {{category-title-before category=subsubcategory}}
                                    {{category-link subsubcategory hideParent="true"}}
                                  </span>
                                {{/unless}}
                              {{/each}}
                            </div>
                          {{else}}
                            {{#if subcategory.description_excerpt}}
                              <div class="category-description subcategory-description">
                                {{dir-span subcategory.description_excerpt}}
                              </div>
                            {{/if}}
                          {{/if}}
                        </td>
                      </tr>
                    {{/each}}
                  </tbody>
                </table>
              {{else if c.subcategories}}
                <div class="subcategories">
                  {{#each c.subcategories as |subcategory|}}
                    {{#unless subcategory.isMuted}}
                      <span class="subcategory">
                        {{category-title-before category=subcategory}}
                        {{category-link subcategory hideParent="true"}}
                        {{category-unread category=subcategory}}
                      </span>
                    {{/unless}}
                  {{/each}}
                </div>
              {{/if}}
            {{/unless}}
          </td>
          <td class="topics">
            <div title={{c.statTitle}}>{{html-safe c.stat}}</div>
            {{category-unread category=c tagName="div" class="unread-new"}}
          </td>
          {{#unless c.isMuted}}
            {{#if showTopics}}
              <td class="latest">
                {{#each c.featuredTopics as |t|}}
                  {{featured-topic topic=t latestTopicOnly=latestTopicOnly}}
                {{/each}}
              </td>
            {{/if}}
          {{/unless}}
        </tr>
      {{/each}}
    </tbody>
  </table>
{{/if}}
