/* Metro module 6794; source: modules/guild_boosting/RoleIconUtils.tsx; dependencies: [661, 477, 3797, 1457, 1423, 2] */ function _fun53491(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#53491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6972:6, offset: 0x0134d670, size: 323 bytes, params: 8, frame: 23 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const constantsModule = require(661) /* metro dependency 661: Constants */; const env0_3 = constantsModule.Endpoints; const env0_4 = constantsModule.GuildFeatures; let protocol = global.location.protocol; let GLOBAL_ENV = global.window.GLOBAL_ENV; const CDN_HOST = GLOBAL_ENV.CDN_HOST; const env0_5 = '' + protocol + '//' + CDN_HOST + '/role-icons'; protocol = global.location.protocol; GLOBAL_ENV = global.window.GLOBAL_ENV; const API_ENDPOINT = GLOBAL_ENV.API_ENDPOINT; const env0_6 = '' + protocol + API_ENDPOINT; const env0_7 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid(); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_boosting/RoleIconUtils.tsx'); exports.getRoleIconData = getRoleIconData; exports.replaceRoleIconSourceSize = replaceRoleIconSourceSize; exports.isRoleIconAssetUrl = isRoleIconAssetUrl; exports.canGuildUseRoleIcons = canGuildUseRoleIcons; } function getRoleIconSource({id, icon}, a1) { // fn#53492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6972:303, offset: 0x0134d7b3, size: 336 bytes, params: 3, frame: 32 var r10; var r1; var r7; var r8; var value; var value4; var moduleValue; var getBestMediaProxySize; var moduleValue2; var value7; var binding; if (icon != null) { if (icon.startsWith('data:')) { return icon; } r10 = (require(1423) /* metro dependency 1423: AvatarUtils */).SUPPORTS_WEBP ? 'webp' : 'png'; value4 = ''; if (a1 != null) { moduleValue = require(1457) /* metro dependency 1457: ImageLoaderUtils */; getBestMediaProxySize = moduleValue.getBestMediaProxySize; moduleValue2 = require(1457) /* metro dependency 1457: ImageLoaderUtils */; value7 = 'size=' + Reflect.apply(getBestMediaProxySize, moduleValue, [a1 * moduleValue2.getDevicePixelRatio()]); r1 = env0_7 ? value4 : '&quality=lossless'; r7 = value7; r8 = r1; } else { r7 = value4; r8 = 'quality=lossless'; } if (global.window.GLOBAL_ENV.CDN_HOST != null) { r1 = value4 + env0_5 + '/' + id + '/' + icon + '.' + r10 + '?' + r7 + r8; } else { binding = env0_6; value = Endpoints.ROLE_ICON(id, icon); value = value4 + binding + value + '?' + r7; r1 = value; } return r1; } } function getRoleIconData(a0, a1) { // fn#53493, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6972:729, offset: 0x0134d903, size: 136 bytes, params: 3, frame: 19 var r3; var defaultImport; var getByName; var defaultImport2; if (a0 == null) { return null; } const unicodeEmoji = a0.unicodeEmoji; const value = undefined; if (unicodeEmoji != null) { defaultImport = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */; getByName = defaultImport.getByName; defaultImport2 = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */; r3 = Reflect.apply(getByName, defaultImport, [defaultImport2.convertSurrogateToName(a0.unicodeEmoji, false)]); } else { r3 = value; } const object2 = {}; object2.customIconSrc = getRoleIconSource(a0, a1); object2.unicodeEmoji = r3 ?? value; return object2; } function replaceRoleIconSourceSize(a0, a1) { // fn#53494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6972:967, offset: 0x0134d98b, size: 116 bytes, params: 3, frame: 17 const replace = a0.replace; var value; const getBestMediaProxySize = (require(1457) /* metro dependency 1457: ImageLoaderUtils */).getBestMediaProxySize; value = Reflect.apply(getBestMediaProxySize, value, [a1 * (require(1457) /* metro dependency 1457: ImageLoaderUtils */).getDevicePixelRatio()]); value = 'size=' + value; return Reflect.apply(replace, a0, [RegExp('size=[0-9]+', 'g'), value]); } function isRoleIconAssetUrl(a0) { // fn#53495, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6972:1094, offset: 0x0134d9ff, size: 92 bytes, params: 2, frame: 16 return a0.startsWith(env0_5) || a0.startsWith('' + env0_6 + '/roles') && a0.includes('/icons/'); } function canGuildUseRoleIcons(a0, a1) { // fn#53496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6972:1187, offset: 0x0134da5b, size: 76 bytes, params: 3, frame: 13 let value = undefined; value = (a1 == null || a1.tags == null ? value : a1.tags.subscription_listing_id) != null; return value || a0.features.has(GuildFeatures.ROLE_ICONS); }