package m3;

import V4.C;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.State;
import androidx.media3.exoplayer.ExoPlayer;
import w4.C3137A;

/* JADX INFO: renamed from: m3.r, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2483r extends C4.j implements J4.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public String f20528a;

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

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

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C2483r(String str, ExoPlayer exoPlayer, State state, EnumC2466a enumC2466a, MutableState mutableState, MutableState mutableState2, A4.d dVar) {
        super(2, dVar);
        this.f20530c = str;
        this.f20531d = exoPlayer;
        this.f20532e = state;
        this.f20533f = enumC2466a;
        this.f20534j = mutableState;
        this.f20535k = mutableState2;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C2483r(this.f20530c, this.f20531d, this.f20532e, this.f20533f, this.f20534j, this.f20535k, dVar);
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        return ((C2483r) create((C) obj, (A4.d) obj2)).invokeSuspend(C3137A.f25453a);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:13:0x0037  */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        String str;
        Object obj2;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f20529b;
        C3137A c3137a = C3137A.f25453a;
        MutableState mutableState = this.f20535k;
        MutableState mutableState2 = this.f20534j;
        State state = this.f20532e;
        if (i6 == 0) {
            AbstractC2467b.l(obj);
            String str2 = this.f20530c;
            if (str2 != null) {
                S4.m mVar = AbstractC2476k.f20513a;
                if (!AbstractC2476k.f20513a.d(str2)) {
                    str2 = null;
                }
                if (str2 == null) {
                    mutableState2.setValue(null);
                    mutableState.setValue(null);
                    ExoPlayer exoPlayer = this.f20531d;
                    exoPlayer.stop();
                    exoPlayer.clearMediaItems();
                    ((J4.c) state.getValue()).invoke(Boolean.FALSE);
                    return c3137a;
                }
                if (!str2.equals((String) mutableState2.getValue()) || ((AbstractC2471f) mutableState.getValue()) == null) {
                    mutableState2.setValue(str2);
                    mutableState.setValue(null);
                    ((J4.c) state.getValue()).invoke(Boolean.FALSE);
                    C2475j c2475j = C2475j.f20506a;
                    this.f20528a = str2;
                    this.f20529b = 1;
                    Object objE = c2475j.e(str2, this.f20533f, this);
                    if (objE == aVar) {
                        return aVar;
                    }
                    str = str2;
                    obj2 = objE;
                }
            }
            return c3137a;
        }
        if (i6 != 1) {
            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
        str = this.f20528a;
        AbstractC2467b.l(obj);
        obj2 = ((w4.n) obj).f25472a;
        if (!(obj2 instanceof w4.m)) {
            AbstractC2471f abstractC2471f = (AbstractC2471f) obj2;
            if (kotlin.jvm.internal.o.c((String) mutableState2.getValue(), str)) {
                mutableState.setValue(abstractC2471f);
            }
        }
        if (w4.n.a(obj2) != null && kotlin.jvm.internal.o.c((String) mutableState2.getValue(), str)) {
            mutableState2.setValue(null);
            ((J4.c) state.getValue()).invoke(Boolean.FALSE);
        }
        return c3137a;
    }
}
