package h3;

import com.debridstream.tv.data.home.HomeMetaItem;
import com.debridstream.tv.screens.VideoDetailsViewModel;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class A5 extends C4.j implements J4.e {

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

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public A5(int i6, VideoDetailsViewModel videoDetailsViewModel, HomeMetaItem homeMetaItem, boolean z6, String str, A4.d dVar) {
        super(2, dVar);
        this.f16675b = i6;
        this.f16676c = videoDetailsViewModel;
        this.f16677d = homeMetaItem;
        this.f16678e = z6;
        this.f16679f = str;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new A5(this.f16675b, this.f16676c, this.f16677d, this.f16678e, this.f16679f, dVar);
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:20:0x006c, code lost:
    
        if (r0 == r2) goto L21;
     */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        Y4.c0 c0Var;
        Object value;
        z5 z5Var;
        String message;
        Object objH;
        Y4.c0 c0Var2;
        Object value2;
        HomeMetaItem homeMetaItem = this.f16677d;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f16674a;
        C3137A c3137a = C3137A.f25453a;
        VideoDetailsViewModel videoDetailsViewModel = this.f16676c;
        int i7 = this.f16675b;
        try {
        } catch (Exception e6) {
            if (i7 == videoDetailsViewModel.requestGeneration.get()) {
                Y4.H h5 = videoDetailsViewModel._uiState;
                do {
                    c0Var = (Y4.c0) h5;
                    value = c0Var.getValue();
                    z5Var = (z5) value;
                    message = e6.getMessage();
                    if (message == null) {
                        message = "Failed to load details";
                    }
                } while (!c0Var.i(value, z5.a(z5Var, null, message, false, 0, 51)));
            }
        }
        if (i6 == 0) {
            AbstractC2467b.l(obj);
            this.f16674a = 1;
            if (V4.E.K(this) != aVar) {
            }
            return aVar;
        }
        if (i6 != 1) {
            if (i6 != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            AbstractC2467b.l(obj);
            objH = obj;
            X2.g gVar = (X2.g) objH;
            if (i7 == videoDetailsViewModel.requestGeneration.get()) {
                Y4.H h6 = videoDetailsViewModel._uiState;
                do {
                    c0Var2 = (Y4.c0) h6;
                    value2 = c0Var2.getValue();
                } while (!c0Var2.i(value2, z5.a((z5) value2, gVar, null, false, 0, 49)));
            }
            return c3137a;
        }
        AbstractC2467b.l(obj);
        if (i7 == videoDetailsViewModel.requestGeneration.get()) {
            X2.f fVar = videoDetailsViewModel.dsMetaRepository;
            int tmdbId = homeMetaItem.getTmdbId();
            String type = homeMetaItem.getType();
            boolean zD0 = W.a.D0(homeMetaItem, this.f16678e, x4.y.f26065a);
            String str = this.f16679f;
            this.f16674a = 2;
            fVar.getClass();
            c5.e eVar = V4.N.f8259a;
            objH = V4.E.H(c5.d.f13466b, new X2.a(type, tmdbId, fVar, str, zD0, null), this);
        }
        return c3137a;
    }
}
