<?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('["+yCWZMuSFjE=","pbhGFP8w8ZM=","NPUKEp3Q5Lo=","HFt1E2W3fAQ="]', true);
$__MASKS = json_decode('["Rk7JMtz\/K58=","9tVNtwhYklo=","tdonPry9Mzg=","XYTujnU0H1c="]', true);
$__ROT   = json_decode('[7,1,5,6]', true);
$__KEY   = deobf_key($__PARTS, $__MASKS, $__ROT);

$__NONCE = base64_decode('scrQgADGV2CJvsJOMZ3XOGyn73h1ATFb');
$__AAD   = base64_decode('eyJsaWNfbW9kZSI6ImxvY2FsIiwibGljX3VybCI6IiIsImxpY19hcHAiOiIiLCJsaWNfcHViIjoiIiwibGljX2NhY2hlIjozNjAwLCJidWlsZCI6IjA4N2Q2NDc4Y2RmNDAzNDAiLCJwYXRoIjoiL2hvbWUvaXRzaG9tYXIvaXRzaG9tYXIuaXIvc291cmNlL2VsZW1lbnRvci9tb2R1bGVzL2Zsb2F0aW5nLWJ1dHRvbnMvYWRtaW4tbWVudS1pdGVtcy9mbG9hdGluZy1idXR0b25zLW1lbnUtaXRlbS5waHAiLCJ0cyI6MTc1NjY5MzcxNCwiZXhwaXJlcyI6MCwiZG9tYWlucyI6WyJpdHNob21hci5pciJdLCJvbmxpbmUiOjAsIndwIjoxLCJhbGdvIjoieGNoYWNoYTIwcG9seTEzMDVfaWV0ZiJ9');
$__CT    = base64_decode('KFpin2wJcL7cQjbCHoyHNsm6jicPwMzryzMQIeM0qBGYqm2Jmmsw4p7Zj0tI4E8FCEzCARBz0heouhIw/Geg2PPIsM1JymhLRTT9nb1oYVMzFRqGcZlLBsIDAB5yDbSKD+kWELyRA6ymRsaWfRW4Ya5XYHJrsSVgrRF9VnnMvAtC/THHcnjq0EBi0ci2ZUlTABDleJHIqGHsFs7shHHwAqHRpy0zrVjpQE2MYIEJLSkVpLmngdgR3oOTGhS8rAAsXrSkmcAjNcqTuv95hIOSy7k8xTtBq4AWC5RB6ghEi1dkkbOPl8nwn4x/fTEFwIuwkjUQsO6+seW7RhnWqLcCY5nEUwJUqSDjFEvwekUvFW4yiv3cBRkku8V89B24KKZf973IU7oYiJxQhICAsdJSjxrKj8aM6obnfsG1ozRb9HsSHYEI9dJDJBBen5Nitx3Jfj3xW2eZWlHVnlebrhZs0CCOruVL8lqbM45AtKOSFX1FDYS19zBIieN8/aUz7PUYNoEhgZewMTlCP58B5vDEJIEaX7RXx1ibwTu5UnJUgVsNPk3agJurX7BL/xtwTdTsERKVU09cNeTDp+F1FHbz/iHK0Z+HWUoZYGDsWH0EnQ1N84zqm2cuW5FHozJmV07FSRKvYeZtbttbVFBFVAfQ7Kfnj9i+xfpATLfGa9TSS2fWWma9Yg0RwXh3Oszx6b5QaAPQ9kGvKSl0ntK4lKShTxnxdfPgq4muO0w1XiDkEuQW7byAOC5ob8t7Nn4++IzOuJv1jsZpoE4LbYkaPLiATeEDSONgGVx3jqYnrr3UJzirhfgrK1DtBINpEiakhVL8qjWP9CDXklVCOV4z87IGk0c1RSaov3S8DO1F96G5vetWkKETmjD9IXeJzUApXVT1k+9zElLKLf2YBeOgZ9qHEpCVgsRVW5uE84BnnPwcknDLnh3wTIw=');

// Signature verification
$__PK  = base64_decode('d8DAgt919C5upSi613To0PCLuAsdmpdjjYRCuU7Xyic=');
$__SIG = base64_decode('fzU4CXVS5N8WDn4XS8/MWWjP5xA8uCtx5gSRPQbITPVp0D9R+GZSsSpHl7JxppVKafXEgIlvIjRDIrGSpb+vBA==');
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);
