package u5;

import F1.C0186o;
import I2.C0334s;
import androidx.recyclerview.widget.i0;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
import n2.AbstractC2613d;
import p2.C2720a;
import p4.C2725d;
import x5.u;
import x5.x;

/* JADX INFO: loaded from: classes3.dex */
public final class l {

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final i0 f24641c;

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public C2725d f24643e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public boolean f24644f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public int f24645g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public d f24646h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public C2720a f24647i;

    public l(i0 i0Var) {
        ArrayList arrayList = (ArrayList) i0Var.f13105b;
        HashMap map = new HashMap();
        b(map, Arrays.asList(new v5.a('*'), new v5.a('_')));
        b(map, arrayList);
        this.f24640b = map;
        this.f24641c = i0Var;
        HashMap map2 = new HashMap();
        this.f24642d = map2;
        map2.put('\\', Collections.singletonList(new v5.c()));
        map2.put('`', Collections.singletonList(new v5.d()));
        map2.put('&', Collections.singletonList(new v5.e()));
        map2.put('<', Arrays.asList(new v5.b(), new v5.f()));
        Set setKeySet = map.keySet();
        Set setKeySet2 = map2.keySet();
        BitSet bitSet = new BitSet();
        Iterator it = setKeySet.iterator();
        while (it.hasNext()) {
            bitSet.set(((Character) it.next()).charValue());
        }
        Iterator it2 = setKeySet2.iterator();
        while (it2.hasNext()) {
            bitSet.set(((Character) it2.next()).charValue());
        }
        bitSet.set(91);
        bitSet.set(93);
        bitSet.set(33);
        bitSet.set(10);
        this.f24639a = bitSet;
    }

    public static void a(char c6, A5.a aVar, HashMap map) {
        if (((A5.a) map.put(Character.valueOf(c6), aVar)) == null) {
            return;
        }
        throw new IllegalArgumentException("Delimiter processor conflict with delimiter char '" + c6 + "'");
    }

    public static void b(HashMap map, List list) {
        r rVar;
        Iterator it = list.iterator();
        while (it.hasNext()) {
            A5.a aVar = (A5.a) it.next();
            char cD = aVar.d();
            char cB = aVar.b();
            if (cD == cB) {
                A5.a aVar2 = (A5.a) map.get(Character.valueOf(cD));
                if (aVar2 == null || aVar2.d() != aVar2.b()) {
                    a(cD, aVar, map);
                } else {
                    if (aVar2 instanceof r) {
                        rVar = (r) aVar2;
                    } else {
                        r rVar2 = new r(cD);
                        rVar2.e(aVar2);
                        rVar = rVar2;
                    }
                    rVar.e(aVar);
                    map.put(Character.valueOf(cD), rVar);
                }
            } else {
                a(cD, aVar, map);
                a(cB, aVar, map);
            }
        }
    }

    public static x i(C0334s c0334s) {
        x xVar = new x(c0334s.l());
        xVar.d(c0334s.m());
        return xVar;
    }

    public final void c(x5.r rVar) {
        x5.r rVar2 = rVar.f26082b;
        if (rVar2 == null) {
            return;
        }
        x5.r rVar3 = rVar.f26083c;
        x xVar = null;
        x xVar2 = null;
        int length = 0;
        while (rVar2 != null) {
            if (rVar2 instanceof x) {
                xVar2 = (x) rVar2;
                if (xVar == null) {
                    xVar = xVar2;
                }
                length = xVar2.f26092g.length() + length;
            } else {
                d(xVar, xVar2, length);
                c(rVar2);
                xVar = null;
                xVar2 = null;
                length = 0;
            }
            if (rVar2 == rVar3) {
                break;
            } else {
                rVar2 = rVar2.f26085e;
            }
        }
        d(xVar, xVar2, length);
    }

    public final void d(x xVar, x xVar2, int i6) {
        C0334s c0334s;
        if (xVar == null || xVar2 == null || xVar == xVar2) {
            return;
        }
        StringBuilder sb = new StringBuilder(i6);
        sb.append(xVar.f26092g);
        if (this.f24644f) {
            c0334s = new C0334s(7, (char) 0);
            c0334s.d(xVar.b());
        } else {
            c0334s = null;
        }
        x5.r rVar = xVar.f26085e;
        x5.r rVar2 = xVar2.f26085e;
        while (rVar != rVar2) {
            sb.append(((x) rVar).f26092g);
            if (c0334s != null) {
                c0334s.d(rVar.b());
            }
            x5.r rVar3 = rVar.f26085e;
            rVar.f();
            rVar = rVar3;
        }
        xVar.f26092g = sb.toString();
        if (c0334s != null) {
            List list = c0334s.f2658b;
            if (list == null) {
                list = Collections.EMPTY_LIST;
            }
            xVar.d(list);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:131:0x0214  */
    /* JADX WARN: Removed duplicated region for block: B:162:0x02d0 A[PHI: r4
      0x02d0: PHI (r4v49 char) = (r4v48 char), (r4v57 char), (r4v58 char) binds: [B:156:0x02c6, B:158:0x02ca, B:161:0x02cf] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:167:0x02e0  */
    /* JADX WARN: Removed duplicated region for block: B:176:0x0316  */
    /* JADX WARN: Removed duplicated region for block: B:178:0x031e  */
    /* JADX WARN: Removed duplicated region for block: B:189:0x0349  */
    /* JADX WARN: Removed duplicated region for block: B:197:0x036a  */
    /* JADX WARN: Removed duplicated region for block: B:201:0x0389  */
    /* JADX WARN: Removed duplicated region for block: B:219:0x03ea  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x00bd  */
    /* JADX WARN: Type inference failed for: r16v0, types: [u5.l] */
    /* JADX WARN: Type inference failed for: r5v1 */
    /* JADX WARN: Type inference failed for: r5v10, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r5v12, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r5v2, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r5v22, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r5v26, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r5v50 */
    /* JADX WARN: Type inference failed for: r5v51 */
    /* JADX WARN: Type inference failed for: r5v52 */
    /* JADX WARN: Type inference failed for: r5v56, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r5v63, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r5v8, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r7v53, types: [u5.k] */
    /* JADX WARN: Type inference failed for: r7v55 */
    /* JADX WARN: Type inference failed for: r7v62 */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void e(C0334s c0334s, x5.r rVar) {
        ?? SingletonList;
        x xVarI;
        String strB;
        x5.r nVar;
        x5.r rVarI;
        String strL;
        String strL2;
        A5.a aVar;
        int codePoint;
        boolean z6;
        boolean z7;
        ?? kVar;
        this.f24643e = new C2725d(c0334s.f2658b);
        this.f24644f = !c0334s.m().isEmpty();
        this.f24645g = 0;
        String strB2 = null;
        this.f24646h = null;
        this.f24647i = null;
        while (true) {
            char cK = this.f24643e.k();
            if (cK != 0) {
                int codePoint2 = 10;
                if (cK == '\n') {
                    this.f24643e.h();
                    SingletonList = Collections.singletonList(this.f24645g >= 2 ? new x5.h() : new u());
                } else if (cK == '!') {
                    C0186o c0186oL = this.f24643e.l();
                    this.f24643e.h();
                    if (this.f24643e.i('[')) {
                        C0186o c0186oL2 = this.f24643e.l();
                        xVarI = i(this.f24643e.c(c0186oL, c0186oL2));
                        C2720a c2720a = this.f24647i;
                        C2720a c2720a2 = new C2720a(xVarI, c0186oL, c0186oL2, c2720a, this.f24646h, true);
                        if (c2720a != null) {
                            c2720a.f22962c = true;
                        }
                        this.f24647i = c2720a2;
                    } else {
                        C2725d c2725d = this.f24643e;
                        xVarI = i(c2725d.c(c0186oL, c2725d.l()));
                    }
                    SingletonList = Collections.singletonList(xVarI);
                } else if (cK == '[') {
                    C0186o c0186oL3 = this.f24643e.l();
                    this.f24643e.h();
                    C0186o c0186oL4 = this.f24643e.l();
                    x xVarI2 = i(this.f24643e.c(c0186oL3, c0186oL4));
                    C2720a c2720a3 = this.f24647i;
                    C2720a c2720a4 = new C2720a(xVarI2, c0186oL3, c0186oL4, c2720a3, this.f24646h, false);
                    if (c2720a3 != null) {
                        c2720a3.f22962c = true;
                    }
                    this.f24647i = c2720a4;
                    SingletonList = Collections.singletonList(xVarI2);
                } else if (cK == ']') {
                    C0186o c0186oL5 = this.f24643e.l();
                    this.f24643e.h();
                    C0186o c0186oL6 = this.f24643e.l();
                    C2720a c2720a5 = this.f24647i;
                    if (c2720a5 == null) {
                        rVarI = i(this.f24643e.c(c0186oL5, c0186oL6));
                    } else if (!c2720a5.f22961b) {
                        this.f24647i = (C2720a) c2720a5.f22966g;
                        rVarI = i(this.f24643e.c(c0186oL5, c0186oL6));
                    } else if (this.f24643e.i('(')) {
                        this.f24643e.n();
                        C2725d c2725d2 = this.f24643e;
                        char cK2 = c2725d2.k();
                        C0186o c0186oL7 = c2725d2.l();
                        if (AbstractC2613d.q(c2725d2)) {
                            if (cK2 == '<') {
                                String strL3 = c2725d2.c(c0186oL7, c2725d2.l()).l();
                                strL2 = strL3.substring(1, strL3.length() - 1);
                            } else {
                                strL2 = c2725d2.c(c0186oL7, c2725d2.l()).l();
                            }
                            strB = w5.b.b(strL2);
                        } else {
                            strB = strB2;
                        }
                        if (strB == null) {
                            this.f24643e.m(c0186oL6);
                        } else {
                            if (this.f24643e.n() >= 1) {
                                C2725d c2725d3 = this.f24643e;
                                C0186o c0186oL8 = c2725d3.l();
                                if (c2725d3.d()) {
                                    char cK3 = c2725d3.k();
                                    char c6 = '\"';
                                    if (cK3 != '\"') {
                                        c6 = '\'';
                                        if (cK3 == '\'') {
                                            c2725d3.h();
                                            if (AbstractC2613d.s(c2725d3, c6) && c2725d3.d()) {
                                                c2725d3.h();
                                                String strL4 = c2725d3.c(c0186oL8, c2725d3.l()).l();
                                                strB2 = w5.b.b(strL4.substring(1, strL4.length() - 1));
                                            }
                                            this.f24643e.n();
                                        } else {
                                            if (cK3 == '(') {
                                                c6 = ')';
                                                c2725d3.h();
                                                if (AbstractC2613d.s(c2725d3, c6)) {
                                                    c2725d3.h();
                                                    String strL42 = c2725d3.c(c0186oL8, c2725d3.l()).l();
                                                    strB2 = w5.b.b(strL42.substring(1, strL42.length() - 1));
                                                    this.f24643e.n();
                                                }
                                            }
                                            strB2 = null;
                                            this.f24643e.n();
                                        }
                                    }
                                } else {
                                    strB2 = null;
                                    this.f24643e.n();
                                }
                            } else {
                                strB2 = null;
                            }
                            if (!this.f24643e.i(')')) {
                                this.f24643e.m(c0186oL6);
                                strB2 = null;
                                strB = null;
                            }
                        }
                        if (strB == null) {
                            C2725d c2725d4 = this.f24643e;
                            if (c2725d4.i('[')) {
                                C0186o c0186oL9 = c2725d4.l();
                                if (AbstractC2613d.r(c2725d4)) {
                                    C0186o c0186oL10 = c2725d4.l();
                                    if (c2725d4.i(']')) {
                                        strL = c2725d4.c(c0186oL9, c0186oL10).l();
                                        if (strL.length() > 999) {
                                        }
                                        if (strL == null) {
                                        }
                                        if (strL != null) {
                                            strL = this.f24643e.c((C0186o) c2720a5.f22965f, c0186oL5).l();
                                            if (strL != null) {
                                            }
                                        } else {
                                            strL = this.f24643e.c((C0186o) c2720a5.f22965f, c0186oL5).l();
                                            if (strL != null) {
                                            }
                                        }
                                    }
                                }
                            } else {
                                strL = null;
                                if (strL == null) {
                                    this.f24643e.m(c0186oL6);
                                }
                                if ((strL != null || strL.isEmpty()) && !c2720a5.f22962c) {
                                    strL = this.f24643e.c((C0186o) c2720a5.f22965f, c0186oL5).l();
                                }
                                if (strL != null) {
                                    l2.c cVar = (l2.c) this.f24641c.f13106c;
                                    cVar.getClass();
                                    x5.o oVar = (x5.o) ((LinkedHashMap) cVar.f20267b).get(w5.b.a(strL));
                                    if (oVar != null) {
                                        strB = oVar.f26079h;
                                        strB2 = oVar.f26080i;
                                    }
                                }
                            }
                        }
                        if (strB == null) {
                            boolean z8 = c2720a5.f22960a;
                            if (z8) {
                                x5.l lVar = new x5.l();
                                lVar.f26074g = strB;
                                lVar.f26075h = strB2;
                                nVar = lVar;
                            } else {
                                nVar = new x5.n(strB, strB2);
                            }
                            x xVar = (x) c2720a5.f22963d;
                            x5.r rVar2 = xVar.f26085e;
                            while (rVar2 != null) {
                                x5.r rVar3 = rVar2.f26085e;
                                nVar.a(rVar2);
                                rVar2 = rVar3;
                            }
                            if (this.f24644f) {
                                C2725d c2725d5 = this.f24643e;
                                nVar.d(c2725d5.c((C0186o) c2720a5.f22964e, c2725d5.l()).m());
                            }
                            g((d) c2720a5.f22967h);
                            c(nVar);
                            xVar.f();
                            C2720a c2720a6 = (C2720a) this.f24647i.f22966g;
                            this.f24647i = c2720a6;
                            if (!z8) {
                                while (c2720a6 != null) {
                                    if (!c2720a6.f22960a) {
                                        c2720a6.f22961b = false;
                                    }
                                    c2720a6 = (C2720a) c2720a6.f22966g;
                                }
                            }
                            rVarI = nVar;
                        } else {
                            this.f24647i = (C2720a) this.f24647i.f22966g;
                            this.f24643e.m(c0186oL6);
                            rVarI = i(this.f24643e.c(c0186oL5, c0186oL6));
                        }
                    } else {
                        strB2 = null;
                        strB = null;
                        if (strB == null) {
                        }
                        if (strB == null) {
                        }
                    }
                    SingletonList = Collections.singletonList(rVarI);
                } else if (this.f24639a.get(cK)) {
                    List list = (List) this.f24642d.get(Character.valueOf(cK));
                    if (list != null) {
                        C0186o c0186oL11 = this.f24643e.l();
                        Iterator it = list.iterator();
                        while (it.hasNext()) {
                            i0 i0VarA = ((v5.g) it.next()).a(this);
                            if (i0VarA != null) {
                                this.f24643e.m((C0186o) i0VarA.f13106c);
                                boolean z9 = this.f24644f;
                                x5.r rVar4 = (x5.r) i0VarA.f13105b;
                                if (z9 && rVar4.b().isEmpty()) {
                                    C2725d c2725d6 = this.f24643e;
                                    rVar4.d(c2725d6.c(c0186oL11, c2725d6.l()).m());
                                }
                                SingletonList = Collections.singletonList(rVar4);
                            } else {
                                this.f24643e.m(c0186oL11);
                            }
                        }
                        aVar = (A5.a) this.f24640b.get(Character.valueOf(cK));
                        if (aVar == null) {
                            SingletonList = Collections.singletonList(f());
                        } else {
                            C2725d c2725d7 = this.f24643e;
                            int i6 = c2725d7.f23011b;
                            if (i6 > 0) {
                                int i7 = i6 - 1;
                                char cCharAt = ((y5.b) c2725d7.f23014e).f26238a.charAt(i7);
                                boolean zIsLowSurrogate = Character.isLowSurrogate(cCharAt);
                                codePoint = cCharAt;
                                codePoint = cCharAt;
                                if (zIsLowSurrogate && i7 > 0) {
                                    char cCharAt2 = ((y5.b) c2725d7.f23014e).f26238a.charAt(i6 - 2);
                                    codePoint = cCharAt;
                                    if (Character.isHighSurrogate(cCharAt2)) {
                                        codePoint = Character.toCodePoint(cCharAt2, cCharAt);
                                    }
                                }
                            } else {
                                codePoint = c2725d7.f23010a > 0 ? 10 : 0;
                            }
                            C0186o c0186oL12 = this.f24643e.l();
                            if (this.f24643e.g(cK) < aVar.c()) {
                                this.f24643e.m(c0186oL12);
                                kVar = strB2;
                            } else {
                                ArrayList arrayList = new ArrayList();
                                this.f24643e.m(c0186oL12);
                                while (this.f24643e.i(cK)) {
                                    C2725d c2725d8 = this.f24643e;
                                    arrayList.add(i(c2725d8.c(c0186oL12, c2725d8.l())));
                                    c0186oL12 = this.f24643e.l();
                                }
                                C2725d c2725d9 = this.f24643e;
                                int i8 = c2725d9.f23011b;
                                if (i8 < c2725d9.f23012c) {
                                    char cCharAt3 = ((y5.b) c2725d9.f23014e).f26238a.charAt(i8);
                                    boolean zIsHighSurrogate = Character.isHighSurrogate(cCharAt3);
                                    codePoint2 = cCharAt3;
                                    if (zIsHighSurrogate) {
                                        int i9 = c2725d9.f23011b + 1;
                                        codePoint2 = cCharAt3;
                                        if (i9 < c2725d9.f23012c) {
                                            char cCharAt4 = ((y5.b) c2725d9.f23014e).f26238a.charAt(i9);
                                            codePoint2 = cCharAt3;
                                            if (Character.isLowSurrogate(cCharAt4)) {
                                                codePoint2 = Character.toCodePoint(cCharAt3, cCharAt4);
                                            }
                                        }
                                    }
                                } else if (c2725d9.f23010a >= ((ArrayList) c2725d9.f23013d).size() - 1) {
                                    codePoint2 = 0;
                                }
                                boolean z10 = codePoint == 0 || m1.g.h(codePoint);
                                boolean z11 = codePoint == 0 || m1.g.i(codePoint);
                                boolean z12 = codePoint2 == 0 || m1.g.h(codePoint2);
                                boolean z13 = codePoint2 == 0 || m1.g.i(codePoint2);
                                boolean z14 = !z13 && (!z12 || z11 || z10);
                                boolean z15 = !z11 && (!z10 || z13 || z12);
                                if (cK == '_') {
                                    z7 = z14 && (!z15 || z10);
                                    z6 = z15 && (!z14 || z12);
                                } else {
                                    boolean z16 = z14 && cK == aVar.d();
                                    z6 = z15 && cK == aVar.b();
                                    z7 = z16;
                                }
                                kVar = new k(arrayList, z7, z6);
                            }
                            if (kVar == 0) {
                                SingletonList = strB2;
                            } else {
                                d dVar = this.f24646h;
                                ArrayList arrayList2 = kVar.f24636a;
                                d dVar2 = new d(arrayList2, cK, kVar.f24638c, kVar.f24637b, dVar);
                                this.f24646h = dVar2;
                                d dVar3 = dVar2.f24601f;
                                if (dVar3 != null) {
                                    dVar3.f24602g = dVar2;
                                }
                                SingletonList = arrayList2;
                            }
                            if (SingletonList == 0) {
                            }
                        }
                    } else {
                        aVar = (A5.a) this.f24640b.get(Character.valueOf(cK));
                        if (aVar == null) {
                        }
                    }
                } else {
                    SingletonList = Collections.singletonList(f());
                }
            } else {
                SingletonList = 0;
            }
            if (SingletonList == 0) {
                g(null);
                c(rVar);
                return;
            } else {
                Iterator it2 = SingletonList.iterator();
                while (it2.hasNext()) {
                    rVar.a((x5.r) it2.next());
                }
                strB2 = null;
            }
        }
    }

    public final x f() {
        char cK;
        C0186o c0186oL = this.f24643e.l();
        this.f24643e.h();
        while (true) {
            cK = this.f24643e.k();
            if (cK == 0 || this.f24639a.get(cK)) {
                break;
            }
            this.f24643e.h();
        }
        C2725d c2725d = this.f24643e;
        C0334s c0334sC = c2725d.c(c0186oL, c2725d.l());
        String strL = c0334sC.l();
        int i6 = -1;
        if (cK == '\n') {
            int length = strL.length() - 1;
            while (true) {
                if (length < 0) {
                    break;
                }
                if (strL.charAt(length) != ' ') {
                    i6 = length;
                    break;
                }
                length--;
            }
            int i7 = i6 + 1;
            this.f24645g = strL.length() - i7;
            strL = strL.substring(0, i7);
        } else if (cK == 0) {
            int length2 = strL.length() - 1;
            while (true) {
                if (length2 >= 0) {
                    char cCharAt = strL.charAt(length2);
                    if (cCharAt != '\t' && cCharAt != ' ') {
                        i6 = length2;
                        break;
                    }
                    length2--;
                } else {
                    break;
                }
            }
            strL = strL.substring(0, i6 + 1);
        }
        x xVar = new x(strL);
        xVar.d(c0334sC.m());
        return xVar;
    }

    public final void g(d dVar) {
        boolean z6;
        ArrayList arrayList;
        HashMap map = new HashMap();
        d dVar2 = this.f24646h;
        while (dVar2 != null) {
            d dVar3 = dVar2.f24601f;
            if (dVar3 == dVar) {
                break;
            } else {
                dVar2 = dVar3;
            }
        }
        while (dVar2 != null) {
            HashMap map2 = this.f24640b;
            char c6 = dVar2.f24597b;
            A5.a aVar = (A5.a) map2.get(Character.valueOf(c6));
            if (!dVar2.f24600e || aVar == null) {
                dVar2 = dVar2.f24602g;
            } else {
                char cD = aVar.d();
                d dVar4 = dVar2.f24601f;
                int iA = 0;
                boolean z7 = false;
                while (dVar4 != null && dVar4 != dVar && dVar4 != map.get(Character.valueOf(c6))) {
                    if (dVar4.f24599d && dVar4.f24597b == cD) {
                        iA = aVar.a(dVar4, dVar2);
                        if (iA > 0) {
                            z6 = true;
                            z7 = true;
                            break;
                        }
                        z7 = true;
                    }
                    dVar4 = dVar4.f24601f;
                }
                z6 = false;
                if (z6) {
                    for (int i6 = 0; i6 < iA; i6++) {
                        ArrayList arrayList2 = dVar4.f24596a;
                        ((x) arrayList2.remove(arrayList2.size() - 1)).f();
                    }
                    int i7 = 0;
                    while (true) {
                        arrayList = dVar2.f24596a;
                        if (i7 >= iA) {
                            break;
                        }
                        ((x) arrayList.remove(0)).f();
                        i7++;
                    }
                    d dVar5 = dVar2.f24601f;
                    while (dVar5 != null && dVar5 != dVar4) {
                        d dVar6 = dVar5.f24601f;
                        h(dVar5);
                        dVar5 = dVar6;
                    }
                    if (dVar4.f24596a.size() == 0) {
                        h(dVar4);
                    }
                    if (arrayList.size() == 0) {
                        d dVar7 = dVar2.f24602g;
                        h(dVar2);
                        dVar2 = dVar7;
                    }
                } else {
                    if (!z7) {
                        map.put(Character.valueOf(c6), dVar2.f24601f);
                        if (!dVar2.f24599d) {
                            h(dVar2);
                        }
                    }
                    dVar2 = dVar2.f24602g;
                }
            }
        }
        while (true) {
            d dVar8 = this.f24646h;
            if (dVar8 == null || dVar8 == dVar) {
                return;
            } else {
                h(dVar8);
            }
        }
    }

    public final void h(d dVar) {
        d dVar2 = dVar.f24601f;
        if (dVar2 != null) {
            dVar2.f24602g = dVar.f24602g;
        }
        d dVar3 = dVar.f24602g;
        if (dVar3 == null) {
            this.f24646h = dVar2;
        } else {
            dVar3.f24601f = dVar2;
        }
    }
}
