package p461;

import kotlin.jvm.internal.DefaultConstructorMarker;
import p402.InterfaceC6540;
import p402.p403.C6560;
import p402.p411.p413.C6635;

/* JADX INFO: renamed from: ޑ.ސ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
@InterfaceC6540
public final class C7123 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final byte[] f20665;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int f20666;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public int f20667;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public boolean f20668;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public boolean f20669;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public C7123 f20670;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public C7123 f20671;

    /* JADX INFO: renamed from: ޑ.ސ$֏, reason: contains not printable characters */
    public static final class C7124 {
        public C7124() {
        }

        public /* synthetic */ C7124(DefaultConstructorMarker defaultConstructorMarker) {
        }
    }

    static {
        new C7124(null);
    }

    public C7123() {
        this.f20665 = new byte[8192];
        this.f20669 = true;
        this.f20668 = false;
    }

    public C7123(byte[] bArr, int i, int i2, boolean z, boolean z2) {
        if (bArr == null) {
            C6635.m9824("data");
            throw null;
        }
        this.f20665 = bArr;
        this.f20666 = i;
        this.f20667 = i2;
        this.f20668 = z;
        this.f20669 = z2;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final C7123 m10475() {
        C7123 c7123 = this.f20670;
        if (c7123 == this) {
            c7123 = null;
        }
        C7123 c71232 = this.f20671;
        if (c71232 == null) {
            C6635.m9822();
            throw null;
        }
        c71232.f20670 = this.f20670;
        C7123 c71233 = this.f20670;
        if (c71233 == null) {
            C6635.m9822();
            throw null;
        }
        c71233.f20671 = c71232;
        this.f20670 = null;
        this.f20671 = null;
        return c7123;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final C7123 m10476(C7123 c7123) {
        if (c7123 == null) {
            C6635.m9824("segment");
            throw null;
        }
        c7123.f20671 = this;
        c7123.f20670 = this.f20670;
        C7123 c71232 = this.f20670;
        if (c71232 == null) {
            C6635.m9822();
            throw null;
        }
        c71232.f20671 = c7123;
        this.f20670 = c7123;
        return c7123;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m10477(C7123 c7123, int i) {
        if (c7123 == null) {
            C6635.m9824("sink");
            throw null;
        }
        if (!c7123.f20669) {
            throw new IllegalStateException("only owner can write".toString());
        }
        int i2 = c7123.f20667;
        if (i2 + i > 8192) {
            if (c7123.f20668) {
                throw new IllegalArgumentException();
            }
            int i3 = c7123.f20666;
            if ((i2 + i) - i3 > 8192) {
                throw new IllegalArgumentException();
            }
            byte[] bArr = c7123.f20665;
            C6560.m9790(bArr, bArr, 0, i3, i2, 2);
            c7123.f20667 -= c7123.f20666;
            c7123.f20666 = 0;
        }
        byte[] bArr2 = this.f20665;
        byte[] bArr3 = c7123.f20665;
        int i4 = c7123.f20667;
        int i5 = this.f20666;
        C6560.m9789(bArr2, bArr3, i4, i5, i5 + i);
        c7123.f20667 += i;
        this.f20666 += i;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final C7123 m10478() {
        this.f20668 = true;
        return new C7123(this.f20665, this.f20666, this.f20667, true, false);
    }
}
