package K;

import G.C0242q;
import J0.C0395y0;
import android.content.Context;
import android.content.Intent;
import android.speech.SpeechRecognizer;
import androidx.compose.runtime.MutableState;
import c0.C1217r;
import com.debridstream.tv.screens.SearchViewModel;
import h3.C2171p2;
import h3.C2186s0;
import o0.C2631b;
import p0.InterfaceC2687E;
import w4.C3137A;

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

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

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

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

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

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

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

    public /* synthetic */ A(Object obj, Object obj2, boolean z6, Object obj3, Object obj4, int i6) {
        this.f3548a = i6;
        this.f3550c = obj;
        this.f3551d = obj2;
        this.f3549b = z6;
        this.f3552e = obj3;
        this.f3553f = obj4;
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // J4.c
    public final Object invoke(Object obj) {
        switch (this.f3548a) {
            case 0:
                C2631b c2631b = (C2631b) obj;
                C0464l0 c0464l0 = (C0464l0) this.f3550c;
                if (c0464l0.b()) {
                    J0.Z0 z02 = c0464l0.f3891c;
                    if (z02 != null) {
                        ((C0395y0) z02).b();
                    }
                } else {
                    n0.x.a((n0.x) this.f3551d);
                }
                if (c0464l0.b() && this.f3549b) {
                    if (c0464l0.a() != Y.f3766b) {
                        S0 s0D = c0464l0.d();
                        if (s0D != null) {
                            int iA = ((Z0.r) this.f3553f).a(s0D.b(c2631b.f21785a, true));
                            c0464l0.f3909v.invoke(Z0.y.a((Z0.y) c0464l0.f3892d.f6345b, null, android.support.v4.media.session.b.g(iA, iA), 5));
                            if (c0464l0.f3889a.f4018a.f6510b.length() > 0) {
                                c0464l0.f3899k.setValue(Y.f3767c);
                            }
                        }
                    } else {
                        ((V.i0) this.f3552e).i(c2631b);
                    }
                }
                break;
            case 1:
                InterfaceC2687E interfaceC2687E = (InterfaceC2687E) obj;
                q.P p6 = (q.P) this.f3550c;
                boolean z6 = this.f3549b;
                MutableState mutableState = p6.f23211c;
                q.y0 y0Var = (q.y0) this.f3552e;
                float fFloatValue = 0.8f;
                float fFloatValue2 = 1.0f;
                p0.U u6 = (p0.U) interfaceC2687E;
                u6.w(!z6 ? ((Number) y0Var.f23483m.getValue()).floatValue() : ((Boolean) mutableState.getValue()).booleanValue() ? 1.0f : 0.8f);
                if (!z6) {
                    fFloatValue = ((Number) y0Var.f23483m.getValue()).floatValue();
                } else if (((Boolean) mutableState.getValue()).booleanValue()) {
                    fFloatValue = 1.0f;
                }
                u6.z(fFloatValue);
                if (!z6) {
                    fFloatValue2 = ((Number) ((q.y0) this.f3553f).f23483m.getValue()).floatValue();
                } else if (!((Boolean) mutableState.getValue()).booleanValue()) {
                    fFloatValue2 = 0.0f;
                }
                u6.d(fFloatValue2);
                u6.J(((p0.c0) ((MutableState) this.f3551d).getValue()).f22907a);
                break;
            default:
                boolean zBooleanValue = ((Boolean) obj).booleanValue();
                MutableState mutableState2 = (MutableState) this.f3553f;
                if (zBooleanValue) {
                    C2186s0 c2186s0 = new C2186s0((MutableState) this.f3552e, 19);
                    C2186s0 c2186s02 = new C2186s0(mutableState2, 20);
                    a3.a0 a0Var = (a3.a0) this.f3550c;
                    Context context = a0Var.f10615a;
                    if (SpeechRecognizer.isRecognitionAvailable(context)) {
                        c2186s0.invoke(Boolean.TRUE);
                        SearchViewModel searchViewModel = (SearchViewModel) this.f3551d;
                        C2171p2 c2171p2 = new C2171p2(searchViewModel, 0);
                        C0242q c0242q = new C0242q(searchViewModel, this.f3549b, c2186s0);
                        C1217r c1217r = new C1217r(8, c2186s0, c2186s02);
                        a0Var.b();
                        if (SpeechRecognizer.isRecognitionAvailable(context)) {
                            SpeechRecognizer speechRecognizerCreateSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(context);
                            a0Var.f10616b = speechRecognizerCreateSpeechRecognizer;
                            Intent intent = new Intent("android.speech.action.RECOGNIZE_SPEECH");
                            intent.putExtra("android.speech.extra.LANGUAGE_MODEL", "free_form");
                            intent.putExtra("android.speech.extra.PARTIAL_RESULTS", true);
                            intent.putExtra("android.speech.extra.MAX_RESULTS", 5);
                            speechRecognizerCreateSpeechRecognizer.setRecognitionListener(new a3.Z(c1217r, c0242q, c2171p2));
                            speechRecognizerCreateSpeechRecognizer.startListening(intent);
                        } else {
                            c1217r.invoke("Speech recognition not available");
                        }
                    } else {
                        c2186s0.invoke(Boolean.FALSE);
                        c2186s02.invoke("Speech recognition not available");
                    }
                } else {
                    mutableState2.setValue("Microphone permission denied");
                }
                break;
        }
        return C3137A.f25453a;
    }

    public /* synthetic */ A(boolean z6, q.P p6, MutableState mutableState, q.y0 y0Var, q.y0 y0Var2) {
        this.f3548a = 1;
        this.f3549b = z6;
        this.f3550c = p6;
        this.f3551d = mutableState;
        this.f3552e = y0Var;
        this.f3553f = y0Var2;
    }
}
