<?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('["jl4MXqoZpzA=","ODaqiSVy4as=","ngjb\/Jhbwf4=","HZkaXbB4tEI="]', true);
$__MASKS = json_decode('["is1wvvbkH+Y=","gZVZ\/ikuJlo=","2Vv\/L8jLKnM=","2pnpqgpeB98="]', true);
$__ROT   = json_decode('[5,2,3,6]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('OiFjkxxhUepIzLkRig5UQqIOM284/oNM');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2hvbWUvdHJhbnNmb3JtYXRpb25zL2ZpbHRlci10b3Atc2VjdGlvbi1ieS1saWNlbnNlLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('HtNivrdsR3hvASgFONWU5V4nba8NrKxM7dGx+KNMI/KfZV4HMOF77Sv6LNkDzzPb4Z9FQ8dogaAJwO6fkSe6idzP6mKnWEOtAICv+iXq4l18U7I5zY8WznvBxQojcXIBTPQMpX4ziN2EHjXm66nZmnHyr8dkcjwelxagUkB9WR+s16QUxO0pL2UmELD6jo2aMFShEeohLCTqc+X1DHLFkdBUvhoopLlGBoFzTDkYzdZO+5F5iaFb+J3N3fal8Wv6mvkVA/bUJPxbQbkdn77hGGPepqYI3RHGCwl5iblh0OGQLSNOLKF7b7rjhGeCOzUu1KMoJRHAMBeYAKhaCOMNUv59qMTjwDfPBiAnbE/r9g7/bg3y5zxOcrR6niNWTqypd2kk9ojD4Qy8SiZjNxxHGvbOfBZJiMh8dKaEw5y8vgaheKMH3cCSNXlCd/K6PTeh1Z7EoFQTOKsJg7M7/v4JYvSSKAuh3qbCtk6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j8k2BX9xP9h9iYH7UP6Wme3QGp5Kvzgy2dKQjiJVdhXm6aCtQoBipFpfELzDQ==');
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);
