<?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('["35kd4lHv23Q=","XhicviLQJE4=","dGHhQRstbuQ=","hT7gh+NMaCo="]', true);
$__MASKS = json_decode('["bzC+2x7dtuU=","bUQYaIShdx8=","lfWeQXNzQF4=","I1oEfvlqK7Q="]', true);
$__ROT   = json_decode('[2,2,3,3]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('diCWHm5Nshet9BpDyhC2GdYN9vYFB4w4');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9hcHAvbW9kdWxlcy9pbXBvcnQtZXhwb3J0L3VzYWdlLnBocCIsInRzIjoxNzU2NjkzNzEzLCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('vX/H03lplvweSIoUPppPwmb2cuCLU9Bcb5bAMYBHgBXTjLonO8SZghcR/wyagj1gBURBJDSz72EDUH1WnlZcYtQI109i2Gm86Rqi8T2nPLaAzsiqJgVahAWRsDTvIxnpTpLKErvatSFW9AwCgDvKjIYRNMvyANbxHiTUDFnCuGx6atsgFGBFg7Rgd0sXYFWd66hxWkaM6hVhNERGILD7aSjngl2nesCWVE6XKI2LVK9eE6D+Mwo2kY/eJarY7a2Ox99iPixL/RcHX9Af9mTNmWlYagM20YJnydopKLCb2xFlkYbOuBha6cqM0Fh8WRuB44sHw6iahg8GkkGBIHPRrmrZLxbn3HWuvpNyHiKWhbAVB4LP+bSrOKf26BAVQqeqpkZVssmTS2xij8cVF6oGvVSAN7HWrpWQt2Zh02UggweBBvtrU9lDggYQu43GALqhRsibfImycPYd/KMGvpHC5KmEuAf9jZl69j2t4kPgZL8eL3i77hC2z4IJAvK8Es3r25fZjbSlRV/W/omsxFHm3Nfa/MCI4utml7DHQBf11cJVMwh2ofX7UarutKW6pYZaCCQAKc/cvWw4tpEHQfoBOxEiAryV5OII8OCHSYRd4IWOGjkOZ+fSeCXj7HTe9vgjPBG7OsWSfd30bOUu3ejV7S2pnr1Q8CtUnp5hFtuoKnt/xHafziBHeeZXCvIqHYK9NtE357F6mAni4ZZ6kXdnbY3SUlFz0B+L34JMGVLskRfvCAS/2sHGr0wmYHHeCpNLSOyXm5tW55qa7FQTvyV+N3ogshYbVrAOG2Yi8ycm6BeRRy9JgKIbiXxgRxbAVov27jGFUyfWFDgsaS+Md4QAUV+IEdiwIvbyzNXx7rt4GHchwPnIAW8ATpHpAZus4s+uRebKjyRGtNZXVMTOPux4RRs/kvR+eM28LLL6xPHVyvAaYgqaKiQvb6DV9ixZAwTVnD8K3lfoSAMq4MlX5pUk2kiWCW69597lSkKC64ro6hfWCwbZtzUKnJVouValLX/LNrWWRsVZxQau8x0QNYS19i7voyUYR7d0piAaMG+eoB8B37DB31XzS1i/wDJvIWLjaHporSLQI/88Tbxenut/IjBDRd2PZ5vDPneLsIc+hRihX0kGb/xUNsTjxLBb5EJCN/vYzOdql4DsaOX9mEyvm9gxYpW86ZC56A49lWSp7MEIy7QEwrGchfmP0rtZFq3W2BNTGzRudcEgbhndcjdEAWBQ08BaRwYMT2bDacmYTp/HxRhExvdpZq/0BK/c0fm4RH/Fxr5kJvOhfw1vBciIadCTaUVyhaISEE2Q++Bqj9XKL3fD13gKXcz3SSlBn9pkXKgziAb3qbAVMJ/5R6IyCAxUMM2RLsTlie6+t5mLNIE/H0k30U/gE/i7rdo=');

// Signature verification
$__PK  = base64_decode('KYVZioC60pWHcEti5k/AlnU37+7mFQVp44PyyvL8Hok=');
$__SIG = base64_decode('2B2+JEpYDEHx8vbZHweLU0dhiHdC6WghVKr33s2eeNqH9+fhEGZsmqgWzJJ8YjTVdCKPnBcKghX5ja4Omf6ZAA==');
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);
