package xyz.stream.api.viewmodel;

import android.app.Activity;
import android.content.Context;
import com.google.android.gms.measurement.internal.u1;
import com.pichillilorenzo.flutter_inappwebview_android.credential_database.URLCredentialContract;
import java.util.HashMap;

/* JADX INFO: loaded from: classes3.dex */
public class LoginViewModel extends ApiViewModel {
    public androidx.lifecycle.v liveLogin;
    public androidx.lifecycle.v liveLostPassword;
    public androidx.lifecycle.v liveQuickLogin;
    public androidx.lifecycle.v liveRegister;
    public androidx.lifecycle.v liveSendCode;
    private androidx.lifecycle.w loginLiveData;
    private androidx.lifecycle.w lostPasswordLiveData;
    private androidx.lifecycle.w quickLoginLiveData;
    private androidx.lifecycle.w registerLiveData;
    private androidx.lifecycle.w sendCodeLiveData;

    public void login(Activity activity, String str, String str2) {
        androidx.lifecycle.w wVar = new androidx.lifecycle.w();
        this.loginLiveData = wVar;
        this.liveLogin = wVar;
        xyz.stream.api.o oVarF = xyz.stream.api.o.f();
        int i10 = 0;
        q qVar = new q(this, str, activity, i10);
        oVarF.getClass();
        HashMap mapU = defpackage.e.u("email", str, URLCredentialContract.FeedEntry.COLUMN_NAME_PASSWORD, str2);
        mapU.putAll(com.google.android.gms.measurement.internal.c0.g());
        xyz.stream.api.o.v("email/login", oVarF.n(), xyz.stream.utils.m.a(mapU), new xyz.stream.api.k(oVarF, qVar, "email/login", i10));
    }

    public void lostPassword(Context context, String str, String str2, String str3) {
        androidx.lifecycle.w wVar = new androidx.lifecycle.w();
        this.lostPasswordLiveData = wVar;
        this.liveLostPassword = wVar;
        xyz.stream.api.o oVarF = xyz.stream.api.o.f();
        b bVar = new b(this, context, 7);
        oVarF.getClass();
        HashMap mapU = defpackage.e.u("email", str, "new_password", str3);
        mapU.put("vcode", str2);
        xyz.stream.api.o.v("user/password/lost", oVarF.n(), xyz.stream.utils.m.a(mapU), new xyz.stream.api.k(oVarF, bVar, "user/password/lost", 3));
    }

    public void quickLogin(Activity activity) {
        androidx.lifecycle.w wVar = new androidx.lifecycle.w();
        this.quickLoginLiveData = wVar;
        this.liveQuickLogin = wVar;
        String strN = kotlinx.coroutines.flow.h.n("persist.sys.sn");
        String strN2 = kotlinx.coroutines.flow.h.n("persist.sys.chipid");
        xyz.stream.utils.f.p().x("checkSnLogin sn: " + strN + ", chipId: " + strN2);
        xyz.stream.api.o oVarF = xyz.stream.api.o.f();
        q qVar = new q(this, strN, activity, 1);
        oVarF.getClass();
        HashMap mapU = defpackage.e.u("sn", strN, "chipId", strN2);
        mapU.putAll(com.google.android.gms.measurement.internal.c0.g());
        xyz.stream.api.o.v("user/login/sn", oVarF.n(), xyz.stream.utils.m.a(mapU), new xyz.stream.api.j(oVarF, qVar, "user/login/sn", mapU, 12));
    }

    public void register(Context context, String str, String str2, String str3) {
        androidx.lifecycle.w wVar = new androidx.lifecycle.w();
        this.registerLiveData = wVar;
        this.liveRegister = wVar;
        xyz.stream.api.o oVarF = xyz.stream.api.o.f();
        p pVar = new p(this, str, context, 0);
        oVarF.getClass();
        HashMap mapU = defpackage.e.u("email", str, URLCredentialContract.FeedEntry.COLUMN_NAME_PASSWORD, str3);
        mapU.put("code", str2);
        mapU.putAll(com.google.android.gms.measurement.internal.c0.g());
        xyz.stream.api.o.v("email/reg", oVarF.n(), xyz.stream.utils.m.a(mapU), new xyz.stream.api.k(oVarF, pVar, "email/reg", 2));
    }

    public void sendCode(Activity activity, boolean z10, String str, String str2) {
        androidx.lifecycle.w wVar = new androidx.lifecycle.w();
        this.sendCodeLiveData = wVar;
        this.liveSendCode = wVar;
        xyz.stream.api.o oVarF = xyz.stream.api.o.f();
        b bVar = new b(this, activity, 6);
        oVarF.getClass();
        HashMap mapO = u1.o("email", str);
        if (z10) {
            mapO.put("type", "forget_password");
        } else {
            mapO.put("type", "register");
        }
        mapO.put(URLCredentialContract.FeedEntry.COLUMN_NAME_PASSWORD, str2);
        mapO.putAll(com.google.android.gms.measurement.internal.c0.g());
        xyz.stream.api.o.v("email/send", oVarF.n(), xyz.stream.utils.m.a(mapO), new xyz.stream.api.k(oVarF, bVar, "email/send", 1));
    }
}
