package com.ironsource; import android.text.TextUtils; import com.ironsource.mediationsdk.adunit.adapter.utility.AdInfo; import com.ironsource.mediationsdk.impressionData.ImpressionData; import com.ironsource.mediationsdk.logger.IronLog; import java.util.Iterator; import java.util.List; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; /* loaded from: classes2.dex */ public class vj { private static final String i = "WaterfallLifeCycleHolder"; private com.ironsource.mediationsdk.r d; private final List e; private final int f; ConcurrentHashMap> a = new ConcurrentHashMap<>(); private String b = ""; private String c = ""; private final Timer g = new Timer(); ConcurrentHashMap h = new ConcurrentHashMap<>(); public class a extends TimerTask { final /* synthetic */ String a; public a(String str) { this.a = str; } @Override // java.util.TimerTask, java.lang.Runnable public void run() { try { IronLog ironLog = IronLog.INTERNAL; ironLog.verbose("removing waterfall with id " + this.a + " from memory"); vj.this.a.remove(this.a); ironLog.verbose("waterfall size is currently " + vj.this.a.size()); ironLog.verbose("removing adInfo with id " + this.a + " from memory"); vj.this.h.remove(this.a); ironLog.verbose("adInfo size is currently " + vj.this.h.size()); } finally { cancel(); } } } public vj(List list, int i2) { this.e = list; this.f = i2; } private void b() { Iterator it = c().iterator(); while (it.hasNext()) { com.ironsource.mediationsdk.r next = it.next(); if (!next.equals(this.d)) { next.q(); } } } public AdInfo a(String str) { if (this.h.containsKey(str)) { return this.h.get(str); } return null; } public synchronized void a(com.ironsource.mediationsdk.r rVar) { try { IronLog.INTERNAL.verbose(); com.ironsource.mediationsdk.r rVar2 = this.d; if (rVar2 != null && !rVar2.equals(rVar)) { this.d.q(); } this.d = rVar; } catch (Throwable th) { throw th; } } public void a(String str, ImpressionData impressionData) { if (TextUtils.isEmpty(str) || impressionData == null) { return; } this.h.put(str, new AdInfo(impressionData)); } public void a(CopyOnWriteArrayList copyOnWriteArrayList, String str) { IronLog ironLog = IronLog.INTERNAL; ironLog.verbose("updating new waterfall with id " + str); b(); this.a.put(str, copyOnWriteArrayList); if (!TextUtils.isEmpty(this.c)) { if (g()) { ironLog.verbose("ad from previous waterfall " + this.c + " is still showing - the current waterfall " + this.b + " will be deleted instead"); String str2 = this.b; this.b = this.c; this.c = str2; } this.g.schedule(new a(this.c), this.f); } this.c = this.b; this.b = str; } public boolean a() { return this.a.size() > 5; } /* JADX WARN: Code restructure failed: missing block: B:27:0x0043, code lost: if (r5.e.contains(r6.j()) == false) goto L25; */ /* JADX WARN: Code restructure failed: missing block: B:29:0x0053, code lost: if (r5.d.j().equals(r6.j()) == false) goto L25; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public synchronized boolean b(com.ironsource.mediationsdk.r r6) { /* r5 = this; monitor-enter(r5) com.ironsource.mediationsdk.logger.IronLog r0 = com.ironsource.mediationsdk.logger.IronLog.INTERNAL // Catch: java.lang.Throwable -> L2f r0.verbose() // Catch: java.lang.Throwable -> L2f r1 = 1 if (r6 == 0) goto L55 boolean r2 = r6.o() // Catch: java.lang.Throwable -> L2f if (r2 == 0) goto L10 goto L55 L10: com.ironsource.mediationsdk.r r2 = r5.d // Catch: java.lang.Throwable -> L2f r3 = 0 if (r2 != 0) goto L16 goto L56 L16: com.ironsource.mediationsdk.LoadWhileShowSupportState r2 = r6.w() // Catch: java.lang.Throwable -> L2f com.ironsource.mediationsdk.LoadWhileShowSupportState r4 = com.ironsource.mediationsdk.LoadWhileShowSupportState.LOAD_WHILE_SHOW_BY_NETWORK // Catch: java.lang.Throwable -> L2f if (r2 != r4) goto L31 com.ironsource.mediationsdk.r r2 = r5.d // Catch: java.lang.Throwable -> L2f java.lang.String r2 = r2.c() // Catch: java.lang.Throwable -> L2f java.lang.String r4 = r6.c() // Catch: java.lang.Throwable -> L2f boolean r2 = r2.equals(r4) // Catch: java.lang.Throwable -> L2f if (r2 == 0) goto L31 goto L55 L2f: r6 = move-exception goto L76 L31: com.ironsource.mediationsdk.LoadWhileShowSupportState r2 = r6.w() // Catch: java.lang.Throwable -> L2f com.ironsource.mediationsdk.LoadWhileShowSupportState r4 = com.ironsource.mediationsdk.LoadWhileShowSupportState.NONE // Catch: java.lang.Throwable -> L2f if (r2 == r4) goto L45 java.util.List r2 = r5.e // Catch: java.lang.Throwable -> L2f java.lang.String r4 = r6.j() // Catch: java.lang.Throwable -> L2f boolean r2 = r2.contains(r4) // Catch: java.lang.Throwable -> L2f if (r2 == 0) goto L56 L45: com.ironsource.mediationsdk.r r2 = r5.d // Catch: java.lang.Throwable -> L2f java.lang.String r2 = r2.j() // Catch: java.lang.Throwable -> L2f java.lang.String r4 = r6.j() // Catch: java.lang.Throwable -> L2f boolean r2 = r2.equals(r4) // Catch: java.lang.Throwable -> L2f if (r2 == 0) goto L56 L55: r3 = r1 L56: if (r3 == 0) goto L72 if (r6 == 0) goto L72 java.lang.StringBuilder r2 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L2f r2.() // Catch: java.lang.Throwable -> L2f java.lang.String r6 = r6.c() // Catch: java.lang.Throwable -> L2f r2.append(r6) // Catch: java.lang.Throwable -> L2f java.lang.String r6 = " will not be added to the auction request" r2.append(r6) // Catch: java.lang.Throwable -> L2f java.lang.String r6 = r2.toString() // Catch: java.lang.Throwable -> L2f r0.verbose(r6) // Catch: java.lang.Throwable -> L2f L72: r6 = r3 ^ 1 monitor-exit(r5) return r6 L76: monitor-exit(r5) throw r6 */ throw new UnsupportedOperationException("Method not decompiled: com.ironsource.vj.b(com.ironsource.mediationsdk.r):boolean"); } public CopyOnWriteArrayList c() { CopyOnWriteArrayList copyOnWriteArrayList = this.a.get(this.b); return copyOnWriteArrayList == null ? new CopyOnWriteArrayList<>() : copyOnWriteArrayList; } public String d() { return this.b; } public int e() { return this.a.size(); } public com.ironsource.mediationsdk.r f() { return this.d; } public synchronized boolean g() { boolean z; com.ironsource.mediationsdk.r rVar = this.d; if (rVar != null) { z = rVar.u().equals(this.c); } return z; } }