/* Metro module 4648; source: lib/uploader/CloudUpload.tsx; dependencies: [57, 29, 5, 102, 6, 7, 15, 17, 18, 162, 4649, 1312, 4401, 661, 3, 507, 4650, 4658, 672, 561, 22, 1458, 4660, 4691, 4692, 4696, 4697, 1216, 4659, 4651, 683, 4698, 4699, 1962, 2] */ import Logger from '../../modules/debug/Logger.tsx'; /* Metro dependency 3 */ import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import ObjectWithoutProperties from '../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */ import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */ import Module00102 from '../../by-id/module-00102.js'; /* Metro dependency 102 */ import Module00162 from '../../by-id/module-00162.js'; /* Metro dependency 162 */ import Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */ import AnalyticsUtils from '../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */ import UnsyncedUserSettingsStore from '../../modules/user_settings/UnsyncedUserSettingsStore.tsx'; /* Metro dependency 1312 */ import NetworkStore from '../../stores/NetworkStore.tsx'; /* Metro dependency 4401 */ import DevSettingsStore from '../../modules/devtools/dev_settings/DevSettingsStore.tsx'; /* Metro dependency 4649 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as HTTPUtilsModule from '../../external/discord_common/js/packages/http-utils/HTTPUtils.tsx'; /* Metro dependency 507 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as UploadModule from './Upload.tsx'; /* Metro dependency 4650 */ import * as UploadUtilsModule from './UploadUtils.tsx'; /* Metro dependency 4658 */ function _fun40022(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40022, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:6, offset: 0x010f2b46, size: 604 bytes, params: 8, frame: 22 const env0_0 = require; const env0_3 = ['Content-Range']; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = CreateClass; const value6 = new (Logger)('CloudUpload.tsx'); const Set = global.Set; const set = new Set([429]); const Error = global.Error; const value11 = _fun40027(Module00162(Error)); const env0_22 = value(UploadAnalytics); value = importDefault(4650) /* metro dependency 4650: Upload */; value = _fun40034(value); (FileImportTrackerModule).fileFinishedImporting('lib/uploader/CloudUpload.tsx'); exports.ResumableUploadError = value11; exports.CloudUploadStatus = {NOT_STARTED: 'NOT_STARTED', STARTED: 'STARTED', UPLOADING: 'UPLOADING', ERROR: 'ERROR', COMPLETED: 'COMPLETED', CANCELED: 'CANCELED', REMOVED_FROM_MSG_DRAFT: 'REMOVED_FROM_MSG_DRAFT'}; exports.CloudUpload = value; function _callSuper_40023(a0, a1, a2) { // fn#40023, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:302, offset: 0x010f2da2, size: 100 bytes, params: 4, frame: 20 var r0; var Reflect; let value = a2; const value3 = Module00017(a1); if (_isNativeReflectConstruct_40024()) { Reflect = global.Reflect; value = Reflect.construct(value3, value || [], Module00017(a0).constructor); r0 = value; } else { value = value3.apply(a0, value); r0 = value; } return PossibleConstructorReturn(a0, r0); } function _isNativeReflectConstruct_40024() { // fn#40024, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:433, offset: 0x010f2e06, 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_40024_isNativeReflectConstruct = function() { return !!result; })(); } function _fun40027(a0) { // fn#40027, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:684, offset: 0x010f2e64, size: 123 bytes, params: 2, frame: 18 const ResumableUploadError2 = ResumableUploadError; Inherits(ResumableUploadError2, a0); return env0_9(ResumableUploadError2, [{key: 'canRetry', value: function() { var r0; r0 = this.kind === 'server_error' || this.kind === 'network_error'; r0 = !r0 ? this.kind === 'client_error' : r0; return r0; }}], [{key: 'getErrorKind', value: value_40030}, {key: 'rejectionHandler', value: function(a0) { var env0_0 = a0; return _fun40032; }}]); function ResumableUploadError(a0) { // fn#40028, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:696, offset: 0x010f2edf, size: 332 bytes, params: 2, frame: 28 var Error; var value5; var error; let value = a1; const value2 = undefined; let r1 = value !== value2 ? value : {}; value = environment.__proto__; env1_8(this, ResumableUploadError); const cause = r1.cause; const response = r1.response; const getErrorKind = ResumableUploadError.getErrorKind; if (cause != null) { r1 = cause; } else { Error = global.Error; value5 = '' + ((response == null ? value2 : response.text) ?? 'Unknown error'); error = new Error(); } const value8 = Reflect.apply(getErrorKind, ResumableUploadError, [r1, response]); r1 = value8 === 'server_error' || value8 === 'client_error' ? '' + a0 + ':' + value8 + ':status_' + ((response == null ? value2 : response.status) ?? 0) : '' + a0 + ':' + value8; value = _callSuper_40023(this, ResumableUploadError, [r1, {cause: cause}]); value.name = 'ResumableUploadError'; value.phase = a0; value.kind = value8; value.messageShort = r1; return value; } function value_40030(a0, a1) { // fn#40030, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:1366, offset: 0x010f3063, size: 239 bytes, params: 3, frame: 15 const r1 = a1?.status ?? 0; value = environment.__proto__; value = env1_19.has(r1); let r3 = a0.message.toLowerCase().includes('network') || a0.message.toLowerCase().includes('terminated'); r3 = !r3 ? a0.message.toLowerCase().includes('offline') : r3; r3 = !r3 ? a0.message.toLowerCase().includes('changed') : r3; return r1 >= 500 && r1 < 600 ? 'server_error' : value ? 'client_error' : r3 ? 'network_error' : 'unknown'; } function value_40031(a0) { // fn#40031, offset: 0x010f3152, size: 16 bytes, params: 2, frame: 2 const env0_0 = a0; return _fun40032; function _fun40032(a0) { // fn#40032, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:1753, offset: 0x010f3162, size: 221 bytes, params: 2, frame: 17 let value = environment.__proto__.__proto__; const HTTPResponseError = (HTTPUtilsModule).HTTPResponseError; value = environment.__proto__; if (a0 instanceof HTTPResponseError) { throw new ResumableUploadError(env0_0, {response: a0}); } let Error = global.Error; const value2 = a0 instanceof Error; const binding = env0_0; const object = {}; if (value2) { object.cause = a0; throw new ResumableUploadError(); } Error = global.Error; const String = global.String; value = String(a0); const value3 = Object.create(Error.prototype, {constructor: {value: Error}}); const error = new Error(value); object.cause = error instanceof Object ? error : value3; throw new ResumableUploadError(); } } } function UploadAnalytics() { // fn#40033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:2210, offset: 0x010f323f, size: 46 bytes, params: 1, frame: 13 ClassCallCheck(this, UploadAnalytics); this.timing = {}; this.uploadResumptionCount = 0; this.uploadResumptionPosition = 0; } function _fun40034(a0) { // fn#40034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:2342, offset: 0x010f326d, size: 920 bytes, params: 2, frame: 19 const CloudUpload2 = CloudUpload; Inherits(CloudUpload2, a0); const binding = env0_9; const items3 = [{key: 'parseRangeHeader', value: function(a0) { var r0; var parseInt; var items; var value = a0.match(RegExp('^bytes=(\\d+)-(\\d+)(?:\\/\\d+)?$', '')); var value2 = null; if (value2 == value) { r0 = value2; } else { parseInt = global.parseInt; items = [parseInt(value[1], 10)]; parseInt = global.parseInt; items[1] = parseInt(value[2], 10); r0 = items; } return r0; }}]; items3[1] = {key: 'retryOpts', value: value_40039}; items3[2] = {key: 'createAttachmentUrlRetryOpts', value: value_40040}; items3[3] = {key: 'supportsResume', value: value_40041}; const binding2 = env0_6; const env0_10 = binding2(_fun40043); items3[4] = {key: 'uploadFileToCloud', value: value_40044}; var env0_9 = binding2(_fun40046); items3[5] = {key: 'getResumePosition', value: value_40049}; const env0_8 = binding2(_fun40051); items3[6] = {key: 'startOrResumeUpload', value: value_40052}; const env0_7 = binding2(_fun40054); items3[7] = {key: 'uploadFileWithResumption', value: value_40060}; var env0_6 = binding2(_fun40062); items3[8] = {key: 'getSize', value: value_40063}; const env0_5 = binding2(_fun40065); items3[9] = {key: 'trackTime', value: value_40066}; const env0_4 = binding2(_fun40068); items3[10] = {key: 'upload', value: value_40075}; const env0_3 = binding2(_fun40077); items3[11] = {key: 'reactNativeCompressAndExtractData', value: value_40080}; items3[12] = {key: 'handleError', value: value_40081}; items3[13] = {key: 'handleComplete', value: value_40082}; items3[14] = {key: '_cancel', value: value_40083}; items3[15] = {key: 'cancel', value: value_40084}; items3[16] = {key: 'removeFromMsgDraft', value: value_40085}; items3[17] = {key: 'isCancelled', value: value_40086}; items3[18] = {key: 'resetState', value: value_40087}; const env0_2 = binding2(_fun40091); items3[19] = {key: 'delete', value: value_40092}; items3[20] = {key: 'setResponseUrl', value: function(a0) { this.responseUrl = a0; var Date = global.Date; this.responseUrlSetAt = Date.now(); }}; const env0_1 = binding2(_fun40095); items3[21] = {key: 'ensureFreshResponseUrl', value: value_40096}; items3[22] = {key: 'setStatus', value: function(a0) { this.status = a0; }}; items3[23] = {key: 'setFilename', value: function(a0) { this.filename = a0; }}; items3[24] = {key: 'setUploadedFilename', value: function(a0) { this.uploadedFilename = a0; }}; items3[25] = {key: 'trackUploadStart', value: value_40100}; items3[26] = {key: 'trackUploadFinished', value: value_40101}; const items2 = [{key: 'fromJson', value: value_40102}]; const env0_0 = binding2(_fun40105); items2[1] = {key: 'tryConvertToWebP', value: value_40106}; items2[2] = {key: 'isResponseUrlStale', value: value_40107}; return binding(CloudUpload2, items3, items2); function CloudUpload(a0, a1, a2, a3) { // fn#40035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:2354, offset: 0x010f3605, size: 497 bytes, params: 5, frame: 21 var environment; const value = environment.__proto__; let binding = env1_8; const value3 = undefined; binding(this, CloudUpload); const value4 = _callSuper_40023(this, CloudUpload, [a0]); const NOT_STARTED = env1_21.NOT_STARTED; value4.status = NOT_STARTED; const value5 = 0; value4.loaded = value5; value4.reactNativeFilePrepped = false; binding = env1_22; const value6 = Object.create(binding.prototype, {constructor: {value: binding}}); const binding2 = new binding(); value4.uploadAnalytics = binding2 instanceof Object ? binding2 : value6; value4.uploadAttempts = value5; value4._aborted = false; value4.createResumeAwareProgressFn = function(a0) { var env0_0 = a0; return _fun40037; }; value4.channelId = a1; let file = a0.file; value4.preCompressionSize = (file == null ? value3 : file.size) ?? value5; file = a0.file; value4.currentSize = (file == null ? value3 : file.size) ?? value5; value4.reactNativeFileIndex = a2; if (a3 != null) { value4.allowOptimization = a3; } const platform = a0.platform; const UploadPlatform = (require(4650) /* metro dependency 4650: Upload */).UploadPlatform; const WEB = UploadPlatform.WEB; if (platform === WEB && a0.compressionMetadata != null) { value4.mimeType = a0.compressionMetadata.originalContentType; } const AbortController = global.AbortController; const value11 = Object.create(AbortController.prototype, {constructor: {value: AbortController}}); const abortController = new AbortController(); value4._abortController = abortController instanceof Object ? abortController : value11; if (value4.origin != null) { value4.uploadAnalytics.origin = typeof value4.origin === 'string' ? value4.origin : (require(4650) /* metro dependency 4650: Upload */).UploadOrigin[value4.origin]; } const DefaultHttpClient = (UploadUtilsModule).DefaultHttpClient; value4._uploadHttpClient = new DefaultHttpClient(); value4._libdiscoreEnabled = false; return value4; function createResumeAwareProgressFn(a0) { // fn#40036, owner: CloudUpload.createResumeAwareProgressFn, offset: 0x010f37f6, size: 16 bytes, params: 2, frame: 2 const env0_0 = a0; return _fun40037; function _fun40037({loaded, total}) { // fn#40037, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:2612, offset: 0x010f3806, size: 77 bytes, params: 2, frame: 17 let binding = env0_0; const value = loaded + binding; const value2 = total + binding; binding = env1_0; binding.emit('progress', value, value2, value - binding.loaded); binding.loaded = value; } } } function value_40039() { // fn#40039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:3459, offset: 0x010f38b6, size: 313 bytes, params: 1, frame: 18 var r0; var object; var Millis; var value3; var value4; const platform = this.item.platform; let value = environment.__proto__; const UploadPlatform = (UploadModule).UploadPlatform; const REACT_NATIVE = UploadPlatform.REACT_NATIVE; if (platform === REACT_NATIVE) { object = {}; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; object.timeout = 1 * Millis.HOUR; value = importDefault(561) /* metro dependency 561: Backoff */; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; value3 = 0.5 * Millis.SECOND; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; value4 = 30 * Millis.MINUTE; value = new value(); object.backoff = value; object.retries = 12; r0 = object; } else { object = {}; object.timeout = 1 * (importDefault(672) /* metro dependency 672: Durations */).Millis.HOUR; object.retries = 12; value = importDefault(561) /* metro dependency 561: Backoff */; value = new value(); object.backoff = value; r0 = object; } return r0; } function value_40040() { // fn#40040, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:3765, offset: 0x010f39ef, size: 269 bytes, params: 1, frame: 18 var r0; var object; var object2; var Millis; var SECOND; var value2; var value3; const platform = this.item.platform; let value = environment.__proto__; const UploadPlatform = (UploadModule).UploadPlatform; const REACT_NATIVE = UploadPlatform.REACT_NATIVE; if (platform === REACT_NATIVE) { object = {}; object2 = {}; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; SECOND = Millis.SECOND; object2.response = 30 * SECOND; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; object2.deadline = 30 * Millis.MINUTE; object.timeout = object2; value = importDefault(561) /* metro dependency 561: Backoff */; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; SECOND = Millis.SECOND; value2 = 0.5 * SECOND; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; SECOND = Millis.SECOND; value3 = 60 * SECOND; value = new value(); object.backoff = value; object.retries = 8; r0 = object; } else { r0 = this.retryOpts(); } return r0; } function value_40041() { // fn#40041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:4056, offset: 0x010f3afc, size: 66 bytes, params: 1, frame: 13 var r0; var platform; var value; const _libdiscoreEnabled = this._libdiscoreEnabled; if (_libdiscoreEnabled) { r0 = _libdiscoreEnabled; } else { platform = this.item.platform; value = environment.__proto__; value = platform !== (require(4650) /* metro dependency 4650: Upload */).UploadPlatform.REACT_NATIVE; r0 = value; } return r0; } function* _fun40043() { // fn#40043, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:4197, offset: 0x010f3b47, size: 566 bytes, params: 1, frame: 25 var r2; var r3; var r4; var file; var filename; var object; var type; var value7; var LibdiscoreHttpClient; var value9; var libdiscoreHttpClient; if (true) { if (this.responseUrl == null) { throw new global.Error('_uploadFileToCloud - responseUrl is not set'); } value = environment.__proto__.__proto__; var binding = env2_18; var log = binding.log; var value3 = 'Uploading ' + this.id; var item = this.item; var platform = item.platform; var UploadPlatform = env2_0(env2_2[16]).UploadPlatform; var REACT_NATIVE = UploadPlatform.REACT_NATIVE; if (platform === REACT_NATIVE) { item = this.item; filename = item.filename; item = this.item; r2 = 'filename=' + filename + ', uri=' + item.uri; } else { r2 = 'filename=' + this.item.file.name; } Reflect.apply(log, binding, [value3, r2]); platform = this.item.platform; UploadPlatform = env2_0(env2_2[16]).UploadPlatform; REACT_NATIVE = UploadPlatform.REACT_NATIVE; if (platform === REACT_NATIVE) { object = {}; item = this.item; object.type = item.mimeType; item = this.item; object.uri = item.uri; item = this.item; object.name = item.filename; type = object.type; value7 = 'application/octet-stream'; r3 = type != null ? object.type === 'application/json' ? value7 : object.type : value7; r4 = object; } else { file = this.item.file; r3 = 'application/octet-stream'; r4 = file; } var value8 = env2_0(env2_2[17]); if (value8.canUploadNatively(this.item)) { binding = env2_0; LibdiscoreHttpClient = binding(env2_2[17]).LibdiscoreHttpClient; value9 = Object.create(LibdiscoreHttpClient.prototype, {constructor: {value: LibdiscoreHttpClient}}); libdiscoreHttpClient = new LibdiscoreHttpClient(); this._uploadHttpClient = libdiscoreHttpClient instanceof Object ? libdiscoreHttpClient : value9; this._libdiscoreEnabled = true; binding = env2_18; binding.log('Using libdiscore client for file upload'); } yield this.uploadFileWithResumption(this.responseUrl, r4, r3); } } function value_40044() { // fn#40044, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:4984, offset: 0x00ccfcea, size: 30 bytes, params: 1, frame: 13 return env0_10.apply(this, arguments); } function* _fun40046(a0) { // fn#40046, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:5084, offset: 0x010f3d86, size: 199 bytes, params: 2, frame: 16 var environment; if (true) { value = environment.__proto__.__proto__; var Millis = env2_1(env2_2[18]).Millis; var SECOND = Millis.SECOND; value = this._uploadHttpClient.doUpload({url: a0, headers: {['Content-Range']: 'bytes */*'}, rejectWithError: true, retries: 0, timeout: {deadline: 30 * SECOND}, signal: this._abortController.signal}); value = value.then(_fun40047); yield value.catch(_fun40048); } function _fun40047(a0) { // fn#40047, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:5313, offset: 0x010f3e4d, size: 75 bytes, params: 2, frame: 12 var r0; var value; if (a0.status === 200) { r0 = env0_0.currentSize; } else if (a0.status === 201) { r0 = env0_0.currentSize; } else { value = environment.__proto__.__proto__.__proto__; value = env3_20.rejectionHandler('status_check'); value = value(a0); r0 = value; } return r0; } function _fun40048(a0) { // fn#40048, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:5411, offset: 0x010f3e98, size: 154 bytes, params: 2, frame: 14 var parseRangeHeader; var range; let value = environment.__proto__.__proto__.__proto__; let binding = env3_0; const HTTPResponseError = binding(env3_2[15]).HTTPResponseError; if (a0 instanceof HTTPResponseError) { if (a0.status === 308) { binding = env0_0; parseRangeHeader = binding.parseRangeHeader; range = a0.headers.range; value = ''; value = Reflect.apply(parseRangeHeader, binding, [range ?? value]); return value != null ? value[1] + 1 : 0; } } binding = env3_20; return binding.rejectionHandler('status_check')(a0); } } function value_40049() { // fn#40049, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:5613, offset: 0x00e5de9c, size: 30 bytes, params: 1, frame: 13 return env0_9.apply(this, arguments); } async function _fun40051(a0) { // fn#40051, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:5715, offset: 0x010f3f44, size: 462 bytes, params: 2, frame: 26 var headers; var uploadAnalytics; var uploadResumptionCount; var object; var currentSize; var value5; let value = a1; if (false) { return undefined; } const r8 = value !== undefined ? value : 0; await undefined; if (false) { return undefined; } value = environment.__proto__.__proto__; let binding = env2_18; binding.log('Attempting to upload attachment with resumeFrom: ' + r8 + ' and attempts: ' + this.uploadAttempts); if (r8 > 0) { uploadAnalytics = this.uploadAnalytics; uploadResumptionCount = uploadAnalytics.uploadResumptionCount; uploadAnalytics.uploadResumptionCount = typeof uploadResumptionCount === 'bigint' ? uploadResumptionCount + 1n : +uploadResumptionCount + 1; object = {}; copyDataProperties(object, a0.headers ?? ({}), undefined); currentSize = this.currentSize; value5 = currentSize - 1; currentSize = this.currentSize; object['Content-Range'] = 'bytes ' + r8 + '-' + value5 + '/' + currentSize; a0.headers = object; } else { headers = a0.headers; if (headers != null) { headers = a0.headers; headers['Content-Range']; a0.headers = env2_5(headers, env2_3); } } const value7 = env2_1(env2_2[20]); a0.onRequestProgress = value7.throttle(this.createResumeAwareProgressFn(r8), 50); const value8 = this._uploadHttpClient.doUpload(a0, {fileByteRange: {start: r8}}); binding = env2_20; await value8.catch(binding.rejectionHandler('upload')); const value9 = undefined; if (true) { if (value9.status === 200) { return value9; } if (value9.status !== 201) { binding = env2_20; object = {response: value9}; throw new binding('upload'); } } return value9; } function value_40052() { // fn#40052, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:6352, offset: 0x00df9c0a, size: 30 bytes, params: 1, frame: 13 return env0_8.apply(this, arguments); } function* _fun40054(a0, a1, a2) { // fn#40054, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:6461, offset: 0x010f411b, size: 607 bytes, params: 4, frame: 28 var r18; var r2; var r4; var r5; var r6; var r7; var r8; var r9; var r10; var r11; var r12; var r16; var r17; var r19; var r1; var _aborted; var Symbol; var iterator; var next; var done; var error; var value13; var value14; var value15; var value16; var value17; let value = this; if (false) { return undefined; } const value4 = undefined; const value5 = value.retryOpts(); const timeout = value5.timeout; const env0_1 = value5.backoff; const retries = value5.retries; const object = {url: a0, body: a1}; object.headers = {['Content-Type']: a2}; object.signal = value._abortController.signal; const value7 = env2_1(env2_2[20]); object.onRequestProgress = value7.throttle(value.createResumeAwareProgressFn(0), 50); object.retries = 0; object.rejectWithError = true; object.timeout = timeout; const generator = loop_40056; let uploadAttempts = value.uploadAttempts; if (uploadAttempts <= retries) { _aborted = value._aborted; reducibleJoin25: while (true) { if (_aborted) { r2 = value; break reducibleJoin25; } r2 = value; r4 = 'iterator.next() did not return an object'; r5 = 'throw'; r6 = 'iterator.throw() did not return an object'; r7 = 'iterator is not an object'; r8 = global; r9 = generator; r10 = retries; r11 = value4; reducibleLoop3: while (true) { value = Reflect.apply(r9, r11, []); Symbol = r8.Symbol; iterator = Symbol.iterator; value = value[iterator](); ensureObject(value, r7, r18); next = value.next; r12 = value; r16 = value4; r17 = next; reduciblePort21: while (true) { exceptionLanding7: while (true) { reducibleLoop4: while (true) { value = Reflect.apply(r17, r12, [r16]); ensureObject(value, r4, r18); done = value.done; if (done) { r1 = value; break reduciblePort21; } try { generatorSetDelegated(value); } catch (error) { break exceptionLanding7; } yield value; reducibleLoop10: while (true) { try { value = undefined; value13 = false; } catch (error) { break exceptionLanding7; } if (value13) { value14 = getMethod(r12, 'return', r18); if (value14 === r11) { return value; } value = Reflect.apply(value14, r12, [value]); ensureObject(value, 'iterator.return() did not return an object', value14); done = value.done; if (done) { return value.value; } value15 = generatorSetDelegated(value); yield value; r18 = value15; continue reducibleLoop10; } r16 = value; continue reducibleLoop4; } continue reducibleLoop4; } break reduciblePort21; } exceptionRetry7: while (true) { value = getMethod(r12, r5, r18); if (value === r11) { value = 'return'; value16 = getMethod(r12, value, r18); reducibleJoin20: while (true) { if (value16 === r11) { r19 = value; break reducibleJoin20; } value = Reflect.apply(value16, r12, []); value17 = 'iterator.return() did not return an object'; ensureObject(value, value17, r18); r19 = value17; break reducibleJoin20; } throwTypeError('yield* delegate must have a .throw() method', r19); throw r11; } value = Reflect.apply(value, r12, [error]); ensureObject(value, r6, r18); done = value.done; reducibleJoin21: while (true) { if (done) { r1 = value; break reducibleJoin21; } generatorSetDelegated(value); yield value; reducibleLoop10: while (true) { try { value = undefined; value13 = false; } catch (error) { continue exceptionRetry7; } reducibleJoin12: while (true) { if (value13) { break reducibleJoin12; } r16 = value; value = Reflect.apply(r17, r12, [r16]); ensureObject(value, r4, r18); done = value.done; if (done) { r1 = value; break reducibleJoin21; } try { generatorSetDelegated(value); } catch (error) { continue exceptionRetry7; } yield value; continue reducibleLoop10; } value14 = getMethod(r12, 'return', r18); if (value14 === r11) { return value; } value = Reflect.apply(value14, r12, [value]); ensureObject(value, 'iterator.return() did not return an object', value14); done = value.done; if (done) { return value.value; } value15 = generatorSetDelegated(value); yield value; r18 = value15; continue reducibleLoop10; } } break reduciblePort21; } } value = r1.value; if (value) { return value.v; } uploadAttempts = r2.uploadAttempts; if (uploadAttempts <= r10) { _aborted = r2._aborted; if (_aborted) { break reducibleJoin25; } continue reducibleLoop3; } break reducibleJoin25; } } } else { r2 = value; } const Error = global.Error; value = 'Upload failed after ' + r2.uploadAttempts + ' attempts'; const value18 = Object.create(Error.prototype, {constructor: {value: Error}}); error = new Error(value); throw error instanceof Object ? error : value18; function* loop_40056() { // fn#40056, original name: ?anon_0__loop, inferred name: loop_40056, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:6755, offset: 0x010f4383, size: 683 bytes, params: 1, frame: 27 var environment; var r8; var value; var value2; var binding; var uploadAttempts; var uploadAnalytics; var responseUrl; var ensureFreshResponseUrl; var value3; var value4; var value5; var binding2; var responseUrl2; var responseUrl3; var value6; var value7; var trackTime; var value8; var binding3; var generator; var value9; var value10; var value11; var value12; var supportsResume; var value13; var value14; var object; var startOrResumeUpload; var binding4; var binding5; var value15; var value16; var value17; var error; var value18; var warn; var id; var message; var HermesInternal; var concat; var binding6; var value19; var value22; var log; var promise; exceptionSkip60: while (true) { exceptionLanding60: while (true) { value = undefined; value2 = false; if (value2) { return value; } var env0_0 = undefined; value = environment.__proto__; binding = env1_0; uploadAttempts = binding.uploadAttempts; binding.uploadAttempts = typeof uploadAttempts === 'bigint' ? uploadAttempts + 1n : +uploadAttempts + 1; uploadAnalytics = binding.uploadAnalytics; uploadAttempts = binding.uploadAttempts; uploadAnalytics.numUploadAttempts = uploadAttempts; try { binding = env1_0; } catch (error) { break exceptionLanding60; } try { responseUrl = binding.responseUrl; } catch (error) { break exceptionLanding60; } try { ensureFreshResponseUrl = binding.ensureFreshResponseUrl; } catch (error) { break exceptionLanding60; } try { value3 = Reflect.apply(ensureFreshResponseUrl, binding, []); } catch (error) { break exceptionLanding60; } yield value3; try { value4 = undefined; value5 = false; } catch (error) { break exceptionLanding60; } if (value5) { return value4; } try { binding = env1_2; } catch (error) { break exceptionLanding60; } try { binding2 = env1_0; } catch (error) { break exceptionLanding60; } try { responseUrl2 = binding2.responseUrl; } catch (error) { break exceptionLanding60; } try { binding.url = responseUrl2; } catch (error) { break exceptionLanding60; } try { responseUrl3 = binding2.responseUrl; } catch (error) { break exceptionLanding60; } try { value6 = responseUrl !== responseUrl3; } catch (error) { break exceptionLanding60; } if (value6) { try { env1_3 = 0; } catch (error) { break exceptionLanding60; } try { binding = env1_0; } catch (error) { break exceptionLanding60; } try { binding.loaded = 0; } catch (error) { break exceptionLanding60; } try { object = {}; } catch (error) { break exceptionLanding60; } try { binding = env1_0; } catch (error) { break exceptionLanding60; } try { startOrResumeUpload = binding.startOrResumeUpload; } catch (error) { break exceptionLanding60; } try { binding4 = env1_2; } catch (error) { break exceptionLanding60; } try { binding5 = env1_3; } catch (error) { break exceptionLanding60; } try { value15 = Reflect.apply(startOrResumeUpload, binding, [binding4, binding5]); } catch (error) { break exceptionLanding60; } yield value15; try { value16 = undefined; value17 = false; } catch (error) { break exceptionLanding60; } if (value17) { return value16; } try { object.v = value16; } catch (error) { break exceptionLanding60; } return object; } try { binding = env1_0; } catch (error) { break exceptionLanding60; } try { uploadAttempts = binding.uploadAttempts; } catch (error) { break exceptionLanding60; } try { value7 = uploadAttempts > 1; } catch (error) { break exceptionLanding60; } if (value7) { try { binding = env1_0; } catch (error) { break exceptionLanding60; } try { trackTime = binding.trackTime; } catch (error) { break exceptionLanding60; } value8 = environment.__proto__.__proto__.__proto__.__proto__; try { binding3 = env4_6; } catch (error) { break exceptionLanding60; } try { generator = _fun40058; } catch (error) { break exceptionLanding60; } try { value9 = binding3(generator); } catch (error) { break exceptionLanding60; } try { value10 = Reflect.apply(trackTime, binding, ['resumptionCheckTimeMs', value9]); } catch (error) { break exceptionLanding60; } yield value10; try { value11 = undefined; value12 = false; } catch (error) { break exceptionLanding60; } if (value12) { return value11; } try { binding = env1_0; } catch (error) { break exceptionLanding60; } try { uploadAnalytics = binding.uploadAnalytics; } catch (error) { break exceptionLanding60; } try { uploadAnalytics.uploadResumptionPosition = value11; } catch (error) { break exceptionLanding60; } try { supportsResume = binding.supportsResume; } catch (error) { break exceptionLanding60; } try { value13 = Reflect.apply(supportsResume, binding, []); } catch (error) { break exceptionLanding60; } value14 = 0; r8 = value13 ? value11 : value14; try { env1_3 = r8; } catch (error) { break exceptionLanding60; } try { binding = env1_0; } catch (error) { break exceptionLanding60; } try { binding.loaded = r8; } catch (error) { break exceptionLanding60; } try { object = {}; } catch (error) { break exceptionLanding60; } try { binding = env1_0; } catch (error) { break exceptionLanding60; } try { startOrResumeUpload = binding.startOrResumeUpload; } catch (error) { break exceptionLanding60; } try { binding4 = env1_2; } catch (error) { break exceptionLanding60; } try { binding5 = env1_3; } catch (error) { break exceptionLanding60; } try { value15 = Reflect.apply(startOrResumeUpload, binding, [binding4, binding5]); } catch (error) { break exceptionLanding60; } yield value15; try { value16 = undefined; value17 = false; } catch (error) { break exceptionLanding60; } if (value17) { return value16; } try { object.v = value16; } catch (error) { break exceptionLanding60; } return object; } try { object = {}; } catch (error) { break exceptionLanding60; } try { binding = env1_0; } catch (error) { break exceptionLanding60; } try { startOrResumeUpload = binding.startOrResumeUpload; } catch (error) { break exceptionLanding60; } try { binding4 = env1_2; } catch (error) { break exceptionLanding60; } try { binding5 = env1_3; } catch (error) { break exceptionLanding60; } try { value15 = Reflect.apply(startOrResumeUpload, binding, [binding4, binding5]); } catch (error) { break exceptionLanding60; } yield value15; try { value16 = undefined; value17 = false; } catch (error) { break exceptionLanding60; } if (value17) { return value16; } try { object.v = value16; } catch (error) { break exceptionLanding60; } return object; break exceptionSkip60; } value18 = environment.__proto__.__proto__.__proto__.__proto__; if (error instanceof env4_20) { if (error.canRetry()) { binding = env4_18; warn = binding.warn; binding6 = env1_0; id = binding6.id; message = error.message; HermesInternal = global.HermesInternal; concat = HermesInternal.concat; Reflect.apply(warn, binding, ['Error uploading ' + id + ': ' + message + ', attempting resumption']); binding6.uploadAnalytics.uploadResumptionReason = error.messageShort; binding = env4_1; value19 = binding(env4_2[21]); yield value19.awaitOnline(); if (false) { return undefined; } binding = env1_1; value22 = binding.fail(); env0_0 = value22; binding = env4_18; log = binding.log; value = env1_0.uploadAttempts + 1; HermesInternal = global.HermesInternal; concat = HermesInternal.concat; Reflect.apply(log, binding, ['Waiting ' + value22 + 'ms before attachment upload attempt ' + value]); promise = new global.Promise(_fun40059); yield promise; promise = undefined; return undefined; } binding = env4_18; warn = binding.warn; id = env1_0.id; message = error.message; HermesInternal = global.HermesInternal; concat = HermesInternal.concat; Reflect.apply(warn, binding, ['Unrecoverable error uploading ' + id + ': ' + message]); throw error; } binding = env4_18; warn = binding.warn; id = env1_0.id; message = error.message; HermesInternal = global.HermesInternal; concat = HermesInternal.concat; Reflect.apply(warn, binding, ['Unrecoverable error uploading ' + id + ': ' + message]); throw error; break exceptionSkip60; } function* _fun40058() { // fn#40058, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:7031, offset: 0x010f4637, size: 52 bytes, params: 1, frame: 12 if (true) { value = environment.__proto__.__proto__.__proto__; var getResumePosition = require.getResumePosition; yield Reflect.apply(getResumePosition, require, [require.responseUrl]); } } function _fun40059(a0) { // fn#40059, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:7602, offset: 0x00fc555a, size: 28 bytes, params: 2, frame: 13 return global.setTimeout(a0, env0_0); } } } function value_40060(a0, a1, a2) { // fn#40060, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:7769, offset: 0x00e5de7e, size: 30 bytes, params: 4, frame: 13 return env0_7.apply(this, arguments); } function* _fun40062() { // fn#40062, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:7871, offset: 0x010f4674, size: 121 bytes, params: 1, frame: 16 var r1; if (false) { return undefined; } const uri = this.item.uri; value = environment.__proto__.__proto__; const binding = env2_0; const value3 = undefined; const getFileSize = binding(env2_2[22]).getFileSize; if (getFileSize == null) { r1 = value3; } else { value = env2_0(env2_2[22]); value = value.getFileSize(uri); r1 = value; } yield r1; value = undefined; if (false) { return value; } return value ?? 0; } function value_40063() { // fn#40063, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:7995, offset: 0x00f29ca4, size: 30 bytes, params: 1, frame: 13 return env0_6.apply(this, arguments); } function value_40066(a0, a1) { // fn#40066, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:8200, offset: 0x00eee203, size: 30 bytes, params: 3, frame: 13 return env0_5.apply(this, arguments); } function* _fun40068() { // fn#40068, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:8284, offset: 0x010f47b7, size: 1490 bytes, params: 1, frame: 34 var environment; var r12; var code; var value; var value2; var status; var value3; var COMPLETED; var setStatus; var STARTED; var performance; var now; var trackUploadStart; var reactNativeFilePrepped; var reactNativeCompressAndExtractData; var value4; var value5; var isCancelled; var allowOptimization; var item; var platform; var binding; var UploadPlatform; var WEB; var value6; var tryConvertToWebP; var file; var id; var value7; var value8; var convertedFile; var size; var convertedMimeType; var uploadAnalytics; var hashTimeMs; var timing; var conversionFailureReason; var compressTimeMs; var property; var getUploadPayload; var value9; var value10; var value11; var getUploadTarget; var target; var value12; var filename; var currentSize; var value13; var handleError; var ENTITY_EMPTY; var binding2; var value14; var getKestrelConfig; var value15; var value16; var getEffectiveKestrelLimit; var getMaxFileSize; var channelId; var value17; var get; var Math; var random; var value18; var log; var HermesInternal; var concat; var value19; var trackTime; var generator; var value20; var value21; var value22; var value23; var setResponseUrl; var body; var attachments; var upload_url; var setUploadedFilename; var upload_filename; var value24; var value25; var value26; var value27; var trackUploadFinished; var handleComplete; var error; var info; var ENTITY_TOO_LARGE; var error2; var JSON; var stringify; var setTimeout; var value30; var INVALID_FILE_ASSET; exceptionLanding80: while (true) { value = undefined; value2 = false; if (value2) { return value; } reduciblePort96: while (true) { exceptionLanding76: while (true) { var env0_0 = this; value = undefined; var env0_2 = value; var env0_3 = value; var env0_1 = this; status = this.status; value3 = environment.__proto__.__proto__; COMPLETED = env2_21.COMPLETED; if (status === COMPLETED) { break reduciblePort96; } setStatus = this.setStatus; STARTED = env2_21.STARTED; Reflect.apply(setStatus, this, [STARTED]); performance = global.performance; now = performance.now; this.startTime = Reflect.apply(now, performance, []); trackUploadStart = this.trackUploadStart; Reflect.apply(trackUploadStart, this, []); reactNativeFilePrepped = this.reactNativeFilePrepped; if (reactNativeFilePrepped === false) { reactNativeCompressAndExtractData = this.reactNativeCompressAndExtractData; yield Reflect.apply(reactNativeCompressAndExtractData, this, []); value4 = undefined; value5 = false; reducibleJoin5: while (true) { if (value5) { return value4; } break reducibleJoin5; } } isCancelled = this.isCancelled; if (!Reflect.apply(isCancelled, this, [])) { allowOptimization = this.allowOptimization; if (allowOptimization) { item = this.item; platform = item.platform; binding = env2_0; UploadPlatform = binding(env2_2[16]).UploadPlatform; WEB = UploadPlatform.WEB; reducibleJoin20: while (true) { if (platform !== WEB) { break reducibleJoin20; } value6 = environment.__proto__; binding = env1_11; tryConvertToWebP = binding.tryConvertToWebP; item = this.item; file = item.file; id = this.id; yield Reflect.apply(tryConvertToWebP, binding, [file, _fun40069, id]); value7 = undefined; value8 = false; if (value8) { return value7; } if (value7 == null) { break reducibleJoin20; } convertedFile = value7.convertedFile; reducibleJoin13: while (true) { if (convertedFile == null) { break reducibleJoin13; } item = this.item; convertedFile = value7.convertedFile; item.file = convertedFile; convertedFile = value7.convertedFile; size = convertedFile.size; this.currentSize = size; break reducibleJoin13; } convertedMimeType = value7.convertedMimeType; reducibleJoin15: while (true) { if (convertedMimeType == null) { break reducibleJoin15; } uploadAnalytics = this.uploadAnalytics; convertedMimeType = value7.convertedMimeType; uploadAnalytics.convertedMimeType = convertedMimeType; break reducibleJoin15; } hashTimeMs = value7.hashTimeMs; reducibleJoin17: while (true) { if (hashTimeMs == null) { break reducibleJoin17; } uploadAnalytics = this.uploadAnalytics; timing = uploadAnalytics.timing; hashTimeMs = value7.hashTimeMs; timing.hashTimeMs = hashTimeMs; break reducibleJoin17; } conversionFailureReason = value7.conversionFailureReason; reducibleJoin19: while (true) { if (conversionFailureReason == null) { break reducibleJoin19; } uploadAnalytics = this.uploadAnalytics; conversionFailureReason = value7.conversionFailureReason; uploadAnalytics.conversionFailureReason = conversionFailureReason; break reducibleJoin19; } uploadAnalytics = this.uploadAnalytics; timing = uploadAnalytics.timing; compressTimeMs = value7.compressTimeMs; timing.compressTimeMs = compressTimeMs; break reducibleJoin20; } } binding = env2_0; property = binding(env2_2[23]).default; getUploadPayload = property.getUploadPayload; yield Reflect.apply(getUploadPayload, property, [this]); value9 = undefined; value10 = false; if (value10) { return value9; } env0_2 = value9; binding = env2_0; value11 = binding(env2_2[24]); getUploadTarget = value11.getUploadTarget; item = this.item; target = item.target; value12 = Reflect.apply(getUploadTarget, value11, [target]); env0_3 = value12; filename = value9.filename; if (filename != null) { filename = value9.filename; reducibleJoin92: while (true) { if (filename === '') { break reducibleJoin92; } this.currentSize; currentSize = this.currentSize; value13 = 0; if (value13 !== currentSize) { binding = env2_0; binding2 = env2_2; value14 = binding(binding2[26]); getKestrelConfig = value14.getKestrelConfig; value15 = Reflect.apply(getKestrelConfig, value14, [{location: 'CloudUpload.upload.postCompressionCheck'}]); value16 = binding(binding2[26]); getEffectiveKestrelLimit = value16.getEffectiveKestrelLimit; getMaxFileSize = value12.getMaxFileSize; channelId = this.channelId; value17 = Reflect.apply(getEffectiveKestrelLimit, value16, [value15, Reflect.apply(getMaxFileSize, value12, [channelId])]); currentSize = this.currentSize; r12 = currentSize ?? value13; if (r12 > value17) { handleError = this.handleError; ENTITY_TOO_LARGE = env2_16.ENTITY_TOO_LARGE; Reflect.apply(handleError, this, [ENTITY_TOO_LARGE]); break reduciblePort96; } binding = env2_13; get = binding.get; if (Reflect.apply(get, binding, ['upload_fail_50'])) { Math = global.Math; random = Math.random; value18 = Reflect.apply(random, Math, []); reducibleJoin30: while (true) { if (value18 < 0.5) { setTimeout = global.setTimeout; setTimeout(_fun40070, 1000); break reduciblePort96; } break reducibleJoin30; } } try { binding = env2_18; } catch (error) { break exceptionLanding80; } try { log = binding.log; } catch (error) { break exceptionLanding80; } try { id = this.id; } catch (error) { break exceptionLanding80; } try { HermesInternal = global.HermesInternal; } catch (error) { break exceptionLanding80; } try { concat = HermesInternal.concat; } catch (error) { break exceptionLanding80; } try { value19 = 'Requesting upload url for ' + id; } catch (error) { break exceptionLanding80; } try { Reflect.apply(log, binding, [value19]); } catch (error) { break exceptionLanding80; } try { trackTime = this.trackTime; } catch (error) { break exceptionLanding80; } try { binding = env2_6; } catch (error) { break exceptionLanding80; } try { generator = _fun40072; } catch (error) { break exceptionLanding80; } try { value20 = binding(generator); } catch (error) { break exceptionLanding80; } try { value21 = Reflect.apply(trackTime, this, ['getUploadUrlTimeMs', value20]); } catch (error) { break exceptionLanding80; } yield value21; try { value22 = undefined; value23 = false; } catch (error) { break exceptionLanding80; } if (value23) { return value22; } try { setResponseUrl = this.setResponseUrl; } catch (error) { break exceptionLanding80; } try { body = value22.body; } catch (error) { break exceptionLanding80; } try { attachments = body.attachments; } catch (error) { break exceptionLanding80; } try { property = attachments[value13]; } catch (error) { break exceptionLanding80; } try { upload_url = property.upload_url; } catch (error) { break exceptionLanding80; } try { Reflect.apply(setResponseUrl, this, [upload_url]); } catch (error) { break exceptionLanding80; } try { setUploadedFilename = this.setUploadedFilename; } catch (error) { break exceptionLanding80; } try { body = value22.body; } catch (error) { break exceptionLanding80; } try { attachments = body.attachments; } catch (error) { break exceptionLanding80; } try { property = attachments[value13]; } catch (error) { break exceptionLanding80; } try { upload_filename = property.upload_filename; } catch (error) { break exceptionLanding80; } try { Reflect.apply(setUploadedFilename, this, [upload_filename]); } catch (error) { break exceptionLanding80; } try { trackTime = this.trackTime; } catch (error) { break exceptionLanding76; } try { binding = env2_6; } catch (error) { break exceptionLanding76; } try { generator = _fun40074; } catch (error) { break exceptionLanding76; } try { value24 = binding(generator); } catch (error) { break exceptionLanding76; } try { value25 = Reflect.apply(trackTime, this, ['uploadTimeMs', value24]); } catch (error) { break exceptionLanding76; } yield value25; try { value26 = undefined; value27 = false; } catch (error) { break exceptionLanding76; } if (value27) { return value26; } try { trackUploadFinished = this.trackUploadFinished; } catch (error) { break exceptionLanding76; } try { binding = env2_21; } catch (error) { break exceptionLanding76; } try { COMPLETED = binding.COMPLETED; } catch (error) { break exceptionLanding76; } try { Reflect.apply(trackUploadFinished, this, [COMPLETED]); } catch (error) { break exceptionLanding76; } try { handleComplete = this.handleComplete; } catch (error) { break exceptionLanding76; } try { id = this.id; } catch (error) { break exceptionLanding76; } try { Reflect.apply(handleComplete, this, [id]); } catch (error) { break exceptionLanding76; } break reduciblePort96; } handleError = this.handleError; ENTITY_EMPTY = env2_16.ENTITY_EMPTY; Reflect.apply(handleError, this, [ENTITY_EMPTY]); break reduciblePort96; } } binding = env2_18; error = binding.error; JSON = global.JSON; stringify = JSON.stringify; value30 = Reflect.apply(stringify, JSON, [value9]); Reflect.apply(error, binding, ['File does not have a filename.', value30]); handleError = this.handleError; INVALID_FILE_ASSET = env2_16.INVALID_FILE_ASSET; Reflect.apply(handleError, this, [INVALID_FILE_ASSET]); return value; } handleComplete = this.handleComplete; id = this.id; Reflect.apply(handleComplete, this, [id]); break reduciblePort96; } isCancelled = this.isCancelled; if (Reflect.apply(isCancelled, this, [])) { handleComplete = this.handleComplete; Reflect.apply(handleComplete, this, [error]); } else { binding = env2_18; info = binding.info; status = error.status; id = this.id; HermesInternal = global.HermesInternal; concat = HermesInternal.concat; Reflect.apply(info, binding, ['Error: status ' + status + ' for ' + id]); handleError = this.handleError; Reflect.apply(handleError, this, [error]); } break reduciblePort96; } return value; } if (error == null) { code = value; if (code != null) { r12 = code; if (r12 === env2_16.ENTITY_TOO_LARGE) { this.handleError(r12); return value; } binding = env2_18; error2 = binding.error; if (r12 != null) { Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + r12 + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } JSON = global.JSON; Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + JSON.stringify(error.body) + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } r12 = error.status; if (r12 === env2_16.ENTITY_TOO_LARGE) { this.handleError(r12); return value; } binding = env2_18; error2 = binding.error; if (r12 != null) { Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + r12 + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } JSON = global.JSON; Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + JSON.stringify(error.body) + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); } else { body = error.body; if (body == null) { code = value; if (code != null) { r12 = code; if (r12 === env2_16.ENTITY_TOO_LARGE) { this.handleError(r12); return value; } binding = env2_18; error2 = binding.error; if (r12 != null) { Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + r12 + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } JSON = global.JSON; Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + JSON.stringify(error.body) + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } r12 = error.status; if (r12 === env2_16.ENTITY_TOO_LARGE) { this.handleError(r12); return value; } binding = env2_18; error2 = binding.error; if (r12 != null) { Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + r12 + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } JSON = global.JSON; Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + JSON.stringify(error.body) + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } code = body.code; if (code != null) { r12 = code; if (r12 === env2_16.ENTITY_TOO_LARGE) { this.handleError(r12); return value; } binding = env2_18; error2 = binding.error; if (r12 != null) { Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + r12 + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } JSON = global.JSON; Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + JSON.stringify(error.body) + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } r12 = error.status; if (r12 === env2_16.ENTITY_TOO_LARGE) { this.handleError(r12); return value; } error2 = env2_18.error; if (r12 != null) { Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + r12 + ' for ' + this.id]); binding = env2_1; binding(env2_2[27]).captureException(error); this.handleError(r12); return value; } JSON = global.JSON; Reflect.apply(error2, binding, ['Requesting upload url failed with code ' + JSON.stringify(error.body) + ' for ' + this.id]); env2_1(env2_2[27]).captureException(error); } this.handleError(r12); return value; function _fun40069() { // fn#40069, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:8695, offset: 0x010f4d89, size: 15 bytes, params: 1, frame: 1 return env0_0._aborted; } function _fun40070() { // fn#40070, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:9742, offset: 0x010f4d98, size: 28 bytes, params: 1, frame: 11 env0_0.handleError(500); } function* _fun40072() { // fn#40072, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:9882, offset: 0x010f4dbd, size: 154 bytes, params: 1, frame: 17 if (true) { value = environment.__proto__; var binding = env1_3; var getCreateAttachmentURL = binding.getCreateAttachmentURL; var binding2 = env1_1; var value3 = Reflect.apply(getCreateAttachmentURL, binding, [binding2.channelId]); var HTTP = env4_0(env4_2[15]).HTTP; var post = HTTP.post; var object = {url: value3}; binding = env1_2; object.body = {files: [binding]}; copyDataProperties(object, binding2.createAttachmentUrlRetryOpts(), binding); object['rejectWithError'] = false; yield Reflect.apply(post, HTTP, [object]); } } function* _fun40074() { // fn#40074, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:10485, offset: 0x010f4e60, size: 45 bytes, params: 1, frame: 10 if (true) { value = environment.__proto__; var binding = env1_1; yield binding.uploadFileToCloud(); } } } function value_40075() { // fn#40075, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:10771, offset: 0x00d8febd, size: 30 bytes, params: 1, frame: 13 return env0_4.apply(this, arguments); } function* _fun40077() { // fn#40077, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:10876, offset: 0x010f4e96, size: 1824 bytes, params: 1, frame: 39 var environment; var r7; var r11; var r20; var uploadAnalytics; var log; var id; var trackTime; var value6; var file; var uri; var name; var value8; var isResolvedUpload; var videoMetadata; var encodingConfig; var type; var value12; var fileSize; var value15; var value16; var mimeType; var object; var object2; var error; var Error; if (false) { return undefined; } value = environment.__proto__.__proto__; let binding = env2_0; const value3 = undefined; const value4 = binding(env2_2[24]); const getUploadTarget = value4.getUploadTarget; if (Reflect.apply(getUploadTarget, value4, [this.item.target]).shouldReactNativeCompressUploads) { if (this.reactNativeFilePrepped === true) { this.uploadAnalytics.fileAlreadyPrepped = true; binding = env2_18; binding.log('reactNativeCompressAndExtractData() file already prepped - ' + this.id); return this; } binding = env2_18; log = binding.log; id = this.id; Reflect.apply(log, binding, ['Starting compression/conversion for ' + id]); trackTime = this.trackTime; binding = env2_6; yield Reflect.apply(trackTime, this, ['compressTimeMs', binding(_fun40079)]); value6 = undefined; if (false) { return value6; } if (value6 == null) { binding = env2_18; binding.error('Failed to get compressed file for ' + this.id); return this; } file = value6.file; if (file == null) { binding = env2_18; binding.error('Failed to get compressed file for ' + this.id); return this; } uri = value6.uri; file = value6.file; name = file.name; binding = env2_0; value8 = binding(env2_2[16]); isResolvedUpload = value8.isResolvedUpload; file = value6.file; if (Reflect.apply(isResolvedUpload, value8, [file])) { uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.imageCompressionQuality = file.imageCompressionQuality; uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.videoCompressionQuality = file.videoCompressionQuality; uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.imageEncoderType = file.imageEncoderType; file = value6.file; if (file.isImage) { uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.sourceMediaWidth = file.sourceWidth; uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.sourceMediaHeight = file.sourceHeight; uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.uploadedImageWidth = file.uploadedImageWidth; uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.uploadedImageHeight = file.uploadedImageHeight; } file = value6.file; videoMetadata = file.videoMetadata; if (value3 !== videoMetadata) { uploadAnalytics = this.uploadAnalytics; file = value6.file; videoMetadata = file.videoMetadata; uploadAnalytics.sourceMediaWidth = videoMetadata.width; uploadAnalytics = this.uploadAnalytics; file = value6.file; videoMetadata = file.videoMetadata; uploadAnalytics.sourceMediaHeight = videoMetadata.height; uploadAnalytics = this.uploadAnalytics; file = value6.file; videoMetadata = file.videoMetadata; uploadAnalytics.sourceMediaFormat = videoMetadata.format; uploadAnalytics = this.uploadAnalytics; file = value6.file; videoMetadata = file.videoMetadata; uploadAnalytics.sourceVideoBitrate = videoMetadata.bitRate; uploadAnalytics = this.uploadAnalytics; file = value6.file; videoMetadata = file.videoMetadata; uploadAnalytics.sourceVideoFramerate = videoMetadata.frameRate; uploadAnalytics = this.uploadAnalytics; file = value6.file; videoMetadata = file.videoMetadata; uploadAnalytics.videoDurationMs = videoMetadata.durationMs; uploadAnalytics = this.uploadAnalytics; file = value6.file; videoMetadata = file.videoMetadata; uploadAnalytics.sourceVideoProfile = videoMetadata.sourceProfile; uploadAnalytics = this.uploadAnalytics; file = value6.file; videoMetadata = file.videoMetadata; uploadAnalytics.sourceVideoLevel = videoMetadata.sourceLevel; } file = value6.file; encodingConfig = file.encodingConfig; if (value3 !== encodingConfig) { uploadAnalytics = this.uploadAnalytics; file = value6.file; encodingConfig = file.encodingConfig; uploadAnalytics.targetVideoWidth = encodingConfig.targetWidth; uploadAnalytics = this.uploadAnalytics; file = value6.file; encodingConfig = file.encodingConfig; uploadAnalytics.targetVideoHeight = encodingConfig.targetHeight; uploadAnalytics = this.uploadAnalytics; file = value6.file; encodingConfig = file.encodingConfig; uploadAnalytics.targetVideoBitrate = encodingConfig.targetBitrate; uploadAnalytics = this.uploadAnalytics; file = value6.file; encodingConfig = file.encodingConfig; uploadAnalytics.targetVideoCodec = encodingConfig.useHEVC ? 'hvc1' : 'avc1'; uploadAnalytics = this.uploadAnalytics; file = value6.file; encodingConfig = file.encodingConfig; uploadAnalytics.targetVideoFramerate = encodingConfig.frameRate; uploadAnalytics = this.uploadAnalytics; file = value6.file; encodingConfig = file.encodingConfig; uploadAnalytics.targetVideoIsHdr = encodingConfig.createHDR; uploadAnalytics = this.uploadAnalytics; file = value6.file; encodingConfig = file.encodingConfig; uploadAnalytics.hevcIsSupported = encodingConfig.hevcIsSupported; uploadAnalytics = this.uploadAnalytics; file = value6.file; encodingConfig = file.encodingConfig; uploadAnalytics.progressUpdateGranularity = encodingConfig.progressUpdateGranularity; } uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.psnr = file.psnr; uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.ssim = file.ssim; uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.origin = file.origin; uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.psnrMeasurementLatencyMs = file.psnrMeasurementLatencyMs; uploadAnalytics = this.uploadAnalytics; file = value6.file; uploadAnalytics.ssimMeasurementLatencyMs = file.ssimMeasurementLatencyMs; } this.filename = name; if (name == null) { binding = env2_18; error = binding.error; file = value6.file; type = file.type; Reflect.apply(error, binding, ['Insufficient file data: ' + ({filename: name, uri: uri, type: type}) + ' for ' + this.id]); Error = global.Error; file = value6.file; type = file.type; error = new Error('Insufficient file data: ' + ({filename: name, uri: uri, type: type})); throw error; } if (uri == null) { binding = env2_18; error = binding.error; file = value6.file; type = file.type; Reflect.apply(error, binding, ['Insufficient file data: ' + ({filename: name, uri: uri, type: type}) + ' for ' + this.id]); Error = global.Error; file = value6.file; type = file.type; error = new Error('Insufficient file data: ' + ({filename: name, uri: uri, type: type})); throw error; } file = value6.file; type = file.type; if (type == null) { binding = env2_18; error = binding.error; file = value6.file; type = file.type; Reflect.apply(error, binding, ['Insufficient file data: ' + ({filename: name, uri: uri, type: type}) + ' for ' + this.id]); Error = global.Error; file = value6.file; type = file.type; error = new Error('Insufficient file data: ' + ({filename: name, uri: uri, type: type})); throw error; } value12 = name.split('.').pop(); r11 = value12 == null ? value3 : value12.toLowerCase(); r7 = r11 === 'jpg' || r11 === 'jpeg' ? 'image/jpeg' : value6.file.type; uploadAnalytics = this.uploadAnalytics; uploadAnalytics.convertedMimeType = r7; fileSize = value6.fileSize; if (fileSize != null) { r20 = fileSize; this.postCompressionSize = r20; this.currentSize = r20; if (r20 == null) { env2_18.error('Size missing from file data for ' + this.id); throw new global.Error('Size missing from file data'); } binding = env2_18; binding.log('Completed compression and conversion. Output size=' + r20 + ' bytes; filename=' + name + '; uri=' + uri + '; originalMimeType=' + this.mimeType + '; mimeType=' + r7 + ' for ' + this.id); object = {uri: uri, filename: name, mimeType: r7}; object2 = {}; copyDataProperties(object2, this.item, name); copyDataProperties(object2, object, name); this.item = object2; this.reactNativeFilePrepped = true; return this; } binding = env2_0; value15 = binding(env2_2[29]); yield value15.getFileData(uri); value16 = undefined; if (false) { return value16; } r20 = value16.size; this.postCompressionSize = r20; this.currentSize = r20; if (r20 == null) { env2_18.error('Size missing from file data for ' + this.id); throw new global.Error('Size missing from file data'); } binding = env2_18; log = binding.log; mimeType = this.mimeType; id = this.id; Reflect.apply(log, binding, ['Completed compression and conversion. Output size=' + r20 + ' bytes; filename=' + name + '; uri=' + uri + '; originalMimeType=' + mimeType + '; mimeType=' + r7 + ' for ' + id]); object = {uri: uri, filename: name, mimeType: r7}; object2 = {}; copyDataProperties(object2, this.item, name); copyDataProperties(object2, object, name); this.item = object2; this.reactNativeFilePrepped = true; } else { this.uploadAnalytics.compressAndExtractDisabled = true; env2_18.log('reactNativeCompressAndExtractData() disabled by upload target'); } return this; function* _fun40079() { // fn#40079, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:11391, offset: 0x010f55bf, size: 90 bytes, params: 1, frame: 16 if (true) { value = environment.__proto__.__proto__.__proto__.__proto__; var binding = env4_0; value = binding(env4_2[28]); var getAttachmentFile = value.getAttachmentFile; binding = env1_0; yield Reflect.apply(getAttachmentFile, value, [binding, binding.reactNativeFileIndex ?? 0]); } } } function value_40080() { // fn#40080, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:14519, offset: 0x00d6afe6, size: 30 bytes, params: 1, frame: 13 return env0_3.apply(this, arguments); } function value_40081(a0) { // fn#40081, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:14623, offset: 0x010f5619, size: 93 bytes, params: 2, frame: 15 var error; const setStatus = this.setStatus; const binding = env1_21; let ERROR = binding.ERROR; Reflect.apply(setStatus, this, [ERROR]); this.error = a0; const trackUploadFinished = this.trackUploadFinished; ERROR = binding.ERROR; Reflect.apply(trackUploadFinished, this, [ERROR]); try { this.emit('error', a0); } catch (error) { } this.removeAllListeners(); } function value_40082(a0) { // fn#40082, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:14809, offset: 0x010f5676, size: 104 bytes, params: 2, frame: 15 const setStatus = this.setStatus; const COMPLETED = env1_21.COMPLETED; Reflect.apply(setStatus, this, [COMPLETED]); const binding = env1_18; binding.log('Upload complete for ' + this.id); this.emit('complete', a0); this.removeAllListeners(); } function value_40083(a0, a1) { // fn#40083, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:14977, offset: 0x010f56de, size: 130 bytes, params: 3, frame: 14 env1_18.log(a1); this._aborted = true; this._abortController.abort(); this.trackUploadFinished(a0); const status = this.status; const COMPLETED = env1_21.COMPLETED; if (status === COMPLETED) { this.delete(); } this.setStatus(a0); this.emit('complete'); this.removeAllListeners(); } function value_40084() { // fn#40084, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:15212, offset: 0x010f5760, size: 61 bytes, params: 1, frame: 15 const _cancel = this._cancel; const CANCELED = env1_21.CANCELED; Reflect.apply(_cancel, this, [CANCELED, 'Cancelled called for ' + this.id]); } function value_40085() { // fn#40085, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:15323, offset: 0x010f579d, size: 61 bytes, params: 1, frame: 15 const _cancel = this._cancel; const REMOVED_FROM_MSG_DRAFT = env1_21.REMOVED_FROM_MSG_DRAFT; Reflect.apply(_cancel, this, [REMOVED_FROM_MSG_DRAFT, 'Removed from draft for ' + this.id]); } function value_40086() { // fn#40086, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:15455, offset: 0x010f57da, size: 49 bytes, params: 1, frame: 4 const status = this.status; const value = environment.__proto__; const CANCELED = env1_21.CANCELED; return status === CANCELED || this.status === env1_21.REMOVED_FROM_MSG_DRAFT; } function value_40087() { // fn#40087, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:15576, offset: 0x010f580b, size: 175 bytes, params: 1, frame: 17 var environment; const value = environment.__proto__; const NOT_STARTED = env1_21.NOT_STARTED; this.status = NOT_STARTED; this.uploadedFilename = undefined; this.responseUrl = undefined; this.responseUrlSetAt = undefined; this.error = undefined; this.startTime = undefined; this.uploadAnalytics = new env1_22(); this.uploadAttempts = 0; this._aborted = false; const AbortController = global.AbortController; this._abortController = new AbortController(); return value_40087_superPropGet(CloudUpload, 'resetState', this, 3)([]); function value_40087_superPropGet(a0, a1, a2, a3) { // fn#40088, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:15861, owner: value_40087._superPropGet, offset: 0x010f58ba, size: 100 bytes, params: 5, frame: 18 let value = a0; const env0_0 = a2; const binding = env2_7; value = env2_11(1 & 3 ? value.prototype : value); value = binding(value, 'resetState', a2); return 2 & 3 ? typeof value !== 'function' ? value : _fun40089 : value; function _fun40089(a0) { // fn#40089, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:15960, offset: 0x00c62408, size: 27 bytes, params: 2, frame: 13 return env0_1.apply(importDefault, a0); } } } function* _fun40091() { // fn#40091, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:16061, offset: 0x010f5927, size: 152 bytes, params: 1, frame: 16 var uploadedFilename; var binding; var value3; var getUploadTarget; var item; var target; var value4; var getDeleteUploadURL; var value5; var binding2; var property; var HTTP; var del; var value6; var error; let value = undefined; if (false) { return value; } reduciblePort16: while (true) { exceptionLanding15: while (true) { uploadedFilename = this.uploadedFilename; if (uploadedFilename == null) { break reduciblePort16; } value = environment.__proto__.__proto__; binding = env2_0; value3 = binding(env2_2[24]); getUploadTarget = value3.getUploadTarget; item = this.item; target = item.target; value4 = Reflect.apply(getUploadTarget, value3, [target]); getDeleteUploadURL = value4.getDeleteUploadURL; uploadedFilename = this.uploadedFilename; value5 = Reflect.apply(getDeleteUploadURL, value4, [uploadedFilename]); try { binding = env2_0; } catch (error) { break exceptionLanding15; } try { binding2 = env2_2; } catch (error) { break exceptionLanding15; } try { property = binding2[15]; } catch (error) { break exceptionLanding15; } try { value = binding(property); } catch (error) { break exceptionLanding15; } try { HTTP = value.HTTP; } catch (error) { break exceptionLanding15; } try { del = HTTP.del; } catch (error) { break exceptionLanding15; } try { value = Reflect.apply(del, HTTP, [value5]); } catch (error) { break exceptionLanding15; } yield value; try { value = undefined; value6 = false; } catch (error) { break exceptionLanding15; } if (value6) { return value; } break reduciblePort16; } break reduciblePort16; } } function value_40092() { // fn#40092, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:16244, offset: 0x00d6b059, size: 30 bytes, params: 1, frame: 13 return env0_2.apply(this, arguments); } function* _fun40095() { // fn#40095, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:16448, offset: 0x010f59ef, size: 421 bytes, params: 1, frame: 20 var value3; var property; var value4; var binding2; var value6; var value7; var value8; var HTTP; var post; var object; var value9; var body; var attachments; var setResponseUrl; var setUploadedFilename; if (true) { value = environment.__proto__; var binding = env1_11; if (binding.isResponseUrlStale(this.responseUrlSetAt)) { value = environment.__proto__.__proto__; binding = env2_0; value3 = undefined; property = binding(env2_2[23]).default; yield property.getUploadPayload(this); value4 = undefined; if (false) { return value4; } binding = env2_0; binding2 = env2_2; value6 = binding(binding2[24]); value7 = value6.getUploadTarget(this.item.target); value8 = value7.getCreateAttachmentURL(this.channelId); HTTP = binding(binding2[15]).HTTP; post = HTTP.post; object = {url: value8}; object.body = {files: [value4]}; copyDataProperties(object, this.createAttachmentUrlRetryOpts(), undefined); object['rejectWithError'] = false; yield Reflect.apply(post, HTTP, [object]); value9 = undefined; if (false) { return value9; } if (value9.ok) { body = value9.body; if ((body == null || body.attachments == null ? value3 : body.attachments[0]) == null) { binding = env2_20; object = {response: value9}; throw new binding('upload'); } setResponseUrl = this.setResponseUrl; body = value9.body; attachments = body.attachments; Reflect.apply(setResponseUrl, this, [attachments[0].upload_url]); setUploadedFilename = this.setUploadedFilename; body = value9.body; attachments = body.attachments; Reflect.apply(setUploadedFilename, this, [attachments[0].upload_filename]); return undefined; } binding = env2_20; object = {response: value9}; throw new binding('upload'); } } } function value_40096() { // fn#40096, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:17003, offset: 0x00c3b2ba, size: 30 bytes, params: 1, frame: 13 return env0_1.apply(this, arguments); } function value_40100() { // fn#40100, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:17320, offset: 0x010f5bb4, size: 186 bytes, params: 1, frame: 19 const defaultImport = AnalyticsUtils; const track = defaultImport.track; const ATTACHMENT_UPLOAD_STARTED = AnalyticEvents.ATTACHMENT_UPLOAD_STARTED; const object = {}; object.file_size = this.currentSize; object.mime_type = this.mimeType ?? 'unknown'; const unsyncedUserSettingsStoreBinding = UnsyncedUserSettingsStore; object.video_upload_quality = unsyncedUserSettingsStoreBinding.videoUploadQuality; object.data_saving_mode = unsyncedUserSettingsStoreBinding.dataSavingMode; object.low_quality_image_mode = unsyncedUserSettingsStoreBinding.dataSavingMode; object.channel_id = this.channelId; const networkStoreBinding = NetworkStore; object.connection_type = networkStoreBinding.getType(); object.effective_connection_speed = networkStoreBinding.getEffectiveConnectionSpeed(); object.service_provider = networkStoreBinding.getServiceProvider(); Reflect.apply(track, defaultImport, [ATTACHMENT_UPLOAD_STARTED, object]); } function value_40101(a0) { // fn#40101, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:17777, offset: 0x010f5c6e, size: 1164 bytes, params: 2, frame: 21 var r7; const startTime = this.startTime; let value = -1; if (startTime != null) { value = global.performance.now(); value -= this.startTime; r7 = value; } else { r7 = value; } value = environment.__proto__; const defaultImport = AnalyticsUtils; const track = defaultImport.track; const ATTACHMENT_UPLOAD_FINISHED = AnalyticEvents.ATTACHMENT_UPLOAD_FINISHED; const object = {duration_ms: r7}; object.file_size = this.currentSize; object.pre_compression_file_size = this.preCompressionSize; object.final_state = a0; const mimeType = this.mimeType; const value2 = 'unknown'; object.mime_type = mimeType ?? value2; object.num_upload_attempts = this.uploadAnalytics.numUploadAttempts ?? 1; object.error_code = this.error; const unsyncedUserSettingsStoreBinding = UnsyncedUserSettingsStore; object.video_upload_quality = unsyncedUserSettingsStoreBinding.videoUploadQuality; object.data_saving_mode = unsyncedUserSettingsStoreBinding.dataSavingMode; object.low_quality_image_mode = unsyncedUserSettingsStoreBinding.dataSavingMode; object.compress_time_ms = this.uploadAnalytics.timing.compressTimeMs; const getUploadUrlTimeMs = this.uploadAnalytics.timing.getUploadUrlTimeMs; object.get_upload_url_time_ms = getUploadUrlTimeMs; object.upload_time_ms = this.uploadAnalytics.timing.uploadTimeMs; object.converted_mime_type = this.uploadAnalytics.convertedMimeType ?? value2; object.image_compression_quality = this.uploadAnalytics.imageCompressionQuality ?? 0; object.video_compression_quality = this.uploadAnalytics.videoCompressionQuality ?? value2; object.image_encoder_type = this.uploadAnalytics.imageEncoderType ?? value2; object.was_converted = this.uploadAnalytics.convertedMimeType != null && this.mimeType !== this.uploadAnalytics.convertedMimeType; object.was_compressed = this.currentSize < this.preCompressionSize; object.source_media_width = this.uploadAnalytics.sourceMediaWidth; object.source_media_height = this.uploadAnalytics.sourceMediaHeight; object.source_media_format = this.uploadAnalytics.sourceMediaFormat; object.uploaded_image_width = this.uploadAnalytics.uploadedImageWidth; object.uploaded_image_height = this.uploadAnalytics.uploadedImageHeight; object.source_video_bitrate = this.uploadAnalytics.sourceVideoBitrate; object.video_duration_ms = this.uploadAnalytics.videoDurationMs; object.source_video_profile_name = this.uploadAnalytics.sourceVideoProfile; object.source_video_profile_level = this.uploadAnalytics.sourceVideoLevel; object.target_video_width = this.uploadAnalytics.targetVideoWidth; object.target_video_height = this.uploadAnalytics.targetVideoHeight; object.target_video_bitrate = this.uploadAnalytics.targetVideoBitrate; object.target_video_codec = this.uploadAnalytics.targetVideoCodec; object.target_video_framerate = this.uploadAnalytics.targetVideoFramerate; object.target_video_is_hdr = this.uploadAnalytics.targetVideoIsHdr; object.hevc_is_supported = this.uploadAnalytics.hevcIsSupported; object.progress_update_granularity = this.uploadAnalytics.progressUpdateGranularity; object.source_video_framerate = this.uploadAnalytics.sourceVideoFramerate; object.channel_id = this.channelId; object.hash_time_ms = this.uploadAnalytics.timing.hashTimeMs; object.psnr = this.uploadAnalytics.psnr; object.ssim = this.uploadAnalytics.ssim; object.origin = this.uploadAnalytics.origin; object.psnr_measurement_latency_ms = this.uploadAnalytics.psnrMeasurementLatencyMs; object.ssim_measurement_latency_ms = this.uploadAnalytics.ssimMeasurementLatencyMs; object.upload_resumption_count = this.uploadAnalytics.uploadResumptionCount; object.upload_resumption_reason = this.uploadAnalytics.uploadResumptionReason; object.upload_resumption_position = this.uploadAnalytics.uploadResumptionPosition; object.upload_resumption_check_time_ms = this.uploadAnalytics.timing.resumptionCheckTimeMs; object.conversion_failure_reason = this.uploadAnalytics.conversionFailureReason; object.upload_http_client = this._libdiscoreEnabled ? 'libdiscore' : 'httputils'; const networkStoreBinding = NetworkStore; object.connection_type = networkStoreBinding.getType(); object.effective_connection_speed = networkStoreBinding.getEffectiveConnectionSpeed(); object.service_provider = networkStoreBinding.getServiceProvider(); Reflect.apply(track, defaultImport, [ATTACHMENT_UPLOAD_FINISHED, object]); } function value_40102(a0) { // fn#40102, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:20992, offset: 0x010f60fa, size: 126 bytes, params: 2, frame: 17 const cloudUpload = new CloudUpload(a0.item, a0.channelId, a0.reactNativeFileIndex); const Object = global.Object; Object.entries(a0).forEach(_fun40103); const status = cloudUpload.status; const COMPLETED = env1_21.COMPLETED; if (status !== COMPLETED) { cloudUpload.status = env1_21.NOT_STARTED; } return cloudUpload; function _fun40103(a0) { // fn#40103, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:21112, offset: 0x010f6178, size: 65 bytes, params: 2, frame: 14 let value = environment.__proto__.__proto__; value = env2_4(a0, 2); const property = value[0]; if (!property.startsWith('_')) { env0_0[property] = value[1]; } } } function* _fun40105(a0, a1, a2) { // fn#40105, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:21263, offset: 0x010f61c2, size: 958 bytes, params: 4, frame: 47 var r18; var r17; var r10; var ConversionFailureReason; var UNKNOWN_ERROR; var r11; var compressTimeMs; var r5; var warn; var HermesInternal; var concat; var performance; var now; var value6; var binding2; var property; var value7; var paths; var value8; var value9; var value10; var maybeConvertToWebP; var value11; var value12; var value13; var value14; var success; var convertedBlob; var value15; var reason; var value16; var log; var value17; var sizeBefore; var sizeAfter; var compressionRatio; var toFixed; var value18; var value19; var File; var items2; var name; var object; var lastModified; var prototype; var file; var value21; var hashTimeMs; var value22; var error; var value23; var Math; var round; var value24; if (false) { return undefined; } value = undefined; let binding = env2_0; const value4 = binding(env2_2[31]); let object2 = {location: 'CloudUpload.maybeConvertToWebP'}; const imageAttachmentMezzanineV2Config = value4.getImageAttachmentMezzanineV2Config(object2); if (imageAttachmentMezzanineV2Config.enabled) { if (a0 == null) { env2_18.warn('webp conversion skipped for ' + a2 + ': no file'); return null; } if (imageAttachmentMezzanineV2Config.maxFileSizeBytes != null) { reducibleJoin6: while (true) { if (a0.size > imageAttachmentMezzanineV2Config.maxFileSizeBytes) { binding = env2_18; warn = binding.warn; concat = global.HermesInternal.concat; Reflect.apply(warn, binding, ['webp conversion skipped for ' + a2 + ': too big']); return null; } break reducibleJoin6; } } if (a1()) { return null; } performance = global.performance; value6 = performance.now(); object2 = {compressTimeMs: 0}; reducibleJoin9: while (true) { reduciblePort101: while (true) { exceptionLanding97: while (true) { try { binding = env2_0; } catch (error) { r10 = value; ConversionFailureReason = value; break exceptionLanding97; } break reducibleJoin9; } binding = env2_18; warn = binding.warn; HermesInternal = global.HermesInternal; concat = HermesInternal.concat; Reflect.apply(warn, binding, ['webp conversion failed for ' + a2 + ':', error]); reducibleJoin99: while (true) { if (ConversionFailureReason == null) { UNKNOWN_ERROR = value; break reducibleJoin99; } UNKNOWN_ERROR = ConversionFailureReason.UNKNOWN_ERROR; break reducibleJoin99; } value23 = 'unknown_error'; r11 = UNKNOWN_ERROR ?? value23; object2.conversionFailureReason = r11; break reduciblePort101; } Math = global.Math; round = Math.round; performance = global.performance; now = performance.now; value24 = Reflect.apply(round, Math, [Reflect.apply(now, performance, []) - value6]); reducibleJoin103: while (true) { if (r10 == null) { compressTimeMs = value; break reducibleJoin103; } compressTimeMs = r10.compressTimeMs; break reducibleJoin103; } r5 = compressTimeMs ?? value24; object2.compressTimeMs = r5; return object2; } try { binding2 = env2_2; } catch (error) { r10 = value; ConversionFailureReason = value; break exceptionLanding97; } try { property = binding2[33]; } catch (error) { r10 = value; ConversionFailureReason = value; break exceptionLanding97; } try { value7 = binding(property); } catch (error) { r10 = value; ConversionFailureReason = value; break exceptionLanding97; } try { property = binding2[32]; } catch (error) { r10 = value; ConversionFailureReason = value; break exceptionLanding97; } try { paths = binding2.paths; } catch (error) { r10 = value; ConversionFailureReason = value; break exceptionLanding97; } try { value8 = value7(property, paths); } catch (error) { r10 = value; ConversionFailureReason = value; break exceptionLanding97; } yield value8; try { value9 = undefined; value10 = false; } catch (error) { r10 = value; ConversionFailureReason = value; break exceptionLanding97; } if (value10) { return value9; } try { ConversionFailureReason = value9.ConversionFailureReason; } catch (error) { r10 = value; ConversionFailureReason = value; break exceptionLanding97; } try { maybeConvertToWebP = value9.maybeConvertToWebP; } catch (error) { r10 = value; break exceptionLanding97; } try { value11 = Reflect.apply(maybeConvertToWebP, value9, [a0]); } catch (error) { r10 = value; break exceptionLanding97; } yield value11; try { value12 = undefined; value13 = false; } catch (error) { r10 = value; break exceptionLanding97; } if (value13) { return value12; } try { value14 = a1(); } catch (error) { r10 = value12; break exceptionLanding97; } if (value14) { return null; } try { success = value12.success; } catch (error) { r10 = value12; break exceptionLanding97; } reducibleJoin101: while (true) { reducibleJoin39: while (true) { if (success) { try { convertedBlob = value12.convertedBlob; } catch (error) { r10 = value12; break exceptionLanding97; } try { value15 = convertedBlob != null; } catch (error) { r10 = value12; break exceptionLanding97; } if (value15) { try { binding = env2_18; } catch (error) { r10 = value12; break exceptionLanding97; } try { log = binding.log; } catch (error) { r10 = value12; break exceptionLanding97; } try { sizeBefore = value12.sizeBefore; } catch (error) { r10 = value12; break exceptionLanding97; } try { sizeAfter = value12.sizeAfter; } catch (error) { r10 = value12; break exceptionLanding97; } try { compressionRatio = value12.compressionRatio; } catch (error) { r10 = value12; break exceptionLanding97; } try { toFixed = compressionRatio.toFixed; } catch (error) { r10 = value12; break exceptionLanding97; } try { value18 = Reflect.apply(toFixed, compressionRatio, [2]); } catch (error) { r10 = value12; break exceptionLanding97; } try { HermesInternal = global.HermesInternal; } catch (error) { r10 = value12; break exceptionLanding97; } try { concat = HermesInternal.concat; } catch (error) { r10 = value12; break exceptionLanding97; } try { value19 = 'webp conversion worked for ' + a2 + ': ' + sizeBefore + ' -> ' + sizeAfter + ' bytes (' + value18 + 'x)'; } catch (error) { r10 = value12; break exceptionLanding97; } try { Reflect.apply(log, binding, [value19]); } catch (error) { r10 = value12; break exceptionLanding97; } try { File = global.File; } catch (error) { r10 = value12; break exceptionLanding97; } try { convertedBlob = value12.convertedBlob; } catch (error) { r10 = value12; break exceptionLanding97; } try { items2 = []; } catch (error) { r10 = value12; break exceptionLanding97; } try { items2[0] = convertedBlob; } catch (error) { r10 = value12; break exceptionLanding97; } try { name = a0.name; } catch (error) { r10 = value12; break exceptionLanding97; } try { object = {}; } catch (error) { r10 = value12; break exceptionLanding97; } try { object.type = 'image/webp'; } catch (error) { r10 = value12; break exceptionLanding97; } try { lastModified = a0.lastModified; } catch (error) { r10 = value12; break exceptionLanding97; } try { object.lastModified = lastModified; } catch (error) { r10 = value12; break exceptionLanding97; } try { prototype = File.prototype; } catch (error) { r10 = value12; break exceptionLanding97; } try { } catch (error) { r10 = value12; break exceptionLanding97; } try { file = new File(); } catch (error) { r10 = value12; break exceptionLanding97; } try { value21 = file instanceof Object ? file : undefined; } catch (error) { r10 = value12; break exceptionLanding97; } try { object2.convertedFile = value21; } catch (error) { r10 = value12; break exceptionLanding97; } try { object2.convertedMimeType = 'image/webp'; } catch (error) { r10 = value12; break exceptionLanding97; } try { hashTimeMs = value12.hashTimeMs; } catch (error) { r10 = value12; break exceptionLanding97; } try { value22 = hashTimeMs != null; } catch (error) { r10 = value12; break exceptionLanding97; } reducibleJoin93: while (true) { if (value22) { r17 = hashTimeMs; break reducibleJoin93; } r17 = value; break reducibleJoin93; } try { object2.hashTimeMs = r17; } catch (error) { r10 = value12; break exceptionLanding97; } r10 = value12; break reducibleJoin101; } try { reason = value12.reason; } catch (error) { r10 = value12; break exceptionLanding97; } break reducibleJoin39; } try { reason = value12.reason; } catch (error) { r10 = value12; break exceptionLanding97; } break reducibleJoin39; } try { value16 = reason != null; } catch (error) { r10 = value12; break exceptionLanding97; } if (value16) { r18 = reason; } else { try { UNKNOWN_ERROR = ConversionFailureReason.UNKNOWN_ERROR; } catch (error) { r10 = value12; break exceptionLanding97; } r18 = UNKNOWN_ERROR; } try { binding = env2_18; } catch (error) { r10 = value12; break exceptionLanding97; } try { log = binding.log; } catch (error) { r10 = value12; break exceptionLanding97; } try { HermesInternal = global.HermesInternal; } catch (error) { r10 = value12; break exceptionLanding97; } try { concat = HermesInternal.concat; } catch (error) { r10 = value12; break exceptionLanding97; } try { value17 = 'webp conversion skipped for ' + a2 + ': ' + r18; } catch (error) { r10 = value12; break exceptionLanding97; } try { Reflect.apply(log, binding, [value17]); } catch (error) { r10 = value12; break exceptionLanding97; } try { object2.conversionFailureReason = r18; } catch (error) { r10 = value12; break exceptionLanding97; } r10 = value12; break reducibleJoin101; } Math = global.Math; round = Math.round; performance = global.performance; now = performance.now; value24 = Reflect.apply(round, Math, [Reflect.apply(now, performance, []) - value6]); reducibleJoin103: while (true) { if (r10 == null) { compressTimeMs = value; break reducibleJoin103; } compressTimeMs = r10.compressTimeMs; break reducibleJoin103; } r5 = compressTimeMs ?? value24; object2.compressTimeMs = r5; return object2; } binding = env2_18; warn = binding.warn; HermesInternal = global.HermesInternal; Reflect.apply(warn, binding, ['webp conversion skipped for ' + a2 + ': not enabled']); return null; } function value_40106(a0, a1, a2) { // fn#40106, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:22578, offset: 0x00c3945f, size: 30 bytes, params: 4, frame: 13 return env0_0.apply(this, arguments); } function value_40107(a0) { // fn#40107, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:22677, offset: 0x010f6580, size: 84 bytes, params: 2, frame: 12 if (a0 == null) { return true; } let value = environment.__proto__; const Millis = (Durations).Millis; const HOUR = Millis.HOUR; value = 12 * HOUR; const Date = global.Date; return Date.now() - a0 > value; } } } function* _fun40065(a0, a1) { // fn#40065, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4826:8077, offset: 0x010f46f6, size: 184 bytes, params: 3, frame: 17 var value3; var value4; var value5; var uploadAnalytics; var timing; var error; if (false) { return undefined; } let performance = global.performance; let now = performance.now; value = Reflect.apply(now, performance, []); try { value3 = a1(); } catch (error) { uploadAnalytics = this.uploadAnalytics; timing = uploadAnalytics.timing; performance = global.performance; now = performance.now; timing[a0] = Reflect.apply(now, performance, []) - value; throw error; } yield value3; try { value4 = undefined; value5 = false; } catch (error) { uploadAnalytics = this.uploadAnalytics; timing = uploadAnalytics.timing; performance = global.performance; now = performance.now; timing[a0] = Reflect.apply(now, performance, []) - value; throw error; } if (value5) { } timing = this.uploadAnalytics.timing; performance = global.performance; timing[a0] = performance.now() - value; return value4; } global.__d(_fun40022, 4648, [57, 29, 5, 102, 6, 7, 15, 17, 18, 162, 4649, 1312, 4401, 661, 3, 507, 4650, 4658, 672, 561, 22, 1458, 4660, 4691, 4692, 4696, 4697, 1216, 4659, 4651, 683, 4698, 4699, 1962, 2]) /* metro module 4648, dependencies: [57, 29, 5, 102, 6, 7, 15, 17, 18, 162, 4649, 1312, 4401, 661, 3, 507, 4650, 4658, 672, 561, 22, 1458, 4660, 4691, 4692, 4696, 4697, 1216, 4659, 4651, 683, 4698, 4699, 1962, 2] */;