package com.facetec.sdk; import com.airbnb.deeplinkdispatch.UrlTreeKt; import com.facetec.sdk.jv; import java.io.Closeable; /* loaded from: classes.dex */ public final class kh implements Closeable { public final jw a; final kd b; final String c; final int d; final ke e; final jv f; final kh g; final kh h; final kh i; public final kf j; private volatile jl l; final long m; final long n; kh(d dVar) { this.e = dVar.e; this.b = dVar.a; this.d = dVar.d; this.c = dVar.b; this.a = dVar.c; this.f = dVar.i.e(); this.j = dVar.f; this.i = dVar.g; this.g = dVar.j; this.h = dVar.h; this.m = dVar.l; this.n = dVar.n; } public final d g() { return new d(this); } public final jl h() { jl jlVar = this.l; if (jlVar != null) { return jlVar; } jl e = jl.e(this.f); this.l = e; return e; } @Override // java.io.Closeable, java.lang.AutoCloseable public final void close() { kf kfVar = this.j; if (kfVar == null) { throw new IllegalStateException("response is not eligible for a body and must not be closed"); } kfVar.close(); } public final String toString() { StringBuilder sb = new StringBuilder("Response{protocol="); sb.append(this.b); sb.append(", code="); sb.append(this.d); sb.append(", message="); sb.append(this.c); sb.append(", url="); sb.append(this.e.a()); sb.append(UrlTreeKt.componentParamSuffixChar); return sb.toString(); } /* loaded from: classes.dex */ public static final class d { kd a; String b; jw c; int d; ke e; kf f; kh g; public kh h; public jv.a i; kh j; long l; long n; public d() { this.d = -1; this.i = new jv.a(); } d(kh khVar) { this.d = -1; this.e = khVar.e; this.a = khVar.b; this.d = khVar.d; this.b = khVar.c; this.c = khVar.a; this.i = khVar.f.e(); this.f = khVar.j; this.g = khVar.i; this.j = khVar.g; this.h = khVar.h; this.l = khVar.m; this.n = khVar.n; } public final d e(String str, String str2) { this.i.b(str, str2); return this; } public final d b(jv jvVar) { this.i = jvVar.e(); return this; } public final d c(kh khVar) { if (khVar != null) { a("networkResponse", khVar); } this.g = khVar; return this; } public final d a(kh khVar) { if (khVar != null) { a("cacheResponse", khVar); } this.j = khVar; return this; } private static void a(String str, kh khVar) { if (khVar.j != null) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(".body != null"); throw new IllegalArgumentException(sb.toString()); } if (khVar.i != null) { StringBuilder sb2 = new StringBuilder(); sb2.append(str); sb2.append(".networkResponse != null"); throw new IllegalArgumentException(sb2.toString()); } if (khVar.g != null) { StringBuilder sb3 = new StringBuilder(); sb3.append(str); sb3.append(".cacheResponse != null"); throw new IllegalArgumentException(sb3.toString()); } if (khVar.h == null) { return; } StringBuilder sb4 = new StringBuilder(); sb4.append(str); sb4.append(".priorResponse != null"); throw new IllegalArgumentException(sb4.toString()); } public final kh d() { if (this.e == null) { throw new IllegalStateException("request == null"); } if (this.a == null) { throw new IllegalStateException("protocol == null"); } if (this.d >= 0) { if (this.b == null) { throw new IllegalStateException("message == null"); } return new kh(this); } StringBuilder sb = new StringBuilder("code < 0: "); sb.append(this.d); throw new IllegalStateException(sb.toString()); } public final d e(kd kdVar) { this.a = kdVar; return this; } public final d e(long j) { this.n = j; return this; } public final d c(int i) { this.d = i; return this; } public final d b(String str) { this.b = str; return this; } public final d b(kf kfVar) { this.f = kfVar; return this; } public final d b(long j) { this.l = j; return this; } public final d a(ke keVar) { this.e = keVar; return this; } public final d a(jw jwVar) { this.c = jwVar; return this; } } public final String b(String str) { String e = this.f.e(str); if (e != null) { return e; } return null; } public final kh j() { return this.h; } public final long i() { return this.n; } public final long f() { return this.m; } public final int e() { return this.d; } public final jv d() { return this.f; } public final boolean c() { int i = this.d; return i >= 200 && i < 300; } public final kf b() { return this.j; } public final ke a() { return this.e; } }