package L1;

import java.util.concurrent.atomic.AtomicLong;
import r4.AbstractC0983h;
import w1.C1091a;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class T implements P1.d {

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ int f1556k;

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

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public Object f1558m;

    public /* synthetic */ T(B2.a aVar, long j5) {
        this.f1556k = 0;
        this.f1558m = aVar;
        this.f1557l = j5;
    }

    public void a(int i) {
        if (i < 64) {
            this.f1557l &= ~(1 << i);
            return;
        }
        T t4 = (T) this.f1558m;
        if (t4 != null) {
            t4.a(i - 64);
        }
    }

    public int b(int i) {
        T t4 = (T) this.f1558m;
        if (t4 == null) {
            return i >= 64 ? Long.bitCount(this.f1557l) : Long.bitCount(this.f1557l & ((1 << i) - 1));
        }
        if (i < 64) {
            return Long.bitCount(this.f1557l & ((1 << i) - 1));
        }
        return Long.bitCount(this.f1557l) + t4.b(i - 64);
    }

    public void c() {
        if (((T) this.f1558m) == null) {
            this.f1558m = new T();
        }
    }

    public boolean d(int i) {
        if (i < 64) {
            return (this.f1557l & (1 << i)) != 0;
        }
        c();
        return ((T) this.f1558m).d(i - 64);
    }

    public void e(int i, boolean z5) {
        if (i >= 64) {
            c();
            ((T) this.f1558m).e(i - 64, z5);
            return;
        }
        long j5 = this.f1557l;
        boolean z6 = (Long.MIN_VALUE & j5) != 0;
        long j6 = (1 << i) - 1;
        this.f1557l = ((j5 & (~j6)) << 1) | (j5 & j6);
        if (z5) {
            j(i);
        } else {
            a(i);
        }
        if (z6 || ((T) this.f1558m) != null) {
            c();
            ((T) this.f1558m).e(0, z6);
        }
    }

    public K4.m f() {
        K4.l lVar = new K4.l(0);
        while (true) {
            String strN = ((X4.o) this.f1558m).n(this.f1557l);
            this.f1557l -= (long) strN.length();
            if (strN.length() == 0) {
                return lVar.b();
            }
            int iM = A4.i.M(strN, ':', 1, 4);
            if (iM != -1) {
                String strSubstring = strN.substring(0, iM);
                AbstractC0983h.d("this as java.lang.String…ing(startIndex, endIndex)", strSubstring);
                String strSubstring2 = strN.substring(iM + 1);
                AbstractC0983h.d("this as java.lang.String).substring(startIndex)", strSubstring2);
                lVar.a(strSubstring, strSubstring2);
            } else if (strN.charAt(0) == ':') {
                String strSubstring3 = strN.substring(1);
                AbstractC0983h.d("this as java.lang.String).substring(startIndex)", strSubstring3);
                lVar.a("", strSubstring3);
            } else {
                lVar.a("", strN);
            }
        }
    }

    public boolean g(int i) {
        if (i >= 64) {
            c();
            return ((T) this.f1558m).g(i - 64);
        }
        long j5 = 1 << i;
        long j6 = this.f1557l;
        boolean z5 = (j6 & j5) != 0;
        long j7 = j6 & (~j5);
        this.f1557l = j7;
        long j8 = j5 - 1;
        this.f1557l = (j7 & j8) | Long.rotateRight((~j8) & j7, 1);
        T t4 = (T) this.f1558m;
        if (t4 != null) {
            if (t4.d(0)) {
                j(63);
            }
            ((T) this.f1558m).g(0);
        }
        return z5;
    }

    @Override // P1.d
    public /* synthetic */ void h(Exception exc) {
        ((AtomicLong) ((B2.a) this.f1558m).f134l).set(this.f1557l);
    }

    public void i() {
        this.f1557l = 0L;
        T t4 = (T) this.f1558m;
        if (t4 != null) {
            t4.i();
        }
    }

    public void j(int i) {
        if (i < 64) {
            this.f1557l |= 1 << i;
        } else {
            c();
            ((T) this.f1558m).j(i - 64);
        }
    }

    public String toString() {
        switch (this.f1556k) {
            case 3:
                if (((T) this.f1558m) == null) {
                    return Long.toBinaryString(this.f1557l);
                }
                return ((T) this.f1558m).toString() + "xx" + Long.toBinaryString(this.f1557l);
            default:
                return super.toString();
        }
    }

    public T(C1091a c1091a) {
        this.f1556k = 1;
        s1.z.g(c1091a);
        this.f1558m = c1091a;
    }

    public T(X4.o oVar) {
        this.f1556k = 2;
        AbstractC0983h.e("source", oVar);
        this.f1558m = oVar;
        this.f1557l = 262144L;
    }

    public T() {
        this.f1556k = 3;
        this.f1557l = 0L;
    }
}
