package o;

import java.util.Arrays;
import java.util.HashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class ER extends C1095eR {

    /* renamed from: o, reason: collision with root package name */
    public final C1095eR f103o;
    public boolean p;

    public ER(long j, C2599u90 c2599u90, OC oc, OC oc2, C1095eR c1095eR) {
        super(j, c2599u90, oc, oc2);
        this.f103o = c1095eR;
        c1095eR.k();
    }

    @Override // o.C1095eR, o.AbstractC2220q90
    public final void c() {
        if (this.c) {
            return;
        }
        super.c();
        if (this.p) {
            return;
        }
        this.p = true;
        this.f103o.l();
    }

    @Override // o.C1095eR
    public final AbstractC2539te w() throws Throwable {
        ER er;
        C1095eR c1095eR = this.f103o;
        if (c1095eR.m || c1095eR.c) {
            return new C2314r90(this);
        }
        C0713aR c0713aR = this.h;
        long j = this.b;
        HashMap mapC = c0713aR != null ? AbstractC2884x90.c(c1095eR.g(), this, this.f103o.d()) : null;
        Object obj = AbstractC2884x90.c;
        synchronized (obj) {
            try {
                AbstractC2884x90.d(this);
            } catch (Throwable th) {
                th = th;
            }
            try {
                if (c0713aR == null || c0713aR.d == 0) {
                    er = this;
                    a();
                } else {
                    er = this;
                    AbstractC2539te abstractC2539teZ = er.z(this.f103o.g(), c0713aR, mapC, this.f103o.d());
                    if (!abstractC2539teZ.equals(C2409s90.f)) {
                        return abstractC2539teZ;
                    }
                    C0713aR c0713aRX = er.f103o.x();
                    if (c0713aRX != null) {
                        c0713aRX.j(c0713aR);
                    } else {
                        er.f103o.B(c0713aR);
                        er.h = null;
                    }
                }
                if (F3.n(er.f103o.g(), j) < 0) {
                    er.f103o.v();
                }
                C1095eR c1095eR2 = er.f103o;
                c1095eR2.r(c1095eR2.d().b(j).a(er.j));
                er.f103o.A(j);
                C1095eR c1095eR3 = er.f103o;
                int i = er.d;
                er.d = -1;
                if (i >= 0) {
                    int[] iArr = c1095eR3.k;
                    int length = iArr.length;
                    int[] iArrCopyOf = Arrays.copyOf(iArr, length + 1);
                    iArrCopyOf[length] = i;
                    c1095eR3.k = iArrCopyOf;
                } else {
                    c1095eR3.getClass();
                }
                C1095eR c1095eR4 = er.f103o;
                C2599u90 c2599u90 = er.j;
                c1095eR4.getClass();
                synchronized (obj) {
                    c1095eR4.j = c1095eR4.j.d(c2599u90);
                    C1095eR c1095eR5 = er.f103o;
                    int[] iArr2 = er.k;
                    c1095eR5.getClass();
                    if (iArr2.length != 0) {
                        int[] iArr3 = c1095eR5.k;
                        if (iArr3.length != 0) {
                            int length2 = iArr3.length;
                            int length3 = iArr2.length;
                            int[] iArrCopyOf2 = Arrays.copyOf(iArr3, length2 + length3);
                            System.arraycopy(iArr2, 0, iArrCopyOf2, length2, length3);
                            iArr2 = iArrCopyOf2;
                        }
                        c1095eR5.k = iArr2;
                    }
                }
                er.m = true;
                if (!er.p) {
                    er.p = true;
                    er.f103o.l();
                }
                return C2409s90.f;
            } catch (Throwable th2) {
                th = th2;
                throw th;
            }
        }
    }
}
