#!/usr/bin/env node
/** Copyright (C) 2020-2025 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_0x38c9fd = a0_0x236b;
(function (_0x1d4deb, _0x4769ac) {
    const _0x12ab84 = a0_0x236b, _0x3e7b55 = _0x1d4deb();
    while (!![]) {
        try {
            const _0x3d742b = -parseInt(_0x12ab84(0x1f0)) / 0x1 * (-parseInt(_0x12ab84(0x1bd)) / 0x2) + -parseInt(_0x12ab84(0x152)) / 0x3 + parseInt(_0x12ab84(0x1e3)) / 0x4 * (parseInt(_0x12ab84(0x14f)) / 0x5) + -parseInt(_0x12ab84(0x170)) / 0x6 * (parseInt(_0x12ab84(0x142)) / 0x7) + parseInt(_0x12ab84(0x1e7)) / 0x8 * (parseInt(_0x12ab84(0x135)) / 0x9) + -parseInt(_0x12ab84(0x1b8)) / 0xa + -parseInt(_0x12ab84(0x14c)) / 0xb * (-parseInt(_0x12ab84(0x161)) / 0xc);
            if (_0x3d742b === _0x4769ac)
                break;
            else
                _0x3e7b55['push'](_0x3e7b55['shift']());
        } catch (_0x353150) {
            _0x3e7b55['push'](_0x3e7b55['shift']());
        }
    }
}(a0_0x466f, 0x58620));
const version = 0x62e3, BUILD_VERSION = 'latest-25315-bc301993', MIN_NODE_MAJOR = 0x12, NODE_VERSIONS = {
        0x12: { 'eol': 0x1968a005600 },
        0x14: { 'eol': 0x19de1b18200 },
        0x16: { 'eol': 0x1a53962ae00 },
        0x18: { 'eol': 0x1b049cc5600 }
    }, NODE_EOL_WARNING = 0x3c;
function a0_0x466f() {
    const _0x3a54f9 = [
        'catch',
        'dismissTag',
        'arch',
        'docker',
        'reactor.yaml',
        'exit',
        'gid',
        'A\x20default\x20(empty)\x20configuration\x20with\x20the\x20Engine\x20disabled\x20will\x20be\x20used.',
        'env',
        'SIGTERM',
        '195750OTIISE',
        'en-US',
        'logs',
        'storage',
        'logging.yaml',
        'Waiting\x20for\x20controllers\x20to\x20start\x20up...',
        'cwd',
        'writeReport',
        'confdir',
        'win32',
        'server/lib/AlertManager',
        'REACTOR_DATA_PREFIX',
        'express',
        '7MAEFDW',
        'dist-config',
        'DateTimeFormat',
        'Exiting...',
        'Failed\x20to\x20write\x20',
        'Please\x20refer\x20to\x20the\x20console\x20log\x20for\x20trace',
        'FORCED\x20EXIT',
        'server/lib/util',
        'crit',
        'Basedir\x20%1;\x20data\x20in\x20%2',
        '4552977QxAJGw',
        'utf-8',
        'getLogger',
        '5VcXldM',
        'TimedPromise',
        'mkdirSync',
        '849537KzPNWm',
        'NODE_PATH\x20required\x20environment\x20variable\x20is\x20not\x20set;\x20can\x27t\x20continue',
        'Shutdown\x20signal\x20(%1)\x20received.\x20Stopping\x20Reaction\x20Engine...',
        'is_docker',
        'accept_nodejs_version',
        'getConfig',
        'All\x20logs\x20closed',
        '/var/reactor',
        'reactor.http_proxy_enabled',
        '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.',
        'Loaded\x20locale\x20%1\x20for\x20%2',
        'ext',
        'waitAllControllers',
        'replace',
        'basedir',
        '12GfqhSN',
        'Shutting\x20down\x20logs:',
        'err',
        'reactor-root-priv',
        'server/lib/httpapi',
        'getInstance',
        'number',
        'debug',
        '\x20cannot\x20be\x20used;\x20encodings\x20other\x20than\x20UTF-8\x20are\x20not\x20supported',
        'locale',
        'notice',
        'reactor.engine.wait_all_controllers',
        'Invalid\x20command\x20line\x20argument:',
        'repl',
        'then',
        '779766GPhHrk',
        'nodejs-version',
        'object',
        'eol',
        'start',
        'setuid',
        'unlinkSync',
        'Starting\x20Structure...',
        'pidfile',
        'pid',
        'warn',
        'argv',
        '\x20unreadable\x20or\x20empty',
        'NOTICE',
        'SIGINT',
        'Warning:\x20NODE_PATH\x20does\x20not\x20have\x20Reactor\x20directory\x20as\x20first\x20element!',
        'opterr',
        'Controller\x20%1\x20failed\x20to\x20start:\x20%2',
        'NODE_PATH',
        'server/lib/Structure',
        'ERROR',
        'REACTOR_HOME',
        'stop',
        'bare-metal',
        'Trapped\x20unhandled\x20exception:',
        'Stopping\x20timers...',
        'en-US.UTF-8',
        'uid',
        'Container\x20has\x20no\x20identifiable\x20mount\x20for\x20/var/reactor.',
        'includes',
        'always',
        'Resolved\x20timezone=%1,\x20environment\x20TZ=%2;\x20offset\x20minutes\x20from\x20UTC=%3',
        'toString',
        'Starting\x20WSAPI...',
        'LC_ALL',
        'Shutdown\x20complete,\x20process\x20ID\x20%1',
        'localesdir',
        'attempting\x20load\x20of\x20locale\x20%1',
        'path',
        'readFileSync',
        'Reactor',
        'noengine',
        'is_windows',
        '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.',
        'Failed\x20to\x20start\x20HTTP\x20API:\x20%1',
        './server/lib/Configuration',
        'Closing\x20APIs...',
        'server/lib/i18n',
        'readdirSync',
        'length',
        'reactor.engine.startup_delay',
        'Trapped\x20unhandled\x20Promise\x20rejection',
        './server/lib/TimerBroker.js',
        'WARN',
        'existsSync',
        'setLocale',
        'Closing\x20logs...',
        'report',
        'timeZone',
        'UTF-8',
        'EADDRINUSE',
        'execPath',
        'EOL',
        'Closing\x20Structure...',
        'Trapped\x20unhandled\x20Promise\x20rejection:\x20%1',
        'plugindir',
        'toLocaleDateString',
        'shutdown',
        'Locale\x20',
        'Starting\x20HTTP\x20server\x20and\x20API...',
        'reactor.pid',
        'match',
        '6390250eRahKO',
        'getgid',
        'REACTOR_CONFIG_PREFIX',
        'version',
        'configuration\x20from',
        '145678MAnMTO',
        'status',
        '/proc/1/mountinfo',
        './dist-config',
        'config',
        'boolean',
        'Configured\x20locale\x20%1;\x20selected\x20locale(s)\x20%2',
        'REACTOR_STORAGE_PREFIX',
        'toUpperCase',
        'addAlert',
        'Failed\x20to\x20set\x20the\x20GID\x20of\x20the\x20Reactor\x20process:\x20',
        'Detected\x20nodejs',
        'resolvedOptions',
        'struct',
        'subscribe',
        'info',
        'reactor',
        'Unable\x20to\x20load\x20configuration\x20from',
        'shift',
        'resolve',
        'sysconfig-invalid',
        '(no\x20ICU)',
        '/opt/reactor/.reactor-docker',
        'Trapped\x20unhandled\x20exception:\x20%1',
        'Stopping\x20service;\x20another\x20instance\x20may\x20be\x20running.',
        'Unsupported\x20nodejs\x20version\x20',
        'now',
        'log',
        'error',
        'trace',
        'app',
        'getuid',
        'unhandled.json',
        './server/lib/Logger',
        'server/wsapi/wsapi',
        'REACTOR_PLUGIN_PREFIX',
        'logsdir',
        'cpSync',
        '2143740pKkAOY',
        'Reactor\x20build\x20%1\x20starting\x20on\x20%2\x20%3',
        'REACTOR_LOG_PREFIX',
        'SIGQUIT',
        '144bKclag',
        'code',
        'getLoadedLocale',
        'engine-disabled',
        'datadir',
        'versions',
        'node',
        'join',
        'Engine\x20startup\x20suppressed;\x20no\x20rules\x20will\x20be\x20processed.',
        '1svJFll',
        'app:\x20NODE_PATH\x20component\x20%1\x20seems\x20to\x20be\x20Reactor\x20install\x20dir',
        'LANGUAGE',
        'Startup\x20was\x20delayed\x20%1ms',
        'reactor.engine.startup_wait',
        'tools',
        'The\x20Reactor\x20configuration\x20in\x20{0:q}\x20could\x20not\x20be\x20read;\x20the\x20system\x20has\x20started\x20with\x20an\x20empty\x20configuration.',
        'reactor.engine.enabled',
        'split',
        'platform',
        'copyFileSync',
        'toLocaleString',
        'LANG',
        'exception'
    ];
    a0_0x466f = function () {
        return _0x3a54f9;
    };
    return a0_0x466f();
}
if (parseInt(process[a0_0x38c9fd(0x1ec)][a0_0x38c9fd(0x1ed)][a0_0x38c9fd(0x125)]('.')[0x0]) < MIN_NODE_MAJOR) {
    console[a0_0x38c9fd(0x1d9)](a0_0x38c9fd(0x1c8), process[a0_0x38c9fd(0x1ec)][a0_0x38c9fd(0x1ed)], '(not\x20supported)');
    throw new Error(a0_0x38c9fd(0x1d6) + process[a0_0x38c9fd(0x1ec)][a0_0x38c9fd(0x1ed)]);
}
const path = require(a0_0x38c9fd(0x196)), os = require('os'), fs = require('fs');
function make_dir(_0x1067c3) {
    const _0x1a5081 = a0_0x38c9fd;
    if (!fs[_0x1a5081(0x1a6)](_0x1067c3))
        return fs[_0x1a5081(0x151)](_0x1067c3), !![];
    return ![];
}
function checkConfigDir(_0x1037cf, _0x5e3a45) {
    const _0xff76ba = a0_0x38c9fd;
    make_dir(_0x1037cf) && fs[_0xff76ba(0x1a0)](_0x5e3a45)['forEach'](_0x24198b => {
        const _0x1122cb = _0xff76ba;
        if (_0x24198b[_0x1122cb(0x1b7)](/\.(yaml|yml|json)(-dist)?$/i)) {
            const _0x532e80 = path['resolve'](_0x1037cf, _0x24198b);
            if (!fs[_0x1122cb(0x1a6)](_0x532e80))
                try {
                    fs[_0x1122cb(0x127)](path['resolve'](_0x5e3a45, _0x24198b), _0x532e80);
                } catch (_0x8b546b) {
                    console[_0x1122cb(0x1d8)](_0x8b546b);
                }
        }
    });
}
let opts = {
        'noengine': ![],
        'repl': ![],
        'pidfile': ![],
        'basedir': process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x185)] || process[a0_0x38c9fd(0x13b)](),
        'opterr': ![]
    }, argv = process[a0_0x38c9fd(0x17b)]['slice'](0x2);
while (argv['length'] > 0x0) {
    let arg = argv[a0_0x38c9fd(0x1cf)]();
    switch (arg) {
    case '-R':
        opts[a0_0x38c9fd(0x16e)] = !![];
        break;
    case '-N':
        opts[a0_0x38c9fd(0x199)] = !![];
        break;
    case '-d':
        opts[a0_0x38c9fd(0x160)] = argv[a0_0x38c9fd(0x1cf)]() || opts['basedir'];
        break;
    case '-c':
        opts['confdir'] = argv[a0_0x38c9fd(0x1cf)]() || opts['confdir'];
        break;
    case '-p':
        opts[a0_0x38c9fd(0x178)] = argv[a0_0x38c9fd(0x1cf)]() || a0_0x38c9fd(0x1b6);
        break;
    default:
        opts[a0_0x38c9fd(0x180)] = !![], console[a0_0x38c9fd(0x1d8)](a0_0x38c9fd(0x16d), arg);
    }
}
opts[a0_0x38c9fd(0x180)] && process[a0_0x38c9fd(0x130)](0xff);
const express = require(a0_0x38c9fd(0x141)), repl = require(a0_0x38c9fd(0x16e)), basedir = path[a0_0x38c9fd(0x1d0)](opts[a0_0x38c9fd(0x160)] || process['env'][a0_0x38c9fd(0x185)] || __dirname), confdir = opts[a0_0x38c9fd(0x13d)] ? path['resolve'](opts[a0_0x38c9fd(0x13d)]) : path[a0_0x38c9fd(0x1d0)](process['env'][a0_0x38c9fd(0x1ba)] ? process['env'][a0_0x38c9fd(0x1ba)] : process[a0_0x38c9fd(0x133)]['REACTOR_DATA_PREFIX'] ? path[a0_0x38c9fd(0x1d0)](process['env'][a0_0x38c9fd(0x140)], a0_0x38c9fd(0x1c1)) : path['join'](basedir, 'config'));
console[a0_0x38c9fd(0x1d8)](a0_0x38c9fd(0x198), BUILD_VERSION, 'app', version, a0_0x38c9fd(0x1bc), confdir), checkConfigDir(confdir, path[a0_0x38c9fd(0x1ee)](basedir, a0_0x38c9fd(0x1c0)));
const Configuration = require(a0_0x38c9fd(0x19d)), rcf = path[a0_0x38c9fd(0x1d0)](confdir, a0_0x38c9fd(0x12f));
let valid_config = ![], c;
try {
    c = Configuration['getInstance']('reactor', rcf)[a0_0x38c9fd(0x157)](a0_0x38c9fd(0x1cd), a0_0x38c9fd(0x172));
    if (!c)
        throw new Error('Configuration\x20file\x20' + rcf + a0_0x38c9fd(0x17c));
    valid_config = !![];
} catch (a0_0x9bf364) {
    console[a0_0x38c9fd(0x1d9)](a0_0x38c9fd(0x1ce), rcf, ':', a0_0x9bf364), console[a0_0x38c9fd(0x1d8)](a0_0x38c9fd(0x132)), c = Configuration[a0_0x38c9fd(0x166)](a0_0x38c9fd(0x1cd), { 'reactor': { 'engine': { 'enabled': ![] } } })['getConfig']('reactor', a0_0x38c9fd(0x172));
}
c[a0_0x38c9fd(0x160)] = basedir, c['confdir'] = confdir, c[a0_0x38c9fd(0x1eb)] = c['datadir'] || path['resolve'](process['env'][a0_0x38c9fd(0x1c4)] ? process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x1c4)] : path[a0_0x38c9fd(0x1d0)](process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x140)] || basedir, a0_0x38c9fd(0x138))), c['logsdir'] = c[a0_0x38c9fd(0x1e1)] || path['resolve'](process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x1e5)] ? process['env'][a0_0x38c9fd(0x1e5)] : path[a0_0x38c9fd(0x1d0)](process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x140)] || basedir, a0_0x38c9fd(0x137))), c[a0_0x38c9fd(0x1b1)] = c['plugindir'] || path[a0_0x38c9fd(0x1d0)](process['env'][a0_0x38c9fd(0x1e0)] ? process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x1e0)] : path['resolve'](process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x140)] || basedir, a0_0x38c9fd(0x15d))), c[a0_0x38c9fd(0x194)] = c['localesdir'] || path[a0_0x38c9fd(0x1d0)](process['env']['REACTOR_PLUGIN_PREFIX'] ? process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x1e0)] : path[a0_0x38c9fd(0x1d0)](process['env'][a0_0x38c9fd(0x140)] || basedir, 'locales')), console[a0_0x38c9fd(0x1d8)](a0_0x38c9fd(0x182), process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x182)]);
const is_docker = fs[a0_0x38c9fd(0x1a6)](a0_0x38c9fd(0x1d3));
c[a0_0x38c9fd(0x155)] = is_docker, c[a0_0x38c9fd(0x19a)] = a0_0x38c9fd(0x13e) === process[a0_0x38c9fd(0x126)], opts['noengine'] = opts[a0_0x38c9fd(0x199)] || fs['existsSync'](path['resolve'](confdir, a0_0x38c9fd(0x199)));
function a0_0x236b(_0x458f8d, _0x2bd99f) {
    const _0x466f53 = a0_0x466f();
    return a0_0x236b = function (_0x236b6a, _0x2faa8a) {
        _0x236b6a = _0x236b6a - 0x125;
        let _0x115884 = _0x466f53[_0x236b6a];
        return _0x115884;
    }, a0_0x236b(_0x458f8d, _0x2bd99f);
}
if (![] && c['gid'] && process[a0_0x38c9fd(0x1b9)]() !== c[a0_0x38c9fd(0x131)])
    try {
        process['setgid'](c['gid']);
    } catch (a0_0x451726) {
        console['error'](a0_0x38c9fd(0x1c7) + a0_0x451726);
    }
if (![] && c[a0_0x38c9fd(0x18b)] && process[a0_0x38c9fd(0x1dc)]() !== c[a0_0x38c9fd(0x18b)])
    try {
        process[a0_0x38c9fd(0x175)](c[a0_0x38c9fd(0x18b)]);
    } catch (a0_0x17fce2) {
        console['error']('Failed\x20to\x20set\x20the\x20UID\x20of\x20the\x20Reactor\x20process:\x20' + a0_0x17fce2), process[a0_0x38c9fd(0x130)](0xfd);
    }
if (opts[a0_0x38c9fd(0x178)]) {
    opts[a0_0x38c9fd(0x178)] = path['resolve'](c[a0_0x38c9fd(0x1eb)], opts['pidfile']);
    try {
        fs['writeFileSync'](opts[a0_0x38c9fd(0x178)], String(process[a0_0x38c9fd(0x179)]));
    } catch (a0_0x2bb5c4) {
        console['error'](a0_0x38c9fd(0x146) + opts['pidfile'] + ':\x20' + a0_0x2bb5c4);
    }
}
make_dir(c[a0_0x38c9fd(0x1eb)]), make_dir(c[a0_0x38c9fd(0x1e1)]), Configuration[a0_0x38c9fd(0x166)]('logging', path[a0_0x38c9fd(0x1ee)](confdir, a0_0x38c9fd(0x139)));
const Logger = require(a0_0x38c9fd(0x1de)), log = Logger[a0_0x38c9fd(0x14e)](a0_0x38c9fd(0x1db)), sys_locale = process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x192)] || process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x129)] || process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x1f2)];
log[a0_0x38c9fd(0x18e)](a0_0x38c9fd(0x1e4), BUILD_VERSION, process['version'], process[a0_0x38c9fd(0x1ad)]), log['always']('Process\x20ID\x20%1\x20user/group\x20%2/%3;\x20%4;\x20platform\x20%5/%6\x20%7;\x20locale\x20%8', process[a0_0x38c9fd(0x179)], process[a0_0x38c9fd(0x1dc)] ? process['getuid']() : '-', process['getgid'] ? process['getgid']() : '-', is_docker ? a0_0x38c9fd(0x12e) : a0_0x38c9fd(0x187), process['platform'], process[a0_0x38c9fd(0x12d)], os[a0_0x38c9fd(0x1bb)](), sys_locale), log[a0_0x38c9fd(0x18e)](a0_0x38c9fd(0x14b), c[a0_0x38c9fd(0x160)], c[a0_0x38c9fd(0x1eb)]), log[a0_0x38c9fd(0x18e)]('NODE_PATH=%1', process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x182)]);
if ('' === (process[a0_0x38c9fd(0x133)]['NODE_PATH'] || '')) {
    log[a0_0x38c9fd(0x14a)](a0_0x38c9fd(0x153));
    throw new Error('Required\x20environment\x20variable\x20NODE_PATH\x20is\x20not\x20set');
} else {
    let paths = process[a0_0x38c9fd(0x133)][a0_0x38c9fd(0x182)][a0_0x38c9fd(0x125)](path['delimiter']), found = ![];
    for (let p of paths) {
        if ('' !== p && fs[a0_0x38c9fd(0x1a6)](path['join'](p, 'server/lib/Logger.js'))) {
            log[a0_0x38c9fd(0x168)](0x5, a0_0x38c9fd(0x1f1), p), found = !![];
            break;
        }
        log[a0_0x38c9fd(0x17a)](a0_0x38c9fd(0x17f));
    }
    if (!found) {
        log[a0_0x38c9fd(0x14a)]('NODE_PATH\x20does\x20not\x20seem\x20to\x20include\x20Reactor\x20install\x20directory\x20as\x20first\x20element:\x20%1', process[a0_0x38c9fd(0x133)]['NODE_PATH']);
        throw new Error('Environment\x20NODE_PATH\x20does\x20not\x20include\x20the\x20Reactor\x20install\x20directory');
    }
}
const hasICU = a0_0x38c9fd(0x172) === typeof Intl;
try {
    const ICUTZ = hasICU ? Intl[a0_0x38c9fd(0x144)]()[a0_0x38c9fd(0x1c9)]()[a0_0x38c9fd(0x1aa)] : a0_0x38c9fd(0x1d2), now = new Date();
    log['always'](a0_0x38c9fd(0x18f), ICUTZ, process['env']['TZ'], -now['getTimezoneOffset']());
} catch (a0_0x133d8b) {
    log[a0_0x38c9fd(0x163)]('app:\x20can\x27t\x20get\x20locale\x20timezone:\x20%1', a0_0x133d8b);
}
const i18n = require(a0_0x38c9fd(0x19f));
let locale = c[a0_0x38c9fd(0x16a)] || sys_locale || a0_0x38c9fd(0x18a);
log[a0_0x38c9fd(0x18e)](a0_0x38c9fd(0x1c3), c[a0_0x38c9fd(0x16a)], locale), locale = locale[a0_0x38c9fd(0x125)](/ *, */);
let loaded = ![];
for (let l of locale) {
    let m = l[a0_0x38c9fd(0x125)](/\./);
    m[0x0] = (m[0x0] || '??')[a0_0x38c9fd(0x15f)]('_', '-'), m[0x1] = (m[0x1] || a0_0x38c9fd(0x1ab))['toUpperCase']();
    if ('UTF-8' !== m[0x1]) {
        log['err'](a0_0x38c9fd(0x1b4) + l + a0_0x38c9fd(0x169));
        continue;
    }
    try {
        log['debug'](0x5, a0_0x38c9fd(0x195), m[0x0]);
        if (i18n['setLocale'](m[0x0], ![])) {
            log['always'](a0_0x38c9fd(0x15c), i18n['getLoadedLocale'](), m[0x0]), loaded = !![];
            break;
        }
    } catch (a0_0x5cd2d8) {
        log[a0_0x38c9fd(0x16b)]('Failed\x20to\x20load\x20locale\x20%1:\x20%2', m[0x0], a0_0x5cd2d8);
    }
}
if (!loaded) {
    let m = locale[0x0][a0_0x38c9fd(0x125)](/\./);
    m[0x0] = (m[0x0] || '??')[a0_0x38c9fd(0x15f)]('_', '-'), m[0x1] = (m[0x1] || a0_0x38c9fd(0x1ab))[a0_0x38c9fd(0x1c5)]();
    try {
        i18n[a0_0x38c9fd(0x1a7)](m[0x0], a0_0x38c9fd(0x136)) && (log[a0_0x38c9fd(0x18e)](a0_0x38c9fd(0x15c), i18n[a0_0x38c9fd(0x1e9)](), m[0x0]), loaded = !![]);
    } catch (a0_0x22432e) {
        log[a0_0x38c9fd(0x16b)]('Failed\x20to\x20load\x20locale\x20%1:\x20%2', m[0x0], a0_0x22432e);
    }
}
!loaded && (log[a0_0x38c9fd(0x17a)]('Loading\x20default\x20en-US\x20as\x20locale\x20and\x20translation\x20(fallback)'), i18n[a0_0x38c9fd(0x1a7)](a0_0x38c9fd(0x136)));
log['always']('Local\x20date/time\x20using\x20configured\x20timezone\x20and\x20locale\x20formatting\x20is\x20%1', new Date()[a0_0x38c9fd(0x128)]());
if (is_docker) {
    try {
        const sp = path[a0_0x38c9fd(0x1d0)](basedir, 'dist-config'), tp = path[a0_0x38c9fd(0x1d0)](process['env'][a0_0x38c9fd(0x140)] || a0_0x38c9fd(0x159), a0_0x38c9fd(0x143));
        fs[a0_0x38c9fd(0x1e2)](sp, tp, {
            'preserveTimestamps': !![],
            'dereference': !![],
            'recursive': !![]
        });
    } catch (a0_0x43d9aa) {
        log['exception'](a0_0x43d9aa);
    }
    try {
        const sp = path[a0_0x38c9fd(0x1d0)](basedir, 'tools'), tp = path[a0_0x38c9fd(0x1d0)](process[a0_0x38c9fd(0x133)]['REACTOR_DATA_PREFIX'] || '/var/reactor', a0_0x38c9fd(0x1f5));
        fs['cpSync'](sp, tp, {
            'preserveTimestamps': !![],
            'dereference': !![],
            'recursive': !![]
        });
    } catch (a0_0x431d16) {
        log[a0_0x38c9fd(0x12a)](a0_0x431d16);
    }
    try {
        const ll = fs[a0_0x38c9fd(0x197)](a0_0x38c9fd(0x1bf))[a0_0x38c9fd(0x190)](a0_0x38c9fd(0x14d))[a0_0x38c9fd(0x125)](os[a0_0x38c9fd(0x1ae)]), ee = ll['find'](_0x3b7e04 => _0x3b7e04[a0_0x38c9fd(0x18d)]('/var/reactor'));
        ee ? log[a0_0x38c9fd(0x1cc)]('Container\x20mount\x20for\x20/var/reactor:\x20%1', ee) : log[a0_0x38c9fd(0x17a)](a0_0x38c9fd(0x18c));
    } catch (a0_0x380d70) {
        log[a0_0x38c9fd(0x12a)](a0_0x380d70);
    }
}
const app = express(), struct = require(a0_0x38c9fd(0x183)), Engine = require('server/lib/Engine'), httpapi = require(a0_0x38c9fd(0x165)), wsapi = require(a0_0x38c9fd(0x1df)), AlertManager = require(a0_0x38c9fd(0x13f));
process['on']('unhandledRejection', (_0x1db9f3, _0x449f8f) => {
    const _0x4bee66 = a0_0x38c9fd;
    console[_0x4bee66(0x1d8)](_0x4bee66(0x1a3), _0x1db9f3), console[_0x4bee66(0x1d9)](_0x1db9f3), console[_0x4bee66(0x1d9)](_0x449f8f), console[_0x4bee66(0x1da)]();
    try {
        process[_0x4bee66(0x1a9)][_0x4bee66(0x13c)](path[_0x4bee66(0x1d0)](c[_0x4bee66(0x1e1)], _0x4bee66(0x1dd)), _0x1db9f3), log[_0x4bee66(0x1d9)](_0x4bee66(0x1b0), _0x1db9f3), log[_0x4bee66(0x12a)](_0x1db9f3), log[_0x4bee66(0x1d9)](_0x4bee66(0x147));
    } catch (_0xb83407) {
    }
}), process['on']('uncaughtException', _0x1d2dd0 => {
    const _0x389a8b = a0_0x38c9fd;
    console['error'](_0x389a8b(0x188), _0x1d2dd0), console[_0x389a8b(0x1da)](_0x1d2dd0);
    try {
        process[_0x389a8b(0x1a9)][_0x389a8b(0x13c)](path['resolve'](c['logsdir'], _0x389a8b(0x1dd)), _0x1d2dd0), log['error'](_0x389a8b(0x1d4), _0x1d2dd0), log['error'](_0x389a8b(0x147));
    } catch (_0x1b021c) {
    }
    _0x389a8b(0x1ac) === _0x1d2dd0[_0x389a8b(0x1e8)] && setTimeout(function () {
        process['exit'](0x1);
    }, 0xfa);
}), log[a0_0x38c9fd(0x16b)](a0_0x38c9fd(0x177)), struct[a0_0x38c9fd(0x174)](c[a0_0x38c9fd(0x160)])[a0_0x38c9fd(0x16f)](async () => {
    const _0x445066 = a0_0x38c9fd, _0x507bb9 = Engine['getInstance']();
    try {
        const _0x198266 = parseInt(process[_0x445066(0x1ec)]['node']['split']('.')[0x0]);
        let _0x43b913 = !![];
        if (!isNaN(_0x198266)) {
            const _0x3a2b4a = NODE_VERSIONS[_0x198266];
            if (_0x3a2b4a) {
                log['info']('nodejs\x20v%1\x20known,\x20supported\x20through\x20%2', _0x198266, new Date(_0x3a2b4a[_0x445066(0x173)])[_0x445066(0x1b2)]());
                const _0x20e517 = _0x3a2b4a[_0x445066(0x173)] - NODE_EOL_WARNING * 0x5265c00;
                if (Date[_0x445066(0x1d7)]() > _0x3a2b4a[_0x445066(0x173)])
                    AlertManager['addAlert'](AlertManager[_0x445066(0x1a5)], '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.', { 'tag': _0x445066(0x171) }, process[_0x445066(0x1ec)][_0x445066(0x1ed)]), _0x43b913 = ![];
                else
                    Date[_0x445066(0x1d7)]() > _0x20e517 && (AlertManager[_0x445066(0x1c6)](AlertManager[_0x445066(0x17d)], _0x445066(0x15b), { 'tag': 'nodejs-version' }, process[_0x445066(0x1ec)][_0x445066(0x1ed)]), _0x43b913 = ![]);
            } else
                _0x198266 !== c?.[_0x445066(0x156)] && (AlertManager['addAlert'](AlertManager[_0x445066(0x1a5)], _0x445066(0x19b), { 'tag': _0x445066(0x171) }, process['versions'][_0x445066(0x1ed)]), _0x43b913 = ![]);
        }
        _0x43b913 && AlertManager[_0x445066(0x12c)](_0x445066(0x171)), process['getuid'] && 0x0 === process[_0x445066(0x1dc)]() && !is_docker ? AlertManager['addAlert'](AlertManager[_0x445066(0x1a5)], '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': _0x445066(0x164) }) : AlertManager[_0x445066(0x12c)]('reactor-root-priv');
    } catch (_0x4f85cf) {
        log[_0x445066(0x12a)](_0x4f85cf);
    }
    !valid_config ? AlertManager[_0x445066(0x1c6)](AlertManager[_0x445066(0x184)], _0x445066(0x1f6), { 'tag': _0x445066(0x1d1) }, rcf) : AlertManager['dismissTag'](_0x445066(0x1d1));
    if (!![] === Configuration[_0x445066(0x157)](_0x445066(0x16c), _0x445066(0x1c2), ![])) {
        log['notice'](_0x445066(0x13a));
        const _0x4ad233 = Date[_0x445066(0x1d7)]();
        let _0x25b4fd = await struct[_0x445066(0x15e)](Configuration[_0x445066(0x157)](_0x445066(0x1f4), _0x445066(0x167), 0xea60));
        log[_0x445066(0x1cc)](_0x445066(0x1f3), Date[_0x445066(0x1d7)]() - _0x4ad233);
        let _0x25925f = 0x0;
        for (let _0x5c1648 of _0x25b4fd) {
            !_0x5c1648[_0x445066(0x1be)] && (log[_0x445066(0x16b)](_0x445066(0x181), _0x5c1648['id'], _0x5c1648['reason']), ++_0x25925f);
        }
        0x0 === _0x25925f && log[_0x445066(0x16b)]('All\x20%1\x20controllers\x20successfully\x20started.', _0x25b4fd[_0x445066(0x1a1)]);
    }
    var _0x467ef2 = async function (_0x4a1e48) {
        const _0x374c85 = _0x445066;
        log[_0x374c85(0x18e)](_0x374c85(0x154), _0x4a1e48);
        try {
            log['notice']('Stopping\x20Engine...'), await _0x507bb9['stop']();
        } catch (_0x3c5a2b) {
            log['exception'](_0x3c5a2b);
        }
        try {
            log['notice'](_0x374c85(0x1af)), await struct[_0x374c85(0x186)]();
        } catch (_0x27b823) {
            log[_0x374c85(0x12a)](_0x27b823), console[_0x374c85(0x1d9)](_0x27b823);
        }
        try {
            log[_0x374c85(0x16b)](_0x374c85(0x19e)), await wsapi[_0x374c85(0x186)](), await httpapi['stop']();
        } catch (_0x2b7d01) {
            log['exception'](_0x2b7d01), console[_0x374c85(0x1d9)](_0x2b7d01);
        }
        try {
            log[_0x374c85(0x16b)](_0x374c85(0x189));
            let _0x195b91 = require(_0x374c85(0x1a4));
            _0x195b91[_0x374c85(0x186)]();
        } catch (_0x37ccfe) {
            log[_0x374c85(0x12a)](_0x37ccfe), console[_0x374c85(0x1d9)](_0x37ccfe);
        }
        log['always'](_0x374c85(0x193), process[_0x374c85(0x179)]);
        try {
            log[_0x374c85(0x18e)](_0x374c85(0x1a8)), await Logger[_0x374c85(0x1b3)](), console[_0x374c85(0x1d8)](_0x374c85(0x158));
        } catch (_0x3e44bb) {
            console[_0x374c85(0x1d9)](_0x374c85(0x162), _0x3e44bb);
        }
        try {
            opts[_0x374c85(0x178)] && fs[_0x374c85(0x176)](opts['pidfile']);
        } catch (_0x5a74cf) {
            console[_0x374c85(0x1d9)](_0x5a74cf);
        }
        setTimeout(() => {
            const _0x445d99 = _0x374c85;
            console['error'](_0x445d99(0x148)), process['exit'](_0x445d99(0x1e6) === _0x4a1e48 ? 0x1 : 0x7f);
        }, 0x7d0), process[_0x374c85(0x130)](_0x374c85(0x1e6) === _0x4a1e48 ? 0x1 : 0x7f);
    };
    process['on'](_0x445066(0x17e), _0x467ef2), process['on'](_0x445066(0x134), _0x467ef2), process['on']('SIGQUIT', _0x467ef2), process['on']('SIGHUP', _0x467ef2), process['on'](_0x445066(0x130), function () {
        const _0xcad3c1 = _0x445066;
        console[_0xcad3c1(0x1d8)](_0xcad3c1(0x145));
    }), log[_0x445066(0x16b)](_0x445066(0x1b5)), httpapi['start'](app, c[_0x445066(0x160)])[_0x445066(0x16f)](_0x48479e => {
        const _0x945e98 = _0x445066;
        if (Configuration[_0x945e98(0x157)](_0x945e98(0x15a), _0x945e98(0x1c2), ![])) {
            const _0x16124c = require('./server/lib/httpproxy');
            log[_0x945e98(0x16b)]('HTTP\x20server\x20running;\x20registering\x20proxy\x20endpoints.'), _0x16124c[_0x945e98(0x174)](app);
        }
        log[_0x945e98(0x16b)](_0x945e98(0x191)), wsapi[_0x945e98(0x174)](app, _0x48479e)[_0x945e98(0x16f)](async () => {
            wsapi['notifyStartup']();
        });
    })[_0x445066(0x12b)](_0x4bdfc3 => {
        const _0x3d635e = _0x445066;
        log[_0x3d635e(0x163)](_0x3d635e(0x19c), _0x4bdfc3), _0x3d635e(0x1ac) === _0x4bdfc3[_0x3d635e(0x1e8)] && (log[_0x3d635e(0x163)](_0x3d635e(0x1d5)), process['kill'](process[_0x3d635e(0x179)], _0x3d635e(0x1e6)));
    });
    if (opts[_0x445066(0x199)] || ![] === Configuration['getConfig'](_0x445066(0x1f7), _0x445066(0x1c2), !![])) {
        const _0x470823 = require(_0x445066(0x19f));
        log[_0x445066(0x14a)](_0x445066(0x1ef)), AlertManager[_0x445066(0x1c6)](AlertManager['ERROR'], _0x470823['_T']('The\x20engine\x20has\x20been\x20disabled\x20and\x20is\x20not\x20running\x20(rules\x20are\x20not\x20being\x20processed).'), { 'tag': 'engine-disabled' });
    } else {
        let _0x4d2147 = Configuration[_0x445066(0x157)](_0x445066(0x1a2), _0x445066(0x167), 0x0);
        if (_0x4d2147 > 0x0) {
            const _0x12290a = require(_0x445066(0x149));
            await _0x12290a[_0x445066(0x150)](() => {
                const _0x401620 = _0x445066;
                log[_0x401620(0x18e)]('Waiting\x20%1\x20seconds\x20before\x20continuing\x20(startup\x20delay)', _0x4d2147 / 0x3e8);
            }, _0x4d2147)['catch'](_0x3dca73 => {
            });
        }
        log[_0x445066(0x16b)]('Starting\x20Reaction\x20Engine...'), struct[_0x445066(0x1cb)](_0x507bb9);
        try {
            _0x507bb9[_0x445066(0x174)](), AlertManager[_0x445066(0x12c)](_0x445066(0x1ea));
        } catch (_0x2b45c9) {
            log[_0x445066(0x163)]('Failed\x20to\x20start\x20engine:\x20%1', _0x2b45c9), log[_0x445066(0x12a)](_0x2b45c9);
        }
    }
});
if (opts[a0_0x38c9fd(0x16e)]) {
    let r = repl[a0_0x38c9fd(0x174)]('>\x20'), ctx = r['context'];
    ctx[a0_0x38c9fd(0x1ca)] = struct, ctx['engine'] = Engine[a0_0x38c9fd(0x166)](struct), r['on'](a0_0x38c9fd(0x130), () => {
        const _0x573253 = a0_0x38c9fd;
        Engine[_0x573253(0x166)](struct)[_0x573253(0x186)](), struct['stop'](), process[_0x573253(0x130)](0x1);
    });
}