package o;

import java.util.ArrayList;
import java.util.LinkedHashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class D1 extends AbstractC2962y1 {
    public final /* synthetic */ int a;
    public final /* synthetic */ E1 b;
    public final /* synthetic */ String c;
    public final /* synthetic */ AbstractC2772w1 d;

    public /* synthetic */ D1(E1 e1, String str, AbstractC2772w1 abstractC2772w1, int i) {
        this.a = i;
        this.b = e1;
        this.c = str;
        this.d = abstractC2772w1;
    }

    @Override // o.AbstractC2962y1
    public final void a(Object obj) {
        switch (this.a) {
            case 0:
                E1 e1 = this.b;
                ArrayList arrayList = e1.d;
                LinkedHashMap linkedHashMap = e1.b;
                String str = this.c;
                Object obj2 = linkedHashMap.get(str);
                AbstractC2772w1 abstractC2772w1 = this.d;
                if (obj2 == null) {
                    throw new IllegalStateException(("Attempting to launch an unregistered ActivityResultLauncher with contract " + abstractC2772w1 + " and input " + obj + ". You must ensure the ActivityResultLauncher is registered before calling launch().").toString());
                }
                int iIntValue = ((Number) obj2).intValue();
                arrayList.add(str);
                try {
                    e1.b(iIntValue, abstractC2772w1, obj);
                    return;
                } catch (Exception e) {
                    arrayList.remove(str);
                    throw e;
                }
            default:
                E1 e12 = this.b;
                ArrayList arrayList2 = e12.d;
                LinkedHashMap linkedHashMap2 = e12.b;
                String str2 = this.c;
                Object obj3 = linkedHashMap2.get(str2);
                AbstractC2772w1 abstractC2772w12 = this.d;
                if (obj3 == null) {
                    throw new IllegalStateException(("Attempting to launch an unregistered ActivityResultLauncher with contract " + abstractC2772w12 + " and input " + obj + ". You must ensure the ActivityResultLauncher is registered before calling launch().").toString());
                }
                int iIntValue2 = ((Number) obj3).intValue();
                arrayList2.add(str2);
                try {
                    e12.b(iIntValue2, abstractC2772w12, obj);
                    return;
                } catch (Exception e2) {
                    arrayList2.remove(str2);
                    throw e2;
                }
        }
    }

    public void b() {
        this.b.f(this.c);
    }
}
