package o; import com.scb.phone.data.entity.transfer.SingleDataEntity; import com.scb.phone.data.network.service.RewardRedemptionService; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.TreeMap; import o.PRA; /* loaded from: classes3.dex */ public final class eLQ implements plw { final C17211uop a; private final igT b; private final C16634pqc c; final C7463col d; private final C5659bxI e; private final C17074thD f; private final C11740ekz g; private final String h; private final SrB i; private final YBt j; @InterfaceC13391fZD public eLQ(SrB srB, C5659bxI c5659bxI, C7463col c7463col, C11740ekz c11740ekz, C17074thD c17074thD, YBt yBt, C16634pqc c16634pqc, C17211uop c17211uop, igT igt, String str) { this.i = srB; this.e = c5659bxI; this.d = c7463col; this.g = c11740ekz; this.f = c17074thD; this.j = yBt; this.c = c16634pqc; this.a = c17211uop; this.b = igt; this.h = str; } @Override // o.plw public final AbstractC13163fSk a(String str) { AbstractC13163fSk rewardCategories = this.i.d.getRewardCategories(str); final C5659bxI c5659bxI = this.e; Objects.requireNonNull(c5659bxI); return rewardCategories.map(new fSS(c5659bxI) { // from class: o.qux private C5659bxI c; @Override // o.fSS public final Object a(Object obj) { return C5659bxI.b((ZmQ) obj); } { this.c = c5659bxI; } }); } @Override // o.plw public final AbstractC13175fSw> a(String str, EnumC1889aRM enumC1889aRM) { return AbstractC13175fSw.e(this.i.d.getSearchSuggestionList(str, enumC1889aRM != null ? enumC1889aRM.name() : null).map(new fSS() { // from class: o.AND @Override // o.fSS public final Object a(Object obj) { return ((nMl) ((SingleDataEntity) obj).getData()).b; } })); } @Override // o.plw public final AbstractC13163fSk e(Txv txv) { AbstractC13163fSk confirmRedemption = this.i.d.confirmRedemption(txv); final C11740ekz c11740ekz = this.g; Objects.requireNonNull(c11740ekz); return confirmRedemption.map(new fSS(c11740ekz) { // from class: o.Ubm private C11740ekz a; @Override // o.fSS public final Object a(Object obj) { return C11740ekz.b((ACk) obj); } { this.a = c11740ekz; } }); } @Override // o.plw public final AbstractC13163fSk a(String str, int i) { AbstractC13163fSk oPRRewards = this.i.d.getOPRRewards(str, i); final C17074thD c17074thD = this.f; Objects.requireNonNull(c17074thD); return oPRRewards.map(new fSS(c17074thD) { // from class: o.KaY private C17074thD d; @Override // o.fSS public final Object a(Object obj) { List list; ArrayList arrayList; final C17074thD c17074thD2 = this.d; lIT lit = (lIT) obj; PNg pNg = new PNg(); pNg.e = !C17074thD.d(lit.d); pNg.a = lit.a; List list2 = lit.d; if (C17074thD.d(list2)) { list = null; } else { YKU yku = new YKU(list2); list = (List) new YKU(yku.a, new wxK(yku.b, new InterfaceC1244Ytw(c17074thD2) { // from class: o.aer private C17074thD e; @Override // o.InterfaceC1244Ytw public final Object d(Object obj2) { TBH b; b = C17074thD.b((C0815Pax) obj2); return b; } { this.e = c17074thD2; } })).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8())); } pNg.b = list; List list3 = lit.b; if (C17074thD.d(list3)) { arrayList = null; } else { arrayList = new ArrayList(); for (C0815Pax c0815Pax : list3) { for (int i2 = 1; i2 <= c0815Pax.e.doubleValue(); i2++) { arrayList.add(C17074thD.b(c0815Pax)); } } } pNg.f = arrayList; List list4 = lit.d; pNg.c = !C17074thD.d(list4) && list4.get(0).a.booleanValue(); List list5 = lit.c; if (list5 != null && !list5.isEmpty()) { pNg.d = list5.get(0).c; } else { pNg.d = null; } return pNg; } { this.d = c17074thD; } }); } @Override // o.plw public final AbstractC13163fSk c(int i, EnumC16373nni enumC16373nni) { AbstractC13163fSk tiers = this.i.d.getTiers(i, enumC16373nni); final YBt yBt = this.j; Objects.requireNonNull(yBt); return tiers.map(new fSS(yBt) { // from class: o.mQz private YBt e; @Override // o.fSS public final Object a(Object obj) { return YBt.b((MQP) obj); } { this.e = yBt; } }); } @Override // o.plw public final AbstractC13163fSk a(String str, int i, EnumC16373nni enumC16373nni) { AbstractC13163fSk abstractC13163fSk; String format = String.format("%s+%d+%s", str, Integer.valueOf(i), enumC16373nni); synchronized (this.b) { igT igt = this.b; abstractC13163fSk = igt.b.containsKey(format) ? igt.b.get(format) : null; if (abstractC13163fSk == null) { abstractC13163fSk = this.i.d.getOprDetails(str, i, enumC16373nni).cache(); this.b.b.put(format, abstractC13163fSk); } } final C16634pqc c16634pqc = this.c; Objects.requireNonNull(c16634pqc); return abstractC13163fSk.map(new fSS(c16634pqc) { // from class: o.TDX private C16634pqc d; @Override // o.fSS public final Object a(Object obj) { final C16634pqc c16634pqc2 = this.d; C17709zAb c17709zAb = (C17709zAb) obj; YKU yku = new YKU(c17709zAb.d); List list = (List) new YKU(yku.a, new wxK(yku.b, new InterfaceC1244Ytw(c16634pqc2) { // from class: o.rSo private C16634pqc e; @Override // o.InterfaceC1244Ytw public final Object d(Object obj2) { return C16634pqc.e((C17595yCN) obj2); } { this.e = c16634pqc2; } })).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8())); pTr ptr = c17709zAb.a; Wgw wgw = new Wgw(); wgw.c = ptr.a; wgw.b = ptr.b; wgw.e = ptr.e; wgw.d = ptr.c; wgw.a = ptr.d; return new Fsg(list, wgw); } { this.d = c16634pqc; } }); } @Override // o.plw public final void a() { this.b.b.clear(); } @Override // o.plw public final void e() { this.a.c.clear(); } @Override // o.plw public final AbstractC13163fSk e(final rOI roi, final boolean z) { oQz oqz; final int intValue = roi.e == null ? -1 : roi.e.intValue(); C17211uop c17211uop = this.a; int i = roi.b; Map map = c17211uop.c.get(Integer.valueOf(intValue)); if (map != null) { oqz = null; for (Map.Entry entry : map.entrySet()) { if (entry.getKey().intValue() >= i) { if (oqz == null) { oqz = new oQz(); oqz.d = new ArrayList(); } oQz value = entry.getValue(); oqz.d.addAll(value.d); oqz.b = value.b; oqz.e = value.e; } } } else { oqz = null; } if (oqz == null || !z) { SrB srB = this.i; String str = this.h; RewardRedemptionService rewardRedemptionService = srB.d; Integer num = roi.e; int i2 = roi.b; String str2 = roi.i != null ? roi.i.value : null; Integer num2 = roi.c; String str3 = roi.a; String str4 = roi.h; return rewardRedemptionService.getProducts(num, i2, str2, num2, str3, str4 == null ? null : str4.replaceAll("[#&']", "_"), roi.d != null ? roi.d.name() : null, roi.f, str).doOnNext(new fSQ(this, z, intValue, roi) { // from class: o.aWk private eLQ b; private rOI c; private boolean d; private int e; @Override // o.fSQ public final void c(Object obj) { eLQ elq = this.b; boolean z2 = this.d; int i3 = this.e; rOI roi2 = this.c; oQz oqz2 = (oQz) obj; if (z2) { C17211uop c17211uop2 = elq.a; int i4 = roi2.b; Map map2 = c17211uop2.c.get(Integer.valueOf(i3)); if (map2 == null) { map2 = new TreeMap<>(); } map2.put(Integer.valueOf(i4), oqz2); c17211uop2.c.put(Integer.valueOf(i3), map2); } } { this.b = this; this.d = z; this.e = intValue; this.c = roi; } }).flatMap(new fSS(this) { // from class: o.HBE private eLQ b; @Override // o.fSS public final Object a(Object obj) { C7463col c7463col = this.b.d; return AbstractC13163fSk.just(C7463col.c((oQz) obj)); } { this.b = this; } }); } return AbstractC13163fSk.just(C7463col.c(oqz)); } }