Files
discord-decomp/sources/by-id/module-00508.js
T
2026-07-28 01:06:53 +03:00

1124 lines
41 KiB
JavaScript

/* Metro module 508; source: unknown; dependencies: [509, 510, 556, 557, 558, 559, 560] */
import * as Module00509Module from './module-00509.js'; /* Metro dependency 509 */
import * as Module00557Module from './module-00557.js'; /* Metro dependency 557 */
import * as Module00558Module from './module-00558.js'; /* Metro dependency 558 */
import * as Module00559Module from './module-00559.js'; /* Metro dependency 559 */
import * as Module00560Module from './module-00560.js'; /* Metro dependency 560 */
function _fun6488(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#6488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:6, offset: 0x00cfd139, size: 971 bytes, params: 8, frame: 22
var r9;
var self;
let env0_0 = require;
const _arrayLikeToArray_6497 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var property;
var value6;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
property = a0.length;
r1 = property;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
var value4 = new global.Array();
var value5 = 0;
if (value5 < r1) {
r2 = value5;
reducibleLoop5: while (true) {
value4[r2] = a0[r2];
value6 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value6 < r1) {
r2 = value6;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value4;
};
const noop_6498 = function() {
};
let closure = serializeObject;
const parseString2 = parseString;
const isJSON = function(a0) {
return RegExp('[/+]json($|[^-\\w])', 'i').test(a0);
};
const Response_65032 = Response_6503;
const closure4 = function(a0, a1) {
var env0_0 = this;
this._query = this._query || [];
this.method = a0;
this.url = a1;
this.header = {};
this._header = {};
this.on('end', _fun6505);
};
const closure5 = function(a0, a1, a2) {
var r2;
var r3;
var value5;
var value = a1;
var value2 = a2;
var value4 = exports('DELETE', a0);
if (typeof value !== 'function') {
r2 = value2;
r3 = value;
} else {
value5 = null;
r2 = value;
r3 = value5;
}
if (r3) {
value4.send(r3);
}
if (r2) {
value4.end(r2);
}
return value4;
};
let window = global.window;
if (typeof window !== 'undefined') {
window = global.window;
} else {
self = global.self;
if (typeof self === 'undefined') {
global.console.warn('Using browser-only version of superagent in non-browser environment');
} else {
self = global.self;
}
}
module.exports = exports_6507;
const exports = module.exports;
exports.Request = closure4;
exports.getXHR = getXHR;
const trim_6509 = function(a0) {
return a0.trim();
};
exports.serializeObject = closure;
exports.parseString = parseString2;
exports.types = {'html': 'text/html', 'json': 'application/json', 'xml': 'text/xml',
'urlencoded': 'application/x-www-form-urlencoded', 'form': 'application/x-www-form-urlencoded',
'form-data': 'application/x-www-form-urlencoded'};
let object = {};
object['application/x-www-form-urlencoded'] = (require(510) /* metro dependency 510 */).stringify;
object['application/json'] = require(556) /* metro dependency 556 */;
exports.serialize = object;
const JSON = global.JSON;
exports.parse = {['application/x-www-form-urlencoded']: parseString2, ['application/json']: JSON.parse};
let value = 0;
let value2 = require(dependencyMap[value]);
value2.mixin(Response_65032.prototype, (Module00557Module).prototype);
Response_65032.prototype._parseBody = _parseBody;
Response_65032.prototype.toError = function() {
var property = this.req;
var method = property.method;
property = property.url;
var value = 'cannot ' + method + ' ' + property + ' (' + this.status + ')';
var Error = global.Error;
value = new Error(value);
value.status = this.status;
value.method = method;
value.url = property;
return value;
};
exports.Response = Response_65032;
(Module00558Module)(closure4.prototype);
let value4 = require(dependencyMap[value]);
value4.mixin(closure4.prototype, (Module00559Module).prototype);
closure4.prototype.type = function(a0) {
var value = a0;
this.set('Content-Type', exports.types[value] || value);
return this;
};
closure4.prototype.accept = function(a0) {
var value = a0;
this.set('Accept', exports.types[value] || value);
return this;
};
closure4.prototype.auth = auth;
closure4.prototype.query = query;
closure4.prototype.attach = function(a0, a1, a2) {
var value2;
if (a1) {
if (this._data) {
throw new global.Error("superagent can't mix .send() and .attach()");
}
value2 = this._getFormData();
value2.append(a0, a1, a2 || a1.name);
}
return this;
};
closure4.prototype._getFormData = _getFormData;
closure4.prototype.callback = function(a0, a1) {
if (this._shouldRetry(a0, a1)) {
return this._retry();
}
var _callback = this._callback;
this.clearTimeout();
if (a0) {
if (this._maxRetries) {
a0.retries = this._retries - 1;
}
this.emit('error', a0);
}
_callback(a0, a1);
};
closure4.prototype.crossDomainError = function() {
var Error = global.Error;
var value2 = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
value2.crossDomain = true;
value2.status = this.status;
value2.method = this.method;
value2.url = this.url;
this.callback(value2);
};
closure4.prototype.agent = function() {
global.console.warn('This is not supported in browser version of superagent');
return this;
};
closure4.prototype.ca = closure4.prototype.agent;
closure4.prototype.buffer = closure4.prototype.ca;
closure4.prototype.write = function() {
var Error = global.Error;
throw new Error('Streaming is not supported in browser version of superagent');
};
closure4.prototype.pipe = closure4.prototype.write;
closure4.prototype._isHost = function(a0) {
var r0;
var value = a0;
r0 = value && typeof value === 'object' && !global.Array.isArray(value);
if (r0) {
value = global.Object.prototype.toString.call(value);
value = value !== '[object Object]';
r0 = value;
}
return r0;
};
closure4.prototype.end = function(a0) {
var value = a0;
if (this._endCalled) {
global.console.warn('Warning: .end() was called twice. This is not supported in superagent');
}
this._endCalled = true;
this._callback = value || noop_6498;
this._finalizeQueryString();
this._end();
};
closure4.prototype._setUploadTimeout = function() {
var env0_0 = this;
if (this._uploadTimeout && !this._uploadTimeoutTimer) {
this._uploadTimeoutTimer = global.setTimeout(_fun6526, this._uploadTimeout);
}
};
closure4.prototype._end = _end;
exports.agent = agent_6530;
closure = _loop_6531;
var env0_6;
object = ['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE'];
let length = object.length;
if (value < length) {
r9 = value;
reducibleLoop6: while (true) {
closure();
value = typeof r9 === 'bigint' ? r9 + 1n : +r9 + 1;
env0_6 = value;
length = object.length;
if (value < length) {
r9 = value;
continue reducibleLoop6;
}
break reducibleLoop6;
}
}
(require(560) /* metro dependency 560 */).prototype.del = (require(560) /* metro dependency 560 */).prototype.delete;
exports.get = function(a0, a1, a2) {
var r2;
var r3;
var value5;
var value = a1;
var value2 = a2;
var value4 = exports('GET', a0);
if (typeof value !== 'function') {
r2 = value2;
r3 = value;
} else {
value5 = null;
r2 = value;
r3 = value5;
}
if (r3) {
value4.query(r3);
}
if (r2) {
value4.end(r2);
}
return value4;
};
exports.head = function(a0, a1, a2) {
var r2;
var r3;
var value5;
var value = a1;
var value2 = a2;
var value4 = exports('HEAD', a0);
if (typeof value !== 'function') {
r2 = value2;
r3 = value;
} else {
value5 = null;
r2 = value;
r3 = value5;
}
if (r3) {
value4.query(r3);
}
if (r2) {
value4.end(r2);
}
return value4;
};
exports.options = function(a0, a1, a2) {
var r2;
var r3;
var value5;
var value = a1;
var value2 = a2;
var value4 = exports('OPTIONS', a0);
if (typeof value !== 'function') {
r2 = value2;
r3 = value;
} else {
value5 = null;
r2 = value;
r3 = value5;
}
if (r3) {
value4.send(r3);
}
if (r2) {
value4.end(r2);
}
return value4;
};
exports.del = closure5;
exports.delete = closure5;
exports.patch = function(a0, a1, a2) {
var r2;
var r3;
var value5;
var value = a1;
var value2 = a2;
var value4 = exports('PATCH', a0);
if (typeof value !== 'function') {
r2 = value2;
r3 = value;
} else {
value5 = null;
r2 = value;
r3 = value5;
}
if (r3) {
value4.send(r3);
}
if (r2) {
value4.end(r2);
}
return value4;
};
exports.post = function(a0, a1, a2) {
var r2;
var r3;
var value5;
var value = a1;
var value2 = a2;
var value4 = exports('POST', a0);
if (typeof value !== 'function') {
r2 = value2;
r3 = value;
} else {
value5 = null;
r2 = value;
r3 = value5;
}
if (r3) {
value4.send(r3);
}
if (r2) {
value4.end(r2);
}
return value4;
};
exports.put = function(a0, a1, a2) {
var r2;
var r3;
var value5;
var value = a1;
var value2 = a2;
var value4 = exports('PUT', a0);
if (typeof value !== 'function') {
r2 = value2;
r3 = value;
} else {
value5 = null;
r2 = value;
r3 = value5;
}
if (r3) {
value4.send(r3);
}
if (r2) {
value4.end(r2);
}
return value4;
};
function _createForOfIteratorHelper(a0, a1) { // fn#6489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:47, offset: 0x00cfd504, size: 443 bytes, params: 3, frame: 18
var r7;
var value3;
var regexp;
var closure;
const env0_0 = a0;
const Symbol = global.Symbol;
let r2 = typeof Symbol !== 'undefined' && a0[global.Symbol.iterator];
r2 = !r2 ? a0['@@iterator'] : r2;
const env0_1 = r2;
if (r2) {
return {s: s, n: n_6494, e: function(a0) {
env0_5 = true;
env0_3 = a0;
}, f: f_6496};
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (env0_1) {
}
closure = function() {
};
return {s: closure, n: n, e: e, f: closure};
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_6497(a0, value);
r2 = value;
} else {
value3 = global.Object.prototype.toString.call(a0).slice(8, -1);
r7 = value3 === 'Object' && a0.constructor ? a0.constructor.name : value3;
if (r7 === 'Map') {
r2 = global.Array.from(a0);
} else if (r7 === 'Set') {
r2 = global.Array.from(a0);
} else if (r7 === 'Arguments') {
value = _arrayLikeToArray_6497(a0, value);
r2 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r7)) {
value = _arrayLikeToArray_6497(a0, value);
r2 = value;
} else {
r2 = value;
}
}
}
} else {
r2 = value;
}
if (r2) {
if (r2) {
}
closure = function() {
};
return {s: closure, n: n, e: e, f: closure};
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _createForOfIteratorHelperN() { // fn#6491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:632, owner: _createForOfIteratorHelper.n, offset: 0x00cfd6bf, size: 69 bytes, params: 1, frame: 5
return env0_2 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_2 === 'bigint' ? env0_2 : +env0_2]};
}
function s() { // fn#6493, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:910, owner: _createForOfIteratorHelper.s, offset: 0x00cfd704, size: 29 bytes, params: 1, frame: 12
env0_1 = env0_1.call(env0_0);
}
function _createForOfIteratorHelperN_6494() { // fn#6494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:938, owner: _createForOfIteratorHelper.n, offset: 0x00cfd721, size: 27 bytes, params: 1, frame: 10
const binding = env0_1;
const value2 = binding.next();
env0_4 = value2.done;
return value2;
}
function _createForOfIteratorHelperF_6496() { // fn#6496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:1013, owner: _createForOfIteratorHelper.f, offset: 0x00cfd750, size: 83 bytes, params: 1, frame: 11
var r1;
var value;
var binding;
var property;
var value2;
var error;
try {
value = environment;
binding = env0_4;
if (binding) {
r1 = binding;
} else {
binding = env0_1;
property = binding.return;
value2 = property == null;
r1 = value2;
}
if (!r1) {
binding = env0_1;
binding.return();
}
} catch (error) {
if (env0_5) {
throw env0_3;
}
throw error;
}
if (env0_5) {
throw env0_3;
}
}
}
function serializeObject(a0) { // fn#6499, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:1763, offset: 0x00cfd7fd, size: 135 bytes, params: 2, frame: 23
var r3;
var items2;
var propertyName;
var propertyName2;
var moduleValue2;
var hasOwn;
if (Module00509Module.isObject(a0)) {
items2 = [];
for (propertyName in a0) {
moduleValue2 = Module00509Module;
hasOwn = moduleValue2.hasOwn;
if (!Reflect.apply(hasOwn, moduleValue2, [a0, propertyName])) {
r3 = propertyName2;
continue;
}
pushEncodedKeyValuePair(items2, propertyName, a0[propertyName]);
r3 = propertyName2;
}
return items2.join('&');
}
return a0;
}
function pushEncodedKeyValuePair(a0, a1, a2) { // fn#6500, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:1916, offset: 0x00cfd884, size: 461 bytes, params: 4, frame: 33
var r12;
var r6;
var push;
var value;
var propertyName;
var propertyName2;
var hasOwn;
var pushEncodedKeyValuePairBinding;
var value3;
var done;
var value4;
var value5;
var error;
if (a2 !== undefined) {
if (a2 !== null) {
value = global.Array.isArray(a2);
if (value) {
value = _createForOfIteratorHelper(a2);
try {
try {
value.s();
value3 = value.n();
done = value3.done;
if (!done) {
r6 = value3;
while (true) {
pushEncodedKeyValuePairBinding = pushEncodedKeyValuePair;
value4 = r6.value;
pushEncodedKeyValuePairBinding(a0, a1, value4);
value5 = value.n();
done = value5.done;
if (done) {
break;
}
r6 = value5;
continue;
}
}
} catch (error) {
value.e(error);
}
} catch (error) {
value.f();
throw error;
}
value.f();
return undefined;
}
value = require(509) /* metro dependency 509 */;
if (value.isObject(a2)) {
for (propertyName in a2) {
value = require(509) /* metro dependency 509 */;
hasOwn = value.hasOwn;
if (!Reflect.apply(hasOwn, value, [a2, propertyName])) {
r12 = propertyName2;
continue;
}
pushEncodedKeyValuePairBinding = pushEncodedKeyValuePair;
value = '' + a1 + '[' + propertyName + ']';
pushEncodedKeyValuePairBinding(a0, value, a2[propertyName]);
r12 = propertyName2;
}
} else {
push = a0.push;
value = global.encodeURI(a1);
value += '=';
Reflect.apply(push, a0, [value + global.encodeURIComponent(a2)]);
}
return undefined;
}
a0.push(global.encodeURI(a1));
}
}
function Response_6503(a0) { // fn#6503, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:2600, offset: 0x00cfdb06, size: 509 bytes, params: 2, frame: 27
var r5;
var property;
var value4;
var slice;
var value5;
var value6;
var trim_6509Binding;
var value7;
this.req = a0;
let xhr = this.req.xhr;
this.xhr = xhr;
this.text = this.req.method === 'HEAD' ? this.xhr.responseType !== undefined ? null : this.xhr.responseText : this.xhr.responseType === '' || this.xhr.responseType === 'text' ? this.xhr.responseText : this.xhr.responseType !== undefined ? null : this.xhr.responseText;
this.statusText = this.req.xhr.statusText;
let status = this.xhr.status;
status = status === 1223 ? 204 : status;
this._setStatusProperties(status);
let value = this.xhr.getAllResponseHeaders();
value = value.split(RegExp('\\r?\\n', ''));
const object = {};
const length = value.length;
const value2 = 0;
if (value2 < length) {
r5 = value2;
while (true) {
property = value[r5];
value4 = property.indexOf(':');
if (value4 !== -1) {
value5 = property.slice(value2, value4);
value6 = value5.toLowerCase();
trim_6509Binding = trim_6509;
slice = property.slice;
object[value6] = trim_6509Binding(Reflect.apply(slice, property, [value4 + 1]));
}
value7 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
if (value7 < length) {
r5 = value7;
continue;
}
break;
}
}
this.headers = object;
this.header = this.headers;
const header = this.header;
xhr = this.xhr;
const getResponseHeader = xhr.getResponseHeader;
header['content-type'] = Reflect.apply(getResponseHeader, xhr, ['content-type']);
this._setHeaderProperties(this.header);
const text = this.text;
value = null;
if (value !== text) {
this.body = this.req.method === 'HEAD' ? value : this._parseBody(this.text || this.xhr.response);
} else if (a0._responseType) {
this.body = this.xhr.response;
} else {
this.body = this.req.method === 'HEAD' ? value : this._parseBody(this.text || this.xhr.response);
}
}
function Request_6504(a0, a1) { // fn#6504, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:3446, offset: 0x00cfdd03, size: 87 bytes, params: 3, frame: 13
this._query = this._query || [];
this.method = a0;
this.url = a1;
this.header = {};
this._header = {};
this.on('end', _fun6505);
function _fun6505() { // fn#6505, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:3578, offset: 0x00cfdd5a, size: 470 bytes, params: 1, frame: 20
var r7;
var r6;
var r3;
var status;
var value3;
var value4;
var binding;
var prototype;
var value5;
var response_6503;
var value6;
var value7;
var Error;
var statusText;
var text;
var value8;
var value9;
var error;
var value10;
var value11;
var error2;
var value12;
var value13;
var xhr;
var responseType;
var response;
var responseText;
const value = undefined;
const value2 = null;
try {
value3 = environment.__proto__;
value4 = environment;
binding = env0_0;
prototype = Response_6503.prototype;
value5 = Object.create(prototype, {constructor: {value: Response_6503}});
response_6503 = new Response_6503();
value6 = response_6503 instanceof Object ? response_6503 : value5;
} catch (error) {
Error = global.Error;
prototype = Error.prototype;
value11 = Object.create(prototype, {constructor: {value: Error}});
error2 = new Error('Parser is unable to parse the response');
value12 = error2 instanceof Object ? error2 : value11;
value12.parse = true;
value12.original = error;
value13 = environment;
xhr = env0_0.xhr;
if (xhr) {
xhr = env0_0.xhr;
responseType = xhr.responseType;
if (value === responseType) {
responseText = env0_0.xhr.responseText;
r3 = responseText;
} else {
response = env0_0.xhr.response;
r3 = response;
}
value12.rawResponse = r3;
xhr = env0_0.xhr;
status = xhr.status;
if (status) {
xhr = env0_0.xhr;
status = xhr.status;
} else {
status = value2;
}
value12.status = status;
status = value12.status;
value12.statusCode = status;
} else {
value12.rawResponse = value2;
value12.status = value2;
}
binding = env0_0;
return binding.callback(value12);
}
env0_0.emit('response', value6);
try {
binding = env0_0;
value7 = binding._isResponseOK(value6);
if (value7) {
r3 = value;
} else {
Error = global.Error;
statusText = value6.statusText;
if (statusText) {
r7 = statusText;
} else {
text = value6.text;
r7 = text;
}
if (r7) {
r6 = r7;
} else {
value8 = 'Unsuccessful HTTP response';
r6 = value8;
}
prototype = Error.prototype;
value9 = Object.create(prototype, {constructor: {value: Error}});
error = new Error();
value10 = error instanceof Object ? error : value9;
r3 = value10;
}
} catch (error) {
r3 = error;
}
if (r3) {
r3.original = value2;
r3.response = value6;
r3.status = r3.status || value6.status;
env0_0.callback(r3, value6);
} else {
env0_0.callback(value2, value6);
}
return value;
}
}
function exports_6507(a0, a1) { // fn#6507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:1402, offset: 0x00cfdf7c, size: 168 bytes, params: 3, frame: 15
var r0;
var request;
if (typeof a1 === 'function') {
request = new exports.Request('GET', a0);
request = request.end(a1);
r0 = request;
} else {
r0 = arguments.length === 1 ? new exports.Request('GET', a0) : new exports.Request(a0, a1);
}
return r0;
}
function getXHR() { // fn#6508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:1592, offset: 0x00cfe024, size: 84 bytes, params: 1, frame: 12
var xMLHttpRequest;
var value;
let XMLHttpRequest = env0_3.XMLHttpRequest;
if (XMLHttpRequest) {
XMLHttpRequest = env0_3.XMLHttpRequest;
value = Object.create(XMLHttpRequest.prototype, {constructor: {value: XMLHttpRequest}});
xMLHttpRequest = new XMLHttpRequest();
return xMLHttpRequest instanceof Object ? xMLHttpRequest : value;
}
const Error = global.Error;
throw new Error('Browser-only version of superagent could not find XHR');
}
function _parseBody(a0) { // fn#6510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:4660, offset: 0x00cfe078, size: 151 bytes, params: 2, frame: 17
var r2;
var r0;
const property = exports.parse[this.type];
if (this.req._parser) {
r0 = this.req._parser(this, a0);
} else {
r2 = !property && isJSON(this.type) ? exports.parse['application/json'] : property;
r0 = r2 && a0 && (a0.length > 0 || a0 instanceof global.Object) ? r2(a0) : null;
}
return r0;
}
function auth(a0, a1, a2) { // fn#6514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:5320, offset: 0x00cfe1e6, size: 148 bytes, params: 4, frame: 18
var r3;
var r5;
const value = a1;
const value2 = a2;
const r0 = arguments.length !== 1 ? value : '';
if (typeof r0 === 'object' && r0 !== null) {
r3 = '';
r5 = r0;
} else {
r3 = r0;
r5 = value2;
}
r5 = !r5 ? {type: typeof global.btoa !== 'function' ? 'auto' : 'basic'} : r5;
return this._auth(a0, r3, r5, r5.encoder || (function(a0) {
if (typeof global.btoa === 'function') {
return (0, global.btoa)(a0);
}
var Error = global.Error;
throw new Error('Cannot use basic auth, btoa is not a function');
}));
}
function query(a0) { // fn#6516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:5657, offset: 0x00cfe2c1, size: 55 bytes, params: 2, frame: 13
var r3;
let value = a0;
if (typeof value === 'string') {
r3 = value;
} else {
value = serializeObject(value);
r3 = value;
}
if (r3) {
this._query.push(r3);
}
return this;
}
function _getFormData() { // fn#6518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:5950, offset: 0x00cfe355, size: 59 bytes, params: 1, frame: 10
if (!this._formData) {
this._formData = new env0_3.FormData();
}
return this._formData;
}
function _setUploadTimeout() { // fn#6525, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:7325, offset: 0x00cfe548, size: 67 bytes, params: 1, frame: 14
if (this._uploadTimeout && !this._uploadTimeoutTimer) {
this._uploadTimeoutTimer = global.setTimeout(_fun6526, this._uploadTimeout);
}
function _fun6526() { // fn#6526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:7433, offset: 0x00cfe58b, size: 42 bytes, params: 1, frame: 15
const binding = env0_0;
binding._timeoutError('Upload timeout of ', binding._uploadTimeout, 'ETIMEDOUT');
}
}
function _end() { // fn#6527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:7559, offset: 0x00cfe5b5, size: 837 bytes, params: 1, frame: 30
var r4;
var r3;
var r5;
var r13;
var value2;
var upload;
var value3;
var error;
var username;
var password;
var open;
var method;
var url;
var property;
var propertyName;
var propertyName2;
var header2;
var value9;
var moduleValue;
var hasOwn;
var header3;
var hasOwn2;
var setRequestHeader;
var header4;
if (this._aborted) {
return this.callback(new global.Error('The request has been aborted even before .end() was called'));
}
const exportsBinding = exports;
const getXHR = exportsBinding.getXHR;
this.xhr = Reflect.apply(getXHR, exportsBinding, []);
const xhr = this.xhr;
let r8 = this._formData || this._data;
this._setTimeouts();
xhr.addEventListener('readystatechange', _fun6528);
const handleProgress2 = handleProgress;
if (this.hasListeners('progress')) {
try {
addEventListener = xhr.addEventListener;
value2 = handleProgress2.bind(null, 'download');
Reflect.apply(addEventListener, xhr, ['progress', value2]);
upload = xhr.upload;
if (upload) {
upload = xhr.upload;
addEventListener = upload.addEventListener;
value3 = handleProgress2.bind(null, 'upload');
Reflect.apply(addEventListener, upload, ['progress', value3]);
}
} catch (error) {
}
}
if (xhr.upload) {
this._setUploadTimeout();
}
try {
username = this.username;
if (username) {
password = this.password;
if (password) {
open = xhr.open;
method = this.method;
url = this.url;
username = this.username;
password = this.password;
Reflect.apply(open, xhr, [method, url, true, username, password]);
} else {
open = xhr.open;
method = this.method;
url = this.url;
Reflect.apply(open, xhr, [method, url, true]);
}
} else {
open = xhr.open;
method = this.method;
url = this.url;
Reflect.apply(open, xhr, [method, url, true]);
}
} catch (error) {
return this.callback(error);
}
if (this._withCredentials) {
xhr.withCredentials = true;
}
if (this._formData) {
r5 = r8;
} else if (this.method === 'GET') {
r5 = r8;
} else if (this.method === 'HEAD') {
r5 = r8;
} else if (typeof r8 === 'string') {
r5 = r8;
} else if (this._isHost(r8)) {
r5 = r8;
} else {
property = this._header['content-type'];
r4 = this._serializer || exports.serialize[property ? property.split(';')[0] : ''];
r3 = !r4 && isJSON(property) ? exports.serialize['application/json'] : r4;
r5 = r3 ? r3(r8) : r8;
}
const header = this.header;
const value8 = null;
for (propertyName in header) {
header2 = this.header;
value9 = value8 !== header2[propertyName];
if (!value9) {
r13 = value9;
continue;
}
moduleValue = require(509) /* metro dependency 509 */;
hasOwn = moduleValue.hasOwn;
header3 = this.header;
hasOwn2 = Reflect.apply(hasOwn, moduleValue, [header3, propertyName]);
r13 = hasOwn2;
if (!r13) {
r8 = propertyName2;
continue;
}
setRequestHeader = xhr.setRequestHeader;
header4 = this.header;
Reflect.apply(setRequestHeader, xhr, [propertyName, header4[propertyName]]);
r8 = propertyName2;
}
if (this._responseType) {
xhr.responseType = this._responseType;
}
this.emit('request', this);
xhr.send(r5 === undefined ? value8 : r5);
function _fun6528() { // fn#6528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:7815, offset: 0x00cfe8fa, size: 149 bytes, params: 1, frame: 14
var status;
var error;
var value3;
const readyState = xhr.readyState;
if (readyState >= 2 && env0_0._responseTimeoutTimer) {
global.clearTimeout(env0_0._responseTimeoutTimer);
}
if (readyState !== 4) {
return undefined;
}
try {
status = xhr.status;
} catch (error) {
value3 = 0;
status = value3;
}
const binding = env0_0;
if (status) {
binding.emit('end');
return undefined;
}
if (binding.timedout) {
return undefined;
}
if (env0_0._aborted) {
return undefined;
}
return env0_0.crossDomainError();
}
function handleProgress(a0, a1) { // fn#6529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:8050, owner: _end.handleProgress, offset: 0x00cfe98f, size: 118 bytes, params: 3, frame: 13
if (a1.total > 0) {
a1.percent = a1.loaded / a1.total * 100;
if (a1.percent === 100) {
global.clearTimeout(env0_0._uploadTimeoutTimer);
}
}
a1.direction = a0;
env0_0.emit('progress', a1);
}
}
function agent_6530() { // fn#6530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:9109, offset: 0x00cfea05, size: 47 bytes, params: 1, frame: 11
let value = Module00560Module;
const value2 = Object.create(value.prototype, {constructor: {value: value}});
value = new value();
return value instanceof Object ? value : value2;
}
function _loop_6531() { // fn#6531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:9151, offset: 0x00cfea34, size: 69 bytes, params: 1, frame: 13
(require(560) /* metro dependency 560 */).prototype[env0_7[env0_6].toLowerCase()] = _fun6532;
function _fun6532(a0, a1) { // fn#6532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:9214, offset: 0x00cfea79, size: 75 bytes, params: 3, frame: 15
const value = environment.__proto__;
const Request = exports.Request;
const request = new Request(env0_0, a0);
this._setDefaults(request);
if (a1) {
request.end(a1);
}
return request;
}
}
}
function _createForOfIteratorHelperE(a0) { // fn#6492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:700, owner: _createForOfIteratorHelper.e, offset: 0x00c381f2, size: 5 bytes, params: 2, frame: 1
throw a0;
}
function parseString(a0) { // fn#6501, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:558:2329, offset: 0x00cfda51, size: 152 bytes, params: 2, frame: 25
var r1;
var property;
var value3;
var decodeURIComponent;
var slice;
var value4;
var value5;
const object = {};
const value = a0.split('&');
const length = value.length;
const value2 = 0;
if (value2 < length) {
r1 = value2;
while (true) {
property = value[r1];
value3 = property.indexOf('=');
if (value3 === -1) {
decodeURIComponent = global.decodeURIComponent;
object[decodeURIComponent(property)] = '';
} else {
decodeURIComponent = global.decodeURIComponent;
slice = property.slice;
value4 = decodeURIComponent(Reflect.apply(slice, property, [value2, value3]));
decodeURIComponent = global.decodeURIComponent;
slice = property.slice;
object[value4] = decodeURIComponent(Reflect.apply(slice, property, [value3 + 1]));
}
value5 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
if (value5 < length) {
r1 = value5;
continue;
}
break;
}
}
return object;
}
global.__d(_fun6488, 508, [509, 510, 556, 557, 558, 559,
560]) /* metro module 508, dependencies: [509, 510, 556, 557, 558, 559, 560] */;