<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag;

$__newAttributes = [];
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames(([
    'alertas' => collect(),
]));

foreach ($attributes->all() as $__key => $__value) {
    if (in_array($__key, $__propNames)) {
        $$__key = $$__key ?? $__value;
    } else {
        $__newAttributes[$__key] = $__value;
    }
}

$attributes = new \Illuminate\View\ComponentAttributeBag($__newAttributes);

unset($__propNames);
unset($__newAttributes);

foreach (array_filter(([
    'alertas' => collect(),
]), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
    $$__key = $$__key ?? $__value;
}

$__defined_vars = get_defined_vars();

foreach ($attributes->all() as $__key => $__value) {
    if (array_key_exists($__key, $__defined_vars)) unset($$__key);
}

unset($__defined_vars, $__key, $__value); ?>

<?php
    $alertas = $alertas ?? collect();
    $temRotacao = $alertas->count() > 1;
?>

<article class="<?php echo \Illuminate\Support\Arr::toCssClasses([
    'ma-features__card',
    'ma-features__card--alertas',
    'ma-features__card--alertas-rotativo' => $temRotacao,
]); ?>" id="ma-feature-alertas" <?php if($temRotacao): ?> data-ma-alertas-rotate <?php endif; ?>>
    <span class="<?php echo \Illuminate\Support\Arr::toCssClasses([
        'ma-features__icon',
        'ma-features__icon--green',
        'ma-features__icon--pulse' => $alertas->isNotEmpty(),
    ]); ?>" aria-hidden="true">
        <i class="fa-solid fa-bell"></i>
    </span>

    <h3 class="ma-features__title"><?php echo e(__('Alertas em tempo real')); ?></h3>

    <div class="ma-features__alertas-body" aria-live="polite" aria-atomic="true">
        <?php if($alertas->isNotEmpty()): ?>
            <div class="ma-features__alertas-rotator">
                <?php $__currentLoopData = $alertas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $alerta): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php
                            $mensagemCard = $alerta->mensagem_resumida_exibicao;
                            $textoRotacao = trim($alerta->titulo_resumido . ' ' . $mensagemCard);
                            $duracaoMs = min(8000, max(6000, mb_strlen($textoRotacao) * 70));
                        ?>
                    <div class="<?php echo \Illuminate\Support\Arr::toCssClasses([
                        'ma-features__alerta-slide',
                        'is-active' => $index === 0,
                    ]); ?>"
                        data-ma-alerta-slide
                        data-duration="<?php echo e($duracaoMs); ?>"
                        <?php if($index !== 0): ?> aria-hidden="true" <?php endif; ?>>
                        <span class="<?php echo \Illuminate\Support\Arr::toCssClasses(['ma-alerts__tag', 'ma-features__alerta-tag', $alerta->categoria->tagClass()]); ?>">
                            <?php echo e($alerta->categoria->label()); ?>

                        </span>
                        <p class="ma-features__alerta-title" title="<?php echo e($alerta->titulo); ?>">
                            <?php echo e($alerta->titulo_resumido); ?>

                        </p>
                        <?php if($mensagemCard): ?>
                            <p class="ma-features__alerta-message"><?php echo e($mensagemCard); ?></p>
                        <?php endif; ?>
                        <time class="ma-features__alerta-date"
                            datetime="<?php echo e($alerta->publicado_em?->toIso8601String()); ?>">
                            <?php echo e($alerta->data_formatada); ?>

                        </time>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        <?php else: ?>
            <p class="ma-features__text">
                <?php echo e(__('Fique por dentro de alterações de rotas, horários e obras.')); ?>

            </p>
        <?php endif; ?>
    </div>

    <?php if($temRotacao): ?>
        <div class="ma-features__alerta-progress" aria-hidden="true">
            <span class="ma-features__alerta-progress-bar" data-ma-alerta-progress></span>
        </div>
    <?php endif; ?>

    <a href="<?php echo e(route('mobiangra.alertas')); ?>" class="ma-features__link">
        <?php echo e(__('Ver alertas')); ?>

        <i class="fa-solid fa-arrow-right" aria-hidden="true"></i>
    </a>
</article>
<?php /**PATH /var/www/html/portal/resources/views/components/mobiangra/feature-alertas-card.blade.php ENDPATH**/ ?>