package com.google.android.material.textfield;

import A3.a;
import K.h;
import M.D;
import M.J;
import N1.C0222x;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcelable;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.PasswordTransformationMethod;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStructure;
import android.view.animation.LinearInterpolator;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import c6.C0587c;
import com.google.android.material.datepicker.c;
import com.google.android.material.internal.CheckableImageButton;
import com.martsnew.tv.R;
import d5.AbstractC0844a;
import h3.AbstractC1031a;
import i3.AbstractC1051a;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Locale;
import l6.C1139a;
import n.C1190H;
import n.C1228p;
import n.S;
import n4.u0;
import s3.b;
import s7.d;
import u3.C1596a;
import u3.C1599d;
import x3.C1713a;
import x3.g;
import x3.j;
import x3.k;
import z3.C1792a;
import z3.e;
import z3.f;
import z3.l;
import z3.m;
import z3.o;
import z3.p;
import z3.q;
import z3.r;
import z3.s;

/* JADX INFO: loaded from: classes.dex */
public class TextInputLayout extends LinearLayout {

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public int f10306A;

    /* JADX INFO: renamed from: A0, reason: collision with root package name */
    public boolean f10307A0;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public boolean f10308B;

    /* JADX INFO: renamed from: B0, reason: collision with root package name */
    public PorterDuff.Mode f10309B0;

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public C1190H f10310C;

    /* JADX INFO: renamed from: C0, reason: collision with root package name */
    public boolean f10311C0;
    public int D;

    /* JADX INFO: renamed from: D0, reason: collision with root package name */
    public ColorDrawable f10312D0;

    /* JADX INFO: renamed from: E, reason: collision with root package name */
    public int f10313E;

    /* JADX INFO: renamed from: E0, reason: collision with root package name */
    public int f10314E0;

    /* JADX INFO: renamed from: F, reason: collision with root package name */
    public CharSequence f10315F;

    /* JADX INFO: renamed from: F0, reason: collision with root package name */
    public Drawable f10316F0;

    /* JADX INFO: renamed from: G, reason: collision with root package name */
    public boolean f10317G;

    /* JADX INFO: renamed from: G0, reason: collision with root package name */
    public View.OnLongClickListener f10318G0;
    public C1190H H;

    /* JADX INFO: renamed from: H0, reason: collision with root package name */
    public View.OnLongClickListener f10319H0;

    /* JADX INFO: renamed from: I, reason: collision with root package name */
    public ColorStateList f10320I;

    /* JADX INFO: renamed from: I0, reason: collision with root package name */
    public final CheckableImageButton f10321I0;

    /* JADX INFO: renamed from: J, reason: collision with root package name */
    public int f10322J;

    /* JADX INFO: renamed from: J0, reason: collision with root package name */
    public ColorStateList f10323J0;

    /* JADX INFO: renamed from: K, reason: collision with root package name */
    public ColorStateList f10324K;
    public ColorStateList K0;

    /* JADX INFO: renamed from: L, reason: collision with root package name */
    public ColorStateList f10325L;

    /* JADX INFO: renamed from: L0, reason: collision with root package name */
    public ColorStateList f10326L0;

    /* JADX INFO: renamed from: M, reason: collision with root package name */
    public CharSequence f10327M;

    /* JADX INFO: renamed from: M0, reason: collision with root package name */
    public int f10328M0;

    /* JADX INFO: renamed from: N, reason: collision with root package name */
    public final C1190H f10329N;

    /* JADX INFO: renamed from: N0, reason: collision with root package name */
    public int f10330N0;

    /* JADX INFO: renamed from: O, reason: collision with root package name */
    public CharSequence f10331O;

    /* JADX INFO: renamed from: O0, reason: collision with root package name */
    public int f10332O0;

    /* JADX INFO: renamed from: P, reason: collision with root package name */
    public final C1190H f10333P;

    /* JADX INFO: renamed from: P0, reason: collision with root package name */
    public ColorStateList f10334P0;

    /* JADX INFO: renamed from: Q, reason: collision with root package name */
    public boolean f10335Q;

    /* JADX INFO: renamed from: Q0, reason: collision with root package name */
    public int f10336Q0;

    /* JADX INFO: renamed from: R, reason: collision with root package name */
    public CharSequence f10337R;

    /* JADX INFO: renamed from: R0, reason: collision with root package name */
    public int f10338R0;

    /* JADX INFO: renamed from: S, reason: collision with root package name */
    public boolean f10339S;

    /* JADX INFO: renamed from: S0, reason: collision with root package name */
    public int f10340S0;

    /* JADX INFO: renamed from: T, reason: collision with root package name */
    public g f10341T;

    /* JADX INFO: renamed from: T0, reason: collision with root package name */
    public int f10342T0;

    /* JADX INFO: renamed from: U, reason: collision with root package name */
    public g f10343U;

    /* JADX INFO: renamed from: U0, reason: collision with root package name */
    public int f10344U0;

    /* JADX INFO: renamed from: V, reason: collision with root package name */
    public final k f10345V;

    /* JADX INFO: renamed from: V0, reason: collision with root package name */
    public boolean f10346V0;

    /* JADX INFO: renamed from: W, reason: collision with root package name */
    public final int f10347W;
    public final b W0;

    /* JADX INFO: renamed from: X0, reason: collision with root package name */
    public boolean f10348X0;

    /* JADX INFO: renamed from: Y0, reason: collision with root package name */
    public boolean f10349Y0;

    /* JADX INFO: renamed from: Z0, reason: collision with root package name */
    public ValueAnimator f10350Z0;

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    public int f10351a0;
    public boolean a1;

    /* JADX INFO: renamed from: b0, reason: collision with root package name */
    public int f10352b0;

    /* JADX INFO: renamed from: b1, reason: collision with root package name */
    public boolean f10353b1;

    /* JADX INFO: renamed from: c0, reason: collision with root package name */
    public int f10354c0;

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    public int f10355d0;

    /* JADX INFO: renamed from: e0, reason: collision with root package name */
    public int f10356e0;

    /* JADX INFO: renamed from: f0, reason: collision with root package name */
    public int f10357f0;

    /* JADX INFO: renamed from: g0, reason: collision with root package name */
    public int f10358g0;

    /* JADX INFO: renamed from: h0, reason: collision with root package name */
    public int f10359h0;

    /* JADX INFO: renamed from: i0, reason: collision with root package name */
    public final Rect f10360i0;

    /* JADX INFO: renamed from: j0, reason: collision with root package name */
    public final Rect f10361j0;

    /* JADX INFO: renamed from: k0, reason: collision with root package name */
    public final RectF f10362k0;

    /* JADX INFO: renamed from: l0, reason: collision with root package name */
    public Typeface f10363l0;

    /* JADX INFO: renamed from: m0, reason: collision with root package name */
    public final CheckableImageButton f10364m0;

    /* JADX INFO: renamed from: n0, reason: collision with root package name */
    public ColorStateList f10365n0;

    /* JADX INFO: renamed from: o0, reason: collision with root package name */
    public boolean f10366o0;

    /* JADX INFO: renamed from: p0, reason: collision with root package name */
    public PorterDuff.Mode f10367p0;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final FrameLayout f10368q;
    public boolean q0;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final LinearLayout f10369r;

    /* JADX INFO: renamed from: r0, reason: collision with root package name */
    public ColorDrawable f10370r0;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final LinearLayout f10371s;

    /* JADX INFO: renamed from: s0, reason: collision with root package name */
    public int f10372s0;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final FrameLayout f10373t;

    /* JADX INFO: renamed from: t0, reason: collision with root package name */
    public View.OnLongClickListener f10374t0;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public EditText f10375u;

    /* JADX INFO: renamed from: u0, reason: collision with root package name */
    public final LinkedHashSet f10376u0;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public CharSequence f10377v;

    /* JADX INFO: renamed from: v0, reason: collision with root package name */
    public int f10378v0;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public int f10379w;

    /* JADX INFO: renamed from: w0, reason: collision with root package name */
    public final SparseArray f10380w0;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public int f10381x;

    /* JADX INFO: renamed from: x0, reason: collision with root package name */
    public final CheckableImageButton f10382x0;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final o f10383y;

    /* JADX INFO: renamed from: y0, reason: collision with root package name */
    public final LinkedHashSet f10384y0;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public boolean f10385z;

    /* JADX INFO: renamed from: z0, reason: collision with root package name */
    public ColorStateList f10386z0;

    /* JADX WARN: Removed duplicated region for block: B:98:0x0516  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public TextInputLayout(Context context, AttributeSet attributeSet) {
        float f3;
        AttributeSet attributeSet2;
        super(a.a(context, attributeSet, R.attr.textInputStyle, R.style.Widget_Design_TextInputLayout), attributeSet, R.attr.textInputStyle);
        this.f10379w = -1;
        this.f10381x = -1;
        this.f10383y = new o(this);
        this.f10360i0 = new Rect();
        this.f10361j0 = new Rect();
        this.f10362k0 = new RectF();
        this.f10376u0 = new LinkedHashSet();
        this.f10378v0 = 0;
        SparseArray sparseArray = new SparseArray();
        this.f10380w0 = sparseArray;
        this.f10384y0 = new LinkedHashSet();
        b bVar = new b(this);
        this.W0 = bVar;
        Context context2 = getContext();
        setOrientation(1);
        setWillNotDraw(false);
        setAddStatesFromChildren(true);
        FrameLayout frameLayout = new FrameLayout(context2);
        this.f10368q = frameLayout;
        frameLayout.setAddStatesFromChildren(true);
        addView(frameLayout);
        LinearLayout linearLayout = new LinearLayout(context2);
        this.f10369r = linearLayout;
        linearLayout.setOrientation(0);
        linearLayout.setLayoutParams(new FrameLayout.LayoutParams(-2, -1, 8388611));
        frameLayout.addView(linearLayout);
        LinearLayout linearLayout2 = new LinearLayout(context2);
        this.f10371s = linearLayout2;
        linearLayout2.setOrientation(0);
        linearLayout2.setLayoutParams(new FrameLayout.LayoutParams(-2, -1, 8388613));
        frameLayout.addView(linearLayout2);
        FrameLayout frameLayout2 = new FrameLayout(context2);
        this.f10373t = frameLayout2;
        frameLayout2.setLayoutParams(new FrameLayout.LayoutParams(-2, -1));
        LinearInterpolator linearInterpolator = AbstractC1051a.f13505a;
        bVar.H = linearInterpolator;
        bVar.g();
        bVar.f16796G = linearInterpolator;
        bVar.g();
        if (bVar.f16811h != 8388659) {
            bVar.f16811h = 8388659;
            bVar.g();
        }
        int[] iArr = AbstractC1031a.f13419z;
        s3.k.a(context2, attributeSet, R.attr.textInputStyle, R.style.Widget_Design_TextInputLayout);
        s3.k.b(context2, attributeSet, iArr, R.attr.textInputStyle, R.style.Widget_Design_TextInputLayout, 20, 18, 33, 38, 42);
        TypedArray typedArrayObtainStyledAttributes = context2.obtainStyledAttributes(attributeSet, iArr, R.attr.textInputStyle, R.style.Widget_Design_TextInputLayout);
        c cVar = new c(context2, typedArrayObtainStyledAttributes);
        this.f10335Q = typedArrayObtainStyledAttributes.getBoolean(41, true);
        setHint(typedArrayObtainStyledAttributes.getText(4));
        this.f10349Y0 = typedArrayObtainStyledAttributes.getBoolean(40, true);
        this.f10348X0 = typedArrayObtainStyledAttributes.getBoolean(35, true);
        if (typedArrayObtainStyledAttributes.hasValue(3)) {
            setMinWidth(typedArrayObtainStyledAttributes.getDimensionPixelSize(3, -1));
        }
        if (typedArrayObtainStyledAttributes.hasValue(2)) {
            setMaxWidth(typedArrayObtainStyledAttributes.getDimensionPixelSize(2, -1));
        }
        k kVarA = k.b(context2, attributeSet, R.attr.textInputStyle, R.style.Widget_Design_TextInputLayout).a();
        this.f10345V = kVarA;
        this.f10347W = context2.getResources().getDimensionPixelOffset(R.dimen.mtrl_textinput_box_label_cutout_padding);
        this.f10354c0 = typedArrayObtainStyledAttributes.getDimensionPixelOffset(7, 0);
        this.f10356e0 = typedArrayObtainStyledAttributes.getDimensionPixelSize(14, context2.getResources().getDimensionPixelSize(R.dimen.mtrl_textinput_box_stroke_width_default));
        this.f10357f0 = typedArrayObtainStyledAttributes.getDimensionPixelSize(15, context2.getResources().getDimensionPixelSize(R.dimen.mtrl_textinput_box_stroke_width_focused));
        this.f10355d0 = this.f10356e0;
        float dimension = typedArrayObtainStyledAttributes.getDimension(11, -1.0f);
        float dimension2 = typedArrayObtainStyledAttributes.getDimension(10, -1.0f);
        float dimension3 = typedArrayObtainStyledAttributes.getDimension(8, -1.0f);
        float dimension4 = typedArrayObtainStyledAttributes.getDimension(9, -1.0f);
        j jVarE = kVarA.e();
        if (dimension >= 0.0f) {
            f3 = 0.0f;
            jVarE.f18629e = new C1713a(dimension);
        } else {
            f3 = 0.0f;
        }
        if (dimension2 >= f3) {
            jVarE.f18630f = new C1713a(dimension2);
        }
        if (dimension3 >= f3) {
            jVarE.f18631g = new C1713a(dimension3);
        }
        if (dimension4 >= f3) {
            jVarE.f18632h = new C1713a(dimension4);
        }
        this.f10345V = jVarE.a();
        ColorStateList colorStateListR = d.r(context2, cVar, 5);
        if (colorStateListR != null) {
            int defaultColor = colorStateListR.getDefaultColor();
            this.f10336Q0 = defaultColor;
            this.f10359h0 = defaultColor;
            if (colorStateListR.isStateful()) {
                this.f10338R0 = colorStateListR.getColorForState(new int[]{-16842910}, -1);
                this.f10340S0 = colorStateListR.getColorForState(new int[]{android.R.attr.state_focused, android.R.attr.state_enabled}, -1);
                this.f10342T0 = colorStateListR.getColorForState(new int[]{android.R.attr.state_hovered, android.R.attr.state_enabled}, -1);
            } else {
                this.f10340S0 = this.f10336Q0;
                ColorStateList colorStateListP = d.p(context2, R.color.mtrl_filled_background_color);
                this.f10338R0 = colorStateListP.getColorForState(new int[]{-16842910}, -1);
                this.f10342T0 = colorStateListP.getColorForState(new int[]{android.R.attr.state_hovered}, -1);
            }
        } else {
            this.f10359h0 = 0;
            this.f10336Q0 = 0;
            this.f10338R0 = 0;
            this.f10340S0 = 0;
            this.f10342T0 = 0;
        }
        if (typedArrayObtainStyledAttributes.hasValue(1)) {
            ColorStateList colorStateListT = cVar.t(1);
            this.f10326L0 = colorStateListT;
            this.K0 = colorStateListT;
        }
        ColorStateList colorStateListR2 = d.r(context2, cVar, 12);
        this.f10332O0 = typedArrayObtainStyledAttributes.getColor(12, 0);
        this.f10328M0 = context2.getColor(R.color.mtrl_textinput_default_box_stroke_color);
        this.f10344U0 = context2.getColor(R.color.mtrl_textinput_disabled_color);
        this.f10330N0 = context2.getColor(R.color.mtrl_textinput_hovered_box_stroke_color);
        if (colorStateListR2 != null) {
            setBoxStrokeColorStateList(colorStateListR2);
        }
        if (typedArrayObtainStyledAttributes.hasValue(13)) {
            setBoxStrokeErrorColor(d.r(context2, cVar, 13));
        }
        if (typedArrayObtainStyledAttributes.getResourceId(42, -1) != -1) {
            setHintTextAppearance(typedArrayObtainStyledAttributes.getResourceId(42, 0));
        }
        int resourceId = typedArrayObtainStyledAttributes.getResourceId(33, 0);
        CharSequence text = typedArrayObtainStyledAttributes.getText(28);
        boolean z8 = typedArrayObtainStyledAttributes.getBoolean(29, false);
        CheckableImageButton checkableImageButton = (CheckableImageButton) LayoutInflater.from(getContext()).inflate(R.layout.design_text_input_end_icon, (ViewGroup) linearLayout2, false);
        this.f10321I0 = checkableImageButton;
        checkableImageButton.setId(R.id.text_input_error_icon);
        checkableImageButton.setVisibility(8);
        if (d.x(context2)) {
            ((ViewGroup.MarginLayoutParams) checkableImageButton.getLayoutParams()).setMarginStart(0);
        }
        if (typedArrayObtainStyledAttributes.hasValue(30)) {
            setErrorIconDrawable(cVar.u(30));
        }
        if (typedArrayObtainStyledAttributes.hasValue(31)) {
            setErrorIconTintList(d.r(context2, cVar, 31));
        }
        if (typedArrayObtainStyledAttributes.hasValue(32)) {
            setErrorIconTintMode(s3.k.f(typedArrayObtainStyledAttributes.getInt(32, -1), null));
        }
        checkableImageButton.setContentDescription(getResources().getText(R.string.error_icon_content_description));
        Field field = J.f4065a;
        checkableImageButton.setImportantForAccessibility(2);
        checkableImageButton.setClickable(false);
        checkableImageButton.setPressable(false);
        checkableImageButton.setFocusable(false);
        int resourceId2 = typedArrayObtainStyledAttributes.getResourceId(38, 0);
        boolean z9 = typedArrayObtainStyledAttributes.getBoolean(37, false);
        CharSequence text2 = typedArrayObtainStyledAttributes.getText(36);
        int resourceId3 = typedArrayObtainStyledAttributes.getResourceId(50, 0);
        CharSequence text3 = typedArrayObtainStyledAttributes.getText(49);
        int resourceId4 = typedArrayObtainStyledAttributes.getResourceId(53, 0);
        CharSequence text4 = typedArrayObtainStyledAttributes.getText(52);
        int resourceId5 = typedArrayObtainStyledAttributes.getResourceId(63, 0);
        CharSequence text5 = typedArrayObtainStyledAttributes.getText(62);
        boolean z10 = typedArrayObtainStyledAttributes.getBoolean(16, false);
        setCounterMaxLength(typedArrayObtainStyledAttributes.getInt(17, -1));
        this.f10313E = typedArrayObtainStyledAttributes.getResourceId(20, 0);
        this.D = typedArrayObtainStyledAttributes.getResourceId(18, 0);
        CheckableImageButton checkableImageButton2 = (CheckableImageButton) LayoutInflater.from(getContext()).inflate(R.layout.design_text_input_start_icon, (ViewGroup) linearLayout, false);
        this.f10364m0 = checkableImageButton2;
        checkableImageButton2.setVisibility(8);
        if (d.x(context2)) {
            ((ViewGroup.MarginLayoutParams) checkableImageButton2.getLayoutParams()).setMarginEnd(0);
        }
        setStartIconOnClickListener(null);
        setStartIconOnLongClickListener(null);
        if (typedArrayObtainStyledAttributes.hasValue(59)) {
            setStartIconDrawable(cVar.u(59));
            if (typedArrayObtainStyledAttributes.hasValue(58)) {
                setStartIconContentDescription(typedArrayObtainStyledAttributes.getText(58));
            }
            setStartIconCheckable(typedArrayObtainStyledAttributes.getBoolean(57, true));
        }
        if (typedArrayObtainStyledAttributes.hasValue(60)) {
            setStartIconTintList(d.r(context2, cVar, 60));
        }
        if (typedArrayObtainStyledAttributes.hasValue(61)) {
            setStartIconTintMode(s3.k.f(typedArrayObtainStyledAttributes.getInt(61, -1), null));
        }
        setBoxBackgroundMode(typedArrayObtainStyledAttributes.getInt(6, 0));
        CheckableImageButton checkableImageButton3 = (CheckableImageButton) LayoutInflater.from(getContext()).inflate(R.layout.design_text_input_end_icon, (ViewGroup) frameLayout2, false);
        this.f10382x0 = checkableImageButton3;
        frameLayout2.addView(checkableImageButton3);
        checkableImageButton3.setVisibility(8);
        if (d.x(context2)) {
            ((ViewGroup.MarginLayoutParams) checkableImageButton3.getLayoutParams()).setMarginStart(0);
        }
        sparseArray.append(-1, new f(this, 0));
        sparseArray.append(0, new f(this, 1));
        sparseArray.append(1, new p(this));
        sparseArray.append(2, new e(this));
        sparseArray.append(3, new l(this));
        if (typedArrayObtainStyledAttributes.hasValue(25)) {
            setEndIconMode(typedArrayObtainStyledAttributes.getInt(25, 0));
            if (typedArrayObtainStyledAttributes.hasValue(24)) {
                setEndIconDrawable(cVar.u(24));
            }
            if (typedArrayObtainStyledAttributes.hasValue(23)) {
                setEndIconContentDescription(typedArrayObtainStyledAttributes.getText(23));
            }
            setEndIconCheckable(typedArrayObtainStyledAttributes.getBoolean(22, true));
        } else if (typedArrayObtainStyledAttributes.hasValue(46)) {
            setEndIconMode(typedArrayObtainStyledAttributes.getBoolean(46, false) ? 1 : 0);
            setEndIconDrawable(cVar.u(45));
            setEndIconContentDescription(typedArrayObtainStyledAttributes.getText(44));
            if (typedArrayObtainStyledAttributes.hasValue(47)) {
                setEndIconTintList(d.r(context2, cVar, 47));
            }
            if (typedArrayObtainStyledAttributes.hasValue(48)) {
                setEndIconTintMode(s3.k.f(typedArrayObtainStyledAttributes.getInt(48, -1), null));
            }
        }
        if (typedArrayObtainStyledAttributes.hasValue(46)) {
            attributeSet2 = null;
        } else {
            if (typedArrayObtainStyledAttributes.hasValue(26)) {
                setEndIconTintList(d.r(context2, cVar, 26));
            }
            if (typedArrayObtainStyledAttributes.hasValue(27)) {
                attributeSet2 = null;
                setEndIconTintMode(s3.k.f(typedArrayObtainStyledAttributes.getInt(27, -1), null));
            }
        }
        C1190H c1190h = new C1190H(context2, attributeSet2);
        this.f10329N = c1190h;
        c1190h.setId(R.id.textinput_prefix_text);
        c1190h.setLayoutParams(new FrameLayout.LayoutParams(-2, -2));
        c1190h.setAccessibilityLiveRegion(1);
        linearLayout.addView(checkableImageButton2);
        linearLayout.addView(c1190h);
        C1190H c1190h2 = new C1190H(context2, null);
        this.f10333P = c1190h2;
        c1190h2.setId(R.id.textinput_suffix_text);
        c1190h2.setLayoutParams(new FrameLayout.LayoutParams(-2, -2, 80));
        c1190h2.setAccessibilityLiveRegion(1);
        linearLayout2.addView(c1190h2);
        linearLayout2.addView(checkableImageButton);
        linearLayout2.addView(frameLayout2);
        setHelperTextEnabled(z9);
        setHelperText(text2);
        setHelperTextTextAppearance(resourceId2);
        setErrorEnabled(z8);
        setErrorTextAppearance(resourceId);
        setErrorContentDescription(text);
        setCounterTextAppearance(this.f10313E);
        setCounterOverflowTextAppearance(this.D);
        setPlaceholderText(text3);
        setPlaceholderTextAppearance(resourceId3);
        setPrefixText(text4);
        setPrefixTextAppearance(resourceId4);
        setSuffixText(text5);
        setSuffixTextAppearance(resourceId5);
        if (typedArrayObtainStyledAttributes.hasValue(34)) {
            setErrorTextColor(cVar.t(34));
        }
        if (typedArrayObtainStyledAttributes.hasValue(39)) {
            setHelperTextColor(cVar.t(39));
        }
        if (typedArrayObtainStyledAttributes.hasValue(43)) {
            setHintTextColor(cVar.t(43));
        }
        if (typedArrayObtainStyledAttributes.hasValue(21)) {
            setCounterTextColor(cVar.t(21));
        }
        if (typedArrayObtainStyledAttributes.hasValue(19)) {
            setCounterOverflowTextColor(cVar.t(19));
        }
        if (typedArrayObtainStyledAttributes.hasValue(51)) {
            setPlaceholderTextColor(cVar.t(51));
        }
        if (typedArrayObtainStyledAttributes.hasValue(54)) {
            setPrefixTextColor(cVar.t(54));
        }
        if (typedArrayObtainStyledAttributes.hasValue(64)) {
            setSuffixTextColor(cVar.t(64));
        }
        setCounterEnabled(z10);
        setEnabled(typedArrayObtainStyledAttributes.getBoolean(0, true));
        cVar.B();
        setImportantForAccessibility(2);
        int i = Build.VERSION.SDK_INT;
        if (i < 26 || i < 26) {
            return;
        }
        D.b(this, 1);
    }

    public static void d(CheckableImageButton checkableImageButton, boolean z8, ColorStateList colorStateList, boolean z9, PorterDuff.Mode mode) {
        Drawable drawable = checkableImageButton.getDrawable();
        if (drawable != null && (z8 || z9)) {
            drawable = drawable.mutate();
            if (z8) {
                drawable.setTintList(colorStateList);
            }
            if (z9) {
                drawable.setTintMode(mode);
            }
        }
        if (checkableImageButton.getDrawable() != drawable) {
            checkableImageButton.setImageDrawable(drawable);
        }
    }

    private m getEndIconDelegate() {
        SparseArray sparseArray = this.f10380w0;
        m mVar = (m) sparseArray.get(this.f10378v0);
        return mVar != null ? mVar : (m) sparseArray.get(0);
    }

    private CheckableImageButton getEndIconToUpdateDummyDrawable() {
        CheckableImageButton checkableImageButton = this.f10321I0;
        if (checkableImageButton.getVisibility() == 0) {
            return checkableImageButton;
        }
        if (this.f10378v0 == 0 || !g()) {
            return null;
        }
        return this.f10382x0;
    }

    public static void j(ViewGroup viewGroup, boolean z8) {
        int childCount = viewGroup.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View childAt = viewGroup.getChildAt(i);
            childAt.setEnabled(z8);
            if (childAt instanceof ViewGroup) {
                j((ViewGroup) childAt, z8);
            }
        }
    }

    public static void l(CheckableImageButton checkableImageButton, View.OnLongClickListener onLongClickListener) {
        Field field = J.f4065a;
        boolean zHasOnClickListeners = checkableImageButton.hasOnClickListeners();
        boolean z8 = onLongClickListener != null;
        boolean z9 = zHasOnClickListeners || z8;
        checkableImageButton.setFocusable(z9);
        checkableImageButton.setClickable(zHasOnClickListeners);
        checkableImageButton.setPressable(zHasOnClickListeners);
        checkableImageButton.setLongClickable(z8);
        checkableImageButton.setImportantForAccessibility(z9 ? 1 : 2);
    }

    private void setEditText(EditText editText) {
        boolean z8;
        boolean z9;
        if (this.f10375u != null) {
            throw new IllegalArgumentException("We already have an EditText, can only have one");
        }
        if (this.f10378v0 != 3 && !(editText instanceof TextInputEditText)) {
            Log.i("TextInputLayout", "EditText added is not a TextInputEditText. Please switch to using that class instead.");
        }
        this.f10375u = editText;
        setMinWidth(this.f10379w);
        setMaxWidth(this.f10381x);
        h();
        setTextInputAccessibilityDelegate(new r(this));
        Typeface typeface = this.f10375u.getTypeface();
        b bVar = this.W0;
        C1596a c1596a = bVar.f16824v;
        if (c1596a != null) {
            c1596a.f17467h = true;
        }
        if (bVar.f16821s != typeface) {
            bVar.f16821s = typeface;
            z8 = true;
        } else {
            z8 = false;
        }
        if (bVar.f16822t != typeface) {
            bVar.f16822t = typeface;
            z9 = true;
        } else {
            z9 = false;
        }
        if (z8 || z9) {
            bVar.g();
        }
        float textSize = this.f10375u.getTextSize();
        if (bVar.i != textSize) {
            bVar.i = textSize;
            bVar.g();
        }
        int gravity = this.f10375u.getGravity();
        int i = (gravity & (-113)) | 48;
        if (bVar.f16811h != i) {
            bVar.f16811h = i;
            bVar.g();
        }
        if (bVar.f16810g != gravity) {
            bVar.f16810g = gravity;
            bVar.g();
        }
        this.f10375u.addTextChangedListener(new C0587c(3, this));
        if (this.K0 == null) {
            this.K0 = this.f10375u.getHintTextColors();
        }
        if (this.f10335Q) {
            if (TextUtils.isEmpty(this.f10337R)) {
                CharSequence hint = this.f10375u.getHint();
                this.f10377v = hint;
                setHint(hint);
                this.f10375u.setHint((CharSequence) null);
            }
            this.f10339S = true;
        }
        if (this.f10310C != null) {
            n(this.f10375u.getText().length());
        }
        q();
        this.f10383y.b();
        this.f10369r.bringToFront();
        this.f10371s.bringToFront();
        this.f10373t.bringToFront();
        this.f10321I0.bringToFront();
        Iterator it = this.f10376u0.iterator();
        while (it.hasNext()) {
            ((C1792a) it.next()).a(this);
        }
        u();
        x();
        if (!isEnabled()) {
            editText.setEnabled(false);
        }
        s(false, true);
    }

    private void setErrorIconVisible(boolean z8) {
        this.f10321I0.setVisibility(z8 ? 0 : 8);
        this.f10373t.setVisibility(z8 ? 8 : 0);
        x();
        if (this.f10378v0 != 0) {
            return;
        }
        p();
    }

    private void setHintInternal(CharSequence charSequence) {
        if (TextUtils.equals(charSequence, this.f10337R)) {
            return;
        }
        this.f10337R = charSequence;
        b bVar = this.W0;
        if (charSequence == null || !TextUtils.equals(bVar.f16825w, charSequence)) {
            bVar.f16825w = charSequence;
            bVar.f16826x = null;
            Bitmap bitmap = bVar.f16828z;
            if (bitmap != null) {
                bitmap.recycle();
                bVar.f16828z = null;
            }
            bVar.g();
        }
        if (this.f10346V0) {
            return;
        }
        i();
    }

    private void setPlaceholderTextEnabled(boolean z8) {
        if (this.f10317G == z8) {
            return;
        }
        if (z8) {
            C1190H c1190h = new C1190H(getContext(), null);
            this.H = c1190h;
            c1190h.setId(R.id.textinput_placeholder);
            this.H.setAccessibilityLiveRegion(1);
            setPlaceholderTextAppearance(this.f10322J);
            setPlaceholderTextColor(this.f10320I);
            C1190H c1190h2 = this.H;
            if (c1190h2 != null) {
                this.f10368q.addView(c1190h2);
                this.H.setVisibility(0);
            }
        } else {
            C1190H c1190h3 = this.H;
            if (c1190h3 != null) {
                c1190h3.setVisibility(8);
            }
            this.H = null;
        }
        this.f10317G = z8;
    }

    public final void a(float f3) {
        b bVar = this.W0;
        if (bVar.f16806c == f3) {
            return;
        }
        if (this.f10350Z0 == null) {
            ValueAnimator valueAnimator = new ValueAnimator();
            this.f10350Z0 = valueAnimator;
            valueAnimator.setInterpolator(AbstractC1051a.f13506b);
            this.f10350Z0.setDuration(167L);
            this.f10350Z0.addUpdateListener(new C0222x(4, this));
        }
        this.f10350Z0.setFloatValues(bVar.f16806c, f3);
        this.f10350Z0.start();
    }

    @Override // android.view.ViewGroup
    public final void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
        if (!(view instanceof EditText)) {
            super.addView(view, i, layoutParams);
            return;
        }
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(layoutParams);
        layoutParams2.gravity = (layoutParams2.gravity & (-113)) | 16;
        FrameLayout frameLayout = this.f10368q;
        frameLayout.addView(view, layoutParams2);
        frameLayout.setLayoutParams(layoutParams);
        r();
        setEditText((EditText) view);
    }

    public final void b() {
        int i;
        int i5;
        int i8;
        g gVar = this.f10341T;
        if (gVar == null) {
            return;
        }
        gVar.setShapeAppearanceModel(this.f10345V);
        if (this.f10352b0 == 2 && (i5 = this.f10355d0) > -1 && (i8 = this.f10358g0) != 0) {
            g gVar2 = this.f10341T;
            gVar2.f18614q.f18596j = i5;
            gVar2.invalidateSelf();
            ColorStateList colorStateListValueOf = ColorStateList.valueOf(i8);
            x3.f fVar = gVar2.f18614q;
            if (fVar.f18591d != colorStateListValueOf) {
                fVar.f18591d = colorStateListValueOf;
                gVar2.onStateChange(gVar2.getState());
            }
        }
        int iB = this.f10359h0;
        if (this.f10352b0 == 1) {
            TypedValue typedValueW = u0.w(getContext(), R.attr.colorSurface);
            iB = F.a.b(this.f10359h0, typedValueW != null ? typedValueW.data : 0);
        }
        this.f10359h0 = iB;
        this.f10341T.i(ColorStateList.valueOf(iB));
        if (this.f10378v0 == 3) {
            this.f10375u.getBackground().invalidateSelf();
        }
        g gVar3 = this.f10343U;
        if (gVar3 != null) {
            if (this.f10355d0 > -1 && (i = this.f10358g0) != 0) {
                gVar3.i(ColorStateList.valueOf(i));
            }
            invalidate();
        }
        invalidate();
    }

    public final void c() {
        d(this.f10382x0, this.f10307A0, this.f10386z0, this.f10311C0, this.f10309B0);
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void dispatchProvideAutofillStructure(ViewStructure viewStructure, int i) {
        EditText editText = this.f10375u;
        if (editText == null) {
            super.dispatchProvideAutofillStructure(viewStructure, i);
            return;
        }
        if (this.f10377v != null) {
            boolean z8 = this.f10339S;
            this.f10339S = false;
            CharSequence hint = editText.getHint();
            this.f10375u.setHint(this.f10377v);
            try {
                super.dispatchProvideAutofillStructure(viewStructure, i);
                return;
            } finally {
                this.f10375u.setHint(hint);
                this.f10339S = z8;
            }
        }
        viewStructure.setAutofillId(getAutofillId());
        onProvideAutofillStructure(viewStructure, i);
        onProvideAutofillVirtualStructure(viewStructure, i);
        FrameLayout frameLayout = this.f10368q;
        viewStructure.setChildCount(frameLayout.getChildCount());
        for (int i5 = 0; i5 < frameLayout.getChildCount(); i5++) {
            View childAt = frameLayout.getChildAt(i5);
            ViewStructure viewStructureNewChild = viewStructure.newChild(i5);
            childAt.dispatchProvideAutofillStructure(viewStructureNewChild, i);
            if (childAt == this.f10375u) {
                viewStructureNewChild.setHint(getHint());
            }
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void dispatchRestoreInstanceState(SparseArray sparseArray) {
        this.f10353b1 = true;
        super.dispatchRestoreInstanceState(sparseArray);
        this.f10353b1 = false;
    }

    @Override // android.view.View
    public final void draw(Canvas canvas) {
        super.draw(canvas);
        if (this.f10335Q) {
            b bVar = this.W0;
            bVar.getClass();
            int iSave = canvas.save();
            if (bVar.f16826x != null && bVar.f16805b) {
                bVar.f16802N.getLineLeft(0);
                bVar.f16794E.setTextSize(bVar.f16792B);
                float f3 = bVar.f16819q;
                float f7 = bVar.f16820r;
                float f8 = bVar.f16791A;
                if (f8 != 1.0f) {
                    canvas.scale(f8, f8, f3, f7);
                }
                canvas.translate(f3, f7);
                bVar.f16802N.draw(canvas);
                canvas.restoreToCount(iSave);
            }
        }
        g gVar = this.f10343U;
        if (gVar != null) {
            Rect bounds = gVar.getBounds();
            bounds.top = bounds.bottom - this.f10355d0;
            this.f10343U.draw(canvas);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x002f  */
    @Override // android.view.ViewGroup, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void drawableStateChanged() {
        boolean z8;
        ColorStateList colorStateList;
        if (this.a1) {
            return;
        }
        this.a1 = true;
        super.drawableStateChanged();
        int[] drawableState = getDrawableState();
        b bVar = this.W0;
        if (bVar != null) {
            bVar.f16793C = drawableState;
            ColorStateList colorStateList2 = bVar.f16814l;
            if ((colorStateList2 == null || !colorStateList2.isStateful()) && ((colorStateList = bVar.f16813k) == null || !colorStateList.isStateful())) {
                z8 = false;
            } else {
                bVar.g();
                z8 = true;
            }
        }
        if (this.f10375u != null) {
            Field field = J.f4065a;
            s(isLaidOut() && isEnabled(), false);
        }
        q();
        z();
        if (z8) {
            invalidate();
        }
        this.a1 = false;
    }

    public final int e() {
        if (!this.f10335Q) {
            return 0;
        }
        int i = this.f10352b0;
        b bVar = this.W0;
        if (i == 0 || i == 1) {
            TextPaint textPaint = bVar.f16795F;
            textPaint.setTextSize(bVar.f16812j);
            textPaint.setTypeface(bVar.f16821s);
            textPaint.setLetterSpacing(bVar.f16801M);
            return (int) (-textPaint.ascent());
        }
        if (i != 2) {
            return 0;
        }
        TextPaint textPaint2 = bVar.f16795F;
        textPaint2.setTextSize(bVar.f16812j);
        textPaint2.setTypeface(bVar.f16821s);
        textPaint2.setLetterSpacing(bVar.f16801M);
        return (int) ((-textPaint2.ascent()) / 2.0f);
    }

    public final boolean f() {
        return this.f10335Q && !TextUtils.isEmpty(this.f10337R) && (this.f10341T instanceof z3.g);
    }

    public final boolean g() {
        return this.f10373t.getVisibility() == 0 && this.f10382x0.getVisibility() == 0;
    }

    @Override // android.widget.LinearLayout, android.view.View
    public int getBaseline() {
        EditText editText = this.f10375u;
        if (editText == null) {
            return super.getBaseline();
        }
        return e() + getPaddingTop() + editText.getBaseline();
    }

    public g getBoxBackground() {
        int i = this.f10352b0;
        if (i == 1 || i == 2) {
            return this.f10341T;
        }
        throw new IllegalStateException();
    }

    public int getBoxBackgroundColor() {
        return this.f10359h0;
    }

    public int getBoxBackgroundMode() {
        return this.f10352b0;
    }

    public float getBoxCornerRadiusBottomEnd() {
        g gVar = this.f10341T;
        return gVar.f18614q.f18588a.f18643h.a(gVar.e());
    }

    public float getBoxCornerRadiusBottomStart() {
        g gVar = this.f10341T;
        return gVar.f18614q.f18588a.f18642g.a(gVar.e());
    }

    public float getBoxCornerRadiusTopEnd() {
        g gVar = this.f10341T;
        return gVar.f18614q.f18588a.f18641f.a(gVar.e());
    }

    public float getBoxCornerRadiusTopStart() {
        g gVar = this.f10341T;
        return gVar.f18614q.f18588a.f18640e.a(gVar.e());
    }

    public int getBoxStrokeColor() {
        return this.f10332O0;
    }

    public ColorStateList getBoxStrokeErrorColor() {
        return this.f10334P0;
    }

    public int getBoxStrokeWidth() {
        return this.f10356e0;
    }

    public int getBoxStrokeWidthFocused() {
        return this.f10357f0;
    }

    public int getCounterMaxLength() {
        return this.f10306A;
    }

    public CharSequence getCounterOverflowDescription() {
        C1190H c1190h;
        if (this.f10385z && this.f10308B && (c1190h = this.f10310C) != null) {
            return c1190h.getContentDescription();
        }
        return null;
    }

    public ColorStateList getCounterOverflowTextColor() {
        return this.f10324K;
    }

    public ColorStateList getCounterTextColor() {
        return this.f10324K;
    }

    public ColorStateList getDefaultHintTextColor() {
        return this.K0;
    }

    public EditText getEditText() {
        return this.f10375u;
    }

    public CharSequence getEndIconContentDescription() {
        return this.f10382x0.getContentDescription();
    }

    public Drawable getEndIconDrawable() {
        return this.f10382x0.getDrawable();
    }

    public int getEndIconMode() {
        return this.f10378v0;
    }

    public CheckableImageButton getEndIconView() {
        return this.f10382x0;
    }

    public CharSequence getError() {
        o oVar = this.f10383y;
        if (oVar.f19333k) {
            return oVar.f19332j;
        }
        return null;
    }

    public CharSequence getErrorContentDescription() {
        return this.f10383y.f19335m;
    }

    public int getErrorCurrentTextColors() {
        C1190H c1190h = this.f10383y.f19334l;
        if (c1190h != null) {
            return c1190h.getCurrentTextColor();
        }
        return -1;
    }

    public Drawable getErrorIconDrawable() {
        return this.f10321I0.getDrawable();
    }

    public final int getErrorTextCurrentColor() {
        C1190H c1190h = this.f10383y.f19334l;
        if (c1190h != null) {
            return c1190h.getCurrentTextColor();
        }
        return -1;
    }

    public CharSequence getHelperText() {
        o oVar = this.f10383y;
        if (oVar.f19339q) {
            return oVar.f19338p;
        }
        return null;
    }

    public int getHelperTextCurrentTextColor() {
        C1190H c1190h = this.f10383y.f19340r;
        if (c1190h != null) {
            return c1190h.getCurrentTextColor();
        }
        return -1;
    }

    public CharSequence getHint() {
        if (this.f10335Q) {
            return this.f10337R;
        }
        return null;
    }

    public final float getHintCollapsedTextHeight() {
        b bVar = this.W0;
        TextPaint textPaint = bVar.f16795F;
        textPaint.setTextSize(bVar.f16812j);
        textPaint.setTypeface(bVar.f16821s);
        textPaint.setLetterSpacing(bVar.f16801M);
        return -textPaint.ascent();
    }

    public final int getHintCurrentCollapsedTextColor() {
        b bVar = this.W0;
        return bVar.d(bVar.f16814l);
    }

    public ColorStateList getHintTextColor() {
        return this.f10326L0;
    }

    public int getMaxWidth() {
        return this.f10381x;
    }

    public int getMinWidth() {
        return this.f10379w;
    }

    @Deprecated
    public CharSequence getPasswordVisibilityToggleContentDescription() {
        return this.f10382x0.getContentDescription();
    }

    @Deprecated
    public Drawable getPasswordVisibilityToggleDrawable() {
        return this.f10382x0.getDrawable();
    }

    public CharSequence getPlaceholderText() {
        if (this.f10317G) {
            return this.f10315F;
        }
        return null;
    }

    public int getPlaceholderTextAppearance() {
        return this.f10322J;
    }

    public ColorStateList getPlaceholderTextColor() {
        return this.f10320I;
    }

    public CharSequence getPrefixText() {
        return this.f10327M;
    }

    public ColorStateList getPrefixTextColor() {
        return this.f10329N.getTextColors();
    }

    public TextView getPrefixTextView() {
        return this.f10329N;
    }

    public CharSequence getStartIconContentDescription() {
        return this.f10364m0.getContentDescription();
    }

    public Drawable getStartIconDrawable() {
        return this.f10364m0.getDrawable();
    }

    public CharSequence getSuffixText() {
        return this.f10331O;
    }

    public ColorStateList getSuffixTextColor() {
        return this.f10333P.getTextColors();
    }

    public TextView getSuffixTextView() {
        return this.f10333P;
    }

    public Typeface getTypeface() {
        return this.f10363l0;
    }

    public final void h() {
        int i = this.f10352b0;
        if (i != 0) {
            k kVar = this.f10345V;
            if (i == 1) {
                this.f10341T = new g(kVar);
                this.f10343U = new g();
            } else {
                if (i != 2) {
                    throw new IllegalArgumentException(AbstractC0844a.n(new StringBuilder(), this.f10352b0, " is illegal; only @BoxBackgroundMode constants are supported."));
                }
                if (!this.f10335Q || (this.f10341T instanceof z3.g)) {
                    this.f10341T = new g(kVar);
                } else {
                    this.f10341T = new z3.g(kVar);
                }
                this.f10343U = null;
            }
        } else {
            this.f10341T = null;
            this.f10343U = null;
        }
        EditText editText = this.f10375u;
        if (editText != null && this.f10341T != null && editText.getBackground() == null && this.f10352b0 != 0) {
            EditText editText2 = this.f10375u;
            g gVar = this.f10341T;
            Field field = J.f4065a;
            editText2.setBackground(gVar);
        }
        z();
        if (this.f10352b0 == 1) {
            if (getContext().getResources().getConfiguration().fontScale >= 2.0f) {
                this.f10354c0 = getResources().getDimensionPixelSize(R.dimen.material_font_2_0_box_collapsed_padding_top);
            } else if (d.x(getContext())) {
                this.f10354c0 = getResources().getDimensionPixelSize(R.dimen.material_font_1_3_box_collapsed_padding_top);
            }
        }
        if (this.f10375u != null && this.f10352b0 == 1) {
            if (getContext().getResources().getConfiguration().fontScale >= 2.0f) {
                EditText editText3 = this.f10375u;
                Field field2 = J.f4065a;
                editText3.setPaddingRelative(editText3.getPaddingStart(), getResources().getDimensionPixelSize(R.dimen.material_filled_edittext_font_2_0_padding_top), this.f10375u.getPaddingEnd(), getResources().getDimensionPixelSize(R.dimen.material_filled_edittext_font_2_0_padding_bottom));
            } else if (d.x(getContext())) {
                EditText editText4 = this.f10375u;
                Field field3 = J.f4065a;
                editText4.setPaddingRelative(editText4.getPaddingStart(), getResources().getDimensionPixelSize(R.dimen.material_filled_edittext_font_1_3_padding_top), this.f10375u.getPaddingEnd(), getResources().getDimensionPixelSize(R.dimen.material_filled_edittext_font_1_3_padding_bottom));
            }
        }
        if (this.f10352b0 != 0) {
            r();
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:48:0x00a2  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void i() {
        float f3;
        float fB;
        float f7;
        float fB2;
        int i;
        float fB3;
        int i5;
        if (f()) {
            RectF rectF = this.f10362k0;
            int width = this.f10375u.getWidth();
            int gravity = this.f10375u.getGravity();
            b bVar = this.W0;
            CharSequence charSequence = bVar.f16825w;
            Field field = J.f4065a;
            boolean zE = (bVar.f16804a.getLayoutDirection() == 1 ? h.f3528d : h.f3527c).e(charSequence.length(), charSequence);
            bVar.f16827y = zE;
            Rect rect = bVar.f16808e;
            if (gravity != 17 && (gravity & 7) != 1) {
                if ((gravity & 8388613) == 8388613 || (gravity & 5) == 5) {
                    if (zE) {
                        i5 = rect.left;
                        f7 = i5;
                    } else {
                        f3 = rect.right;
                        fB = bVar.b();
                    }
                } else if (zE) {
                    f3 = rect.right;
                    fB = bVar.b();
                } else {
                    i5 = rect.left;
                    f7 = i5;
                }
                rectF.left = f7;
                rectF.top = rect.top;
                if (gravity != 17 || (gravity & 7) == 1) {
                    fB2 = (width / 2.0f) + (bVar.b() / 2.0f);
                } else if ((gravity & 8388613) == 8388613 || (gravity & 5) == 5) {
                    if (bVar.f16827y) {
                        fB3 = bVar.b();
                        fB2 = fB3 + f7;
                    } else {
                        i = rect.right;
                        fB2 = i;
                    }
                } else if (bVar.f16827y) {
                    i = rect.right;
                    fB2 = i;
                } else {
                    fB3 = bVar.b();
                    fB2 = fB3 + f7;
                }
                rectF.right = fB2;
                TextPaint textPaint = bVar.f16795F;
                textPaint.setTextSize(bVar.f16812j);
                textPaint.setTypeface(bVar.f16821s);
                textPaint.setLetterSpacing(bVar.f16801M);
                textPaint.ascent();
                float f8 = rectF.left;
                float f9 = this.f10347W;
                rectF.left = f8 - f9;
                rectF.right += f9;
                int i8 = this.f10355d0;
                this.f10351a0 = i8;
                rectF.top = 0.0f;
                rectF.bottom = i8;
                rectF.offset(-getPaddingLeft(), 0.0f);
                z3.g gVar = (z3.g) this.f10341T;
                gVar.getClass();
                gVar.m(rectF.left, rectF.top, rectF.right, rectF.bottom);
            }
            f3 = width / 2.0f;
            fB = bVar.b() / 2.0f;
            f7 = f3 - fB;
            rectF.left = f7;
            rectF.top = rect.top;
            if (gravity != 17) {
                fB2 = (width / 2.0f) + (bVar.b() / 2.0f);
            }
            rectF.right = fB2;
            TextPaint textPaint2 = bVar.f16795F;
            textPaint2.setTextSize(bVar.f16812j);
            textPaint2.setTypeface(bVar.f16821s);
            textPaint2.setLetterSpacing(bVar.f16801M);
            textPaint2.ascent();
            float f82 = rectF.left;
            float f92 = this.f10347W;
            rectF.left = f82 - f92;
            rectF.right += f92;
            int i82 = this.f10355d0;
            this.f10351a0 = i82;
            rectF.top = 0.0f;
            rectF.bottom = i82;
            rectF.offset(-getPaddingLeft(), 0.0f);
            z3.g gVar2 = (z3.g) this.f10341T;
            gVar2.getClass();
            gVar2.m(rectF.left, rectF.top, rectF.right, rectF.bottom);
        }
    }

    public final void k(CheckableImageButton checkableImageButton, ColorStateList colorStateList) {
        Drawable drawable = checkableImageButton.getDrawable();
        if (checkableImageButton.getDrawable() == null || colorStateList == null || !colorStateList.isStateful()) {
            return;
        }
        int[] drawableState = getDrawableState();
        int[] drawableState2 = checkableImageButton.getDrawableState();
        int length = drawableState.length;
        int[] iArrCopyOf = Arrays.copyOf(drawableState, drawableState.length + drawableState2.length);
        System.arraycopy(drawableState2, 0, iArrCopyOf, length, drawableState2.length);
        int colorForState = colorStateList.getColorForState(iArrCopyOf, colorStateList.getDefaultColor());
        Drawable drawableMutate = drawable.mutate();
        drawableMutate.setTintList(ColorStateList.valueOf(colorForState));
        checkableImageButton.setImageDrawable(drawableMutate);
    }

    public final void m(C1190H c1190h, int i) {
        try {
            c1190h.setTextAppearance(i);
            if (c1190h.getTextColors().getDefaultColor() != -65281) {
                return;
            }
        } catch (Exception unused) {
        }
        c1190h.setTextAppearance(R.style.TextAppearance_AppCompat_Caption);
        c1190h.setTextColor(getContext().getColor(R.color.design_error));
    }

    public final void n(int i) {
        boolean z8 = this.f10308B;
        int i5 = this.f10306A;
        String string = null;
        if (i5 == -1) {
            this.f10310C.setText(String.valueOf(i));
            this.f10310C.setContentDescription(null);
            this.f10308B = false;
        } else {
            this.f10308B = i > i5;
            Context context = getContext();
            this.f10310C.setContentDescription(context.getString(this.f10308B ? R.string.character_counter_overflowed_content_description : R.string.character_counter_content_description, Integer.valueOf(i), Integer.valueOf(this.f10306A)));
            if (z8 != this.f10308B) {
                o();
            }
            String str = K.b.f3513b;
            K.b bVar = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == 1 ? K.b.f3516e : K.b.f3515d;
            C1190H c1190h = this.f10310C;
            String string2 = getContext().getString(R.string.character_counter_pattern, Integer.valueOf(i), Integer.valueOf(this.f10306A));
            if (string2 == null) {
                bVar.getClass();
            } else {
                bVar.getClass();
                K.g gVar = h.f3525a;
                string = bVar.c(string2).toString();
            }
            c1190h.setText(string);
        }
        if (this.f10375u == null || z8 == this.f10308B) {
            return;
        }
        s(false, false);
        z();
        q();
    }

    public final void o() {
        ColorStateList colorStateList;
        ColorStateList colorStateList2;
        C1190H c1190h = this.f10310C;
        if (c1190h != null) {
            m(c1190h, this.f10308B ? this.D : this.f10313E);
            if (!this.f10308B && (colorStateList2 = this.f10324K) != null) {
                this.f10310C.setTextColor(colorStateList2);
            }
            if (!this.f10308B || (colorStateList = this.f10325L) == null) {
                return;
            }
            this.f10310C.setTextColor(colorStateList);
        }
    }

    @Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
    public final void onLayout(boolean z8, int i, int i5, int i8, int i9) {
        super.onLayout(z8, i, i5, i8, i9);
        EditText editText = this.f10375u;
        if (editText != null) {
            ThreadLocal threadLocal = s3.c.f16829a;
            int width = editText.getWidth();
            int height = editText.getHeight();
            Rect rect = this.f10360i0;
            rect.set(0, 0, width, height);
            ThreadLocal threadLocal2 = s3.c.f16829a;
            Matrix matrix = (Matrix) threadLocal2.get();
            if (matrix == null) {
                matrix = new Matrix();
                threadLocal2.set(matrix);
            } else {
                matrix.reset();
            }
            s3.c.a(this, editText, matrix);
            ThreadLocal threadLocal3 = s3.c.f16830b;
            RectF rectF = (RectF) threadLocal3.get();
            if (rectF == null) {
                rectF = new RectF();
                threadLocal3.set(rectF);
            }
            rectF.set(rect);
            matrix.mapRect(rectF);
            rect.set((int) (rectF.left + 0.5f), (int) (rectF.top + 0.5f), (int) (rectF.right + 0.5f), (int) (rectF.bottom + 0.5f));
            g gVar = this.f10343U;
            if (gVar != null) {
                int i10 = rect.bottom;
                gVar.setBounds(rect.left, i10 - this.f10357f0, rect.right, i10);
            }
            if (this.f10335Q) {
                float textSize = this.f10375u.getTextSize();
                b bVar = this.W0;
                if (bVar.i != textSize) {
                    bVar.i = textSize;
                    bVar.g();
                }
                int gravity = this.f10375u.getGravity();
                int i11 = (gravity & (-113)) | 48;
                if (bVar.f16811h != i11) {
                    bVar.f16811h = i11;
                    bVar.g();
                }
                if (bVar.f16810g != gravity) {
                    bVar.f16810g = gravity;
                    bVar.g();
                }
                if (this.f10375u == null) {
                    throw new IllegalStateException();
                }
                Field field = J.f4065a;
                boolean z9 = getLayoutDirection() == 1;
                int i12 = rect.bottom;
                Rect rect2 = this.f10361j0;
                rect2.bottom = i12;
                int i13 = this.f10352b0;
                C1190H c1190h = this.f10329N;
                if (i13 == 1) {
                    int compoundPaddingLeft = this.f10375u.getCompoundPaddingLeft() + rect.left;
                    if (this.f10327M != null && !z9) {
                        compoundPaddingLeft = (compoundPaddingLeft - c1190h.getMeasuredWidth()) + c1190h.getPaddingLeft();
                    }
                    rect2.left = compoundPaddingLeft;
                    rect2.top = rect.top + this.f10354c0;
                    int compoundPaddingRight = rect.right - this.f10375u.getCompoundPaddingRight();
                    if (this.f10327M != null && z9) {
                        compoundPaddingRight += c1190h.getMeasuredWidth() - c1190h.getPaddingRight();
                    }
                    rect2.right = compoundPaddingRight;
                } else if (i13 != 2) {
                    int compoundPaddingLeft2 = this.f10375u.getCompoundPaddingLeft() + rect.left;
                    if (this.f10327M != null && !z9) {
                        compoundPaddingLeft2 = (compoundPaddingLeft2 - c1190h.getMeasuredWidth()) + c1190h.getPaddingLeft();
                    }
                    rect2.left = compoundPaddingLeft2;
                    rect2.top = getPaddingTop();
                    int compoundPaddingRight2 = rect.right - this.f10375u.getCompoundPaddingRight();
                    if (this.f10327M != null && z9) {
                        compoundPaddingRight2 += c1190h.getMeasuredWidth() - c1190h.getPaddingRight();
                    }
                    rect2.right = compoundPaddingRight2;
                } else {
                    rect2.left = this.f10375u.getPaddingLeft() + rect.left;
                    rect2.top = rect.top - e();
                    rect2.right = rect.right - this.f10375u.getPaddingRight();
                }
                int i14 = rect2.left;
                int i15 = rect2.top;
                int i16 = rect2.right;
                int i17 = rect2.bottom;
                Rect rect3 = bVar.f16808e;
                if (rect3.left != i14 || rect3.top != i15 || rect3.right != i16 || rect3.bottom != i17) {
                    rect3.set(i14, i15, i16, i17);
                    bVar.D = true;
                    bVar.f();
                }
                if (this.f10375u == null) {
                    throw new IllegalStateException();
                }
                TextPaint textPaint = bVar.f16795F;
                textPaint.setTextSize(bVar.i);
                textPaint.setTypeface(bVar.f16822t);
                textPaint.setLetterSpacing(0.0f);
                float f3 = -textPaint.ascent();
                rect2.left = this.f10375u.getCompoundPaddingLeft() + rect.left;
                rect2.top = (this.f10352b0 != 1 || this.f10375u.getMinLines() > 1) ? rect.top + this.f10375u.getCompoundPaddingTop() : (int) (rect.centerY() - (f3 / 2.0f));
                rect2.right = rect.right - this.f10375u.getCompoundPaddingRight();
                int compoundPaddingBottom = (this.f10352b0 != 1 || this.f10375u.getMinLines() > 1) ? rect.bottom - this.f10375u.getCompoundPaddingBottom() : (int) (rect2.top + f3);
                rect2.bottom = compoundPaddingBottom;
                int i18 = rect2.left;
                int i19 = rect2.top;
                int i20 = rect2.right;
                Rect rect4 = bVar.f16807d;
                if (rect4.left != i18 || rect4.top != i19 || rect4.right != i20 || rect4.bottom != compoundPaddingBottom) {
                    rect4.set(i18, i19, i20, compoundPaddingBottom);
                    bVar.D = true;
                    bVar.f();
                }
                bVar.g();
                if (!f() || this.f10346V0) {
                    return;
                }
                i();
            }
        }
    }

    @Override // android.widget.LinearLayout, android.view.View
    public final void onMeasure(int i, int i5) {
        EditText editText;
        int iMax;
        super.onMeasure(i, i5);
        boolean z8 = false;
        if (this.f10375u != null && this.f10375u.getMeasuredHeight() < (iMax = Math.max(this.f10371s.getMeasuredHeight(), this.f10369r.getMeasuredHeight()))) {
            this.f10375u.setMinimumHeight(iMax);
            z8 = true;
        }
        boolean zP = p();
        if (z8 || zP) {
            this.f10375u.post(new q(this, 1));
        }
        if (this.H != null && (editText = this.f10375u) != null) {
            this.H.setGravity(editText.getGravity());
            this.H.setPadding(this.f10375u.getCompoundPaddingLeft(), this.f10375u.getCompoundPaddingTop(), this.f10375u.getCompoundPaddingRight(), this.f10375u.getCompoundPaddingBottom());
        }
        u();
        x();
    }

    @Override // android.view.View
    public final void onRestoreInstanceState(Parcelable parcelable) {
        if (!(parcelable instanceof s)) {
            super.onRestoreInstanceState(parcelable);
            return;
        }
        s sVar = (s) parcelable;
        super.onRestoreInstanceState(sVar.f6203q);
        setError(sVar.f19350s);
        if (sVar.f19351t) {
            this.f10382x0.post(new q(this, 0));
        }
        setHint(sVar.f19352u);
        setHelperText(sVar.f19353v);
        setPlaceholderText(sVar.f19354w);
        requestLayout();
    }

    @Override // android.view.View
    public final Parcelable onSaveInstanceState() {
        s sVar = new s(super.onSaveInstanceState());
        if (this.f10383y.e()) {
            sVar.f19350s = getError();
        }
        sVar.f19351t = this.f10378v0 != 0 && this.f10382x0.f10285t;
        sVar.f19352u = getHint();
        sVar.f19353v = getHelperText();
        sVar.f19354w = getPlaceholderText();
        return sVar;
    }

    /* JADX WARN: Removed duplicated region for block: B:19:0x0053  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean p() {
        boolean z8;
        if (this.f10375u == null) {
            return false;
        }
        boolean z9 = true;
        if (getStartIconDrawable() != null || this.f10327M != null) {
            LinearLayout linearLayout = this.f10369r;
            if (linearLayout.getMeasuredWidth() > 0) {
                int measuredWidth = linearLayout.getMeasuredWidth() - this.f10375u.getPaddingLeft();
                if (this.f10370r0 == null || this.f10372s0 != measuredWidth) {
                    ColorDrawable colorDrawable = new ColorDrawable();
                    this.f10370r0 = colorDrawable;
                    this.f10372s0 = measuredWidth;
                    colorDrawable.setBounds(0, 0, measuredWidth, 1);
                }
                Drawable[] compoundDrawablesRelative = this.f10375u.getCompoundDrawablesRelative();
                Drawable drawable = compoundDrawablesRelative[0];
                ColorDrawable colorDrawable2 = this.f10370r0;
                if (drawable != colorDrawable2) {
                    this.f10375u.setCompoundDrawablesRelative(colorDrawable2, compoundDrawablesRelative[1], compoundDrawablesRelative[2], compoundDrawablesRelative[3]);
                    z8 = true;
                }
                z8 = false;
            } else {
                if (this.f10370r0 != null) {
                    Drawable[] compoundDrawablesRelative2 = this.f10375u.getCompoundDrawablesRelative();
                    this.f10375u.setCompoundDrawablesRelative(null, compoundDrawablesRelative2[1], compoundDrawablesRelative2[2], compoundDrawablesRelative2[3]);
                    this.f10370r0 = null;
                    z8 = true;
                }
                z8 = false;
            }
        }
        if ((this.f10321I0.getVisibility() == 0 || ((this.f10378v0 != 0 && g()) || this.f10331O != null)) && this.f10371s.getMeasuredWidth() > 0) {
            int measuredWidth2 = this.f10333P.getMeasuredWidth() - this.f10375u.getPaddingRight();
            CheckableImageButton endIconToUpdateDummyDrawable = getEndIconToUpdateDummyDrawable();
            if (endIconToUpdateDummyDrawable != null) {
                measuredWidth2 = ((ViewGroup.MarginLayoutParams) endIconToUpdateDummyDrawable.getLayoutParams()).getMarginStart() + endIconToUpdateDummyDrawable.getMeasuredWidth() + measuredWidth2;
            }
            Drawable[] compoundDrawablesRelative3 = this.f10375u.getCompoundDrawablesRelative();
            ColorDrawable colorDrawable3 = this.f10312D0;
            if (colorDrawable3 != null && this.f10314E0 != measuredWidth2) {
                this.f10314E0 = measuredWidth2;
                colorDrawable3.setBounds(0, 0, measuredWidth2, 1);
                this.f10375u.setCompoundDrawablesRelative(compoundDrawablesRelative3[0], compoundDrawablesRelative3[1], this.f10312D0, compoundDrawablesRelative3[3]);
                return true;
            }
            if (colorDrawable3 == null) {
                ColorDrawable colorDrawable4 = new ColorDrawable();
                this.f10312D0 = colorDrawable4;
                this.f10314E0 = measuredWidth2;
                colorDrawable4.setBounds(0, 0, measuredWidth2, 1);
            }
            Drawable drawable2 = compoundDrawablesRelative3[2];
            ColorDrawable colorDrawable5 = this.f10312D0;
            if (drawable2 != colorDrawable5) {
                this.f10316F0 = drawable2;
                this.f10375u.setCompoundDrawablesRelative(compoundDrawablesRelative3[0], compoundDrawablesRelative3[1], colorDrawable5, compoundDrawablesRelative3[3]);
                return true;
            }
        } else if (this.f10312D0 != null) {
            Drawable[] compoundDrawablesRelative4 = this.f10375u.getCompoundDrawablesRelative();
            if (compoundDrawablesRelative4[2] == this.f10312D0) {
                this.f10375u.setCompoundDrawablesRelative(compoundDrawablesRelative4[0], compoundDrawablesRelative4[1], this.f10316F0, compoundDrawablesRelative4[3]);
            } else {
                z9 = z8;
            }
            this.f10312D0 = null;
            return z9;
        }
        return z8;
    }

    public final void q() {
        Drawable background;
        C1190H c1190h;
        EditText editText = this.f10375u;
        if (editText == null || this.f10352b0 != 0 || (background = editText.getBackground()) == null) {
            return;
        }
        int[] iArr = S.f14773a;
        Drawable drawableMutate = background.mutate();
        o oVar = this.f10383y;
        if (oVar.e()) {
            C1190H c1190h2 = oVar.f19334l;
            drawableMutate.setColorFilter(C1228p.b(c1190h2 != null ? c1190h2.getCurrentTextColor() : -1, PorterDuff.Mode.SRC_IN));
        } else if (this.f10308B && (c1190h = this.f10310C) != null) {
            drawableMutate.setColorFilter(C1228p.b(c1190h.getCurrentTextColor(), PorterDuff.Mode.SRC_IN));
        } else {
            drawableMutate.clearColorFilter();
            this.f10375u.refreshDrawableState();
        }
    }

    public final void r() {
        if (this.f10352b0 != 1) {
            FrameLayout frameLayout = this.f10368q;
            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
            int iE = e();
            if (iE != layoutParams.topMargin) {
                layoutParams.topMargin = iE;
                frameLayout.requestLayout();
            }
        }
    }

    public final void s(boolean z8, boolean z9) {
        ColorStateList colorStateList;
        C1190H c1190h;
        boolean zIsEnabled = isEnabled();
        EditText editText = this.f10375u;
        boolean z10 = (editText == null || TextUtils.isEmpty(editText.getText())) ? false : true;
        EditText editText2 = this.f10375u;
        boolean z11 = editText2 != null && editText2.hasFocus();
        o oVar = this.f10383y;
        boolean zE = oVar.e();
        ColorStateList colorStateList2 = this.K0;
        b bVar = this.W0;
        if (colorStateList2 != null) {
            bVar.h(colorStateList2);
            ColorStateList colorStateList3 = this.K0;
            if (bVar.f16813k != colorStateList3) {
                bVar.f16813k = colorStateList3;
                bVar.g();
            }
        }
        if (!zIsEnabled) {
            ColorStateList colorStateList4 = this.K0;
            int colorForState = colorStateList4 != null ? colorStateList4.getColorForState(new int[]{-16842910}, this.f10344U0) : this.f10344U0;
            bVar.h(ColorStateList.valueOf(colorForState));
            ColorStateList colorStateListValueOf = ColorStateList.valueOf(colorForState);
            if (bVar.f16813k != colorStateListValueOf) {
                bVar.f16813k = colorStateListValueOf;
                bVar.g();
            }
        } else if (zE) {
            C1190H c1190h2 = oVar.f19334l;
            bVar.h(c1190h2 != null ? c1190h2.getTextColors() : null);
        } else if (this.f10308B && (c1190h = this.f10310C) != null) {
            bVar.h(c1190h.getTextColors());
        } else if (z11 && (colorStateList = this.f10326L0) != null) {
            bVar.h(colorStateList);
        }
        if (z10 || !this.f10348X0 || (isEnabled() && z11)) {
            if (z9 || this.f10346V0) {
                ValueAnimator valueAnimator = this.f10350Z0;
                if (valueAnimator != null && valueAnimator.isRunning()) {
                    this.f10350Z0.cancel();
                }
                if (z8 && this.f10349Y0) {
                    a(1.0f);
                } else {
                    bVar.i(1.0f);
                }
                this.f10346V0 = false;
                if (f()) {
                    i();
                }
                EditText editText3 = this.f10375u;
                t(editText3 != null ? editText3.getText().length() : 0);
                v();
                y();
                return;
            }
            return;
        }
        if (z9 || !this.f10346V0) {
            ValueAnimator valueAnimator2 = this.f10350Z0;
            if (valueAnimator2 != null && valueAnimator2.isRunning()) {
                this.f10350Z0.cancel();
            }
            if (z8 && this.f10349Y0) {
                a(0.0f);
            } else {
                bVar.i(0.0f);
            }
            if (f() && !((z3.g) this.f10341T).f19296O.isEmpty() && f()) {
                ((z3.g) this.f10341T).m(0.0f, 0.0f, 0.0f, 0.0f);
            }
            this.f10346V0 = true;
            C1190H c1190h3 = this.H;
            if (c1190h3 != null && this.f10317G) {
                c1190h3.setText((CharSequence) null);
                this.H.setVisibility(4);
            }
            v();
            y();
        }
    }

    public void setBoxBackgroundColor(int i) {
        if (this.f10359h0 != i) {
            this.f10359h0 = i;
            this.f10336Q0 = i;
            this.f10340S0 = i;
            this.f10342T0 = i;
            b();
        }
    }

    public void setBoxBackgroundColorResource(int i) {
        setBoxBackgroundColor(getContext().getColor(i));
    }

    public void setBoxBackgroundColorStateList(ColorStateList colorStateList) {
        int defaultColor = colorStateList.getDefaultColor();
        this.f10336Q0 = defaultColor;
        this.f10359h0 = defaultColor;
        this.f10338R0 = colorStateList.getColorForState(new int[]{-16842910}, -1);
        this.f10340S0 = colorStateList.getColorForState(new int[]{android.R.attr.state_focused, android.R.attr.state_enabled}, -1);
        this.f10342T0 = colorStateList.getColorForState(new int[]{android.R.attr.state_hovered, android.R.attr.state_enabled}, -1);
        b();
    }

    public void setBoxBackgroundMode(int i) {
        if (i == this.f10352b0) {
            return;
        }
        this.f10352b0 = i;
        if (this.f10375u != null) {
            h();
        }
    }

    public void setBoxStrokeColor(int i) {
        if (this.f10332O0 != i) {
            this.f10332O0 = i;
            z();
        }
    }

    public void setBoxStrokeColorStateList(ColorStateList colorStateList) {
        if (colorStateList.isStateful()) {
            this.f10328M0 = colorStateList.getDefaultColor();
            this.f10344U0 = colorStateList.getColorForState(new int[]{-16842910}, -1);
            this.f10330N0 = colorStateList.getColorForState(new int[]{android.R.attr.state_hovered, android.R.attr.state_enabled}, -1);
            this.f10332O0 = colorStateList.getColorForState(new int[]{android.R.attr.state_focused, android.R.attr.state_enabled}, -1);
        } else if (this.f10332O0 != colorStateList.getDefaultColor()) {
            this.f10332O0 = colorStateList.getDefaultColor();
        }
        z();
    }

    public void setBoxStrokeErrorColor(ColorStateList colorStateList) {
        if (this.f10334P0 != colorStateList) {
            this.f10334P0 = colorStateList;
            z();
        }
    }

    public void setBoxStrokeWidth(int i) {
        this.f10356e0 = i;
        z();
    }

    public void setBoxStrokeWidthFocused(int i) {
        this.f10357f0 = i;
        z();
    }

    public void setBoxStrokeWidthFocusedResource(int i) {
        setBoxStrokeWidthFocused(getResources().getDimensionPixelSize(i));
    }

    public void setBoxStrokeWidthResource(int i) {
        setBoxStrokeWidth(getResources().getDimensionPixelSize(i));
    }

    public void setCounterEnabled(boolean z8) {
        if (this.f10385z != z8) {
            o oVar = this.f10383y;
            if (z8) {
                C1190H c1190h = new C1190H(getContext(), null);
                this.f10310C = c1190h;
                c1190h.setId(R.id.textinput_counter);
                Typeface typeface = this.f10363l0;
                if (typeface != null) {
                    this.f10310C.setTypeface(typeface);
                }
                this.f10310C.setMaxLines(1);
                oVar.a(this.f10310C, 2);
                ((ViewGroup.MarginLayoutParams) this.f10310C.getLayoutParams()).setMarginStart(getResources().getDimensionPixelOffset(R.dimen.mtrl_textinput_counter_margin_start));
                o();
                if (this.f10310C != null) {
                    EditText editText = this.f10375u;
                    n(editText == null ? 0 : editText.getText().length());
                }
            } else {
                oVar.h(this.f10310C, 2);
                this.f10310C = null;
            }
            this.f10385z = z8;
        }
    }

    public void setCounterMaxLength(int i) {
        if (this.f10306A != i) {
            if (i > 0) {
                this.f10306A = i;
            } else {
                this.f10306A = -1;
            }
            if (!this.f10385z || this.f10310C == null) {
                return;
            }
            EditText editText = this.f10375u;
            n(editText == null ? 0 : editText.getText().length());
        }
    }

    public void setCounterOverflowTextAppearance(int i) {
        if (this.D != i) {
            this.D = i;
            o();
        }
    }

    public void setCounterOverflowTextColor(ColorStateList colorStateList) {
        if (this.f10325L != colorStateList) {
            this.f10325L = colorStateList;
            o();
        }
    }

    public void setCounterTextAppearance(int i) {
        if (this.f10313E != i) {
            this.f10313E = i;
            o();
        }
    }

    public void setCounterTextColor(ColorStateList colorStateList) {
        if (this.f10324K != colorStateList) {
            this.f10324K = colorStateList;
            o();
        }
    }

    public void setDefaultHintTextColor(ColorStateList colorStateList) {
        this.K0 = colorStateList;
        this.f10326L0 = colorStateList;
        if (this.f10375u != null) {
            s(false, false);
        }
    }

    @Override // android.view.View
    public void setEnabled(boolean z8) {
        j(this, z8);
        super.setEnabled(z8);
    }

    public void setEndIconActivated(boolean z8) {
        this.f10382x0.setActivated(z8);
    }

    public void setEndIconCheckable(boolean z8) {
        this.f10382x0.setCheckable(z8);
    }

    public void setEndIconContentDescription(int i) {
        setEndIconContentDescription(i != 0 ? getResources().getText(i) : null);
    }

    public void setEndIconDrawable(int i) {
        setEndIconDrawable(i != 0 ? android.support.v4.media.session.a.l(getContext(), i) : null);
    }

    public void setEndIconMode(int i) {
        int i5 = this.f10378v0;
        this.f10378v0 = i;
        for (z3.b bVar : this.f10384y0) {
            switch (bVar.f19283a) {
                case u0.f15495q /* 0 */:
                    EditText editText = getEditText();
                    if (editText != null && i5 == 2) {
                        editText.post(new g3.p(bVar, editText, 4, false));
                        if (editText.getOnFocusChangeListener() == ((e) bVar.f19284b).f19290e) {
                            editText.setOnFocusChangeListener(null);
                        }
                    }
                    break;
                case 1:
                    AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) getEditText();
                    if (autoCompleteTextView != null && i5 == 3) {
                        autoCompleteTextView.post(new g3.p(bVar, autoCompleteTextView, 6, false));
                        if (autoCompleteTextView.getOnFocusChangeListener() == ((l) bVar.f19284b).f19305e) {
                            autoCompleteTextView.setOnFocusChangeListener(null);
                        }
                        autoCompleteTextView.setOnTouchListener(null);
                        autoCompleteTextView.setOnDismissListener(null);
                    }
                    break;
                default:
                    EditText editText2 = getEditText();
                    if (editText2 != null && i5 == 1) {
                        editText2.setTransformationMethod(PasswordTransformationMethod.getInstance());
                        editText2.post(new g3.p(bVar, editText2, 7, false));
                    }
                    break;
            }
        }
        setEndIconVisible(i != 0);
        if (!getEndIconDelegate().b(this.f10352b0)) {
            throw new IllegalStateException("The current box background mode " + this.f10352b0 + " is not supported by the end icon mode " + i);
        }
        getEndIconDelegate().a();
        c();
    }

    public void setEndIconOnClickListener(View.OnClickListener onClickListener) {
        View.OnLongClickListener onLongClickListener = this.f10318G0;
        CheckableImageButton checkableImageButton = this.f10382x0;
        checkableImageButton.setOnClickListener(onClickListener);
        l(checkableImageButton, onLongClickListener);
    }

    public void setEndIconOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        this.f10318G0 = onLongClickListener;
        CheckableImageButton checkableImageButton = this.f10382x0;
        checkableImageButton.setOnLongClickListener(onLongClickListener);
        l(checkableImageButton, onLongClickListener);
    }

    public void setEndIconTintList(ColorStateList colorStateList) {
        if (this.f10386z0 != colorStateList) {
            this.f10386z0 = colorStateList;
            this.f10307A0 = true;
            c();
        }
    }

    public void setEndIconTintMode(PorterDuff.Mode mode) {
        if (this.f10309B0 != mode) {
            this.f10309B0 = mode;
            this.f10311C0 = true;
            c();
        }
    }

    public void setEndIconVisible(boolean z8) {
        if (g() != z8) {
            this.f10382x0.setVisibility(z8 ? 0 : 8);
            x();
            p();
        }
    }

    public void setError(CharSequence charSequence) {
        o oVar = this.f10383y;
        if (!oVar.f19333k) {
            if (TextUtils.isEmpty(charSequence)) {
                return;
            } else {
                setErrorEnabled(true);
            }
        }
        if (TextUtils.isEmpty(charSequence)) {
            oVar.g();
            return;
        }
        oVar.c();
        oVar.f19332j = charSequence;
        oVar.f19334l.setText(charSequence);
        int i = oVar.f19331h;
        if (i != 1) {
            oVar.i = 1;
        }
        oVar.j(i, oVar.i, oVar.i(oVar.f19334l, charSequence));
    }

    public void setErrorContentDescription(CharSequence charSequence) {
        o oVar = this.f10383y;
        oVar.f19335m = charSequence;
        C1190H c1190h = oVar.f19334l;
        if (c1190h != null) {
            c1190h.setContentDescription(charSequence);
        }
    }

    public void setErrorEnabled(boolean z8) {
        o oVar = this.f10383y;
        if (oVar.f19333k == z8) {
            return;
        }
        oVar.c();
        TextInputLayout textInputLayout = oVar.f19325b;
        if (z8) {
            C1190H c1190h = new C1190H(oVar.f19324a, null);
            oVar.f19334l = c1190h;
            c1190h.setId(R.id.textinput_error);
            oVar.f19334l.setTextAlignment(5);
            Typeface typeface = oVar.f19343u;
            if (typeface != null) {
                oVar.f19334l.setTypeface(typeface);
            }
            int i = oVar.f19336n;
            oVar.f19336n = i;
            C1190H c1190h2 = oVar.f19334l;
            if (c1190h2 != null) {
                textInputLayout.m(c1190h2, i);
            }
            ColorStateList colorStateList = oVar.f19337o;
            oVar.f19337o = colorStateList;
            C1190H c1190h3 = oVar.f19334l;
            if (c1190h3 != null && colorStateList != null) {
                c1190h3.setTextColor(colorStateList);
            }
            CharSequence charSequence = oVar.f19335m;
            oVar.f19335m = charSequence;
            C1190H c1190h4 = oVar.f19334l;
            if (c1190h4 != null) {
                c1190h4.setContentDescription(charSequence);
            }
            oVar.f19334l.setVisibility(4);
            oVar.f19334l.setAccessibilityLiveRegion(1);
            oVar.a(oVar.f19334l, 0);
        } else {
            oVar.g();
            oVar.h(oVar.f19334l, 0);
            oVar.f19334l = null;
            textInputLayout.q();
            textInputLayout.z();
        }
        oVar.f19333k = z8;
    }

    public void setErrorIconDrawable(int i) {
        setErrorIconDrawable(i != 0 ? android.support.v4.media.session.a.l(getContext(), i) : null);
        k(this.f10321I0, this.f10323J0);
    }

    public void setErrorIconOnClickListener(View.OnClickListener onClickListener) {
        View.OnLongClickListener onLongClickListener = this.f10319H0;
        CheckableImageButton checkableImageButton = this.f10321I0;
        checkableImageButton.setOnClickListener(onClickListener);
        l(checkableImageButton, onLongClickListener);
    }

    public void setErrorIconOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        this.f10319H0 = onLongClickListener;
        CheckableImageButton checkableImageButton = this.f10321I0;
        checkableImageButton.setOnLongClickListener(onLongClickListener);
        l(checkableImageButton, onLongClickListener);
    }

    public void setErrorIconTintList(ColorStateList colorStateList) {
        this.f10323J0 = colorStateList;
        CheckableImageButton checkableImageButton = this.f10321I0;
        Drawable drawable = checkableImageButton.getDrawable();
        if (drawable != null) {
            drawable = drawable.mutate();
            drawable.setTintList(colorStateList);
        }
        if (checkableImageButton.getDrawable() != drawable) {
            checkableImageButton.setImageDrawable(drawable);
        }
    }

    public void setErrorIconTintMode(PorterDuff.Mode mode) {
        CheckableImageButton checkableImageButton = this.f10321I0;
        Drawable drawable = checkableImageButton.getDrawable();
        if (drawable != null) {
            drawable = drawable.mutate();
            drawable.setTintMode(mode);
        }
        if (checkableImageButton.getDrawable() != drawable) {
            checkableImageButton.setImageDrawable(drawable);
        }
    }

    public void setErrorTextAppearance(int i) {
        o oVar = this.f10383y;
        oVar.f19336n = i;
        C1190H c1190h = oVar.f19334l;
        if (c1190h != null) {
            oVar.f19325b.m(c1190h, i);
        }
    }

    public void setErrorTextColor(ColorStateList colorStateList) {
        o oVar = this.f10383y;
        oVar.f19337o = colorStateList;
        C1190H c1190h = oVar.f19334l;
        if (c1190h == null || colorStateList == null) {
            return;
        }
        c1190h.setTextColor(colorStateList);
    }

    public void setExpandedHintEnabled(boolean z8) {
        if (this.f10348X0 != z8) {
            this.f10348X0 = z8;
            s(false, false);
        }
    }

    public void setHelperText(CharSequence charSequence) {
        boolean zIsEmpty = TextUtils.isEmpty(charSequence);
        o oVar = this.f10383y;
        if (zIsEmpty) {
            if (oVar.f19339q) {
                setHelperTextEnabled(false);
                return;
            }
            return;
        }
        if (!oVar.f19339q) {
            setHelperTextEnabled(true);
        }
        oVar.c();
        oVar.f19338p = charSequence;
        oVar.f19340r.setText(charSequence);
        int i = oVar.f19331h;
        if (i != 2) {
            oVar.i = 2;
        }
        oVar.j(i, oVar.i, oVar.i(oVar.f19340r, charSequence));
    }

    public void setHelperTextColor(ColorStateList colorStateList) {
        o oVar = this.f10383y;
        oVar.f19342t = colorStateList;
        C1190H c1190h = oVar.f19340r;
        if (c1190h == null || colorStateList == null) {
            return;
        }
        c1190h.setTextColor(colorStateList);
    }

    public void setHelperTextEnabled(boolean z8) {
        o oVar = this.f10383y;
        if (oVar.f19339q == z8) {
            return;
        }
        oVar.c();
        if (z8) {
            C1190H c1190h = new C1190H(oVar.f19324a, null);
            oVar.f19340r = c1190h;
            c1190h.setId(R.id.textinput_helper_text);
            oVar.f19340r.setTextAlignment(5);
            Typeface typeface = oVar.f19343u;
            if (typeface != null) {
                oVar.f19340r.setTypeface(typeface);
            }
            oVar.f19340r.setVisibility(4);
            oVar.f19340r.setAccessibilityLiveRegion(1);
            int i = oVar.f19341s;
            oVar.f19341s = i;
            C1190H c1190h2 = oVar.f19340r;
            if (c1190h2 != null) {
                c1190h2.setTextAppearance(i);
            }
            ColorStateList colorStateList = oVar.f19342t;
            oVar.f19342t = colorStateList;
            C1190H c1190h3 = oVar.f19340r;
            if (c1190h3 != null && colorStateList != null) {
                c1190h3.setTextColor(colorStateList);
            }
            oVar.a(oVar.f19340r, 1);
        } else {
            oVar.c();
            int i5 = oVar.f19331h;
            if (i5 == 2) {
                oVar.i = 0;
            }
            oVar.j(i5, oVar.i, oVar.i(oVar.f19340r, null));
            oVar.h(oVar.f19340r, 1);
            oVar.f19340r = null;
            TextInputLayout textInputLayout = oVar.f19325b;
            textInputLayout.q();
            textInputLayout.z();
        }
        oVar.f19339q = z8;
    }

    public void setHelperTextTextAppearance(int i) {
        o oVar = this.f10383y;
        oVar.f19341s = i;
        C1190H c1190h = oVar.f19340r;
        if (c1190h != null) {
            c1190h.setTextAppearance(i);
        }
    }

    public void setHint(CharSequence charSequence) {
        if (this.f10335Q) {
            setHintInternal(charSequence);
            sendAccessibilityEvent(2048);
        }
    }

    public void setHintAnimationEnabled(boolean z8) {
        this.f10349Y0 = z8;
    }

    public void setHintEnabled(boolean z8) {
        if (z8 != this.f10335Q) {
            this.f10335Q = z8;
            if (z8) {
                CharSequence hint = this.f10375u.getHint();
                if (!TextUtils.isEmpty(hint)) {
                    if (TextUtils.isEmpty(this.f10337R)) {
                        setHint(hint);
                    }
                    this.f10375u.setHint((CharSequence) null);
                }
                this.f10339S = true;
            } else {
                this.f10339S = false;
                if (!TextUtils.isEmpty(this.f10337R) && TextUtils.isEmpty(this.f10375u.getHint())) {
                    this.f10375u.setHint(this.f10337R);
                }
                setHintInternal(null);
            }
            if (this.f10375u != null) {
                r();
            }
        }
    }

    public void setHintTextAppearance(int i) {
        b bVar = this.W0;
        TextInputLayout textInputLayout = bVar.f16804a;
        C1599d c1599d = new C1599d(textInputLayout.getContext(), i);
        ColorStateList colorStateList = c1599d.f17473a;
        if (colorStateList != null) {
            bVar.f16814l = colorStateList;
        }
        float f3 = c1599d.f17482k;
        if (f3 != 0.0f) {
            bVar.f16812j = f3;
        }
        ColorStateList colorStateList2 = c1599d.f17474b;
        if (colorStateList2 != null) {
            bVar.f16800L = colorStateList2;
        }
        bVar.f16798J = c1599d.f17478f;
        bVar.f16799K = c1599d.f17479g;
        bVar.f16797I = c1599d.f17480h;
        bVar.f16801M = c1599d.f17481j;
        C1596a c1596a = bVar.f16824v;
        if (c1596a != null) {
            c1596a.f17467h = true;
        }
        C1139a c1139a = new C1139a(bVar);
        c1599d.a();
        bVar.f16824v = new C1596a(c1139a, c1599d.f17485n);
        c1599d.c(textInputLayout.getContext(), bVar.f16824v);
        bVar.g();
        this.f10326L0 = bVar.f16814l;
        if (this.f10375u != null) {
            s(false, false);
            r();
        }
    }

    public void setHintTextColor(ColorStateList colorStateList) {
        if (this.f10326L0 != colorStateList) {
            if (this.K0 == null) {
                this.W0.h(colorStateList);
            }
            this.f10326L0 = colorStateList;
            if (this.f10375u != null) {
                s(false, false);
            }
        }
    }

    public void setMaxWidth(int i) {
        this.f10381x = i;
        EditText editText = this.f10375u;
        if (editText == null || i == -1) {
            return;
        }
        editText.setMaxWidth(i);
    }

    public void setMaxWidthResource(int i) {
        setMaxWidth(getContext().getResources().getDimensionPixelSize(i));
    }

    public void setMinWidth(int i) {
        this.f10379w = i;
        EditText editText = this.f10375u;
        if (editText == null || i == -1) {
            return;
        }
        editText.setMinWidth(i);
    }

    public void setMinWidthResource(int i) {
        setMinWidth(getContext().getResources().getDimensionPixelSize(i));
    }

    @Deprecated
    public void setPasswordVisibilityToggleContentDescription(int i) {
        setPasswordVisibilityToggleContentDescription(i != 0 ? getResources().getText(i) : null);
    }

    @Deprecated
    public void setPasswordVisibilityToggleDrawable(int i) {
        setPasswordVisibilityToggleDrawable(i != 0 ? android.support.v4.media.session.a.l(getContext(), i) : null);
    }

    @Deprecated
    public void setPasswordVisibilityToggleEnabled(boolean z8) {
        if (z8 && this.f10378v0 != 1) {
            setEndIconMode(1);
        } else {
            if (z8) {
                return;
            }
            setEndIconMode(0);
        }
    }

    @Deprecated
    public void setPasswordVisibilityToggleTintList(ColorStateList colorStateList) {
        this.f10386z0 = colorStateList;
        this.f10307A0 = true;
        c();
    }

    @Deprecated
    public void setPasswordVisibilityToggleTintMode(PorterDuff.Mode mode) {
        this.f10309B0 = mode;
        this.f10311C0 = true;
        c();
    }

    public void setPlaceholderText(CharSequence charSequence) {
        if (this.f10317G && TextUtils.isEmpty(charSequence)) {
            setPlaceholderTextEnabled(false);
        } else {
            if (!this.f10317G) {
                setPlaceholderTextEnabled(true);
            }
            this.f10315F = charSequence;
        }
        EditText editText = this.f10375u;
        t(editText != null ? editText.getText().length() : 0);
    }

    public void setPlaceholderTextAppearance(int i) {
        this.f10322J = i;
        C1190H c1190h = this.H;
        if (c1190h != null) {
            c1190h.setTextAppearance(i);
        }
    }

    public void setPlaceholderTextColor(ColorStateList colorStateList) {
        if (this.f10320I != colorStateList) {
            this.f10320I = colorStateList;
            C1190H c1190h = this.H;
            if (c1190h == null || colorStateList == null) {
                return;
            }
            c1190h.setTextColor(colorStateList);
        }
    }

    public void setPrefixText(CharSequence charSequence) {
        this.f10327M = TextUtils.isEmpty(charSequence) ? null : charSequence;
        this.f10329N.setText(charSequence);
        v();
    }

    public void setPrefixTextAppearance(int i) {
        this.f10329N.setTextAppearance(i);
    }

    public void setPrefixTextColor(ColorStateList colorStateList) {
        this.f10329N.setTextColor(colorStateList);
    }

    public void setStartIconCheckable(boolean z8) {
        this.f10364m0.setCheckable(z8);
    }

    public void setStartIconContentDescription(int i) {
        setStartIconContentDescription(i != 0 ? getResources().getText(i) : null);
    }

    public void setStartIconDrawable(int i) {
        setStartIconDrawable(i != 0 ? android.support.v4.media.session.a.l(getContext(), i) : null);
    }

    public void setStartIconOnClickListener(View.OnClickListener onClickListener) {
        View.OnLongClickListener onLongClickListener = this.f10374t0;
        CheckableImageButton checkableImageButton = this.f10364m0;
        checkableImageButton.setOnClickListener(onClickListener);
        l(checkableImageButton, onLongClickListener);
    }

    public void setStartIconOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        this.f10374t0 = onLongClickListener;
        CheckableImageButton checkableImageButton = this.f10364m0;
        checkableImageButton.setOnLongClickListener(onLongClickListener);
        l(checkableImageButton, onLongClickListener);
    }

    public void setStartIconTintList(ColorStateList colorStateList) {
        if (this.f10365n0 != colorStateList) {
            this.f10365n0 = colorStateList;
            this.f10366o0 = true;
            d(this.f10364m0, true, colorStateList, this.q0, this.f10367p0);
        }
    }

    public void setStartIconTintMode(PorterDuff.Mode mode) {
        if (this.f10367p0 != mode) {
            this.f10367p0 = mode;
            this.q0 = true;
            d(this.f10364m0, this.f10366o0, this.f10365n0, true, mode);
        }
    }

    public void setStartIconVisible(boolean z8) {
        CheckableImageButton checkableImageButton = this.f10364m0;
        if ((checkableImageButton.getVisibility() == 0) != z8) {
            checkableImageButton.setVisibility(z8 ? 0 : 8);
            u();
            p();
        }
    }

    public void setSuffixText(CharSequence charSequence) {
        this.f10331O = TextUtils.isEmpty(charSequence) ? null : charSequence;
        this.f10333P.setText(charSequence);
        y();
    }

    public void setSuffixTextAppearance(int i) {
        this.f10333P.setTextAppearance(i);
    }

    public void setSuffixTextColor(ColorStateList colorStateList) {
        this.f10333P.setTextColor(colorStateList);
    }

    public void setTextInputAccessibilityDelegate(r rVar) {
        EditText editText = this.f10375u;
        if (editText != null) {
            J.j(editText, rVar);
        }
    }

    public void setTypeface(Typeface typeface) {
        boolean z8;
        if (typeface != this.f10363l0) {
            this.f10363l0 = typeface;
            b bVar = this.W0;
            C1596a c1596a = bVar.f16824v;
            boolean z9 = true;
            if (c1596a != null) {
                c1596a.f17467h = true;
            }
            if (bVar.f16821s != typeface) {
                bVar.f16821s = typeface;
                z8 = true;
            } else {
                z8 = false;
            }
            if (bVar.f16822t != typeface) {
                bVar.f16822t = typeface;
            } else {
                z9 = false;
            }
            if (z8 || z9) {
                bVar.g();
            }
            o oVar = this.f10383y;
            if (typeface != oVar.f19343u) {
                oVar.f19343u = typeface;
                C1190H c1190h = oVar.f19334l;
                if (c1190h != null) {
                    c1190h.setTypeface(typeface);
                }
                C1190H c1190h2 = oVar.f19340r;
                if (c1190h2 != null) {
                    c1190h2.setTypeface(typeface);
                }
            }
            C1190H c1190h3 = this.f10310C;
            if (c1190h3 != null) {
                c1190h3.setTypeface(typeface);
            }
        }
    }

    public final void t(int i) {
        if (i != 0 || this.f10346V0) {
            C1190H c1190h = this.H;
            if (c1190h == null || !this.f10317G) {
                return;
            }
            c1190h.setText((CharSequence) null);
            this.H.setVisibility(4);
            return;
        }
        C1190H c1190h2 = this.H;
        if (c1190h2 == null || !this.f10317G) {
            return;
        }
        c1190h2.setText(this.f10315F);
        this.H.setVisibility(0);
        this.H.bringToFront();
    }

    public final void u() {
        int paddingStart;
        if (this.f10375u == null) {
            return;
        }
        if (this.f10364m0.getVisibility() == 0) {
            paddingStart = 0;
        } else {
            EditText editText = this.f10375u;
            Field field = J.f4065a;
            paddingStart = editText.getPaddingStart();
        }
        C1190H c1190h = this.f10329N;
        int compoundPaddingTop = this.f10375u.getCompoundPaddingTop();
        int dimensionPixelSize = getContext().getResources().getDimensionPixelSize(R.dimen.material_input_text_to_prefix_suffix_padding);
        int compoundPaddingBottom = this.f10375u.getCompoundPaddingBottom();
        Field field2 = J.f4065a;
        c1190h.setPaddingRelative(paddingStart, compoundPaddingTop, dimensionPixelSize, compoundPaddingBottom);
    }

    public final void v() {
        this.f10329N.setVisibility((this.f10327M == null || this.f10346V0) ? 8 : 0);
        p();
    }

    public final void w(boolean z8, boolean z9) {
        int defaultColor = this.f10334P0.getDefaultColor();
        int colorForState = this.f10334P0.getColorForState(new int[]{android.R.attr.state_hovered, android.R.attr.state_enabled}, defaultColor);
        int colorForState2 = this.f10334P0.getColorForState(new int[]{android.R.attr.state_activated, android.R.attr.state_enabled}, defaultColor);
        if (z8) {
            this.f10358g0 = colorForState2;
        } else if (z9) {
            this.f10358g0 = colorForState;
        } else {
            this.f10358g0 = defaultColor;
        }
    }

    public final void x() {
        int paddingEnd;
        if (this.f10375u == null) {
            return;
        }
        if (g() || this.f10321I0.getVisibility() == 0) {
            paddingEnd = 0;
        } else {
            EditText editText = this.f10375u;
            Field field = J.f4065a;
            paddingEnd = editText.getPaddingEnd();
        }
        C1190H c1190h = this.f10333P;
        int dimensionPixelSize = getContext().getResources().getDimensionPixelSize(R.dimen.material_input_text_to_prefix_suffix_padding);
        int paddingTop = this.f10375u.getPaddingTop();
        int paddingBottom = this.f10375u.getPaddingBottom();
        Field field2 = J.f4065a;
        c1190h.setPaddingRelative(dimensionPixelSize, paddingTop, paddingEnd, paddingBottom);
    }

    public final void y() {
        C1190H c1190h = this.f10333P;
        int visibility = c1190h.getVisibility();
        boolean z8 = (this.f10331O == null || this.f10346V0) ? false : true;
        c1190h.setVisibility(z8 ? 0 : 8);
        if (visibility != c1190h.getVisibility()) {
            getEndIconDelegate().c(z8);
        }
        p();
    }

    public final void z() {
        C1190H c1190h;
        EditText editText;
        EditText editText2;
        if (this.f10341T == null || this.f10352b0 == 0) {
            return;
        }
        boolean z8 = false;
        boolean z9 = isFocused() || ((editText2 = this.f10375u) != null && editText2.hasFocus());
        boolean z10 = isHovered() || ((editText = this.f10375u) != null && editText.isHovered());
        boolean zIsEnabled = isEnabled();
        o oVar = this.f10383y;
        if (!zIsEnabled) {
            this.f10358g0 = this.f10344U0;
        } else if (oVar.e()) {
            if (this.f10334P0 != null) {
                w(z9, z10);
            } else {
                C1190H c1190h2 = oVar.f19334l;
                this.f10358g0 = c1190h2 != null ? c1190h2.getCurrentTextColor() : -1;
            }
        } else if (!this.f10308B || (c1190h = this.f10310C) == null) {
            if (z9) {
                this.f10358g0 = this.f10332O0;
            } else if (z10) {
                this.f10358g0 = this.f10330N0;
            } else {
                this.f10358g0 = this.f10328M0;
            }
        } else if (this.f10334P0 != null) {
            w(z9, z10);
        } else {
            this.f10358g0 = c1190h.getCurrentTextColor();
        }
        if (getErrorIconDrawable() != null && oVar.f19333k && oVar.e()) {
            z8 = true;
        }
        setErrorIconVisible(z8);
        k(this.f10321I0, this.f10323J0);
        k(this.f10364m0, this.f10365n0);
        ColorStateList colorStateList = this.f10386z0;
        CheckableImageButton checkableImageButton = this.f10382x0;
        k(checkableImageButton, colorStateList);
        m endIconDelegate = getEndIconDelegate();
        endIconDelegate.getClass();
        if (endIconDelegate instanceof l) {
            if (!oVar.e() || getEndIconDrawable() == null) {
                c();
            } else {
                Drawable drawableMutate = getEndIconDrawable().mutate();
                C1190H c1190h3 = oVar.f19334l;
                drawableMutate.setTint(c1190h3 != null ? c1190h3.getCurrentTextColor() : -1);
                checkableImageButton.setImageDrawable(drawableMutate);
            }
        }
        if (z9 && isEnabled()) {
            this.f10355d0 = this.f10357f0;
        } else {
            this.f10355d0 = this.f10356e0;
        }
        if (this.f10352b0 == 2 && f() && !this.f10346V0 && this.f10351a0 != this.f10355d0) {
            if (f()) {
                ((z3.g) this.f10341T).m(0.0f, 0.0f, 0.0f, 0.0f);
            }
            i();
        }
        if (this.f10352b0 == 1) {
            if (!isEnabled()) {
                this.f10359h0 = this.f10338R0;
            } else if (z10 && !z9) {
                this.f10359h0 = this.f10342T0;
            } else if (z9) {
                this.f10359h0 = this.f10340S0;
            } else {
                this.f10359h0 = this.f10336Q0;
            }
        }
        b();
    }

    public void setEndIconContentDescription(CharSequence charSequence) {
        if (getEndIconContentDescription() != charSequence) {
            this.f10382x0.setContentDescription(charSequence);
        }
    }

    public void setEndIconDrawable(Drawable drawable) {
        CheckableImageButton checkableImageButton = this.f10382x0;
        checkableImageButton.setImageDrawable(drawable);
        k(checkableImageButton, this.f10386z0);
    }

    public void setStartIconContentDescription(CharSequence charSequence) {
        if (getStartIconContentDescription() != charSequence) {
            this.f10364m0.setContentDescription(charSequence);
        }
    }

    public void setStartIconDrawable(Drawable drawable) {
        CheckableImageButton checkableImageButton = this.f10364m0;
        checkableImageButton.setImageDrawable(drawable);
        if (drawable != null) {
            setStartIconVisible(true);
            k(checkableImageButton, this.f10365n0);
        } else {
            setStartIconVisible(false);
            setStartIconOnClickListener(null);
            setStartIconOnLongClickListener(null);
            setStartIconContentDescription((CharSequence) null);
        }
    }

    public void setErrorIconDrawable(Drawable drawable) {
        this.f10321I0.setImageDrawable(drawable);
        setErrorIconVisible(drawable != null && this.f10383y.f19333k);
    }

    @Deprecated
    public void setPasswordVisibilityToggleContentDescription(CharSequence charSequence) {
        this.f10382x0.setContentDescription(charSequence);
    }

    @Deprecated
    public void setPasswordVisibilityToggleDrawable(Drawable drawable) {
        this.f10382x0.setImageDrawable(drawable);
    }

    public void setHint(int i) {
        setHint(i != 0 ? getResources().getText(i) : null);
    }
}
