package I5;

import A6.n;
import O6.p;
import android.widget.TextView;
import com.google.android.gms.internal.measurement.C1;
import com.martsnew.tv.R;
import com.martsnew.tv.ui.login.code.TvCodeLoginFragment;
import java.util.ArrayList;
import u5.AbstractC1632k;

/* JADX INFO: loaded from: classes.dex */
public final class c extends G6.i implements p {

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public /* synthetic */ Object f3382u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final /* synthetic */ TvCodeLoginFragment f3383v;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public c(E6.d dVar, TvCodeLoginFragment tvCodeLoginFragment) {
        super(2, dVar);
        this.f3383v = tvCodeLoginFragment;
    }

    @Override // O6.p
    public final Object k(Object obj, Object obj2) throws Throwable {
        c cVar = (c) m((E6.d) obj2, (String) obj);
        n nVar = n.f457a;
        cVar.p(nVar);
        return nVar;
    }

    @Override // G6.a
    public final E6.d m(E6.d dVar, Object obj) {
        c cVar = new c(dVar, this.f3383v);
        cVar.f3382u = obj;
        return cVar;
    }

    @Override // G6.a
    public final Object p(Object obj) throws Throwable {
        C1.N(obj);
        String str = (String) this.f3382u;
        P6.g.e(str, "<this>");
        int length = str.length();
        int i = 0;
        ArrayList arrayList = new ArrayList((length % 1 == 0 ? 0 : 1) + length);
        while (i >= 0 && i < length) {
            int i5 = i + 1;
            CharSequence charSequenceSubSequence = str.subSequence(i, (i5 < 0 || i5 > length) ? length : i5);
            P6.g.e(charSequenceSubSequence, "it");
            arrayList.add(charSequenceSubSequence.toString());
            i = i5;
        }
        AbstractC1632k abstractC1632k = (AbstractC1632k) this.f3383v.f0();
        TextView textView = abstractC1632k.f17759S;
        P6.g.d(textView, "textCodeError");
        textView.setVisibility(8);
        TextView textView2 = abstractC1632k.f17754N;
        int i8 = R.drawable.background_code;
        textView2.setBackgroundResource(R.drawable.background_code);
        int i9 = !arrayList.isEmpty() ? R.drawable.background_code : R.drawable.background_code_empty;
        TextView textView3 = abstractC1632k.f17755O;
        textView3.setBackgroundResource(i9);
        int i10 = arrayList.size() > 1 ? R.drawable.background_code : R.drawable.background_code_empty;
        TextView textView4 = abstractC1632k.f17756P;
        textView4.setBackgroundResource(i10);
        if (arrayList.size() <= 2) {
            i8 = R.drawable.background_code_empty;
        }
        TextView textView5 = abstractC1632k.f17757Q;
        textView5.setBackgroundResource(i8);
        textView2.setText((CharSequence) B6.k.i0(arrayList));
        textView3.setText((CharSequence) B6.k.j0(1, arrayList));
        textView4.setText((CharSequence) B6.k.j0(2, arrayList));
        textView5.setText((CharSequence) B6.k.j0(3, arrayList));
        return n.f457a;
    }
}
