X-plore v4.37.09版本的 MD5 值为:1ac588cd7c13e9578c2d4266387e2f4f
以下内容为反编译后的 f.java 源代码,内容仅作参考
package M6;
import D3.dl.ysONN;
import F7.C1160d;
import F7.w;
import F7.x;
import M6.f;
import M6.l;
import S4.oWw.yBiTelOWBwmsB;
import W7.C;
import W7.C1528a0;
import W7.Z;
import W7.j0;
import W7.n0;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.security.KeyChain;
import android.security.KeyChainAliasCallback;
import android.security.KeyChainException;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.ClientCertRequest;
import android.webkit.HttpAuthHandler;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import c3.dDy.EPlQ;
import h7.AbstractC6736y;
import h7.C6709J;
import i7.AbstractC6821C;
import i7.AbstractC6843u;
import i7.Q;
import i7.S;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringTokenizer;
import org.json.JSONObject;
import u6.AbstractC7557C;
import u6.E;
import u6.F;
import w7.AbstractC7763c;
import w7.AbstractC7771k;
import w7.AbstractC7780t;
import w7.AbstractC7781u;
public final class f {
public static final e f7452e = new e(null);
public static final int f7453f = 8;
private static final a f7454g = new a();
private final String f7455a;
private final String f7456b;
private String f7457c;
private String f7458d;
public static final class a extends c {
public a() {
super("https://login.microsoftonline.com", "common");
}
}
public static final class b {
public static final C0218b Companion = new C0218b(null);
private String f7459a;
private String f7460b;
private String f7461c;
private String f7462d;
private String f7463e;
private String f7464f;
private String f7465g;
private String f7466h;
private String f7467i;
private String f7468j;
private String f7469k;
private String f7470l;
private String f7471m;
private String f7472n;
public String f7473o;
public static final class a implements C {
public static final a f7474a;
private static final C1528a0 f7475b;
static {
a aVar = new a();
f7474a = aVar;
C1528a0 c1528a0 = new C1528a0("com.lonelycatgames.Xplore.clouds.one_drive.AzureTokenRetriever.AuthorizationRequest1", aVar, 14);
c1528a0.n("client_id", true);
c1528a0.n("redirect_uri", true);
c1528a0.n("scope", true);
c1528a0.n("login_hint", true);
c1528a0.n("prompt", true);
c1528a0.n("response_type", true);
c1528a0.n("code_challenge", true);
c1528a0.n("code_challenge_method", true);
c1528a0.n("x-client-Ver", true);
c1528a0.n("x-client-SKU", true);
c1528a0.n("x-client-OS", true);
c1528a0.n("x-client-DM", true);
c1528a0.n("login_req", true);
c1528a0.n("domain_req", true);
f7475b = c1528a0;
}
private a() {
}
@Override
public U7.f a() {
return f7475b;
}
@Override
public S7.b[] b() {
return C.a.a(this);
}
@Override
public S7.b[] d() {
n0 n0Var = n0.f13238a;
return new S7.b[]{T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var)};
}
@Override
public b e(V7.e eVar) {
int i9;
String str;
String str2;
String str3;
String str4;
String str5;
String str6;
String str7;
String str8;
String str9;
String str10;
String str11;
String str12;
String str13;
String str14;
String str15;
String str16;
String str17;
String str18;
AbstractC7780t.f(eVar, "decoder");
U7.f a9 = a();
V7.c c9 = eVar.c(a9);
String str19 = null;
if (c9.x()) {
n0 n0Var = n0.f13238a;
String str20 = (String) c9.e(a9, 0, n0Var, null);
String str21 = (String) c9.e(a9, 1, n0Var, null);
String str22 = (String) c9.e(a9, 2, n0Var, null);
String str23 = (String) c9.e(a9, 3, n0Var, null);
String str24 = (String) c9.e(a9, 4, n0Var, null);
String str25 = (String) c9.e(a9, 5, n0Var, null);
String str26 = (String) c9.e(a9, 6, n0Var, null);
String str27 = (String) c9.e(a9, 7, n0Var, null);
String str28 = (String) c9.e(a9, 8, n0Var, null);
String str29 = (String) c9.e(a9, 9, n0Var, null);
String str30 = (String) c9.e(a9, 10, n0Var, null);
String str31 = (String) c9.e(a9, 11, n0Var, null);
String str32 = (String) c9.e(a9, 12, n0Var, null);
str14 = (String) c9.e(a9, 13, n0Var, null);
i9 = 16383;
str3 = str31;
str4 = str30;
str9 = str29;
str6 = str27;
str7 = str26;
str10 = str25;
str11 = str23;
str5 = str28;
str8 = str24;
str13 = str22;
str12 = str21;
str2 = str32;
str = str20;
} else {
int i10 = 0;
String str33 = null;
String str34 = null;
String str35 = null;
String str36 = null;
String str37 = null;
String str38 = null;
String str39 = null;
String str40 = null;
String str41 = null;
String str42 = null;
String str43 = null;
String str44 = null;
boolean z8 = true;
String str45 = null;
while (z8) {
String str46 = str33;
int v8 = c9.v(a9);
switch (v8) {
case -1:
str16 = str19;
str17 = str45;
str18 = str46;
z8 = false;
str33 = str18;
str45 = str17;
str19 = str16;
case 0:
str16 = str19;
str17 = str45;
str18 = str46;
str44 = (String) c9.e(a9, 0, n0.f13238a, str44);
i10 |= 1;
str33 = str18;
str45 = str17;
str19 = str16;
case 1:
str16 = str19;
str17 = str45;
str33 = (String) c9.e(a9, 1, n0.f13238a, str46);
i10 |= 2;
str45 = str17;
str19 = str16;
case 2:
i10 |= 4;
str45 = (String) c9.e(a9, 2, n0.f13238a, str45);
str19 = str19;
str33 = str46;
case 3:
str15 = str45;
str43 = (String) c9.e(a9, 3, n0.f13238a, str43);
i10 |= 8;
str33 = str46;
str45 = str15;
case 4:
str15 = str45;
str40 = (String) c9.e(a9, 4, n0.f13238a, str40);
i10 |= 16;
str33 = str46;
str45 = str15;
case 5:
str15 = str45;
str42 = (String) c9.e(a9, 5, n0.f13238a, str42);
i10 |= 32;
str33 = str46;
str45 = str15;
case 6:
str15 = str45;
str39 = (String) c9.e(a9, 6, n0.f13238a, str39);
i10 |= 64;
str33 = str46;
str45 = str15;
case 7:
str15 = str45;
str38 = (String) c9.e(a9, 7, n0.f13238a, str38);
i10 |= 128;
str33 = str46;
str45 = str15;
case 8:
str15 = str45;
str37 = (String) c9.e(a9, 8, n0.f13238a, str37);
i10 |= 256;
str33 = str46;
str45 = str15;
case 9:
str15 = str45;
str41 = (String) c9.e(a9, 9, n0.f13238a, str41);
i10 |= 512;
str33 = str46;
str45 = str15;
case 10:
str15 = str45;
str36 = (String) c9.e(a9, 10, n0.f13238a, str36);
i10 |= 1024;
str33 = str46;
str45 = str15;
case 11:
str15 = str45;
str35 = (String) c9.e(a9, 11, n0.f13238a, str35);
i10 |= 2048;
str33 = str46;
str45 = str15;
case 12:
str15 = str45;
str34 = (String) c9.e(a9, 12, n0.f13238a, str34);
i10 |= 4096;
str33 = str46;
str45 = str15;
case 13:
str15 = str45;
str19 = (String) c9.e(a9, 13, n0.f13238a, str19);
i10 |= 8192;
str33 = str46;
str45 = str15;
default:
throw new S7.k(v8);
}
}
i9 = i10;
str = str44;
str2 = str34;
str3 = str35;
str4 = str36;
str5 = str37;
str6 = str38;
str7 = str39;
str8 = str40;
str9 = str41;
str10 = str42;
str11 = str43;
str12 = str33;
str13 = str45;
str14 = str19;
}
c9.b(a9);
return new b(i9, str, str12, str13, str11, str8, str10, str7, str6, str5, str9, str4, str3, str2, str14, null);
}
@Override
public void c(V7.f fVar, b bVar) {
AbstractC7780t.f(fVar, "encoder");
AbstractC7780t.f(bVar, "value");
U7.f a9 = a();
V7.d c9 = fVar.c(a9);
b.h(bVar, c9, a9);
c9.b(a9);
}
}
public static final class C0218b {
private C0218b() {
}
public C0218b(AbstractC7771k abstractC7771k) {
this();
}
public final S7.b serializer() {
return a.f7474a;
}
}
public static final class c {
private final String f7476a;
private final String f7477b;
public c() {
byte[] bArr = new byte[32];
new SecureRandom().nextBytes(bArr);
String H02 = t6.k.H0(bArr, false, false, true, 3, null);
this.f7476a = H02;
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
Charset forName = Charset.forName("ISO_8859_1");
AbstractC7780t.e(forName, "forName(...)");
byte[] bytes = H02.getBytes(forName);
AbstractC7780t.e(bytes, "getBytes(...)");
messageDigest.update(bytes);
byte[] digest = messageDigest.digest();
AbstractC7780t.c(digest);
this.f7477b = t6.k.H0(digest, false, false, true, 3, null);
} catch (UnsupportedEncodingException unused) {
throw new IllegalStateException();
} catch (NoSuchAlgorithmException e9) {
throw new IllegalStateException("Failed to generate the code verifier challenge", e9);
}
}
public final String a() {
return this.f7477b;
}
public final String b() {
return this.f7476a;
}
}
public b() {
this.f7464f = "code";
c cVar = new c();
this.f7466h = "S256";
this.f7465g = cVar.a();
c(cVar.b());
this.f7467i = "1.0";
this.f7468j = "MSAL.Android";
this.f7469k = String.valueOf(Build.VERSION.SDK_INT);
this.f7470l = Build.MODEL;
}
public b(int i9, String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11, String str12, String str13, String str14, j0 j0Var) {
if ((i9 & 1) == 0) {
this.f7459a = null;
} else {
this.f7459a = str;
}
if ((i9 & 2) == 0) {
this.f7460b = null;
} else {
this.f7460b = str2;
}
if ((i9 & 4) == 0) {
this.f7461c = null;
} else {
this.f7461c = str3;
}
if ((i9 & 8) == 0) {
this.f7462d = null;
} else {
this.f7462d = str4;
}
if ((i9 & 16) == 0) {
this.f7463e = null;
} else {
this.f7463e = str5;
}
if ((i9 & 32) == 0) {
this.f7464f = null;
} else {
this.f7464f = str6;
}
if ((i9 & 64) == 0) {
this.f7465g = null;
} else {
this.f7465g = str7;
}
if ((i9 & 128) == 0) {
this.f7466h = null;
} else {
this.f7466h = str8;
}
if ((i9 & 256) == 0) {
this.f7467i = null;
} else {
this.f7467i = str9;
}
if ((i9 & 512) == 0) {
this.f7468j = null;
} else {
this.f7468j = str10;
}
if ((i9 & 1024) == 0) {
this.f7469k = null;
} else {
this.f7469k = str11;
}
if ((i9 & 2048) == 0) {
this.f7470l = null;
} else {
this.f7470l = str12;
}
if ((i9 & 4096) == 0) {
this.f7471m = null;
} else {
this.f7471m = str13;
}
if ((i9 & 8192) == 0) {
this.f7472n = null;
} else {
this.f7472n = str14;
}
this.f7464f = "code";
c cVar = new c();
this.f7466h = "S256";
this.f7465g = cVar.a();
c(cVar.b());
this.f7467i = "1.0";
this.f7468j = "MSAL.Android";
this.f7469k = String.valueOf(Build.VERSION.SDK_INT);
this.f7470l = Build.MODEL;
}
public static final void h(b bVar, V7.d dVar, U7.f fVar) {
if (dVar.C(fVar, 0) || bVar.f7459a != null) {
dVar.r(fVar, 0, n0.f13238a, bVar.f7459a);
}
if (dVar.C(fVar, 1) || bVar.f7460b != null) {
dVar.r(fVar, 1, n0.f13238a, bVar.f7460b);
}
if (dVar.C(fVar, 2) || bVar.f7461c != null) {
dVar.r(fVar, 2, n0.f13238a, bVar.f7461c);
}
if (dVar.C(fVar, 3) || bVar.f7462d != null) {
dVar.r(fVar, 3, n0.f13238a, bVar.f7462d);
}
if (dVar.C(fVar, 4) || bVar.f7463e != null) {
dVar.r(fVar, 4, n0.f13238a, bVar.f7463e);
}
if (dVar.C(fVar, 5) || bVar.f7464f != null) {
dVar.r(fVar, 5, n0.f13238a, bVar.f7464f);
}
if (dVar.C(fVar, 6) || bVar.f7465g != null) {
dVar.r(fVar, 6, n0.f13238a, bVar.f7465g);
}
if (dVar.C(fVar, 7) || bVar.f7466h != null) {
dVar.r(fVar, 7, n0.f13238a, bVar.f7466h);
}
if (dVar.C(fVar, 8) || bVar.f7467i != null) {
dVar.r(fVar, 8, n0.f13238a, bVar.f7467i);
}
if (dVar.C(fVar, 9) || bVar.f7468j != null) {
dVar.r(fVar, 9, n0.f13238a, bVar.f7468j);
}
if (dVar.C(fVar, 10) || bVar.f7469k != null) {
dVar.r(fVar, 10, n0.f13238a, bVar.f7469k);
}
if (dVar.C(fVar, 11) || bVar.f7470l != null) {
dVar.r(fVar, 11, n0.f13238a, bVar.f7470l);
}
if (dVar.C(fVar, 12) || bVar.f7471m != null) {
dVar.r(fVar, 12, n0.f13238a, bVar.f7471m);
}
if (!dVar.C(fVar, 13) && bVar.f7472n == null) {
return;
}
dVar.r(fVar, 13, n0.f13238a, bVar.f7472n);
}
public final String a() {
String str = this.f7473o;
if (str != null) {
return str;
}
AbstractC7780t.r("codeVerifier");
return null;
}
public final void b(String str) {
this.f7459a = str;
}
public final void c(String str) {
AbstractC7780t.f(str, "<set-?>");
this.f7473o = str;
}
public final void d(String str) {
this.f7462d = str;
}
public final void e(String str) {
this.f7463e = str;
}
public final void f(String str) {
this.f7460b = str;
}
public final void g(String str) {
this.f7461c = str;
}
}
public static class c {
protected static final a f7478c = new a(null);
private final String f7479a;
private final String f7480b;
protected static final class a {
private a() {
}
public a(AbstractC7771k abstractC7771k) {
this();
}
}
public c(String str, String str2) {
AbstractC7780t.f(str, "cloudUrl");
AbstractC7780t.f(str2, "tenantId");
this.f7479a = str;
this.f7480b = str2;
}
public final String a() {
return this.f7479a;
}
public final String b() {
return this.f7480b;
}
}
public static final class d extends WebViewClient {
private final Activity f7481a;
private final String f7482b;
private final WebView f7483c;
private final v7.l f7484d;
public static final class a extends Exception {
public a(String str) {
super(str);
}
}
public static final class b {
private final WebView f7485a;
private final HttpAuthHandler f7486b;
private final String f7487c;
private final String f7488d;
public b(WebView webView, HttpAuthHandler httpAuthHandler, String str, String str2) {
AbstractC7780t.f(httpAuthHandler, "handler");
this.f7485a = webView;
this.f7486b = httpAuthHandler;
this.f7487c = str;
this.f7488d = str2;
}
public final HttpAuthHandler a() {
return this.f7486b;
}
public final String b() {
return this.f7487c;
}
public final String c() {
return this.f7488d;
}
public final WebView d() {
return this.f7485a;
}
}
public d(Activity activity, String str, WebView webView, v7.l lVar) {
AbstractC7780t.f(activity, "activity");
AbstractC7780t.f(str, "redirectUrl");
AbstractC7780t.f(webView, "webView");
AbstractC7780t.f(lVar, "authorizeCallback");
this.f7481a = activity;
this.f7482b = str;
this.f7483c = webView;
this.f7484d = lVar;
}
private final void f() {
this.f7484d.h(new M6.b(new t()));
}
private final boolean g(WebView webView, String str) {
boolean D8;
boolean D9;
String lowerCase = str.toLowerCase(Locale.ROOT);
AbstractC7780t.e(lowerCase, "toLowerCase(...)");
D8 = w.D(lowerCase, "urn:http-auth:PKeyAuth", false, 2, null);
if (!D8) {
D9 = w.D(lowerCase, this.f7482b, false, 2, null);
return D9 ? m(webView, str) : i(webView, str);
}
try {
k(str);
return true;
} catch (a e9) {
String message = e9.getMessage();
if (message == null) {
message = "!";
}
n(message);
webView.stopLoading();
return true;
}
}
public static final void h(ClientCertRequest clientCertRequest, d dVar, Activity activity, String str) {
AbstractC7780t.f(clientCertRequest, "$request");
AbstractC7780t.f(dVar, "this$0");
AbstractC7780t.f(activity, EPlQ.JndIVt);
if (str == null) {
clientCertRequest.cancel();
return;
}
try {
clientCertRequest.proceed(KeyChain.getPrivateKey(activity, str), KeyChain.getCertificateChain(dVar.f7481a, str));
} catch (KeyChainException | InterruptedException unused) {
clientCertRequest.cancel();
}
}
private final boolean i(WebView webView, String str) {
boolean D8;
if (AbstractC7780t.a(str, "about:blank")) {
return true;
}
D8 = w.D(str, "https://", false, 2, null);
if (D8) {
return false;
}
n("The webView was redirected to an unsafe URL.");
webView.stopLoading();
return true;
}
private final void j(b bVar) {
if (!bVar.a().useHttpAuthUsernamePassword() || bVar.d() == null) {
o(bVar);
return;
}
String[] httpAuthUsernamePassword = bVar.d().getHttpAuthUsernamePassword(bVar.b(), bVar.c());
if (httpAuthUsernamePassword == null || httpAuthUsernamePassword.length != 2) {
return;
}
String str = httpAuthUsernamePassword[0];
String str2 = httpAuthUsernamePassword[1];
AbstractC7780t.c(str);
if (str.length() > 0) {
AbstractC7780t.c(str2);
if (str2.length() > 0) {
bVar.a().proceed(str, str2);
}
}
}
private final void k(String str) {
Map g9 = f.f7452e.g(str);
final String str2 = (String) g9.get("Context");
if (str2 == null) {
throw new a("Context is empty");
}
final String str3 = (String) g9.get("Version");
if (str3 == null) {
throw new a("Version name is empty");
}
final String str4 = (String) g9.get("SubmitUrl");
if (str4 == null) {
throw new a("SubmitUrl is empty");
}
this.f7483c.stopLoading();
this.f7483c.post(new Runnable() {
@Override
public final void run() {
f.d.l(f.d.this, str4, str2, str3);
}
});
}
public static final void l(d dVar, String str, String str2, String str3) {
Map<String, String> e9;
AbstractC7780t.f(dVar, "this$0");
AbstractC7780t.f(str, "$submitUrl");
AbstractC7780t.f(str2, "$context");
AbstractC7780t.f(str3, "$version");
WebView webView = dVar.f7483c;
e9 = Q.e(AbstractC6736y.a("Authorization", "PKeyAuth Context=\"" + str2 + "\",Version=\"" + str3 + '\"'));
webView.loadUrl(str, e9);
}
private final void n(String str) {
this.f7484d.h(new M6.b(new o(str)));
}
private final void o(final b bVar) {
View inflate = LayoutInflater.from(this.f7481a).inflate(this.f7481a.getResources().getLayout(E.f56027a), (ViewGroup) null);
final EditText editText = (EditText) inflate.findViewById(AbstractC7557C.f55894U1);
final EditText editText2 = (EditText) inflate.findViewById(AbstractC7557C.f55916b1);
new AlertDialog.Builder(this.f7481a).setTitle("OneDrive credentials").setView(inflate).setPositiveButton(F.f56333d4, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i9) {
f.d.p(f.d.b.this, editText, editText2, dialogInterface, i9);
}
}).setNegativeButton(F.f56181N, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i9) {
f.d.q(f.d.b.this, this, dialogInterface, i9);
}
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
f.d.r(f.d.b.this, this, dialogInterface);
}
}).create().show();
}
public static final void p(b bVar, EditText editText, EditText editText2, DialogInterface dialogInterface, int i9) {
AbstractC7780t.f(bVar, "$ntlmChallenge");
bVar.a().proceed(editText.getText().toString(), editText2.getText().toString());
}
public static final void q(b bVar, d dVar, DialogInterface dialogInterface, int i9) {
AbstractC7780t.f(bVar, "$ntlmChallenge");
AbstractC7780t.f(dVar, "this$0");
bVar.a().cancel();
dVar.f();
}
public static final void r(b bVar, d dVar, DialogInterface dialogInterface) {
AbstractC7780t.f(bVar, "$ntlmChallenge");
AbstractC7780t.f(dVar, "this$0");
bVar.a().cancel();
dVar.f();
}
public final boolean m(WebView webView, String str) {
boolean u9;
AbstractC7780t.f(webView, "view");
AbstractC7780t.f(str, "url");
webView.stopLoading();
Uri parse = Uri.parse(str);
String queryParameter = parse.getQueryParameter("error");
if (queryParameter != null) {
u9 = w.u(queryParameter);
if (!u9) {
String queryParameter2 = parse.getQueryParameter("error_description");
if (queryParameter2 == null && (queryParameter2 = parse.getQueryParameter("error_subcode")) == null) {
queryParameter2 = "Error";
}
n(queryParameter2);
return true;
}
}
this.f7484d.h(f.f7452e.h(str));
return true;
}
@Override
public void onReceivedClientCertRequest(WebView webView, final ClientCertRequest clientCertRequest) {
boolean I8;
AbstractC7780t.f(webView, "view");
AbstractC7780t.f(clientCertRequest, "request");
Principal[] principals = clientCertRequest.getPrincipals();
if (principals != null) {
Iterator a9 = AbstractC7763c.a(principals);
while (a9.hasNext()) {
String name = ((Principal) a9.next()).getName();
AbstractC7780t.e(name, "getName(...)");
I8 = x.I(name, "CN=MS-Organization-Access", false, 2, null);
if (I8) {
clientCertRequest.cancel();
return;
}
}
}
final Activity activity = this.f7481a;
KeyChain.choosePrivateKeyAlias(activity, new KeyChainAliasCallback() {
@Override
public final void alias(String str) {
f.d.h(clientCertRequest, this, activity, str);
}
}, clientCertRequest.getKeyTypes(), clientCertRequest.getPrincipals(), clientCertRequest.getHost(), clientCertRequest.getPort(), null);
}
@Override
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
AbstractC7780t.f(webView, "wv");
AbstractC7780t.f(webResourceRequest, "request");
AbstractC7780t.f(webResourceError, "error");
if (webResourceRequest.isForMainFrame()) {
n(webResourceError.getDescription().toString());
}
}
@Override
public void onReceivedHttpAuthRequest(WebView webView, HttpAuthHandler httpAuthHandler, String str, String str2) {
AbstractC7780t.f(webView, "view");
AbstractC7780t.f(httpAuthHandler, "handler");
AbstractC7780t.f(str, "host");
AbstractC7780t.f(str2, "realm");
j(new b(webView, httpAuthHandler, str, str2));
}
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
AbstractC7780t.f(webView, "view");
AbstractC7780t.f(sslErrorHandler, ysONN.oTHvRsDFsKgTT);
AbstractC7780t.f(sslError, "error");
super.onReceivedSslError(webView, sslErrorHandler, sslError);
sslErrorHandler.cancel();
String sslError2 = sslError.toString();
AbstractC7780t.e(sslError2, "toString(...)");
n(sslError2);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
AbstractC7780t.f(webView, "view");
AbstractC7780t.f(str, "url");
return g(webView, str);
}
}
public static final class e {
private e() {
}
public e(AbstractC7771k abstractC7771k) {
this();
}
private final M6.b e(String str) {
return new M6.b(str == null ? new t() : new o(str));
}
public final String f(String str, b bVar) {
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append("/authorize?");
X7.b O8 = t6.k.O();
O8.a();
sb.append(i(new JSONObject(O8.b(b.Companion.serializer(), bVar))));
return sb.toString();
}
public final Map g(String str) {
Uri parse = Uri.parse(str);
Map j9 = j(parse.getFragment());
if (!(!j9.isEmpty())) {
j9 = null;
}
return j9 == null ? j(parse.getEncodedQuery()) : j9;
}
public final M6.a h(String str) {
Map g9 = (str == null || str.length() == 0) ? null : g(str);
return (g9 == null || g9.isEmpty()) ? e("The authorization server returned an invalid response.") : g9.containsKey("code") ? k(g9) : g9.containsKey("error") ? e((String) g9.get("error_description")) : e("The authorization server returned an invalid response.");
}
public final String i(JSONObject jSONObject) {
StringBuilder sb = new StringBuilder();
Iterator<String> keys = jSONObject.keys();
AbstractC7780t.e(keys, "keys(...)");
while (keys.hasNext()) {
String next = keys.next();
Object opt = jSONObject.opt(next);
if (opt != null) {
AbstractC7780t.c(opt);
String obj = opt.toString();
if (obj.length() > 0) {
if (sb.length() > 0) {
sb.append('&');
}
F7.t.h(sb, Uri.encode(next), '=', Uri.encode(obj));
}
}
}
String sb2 = sb.toString();
AbstractC7780t.e(sb2, "run(...)");
return sb2;
}
private final Map j(String str) {
Map h9;
boolean u9;
List s02;
CharSequence M02;
boolean u10;
String str2;
CharSequence M03;
if (str != null) {
u9 = w.u(str);
if (!u9) {
HashMap hashMap = new HashMap();
StringTokenizer stringTokenizer = new StringTokenizer(str, "&");
while (stringTokenizer.hasMoreTokens()) {
String nextToken = stringTokenizer.nextToken();
AbstractC7780t.e(nextToken, "nextToken(...)");
s02 = x.s0(nextToken, new char[]{'='}, false, 2, 2, null);
M02 = x.M0((String) s02.get(0));
String decode = Uri.decode(M02.toString());
if (decode != null) {
u10 = w.u(decode);
if (!u10) {
AbstractC7780t.c(decode);
if (s02.size() == 2) {
M03 = x.M0((String) s02.get(1));
str2 = Uri.decode(M03.toString());
} else {
str2 = yBiTelOWBwmsB.YYpiUNZaaOAD;
}
AbstractC7780t.c(str2);
hashMap.put(decode, str2);
}
}
}
return hashMap;
}
}
h9 = S.h();
return h9;
}
private final M6.a k(Map map) {
String str = (String) map.get("code");
return (str == null || str.length() == 0) ? e("No code") : new M6.c(str);
}
}
public static final class C0219f {
public static final b Companion = new b(null);
private final String f7489a;
private final String f7490b;
private final String f7491c;
private String f7492d;
private String f7493e;
private String f7494f;
public static final class a implements C {
public static final a f7495a;
private static final C1528a0 f7496b;
static {
a aVar = new a();
f7495a = aVar;
C1528a0 c1528a0 = new C1528a0("com.lonelycatgames.Xplore.clouds.one_drive.AzureTokenRetriever.TokenRequest1", aVar, 6);
c1528a0.n("grant_type", false);
c1528a0.n("client_id", false);
c1528a0.n("redirect_uri", false);
c1528a0.n("code", true);
c1528a0.n("code_verifier", true);
c1528a0.n("refresh_token", true);
f7496b = c1528a0;
}
private a() {
}
@Override
public U7.f a() {
return f7496b;
}
@Override
public S7.b[] b() {
return C.a.a(this);
}
@Override
public S7.b[] d() {
n0 n0Var = n0.f13238a;
int i9 = 1 >> 2;
return new S7.b[]{n0Var, n0Var, n0Var, T7.a.p(n0Var), T7.a.p(n0Var), T7.a.p(n0Var)};
}
@Override
public C0219f e(V7.e eVar) {
int i9;
String str;
String str2;
String str3;
String str4;
String str5;
String str6;
AbstractC7780t.f(eVar, "decoder");
U7.f a9 = a();
V7.c c9 = eVar.c(a9);
String str7 = null;
if (c9.x()) {
String m9 = c9.m(a9, 0);
String m10 = c9.m(a9, 1);
String m11 = c9.m(a9, 2);
n0 n0Var = n0.f13238a;
String str8 = (String) c9.e(a9, 3, n0Var, null);
String str9 = (String) c9.e(a9, 4, n0Var, null);
str = m9;
str6 = (String) c9.e(a9, 5, n0Var, null);
str4 = str8;
str5 = str9;
str3 = m11;
str2 = m10;
i9 = 63;
} else {
boolean z8 = true;
int i10 = 0;
String str10 = null;
String str11 = null;
String str12 = null;
String str13 = null;
String str14 = null;
while (z8) {
int v8 = c9.v(a9);
switch (v8) {
case -1:
z8 = false;
case 0:
str7 = c9.m(a9, 0);
i10 |= 1;
case 1:
str10 = c9.m(a9, 1);
i10 |= 2;
case 2:
str11 = c9.m(a9, 2);
i10 |= 4;
case 3:
str12 = (String) c9.e(a9, 3, n0.f13238a, str12);
i10 |= 8;
case 4:
str13 = (String) c9.e(a9, 4, n0.f13238a, str13);
i10 |= 16;
case 5:
str14 = (String) c9.e(a9, 5, n0.f13238a, str14);
i10 |= 32;
default:
throw new S7.k(v8);
}
}
i9 = i10;
str = str7;
str2 = str10;
str3 = str11;
str4 = str12;
str5 = str13;
str6 = str14;
}
c9.b(a9);
return new C0219f(i9, str, str2, str3, str4, str5, str6, null);
}
@Override
public void c(V7.f fVar, C0219f c0219f) {
AbstractC7780t.f(fVar, "encoder");
AbstractC7780t.f(c0219f, "value");
U7.f a9 = a();
V7.d c9 = fVar.c(a9);
C0219f.d(c0219f, c9, a9);
c9.b(a9);
}
}
public static final class b {
private b() {
}
public b(AbstractC7771k abstractC7771k) {
this();
}
public final S7.b serializer() {
return a.f7495a;
}
}
public C0219f(int i9, String str, String str2, String str3, String str4, String str5, String str6, j0 j0Var) {
if (7 != (i9 & 7)) {
Z.a(i9, 7, a.f7495a.a());
}
this.f7489a = str;
this.f7490b = str2;
this.f7491c = str3;
if ((i9 & 8) == 0) {
this.f7492d = null;
} else {
this.f7492d = str4;
}
if ((i9 & 16) == 0) {
this.f7493e = null;
} else {
this.f7493e = str5;
}
if ((i9 & 32) == 0) {
this.f7494f = null;
} else {
this.f7494f = str6;
}
}
public C0219f(String str, String str2, String str3) {
AbstractC7780t.f(str, "grant_type");
AbstractC7780t.f(str2, "client_id");
AbstractC7780t.f(str3, "redirect_uri");
this.f7489a = str;
this.f7490b = str2;
this.f7491c = str3;
}
public static final void d(C0219f c0219f, V7.d dVar, U7.f fVar) {
dVar.v(fVar, 0, c0219f.f7489a);
dVar.v(fVar, 1, c0219f.f7490b);
dVar.v(fVar, 2, c0219f.f7491c);
if (dVar.C(fVar, 3) || c0219f.f7492d != null) {
dVar.r(fVar, 3, n0.f13238a, c0219f.f7492d);
}
if (dVar.C(fVar, 4) || c0219f.f7493e != null) {
dVar.r(fVar, 4, n0.f13238a, c0219f.f7493e);
}
if (!dVar.C(fVar, 5) && c0219f.f7494f == null) {
return;
}
dVar.r(fVar, 5, n0.f13238a, c0219f.f7494f);
}
public final void a(String str) {
this.f7492d = str;
}
public final void b(String str) {
this.f7493e = str;
}
public final void c(String str) {
this.f7494f = str;
}
}
static final class g extends AbstractC7781u implements v7.l {
final v7.l f7497b;
g(v7.l lVar) {
super(1);
this.f7497b = lVar;
}
public final void a(M6.a aVar) {
AbstractC7780t.f(aVar, "it");
this.f7497b.h(aVar);
}
@Override
public Object h(Object obj) {
a((M6.a) obj);
return C6709J.f49946a;
}
}
public f(String str, String str2) {
AbstractC7780t.f(str, "redirectUrl");
AbstractC7780t.f(str2, "clientId");
this.f7455a = str;
this.f7456b = str2;
}
public static String b(f fVar, List list, String str, int i9, Object obj) {
if ((i9 & 2) != 0) {
str = null;
}
return fVar.a(list, str);
}
private final void c() {
Uri parse;
M6.d dVar = M6.d.f7448a;
a aVar = f7454g;
String b9 = dVar.b(new URL(aVar.a()));
if (b9 == null) {
parse = Uri.parse(aVar.a());
} else {
parse = Uri.parse("https://" + b9);
}
String uri = parse.buildUpon().appendPath(aVar.b()).appendEncodedPath("oAuth2/v2.0").build().toString();
AbstractC7780t.e(uri, "toString(...)");
this.f7457c = uri;
}
private final r f(C0219f c0219f) {
e eVar = f7452e;
X7.b O8 = t6.k.O();
O8.a();
String i9 = eVar.i(new JSONObject(O8.b(C0219f.Companion.serializer(), c0219f)));
StringBuilder sb = new StringBuilder();
String str = this.f7457c;
if (str == null) {
AbstractC7780t.r("oauthUrl");
str = null;
}
sb.append(str);
sb.append("/token");
String sb2 = sb.toString();
byte[] bytes = i9.getBytes(C1160d.f4033b);
AbstractC7780t.e(bytes, "getBytes(...)");
l.b b9 = new l(sb2, "POST", bytes, "application/x-www-form-urlencoded").b();
String a9 = b9.a();
if (b9.b() >= 300) {
X7.b N8 = t6.k.N();
N8.a();
return (r) N8.c(p.Companion.serializer(), a9);
}
X7.b N9 = t6.k.N();
N9.a();
return (r) N9.c(q.Companion.serializer(), a9);
}
public final String a(List list, String str) {
List n9;
List m02;
String c02;
AbstractC7780t.f(list, "scopes");
c();
n9 = AbstractC6843u.n("openid", "profile", "offline_access");
m02 = AbstractC6821C.m0(n9, list);
b bVar = new b();
bVar.b(this.f7456b);
bVar.f(this.f7455a);
c02 = AbstractC6821C.c0(m02, " ", null, null, 0, null, null, 62, null);
bVar.g(c02);
bVar.d(str);
bVar.e("select_account");
this.f7458d = bVar.a();
e eVar = f7452e;
String str2 = this.f7457c;
if (str2 == null) {
AbstractC7780t.r("oauthUrl");
str2 = null;
}
return eVar.f(str2, bVar);
}
public final r d(M6.c cVar) {
AbstractC7780t.f(cVar, "auth");
C0219f c0219f = new C0219f("authorization_code", this.f7456b, this.f7455a);
String str = this.f7458d;
if (str == null) {
AbstractC7780t.r("codeVerifier");
str = null;
}
c0219f.b(str);
c0219f.a(cVar.a());
return f(c0219f);
}
public final r e(String str) {
AbstractC7780t.f(str, "refreshToken");
c();
C0219f c0219f = new C0219f("refresh_token", this.f7456b, this.f7455a);
c0219f.c(str);
return f(c0219f);
}
public final void g(Activity activity, WebView webView, String str, v7.l lVar) {
AbstractC7780t.f(activity, "activity");
AbstractC7780t.f(webView, "webView");
AbstractC7780t.f(str, "url");
AbstractC7780t.f(lVar, "authCb");
WebSettings settings = webView.getSettings();
settings.setUserAgentString(settings.getUserAgentString() + " PKeyAuth/1.0");
settings.setJavaScriptEnabled(true);
settings.setMixedContentMode(0);
webView.setWebViewClient(new d(activity, this.f7455a, webView, new g(lVar)));
webView.loadUrl(str);
}
}