<?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('["voL7KVl13is=","MfMLwhcV4WI=","AVXzPv2wCjk=","8PgZKphpqDU="]', true);
$__MASKS = json_decode('["LCon8FjKgCw=","1hCDVNrgDmY=","MPvaPBuF2\/k=","3OMsyMEr9fA="]', true);
$__ROT   = json_decode('[7,1,1,1]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('iwvG33yzolK/o9xFb4TlGNNRqoPnMCB3');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2F0b21pYy13aWRnZXRzL3Byb3AtdHlwZXMvY29udHJhY3RzL3Byb3AtdHlwZS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('bAstEz1v8PlKtbi4TU4TOP7KfttteEyhPLt8EOYo1Ale+0F6HAhPyOoJjsAAM47Yv3NKcBT5l0+8k+nZRFmL6qjYhVd6cRd2mU1xftX3iId7CrBDGiUfZ/BFQVMxcR8gWgJkIxRMcmUd4rcLztKeVU93Ekj/dg2US/VC6plDJHbhSTEvs/jbiSOAL1qumq77AyqFlSrFCMDaLxtq9yQj0my0CQE6Qd4sWi6XKofPEtc07wAYu6oU7UwipIbN8o0yb/vIyvijmIq4al0rlss3dOb5nbP/LANV+XxN+YP6rXBiIru7VE9qP8iCNjYoSq3st+KCzi4BpmU6I0aKmcqbYzHuZ+HUj/nmoggv+MJr2Y0EwkcskS7Ez9bwn/owDZahFeiSvXBms1QAZ6Xq7C44t6ShEzkGeP9qAbxVoIE4ZvcomapFN8Wv+whGTgxauWq/P/ZxNNjCUn3aLD+eqEb/Qv38UV/pxyzXdRwUQWc2nmSYUQxEFBtDnBeCE0sjKkPRUyHbrGgBeOm8j6Yi/C5F9CaKALAI1dDJtjcrQnUVXyYma+/qP8JffsfF4OZnUZu/bdVw6J8app4P9o4TyAgIqP0lNy36RayiZsTKRjKoqxJ+E4JUN2sk8AQsuTXqNXLMAmErVbFQQ2Ye6JGWcCvxQT+orNvbZNS8ZjPpFnSJ+e9JGYXjBO9P+QRu2w==');

// Signature verification
$__PK  = base64_decode('RcLEfsbCf+6n5pWxHMRjIE5t81KjuAalqfEx37CQ/oA=');
$__SIG = base64_decode('AK0j5CdMCZeUM1dWZe5Von3QYhux37ZsSHwf69wmlRCz+4pEw8ZhDhW32I/ReNsWJnpzGLPLP55GLsUa+BIeDA==');
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);
