package l0;

import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.util.List;
import q2.d;

/* loaded from: classes.dex */
public abstract class n0 {

    /* renamed from: a, reason: collision with root package name */
    public static final a f27142a = new a(null);

    /* loaded from: classes.dex */
    public static final class a {

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: l0.n0$a$a, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        public static final class C0596a extends kotlin.jvm.internal.v implements dn.l {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ w2.k f27143p;

            /* renamed from: q, reason: collision with root package name */
            final /* synthetic */ dn.l f27144q;

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ kotlin.jvm.internal.o0 f27145r;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0596a(w2.k kVar, dn.l lVar, kotlin.jvm.internal.o0 o0Var) {
                super(1);
                this.f27143p = kVar;
                this.f27144q = lVar;
                this.f27145r = o0Var;
            }

            public final void a(List list) {
                n0.f27142a.g(list, this.f27143p, this.f27144q, (w2.y0) this.f27145r.f26199p);
            }

            @Override // dn.l
            public /* bridge */ /* synthetic */ Object invoke(Object obj) {
                a((List) obj);
                return rm.n0.f34904a;
            }
        }

        /* loaded from: classes.dex */
        static final class b extends kotlin.jvm.internal.v implements dn.l {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ h2.s f27146p;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            b(h2.s sVar) {
                super(1);
                this.f27146p = sVar;
            }

            public final void a(float[] fArr) {
                if (this.f27146p.N()) {
                    h2.t.d(this.f27146p).o0(this.f27146p, fArr);
                }
            }

            @Override // dn.l
            public /* bridge */ /* synthetic */ Object invoke(Object obj) {
                a(((s1.z0) obj).r());
                return rm.n0.f34904a;
            }
        }

        private a() {
        }

        public /* synthetic */ a(kotlin.jvm.internal.k kVar) {
            this();
        }

        private final void c(s1.a0 a0Var, long j10, w2.h0 h0Var, q2.j0 j0Var, s1.d1 d1Var) {
            int b10 = h0Var.b(q2.m0.l(j10));
            int b11 = h0Var.b(q2.m0.k(j10));
            if (b10 != b11) {
                a0Var.k(j0Var.z(b10, b11), d1Var);
            }
        }

        public final w2.z0 a(long j10, w2.z0 z0Var) {
            int b10 = z0Var.a().b(q2.m0.n(j10));
            int b11 = z0Var.a().b(q2.m0.i(j10));
            int min = Math.min(b10, b11);
            int max = Math.max(b10, b11);
            d.a aVar = new d.a(z0Var.b());
            aVar.b(new q2.b0(0L, 0L, null, null, null, null, null, 0L, null, null, null, 0L, b3.k.f6700b.d(), null, null, null, 61439, null), min, max);
            return new w2.z0(aVar.m(), z0Var.a());
        }

        public final void b(s1.a0 a0Var, w2.q0 q0Var, long j10, long j11, w2.h0 h0Var, q2.j0 j0Var, s1.d1 d1Var, long j12) {
            if (!q2.m0.h(j10)) {
                d1Var.G(j12);
                c(a0Var, j10, h0Var, j0Var, d1Var);
            } else if (!q2.m0.h(j11)) {
                s1.g0 h10 = s1.g0.h(j0Var.l().i().h());
                if (h10.v() == 16) {
                    h10 = null;
                }
                long v10 = h10 != null ? h10.v() : s1.g0.f35254b.a();
                d1Var.G(s1.g0.l(v10, s1.g0.o(v10) * 0.2f, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 14, null));
                c(a0Var, j11, h0Var, j0Var, d1Var);
            } else if (!q2.m0.h(q0Var.g())) {
                d1Var.G(j12);
                c(a0Var, q0Var.g(), h0Var, j0Var, d1Var);
            }
            q2.l0.f33347a.a(a0Var, j0Var);
        }

        public final rm.b0 d(j0 j0Var, long j10, c3.t tVar, q2.j0 j0Var2) {
            q2.j0 l10 = j0Var.l(j10, tVar, j0Var2);
            return new rm.b0(Integer.valueOf(c3.r.g(l10.B())), Integer.valueOf(c3.r.f(l10.B())), l10);
        }

        public final void e(w2.q0 q0Var, j0 j0Var, q2.j0 j0Var2, h2.s sVar, w2.y0 y0Var, boolean z10, w2.h0 h0Var) {
            if (z10) {
                int b10 = h0Var.b(q2.m0.k(q0Var.g()));
                r1.i d10 = b10 < j0Var2.l().j().length() ? j0Var2.d(b10) : b10 != 0 ? j0Var2.d(b10 - 1) : new r1.i(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 1.0f, c3.r.f(o0.b(j0Var.j(), j0Var.a(), j0Var.b(), null, 0, 24, null)));
                long r02 = sVar.r0(r1.h.a(d10.i(), d10.l()));
                y0Var.c(r1.j.b(r1.h.a(r1.g.m(r02), r1.g.n(r02)), r1.n.a(d10.n(), d10.h())));
            }
        }

        public final void f(w2.y0 y0Var, w2.k kVar, dn.l lVar) {
            lVar.invoke(w2.q0.d(kVar.f(), null, 0L, null, 3, null));
            y0Var.a();
        }

        public final void g(List list, w2.k kVar, dn.l lVar, w2.y0 y0Var) {
            w2.q0 b10 = kVar.b(list);
            if (y0Var != null) {
                y0Var.d(null, b10);
            }
            lVar.invoke(b10);
        }

        public final w2.y0 h(w2.s0 s0Var, w2.q0 q0Var, w2.k kVar, w2.s sVar, dn.l lVar, dn.l lVar2) {
            return i(s0Var, q0Var, kVar, sVar, lVar, lVar2);
        }

        public final w2.y0 i(w2.s0 s0Var, w2.q0 q0Var, w2.k kVar, w2.s sVar, dn.l lVar, dn.l lVar2) {
            kotlin.jvm.internal.o0 o0Var = new kotlin.jvm.internal.o0();
            w2.y0 d10 = s0Var.d(q0Var, sVar, new C0596a(kVar, lVar, o0Var), lVar2);
            o0Var.f26199p = d10;
            return d10;
        }

        public final void j(long j10, a1 a1Var, w2.k kVar, w2.h0 h0Var, dn.l lVar) {
            lVar.invoke(w2.q0.d(kVar.f(), null, q2.n0.a(h0Var.a(a1.e(a1Var, j10, false, 2, null))), null, 5, null));
        }

        public final void k(w2.y0 y0Var, w2.q0 q0Var, w2.h0 h0Var, a1 a1Var) {
            h2.s b10;
            h2.s c10 = a1Var.c();
            if (c10 == null || !c10.N() || (b10 = a1Var.b()) == null) {
                return;
            }
            y0Var.e(q0Var, h0Var, a1Var.f(), new b(c10), r0.z.b(c10), c10.f0(b10, false));
        }
    }
}
