package androidx.navigation;

import V4.t0;
import V4.u0;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import androidx.lifecycle.EnumC1108q;
import androidx.media3.exoplayer.source.ProgressiveMediaSource;
import java.io.File;
import java.io.Serializable;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
import m4.AbstractC2504f0;
import m4.e2;
import p5.AbstractC2731a;
import p5.AbstractC2732b;
import p5.C2733c;
import p5.C2736f;
import p5.C2740j;
import p5.C2743m;
import t3.InterfaceC2949b;
import x3.C3216a;
import x3.C3217b;
import x3.EnumC3219d;
import x4.AbstractC3250p;

/* JADX INFO: renamed from: androidx.navigation.i, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1134i implements d5.a, B0.a, l2.d, e2, InterfaceC2949b {

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

    public /* synthetic */ C1134i(int i6) {
        this.f12753a = i6;
    }

    public static final void e(C2736f c2736f, long j4, boolean z6) {
        C2736f c2736f2;
        ReentrantLock reentrantLock = C2736f.f23089h;
        if (C2736f.l == null) {
            C2736f.l = new C2736f();
            C2733c c2733c = new C2733c("Okio Watchdog");
            c2733c.setDaemon(true);
            c2733c.start();
        }
        long jNanoTime = System.nanoTime();
        if (j4 != 0 && z6) {
            c2736f.f23095g = Math.min(j4, c2736f.c() - jNanoTime) + jNanoTime;
        } else if (j4 != 0) {
            c2736f.f23095g = j4 + jNanoTime;
        } else {
            if (!z6) {
                throw new AssertionError();
            }
            c2736f.f23095g = c2736f.c();
        }
        long j6 = c2736f.f23095g - jNanoTime;
        C2736f c2736f3 = C2736f.l;
        kotlin.jvm.internal.o.e(c2736f3);
        while (true) {
            c2736f2 = c2736f3.f23094f;
            if (c2736f2 == null || j6 < c2736f2.f23095g - jNanoTime) {
                break;
            }
            kotlin.jvm.internal.o.e(c2736f2);
            c2736f3 = c2736f2;
        }
        c2736f.f23094f = c2736f2;
        c2736f3.f23094f = c2736f;
        if (c2736f3 == C2736f.l) {
            C2736f.f23090i.signal();
        }
    }

    public static final boolean f(p5.G g6) {
        p5.G g7 = q5.i.f23764d;
        return !S4.w.s0(g6.b(), ".class", true);
    }

    public static final float g(float f6, float[] fArr, float[] fArr2) {
        float f7;
        float f8;
        float f9;
        float f10;
        float fAbs = Math.abs(f6);
        float fSignum = Math.signum(f6);
        int iBinarySearch = Arrays.binarySearch(fArr, fAbs);
        if (iBinarySearch >= 0) {
            return fSignum * fArr2[iBinarySearch];
        }
        int i6 = -(iBinarySearch + 1);
        int i7 = i6 - 1;
        if (i7 >= fArr.length - 1) {
            float f11 = fArr[fArr.length - 1];
            float f12 = fArr2[fArr.length - 1];
            if (f11 == 0.0f) {
                return 0.0f;
            }
            return (f12 / f11) * f6;
        }
        if (i7 == -1) {
            float f13 = fArr[0];
            f9 = fArr2[0];
            f10 = f13;
            f8 = 0.0f;
            f7 = 0.0f;
        } else {
            float f14 = fArr[i7];
            float f15 = fArr[i6];
            f7 = fArr2[i7];
            f8 = f14;
            f9 = fArr2[i6];
            f10 = f15;
        }
        return (((f9 - f7) * Math.max(0.0f, Math.min(1.0f, f8 == f10 ? 0.0f : (fAbs - f8) / (f10 - f8)))) + f7) * fSignum;
    }

    public static n4.u h(int i6) {
        return new n4.u(new C2740j(), Math.min(ProgressiveMediaSource.DEFAULT_LOADING_CHECK_INTERVAL_BYTES, Math.max(4096, i6)));
    }

    public static C2736f i() throws InterruptedException {
        C2736f c2736f = C2736f.l;
        kotlin.jvm.internal.o.e(c2736f);
        C2736f c2736f2 = c2736f.f23094f;
        if (c2736f2 == null) {
            long jNanoTime = System.nanoTime();
            C2736f.f23090i.await(C2736f.f23091j, TimeUnit.MILLISECONDS);
            C2736f c2736f3 = C2736f.l;
            kotlin.jvm.internal.o.e(c2736f3);
            if (c2736f3.f23094f != null || System.nanoTime() - jNanoTime < C2736f.f23092k) {
                return null;
            }
            return C2736f.l;
        }
        long jNanoTime2 = c2736f2.f23095g - System.nanoTime();
        if (jNanoTime2 > 0) {
            C2736f.f23090i.await(jNanoTime2, TimeUnit.NANOSECONDS);
            return null;
        }
        C2736f c2736f4 = C2736f.l;
        kotlin.jvm.internal.o.e(c2736f4);
        c2736f4.f23094f = c2736f2.f23094f;
        c2736f2.f23094f = null;
        c2736f2.f23093e = 2;
        return c2736f2;
    }

    public static C1137l j(Context context, B destination, Bundle bundle, EnumC1108q hostLifecycleState, V v3) {
        String string = UUID.randomUUID().toString();
        kotlin.jvm.internal.o.g(string, "randomUUID().toString()");
        kotlin.jvm.internal.o.h(destination, "destination");
        kotlin.jvm.internal.o.h(hostLifecycleState, "hostLifecycleState");
        return new C1137l(context, destination, bundle, hostLifecycleState, v3, string, null);
    }

    public static C2743m l(String str) {
        char c6;
        int i6;
        char cCharAt;
        char c7 = 'A';
        kotlin.jvm.internal.o.h(str, "<this>");
        byte[] bArr = AbstractC2731a.f23082a;
        int length = str.length();
        while (true) {
            c6 = '\t';
            if (length <= 0 || !((cCharAt = str.charAt(length - 1)) == '=' || cCharAt == '\n' || cCharAt == '\r' || cCharAt == ' ' || cCharAt == '\t')) {
                break;
            }
            length--;
        }
        int i7 = (int) ((((long) length) * 6) / 8);
        byte[] bArrCopyOf = new byte[i7];
        int i8 = 0;
        int i9 = 0;
        int i10 = 0;
        int i11 = 0;
        while (true) {
            if (i8 < length) {
                char cCharAt2 = str.charAt(i8);
                char c8 = c7;
                if (c7 <= cCharAt2 && cCharAt2 < '[') {
                    i6 = cCharAt2 - 'A';
                } else if ('a' <= cCharAt2 && cCharAt2 < '{') {
                    i6 = cCharAt2 - 'G';
                } else if ('0' <= cCharAt2 && cCharAt2 < ':') {
                    i6 = cCharAt2 + 4;
                } else if (cCharAt2 != '+' && cCharAt2 != '-') {
                    if (cCharAt2 != '/' && cCharAt2 != '_') {
                        if (cCharAt2 != '\n' && cCharAt2 != '\r' && cCharAt2 != ' ' && cCharAt2 != c6) {
                            break;
                        }
                        i8++;
                        c7 = c8;
                        c6 = '\t';
                    } else {
                        i6 = 63;
                    }
                } else {
                    i6 = 62;
                }
                int i12 = i6 | (i10 << 6);
                i9++;
                if (i9 % 4 == 0) {
                    bArrCopyOf[i11] = (byte) (i12 >> 16);
                    int i13 = i11 + 2;
                    bArrCopyOf[i11 + 1] = (byte) (i12 >> 8);
                    i11 += 3;
                    bArrCopyOf[i13] = (byte) i12;
                }
                i10 = i12;
                i8++;
                c7 = c8;
                c6 = '\t';
            } else {
                int i14 = i9 % 4;
                if (i14 != 1) {
                    if (i14 == 2) {
                        bArrCopyOf[i11] = (byte) ((i10 << 12) >> 16);
                        i11 = 1 + i11;
                    } else if (i14 == 3) {
                        int i15 = i10 << 6;
                        int i16 = 1 + i11;
                        bArrCopyOf[i11] = (byte) (i15 >> 16);
                        i11 += 2;
                        bArrCopyOf[i16] = (byte) (i15 >> 8);
                    }
                    if (i11 != i7) {
                        bArrCopyOf = Arrays.copyOf(bArrCopyOf, i11);
                        kotlin.jvm.internal.o.g(bArrCopyOf, "copyOf(...)");
                    }
                }
            }
        }
        bArrCopyOf = null;
        if (bArrCopyOf != null) {
            return new C2743m(bArrCopyOf);
        }
        return null;
    }

    public static C2743m m(String str) {
        if (str.length() % 2 != 0) {
            throw new IllegalArgumentException("Unexpected hex string: ".concat(str).toString());
        }
        int length = str.length() / 2;
        byte[] bArr = new byte[length];
        for (int i6 = 0; i6 < length; i6++) {
            int i7 = i6 * 2;
            bArr[i6] = (byte) (q5.b.a(str.charAt(i7 + 1)) + (q5.b.a(str.charAt(i7)) << 4));
        }
        return new C2743m(bArr);
    }

    public static C2743m n(String str) {
        kotlin.jvm.internal.o.h(str, "<this>");
        byte[] bytes = str.getBytes(S4.a.f6257a);
        kotlin.jvm.internal.o.g(bytes, "getBytes(...)");
        C2743m c2743m = new C2743m(bytes);
        c2743m.f23104c = str;
        return c2743m;
    }

    public static p5.G o(String str, boolean z6) {
        kotlin.jvm.internal.o.h(str, "<this>");
        C2743m c2743m = q5.f.f23754a;
        C2740j c2740j = new C2740j();
        c2740j.W(str);
        return q5.f.d(c2740j, z6);
    }

    public static p5.G p(File file) {
        String str = p5.G.f23047b;
        kotlin.jvm.internal.o.h(file, "<this>");
        String string = file.toString();
        kotlin.jvm.internal.o.g(string, "toString(...)");
        return o(string, false);
    }

    public static p5.G q(Path path) {
        String str = p5.G.f23047b;
        kotlin.jvm.internal.o.h(path, "<this>");
        return o(path.toString(), false);
    }

    public static android.graphics.Path r(float f6, float f7, float f8, float f9) {
        android.graphics.Path path = new android.graphics.Path();
        path.moveTo(f6, f7);
        path.lineTo(f8, f9);
        return path;
    }

    public static C2743m s(byte[] bArr) {
        C2743m c2743m = C2743m.f23101d;
        int length = bArr.length;
        AbstractC2732b.e(bArr.length, 0, length);
        return new C2743m(AbstractC3250p.F(bArr, 0, length));
    }

    public static p5.G v(p5.G g6, p5.G base) {
        kotlin.jvm.internal.o.h(g6, "<this>");
        kotlin.jvm.internal.o.h(base, "base");
        return q5.i.f23764d.e(S4.w.x0(S4.p.X0(g6.f23048a.t(), base.f23048a.t()), '\\', '/'));
    }

    @Override // l2.d
    public void a(int i6, Serializable serializable) {
        String str;
        switch (this.f12753a) {
            case 6:
                break;
            default:
                switch (i6) {
                    case 1:
                        str = "RESULT_INSTALL_SUCCESS";
                        break;
                    case 2:
                        str = "RESULT_ALREADY_INSTALLED";
                        break;
                    case 3:
                        str = "RESULT_UNSUPPORTED_ART_VERSION";
                        break;
                    case 4:
                        str = "RESULT_NOT_WRITABLE";
                        break;
                    case 5:
                        str = "RESULT_DESIRED_FORMAT_UNSUPPORTED";
                        break;
                    case 6:
                        str = "RESULT_BASELINE_PROFILE_NOT_FOUND";
                        break;
                    case 7:
                        str = "RESULT_IO_EXCEPTION";
                        break;
                    case 8:
                        str = "RESULT_PARSE_EXCEPTION";
                        break;
                    case 9:
                    default:
                        str = "";
                        break;
                    case 10:
                        str = "RESULT_INSTALL_SKIP_FILE_SUCCESS";
                        break;
                    case 11:
                        str = "RESULT_DELETE_SKIP_FILE_SUCCESS";
                        break;
                }
                if (i6 == 6 || i6 == 7 || i6 == 8) {
                    Log.e("ProfileInstaller", str, (Throwable) serializable);
                } else {
                    Log.d("ProfileInstaller", str);
                }
                break;
        }
    }

    @Override // m4.e2
    public Object b() {
        return Executors.newCachedThreadPool(AbstractC2504f0.e("grpc-okhttp-%d"));
    }

    @Override // l2.d
    public void c() {
        switch (this.f12753a) {
            case 6:
                break;
            default:
                Log.d("ProfileInstaller", "DIAGNOSTIC_PROFILE_IS_COMPRESSED");
                break;
        }
    }

    @Override // m4.e2
    public void d(Object obj) {
        ((ExecutorService) ((Executor) obj)).shutdown();
    }

    @Override // v4.InterfaceC3128a
    public Object get() {
        u4.c cVar = new u4.c(3);
        HashMap map = new HashMap();
        o3.c cVar2 = o3.c.f21809a;
        Set set = Collections.EMPTY_SET;
        if (set == null) {
            throw new NullPointerException("Null flags");
        }
        map.put(cVar2, new C3217b(30000L, 86400000L, set));
        o3.c cVar3 = o3.c.f21811c;
        if (set == null) {
            throw new NullPointerException("Null flags");
        }
        map.put(cVar3, new C3217b(1000L, 86400000L, set));
        o3.c cVar4 = o3.c.f21810b;
        if (set == null) {
            throw new NullPointerException("Null flags");
        }
        Set setUnmodifiableSet = Collections.unmodifiableSet(new HashSet(Arrays.asList(EnumC3219d.f26011b)));
        if (setUnmodifiableSet == null) {
            throw new NullPointerException("Null flags");
        }
        map.put(cVar4, new C3217b(86400000L, 86400000L, setUnmodifiableSet));
        if (map.keySet().size() < o3.c.values().length) {
            throw new IllegalStateException("Not all priorities have been configured");
        }
        new HashMap();
        return new C3216a(cVar, map);
    }

    public C1134i(u0 u0Var) {
        this.f12753a = 3;
        t0 t0Var = t0.f8336a;
    }

    private final void t() {
    }

    private final void u(int i6, Serializable serializable) {
    }
}
