decord/beta/source/modules/collectibles/hooks/useRecommendedCollectiblesSections.tsx
2026-10-12 16:32:48 +00:00

172 lines
5.1 KiB
TypeScript

// Module ID: 13469
// Function ID: 13470
// Name: useRecommendedCollectiblesSections
// Dependencies: [19, 13470, 558, 576, 13471, 6170, 13472, 2]
// Module 13469 (useRecommendedCollectiblesSections)
import react from "react" /* 19 */;
import useInitialValueDefault from "useInitialValue" /* 6170 */;
import CollectiblesRecommendationUtils from "CollectiblesRecommendationUtils" /* 13472 */;
import CollectiblesRecommendationStore from "CollectiblesRecommendationStore" /* 13470 */;
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
let _require, dependencyMap, importDefault;
let useMemo = react.useMemo;
let closure_5 = [];
let tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useRecommendedCollectiblesSections(arr, arg1) {
let closure_0;
let tmp4;
_require = arg1;
let tmp = arr;
let obj = require("react");
const cResult = obj.c(9);
let obj2 = require("EditProfileCollectiblesOrderingExperiment");
const isEditProfileCollectiblesOrderingEnabled = obj2.useIsEditProfileCollectiblesOrderingEnabled("collectibles_picker");
if (cResult[0] !== isEditProfileCollectiblesOrderingEnabled) {
const fn = function n() {
let tmp2;
const tmp = isEditProfileCollectiblesOrderingEnabled;
if (tmp) {
const recommendations = CollectiblesRecommendationStore.getRecommendations();
let skuIds;
if (recommendations != null) {
skuIds = recommendations.skuIds;
}
if (skuIds == null) {
skuIds = closure_5;
}
tmp2 = skuIds;
} else {
tmp2 = closure_5;
}
return tmp2;
};
cResult[0] = isEditProfileCollectiblesOrderingEnabled;
cResult[1] = fn;
tmp4 = fn;
} else {
tmp4 = cResult[1];
}
arr = isEditProfileCollectiblesOrderingEnabled(tmp[5])(tmp4);
let tmp5 = arr;
if (0 !== arr.length) {
let tmp6;
if (cResult[2] === arg1) {
if (cResult[3] === arr) {
if (cResult[4] === arr) {
tmp6 = cResult[5];
}
tmp5 = tmp6;
}
}
if (cResult[6] === arg1) {
let tmp7;
if (cResult[7] === arr) {
tmp7 = cResult[8];
}
const mapped = arr.map(tmp7);
class C {
constructor(section) {
if (section.section !== closure_0) {
return section;
} else {
const obj = CollectiblesRecommendationUtils;
const result = obj.reorderCollectiblesByRecommendation(section.items, arr);
let tmp5 = section;
if (result !== section.items) {
const obj2 = { items: result };
const merged = Object.assign(section);
tmp5 = obj2;
}
return tmp5;
}
}
}
cResult[2] = arg1;
cResult[3] = arr;
cResult[4] = arr;
cResult[5] = mapped;
tmp6 = mapped;
}
class C {
constructor(section) {
if (section.section !== closure_0) {
return section;
} else {
const obj = CollectiblesRecommendationUtils;
const result = obj.reorderCollectiblesByRecommendation(section.items, arr);
let tmp5 = section;
if (result !== section.items) {
const obj2 = { items: result };
const merged = Object.assign(section);
tmp5 = obj2;
}
return tmp5;
}
}
}
cResult[6] = arg1;
cResult[7] = arr;
cResult[8] = C;
tmp7 = C;
}
return tmp5;
}) : (function useRecommendedCollectiblesSections(arg0, arg1) {
let closure_0;
let closure_1;
let closure_2;
let length;
_require = arg0;
importDefault = arg1;
let obj = require("EditProfileCollectiblesOrderingExperiment");
dependencyMap = obj.useIsEditProfileCollectiblesOrderingEnabled("collectibles_picker");
let tmp = useInitialValueDefault(() => {
let tmp2;
const tmp = closure_2;
if (tmp) {
const recommendations = CollectiblesRecommendationStore.getRecommendations();
let skuIds;
if (recommendations != null) {
skuIds = recommendations.skuIds;
}
if (skuIds == null) {
skuIds = closure_5;
}
tmp2 = skuIds;
} else {
tmp2 = closure_5;
}
return tmp2;
});
useMemo = tmp;
const items = [arg1, tmp, arg0];
return useMemo(() => {
let mapped;
if (0 === length.length) {
mapped = closure_0;
} else {
mapped = closure_0.map((section) => {
if (section.section !== closure_1_1) {
return section;
} else {
const obj = closure_0(closure_2[6]);
const result = obj.reorderCollectiblesByRecommendation(section.items, length);
let tmp5 = section;
if (result !== section.items) {
const obj2 = { items: result };
const merged = Object.assign(section);
tmp5 = obj2;
}
return tmp5;
}
});
}
return mapped;
}, items);
});
let result = size.fileFinishedImporting("modules/collectibles/hooks/useRecommendedCollectiblesSections.tsx");
export default tmp2;