// Metro module 5802 (f5803). import AvatarDecorationRecord from "./AvatarDecorationRecord"; import NameplateRecord from "./NameplateRecord"; import ProfileEffectRecord from "./ProfileEffectRecord"; import ProfileFrameRecord from "./ProfileFrameRecord"; import UnknownCollectiblesItemRecord from "./UnknownCollectiblesItemRecord"; import { SKUProductLines, SKUTypes } from "../../../Constants"; import { CollectiblesItemType } from "../../../_bundle/Module1901"; let transformSKUToCollectiblesItem; export function createCollectiblesItemsFromServerResponse(a0) { return a0 == null ? [] : a0.reduce((acc, item) => { const type = item.type; if (CollectiblesItemType.AVATAR_DECORATION === type) { acc.push(AvatarDecorationRecord.fromServer(item)); } else if (CollectiblesItemType.NAMEPLATE === type) { acc.push(NameplateRecord.fromServer(item)); } else if (CollectiblesItemType.PROFILE_EFFECT === type) { acc.push(ProfileEffectRecord.fromServer(item)); } else if (CollectiblesItemType.PROFILE_FRAME === type) { acc.push(ProfileFrameRecord.fromServer(item)); } else { acc.push(UnknownCollectiblesItemRecord.fromServer(item)); } return acc; }, []); } transformSKUToCollectiblesItem = function transformSKUToCollectiblesItem(a0) { if (a0.productLine === SKUProductLines.COLLECTIBLES) { if (a0.type === SKUTypes.BUNDLE) { const items = []; let bundledSkus = a0.bundledSkus; if (bundledSkus == null) { bundledSkus = []; } for (const item of bundledSkus) { const r115 = transformSKUToCollectiblesItem(item); if (r115?.type === "single") { items.push(r115.item); } } if (items.length === 0) { return void 0; } let previewAssetPaths = a0.previewAssetPaths; if (previewAssetPaths == null) { previewAssetPaths = void 0; } return { type: "bundle", items, previewAssets: previewAssetPaths }; } const item2 = a0.tenantMetadata?.collectibles?.item; if (item2 != null) { const type = item2.type; if (CollectiblesItemType.AVATAR_DECORATION === type) { return { type: "single", item: new AvatarDecorationRecord({ skuId: a0.id, type: item2.type, asset: item2.asset, label: item2.label }) }; } if (CollectiblesItemType.NAMEPLATE === type) { return { type: "single", item: new NameplateRecord({ skuId: a0.id, type: item2.type, asset: item2.asset, label: item2.label, palette: item2.palette }) }; } if (CollectiblesItemType.PROFILE_EFFECT === type) { let effects = item2.effects; if (effects == null) { effects = []; } return { type: "single", item: new ProfileEffectRecord({ skuId: a0.id, type: item2.type, title: item2.title, description: item2.description, thumbnailPreviewSrc: item2.thumbnailPreviewSrc, reducedMotionSrc: item2.reducedMotionSrc, effects, accessibilityLabel: item2.accessibilityLabel, animationType: item2.animationType, staticFrameSrc: item2.staticFrameSrc }) }; } if (CollectiblesItemType.PROFILE_FRAME === type) { return { type: "single", item: new ProfileFrameRecord({ skuId: a0.id, type: item2.type, label: item2.label, layers: item2.layers, innerWidth: item2.innerWidth, overflowTop: item2.overflowTop, overflowBottom: item2.overflowBottom, overflowHorizontal: item2.overflowHorizontal }) }; } return void 0; } } }; export { transformSKUToCollectiblesItem };