decord/source/stores/RegionStore.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

98 lines
2.5 KiB
TypeScript

// Module ID: 16907
// Function ID: 16908
// Name: RegionStore
// Dependencies: [1979, 12, 504, 573, 2]
// Module 16907 (RegionStore)
import _modDef12 from "module_12" /* 12 */;
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import GuildStore from "GuildStore" /* 1979 */;
let c3 = null;
let closure_4 = {};
const Store = initializeDefault.Store;
class RegionStore extends Store {
}
const prototype = RegionStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(GuildStore);
};
prototype["getOptimalRegion"] = function getOptimalRegion(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
}
const regions = this.getRegions(tmp);
let tmp2 = null;
if (null != regions) {
let found = regions.find((optimal) => optimal.optimal);
if (found == null) {
found = _modDef12.sample(regions);
}
tmp2 = found;
}
return tmp2;
};
prototype["getOptimalRegionId"] = function 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;
};
prototype["getRandomRegion"] = function getRandomRegion(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
}
const regions = this.getRegions(tmp);
let sampleResult = null;
if (null != regions) {
sampleResult = _modDef12.sample(regions);
}
return sampleResult;
};
prototype["getRandomRegionId"] = function 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;
};
prototype["getRegions"] = function getRegions(guildId) {
if (null != guildId) {
let tmp = closure_4[guildId];
} else {
tmp = c3;
}
return tmp;
};
RegionStore.displayName = "RegionStore";
const regionStore = new RegionStore(DispatcherDefault, {
LOAD_REGIONS: function handleLoadRegions(regions) {
const sortByResult = _modDef12.sortBy(regions.regions, (name) => name.name);
if (null != regions.guildId) {
closure_4[regions.guildId] = sortByResult;
} else {
c3 = sortByResult;
}
},
GUILD_DELETE: function handleDeleteGuild(arg0) {
delete tmp2[tmp];
}
});
const size = fn(2);
const result = size.fileFinishedImporting("stores/RegionStore.tsx");
export default regionStore;