decord/source/modules/guilds_bar/native/GuildsBarGuild.tsx

335 lines
14 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 15644
// Function ID: 15645
// Dependencies: [19, 1434, 4831, 5388, 1910, 4201, 5083, 15612, 15613, 676, 21, 4668, 712, 1367, 4100, 15623, 15352, 15356, 15645, 589, 7226, 15656, 15657, 4832, 1236, 698, 15637, 15666, 15614, 15667, 4119, 4749, 5454, 15669, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 15644
import ThemesDefault from "Themes" /* 712 */;
import importAllResult from "noop" /* 19 */;
import GuildNSFWContentLevel from "GuildNSFWContentLevel" /* 1434 */;
import closure_6 from "handleConnectionOpen" /* 4831 */;
import closure_7 from "updateGuildUnreadSentinel" /* 5388 */;
import closure_8 from "createGuildRecordFromRust" /* 1910 */;
import closure_9 from "handleConnectionOpen" /* 4201 */;
import closure_10 from "insertUnsortedGuilds" /* 5083 */;
import { useItemDragState } from "withEqualityFn" /* 15612 */;
import { TRANSITION_PHYSICS } from "GUILD_ITEM_SIZE" /* 15613 */;
import { AnalyticEvents } from "ME" /* 676 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4668 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
let c3 = importAllResult;
2026-08-04 08:36:32 +00:00
({ getGuildIconSource: c4, getGuildIconURL: c5 } = GuildNSFWContentLevel);
({ Fragment: closure_14, jsxs: closure_15, jsx: closure_16 } = jsxProd);
let obj = { guildIcon: null };
2026-08-24 06:08:38 +00:00
obj = { width: ThemesDefault.modules.mobile.GUILD_BAR_ITEM_SIZE, height: ThemesDefault.modules.mobile.GUILD_BAR_ITEM_SIZE };
2026-08-04 08:36:32 +00:00
obj[0] = obj;
let closure_17 = createCacheKey.createStyles(obj);
let closure_18 = { 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}};}" };
2026-07-20 16:05:17 +00:00
const memoResult = importAllResult.memo(function GuildsBarGuild(guildId) {
guildId = guildId.guildId;
let flag = guildId.isDragPreview;
if (flag === undefined) {
flag = false;
}
let flag2 = guildId.hideExpandedChildren;
if (flag2 === undefined) {
flag2 = false;
}
2026-07-23 10:11:24 +00:00
let token;
let drawerOpen;
2026-08-24 06:08:38 +00:00
importAllResult = undefined;
2026-07-23 10:11:24 +00:00
let selected;
2026-07-20 16:05:17 +00:00
let isUnavailable;
let mentionCount;
2026-07-23 10:11:24 +00:00
let unread;
let guildName;
let mediaState;
let isDragTarget;
let dragDropInProgress;
let stateFromStores1;
let sharedValue;
2026-08-04 08:36:32 +00:00
const tmp3 = token(drawerOpen[13])("GuildsBarGuild");
const tmp4 = callback2();
let obj = guildId(drawerOpen[14]);
token = obj.useToken(token(drawerOpen[12]).modules.mobile.GUILD_BAR_ITEM_SIZE);
2026-08-24 06:08:38 +00:00
obj1 = guildId(drawerOpen[15]);
2026-08-04 08:36:32 +00:00
const enableHome = importAllResult.useContext(guildId(drawerOpen[16]).HomeDrawerStateContext).enableHome;
let obj2 = guildId(drawerOpen[17]);
2026-07-23 10:11:24 +00:00
drawerOpen = obj2.useDrawerOpen(enableHome);
2026-08-04 08:36:32 +00:00
importAllResult = importAllResult.useRef(guildId(drawerOpen[18]).HomeDrawerActiveHook.NONE);
2026-07-23 10:11:24 +00:00
const callback = importAllResult.useCallback((current) => {
2026-07-20 16:05:17 +00:00
closure_3.current = current;
}, []);
2026-08-04 08:36:32 +00:00
let obj3 = guildId(drawerOpen[19]);
let items = [mediaState, mentionCount, unread];
2026-07-20 16:05:17 +00:00
const items1 = [guildId];
2026-08-04 08:36:32 +00:00
const stateFromStoresObject = obj3.useStateFromStoresObject(items, () => ({ selected: mediaState.getGuildId() === guildId, isUnavailable: mentionCount.isUnavailable(guildId), unread: unread.hasUnread(guildId), mentionCount: unread.getMentionCount(guildId), isMentionLowImportance: unread.getIsMentionLowImportance(guildId) }), items1);
2026-07-23 10:11:24 +00:00
selected = stateFromStoresObject.selected;
2026-07-20 16:05:17 +00:00
isUnavailable = stateFromStoresObject.isUnavailable;
mentionCount = stateFromStoresObject.mentionCount;
2026-07-23 10:11:24 +00:00
unread = stateFromStoresObject.unread;
2026-08-04 08:36:32 +00:00
let obj4 = guildId(drawerOpen[19]);
2026-07-23 10:11:24 +00:00
const items2 = [guildName];
2026-07-20 16:05:17 +00:00
const items3 = [guildId, token, selected];
const stateFromStores = obj4.useStateFromStores(items2, () => {
const guild = guildName.getGuild(guildId);
let tmp2;
if (null != guild) {
2026-08-04 08:36:32 +00:00
tmp2 = isUnavailable(guild, token, selected);
2026-07-20 16:05:17 +00:00
}
let name;
2026-07-29 08:29:29 +00:00
if (guild != null) {
2026-07-20 16:05:17 +00:00
name = guild.name;
}
2026-07-29 08:29:29 +00:00
const obj = { guildName: name, icon: tmp2, asset: null };
2026-07-20 16:05:17 +00:00
let tmp7;
if (null != tmp2) {
if (null != guild) {
2026-08-04 08:36:32 +00:00
tmp7 = selected(guild, guildId(drawerOpen[20]).ImageSizes[guildId(undefined, drawerOpen[20]).GuildIconSizes.LARGE], selected);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
obj[2] = tmp7;
2026-07-20 16:05:17 +00:00
return obj;
2026-08-04 08:36:32 +00:00
}, items3, token(drawerOpen[21]));
2026-07-23 10:11:24 +00:00
guildName = stateFromStores.guildName;
2026-07-20 16:05:17 +00:00
({ asset, icon } = stateFromStores);
2026-08-04 08:36:32 +00:00
const tmp12 = token(drawerOpen[22])(guildId, mentionCount, stateFromStoresObject.isMentionLowImportance);
2026-07-29 08:29:29 +00:00
mediaState = tmp12.mediaState;
2026-08-04 08:36:32 +00:00
const items4 = [guildId, isUnavailable, drawerOpen];
2026-07-29 08:29:29 +00:00
({ badgeTopRight, badgeBottomRight, cutouts } = tmp12);
2026-07-20 16:05:17 +00:00
const items5 = [guildName, mentionCount, unread, mediaState];
2026-08-04 08:36:32 +00:00
const memo = importAllResult.useMemo(() => ({
onPress() {
2026-08-24 06:08:38 +00:00
if (null != closure_1_8.getGuild(closure_0)) {
2026-08-04 08:36:32 +00:00
if (!closure_5) {
if (closure_2) {
2026-08-24 06:08:38 +00:00
const guildFolders = closure_1_10.getGuildFolders();
2026-08-04 08:36:32 +00:00
const findIndexResult = guildFolders.findIndex((guildIds) => {
guildIds = guildIds.guildIds;
return guildIds.includes(closure_0);
});
if (findIndexResult > -1) {
let obj = { guild_id: null, index: null, active_hook: null };
2026-07-29 08:29:29 +00:00
obj[0] = tmp;
2026-08-04 08:36:32 +00:00
obj[1] = findIndexResult;
obj[2] = ref.current;
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_2[25]).track(closure_1_13.HOME_DRAWER_GUILD_CLICKED, obj);
const obj2 = closure_1_1(closure_1_2[25]);
2026-07-20 16:05:17 +00:00
}
}
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_2[26])(tmp);
2026-07-20 16:05:17 +00:00
}
2026-08-04 08:36:32 +00:00
}
obj = { title: null, body: null };
2026-08-24 06:08:38 +00:00
const intl = closure_1_0(closure_1_2[24]).intl;
obj[0] = intl.string(closure_1_0(closure_1_2[24]).t.R0RpRX);
const intl2 = closure_1_0(closure_1_2[24]).intl;
obj[1] = intl2.string(closure_1_0(closure_1_2[24]).t.m9gRVN);
return closure_1_1(closure_1_2[23]).show(obj);
2026-07-20 16:05:17 +00:00
}
2026-08-04 08:36:32 +00:00
}), items4);
2026-07-23 10:11:24 +00:00
const memo1 = importAllResult.useMemo(() => {
2026-07-20 16:05:17 +00:00
if (null != mentionCount) {
2026-07-29 08:29:29 +00:00
if (tmp > 0) {
2026-08-04 08:36:32 +00:00
const intl3 = guildId(drawerOpen[24]).intl;
2026-07-29 08:29:29 +00:00
let obj = { guildName: null, mentions: null };
obj[0] = guildName;
obj[1] = tmp;
2026-08-04 08:36:32 +00:00
let formatToPlainStringResult = intl3.formatToPlainString(guildId(drawerOpen[24]).t["/uzRss"], obj);
2026-07-20 16:05:17 +00:00
}
const items = [];
if (mediaState.activeEvent) {
2026-08-04 08:36:32 +00:00
const intl4 = guildId(drawerOpen[24]).intl;
items.push(intl4.string(guildId(drawerOpen[24]).t.dHvJ2p));
2026-07-20 16:05:17 +00:00
}
if (mediaState.liveStage) {
2026-08-04 08:36:32 +00:00
const intl5 = guildId(drawerOpen[24]).intl;
items.push(intl5.string(guildId(drawerOpen[24]).t.OO7ndG));
2026-07-20 16:05:17 +00:00
}
if (mediaState.screenshare) {
2026-08-04 08:36:32 +00:00
const intl6 = guildId(drawerOpen[24]).intl;
items.push(intl6.string(guildId(drawerOpen[24]).t.wsHMZ7));
2026-07-20 16:05:17 +00:00
}
if (mediaState.video) {
2026-08-04 08:36:32 +00:00
const intl7 = guildId(drawerOpen[24]).intl;
items.push(intl7.string(guildId(drawerOpen[24]).t.BrLCS0));
2026-07-20 16:05:17 +00:00
}
if (mediaState.audio) {
2026-08-04 08:36:32 +00:00
const intl8 = guildId(drawerOpen[24]).intl;
items.push(intl8.string(guildId(drawerOpen[24]).t.jPBhKy));
2026-07-20 16:05:17 +00:00
}
if (mediaState.activity) {
2026-08-04 08:36:32 +00:00
const intl9 = guildId(drawerOpen[24]).intl;
items.push(intl9.string(guildId(drawerOpen[24]).t.Y3Gii5));
2026-07-20 16:05:17 +00:00
}
let combined = formatToPlainStringResult;
if (items.length > 0) {
const _HermesInternal = HermesInternal;
combined = "" + formatToPlainStringResult + ", " + items.join(" ");
}
return combined;
}
if (true === unread) {
2026-08-04 08:36:32 +00:00
const intl2 = guildId(drawerOpen[24]).intl;
2026-07-29 08:29:29 +00:00
obj = { guildName: null };
obj[0] = guildName;
2026-08-04 08:36:32 +00:00
formatToPlainStringResult = intl2.formatToPlainString(guildId(drawerOpen[24]).t.lzqe42, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-08-04 08:36:32 +00:00
const intl = guildId(drawerOpen[24]).intl;
2026-07-29 08:29:29 +00:00
obj = { guildName: null, mentions: null };
obj[0] = guildName;
obj[1] = tmp;
2026-08-04 08:36:32 +00:00
formatToPlainStringResult = intl.formatToPlainString(guildId(drawerOpen[24]).t["/uzRss"], obj);
2026-07-20 16:05:17 +00:00
}
}, items5);
2026-08-04 08:36:32 +00:00
const tmp15 = token(drawerOpen[27])(guildId, icon, asset);
2026-07-31 08:44:05 +00:00
const tmp16 = dragDropInProgress(guildId, flag);
2026-07-29 08:29:29 +00:00
isDragTarget = tmp16.isDragTarget;
dragDropInProgress = tmp16.dragDropInProgress;
({ dragState, overState, itemSize } = tmp16);
2026-07-23 10:11:24 +00:00
const guildsBarAnimatedWrapperStyles = obj1.useGuildsBarAnimatedWrapperStyles({ disableSelectedColor: true, disableBGColor: true });
2026-07-29 08:29:29 +00:00
const tmp5 = guildId;
2026-07-23 10:11:24 +00:00
const items6 = [isDragTarget];
2026-08-04 08:36:32 +00:00
stateFromStores1 = guildId(drawerOpen[19]).useStateFromStores(items6, () => isDragTarget.getGuildsTree().version);
2026-07-20 16:05:17 +00:00
const items7 = [guildId, stateFromStores1];
2026-07-23 10:11:24 +00:00
const memo2 = importAllResult.useMemo(() => {
2026-08-04 08:36:32 +00:00
const arr = token(drawerOpen[28])(items, stateFromStores1);
items = [...arr.map((label) => ({ name: label.label, label: label.label, action: label.action })), ...token(drawerOpen[29])(items, stateFromStores1).map((name) => ({ name: name.name, label: name.label, action: name.action }))];
const arr2 = token(drawerOpen[29])(items, stateFromStores1);
2026-07-20 16:05:17 +00:00
return {
accessibilityActions: items.map((name) => ({ name: name.name, label: name.label })),
onAccessibilityAction(arg0) {
2026-08-24 06:08:38 +00:00
items = arg0;
2026-07-23 10:11:24 +00:00
const found = items.find((name) => name.name === nativeEvent.nativeEvent.actionName);
2026-07-29 08:29:29 +00:00
if (found != null) {
const action = found.action;
if (action != null) {
action();
}
2026-07-20 16:05:17 +00:00
}
}
};
}, items7);
({ accessibilityActions, onAccessibilityAction } = memo2);
2026-08-04 08:36:32 +00:00
const obj6 = guildId(drawerOpen[19]);
sharedValue = guildId(drawerOpen[30]).useSharedValue(guildId);
class R {
2026-07-20 16:05:17 +00:00
constructor(arg0) {
value = dragDropInProgress.get();
if (value) {
2026-08-24 06:08:38 +00:00
tmp2 = closure_13;
2026-07-20 16:05:17 +00:00
tmp3 = guildId;
2026-08-24 06:08:38 +00:00
value = closure_13.get() === guildId;
2026-07-20 16:05:17 +00:00
}
if (value) {
tmp4 = isDragTarget;
value = !isDragTarget;
}
2026-07-29 08:29:29 +00:00
tmp6 = guildId;
2026-08-24 06:08:38 +00:00
tmp5 = closure_13;
2026-07-29 08:29:29 +00:00
if (guildId == null) {
tmp6 = null;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
result = closure_13.set(tmp6);
2026-07-20 16:05:17 +00:00
if (value) {
tmp8 = guildId;
2026-08-24 06:08:38 +00:00
tmp9 = closure_2;
obj = guildId(closure_2[31]);
tmp10 = closure_12;
2026-07-20 16:05:17 +00:00
str = "animate-always";
2026-08-24 06:08:38 +00:00
targetOriginY = obj.withSpring(guildId.targetOriginY, closure_12, "animate-always");
2026-07-20 16:05:17 +00:00
} else {
targetOriginY = guildId.targetOriginY;
}
2026-07-29 08:29:29 +00:00
obj = { originY: targetOriginY, height: null };
2026-07-20 16:05:17 +00:00
if (value) {
tmp11 = guildId;
2026-08-24 06:08:38 +00:00
tmp12 = closure_2;
obj3 = guildId(closure_2[31]);
tmp13 = closure_12;
2026-07-20 16:05:17 +00:00
str2 = "animate-always";
2026-08-24 06:08:38 +00:00
targetHeight = obj3.withSpring(guildId.targetHeight, closure_12, "animate-always");
2026-07-20 16:05:17 +00:00
} else {
targetHeight = guildId.targetHeight;
}
2026-07-29 08:29:29 +00:00
obj[1] = targetHeight;
obj1 = { originY: guildId.currentOriginY, height: guildId.currentHeight };
return { animations: obj, initialValues: obj1 };
2026-07-20 16:05:17 +00:00
}
}
2026-08-04 08:36:32 +00:00
obj = { dragDropInProgress, sharedId: sharedValue, guildId, isDragTarget, withSpring: guildId(drawerOpen[31]).withSpring, TRANSITION_PHYSICS: stateFromStores1 };
R.__closure = obj;
R.__workletHash = 14096669603718;
R.__initData = closure_18;
2026-07-20 16:05:17 +00:00
const items8 = [guildId, sharedValue, isDragTarget, dragDropInProgress];
2026-08-04 08:36:32 +00:00
const callback1 = importAllResult.useCallback(R, items8);
2026-07-29 08:29:29 +00:00
obj = { id: guildId, draggedItemSize: itemSize, accessibilityActions, onAccessibilityAction, cutouts: null, selected: null, isDragTarget: null, dragState: null, sharedId: null, circle: null, overState: null, unread: null, label: null, config: null, styles: null, isDragPreview: null, layout: null, externalChildren: null, expandedChildren: null, children: null };
let tmp23;
2026-08-04 08:36:32 +00:00
const obj7 = guildId(drawerOpen[30]);
2026-07-20 16:05:17 +00:00
if (!isDragTarget) {
2026-07-29 08:29:29 +00:00
tmp23 = cutouts;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[4] = tmp23;
obj[5] = selected;
obj[6] = isDragTarget;
obj[7] = dragState;
obj[8] = sharedValue;
let tmp24 = !tmp3;
if (!tmp3) {
let tmp25 = !selected;
if (!selected) {
tmp25 = !enableHome;
}
tmp24 = tmp25;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[9] = tmp24;
obj[10] = overState;
obj[11] = unread;
obj[12] = memo1;
obj[13] = memo;
obj[14] = guildsBarAnimatedWrapperStyles;
2026-07-20 16:05:17 +00:00
if (!flag) {
flag = isDragTarget;
}
2026-07-29 08:29:29 +00:00
obj[15] = flag;
obj[16] = callback1;
2026-07-20 16:05:17 +00:00
const items9 = [badgeTopRight, badgeBottomRight];
2026-08-04 08:36:32 +00:00
obj[17] = callback(closure_14, { children: items9 });
2026-07-29 08:29:29 +00:00
let tmp21Result;
2026-08-03 11:20:01 +00:00
if (enableHome) {
if (!flag2) {
obj1 = { guildId: null, onActiveHookChange: null };
obj1[0] = guildId;
obj1[1] = callback;
2026-08-04 08:36:32 +00:00
tmp21Result = tmp21(tmp(tmp2[18]), obj1);
2026-08-03 11:20:01 +00:00
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[18] = tmp21Result;
2026-07-20 16:05:17 +00:00
if (isUnavailable) {
2026-07-29 08:29:29 +00:00
obj2 = { source: null, style: null };
2026-08-04 08:36:32 +00:00
let tmpResult = tmp(tmp2[32]);
obj2[0] = tmp(tmp2[33]);
2026-07-29 08:29:29 +00:00
obj2[1] = tmp4.guildIcon;
tmp21Result = tmp21(tmpResult, obj2);
} else if (null != tmp15) {
obj3 = { source: null, style: null };
obj3[0] = tmp15;
obj3[1] = tmp4.guildIcon;
2026-08-04 08:36:32 +00:00
tmp21Result = tmp21(tmp(tmp2[32]), obj3);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj4 = { value: null, selected: null, animate: null, size: null };
obj4[0] = guildName;
obj4[1] = selected;
obj4[2] = selected;
2026-08-04 08:36:32 +00:00
tmpResult = tmp(tmp2[20]);
obj4[3] = tmp5(tmp2[20]).GuildIconSizes.LARGE;
2026-07-29 08:29:29 +00:00
tmp21Result = tmp21(tmpResult, obj4);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[19] = tmp21Result;
2026-08-04 08:36:32 +00:00
return closure_16(token(drawerOpen[15]), obj);
2026-07-20 16:05:17 +00:00
});
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/guilds_bar/native/GuildsBarGuild.tsx");
2026-07-20 16:05:17 +00:00
export default memoResult;