package g1;

import android.text.InputFilter;
import android.text.Spanned;
import android.widget.TextView;
import androidx.emoji2.text.t;

/* JADX INFO: loaded from: classes.dex */
public final class g implements InputFilter {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final TextView f26140a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public f f26141b;

    public g(TextView textView) {
        this.f26140a = textView;
    }

    @Override // android.text.InputFilter
    public final CharSequence filter(CharSequence charSequence, int i10, int i11, Spanned spanned, int i12, int i13) {
        TextView textView = this.f26140a;
        if (textView.isInEditMode()) {
            return charSequence;
        }
        int iB = t.a().b();
        if (iB != 0) {
            if (iB == 1) {
                if ((i13 == 0 && i12 == 0 && spanned.length() == 0 && charSequence == textView.getText()) || charSequence == null) {
                    return charSequence;
                }
                if (i10 != 0 || i11 != charSequence.length()) {
                    charSequence = charSequence.subSequence(i10, i11);
                }
                return t.a().process(charSequence, 0, charSequence.length());
            }
            if (iB != 3) {
                return charSequence;
            }
        }
        t tVarA = t.a();
        if (this.f26141b == null) {
            this.f26141b = new f(textView, this);
        }
        tVarA.g(this.f26141b);
        return charSequence;
    }
}
