package n40; import android.content.Context; import android.content.Intent; import android.net.Uri; import java.util.Locale; import jp.naver.line.android.urlscheme.SchemeServiceReferrer; import zj3.c; import zj3.d; public class j { /* renamed from: a reason: collision with root package name */ public static final String[] f115891a = {"http://line.naver.jp/", "https://line.naver.jp/", "http://line.me/", "https://line.me/", "https://works.do/R/", "http://webpos.line.me/", "https://webpos.line.me/", "https://qrcodepay.line.me/", "https://dpos-pay.line.me"}; /* renamed from: b reason: collision with root package name */ public static final String[] f115892b = {"https://www.mobike.com/download/app.html", "http://www.mobike.com/download/app.html"}; public static class a extends Exception { private static final long serialVersionUID = 1; public a(String str) { super(str); } } public static int a(Context context, String str, int i14, boolean z14, boolean z15) throws a { boolean z16; if (str == null) { return 5; } String replaceFirst = str.replaceFirst("^https://works\\.do/R/ti/p/", "https://line.me/R/ti/p/"); if (c.f199559a.j(replaceFirst, i14)) { return 6; } Uri parse = Uri.parse(replaceFirst); d dVar = d.f199582a; boolean z17 = true; if (dVar.b(parse)) { if (z14) { return 1; } try { if (dVar.c(context, parse, SchemeServiceReferrer.QRCodeReader.f98257c).b()) { return 1; } return 5; } catch (zj3.a unused) { } } else if (b(replaceFirst, f115891a)) { context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(replaceFirst))); return 1; } else if (b(replaceFirst, f115892b)) { return 3; } else { String[] strArr = {"http://", "https://", "rtsp://"}; int i15 = 0; while (true) { if (i15 >= 3) { z16 = false; break; } if (replaceFirst.toLowerCase().startsWith(strArr[i15])) { z16 = true; break; } i15++; } if (z16) { return 2; } String[] strArr2 = {"sms:", "smsto:"}; int i16 = 0; while (true) { if (i16 >= 2) { z17 = false; break; } if (replaceFirst.toLowerCase(Locale.US).startsWith(strArr2[i16])) { break; } i16++; } if (z17 && z15) { return 4; } throw new a(a1.a.a("url = ", replaceFirst)); } } public static boolean b(String str, String[] strArr) { for (String str2 : strArr) { if (str.toLowerCase().startsWith(str2)) { return true; } } return false; } }