得物.apk(点击下载) / g.java


package t81;

import a.f;
import android.text.TextUtils;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.common.utils.TimeRecorder;
import com.shizhuang.duapp.modules.rafflev2.installment.dataconvert.ComponentItem;
import com.shizhuang.duapp.modules.rafflev2.installment.dataconvert.ComponentModule;
import com.shizhuang.duapp.modules.rafflev2.installment.dataconvert.IComponentParser;
import com.shizhuang.duapp.modules.rafflev2.installment.dataconvert.IJsonParser;
import com.shizhuang.duapp.modules.rafflev2.installment.models.HLComponentItemModel;
import com.shizhuang.duapp.modules.rafflev2.installment.models.HLComponentModel;
import com.shizhuang.duapp.modules.rafflev2.installment.models.HlComponentPathModel;
import com.shizhuang.duapp.modules.rafflev2.installment.models.InstalmentHomeListModel;
import com.shizhuang.duapp.modules.rafflev2.installment.models.TabModel;
import df.b0;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt__IterablesKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import nd.e;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/* compiled from: InstallmentComponentEngine.kt */
public final class g {
    @NotNull

    /* renamed from: a  reason: collision with root package name */
    public static final g f38383a = new g();
    public static ChangeQuickRedirect changeQuickRedirect;
    @NotNull
    private static final f factory;

    static {
        f fVar = new f("");
        factory = fVar;
        e.b(fVar);
    }

    @NotNull
    public final InstalmentHomeListModel a(@NotNull String str, boolean z, @Nullable String str2) {
        ArrayList arrayList;
        IComponentParser iComponentParser;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, new Byte(z ? (byte) 1 : 0), null}, this, changeQuickRedirect, false, 309867, new Class[]{String.class, Boolean.TYPE, String.class}, InstalmentHomeListModel.class);
        if (proxy.isSupported) {
            return (InstalmentHomeListModel) proxy.result;
        }
        f fVar = factory;
        PatchProxyResult proxy2 = PatchProxy.proxy(new Object[]{str, null}, fVar, f.changeQuickRedirect, false, 309863, new Class[]{String.class, String.class}, InstalmentHomeListModel.class);
        if (proxy2.isSupported) {
            return (InstalmentHomeListModel) proxy2.result;
        }
        TimeRecorder.a("InstallmentComponentDataFactory#parse");
        ArrayList arrayList2 = new ArrayList();
        IJsonParser a5 = i.f38384a.a(str);
        synchronized (fVar.a()) {
            arrayList = new ArrayList(fVar.a());
        }
        Iterator it2 = arrayList.iterator();
        while (it2.hasNext()) {
            ComponentModule componentModule = (ComponentModule) it2.next();
            if (!(componentModule == null || (iComponentParser = fVar.b().get(componentModule.getName())) == null)) {
                Object parse = iComponentParser.parse(a5, componentModule);
                if (parse instanceof List) {
                    arrayList2.addAll((List) parse);
                } else if (parse != null) {
                    arrayList2.add(parse);
                }
            }
        }
        String str3 = (String) a5.getValue("ruleUrl", String.class);
        if (str3 == null) {
            str3 = "";
        }
        List list = a5.getList("tabs", TabModel.class);
        if (list == null) {
            list = CollectionsKt__CollectionsKt.emptyList();
        }
        InstalmentHomeListModel instalmentHomeListModel = new InstalmentHomeListModel(str3, arrayList2, list);
        StringBuilder h12 = f.h("thread name: ");
        h12.append(Thread.currentThread().getName());
        TimeRecorder.d("InstallmentComponentDataFactory#parse", h12.toString());
        return instalmentHomeListModel;
    }

    public final void b(@Nullable HLComponentModel hLComponentModel) {
        HLComponentModel hLComponentModel2;
        List<ComponentModule> list;
        List<ComponentModule> list2;
        List<HLComponentItemModel> components;
        List<HLComponentItemModel> filterNotNull;
        ComponentModule componentModule;
        ArrayList arrayList;
        if (!PatchProxy.proxy(new Object[]{hLComponentModel}, this, changeQuickRedirect, false, 309865, new Class[]{HLComponentModel.class}, Void.TYPE).isSupported) {
            if (hLComponentModel == null) {
                PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 309866, new Class[0], HLComponentModel.class);
                if (proxy.isSupported) {
                    hLComponentModel2 = (HLComponentModel) proxy.result;
                } else {
                    String str = (String) b0.f("installment_layout", "");
                    hLComponentModel2 = !TextUtils.isEmpty(str) ? (HLComponentModel) e.f(str, HLComponentModel.class) : null;
                }
            } else {
                b0.l("installment_layout", e.n(hLComponentModel));
                hLComponentModel2 = hLComponentModel;
            }
            if (hLComponentModel2 == null || (components = hLComponentModel2.getComponents()) == null || (filterNotNull = CollectionsKt___CollectionsKt.filterNotNull(components)) == null) {
                list = null;
            } else {
                ArrayList arrayList2 = new ArrayList();
                for (HLComponentItemModel hLComponentItemModel : filterNotNull) {
                    if (hLComponentItemModel.getName() != null) {
                        String name = hLComponentItemModel.getName();
                        List<HlComponentPathModel> data = hLComponentItemModel.getData();
                        if (data != null) {
                            arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(data, 10));
                            Iterator<T> it2 = data.iterator();
                            while (it2.hasNext()) {
                                T next = it2.next();
                                arrayList.add(new ComponentItem(next != null ? next.getModel() : null, next != null ? next.getPath() : null));
                            }
                        } else {
                            arrayList = null;
                        }
                        String style = hLComponentItemModel.getStyle();
                        if (style == null) {
                            style = null;
                        }
                        componentModule = new ComponentModule(name, arrayList, style);
                    } else {
                        componentModule = null;
                    }
                    if (componentModule != null) {
                        arrayList2.add(componentModule);
                    }
                }
                list = CollectionsKt___CollectionsKt.toMutableList((Collection) arrayList2);
            }
            if (list == null || list.isEmpty()) {
                f fVar = factory;
                PatchProxyResult proxy2 = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 309868, new Class[0], List.class);
                if (proxy2.isSupported) {
                    list2 = (List) proxy2.result;
                } else {
                    list2 = CollectionsKt__CollectionsKt.listOf((Object[]) new ComponentModule[]{new ComponentModule("seprator_bar", null, "{\n\t\t\t\t\"color\": \"#FFFFFF\",\n\t\t\t\t\"backgroundImg\": \"https://apk.poizon.com/duApp/Android_Config/Assets/resouces/d01376522cfd05afa3674689e8f62405.png\",\n\t\t\t\t\"height\": 108\n\t\t\t}", 2, null), e.a("bannerLayout", "banner", "banner", null, 8), new ComponentModule("seprator_bar", null, "{\n\t\t\t\t\"color\": \"#FFFFFF\",\n\t\t\t\t\"height\": 16\n\t\t\t}", 2, null), e.a("stagingList", "stagingList", "stagingList", null, 8), new ComponentModule("seprator_bar", null, "{\n\t\t\t\t\"color\": \"#FFFFFF\",\n\t\t\t\t\"height\": 30\n\t\t\t}", 2, null), e.a("instalment", "instalment", "instalment", null, 8), new ComponentModule("seprator_bar", null, "{\n\t\t\t\t\"color\": \"#FFFFFF\",\n\t\t\t\t\"height\": 22\n\t\t\t}", 2, null)});
                }
                fVar.d(list2);
                return;
            }
            factory.d(list);
        }
    }
}