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

383 lines
18 KiB
React

/* Metro module 217; source: unknown; dependencies: [29, 6, 7, 15, 17, 18, 209, 218, 44, 194, 197, 212, 206, 220, 201, 221, 199, 200] */
function _fun3026(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#3026, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:6, offset: 0x00c8f485, size: 236 bytes, params: 8, frame: 20
const env0_0 = require;
const env0_3 = ['headers'];
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = importDefault(29) /* metro dependency 29 */;
const env0_5 = importDefault(6) /* metro dependency 6 */;
const env0_6 = importDefault(7) /* metro dependency 7 */;
const env0_7 = importDefault(15) /* metro dependency 15 */;
const env0_8 = importDefault(17) /* metro dependency 17 */;
const env0_9 = importDefault(18) /* metro dependency 18 */;
let value = importDefault(200) /* metro dependency 200 */;
value = _fun3030(value);
value.CONNECTING = 0;
value.OPEN = 1;
value.CLOSING = 2;
value.CLOSED = 3;
exports.default = value;
}
function _isNativeReflectConstruct_3027() { // fn#3027, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:176, offset: 0x00c8f571, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_3027_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun3030(a0) { // fn#3030, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:405, offset: 0x00c8f5cf, size: 343 bytes, params: 2, frame: 16
const closure = WebSocket;
env0_9(closure, a0);
return env0_6(closure, [{key: 'binaryType', get: function() {
return this._binaryType;
}, set: set_3033}, {key: 'close', value: function(a0, a1) {
if (this.readyState !== this.CLOSING && this.readyState !== this.CLOSED) {
this.readyState = this.CLOSING;
this._close(a0, a1);
}
}}, {key: 'send', value: value_3035}, {key: 'ping', value: value_3036}, {key: '_close', value: value_3037},
{key: '_unregisterEvents', value: function() {
this._subscriptions.forEach(_fun3039);
this._subscriptions = [];
}}, {key: '_registerEvents', value: value_3040}, {key: 'onclose', get: get_3045, set: set_3046}, {key: 'onerror',
get: get_3047, set: set_3048}, {key: 'onmessage', get: get_3049, set: set_3050}, {key: 'onopen', get: get_3051,
set: set_3052}]);
}
function WebSocket(a0, a1, a2) { // fn#3031, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:417, offset: 0x00c8f726, size: 527 bytes, params: 4, frame: 24
var console;
var warn;
let value = a1;
const value2 = a2;
let binding = env1_5;
binding(this, WebSocket);
const value5 = env1_8(WebSocket);
const value8 = env1_7(this, _isNativeReflectConstruct_3027() ? global.Reflect.construct(value5, [],
env1_8(this).constructor) : value5.apply(this, undefined));
value8.CONNECTING = 0;
value8.OPEN = 1;
value8.CLOSING = 2;
value8.CLOSED = 3;
value8.readyState = 0;
value8.url = a0;
const r3 = typeof value !== 'string' ? value : [value];
const r10 = value2 || ({});
const headers = r10.headers;
const r1 = headers !== undefined ? headers : {};
value = env1_4(r10, env1_3);
if (value && typeof value.origin === 'string') {
global.console.warn('Specifying `origin` as a WebSocket connection option is deprecated. Include it under `headers` instead.');
r1.origin = value.origin;
delete value.origin;
}
const Object = global.Object;
if (Object.keys(value).length > 0) {
console = global.console;
warn = console.warn;
value = global.Object.keys(value);
value = value.join('`, `');
Reflect.apply(warn, console,
['Unrecognized WebSocket connection option(s) `' + value + '`. Did you mean to put these under `headers`?']);
}
const Array = global.Array;
const r5 = Array.isArray(r3) ? r3 : null;
value = importDefault(209) /* metro dependency 209 */;
value = new value(null);
value8._eventEmitter = value;
binding = env1_10;
value = typeof binding === 'bigint' ? binding : +binding;
env1_10 = typeof value === 'bigint' ? value + 1n : +value + 1;
value8._socketId = value;
value8._registerEvents();
value = importDefault(218) /* metro dependency 218 */;
value.connect(a0, r5, {headers: r1}, value8._socketId);
return value8;
}
function set_3033(a0) { // fn#3033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:1368, offset: 0x00c8f940, size: 225 bytes, params: 2, frame: 18
let value = a0 !== 'blob';
if (value) {
if (a0 !== 'arraybuffer') {
throw new global.Error("binaryType must be either 'blob' or 'arraybuffer'");
}
if (!(this._binaryType !== 'blob' && value)) {
value = environment.__proto__;
(importDefault(44) /* metro dependency 44 */)((importDefault(194) /* metro dependency 194 */).isAvailable,
'Native module BlobModule is required for blob support');
if (a0 === 'blob') {
value = importDefault(194) /* metro dependency 194 */;
value.addWebSocketHandler(this._socketId);
} else {
value = importDefault(194) /* metro dependency 194 */;
value.removeWebSocketHandler(this._socketId);
}
}
} else if (!(this._binaryType !== 'blob' && value)) {
value = environment.__proto__;
(importDefault(44) /* metro dependency 44 */)((importDefault(194) /* metro dependency 194 */).isAvailable,
'Native module BlobModule is required for blob support');
if (a0 === 'blob') {
value = importDefault(194) /* metro dependency 194 */;
value.addWebSocketHandler(this._socketId);
} else {
value = importDefault(194) /* metro dependency 194 */;
value.removeWebSocketHandler(this._socketId);
}
}
this._binaryType = a0;
}
function value_3035(a0) { // fn#3035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:1905, offset: 0x00c8fa6c, size: 355 bytes, params: 2, frame: 18
var ArrayBuffer;
const readyState = this.readyState;
const CONNECTING = this.CONNECTING;
if (readyState === CONNECTING) {
throw new global.Error('INVALID_STATE_ERR');
}
let value = environment.__proto__;
if (a0 instanceof (importDefault(197) /* metro dependency 197 */)) {
value = importDefault(44) /* metro dependency 44 */;
value((importDefault(194) /* metro dependency 194 */).isAvailable,
'Native module BlobModule is required for blob support');
value = importDefault(194) /* metro dependency 194 */;
value.sendOverSocket(a0, this._socketId);
} else {
if (typeof a0 !== 'string') {
ArrayBuffer = global.ArrayBuffer;
if (a0 instanceof ArrayBuffer) {
value = importDefault(218) /* metro dependency 218 */;
value.sendBinary((importDefault(212) /* metro dependency 212 */)(a0), this._socketId);
return undefined;
}
ArrayBuffer = global.ArrayBuffer;
if (ArrayBuffer.isView(a0)) {
value = importDefault(218) /* metro dependency 218 */;
value.sendBinary((importDefault(212) /* metro dependency 212 */)(a0), this._socketId);
return undefined;
}
throw new global.Error('Unsupported data type');
}
value = importDefault(218) /* metro dependency 218 */;
value.send(a0, this._socketId);
}
}
function value_3036() { // fn#3036, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:2380, offset: 0x00c8fbcf, size: 97 bytes, params: 1, frame: 12
const readyState = this.readyState;
const CONNECTING = this.CONNECTING;
if (readyState === CONNECTING) {
throw new global.Error('INVALID_STATE_ERR');
}
let value = environment.__proto__;
value = importDefault(218) /* metro dependency 218 */;
value.ping(this._socketId);
}
function value_3037(a0, a1) { // fn#3037, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:2521, offset: 0x00c8fc30, size: 165 bytes, params: 3, frame: 20
let value = a0;
const value2 = a1;
const r9 = typeof value !== 'number' ? 1000 : value;
const r8 = typeof value2 !== 'string' ? '' : value2;
value = environment.__proto__;
const defaultImport = importDefault(218) /* metro dependency 218 */;
defaultImport.close(r9, r8, this._socketId);
if ((importDefault(194) /* metro dependency 194 */).isAvailable && this._binaryType === 'blob') {
value = importDefault(194) /* metro dependency 194 */;
value.removeWebSocketHandler(this._socketId);
}
}
function value_3038() { // fn#3038, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:2761, offset: 0x00c8fcd5, size: 40 bytes, params: 1, frame: 12
this._subscriptions.forEach(function(a0) {
return a0.remove();
});
this._subscriptions = [];
}
function value_3040() { // fn#3040, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:2906, offset: 0x00c8fd0c, size: 155 bytes, params: 1, frame: 16
let _eventEmitter = this._eventEmitter;
const items2 = [_eventEmitter.addListener('websocketMessage', _fun3041)];
_eventEmitter = this._eventEmitter;
items2[1] = _eventEmitter.addListener('websocketOpen', _fun3042);
_eventEmitter = this._eventEmitter;
items2[2] = _eventEmitter.addListener('websocketClosed', _fun3043);
_eventEmitter = this._eventEmitter;
items2[3] = _eventEmitter.addListener('websocketFailed', _fun3044);
this._subscriptions = items2;
}
function get_3045() { // fn#3045, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:3919, offset: 0x00c90065, size: 46 bytes, params: 1, frame: 13
const value = environment.__proto__;
return (require(199) /* metro dependency 199 */).getEventHandlerAttribute(this, 'close');
}
function set_3046(a0) { // fn#3046, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:3994, offset: 0x00c90093, size: 50 bytes, params: 2, frame: 16
const value = environment.__proto__;
(require(199) /* metro dependency 199 */).setEventHandlerAttribute(this, 'close', a0);
}
function get_3047() { // fn#3047, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:4081, offset: 0x00c900c5, size: 46 bytes, params: 1, frame: 13
const value = environment.__proto__;
return (require(199) /* metro dependency 199 */).getEventHandlerAttribute(this, 'error');
}
function set_3048(a0) { // fn#3048, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:4156, offset: 0x00c900f3, size: 50 bytes, params: 2, frame: 16
const value = environment.__proto__;
(require(199) /* metro dependency 199 */).setEventHandlerAttribute(this, 'error', a0);
}
function get_3049() { // fn#3049, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:4245, offset: 0x00c90125, size: 46 bytes, params: 1, frame: 13
const value = environment.__proto__;
return (require(199) /* metro dependency 199 */).getEventHandlerAttribute(this, 'message');
}
function set_3050(a0) { // fn#3050, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:4322, offset: 0x00c90153, size: 50 bytes, params: 2, frame: 16
const value = environment.__proto__;
(require(199) /* metro dependency 199 */).setEventHandlerAttribute(this, 'message', a0);
}
function get_3051() { // fn#3051, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:4410, offset: 0x00c90185, size: 46 bytes, params: 1, frame: 13
const value = environment.__proto__;
return (require(199) /* metro dependency 199 */).getEventHandlerAttribute(this, 'open');
}
function set_3052(a0) { // fn#3052, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:4484, offset: 0x00c901b3, size: 50 bytes, params: 2, frame: 16
const value = environment.__proto__;
(require(199) /* metro dependency 199 */).setEventHandlerAttribute(this, 'open', a0);
}
function _fun3041(a0) { // fn#3041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:3016, offset: 0x00c8fda7, size: 232 bytes, params: 2, frame: 16
var r3;
var data;
var type;
var value2;
var defaultImport;
var value3;
var defaultImport2;
var raw_length;
var binding;
var dispatchEvent;
var object;
const id = a0.id;
var value;
if (id === env0_0._socketId) {
data = a0.data;
type = a0.type;
if (type === 'binary') {
value3 = environment.__proto__.__proto__;
defaultImport2 = importDefault(206) /* metro dependency 206 */;
r3 = defaultImport2.toByteArray(a0.data).buffer;
} else if (type !== 'blob') {
r3 = data;
} else {
value2 = environment.__proto__.__proto__;
defaultImport = importDefault(194) /* metro dependency 194 */;
r3 = defaultImport.createFromOptions(a0.data);
}
raw_length = a0.raw_length;
binding = env0_0;
dispatchEvent = binding.dispatchEvent;
value = environment.__proto__.__proto__;
value = importDefault(220) /* metro dependency 220 */;
object = {data: r3, raw_length: raw_length};
value = new value('message');
Reflect.apply(dispatchEvent, binding, [value]);
}
}
function _fun3042(a0) { // fn#3042, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:3318, offset: 0x00c8fe8f, size: 117 bytes, params: 2, frame: 13
var binding;
var dispatchEvent;
const id = a0.id;
var value;
if (id === env0_0._socketId) {
binding = env0_0;
binding.readyState = binding.OPEN;
binding.protocol = a0.protocol;
dispatchEvent = binding.dispatchEvent;
value = environment.__proto__.__proto__;
value = importDefault(201) /* metro dependency 201 */;
value = new value('open');
Reflect.apply(dispatchEvent, binding, [value]);
}
}
function _fun3043(a0) { // fn#3043, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:3486, offset: 0x00c8ff04, size: 153 bytes, params: 2, frame: 15
var binding;
var dispatchEvent;
var object2;
const id = a0.id;
var value;
if (id === env0_0._socketId) {
binding = env0_0;
binding.readyState = binding.CLOSED;
dispatchEvent = binding.dispatchEvent;
value = environment.__proto__.__proto__;
value = importDefault(221) /* metro dependency 221 */;
object2 = {};
object2.code = a0.code;
object2.reason = a0.reason;
value = new value('close');
Reflect.apply(dispatchEvent, binding, [value]);
binding._unregisterEvents();
binding.close();
}
}
function _fun3044(a0) { // fn#3044, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:242:3697, offset: 0x00c8ff9d, size: 200 bytes, params: 2, frame: 18
var binding;
var dispatchEvent;
var prototype;
var value2;
var value3;
const id = a0.id;
var value;
if (id === env0_0._socketId) {
binding = env0_0;
binding.readyState = binding.CLOSED;
dispatchEvent = binding.dispatchEvent;
value = environment.__proto__.__proto__;
value = importDefault(201) /* metro dependency 201 */;
prototype = value.prototype;
value2 = Object.create(prototype, {constructor: {value: value}});
value = new value('error');
value = value instanceof Object ? value : value2;
Reflect.apply(dispatchEvent, binding, [value]);
dispatchEvent = binding.dispatchEvent;
value = importDefault(221) /* metro dependency 221 */;
({code: 1006}).reason = a0.message;
prototype = value.prototype;
value3 = Object.create(prototype, {constructor: {value: value}});
value = new value('close');
value = value instanceof Object ? value : value3;
Reflect.apply(dispatchEvent, binding, [value]);
binding._unregisterEvents();
binding.close();
}
}