<div id="comments" class="comments-area clearfix">
	<h3 class="comments-count section-heading uppercase"><span>{{ $comment['total'] }} 件のコメント</span></h3>
  <div style="margin: 12px 0;">
    <div style="display: none; padding: 20px;" class="alert alert-warning" id="jswarning">コメントを投稿するには、JavaScriptをOFFにして下さい。</div>
    <noscript>
      @if ($isvideo !== 'n')
        <form action="/comment/new" method="post">
          @csrf
          @if ($user == new stdClass())
            <div class="form-group row">
              <div class="col-md-4 col-lg-3">名前</div>
              <div class="input-group col-md col-lg">
                <input type="text" name="newname" class="form-control" value="" placeholder="ご入力しない場合、名前は「名無しのテクニシャン」になります。" />
              </div>
            </div>
            <div class="form-group row">
              <div class="col-md-4 col-lg-3">メールアドレス</div>
              <div class="input-group col-md col-lg">
                <input type="text" name="newmail" class="form-control" value="" placeholder="返信される場合、メールに通知を送ります。" />
              </div>
            </div>
          @else
            <div class="form-group row">
              <div class="col-md-4 col-lg-3">名前</div>
              <div class="input-group col-md col-lg">
                <a href="/profile/{{ $user['user_id'] }}" style="{{ $user['showcol'] }}"><img style="width: 24px; height: 24px;" src="{{ $user['avatar'] }}" alt="{{ $user['showname'] }}さんのアイコン"> {{ $user['showname'] }}</a>
              </div>
            </div>
          @endif
          <div class="row">
            <div class="col-md-4 col-lg-3">本文 <span class="badge badge-danger">必須</span></div>
            <div class="col-md col-lg">
              <textarea class="form-control" name="newmessage" rows="4"></textarea>
            </div>
          </div>
          <input type="hidden" name="slug" value="{{ $slug }}" />
          <div class="row" style="margin-top: 16px;">
            <div class="col">
              <input name="submit" type="submit" class="btn btn-block btn-primary" value="送信" />
            </div>
          </div>
        </form>
      @endif
    </noscript>
    <hr />
    @if ($comment['total'] == 0) コメントがありません。
    @else
      @foreach ($comment['come'] as $i => $c)
        <ul class="commentlist">
          <li class="comment even thread-even depth-1" id="li-comment-{{ $c->id }}">
            <div class="commentnumber">{{ (int)$i+1 }}({{ $c->src }})</div>
            <div id="comment-{{ $c->id }}">
              <div>
                <cite class="fn">
                  @if ($c->isvideo == 'n')
                    <img style="height: 24px;" src="{{ $c->icon }}" alt="{{ $c->name }}さんのアイコン">
                    <a href="{{ $c->channel }}" style="overflow-wrap: break-word;">{{ ($c->name ?: '名無しのテクニシャン') }}</a>
                  @else
                    @if ($c->user_id)
                      <a href="/profile/{{ $c->user_id }}" style="{{ $c->showcol }}"><img style="width: 24px; height: 24px;" src="{{ $c->avatar }}" alt="{{ $c->showname }}さんのアイコン"> {{ $c->showname }}</a>
                    @else
                      {{ ($c->name ?: '名無しのテクニシャン') }}
                    @endif
                  @endif
                </cite> <span class="says">より:</span>
                <span class="comment-meta commentmetadata" id="#comment-{{ $c->id }}"> <a href="#comment-{{ $c->id }}">{{ $c->created }}</a></span>
              </div>
              <p style="white-space: pre-wrap; word-wrap: break-word; width: 500px;"><?php echo $c->message; ?></p>
              <div class="reply">返信（{{ $c->replyCount }}）</div>
            </div>
          </li>
          @if (isset($c->replies))
            @foreach ($c->replies as $j => $r)
              <ul class="commentlist">
                <li class="comment even thread-even depth-2" id="li-comment-${{ $r['id'] }}">
                  <div class="commentnumber">{{ $i+1 }}/{{ $j+1 }}({{ $c->src }})</div>
                  <div id="comment-{{ $r['id'] }}">
                    <div>
                      <cite class="fn">
                        @if ($c->isvideo != 'f')
                          <img style="height: 24px;" src="{{ $r['icon'] }}" alt="{{ $r['name'] }}さんのアイコン">
                          <a href="{{ $r['channel'] }}">{{ ($r['name'] ?: '名無しのテクニシャン') }}</a>
                        @else
                          @if ($r['user_id'])
                            <a href="/profile/{{ $r['user_id'] }}" style="{{ $r['showcol'] }}"><img style="width: 24px; height: 24px;" src="{{ $r['avatar'] }}" alt="{{ $r['showname'] }}さんのアイコン"> {{ $r['showname'] }}</a>
                          @else
                            {{ ($r['name'] ?: '名無しのテクニシャン') }}
                          @endif
                        @endif
                      </cite> <span class="says">より:</span>
                      <span class="comment-meta commentmetadata" id="#comment-{{ $r['id'] }}"> <a href="#comment-{{ $r['id'] }}">{{ $r['created'] }}</a></span>
                    </div>
                    <p style="white-space: pre-wrap; word-wrap: break-word; width: 500px;"><?php echo $r['message']; ?></p>
                  </div>
                </li>
              </ul>
            @endforeach
          @endif
        </ul>
      @endforeach
    @endif
	</div>
</div>
