package o; import android.text.TextUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import o.PRA; /* loaded from: classes.dex */ public final class PcD extends C0619KuQ { private C13967fkM a; private int e; private int d = 0; private int c = 2; @InterfaceC13391fZD public PcD(C13967fkM c13967fkM, String str) { this.e = 0; this.a = c13967fkM; try { this.e = Integer.parseInt(str); } catch (Exception e) { guQ.e(e, "not able to parse tile version as Integer", new Object[0]); } } public final List c(List list, String str) { if (list == null) { return null; } ArrayList arrayList = new ArrayList(); YKU yku = new YKU(list); List list2 = (List) new YKU(yku.a, new C17745zRk(yku.b, xNZ.a(new sYu()))).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8())); for (int i = 0; i < list2.size(); i++) { arrayList.add(b(list.get(i), str, arrayList.size())); } return arrayList; } public final C13245fUx c(final Ben ben, final String str, EnumC17751zVK enumC17751zVK, EnumC17751zVK enumC17751zVK2, EnumC17751zVK enumC17751zVK3, EnumC17751zVK enumC17751zVK4) { List list; ArrayList arrayList = null; if (ben == null) { EQY c = EQY.c(); c.i = new ArrayList(); return new C13245fUx(null, c); } if (ben.a != null) { arrayList = new ArrayList(); for (int i = 0; i < ben.a.size(); i++) { arrayList.add(b(ben.a.get(i), str, arrayList.size())); } } ArrayList arrayList2 = arrayList; this.c = ben.g; final ArrayList arrayList3 = new ArrayList(); if (enumC17751zVK != EnumC17751zVK.SUCCESS) { if (enumC17751zVK == EnumC17751zVK.LOADING) { arrayList3.add(uxC.b().c(AyW.LOADING).a(arrayList3.size()).f(2)); arrayList3.add(uxC.b().c(AyW.SCB).a(arrayList3.size())); } else if (enumC17751zVK == EnumC17751zVK.ERROR) { arrayList3.add(uxC.b().c(AyW.ERROR).a(arrayList3.size()).f(2)); arrayList3.add(uxC.b().c(AyW.SCB).a(arrayList3.size())); } } else { YKU yku = new YKU(ben.b); List list2 = (List) new YKU(yku.a, new C17745zRk(yku.b, xNZ.a(new sYu()))).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8())); if (list2.isEmpty()) { arrayList3.add(uxC.b().c(AyW.SCB).f(3).a(arrayList3.size())); } else if (list2.size() == 1) { arrayList3.add(b((C17104tuu) list2.get(0), str, arrayList3.size()).f(2)); arrayList3.add(uxC.b().c(AyW.SCB).a(arrayList3.size())); } else if (list2.size() == 2) { arrayList3.add(b((C17104tuu) list2.get(0), str, arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(1), str, arrayList3.size())); arrayList3.add(uxC.b().c(AyW.SCB).a(arrayList3.size())); } else if (list2.size() == 3) { arrayList3.add(b((C17104tuu) list2.get(0), str, arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(1), str, arrayList3.size())); arrayList3.add(uxC.b().c(AyW.SCB).a(arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(2), str, arrayList3.size()).f(3)); } else if (list2.size() == 4) { arrayList3.add(b((C17104tuu) list2.get(0), str, arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(1), str, arrayList3.size())); arrayList3.add(uxC.b().c(AyW.SCB).a(arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(2), str, arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(3), str, arrayList3.size()).f(2)); } else if (list2.size() == 5) { arrayList3.add(b((C17104tuu) list2.get(0), str, arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(1), str, arrayList3.size())); arrayList3.add(uxC.b().c(AyW.SCB).a(arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(2), str, arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(3), str, arrayList3.size())); arrayList3.add(b((C17104tuu) list2.get(4), str, arrayList3.size())); } } if (enumC17751zVK2 != EnumC17751zVK.SUCCESS || enumC17751zVK != EnumC17751zVK.SUCCESS) { if (enumC17751zVK2 == EnumC17751zVK.LOADING) { arrayList3.add(uxC.b().c(AyW.PREDICTIVE_TILE_LOADING).a(this.c + 1).f(3)); } } else if (ben.i != null) { this.d = ben.h; YKU yku2 = new YKU(ben.i); final List list3 = (List) new YKU(yku2.a, new C17745zRk(yku2.b, xNZ.a(new sYu()))).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8())); final int size = arrayList3.size(); rgl a = rgl.a(list3.size() + 1); InterfaceC4998bkj interfaceC4998bkj = new InterfaceC4998bkj(this, list3, ben, arrayList3, str, size) { // from class: o.Hvr private List a; private List b; private String c; private Ben d; private PcD e; private int h; @Override // o.InterfaceC4998bkj public final void d(int i2) { PcD.a(this.e, this.b, this.d, this.a, this.c, this.h, i2); } { this.e = this; this.b = list3; this.d = ben; this.a = arrayList3; this.c = str; this.h = size; } }; while (a.d.hasNext()) { interfaceC4998bkj.d(a.d.e()); } } if (enumC17751zVK4 == EnumC17751zVK.SUCCESS && (list = ben.e) != null) { YKU yku3 = new YKU(this.a.b(list)); YKU yku4 = new YKU(yku3.a, new GEP(yku3.b, new Jel(this) { // from class: o.XhM private PcD a; @Override // o.Jel public final boolean e(Object obj) { return PcD.c(this.a, (QJg) obj); } { this.a = this; } })); List list4 = (List) new YKU(yku4.a, new wxK(yku4.b, new InterfaceC1244Ytw(this, str) { // from class: o.qdH private String a; private PcD b; @Override // o.InterfaceC1244Ytw public final Object d(Object obj) { return PcD.d(this.b, this.a, (QJg) obj); } { this.b = this; this.a = str; } })).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8())); if (list4 != null && !list4.isEmpty()) { arrayList3.add(new uxC().c(AyW.BANNER).f(3).a(arrayList3.size()).d(list4)); } } if (enumC17751zVK3 == EnumC17751zVK.SUCCESS && ben.f != null) { List b = this.a.b(ben.f); int size2 = arrayList3.size(); int i2 = this.d; ArrayList arrayList4 = new ArrayList(); Iterator it = b.iterator(); while (it.hasNext()) { arrayList4.add(e(it.next(), size2, i2, str)); } arrayList3.addAll(arrayList4); } EQY c2 = EQY.c(); c2.i = arrayList3; c2.a = ben.c; c2.c = ben.g; c2.b = ben.h; c2.d = enumC17751zVK3; return new C13245fUx(arrayList2, c2); } private uxC b(C17104tuu c17104tuu, String str, int i) { return new uxC().g(e(c17104tuu)).e(c17104tuu.b).a(i).g(c17104tuu.d).g(c17104tuu.c == 1).f(c17104tuu.g == 1).d(c17104tuu.h).s(a(c17104tuu, str)).a(c17104tuu.l).c(d(c17104tuu.m)).b(c17104tuu.k != null ? this.b.e(c17104tuu.k) : null).b(c17104tuu.a); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.PcD$4, reason: invalid class name */ /* loaded from: classes.dex */ public static /* synthetic */ class AnonymousClass4 { static final int[] c; static { int[] iArr = new int[EnumC15824isw.values().length]; c = iArr; try { iArr[EnumC15824isw.BILLERTOPUP.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { c[EnumC15824isw.BILLERPAYMENT.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { c[EnumC15824isw.FAVOURITE.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { c[EnumC15824isw.TRANSFER.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { c[EnumC15824isw.IMAGE.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } } } /* JADX INFO: Access modifiers changed from: private */ public uxC e(QJg qJg, int i, int i2, String str) { String str2; String str3; String str4; uxC d = uxC.b().c(AyW.STATIC_SHORTCUT).a(h(qJg.F)).d(qJg.A); StringBuilder sb = new StringBuilder(); sb.append(a(qJg.I, qJg.D)); sb.append("\n"); sb.append(a(qJg.G, qJg.C)); uxC g = d.s(sb.toString()).a(i + i2 + qJg.p).f(j(qJg.E)).e(qJg.k).b(qJg.q == 1).a().k(qJg.z).c(qJg.f).b(qJg.m).f(qJg.B == 1).g(qJg.t == 1); Ikx a = Ikx.a(); a.f = qJg.u; if ("en".equalsIgnoreCase(str)) { str2 = qJg.y; } else { str2 = qJg.v; } a.i = str2; C1170Xbv c1170Xbv = this.b; a.k = EnumC15824isw.c(qJg.l); a.h = qJg.K; a.g = qJg.J; uxC n = g.b(a).e(qJg.i).d(qJg.d).k(qJg.u).n(qJg.H); if ("en".equalsIgnoreCase(str)) { str3 = qJg.r; } else { str3 = qJg.x; } uxC o2 = n.o(str3); if ("en".equalsIgnoreCase(str)) { str4 = qJg.y; } else { str4 = qJg.v; } return o2.n(str4).t(qJg.h).d(c(qJg.M, i, i2, str)); } private static String a(String str, String str2) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(TextUtils.isEmpty(str2) ? "" : " ".concat(String.valueOf(str2))); return sb.toString(); } private static EnumC15824isw h(String str) { if ("FUNCTION".equalsIgnoreCase(str)) { return EnumC15824isw.FUNCTION; } if ("APPLICATION".equalsIgnoreCase(str)) { return EnumC15824isw.APPLICATION; } if ("TILE".equalsIgnoreCase(str)) { return EnumC15824isw.TILES; } if (EnumC15824isw.OPENACCOUNT_NTB.name().equals(str)) { return EnumC15824isw.OPENACCOUNT_NTB; } if (EnumC15824isw.TILE_CATEGORY.name().equals(str)) { return EnumC15824isw.TILE_CATEGORY; } if (EnumC15824isw.CARD_TILE_VERTICAL.name().equals(str)) { return EnumC15824isw.CARD_TILE_VERTICAL; } if (EnumC15824isw.CARD_TILE_HORIZONTAL.name().equals(str)) { return EnumC15824isw.CARD_TILE_HORIZONTAL; } if (EnumC15824isw.WEBVIEW_PARTNER.name().equals(str)) { return EnumC15824isw.WEBVIEW_PARTNER; } if (EnumC15824isw.IMAGE.name().equals(str)) { return EnumC15824isw.IMAGE; } if (EnumC15824isw.DEEPLINK.name().equalsIgnoreCase(str)) { return EnumC15824isw.DEEPLINK; } return EnumC15824isw.WEBVIEWTILE; } public static /* synthetic */ uxC d(PcD pcD, String str, QJg qJg) { String str2; String str3; String str4; int i = pcD.d; uxC d = uxC.b().c(AyW.BANNER).a(h(qJg.F)).d(qJg.A); StringBuilder sb = new StringBuilder(); sb.append(a(qJg.I, qJg.D)); sb.append("\n"); sb.append(a(qJg.G, qJg.C)); uxC g = d.s(sb.toString()).a(qJg.p).f(j(qJg.E)).e(qJg.k).b(qJg.q == 1).a().k(qJg.z).c(qJg.f).b(qJg.m).f(qJg.B == 1).g(qJg.t == 1); Ikx a = Ikx.a(); a.f = qJg.u; if ("en".equalsIgnoreCase(str)) { str2 = qJg.y; } else { str2 = qJg.v; } a.i = str2; C1170Xbv c1170Xbv = pcD.b; a.k = EnumC15824isw.c(qJg.l); a.h = qJg.K; a.g = qJg.J; uxC n = g.b(a).e(qJg.i).d(qJg.d).k(qJg.u).n(qJg.H); if ("en".equalsIgnoreCase(str)) { str3 = qJg.r; } else { str3 = qJg.x; } uxC o2 = n.o(str3); if ("en".equalsIgnoreCase(str)) { str4 = qJg.y; } else { str4 = qJg.v; } uxC t = o2.n(str4).t(qJg.h); t.b = qJg.g; uxC a2 = t.a(qJg.j); a2.a = qJg.a; a2.c = qJg.b; return a2.d(pcD.c(qJg.M, pcD.c, i, str)).h(qJg.f8323o); } public static /* synthetic */ boolean c(PcD pcD, QJg qJg) { return qJg.n <= pcD.e; } private static String e(C17104tuu c17104tuu) { String a; if (c17104tuu.k == null) { return ""; } int i = AnonymousClass4.c[c17104tuu.l.ordinal()]; if (i != 1) { if (i != 2) { if (i != 3) { if (i != 4) { if (i != 5 || c17104tuu.k.d == null) { return ""; } a = c17104tuu.k.d; } else { if (c17104tuu.k.f == null) { return ""; } a = c17104tuu.k.f.q; } } else { if (c17104tuu.k.i == null) { return ""; } a = c17104tuu.k.i.q; } } else { if (c17104tuu.k.e == null) { return ""; } a = c17104tuu.k.e.a; } } else { if (c17104tuu.k.c == null) { return ""; } a = c17104tuu.k.c.a(); } return a; } private List c(List list, final int i, final int i2, final String str) { if (list == null) { return null; } YKU yku = new YKU(list); return (List) new YKU(yku.a, new wxK(yku.b, new InterfaceC1244Ytw(this, i, i2, str) { // from class: o.FpB private String a; private PcD b; private int c; private int d; @Override // o.InterfaceC1244Ytw public final Object d(Object obj) { uxC e; e = this.b.e((QJg) obj, this.d, this.c, this.a); return e; } { this.b = this; this.d = i; this.c = i2; this.a = str; } })).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8())); } public static /* synthetic */ void a(PcD pcD, List list, Ben ben, List list2, String str, int i, int i2) { String str2; String str3; if (i2 < list.size() && i2 < ben.h) { C17104tuu c17104tuu = (C17104tuu) list.get(i2); uxC d = new uxC().g(e(c17104tuu)).e(c17104tuu.b).a(i + i2).g(c17104tuu.d).g(c17104tuu.c == 1).f(c17104tuu.g == 1).d(c17104tuu.h); if ("en".equalsIgnoreCase(str)) { str2 = c17104tuu.f; } else { str2 = c17104tuu.i; } uxC s = d.s(str2); if ("en".equalsIgnoreCase(str)) { str3 = c17104tuu.j; } else { str3 = c17104tuu.n; } list2.add(s.w(str3).a(c17104tuu.l).c(AyW.NTB_PREDICTIVE).b(c17104tuu.k != null ? pcD.b.e(c17104tuu.k) : null).b(c17104tuu.a)); } if (i2 != list.size() || i2 == 0 || i2 >= ben.h) { return; } list2.add(uxC.b().b(0L).c(AyW.LEARN_MORE).a(i + i2).f(3 - (list.size() % 3))); } }