package p037.p058.p064;

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 androidx.constraintlayout.widget.ConstraintLayout;
import java.io.IOException;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import p037.p058.p064.C1779;

/* JADX INFO: renamed from: މ.ނ.ހ.ހ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C1776 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public SparseArray<C1777> f5906 = new SparseArray<>();

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public SparseArray<C1779> f5907 = new SparseArray<>();

    /* JADX INFO: renamed from: މ.ނ.ހ.ހ$֏, reason: contains not printable characters */
    public static class C1777 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int f5908;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public ArrayList<C1778> f5909 = new ArrayList<>();

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public int f5910;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public C1779 f5911;

        public C1777(Context context, XmlPullParser xmlPullParser) {
            this.f5910 = -1;
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), C1790.State);
            int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
            for (int i = 0; i < indexCount; i++) {
                int index = typedArrayObtainStyledAttributes.getIndex(i);
                if (index == C1790.State_android_id) {
                    this.f5908 = typedArrayObtainStyledAttributes.getResourceId(index, this.f5908);
                } else if (index == C1790.State_constraints) {
                    this.f5910 = typedArrayObtainStyledAttributes.getResourceId(index, this.f5910);
                    String resourceTypeName = context.getResources().getResourceTypeName(this.f5910);
                    context.getResources().getResourceName(this.f5910);
                    if ("layout".equals(resourceTypeName)) {
                        C1779 c1779 = new C1779();
                        this.f5911 = c1779;
                        c1779.m3530(context, this.f5910);
                    }
                }
            }
            typedArrayObtainStyledAttributes.recycle();
        }
    }

    /* JADX INFO: renamed from: މ.ނ.ހ.ހ$ؠ, reason: contains not printable characters */
    public static class C1778 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public float f5912;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public float f5913;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public float f5914;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public float f5915;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public int f5916;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public C1779 f5917;

        public C1778(Context context, XmlPullParser xmlPullParser) {
            this.f5912 = Float.NaN;
            this.f5913 = Float.NaN;
            this.f5914 = Float.NaN;
            this.f5915 = Float.NaN;
            this.f5916 = -1;
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(Xml.asAttributeSet(xmlPullParser), C1790.Variant);
            int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
            for (int i = 0; i < indexCount; i++) {
                int index = typedArrayObtainStyledAttributes.getIndex(i);
                if (index == C1790.Variant_constraints) {
                    this.f5916 = typedArrayObtainStyledAttributes.getResourceId(index, this.f5916);
                    String resourceTypeName = context.getResources().getResourceTypeName(this.f5916);
                    context.getResources().getResourceName(this.f5916);
                    if ("layout".equals(resourceTypeName)) {
                        C1779 c1779 = new C1779();
                        this.f5917 = c1779;
                        c1779.m3530(context, this.f5916);
                    }
                } else if (index == C1790.Variant_region_heightLessThan) {
                    this.f5915 = typedArrayObtainStyledAttributes.getDimension(index, this.f5915);
                } else if (index == C1790.Variant_region_heightMoreThan) {
                    this.f5913 = typedArrayObtainStyledAttributes.getDimension(index, this.f5913);
                } else if (index == C1790.Variant_region_widthLessThan) {
                    this.f5914 = typedArrayObtainStyledAttributes.getDimension(index, this.f5914);
                } else if (index == C1790.Variant_region_widthMoreThan) {
                    this.f5912 = typedArrayObtainStyledAttributes.getDimension(index, this.f5912);
                } else {
                    Log.v("ConstraintLayoutStates", "Unknown tag");
                }
            }
            typedArrayObtainStyledAttributes.recycle();
        }
    }

    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    public C1776(Context context, ConstraintLayout constraintLayout, int i) {
        XmlResourceParser xml = context.getResources().getXml(i);
        C1777 c1777 = null;
        try {
            for (int eventType = xml.getEventType(); eventType != 1; eventType = xml.next()) {
                if (eventType == 0) {
                    xml.getName();
                } else if (eventType == 2) {
                    String name = xml.getName();
                    byte b = -1;
                    switch (name.hashCode()) {
                        case -1349929691:
                            if (name.equals("ConstraintSet")) {
                                b = 4;
                            }
                            break;
                        case 80204913:
                            if (name.equals("State")) {
                                b = 2;
                            }
                            break;
                        case 1382829617:
                            if (name.equals("StateSet")) {
                                b = 1;
                            }
                            break;
                        case 1657696882:
                            if (name.equals("layoutDescription")) {
                                b = 0;
                            }
                            break;
                        case 1901439077:
                            if (name.equals("Variant")) {
                                b = 3;
                            }
                            break;
                    }
                    if (b != 0 && b != 1) {
                        if (b == 2) {
                            c1777 = new C1777(context, xml);
                            this.f5906.put(c1777.f5908, c1777);
                        } else if (b == 3) {
                            C1778 c1778 = new C1778(context, xml);
                            if (c1777 != null) {
                                c1777.f5909.add(c1778);
                            }
                        } else if (b != 4) {
                            Log.v("ConstraintLayoutStates", "unknown tag " + name);
                        } else {
                            m3527(context, xml);
                        }
                    }
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e2) {
            e2.printStackTrace();
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:114:0x01d2, code lost:
    
        continue;
     */
    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    /* JADX WARN: Removed duplicated region for block: B:56:0x00e7  */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m3527(Context context, XmlPullParser xmlPullParser) {
        int eventType;
        C1779.C1780 c1780;
        C1779.C1780 c1780M3529;
        C1779 c1779 = new C1779();
        int attributeCount = xmlPullParser.getAttributeCount();
        for (int i = 0; i < attributeCount; i++) {
            if ("id".equals(xmlPullParser.getAttributeName(i))) {
                String attributeValue = xmlPullParser.getAttributeValue(i);
                int identifier = attributeValue.contains("/") ? 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");
                    }
                }
                try {
                    eventType = xmlPullParser.getEventType();
                    c1780 = null;
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (XmlPullParserException e2) {
                    e2.printStackTrace();
                }
                while (eventType != 1) {
                    if (eventType != 0) {
                        byte b = 3;
                        if (eventType == 2) {
                            String name = xmlPullParser.getName();
                            switch (name.hashCode()) {
                                case -2025855158:
                                    b = name.equals("Layout") ? (byte) 5 : (byte) -1;
                                    break;
                                case -1984451626:
                                    if (name.equals("Motion")) {
                                        b = 6;
                                        break;
                                    }
                                    break;
                                case -1269513683:
                                    if (name.equals("PropertySet")) {
                                        break;
                                    }
                                    break;
                                case -1238332596:
                                    if (name.equals("Transform")) {
                                        b = 4;
                                        break;
                                    }
                                    break;
                                case -71750448:
                                    if (name.equals("Guideline")) {
                                        b = 1;
                                        break;
                                    }
                                    break;
                                case 1331510167:
                                    if (name.equals("Barrier")) {
                                        b = 2;
                                        break;
                                    }
                                    break;
                                case 1791837707:
                                    if (name.equals("CustomAttribute")) {
                                        b = 7;
                                        break;
                                    }
                                    break;
                                case 1803088381:
                                    if (name.equals("Constraint")) {
                                        b = 0;
                                        break;
                                    }
                                    break;
                                default:
                                    break;
                            }
                            switch (b) {
                                case 0:
                                    c1780M3529 = c1779.m3529(context, Xml.asAttributeSet(xmlPullParser));
                                    break;
                                case 1:
                                    c1780M3529 = c1779.m3529(context, Xml.asAttributeSet(xmlPullParser));
                                    c1780M3529.f5926.f5930 = true;
                                    c1780M3529.f5926.f5931 = true;
                                    break;
                                case 2:
                                    c1780M3529 = c1779.m3529(context, Xml.asAttributeSet(xmlPullParser));
                                    c1780M3529.f5926.f5985 = 1;
                                    break;
                                case 3:
                                    if (c1780 == null) {
                                        throw new RuntimeException("XML parser error must be within a Constraint " + xmlPullParser.getLineNumber());
                                    }
                                    c1780.f5924.m3538(context, Xml.asAttributeSet(xmlPullParser));
                                    continue;
                                    break;
                                case 4:
                                    if (c1780 == null) {
                                        throw new RuntimeException("XML parser error must be within a Constraint " + xmlPullParser.getLineNumber());
                                    }
                                    c1780.f5927.m3539(context, Xml.asAttributeSet(xmlPullParser));
                                    continue;
                                    break;
                                case 5:
                                    if (c1780 == null) {
                                        throw new RuntimeException("XML parser error must be within a Constraint " + xmlPullParser.getLineNumber());
                                    }
                                    c1780.f5926.m3536(context, Xml.asAttributeSet(xmlPullParser));
                                    continue;
                                    break;
                                case 6:
                                    if (c1780 == null) {
                                        throw new RuntimeException("XML parser error must be within a Constraint " + xmlPullParser.getLineNumber());
                                    }
                                    c1780.f5925.m3537(context, Xml.asAttributeSet(xmlPullParser));
                                    continue;
                                    break;
                                case 7:
                                    if (c1780 == null) {
                                        throw new RuntimeException("XML parser error must be within a Constraint " + xmlPullParser.getLineNumber());
                                    }
                                    C1773.m3520(context, xmlPullParser, c1780.f5928);
                                    continue;
                                    break;
                            }
                            c1780 = c1780M3529;
                        } else if (eventType != 3) {
                            continue;
                        } else {
                            String name2 = xmlPullParser.getName();
                            if ("ConstraintSet".equals(name2)) {
                                this.f5907.put(identifier, c1779);
                                return;
                            } else if (name2.equalsIgnoreCase("Constraint")) {
                                c1779.f5922.put(Integer.valueOf(c1780.f5923), c1780);
                                c1780 = null;
                            }
                        }
                    } else {
                        xmlPullParser.getName();
                    }
                    eventType = xmlPullParser.next();
                }
                this.f5907.put(identifier, c1779);
                return;
            }
        }
    }
}
