package M2;

import androidx.compose.runtime.MutableState;
import d3.v2;
import h3.C5;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class P1 implements J4.a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f4500a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f4501b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f4502c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ Object f4503d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ Object f4504e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ Object f4505f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final /* synthetic */ Object f4506j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ Object f4507k;

    public /* synthetic */ P1(V4.C c6, MutableState mutableState, MutableState mutableState2, MutableState mutableState3, MutableState mutableState4, X2.f fVar, MutableState mutableState5) {
        this.f4500a = 0;
        this.f4501b = c6;
        this.f4502c = mutableState;
        this.f4503d = mutableState2;
        this.f4504e = mutableState3;
        this.f4505f = mutableState4;
        this.f4507k = fVar;
        this.f4506j = mutableState5;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:35:0x00cd  */
    @Override // J4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invoke() {
        C3137A c3137a = C3137A.f25453a;
        Object obj = this.f4501b;
        Object obj2 = this.f4507k;
        Object obj3 = this.f4506j;
        Object obj4 = this.f4505f;
        Object obj5 = this.f4504e;
        Object obj6 = this.f4503d;
        Object obj7 = this.f4502c;
        switch (this.f4500a) {
            case 0:
                MutableState mutableState = (MutableState) obj7;
                if (!((Boolean) mutableState.getValue()).booleanValue()) {
                    Integer numB0 = S4.w.B0((String) ((MutableState) obj6).getValue());
                    int iIntValue = numB0 != null ? numB0.intValue() : 0;
                    if (iIntValue > 0) {
                        mutableState.setValue(Boolean.TRUE);
                        MutableState mutableState2 = (MutableState) obj5;
                        mutableState2.setValue(null);
                        MutableState mutableState3 = (MutableState) obj4;
                        mutableState3.setValue(0);
                        V4.E.y((V4.C) obj, null, null, new Q1((X2.f) obj2, iIntValue, (MutableState) obj3, mutableState2, mutableState3, mutableState, null), 3);
                    } else {
                        a5.c cVar = K2.p.f4116a;
                        K2.p.a("Enter a valid TMDB id", (10 & 2) != 0 ? "" : "Could not resolve a playable download URL for this link.", K2.r.f4129d, (10 & 8) != 0 ? androidx.media3.common.C.DEFAULT_MAX_SEEK_TO_PREVIOUS_POSITION_MS : 4000L);
                    }
                }
                break;
            case 1:
                AtomicBoolean atomicBoolean = (AtomicBoolean) obj;
                atomicBoolean.set(true);
                AtomicBoolean atomicBoolean2 = (AtomicBoolean) obj5;
                J4.a aVar = (J4.a) obj2;
                N2.q.k(atomicBoolean, atomicBoolean2, (AtomicInteger) obj4, (AtomicInteger) obj3, aVar);
                ((CopyOnWriteArrayList) obj6).add(V4.E.y((a5.c) obj7, null, null, new N2.p(atomicBoolean2, aVar, null), 3));
                break;
            case 2:
                MutableState mutableState4 = (MutableState) obj7;
                if (v2.V(mutableState4)) {
                    mutableState4.setValue(Boolean.FALSE);
                    break;
                } else {
                    MutableState mutableState5 = (MutableState) obj6;
                    if (v2.T(mutableState5)) {
                        mutableState5.setValue(Boolean.FALSE);
                        break;
                    } else {
                        MutableState mutableState6 = (MutableState) obj5;
                        if (v2.Q(mutableState6)) {
                            mutableState6.setValue(Boolean.FALSE);
                            break;
                        } else {
                            MutableState mutableState7 = (MutableState) obj4;
                            if (v2.S(mutableState7)) {
                                MutableState mutableState8 = (MutableState) obj3;
                                if (((d3.G) mutableState8.getValue()) == d3.G.f15095b) {
                                    mutableState8.setValue(d3.G.f15094a);
                                } else if (!((Boolean) mutableState7.getValue()).booleanValue()) {
                                    MutableState mutableState9 = (MutableState) obj;
                                    if (((d3.D) mutableState9.getValue()) == d3.D.f15044c || ((d3.D) mutableState9.getValue()) == d3.D.f15043b) {
                                        mutableState9.setValue(d3.D.f15042a);
                                    } else {
                                        ((MutableState) obj2).setValue(Boolean.FALSE);
                                    }
                                } else {
                                    mutableState7.setValue(Boolean.FALSE);
                                }
                                break;
                            }
                        }
                    }
                }
                break;
            default:
                MutableState mutableState10 = (MutableState) obj7;
                if (!((Boolean) mutableState10.getValue()).booleanValue()) {
                    MutableState mutableState11 = (MutableState) obj6;
                    if (!((Boolean) mutableState11.getValue()).booleanValue()) {
                        MutableState mutableState12 = (MutableState) obj5;
                        if (!((Boolean) mutableState12.getValue()).booleanValue()) {
                            MutableState mutableState13 = (MutableState) obj4;
                            if (!((Boolean) mutableState13.getValue()).booleanValue()) {
                                MutableState mutableState14 = (MutableState) obj3;
                                if (((C5) mutableState14.getValue()) != C5.f16742b) {
                                    ((J4.a) obj).invoke();
                                } else {
                                    ((MutableState) obj2).setValue(Boolean.TRUE);
                                    mutableState14.setValue(C5.f16741a);
                                }
                            } else {
                                mutableState13.setValue(Boolean.FALSE);
                            }
                        } else {
                            mutableState12.setValue(Boolean.FALSE);
                        }
                    } else {
                        mutableState11.setValue(Boolean.FALSE);
                    }
                } else {
                    mutableState10.setValue(Boolean.FALSE);
                }
                break;
        }
        return c3137a;
    }

    public /* synthetic */ P1(MutableState mutableState, MutableState mutableState2, MutableState mutableState3, MutableState mutableState4, MutableState mutableState5, MutableState mutableState6, MutableState mutableState7) {
        this.f4500a = 2;
        this.f4502c = mutableState;
        this.f4503d = mutableState2;
        this.f4504e = mutableState3;
        this.f4505f = mutableState4;
        this.f4506j = mutableState5;
        this.f4501b = mutableState6;
        this.f4507k = mutableState7;
    }

    public /* synthetic */ P1(Object obj, Object obj2, Object obj3, Object obj4, Object obj5, Object obj6, Object obj7, int i6) {
        this.f4500a = i6;
        this.f4501b = obj;
        this.f4502c = obj2;
        this.f4503d = obj3;
        this.f4504e = obj4;
        this.f4505f = obj5;
        this.f4506j = obj6;
        this.f4507k = obj7;
    }
}
