package o;

import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ShortcutManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;
import androidx.core.graphics.drawable.IconCompat;
import com.google.android.material.appbar.MaterialToolbar;
import ir.devixor.app.service.ForegroundService;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collection;
import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public abstract class C80 implements InterfaceC1888mk0 {
    public static volatile A80 a;
    public static volatile ArrayList b;
    public static final C2943xq c = new C2943xq("RESUME_TOKEN", 4);
    public static final C0688a6 d = new C0688a6(20);
    public static final byte[] e = {112, 114, 111, 0};
    public static final byte[] f = {112, 114, 109, 0};
    public static final C1746lA g = new C1746lA(12);
    public static CG h;
    public static CG i;
    public static CG j;

    public static List A(ForegroundService foregroundService) {
        Bundle bundle;
        String string;
        if (b == null) {
            ArrayList arrayList = new ArrayList();
            PackageManager packageManager = foregroundService.getPackageManager();
            Intent intent = new Intent("androidx.core.content.pm.SHORTCUT_LISTENER");
            intent.setPackage(foregroundService.getPackageName());
            Iterator<ResolveInfo> it = packageManager.queryIntentActivities(intent, 128).iterator();
            while (it.hasNext()) {
                ActivityInfo activityInfo = it.next().activityInfo;
                if (activityInfo != null && (bundle = activityInfo.metaData) != null && (string = bundle.getString("androidx.core.content.pm.shortcut_listener_impl")) != null) {
                    try {
                        if (Class.forName(string, false, C80.class.getClassLoader()).getMethod("getInstance", Context.class).invoke(null, foregroundService) != null) {
                            throw new ClassCastException();
                        }
                        arrayList.add(null);
                    } catch (Exception unused) {
                        continue;
                    }
                }
            }
            if (b == null) {
                b = arrayList;
            }
        }
        return b;
    }

    public static ArrayList B(MaterialToolbar materialToolbar, CharSequence charSequence) {
        ArrayList arrayList = new ArrayList();
        for (int i2 = 0; i2 < materialToolbar.getChildCount(); i2++) {
            View childAt = materialToolbar.getChildAt(i2);
            if (childAt instanceof TextView) {
                TextView textView = (TextView) childAt;
                if (TextUtils.equals(textView.getText(), charSequence)) {
                    arrayList.add(textView);
                }
            }
        }
        return arrayList;
    }

    public static final float C(C2872x30 c2872x30) {
        if (c2872x30 != null) {
            return c2872x30.a;
        }
        return 0.0f;
    }

    public static final boolean D(InterfaceC0065Cn interfaceC0065Cn) {
        TI ti = (TI) interfaceC0065Cn.i().m(C0669Zu.K);
        if (ti != null) {
            return ti.b();
        }
        return true;
    }

    public static final boolean E(T00 t00, T00 t002, T00 t003, int i2) {
        if (!F(i2, t00, t003)) {
            return false;
        }
        if (F(i2, t002, t003) && !j(t003, t00, t002, i2)) {
            return !j(t003, t002, t00, i2) && G(i2, t003, t00) < G(i2, t003, t002);
        }
        return true;
    }

    public static final boolean F(int i2, T00 t00, T00 t002) {
        float f2 = t00.b;
        float f3 = t00.d;
        float f4 = t00.a;
        float f5 = t00.c;
        if (i2 == 3) {
            float f6 = t002.c;
            float f7 = t002.a;
            return (f6 > f5 || f7 >= f5) && f7 > f4;
        }
        if (i2 == 4) {
            float f8 = t002.a;
            float f9 = t002.c;
            return (f8 < f4 || f9 <= f4) && f9 < f5;
        }
        if (i2 == 5) {
            float f10 = t002.d;
            float f11 = t002.b;
            return (f10 > f3 || f11 >= f3) && f11 > f2;
        }
        if (i2 != 6) {
            throw new IllegalStateException("This function should only be used for 2-D focus search");
        }
        float f12 = t002.b;
        float f13 = t002.d;
        return (f12 < f2 || f13 <= f2) && f13 < f3;
    }

    public static final long G(int i2, T00 t00, T00 t002) {
        float f2;
        float f3;
        float f4 = t002.b;
        float f5 = t002.d;
        float f6 = t002.a;
        float f7 = t002.c;
        if (i2 == 3) {
            f2 = t00.a - f7;
        } else if (i2 == 4) {
            f2 = f6 - t00.c;
        } else if (i2 == 5) {
            f2 = t00.b - f5;
        } else {
            if (i2 != 6) {
                throw new IllegalStateException("This function should only be used for 2-D focus search");
            }
            f2 = f4 - t00.d;
        }
        if (f2 < 0.0f) {
            f2 = 0.0f;
        }
        long j2 = (long) f2;
        if (i2 == 3 || i2 == 4) {
            float f8 = t00.b;
            float f9 = 2;
            f3 = (((t00.d - f8) / f9) + f8) - (((f5 - f4) / f9) + f4);
        } else {
            if (i2 != 5 && i2 != 6) {
                throw new IllegalStateException("This function should only be used for 2-D focus search");
            }
            float f10 = t00.a;
            float f11 = 2;
            f3 = (((t00.c - f10) / f11) + f10) - (((f7 - f6) / f11) + f6);
        }
        long j3 = (long) f3;
        return (j3 * j3) + (13 * j2 * j2);
    }

    public static String H(X509Certificate x509Certificate) throws NoSuchAlgorithmException {
        if (x509Certificate == null) {
            throw new IllegalArgumentException("Certificate pinning requires X509 certificates");
        }
        StringBuilder sb = new StringBuilder("sha256/");
        byte[] encoded = x509Certificate.getPublicKey().getEncoded();
        int length = encoded.length;
        int i2 = 0;
        F3.l(encoded.length, 0, length);
        AbstractC2461sm0.d(length, encoded.length);
        byte[] bArrCopyOfRange = Arrays.copyOfRange(encoded, 0, length);
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
        messageDigest.update(bArrCopyOfRange, 0, bArrCopyOfRange.length);
        byte[] bArrDigest = messageDigest.digest();
        byte[] bArr = AbstractC0675a.a;
        byte[] bArr2 = new byte[((bArrDigest.length + 2) / 3) * 4];
        int length2 = bArrDigest.length - (bArrDigest.length % 3);
        int i3 = 0;
        while (i2 < length2) {
            byte b2 = bArrDigest[i2];
            int i4 = i2 + 2;
            byte b3 = bArrDigest[i2 + 1];
            i2 += 3;
            byte b4 = bArrDigest[i4];
            bArr2[i3] = bArr[(b2 & 255) >> 2];
            bArr2[i3 + 1] = bArr[((b2 & 3) << 4) | ((b3 & 255) >> 4)];
            int i5 = i3 + 3;
            bArr2[i3 + 2] = bArr[((b3 & 15) << 2) | ((b4 & 255) >> 6)];
            i3 += 4;
            bArr2[i5] = bArr[b4 & 63];
        }
        int length3 = bArrDigest.length - length2;
        if (length3 == 1) {
            byte b5 = bArrDigest[i2];
            bArr2[i3] = bArr[(b5 & 255) >> 2];
            bArr2[i3 + 1] = bArr[(b5 & 3) << 4];
            bArr2[i3 + 2] = 61;
            bArr2[i3 + 3] = 61;
        } else if (length3 == 2) {
            int i6 = i2 + 1;
            byte b6 = bArrDigest[i2];
            byte b7 = bArrDigest[i6];
            bArr2[i3] = bArr[(b6 & 255) >> 2];
            bArr2[i3 + 1] = bArr[((b6 & 3) << 4) | ((b7 & 255) >> 4)];
            bArr2[i3 + 2] = bArr[(b7 & 15) << 2];
            bArr2[i3 + 3] = 61;
        }
        sb.append(new String(bArr2, AbstractC2355rh.a));
        return sb.toString();
    }

    public static void I(ForegroundService foregroundService, C3072z80 c3072z80) {
        IconCompat iconCompat;
        int i2;
        InputStream inputStreamG;
        Bitmap bitmapDecodeStream;
        IconCompat iconCompatB;
        int i3 = Build.VERSION.SDK_INT;
        int maxShortcutCountPerActivity = i3 >= 25 ? AbstractC0955cv.f(foregroundService.getSystemService(AbstractC0955cv.g())).getMaxShortcutCountPerActivity() : 5;
        if (maxShortcutCountPerActivity == 0) {
            return;
        }
        if (i3 <= 29 && (iconCompat = c3072z80.f) != null && (((i2 = iconCompat.a) == 6 || i2 == 4) && (inputStreamG = iconCompat.g(foregroundService)) != null && (bitmapDecodeStream = BitmapFactory.decodeStream(inputStreamG)) != null)) {
            if (i2 == 6) {
                iconCompatB = new IconCompat(5);
                iconCompatB.b = bitmapDecodeStream;
            } else {
                iconCompatB = IconCompat.b(bitmapDecodeStream);
            }
            c3072z80.f = iconCompatB;
        }
        if (i3 >= 30) {
            AbstractC0955cv.f(foregroundService.getSystemService(AbstractC0955cv.g())).pushDynamicShortcut(c3072z80.a());
        } else if (i3 >= 25) {
            ShortcutManager shortcutManagerF = AbstractC0955cv.f(foregroundService.getSystemService(AbstractC0955cv.g()));
            if (shortcutManagerF.isRateLimitingActive()) {
                return;
            }
            List dynamicShortcuts = shortcutManagerF.getDynamicShortcuts();
            if (dynamicShortcuts.size() >= maxShortcutCountPerActivity) {
                shortcutManagerF.removeDynamicShortcuts(Arrays.asList(B80.a(dynamicShortcuts)));
            }
            shortcutManagerF.addDynamicShortcuts(Arrays.asList(c3072z80.a()));
        }
        if (a == null) {
            try {
                a = (A80) Class.forName("androidx.sharetarget.ShortcutInfoCompatSaverImpl", false, C80.class.getClassLoader()).getMethod("getInstance", Context.class).invoke(null, foregroundService);
            } catch (Exception unused) {
            }
            if (a == null) {
                a = new A80();
            }
        }
        try {
            a.getClass();
            ArrayList arrayList = new ArrayList();
            if (arrayList.size() >= maxShortcutCountPerActivity) {
                int size = arrayList.size();
                char c2 = 65535;
                String str = null;
                int i4 = 0;
                while (i4 < size) {
                    Object obj = arrayList.get(i4);
                    i4++;
                    C3072z80 c3072z802 = (C3072z80) obj;
                    c3072z802.getClass();
                    if (c2 < 0) {
                        str = c3072z802.b;
                        c2 = 0;
                    }
                }
                Arrays.asList(str);
            }
            Arrays.asList(c3072z80);
            Iterator it = ((ArrayList) A(foregroundService)).iterator();
            if (it.hasNext()) {
                if (it.next() != null) {
                    throw new ClassCastException();
                }
                Collections.singletonList(c3072z80);
                throw null;
            }
        } catch (Exception unused2) {
            Iterator it2 = ((ArrayList) A(foregroundService)).iterator();
            if (it2.hasNext()) {
                if (it2.next() != null) {
                    throw new ClassCastException();
                }
                Collections.singletonList(c3072z80);
                throw null;
            }
        } catch (Throwable th) {
            Iterator it3 = ((ArrayList) A(foregroundService)).iterator();
            if (!it3.hasNext()) {
                S(foregroundService, c3072z80.b);
                throw th;
            }
            if (it3.next() != null) {
                throw new ClassCastException();
            }
            Collections.singletonList(c3072z80);
            throw null;
        }
        S(foregroundService, c3072z80.b);
    }

    public static int[] J(ByteArrayInputStream byteArrayInputStream, int i2) {
        int[] iArr = new int[i2];
        int iX = 0;
        for (int i3 = 0; i3 < i2; i3++) {
            iX += (int) C2887xC.x(byteArrayInputStream, 2);
            iArr[i3] = iX;
        }
        return iArr;
    }

    public static final Zm0 K(C1822m00 c1822m00) throws IOException {
        Long lValueOf;
        int iT = c1822m00.t();
        if (iT != 33639248) {
            throw new IOException("bad zip: expected " + y(33639248) + " but was " + y(iT));
        }
        c1822m00.skip(4L);
        short sX = c1822m00.x();
        int i2 = sX & 65535;
        if ((sX & 1) != 0) {
            throw new IOException("unsupported zip: general purpose bit flag=" + y(i2));
        }
        int iX = c1822m00.x() & 65535;
        short sX2 = c1822m00.x();
        int i3 = sX2 & 65535;
        short sX3 = c1822m00.x();
        int i4 = sX3 & 65535;
        if (i3 == -1) {
            lValueOf = null;
        } else {
            GregorianCalendar gregorianCalendar = new GregorianCalendar();
            gregorianCalendar.set(14, 0);
            gregorianCalendar.set(((i4 >> 9) & 127) + 1980, ((i4 >> 5) & 15) - 1, sX3 & 31, (i3 >> 11) & 31, (i3 >> 5) & 63, (sX2 & 31) << 1);
            lValueOf = Long.valueOf(gregorianCalendar.getTime().getTime());
        }
        Long l = lValueOf;
        c1822m00.t();
        A10 a10 = new A10();
        a10.l = c1822m00.t() & 4294967295L;
        A10 a102 = new A10();
        a102.l = c1822m00.t() & 4294967295L;
        int iX2 = c1822m00.x() & 65535;
        int iX3 = c1822m00.x() & 65535;
        int iX4 = c1822m00.x() & 65535;
        c1822m00.skip(8L);
        A10 a103 = new A10();
        a103.l = c1822m00.t() & 4294967295L;
        String strF = c1822m00.f(iX2);
        if (Za0.Q(strF, (char) 0)) {
            throw new IOException("bad zip: filename contains 0x00");
        }
        long j2 = a102.l == 4294967295L ? 8 : 0L;
        if (a10.l == 4294967295L) {
            j2 += 8;
        }
        if (a103.l == 4294967295L) {
            j2 += 8;
        }
        long j3 = j2;
        C2773w10 c2773w10 = new C2773w10();
        L(c1822m00, iX3, new C0845bn0(c2773w10, j3, a102, c1822m00, a10, a103));
        if (j3 > 0 && !c2773w10.l) {
            throw new IOException("bad zip: zip64 extra required but absent");
        }
        c1822m00.f(iX4);
        String str = SV.m;
        return new Zm0(BP.n("/").d(strF), strF.endsWith("/"), a10.l, a102.l, iX, l, a103.l);
    }

    public static final void L(InterfaceC1687kf interfaceC1687kf, int i2, SC sc) throws IOException {
        long j2 = i2;
        while (j2 != 0) {
            if (j2 < 4) {
                throw new IOException("bad zip: truncated header in extra field");
            }
            int iX = interfaceC1687kf.x() & 65535;
            long jX = interfaceC1687kf.x() & 65535;
            long j3 = j2 - 4;
            if (j3 < jX) {
                throw new IOException("bad zip: truncated value in extra field");
            }
            interfaceC1687kf.I(jX);
            long j4 = interfaceC1687kf.v().m;
            sc.f(Integer.valueOf(iX), Long.valueOf(jX));
            long j5 = (interfaceC1687kf.v().m + jX) - j4;
            if (j5 < 0) {
                throw new IOException(AbstractC0126Ew.j(iX, "unsupported zip: too many bytes processed for "));
            }
            if (j5 > 0) {
                interfaceC1687kf.v().skip(j5);
            }
            j2 = j3 - jX;
        }
    }

    public static C0199Hr[] M(FileInputStream fileInputStream, byte[] bArr, byte[] bArr2, C0199Hr[] c0199HrArr) throws IOException {
        byte[] bArr3 = AbstractC1692kh0.s;
        if (!Arrays.equals(bArr, bArr3)) {
            if (!Arrays.equals(bArr, AbstractC1692kh0.t)) {
                throw new IllegalStateException("Unsupported meta version");
            }
            int iX = (int) C2887xC.x(fileInputStream, 2);
            byte[] bArrW = C2887xC.w(fileInputStream, (int) C2887xC.x(fileInputStream, 4), (int) C2887xC.x(fileInputStream, 4));
            if (fileInputStream.read() > 0) {
                throw new IllegalStateException("Content found after the end of file");
            }
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArrW);
            try {
                C0199Hr[] c0199HrArrO = O(byteArrayInputStream, bArr2, iX, c0199HrArr);
                byteArrayInputStream.close();
                return c0199HrArrO;
            } catch (Throwable th) {
                try {
                    byteArrayInputStream.close();
                } catch (Throwable th2) {
                    th.addSuppressed(th2);
                }
                throw th;
            }
        }
        if (Arrays.equals(AbstractC1692kh0.n, bArr2)) {
            throw new IllegalStateException("Requires new Baseline Profile Metadata. Please rebuild the APK with Android Gradle Plugin 7.2 Canary 7 or higher");
        }
        if (!Arrays.equals(bArr, bArr3)) {
            throw new IllegalStateException("Unsupported meta version");
        }
        int iX2 = (int) C2887xC.x(fileInputStream, 1);
        byte[] bArrW2 = C2887xC.w(fileInputStream, (int) C2887xC.x(fileInputStream, 4), (int) C2887xC.x(fileInputStream, 4));
        if (fileInputStream.read() > 0) {
            throw new IllegalStateException("Content found after the end of file");
        }
        ByteArrayInputStream byteArrayInputStream2 = new ByteArrayInputStream(bArrW2);
        try {
            C0199Hr[] c0199HrArrN = N(byteArrayInputStream2, iX2, c0199HrArr);
            byteArrayInputStream2.close();
            return c0199HrArrN;
        } catch (Throwable th3) {
            try {
                byteArrayInputStream2.close();
            } catch (Throwable th4) {
                th3.addSuppressed(th4);
            }
            throw th3;
        }
    }

    public static C0199Hr[] N(ByteArrayInputStream byteArrayInputStream, int i2, C0199Hr[] c0199HrArr) {
        if (byteArrayInputStream.available() == 0) {
            return new C0199Hr[0];
        }
        if (i2 != c0199HrArr.length) {
            throw new IllegalStateException("Mismatched number of dex files found in metadata");
        }
        String[] strArr = new String[i2];
        int[] iArr = new int[i2];
        for (int i3 = 0; i3 < i2; i3++) {
            int iX = (int) C2887xC.x(byteArrayInputStream, 2);
            iArr[i3] = (int) C2887xC.x(byteArrayInputStream, 2);
            strArr[i3] = new String(C2887xC.v(byteArrayInputStream, iX), StandardCharsets.UTF_8);
        }
        for (int i4 = 0; i4 < i2; i4++) {
            C0199Hr c0199Hr = c0199HrArr[i4];
            if (!c0199Hr.b.equals(strArr[i4])) {
                throw new IllegalStateException("Order of dexfiles in metadata did not match baseline");
            }
            int i5 = iArr[i4];
            c0199Hr.e = i5;
            c0199Hr.h = J(byteArrayInputStream, i5);
        }
        return c0199HrArr;
    }

    public static C0199Hr[] O(ByteArrayInputStream byteArrayInputStream, byte[] bArr, int i2, C0199Hr[] c0199HrArr) {
        if (byteArrayInputStream.available() == 0) {
            return new C0199Hr[0];
        }
        if (i2 != c0199HrArr.length) {
            throw new IllegalStateException("Mismatched number of dex files found in metadata");
        }
        for (int i3 = 0; i3 < i2; i3++) {
            C2887xC.x(byteArrayInputStream, 2);
            String str = new String(C2887xC.v(byteArrayInputStream, (int) C2887xC.x(byteArrayInputStream, 2)), StandardCharsets.UTF_8);
            long jX = C2887xC.x(byteArrayInputStream, 4);
            int iX = (int) C2887xC.x(byteArrayInputStream, 2);
            C0199Hr c0199Hr = null;
            if (c0199HrArr.length > 0) {
                int iIndexOf = str.indexOf("!");
                if (iIndexOf < 0) {
                    iIndexOf = str.indexOf(":");
                }
                String strSubstring = iIndexOf > 0 ? str.substring(iIndexOf + 1) : str;
                int i4 = 0;
                while (true) {
                    if (i4 >= c0199HrArr.length) {
                        break;
                    }
                    if (c0199HrArr[i4].b.equals(strSubstring)) {
                        c0199Hr = c0199HrArr[i4];
                        break;
                    }
                    i4++;
                }
            }
            if (c0199Hr == null) {
                throw new IllegalStateException("Missing profile key: ".concat(str));
            }
            c0199Hr.d = jX;
            int[] iArrJ = J(byteArrayInputStream, iX);
            if (Arrays.equals(bArr, AbstractC1692kh0.r)) {
                c0199Hr.e = iX;
                c0199Hr.h = iArrJ;
            }
        }
        return c0199HrArr;
    }

    public static final C3135zr P(C1822m00 c1822m00, C3135zr c3135zr) throws IOException {
        B10 b10 = new B10();
        b10.l = c3135zr != null ? (Long) c3135zr.g : null;
        B10 b102 = new B10();
        B10 b103 = new B10();
        int iT = c1822m00.t();
        if (iT != 67324752) {
            throw new IOException("bad zip: expected " + y(67324752) + " but was " + y(iT));
        }
        c1822m00.skip(2L);
        short sX = c1822m00.x();
        int i2 = sX & 65535;
        if ((sX & 1) != 0) {
            throw new IOException("unsupported zip: general purpose bit flag=" + y(i2));
        }
        c1822m00.skip(18L);
        int iX = 65535 & c1822m00.x();
        c1822m00.skip(c1822m00.x() & 65535);
        if (c3135zr == null) {
            c1822m00.skip(iX);
            return null;
        }
        L(c1822m00, iX, new C0196Ho(c1822m00, b10, b102, b103, 1));
        return new C3135zr(c3135zr.b, c3135zr.c, null, (Long) c3135zr.e, (Long) b103.l, (Long) b10.l, (Long) b102.l);
    }

    public static C0199Hr[] Q(FileInputStream fileInputStream, byte[] bArr, String str) throws IOException {
        if (!Arrays.equals(bArr, AbstractC1692kh0.f616o)) {
            throw new IllegalStateException("Unsupported version");
        }
        int iX = (int) C2887xC.x(fileInputStream, 1);
        byte[] bArrW = C2887xC.w(fileInputStream, (int) C2887xC.x(fileInputStream, 4), (int) C2887xC.x(fileInputStream, 4));
        if (fileInputStream.read() > 0) {
            throw new IllegalStateException("Content found after the end of file");
        }
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArrW);
        try {
            C0199Hr[] c0199HrArrR = R(byteArrayInputStream, str, iX);
            byteArrayInputStream.close();
            return c0199HrArrR;
        } catch (Throwable th) {
            try {
                byteArrayInputStream.close();
            } catch (Throwable th2) {
                th.addSuppressed(th2);
            }
            throw th;
        }
    }

    public static C0199Hr[] R(ByteArrayInputStream byteArrayInputStream, String str, int i2) throws IOException {
        int i3 = 0;
        if (byteArrayInputStream.available() == 0) {
            return new C0199Hr[0];
        }
        C0199Hr[] c0199HrArr = new C0199Hr[i2];
        for (int i4 = 0; i4 < i2; i4++) {
            int iX = (int) C2887xC.x(byteArrayInputStream, 2);
            int iX2 = (int) C2887xC.x(byteArrayInputStream, 2);
            c0199HrArr[i4] = new C0199Hr(str, new String(C2887xC.v(byteArrayInputStream, iX), StandardCharsets.UTF_8), C2887xC.x(byteArrayInputStream, 4), iX2, (int) C2887xC.x(byteArrayInputStream, 4), (int) C2887xC.x(byteArrayInputStream, 4), new int[iX2], new TreeMap());
        }
        int i5 = 0;
        while (i5 < i2) {
            C0199Hr c0199Hr = c0199HrArr[i5];
            int iAvailable = byteArrayInputStream.available();
            int i6 = c0199Hr.f;
            int i7 = c0199Hr.g;
            TreeMap treeMap = c0199Hr.i;
            int i8 = iAvailable - i6;
            int iX3 = i3;
            while (byteArrayInputStream.available() > i8) {
                iX3 += (int) C2887xC.x(byteArrayInputStream, 2);
                treeMap.put(Integer.valueOf(iX3), 1);
                int iX4 = (int) C2887xC.x(byteArrayInputStream, 2);
                while (iX4 > 0) {
                    C2887xC.x(byteArrayInputStream, 2);
                    int iX5 = (int) C2887xC.x(byteArrayInputStream, 1);
                    if (iX5 != 6 && iX5 != 7) {
                        while (iX5 > 0) {
                            C2887xC.x(byteArrayInputStream, 1);
                            int i9 = i3;
                            int i10 = i5;
                            for (int iX6 = (int) C2887xC.x(byteArrayInputStream, 1); iX6 > 0; iX6--) {
                                C2887xC.x(byteArrayInputStream, 2);
                            }
                            iX5--;
                            i3 = i9;
                            i5 = i10;
                        }
                    }
                    iX4--;
                    i3 = i3;
                    i5 = i5;
                }
            }
            int i11 = i3;
            int i12 = i5;
            if (byteArrayInputStream.available() != i8) {
                throw new IllegalStateException("Read too much data during profile line parse");
            }
            c0199Hr.h = J(byteArrayInputStream, c0199Hr.e);
            BitSet bitSetValueOf = BitSet.valueOf(C2887xC.v(byteArrayInputStream, (((i7 * 2) + 7) & (-8)) / 8));
            for (int i13 = i11; i13 < i7; i13++) {
                int i14 = bitSetValueOf.get(i13) ? 2 : i11;
                if (bitSetValueOf.get(i13 + i7)) {
                    i14 |= 4;
                }
                if (i14 != 0) {
                    Integer numValueOf = (Integer) treeMap.get(Integer.valueOf(i13));
                    if (numValueOf == null) {
                        numValueOf = Integer.valueOf(i11);
                    }
                    treeMap.put(Integer.valueOf(i13), Integer.valueOf(i14 | numValueOf.intValue()));
                }
            }
            i5 = i12 + 1;
            i3 = i11;
        }
        return c0199HrArr;
    }

    public static void S(ForegroundService foregroundService, String str) {
        str.getClass();
        if (Build.VERSION.SDK_INT >= 25) {
            AbstractC0955cv.f(foregroundService.getSystemService(AbstractC0955cv.g())).reportShortcutUsed(str);
        }
        Iterator it = ((ArrayList) A(foregroundService)).iterator();
        if (it.hasNext()) {
            if (it.next() != null) {
                throw new ClassCastException();
            }
            Collections.singletonList(str);
            throw null;
        }
    }

    public static TypedValue T(Context context, int i2) {
        TypedValue typedValue = new TypedValue();
        if (context.getTheme().resolveAttribute(i2, typedValue, true)) {
            return typedValue;
        }
        return null;
    }

    public static boolean U(Context context, int i2, boolean z) {
        TypedValue typedValueT = T(context, i2);
        return (typedValueT == null || typedValueT.type != 18) ? z : typedValueT.data != 0;
    }

    public static TypedValue V(Context context, int i2, String str) {
        TypedValue typedValueT = T(context, i2);
        if (typedValueT != null) {
            return typedValueT;
        }
        throw new IllegalArgumentException(String.format("%1$s requires a value for the %2$s attribute to be set in your app theme. You can either set the attribute in your theme or update your theme to inherit from Theme.MaterialComponents (or a descendant).", str, context.getResources().getResourceName(i2)));
    }

    public static final boolean W(int i2, V5 v5, C1556jA c1556jA, T00 t00) {
        C1556jA c1556jAT;
        C1479iR c1479iR = new C1479iR(new C1556jA[16]);
        if (!c1556jA.l.y) {
            AbstractC2133pH.b("visitChildren called on an unattached node");
        }
        C1479iR c1479iR2 = new C1479iR(new LP[16]);
        LP lp = c1556jA.l;
        LP lp2 = lp.q;
        if (lp2 == null) {
            AbstractC2539te.g(c1479iR2, lp);
        } else {
            c1479iR2.b(lp2);
        }
        while (true) {
            int i3 = c1479iR2.n;
            if (i3 == 0) {
                break;
            }
            LP lpI = (LP) c1479iR2.k(i3 - 1);
            if ((lpI.f209o & 1024) == 0) {
                AbstractC2539te.g(c1479iR2, lpI);
            } else {
                while (true) {
                    if (lpI == null) {
                        break;
                    }
                    if ((lpI.n & 1024) != 0) {
                        C1479iR c1479iR3 = null;
                        while (lpI != null) {
                            if (lpI instanceof C1556jA) {
                                C1556jA c1556jA2 = (C1556jA) lpI;
                                if (c1556jA2.y) {
                                    c1479iR.b(c1556jA2);
                                }
                            } else if ((lpI.n & 1024) != 0 && (lpI instanceof AbstractC0561Vq)) {
                                int i4 = 0;
                                for (LP lp3 = ((AbstractC0561Vq) lpI).A; lp3 != null; lp3 = lp3.q) {
                                    if ((lp3.n & 1024) != 0) {
                                        i4++;
                                        if (i4 == 1) {
                                            lpI = lp3;
                                        } else {
                                            if (c1479iR3 == null) {
                                                c1479iR3 = new C1479iR(new LP[16]);
                                            }
                                            if (lpI != null) {
                                                c1479iR3.b(lpI);
                                                lpI = null;
                                            }
                                            c1479iR3.b(lp3);
                                        }
                                    }
                                }
                                if (i4 == 1) {
                                }
                            }
                            lpI = AbstractC2539te.i(c1479iR3);
                        }
                    } else {
                        lpI = lpI.q;
                    }
                }
            }
        }
        while (c1479iR.n != 0 && (c1556jAT = t(c1479iR, t00, i2)) != null) {
            if (c1556jAT.I0().a) {
                return ((Boolean) v5.g(c1556jAT)).booleanValue();
            }
            if (v(i2, v5, c1556jAT, t00)) {
                return true;
            }
            c1479iR.j(c1556jAT);
        }
        return false;
    }

    public static final String X(float f2) {
        if (Float.isNaN(f2)) {
            return "NaN";
        }
        if (Float.isInfinite(f2)) {
            return f2 < 0.0f ? "-Infinity" : "Infinity";
        }
        int iMax = Math.max(1, 0);
        float fPow = (float) Math.pow(10.0f, iMax);
        float f3 = f2 * fPow;
        int i2 = (int) f3;
        if (f3 - i2 >= 0.5f) {
            i2++;
        }
        float f4 = i2 / fPow;
        return iMax > 0 ? String.valueOf(f4) : String.valueOf((int) f4);
    }

    /* JADX WARN: Finally extract failed */
    public static boolean Y(ByteArrayOutputStream byteArrayOutputStream, byte[] bArr, C0199Hr[] c0199HrArr) throws IOException {
        long j2;
        int length;
        byte[] bArr2 = AbstractC1692kh0.r;
        byte[] bArr3 = AbstractC1692kh0.q;
        byte[] bArr4 = AbstractC1692kh0.n;
        int i2 = 0;
        if (Arrays.equals(bArr, bArr4)) {
            ArrayList arrayList = new ArrayList(3);
            ArrayList arrayList2 = new ArrayList(3);
            ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
            try {
                C2887xC.I(byteArrayOutputStream2, c0199HrArr.length);
                int i3 = 2;
                int i4 = 2;
                for (C0199Hr c0199Hr : c0199HrArr) {
                    C2887xC.H(byteArrayOutputStream2, c0199Hr.c, 4);
                    C2887xC.H(byteArrayOutputStream2, c0199Hr.d, 4);
                    C2887xC.H(byteArrayOutputStream2, c0199Hr.g, 4);
                    String strW = w(c0199Hr.a, c0199Hr.b, bArr4);
                    Charset charset = StandardCharsets.UTF_8;
                    int length2 = strW.getBytes(charset).length;
                    C2887xC.I(byteArrayOutputStream2, length2);
                    i4 = i4 + 14 + length2;
                    byteArrayOutputStream2.write(strW.getBytes(charset));
                }
                byte[] byteArray = byteArrayOutputStream2.toByteArray();
                if (i4 != byteArray.length) {
                    throw new IllegalStateException("Expected size " + i4 + ", does not match actual size " + byteArray.length);
                }
                Um0 um0 = new Um0(1, byteArray, false);
                byteArrayOutputStream2.close();
                arrayList.add(um0);
                ByteArrayOutputStream byteArrayOutputStream3 = new ByteArrayOutputStream();
                int i5 = 0;
                int i6 = 0;
                while (i5 < c0199HrArr.length) {
                    try {
                        C0199Hr c0199Hr2 = c0199HrArr[i5];
                        C2887xC.I(byteArrayOutputStream3, i5);
                        C2887xC.I(byteArrayOutputStream3, c0199Hr2.e);
                        i6 = i6 + 4 + (c0199Hr2.e * i3);
                        int[] iArr = c0199Hr2.h;
                        int length3 = iArr.length;
                        int i7 = i2;
                        int i8 = i3;
                        int i9 = i7;
                        while (i9 < length3) {
                            int i10 = iArr[i9];
                            C2887xC.I(byteArrayOutputStream3, i10 - i7);
                            i9++;
                            i7 = i10;
                        }
                        i5++;
                        i3 = i8;
                        i2 = 0;
                    } catch (Throwable th) {
                    }
                }
                byte[] byteArray2 = byteArrayOutputStream3.toByteArray();
                if (i6 != byteArray2.length) {
                    throw new IllegalStateException("Expected size " + i6 + ", does not match actual size " + byteArray2.length);
                }
                Um0 um02 = new Um0(3, byteArray2, true);
                byteArrayOutputStream3.close();
                arrayList.add(um02);
                byteArrayOutputStream3 = new ByteArrayOutputStream();
                int i11 = 0;
                int i12 = 0;
                while (i11 < c0199HrArr.length) {
                    try {
                        C0199Hr c0199Hr3 = c0199HrArr[i11];
                        Iterator it = c0199Hr3.i.entrySet().iterator();
                        int iIntValue = 0;
                        while (it.hasNext()) {
                            iIntValue |= ((Integer) ((Map.Entry) it.next()).getValue()).intValue();
                        }
                        ByteArrayOutputStream byteArrayOutputStream4 = new ByteArrayOutputStream();
                        try {
                            d0(byteArrayOutputStream4, iIntValue, c0199Hr3);
                            byte[] byteArray3 = byteArrayOutputStream4.toByteArray();
                            byteArrayOutputStream4.close();
                            byteArrayOutputStream4 = new ByteArrayOutputStream();
                            try {
                                e0(byteArrayOutputStream4, c0199Hr3);
                                byte[] byteArray4 = byteArrayOutputStream4.toByteArray();
                                byteArrayOutputStream4.close();
                                C2887xC.I(byteArrayOutputStream3, i11);
                                int length4 = byteArray3.length + 2 + byteArray4.length;
                                int i13 = i12 + 6;
                                int i14 = i11;
                                C2887xC.H(byteArrayOutputStream3, length4, 4);
                                C2887xC.I(byteArrayOutputStream3, iIntValue);
                                byteArrayOutputStream3.write(byteArray3);
                                byteArrayOutputStream3.write(byteArray4);
                                i12 = i13 + length4;
                                i11 = i14 + 1;
                            } finally {
                            }
                        } finally {
                        }
                    } finally {
                        try {
                            byteArrayOutputStream3.close();
                            throw th;
                        } catch (Throwable th2) {
                            th.addSuppressed(th2);
                        }
                    }
                }
                byte[] byteArray5 = byteArrayOutputStream3.toByteArray();
                if (i12 != byteArray5.length) {
                    throw new IllegalStateException("Expected size " + i12 + ", does not match actual size " + byteArray5.length);
                }
                Um0 um03 = new Um0(4, byteArray5, true);
                byteArrayOutputStream3.close();
                arrayList.add(um03);
                long j3 = 4;
                long size = j3 + j3 + 4 + (arrayList.size() * 16);
                C2887xC.H(byteArrayOutputStream, arrayList.size(), 4);
                for (int i15 = 0; i15 < arrayList.size(); i15++) {
                    Um0 um04 = (Um0) arrayList.get(i15);
                    int i16 = um04.a;
                    byte[] bArr5 = um04.b;
                    if (i16 == 1) {
                        j2 = 0;
                    } else if (i16 == 2) {
                        j2 = 1;
                    } else if (i16 == 3) {
                        j2 = 2;
                    } else if (i16 == 4) {
                        j2 = 3;
                    } else {
                        if (i16 != 5) {
                            throw null;
                        }
                        j2 = 4;
                    }
                    C2887xC.H(byteArrayOutputStream, j2, 4);
                    C2887xC.H(byteArrayOutputStream, size, 4);
                    if (um04.c) {
                        long length5 = bArr5.length;
                        byte[] bArrL = C2887xC.l(bArr5);
                        arrayList2.add(bArrL);
                        C2887xC.H(byteArrayOutputStream, bArrL.length, 4);
                        C2887xC.H(byteArrayOutputStream, length5, 4);
                        length = bArrL.length;
                    } else {
                        arrayList2.add(bArr5);
                        C2887xC.H(byteArrayOutputStream, bArr5.length, 4);
                        C2887xC.H(byteArrayOutputStream, 0L, 4);
                        length = bArr5.length;
                    }
                    size += length;
                }
                for (int i17 = 0; i17 < arrayList2.size(); i17++) {
                    byteArrayOutputStream.write((byte[]) arrayList2.get(i17));
                }
            } catch (Throwable th3) {
                try {
                    byteArrayOutputStream2.close();
                    throw th3;
                } catch (Throwable th4) {
                    th3.addSuppressed(th4);
                    throw th3;
                }
            }
        } else {
            byte[] bArr6 = AbstractC1692kh0.f616o;
            if (Arrays.equals(bArr, bArr6)) {
                byte[] bArrS = s(c0199HrArr, bArr6);
                C2887xC.H(byteArrayOutputStream, c0199HrArr.length, 1);
                C2887xC.H(byteArrayOutputStream, bArrS.length, 4);
                byte[] bArrL2 = C2887xC.l(bArrS);
                C2887xC.H(byteArrayOutputStream, bArrL2.length, 4);
                byteArrayOutputStream.write(bArrL2);
                return true;
            }
            if (Arrays.equals(bArr, bArr3)) {
                C2887xC.H(byteArrayOutputStream, c0199HrArr.length, 1);
                for (C0199Hr c0199Hr4 : c0199HrArr) {
                    int size2 = c0199Hr4.i.size() * 4;
                    String strW2 = w(c0199Hr4.a, c0199Hr4.b, bArr3);
                    Charset charset2 = StandardCharsets.UTF_8;
                    C2887xC.I(byteArrayOutputStream, strW2.getBytes(charset2).length);
                    C2887xC.I(byteArrayOutputStream, c0199Hr4.h.length);
                    C2887xC.H(byteArrayOutputStream, size2, 4);
                    C2887xC.H(byteArrayOutputStream, c0199Hr4.c, 4);
                    byteArrayOutputStream.write(strW2.getBytes(charset2));
                    Iterator it2 = c0199Hr4.i.keySet().iterator();
                    while (it2.hasNext()) {
                        C2887xC.I(byteArrayOutputStream, ((Integer) it2.next()).intValue());
                        C2887xC.I(byteArrayOutputStream, 0);
                    }
                    for (int i18 : c0199Hr4.h) {
                        C2887xC.I(byteArrayOutputStream, i18);
                    }
                }
            } else {
                byte[] bArr7 = AbstractC1692kh0.p;
                if (Arrays.equals(bArr, bArr7)) {
                    byte[] bArrS2 = s(c0199HrArr, bArr7);
                    C2887xC.H(byteArrayOutputStream, c0199HrArr.length, 1);
                    C2887xC.H(byteArrayOutputStream, bArrS2.length, 4);
                    byte[] bArrL3 = C2887xC.l(bArrS2);
                    C2887xC.H(byteArrayOutputStream, bArrL3.length, 4);
                    byteArrayOutputStream.write(bArrL3);
                    return true;
                }
                if (!Arrays.equals(bArr, bArr2)) {
                    return false;
                }
                C2887xC.I(byteArrayOutputStream, c0199HrArr.length);
                for (C0199Hr c0199Hr5 : c0199HrArr) {
                    String str = c0199Hr5.a;
                    TreeMap treeMap = c0199Hr5.i;
                    String strW3 = w(str, c0199Hr5.b, bArr2);
                    Charset charset3 = StandardCharsets.UTF_8;
                    C2887xC.I(byteArrayOutputStream, strW3.getBytes(charset3).length);
                    C2887xC.I(byteArrayOutputStream, treeMap.size());
                    C2887xC.I(byteArrayOutputStream, c0199Hr5.h.length);
                    C2887xC.H(byteArrayOutputStream, c0199Hr5.c, 4);
                    byteArrayOutputStream.write(strW3.getBytes(charset3));
                    Iterator it3 = treeMap.keySet().iterator();
                    while (it3.hasNext()) {
                        C2887xC.I(byteArrayOutputStream, ((Integer) it3.next()).intValue());
                    }
                    for (int i19 : c0199Hr5.h) {
                        C2887xC.I(byteArrayOutputStream, i19);
                    }
                }
            }
        }
        return true;
    }

    public static final boolean Z(Throwable th, NC nc) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        Collection collectionAsList;
        Object objInvoke;
        Integer num = LI.a;
        C0225Ir c0225Ir = null;
        if (num == null || num.intValue() >= 19) {
            collectionAsList = Arrays.asList(th.getSuppressed());
        } else {
            Method method = AbstractC0815bX.b;
            collectionAsList = (method == null || (objInvoke = method.invoke(th, null)) == null) ? C0332Mv.l : Arrays.asList((Throwable[]) objInvoke);
        }
        boolean z = false;
        if (!collectionAsList.isEmpty()) {
            Iterator it = collectionAsList.iterator();
            while (it.hasNext()) {
                if (((Throwable) it.next()) instanceof C0225Ir) {
                    return false;
                }
            }
        }
        try {
            List list = (List) nc.a();
            boolean zIsEmpty = list.isEmpty();
            z = !zIsEmpty;
            if (!zIsEmpty) {
                c0225Ir = new C0225Ir(list);
            }
        } catch (Throwable th2) {
            c0225Ir = th2;
        }
        if (c0225Ir != null) {
            i(th, c0225Ir);
        }
        return z;
    }

    public static final Boolean a0(int i2, V5 v5, C1556jA c1556jA, T00 t00) {
        int iOrdinal = c1556jA.J0().ordinal();
        if (iOrdinal != 0) {
            if (iOrdinal == 1) {
                C1556jA c1556jAL = AbstractC0752ap.L(c1556jA);
                if (c1556jAL == null) {
                    throw new IllegalStateException("ActiveParent must have a focusedChild");
                }
                int iOrdinal2 = c1556jAL.J0().ordinal();
                if (iOrdinal2 != 0) {
                    if (iOrdinal2 == 1) {
                        Boolean boolA0 = a0(i2, v5, c1556jAL, t00);
                        if (!F3.c(boolA0, Boolean.FALSE)) {
                            return boolA0;
                        }
                        if (t00 == null) {
                            if (c1556jAL.J0() != EnumC1366hA.m) {
                                throw new IllegalStateException("Searching for active node in inactive hierarchy");
                            }
                            C1556jA c1556jAG = AbstractC0752ap.G(c1556jAL);
                            if (c1556jAG == null) {
                                throw new IllegalStateException("ActiveParent must have a focusedChild");
                            }
                            t00 = AbstractC0752ap.H(c1556jAG);
                        }
                        return Boolean.valueOf(v(i2, v5, c1556jA, t00));
                    }
                    if (iOrdinal2 != 2) {
                        if (iOrdinal2 != 3) {
                            throw new C2170pj();
                        }
                        throw new IllegalStateException("ActiveParent must have a focusedChild");
                    }
                }
                if (t00 == null) {
                    t00 = AbstractC0752ap.H(c1556jAL);
                }
                return Boolean.valueOf(v(i2, v5, c1556jA, t00));
            }
            if (iOrdinal != 2) {
                if (iOrdinal == 3) {
                    return c1556jA.I0().a ? (Boolean) v5.g(c1556jA) : t00 == null ? Boolean.valueOf(u(c1556jA, i2, v5)) : Boolean.valueOf(W(i2, v5, c1556jA, t00));
                }
                throw new C2170pj();
            }
        }
        return Boolean.valueOf(u(c1556jA, i2, v5));
    }

    public static void b0(ByteArrayOutputStream byteArrayOutputStream, C0199Hr c0199Hr) throws IOException {
        e0(byteArrayOutputStream, c0199Hr);
        int i2 = c0199Hr.g;
        int[] iArr = c0199Hr.h;
        int length = iArr.length;
        int i3 = 0;
        int i4 = 0;
        while (i3 < length) {
            int i5 = iArr[i3];
            C2887xC.I(byteArrayOutputStream, i5 - i4);
            i3++;
            i4 = i5;
        }
        byte[] bArr = new byte[(((i2 * 2) + 7) & (-8)) / 8];
        for (Map.Entry entry : c0199Hr.i.entrySet()) {
            int iIntValue = ((Integer) entry.getKey()).intValue();
            int iIntValue2 = ((Integer) entry.getValue()).intValue();
            if ((iIntValue2 & 2) != 0) {
                int i6 = iIntValue / 8;
                bArr[i6] = (byte) (bArr[i6] | (1 << (iIntValue % 8)));
            }
            if ((iIntValue2 & 4) != 0) {
                int i7 = iIntValue + i2;
                int i8 = i7 / 8;
                bArr[i8] = (byte) ((1 << (i7 % 8)) | bArr[i8]);
            }
        }
        byteArrayOutputStream.write(bArr);
    }

    public static void c0(ByteArrayOutputStream byteArrayOutputStream, C0199Hr c0199Hr, String str) throws IOException {
        Charset charset = StandardCharsets.UTF_8;
        C2887xC.I(byteArrayOutputStream, str.getBytes(charset).length);
        C2887xC.I(byteArrayOutputStream, c0199Hr.e);
        C2887xC.H(byteArrayOutputStream, c0199Hr.f, 4);
        C2887xC.H(byteArrayOutputStream, c0199Hr.c, 4);
        C2887xC.H(byteArrayOutputStream, c0199Hr.g, 4);
        byteArrayOutputStream.write(str.getBytes(charset));
    }

    /* JADX WARN: Removed duplicated region for block: B:23:0x0046  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x005b  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x006a  */
    /* JADX WARN: Removed duplicated region for block: B:35:0x006c  */
    /* JADX WARN: Removed duplicated region for block: B:38:0x0075  */
    /* JADX WARN: Removed duplicated region for block: B:54:0x0110  */
    /* JADX WARN: Removed duplicated region for block: B:57:0x0128  */
    /* JADX WARN: Removed duplicated region for block: B:59:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final void d(o.NC r24, o.C0554Vj r25, o.MP r26, o.SC r27, o.SC r28, o.SC r29, o.L70 r30, long r31, long r33, long r35, long r37, float r39, o.C0406Pr r40, o.C0321Mk r41, int r42, int r43) {
        /*
            Method dump skipped, instructions count: 323
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C80.d(o.NC, o.Vj, o.MP, o.SC, o.SC, o.SC, o.L70, long, long, long, long, float, o.Pr, o.Mk, int, int):void");
    }

    public static void d0(ByteArrayOutputStream byteArrayOutputStream, int i2, C0199Hr c0199Hr) throws IOException {
        int i3 = c0199Hr.g;
        byte[] bArr = new byte[(((Integer.bitCount(i2 & (-2)) * i3) + 7) & (-8)) / 8];
        for (Map.Entry entry : c0199Hr.i.entrySet()) {
            int iIntValue = ((Integer) entry.getKey()).intValue();
            int iIntValue2 = ((Integer) entry.getValue()).intValue();
            int i4 = 0;
            for (int i5 = 1; i5 <= 4; i5 <<= 1) {
                if (i5 != 1 && (i5 & i2) != 0) {
                    if ((i5 & iIntValue2) == i5) {
                        int i6 = (i4 * i3) + iIntValue;
                        int i7 = i6 / 8;
                        bArr[i7] = (byte) ((1 << (i6 % 8)) | bArr[i7]);
                    }
                    i4++;
                }
            }
        }
        byteArrayOutputStream.write(bArr);
    }

    public static final C0168Gm e(InterfaceC2747vn interfaceC2747vn) {
        if (interfaceC2747vn.m(C0669Zu.K) == null) {
            interfaceC2747vn = interfaceC2747vn.M(AbstractC0752ap.g());
        }
        return new C0168Gm(interfaceC2747vn);
    }

    public static void e0(ByteArrayOutputStream byteArrayOutputStream, C0199Hr c0199Hr) {
        int i2 = 0;
        for (Map.Entry entry : c0199Hr.i.entrySet()) {
            int iIntValue = ((Integer) entry.getKey()).intValue();
            if ((((Integer) entry.getValue()).intValue() & 1) != 0) {
                C2887xC.I(byteArrayOutputStream, iIntValue - i2);
                C2887xC.I(byteArrayOutputStream, 0);
                i2 = iIntValue;
            }
        }
    }

    public static final void f(long j2, C0733af0 c0733af0, SC sc, C0321Mk c0321Mk, int i2) {
        c0321Mk.X(-684938728);
        int i3 = (c0321Mk.e(j2) ? 4 : 2) | i2 | (c0321Mk.f(c0733af0) ? 32 : 16);
        if ((i2 & 384) == 0) {
            i3 |= c0321Mk.h(sc) ? 256 : 128;
        }
        if (c0321Mk.N(i3 & 1, (i3 & 147) != 146)) {
            C0935cl c0935cl = Ke0.a;
            AbstractC2841wm0.c(new A7[]{AbstractC1606jm.a.a(new C0190Hi(j2)), c0935cl.a(((C0733af0) c0321Mk.j(c0935cl)).d(c0733af0))}, sc, c0321Mk, ((i3 >> 3) & 112) | 8);
        } else {
            c0321Mk.Q();
        }
        L00 l00S = c0321Mk.s();
        if (l00S != null) {
            l00S.d = new AZ(j2, c0733af0, sc, i2, 0);
        }
    }

    public static final boolean g(C0329Ms c0329Ms, long j2) {
        if (!c0329Ms.l.y) {
            return false;
        }
        C2702vH c2702vH = (C2702vH) AbstractC2539te.S(c0329Ms).N.d;
        if (!c2702vH.Z.y) {
            return false;
        }
        long jL = c2702vH.L(0L);
        float fIntBitsToFloat = Float.intBitsToFloat((int) (jL >> 32));
        float fIntBitsToFloat2 = Float.intBitsToFloat((int) (jL & 4294967295L));
        long j3 = c0329Ms.B;
        float f2 = ((int) (j3 >> 32)) + fIntBitsToFloat;
        float f3 = ((int) (j3 & 4294967295L)) + fIntBitsToFloat2;
        float fIntBitsToFloat3 = Float.intBitsToFloat((int) (j2 >> 32));
        if (fIntBitsToFloat > fIntBitsToFloat3 || fIntBitsToFloat3 > f2) {
            return false;
        }
        float fIntBitsToFloat4 = Float.intBitsToFloat((int) (j2 & 4294967295L));
        return fIntBitsToFloat2 <= fIntBitsToFloat4 && fIntBitsToFloat4 <= f3;
    }

    public static final boolean h(int i2, KeyEvent keyEvent) {
        return ((int) (IJ.r(keyEvent) >> 32)) == i2;
    }

    public static void i(Throwable th, Throwable th2) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        if (th != th2) {
            Integer num = LI.a;
            if (num == null || num.intValue() >= 19) {
                th.addSuppressed(th2);
                return;
            }
            Method method = AbstractC0815bX.a;
            if (method != null) {
                method.invoke(th, th2);
            }
        }
    }

    public static final boolean j(T00 t00, T00 t002, T00 t003, int i2) {
        float f2;
        float f3;
        boolean zK = k(i2, t003, t00);
        float f4 = t003.b;
        float f5 = t003.d;
        float f6 = t003.a;
        float f7 = t003.c;
        float f8 = t00.d;
        float f9 = t00.b;
        float f10 = t00.c;
        float f11 = t00.a;
        if (zK || !k(i2, t002, t00)) {
            return false;
        }
        if (i2 == 3) {
            if (f11 < f7) {
                return true;
            }
        } else if (i2 == 4) {
            if (f10 > f6) {
                return true;
            }
        } else if (i2 == 5) {
            if (f9 < f5) {
                return true;
            }
        } else {
            if (i2 != 6) {
                throw new IllegalStateException("This function should only be used for 2-D focus search");
            }
            if (f8 > f4) {
                return true;
            }
        }
        if (i2 == 3 || i2 == 4) {
            return true;
        }
        if (i2 == 3) {
            f2 = f11 - t002.c;
        } else if (i2 == 4) {
            f2 = t002.a - f10;
        } else if (i2 == 5) {
            f2 = f9 - t002.d;
        } else {
            if (i2 != 6) {
                throw new IllegalStateException("This function should only be used for 2-D focus search");
            }
            f2 = t002.b - f8;
        }
        if (f2 < 0.0f) {
            f2 = 0.0f;
        }
        if (i2 == 3) {
            f3 = f11 - f6;
        } else if (i2 == 4) {
            f3 = f7 - f10;
        } else if (i2 == 5) {
            f3 = f9 - f4;
        } else {
            if (i2 != 6) {
                throw new IllegalStateException("This function should only be used for 2-D focus search");
            }
            f3 = f5 - f8;
        }
        if (f3 < 1.0f) {
            f3 = 1.0f;
        }
        return f2 < f3;
    }

    public static final boolean k(int i2, T00 t00, T00 t002) {
        if (i2 == 3 || i2 == 4) {
            return t00.d > t002.b && t00.b < t002.d;
        }
        if (i2 == 5 || i2 == 6) {
            return t00.c > t002.a && t00.a < t002.c;
        }
        throw new IllegalStateException("This function should only be used for 2-D focus search");
    }

    public static final Object l(InterfaceC0535Uq interfaceC0535Uq, NC nc, AbstractC0298Lm abstractC0298Lm) {
        Object obj;
        AbstractC2239qS abstractC2239qSR;
        Object objD;
        C0312Mb c0312Mb;
        LP lp = (LP) interfaceC0535Uq;
        boolean z = lp.l.y;
        if (z) {
            if (!z) {
                AbstractC2133pH.b("visitAncestors called on an unattached node");
            }
            LP lp2 = lp.l.p;
            C2420sK c2420sKS = AbstractC2539te.S(interfaceC0535Uq);
            loop0: while (true) {
                obj = null;
                if (c2420sKS == null) {
                    break;
                }
                if ((((LP) c2420sKS.N.g).f209o & 524288) != 0) {
                    while (lp2 != null) {
                        if ((lp2.n & 524288) != 0) {
                            LP lpI = lp2;
                            C1479iR c1479iR = null;
                            while (lpI != null) {
                                if (lpI instanceof InterfaceC0134Fe) {
                                    obj = lpI;
                                    break loop0;
                                }
                                if ((lpI.n & 524288) != 0 && (lpI instanceof AbstractC0561Vq)) {
                                    int i2 = 0;
                                    for (LP lp3 = ((AbstractC0561Vq) lpI).A; lp3 != null; lp3 = lp3.q) {
                                        if ((lp3.n & 524288) != 0) {
                                            i2++;
                                            if (i2 == 1) {
                                                lpI = lp3;
                                            } else {
                                                if (c1479iR == null) {
                                                    c1479iR = new C1479iR(new LP[16]);
                                                }
                                                if (lpI != null) {
                                                    c1479iR.b(lpI);
                                                    lpI = null;
                                                }
                                                c1479iR.b(lp3);
                                            }
                                        }
                                    }
                                    if (i2 == 1) {
                                    }
                                }
                                lpI = AbstractC2539te.i(c1479iR);
                            }
                        }
                        lp2 = lp2.p;
                    }
                }
                c2420sKS = c2420sKS.s();
                lp2 = (c2420sKS == null || (c0312Mb = c2420sKS.N) == null) ? null : (Bc0) c0312Mb.f;
            }
            InterfaceC0134Fe interfaceC0134Fe = (InterfaceC0134Fe) obj;
            if (interfaceC0134Fe != null && (objD = interfaceC0134Fe.D((abstractC2239qSR = AbstractC2539te.R(interfaceC0535Uq)), new C1352h3(2, nc, abstractC2239qSR), abstractC0298Lm)) == EnumC0091Dn.l) {
                return objD;
            }
        }
        return Oh0.a;
    }

    public static final LinkedHashMap m(ArrayList arrayList) {
        String str = SV.m;
        SV svN = BP.n("/");
        C3001yV[] c3001yVArr = {new C3001yV(svN, new Zm0(svN))};
        LinkedHashMap linkedHashMap = new LinkedHashMap(GN.Z(1));
        GN.b0(linkedHashMap, c3001yVArr);
        for (Zm0 zm0 : AbstractC3117zi.p0(arrayList, new C1746lA(13))) {
            if (((Zm0) linkedHashMap.put(zm0.a, zm0)) == null) {
                while (true) {
                    SV sv = zm0.a;
                    SV svB = sv.b();
                    if (svB != null) {
                        Zm0 zm02 = (Zm0) linkedHashMap.get(svB);
                        if (zm02 != null) {
                            zm02.h.add(sv);
                            break;
                        }
                        Zm0 zm03 = new Zm0(svB);
                        linkedHashMap.put(svB, zm03);
                        zm03.h.add(sv);
                        zm0 = zm03;
                    }
                }
            }
        }
        return linkedHashMap;
    }

    public static final void n(InterfaceC0065Cn interfaceC0065Cn, QP qp) {
        TI ti = (TI) interfaceC0065Cn.i().m(C0669Zu.K);
        if (ti != null) {
            ti.c(qp);
        } else {
            throw new IllegalStateException(("Scope cannot be cancelled because it does not have a job: " + interfaceC0065Cn).toString());
        }
    }

    public static void o(C1210ff c1210ff) {
        c1210ff.g(null, false);
    }

    public static final void p(C1556jA c1556jA, C1479iR c1479iR) {
        if (!c1556jA.l.y) {
            AbstractC2133pH.b("visitChildren called on an unattached node");
        }
        C1479iR c1479iR2 = new C1479iR(new LP[16]);
        LP lp = c1556jA.l;
        LP lp2 = lp.q;
        if (lp2 == null) {
            AbstractC2539te.g(c1479iR2, lp);
        } else {
            c1479iR2.b(lp2);
        }
        while (true) {
            int i2 = c1479iR2.n;
            if (i2 == 0) {
                return;
            }
            LP lpI = (LP) c1479iR2.k(i2 - 1);
            if ((lpI.f209o & 1024) == 0) {
                AbstractC2539te.g(c1479iR2, lpI);
            } else {
                while (true) {
                    if (lpI == null) {
                        break;
                    }
                    if ((lpI.n & 1024) != 0) {
                        C1479iR c1479iR3 = null;
                        while (lpI != null) {
                            if (lpI instanceof C1556jA) {
                                C1556jA c1556jA2 = (C1556jA) lpI;
                                if (c1556jA2.y && !AbstractC2539te.S(c1556jA2).X) {
                                    if (c1556jA2.I0().a) {
                                        c1479iR.b(c1556jA2);
                                    } else {
                                        p(c1556jA2, c1479iR);
                                    }
                                }
                            } else if ((lpI.n & 1024) != 0 && (lpI instanceof AbstractC0561Vq)) {
                                int i3 = 0;
                                for (LP lp3 = ((AbstractC0561Vq) lpI).A; lp3 != null; lp3 = lp3.q) {
                                    if ((lp3.n & 1024) != 0) {
                                        i3++;
                                        if (i3 == 1) {
                                            lpI = lp3;
                                        } else {
                                            if (c1479iR3 == null) {
                                                c1479iR3 = new C1479iR(new LP[16]);
                                            }
                                            if (lpI != null) {
                                                c1479iR3.b(lpI);
                                                lpI = null;
                                            }
                                            c1479iR3.b(lp3);
                                        }
                                    }
                                }
                                if (i3 == 1) {
                                }
                            }
                            lpI = AbstractC2539te.i(c1479iR3);
                        }
                    } else {
                        lpI = lpI.q;
                    }
                }
            }
        }
    }

    public static final int q(float f2) {
        return ((int) (f2 >= 0.0f ? Math.ceil(f2) : Math.floor(f2))) * (-1);
    }

    public static final Object r(SC sc, InterfaceC0220Im interfaceC0220Im) {
        M40 m40 = new M40(interfaceC0220Im, interfaceC0220Im.h());
        return Co0.O(m40, m40, sc);
    }

    public static byte[] s(C0199Hr[] c0199HrArr, byte[] bArr) throws IOException {
        int i2 = 0;
        int length = 0;
        for (C0199Hr c0199Hr : c0199HrArr) {
            length += ((((c0199Hr.g * 2) + 7) & (-8)) / 8) + (c0199Hr.e * 2) + w(c0199Hr.a, c0199Hr.b, bArr).getBytes(StandardCharsets.UTF_8).length + 16 + c0199Hr.f;
        }
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(length);
        if (Arrays.equals(bArr, AbstractC1692kh0.p)) {
            int length2 = c0199HrArr.length;
            while (i2 < length2) {
                C0199Hr c0199Hr2 = c0199HrArr[i2];
                c0(byteArrayOutputStream, c0199Hr2, w(c0199Hr2.a, c0199Hr2.b, bArr));
                b0(byteArrayOutputStream, c0199Hr2);
                i2++;
            }
        } else {
            for (C0199Hr c0199Hr3 : c0199HrArr) {
                c0(byteArrayOutputStream, c0199Hr3, w(c0199Hr3.a, c0199Hr3.b, bArr));
            }
            int length3 = c0199HrArr.length;
            while (i2 < length3) {
                b0(byteArrayOutputStream, c0199HrArr[i2]);
                i2++;
            }
        }
        if (byteArrayOutputStream.size() == length) {
            return byteArrayOutputStream.toByteArray();
        }
        throw new IllegalStateException("The bytes saved do not match expectation. actual=" + byteArrayOutputStream.size() + " expected=" + length);
    }

    public static final C1556jA t(C1479iR c1479iR, T00 t00, int i2) {
        T00 t00G;
        if (i2 == 3) {
            t00G = t00.g((t00.c - t00.a) + 1, 0.0f);
        } else if (i2 == 4) {
            t00G = t00.g(-((t00.c - t00.a) + 1), 0.0f);
        } else if (i2 == 5) {
            t00G = t00.g(0.0f, (t00.d - t00.b) + 1);
        } else {
            if (i2 != 6) {
                throw new IllegalStateException("This function should only be used for 2-D focus search");
            }
            t00G = t00.g(0.0f, -((t00.d - t00.b) + 1));
        }
        Object[] objArr = c1479iR.l;
        int i3 = c1479iR.n;
        C1556jA c1556jA = null;
        for (int i4 = 0; i4 < i3; i4++) {
            C1556jA c1556jA2 = (C1556jA) objArr[i4];
            if (AbstractC0752ap.S(c1556jA2)) {
                T00 t00H = AbstractC0752ap.H(c1556jA2);
                if (E(t00H, t00G, t00, i2)) {
                    c1556jA = c1556jA2;
                    t00G = t00H;
                }
            }
        }
        return c1556jA;
    }

    public static final boolean u(C1556jA c1556jA, int i2, OC oc) {
        T00 t00;
        C1479iR c1479iR = new C1479iR(new C1556jA[16]);
        p(c1556jA, c1479iR);
        int i3 = c1479iR.n;
        if (i3 <= 1) {
            C1556jA c1556jA2 = (C1556jA) (i3 == 0 ? null : c1479iR.l[0]);
            if (c1556jA2 != null) {
                return ((Boolean) oc.g(c1556jA2)).booleanValue();
            }
        } else {
            if (i2 == 7) {
                i2 = 4;
            }
            if (i2 == 4 || i2 == 6) {
                T00 t00H = AbstractC0752ap.H(c1556jA);
                float f2 = t00H.a;
                float f3 = t00H.b;
                t00 = new T00(f2, f3, f2, f3);
            } else {
                if (i2 != 3 && i2 != 5) {
                    throw new IllegalStateException("This function should only be used for 2-D focus search");
                }
                T00 t00H2 = AbstractC0752ap.H(c1556jA);
                float f4 = t00H2.c;
                float f5 = t00H2.d;
                t00 = new T00(f4, f5, f4, f5);
            }
            C1556jA c1556jAT = t(c1479iR, t00, i2);
            if (c1556jAT != null) {
                return ((Boolean) oc.g(c1556jAT)).booleanValue();
            }
        }
        return false;
    }

    public static final boolean v(int i2, V5 v5, C1556jA c1556jA, T00 t00) {
        if (W(i2, v5, c1556jA, t00)) {
            return true;
        }
        C1556jA c1556jA2 = ((C0674Zz) ((C2207q3) AbstractC2539te.T(c1556jA)).getFocusOwner()).h;
        AbstractC0249Jp.d0(c1556jA);
        return false;
    }

    public static String w(String str, String str2, byte[] bArr) {
        byte[] bArr2 = AbstractC1692kh0.q;
        byte[] bArr3 = AbstractC1692kh0.r;
        String str3 = (Arrays.equals(bArr, bArr3) || Arrays.equals(bArr, bArr2)) ? ":" : "!";
        if (str.length() <= 0) {
            if ("!".equals(str3)) {
                return str2.replace(":", "!");
            }
            if (":".equals(str3)) {
                return str2.replace("!", ":");
            }
        } else {
            if (str2.equals("classes.dex")) {
                return str;
            }
            if (str2.contains("!") || str2.contains(":")) {
                if ("!".equals(str3)) {
                    return str2.replace(":", "!");
                }
                if (":".equals(str3)) {
                    return str2.replace("!", ":");
                }
            } else if (!str2.endsWith(".apk")) {
                StringBuilder sb = new StringBuilder();
                sb.append(str);
                return AbstractC2462sn.n(sb, (Arrays.equals(bArr, bArr3) || Arrays.equals(bArr, bArr2)) ? ":" : "!", str2);
            }
        }
        return str2;
    }

    public static Drawable x(Context context, int i2) {
        return C2680v20.b().c(context, i2);
    }

    public static final String y(int i2) {
        AbstractC0940cn0.g(16);
        return "0x".concat(Integer.toString(i2, 16));
    }

    public static final C2872x30 z(InterfaceC1760lO interfaceC1760lO) {
        Object objK = interfaceC1760lO.k();
        if (objK instanceof C2872x30) {
            return (C2872x30) objK;
        }
        return null;
    }

    @Override // o.InterfaceC1888mk0
    public void b() {
    }

    @Override // o.InterfaceC1888mk0
    public void c() {
    }
}
