Initial commit

This commit is contained in:
janisslsm committed 2026-07-27 16:20:00 +03:00
commit af3b49f756
16065 files changed
+2938410

No files matched your search

File diff suppressed because it is too large. Load diff
+128
View File
@@ -0,0 +1,128 @@
/* Metro module 4650; source: lib/uploader/Upload.tsx; dependencies: [6, 7, 15, 17, 18, 4651, 22, 4655, 491, 639, 2] */
function _fun40122(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40122, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:6, offset: 0x010f6cfc, size: 320 bytes, params: 8, frame: 21
var object3;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = importDefault(6) /* metro dependency 6 */;
const env0_5 = importDefault(7) /* metro dependency 7 */;
const env0_6 = importDefault(15) /* metro dependency 15 */;
const env0_7 = importDefault(17) /* metro dependency 17 */;
const env0_8 = importDefault(18) /* metro dependency 18 */;
object3 = {REACT_NATIVE: 0};
object3[0] = 'REACT_NATIVE';
object3.WEB = 1;
object3[1] = 'WEB';
const object4 = {FILE_ATTACHMENT: 0};
object4[0] = 'FILE_ATTACHMENT';
object4.IMAGE_PICKER = 1;
object4[1] = 'IMAGE_PICKER';
object4.IMAGE_EDITOR = 2;
object4[2] = 'IMAGE_EDITOR';
const EventEmitter = (require(639) /* metro dependency 639 */).EventEmitter;
const value = _fun40126(EventEmitter);
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/Upload.tsx');
exports.default = value;
exports.UploadPlatform = object3;
exports.isResolvedUpload = function(a0) {
return a0.isVideo !== undefined && a0.isImage !== undefined;
};
exports.UploadOrigin = object4;
}
function _isNativeReflectConstruct_40123() { // fn#40123, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:148, offset: 0x010f6e3c, 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_40123_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun40126(a0) { // fn#40126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:570, offset: 0x010f6e9a, size: 91 bytes, params: 2, frame: 16
const closure = Upload;
env0_8(closure, a0);
return env0_5(closure, [{key: 'cancel', value: function() {
}}, {key: 'resetState', value: function() {
return this;
}}]);
}
function Upload(a0) { // fn#40127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4828:582, offset: 0x010f6ef5, size: 579 bytes, params: 2, frame: 21
var moduleValue;
var classifyFile;
var file;
var classification;
var moduleValue2;
var getFile;
var filename;
var value8;
const value = environment.__proto__;
env1_4(this, Upload);
const value3 = env1_7(Upload);
const value6 = env1_6(this, _isNativeReflectConstruct_40123() ? global.Reflect.construct(value3, [],
env1_7(this).constructor) : value3.apply(this, undefined));
value6.allowOptimization = true;
value6.item = a0;
const platform = a0.platform;
const REACT_NATIVE = env1_9.REACT_NATIVE;
if (platform === REACT_NATIVE) {
value6.id = a0.id ?? a0.uri;
moduleValue2 = require(4651) /* metro dependency 4651: UploadUtils */;
getFile = moduleValue2.getFile;
filename = a0.filename;
value8 = Reflect.apply(getFile, moduleValue2, [{uri: a0.uri, overrideFilename: filename,
overrideType: a0.mimeType}]);
filename = value8.filename;
value6.filename = filename;
value6.isImage = value8.isImage;
value6.isVideo = value8.isVideo;
value6.mimeType = value8.type;
value6.origin = a0.origin;
value6.durationSecs = a0.durationSecs;
value6.waveform = a0.waveform;
} else {
value6.id = a0.id ?? (importDefault(22) /* metro dependency 22 */).uniqueId('upload');
moduleValue = importAll(4655) /* metro dependency 4655: FileUtils */;
classifyFile = moduleValue.classifyFile;
file = a0.file;
value6.classification = Reflect.apply(classifyFile, moduleValue, [file]);
classification = value6.classification;
value6.isImage = classification === 'image';
classification = value6.classification;
value6.isVideo = classification === 'video';
file = a0.file;
value6.filename = file.name;
file = a0.file;
value6.mimeType = file.type;
value6.origin = a0.origin;
}
value6.isThumbnail = a0.isThumbnail;
value6.clip = a0.clip;
value6.uniqueId = (require(491) /* metro dependency 491 */).v4();
value6.spoiler = false;
value6.description = null;
return value6;
}
+71
View File
@@ -0,0 +1,71 @@
/* Metro module 4692; source: lib/uploader/UploadTargets.tsx; dependencies: [6, 7, 1379, 661, 4655, 4651, 4693, 4695, 2] */
function _fun40570(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:6, offset: 0x0110535c, size: 256 bytes, params: 8, frame: 20
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = importDefault(6) /* metro dependency 6 */;
const env0_5 = importDefault(7) /* metro dependency 7 */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_7 = constantsModule.Endpoints;
const env0_8 = constantsModule.MAX_UPLOAD_COUNT;
const env0_9 = _fun40571();
object2 = {MESSAGE_ATTACHMENT: 0};
object2[0] = 'MESSAGE_ATTACHMENT';
object2.GUILD_PRODUCT_ATTACHMENT = 1;
object2[1] = 'GUILD_PRODUCT_ATTACHMENT';
object2.GRAVITY_ATTACHMENT = 2;
object2[2] = 'GRAVITY_ATTACHMENT';
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/UploadTargets.tsx');
exports.UploadTargets = object2;
exports.getUploadTarget = getUploadTarget;
}
function _fun40571() { // fn#40571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:173, offset: 0x0110545c, size: 176 bytes, params: 1, frame: 15
return env0_5(MessageAttachmentUploadTarget, [{key: 'getCreateAttachmentURL', value: function(a0) {
return Endpoints.MESSAGE_CREATE_ATTACHMENT_UPLOAD(a0);
}}, {key: 'getDeleteUploadURL', value: function(a0) {
return Endpoints.MESSAGE_DELETE_UPLOAD(a0);
}}, {key: 'getMaxFileSize', value: value_40575}, {key: 'getMaxAttachmentsCount', value: function() {
return MAX_UPLOAD_COUNT;
}}, {key: 'getMaxTotalAttachmentSize', value: function() {
return require(dependencyMap[5]).MAX_TOTAL_ATTACHMENT_SIZE;
}}, {key: 'shouldReactNativeCompressUploads', get: function() {
return true;
}}]);
}
function getUploadTarget(a0) { // fn#40579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:1077, offset: 0x011055a1, size: 158 bytes, params: 2, frame: 12
var value3;
var value4;
var value;
const GUILD_PRODUCT_ATTACHMENT = env0_10.GUILD_PRODUCT_ATTACHMENT;
if (GUILD_PRODUCT_ATTACHMENT === a0) {
value = importDefault(4693) /* metro dependency 4693: GuildProductAttachmentUploadTarget */;
value4 = Object.create(value.prototype, {constructor: {value: value}});
value = new value();
return value instanceof Object ? value : value4;
}
const GRAVITY_ATTACHMENT = env0_10.GRAVITY_ATTACHMENT;
if (GRAVITY_ATTACHMENT === a0) {
value = importDefault(4695) /* metro dependency 4695: ICYMIAttachmentUploadTarget */;
value3 = Object.create(value.prototype, {constructor: {value: value}});
value = new value();
return value instanceof Object ? value : value3;
}
env0_10.MESSAGE_ATTACHMENT;
const binding = env0_9;
value = Object.create(binding.prototype, {constructor: {value: binding}});
const binding2 = new binding();
return binding2 instanceof Object ? binding2 : value;
}
function value_40575(a0) { // fn#40575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4870:479, offset: 0x0110553a, size: 70 bytes, params: 2, frame: 13
let value = environment.__proto__;
const basicChannel = ChannelStore.getBasicChannel(a0);
value = undefined;
const fileUtilsModule = importAll(4655) /* metro dependency 4655: FileUtils */;
return fileUtilsModule.maxFileSize(basicChannel == null ? value : basicChannel.guild_id);
}
+235
View File
@@ -0,0 +1,235 @@
/* Metro module 4658; source: lib/uploader/UploadUtils.tsx; dependencies: [6, 7, 4650, 507, 4659, 1873, 2] */
function _fun40246(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40246, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:6, offset: 0x010fa529, size: 180 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
let value = _fun40247();
const value2 = _fun40251();
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/UploadUtils.tsx');
exports.doesImageMatchUpload = doesImageMatchUpload;
exports.calculateProgress = function(a0, a1) {
var value = 0;
return value === a1 ? value : global.Math.min(global.Math.floor(a0 / a1 * 100), 100);
};
exports.DefaultHttpClient = value;
exports.canUploadNatively = canUploadNatively;
exports.LibdiscoreHttpClient = value2;
}
function _fun40247() { // fn#40247, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:122, offset: 0x010fa5dd, size: 80 bytes, params: 1, frame: 15
return env0_3(DefaultHttpClient, [{key: 'sliceBody', value: function(a0, a1) {
var r0;
var value = a0;
if (value instanceof global.File) {
value = value.slice(a1);
r0 = value;
} else {
r0 = value;
}
return r0;
}}, {key: 'doUpload', value: function(a0, a1) {
if (a1?.fileByteRange != null) {
a0.body = this.sliceBody(a0.body, a1.fileByteRange.start);
}
return require(dependencyMap[3]).HTTP.put(a0);
}}]);
}
function _fun40251() { // fn#40251, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:448, offset: 0x010fa6be, size: 55 bytes, params: 1, frame: 14
return env0_3(LibdiscoreHttpClient, [{key: 'doUpload', value: value_40253}]);
}
function doesImageMatchUpload(a0, a1) { // fn#40256, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:1993, offset: 0x010fab0b, size: 176 bytes, params: 3, frame: 15
var item;
const UploadPlatform = (require(4650) /* metro dependency 4650: Upload */).UploadPlatform;
var filename;
var originalUri;
if (a1.id === a0.uri) {
return true;
}
if (a1.id == null) {
item = a1.item;
if (item.platform === UploadPlatform.REACT_NATIVE) {
item = a1.item;
filename = a0.filename;
originalUri = item.originalUri;
if (originalUri === a0.uri) {
return true;
}
if (filename == null) {
return false;
}
originalUri = item.originalUri;
if (originalUri == null) {
return false;
}
if (originalUri.includes(filename)) {
return true;
}
return false;
}
} else {
if (a1.id === a0.id) {
return true;
}
item = a1.item;
if (item.platform === UploadPlatform.REACT_NATIVE) {
item = a1.item;
filename = a0.filename;
originalUri = item.originalUri;
if (originalUri === a0.uri) {
return true;
}
if (filename == null) {
return false;
}
originalUri = item.originalUri;
if (originalUri == null) {
return false;
}
if (originalUri.includes(filename)) {
return true;
}
return false;
}
}
return false;
}
function canUploadNatively(a0) { // fn#40258, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:2423, offset: 0x010fabf8, size: 138 bytes, params: 2, frame: 15
var moduleValue;
const platform = a0.platform;
var value;
const UploadPlatform = (require(4650) /* metro dependency 4650: Upload */).UploadPlatform;
const REACT_NATIVE = UploadPlatform.REACT_NATIVE;
let r0 = platform === REACT_NATIVE && a0.uri != null;
if (r0) {
moduleValue = require(4659) /* metro dependency 4659: AttachmentFileNative */;
r0 = moduleValue.fileIsInAppDir(a0.uri);
}
if (r0) {
value = require(1873) /* metro dependency 1873: shimNative */;
value = value.isLibdiscoreInitialized();
r0 = value;
}
return r0;
}
function LibdiscoreHttpClient() { // fn#40252, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:469, offset: 0x010fa6f5, size: 96 bytes, params: 1, frame: 14
let value = environment.__proto__;
env1_2(this, LibdiscoreHttpClient);
value = require(1873) /* metro dependency 1873: shimNative */;
if (value.isLibdiscoreInitialized()) {
return undefined;
}
const Error = global.Error;
throw new Error('Libdiscore is not loaded');
}
function value_40253(a0, a1) { // fn#40253, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:637, offset: 0x010fa755, size: 426 bytes, params: 3, frame: 20
var environment;
var r1;
var value5;
let env0_0 = a0;
let value = environment.__proto__;
value = undefined;
const httpClientAPI = (require(1873) /* metro dependency 1873: shimNative */).getHttpClientAPI();
if (httpClientAPI == null) {
throw new global.Error('Libdiscore client is not available');
}
let body = a0.body;
let uri = body == null ? value : body.uri;
if (value !== uri && typeof a0.body.uri === 'string') {
body = a0.body;
uri = body.uri;
value5 = uri.startsWith('file://');
body = a0.body;
uri = body.uri;
r1 = value5 ? uri.slice(7) : uri;
} else {
r1 = value;
}
if (value === r1) {
throw new global.Error('No file path found in request body');
}
if (r1 === '') {
throw new global.Error('No file path found in request body');
}
let env0_2 = httpClientAPI.httpRequest(a0.url, {method: 'PUT', body: {path: r1,
byteRangeStart: a1 == null || a1.fileByteRange == null ? value : a1.fileByteRange.start,
byteRangeEnd: a1 == null || a1.fileByteRange == null ? value : a1.fileByteRange.end}, headers: a0.headers});
const Promise = global.Promise;
value = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(function(a0, a1) {
var env0_0 = a0;
var env0_1 = a1;
var closure = _fun40255;
var env0_2 = closure;
closure();
});
return promise instanceof Object ? promise : value;
}
function _fun40254(a0, a1) { // fn#40254, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:1196, offset: 0x010fa8ff, size: 33 bytes, params: 3, frame: 9
const env0_0 = a0;
const env0_1 = a1;
pollStatus();
}
function pollStatus() { // fn#40255, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4836:1219, offset: 0x010fa920, size: 491 bytes, params: 1, frame: 18
var binding;
var httpRequestStatus;
var Error;
var error;
var object2;
var response;
var value5;
const value = environment.__proto__;
const signal = env1_0.signal;
if (signal == null) {
httpRequestStatus = env1_1.getHttpRequestStatus(env1_2);
} else {
if (signal.aborted) {
Error = global.Error;
value5 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('Request cancelled');
require(error instanceof Object ? error : value5);
env1_1.cancelHttpRequest(env1_2);
return undefined;
}
httpRequestStatus = env1_1.getHttpRequestStatus(env1_2);
}
const value3 = undefined;
if ((httpRequestStatus == null ? value3 : httpRequestStatus.status) === 'success') {
binding = env0_0;
object2 = {};
response = httpRequestStatus.response;
object2.status = response == null ? value3 : response.status;
response = httpRequestStatus.response;
object2.headers = response == null ? value3 : response.headers;
response = httpRequestStatus.response;
object2.text = response == null ? value3 : response.body;
binding(object2);
} else if ((httpRequestStatus == null ? value3 : httpRequestStatus.status) === 'error') {
Error = global.Error;
error = httpRequestStatus.error;
error = new Error();
require(error);
} else if ((httpRequestStatus == null ? value3 : httpRequestStatus.status) === 'progressing') {
if (value3 !== env1_0.onRequestProgress) {
if (httpRequestStatus.uploaded_bytes != null) {
if (httpRequestStatus.uploaded_bytes > 0) {
env1_0.onRequestProgress({loaded: httpRequestStatus.uploaded_bytes,
total: httpRequestStatus.total_bytes});
}
}
}
global.setTimeout(pollStatus, 50);
} else {
require(new global.Error('Unknown upload status'));
}
return value3;
}
+889
View File
@@ -0,0 +1,889 @@
/* Metro module 7227; source: lib/uploader/UploaderBase.tsx; dependencies: [5, 6, 7, 15, 17, 18, 661, 4503, 3, 4658, 22, 4692, 4697, 4659, 639, 2] */
function _fun57858(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57858, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:6, offset: 0x016b7d68, size: 332 bytes, params: 8, frame: 19
const env0_0 = require;
const _arrayLikeToArray_57861 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
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) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const env0_4 = importDefault(6) /* metro dependency 6 */;
const env0_5 = importDefault(7) /* metro dependency 7 */;
const env0_6 = importDefault(15) /* metro dependency 15 */;
const env0_7 = importDefault(17) /* metro dependency 17 */;
const env0_8 = importDefault(18) /* metro dependency 18 */;
const env0_9 = (require(661) /* metro dependency 661: Constants */).AbortCodes;
const env0_10 = (require(4503) /* metro dependency 4503: MessageConstants */).FileUploadErrorTypes;
let value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('UploaderBase.tsx');
const EventEmitter = (require(639) /* metro dependency 639 */).EventEmitter;
value = _fun57865(EventEmitter);
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/UploaderBase.tsx');
exports.default = value;
}
function _createForOfIteratorHelperLoose_57859(a0, a1) { // fn#57859, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:214, offset: 0x016b7eb4, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun57860;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_57861(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_57861(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_57861(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun57860;
}
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 _isNativeReflectConstruct_57862() { // fn#57862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:1124, offset: 0x016b8026, 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_57862_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun57865(a0) { // fn#57865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:1358, offset: 0x016b8084, size: 344 bytes, params: 2, frame: 17
const closure = UploaderBase;
env0_8(closure, a0);
const binding = env0_5;
const items2 = [{key: '_fileSize', value: function() {
return this.files.reduce(_fun57875, 0);
}}];
const binding2 = env0_3;
const env0_1 = binding2(_fun57877);
items2[1] = {key: 'compressAndCheckFileSize', value: value_57878};
items2[2] = {key: 'setUploadingTextForUI', value: value_57879};
items2[3] = {key: '_recomputeProgress', value: function() {
var value = this._recomputeProgressTotal();
this._handleProgress(value.loaded, value.total, this._recomputeProgressByFile());
}};
items2[4] = {key: '_recomputeProgressTotal', value: function() {
var value = this._fileSize();
var object = {};
object.loaded = this.files.reduce(_fun57884, 0);
object.total = value;
return object;
}};
items2[5] = {key: '_recomputeProgressByFile', value: function() {
this.files.forEach(_fun57886);
return {};
}};
items2[6] = {key: '_addAttachmentsToPayload', value: value_57887};
items2[7] = {key: 'clearProcessingMessageInterval', value: function() {
if (this.processingMessageChangeInterval != null) {
global.clearInterval(this.processingMessageChangeInterval);
this.processingMessageChangeInterval = undefined;
}
}};
items2[8] = {key: 'cancel', value: value_57889};
const env0_0 = binding2(_fun57892);
items2[9] = {key: 'cancelItem', value: value_57894};
items2[10] = {key: 'upload', value: function(a0) {
if (this._cancel != null) {
throw new global.Error('Uploader.upload(...): An upload is already in progress.');
}
this._lastUpdate = global.Date.now();
this._loaded = 0;
this._file = {'id': null, 'currentSize': 0, 'totalPreCompressionSize': 0, 'compressionProgress': 0,
'progress': 0,
'rate': 0, 'hasImage': false, 'hasVideo': false, 'attachmentsCount': 0, id: this.id, items: a0};
}};
return binding(closure, items2);
}
function UploaderBase() { // fn#57866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:1370, offset: 0x016b81dc, size: 303 bytes, params: 1, frame: 21
var environment;
const value = environment.__proto__;
env1_4(this, UploaderBase);
const value3 = env1_7(UploaderBase);
const value6 = env1_6(this, _isNativeReflectConstruct_57862() ? global.Reflect.construct(value3, [],
env1_7(this).constructor) : value3.apply(this, undefined));
value6._aborted = false;
value6._errored = false;
value6.files = [];
value6._lastUpdate = 0;
value6._loaded = 0;
value6.alreadyStarted = false;
value6._handleStart = _handleStart;
value6._handleProgress = _handleProgress;
value6._handleException = _handleException;
value6._handleAborted = _handleAborted;
value6._handleError = _handleError;
value6._handleComplete = _handleComplete;
value6.id = (importDefault(22) /* metro dependency 22 */).uniqueId('Uploader');
value6._file = {'id': null, 'currentSize': 0, 'totalPreCompressionSize': 0, 'compressionProgress': 0, 'progress': 0,
'rate': 0, 'hasImage': false, 'hasVideo': false, 'attachmentsCount': 0, id: value6.id, items: undefined};
return value6;
}
function value_57874() { // fn#57874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:2862, offset: 0x016b85e2, size: 32 bytes, params: 1, frame: 13
return this.files.reduce(function(a0, {currentSize}) {
return a0 + (currentSize ?? 0);
}, 0);
}
function* _fun57877() { // fn#57877, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:3002, offset: 0x016b862b, size: 775 bytes, params: 1, frame: 34
var r5;
var r19;
var r1;
var object3;
var concat;
var reactNativeCompressAndExtractData;
var value12;
var value13;
var value14;
var isCancelled;
var isCancelled2;
var currentSize;
var value15;
var value16;
var binding2;
var value17;
var getEffectiveKestrelLimit;
var getMaxFileSize;
var channelId;
var value18;
var value19;
var value20;
var value21;
var _handleError;
var ENTITY_TOO_LARGE;
var object4;
var POSTCOMPRESSION_INDIVIDUAL_FILE_TOO_LARGE;
var ENTITY_EMPTY;
var value22;
var value23;
var error;
var _handleException;
var _fileSize;
var getMaxTotalAttachmentSize;
var POSTCOMPRESSION_SUM_TOO_LARGE;
if (false) {
return undefined;
}
value = undefined;
let binding = env2_0;
const value4 = binding(env2_2[11]);
const getUploadTarget = value4.getUploadTarget;
const files = this.files;
const value5 = 0;
let property = files[value5];
const value6 = Reflect.apply(getUploadTarget, value4,
[property == null || property.item == null ? value : property.item.target]);
const length = this.files.length;
const getMaxAttachmentsCount = value6.getMaxAttachmentsCount;
if (length > Reflect.apply(getMaxAttachmentsCount, value6, [])) {
binding = env2_11;
binding.log('Too many attachments for ' + this.id);
this._handleError({code: env2_9.TOO_MANY_ATTACHMENTS});
return false;
}
const kestrelConfig = env2_0(env2_2[12]).getKestrelConfig({location: 'UploaderBase.compressAndCheckFileSize'});
binding = env2_11;
let log = binding.log;
let id = this.id;
let HermesInternal = global.HermesInternal;
Reflect.apply(log, binding, ['compressing files for ' + id]);
const value9 = env2_12(this.files);
const value10 = value9();
let done = value10.done;
if (done) {
value = this._fileSize();
value = value > value6.getMaxTotalAttachmentSize();
if (value) {
this._handleError({code: env2_9.ENTITY_TOO_LARGE, reason: {type: env2_10.POSTCOMPRESSION_SUM_TOO_LARGE}});
r1 = 1;
} else {
r1 = value;
}
return !r1;
}
let r13 = value10;
let value11 = r13.value;
reducibleLoop7: while (true) {
try {
reactNativeCompressAndExtractData = value11.reactNativeCompressAndExtractData;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
value12 = Reflect.apply(reactNativeCompressAndExtractData, value11, []);
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
yield value12;
try {
value13 = undefined;
value14 = false;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
if (value14) {
return value13;
}
try {
isCancelled = value11.isCancelled;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
isCancelled2 = Reflect.apply(isCancelled, value11, []);
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
if (isCancelled2) {
try {
binding = env2_11;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
log = binding.log;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
id = value11.id;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
HermesInternal = global.HermesInternal;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
concat = HermesInternal.concat;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
value22 = 'compressAndCheckFileSize() file has been cancelled for compression - ' + id;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
Reflect.apply(log, binding, [value22]);
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
} else {
try {
currentSize = value11.currentSize;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
value15 = currentSize != null;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
reducibleJoin23: while (true) {
if (value15) {
r5 = currentSize;
break reducibleJoin23;
}
r5 = value5;
break reducibleJoin23;
}
try {
value16 = value5 === r5;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
if (value16) {
try {
_handleError = this._handleError;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
object3 = {};
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
binding = env2_9;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
ENTITY_EMPTY = binding.ENTITY_EMPTY;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
object3.code = ENTITY_EMPTY;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
Reflect.apply(_handleError, this, [object3]);
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
return false;
}
try {
binding = env2_0;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
binding2 = env2_2;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
property = binding2[12];
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
value17 = binding(property);
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
getEffectiveKestrelLimit = value17.getEffectiveKestrelLimit;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
getMaxFileSize = value6.getMaxFileSize;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
channelId = value11.channelId;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
value18 = Reflect.apply(getMaxFileSize, value6, [channelId]);
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
value19 = Reflect.apply(getEffectiveKestrelLimit, value17, [kestrelConfig, value18]);
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
currentSize = value11.currentSize;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
value20 = currentSize != null;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
reducibleJoin40: while (true) {
if (value20) {
r19 = currentSize;
break reducibleJoin40;
}
r19 = value5;
break reducibleJoin40;
}
try {
value21 = r19 > value19;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
reducibleJoin69: while (true) {
if (value21) {
try {
_handleError = this._handleError;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
object3 = {};
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
binding = env2_9;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
ENTITY_TOO_LARGE = binding.ENTITY_TOO_LARGE;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
object3.code = ENTITY_TOO_LARGE;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
object4 = {};
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
binding = env2_10;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
POSTCOMPRESSION_INDIVIDUAL_FILE_TOO_LARGE = binding.POSTCOMPRESSION_INDIVIDUAL_FILE_TOO_LARGE;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
object4.type = POSTCOMPRESSION_INDIVIDUAL_FILE_TOO_LARGE;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
object3.reason = object4;
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
try {
Reflect.apply(_handleError, this, [object3]);
} catch (error) {
_handleException = this._handleException;
Reflect.apply(_handleException, this, [error]);
return false;
}
return false;
}
break reducibleJoin69;
}
}
value23 = value9();
done = value23.done;
if (done) {
_fileSize = this._fileSize;
value = Reflect.apply(_fileSize, this, []);
getMaxTotalAttachmentSize = value6.getMaxTotalAttachmentSize;
value = value > Reflect.apply(getMaxTotalAttachmentSize, value6, []);
reducibleJoin74: while (true) {
if (value) {
_handleError = this._handleError;
ENTITY_TOO_LARGE = env2_9.ENTITY_TOO_LARGE;
POSTCOMPRESSION_SUM_TOO_LARGE = env2_10.POSTCOMPRESSION_SUM_TOO_LARGE;
Reflect.apply(_handleError, this, [{code: ENTITY_TOO_LARGE,
reason: {type: POSTCOMPRESSION_SUM_TOO_LARGE}}]);
value = 1;
r1 = value;
break reducibleJoin74;
}
r1 = value;
break reducibleJoin74;
}
return !r1;
}
r13 = value23;
value11 = r13.value;
continue reducibleLoop7;
}
}
function value_57879() { // fn#57879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:4258, offset: 0x016b8932, size: 229 bytes, params: 1, frame: 24
const value = this.files.some(function(a0) {
return a0.isImage;
});
const value2 = this.files.some(function(a0) {
return a0.isVideo;
});
const value3 = this._fileSize();
const binding = env1_11;
const log = binding.log;
const length = this.files.length;
Reflect.apply(log, binding,
['setUploadingTextForUI - total content: ' + value3 + ' bytes and ' + length + ' attachments for ' + this.id]);
const object2 = {};
copyDataProperties(object2, this._file, length);
object2['totalPostCompressionSize'] = value3;
object2['currentSize'] = value3;
object2['hasVideo'] = value2;
object2['hasImage'] = value;
object2['attachmentsCount'] = this.files.length;
object2['items'] = this.files;
this._file = object2;
}
function value_57883() { // fn#57883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:4817, offset: 0x016b8a65, size: 54 bytes, params: 1, frame: 15
const value = this._fileSize();
const object2 = {};
object2.loaded = this.files.reduce(function(a0, {loaded}) {
return a0 + (loaded ?? 0);
}, 0);
object2.total = value;
return object2;
}
function value_57885() { // fn#57885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:4985, offset: 0x016b8abb, size: 34 bytes, params: 1, frame: 12
this.files.forEach(_fun57886);
return {};
}
function value_57887(a0, a1, a2) { // fn#57887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:5140, offset: 0x016b8b23, size: 102 bytes, params: 4, frame: 19
const object2 = {};
copyDataProperties(object2, a0, undefined);
let value = environment.__proto__;
value = importDefault(22) /* metro dependency 22 */;
const value2 = value.get(object2, a1, []);
const items2 = [];
arraySpread(items2, a2, arraySpread(items2, value2, 0, value), value);
return (importDefault(22) /* metro dependency 22 */).set(object2, a1, items2);
}
function value_57889() { // fn#57889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:5450, offset: 0x016b8bb7, size: 126 bytes, params: 1, frame: 14
var _cancel;
const binding = env1_11;
binding.log('cancel() for ' + this.id);
if (!this._aborted) {
this._aborted = true;
_cancel = this._cancel;
if (_cancel != null) {
_cancel.call(this);
}
this.files.forEach(function(a0) {
return a0.cancel();
});
this._handleComplete();
}
}
function* _fun57892(a0) { // fn#57892, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:5662, offset: 0x016b8c4d, size: 360 bytes, params: 2, frame: 21
var environment;
if (true) {
var env0_0 = a0;
value = environment.__proto__.__proto__;
var binding = env2_11;
binding.log('Cancel called for ' + this.id + ' for item ' + a0);
var files = this.files;
var value3 = files.find(_fun57893);
if (value3 != null) {
if (value3.isCancelled()) {
return undefined;
}
files = this.files;
var value4 = files.indexOf(value3);
files = this.files;
var slice = files.slice;
var value5 = Reflect.apply(slice, files, [0, value4]);
var object = [];
var value6 = arraySpread(object, value5, 0, value4);
files = this.files;
slice = files.slice;
arraySpread(object, Reflect.apply(slice, files, [value4 + 1]), value6, value4);
this.files = object;
object = {};
var _file = this._file;
copyDataProperties(object, _file, value6);
files = this.files;
object['items'] = files;
this._file = object;
value = env2_0(env2_2[13]);
yield value.cancelGetAttachmentFile(value3);
value = undefined;
if (false) {
return value;
}
value3.cancel();
var emit = this.emit;
_file = this._file;
Reflect.apply(emit, this, ['cancel-upload-item', _file]);
files = this.files;
if (files.length === 0) {
this.cancel();
}
}
}
}
function _handleStart(a0) { // fn#57867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:1683, owner: UploaderBase._handleStart, offset: 0x016b830b, size: 67 bytes, params: 2, frame: 14
let binding = env0_0;
binding._cancel = a0;
if (!binding.alreadyStarted) {
binding = env0_0;
binding.emit('start', binding._file);
}
env0_0.alreadyStarted = true;
}
function _handleProgress(a0, a1, a2) { // fn#57868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:1780, owner: UploaderBase._handleProgress, offset: 0x016b834e, size: 252 bytes, params: 4, frame: 22
var items2;
const env0_0 = a2;
const Date = global.Date;
const value = Date.now();
const value3 = (require(4658) /* metro dependency 4658: UploadUtils */).calculateProgress(a0, a1);
const Math = global.Math;
const floor = Math.floor;
let binding = env0_0;
const value5 = a0 - binding._loaded;
const value6 = value - binding._lastUpdate;
const value7 = Reflect.apply(floor, Math, [value5 / (value6 / 1000)]);
if (a2 != null) {
items2 = env0_0._file.items;
if (items2 != null) {
items2.forEach(function(a0) {
a0.item.progress = importDefault[a0.id];
});
}
}
binding = env0_0;
binding._lastUpdate = value;
binding._loaded = a0;
const object2 = {};
copyDataProperties(object2, binding._file, value6);
object2['currentSize'] = a1;
object2['progress'] = value3;
object2['rate'] = value7;
binding._file = object2;
binding.emit('progress', binding._file);
}
function _handleException(a0) { // fn#57870, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:2101, owner: UploaderBase._handleException, offset: 0x016b846c, size: 65 bytes, params: 2, frame: 14
const binding = env0_0;
const _handleError = binding._handleError;
const object = {};
const ERROR_SOURCE_UNKNOWN = FileUploadErrorTypes.ERROR_SOURCE_UNKNOWN;
object.type = ERROR_SOURCE_UNKNOWN;
object.msg = a0.toString();
Reflect.apply(_handleError, binding, [{reason: object}]);
}
function _handleAborted() { // fn#57871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:2195, owner: UploaderBase._handleAborted, offset: 0x016b84ad, size: 21 bytes, params: 1, frame: 9
env0_0.clearProcessingMessageInterval();
}
function _handleError({code, reason, body}) { // fn#57872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:2251, owner: UploaderBase._handleError, offset: 0x016b84c2, size: 184 bytes, params: 2, frame: 24
var binding2;
var log;
var value;
let binding = env0_0;
binding.clearProcessingMessageInterval();
if (!binding._aborted) {
binding = env0_0;
binding._errored = true;
value = environment.__proto__.__proto__;
binding2 = env2_11;
log = binding2.log;
value = global.JSON.stringify(reason);
Reflect.apply(log, binding2, ['_handleError: ' + code + ' (' + value + ') for ' + binding.id]);
binding.emit('error', binding._file, code, body, reason);
binding.removeAllListeners();
}
}
function _handleComplete(a0) { // fn#57873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:2478, owner: UploaderBase._handleComplete, offset: 0x016b857a, size: 104 bytes, params: 2, frame: 16
const binding = env0_0;
binding.clearProcessingMessageInterval();
const binding2 = env2_11;
binding2.log('_handleComplete for ' + binding.id);
binding.emit('complete', binding._file, a0);
binding.removeAllListeners();
}
function _fun57886({id, loaded, currentSize}) { // fn#57886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7405:5032, offset: 0x016b8add, size: 70 bytes, params: 2, frame: 16
const binding = env0_0;
let value = environment.__proto__.__proto__;
value = require(4658) /* metro dependency 4658: UploadUtils */;
binding[id] = value.calculateProgress(loaded, currentSize);
}
+192
View File
@@ -0,0 +1,192 @@
/* Metro module 7225; source: lib/uploader/UploaderQueue.tsx; dependencies: [5, 6, 7, 3, 2] */
function _fun57838(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:6, offset: 0x016b7650, size: 202 bytes, params: 8, frame: 18
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_0 = importDefault(5) /* metro dependency 5 */;
const env0_1 = importDefault(6) /* metro dependency 6 */;
const env0_2 = importDefault(7) /* metro dependency 7 */;
let value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('UploaderQueue.tsx');
value = _fun57839();
value = new value();
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/UploaderQueue.tsx');
exports.default = value;
}
function _fun57839() { // fn#57839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:166, offset: 0x016b771a, size: 96 bytes, params: 1, frame: 17
const binding = env0_2;
const closure = UploaderQueue;
const items2 = [{key: 'enqueue', value: value_57841}];
const env0_0Binding = env0_0(_fun57843);
items2[1] = {key: 'drainQueue', value: value_57847};
return binding(closure, items2);
}
function UploaderQueue() { // fn#57840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:187, offset: 0x016b777a, size: 45 bytes, params: 1, frame: 13
env1_1(this, UploaderQueue);
this.queue = [];
this.drainingQueue = false;
}
function value_57841(a0) { // fn#57841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:294, offset: 0x016b77a7, size: 93 bytes, params: 2, frame: 13
this.queue.unshift(a0);
const value = environment.__proto__;
const binding = env1_3;
binding.log('enqueue() - alreadying draining? ' + (this.drainingQueue ? 'yes' : 'no'));
if (!this.drainingQueue) {
this.drainQueue();
}
}
function* _fun57843() { // fn#57843, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:473, offset: 0x016b780d, size: 298 bytes, params: 1, frame: 21
var environment;
var value4;
var Promise;
var prototype;
var closure;
var promise;
var value6;
var value7;
var value8;
var id;
var value9;
var error;
var error2;
var drainQueue;
if (true) {
var env0_0;
this.drainingQueue = true;
value = environment.__proto__.__proto__;
var binding = env2_3;
var log = binding.log;
Reflect.apply(log, binding, ['drainQueue() - starting, queue length: ' + this.queue.length]);
var value3 = this.queue.pop();
if (value3 == null) {
env2_3.log('drainQueue() - No uploads left, setting drainingQueue to false');
this.drainingQueue = false;
} else {
reducibleJoin3: while (true) {
reduciblePort29: while (true) {
exceptionLanding28: while (true) {
try {
binding = env2_3;
} catch (error) {
break exceptionLanding28;
}
break reducibleJoin3;
}
binding = env2_3;
error2 = binding.error;
Reflect.apply(error2, binding, [error]);
break reduciblePort29;
}
drainQueue = this.drainQueue;
Reflect.apply(drainQueue, this, []);
return undefined;
}
try {
log = binding.log;
} catch (error) {
break exceptionLanding28;
}
try {
Reflect.apply(log, binding, ['drainQueue() - start uploader']);
} catch (error) {
break exceptionLanding28;
}
try {
value4 = value3();
} catch (error) {
break exceptionLanding28;
}
try {
env0_0 = value4;
} catch (error) {
break exceptionLanding28;
}
try {
Promise = global.Promise;
} catch (error) {
break exceptionLanding28;
}
try {
prototype = Promise.prototype;
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
closure = _fun57844;
} catch (error) {
break exceptionLanding28;
}
try {
promise = new Promise();
} catch (error) {
break exceptionLanding28;
}
try {
value6 = promise instanceof Object ? promise : undefined;
} catch (error) {
break exceptionLanding28;
}
yield value6;
try {
value7 = undefined;
value8 = false;
} catch (error) {
break exceptionLanding28;
}
if (value8) {
return value7;
}
try {
binding = env2_3;
} catch (error) {
break exceptionLanding28;
}
try {
log = binding.log;
} catch (error) {
break exceptionLanding28;
}
try {
id = value4.id;
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
value9 = 'drainQueue() Uploader complete - ' + id;
} catch (error) {
break exceptionLanding28;
}
try {
Reflect.apply(log, binding, [value9]);
} catch (error) {
break exceptionLanding28;
}
this.drainQueue();
}
}
}
function _fun57844(a0) { // fn#57844, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7403:789, offset: 0x016b7937, size: 98 bytes, params: 2, frame: 15
const env0_0 = a0;
if (env0_0._aborted || env0_0._errored) {
a0();
}
env0_0.addListener('complete', _fun57845);
env0_0.addListener('error', _fun57846);
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,87 @@
/* Metro module 4691; source: lib/uploader/native/CloudUploaderUtils.tsx; dependencies: [1949, 1226, 691, 4651, 22, 683, 2] */
function _fun40565(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:6, offset: 0x011050d7, size: 183 bytes, params: 8, frame: 20
var object2;
const env0_0 = require;
const closure = getUploadPayload;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const developerOptionsStore = importDefault(691) /* metro dependency 691: DeveloperOptionsStore */;
object2 = {getUploadPayload: closure};
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/native/CloudUploaderUtils.tsx');
exports.default = object2;
exports.prepareMessagePayload = prepareMessagePayload;
exports.getUploadPayload = closure;
}
function _prepareMessageRequestBodyCloud(a0, a1, a2) { // fn#40566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:126, offset: 0x0110518e, size: 166 bytes, params: 4, frame: 21
var r0;
var object3;
var object4;
var value;
var value2;
var items2;
const items3 = [];
a0.forEach(_fun40567);
if (a2 == null) {
object3 = {};
copyDataProperties(object3, a1, undefined);
object3['attachments'] = items3;
r0 = object3;
} else if (a1 != null) {
object4 = {};
copyDataProperties(object4, a1, undefined);
value = importDefault(22) /* metro dependency 22 */;
value2 = value.get(object4, a2, []);
items2 = [];
arraySpread(items2, items3, arraySpread(items2, value2, 0, value), value);
value = importDefault(22) /* metro dependency 22 */;
value = value.set(object4, a2, items2);
r0 = value;
} else {
object3 = {};
copyDataProperties(object3, a1, undefined);
object3['attachments'] = items3;
r0 = object3;
}
return r0;
}
function getUploadPayload({filename, currentSize}) { // fn#40568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:425, offset: 0x0110527b, size: 73 bytes, params: 2, frame: 12
const object2 = {};
object2.filename = filename;
object2.file_size = currentSize;
object2.id = (importDefault(22) /* metro dependency 22 */).uniqueId();
object2.original_content_type = undefined;
return object2;
}
function prepareMessagePayload(a0, a1, a2, a3) { // fn#40569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:711, offset: 0x011052c4, size: 152 bytes, params: 5, frame: 18
const value2 = _prepareMessageRequestBodyCloud(a1, a2, a3);
const object = {Authorization: a0};
const getDebugOptionsHeaderValue = DeveloperOptionsStore.getDebugOptionsHeaderValue;
object['X-Debug-Options'] = Reflect.apply(getDebugOptionsHeaderValue, DeveloperOptionsStore, []);
object['Accept-Language'] = LocaleStore.locale;
const superPropertiesBase64 = (importDefault(683) /* metro dependency 683: AnalyticsUtils */).getSuperPropertiesBase64();
if (superPropertiesBase64 != null) {
object['X-Super-Properties'] = superPropertiesBase64;
}
const fingerprint = AuthenticationStore.getFingerprint();
if (fingerprint != null) {
object['X-Fingerprint'] = fingerprint;
}
return {headers: object, body: value2};
}
function _fun40567(a0, a1) { // fn#40567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4869:201, offset: 0x01105234, size: 71 bytes, params: 3, frame: 14
let value = environment.__proto__;
value = require(4651) /* metro dependency 4651: UploadUtils */;
const attachmentPayload = value.getAttachmentPayload(a0, a1);
const binding = env0_0;
const push = binding.push;
const object2 = {};
copyDataProperties(object2, attachmentPayload, value);
Reflect.apply(push, binding, [object2]);
}
@@ -0,0 +1,116 @@
/* Metro module 7226; source: lib/uploader/stageAttachmentFiles.tsx; dependencies: [5, 661, 4648, 2] */
function _fun57848(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:6, offset: 0x016b7999, size: 143 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(5) /* metro dependency 5 */;
const env0_3 = (require(661) /* metro dependency 661: Constants */).AbortCodes;
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/uploader/stageAttachmentFiles.tsx');
exports.default = function() {
return _stageAttachmentFiles.apply(this, arguments);
};
}
function _stageAttachmentFiles() { // fn#57849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:127, offset: 0x016b7a28, size: 48 bytes, params: 1, frame: 14
return env0_2(_fun57851).apply(this, arguments);
}
async function _fun57851(a0) { // fn#57851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:192, offset: 0x016b7a6a, size: 100 bytes, params: 2, frame: 15
let value = a1;
if (true) {
var env0_0 = value !== undefined ? value : false;
var env0_1 = a2;
await undefined;
if (false) {
return undefined;
}
value = a0.map(function(a0) {
var env0_0 = a0;
var Promise = global.Promise;
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
var value2 = new Promise(_fun57853);
return value2 instanceof Object ? value2 : value;
});
var Promise = global.Promise;
await Promise.all(value);
}
}
function _fun57852(a0) { // fn#57852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:225, offset: 0x016b7ace, size: 44 bytes, params: 2, frame: 11
const env0_0 = a0;
const Promise = global.Promise;
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(_fun57853);
return promise instanceof Object ? promise : value;
}
function _fun57853(a0, a1) { // fn#57853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:241, offset: 0x016b7afa, size: 482 bytes, params: 3, frame: 19
var environment;
var Error;
var value3;
var error;
var value5;
var value7;
var value8;
const env0_0 = a0;
const env0_1 = a1;
const status = env0_0.status;
let binding = env4_0;
const CloudUploadStatus = binding(env4_1[2]).CloudUploadStatus;
const NOT_STARTED = CloudUploadStatus.NOT_STARTED;
if (NOT_STARTED === status) {
env0_0.upload();
} else if (env4_0(env4_1[2]).CloudUploadStatus.COMPLETED === status) {
a0('complete');
} else if (env4_0(env4_1[2]).CloudUploadStatus.ERROR === status) {
value7 = environment.__proto__;
if (env1_0) {
error = env0_0.error;
if (error !== env4_3.ENTITY_TOO_LARGE) {
env0_0.upload();
} else {
Error = global.Error;
value8 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('File failed to upload');
a1(error instanceof Object ? error : value8);
}
} else {
Error = global.Error;
value8 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('File failed to upload');
a1(error instanceof Object ? error : value8);
}
} else if (env4_0(env4_1[2]).CloudUploadStatus.CANCELED === status) {
Error = global.Error;
value5 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('Upload is canceled');
a1(error instanceof Object ? error : value5);
} else if (env4_0(env4_1[2]).CloudUploadStatus.REMOVED_FROM_MSG_DRAFT === status) {
Error = global.Error;
value3 = Object.create(Error.prototype, {constructor: {value: Error}});
error = new Error('Upload is removed from draft');
a1(error instanceof Object ? error : value3);
}
binding = env0_0;
binding.on('complete', _fun57854);
binding.on('error', _fun57855);
binding.on('progress', function(a0, a1) {
if (importDefault != null) {
importDefault(a0, a1);
}
});
}
function _fun57854() { // fn#57854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:708, offset: 0x016b7cdc, size: 20 bytes, params: 1, frame: 11
env0_0('complete');
}
function _fun57855() { // fn#57855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7404:744, offset: 0x016b7cf0, size: 85 bytes, params: 1, frame: 15
const Error = global.Error;
let value = environment.__proto__;
value = 'File ' + env1_0.id + ' failed to upload';
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
const error = new Error();
require(error instanceof Object ? error : value2);
}
File diff suppressed because it is too large. Load diff