package h5; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; /* loaded from: classes2.dex */ public final class p { /* renamed from: j, reason: collision with root package name */ private static final Pattern f10251j = Pattern.compile("(\\d{2,4})[^\\d]*"); /* renamed from: k, reason: collision with root package name */ private static final Pattern f10252k = Pattern.compile("(?i)(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec).*"); /* renamed from: l, reason: collision with root package name */ private static final Pattern f10253l = Pattern.compile("(\\d{1,2})[^\\d]*"); /* renamed from: m, reason: collision with root package name */ private static final Pattern f10254m = Pattern.compile("(\\d{1,2}):(\\d{1,2}):(\\d{1,2})[^\\d]*"); /* renamed from: a, reason: collision with root package name */ private final String f10255a; /* renamed from: b, reason: collision with root package name */ private final String f10256b; /* renamed from: c, reason: collision with root package name */ private final long f10257c; /* renamed from: d, reason: collision with root package name */ private final String f10258d; /* renamed from: e, reason: collision with root package name */ private final String f10259e; /* renamed from: f, reason: collision with root package name */ private final boolean f10260f; /* renamed from: g, reason: collision with root package name */ private final boolean f10261g; /* renamed from: h, reason: collision with root package name */ private final boolean f10262h; /* renamed from: i, reason: collision with root package name */ private final boolean f10263i; private p(String str, String str2, long j10, String str3, String str4, boolean z10, boolean z11, boolean z12, boolean z13) { this.f10255a = str; this.f10256b = str2; this.f10257c = j10; this.f10258d = str3; this.f10259e = str4; this.f10260f = z10; this.f10261g = z11; this.f10263i = z12; this.f10262h = z13; } private static int a(String str, int i10, int i11, boolean z10) { while (i10 < i11) { char charAt = str.charAt(i10); if (((charAt < ' ' && charAt != '\t') || charAt >= 127 || (charAt >= '0' && charAt <= '9') || ((charAt >= 'a' && charAt <= 'z') || ((charAt >= 'A' && charAt <= 'Z') || charAt == ':'))) == (!z10)) { return i10; } i10++; } return i11; } private static long b(String str, int i10, int i11) { int a10 = a(str, i10, i11, false); Matcher matcher = f10254m.matcher(str); int i12 = -1; int i13 = -1; int i14 = -1; int i15 = -1; int i16 = -1; int i17 = -1; while (a10 < i11) { int a11 = a(str, a10 + 1, i11, true); matcher.region(a10, a11); if (i13 == -1 && matcher.usePattern(f10254m).matches()) { i13 = Integer.parseInt(matcher.group(1)); i16 = Integer.parseInt(matcher.group(2)); i17 = Integer.parseInt(matcher.group(3)); } else if (i14 == -1 && matcher.usePattern(f10253l).matches()) { i14 = Integer.parseInt(matcher.group(1)); } else { if (i15 == -1) { Pattern pattern = f10252k; if (matcher.usePattern(pattern).matches()) { i15 = pattern.pattern().indexOf(matcher.group(1).toLowerCase(Locale.US)) / 4; } } if (i12 == -1 && matcher.usePattern(f10251j).matches()) { i12 = Integer.parseInt(matcher.group(1)); } } a10 = a(str, a11 + 1, i11, false); } if (i12 >= 70 && i12 <= 99) { i12 += 1900; } if (i12 >= 0 && i12 <= 69) { i12 += 2000; } if (i12 < 1601) { throw new IllegalArgumentException(); } if (i15 == -1) { throw new IllegalArgumentException(); } if (i14 < 1 || i14 > 31) { throw new IllegalArgumentException(); } if (i13 < 0 || i13 > 23) { throw new IllegalArgumentException(); } if (i16 < 0 || i16 > 59) { throw new IllegalArgumentException(); } if (i17 < 0 || i17 > 59) { throw new IllegalArgumentException(); } GregorianCalendar gregorianCalendar = new GregorianCalendar(i5.c.f10886p); gregorianCalendar.setLenient(false); gregorianCalendar.set(1, i12); gregorianCalendar.set(2, i15 - 1); gregorianCalendar.set(5, i14); gregorianCalendar.set(11, i13); gregorianCalendar.set(12, i16); gregorianCalendar.set(13, i17); gregorianCalendar.set(14, 0); return gregorianCalendar.getTimeInMillis(); } /* JADX WARN: Removed duplicated region for block: B:54:0x00ed */ /* JADX WARN: Removed duplicated region for block: B:69:0x0128 */ /* JADX WARN: Removed duplicated region for block: B:71:0x00f0 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ static h5.p c(long r23, h5.b0 r25, java.lang.String r26) { /* Method dump skipped, instructions count: 311 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: h5.p.c(long, h5.b0, java.lang.String):h5.p"); } private static String d(String str) { if (str.endsWith(".")) { throw new IllegalArgumentException(); } if (str.startsWith(".")) { str = str.substring(1); } String g10 = i5.c.g(str); if (g10 != null) { return g10; } throw new IllegalArgumentException(); } private static boolean f(String str, String str2) { if (str.equals(str2)) { return true; } return str.endsWith(str2) && str.charAt((str.length() - str2.length()) - 1) == '.' && !i5.c.F(str); } private static long g(String str) { try { long parseLong = Long.parseLong(str); if (parseLong <= 0) { return Long.MIN_VALUE; } return parseLong; } catch (NumberFormatException e10) { if (str.matches("-?\\d+")) { return str.startsWith("-") ? Long.MIN_VALUE : Long.MAX_VALUE; } throw e10; } } public static p i(b0 b0Var, String str) { return c(System.currentTimeMillis(), b0Var, str); } public static List j(b0 b0Var, a0 a0Var) { List g10 = a0Var.g("Set-Cookie"); int size = g10.size(); ArrayList arrayList = null; for (int i10 = 0; i10 < size; i10++) { p i11 = i(b0Var, (String) g10.get(i10)); if (i11 != null) { if (arrayList == null) { arrayList = new ArrayList(); } arrayList.add(i11); } } return arrayList != null ? Collections.unmodifiableList(arrayList) : Collections.emptyList(); } String e(boolean z10) { String a10; StringBuilder sb = new StringBuilder(); sb.append(this.f10255a); sb.append('='); sb.append(this.f10256b); if (this.f10262h) { if (this.f10257c == Long.MIN_VALUE) { a10 = "; max-age=0"; } else { sb.append("; expires="); a10 = l5.d.a(new Date(this.f10257c)); } sb.append(a10); } if (!this.f10263i) { sb.append("; domain="); if (z10) { sb.append("."); } sb.append(this.f10258d); } sb.append("; path="); sb.append(this.f10259e); if (this.f10260f) { sb.append("; secure"); } if (this.f10261g) { sb.append("; httponly"); } return sb.toString(); } public boolean equals(Object obj) { if (!(obj instanceof p)) { return false; } p pVar = (p) obj; return pVar.f10255a.equals(this.f10255a) && pVar.f10256b.equals(this.f10256b) && pVar.f10258d.equals(this.f10258d) && pVar.f10259e.equals(this.f10259e) && pVar.f10257c == this.f10257c && pVar.f10260f == this.f10260f && pVar.f10261g == this.f10261g && pVar.f10262h == this.f10262h && pVar.f10263i == this.f10263i; } public String h() { return this.f10255a; } public int hashCode() { int hashCode = (((((((this.f10255a.hashCode() + 527) * 31) + this.f10256b.hashCode()) * 31) + this.f10258d.hashCode()) * 31) + this.f10259e.hashCode()) * 31; long j10 = this.f10257c; return ((((((((hashCode + ((int) (j10 ^ (j10 >>> 32)))) * 31) + (!this.f10260f ? 1 : 0)) * 31) + (!this.f10261g ? 1 : 0)) * 31) + (!this.f10262h ? 1 : 0)) * 31) + (!this.f10263i ? 1 : 0); } public String k() { return this.f10256b; } public String toString() { return e(false); } }