package com.google.firebase.auth.internal; import android.content.Context; import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.view.View; import android.view.ViewConfiguration; import com.google.android.gms.common.internal.Preconditions; import com.google.android.gms.common.logging.Logger; import com.google.android.gms.internal.p002firebaseauthapi.zzqx; import com.google.android.gms.internal.p002firebaseauthapi.zzzy; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.auth.MultiFactorInfo; import java.lang.reflect.Method; import java.util.List; import net.sf.scuba.smartcards.ISO7816; import o.GuL; import o.xzZ; import org.json.JSONArray; import org.json.JSONObject; /* loaded from: classes2.dex */ public final class zzbg { private static final byte[] $$a = {61, 7, ISO7816.INS_READ_RECORD_STAMPED, 119}; private static final int $$b = 228; private static int $10 = 0; private static int $11 = 1; private static int b = 0; private static int d = 1; private static long e = -7197802133512590943L; private final Context zza; private final String zzb; private final SharedPreferences zzc; private final Logger zzd; public zzbg(Context context, String str) { Preconditions.checkNotNull(context); String checkNotEmpty = Preconditions.checkNotEmpty(str); this.zzb = checkNotEmpty; Context applicationContext = context.getApplicationContext(); this.zza = applicationContext; this.zzc = applicationContext.getSharedPreferences(String.format("com.google.firebase.auth.api.Store.%s", checkNotEmpty), 0); this.zzd = new Logger("StorageHelpers", new String[0]); } /* JADX WARN: Removed duplicated region for block: B:10:0x0025 */ /* JADX WARN: Removed duplicated region for block: B:7:0x001d */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0025 -> B:4:0x002e). Please report as a decompilation issue!!! */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void c(byte r6, short r7, short r8, java.lang.Object[] r9) { /* int r8 = r8 * 2 int r8 = r8 + 119 int r6 = r6 * 4 int r0 = r6 + 1 int r7 = r7 * 3 int r7 = 3 - r7 byte[] r1 = com.google.firebase.auth.internal.zzbg.$$a byte[] r0 = new byte[r0] r2 = 0 if (r1 != 0) goto L17 r4 = r6 r8 = r7 r3 = r2 goto L2e L17: r3 = r2 L18: byte r4 = (byte) r8 r0[r3] = r4 if (r3 != r6) goto L25 java.lang.String r6 = new java.lang.String r6.(r0, r2) r9[r2] = r6 return L25: int r7 = r7 + 1 int r3 = r3 + 1 r4 = r1[r7] r5 = r8 r8 = r7 r7 = r5 L2e: int r7 = r7 + r4 r5 = r8 r8 = r7 r7 = r5 goto L18 */ throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.auth.internal.zzbg.c(byte, short, short, java.lang.Object[]):void"); } public final void zzc(String str) { int i = 2 % 2; int i2 = d + 81; b = i2 % 128; if (i2 % 2 == 0) { this.zzc.edit().remove(str).apply(); } else { this.zzc.edit().remove(str).apply(); throw null; } } /* JADX WARN: Code restructure failed: missing block: B:10:0x004f, code lost: return com.google.android.gms.internal.p002firebaseauthapi.zzzy.zzd(r5); */ /* JADX WARN: Code restructure failed: missing block: B:11:0x0050, code lost: com.google.android.gms.internal.p002firebaseauthapi.zzzy.zzd(r5); r3.hashCode(); */ /* JADX WARN: Code restructure failed: missing block: B:12:0x0056, code lost: throw null; */ /* JADX WARN: Code restructure failed: missing block: B:14:0x003e, code lost: if (r5 != null) goto L9; */ /* JADX WARN: Code restructure failed: missing block: B:4:0x0026, code lost: if (r5 != null) goto L9; */ /* JADX WARN: Code restructure failed: missing block: B:5:0x0057, code lost: return null; */ /* JADX WARN: Code restructure failed: missing block: B:7:0x0040, code lost: r1 = com.google.firebase.auth.internal.zzbg.b + 49; com.google.firebase.auth.internal.zzbg.d = r1 % 128; */ /* JADX WARN: Code restructure failed: missing block: B:8:0x0049, code lost: if ((r1 % 2) == 0) goto L13; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final com.google.android.gms.internal.p002firebaseauthapi.zzzy zzb(com.google.firebase.auth.FirebaseUser r5) { /* r4 = this; r0 = 2 int r1 = r0 % r0 int r1 = com.google.firebase.auth.internal.zzbg.d int r1 = r1 + 65 int r2 = r1 % 128 com.google.firebase.auth.internal.zzbg.b = r2 int r1 = r1 % r0 java.lang.String r2 = "com.google.firebase.auth.GET_TOKEN_RESPONSE.%s" r3 = 0 if (r1 == 0) goto L29 com.google.android.gms.common.internal.Preconditions.checkNotNull(r5) android.content.SharedPreferences r1 = r4.zzc java.lang.String r5 = r5.getUid() java.lang.Object[] r5 = new java.lang.Object[]{r5} java.lang.String r5 = java.lang.String.format(r2, r5) java.lang.String r5 = r1.getString(r5, r3) if (r5 == 0) goto L57 goto L40 L29: com.google.android.gms.common.internal.Preconditions.checkNotNull(r5) android.content.SharedPreferences r1 = r4.zzc java.lang.String r5 = r5.getUid() java.lang.Object[] r5 = new java.lang.Object[]{r5} java.lang.String r5 = java.lang.String.format(r2, r5) java.lang.String r5 = r1.getString(r5, r3) if (r5 == 0) goto L57 L40: int r1 = com.google.firebase.auth.internal.zzbg.b int r1 = r1 + 49 int r2 = r1 % 128 com.google.firebase.auth.internal.zzbg.d = r2 int r1 = r1 % r0 if (r1 == 0) goto L50 com.google.android.gms.internal.firebase-auth-api.zzzy r5 = com.google.android.gms.internal.p002firebaseauthapi.zzzy.zzd(r5) return r5 L50: com.google.android.gms.internal.p002firebaseauthapi.zzzy.zzd(r5) r3.hashCode() throw r3 L57: return r3 */ throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.auth.internal.zzbg.zzb(com.google.firebase.auth.FirebaseUser):com.google.android.gms.internal.firebase-auth-api.zzzy"); } public final void zze(FirebaseUser firebaseUser, zzzy zzzyVar) { int i = 2 % 2; int i2 = d + 77; b = i2 % 128; int i3 = i2 % 2; Preconditions.checkNotNull(firebaseUser); Preconditions.checkNotNull(zzzyVar); this.zzc.edit().putString(String.format("com.google.firebase.auth.GET_TOKEN_RESPONSE.%s", firebaseUser.getUid()), zzzyVar.zzh()).apply(); int i4 = b + 97; d = i4 % 128; if (i4 % 2 == 0) { int i5 = 37 / 0; } } public final FirebaseUser zza() { int i = 2 % 2; int i2 = d + 9; b = i2 % 128; int i3 = i2 % 2; String string = this.zzc.getString("com.google.firebase.auth.FIREBASE_USER", null); if (TextUtils.isEmpty(string)) { return null; } try { JSONObject jSONObject = new JSONObject(string); if (!(!jSONObject.has("type"))) { int i4 = b + 7; d = i4 % 128; int i5 = i4 % 2; if ("com.google.firebase.auth.internal.DefaultFirebaseUser".equalsIgnoreCase(jSONObject.optString("type"))) { int i6 = b + 45; d = i6 % 128; if (i6 % 2 != 0) { return zzf(jSONObject); } zzf(jSONObject); throw null; } } } catch (Exception unused) { } return null; } public final void zzd(FirebaseUser firebaseUser) { String str; int i = 2 % 2; Preconditions.checkNotNull(firebaseUser); JSONObject jSONObject = new JSONObject(); if (zzx.class.isAssignableFrom(firebaseUser.getClass())) { zzx zzxVar = (zzx) firebaseUser; try { jSONObject.put("cachedTokenState", zzxVar.zzf()); jSONObject.put("applicationName", zzxVar.zza().getName()); jSONObject.put("type", "com.google.firebase.auth.internal.DefaultFirebaseUser"); if (zzxVar.zzo() != null) { JSONArray jSONArray = new JSONArray(); List zzo = zzxVar.zzo(); int size = zzo.size(); if (zzo.size() > 30) { int i2 = d + 19; b = i2 % 128; int i3 = i2 % 2; this.zzd.w("Provider user info list size larger than max size, truncating list to %d. Actual list size: %d", 30, Integer.valueOf(zzo.size())); int i4 = d + 63; b = i4 % 128; if (i4 % 2 != 0) { int i5 = 3 / 4; } size = 30; } int i6 = 0; while (i6 < size) { int i7 = d + 27; b = i7 % 128; if (i7 % 2 != 0) { jSONArray.put(((zzt) zzo.get(i6)).zzb()); i6 += 12; } else { jSONArray.put(((zzt) zzo.get(i6)).zzb()); i6++; } } jSONObject.put("userInfos", jSONArray); } jSONObject.put("anonymous", zzxVar.isAnonymous()); Object[] objArr = new Object[1]; a(new char[]{13018, 13032, 4979, 43830, 7437}, Drawable.resolveOpacity(0, 0), objArr); jSONObject.put("version", ((String) objArr[0]).intern()); if (zzxVar.getMetadata() != null) { jSONObject.put("userMetadata", ((zzz) zzxVar.getMetadata()).zza()); } List enrolledFactors = new zzac(zzxVar).getEnrolledFactors(); if (!enrolledFactors.isEmpty()) { JSONArray jSONArray2 = new JSONArray(); for (int i8 = 0; i8 < enrolledFactors.size(); i8++) { jSONArray2.put(enrolledFactors.get(i8).toJson()); } jSONObject.put("userMultiFactorInfo", jSONArray2); } str = jSONObject.toString(); } catch (Exception e2) { this.zzd.wtf("Failed to turn object into JSON", e2, new Object[0]); throw new zzqx(e2); } } else { str = null; } if (!(!TextUtils.isEmpty(str))) { return; } this.zzc.edit().putString("com.google.firebase.auth.FIREBASE_USER", str).apply(); } /* JADX WARN: Removed duplicated region for block: B:35:0x00f9 A[Catch: zzqx -> 0x017f, IllegalArgumentException -> 0x0181, ArrayIndexOutOfBoundsException -> 0x0183, JSONException -> 0x0185, TRY_ENTER, TryCatch #1 {JSONException -> 0x0185, blocks: (B:3:0x0012, B:5:0x0043, B:8:0x004c, B:12:0x0062, B:15:0x00a0, B:18:0x00a8, B:19:0x00ad, B:22:0x00ae, B:25:0x00c6, B:27:0x00cf, B:28:0x00d2, B:30:0x00db, B:35:0x00f9, B:38:0x00fc, B:40:0x0102, B:42:0x0108, B:43:0x010e, B:45:0x0114, B:49:0x0138, B:52:0x0141, B:58:0x016b, B:59:0x0172, B:54:0x0151, B:56:0x0175, B:65:0x0149, B:71:0x017b), top: B:2:0x0012 }] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private final com.google.firebase.auth.internal.zzx zzf(org.json.JSONObject r27) { /* Method dump skipped, instructions count: 409 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.auth.internal.zzbg.zzf(org.json.JSONObject):com.google.firebase.auth.internal.zzx"); } private static void a(char[] cArr, int i, Object[] objArr) { Object obj; int i2 = 2 % 2; GuL guL = new GuL(); char[] a = GuL.a(e ^ (-7538262848231253921L), cArr, i); guL.a = 4; while (true) { obj = null; if (guL.a >= a.length) { break; } int i3 = $11 + 27; $10 = i3 % 128; int i4 = i3 % 2; guL.c = guL.a - 4; int i5 = guL.a; try { Object[] objArr2 = {Long.valueOf(a[guL.a] ^ a[guL.a % 4]), Long.valueOf(guL.c), Long.valueOf(e)}; Object obj2 = xzZ.y.get(428080616); if (obj2 == null) { Class cls = (Class) xzZ.c((ViewConfiguration.getEdgeSlop() >> 16) + 208, 5 - (ViewConfiguration.getFadingEdgeLength() >> 16), (char) (1706 - (ViewConfiguration.getLongPressTimeout() >> 16))); byte b2 = (byte) 0; byte b3 = b2; Object[] objArr3 = new Object[1]; c(b2, b3, b3, objArr3); obj2 = cls.getMethod((String) objArr3[0], Long.TYPE, Long.TYPE, Long.TYPE); xzZ.y.put(428080616, obj2); } a[i5] = ((Character) ((Method) obj2).invoke(null, objArr2)).charValue(); Object[] objArr4 = {guL, guL}; Object obj3 = xzZ.y.get(-1875914398); if (obj3 == null) { Class cls2 = (Class) xzZ.c((ViewConfiguration.getMinimumFlingVelocity() >> 16) + 392, (ViewConfiguration.getScrollFriction() > BitmapDescriptorFactory.HUE_RED ? 1 : (ViewConfiguration.getScrollFriction() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)) + 4, (char) View.MeasureSpec.makeMeasureSpec(0, 0)); byte b4 = (byte) 0; byte b5 = b4; Object[] objArr5 = new Object[1]; c(b4, b5, (byte) (b5 + 1), objArr5); obj3 = cls2.getMethod((String) objArr5[0], Object.class, Object.class); xzZ.y.put(-1875914398, obj3); } ((Method) obj3).invoke(null, objArr4); } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } String str = new String(a, 4, a.length - 4); int i6 = $10 + 77; $11 = i6 % 128; if (i6 % 2 != 0) { objArr[0] = str; } else { obj.hashCode(); throw null; } } }