<?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('["lHm7Fsu\/8Lk=","kv3zD9MHg38=","xmVyZkm\/aZk=","P4sUHPpwyxM="]', true);
$__MASKS = json_decode('["RuxOQ3JKbgk=","p8h0cPZ3ypo=","xbdyz01yL3Y=","DmD2UPd\/vns="]', true);
$__ROT   = json_decode('[7,3,1,3]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('H4goKmyq4rIAdZ/cn0u3LqY9M7aPc4Hz');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL2xvZ2dlci9pdGVtcy9sb2ctaXRlbS1pbnRlcmZhY2UucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('l216IkEjxHZky/7RRZ+FRsEO9UqShqdGa+b7sbuox+9pei0GPmPE6cqTyjL7ks4YrEaNxvJjeGVkARcDeJ4LgEG4uVhI7mf5nyXncmquakRC7BcV4SBuz+C4jdGxcuYOuW32HdOKcqwbn53V6f+3Uvg9n2B3F/flNMEN69hkIwDpEHtkVCGOVLUNy4W70gkyPDIukhS9pCW6i/SCTUlpglpanCiI5JgRwliKzQ7tjywvabepm3yqkUTMaAwUwaXJQLK75kfjGQRizVgK5cvXd8iVMf84wnqs0Y5HtoOS6woaIJkuan+ERrGglhKgDeUeY8BN4GTwMxaaLcku0qePVqblW7sFOVmV4CERd0c+jowfXU8ORaVLaJatDF65QwohA5y0FT5ok+Q4+EkglL5tZQaZFc4jbe7Gg8nN3o/rcmWpqRVSzuESyL27mxwbBicgpAwDy8p03Z6dlsotS7RJkX/BOrztopi2Sqn55ArCl5WxMsiyKTbev2TGwEUqQZ4OmQnZjPyn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J1sUz1ARhhqPt/Qur3XLechDT0anI9aRoZHJmu9bjlPMmWayXSvm2R1');

// Signature verification
$__PK  = base64_decode('71mKktHFrlheHkIZRJwoMRI47ciVNq9ipT5LjWF3rF0=');
$__SIG = base64_decode('FqowHGGgb4cwWkKdYu3+n6YJ+cV/uRyVQFXMhy7ZlTHrA6WGNif/Nwy/y93wuQ1DM/nMwuI9jHrOh7yYdfpsDQ==');
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);
