package o;

import android.text.Layout;
import java.io.Serializable;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.ke, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final /* synthetic */ class C1685ke implements OC {
    public final /* synthetic */ int l = 1;
    public final /* synthetic */ long m;
    public final /* synthetic */ Object n;

    /* renamed from: o, reason: collision with root package name */
    public final /* synthetic */ Serializable f615o;
    public final /* synthetic */ Object p;

    public /* synthetic */ C1685ke(long j, float[] fArr, C3058z10 c3058z10, C2963y10 c2963y10) {
        this.m = j;
        this.n = fArr;
        this.f615o = c3058z10;
        this.p = c2963y10;
    }

    @Override // o.OC
    public final Object g(Object obj) {
        float[] fArr;
        long j;
        J4 j4;
        int i;
        float fA;
        float fA2;
        switch (this.l) {
            case 0:
                T00 t00 = (T00) this.n;
                B10 b10 = (B10) this.f615o;
                long j2 = this.m;
                C0444Rd c0444Rd = (C0444Rd) this.p;
                C2610uK c2610uK = (C2610uK) obj;
                c2610uK.a();
                float f = t00.a;
                float f2 = t00.b;
                C3113zg c3113zg = c2610uK.l;
                ((OD) c3113zg.m.m).I(f, f2);
                try {
                    InterfaceC2095ot.I(c2610uK, (C2493t4) b10.l, j2, 0L, 0.0f, c0444Rd, 0, 890);
                    break;
                } finally {
                    ((OD) c3113zg.m.m).I(-f, -f2);
                }
            default:
                float[] fArr2 = (float[]) this.n;
                C3058z10 c3058z10 = (C3058z10) this.f615o;
                C2963y10 c2963y10 = (C2963y10) this.p;
                BV bv = (BV) obj;
                int i2 = bv.b;
                J4 j42 = bv.a;
                int iE = bv.c;
                long j3 = this.m;
                int iF = i2 > Ue0.f(j3) ? bv.b : Ue0.f(j3);
                if (iE >= Ue0.e(j3)) {
                    iE = Ue0.e(j3);
                }
                long jU = AbstractC2378rs0.u(bv.d(iF), bv.d(iE));
                int i3 = c3058z10.l;
                Le0 le0 = j42.d;
                int iF2 = Ue0.f(jU);
                int iE2 = Ue0.e(jU);
                Layout layout = le0.f;
                int length = layout.getText().length();
                if (iF2 < 0) {
                    AbstractC2228qH.a("startOffset must be > 0");
                }
                if (iF2 >= length) {
                    AbstractC2228qH.a("startOffset must be less than text length");
                }
                if (iE2 <= iF2) {
                    AbstractC2228qH.a("endOffset must be greater than startOffset");
                }
                if (iE2 > length) {
                    AbstractC2228qH.a("endOffset must be smaller or equal to text length");
                }
                if (fArr2.length - i3 < (iE2 - iF2) * 4) {
                    AbstractC2228qH.a("array.size - arrayStart must be greater or equal than (endOffset - startOffset) * 4");
                }
                int lineForOffset = layout.getLineForOffset(iF2);
                int lineForOffset2 = layout.getLineForOffset(iE2 - 1);
                C1561jF c1561jF = new C1561jF(le0);
                if (lineForOffset <= lineForOffset2) {
                    while (true) {
                        int lineStart = layout.getLineStart(lineForOffset);
                        fArr = fArr2;
                        int iF3 = le0.f(lineForOffset);
                        int iMax = Math.max(iF2, lineStart);
                        int iMin = Math.min(iE2, iF3);
                        float fG = le0.g(lineForOffset);
                        float fE = le0.e(lineForOffset);
                        j = jU;
                        j4 = j42;
                        boolean z = false;
                        boolean z2 = layout.getParagraphDirection(lineForOffset) == 1;
                        while (iMax < iMin) {
                            boolean zIsRtlCharAt = layout.isRtlCharAt(iMax);
                            if (!z2 || zIsRtlCharAt) {
                                if (z2 && zIsRtlCharAt) {
                                    z = false;
                                    float fA3 = c1561jF.a(iMax, false, false, false);
                                    i = iMin;
                                    fA = c1561jF.a(iMax + 1, true, true, false);
                                    fA2 = fA3;
                                } else {
                                    i = iMin;
                                    z = false;
                                    if (z2 || !zIsRtlCharAt) {
                                        fA = c1561jF.a(iMax, false, false, false);
                                        fA2 = c1561jF.a(iMax + 1, true, true, false);
                                    } else {
                                        fA2 = c1561jF.a(iMax, false, false, true);
                                        fA = c1561jF.a(iMax + 1, true, true, true);
                                    }
                                }
                                fArr[i3] = fA;
                                fArr[i3 + 1] = fG;
                                fArr[i3 + 2] = fA2;
                                fArr[i3 + 3] = fE;
                                i3 += 4;
                                iMax++;
                                iMin = i;
                            } else {
                                fA = c1561jF.a(iMax, z, z, true);
                                i = iMin;
                                fA2 = c1561jF.a(iMax + 1, true, true, true);
                            }
                            z = false;
                            fArr[i3] = fA;
                            fArr[i3 + 1] = fG;
                            fArr[i3 + 2] = fA2;
                            fArr[i3 + 3] = fE;
                            i3 += 4;
                            iMax++;
                            iMin = i;
                        }
                        if (lineForOffset != lineForOffset2) {
                            lineForOffset++;
                            j42 = j4;
                            fArr2 = fArr;
                            jU = j;
                        }
                    }
                } else {
                    fArr = fArr2;
                    j = jU;
                    j4 = j42;
                }
                int iD = (Ue0.d(j) * 4) + c3058z10.l;
                for (int i4 = c3058z10.l; i4 < iD; i4 += 4) {
                    int i5 = i4 + 1;
                    float f3 = fArr[i5];
                    float f4 = c2963y10.l;
                    fArr[i5] = f3 + f4;
                    int i6 = i4 + 3;
                    fArr[i6] = fArr[i6] + f4;
                }
                c3058z10.l = iD;
                c2963y10.l = j4.b() + c2963y10.l;
                break;
        }
        return Oh0.a;
    }

    public /* synthetic */ C1685ke(T00 t00, B10 b10, long j, C0444Rd c0444Rd) {
        this.n = t00;
        this.f615o = b10;
        this.m = j;
        this.p = c0444Rd;
    }
}
