package o;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Bs0 extends Yn0 {
    public final /* synthetic */ int n = 0;

    /* renamed from: o, reason: collision with root package name */
    public final Object f59o;

    public Bs0(C70 c70) {
        super("internal.eventLogger");
        this.f59o = c70;
    }

    @Override // o.Yn0
    public final InterfaceC1991no0 g(C2062oc0 c2062oc0, List list) {
        TreeMap treeMap;
        switch (this.n) {
            case 0:
                AbstractC2378rs0.o0(this.l, 3, list);
                String strZzc = ((C3031ym0) c2062oc0.b).h(c2062oc0, (InterfaceC1991no0) list.get(0)).zzc();
                InterfaceC1991no0 interfaceC1991no0 = (InterfaceC1991no0) list.get(1);
                C3031ym0 c3031ym0 = (C3031ym0) c2062oc0.b;
                long jV0 = (long) AbstractC2378rs0.v0(c3031ym0.h(c2062oc0, interfaceC1991no0).zzd().doubleValue());
                InterfaceC1991no0 interfaceC1991no0H = c3031ym0.h(c2062oc0, (InterfaceC1991no0) list.get(2));
                HashMap mapX0 = interfaceC1991no0H instanceof C1325go0 ? AbstractC2378rs0.x0((C1325go0) interfaceC1991no0H) : new HashMap();
                C70 c70 = (C70) this.f59o;
                c70.getClass();
                HashMap map = new HashMap();
                for (String str : mapX0.keySet()) {
                    HashMap map2 = ((Kn0) c70.m).c;
                    map.put(str, Kn0.b(str, map2.containsKey(str) ? map2.get(str) : null, mapX0.get(str)));
                }
                ((ArrayList) c70.f65o).add(new Kn0(strZzc, jV0, map));
                return InterfaceC1991no0.d;
            case 1:
                AbstractC2378rs0.o0("getValue", 2, list);
                InterfaceC1991no0 interfaceC1991no0H2 = ((C3031ym0) c2062oc0.b).h(c2062oc0, (InterfaceC1991no0) list.get(0));
                InterfaceC1991no0 interfaceC1991no0H3 = ((C3031ym0) c2062oc0.b).h(c2062oc0, (InterfaceC1991no0) list.get(1));
                String strZzc2 = interfaceC1991no0H2.zzc();
                C3031ym0 c3031ym02 = (C3031ym0) this.f59o;
                Map map3 = (Map) ((C2851wr0) c3031ym02.n).d.get((String) c3031ym02.m);
                String str2 = (map3 == null || !map3.containsKey(strZzc2)) ? null : (String) map3.get(strZzc2);
                return str2 != null ? new C2560to0(str2) : interfaceC1991no0H3;
            case 2:
                return InterfaceC1991no0.d;
            case 3:
                try {
                    return As0.d0(((CallableC2282qr0) this.f59o).call());
                } catch (Exception unused) {
                    return InterfaceC1991no0.d;
                }
            default:
                AbstractC2378rs0.o0(this.l, 3, list);
                ((C3031ym0) c2062oc0.b).h(c2062oc0, (InterfaceC1991no0) list.get(0)).zzc();
                InterfaceC1991no0 interfaceC1991no02 = (InterfaceC1991no0) list.get(1);
                C3031ym0 c3031ym03 = (C3031ym0) c2062oc0.b;
                InterfaceC1991no0 interfaceC1991no0H4 = c3031ym03.h(c2062oc0, interfaceC1991no02);
                if (!(interfaceC1991no0H4 instanceof C1801lo0)) {
                    throw new IllegalArgumentException("Invalid callback type");
                }
                InterfaceC1991no0 interfaceC1991no0H5 = c3031ym03.h(c2062oc0, (InterfaceC1991no0) list.get(2));
                if (!(interfaceC1991no0H5 instanceof C1325go0)) {
                    throw new IllegalArgumentException("Invalid callback params");
                }
                C1325go0 c1325go0 = (C1325go0) interfaceC1991no0H5;
                HashMap map4 = c1325go0.l;
                if (!map4.containsKey("type")) {
                    throw new IllegalArgumentException("Undefined rule type");
                }
                String strZzc3 = c1325go0.c("type").zzc();
                int iU0 = map4.containsKey("priority") ? AbstractC2378rs0.u0(c1325go0.c("priority").zzd().doubleValue()) : 1000;
                Gm0 gm0 = (Gm0) this.f59o;
                C1801lo0 c1801lo0 = (C1801lo0) interfaceC1991no0H4;
                gm0.getClass();
                if ("create".equals(strZzc3)) {
                    treeMap = (TreeMap) gm0.n;
                } else {
                    if (!"edit".equals(strZzc3)) {
                        throw new IllegalStateException("Unknown callback type: ".concat(String.valueOf(strZzc3)));
                    }
                    treeMap = (TreeMap) gm0.m;
                }
                if (treeMap.containsKey(Integer.valueOf(iU0))) {
                    iU0 = ((Integer) treeMap.lastKey()).intValue() + 1;
                }
                treeMap.put(Integer.valueOf(iU0), c1801lo0);
                return InterfaceC1991no0.d;
        }
    }

    public Bs0(C1696kj0 c1696kj0) {
        super("internal.logger");
        this.f59o = c1696kj0;
        this.m.put("log", new Dw0(this, false, true));
        this.m.put("silent", new Mt0("silent", 1));
        ((Yn0) this.m.get("silent")).d("log", new Dw0(this, true, true));
        this.m.put("unmonitored", new Mt0("unmonitored", 2));
        ((Yn0) this.m.get("unmonitored")).d("log", new Dw0(this, false, false));
    }

    public Bs0(Gm0 gm0) {
        super("internal.registerCallback");
        this.f59o = gm0;
    }

    public Bs0(CallableC2282qr0 callableC2282qr0) {
        super("internal.appMetadata");
        this.f59o = callableC2282qr0;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public Bs0(Mt0 mt0, C3031ym0 c3031ym0) {
        super("getValue");
        this.f59o = c3031ym0;
    }
}
