package J0;

import f1.EnumC2022j;
import o0.C2632c;

/* JADX INFO: renamed from: J0.e, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0354e extends AbstractC0345b {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static C0354e f3004e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final EnumC2022j f3005f = EnumC2022j.f16383b;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final EnumC2022j f3006g = EnumC2022j.f16382a;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public T0.L f3007c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Q0.s f3008d;

    @Override // J0.AbstractC0345b
    public final int[] c(int i6) {
        int iE;
        if (e().length() <= 0 || i6 >= e().length()) {
            return null;
        }
        try {
            Q0.s sVar = this.f3008d;
            if (sVar == null) {
                kotlin.jvm.internal.o.n("node");
                throw null;
            }
            C2632c c2632cG = sVar.g();
            int iRound = Math.round(c2632cG.f21790d - c2632cG.f21788b);
            if (i6 <= 0) {
                i6 = 0;
            }
            T0.L l = this.f3007c;
            if (l == null) {
                kotlin.jvm.internal.o.n("layoutResult");
                throw null;
            }
            int iD = l.f6472b.d(i6);
            T0.L l6 = this.f3007c;
            if (l6 == null) {
                kotlin.jvm.internal.o.n("layoutResult");
                throw null;
            }
            float f6 = l6.f6472b.f(iD) + iRound;
            T0.L l7 = this.f3007c;
            if (l7 == null) {
                kotlin.jvm.internal.o.n("layoutResult");
                throw null;
            }
            if (l7 == null) {
                kotlin.jvm.internal.o.n("layoutResult");
                throw null;
            }
            if (f6 < l7.f6472b.f(r0.f6537f - 1)) {
                T0.L l8 = this.f3007c;
                if (l8 == null) {
                    kotlin.jvm.internal.o.n("layoutResult");
                    throw null;
                }
                iE = l8.f6472b.e(f6);
            } else {
                T0.L l9 = this.f3007c;
                if (l9 == null) {
                    kotlin.jvm.internal.o.n("layoutResult");
                    throw null;
                }
                iE = l9.f6472b.f6537f;
            }
            return d(i6, i(iE - 1, f3006g) + 1);
        } catch (IllegalStateException unused) {
            return null;
        }
    }

    @Override // J0.AbstractC0345b
    public final int[] h(int i6) {
        int iE;
        if (e().length() <= 0 || i6 <= 0) {
            return null;
        }
        try {
            Q0.s sVar = this.f3008d;
            if (sVar == null) {
                kotlin.jvm.internal.o.n("node");
                throw null;
            }
            C2632c c2632cG = sVar.g();
            int iRound = Math.round(c2632cG.f21790d - c2632cG.f21788b);
            int length = e().length();
            if (length <= i6) {
                i6 = length;
            }
            T0.L l = this.f3007c;
            if (l == null) {
                kotlin.jvm.internal.o.n("layoutResult");
                throw null;
            }
            int iD = l.f6472b.d(i6);
            T0.L l6 = this.f3007c;
            if (l6 == null) {
                kotlin.jvm.internal.o.n("layoutResult");
                throw null;
            }
            float f6 = l6.f6472b.f(iD) - iRound;
            if (f6 > 0.0f) {
                T0.L l7 = this.f3007c;
                if (l7 == null) {
                    kotlin.jvm.internal.o.n("layoutResult");
                    throw null;
                }
                iE = l7.f6472b.e(f6);
            } else {
                iE = 0;
            }
            if (i6 == e().length() && iE < iD) {
                iE++;
            }
            return d(i(iE, f3005f), i6);
        } catch (IllegalStateException unused) {
            return null;
        }
    }

    public final int i(int i6, EnumC2022j enumC2022j) {
        T0.L l = this.f3007c;
        if (l == null) {
            kotlin.jvm.internal.o.n("layoutResult");
            throw null;
        }
        int iF = l.f(i6);
        T0.L l6 = this.f3007c;
        if (l6 == null) {
            kotlin.jvm.internal.o.n("layoutResult");
            throw null;
        }
        if (enumC2022j != l6.g(iF)) {
            T0.L l7 = this.f3007c;
            if (l7 != null) {
                return l7.f(i6);
            }
            kotlin.jvm.internal.o.n("layoutResult");
            throw null;
        }
        if (this.f3007c != null) {
            return r6.f6472b.c(i6, false) - 1;
        }
        kotlin.jvm.internal.o.n("layoutResult");
        throw null;
    }
}
