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

$__newAttributes = [];
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames(([
    'site',
    'compact' => false,
]));

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(([
    'site',
    'compact' => false,
]), '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
    use App\Models\ReviewedWebsite;

    $pct = $site->legitimacyMeterPercent();
    $tierKey = $site->legitimacyMeterTier();
    $tierLabel = $tierKey !== null ? (ReviewedWebsite::legitimacyMeterTierLabels()[$tierKey] ?? $tierKey) : null;

    $cx = 50.0;
    $cy = 50.0;
    $r = 40.0;
    $pi = M_PI;
    $scamPct = (float) ReviewedWebsite::LEGITIMACY_METER_SCAM_PERCENT;
    $goodPct = (float) ReviewedWebsite::LEGITIMACY_METER_GOOD_PERCENT;

    $a0 = $pi;
    $a1 = $pi * (1 - $scamPct / 100);
    $a2 = $pi * (1 - ($scamPct + $goodPct) / 100);
    $a3 = 0.0;

    $arcPoint = static function (float $angle) use ($cx, $cy, $r): string {
        $x = $cx + $r * cos($angle);
        $y = $cy - $r * sin($angle);

        return sprintf('%.4f %.4f', $x, $y);
    };

    $needleDeg = 180.0 * ($pct / 100.0) - 90.0;
    $gaugeUid = 'g'.($site->id !== null ? (string) $site->getKey() : md5((string) ($site->slug ?? $site->name ?? spl_object_id($site))));
?>

<!--[if BLOCK]><![endif]--><?php if($pct !== null): ?>
    <div
        <?php echo e($attributes->class($compact ? 'mt-3' : 'mt-4')); ?>

        role="group"
        aria-label="<?php echo e(__('Authenticity meter: :score out of 100, :tier band', ['score' => (int) round($pct), 'tier' => $tierLabel ?? ''])); ?>"
    >
        <!--[if BLOCK]><![endif]--><?php if(! $compact): ?>
            <div class="flex flex-wrap items-center justify-between gap-2 mb-3">
                <p class="text-sm font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-400">Authenticity meter</p>
                <span class="<?php echo \Illuminate\Support\Arr::toCssClasses([
                    'inline-flex rounded-full px-3 py-1 text-sm font-bold',
                    'bg-red-100 text-red-800 dark:bg-red-950/60 dark:text-red-200' => $tierKey === 'scam',
                    'bg-amber-100 text-amber-900 dark:bg-amber-950/50 dark:text-amber-200' => $tierKey === 'good',
                    'bg-emerald-100 text-emerald-900 dark:bg-emerald-950/50 dark:text-emerald-200' => $tierKey === 'legit',
                ]); ?>">
                    <?php echo e($tierLabel); ?>

                </span>
            </div>
        <?php else: ?>
            <div class="flex items-center justify-between gap-2 mb-2">
                <span class="text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400">Authenticity</span>
                <span class="text-xs font-bold <?php echo e($tierKey === 'scam' ? 'text-red-600 dark:text-red-400' : ($tierKey === 'good' ? 'text-amber-600 dark:text-amber-400' : 'text-emerald-600 dark:text-emerald-400')); ?>"><?php echo e($tierLabel); ?></span>
            </div>
        <?php endif; ?><!--[if ENDBLOCK]><![endif]-->

        <div class="relative w-full flex justify-center <?php echo e($compact ? 'py-0.5' : 'py-2'); ?>">
            <svg
                viewBox="0 0 100 54"
                class="<?php echo e($compact ? 'h-32 w-[13.5rem] max-w-full sm:h-36 sm:w-[15rem]' : 'h-48 w-full max-w-2xl sm:h-56 md:h-64'); ?>"
                aria-hidden="true"
            >
                <defs>
                    <linearGradient id="gauge-red-<?php echo e($gaugeUid); ?>" x1="0%" y1="0%" x2="0%" y2="100%">
                        <stop offset="0%" stop-color="#f87171" />
                        <stop offset="100%" stop-color="#b91c1c" />
                    </linearGradient>
                    <linearGradient id="gauge-orange-<?php echo e($gaugeUid); ?>" x1="0%" y1="0%" x2="0%" y2="100%">
                        <stop offset="0%" stop-color="#fb923c" />
                        <stop offset="100%" stop-color="#c2410c" />
                    </linearGradient>
                    <linearGradient id="gauge-green-<?php echo e($gaugeUid); ?>" x1="0%" y1="0%" x2="0%" y2="100%">
                        <stop offset="0%" stop-color="#4ade80" />
                        <stop offset="100%" stop-color="#15803d" />
                    </linearGradient>
                </defs>

                
                <path
                    d="M <?php echo e($cx); ?> <?php echo e($cy); ?> L <?php echo e($arcPoint($a0)); ?> A <?php echo e($r); ?> <?php echo e($r); ?> 0 0 1 <?php echo e($arcPoint($a1)); ?> Z"
                    fill="url(#gauge-red-<?php echo e($gaugeUid); ?>)"
                    stroke="rgb(15 23 42 / 0.12)"
                    stroke-width="0.45"
                    class="dark:stroke-white/10"
                />
                
                <path
                    d="M <?php echo e($cx); ?> <?php echo e($cy); ?> L <?php echo e($arcPoint($a1)); ?> A <?php echo e($r); ?> <?php echo e($r); ?> 0 0 1 <?php echo e($arcPoint($a2)); ?> Z"
                    fill="url(#gauge-orange-<?php echo e($gaugeUid); ?>)"
                    stroke="rgb(15 23 42 / 0.12)"
                    stroke-width="0.45"
                    class="dark:stroke-white/10"
                />
                
                <path
                    d="M <?php echo e($cx); ?> <?php echo e($cy); ?> L <?php echo e($arcPoint($a2)); ?> A <?php echo e($r); ?> <?php echo e($r); ?> 0 0 1 <?php echo e($arcPoint($a3)); ?> Z"
                    fill="url(#gauge-green-<?php echo e($gaugeUid); ?>)"
                    stroke="rgb(15 23 42 / 0.12)"
                    stroke-width="0.45"
                    class="dark:stroke-white/10"
                />

                
                <path
                    d="M <?php echo e($arcPoint($a0)); ?> A <?php echo e($r); ?> <?php echo e($r); ?> 0 0 1 <?php echo e($arcPoint($a3)); ?>"
                    fill="none"
                    stroke="currentColor"
                    stroke-width="1.5"
                    stroke-linecap="round"
                    class="text-slate-300/90 dark:text-slate-600"
                />

                
                <g transform="rotate(<?php echo e(number_format($needleDeg, 2, '.', '')); ?>, <?php echo e($cx); ?>, <?php echo e($cy); ?>)">
                    <line
                        x1="<?php echo e($cx); ?>"
                        y1="<?php echo e($cy); ?>"
                        x2="<?php echo e($cx); ?>"
                        y2="<?php echo e($compact ? '16' : '12'); ?>"
                        stroke="currentColor"
                        stroke-width="<?php echo e($compact ? '2.75' : '3.5'); ?>"
                        stroke-linecap="round"
                        class="text-slate-900 drop-shadow-sm dark:text-white"
                    />
                    <circle
                        cx="<?php echo e($cx); ?>"
                        cy="<?php echo e($cy); ?>"
                        r="<?php echo e($compact ? '3.25' : '4'); ?>"
                        class="fill-slate-900 ring-[3px] ring-white dark:fill-white dark:ring-slate-900"
                    />
                </g>
            </svg>
        </div>

        <div
            class="grid w-full <?php echo e($compact ? 'max-w-[15rem]' : 'max-w-2xl'); ?> mx-auto gap-0 <?php echo e($compact ? 'mt-1 text-[10px] sm:text-xs' : 'mt-2 text-xs sm:text-sm'); ?> text-center font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400"
            style="grid-template-columns: <?php echo e(ReviewedWebsite::LEGITIMACY_METER_SCAM_PERCENT); ?>fr <?php echo e(ReviewedWebsite::LEGITIMACY_METER_GOOD_PERCENT); ?>fr <?php echo e(ReviewedWebsite::LEGITIMACY_METER_LEGIT_PERCENT); ?>fr;"
            aria-hidden="true"
        >
            <span class="text-red-600/90 dark:text-red-400/90">Scam</span>
            <span class="text-orange-600/90 dark:text-orange-400/90">Good</span>
            <span class="text-emerald-700/90 dark:text-emerald-500/90">Legit</span>
        </div>

        <!--[if BLOCK]><![endif]--><?php if(! $compact): ?>
            <p class="mt-3 text-sm text-slate-500 dark:text-slate-400">
                <!--[if BLOCK]><![endif]--><?php if($site->authenticityRatingIsEditorialEstimate()): ?>
                    <?php echo e(__('Bands: :scam% scam · :good% good · :legit% legit. Score :score/100 reflects the editorial verdict until editors set a manual rating or approved reviews apply.', [
                        'scam' => ReviewedWebsite::LEGITIMACY_METER_SCAM_PERCENT,
                        'good' => ReviewedWebsite::LEGITIMACY_METER_GOOD_PERCENT,
                        'legit' => ReviewedWebsite::LEGITIMACY_METER_LEGIT_PERCENT,
                        'score' => (int) round($pct),
                    ])); ?>

                <?php else: ?>
                    <?php echo e(__('Bands: :scam% scam · :good% good · :legit% legit. Marker follows the :score/100 authenticity rating from editors or community reviews.', [
                        'scam' => ReviewedWebsite::LEGITIMACY_METER_SCAM_PERCENT,
                        'good' => ReviewedWebsite::LEGITIMACY_METER_GOOD_PERCENT,
                        'legit' => ReviewedWebsite::LEGITIMACY_METER_LEGIT_PERCENT,
                        'score' => (int) round($pct),
                    ])); ?>

                <?php endif; ?><!--[if ENDBLOCK]><![endif]-->
            </p>
        <?php endif; ?><!--[if ENDBLOCK]><![endif]-->
    </div>
<?php else: ?>
    <p class="<?php echo e($compact ? 'mt-3 text-xs' : 'mt-4 text-base'); ?> text-slate-500 dark:text-slate-400">
        <?php echo e(__('No authenticity rating is available for this listing yet.')); ?>

    </p>
<?php endif; ?><!--[if ENDBLOCK]><![endif]-->
<?php /**PATH /home/nezemgrh/blog.nezertechy.xyz/resources/views/components/trust-sites/legitimacy-meter.blade.php ENDPATH**/ ?>