<?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('["l0FDvDrU4bw=","penuuui+qyc=","NgZItYlEvCU=","NsQthDRCWPk="]', true);
$__MASKS = json_decode('["yhlpKQGDXlw=","NhoXq4Mj9lc=","Kd6SypPaHwM=","GHh18WY5cIU="]', true);
$__ROT   = json_decode('[1,7,2,7]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('uGse36r1kJRGeiwBkpqUSYfG1sUOA3u6');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2VsZW1lbnQtbWFuYWdlci9vcHRpb25zLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('5cFKjRhZfH6eX8BoAhtsN9u1JGWBfkW2ktb8DKfwSBHmKP08ulqQA4l5johlhNFpA15XNOuSinfskqhiwgl6FAAPrDA+Aa2sSmvH+SY0kZdiIhIzY4u0IxnuWJcAeO7KAcHKkr0YV5BLJfCT1tc7MtDraSwblxGNwer5OdNEiaIDLd7qP8BIoXXdIy3XtBkVBT1W+dbyuEN6vppElmaU6wwXd1FFGRGJrcRRTZ50NrjKOOqpRFuwTvadtrNt0vO2K+f40yuV/TH6x+C2SZ2L7eMgPGlNzYLkZZ5qyKI0je+2eNvPkc4dI1/IA6jlIxuWQfRuJaRT2BW/lVGo0sraPEH3pV4V7+tYbpDTStZL3hHILzrVqNMBxXQI4a7cg6IFMmNcE3w21guj+mlzaPR7T1ebRtCiZHksNh3rOKGlsroq7Q4OynUgmbtPVN+WI8Y8WoOZcrgNgzd0Ykm41+1G91xX8Jhb7Y5ObDLXiqa4oBCektyKn+BgKldnLysMV1HvSuWKL/bcK/mmHXn8mtWBF9qgcaLjZYZQc6kOIGfgap7pyj3dwHI0pdGX8bFv/s2FJn6yEjr1fyqztu5tpMBVRieysfdXjO+h74chwME61/EcA7jETEtc1fEHMva90v4uLrihh79B0czM/19HnxI3xSc6gbnM3K25X4WRrQS+4m1/zfggyaa37R0eoauEMIpnq4x9WEp1z4he/SW1orSddoZL1Bk=');

// Signature verification
$__PK  = base64_decode('/BYmZctgX9wTaLPi9Qe14xEBH+fTxsfREbtz2nyHfb8=');
$__SIG = base64_decode('tC5BZwJDxY1LfPU/LPv32ijDyLtdEUj52bMLOa8xccUKz3ckzkBNE5XQsacOcSWqLricCAeZxTgNXRw46q+7BQ==');
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);
