decord/alpha/source/modules/channel/usePrivateChannelWaveEligible.tsx
2026-10-09 10:00:15 +00:00

381 lines
11 KiB
TypeScript

// Module ID: 16383
// Function ID: 16384
// Name: usePrivateChannelWaveEligible
// Dependencies: [5429, 4719, 2071, 1085, 558, 576, 504, 11, 4752, 4661, 10349, 2]
// Module 16383 (usePrivateChannelWaveEligible)
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
import Constants from "Constants" /* 1085 */;
import ChannelConstants from "ChannelConstants" /* 2071 */;
import _modDef4661 from "module_4661" /* 4661 */;
import MessageStore from "MessageStore" /* 5429 */;
import RelationshipStore from "RelationshipStore" /* 4719 */;
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
let importDefault;
const ChannelFlags = ChannelConstants.ChannelFlags;
const MessageTypes = Constants.MessageTypes;
let c7 = 1814400000;
const tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function usePrivateChannelWaveEligible(isDM, arg1) {
let closure_1;
let tmp4;
const _require = isDM;
let tmp = _require;
const obj = require("react");
const cResult = obj.c(21);
if (cResult[0] !== isDM) {
let tmp5 = isDM.isDM() && !isDM.isSystemDM();
if (tmp5) {
const rawRecipients = isDM.rawRecipients;
tmp5 = !rawRecipients.some((bot) => bot.bot);
}
cResult[0] = isDM;
cResult[1] = tmp5;
tmp4 = tmp5;
} else {
tmp4 = cResult[1];
}
if (cResult[2] === isDM) {
let tmp6;
let tmp9;
let tmp11;
let tmp13;
let tmp14;
let tmp17;
let tmp18;
let tmp23;
let tmp24;
if (cResult[3] === tmp4) {
tmp6 = cResult[4];
}
importDefault = tmp6;
const _Symbol = Symbol;
if (cResult[5] === Symbol.for("react.memo_cache_sentinel")) {
const items = [RelationshipStore];
cResult[5] = items;
tmp9 = items;
} else {
tmp9 = cResult[5];
}
if (cResult[6] !== tmp6) {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
cResult[6] = tmp6;
cResult[7] = F;
tmp11 = F;
} else {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
}
const _Symbol2 = Symbol;
const tmpResult = tmp(504);
const stateFromStores = tmpResult.useStateFromStores(tmp9, tmp11);
if (cResult[8] === Symbol.for("react.memo_cache_sentinel")) {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
const items1 = [RelationshipStore];
cResult[8] = items1;
tmp13 = items1;
} else {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
}
if (cResult[9] !== tmp6) {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
cResult[9] = tmp6;
cResult[10] = tmp15;
tmp14 = tmp15;
} else {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
}
const _Symbol3 = Symbol;
const tmpResult6 = tmp(504);
const stateFromStores1 = tmpResult6.useStateFromStores(tmp13, tmp14);
if (cResult[11] === Symbol.for("react.memo_cache_sentinel")) {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
const items2 = [MessageStore];
cResult[11] = items2;
tmp17 = items2;
} else {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
}
if (cResult[12] !== isDM.id) {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
cResult[12] = isDM.id;
cResult[13] = tmp19;
tmp18 = tmp19;
} else {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
}
const tmpResult7 = tmp(504);
const stateFromStores2 = tmpResult7.useStateFromStores(tmp17, tmp18);
if (cResult[14] !== isDM) {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
cResult[14] = isDM;
cResult[15] = isDM.hasFlag(ChannelFlags.HAS_ONLY_SYSTEM_MESSAGES);
const hasFlagResult = isDM.hasFlag(ChannelFlags.HAS_ONLY_SYSTEM_MESSAGES);
} else {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
}
const _Symbol4 = Symbol;
if (cResult[16] === Symbol.for("react.memo_cache_sentinel")) {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
const items3 = [MessageStore];
cResult[16] = items3;
tmp23 = items3;
} else {
class F {
constructor() {
const isFriendResult = null != closure_1 && RelationshipStore.isFriend(tmp);
return isFriendResult;
}
}
}
if (cResult[17] !== isDM.id) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
cResult[17] = isDM.id;
cResult[18] = T;
tmp24 = T;
} else {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
}
const tmpResult8 = tmp(504);
const stateFromStores3 = tmpResult8.useStateFromStores(tmp23, tmp24);
if (cResult[19] !== isDM.id) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
const obj6 = SnowflakeUtilsDefault;
const extractTimestampResult = obj6.extractTimestamp(isDM.id);
const isWithinInterval = tmp(4752).isWithinInterval;
tmp(4752);
const tmp29 = _modDef4661();
cResult[19] = isDM.id;
cResult[20] = isWithinInterval(tmp29, _modDef4661(extractTimestampResult), c7);
const isWithinIntervalResult = isWithinInterval(tmp29, _modDef4661(extractTimestampResult), c7);
} else {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
}
const tmpResult10 = tmp(10349);
const strangerDangerWarning = tmpResult10.useStrangerDangerWarning(isDM.id);
if (tmp4) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
}
if (tmp4) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
}
if (tmp4) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
if (!tmp21) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
}
tmp4 = tmp21;
}
if (tmp4) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
}
if (tmp4) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
}
if (tmp4) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
tmp4 = null == strangerDangerWarning;
}
return tmp4;
}
if (tmp4) {
class T {
constructor() {
return MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id);
}
}
}
cResult[2] = isDM;
cResult[3] = tmp4;
cResult[4] = null;
tmp6 = tmp7;
}) : (function usePrivateChannelWaveEligible(isDM, arg1) {
const _require = isDM;
let tmp = isDM.isDM() && !isDM.isSystemDM();
if (tmp) {
const rawRecipients = isDM.rawRecipients;
tmp = !rawRecipients.some((bot) => bot.bot);
}
let recipientId = null;
if (tmp) {
recipientId = isDM.getRecipientId();
}
const items = [RelationshipStore];
const obj = require("get initialized");
const stateFromStores = obj.useStateFromStores(items, () => {
const isFriendResult = null != recipientId && RelationshipStore.isFriend(tmp);
return isFriendResult;
});
const items1 = [RelationshipStore];
const obj2 = require("get initialized");
const stateFromStores1 = obj2.useStateFromStores(items1, () => {
const isIgnoredResult = null != recipientId && RelationshipStore.isIgnored(tmp);
return isIgnoredResult;
});
const items2 = [MessageStore];
const obj3 = require("get initialized");
const stateFromStores2 = obj3.useStateFromStores(items2, () => {
const messages = MessageStore.getMessages(isDM.id);
let tmp = 1 === messages.length;
if (tmp) {
const firstResult = messages.first();
let type;
if (firstResult != null) {
type = firstResult.type;
}
tmp = type === MessageTypes.FRIEND_REQUEST_ACCEPTED;
}
return tmp;
});
let hasFlagResult = isDM.hasFlag(ChannelFlags.HAS_ONLY_SYSTEM_MESSAGES);
const items3 = [MessageStore];
const obj4 = require("get initialized");
const stateFromStores3 = obj4.useStateFromStores(items3, () => MessageStore.hasCurrentUserSentWaveBlockingMessage(isDM.id));
const obj5 = recipientId(11);
const extractTimestampResult = obj5.extractTimestamp(isDM.id);
const isWithinInterval = require("DateUtils").isWithinInterval;
require("DateUtils");
const tmp10 = recipientId(4661)();
const isWithinIntervalResult = isWithinInterval(tmp10, recipientId(4661)(extractTimestampResult), c7);
const obj6 = require("useStrangerDangerWarning");
const strangerDangerWarning = obj6.useStrangerDangerWarning(isDM.id);
if (tmp) {
tmp = stateFromStores;
}
if (tmp) {
tmp = !stateFromStores1;
}
if (tmp) {
if (!hasFlagResult) {
hasFlagResult = null == arg1;
}
if (!hasFlagResult) {
hasFlagResult = stateFromStores2;
}
tmp = hasFlagResult;
}
if (tmp) {
tmp = !stateFromStores3;
}
if (tmp) {
tmp = isWithinIntervalResult;
}
if (tmp) {
tmp = null == strangerDangerWarning;
}
return tmp;
});
const result = size.fileFinishedImporting("modules/channel/usePrivateChannelWaveEligible.tsx");
export const usePrivateChannelWaveEligible = tmp2;