decord/source/modules/channel/VoiceChannelAnimationStateStore.tsx
2026-07-29 08:29:29 +00:00

254 lines
7.1 KiB
TypeScript

// Module ID: 12739
// Function ID: 12740
// Name: resetAllState
// Dependencies: [32, 4006, 4205, 589, 709, 2]
// Module 12739 (resetAllState)
import _slicedToArray from "_slicedToArray";
import handleConnectionOpen from "handleConnectionOpen";
import updateVoiceState from "updateVoiceState";
import { Store } from "initialize";
function resetAllState() {
(function clearAllTimers() {
const keys = Object.keys(table);
for (const item10009 of keys) {
let _clearTimeout = clearTimeout;
let tmp2 = table;
let clearTimeoutResult = clearTimeout(table[item10009]);
continue;
}
table = {};
})();
let closure_4 = {};
}
function updateChannelAnimationState(arg0, arg1) {
let num;
if (dependencyMap[arg0] != null) {
num = tmp4.userCount;
}
if (num == null) {
num = 0;
}
const bound = Math.max(0, num + arg1);
if (0 === num) {
if (bound > 0) {
let obj = { style: null, userCount: null };
obj[0] = obj.GENTLE_AMBIENT_WITH_INTRO;
obj[1] = bound;
dependencyMap[arg0] = obj;
let _slicedToArray = arg0;
if (null != dependencyMap2[arg0]) {
const _clearTimeout3 = clearTimeout;
clearTimeout(dependencyMap2[arg0]);
delete tmp3[tmp2];
}
const _setTimeout2 = setTimeout;
dependencyMap2[arg0] = setTimeout(() => {
if (null != outer1_4[_slicedToArray]) {
const obj = {};
const merged = Object.assign(tmp4);
obj.style = outer1_3.GENTLE_AMBIENT;
outer1_4[tmp3] = obj;
outer1_9.emitChange();
}
delete tmp[tmp2];
}, 2000);
let flag = true;
}
return flag;
}
if (num > 0) {
if (bound > num) {
obj = { style: null, userCount: null };
obj[0] = obj.HIGH_CONTRAST;
obj[1] = bound;
dependencyMap[arg0] = obj;
_slicedToArray = arg0;
if (null != dependencyMap2[arg0]) {
const _clearTimeout2 = clearTimeout;
clearTimeout(dependencyMap2[arg0]);
delete tmp3[tmp2];
}
const _setTimeout = setTimeout;
dependencyMap2[arg0] = setTimeout(() => {
if (null != outer1_4[_slicedToArray]) {
const obj = {};
const merged = Object.assign(tmp4);
obj.style = outer1_3.GENTLE_AMBIENT;
outer1_4[tmp3] = obj;
outer1_9.emitChange();
}
delete tmp[tmp2];
}, 2000);
flag = true;
}
}
if (0 === bound) {
if (null != dependencyMap2[arg0]) {
const _clearTimeout = clearTimeout;
clearTimeout(dependencyMap2[arg0]);
delete tmp[tmp2];
}
delete tmp[tmp2];
flag = true;
} else {
flag = null != tmp4 && bound !== num;
if (flag) {
obj = {};
let merged = Object.assign(tmp4);
obj.userCount = bound;
dependencyMap[arg0] = obj;
flag = true;
}
}
}
function handleConnectionOpenOrLogout() {
(function clearAllTimers() {
const keys = Object.keys(table);
for (const item10009 of keys) {
let _clearTimeout = clearTimeout;
let tmp2 = table;
let clearTimeoutResult = clearTimeout(table[item10009]);
continue;
}
table = {};
})();
let closure_4 = {};
return true;
}
let obj = { GENTLE_AMBIENT: "GENTLE_AMBIENT", GENTLE_AMBIENT_WITH_INTRO: "GENTLE_AMBIENT_WITH_INTRO", HIGH_CONTRAST: "HIGH_CONTRAST" };
let closure_4 = {};
let closure_5 = {};
let c6 = null;
class VoiceChannelAnimationStateStoreClass extends Store {
}
const prototype = VoiceChannelAnimationStateStoreClass.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(updateVoiceState, handleConnectionOpen);
};
prototype["getAnimationStyle"] = function getAnimationStyle(arg0) {
let style;
if (dependencyMap[arg0] != null) {
style = tmp.style;
}
if (style == null) {
style = obj.GENTLE_AMBIENT;
}
return style;
};
prototype["getUserCount"] = function getUserCount(arg0) {
let num;
if (dependencyMap[arg0] != null) {
num = tmp.userCount;
}
if (num == null) {
num = 0;
}
return num;
};
VoiceChannelAnimationStateStoreClass.displayName = "VoiceChannelAnimationStateStore";
obj = {
VOICE_STATE_UPDATES: function handleVoiceStateUpdates(arg0) {
guildId = guildId.getGuildId();
let tmp2 = guildId !== guildId;
if (tmp2) {
tmp2 = null != guildId;
}
const obj = {};
const iter = arg0.voiceStates[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp5 = nextResult;
if (nextResult.guildId === guildId) {
let tmp6 = nextResult;
if (null != tmp5.oldChannelId) {
let tmp7 = nextResult;
let num = obj[tmp5.oldChannelId];
if (num == null) {
num = 0;
}
obj[tmp5.oldChannelId] = num - 1;
}
let tmp8 = nextResult;
if (null != tmp5.channelId) {
let tmp9 = nextResult;
let num2 = obj[tmp5.channelId];
if (num2 == null) {
num2 = 0;
}
obj[tmp5.channelId] = num2 + 1;
}
}
continue;
}
let flag = false;
const entries = Object.entries(obj);
while (tmp11 !== undefined) {
let tmp13 = callback;
let tmp14 = callback(tmp12, 2);
let tmp15 = updateChannelAnimationState;
if (updateChannelAnimationState(tmp14[0], tmp14[1])) {
flag = true;
}
continue;
}
return flag;
},
CHANNEL_SELECT: function handleChannelSelect(guildId) {
let tmp14;
let tmp15;
guildId = guildId.guildId;
if (guildId === guildId) {
return false;
} else if (null == guildId) {
return false;
} else {
resetAllState();
let obj = {};
const _Object2 = Object;
const values = Object.values(voiceStates.getVoiceStates(guildId));
const iter = values[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp4 = nextResult;
if (null != nextResult.channelId) {
let tmp5 = nextResult;
let num = obj[tmp4.channelId];
if (num == null) {
num = 0;
}
obj[tmp4.channelId] = num + 1;
}
continue;
}
const _Object = Object;
const entries = Object.entries(obj);
const tmp8 = entries[Symbol.iterator]();
while (tmp8 !== undefined) {
let tmp12 = callback;
let tmp13 = callback(tmp10, 2);
[tmp14, tmp15] = tmp13;
if (tmp15 > 0) {
let tmp17 = closure_4;
let tmp18 = tmp14;
obj = { style: null, userCount: null };
let tmp19 = obj;
obj[0] = obj.GENTLE_AMBIENT;
let tmp20 = tmp15;
obj[1] = tmp16;
closure_4[tmp14] = obj;
}
continue;
}
return true;
}
},
CONNECTION_OPEN: handleConnectionOpenOrLogout,
LOGOUT: handleConnectionOpenOrLogout
};
const voiceChannelAnimationStateStoreClass = new VoiceChannelAnimationStateStoreClass(require("dispatcher"), obj);
const result = require("updateVoiceState").fileFinishedImporting("modules/channel/VoiceChannelAnimationStateStore.tsx");
export default voiceChannelAnimationStateStoreClass;
export const AnimationStyle = obj;