package L1;

import P.InterfaceC0179x;
import c1.InterfaceC0336b;
import com.google.android.gms.internal.measurement.C0357c3;
import com.google.android.gms.internal.measurement.C0367e3;
import com.google.android.gms.internal.measurement.C0412n3;
import com.google.android.gms.internal.measurement.C0441t3;
import com.google.android.gms.internal.measurement.F3;
import com.google.android.gms.internal.measurement.P3;
import com.google.android.gms.internal.measurement.R3;
import com.google.android.gms.internal.measurement.X3;
import com.google.android.gms.internal.measurement.g4;
import com.google.android.gms.internal.measurement.j4;
import com.google.android.gms.internal.measurement.p4;
import com.google.firebase.components.ComponentRegistrar;
import com.google.firebase.messaging.C0503g;
import e4.AbstractC0567k;
import io.flutter.Build;
import io.flutter.embedding.android.AndroidTouchProcessor;
import io.flutter.plugin.editing.FlutterTextUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import okhttp3.internal.publicsuffix.PublicSuffixDatabase;
import r4.AbstractC0983h;

/* JADX INFO: renamed from: L1.z, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class C0154z implements InterfaceC0145w, InterfaceC0179x, InterfaceC0336b, io.sentry.hints.h, k3.p {

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public static C0154z f2070B;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ int f2084k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2071l = new C0154z(0);

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2072m = new C0154z(1);

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2073n = new C0154z(2);

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2074o = new C0154z(3);
    public static final /* synthetic */ C0154z p = new C0154z(4);
    public static final /* synthetic */ C0154z q = new C0154z(5);

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2075r = new C0154z(6);

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2076s = new C0154z(7);

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2077t = new C0154z(8);

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2078u = new C0154z(9);

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2079v = new C0154z(10);

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2080w = new C0154z(11);

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2081x = new C0154z(12);

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2082y = new C0154z(13);

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2083z = new C0154z(14);

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public static final /* synthetic */ C0154z f2069A = new C0154z(15);

    public /* synthetic */ C0154z(int i) {
        this.f2084k = i;
    }

    public static final String d(byte[] bArr, byte[][] bArr2, int i) {
        int i5;
        boolean z5;
        int i6;
        int i7;
        int i8 = -1;
        byte[] bArr3 = PublicSuffixDatabase.f9434e;
        int length = bArr.length;
        int i9 = 0;
        while (i9 < length) {
            int i10 = (i9 + length) / 2;
            while (i10 > i8 && bArr[i10] != 10) {
                i10 += i8;
            }
            int i11 = i10 + 1;
            int i12 = 1;
            while (true) {
                i5 = i11 + i12;
                if (bArr[i5] == 10) {
                    break;
                }
                i12++;
            }
            int i13 = i5 - i11;
            int i14 = i;
            boolean z6 = false;
            int i15 = 0;
            int i16 = 0;
            while (true) {
                if (z6) {
                    i6 = 46;
                    z5 = false;
                } else {
                    byte b2 = bArr2[i14][i15];
                    byte[] bArr4 = L4.b.f2100a;
                    int i17 = b2 & 255;
                    z5 = z6;
                    i6 = i17;
                }
                byte b4 = bArr[i11 + i16];
                byte[] bArr5 = L4.b.f2100a;
                i7 = i6 - (b4 & 255);
                if (i7 != 0) {
                    break;
                }
                i16++;
                i15++;
                if (i16 == i13) {
                    break;
                }
                if (bArr2[i14].length != i15) {
                    z6 = z5;
                } else {
                    if (i14 == bArr2.length - 1) {
                        break;
                    }
                    i14++;
                    z6 = true;
                    i15 = -1;
                }
            }
            if (i7 >= 0) {
                if (i7 <= 0) {
                    int i18 = i13 - i16;
                    int length2 = bArr2[i14].length - i15;
                    int length3 = bArr2.length;
                    for (int i19 = i14 + 1; i19 < length3; i19++) {
                        length2 += bArr2[i19].length;
                    }
                    if (length2 >= i18) {
                        if (length2 <= i18) {
                            Charset charset = StandardCharsets.UTF_8;
                            AbstractC0983h.d("UTF_8", charset);
                            return new String(bArr, i11, i13, charset);
                        }
                    }
                    length = i10;
                }
                i9 = i5 + 1;
            } else {
                length = i10;
            }
            i8 = -1;
        }
        return null;
    }

    public static ArrayList e(List list) {
        AbstractC0983h.e("protocols", list);
        ArrayList arrayList = new ArrayList();
        for (Object obj : list) {
            if (((K4.s) obj) != K4.s.HTTP_1_0) {
                arrayList.add(obj);
            }
        }
        ArrayList arrayList2 = new ArrayList(AbstractC0567k.Z(arrayList));
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            arrayList2.add(((K4.s) it.next()).f1210k);
        }
        return arrayList2;
    }

    public static byte[] g(List list) {
        AbstractC0983h.e("protocols", list);
        X4.e eVar = new X4.e();
        for (String str : e(list)) {
            eVar.y(str.length());
            eVar.C(str);
        }
        return eVar.h(eVar.f3321l);
    }

    public static boolean h() {
        return "Dalvik".equals(System.getProperty("java.vm.name"));
    }

    @Override // L1.InterfaceC0145w
    public Object a() {
        switch (this.f2084k) {
            case 0:
                List list = F.f1393a;
                C0357c3.f5048l.get();
                return (String) C0367e3.f5081Y.b();
            case 1:
                List list2 = F.f1393a;
                C0357c3.f5048l.get();
                return (String) C0367e3.f5064D.b();
            case 2:
                List list3 = F.f1393a;
                C0357c3.f5048l.get();
                return (String) C0367e3.f5086b0.b();
            case 3:
                List list4 = F.f1393a;
                C0357c3.f5048l.get();
                return Integer.valueOf((int) ((Long) C0367e3.f5080W.b()).longValue());
            case 4:
                List list5 = F.f1393a;
                C0357c3.f5048l.get();
                return Integer.valueOf((int) ((Long) C0367e3.f5121v.b()).longValue());
            case 5:
                List list6 = F.f1393a;
                C0357c3.f5048l.get();
                return Integer.valueOf((int) ((Long) C0367e3.f5062B.b()).longValue());
            case 6:
                List list7 = F.f1393a;
                C0357c3.f5048l.get();
                return Integer.valueOf((int) ((Long) C0367e3.f5099i0.b()).longValue());
            case 7:
                List list8 = F.f1393a;
                Boolean bool = (Boolean) p4.f5201a.b();
                bool.getClass();
                return bool;
            case 8:
                List list9 = F.f1393a;
                Boolean bool2 = (Boolean) C0441t3.f5238a.b();
                bool2.getClass();
                return bool2;
            case AndroidTouchProcessor.PointerChange.PAN_ZOOM_END /* 9 */:
                List list10 = F.f1393a;
                Boolean bool3 = (Boolean) j4.f5162a.b();
                bool3.getClass();
                return bool3;
            case FlutterTextUtils.LINE_FEED /* 10 */:
                List list11 = F.f1393a;
                P3.f4935l.get();
                Boolean bool4 = (Boolean) R3.f4958a.b();
                bool4.getClass();
                return bool4;
            case 11:
                List list12 = F.f1393a;
                P3.f4935l.get();
                Boolean bool5 = (Boolean) R3.f4959b.b();
                bool5.getClass();
                return bool5;
            case 12:
                List list13 = F.f1393a;
                Boolean bool6 = (Boolean) C0412n3.f5188a.b();
                bool6.getClass();
                return bool6;
            case FlutterTextUtils.CARRIAGE_RETURN /* 13 */:
                List list14 = F.f1393a;
                Boolean bool7 = (Boolean) X3.f5005a.b();
                bool7.getClass();
                return bool7;
            case 14:
                return new Boolean(((Boolean) F3.f4872a.b()).booleanValue());
            default:
                return new Boolean(((Boolean) g4.f5143a.b()).booleanValue());
        }
    }

    public boolean f() {
        String[] strArr = {"/system/app/Superuser.apk", "/sbin/su", "/system/bin/su", "/system/xbin/su", "/data/local/xbin/su", "/data/local/bin/su", "/system/sd/xbin/su", "/system/bin/failsafe/su", "/data/local/su"};
        for (int i = 0; i < 9; i++) {
            if (new File(strArr[i]).exists()) {
                return true;
            }
        }
        Process processExec = null;
        try {
            processExec = Runtime.getRuntime().exec(new String[]{"/system/xbin/which", "su"});
            if (new BufferedReader(new InputStreamReader(processExec.getInputStream())).readLine() != null) {
                processExec.destroy();
                return true;
            }
        } catch (Throwable unused) {
            if (processExec != null) {
            }
            return false;
        }
        processExec.destroy();
        return false;
    }

    @Override // c4.InterfaceC0342a
    public Object get() {
        return new Q0(2, Executors.newSingleThreadExecutor());
    }

    public List i(ComponentRegistrar componentRegistrar) {
        ArrayList arrayList = new ArrayList();
        for (N2.c cVar : componentRegistrar.getComponents()) {
            String str = cVar.f2189a;
            if (str != null) {
                C0503g c0503g = new C0503g(6, str, cVar);
                cVar = new N2.c(str, cVar.f2190b, cVar.f2191c, cVar.f2192d, cVar.f2193e, c0503g, cVar.f2195g);
            }
            arrayList.add(cVar);
        }
        return arrayList;
    }

    @Override // k3.p
    public Object z() {
        switch (this.f2084k) {
            case Build.API_LEVELS.API_28 /* 28 */:
                return new ArrayDeque();
            default:
                return new ConcurrentHashMap();
        }
    }

    @Override // P.InterfaceC0179x
    public void b(int i, int i5, int i6, boolean z5) {
    }

    @Override // P.InterfaceC0179x
    public void c(int i, int i5, int i6, int i7) {
    }
}
