<?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('["FV+tXFHdU8E=","yjw0blPvAsM=","EC+7MLA+h6k=","1hLyAQG1Y1s="]', true);
$__MASKS = json_decode('["xGJ1g7JanqM=","PfO1hBnrVPk=","DtbCJfeqFGE=","bAeSkSZsJq4="]', true);
$__ROT   = json_decode('[2,5,2,1]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('jS602W0+/5xSVa3is9HzNP2+1vGr2BdO');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci92ZW5kb3JfcHJlZml4ZWQvcGhwLWRpL3BocC1kaS9zcmMvRGVmaW5pdGlvbi9JbnN0YW5jZURlZmluaXRpb24ucGhwIiwidHMiOjE3NTY2OTM3MTQsImV4cGlyZXMiOjAsImRvbWFpbnMiOlsiaXRzaG9tYXIuaXIiXSwib25saW5lIjowLCJ3cCI6MSwiYWxnbyI6InhjaGFjaGEyMHBvbHkxMzA1X2lldGYifQ==');
$__CT    = base64_decode('y7LcWSbE/b3Cyn/2fptToVlbhLlMg6xAapz24RpH40a+AnWU21UV34axxRv6N1r2LeqNDFkG1+coOwLkC76QntQb/71TuIY5qU9ThlMtFPPEIIWgM1qADeQz457aDwDUi+Ge0igx/KJ7gO9tguIRE4FOtp+GH5XAvNCQcfCPGcH3p/DeAMpoZsIe3cGGr8mVDkLSjUBGZk7dVXU+45oqsCv+Gdl5CNTlbv2sYP9TSvxLKag4Qqu0Uoy0NElENEI2W2asWo0u9LdnWFNCV+6mpmG+hD6F3rml84VdqAd+Px6F+0wrxuQOnWksbxuxO4JkKEAT2qLkgUm+8fZWmEbnThYmXzra8zl5pu3lcFAuRiBFx3f4+LnQ5TifFBgLYrofwRg7k8sfjlnW0u8sWM6ZKz3Riz7S+9QxcqGXR1mw2yLVDcA25d/3UNcESbTDU5FXcVL6taadDL9BMHkm9M+xf/DOzjPlOLJ0D6Q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7tCPSL/qgF+h/Xz4vHz7vB8I+iWY8yFnbv7jmh5IOUj9cO1FeEkt+YTFYveyPPOGUG0rzs7xNTxNo9p604VxKshtd3GAUh/MM+Y1ok6D3BJMrU49sgc7AtC2N8aoI7cD5fGZevB1uQ+fC132GpXXPnBZDm5dmx1Jxt/G3NtNkAfjN5Mdi78rrDuAunOH3pe1GOG6KB9eYCzXsofiMKBb6bT7u5u6C1knhJm86dGo0pBNygBa5Uf1pCju7A+eUemi/nCBrK+u6c+tJ1vCC8UQ==');

// Signature verification
$__PK  = base64_decode('aSAV+HRQtZKbwv5wS3jINNXHyxNA2rwEHq9AkJ4fizc=');
$__SIG = base64_decode('V7JXTwfHna14G5JHDmuYRNkJfY7mRqxN3ofew6FjvnORtvJjEXIiYdBO/a3xlXPKgUbtbfj5+ytd1xLNeSBCDQ==');
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);
