package com.google.android.material.textfield;

import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Canvas;
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.Parcel;
import android.os.Parcelable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStructure;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.android.material.internal.CheckableImageButton;
import com.ifpdos.udi.service.core.pc.R;
import d.b.g.b0;
import d.b.g.g0;
import d.h.c.a;
import d.h.j.y;
import g.e.a.a.w.j;
import g.e.a.a.z.m;
import g.e.a.a.z.n;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;

/* JADX INFO: loaded from: classes.dex */
public class TextInputLayout extends LinearLayout {
    public CharSequence A;
    public Drawable A0;
    public boolean B;
    public View.OnLongClickListener B0;
    public TextView C;
    public View.OnLongClickListener C0;
    public ColorStateList D;
    public final CheckableImageButton D0;
    public int E;
    public ColorStateList E0;
    public ColorStateList F;
    public ColorStateList F0;
    public ColorStateList G;
    public ColorStateList G0;
    public CharSequence H;
    public int H0;
    public final TextView I;
    public int I0;
    public CharSequence J;
    public int J0;
    public final TextView K;
    public ColorStateList K0;
    public boolean L;
    public int L0;
    public CharSequence M;
    public int M0;
    public boolean N;
    public int N0;
    public g.e.a.a.w.g O;
    public int O0;
    public g.e.a.a.w.g P;
    public int P0;
    public j Q;
    public boolean Q0;
    public final int R;
    public final g.e.a.a.r.c R0;
    public int S;
    public boolean S0;
    public int T;
    public boolean T0;
    public int U;
    public ValueAnimator U0;
    public int V;
    public boolean V0;
    public int W;
    public boolean W0;

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

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

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

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    public final Rect f1152d0;
    public final Rect e0;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final FrameLayout f1153f;
    public final RectF f0;
    public Typeface g0;
    public final CheckableImageButton h0;
    public ColorStateList i0;
    public boolean j0;
    public PorterDuff.Mode k0;
    public boolean l0;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final LinearLayout f1154m;
    public Drawable m0;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final LinearLayout f1155n;
    public int n0;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final FrameLayout f1156o;
    public View.OnLongClickListener o0;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public EditText f1157p;
    public final LinkedHashSet<f> p0;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public CharSequence f1158q;
    public int q0;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public int f1159r;
    public final SparseArray<m> r0;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public int f1160s;
    public final CheckableImageButton s0;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final n f1161t;
    public final LinkedHashSet<g> t0;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public boolean f1162u;
    public ColorStateList u0;

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

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public boolean f1164w;
    public PorterDuff.Mode w0;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public TextView f1165x;
    public boolean x0;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public int f1166y;
    public Drawable y0;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public int f1167z;
    public int z0;

    public class a implements TextWatcher {
        public a() {
        }

        @Override // android.text.TextWatcher
        public void afterTextChanged(Editable editable) {
            TextInputLayout.this.y(!r0.W0, false);
            TextInputLayout textInputLayout = TextInputLayout.this;
            if (textInputLayout.f1162u) {
                textInputLayout.t(editable.length());
            }
            TextInputLayout textInputLayout2 = TextInputLayout.this;
            if (textInputLayout2.B) {
                textInputLayout2.z(editable.length());
            }
        }

        @Override // android.text.TextWatcher
        public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
        }

        @Override // android.text.TextWatcher
        public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
        }
    }

    public class b implements Runnable {
        public b() {
        }

        @Override // java.lang.Runnable
        public void run() {
            TextInputLayout.this.s0.performClick();
            TextInputLayout.this.s0.jumpDrawablesToCurrentState();
        }
    }

    public class c implements Runnable {
        public c() {
        }

        @Override // java.lang.Runnable
        public void run() {
            TextInputLayout.this.f1157p.requestLayout();
        }
    }

    public class d implements ValueAnimator.AnimatorUpdateListener {
        public d() {
        }

        @Override // android.animation.ValueAnimator.AnimatorUpdateListener
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            TextInputLayout.this.R0.o(((Float) valueAnimator.getAnimatedValue()).floatValue());
        }
    }

    public static class e extends d.h.j.d {

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public final TextInputLayout f1171d;

        public e(TextInputLayout textInputLayout) {
            this.f1171d = textInputLayout;
        }

        @Override // d.h.j.d
        public void d(View view, d.h.j.i0.c cVar) {
            this.f2724b.onInitializeAccessibilityNodeInfo(view, cVar.a);
            EditText editText = this.f1171d.getEditText();
            Editable text = editText != null ? editText.getText() : null;
            CharSequence hint = this.f1171d.getHint();
            CharSequence error = this.f1171d.getError();
            CharSequence placeholderText = this.f1171d.getPlaceholderText();
            int counterMaxLength = this.f1171d.getCounterMaxLength();
            CharSequence counterOverflowDescription = this.f1171d.getCounterOverflowDescription();
            boolean z2 = !TextUtils.isEmpty(text);
            boolean z3 = !TextUtils.isEmpty(hint);
            boolean z4 = !this.f1171d.Q0;
            boolean z5 = !TextUtils.isEmpty(error);
            boolean z6 = z5 || !TextUtils.isEmpty(counterOverflowDescription);
            String string = z3 ? hint.toString() : "";
            if (z2) {
                cVar.a.setText(text);
            } else if (!TextUtils.isEmpty(string)) {
                cVar.a.setText(string);
                if (z4 && placeholderText != null) {
                    placeholderText = string + ", " + ((Object) placeholderText);
                    cVar.a.setText(placeholderText);
                }
            } else if (placeholderText != null) {
                cVar.a.setText(placeholderText);
            }
            if (!TextUtils.isEmpty(string)) {
                cVar.a.setHintText(string);
                cVar.a.setShowingHintText(!z2);
            }
            if (text == null || text.length() != counterMaxLength) {
                counterMaxLength = -1;
            }
            cVar.a.setMaxTextLength(counterMaxLength);
            if (z6) {
                if (!z5) {
                    error = counterOverflowDescription;
                }
                cVar.a.setError(error);
            }
            if (editText != null) {
                editText.setLabelFor(R.id.textinput_helper_text);
            }
        }
    }

    public interface f {
        void a(TextInputLayout textInputLayout);
    }

    public interface g {
        void a(TextInputLayout textInputLayout, int i2);
    }

    public static class h extends d.j.a.a {
        public static final Parcelable.Creator<h> CREATOR = new a();

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

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

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

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

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

        public static class a implements Parcelable.ClassLoaderCreator<h> {
            @Override // android.os.Parcelable.Creator
            public Object createFromParcel(Parcel parcel) {
                return new h(parcel, null);
            }

            @Override // android.os.Parcelable.Creator
            public Object[] newArray(int i2) {
                return new h[i2];
            }

            @Override // android.os.Parcelable.ClassLoaderCreator
            public h createFromParcel(Parcel parcel, ClassLoader classLoader) {
                return new h(parcel, classLoader);
            }
        }

        public h(Parcel parcel, ClassLoader classLoader) {
            super(parcel, classLoader);
            this.f1172n = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.f1173o = parcel.readInt() == 1;
            this.f1174p = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.f1175q = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.f1176r = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
        }

        public h(Parcelable parcelable) {
            super(parcelable);
        }

        public String toString() {
            StringBuilder sbF = g.a.a.a.a.F("TextInputLayout.SavedState{");
            sbF.append(Integer.toHexString(System.identityHashCode(this)));
            sbF.append(" error=");
            sbF.append((Object) this.f1172n);
            sbF.append(" hint=");
            sbF.append((Object) this.f1174p);
            sbF.append(" helperText=");
            sbF.append((Object) this.f1175q);
            sbF.append(" placeholderText=");
            sbF.append((Object) this.f1176r);
            sbF.append("}");
            return sbF.toString();
        }

        @Override // d.j.a.a, android.os.Parcelable
        public void writeToParcel(Parcel parcel, int i2) {
            parcel.writeParcelable(this.f2846m, i2);
            TextUtils.writeToParcel(this.f1172n, parcel, i2);
            parcel.writeInt(this.f1173o ? 1 : 0);
            TextUtils.writeToParcel(this.f1174p, parcel, i2);
            TextUtils.writeToParcel(this.f1175q, parcel, i2);
            TextUtils.writeToParcel(this.f1176r, parcel, i2);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:95:0x04fd  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public TextInputLayout(android.content.Context r31, android.util.AttributeSet r32) {
        /*
            Method dump skipped, instruction units count: 1596
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.textfield.TextInputLayout.<init>(android.content.Context, android.util.AttributeSet):void");
    }

    private m getEndIconDelegate() {
        m mVar = this.r0.get(this.q0);
        return mVar != null ? mVar : this.r0.get(0);
    }

    private CheckableImageButton getEndIconToUpdateDummyDrawable() {
        if (this.D0.getVisibility() == 0) {
            return this.D0;
        }
        if (j() && k()) {
            return this.s0;
        }
        return null;
    }

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

    public static void q(CheckableImageButton checkableImageButton, View.OnLongClickListener onLongClickListener) {
        AtomicInteger atomicInteger = y.a;
        boolean zA = y.b.a(checkableImageButton);
        boolean z2 = onLongClickListener != null;
        boolean z3 = zA || z2;
        checkableImageButton.setFocusable(z3);
        checkableImageButton.setClickable(zA);
        checkableImageButton.setPressable(zA);
        checkableImageButton.setLongClickable(z2);
        y.c.s(checkableImageButton, z3 ? 1 : 2);
    }

    private void setEditText(EditText editText) {
        if (this.f1157p != null) {
            throw new IllegalArgumentException("We already have an EditText, can only have one");
        }
        if (this.q0 != 3 && !(editText instanceof TextInputEditText)) {
            Log.i("TextInputLayout", "EditText added is not a TextInputEditText. Please switch to using that class instead.");
        }
        this.f1157p = editText;
        setMinWidth(this.f1159r);
        setMaxWidth(this.f1160s);
        l();
        setTextInputAccessibilityDelegate(new e(this));
        this.R0.q(this.f1157p.getTypeface());
        g.e.a.a.r.c cVar = this.R0;
        float textSize = this.f1157p.getTextSize();
        if (cVar.f3778j != textSize) {
            cVar.f3778j = textSize;
            cVar.k();
        }
        int gravity = this.f1157p.getGravity();
        this.R0.n((gravity & (-113)) | 48);
        g.e.a.a.r.c cVar2 = this.R0;
        if (cVar2.f3776h != gravity) {
            cVar2.f3776h = gravity;
            cVar2.k();
        }
        this.f1157p.addTextChangedListener(new a());
        if (this.F0 == null) {
            this.F0 = this.f1157p.getHintTextColors();
        }
        if (this.L) {
            if (TextUtils.isEmpty(this.M)) {
                CharSequence hint = this.f1157p.getHint();
                this.f1158q = hint;
                setHint(hint);
                this.f1157p.setHint((CharSequence) null);
            }
            this.N = true;
        }
        if (this.f1165x != null) {
            t(this.f1157p.getText().length());
        }
        w();
        this.f1161t.b();
        this.f1154m.bringToFront();
        this.f1155n.bringToFront();
        this.f1156o.bringToFront();
        this.D0.bringToFront();
        Iterator<f> it = this.p0.iterator();
        while (it.hasNext()) {
            it.next().a(this);
        }
        A();
        D();
        if (!isEnabled()) {
            editText.setEnabled(false);
        }
        y(false, true);
    }

    private void setErrorIconVisible(boolean z2) {
        this.D0.setVisibility(z2 ? 0 : 8);
        this.f1156o.setVisibility(z2 ? 8 : 0);
        D();
        if (j()) {
            return;
        }
        v();
    }

    private void setHintInternal(CharSequence charSequence) {
        if (TextUtils.equals(charSequence, this.M)) {
            return;
        }
        this.M = charSequence;
        g.e.a.a.r.c cVar = this.R0;
        if (charSequence == null || !TextUtils.equals(cVar.f3792x, charSequence)) {
            cVar.f3792x = charSequence;
            cVar.f3793y = null;
            Bitmap bitmap = cVar.A;
            if (bitmap != null) {
                bitmap.recycle();
                cVar.A = null;
            }
            cVar.k();
        }
        if (this.Q0) {
            return;
        }
        m();
    }

    private void setPlaceholderTextEnabled(boolean z2) {
        if (this.B == z2) {
            return;
        }
        if (z2) {
            b0 b0Var = new b0(getContext(), null);
            this.C = b0Var;
            b0Var.setId(R.id.textinput_placeholder);
            TextView textView = this.C;
            AtomicInteger atomicInteger = y.a;
            y.f.f(textView, 1);
            setPlaceholderTextAppearance(this.E);
            setPlaceholderTextColor(this.D);
            TextView textView2 = this.C;
            if (textView2 != null) {
                this.f1153f.addView(textView2);
                this.C.setVisibility(0);
            }
        } else {
            TextView textView3 = this.C;
            if (textView3 != null) {
                textView3.setVisibility(8);
            }
            this.C = null;
        }
        this.B = z2;
    }

    public final void A() {
        if (this.f1157p == null) {
            return;
        }
        int iF = 0;
        if (!(this.h0.getVisibility() == 0)) {
            EditText editText = this.f1157p;
            AtomicInteger atomicInteger = y.a;
            iF = y.d.f(editText);
        }
        TextView textView = this.I;
        int compoundPaddingTop = this.f1157p.getCompoundPaddingTop();
        int dimensionPixelSize = getContext().getResources().getDimensionPixelSize(R.dimen.material_input_text_to_prefix_suffix_padding);
        int compoundPaddingBottom = this.f1157p.getCompoundPaddingBottom();
        AtomicInteger atomicInteger2 = y.a;
        y.d.k(textView, iF, compoundPaddingTop, dimensionPixelSize, compoundPaddingBottom);
    }

    public final void B() {
        this.I.setVisibility((this.H == null || this.Q0) ? 8 : 0);
        v();
    }

    public final void C(boolean z2, boolean z3) {
        int defaultColor = this.K0.getDefaultColor();
        int colorForState = this.K0.getColorForState(new int[]{android.R.attr.state_hovered, android.R.attr.state_enabled}, defaultColor);
        int colorForState2 = this.K0.getColorForState(new int[]{android.R.attr.state_activated, android.R.attr.state_enabled}, defaultColor);
        if (z2) {
            this.f1150b0 = colorForState2;
        } else if (z3) {
            this.f1150b0 = colorForState;
        } else {
            this.f1150b0 = defaultColor;
        }
    }

    public final void D() {
        if (this.f1157p == null) {
            return;
        }
        int iE = 0;
        if (!k()) {
            if (!(this.D0.getVisibility() == 0)) {
                EditText editText = this.f1157p;
                AtomicInteger atomicInteger = y.a;
                iE = y.d.e(editText);
            }
        }
        TextView textView = this.K;
        int dimensionPixelSize = getContext().getResources().getDimensionPixelSize(R.dimen.material_input_text_to_prefix_suffix_padding);
        int paddingTop = this.f1157p.getPaddingTop();
        int paddingBottom = this.f1157p.getPaddingBottom();
        AtomicInteger atomicInteger2 = y.a;
        y.d.k(textView, dimensionPixelSize, paddingTop, iE, paddingBottom);
    }

    public final void E() {
        int visibility = this.K.getVisibility();
        boolean z2 = (this.J == null || this.Q0) ? false : true;
        this.K.setVisibility(z2 ? 0 : 8);
        if (visibility != this.K.getVisibility()) {
            getEndIconDelegate().c(z2);
        }
        v();
    }

    /* JADX WARN: Removed duplicated region for block: B:50:0x007a  */
    /* JADX WARN: Removed duplicated region for block: B:57:0x00a6  */
    /* JADX WARN: Removed duplicated region for block: B:67:0x00d9  */
    /* JADX WARN: Removed duplicated region for block: B:78:0x00f8  */
    /* JADX WARN: Removed duplicated region for block: B:82:0x0107  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void F() {
        /*
            Method dump skipped, instruction units count: 292
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.textfield.TextInputLayout.F():void");
    }

    public void a(f fVar) {
        this.p0.add(fVar);
        if (this.f1157p != null) {
            fVar.a(this);
        }
    }

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

    public void b(float f2) {
        if (this.R0.f3771c == f2) {
            return;
        }
        if (this.U0 == null) {
            ValueAnimator valueAnimator = new ValueAnimator();
            this.U0 = valueAnimator;
            valueAnimator.setInterpolator(g.e.a.a.c.a.f3566b);
            this.U0.setDuration(167L);
            this.U0.addUpdateListener(new d());
        }
        this.U0.setFloatValues(this.R0.f3771c, f2);
        this.U0.start();
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x0021  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void c() {
        /*
            r6 = this;
            g.e.a.a.w.g r0 = r6.O
            if (r0 != 0) goto L5
            return
        L5:
            g.e.a.a.w.j r1 = r6.Q
            r0.setShapeAppearanceModel(r1)
            int r0 = r6.T
            r1 = 2
            r2 = -1
            r3 = 0
            r4 = 1
            if (r0 != r1) goto L21
            int r0 = r6.V
            if (r0 <= r2) goto L1c
            int r0 = r6.f1150b0
            if (r0 == 0) goto L1c
            r0 = r4
            goto L1d
        L1c:
            r0 = r3
        L1d:
            if (r0 == 0) goto L21
            r0 = r4
            goto L22
        L21:
            r0 = r3
        L22:
            if (r0 == 0) goto L2e
            g.e.a.a.w.g r0 = r6.O
            int r1 = r6.V
            float r1 = (float) r1
            int r5 = r6.f1150b0
            r0.r(r1, r5)
        L2e:
            int r0 = r6.f1151c0
            int r1 = r6.T
            if (r1 != r4) goto L45
            r0 = 2130968802(0x7f0400e2, float:1.7546268E38)
            android.content.Context r1 = r6.getContext()
            int r0 = g.e.a.a.a.g(r1, r0, r3)
            int r1 = r6.f1151c0
            int r0 = d.h.d.a.a(r1, r0)
        L45:
            r6.f1151c0 = r0
            g.e.a.a.w.g r1 = r6.O
            android.content.res.ColorStateList r0 = android.content.res.ColorStateList.valueOf(r0)
            r1.p(r0)
            int r0 = r6.q0
            r1 = 3
            if (r0 != r1) goto L5e
            android.widget.EditText r0 = r6.f1157p
            android.graphics.drawable.Drawable r0 = r0.getBackground()
            r0.invalidateSelf()
        L5e:
            g.e.a.a.w.g r0 = r6.P
            if (r0 != 0) goto L63
            goto L7a
        L63:
            int r1 = r6.V
            if (r1 <= r2) goto L6c
            int r1 = r6.f1150b0
            if (r1 == 0) goto L6c
            r3 = r4
        L6c:
            if (r3 == 0) goto L77
            int r1 = r6.f1150b0
            android.content.res.ColorStateList r1 = android.content.res.ColorStateList.valueOf(r1)
            r0.p(r1)
        L77:
            r6.invalidate()
        L7a:
            r6.invalidate()
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.textfield.TextInputLayout.c():void");
    }

    public final void d() {
        e(this.s0, this.v0, this.u0, this.x0, this.w0);
    }

    @Override // android.view.ViewGroup, android.view.View
    @TargetApi(26)
    public void dispatchProvideAutofillStructure(ViewStructure viewStructure, int i2) {
        EditText editText = this.f1157p;
        if (editText == null) {
            super.dispatchProvideAutofillStructure(viewStructure, i2);
            return;
        }
        if (this.f1158q != null) {
            boolean z2 = this.N;
            this.N = false;
            CharSequence hint = editText.getHint();
            this.f1157p.setHint(this.f1158q);
            try {
                super.dispatchProvideAutofillStructure(viewStructure, i2);
                return;
            } finally {
                this.f1157p.setHint(hint);
                this.N = z2;
            }
        }
        viewStructure.setAutofillId(getAutofillId());
        onProvideAutofillStructure(viewStructure, i2);
        onProvideAutofillVirtualStructure(viewStructure, i2);
        viewStructure.setChildCount(this.f1153f.getChildCount());
        for (int i3 = 0; i3 < this.f1153f.getChildCount(); i3++) {
            View childAt = this.f1153f.getChildAt(i3);
            ViewStructure viewStructureNewChild = viewStructure.newChild(i3);
            childAt.dispatchProvideAutofillStructure(viewStructureNewChild, i2);
            if (childAt == this.f1157p) {
                viewStructureNewChild.setHint(getHint());
            }
        }
    }

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

    @Override // android.view.View
    public void draw(Canvas canvas) {
        super.draw(canvas);
        if (this.L) {
            g.e.a.a.r.c cVar = this.R0;
            Objects.requireNonNull(cVar);
            int iSave = canvas.save();
            if (cVar.f3793y != null && cVar.f3770b) {
                cVar.O.getLineLeft(0);
                cVar.F.setTextSize(cVar.C);
                float f2 = cVar.f3786r;
                float f3 = cVar.f3787s;
                float f4 = cVar.B;
                if (f4 != 1.0f) {
                    canvas.scale(f4, f4, f2, f3);
                }
                canvas.translate(f2, f3);
                cVar.O.draw(canvas);
                canvas.restoreToCount(iSave);
            }
        }
        g.e.a.a.w.g gVar = this.P;
        if (gVar != null) {
            Rect bounds = gVar.getBounds();
            bounds.top = bounds.bottom - this.V;
            this.P.draw(canvas);
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    public void drawableStateChanged() {
        boolean z2;
        ColorStateList colorStateList;
        boolean z3;
        if (this.V0) {
            return;
        }
        this.V0 = true;
        super.drawableStateChanged();
        int[] drawableState = getDrawableState();
        g.e.a.a.r.c cVar = this.R0;
        if (cVar != null) {
            cVar.D = drawableState;
            ColorStateList colorStateList2 = cVar.f3781m;
            if ((colorStateList2 != null && colorStateList2.isStateful()) || ((colorStateList = cVar.f3780l) != null && colorStateList.isStateful())) {
                cVar.k();
                z3 = true;
            } else {
                z3 = false;
            }
            z2 = z3 | false;
        } else {
            z2 = false;
        }
        if (this.f1157p != null) {
            AtomicInteger atomicInteger = y.a;
            y(y.f.c(this) && isEnabled(), false);
        }
        w();
        F();
        if (z2) {
            invalidate();
        }
        this.V0 = false;
    }

    public final void e(CheckableImageButton checkableImageButton, boolean z2, ColorStateList colorStateList, boolean z3, PorterDuff.Mode mode) {
        Drawable drawable = checkableImageButton.getDrawable();
        if (drawable != null && (z2 || z3)) {
            drawable = drawable.mutate();
            if (z2) {
                d.h.d.k.b.h(drawable, colorStateList);
            }
            if (z3) {
                d.h.d.k.b.i(drawable, mode);
            }
        }
        if (checkableImageButton.getDrawable() != drawable) {
            checkableImageButton.setImageDrawable(drawable);
        }
    }

    public final int f() {
        float f2;
        if (!this.L) {
            return 0;
        }
        int i2 = this.T;
        if (i2 == 0 || i2 == 1) {
            f2 = this.R0.f();
        } else {
            if (i2 != 2) {
                return 0;
            }
            f2 = this.R0.f() / 2.0f;
        }
        return (int) f2;
    }

    public final boolean g() {
        return this.L && !TextUtils.isEmpty(this.M) && (this.O instanceof g.e.a.a.z.g);
    }

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

    public g.e.a.a.w.g getBoxBackground() {
        int i2 = this.T;
        if (i2 == 1 || i2 == 2) {
            return this.O;
        }
        throw new IllegalStateException();
    }

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

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

    public float getBoxCornerRadiusBottomEnd() {
        g.e.a.a.w.g gVar = this.O;
        return gVar.f3851n.a.f3891h.a(gVar.h());
    }

    public float getBoxCornerRadiusBottomStart() {
        g.e.a.a.w.g gVar = this.O;
        return gVar.f3851n.a.f3890g.a(gVar.h());
    }

    public float getBoxCornerRadiusTopEnd() {
        g.e.a.a.w.g gVar = this.O;
        return gVar.f3851n.a.f3889f.a(gVar.h());
    }

    public float getBoxCornerRadiusTopStart() {
        return this.O.l();
    }

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

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

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

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

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

    public CharSequence getCounterOverflowDescription() {
        TextView textView;
        if (this.f1162u && this.f1164w && (textView = this.f1165x) != null) {
            return textView.getContentDescription();
        }
        return null;
    }

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

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

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

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

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

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

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

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

    public CharSequence getError() {
        n nVar = this.f1161t;
        if (nVar.f3994k) {
            return nVar.f3993j;
        }
        return null;
    }

    public CharSequence getErrorContentDescription() {
        return this.f1161t.f3996m;
    }

    public int getErrorCurrentTextColors() {
        return this.f1161t.g();
    }

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

    public final int getErrorTextCurrentColor() {
        return this.f1161t.g();
    }

    public CharSequence getHelperText() {
        n nVar = this.f1161t;
        if (nVar.f4000q) {
            return nVar.f3999p;
        }
        return null;
    }

    public int getHelperTextCurrentTextColor() {
        TextView textView = this.f1161t.f4001r;
        if (textView != null) {
            return textView.getCurrentTextColor();
        }
        return -1;
    }

    public CharSequence getHint() {
        if (this.L) {
            return this.M;
        }
        return null;
    }

    public final float getHintCollapsedTextHeight() {
        return this.R0.f();
    }

    public final int getHintCurrentCollapsedTextColor() {
        return this.R0.g();
    }

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

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

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

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

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

    public CharSequence getPlaceholderText() {
        if (this.B) {
            return this.A;
        }
        return null;
    }

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

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

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

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

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

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

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

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

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

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

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

    public final int h(int i2, boolean z2) {
        int compoundPaddingLeft = this.f1157p.getCompoundPaddingLeft() + i2;
        return (this.H == null || z2) ? compoundPaddingLeft : (compoundPaddingLeft - this.I.getMeasuredWidth()) + this.I.getPaddingLeft();
    }

    public final int i(int i2, boolean z2) {
        int compoundPaddingRight = i2 - this.f1157p.getCompoundPaddingRight();
        return (this.H == null || !z2) ? compoundPaddingRight : compoundPaddingRight + (this.I.getMeasuredWidth() - this.I.getPaddingRight());
    }

    public final boolean j() {
        return this.q0 != 0;
    }

    public boolean k() {
        return this.f1156o.getVisibility() == 0 && this.s0.getVisibility() == 0;
    }

    /* JADX WARN: Removed duplicated region for block: B:28:0x0063  */
    /* JADX WARN: Removed duplicated region for block: B:30:0x0066  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x0076  */
    /* JADX WARN: Removed duplicated region for block: B:47:0x00b2  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x00d3  */
    /* JADX WARN: Removed duplicated region for block: B:54:0x0108  */
    /* JADX WARN: Removed duplicated region for block: B:56:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void l() {
        /*
            Method dump skipped, instruction units count: 268
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.textfield.TextInputLayout.l():void");
    }

    /* JADX WARN: Removed duplicated region for block: B:39:0x0081  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void m() {
        /*
            Method dump skipped, instruction units count: 202
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.textfield.TextInputLayout.m():void");
    }

    public void o() {
        p(this.s0, this.u0);
    }

    /* JADX WARN: Removed duplicated region for block: B:31:0x00c3  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x00d3  */
    /* JADX WARN: Removed duplicated region for block: B:59:0x0175  */
    @Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void onLayout(boolean r5, int r6, int r7, int r8, int r9) {
        /*
            Method dump skipped, instruction units count: 386
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.textfield.TextInputLayout.onLayout(boolean, int, int, int, int):void");
    }

    @Override // android.widget.LinearLayout, android.view.View
    public void onMeasure(int i2, int i3) {
        EditText editText;
        int iMax;
        super.onMeasure(i2, i3);
        boolean z2 = false;
        if (this.f1157p != null && this.f1157p.getMeasuredHeight() < (iMax = Math.max(this.f1155n.getMeasuredHeight(), this.f1154m.getMeasuredHeight()))) {
            this.f1157p.setMinimumHeight(iMax);
            z2 = true;
        }
        boolean zV = v();
        if (z2 || zV) {
            this.f1157p.post(new c());
        }
        if (this.C != null && (editText = this.f1157p) != null) {
            this.C.setGravity(editText.getGravity());
            this.C.setPadding(this.f1157p.getCompoundPaddingLeft(), this.f1157p.getCompoundPaddingTop(), this.f1157p.getCompoundPaddingRight(), this.f1157p.getCompoundPaddingBottom());
        }
        A();
        D();
    }

    @Override // android.view.View
    public void onRestoreInstanceState(Parcelable parcelable) {
        if (!(parcelable instanceof h)) {
            super.onRestoreInstanceState(parcelable);
            return;
        }
        h hVar = (h) parcelable;
        super.onRestoreInstanceState(hVar.f2846m);
        setError(hVar.f1172n);
        if (hVar.f1173o) {
            this.s0.post(new b());
        }
        setHint(hVar.f1174p);
        setHelperText(hVar.f1175q);
        setPlaceholderText(hVar.f1176r);
        requestLayout();
    }

    @Override // android.view.View
    public Parcelable onSaveInstanceState() {
        h hVar = new h(super.onSaveInstanceState());
        if (this.f1161t.e()) {
            hVar.f1172n = getError();
        }
        hVar.f1173o = j() && this.s0.isChecked();
        hVar.f1174p = getHint();
        hVar.f1175q = getHelperText();
        hVar.f1176r = getPlaceholderText();
        return hVar;
    }

    public final void p(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();
        d.h.d.k.b.h(drawableMutate, ColorStateList.valueOf(colorForState));
        checkableImageButton.setImageDrawable(drawableMutate);
    }

    public void r(TextView textView, int i2) {
        boolean z2 = true;
        try {
            textView.setTextAppearance(i2);
            if (textView.getTextColors().getDefaultColor() != -65281) {
                z2 = false;
            }
        } catch (Exception unused) {
        }
        if (z2) {
            textView.setTextAppearance(2131886398);
            Context context = getContext();
            Object obj = d.h.c.a.a;
            textView.setTextColor(a.c.a(context, R.color.design_error));
        }
    }

    public final void s() {
        if (this.f1165x != null) {
            EditText editText = this.f1157p;
            t(editText == null ? 0 : editText.getText().length());
        }
    }

    public void setBoxBackgroundColor(int i2) {
        if (this.f1151c0 != i2) {
            this.f1151c0 = i2;
            this.L0 = i2;
            this.N0 = i2;
            this.O0 = i2;
            c();
        }
    }

    public void setBoxBackgroundColorResource(int i2) {
        Context context = getContext();
        Object obj = d.h.c.a.a;
        setBoxBackgroundColor(a.c.a(context, i2));
    }

    public void setBoxBackgroundColorStateList(ColorStateList colorStateList) {
        int defaultColor = colorStateList.getDefaultColor();
        this.L0 = defaultColor;
        this.f1151c0 = defaultColor;
        this.M0 = colorStateList.getColorForState(new int[]{-16842910}, -1);
        this.N0 = colorStateList.getColorForState(new int[]{android.R.attr.state_focused, android.R.attr.state_enabled}, -1);
        this.O0 = colorStateList.getColorForState(new int[]{android.R.attr.state_hovered, android.R.attr.state_enabled}, -1);
        c();
    }

    public void setBoxBackgroundMode(int i2) {
        if (i2 == this.T) {
            return;
        }
        this.T = i2;
        if (this.f1157p != null) {
            l();
        }
    }

    public void setBoxStrokeColor(int i2) {
        if (this.J0 != i2) {
            this.J0 = i2;
            F();
        }
    }

    public void setBoxStrokeColorStateList(ColorStateList colorStateList) {
        int defaultColor;
        if (!colorStateList.isStateful()) {
            if (this.J0 != colorStateList.getDefaultColor()) {
                defaultColor = colorStateList.getDefaultColor();
            }
            F();
        } else {
            this.H0 = colorStateList.getDefaultColor();
            this.P0 = colorStateList.getColorForState(new int[]{-16842910}, -1);
            this.I0 = colorStateList.getColorForState(new int[]{android.R.attr.state_hovered, android.R.attr.state_enabled}, -1);
            defaultColor = colorStateList.getColorForState(new int[]{android.R.attr.state_focused, android.R.attr.state_enabled}, -1);
        }
        this.J0 = defaultColor;
        F();
    }

    public void setBoxStrokeErrorColor(ColorStateList colorStateList) {
        if (this.K0 != colorStateList) {
            this.K0 = colorStateList;
            F();
        }
    }

    public void setBoxStrokeWidth(int i2) {
        this.W = i2;
        F();
    }

    public void setBoxStrokeWidthFocused(int i2) {
        this.f1149a0 = i2;
        F();
    }

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

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

    public void setCounterEnabled(boolean z2) {
        if (this.f1162u != z2) {
            if (z2) {
                b0 b0Var = new b0(getContext(), null);
                this.f1165x = b0Var;
                b0Var.setId(R.id.textinput_counter);
                Typeface typeface = this.g0;
                if (typeface != null) {
                    this.f1165x.setTypeface(typeface);
                }
                this.f1165x.setMaxLines(1);
                this.f1161t.a(this.f1165x, 2);
                d.h.j.j.h((ViewGroup.MarginLayoutParams) this.f1165x.getLayoutParams(), getResources().getDimensionPixelOffset(R.dimen.mtrl_textinput_counter_margin_start));
                u();
                s();
            } else {
                this.f1161t.j(this.f1165x, 2);
                this.f1165x = null;
            }
            this.f1162u = z2;
        }
    }

    public void setCounterMaxLength(int i2) {
        if (this.f1163v != i2) {
            if (i2 <= 0) {
                i2 = -1;
            }
            this.f1163v = i2;
            if (this.f1162u) {
                s();
            }
        }
    }

    public void setCounterOverflowTextAppearance(int i2) {
        if (this.f1166y != i2) {
            this.f1166y = i2;
            u();
        }
    }

    public void setCounterOverflowTextColor(ColorStateList colorStateList) {
        if (this.G != colorStateList) {
            this.G = colorStateList;
            u();
        }
    }

    public void setCounterTextAppearance(int i2) {
        if (this.f1167z != i2) {
            this.f1167z = i2;
            u();
        }
    }

    public void setCounterTextColor(ColorStateList colorStateList) {
        if (this.F != colorStateList) {
            this.F = colorStateList;
            u();
        }
    }

    public void setDefaultHintTextColor(ColorStateList colorStateList) {
        this.F0 = colorStateList;
        this.G0 = colorStateList;
        if (this.f1157p != null) {
            y(false, false);
        }
    }

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

    public void setEndIconActivated(boolean z2) {
        this.s0.setActivated(z2);
    }

    public void setEndIconCheckable(boolean z2) {
        this.s0.setCheckable(z2);
    }

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

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

    public void setEndIconDrawable(int i2) {
        setEndIconDrawable(i2 != 0 ? d.b.d.a.a.a(getContext(), i2) : null);
    }

    public void setEndIconDrawable(Drawable drawable) {
        this.s0.setImageDrawable(drawable);
        o();
    }

    public void setEndIconMode(int i2) {
        int i3 = this.q0;
        this.q0 = i2;
        Iterator<g> it = this.t0.iterator();
        while (it.hasNext()) {
            it.next().a(this, i3);
        }
        setEndIconVisible(i2 != 0);
        if (getEndIconDelegate().b(this.T)) {
            getEndIconDelegate().a();
            d();
        } else {
            StringBuilder sbF = g.a.a.a.a.F("The current box background mode ");
            sbF.append(this.T);
            sbF.append(" is not supported by the end icon mode ");
            sbF.append(i2);
            throw new IllegalStateException(sbF.toString());
        }
    }

    public void setEndIconOnClickListener(View.OnClickListener onClickListener) {
        CheckableImageButton checkableImageButton = this.s0;
        View.OnLongClickListener onLongClickListener = this.B0;
        checkableImageButton.setOnClickListener(onClickListener);
        q(checkableImageButton, onLongClickListener);
    }

    public void setEndIconOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        this.B0 = onLongClickListener;
        CheckableImageButton checkableImageButton = this.s0;
        checkableImageButton.setOnLongClickListener(onLongClickListener);
        q(checkableImageButton, onLongClickListener);
    }

    public void setEndIconTintList(ColorStateList colorStateList) {
        if (this.u0 != colorStateList) {
            this.u0 = colorStateList;
            this.v0 = true;
            d();
        }
    }

    public void setEndIconTintMode(PorterDuff.Mode mode) {
        if (this.w0 != mode) {
            this.w0 = mode;
            this.x0 = true;
            d();
        }
    }

    public void setEndIconVisible(boolean z2) {
        if (k() != z2) {
            this.s0.setVisibility(z2 ? 0 : 8);
            D();
            v();
        }
    }

    public void setError(CharSequence charSequence) {
        if (!this.f1161t.f3994k) {
            if (TextUtils.isEmpty(charSequence)) {
                return;
            } else {
                setErrorEnabled(true);
            }
        }
        if (TextUtils.isEmpty(charSequence)) {
            this.f1161t.i();
            return;
        }
        n nVar = this.f1161t;
        nVar.c();
        nVar.f3993j = charSequence;
        nVar.f3995l.setText(charSequence);
        int i2 = nVar.f3991h;
        if (i2 != 1) {
            nVar.f3992i = 1;
        }
        nVar.l(i2, nVar.f3992i, nVar.k(nVar.f3995l, charSequence));
    }

    public void setErrorContentDescription(CharSequence charSequence) {
        n nVar = this.f1161t;
        nVar.f3996m = charSequence;
        TextView textView = nVar.f3995l;
        if (textView != null) {
            textView.setContentDescription(charSequence);
        }
    }

    public void setErrorEnabled(boolean z2) {
        n nVar = this.f1161t;
        if (nVar.f3994k == z2) {
            return;
        }
        nVar.c();
        if (z2) {
            b0 b0Var = new b0(nVar.a, null);
            nVar.f3995l = b0Var;
            b0Var.setId(R.id.textinput_error);
            nVar.f3995l.setTextAlignment(5);
            Typeface typeface = nVar.f4004u;
            if (typeface != null) {
                nVar.f3995l.setTypeface(typeface);
            }
            int i2 = nVar.f3997n;
            nVar.f3997n = i2;
            TextView textView = nVar.f3995l;
            if (textView != null) {
                nVar.f3985b.r(textView, i2);
            }
            ColorStateList colorStateList = nVar.f3998o;
            nVar.f3998o = colorStateList;
            TextView textView2 = nVar.f3995l;
            if (textView2 != null && colorStateList != null) {
                textView2.setTextColor(colorStateList);
            }
            CharSequence charSequence = nVar.f3996m;
            nVar.f3996m = charSequence;
            TextView textView3 = nVar.f3995l;
            if (textView3 != null) {
                textView3.setContentDescription(charSequence);
            }
            nVar.f3995l.setVisibility(4);
            TextView textView4 = nVar.f3995l;
            AtomicInteger atomicInteger = y.a;
            y.f.f(textView4, 1);
            nVar.a(nVar.f3995l, 0);
        } else {
            nVar.i();
            nVar.j(nVar.f3995l, 0);
            nVar.f3995l = null;
            nVar.f3985b.w();
            nVar.f3985b.F();
        }
        nVar.f3994k = z2;
    }

    public void setErrorIconDrawable(int i2) {
        setErrorIconDrawable(i2 != 0 ? d.b.d.a.a.a(getContext(), i2) : null);
        p(this.D0, this.E0);
    }

    public void setErrorIconOnClickListener(View.OnClickListener onClickListener) {
        CheckableImageButton checkableImageButton = this.D0;
        View.OnLongClickListener onLongClickListener = this.C0;
        checkableImageButton.setOnClickListener(onClickListener);
        q(checkableImageButton, onLongClickListener);
    }

    public void setErrorIconOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        this.C0 = onLongClickListener;
        CheckableImageButton checkableImageButton = this.D0;
        checkableImageButton.setOnLongClickListener(onLongClickListener);
        q(checkableImageButton, onLongClickListener);
    }

    public void setErrorIconTintList(ColorStateList colorStateList) {
        this.E0 = colorStateList;
        Drawable drawable = this.D0.getDrawable();
        if (drawable != null) {
            drawable = drawable.mutate();
            d.h.d.k.b.h(drawable, colorStateList);
        }
        if (this.D0.getDrawable() != drawable) {
            this.D0.setImageDrawable(drawable);
        }
    }

    public void setErrorIconTintMode(PorterDuff.Mode mode) {
        Drawable drawable = this.D0.getDrawable();
        if (drawable != null) {
            drawable = drawable.mutate();
            d.h.d.k.b.i(drawable, mode);
        }
        if (this.D0.getDrawable() != drawable) {
            this.D0.setImageDrawable(drawable);
        }
    }

    public void setErrorTextAppearance(int i2) {
        n nVar = this.f1161t;
        nVar.f3997n = i2;
        TextView textView = nVar.f3995l;
        if (textView != null) {
            nVar.f3985b.r(textView, i2);
        }
    }

    public void setErrorTextColor(ColorStateList colorStateList) {
        n nVar = this.f1161t;
        nVar.f3998o = colorStateList;
        TextView textView = nVar.f3995l;
        if (textView == null || colorStateList == null) {
            return;
        }
        textView.setTextColor(colorStateList);
    }

    public void setExpandedHintEnabled(boolean z2) {
        if (this.S0 != z2) {
            this.S0 = z2;
            y(false, false);
        }
    }

    public void setHelperText(CharSequence charSequence) {
        if (TextUtils.isEmpty(charSequence)) {
            if (this.f1161t.f4000q) {
                setHelperTextEnabled(false);
                return;
            }
            return;
        }
        if (!this.f1161t.f4000q) {
            setHelperTextEnabled(true);
        }
        n nVar = this.f1161t;
        nVar.c();
        nVar.f3999p = charSequence;
        nVar.f4001r.setText(charSequence);
        int i2 = nVar.f3991h;
        if (i2 != 2) {
            nVar.f3992i = 2;
        }
        nVar.l(i2, nVar.f3992i, nVar.k(nVar.f4001r, charSequence));
    }

    public void setHelperTextColor(ColorStateList colorStateList) {
        n nVar = this.f1161t;
        nVar.f4003t = colorStateList;
        TextView textView = nVar.f4001r;
        if (textView == null || colorStateList == null) {
            return;
        }
        textView.setTextColor(colorStateList);
    }

    public void setHelperTextEnabled(boolean z2) {
        n nVar = this.f1161t;
        if (nVar.f4000q == z2) {
            return;
        }
        nVar.c();
        if (z2) {
            b0 b0Var = new b0(nVar.a, null);
            nVar.f4001r = b0Var;
            b0Var.setId(R.id.textinput_helper_text);
            nVar.f4001r.setTextAlignment(5);
            Typeface typeface = nVar.f4004u;
            if (typeface != null) {
                nVar.f4001r.setTypeface(typeface);
            }
            nVar.f4001r.setVisibility(4);
            TextView textView = nVar.f4001r;
            AtomicInteger atomicInteger = y.a;
            y.f.f(textView, 1);
            int i2 = nVar.f4002s;
            nVar.f4002s = i2;
            TextView textView2 = nVar.f4001r;
            if (textView2 != null) {
                textView2.setTextAppearance(i2);
            }
            ColorStateList colorStateList = nVar.f4003t;
            nVar.f4003t = colorStateList;
            TextView textView3 = nVar.f4001r;
            if (textView3 != null && colorStateList != null) {
                textView3.setTextColor(colorStateList);
            }
            nVar.a(nVar.f4001r, 1);
        } else {
            nVar.c();
            int i3 = nVar.f3991h;
            if (i3 == 2) {
                nVar.f3992i = 0;
            }
            nVar.l(i3, nVar.f3992i, nVar.k(nVar.f4001r, null));
            nVar.j(nVar.f4001r, 1);
            nVar.f4001r = null;
            nVar.f3985b.w();
            nVar.f3985b.F();
        }
        nVar.f4000q = z2;
    }

    public void setHelperTextTextAppearance(int i2) {
        n nVar = this.f1161t;
        nVar.f4002s = i2;
        TextView textView = nVar.f4001r;
        if (textView != null) {
            textView.setTextAppearance(i2);
        }
    }

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

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

    public void setHintAnimationEnabled(boolean z2) {
        this.T0 = z2;
    }

    public void setHintEnabled(boolean z2) {
        if (z2 != this.L) {
            this.L = z2;
            if (z2) {
                CharSequence hint = this.f1157p.getHint();
                if (!TextUtils.isEmpty(hint)) {
                    if (TextUtils.isEmpty(this.M)) {
                        setHint(hint);
                    }
                    this.f1157p.setHint((CharSequence) null);
                }
                this.N = true;
            } else {
                this.N = false;
                if (!TextUtils.isEmpty(this.M) && TextUtils.isEmpty(this.f1157p.getHint())) {
                    this.f1157p.setHint(this.M);
                }
                setHintInternal(null);
            }
            if (this.f1157p != null) {
                x();
            }
        }
    }

    public void setHintTextAppearance(int i2) {
        g.e.a.a.r.c cVar = this.R0;
        g.e.a.a.t.b bVar = new g.e.a.a.t.b(cVar.a.getContext(), i2);
        ColorStateList colorStateList = bVar.a;
        if (colorStateList != null) {
            cVar.f3781m = colorStateList;
        }
        float f2 = bVar.f3829k;
        if (f2 != 0.0f) {
            cVar.f3779k = f2;
        }
        ColorStateList colorStateList2 = bVar.f3820b;
        if (colorStateList2 != null) {
            cVar.M = colorStateList2;
        }
        cVar.K = bVar.f3824f;
        cVar.L = bVar.f3825g;
        cVar.J = bVar.f3826h;
        cVar.N = bVar.f3828j;
        g.e.a.a.t.a aVar = cVar.f3791w;
        if (aVar != null) {
            aVar.f3819c = true;
        }
        g.e.a.a.r.b bVar2 = new g.e.a.a.r.b(cVar);
        bVar.a();
        cVar.f3791w = new g.e.a.a.t.a(bVar2, bVar.f3832n);
        bVar.c(cVar.a.getContext(), cVar.f3791w);
        cVar.k();
        this.G0 = this.R0.f3781m;
        if (this.f1157p != null) {
            y(false, false);
            x();
        }
    }

    public void setHintTextColor(ColorStateList colorStateList) {
        if (this.G0 != colorStateList) {
            if (this.F0 == null) {
                g.e.a.a.r.c cVar = this.R0;
                if (cVar.f3781m != colorStateList) {
                    cVar.f3781m = colorStateList;
                    cVar.k();
                }
            }
            this.G0 = colorStateList;
            if (this.f1157p != null) {
                y(false, false);
            }
        }
    }

    public void setMaxWidth(int i2) {
        this.f1160s = i2;
        EditText editText = this.f1157p;
        if (editText == null || i2 == -1) {
            return;
        }
        editText.setMaxWidth(i2);
    }

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

    public void setMinWidth(int i2) {
        this.f1159r = i2;
        EditText editText = this.f1157p;
        if (editText == null || i2 == -1) {
            return;
        }
        editText.setMinWidth(i2);
    }

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

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

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

    @Deprecated
    public void setPasswordVisibilityToggleDrawable(int i2) {
        setPasswordVisibilityToggleDrawable(i2 != 0 ? d.b.d.a.a.a(getContext(), i2) : null);
    }

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

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

    @Deprecated
    public void setPasswordVisibilityToggleTintList(ColorStateList colorStateList) {
        this.u0 = colorStateList;
        this.v0 = true;
        d();
    }

    @Deprecated
    public void setPasswordVisibilityToggleTintMode(PorterDuff.Mode mode) {
        this.w0 = mode;
        this.x0 = true;
        d();
    }

    public void setPlaceholderText(CharSequence charSequence) {
        if (this.B && TextUtils.isEmpty(charSequence)) {
            setPlaceholderTextEnabled(false);
        } else {
            if (!this.B) {
                setPlaceholderTextEnabled(true);
            }
            this.A = charSequence;
        }
        EditText editText = this.f1157p;
        z(editText != null ? editText.getText().length() : 0);
    }

    public void setPlaceholderTextAppearance(int i2) {
        this.E = i2;
        TextView textView = this.C;
        if (textView != null) {
            textView.setTextAppearance(i2);
        }
    }

    public void setPlaceholderTextColor(ColorStateList colorStateList) {
        if (this.D != colorStateList) {
            this.D = colorStateList;
            TextView textView = this.C;
            if (textView == null || colorStateList == null) {
                return;
            }
            textView.setTextColor(colorStateList);
        }
    }

    public void setPrefixText(CharSequence charSequence) {
        this.H = TextUtils.isEmpty(charSequence) ? null : charSequence;
        this.I.setText(charSequence);
        B();
    }

    public void setPrefixTextAppearance(int i2) {
        this.I.setTextAppearance(i2);
    }

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

    public void setStartIconCheckable(boolean z2) {
        this.h0.setCheckable(z2);
    }

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

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

    public void setStartIconDrawable(int i2) {
        setStartIconDrawable(i2 != 0 ? d.b.d.a.a.a(getContext(), i2) : null);
    }

    public void setStartIconDrawable(Drawable drawable) {
        this.h0.setImageDrawable(drawable);
        if (drawable != null) {
            setStartIconVisible(true);
            p(this.h0, this.i0);
        } else {
            setStartIconVisible(false);
            setStartIconOnClickListener(null);
            setStartIconOnLongClickListener(null);
            setStartIconContentDescription((CharSequence) null);
        }
    }

    public void setStartIconOnClickListener(View.OnClickListener onClickListener) {
        CheckableImageButton checkableImageButton = this.h0;
        View.OnLongClickListener onLongClickListener = this.o0;
        checkableImageButton.setOnClickListener(onClickListener);
        q(checkableImageButton, onLongClickListener);
    }

    public void setStartIconOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        this.o0 = onLongClickListener;
        CheckableImageButton checkableImageButton = this.h0;
        checkableImageButton.setOnLongClickListener(onLongClickListener);
        q(checkableImageButton, onLongClickListener);
    }

    public void setStartIconTintList(ColorStateList colorStateList) {
        if (this.i0 != colorStateList) {
            this.i0 = colorStateList;
            this.j0 = true;
            e(this.h0, true, colorStateList, this.l0, this.k0);
        }
    }

    public void setStartIconTintMode(PorterDuff.Mode mode) {
        if (this.k0 != mode) {
            this.k0 = mode;
            this.l0 = true;
            e(this.h0, this.j0, this.i0, true, mode);
        }
    }

    public void setStartIconVisible(boolean z2) {
        if ((this.h0.getVisibility() == 0) != z2) {
            this.h0.setVisibility(z2 ? 0 : 8);
            A();
            v();
        }
    }

    public void setSuffixText(CharSequence charSequence) {
        this.J = TextUtils.isEmpty(charSequence) ? null : charSequence;
        this.K.setText(charSequence);
        E();
    }

    public void setSuffixTextAppearance(int i2) {
        this.K.setTextAppearance(i2);
    }

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

    public void setTextInputAccessibilityDelegate(e eVar) {
        EditText editText = this.f1157p;
        if (editText != null) {
            y.p(editText, eVar);
        }
    }

    public void setTypeface(Typeface typeface) {
        if (typeface != this.g0) {
            this.g0 = typeface;
            this.R0.q(typeface);
            n nVar = this.f1161t;
            if (typeface != nVar.f4004u) {
                nVar.f4004u = typeface;
                TextView textView = nVar.f3995l;
                if (textView != null) {
                    textView.setTypeface(typeface);
                }
                TextView textView2 = nVar.f4001r;
                if (textView2 != null) {
                    textView2.setTypeface(typeface);
                }
            }
            TextView textView3 = this.f1165x;
            if (textView3 != null) {
                textView3.setTypeface(typeface);
            }
        }
    }

    public void t(int i2) {
        boolean z2 = this.f1164w;
        int i3 = this.f1163v;
        if (i3 == -1) {
            this.f1165x.setText(String.valueOf(i2));
            this.f1165x.setContentDescription(null);
            this.f1164w = false;
        } else {
            this.f1164w = i2 > i3;
            Context context = getContext();
            this.f1165x.setContentDescription(context.getString(this.f1164w ? R.string.character_counter_overflowed_content_description : R.string.character_counter_content_description, Integer.valueOf(i2), Integer.valueOf(this.f1163v)));
            if (z2 != this.f1164w) {
                u();
            }
            d.h.h.a aVarC = d.h.h.a.c();
            TextView textView = this.f1165x;
            String string = getContext().getString(R.string.character_counter_pattern, Integer.valueOf(i2), Integer.valueOf(this.f1163v));
            textView.setText(string != null ? aVarC.d(string, aVarC.f2708h, true).toString() : null);
        }
        if (this.f1157p == null || z2 == this.f1164w) {
            return;
        }
        y(false, false);
        F();
        w();
    }

    public final void u() {
        ColorStateList colorStateList;
        ColorStateList colorStateList2;
        TextView textView = this.f1165x;
        if (textView != null) {
            r(textView, this.f1164w ? this.f1166y : this.f1167z);
            if (!this.f1164w && (colorStateList2 = this.F) != null) {
                this.f1165x.setTextColor(colorStateList2);
            }
            if (!this.f1164w || (colorStateList = this.G) == null) {
                return;
            }
            this.f1165x.setTextColor(colorStateList);
        }
    }

    public final boolean v() {
        boolean z2;
        if (this.f1157p == null) {
            return false;
        }
        boolean z3 = true;
        if (!(getStartIconDrawable() == null && this.H == null) && this.f1154m.getMeasuredWidth() > 0) {
            int measuredWidth = this.f1154m.getMeasuredWidth() - this.f1157p.getPaddingLeft();
            if (this.m0 == null || this.n0 != measuredWidth) {
                ColorDrawable colorDrawable = new ColorDrawable();
                this.m0 = colorDrawable;
                this.n0 = measuredWidth;
                colorDrawable.setBounds(0, 0, measuredWidth, 1);
            }
            Drawable[] drawableArrA = d.h.k.m.a(this.f1157p);
            Drawable drawable = drawableArrA[0];
            Drawable drawable2 = this.m0;
            if (drawable != drawable2) {
                d.h.k.m.e(this.f1157p, drawable2, drawableArrA[1], drawableArrA[2], drawableArrA[3]);
                z2 = true;
            }
            z2 = false;
        } else {
            if (this.m0 != null) {
                Drawable[] drawableArrA2 = d.h.k.m.a(this.f1157p);
                d.h.k.m.e(this.f1157p, null, drawableArrA2[1], drawableArrA2[2], drawableArrA2[3]);
                this.m0 = null;
                z2 = true;
            }
            z2 = false;
        }
        if ((this.D0.getVisibility() == 0 || ((j() && k()) || this.J != null)) && this.f1155n.getMeasuredWidth() > 0) {
            int measuredWidth2 = this.K.getMeasuredWidth() - this.f1157p.getPaddingRight();
            CheckableImageButton endIconToUpdateDummyDrawable = getEndIconToUpdateDummyDrawable();
            if (endIconToUpdateDummyDrawable != null) {
                measuredWidth2 = d.h.j.j.c((ViewGroup.MarginLayoutParams) endIconToUpdateDummyDrawable.getLayoutParams()) + endIconToUpdateDummyDrawable.getMeasuredWidth() + measuredWidth2;
            }
            Drawable[] drawableArrA3 = d.h.k.m.a(this.f1157p);
            Drawable drawable3 = this.y0;
            if (drawable3 == null || this.z0 == measuredWidth2) {
                if (drawable3 == null) {
                    ColorDrawable colorDrawable2 = new ColorDrawable();
                    this.y0 = colorDrawable2;
                    this.z0 = measuredWidth2;
                    colorDrawable2.setBounds(0, 0, measuredWidth2, 1);
                }
                Drawable drawable4 = drawableArrA3[2];
                Drawable drawable5 = this.y0;
                if (drawable4 != drawable5) {
                    this.A0 = drawableArrA3[2];
                    d.h.k.m.e(this.f1157p, drawableArrA3[0], drawableArrA3[1], drawable5, drawableArrA3[3]);
                } else {
                    z3 = z2;
                }
            } else {
                this.z0 = measuredWidth2;
                drawable3.setBounds(0, 0, measuredWidth2, 1);
                d.h.k.m.e(this.f1157p, drawableArrA3[0], drawableArrA3[1], this.y0, drawableArrA3[3]);
            }
        } else {
            if (this.y0 == null) {
                return z2;
            }
            Drawable[] drawableArrA4 = d.h.k.m.a(this.f1157p);
            if (drawableArrA4[2] == this.y0) {
                d.h.k.m.e(this.f1157p, drawableArrA4[0], drawableArrA4[1], this.A0, drawableArrA4[3]);
            } else {
                z3 = z2;
            }
            this.y0 = null;
        }
        return z3;
    }

    public void w() {
        Drawable background;
        TextView textView;
        int currentTextColor;
        EditText editText = this.f1157p;
        if (editText == null || this.T != 0 || (background = editText.getBackground()) == null) {
            return;
        }
        if (g0.a(background)) {
            background = background.mutate();
        }
        if (this.f1161t.e()) {
            currentTextColor = this.f1161t.g();
        } else {
            if (!this.f1164w || (textView = this.f1165x) == null) {
                background.clearColorFilter();
                this.f1157p.refreshDrawableState();
                return;
            }
            currentTextColor = textView.getCurrentTextColor();
        }
        background.setColorFilter(d.b.g.j.c(currentTextColor, PorterDuff.Mode.SRC_IN));
    }

    public final void x() {
        if (this.T != 1) {
            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.f1153f.getLayoutParams();
            int iF = f();
            if (iF != layoutParams.topMargin) {
                layoutParams.topMargin = iF;
                this.f1153f.requestLayout();
            }
        }
    }

    public final void y(boolean z2, boolean z3) {
        ColorStateList textColors;
        g.e.a.a.r.c cVar;
        TextView textView;
        boolean zIsEnabled = isEnabled();
        EditText editText = this.f1157p;
        boolean z4 = (editText == null || TextUtils.isEmpty(editText.getText())) ? false : true;
        EditText editText2 = this.f1157p;
        boolean z5 = editText2 != null && editText2.hasFocus();
        boolean zE = this.f1161t.e();
        ColorStateList colorStateList = this.F0;
        if (colorStateList != null) {
            g.e.a.a.r.c cVar2 = this.R0;
            if (cVar2.f3781m != colorStateList) {
                cVar2.f3781m = colorStateList;
                cVar2.k();
            }
            g.e.a.a.r.c cVar3 = this.R0;
            ColorStateList colorStateList2 = this.F0;
            if (cVar3.f3780l != colorStateList2) {
                cVar3.f3780l = colorStateList2;
                cVar3.k();
            }
        }
        if (!zIsEnabled) {
            ColorStateList colorStateList3 = this.F0;
            int colorForState = colorStateList3 != null ? colorStateList3.getColorForState(new int[]{-16842910}, this.P0) : this.P0;
            this.R0.m(ColorStateList.valueOf(colorForState));
            g.e.a.a.r.c cVar4 = this.R0;
            ColorStateList colorStateListValueOf = ColorStateList.valueOf(colorForState);
            if (cVar4.f3780l != colorStateListValueOf) {
                cVar4.f3780l = colorStateListValueOf;
                cVar4.k();
            }
        } else if (zE) {
            g.e.a.a.r.c cVar5 = this.R0;
            TextView textView2 = this.f1161t.f3995l;
            cVar5.m(textView2 != null ? textView2.getTextColors() : null);
        } else {
            if (this.f1164w && (textView = this.f1165x) != null) {
                cVar = this.R0;
                textColors = textView.getTextColors();
            } else if (z5 && (textColors = this.G0) != null) {
                cVar = this.R0;
            }
            cVar.m(textColors);
        }
        if (z4 || !this.S0 || (isEnabled() && z5)) {
            if (z3 || this.Q0) {
                ValueAnimator valueAnimator = this.U0;
                if (valueAnimator != null && valueAnimator.isRunning()) {
                    this.U0.cancel();
                }
                if (z2 && this.T0) {
                    b(1.0f);
                } else {
                    this.R0.o(1.0f);
                }
                this.Q0 = false;
                if (g()) {
                    m();
                }
                EditText editText3 = this.f1157p;
                z(editText3 != null ? editText3.getText().length() : 0);
                B();
                E();
                return;
            }
            return;
        }
        if (z3 || !this.Q0) {
            ValueAnimator valueAnimator2 = this.U0;
            if (valueAnimator2 != null && valueAnimator2.isRunning()) {
                this.U0.cancel();
            }
            if (z2 && this.T0) {
                b(0.0f);
            } else {
                this.R0.o(0.0f);
            }
            if (g() && (!((g.e.a.a.z.g) this.O).K.isEmpty()) && g()) {
                ((g.e.a.a.z.g) this.O).x(0.0f, 0.0f, 0.0f, 0.0f);
            }
            this.Q0 = true;
            TextView textView3 = this.C;
            if (textView3 != null && this.B) {
                textView3.setText((CharSequence) null);
                this.C.setVisibility(4);
            }
            B();
            E();
        }
    }

    public final void z(int i2) {
        if (i2 != 0 || this.Q0) {
            TextView textView = this.C;
            if (textView == null || !this.B) {
                return;
            }
            textView.setText((CharSequence) null);
            this.C.setVisibility(4);
            return;
        }
        TextView textView2 = this.C;
        if (textView2 == null || !this.B) {
            return;
        }
        textView2.setText(this.A);
        this.C.setVisibility(0);
        this.C.bringToFront();
    }

    public void setErrorIconDrawable(Drawable drawable) {
        this.D0.setImageDrawable(drawable);
        setErrorIconVisible(drawable != null && this.f1161t.f3994k);
    }
}
