Files
discord-decomp/sources/modules/guilds_bar/native/GuildsBarGuild.tsx
T
2026-07-27 16:20:00 +03:00

337 lines
20 KiB
TypeScript

/* Metro module 14415; source: modules/guilds_bar/native/GuildsBarGuild.tsx; dependencies: [31, 3785, 1422, 4646, 5214, 1867, 3969, 4896, 14384, 14385, 661, 33, 4017, 4501, 697, 1357, 3860, 14395, 4013, 566, 6819, 14416, 14417, 4647, 1244, 683, 6914, 14410, 4559, 14386, 8812, 14425, 14426, 4577, 14428, 5475, 14433, 2] */
function _fun109099(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109099, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:6, offset: 0x0233d3d3, size: 575 bytes, params: 8, frame: 23
var object3;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = importAll(31) /* metro dependency 31 */;
const lurkingStore = importDefault(3785) /* metro dependency 3785: LurkingStore */;
const guildRecordModule = require(1422) /* metro dependency 1422: GuildRecord */;
const env0_5 = guildRecordModule.getGuildIconSource;
const env0_6 = guildRecordModule.getGuildIconURL;
const guildAvailabilityStore = importDefault(4646) /* metro dependency 4646: GuildAvailabilityStore */;
const guildReadStateStore = importDefault(5214) /* metro dependency 5214: GuildReadStateStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const selectedGuildStore = importDefault(3969) /* metro dependency 3969: SelectedGuildStore */;
const sortedGuildStore = importDefault(4896) /* metro dependency 4896: SortedGuildStore */;
const env0_12 = (require(14384) /* metro dependency 14384: GuildsBarDnDStore */).useItemDragState;
const env0_13 = (require(14385) /* metro dependency 14385: GuildsBarConstants */).TRANSITION_PHYSICS;
const env0_14 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
const value3 = require(33) /* metro dependency 33 */;
const env0_15 = value3.Fragment;
const env0_16 = value3.jsxs;
const env0_17 = value3.jsx;
object3 = {};
object3.pan = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(-1);
object3.itemMeasurements = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable([]);
object3.activeIndex = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(-1);
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = createStylesModule.createStyles;
const object4 = {};
let GUILD_BAR_ITEM_SIZE = (importDefault(697) /* metro dependency 697: native */).modules.mobile.GUILD_BAR_ITEM_SIZE;
object4.width = GUILD_BAR_ITEM_SIZE;
GUILD_BAR_ITEM_SIZE = (importDefault(697) /* metro dependency 697: native */).modules.mobile.GUILD_BAR_ITEM_SIZE;
object4.height = GUILD_BAR_ITEM_SIZE;
const env0_19 = Reflect.apply(createStyles, createStylesModule, [{guildIcon: object4}]);
object3 = {code: "function GuildsBarGuildTsx1(values){const{dragDropInProgress,sharedId,guildId,isDragTarget,withSpring,TRANSITION_PHYSICS}=this.__closure;var _guildId;const shouldAnimate=dragDropInProgress.get()&&sharedId.get()===guildId&&!isDragTarget;sharedId.set((_guildId=guildId)!==null&&_guildId!==void 0?_guildId:null);return{animations:{originY:shouldAnimate?withSpring(values.targetOriginY,TRANSITION_PHYSICS,'animate-always'):values.targetOriginY,height:shouldAnimate?withSpring(values.targetHeight,TRANSITION_PHYSICS,'animate-always'):values.targetHeight},initialValues:{originY:values.currentOriginY,height:values.currentHeight}};}"};
value = value.memo(GuildsBarGuild);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guilds_bar/native/GuildsBarGuild.tsx');
exports.default = value;
}
function GuildsBarGuild({guildId, isDragPreview}) { // fn#109100, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:1246, offset: 0x0233d612, size: 1324 bytes, params: 2, frame: 45
var object2;
isDragPreview = !(isDragPreview === undefined) && isDragPreview;
const value4 = (importDefault(1357) /* metro dependency 1357: MobileVisualRefreshExperiment */)('GuildsBarGuild');
const styles = useStyles();
const useTokenModule = require(3860) /* metro dependency 3860: useToken */;
const useToken = useTokenModule.useToken;
const GUILD_BAR_ITEM_SIZE = (importDefault(697) /* metro dependency 697: native */).modules.mobile.GUILD_BAR_ITEM_SIZE;
const value5 = Reflect.apply(useToken, useTokenModule, [GUILD_BAR_ITEM_SIZE]);
const value6 = (require(14395) /* metro dependency 14395: GuildsBarAnimatedItemWrapper */).useGuildsBarAnimatedWrapperStyles({'disableSelectedColor': true,
'disableBGColor': true});
const MobileHomeDrawerExperiment = (require(4013) /* metro dependency 4013: HomeDrawerExperiment */).MobileHomeDrawerExperiment;
const useConfig = MobileHomeDrawerExperiment.useConfig;
const enableHome = Reflect.apply(useConfig, MobileHomeDrawerExperiment, [{location: 'guilds'}]).enableHome;
const value7 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([SelectedGuildStore,
GuildAvailabilityStore, GuildReadStateStore, LurkingStore], _fun109101, [guildId]);
const selected = value7.selected;
const isUnavailable = value7.isUnavailable;
const env0_3 = isUnavailable;
const mentionCount = value7.mentionCount;
const unread = value7.unread;
const isMentionLowImportance = value7.isMentionLowImportance;
const isLurking = value7.isLurking;
const {asset, icon, guildName} = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore],
_fun109102, [guildId, value5, selected],
importDefault(14416) /* metro dependency 14416: isGuildsBarGuildDataEqual */);
const {badgeTopRight, badgeBottomRight, cutouts,
mediaState} = (importDefault(14417) /* metro dependency 14417: useGuildsBarBadges */)(guildId, mentionCount,
isMentionLowImportance);
const binding = env0_3;
const value10 = binding.useMemo(_fun109103, [guildId, value5, isLurking, isUnavailable]);
const value11 = binding.useMemo(_fun109109, [guildName, mentionCount, unread, mediaState]);
const value12 = (importDefault(14425) /* metro dependency 14425: usePreloadedGuildAsset */)(guildId, icon, asset);
const {isDragTarget, dragState, overState, itemSize, dragDropInProgress} = useItemDragState(guildId, isDragPreview);
const {accessibilityActions, onAccessibilityAction} = binding.useMemo(_fun109111, [guildId,
(require(566) /* metro dependency 566: flux */).useStateFromStores([SortedGuildStore], function() {
return SortedGuildStore.getGuildsTree().version;
})]);
const value15 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(guildId);
const useCallback = binding.useCallback;
const closure = GuildsBarGuildF;
object2 = {dragDropInProgress: dragDropInProgress, sharedId: value15, guildId: guildId, isDragTarget: isDragTarget};
object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
object2.TRANSITION_PHYSICS = TRANSITION_PHYSICS;
closure.__closure = object2;
closure.__workletHash = 14096669603718;
closure.__initData = env0_20;
return ((Component) => <Component id={guildId} draggedItemSize={itemSize} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} cutouts={isDragTarget ? undefined : cutouts} selected={selected} isDragTarget={isDragTarget} dragState={dragState} sharedId={value15} circle={!value4 && (!selected && !enableHome)} overState={overState} unread={unread} label={value11} config={value10} styles={value6} isDragPreview={isDragTarget} layout={Reflect.apply(useCallback,
binding, [closure, [guildId, value15, isDragTarget,
dragDropInProgress]])} externalChildren={<>{badgeTopRight}{badgeBottomRight}</>} expandedChildren={((Component) => <Component guildId={guildId} />)(importDefault(14428) /* metro dependency 14428: HomeDrawerGuildRow */)}>{isUnavailable ? ((Component) => <Component source={importDefault(14433) /* metro dependency 14433 */} style={styles.guildIcon} />)(importDefault(5475) /* metro dependency 5475: FastImage */) : value12 != null ? ((Component) => <Component source={value12} style={styles.guildIcon} />)(importDefault(5475) /* metro dependency 5475: FastImage */) : ((Component) => <Component value={guildName} selected={selected} animate={selected} size={(require(6819) /* metro dependency 6819: GuildIcon */).GuildIconSizes.LARGE} />)(importDefault(6819) /* metro dependency 6819: GuildIcon */)}</Component>)(importDefault(14395) /* metro dependency 14395: GuildsBarAnimatedItemWrapper */);
}
function _fun109101() { // fn#109101, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:1625, offset: 0x0233db3e, size: 129 bytes, params: 1, frame: 13
const object2 = {};
const guildId2 = SelectedGuildStore.getGuildId();
const guildIdBinding = guildId;
object2.selected = guildId2 === guildIdBinding;
object2.isUnavailable = GuildAvailabilityStore.isUnavailable(guildIdBinding);
object2.unread = GuildReadStateStore.hasUnread(guildIdBinding);
object2.mentionCount = GuildReadStateStore.getMentionCount(guildIdBinding);
object2.isMentionLowImportance = GuildReadStateStore.getIsMentionLowImportance(guildIdBinding);
object2.isLurking = LurkingStore.isLurking(guildIdBinding);
return object2;
}
function _fun109102() { // fn#109102, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:1970, offset: 0x0233dbbf, size: 173 bytes, params: 1, frame: 20
const value = environment.__proto__;
const guild = GuildStore.getGuild(guildId);
const value4 = undefined;
let r1 = guild != null ? getGuildIconURL(guild, env0_1, selected) : value4;
const object2 = {};
object2.guildName = guild == null ? value4 : guild.name;
object2.icon = r1;
r1 = r1 != null && guild != null ? getGuildIconSource(guild,
(require(6819) /* metro dependency 6819: GuildIcon */).ImageSizes[(require(6819) /* metro dependency 6819: GuildIcon */).GuildIconSizes.LARGE],
selected) : value4;
object2.asset = r1;
return object2;
}
function _fun109103() { // fn#109103, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:2306, offset: 0x0233dc6c, size: 41 bytes, params: 1, frame: 4
return {onPress: onPress_109104, onLongPress: isLurking ? _fun109106 : undefined};
}
function _fun109109() { // fn#109109, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:3193, offset: 0x0233dffc, size: 850 bytes, params: 1, frame: 20
var r0;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var push;
var value8;
var value9;
var value10;
var value11;
var value12;
var value;
const r5 = mentionCount == null ? unread === true ? intl.formatToPlainString(t.lzqe42,
{guildName: guildName}) : intl.formatToPlainString(t['/uzRss'], {guildName: guildName,
mentions: mentionCount}) : mentionCount > 0 ? intl.formatToPlainString(t['/uzRss'], {guildName: guildName,
mentions: mentionCount}) : unread === true ? intl.formatToPlainString(t.lzqe42,
{guildName: guildName}) : intl.formatToPlainString(t['/uzRss'], {guildName: guildName, mentions: mentionCount});
const items = [];
if (mediaState.activeEvent) {
push = items.push;
value8 = environment.__proto__;
Reflect.apply(push, items, [intl.string(t.dHvJ2p)]);
}
if (mediaState.liveStage) {
push = items.push;
value9 = environment.__proto__;
Reflect.apply(push, items, [intl.string(t.OO7ndG)]);
}
if (mediaState.screenshare) {
push = items.push;
value10 = environment.__proto__;
Reflect.apply(push, items, [intl.string(t.wsHMZ7)]);
}
if (mediaState.video) {
push = items.push;
value11 = environment.__proto__;
Reflect.apply(push, items, [intl.string(t.BrLCS0)]);
}
if (mediaState.audio) {
push = items.push;
value12 = environment.__proto__;
Reflect.apply(push, items, [intl.string(t.jPBhKy)]);
}
if (mediaState.activity) {
push = items.push;
value = environment.__proto__;
Reflect.apply(push, items, [intl.string(t.Y3Gii5)]);
}
if (items.length > 0) {
value = items.join(' ');
value = '' + r5 + ', ' + value;
r0 = value;
} else {
r0 = r5;
}
return r0;
}
function _fun109111() { // fn#109111, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:4075, offset: 0x0233e367, size: 162 bytes, params: 1, frame: 18
var environment;
let value = environment.__proto__;
value = importDefault(dependencyMap[29]);
const guildIdBinding = guildId;
value = value(guildIdBinding, version);
const value3 = importDefault(dependencyMap[32])(guildIdBinding, version);
value = value.map(function(a0) {
return {name: a0.label, label: a0.label, action: a0.action};
});
const items2 = [];
value = arraySpread(items2, value, 0, dependencyMap);
arraySpread(items2, value3.map(function(a0) {
return {name: a0.name, label: a0.label, action: a0.action};
}), value, dependencyMap);
const object2 = {};
object2.accessibilityActions = items2.map(function({name, label}) {
return {name: name, label: label};
});
object2.onAccessibilityAction = onAccessibilityAction_109115;
return object2;
}
function GuildsBarGuildF(a0) { // fn#109117, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:4555, owner: GuildsBarGuild.f, offset: 0x0233e4cb, size: 260 bytes, params: 2, frame: 20
var r4;
var moduleValue;
var moduleValue2;
var value;
let r3 = dragDropInProgress.get() && env0_12.get() === guildId && !isDragTarget;
const binding = env0_12;
const set = binding.set;
const guildIdBinding = guildId;
const value6 = null;
Reflect.apply(set, binding, [value6 != guildIdBinding ? guildId : value6]);
const object = {};
if (r3) {
value = environment.__proto__;
moduleValue = require(4577) /* metro dependency 4577: spring */;
value = moduleValue.withSpring(a0.targetOriginY, TRANSITION_PHYSICS, 'animate-always');
r4 = value;
} else {
r4 = a0.targetOriginY;
}
object.originY = r4;
if (r3) {
value = environment.__proto__;
moduleValue2 = require(4577) /* metro dependency 4577: spring */;
value = moduleValue2.withSpring(a0.targetHeight, TRANSITION_PHYSICS, 'animate-always');
r3 = value;
} else {
r3 = a0.targetHeight;
}
object.height = r3;
return {animations: object, initialValues: {originY: a0.currentOriginY, height: a0.currentHeight}};
}
function onPress_109104() { // fn#109104, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:2320, offset: 0x0233dc95, size: 364 bytes, params: 1, frame: 19
var environment;
var defaultImport;
var object2;
var moduleValue;
var defaultImport2;
var show;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const value = environment.__proto__.__proto__;
const getGuild = GuildStore.getGuild;
if (Reflect.apply(getGuild, GuildStore, [guildId]) == null) {
defaultImport2 = importDefault(4647) /* metro dependency 4647: AlertActionCreators */;
show = defaultImport2.show;
object2 = {};
object2.title = intl.string(t.R0RpRX);
object2.body = intl.string(t.m9gRVN);
return Reflect.apply(show, defaultImport2, [object2]);
}
if (isUnavailable) {
defaultImport2 = importDefault(4647) /* metro dependency 4647: AlertActionCreators */;
show = defaultImport2.show;
object2 = {};
object2.title = intl.string(t.R0RpRX);
object2.body = intl.string(t.m9gRVN);
return Reflect.apply(show, defaultImport2, [object2]);
}
const index = SortedGuildStore.getGuildFolders().findIndex(function({guildIds}) {
return guildIds.includes(guildId);
});
if (index > -1) {
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
defaultImport.track(AnalyticEvents.GUILD_CLICKED, {guild_id: guildId, index: index});
}
if (isLurking) {
moduleValue = require(6914) /* metro dependency 6914: LurkerPreviewAnalytics */;
moduleValue.trackGuildIconClicked(guildId);
}
(importDefault(14410) /* metro dependency 14410: transitionGuildsBarToGuildOrOpenSelectedChannel */)(guildId);
}
function _fun109106(a0) { // fn#109106, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:2654, offset: 0x0233de1d, size: 362 bytes, params: 2, frame: 20
var environment;
var moduleValue;
var value4;
var pageY;
var binding;
const value = environment.__proto__.__proto__;
const guild = GuildStore.getGuild(guildId);
if (guild != null) {
moduleValue = require(4559) /* metro dependency 4559: useIsScreenReaderEnabledNative */;
if (!moduleValue.getIsScreenReaderEnabled()) {
value4 = (importDefault(14386) /* metro dependency 14386: getGuildsBarGuildMenuItems */)(guildId,
SortedGuildStore.getGuildsTree().version);
if (value4.length !== 0) {
pageY = a0.nativeEvent.pageY;
binding = env2_18;
binding.activeIndex.set(-1);
(require(8812) /* metro dependency 8812: ContextMenuStateNative */).showContextMenu({key: guildId,
title: guild.name, items: value4, x: 12 + env1_1 + 12,
y: pageY - env1_1 / 2, positionX: 'left', positionY: 'below', width: env1_1, height: env1_1, state: binding, dividerIndexes: [], keyboardShouldPersistTaps: 'never', requestClose: requestClose_109107, onClose: function() {
}});
}
}
}
}
function onAccessibilityAction_109115(a0) { // fn#109115, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:4321, offset: 0x0233e466, size: 68 bytes, params: 2, frame: 12
const env0_0 = a0;
const value = env0_0.find(_fun109116);
if (!(value == null || value.action == null)) {
value.action();
}
}
function requestClose_109107(a0) { // fn#109107, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:3020, offset: 0x0233df87, size: 117 bytes, params: 2, frame: 12
var value;
var binding;
var activeIndex;
var property;
if (!a0) {
binding = env0_0;
value = environment.__proto__.__proto__.__proto__;
activeIndex = env3_18.activeIndex;
property = binding[activeIndex.get()];
if (property != null) {
property.action();
}
}
value = environment.__proto__.__proto__.__proto__;
env3_18.activeIndex.set(-1);
(require(8812) /* metro dependency 8812: ContextMenuStateNative */).hideContextMenu();
}
function _fun109116({name}) { // fn#109116, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:4369, offset: 0x0233e4aa, size: 33 bytes, params: 2, frame: 2
return name === env0_0.nativeEvent.actionName;
}