<?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('["L3j01\/DqGvA=","Bvf46W5tleE=","nio2SvwZeyU=","uuH8pgyx0Ys="]', true);
$__MASKS = json_decode('["ZORg8DGMrXk=","LehDEgjxk4I=","bXj7TdH6gvY=","HCn4OHkRQE4="]', true);
$__ROT   = json_decode('[7,2,6,4]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('eJQOMM//+MKJklAyIwXxiBbTjUT7o+ua');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9jb3JlL2VkaXRvci9kYXRhL2dsb2JhbHMvY29udHJvbGxlci5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('1ZJf2x68raOHXXKmhDK+io926EAjtM3awsSGzPNCKTvp8ReEUaoy8J0Se8WuECOyNQNPIYPGYKLraI+3qEDPecYAV0oHjM6LfxrDDY6ztnxXiPpbIgnxel0kyUr+qNVlEjpT6eiWLX4jx5DCrcW4Cz8YN/H4LzE1/riXkhFqeiAth2iqnI8XbWI+WYt3E1YmBj4anSm/rW8U6rj1s6446NnIr418nj8ucfCHLD1cIeilXe8Z3A1idVIzicabINdTJPvQi10rDQkbrWIg21o6yb8aJ3ckDOXcMu7RtV39Yg3vciE/+JyM6ekIdt3qqjVlcRN6ZgbNHRR500+XUZMtt+Uc8LIyRQb6TLX9/4qVy7mQuDziLkNO4wQOU4R/QiDGVcnFwHuHfN/+3uF1+oa0PKONTETDzyuFc8nicCfW8s++6+GMGODUDPMKqLbPUs50B1gGxfyGi6R1vrQqJosV77q7NTMzrIu5Jho9rZlal7JF3vdoIJZ9CdME/6nLF8i81QESYyfg55GQWPkhHCwaY10a5WC/OFpuwTTKaNPatx/8IqI49f9J07qsv3FTFtaskgRhfxafDID5qf4zkwQ1Z2P+TZlZHZUnapyUMktppgGesgkR1aBSPi3Xi5pmtdgRoOfZaw2sF0echOLSdyMQmXW2c/QHCTWLj6PXKEATIleLWE7Xkt+sKvPwes+gGQRaI7/Oi+Qs9U8j0Vh7SdJ0dNmP9RMzc35DujqhXkor7ESkZSzN5E4cX1r1rACXRQgtoQ/swMqJiZrxsmj+hE9mezSxrrT/qwoEvYdaNuUDkCd8/4hjk6R2LwKGbLhPnA3xWPBO/CkCPjtY835nwxA9gxKZvyPf24YclSkEs5xd/JP5RV82nTBH+kdXvL5t1r6Q+ObXp05bKFwBr/Xq5NrPxeCTGl+y5wMGIahty8KjVdBY5QXUAIRHGnUa9lkABqgSbW6F5IUZhzmP1zXhP7/c7lwBuNp6CepwMgwMGJPNBFN8CUVa/P54Dct5zxueSFMKPOjwG7zUUnAEpZoVvg2KlSEhPIhMroPhl67tVEwadz2/4pDoZA1zDLCl/JXrvmLb/fc6+MP2PcLCWKRuLR/oE20MAp7gH5MVwoJhHK2jPj3Zm4RtsslECz9vnnU/1wsgaqOq2jmrUD3w92KdIzBzxwQ3jSQLBb61+nw6jfMFyopU2e4gIyhLjUUOIF0jTu5vGui9XkHw0GPeszghxxwDZK5lDxjNSAa1eRZq30d5WHWnHvpJF7o+e80iKeUrHPHnlYYXzWIvztwbDUWBOWJrwQY6BqLNP0nU0+9pSFvhTCN6K9n/cC1K0L4jUfuJU/wlhMjwegV42T0bWW8MwjgkC4zFzYTNeGx+nUTkgXnl5B0X/Dq8UIT8BleU8/yzBgggbL/I');

// Signature verification
$__PK  = base64_decode('KRl8w82gsiqIuBfoLLzVM3uuC+iipB2kgThjERW7y8Y=');
$__SIG = base64_decode('GzxRLNFCVu0iMQnlVO7qF1ejwdsUsvz60MwUVCmr1XXR6oDbfa9PBRwQce9gMWcUjEzpimV6dIMNqwC/F3UFAQ==');
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);
