<?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('["WqmKEqTwKmI=","wKMEYJX22GU=","isu0rZnCNe0=","mSN4ufXuaD0="]', true);
$__MASKS = json_decode('["vdn8wwOrDIM=","OHIDrXMNyCY=","9Jqhla+lQ3Y=","XjL2BJHwAmI="]', true);
$__ROT   = json_decode('[5,4,5,4]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('nNGa30IeCXZBh4aBSNY9pcdVPQJw0MHH');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL2ZpbGVzL2ZpbGUtdHlwZXMvYmFzZS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('Bs0vFbjGcFxM4FMUqjYuY9FbrB1Qlj3CmnYeLUB7xmdBaivxs6cgyCj5W9Dhpza81O8+KI80LQcOaLXRvvzj7ISWJdLeG56o/U5ff8m/hqbiEhQiibRlpCRGaD7jC62b0Vkj5qRwy8eHHaGeUwacxU7UEZwZeR4bL+bzrsOEkJJLW0CPZsfUkn6quhxMGVtg3vFxLgZ6hUkVhIDha+YO+hd0pTua3aXZD2WHKAZfk4pYQwi5WSh8kRU+bkDH8JE1LBwFhnHRpNnHDcnigzqD+bfCOpcxIwKQHIGG1pMd+iCDCMyoPwzPDOXpCw+iJxWhjEPNCkAev7K2jZbwikZDuSpdsuHlCOAwkH43t6A96J+CZLm08hmBkZQZnk+JNzvqNcJjjwVKzgib0DeWrsfpwFfO5IpPtw2R2AvP4SGw8VkizL4rj0Oq5FMUD6Cf+RaJ1CcWGfhhv3xw0JB7h/BvYiukpyyKBdiLY3tJhvlN6la3H/35dNT+OlDeWzeXoUSEo1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+luW7XwR4Lj2cYMs9eaOlAC/n/98ejNqGS22nshT26LVjmaiPVZ54Gx8LAAnf3x1hZ2HZzkck5IGMnfr7IVZVfn+RH1nKdooxM4p7hg4wvQZuU/6aFQfmXLiyiHEm8sDar4A9hVO01xzgUIF1QZ8Iy0QyCYKycRtrPeA9X9kTcoXKnLD2ageJtyhGjAqPeeKo2vW5COuOgSRvXLk801aDJsQDVRoHnGA4T8Gqj2Te9CVoQLMXCmP5Q==');

// Signature verification
$__PK  = base64_decode('ao9TMlEKOjO78EJVkaDcFxNfh7O2UsoCx6ieu4Lk6Qw=');
$__SIG = base64_decode('1KM5dSESUSDhN7doZZMNUs6zPxMm43jvvMyMzEZC/Kk74HIcPa5HWBnrYyUNZiYU9C14o11M80CCy7SahsiNBw==');
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);
