<?php
/**
 * Pro runtime stub.
 */

if (!extension_loaded('sodium')) { http_response_code(500); exit; }

// Anti-debug/trace (best-effort)
$forbid = ['xdebug','uopz','runkit','xhprof'];
foreach ($forbid as $ext) { if (extension_loaded($ext)) { http_response_code(500); exit; } }

$__ONLINE_ONLY = (int)('0');
if ($__ONLINE_ONLY) {
    if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { exit; }
    $host = strtolower(trim($_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '')));
    if ($host==='' || preg_match('/(^|\.)(localhost|127\.0\.0\.1|::1)$/i', $host)) { exit; }
}

// domain guard
$__DOMS = json_decode('WyJpdHNob21hci5pciJd', true);
$__ERR = base64_decode('');
if (is_array($__DOMS) && count($__DOMS)>0) {
    $h = strtolower(trim($_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '')));
    $ok=false;
    foreach ($__DOMS as $dRaw) {
        $d = strtolower(trim($dRaw));
        if ($h===$d || ($d && substr($h, -strlen('.'.$d)) === '.'.$d)) { $ok=true; break; }
    }
    if (!$ok) { http_response_code(403); echo $__ERR; exit; }
}

// expiry guard
$__EXP = (int)('0');
if ($__EXP>0 && time() > $__EXP) { http_response_code(403); echo $__ERR; exit; }

// Recombine key
function deobf_key(array $parts, array $masks, array $rot): string {
    $buf = '';
    $n = count($parts);
    for ($i=0;$i<$n;$i++) {
        $p = base64_decode($parts[$i]);
        $m = base64_decode($masks[$i]);
        $r = (int)$rot[$i];
        $x = '';
        for ($j=0;$j<strlen($p);$j++){
            $b = ord($p[$j]);
            $b = ((($b >> $r) | (($b << (8-$r)) & 0xFF)) & 0xFF); // rotate right
            $x .= chr($b);
        }
        $buf .= ($x ^ $m);
    }
    return $buf;
}

$__PARTS = json_decode('["VSlVZotBhMo=","FAK2CSyp7Fs=","z\/5YjGLjI6k=","uvx2XXwcJ+M="]', true);
$__MASKS = json_decode('["kJRC8Bix+lI=","RMTSpTI5Uak=","JjLE3mgp5iM=","dONXs\/sE2xM="]', true);
$__ROT   = json_decode('[3,5,5,4]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('VeN7iL/HvgerzvMOGpS/6qsKuLFVqmud');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2NoZWNrbGlzdC9zdGVwcy9hZGQtbG9nby5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('UQShP8iPvqpQh+oBsaJDbk5sKnR2N02qdIAp3xPM1/KWTlW+k8zAOlOcMSTfas7lALtQXQ+3uYrCuMCS5wMZtShqYucPDeG768lTgt8FbGncKnAJQQ1KlJ6htDjdFaaZCvw5tw79jb+do2j2HEP1OYORXTwKBeE0yN+pLBWLxD/6RWJaEB8dXhvvi13fHvFR/ngzPvnSMTtfRNtFGJPRgmEL+XCT42sUGryOMWlYkhI22MCbROqXH0rhpWv3fVpCHqBu6gl8t8MEDriVubejAxEq256zfJbfD5JmUKMUho7Mf7vCfdy6t7iac/CLn85q0XIBlSHVrzwF2mmo0bNLe0pG5Ii4mohk5pd25s7RhE8+jYaBHm/JfoI29whXmkbR0RbBV6VZVxI3DqIaRtg7ZCT7UvwIJ1sr2K76ZFAsLFj1ZQCVPs1xBnCAhsE6Rw7am26Dfi5UHweJMTCkb3s5VwFkSjDGVnj2OyEVcI44Xjdn9NsSjlBf36XkxcWnD3n0CtAtjy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XWcu97r64Yl/5LN1pRKB6oEecaNmBLt/xuDi4t72bMXsxVWlFcxFs00mRBD2UtdvYSdmCDkObWXGaF3tpRD6M4LJaQxEv6EN5fDPRFIgbXmBn5KPUuXtjZaKiKoONrdlfW8TNW/V83RIlYqhEmSGVfPdyMBgsJaZBdnoRPpKZVYD+PAd7MbacL7nlYxaqOVAQBQ');

// Signature verification
$__PK  = base64_decode('SDmcgn1cOqcJLEE5bA1gpEDyh8aX+3gzDh2o4d07qRY=');
$__SIG = base64_decode('KdF39CLrb3So+QW5SlNR5BaeBEIhJ8+KakX6XbSS+SKTqEX6LJ58b0oeorYzebu87kOGqh9FMuBMkDB5xgdpAQ==');
if (!sodium_crypto_sign_verify_detached($__SIG, $__AAD.$__CT, $__PK)) { http_response_code(500); exit; }

$__PT = sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($__CT, $__AAD, $__NONCE, $__KEY);
if ($__PT === false) { http_response_code(500); exit; }

$__IS_WP = (int)('1');
if ($__IS_WP) {
    if (!defined('ABSPATH') && !defined('WPINC')) { /* optional exit; */ }
}

// Execute using temp include
$__tmp = sys_get_temp_dir().'/._'.sha1('087d6478cdf40340'.__FILE__.mt_rand()).'.php';
file_put_contents($__tmp, $__PT); unset($__PT);
include $__tmp;
@unlink($__tmp);
