// Module ID: 5624 // Function ID: 5625 // Name: useMessageAuthor // Dependencies: [2064, 2124, 2118, 2086, 4719, 1390, 558, 38, 576, 504, 4923, 5625, 2] // Exports: getMessageAuthor // Module 5624 (useMessageAuthor) import _modDef38 from "module_38" /* 38 */; import get_initialized from "get initialized" /* 504 */; import react from "react" /* 576 */; import UserUtilsDefault from "UserUtils" /* 4923 */; import ChannelStore from "ChannelStore" /* 2064 */; import GuildMemberStore from "GuildMemberStore" /* 2124 */; import GuildRoleStore from "GuildRoleStore" /* 2118 */; import GuildStore from "GuildStore" /* 2086 */; import RelationshipStore from "RelationshipStore" /* 4719 */; import UserStore from "UserStore" /* 1390 */; import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */; import size from "module_2" /* 2 */; const require = globalThis.__r; let _require, c3, c4, dependencyMap; function useNullableMessageAuthor(message) { let c2; let guild; let stateFromStores6; let tmp26; let tmp58; let tmp59; let tmp62; let tmp64; let user; const tmp = closure_9; if (tmp) { let first; let tmp33; let tmp38; let closure_0 = message; const obj9 = react; const cResult = obj9.c(36); const _Symbol = Symbol; if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) { const items = [c3]; cResult[0] = items; first = items; } else { first = cResult[0]; } if (cResult[1] !== message) { const fn = function h() { let channel = null; if (null != closure_0) { channel = guild_id.getChannel(tmp.channel_id); } return channel; }; cResult[1] = message; cResult[2] = fn; tmp33 = fn; } else { tmp33 = cResult[2]; } const tmp27Result = get_initialized; const stateFromStores = tmp27Result.useStateFromStores(first, tmp33); let id; if (message != null) { const author = message.author; if (author != null) { id = author.id; } } let guild_id; if (stateFromStores != null) { guild_id = stateFromStores.guild_id; } const _Symbol2 = Symbol; if (cResult[3] === Symbol.for("react.memo_cache_sentinel")) { const items1 = [c4]; cResult[3] = items1; tmp38 = items1; } else { tmp38 = cResult[3]; } if (cResult[4] === guild_id) { let tmp40; let tmp42; let tmp45; let tmp44; let tmp52; let tmp54; let tmp53; let tmp57; if (cResult[5] === id) { tmp40 = cResult[6]; } const tmp27Result6 = get_initialized; const stateFromStores1 = tmp27Result6.useStateFromStores(tmp38, tmp40); const _Symbol3 = Symbol; if (cResult[7] === Symbol.for("react.memo_cache_sentinel")) { const items2 = [UserStore]; cResult[7] = items2; tmp42 = items2; } else { tmp42 = cResult[7]; } if (cResult[8] !== id) { class R { constructor() { return user.getUser(id); } } const items3 = [id]; cResult[8] = id; cResult[9] = R; cResult[10] = items3; tmp45 = items3; tmp44 = R; } else { class R { constructor() { return user.getUser(id); } } tmp45 = cResult[10]; } const tmp27Result7 = get_initialized; let stateFromStores2 = tmp27Result7.useStateFromStores(tmp42, tmp44, tmp45); const useName2 = stateFromStores6(4923).useName; stateFromStores6(4923); const tmp47 = stateFromStores6; if (message != null) { class R { constructor() { return user.getUser(id); } } } if (undefined) { class R { constructor() { return user.getUser(id); } } if (message != null) { class R { constructor() { return user.getUser(id); } } } stateFromStores2 = tmp50; } const name2 = useName2(stateFromStores2); const _Symbol4 = Symbol; if (cResult[11] === Symbol.for("react.memo_cache_sentinel")) { class R { constructor() { return user.getUser(id); } } const items4 = [GuildStore]; cResult[11] = items4; tmp52 = items4; } else { class R { constructor() { return user.getUser(id); } } } if (cResult[12] !== guild_id) { class F { constructor() { return guild.getGuild(guild_id); } } const items5 = [guild_id]; cResult[12] = guild_id; cResult[13] = F; cResult[14] = items5; tmp54 = items5; tmp53 = F; } else { class F { constructor() { return guild.getGuild(guild_id); } } tmp54 = cResult[14]; } const tmp27Result8 = get_initialized; const stateFromStores3 = tmp27Result8.useStateFromStores(tmp52, tmp53, tmp54); if (stateFromStores1 != null) { class F { constructor() { return guild.getGuild(guild_id); } } } c4 = tmp56; const _Symbol5 = Symbol; if (cResult[15] === Symbol.for("react.memo_cache_sentinel")) { class F { constructor() { return guild.getGuild(guild_id); } } const items6 = [GuildRoleStore]; cResult[15] = items6; tmp57 = items6; } else { class F { constructor() { return guild.getGuild(guild_id); } } } if (cResult[16] === guild_id) { let tmp61; class F { constructor() { return guild.getGuild(guild_id); } } const tmp27Result9 = get_initialized; const stateFromStores4 = tmp27Result9.useStateFromStores(tmp57, tmp58, tmp59); const _Symbol6 = Symbol; if (cResult[20] === Symbol.for("react.memo_cache_sentinel")) { class F { constructor() { return guild.getGuild(guild_id); } } const items7 = [RelationshipStore]; cResult[20] = items7; tmp61 = items7; } else { class F { constructor() { return guild.getGuild(guild_id); } } } if (cResult[21] === stateFromStores) { class F { constructor() { return guild.getGuild(guild_id); } } const tmp27Result10 = get_initialized; const stateFromStores5 = tmp27Result10.useStateFromStores(tmp61, tmp62); if (cResult[24] === guild_id) { class F { constructor() { return guild.getGuild(guild_id); } } const tmp65 = tmp47(5625)(tmp64); if (null != message) { class F { constructor() { return guild.getGuild(guild_id); } } const obj2 = { user: message.author, channel: stateFromStores, guild: stateFromStores3, memberColorRole: stateFromStores4, userName: name2, member: stateFromStores1, friendNickname: stateFromStores5, displayNameStyles: tmp65 }; cResult[27] = stateFromStores; cResult[28] = tmp65; cResult[29] = stateFromStores5; cResult[30] = stateFromStores3; cResult[31] = stateFromStores1; cResult[32] = stateFromStores4; cResult[33] = message.author; cResult[34] = name2; const tmp69 = computeMessageAuthor(obj2); class P { constructor() { role = undefined; if (null != guild_id) { if (null != c4) { role = role.getRole(tmp, tmp3); } } return role; } } cResult[35] = tmp69; } tmp26 = tmp66; } const obj3 = { userId: id, guildId: guild_id }; cResult[24] = guild_id; cResult[25] = id; cResult[26] = obj3; tmp64 = obj3; } const fn3 = function x() { nickname = null; if (null != id) { let isPrivateResult; const obj = stateFromStores; if (stateFromStores != null) { isPrivateResult = obj.isPrivate(); } nickname = null; if (isPrivateResult) { nickname = nickname.getNickname(tmp); } } return nickname; }; cResult[21] = stateFromStores; cResult[22] = id; cResult[23] = fn3; tmp62 = fn3; } class P { constructor() { role = undefined; if (null != guild_id) { if (null != c4) { role = role.getRole(tmp, tmp3); } } return role; } } const items8 = [guild_id, undefined]; cResult[16] = guild_id; cResult[17] = undefined; cResult[18] = P; cResult[19] = items8; tmp58 = P; tmp59 = items8; } const fn2 = function v() { let member = null; if (null != guild_id) { member = null; if (null != id) { member = _undefined.getMember(tmp, tmp3); } } return member; }; cResult[5] = id; cResult[6] = fn2; tmp40 = fn2; } else { class F { constructor() { return guild.getGuild(guild_id); } } const tmp3 = dependencyMap; let obj = get_initialized; const items9 = [c3]; stateFromStores6 = obj.useStateFromStores(items9, () => { let channel = null; if (null != _require) { channel = ChannelStore.getChannel(tmp.channel_id); } return channel; }); if (message != null) { class F { constructor() { return guild.getGuild(guild_id); } } if (tmp8 != null) { class F { constructor() { return guild.getGuild(guild_id); } } } } dependencyMap = tmp7; if (stateFromStores6 != null) { class F { constructor() { return guild.getGuild(guild_id); } } } c3 = tmp9; const items10 = [c4]; const tmp2Result = get_initialized; const stateFromStores7 = tmp2Result.useStateFromStores(items10, () => { let member = null; if (null != c3) { member = null; if (null != c2) { member = GuildMemberStore.getMember(tmp, tmp3); } } return member; }); const items11 = [UserStore]; const items12 = [undefined]; const tmp2Result5 = get_initialized; let stateFromStores8 = tmp2Result5.useStateFromStores(items11, () => UserStore.getUser(c2), items12); class P { constructor() { role = undefined; if (null != guild_id) { if (null != c4) { role = role.getRole(tmp, tmp3); } } return role; } } const useName = stateFromStores6(4923).useName; stateFromStores6(4923); if (message != null) { class F { constructor() { return guild.getGuild(guild_id); } } } if (undefined) { class F { constructor() { return guild.getGuild(guild_id); } } if (message != null) { class F { constructor() { return guild.getGuild(guild_id); } } } stateFromStores8 = tmp16; } const name = useName(stateFromStores8); const items13 = [GuildStore]; const items14 = [undefined]; const tmp2Result6 = get_initialized; const stateFromStores9 = tmp2Result6.useStateFromStores(items13, () => GuildStore.getGuild(c3), items14); if (stateFromStores7 != null) { class F { constructor() { return guild.getGuild(guild_id); } } } c4 = tmp20; const items15 = [GuildRoleStore]; const items16 = [undefined, undefined]; const tmp2Result7 = get_initialized; const stateFromStores10 = tmp2Result7.useStateFromStores(items15, () => { role = undefined; if (null != c3) { if (null != c4) { role = GuildRoleStore.getRole(tmp, tmp3); } } return role; }, items16); const items17 = [RelationshipStore]; const tmp2Result8 = get_initialized; const stateFromStores11 = tmp2Result8.useStateFromStores(items17, () => { nickname = null; if (null != c2) { let isPrivateResult; const obj = stateFromStores6; if (stateFromStores6 != null) { isPrivateResult = obj.isPrivate(); } nickname = null; if (isPrivateResult) { nickname = RelationshipStore.getNickname(tmp); } } return nickname; }); tmp26 = null; if (null != message) { class F { constructor() { return guild.getGuild(guild_id); } } const obj5 = { user: message.author, channel: stateFromStores6, guild: stateFromStores9, memberColorRole: stateFromStores10, userName: name, member: stateFromStores7, friendNickname: stateFromStores11, displayNameStyles: tmp25 }; tmp26 = computeMessageAuthor(obj5); } } return tmp26; } function getUserAuthor(user, channel) { let displayNameStyles; let id; if (user != null) { id = user.id; } let guild_id; if (channel != null) { guild_id = channel.guild_id; } let member = null; const guild = GuildStore.getGuild(guild_id); if (null != guild_id) { member = null; if (null != id) { member = GuildMemberStore.getMember(guild_id, id); } } let role; if (null != guild_id) { let colorRoleId; if (member != null) { colorRoleId = member.colorRoleId; } if (null != colorRoleId) { role = GuildRoleStore.getRole(guild_id, member.colorRoleId); } } let nickname = null; if (null != id) { nickname = null; if (null != channel) { nickname = null; if (channel.isPrivate()) { nickname = RelationshipStore.getNickname(id); } } } const obj = { user, channel, guild, memberColorRole: role, member, friendNickname: nickname, displayNameStyles }; displayNameStyles = undefined; const tmp11 = computeMessageAuthor; if (user != null) { displayNameStyles = user.displayNameStyles; } return tmp11(obj); } function computeMessageAuthor(channel) { let displayNameStyles; let friendNickname; let guild; let id2; let member; let memberColorRole; let name; let primaryGuild; let user; let userName; ({ user, guild, memberColorRole, member, userName, friendNickname, displayNameStyles } = channel); let str = "???"; channel = channel.channel; if (null != user) { if (userName == null) { const obj = UserUtilsDefault; userName = obj.getName(user); } str = userName; } let id; if (user != null) { id = user.id; } if (null != id) { let obj7; if (null != channel) { let id1; if (guild != null) { id1 = guild.id; } if (null == id1) { if (friendNickname == null) { friendNickname = str; } obj7 = { nick: friendNickname, colorString: null, colorStrings: null, displayNameStyles }; const obj3 = { nick: friendNickname, colorString: null, colorStrings: null, displayNameStyles }; } else if (null == member) { obj7 = { nick: str, colorString: null, colorStrings: null, displayNameStyles }; const obj4 = { nick: str, colorString: null, colorStrings: null, displayNameStyles }; } else { let nick = member.nick; if (nick == null) { nick = str; } obj7 = { nick, colorString: null, colorStrings: null, colorRoleName: name, colorRoleId: id2, iconRoleId: null, guildMemberAvatar: null, guildMemberAvatarDecoration: null, primaryGuild, guildId: guild.id, authorId: user.id, displayNameStyles }; ({ colorString: obj2.colorString, colorStrings: obj2.colorStrings } = member); name = undefined; if (memberColorRole != null) { name = memberColorRole.name; } id2 = undefined; if (memberColorRole != null) { id2 = memberColorRole.id; } ({ iconRoleId: obj2.iconRoleId, avatar: obj2.guildMemberAvatar, avatarDecoration: obj2.guildMemberAvatarDecoration } = member); primaryGuild = user.primaryGuild; } } return obj7; } obj7 = { nick: str, colorString: null, colorStrings: null, displayNameStyles }; } let ReactCompilerGating = ReactCompilerGating_mod; let tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useMessageNickAndColor(message, arg1) { let tmp = arg1; const tmp2 = useNullableMessageAuthor(message); _modDef38(null != tmp2, "Result cannot be null because the message is not null"); if (arg1 == null) { tmp = tmp2; } return tmp; }) : (function useMessageNickAndColor(message, arg1) { let tmp = arg1; const tmp2 = useNullableMessageAuthor(message); _modDef38(null != tmp2, "Result cannot be null because the message is not null"); if (arg1 == null) { tmp = tmp2; } return tmp; }); ReactCompilerGating = ReactCompilerGating_mod; let closure_9 = ReactCompilerGating.isReactCompilerEnabled(); ReactCompilerGating = ReactCompilerGating_mod; let tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? (function useUserNickAndColor(arg0, arg1) { const tmp = closure_11(arg0, arg1); _modDef38(null != tmp, "Result cannot be null because user and channel are not null"); return tmp; }) : (function useUserNickAndColor(arg0, arg1) { const tmp = closure_11(arg0, arg1); _modDef38(null != tmp, "Result cannot be null because user and channel are not null"); return tmp; }); ReactCompilerGating = ReactCompilerGating_mod; const tmp4 = ReactCompilerGating.isReactCompilerEnabled() ? (function useNullableUserAuthor(id, guild_id) { let first; _require = guild_id; const tmp = _require; let obj = require("react"); const cResult = obj.c(29); id = undefined; if (id != null) { id = id.id; } guild_id = undefined; if (guild_id != null) { guild_id = guild_id.guild_id; } if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) { const items = [GuildMemberStore]; cResult[0] = items; first = items; } else { first = cResult[0]; } if (cResult[1] === guild_id) { let tmp8; let tmp10; let tmp13; let tmp12; let tmp16; if (cResult[2] === id) { tmp8 = cResult[3]; } const tmpResult = tmp(guild_id[9]); const stateFromStores = tmpResult.useStateFromStores(first, tmp8); const _Symbol = Symbol; if (cResult[4] === Symbol.for("react.memo_cache_sentinel")) { const items1 = [GuildStore]; cResult[4] = items1; tmp10 = items1; } else { tmp10 = cResult[4]; } if (cResult[5] !== guild_id) { const fn = function y() { return GuildStore.getGuild(guild_id); }; const items2 = [guild_id]; cResult[5] = guild_id; cResult[6] = fn; cResult[7] = items2; tmp13 = items2; tmp12 = fn; } else { tmp12 = cResult[6]; tmp13 = cResult[7]; } const tmpResult4 = tmp(guild_id[9]); const stateFromStores1 = tmpResult4.useStateFromStores(tmp10, tmp12, tmp13); let colorRoleId; if (stateFromStores != null) { colorRoleId = stateFromStores.colorRoleId; } const _Symbol2 = Symbol; if (cResult[8] === Symbol.for("react.memo_cache_sentinel")) { const items3 = [GuildRoleStore]; cResult[8] = items3; tmp16 = items3; } else { tmp16 = cResult[8]; } if (cResult[9] === guild_id) { let tmp18; let tmp19; let tmp21; if (cResult[10] === colorRoleId) { tmp18 = cResult[11]; tmp19 = cResult[12]; } const tmpResult5 = tmp(guild_id[9]); const stateFromStores2 = tmpResult5.useStateFromStores(tmp16, tmp18, tmp19); const _Symbol3 = Symbol; if (cResult[13] === Symbol.for("react.memo_cache_sentinel")) { const items4 = [RelationshipStore]; cResult[13] = items4; tmp21 = items4; } else { tmp21 = cResult[13]; } if (cResult[14] === guild_id) { let tmp23; if (cResult[15] === id) { tmp23 = cResult[16]; } const tmpResult6 = tmp(guild_id[9]); const stateFromStores3 = tmpResult6.useStateFromStores(tmp21, tmp23); const obj6 = id(guild_id[10]); const name = obj6.useName(id); const tmp25 = id; if (cResult[17] === guild_id) { let tmp27; if (cResult[18] === id) { tmp27 = cResult[19]; } const tmp29 = tmp25(guild_id[11])(tmp27); if (cResult[20] === guild_id) { if (cResult[21] === tmp29) { if (cResult[22] === stateFromStores3) { if (cResult[23] === stateFromStores1) { if (cResult[24] === stateFromStores) { if (cResult[25] === stateFromStores2) { if (cResult[26] === id) { let tmp30; if (cResult[27] === name) { tmp30 = cResult[28]; } return tmp30; } } } } } } } const obj2 = { user: id, channel: guild_id, guild: null, memberColorRole: stateFromStores2, member: stateFromStores, userName: name, friendNickname: stateFromStores3, displayNameStyles: tmp29 }; class I { constructor() { let nickname = null; if (null != id) { let isPrivateResult; const obj = guild_id; if (guild_id != null) { isPrivateResult = obj.isPrivate(); } nickname = null; if (isPrivateResult) { nickname = RelationshipStore.getNickname(tmp); } } return nickname; } } const tmp32 = computeMessageAuthor(obj2); class R { constructor() { let role; if (null != guild_id) { if (null != colorRoleId) { role = GuildRoleStore.getRole(tmp, tmp3); } } return role; } } cResult[21] = tmp29; cResult[22] = stateFromStores3; class S { constructor() { let member = null; if (null != guild_id) { member = null; if (null != id) { member = GuildMemberStore.getMember(tmp, tmp3); } } return member; } } cResult[24] = stateFromStores; cResult[25] = stateFromStores2; cResult[26] = id; cResult[27] = name; cResult[28] = tmp32; tmp30 = tmp32; } class I { constructor() { let nickname = null; if (null != id) { let isPrivateResult; const obj = guild_id; if (guild_id != null) { isPrivateResult = obj.isPrivate(); } nickname = null; if (isPrivateResult) { nickname = RelationshipStore.getNickname(tmp); } } return nickname; } } tmp28[0] = id; tmp28[1] = guild_id; cResult[17] = guild_id; cResult[18] = id; cResult[19] = tmp28; class R { constructor() { let role; if (null != guild_id) { if (null != colorRoleId) { role = GuildRoleStore.getRole(tmp, tmp3); } } return role; } } } class I { constructor() { let nickname = null; if (null != id) { let isPrivateResult; const obj = guild_id; if (guild_id != null) { isPrivateResult = obj.isPrivate(); } nickname = null; if (isPrivateResult) { nickname = RelationshipStore.getNickname(tmp); } } return nickname; } } cResult[14] = guild_id; cResult[15] = id; cResult[16] = I; tmp23 = I; } class R { constructor() { let role; if (null != guild_id) { if (null != colorRoleId) { role = GuildRoleStore.getRole(tmp, tmp3); } } return role; } } const items5 = [guild_id, colorRoleId]; cResult[9] = guild_id; class S { constructor() { let member = null; if (null != guild_id) { member = null; if (null != id) { member = GuildMemberStore.getMember(tmp, tmp3); } } return member; } } cResult[10] = colorRoleId; cResult[11] = R; cResult[12] = items5; tmp19 = items5; tmp18 = R; } class S { constructor() { let member = null; if (null != guild_id) { member = null; if (null != id) { member = GuildMemberStore.getMember(tmp, tmp3); } } return member; } } cResult[1] = guild_id; cResult[2] = id; cResult[3] = S; tmp8 = S; }) : (function useNullableUserAuthor(id, channel) { _require = channel; id = undefined; if (id != null) { id = id.id; } let guild_id; if (channel != null) { guild_id = channel.guild_id; } const tmp3 = _require; let obj = require("get initialized"); const items = [GuildMemberStore]; const stateFromStores = obj.useStateFromStores(items, () => { let member = null; if (null != guild_id) { member = null; if (null != id) { member = GuildMemberStore.getMember(tmp, tmp3); } } return member; }); const items1 = [GuildStore]; const items2 = [guild_id]; let colorRoleId; const obj2 = require("get initialized"); const stateFromStores1 = obj2.useStateFromStores(items1, () => GuildStore.getGuild(guild_id), items2); if (stateFromStores != null) { colorRoleId = stateFromStores.colorRoleId; } const items3 = [GuildRoleStore]; const items4 = [guild_id, colorRoleId]; const tmp3Result = tmp3(guild_id[9]); const stateFromStores2 = tmp3Result.useStateFromStores(items3, () => { let role; if (null != guild_id) { if (null != colorRoleId) { role = GuildRoleStore.getRole(tmp, tmp3); } } return role; }, items4); const items5 = [RelationshipStore]; const tmp3Result2 = tmp3(guild_id[9]); const stateFromStores3 = tmp3Result2.useStateFromStores(items5, () => { let nickname = null; if (null != id) { let isPrivateResult; const obj = channel; if (channel != null) { isPrivateResult = obj.isPrivate(); } nickname = null; if (isPrivateResult) { nickname = RelationshipStore.getNickname(tmp); } } return nickname; }); const obj5 = id(guild_id[10]); const name = obj5.useName(id); const obj3 = { user: id, channel, guild: stateFromStores1, memberColorRole: stateFromStores2, member: stateFromStores, userName: name, friendNickname: stateFromStores3, displayNameStyles: id(guild_id[11])({ userId: id, guildId: guild_id }) }; return computeMessageAuthor(obj3); }); let closure_11 = tmp4; const result = size.fileFinishedImporting("modules/messages/useMessageAuthor.tsx"); export default tmp2; export { useNullableMessageAuthor }; export const getMessageAuthor = function getMessageAuthor(message) { return getUserAuthor(message.author, ChannelStore.getChannel(message.channel_id)); }; export const useUserNickAndColor = tmp3; export const useNullableUserAuthor = tmp4; export { getUserAuthor };