/* Metro module 7392; source: unknown; dependencies: [7368, 7369, 7393, 7383, 7380, 7375] */ function _fun59559(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#59559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7570:6, offset: 0x016ecb8a, size: 127 bytes, params: 8, frame: 19 let env0_0 = require; const closure = updateSession_59560; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); require(7368) /* metro dependency 7368 */; require(7369) /* metro dependency 7369 */; require(7393) /* metro dependency 7393 */; exports.closeSession = function(a0, a1) { updateSession_59560(a0, a1 ? {status: a1} : a0.status !== 'ok' ? {} : {status: 'exited'}); }; exports.makeSession = function(a0) { var value2 = require(dependencyMap[3]).timestampInSeconds(); var object = {'sid': null, 'init': true, 'timestamp': null, 'started': null, 'duration': 0, 'status': 'ok', 'errors': 0, 'ignoreDuration': false}; object.sid = require(dependencyMap[4]).uuid4(); object.timestamp = value2; object.started = value2; object.toJSON = _fun59563; var env0_0 = object; if (a0) { updateSession_59560(object, a0); } return object; }; exports.updateSession = closure; } function updateSession_59560(a0) { // fn#59560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7570:30, offset: 0x016ecc09, size: 643 bytes, params: 2, frame: 15 var r3; var did; var value; var value2; const r1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; const user = r1.user; if (user) { r3 = !a0.ipAddress && r1.user.ip_address; if (r3) { a0.ipAddress = r1.user.ip_address; } did = a0.did; did = !did ? r1.did : did; if (!did) { r3 = r1.user.id || r1.user.email; r3 = !r3 ? r1.user.username : r3; a0.did = r3; } } const timestamp = r1.timestamp; if (timestamp) { r3 = timestamp; } else { value = require(7383) /* metro dependency 7383 */; value = value.timestampInSeconds(); r3 = value; } a0.timestamp = r3; if (r1.abnormal_mechanism) { a0.abnormal_mechanism = r1.abnormal_mechanism; } if (r1.ignoreDuration) { a0.ignoreDuration = r1.ignoreDuration; } if (r1.sid) { if (r1.sid.length === 32) { r3 = r1.sid; } else { value = require(7380) /* metro dependency 7380 */; value = value.uuid4(); r3 = value; } a0.sid = r3; } if (r1.init !== undefined) { a0.init = r1.init; } if (!a0.did && r1.did) { a0.did = '' + r1.did; } if (typeof r1.started === 'number') { a0.started = r1.started; } if (a0.ignoreDuration) { a0.duration = undefined; } else if (typeof r1.duration === 'number') { a0.duration = r1.duration; } else { value = a0.timestamp - a0.started; value2 = 0; a0.duration = value >= value2 ? value : value2; } if (r1.release) { a0.release = r1.release; } if (r1.environment) { a0.environment = r1.environment; } if (!a0.ipAddress && r1.ipAddress) { a0.ipAddress = r1.ipAddress; } const userAgent = a0.userAgent; if (!userAgent && r1.userAgent) { a0.userAgent = r1.userAgent; } if (typeof r1.errors === 'number') { a0.errors = r1.errors; } if (r1.status) { a0.status = r1.status; } } function makeSession_59562(a0) { // fn#59562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7570:1226, offset: 0x016ece8c, size: 119 bytes, params: 2, frame: 18 const value2 = (require(7383) /* metro dependency 7383 */).timestampInSeconds(); const object2 = {'sid': null, 'init': true, 'timestamp': null, 'started': null, 'duration': 0, 'status': 'ok', 'errors': 0, 'ignoreDuration': false}; object2.sid = (require(7380) /* metro dependency 7380 */).uuid4(); object2.timestamp = value2; object2.started = value2; object2.toJSON = toJSON_59563; if (a0) { updateSession_59560(object2, a0); } return object2; } function makeSession_59562ToJSON() { // fn#59563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7570:1395, owner: makeSession_59562.toJSON, offset: 0x016ecf03, size: 353 bytes, params: 1, frame: 19 var environment; const binding = env0_0; let value = environment.__proto__; value = undefined; const moduleValue = require(7375) /* metro dependency 7375 */; const dropUndefinedKeys = moduleValue.dropUndefinedKeys; const object2 = {}; object2.sid = '' + binding.sid; object2.init = binding.init; let Date = global.Date; const value2 = 1000 * binding.started; const value3 = Object.create(Date.prototype, {constructor: {value: Date}}); let date = new Date(value2); object2.started = (date instanceof Object ? date : value3).toISOString(); Date = global.Date; const value5 = 1000 * binding.timestamp; const value6 = Object.create(Date.prototype, {constructor: {value: Date}}); date = new Date(value5); object2.timestamp = (date instanceof Object ? date : value6).toISOString(); object2.status = binding.status; object2.errors = binding.errors; object2.did = typeof binding.did === 'number' ? '' + binding.did : typeof binding.did !== 'string' ? value : '' + binding.did; object2.duration = binding.duration; object2.abnormal_mechanism = binding.abnormal_mechanism; const userAgent = binding.userAgent; object2.attrs = {release: binding.release, environment: binding.environment, ip_address: binding.ipAddress, user_agent: userAgent}; return Reflect.apply(dropUndefinedKeys, moduleValue, [object2]); }