// Module ID: 13343 // Function ID: 13344 // Name: useAppDMChatInputState // Dependencies: [19, 9248, 5440, 7321, 2022, 1390, 1085, 1998, 558, 576, 504, 8312, 584, 6858, 2] // Module 13343 (useAppDMChatInputState) import DispatcherDefault from "Dispatcher" /* 584 */; import Constants from "Constants" /* 1085 */; import Server from "Server" /* 1998 */; import maybeFetchUserProfileDefault from "maybeFetchUserProfile" /* 8312 */; import ApplicationCommandIndexStore from "ApplicationCommandIndexStore" /* 9248 */; import react from "react" /* 19 */; import ApplicationStore from "ApplicationStore" /* 5440 */; import UserProfileStore from "UserProfileStore" /* 7321 */; import ApplicationRecord from "ApplicationRecord" /* 2022 */; import UserStore from "UserStore" /* 1390 */; import ReactCompilerGating from "ReactCompilerGating" /* 558 */; import size from "module_2" /* 2 */; const require = globalThis.__r; let user; const useQueryState = ApplicationCommandIndexStore.useQueryState; const EMPTY_STRING_SNOWFLAKE_ID = Constants.EMPTY_STRING_SNOWFLAKE_ID; let items = [Server.ApplicationCommandType.PRIMARY_ENTRY_POINT, Server.ApplicationCommandType.CHAT, Server.ApplicationCommandType.MESSAGE, Server.ApplicationCommandType.USER]; let tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useAppDMChatInputState(context) { let _require; let tmp13; let tmp16; let tmp18; let tmp45; let tmp9; const tmp = _require; let tmp2 = dependencyMap; let obj = require("react"); const cResult = obj.c(32); const channel = context.context.channel; let tmp4 = null; if (null != channel) { tmp4 = null; if (true === channel.isDM()) { let tmp5; if (cResult[0] !== channel) { user = UserStore.getUser(channel.getRecipientId()); cResult[0] = channel; cResult[1] = user; tmp5 = user; } else { tmp5 = cResult[1]; } let tmp8 = null; if (undefined !== tmp5) { tmp8 = null; if (true === tmp5.bot) { tmp8 = tmp5; } } tmp4 = tmp8; } } _require = tmp4; if (cResult[2] === Symbol.for("react.memo_cache_sentinel")) { items = [ApplicationStore]; cResult[2] = items; tmp9 = items; } else { tmp9 = cResult[2]; } let id; const tmp11 = cResult[3]; if (tmp4 != null) { id = tmp4.id; } if (tmp11 !== id) { let id1; if (tmp4 != null) { id1 = tmp4.id; } class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } cResult[3] = id1; cResult[4] = M; tmp13 = M; } else { tmp13 = cResult[4]; } const tmpResult = tmp(504); const stateFromStores = tmpResult.useStateFromStores(tmp9, tmp13); if (cResult[5] === Symbol.for("react.memo_cache_sentinel")) { const items1 = []; class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } cResult[5] = items1; tmp16 = items1; } else { tmp16 = cResult[5]; } if (cResult[6] !== tmp4) { class E { constructor() { let tmp2; if (null !== user) { let id; const getUserProfile = UserProfileStore.getUserProfile; if (user != null) { id = tmp.id; } const userProfile = getUserProfile(id); let application; if (userProfile != null) { application = userProfile.application; } tmp2 = application; } return tmp2; } } class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } cResult[7] = E; tmp18 = E; } else { class E { constructor() { let tmp2; if (null !== user) { let id; const getUserProfile = UserProfileStore.getUserProfile; if (user != null) { id = tmp.id; } const userProfile = getUserProfile(id); let application; if (userProfile != null) { application = userProfile.application; } tmp2 = application; } return tmp2; } } } const tmpResult2 = tmp(504); const stateFromStores1 = tmpResult2.useStateFromStores(tmp16, tmp18); if (stateFromStores == null) { class E { constructor() { let tmp2; if (null !== user) { let id; const getUserProfile = UserProfileStore.getUserProfile; if (user != null) { id = tmp.id; } const userProfile = getUserProfile(id); let application; if (userProfile != null) { application = userProfile.application; } tmp2 = application; } return tmp2; } } if (stateFromStores1 != null) { class E { constructor() { let tmp2; if (null !== user) { let id; const getUserProfile = UserProfileStore.getUserProfile; if (user != null) { id = tmp.id; } const userProfile = getUserProfile(id); let application; if (userProfile != null) { application = userProfile.application; } tmp2 = application; } return tmp2; } } } class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } } if (cResult[8] === stateFromStores) { class E { constructor() { let tmp2; if (null !== user) { let id; const getUserProfile = UserProfileStore.getUserProfile; if (user != null) { id = tmp.id; } const userProfile = getUserProfile(id); let application; if (userProfile != null) { application = userProfile.application; } tmp2 = application; } return tmp2; } } const tmp20 = cResult[9]; class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } if (tmp20 === tmp21) { class E { constructor() { let tmp2; if (null !== user) { let id; const getUserProfile = UserProfileStore.getUserProfile; if (user != null) { id = tmp.id; } const userProfile = getUserProfile(id); let application; if (userProfile != null) { application = userProfile.application; } tmp2 = application; } return tmp2; } } } if (cResult[11] === stateFromStores) { let tmp23; let tmp25; class E { constructor() { let tmp2; if (null !== user) { let id; const getUserProfile = UserProfileStore.getUserProfile; if (user != null) { id = tmp.id; } const userProfile = getUserProfile(id); let application; if (userProfile != null) { application = userProfile.application; } tmp2 = application; } return tmp2; } } const obj4 = react; class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } if (cResult[14] !== tmp4) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } cResult[15] = D; tmp23 = D; } else { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } if (tmp4 != null) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } if (cResult[16] !== undefined) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } tmp26[0] = undefined; class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } cResult[16] = undefined; cResult[17] = tmp26; tmp25 = tmp26; } else { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } const effect = obj4.useEffect(tmp23, tmp25); if (cResult[18] !== channel) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } tmp29[0] = channel; class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } cResult[18] = channel; cResult[19] = tmp29; } else { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } const _Symbol = Symbol; if (cResult[20] === Symbol.for("react.memo_cache_sentinel")) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } cResult[20] = tmp31; } else { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } if (tmp4 != null) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } if (cResult[21] === stateFromStores) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } if (cResult[24] === stateFromStores) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } if (cResult[27] !== tmp38) { let fromServer; class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } if (null != tmp38) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } fromServer = ApplicationRecord.createFromServer(tmp38); } class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } cResult[27] = tmp38; cResult[28] = fromServer; } else { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } class M { constructor() { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (user != null) { id = user.id; } return getAppIdForBotUserId(id); } } const useGetOrFetchApplication = tmp43.useGetOrFetchApplication; if (null == tmp41) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } if (tmp41 == null) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } if (tmp41 == null) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } if (tmp4 != null) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } if (undefined == null) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } if (cResult[29] === tmp41) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } return tmp45; } let obj2 = { application: tmp41, isAppDM: undefined }; cResult[29] = tmp41; cResult[30] = undefined; cResult[31] = obj2; tmp45 = obj2; } const descriptors = tmp37.descriptors; const found = descriptors.find((application) => { application = application.application; let id; if (application != null) { id = application.id; } return id === stateFromStores; }); if (found != null) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } cResult[24] = stateFromStores; cResult[25] = tmp37.descriptors; cResult[26] = undefined; } const obj3 = { applicationId: stateFromStores, allowFetch: null != undefined, allowApplicationState: true }; cResult[21] = stateFromStores; cResult[22] = null != undefined; cResult[23] = obj3; } const items2 = [tmp4, stateFromStores]; cResult[11] = stateFromStores; cResult[12] = tmp4; cResult[13] = items2; } cResult[8] = stateFromStores; if (tmp4 != null) { class D { constructor() { let id; if (user != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: user.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } } } } const fn = function b() { if (null == stateFromStores) { let id; const tmp3 = maybeFetchUserProfileDefault; if (user != null) { id = user.id; } if (id == null) { id = EMPTY_STRING_SNOWFLAKE_ID; } tmp3(id, undefined, { withMutualGuilds: true }); } }; cResult[9] = undefined; cResult[10] = fn; }) : (function useAppDMChatInputState(context) { let flag; let id2; let tmp16; let stateFromStores; let application; const channel = context.context.channel; let obj = application; items = [channel]; const memo = application.useMemo(() => { if (null != channel) { if (true === channel.isDM()) { user = UserStore.getUser(obj.getRecipientId()); let tmp3 = null; if (undefined !== user) { tmp3 = null; if (true === user.bot) { tmp3 = user; } } return tmp3; } } return null; }, items); let tmp2 = channel; let tmp3 = stateFromStores; let obj2 = channel(stateFromStores[10]); const items1 = [ApplicationStore]; stateFromStores = obj2.useStateFromStores(items1, () => { let id; const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId; if (memo != null) { id = memo.id; } return getAppIdForBotUserId(id); }); const items2 = [UserProfileStore]; const obj3 = channel(stateFromStores[10]); const stateFromStores1 = obj3.useStateFromStores(items2, () => { let tmp2; if (null !== memo) { let id; const getUserProfile = UserProfileStore.getUserProfile; if (memo != null) { id = tmp.id; } const userProfile = getUserProfile(id); application = undefined; if (userProfile != null) { application = userProfile.application; } tmp2 = application; } return tmp2; }); if (stateFromStores == null) { let id; if (stateFromStores1 != null) { id = stateFromStores1.id; } stateFromStores = id; } const items3 = [memo, stateFromStores]; const effect = obj.useEffect(() => { if (null == stateFromStores) { let id; const tmp3 = maybeFetchUserProfileDefault; if (memo != null) { id = memo.id; } if (id == null) { id = EMPTY_STRING_SNOWFLAKE_ID; } tmp3(id, undefined, { withMutualGuilds: true }); } }, items3); let id1; const useEffect = obj.useEffect; if (memo != null) { id1 = memo.id; } const items4 = [id1]; const effect1 = useEffect(() => { let id; if (memo != null) { id = tmp.id; } if (null != id) { const obj2 = { type: "APP_DM_OPEN", botUserId: memo.id }; const obj = DispatcherDefault; obj.dispatch(obj2); } }, items4); const obj5 = { applicationId: stateFromStores, allowFetch: null != id2, allowApplicationState: true }; id2 = undefined; const obj4 = { commandTypes: items }; const tmp10 = useQueryState; if (memo != null) { id2 = memo.id; } const descriptors = tmp10({ channel, type: "channel" }, obj4, obj5).descriptors; const found = descriptors.find((application) => { application = application.application; let id; if (application != null) { id = application.id; } return id === stateFromStores; }); application = undefined; if (found != null) { application = found.application; } const items5 = [application]; let memo1 = obj.useMemo(() => { let fromServer; if (null != application) { fromServer = ApplicationRecord.createFromServer(tmp); } return fromServer; }, items5); const useGetOrFetchApplication = tmp2(tmp3[13]).useGetOrFetchApplication; tmp2(tmp3[13]); if (null == memo1) { tmp16 = stateFromStores; } if (memo1 == null) { memo1 = useGetOrFetchApplication(tmp16); } const obj6 = { application: memo1, isAppDM: flag }; flag = undefined; if (memo != null) { flag = memo.bot; } if (flag == null) { flag = false; } return obj6; }); const result = size.fileFinishedImporting("modules/app_dms/useAppDMChatInputState.tsx"); export default tmp2;