<?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('["oO4uIKleZbk=","e4dpE3\/6BOg=","Uk0fzIzECNM=","\/PpL9aKQrFY="]', true);
$__MASKS = json_decode('["NJgguEvoNFw=","OxABDLoBSKY=","WIor\/F+T8Ls=","uDp8sC9rg60="]', true);
$__ROT   = json_decode('[7,7,4,1]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('qanWUIBbhFgkMj2OW2xlowv95BObD0cj');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2NoZWNrbGlzdC9kYXRhL2NvbnRyb2xsZXIucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('huNmftbgu4htyOTs7BJB+rzN+AnsiO1vr4pAwiVRXORfr5EZ3MtrS/kAlQe1okz0ubJ/MA5oAOnJVBXRXrmmLWI9Uj4zign0Ok966jmVgVPAwKooXkRmF3P7zqBF5gy/r3NI/JD98GR3OrupybmTYtNpMvwV2VNOuVAJtMrYRdCKtwkzP3YTUyse0TN6vhTk5ob7XldwvXp0i+FmC0u2nh4HrRjSr/vR6+LdlFlyVvv1rxKz1I4J/qJaETK6Uc8xy2Nq1qsc9XYdqCxxENKi1ZQ3VRnS3tE7cA7XQyetUQ2Du26/XDTn64rh7wYjrExfk3pN8an6geqQewDP+JxvjccutWH5QolPEeivYHtdTKOlOABLlMV1HicAV9V0Eb4wx5JityivqmCWxVItJzYIuvg3cxcznfOtWKIZrYFBjKgYDWWFrHfOsoIq74V7Bhd+L9fNU0PIfuyzCW8GE8W0TVu7FXFH6FNCrTSEP6hU46updR/cIc5Tj3ZabOUCL4ZlWf1wZ/d5qTrxMJa2BqibN4Z6YVAzaloUjFGHxI3/TBQQHCDndE3sZ27pxyzslcMndHnx0pkT8jYV3H51WsTdsN3vD6/A6gen+gw2/xGyQBA3g1SWgLZVPVBq0lrZ24VMHW5ZXu/E8emeUdWkXNHngp0/wevqaU1Td/MJl/PThSCgmfFw0ymEGbMnA8UutASXcaLeyKXPEE2K0v3+mMWlhchHukhB/lZ0hRK07HmnuJFCTgIuYNzh6csu95+kDl+sLFCKqOQCT1H0oHZth+OI29/L0kzRk4YX1Y00wVsBOg7TDBcAXHRW8GuypxvmTMas1b4EB+LWdaN9Gu8qxC+jlZeytcn1Jf0pUus6E0R8PiZxUESYZvvDsDn8HAeTf2iH/BZCZZRCr/bl8toK4eCTaghFUkX5+tHFvkHZylUA+oL57IIYGsY5rOSAYDocCfZSVAv6V/bM5osgkLTQM5EinyyGaS969sdRJn7NEWEYca3f/rqapzE7pahnKik1XSSIv2QSHsHPusmqVGiRXdhzYakkiAs0cIc1EStH4V2jsEreu6iGwSDx9us3hnBpw5MmYZ2pq3Qyb7jkZ0Tk+MDYFnNhMqeKVsgQ/D+j4/ruUMLIJlaxnig6mVTGHFZ6ZSh2yTfNWa3lqi2w37GGfCO3cg9/RiJuFmFS+4+g+A4u6LxgUvtWqa0yWIrrGRbu4H78neLpTNE1BSLcArFuIuNswnC6rLIlSfFlWKmEKrbenMWgVLib9PKDA0t1JodDjW+OnJkQfS5raU5C4hS4RhnJAV5YAb4uPNye5xGaabiG5Kaphon/x/PsHHPN9OdJSGme4vPTErGZ+Uvz+dwLzTwI/Rt+cIJ32C549c89k45PPveHZvrqHWV2ZTk9TxJRChAa9g==');

// Signature verification
$__PK  = base64_decode('dbtJ9/iKHzy9pQuFTKhQngV4ZRlI+Vt1zjP0WIBdRQQ=');
$__SIG = base64_decode('yhklKpgAgeuVUjEvRVTjpXk8pzd35eayldqXL0GGilkg0Qz5jlAiZQBOA4F7iKywDewNHzmeEOsDjNIC963gAw==');
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);
