package m;

import android.R;
import android.graphics.Insets;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import io.sentry.flutter.SentryFlutterPluginKt;
import java.lang.reflect.InvocationTargetException;

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

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final int[] f9084a = {R.attr.state_checked};

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final int[] f9085b = new int[0];

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final Rect f9086c = new Rect();

    public static void a(Drawable drawable) {
        String name = drawable.getClass().getName();
        int i = Build.VERSION.SDK_INT;
        if (i < 29 || i >= 31 || !"android.graphics.drawable.ColorStateListDrawable".equals(name)) {
            return;
        }
        int[] state = drawable.getState();
        if (state == null || state.length == 0) {
            drawable.setState(f9084a);
        } else {
            drawable.setState(f9085b);
        }
        drawable.setState(state);
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static Rect b(Drawable drawable) {
        int i = Build.VERSION.SDK_INT;
        if (i >= 29) {
            Insets insetsA = U.a(drawable);
            return new Rect(insetsA.left, insetsA.top, insetsA.right, insetsA.bottom);
        }
        boolean z5 = drawable instanceof H.b;
        Object obj = drawable;
        if (z5) {
            ((H.c) ((H.b) drawable)).getClass();
            obj = null;
        }
        if (i >= 29) {
            boolean z6 = T.f9076a;
        } else if (T.f9076a) {
            try {
                Object objInvoke = T.f9077b.invoke(obj, new Object[0]);
                if (objInvoke != null) {
                    return new Rect(T.f9078c.getInt(objInvoke), T.f9079d.getInt(objInvoke), T.f9080e.getInt(objInvoke), T.f9081f.getInt(objInvoke));
                }
            } catch (IllegalAccessException | InvocationTargetException unused) {
            }
        }
        return f9086c;
    }

    public static PorterDuff.Mode c(int i, PorterDuff.Mode mode) {
        if (i == 3) {
            return PorterDuff.Mode.SRC_OVER;
        }
        if (i == 5) {
            return PorterDuff.Mode.SRC_IN;
        }
        if (i == 9) {
            return PorterDuff.Mode.SRC_ATOP;
        }
        switch (i) {
            case 14:
                return PorterDuff.Mode.MULTIPLY;
            case 15:
                return PorterDuff.Mode.SCREEN;
            case SentryFlutterPluginKt.VIDEO_BLOCK_SIZE /* 16 */:
                return PorterDuff.Mode.ADD;
            default:
                return mode;
        }
    }
}
