package h;

import d.AbstractC0421a;
import d.C0424d;
import d.C0425e;
import g.C0474a;
import g.EnumC0475b;
import g.InterfaceC0476c;
import g.i;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import l.C0611c;
import l.C0615g;
import okhttp3.HttpUrl;

/* JADX INFO: loaded from: classes.dex */
public class o implements t {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final l[] f4142a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    protected final l[] f4143b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    protected final Class f4144c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final C0615g f4145d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private ConcurrentMap f4146e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private final Map f4147f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private Map f4148g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private transient long[] f4149h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    private transient short[] f4150i;

    public o(g.i iVar, Class cls, Type type) {
        this(iVar, C0615g.c(cls, type, iVar.f4006f, iVar.f4013m, iVar.f4015o, iVar.t()));
    }

    private Object c(g.i iVar, Object obj) {
        return this.f4145d.f5293e.invoke(null, obj);
    }

    protected static o l(g.i iVar, C0615g c0615g, String str) {
        e.d dVar = c0615g.f5299k;
        if (dVar == null) {
            return null;
        }
        for (Class cls : dVar.seeAlso()) {
            t tVarN = iVar.n(cls);
            if (tVarN instanceof o) {
                o oVar = (o) tVarN;
                C0615g c0615g2 = oVar.f4145d;
                if (c0615g2.f5300l.equals(str)) {
                    return oVar;
                }
                o oVarL = l(iVar, c0615g2, str);
                if (oVarL != null) {
                    return oVarL;
                }
            }
        }
        return null;
    }

    static boolean m(int i2, int[] iArr) {
        if (iArr == null) {
            return false;
        }
        int i3 = i2 / 32;
        int i4 = i2 % 32;
        if (i3 < iArr.length) {
            if (((1 << i4) & iArr[i3]) != 0) {
                return true;
            }
        }
        return false;
    }

    protected void a(InterfaceC0476c interfaceC0476c, int i2) {
        if (interfaceC0476c.F() != i2) {
            throw new C0424d("syntax error");
        }
    }

    @Override // h.t
    public Object b(C0474a c0474a, Type type, Object obj) {
        return g(c0474a, type, obj, 0);
    }

    @Override // h.t
    public int d() {
        return 12;
    }

    public Object e(C0474a c0474a, Type type) {
        Object objNewInstance;
        if ((type instanceof Class) && this.f4144c.isInterface()) {
            return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{(Class) type}, new C0425e());
        }
        C0615g c0615g = this.f4145d;
        Constructor constructor = c0615g.f5291c;
        Object obj = null;
        if (constructor == null && c0615g.f5293e == null) {
            return null;
        }
        Method method = c0615g.f5293e;
        if (method != null && c0615g.f5295g > 0) {
            return null;
        }
        try {
            if (c0615g.f5295g == 0) {
                objNewInstance = constructor != null ? constructor.newInstance(null) : method.invoke(null, null);
            } else {
                g.h hVarJ = c0474a.j();
                if (hVarJ == null || hVarJ.f3984a == null) {
                    throw new C0424d("can't create non-static inner class instance.");
                }
                if (!(type instanceof Class)) {
                    throw new C0424d("can't create non-static inner class instance.");
                }
                String name = ((Class) type).getName();
                String strSubstring = name.substring(0, name.lastIndexOf(36));
                Object obj2 = hVarJ.f3984a;
                String name2 = obj2.getClass().getName();
                if (!name2.equals(strSubstring)) {
                    g.h hVar = hVarJ.f3985b;
                    if (hVar == null || hVar.f3984a == null || !("java.util.ArrayList".equals(name2) || "java.util.List".equals(name2) || "java.util.Collection".equals(name2) || "java.util.Map".equals(name2) || "java.util.HashMap".equals(name2))) {
                        obj = obj2;
                    } else if (hVar.f3984a.getClass().getName().equals(strSubstring)) {
                        obj = hVar.f3984a;
                    }
                    obj2 = obj;
                }
                if (obj2 == null || ((obj2 instanceof Collection) && ((Collection) obj2).isEmpty())) {
                    throw new C0424d("can't create non-static inner class instance.");
                }
                objNewInstance = constructor.newInstance(obj2);
            }
            if (c0474a != null && c0474a.f3944H.j(EnumC0475b.InitStringFieldAsEmpty)) {
                for (C0611c c0611c : this.f4145d.f5296h) {
                    if (c0611c.f5264y == String.class) {
                        try {
                            c0611c.n(objNewInstance, HttpUrl.FRAGMENT_ENCODE_SET);
                        } catch (Exception e2) {
                            throw new C0424d("create instance error, class " + this.f4144c.getName(), e2);
                        }
                    }
                }
            }
            return objNewInstance;
        } catch (C0424d e3) {
            throw e3;
        } catch (Exception e4) {
            throw new C0424d("create instance error, class " + this.f4144c.getName(), e4);
        }
    }

    public Object f(Map map, g.i iVar) throws IllegalAccessException {
        Object objNewInstance;
        C0615g c0615g;
        C0611c[] c0611cArr;
        Constructor constructor;
        C0611c[] c0611cArr2;
        Integer num;
        C0615g c0615g2 = this.f4145d;
        if (c0615g2.f5292d == null && c0615g2.f5293e == null) {
            Object objE = e(null, this.f4144c);
            for (Map.Entry entry : map.entrySet()) {
                String str = (String) entry.getKey();
                Object value = entry.getValue();
                l lVarQ = q(str);
                if (lVarQ != null) {
                    C0611c c0611c = lVarQ.f4139a;
                    Field field = c0611c.f5262r;
                    Type type = c0611c.f5243H;
                    if (c0611c.f5244I == null || c0611c.d() == null || c0611c.d().deserializeUsing() == Void.class || !c0611c.f5264y.isInstance(value)) {
                        if (field != null && c0611c.f5256g == null) {
                            Class<?> type2 = field.getType();
                            if (type2 == Boolean.TYPE) {
                                if (value == Boolean.FALSE) {
                                    field.setBoolean(objE, false);
                                } else if (value == Boolean.TRUE) {
                                    field.setBoolean(objE, true);
                                }
                            } else if (type2 == Integer.TYPE) {
                                if (value instanceof Number) {
                                    field.setInt(objE, ((Number) value).intValue());
                                }
                            } else if (type2 == Long.TYPE) {
                                if (value instanceof Number) {
                                    field.setLong(objE, ((Number) value).longValue());
                                }
                            } else if (type2 == Float.TYPE) {
                                if (value instanceof Number) {
                                    field.setFloat(objE, ((Number) value).floatValue());
                                } else if (value instanceof String) {
                                    String str2 = (String) value;
                                    field.setFloat(objE, str2.length() <= 10 ? l.l.J0(str2) : Float.parseFloat(str2));
                                }
                            } else if (type2 == Double.TYPE) {
                                if (value instanceof Number) {
                                    field.setDouble(objE, ((Number) value).doubleValue());
                                } else if (value instanceof String) {
                                    String str3 = (String) value;
                                    field.setDouble(objE, str3.length() <= 10 ? l.l.I0(str3) : Double.parseDouble(str3));
                                }
                            } else if (value != null && type == value.getClass()) {
                                field.set(objE, value);
                            }
                        }
                        String str4 = c0611c.f5259i0;
                        lVarQ.g(objE, (str4 == null || type != Date.class) ? (str4 != null && (type instanceof Class) && ((Class) type).getName().equals("java.time.LocalDateTime")) ? l.l.v(value, str4) : type instanceof ParameterizedType ? l.l.g(value, (ParameterizedType) type, iVar) : l.l.h(value, type, iVar) : l.l.p(value, str4));
                    } else {
                        lVarQ.c(new C0474a(AbstractC0421a.n(value)), objE, type, null);
                    }
                }
            }
            Method method = this.f4145d.f5294f;
            if (method == null) {
                return objE;
            }
            try {
                return method.invoke(objE, null);
            } catch (Exception e2) {
                throw new C0424d("build object error", e2);
            }
        }
        C0611c[] c0611cArr3 = c0615g2.f5296h;
        int length = c0611cArr3.length;
        Object[] objArr = new Object[length];
        HashMap map2 = null;
        for (int i2 = 0; i2 < length; i2++) {
            C0611c c0611c2 = c0611cArr3[i2];
            Object objValueOf = map.get(c0611c2.f5250b);
            if (objValueOf == null) {
                Class cls = c0611c2.f5264y;
                if (cls == Integer.TYPE) {
                    objValueOf = 0;
                } else if (cls == Long.TYPE) {
                    objValueOf = 0L;
                } else if (cls == Short.TYPE) {
                    objValueOf = (short) 0;
                } else if (cls == Byte.TYPE) {
                    objValueOf = (byte) 0;
                } else if (cls == Float.TYPE) {
                    objValueOf = Float.valueOf(0.0f);
                } else if (cls == Double.TYPE) {
                    objValueOf = Double.valueOf(com.jsyn.unitgen.u.FALSE);
                } else if (cls == Character.TYPE) {
                    objValueOf = '0';
                } else if (cls == Boolean.TYPE) {
                    objValueOf = Boolean.FALSE;
                }
                if (map2 == null) {
                    map2 = new HashMap();
                }
                map2.put(c0611c2.f5250b, Integer.valueOf(i2));
            }
            objArr[i2] = objValueOf;
        }
        if (map2 != null) {
            for (Map.Entry entry2 : map.entrySet()) {
                String str5 = (String) entry2.getKey();
                Object value2 = entry2.getValue();
                l lVarQ2 = q(str5);
                if (lVarQ2 != null && (num = (Integer) map2.get(lVarQ2.f4139a.f5250b)) != null) {
                    objArr[num.intValue()] = value2;
                }
            }
        }
        C0615g c0615g3 = this.f4145d;
        if (c0615g3.f5292d == null) {
            Method method2 = c0615g3.f5293e;
            if (method2 == null) {
                return null;
            }
            try {
                return method2.invoke(null, objArr);
            } catch (Exception e3) {
                throw new C0424d("create factory method error, " + this.f4145d.f5293e.toString(), e3);
            }
        }
        if (!c0615g3.f5305q) {
            try {
                objNewInstance = this.f4145d.f5292d.newInstance(objArr);
                break;
            } catch (Exception e4) {
                throw new C0424d("create instance error, " + this.f4145d.f5292d.toGenericString(), e4);
            }
        }
        int i3 = 0;
        while (true) {
            if (i3 < length) {
                if (objArr[i3] != null || (c0611cArr = (c0615g = this.f4145d).f5296h) == null || i3 >= c0611cArr.length) {
                    i3++;
                } else if (c0611cArr[i3].f5264y == String.class && (constructor = c0615g.f5306r) != null) {
                    try {
                        objNewInstance = constructor.newInstance(null);
                        for (int i4 = 0; i4 < length; i4++) {
                            Object obj = objArr[i4];
                            if (obj != null && (c0611cArr2 = this.f4145d.f5296h) != null && i4 < c0611cArr2.length) {
                                c0611cArr2[i4].n(objNewInstance, obj);
                            }
                        }
                    } catch (Exception e5) {
                        throw new C0424d("create instance error, " + this.f4145d.f5292d.toGenericString(), e5);
                    }
                }
            }
        }
        return objNewInstance;
    }

    public Object g(C0474a c0474a, Type type, Object obj, int i2) {
        return h(c0474a, type, obj, null, i2, null);
    }

    /* JADX WARN: Code restructure failed: missing block: B:146:0x01f2, code lost:
    
        if (r7 == (-2)) goto L147;
     */
    /* JADX WARN: Code restructure failed: missing block: B:386:0x0518, code lost:
    
        r27 = r5;
        r0 = r20;
        r12 = r28;
        r37 = 0;
     */
    /* JADX WARN: Code restructure failed: missing block: B:572:0x07e7, code lost:
    
        if (r6[r3].f5264y != r12) goto L596;
     */
    /* JADX WARN: Code restructure failed: missing block: B:573:0x07e9, code lost:
    
        r3 = r5.f5306r;
     */
    /* JADX WARN: Code restructure failed: missing block: B:574:0x07eb, code lost:
    
        if (r3 == null) goto L596;
     */
    /* JADX WARN: Code restructure failed: missing block: B:575:0x07ed, code lost:
    
        r3 = r3.newInstance(null);
     */
    /* JADX WARN: Code restructure failed: missing block: B:576:0x07f2, code lost:
    
        r5 = 0;
     */
    /* JADX WARN: Code restructure failed: missing block: B:578:0x07f4, code lost:
    
        if (r5 >= r1.length) goto L714;
     */
    /* JADX WARN: Code restructure failed: missing block: B:579:0x07f6, code lost:
    
        r6 = r1[r5];
     */
    /* JADX WARN: Code restructure failed: missing block: B:580:0x07f8, code lost:
    
        if (r6 == null) goto L715;
     */
    /* JADX WARN: Code restructure failed: missing block: B:581:0x07fa, code lost:
    
        r7 = r32.f4145d.f5296h;
     */
    /* JADX WARN: Code restructure failed: missing block: B:582:0x07fe, code lost:
    
        if (r7 == null) goto L716;
     */
    /* JADX WARN: Code restructure failed: missing block: B:584:0x0801, code lost:
    
        if (r5 >= r7.length) goto L717;
     */
    /* JADX WARN: Code restructure failed: missing block: B:585:0x0803, code lost:
    
        r7[r5].n(r3, r6);
     */
    /* JADX WARN: Code restructure failed: missing block: B:587:0x0809, code lost:
    
        r0 = th;
     */
    /* JADX WARN: Code restructure failed: missing block: B:588:0x080a, code lost:
    
        r5 = r3;
     */
    /* JADX WARN: Code restructure failed: missing block: B:589:0x080d, code lost:
    
        r0 = e;
     */
    /* JADX WARN: Code restructure failed: missing block: B:591:0x080f, code lost:
    
        r5 = r5 + 1;
     */
    /* JADX WARN: Code restructure failed: missing block: B:592:0x0812, code lost:
    
        r1 = r3;
     */
    /* JADX WARN: Code restructure failed: missing block: B:593:0x0814, code lost:
    
        r0 = e;
     */
    /* JADX WARN: Code restructure failed: missing block: B:594:0x0815, code lost:
    
        r3 = r27;
     */
    /* JADX WARN: Code restructure failed: missing block: B:606:0x0873, code lost:
    
        throw new d.C0424d("create instance error, " + r2 + ", " + r32.f4145d.f5292d.toGenericString(), r0);
     */
    /* JADX WARN: Code restructure failed: missing block: B:644:0x0913, code lost:
    
        throw new d.C0424d("syntax error, unexpect token " + g.g.a(r11.F()));
     */
    /* JADX WARN: Removed duplicated region for block: B:291:0x037f A[Catch: all -> 0x01cb, TryCatch #7 {all -> 0x01cb, blocks: (B:124:0x01ba, B:126:0x01be, B:291:0x037f, B:293:0x0389, B:295:0x0395, B:298:0x03a2, B:305:0x03bc, B:307:0x03c6, B:309:0x03d2, B:311:0x03d9, B:313:0x03e1, B:316:0x03e9, B:317:0x03f5, B:320:0x03fe, B:323:0x0404, B:326:0x0409, B:327:0x0415, B:329:0x041d, B:330:0x0423, B:332:0x0429, B:334:0x042f, B:335:0x0435, B:336:0x043b, B:337:0x043f, B:340:0x0446, B:351:0x0475, B:352:0x048f, B:354:0x0492, B:361:0x04a0, B:363:0x04a9, B:365:0x04bc, B:368:0x04c9, B:370:0x04d3, B:372:0x04ee, B:374:0x04f6, B:376:0x04fa, B:378:0x0500, B:358:0x049b, B:133:0x01cf, B:137:0x01da, B:143:0x01e6, B:147:0x01f4, B:151:0x0215, B:153:0x0219, B:160:0x0229, B:167:0x0239, B:172:0x0245, B:177:0x024f, B:182:0x0259, B:187:0x0263, B:189:0x0269, B:192:0x0277, B:194:0x027f, B:196:0x0283, B:204:0x029b, B:212:0x02ae, B:220:0x02c1, B:226:0x02d0, B:230:0x02e6, B:232:0x02ee, B:236:0x02f9, B:235:0x02f5, B:242:0x0304, B:244:0x030c, B:248:0x0317, B:247:0x0313, B:254:0x0322, B:258:0x0331, B:257:0x032d, B:264:0x033c, B:266:0x0344, B:270:0x034f, B:269:0x034b, B:276:0x035a, B:278:0x0360, B:282:0x036b, B:281:0x0367), top: B:668:0x01ba }] */
    /* JADX WARN: Removed duplicated region for block: B:393:0x0551  */
    /* JADX WARN: Removed duplicated region for block: B:395:0x0560 A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:411:0x05a7  */
    /* JADX WARN: Removed duplicated region for block: B:413:0x05b0  */
    /* JADX WARN: Removed duplicated region for block: B:442:0x062c  */
    /* JADX WARN: Removed duplicated region for block: B:461:0x0688  */
    /* JADX WARN: Removed duplicated region for block: B:462:0x068b A[Catch: all -> 0x066b, TryCatch #6 {all -> 0x066b, blocks: (B:642:0x08e2, B:459:0x0680, B:462:0x068b, B:464:0x0691, B:637:0x08d1, B:639:0x08d9, B:643:0x08f4, B:644:0x0913, B:448:0x065b, B:450:0x0661, B:452:0x0667, B:457:0x0678, B:645:0x0914, B:646:0x091c), top: B:667:0x08e2 }] */
    /* JADX WARN: Removed duplicated region for block: B:598:0x0825 A[Catch: all -> 0x019d, TRY_ENTER, TryCatch #17 {all -> 0x019d, blocks: (B:109:0x017d, B:111:0x018b, B:113:0x0191, B:470:0x06a2, B:598:0x0825, B:599:0x082d, B:601:0x0833, B:603:0x0845, B:618:0x08a4, B:620:0x08a9, B:627:0x08b8, B:634:0x08c6, B:635:0x08cd, B:342:0x0454, B:344:0x045d, B:349:0x046d, B:350:0x0474), top: B:684:0x017d, inners: #16 }] */
    /* JADX WARN: Removed duplicated region for block: B:652:0x0928  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    protected java.lang.Object h(g.C0474a r33, java.lang.reflect.Type r34, java.lang.Object r35, java.lang.Object r36, int r37, int[] r38) throws java.lang.Throwable {
        /*
            Method dump skipped, instruction units count: 2355
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: h.o.h(g.a, java.lang.reflect.Type, java.lang.Object, java.lang.Object, int, int[]):java.lang.Object");
    }

    public Object i(C0474a c0474a, Type type, Object obj, Object obj2) {
        InterfaceC0476c interfaceC0476c = c0474a.f3944H;
        if (interfaceC0476c.F() != 14) {
            throw new C0424d("error");
        }
        String strC0 = interfaceC0476c.c0(c0474a.f3955g);
        if (strC0 != null) {
            t tVarL = l(c0474a.i(), this.f4145d, strC0);
            if (tVarL == null) {
                tVarL = c0474a.i().n(c0474a.i().h(strC0, l.l.P(type), interfaceC0476c.I()));
            }
            if (tVarL instanceof o) {
                return ((o) tVarL).i(c0474a, type, obj, obj2);
            }
        }
        Object objE = e(c0474a, type);
        int length = this.f4143b.length;
        int i2 = 0;
        while (true) {
            if (i2 >= length) {
                break;
            }
            char c2 = i2 == length + (-1) ? ']' : ',';
            l lVar = this.f4143b[i2];
            Class cls = lVar.f4139a.f5264y;
            if (cls == Integer.TYPE) {
                lVar.e(objE, interfaceC0476c.u(c2));
            } else if (cls == String.class) {
                lVar.h(objE, interfaceC0476c.H(c2));
            } else if (cls == Long.TYPE) {
                lVar.f(objE, interfaceC0476c.R(c2));
            } else if (cls.isEnum()) {
                char cL = interfaceC0476c.L();
                lVar.g(objE, (cL == '\"' || cL == 'n') ? interfaceC0476c.G(cls, c0474a.v(), c2) : (cL < '0' || cL > '9') ? o(interfaceC0476c, c2) : ((h) ((f) lVar).j(c0474a.i())).c(interfaceC0476c.u(c2)));
            } else if (cls == Boolean.TYPE) {
                lVar.i(objE, interfaceC0476c.f(c2));
            } else if (cls == Float.TYPE) {
                lVar.g(objE, Float.valueOf(interfaceC0476c.h(c2)));
            } else if (cls == Double.TYPE) {
                lVar.g(objE, Double.valueOf(interfaceC0476c.K(c2)));
            } else if (cls == Date.class && interfaceC0476c.L() == '1') {
                lVar.g(objE, new Date(interfaceC0476c.R(c2)));
            } else if (cls == BigDecimal.class) {
                lVar.g(objE, interfaceC0476c.N(c2));
            } else {
                interfaceC0476c.s(14);
                C0611c c0611c = lVar.f4139a;
                lVar.g(objE, c0474a.P(c0611c.f5243H, c0611c.f5250b));
                if (interfaceC0476c.F() == 15) {
                    break;
                }
                a(interfaceC0476c, c2 == ']' ? 15 : 16);
            }
            i2++;
        }
        interfaceC0476c.s(16);
        return objE;
    }

    public l j(String str) {
        return k(str, null);
    }

    public l k(String str, int[] iArr) {
        l lVar;
        if (str == null) {
            return null;
        }
        Map map = this.f4148g;
        if (map != null && (lVar = (l) map.get(str)) != null) {
            return lVar;
        }
        int length = this.f4143b.length - 1;
        int i2 = 0;
        while (i2 <= length) {
            int i3 = (i2 + length) >>> 1;
            int iCompareTo = this.f4143b[i3].f4139a.f5250b.compareTo(str);
            if (iCompareTo < 0) {
                i2 = i3 + 1;
            } else {
                if (iCompareTo <= 0) {
                    if (m(i3, iArr)) {
                        return null;
                    }
                    return this.f4143b[i3];
                }
                length = i3 - 1;
            }
        }
        Map map2 = this.f4147f;
        if (map2 != null) {
            return (l) map2.get(str);
        }
        return null;
    }

    /* JADX WARN: Removed duplicated region for block: B:114:0x021c  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x0088  */
    /* JADX WARN: Removed duplicated region for block: B:60:0x012b  */
    /* JADX WARN: Type inference failed for: r19v13 */
    /* JADX WARN: Type inference failed for: r19v2, types: [boolean, int] */
    /* JADX WARN: Type inference failed for: r19v5 */
    /* JADX WARN: Type inference failed for: r19v6 */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public boolean n(g.C0474a r22, java.lang.String r23, java.lang.Object r24, java.lang.reflect.Type r25, java.util.Map r26, int[] r27) {
        /*
            Method dump skipped, instruction units count: 605
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: h.o.n(g.a, java.lang.String, java.lang.Object, java.lang.reflect.Type, java.util.Map, int[]):boolean");
    }

    protected Enum o(InterfaceC0476c interfaceC0476c, char c2) {
        throw new C0424d("illegal enum. " + interfaceC0476c.b());
    }

    protected Enum p(g.d dVar, char[] cArr, t tVar) {
        h hVar = tVar instanceof h ? (h) tVar : null;
        if (hVar == null) {
            dVar.f3975c0 = -1;
            return null;
        }
        long jU0 = dVar.u0(cArr);
        if (dVar.f3975c0 <= 0) {
            return null;
        }
        Enum enumA = hVar.a(jU0);
        if (enumA == null) {
            if (jU0 == -3750763034362895579L) {
                return null;
            }
            if (dVar.j(EnumC0475b.ErrorOnEnumNotMatch)) {
                throw new C0424d("not match enum value, " + hVar.f4135a);
            }
        }
        return enumA;
    }

    public l q(String str) {
        return r(str, null);
    }

    public l r(String str, int[] iArr) {
        boolean zStartsWith;
        if (str == null) {
            return null;
        }
        l lVarK = k(str, iArr);
        if (lVarK == null) {
            int i2 = 0;
            if (this.f4149h == null) {
                long[] jArr = new long[this.f4143b.length];
                int i3 = 0;
                while (true) {
                    l[] lVarArr = this.f4143b;
                    if (i3 >= lVarArr.length) {
                        break;
                    }
                    jArr[i3] = lVarArr[i3].f4139a.f5261k0;
                    i3++;
                }
                Arrays.sort(jArr);
                this.f4149h = jArr;
            }
            int iBinarySearch = Arrays.binarySearch(this.f4149h, l.l.J(str));
            if (iBinarySearch < 0) {
                iBinarySearch = Arrays.binarySearch(this.f4149h, l.l.K(str));
            }
            if (iBinarySearch < 0) {
                zStartsWith = str.startsWith("is");
                if (zStartsWith) {
                    iBinarySearch = Arrays.binarySearch(this.f4149h, l.l.K(str.substring(2)));
                }
            } else {
                zStartsWith = false;
            }
            if (iBinarySearch >= 0) {
                if (this.f4150i == null) {
                    short[] sArr = new short[this.f4149h.length];
                    Arrays.fill(sArr, (short) -1);
                    while (true) {
                        l[] lVarArr2 = this.f4143b;
                        if (i2 >= lVarArr2.length) {
                            break;
                        }
                        int iBinarySearch2 = Arrays.binarySearch(this.f4149h, lVarArr2[i2].f4139a.f5261k0);
                        if (iBinarySearch2 >= 0) {
                            sArr[iBinarySearch2] = (short) i2;
                        }
                        i2++;
                    }
                    this.f4150i = sArr;
                }
                short s2 = this.f4150i[iBinarySearch];
                if (s2 != -1 && !m(s2, iArr)) {
                    lVarK = this.f4143b[s2];
                }
            }
            if (lVarK != null) {
                C0611c c0611c = lVarK.f4139a;
                if ((c0611c.f5247Q & EnumC0475b.DisableFieldSmartMatch.mask) != 0) {
                    return null;
                }
                Class cls = c0611c.f5264y;
                if (zStartsWith && cls != Boolean.TYPE && cls != Boolean.class) {
                    return null;
                }
            }
        }
        return lVarK;
    }

    public o(g.i iVar, C0615g c0615g) {
        this.f4144c = c0615g.f5289a;
        this.f4145d = c0615g;
        e.d dVar = c0615g.f5299k;
        if (dVar != null && dVar.autoTypeCheckHandler() != i.a.class) {
            try {
                android.support.v4.media.a.a(c0615g.f5299k.autoTypeCheckHandler().newInstance());
            } catch (Exception unused) {
            }
        }
        C0611c[] c0611cArr = c0615g.f5297i;
        this.f4143b = new l[c0611cArr.length];
        int length = c0611cArr.length;
        HashMap map = null;
        for (int i2 = 0; i2 < length; i2++) {
            C0611c c0611c = c0615g.f5297i[i2];
            l lVarI = iVar.i(iVar, c0615g, c0611c);
            this.f4143b[i2] = lVarI;
            if (length > 128) {
                if (this.f4148g == null) {
                    this.f4148g = new HashMap();
                }
                this.f4148g.put(c0611c.f5250b, lVarI);
            }
            for (String str : c0611c.f5260j0) {
                if (map == null) {
                    map = new HashMap();
                }
                map.put(str, lVarI);
            }
        }
        this.f4147f = map;
        C0611c[] c0611cArr2 = c0615g.f5296h;
        this.f4142a = new l[c0611cArr2.length];
        int length2 = c0611cArr2.length;
        for (int i3 = 0; i3 < length2; i3++) {
            this.f4142a[i3] = j(c0615g.f5296h[i3].f5250b);
        }
    }
}
