package defpackage;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;

/* JADX INFO: renamed from: ʽᵸ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C0179 {

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public static final C3363 f1607 = new C3363(0);

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public static final Random f1608 = new Random();

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public C3966 f1614;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public String f1615;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final C5201 f1612 = new C5201();

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final C4593 f1609 = new C4593();

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final HashMap f1610 = new HashMap();

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public AbstractC4975 f1611 = AbstractC4975.f18879;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public long f1613 = -1;

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final synchronized void m1324(C5515 c5515) {
        C3966 c3966;
        try {
            String str = this.f1615;
            if (str != null) {
                C5410 c5410 = (C5410) this.f1610.get(str);
                c5410.getClass();
                m1327(c5410);
            }
            Iterator it = this.f1610.values().iterator();
            while (it.hasNext()) {
                C5410 c54102 = (C5410) it.next();
                it.remove();
                if (c54102.f20515 && (c3966 = this.f1614) != null) {
                    c3966.m8711(c5515, c54102.f20516);
                }
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x004b  */
    /* JADX WARN: Removed duplicated region for block: B:41:0x008e  */
    /* JADX WARN: Removed duplicated region for block: B:59:0x00a0 A[ADDED_TO_REGION, REMOVE, SYNTHETIC] */
    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final C5410 m1325(int i, C4100 c4100) {
        long j;
        long j2;
        HashMap map = this.f1610;
        C5410 c5410 = null;
        long j3 = Long.MAX_VALUE;
        for (C5410 c54102 : map.values()) {
            long j4 = c54102.f20514;
            C4100 c41002 = c54102.f20518;
            if (j4 == -1 && i == c54102.f20513 && c4100 != null) {
                long j5 = c4100.f15714;
                C0179 c0179 = c54102.f20517;
                j = -1;
                C5410 c54103 = (C5410) c0179.f1610.get(c0179.f1615);
                if (c54103 != null) {
                    long j6 = c54103.f20514;
                    if (j6 == -1) {
                        j6 = c0179.f1613 + 1;
                    }
                    if (j5 >= j6) {
                        c54102.f20514 = j5;
                    }
                }
            } else {
                j = -1;
            }
            if (c4100 != null) {
                long j7 = c4100.f15714;
                if (j7 != j) {
                    if (c41002 == null) {
                        if (!c4100.m8958() && j7 == c54102.f20514) {
                            j2 = c54102.f20514;
                            if (j2 == j || j2 < j3) {
                                c5410 = c54102;
                                j3 = j2;
                            } else if (j2 == j3) {
                                String str = AbstractC0956.f4222;
                                if (c5410.f20518 != null && c41002 != null) {
                                    c5410 = c54102;
                                }
                            }
                        }
                    } else if (j7 == c41002.f15714 && c4100.f15710 == c41002.f15710 && c4100.f15711 == c41002.f15711) {
                        j2 = c54102.f20514;
                        if (j2 == j) {
                        }
                        c5410 = c54102;
                        j3 = j2;
                    }
                }
            }
            if (i == c54102.f20513) {
                j2 = c54102.f20514;
                if (j2 == j) {
                }
                c5410 = c54102;
                j3 = j2;
            }
        }
        if (c5410 != null) {
            return c5410;
        }
        String str2 = (String) f1607.get();
        C5410 c54104 = new C5410(this, str2, i, c4100);
        map.put(str2, c54104);
        return c54104;
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final void m1326(C5515 c5515) {
        C4100 c4100;
        AbstractC4975 abstractC4975 = c5515.f20828;
        int i = c5515.f20830;
        C4100 c41002 = c5515.f20835;
        boolean zM10285 = abstractC4975.m10285();
        String str = this.f1615;
        HashMap map = this.f1610;
        if (zM10285) {
            if (str != null) {
                C5410 c5410 = (C5410) map.get(str);
                c5410.getClass();
                m1327(c5410);
                return;
            }
            return;
        }
        C5410 c54102 = (C5410) map.get(str);
        this.f1615 = m1325(i, c41002).f20516;
        m1330(c5515);
        if (c41002 != null) {
            long j = c41002.f15714;
            if (c41002.m8958()) {
                if (c54102 != null && c54102.f20514 == j && (c4100 = c54102.f20518) != null && c4100.f15710 == c41002.f15710 && c4100.f15711 == c41002.f15711) {
                    return;
                }
                m1325(i, new C4100(j, c41002.f15713));
                this.f1614.getClass();
            }
        }
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final void m1327(C5410 c5410) {
        long j = c5410.f20514;
        if (j != -1 && c5410.f20515) {
            this.f1613 = j;
        }
        this.f1615 = null;
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final synchronized void m1328(C5515 c5515, int i) {
        try {
            this.f1614.getClass();
            boolean z = i == 0;
            Iterator it = this.f1610.values().iterator();
            while (it.hasNext()) {
                C5410 c5410 = (C5410) it.next();
                if (c5410.m11025(c5515)) {
                    it.remove();
                    boolean zEquals = c5410.f20516.equals(this.f1615);
                    if (zEquals) {
                        m1327(c5410);
                    }
                    if (c5410.f20515) {
                        if (z && zEquals) {
                            boolean z2 = c5410.f20519;
                        }
                        this.f1614.m8711(c5515, c5410.f20516);
                    }
                }
            }
            m1326(c5515);
        } catch (Throwable th) {
            throw th;
        }
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final synchronized String m1329(AbstractC4975 abstractC4975, C4100 c4100) {
        return m1325(abstractC4975.mo7165(c4100.f15713, this.f1609).f17476, c4100).f20516;
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x002f A[Catch: all -> 0x0054, TRY_LEAVE, TryCatch #0 {, blocks: (B:3:0x0001, B:7:0x0010, B:9:0x0014, B:11:0x001c, B:13:0x0028, B:16:0x002f, B:22:0x003a, B:24:0x0046, B:26:0x004c, B:32:0x0057, B:34:0x0063, B:35:0x0067, B:37:0x006c, B:39:0x0072, B:41:0x0089, B:42:0x00b6, B:44:0x00ba, B:45:0x00c1, B:47:0x00cb, B:49:0x00cf), top: B:54:0x0001 }] */
    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final synchronized void m1330(C5515 c5515) {
        this.f1614.getClass();
        if (c5515.f20828.m10285()) {
            return;
        }
        C4100 c4100 = c5515.f20835;
        if (c4100 != null) {
            long j = c4100.f15714;
            if (j != -1) {
                C5410 c5410 = (C5410) this.f1610.get(this.f1615);
                if (c5410 != null) {
                    long j2 = c5410.f20514;
                    if (j2 == -1) {
                        j2 = this.f1613 + 1;
                    }
                    if (j < j2) {
                        return;
                    }
                }
            }
            C5410 c54102 = (C5410) this.f1610.get(this.f1615);
            if (c54102 != null && c54102.f20514 == -1 && c54102.f20513 != c5515.f20830) {
                return;
            }
        }
        C5410 c5410M1325 = m1325(c5515.f20830, c5515.f20835);
        if (this.f1615 == null) {
            this.f1615 = c5410M1325.f20516;
        }
        C4100 c41002 = c5515.f20835;
        if (c41002 != null && c41002.m8958()) {
            C4100 c41003 = c5515.f20835;
            C5410 c5410M13252 = m1325(c5515.f20830, new C4100(c41003.f15713, c41003.f15714, c41003.f15710));
            if (!c5410M13252.f20515) {
                c5410M13252.f20515 = true;
                c5515.f20828.mo7165(c5515.f20835.f15713, this.f1609);
                this.f1609.m9683(c5515.f20835.f15710);
                Math.max(0L, AbstractC0956.m3264(0L) + AbstractC0956.m3264(this.f1609.f17477));
                this.f1614.getClass();
            }
        }
        if (!c5410M1325.f20515) {
            c5410M1325.f20515 = true;
            this.f1614.getClass();
        }
        if (c5410M1325.f20516.equals(this.f1615) && !c5410M1325.f20519) {
            c5410M1325.f20519 = true;
            this.f1614.m8712(c5515, c5410M1325.f20516);
        }
    }
}
