package androidx.core.text;

import java.util.Locale;

/* loaded from: classes.dex */
public abstract class f {

    /* renamed from: a, reason: collision with root package name */
    public static final androidx.core.text.e f3792a = new e(null, false);

    /* renamed from: b, reason: collision with root package name */
    public static final androidx.core.text.e f3793b = new e(null, true);

    /* renamed from: c, reason: collision with root package name */
    public static final androidx.core.text.e f3794c;

    /* renamed from: d, reason: collision with root package name */
    public static final androidx.core.text.e f3795d;

    /* renamed from: e, reason: collision with root package name */
    public static final androidx.core.text.e f3796e;

    /* renamed from: f, reason: collision with root package name */
    public static final androidx.core.text.e f3797f;

    /* loaded from: classes.dex */
    private static class a implements c {

        /* renamed from: b, reason: collision with root package name */
        static final a f3798b = new a(true);

        /* renamed from: a, reason: collision with root package name */
        private final boolean f3799a;

        private a(boolean z10) {
            this.f3799a = z10;
        }

        @Override // androidx.core.text.f.c
        public int a(CharSequence charSequence, int i10, int i11) {
            int i12 = i11 + i10;
            boolean z10 = false;
            while (i10 < i12) {
                int a10 = f.a(Character.getDirectionality(charSequence.charAt(i10)));
                if (a10 != 0) {
                    if (a10 != 1) {
                        continue;
                        i10++;
                        z10 = z10;
                    } else if (!this.f3799a) {
                        return 1;
                    }
                } else if (this.f3799a) {
                    return 0;
                }
                z10 = true;
                i10++;
                z10 = z10;
            }
            if (z10) {
                return this.f3799a ? 1 : 0;
            }
            return 2;
        }
    }

    /* loaded from: classes.dex */
    private static class b implements c {

        /* renamed from: a, reason: collision with root package name */
        static final b f3800a = new b();

        private b() {
        }

        @Override // androidx.core.text.f.c
        public int a(CharSequence charSequence, int i10, int i11) {
            int i12 = i11 + i10;
            int i13 = 2;
            while (i10 < i12 && i13 == 2) {
                i13 = f.b(Character.getDirectionality(charSequence.charAt(i10)));
                i10++;
            }
            return i13;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes.dex */
    public interface c {
        int a(CharSequence charSequence, int i10, int i11);
    }

    /* loaded from: classes.dex */
    private static abstract class d implements androidx.core.text.e {

        /* renamed from: a, reason: collision with root package name */
        private final c f3801a;

        d(c cVar) {
            this.f3801a = cVar;
        }

        private boolean c(CharSequence charSequence, int i10, int i11) {
            int a10 = this.f3801a.a(charSequence, i10, i11);
            if (a10 == 0) {
                return true;
            }
            if (a10 != 1) {
                return b();
            }
            return false;
        }

        @Override // androidx.core.text.e
        public boolean a(CharSequence charSequence, int i10, int i11) {
            if (charSequence == null || i10 < 0 || i11 < 0 || charSequence.length() - i11 < i10) {
                throw new IllegalArgumentException();
            }
            return this.f3801a == null ? b() : c(charSequence, i10, i11);
        }

        protected abstract boolean b();
    }

    /* loaded from: classes.dex */
    private static class e extends d {

        /* renamed from: b, reason: collision with root package name */
        private final boolean f3802b;

        e(c cVar, boolean z10) {
            super(cVar);
            this.f3802b = z10;
        }

        @Override // androidx.core.text.f.d
        protected boolean b() {
            return this.f3802b;
        }
    }

    /* renamed from: androidx.core.text.f$f, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    private static class C0099f extends d {

        /* renamed from: b, reason: collision with root package name */
        static final C0099f f3803b = new C0099f();

        C0099f() {
            super(null);
        }

        @Override // androidx.core.text.f.d
        protected boolean b() {
            return g.a(Locale.getDefault()) == 1;
        }
    }

    static {
        b bVar = b.f3800a;
        f3794c = new e(bVar, false);
        f3795d = new e(bVar, true);
        f3796e = new e(a.f3798b, false);
        f3797f = C0099f.f3803b;
    }

    static int a(int i10) {
        if (i10 != 0) {
            return (i10 == 1 || i10 == 2) ? 0 : 2;
        }
        return 1;
    }

    static int b(int i10) {
        if (i10 != 0) {
            if (i10 == 1 || i10 == 2) {
                return 0;
            }
            switch (i10) {
                case 14:
                case 15:
                    break;
                case 16:
                case 17:
                    return 0;
                default:
                    return 2;
            }
        }
        return 1;
    }
}
