Files
discord-decomp/sources/by-id/module-00946.jsx
T
2026-07-27 16:20:00 +03:00

187 lines
9.4 KiB
React

/* Metro module 946; source: unknown; dependencies: [77, 944, 947, 948] */
function _fun10056(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#10056, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1073:6, offset: 0x00d7acea, size: 214 bytes, params: 8, frame: 22
const env0_0 = require;
const closure = getClientAttributes;
const closure2 = getServerAttributes;
const closure3 = extractClientInfo;
const closure4 = getTransportTypes;
const env0_2 = require(77) /* metro dependency 77 */;
const Object = global.Object;
const defineProperty = Object.defineProperty;
const Symbol = global.Symbol;
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
exports.buildClientAttributesFromInfo = function(a0) {
var object = {};
if (a0 != null && a0.name) {
object['mcp.client.name'] = a0.name;
}
if (a0 != null && a0.title) {
object['mcp.client.title'] = a0.title;
}
if (a0 != null && a0.version) {
object['mcp.client.version'] = a0.version;
}
return object;
};
exports.buildServerAttributesFromInfo = buildServerAttributesFromInfo;
exports.buildTransportAttributes = buildTransportAttributes;
exports.extractClientInfo = closure3;
exports.extractSessionDataFromInitializeRequest = extractSessionDataFromInitializeRequest;
exports.extractSessionDataFromInitializeResponse = function(a0) {
var object = {};
if (require(dependencyMap[1]).isValidContentItem(a0)) {
if (typeof a0.protocolVersion === 'string') {
object.protocolVersion = a0.protocolVersion;
}
if (a0.serverInfo) {
object.serverInfo = extractPartyInfo(a0.serverInfo);
}
}
return object;
};
exports.getClientAttributes = closure;
exports.getServerAttributes = closure2;
exports.getTransportTypes = closure4;
}
function extractPartyInfo(a0) { // fn#10057, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1073:44, offset: 0x00d7adc0, size: 121 bytes, params: 2, frame: 13
const object2 = {};
const value = require(944) /* metro dependency 944 */;
if (value.isValidContentItem(a0)) {
if (typeof a0.name === 'string') {
object2.name = a0.name;
}
if (typeof a0.title === 'string') {
object2.title = a0.title;
}
if (typeof a0.version === 'string') {
object2.version = a0.version;
}
}
return object2;
}
function getClientAttributes(a0) { // fn#10058, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1073:259, offset: 0x00d7ae39, size: 125 bytes, params: 2, frame: 13
let value = require(947) /* metro dependency 947 */;
value = value.getClientInfoForTransport(a0);
const object2 = {};
if (value != null && value.name) {
object2['mcp.client.name'] = value.name;
}
if (value != null && value.title) {
object2['mcp.client.title'] = value.title;
}
if (value != null && value.version) {
object2['mcp.client.version'] = value.version;
}
return object2;
}
function getServerAttributes(a0) { // fn#10059, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1073:501, offset: 0x00d7aeb6, size: 212 bytes, params: 2, frame: 16
const value2 = undefined;
const sessionDataForTransport = (require(947) /* metro dependency 947 */).getSessionDataForTransport(a0);
const serverInfo = sessionDataForTransport == null ? value2 : sessionDataForTransport.serverInfo;
const object2 = {};
if (serverInfo != null && serverInfo.name) {
object2[(require(948) /* metro dependency 948 */).MCP_SERVER_NAME_ATTRIBUTE] = serverInfo.name;
}
if (serverInfo != null && serverInfo.title) {
object2[(require(948) /* metro dependency 948 */).MCP_SERVER_TITLE_ATTRIBUTE] = serverInfo.title;
}
if (serverInfo != null && serverInfo.version) {
object2[(require(948) /* metro dependency 948 */).MCP_SERVER_VERSION_ATTRIBUTE] = serverInfo.version;
}
return object2;
}
function extractClientInfo(a0) { // fn#10060, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1073:824, offset: 0x00d7af8a, size: 262 bytes, params: 2, frame: 8
const object2 = {};
const value = undefined;
let r1 = (a0 == null || a0.requestInfo == null ? value : a0.requestInfo.remoteAddress) || (a0 == null ? value : a0.clientAddress);
r1 = !r1 ? a0 == null || a0.request == null ? value : a0.request.ip : r1;
r1 = !r1 ? a0 == null || a0.request == null || a0.request.connection == null ? value : a0.request.connection.remoteAddress : r1;
object2.address = r1;
r1 = (a0 == null || a0.requestInfo == null ? value : a0.requestInfo.remotePort) || (a0 == null ? value : a0.clientPort);
r1 = !r1 ? a0 == null || a0.request == null || a0.request.connection == null ? value : a0.request.connection.remotePort : r1;
object2.port = r1;
return object2;
}
function getTransportTypes(a0) { // fn#10061, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1073:1266, offset: 0x00d7b090, size: 178 bytes, params: 2, frame: 15
var name;
var r2;
var value;
var value2;
if (a0 != null) {
var constructor = a0.constructor;
if (constructor) {
constructor = a0.constructor;
value = undefined;
name = constructor == null ? value : constructor.name;
value = 'unknown';
r2 = typeof name !== 'string' ? value : a0.constructor.name;
value2 = r2.toLowerCase();
return {mcpTransport: r2,
networkTransport: value2.includes('stdio') ? 'pipe' : value2.includes('http') || value2.includes('sse') ? 'tcp' : value};
}
}
return {'mcpTransport': 'unknown', 'networkTransport': 'unknown'};
}
function buildServerAttributesFromInfo(a0) { // fn#10063, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1073:1970, offset: 0x00d7b19b, size: 176 bytes, params: 2, frame: 14
const object2 = {};
if (a0 != null && a0.name) {
object2[(require(948) /* metro dependency 948 */).MCP_SERVER_NAME_ATTRIBUTE] = a0.name;
}
if (a0 != null && a0.title) {
object2[(require(948) /* metro dependency 948 */).MCP_SERVER_TITLE_ATTRIBUTE] = a0.title;
}
if (a0 != null && a0.version) {
object2[(require(948) /* metro dependency 948 */).MCP_SERVER_VERSION_ATTRIBUTE] = a0.version;
}
return object2;
}
function buildTransportAttributes(a0, a1) { // fn#10064, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1073:2259, offset: 0x00d7b24b, size: 453 bytes, params: 3, frame: 33
const sessionId = a0 && 'sessionId' in a0 ? a0.sessionId : undefined;
const r1 = a1 ? extractClientInfo(a1) : {};
const {mcpTransport, networkTransport} = getTransportTypes(a0);
const clientAttributes = getClientAttributes(a0);
const serverAttributes = getServerAttributes(a0);
const protocolVersionForTransport = (require(947) /* metro dependency 947 */).getProtocolVersionForTransport(a0);
const Object = global.Object;
const assign = Object.assign;
const r5 = sessionId && env0_2({}, (require(948) /* metro dependency 948 */).MCP_SESSION_ID_ATTRIBUTE, sessionId);
const r4 = r1.address && env0_2({}, (require(948) /* metro dependency 948 */).CLIENT_ADDRESS_ATTRIBUTE, r1.address);
const r3 = r1.port && env0_2({}, (require(948) /* metro dependency 948 */).CLIENT_PORT_ATTRIBUTE, r1.port);
const binding = env0_2;
const MCP_TRANSPORT_ATTRIBUTE = (require(948) /* metro dependency 948 */).MCP_TRANSPORT_ATTRIBUTE;
const value12 = binding({}, MCP_TRANSPORT_ATTRIBUTE, mcpTransport);
const NETWORK_TRANSPORT_ATTRIBUTE = (require(948) /* metro dependency 948 */).NETWORK_TRANSPORT_ATTRIBUTE;
const value13 = binding(value12, NETWORK_TRANSPORT_ATTRIBUTE, networkTransport);
const NETWORK_PROTOCOL_VERSION_ATTRIBUTE = (require(948) /* metro dependency 948 */).NETWORK_PROTOCOL_VERSION_ATTRIBUTE;
return Reflect.apply(assign, Object, [{}, r5, r4, r3, binding(value13, NETWORK_PROTOCOL_VERSION_ATTRIBUTE, '2.0'),
protocolVersionForTransport && env0_2({},
(require(948) /* metro dependency 948 */).MCP_PROTOCOL_VERSION_ATTRIBUTE, protocolVersionForTransport),
clientAttributes, serverAttributes]);
}
function extractSessionDataFromInitializeRequest(a0) { // fn#10065, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1073:2973, offset: 0x00d7b410, size: 135 bytes, params: 2, frame: 15
const object2 = {};
const moduleValue = require(944) /* metro dependency 944 */;
const isValidContentItem = moduleValue.isValidContentItem;
let params = a0.params;
if (Reflect.apply(isValidContentItem, moduleValue, [params])) {
params = a0.params;
if (typeof params.protocolVersion === 'string') {
object2.protocolVersion = a0.params.protocolVersion;
}
params = a0.params;
if (params.clientInfo) {
object2.clientInfo = extractPartyInfo(a0.params.clientInfo);
}
}
return object2;
}