244 lines
9.9 KiB
TypeScript
244 lines
9.9 KiB
TypeScript
/* Metro module 9313; source: modules/guild_profile/hooks/useGuildProfileGames.tsx; dependencies: [31, 5200, 5199, 1226, 566, 5198, 1360, 2] */
|
|
function _fun72754(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#72754, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:6, offset: 0x01d5235d, size: 204 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_72757 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const closure = useAllGuildProfileGames;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importAll(31) /* metro dependency 31 */;
|
|
const gameRecord = importDefault(5200) /* metro dependency 5200: GameRecord */;
|
|
const gameStore = importDefault(5199) /* metro dependency 5199: GameStore */;
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_profile/hooks/useGuildProfileGames.tsx');
|
|
exports.default = useGuildProfileGames;
|
|
exports.useAllGuildProfileGames = closure;
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_72755(a0, a1) { // fn#72755, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:141, offset: 0x01d52429, size: 372 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun72756;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_72757(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_72757(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_72757(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun72756;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
}
|
|
|
|
function useAllGuildProfileGames(a0) { // fn#72758, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:1051, offset: 0x01d5259d, size: 180 bytes, params: 2, frame: 21
|
|
const env0_0 = a0;
|
|
const games = a0.games;
|
|
(require(5198) /* metro dependency 5198: useGame */).useGames(games == null || (require(566) /* metro dependency 566: flux */).useStateFromStores([AuthenticationStore],
|
|
function() {
|
|
return AuthenticationStore.isAuthenticated();
|
|
}) ? a0.gameApplicationIds : []);
|
|
const env0_1 = useFallbackGameRecords(games);
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([GameStore], _fun72762);
|
|
}
|
|
|
|
function useGuildProfileGames(a0) { // fn#72764, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:1691, offset: 0x01d52793, size: 180 bytes, params: 2, frame: 17
|
|
var object2;
|
|
const value3 = env0_2.useMemo(_fun72765, [useAllGuildProfileGames(a0), a0.gameActivity]);
|
|
var env0_2 = value3;
|
|
object2 = {};
|
|
object2.gamesToDisplay = env0_2.useMemo(_fun72768, [value3]);
|
|
object2.lastGameToDisplay = env0_2.useMemo(_fun72769, [value3]);
|
|
object2.remainingGames = env0_2.useMemo(_fun72770, [value3]);
|
|
return object2;
|
|
}
|
|
|
|
function useFallbackGameRecords(a0) { // fn#72760, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:1222, owner: useAllGuildProfileGames.useFallbackGameRecords, offset: 0x01d52664, size: 44 bytes, params: 2, frame: 14
|
|
const env0_0 = a0;
|
|
return env1_2.useMemo(_fun72761, [a0]);
|
|
}
|
|
|
|
function _fun72762() { // fn#72762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:1477, offset: 0x01d5271a, size: 75 bytes, params: 1, frame: 13
|
|
const value = env0_0.gameApplicationIds.map(_fun72763);
|
|
return value.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
|
|
}
|
|
|
|
function _fun72765() { // fn#72765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:1787, offset: 0x01d52847, size: 53 bytes, params: 1, frame: 14
|
|
const gameActivityBinding = gameActivity;
|
|
const value2 = ((a0) => {
|
|
var env0_0 = a0;
|
|
return _fun72767;
|
|
})(gameActivityBinding);
|
|
const binding = env0_1;
|
|
const items2 = [];
|
|
arraySpread(items2, binding, 0, gameActivityBinding);
|
|
return items2.sort(value2);
|
|
}
|
|
|
|
function _fun72768() { // fn#72768, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:2040, offset: 0x01d528f5, size: 25 bytes, params: 1, frame: 13
|
|
return env0_2.slice(0, 5);
|
|
}
|
|
|
|
function _fun72769() { // fn#72769, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:2092, offset: 0x01d5290e, size: 28 bytes, params: 1, frame: 3
|
|
const property = env0_2[5];
|
|
const value = null;
|
|
return value != property ? property : value;
|
|
}
|
|
|
|
function _fun72770() { // fn#72770, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:2165, offset: 0x01d5292a, size: 22 bytes, params: 1, frame: 11
|
|
return env0_2.slice(5);
|
|
}
|
|
|
|
function _fun72761() { // fn#72761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:1275, offset: 0x01d52690, size: 138 bytes, params: 1, frame: 19
|
|
var r2;
|
|
var value6;
|
|
var set;
|
|
var id;
|
|
var value7;
|
|
var gameRecord;
|
|
var value8;
|
|
var value9;
|
|
const Map = global.Map;
|
|
let prototype = Map.prototype;
|
|
let value = Object.create(prototype, {constructor: {value: Map}});
|
|
const map = new Map();
|
|
value = map instanceof Object ? map : value;
|
|
if (env0_0 != null) {
|
|
var value4 = _createForOfIteratorHelperLoose_72755(env0_0);
|
|
var value5 = value4();
|
|
var done = value5.done;
|
|
if (!done) {
|
|
r2 = value5;
|
|
reducibleLoop2: while (true) {
|
|
value6 = r2.value;
|
|
set = value.set;
|
|
id = value6.id;
|
|
prototype = GameRecord.prototype;
|
|
value7 = Object.create(prototype, {constructor: {value: GameRecord}});
|
|
gameRecord = new GameRecord();
|
|
value8 = gameRecord instanceof Object ? gameRecord : value7;
|
|
Reflect.apply(set, value, [id, value8]);
|
|
value9 = value4();
|
|
done = value9.done;
|
|
if (done) {
|
|
break reducibleLoop2;
|
|
}
|
|
r2 = value9;
|
|
continue reducibleLoop2;
|
|
}
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
|
|
function _fun72763(a0) { // fn#72763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:1507, offset: 0x01d52765, size: 46 bytes, params: 2, frame: 12
|
|
var r0;
|
|
let value = environment.__proto__.__proto__;
|
|
value = GameStore.getGame(a0);
|
|
if (value != null) {
|
|
r0 = value;
|
|
} else {
|
|
value = environment.__proto__;
|
|
value = env1_1.get(a0);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function gameActivitySorter(a0) { // fn#72766, offset: 0x01d5287c, size: 18 bytes, params: 2, frame: 2
|
|
const env0_0 = a0;
|
|
return _fun72767;
|
|
}
|
|
|
|
function _fun72767({id}, {id}) { // fn#72767, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9499:1835, offset: 0x01d5288e, size: 103 bytes, params: 3, frame: 7
|
|
const r2 = env0_0[id]?.score ?? 0;
|
|
const r1 = env0_0[id]?.score ?? 0;
|
|
return r2 === r1 ? 0 : r1 - r2;
|
|
}
|
|
|