package H5;

import Z6.AbstractC0385z;
import Z6.InterfaceC0382w;
import com.google.android.gms.internal.measurement.C1;
import com.martsnew.domain.model.Movie;
import com.martsnew.domain.model.Shortcut;
import com.martsnew.domain.model.Vote;
import com.martsnew.domain.type.MediaType;
import java.util.ArrayList;
import java.util.List;
import k5.C1101a;
import k5.C1104d;
import k5.C1105e;
import k5.C1107g;

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

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

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

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

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

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

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final /* synthetic */ B f3166z;

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

    @Override // O6.p
    public final Object k(Object obj, Object obj2) {
        return ((x) m((E6.d) obj2, (InterfaceC0382w) obj)).p(A6.n.f457a);
    }

    @Override // G6.a
    public final E6.d m(E6.d dVar, Object obj) {
        x xVar = new x(this.f3166z, dVar);
        xVar.f3165y = obj;
        return xVar;
    }

    /* JADX WARN: Code restructure failed: missing block: B:77:0x0246, code lost:
    
        if (r7.f(r2, r44) == r1) goto L78;
     */
    /* JADX WARN: Removed duplicated region for block: B:30:0x008e  */
    /* JADX WARN: Removed duplicated region for block: B:35:0x00a2  */
    /* JADX WARN: Removed duplicated region for block: B:40:0x00b8  */
    /* JADX WARN: Removed duplicated region for block: B:68:0x0215  */
    /* JADX WARN: Removed duplicated region for block: B:73:0x0227  */
    /* JADX WARN: Removed duplicated region for block: B:76:0x0236  */
    /* JADX WARN: Type inference failed for: r4v0 */
    /* JADX WARN: Type inference failed for: r4v1, types: [com.martsnew.domain.type.MediaType, java.util.ArrayList, java.util.List] */
    /* JADX WARN: Type inference failed for: r4v17 */
    @Override // G6.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object p(Object obj) throws Throwable {
        Z6.C cD;
        Object objA;
        Object obj2;
        List list;
        ArrayList arrayList;
        B b8;
        Object objJ;
        Throwable thA;
        int size;
        int i;
        ArrayList arrayList2;
        MediaType mediaType;
        C0143b c0143b;
        F6.a aVar = F6.a.f2580q;
        int i5 = this.f3164x;
        ?? r42 = 0;
        B b9 = this.f3166z;
        if (i5 == 0) {
            C1.N(obj);
            cD = b9.f3104g.f16277a.b() ? AbstractC0385z.d((InterfaceC0382w) this.f3165y, new w(b9, null)) : null;
            this.f3165y = cD;
            this.f3164x = 1;
            objA = b9.f3101d.a(this);
            if (objA != aVar) {
            }
            return aVar;
        }
        if (i5 != 1) {
            if (i5 != 2) {
                if (i5 != 3) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                C1.N(obj);
                return A6.n.f457a;
            }
            ArrayList arrayList3 = this.f3163w;
            list = this.f3162v;
            b8 = this.f3161u;
            obj2 = this.f3165y;
            C1.N(obj);
            arrayList = arrayList3;
            objJ = obj;
            c0143b = (C0143b) objJ;
            if (c0143b != null) {
                arrayList.add(c0143b);
            }
            ArrayList arrayList4 = new ArrayList();
            for (Object obj3 : list) {
                if (!(((k5.i) obj3) instanceof C1107g)) {
                    arrayList4.add(obj3);
                }
            }
            size = arrayList4.size();
            i = 0;
            while (i < size) {
                Object obj4 = arrayList4.get(i);
                i++;
                k5.i iVar = (k5.i) obj4;
                if (iVar instanceof C1104d) {
                    C1104d c1104d = (C1104d) iVar;
                    Shortcut shortcut = c1104d.f13969a;
                    ArrayList arrayListY0 = B6.k.y0(c1104d.f13970b);
                    arrayListY0.add(new C1101a(new Movie(0L, (String) null, (String) null, (String) null, (String) null, (String) null, 0, (MediaType) null, (String) null, (String) null, false, 0, 0, (String) null, 0.0d, 0L, (List) null, (List) null, (List) null, (List) null, false, (Vote) null, 8388606)));
                    arrayList.add(new C0143b(shortcut.f11086r, r42, arrayListY0, r42));
                } else if (iVar instanceof C1105e) {
                    C1105e c1105e = (C1105e) iVar;
                    Shortcut shortcut2 = c1105e.f13971a;
                    ArrayList arrayListY02 = B6.k.y0(c1105e.f13972b);
                    arrayListY02.add(new Movie(-100L, (String) null, (String) null, c1105e.f13971a.f11085q, (String) null, (String) null, 0, (MediaType) null, (String) null, (String) null, false, 0, 0, (String) null, 0.0d, 0L, (List) null, (List) null, (List) null, (List) null, false, (Vote) null, 8388598));
                    arrayList.add(new C0143b(shortcut2.f11086r, arrayListY02, r42, r42));
                } else if (iVar instanceof k5.h) {
                    k5.h hVar = (k5.h) iVar;
                    for (k5.o oVar : hVar.f13976b) {
                        Shortcut shortcut3 = hVar.f13975a;
                        ArrayList arrayListY03 = B6.k.y0(oVar.f13988c);
                        List list2 = oVar.f13988c;
                        Movie movie = (Movie) B6.k.i0(list2);
                        if (movie == null || (mediaType = movie.f11076x) == null) {
                            mediaType = MediaType.f11105r;
                        }
                        arrayListY03.add(new Movie(-100L, (String) null, (String) null, shortcut3.f11085q, (String) null, (String) null, 0, mediaType, (String) null, (String) null, false, 0, 0, (String) null, 0.0d, 0L, (List) null, (List) null, (List) null, (List) null, false, (Vote) null, 8388470));
                        Movie movie2 = (Movie) B6.k.i0(list2);
                        arrayList.add(new C0143b(shortcut3.f11086r, arrayListY03, null, movie2 != null ? movie2.f11076x : null));
                        arrayList4 = arrayList4;
                    }
                }
                arrayList4 = arrayList4;
                r42 = 0;
            }
            b8.f3106j.f(arrayList);
            arrayList2 = new ArrayList();
            for (Object obj5 : list) {
                if (obj5 instanceof C1107g) {
                    arrayList2.add(obj5);
                }
            }
            if (!arrayList2.isEmpty()) {
                b8.f3105h.f(B6.k.h0(arrayList2));
            }
            thA = A6.j.a(obj2);
            if (thA != null) {
                this.f3165y = obj2;
                this.f3161u = null;
                this.f3162v = null;
                this.f3163w = null;
                this.f3164x = 3;
            }
            return A6.n.f457a;
        }
        cD = (Z6.C) this.f3165y;
        C1.N(obj);
        objA = ((A6.j) obj).f449q;
        obj2 = objA;
        if (obj2 instanceof A6.i) {
            thA = A6.j.a(obj2);
            if (thA != null) {
            }
            return A6.n.f457a;
        }
        list = (List) obj2;
        arrayList = new ArrayList();
        if (cD == null) {
            b8 = b9;
            ArrayList arrayList42 = new ArrayList();
            while (r10.hasNext()) {
            }
            size = arrayList42.size();
            i = 0;
            while (i < size) {
            }
            b8.f3106j.f(arrayList);
            arrayList2 = new ArrayList();
            while (r3.hasNext()) {
            }
            if (!arrayList2.isEmpty()) {
            }
            thA = A6.j.a(obj2);
            if (thA != null) {
            }
            return A6.n.f457a;
        }
        this.f3165y = obj2;
        this.f3161u = b9;
        this.f3162v = list;
        this.f3163w = arrayList;
        this.f3164x = 2;
        objJ = cD.j(this);
        if (objJ != aVar) {
            b8 = b9;
            c0143b = (C0143b) objJ;
            if (c0143b != null) {
            }
            ArrayList arrayList422 = new ArrayList();
            while (r10.hasNext()) {
            }
            size = arrayList422.size();
            i = 0;
            while (i < size) {
            }
            b8.f3106j.f(arrayList);
            arrayList2 = new ArrayList();
            while (r3.hasNext()) {
            }
            if (!arrayList2.isEmpty()) {
            }
            thA = A6.j.a(obj2);
            if (thA != null) {
            }
            return A6.n.f457a;
        }
        return aVar;
    }
}
