decord/source/stores/RegionStore.tsx

100 lines
2.6 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 16159
// Function ID: 16160
2026-07-29 08:29:29 +00:00
// Name: initialize
2026-08-11 06:20:06 +00:00
// Dependencies: [1910, 12, 589, 709, 2]
2026-07-23 10:11:24 +00:00
2026-08-25 06:04:03 +00:00
// Module 16159 (initialize)
2026-08-24 06:08:38 +00:00
import applyDefault from "apply" /* 12 */;
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import closure_2 from "createGuildRecordFromRust" /* 1910 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
let c3 = null;
let closure_4 = {};
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class RegionStore extends Store {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = RegionStore.prototype;
prototype["initialize"] = function initialize() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_2);
2026-07-29 08:29:29 +00:00
};
prototype["getOptimalRegion"] = function getOptimalRegion(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const regions = this.getRegions(tmp);
let tmp2 = null;
if (null != regions) {
let found = regions.find((optimal) => optimal.optimal);
if (found == null) {
2026-08-24 06:08:38 +00:00
found = applyDefault.sample(regions);
const obj = applyDefault;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
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) {
2026-08-24 06:08:38 +00:00
sampleResult = applyDefault.sample(regions);
const obj = applyDefault;
2026-07-29 08:29:29 +00:00
}
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 = table[guildId];
} else {
tmp = c3;
}
return tmp;
};
RegionStore.displayName = "RegionStore";
2026-08-24 06:08:38 +00:00
const regionStore = new RegionStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
LOAD_REGIONS: function handleLoadRegions(regions) {
2026-08-24 06:08:38 +00:00
const sortByResult = applyDefault.sortBy(regions.regions, (name) => name.name);
2026-07-20 16:05:17 +00:00
if (null != regions.guildId) {
2026-07-29 08:29:29 +00:00
closure_4[regions.guildId] = sortByResult;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
c3 = sortByResult;
2026-07-20 16:05:17 +00:00
}
},
GUILD_DELETE: function handleDeleteGuild(arg0) {
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("stores/RegionStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default regionStore;