Files
discord-decomp/sources/components_native/common/UserSummaryItem.tsx
T
2026-07-28 01:06:53 +03:00

285 lines
13 KiB
TypeScript

/* Metro module 10881; source: components_native/common/UserSummaryItem.tsx; dependencies: [31, 27, 1945, 33, 4501, 697, 1305, 566, 1423, 4617, 1244, 4573, 2] */
import Native from '../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import GuildMemberStore from '../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
import NicknameUtils from '../../utils/NicknameUtils.tsx'; /* Metro dependency 4617 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as NativeModule from '../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as CreateStylesModule from '../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TextModule from '../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
function _fun83354(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11067:6, offset: 0x01f165fa, size: 379 bytes, params: 8, frame: 22
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
ReactModule;
const createStyles = CreateStylesModule.createStyles;
object = {};
object.container = {flexDirection: 'row'};
object.names = {'marginStart': 4, 'paddingRight': 1};
const TEXT_SUBTLE = (Native).colors.TEXT_SUBTLE;
object.namesLegacy = {'marginStart': 4, 'paddingRight': 1, color: TEXT_SUBTLE};
const BACKGROUND_BASE_LOWEST = (Native).colors.BACKGROUND_BASE_LOWEST;
object.plusCountContainer = {'backgroundColor': null, 'marginStart': 2, 'alignItems': 'center',
backgroundColor: BACKGROUND_BASE_LOWEST};
object.cutout = {marginRight: -4};
const env0_6 = Reflect.apply(createStyles, CreateStylesModule, [object]);
object = {};
const CutoutDirection = (NativeModule).CutoutDirection;
const RIGHT = CutoutDirection.RIGHT;
object.direction = RIGHT;
(FileImportTrackerModule).fileFinishedImporting('components_native/common/UserSummaryItem.tsx');
exports.default = UserSummaryItem;
function UserSummaryItem({style, namesStyle, namesVariant, max, users, renderedUsers, withNames, channelId, guildId, avatarSize, withPlusCount, cutout, cutoutStyle}) { // fn#83355, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11067:584, offset: 0x01f16775, size: 990 bytes, params: 2, frame: 32
var environment;
var r1;
var r5;
var r4;
var r13;
var r15;
var value;
var AvatarSizes;
var XXSMALL;
var binding;
var value4;
var length2;
var value6;
var intl;
var formatToPlainString;
var t;
var GhkJ21;
var length3;
var value7;
var HermesInternal;
var concat;
var value8;
var push;
var jsxRuntimeEnv0_5Binding;
var LegacyText;
var namesLegacy;
const Text = (TextModule).Text;
var names;
var pop;
var value9;
var AVATAR_SIZE_MAP;
var property;
var object2;
var plusCountContainer;
reducibleJoin2: while (true) {
if (max !== undefined) {
break reducibleJoin2;
}
value = 3;
max = value;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (renderedUsers !== undefined) {
r1 = renderedUsers;
break reducibleJoin4;
}
r1 = [];
break reducibleJoin4;
}
reducibleJoin6: while (true) {
if (avatarSize !== undefined) {
r5 = avatarSize;
break reducibleJoin6;
}
value = environment;
AvatarSizes = (require(1305) /* metro dependency 1305: native */).AvatarSizes;
XXSMALL = AvatarSizes.XXSMALL;
r5 = XXSMALL;
break reducibleJoin6;
}
reducibleJoin8: while (true) {
if (cutout !== undefined) {
r4 = cutout;
break reducibleJoin8;
}
value = environment;
binding = env0_7;
r4 = binding;
break reducibleJoin8;
}
var env0_10;
const styles = useStyles();
let length = r1.length;
length = length > 0 ? r1.length : users.length;
const Math = global.Math;
const value3 = Math.min(length, max);
const env0_8 = {};
(require(566) /* metro dependency 566: flux */).useStateFromStores([GuildMemberStore], function() {
return users.forEach(_fun83357);
});
if (value3 === 0) {
return null;
}
const items2 = [];
if (0 < value3) {
r13 = 0;
reducibleLoop13: while (true) {
UserSummaryItem_loop();
value4 = typeof r13 === 'bigint' ? r13 + 1n : +r13 + 1;
env0_10 = value4;
if (value4 < value3) {
r13 = value4;
continue reducibleLoop13;
}
break reducibleLoop13;
}
}
const name = (NicknameUtils).getName(guildId, channelId, users[0]);
reducibleJoin16: while (true) {
if (withNames) {
length2 = users.length;
value6 = length2 > 1;
r13 = value6;
break reducibleJoin16;
}
r13 = withNames;
break reducibleJoin16;
}
reducibleJoin18: while (true) {
if (r13) {
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
formatToPlainString = intl.formatToPlainString;
t = (require(1244) /* metro dependency 1244: indexNative */).t;
GhkJ21 = t.GhkJ21;
length3 = users.length;
value7 = Reflect.apply(formatToPlainString, intl, [GhkJ21, {name: name, count: length3 - 1}]);
r15 = value7;
break reducibleJoin18;
}
r15 = name;
break reducibleJoin18;
}
reducibleJoin23: while (true) {
if (withNames) {
if (users[0] == null) {
break reducibleJoin23;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value8 = 'username-' + r15;
if (namesVariant != null) {
push = items2.push;
jsxRuntimeEnv0_5Binding = jsxRuntimeEnv0_5;
names = styles.names;
Reflect.apply(push, items2,
[<Text variant={namesVariant} color="redesign-channel-name-muted-text" style={[names,
namesStyle]} lineClamp={1} key={value8}>{r15}</Text>]);
break reducibleJoin23;
}
push = items2.push;
jsxRuntimeEnv0_5Binding = jsxRuntimeEnv0_5;
LegacyText = (require(1305) /* metro dependency 1305: native */).LegacyText;
namesLegacy = styles.namesLegacy;
Reflect.apply(push, items2, [<LegacyText style={[namesLegacy,
namesStyle]} numberOfLines={1} key={value8}>{r15}</LegacyText>]);
break reducibleJoin23;
}
break reducibleJoin23;
}
reducibleJoin26: while (true) {
if (length > max) {
if (withPlusCount) {
pop = items2.pop;
Reflect.apply(pop, items2, []);
value9 = '+' + (length + 1 - max);
AVATAR_SIZE_MAP = (require(1305) /* metro dependency 1305: native */).AVATAR_SIZE_MAP;
property = AVATAR_SIZE_MAP[r5];
push = items2.push;
jsxRuntimeEnv0_5Binding = jsxRuntimeEnv0_5;
object2 = {};
plusCountContainer = styles.plusCountContainer;
object2.style = [plusCountContainer, {borderRadius: property, width: property, height: property,
padding: property / 8}];
object2.children = (
<Text variant="text-xs/normal" color="mobile-text-heading-primary">
{value9}
</Text>
);
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
Reflect.apply(push, items2, [<View {...object2} key={'plus-' + value9} />]);
break reducibleJoin26;
}
break reducibleJoin26;
}
break reducibleJoin26;
}
return (
<View style={[style, styles.container]}>
{items2}
</View>
);
function _fun83356() { // fn#83356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11067:896, offset: 0x01f16b53, size: 28 bytes, params: 1, frame: 11
return users.forEach(_fun83357);
function _fun83357(a0) { // fn#83357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11067:911, offset: 0x01f16b6f, size: 71 bytes, params: 2, frame: 15
var binding;
var id;
var value4;
var guildMemberStoreBinding;
if (guildId != null && a0 != null) {
binding = env1_8;
id = a0.id;
value4 = environment.__proto__.__proto__;
guildMemberStoreBinding = GuildMemberStore;
binding[id] = guildMemberStoreBinding.getMember(guildId, a0.id);
}
}
}
function UserSummaryItem_loop() { // fn#83358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11067:1005, owner: UserSummaryItem._loop, offset: 0x01f16bb6, size: 335 bytes, params: 1, frame: 21
var environment;
var r5;
var r8;
var push;
var property;
var value5;
var CutoutableAvatarImage;
var binding;
if (env0_1.length === 0) {
property = users[env0_10];
r5 = property?.id ?? '@' + env0_10;
value5 = environment.__proto__;
r8 = property == null ? (importDefault(1423) /* metro dependency 1423: AvatarUtils */).makeSource(null) : _loopO;
binding = env0_9;
push = binding.push;
CutoutableAvatarImage = (require(1305) /* metro dependency 1305: native */).CutoutableAvatarImage;
if (binding < env0_7 - 1) {
Reflect.apply(push, binding, [<CutoutableAvatarImage size={ReactNativeModule.View} source={r8} style={[styles.cutout,
cutoutStyle]} cutout={env0_4} key={r5} />]);
} else {
Reflect.apply(push, binding, [<CutoutableAvatarImage size={ReactNativeModule.View} source={r8} key={r5} />]);
}
} else {
binding = env0_9;
binding.push(env0_1[env0_10]);
}
function _loopO() { // fn#83359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11067:1156, owner: UserSummaryItem._loop.o, offset: 0x01f16d05, size: 189 bytes, params: 1, frame: 21
const value = a0;
const value2 = undefined;
const r6 = value !== value2 ? value : false;
const binding = env0_0;
const getAvatarURL = binding.getAvatarURL;
const guildIdBinding = guildId;
const AVATAR_SIZE_MAP = (NativeModule).AVATAR_SIZE_MAP;
const value5 = Reflect.apply(getAvatarURL, binding, [guildIdBinding, AVATAR_SIZE_MAP[env1_3], r6]);
return (importDefault(1423) /* metro dependency 1423: AvatarUtils */).makeSource((env0_1 == null ? value2 : env0_1.avatar) == null ? value5 : (importDefault(1423) /* metro dependency 1423: AvatarUtils */).getGuildMemberAvatarURL(env0_1,
r6) ?? value5);
}
}
}
}
global.__d(_fun83354, 10881, [31, 27, 1945, 33, 4501, 697, 1305, 566, 1423, 4617, 1244, 4573,
2]) /* metro module 10881, dependencies: [31, 27, 1945, 33, 4501, 697, 1305, 566, 1423, 4617, 1244, 4573, 2] */;