package L0;

import B0.r0;
import B0.t0;
import android.net.Uri;
import android.os.Handler;
import g1.C0971b;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import u0.C1578n;
import u0.C1579o;
import x0.AbstractC1709a;

/* JADX INFO: loaded from: classes.dex */
public final class T implements A, T0.o, P0.h, P0.k, a0 {

    /* JADX INFO: renamed from: f0, reason: collision with root package name */
    public static final Map f3687f0;

    /* JADX INFO: renamed from: g0, reason: collision with root package name */
    public static final C1579o f3688g0;

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public final long f3689A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public final P0.m f3690B;

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public final A1.y f3691C;
    public final t0 D;

    /* JADX INFO: renamed from: E, reason: collision with root package name */
    public final N f3692E;

    /* JADX INFO: renamed from: F, reason: collision with root package name */
    public final N f3693F;

    /* JADX INFO: renamed from: G, reason: collision with root package name */
    public final Handler f3694G;
    public InterfaceC0170z H;

    /* JADX INFO: renamed from: I, reason: collision with root package name */
    public C0971b f3695I;

    /* JADX INFO: renamed from: J, reason: collision with root package name */
    public b0[] f3696J;

    /* JADX INFO: renamed from: K, reason: collision with root package name */
    public S[] f3697K;

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

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

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

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

    /* JADX INFO: renamed from: P, reason: collision with root package name */
    public C2.a f3702P;

    /* JADX INFO: renamed from: Q, reason: collision with root package name */
    public T0.z f3703Q;

    /* JADX INFO: renamed from: R, reason: collision with root package name */
    public long f3704R;

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

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

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

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

    /* JADX INFO: renamed from: W, reason: collision with root package name */
    public boolean f3709W;
    public int X;

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

    /* JADX INFO: renamed from: Z, reason: collision with root package name */
    public long f3711Z;

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    public long f3712a0;

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

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

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

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

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final Uri f3717q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final z0.h f3718r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final E0.h f3719s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final C4.f f3720t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final E0.e f3721u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final E0.e f3722v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final W f3723w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final P0.e f3724x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final long f3725y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final C1579o f3726z;

    static {
        HashMap map = new HashMap();
        map.put("Icy-MetaData", "1");
        f3687f0 = Collections.unmodifiableMap(map);
        C1578n c1578n = new C1578n();
        c1578n.f17309a = "icy";
        c1578n.f17320m = u0.E.m("application/x-icy");
        f3688g0 = new C1579o(c1578n);
    }

    public T(Uri uri, z0.h hVar, A1.y yVar, E0.h hVar2, E0.e eVar, C4.f fVar, E0.e eVar2, W w4, P0.e eVar3, int i, C1579o c1579o, long j8, Q0.a aVar) {
        this.f3717q = uri;
        this.f3718r = hVar;
        this.f3719s = hVar2;
        this.f3722v = eVar;
        this.f3720t = fVar;
        this.f3721u = eVar2;
        this.f3723w = w4;
        this.f3724x = eVar3;
        this.f3725y = i;
        this.f3726z = c1579o;
        this.f3690B = aVar != null ? new P0.m(aVar) : new P0.m("ProgressiveMediaPeriod");
        this.f3691C = yVar;
        this.f3689A = j8;
        this.D = new t0();
        this.f3692E = new N(this, 1);
        this.f3693F = new N(this, 2);
        this.f3694G = x0.v.n(null);
        this.f3697K = new S[0];
        this.f3696J = new b0[0];
        this.f3712a0 = -9223372036854775807L;
        this.f3706T = 1;
    }

    public final void A() {
        long j8;
        int i;
        if (this.f3716e0 || this.f3699M || !this.f3698L || this.f3703Q == null) {
            return;
        }
        for (b0 b0Var : this.f3696J) {
            if (b0Var.t() == null) {
                return;
            }
        }
        t0 t0Var = this.D;
        synchronized (t0Var) {
            t0Var.f916b = false;
        }
        int length = this.f3696J.length;
        u0.T[] tArr = new u0.T[length];
        boolean[] zArr = new boolean[length];
        int i5 = 0;
        while (true) {
            j8 = this.f3689A;
            if (i5 >= length) {
                break;
            }
            C1579o c1579oT = this.f3696J[i5].t();
            c1579oT.getClass();
            String str = c1579oT.f17358n;
            boolean zI = u0.E.i(str);
            boolean z8 = zI || u0.E.l(str);
            zArr[i5] = z8;
            this.f3700N = z8 | this.f3700N;
            this.f3701O = j8 != -9223372036854775807L && length == 1 && u0.E.j(str);
            C0971b c0971b = this.f3695I;
            if (c0971b != null) {
                if (zI || this.f3697K[i5].f3686b) {
                    u0.D d8 = c1579oT.f17356l;
                    u0.D d9 = d8 == null ? new u0.D(c0971b) : d8.a(c0971b);
                    C1578n c1578nA = c1579oT.a();
                    c1578nA.f17318k = d9;
                    c1579oT = new C1579o(c1578nA);
                }
                if (zI && c1579oT.f17353h == -1 && c1579oT.i == -1 && (i = c0971b.f12877a) != -1) {
                    C1578n c1578nA2 = c1579oT.a();
                    c1578nA2.f17316h = i;
                    c1579oT = new C1579o(c1578nA2);
                }
            }
            int iO = this.f3719s.o(c1579oT);
            C1578n c1578nA3 = c1579oT.a();
            c1578nA3.f17308L = iO;
            C1579o c1579o = new C1579o(c1578nA3);
            tArr[i5] = new u0.T(Integer.toString(i5), c1579o);
            this.f3709W = c1579o.f17364t | this.f3709W;
            i5++;
        }
        this.f3702P = new C2.a(new n0(tArr), zArr);
        if (this.f3701O && this.f3704R == -9223372036854775807L) {
            this.f3704R = j8;
            this.f3703Q = new O(this, this.f3703Q);
        }
        this.f3723w.t(this.f3704R, this.f3703Q, this.f3705S);
        this.f3699M = true;
        InterfaceC0170z interfaceC0170z = this.H;
        interfaceC0170z.getClass();
        interfaceC0170z.n(this);
    }

    public final void B(int i) {
        w();
        C2.a aVar = this.f3702P;
        boolean[] zArr = (boolean[]) aVar.f1160u;
        if (zArr[i]) {
            return;
        }
        C1579o c1579o = ((n0) aVar.f1158s).a(i).f17203d[0];
        int iH = u0.E.h(c1579o.f17358n);
        long j8 = this.f3711Z;
        E0.e eVar = this.f3721u;
        eVar.a(new C0.b(eVar, 7, new C0169y(1, iH, c1579o, 0, null, x0.v.W(j8), -9223372036854775807L)));
        zArr[i] = true;
    }

    public final void C(int i) {
        w();
        if (this.f3713b0) {
            if ((!this.f3700N || ((boolean[]) this.f3702P.f1157r)[i]) && !this.f3696J[i].u(false)) {
                this.f3712a0 = 0L;
                this.f3713b0 = false;
                this.f3708V = true;
                this.f3711Z = 0L;
                this.f3714c0 = 0;
                for (b0 b0Var : this.f3696J) {
                    b0Var.z(false);
                }
                InterfaceC0170z interfaceC0170z = this.H;
                interfaceC0170z.getClass();
                interfaceC0170z.s(this);
            }
        }
    }

    public final T0.F D(S s8) {
        int length = this.f3696J.length;
        for (int i = 0; i < length; i++) {
            if (s8.equals(this.f3697K[i])) {
                return this.f3696J[i];
            }
        }
        if (this.f3698L) {
            AbstractC1709a.B("ProgressiveMediaPeriod", "Extractor added new track (id=" + s8.f3685a + ") after finishing tracks.");
            return new T0.l();
        }
        E0.h hVar = this.f3719s;
        hVar.getClass();
        b0 b0Var = new b0(this.f3724x, hVar, this.f3722v);
        b0Var.f3774f = this;
        int i5 = length + 1;
        S[] sArr = (S[]) Arrays.copyOf(this.f3697K, i5);
        sArr[length] = s8;
        int i8 = x0.v.f18553a;
        this.f3697K = sArr;
        b0[] b0VarArr = (b0[]) Arrays.copyOf(this.f3696J, i5);
        b0VarArr[length] = b0Var;
        this.f3696J = b0VarArr;
        return b0Var;
    }

    public final void E(T0.z zVar) {
        this.f3703Q = this.f3695I == null ? zVar : new T0.q(-9223372036854775807L);
        this.f3704R = zVar.k();
        boolean z8 = !this.f3710Y && zVar.k() == -9223372036854775807L;
        this.f3705S = z8;
        this.f3706T = z8 ? 7 : 1;
        if (this.f3699M) {
            this.f3723w.t(this.f3704R, zVar, z8);
        } else {
            A();
        }
    }

    public final void F() {
        P p3 = new P(this, this.f3717q, this.f3718r, this.f3691C, this, this.D);
        if (this.f3699M) {
            AbstractC1709a.j(z());
            long j8 = this.f3704R;
            if (j8 != -9223372036854775807L && this.f3712a0 > j8) {
                this.f3715d0 = true;
                this.f3712a0 = -9223372036854775807L;
                return;
            }
            T0.z zVar = this.f3703Q;
            zVar.getClass();
            long j9 = zVar.h(this.f3712a0).f6482a.f6339b;
            long j10 = this.f3712a0;
            p3.f3676f.f4006a = j9;
            p3.i = j10;
            p3.f3678h = true;
            p3.f3681l = false;
            for (b0 b0Var : this.f3696J) {
                b0Var.f3787t = this.f3712a0;
            }
            this.f3712a0 = -9223372036854775807L;
        }
        this.f3714c0 = x();
        this.f3690B.d(p3, this, this.f3720t.o(this.f3706T));
    }

    public final boolean G() {
        return this.f3708V || z();
    }

    @Override // L0.e0
    public final boolean a() {
        boolean z8;
        if (!this.f3690B.b()) {
            return false;
        }
        t0 t0Var = this.D;
        synchronized (t0Var) {
            z8 = t0Var.f916b;
        }
        return z8;
    }

    @Override // L0.A
    public final long b(O0.s[] sVarArr, boolean[] zArr, c0[] c0VarArr, boolean[] zArr2, long j8) {
        O0.s sVar;
        w();
        C2.a aVar = this.f3702P;
        n0 n0Var = (n0) aVar.f1158s;
        boolean[] zArr3 = (boolean[]) aVar.f1159t;
        int i = this.X;
        int i5 = 0;
        for (int i8 = 0; i8 < sVarArr.length; i8++) {
            c0 c0Var = c0VarArr[i8];
            if (c0Var != null && (sVarArr[i8] == null || !zArr[i8])) {
                int i9 = ((Q) c0Var).f3683q;
                AbstractC1709a.j(zArr3[i9]);
                this.X--;
                zArr3[i9] = false;
                c0VarArr[i8] = null;
            }
        }
        boolean z8 = !this.f3707U ? j8 == 0 || this.f3701O : i != 0;
        for (int i10 = 0; i10 < sVarArr.length; i10++) {
            if (c0VarArr[i10] == null && (sVar = sVarArr[i10]) != null) {
                AbstractC1709a.j(sVar.length() == 1);
                AbstractC1709a.j(sVar.k(0) == 0);
                int iIndexOf = n0Var.f3884b.indexOf(sVar.b());
                if (iIndexOf < 0) {
                    iIndexOf = -1;
                }
                AbstractC1709a.j(!zArr3[iIndexOf]);
                this.X++;
                zArr3[iIndexOf] = true;
                this.f3709W = sVar.e().f17364t | this.f3709W;
                c0VarArr[i10] = new Q(this, iIndexOf);
                zArr2[i10] = true;
                if (!z8) {
                    b0 b0Var = this.f3696J[iIndexOf];
                    z8 = (b0Var.q() == 0 || b0Var.C(j8, true)) ? false : true;
                }
            }
        }
        if (this.X == 0) {
            this.f3713b0 = false;
            this.f3708V = false;
            this.f3709W = false;
            P0.m mVar = this.f3690B;
            if (mVar.b()) {
                b0[] b0VarArr = this.f3696J;
                int length = b0VarArr.length;
                while (i5 < length) {
                    b0VarArr[i5].j();
                    i5++;
                }
                mVar.a();
            } else {
                this.f3715d0 = false;
                for (b0 b0Var2 : this.f3696J) {
                    b0Var2.z(false);
                }
            }
        } else if (z8) {
            j8 = p(j8);
            while (i5 < c0VarArr.length) {
                if (c0VarArr[i5] != null) {
                    zArr2[i5] = true;
                }
                i5++;
            }
        }
        this.f3707U = true;
        return j8;
    }

    @Override // L0.A
    public final long c(long j8, r0 r0Var) {
        w();
        if (!this.f3703Q.b()) {
            return 0L;
        }
        T0.y yVarH = this.f3703Q.h(j8);
        return r0Var.a(j8, yVarH.f6482a.f6338a, yVarH.f6483b.f6338a);
    }

    @Override // L0.A
    public final n0 d() {
        w();
        return (n0) this.f3702P.f1158s;
    }

    @Override // P0.h
    public final void e(P0.j jVar, long j8, long j9, int i) {
        C0164t c0164t;
        P p3 = (P) jVar;
        z0.x xVar = p3.f3672b;
        if (i == 0) {
            c0164t = new C0164t(p3.f3679j);
        } else {
            Uri uri = xVar.f19183s;
            c0164t = new C0164t(j9);
        }
        this.f3721u.e(c0164t, 1, -1, null, 0, null, p3.i, this.f3704R, i);
    }

    @Override // L0.e0
    public final boolean f(B0.T t6) {
        if (this.f3715d0) {
            return false;
        }
        P0.m mVar = this.f3690B;
        if (mVar.f5306c != null || this.f3713b0) {
            return false;
        }
        if ((this.f3699M || this.f3726z != null) && this.X == 0) {
            return false;
        }
        boolean zF = this.D.f();
        if (mVar.b()) {
            return zF;
        }
        F();
        return true;
    }

    @Override // P0.h
    public final void g(P0.j jVar, long j8, long j9) {
        P p3 = (P) jVar;
        if (this.f3704R == -9223372036854775807L && this.f3703Q != null) {
            long jY = y(true);
            long j10 = jY == Long.MIN_VALUE ? 0L : jY + 10000;
            this.f3704R = j10;
            this.f3723w.t(j10, this.f3703Q, this.f3705S);
        }
        Uri uri = p3.f3672b.f19183s;
        C0164t c0164t = new C0164t(j9);
        this.f3720t.getClass();
        this.f3721u.c(c0164t, 1, -1, null, 0, null, p3.i, this.f3704R);
        this.f3715d0 = true;
        InterfaceC0170z interfaceC0170z = this.H;
        interfaceC0170z.getClass();
        interfaceC0170z.s(this);
    }

    @Override // T0.o
    public final void h() {
        this.f3698L = true;
        this.f3694G.post(this.f3692E);
    }

    @Override // P0.k
    public final void i() {
        for (b0 b0Var : this.f3696J) {
            b0Var.z(true);
            K4.c cVar = b0Var.f3776h;
            if (cVar != null) {
                cVar.J(b0Var.f3773e);
                b0Var.f3776h = null;
                b0Var.f3775g = null;
            }
        }
        A1.y yVar = this.f3691C;
        T0.m mVar = (T0.m) yVar.f364s;
        if (mVar != null) {
            mVar.a();
            yVar.f364s = null;
        }
        yVar.f365t = null;
    }

    @Override // T0.o
    public final T0.F j(int i, int i5) {
        return D(new S(i, false));
    }

    @Override // L0.e0
    public final long k() {
        long jY;
        boolean z8;
        w();
        if (this.f3715d0 || this.X == 0) {
            return Long.MIN_VALUE;
        }
        if (z()) {
            return this.f3712a0;
        }
        if (this.f3700N) {
            int length = this.f3696J.length;
            jY = Long.MAX_VALUE;
            for (int i = 0; i < length; i++) {
                C2.a aVar = this.f3702P;
                if (((boolean[]) aVar.f1157r)[i] && ((boolean[]) aVar.f1159t)[i]) {
                    b0 b0Var = this.f3696J[i];
                    synchronized (b0Var) {
                        z8 = b0Var.f3790w;
                    }
                    if (!z8) {
                        jY = Math.min(jY, this.f3696J[i].n());
                    }
                }
            }
        } else {
            jY = Long.MAX_VALUE;
        }
        if (jY == Long.MAX_VALUE) {
            jY = y(false);
        }
        return jY == Long.MIN_VALUE ? this.f3711Z : jY;
    }

    @Override // L0.A
    public final void l() throws IOException {
        int iO = this.f3720t.o(this.f3706T);
        P0.m mVar = this.f3690B;
        IOException iOException = mVar.f5306c;
        if (iOException != null) {
            throw iOException;
        }
        P0.i iVar = mVar.f5305b;
        if (iVar != null) {
            if (iO == Integer.MIN_VALUE) {
                iO = iVar.f5291q;
            }
            IOException iOException2 = iVar.f5295u;
            if (iOException2 != null && iVar.f5296v > iO) {
                throw iOException2;
            }
        }
        if (this.f3715d0 && !this.f3699M) {
            throw u0.F.a(null, "Loading finished before preparation is complete.");
        }
    }

    @Override // L0.a0
    public final void m() {
        this.f3694G.post(this.f3692E);
    }

    @Override // P0.h
    public final B1.f n(P0.j jVar, long j8, long j9, IOException iOException, int i) {
        long jMin;
        B1.f fVar;
        T0.z zVar;
        P p3 = (P) jVar;
        Uri uri = p3.f3672b.f19183s;
        C0164t c0164t = new C0164t(j9);
        int i5 = x0.v.f18553a;
        this.f3720t.getClass();
        if ((iOException instanceof u0.F) || (iOException instanceof FileNotFoundException) || (iOException instanceof z0.q) || (iOException instanceof P0.l)) {
            jMin = -9223372036854775807L;
            break;
        }
        int i8 = z0.i.f19130r;
        for (Throwable cause = iOException; cause != null; cause = cause.getCause()) {
            if ((cause instanceof z0.i) && ((z0.i) cause).f19131q == 2008) {
                jMin = -9223372036854775807L;
                break;
            }
        }
        jMin = Math.min((i - 1) * 1000, 5000);
        if (jMin == -9223372036854775807L) {
            fVar = P0.m.f5303f;
        } else {
            int iX = x();
            int i9 = iX > this.f3714c0 ? 1 : 0;
            if (this.f3710Y || !((zVar = this.f3703Q) == null || zVar.k() == -9223372036854775807L)) {
                this.f3714c0 = iX;
            } else if (!this.f3699M || G()) {
                this.f3708V = this.f3699M;
                this.f3711Z = 0L;
                this.f3714c0 = 0;
                for (b0 b0Var : this.f3696J) {
                    b0Var.z(false);
                }
                p3.f3676f.f4006a = 0L;
                p3.i = 0L;
                p3.f3678h = true;
                p3.f3681l = false;
            } else {
                this.f3713b0 = true;
                fVar = P0.m.f5302e;
            }
            fVar = new B1.f(i9, jMin, false);
        }
        B1.f fVar2 = fVar;
        int i10 = fVar2.f961a;
        this.f3721u.d(c0164t, 1, -1, null, 0, null, p3.i, this.f3704R, iOException, !(i10 == 0 || i10 == 1));
        return fVar2;
    }

    @Override // L0.A
    public final void o(InterfaceC0170z interfaceC0170z, long j8) {
        this.H = interfaceC0170z;
        C1579o c1579o = this.f3726z;
        if (c1579o == null) {
            this.D.f();
            F();
        } else {
            j(0, 3).e(c1579o);
            E(new T0.w(-9223372036854775807L, new long[]{0}, new long[]{0}));
            h();
            this.f3712a0 = j8;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:39:0x0071  */
    @Override // L0.A
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final long p(long j8) {
        w();
        boolean[] zArr = (boolean[]) this.f3702P.f1157r;
        if (!this.f3703Q.b()) {
            j8 = 0;
        }
        this.f3708V = false;
        boolean z8 = true;
        boolean z9 = this.f3711Z == j8;
        this.f3711Z = j8;
        if (z()) {
            this.f3712a0 = j8;
            return j8;
        }
        int i = this.f3706T;
        P0.m mVar = this.f3690B;
        if (i == 7 || !(this.f3715d0 || mVar.b())) {
            this.f3713b0 = false;
            this.f3712a0 = j8;
            this.f3715d0 = false;
            this.f3709W = false;
            if (mVar.b()) {
                for (b0 b0Var : this.f3696J) {
                    b0Var.j();
                }
                mVar.a();
                return j8;
            }
            mVar.f5306c = null;
            for (b0 b0Var2 : this.f3696J) {
                b0Var2.z(false);
            }
        } else {
            int length = this.f3696J.length;
            for (int i5 = 0; i5 < length; i5++) {
                b0 b0Var3 = this.f3696J[i5];
                if (b0Var3.q() != 0 || !z9) {
                    if (!(this.f3701O ? b0Var3.B(b0Var3.f3784q) : b0Var3.C(j8, false)) && (zArr[i5] || !this.f3700N)) {
                        z8 = false;
                        break;
                    }
                }
            }
            if (!z8) {
            }
        }
        return j8;
    }

    @Override // L0.A
    public final void q(long j8) throws Throwable {
        if (this.f3701O) {
            return;
        }
        w();
        if (z()) {
            return;
        }
        boolean[] zArr = (boolean[]) this.f3702P.f1159t;
        int length = this.f3696J.length;
        for (int i = 0; i < length; i++) {
            this.f3696J[i].i(j8, zArr[i]);
        }
    }

    @Override // L0.e0
    public final long r() {
        return k();
    }

    @Override // P0.h
    public final void s(P0.j jVar, long j8, long j9, boolean z8) {
        P p3 = (P) jVar;
        Uri uri = p3.f3672b.f19183s;
        C0164t c0164t = new C0164t(j9);
        this.f3720t.getClass();
        this.f3721u.b(c0164t, 1, -1, null, 0, null, p3.i, this.f3704R);
        if (z8) {
            return;
        }
        for (b0 b0Var : this.f3696J) {
            b0Var.z(false);
        }
        if (this.X > 0) {
            InterfaceC0170z interfaceC0170z = this.H;
            interfaceC0170z.getClass();
            interfaceC0170z.s(this);
        }
    }

    @Override // L0.A
    public final long t() {
        if (this.f3709W) {
            this.f3709W = false;
            return this.f3711Z;
        }
        if (!this.f3708V) {
            return -9223372036854775807L;
        }
        if (!this.f3715d0 && x() <= this.f3714c0) {
            return -9223372036854775807L;
        }
        this.f3708V = false;
        return this.f3711Z;
    }

    @Override // T0.o
    public final void v(T0.z zVar) {
        this.f3694G.post(new B0.A(this, 15, zVar));
    }

    public final void w() {
        AbstractC1709a.j(this.f3699M);
        this.f3702P.getClass();
        this.f3703Q.getClass();
    }

    public final int x() {
        int i = 0;
        for (b0 b0Var : this.f3696J) {
            i += b0Var.f3784q + b0Var.f3783p;
        }
        return i;
    }

    /* JADX WARN: Removed duplicated region for block: B:8:0x0017  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final long y(boolean z8) {
        long jMax = Long.MIN_VALUE;
        for (int i = 0; i < this.f3696J.length; i++) {
            if (!z8) {
                C2.a aVar = this.f3702P;
                aVar.getClass();
                if (((boolean[]) aVar.f1159t)[i]) {
                    jMax = Math.max(jMax, this.f3696J[i].n());
                }
            }
        }
        return jMax;
    }

    public final boolean z() {
        return this.f3712a0 != -9223372036854775807L;
    }

    @Override // L0.e0
    public final void u(long j8) {
    }
}
