package o0;

import android.view.inputmethod.EditorInfo;
import com.google.firebase.crashlytics.internal.metadata.UserMetadata;
import w2.r;
import w2.x;
import w2.y;

/* loaded from: classes.dex */
public abstract class z {
    private static final boolean a(int i10, int i11) {
        return (i10 & i11) == i11;
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x011f  */
    /* JADX WARN: Removed duplicated region for block: B:18:0x012e  */
    /* JADX WARN: Removed duplicated region for block: B:32:0x0185  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final void b(EditorInfo editorInfo, CharSequence charSequence, long j10, w2.s sVar, String[] strArr) {
        int e10 = sVar.e();
        r.a aVar = w2.r.f40806b;
        int i10 = 3;
        int i11 = 6;
        if (w2.r.m(e10, aVar.a())) {
            if (!sVar.h()) {
                i11 = 0;
            }
        } else if (w2.r.m(e10, aVar.e())) {
            i11 = 1;
        } else if (w2.r.m(e10, aVar.c())) {
            i11 = 2;
        } else if (w2.r.m(e10, aVar.d())) {
            i11 = 5;
        } else if (w2.r.m(e10, aVar.f())) {
            i11 = 7;
        } else if (w2.r.m(e10, aVar.g())) {
            i11 = 3;
        } else if (w2.r.m(e10, aVar.h())) {
            i11 = 4;
        } else if (!w2.r.m(e10, aVar.b())) {
            throw new IllegalStateException("invalid ImeAction".toString());
        }
        editorInfo.imeOptions = i11;
        sVar.g();
        s1.f30512a.a(editorInfo, sVar.d());
        int f10 = sVar.f();
        y.a aVar2 = w2.y.f40862b;
        if (!w2.y.n(f10, aVar2.h())) {
            if (!w2.y.n(f10, aVar2.a())) {
                if (w2.y.n(f10, aVar2.d())) {
                    i10 = 2;
                } else if (!w2.y.n(f10, aVar2.g())) {
                    if (w2.y.n(f10, aVar2.j())) {
                        i10 = 17;
                    } else if (w2.y.n(f10, aVar2.c())) {
                        i10 = 33;
                    } else if (w2.y.n(f10, aVar2.f())) {
                        i10 = 129;
                    } else if (w2.y.n(f10, aVar2.e())) {
                        i10 = 18;
                    } else {
                        if (!w2.y.n(f10, aVar2.b())) {
                            throw new IllegalStateException("Invalid Keyboard Type".toString());
                        }
                        i10 = 8194;
                    }
                }
                editorInfo.inputType = i10;
                if (!sVar.h() && a(editorInfo.inputType, 1)) {
                    editorInfo.inputType |= 131072;
                    if (w2.r.m(sVar.e(), aVar.a())) {
                        editorInfo.imeOptions |= 1073741824;
                    }
                }
                if (a(editorInfo.inputType, 1)) {
                    int c10 = sVar.c();
                    x.a aVar3 = w2.x.f40855b;
                    if (w2.x.i(c10, aVar3.a())) {
                        editorInfo.inputType |= 4096;
                    } else if (w2.x.i(c10, aVar3.e())) {
                        editorInfo.inputType |= UserMetadata.MAX_INTERNAL_KEY_SIZE;
                    } else if (w2.x.i(c10, aVar3.c())) {
                        editorInfo.inputType |= 16384;
                    }
                    if (sVar.b()) {
                        editorInfo.inputType |= 32768;
                    }
                }
                editorInfo.initialSelStart = q2.m0.n(j10);
                editorInfo.initialSelEnd = q2.m0.i(j10);
                w3.a.b(editorInfo, charSequence);
                if (strArr != null) {
                    w3.a.a(editorInfo, strArr);
                }
                editorInfo.imeOptions |= 33554432;
                if (m0.c.a() || w2.y.n(sVar.f(), aVar2.f()) || w2.y.n(sVar.f(), aVar2.e())) {
                    w3.a.c(editorInfo, false);
                } else {
                    w3.a.c(editorInfo, true);
                    y.f30526a.a(editorInfo);
                    return;
                }
            }
            editorInfo.imeOptions |= Integer.MIN_VALUE;
        }
        i10 = 1;
        editorInfo.inputType = i10;
        if (!sVar.h()) {
            editorInfo.inputType |= 131072;
            if (w2.r.m(sVar.e(), aVar.a())) {
            }
        }
        if (a(editorInfo.inputType, 1)) {
        }
        editorInfo.initialSelStart = q2.m0.n(j10);
        editorInfo.initialSelEnd = q2.m0.i(j10);
        w3.a.b(editorInfo, charSequence);
        if (strArr != null) {
        }
        editorInfo.imeOptions |= 33554432;
        if (m0.c.a()) {
        }
        w3.a.c(editorInfo, false);
    }

    public static /* synthetic */ void c(EditorInfo editorInfo, CharSequence charSequence, long j10, w2.s sVar, String[] strArr, int i10, Object obj) {
        if ((i10 & 8) != 0) {
            strArr = null;
        }
        b(editorInfo, charSequence, j10, sVar, strArr);
    }
}
