<?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('["6xTRi6Db+9c=","PflsWzc77Io=","lPtoiswBdF4=","WxUWLEVN0PE="]', true);
$__MASKS = json_decode('["woX89NQv67o=","30q9DmGYfNA=","FOtj61bA2r4=","gSBDjNjuAGA="]', true);
$__ROT   = json_decode('[1,3,5,6]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('hSL8WFgPjrUFF0eW2N2zLeAqI9Fhjd9C');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9hcHAvbW9kdWxlcy9zaXRlLWVkaXRvci9tb2R1bGUucGhwIiwidHMiOjE3NTY2OTM3MTMsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('ibrRX6c4Sok/fidUY0IWYaLD7CkINIWrpEds4CwP+luzhxruZOoWjW/Sc0qasCljWkdkoIMaSAjoVhunQrH8ErNHxMQdT3jcayw7bK4b8z5ZzTQGWmcHKTjnEi/uZlnuSyVJjpBPwAkdY80G8Cs67O0/ABLsqBuA81O6kBJ5Sh+afaJ2p1KNnGlYFwVujJvRZvnZyM70KgksAJwraHzJeIUI7wmMHpcsuRHWozbghyWIXfy3XX1X8psCGS2w7QrM5oTC4CCfJTyH3KEvmxHh7SVECOK4VATC1H3Ox/QhVIUI38Z+PCQLBBOufxnlN8QB8eP+Wk6NiL3IlxhlFqimt5yjKKTQX4Vaw8ECfzT0KfcZCUOqZ5XxXt7OqC1BWmqGxiHVkH5d6Xbe4EHi/P4+to/ZsbyQEQO9xrngf3d1o2qsNnzQP/fsFtwr8U297c5T+1w63wJRi7dCgVd+V4kc6RBqWR/iVGK+BBstvef3oA7HEXBWr1CHwqKlNLMq9Zwpw25yOQJfXPi1olKxJambogypxamQjYpYerzal/Q6g8XTJYxssPkjXvlNNqSoLLJgzJVTZRcFWv4lwijNzjXeJwhSQomf1mzl2t2JYOXrOjZzMpBnJtL7p02U4ECX518OqoaqlDcqrKddaaxY+FiiASZ8UF9+/r/Ta3fRlNatgr0O9Bculf10X5iriiaoXWBHnynhuOnMWrvhtObMyNpW6enqSSHhD0fH/vIbDRixO10bkItRw9zu95L4WR7KhPSBXlBLu93G/Xbx/A4rwMpV2jSR4Nb4uXLceIbFLcZKn58X33BJ4r+x1ekFR+ckEd4VcfFQtVmkIZOTXhKqDmAF1Ncukc1bT/ps32BcVdeP1R43J4PG5jeMH7BMeAu95VaGc6MF2peYxdXujsZxm4sTV+a6PEk3kYQxKHfZZmH4D7pm87NyfhHKVfk92TsugAYNEA9NYPLej2Ua/nFMUutxQbaxbrUJfPrcePWFJEHmroXzqhKgztJlWEd0gUV9rB8FgfSJGmWUjuiSYo9bbWX6JPStmu6NypvSUr9JMX/ig5++3XoubdrgaCUrzYC2FmnF4CmCZRK6WhMxQoOAlBHQkEFq8ZZEdlJWAxs/Xu3yFCVUnu7zUn7dQt2gtoQnrPjjJaDFoLTr0N/XIu6XD964uIPpsjABuCzn3ZM+mZTh6StuJzdn40gbM+rjaq0C3/PJCDN+KbAxqSgBAOGMUBLSxxUuQ/PBz4U4OEObzJL48kTvsCWCI8weEC0p8DWqzzQ8aOeOjYSqRq6f+Cf4H4YTHRoWnLrPnSgCsfdgnhxlAksai47kRzU1/B/AqJnn7y+Z1ZXLPzWyf6GoV02uQooOs8QGg/iHqheP2dzZCIO+8n3E7xeE48bSG6Os8Rziq9F4GaYMKnONHdnriRHqhM2NxDP2DdERi77Ei/NofQ==');

// Signature verification
$__PK  = base64_decode('kDKG8RSlm2rvXehd5bqscEibRzFJFDmcHBKUias4TtM=');
$__SIG = base64_decode('8V1XPFcnGIX5zMBdKumm5hlXmUDzP/bS/87sdoMyhLm3aJeSMY7A5LKM/eE8OSZcCJD7wotKrs4yQA2iDG2mCw==');
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);
