/* Metro module 8402; source: modules/profile_customization/ProfileCustomizationUtils.tsx; dependencies: [31, 7624, 5189, 1945, 566, 4002, 1244, 2] */ import GuildMemberStore from '../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */ import UserProfileStore from '../user_profile/UserProfileStore.tsx'; /* Metro dependency 5189 */ import UserProfileSettingsStore from '../user_profile/UserProfileSettingsStore.tsx'; /* Metro dependency 7624 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as SharedModule from '../../design/shared.tsx'; /* Metro dependency 4002 */ function _fun66759(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:6, offset: 0x01c08c18, size: 348 bytes, params: 8, frame: 20 let env0_0 = require; const closure = function({userValue, guildValue, pendingValue, guildId}) { return pendingValue === '' || pendingValue === null ? guildId != null ? userValue : null : pendingValue === '' ? guildId == null || guildValue === '' ? userValue : guildValue ?? userValue : pendingValue ?? (guildId == null || guildValue === '' ? userValue : guildValue ?? userValue); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/profile_customization/ProfileCustomizationUtils.tsx'); exports.useAvatarsWithGuilds = useAvatarsWithGuilds; exports.useGuildMemberAndUserPendingNameplate = useGuildMemberAndUserPendingNameplate; exports.useGuildMemberOrUserPendingDisplayNameStyles = useGuildMemberOrUserPendingDisplayNameStyles; exports.useUserAvatarDecoration = useUserAvatarDecoration; exports.useUserProfileEffect = function({user, guildId}) { return require(dependencyMap[4]).useStateFromStores([UserProfileStore], _fun66773); }; exports.useUserProfileFrame = function({user, guildId}) { return require(dependencyMap[4]).useStateFromStores([UserProfileStore], _fun66775); }; exports.useAvatarDecorationSettings = function(a0) { var env0_0 = a0; return require(dependencyMap[4]).useStateFromStoresObject([UserProfileSettingsStore], _fun66777); }; exports.useProfileEffectSettings = function(a0) { var env0_0 = a0; return require(dependencyMap[4]).useStateFromStoresObject([UserProfileSettingsStore], _fun66779); }; exports.useProfileFrameSettings = function(a0) { var env0_0 = a0; return require(dependencyMap[4]).useStateFromStoresObject([UserProfileSettingsStore], _fun66781); }; exports.getProfilePreviewValue = closure; exports.resolveCollectiblesOverride = resolveCollectiblesOverride; exports.showRemoveAvatar = function(a0, a1) { return a0 === undefined ? a1 != null : a0 != null; }; exports.showRemoveBanner = function(a0, a1) { return a0 === undefined ? a1 != null : a0 != null; }; exports.announcePendingAvatarChange = announcePendingAvatarChange; function useAvatarsWithGuilds(a0) { // fn#66761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:422, offset: 0x01c08dd2, size: 44 bytes, params: 2, frame: 14 const env0_0 = a0; return ReactModule.useMemo(_fun66762, [a0]); function _fun66762() { // fn#66762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:473, offset: 0x01c08dfe, size: 160 bytes, params: 1, frame: 22 var environment; var r6; var avatar; var r0; var propertyName; var propertyName2; var property; let value = environment.__proto__; value = GuildMemberStore.getMutableAllGuildsAndMembers(); const object = {}; const properties = Object.keys(value); const properties2 = 0; const properties3 = properties.length; const value3 = undefined; if (properties !== value3) { r6 = properties2; while (true) { propertyName = properties[r6]; propertyName2 = r6 + 1; if (propertyName === value3) { break; } property = value[propertyName]; property = property[env0_0]; if (property == null) { avatar = value3; continue; } avatar = property.avatar; if (avatar == null) { r6 = propertyName2; continue; } if (object[avatar] != null) { continue; } object[avatar] = []; property = object[avatar]; property.push(propertyName); r6 = propertyName2; } } if (object != null) { value = global.Object.entries(object); value = value.map(function(a0) { return a0[1][0]; }); r0 = value; } else { r0 = []; } return r0; } } function useGuildMemberAndUserPendingNameplate(a0, a1) { // fn#66764, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:729, offset: 0x01c08eb0, size: 185 bytes, params: 3, frame: 20 const env0_0 = a0; const env0_1 = a1; const value2 = undefined; const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildMemberStore], _fun66765); const value = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([UserProfileSettingsStore], function() { var object = {}; var userProfileSettingsStoreBinding = UserProfileSettingsStore; object.pendingNameplate = userProfileSettingsStoreBinding.getPendingChanges(require).pendingNameplate; object.pendingErrors = userProfileSettingsStoreBinding.getErrors(require).nameplate; return object; }); return {userNameplate: a0.nameplate, guildNameplate: value3 == null || value3.collectibles == null ? value2 : value3.collectibles.nameplate, pendingNameplate: value.pendingNameplate, pendingErrors: value.pendingErrors}; function _fun66765() { // fn#66765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:821, offset: 0x01c08f69, size: 49 bytes, params: 1, frame: 14 return require === undefined ? null : GuildMemberStore.getMember(require, env0_0.id); } } function useGuildMemberOrUserPendingDisplayNameStyles(a0, a1) { // fn#66767, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:1233, offset: 0x01c08fd8, size: 192 bytes, params: 3, frame: 20 const env0_0 = a0; const env0_1 = a1; const value2 = undefined; const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildMemberStore], _fun66768); const value = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([UserProfileSettingsStore], function() { var object = {}; var userProfileSettingsStoreBinding = UserProfileSettingsStore; object.pendingDisplayNameStyles = userProfileSettingsStoreBinding.getPendingChanges(require).pendingDisplayNameStyles; object.tryItOutDisplayNameStyles = userProfileSettingsStoreBinding.getTryItOutChanges().tryItOutDisplayNameStyles; object.pendingErrors = userProfileSettingsStoreBinding.getErrors(require).displayNameStyles; return object; }); return {userDisplayNameStyles: a0 == null ? value2 : a0.displayNameStyles, guildDisplayNameStyles: value3 == null ? value2 : value3.displayNameStyles, pendingDisplayNameStyles: value.pendingDisplayNameStyles, tryItOutDisplayNameStyles: value.tryItOutDisplayNameStyles, pendingErrors: value.pendingErrors}; function _fun66768() { // fn#66768, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:1330, offset: 0x01c09098, size: 64 bytes, params: 1, frame: 14 const value2 = null; return require === undefined || value2 == env0_0 ? value2 : GuildMemberStore.getMember(require, env0_0.id); } } function useUserAvatarDecoration({user, guildId}) { // fn#66770, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:1924, offset: 0x01c0912b, size: 112 bytes, params: 2, frame: 17 return guildId != null ? (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildMemberStore], _fun66771)?.avatarDecoration : user.avatarDecoration; function _fun66771() { // fn#66771, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:2015, offset: 0x01c0919b, size: 50 bytes, params: 1, frame: 14 const guildIdBinding = guildId; const value2 = null; return value2 != guildIdBinding ? GuildMemberStore.getMember(guildId, user.id) : value2; } } function useUserProfileEffect({user, guildId}) { // fn#66772, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:2146, offset: 0x01c091cd, size: 80 bytes, params: 2, frame: 14 return (FluxModule).useStateFromStores([UserProfileStore], _fun66773); function _fun66773() { // fn#66773, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:2235, offset: 0x01c0921d, size: 109 bytes, params: 1, frame: 15 return guildId == null ? UserProfileStore.getUserProfile(user.id)?.profileEffect : UserProfileStore.getGuildMemberProfile(user.id, guildId)?.profileEffect; } } function useUserProfileFrame({user, guildId}) { // fn#66774, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:2410, offset: 0x01c0928a, size: 80 bytes, params: 2, frame: 14 return (FluxModule).useStateFromStores([UserProfileStore], _fun66775); function _fun66775() { // fn#66775, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:2498, offset: 0x01c092da, size: 109 bytes, params: 1, frame: 15 return guildId == null ? UserProfileStore.getUserProfile(user.id)?.profileFrame : UserProfileStore.getGuildMemberProfile(user.id, guildId)?.profileFrame; } } function useAvatarDecorationSettings(a0) { // fn#66776, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:2679, offset: 0x01c09347, size: 67 bytes, params: 2, frame: 14 const env0_0 = a0; return (FluxModule).useStateFromStoresObject([UserProfileSettingsStore], _fun66777); function _fun66777() { // fn#66777, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:2764, offset: 0x01c0938a, size: 62 bytes, params: 1, frame: 12 const userProfileSettingsStoreBinding = UserProfileSettingsStore; const getPendingChanges = userProfileSettingsStoreBinding.getPendingChanges; const binding = env0_0; const getErrors = userProfileSettingsStoreBinding.getErrors; return {pendingAvatarDecoration: Reflect.apply(getPendingChanges, userProfileSettingsStoreBinding, [binding]).pendingAvatarDecoration, errors: Reflect.apply(getErrors, userProfileSettingsStoreBinding, [binding]).avatarDecoration}; } } function useProfileEffectSettings(a0) { // fn#66778, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:2912, offset: 0x01c093c8, size: 67 bytes, params: 2, frame: 14 const env0_0 = a0; return (FluxModule).useStateFromStoresObject([UserProfileSettingsStore], _fun66779); function _fun66779() { // fn#66779, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:2994, offset: 0x01c0940b, size: 62 bytes, params: 1, frame: 12 const userProfileSettingsStoreBinding = UserProfileSettingsStore; const getPendingChanges = userProfileSettingsStoreBinding.getPendingChanges; const binding = env0_0; const getErrors = userProfileSettingsStoreBinding.getErrors; return {pendingProfileEffect: Reflect.apply(getPendingChanges, userProfileSettingsStoreBinding, [binding]).pendingProfileEffect, errors: Reflect.apply(getErrors, userProfileSettingsStoreBinding, [binding]).profileEffect}; } } function useProfileFrameSettings(a0) { // fn#66780, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:3132, offset: 0x01c09449, size: 67 bytes, params: 2, frame: 14 const env0_0 = a0; return (FluxModule).useStateFromStoresObject([UserProfileSettingsStore], _fun66781); function _fun66781() { // fn#66781, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:3213, offset: 0x01c0948c, size: 62 bytes, params: 1, frame: 12 const userProfileSettingsStoreBinding = UserProfileSettingsStore; const getPendingChanges = userProfileSettingsStoreBinding.getPendingChanges; const binding = env0_0; const getErrors = userProfileSettingsStoreBinding.getErrors; return {pendingProfileFrame: Reflect.apply(getPendingChanges, userProfileSettingsStoreBinding, [binding]).pendingProfileFrame, errors: Reflect.apply(getErrors, userProfileSettingsStoreBinding, [binding]).profileFrame}; } } function resolveCollectiblesOverride({pendingValue, userValue, guildValue, guildId}) { // fn#66782, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:3400, offset: 0x01c094ca, size: 81 bytes, params: 2, frame: 15 var profilePreviewValue; var value2; if (pendingValue !== undefined) { profilePreviewValue = getProfilePreviewValue({userValue: userValue, guildValue: guildValue, pendingValue: pendingValue, guildId: guildId}); value2 = null; return value2 != profilePreviewValue ? profilePreviewValue : value2; } } function announcePendingAvatarChange(a0) { // fn#66785, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8587:3811, offset: 0x01c09537, size: 306 bytes, params: 2, frame: 16 const AccessibilityAnnouncer = (SharedModule).AccessibilityAnnouncer; const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; if (a0 === 'set') { AccessibilityAnnouncer.announce(intl.string(t.dyU5c5)); } else if (a0 === 'remove') { AccessibilityAnnouncer.announce(intl.string(t['f1+oNk'])); } else { AccessibilityAnnouncer.announce(intl.string(t['/b5nqj'])); } } } global.__d(_fun66759, 8402, [31, 7624, 5189, 1945, 566, 4002, 1244, 2]) /* metro module 8402, dependencies: [31, 7624, 5189, 1945, 566, 4002, 1244, 2] */;