decord/beta/source/stores/RegionStore.tsx

104 lines
2.5 KiB
TypeScript
Raw Normal View History

2026-10-02 13:37:24 +00:00
// Module ID: 16634
// Function ID: 16635
// Name: RegionStore
2026-10-02 13:37:24 +00:00
// Dependencies: [2073, 12, 504, 585, 2]
2026-10-02 13:37:24 +00:00
// Module 16634 (RegionStore)
import _modDef12 from "module_12" /* 12 */;
2026-10-01 14:13:23 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
2026-10-02 13:37:24 +00:00
import DispatcherDefault from "Dispatcher" /* 585 */;
import GuildStore from "GuildStore" /* 2073 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
let c3 = null;
2026-10-01 14:13:23 +00:00
const React3 = {};
const Store = get_initializedDefault.Store;
class RegionStore extends Store {
2026-10-01 14:13:23 +00:00
initialize() {
this.waitFor(GuildStore);
}
2026-10-01 14:13:23 +00:00
getOptimalRegion(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
}
2026-10-01 14:13:23 +00:00
const regions = this.getRegions(tmp);
let tmp2 = null;
if (null != regions) {
let found = regions.find((optimal) => optimal.optimal);
if (found == null) {
const obj = _modDef12;
found = obj.sample(regions);
}
tmp2 = found;
}
return tmp2;
}
2026-10-01 14:13:23 +00:00
getOptimalRegionId(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
}
const optimalRegion = this.getOptimalRegion(tmp);
let id = null;
if (null != optimalRegion) {
id = optimalRegion.id;
}
return id;
}
2026-10-01 14:13:23 +00:00
getRandomRegion(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
}
const regions = this.getRegions(tmp);
let sampleResult = null;
if (null != regions) {
const obj = _modDef12;
sampleResult = obj.sample(regions);
}
return sampleResult;
}
2026-10-01 14:13:23 +00:00
getRandomRegionId(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
}
const randomRegion = this.getRandomRegion(tmp);
let id = null;
if (null != randomRegion) {
id = randomRegion.id;
}
return id;
}
2026-10-01 14:13:23 +00:00
getRegions(guildId) {
let tmp;
if (null != guildId) {
tmp = closure_4[guildId];
} else {
tmp = c3;
}
return tmp;
}
2026-10-01 14:13:23 +00:00
}
const prototype = RegionStore.prototype;
RegionStore.displayName = "RegionStore";
2026-10-01 14:13:23 +00:00
let obj = {
LOAD_REGIONS: function handleLoadRegions(regions) {
2026-10-01 14:13:23 +00:00
const obj = _modDef12;
const sortByResult = obj.sortBy(regions.regions, (name) => name.name);
if (null != regions.guildId) {
closure_4[regions.guildId] = sortByResult;
} else {
c3 = sortByResult;
}
},
GUILD_DELETE: function handleDeleteGuild(arg0) {
2026-10-01 14:13:23 +00:00
delete closure_4[arg0.guild.id];
}
2026-10-01 14:13:23 +00:00
};
const regionStore = new RegionStore(DispatcherDefault, obj);
const result = size.fileFinishedImporting("stores/RegionStore.tsx");
export default regionStore;