package O1;

import W.C0348o;
import W.C0349p;
import Z6.AbstractC0385z;
import a.AbstractC0386a;
import android.content.Context;
import android.os.Bundle;
import android.security.keystore.KeyGenParameterSpec;
import android.text.Editable;
import android.text.Selection;
import android.text.TextPaint;
import android.util.SparseIntArray;
import android.view.KeyEvent;
import android.view.View;
import androidx.leanback.widget.AbstractC0458c0;
import androidx.leanback.widget.C0468h0;
import androidx.leanback.widget.P0;
import androidx.leanback.widget.X;
import androidx.lifecycle.C0506k;
import androidx.lifecycle.EnumC0510o;
import b4.C0539b;
import c0.C0567d;
import c0.C0575l;
import c7.InterfaceC0596d;
import c7.InterfaceC0597e;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.internal.measurement.C1;
import d0.C0760a;
import d3.V0;
import d7.C0850a;
import e0.C0853a;
import g3.InterfaceC0985c;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.ProviderException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
import javax.crypto.KeyGenerator;
import y5.AbstractC1757b;

/* JADX INFO: renamed from: O1.a, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0225a implements X1.b, InterfaceC0985c, InterfaceC0596d, androidx.leanback.widget.T, androidx.leanback.widget.P {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final /* synthetic */ int f5009q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public Object f5010r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public Object f5011s;

    public /* synthetic */ C0225a(int i, Object obj) {
        this.f5009q = i;
        this.f5011s = obj;
    }

    public static boolean j(Editable editable, KeyEvent keyEvent, boolean z8) {
        c0.s[] sVarArr;
        if (KeyEvent.metaStateHasNoModifiers(keyEvent.getMetaState())) {
            int selectionStart = Selection.getSelectionStart(editable);
            int selectionEnd = Selection.getSelectionEnd(editable);
            if (selectionStart != -1 && selectionEnd != -1 && selectionStart == selectionEnd && (sVarArr = (c0.s[]) editable.getSpans(selectionStart, selectionEnd, c0.s.class)) != null && sVarArr.length > 0) {
                for (c0.s sVar : sVarArr) {
                    int spanStart = editable.getSpanStart(sVar);
                    int spanEnd = editable.getSpanEnd(sVar);
                    if ((z8 && spanStart == selectionStart) || ((!z8 && spanEnd == selectionStart) || (selectionStart > spanStart && selectionStart < spanEnd))) {
                        editable.delete(spanStart, spanEnd);
                        return true;
                    }
                }
            }
        }
        return false;
    }

    @Override // g3.InterfaceC0985c
    public void a(g3.o oVar) {
        ((Map) ((C0225a) this.f5011s).f5011s).remove((g3.h) this.f5010r);
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0051 A[Catch: all -> 0x00a3, TRY_LEAVE, TryCatch #2 {all -> 0x00a3, blocks: (B:20:0x004d, B:22:0x0051, B:25:0x0062, B:29:0x0069, B:31:0x0071, B:33:0x007c, B:32:0x0077, B:27:0x0066, B:28:0x0068, B:45:0x009b, B:46:0x00a2, B:24:0x005d), top: B:71:0x004d, outer: #4, inners: #3 }] */
    /* JADX WARN: Removed duplicated region for block: B:45:0x009b A[Catch: all -> 0x00a3, TRY_ENTER, TryCatch #2 {all -> 0x00a3, blocks: (B:20:0x004d, B:22:0x0051, B:25:0x0062, B:29:0x0069, B:31:0x0071, B:33:0x007c, B:32:0x0077, B:27:0x0066, B:28:0x0068, B:45:0x009b, B:46:0x00a2, B:24:0x005d), top: B:71:0x004d, outer: #4, inners: #3 }] */
    @Override // X1.b
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public X1.a b(String str) {
        FileChannel fileChannel;
        FileChannel fileChannel2;
        P6.g.e(str, "fileName");
        w wVar = (w) this.f5011s;
        wVar.getClass();
        if (!str.equals(":memory:")) {
            str = wVar.f5081c.f5012a.getDatabasePath(str).getAbsolutePath();
            P6.g.b(str);
        }
        boolean z8 = true;
        P1.a aVar = new P1.a(str, (wVar.f5079a || wVar.f5080b || str.equals(":memory:")) ? false : true);
        ReentrantLock reentrantLock = aVar.f5326a;
        reentrantLock.lock();
        C0225a c0225a = aVar.f5327b;
        if (c0225a != null) {
            try {
                c0225a.n();
                try {
                    try {
                        if (!wVar.f5080b) {
                            throw new IllegalStateException("Recursive database initialization detected. Did you try to use the database instance during initialization? Maybe in one of the callbacks?");
                        }
                        X1.a aVarB = ((X1.b) this.f5010r).b(str);
                        if (wVar.f5079a) {
                            if (wVar.f5081c.f5018g == x.f5087r) {
                                android.support.v4.media.session.a.i(aVarB, "PRAGMA synchronous = NORMAL");
                            } else {
                                android.support.v4.media.session.a.i(aVarB, "PRAGMA synchronous = FULL");
                            }
                            w.b(aVarB);
                            wVar.f5082d.t(aVarB);
                        } else {
                            try {
                                wVar.f5080b = true;
                                w.a(wVar, aVarB);
                                wVar.f5080b = false;
                            } catch (Throwable th) {
                                wVar.f5080b = false;
                                throw th;
                            }
                        }
                        if (c0225a != null && (fileChannel2 = (FileChannel) c0225a.f5011s) != null) {
                            try {
                                fileChannel2.close();
                                c0225a.f5011s = null;
                            } finally {
                            }
                        }
                        return aVarB;
                    } catch (Throwable th2) {
                        if (c0225a != null && (fileChannel = (FileChannel) c0225a.f5011s) != null) {
                            try {
                                fileChannel.close();
                                c0225a.f5011s = null;
                            } finally {
                            }
                        }
                        throw th2;
                    }
                } catch (Throwable th3) {
                    th = th3;
                }
                th = th3;
            } catch (Throwable th4) {
                th = th4;
                z8 = false;
            }
        } else {
            if (!wVar.f5080b) {
            }
            th = th3;
        }
        try {
            if (z8) {
                throw th;
            }
            throw new IllegalStateException("Unable to open database '" + str + "'. Was a proper path / name used in Room's database builder?", th);
        } finally {
            reentrantLock.unlock();
        }
    }

    @Override // androidx.leanback.widget.P
    public void c(View view) {
        switch (this.f5009q) {
            case 18:
                androidx.leanback.widget.K k8 = (androidx.leanback.widget.K) this.f5010r;
                ((y5.l) this.f5011s).getClass();
                y5.l.w(k8, view, true);
                break;
            default:
                N5.c cVar = (N5.c) this.f5011s;
                if (cVar.f4752d != null) {
                    androidx.leanback.widget.F f3 = view == null ? null : (androidx.leanback.widget.F) ((P0) this.f5010r).f8486c.M(view);
                    if (f3 != null) {
                        cVar.f4752d.e(f3.f8368v, f3.f8369w, null, null);
                    } else {
                        cVar.f4752d.e(null, null, null, null);
                    }
                }
                break;
        }
    }

    public void d(Object obj, String str) {
        ((ArrayList) this.f5010r).add(str + "=" + String.valueOf(obj));
    }

    @Override // androidx.leanback.widget.T
    public void e(X x8, Object obj, C0468h0 c0468h0, Object obj2) {
        AbstractC0458c0 abstractC0458c0 = (AbstractC0458c0) obj2;
        int i = ((androidx.leanback.app.C) ((androidx.leanback.app.p) this.f5010r).f8240a).f8196s0;
        androidx.leanback.app.r rVar = (androidx.leanback.app.r) this.f5011s;
        rVar.w0(i);
        AbstractC1757b abstractC1757b = rVar.f8266f1;
        if (abstractC1757b != null) {
            abstractC1757b.e(x8, obj, c0468h0, abstractC0458c0);
        }
    }

    public boolean f() {
        synchronized (this) {
            if (((AtomicBoolean) this.f5011s).get()) {
                return false;
            }
            ((AtomicInteger) this.f5010r).incrementAndGet();
            return true;
        }
    }

    public B3.f g() {
        KeyGenParameterSpec keyGenParameterSpec = (KeyGenParameterSpec) this.f5011s;
        if (keyGenParameterSpec == null) {
            throw new IllegalArgumentException("build() called before setKeyGenParameterSpec or setKeyScheme.");
        }
        Object obj = W1.c.f7075a;
        if (keyGenParameterSpec.getKeySize() != 256) {
            throw new IllegalArgumentException("invalid key size, want 256 bits got " + keyGenParameterSpec.getKeySize() + " bits");
        }
        if (!Arrays.equals(keyGenParameterSpec.getBlockModes(), new String[]{"GCM"})) {
            throw new IllegalArgumentException("invalid block mode, want GCM got " + Arrays.toString(keyGenParameterSpec.getBlockModes()));
        }
        if (keyGenParameterSpec.getPurposes() != 3) {
            throw new IllegalArgumentException("invalid purposes mode, want PURPOSE_ENCRYPT | PURPOSE_DECRYPT got " + keyGenParameterSpec.getPurposes());
        }
        if (!Arrays.equals(keyGenParameterSpec.getEncryptionPaddings(), new String[]{"NoPadding"})) {
            throw new IllegalArgumentException("invalid padding mode, want NoPadding got " + Arrays.toString(keyGenParameterSpec.getEncryptionPaddings()));
        }
        if (keyGenParameterSpec.isUserAuthenticationRequired() && keyGenParameterSpec.getUserAuthenticationValidityDurationSeconds() < 1) {
            throw new IllegalArgumentException("per-operation authentication is not supported (UserAuthenticationValidityDurationSeconds must be >0)");
        }
        synchronized (W1.c.f7075a) {
            String keystoreAlias = keyGenParameterSpec.getKeystoreAlias();
            KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
            keyStore.load(null);
            if (!keyStore.containsAlias(keystoreAlias)) {
                try {
                    KeyGenerator keyGenerator = KeyGenerator.getInstance("AES", "AndroidKeyStore");
                    keyGenerator.init(keyGenParameterSpec);
                    keyGenerator.generateKey();
                } catch (ProviderException e8) {
                    throw new GeneralSecurityException(e8.getMessage(), e8);
                }
            }
        }
        return new B3.f((KeyGenParameterSpec) this.f5011s, keyGenParameterSpec.getKeystoreAlias());
    }

    public Bundle h(String str) {
        V1.a aVar = (V1.a) this.f5010r;
        if (!aVar.f6857g) {
            throw new IllegalStateException("You can 'consumeRestoredStateForKey' only after the corresponding component has moved to the 'CREATED' state");
        }
        Bundle bundle = aVar.f6856f;
        if (bundle == null) {
            return null;
        }
        Bundle bundleP = bundle.containsKey(str) ? AbstractC0386a.p(str, bundle) : null;
        bundle.remove(str);
        if (bundle.isEmpty()) {
            aVar.f6856f = null;
        }
        return bundleP;
    }

    public T0.m k(Object... objArr) {
        Constructor constructorB;
        synchronized (((AtomicBoolean) this.f5011s)) {
            if (!((AtomicBoolean) this.f5011s).get()) {
                try {
                    constructorB = ((I3.y) this.f5010r).b();
                } catch (ClassNotFoundException unused) {
                    ((AtomicBoolean) this.f5011s).set(true);
                    constructorB = null;
                } catch (Exception e8) {
                    throw new RuntimeException("Error instantiating extension", e8);
                }
            }
            constructorB = null;
        }
        if (constructorB == null) {
            return null;
        }
        try {
            return (T0.m) constructorB.newInstance(objArr);
        } catch (Exception e9) {
            throw new IllegalStateException("Unexpected error creating extractor", e9);
        }
    }

    public U1.d l() {
        U1.d dVar;
        V1.a aVar = (V1.a) this.f5010r;
        synchronized (aVar.f6853c) {
            Iterator it = aVar.f6854d.entrySet().iterator();
            do {
                dVar = null;
                if (!it.hasNext()) {
                    break;
                }
                Map.Entry entry = (Map.Entry) it.next();
                String str = (String) entry.getKey();
                U1.d dVar2 = (U1.d) entry.getValue();
                if (P6.g.a(str, "androidx.lifecycle.internal.SavedStateHandlesProvider")) {
                    dVar = dVar2;
                }
            } while (dVar == null);
        }
        return dVar;
    }

    public boolean m(CharSequence charSequence, int i, int i5, C0575l c0575l) {
        if (c0575l.f9304c == 0) {
            C0567d c0567d = (C0567d) this.f5011s;
            C0760a c0760aB = c0575l.b();
            int iA = c0760aB.a(8);
            if (iA != 0) {
                ((ByteBuffer) c0760aB.f1393t).getShort(iA + c0760aB.f1390q);
            }
            c0567d.getClass();
            ThreadLocal threadLocal = C0567d.f9282b;
            if (threadLocal.get() == null) {
                threadLocal.set(new StringBuilder());
            }
            StringBuilder sb = (StringBuilder) threadLocal.get();
            sb.setLength(0);
            while (i < i5) {
                sb.append(charSequence.charAt(i));
                i++;
            }
            TextPaint textPaint = c0567d.f9283a;
            String string = sb.toString();
            int i8 = F.c.f2233a;
            c0575l.f9304c = textPaint.hasGlyph(string) ? 2 : 1;
        }
        return c0575l.f9304c == 2;
    }

    public void n() throws IOException {
        String str = (String) this.f5010r;
        if (((FileChannel) this.f5011s) != null) {
            return;
        }
        try {
            File file = new File(str);
            File parentFile = file.getParentFile();
            if (parentFile != null) {
                parentFile.mkdirs();
            }
            FileChannel channel = new FileOutputStream(file).getChannel();
            this.f5011s = channel;
            if (channel != null) {
                channel.lock();
            }
        } catch (Throwable th) {
            FileChannel fileChannel = (FileChannel) this.f5011s;
            if (fileChannel != null) {
                fileChannel.close();
            }
            this.f5011s = null;
            throw new IllegalStateException(I1.a.p("Unable to lock file: '", str, "'."), th);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:118:? A[RETURN, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:14:0x0032  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x0073  */
    /* JADX WARN: Removed duplicated region for block: B:36:0x007e  */
    /* JADX WARN: Removed duplicated region for block: B:47:0x00b0  */
    /* JADX WARN: Removed duplicated region for block: B:72:0x0118  */
    /* JADX WARN: Type inference failed for: r2v4, types: [G6.i, O6.p] */
    @Override // c7.InterfaceC0596d
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public Object o(InterfaceC0597e interfaceC0597e, E6.d dVar) throws Throwable {
        c7.o oVar;
        Throwable th;
        d7.w wVar;
        C0225a c0225a;
        InterfaceC0597e interfaceC0597e2;
        d7.t tVar;
        c7.p pVar;
        C0225a c0225a2;
        c7.u uVar;
        Q4.H h8;
        switch (this.f5009q) {
            case 10:
                Object objO = ((C0225a) this.f5010r).o(new Q4.H(interfaceC0597e, (Q4.K) this.f5011s, 0), dVar);
                return objO == F6.a.f2580q ? objO : A6.n.f457a;
            case 22:
                if (dVar instanceof c7.o) {
                    oVar = (c7.o) dVar;
                    int i = oVar.f9453u;
                    if ((i & Integer.MIN_VALUE) != 0) {
                        oVar.f9453u = i - Integer.MIN_VALUE;
                    } else {
                        oVar = new c7.o(this, dVar);
                    }
                }
                Object obj = oVar.f9452t;
                F6.a aVar = F6.a.f2580q;
                int i5 = oVar.f9453u;
                if (i5 == 0) {
                    C1.N(obj);
                    E6.i iVar = oVar.f3016r;
                    P6.g.b(iVar);
                    d7.w wVar2 = new d7.w(interfaceC0597e, iVar);
                    try {
                        ?? r22 = (G6.i) this.f5010r;
                        oVar.f9455w = this;
                        oVar.f9456x = interfaceC0597e;
                        oVar.f9457y = wVar2;
                        oVar.f9453u = 1;
                        if (r22.k(wVar2, oVar) == aVar) {
                            return aVar;
                        }
                        c0225a = this;
                        interfaceC0597e2 = interfaceC0597e;
                        wVar = wVar2;
                        wVar.q();
                        tVar = (d7.t) c0225a.f5011s;
                        oVar.f9455w = null;
                        oVar.f9456x = null;
                        oVar.f9457y = null;
                        oVar.f9453u = 2;
                        if (tVar.o(interfaceC0597e2, oVar) == aVar) {
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        wVar = wVar2;
                        wVar.q();
                        throw th;
                    }
                } else if (i5 == 1) {
                    wVar = oVar.f9457y;
                    interfaceC0597e2 = oVar.f9456x;
                    c0225a = oVar.f9455w;
                    try {
                        C1.N(obj);
                        wVar.q();
                        tVar = (d7.t) c0225a.f5011s;
                        oVar.f9455w = null;
                        oVar.f9456x = null;
                        oVar.f9457y = null;
                        oVar.f9453u = 2;
                        if (tVar.o(interfaceC0597e2, oVar) == aVar) {
                            return aVar;
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        wVar.q();
                        throw th;
                    }
                } else {
                    if (i5 != 2) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    C1.N(obj);
                }
                return A6.n.f457a;
            case 23:
                if (dVar instanceof c7.p) {
                    pVar = (c7.p) dVar;
                    int i8 = pVar.f9459u;
                    if ((i8 & Integer.MIN_VALUE) != 0) {
                        pVar.f9459u = i8 - Integer.MIN_VALUE;
                    } else {
                        pVar = new c7.p(this, dVar);
                    }
                }
                Object objF = pVar.f9458t;
                Object obj2 = F6.a.f2580q;
                int i9 = pVar.f9459u;
                if (i9 == 0) {
                    C1.N(objF);
                    pVar.f9461w = this;
                    pVar.f9462x = interfaceC0597e;
                    pVar.f9459u = 1;
                    objF = c7.H.f((InterfaceC0596d) this.f5010r, interfaceC0597e, pVar);
                    if (objF == obj2) {
                        return obj2;
                    }
                    c0225a2 = this;
                } else {
                    if (i9 != 1) {
                        if (i9 != 2) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        C1.N(objF);
                        return A6.n.f457a;
                    }
                    interfaceC0597e = pVar.f9462x;
                    c0225a2 = pVar.f9461w;
                    C1.N(objF);
                }
                Throwable th4 = (Throwable) objF;
                if (th4 != null) {
                    Q4.F f3 = (Q4.F) c0225a2.f5011s;
                    pVar.f9461w = null;
                    pVar.f9462x = null;
                    pVar.f9459u = 2;
                    if (f3.j(interfaceC0597e, th4, pVar) == obj2) {
                        return obj2;
                    }
                }
                return A6.n.f457a;
            case 24:
                Object objO2 = ((C0225a) this.f5010r).o(new c7.t(new P6.j(), interfaceC0597e, (C0349p) this.f5011s), dVar);
                return objO2 == F6.a.f2580q ? objO2 : A6.n.f457a;
            case 25:
                if (dVar instanceof c7.u) {
                    uVar = (c7.u) dVar;
                    int i10 = uVar.f9480u;
                    if ((i10 & Integer.MIN_VALUE) != 0) {
                        uVar.f9480u = i10 - Integer.MIN_VALUE;
                    } else {
                        uVar = new c7.u(this, dVar);
                    }
                }
                Object obj3 = uVar.f9479t;
                F6.a aVar2 = F6.a.f2580q;
                int i11 = uVar.f9480u;
                if (i11 == 0) {
                    C1.N(obj3);
                    C0225a c0225a3 = (C0225a) this.f5010r;
                    Q4.H h9 = new Q4.H((C0348o) this.f5011s, interfaceC0597e);
                    try {
                        uVar.f9482w = h9;
                        uVar.f9480u = 1;
                        if (c0225a3.o(h9, uVar) == aVar2) {
                            return aVar2;
                        }
                    } catch (C0850a e8) {
                        e = e8;
                        h8 = h9;
                        if (e.f12341q == h8) {
                            throw e;
                        }
                        E6.i iVar2 = uVar.f3016r;
                        P6.g.b(iVar2);
                        AbstractC0385z.i(iVar2);
                    }
                } else {
                    if (i11 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    h8 = uVar.f9482w;
                    try {
                        C1.N(obj3);
                        break;
                    } catch (C0850a e9) {
                        e = e9;
                        if (e.f12341q == h8) {
                        }
                    }
                }
                return A6.n.f457a;
            default:
                Object objO3 = ((V0) this.f5010r).o(new Q4.H(interfaceC0597e, (W5.n) this.f5011s, 3), dVar);
                return objO3 == F6.a.f2580q ? objO3 : A6.n.f457a;
        }
    }

    public void p(Bundle bundle) {
        V1.a aVar = (V1.a) this.f5010r;
        if (!aVar.f6855e) {
            aVar.a();
        }
        U1.e eVar = aVar.f6851a;
        if (eVar.C().l().compareTo(EnumC0510o.f8837t) >= 0) {
            throw new IllegalStateException(("performRestore cannot be called when owner is " + eVar.C().l()).toString());
        }
        if (aVar.f6857g) {
            throw new IllegalStateException("SavedStateRegistry was already restored.");
        }
        Bundle bundleP = null;
        if (bundle != null && bundle.containsKey("androidx.lifecycle.BundlableSavedStateRegistry.key")) {
            bundleP = AbstractC0386a.p("androidx.lifecycle.BundlableSavedStateRegistry.key", bundle);
        }
        aVar.f6856f = bundleP;
        aVar.f6857g = true;
    }

    public void q(Bundle bundle) {
        V1.a aVar = (V1.a) this.f5010r;
        Bundle bundleE = W3.b.e((A6.h[]) Arrays.copyOf(new A6.h[0], 0));
        Bundle bundle2 = aVar.f6856f;
        if (bundle2 != null) {
            bundleE.putAll(bundle2);
        }
        synchronized (aVar.f6853c) {
            for (Map.Entry entry : aVar.f6854d.entrySet()) {
                String str = (String) entry.getKey();
                Bundle bundleA = ((U1.d) entry.getValue()).a();
                P6.g.e(str, "key");
                bundleE.putBundle(str, bundleA);
            }
        }
        if (bundleE.isEmpty()) {
            return;
        }
        bundle.putBundle("androidx.lifecycle.BundlableSavedStateRegistry.key", bundleE);
    }

    public void r(O3.n nVar) throws GeneralSecurityException {
        O3.o oVar = new O3.o(nVar.f5159a, P3.g.class);
        HashMap map = (HashMap) this.f5010r;
        if (!map.containsKey(oVar)) {
            map.put(oVar, nVar);
            return;
        }
        O3.n nVar2 = (O3.n) map.get(oVar);
        if (nVar2.equals(nVar) && nVar.equals(nVar2)) {
            return;
        }
        throw new GeneralSecurityException("Attempt to register non-equal PrimitiveConstructor object for already existing object of type: " + oVar);
    }

    public void s(H3.m mVar) throws GeneralSecurityException {
        if (mVar == null) {
            throw new NullPointerException("wrapper must be non-null");
        }
        Class clsC = mVar.c();
        HashMap map = (HashMap) this.f5011s;
        if (!map.containsKey(clsC)) {
            map.put(clsC, mVar);
            return;
        }
        H3.m mVar2 = (H3.m) map.get(clsC);
        if (mVar2.equals(mVar) && mVar.equals(mVar2)) {
            return;
        }
        throw new GeneralSecurityException("Attempt to register non-equal PrimitiveWrapper object or input class object for already existing object of type" + clsC);
    }

    public void t(String str, U1.d dVar) {
        P6.g.e(dVar, "provider");
        V1.a aVar = (V1.a) this.f5010r;
        synchronized (aVar.f6853c) {
            if (aVar.f6854d.containsKey(str)) {
                throw new IllegalArgumentException("SavedStateProvider with the given key is already registered");
            }
            aVar.f6854d.put(str, dVar);
        }
    }

    public String toString() {
        switch (this.f5009q) {
            case Z.g.BYTES_FIELD_NUMBER /* 8 */:
                StringBuilder sb = new StringBuilder(100);
                sb.append(this.f5011s.getClass().getSimpleName());
                sb.append('{');
                ArrayList arrayList = (ArrayList) this.f5010r;
                int size = arrayList.size();
                for (int i = 0; i < size; i++) {
                    sb.append((String) arrayList.get(i));
                    if (i < size - 1) {
                        sb.append(", ");
                    }
                }
                sb.append('}');
                return sb.toString();
            default:
                return super.toString();
        }
    }

    public void u() {
        if (!((V1.a) this.f5010r).f6858h) {
            throw new IllegalStateException("Can not perform this action after onSaveInstanceState");
        }
        U1.a aVar = (U1.a) this.f5011s;
        if (aVar == null) {
            aVar = new U1.a(this);
        }
        this.f5011s = aVar;
        try {
            C0506k.class.getDeclaredConstructor(null);
            U1.a aVar2 = (U1.a) this.f5011s;
            if (aVar2 != null) {
                aVar2.f6676a.add(C0506k.class.getName());
            }
        } catch (NoSuchMethodException e8) {
            throw new IllegalArgumentException("Class " + C0506k.class.getSimpleName() + " must have default constructor in order to be automatically recreated", e8);
        }
    }

    public void v() {
        synchronized (this) {
            ((AtomicInteger) this.f5010r).decrementAndGet();
            if (((AtomicInteger) this.f5010r).get() < 0) {
                throw new IllegalStateException("Unbalanced call to unblock() detected.");
            }
        }
    }

    public void w(boolean z8, Status status) {
        HashMap map;
        HashMap map2;
        synchronized (((Map) this.f5010r)) {
            map = new HashMap((Map) this.f5010r);
        }
        synchronized (((Map) this.f5011s)) {
            map2 = new HashMap((Map) this.f5011s);
        }
        for (Map.Entry entry : map.entrySet()) {
            if (z8 || ((Boolean) entry.getValue()).booleanValue()) {
                entry.getKey().getClass();
                throw new ClassCastException();
            }
        }
        for (Map.Entry entry2 : map2.entrySet()) {
            if (z8 || ((Boolean) entry2.getValue()).booleanValue()) {
                ((g3.h) entry2.getKey()).a(new D0.q(status));
            }
        }
    }

    public /* synthetic */ C0225a(Object obj, int i, Object obj2) {
        this.f5009q = i;
        this.f5011s = obj;
        this.f5010r = obj2;
    }

    public /* synthetic */ C0225a(Object obj, Object obj2, int i, boolean z8) {
        this.f5009q = i;
        this.f5010r = obj;
        this.f5011s = obj2;
    }

    public C0225a(int i) {
        this.f5009q = i;
        switch (i) {
            case 5:
                this.f5010r = new HashMap();
                this.f5011s = new HashMap();
                break;
            case 9:
                M2.e eVar = M2.e.f4165d;
                this.f5010r = new SparseIntArray();
                this.f5011s = eVar;
                break;
            default:
                this.f5010r = Collections.synchronizedMap(new WeakHashMap());
                this.f5011s = Collections.synchronizedMap(new WeakHashMap());
                break;
        }
    }

    public C0225a(P.g gVar, C0853a c0853a) {
        this.f5009q = 20;
        this.f5011s = c0853a;
        gVar.u(new C0539b(0, this));
        this.f5010r = new HashSet();
    }

    public /* synthetic */ C0225a(Object obj) {
        this.f5009q = 8;
        this.f5011s = obj;
        this.f5010r = new ArrayList();
    }

    public C0225a(V1.a aVar, int i) {
        this.f5009q = i;
        switch (i) {
            case 15:
                this.f5010r = aVar;
                this.f5011s = new C0225a(aVar, 14);
                break;
            default:
                this.f5010r = aVar;
                break;
        }
    }

    public C0225a(String str) {
        this.f5009q = 7;
        this.f5010r = str.concat(".lck");
    }

    public C0225a(z zVar) {
        this.f5009q = 6;
        this.f5010r = new AtomicInteger(0);
        this.f5011s = new AtomicBoolean(false);
    }

    public C0225a(O3.p pVar) {
        this.f5009q = 5;
        this.f5010r = new HashMap(pVar.f5163a);
        this.f5011s = new HashMap(pVar.f5164b);
    }

    public C0225a(w wVar, X1.b bVar) {
        this.f5009q = 0;
        P6.g.e(bVar, "actual");
        this.f5011s = wVar;
        this.f5010r = bVar;
    }

    /* JADX WARN: Multi-variable type inference failed */
    public C0225a(O6.p pVar, d7.t tVar) {
        this.f5009q = 22;
        this.f5010r = (G6.i) pVar;
        this.f5011s = tVar;
    }

    public C0225a(C2.a aVar, C4.f fVar, C0567d c0567d) {
        this.f5009q = 21;
        this.f5010r = aVar;
        this.f5011s = c0567d;
    }

    public C0225a(Context context) {
        this.f5009q = 16;
        context.getApplicationContext();
        this.f5010r = "_androidx_security_master_key_";
    }

    public C0225a(I3.y yVar) {
        this.f5009q = 12;
        this.f5010r = yVar;
        this.f5011s = new AtomicBoolean(false);
    }
}
