package o; import com.airbnb.deeplinkdispatch.UrlTreeKt; import com.huawei.hms.android.SystemUtils; import java.io.IOException; import java.io.PrintStream; import java.io.Reader; import java.util.Hashtable; import org.xmlpull.repackaged.v1.XmlPullParserException; /* renamed from: o.gng, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15331gng implements InterfaceC15578gue { private String A; private int B; private Reader C; private String D; private String E; private int F; private String G; private boolean I; private Hashtable b; private char[] c; private int e; private int f; private int g; private int i; private int j; private boolean l; private boolean n; /* renamed from: o, reason: collision with root package name */ private int f9145o; private boolean p; private Object q; private boolean r; private boolean s; private int t; private Boolean u; private boolean v; private String w; private String z; private String[] a = new String[16]; private String[] y = new String[8]; private int[] x = new int[4]; private char[] h = new char[128]; private String[] k = new String[16]; private int[] m = new int[2]; public C15331gng() { this.c = new char[Runtime.getRuntime().freeMemory() >= 1048576 ? 8192 : 128]; } private final void e(String str) throws XmlPullParserException { if (!this.I) { b(str); } else if (this.A == null) { this.A = "ERR: ".concat(String.valueOf(str)); } } private final void b(String str) throws XmlPullParserException { if (str.length() >= 100) { StringBuilder sb = new StringBuilder(); sb.append(str.substring(0, 100)); sb.append("\n"); str = sb.toString(); } throw new XmlPullParserException(str, this, null); } private final void p() throws IOException, XmlPullParserException { String str; int i; int i2; int i3; if (this.C == null) { b("No Input specified"); } if (this.F == 3) { this.e--; } do { this.f9145o = -1; int i4 = 0; if (this.l) { this.l = false; this.F = 3; return; } if (this.A != null) { while (i4 < this.A.length()) { f(this.A.charAt(i4)); i4++; } this.A = null; this.F = 9; return; } this.E = null; this.D = null; this.z = null; int r = r(); this.F = r; if (r == 1) { return; } int i5 = 2; if (r == 2) { d(false); return; } if (r == 3) { q(); q(); this.D = s(); while (true) { int h = h(0); if (h > 32 || h == -1) { break; } else { q(); } } d(UrlTreeKt.configurablePathSegmentSuffixChar); int i6 = this.e; int i7 = (i6 - 1) << 2; if (i6 == 0) { e("element stack empty"); this.F = 9; return; } if (this.I) { return; } int i8 = i7 + 3; if (!this.D.equals(this.a[i8])) { StringBuilder sb = new StringBuilder("expected: /"); sb.append(this.a[i8]); sb.append(" read: "); sb.append(this.D); e(sb.toString()); } String[] strArr = this.a; this.z = strArr[i7]; this.E = strArr[i7 + 1]; this.D = strArr[i7 + 2]; return; } if (r == 4) { e(60, !this.s); if (this.e == 0 && this.n) { this.F = 7; return; } return; } if (r == 6) { t(); return; } boolean z = this.s; q(); int q = q(); if (q == 63) { if ((h(0) == 120 || h(0) == 88) && (h(1) == 109 || h(1) == 77)) { if (z) { f(h(0)); f(h(1)); } q(); q(); if ((h(0) == 108 || h(0) == 76) && h(1) <= 32) { if (this.f != 1 || this.B > 4) { e("PI must not start with xml"); } d(true); if (this.f9145o <= 0 || !"version".equals(this.k[2])) { e("version expected"); } String[] strArr2 = this.k; this.G = strArr2[3]; if (1 >= this.f9145o || !"encoding".equals(strArr2[6])) { i5 = 1; } else { this.w = this.k[7]; } if (i5 < this.f9145o) { int i9 = i5 << 2; if ("standalone".equals(this.k[i9 + 2])) { String str2 = this.k[i9 + 3]; if ("yes".equals(str2)) { this.u = Boolean.TRUE; } else if ("no".equals(str2)) { this.u = Boolean.FALSE; } else { e("illegal standalone value: ".concat(String.valueOf(str2))); } i5++; } } if (i5 != this.f9145o) { e("illegal xmldecl"); } this.n = true; this.g = 0; i3 = 998; this.F = i3; } } i = 8; str = ""; i2 = 63; } else if (q == 33) { if (h(0) == 45) { str = "--"; i2 = 45; i = 9; } else if (h(0) == 91) { i = 5; str = "[CDATA["; i2 = 93; z = true; } else { str = "DOCTYPE"; i = 10; i2 = -1; } } else { e("illegal: <".concat(String.valueOf(q))); i3 = 9; this.F = i3; } for (int i10 = 0; i10 < str.length(); i10++) { d(str.charAt(i10)); } if (i == 10) { int i11 = 1; while (true) { int q2 = q(); if (q2 == -1) { e("Unexpected EOF"); break; } if (q2 == 39) { i4 ^= 1; } else if (q2 != 60) { if (q2 == 62 && i4 == 0 && i11 - 1 == 0) { break; } } else if (i4 == 0) { i11++; } if (z) { f(q2); } } } else { int i12 = 0; while (true) { int q3 = q(); if (q3 == -1) { e("Unexpected EOF"); break; } if (z) { f(q3); } if ((i2 == 63 || q3 == i2) && h(0) == i2 && h(1) == 62) { if (i2 == 45 && i12 == 45 && !this.I) { e("illegal comment delimiter: --->"); } q(); q(); if (z && i2 != 63) { this.g--; } } else { i12 = q3; } } i3 = 9; this.F = i3; } i3 = i; this.F = i3; } while (i3 == 998); } private final int r() throws IOException { int h = h(0); if (h == -1) { return 1; } if (h == 38) { return 6; } if (h != 60) { return 4; } int h2 = h(1); if (h2 == 33) { return 999; } if (h2 != 47) { return h2 != 63 ? 2 : 999; } return 3; } private final void f(int i) { this.n &= i <= 32; int i2 = this.g; char[] cArr = this.h; if (i2 == cArr.length) { char[] cArr2 = new char[((i2 << 2) / 3) + 4]; System.arraycopy(cArr, 0, cArr2, 0, i2); this.h = cArr2; } char[] cArr3 = this.h; int i3 = this.g; this.g = i3 + 1; cArr3[i3] = (char) i; } private final void d(boolean z) throws IOException, XmlPullParserException { int i; String str; if (!z) { q(); } this.D = s(); this.f9145o = 0; while (true) { int h = h(0); if (h > 32 || h == -1) { int h2 = h(0); if (!z) { if (h2 == 47) { this.l = true; q(); while (true) { int h3 = h(0); if (h3 > 32 || h3 == -1) { break; } else { q(); } } d(UrlTreeKt.configurablePathSegmentSuffixChar); } else if (h2 == 62 && !z) { q(); break; } } else if (h2 == 63) { q(); d(UrlTreeKt.configurablePathSegmentSuffixChar); return; } if (h2 == -1) { e("Unexpected EOF"); return; } String s = s(); if (s.length() == 0) { e("attr name expected"); break; } int i2 = this.f9145o; this.f9145o = i2 + 1; int i3 = i2 << 2; String[] strArr = this.k; if (strArr.length < i3 + 4) { String[] strArr2 = new String[i3 + 20]; System.arraycopy(strArr, 0, strArr2, 0, strArr.length); strArr = strArr2; } this.k = strArr; strArr[i3] = ""; strArr[i3 + 1] = null; int i4 = i3 + 3; strArr[i3 + 2] = s; while (true) { int h4 = h(0); if (h4 > 32 || h4 == -1) { break; } else { q(); } } if (h(0) != 61) { if (!this.I) { e("Attr.value missing f. ".concat(String.valueOf(s))); } this.k[i4] = s; } else { d('='); while (true) { int h5 = h(0); if (h5 > 32 || h5 == -1) { break; } else { q(); } } int h6 = h(0); if (h6 == 39 || h6 == 34) { q(); } else { if (!this.I) { e("attr value delimiter missing!"); } h6 = 32; } int i5 = this.g; e(h6, true); this.k[i4] = new String(this.h, i5, this.g - i5); this.g = i5; if (h6 != 32) { q(); } } } else { q(); } } int i6 = this.e; this.e = i6 + 1; int i7 = i6 << 2; String[] strArr3 = this.a; if (strArr3.length < i7 + 4) { String[] strArr4 = new String[i7 + 20]; System.arraycopy(strArr3, 0, strArr4, 0, strArr3.length); strArr3 = strArr4; } this.a = strArr3; strArr3[i7 + 3] = this.D; int i8 = this.e; int[] iArr = this.x; if (i8 >= iArr.length) { int[] iArr2 = new int[i8 + 4]; System.arraycopy(iArr, 0, iArr2, 0, iArr.length); this.x = iArr2; } int[] iArr3 = this.x; int i9 = this.e; iArr3[i9] = iArr3[i9 - 1]; if (!this.v) { this.z = ""; } else { int i10 = 0; boolean z2 = false; while (true) { i = this.f9145o << 2; if (i10 >= i) { break; } String str2 = this.k[i10 + 2]; int indexOf = str2.indexOf(58); if (indexOf != -1) { String substring = str2.substring(0, indexOf); str = str2.substring(indexOf + 1); str2 = substring; } else if (str2.equals("xmlns")) { str = null; } else { i10 += 4; } if (str2.equals("xmlns")) { int[] iArr4 = this.x; int i11 = this.e; int i12 = iArr4[i11]; iArr4[i11] = i12 + 1; int i13 = i12 << 1; String[] strArr5 = this.y; if (strArr5.length < i13 + 2) { String[] strArr6 = new String[i13 + 18]; System.arraycopy(strArr5, 0, strArr6, 0, strArr5.length); strArr5 = strArr6; } this.y = strArr5; strArr5[i13] = str; String[] strArr7 = this.k; int i14 = i10 + 3; strArr5[i13 + 1] = strArr7[i14]; if (str != null && strArr7[i14].equals("")) { e("illegal empty namespace"); } String[] strArr8 = this.k; int i15 = this.f9145o - 1; this.f9145o = i15; System.arraycopy(strArr8, i10 + 4, strArr8, i10, (i15 << 2) - i10); i10 -= 4; } else { z2 = true; } i10 += 4; } if (z2) { for (int i16 = i - 4; i16 >= 0; i16 -= 4) { int i17 = i16 + 2; String str3 = this.k[i17]; int indexOf2 = str3.indexOf(58); if (indexOf2 == 0 && !this.I) { StringBuilder sb = new StringBuilder("illegal attribute name: "); sb.append(str3); sb.append(" at "); sb.append(this); throw new RuntimeException(sb.toString()); } if (indexOf2 != -1) { String substring2 = str3.substring(0, indexOf2); String substring3 = str3.substring(indexOf2 + 1); String c = c(substring2); if (c == null && !this.I) { StringBuilder sb2 = new StringBuilder("Undefined Prefix: "); sb2.append(substring2); sb2.append(" in "); sb2.append(this); throw new RuntimeException(sb2.toString()); } String[] strArr9 = this.k; strArr9[i16] = c; strArr9[i16 + 1] = substring2; strArr9[i17] = substring3; } } } int indexOf3 = this.D.indexOf(58); if (indexOf3 == 0) { StringBuilder sb3 = new StringBuilder("illegal tag name: "); sb3.append(this.D); e(sb3.toString()); } if (indexOf3 != -1) { this.E = this.D.substring(0, indexOf3); this.D = this.D.substring(indexOf3 + 1); } String c2 = c(this.E); this.z = c2; if (c2 == null) { if (this.E != null) { StringBuilder sb4 = new StringBuilder("undefined prefix: "); sb4.append(this.E); e(sb4.toString()); } this.z = ""; } } String[] strArr10 = this.a; strArr10[i7] = this.z; strArr10[i7 + 1] = this.E; strArr10[i7 + 2] = this.D; } private final void t() throws IOException, XmlPullParserException { f(q()); int i = this.g; while (true) { int h = h(0); if (h == 59) { q(); String str = new String(this.h, i, this.g - i); this.g = i - 1; if (this.s && this.F == 6) { this.D = str; } if (str.charAt(0) == '#') { f(str.charAt(1) == 'x' ? Integer.parseInt(str.substring(2), 16) : Integer.parseInt(str.substring(1))); return; } String str2 = (String) this.b.get(str); boolean z = str2 == null; this.r = z; if (z) { if (this.s) { return; } StringBuilder sb = new StringBuilder("unresolved: &"); sb.append(str); sb.append(";"); e(sb.toString()); return; } for (int i2 = 0; i2 < str2.length(); i2++) { f(str2.charAt(i2)); } return; } if (h < 128 && ((h < 48 || h > 57) && ((h < 97 || h > 122) && ((h < 65 || h > 90) && h != 95 && h != 45 && h != 35)))) { if (!this.I) { e("unterminated entity ref"); } PrintStream printStream = System.out; StringBuilder sb2 = new StringBuilder("broken entitiy: "); int i3 = i - 1; sb2.append(new String(this.h, i3, this.g - i3)); printStream.println(sb2.toString()); return; } f(q()); } } private final void e(int i, boolean z) throws IOException, XmlPullParserException { int h = h(0); int i2 = 0; while (h != -1 && h != i) { if (i == 32 && (h <= 32 || h == 62)) { return; } if (h == 38) { if (!z) { return; } else { t(); } } else if (h == 10 && this.F == 2) { q(); f(32); } else { f(q()); } if (h == 62 && i2 >= 2 && i != 93) { e("Illegal: ]]>"); } i2 = h == 93 ? i2 + 1 : 0; h = h(0); } } private final void d(char c) throws IOException, XmlPullParserException { int q = q(); if (q != c) { StringBuilder sb = new StringBuilder("expected: '"); sb.append(c); sb.append("' actual: '"); sb.append((char) q); sb.append("'"); e(sb.toString()); } } private final int q() throws IOException { int i; if (this.t == 0) { i = h(0); } else { int[] iArr = this.m; int i2 = iArr[0]; iArr[0] = iArr[1]; i = i2; } this.t--; this.B++; if (i == 10) { this.f++; this.B = 1; } return i; } private final int h(int i) throws IOException { int i2; while (i >= this.t) { char[] cArr = this.c; if (cArr.length <= 1) { i2 = this.C.read(); } else { int i3 = this.j; if (i3 < this.i) { this.j = i3 + 1; i2 = cArr[i3]; } else { int read = this.C.read(cArr, 0, cArr.length); this.i = read; int i4 = read <= 0 ? -1 : this.c[0]; this.j = 1; i2 = i4; } } if (i2 == 13) { this.p = true; int[] iArr = this.m; int i5 = this.t; this.t = i5 + 1; iArr[i5] = 10; } else { if (i2 != 10) { int[] iArr2 = this.m; int i6 = this.t; this.t = i6 + 1; iArr2[i6] = i2; } else if (!this.p) { int[] iArr3 = this.m; int i7 = this.t; this.t = i7 + 1; iArr3[i7] = 10; } this.p = false; } } return this.m[i]; } private final String s() throws IOException, XmlPullParserException { int i = this.g; int h = h(0); if ((h < 97 || h > 122) && ((h < 65 || h > 90) && h != 95 && h != 58 && h < 192 && !this.I)) { e("name expected"); } while (true) { f(q()); int h2 = h(0); if (h2 < 97 || h2 > 122) { if (h2 < 65 || h2 > 90) { if (h2 < 48 || h2 > 57) { if (h2 != 95 && h2 != 45 && h2 != 58 && h2 != 46 && h2 < 183) { String str = new String(this.h, i, this.g - i); this.g = i; return str; } } } } } } /* JADX WARN: Failed to find 'out' block for switch in B:15:0x0030. Please report as an issue. */ /* JADX WARN: Removed duplicated region for block: B:32:0x00ac A[Catch: Exception -> 0x0146, TRY_ENTER, TRY_LEAVE, TryCatch #0 {Exception -> 0x0146, blocks: (B:5:0x0008, B:7:0x000e, B:9:0x0014, B:11:0x0023, B:16:0x0035, B:18:0x003b, B:21:0x004a, B:23:0x0057, B:25:0x005f, B:27:0x0067, B:29:0x006a, B:32:0x00ac, B:36:0x00ea, B:43:0x00c1, B:47:0x00d9, B:52:0x0079, B:53:0x0082, B:55:0x0089, B:56:0x0092, B:58:0x0095, B:59:0x009e), top: B:4:0x0008 }] */ /* JADX WARN: Removed duplicated region for block: B:41:0x00bd */ @Override // o.InterfaceC15578gue /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void b(java.io.InputStream r13) throws org.xmlpull.repackaged.v1.XmlPullParserException { /* Method dump skipped, instructions count: 388 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.C15331gng.b(java.io.InputStream):void"); } @Override // o.InterfaceC15578gue public final int a(int i) { if (i > this.e) { throw new IndexOutOfBoundsException(); } return this.x[i]; } @Override // o.InterfaceC15578gue public final String e(int i) { return this.y[i << 1]; } @Override // o.InterfaceC15578gue public final String g(int i) { return this.y[(i << 1) + 1]; } @Override // o.InterfaceC15578gue public final String c(String str) { if ("xml".equals(str)) { return "http://www.w3.org/XML/1998/namespace"; } if ("xmlns".equals(str)) { return "http://www.w3.org/2000/xmlns/"; } for (int i = (this.x[this.e] << 1) - 2; i >= 0; i -= 2) { if (str == null) { String[] strArr = this.y; if (strArr[i] == null) { return strArr[i + 1]; } } else if (str.equals(this.y[i])) { return this.y[i + 1]; } } return null; } @Override // o.InterfaceC15578gue public final String f() { StringBuffer stringBuffer = new StringBuffer(this.F < d.length ? d[this.F] : SystemUtils.UNKNOWN); stringBuffer.append(' '); int i = this.F; if (i == 2 || i == 3) { if (this.l) { stringBuffer.append("(empty) "); } stringBuffer.append(UrlTreeKt.configurablePathSegmentPrefixChar); if (this.F == 3) { stringBuffer.append('/'); } if (this.E != null) { StringBuilder sb = new StringBuilder(UrlTreeKt.componentParamPrefix); sb.append(this.z); sb.append(UrlTreeKt.componentParamSuffix); sb.append(this.E); sb.append(":"); stringBuffer.append(sb.toString()); } stringBuffer.append(this.D); int i2 = this.f9145o; for (int i3 = 0; i3 < (i2 << 2); i3 += 4) { stringBuffer.append(' '); int i4 = i3 + 1; if (this.k[i4] != null) { StringBuilder sb2 = new StringBuilder(UrlTreeKt.componentParamPrefix); sb2.append(this.k[i3]); sb2.append(UrlTreeKt.componentParamSuffix); sb2.append(this.k[i4]); sb2.append(":"); stringBuffer.append(sb2.toString()); } StringBuilder sb3 = new StringBuilder(); sb3.append(this.k[i3 + 2]); sb3.append("='"); sb3.append(this.k[i3 + 3]); sb3.append("'"); stringBuffer.append(sb3.toString()); } stringBuffer.append(UrlTreeKt.configurablePathSegmentSuffixChar); } else if (i != 7) { if (i != 4) { stringBuffer.append(g()); } else if (this.n) { stringBuffer.append("(whitespace)"); } else { String g = g(); if (g.length() > 16) { StringBuilder sb4 = new StringBuilder(); sb4.append(g.substring(0, 16)); sb4.append("..."); g = sb4.toString(); } stringBuffer.append(g); } } StringBuilder sb5 = new StringBuilder("@"); sb5.append(this.f); sb5.append(":"); sb5.append(this.B); stringBuffer.append(sb5.toString()); if (this.C != null) { stringBuffer.append(" in "); stringBuffer.append(this.C.toString()); } return stringBuffer.toString(); } @Override // o.InterfaceC15578gue public final boolean o() throws XmlPullParserException { if (this.F != 2) { b("Wrong event type"); } return this.l; } @Override // o.InterfaceC15578gue public final String c(int i) { if (i >= this.f9145o) { throw new IndexOutOfBoundsException(); } return this.k[i << 2]; } @Override // o.InterfaceC15578gue public final String d(int i) { if (i >= this.f9145o) { throw new IndexOutOfBoundsException(); } return this.k[(i << 2) + 2]; } @Override // o.InterfaceC15578gue public final String b(int i) { if (i >= this.f9145o) { throw new IndexOutOfBoundsException(); } return this.k[(i << 2) + 3]; } @Override // o.InterfaceC15578gue public final String a(String str, String str2) { for (int i = (this.f9145o << 2) - 4; i >= 0; i -= 4) { if (this.k[i + 2].equals(str2) && (str == null || this.k[i].equals(str))) { return this.k[i + 3]; } } return null; } @Override // o.InterfaceC15578gue public final int m() throws XmlPullParserException, IOException { this.g = 0; this.n = true; this.s = false; int i = gsX.MAX_VALUE_OF_ERA; while (true) { p(); int i2 = this.F; if (i2 < i) { i = i2; } if (i > 6 || (i >= 4 && r() >= 4)) { } } this.F = i; if (i > 4) { this.F = 4; } return this.F; } @Override // o.InterfaceC15578gue public final int k() throws XmlPullParserException, IOException { this.n = true; this.g = 0; this.s = true; p(); return this.F; } @Override // o.InterfaceC15578gue public final int n() throws XmlPullParserException, IOException { m(); if (this.F == 4 && this.n) { m(); } int i = this.F; if (i != 3 && i != 2) { b("unexpected type"); } return this.F; } @Override // o.InterfaceC15578gue public final String l() throws XmlPullParserException, IOException { String str; if (this.F != 2) { b("precondition: START_TAG"); } m(); if (this.F == 4) { str = g(); m(); } else { str = ""; } if (this.F != 3) { b("END_TAG expected"); } return str; } @Override // o.InterfaceC15578gue public final void d(String str) throws XmlPullParserException { if ("http://xmlpull.org/v1/doc/features.html#process-namespaces".equals(str)) { this.v = true; } else if (str.startsWith("http://xmlpull.org/v1/doc/") && str.substring(40).equals("relaxed")) { this.I = true; } else { b("unsupported feature: ".concat(String.valueOf(str))); } } @Override // o.InterfaceC15578gue public final String g() { int i = this.F; if (i < 4 || (i == 6 && this.r)) { return null; } return new String(this.h, 0, this.g); } @Override // o.InterfaceC15578gue public final void d(int i, String str, String str2) throws XmlPullParserException, IOException { if (i == this.F && ((str == null || str.equals(this.z)) && (str2 == null || str2.equals(this.D)))) { return; } StringBuilder sb = new StringBuilder("expected: "); sb.append(d[i]); sb.append(" {"); sb.append(str); sb.append(UrlTreeKt.componentParamSuffix); sb.append(str2); b(sb.toString()); } @Override // o.InterfaceC15578gue public final String i() { return this.z; } @Override // o.InterfaceC15578gue public final String h() { return this.D; } @Override // o.InterfaceC15578gue public final int j() { return this.f; } @Override // o.InterfaceC15578gue public final int b() throws XmlPullParserException { return this.F; } @Override // o.InterfaceC15578gue public final int d() { return this.e; } @Override // o.InterfaceC15578gue public final int e() { return this.B; } @Override // o.InterfaceC15578gue public final String a() { return "CDATA"; } @Override // o.InterfaceC15578gue public final int c() { return this.f9145o; } }