package p037.p109;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.TreeMap;
import p037.p109.AbstractC2401;
import p037.p109.p110.AbstractC2419;
import p037.p115.p116.InterfaceC2442;
import p037.p115.p116.InterfaceC2443;
import p037.p115.p116.p117.C2449;
import p138.p139.p143.p144.C2803;

/* JADX INFO: renamed from: މ.ސ.އ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C2406 extends InterfaceC2443.AbstractC2444 {

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public C2377 f7623;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final AbstractC2407 f7624;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final String f7625;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final String f7626;

    /* JADX INFO: renamed from: މ.ސ.އ$֏, reason: contains not printable characters */
    public static abstract class AbstractC2407 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final int f7627;

        public AbstractC2407(int i) {
            this.f7627 = i;
        }

        /* JADX INFO: renamed from: ֏ */
        public abstract void mo858(InterfaceC2442 interfaceC2442);

        /* JADX INFO: renamed from: ؠ */
        public abstract void mo859(InterfaceC2442 interfaceC2442);

        /* JADX INFO: renamed from: ހ */
        public abstract void mo860(InterfaceC2442 interfaceC2442);

        /* JADX INFO: renamed from: ށ */
        public abstract void mo861(InterfaceC2442 interfaceC2442);

        /* JADX INFO: renamed from: ނ */
        public abstract void mo862(InterfaceC2442 interfaceC2442);

        /* JADX INFO: renamed from: ރ */
        public abstract void mo863(InterfaceC2442 interfaceC2442);

        /* JADX INFO: renamed from: ބ */
        public abstract C2408 mo864(InterfaceC2442 interfaceC2442);
    }

    /* JADX INFO: renamed from: މ.ސ.އ$ؠ, reason: contains not printable characters */
    public static class C2408 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final boolean f7628;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final String f7629;

        public C2408(boolean z, String str) {
            this.f7628 = z;
            this.f7629 = str;
        }
    }

    public C2406(C2377 c2377, AbstractC2407 abstractC2407, String str, String str2) {
        super(abstractC2407.f7627);
        this.f7623 = c2377;
        this.f7624 = abstractC2407;
        this.f7625 = str;
        this.f7626 = str2;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m4488(InterfaceC2442 interfaceC2442) {
        C2449 c2449 = (C2449) interfaceC2442;
        c2449.f7741.execSQL("CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)");
        c2449.f7741.execSQL(C2803.m4880("INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '", this.f7625, "')"));
    }

    /* JADX WARN: Code restructure failed: missing block: B:40:0x0077, code lost:
    
        r2 = r4;
     */
    /* JADX WARN: Removed duplicated region for block: B:19:0x0033  */
    /* JADX WARN: Removed duplicated region for block: B:53:0x00bd  */
    /* JADX WARN: Removed duplicated region for block: B:67:0x0078 A[EDGE_INSN: B:67:0x0078->B:41:0x0078 BREAK  A[LOOP:1: B:12:0x001d->B:39:0x0075], SYNTHETIC] */
    @Override // p037.p115.p116.InterfaceC2443.AbstractC2444
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void mo4489(InterfaceC2442 interfaceC2442, int i, int i2) {
        List listEmptyList;
        TreeMap<Integer, AbstractC2419> treeMap;
        int iIntValue;
        boolean z;
        C2377 c2377 = this.f7623;
        boolean z2 = true;
        if (c2377 != null) {
            AbstractC2401.C2405 c2405 = c2377.f7534;
            ArrayList arrayList = null;
            if (c2405 == null) {
                throw null;
            }
            if (i == i2) {
                listEmptyList = Collections.emptyList();
            } else {
                boolean z3 = i2 > i;
                ArrayList arrayList2 = new ArrayList();
                int i3 = i;
                while (true) {
                    if (z3) {
                        if (i3 >= i2) {
                            break;
                        }
                        treeMap = c2405.f7622.get(Integer.valueOf(i3));
                        if (treeMap == null) {
                            break;
                        }
                        Iterator<Integer> it = (z3 ? treeMap.descendingKeySet() : treeMap.keySet()).iterator();
                        while (true) {
                            if (!it.hasNext()) {
                                iIntValue = i3;
                                z = false;
                                break;
                            } else {
                                iIntValue = it.next().intValue();
                                if (!z3 ? iIntValue < i2 || iIntValue >= i3 : iIntValue > i2 || iIntValue <= i3) {
                                    arrayList2.add(treeMap.get(Integer.valueOf(iIntValue)));
                                    z = true;
                                    break;
                                }
                            }
                        }
                        if (!z) {
                            break;
                        } else {
                            i3 = iIntValue;
                        }
                    } else {
                        if (i3 <= i2) {
                            break;
                        }
                        treeMap = c2405.f7622.get(Integer.valueOf(i3));
                        if (treeMap == null) {
                        }
                    }
                }
                listEmptyList = arrayList;
            }
            if (listEmptyList != null) {
                this.f7624.mo863(interfaceC2442);
                Iterator it2 = listEmptyList.iterator();
                while (it2.hasNext()) {
                    ((AbstractC2419) it2.next()).mo4500(interfaceC2442);
                }
                C2408 c2408Mo864 = this.f7624.mo864(interfaceC2442);
                if (!c2408Mo864.f7628) {
                    StringBuilder sbM4889 = C2803.m4889("Migration didn't properly handle: ");
                    sbM4889.append(c2408Mo864.f7629);
                    throw new IllegalStateException(sbM4889.toString());
                }
                this.f7624.mo862(interfaceC2442);
                m4488(interfaceC2442);
            } else {
                z2 = false;
            }
        }
        if (z2) {
            return;
        }
        C2377 c23772 = this.f7623;
        if (c23772 != null && !c23772.m4444(i, i2)) {
            this.f7624.mo859(interfaceC2442);
            this.f7624.mo858(interfaceC2442);
            return;
        }
        throw new IllegalStateException("A migration from " + i + " to " + i2 + " was required but not found. Please provide the necessary Migration path via RoomDatabase.Builder.addMigration(Migration ...) or allow for destructive migrations via one of the RoomDatabase.Builder.fallbackToDestructiveMigration* methods.");
    }
}
