/* Metro module 7413; source: unknown; dependencies: [65, 57, 7370, 7414, 7375, 7416] */ function _fun59739(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#59739, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7591:6, offset: 0x016f16d8, size: 238 bytes, params: 8, frame: 18 let env0_0 = require; const closure = function(a0, a1) { var property; var value; var error; var iterator = a0[1][Symbol.iterator](); var iterator2 = iterator.next; var r1 = iterator; var item2 = Reflect.apply(iterator2, r1, []); var item = item2.value; item2 = item2.done ? undefined : r1; reducibleJoin2: while (true) { if (item2 === undefined) { return false; } break reducibleJoin2; } reducibleLoop2: while (true) { try { property = item[0]; } catch (error) { try { item2.return(); } catch { } throw error; } try { property = property.type; } catch (error) { try { item2.return(); } catch { } throw error; } try { value = a1(item, property); } catch (error) { try { item2.return(); } catch { } throw error; } if (value) { item2.return(); return true; } r1 = item2; item2 = Reflect.apply(iterator2, r1, []); item = item2.value; item2 = item2.done ? undefined : r1; if (item2 === undefined) { return false; } continue reducibleLoop2; } }; const env0_2 = require(65) /* metro dependency 65 */; const env0_3 = require(57) /* metro dependency 57 */; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_4 = {'session': 'session', 'sessions': 'session', 'attachment': 'attachment', 'transaction': 'transaction', 'event': 'error', 'client_report': 'internal', 'user_report': 'default', 'profile': 'profile', 'profile_chunk': 'profile', 'replay_event': 'replay', 'replay_recording': 'replay', 'check_in': 'monitor', 'feedback': 'feedback', 'span': 'span', 'statsd': 'metric_bucket', 'raw_security': 'security'}; exports.addItemToEnvelope = addItemToEnvelope_59742; exports.createAttachmentEnvelopeItem = createAttachmentEnvelopeItem_59743; exports.createEnvelope = function(a0) { return [a0, arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []]; }; exports.createEventEnvelopeHeaders = createEventEnvelopeHeaders_59745; exports.createSpanEnvelopeItem = function(a0) { return [{type: 'span'}, a0]; }; exports.envelopeContainsItemType = function(a0, a1) { var env0_0 = a1; return forEachEnvelopeItem_59740(a0, _fun59748); }; exports.envelopeItemTypeToDataCategory = envelopeItemTypeToDataCategory_59749; exports.forEachEnvelopeItem = closure; exports.getSdkMetadataForEnvelopeHeader = function(a0) { var sdk; if (a0) { if (a0.sdk) { sdk = a0.sdk; return {name: sdk.name, version: sdk.version}; } } }; exports.parseEnvelope = parseEnvelope_59751; exports.serializeEnvelope = serializeEnvelope_59754; } function encodeUTF8_59741(a0) { // fn#59741, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7591:153, offset: 0x016f17c6, size: 164 bytes, params: 2, frame: 14 var r0; var textEncoder; const GLOBAL_OBJ = (require(7370) /* metro dependency 7370 */).GLOBAL_OBJ; if (GLOBAL_OBJ.__SENTRY__) { if (GLOBAL_OBJ.__SENTRY__.encodePolyfill) { r0 = GLOBAL_OBJ.__SENTRY__.encodePolyfill(a0); } else { textEncoder = new global.TextEncoder(); textEncoder = textEncoder.encode(a0); r0 = textEncoder; } } else { textEncoder = new global.TextEncoder(); textEncoder = textEncoder.encode(a0); r0 = textEncoder; } return r0; } function createAttachmentEnvelopeItem_59743(a0) { // fn#59743, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7591:872, offset: 0x016f186a, size: 147 bytes, params: 2, frame: 14 var value; const r1 = typeof a0.data === 'string' ? encodeUTF8_59741(a0.data) : a0.data; value = Reflect.apply((require(7375) /* metro dependency 7375 */).dropUndefinedKeys, value, [{type: 'attachment', length: r1.length, filename: a0.filename, content_type: a0.contentType, attachment_type: a0.attachmentType}]); return [value, r1]; } function createEventEnvelopeHeaders_59745(a0, a1, a2, a3) { // fn#59745, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7591:1267, offset: 0x016f18fd, size: 269 bytes, params: 5, frame: 24 var r0; var object2; var dropUndefinedKeys; var Object2; let value = a1; const value2 = a3; const r12 = a0.sdkProcessingMetadata && a0.sdkProcessingMetadata.dynamicSamplingContext; const Object = global.Object; const assign = Object.assign; const object4 = {}; object4.event_id = a0.event_id; const Date = global.Date; const value3 = Object.create(Date.prototype, {constructor: {value: Date}}); const date = new Date(); object4.sent_at = (date instanceof Object ? date : value3).toISOString(); const r2 = value && ({sdk: value}); let r1 = a2 ? value2 : !!a2; if (r1) { object2 = {}; object2.dsn = (require(7416) /* metro dependency 7416 */).dsnToString(value2); r1 = object2; } if (r12) { value = require(7375) /* metro dependency 7375 */; dropUndefinedKeys = value.dropUndefinedKeys; Object2 = global.Object; r0 = {trace: Reflect.apply(dropUndefinedKeys, value, [Object2.assign({}, r12)])}; } else { r0 = r12; } return Reflect.apply(assign, Object, [object4, r2, r1, r0]); } function envelopeContainsItemType_59747(a0, a1) { // fn#59747, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7591:1688, offset: 0x016f1a0a, size: 34 bytes, params: 3, frame: 13 const env0_0 = a1; return forEachEnvelopeItem_59740(a0, function(a0, a1) { return require.includes(a1); }); } function parseEnvelope_59751(a0) { // fn#59751, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7591:2090, offset: 0x016f1a5d, size: 162 bytes, params: 2, frame: 20 var r0; var r9; var value4; var push; var items2; var value5; var value6; let value = a0; const closure = parseEnvelope_59751ReadBinary; const closure2 = parseEnvelope_59751ReadJson; if (typeof value !== 'string') { r0 = value; } else { value = encodeUTF8_59741(value); r0 = value; } const env0_0 = r0; value = undefined; const value3 = closure2(); const items3 = []; let length = env0_0.length; if (length) { while (true) { value4 = closure2(); length = value4.length; length = typeof length !== 'number' ? value : value4.length; push = items3.push; items2 = [value4]; if (length) { value6 = closure(length); r9 = value6; } else { value5 = closure2(); r9 = value5; } items2[1] = r9; Reflect.apply(push, items3, [items2]); length = env0_0.length; if (length) { continue; } break; } } return [value3, items3]; } function serializeEnvelope_59754(a0) { // fn#59754, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7591:2675, offset: 0x016f1bde, size: 328 bytes, params: 2, frame: 29 var environment; var r4; var r13; var r0; var closure; var value; var value2; var property; var property2; var JSON; var stringify; var iterator; var iterator2; var item; var item2; var binding; var value3; var property3; var value4; var HermesInternal; var concat; var value5; var value6; var Uint8Array; var value7; var value8; var error; var moduleValue; var normalize; var value9; var value10; exceptionLanding42: while (true) { closure = serializeEnvelope_59754Append; value = environment; value2 = env0_3(a0, 2); property = value2[0]; property2 = value2[1]; JSON = global.JSON; stringify = JSON.stringify; var env0_0 = Reflect.apply(stringify, JSON, [property]); iterator = property2[Symbol.iterator](); iterator2 = iterator.next; r4 = iterator; reducibleLoop1: while (true) { item2 = Reflect.apply(iterator2, r4, []); item = item2.value; item2 = item2.done ? undefined : r4; if (item2 === undefined) { break reducibleLoop1; } try { binding = env0_3; } catch (error) { break exceptionLanding42; } try { value3 = binding(item, 2); } catch (error) { break exceptionLanding42; } try { property = value3[0]; } catch (error) { break exceptionLanding42; } try { property3 = value3[1]; } catch (error) { break exceptionLanding42; } try { JSON = global.JSON; } catch (error) { break exceptionLanding42; } try { stringify = JSON.stringify; } catch (error) { break exceptionLanding42; } try { value4 = Reflect.apply(stringify, JSON, [property]); } catch (error) { break exceptionLanding42; } try { HermesInternal = global.HermesInternal; } catch (error) { break exceptionLanding42; } try { concat = HermesInternal.concat; } catch (error) { break exceptionLanding42; } try { value5 = '\n' + value4 + '\n'; } catch (error) { break exceptionLanding42; } try { closure(value5); } catch (error) { break exceptionLanding42; } try { value6 = typeof property3 === 'string'; } catch (error) { break exceptionLanding42; } if (!value6) { try { Uint8Array = global.Uint8Array; } catch (error) { break exceptionLanding42; } try { value7 = property3 instanceof Uint8Array; } catch (error) { break exceptionLanding42; } reducibleJoin40: while (true) { if (value7) { break reducibleJoin40; } reducibleJoin22: while (true) { reduciblePort37: while (true) { exceptionLanding26: while (true) { try { try { JSON = global.JSON; } catch (error) { break exceptionLanding26; } } catch (error) { break exceptionLanding42; } break reducibleJoin22; } try { JSON = global.JSON; } catch (error) { break exceptionLanding42; } try { stringify = JSON.stringify; } catch (error) { break exceptionLanding42; } try { } catch (error) { break exceptionLanding42; } try { } catch (error) { break exceptionLanding42; } try { property = dependencyMap[3]; } catch (error) { break exceptionLanding42; } try { moduleValue = require(property); } catch (error) { break exceptionLanding42; } try { normalize = moduleValue.normalize; } catch (error) { break exceptionLanding42; } try { value9 = Reflect.apply(normalize, moduleValue, [property3]); } catch (error) { break exceptionLanding42; } try { value10 = Reflect.apply(stringify, JSON, [value9]); } catch (error) { break exceptionLanding42; } r13 = value10; break reduciblePort37; } try { closure(r13); } catch (error) { break exceptionLanding42; } r4 = item2; continue reducibleLoop1; } try { try { stringify = JSON.stringify; } catch (error) { break exceptionLanding26; } } catch (error) { break exceptionLanding42; } try { try { value8 = Reflect.apply(stringify, JSON, [property3]); } catch (error) { break exceptionLanding26; } } catch (error) { break exceptionLanding42; } r13 = value8; try { closure(r13); } catch (error) { break exceptionLanding42; } r4 = item2; continue reducibleLoop1; } } try { closure(property3); } catch (error) { break exceptionLanding42; } r4 = item2; continue reducibleLoop1; } if (typeof env0_0 === 'string') { binding = env0_0; r0 = binding; } else { binding = env0_0; value = ((a0) => { var error; var value = 0; var value2 = a0.reduce(_fun59757, value); var property = global.Uint8Array; var value4 = new property(value2); var iterator = a0[Symbol.iterator](); var iterator2 = iterator.next; var r2 = iterator; var r4 = value; var item2 = Reflect.apply(iterator2, r2, []); var item = item2.value; item2 = item2.done ? undefined : r2; reducibleJoin2: while (true) { if (item2 === undefined) { return value4; } break reducibleJoin2; } reducibleLoop2: while (true) { try { property = value4.set; } catch (error) { try { item2.return(); } catch { } throw error; } try { Reflect.apply(property, value4, [item, r4]); } catch (error) { try { item2.return(); } catch { } throw error; } try { property = item.length; } catch (error) { try { item2.return(); } catch { } throw error; } try { value = r4 + property; } catch (error) { try { item2.return(); } catch { } throw error; } r2 = item2; r4 = value; item2 = Reflect.apply(iterator2, r2, []); item = item2.value; item2 = item2.done ? undefined : r2; if (item2 === undefined) { break reducibleLoop2; } continue reducibleLoop2; } return value4; })(binding); r0 = value; } return r0; } try { item2.return(); } catch { } throw error; } function parseEnvelope_59751ReadJson() { // fn#59753, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7591:2229, owner: parseEnvelope_59751.readJson, offset: 0x016f1aff, size: 223 bytes, params: 1, frame: 17 var r0; var TextDecoder; var value4; var textDecoder; const value2 = env0_0.indexOf(10); const r4 = value2 < 0 ? env0_0.length : value2; const JSON = global.JSON; const parse = JSON.parse; let value = parseEnvelope_59751ReadBinary(r4); const GLOBAL_OBJ = (require(7370) /* metro dependency 7370 */).GLOBAL_OBJ; if (GLOBAL_OBJ.__SENTRY__) { if (GLOBAL_OBJ.__SENTRY__.decodePolyfill) { value = GLOBAL_OBJ.__SENTRY__.decodePolyfill(value); r0 = value; } else { TextDecoder = global.TextDecoder; value4 = Object.create(TextDecoder.prototype, {constructor: {value: TextDecoder}}); textDecoder = new TextDecoder(); value = (textDecoder instanceof Object ? textDecoder : value4).decode(value); r0 = value; } } else { TextDecoder = global.TextDecoder; value4 = Object.create(TextDecoder.prototype, {constructor: {value: TextDecoder}}); textDecoder = new TextDecoder(); value = (textDecoder instanceof Object ? textDecoder : value4).decode(value); r0 = value; } return Reflect.apply(parse, JSON, [r0]); } function serializeEnvelope_59754ConcatBuffers(a0) { // fn#59756, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7591:3139, owner: serializeEnvelope_59754.concatBuffers, offset: 0x016f1d26, size: 114 bytes, params: 2, frame: 18 var set; var length; var error; let value = 0; const value2 = a0.reduce(function(a0, a1) { return a0 + a1.length; }, value); const Uint8Array = global.Uint8Array; const uint8Array = new Uint8Array(value2); const iterator = a0[Symbol.iterator](); const iterator2 = iterator.next; let r2 = iterator; let r4 = value; let item2 = Reflect.apply(iterator2, r2, []); let item = item2.value; item2 = item2.done ? undefined : r2; reducibleJoin2: while (true) { if (item2 === undefined) { return uint8Array; } break reducibleJoin2; } reducibleLoop2: while (true) { try { set = uint8Array.set; } catch (error) { try { item2.return(); } catch { } throw error; } try { Reflect.apply(set, uint8Array, [item, r4]); } catch (error) { try { item2.return(); } catch { } throw error; } try { length = item.length; } catch (error) { try { item2.return(); } catch { } throw error; } try { value = r4 + length; } catch (error) { try { item2.return(); } catch { } throw error; } r2 = item2; r4 = value; item2 = Reflect.apply(iterator2, r2, []); item = item2.value; item2 = item2.done ? undefined : r2; if (item2 === undefined) { break reducibleLoop2; } continue reducibleLoop2; } return uint8Array; }