package xyz.stream.api.database;

import java.util.Iterator;
import java.util.List;
import vf.w;
import xyz.stream.api.database.entity.RecordEntity;
import xyz.stream.utils.f0;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class p implements Runnable {

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

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

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

    public /* synthetic */ p(q qVar, Integer num, int i10) {
        this.f35839a = i10;
        this.f35840b = qVar;
        this.f35841c = num;
    }

    @Override // java.lang.Runnable
    public final void run() {
        int i10 = this.f35839a;
        Integer num = this.f35841c;
        q qVar = this.f35840b;
        switch (i10) {
            case 0:
                qVar.getClass();
                String strQ = f0.o().q("flutter.selectRoles", "");
                if (num == null) {
                    List listB = ((vf.i) qVar.f35844b).b(strQ);
                    if (listB != null && !listB.isEmpty()) {
                        Iterator it = listB.iterator();
                        while (it.hasNext()) {
                            ((vf.i) qVar.f35844b).a((RecordEntity) it.next());
                        }
                    }
                } else {
                    w wVar = qVar.f35844b;
                    int iIntValue = num.intValue();
                    vf.i iVar = (vf.i) wVar;
                    iVar.getClass();
                    List list = (List) androidx.room.util.b.b(iVar.f33973a, true, false, new vf.b(strQ, iIntValue));
                    if (list != null && !list.isEmpty()) {
                        Iterator it2 = list.iterator();
                        while (it2.hasNext()) {
                            ((vf.i) qVar.f35844b).a((RecordEntity) it2.next());
                        }
                    }
                }
                xyz.stream.api.o.f().e(true, null, num);
                break;
            default:
                w wVar2 = qVar.f35844b;
                int iIntValue2 = num.intValue();
                vf.i iVar2 = (vf.i) wVar2;
                iVar2.getClass();
                RecordEntity recordEntity = (RecordEntity) androidx.room.util.b.b(iVar2.f33973a, true, false, new h3.d(iIntValue2, 5));
                if (recordEntity != null) {
                    if (recordEntity.getSeriesId() == null || recordEntity.getSeriesId().intValue() <= 0 || recordEntity.getSourceType().intValue() != 3) {
                        ((vf.i) qVar.f35844b).a(recordEntity);
                    } else {
                        w wVar3 = qVar.f35844b;
                        Integer seriesId = recordEntity.getSeriesId();
                        vf.i iVar3 = (vf.i) wVar3;
                        iVar3.getClass();
                        androidx.room.util.b.b(iVar3.f33973a, false, true, new vf.k(3, seriesId));
                    }
                    xyz.stream.api.o.f().e(false, recordEntity, null);
                    break;
                }
                break;
        }
    }
}
