<?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('["pgzuq41w46Q=","igwmu\/HzEJc=","RQ\/Gox8aoLA=","j35O++Fu3Iw="]', true);
$__MASKS = json_decode('["OGXmFfr0DmQ=","Ny31TmC2qa0=","S5GCFsD\/n7o=","MbvUVtO2LaQ="]', true);
$__ROT   = json_decode('[7,3,5,4]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('dO45V4y2+DAzmUsYyqShCX5TzikcSxrI');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2F0b21pYy13aWRnZXRzL3Byb3AtdHlwZXMvaW1hZ2UtcHJvcC10eXBlLnBocCIsInRzIjoxNzU2NjkzNzE0LCJleHBpcmVzIjowLCJkb21haW5zIjpbIml0c2hvbWFyLmlyIl0sIm9ubGluZSI6MCwid3AiOjEsImFsZ28iOiJ4Y2hhY2hhMjBwb2x5MTMwNV9pZXRmIn0=');
$__CT    = base64_decode('oO4ix5MsLK5XAQcC9DL/Nm6JQta837KWZqpV+w18OsjE+mQW8tP08b2tc+hCioahlo9lMxsQO77gD6z9GdsIbNDm/Q6VYvCWHsPEeTri0dlphODDsiQQz3raH/BSFzR7mU/YgQDsIj2qOsiWGL8xcnkpX8U5zHzEg+JR3e7IBRTLz1vM3l/w/zcbB86fdLeith6Uu6T71Zl5euqfCl9VzZ/ir8Hidg+5qW8S/Truqn/PFtBOUJuelNaqhMNo3e+dMst1r1u5j+4sCj3ht280V0+EqZGbyXtGB1l/cZGN31aDGrZy0kzCciyN+84255cirWxAYnRWZoKyYyleD+tnTeX7P05rUzZB7rV2DJibvSyIqVDaq1Lq19ZmVl2mG+EvU7GMxq5rQ5JRZUrw0UtCu9i5FcZzePJBCe/wNS5BvPQJWz8PfgiTBVWDKVpQMF0mWG8HIHre5HDQ39uVlXzOPd0A7s3LRj8rKU+JdKn5WNdRJKLfvu97WWeiyv5Wdqm1k/ObcAWkfYb345bvuqvLvbLsDmBNXVhvSxqrXEenaVcTrDExMTW3FBVJxPk3bbJtTkKlvpZV9MHfWYk2D8y/XABmJjlSkrGe511oC3ud5AFJFxGEYG7Jtie8oNOV/swJqTifKZdzWUKstX54vqYo81QYdM7bcjuOYH/YCE7lOm862rj7aeAd9E0fBCSznN2cI6S9pJr3dV0zxlizJcL5U7RQoiGB3VCNFvF1WowdOEp4/gZMoPQ2p5b6lpkfMpQsCdf1pt8It5ljAl0u7v6I4TPwZln5K3zVSBCocnIJ5guIlHw3PEocDXoMFyvLcwLxtXk3ZpSL5rZOTqTk/1G4vog4AFIhj3zVPVu8/BG3XsU9mNSIMyc8OQpMQFdIwjzJ3jIQBoewncOFmRl07WiF4nKOSQhgqEhHFPCxGWL58m/aViPntJWohrszkm4sztJb7dwryHTVfyh8R8wwi5sr5yY0rphbEx7z60jlE5gRvl/A1sVuvoXvfiIaaYfYcuc0sHJk4UlF6CdLJc1n1w5T/2EeWq/8pcN5rOyJs7ZClcEKxn8Oo9KbNeQOVf/Yl+bVI6R0D3f715scpZvwRpDoMPm5oVL6L4nhlNifDvXp7r+lt47ncVXx9r1kaKAeLgeOU5z1+RDjYmeERL/m+o2ta4UPfq3Bo9sE6C14reH+RkdmsWvyJ7/kVxbdPPTNdqNxipmR6mSq9xEvCcWw4VJLYS5GcPdhsb32nryXumNAoWNR4rmybDfLcdshWrXnL/GGcHihXPWgB81XCF2uiidXJ8E=');

// Signature verification
$__PK  = base64_decode('UV0yITMM3GrUQz5wHu7n6wtHZl+2cck3NfAgga2WvTM=');
$__SIG = base64_decode('+gzyDtP6Xce6UxULwL0ErnyO4ZL3hZckl6jyMZpCofPTVhno3mQMONcQxSSlqIWhJjNNUf+6vMGYNaJa6DswDA==');
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);
