package nb;

import a0.v;
import a4.k0;
import a4.l0;
import android.app.Application;
import android.content.Context;
import android.database.sqlite.SQLiteException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Camera;
import android.media.tv.TvContract;
import android.net.Uri;
import android.os.Build;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.view.InputEvent;
import android.view.View;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import androidx.media3.common.C;
import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.ParsableByteArray;
import androidx.media3.extractor.z0;
import androidx.recyclerview.widget.f2;
import androidx.recyclerview.widget.q1;
import androidx.recyclerview.widget.x0;
import com.google.android.gms.measurement.internal.u1;
import io.flutter.plugins.GeneratedPluginRegistrant;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Set;
import k1.k;
import kotlin.UninitializedPropertyAccessException;
import kotlin.collections.EmptySet;
import kotlin.collections.builders.ListBuilder;
import kotlin.collections.n;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.coroutines.h;
import kotlin.coroutines.jvm.internal.BaseContinuationImpl;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.RestrictedContinuationImpl;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.b1;
import kotlinx.coroutines.g1;
import kotlinx.coroutines.j0;
import kotlinx.coroutines.q;
import kotlinx.coroutines.y0;
import nb.g;
import okio.Utf8;
import org.chromium.support_lib_boundary.WebResourceRequestBoundaryInterface;
import org.chromium.support_lib_boundary.WebkitToCompatConverterBoundaryInterface;
import sd.l;

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

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

    public static Set A() {
        try {
            Object objInvoke = Class.forName("android.text.EmojiConsistency").getMethod("getEmojiConsistencySet", new Class[0]).invoke(null, new Object[0]);
            if (objInvoke == null) {
                return Collections.emptySet();
            }
            Set set = (Set) objInvoke;
            Iterator it = set.iterator();
            while (it.hasNext()) {
                if (!(it.next() instanceof int[])) {
                    return Collections.emptySet();
                }
            }
            return set;
        } catch (Throwable unused) {
            return Collections.emptySet();
        }
    }

    public static final Class B(yd.b bVar) {
        i(bVar, "<this>");
        Class clsA = ((kotlin.jvm.internal.a) bVar).a();
        g(clsA, "null cannot be cast to non-null type java.lang.Class<T of kotlin.jvm.JvmClassMappingKt.<get-java>>");
        return clsA;
    }

    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    public static final Class C(yd.b bVar) {
        i(bVar, "<this>");
        Class clsA = ((kotlin.jvm.internal.a) bVar).a();
        if (!clsA.isPrimitive()) {
            return clsA;
        }
        String name = clsA.getName();
        switch (name.hashCode()) {
            case -1325958191:
                if (!name.equals("double")) {
                }
                break;
            case 104431:
                if (!name.equals("int")) {
                }
                break;
            case 3039496:
                if (!name.equals("byte")) {
                }
                break;
            case 3052374:
                if (!name.equals("char")) {
                }
                break;
            case 3327612:
                if (!name.equals("long")) {
                }
                break;
            case 3625364:
                if (!name.equals("void")) {
                }
                break;
            case 64711720:
                if (!name.equals("boolean")) {
                }
                break;
            case 97526364:
                if (!name.equals("float")) {
                }
                break;
            case 109413500:
                if (!name.equals("short")) {
                }
                break;
        }
        return clsA;
    }

    public static long E(byte b10, byte b11) {
        int i10;
        int i11 = b10 & 255;
        int i12 = b10 & 3;
        if (i12 != 0) {
            i10 = 2;
            if (i12 != 1 && i12 != 2) {
                i10 = b11 & Utf8.REPLACEMENT_BYTE;
            }
        } else {
            i10 = 1;
        }
        int i13 = i11 >> 3;
        int i14 = i13 & 3;
        return ((long) i10) * ((long) (i13 >= 16 ? 2500 << i14 : i13 >= 12 ? 10000 << (i13 & 1) : i14 == 3 ? 60000 : 10000 << i14));
    }

    public static Continuation F(Continuation continuation) {
        Continuation continuationIntercepted;
        i(continuation, "<this>");
        ContinuationImpl continuationImpl = continuation instanceof ContinuationImpl ? (ContinuationImpl) continuation : null;
        return (continuationImpl == null || (continuationIntercepted = continuationImpl.intercepted()) == null) ? continuation : continuationIntercepted;
    }

    public static /* synthetic */ j0 G(y0 y0Var, boolean z10, b1 b1Var, int i10) {
        if ((i10 & 1) != 0) {
            z10 = false;
        }
        return ((g1) y0Var).L(z10, (i10 & 2) != 0, b1Var);
    }

    public static boolean H(Uri uri) {
        return uri != null && "content".equals(uri.getScheme()) && "media".equals(uri.getAuthority());
    }

    public static boolean I(WebResourceRequest webResourceRequest) {
        a4.b bVar = k0.f330m;
        if (bVar.a()) {
            return webResourceRequest.isRedirect();
        }
        if (bVar.b()) {
            return ((WebResourceRequestBoundaryInterface) ee.b.castToSuppLibClass(WebResourceRequestBoundaryInterface.class, ((WebkitToCompatConverterBoundaryInterface) l0.f344a.f31183b).convertWebResourceRequest(webResourceRequest))).isRedirect();
        }
        throw k0.a();
    }

    public static File J(String str, String str2) {
        File file = new File(str);
        if (file.isFile()) {
            file.delete();
        }
        if (!file.exists()) {
            file.mkdirs();
        }
        return new File(file, str2);
    }

    public static final Object K(Object obj) {
        return obj instanceof q ? kotlin.a.b(((q) obj).f29523a) : obj;
    }

    public static void L(xc.c cVar) {
        try {
            GeneratedPluginRegistrant.class.getDeclaredMethod("registerWith", xc.c.class).invoke(null, cVar);
        } catch (Exception unused) {
            Objects.toString(cVar);
        }
    }

    public static File O(String str, String str2) {
        File file = new File(str);
        if (file.isFile()) {
            file.delete();
        }
        if (!file.exists()) {
            file.mkdirs();
        }
        return new File(file, u1.j(str2, ".temp"));
    }

    public static int P(float f10) {
        return (int) (f10 + (f10 < 0.0f ? -0.5f : 0.5f));
    }

    public static void Q(String str, RuntimeException runtimeException) {
        StackTraceElement[] stackTrace = runtimeException.getStackTrace();
        int length = stackTrace.length;
        int i10 = -1;
        for (int i11 = 0; i11 < length; i11++) {
            if (str.equals(stackTrace[i11].getClassName())) {
                i10 = i11;
            }
        }
        runtimeException.setStackTrace((StackTraceElement[]) Arrays.copyOfRange(stackTrace, i10 + 1, length));
    }

    public static Set R(Object... objArr) {
        i(objArr, "elements");
        if (objArr.length <= 0) {
            return EmptySet.f29205a;
        }
        int length = objArr.length;
        if (length == 0) {
            return EmptySet.f29205a;
        }
        if (length == 1) {
            Set setSingleton = Collections.singleton(objArr[0]);
            h(setSingleton, "singleton(element)");
            return setSingleton;
        }
        LinkedHashSet linkedHashSet = new LinkedHashSet(ua.b.D(objArr.length));
        for (Object obj : objArr) {
            linkedHashSet.add(obj);
        }
        return linkedHashSet;
    }

    /* JADX WARN: Removed duplicated region for block: B:27:0x0060 A[PHI: r0 r1
      0x0060: PHI (r0v8 java.net.URLConnection) = (r0v7 java.net.URLConnection), (r0v12 java.net.URLConnection) binds: [B:34:0x0073, B:26:0x005e] A[DONT_GENERATE, DONT_INLINE]
      0x0060: PHI (r1v5 android.graphics.Bitmap) = (r1v10 android.graphics.Bitmap), (r1v7 android.graphics.Bitmap) binds: [B:34:0x0073, B:26:0x005e] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:37:0x0078  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x009e A[ORIG_RETURN, RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:54:0x00a8  */
    /* JADX WARN: Removed duplicated region for block: B:67:0x00a1 A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:69:0x006e A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:80:? A[SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static void S(Context context, long j10, Uri uri) throws Throwable {
        URLConnection uRLConnectionOpenConnection;
        InputStream inputStreamOpenInputStream;
        String scheme = uri.normalizeScheme().getScheme();
        InputStream inputStream = null;
        bitmapDecodeStream = null;
        Bitmap bitmapDecodeStream = null;
        inputStream = null;
        try {
            if ("android.resource".equals(scheme) || "file".equals(scheme) || "content".equals(scheme)) {
                inputStreamOpenInputStream = context.getContentResolver().openInputStream(uri);
                uRLConnectionOpenConnection = null;
            } else {
                uRLConnectionOpenConnection = new URL(uri.toString()).openConnection();
                uRLConnectionOpenConnection.setConnectTimeout(3000);
                uRLConnectionOpenConnection.setReadTimeout(10000);
                try {
                    inputStreamOpenInputStream = uRLConnectionOpenConnection.getInputStream();
                } catch (IOException unused) {
                    inputStreamOpenInputStream = null;
                    uri.toString();
                    if (inputStreamOpenInputStream != null) {
                    }
                    if (uRLConnectionOpenConnection instanceof HttpURLConnection) {
                    }
                    if (bitmapDecodeStream != null) {
                    }
                } catch (Throwable th) {
                    th = th;
                    if (inputStream != null) {
                    }
                    if (uRLConnectionOpenConnection instanceof HttpURLConnection) {
                    }
                }
            }
            try {
                try {
                    bitmapDecodeStream = BitmapFactory.decodeStream(inputStreamOpenInputStream);
                    if (inputStreamOpenInputStream != null) {
                        try {
                            inputStreamOpenInputStream.close();
                        } catch (IOException unused2) {
                        }
                    }
                } catch (IOException unused3) {
                    uri.toString();
                    if (inputStreamOpenInputStream != null) {
                        try {
                            inputStreamOpenInputStream.close();
                        } catch (IOException unused4) {
                        }
                    }
                    if (uRLConnectionOpenConnection instanceof HttpURLConnection) {
                    }
                    if (bitmapDecodeStream != null) {
                    }
                }
            } catch (Throwable th2) {
                th = th2;
                inputStream = inputStreamOpenInputStream;
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (IOException unused5) {
                    }
                }
                if (uRLConnectionOpenConnection instanceof HttpURLConnection) {
                    throw th;
                }
                ((HttpURLConnection) uRLConnectionOpenConnection).disconnect();
                throw th;
            }
        } catch (IOException unused6) {
            uRLConnectionOpenConnection = null;
            inputStreamOpenInputStream = null;
        } catch (Throwable th3) {
            th = th3;
            uRLConnectionOpenConnection = null;
        }
        if (uRLConnectionOpenConnection instanceof HttpURLConnection) {
            ((HttpURLConnection) uRLConnectionOpenConnection).disconnect();
        }
        if (bitmapDecodeStream != null) {
            try {
                OutputStream outputStreamOpenOutputStream = context.getContentResolver().openOutputStream(TvContract.buildChannelLogoUri(j10));
                try {
                    bitmapDecodeStream.compress(Bitmap.CompressFormat.PNG, 100, outputStreamOpenOutputStream);
                    outputStreamOpenOutputStream.flush();
                    outputStreamOpenOutputStream.close();
                } catch (Throwable th4) {
                    if (outputStreamOpenOutputStream != null) {
                        try {
                            outputStreamOpenOutputStream.close();
                        } catch (Throwable th5) {
                            th4.addSuppressed(th5);
                        }
                    }
                    throw th4;
                }
            } catch (SQLiteException | IOException unused7) {
            }
        }
    }

    public static int T(int[] iArr) {
        int i10 = 0;
        for (int i11 : iArr) {
            i10 += i11;
        }
        return i10;
    }

    public static void U(String str) {
        UninitializedPropertyAccessException uninitializedPropertyAccessException = new UninitializedPropertyAccessException(u1.k("lateinit property ", str, " has not been initialized"));
        Q(g.class.getName(), uninitializedPropertyAccessException);
        throw uninitializedPropertyAccessException;
    }

    public static void V() {
        if (Looper.getMainLooper() != Looper.myLooper()) {
            throw new IllegalStateException("Must be called from the main thread.");
        }
    }

    public static final List a(Throwable th) {
        return hb.a.m0(th.getClass().getSimpleName(), th.toString(), "Cause: " + th.getCause() + ", Stacktrace: " + Log.getStackTraceString(th));
    }

    public static void b(StringBuilder sb, Object obj, l lVar) {
        if (lVar != null) {
            sb.append((CharSequence) lVar.invoke(obj));
            return;
        }
        if (obj == null || (obj instanceof CharSequence)) {
            sb.append((CharSequence) obj);
        } else if (obj instanceof Character) {
            sb.append(((Character) obj).charValue());
        } else {
            sb.append((CharSequence) String.valueOf(obj));
        }
    }

    public static boolean c(Object obj, Object obj2) {
        return obj == null ? obj2 == null : obj.equals(obj2);
    }

    public static ArrayList d(byte[] bArr) {
        long j10 = (((long) (((bArr[11] & 255) << 8) | (bArr[10] & 255))) * C.NANOS_PER_SECOND) / 48000;
        ArrayList arrayList = new ArrayList(3);
        arrayList.add(bArr);
        arrayList.add(ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(j10).array());
        arrayList.add(ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(80000000L).array());
        return arrayList;
    }

    public static final void e(yd.b bVar, Object obj) {
        i(bVar, "<this>");
        kotlin.jvm.internal.b bVar2 = (kotlin.jvm.internal.b) bVar;
        if (bVar2.d(obj)) {
            g(obj, "null cannot be cast to non-null type T of kotlin.reflect.KClasses.cast");
        } else {
            throw new ClassCastException("Value cannot be cast to " + bVar2.b());
        }
    }

    public static void f(Object obj) {
        if (obj != null) {
            return;
        }
        NullPointerException nullPointerException = new NullPointerException();
        Q(g.class.getName(), nullPointerException);
        throw nullPointerException;
    }

    public static void g(Object obj, String str) {
        if (obj != null) {
            return;
        }
        NullPointerException nullPointerException = new NullPointerException(str);
        Q(g.class.getName(), nullPointerException);
        throw nullPointerException;
    }

    public static void h(Object obj, String str) {
        if (obj != null) {
            return;
        }
        NullPointerException nullPointerException = new NullPointerException(str.concat(" must not be null"));
        Q(g.class.getName(), nullPointerException);
        throw nullPointerException;
    }

    public static void i(Object obj, String str) {
        if (obj == null) {
            StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
            String name = g.class.getName();
            int i10 = 0;
            while (!stackTrace[i10].getClassName().equals(name)) {
                i10++;
            }
            while (stackTrace[i10].getClassName().equals(name)) {
                i10++;
            }
            StackTraceElement stackTraceElement = stackTrace[i10];
            StringBuilder sbT = defpackage.e.t("Parameter specified as non-null is null: method ", stackTraceElement.getClassName(), ".", stackTraceElement.getMethodName(), ", parameter ");
            sbT.append(str);
            NullPointerException nullPointerException = new NullPointerException(sbT.toString());
            Q(g.class.getName(), nullPointerException);
            throw nullPointerException;
        }
    }

    public static int j(int i10, int i11) {
        if (i10 < i11) {
            return -1;
        }
        return i10 == i11 ? 0 : 1;
    }

    public static int k(f2 f2Var, x0 x0Var, View view, View view2, q1 q1Var, boolean z10) {
        if (q1Var.getChildCount() == 0 || f2Var.b() == 0 || view == null || view2 == null) {
            return 0;
        }
        if (!z10) {
            return Math.abs(q1Var.getPosition(view) - q1Var.getPosition(view2)) + 1;
        }
        return Math.min(x0Var.l(), x0Var.d(view2) - x0Var.g(view));
    }

    public static int l(f2 f2Var, x0 x0Var, View view, View view2, q1 q1Var, boolean z10, boolean z11) {
        if (q1Var.getChildCount() == 0 || f2Var.b() == 0 || view == null || view2 == null) {
            return 0;
        }
        int iMax = z11 ? Math.max(0, (f2Var.b() - Math.max(q1Var.getPosition(view), q1Var.getPosition(view2))) - 1) : Math.max(0, Math.min(q1Var.getPosition(view), q1Var.getPosition(view2)));
        if (z10) {
            return Math.round((iMax * (Math.abs(x0Var.d(view2) - x0Var.g(view)) / (Math.abs(q1Var.getPosition(view) - q1Var.getPosition(view2)) + 1))) + (x0Var.k() - x0Var.g(view)));
        }
        return iMax;
    }

    public static int m(f2 f2Var, x0 x0Var, View view, View view2, q1 q1Var, boolean z10) {
        if (q1Var.getChildCount() == 0 || f2Var.b() == 0 || view == null || view2 == null) {
            return 0;
        }
        if (!z10) {
            return f2Var.b();
        }
        return (int) (((x0Var.d(view2) - x0Var.g(view)) / (Math.abs(q1Var.getPosition(view) - q1Var.getPosition(view2)) + 1)) * f2Var.b());
    }

    public static void n(long j10, ParsableByteArray parsableByteArray, z0[] z0VarArr) {
        int i10;
        while (true) {
            if (parsableByteArray.bytesLeft() <= 1) {
                return;
            }
            int i11 = 0;
            while (true) {
                if (parsableByteArray.bytesLeft() == 0) {
                    i10 = -1;
                    break;
                }
                int unsignedByte = parsableByteArray.readUnsignedByte();
                i11 += unsignedByte;
                if (unsignedByte != 255) {
                    i10 = i11;
                    break;
                }
            }
            int i12 = 0;
            while (true) {
                if (parsableByteArray.bytesLeft() == 0) {
                    i12 = -1;
                    break;
                }
                int unsignedByte2 = parsableByteArray.readUnsignedByte();
                i12 += unsignedByte2;
                if (unsignedByte2 != 255) {
                    break;
                }
            }
            int position = parsableByteArray.getPosition() + i12;
            if (i12 == -1 || i12 > parsableByteArray.bytesLeft()) {
                androidx.media3.common.util.Log.w("CeaUtil", "Skipping remainder of malformed SEI NAL unit.");
                position = parsableByteArray.limit();
            } else if (i10 == 4 && i12 >= 8) {
                int unsignedByte3 = parsableByteArray.readUnsignedByte();
                int unsignedShort = parsableByteArray.readUnsignedShort();
                int i13 = unsignedShort == 49 ? parsableByteArray.readInt() : 0;
                int unsignedByte4 = parsableByteArray.readUnsignedByte();
                if (unsignedShort == 47) {
                    parsableByteArray.skipBytes(1);
                }
                boolean z10 = unsignedByte3 == 181 && (unsignedShort == 49 || unsignedShort == 47) && unsignedByte4 == 3;
                if (unsignedShort == 49) {
                    z10 &= i13 == 1195456820;
                }
                if (z10) {
                    o(j10, parsableByteArray, z0VarArr);
                }
            }
            parsableByteArray.setPosition(position);
        }
    }

    public static void o(long j10, ParsableByteArray parsableByteArray, z0[] z0VarArr) {
        int unsignedByte = parsableByteArray.readUnsignedByte();
        if ((unsignedByte & 64) != 0) {
            parsableByteArray.skipBytes(1);
            int i10 = (unsignedByte & 31) * 3;
            int position = parsableByteArray.getPosition();
            for (z0 z0Var : z0VarArr) {
                parsableByteArray.setPosition(position);
                z0Var.sampleData(parsableByteArray, i10);
                Assertions.checkState(j10 != -9223372036854775807L);
                z0Var.sampleMetadata(j10, 1, i10, 0, null);
            }
        }
    }

    public static com.google.firebase.components.a p(String str, String str2) {
        a aVar = new a(str, str2);
        v vVarB = com.google.firebase.components.a.b(a.class);
        vVarB.f213b = 1;
        vVarB.f217f = new androidx.media3.exoplayer.offline.e(aVar, 0);
        return vVarB.e();
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static Continuation q(final Object obj, final Continuation continuation, final Function2 function2) {
        i(function2, "<this>");
        i(continuation, "completion");
        if (function2 instanceof BaseContinuationImpl) {
            return ((BaseContinuationImpl) function2).create(obj, continuation);
        }
        final h context = continuation.getContext();
        return context == EmptyCoroutineContext.f29221a ? new RestrictedContinuationImpl(obj, continuation, function2) { // from class: kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$3
            final /* synthetic */ Object $receiver$inlined;
            final /* synthetic */ Function2 $this_createCoroutineUnintercepted$inlined;
            private int label;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            {
                super(continuation);
                this.$this_createCoroutineUnintercepted$inlined = function2;
                g.g(continuation, "null cannot be cast to non-null type kotlin.coroutines.Continuation<kotlin.Any?>");
            }

            @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
            public final Object invokeSuspend(Object obj2) {
                int i10 = this.label;
                if (i10 != 0) {
                    if (i10 != 1) {
                        throw new IllegalStateException("This coroutine had already completed".toString());
                    }
                    this.label = 2;
                    kotlin.a.d(obj2);
                    return obj2;
                }
                this.label = 1;
                kotlin.a.d(obj2);
                g.g(this.$this_createCoroutineUnintercepted$inlined, "null cannot be cast to non-null type kotlin.Function2<R of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$1, kotlin.coroutines.Continuation<T of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$1>, kotlin.Any?>");
                Function2 function22 = this.$this_createCoroutineUnintercepted$inlined;
                hb.a.c(2, function22);
                return function22.invoke(this.$receiver$inlined, this);
            }
        } : new ContinuationImpl(continuation, context, function2, obj) { // from class: kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$4
            final /* synthetic */ Object $receiver$inlined;
            final /* synthetic */ Function2 $this_createCoroutineUnintercepted$inlined;
            private int label;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            {
                super(continuation, context);
                this.$this_createCoroutineUnintercepted$inlined = function2;
                this.$receiver$inlined = obj;
                g.g(continuation, "null cannot be cast to non-null type kotlin.coroutines.Continuation<kotlin.Any?>");
            }

            @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
            public final Object invokeSuspend(Object obj2) {
                int i10 = this.label;
                if (i10 != 0) {
                    if (i10 != 1) {
                        throw new IllegalStateException("This coroutine had already completed".toString());
                    }
                    this.label = 2;
                    kotlin.a.d(obj2);
                    return obj2;
                }
                this.label = 1;
                kotlin.a.d(obj2);
                g.g(this.$this_createCoroutineUnintercepted$inlined, "null cannot be cast to non-null type kotlin.Function2<R of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$1, kotlin.coroutines.Continuation<T of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$1>, kotlin.Any?>");
                Function2 function22 = this.$this_createCoroutineUnintercepted$inlined;
                hb.a.c(2, function22);
                return function22.invoke(this.$receiver$inlined, this);
            }
        };
    }

    public static float r(float f10, float f11, float f12, float f13) {
        double d10 = f10 - f12;
        double d11 = f11 - f13;
        return (float) Math.sqrt((d11 * d11) + (d10 * d10));
    }

    public static float s(int i10, int i11, int i12, int i13) {
        double d10 = i10 - i12;
        double d11 = i11 - i13;
        return (float) Math.sqrt((d11 * d11) + (d10 * d10));
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static final ArrayList t(ListBuilder listBuilder, ListBuilder listBuilder2) {
        Iterator it = new xd.c(0, listBuilder2.size() - 1, 1).iterator();
        xd.b bVar = (xd.b) it;
        if (!bVar.f34812c) {
            throw new NoSuchElementException();
        }
        xd.b bVar2 = (xd.b) it;
        int iB = bVar2.b();
        if (bVar.f34812c) {
            float fU = u(((k) listBuilder.get(0)).f28993b, ((k) listBuilder2.get(iB)).f28993b);
            do {
                int iB2 = bVar2.b();
                float fU2 = u(((k) listBuilder.get(0)).f28993b, ((k) listBuilder2.get(iB2)).f28993b);
                if (Float.compare(fU, fU2) > 0) {
                    iB = iB2;
                    fU = fU2;
                }
            } while (bVar.f34812c);
        }
        int iF = listBuilder.getLength();
        int iF2 = listBuilder2.getLength();
        ArrayList arrayListQ0 = hb.a.q0(listBuilder2.get(iB));
        int i10 = iB;
        for (int i11 = 1; i11 < iF; i11++) {
            int i12 = iB - (iF - i11);
            if (i12 <= i10) {
                i12 += iF2;
            }
            Iterator it2 = new xd.c(i10 + 1, i12, 1).iterator();
            xd.b bVar3 = (xd.b) it2;
            if (!bVar3.f34812c) {
                throw new NoSuchElementException();
            }
            xd.b bVar4 = (xd.b) it2;
            int iB3 = bVar4.b();
            if (bVar3.f34812c) {
                float fU3 = u(((k) listBuilder.get(i11)).f28993b, ((k) listBuilder2.get(iB3 % iF2)).f28993b);
                do {
                    int iB4 = bVar4.b();
                    float fU4 = u(((k) listBuilder.get(i11)).f28993b, ((k) listBuilder2.get(iB4 % iF2)).f28993b);
                    if (Float.compare(fU3, fU4) > 0) {
                        iB3 = iB4;
                        fU3 = fU4;
                    }
                } while (bVar3.f34812c);
            }
            i10 = iB3;
            arrayListQ0.add(listBuilder2.get(i10 % iF2));
        }
        return arrayListQ0;
    }

    public static final float u(k1.g gVar, k1.g gVar2) {
        i(gVar, "f1");
        i(gVar2, "f2");
        if ((gVar instanceof k1.e) && (gVar2 instanceof k1.e) && ((k1.e) gVar).f28982d != ((k1.e) gVar2).f28982d) {
            return Float.MAX_VALUE;
        }
        List list = gVar.f28983a;
        float fA = (((k1.c) n.k1(list)).a() + ((k1.c) n.e1(list)).f28977a[0]) / 2.0f;
        float fB = (((k1.c) n.k1(list)).b() + ((k1.c) n.e1(list)).f28977a[1]) / 2.0f;
        List list2 = gVar2.f28983a;
        float fA2 = (((k1.c) n.k1(list2)).a() + ((k1.c) n.e1(list2)).f28977a[0]) / 2.0f;
        float f10 = fA - fA2;
        float fB2 = fB - ((((k1.c) n.k1(list2)).b() + ((k1.c) n.e1(list2)).f28977a[1]) / 2.0f);
        return (fB2 * fB2) + (f10 * f10);
    }

    public static InvocationHandler v() {
        ClassLoader classLoader;
        if (Build.VERSION.SDK_INT >= 28) {
            classLoader = WebView.getWebViewClassLoader();
        } else {
            try {
                Method declaredMethod = WebView.class.getDeclaredMethod("getFactory", new Class[0]);
                declaredMethod.setAccessible(true);
                classLoader = declaredMethod.invoke(null, new Object[0]).getClass().getClassLoader();
            } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e10) {
                throw new RuntimeException(e10);
            }
        }
        return (InvocationHandler) Class.forName("org.chromium.support_lib_glue.SupportLibReflectionUtil", false, classLoader).getDeclaredMethod("createWebViewProviderFactory", new Class[0]).invoke(null, new Object[0]);
    }

    /* JADX WARN: Removed duplicated region for block: B:12:0x0020  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x0023 A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static String w() {
        String processName;
        String str;
        if (TextUtils.isEmpty(f31187a)) {
            String str2 = null;
            if (Build.VERSION.SDK_INT >= 28) {
                try {
                    processName = Application.getProcessName();
                } catch (Throwable unused) {
                    processName = null;
                }
                f31187a = processName;
                if (TextUtils.isEmpty(processName)) {
                    str = f31187a;
                } else {
                    try {
                        Method declaredMethod = Class.forName("android.app.ActivityThread", false, Application.class.getClassLoader()).getDeclaredMethod("currentProcessName", new Class[0]);
                        declaredMethod.setAccessible(true);
                        Object objInvoke = declaredMethod.invoke(null, new Object[0]);
                        if (objInvoke instanceof String) {
                            str2 = (String) objInvoke;
                        }
                    } catch (Throwable unused2) {
                    }
                    f31187a = str2;
                    str = !TextUtils.isEmpty(str2) ? f31187a : f31187a;
                }
            } else {
                processName = null;
                f31187a = processName;
                if (TextUtils.isEmpty(processName)) {
                }
            }
        } else {
            str = f31187a;
        }
        return (TextUtils.isEmpty(str) || !str.contains(":")) ? str : str.replace(":", "_");
    }

    public static String x(File file) {
        int i10;
        if (!file.isFile()) {
            return "";
        }
        byte[] bArr = new byte[1024];
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("MD5");
            BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
            while (true) {
                int i11 = bufferedInputStream.read(bArr, 0, 1024);
                if (i11 == -1) {
                    break;
                }
                messageDigest.update(bArr, 0, i11);
            }
            if (!TextUtils.isEmpty(null)) {
                throw null;
            }
            bufferedInputStream.close();
            byte[] bArrDigest = messageDigest.digest();
            if (bArrDigest == null || bArrDigest.length <= 0) {
                return "";
            }
            char[] cArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
            char[] cArr2 = new char[bArrDigest.length * 2];
            int i12 = 0;
            for (byte b10 : bArrDigest) {
                int i13 = i12 + 1;
                cArr2[i12] = cArr[(b10 >>> 4) & 15];
                i12 += 2;
                cArr2[i13] = cArr[b10 & 15];
            }
            return new String(cArr2);
        } catch (Exception unused) {
            return "";
        }
    }

    public static com.google.firebase.components.a y(String str, oa.a aVar) {
        v vVarB = com.google.firebase.components.a.b(a.class);
        vVarB.f213b = 1;
        vVarB.d(com.google.firebase.components.k.a(Context.class));
        vVarB.f217f = new e(str, aVar, 0);
        return vVarB.e();
    }

    public static int z(int i10) {
        int numberOfCameras = Camera.getNumberOfCameras();
        if (numberOfCameras == 0) {
            return -1;
        }
        boolean z10 = i10 >= 0;
        if (!z10) {
            i10 = 0;
            while (i10 < numberOfCameras) {
                Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
                Camera.getCameraInfo(i10, cameraInfo);
                if (cameraInfo.facing == 0) {
                    break;
                }
                i10++;
            }
        }
        return i10 < numberOfCameras ? i10 : z10 ? -1 : 0;
    }

    public abstract Object D(Continuation continuation);

    public abstract Object M(Uri uri, InputEvent inputEvent, Continuation continuation);

    public abstract Object N(Uri uri, Continuation continuation);
}
