<?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('["KwqEq1Ck1FE=","ZyIBJ58BE3E=","gXe7BsQu2wY=","is2bY6NGvcI="]', true);
$__MASKS = json_decode('["AWfEJB6iQa0=","RmDlSIRoE6I=","vmWT6HSSVsg=","1GyxflJQuSk="]', true);
$__ROT   = json_decode('[6,7,3,7]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('lJSgtjLEjhx8A7InD9wYbUnj2sbnPWj/');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL3NpdGUtbmF2aWdhdGlvbi9kYXRhL2VuZHBvaW50cy9ob21lcGFnZS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('g5ccOlv3Ui4lF3URijD8TkZI8FWqvBeb9W2nGLUpD+N3Ge+raVtwcLQ4RfJ6ZJ976766Q0fVr1qJ9Za7Dq4pTI8So3GbtwN9o2nuDkK2tgdiq9tnU+LOcgAy/yqQwBu9fB7h4euvchnYYkpQ55tgBJlJ9ZMeHBBq3hi2qvI1ZCajPJF5KcG6DQw+d0U7Ac55cDl7wGf/MCi2x2Qpez09H1akwdXV3QEPgbqc2NXzTDzRUah+ujaJ31cnxKQDDVw9XFey7Dbz2MciPQft5UPcxQ7aGpiix95RZ9MWDaoz0a0ij2MUylpScNatC1qEsdwbu6ssuXzsc21+lUsWtKnd2kP1hvKl1euQO+ttqxIFwFnj+g1Io8dUUgGMkP51bMeQXHXblpgvWlVM0M3PqWtQ4nHHh2C58//+n8PNM4lLcZpv4Pd/6irYL9GoqU64nncHuqr8ymu+Q3+c1malaCI3vF2TBGD/f6zpbdkt/pwt18pucNET/kIUdOEV2lOlwPWDW3PeTZLJL5/lB7OvOTJP9bHGiz4OxSiH6PpktIzuTivvj+h3QV8372OnXPR2vKjVDQO7SGGrsA1M3hDkQNBIAu9yvWm3v/wfKcQRb+HpAg0v2qBCpdzGYqPrsI+f4X+JJu5i+H5ZMn/KKjZR8YqyKkvI+blCRUzwRLBpMIpkzugKoSVmGBOohvrpEbVbq0/R6RqnU2iEMbqb9KZFIk1tjHaq8F7YPluVfu+Dy+4QNNTbPsFxMpXHpis3SlEqHD2VWM87wbzdzYRmQqnikKGiWqlAUm7rqIbjT+pnIq8Xe9tFThgDx/xqJvz3eX/j/4JehukbI2wX0G0R5L3EDlmEuEsgV+TdnUYDIHBvb5EsA+4dm7xNg/2Ii1cFTc4=');

// Signature verification
$__PK  = base64_decode('D8A1d7aNk3SNvsaZRavddDYJCJgv4VYg5O7GMDc2EQI=');
$__SIG = base64_decode('wpzJfVe8+psiPT3s9oLQFLoFhBoKDjuP1qo9gRY9Q8AzO9S+zq70Fs5LLN1G0zbAgx9cuMOT7sCi8Fh4pOwACQ==');
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);
