package K;

import B.AbstractC0069k;
import G0.InterfaceC0249c0;
import a0.AbstractC0905i;
import android.content.Context;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.compose.runtime.MutableState;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.ui.PlayerView;
import androidx.media3.ui.SubtitleView;
import d3.RunnableC1896j0;
import java.util.ArrayList;
import java.util.List;
import o0.C2632c;
import w4.C3137A;
import x.EnumC3207z0;
import x4.AbstractC3252r;

/* JADX INFO: renamed from: K.a0, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class C0442a0 implements J4.c {

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

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

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

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

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

    public /* synthetic */ C0442a0(int i6, int i7, Object obj, Object obj2, Object obj3) {
        this.f3779a = i7;
        this.f3782d = obj;
        this.f3780b = obj2;
        this.f3783e = obj3;
        this.f3781c = i6;
    }

    @Override // J4.c
    public final Object invoke(Object obj) {
        switch (this.f3779a) {
            case 0:
                G0.p0 p0Var = (G0.p0) obj;
                C0444b0 c0444b0 = (C0444b0) this.f3782d;
                S0 s02 = (S0) c0444b0.f3793d.invoke();
                T0.L l = s02 != null ? s02.f3742a : null;
                boolean z6 = ((InterfaceC0249c0) this.f3780b).getLayoutDirection() == h1.m.f16629b;
                G0.q0 q0Var = (G0.q0) this.f3783e;
                C2632c c2632cF = AbstractC0454g0.f(p0Var, c0444b0.f3791b, c0444b0.f3792c, l, z6, q0Var.f1998a);
                EnumC3207z0 enumC3207z0 = EnumC3207z0.f25985b;
                int i6 = q0Var.f1998a;
                P0 p02 = c0444b0.f3790a;
                p02.a(enumC3207z0, c2632cF, this.f3781c, i6);
                G0.p0.r(p0Var, q0Var, Math.round(-p02.f3721a.getFloatValue()), 0);
                return C3137A.f25453a;
            case 1:
                G0.p0 p0Var2 = (G0.p0) obj;
                ArrayList arrayList = (ArrayList) this.f3782d;
                int size = arrayList.size();
                for (int i7 = 0; i7 < size; i7++) {
                    List list = (List) arrayList.get(i7);
                    int size2 = list.size();
                    int[] iArr = new int[size2];
                    int i8 = 0;
                    while (true) {
                        InterfaceC0249c0 interfaceC0249c0 = (InterfaceC0249c0) this.f3780b;
                        if (i8 < size2) {
                            iArr[i8] = ((G0.q0) list.get(i8)).f1998a + (i8 < AbstractC3252r.A(list) ? interfaceC0249c0.g0(AbstractC0905i.f9930c) : 0);
                            i8++;
                        } else {
                            int[] iArr2 = new int[size2];
                            AbstractC0069k.f324b.c(interfaceC0249c0, this.f3781c, iArr, interfaceC0249c0.getLayoutDirection(), iArr2);
                            int size3 = list.size();
                            for (int i9 = 0; i9 < size3; i9++) {
                                p0Var2.l((G0.q0) list.get(i9), iArr2[i9], ((Number) ((ArrayList) this.f3783e).get(i7)).intValue(), 0.0f);
                            }
                        }
                    }
                }
                return C3137A.f25453a;
            case 2:
                n0.q focusProperties = (n0.q) obj;
                kotlin.jvm.internal.o.h(focusProperties, "$this$focusProperties");
                List list2 = (List) this.f3780b;
                int i10 = this.f3781c;
                focusProperties.e(i10 == 0 ? (n0.x) this.f3782d : (n0.x) list2.get(i10 - 1));
                focusProperties.g(i10 == AbstractC3252r.A((List) this.f3783e) ? (n0.x) list2.get(i10) : (n0.x) list2.get(i10 + 1));
                focusProperties.i((n0.x) list2.get(i10));
                focusProperties.b((n0.x) list2.get(i10));
                return C3137A.f25453a;
            default:
                Context ctx = (Context) obj;
                kotlin.jvm.internal.o.h(ctx, "ctx");
                d3.F f6 = new d3.F(ctx);
                f6.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
                PlayerView playerView = new PlayerView(ctx);
                playerView.setUseController(false);
                playerView.setResizeMode(this.f3781c);
                playerView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
                f6.f15080a = playerView;
                SubtitleView subtitleView = new SubtitleView(ctx);
                subtitleView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
                subtitleView.setElevation(1000.0f);
                subtitleView.setClickable(false);
                subtitleView.setFocusable(false);
                subtitleView.setApplyEmbeddedFontSizes(false);
                f6.addView(playerView);
                f6.addView(subtitleView);
                d3.P p6 = new d3.P(f6, playerView, subtitleView);
                p6.a(ctx, (Bundle) this.f3782d);
                f6.setTag(p6);
                ((MutableState) this.f3780b).setValue(p6);
                playerView.post(new RunnableC1896j0(playerView, 0));
                p6.b((ExoPlayer) this.f3783e);
                return f6;
        }
    }

    public /* synthetic */ C0442a0(int i6, n0.x xVar, List list, List list2) {
        this.f3779a = 2;
        this.f3781c = i6;
        this.f3782d = xVar;
        this.f3780b = list;
        this.f3783e = list2;
    }

    public /* synthetic */ C0442a0(ArrayList arrayList, InterfaceC0249c0 interfaceC0249c0, int i6, ArrayList arrayList2) {
        this.f3779a = 1;
        float f6 = AbstractC0905i.f9928a;
        this.f3782d = arrayList;
        this.f3780b = interfaceC0249c0;
        this.f3781c = i6;
        this.f3783e = arrayList2;
    }
}
