package o; import com.google.common.primitives.UnsignedBytes; import java.io.IOException; import java.util.Hashtable; import org.bouncycastle.asn1.ASN1Encoding; /* renamed from: o.gpq, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15414gpq { public static void b(StringBuffer stringBuffer, C15411gpn c15411gpn, Hashtable hashtable) { boolean z = true; if (c15411gpn.d.d.size() > 1) { C15410gpm[] b = c15411gpn.b(); for (int i = 0; i != b.length; i++) { if (z) { z = false; } else { stringBuffer.append('+'); } d(stringBuffer, b[i], hashtable); } return; } if (c15411gpn.a() != null) { d(stringBuffer, c15411gpn.a(), hashtable); } } public static String a(InterfaceC15342gnr interfaceC15342gnr) { StringBuffer stringBuffer = new StringBuffer(); if ((interfaceC15342gnr instanceof InterfaceC15322gnQ) && !(interfaceC15342gnr instanceof goH)) { String j = ((InterfaceC15322gnQ) interfaceC15342gnr).j(); if (j.length() > 0 && j.charAt(0) == '#') { stringBuffer.append("\\".concat(String.valueOf(j))); } else { stringBuffer.append(j); } } else { try { StringBuilder sb = new StringBuilder("#"); byte[] c = grS.c(interfaceC15342gnr.i().c(ASN1Encoding.DER)); int length = c.length; char[] cArr = new char[length]; for (int i = 0; i != length; i++) { cArr[i] = (char) (c[i] & UnsignedBytes.MAX_VALUE); } sb.append(new String(cArr)); stringBuffer.append(sb.toString()); } catch (IOException unused) { throw new IllegalArgumentException("Other value has no encoded form"); } } int length2 = stringBuffer.length(); int i2 = (stringBuffer.length() >= 2 && stringBuffer.charAt(0) == '\\' && stringBuffer.charAt(1) == '#') ? 2 : 0; while (i2 != length2) { if (stringBuffer.charAt(i2) == ',' || stringBuffer.charAt(i2) == '\"' || stringBuffer.charAt(i2) == '\\' || stringBuffer.charAt(i2) == '+' || stringBuffer.charAt(i2) == '=' || stringBuffer.charAt(i2) == '<' || stringBuffer.charAt(i2) == '>' || stringBuffer.charAt(i2) == ';') { stringBuffer.insert(i2, "\\"); i2++; length2++; } i2++; } if (stringBuffer.length() > 0) { for (int i3 = 0; stringBuffer.length() > i3 && stringBuffer.charAt(i3) == ' '; i3 += 2) { stringBuffer.insert(i3, "\\"); } } for (int length3 = stringBuffer.length() - 1; length3 >= 0 && stringBuffer.charAt(length3) == ' '; length3--) { stringBuffer.insert(length3, '\\'); } return stringBuffer.toString(); } /* JADX WARN: Code restructure failed: missing block: B:29:0x0066, code lost: if (r0 >= (r6.length() - 1)) goto L30; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static java.lang.String b(java.lang.String r6) { /* java.lang.String r6 = o.grR.c(r6) int r0 = r6.length() r1 = 0 if (r0 <= 0) goto L25 char r0 = r6.charAt(r1) r2 = 35 if (r0 != r2) goto L25 o.gnE r0 = e(r6) boolean r2 = r0 instanceof o.InterfaceC15322gnQ if (r2 == 0) goto L25 o.gnQ r0 = (o.InterfaceC15322gnQ) r0 java.lang.String r6 = r0.j() java.lang.String r6 = o.grR.c(r6) L25: int r0 = r6.length() r2 = 1 if (r0 <= r2) goto L6d L2c: int r0 = r1 + 1 int r3 = r6.length() r4 = 32 r5 = 92 if (r0 >= r3) goto L47 char r3 = r6.charAt(r1) if (r3 != r5) goto L47 char r0 = r6.charAt(r0) if (r0 != r4) goto L47 int r1 = r1 + 2 goto L2c L47: int r0 = r6.length() int r0 = r0 - r2 L4c: int r3 = r0 + (-1) if (r3 <= 0) goto L5f char r3 = r6.charAt(r3) if (r3 != r5) goto L5f char r3 = r6.charAt(r0) if (r3 != r4) goto L5f int r0 = r0 + (-2) goto L4c L5f: if (r1 > 0) goto L68 int r3 = r6.length() int r3 = r3 - r2 if (r0 >= r3) goto L6d L68: int r0 = r0 + r2 java.lang.String r6 = r6.substring(r1, r0) L6d: java.lang.String r6 = d(r6) return r6 */ throw new UnsupportedOperationException("Method not decompiled: o.C15414gpq.b(java.lang.String):java.lang.String"); } private static AbstractC15315gnE e(String str) { try { return AbstractC15315gnE.b(grS.b(str.substring(1))); } catch (IOException e) { throw new IllegalStateException("unknown encoding in name: ".concat(String.valueOf(e))); } } private static String d(String str) { StringBuffer stringBuffer = new StringBuffer(); if (str.length() != 0) { char charAt = str.charAt(0); stringBuffer.append(charAt); int i = 1; while (i < str.length()) { char charAt2 = str.charAt(i); if (charAt != ' ' || charAt2 != ' ') { stringBuffer.append(charAt2); } i++; charAt = charAt2; } } return stringBuffer.toString(); } public static boolean d(C15411gpn c15411gpn, C15411gpn c15411gpn2) { if (c15411gpn.d.d.size() > 1) { if (c15411gpn2.d.d.size() <= 1) { return false; } C15410gpm[] b = c15411gpn.b(); C15410gpm[] b2 = c15411gpn2.b(); if (b.length != b2.length) { return false; } for (int i = 0; i != b.length; i++) { if (!d(b[i], b2[i])) { return false; } } return true; } if (c15411gpn2.d.d.size() <= 1) { return d(c15411gpn.a(), c15411gpn2.a()); } return false; } private static void d(StringBuffer stringBuffer, C15410gpm c15410gpm, Hashtable hashtable) { String str = (String) hashtable.get(c15410gpm.d); if (str != null) { stringBuffer.append(str); } else { stringBuffer.append(c15410gpm.d.d); } stringBuffer.append('='); stringBuffer.append(a(c15410gpm.c)); } private static boolean d(C15410gpm c15410gpm, C15410gpm c15410gpm2) { if (c15410gpm == c15410gpm2) { return true; } return c15410gpm != null && c15410gpm2 != null && c15410gpm.d.equals(c15410gpm2.d) && b(a(c15410gpm.c)).equals(b(a(c15410gpm2.c))); } }