#!/usr/bin/env node
/** Copyright (C) 2020-2026 Kedron Holdings LLC, All Rights Reserved. This file is part of Reactor.
 *  For info and license terms please see https://reactor.toggledbits.com/
 *  ------------------------------------------------------------------------------
*/
const a0_0x10dfea = a0_0xa13c;
(function (_0x2a2a43, _0xa1aacf) {
    const _0x2efb05 = a0_0xa13c, _0x4a9c2e = _0x2a2a43();
    while (!![]) {
        try {
            const _0x572c90 = parseInt(_0x2efb05(0x224)) / 0x1 + parseInt(_0x2efb05(0x1f4)) / 0x2 + -parseInt(_0x2efb05(0x264)) / 0x3 * (parseInt(_0x2efb05(0x219)) / 0x4) + -parseInt(_0x2efb05(0x25f)) / 0x5 + parseInt(_0x2efb05(0x1fe)) / 0x6 + -parseInt(_0x2efb05(0x1e7)) / 0x7 + -parseInt(_0x2efb05(0x1fb)) / 0x8 * (-parseInt(_0x2efb05(0x1ad)) / 0x9);
            if (_0x572c90 === _0xa1aacf)
                break;
            else
                _0x4a9c2e['push'](_0x4a9c2e['shift']());
        } catch (_0x428c62) {
            _0x4a9c2e['push'](_0x4a9c2e['shift']());
        }
    }
}(a0_0x2287, 0x7905c));
const version = 0x6608, BUILD_VERSION = 'latest-26120-11db5cb2', MIN_NODE_MAJOR = 0x12, NODE_VERSIONS = {
        0x12: { 'eol': 0x1968a005600 },
        0x14: { 'eol': 0x19de1b18200 },
        0x16: { 'eol': 0x1a53962ae00 },
        0x18: { 'eol': 0x1b049cc5600 }
    }, NODE_EOL_WARNING = 0x3c;
if (parseInt(process['versions'][a0_0x10dfea(0x235)][a0_0x10dfea(0x200)]('.')[0x0]) < MIN_NODE_MAJOR) {
    console[a0_0x10dfea(0x1ed)](a0_0x10dfea(0x22a), process[a0_0x10dfea(0x1c4)][a0_0x10dfea(0x235)], a0_0x10dfea(0x26a));
    throw new Error(a0_0x10dfea(0x1c3) + process[a0_0x10dfea(0x1c4)]['node']);
}
const path = require(a0_0x10dfea(0x250)), os = require('os'), fs = require('fs');
function make_dir(_0x2421f7) {
    const _0x31cf66 = a0_0x10dfea;
    if (!fs[_0x31cf66(0x1d4)](_0x2421f7))
        return fs['mkdirSync'](_0x2421f7), !![];
    return ![];
}
function checkConfigDir(_0x5da024, _0x1b458c) {
    const _0x2c9c37 = a0_0x10dfea;
    make_dir(_0x5da024) && fs[_0x2c9c37(0x252)](_0x1b458c)[_0x2c9c37(0x1fd)](_0x34d68c => {
        const _0x46da7b = _0x2c9c37;
        if (_0x34d68c[_0x46da7b(0x20f)](/\.(yaml|yml|json)(-dist)?$/i)) {
            const _0x33a1ad = path[_0x46da7b(0x1a8)](_0x5da024, _0x34d68c);
            if (!fs[_0x46da7b(0x1d4)](_0x33a1ad))
                try {
                    fs['copyFileSync'](path[_0x46da7b(0x1a8)](_0x1b458c, _0x34d68c), _0x33a1ad);
                } catch (_0x297184) {
                    console[_0x46da7b(0x1f3)](_0x297184);
                }
        }
    });
}
let opts = {
        'noengine': ![],
        'repl': ![],
        'pidfile': ![],
        'basedir': process['env']['REACTOR_HOME'] || process['cwd'](),
        'opterr': ![]
    }, argv = process[a0_0x10dfea(0x272)][a0_0x10dfea(0x27e)](0x2);
function a0_0x2287() {
    const _0x486e0d = [
        'config',
        'getConfig',
        'uncaughtException',
        'utf-8',
        'confdir',
        '842232BksHbM',
        'Configuration\x20file\x20',
        'forEach',
        '503676ycCjGD',
        'always',
        'split',
        'logging.yaml',
        'debug',
        'kill',
        'is_windows',
        'Please\x20refer\x20to\x20the\x20console\x20log\x20for\x20trace',
        '/proc/1/mountinfo',
        'gid',
        'now',
        'Container\x20mount\x20for\x20/var/reactor:\x20%1',
        'pid',
        'The\x20version\x20of\x20nodejs\x20you\x20are\x20using\x20({0})\x20is\x20not\x20an\x20LTS\x20version,\x20or\x20has\x20not\x20been\x20tested\x20with\x20Reactor.\x20This\x20is\x20not\x20recommended.',
        'Locale\x20',
        'locale',
        'EADDRINUSE',
        'match',
        'env',
        'Shutdown\x20complete,\x20process\x20ID\x20%1',
        'NOTICE',
        'tools',
        'NODE_PATH\x20required\x20environment\x20variable\x20is\x20not\x20set;\x20can\x27t\x20continue',
        'cpSync',
        'pidfile',
        'Closing\x20APIs...',
        'Resolved\x20timezone=%1,\x20environment\x20TZ=%2;\x20offset\x20minutes\x20from\x20UTC=%3',
        '51808CZRPAw',
        'shutdown',
        'addAlert',
        'nodejs-version',
        'server/lib/Structure',
        'getuid',
        'crit',
        'Loaded\x20locale\x20%1\x20for\x20%2',
        'reactor',
        'The\x20version\x20of\x20nodejs\x20you\x20are\x20using\x20({0})\x20is\x20now\x20end-of-life,\x20and\x20so\x20is\x20deprecated\x20for\x20use\x20with\x20Reactor.\x20Please\x20upgrade\x20nodejs\x20to\x20the\x20latest\x20LTS\x20version\x20as\x20soon\x20as\x20possible.',
        'Stopping\x20timers...',
        '776821fbOhRK',
        'app:\x20can\x27t\x20get\x20locale\x20timezone:\x20%1',
        'en-US.UTF-8',
        'resolvedOptions',
        'sysconfig-invalid',
        'Startup\x20was\x20delayed\x20%1ms',
        'Detected\x20nodejs',
        'eol',
        'app:\x20NODE_PATH\x20component\x20%1\x20seems\x20to\x20be\x20Reactor\x20install\x20dir',
        'reactor.engine.wait_all_controllers',
        'find',
        'Engine\x20startup\x20suppressed;\x20no\x20rules\x20will\x20be\x20processed.',
        'context',
        'readFileSync',
        'subscribe',
        'nodejs\x20major\x20version\x20%1\x20accepted\x20(by\x20configuration\x20exception)',
        'is_docker',
        'node',
        'datadir',
        'locales',
        'Failed\x20to\x20write\x20',
        'unhandled.json',
        'opterr',
        'UTF-8',
        'All\x20logs\x20closed',
        'Unable\x20to\x20load\x20configuration\x20from',
        'dist-config',
        'replace',
        '/var/reactor/.docker-image-volume',
        './server/lib/Logger',
        'The\x20version\x20of\x20nodejs\x20you\x20are\x20using\x20({0})\x20is\x20approaching\x20end-of-life.\x20Please\x20upgrade\x20nodejs\x20to\x20the\x20latest\x20LTS\x20version\x20as\x20soon\x20as\x20possible.',
        'join',
        'notice',
        './server/lib/TimerBroker.js',
        'Basedir\x20%1;\x20data\x20in\x20%2',
        'toLocaleDateString',
        'version',
        'SIGQUIT',
        'REACTOR_LOG_PREFIX',
        '/var/reactor',
        'Failed\x20to\x20set\x20the\x20GID\x20of\x20the\x20Reactor\x20process:\x20',
        'Starting\x20WSAPI...',
        'NODE_PATH=%1',
        'Required\x20environment\x20variable\x20NODE_PATH\x20is\x20not\x20set',
        'path',
        'TimedPromise',
        'readdirSync',
        'ext',
        'shift',
        'Local\x20date/time\x20using\x20configured\x20timezone\x20and\x20locale\x20formatting\x20is\x20%1',
        'win32',
        'Failed\x20to\x20load\x20locale\x20%1:\x20%2',
        'getLogger',
        'Configured\x20locale\x20%1;\x20selected\x20locale(s)\x20%2',
        'setLocale',
        'status',
        'number',
        'timeZone',
        'stop',
        '3982200hbwDNr',
        'NODE_PATH\x20does\x20not\x20seem\x20to\x20include\x20Reactor\x20install\x20directory\x20as\x20first\x20element:\x20%1',
        'Controller\x20%1\x20failed\x20to\x20start:\x20%2',
        'en-US',
        'arch',
        '114frvznF',
        'SIGHUP',
        'suppress_docker_volume_check',
        'setgid',
        '/opt/reactor/.reactor-docker',
        '(no\x20ICU)',
        '(not\x20supported)',
        'server/lib/AlertManager',
        'err',
        'Closing\x20logs...',
        'server/lib/httpapi',
        'Invalid\x20command\x20line\x20argument:',
        'toUpperCase',
        'logsdir',
        'argv',
        'exception',
        'REACTOR_CONFIG_PREFIX',
        'noengine',
        'object',
        'Container\x20has\x20no\x20identifiable\x20mount\x20for\x20/var/reactor.',
        'LANGUAGE',
        'Waiting\x20%1\x20seconds\x20before\x20continuing\x20(startup\x20delay)',
        'localesdir',
        'HTTP\x20server\x20running;\x20registering\x20proxy\x20endpoints.',
        'NODE_PATH',
        'server/lib/i18n',
        'slice',
        'resolve',
        'express',
        'server/lib/util',
        'Reload\x20message\x20received\x20(handling\x20as\x20SIGQUIT)',
        'Exiting...',
        '99FEsBse',
        'Starting\x20Reaction\x20Engine...',
        'Trapped\x20unhandled\x20Promise\x20rejection',
        'The\x20Reactor\x20configuration\x20in\x20{0:q}\x20could\x20not\x20be\x20read;\x20the\x20system\x20has\x20started\x20with\x20an\x20empty\x20configuration.',
        'warn',
        'notifyStartup',
        'REACTOR_PLUGIN_PREFIX',
        'server/lib/Engine',
        'nodejs\x20v%1\x20known,\x20supported\x20through\x20%2',
        'The\x20engine\x20has\x20been\x20disabled\x20and\x20is\x20not\x20running\x20(rules\x20are\x20not\x20being\x20processed).',
        'attempting\x20load\x20of\x20locale\x20%1',
        'info',
        'waitAllControllers',
        'accept_nodejs_version',
        'reactor-root-priv',
        'All\x20%1\x20controllers\x20successfully\x20started.',
        'server/wsapi/wsapi',
        'repl',
        'WARN',
        'reactor.pid',
        'getInstance',
        'toString',
        'Unsupported\x20nodejs\x20version\x20',
        'versions',
        'basedir',
        'FORCED\x20EXIT',
        'struct',
        'trace',
        'Shutting\x20down\x20logs:',
        'start',
        'REACTOR_STORAGE_PREFIX',
        'Stopping\x20Engine...',
        'dismissTag',
        'The\x20data\x20volume\x20has\x20not\x20been\x20correctly\x20configured\x20and\x20mounted.\x20Stopping\x20container.\x20Please\x20refer\x20to\x20the\x20installation\x20instructions\x20for\x20your\x20docker\x20image.',
        'writeFileSync',
        'report',
        './server/lib/httpproxy',
        'uid',
        'app',
        'existsSync',
        '\x20cannot\x20be\x20used;\x20encodings\x20other\x20than\x20UTF-8\x20are\x20not\x20supported',
        'Trapped\x20unhandled\x20exception:',
        'setuid',
        'platform',
        'reactor.engine.enabled',
        'reactor.yaml',
        'unhandledRejection',
        'Failed\x20to\x20set\x20the\x20UID\x20of\x20the\x20Reactor\x20process:\x20',
        'LC_ALL',
        'getgid',
        'code',
        'engine-disabled',
        'plugindir',
        'REACTOR_HOME',
        'length',
        'Starting\x20Structure...',
        'docker',
        'boolean',
        '4502568SNPjqG',
        'server/lib/Logger.js',
        'EOL',
        'Reactor',
        'exit',
        'SIGINT',
        'error',
        'REACTOR_DATA_PREFIX',
        'includes',
        'getLoadedLocale',
        'then',
        'reason',
        'log',
        '817424reZxdo',
        'experimental_check_uidgid'
    ];
    a0_0x2287 = function () {
        return _0x486e0d;
    };
    return a0_0x2287();
}
while (argv['length'] > 0x0) {
    let arg = argv[a0_0x10dfea(0x254)]();
    switch (arg) {
    case '-R':
        opts[a0_0x10dfea(0x1be)] = !![];
        break;
    case '-N':
        opts[a0_0x10dfea(0x275)] = !![];
        break;
    case '-d':
        opts[a0_0x10dfea(0x1c5)] = argv[a0_0x10dfea(0x254)]() || opts['basedir'];
        break;
    case '-c':
        opts[a0_0x10dfea(0x1fa)] = argv[a0_0x10dfea(0x254)]() || opts[a0_0x10dfea(0x1fa)];
        break;
    case '-p':
        opts[a0_0x10dfea(0x216)] = argv['shift']() || a0_0x10dfea(0x1c0);
        break;
    default:
        opts[a0_0x10dfea(0x23a)] = !![], console['log'](a0_0x10dfea(0x26f), arg);
    }
}
opts[a0_0x10dfea(0x23a)] && process[a0_0x10dfea(0x1eb)](0xff);
const express = require(a0_0x10dfea(0x1a9)), repl = require(a0_0x10dfea(0x1be)), basedir = path[a0_0x10dfea(0x1a8)](opts[a0_0x10dfea(0x1c5)] || process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1e2)] || __dirname), confdir = opts[a0_0x10dfea(0x1fa)] ? path[a0_0x10dfea(0x1a8)](opts['confdir']) : path[a0_0x10dfea(0x1a8)](process['env'][a0_0x10dfea(0x274)] ? process[a0_0x10dfea(0x210)][a0_0x10dfea(0x274)] : process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1ee)] ? path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1ee)], a0_0x10dfea(0x1f6)) : path['join'](basedir, a0_0x10dfea(0x1f6)));
console[a0_0x10dfea(0x1f3)](a0_0x10dfea(0x1ea), BUILD_VERSION, a0_0x10dfea(0x1d3), version, 'configuration\x20from', confdir), checkConfigDir(confdir, path[a0_0x10dfea(0x243)](basedir, './dist-config'));
const Configuration = require('./server/lib/Configuration'), rcf = path['resolve'](confdir, a0_0x10dfea(0x1da));
let valid_config = ![], c;
try {
    c = Configuration['getInstance']('reactor', rcf)[a0_0x10dfea(0x1f7)](a0_0x10dfea(0x221), a0_0x10dfea(0x276));
    if (!c)
        throw new Error(a0_0x10dfea(0x1fc) + rcf + '\x20unreadable\x20or\x20empty');
    valid_config = !![];
} catch (a0_0x10ac3d) {
    console[a0_0x10dfea(0x1ed)](a0_0x10dfea(0x23d), rcf, ':', a0_0x10ac3d), console[a0_0x10dfea(0x1f3)]('A\x20default\x20(empty)\x20configuration\x20with\x20the\x20Engine\x20disabled\x20will\x20be\x20used.'), c = Configuration[a0_0x10dfea(0x1c1)]('reactor', { 'reactor': { 'engine': { 'enabled': ![] } } })[a0_0x10dfea(0x1f7)](a0_0x10dfea(0x221), 'object');
}
c[a0_0x10dfea(0x1c5)] = basedir, c[a0_0x10dfea(0x1fa)] = confdir, c[a0_0x10dfea(0x236)] = c[a0_0x10dfea(0x236)] || path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1cb)] ? process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1cb)] : path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1ee)] || basedir, 'storage')), c[a0_0x10dfea(0x271)] = c[a0_0x10dfea(0x271)] || path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)][a0_0x10dfea(0x24a)] ? process[a0_0x10dfea(0x210)][a0_0x10dfea(0x24a)] : path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1ee)] || basedir, 'logs')), c[a0_0x10dfea(0x1e1)] = c[a0_0x10dfea(0x1e1)] || path['resolve'](process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1b3)] ? process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1b3)] : path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1ee)] || basedir, a0_0x10dfea(0x253))), c[a0_0x10dfea(0x27a)] = c['localesdir'] || path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1b3)] ? process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1b3)] : path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1ee)] || basedir, a0_0x10dfea(0x237))), console[a0_0x10dfea(0x1f3)](a0_0x10dfea(0x27c), process[a0_0x10dfea(0x210)][a0_0x10dfea(0x27c)]);
const is_docker = fs[a0_0x10dfea(0x1d4)](a0_0x10dfea(0x268));
c[a0_0x10dfea(0x234)] = is_docker, c[a0_0x10dfea(0x204)] = a0_0x10dfea(0x256) === process[a0_0x10dfea(0x1d8)];
if (is_docker && fs[a0_0x10dfea(0x1d4)](a0_0x10dfea(0x240)) && !![] !== c[a0_0x10dfea(0x266)]) {
    console[a0_0x10dfea(0x1ed)](a0_0x10dfea(0x1ce));
    throw new Error('Invalid\x20volume\x20configuration');
}
opts[a0_0x10dfea(0x275)] = opts[a0_0x10dfea(0x275)] || fs[a0_0x10dfea(0x1d4)](path[a0_0x10dfea(0x1a8)](confdir, a0_0x10dfea(0x275)));
if (c[a0_0x10dfea(0x1f5)]) {
    if (c['gid'] && process[a0_0x10dfea(0x1de)]() !== c[a0_0x10dfea(0x207)])
        try {
            process[a0_0x10dfea(0x267)](c[a0_0x10dfea(0x207)]);
        } catch (a0_0x228b3c) {
            console['error'](a0_0x10dfea(0x24c) + a0_0x228b3c);
        }
    if (c[a0_0x10dfea(0x1d2)] && process[a0_0x10dfea(0x21e)]() !== c[a0_0x10dfea(0x1d2)])
        try {
            process[a0_0x10dfea(0x1d7)](c[a0_0x10dfea(0x1d2)]);
        } catch (a0_0x4f2d83) {
            console[a0_0x10dfea(0x1ed)](a0_0x10dfea(0x1dc) + a0_0x4f2d83);
            throw a0_0x4f2d83;
        }
}
if (opts[a0_0x10dfea(0x216)]) {
    opts['pidfile'] = path[a0_0x10dfea(0x1a8)](c[a0_0x10dfea(0x236)], opts[a0_0x10dfea(0x216)]);
    try {
        fs[a0_0x10dfea(0x1cf)](opts[a0_0x10dfea(0x216)], String(process[a0_0x10dfea(0x20a)]));
    } catch (a0_0x223e29) {
        console['error'](a0_0x10dfea(0x238) + opts[a0_0x10dfea(0x216)] + ':\x20' + a0_0x223e29);
    }
}
make_dir(c['datadir']), make_dir(c[a0_0x10dfea(0x271)]), Configuration['getInstance']('logging', path[a0_0x10dfea(0x243)](confdir, a0_0x10dfea(0x201)));
const Logger = require(a0_0x10dfea(0x241)), log = Logger[a0_0x10dfea(0x258)](a0_0x10dfea(0x1d3)), sys_locale = process[a0_0x10dfea(0x210)][a0_0x10dfea(0x1dd)] || process[a0_0x10dfea(0x210)]['LANG'] || process[a0_0x10dfea(0x210)][a0_0x10dfea(0x278)];
log[a0_0x10dfea(0x1ff)]('Reactor\x20build\x20%1\x20starting\x20on\x20%2\x20%3', BUILD_VERSION, process[a0_0x10dfea(0x248)], process['execPath']), log[a0_0x10dfea(0x1ff)]('Process\x20ID\x20%1\x20user/group\x20%2/%3;\x20%4;\x20platform\x20%5/%6\x20%7;\x20locale\x20%8', process[a0_0x10dfea(0x20a)], process[a0_0x10dfea(0x21e)] ? process[a0_0x10dfea(0x21e)]() : '-', process[a0_0x10dfea(0x1de)] ? process[a0_0x10dfea(0x1de)]() : '-', is_docker ? a0_0x10dfea(0x1e5) : 'bare-metal', process['platform'], process[a0_0x10dfea(0x263)], os['version'](), sys_locale), log['always'](a0_0x10dfea(0x246), c[a0_0x10dfea(0x1c5)], c[a0_0x10dfea(0x236)]), log[a0_0x10dfea(0x1ff)](a0_0x10dfea(0x24e), process['env'][a0_0x10dfea(0x27c)]);
if ('' === (process['env'][a0_0x10dfea(0x27c)] || '')) {
    log[a0_0x10dfea(0x21f)](a0_0x10dfea(0x214));
    throw new Error(a0_0x10dfea(0x24f));
} else {
    let paths = process[a0_0x10dfea(0x210)][a0_0x10dfea(0x27c)][a0_0x10dfea(0x200)](path['delimiter']), found = ![];
    for (let p of paths) {
        if ('' !== p && fs[a0_0x10dfea(0x1d4)](path[a0_0x10dfea(0x243)](p, a0_0x10dfea(0x1e8)))) {
            log[a0_0x10dfea(0x202)](0x5, a0_0x10dfea(0x22c), p), found = !![];
            break;
        }
        log['warn']('Warning:\x20NODE_PATH\x20does\x20not\x20have\x20Reactor\x20directory\x20as\x20first\x20element!');
    }
    if (!found) {
        log['crit'](a0_0x10dfea(0x260), process['env'][a0_0x10dfea(0x27c)]);
        throw new Error('Environment\x20NODE_PATH\x20does\x20not\x20include\x20the\x20Reactor\x20install\x20directory');
    }
}
const hasICU = a0_0x10dfea(0x276) === typeof Intl;
try {
    const ICUTZ = hasICU ? Intl['DateTimeFormat']()[a0_0x10dfea(0x227)]()[a0_0x10dfea(0x25d)] : a0_0x10dfea(0x269), now = new Date();
    log[a0_0x10dfea(0x1ff)](a0_0x10dfea(0x218), ICUTZ, process['env']['TZ'], -now['getTimezoneOffset']());
} catch (a0_0xbd5db6) {
    log['err'](a0_0x10dfea(0x225), a0_0xbd5db6);
}
const i18n = require(a0_0x10dfea(0x27d));
let locale = c[a0_0x10dfea(0x20d)] || sys_locale || a0_0x10dfea(0x226);
log['always'](a0_0x10dfea(0x259), c[a0_0x10dfea(0x20d)], locale), locale = locale[a0_0x10dfea(0x200)](/ *, */);
let loaded = ![];
for (let l of locale) {
    let m = l[a0_0x10dfea(0x200)](/\./);
    m[0x0] = (m[0x0] || '??')[a0_0x10dfea(0x23f)]('_', '-'), m[0x1] = (m[0x1] || a0_0x10dfea(0x23b))['toUpperCase']();
    if (a0_0x10dfea(0x23b) !== m[0x1]) {
        log[a0_0x10dfea(0x26c)](a0_0x10dfea(0x20c) + l + a0_0x10dfea(0x1d5));
        continue;
    }
    try {
        log[a0_0x10dfea(0x202)](0x5, a0_0x10dfea(0x1b7), m[0x0]);
        if (i18n[a0_0x10dfea(0x25a)](m[0x0], ![])) {
            log[a0_0x10dfea(0x1ff)](a0_0x10dfea(0x220), i18n[a0_0x10dfea(0x1f0)](), m[0x0]), loaded = !![];
            break;
        }
    } catch (a0_0x43526e) {
        log['notice'](a0_0x10dfea(0x257), m[0x0], a0_0x43526e);
    }
}
if (!loaded) {
    let m = locale[0x0]['split'](/\./);
    m[0x0] = (m[0x0] || '??')[a0_0x10dfea(0x23f)]('_', '-'), m[0x1] = (m[0x1] || a0_0x10dfea(0x23b))[a0_0x10dfea(0x270)]();
    try {
        i18n[a0_0x10dfea(0x25a)](m[0x0], a0_0x10dfea(0x262)) && (log[a0_0x10dfea(0x1ff)](a0_0x10dfea(0x220), i18n['getLoadedLocale'](), m[0x0]), loaded = !![]);
    } catch (a0_0x490bd5) {
        log['notice'](a0_0x10dfea(0x257), m[0x0], a0_0x490bd5);
    }
}
!loaded && (log[a0_0x10dfea(0x1b1)]('Loading\x20default\x20en-US\x20as\x20locale\x20and\x20translation\x20(fallback)'), i18n[a0_0x10dfea(0x25a)](a0_0x10dfea(0x262)));
function a0_0xa13c(_0x32a4d4, _0x45dcd2) {
    _0x32a4d4 = _0x32a4d4 - 0x1a8;
    const _0x2287df = a0_0x2287();
    let _0xa13cf3 = _0x2287df[_0x32a4d4];
    return _0xa13cf3;
}
log[a0_0x10dfea(0x1ff)](a0_0x10dfea(0x255), new Date()['toLocaleString']());
if (is_docker) {
    try {
        const sp = path[a0_0x10dfea(0x1a8)](basedir, a0_0x10dfea(0x23e)), tp = path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)]['REACTOR_DATA_PREFIX'] || '/var/reactor', a0_0x10dfea(0x23e));
        fs[a0_0x10dfea(0x215)](sp, tp, {
            'preserveTimestamps': !![],
            'dereference': !![],
            'recursive': !![]
        });
    } catch (a0_0x5affdc) {
        log[a0_0x10dfea(0x273)](a0_0x5affdc);
    }
    try {
        const sp = path[a0_0x10dfea(0x1a8)](basedir, a0_0x10dfea(0x213)), tp = path[a0_0x10dfea(0x1a8)](process[a0_0x10dfea(0x210)]['REACTOR_DATA_PREFIX'] || a0_0x10dfea(0x24b), a0_0x10dfea(0x213));
        fs[a0_0x10dfea(0x215)](sp, tp, {
            'preserveTimestamps': !![],
            'dereference': !![],
            'recursive': !![]
        });
    } catch (a0_0x42623a) {
        log[a0_0x10dfea(0x273)](a0_0x42623a);
    }
    try {
        const ll = fs[a0_0x10dfea(0x231)](a0_0x10dfea(0x206))[a0_0x10dfea(0x1c2)](a0_0x10dfea(0x1f9))[a0_0x10dfea(0x200)](os[a0_0x10dfea(0x1e9)]), ee = ll[a0_0x10dfea(0x22e)](_0x1b9566 => _0x1b9566[a0_0x10dfea(0x1ef)](a0_0x10dfea(0x24b)));
        ee ? log[a0_0x10dfea(0x1b8)](a0_0x10dfea(0x209), ee) : log[a0_0x10dfea(0x1b1)](a0_0x10dfea(0x277));
    } catch (a0_0x5f1473) {
        log[a0_0x10dfea(0x273)](a0_0x5f1473);
    }
}
const app = express(), struct = require(a0_0x10dfea(0x21d)), Engine = require(a0_0x10dfea(0x1b4)), httpapi = require(a0_0x10dfea(0x26e)), wsapi = require(a0_0x10dfea(0x1bd)), AlertManager = require(a0_0x10dfea(0x26b));
process['on'](a0_0x10dfea(0x1db), (_0x40342f, _0xd07d30) => {
    const _0x1bdd4a = a0_0x10dfea;
    console[_0x1bdd4a(0x1f3)](_0x1bdd4a(0x1af), _0x40342f), console[_0x1bdd4a(0x1ed)](_0x40342f), console[_0x1bdd4a(0x1ed)](_0xd07d30), console[_0x1bdd4a(0x1c8)]();
    try {
        process['report']['writeReport'](path['resolve'](c[_0x1bdd4a(0x271)], _0x1bdd4a(0x239)), _0x40342f), log[_0x1bdd4a(0x1ed)]('Trapped\x20unhandled\x20Promise\x20rejection:\x20%1', _0x40342f), log[_0x1bdd4a(0x273)](_0x40342f), log[_0x1bdd4a(0x1ed)](_0x1bdd4a(0x205));
    } catch (_0x5b9f99) {
    }
}), process['on'](a0_0x10dfea(0x1f8), _0x1115ee => {
    const _0xb2e026 = a0_0x10dfea;
    console[_0xb2e026(0x1ed)](_0xb2e026(0x1d6), _0x1115ee), console[_0xb2e026(0x1c8)](_0x1115ee);
    try {
        process[_0xb2e026(0x1d0)]['writeReport'](path['resolve'](c[_0xb2e026(0x271)], _0xb2e026(0x239)), _0x1115ee), log[_0xb2e026(0x1ed)]('Trapped\x20unhandled\x20exception:\x20%1', _0x1115ee), log['error'](_0xb2e026(0x205));
    } catch (_0x1aec5c) {
    }
    _0xb2e026(0x20e) === _0x1115ee[_0xb2e026(0x1df)] && setTimeout(function () {
        const _0xf6c2b6 = _0xb2e026;
        process[_0xf6c2b6(0x1eb)](0x1);
    }, 0xfa);
}), log[a0_0x10dfea(0x244)](a0_0x10dfea(0x1e4)), struct['start'](c[a0_0x10dfea(0x1c5)])[a0_0x10dfea(0x1f1)](async () => {
    const _0x532b9d = a0_0x10dfea, _0x209083 = Engine[_0x532b9d(0x1c1)]();
    try {
        const _0x311c2b = parseInt(process[_0x532b9d(0x1c4)][_0x532b9d(0x235)][_0x532b9d(0x200)]('.')[0x0]);
        let _0x59dec1 = !![];
        if (!isNaN(_0x311c2b)) {
            const _0x40ebd0 = NODE_VERSIONS[_0x311c2b];
            if (c?.[_0x532b9d(0x1ba)] && c[_0x532b9d(0x1ba)] == _0x311c2b)
                log[_0x532b9d(0x202)](0x5, _0x532b9d(0x233), _0x311c2b);
            else {
                if (_0x40ebd0) {
                    log[_0x532b9d(0x1b8)](_0x532b9d(0x1b5), _0x311c2b, new Date(_0x40ebd0[_0x532b9d(0x22b)])[_0x532b9d(0x247)]());
                    const _0x1e3433 = _0x40ebd0[_0x532b9d(0x22b)] - NODE_EOL_WARNING * 0x5265c00;
                    if (Date['now']() >= _0x40ebd0[_0x532b9d(0x22b)])
                        AlertManager[_0x532b9d(0x21b)](AlertManager[_0x532b9d(0x1bf)], _0x532b9d(0x222), { 'tag': _0x532b9d(0x21c) }, process[_0x532b9d(0x1c4)][_0x532b9d(0x235)]), _0x59dec1 = ![];
                    else
                        Date[_0x532b9d(0x208)]() >= _0x1e3433 && (AlertManager[_0x532b9d(0x21b)](AlertManager[_0x532b9d(0x212)], _0x532b9d(0x242), { 'tag': _0x532b9d(0x21c) }, process[_0x532b9d(0x1c4)]['node']), _0x59dec1 = ![]);
                } else
                    AlertManager[_0x532b9d(0x21b)](AlertManager[_0x532b9d(0x1bf)], _0x532b9d(0x20b), { 'tag': _0x532b9d(0x21c) }, process[_0x532b9d(0x1c4)][_0x532b9d(0x235)]), _0x59dec1 = ![];
            }
        }
        _0x59dec1 && AlertManager[_0x532b9d(0x1cd)](_0x532b9d(0x21c)), process[_0x532b9d(0x21e)] && 0x0 === process['getuid']() && !is_docker ? AlertManager[_0x532b9d(0x21b)](AlertManager[_0x532b9d(0x1bf)], 'Reactor\x20is\x20running\x20as\x20root!\x20This\x20is\x20a\x20very\x20high\x20security\x20risk\x20and\x20not\x20recommended.\x20Please\x20run\x20Reactor\x20as\x20an\x20unprivileged\x20user\x20only.\x20Refer\x20to\x20the\x20installation\x20instructions.', { 'tag': _0x532b9d(0x1bb) }) : AlertManager[_0x532b9d(0x1cd)](_0x532b9d(0x1bb));
    } catch (_0xcd3944) {
        log[_0x532b9d(0x273)](_0xcd3944);
    }
    !valid_config ? AlertManager['addAlert'](AlertManager['ERROR'], _0x532b9d(0x1b0), { 'tag': _0x532b9d(0x228) }, rcf) : AlertManager[_0x532b9d(0x1cd)](_0x532b9d(0x228));
    if (!![] === Configuration[_0x532b9d(0x1f7)](_0x532b9d(0x22d), _0x532b9d(0x1e6), ![])) {
        log['notice']('Waiting\x20for\x20controllers\x20to\x20start\x20up...');
        const _0x351651 = Date[_0x532b9d(0x208)]();
        let _0x153a89 = await struct[_0x532b9d(0x1b9)](Configuration[_0x532b9d(0x1f7)]('reactor.engine.startup_wait', _0x532b9d(0x25c), 0xea60));
        log[_0x532b9d(0x1b8)](_0x532b9d(0x229), Date['now']() - _0x351651);
        let _0x5219ac = 0x0;
        for (let _0x2d54db of _0x153a89) {
            !_0x2d54db[_0x532b9d(0x25b)] && (log['notice'](_0x532b9d(0x261), _0x2d54db['id'], _0x2d54db[_0x532b9d(0x1f2)]), ++_0x5219ac);
        }
        0x0 === _0x5219ac && log[_0x532b9d(0x244)](_0x532b9d(0x1bc), _0x153a89[_0x532b9d(0x1e3)]);
    }
    var _0x5eee40 = ![], _0x2dc1f9 = async function (_0x4d5279) {
            const _0x4b5555 = _0x532b9d;
            if (_0x5eee40)
                return;
            _0x5eee40 = !![], log[_0x4b5555(0x1ff)]('Shutdown\x20signal\x20(%1)\x20received.\x20Stopping\x20Reaction\x20Engine...', _0x4d5279);
            try {
                log[_0x4b5555(0x244)](_0x4b5555(0x1cc)), await _0x209083['stop']();
            } catch (_0x5d41e6) {
                log['exception'](_0x5d41e6);
            }
            try {
                log['notice']('Closing\x20Structure...'), await struct[_0x4b5555(0x25e)]();
            } catch (_0x203e5f) {
                log['exception'](_0x203e5f), console[_0x4b5555(0x1ed)](_0x203e5f);
            }
            try {
                log[_0x4b5555(0x244)](_0x4b5555(0x217)), await wsapi[_0x4b5555(0x25e)](), await httpapi['stop']();
            } catch (_0x562d04) {
                log[_0x4b5555(0x273)](_0x562d04), console[_0x4b5555(0x1ed)](_0x562d04);
            }
            try {
                log['notice'](_0x4b5555(0x223));
                let _0x5d987e = require(_0x4b5555(0x245));
                _0x5d987e[_0x4b5555(0x25e)]();
            } catch (_0x39e477) {
                log[_0x4b5555(0x273)](_0x39e477), console[_0x4b5555(0x1ed)](_0x39e477);
            }
            log[_0x4b5555(0x1ff)](_0x4b5555(0x211), process['pid']);
            try {
                log[_0x4b5555(0x1ff)](_0x4b5555(0x26d)), await Logger[_0x4b5555(0x21a)](), console['log'](_0x4b5555(0x23c));
            } catch (_0x2ebadd) {
                console[_0x4b5555(0x1ed)](_0x4b5555(0x1c9), _0x2ebadd);
            }
            try {
                opts[_0x4b5555(0x216)] && fs['unlinkSync'](opts['pidfile']);
            } catch (_0x1f699b) {
                console[_0x4b5555(0x1ed)](_0x1f699b);
            }
            setTimeout(() => {
                const _0x11a60a = _0x4b5555;
                console['error'](_0x11a60a(0x1c6)), process['exit'](_0x11a60a(0x249) === _0x4d5279 ? 0x1 : 0x7f);
            }, 0x7d0), process[_0x4b5555(0x1eb)]('SIGQUIT' === _0x4d5279 ? 0x1 : 0x7f);
        };
    process['on'](_0x532b9d(0x1ec), _0x2dc1f9), process['on']('SIGTERM', _0x2dc1f9), process['on'](_0x532b9d(0x249), _0x2dc1f9), process['on'](_0x532b9d(0x265), _0x2dc1f9), process['on']('message', _0x1939e0 => {
        const _0x278b50 = _0x532b9d;
        log['debug'](0x5, 'received\x20message:\x20%1', _0x1939e0);
        if ('shutdown' === _0x1939e0)
            log['notice']('Shutdown\x20message\x20received\x20(handling\x20as\x20SIGINT)'), _0x2dc1f9('SIGINT');
        else
            'reload' === _0x1939e0 && (log[_0x278b50(0x244)](_0x278b50(0x1ab)), _0x2dc1f9(_0x278b50(0x249)));
    }), process['on']('exit', function () {
        const _0x1f571c = _0x532b9d;
        console[_0x1f571c(0x1f3)](_0x1f571c(0x1ac));
    }), log[_0x532b9d(0x244)]('Starting\x20HTTP\x20server\x20and\x20API...'), httpapi[_0x532b9d(0x1ca)](app, c[_0x532b9d(0x1c5)])['then'](_0x5dff66 => {
        const _0xa65290 = _0x532b9d;
        if (Configuration[_0xa65290(0x1f7)]('reactor.http_proxy_enabled', _0xa65290(0x1e6), ![])) {
            const _0x9ab481 = require(_0xa65290(0x1d1));
            log[_0xa65290(0x244)](_0xa65290(0x27b)), _0x9ab481[_0xa65290(0x1ca)](app);
        }
        log[_0xa65290(0x244)](_0xa65290(0x24d)), wsapi['start'](app, _0x5dff66)[_0xa65290(0x1f1)](async () => {
            const _0x555049 = _0xa65290;
            wsapi[_0x555049(0x1b2)]();
        });
    })['catch'](_0x546f10 => {
        const _0x4a9772 = _0x532b9d;
        log[_0x4a9772(0x26c)]('Failed\x20to\x20start\x20HTTP\x20API:\x20%1', _0x546f10), _0x4a9772(0x20e) === _0x546f10['code'] && (log[_0x4a9772(0x26c)]('Stopping\x20service;\x20another\x20instance\x20may\x20be\x20running.'), process[_0x4a9772(0x203)](process['pid'], _0x4a9772(0x249)));
    });
    if (opts['noengine'] || ![] === Configuration[_0x532b9d(0x1f7)](_0x532b9d(0x1d9), _0x532b9d(0x1e6), !![])) {
        const _0x3eda8d = require(_0x532b9d(0x27d));
        log[_0x532b9d(0x21f)](_0x532b9d(0x22f)), AlertManager[_0x532b9d(0x21b)](AlertManager['ERROR'], _0x3eda8d['_T'](_0x532b9d(0x1b6)), { 'tag': _0x532b9d(0x1e0) });
    } else {
        let _0x2d1a0b = Configuration[_0x532b9d(0x1f7)]('reactor.engine.startup_delay', _0x532b9d(0x25c), 0x0);
        if (_0x2d1a0b > 0x0) {
            const _0x3ee321 = require(_0x532b9d(0x1aa));
            await _0x3ee321[_0x532b9d(0x251)](() => {
                const _0x1c41bd = _0x532b9d;
                log['always'](_0x1c41bd(0x279), _0x2d1a0b / 0x3e8);
            }, _0x2d1a0b)['catch'](_0x27ee99 => {
            });
        }
        log[_0x532b9d(0x244)](_0x532b9d(0x1ae)), struct[_0x532b9d(0x232)](_0x209083);
        try {
            _0x209083[_0x532b9d(0x1ca)](), AlertManager[_0x532b9d(0x1cd)]('engine-disabled');
        } catch (_0x1b8f75) {
            log[_0x532b9d(0x26c)]('Failed\x20to\x20start\x20engine:\x20%1', _0x1b8f75), log[_0x532b9d(0x273)](_0x1b8f75);
        }
    }
});
if (opts[a0_0x10dfea(0x1be)]) {
    let r = repl[a0_0x10dfea(0x1ca)]('>\x20'), ctx = r[a0_0x10dfea(0x230)];
    ctx[a0_0x10dfea(0x1c7)] = struct, ctx['engine'] = Engine['getInstance'](struct), r['on'](a0_0x10dfea(0x1eb), () => {
        const _0x1afed5 = a0_0x10dfea;
        Engine[_0x1afed5(0x1c1)](struct)[_0x1afed5(0x25e)](), struct[_0x1afed5(0x25e)](), process[_0x1afed5(0x1eb)](0x1);
    });
}