package com.mbridge.msdk.reward.b; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.text.TextUtils; import com.mbridge.msdk.foundation.entity.CampaignEx; import com.mbridge.msdk.foundation.same.report.d.d; import com.mbridge.msdk.out.MBridgeIds; import com.mbridge.msdk.reward.b.a; import com.mbridge.msdk.videocommon.listener.InterVideoOutListener; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; /* loaded from: classes4.dex */ public final class b extends Handler { private final a a; public b(a aVar) { super(Looper.getMainLooper()); this.a = aVar; } @Override // android.os.Handler public final void handleMessage(Message message) { int i = message.what; Object obj = message.obj; com.mbridge.msdk.foundation.same.report.d.c a = this.a.a(message); CopyOnWriteArrayList e = this.a.e(); List f = this.a.f(); com.mbridge.msdk.reward.adapter.c g = this.a.g(); boolean h = this.a.h(); String j = this.a.j(); String i2 = this.a.i(); a.c k = this.a.k(); InterVideoOutListener l = this.a.l(); boolean m = this.a.m(); MBridgeIds n = this.a.n(); boolean o = this.a.o(); switch (i) { case 8: if (e != null && e.size() > 0) { boolean z = (f == null || f.size() <= 0) ? false : !TextUtils.isEmpty(f.get(0).getCMPTEntryUrl()); int nscpt = e.get(0).getNscpt(); if (g != null && g.a(e, z, nscpt)) { if (k != null && h) { k.a(j, i2, a); break; } } else if (k != null && h) { com.mbridge.msdk.videocommon.a.c(i2); com.mbridge.msdk.videocommon.a.a(); com.mbridge.msdk.foundation.c.b b = com.mbridge.msdk.foundation.c.a.b(880010, "load timeout"); if (a != null) { a.a(b); } k.a(b, a); break; } } break; case 9: if (l != null && h) { if (m) { this.a.c(); } l.onVideoLoadSuccess(n); break; } break; case 16: case 18: if (l != null && h) { String obj2 = obj instanceof String ? obj.toString() : ""; if (a != null && a.o() != null) { obj2 = a.o().b(); } com.mbridge.msdk.videocommon.a.c(i2); com.mbridge.msdk.videocommon.a.a(); if (m) { this.a.c(); } l.onVideoLoadFail(n, obj2); break; } break; case 17: if (l != null && h) { if (m) { this.a.c(); } l.onLoadSuccess(n); break; } break; case 1001001: this.a.a(false, d.a().a(0, o ? 287 : 94, i2, true, 1)); break; case 1001002: if (g != null) { if (!g.b()) { if (g.h(false)) { if (!g.b()) { g.g(false); if (g.h(true)) { if (!g.b()) { g.g(true); break; } else if (k != null) { g.f(true); CopyOnWriteArrayList d = g.d(); if (d != null && d.size() == 0) { d = g.e(); } this.a.a(d); com.mbridge.msdk.foundation.same.report.d.c a2 = this.a.a(d, a); if (a2 != null) { a2.b(d); } k.b(j, i2, a2); break; } } } else if (k != null) { g.f(false); CopyOnWriteArrayList d2 = g.d(); if (d2 != null && d2.size() == 0) { d2 = g.e(); } this.a.a(d2); com.mbridge.msdk.foundation.same.report.d.c a3 = this.a.a(d2, a); if (a3 != null) { a3.b(d2); } k.b(j, i2, a3); break; } } else if (g.h(true)) { if (!g.b()) { g.g(true); break; } else if (k != null) { g.f(true); CopyOnWriteArrayList d3 = g.d(); if (d3 != null && d3.size() == 0) { d3 = g.e(); } this.a.a(d3); com.mbridge.msdk.foundation.same.report.d.c a4 = this.a.a(d3, a); if (a4 != null) { a4.b(d3); } k.b(j, i2, a4); break; } } } else if (k != null) { CopyOnWriteArrayList d4 = g.d(); if (d4 != null && d4.size() == 0) { d4 = g.e(); } this.a.a(d4); com.mbridge.msdk.foundation.same.report.d.c a5 = this.a.a(d4, a); if (a5 != null) { a5.b(d4); } k.b(j, i2, a5); break; } } break; } } }