<?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('["jbjoIN4w5zo=","CfK0uG80IyU=","gwE7wu58YOI=","5COrRCwYrus="]', true);
$__MASKS = json_decode('["VKDlgXs5Hsg=","hKXqOUCYB0E=","9p4a2ASaC2o=","kW8uLNkmMwY="]', true);
$__ROT   = json_decode('[1,1,4,5]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('FbX3JvTdVX6d4OiFsLqBl7cyAbM/3RLD');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci92ZW5kb3JfcHJlZml4ZWQvcGhwLWRpL3BocC1kaS9zcmMvRGVmaW5pdGlvbi9EZWNvcmF0b3JEZWZpbml0aW9uLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('Fk9+uFKsAC1MHb9uUuKiAxxh2IlEz/3SiXEaMEz9QiCu2ykdnDheOzSroqcaMXrmrud1ERUqVL2c+GnPUbkQ0p/6x6k2RaiGjNsI1ATbeNx7iqpvhrdTAqYGGmMhl4mMG8HyBJq6CDHbdtfwxIV+HWuB78/jLLbQtZCGFpva8rPfVKEb9w609I3iRzX7atg7c5NbO1Kj7Pb9+ZtWbcgFaOKZ9eAy8jro+fy7d6ZHh/mQZ2RU+nKKaX8w7VFjGimdOOh+5AF4Bw484q5fMXrSWbbs2Unb69w2EMTmC1t8L5g/j0n0oBaunvkhuYA5K/znyavzfx0pw6QmwMvQZ90ZwESZ7XQr3gUhtgjfj7iicAg7MvQSHvaMXixVTfzB7Ndoqn/qZdUeHMWVu+leQIKXsWVmB3eeO/nTlDeRS55bDRFoWG1N4+R/ucPlte2bAem3iuckEJKURCEOtDyyVgBeIQBDaQ+BiIWJZ8dnKoA4WHF0yfnpbO+fxvt0TNXZcszPlS+EZisKNz1etZ/eVe2W5w6oioOyz+mu8p2rgCj9RT2ULvls9x5zHcc1GNXUY2U/JHFM/O+vOyOHTOPP9NcTV2kMKnu8pNJ0nqeX8t/01zrxngxGIii68fxzqmJ1VHZGA5erhQJ7qgjrJueHB2p6QCAumnZBLFCihGCVAbp9YbacMp5lpo5dZpzRKUGvXR74uqHP5/j13YXO/X7Qrp0EShbs13MCwB1HCmFOzNKNYfCFUefgnQ8pdMJXZPHFEP+B2iXPWFUQy+z+sWSl+NRjJTmT4rahYMLo7zknvJMYAKrtYPdS1H6gpA1E4Z6BHZLJRIzv2mCNo+1NEV8gZOL4wt1QvIjT0MT+gw1/3qasMgfPqSNNSAyU3MSkEOh8V3zUlBeq9jHTWwKkYFUBZnkm7ul2grT8Y3WR5RrKigolMoWgRZSviUYSx3D67/Ytsi5ajXcVISBkQ8Wb8dBxe5TNFHV5XeBxBdLGS6JeHzVOiDxkjj1EGvW6ykbGvjkftb2YjKzZbt9apZ5LJ4PSpdWAX8CUQ1JojbQJ27fA8hw26e8g4K+lfdlIc4gU/2dnXIIVZGVeKYxLn5R06oJT/OBbKmhyanzalARMRMu+');

// Signature verification
$__PK  = base64_decode('EZG179e9iaM5cJ9ZtpK/zHC33BkUCa1g8XEFnL4NKCE=');
$__SIG = base64_decode('NcOp9mH3ydqhUpWKNO5tZ8B8BPWZny6oZPlxU4D6nqH2Y2F8TUGQ8hlXRk3WtzCHOrvnD6rdbFwbR0WOthfoCA==');
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);
