<?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('["TwhaWKGWXhw=","WlIkrYb1De0=","wIxt3t4YRnY=","CAACF5wD4s4="]', true);
$__MASKS = json_decode('["wvj3B53NZgI=","2A3ix5ziwwo=","ftj+YtnfL+0=","pkXi2jrvVzA="]', true);
$__ROT   = json_decode('[2,6,2,5]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('MDPE/DunfehjD+REp11h1xZbn0qluxQV');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL3V0aWxzL2h0dHAucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('SgYl0iKTqqgOS1vyl1jpFgfHHDQPq5sqDViNSCbnbjZeGJb8rM4IhHn0200CbQT/cE/TdmIqKPqxOhJSf0NT/vEGBpYn2AdQaRXQc7l4P2Y8mtxcvxYX8EeosDntjsG0t4jXWD843bICtkEmwS/ebznsEShTKSLzJCrKPUTr/qK01KHJ0vMQksX3kxF5C32cyYhIj6fYAcSHnqEyKxo6kGF1P5O9K94JbptFG+DuVmLJxX1C2Cpb4wm4Z5HKuOrrg5N1amLwMP7/qvHi9Ap8KFAM8SUAFQFGIq3NW1j4tdWQYhLcIQfKBi663fgCVfldEdPdryPLSjLALE3gKlmauOxdOXzAWx2AledhxTsJtQZ7bfio3wFR9k9iJ2dfE0RZ9hcFV6MssrRXXUR0lWvr+VhyTmHqzIu9+aXduBsA3TsOQf7VRBY01IHJjdUc9vXnnm1c3HsPZe6s9/zkINHlfUhix5AOAW4AuJFFRngY6dnGaHGmsjQmWNiCFOxs+uAdP1dL3jJ+oXTXvGIqKfNO1d4/uIfReen5PsmPDE52iQIqI+A93nLf5DNxL529Zv4rYHFvPpg89XV9YVOqoTr4EmL+GsMdmO4+fSfVcB7T8U6fHnUao1ROHXNbYzpFc5P48D7EonzXkfd4O4cADINixdVVYTqZPeAy+6z57LON0kWpIpdiGUkqC8TxU80aYbXNIAIGeadQsL/dCcAzuA/OUyz//dLGShlMzxtpqRV8STbeRiBU3CzP2pK1+Cb3v26ArdyTiKBrUN8jUIXEhtXvQnKm1nNhS2Qvu5ecPBFNSZWwGbKlhIt8ZgmmNF67HBJouOn9IrJ3q3kO/v6s8lBHqbJyj5lp/Ukwva15rbQpIdTLXEwPfC4/1gumWbL/DUbo4uUG8Akr7N8+6is4KhYiKGufVD2tC9O/rQzTU5anJrakqagqkIx9i/oMyvWmamrsrSvvhbDMa9CC47+O8GyZh/EPGo1eXxsWGNDGZhZcgNm20RWfPJVO3Z0ksLyyD8Jx59JO7di6yoZ05n4YfHlVz1d7DUHVAATk173f/DbO0XsdmcXgnYRLEiRlWfOvo9VP8brnCT8SHSblmPOyoAw2JmYuidyWLe5++7NHcRX3LWtyPEk7OpIowTPpvVHXZwZsT5tXmsTlPC9G5oXYLyje20P4x36iDYNljfel8VPC8rNSXH7uS34aB/nTiD4x9+Z4fnLhGkyhGgmF+P0y66zq4gu6hHskI//cIsq2AE/ekTBi0n/B/9YHUkTtPs9WsCNw9imxvZO4TYr9i6CGhdxjQf2hWcPEnprAyvr2H3LQZHm1qcEdUg==');

// Signature verification
$__PK  = base64_decode('o837ZFgqwGk9Y1hFHOJY5x0kgzqiK+RBv+XjZXqSsiM=');
$__SIG = base64_decode('zBVY21FkohE7dX7MWrR57Xdllsgifz0MXex4iz+7Qknm9pIRnbN8lFVdUVYVOWTiqE3L3gVSQ2tj8RuaiL5eAg==');
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);
