package L1;

import android.os.Bundle;
import java.util.EnumMap;
import java.util.Iterator;

/* JADX INFO: loaded from: classes.dex */
public final class L0 {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final L0 f1485c = new L0(100);

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final EnumMap f1486a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final int f1487b;

    public L0(int i) {
        EnumMap enumMap = new EnumMap(K0.class);
        this.f1486a = enumMap;
        K0 k02 = K0.AD_STORAGE;
        I0 i02 = I0.UNINITIALIZED;
        enumMap.put(k02, i02);
        enumMap.put(K0.ANALYTICS_STORAGE, i02);
        this.f1487b = i;
    }

    public static String a(int i) {
        return i != -30 ? i != -20 ? i != -10 ? i != 0 ? i != 30 ? i != 90 ? i != 100 ? "OTHER" : "UNKNOWN" : "REMOTE_CONFIG" : "1P_INIT" : "1P_API" : "MANIFEST" : "API" : "TCF";
    }

    public static L0 b(int i, Bundle bundle) {
        if (bundle == null) {
            return new L0(i);
        }
        EnumMap enumMap = new EnumMap(K0.class);
        for (K0 k02 : J0.STORAGE.f1475k) {
            enumMap.put(k02, d(bundle.getString(k02.f1481k)));
        }
        return new L0(enumMap, i);
    }

    public static L0 c(int i, String str) {
        EnumMap enumMap = new EnumMap(K0.class);
        J0 j02 = J0.STORAGE;
        int i5 = 0;
        while (true) {
            K0[] k0Arr = j02.f1475k;
            if (i5 >= k0Arr.length) {
                return new L0(enumMap, i);
            }
            String str2 = str == null ? "" : str;
            K0 k02 = k0Arr[i5];
            int i6 = i5 + 2;
            if (i6 < str2.length()) {
                enumMap.put(k02, e(str2.charAt(i6)));
            } else {
                enumMap.put(k02, I0.UNINITIALIZED);
            }
            i5++;
        }
    }

    public static I0 d(String str) {
        I0 i02 = I0.UNINITIALIZED;
        return str == null ? i02 : str.equals("granted") ? I0.GRANTED : str.equals("denied") ? I0.DENIED : i02;
    }

    public static I0 e(char c6) {
        return c6 != '+' ? c6 != '0' ? c6 != '1' ? I0.UNINITIALIZED : I0.GRANTED : I0.DENIED : I0.POLICY;
    }

    public static char h(I0 i02) {
        if (i02 == null) {
            return '-';
        }
        int iOrdinal = i02.ordinal();
        if (iOrdinal == 1) {
            return '+';
        }
        if (iOrdinal != 2) {
            return iOrdinal != 3 ? '-' : '1';
        }
        return '0';
    }

    public static boolean l(int i, int i5) {
        int i6 = -30;
        if (i == -20) {
            if (i5 == -30) {
                return true;
            }
            i = -20;
        }
        if (i != -30) {
            i6 = i;
        } else if (i5 == -20) {
            return true;
        }
        return i6 == i5 || i < i5;
    }

    public final boolean equals(Object obj) {
        if (!(obj instanceof L0)) {
            return false;
        }
        L0 l0 = (L0) obj;
        for (K0 k02 : J0.STORAGE.f1475k) {
            if (this.f1486a.get(k02) != l0.f1486a.get(k02)) {
                return false;
            }
        }
        return this.f1487b == l0.f1487b;
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x0030  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public final java.lang.String f() {
        /*
            r7 = this;
            java.lang.StringBuilder r0 = new java.lang.StringBuilder
            java.lang.String r1 = "G1"
            r0.<init>(r1)
            L1.J0 r1 = L1.J0.STORAGE
            L1.K0[] r1 = r1.f1475k
            int r2 = r1.length
            r3 = 0
        Ld:
            if (r3 >= r2) goto L38
            r4 = r1[r3]
            java.util.EnumMap r5 = r7.f1486a
            java.lang.Object r4 = r5.get(r4)
            L1.I0 r4 = (L1.I0) r4
            r5 = 45
            if (r4 == 0) goto L32
            int r4 = r4.ordinal()
            if (r4 == 0) goto L32
            r6 = 1
            if (r4 == r6) goto L30
            r6 = 2
            if (r4 == r6) goto L2d
            r6 = 3
            if (r4 == r6) goto L30
            goto L32
        L2d:
            r5 = 48
            goto L32
        L30:
            r5 = 49
        L32:
            r0.append(r5)
            int r3 = r3 + 1
            goto Ld
        L38:
            java.lang.String r0 = r0.toString()
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: L1.L0.f():java.lang.String");
    }

    public final String g() {
        StringBuilder sb = new StringBuilder("G1");
        for (K0 k02 : J0.STORAGE.f1475k) {
            sb.append(h((I0) this.f1486a.get(k02)));
        }
        return sb.toString();
    }

    public final int hashCode() {
        Iterator it = this.f1486a.values().iterator();
        int iHashCode = this.f1487b * 17;
        while (it.hasNext()) {
            iHashCode = (iHashCode * 31) + ((I0) it.next()).hashCode();
        }
        return iHashCode;
    }

    public final boolean i(K0 k02) {
        return ((I0) this.f1486a.get(k02)) != I0.DENIED;
    }

    /* JADX WARN: Removed duplicated region for block: B:14:0x0031  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public final L1.L0 j(L1.L0 r9) {
        /*
            r8 = this;
            java.util.EnumMap r0 = new java.util.EnumMap
            java.lang.Class<L1.K0> r1 = L1.K0.class
            r0.<init>(r1)
            L1.J0 r1 = L1.J0.STORAGE
            L1.K0[] r1 = r1.f1475k
            int r2 = r1.length
            r3 = 0
        Ld:
            if (r3 >= r2) goto L48
            r4 = r1[r3]
            java.util.EnumMap r5 = r8.f1486a
            java.lang.Object r5 = r5.get(r4)
            L1.I0 r5 = (L1.I0) r5
            java.util.EnumMap r6 = r9.f1486a
            java.lang.Object r6 = r6.get(r4)
            L1.I0 r6 = (L1.I0) r6
            if (r5 != 0) goto L24
            goto L31
        L24:
            if (r6 == 0) goto L40
            L1.I0 r7 = L1.I0.UNINITIALIZED
            if (r5 != r7) goto L2b
            goto L31
        L2b:
            if (r6 == r7) goto L40
            L1.I0 r7 = L1.I0.POLICY
            if (r5 != r7) goto L33
        L31:
            r5 = r6
            goto L40
        L33:
            if (r6 == r7) goto L40
            L1.I0 r7 = L1.I0.DENIED
            if (r5 == r7) goto L3f
            if (r6 != r7) goto L3c
            goto L3f
        L3c:
            L1.I0 r5 = L1.I0.GRANTED
            goto L40
        L3f:
            r5 = r7
        L40:
            if (r5 == 0) goto L45
            r0.put(r4, r5)
        L45:
            int r3 = r3 + 1
            goto Ld
        L48:
            L1.L0 r9 = new L1.L0
            r1 = 100
            r9.<init>(r0, r1)
            return r9
        */
        throw new UnsupportedOperationException("Method not decompiled: L1.L0.j(L1.L0):L1.L0");
    }

    public final L0 k(L0 l0) {
        EnumMap enumMap = new EnumMap(K0.class);
        for (K0 k02 : J0.STORAGE.f1475k) {
            I0 i02 = (I0) this.f1486a.get(k02);
            if (i02 == I0.UNINITIALIZED) {
                i02 = (I0) l0.f1486a.get(k02);
            }
            if (i02 != null) {
                enumMap.put(k02, i02);
            }
        }
        return new L0(enumMap, this.f1487b);
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder("source=");
        sb.append(a(this.f1487b));
        for (K0 k02 : J0.STORAGE.f1475k) {
            sb.append(",");
            sb.append(k02.f1481k);
            sb.append("=");
            I0 i02 = (I0) this.f1486a.get(k02);
            if (i02 == null) {
                i02 = I0.UNINITIALIZED;
            }
            sb.append(i02);
        }
        return sb.toString();
    }

    public L0(EnumMap enumMap, int i) {
        EnumMap enumMap2 = new EnumMap(K0.class);
        this.f1486a = enumMap2;
        enumMap2.putAll(enumMap);
        this.f1487b = i;
    }
}
