659 lines
28 KiB
TypeScript
659 lines
28 KiB
TypeScript
/* Metro module 8081; source: modules/rpc/RPCHelpers.tsx; dependencies: [5, 4234, 4235, 1383, 1885, 1379, 1867, 4259, 4814, 4396, 1878, 4297, 4135, 661, 1471, 4100, 672, 22, 7067, 6622, 4634, 8082, 4617, 1473, 4122, 507, 8076, 8067, 8083, 2] */
|
|
function _fun64757(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#64757, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6, offset: 0x01bb43b5, size: 1047 bytes, params: 8, frame: 31
|
|
var value7;
|
|
var property2;
|
|
var regexp;
|
|
var RegExp;
|
|
const env0_0 = require;
|
|
const closure = function(a0) {
|
|
var r0;
|
|
var protocol;
|
|
var host;
|
|
var value2;
|
|
var value3;
|
|
var value = a0;
|
|
if (RegExp('^http', '').test(value)) {
|
|
r0 = value;
|
|
} else {
|
|
protocol = global.location.protocol;
|
|
host = global.location.host;
|
|
value2 = value.charAt(0);
|
|
value3 = '/';
|
|
value = '' + protocol + '//' + host + (value3 !== value2 ? value3 : '') + value;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
const closure2 = function(a0) {
|
|
var value = a1;
|
|
return (value !== undefined ? value : []).indexOf(a0) > -1;
|
|
};
|
|
const closure3 = transformInternalTextMessage;
|
|
const closure4 = transformVoiceState;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = undefined;
|
|
const env0_3 = importDefault(5) /* metro dependency 5 */;
|
|
const applicationStore = importDefault(4234) /* metro dependency 4234: ApplicationStore */;
|
|
const applicationRecord = importDefault(4235) /* metro dependency 4235: ApplicationRecord */;
|
|
const env0_6 = (require(1383) /* metro dependency 1383: ChannelRecord */).GUILD_VOCAL_CHANNEL_TYPES;
|
|
const userRecord = importDefault(1885) /* metro dependency 1885: UserRecord */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */;
|
|
const messageStore = importDefault(4814) /* metro dependency 4814: MessageStore */;
|
|
const presenceStore = importDefault(4396) /* metro dependency 4396: PresenceStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const voiceStateStore = importDefault(4297) /* metro dependency 4297: VoiceStateStore */;
|
|
const constantsModule = require(4135) /* metro dependency 4135: Constants */;
|
|
const env0_15 = constantsModule.RPC_LOCAL_SCOPE;
|
|
const env0_16 = constantsModule.TransportTypes;
|
|
const constantsModule2 = require(661) /* metro dependency 661: Constants */;
|
|
const env0_17 = constantsModule2.ActivityActionTypes;
|
|
const env0_18 = constantsModule2.ChannelTypes;
|
|
const env0_19 = constantsModule2.Endpoints;
|
|
const env0_20 = constantsModule2.MAX_MESSAGES_PER_CHANNEL;
|
|
const env0_21 = constantsModule2.RPCCloseCodes;
|
|
const env0_22 = constantsModule2.RPCErrors;
|
|
const env0_23 = constantsModule2.RTCConnectionStates;
|
|
const urlUtils = importDefault(1471) /* metro dependency 1471: URLUtils */;
|
|
const toURLSafe = urlUtils.toURLSafe;
|
|
const GLOBAL_ENV = global.window.GLOBAL_ENV;
|
|
const API_ENDPOINT = GLOBAL_ENV.API_ENDPOINT;
|
|
const value5 = Reflect.apply(toURLSafe, urlUtils, [API_ENDPOINT]);
|
|
let r16 = (value5 == null ? value : value5.host) ?? 'localhost';
|
|
const property = r16.split(':')[0];
|
|
if (property.includes('.')) {
|
|
value7 = property.split('.');
|
|
property2 = value7[value7.length - 1];
|
|
regexp = RegExp('^\\d+$', '');
|
|
r16 = regexp.test(property2) ? property : value7.slice(-2).join('.');
|
|
} else {
|
|
r16 = property;
|
|
}
|
|
RegExp = global.RegExp;
|
|
const regExp = new RegExp('^' + (importDefault(4100) /* metro dependency 4100: RegexUtils */).escape('https://') + '(?:[a-z]+\\.)?(' + (importDefault(4100) /* metro dependency 4100: RegexUtils */).escape(r16) + '|discordapp.com|discord.com)$');
|
|
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
const MINUTE = Millis.MINUTE;
|
|
const value17 = 1 * MINUTE;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/rpc/RPCHelpers.tsx');
|
|
exports.VALIDATE_SOCKET_CALLS_PER_PERIOD_LOW = 2;
|
|
exports.VALIDATE_SOCKET_CALLS_PER_PERIOD_HIGH = 60;
|
|
exports.VALIDATE_SOCKET_PERIOD_MS = value17;
|
|
exports.VALIDATE_SOCKET_THROTTLERS = {};
|
|
exports.getRemoteIconURL = closure;
|
|
exports.containsSameValues = containsSameValues;
|
|
exports.validateOrigin = closure2;
|
|
exports.transformChannel = transformChannel;
|
|
exports.transformInternalTextMessage = closure3;
|
|
exports.transformVoiceState = closure4;
|
|
exports.transformBaseRelationship = function(a0, a1) {
|
|
var object = {type: a0};
|
|
object.user = importDefault(dependencyMap[21])(a1);
|
|
var object2 = {};
|
|
object2.status = PresenceStore.getStatus(a1.id, null);
|
|
object2.activity = null;
|
|
object.presence = object2;
|
|
return object;
|
|
};
|
|
exports.transformApplicationRelationship = transformApplicationRelationship;
|
|
exports.isMatchingOrigin = isMatchingOrigin;
|
|
exports.hasMessageReadPermission = hasMessageReadPermission;
|
|
exports.getVoiceConnectionState = function(a0) {
|
|
if (RTCConnectionStates.RTC_CONNECTED === a0) {
|
|
return a0.replace(RegExp('^RTC_', ''), 'VOICE_');
|
|
}
|
|
if (RTCConnectionStates.RTC_CONNECTING === a0) {
|
|
return a0.replace(RegExp('^RTC_', ''), 'VOICE_');
|
|
}
|
|
if (RTCConnectionStates.RTC_DISCONNECTED === a0) {
|
|
return a0.replace(RegExp('^RTC_', ''), 'VOICE_');
|
|
}
|
|
return a0;
|
|
};
|
|
exports.validateActivityInvite = validateActivityInvite;
|
|
exports.validateSocketApplication = function() {
|
|
return _validateSocketApplication.apply(this, arguments);
|
|
};
|
|
exports.processSocketThrottlers = function() {
|
|
return _processSocketThrottlers.apply(this, arguments);
|
|
};
|
|
exports.validateOriginAndUpdateSocket = validateOriginAndUpdateSocket;
|
|
exports.getDeprecatedVoiceSettingsWithShortcut = getDeprecatedVoiceSettingsWithShortcut;
|
|
exports.getVoiceSettingsWithShortcut = getVoiceSettingsWithShortcut;
|
|
exports.validatePostMessageTransport = validatePostMessageTransport;
|
|
exports.validateApplication = validateApplication;
|
|
return value;
|
|
}
|
|
|
|
function recurseReplaceContentTree(a0) { // fn#64758, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:891, offset: 0x01bb47cc, size: 133 bytes, params: 2, frame: 12
|
|
if (a0.type === 'customEmoji') {
|
|
a0.type = 'emoji';
|
|
}
|
|
if (a0.type === 'emoji' && a0.src) {
|
|
a0.src = getRemoteIconURL(a0.src);
|
|
}
|
|
const Array = global.Array;
|
|
const isArray = Array.isArray;
|
|
let content = a0.content;
|
|
if (Reflect.apply(isArray, Array, [content])) {
|
|
content = a0.content;
|
|
a0.content = content.map(recurseReplaceContentTree);
|
|
}
|
|
return a0;
|
|
}
|
|
|
|
function transformInternalTextMessage(a0) { // fn#64761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:1294, offset: 0x01bb48f3, size: 466 bytes, params: 2, frame: 21
|
|
var object2;
|
|
var r4;
|
|
var userRecord;
|
|
const value2 = undefined;
|
|
const defaultImport = importDefault(6622) /* metro dependency 6622: MarkupUtils */;
|
|
const toAST = defaultImport.parseToAST(a0.content, true, {channelId: a0.channel_id});
|
|
const value3 = toAST.map(recurseReplaceContentTree);
|
|
const channel = ChannelStore.getChannel(a0.channel_id);
|
|
if (a0.author != null) {
|
|
userRecord = new UserRecord(a0.author);
|
|
} else {
|
|
r4 = value2;
|
|
}
|
|
const r7 = a0.author != null ? (require(4634) /* metro dependency 4634: useMessageAuthor */).getUserAuthor(r4,
|
|
channel) : value2;
|
|
object2 = {};
|
|
object2.id = a0.id;
|
|
object2.blocked = a0.blocked;
|
|
object2.bot = a0.bot;
|
|
object2.content = a0.content;
|
|
object2.content_parsed = value3.length ? value3 : value2;
|
|
object2.nick = r7 == null ? value2 : r7.nick;
|
|
object2.author_color = r7 == null ? value2 : r7.colorString;
|
|
object2.edited_timestamp = a0.edited_timestamp || a0.editedTimestamp;
|
|
object2.timestamp = a0.timestamp;
|
|
object2.tts = a0.tts;
|
|
object2.mentions = a0.mentions;
|
|
object2.mention_everyone = a0.mention_everyone || a0.mentionEveryone;
|
|
object2.mention_roles = a0.mention_roles || a0.mentionRoles;
|
|
object2.embeds = a0.embeds;
|
|
object2.attachments = a0.attachments;
|
|
object2.author = r4 != null ? (importDefault(8082) /* metro dependency 8082: transformUser */)(r4) : value2;
|
|
object2.pinned = a0.pinned;
|
|
object2.type = a0.type;
|
|
return object2;
|
|
}
|
|
|
|
function transformVoiceState(a0, a1, {mute, deaf, selfMute, selfDeaf, suppress, userId}) { // fn#64762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2031, offset: 0x01bb4ac5, size: 299 bytes, params: 4, frame: 26
|
|
var Error;
|
|
var value;
|
|
const user = UserStore.getUser(userId);
|
|
if (user == null) {
|
|
Error = global.Error;
|
|
value = 'Invalid user id: ' + userId;
|
|
throw new Error();
|
|
}
|
|
const object2 = {};
|
|
object2.nick = (importDefault(4617) /* metro dependency 4617: NicknameUtils */).getName(a0, a1, user);
|
|
object2.mute = MediaEngineStore.isLocalMute(user.id);
|
|
object2.volume = MediaEngineStore.getLocalVolume(user.id);
|
|
object2.pan = MediaEngineStore.getLocalPan(user.id);
|
|
object2.voice_state = {mute: mute, deaf: deaf, self_mute: selfMute, self_deaf: selfDeaf, suppress: suppress};
|
|
object2.user = (importDefault(8082) /* metro dependency 8082: transformUser */)(user);
|
|
return object2;
|
|
}
|
|
|
|
function fetchApplicationRPC(a0) { // fn#64763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2392, offset: 0x01bb4bf0, size: 103 bytes, params: 2, frame: 16
|
|
const HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
const get = HTTP.get;
|
|
const object2 = {'url': null, 'oldFormErrors': true, 'retries': 3, 'rejectWithError': true};
|
|
object2.url = Endpoints.APPLICATION_RPC(a0);
|
|
return Reflect.apply(get, HTTP, [object2]).then(function(a0) {
|
|
return a0.body;
|
|
}, _fun64765);
|
|
}
|
|
|
|
function _validateSocketApplication() { // fn#64766, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2627, offset: 0x01bb4ca0, size: 48 bytes, params: 1, frame: 14
|
|
return env0_3(_fun64768).apply(this, arguments);
|
|
}
|
|
|
|
function _processSocketThrottlers() { // fn#64769, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:3316, offset: 0x01bb4e9e, size: 48 bytes, params: 1, frame: 14
|
|
return env0_3(_fun64771).apply(this, arguments);
|
|
}
|
|
|
|
function containsSameValues(a0, a1) { // fn#64772, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:3881, offset: 0x01bb4fae, size: 84 bytes, params: 3, frame: 16
|
|
const value = importDefault(22) /* metro dependency 22 */;
|
|
const isEqual = value.isEqual;
|
|
const defaultImport = importDefault(22) /* metro dependency 22 */;
|
|
const pick = defaultImport.pick;
|
|
const Object = global.Object;
|
|
return Reflect.apply(isEqual, value, [a0, Reflect.apply(pick, defaultImport, [a1, Object.keys(a0)])]);
|
|
}
|
|
|
|
function transformChannel(a0, a1) { // fn#64773, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4029, offset: 0x01bb5002, size: 166 bytes, params: 3, frame: 16
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const items3 = [];
|
|
const env0_2 = a0.getGuildId();
|
|
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
|
|
const items2 = [GUILD_CATEGORY];
|
|
arraySpread(items2, GUILD_VOCAL_CHANNEL_TYPES, 1, GUILD_CATEGORY);
|
|
if (!items2.includes(a0.type)) {
|
|
items3.push(new global.Promise(function(a0) {
|
|
var binding = a0;
|
|
MessageStore.whenReady(binding.id, _fun64775);
|
|
importDefault(dependencyMap[18]).fetchMessages({channelId: binding.id, limit: MAX_MESSAGES_PER_CHANNEL});
|
|
}));
|
|
}
|
|
const Promise = global.Promise;
|
|
return Promise.all(items3).then(_fun64776);
|
|
}
|
|
|
|
function transformApplicationRelationship(a0, a1) { // fn#64779, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4960, offset: 0x01bb529b, size: 106 bytes, params: 3, frame: 17
|
|
var r0;
|
|
var object3;
|
|
var object4;
|
|
let value = a0;
|
|
const value2 = null;
|
|
if (value2 == a1) {
|
|
r0 = value;
|
|
} else {
|
|
object3 = {};
|
|
copyDataProperties(object3, value, a1);
|
|
object4 = {};
|
|
copyDataProperties(object4, value.presence, a1);
|
|
value = PresenceStore.getApplicationActivity(value.user.id, a1);
|
|
object4['activity'] = value2 != value ? value : value2;
|
|
object3['presence'] = object4;
|
|
r0 = object3;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function isMatchingOrigin(a0) { // fn#64780, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:5147, offset: 0x01bb5305, size: 237 bytes, params: 2, frame: 18
|
|
var r0;
|
|
var value;
|
|
var property;
|
|
var defaultImport;
|
|
var value2;
|
|
var hostname;
|
|
var value5;
|
|
var value6;
|
|
var error;
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
const origin = global.window.location.origin;
|
|
if (a0 === origin) {
|
|
return true;
|
|
}
|
|
try {
|
|
value = environment;
|
|
property = dependencyMap[23];
|
|
defaultImport = importDefault(property);
|
|
value2 = defaultImport.parse(a0);
|
|
hostname = value2.hostname;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
let r1 = global.window.location.hostname === hostname && hostname === 'localhost';
|
|
if (r1) {
|
|
r0 = r1;
|
|
} else {
|
|
value5 = a0.match('staging') == null;
|
|
if (value5) {
|
|
value6 = env0_24.test(a0);
|
|
r1 = !(value6 ? !env0_24.test(origin) : !value6);
|
|
} else {
|
|
r1 = value5;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function hasMessageReadPermission(a0, a1, a2) { // fn#64781, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:5432, offset: 0x01bb53f2, size: 125 bytes, params: 4, frame: 14
|
|
var r0;
|
|
var value;
|
|
const getGuild = GuildStore.getGuild;
|
|
const getGuildId = a0.getGuildId;
|
|
const value2 = Reflect.apply(getGuild, GuildStore, [Reflect.apply(getGuildId, a0, [])]);
|
|
const value4 = (value2 != null ? value2.application_id : a0.getApplicationId()) === a1;
|
|
if (value4) {
|
|
r0 = value4;
|
|
} else {
|
|
value = a2.indexOf((require(4122) /* metro dependency 4122: OAuth2Scopes */).OAuth2Scopes.MESSAGES_READ);
|
|
value = value > -1;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function validateActivityInvite(a0, a1, a2) { // fn#64783, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:5837, offset: 0x01bb54c2, size: 64 bytes, params: 4, frame: 5
|
|
var r1;
|
|
var r0;
|
|
const JOIN = ActivityActionTypes.JOIN;
|
|
const value = a0 === JOIN;
|
|
if (value) {
|
|
r1 = a1 != null && a1.id != null;
|
|
r1 = r1 && a2.join != null;
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function validateOriginAndUpdateSocket(a0, a1) { // fn#64786, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6205, offset: 0x01bb5502, size: 43 bytes, params: 3, frame: 3
|
|
if (a1 == null) {
|
|
a0.authorization.scopes = [RPC_LOCAL_SCOPE];
|
|
}
|
|
}
|
|
|
|
function getDeprecatedVoiceSettingsWithShortcut(a0) { // fn#64787, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6330, offset: 0x01bb552d, size: 296 bytes, params: 2, frame: 17
|
|
const settings = MediaEngineStore.getSettings();
|
|
const closure = function(a0) {
|
|
var Object = global.Object;
|
|
var value = Object.values(a0);
|
|
value = value.sort(_fun64789);
|
|
return value.map(_fun64790);
|
|
};
|
|
const value3 = a0(settings);
|
|
const object4 = {};
|
|
const object5 = {};
|
|
const getInputDevices = MediaEngineStore.getInputDevices;
|
|
object5.available_devices = closure(Reflect.apply(getInputDevices, MediaEngineStore, []));
|
|
object5.device_id = settings.inputDeviceId;
|
|
object5.volume = settings.inputVolume;
|
|
object4.input = object5;
|
|
const object6 = {};
|
|
const getOutputDevices = MediaEngineStore.getOutputDevices;
|
|
object6.available_devices = closure(Reflect.apply(getOutputDevices, MediaEngineStore, []));
|
|
object6.device_id = settings.outputDeviceId;
|
|
object6.volume = settings.outputVolume;
|
|
object4.output = object6;
|
|
object4.mode = {type: settings.mode, auto_threshold: settings.modeOptions.autoThreshold,
|
|
threshold: settings.modeOptions.threshold, shortcut: value3, delay: settings.modeOptions.delay};
|
|
object4.automatic_gain_control = settings.automaticGainControl;
|
|
object4.echo_cancellation = settings.echoCancellation;
|
|
object4.noise_suppression = settings.noiseSuppression;
|
|
object4.qos = settings.qos;
|
|
object4.silence_warning = settings.silenceWarning;
|
|
object4.deaf = settings.deaf;
|
|
object4.mute = settings.mute;
|
|
return object4;
|
|
}
|
|
|
|
function getVoiceSettingsWithShortcut(a0, a1) { // fn#64791, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:7090, offset: 0x01bb56bc, size: 124 bytes, params: 3, frame: 13
|
|
const settings = MediaEngineStore.getSettings(a0);
|
|
const value2 = a1(settings);
|
|
const Object = global.Object;
|
|
return {input_mode: {type: settings.mode, shortcut: value2}, local_mutes: Object.keys(settings.localMutes),
|
|
local_volumes: settings.localVolumes, self_mute: settings.mute, self_deaf: settings.deaf};
|
|
}
|
|
|
|
function validatePostMessageTransport(a0) { // fn#64792, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:7341, offset: 0x01bb5738, size: 119 bytes, params: 2, frame: 15
|
|
var defaultImport;
|
|
var value;
|
|
const POST_MESSAGE = TransportTypes.POST_MESSAGE;
|
|
if (a0 !== POST_MESSAGE) {
|
|
defaultImport = importDefault(8076) /* metro dependency 8076: RPCError */;
|
|
({}).errorCode = RPCErrors.INVALID_COMMAND;
|
|
value = 'command not available from "' + a0 + ' transport';
|
|
value = new defaultImport();
|
|
throw value;
|
|
}
|
|
}
|
|
|
|
function validateApplication(a0) { // fn#64793, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:7525, offset: 0x01bb57af, size: 94 bytes, params: 2, frame: 13
|
|
if (a0.id == null) {
|
|
throw new (importDefault(8076) /* metro dependency 8076: RPCError */)({errorCode: RPCErrors.INVALID_COMMAND},
|
|
'Invalid application');
|
|
}
|
|
return a0.id;
|
|
}
|
|
|
|
function _fun64765() { // fn#64765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2546, offset: 0x01bb4c57, size: 73 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
const defaultImport = importDefault(8076) /* metro dependency 8076: RPCError */;
|
|
const INVALID_CLIENTID = RPCCloseCodes.INVALID_CLIENTID;
|
|
throw new defaultImport({closeCode: INVALID_CLIENTID}, 'Invalid Client ID');
|
|
}
|
|
|
|
function* _fun64768(a0, a1, a2) { // fn#64768, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2702, offset: 0x01bb4cd9, size: 453 bytes, params: 4, frame: 21
|
|
var r3;
|
|
var createFromServer;
|
|
var value8;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
let binding = env2_4;
|
|
const application = binding.getApplication(a1);
|
|
if (typeof a2 !== 'string') {
|
|
r3 = application;
|
|
if (r3 != null) {
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
createFromServer = binding.createFromServer;
|
|
yield env2_32(a1);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
value = Reflect.apply(createFromServer, binding, [value]);
|
|
r3 = value;
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
const transport = a0.transport;
|
|
const POST_MESSAGE = env2_16.POST_MESSAGE;
|
|
if (transport === POST_MESSAGE) {
|
|
binding = env2_1;
|
|
value8 = binding(env2_2[27])(a1);
|
|
if (value8 == null) {
|
|
throw new env2_1(env2_2[26])({closeCode: env2_21.INVALID_ORIGIN}, 'Invalid Origin');
|
|
}
|
|
binding = env2_29;
|
|
if (binding(a2, [value8])) {
|
|
r3 = application;
|
|
if (r3 != null) {
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon,
|
|
coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
createFromServer = binding.createFromServer;
|
|
yield env2_32(a1);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
value = Reflect.apply(createFromServer, binding, [value]);
|
|
r3 = value;
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
binding = env2_1;
|
|
throw new binding(env2_2[26])({closeCode: env2_21.INVALID_ORIGIN}, 'Invalid Origin');
|
|
}
|
|
yield env2_32(a1);
|
|
const value4 = undefined;
|
|
if (false) {
|
|
return value4;
|
|
}
|
|
const fromServer = env2_5.createFromServer(value4);
|
|
binding = env2_29;
|
|
if (binding(a2, value4.rpc_origins)) {
|
|
r3 = fromServer;
|
|
if (r3 != null) {
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
createFromServer = binding.createFromServer;
|
|
yield env2_32(a1);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
value = Reflect.apply(createFromServer, binding, [value]);
|
|
r3 = value;
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
const value6 = env2_1(env2_2[26]);
|
|
const INVALID_ORIGIN = env2_21.INVALID_ORIGIN;
|
|
throw new value6({closeCode: INVALID_ORIGIN}, 'Invalid Origin');
|
|
}
|
|
|
|
function* _fun64771(a0, a1, a2) { // fn#64771, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:3387, offset: 0x01bb4ed7, size: 215 bytes, params: 4, frame: 19
|
|
var r9;
|
|
var r3;
|
|
var binding;
|
|
var value5;
|
|
var prototype;
|
|
var value6;
|
|
var value7;
|
|
var value8;
|
|
var process;
|
|
var value9;
|
|
var value10;
|
|
var value11;
|
|
var error;
|
|
var value12;
|
|
var object2;
|
|
var CLOSE_ABNORMAL;
|
|
var value13;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const property = env2_26[a0];
|
|
if (property == null) {
|
|
r9 = a1 ? 2 : 60;
|
|
binding = env2_1;
|
|
value5 = binding(env2_2[28]);
|
|
binding = env2_25;
|
|
prototype = value5.prototype;
|
|
value6 = Object.create(prototype, {constructor: {value: value5}});
|
|
value7 = new value5();
|
|
value8 = value7 instanceof Object ? value7 : value6;
|
|
env2_26[a0] = value8;
|
|
r3 = value8;
|
|
} else {
|
|
r3 = property;
|
|
}
|
|
try {
|
|
process = r3.process;
|
|
} catch (error) {
|
|
binding = env2_1;
|
|
value12 = binding(env2_2[26]);
|
|
object2 = {};
|
|
CLOSE_ABNORMAL = env2_21.CLOSE_ABNORMAL;
|
|
object2.closeCode = CLOSE_ABNORMAL;
|
|
prototype = value12.prototype;
|
|
value = Object.create(prototype, {constructor: {value: value12}});
|
|
value13 = new value12(object2, 'Socket closed during throttle');
|
|
value = value13 instanceof Object ? value13 : value;
|
|
throw value;
|
|
}
|
|
try {
|
|
value9 = Reflect.apply(process, r3, [a2]);
|
|
} catch (error) {
|
|
binding = env2_1;
|
|
value12 = binding(env2_2[26]);
|
|
object2 = {};
|
|
CLOSE_ABNORMAL = env2_21.CLOSE_ABNORMAL;
|
|
object2.closeCode = CLOSE_ABNORMAL;
|
|
prototype = value12.prototype;
|
|
value = Object.create(prototype, {constructor: {value: value12}});
|
|
value13 = new value12(object2, 'Socket closed during throttle');
|
|
value = value13 instanceof Object ? value13 : value;
|
|
throw value;
|
|
}
|
|
yield value9;
|
|
try {
|
|
value10 = undefined;
|
|
value11 = false;
|
|
} catch (error) {
|
|
binding = env2_1;
|
|
value12 = binding(env2_2[26]);
|
|
object2 = {};
|
|
CLOSE_ABNORMAL = env2_21.CLOSE_ABNORMAL;
|
|
object2.closeCode = CLOSE_ABNORMAL;
|
|
prototype = value12.prototype;
|
|
value = Object.create(prototype, {constructor: {value: value12}});
|
|
value13 = new value12(object2, 'Socket closed during throttle');
|
|
value = value13 instanceof Object ? value13 : value;
|
|
throw value;
|
|
}
|
|
return value11 ? value10 : undefined;
|
|
}
|
|
|
|
function _fun64774(a0) { // fn#64774, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4154, offset: 0x01bb50a8, size: 99 bytes, params: 2, frame: 15
|
|
const env0_0 = a0;
|
|
const whenReady = MessageStore.whenReady;
|
|
const binding = env0_0;
|
|
Reflect.apply(whenReady, MessageStore, [binding.id, _fun64775]);
|
|
(importDefault(7067) /* metro dependency 7067: MessageActionCreators */).fetchMessages({channelId: binding.id,
|
|
limit: MAX_MESSAGES_PER_CHANNEL});
|
|
}
|
|
|
|
function _fun64776() { // fn#64776, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4261, offset: 0x01bb510b, size: 276 bytes, params: 1, frame: 16
|
|
var environment;
|
|
var r2;
|
|
var value2;
|
|
var value5;
|
|
var value7;
|
|
let binding = env0_0;
|
|
if (binding.isNSFW()) {
|
|
value2 = environment.__proto__;
|
|
if (UserStore.getCurrentUser()?.nsfwAllowed !== true) {
|
|
r2 = [];
|
|
} else if (require) {
|
|
value5 = environment.__proto__;
|
|
value7 = MessageStore.getMessages(env0_0.id).toArray();
|
|
r2 = value7.map(transformInternalTextMessage);
|
|
} else {
|
|
r2 = [];
|
|
}
|
|
} else if (require) {
|
|
value5 = environment.__proto__;
|
|
value7 = MessageStore.getMessages(env0_0.id).toArray();
|
|
r2 = value7.map(transformInternalTextMessage);
|
|
} else {
|
|
r2 = [];
|
|
}
|
|
const Object = global.Object;
|
|
const values = Object.values;
|
|
const getVoiceStatesForChannel = VoiceStateStore.getVoiceStatesForChannel;
|
|
binding = env0_0;
|
|
const value11 = Reflect.apply(values, Object, [Reflect.apply(getVoiceStatesForChannel, VoiceStateStore,
|
|
[binding.id])]).map(_fun64777);
|
|
const userLimit = binding.userLimit;
|
|
return {id: binding.id, name: binding.name, type: binding.type, topic: binding.topic, bitrate: binding.bitrate,
|
|
user_limit: userLimit, guild_id: env0_2, position: binding.position, messages: r2, voice_states: value11};
|
|
}
|
|
|
|
function formatDevices(a0) { // fn#64788, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6417, owner: getDeprecatedVoiceSettingsWithShortcut.formatDevices, offset: 0x01bb5655, size: 56 bytes, params: 2, frame: 12
|
|
const Object = global.Object;
|
|
let value = Object.values(a0);
|
|
value = value.sort(function({index}, a1) {
|
|
return index - a1.index;
|
|
});
|
|
return value.map(function(a0) {
|
|
return {id: a0.id, name: a0.name};
|
|
});
|
|
}
|
|
|
|
function _fun64777(a0) { // fn#64777, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4471, offset: 0x01bb521f, size: 37 bytes, params: 2, frame: 15
|
|
return transformVoiceState(env1_2, env1_0.id, a0);
|
|
}
|
|
|