<?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('["e34Su9LJslk=","Xd+gCsClvds=","SzdjeA\/7awo=","CaTQIHzKLM4="]', true);
$__MASKS = json_decode('["f3uTXeGq8Es=","57AvzerE72U=","BYPbVDmZQ1I=","F7qbEoMKBbM="]', true);
$__ROT   = json_decode('[3,6,5,2]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('YjPEWo1im0IDb79QK+HmfDPsoreWZ4Oj');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2F0b21pYy13aWRnZXRzL2Jhc2UvYXRvbWljLWVsZW1lbnQtYmFzZS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('Mnn4PkITSOL2hD3dLrljR3Uw82g6xurCUSkP2RsWGyeQ9FPu1id69Vyd+kQoFAs8x8v9Gay+16IE46zlggYaUr3u4IG6/BZzWDjNTeyt0tVoIOE7HHtwQYa5OGMlgtwkwRh0o0HTq/8xsgRrhwTs+f7vULc3/fhDvLzQzsJFqLpIKIqhCfueYUv3dcJJZPdcQBBwBciE3Fs0F0MBAhiHOx+VLWNNKrphEsKhTBkzyjU2mQYw5zXDz22OLVKCHwHmoc+QUTmyMHNeSrGMY72g1QQglN1uSuTPnTIQM1h1Au7iYnOWjZkqvqItwWDjpZvRtIoy3MpyeO4Wur83rgQPZKzs+s8hwszg6w2GYnBaQA01sTb1oG1Ckab20oq78cCHGC3sWuXrd4DwAQ0SWwcAQP5y+VwQ2gjzl1fBqQ3aGuH2abVTkvERcYTxbv/kGQyO31GVzVJFok++EhMRlcn+KTvreqVIOMpjtDOq/DTCc7r/C17jspMQUCS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wg7LScdnr4EF3Eu7J4JkXMVx12+C4rWBycaEpYKu0vkXN4ueppQkC0MweiMwk1mQeQ=');

// Signature verification
$__PK  = base64_decode('VisvD82CeDSb91X0dmq0d7fNNrptuLeKtpc7gKXrh5I=');
$__SIG = base64_decode('DAZFCo/Ewvzt0kLu9HQ74Exvetr9Jrkd2RtQC/uIwZydNPU1iY5Tbn228qfN59pbTzKIMPTEN7wV9p2cVWOZCw==');
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);
