@if(config('Discussion.thread_comments') && $depth < config('Discussion.thread_comments_depth'))
    <ol class="children sm:pl-100 pl-30">
        @php
            $depth++;
        @endphp
    	@forelse($comments as $comment)
        <li class="comment">
            <div class="comment-body mb-30 flex gap-20 border-b pb-30 border-black/10">
                <div class="comment-author vcard">
                    @if (optional($comment->user)->profile && Storage::exists('public/user-images/'.$comment->user->profile))
                        <img class="avatar sm:size-80 size-50 rounded-full photo" src="{{ asset('storage/user-images/'.$comment->user->profile) }}" alt="">
                    @else
                        <img class="avatar sm:size-80 size-50 rounded-full photo" src="{{ asset('images/no-user.png') }}" alt="">
                    @endif
                </div>
                <div class="comment-info flex-1">
                    <div class="title dark:text-white mb-5 flex justify-between flex-wrap gap-6">
                        <cite class="fn">
                            {{ $comment->commenter }}
                        </cite>
                        <span class="max-sm:text-sm">{{ \Carbon\Carbon::parse($comment->created_at) }}</span>
                    </div>
                    <p class="sm:text-xl"><span class="text-primary text-lowercase me-2 fw-bold fst-italic user-select-none">{{ __('@') }}{{ str_replace(' ', '', $parent_comment) }}</span>{{ $comment->comment }}</p>
                    <div class="reply mt-15">
                        @if($comment->object_type=="1")
                            <a rel="nofollow" href="{{ DzHelper::laraBlogLink($comment->object_id) }}?replytocom={{ $comment->id }}#respond" class="comment-reply-link w3-comment-reply border hover:text-secondary dark:text-white dark:border-white/10 border-black/10 hover:bg-primary rounded-full px-15 py-6 inline-block text-sm font-medium" data-commentid="{{ $comment->id }}" data-postid="{{ $comment->object_id }}"  data-replyto="Reply to {{ $comment->commenter }}">
                                <span>
                                    <i class="fa fa-reply"></i>
                                    {{ __('REPLY') }}
                                </span>
                            </a>
                        @else
                            <a rel="nofollow" href="{{ DzHelper::laraPageLink($blog->id) }}?replytocom={{ $comment->id }}#respond" class="comment-reply-link w3-comment-reply border hover:text-secondary dark:text-white dark:border-white/10 border-black/10 hover:bg-primary rounded-full px-15 py-6 inline-block text-sm font-medium" data-commentid="{{ $comment->id }}" data-postid="{{ $comment->object_id }}"  data-replyto="Reply to {{ $comment->commenter }}">
                                <span>
                                    <i class="fa fa-reply"></i>
                                    {{ __('REPLY') }}
                                </span>
                            </a>
                        @endif
                    </div>
                </div>
            </div>
            @if (isset($comment->child_comments) && $comment->child_comments->isNotEmpty())
                @include('elements.child_comments', ['comments' => $comment->child_comments,'parent_comment' => $comment->commenter, 'depth' => $depth])
            @endif
        </li>
    	@empty
    	@endforelse
    </ol>
@else
    @forelse($comments as $comment)
        <li class="comment">
            <div class="comment-body mb-30 flex gap-20 border-b pb-30 border-black/10">
                <div class="comment-author vcard">
                    @if (optional($comment->user)->profile && Storage::exists('public/user-images/'.$comment->user->profile))
                        <img class="avatar sm:size-80 size-50 rounded-full photo" src="{{ asset('storage/user-images/'.$comment->user->profile) }}" alt="">
                    @else
                        <img class="avatar sm:size-80 size-50 rounded-full photo" src="{{ asset('images/no-user.png') }}" alt="">
                    @endif
                </div>
                <div class="comment-info flex-1">
                    <div class="title dark:text-white mb-5 flex justify-between flex-wrap gap-6">
                        <cite class="fn">
                            {{ $comment->commenter }}
                        </cite>
                        <span class="max-sm:text-sm">{{ \Carbon\Carbon::parse($comment->created_at)->format('d F, Y') }}</span>
                    </div>
                    <p class="sm:text-xl"><span class="text-primary text-lowercase me-2 fw-bold fst-italic user-select-none">{{ __('@') }}{{ str_replace(' ', '', $parent_comment) }}</span>{{ $comment->comment }}</p>
                    <div class="reply mt-15">
                        @if($comment->object_type=="1")
                            <a rel="nofollow" href="{{ DzHelper::laraBlogLink($comment->object_id) }}?replytocom={{ $comment->id }}#respond" class="comment-reply-link w3-comment-reply border hover:text-secondary dark:text-white dark:border-white/10 border-black/10 hover:bg-primary rounded-full px-15 py-6 inline-block text-sm font-medium" data-commentid="{{ $comment->id }}" data-postid="{{ $comment->object_id }}"  data-replyto="Reply to {{ $comment->commenter }}">
                                <span>
                                    <i class="fa fa-reply"></i>
                                    {{ __('REPLY') }}
                                </span>
                            </a>
                        @else
                            <a rel="nofollow" href="{{ DzHelper::laraPageLink($blog->id) }}?replytocom={{ $comment->id }}#respond" class="comment-reply-link w3-comment-reply border hover:text-secondary dark:text-white dark:border-white/10 border-black/10 hover:bg-primary rounded-full px-15 py-6 inline-block text-sm font-medium" data-commentid="{{ $comment->id }}" data-postid="{{ $comment->object_id }}"  data-replyto="Reply to {{ $comment->commenter }}">
                                <span>
                                    <i class="fa fa-reply"></i>
                                    {{ __('REPLY') }}
                                </span>
                            </a>
                        @endif
                    </div>
                </div>
            </div>
        </li>
        @if (isset($comment->child_comments) && $comment->child_comments->isNotEmpty())
            @include('elements.child_comments', ['comments' => $comment->child_comments,'parent_comment' => $comment->commenter, 'depth' => $depth])
        @endif
    @empty
    @endforelse
@endif
