package p138.p176.p177.p190.p239;

import android.text.TextUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import p000.p001.p002.p003.p004.C0567;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ဢ.ބ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4122 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final Pattern f13171 = Pattern.compile("^rgb\\((\\d{1,3}),(\\d{1,3}),(\\d{1,3})\\)$");

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static final Pattern f13172 = Pattern.compile("^rgba\\((\\d{1,3}),(\\d{1,3}),(\\d{1,3}),(\\d{1,3})\\)$");

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public static final Pattern f13173 = Pattern.compile("^rgba\\((\\d{1,3}),(\\d{1,3}),(\\d{1,3}),(\\d*\\.?\\d*?)\\)$");

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public static final Map<String, Integer> f13174;

    static {
        HashMap map = new HashMap();
        f13174 = map;
        map.put("aliceblue", -984833);
        f13174.put("antiquewhite", -332841);
        f13174.put("aqua", -16711681);
        f13174.put("aquamarine", -8388652);
        f13174.put("azure", -983041);
        f13174.put("beige", -657956);
        f13174.put("bisque", -6972);
        f13174.put("black", -16777216);
        f13174.put("blanchedalmond", -5171);
        f13174.put("blue", -16776961);
        f13174.put("blueviolet", -7722014);
        f13174.put("brown", -5952982);
        f13174.put("burlywood", -2180985);
        f13174.put("cadetblue", -10510688);
        f13174.put("chartreuse", -8388864);
        f13174.put("chocolate", -2987746);
        f13174.put("coral", -32944);
        f13174.put("cornflowerblue", -10185235);
        f13174.put("cornsilk", -1828);
        f13174.put("crimson", -2354116);
        f13174.put("cyan", -16711681);
        f13174.put("darkblue", -16777077);
        f13174.put("darkcyan", -16741493);
        f13174.put("darkgoldenrod", -4684277);
        f13174.put("darkgray", -5658199);
        f13174.put("darkgreen", -16751616);
        f13174.put("darkgrey", -5658199);
        f13174.put("darkkhaki", -4343957);
        f13174.put("darkmagenta", -7667573);
        f13174.put("darkolivegreen", -11179217);
        f13174.put("darkorange", -29696);
        f13174.put("darkorchid", -6737204);
        f13174.put("darkred", -7667712);
        f13174.put("darksalmon", -1468806);
        f13174.put("darkseagreen", -7357297);
        f13174.put("darkslateblue", -12042869);
        f13174.put("darkslategray", -13676721);
        f13174.put("darkslategrey", -13676721);
        f13174.put("darkturquoise", -16724271);
        f13174.put("darkviolet", -7077677);
        f13174.put("deeppink", -60269);
        f13174.put("deepskyblue", -16728065);
        f13174.put("dimgray", -9868951);
        f13174.put("dimgrey", -9868951);
        f13174.put("dodgerblue", -14774017);
        f13174.put("firebrick", -5103070);
        f13174.put("floralwhite", -1296);
        f13174.put("forestgreen", -14513374);
        f13174.put("fuchsia", -65281);
        f13174.put("gainsboro", -2302756);
        f13174.put("ghostwhite", -460545);
        f13174.put("gold", -10496);
        f13174.put("goldenrod", -2448096);
        f13174.put("gray", -8355712);
        f13174.put("green", -16744448);
        f13174.put("greenyellow", -5374161);
        f13174.put("grey", -8355712);
        f13174.put("honeydew", -983056);
        f13174.put("hotpink", -38476);
        f13174.put("indianred", -3318692);
        f13174.put("indigo", -11861886);
        f13174.put("ivory", -16);
        f13174.put("khaki", -989556);
        f13174.put("lavender", -1644806);
        f13174.put("lavenderblush", -3851);
        f13174.put("lawngreen", -8586240);
        f13174.put("lemonchiffon", -1331);
        f13174.put("lightblue", -5383962);
        f13174.put("lightcoral", -1015680);
        f13174.put("lightcyan", -2031617);
        f13174.put("lightgoldenrodyellow", -329006);
        f13174.put("lightgray", -2894893);
        f13174.put("lightgreen", -7278960);
        f13174.put("lightgrey", -2894893);
        f13174.put("lightpink", -18751);
        f13174.put("lightsalmon", -24454);
        f13174.put("lightseagreen", -14634326);
        f13174.put("lightskyblue", -7876870);
        f13174.put("lightslategray", -8943463);
        f13174.put("lightslategrey", -8943463);
        f13174.put("lightsteelblue", -5192482);
        f13174.put("lightyellow", -32);
        f13174.put("lime", -16711936);
        f13174.put("limegreen", -13447886);
        f13174.put("linen", -331546);
        f13174.put("magenta", -65281);
        f13174.put("maroon", -8388608);
        f13174.put("mediumaquamarine", -10039894);
        f13174.put("mediumblue", -16777011);
        f13174.put("mediumorchid", -4565549);
        f13174.put("mediumpurple", -7114533);
        f13174.put("mediumseagreen", -12799119);
        f13174.put("mediumslateblue", -8689426);
        f13174.put("mediumspringgreen", -16713062);
        f13174.put("mediumturquoise", -12004916);
        f13174.put("mediumvioletred", -3730043);
        f13174.put("midnightblue", -15132304);
        f13174.put("mintcream", -655366);
        f13174.put("mistyrose", -6943);
        f13174.put("moccasin", -6987);
        f13174.put("navajowhite", -8531);
        f13174.put("navy", -16777088);
        f13174.put("oldlace", -133658);
        f13174.put("olive", -8355840);
        f13174.put("olivedrab", -9728477);
        f13174.put("orange", -23296);
        f13174.put("orangered", -47872);
        f13174.put("orchid", -2461482);
        f13174.put("palegoldenrod", -1120086);
        f13174.put("palegreen", -6751336);
        f13174.put("paleturquoise", -5247250);
        f13174.put("palevioletred", -2396013);
        f13174.put("papayawhip", -4139);
        f13174.put("peachpuff", -9543);
        f13174.put("peru", -3308225);
        f13174.put("pink", -16181);
        f13174.put("plum", -2252579);
        f13174.put("powderblue", -5185306);
        f13174.put("purple", -8388480);
        f13174.put("rebeccapurple", -10079335);
        f13174.put("red", -65536);
        f13174.put("rosybrown", -4419697);
        f13174.put("royalblue", -12490271);
        f13174.put("saddlebrown", -7650029);
        f13174.put("salmon", -360334);
        f13174.put("sandybrown", -744352);
        f13174.put("seagreen", -13726889);
        f13174.put("seashell", -2578);
        f13174.put("sienna", -6270419);
        f13174.put("silver", -4144960);
        f13174.put("skyblue", -7876885);
        f13174.put("slateblue", -9807155);
        f13174.put("slategray", -9404272);
        f13174.put("slategrey", -9404272);
        f13174.put("snow", -1286);
        f13174.put("springgreen", -16711809);
        f13174.put("steelblue", -12156236);
        f13174.put("tan", -2968436);
        f13174.put("teal", -16744320);
        f13174.put("thistle", -2572328);
        f13174.put("tomato", -40121);
        f13174.put("transparent", 0);
        f13174.put("turquoise", -12525360);
        f13174.put("violet", -1146130);
        f13174.put("wheat", -663885);
        f13174.put("white", -1);
        f13174.put("whitesmoke", -657931);
        f13174.put("yellow", -256);
        f13174.put("yellowgreen", -6632142);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static int m6625(String str, boolean z) {
        int i;
        int i2;
        int i3;
        C0567.m1896(!TextUtils.isEmpty(str));
        String strReplace = str.replace(" ", "");
        if (strReplace.charAt(0) == '#') {
            int i4 = (int) Long.parseLong(strReplace.substring(1), 16);
            if (strReplace.length() == 7) {
                return i4 | (-16777216);
            }
            if (strReplace.length() == 9) {
                return ((i4 & 255) << 24) | (i4 >>> 8);
            }
            throw new IllegalArgumentException();
        }
        if (strReplace.startsWith("rgba")) {
            Matcher matcher = (z ? f13173 : f13172).matcher(strReplace);
            if (matcher.matches()) {
                int i5 = z ? (int) (Float.parseFloat(matcher.group(4)) * 255.0f) : Integer.parseInt(matcher.group(4), 10);
                int i6 = Integer.parseInt(matcher.group(1), 10);
                int i7 = Integer.parseInt(matcher.group(2), 10);
                i = Integer.parseInt(matcher.group(3), 10);
                i2 = (i5 << 24) | (i6 << 16);
                i3 = i7 << 8;
                return i | i2 | i3;
            }
            throw new IllegalArgumentException();
        }
        if (strReplace.startsWith("rgb")) {
            Matcher matcher2 = f13171.matcher(strReplace);
            if (matcher2.matches()) {
                int i8 = Integer.parseInt(matcher2.group(1), 10);
                int i9 = Integer.parseInt(matcher2.group(2), 10);
                i = Integer.parseInt(matcher2.group(3), 10);
                i2 = (i8 << 16) | (-16777216);
                i3 = i9 << 8;
                return i | i2 | i3;
            }
        } else {
            Integer num = f13174.get(C4150.m6809(strReplace));
            if (num != null) {
                return num.intValue();
            }
        }
        throw new IllegalArgumentException();
    }
}
