package j5; import h5.a0; import h5.h; import h5.h0; import h5.i0; import java.util.Date; import java.util.concurrent.TimeUnit; import l5.d; import l5.e; /* loaded from: classes2.dex */ public final class b { /* renamed from: a, reason: collision with root package name */ public final h0 f11058a; /* renamed from: b, reason: collision with root package name */ public final i0 f11059b; public static class a { /* renamed from: a, reason: collision with root package name */ final long f11060a; /* renamed from: b, reason: collision with root package name */ final h0 f11061b; /* renamed from: c, reason: collision with root package name */ final i0 f11062c; /* renamed from: d, reason: collision with root package name */ private Date f11063d; /* renamed from: e, reason: collision with root package name */ private String f11064e; /* renamed from: f, reason: collision with root package name */ private Date f11065f; /* renamed from: g, reason: collision with root package name */ private String f11066g; /* renamed from: h, reason: collision with root package name */ private Date f11067h; /* renamed from: i, reason: collision with root package name */ private long f11068i; /* renamed from: j, reason: collision with root package name */ private long f11069j; /* renamed from: k, reason: collision with root package name */ private String f11070k; /* renamed from: l, reason: collision with root package name */ private int f11071l; public a(long j10, h0 h0Var, i0 i0Var) { this.f11071l = -1; this.f11060a = j10; this.f11061b = h0Var; this.f11062c = i0Var; if (i0Var != null) { this.f11068i = i0Var.m0(); this.f11069j = i0Var.f0(); a0 R = i0Var.R(); int e10 = R.e(); for (int i10 = 0; i10 < e10; i10++) { String c10 = R.c(i10); String f10 = R.f(i10); if ("Date".equalsIgnoreCase(c10)) { this.f11063d = d.b(f10); this.f11064e = f10; } else if ("Expires".equalsIgnoreCase(c10)) { this.f11067h = d.b(f10); } else if ("Last-Modified".equalsIgnoreCase(c10)) { this.f11065f = d.b(f10); this.f11066g = f10; } else if ("ETag".equalsIgnoreCase(c10)) { this.f11070k = f10; } else if ("Age".equalsIgnoreCase(c10)) { this.f11071l = e.e(f10, -1); } } } } private long a() { Date date = this.f11063d; long max = date != null ? Math.max(0L, this.f11069j - date.getTime()) : 0L; int i10 = this.f11071l; if (i10 != -1) { max = Math.max(max, TimeUnit.SECONDS.toMillis(i10)); } long j10 = this.f11069j; return max + (j10 - this.f11068i) + (this.f11060a - j10); } private static boolean b(h0 h0Var) { return (h0Var.c("If-Modified-Since") == null && h0Var.c("If-None-Match") == null) ? false : true; } private long c() { if (this.f11062c.z().e() != -1) { return TimeUnit.SECONDS.toMillis(r0.e()); } if (this.f11067h != null) { Date date = this.f11063d; long time = this.f11067h.getTime() - (date != null ? date.getTime() : this.f11069j); if (time > 0) { return time; } return 0L; } if (this.f11065f == null || this.f11062c.j0().h().z() != null) { return 0L; } Date date2 = this.f11063d; long time2 = (date2 != null ? date2.getTime() : this.f11068i) - this.f11065f.getTime(); if (time2 > 0) { return time2 / 10; } return 0L; } private b d() { String str; if (this.f11062c == null) { return new b(this.f11061b, null); } if ((!this.f11061b.e() || this.f11062c.I() != null) && b.a(this.f11062c, this.f11061b)) { h b10 = this.f11061b.b(); if (b10.i() || b(this.f11061b)) { return new b(this.f11061b, null); } h z10 = this.f11062c.z(); if (z10.b()) { return new b(null, this.f11062c); } long a10 = a(); long c10 = c(); if (b10.e() != -1) { c10 = Math.min(c10, TimeUnit.SECONDS.toMillis(b10.e())); } long j10 = 0; long millis = b10.g() != -1 ? TimeUnit.SECONDS.toMillis(b10.g()) : 0L; if (!z10.h() && b10.f() != -1) { j10 = TimeUnit.SECONDS.toMillis(b10.f()); } if (!z10.i()) { long j11 = millis + a10; if (j11 < j10 + c10) { i0.a a02 = this.f11062c.a0(); if (j11 >= c10) { a02.c("Warning", "110 HttpURLConnection \"MobonResponse is stale\""); } if (a10 > 86400000 && e()) { a02.c("Warning", "113 HttpURLConnection \"Heuristic expiration\""); } return new b(null, a02.e()); } } String str2 = this.f11070k; if (str2 != null) { str = "If-None-Match"; } else { if (this.f11065f != null) { str2 = this.f11066g; } else { if (this.f11063d == null) { return new b(this.f11061b, null); } str2 = this.f11064e; } str = "If-Modified-Since"; } a0.a d10 = this.f11061b.d().d(); i5.a.f10869a.b(d10, str, str2); return new b(this.f11061b.g().d(d10.e()).b(), this.f11062c); } return new b(this.f11061b, null); } private boolean e() { return this.f11062c.z().e() == -1 && this.f11067h == null; } public b f() { b d10 = d(); return (d10.f11058a == null || !this.f11061b.b().k()) ? d10 : new b(null, null); } } b(h0 h0Var, i0 i0Var) { this.f11058a = h0Var; this.f11059b = i0Var; } /* JADX WARN: Code restructure failed: missing block: B:31:0x0056, code lost: if (r3.z().c() == false) goto L33; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public static boolean a(h5.i0 r3, h5.h0 r4) { /* int r0 = r3.G() r1 = 200(0xc8, float:2.8E-43) r2 = 0 if (r0 == r1) goto L5a r1 = 410(0x19a, float:5.75E-43) if (r0 == r1) goto L5a r1 = 414(0x19e, float:5.8E-43) if (r0 == r1) goto L5a r1 = 501(0x1f5, float:7.02E-43) if (r0 == r1) goto L5a r1 = 203(0xcb, float:2.84E-43) if (r0 == r1) goto L5a r1 = 204(0xcc, float:2.86E-43) if (r0 == r1) goto L5a r1 = 307(0x133, float:4.3E-43) if (r0 == r1) goto L31 r1 = 308(0x134, float:4.32E-43) if (r0 == r1) goto L5a r1 = 404(0x194, float:5.66E-43) if (r0 == r1) goto L5a r1 = 405(0x195, float:5.68E-43) if (r0 == r1) goto L5a switch(r0) { case 300: goto L5a; case 301: goto L5a; case 302: goto L31; default: goto L30; } L30: goto L59 L31: java.lang.String r0 = "Expires" java.lang.String r0 = r3.O(r0) if (r0 != 0) goto L5a h5.h r0 = r3.z() int r0 = r0.e() r1 = -1 if (r0 != r1) goto L5a h5.h r0 = r3.z() boolean r0 = r0.d() if (r0 != 0) goto L5a h5.h r0 = r3.z() boolean r0 = r0.c() if (r0 == 0) goto L59 goto L5a L59: return r2 L5a: h5.h r3 = r3.z() boolean r3 = r3.j() if (r3 != 0) goto L6f h5.h r3 = r4.b() boolean r3 = r3.j() if (r3 != 0) goto L6f r2 = 1 L6f: return r2 */ throw new UnsupportedOperationException("Method not decompiled: j5.b.a(h5.i0, h5.h0):boolean"); } }