@if ($paginator->hasPages())
<nav role="navigation" aria-label="{{ __('Pagination Navigation') }}" class="flex items-center justify-between mt-6">

    <div class="flex justify-between flex-1 sm:hidden">
        @if ($paginator->onFirstPage())
        <span class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-500 bg-gray-700 border border-gray-600 cursor-default leading-5 rounded-md">
            {!! __('pagination.previous') !!}
        </span>
        @else
        <button wire:click="previousPage" type="button" rel="prev" class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-blue-700 leading-5 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 active:bg-blue-800 transition ease-in-out duration-150">
            {!! __('pagination.previous') !!}
        </button>
        @endif

        @if ($paginator->hasMorePages())
        <button wire:click="nextPage" type="button" rel="next" class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-white bg-blue-600 border border-blue-700 leading-5 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 active:bg-blue-800 transition ease-in-out duration-150">
            {!! __('pagination.next') !!}
        </button>
        @else
        <span class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-500 bg-gray-700 border border-gray-600 cursor-default leading-5 rounded-md">
            {!! __('pagination.next') !!}
        </span>
        @endif
    </div>

    <div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
        <div>
            <p class="text-sm text-gray-600 leading-5">
                {!! __('Mostrando') !!}
                @if ($paginator->firstItem())
                <span class="font-medium text-blue-600">{{ $paginator->firstItem() }}</span>
                {!! __('a') !!}
                <span class="font-medium text-blue-600">{{ $paginator->lastItem() }}</span>
                @else
                <span class="font-medium text-blue-600">{{ $paginator->count() }}</span>
                @endif
                {!! __('de') !!}
                <span class="font-medium text-blue-600">{{ $paginator->total() }}</span>
                {!! __('resultados') !!}
            </p>
        </div>

        <div>
            <span class="relative z-0 inline-flex rtl:flex-row-reverse shadow-lg rounded-md bg-white border border-gray-200 p-1">

                {{-- Link da Página Anterior --}}
                @if ($paginator->onFirstPage())
                <span aria-disabled="true" aria-label="{{ __('pagination.previous') }}">
                    <span class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-400 bg-white border-r border-gray-200 cursor-default rounded-l-md leading-5" aria-hidden="true">
                        <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
                            <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
                        </svg>
                    </span>
                </span>
                @else
                <button wire:click="previousPage" type="button" rel="prev" class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-700 bg-white rounded-l-md leading-5 hover:bg-gray-100 focus:z-10 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 active:bg-gray-200 transition ease-in-out duration-150" aria-label="{{ __('pagination.previous') }}">
                    <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
                        <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
                    </svg>
                </button>
                @endif

                {{-- Elementos de Paginação --}}
                @foreach ($elements as $element)
                {{-- Separador "Três Pontos" --}}
                @if (is_string($element))
                <span aria-disabled="true">
                    <span class="relative inline-flex cursor-pointer items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white cursor-default leading-5 border-l border-r border-gray-200">{{ $element }}</span>
                </span>
                @endif

                {{-- Array de Links --}}
                @if (is_array($element))
                @foreach ($element as $page => $url)
                @if ($page == $paginator->currentPage())
                <span aria-current="page" wire:key="page-span-{{ $page }}">
                    <span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-white bg-blue-400 border border-blue-400 cursor-pointer leading-5 shadow-inner rounded-md mx-1">{{ $page }}</span>
                </span>
                @else
                <button wire:click="gotoPage({{ $page }})" type="button" wire:key="page-button-{{ $page }}"
                    class="relative inline-flex items-center cursor-pointer px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white leading-5 hover:bg-gray-100 focus:z-10 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 active:bg-gray-200 transition ease-in-out duration-150 mx-1 rounded-md">
                    {{ $page }}
                </button>
                @endif
                @endforeach
                @endif
                @endforeach

                {{-- Link da Próxima Página --}}
                @if ($paginator->hasMorePages())
                <button wire:click="nextPage" type="button" rel="next" class="relative inline-flex items-center px-2 py-2 cursor-pointer -ml-px text-sm font-medium text-gray-700 bg-white rounded-r-md leading-5 hover:bg-gray-100 focus:z-10 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 active:bg-gray-200 transition ease-in-out duration-150" aria-label="{{ __('pagination.next') }}">
                    <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
                        <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
                    </svg>
                </button>
                @else
                <span aria-disabled="true" aria-label="{{ __('pagination.next') }}">
                    <span class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-400 bg-white border-l border-gray-200 cursor-default rounded-r-md leading-5" aria-hidden="true">
                        <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
                            <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
                        </svg>
                    </span>
                </span>
                @endif
            </span>
        </div>
    </div>
</nav>
@endif