package h5; import android.content.Context; import com.google.android.gms.ads.RequestConfiguration; import java.io.IOException; import java.util.ArrayList; /* loaded from: classes2.dex */ final class u0 implements i { /* renamed from: a, reason: collision with root package name */ final f0 f10300a; /* renamed from: b, reason: collision with root package name */ final l5.j f10301b; /* renamed from: c, reason: collision with root package name */ private t f10302c; /* renamed from: d, reason: collision with root package name */ final h0 f10303d; /* renamed from: e, reason: collision with root package name */ final boolean f10304e; /* renamed from: f, reason: collision with root package name */ private boolean f10305f; final class a extends i5.b { /* renamed from: b, reason: collision with root package name */ private final j f10306b; a(j jVar) { super("OkHttp %s", u0.this.h()); this.f10306b = jVar; } @Override // i5.b protected void j() { IOException e10; boolean z10; i0 g10; try { try { g10 = u0.this.g(); z10 = true; } catch (IOException e11) { e10 = e11; z10 = false; } try { if (u0.this.f10301b.h()) { this.f10306b.b(u0.this, new IOException("Canceled")); } else { this.f10306b.a(u0.this, g10); } } catch (IOException e12) { e10 = e12; if (z10) { o5.a.j().o(4, "Callback failure for " + u0.this.i(), e10); } else { u0.this.f10302c.c(u0.this, e10); this.f10306b.b(u0.this, e10); } } } finally { u0.this.f10300a.k().d(this); } } u0 k() { return u0.this; } String l() { return u0.this.f10303d.h().t(); } } private u0(f0 f0Var, h0 h0Var, boolean z10) { this.f10300a = f0Var; this.f10303d = h0Var; this.f10304e = z10; this.f10301b = new l5.j(f0Var, z10); } static u0 b(Context context, f0 f0Var, h0 h0Var, boolean z10) { u0 u0Var = new u0(f0Var, h0Var, z10); u0Var.f10302c = f0Var.m().a(u0Var); return u0Var; } static u0 d(f0 f0Var, h0 h0Var, boolean z10) { u0 u0Var = new u0(f0Var, h0Var, z10); u0Var.f10302c = f0Var.m().a(u0Var); return u0Var; } private void e() { this.f10301b.i(o5.a.j().m("response.body().close()")); } /* renamed from: f, reason: merged with bridge method [inline-methods] */ public u0 clone() { return d(this.f10300a, this.f10303d, this.f10304e); } i0 g() { ArrayList arrayList = new ArrayList(); arrayList.addAll(this.f10300a.q()); arrayList.add(this.f10301b); arrayList.add(new l5.a(this.f10300a.j())); this.f10300a.a(); arrayList.add(new j5.a(null)); arrayList.add(new k5.a(this.f10300a)); if (!this.f10304e) { arrayList.addAll(this.f10300a.r()); } arrayList.add(new l5.b(this.f10304e)); return new l5.g(arrayList, null, null, null, 0, this.f10303d, this, this.f10302c, this.f10300a.g(), this.f10300a.y(), this.f10300a.D()).e(this.f10303d); } String h() { return this.f10303d.h().A(); } String i() { StringBuilder sb = new StringBuilder(); sb.append(j() ? "canceled " : RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED); sb.append(this.f10304e ? "web socket" : "call"); sb.append(" to "); sb.append(h()); return sb.toString(); } public boolean j() { return this.f10301b.h(); } @Override // h5.i public void z(j jVar) { synchronized (this) { if (this.f10305f) { throw new IllegalStateException("Already Executed"); } this.f10305f = true; } e(); this.f10302c.d(this); this.f10300a.k().b(new a(jVar)); } }