81 lines
4.2 KiB
TypeScript
81 lines
4.2 KiB
TypeScript
/* Metro module 14063; source: modules/collectibles/native/hooks/useCardLayout.tsx; dependencies: [10020, 1478, 2] */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as CollectiblesShopCardV2Module from '../CollectiblesShopCardV2.tsx'; /* Metro dependency 10020 */
|
|
|
|
function _fun106622(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#106622, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14260:6, offset: 0x022e3144, size: 125 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const calculateTotalGaps_106623 = function(a0, a1) {
|
|
var COLLECTIBLES_SHOP_CARD_GAP = require(dependencyMap[0]).COLLECTIBLES_SHOP_CARD_GAP;
|
|
return a1 + COLLECTIBLES_SHOP_CARD_GAP * (a0 - 1);
|
|
};
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/collectibles/native/hooks/useCardLayout.tsx');
|
|
exports.useCardLayout = useCardLayout;
|
|
function calculateCardWidth_106624(a0, a1, a2) { // fn#106624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14260:184, offset: 0x01e79370, size: 34 bytes, params: 4, frame: 13
|
|
return (a1 - calculateTotalGaps_106623(a0, a2)) / a0;
|
|
}
|
|
|
|
function useCardLayout() { // fn#106625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14260:324, offset: 0x022e31f6, size: 539 bytes, params: 1, frame: 26
|
|
var r0;
|
|
var r32;
|
|
var r15;
|
|
var value11;
|
|
var value12;
|
|
const value2 = 1;
|
|
const width = importDefault(dependencyMap[value2])().width;
|
|
const r2 = width >= 320 ? 2 : value2;
|
|
const value4 = 2;
|
|
if (r2 < value4) {
|
|
return {columns: r2, cardWidth: undefined, rowWidth: undefined};
|
|
}
|
|
const r6 = width >= 768 ? 4 : value4;
|
|
const COLLECTIBLES_SHOP_CARD_WIDTH = (CollectiblesShopCardV2Module).COLLECTIBLES_SHOP_CARD_WIDTH;
|
|
const value6 = COLLECTIBLES_SHOP_CARD_WIDTH * r2;
|
|
const COLLECTIBLES_SHOP_CARD_GAP = (CollectiblesShopCardV2Module).COLLECTIBLES_SHOP_CARD_GAP;
|
|
const value7 = width - (value6 + COLLECTIBLES_SHOP_CARD_GAP * (r2 - value2));
|
|
const r3 = value7 < value4 * COLLECTIBLES_SHOP_CARD_GAP ? global.Math.max(4,
|
|
value7) : value4 * COLLECTIBLES_SHOP_CARD_GAP;
|
|
const value10 = calculateCardWidth_106624(r2, width, r3);
|
|
const COLLECTIBLES_SHOP_CARD_MAX_WIDTH = (CollectiblesShopCardV2Module).COLLECTIBLES_SHOP_CARD_MAX_WIDTH;
|
|
if (value10 > COLLECTIBLES_SHOP_CARD_MAX_WIDTH) {
|
|
if (r2 < r6) {
|
|
r0 = r2;
|
|
while (true) {
|
|
value11 = typeof r0 === 'bigint' ? r0 + 1n : +r0 + 1;
|
|
value12 = calculateCardWidth_106624(value11, width, r3);
|
|
if (!(value12 > COLLECTIBLES_SHOP_CARD_MAX_WIDTH)) {
|
|
r32 = value11;
|
|
r15 = value12;
|
|
break;
|
|
}
|
|
if (value11 < r6) {
|
|
r0 = value11;
|
|
continue;
|
|
}
|
|
r32 = value11;
|
|
r15 = value12;
|
|
break;
|
|
}
|
|
} else {
|
|
r32 = r2;
|
|
r15 = value10;
|
|
}
|
|
} else {
|
|
r32 = r2;
|
|
r15 = value10;
|
|
}
|
|
const Math = global.Math;
|
|
const min = Math.min;
|
|
const Math2 = global.Math;
|
|
const value14 = Reflect.apply(min, Math, [Math2.max(r15, COLLECTIBLES_SHOP_CARD_WIDTH),
|
|
COLLECTIBLES_SHOP_CARD_MAX_WIDTH]);
|
|
return value14 * r32 + calculateTotalGaps_106623(r32, r3) > width && r32 > value2 ? {columns: value2,
|
|
cardWidth: undefined, rowWidth: undefined} : {columns: r32, cardWidth: value14,
|
|
rowWidth: value14 * r32 + COLLECTIBLES_SHOP_CARD_GAP * (r32 - value2) + r3};
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun106622, 14063, [10020, 1478, 2]) /* metro module 14063, dependencies: [10020, 1478, 2] */;
|