
<div class="w-full" style="font-size:14px; display:flex; flex-direction:column; gap:14px;">

    <div>
        <a href="<?php echo e(route('products.show', $product)); ?>" wire:navigate
           class="inline-flex items-center gap-1.5 text-[13px] font-semibold" style="color:var(--text-link);">
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>
            <?php echo e($product->name); ?>

        </a>
    </div>

    
    <section class="overflow-hidden rounded-xl border"
             style="background:var(--surface-card); border-color:var(--border-subtle);">

        <div class="flex flex-wrap items-start justify-between gap-6 px-6 py-5">
            <div class="flex min-w-0 flex-1 items-start gap-4">
                
                <span class="flex h-[52px] w-[52px] flex-none items-center justify-center rounded-xl"
                      style="background:<?php echo e($ficha['fondo']); ?>; color:<?php echo e($ficha['tinta']); ?>; font-family:'Plus Jakarta Sans',sans-serif; font-size:20px; font-weight:700;">
                    <?php echo e($ficha['inicial']); ?>

                </span>

                <div class="min-w-0">
                    <div class="text-[10.5px] font-semibold uppercase tracking-[0.08em]" style="color:var(--orange-600);">
                        Contenido versionado · <?php echo e($product->name); ?>

                    </div>
                    <h1 class="mt-0.5" style="font-family:'Plus Jakarta Sans',sans-serif; font-size:21px; font-weight:700; letter-spacing:-0.02em; color:var(--text-strong); margin:0;">
                        <?php echo e($ficha['nombre']); ?>

                    </h1>
                    <div class="mt-1 max-w-[640px] text-[13px] leading-[1.5]" style="color:var(--text-muted);">
                        <?php echo e($ficha['explicacion']); ?>

                    </div>

                    <div class="mt-2 flex flex-wrap items-center gap-y-1 gap-x-[7px] text-[12px]" style="color:var(--text-muted);">
                        
                        <span>
                            Acción de la API:
                            <strong class="font-semibold" style="font-family:ui-monospace,monospace; color:var(--text-strong);"><?php echo e($ficha['accion']); ?></strong>
                        </span>
                        <span style="color:var(--border-default);">·</span>
                        <span>
                            <strong class="font-semibold" style="color:var(--text-strong);"><?php echo e($versiones->total()); ?></strong>
                            <?php echo e($versiones->total() === 1 ? 'versión' : 'versiones'); ?>

                        </span>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($reparto['entornos'] > 0): ?>
                            <span style="color:var(--border-default);">·</span>
                            
                            <span>
                                <strong class="font-semibold" style="color:var(--text-strong);"><?php echo e($reparto['entornos']); ?></strong>
                                <?php echo e($reparto['entornos'] === 1 ? 'entorno con licencia' : 'entornos con licencia'); ?>,
                                <strong class="font-semibold" style="color:var(--text-strong);"><?php echo e($reparto['entornos'] - $reparto['sinPlugin']); ?></strong>
                                con el plugin instalado
                            </span>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>
            </div>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($puedeEscribir): ?>
                <button type="button" wire:click="createNewVersion"
                        class="flex-none rounded-lg px-4 py-2.5 text-[13px] font-semibold text-white"
                        style="background:var(--orange-500);"
                        onmouseover="this.style.background='var(--orange-600)'"
                        onmouseout="this.style.background='var(--orange-500)'">
                    Nueva versión
                </button>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>

        
        <div class="flex gap-0.5 overflow-x-auto border-t px-4"
             style="border-color:var(--divider); background:var(--surface-alt);">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $tipos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tipo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <a href="<?php echo e($tipo['ruta']); ?>" wire:navigate
                   class="inline-flex flex-none items-center gap-[7px] whitespace-nowrap px-3.5 pb-2.5 pt-[11px] text-[13px]"
                   style="border-bottom:2px solid <?php echo e($tipo['activo'] ? 'var(--orange-500)' : 'transparent'); ?>;
                          color:<?php echo e($tipo['activo'] ? 'var(--orange-600)' : 'var(--text-muted)'); ?>;
                          font-weight:<?php echo e($tipo['activo'] ? 600 : 500); ?>;">
                    <?php echo e($tipo['nombre']); ?>

                    <span class="rounded-full px-[7px] py-px text-[10.5px]"
                          style="font-weight:<?php echo e($tipo['cuantas'] > 0 ? 700 : 600); ?>;
                                 background:<?php echo e($tipo['cuantas'] > 0 ? 'var(--orange-100)' : 'var(--surface-sunken)'); ?>;
                                 color:<?php echo e($tipo['cuantas'] > 0 ? 'var(--orange-600)' : 'var(--text-subtle)'); ?>;"><?php echo e($tipo['cuantas']); ?></span>
                </a>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
    </section>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = ['success' => 'success', 'error' => 'danger']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $clave => $color): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session($clave)): ?>
            <div class="rounded-lg px-4 py-2.5 text-[13px]"
                 style="background:var(--<?php echo e($color); ?>-50); color:var(--<?php echo e($color); ?>-500);">
                <?php echo e(session($clave)); ?>

            </div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    
    
    <?php
        $conError = collect($porEntorno)->filter(fn (array $f) => $f['entorno'] !== null && $f['recibe'] === null)->count();
        $sinLlamar = collect($porEntorno)->filter(fn (array $f) => $f['entorno'] !== null && $f['recibe'] !== null && $f['peticiones'] === 0)->count();
        $nadieAlcanza = collect($reparto['porVersion'] ?? [])->filter(fn (int $n) => $n === 0)->count();
    ?>
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($versiones->total() > 0 && ($conError > 0 || $sinLlamar > 0 || $nadieAlcanza > 0)): ?>
        <div class="flex items-start gap-3 rounded-xl border px-[18px] py-3 text-[13px] leading-[1.55]"
             style="background:var(--warning-50); border-color:var(--warning-500); color:var(--text-body);">
            <svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="var(--warning-500)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="flex:none; margin-top:2px;"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>
            <span>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($conError > 0): ?>
                    <strong class="font-semibold"><?php echo e($conError); ?></strong>
                    <?php echo e($conError === 1 ? 'cliente pide este contenido y recibe un error' : 'clientes piden este contenido y reciben un error'); ?>

                    <?php echo e($ficha['error']); ?>: su plugin es más antiguo que la versión más antigua que hay publicada.
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($sinLlamar > 0): ?>
                    <strong class="font-semibold"><?php echo e($sinLlamar); ?></strong>
                    <?php echo e($sinLlamar === 1 ? 'cliente tiene el plugin instalado y no ha llamado nunca' : 'clientes tienen el plugin instalado y no han llamado nunca'); ?>:
                    o su tarea programada no corre, o su versión no pide este contenido.
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($nadieAlcanza > 0): ?>
                    <strong class="font-semibold"><?php echo e($nadieAlcanza); ?></strong>
                    <?php echo e($nadieAlcanza === 1 ? 'versión no la alcanza ningún cliente' : 'versiones no las alcanza ningún cliente'); ?>:
                    publicado no significa entregado.
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                El detalle, en «Qué recibe cada entorno».
            </span>
        </div>
    <?php endif; ?>

    <?php if($versiones->total() > 0): ?>

        
        <section style="display:flex; flex-direction:column; gap:10px;">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $versiones; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $version): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                    $cuantos = $version->{$elementos} ?? 0;
                    $laReciben = $reparto['porVersion'][(string) $version->version] ?? 0;

                    // La única acción de estado que se ofrece desde donde está la versión.
                    // Se calcula aquí y no en el atributo: Blade dentro de un atributo no lo
                    // reconoce el compilador, se queda literal y rompe el bloque de fuera.
                    [$estadoDestino, $textoDeEstado, $iconoDeEstado] = \App\Support\EstadoDePublicacion::accionDesde($version->status);
                    $publicando = $estadoDestino === \App\Support\EstadoDePublicacion::PUBLICADA;
                ?>
                <div class="rounded-xl border px-5 py-4"
                     style="background:var(--surface-card); border-color:var(--border-subtle);<?php echo e($cuantos === 0 ? ' opacity:0.75;' : ''); ?>">
                    <div class="flex flex-wrap items-start justify-between gap-4">
                        <div class="min-w-0 flex-1">
                            <div class="flex flex-wrap items-center gap-2.5">
                                <span style="font-family:ui-monospace,monospace; font-size:17px; font-weight:700; color:var(--text-strong);">
                                    <?php echo e($version->version); ?>

                                </span>

                                
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($version->esBorrador()): ?>
                                    <span class="rounded-full px-2.5 py-px text-[10.5px] font-semibold"
                                          title="No se sirve a nadie, aunque su número le cuadre a algún sitio."
                                          style="color:var(--neutral-700, var(--text-body)); background:var(--surface-sunken);">
                                        Borrador — no se sirve
                                    </span>
                                <?php elseif(! $version->seSirve()): ?>
                                    <span class="rounded-full px-2.5 py-px text-[10.5px] font-semibold"
                                          title="Deshabilitada: ya no se sirve, y quien la recibía pasa a recibir la anterior que le cuadre. La fila y su contenido se conservan enteros, y se puede volver a habilitar."
                                          style="color:var(--text-subtle); background:var(--surface-sunken);">
                                        Deshabilitada
                                    </span>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                                
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($cuantos === 0 && $version->seSirve()): ?>
                                    <span class="rounded-full px-2 py-px text-[10.5px] font-semibold"
                                          style="color:var(--warning-500); background:var(--warning-50);">
                                        Vacía — se sirve sin contenido
                                    </span>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </div>

                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($cuantos > 0): ?>
                                <div class="mt-1 text-[12px]" style="color:var(--text-muted);">
                                    <?php echo e($cuantos); ?> <?php echo e($cuantos === 1 ? $ficha['elemento'] : $ficha['elementos']); ?>

                                </div>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                            <div class="mt-[5px] text-[12.5px]" style="color:var(--text-body);">
                                <?php echo e($version->description ?: '—'); ?>

                            </div>

                            <div class="mt-[3px] text-[11.5px]" style="color:var(--text-subtle);">
                                Creada por <?php echo e($version->creator?->name ?? 'desconocido'); ?> · <?php echo e($version->created_at->format('d/m/Y')); ?>

                            </div>
                        </div>

                        <div class="flex flex-none flex-col items-end gap-2">
                            
                            <div class="flex items-center gap-1.5 text-[12.5px]">
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($reparto['entornos'] === 0): ?>
                                    <span class="h-2 w-2 flex-none rounded-full" style="background:var(--neutral-400);"></span>
                                    <span style="color:var(--text-subtle);">Sin entornos</span>
                                <?php elseif($laReciben > 0): ?>
                                    <span class="h-2 w-2 flex-none rounded-full" style="background:var(--success-500);"></span>
                                    <span style="color:var(--text-body);">
                                        La reciben <strong style="font-weight:700; color:var(--text-strong);"><?php echo e($laReciben); ?></strong>
                                    </span>
                                <?php else: ?>
                                    <span class="h-2 w-2 flex-none rounded-full" style="background:var(--danger-500);"></span>
                                    <span class="tip font-semibold"
                                          data-tip="Ningún entorno tiene el plugin en una versión que resuelva a esta"
                                          style="color:var(--danger-500);">Nadie la resuelve</span>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </div>

                            
                            <div class="flex flex-wrap items-center justify-end gap-2 text-[12.5px] font-semibold">
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($puedeEscribir): ?>
                                    
                                    <button type="button"
                                            wire:click="pedirCambioDeEstado(<?php echo e($version->id); ?>, '<?php echo e($estadoDestino); ?>')"
                                            class="inline-flex items-center gap-1.5 rounded-lg border px-3 py-1.5"
                                            style="border-color:<?php echo e($publicando ? 'var(--success-500)' : 'var(--border-default)'); ?>;
                                                   background:var(--surface-page);
                                                   color:<?php echo e($publicando ? 'var(--success-600, var(--success-500))' : 'var(--text-body)'); ?>;">
                                        <?php if (isset($component)) { $__componentOriginalfdf903d7ccd93920cd8355627b101ee6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfdf903d7ccd93920cd8355627b101ee6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icono-de-accion','data' => ['nombre' => $iconoDeEstado]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icono-de-accion'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['nombre' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($iconoDeEstado)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfdf903d7ccd93920cd8355627b101ee6)): ?>
<?php $attributes = $__attributesOriginalfdf903d7ccd93920cd8355627b101ee6; ?>
<?php unset($__attributesOriginalfdf903d7ccd93920cd8355627b101ee6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfdf903d7ccd93920cd8355627b101ee6)): ?>
<?php $component = $__componentOriginalfdf903d7ccd93920cd8355627b101ee6; ?>
<?php unset($__componentOriginalfdf903d7ccd93920cd8355627b101ee6); ?>
<?php endif; ?>
                                        <?php echo e($textoDeEstado); ?>

                                    </button>

                                    
                                    <button type="button" wire:click="pedirDuplicar(<?php echo e($version->id); ?>)"
                                            class="inline-flex items-center gap-1.5 rounded-lg border px-3 py-1.5"
                                            style="border-color:var(--border-default); background:var(--surface-page); color:var(--text-body);">
                                        <?php if (isset($component)) { $__componentOriginalfdf903d7ccd93920cd8355627b101ee6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfdf903d7ccd93920cd8355627b101ee6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icono-de-accion','data' => ['nombre' => 'duplicar']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icono-de-accion'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['nombre' => 'duplicar']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfdf903d7ccd93920cd8355627b101ee6)): ?>
<?php $attributes = $__attributesOriginalfdf903d7ccd93920cd8355627b101ee6; ?>
<?php unset($__attributesOriginalfdf903d7ccd93920cd8355627b101ee6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfdf903d7ccd93920cd8355627b101ee6)): ?>
<?php $component = $__componentOriginalfdf903d7ccd93920cd8355627b101ee6; ?>
<?php unset($__componentOriginalfdf903d7ccd93920cd8355627b101ee6); ?>
<?php endif; ?>
                                        Duplicar como nueva…
                                    </button>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                                
                                <a href="<?php echo e(route($ficha['rutaVer'], [$product, $version])); ?>" wire:navigate
                                   class="inline-flex items-center gap-1.5 rounded-lg border px-3 py-1.5"
                                   style="border-color:var(--border-default); background:var(--surface-page); color:var(--text-link);">
                                    <?php if (isset($component)) { $__componentOriginalfdf903d7ccd93920cd8355627b101ee6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfdf903d7ccd93920cd8355627b101ee6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icono-de-accion','data' => ['nombre' => 'ver']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icono-de-accion'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['nombre' => 'ver']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfdf903d7ccd93920cd8355627b101ee6)): ?>
<?php $attributes = $__attributesOriginalfdf903d7ccd93920cd8355627b101ee6; ?>
<?php unset($__attributesOriginalfdf903d7ccd93920cd8355627b101ee6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfdf903d7ccd93920cd8355627b101ee6)): ?>
<?php $component = $__componentOriginalfdf903d7ccd93920cd8355627b101ee6; ?>
<?php unset($__componentOriginalfdf903d7ccd93920cd8355627b101ee6); ?>
<?php endif; ?>
                                    Ver contenido
                                </a>
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($puedeEscribir): ?>
                                    <a href="<?php echo e(route($ficha['rutaEditar'], [$product, $version])); ?>" wire:navigate
                                       class="inline-flex items-center gap-1.5 rounded-lg border px-3 py-1.5"
                                       style="border-color:var(--border-default); background:var(--surface-page); color:var(--text-link);">
                                        <?php if (isset($component)) { $__componentOriginalfdf903d7ccd93920cd8355627b101ee6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfdf903d7ccd93920cd8355627b101ee6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icono-de-accion','data' => ['nombre' => 'editar']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icono-de-accion'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['nombre' => 'editar']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfdf903d7ccd93920cd8355627b101ee6)): ?>
<?php $attributes = $__attributesOriginalfdf903d7ccd93920cd8355627b101ee6; ?>
<?php unset($__attributesOriginalfdf903d7ccd93920cd8355627b101ee6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfdf903d7ccd93920cd8355627b101ee6)): ?>
<?php $component = $__componentOriginalfdf903d7ccd93920cd8355627b101ee6; ?>
<?php unset($__componentOriginalfdf903d7ccd93920cd8355627b101ee6); ?>
<?php endif; ?>
                                        Editar versión
                                    </a>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($this->puedeBorrarLaVersion()): ?>
                                    <?php if (isset($component)) { $__componentOriginal16cfd58c4c747d2a684655af648eda77 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal16cfd58c4c747d2a684655af648eda77 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.boton-borrar-version','data' => ['laReciben' => $laReciben,'elementos' => $cuantos,'versionId' => $version->id,'forma' => 'enlace']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('boton-borrar-version'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['la-reciben' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($laReciben),'elementos' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($cuantos),'version-id' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($version->id),'forma' => 'enlace']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal16cfd58c4c747d2a684655af648eda77)): ?>
<?php $attributes = $__attributesOriginal16cfd58c4c747d2a684655af648eda77; ?>
<?php unset($__attributesOriginal16cfd58c4c747d2a684655af648eda77); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal16cfd58c4c747d2a684655af648eda77)): ?>
<?php $component = $__componentOriginal16cfd58c4c747d2a684655af648eda77; ?>
<?php unset($__componentOriginal16cfd58c4c747d2a684655af648eda77); ?>
<?php endif; ?>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </section>

        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($versiones->hasPages()): ?>
            <div><?php echo e($versiones->links()); ?></div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

        
        <?php echo $__env->make('livewire.products.contenido.por-entorno', [
            'porEntorno' => $porEntorno,
            'peticiones' => $peticiones,
            'product' => $product,
        ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <?php else: ?>
        
        
        <section class="rounded-xl border px-6 py-11 text-center"
                 style="background:var(--surface-card); border-color:var(--border-subtle);">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($search !== '' || $versionFilter): ?>
                <div class="text-[13px]" style="color:var(--text-muted);">
                    Ninguna versión encaja con la búsqueda.
                    <button type="button" wire:click="$set('search', ''); $set('versionFilter', null)"
                            class="font-semibold" style="color:var(--text-link);">Quitarla</button>
                </div>
            <?php else: ?>
                <span class="inline-flex h-[52px] w-[52px] items-center justify-center rounded-[14px]"
                      style="background:<?php echo e($ficha['fondo']); ?>; color:<?php echo e($ficha['tinta']); ?>; font-family:'Plus Jakarta Sans',sans-serif; font-size:20px; font-weight:700;">
                    <?php echo e($ficha['inicial']); ?>

                </span>

                <div class="mt-4" style="font-family:'Plus Jakarta Sans',sans-serif; font-size:17px; font-weight:700; color:var(--text-strong);">
                    <?php echo e($product->name); ?> no publica <?php echo e(mb_strtolower($ficha['nombre'])); ?> todavía
                </div>

                
                <p class="mx-auto mt-3 max-w-[560px] text-[13.5px] leading-[1.65]" style="color:var(--text-body);">
                    <?php echo e($ficha['explicacion']); ?>

                </p>

                <div class="mx-auto mt-5 max-w-[520px] rounded-lg px-4 py-3 text-[12.5px] leading-[1.6]"
                     style="background:var(--surface-alt); color:var(--text-muted);">
                    Mientras no haya ninguna versión, la acción
                    <strong class="font-semibold" style="font-family:ui-monospace,monospace; color:var(--text-body);"><?php echo e($ficha['accion']); ?></strong>
                    responde un error <strong class="font-semibold" style="color:var(--text-body);"><?php echo e($ficha['error']); ?></strong>
                    a quien la pida. No es un fallo: es que aún no hay nada publicado.
                </div>

                
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(($peticiones['total'] ?? 0) > 0): ?>
                    <div class="mx-auto mt-3.5 inline-flex max-w-[560px] items-start gap-2.5 rounded-[10px] border px-4 py-2.5 text-left text-[12.5px]"
                         style="background:var(--danger-50); border-color:var(--danger-500); color:var(--text-body);">
                        <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="var(--danger-500)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="flex:none; margin-top:2px;"><circle cx="12" cy="12" r="10"/><path d="M12 8v4"/><path d="M12 16h.01"/></svg>
                        <span>
                            Y hay quien lo está pidiendo: <strong class="font-semibold"><?php echo e($peticiones['total']); ?></strong>
                            <?php echo e($peticiones['total'] === 1 ? 'petición registrada' : 'peticiones registradas'); ?> en los últimos 30 días,
                            <?php echo e($peticiones['conError'] === $peticiones['total'] ? 'todas con error' : $peticiones['conError'] . ' con error'); ?>.
                            Alguien espera contenido que no existe.
                        </span>
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($puedeEscribir): ?>
                    <div class="mt-6 flex justify-center">
                        <button type="button" wire:click="createNewVersion"
                                class="rounded-lg px-5 py-2.5 text-[13.5px] font-semibold text-white"
                                style="background:var(--orange-500);"
                                onmouseover="this.style.background='var(--orange-600)'"
                                onmouseout="this.style.background='var(--orange-500)'">
                            Crear la primera versión
                        </button>
                    </div>
                    <div class="mt-2.5 text-[11.5px]" style="color:var(--text-subtle);">
                        Se numerará con la fecha de hoy, en formato <code style="font-family:ui-monospace,monospace;">AAAAMMDDNN</code>
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </section>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
</div><?php /**PATH /var/www/html/resources/views/livewire/products/contenido/versiones.blade.php ENDPATH**/ ?>