@php
	$item = [];
	if (isset($payload)) {
		$images = [];
		$hovers = [];
		foreach ($payload as $key => $value) {
			
			if (preg_match('/^image(\d+)$/', $key, $matches)) {
            $index = $matches[1]; // Captura o número da imagem
            $images[$index] = ['image' => $value]; // Armazena no array temporário
			}
			
			if (preg_match('/^hover(\d+)$/', $key, $matches)) {
				$index = $matches[1];
				$hovers[$index] = ['hover' => $value];
			}
		}

		foreach ($images as $index => $imgData) {
			$item[] = (object) array_merge(
				$imgData,
				$hovers[$index] ?? ['hover' => null],
			);
		}

		$data = (object) [
			'title' => $payload->title->value  ?? null,
			'subtitle' => $payload->subtitle->value ?? null,
			'partners' => $item,
		];
	}
@endphp
<div class="@if (isset($path) && $path =='distribution') bg-dark @endif">
	<div class="container container-botton">
		<div class="header-counter">
			<div class="header-bottom d-flex justify-content-between">
				<div class="d-flex flex-column" style="width: 100%">
					<div class="px-5 box-span">
						@if (isset($data->title))
						<span>{{ $data->title }}</span>
					@endif
					@if (isset($data->subtitle))
						<h2>{{ $data->subtitle }}</h2>
					@endif
					</div>
	
					<div class="d-flex justify-content-around">
						@foreach($data->partners as $item)
							@if (isset($item->image))
								<div class="box-one d-flex justify-content-center">
									<div class="box-icon d-flex flex-column align-items-center justify-content-center">
										<div class="main-icon">
											<img src="{{ $item->image->src }}" alt="{{ $item->image->alt }}">
										</div>
										@if (isset($item->hover))
											<div class="hover-icon">
												<img src="{{ $item->hover->src }}" alt="{{ $item->hover->alt }}">
											</div>
										@endif
									</div> 
								</div>
							@endif
						@endforeach
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- End Header Counter Area -->
