package v3; import androidx.paging.compose.c; import bh4.d; import com.tencent.thumbplayer.api.TPOptionalID; import dh4.f; import dh4.j; import gk4.h; import gk4.n0; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import jk4.g; import kh4.l; import kh4.p; import kotlin.ResultKt; import lh4.a0; import lh4.m; import lh4.o; import v3.f2; import v3.g0; import v3.n0; import v3.n1; import wg4.b0; import xg4.c0; @f(c = "androidx.paging.PagingDataDiffer$collectFrom$2", f = "PagingDataDiffer.kt", l = {390}, m = "invokeSuspend") public final class o1 extends j implements l<d<? super b0>, Object> { /* renamed from: d reason: collision with root package name */ public int f322460d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ n1 f322461e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ m1 f322462f; public static final class a implements g<n0<Object>> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ o1 f322463d; @f(c = "androidx.paging.PagingDataDiffer$collectFrom$2$1$1", f = "PagingDataDiffer.kt", l = {TPOptionalID.OPTION_ID_BEFORE_LONG_SEEK_AV_PTS_ALIGN_MAX_THRESHOLD_MS, 180}, m = "invokeSuspend") /* renamed from: v3.o1$a$a reason: collision with other inner class name */ public static final class C5653a extends j implements p<n0, d<? super b0>, Object> { /* renamed from: d reason: collision with root package name */ public Object f322464d; /* renamed from: e reason: collision with root package name */ public Object f322465e; /* renamed from: f reason: collision with root package name */ public int f322466f; /* renamed from: g reason: collision with root package name */ public final /* synthetic */ n0 f322467g; /* renamed from: h reason: collision with root package name */ public final /* synthetic */ a f322468h; /* renamed from: v3.o1$a$a$a reason: collision with other inner class name */ public static final class C5654a extends o implements kh4.a<b0> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ C5653a f322469d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ a1 f322470e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ a0 f322471f; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public C5654a(C5653a aVar, a1 a1Var, a0 a0Var) { super(0); this.f322469d = aVar; this.f322470e = a1Var; this.f322471f = a0Var; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public b0 invoke() { this.f322469d.f322468h.f322463d.f322461e.f322414a = this.f322470e; this.f322471f.f253280d = true; return b0.f332794a; } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public C5653a(n0 n0Var, d dVar, a aVar) { super(2, dVar); this.f322467g = n0Var; this.f322468h = aVar; } @Override // dh4.a public final d<b0> create(Object obj, d<?> dVar) { m.g(dVar, "completion"); return new C5653a(this.f322467g, dVar, this.f322468h); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */ @Override // kh4.p public final Object invoke(n0 n0Var, d<? super b0> dVar) { return ((C5653a) create(n0Var, dVar)).invokeSuspend(b0.f332794a); } /* JADX WARNING: Removed duplicated region for block: B:109:0x0372 */ /* JADX WARNING: Removed duplicated region for block: B:110:0x037c */ /* JADX WARNING: Removed duplicated region for block: B:121:0x03b5 */ /* JADX WARNING: Removed duplicated region for block: B:124:0x03cb */ /* JADX WARNING: Removed duplicated region for block: B:33:0x0164 */ /* JADX WARNING: Removed duplicated region for block: B:56:0x025b */ /* JADX WARNING: Removed duplicated region for block: B:87:0x0317 */ /* JADX WARNING: Removed duplicated region for block: B:90:0x0326 */ @Override // dh4.a public final Object invokeSuspend(Object obj) { n0 n0Var; n0 n0Var2; boolean z15; boolean z16; boolean z17; int i15; int i16; Integer num; a1 a1Var; a0 a0Var; i0 i0Var = i0.REFRESH; int i17 = this.f322466f; if (i17 == 0) { ResultKt.throwOnFailure(obj); n0 n0Var3 = this.f322467g; if (!(n0Var3 instanceof n0.b) || ((n0.b) n0Var3).f322389a != i0Var) { this.f322468h.f322463d.f322461e.getClass(); n1 n1Var = this.f322468h.f322463d.f322461e; a1<T> a1Var2 = n1Var.f322414a; n0Var = this.f322467g; n1.b bVar = n1Var.f322421h; a1Var2.getClass(); i0 i0Var2 = i0.APPEND; i0 i0Var3 = i0.PREPEND; m.g(n0Var, "pageEvent"); m.g(bVar, "callback"); if (!(n0Var instanceof n0.b)) { } if (this.f322467g instanceof n0.a) { } n0Var2 = this.f322467g; if (n0Var2 instanceof n0.b) { } return b0.f332794a; } this.f322468h.f322463d.f322461e.f322419f = false; a1Var = new a1((n0.b) this.f322467g); a0Var = new a0(); a0Var.f253280d = false; n1 n1Var2 = this.f322468h.f322463d.f322461e; a1<T> a1Var3 = n1Var2.f322414a; m mVar = ((n0.b) this.f322467g).f322393e; C5654a aVar = new C5654a(this, a1Var, a0Var); this.f322464d = a1Var; this.f322465e = a0Var; this.f322466f = 1; aVar.invoke(); c.a(((c.b) n1Var2).f6783l); num = null; } else if (i17 == 1) { a0Var = (a0) this.f322465e; a1Var = (a1) this.f322464d; ResultKt.throwOnFailure(obj); num = obj; } else if (i17 == 2) { ResultKt.throwOnFailure(obj); n1 n1Var3 = this.f322468h.f322463d.f322461e; a1<T> a1Var22 = n1Var3.f322414a; n0Var = this.f322467g; n1.b bVar2 = n1Var3.f322421h; a1Var22.getClass(); i0 i0Var22 = i0.APPEND; i0 i0Var32 = i0.PREPEND; m.g(n0Var, "pageEvent"); m.g(bVar2, "callback"); if (!(n0Var instanceof n0.b)) { n0.b bVar3 = (n0.b) n0Var; Iterator<T> it = bVar3.f322390b.iterator(); int i18 = 0; while (it.hasNext()) { i18 += it.next().f322286b.size(); } int d15 = a1Var22.d(); int ordinal = bVar3.f322389a.ordinal(); if (ordinal != 0) { if (ordinal == 1) { int min = Math.min(a1Var22.f322193c, i18); int i19 = i18 - min; ((ArrayList) a1Var22.f322191a).addAll(0, bVar3.f322390b); a1Var22.f322192b += i18; a1Var22.f322193c = bVar3.f322391c; bVar2.f322426a.f322423j.c(a1Var22.f322193c - min, min); bVar2.b(0, i19); int d16 = (a1Var22.d() - d15) - i19; if (d16 > 0) { bVar2.b(0, d16); } else if (d16 < 0) { bVar2.f322426a.f322423j.a(0, -d16); } } else if (ordinal == 2) { int min2 = Math.min(a1Var22.f322194d, i18); int i25 = a1Var22.f322193c + a1Var22.f322192b; int i26 = i18 - min2; ArrayList arrayList = (ArrayList) a1Var22.f322191a; arrayList.addAll(arrayList.size(), bVar3.f322390b); a1Var22.f322192b += i18; a1Var22.f322194d = bVar3.f322392d; bVar2.f322426a.f322423j.c(i25, min2); bVar2.b(i25 + min2, i26); int d17 = (a1Var22.d() - d15) - i26; if (d17 > 0) { bVar2.b(a1Var22.d() - d17, d17); } else if (d17 < 0) { bVar2.f322426a.f322423j.a(a1Var22.d(), -d17); } } m mVar2 = bVar3.f322393e; b1 b1Var = new b1(bVar2); mVar2.getClass(); h0 h0Var = mVar2.f322369d; g0 g0Var = h0Var.f322325a; Boolean bool = Boolean.FALSE; b1Var.invoke(i0Var, bool, g0Var); b1Var.invoke(i0Var32, bool, h0Var.f322326b); b1Var.invoke(i0Var22, bool, h0Var.f322327c); h0 h0Var2 = mVar2.f322370e; if (h0Var2 != null) { g0 g0Var2 = h0Var2.f322325a; Boolean bool2 = Boolean.TRUE; b1Var.invoke(i0Var, bool2, g0Var2); b1Var.invoke(i0Var32, bool2, h0Var2.f322326b); b1Var.invoke(i0Var22, bool2, h0Var2.f322327c); } } else { throw new IllegalArgumentException(); } } else if (n0Var instanceof n0.a) { n0.a aVar2 = (n0.a) n0Var; int d18 = a1Var22.d(); if (aVar2.f322383a == i0Var32) { int i27 = a1Var22.f322193c; a1Var22.f322192b -= a1Var22.b(new rh4.j(aVar2.f322384b, aVar2.f322385c)); a1Var22.f322193c = aVar2.f322386d; int d19 = a1Var22.d() - d18; if (d19 > 0) { i16 = 0; bVar2.b(0, d19); } else { i16 = 0; if (d19 < 0) { bVar2.f322426a.f322423j.a(0, -d19); } } int max = Math.max(i16, i27 + d19); int i28 = aVar2.f322386d - max; if (i28 > 0) { bVar2.f322426a.f322423j.c(max, i28); } bVar2.a(i0Var32, false, g0.c.f322320c); } else { int i29 = a1Var22.f322194d; a1Var22.f322192b -= a1Var22.b(new rh4.j(aVar2.f322384b, aVar2.f322385c)); a1Var22.f322194d = aVar2.f322386d; int d25 = a1Var22.d() - d18; if (d25 > 0) { bVar2.b(d18, d25); } else if (d25 < 0) { bVar2.f322426a.f322423j.a(d18 + d25, -d25); } if (d25 < 0) { i15 = Math.min(i29, -d25); } else { i15 = 0; } int i35 = aVar2.f322386d - (i29 - i15); if (i35 > 0) { bVar2.f322426a.f322423j.c(a1Var22.d() - aVar2.f322386d, i35); } bVar2.a(i0Var22, false, g0.c.f322320c); } } else if (n0Var instanceof n0.c) { n0.c cVar = (n0.c) n0Var; bVar2.a(cVar.f322411a, cVar.f322412b, cVar.f322413c); } if (this.f322467g instanceof n0.a) { this.f322468h.f322463d.f322461e.f322419f = false; } n0Var2 = this.f322467g; if (n0Var2 instanceof n0.b) { n0.b bVar4 = (n0.b) n0Var2; m mVar3 = bVar4.f322393e; boolean z18 = mVar3.f322367b.f322316a; boolean z19 = mVar3.f322368c.f322316a; i0 i0Var4 = bVar4.f322389a; if ((i0Var4 != i0Var32 || !z18) && (i0Var4 != i0Var22 || !z19)) { z15 = true; } else { z15 = false; } List<d2<T>> list = bVar4.f322390b; if (!(list instanceof Collection) || !list.isEmpty()) { Iterator<T> it4 = list.iterator(); while (true) { if (it4.hasNext()) { if (!Boolean.valueOf(it4.next().f322286b.isEmpty()).booleanValue()) { z16 = false; break; } } else { break; } } if (z15) { this.f322468h.f322463d.f322461e.f322419f = false; } else if (this.f322468h.f322463d.f322461e.f322419f || z16) { if (!z16) { int i36 = this.f322468h.f322463d.f322461e.f322420g; n1 n1Var4 = this.f322468h.f322463d.f322461e; if (i36 >= n1Var4.f322414a.f322193c) { int i37 = n1Var4.f322420g; a1<T> a1Var4 = this.f322468h.f322463d.f322461e.f322414a; if (i37 <= a1Var4.f322193c + a1Var4.f322192b) { z17 = false; if (!z17) { n1 n1Var5 = this.f322468h.f322463d.f322461e; e2 e2Var = n1Var5.f322415b; if (e2Var != null) { e2Var.a(n1Var5.f322414a.a(n1Var5.f322420g)); } } else { this.f322468h.f322463d.f322461e.f322419f = false; } } } } z17 = true; if (!z17) { } } } z16 = true; if (z15) { } } return b0.f332794a; } else { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } Integer num2 = num; if (a0Var.f253280d) { n1 n1Var6 = this.f322468h.f322463d.f322461e; m mVar4 = ((n0.b) this.f322467g).f322393e; if (!m.b(n1Var6.f322416c.c(), mVar4)) { m0 m0Var = n1Var6.f322416c; m0Var.getClass(); m.g(mVar4, "combinedLoadStates"); m0Var.f322371a = mVar4.f322366a; m0Var.f322372b = mVar4.f322367b; m0Var.f322373c = mVar4.f322368c; m0Var.f322374d = mVar4.f322369d; m0Var.f322375e = mVar4.f322370e; Iterator<l<m, b0>> it5 = n1Var6.f322417d.iterator(); while (it5.hasNext()) { it5.next().invoke(mVar4); } } if (num2 == null) { e2 e2Var2 = this.f322468h.f322463d.f322461e.f322415b; if (e2Var2 != null) { int i38 = a1Var.f322192b / 2; Integer U = xg4.o.U(((d2) c0.O(a1Var.f322191a)).f322285a); m.d(U); int intValue = U.intValue(); Integer T = xg4.o.T(((d2) c0.X(a1Var.f322191a)).f322285a); m.d(T); e2Var2.a(new f2.b(i38, i38, intValue, T.intValue())); } } else { this.f322468h.f322463d.f322461e.f322420g = num2.intValue(); e2 e2Var3 = this.f322468h.f322463d.f322461e.f322415b; if (e2Var3 != null) { e2Var3.a(a1Var.a(num2.intValue())); } } return b0.f332794a; } throw new IllegalStateException("Missing call to onListPresentable after new list was presented. If you are seeing this exception, it is generally an indication of an issue with Paging. Please file a bug so we can fix it at: https://issuetracker.google.com/issues/new?component=413106".toString()); } } public a(o1 o1Var) { this.f322463d = o1Var; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, bh4.d] */ @Override // jk4.g public Object emit(n0<Object> n0Var, d dVar) { Object g15 = h.g(this.f322463d.f322461e.f322424k, new C5653a(n0Var, null, this), dVar); if (g15 == ch4.a.COROUTINE_SUSPENDED) { return g15; } return b0.f332794a; } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public o1(n1 n1Var, m1 m1Var, d dVar) { super(1, dVar); this.f322461e = n1Var; this.f322462f = m1Var; } @Override // dh4.a public final d<b0> create(d<?> dVar) { m.g(dVar, "completion"); return new o1(this.f322461e, this.f322462f, dVar); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kh4.l public final Object invoke(d<? super b0> dVar) { return ((o1) create(dVar)).invokeSuspend(b0.f332794a); } @Override // dh4.a public final Object invokeSuspend(Object obj) { ch4.a aVar = ch4.a.COROUTINE_SUSPENDED; int i15 = this.f322460d; if (i15 == 0) { ResultKt.throwOnFailure(obj); n1 n1Var = this.f322461e; m1 m1Var = this.f322462f; n1Var.f322415b = m1Var.f322377b; jk4.f<n0<T>> fVar = m1Var.f322376a; a aVar2 = new a(this); this.f322460d = 1; if (fVar.a(aVar2, this) == aVar) { return aVar; } } else if (i15 == 1) { ResultKt.throwOnFailure(obj); } else { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } return b0.f332794a; } }