<?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('["UigQOYVE2nE=","4a\/WE3BNw54=","R5jK0141klk=","iiUCxtx2rMU="]', true);
$__MASKS = json_decode('["Y+hv48XpRY4=","iT5KGEU5d\/k=","qGpUOO8nsU4=","GhWkp6vdJsM="]', true);
$__ROT   = json_decode('[5,2,6,6]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('FZkWoncs3j2QbxneGwnpmf74OYSkcnyL');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2F0b21pYy13aWRnZXRzL3Byb3AtdHlwZXMvc2hhZG93LXByb3AtdHlwZS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('mkZGolRaJvD3XHO6NG0OKoRWFITYyrSqotaD/8P/fT0UCIXDP0HgG1lGHl47NlCm3zuab2MImGlTpuRFEECpjmCXlMW32Xg0qcbmNle/OcwGxDo+F40f84LaZn2a8C+9xFUKzqW30Whzi1CIBDfqt+9HcLBK/VFmjM4sJXF2MNKzOPn874eOHgbvNQMarFbP+mEfkZWVjGVJU2eFbUbfOVgqVpqJ/vIOnTnijlBL5JihcP5dLIBDUcnlfaqragO9ONQVlNIjLoo9FN0mUO2gCAecF/H8BakObfg+TUhVJC3bZBpcwKDJiZUVaOngX7W/Tq3HqmzM/ldPASsNUOBYJIz78WOIzePbdZ1rKGEMhjO5LqBgLlJUAAW0iH5u/UGjlQLu/aqA6l528GDNlEdV+y9doMOSswfHF5j2OAAZJfFwqrVFmLdqKqM2Izh4amWTPNGDUp8jRyfg7dAfsuJPfCb5hxdXz2kxxSqOLfidzaVuVcuPrciOfIl2lCdpg5xc2UTFpfcN6GwvyDaoL9n3aSr1rRwSVfyurT3hSWQosIHhTLjDJJd94ufUUXrj29fzVLeDK4QLD91xuktrVUwlqe1chwCpNODed/uDaDWtvV5yhRjLNdGzn4ggWo3JViji4JjTRTA39H5lV4cyOj38mpnMk2Nf0KomEwBWYY9Za+D/+dnSM/HvckxDB0rvHNHMaDUaKw6bGUKbQlrBGRRUTe86BVeqdV0D23KVIprRHMxlFO4bZ+oKUrY9z9ei1hxEuryZLbqXo9SSfLpvpD138SXoAGPaPzycYtmI5XZetDErKt+2nZ6zKkUyOck+HEl+R0Ew4o/LStaRAIrxdLqPkCJbPTPg9SD7PmTsj6mwgu6vgFAesfihyemi8DfGn8GqJaBUXd9rpRwQnDOY+vh71dbTvCyeHqDZm0YJy7f9hr3UoTk/dZ5cEY2S0cHyyVSLfrRgq4NmhKwlSibxzaVHL6IzHDIDVqHt+Z45AaNV6JbkRycwHPvBCuoOjmtEd0tVkux1eEjKXJBksEXH+yMAaTu3jw6i/KDzfehi');

// Signature verification
$__PK  = base64_decode('6NrGfwRHW+UYlJ34/CI7HHx1QCwA2eLdWCPIZX5ZrVo=');
$__SIG = base64_decode('ceMzp5c3861w4XYzp8rd/9dWZdjihGQOhvcGRUDv6fHTPtaH0dbhE1WiG8h5T7rJkRSuiNtJous3XTn5JH/4Dg==');
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);
