decord/source/modules/guild_profile/hooks/useGuildProfileGames.tsx

203 lines
5.9 KiB
TypeScript
Raw Normal View History

2026-07-24 07:16:23 +00:00
// Module ID: 11907
// Function ID: 92173
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-24 07:16:23 +00:00
// Dependencies: [31, 4152, 4151, 1194, 566, 6864, 1327, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-24 07:16:23 +00:00
// Module 11907 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import result from "result";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_4 from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
const require = arg1;
function _createForOfIteratorHelperLoose(iterable) {
let closure_0 = iterable;
iterable = "undefined" !== typeof Symbol;
if (iterable) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol;
2026-07-23 10:11:24 +00:00
iterable = iterable[Symbol.iterator];
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (!iterable) {
iterable = iterable[Symbol.iterator];
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (iterable) {
const iter = iterable.call(iterable);
2026-07-20 16:05:17 +00:00
const next = iter.next;
return next.bind(iter);
} else {
const _Array = Array;
2026-07-23 10:11:24 +00:00
let tmp = iterable;
if (!Array.isArray(iterable)) {
2026-07-20 16:05:17 +00:00
let tmp2;
2026-07-23 10:11:24 +00:00
if (iterable) {
if ("string" === typeof iterable) {
tmp2 = _arrayLikeToArray(iterable, undefined);
2026-07-20 16:05:17 +00:00
} else {
const toString = {}.toString;
2026-07-23 10:11:24 +00:00
const substr = toString.call(iterable).slice(8, -1);
2026-07-20 16:05:17 +00:00
let name = substr;
if (tmp3) {
2026-07-23 10:11:24 +00:00
name = iterable.constructor.name;
2026-07-20 16:05:17 +00:00
}
if ("Map" !== name) {
if ("Set" !== name) {
if ("Arguments" === name) {
2026-07-23 10:11:24 +00:00
let arr = _arrayLikeToArray(iterable, undefined);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/;
2026-07-20 16:05:17 +00:00
}
}
tmp2 = arr;
}
const _Array2 = Array;
2026-07-23 10:11:24 +00:00
arr = Array.from(iterable);
const callResult = toString.call(iterable);
tmp3 = "Object" === substr && iterable.constructor;
2026-07-20 16:05:17 +00:00
}
}
tmp = tmp2;
if (!tmp2) {
const _TypeError = TypeError;
const typeError = new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
throw typeError;
}
}
if (tmp) {
2026-07-23 10:11:24 +00:00
closure_0 = tmp;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c1 = 0;
2026-07-20 16:05:17 +00:00
return () => {
2026-07-23 10:11:24 +00:00
if (closure_1 >= length.length) {
2026-07-20 16:05:17 +00:00
let obj = { done: true };
} else {
obj = { done: false };
closure_1 = tmp3 + 1;
2026-07-23 10:11:24 +00:00
obj.value = length[+closure_1];
2026-07-20 16:05:17 +00:00
}
return obj;
};
}
}
function _arrayLikeToArray(arg0, arg1) {
let length;
if (tmp) {
length = arg0.length;
}
const ArrayResult = Array(length);
for (let num = 0; num < length; num = num + 1) {
ArrayResult[num] = arg0[num];
}
return ArrayResult;
}
function useAllGuildProfileGames(profile) {
2026-07-23 10:11:24 +00:00
const _require = profile;
2026-07-20 16:05:17 +00:00
const games = profile.games;
2026-07-23 10:11:24 +00:00
let items = [closure_5];
const stateFromStores = _require(566).useStateFromStores(items, () => outer1_5.isAuthenticated());
2026-07-24 07:16:23 +00:00
_require(6864);
2026-07-20 16:05:17 +00:00
if (null != games) {
if (!stateFromStores) {
let items1 = [];
}
tmp3(items1);
2026-07-23 10:11:24 +00:00
const dependencyMap = (function useFallbackGameRecords(games) {
let closure_0 = games;
2026-07-20 16:05:17 +00:00
const items = [games];
2026-07-23 10:11:24 +00:00
return outer1_2.useMemo(() => {
2026-07-20 16:05:17 +00:00
let done;
const map = new Map();
2026-07-23 10:11:24 +00:00
if (null == closure_0) {
2026-07-20 16:05:17 +00:00
return map;
} else {
2026-07-23 10:11:24 +00:00
const tmp3 = outer2_6(closure_0);
2026-07-20 16:05:17 +00:00
let iter = tmp3();
if (!iter.done) {
do {
let value = iter.value;
2026-07-23 10:11:24 +00:00
let tmp4 = outer2_3;
let prototype = outer2_3.prototype;
2026-07-20 16:05:17 +00:00
let tmp5 = new.target;
let tmp6 = new.target;
let tmp7 = value;
2026-07-23 10:11:24 +00:00
let tmp8 = new outer2_3(value);
2026-07-20 16:05:17 +00:00
let tmp9 = tmp8;
let result = map.set(value.id, tmp8);
let iter2 = tmp3();
iter = iter2;
done = iter2.done;
} while (!done);
}
return map;
}
}, items);
2026-07-23 10:11:24 +00:00
})(games);
2026-07-20 16:05:17 +00:00
const items2 = [closure_4];
2026-07-23 10:11:24 +00:00
return _require(566).useStateFromStoresArray(items2, () => {
const gameApplicationIds = profile.gameApplicationIds;
2026-07-20 16:05:17 +00:00
const mapped = gameApplicationIds.map((arg0) => {
2026-07-23 10:11:24 +00:00
let game = outer2_4.getGame(arg0);
2026-07-20 16:05:17 +00:00
if (null == game) {
2026-07-23 10:11:24 +00:00
game = outer1_1.get(arg0);
2026-07-20 16:05:17 +00:00
}
return game;
});
2026-07-23 10:11:24 +00:00
return mapped.filter(profile(table[6]).isNotNullish);
2026-07-20 16:05:17 +00:00
});
}
items1 = profile.gameApplicationIds;
}
2026-07-23 10:11:24 +00:00
let result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/guild_profile/hooks/useGuildProfileGames.tsx");
2026-07-20 16:05:17 +00:00
export default function useGuildProfileGames(gameActivity) {
gameActivity = gameActivity.gameActivity;
const tmp = useAllGuildProfileGames(gameActivity);
const dependencyMap = tmp;
2026-07-23 10:11:24 +00:00
let items = [tmp, gameActivity];
memo = memo.useMemo(() => {
2026-07-20 16:05:17 +00:00
const items = [];
2026-07-23 10:11:24 +00:00
HermesBuiltin.arraySpread(closure_1, 0);
return items.sort((function gameActivitySorter(gameActivity) {
let closure_0 = gameActivity;
2026-07-20 16:05:17 +00:00
return (arg0, arg1) => {
let score;
2026-07-23 10:11:24 +00:00
if (null != gameActivity[arg0.id]) {
2026-07-20 16:05:17 +00:00
score = tmp.score;
}
let num = 0;
if (null != score) {
num = score;
}
let score1;
2026-07-23 10:11:24 +00:00
if (null != gameActivity[arg1.id]) {
2026-07-20 16:05:17 +00:00
score1 = tmp3.score;
}
let num2 = 0;
if (null != score1) {
num2 = score1;
}
let num3 = 0;
if (num !== num2) {
num3 = num2 - num;
}
return num3;
};
2026-07-23 10:11:24 +00:00
})(gameActivity));
2026-07-20 16:05:17 +00:00
}, items);
const items1 = [memo];
const items2 = [memo];
const items3 = [memo];
return {
2026-07-23 10:11:24 +00:00
gamesToDisplay: memo.useMemo(() => memo.slice(0, 5), items1),
lastGameToDisplay: memo.useMemo(() => {
2026-07-20 16:05:17 +00:00
let tmp2 = null;
if (null != memo[5]) {
tmp2 = tmp;
}
return tmp2;
}, items2),
2026-07-23 10:11:24 +00:00
remainingGames: memo.useMemo(() => memo.slice(5), items3)
2026-07-20 16:05:17 +00:00
};
};
export { useAllGuildProfileGames };