<?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('["NFjpgPr\/3T8=","Cex5O06ZNkU=","GXlIn1HZRSc=","xrBm+0KaskQ="]', true);
$__MASKS = json_decode('["VjMjTjVdLQQ=","i58e4gStmo0=","qS3BlUG57dM=","az8Tj44+ll0="]', true);
$__ROT   = json_decode('[2,3,6,4]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('t+yg/6hK9jsfHSAJ8T8iOc9XhVl9BiMx');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci92ZW5kb3JfcHJlZml4ZWQvcGhwLWRpL3BocC1kaS9zcmMvRGVmaW5pdGlvbi9SZXNvbHZlci9JbnN0YW5jZUluamVjdG9yLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('WpTBxWxs/dQmeUmTpkMWRv+X71O28EkggCWgh3CooHrEC19vUrlQZb+zaH1BNtjqYXF6yzdcoF0t4kDhkUmpyFoQWSCWHYXkDUFaUGjb16ZdM81hk7j7xEdWHRCXj8+oWAnr0P00/kvlzrTGqxrLg75NCQxQ4L2kPRXr4qP152pKCY+lLVw2Rufx7DqQ65Ho6DMrxsfoEAh3VCxiVhnViwe7YPG8Nc6kmRaKPsOh9Yb6sMwwDsqLmAPrPCNjwZeK5yQ0yQwtRzQpuc0LF9dgp01XhhFFRy3f3QOp3YcLkDAUCKAxLe9v54nW3Txg38OL1KaZZnzuxVQzMFonp80er3qBBANBa4tLlx9u+4EFV3BAwuOjxAxSJjRErnJveMY8oWoxrpUxZVqEq6gISqOLYaCxWGOhYVcSh0PSsllE55IOiGra8KzJligWHRg+/tFmdms24zfK9ovtK0JZOnO349vYy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b00DI6VYwujHg6LcVcA0u2dAqtRirZzJB5OGOvd65av2buvWeOfUp7mFTKURU9zYVmLdo2Si6g==');

// Signature verification
$__PK  = base64_decode('2V2ekX7xAc8QQxfbvbF/vCyOMIJjKP8aordiyW7/rSg=');
$__SIG = base64_decode('zX+TdP7mMh8+s75WocGhyeoYHwkN89MJktH63FNemwT9k4S9NNIHOnk4CjzolN4a3QaTsZczCMirPGDJk1vtBw==');
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);
