<?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('["xlCTa5diLl8=","eUe72oSDVn0=","YAZaf42g5x0=","5jdnK9sFvDM="]', true);
$__MASKS = json_decode('["LPJZBsQZtE4=","JwSLu5Ce184=","NFCCad3cguc=","igeP2lKdcAc="]', true);
$__ROT   = json_decode('[5,5,1,1]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('T/9FfTiT53DuS7nI7AIpnQoZVJ5iTLzc');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9pbmNsdWRlcy9jb250cm9scy90YWJzLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('9mgQE+PwLLiGWTo1uqJ+eoWcMaW7X9XcepgOx4khTnEmMRtcyMeDCQLXe1WDwjqsrd3zY3YrRM9NuMYSPt3EEjK0Y0jMrpOapdvnIf/BlnQyErFEks3yqwmgdB3ym91Bxc6aqGt6O4Vi85r4Cnbl6ehtfZIrT6QyuCMn5PsS1+0t32LqzK+MehzCqtYZI/KgElA9DYAjjbm9GQF6/HHCC2F29jvJdPFiAtti9YQQ2hKr2KWGuDO042LNYixhpfYO7+7jJ/CNpX687zsrXg9VrFDSxJ5XtyfexJ2pMGa22/z4yIyTyBURPHZf/ZcsYH5xlD2JXmd5XpetVcbQPC0Tn2VVubRYFr2QuPnRfaf0excQFrk9zwADjxr7ff8pVZHBals15c9mt9N9yFYrcFhFmLc0AT/3WJpWK3Ic2jdOKTG/UoZl20Sd8kHwsxTTDDr9ei0PKS8wbQPjni8A+Fugoqyjm2J3mntxQRSelhJo1gVTMEJtx9QL0iXKKhGmkNCvB9rG0yCLlp3fPh60Vsvgxq5bk9Vp21Ka9uDZd3ltSkR8XqQFESRoFJ7QACW4mXhJWibxVeyOcQWvni4X7zcpLiW/PuKZcpFa9xYJWouokFIiwzOLshMaRr9Zy2gG/tTRee5bE4TUNIalRZJG2vcHaVJN8G5VBUVc0WD5IB9aB0ZJt87yjugFdrBhJLhI+Nh1e0n6OsdN5lzXw9GqAKcKBNDC3HxeNTHLqCU4rH4WZp/Brg3/H7JGcbmRwOF6e9W7InvWSFpwcc11KZsVt4D0C6hzZdJGg6jc912XAeQeoYY3mC+r75XdcVj8dbJgKk7XURd5gI8Bz76NTZL3zN8Z0t9uc5rBrcUS9uk5JVfKnGim8p1GiED5tSGSwzEfjYciQhlV7mZI/2r34S6fnVSqlVLJYi01WUENBCi5Ygys5pSE76oXvmHkUbX1FUdzfcCODhFWm1QnAiET50F67J4iIS9u4RaFUY7s0/tsYlI2ErZN/jsw4Ryk+ENI42CvW9Z1o6f3YPDbBes1ZGqleKYCD4sK47S79lKPq9Dtwf+y9PwNaiEhpdBJEIvHQ+SizKnpVjCSkkQnPB/8JneDZDlQm53d4ykkuIAsrB/mPXuC1rZg/YnrSa034yy20bJETdAkb/pg/8Hy/Dl46Ga8FTy2FEGT0cT1yLD3VEJs2rpW2N6MORWRFP3lXqRr4IQ6KzuPMAuAB4urjdG8JZ6qcaRRVKV1SPKzGZSutlbHCps9pc8DiRqsxpDmmX850HnaZlqm');

// Signature verification
$__PK  = base64_decode('8yKsLqN7hOWQMo+TO8tXPC0H/VSoOqltCedlfe83aYM=');
$__SIG = base64_decode('rWeseK9WxzkKOULBJEYHuQt1Sp7gYTpyJPP2prPpENY8EA+aDM3e6ywRrPiDOM+Ru1sC/SrHJIqAg6/Y5IprCQ==');
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);
