package defpackage;

import android.content.ComponentName;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.util.SparseIntArray;
import androidx.work.impl.WorkDatabase_Impl;
import ar.tvplayer.tv.R;
import com.bumptech.glide.ComponentCallbacks2C0017;
import com.google.android.datatransport.cct.CctBackendFactory;
import com.google.android.datatransport.runtime.backends.TransportBackendDiscovery;
import com.hierynomus.smbj.common.SMBRuntimeException;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReentrantLock;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: renamed from: ᵨʽ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C3714 implements InterfaceC1088, InterfaceC2925, InterfaceC4978, InterfaceC2067, InterfaceC5533, InterfaceC1989 {

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final /* synthetic */ int f14141;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public Object f14142;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public Object f14143;

    public C3714(int i) {
        this.f14141 = i;
        switch (i) {
            case C5224.DOUBLE_FIELD_NUMBER /* 7 */:
                this.f14143 = new AtomicReference();
                this.f14142 = new C3310(0);
                break;
            case 9:
                this.f14143 = new AtomicInteger();
                this.f14142 = new AtomicInteger();
                break;
            case 17:
                this.f14143 = new ArrayList();
                this.f14142 = new HashMap();
                break;
            case 21:
                this.f14143 = new C5021(1000L);
                this.f14142 = AbstractC2765.m6673(10, new ᵖˊʨ(6));
                break;
            case 24:
                this.f14143 = new ReentrantLock();
                this.f14142 = new HashMap();
                break;
            default:
                this.f14143 = new SparseIntArray();
                this.f14142 = new SparseIntArray();
                break;
        }
    }

    public /* synthetic */ C3714(int i, Object obj) {
        this.f14141 = i;
        this.f14142 = obj;
    }

    public /* synthetic */ C3714(int i, boolean z) {
        this.f14141 = i;
    }

    public C3714(Context context, int i) {
        this.f14141 = i;
        switch (i) {
            case 29:
                ᵘᵞʿⁱ.ᵶᵥᵝ(context);
                Resources resources = context.getResources();
                this.f14143 = resources;
                this.f14142 = resources.getResourcePackageName(R.string.h);
                break;
            default:
                this.f14142 = null;
                this.f14143 = context;
                break;
        }
    }

    public C3714(WorkDatabase_Impl workDatabase_Impl) {
        this.f14141 = 2;
        this.f14143 = workDatabase_Impl;
        this.f14142 = Collections.newSetFromMap(new IdentityHashMap());
    }

    public /* synthetic */ C3714(Object obj) {
        this.f14141 = 8;
        this.f14142 = obj;
        this.f14143 = new ArrayList();
    }

    public /* synthetic */ C3714(Object obj, int i, Object obj2) {
        this.f14141 = i;
        this.f14143 = obj;
        this.f14142 = obj2;
    }

    public C3714(String str, final ᵨˈʼﹶ r3) {
        this.f14141 = 18;
        this.f14143 = str;
        final int i = 0;
        this.f14142 = new InterfaceC0778() { // from class: ᵱᵽ
            @Override // defpackage.InterfaceC0778
            /* JADX INFO: renamed from: ʽˈˋ */
            public final Object mo1706(Object obj) {
                String str2;
                int i2 = i;
                int i3 = 1;
                C5063 c5063 = C5063.f19112;
                Object obj2 = r3;
                switch (i2) {
                    case 0:
                        ((ᵨˈʼﹶ) obj2).ʽˈˋ(new C4888((InterfaceC4296) obj));
                        return c5063;
                    case 1:
                        InterfaceC1073[] interfaceC1073Arr = ᵘᵫ.ᵴˀᵰʒ;
                        ((ᵘᵫ) obj2).ᵦᵎ(false);
                        return c5063;
                    case 2:
                        ᵹᵕ r0 = (ᵹᵕ) obj2;
                        InterfaceC1073[] interfaceC1073Arr2 = ᵹᵕ.ˑˀˉᵲ;
                        r0.ᵩٴʽ();
                        r0.ˎᵿˆ().ᵲː();
                        return c5063;
                    case 3:
                        ˎˋ r6 = (ˎˋ) obj2;
                        ᵯˊ r02 = (ᵯˊ) ((ˋˆᵧʾ) r6.ˋᵤᵦ.getValue()).ʽˈˋ.m7563();
                        if (r02 != null) {
                            r6.f18206.f6506.m465();
                            int iOrdinal = r02.ˁˌᵩ.ordinal();
                            if (iOrdinal == 0) {
                                str2 = "sortingDefault";
                            } else if (iOrdinal == 1) {
                                str2 = "sortingByPlaylistOrder";
                            } else if (iOrdinal == 2) {
                                str2 = "sortingByName";
                            } else if (iOrdinal == 3) {
                                str2 = "sortingManual";
                            } else {
                                if (iOrdinal != 4) {
                                    C1685.m4561();
                                    return null;
                                }
                                str2 = "sortingByTime";
                            }
                            ᵥˈᵛ.ᵷᵺʾᵖ(r6, "sortingDefault", r6.m7763(R.string.h), ᵝˉː.ᵱʡˏ(r6), r6.ᵾᵧ(str2.equals("sortingDefault")), false, 0, 240);
                            ᵥˈᵛ.ᵷᵺʾᵖ(r6, "sortingByPlaylistOrder", r6.m7763(R.string.h), (CharSequence) null, r6.ᵾᵧ(str2.equals("sortingByPlaylistOrder")), false, 0, 244);
                            ᵥˈᵛ.ᵷᵺʾᵖ(r6, "sortingByName", r6.m7763(R.string.h), (CharSequence) null, r6.ᵾᵧ(str2.equals("sortingByName")), false, 0, 244);
                            if (!r02.ᵨˈʼﹶ) {
                                ᵥˈᵛ.ᵷᵺʾᵖ(r6, "sortingByTime", r6.m7763(R.string.h), (CharSequence) null, r6.ᵾᵧ(str2.equals("sortingByTime")), false, 0, 244);
                            }
                            ᵥˈᵛ.ᵷᵺʾᵖ(r6, "sortingManual", r6.m7763(R.string.h), (CharSequence) null, r6.ᵾᵧ(str2.equals("sortingManual")), false, 0, 244);
                            ᵥˈᵛ.ᵷᵺʾᵖ(r6, "reorderGroups", r6.m7763(R.string.h), (CharSequence) null, (Drawable) null, str2.equals("sortingManual"), 0, 236);
                            r6.m9977(str2);
                            r6.m7790();
                        }
                        return c5063;
                    case 4:
                        ((ˆᵡᵜ) obj2).ᵳˉᵴˆ();
                        return c5063;
                    case 5:
                        C2187 c2187 = (C2187) obj;
                        return ((CharSequence) obj2).subSequence(c2187.f20741, c2187.f20743 + 1).toString();
                    case C5224.STRING_SET_FIELD_NUMBER /* 6 */:
                        File file = (File) obj2;
                        InputStream inputStream = (InputStream) obj;
                        if (inputStream == null) {
                            return null;
                        }
                        File file2 = new File(file, "rec_index_to_read_zip");
                        ᵕᵛ.ᵵᵽ(file2, inputStream);
                        return file2;
                    case C5224.DOUBLE_FIELD_NUMBER /* 7 */:
                        ((ᵪˏᵗ) obj2).ᵙˁˇ();
                        return c5063;
                    case C5224.BYTES_FIELD_NUMBER /* 8 */:
                        int iIntValue = ((Integer) obj).intValue();
                        InterfaceC1073[] interfaceC1073Arr3 = ᵯﹳᵷʔ.ˀᵘːˊ;
                        return Boolean.valueOf(((ᵫᵮᵔʕ) obj2).ːˏᵟᵯ(iIntValue) == R.layout.h);
                    case 9:
                        InterfaceC1073[] interfaceC1073Arr4 = ʿˈˑᵲ.ˑˀˉᵲ;
                        ((ʿˈˑᵲ) obj2).ᵦˀˈᵨ(false);
                        return c5063;
                    case 10:
                        ((ᵷˆˇ) obj2).ᵳˉᵴˆ();
                        return c5063;
                    case 11:
                        C0970 c0970 = (C0970) obj2;
                        InterfaceC4296 interfaceC4296 = (InterfaceC4296) obj;
                        while (interfaceC4296.mo3331()) {
                            c0970.add(interfaceC4296.mo3327(0));
                        }
                        return c5063;
                    case 12:
                        ((ᵣʿ) obj2).ˁˁﹳ();
                        return c5063;
                    default:
                        long j = ((ᵴˊˀᵝ) obj).ʽˈˋ;
                        long j2 = ((ᵫᵨᵤˎ) obj2).ʽˈˋ;
                        if (j == j2) {
                            i3 = 0;
                        } else if (j < j2) {
                            i3 = -1;
                        }
                        return Integer.valueOf(i3);
                }
            }
        };
    }

    public C3714(Locale locale) {
        this.f14141 = 11;
        this.f14143 = locale;
        this.f14142 = DateFormatSymbols.getInstance(locale).getShortMonths();
        Calendar calendar = Calendar.getInstance(locale);
        AbstractC3481.m7951(calendar.getMinimum(5), calendar.getMaximum(5));
    }

    public C3714(C0085 c0085) {
        this.f14141 = 15;
        this.f14143 = c0085;
        this.f14142 = new C4545();
    }

    public C3714(C1024 c1024) {
        this.f14141 = 1;
        this.f14142 = c1024;
        this.f14143 = new Rect();
    }

    public C3714(C1109 c1109) {
        this.f14141 = 22;
        this.f14143 = c1109;
        this.f14142 = new C1709(20, c1109);
    }

    public C3714(InterfaceC2047 interfaceC2047) {
        this.f14141 = 12;
        this.f14143 = interfaceC2047;
        this.f14142 = new C4215(25, 0);
    }

    public C3714(ˑᵤʽˏ r2) {
        this.f14141 = 4;
        this.f14143 = new HashMap();
        this.f14142 = r2;
    }

    public C3714(C3420 c3420, ᵯᵨᵲ r3) {
        this.f14141 = 25;
        this.f14142 = c3420;
        this.f14143 = r3;
    }

    public C3714(byte[] bArr, Provider provider) {
        this.f14141 = 13;
        if (!AbstractC2704.m6538(1)) {
            C1685.m4558("Cannot use AES-CMAC in FIPS-mode, as BoringCrypto module is not available");
            throw null;
        }
        this.f14143 = new SecretKeySpec(bArr, "AES");
        this.f14142 = provider;
    }

    public C3714(InterfaceC1088[] interfaceC1088Arr) {
        this.f14141 = 6;
        this.f14143 = interfaceC1088Arr;
        this.f14142 = new C5314(1);
    }

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public static int m8356(int i, int i2) {
        int i3 = 0;
        int i4 = 0;
        for (int i5 = 0; i5 < i; i5++) {
            i3++;
            if (i3 == i2) {
                i4++;
                i3 = 0;
            } else if (i3 > i2) {
                i4++;
                i3 = 1;
            }
        }
        return i3 + 1 > i2 ? i4 + 1 : i4;
    }

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public static C3714 m8357(String... strArr) {
        try {
            C1054[] c1054Arr = new C1054[strArr.length];
            C4903 c4903 = new C4903();
            for (int i = 0; i < strArr.length; i++) {
                C3829.m8528(c4903, strArr[i]);
                c4903.readByte();
                c1054Arr[i] = c4903.mo5343(c4903.f18672);
            }
            return new C3714((String[]) strArr.clone(), 3, ᵻᵕᵭ.ˌᵨʠᵫ(c1054Arr));
        } catch (IOException e) {
            throw new AssertionError(e);
        }
    }

    public String toString() {
        int i = 0;
        switch (this.f14141) {
            case C5224.BYTES_FIELD_NUMBER /* 8 */:
                StringBuilder sb = new StringBuilder(100);
                sb.append(this.f14142.getClass().getSimpleName());
                sb.append('{');
                ArrayList arrayList = (ArrayList) this.f14143;
                int size = arrayList.size();
                while (i < size) {
                    sb.append((String) arrayList.get(i));
                    if (i < size - 1) {
                        sb.append(", ");
                    }
                    i++;
                }
                sb.append('}');
                return sb.toString();
            case 14:
                String string = "[ ";
                if (((C4996) this.f14143) != null) {
                    while (i < 9) {
                        StringBuilder sbM8219 = AbstractC3653.m8219(string);
                        sbM8219.append(((C4996) this.f14143).f18934[i]);
                        sbM8219.append(" ");
                        string = sbM8219.toString();
                        i++;
                    }
                }
                return string + "] " + ((C4996) this.f14143);
            case 20:
                return "SMB2FileId{persistentHandle=" + ᵹˊᵫˋ.ˊᵨᵧ((byte[]) this.f14143) + '}';
            default:
                return super.toString();
        }
    }

    @Override // defpackage.InterfaceC2067
    /* JADX INFO: renamed from: ʽˈˋ */
    public void mo5510(C2134 c2134, int i) throws IOException {
        int[] iArr = (int[]) this.f14142;
        try {
            c2134.read((byte[]) this.f14143, iArr[0], i);
            iArr[0] = iArr[0] + i;
        } finally {
            c2134.close();
        }
    }

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public C3400 m8358() {
        JSONObject jSONObject;
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] bArr = new byte[16384];
        try {
            FileInputStream fileInputStream = new FileInputStream(m8372());
            while (true) {
                try {
                    int i = fileInputStream.read(bArr, 0, 16384);
                    if (i < 0) {
                        break;
                    }
                    byteArrayOutputStream.write(bArr, 0, i);
                } finally {
                }
            }
            jSONObject = new JSONObject(byteArrayOutputStream.toString());
            fileInputStream.close();
        } catch (IOException | JSONException unused) {
            jSONObject = new JSONObject();
        }
        String strOptString = jSONObject.optString("Fid", null);
        int iOptInt = jSONObject.optInt("Status", 0);
        String strOptString2 = jSONObject.optString("AuthToken", null);
        String strOptString3 = jSONObject.optString("RefreshToken", null);
        long jOptLong = jSONObject.optLong("TokenCreationEpochInSecs", 0L);
        long jOptLong2 = jSONObject.optLong("ExpiresInSecs", 0L);
        String strOptString4 = jSONObject.optString("FisError", null);
        int i2 = AbstractC3653.m8225(5)[iOptInt];
        if (i2 == 0) {
            C4935.m10233("Null registrationStatus");
            return null;
        }
        String str = i2 == 0 ? " registrationStatus" : "";
        if (str.isEmpty()) {
            return new C3400(strOptString, i2, strOptString2, strOptString3, jOptLong2, jOptLong, strOptString4);
        }
        ᵕᵩʽᵲ.ᵪᵹᵥᵻ("Missing required properties:".concat(str));
        return null;
    }

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public void m8359() {
        ((C1109) this.f14143).m3595();
    }

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public String m8360(InterfaceC0883 interfaceC0883) {
        String strM8381;
        synchronized (((C5021) this.f14143)) {
            strM8381 = (String) ((C5021) this.f14143).m10359(interfaceC0883);
        }
        if (strM8381 == null) {
            strM8381 = m8381(interfaceC0883);
        }
        synchronized (((C5021) this.f14143)) {
            ((C5021) this.f14143).m10360(interfaceC0883, strM8381);
        }
        return strM8381;
    }

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public void m8361(C1973 c1973) {
        byte[] bArr = (byte[]) this.f14143;
        c1973.mo2472(bArr.length, bArr);
        byte[] bArr2 = (byte[]) this.f14142;
        c1973.mo2472(bArr2.length, bArr2);
    }

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public synchronized ArrayList m8362(Class cls, Class cls2) {
        ArrayList arrayList;
        arrayList = new ArrayList();
        ArrayList arrayList2 = (ArrayList) this.f14143;
        int size = arrayList2.size();
        int i = 0;
        while (i < size) {
            Object obj = arrayList2.get(i);
            i++;
            List<C5295> list = (List) ((HashMap) this.f14142).get((String) obj);
            if (list != null) {
                for (C5295 c5295 : list) {
                    if ((c5295.f20012.isAssignableFrom(cls) && cls2.isAssignableFrom(c5295.f20010)) && !arrayList.contains(c5295.f20010)) {
                        arrayList.add(c5295.f20010);
                    }
                }
            }
        }
        return arrayList;
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public void m8363() {
        int[] iArr = (int[]) this.f14143;
        if (iArr != null) {
            Arrays.fill(iArr, -1);
        }
        this.f14142 = null;
    }

    @Override // defpackage.InterfaceC1989
    /* JADX INFO: renamed from: ˋˈ */
    public void mo5363(InterfaceC5397 interfaceC5397, Bitmap bitmap) throws IOException {
        IOException iOException = ((C5578) this.f14142).f21039;
        if (iOException != null) {
            if (bitmap == null) {
                throw iOException;
            }
            interfaceC5397.mo7363(bitmap);
            throw iOException;
        }
    }

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public String m8364(String str) {
        String str2 = (String) this.f14142;
        Resources resources = (Resources) this.f14143;
        int identifier = resources.getIdentifier(str, "string", str2);
        if (identifier == 0) {
            return null;
        }
        return resources.getString(identifier);
    }

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public void m8365(Bundle bundle) {
        C1109 c1109 = (C1109) this.f14143;
        InterfaceC2566 interfaceC2566 = c1109.f4746;
        if (!c1109.f4745) {
            c1109.m3595();
        }
        if (interfaceC2566.mo4192().f3300.m1024(EnumC0038.f1192)) {
            C4935.m10241(interfaceC2566.mo4192().f3300, "performRestore cannot be called when owner is ");
            return;
        }
        if (c1109.f4747) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("SavedStateRegistry was already restored.");
            return;
        }
        Bundle bundle2 = null;
        if (bundle != null && bundle.containsKey("androidx.lifecycle.BundlableSavedStateRegistry.key")) {
            bundle2 = ᵬʕˎʽ.ˊᵙᵾᵲ("androidx.lifecycle.BundlableSavedStateRegistry.key", bundle);
        }
        c1109.f4749 = bundle2;
        c1109.f4747 = true;
    }

    @Override // defpackage.InterfaceC5533
    /* JADX INFO: renamed from: ˏːˆ */
    public C1300 mo2608(Object obj) throws Throwable {
        FileWriter fileWriter;
        C3420 c3420 = (C3420) this.f14142;
        JSONObject jSONObject = (JSONObject) ((ExecutorC5381) ((ᵯᵨᵲ) this.f14143).ᵨᵼⁱ).f20391.submit((Callable) new ᵫᵔˊᵲ(7, this)).get();
        FileWriter fileWriter2 = null;
        if (jSONObject != null) {
            ˈᵷᵵᵞ r1 = (ˈᵷᵵᵞ) c3420.f13167;
            r1.getClass();
            C1610 c1610M7169 = (jSONObject.getInt("settings_version") != 3 ? new ᵠʽᵲ(18) : new ᵤᵮᵨ(7)).m7169((ˑᵤʽˏ) r1.ᵜᵪʾ, jSONObject);
            C1014 c1014 = (C1014) c3420.f13168;
            long j = c1610M7169.f6445;
            c1014.getClass();
            Log.isLoggable("FirebaseCrashlytics", 2);
            try {
                jSONObject.put("expires_at", j);
                fileWriter = new FileWriter((File) c1014.f4404);
                try {
                    fileWriter.write(jSONObject.toString());
                    fileWriter.flush();
                } catch (Exception unused) {
                } catch (Throwable th) {
                    th = th;
                    fileWriter2 = fileWriter;
                    ᵥˇᵛˎ.ᵻˈᵦʼ(fileWriter2);
                    throw th;
                }
            } catch (Exception unused2) {
                fileWriter = null;
            } catch (Throwable th2) {
                th = th2;
            }
            ᵥˇᵛˎ.ᵻˈᵦʼ(fileWriter);
            jSONObject.toString();
            Log.isLoggable("FirebaseCrashlytics", 3);
            String str = ((C1281) c3420.f13165).f5357;
            SharedPreferences.Editor editorEdit = ((Context) c3420.f13169).getSharedPreferences("com.google.firebase.crashlytics", 0).edit();
            editorEdit.putString("existing_instance_identifier", str);
            editorEdit.apply();
            ((AtomicReference) c3420.f13166).set(c1610M7169);
            ((C0589) ((AtomicReference) c3420.f13172).get()).m2219(c1610M7169);
        }
        return ᵥˈᵛ.ᵸˆˁ((Object) null);
    }

    @Override // defpackage.InterfaceC4978
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public void mo2718() {
        C4545 c4545 = (C4545) this.f14142;
        byte[] bArr = AbstractC0956.f4216;
        c4545.getClass();
        c4545.m9600(bArr.length, bArr);
    }

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public void m8366(Class cls, Class cls2, Class cls3, List list) {
        synchronized (((C3310) this.f14142)) {
            ((C3310) this.f14142).put(new C3472(cls, cls2, cls3), list);
        }
    }

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public void m8367() {
        ((SparseIntArray) this.f14143).clear();
    }

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public void m8368(C3400 c3400) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("Fid", c3400.f13098);
            jSONObject.put("Status", AbstractC3653.m8218(c3400.f13095));
            jSONObject.put("AuthToken", c3400.f13096);
            jSONObject.put("RefreshToken", c3400.f13100);
            jSONObject.put("TokenCreationEpochInSecs", c3400.f13101);
            jSONObject.put("ExpiresInSecs", c3400.f13097);
            jSONObject.put("FisError", c3400.f13099);
            C1191 c1191 = (C1191) this.f14142;
            c1191.m3677();
            File fileCreateTempFile = File.createTempFile("PersistedInstallation", "tmp", c1191.f5076.getFilesDir());
            FileOutputStream fileOutputStream = new FileOutputStream(fileCreateTempFile);
            fileOutputStream.write(jSONObject.toString().getBytes("UTF-8"));
            fileOutputStream.close();
            if (fileCreateTempFile.renameTo(m8372())) {
            } else {
                throw new IOException("unable to rename the tmpfile to PersistedInstallation");
            }
        } catch (IOException | JSONException unused) {
        }
    }

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public long[] m8369(int i) {
        Semaphore semaphore = (Semaphore) this.f14142;
        try {
            if (!semaphore.tryAcquire(i, 5000L, TimeUnit.MILLISECONDS)) {
                throw new SMBRuntimeException("Not enough credits (" + semaphore.availablePermits() + " available) to hand out " + i + " sequence numbers");
            }
            long j = i;
            long andAdd = ((AtomicLong) this.f14143).getAndAdd(j);
            int i2 = (int) ((j + andAdd) - andAdd);
            long[] jArr = new long[i2];
            for (int i3 = 0; i3 < i2; i3++) {
                jArr[i3] = ((long) i3) + andAdd;
            }
            return jArr;
        } catch (InterruptedException unused) {
            Thread.currentThread().interrupt();
            StringBuilder sbM8237 = AbstractC3653.m8237(i, "Got interrupted waiting for ", " to be available. Credits available at this moment: ");
            sbM8237.append(semaphore.availablePermits());
            throw new SMBRuntimeException(sbM8237.toString());
        }
    }

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public synchronized List m8370(String str) {
        List arrayList;
        try {
            if (!((ArrayList) this.f14143).contains(str)) {
                ((ArrayList) this.f14143).add(str);
            }
            arrayList = (List) ((HashMap) this.f14142).get(str);
            if (arrayList == null) {
                arrayList = new ArrayList();
                ((HashMap) this.f14142).put(str, arrayList);
            }
        } catch (Throwable th) {
            throw th;
        }
        return arrayList;
    }

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public void m8371(Long l) {
        ReentrantLock reentrantLock = (ReentrantLock) this.f14143;
        reentrantLock.lock();
        try {
        } finally {
            reentrantLock.unlock();
        }
    }

    @Override // defpackage.InterfaceC2925
    /* JADX INFO: renamed from: ᵨᵣ */
    public byte[] mo4740(int i, byte[] bArr) throws NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException {
        if (i > 16) {
            throw new InvalidAlgorithmParameterException("outputLength must not be larger than 16");
        }
        Mac mac = Mac.getInstance("AESCMAC", (Provider) this.f14142);
        mac.init((SecretKeySpec) this.f14143);
        byte[] bArrDoFinal = mac.doFinal(bArr);
        return i == bArrDoFinal.length ? bArrDoFinal : Arrays.copyOf(bArrDoFinal, i);
    }

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public File m8372() {
        if (((File) this.f14143) == null) {
            synchronized (this) {
                try {
                    if (((File) this.f14143) == null) {
                        C1191 c1191 = (C1191) this.f14142;
                        c1191.m3677();
                        this.f14143 = new File(c1191.f5076.getFilesDir(), "PersistedInstallation." + ((C1191) this.f14142).m3676() + ".json");
                    }
                } finally {
                }
            }
        }
        return (File) this.f14143;
    }

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public CctBackendFactory m8373(String str) {
        Map map;
        PackageManager packageManager;
        ServiceInfo serviceInfo;
        if (((Map) this.f14142) == null) {
            Context context = (Context) this.f14143;
            try {
                packageManager = context.getPackageManager();
            } catch (PackageManager.NameNotFoundException unused) {
            }
            Bundle bundle = (packageManager == null || (serviceInfo = packageManager.getServiceInfo(new ComponentName(context, (Class<?>) TransportBackendDiscovery.class), 128)) == null) ? null : serviceInfo.metaData;
            if (bundle == null) {
                map = Collections.EMPTY_MAP;
            } else {
                HashMap map2 = new HashMap();
                for (String str2 : bundle.keySet()) {
                    Object obj = bundle.get(str2);
                    if ((obj instanceof String) && str2.startsWith("backend:")) {
                        for (String str3 : ((String) obj).split(",", -1)) {
                            String strTrim = str3.trim();
                            if (!strTrim.isEmpty()) {
                                map2.put(strTrim, str2.substring(8));
                            }
                        }
                    }
                }
                map = map2;
            }
            this.f14142 = map;
        }
        String str4 = (String) ((Map) this.f14142).get(str);
        if (str4 == null) {
            return null;
        }
        try {
            return (CctBackendFactory) Class.forName(str4).asSubclass(CctBackendFactory.class).getDeclaredConstructor(null).newInstance(null);
        } catch (ClassNotFoundException unused2) {
            StringBuilder sb = new StringBuilder("Class ");
            sb.append(str4);
            sb.append(" is not found.");
            return null;
        } catch (IllegalAccessException unused3) {
            StringBuilder sb2 = new StringBuilder("Could not instantiate ");
            sb2.append(str4);
            sb2.append(".");
            return null;
        } catch (InstantiationException unused4) {
            StringBuilder sb3 = new StringBuilder("Could not instantiate ");
            sb3.append(str4);
            sb3.append(".");
            return null;
        } catch (NoSuchMethodException unused5) {
            "Could not instantiate ".concat(str4);
            return null;
        } catch (InvocationTargetException unused6) {
            "Could not instantiate ".concat(str4);
            return null;
        }
    }

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public void m8374(int i, int i2) {
        int[] iArr = (int[]) this.f14143;
        if (iArr == null || i >= iArr.length) {
            return;
        }
        int i3 = i + i2;
        m8380(i3);
        int[] iArr2 = (int[]) this.f14143;
        System.arraycopy(iArr2, i, iArr2, i3, (iArr2.length - i) - i2);
        Arrays.fill((int[]) this.f14143, i, i3, -1);
        ArrayList arrayList = (ArrayList) this.f14142;
        if (arrayList == null) {
            return;
        }
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            C4843 c4843 = (C4843) ((ArrayList) this.f14142).get(size);
            int i4 = c4843.f18453;
            if (i4 >= i) {
                c4843.f18453 = i4 + i2;
            }
        }
    }

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public ComponentCallbacks2C2427 m8375(Context context, ComponentCallbacks2C0017 componentCallbacks2C0017, C0727 c0727, AbstractC0651 abstractC0651, boolean z) {
        ᵱˉˈ.ʽˈˋ();
        ᵱˉˈ.ʽˈˋ();
        HashMap map = (HashMap) this.f14143;
        ComponentCallbacks2C2427 componentCallbacks2C2427 = (ComponentCallbacks2C2427) map.get(c0727);
        if (componentCallbacks2C2427 != null) {
            return componentCallbacks2C2427;
        }
        C2946 c2946 = new C2946(c0727);
        ˑᵤʽˏ r2 = (ˑᵤʽˏ) this.f14142;
        ˉᵠﹳᵘ r3 = new ˉᵠﹳᵘ(this, abstractC0651);
        r2.getClass();
        ComponentCallbacks2C2427 componentCallbacks2C24272 = new ComponentCallbacks2C2427(componentCallbacks2C0017, c2946, r3, context);
        map.put(c0727, componentCallbacks2C24272);
        c2946.mo7036(new C1617(this, c0727));
        if (z) {
            componentCallbacks2C24272.mo3555();
        }
        return componentCallbacks2C24272;
    }

    @Override // defpackage.InterfaceC1989
    /* JADX INFO: renamed from: ᵱᵽʡᵚ */
    public void mo5364() {
        C1645 c1645 = (C1645) this.f14143;
        synchronized (c1645) {
            c1645.f6539 = c1645.f6538.length;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:40:0x00e5  */
    /* JADX WARN: Removed duplicated region for block: B:68:0x0118 A[EDGE_INSN: B:68:0x0118->B:52:0x0118 BREAK  A[LOOP:1: B:38:0x00df->B:51:0x0107], SYNTHETIC] */
    @Override // defpackage.InterfaceC4978
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public C2744 mo2729(InterfaceC5206 interfaceC5206, long j) {
        long position = interfaceC5206.getPosition();
        int iMin = (int) Math.min(20000L, interfaceC5206.getLength() - position);
        C4545 c4545 = (C4545) this.f14142;
        c4545.m9603(iMin);
        interfaceC5206.mo4701(c4545.f17284, 0, iMin);
        int i = -1;
        int i2 = -1;
        long j2 = -9223372036854775807L;
        while (c4545.m9623() >= 4) {
            if (C5052.m10389(c4545.f17282, c4545.f17284) != 442) {
                c4545.m9609(1);
            } else {
                c4545.m9609(4);
                long jM8526 = C3827.m8526(c4545);
                if (jM8526 != -9223372036854775807L) {
                    long jM1133 = ((C0085) this.f14143).m1133(jM8526);
                    if (jM1133 > j) {
                        return j2 == -9223372036854775807L ? new C2744(jM1133, -1, position) : new C2744(-9223372036854775807L, 0, position + ((long) i2));
                    }
                    long j3 = 100000 + jM1133;
                    i2 = c4545.f17282;
                    if (j3 > j) {
                        return new C2744(-9223372036854775807L, 0, position + ((long) i2));
                    }
                    j2 = jM1133;
                }
                int i3 = c4545.f17283;
                if (c4545.m9623() < 10) {
                    c4545.m9624(i3);
                } else {
                    c4545.m9609(9);
                    int iM9626 = c4545.m9626() & 7;
                    if (c4545.m9623() < iM9626) {
                        c4545.m9624(i3);
                    } else {
                        c4545.m9609(iM9626);
                        if (c4545.m9623() < 4) {
                            c4545.m9624(i3);
                        } else {
                            if (C5052.m10389(c4545.f17282, c4545.f17284) == 443) {
                                c4545.m9609(4);
                                int iM9598 = c4545.m9598();
                                if (c4545.m9623() >= iM9598) {
                                    c4545.m9609(iM9598);
                                    while (true) {
                                        if (c4545.m9623() >= 4) {
                                            break;
                                        }
                                        int iM10389 = C5052.m10389(c4545.f17282, c4545.f17284);
                                        if (iM10389 == 442 || iM10389 == 441 || (iM10389 >>> 8) != 1) {
                                            break;
                                        }
                                        c4545.m9609(4);
                                        if (c4545.m9623() < 2) {
                                            c4545.m9624(i3);
                                            break;
                                        }
                                        c4545.m9624(Math.min(c4545.f17283, c4545.f17282 + c4545.m9598()));
                                    }
                                } else {
                                    c4545.m9624(i3);
                                }
                            } else {
                                while (true) {
                                    if (c4545.m9623() >= 4) {
                                    }
                                    c4545.m9624(Math.min(c4545.f17283, c4545.f17282 + c4545.m9598()));
                                }
                            }
                        }
                    }
                }
                i = c4545.f17282;
            }
        }
        return j2 != -9223372036854775807L ? new C2744(j2, -2, position + ((long) i)) : C2744.f10548;
    }

    @Override // defpackage.InterfaceC1088
    /* JADX INFO: renamed from: ᵵᵽ */
    public StackTraceElement[] mo3528(StackTraceElement[] stackTraceElementArr) {
        if (stackTraceElementArr.length <= 1024) {
            return stackTraceElementArr;
        }
        InterfaceC1088[] interfaceC1088Arr = (InterfaceC1088[]) this.f14143;
        StackTraceElement[] stackTraceElementArrMo3528 = stackTraceElementArr;
        for (int i = 0; i < 1; i++) {
            InterfaceC1088 interfaceC1088 = interfaceC1088Arr[i];
            if (stackTraceElementArrMo3528.length <= 1024) {
                break;
            }
            stackTraceElementArrMo3528 = interfaceC1088.mo3528(stackTraceElementArr);
        }
        return stackTraceElementArrMo3528.length > 1024 ? ((C5314) this.f14142).mo3528(stackTraceElementArrMo3528) : stackTraceElementArrMo3528;
    }

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public void m8376(int i, int i2) {
        int[] iArr = (int[]) this.f14143;
        if (iArr == null || i >= iArr.length) {
            return;
        }
        int i3 = i + i2;
        m8380(i3);
        int[] iArr2 = (int[]) this.f14143;
        System.arraycopy(iArr2, i3, iArr2, i, (iArr2.length - i) - i2);
        int[] iArr3 = (int[]) this.f14143;
        Arrays.fill(iArr3, iArr3.length - i2, iArr3.length, -1);
        ArrayList arrayList = (ArrayList) this.f14142;
        if (arrayList == null) {
            return;
        }
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            C4843 c4843 = (C4843) ((ArrayList) this.f14142).get(size);
            int i4 = c4843.f18453;
            if (i4 >= i) {
                if (i4 < i3) {
                    ((ArrayList) this.f14142).remove(size);
                } else {
                    c4843.f18453 = i4 - i2;
                }
            }
        }
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public C5022 m8377(Long l) {
        ReentrantLock reentrantLock = (ReentrantLock) this.f14143;
        reentrantLock.lock();
        try {
            return (C5022) ((HashMap) this.f14142).get(l);
        } finally {
            reentrantLock.unlock();
        }
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public void m8378(Object obj, String str) {
        int length = str.length();
        String strValueOf = String.valueOf(obj);
        ((ArrayList) this.f14143).add(AbstractC0793.m2864(new StringBuilder(length + 1 + strValueOf.length()), str, "=", strValueOf));
    }

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public void m8379(Bundle bundle) {
        C1109 c1109 = (C1109) this.f14143;
        Bundle bundle2 = ᵗʓ.ːˏᵟᵯ((C1081[]) Arrays.copyOf(new C1081[0], 0));
        Bundle bundle3 = c1109.f4749;
        if (bundle3 != null) {
            bundle2.putAll(bundle3);
        }
        synchronized (c1109.f4744) {
            for (Map.Entry entry : c1109.f4748.entrySet()) {
                bundle2.putBundle((String) entry.getKey(), ((InterfaceC2058) entry.getValue()).mo3884());
            }
        }
        if (bundle2.isEmpty()) {
            return;
        }
        bundle.putBundle("androidx.lifecycle.BundlableSavedStateRegistry.key", bundle2);
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public void m8380(int i) {
        int[] iArr = (int[]) this.f14143;
        if (iArr == null) {
            int[] iArr2 = new int[Math.max(i, 10) + 1];
            this.f14143 = iArr2;
            Arrays.fill(iArr2, -1);
        } else if (i >= iArr.length) {
            int length = iArr.length;
            while (length <= i) {
                length *= 2;
            }
            int[] iArr3 = new int[length];
            this.f14143 = iArr3;
            System.arraycopy(iArr, 0, iArr3, 0, iArr.length);
            int[] iArr4 = (int[]) this.f14143;
            Arrays.fill(iArr4, iArr.length, iArr4.length, -1);
        }
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public String m8381(InterfaceC0883 interfaceC0883) {
        String str;
        C4280 c4280 = (C4280) ((ᵯᵨᵲ) this.f14142).ᵟᵹᵙ();
        try {
            interfaceC0883.mo2451(c4280.f16338);
            byte[] bArrDigest = c4280.f16338.digest();
            char[] cArr = ᵱˉˈ.ʽˈˋ;
            synchronized (cArr) {
                for (int i = 0; i < bArrDigest.length; i++) {
                    byte b = bArrDigest[i];
                    int i2 = i * 2;
                    char[] cArr2 = ᵱˉˈ.ᵲᵶᵳˈ;
                    cArr[i2] = cArr2[(b & 255) >>> 4];
                    cArr[i2 + 1] = cArr2[b & 15];
                }
                str = new String(cArr);
            }
            return str;
        } finally {
            ((ᵯᵨᵲ) this.f14142).ᵵᵽ(c4280);
        }
    }
}
