/* Metro module 1423; source: utils/AvatarUtils.tsx; dependencies: [661, 1424, 1426, 477, 1457, 1468, 1853, 1856, 24, 1857, 1859, 1860, 21, 1473, 2] */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as PlatformUtilsModule from './PlatformUtils.tsx'; /* Metro dependency 477 */ import * as AvatarDecorationConstantsModule from '../modules/collectibles/avatar_decorations/AvatarDecorationConstants.tsx'; /* Metro dependency 1424 */ import * as ImageLoaderUtilsModule from '../modules/image_upload/ImageLoaderUtils.tsx'; /* Metro dependency 1457 */ import * as NumberUtilsModule from './NumberUtils.tsx'; /* Metro dependency 1856 */ function _fun16603(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#16603, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:6, offset: 0x00e54bbf, size: 1034 bytes, params: 8, frame: 50 const env0_0 = require; const getEmojiURL2 = getEmojiURL; const getDefaultAvatarURL2 = getDefaultAvatarURL; const getUserAvatarURL2 = getUserAvatarURL; const getGuildMemberAvatarURLSimple2 = getGuildMemberAvatarURLSimple; const getGuildMemberAvatarURL2 = getGuildMemberAvatarURL; const getGuildMemberAvatarSource2 = getGuildMemberAvatarSource; const getUserBannerURL2 = getUserBannerURL; const getAvatarDecorationURL2 = getAvatarDecorationURL; const getGuildMemberBannerURL2 = getGuildMemberBannerURL; const getGuildSplashURL2 = getGuildSplashURL; const getGuildBannerURL2 = getGuildBannerURL; const getGuildHomeHeaderURL2 = getGuildHomeHeaderURL; const getResourceChannelIconURL2 = getResourceChannelIconURL; const getNewMemberActionIconURL2 = getNewMemberActionIconURL; const getGuildDiscoverySplashURL2 = getGuildDiscoverySplashURL; const getGuildIconURL_166212 = getGuildIconURL_16621; const getGuildTemplateIconURL2 = getGuildTemplateIconURL; const getApplicationIconURL2 = getApplicationIconURL; const getGameAssetURL2 = getGameAssetURL; const getVideoFilterAssetURL2 = getVideoFilterAssetURL; const getChannelIconURL2 = getChannelIconURL; const hasAnimatedGuildIcon2 = hasAnimatedGuildIcon; const closure23 = function(a0) { return a0 != null && a0.startsWith('a_'); }; const closure24 = function(a0) { return a0 != null && a0.startsWith('v_'); }; const closure25 = function(a0) { var value = a0; return typeof value === 'number' ? value : {uri: value ?? undefined}; }; const isDataUri2 = isDataUri; const getAnimatedFormat = function(a0) { return a0 ? 'webp' : 'gif'; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = 0; const value2 = require(dependencyMap[value]); const env0_3 = value2.Endpoints; const env0_4 = value2.AVATAR_SIZE; const regexp = RegExp('^data:', ''); const DEFAULT_AVATARS = (require(1426) /* metro dependency 1426: AvatarUtils */).default.DEFAULT_AVATARS; const DEFAULT_AVATARS_SMALL = (require(1426) /* metro dependency 1426: AvatarUtils */).default.DEFAULT_AVATARS_SMALL; const r25 = DEFAULT_AVATARS_SMALL ?? DEFAULT_AVATARS; const DEFAULT_AVATARS_SMALL_MAX_SIZE = (require(1426) /* metro dependency 1426: AvatarUtils */).default.DEFAULT_AVATARS_SMALL_MAX_SIZE; const r24 = DEFAULT_AVATARS_SMALL_MAX_SIZE ?? value; const DEFAULT_PROVISIONAL_AVATARS = (require(1426) /* metro dependency 1426: AvatarUtils */).default.DEFAULT_PROVISIONAL_AVATARS; const DEFAULT_GROUP_DM_AVATARS = (require(1426) /* metro dependency 1426: AvatarUtils */).default.DEFAULT_GROUP_DM_AVATARS; value = (require(1426) /* metro dependency 1426: AvatarUtils */).default.canUseWebp(); const env0_12 = (PlatformUtilsModule).isAndroid(); object = {getUserAvatarURL: getUserAvatarURL2, getDefaultAvatarURL: getDefaultAvatarURL2, getGuildMemberAvatarURL: getGuildMemberAvatarURL2, getGuildMemberAvatarURLSimple: getGuildMemberAvatarURLSimple2, getGuildMemberAvatarSource: getGuildMemberAvatarSource2, getGuildMemberBannerURL: getGuildMemberBannerURL2, getUserBannerURL: getUserBannerURL2, getAvatarDecorationURL: getAvatarDecorationURL2, hasAnimatedGuildIcon: hasAnimatedGuildIcon2, isAnimatedIconHash: closure23, getUserAvatarSource: function(a0, a1, a2) { return makeSource(getUserAvatarURL(a0, a1, a2)); }, getGuildIconURL: getGuildIconURL_166212, getGuildSplashURL: getGuildSplashURL2, getGuildSplashSource: function(a0) { return makeSource(getGuildSplashURL(a0)); }, getGuildDiscoverySplashURL: getGuildDiscoverySplashURL2, getGuildDiscoverySplashSource: function(a0) { return makeSource(getGuildDiscoverySplashURL(a0)); }, getGuildBannerURL: getGuildBannerURL2, getGuildHomeHeaderURL: getGuildHomeHeaderURL2, getResourceChannelIconURL: getResourceChannelIconURL2, getNewMemberActionIconURL: getNewMemberActionIconURL2, getGuildTemplateIconURL: getGuildTemplateIconURL2, getChannelIconURL: getChannelIconURL2, getEmojiURL: getEmojiURL2, getApplicationIconURL: getApplicationIconURL2, getGameAssetURL: getGameAssetURL2, getVideoFilterAssetURL: getVideoFilterAssetURL2, getGameAssetSource: function(a0) { return makeSource(getGameAssetURL(a0)); }, getGuildIconSource: function(a0) { return makeSource(getGuildIconURL_16621(a0)); }, getGuildTemplateIconSource: function(a0) { return makeSource(getGuildTemplateIconURL(a0)); }, getGuildBannerSource: getGuildBannerSource, getGuildHomeHeaderSource: function(a0) { return makeSource(getGuildHomeHeaderURL(a0)); }, getChannelIconSource: function(a0) { return makeSource(getChannelIconURL(a0)); }, getApplicationIconSource: function(a0) { return makeSource(getApplicationIconURL(a0)); }, makeSource: closure25, getAnimatableSourceWithFallback: getAnimatableSourceWithFallback}; (FileImportTrackerModule).fileFinishedImporting('utils/AvatarUtils.tsx'); exports.default = object; exports.DATA_IMAGE_PREFIX = regexp; exports.DEFAULT_AVATARS = DEFAULT_AVATARS; exports.DEFAULT_AVATARS_SMALL = r25; exports.DEFAULT_AVATARS_SMALL_MAX_SIZE = r24; exports.DEFAULT_PROVISIONAL_AVATARS = DEFAULT_PROVISIONAL_AVATARS; exports.DEFAULT_GROUP_DM_AVATARS = DEFAULT_GROUP_DM_AVATARS; exports.SUPPORTS_WEBP = value; exports.LEGACY_DEFAULT_AVATAR_COUNT = 5; exports.DEFAULT_AVATAR_COUNT = 6; exports.getEmojiURL = getEmojiURL2; exports.getDefaultAvatarURL = getDefaultAvatarURL2; exports.getUserAvatarURL = getUserAvatarURL2; exports.getGuildMemberAvatarURLSimple = getGuildMemberAvatarURLSimple2; exports.getGuildMemberAvatarURL = getGuildMemberAvatarURL2; exports.getGuildMemberAvatarSource = getGuildMemberAvatarSource2; exports.getUserBannerURL = getUserBannerURL2; exports.getAvatarDecorationURL = getAvatarDecorationURL2; exports.getGuildMemberBannerURL = getGuildMemberBannerURL2; exports.getResourceChannelIconURL = getResourceChannelIconURL2; exports.getNewMemberActionIconURL = getNewMemberActionIconURL2; exports.getGuildTemplateIconURL = getGuildTemplateIconURL2; exports.getVideoFilterAssetURL = getVideoFilterAssetURL2; exports.hasAnimatedGuildIcon = hasAnimatedGuildIcon2; exports.isAnimatedIconHash = closure23; exports.isVideoAssetHash = closure24; exports.isAnimatedImageURL = isAnimatedImageURL; exports.isVideoURL = isVideoURL; exports.makeSource = closure25; exports.isDataUri = isDataUri2; function getAvatarURL({endpoint, path, id, hash, size, lossless, canAnimate, keepAspectRatio, format, canWebP}) { // fn#16604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:483, offset: 0x00e54fc9, size: 547 bytes, params: 2, frame: 34 var r12; var r4; var r0; var r7; var r2; var value; var CDN_HOST; var object; var getBestMediaProxySize; var moduleValue; lossless = !(lossless === undefined) && lossless; canAnimate = !(canAnimate === undefined) && canAnimate; format = format === undefined ? null : format; const r11 = canWebP !== undefined ? canWebP : env0_11; if (id != null) { if (hash != null) { r12 = format ?? (canAnimate && isAnimatedIconHash(hash) ? getAnimatedFormat(r11) : 'jpg'); r12 = canAnimate && isVideoAssetHash(hash) ? 'mp4' : r12; CDN_HOST = global.window.GLOBAL_ENV.CDN_HOST; if (CDN_HOST != null) { r4 = r12 !== 'jpg' ? r12 : r11 ? 'webp' : 'png'; r0 = 'https://' + CDN_HOST + '/' + path + '/' + id + '/' + hash + '.' + r4; r7 = r4; } else { value = global.location.protocol + global.window.GLOBAL_ENV.API_ENDPOINT; value += endpoint(id, hash, r12); r0 = value; r7 = r12; } if (r7 === 'mp4') { return r0; } object = {}; if (size != null) { value = require(1457) /* metro dependency 1457: ImageLoaderUtils */; getBestMediaProxySize = value.getBestMediaProxySize; moduleValue = require(1457) /* metro dependency 1457: ImageLoaderUtils */; object.size = Reflect.apply(getBestMediaProxySize, value, [size * moduleValue.getDevicePixelRatio()]); } if (keepAspectRatio != null) { object.keep_aspect_ratio = keepAspectRatio; } if (lossless) { object.quality = 'lossless'; } value = r7 === 'webp'; r2 = value && canAnimate; r2 = r2 && isAnimatedIconHash(hash); if (r2) { object.animated = true; } value = importDefault(1468) /* metro dependency 1468 */; value = value.stringify(object); return r0 + ('?' + value); } } } function getEmojiURL({id, animated, size, forcePNG}) { // fn#16605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:1176, offset: 0x00e551ec, size: 492 bytes, params: 2, frame: 34 var enabled; var property; var moduleValue3; var getForceSdrEmojisStickersConfig; var forceSdrEmojisStickersConfig; var error; forcePNG = !(forcePNG === undefined) && forcePNG; let value = 'png'; const r0 = forcePNG ? value : animated ? env0_11 ? 'webp' : 'gif' : env0_11 ? 'webp' : value; const value3 = ''; const r02 = env0_11 && animated ? '&animated=true' : value3; const moduleValue = require(dependencyMap[4]); const getBestMediaProxySize = moduleValue.getBestMediaProxySize; const moduleValue2 = require(dependencyMap[4]); const getDevicePixelRatio = moduleValue2.getDevicePixelRatio; const value7 = 'size=' + Reflect.apply(getBestMediaProxySize, moduleValue, [size * Reflect.apply(getDevicePixelRatio, moduleValue2, []), env0_12]); try { property = dependencyMap[6]; moduleValue3 = require(property); getForceSdrEmojisStickersConfig = moduleValue3.getForceSdrEmojisStickersConfig; forceSdrEmojisStickersConfig = getForceSdrEmojisStickersConfig({location: 'getEmojiURL'}); enabled = forceSdrEmojisStickersConfig.enabled; } catch (error) { enabled = false; } const r9 = enabled ? '&force_sdr=true' : value3; let GLOBAL_ENV = global.window.GLOBAL_ENV; const CDN_HOST = GLOBAL_ENV.CDN_HOST; if (CDN_HOST != null) { return value3 + global.location.protocol + '//' + global.window.GLOBAL_ENV.CDN_HOST + '/emojis/' + id + '.' + r0 + '?' + value7 + r02 + r9; } const protocol = global.location.protocol; GLOBAL_ENV = global.window.GLOBAL_ENV; const API_ENDPOINT = GLOBAL_ENV.API_ENDPOINT; const value11 = protocol + API_ENDPOINT; const EMOJI = Endpoints.EMOJI; value = value11 + Reflect.apply(EMOJI, Endpoints, [id, r0]); return enabled ? value3 + value + '?force_sdr=true' : value; } function getDefaultAvatarURL(a0, a1) { // fn#16606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:1742, offset: 0x00e553d8, size: 221 bytes, params: 3, frame: 18 let value = a2; let r0 = value !== undefined ? value : false; const r1 = r0 ? DEFAULT_PROVISIONAL_AVATARS : r0 || a3 == null ? DEFAULT_AVATARS : a3 <= env0_9 ? env0_8 : DEFAULT_AVATARS; if (a0 == null) { if (a1 == null) { return r1[0]; } } const integer = (NumberUtilsModule).parseInteger(a1, 0); if (integer > 0) { r0 = r1[integer % 5]; } else if (a0 != null) { value = (importDefault(24) /* metro dependency 24 */)(a0); value = value.shiftRight(22); value = value.mod(r1.length); r0 = r1[value.toJSNumber()]; } else { r0 = r1[0]; } return r0; } function getUserAvatarURLWithoutFallback({id, avatar, discriminator, bot}) { // fn#16607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:1966, offset: 0x00e554b5, size: 214 bytes, params: 2, frame: 20 var property; const value = a1; const value2 = a2; const value3 = a3; const value4 = a4; const r7 = value !== undefined ? value : false; const r8 = value2 !== undefined ? value2 : AVATAR_SIZE; const r6 = value3 !== undefined ? value3 : null; const r5 = value4 !== undefined ? value4 : env0_11; if (bot) { property = (require(1426) /* metro dependency 1426: AvatarUtils */).default.BOT_AVATARS[avatar]; if (property) { return property; } if (avatar != null) { return getAvatarURL({endpoint: Endpoints.AVATAR, path: 'avatars', id: id, hash: avatar, size: r8, canAnimate: r7, format: r6, canWebP: r5}); } if (discriminator === '0000') { return DEFAULT_AVATARS[0]; } return getAvatarURL({endpoint: Endpoints.AVATAR, path: 'avatars', id: id, hash: avatar, size: r8, canAnimate: r7, format: r6, canWebP: r5}); } const getAvatarURLBinding = getAvatarURL; const AVATAR = Endpoints.AVATAR; return getAvatarURLBinding({endpoint: AVATAR, path: 'avatars', id: id, hash: avatar, size: r8, canAnimate: r7, format: r6, canWebP: r5}); } function getUserAvatarURL(a0) { // fn#16608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:2265, offset: 0x00e5558b, size: 117 bytes, params: 2, frame: 20 const value = a1; const value2 = a2; const value3 = a3; const value4 = a4; const r7 = value !== undefined ? value : false; const r6 = value2 !== undefined ? value2 : AVATAR_SIZE; return getUserAvatarURLWithoutFallback(a0, r7, r6, value3 !== undefined ? value3 : null, value4 !== undefined ? value4 : env0_11) ?? getDefaultAvatarURL(a0.id, a0.discriminator, a0.isProvisional, r6); } function getGuildMemberAvatarURLSimple({guildId, userId, avatar, canAnimate, size, canWebP}) { // fn#16609, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:2442, offset: 0x00e55600, size: 448 bytes, params: 2, frame: 25 var r2; var r1; var r8; var value; canAnimate = !(canAnimate === undefined) && canAnimate; const r11 = size !== undefined ? size : AVATAR_SIZE; const r4 = canWebP !== undefined ? canWebP : env0_11; const r3 = canAnimate && isAnimatedIconHash(avatar) ? getAnimatedFormat(r4) : 'jpg'; const GLOBAL_ENV = global.window.GLOBAL_ENV; const CDN_HOST = GLOBAL_ENV.CDN_HOST; if (CDN_HOST != null) { r2 = value !== r3 ? r3 : r4 ? 'webp' : 'png'; value = Endpoints.GUILD_MEMBER_AVATAR(guildId, userId, avatar, r2); value = 'https://' + CDN_HOST + value; r1 = value; r8 = r2; } else { value = global.location.protocol + global.window.GLOBAL_ENV.API_ENDPOINT; value += Endpoints.GUILD_MEMBER_AVATAR(guildId, userId, avatar, r3); r1 = value; r8 = r3; } const object = {}; const getBestMediaProxySize = ImageLoaderUtilsModule.getBestMediaProxySize; const getDevicePixelRatio = ImageLoaderUtilsModule.getDevicePixelRatio; object.size = Reflect.apply(getBestMediaProxySize, ImageLoaderUtilsModule, [r11 * Reflect.apply(getDevicePixelRatio, ImageLoaderUtilsModule, [])]); if (r8 === 'webp' && canAnimate && isAnimatedIconHash(avatar)) { object.animated = true; } value = importDefault(1468) /* metro dependency 1468 */; value = value.stringify(object); return r1 + ('?' + value); } function getGuildMemberAvatarURL({userId, avatar, guildId}) { // fn#16610, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:2976, offset: 0x00e557c0, size: 73 bytes, params: 2, frame: 16 let value = a1; const r4 = value !== undefined ? value : false; value = null; return value == avatar ? value : getGuildMemberAvatarURLSimple({userId: userId, avatar: avatar, guildId: guildId, canAnimate: r4}); } function getGuildMemberAvatarSource(a0, a1) { // fn#16611, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:3139, offset: 0x00e55809, size: 66 bytes, params: 3, frame: 16 const value = a2; const r5 = value !== undefined ? value : false; const guildMemberAvatarURL = getGuildMemberAvatarURL(a0, r5); return guildMemberAvatarURL != null ? makeSource(guildMemberAvatarURL) : a1.getAvatarSource(a0.guildId, r5); } function getUserBannerURL({id, banner, canAnimate, size}) { // fn#16612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:3280, offset: 0x00e5584b, size: 372 bytes, params: 2, frame: 28 var r8; var r1; var r3; var CDN_HOST; var value; var object; var moduleValue; var getBestMediaProxySize; var moduleValue2; if (banner != null) { CDN_HOST = global.window.GLOBAL_ENV.CDN_HOST; value = 'png'; r8 = canAnimate && isAnimatedIconHash(banner) ? getAnimatedFormat(env0_11) : value; if (CDN_HOST != null) { r1 = 'https://' + CDN_HOST + '/banners/' + id + '/' + banner + '.' + r8; } else { value = global.location.protocol + global.window.GLOBAL_ENV.API_ENDPOINT; value += Endpoints.USER_BANNER(id, banner, r8); r1 = value; } object = {}; moduleValue = require(1457) /* metro dependency 1457: ImageLoaderUtils */; getBestMediaProxySize = moduleValue.getBestMediaProxySize; moduleValue2 = require(1457) /* metro dependency 1457: ImageLoaderUtils */; object.size = Reflect.apply(getBestMediaProxySize, moduleValue, [size * moduleValue2.getDevicePixelRatio()]); r3 = r8 === 'webp' && canAnimate; r3 = r3 && isAnimatedIconHash(banner); if (r3) { object.animated = true; } value = importDefault(1468) /* metro dependency 1468 */; value = value.stringify(object); return r1 + ('?' + value); } } function getAvatarDecorationURL({avatarDecoration, size, canAnimate}) { // fn#16613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:3729, offset: 0x00e559bf, size: 550 bytes, params: 2, frame: 26 var r12; var property; var moduleValue2; var CollectiblesItemAssetFormat; var getCollectiblesItemAssetUrl; var STATIC; var ANIMATED; var object; var skuId; var collectiblesItemAssetUrl; var value3; var URL; var value5; var uRL; var value8; var error; const r5 = size !== undefined ? size : AVATAR_DECORATION_SIZE; canAnimate = !(canAnimate === undefined) && canAnimate; if (avatarDecoration == null) { return null; } const moduleValue = require(dependencyMap[9]); if (moduleValue.isAvatarDecorationExpired(avatarDecoration)) { return null; } try { } catch (error) { return null; } try { } catch (error) { return null; } try { property = dependencyMap[10]; } catch (error) { return null; } try { moduleValue2 = require(property); } catch (error) { return null; } try { CollectiblesItemAssetFormat = moduleValue2.CollectiblesItemAssetFormat; } catch (error) { return null; } try { getCollectiblesItemAssetUrl = moduleValue2.getCollectiblesItemAssetUrl; } catch (error) { return null; } if (canAnimate) { try { ANIMATED = CollectiblesItemAssetFormat.ANIMATED; } catch (error) { return null; } r12 = ANIMATED; } else { try { STATIC = CollectiblesItemAssetFormat.STATIC; } catch (error) { return null; } r12 = STATIC; } try { object = {}; } catch (error) { return null; } try { skuId = avatarDecoration.skuId; } catch (error) { return null; } try { object.skuId = skuId; } catch (error) { return null; } try { object.assetFormat = r12; } catch (error) { return null; } try { collectiblesItemAssetUrl = getCollectiblesItemAssetUrl(object); } catch (error) { return null; } try { value3 = collectiblesItemAssetUrl != null; } catch (error) { return null; } if (value3) { return collectiblesItemAssetUrl; } const asset = avatarDecoration.asset; if (asset == null) { return null; } const {CDN_HOST, API_ENDPOINT} = global.window.GLOBAL_ENV; const value4 = Endpoints.AVATAR_DECORATION_PRESETS(asset); if (CDN_HOST != null) { URL = global.URL; value8 = 'https://' + CDN_HOST + value4; uRL = new URL(); } else { URL = global.URL; value5 = '' + global.location.protocol + API_ENDPOINT + value4; uRL = new URL(); } let searchParams = undefined.searchParams; const set = searchParams.set; const moduleValue3 = require(dependencyMap[4]); const getBestMediaProxySize = moduleValue3.getBestMediaProxySize; const moduleValue4 = require(dependencyMap[4]); const getDevicePixelRatio = moduleValue4.getDevicePixelRatio; let value = Reflect.apply(getBestMediaProxySize, moduleValue3, [r5 * Reflect.apply(getDevicePixelRatio, moduleValue4, []), env0_12]); value = '' + value; Reflect.apply(set, searchParams, ['size', value]); searchParams = undefined.searchParams; searchParams.set('passthrough', '' + canAnimate); return undefined.toString(); } function getGuildMemberBannerURL({id, guildId, banner, canAnimate, size}) { // fn#16614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:4412, offset: 0x00e55be5, size: 369 bytes, params: 2, frame: 25 var r3; var r1; var CDN_HOST; var value; var value3; var object; var moduleValue; var getBestMediaProxySize; var moduleValue2; if (banner != null) { if (guildId != null) { CDN_HOST = global.window.GLOBAL_ENV.CDN_HOST; value = 'png'; r3 = canAnimate && isAnimatedIconHash(banner) ? getAnimatedFormat(env0_11) : value; value3 = Endpoints.GUILD_MEMBER_BANNER(guildId, id, banner, r3); r1 = CDN_HOST != null ? 'https://' + CDN_HOST + value3 : global.location.protocol + global.window.GLOBAL_ENV.API_ENDPOINT + value3; object = {}; moduleValue = require(1457) /* metro dependency 1457: ImageLoaderUtils */; getBestMediaProxySize = moduleValue.getBestMediaProxySize; moduleValue2 = require(1457) /* metro dependency 1457: ImageLoaderUtils */; object.size = Reflect.apply(getBestMediaProxySize, moduleValue, [size * moduleValue2.getDevicePixelRatio()]); r3 = r3 === 'webp' && canAnimate; r3 = r3 && isAnimatedIconHash(banner); if (r3) { object.animated = true; } value = importDefault(1468) /* metro dependency 1468 */; value = value.stringify(object); return r1 + ('?' + value); } } } function getGuildSplashURL({id, splash, size}) { // fn#16615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:4882, offset: 0x00e55d56, size: 282 bytes, params: 2, frame: 25 var r4; var width; var value; if (splash == null) { return null; } if (size != null) { r4 = size; } else { width = global.window.screen.width; value = require(1457) /* metro dependency 1457: ImageLoaderUtils */; value = width * value.getDevicePixelRatio(); r4 = value; } const bestMediaProxySize = (require(1457) /* metro dependency 1457: ImageLoaderUtils */).getBestMediaProxySize(r4); const GLOBAL_ENV = global.window.GLOBAL_ENV; const CDN_HOST = GLOBAL_ENV.CDN_HOST; return (CDN_HOST != null ? 'https://' + CDN_HOST + '/splashes/' + id + '/' + splash + '.jpg' : global.location.protocol + global.window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_SPLASH(id, splash)) + ('?size=' + bestMediaProxySize); } function getGuildBannerURL({id, banner}) { // fn#16616, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:5229, offset: 0x00e55e70, size: 401 bytes, params: 2, frame: 31 let value = a1; const r7 = value !== undefined ? value : false; if (banner == null) { return null; } const bestMediaProxySize = (ImageLoaderUtilsModule).getBestMediaProxySize(360 * (ImageLoaderUtilsModule).getDevicePixelRatio()); const value4 = 'jpg'; let r2 = env0_11 ? 'webp' : value4; const r9 = r7 && isAnimatedIconHash(banner) ? getAnimatedFormat(env0_11) : r2; const GLOBAL_ENV = global.window.GLOBAL_ENV; const CDN_HOST = GLOBAL_ENV.CDN_HOST; r2 = CDN_HOST != null ? 'https://' + CDN_HOST + '/banners/' + id + '/' + banner + '.' + r9 : global.location.protocol + global.window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_BANNER(id, banner, r9); const object = {size: bestMediaProxySize}; if (value4 === r9) { object.quality = 'lossless'; } if (r9 === 'webp' && r7 && isAnimatedIconHash(banner)) { object.animated = true; } value = importDefault(1468) /* metro dependency 1468 */; value = value.stringify(object); return r2 + ('?' + value); } function getGuildHomeHeaderURL({id, homeHeader}) { // fn#16617, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:5728, offset: 0x00e56001, size: 244 bytes, params: 2, frame: 25 if (homeHeader == null) { return null; } const bestMediaProxySize = (ImageLoaderUtilsModule).getBestMediaProxySize(1096 * (ImageLoaderUtilsModule).getDevicePixelRatio()); const GLOBAL_ENV = global.window.GLOBAL_ENV; const CDN_HOST = GLOBAL_ENV.CDN_HOST; return (CDN_HOST != null ? 'https://' + CDN_HOST + '/home-headers/' + id + '/' + homeHeader + '.png' : global.location.protocol + global.window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_HOME_HEADER(id, homeHeader)) + ('?size=' + bestMediaProxySize); } function getResourceChannelIconURL({channelId, icon}) { // fn#16618, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:6055, offset: 0x00e560f5, size: 96 bytes, params: 2, frame: 15 const value = null; return value == icon ? value : getAvatarURL({endpoint: Endpoints.GUILD_RESOURCE_CHANNELS_ICON, path: 'resource-channels', id: channelId, hash: icon, size: AVATAR_SIZE, canAnimate: true, canWebP: false}); } function getNewMemberActionIconURL({channelId, icon}) { // fn#16619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:6257, offset: 0x00e56155, size: 96 bytes, params: 2, frame: 15 const value = null; return value == icon ? value : getAvatarURL({endpoint: Endpoints.GUILD_NEW_MEMBER_ACTIONS_ICON, path: 'new-member-actions', id: channelId, hash: icon, size: AVATAR_SIZE, canAnimate: true, canWebP: false}); } function getGuildDiscoverySplashURL({id, splash, size}) { // fn#16620, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:6461, offset: 0x00e561b5, size: 282 bytes, params: 2, frame: 25 var r4; var width; var value; if (splash == null) { return null; } if (size != null) { r4 = size; } else { width = global.window.screen.width; value = require(1457) /* metro dependency 1457: ImageLoaderUtils */; value = width * value.getDevicePixelRatio(); r4 = value; } const bestMediaProxySize = (require(1457) /* metro dependency 1457: ImageLoaderUtils */).getBestMediaProxySize(r4); const GLOBAL_ENV = global.window.GLOBAL_ENV; const CDN_HOST = GLOBAL_ENV.CDN_HOST; return (CDN_HOST != null ? 'https://' + CDN_HOST + '/discovery-splashes/' + id + '/' + splash + '.jpg' : global.location.protocol + global.window.GLOBAL_ENV.API_ENDPOINT + Endpoints.GUILD_DISCOVERY_SPLASH(id, splash)) + ('?size=' + bestMediaProxySize); } function getGuildIconURL_16621({id, icon, size, canAnimate, lossless}) { // fn#16621, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:6837, offset: 0x00e562cf, size: 115 bytes, params: 2, frame: 18 canAnimate = !(canAnimate === undefined) && canAnimate; lossless = !(lossless === undefined) && lossless; const getAvatarURLBinding = getAvatarURL; const GUILD_ICON = Endpoints.GUILD_ICON; return getAvatarURLBinding({endpoint: GUILD_ICON, path: 'icons', id: id, hash: icon, size: size, canAnimate: canAnimate, lossless: lossless, canWebP: env0_11}); } function getGuildTemplateIconURL({id, icon, size, canAnimate}) { // fn#16622, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:7025, offset: 0x00e56342, size: 109 bytes, params: 2, frame: 16 const r4 = size !== undefined ? size : AVATAR_SIZE; canAnimate = !(canAnimate === undefined) && canAnimate; const getAvatarURLBinding = getAvatarURL; const GUILD_TEMPLATE_ICON = Endpoints.GUILD_TEMPLATE_ICON; return getAvatarURLBinding({endpoint: GUILD_TEMPLATE_ICON, path: 'guild-templates', id: id, hash: icon, size: r4, canAnimate: canAnimate, canWebP: false}); } function getApplicationIconURL({id, icon, size, bot, botIconFirst, fallbackAvatar, keepAspectRatio, guildMember}) { // fn#16623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:7218, offset: 0x00e563af, size: 342 bytes, params: 2, frame: 23 var userAvatarURLWithoutFallback; var userAvatarURLWithoutFallback2; const value = undefined; const r7 = size !== value ? size : AVATAR_SIZE; fallbackAvatar = fallbackAvatar === value || fallbackAvatar; let id = bot == null ? value : bot.id; if (id != null) { if (guildMember == null) { if (bot == null) { if (icon != null) { return isDataUri(icon) ? icon : getAvatarURL({endpoint: Endpoints.APPLICATION_ICON, path: 'app-icons', id: id, hash: icon, size: r7, canAnimate: false, canWebP: false, keepAspectRatio: keepAspectRatio}); } if (bot == null) { return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } userAvatarURLWithoutFallback2 = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback2 != null) { return userAvatarURLWithoutFallback2; } return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } if (botIconFirst) { userAvatarURLWithoutFallback = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback != null) { return userAvatarURLWithoutFallback; } if (icon != null) { return isDataUri(icon) ? icon : getAvatarURL({endpoint: Endpoints.APPLICATION_ICON, path: 'app-icons', id: id, hash: icon, size: r7, canAnimate: false, canWebP: false, keepAspectRatio: keepAspectRatio}); } if (bot == null) { return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } userAvatarURLWithoutFallback2 = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback2 != null) { return userAvatarURLWithoutFallback2; } return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } if (icon != null) { return isDataUri(icon) ? icon : getAvatarURL({endpoint: Endpoints.APPLICATION_ICON, path: 'app-icons', id: id, hash: icon, size: r7, canAnimate: false, canWebP: false, keepAspectRatio: keepAspectRatio}); } if (bot == null) { return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } userAvatarURLWithoutFallback2 = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback2 != null) { return userAvatarURLWithoutFallback2; } return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } if (guildMember.avatar == null) { if (bot == null) { if (icon != null) { return isDataUri(icon) ? icon : getAvatarURL({endpoint: Endpoints.APPLICATION_ICON, path: 'app-icons', id: id, hash: icon, size: r7, canAnimate: false, canWebP: false, keepAspectRatio: keepAspectRatio}); } if (bot == null) { return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } userAvatarURLWithoutFallback2 = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback2 != null) { return userAvatarURLWithoutFallback2; } return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } if (botIconFirst) { userAvatarURLWithoutFallback = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback != null) { return userAvatarURLWithoutFallback; } if (icon != null) { return isDataUri(icon) ? icon : getAvatarURL({endpoint: Endpoints.APPLICATION_ICON, path: 'app-icons', id: id, hash: icon, size: r7, canAnimate: false, canWebP: false, keepAspectRatio: keepAspectRatio}); } if (bot == null) { return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } userAvatarURLWithoutFallback2 = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback2 != null) { return userAvatarURLWithoutFallback2; } return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } if (icon != null) { return isDataUri(icon) ? icon : getAvatarURL({endpoint: Endpoints.APPLICATION_ICON, path: 'app-icons', id: id, hash: icon, size: r7, canAnimate: false, canWebP: false, keepAspectRatio: keepAspectRatio}); } if (bot == null) { return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } userAvatarURLWithoutFallback2 = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback2 != null) { return userAvatarURLWithoutFallback2; } return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } var getGuildMemberAvatarURLSimpleBinding = getGuildMemberAvatarURLSimple; id = bot.id; var guildMemberAvatarURLSimpleBinding = getGuildMemberAvatarURLSimpleBinding({userId: id, guildId: guildMember.guildId, avatar: guildMember.avatar, canAnimate: false, size: r7}); if (guildMemberAvatarURLSimpleBinding != null) { return guildMemberAvatarURLSimpleBinding; } } if (bot != null) { if (botIconFirst) { userAvatarURLWithoutFallback = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback != null) { return userAvatarURLWithoutFallback; } if (icon != null) { return isDataUri(icon) ? icon : getAvatarURL({endpoint: Endpoints.APPLICATION_ICON, path: 'app-icons', id: id, hash: icon, size: r7, canAnimate: false, canWebP: false, keepAspectRatio: keepAspectRatio}); } if (bot == null) { return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } userAvatarURLWithoutFallback2 = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback2 != null) { return userAvatarURLWithoutFallback2; } return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } } if (icon != null) { return isDataUri(icon) ? icon : getAvatarURL({endpoint: Endpoints.APPLICATION_ICON, path: 'app-icons', id: id, hash: icon, size: r7, canAnimate: false, canWebP: false, keepAspectRatio: keepAspectRatio}); } if (bot != null) { userAvatarURLWithoutFallback2 = getUserAvatarURLWithoutFallback(bot, false, r7); if (userAvatarURLWithoutFallback2 != null) { return userAvatarURLWithoutFallback2; } } return fallbackAvatar ? importDefault(1860) /* metro dependency 1860 */ : value; } function getGameAssetURL({id, hash, size, keepAspectRatio, format}) { // fn#16624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:7869, offset: 0x00e56505, size: 123 bytes, params: 2, frame: 17 const r3 = size !== undefined ? size : AVATAR_SIZE; keepAspectRatio = !(keepAspectRatio === undefined) && keepAspectRatio; const getAvatarURLBinding = getAvatarURL; const APPLICATION_ICON = Endpoints.APPLICATION_ICON; return getAvatarURLBinding({endpoint: APPLICATION_ICON, path: 'app-icons', id: id, hash: hash, size: r3, canAnimate: false, keepAspectRatio: keepAspectRatio, format: format, canWebP: false}); } function getVideoFilterAssetURL({userId, assetId, assetHash, size, canAnimate}) { // fn#16625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:8087, offset: 0x00e56580, size: 132 bytes, params: 2, frame: 18 canAnimate = canAnimate === undefined || canAnimate; return getAvatarURL({endpoint: function(a0, a1, a2) { return Endpoints.VIDEO_FILTER_ASSET_STORAGE(userId, assetId, assetHash, a2); }, path: 'video-filter-assets/' + userId, id: assetId, hash: assetHash, size: size, canAnimate: canAnimate, canWebP: false}); } function getChannelIconURL({id, icon, applicationId, size}) { // fn#16627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:8330, offset: 0x00e5662c, size: 263 bytes, params: 2, frame: 21 var r0; var value; var avatarURL; var DEFAULT_GROUP_DM_AVATARS; if (applicationId != null) { r0 = getApplicationIconURL({id: applicationId, icon: icon, size: size}) ?? (require(1426) /* metro dependency 1426: AvatarUtils */).default.DEFAULT_CHANNEL_ICON; } else { avatarURL = getAvatarURL({endpoint: Endpoints.CHANNEL_ICON, path: 'channel-icons', id: id, hash: icon, canAnimate: false, size: size, canWebP: false}); if (avatarURL != null) { r0 = avatarURL; } else { DEFAULT_GROUP_DM_AVATARS = (require(1426) /* metro dependency 1426: AvatarUtils */).default.DEFAULT_GROUP_DM_AVATARS; value = importDefault(21) /* metro dependency 21: SnowflakeUtils */; value = value.extractTimestamp(id); r0 = DEFAULT_GROUP_DM_AVATARS[value % (require(1426) /* metro dependency 1426: AvatarUtils */).default.DEFAULT_GROUP_DM_AVATARS.length]; } } return r0; } function hasAnimatedGuildIcon(a0) { // fn#16628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:8792, offset: 0x00e56733, size: 35 bytes, params: 2, frame: 13 return isAnimatedIconHash(a0?.icon); } function _getAssetHash(a0) { // fn#16631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:9004, offset: 0x00e56794, size: 77 bytes, params: 2, frame: 12 var value; var property; var pathname; var error; try { value = environment; property = dependencyMap[13]; value = require(property); value = value.parse(a0); pathname = value.pathname; value = pathname.split('/'); value = value.pop(); } catch (error) { return null; } return value; } function isDataUri(a0) { // fn#16633, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:11087, offset: 0x00e5680b, size: 31 bytes, params: 2, frame: 12 return a0 != null && env0_6.test(a0); } function getGuildBannerSource(a0) { // fn#16641, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:10645, offset: 0x00e568ec, size: 38 bytes, params: 2, frame: 14 const value = a1; return makeSource(getGuildBannerURL(a0, value !== undefined ? value : false)); } function getAnimatableSourceWithFallback(a0, a1) { // fn#16645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:10899, offset: 0x00e56966, size: 138 bytes, params: 3, frame: 16 var r0; var value3; var items2; var object; const value = a1(a0); const moduleValue = require(dependencyMap[3]); if (moduleValue.isAndroid()) { if (a0) { if (typeof value !== 'number') { value3 = a1(false); if (typeof value3 === 'number') { items2 = [value]; object = {}; copyDataProperties(object, value3, dependencyMap); object['isForceCached'] = true; items2[1] = object; r0 = items2; } else if (value3.uri === value.uri) { r0 = value3; } else { items2 = [value]; object = {}; copyDataProperties(object, value3, dependencyMap); object['isForceCached'] = true; items2[1] = object; r0 = items2; } return r0; } return value; } } return value; } function isAnimatedImageURL(a0) { // fn#16646, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:12274, offset: 0x00e569f0, size: 37 bytes, params: 2, frame: 13 return a0 != null && isAnimatedIconHash(_getAssetHash(a0)); } function isVideoURL(a0) { // fn#16647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1550:12373, offset: 0x00e56a15, size: 37 bytes, params: 2, frame: 13 return a0 != null && isVideoAssetHash(_getAssetHash(a0)); } } global.__d(_fun16603, 1423, [661, 1424, 1426, 477, 1457, 1468, 1853, 1856, 24, 1857, 1859, 1860, 21, 1473, 2]) /* metro module 1423, dependencies: [661, 1424, 1426, 477, 1457, 1468, 1853, 1856, 24, 1857, 1859, 1860, 21, 1473, 2] */;