package W2;

import B3.m;
import B3.n;
import B6.t;
import P2.w;
import a4.ExecutorC0401d;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Matrix;
import android.hardware.display.DisplayManager;
import android.net.Uri;
import android.os.Build;
import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.StrictMode;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.EdgeEffect;
import androidx.leanback.transition.FadeAndShortSlide;
import com.google.android.gms.internal.measurement.AbstractC0707u1;
import f0.C0903c;
import f0.C0907g;
import g3.p;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.cert.Certificate;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
import k7.G;
import n4.u0;
import u0.E;
import u0.F;
import x0.o;

/* JADX INFO: loaded from: classes.dex */
public abstract class g {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static ClassLoader f7089a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static Thread f7090b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final /* synthetic */ int f7091c = 0;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final /* synthetic */ int f7092d = 0;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final /* synthetic */ int f7093e = 0;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final /* synthetic */ int f7094f = 0;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final /* synthetic */ int f7095g = 0;

    public static B3.l A(B3.l lVar) {
        return ((lVar instanceof n) || (lVar instanceof m)) ? lVar : lVar instanceof Serializable ? new m(lVar) : new n(lVar);
    }

    public static MappedByteBuffer B(Context context, Uri uri) {
        ParcelFileDescriptor parcelFileDescriptorOpenFileDescriptor;
        try {
            parcelFileDescriptorOpenFileDescriptor = context.getContentResolver().openFileDescriptor(uri, "r", null);
        } catch (IOException unused) {
        }
        if (parcelFileDescriptorOpenFileDescriptor == null) {
            if (parcelFileDescriptorOpenFileDescriptor != null) {
                parcelFileDescriptorOpenFileDescriptor.close();
                return null;
            }
            return null;
        }
        try {
            FileInputStream fileInputStream = new FileInputStream(parcelFileDescriptorOpenFileDescriptor.getFileDescriptor());
            try {
                FileChannel channel = fileInputStream.getChannel();
                MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, 0L, channel.size());
                fileInputStream.close();
                parcelFileDescriptorOpenFileDescriptor.close();
                return map;
            } finally {
            }
        } finally {
        }
    }

    public static float C(EdgeEffect edgeEffect, float f3, float f7) {
        if (Build.VERSION.SDK_INT >= 31) {
            return P.c.c(edgeEffect, f3, f7);
        }
        P.b.a(edgeEffect, f3, f7);
        return f3;
    }

    public static final File D(Context context, String str) {
        P6.g.e(str, "name");
        String strConcat = str.concat(".preferences_pb");
        P6.g.e(strConcat, "fileName");
        return new File(context.getApplicationContext().getFilesDir(), "datastore/".concat(strConcat));
    }

    public static long E(o oVar, int i, int i5) {
        oVar.F(i);
        if (oVar.a() < 5) {
            return -9223372036854775807L;
        }
        int iG = oVar.g();
        if ((8388608 & iG) != 0 || ((2096896 & iG) >> 8) != i5 || (iG & 32) == 0 || oVar.t() < 7 || oVar.a() < 7 || (oVar.t() & 16) != 16) {
            return -9223372036854775807L;
        }
        byte[] bArr = new byte[6];
        oVar.e(bArr, 0, 6);
        return ((((long) bArr[0]) & 255) << 25) | ((((long) bArr[1]) & 255) << 17) | ((((long) bArr[2]) & 255) << 9) | ((((long) bArr[3]) & 255) << 1) | ((255 & ((long) bArr[4])) >> 7);
    }

    public static final void F(Object[] objArr, int i, int i5) {
        P6.g.e(objArr, "<this>");
        while (i < i5) {
            objArr[i] = null;
            i++;
        }
    }

    public static w1.g G(w1.g gVar, String[] strArr, Map map) {
        int i = 0;
        if (gVar == null) {
            if (strArr == null) {
                return null;
            }
            if (strArr.length == 1) {
                return (w1.g) map.get(strArr[0]);
            }
            if (strArr.length > 1) {
                w1.g gVar2 = new w1.g();
                int length = strArr.length;
                while (i < length) {
                    gVar2.a((w1.g) map.get(strArr[i]));
                    i++;
                }
                return gVar2;
            }
        } else {
            if (strArr != null && strArr.length == 1) {
                gVar.a((w1.g) map.get(strArr[0]));
                return gVar;
            }
            if (strArr != null && strArr.length > 1) {
                int length2 = strArr.length;
                while (i < length2) {
                    gVar.a((w1.g) map.get(strArr[i]));
                    i++;
                }
            }
        }
        return gVar;
    }

    public static final void H(View view, View view2) {
        if (!(view instanceof ViewGroup) || view2 == null) {
            return;
        }
        ViewGroup viewGroup = (ViewGroup) view;
        if (viewGroup.indexOfChild(view2) != -1) {
            return;
        }
        if (view2.getParent() != null) {
            ViewParent parent = view2.getParent();
            ViewGroup viewGroup2 = parent instanceof ViewGroup ? (ViewGroup) parent : null;
            if (viewGroup2 != null) {
                viewGroup2.removeView(view2);
            }
        }
        viewGroup.addView(view2);
    }

    public static final void I(View view, View view2) {
        if (!(view instanceof ViewGroup) || view2 == null) {
            return;
        }
        ViewGroup viewGroup = (ViewGroup) view;
        if (viewGroup.indexOfChild(view2) != -1) {
            return;
        }
        if (view2.getParent() != null) {
            ViewParent parent = view2.getParent();
            ViewGroup viewGroup2 = parent instanceof ViewGroup ? (ViewGroup) parent : null;
            if (viewGroup2 != null) {
                viewGroup2.removeView(view2);
            }
        }
        viewGroup.addView(view2, 0);
    }

    public static final void J(View view, View view2) {
        if (!(view instanceof ViewGroup) || view2 == null) {
            return;
        }
        ((ViewGroup) view).removeView(view2);
    }

    public static g3.o K(List list) {
        if (list == null || list.isEmpty()) {
            return p(null);
        }
        Iterator it = list.iterator();
        while (it.hasNext()) {
            if (((g3.o) it.next()) == null) {
                throw new NullPointerException("null tasks are not accepted");
            }
        }
        g3.o oVar = new g3.o();
        g3.k kVar = new g3.k(list.size(), oVar);
        Iterator it2 = list.iterator();
        while (it2.hasNext()) {
            g3.o oVar2 = (g3.o) it2.next();
            ExecutorC0401d executorC0401d = g3.i.f12925b;
            oVar2.c(executorC0401d, kVar);
            oVar2.b(executorC0401d, kVar);
            oVar2.a(executorC0401d, kVar);
        }
        return oVar;
    }

    public static g3.o L(g3.o... oVarArr) {
        if (oVarArr.length == 0) {
            return p(Collections.EMPTY_LIST);
        }
        List listAsList = Arrays.asList(oVarArr);
        return (listAsList == null || listAsList.isEmpty()) ? p(Collections.EMPTY_LIST) : K(listAsList).e(g3.i.f12924a, new g3.j(listAsList));
    }

    /* JADX WARN: Removed duplicated region for block: B:53:0x00ab A[Catch: all -> 0x00a7, PHI: r1
      0x00ab: PHI (r1v4 java.lang.Thread) = (r1v3 java.lang.Thread), (r1v15 java.lang.Thread) binds: [B:7:0x000a, B:47:0x00a4] A[DONT_GENERATE, DONT_INLINE], TRY_LEAVE, TryCatch #4 {, blocks: (B:4:0x0003, B:6:0x0007, B:8:0x000c, B:46:0x00a2, B:61:0x00d1, B:12:0x001f, B:52:0x00aa, B:53:0x00ab, B:64:0x00d5, B:65:0x00d6, B:54:0x00ac, B:60:0x00d0, B:59:0x00b6, B:13:0x0020, B:15:0x002d, B:25:0x0047, B:26:0x004e, B:28:0x0059, B:34:0x006e, B:35:0x0075, B:43:0x0086, B:44:0x00a0, B:18:0x003c), top: B:77:0x0003, inners: #2, #6 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static synchronized ClassLoader M() {
        SecurityException e8;
        Thread thread;
        ThreadGroup threadGroup;
        f fVar;
        if (f7089a == null) {
            Thread thread2 = f7090b;
            ClassLoader contextClassLoader = null;
            if (thread2 != null) {
                synchronized (thread2) {
                    try {
                        contextClassLoader = f7090b.getContextClassLoader();
                    } catch (SecurityException e9) {
                        Log.w("DynamiteLoaderV2CL", "Failed to get thread context classloader " + e9.getMessage());
                    }
                }
                f7089a = contextClassLoader;
            } else {
                ThreadGroup threadGroup2 = Looper.getMainLooper().getThread().getThreadGroup();
                if (threadGroup2 == null) {
                    thread2 = null;
                } else {
                    synchronized (Void.class) {
                        try {
                            try {
                                int iActiveGroupCount = threadGroup2.activeGroupCount();
                                ThreadGroup[] threadGroupArr = new ThreadGroup[iActiveGroupCount];
                                threadGroup2.enumerate(threadGroupArr);
                                int i = 0;
                                int i5 = 0;
                                while (true) {
                                    if (i5 >= iActiveGroupCount) {
                                        threadGroup = null;
                                        break;
                                    }
                                    threadGroup = threadGroupArr[i5];
                                    if ("dynamiteLoader".equals(threadGroup.getName())) {
                                        break;
                                    }
                                    i5++;
                                }
                                if (threadGroup == null) {
                                    threadGroup = new ThreadGroup(threadGroup2, "dynamiteLoader");
                                }
                                int iActiveCount = threadGroup.activeCount();
                                Thread[] threadArr = new Thread[iActiveCount];
                                threadGroup.enumerate(threadArr);
                                while (true) {
                                    if (i >= iActiveCount) {
                                        thread = null;
                                        break;
                                    }
                                    thread = threadArr[i];
                                    if ("GmsDynamite".equals(thread.getName())) {
                                        break;
                                    }
                                    i++;
                                }
                                if (thread == null) {
                                    try {
                                        fVar = new f(threadGroup, "GmsDynamite");
                                    } catch (SecurityException e10) {
                                        e8 = e10;
                                    }
                                    try {
                                        fVar.setContextClassLoader(null);
                                        fVar.start();
                                        thread = fVar;
                                    } catch (SecurityException e11) {
                                        e8 = e11;
                                        thread = fVar;
                                        Log.w("DynamiteLoaderV2CL", "Failed to enumerate thread/threadgroup " + e8.getMessage());
                                    }
                                }
                            } catch (SecurityException e12) {
                                e8 = e12;
                                thread = null;
                            }
                        } finally {
                        }
                    }
                    thread2 = thread;
                }
                f7090b = thread2;
                if (thread2 != null) {
                }
                f7089a = contextClassLoader;
            }
        }
        return f7089a;
    }

    public static Object N(g3.o oVar) throws ExecutionException {
        if (oVar.i()) {
            return oVar.g();
        }
        if (oVar.f12946d) {
            throw new CancellationException("Task is already canceled");
        }
        throw new ExecutionException(oVar.f());
    }

    public static final boolean a(Object[] objArr, int i, int i5, List list) {
        if (i5 == list.size()) {
            for (int i8 = 0; i8 < i5; i8++) {
                if (P6.g.a(objArr[i + i8], list.get(i8))) {
                }
            }
            return true;
        }
        return false;
    }

    public static final String b(Object[] objArr, int i, int i5, B6.f fVar) {
        StringBuilder sb = new StringBuilder((i5 * 3) + 2);
        sb.append("[");
        for (int i8 = 0; i8 < i5; i8++) {
            if (i8 > 0) {
                sb.append(", ");
            }
            Object obj = objArr[i + i8];
            if (obj == fVar) {
                sb.append("(this Collection)");
            } else {
                sb.append(obj);
            }
        }
        sb.append("]");
        String string = sb.toString();
        P6.g.d(string, "toString(...)");
        return string;
    }

    public static final void c(View view, float f3) {
        if (view == null) {
            return;
        }
        view.clearAnimation();
        view.animate().alpha(f3).setDuration(300L).start();
    }

    public static Object d(g3.o oVar) throws InterruptedException {
        w.e("Must not be called on the main application thread");
        Looper looperMyLooper = Looper.myLooper();
        if (looperMyLooper != null && Objects.equals(looperMyLooper.getThread().getName(), "GoogleApiHandler")) {
            throw new IllegalStateException("Must not be called on GoogleApiHandler thread.");
        }
        if (oVar.h()) {
            return N(oVar);
        }
        M4.c cVar = new M4.c(1);
        Executor executor = g3.i.f12925b;
        oVar.c(executor, cVar);
        oVar.b(executor, cVar);
        oVar.a(executor, cVar);
        cVar.f4218r.await();
        return N(oVar);
    }

    public static Object e(g3.o oVar, long j8) throws TimeoutException {
        TimeUnit timeUnit = TimeUnit.MILLISECONDS;
        w.e("Must not be called on the main application thread");
        Looper looperMyLooper = Looper.myLooper();
        if (looperMyLooper != null && Objects.equals(looperMyLooper.getThread().getName(), "GoogleApiHandler")) {
            throw new IllegalStateException("Must not be called on GoogleApiHandler thread.");
        }
        w.g(oVar, "Task must not be null");
        w.g(timeUnit, "TimeUnit must not be null");
        if (oVar.h()) {
            return N(oVar);
        }
        M4.c cVar = new M4.c(1);
        Executor executor = g3.i.f12925b;
        oVar.c(executor, cVar);
        oVar.b(executor, cVar);
        oVar.a(executor, cVar);
        if (cVar.f4218r.await(j8, timeUnit)) {
            return N(oVar);
        }
        throw new TimeoutException("Timed out waiting for Task");
    }

    public static g3.o f(Executor executor, Callable callable) {
        w.g(executor, "Executor must not be null");
        g3.o oVar = new g3.o();
        executor.execute(new p(oVar, 0, callable));
        return oVar;
    }

    public static void g(Closeable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException unused) {
            }
        }
    }

    public static int h(int i, int i5) {
        return F.a.d(i, (Color.alpha(i) * i5) / 255);
    }

    public static boolean i(File file, Resources resources, int i) throws Throwable {
        InputStream inputStreamOpenRawResource;
        try {
            inputStreamOpenRawResource = resources.openRawResource(i);
            try {
                boolean zJ = j(file, inputStreamOpenRawResource);
                g(inputStreamOpenRawResource);
                return zJ;
            } catch (Throwable th) {
                th = th;
                g(inputStreamOpenRawResource);
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
            inputStreamOpenRawResource = null;
        }
    }

    public static boolean j(File file, InputStream inputStream) throws Throwable {
        FileOutputStream fileOutputStream;
        StrictMode.ThreadPolicy threadPolicyAllowThreadDiskWrites = StrictMode.allowThreadDiskWrites();
        FileOutputStream fileOutputStream2 = null;
        try {
            try {
                fileOutputStream = new FileOutputStream(file, false);
            } catch (IOException e8) {
                e = e8;
            }
        } catch (Throwable th) {
            th = th;
        }
        try {
            byte[] bArr = new byte[1024];
            while (true) {
                int i = inputStream.read(bArr);
                if (i == -1) {
                    g(fileOutputStream);
                    StrictMode.setThreadPolicy(threadPolicyAllowThreadDiskWrites);
                    return true;
                }
                fileOutputStream.write(bArr, 0, i);
            }
        } catch (IOException e9) {
            e = e9;
            fileOutputStream2 = fileOutputStream;
            Log.e("TypefaceCompatUtil", "Error copying resource contents to temp file: " + e.getMessage());
            g(fileOutputStream2);
            StrictMode.setThreadPolicy(threadPolicyAllowThreadDiskWrites);
            return false;
        } catch (Throwable th2) {
            th = th2;
            fileOutputStream2 = fileOutputStream;
            g(fileOutputStream2);
            StrictMode.setThreadPolicy(threadPolicyAllowThreadDiskWrites);
            throw th;
        }
    }

    public static Bitmap k(int i, byte[] bArr) throws IOException {
        int iE;
        int i5 = 0;
        Bitmap bitmapDecodeByteArray = BitmapFactory.decodeByteArray(bArr, 0, i, null);
        if (bitmapDecodeByteArray == null) {
            throw F.a(new IllegalStateException(), "Could not decode image data");
        }
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
        try {
            C0907g c0907g = new C0907g(byteArrayInputStream);
            byteArrayInputStream.close();
            C0903c c0903cC = c0907g.c("Orientation");
            if (c0903cC == null) {
                iE = 1;
            } else {
                try {
                    iE = c0903cC.e(c0907g.f12654f);
                } catch (NumberFormatException unused) {
                    iE = 1;
                }
            }
            switch (iE) {
                case 3:
                case 4:
                    i5 = 180;
                    break;
                case 5:
                case Z.g.BYTES_FIELD_NUMBER /* 8 */:
                    i5 = 270;
                    break;
                case Z.g.STRING_SET_FIELD_NUMBER /* 6 */:
                case Z.g.DOUBLE_FIELD_NUMBER /* 7 */:
                    i5 = 90;
                    break;
            }
            if (i5 == 0) {
                return bitmapDecodeByteArray;
            }
            Matrix matrix = new Matrix();
            matrix.postRotate(i5);
            return Bitmap.createBitmap(bitmapDecodeByteArray, 0, 0, bitmapDecodeByteArray.getWidth(), bitmapDecodeByteArray.getHeight(), matrix, false);
        } finally {
        }
    }

    public static final boolean l(String str, String str2) {
        P6.g.e(str, "current");
        if (str.equals(str2)) {
            return true;
        }
        if (str.length() != 0) {
            int i = 0;
            int i5 = 0;
            int i8 = 0;
            while (true) {
                if (i < str.length()) {
                    char cCharAt = str.charAt(i);
                    int i9 = i8 + 1;
                    if (i8 == 0 && cCharAt != '(') {
                        break;
                    }
                    if (cCharAt == '(') {
                        i5++;
                    } else if (cCharAt == ')' && i5 - 1 == 0 && i8 != str.length() - 1) {
                        break;
                    }
                    i++;
                    i8 = i9;
                } else if (i5 == 0) {
                    String strSubstring = str.substring(1, str.length() - 1);
                    P6.g.d(strSubstring, "substring(...)");
                    return P6.g.a(X6.e.j0(strSubstring).toString(), str2);
                }
            }
        }
        return false;
    }

    public static boolean m(Context context) {
        DisplayManager displayManager = (DisplayManager) context.getSystemService("display");
        Display display = displayManager != null ? displayManager.getDisplay(0) : null;
        if (display != null && display.isHdr()) {
            for (int i : display.getHdrCapabilities().getSupportedHdrTypes()) {
                if (i == 1) {
                    return true;
                }
            }
        }
        return false;
    }

    public static final void n(View view, float f3) {
        if (view == null) {
            return;
        }
        view.clearAnimation();
        view.animate().alpha(f3).setDuration(300L).start();
    }

    public static g3.o o(L4.e eVar) {
        g3.o oVar = new g3.o();
        oVar.k(eVar);
        return oVar;
    }

    public static g3.o p(Object obj) {
        g3.o oVar = new g3.o();
        oVar.l(obj);
        return oVar;
    }

    public static final String q(Collection collection) {
        P6.g.e(collection, "collection");
        if (collection.isEmpty()) {
            return " }";
        }
        return X6.g.C(B6.k.m0(collection, ",\n", "\n", "\n", null, 56)) + "},";
    }

    public static k7.n r(SSLSession sSLSession) throws IOException {
        Certificate[] peerCertificates;
        List listL = t.f1032q;
        String cipherSuite = sSLSession.getCipherSuite();
        if (cipherSuite == null) {
            throw new IllegalStateException("cipherSuite == null");
        }
        if (cipherSuite.equals("TLS_NULL_WITH_NULL_NULL") ? true : cipherSuite.equals("SSL_NULL_WITH_NULL_NULL")) {
            throw new IOException("cipherSuite == ".concat(cipherSuite));
        }
        k7.h hVarD = k7.h.f14061b.d(cipherSuite);
        String protocol = sSLSession.getProtocol();
        if (protocol == null) {
            throw new IllegalStateException("tlsVersion == null");
        }
        if ("NONE".equals(protocol)) {
            throw new IOException("tlsVersion == NONE");
        }
        G gI = AbstractC0707u1.i(protocol);
        try {
            peerCertificates = sSLSession.getPeerCertificates();
        } catch (SSLPeerUnverifiedException unused) {
        }
        List listL2 = peerCertificates != null ? l7.b.l(Arrays.copyOf(peerCertificates, peerCertificates.length)) : listL;
        Certificate[] localCertificates = sSLSession.getLocalCertificates();
        if (localCertificates != null) {
            listL = l7.b.l(Arrays.copyOf(localCertificates, localCertificates.length));
        }
        return new k7.n(gI, hVarD, listL, new O5.h(20, listL2));
    }

    public static int s(View view, int i) {
        return u0.x(i, view.getContext(), view.getClass().getCanonicalName());
    }

    public static float t(EdgeEffect edgeEffect) {
        if (Build.VERSION.SDK_INT >= 31) {
            return P.c.b(edgeEffect);
        }
        return 0.0f;
    }

    public static File w(Context context) {
        File cacheDir = context.getCacheDir();
        if (cacheDir == null) {
            return null;
        }
        String str = ".font" + Process.myPid() + "-" + Process.myTid() + "-";
        for (int i = 0; i < 100; i++) {
            File file = new File(cacheDir, str + i);
            if (file.createNewFile()) {
                return file;
            }
        }
        return null;
    }

    /* JADX WARN: Code restructure failed: missing block: B:100:0x01a4, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:104:0x01b3, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:108:0x01c2, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:112:0x01cf, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:116:0x01dd, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:120:0x01eb, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:124:0x01f9, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:128:0x0206, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:12:0x004f, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:132:0x0214, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:16:0x005f, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:20:0x006f, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:24:0x007f, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:28:0x008f, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:32:0x009f, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:36:0x00af, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:40:0x00bf, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:44:0x00cf, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:48:0x00df, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:52:0x00ef, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:56:0x00ff, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:60:0x010e, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:64:0x011d, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:68:0x012c, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:72:0x013b, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:76:0x014a, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:7:0x0039, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:80:0x0159, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:84:0x0168, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:88:0x0177, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:8:0x003f, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:92:0x0186, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Code restructure failed: missing block: B:96:0x0195, code lost:
    
        r23 = 20;
     */
    /* JADX WARN: Removed duplicated region for block: B:134:0x021e A[PHI: r23
      0x021e: PHI (r23v32 int) = 
      (r23v1 int)
      (r23v2 int)
      (r23v3 int)
      (r23v4 int)
      (r23v5 int)
      (r23v6 int)
      (r23v7 int)
      (r23v8 int)
      (r23v9 int)
      (r23v10 int)
      (r23v11 int)
      (r23v12 int)
      (r23v13 int)
      (r23v14 int)
      (r23v15 int)
      (r23v16 int)
      (r23v17 int)
      (r23v18 int)
      (r23v19 int)
      (r23v20 int)
      (r23v21 int)
      (r23v22 int)
      (r23v23 int)
      (r23v24 int)
      (r23v25 int)
      (r23v26 int)
      (r23v27 int)
      (r23v28 int)
      (r23v29 int)
      (r23v30 int)
      (r23v31 int)
      (r23v33 int)
     binds: [B:133:0x021c, B:129:0x020e, B:125:0x0201, B:121:0x01f3, B:117:0x01e5, B:113:0x01d7, B:109:0x01ca, B:105:0x01bb, B:101:0x01ac, B:97:0x019d, B:93:0x018e, B:89:0x017f, B:85:0x0170, B:81:0x0161, B:77:0x0152, B:73:0x0143, B:69:0x0134, B:65:0x0125, B:61:0x0116, B:57:0x0107, B:53:0x00f7, B:49:0x00e7, B:45:0x00d7, B:41:0x00c7, B:37:0x00b7, B:33:0x00a7, B:29:0x0097, B:25:0x0087, B:21:0x0077, B:17:0x0067, B:13:0x0057, B:9:0x0047] A[DONT_GENERATE, DONT_INLINE]] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static int x(String str) {
        if (str == null) {
            return -1;
        }
        String strM = E.m(str);
        strM.getClass();
        switch (strM) {
        }
        return -1;
    }

    public static int y(Uri uri) {
        String lastPathSegment = uri.getLastPathSegment();
        if (lastPathSegment == null) {
            return -1;
        }
        if (lastPathSegment.endsWith(".ac3") || lastPathSegment.endsWith(".ec3")) {
            return 0;
        }
        if (lastPathSegment.endsWith(".ac4")) {
            return 1;
        }
        if (lastPathSegment.endsWith(".adts") || lastPathSegment.endsWith(".aac")) {
            return 2;
        }
        if (lastPathSegment.endsWith(".amr")) {
            return 3;
        }
        if (lastPathSegment.endsWith(".flac")) {
            return 4;
        }
        if (lastPathSegment.endsWith(".flv")) {
            return 5;
        }
        if (lastPathSegment.endsWith(".mid") || lastPathSegment.endsWith(".midi") || lastPathSegment.endsWith(".smf")) {
            return 15;
        }
        if (lastPathSegment.startsWith(".mk", lastPathSegment.length() - 4) || lastPathSegment.endsWith(".webm")) {
            return 6;
        }
        if (lastPathSegment.endsWith(".mp3")) {
            return 7;
        }
        if (lastPathSegment.endsWith(".mp4") || lastPathSegment.startsWith(".m4", lastPathSegment.length() - 4) || lastPathSegment.startsWith(".mp4", lastPathSegment.length() - 5) || lastPathSegment.startsWith(".cmf", lastPathSegment.length() - 5)) {
            return 8;
        }
        if (lastPathSegment.startsWith(".og", lastPathSegment.length() - 4) || lastPathSegment.endsWith(".opus")) {
            return 9;
        }
        if (lastPathSegment.endsWith(".ps") || lastPathSegment.endsWith(".mpeg") || lastPathSegment.endsWith(".mpg") || lastPathSegment.endsWith(".m2p")) {
            return 10;
        }
        if (lastPathSegment.endsWith(".ts") || lastPathSegment.startsWith(".ts", lastPathSegment.length() - 4)) {
            return 11;
        }
        if (lastPathSegment.endsWith(".wav") || lastPathSegment.endsWith(".wave")) {
            return 12;
        }
        if (lastPathSegment.endsWith(".vtt") || lastPathSegment.endsWith(".webvtt")) {
            return 13;
        }
        if (lastPathSegment.endsWith(".jpg") || lastPathSegment.endsWith(".jpeg")) {
            return 14;
        }
        if (lastPathSegment.endsWith(".avi")) {
            return 16;
        }
        if (lastPathSegment.endsWith(".png")) {
            return 17;
        }
        if (lastPathSegment.endsWith(".webp")) {
            return 18;
        }
        if (lastPathSegment.endsWith(".bmp") || lastPathSegment.endsWith(".dib")) {
            return 19;
        }
        if (lastPathSegment.endsWith(".heic") || lastPathSegment.endsWith(".heif")) {
            return 20;
        }
        return lastPathSegment.endsWith(".avif") ? 21 : -1;
    }

    public static int z(float f3, int i, int i5) {
        return F.a.b(F.a.d(i5, Math.round(Color.alpha(i5) * f3)), i);
    }

    public float u(FadeAndShortSlide fadeAndShortSlide, ViewGroup viewGroup, View view, int[] iArr) {
        return view.getTranslationX();
    }

    public float v(FadeAndShortSlide fadeAndShortSlide, ViewGroup viewGroup, View view, int[] iArr) {
        return view.getTranslationY();
    }
}
