package androidx.constraintlayout.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.util.Log;
import android.util.SparseArray;
import android.util.Xml;
import com.google.firebase.sessions.settings.RemoteSettings;
import java.io.IOException;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

/* loaded from: classes.dex */
public class c {

    /* renamed from: a, reason: collision with root package name */
    private final ConstraintLayout f3137a;

    /* renamed from: b, reason: collision with root package name */
    int f3138b = -1;

    /* renamed from: c, reason: collision with root package name */
    int f3139c = -1;

    /* renamed from: d, reason: collision with root package name */
    private SparseArray f3140d = new SparseArray();

    /* renamed from: e, reason: collision with root package name */
    private SparseArray f3141e = new SparseArray();

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static class a {

        /* renamed from: a, reason: collision with root package name */
        int f3142a;

        /* renamed from: b, reason: collision with root package name */
        ArrayList f3143b = new ArrayList();

        /* renamed from: c, reason: collision with root package name */
        int f3144c;

        /* renamed from: d, reason: collision with root package name */
        d f3145d;

        public a(Context context, XmlPullParser xmlPullParser) {
            this.f3144c = -1;
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), g.R6);
            int indexCount = obtainStyledAttributes.getIndexCount();
            for (int i10 = 0; i10 < indexCount; i10++) {
                int index = obtainStyledAttributes.getIndex(i10);
                if (index == g.S6) {
                    this.f3142a = obtainStyledAttributes.getResourceId(index, this.f3142a);
                } else if (index == g.T6) {
                    this.f3144c = obtainStyledAttributes.getResourceId(index, this.f3144c);
                    String resourceTypeName = context.getResources().getResourceTypeName(this.f3144c);
                    context.getResources().getResourceName(this.f3144c);
                    if ("layout".equals(resourceTypeName)) {
                        d dVar = new d();
                        this.f3145d = dVar;
                        dVar.f(context, this.f3144c);
                    }
                }
            }
            obtainStyledAttributes.recycle();
        }

        void a(b bVar) {
            this.f3143b.add(bVar);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static class b {

        /* renamed from: a, reason: collision with root package name */
        float f3146a;

        /* renamed from: b, reason: collision with root package name */
        float f3147b;

        /* renamed from: c, reason: collision with root package name */
        float f3148c;

        /* renamed from: d, reason: collision with root package name */
        float f3149d;

        /* renamed from: e, reason: collision with root package name */
        int f3150e;

        /* renamed from: f, reason: collision with root package name */
        d f3151f;

        public b(Context context, XmlPullParser xmlPullParser) {
            this.f3146a = Float.NaN;
            this.f3147b = Float.NaN;
            this.f3148c = Float.NaN;
            this.f3149d = Float.NaN;
            this.f3150e = -1;
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), g.f3402p7);
            int indexCount = obtainStyledAttributes.getIndexCount();
            for (int i10 = 0; i10 < indexCount; i10++) {
                int index = obtainStyledAttributes.getIndex(i10);
                if (index == g.f3411q7) {
                    this.f3150e = obtainStyledAttributes.getResourceId(index, this.f3150e);
                    String resourceTypeName = context.getResources().getResourceTypeName(this.f3150e);
                    context.getResources().getResourceName(this.f3150e);
                    if ("layout".equals(resourceTypeName)) {
                        d dVar = new d();
                        this.f3151f = dVar;
                        dVar.f(context, this.f3150e);
                    }
                } else if (index == g.f3420r7) {
                    this.f3149d = obtainStyledAttributes.getDimension(index, this.f3149d);
                } else if (index == g.f3429s7) {
                    this.f3147b = obtainStyledAttributes.getDimension(index, this.f3147b);
                } else if (index == g.f3438t7) {
                    this.f3148c = obtainStyledAttributes.getDimension(index, this.f3148c);
                } else if (index == g.f3447u7) {
                    this.f3146a = obtainStyledAttributes.getDimension(index, this.f3146a);
                } else {
                    Log.v("ConstraintLayoutStates", "Unknown tag");
                }
            }
            obtainStyledAttributes.recycle();
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public c(Context context, ConstraintLayout constraintLayout, int i10) {
        this.f3137a = constraintLayout;
        a(context, i10);
    }

    private void a(Context context, int i10) {
        XmlResourceParser xml = context.getResources().getXml(i10);
        try {
            int eventType = xml.getEventType();
            a aVar = null;
            while (true) {
                char c10 = 1;
                if (eventType == 1) {
                    return;
                }
                if (eventType == 0) {
                    xml.getName();
                } else if (eventType == 2) {
                    String name = xml.getName();
                    switch (name.hashCode()) {
                        case -1349929691:
                            if (name.equals("ConstraintSet")) {
                                c10 = 4;
                                break;
                            }
                            break;
                        case 80204913:
                            if (name.equals("State")) {
                                c10 = 2;
                                break;
                            }
                            break;
                        case 1382829617:
                            if (name.equals("StateSet")) {
                                break;
                            }
                            break;
                        case 1657696882:
                            if (name.equals("layoutDescription")) {
                                c10 = 0;
                                break;
                            }
                            break;
                        case 1901439077:
                            if (name.equals("Variant")) {
                                c10 = 3;
                                break;
                            }
                            break;
                    }
                    c10 = 65535;
                    if (c10 == 2) {
                        aVar = new a(context, xml);
                        this.f3140d.put(aVar.f3142a, aVar);
                    } else if (c10 == 3) {
                        b bVar = new b(context, xml);
                        if (aVar != null) {
                            aVar.a(bVar);
                        }
                    } else if (c10 == 4) {
                        b(context, xml);
                    }
                }
                eventType = xml.next();
            }
        } catch (IOException e10) {
            e10.printStackTrace();
        } catch (XmlPullParserException e11) {
            e11.printStackTrace();
        }
    }

    private void b(Context context, XmlPullParser xmlPullParser) {
        d dVar = new d();
        int attributeCount = xmlPullParser.getAttributeCount();
        for (int i10 = 0; i10 < attributeCount; i10++) {
            String attributeName = xmlPullParser.getAttributeName(i10);
            String attributeValue = xmlPullParser.getAttributeValue(i10);
            if (attributeName != null && attributeValue != null && "id".equals(attributeName)) {
                int identifier = attributeValue.contains(RemoteSettings.FORWARD_SLASH_STRING) ? context.getResources().getIdentifier(attributeValue.substring(attributeValue.indexOf(47) + 1), "id", context.getPackageName()) : -1;
                if (identifier == -1) {
                    if (attributeValue.length() > 1) {
                        identifier = Integer.parseInt(attributeValue.substring(1));
                    } else {
                        Log.e("ConstraintLayoutStates", "error in parsing id");
                    }
                }
                dVar.m(context, xmlPullParser);
                this.f3141e.put(identifier, dVar);
                return;
            }
        }
    }

    public void c(e eVar) {
    }
}
