package a0;

import android.content.Context;
import android.content.res.XmlResourceParser;
import android.util.Xml;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.xmlpull.v1.XmlPullParserException;

/* JADX INFO: loaded from: classes.dex */
public final class h {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final HashMap f100b;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public HashMap f101a = new HashMap();

    static {
        HashMap map = new HashMap();
        f100b = map;
        try {
            map.put("KeyAttribute", e.class.getConstructor(new Class[0]));
            map.put("KeyPosition", j.class.getConstructor(new Class[0]));
            map.put("KeyCycle", g.class.getConstructor(new Class[0]));
            map.put("KeyTimeCycle", l.class.getConstructor(new Class[0]));
            map.put("KeyTrigger", n.class.getConstructor(new Class[0]));
        } catch (NoSuchMethodException unused) {
        }
    }

    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    /* JADX WARN: Removed duplicated region for block: B:33:0x006e  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public h(Context context, XmlResourceParser xmlResourceParser) {
        HashMap map;
        HashMap map2;
        byte b10;
        c eVar;
        try {
            int eventType = xmlResourceParser.getEventType();
            c cVar = null;
            while (eventType != 1) {
                if (eventType == 2) {
                    String name = xmlResourceParser.getName();
                    if (f100b.containsKey(name)) {
                        switch (name.hashCode()) {
                            case -300573030:
                                b10 = !name.equals("KeyTimeCycle") ? (byte) -1 : (byte) 3;
                                break;
                            case -298435811:
                                if (name.equals("KeyAttribute")) {
                                    b10 = 0;
                                    break;
                                }
                                break;
                            case 540053991:
                                if (name.equals("KeyCycle")) {
                                    b10 = 2;
                                    break;
                                }
                                break;
                            case 1153397896:
                                if (name.equals("KeyPosition")) {
                                    b10 = 1;
                                    break;
                                }
                                break;
                            case 1308496505:
                                if (name.equals("KeyTrigger")) {
                                    b10 = 4;
                                    break;
                                }
                                break;
                            default:
                                break;
                        }
                        if (b10 == 0) {
                            eVar = new e();
                        } else if (b10 == 1) {
                            eVar = new j();
                        } else if (b10 == 2) {
                            eVar = new g();
                        } else if (b10 == 3) {
                            eVar = new l();
                        } else {
                            if (b10 != 4) {
                                throw new NullPointerException("Key " + name + " not found");
                            }
                            eVar = new n();
                        }
                        eVar.e(context, Xml.asAttributeSet(xmlResourceParser));
                        b(eVar);
                        cVar = eVar;
                    } else if (name.equalsIgnoreCase("CustomAttribute")) {
                        if (cVar != null && (map2 = cVar.f29d) != null) {
                            androidx.constraintlayout.widget.a.d(context, xmlResourceParser, map2);
                        }
                    } else if (name.equalsIgnoreCase("CustomMethod") && cVar != null && (map = cVar.f29d) != null) {
                        androidx.constraintlayout.widget.a.d(context, xmlResourceParser, map);
                    }
                } else if (eventType == 3 && "KeyFrameSet".equals(xmlResourceParser.getName())) {
                    return;
                }
                eventType = xmlResourceParser.next();
            }
        } catch (IOException | XmlPullParserException unused) {
        }
    }

    public final void a(q qVar) {
        Integer numValueOf = Integer.valueOf(qVar.f168c);
        HashMap map = this.f101a;
        ArrayList arrayList = (ArrayList) map.get(numValueOf);
        if (arrayList != null) {
            qVar.f188w.addAll(arrayList);
        }
        ArrayList<c> arrayList2 = (ArrayList) map.get(-1);
        if (arrayList2 != null) {
            for (c cVar : arrayList2) {
                String str = ((androidx.constraintlayout.widget.c) qVar.f167b.getLayoutParams()).Y;
                String str2 = cVar.f28c;
                if (str2 != null && str != null && str.matches(str2)) {
                    qVar.a(cVar);
                }
            }
        }
    }

    public final void b(c cVar) {
        Integer numValueOf = Integer.valueOf(cVar.f27b);
        HashMap map = this.f101a;
        if (!map.containsKey(numValueOf)) {
            map.put(Integer.valueOf(cVar.f27b), new ArrayList());
        }
        ArrayList arrayList = (ArrayList) map.get(Integer.valueOf(cVar.f27b));
        if (arrayList != null) {
            arrayList.add(cVar);
        }
    }
}
