<div class="source-viewer-header"></div>

{{#if canSeeCode}}

  {{#if hasSourceBefore}}
    <i class="spinner js-component-viewer-source-before"></i>
  {{/if}}

  <table class="source-table">
    {{#each source}}
      <tr class="source-line {{#eq line 0}}{{#empty issues}}hidden{{/empty}}{{/eq}}" {{#if line}}data-line-number="{{line}}"{{/if}}>
        <td class="source-meta source-line-number" {{#if line}}data-line-number="{{line}}"{{/if}}></td>

        <td class="source-meta source-line-scm" {{#if line}}data-line-number="{{line}}"{{/if}}>
          {{#ifSCMChanged2 ../source line}}
            <div class="source-line-scm-inner" data-author="{{scmAuthor}}"></div>
          {{/ifSCMChanged2}}
        </td>

        {{#if ../hasUTCoverage}}
          <td class="source-meta source-line-coverage {{#notNull utCoverageStatus}}source-line-{{utCoverageStatus}}{{/notNull}}"
              data-tests="ut"
              data-line-number="{{line}}" {{#notNull utCoverageStatus}}title="{{t 'source_viewer.tooltip.ut' utCoverageStatus}}" data-placement="right" data-toggle="tooltip"{{/notNull}}>
            <div class="source-line-bar"></div>
          </td>
        {{/if}}

        {{#if ../hasITCoverage}}
          <td class="source-meta source-line-coverage {{#notNull itCoverageStatus}}source-line-{{itCoverageStatus}}{{/notNull}}"
              data-tests="it"
              data-line-number="{{line}}" {{#notNull itCoverageStatus}}title="{{t 'source_viewer.tooltip.it' itCoverageStatus}}" data-placement="right" data-toggle="tooltip"{{/notNull}}>
            <div class="source-line-bar"></div>
          </td>
        {{/if}}

        {{#if ../hasDuplications}}
          <td class="source-meta source-line-duplications {{#if duplicated}}source-line-duplicated{{/if}}"
              {{#if duplicated}}title="{{t 'source_viewer.tooltip.duplicated_line'}}" data-placement="right" data-toggle="tooltip"{{/if}}>
            <div class="source-line-bar"></div>
          </td>

          {{#each duplications}}
            <td class="source-meta source-line-duplications-extra {{#if this}}source-line-duplicated{{/if}}"
                data-index="{{this}}" data-line-number="{{../line}}"
                {{#if this}}title="{{t 'source_viewer.tooltip.duplicated_block'}}" data-placement="right" data-toggle="tooltip"{{/if}}>
              <div class="source-line-bar"></div>
            </td>
          {{/each}}
        {{/if}}

        <td class="source-meta source-line-issues {{#notEmpty issues}}source-line-with-issues{{/notEmpty}}"
            data-line-number="{{line}}">
          {{#withFirst issues}}
            {{severityIcon severity}}
          {{/withFirst}}
        </td>

        <td class="source-meta source-line-filtered-container" data-line-number="{{line}}">
          <div class="source-line-bar"></div>
        </td>

        <td class="source-line-code code {{#notEmpty issues}}has-issues{{/notEmpty}}" data-line-number="{{line}}">
          {{#notNull code}}
            <pre>{{#if code}}{{{code}}}{{else}}&nbsp;{{/if}}</pre>
          {{/notNull}}

          {{#notEmpty issues}}
            <div class="issue-list">
              {{#each issues}}
                <div class="issue" id="issue-{{key}}"></div>
              {{/each}}
            </div>
          {{/notEmpty}}
        </td>
      </tr>
    {{/each}}
  </table>

  {{#if hasSourceAfter}}
    <i class="spinner js-component-viewer-source-after"></i>
  {{/if}}

{{else}}

  <div class="alert alert-warning">{{t 'code_viewer.no_source_code_displayed_due_to_security'}}</div>

{{/if}}
