package j.u0;

import j.b0;
import j.e0;
import j.j0;
import j.x;
import j.z;
import jxl.SheetSettings;
import okhttp3.internal.http2.Settings;

/* JADX INFO: compiled from: UStrings.kt */
/* JADX INFO: loaded from: classes.dex */
public final class u {
    public static final byte a(String str) {
        j.p0.d.r.f(str, "<this>");
        x xVarB = b(str);
        if (xVarB != null) {
            return xVarB.f();
        }
        p.j(str);
        throw null;
    }

    public static final x b(String str) {
        j.p0.d.r.f(str, "<this>");
        return c(str, 10);
    }

    public static final x c(String str, int i2) {
        j.p0.d.r.f(str, "<this>");
        z zVarF = f(str, i2);
        if (zVarF == null) {
            return null;
        }
        int iF = zVarF.f();
        z.b(SheetSettings.DEFAULT_DEFAULT_ROW_HEIGHT);
        if (j0.a(iF, SheetSettings.DEFAULT_DEFAULT_ROW_HEIGHT) > 0) {
            return null;
        }
        byte b = (byte) iF;
        x.b(b);
        return x.a(b);
    }

    public static final int d(String str) {
        j.p0.d.r.f(str, "<this>");
        z zVarE = e(str);
        if (zVarE != null) {
            return zVarE.f();
        }
        p.j(str);
        throw null;
    }

    public static final z e(String str) {
        j.p0.d.r.f(str, "<this>");
        return f(str, 10);
    }

    public static final z f(String str, int i2) {
        j.p0.d.r.f(str, "<this>");
        a.a(i2);
        int length = str.length();
        if (length == 0) {
            return null;
        }
        int i3 = 0;
        char cCharAt = str.charAt(0);
        int i4 = 1;
        if (j.p0.d.r.h(cCharAt, 48) >= 0) {
            i4 = 0;
        } else if (length == 1 || cCharAt != '+') {
            return null;
        }
        z.b(i2);
        int iB = 119304647;
        while (i4 < length) {
            int iB2 = b.b(str.charAt(i4), i2);
            if (iB2 < 0) {
                return null;
            }
            if (j0.a(i3, iB) > 0) {
                if (iB == 119304647) {
                    iB = j0.b(-1, i2);
                    if (j0.a(i3, iB) > 0) {
                    }
                }
                return null;
            }
            int i5 = i3 * i2;
            z.b(i5);
            z.b(iB2);
            int i6 = iB2 + i5;
            z.b(i6);
            if (j0.a(i6, i5) < 0) {
                return null;
            }
            i4++;
            i3 = i6;
        }
        return z.a(i3);
    }

    public static final long g(String str) {
        j.p0.d.r.f(str, "<this>");
        b0 b0VarH = h(str);
        if (b0VarH != null) {
            return b0VarH.f();
        }
        p.j(str);
        throw null;
    }

    public static final b0 h(String str) {
        j.p0.d.r.f(str, "<this>");
        return i(str, 10);
    }

    public static final b0 i(String str, int i2) {
        j.p0.d.r.f(str, "<this>");
        a.a(i2);
        int length = str.length();
        if (length == 0) {
            return null;
        }
        long j2 = -1;
        int i3 = 0;
        char cCharAt = str.charAt(0);
        if (j.p0.d.r.h(cCharAt, 48) < 0) {
            if (length == 1 || cCharAt != '+') {
                return null;
            }
            i3 = 1;
        }
        long j3 = i2;
        b0.b(j3);
        long j4 = 0;
        long jD = 512409557603043100L;
        while (i3 < length) {
            int iB = b.b(str.charAt(i3), i2);
            if (iB < 0) {
                return null;
            }
            if (j0.c(j4, jD) > 0) {
                if (jD == 512409557603043100L) {
                    jD = j0.d(j2, j3);
                    if (j0.c(j4, jD) > 0) {
                    }
                }
                return null;
            }
            long j5 = j4 * j3;
            b0.b(j5);
            z.b(iB);
            long j6 = ((long) iB) & 4294967295L;
            b0.b(j6);
            long j7 = j6 + j5;
            b0.b(j7);
            if (j0.c(j7, j5) < 0) {
                return null;
            }
            i3++;
            j4 = j7;
            j2 = -1;
        }
        return b0.a(j4);
    }

    public static final short j(String str) {
        j.p0.d.r.f(str, "<this>");
        e0 e0VarK = k(str);
        if (e0VarK != null) {
            return e0VarK.f();
        }
        p.j(str);
        throw null;
    }

    public static final e0 k(String str) {
        j.p0.d.r.f(str, "<this>");
        return l(str, 10);
    }

    public static final e0 l(String str, int i2) {
        j.p0.d.r.f(str, "<this>");
        z zVarF = f(str, i2);
        if (zVarF == null) {
            return null;
        }
        int iF = zVarF.f();
        z.b(Settings.DEFAULT_INITIAL_WINDOW_SIZE);
        if (j0.a(iF, Settings.DEFAULT_INITIAL_WINDOW_SIZE) > 0) {
            return null;
        }
        short s = (short) iF;
        e0.b(s);
        return e0.a(s);
    }
}
