package defpackage;

import android.util.SparseArray;
import androidx.media3.exoplayer.drm.DrmSession$DrmSessionException;
import j$.util.Objects;
import java.io.EOFException;

/* JADX INFO: renamed from: ˆᵭᵎ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public class C0890 implements InterfaceC5226 {

    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    public boolean f3916;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public boolean f3917;

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public int f3918;

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public long f3919;

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public int f3920;

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public InterfaceC4417 f3922;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public C5286 f3925;

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public long f3928;

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public int f3932;

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public boolean f3933;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final C3317 f3934;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public boolean f3935;

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public int f3939;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final C4730 f3941;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public C5286 f3942;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final InterfaceC4636 f3945;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public C5286 f3946;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public InterfaceC0766 f3948;

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final C5019 f3914 = new C5019();

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public int f3947 = 1000;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public long[] f3940 = new long[1000];

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public long[] f3944 = new long[1000];

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public long[] f3923 = new long[1000];

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public int[] f3931 = new int[1000];

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public int[] f3937 = new int[1000];

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public C1688[] f3936 = new C1688[1000];

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final C1404 f3927 = new C1404(new ᵷᵝˎ(16));

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public long f3926 = Long.MIN_VALUE;

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public long f3924 = Long.MIN_VALUE;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public long f3930 = Long.MIN_VALUE;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public boolean f3943 = true;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public boolean f3938 = true;

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public boolean f3915 = true;

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public long f3921 = Long.MIN_VALUE;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public int f3929 = -1;

    public C0890(ᵣˊˈᵪ r1, InterfaceC4636 interfaceC4636, C3317 c3317) {
        this.f3945 = interfaceC4636;
        this.f3934 = c3317;
        this.f3941 = new C4730(r1);
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ʽˈˋ */
    public final void mo1738(C4545 c4545, int i, int i2) {
        while (true) {
            C4730 c4730 = this.f3941;
            if (i <= 0) {
                c4730.getClass();
                return;
            }
            int iM9891 = c4730.m9891(i);
            C1889 c1889 = c4730.f17990;
            C1196 c1196 = (C1196) c1889.f7486;
            c4545.m9627(c1196.f5091, ((int) (c4730.f17988 - c1889.f7485)) + c1196.f5090, iM9891);
            i -= iM9891;
            long j = c4730.f17988 + ((long) iM9891);
            c4730.f17988 = j;
            C1889 c18892 = c4730.f17990;
            if (j == c18892.f7487) {
                c4730.f17990 = (C1889) c18892.f7488;
            }
        }
    }

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public final int m3091(ˊˊᵞᵽ r12, C3008 c3008, int i, boolean z) {
        int i2;
        boolean z2 = (i & 2) != 0;
        C5019 c5019 = this.f3914;
        synchronized (this) {
            c3008.f11583 = false;
            int iM3103 = m3103();
            int i3 = this.f3929;
            boolean z3 = i3 != -1 && iM3103 >= i3;
            i2 = -5;
            if (!(this.f3918 != this.f3932) || z3) {
                if (!z && !this.f3935 && !z3) {
                    C5286 c5286 = this.f3946;
                    if (c5286 == null || (!z2 && c5286 == this.f3942)) {
                        i2 = -3;
                    } else {
                        m3121(c5286, r12);
                    }
                }
                c3008.f9866 = 4;
                c3008.f11577 = Long.MIN_VALUE;
                i2 = -4;
            } else {
                C5286 c52862 = ((C0209) this.f3927.m4043(iM3103)).f1687;
                if (!z2 && c52862 == this.f3942) {
                    int iM3109 = m3109(this.f3918);
                    if (m3094(iM3109)) {
                        c3008.f9866 = this.f3931[iM3109];
                        if (this.f3918 == this.f3932 - 1 && (z || this.f3935)) {
                            c3008.m6277(536870912);
                        }
                        c3008.f11577 = this.f3923[iM3109];
                        c5019.f19020 = this.f3937[iM3109];
                        c5019.f19018 = this.f3944[iM3109];
                        c5019.f19019 = this.f3936[iM3109];
                        i2 = -4;
                    } else {
                        c3008.f11583 = true;
                        i2 = -3;
                    }
                }
                m3121(c52862, r12);
            }
        }
        if (i2 == -4 && !c3008.m6278(4)) {
            boolean z4 = (i & 1) != 0;
            if ((i & 4) == 0) {
                C4730 c4730 = this.f3941;
                C5019 c50192 = this.f3914;
                if (z4) {
                    C4730.m9889(c4730.f17986, c3008, c50192, c4730.f17985);
                } else {
                    c4730.f17986 = C4730.m9889(c4730.f17986, c3008, c50192, c4730.f17985);
                }
            }
            if (!z4) {
                this.f3918++;
            }
        }
        return i2;
    }

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public final synchronized boolean m3092(int i) {
        m3093();
        int i2 = this.f3939;
        if (i >= i2 && i <= this.f3932 + i2) {
            int i3 = this.f3929;
            if (i3 != -1 && i >= i3) {
                return false;
            }
            this.f3926 = Long.MIN_VALUE;
            this.f3918 = i - i2;
            return true;
        }
        return false;
    }

    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    public final synchronized void m3093() {
        this.f3918 = 0;
        C4730 c4730 = this.f3941;
        c4730.f17986 = c4730.f17989;
    }

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public final boolean m3094(int i) {
        InterfaceC4417 interfaceC4417 = this.f3922;
        if (interfaceC4417 == null || interfaceC4417.mo4236() == 4) {
            return true;
        }
        return (this.f3931[i] & 1073741824) == 0 && this.f3922.mo4233();
    }

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public final synchronized long m3095() {
        return this.f3930;
    }

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public final void m3096(boolean z) {
        C4730 c4730 = this.f3941;
        C1889 c1889 = c4730.f17989;
        if (((C1196) c1889.f7486) != null) {
            ᵣˊˈᵪ r2 = c4730.f17987;
            synchronized (r2) {
                ((C2577) r2.ᵨᵼⁱ).f9955.m5753(c1889);
                C1889 c18892 = c1889;
                while (c18892 != null) {
                    C1196 c1196 = (C1196) c18892.f7486;
                    c1196.getClass();
                    r2.ˊᵡᵗʨ(c1196);
                    c18892 = (C1889) c18892.f7488;
                    if (c18892 == null || ((C1196) c18892.f7486) == null) {
                        c18892 = null;
                    }
                }
            }
            c1889.f7486 = null;
            c1889.f7488 = null;
        }
        C1889 c18893 = c4730.f17989;
        int i = c4730.f17984;
        ᵻᵪ.ˌᴵ(((C1196) c18893.f7486) == null);
        c18893.f7485 = 0L;
        c18893.f7487 = i;
        C1889 c18894 = c4730.f17989;
        c4730.f17986 = c18894;
        c4730.f17990 = c18894;
        c4730.f17988 = 0L;
        c4730.f17987.ˈⁱᵡ();
        this.f3932 = 0;
        this.f3939 = 0;
        this.f3920 = 0;
        this.f3918 = 0;
        this.f3929 = -1;
        this.f3938 = true;
        this.f3926 = Long.MIN_VALUE;
        this.f3924 = Long.MIN_VALUE;
        this.f3930 = Long.MIN_VALUE;
        this.f3935 = false;
        C1404 c1404 = this.f3927;
        SparseArray sparseArray = (SparseArray) c1404.f5807;
        for (int i2 = 0; i2 < sparseArray.size(); i2++) {
            ((ᵷᵝˎ) c1404.f5809).accept(sparseArray.valueAt(i2));
        }
        c1404.f5808 = -1;
        sparseArray.clear();
        if (z) {
            this.f3925 = null;
            this.f3946 = null;
            this.f3943 = true;
            this.f3915 = true;
        }
    }

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public C5286 mo3097(C5286 c5286) {
        if (this.f3919 == 0 || c5286.f19975 == Long.MAX_VALUE) {
            return c5286;
        }
        C4753 c4753M10878 = c5286.m10878();
        c4753M10878.f18094 = c5286.f19975 + this.f3919;
        return new C5286(c4753M10878);
    }

    /* JADX INFO: renamed from: ˊᵡᵗʨ, reason: contains not printable characters */
    public final synchronized void m3098(long j) throws Throwable {
        C0890 c0890;
        Throwable th;
        C0890 c08902;
        long j2;
        int iM3111;
        try {
            try {
                if (j == this.f3921) {
                    return;
                }
                int i = -1;
                if (j != Long.MIN_VALUE) {
                    if (j <= this.f3930) {
                        c08902 = this;
                        j2 = j;
                        iM3111 = c08902.m3111(this.f3920, this.f3932, j2, false);
                    } else {
                        c08902 = this;
                        j2 = j;
                        iM3111 = -1;
                    }
                    if (iM3111 != -1) {
                        i = c08902.f3939 + iM3111;
                    }
                    c08902.f3929 = i;
                    c08902.f3921 = j2;
                    return;
                }
                try {
                    this.f3929 = -1;
                    return;
                } catch (Throwable th2) {
                    th = th2;
                    c0890 = this;
                }
            } catch (Throwable th3) {
                th = th3;
            }
        } catch (Throwable th4) {
            th = th4;
            c0890 = this;
        }
        th = th;
        throw th;
    }

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public final long m3099(int i) {
        long jMax = Long.MIN_VALUE;
        if (i == 0) {
            return Long.MIN_VALUE;
        }
        int iM3109 = m3109(i - 1);
        for (int i2 = 0; i2 < i; i2++) {
            jMax = Math.max(jMax, this.f3923[iM3109]);
            if ((this.f3931[iM3109] & 1) != 0) {
                return jMax;
            }
            iM3109--;
            if (iM3109 == -1) {
                iM3109 = this.f3947 - 1;
            }
        }
        return jMax;
    }

    /* JADX WARN: Removed duplicated region for block: B:30:0x009a A[Catch: all -> 0x0021, TryCatch #0 {all -> 0x0021, blocks: (B:3:0x0001, B:5:0x0007, B:9:0x001d, B:12:0x0024, B:16:0x002c, B:18:0x003f, B:22:0x0047, B:23:0x004e, B:28:0x007f, B:51:0x00fa, B:53:0x0103, B:30:0x009a, B:32:0x00a3, B:34:0x00ac, B:36:0x00c0, B:40:0x00c9, B:41:0x00ce, B:43:0x00d4, B:47:0x00e2, B:49:0x00e7, B:50:0x00f7, B:33:0x00aa), top: B:58:0x0001 }] */
    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final synchronized void m3100(long j, int i, long j2, int i2, C1688 c1688) {
        try {
            int i3 = this.f3932;
            if (i3 > 0) {
                int iM3109 = m3109(i3 - 1);
                ᵻᵪ.ᵱᵽʡᵚ(this.f3944[iM3109] + ((long) this.f3937[iM3109]) <= j2);
            }
            this.f3935 = (536870912 & i) != 0;
            this.f3930 = Math.max(this.f3930, j);
            long j3 = this.f3921;
            if (j3 != Long.MIN_VALUE && this.f3929 == -1 && j >= j3) {
                this.f3929 = this.f3939 + this.f3932;
            }
            int iM31092 = m3109(this.f3932);
            this.f3923[iM31092] = j;
            this.f3944[iM31092] = j2;
            this.f3937[iM31092] = i2;
            this.f3931[iM31092] = i;
            this.f3936[iM31092] = c1688;
            this.f3940[iM31092] = this.f3928;
            if (!(((SparseArray) this.f3927.f5807).size() == 0)) {
                SparseArray sparseArray = (SparseArray) this.f3927.f5807;
                if (!((C0209) sparseArray.valueAt(sparseArray.size() - 1)).f1687.equals(this.f3946)) {
                    C5286 c5286 = this.f3946;
                    c5286.getClass();
                    InterfaceC4636 interfaceC4636 = this.f3945;
                    InterfaceC2766 interfaceC2766Mo5544 = interfaceC4636 != null ? interfaceC4636.mo5544(this.f3934, c5286) : InterfaceC2766.f10626;
                    C1404 c1404 = this.f3927;
                    int i4 = this.f3939 + this.f3932;
                    C0209 c0209 = new C0209(c5286, interfaceC2766Mo5544);
                    SparseArray sparseArray2 = (SparseArray) c1404.f5807;
                    if (c1404.f5808 == -1) {
                        ᵻᵪ.ˌᴵ(sparseArray2.size() == 0);
                        c1404.f5808 = 0;
                    }
                    if (sparseArray2.size() > 0) {
                        int iKeyAt = sparseArray2.keyAt(sparseArray2.size() - 1);
                        ᵻᵪ.ᵱᵽʡᵚ(i4 >= iKeyAt);
                        if (iKeyAt == i4) {
                            ((ᵷᵝˎ) c1404.f5809).accept(sparseArray2.valueAt(sparseArray2.size() - 1));
                        }
                    }
                    sparseArray2.append(i4, c0209);
                }
            }
            int i5 = this.f3932 + 1;
            this.f3932 = i5;
            int i6 = this.f3947;
            if (i5 == i6) {
                int i7 = i6 + 1000;
                long[] jArr = new long[i7];
                long[] jArr2 = new long[i7];
                long[] jArr3 = new long[i7];
                int[] iArr = new int[i7];
                int[] iArr2 = new int[i7];
                C1688[] c1688Arr = new C1688[i7];
                int i8 = this.f3920;
                int i9 = i6 - i8;
                System.arraycopy(this.f3944, i8, jArr2, 0, i9);
                System.arraycopy(this.f3923, this.f3920, jArr3, 0, i9);
                System.arraycopy(this.f3931, this.f3920, iArr, 0, i9);
                System.arraycopy(this.f3937, this.f3920, iArr2, 0, i9);
                System.arraycopy(this.f3936, this.f3920, c1688Arr, 0, i9);
                System.arraycopy(this.f3940, this.f3920, jArr, 0, i9);
                int i10 = this.f3920;
                System.arraycopy(this.f3944, 0, jArr2, i9, i10);
                System.arraycopy(this.f3923, 0, jArr3, i9, i10);
                System.arraycopy(this.f3931, 0, iArr, i9, i10);
                System.arraycopy(this.f3937, 0, iArr2, i9, i10);
                System.arraycopy(this.f3936, 0, c1688Arr, i9, i10);
                System.arraycopy(this.f3940, 0, jArr, i9, i10);
                this.f3944 = jArr2;
                this.f3923 = jArr3;
                this.f3931 = iArr;
                this.f3937 = iArr2;
                this.f3936 = c1688Arr;
                this.f3940 = jArr;
                this.f3920 = 0;
                this.f3947 = i7;
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:13:0x0026  */
    /* JADX WARN: Removed duplicated region for block: B:14:0x0028  */
    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final synchronized boolean m3101(boolean z, long j) throws Throwable {
        C0890 c0890;
        Throwable th;
        int iM3109;
        long j2;
        long jMin;
        int i;
        int i2;
        long j3;
        C0890 c08902;
        int iM3117;
        try {
            try {
                m3093();
                iM3109 = m3109(this.f3918);
                j2 = this.f3921;
                jMin = this.f3930;
            } catch (Throwable th2) {
                th = th2;
            }
        } catch (Throwable th3) {
            th = th3;
            c0890 = this;
        }
        if (j2 != Long.MIN_VALUE) {
            try {
                jMin = Math.min(jMin, j2);
                try {
                    i = this.f3918;
                    i2 = this.f3932;
                    if (!(i == i2) && j >= this.f3923[iM3109] && (j <= jMin || z)) {
                        if (this.f3915) {
                            int i3 = i2 - i;
                            c0890 = this;
                            j3 = j;
                            try {
                                iM3117 = c0890.m3111(iM3109, i3, j3, z);
                                c08902 = c0890;
                            } catch (Throwable th4) {
                                th = th4;
                                th = th;
                                throw th;
                            }
                        } else {
                            j3 = j;
                            int i4 = i2 - i;
                            c08902 = this;
                            iM3117 = c08902.m3117(iM3109, i4, j3, true);
                        }
                        if (iM3117 == -1) {
                            return false;
                        }
                        c08902.f3926 = j3;
                        c08902.f3918 += iM3117;
                        return true;
                    }
                } catch (Throwable th5) {
                    th = th5;
                    c0890 = this;
                }
            } catch (Throwable th6) {
                th = th6;
                c0890 = this;
            }
            th = th;
        } else {
            i = this.f3918;
            i2 = this.f3932;
            if (!(i == i2)) {
            }
        }
        throw th;
        return false;
    }

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public final long m3102(int i) {
        int i2 = this.f3939;
        int i3 = this.f3932;
        int i4 = (i2 + i3) - i;
        boolean z = false;
        ᵻᵪ.ᵱᵽʡᵚ(i4 >= 0 && i4 <= i3 - this.f3918);
        int i5 = this.f3932 - i4;
        this.f3932 = i5;
        this.f3930 = Math.max(this.f3924, m3099(i5));
        if (i4 == 0 && this.f3935) {
            z = true;
        }
        this.f3935 = z;
        int i6 = this.f3929;
        if (i6 != -1 && i < i6) {
            this.f3929 = -1;
        }
        C1404 c1404 = this.f3927;
        SparseArray sparseArray = (SparseArray) c1404.f5807;
        for (int size = sparseArray.size() - 1; size >= 0 && i < sparseArray.keyAt(size); size--) {
            ((ᵷᵝˎ) c1404.f5809).accept(sparseArray.valueAt(size));
            sparseArray.removeAt(size);
        }
        c1404.f5808 = sparseArray.size() > 0 ? Math.min(c1404.f5808, sparseArray.size() - 1) : -1;
        int i7 = this.f3932;
        if (i7 == 0) {
            return 0L;
        }
        int iM3109 = m3109(i7 - 1);
        return this.f3944[iM3109] + ((long) this.f3937[iM3109]);
    }

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final int m3103() {
        return this.f3939 + this.f3918;
    }

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public final void m3104() throws DrmSession$DrmSessionException {
        InterfaceC4417 interfaceC4417 = this.f3922;
        if (interfaceC4417 == null || interfaceC4417.mo4236() != 1) {
            return;
        }
        DrmSession$DrmSessionException drmSession$DrmSessionExceptionMo4238 = this.f3922.mo4238();
        drmSession$DrmSessionExceptionMo4238.getClass();
        throw drmSession$DrmSessionExceptionMo4238;
    }

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public final synchronized long m3105() {
        return Math.max(this.f3924, m3099(this.f3918));
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final int mo1739(InterfaceC0372 interfaceC0372, int i, boolean z) throws EOFException {
        C4730 c4730 = this.f3941;
        int iM9891 = c4730.m9891(i);
        C1889 c1889 = c4730.f17990;
        C1196 c1196 = (C1196) c1889.f7486;
        int i2 = interfaceC0372.read(c1196.f5091, ((int) (c4730.f17988 - c1889.f7485)) + c1196.f5090, iM9891);
        if (i2 == -1) {
            if (z) {
                return -1;
            }
            throw new EOFException();
        }
        long j = c4730.f17988 + ((long) i2);
        c4730.f17988 = j;
        C1889 c18892 = c4730.f17990;
        if (j == c18892.f7487) {
            c4730.f17990 = (C1889) c18892.f7488;
        }
        return i2;
    }

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public final synchronized long m3106() {
        try {
        } catch (Throwable th) {
            throw th;
        }
        return this.f3918 != this.f3932 ? this.f3940[m3109(this.f3918)] : this.f3928;
    }

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final synchronized int m3107(boolean z, long j) {
        try {
            try {
                int iM3109 = m3109(this.f3918);
                int i = this.f3918;
                int i2 = this.f3932;
                if (!(i != i2) || j < this.f3923[iM3109]) {
                    return 0;
                }
                if (j > this.f3930 && z) {
                    return i2 - i;
                }
                int iM3117 = m3117(iM3109, i2 - i, j, true);
                if (iM3117 == -1) {
                    return 0;
                }
                return iM3117;
            } catch (Throwable th) {
                th = th;
            }
        } catch (Throwable th2) {
            th = th2;
        }
        throw th;
    }

    /* JADX WARN: Removed duplicated region for block: B:9:0x000e  */
    /* JADX INFO: renamed from: ᵛˑﹳ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final synchronized void m3108(int i) {
        boolean z;
        if (i >= 0) {
            try {
                z = this.f3918 + i <= this.f3932;
            } catch (Throwable th) {
                throw th;
            }
        }
        ᵻᵪ.ᵱᵽʡᵚ(z);
        this.f3918 += i;
    }

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final int m3109(int i) {
        int i2 = this.f3920 + i;
        int i3 = this.f3947;
        return i2 < i3 ? i2 : i2 - i3;
    }

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final void m3110(long j) {
        if (this.f3932 == 0) {
            return;
        }
        ᵻᵪ.ᵱᵽʡᵚ(j > m3105());
        m3114(this.f3939 + m3122(j));
    }

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public final int m3111(int i, int i2, long j, boolean z) {
        for (int i3 = 0; i3 < i2; i3++) {
            if (this.f3923[i] >= j) {
                return i3;
            }
            i++;
            if (i == this.f3947) {
                i = 0;
            }
        }
        if (z) {
            return i2;
        }
        return -1;
    }

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public final void m3112() {
        m3096(true);
        InterfaceC4417 interfaceC4417 = this.f3922;
        if (interfaceC4417 != null) {
            interfaceC4417.mo4235(this.f3934);
            this.f3922 = null;
            this.f3942 = null;
        }
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵨᵣ */
    public final /* synthetic */ void mo1740(int i, C4545 c4545) {
        AbstractC2704.m6541(this, c4545, i);
    }

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public final synchronized C5286 m3113() {
        return this.f3943 ? null : this.f3946;
    }

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public final void m3114(int i) {
        C1889 c1889;
        C4730 c4730 = this.f3941;
        long jM3102 = m3102(i);
        int i2 = c4730.f17984;
        ᵻᵪ.ᵱᵽʡᵚ(jM3102 <= c4730.f17988);
        c4730.f17988 = jM3102;
        if (jM3102 != 0) {
            C1889 c18892 = c4730.f17989;
            if (jM3102 != c18892.f7485) {
                while (true) {
                    long j = c4730.f17988;
                    long j2 = c18892.f7487;
                    c1889 = (C1889) c18892.f7488;
                    if (j <= j2) {
                        break;
                    } else {
                        c18892 = c1889;
                    }
                }
                c1889.getClass();
                if (((C1196) c1889.f7486) != null) {
                    ᵣˊˈᵪ r7 = c4730.f17987;
                    synchronized (r7) {
                        ((C2577) r7.ᵨᵼⁱ).f9955.m5753(c1889);
                        C1889 c18893 = c1889;
                        while (c18893 != null) {
                            C1196 c1196 = (C1196) c18893.f7486;
                            c1196.getClass();
                            r7.ˊᵡᵗʨ(c1196);
                            c18893 = (C1889) c18893.f7488;
                            if (c18893 == null || ((C1196) c18893.f7486) == null) {
                                c18893 = null;
                            }
                        }
                    }
                    c1889.f7486 = null;
                    c1889.f7488 = null;
                }
                C1889 c18894 = new C1889(c18892.f7487, i2);
                c18892.f7488 = c18894;
                if (c4730.f17988 == c18892.f7487) {
                    c18892 = c18894;
                }
                c4730.f17990 = c18892;
                if (c4730.f17986 == c1889) {
                    c4730.f17986 = c18894;
                    return;
                }
                return;
            }
        }
        c4730.m9892(c4730.f17989);
        C1889 c18895 = new C1889(c4730.f17988, i2);
        c4730.f17989 = c18895;
        c4730.f17986 = c18895;
        c4730.f17990 = c18895;
    }

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final void m3115() {
        long jM3118;
        C4730 c4730 = this.f3941;
        synchronized (this) {
            int i = this.f3932;
            jM3118 = i == 0 ? -1L : m3118(i);
        }
        c4730.m9890(jM3118);
    }

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final synchronized boolean m3116() {
        return this.f3929 != -1;
    }

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public final int m3117(int i, int i2, long j, boolean z) {
        int i3 = -1;
        for (int i4 = 0; i4 < i2; i4++) {
            long j2 = this.f3923[i];
            if (j2 > j) {
                break;
            }
            if (!z || (this.f3931[i] & 1) != 0) {
                if (j2 == j) {
                    return i4;
                }
                i3 = i4;
            }
            i++;
            if (i == this.f3947) {
                i = 0;
            }
        }
        return i3;
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final long m3118(int i) {
        this.f3924 = Math.max(this.f3924, m3099(i));
        this.f3932 -= i;
        int i2 = this.f3939 + i;
        this.f3939 = i2;
        int i3 = this.f3920 + i;
        this.f3920 = i3;
        int i4 = this.f3947;
        if (i3 >= i4) {
            this.f3920 = i3 - i4;
        }
        int i5 = this.f3918 - i;
        this.f3918 = i5;
        int i6 = 0;
        if (i5 < 0) {
            this.f3918 = 0;
        }
        C1404 c1404 = this.f3927;
        SparseArray sparseArray = (SparseArray) c1404.f5807;
        while (i6 < sparseArray.size() - 1) {
            int i7 = i6 + 1;
            if (i2 < sparseArray.keyAt(i7)) {
                break;
            }
            ((ᵷᵝˎ) c1404.f5809).accept(sparseArray.valueAt(i6));
            sparseArray.removeAt(i6);
            int i8 = c1404.f5808;
            if (i8 > 0) {
                c1404.f5808 = i8 - 1;
            }
            i6 = i7;
        }
        if (this.f3932 != 0) {
            return this.f3944[this.f3920];
        }
        int i9 = this.f3920;
        if (i9 == 0) {
            i9 = this.f3947;
        }
        int i10 = i9 - 1;
        return this.f3944[i10] + ((long) this.f3937[i10]);
    }

    /* JADX WARN: Removed duplicated region for block: B:24:0x004b  */
    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void mo1741(long j, int i, int i2, int i3, C1688 c1688) {
        int i4;
        if (this.f3917) {
            C5286 c5286 = this.f3925;
            c5286.getClass();
            mo1742(c5286);
        }
        int i5 = i & 1;
        boolean z = i5 != 0;
        if (this.f3938) {
            if (!z) {
                return;
            } else {
                this.f3938 = false;
            }
        }
        long j2 = this.f3919 + j;
        if (!this.f3915) {
            i4 = i;
        } else {
            if (j2 < this.f3926) {
                return;
            }
            if (i5 == 0) {
                if (!this.f3933) {
                    ˋˀᵧ.ʿٴˇ("Overriding unexpected non-sync sample for format: " + this.f3946);
                    this.f3933 = true;
                }
                i4 = i | 1;
            }
        }
        if (this.f3916) {
            if (!z) {
                return;
            }
            synchronized (this) {
                if (this.f3932 == 0) {
                    z = j2 > this.f3924;
                } else if (m3105() >= j2) {
                    z = false;
                } else {
                    m3102(this.f3939 + m3122(j2));
                }
            }
            if (!z) {
                return;
            } else {
                this.f3916 = false;
            }
        }
        m3100(j2, i4, (this.f3941.f17988 - ((long) i2)) - ((long) i3), i2, c1688);
    }

    /* JADX WARN: Removed duplicated region for block: B:18:0x0059 A[Catch: all -> 0x0057, TryCatch #0 {all -> 0x0057, blocks: (B:4:0x000a, B:8:0x0016, B:13:0x0028, B:15:0x0041, B:19:0x005b, B:21:0x0069, B:25:0x0072, B:18:0x0059), top: B:35:0x000a }] */
    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵵᵽ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void mo1742(C5286 c5286) {
        C5286 c5286Mo3097 = mo3097(c5286);
        boolean z = false;
        this.f3917 = false;
        this.f3925 = c5286;
        synchronized (this) {
            try {
                this.f3943 = false;
                if (!Objects.equals(c5286Mo3097, this.f3946)) {
                    if (!(((SparseArray) this.f3927.f5807).size() == 0)) {
                        SparseArray sparseArray = (SparseArray) this.f3927.f5807;
                        if (((C0209) sparseArray.valueAt(sparseArray.size() - 1)).f1687.equals(c5286Mo3097)) {
                            SparseArray sparseArray2 = (SparseArray) this.f3927.f5807;
                            this.f3946 = ((C0209) sparseArray2.valueAt(sparseArray2.size() - 1)).f1687;
                        } else {
                            this.f3946 = c5286Mo3097;
                        }
                        boolean z2 = this.f3915;
                        C5286 c52862 = this.f3946;
                        String str = c52862.f19987;
                        this.f3915 = z2 & (AbstractC4208.m9141(str) == 1 && AbstractC4208.m9137(str, c52862.f19996));
                        this.f3933 = false;
                        z = true;
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        InterfaceC0766 interfaceC0766 = this.f3948;
        if (interfaceC0766 == null || !z) {
            return;
        }
        interfaceC0766.mo2755();
    }

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public final synchronized boolean m3119(boolean z) {
        C5286 c5286;
        int iM3103 = m3103();
        int i = this.f3929;
        boolean z2 = true;
        if (i != -1 && iM3103 >= i) {
            return true;
        }
        if (this.f3918 != this.f3932) {
            if (((C0209) this.f3927.m4043(iM3103)).f1687 != this.f3942) {
                return true;
            }
            return m3094(m3109(this.f3918));
        }
        if (!z && !this.f3935 && ((c5286 = this.f3946) == null || c5286 == this.f3942)) {
            z2 = false;
        }
        return z2;
    }

    /* JADX WARN: Removed duplicated region for block: B:9:0x0013  */
    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m3120(boolean z, long j) throws Throwable {
        C0890 c0890;
        Throwable th;
        long jM3118;
        C4730 c4730 = this.f3941;
        synchronized (this) {
            try {
                try {
                    int i = this.f3932;
                    jM3118 = -1;
                    if (i != 0) {
                        long[] jArr = this.f3923;
                        int i2 = this.f3920;
                        if (j >= jArr[i2]) {
                            if (z) {
                                try {
                                    int i3 = this.f3918;
                                    if (i3 != i) {
                                        i = i3 + 1;
                                    }
                                } catch (Throwable th2) {
                                    th = th2;
                                    c0890 = this;
                                    throw th;
                                }
                            }
                            int iM3117 = m3117(i2, i, j, false);
                            if (iM3117 != -1) {
                                jM3118 = m3118(iM3117);
                            }
                        }
                    }
                } catch (Throwable th3) {
                    th = th3;
                    th = th;
                    throw th;
                }
            } catch (Throwable th4) {
                th = th4;
                c0890 = this;
                th = th;
                throw th;
            }
        }
        c4730.m9890(jM3118);
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    public final /* synthetic */ void mo1743(long j) {
    }

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public final void m3121(C5286 c5286, ˊˊᵞᵽ r8) {
        C5286 c52862;
        C5286 c52863 = this.f3942;
        boolean z = c52863 == null;
        C5576 c5576 = c52863 == null ? null : c52863.f19965;
        this.f3942 = c5286;
        C5576 c55762 = c5286.f19965;
        InterfaceC4636 interfaceC4636 = this.f3945;
        if (interfaceC4636 != null) {
            int iMo5537 = interfaceC4636.mo5537(c5286);
            C4753 c4753M10878 = c5286.m10878();
            c4753M10878.f18106 = iMo5537;
            c52862 = new C5286(c4753M10878);
        } else {
            c52862 = c5286;
        }
        r8.ᵔᵖᵹᵫ = c52862;
        r8.ᵜᵪʾ = this.f3922;
        if (interfaceC4636 == null) {
            return;
        }
        if (z || !Objects.equals(c5576, c55762)) {
            InterfaceC4417 interfaceC4417 = this.f3922;
            C3317 c3317 = this.f3934;
            InterfaceC4417 interfaceC4417Mo5539 = interfaceC4636.mo5539(c3317, c5286);
            this.f3922 = interfaceC4417Mo5539;
            r8.ᵜᵪʾ = interfaceC4417Mo5539;
            if (interfaceC4417 != null) {
                interfaceC4417.mo4235(c3317);
            }
        }
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final int m3122(long j) {
        int i = this.f3932;
        int iM3109 = m3109(i - 1);
        while (i > this.f3918 && this.f3923[iM3109] >= j) {
            i--;
            iM3109--;
            if (iM3109 == -1) {
                iM3109 = this.f3947 - 1;
            }
        }
        return i;
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public final int mo1744(InterfaceC0372 interfaceC0372, int i, boolean z) {
        return mo1739(interfaceC0372, i, z);
    }
}
