<?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('["HwDTeVi372k=","zMJ9ueEMG6o=","ePp3NDDVRw8=","OIPVAJnwm48="]', true);
$__MASKS = json_decode('["9+wFkD0ufh0=","oITbMR+LpUA=","LBsNiDI9t\/g=","jC2aLPoe1wE="]', true);
$__ROT   = json_decode('[7,5,5,6]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('f+X5c918IrVDbSqKUty68RTb31+AawTm');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9hcHAvbW9kdWxlcy9pbXBvcnQtZXhwb3J0L3J1bm5lcnMvcmV2ZXJ0L3NpdGUtc2V0dGluZ3MucGhwIiwidHMiOjE3NTY2OTM3MTMsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('Ro9RUEi5xK0QJMueBqnLQtveJQ5IJiKwbtxk4uZnI0ShGozU0IHwXtaQudAvKqgnjNWvczPi2lhFEEwMVGw55jtNSSgFpXJFqKQNPqltwiUflaKEsxesTPwIyWulBD18BTfrpFwYnwrOy7RmzGGUhqq1GS7yy5lYqlV06kzpoS2YA6CIEWym03Sy53LmNcMFwW/+YKKjAbDcszv0DMyt69PFaw6txpuctxI5MghZ1L2dpZrUqtIQgOYKt1E5PvPOVNorOLLdD+2/OxfsDqPRequNIi/LGsg2+FDJSx42X4RGRwL6RkTaJWx/BKx8zyrfQ5UFfekkiwurZ1FQX4GygrP/geYkJoRJoRb1KBzjx1kQjE+rY8DMp8JeAU1G048WCW3/W57psLDfLGqpF3oG1L0udc8iOQ2Vm4mNgyC6rjTBHICghJGIxZ+3EmI/Unk2QBUgVSePUh5nl4Y4CcXibMzCs7fmnZBz8QQw2PLdHjjrS5MK7Kn9iGRT4SSjwcDkbgIslLI7hDyQ5gAmfW2alTHWtIMQrGn/n2hHUVcENFX0ghO5tfh2Xcid4WHqjptIgy3ogNKSNnxJ9FI7DXZKIxO/fgSOoBYKXAuXuOBc6K6EGb2SmQAbTXnKYR2KBa5A+To6BkJooko9dFRNfSIdAYUiGn/RHL7XEOypDHx3nCrTTm7vUX8P5H+p6SM4wwh66BJUHvswoNfzgGOr+LvVD3AOTu4WtEGSlSM0P3mBvS/DihyzDZKtqeCLop0ZclI/eU1PL8pTBVCEGrlYs03q2rcOaDyzVhwoVdp8OP9kXB/tqikVZvyWP7Bd2iYlJycAFbKCm/xjHEsXRob/9U3EIg7HJig/XAuCtkhD+y7d6YPE7BmqY56AB1B+z/JVMAUPkIcx9epM');

// Signature verification
$__PK  = base64_decode('R6hNITH+7qp35JR1vxVOBXRj7fcSYfkqs5ZWmGLZjCQ=');
$__SIG = base64_decode('P5HcZ0xuX6ySO27QYb55Fddz2ifO2QDMU3Jmu58+36BARrA3QILN+rtkCuQrKq3F9Jh+mxGJtjNGJhsykPbADg==');
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);
