Files
2026-07-28 01:06:53 +03:00

232 lines
13 KiB
TypeScript

/* Metro module 6956; source: modules/voice_channel_effects/VoiceChannelEffectsUtils.tsx; dependencies: [1878, 6955, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 22, 1457, 1423, 3797, 3801, 1244, 2] */
import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import UnicodeEmojis from '../emojis/UnicodeEmojis.tsx'; /* Metro dependency 3797 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as ImageLoaderUtilsModule from '../image_upload/ImageLoaderUtils.tsx'; /* Metro dependency 1457 */
import * as VoiceChannelEffectsConstantsModule from './VoiceChannelEffectsConstants.tsx'; /* Metro dependency 6955 */
function _fun55326(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#55326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7134:6, offset: 0x0137bd09, size: 655 bytes, params: 8, frame: 21
let env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = VoiceChannelEffectsConstantsModule;
const env0_4 = value.EMOJI_SIZE;
const VoiceChannelEffectAnimationType = value.VoiceChannelEffectAnimationType;
object = {};
object.BASIC = [importDefault(6957) /* metro dependency 6957 */];
object.PREMIUM = [importDefault(6958) /* metro dependency 6958 */, importDefault(6959) /* metro dependency 6959 */,
importDefault(6960) /* metro dependency 6960 */, importDefault(6961) /* metro dependency 6961 */,
importDefault(6962) /* metro dependency 6962 */, importDefault(6963) /* metro dependency 6963 */,
importDefault(6964) /* metro dependency 6964 */, importDefault(6965) /* metro dependency 6965 */,
importDefault(6966) /* metro dependency 6966 */, importDefault(6967) /* metro dependency 6967 */,
importDefault(6968) /* metro dependency 6968 */, importDefault(6969) /* metro dependency 6969 */,
importDefault(6970) /* metro dependency 6970 */, importDefault(6971) /* metro dependency 6971 */,
importDefault(6972) /* metro dependency 6972 */, importDefault(6973) /* metro dependency 6973 */,
importDefault(6974) /* metro dependency 6974 */, importDefault(6975) /* metro dependency 6975 */,
importDefault(6976) /* metro dependency 6976 */, importDefault(6977) /* metro dependency 6977 */,
importDefault(6978) /* metro dependency 6978 */];
const object2 = {};
const BASIC = VoiceChannelEffectAnimationType.BASIC;
const BASIC2 = object.BASIC;
object2[BASIC] = BASIC2;
const PREMIUM = VoiceChannelEffectAnimationType.PREMIUM;
const PREMIUM2 = object.PREMIUM;
object2[PREMIUM] = PREMIUM2;
value = importDefault(22) /* metro dependency 22 */;
value = value.memoize(function(a0) {
var env0_0 = a0;
var Promise = global.Promise;
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
var value2 = new Promise(_fun55331);
return value2 instanceof Object ? value2 : value;
});
(FileImportTrackerModule).fileFinishedImporting('modules/voice_channel_effects/VoiceChannelEffectsUtils.tsx');
exports.CUSTOM_CALL_SOUND_ANIMATION_RANGE = {'start': 10, 'end': 15};
exports.AnimationTypeToAnimations = object2;
exports.getResizedEmojiData = value;
exports.sampleAnimationId = sampleAnimationId;
exports.getEffectUrl = getEffectUrl;
exports.getEffectAnnouncement = getEffectAnnouncement;
function getUniqueListFromMetadata(a0, a1) { // fn#55327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7134:751, offset: 0x0137bf98, size: 93 bytes, params: 3, frame: 12
const env0_0 = a1;
let value = Module00022;
value = value(a0);
value = value.map(_fun55328);
value = value.filter(function(a0) {
return a0 != null;
});
value = value.uniq();
return value.value();
function _fun55328(a0) { // fn#55328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7134:815, offset: 0x0137bff5, size: 28 bytes, params: 2, frame: 3
const property = a0[require];
const value = null;
return value != property ? property : value;
}
}
function _fun55330(a0) { // fn#55330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7134:443, offset: 0x0137c011, size: 44 bytes, params: 2, frame: 11
const env0_0 = a0;
const Promise = global.Promise;
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(_fun55331);
return promise instanceof Object ? promise : value;
function _fun55331(a0) { // fn#55331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7134:459, offset: 0x0137c03d, size: 81 bytes, params: 2, frame: 10
const env0_0 = a0;
const Image = global.Image;
const image = new Image();
image.src = env0_0;
image.crossOrigin = 'Anonymous';
image.onload = onload_55332;
function onload_55332() { // fn#55332, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7134:522, offset: 0x0137c08e, size: 195 bytes, params: 1, frame: 17
var element;
var binding;
let value = environment.__proto__.__proto__;
const getDevicePixelRatio = (ImageLoaderUtilsModule).getDevicePixelRatio;
value = EMOJI_SIZE * Reflect.apply(getDevicePixelRatio, value, []);
if (env0_1.width !== value) {
element = global.document.createElement('canvas');
element.width = value;
element.height = value;
value = element.getContext('2d');
if (value != null) {
value.drawImage(env0_1, 0, 0);
}
env0_0(element.toDataURL('image/png'));
} else if (env0_1.height === value) {
binding = env0_0;
value = environment.__proto__;
binding(env1_0);
} else {
element = global.document.createElement('canvas');
element.width = value;
element.height = value;
value = element.getContext('2d');
if (value != null) {
value.drawImage(env0_1, 0, 0);
}
env0_0(element.toDataURL('image/png'));
}
}
}
}
function sampleAnimationId(a0, a1) { // fn#55333, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7134:1114, offset: 0x0137c151, size: 149 bytes, params: 3, frame: 14
var Math;
var value;
const property = env0_6[a0];
if (a1 == null) {
Math = global.Math;
return Math.floor(global.Math.random() * property.length);
}
const PREMIUM = VoiceChannelEffectAnimationType.PREMIUM;
if (a0 === PREMIUM) {
value = a1.end + 1;
Math = global.Math;
return Math.floor(global.Math.random() * (a1.start - value) + value);
}
Math = global.Math;
const floor = Math.floor;
const Math2 = global.Math;
return Reflect.apply(floor, Math, [Math2.random() * property.length]);
}
function getEffectUrl(a0) { // fn#55334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7134:1279, offset: 0x0137c1e6, size: 213 bytes, params: 2, frame: 21
var r0;
var getEmojiURL;
var animated;
let value = a1;
if (a0.id != null) {
value = importDefault(1423) /* metro dependency 1423: AvatarUtils */;
getEmojiURL = value.getEmojiURL;
animated = a0.animated;
return Reflect.apply(getEmojiURL, value, [{id: a0.id, animated: animated != null && animated,
size: value !== undefined ? value : EMOJI_SIZE}]);
}
const defaultImport = UnicodeEmojis;
const byName = defaultImport.getByName(defaultImport.convertSurrogateToName(a0.name, false));
if (byName != null) {
value = importDefault(3801) /* metro dependency 3801: EmojiUtils */;
value = value.getURL(byName.surrogates);
r0 = value;
} else {
r0 = '';
}
return r0;
}
function getEffectAnnouncement(a0) { // fn#55335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7134:1553, offset: 0x0137c2bb, size: 587 bytes, params: 2, frame: 24
var r1;
var r0;
var username;
var property;
const intl = (IndexNativeModule).intl;
var formatToPlainString;
const t = (IndexNativeModule).t;
var object;
var user;
var user2;
var yZYxzF;
if (a0.length < 1) {
return '';
}
var value;
const getUniqueListFromMetadataBinding = getUniqueListFromMetadata;
const value2 = undefined;
const uniqueListFromMetadataBinding = getUniqueListFromMetadataBinding(a0, 'userId');
const uniqueListFromMetadataBinding2 = getUniqueListFromMetadataBinding(a0, 'emojiName');
const r6 = uniqueListFromMetadataBinding2.length < 2 ? (uniqueListFromMetadataBinding2 == null ? value2 : uniqueListFromMetadataBinding2[0]) ?? '' : uniqueListFromMetadataBinding2.join(', ');
if (uniqueListFromMetadataBinding.length < 1) {
r0 = '';
} else {
if (uniqueListFromMetadataBinding.length === 1) {
formatToPlainString = intl.formatToPlainString;
yZYxzF = t.yZYxzF;
value = UserStore.getUser(uniqueListFromMetadataBinding[0]);
value = Reflect.apply(formatToPlainString, intl, [yZYxzF,
{firstUsername: value == null ? value2 : value.username,
emojiNames: r6}]);
r1 = value;
} else if (uniqueListFromMetadataBinding.length === 2) {
formatToPlainString = intl.formatToPlainString;
property = t['8rmtbd'];
object = {};
user2 = UserStore.getUser(uniqueListFromMetadataBinding[0]);
username = user2 == null ? value2 : user2.username;
object.firstUsername = username;
value = UserStore.getUser(uniqueListFromMetadataBinding[1]);
username = value == null ? value2 : value.username;
object.secondUsername = username;
object.emojiNames = r6;
value = Reflect.apply(formatToPlainString, intl, [property, object]);
r1 = value;
} else {
formatToPlainString = intl.formatToPlainString;
property = t['/okjv0'];
object = {};
user = UserStore.getUser(uniqueListFromMetadataBinding[0]);
username = user == null ? value2 : user.username;
object.firstUsername = username;
value = UserStore.getUser(uniqueListFromMetadataBinding[1]);
username = value == null ? value2 : value.username;
object.secondUsername = username;
object.count = uniqueListFromMetadataBinding.length - 2;
object.emojiNames = r6;
value = Reflect.apply(formatToPlainString, intl, [property, object]);
r1 = value;
}
r0 = r1;
}
return r0;
}
}
global.__d(_fun55326, 6956, [1878, 6955, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968,
6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 22, 1457, 1423, 3797, 3801, 1244,
2]) /* metro module 6956, dependencies: [1878, 6955, 6957, 6958, 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6968, 6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978, 22, 1457, 1423, 3797, 3801, 1244, 2] */;