package com.google.android.gms.internal.ads;

import android.graphics.PointF;
import androidx.annotation.Nullable;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/* JADX INFO: loaded from: classes2.dex */
public final class a9 {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final Pattern f8573b = Pattern.compile("\\{([^}]*)\\}");

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final Pattern f8574c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final Pattern f8575d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final Pattern f8576e;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final int f8577a;

    @Nullable
    public final PointF zzb;

    static {
        String str = bb1.f9474a;
        Locale locale = Locale.US;
        f8574c = Pattern.compile(String.format(locale, "\\\\pos\\((%1$s),(%1$s)\\)", "\\s*\\d+(?:\\.\\d+)?\\s*"));
        f8575d = Pattern.compile(String.format(locale, "\\\\move\\(%1$s,%1$s,(%1$s),(%1$s)(?:,%1$s,%1$s)?\\)", "\\s*\\d+(?:\\.\\d+)?\\s*"));
        f8576e = Pattern.compile("\\\\an(\\d+)");
    }

    private a9(int i10, @Nullable PointF pointF) {
        this.f8577a = i10;
        this.zzb = pointF;
    }

    /* JADX WARN: Can't wrap try/catch for region: R(16:5|39|6|(2:(1:9)|10)(1:(1:12)(7:19|(1:21)|41|22|45|(7:24|25|37|26|SW:27|29|(0)(0))(2:29|(0)(0))|46))|13|14|15|16|17|(0)|41|22|45|(0)(0)|46|3) */
    /* JADX WARN: Removed duplicated region for block: B:21:0x0082  */
    /* JADX WARN: Removed duplicated region for block: B:24:0x008f A[Catch: RuntimeException -> 0x000a, TRY_LEAVE, TryCatch #2 {RuntimeException -> 0x000a, blocks: (B:22:0x0083, B:24:0x008f, B:26:0x0096, B:28:0x00a1), top: B:41:0x0083 }] */
    /* JADX WARN: Removed duplicated region for block: B:29:0x00aa  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x00ad A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:47:0x000a A[SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static a9 a(String str) {
        Matcher matcher;
        int i10;
        Matcher matcher2;
        Matcher matcher3;
        boolean zFind;
        boolean zFind2;
        PointF pointF;
        String strGroup;
        String strGroup2;
        Matcher matcher4 = f8573b.matcher(str);
        PointF pointF2 = null;
        int i11 = -1;
        while (matcher4.find()) {
            String strGroup3 = matcher4.group(1);
            strGroup3.getClass();
            try {
                matcher2 = f8574c.matcher(strGroup3);
                matcher3 = f8575d.matcher(strGroup3);
                zFind = matcher2.find();
                zFind2 = matcher3.find();
            } catch (RuntimeException unused) {
            }
            if (zFind) {
                if (zFind2) {
                    StringBuilder sb = new StringBuilder(strGroup3.length() + 82);
                    sb.append("Override has both \\pos(x,y) and \\move(x1,y1,x2,y2); using \\pos values. override='");
                    sb.append(strGroup3);
                    sb.append("'");
                    vt0.b(sb.toString());
                }
                strGroup = matcher2.group(1);
                strGroup2 = matcher2.group(2);
            } else if (zFind2) {
                strGroup = matcher3.group(1);
                strGroup2 = matcher3.group(2);
            } else {
                pointF = null;
                if (pointF != null) {
                    pointF2 = pointF;
                }
                matcher = f8576e.matcher(strGroup3);
                if (matcher.find()) {
                    i10 = -1;
                    if (i10 == -1) {
                    }
                } else {
                    String strGroup4 = matcher.group(1);
                    strGroup4.getClass();
                    try {
                        i10 = Integer.parseInt(strGroup4.trim());
                    } catch (NumberFormatException unused2) {
                    }
                    switch (i10) {
                        case 1:
                        case 2:
                        case 3:
                        case 4:
                        case 5:
                        case 6:
                        case 7:
                        case 8:
                        case 9:
                            if (i10 == -1) {
                                continue;
                            } else {
                                i11 = i10;
                            }
                            break;
                        default:
                            vt0.c("Ignoring unknown alignment: ".concat(strGroup4));
                            break;
                    }
                    i10 = -1;
                    if (i10 == -1) {
                    }
                }
            }
            strGroup.getClass();
            float f10 = Float.parseFloat(strGroup.trim());
            strGroup2.getClass();
            pointF = new PointF(f10, Float.parseFloat(strGroup2.trim()));
            if (pointF != null) {
            }
            matcher = f8576e.matcher(strGroup3);
            if (matcher.find()) {
            }
        }
        return new a9(i11, pointF2);
    }
}
