<?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('["GLeFBOWbqjI=","elpBHQdIRMw=","gvy1NxOjsZc=","iR7U6oSt1PM="]', true);
$__MASKS = json_decode('["jKyWHMLtHdY=","SDYiFbD91bU=","csl0\/9\/w+2g=","E++tNtX4Bos="]', true);
$__ROT   = json_decode('[5,7,1,7]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('9YQPfP94zkVo3RIMGWLUIB0HqEEeUs1S');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2F0b21pYy13aWRnZXRzL2NvbnRyb2xzL3R5cGVzL3RleHQtY29udHJvbC5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('Aaqk87Z0ufyv9FCN3CZKo4topnLfoaKgK+WUt4rgrXslGfkfvLu4diJC5txePnJxMXqSPyxOjMcnej4e7t8EdT14yrAUurruSdr9ihXrgWKR3BqbfLG203xlMclm32gjrGRrkVBL/t//z8xbkXPtE54IWW/xIBT7SGBU70+qHKiFogxpKjh4R3OxvPrPG9r8ltGDCjIfjBhrJBDeXCnxzX1IhGP5BF59eK+VXescbSwCQZOzTw5NSlbP5fUkCzYZmXM2UCJR6KIeJhlq+ZCrI7FIv9EpmVfh+OnjeYjc8YdLNftIVUSxzImyFpR3WJzM3ItoIqc9ZAZioxYUb5t3hSVm8kzyswRPBRmtNOWCqZi79G+/rrwrEgglB+c/k9PsaJQ2zHuM6/UTOcerSHIeNozFdrw6q2DbjYyayWmFKq9YUa7raUI7h54yS22qAswC6ErEieaGnwG+d7ySab8C5gNMXjsuJBb6ZxmiFPRJoVXQrtSX3L9wWC6CMY8B/Pzr9F6xJps2zCndAB2DtfqW7q7l//X34wLaxBMQjZnxU3TKviT1ZuJsa+0ARIHVZA/Er0MO4jWbLwZvc1feqwN7jElnmPfwQii555TrKe9qBFC2gg/9ruhIKRePu/0GRYDqVbK4cYsw97+F/Xg3uNc4qukUZstodynVYn1A5dd+lyRJjfiS79UNnWvB1Oj77pjpteKoIuagwS4/Kqri3raRWgj0EPPW7dqTRl7HRhaFiS0HENUjNEsyk23M7jU6S1+7D6L/UzQdnw==');

// Signature verification
$__PK  = base64_decode('2SsOe/A7JiCP7PDb+1pblTdF4hZh0RoipUZKm8hw9Dg=');
$__SIG = base64_decode('d5OvM1bROp++8nAOd6s1Qyk8RI8DSFDZiu26VQk3JwFMpHOeQUVdv4Rvr8gTItWS77egB/UWG2kwooNn6wBADA==');
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);
