CheetahGram v8.5.4版本的 MD5 值为:3d14e79cc242c314d3933620ff3ab030
以下内容为反编译后的 w6.java 源代码,内容仅作参考
package org.telegram.ui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.InputFilter;
import android.text.SpannableStringBuilder;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.util.Base64;
import android.util.Property;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.content.FileProvider;
import co.cheetah.gram.R;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import javax.crypto.Cipher;
import org.json.JSONArray;
import org.json.JSONObject;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.DispatchQueue;
import org.telegram.messenger.DownloadController;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLoader;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MrzRecognizer;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.SRPHelper;
import org.telegram.messenger.SecureDocument;
import org.telegram.messenger.SecureDocumentKey;
import org.telegram.messenger.SendMessagesHelper;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.p110.ad5;
import org.telegram.messenger.p110.ah5;
import org.telegram.messenger.p110.aq6;
import org.telegram.messenger.p110.ax5;
import org.telegram.messenger.p110.bd5;
import org.telegram.messenger.p110.bk6;
import org.telegram.messenger.p110.bq6;
import org.telegram.messenger.p110.cd5;
import org.telegram.messenger.p110.cg5;
import org.telegram.messenger.p110.ch5;
import org.telegram.messenger.p110.cq6;
import org.telegram.messenger.p110.cs1;
import org.telegram.messenger.p110.dd5;
import org.telegram.messenger.p110.dq6;
import org.telegram.messenger.p110.e26;
import org.telegram.messenger.p110.e77;
import org.telegram.messenger.p110.ed5;
import org.telegram.messenger.p110.ek7;
import org.telegram.messenger.p110.eq6;
import org.telegram.messenger.p110.ey5;
import org.telegram.messenger.p110.f27;
import org.telegram.messenger.p110.fh5;
import org.telegram.messenger.p110.fq6;
import org.telegram.messenger.p110.g26;
import org.telegram.messenger.p110.g52;
import org.telegram.messenger.p110.gq6;
import org.telegram.messenger.p110.h26;
import org.telegram.messenger.p110.hc5;
import org.telegram.messenger.p110.hh5;
import org.telegram.messenger.p110.hq6;
import org.telegram.messenger.p110.i77;
import org.telegram.messenger.p110.i95;
import org.telegram.messenger.p110.ib5;
import org.telegram.messenger.p110.ie5;
import org.telegram.messenger.p110.ih5;
import org.telegram.messenger.p110.iq6;
import org.telegram.messenger.p110.iv4;
import org.telegram.messenger.p110.ix5;
import org.telegram.messenger.p110.j27;
import org.telegram.messenger.p110.je5;
import org.telegram.messenger.p110.jg5;
import org.telegram.messenger.p110.jq6;
import org.telegram.messenger.p110.kd5;
import org.telegram.messenger.p110.kf5;
import org.telegram.messenger.p110.kg5;
import org.telegram.messenger.p110.kq6;
import org.telegram.messenger.p110.ld5;
import org.telegram.messenger.p110.lh5;
import org.telegram.messenger.p110.lq6;
import org.telegram.messenger.p110.mq6;
import org.telegram.messenger.p110.ne4;
import org.telegram.messenger.p110.nh5;
import org.telegram.messenger.p110.nq6;
import org.telegram.messenger.p110.o87;
import org.telegram.messenger.p110.oa5;
import org.telegram.messenger.p110.oh5;
import org.telegram.messenger.p110.ok;
import org.telegram.messenger.p110.op6;
import org.telegram.messenger.p110.oq6;
import org.telegram.messenger.p110.ov5;
import org.telegram.messenger.p110.pf5;
import org.telegram.messenger.p110.pg0;
import org.telegram.messenger.p110.pp6;
import org.telegram.messenger.p110.pq6;
import org.telegram.messenger.p110.py5;
import org.telegram.messenger.p110.pz4;
import org.telegram.messenger.p110.q60;
import org.telegram.messenger.p110.qc5;
import org.telegram.messenger.p110.qf5;
import org.telegram.messenger.p110.qh5;
import org.telegram.messenger.p110.qp6;
import org.telegram.messenger.p110.qq6;
import org.telegram.messenger.p110.rf5;
import org.telegram.messenger.p110.rp0;
import org.telegram.messenger.p110.rq6;
import org.telegram.messenger.p110.rr1;
import org.telegram.messenger.p110.sp6;
import org.telegram.messenger.p110.sq6;
import org.telegram.messenger.p110.t51;
import org.telegram.messenger.p110.te5;
import org.telegram.messenger.p110.tp6;
import org.telegram.messenger.p110.tq6;
import org.telegram.messenger.p110.u27;
import org.telegram.messenger.p110.ue5;
import org.telegram.messenger.p110.up6;
import org.telegram.messenger.p110.uq6;
import org.telegram.messenger.p110.ur;
import org.telegram.messenger.p110.uw3;
import org.telegram.messenger.p110.v27;
import org.telegram.messenger.p110.ve5;
import org.telegram.messenger.p110.vo;
import org.telegram.messenger.p110.vp6;
import org.telegram.messenger.p110.vq5;
import org.telegram.messenger.p110.vq6;
import org.telegram.messenger.p110.wg5;
import org.telegram.messenger.p110.wp6;
import org.telegram.messenger.p110.wq6;
import org.telegram.messenger.p110.xd5;
import org.telegram.messenger.p110.xp6;
import org.telegram.messenger.p110.xq6;
import org.telegram.messenger.p110.yp6;
import org.telegram.messenger.p110.zc5;
import org.telegram.messenger.p110.zd5;
import org.telegram.messenger.p110.zg5;
import org.telegram.messenger.p110.zp6;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.ui.ActionBar.a;
import org.telegram.ui.ActionBar.a0;
import org.telegram.ui.ActionBar.i;
import org.telegram.ui.Components.ChatAttachAlert;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.b;
import org.telegram.ui.PhotoViewer;
import org.telegram.ui.c0;
import org.telegram.ui.l3;
import org.telegram.ui.w6;
import uk.co.chrisjenx.calligraphy.BuildConfig;
public class w6 extends org.telegram.ui.ActionBar.k implements NotificationCenter.NotificationCenterDelegate {
private String A;
private i77 A0;
private HashMap<xp6, g0> A1;
private String B;
private o87 B0;
private HashMap<xp6, xp6> B1;
private int C0;
private HashMap<String, String> C1;
private boolean[] D0;
private HashMap<String, String> D1;
private boolean E0;
private HashMap<String, HashMap<String, String>> E1;
private boolean F0;
private HashMap<String, String> F1;
private int[] G;
private TextView G0;
private HashMap<String, String> G1;
private ld5 H;
private o87 H0;
private HashMap<String, String> H1;
private xp6 I;
private o87 I0;
private HashMap<String, String> I1;
private xp6 J;
private iv4 J0;
private CharSequence J1;
private LinearLayout K0;
private CharSequence K1;
private ImageView L0;
private c0 L1;
private TextView M0;
private boolean M1;
private TextView N0;
private PhotoViewer.d2 N1;
private TextView O0;
private String O1;
private t51 P0;
private Runnable P1;
private ArrayList<xp6> Q;
private i77 Q0;
private a0 Q1;
private aq6 R;
private i77 R0;
private c0 R1;
private aq6 S;
private ImageView S0;
private int S1;
private te5 T;
private TextView T0;
private pz4[] T1;
private lh5 U;
private TextView U0;
private org.telegram.ui.ActionBar.i U1;
private org.telegram.ui.ActionBar.d V;
private FrameLayout V0;
private Dialog V1;
private AnimatorSet W;
private TextView W0;
private ArrayList<String> W1;
private rp0 X;
private int X0;
private TextView Y;
private byte[] Y0;
private rp0 Z;
private byte[] Z0;
private FrameLayout a0;
private String a1;
private o87 b0;
private ChatAttachAlert b1;
private View c0;
private int c1;
private View d0;
private int d1;
private e77 e0;
private ArrayList<String> e1;
private e77 f0;
private HashMap<String, String> f1;
private e77 g0;
private HashMap<String, String> g1;
private o87 h0;
private HashMap<String, String> h1;
private EditTextBoldCursor[] i0;
private HashMap<String, String> i1;
private ViewGroup[] j0;
private boolean j1;
private EditTextBoldCursor[] k0;
private boolean k1;
private ScrollView l0;
private long l1;
private LinearLayout m0;
private byte[] m1;
private LinearLayout n0;
private String n1;
private LinearLayout o0;
private byte[] o1;
private LinearLayout p0;
private boolean p1;
private String q;
private LinearLayout q0;
private boolean q1;
private int r;
private LinearLayout r0;
private w6 r1;
private long s;
private LinearLayout s0;
private ArrayList<SecureDocument> s1;
private String t;
private rr1 t0;
private SecureDocument t1;
private String u;
private ArrayList<View> u0;
private ArrayList<SecureDocument> u1;
private boolean v;
private iv4 v0;
private SecureDocument v1;
private String w;
private iv4 w0;
private SecureDocument w1;
private String x;
private i77 x0;
private HashMap<SecureDocument, f0> x1;
private String y;
private i77 y0;
private HashMap<String, SecureDocument> y1;
private String z;
private i77 z0;
private HashMap<xp6, HashMap<String, String>> z1;
public class a implements TextWatcher {
private int a = -1;
private int b;
a() {
}
@Override
public void afterTextChanged(Editable editable) {
int i;
int i2;
if (w6.this.k1) {
return;
}
cs1 cs1Var = (cs1) w6.this.i0[2];
int selectionStart = cs1Var.getSelectionStart();
String obj = cs1Var.getText().toString();
if (this.a == 3) {
obj = obj.substring(0, this.b) + obj.substring(this.b + 1);
selectionStart--;
}
StringBuilder sb = new StringBuilder(obj.length());
int i3 = 0;
while (i3 < obj.length()) {
int i4 = i3 + 1;
String substring = obj.substring(i3, i4);
if ("0123456789".contains(substring)) {
sb.append(substring);
}
i3 = i4;
}
w6.this.k1 = true;
String hintText = cs1Var.getHintText();
if (hintText != null) {
int i5 = 0;
while (true) {
if (i5 >= sb.length()) {
break;
}
if (i5 < hintText.length()) {
if (hintText.charAt(i5) == ' ') {
sb.insert(i5, ' ');
i5++;
if (selectionStart == i5 && (i2 = this.a) != 2 && i2 != 3) {
selectionStart++;
}
}
i5++;
} else {
sb.insert(i5, ' ');
if (selectionStart == i5 + 1 && (i = this.a) != 2 && i != 3) {
selectionStart++;
}
}
}
}
cs1Var.setText(sb);
if (selectionStart >= 0) {
cs1Var.setSelection(Math.min(selectionStart, cs1Var.length()));
}
cs1Var.K();
w6.this.k1 = false;
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
int i4;
if (i2 == 0 && i3 == 1) {
this.a = 1;
return;
}
if (i2 != 1 || i3 != 0) {
i4 = -1;
} else {
if (charSequence.charAt(i) == ' ' && i > 0) {
this.a = 3;
this.b = i - 1;
return;
}
i4 = 2;
}
this.a = i4;
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
public interface a0 {
void a(String str, String str2);
}
public class b extends FrameLayout {
private StaticLayout a;
float b;
final EditTextBoldCursor c;
b(w6 w6Var, Context context, EditTextBoldCursor editTextBoldCursor) {
super(context);
this.c = editTextBoldCursor;
}
@Override
protected void onDraw(Canvas canvas) {
if (this.a != null) {
canvas.save();
canvas.translate(AndroidUtilities.dp(21.0f) + this.b, this.c.getLineY() + AndroidUtilities.dp(3.0f));
this.a.draw(canvas);
canvas.restore();
}
}
@Override
protected void onMeasure(int i, int i2) {
int size = View.MeasureSpec.getSize(i) - AndroidUtilities.dp(34.0f);
StaticLayout B = this.c.B(size);
this.a = B;
if (B != null) {
int lineCount = B.getLineCount();
int i3 = 0;
if (lineCount > 1) {
i2 = View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + (this.a.getLineBottom(lineCount - 1) - this.a.getLineBottom(0)), 1073741824);
}
if (LocaleController.isRTL) {
float f = 0.0f;
while (true) {
if (i3 >= lineCount) {
break;
}
if (this.a.getLineLeft(i3) != 0.0f) {
this.b = 0.0f;
break;
}
f = Math.max(f, this.a.getLineWidth(i3));
if (i3 == lineCount - 1) {
this.b = size - f;
}
i3++;
}
}
}
super.onMeasure(i, i2);
}
}
public class b0 extends ClickableSpan {
public b0() {
}
@Override
public void onClick(View view) {
ok.w(w6.this.c0(), w6.this.H.f);
}
@Override
public void updateDrawState(TextPaint textPaint) {
super.updateDrawState(textPaint);
textPaint.setUnderlineText(true);
textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
}
}
public class c implements TextWatcher {
private boolean a;
final EditTextBoldCursor b;
final String c;
c(EditTextBoldCursor editTextBoldCursor, String str) {
this.b = editTextBoldCursor;
this.c = str;
}
@Override
public void afterTextChanged(Editable editable) {
if (this.a) {
return;
}
boolean z = true;
this.a = true;
int i = 0;
while (true) {
if (i >= editable.length()) {
z = false;
break;
}
char charAt = editable.charAt(i);
if ((charAt < 'a' || charAt > 'z') && ((charAt < 'A' || charAt > 'Z') && !((charAt >= '0' && charAt <= '9') || charAt == '-' || charAt == ' '))) {
break;
} else {
i++;
}
}
this.a = false;
if (z) {
this.b.setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
} else {
w6.this.L5(this.b, this.c, editable, false);
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
public interface c0 {
void a(xp6 xp6Var, String str, String str2, xp6 xp6Var2, String str3, ArrayList<SecureDocument> arrayList, SecureDocument secureDocument, ArrayList<SecureDocument> arrayList2, SecureDocument secureDocument2, SecureDocument secureDocument3, Runnable runnable, a0 a0Var);
void b(xp6 xp6Var, xp6 xp6Var2, ArrayList<xp6> arrayList, boolean z, Runnable runnable, a0 a0Var);
SecureDocument c(qp6 qp6Var);
}
public class d implements TextWatcher {
final EditTextBoldCursor a;
final String b;
d(EditTextBoldCursor editTextBoldCursor, String str) {
this.a = editTextBoldCursor;
this.b = str;
}
@Override
public void afterTextChanged(Editable editable) {
w6.this.L5(this.a, this.b, editable, false);
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
public class d0 extends pz4 implements NotificationCenter.NotificationCenterDelegate {
private int A;
private String a;
private String b;
private LinearLayout c;
private EditTextBoldCursor[] d;
private TextView e;
private TextView f;
private ImageView g;
private ImageView h;
private TextView i;
private TextView j;
private e0 k;
private Timer l;
private Timer m;
private final Object n;
private int o;
private int p;
private double q;
private double r;
private boolean s;
private boolean t;
private boolean u;
private String v;
private int w;
private int x;
private String y;
private int z;
class a extends TextView {
a(d0 d0Var, Context context, w6 w6Var) {
super(context);
}
@Override
protected void onMeasure(int i, int i2) {
super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
}
class b extends TextView {
b(d0 d0Var, Context context, w6 w6Var) {
super(context);
}
@Override
protected void onMeasure(int i, int i2) {
super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
}
}
class c implements TextWatcher {
final int a;
c(int i) {
this.a = i;
}
@Override
public void afterTextChanged(Editable editable) {
int length;
if (!d0.this.s && (length = editable.length()) >= 1) {
if (length > 1) {
String obj = editable.toString();
d0.this.s = true;
for (int i = 0; i < Math.min(d0.this.z - this.a, length); i++) {
if (i == 0) {
editable.replace(0, length, obj.substring(i, i + 1));
} else {
d0.this.d[this.a + i].setText(obj.substring(i, i + 1));
}
}
d0.this.s = false;
}
if (this.a != d0.this.z - 1) {
d0.this.d[this.a + 1].setSelection(d0.this.d[this.a + 1].length());
d0.this.d[this.a + 1].requestFocus();
}
if ((this.a == d0.this.z - 1 || (this.a == d0.this.z - 2 && length >= 2)) && d0.this.getCode().length() == d0.this.z) {
d0.this.f(null);
}
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
public class d extends TimerTask {
d() {
}
public void b() {
double currentTimeMillis = System.currentTimeMillis();
double d = d0.this.r;
Double.isNaN(currentTimeMillis);
d0.this.r = currentTimeMillis;
d0.x(d0.this, currentTimeMillis - d);
if (d0.this.p <= 1000) {
d0.this.j.setVisibility(0);
d0.this.i.setVisibility(8);
d0.this.a0();
}
}
@Override
public void run() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.d0.d.this.b();
}
});
}
}
public class e extends TimerTask {
e() {
}
public void d(ov5 ov5Var) {
d0.this.v = ov5Var.b;
}
public void e(i95 i95Var, final ov5 ov5Var) {
if (ov5Var == null || ov5Var.b == null) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.d0.e.this.d(ov5Var);
}
});
}
public void f() {
TextView textView;
int i;
String str;
NotificationCenter globalInstance;
d0 d0Var;
int i2;
TextView textView2;
String formatString;
if (d0.this.o < 1000) {
if (d0.this.k != null) {
d0.this.k.a(1.0f);
}
d0.this.b0();
if (d0.this.w == 3) {
AndroidUtilities.setWaitingForCall(false);
globalInstance = NotificationCenter.getGlobalInstance();
d0Var = d0.this;
i2 = NotificationCenter.didReceiveCall;
} else {
if (d0.this.w != 2 && d0.this.w != 4) {
return;
}
if (d0.this.x == 4 || d0.this.x == 2) {
if (d0.this.x == 4) {
textView = d0.this.i;
i = R.string.Calling;
str = "Calling";
} else {
textView = d0.this.i;
i = R.string.SendingSms;
str = "SendingSms";
}
textView.setText(LocaleController.getString(str, i));
d0.this.Y();
ih5 ih5Var = new ih5();
ih5Var.a = d0.this.a;
ih5Var.b = d0.this.b;
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(ih5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.d0.e.this.e(i95Var, ov5Var);
}
}, 2);
return;
}
if (d0.this.x != 3) {
return;
}
AndroidUtilities.setWaitingForSms(false);
globalInstance = NotificationCenter.getGlobalInstance();
d0Var = d0.this;
i2 = NotificationCenter.didReceiveSmsCode;
}
globalInstance.removeObserver(d0Var, i2);
d0.this.t = false;
d0.this.a0();
d0.this.m0();
return;
}
int i3 = (d0.this.o / 1000) / 60;
int i4 = (d0.this.o / 1000) - (i3 * 60);
if (d0.this.x != 4 && d0.this.x != 3) {
if (d0.this.x == 2) {
textView2 = d0.this.i;
formatString = LocaleController.formatString("SmsText", R.string.SmsText, Integer.valueOf(i3), Integer.valueOf(i4));
}
if (d0.this.k == null) {
d0.this.k.a(1.0f - (d0.this.o / d0.this.A));
return;
}
return;
}
textView2 = d0.this.i;
formatString = LocaleController.formatString("CallText", R.string.CallText, Integer.valueOf(i3), Integer.valueOf(i4));
textView2.setText(formatString);
if (d0.this.k == null) {
}
}
@Override
public void run() {
if (d0.this.l == null) {
return;
}
double currentTimeMillis = System.currentTimeMillis();
double d = d0.this.q;
Double.isNaN(currentTimeMillis);
d0.F(d0.this, currentTimeMillis - d);
d0.this.q = currentTimeMillis;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.d0.e.this.f();
}
});
}
}
public d0(Context context, int i) {
super(context);
TextView textView;
int i2;
String str;
TextView textView2;
int i3;
String str2;
FrameLayout.LayoutParams b2;
View view;
this.n = new Object();
this.o = 60000;
this.p = 15000;
this.v = BuildConfig.FLAVOR;
this.y = "*";
this.w = i;
setOrientation(1);
TextView textView3 = new TextView(context);
this.e = textView3;
textView3.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
this.e.setTextSize(1, 14.0f);
this.e.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
TextView textView4 = new TextView(context);
this.f = textView4;
textView4.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.f.setTextSize(1, 18.0f);
this.f.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.f.setGravity(LocaleController.isRTL ? 5 : 3);
this.f.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.f.setGravity(49);
if (this.w == 3) {
this.e.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
FrameLayout frameLayout = new FrameLayout(context);
addView(frameLayout, g52.l(-2, -2, LocaleController.isRTL ? 5 : 3));
ImageView imageView = new ImageView(context);
imageView.setImageResource(org.telegram.messenger.R.drawable.phone_activate);
boolean z = LocaleController.isRTL;
if (z) {
frameLayout.addView(imageView, g52.b(64, 76.0f, 19, 2.0f, 2.0f, 0.0f, 0.0f));
View view2 = this.e;
b2 = g52.b(-1, -2.0f, LocaleController.isRTL ? 5 : 3, 82.0f, 0.0f, 0.0f, 0.0f);
view = view2;
} else {
frameLayout.addView(this.e, g52.b(-1, -2.0f, z ? 5 : 3, 0.0f, 0.0f, 82.0f, 0.0f));
b2 = g52.b(64, 76.0f, 21, 0.0f, 2.0f, 0.0f, 2.0f);
view = imageView;
}
frameLayout.addView(view, b2);
} else {
this.e.setGravity(49);
FrameLayout frameLayout2 = new FrameLayout(context);
addView(frameLayout2, g52.l(-2, -2, 49));
if (this.w == 1) {
ImageView imageView2 = new ImageView(context);
this.g = imageView2;
imageView2.setImageResource(org.telegram.messenger.R.drawable.sms_devices);
this.g.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"), PorterDuff.Mode.MULTIPLY));
frameLayout2.addView(this.g, g52.b(-2, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
ImageView imageView3 = new ImageView(context);
this.h = imageView3;
imageView3.setImageResource(org.telegram.messenger.R.drawable.sms_bubble);
this.h.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("chats_actionBackground"), PorterDuff.Mode.MULTIPLY));
frameLayout2.addView(this.h, g52.b(-2, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
textView = this.f;
i2 = R.string.SentAppCodeTitle;
str = "SentAppCodeTitle";
} else {
ImageView imageView4 = new ImageView(context);
this.h = imageView4;
imageView4.setImageResource(org.telegram.messenger.R.drawable.sms_code);
this.h.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("chats_actionBackground"), PorterDuff.Mode.MULTIPLY));
frameLayout2.addView(this.h, g52.b(-2, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
textView = this.f;
i2 = R.string.SentSmsCodeTitle;
str = "SentSmsCodeTitle";
}
textView.setText(LocaleController.getString(str, i2));
addView(this.f, g52.m(-2, -2, 49, 0, 18, 0, 0));
addView(this.e, g52.m(-2, -2, 49, 0, 17, 0, 0));
}
LinearLayout linearLayout = new LinearLayout(context);
this.c = linearLayout;
linearLayout.setOrientation(0);
addView(this.c, g52.l(-2, 36, 1));
if (this.w == 3) {
this.c.setVisibility(8);
}
a aVar = new a(this, context, w6.this);
this.i = aVar;
aVar.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
this.i.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
if (this.w == 3) {
this.i.setTextSize(1, 14.0f);
addView(this.i, g52.l(-2, -2, LocaleController.isRTL ? 5 : 3));
this.k = new e0(context);
this.i.setGravity(LocaleController.isRTL ? 5 : 3);
addView(this.k, g52.h(-1, 3, 0.0f, 12.0f, 0.0f, 0.0f));
} else {
this.i.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
this.i.setTextSize(1, 15.0f);
this.i.setGravity(49);
addView(this.i, g52.l(-2, -2, 49));
}
b bVar = new b(this, context, w6.this);
this.j = bVar;
bVar.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
this.j.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.j.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
this.j.setTextSize(1, 15.0f);
this.j.setGravity(49);
if (this.w == 1) {
textView2 = this.j;
i3 = R.string.DidNotGetTheCodeSms;
str2 = "DidNotGetTheCodeSms";
} else {
textView2 = this.j;
i3 = R.string.DidNotGetTheCode;
str2 = "DidNotGetTheCode";
}
textView2.setText(LocaleController.getString(str2, i3));
addView(this.j, g52.l(-2, -2, 49));
this.j.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
w6.d0.this.c0(view3);
}
});
}
static int F(d0 d0Var, double d2) {
double d3 = d0Var.o;
Double.isNaN(d3);
int i = (int) (d3 - d2);
d0Var.o = i;
return i;
}
public void Y() {
if (this.m != null) {
return;
}
this.p = 15000;
this.m = new Timer();
this.r = System.currentTimeMillis();
this.m.schedule(new d(), 0L, 1000L);
}
private void Z() {
if (this.l != null) {
return;
}
Timer timer = new Timer();
this.l = timer;
timer.schedule(new e(), 0L, 1000L);
}
public void a0() {
try {
synchronized (this.n) {
Timer timer = this.m;
if (timer != null) {
timer.cancel();
this.m = null;
}
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
public void b0() {
try {
synchronized (this.n) {
Timer timer = this.l;
if (timer != null) {
timer.cancel();
this.l = null;
}
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
public void c0(View view) {
if (this.u) {
return;
}
int i = this.x;
if (!((i == 4 && this.w == 2) || i == 0)) {
m0();
return;
}
try {
PackageInfo packageInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
String format = String.format(Locale.US, "%s (%d)", packageInfo.versionName, Integer.valueOf(packageInfo.versionCode));
Intent intent = new Intent("android.intent.action.SENDTO");
intent.setData(Uri.parse("mailto:"));
intent.putExtra("android.intent.extra.EMAIL", new String[]{"sms@telegram.org"});
intent.putExtra("android.intent.extra.SUBJECT", "Android registration/login issue " + format + " " + this.a);
intent.putExtra("android.intent.extra.TEXT", "Phone: " + this.a + "\nApp version: " + format + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + this.v);
getContext().startActivity(Intent.createChooser(intent, "Send email..."));
} catch (Exception unused) {
org.telegram.ui.Components.b.A4(w6.this, LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
}
}
public void d0(DialogInterface dialogInterface, int i) {
b(true);
w6.this.k8(0, true, null);
}
public static void e0(i95 i95Var, ov5 ov5Var) {
}
public void f0(ov5 ov5Var, kg5 kg5Var) {
int i;
NotificationCenter globalInstance;
int i2;
int i3;
EditTextBoldCursor[] editTextBoldCursorArr;
int i4;
w6.this.W7();
this.u = false;
if (ov5Var == null) {
b0();
a0();
c0 c0Var = w6.this.L1;
xp6 xp6Var = w6.this.I;
String str = (String) w6.this.C1.get("phone");
final w6 w6Var = w6.this;
c0Var.a(xp6Var, str, null, null, null, null, null, null, null, null, new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.D();
}
}, null);
return;
}
this.v = ov5Var.b;
int i5 = this.w;
if ((i5 == 3 && ((i4 = this.x) == 4 || i4 == 2)) || ((i5 == 2 && ((i = this.x) == 4 || i == 3)) || (i5 == 4 && this.x == 2))) {
Z();
}
int i6 = this.w;
if (i6 == 2) {
AndroidUtilities.setWaitingForSms(true);
globalInstance = NotificationCenter.getGlobalInstance();
i2 = NotificationCenter.didReceiveSmsCode;
} else {
if (i6 == 3) {
AndroidUtilities.setWaitingForCall(true);
globalInstance = NotificationCenter.getGlobalInstance();
i2 = NotificationCenter.didReceiveCall;
}
this.t = true;
if (this.w != 3) {
org.telegram.ui.Components.b.l4(((org.telegram.ui.ActionBar.k) w6.this).d, ov5Var, w6.this, kg5Var, new Object[0]);
}
w6.this.o8(true, false);
if (ov5Var.b.contains("PHONE_CODE_EMPTY") && !ov5Var.b.contains("PHONE_CODE_INVALID")) {
if (ov5Var.b.contains("PHONE_CODE_EXPIRED")) {
b(true);
w6.this.k8(0, true, null);
return;
}
return;
}
i3 = 0;
while (true) {
editTextBoldCursorArr = this.d;
if (i3 < editTextBoldCursorArr.length) {
editTextBoldCursorArr[0].requestFocus();
return;
} else {
editTextBoldCursorArr[i3].setText(BuildConfig.FLAVOR);
i3++;
}
}
}
globalInstance.addObserver(this, i2);
this.t = true;
if (this.w != 3) {
}
w6.this.o8(true, false);
if (ov5Var.b.contains("PHONE_CODE_EMPTY")) {
}
i3 = 0;
while (true) {
editTextBoldCursorArr = this.d;
if (i3 < editTextBoldCursorArr.length) {
}
editTextBoldCursorArr[i3].setText(BuildConfig.FLAVOR);
i3++;
}
}
public void g0(final kg5 kg5Var, i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.d0.this.f0(ov5Var, kg5Var);
}
});
}
public String getCode() {
if (this.d == null) {
return BuildConfig.FLAVOR;
}
StringBuilder sb = new StringBuilder();
int i = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.d;
if (i >= editTextBoldCursorArr.length) {
return sb.toString();
}
sb.append(uw3.h(editTextBoldCursorArr[i].getText().toString()));
i++;
}
}
public void h0(DialogInterface dialogInterface, int i) {
b(true);
w6.this.D();
}
public void i0(ov5 ov5Var, Bundle bundle, i95 i95Var, ih5 ih5Var) {
this.u = false;
if (ov5Var == null) {
w6.this.j6(bundle, (lh5) i95Var, true);
} else {
org.telegram.ui.ActionBar.i iVar = (org.telegram.ui.ActionBar.i) org.telegram.ui.Components.b.l4(((org.telegram.ui.ActionBar.k) w6.this).d, ov5Var, w6.this, ih5Var, new Object[0]);
if (iVar != null && ov5Var.b.contains("PHONE_CODE_EXPIRED")) {
iVar.J0(new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
w6.d0.this.h0(dialogInterface, i);
}
});
}
}
w6.this.W7();
}
public void j0(final Bundle bundle, final ih5 ih5Var, final i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.d0.this.i0(ov5Var, bundle, i95Var, ih5Var);
}
});
}
public boolean k0(int i, View view, int i2, KeyEvent keyEvent) {
if (i2 != 67 || this.d[i].length() != 0 || i <= 0) {
return false;
}
EditTextBoldCursor[] editTextBoldCursorArr = this.d;
int i3 = i - 1;
editTextBoldCursorArr[i3].setSelection(editTextBoldCursorArr[i3].length());
this.d[i3].requestFocus();
this.d[i3].dispatchKeyEvent(keyEvent);
return true;
}
public boolean l0(TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
f(null);
return true;
}
public void m0() {
final Bundle bundle = new Bundle();
bundle.putString("phone", this.a);
this.u = true;
w6.this.X7();
final ih5 ih5Var = new ih5();
ih5Var.a = this.a;
ih5Var.b = this.b;
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(ih5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.d0.this.j0(bundle, ih5Var, i95Var, ov5Var);
}
}, 2);
}
static int x(d0 d0Var, double d2) {
double d3 = d0Var.p;
Double.isNaN(d3);
int i = (int) (d3 - d2);
d0Var.p = i;
return i;
}
@Override
public boolean a() {
return true;
}
@Override
public boolean b(boolean z) {
NotificationCenter globalInstance;
int i;
if (!z) {
i.C0142i c0142i = new i.C0142i(w6.this.c0());
c0142i.u(LocaleController.getString("AppName", R.string.AppName));
c0142i.l(LocaleController.getString("StopVerification", R.string.StopVerification));
c0142i.s(LocaleController.getString("Continue", R.string.Continue), null);
c0142i.n(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
w6.d0.this.d0(dialogInterface, i2);
}
});
w6.this.o1(c0142i.a());
return false;
}
wg5 wg5Var = new wg5();
wg5Var.a = this.a;
wg5Var.b = this.b;
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(wg5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.d0.e0(i95Var, ov5Var);
}
}, 2);
b0();
a0();
int i2 = this.w;
if (i2 != 2) {
if (i2 == 3) {
AndroidUtilities.setWaitingForCall(false);
globalInstance = NotificationCenter.getGlobalInstance();
i = NotificationCenter.didReceiveCall;
}
this.t = false;
return true;
}
AndroidUtilities.setWaitingForSms(false);
globalInstance = NotificationCenter.getGlobalInstance();
i = NotificationCenter.didReceiveSmsCode;
globalInstance.removeObserver(this, i);
this.t = false;
return true;
}
@Override
public void d() {
this.u = false;
}
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
EditTextBoldCursor[] editTextBoldCursorArr;
if (!this.t || (editTextBoldCursorArr = this.d) == null) {
return;
}
if (i == NotificationCenter.didReceiveSmsCode) {
editTextBoldCursorArr[0].setText(BuildConfig.FLAVOR + objArr[0]);
} else {
if (i != NotificationCenter.didReceiveCall) {
return;
}
String str = BuildConfig.FLAVOR + objArr[0];
if (!AndroidUtilities.checkPhonePattern(this.y, str)) {
return;
}
this.s = true;
this.d[0].setText(str);
this.s = false;
}
f(null);
}
@Override
public void e() {
NotificationCenter globalInstance;
int i;
super.e();
int i2 = this.w;
if (i2 != 2) {
if (i2 == 3) {
AndroidUtilities.setWaitingForCall(false);
globalInstance = NotificationCenter.getGlobalInstance();
i = NotificationCenter.didReceiveCall;
}
this.t = false;
b0();
a0();
}
AndroidUtilities.setWaitingForSms(false);
globalInstance = NotificationCenter.getGlobalInstance();
i = NotificationCenter.didReceiveSmsCode;
globalInstance.removeObserver(this, i);
this.t = false;
b0();
a0();
}
@Override
public void f(String str) {
NotificationCenter globalInstance;
int i;
if (this.u) {
return;
}
if (str == null) {
str = getCode();
}
if (TextUtils.isEmpty(str)) {
AndroidUtilities.shakeView(this.c, 2.0f, 0);
return;
}
this.u = true;
int i2 = this.w;
if (i2 != 2) {
if (i2 == 3) {
AndroidUtilities.setWaitingForCall(false);
globalInstance = NotificationCenter.getGlobalInstance();
i = NotificationCenter.didReceiveCall;
}
this.t = false;
w6.this.o8(true, true);
final kg5 kg5Var = new kg5();
kg5Var.a = this.a;
kg5Var.c = str;
kg5Var.b = this.b;
b0();
w6.this.X7();
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(kg5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.d0.this.g0(kg5Var, i95Var, ov5Var);
}
}, 2);
}
AndroidUtilities.setWaitingForSms(false);
globalInstance = NotificationCenter.getGlobalInstance();
i = NotificationCenter.didReceiveSmsCode;
globalInstance.removeObserver(this, i);
this.t = false;
w6.this.o8(true, true);
final kg5 kg5Var2 = new kg5();
kg5Var2.a = this.a;
kg5Var2.c = str;
kg5Var2.b = this.b;
b0();
w6.this.X7();
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(kg5Var2, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.d0.this.g0(kg5Var2, i95Var, ov5Var);
}
}, 2);
}
@Override
public void g() {
super.g();
LinearLayout linearLayout = this.c;
if (linearLayout == null || linearLayout.getVisibility() != 0) {
return;
}
for (int length = this.d.length - 1; length >= 0; length--) {
if (length == 0 || this.d[length].length() != 0) {
this.d[length].requestFocus();
EditTextBoldCursor[] editTextBoldCursorArr = this.d;
editTextBoldCursorArr[length].setSelection(editTextBoldCursorArr[length].length());
AndroidUtilities.showKeyboard(this.d[length]);
return;
}
}
}
@Override
public void j(Bundle bundle, boolean z) {
NotificationCenter globalInstance;
int i;
int i2;
EditTextBoldCursor[] editTextBoldCursorArr;
final int i3;
e0 e0Var;
String formatString;
int i4;
TextView textView;
int i5;
int i6;
TextView textView2;
String formatString2;
if (bundle == null) {
return;
}
this.t = true;
int i7 = this.w;
if (i7 != 2) {
if (i7 == 3) {
AndroidUtilities.setWaitingForCall(true);
globalInstance = NotificationCenter.getGlobalInstance();
i = NotificationCenter.didReceiveCall;
}
this.a = bundle.getString("phone");
this.b = bundle.getString("phoneHash");
int i8 = bundle.getInt("timeout");
this.o = i8;
this.A = i8;
this.x = bundle.getInt("nextType");
this.y = bundle.getString("pattern");
i2 = bundle.getInt("length");
this.z = i2;
if (i2 == 0) {
this.z = 5;
}
editTextBoldCursorArr = this.d;
CharSequence charSequence = BuildConfig.FLAVOR;
int i9 = 8;
if (editTextBoldCursorArr == null && editTextBoldCursorArr.length == this.z) {
int i10 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr2 = this.d;
if (i10 >= editTextBoldCursorArr2.length) {
break;
}
editTextBoldCursorArr2[i10].setText(BuildConfig.FLAVOR);
i10++;
}
} else {
this.d = new EditTextBoldCursor[this.z];
i3 = 0;
while (i3 < this.z) {
this.d[i3] = new EditTextBoldCursor(getContext());
this.d[i3].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.d[i3].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.d[i3].setCursorSize(AndroidUtilities.dp(20.0f));
this.d[i3].setCursorWidth(1.5f);
Drawable mutate = getResources().getDrawable(org.telegram.messenger.R.drawable.search_dark_activated).mutate();
mutate.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteInputFieldActivated"), PorterDuff.Mode.MULTIPLY));
this.d[i3].setBackgroundDrawable(mutate);
this.d[i3].setImeOptions(268435461);
this.d[i3].setTextSize(1, 20.0f);
this.d[i3].setMaxLines(1);
this.d[i3].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.d[i3].setPadding(0, 0, 0, 0);
this.d[i3].setGravity(49);
if (this.w == 3) {
this.d[i3].setEnabled(false);
this.d[i3].setInputType(0);
this.d[i3].setVisibility(8);
} else {
this.d[i3].setInputType(3);
}
this.c.addView(this.d[i3], g52.m(34, 36, 1, 0, 0, i3 != this.z - 1 ? 7 : 0, 0));
this.d[i3].addTextChangedListener(new c(i3));
this.d[i3].setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view, int i11, KeyEvent keyEvent) {
boolean k0;
k0 = w6.d0.this.k0(i3, view, i11, keyEvent);
return k0;
}
});
this.d[i3].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i11, KeyEvent keyEvent) {
boolean l0;
l0 = w6.d0.this.l0(textView3, i11, keyEvent);
return l0;
}
});
i3++;
}
}
e0Var = this.k;
if (e0Var != null) {
e0Var.setVisibility(this.x != 0 ? 0 : 8);
}
if (this.a != null) {
return;
}
String c2 = uw3.d().c("+" + this.a);
int i11 = this.w;
if (i11 == 2) {
formatString = LocaleController.formatString("SentSmsCode", R.string.SentSmsCode, LocaleController.addNbsp(c2));
} else {
if (i11 != 3) {
if (i11 == 4) {
formatString = LocaleController.formatString("SentCallOnly", R.string.SentCallOnly, LocaleController.addNbsp(c2));
}
this.e.setText(charSequence);
if (this.w == 3) {
AndroidUtilities.showKeyboard(this.d[0]);
this.d[0].requestFocus();
} else {
AndroidUtilities.hideKeyboard(this.d[0]);
}
b0();
a0();
this.q = System.currentTimeMillis();
i4 = this.w;
if (i4 != 3 && ((i6 = this.x) == 4 || i6 == 2)) {
this.j.setVisibility(8);
this.i.setVisibility(0);
int i12 = this.x;
if (i12 == 4) {
textView2 = this.i;
formatString2 = LocaleController.formatString("CallText", R.string.CallText, 1, 0);
} else if (i12 == 2) {
textView2 = this.i;
formatString2 = LocaleController.formatString("SmsText", R.string.SmsText, 1, 0);
}
textView2.setText(formatString2);
} else if (i4 != 2 && ((i5 = this.x) == 4 || i5 == 3)) {
this.i.setText(LocaleController.formatString("CallText", R.string.CallText, 2, 0));
this.j.setVisibility(this.o < 1000 ? 0 : 8);
textView = this.i;
} else if (i4 == 4 || this.x != 2) {
this.i.setVisibility(8);
this.j.setVisibility(8);
Y();
return;
} else {
this.i.setText(LocaleController.formatString("SmsText", R.string.SmsText, 2, 0));
this.j.setVisibility(this.o < 1000 ? 0 : 8);
textView = this.i;
}
Z();
return;
}
formatString = LocaleController.formatString("SentCallCode", R.string.SentCallCode, LocaleController.addNbsp(c2));
}
charSequence = AndroidUtilities.replaceTags(formatString);
this.e.setText(charSequence);
if (this.w == 3) {
}
b0();
a0();
this.q = System.currentTimeMillis();
i4 = this.w;
if (i4 != 3) {
}
if (i4 != 2) {
}
if (i4 == 4) {
}
this.i.setVisibility(8);
this.j.setVisibility(8);
Y();
return;
}
AndroidUtilities.setWaitingForSms(true);
globalInstance = NotificationCenter.getGlobalInstance();
i = NotificationCenter.didReceiveSmsCode;
globalInstance.addObserver(this, i);
this.a = bundle.getString("phone");
this.b = bundle.getString("phoneHash");
int i82 = bundle.getInt("timeout");
this.o = i82;
this.A = i82;
this.x = bundle.getInt("nextType");
this.y = bundle.getString("pattern");
i2 = bundle.getInt("length");
this.z = i2;
if (i2 == 0) {
}
editTextBoldCursorArr = this.d;
CharSequence charSequence2 = BuildConfig.FLAVOR;
int i92 = 8;
if (editTextBoldCursorArr == null) {
}
this.d = new EditTextBoldCursor[this.z];
i3 = 0;
while (i3 < this.z) {
}
e0Var = this.k;
if (e0Var != null) {
}
if (this.a != null) {
}
}
@Override
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
int i5;
int measuredHeight;
TextView textView;
int left;
TextView textView2;
super.onLayout(z, i, i2, i3, i4);
if (this.w == 3 || this.h == null) {
return;
}
int bottom = this.e.getBottom();
int measuredHeight2 = getMeasuredHeight() - bottom;
if (this.j.getVisibility() == 0) {
measuredHeight = this.j.getMeasuredHeight();
i5 = (measuredHeight2 + bottom) - measuredHeight;
textView = this.j;
left = textView.getLeft();
textView2 = this.j;
} else {
if (this.i.getVisibility() != 0) {
i5 = measuredHeight2 + bottom;
int measuredHeight3 = this.c.getMeasuredHeight();
int i6 = (((i5 - bottom) - measuredHeight3) / 2) + bottom;
LinearLayout linearLayout = this.c;
linearLayout.layout(linearLayout.getLeft(), i6, this.c.getRight(), measuredHeight3 + i6);
}
measuredHeight = this.i.getMeasuredHeight();
i5 = (measuredHeight2 + bottom) - measuredHeight;
textView = this.i;
left = textView.getLeft();
textView2 = this.i;
}
textView.layout(left, i5, textView2.getRight(), measuredHeight + i5);
int measuredHeight32 = this.c.getMeasuredHeight();
int i62 = (((i5 - bottom) - measuredHeight32) / 2) + bottom;
LinearLayout linearLayout2 = this.c;
linearLayout2.layout(linearLayout2.getLeft(), i62, this.c.getRight(), measuredHeight32 + i62);
}
@Override
protected void onMeasure(int i, int i2) {
ImageView imageView;
super.onMeasure(i, i2);
if (this.w == 3 || (imageView = this.h) == null) {
return;
}
int measuredHeight = imageView.getMeasuredHeight() + this.f.getMeasuredHeight() + this.e.getMeasuredHeight() + AndroidUtilities.dp(35.0f);
int dp = AndroidUtilities.dp(80.0f);
int dp2 = AndroidUtilities.dp(291.0f);
if (w6.this.C0 - measuredHeight < dp) {
setMeasuredDimension(getMeasuredWidth(), measuredHeight + dp);
} else {
setMeasuredDimension(getMeasuredWidth(), Math.min(w6.this.C0, dp2));
}
}
}
public class e implements c0.i {
e() {
}
@Override
public void a(String str) {
vo.b(this, str);
}
@Override
public void b(MrzRecognizer.Result result) {
EditTextBoldCursor editTextBoldCursor;
int i;
String str;
if (!TextUtils.isEmpty(result.firstName)) {
w6.this.i0[0].setText(result.firstName);
}
if (!TextUtils.isEmpty(result.middleName)) {
w6.this.i0[1].setText(result.middleName);
}
if (!TextUtils.isEmpty(result.lastName)) {
w6.this.i0[2].setText(result.lastName);
}
int i2 = result.gender;
if (i2 != 0) {
if (i2 == 1) {
w6.this.B = "male";
editTextBoldCursor = w6.this.i0[4];
i = R.string.PassportMale;
str = "PassportMale";
} else if (i2 == 2) {
w6.this.B = "female";
editTextBoldCursor = w6.this.i0[4];
i = R.string.PassportFemale;
str = "PassportFemale";
}
editTextBoldCursor.setText(LocaleController.getString(str, i));
}
if (!TextUtils.isEmpty(result.nationality)) {
w6.this.z = result.nationality;
String str2 = (String) w6.this.i1.get(w6.this.z);
if (str2 != null) {
w6.this.i0[5].setText(str2);
}
}
if (!TextUtils.isEmpty(result.issuingCountry)) {
w6.this.A = result.issuingCountry;
String str3 = (String) w6.this.i1.get(w6.this.A);
if (str3 != null) {
w6.this.i0[6].setText(str3);
}
}
if (result.birthDay <= 0 || result.birthMonth <= 0 || result.birthYear <= 0) {
return;
}
w6.this.i0[3].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(result.birthDay), Integer.valueOf(result.birthMonth), Integer.valueOf(result.birthYear)));
}
}
public static class e0 extends View {
private Paint a;
private Paint b;
private float c;
public e0(Context context) {
super(context);
this.a = new Paint();
this.b = new Paint();
this.a.setColor(org.telegram.ui.ActionBar.w.r1("login_progressInner"));
this.b.setColor(org.telegram.ui.ActionBar.w.r1("login_progressOuter"));
}
public void a(float f) {
this.c = f;
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
float measuredWidth = (int) (getMeasuredWidth() * this.c);
canvas.drawRect(0.0f, 0.0f, measuredWidth, getMeasuredHeight(), this.b);
canvas.drawRect(measuredWidth, 0.0f, getMeasuredWidth(), getMeasuredHeight(), this.a);
}
}
public class f extends FrameLayout {
private StaticLayout a;
private float b;
final EditTextBoldCursor c;
f(w6 w6Var, Context context, EditTextBoldCursor editTextBoldCursor) {
super(context);
this.c = editTextBoldCursor;
}
@Override
protected void onDraw(Canvas canvas) {
if (this.a != null) {
canvas.save();
canvas.translate(AndroidUtilities.dp(21.0f) + this.b, this.c.getLineY() + AndroidUtilities.dp(3.0f));
this.a.draw(canvas);
canvas.restore();
}
}
@Override
protected void onMeasure(int i, int i2) {
int size = View.MeasureSpec.getSize(i) - AndroidUtilities.dp(34.0f);
StaticLayout B = this.c.B(size);
this.a = B;
if (B != null) {
int lineCount = B.getLineCount();
int i3 = 0;
if (lineCount > 1) {
i2 = View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + (this.a.getLineBottom(lineCount - 1) - this.a.getLineBottom(0)), 1073741824);
}
if (LocaleController.isRTL) {
float f = 0.0f;
while (true) {
if (i3 >= lineCount) {
break;
}
if (this.a.getLineLeft(i3) != 0.0f) {
this.b = 0.0f;
break;
}
f = Math.max(f, this.a.getLineWidth(i3));
if (i3 == lineCount - 1) {
this.b = size - f;
}
i3++;
}
}
}
super.onMeasure(i, i2);
}
}
public class f0 extends FrameLayout implements DownloadController.FileDownloadProgressListener {
private TextView a;
private TextView b;
private org.telegram.messenger.p110.pf c;
private ne4 d;
private int e;
private SecureDocument f;
private int g;
public f0(Context context) {
super(context);
this.g = DownloadController.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).generateObserverTag();
this.d = new ne4(this);
org.telegram.messenger.p110.pf pfVar = new org.telegram.messenger.p110.pf(context);
this.c = pfVar;
addView(pfVar, g52.b(48, 48.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 8.0f, 21.0f, 0.0f));
TextView textView = new TextView(context);
this.a = textView;
textView.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.a.setTextSize(1, 16.0f);
this.a.setLines(1);
this.a.setMaxLines(1);
this.a.setSingleLine(true);
this.a.setEllipsize(TextUtils.TruncateAt.END);
this.a.setGravity((LocaleController.isRTL ? 5 : 3) | 16);
View view = this.a;
boolean z = LocaleController.isRTL;
addView(view, g52.b(-2, -2.0f, (z ? 5 : 3) | 48, z ? 21 : 81, 10.0f, z ? 81 : 21, 0.0f));
TextView textView2 = new TextView(context);
this.b = textView2;
textView2.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText2"));
this.b.setTextSize(1, 13.0f);
this.b.setGravity(LocaleController.isRTL ? 5 : 3);
this.b.setLines(1);
this.b.setMaxLines(1);
this.b.setSingleLine(true);
this.b.setPadding(0, 0, 0, 0);
View view2 = this.b;
boolean z2 = LocaleController.isRTL;
addView(view2, g52.b(-2, -2.0f, (z2 ? 5 : 3) | 48, z2 ? 21 : 81, 35.0f, z2 ? 81 : 21, 0.0f));
setWillNotDraw(false);
}
public void c(String str, CharSequence charSequence, SecureDocument secureDocument) {
this.a.setText(str);
this.b.setText(charSequence);
this.c.l(secureDocument, "48_48");
this.f = secureDocument;
d(false);
}
public void d(boolean z) {
String attachFileName = FileLoader.getAttachFileName(this.f);
boolean exists = FileLoader.getPathToAttach(this.f).exists();
if (TextUtils.isEmpty(attachFileName)) {
this.d.c(null, false, false);
return;
}
SecureDocument secureDocument = this.f;
if (secureDocument.path != null) {
if (secureDocument.inputFile != null) {
DownloadController.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).removeLoadingFileObserver(this);
this.d.c(null, false, z);
this.e = -1;
return;
} else {
DownloadController.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).addLoadingFileObserver(this.f.path, this);
this.e = 1;
Float fileProgress = ImageLoader.getInstance().getFileProgress(this.f.path);
this.d.c(org.telegram.ui.ActionBar.w.t4[5][0], true, z);
this.d.d(fileProgress != null ? fileProgress.floatValue() : 0.0f, false);
}
} else if (exists) {
DownloadController.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).removeLoadingFileObserver(this);
this.e = -1;
this.d.c(null, false, z);
} else {
DownloadController.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).addLoadingFileObserver(attachFileName, this);
this.e = 1;
Float fileProgress2 = ImageLoader.getInstance().getFileProgress(attachFileName);
this.d.c(org.telegram.ui.ActionBar.w.t4[5][0], true, z);
this.d.d(fileProgress2 != null ? fileProgress2.floatValue() : 0.0f, z);
}
invalidate();
}
@Override
protected boolean drawChild(Canvas canvas, View view, long j) {
boolean drawChild = super.drawChild(canvas, view, j);
if (view == this.c) {
this.d.a(canvas);
}
return drawChild;
}
@Override
public int getObserverTag() {
return this.g;
}
@Override
public void invalidate() {
super.invalidate();
this.a.invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawLine(LocaleController.isRTL ? 0.0f : AndroidUtilities.dp(20.0f), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20.0f) : 0), getMeasuredHeight() - 1, org.telegram.ui.ActionBar.w.l0);
}
@Override
public void onFailedDownload(String str, boolean z) {
d(false);
}
@Override
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
int left = this.c.getLeft() + ((this.c.getMeasuredWidth() - AndroidUtilities.dp(24.0f)) / 2);
int top = this.c.getTop() + ((this.c.getMeasuredHeight() - AndroidUtilities.dp(24.0f)) / 2);
this.d.f(left, top, AndroidUtilities.dp(24.0f) + left, AndroidUtilities.dp(24.0f) + top);
}
@Override
protected void onMeasure(int i, int i2) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + 1, 1073741824));
}
@Override
public void onProgressDownload(String str, long j, long j2) {
this.d.d(Math.min(1.0f, ((float) j) / ((float) j2)), true);
if (this.e != 1) {
d(false);
}
}
@Override
public void onProgressUpload(String str, long j, long j2, boolean z) {
this.d.d(Math.min(1.0f, ((float) j) / ((float) j2)), true);
}
@Override
public void onSuccessDownload(String str) {
this.d.d(1.0f, true);
d(true);
}
public void setValue(CharSequence charSequence) {
this.b.setText(charSequence);
}
}
public class g implements TextWatcher {
private boolean a;
final EditTextBoldCursor b;
final String c;
g(EditTextBoldCursor editTextBoldCursor, String str) {
this.b = editTextBoldCursor;
this.c = str;
}
@Override
public void afterTextChanged(Editable editable) {
boolean z;
if (this.a) {
return;
}
int intValue = ((Integer) this.b.getTag()).intValue();
int i = 0;
while (true) {
if (i >= editable.length()) {
z = false;
break;
}
char charAt = editable.charAt(i);
if ((charAt < '0' || charAt > '9') && ((charAt < 'a' || charAt > 'z') && !((charAt >= 'A' && charAt <= 'Z') || charAt == ' ' || charAt == '\'' || charAt == ',' || charAt == '.' || charAt == '&' || charAt == '-' || charAt == '/'))) {
z = true;
break;
}
i++;
}
if (z && !w6.this.E0) {
this.b.setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
} else {
w6.this.D0[intValue] = z;
w6.this.L5(this.b, this.c, editable, false);
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
public class g0 extends FrameLayout {
private TextView a;
private TextView b;
private ImageView c;
private boolean d;
public g0(w6 w6Var, Context context) {
super(context);
int i = w6Var.r == 8 ? 21 : 51;
TextView textView = new TextView(context);
this.a = textView;
textView.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.a.setTextSize(1, 16.0f);
this.a.setLines(1);
this.a.setMaxLines(1);
this.a.setSingleLine(true);
this.a.setEllipsize(TextUtils.TruncateAt.END);
this.a.setGravity((LocaleController.isRTL ? 5 : 3) | 16);
TextView textView2 = this.a;
boolean z = LocaleController.isRTL;
addView(textView2, g52.b(-2, -2.0f, (z ? 5 : 3) | 48, z ? i : 21, 10.0f, z ? 21 : i, 0.0f));
TextView textView3 = new TextView(context);
this.b = textView3;
textView3.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText2"));
this.b.setTextSize(1, 13.0f);
this.b.setGravity(LocaleController.isRTL ? 5 : 3);
this.b.setLines(1);
this.b.setMaxLines(1);
this.b.setSingleLine(true);
this.b.setEllipsize(TextUtils.TruncateAt.END);
this.b.setPadding(0, 0, 0, 0);
TextView textView4 = this.b;
boolean z2 = LocaleController.isRTL;
addView(textView4, g52.b(-2, -2.0f, (z2 ? 5 : 3) | 48, z2 ? i : 21, 35.0f, z2 ? 21 : i, 0.0f));
ImageView imageView = new ImageView(context);
this.c = imageView;
imageView.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("featuredStickers_addedIcon"), PorterDuff.Mode.MULTIPLY));
this.c.setImageResource(org.telegram.messenger.R.drawable.sticker_added);
addView(this.c, g52.b(-2, -2.0f, (LocaleController.isRTL ? 3 : 5) | 48, 21.0f, 25.0f, 21.0f, 0.0f));
}
public void b(String str, CharSequence charSequence, boolean z) {
this.a.setText(str);
this.b.setText(charSequence);
this.d = z;
setWillNotDraw(!z);
}
@Override
protected void onDraw(Canvas canvas) {
if (this.d) {
canvas.drawLine(LocaleController.isRTL ? 0.0f : AndroidUtilities.dp(20.0f), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20.0f) : 0), getMeasuredHeight() - 1, org.telegram.ui.ActionBar.w.l0);
}
}
@Override
protected void onMeasure(int i, int i2) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + (this.d ? 1 : 0), 1073741824));
}
public void setChecked(boolean z) {
this.c.setVisibility(z ? 0 : 4);
}
public void setNeedDivider(boolean z) {
this.d = z;
setWillNotDraw(!z);
invalidate();
}
public void setValue(CharSequence charSequence) {
this.b.setText(charSequence);
}
}
public class h implements TextWatcher {
final EditTextBoldCursor a;
final String b;
final HashMap c;
h(EditTextBoldCursor editTextBoldCursor, String str, HashMap hashMap) {
this.a = editTextBoldCursor;
this.b = str;
this.c = hashMap;
}
@Override
public void afterTextChanged(Editable editable) {
w6 w6Var = w6.this;
w6Var.L5(this.a, this.b, editable, this.c == w6Var.D1);
int intValue = ((Integer) this.a.getTag()).intValue();
EditTextBoldCursor editTextBoldCursor = w6.this.i0[intValue];
if (intValue == 6) {
w6.this.N5(true);
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
public class i extends FrameLayout {
private StaticLayout a;
private float b;
final EditTextBoldCursor c;
i(w6 w6Var, Context context, EditTextBoldCursor editTextBoldCursor) {
super(context);
this.c = editTextBoldCursor;
}
@Override
protected void onDraw(Canvas canvas) {
if (this.a != null) {
canvas.save();
canvas.translate(AndroidUtilities.dp(21.0f) + this.b, this.c.getLineY() + AndroidUtilities.dp(3.0f));
this.a.draw(canvas);
canvas.restore();
}
}
@Override
protected void onMeasure(int i, int i2) {
int size = View.MeasureSpec.getSize(i) - AndroidUtilities.dp(34.0f);
StaticLayout B = this.c.B(size);
this.a = B;
if (B != null) {
int lineCount = B.getLineCount();
int i3 = 0;
if (lineCount > 1) {
i2 = View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64.0f) + (this.a.getLineBottom(lineCount - 1) - this.a.getLineBottom(0)), 1073741824);
}
if (LocaleController.isRTL) {
float f = 0.0f;
while (true) {
if (i3 >= lineCount) {
break;
}
if (this.a.getLineLeft(i3) != 0.0f) {
this.b = 0.0f;
break;
}
f = Math.max(f, this.a.getLineWidth(i3));
if (i3 == lineCount - 1) {
this.b = size - f;
}
i3++;
}
}
}
super.onMeasure(i, i2);
}
}
public class j implements TextWatcher {
private boolean a;
final EditTextBoldCursor b;
final String c;
j(EditTextBoldCursor editTextBoldCursor, String str) {
this.b = editTextBoldCursor;
this.c = str;
}
@Override
public void afterTextChanged(Editable editable) {
if (this.a) {
return;
}
w6.this.L5(this.b, this.c, editable, false);
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
class k extends PhotoViewer.y1 {
k() {
}
@Override
public String F() {
return w6.this.c1 == 1 ? LocaleController.formatString("PassportDeleteSelfieAlert", R.string.PassportDeleteSelfieAlert, new Object[0]) : LocaleController.formatString("PassportDeleteScanAlert", R.string.PassportDeleteScanAlert, new Object[0]);
}
@Override
public PhotoViewer.e2 n(MessageObject messageObject, oa5 oa5Var, int i, boolean z) {
if (i < 0 || i >= w6.this.s0.getChildCount()) {
return null;
}
f0 f0Var = (f0) w6.this.s0.getChildAt(i);
int[] iArr = new int[2];
f0Var.c.getLocationInWindow(iArr);
PhotoViewer.e2 e2Var = new PhotoViewer.e2();
e2Var.b = iArr[0];
e2Var.c = iArr[1] - (Build.VERSION.SDK_INT < 21 ? AndroidUtilities.statusBarHeight : 0);
e2Var.d = w6.this.s0;
ImageReceiver imageReceiver = f0Var.c.getImageReceiver();
e2Var.a = imageReceiver;
e2Var.e = imageReceiver.getBitmapSafe();
return e2Var;
}
@Override
public void r(int i) {
ArrayList arrayList;
SecureDocument secureDocument;
StringBuilder sb;
String str;
if (w6.this.c1 == 1) {
secureDocument = w6.this.t1;
} else {
if (w6.this.c1 == 4) {
arrayList = w6.this.u1;
} else if (w6.this.c1 == 2) {
secureDocument = w6.this.v1;
} else if (w6.this.c1 == 3) {
secureDocument = w6.this.w1;
} else {
arrayList = w6.this.s1;
}
secureDocument = (SecureDocument) arrayList.get(i);
}
f0 f0Var = (f0) w6.this.x1.remove(secureDocument);
if (f0Var == null) {
return;
}
String l6 = w6.this.l6(secureDocument);
String str2 = null;
if (w6.this.c1 == 1) {
w6.this.t1 = null;
sb = new StringBuilder();
str = "selfie";
} else if (w6.this.c1 == 4) {
sb = new StringBuilder();
str = "translation";
} else if (w6.this.c1 == 2) {
w6.this.v1 = null;
sb = new StringBuilder();
str = "front";
} else {
if (w6.this.c1 != 3) {
if (w6.this.c1 == 0) {
sb = new StringBuilder();
str = "files";
}
if (str2 != null) {
if (w6.this.H1 != null) {
w6.this.H1.remove(str2);
}
if (w6.this.I1 != null) {
w6.this.I1.remove(str2);
}
}
w6 w6Var = w6.this;
w6Var.t8(w6Var.c1);
w6.this.s0.removeView(f0Var);
}
w6.this.w1 = null;
sb = new StringBuilder();
str = "reverse";
}
sb.append(str);
sb.append(l6);
str2 = sb.toString();
if (str2 != null) {
}
w6 w6Var2 = w6.this;
w6Var2.t8(w6Var2.c1);
w6.this.s0.removeView(f0Var);
}
}
public class l {
aq6 a;
boolean b;
boolean c;
public l(w6 w6Var, aq6 aq6Var, boolean z, boolean z2) {
this.a = aq6Var;
this.b = z;
this.c = z2;
}
}
public class m implements c0 {
final ed5 a;
final boolean b;
final int c;
public class a implements RequestDelegate {
final a0 a;
final String b;
final kf5 c;
final xp6 d;
final xp6 e;
final ArrayList f;
final SecureDocument g;
final SecureDocument h;
final SecureDocument i;
final ArrayList j;
final String k;
final String l;
final Runnable m;
final c0 n;
final h26 o;
a(a0 a0Var, String str, kf5 kf5Var, xp6 xp6Var, xp6 xp6Var2, ArrayList arrayList, SecureDocument secureDocument, SecureDocument secureDocument2, SecureDocument secureDocument3, ArrayList arrayList2, String str2, String str3, Runnable runnable, c0 c0Var, h26 h26Var) {
this.a = a0Var;
this.b = str;
this.c = kf5Var;
this.d = xp6Var;
this.e = xp6Var2;
this.f = arrayList;
this.g = secureDocument;
this.h = secureDocument2;
this.i = secureDocument3;
this.j = arrayList2;
this.k = str2;
this.l = str3;
this.m = runnable;
this.n = c0Var;
this.o = h26Var;
}
public void f(ov5 ov5Var, a0 a0Var, String str, kf5 kf5Var, boolean z, xp6 xp6Var, xp6 xp6Var2, aq6 aq6Var, aq6 aq6Var2, ArrayList arrayList, SecureDocument secureDocument, SecureDocument secureDocument2, SecureDocument secureDocument3, ArrayList arrayList2, String str2, String str3, int i, Runnable runnable) {
int size;
int i2;
zc5 zc5Var;
zc5 zc5Var2;
zc5 zc5Var3;
int size2;
int i3;
int i4;
if (ov5Var != null) {
if (a0Var != null) {
a0Var.a(ov5Var.b, str);
}
org.telegram.ui.Components.b.l4(((org.telegram.ui.ActionBar.k) w6.this).d, ov5Var, w6.this, kf5Var, str);
return;
}
w6 w6Var = w6.this;
if (!z) {
w6Var.g8(xp6Var2);
w6Var = w6.this;
} else if (xp6Var == null) {
w6Var.g8(xp6Var2);
if (aq6Var != null) {
w6.this.H.c.add(aq6Var);
}
if (aq6Var2 != null) {
w6.this.H.c.add(aq6Var2);
}
if (arrayList != null && !arrayList.isEmpty()) {
size2 = arrayList.size();
i3 = 0;
while (i3 < size2) {
SecureDocument secureDocument4 = (SecureDocument) arrayList.get(i3);
if (secureDocument4.inputFile != null) {
int size3 = aq6Var.h.size();
int i5 = 0;
while (i5 < size3) {
zc5 zc5Var4 = aq6Var.h.get(i5);
i4 = size2;
if (zc5Var4 instanceof qp6) {
qp6 qp6Var = (qp6) zc5Var4;
if (Utilities.arraysEquals(secureDocument4.fileSecret, 0, qp6Var.g, 0)) {
m.this.f(secureDocument4, qp6Var);
break;
}
}
i5++;
size2 = i4;
}
}
i4 = size2;
i3++;
size2 = i4;
}
}
if (secureDocument != null && secureDocument.inputFile != null) {
zc5Var3 = aq6Var.f;
if (zc5Var3 instanceof qp6) {
qp6 qp6Var2 = (qp6) zc5Var3;
if (Utilities.arraysEquals(secureDocument.fileSecret, 0, qp6Var2.g, 0)) {
m.this.f(secureDocument, qp6Var2);
}
}
}
if (secureDocument2 != null && secureDocument2.inputFile != null) {
zc5Var2 = aq6Var.d;
if (zc5Var2 instanceof qp6) {
qp6 qp6Var3 = (qp6) zc5Var2;
if (Utilities.arraysEquals(secureDocument2.fileSecret, 0, qp6Var3.g, 0)) {
m.this.f(secureDocument2, qp6Var3);
}
}
}
if (secureDocument3 != null && secureDocument3.inputFile != null) {
zc5Var = aq6Var.e;
if (zc5Var instanceof qp6) {
qp6 qp6Var4 = (qp6) zc5Var;
if (Utilities.arraysEquals(secureDocument3.fileSecret, 0, qp6Var4.g, 0)) {
m.this.f(secureDocument3, qp6Var4);
}
}
}
if (arrayList2 != null && !arrayList2.isEmpty()) {
size = arrayList2.size();
for (i2 = 0; i2 < size; i2++) {
SecureDocument secureDocument5 = (SecureDocument) arrayList2.get(i2);
if (secureDocument5.inputFile != null) {
int size4 = aq6Var.g.size();
for (int i6 = 0; i6 < size4; i6++) {
zc5 zc5Var5 = aq6Var.g.get(i6);
if (zc5Var5 instanceof qp6) {
qp6 qp6Var5 = (qp6) zc5Var5;
if (Utilities.arraysEquals(secureDocument5.fileSecret, 0, qp6Var5.g, 0)) {
m.this.f(secureDocument5, qp6Var5);
break;
}
}
}
}
}
}
w6.this.l8(xp6Var2, str, str2, xp6Var, str3, z, i);
if (runnable == null) {
runnable.run();
return;
}
return;
}
w6Var.g8(xp6Var);
if (aq6Var != null) {
}
if (aq6Var2 != null) {
}
if (arrayList != null) {
size2 = arrayList.size();
i3 = 0;
while (i3 < size2) {
}
}
if (secureDocument != null) {
zc5Var3 = aq6Var.f;
if (zc5Var3 instanceof qp6) {
}
}
if (secureDocument2 != null) {
zc5Var2 = aq6Var.d;
if (zc5Var2 instanceof qp6) {
}
}
if (secureDocument3 != null) {
zc5Var = aq6Var.e;
if (zc5Var instanceof qp6) {
}
}
if (arrayList2 != null) {
size = arrayList2.size();
while (i2 < size) {
}
}
w6.this.l8(xp6Var2, str, str2, xp6Var, str3, z, i);
if (runnable == null) {
}
}
public void g(i95 i95Var, String str, xp6 xp6Var, c0 c0Var, ov5 ov5Var, a0 a0Var) {
if (i95Var == null) {
w6.this.m8(LocaleController.getString("PassportEmail", R.string.PassportEmail), ov5Var.b);
if (a0Var != null) {
a0Var.a(ov5Var.b, str);
return;
}
return;
}
rf5 rf5Var = (rf5) i95Var;
HashMap hashMap = new HashMap();
hashMap.put("email", str);
hashMap.put("pattern", rf5Var.a);
w6 w6Var = new w6(6, w6.this.H, w6.this.T, xp6Var, (aq6) null, (xp6) null, (aq6) null, (HashMap<String, String>) hashMap, (HashMap<String, String>) null);
((org.telegram.ui.ActionBar.k) w6Var).d = ((org.telegram.ui.ActionBar.k) w6.this).d;
w6Var.d1 = rf5Var.b;
w6Var.o1 = w6.this.o1;
w6Var.m1 = w6.this.m1;
w6Var.L1 = c0Var;
w6.this.T0(w6Var, true);
}
public void h(final String str, final xp6 xp6Var, final c0 c0Var, final a0 a0Var, final i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.m.a.this.g(i95Var, str, xp6Var, c0Var, ov5Var, a0Var);
}
});
}
public static void i(a0 a0Var, ov5 ov5Var, String str) {
a0Var.a(ov5Var.b, str);
}
public void j(final ov5 ov5Var, final aq6 aq6Var, final aq6 aq6Var2) {
final a0 a0Var = this.a;
final String str = this.b;
final kf5 kf5Var = this.c;
m mVar = m.this;
final boolean z = mVar.b;
final xp6 xp6Var = this.d;
final xp6 xp6Var2 = this.e;
final ArrayList arrayList = this.f;
final SecureDocument secureDocument = this.g;
final SecureDocument secureDocument2 = this.h;
final SecureDocument secureDocument3 = this.i;
final ArrayList arrayList2 = this.j;
final String str2 = this.k;
final String str3 = this.l;
final int i = mVar.c;
final Runnable runnable = this.m;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.m.a.this.f(ov5Var, a0Var, str, kf5Var, z, xp6Var, xp6Var2, aq6Var, aq6Var2, arrayList, secureDocument, secureDocument2, secureDocument3, arrayList2, str2, str3, i, runnable);
}
});
}
@Override
public void run(i95 i95Var, final ov5 ov5Var) {
if (ov5Var != null) {
if (ov5Var.b.equals("EMAIL_VERIFICATION_NEEDED")) {
pf5 pf5Var = new pf5();
pf5Var.a = this.b;
ConnectionsManager connectionsManager = ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d);
final String str = this.b;
final xp6 xp6Var = this.e;
final c0 c0Var = this.n;
final a0 a0Var = this.a;
connectionsManager.sendRequest(pf5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var2, ov5 ov5Var2) {
w6.m.a.this.h(str, xp6Var, c0Var, a0Var, i95Var2, ov5Var2);
}
});
return;
}
if (ov5Var.b.equals("PHONE_VERIFICATION_NEEDED")) {
final a0 a0Var2 = this.a;
final String str2 = this.b;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.m.a.i(w6.a0.this, ov5Var, str2);
}
});
return;
}
}
if (ov5Var != null || this.o == null) {
j(ov5Var, (aq6) i95Var, null);
return;
}
final aq6 aq6Var = (aq6) i95Var;
kf5 kf5Var = new kf5();
kf5Var.a = this.o;
kf5Var.b = w6.this.l1;
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(kf5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var2, ov5 ov5Var2) {
w6.m.a.this.j(aq6Var, i95Var2, ov5Var2);
}
});
}
}
m(ed5 ed5Var, boolean z, int i) {
this.a = ed5Var;
this.b = z;
this.c = i;
}
private ib5 e(SecureDocument secureDocument) {
if (secureDocument.inputFile == null) {
e26 e26Var = new e26();
qp6 qp6Var = secureDocument.secureFile;
e26Var.a = qp6Var.a;
e26Var.b = qp6Var.b;
return e26Var;
}
g26 g26Var = new g26();
py5 py5Var = secureDocument.inputFile;
g26Var.a = py5Var.a;
g26Var.b = py5Var.b;
g26Var.c = py5Var.d;
g26Var.d = secureDocument.fileHash;
g26Var.e = secureDocument.fileSecret;
return g26Var;
}
public void f(SecureDocument secureDocument, qp6 qp6Var) {
File pathToAttach = FileLoader.getPathToAttach(secureDocument);
String str = secureDocument.secureFile.d + "_" + secureDocument.secureFile.a;
File pathToAttach2 = FileLoader.getPathToAttach(qp6Var);
String str2 = qp6Var.d + "_" + qp6Var.a;
pathToAttach.renameTo(pathToAttach2);
ImageLoader.getInstance().replaceImageInCache(str, str2, null, false);
}
@Override
public void a(xp6 xp6Var, String str, String str2, xp6 xp6Var2, String str3, ArrayList<SecureDocument> arrayList, SecureDocument secureDocument, ArrayList<SecureDocument> arrayList2, SecureDocument secureDocument2, SecureDocument secureDocument3, Runnable runnable, a0 a0Var) {
h26 h26Var;
wp6 wp6Var;
h26 h26Var2;
if (!TextUtils.isEmpty(str2)) {
h26Var = new h26();
h26Var.b = xp6Var.e;
h26Var.a |= 1;
z h6 = w6.this.h6(AndroidUtilities.getStringBytes(str2));
pp6 pp6Var = new pp6();
h26Var.c = pp6Var;
pp6Var.a = h6.c;
pp6Var.b = h6.d;
pp6Var.c = h6.a;
} else if (TextUtils.isEmpty(str)) {
h26Var = null;
} else {
ed5 ed5Var = this.a;
if (ed5Var instanceof oq6) {
vp6 vp6Var = new vp6();
vp6Var.a = str;
wp6Var = vp6Var;
} else {
if (!(ed5Var instanceof uq6)) {
return;
}
wp6 wp6Var2 = new wp6();
wp6Var2.a = str;
wp6Var = wp6Var2;
}
h26 h26Var3 = new h26();
h26Var3.b = xp6Var.e;
h26Var3.a |= 32;
h26Var3.i = wp6Var;
h26Var = h26Var3;
}
if (!this.b && h26Var == null) {
if (a0Var != null) {
a0Var.a(null, null);
return;
}
return;
}
if (xp6Var2 != null) {
h26 h26Var4 = new h26();
h26Var4.b = xp6Var2.e;
if (!TextUtils.isEmpty(str3)) {
h26Var4.a |= 1;
z h62 = w6.this.h6(AndroidUtilities.getStringBytes(str3));
pp6 pp6Var2 = new pp6();
h26Var4.c = pp6Var2;
pp6Var2.a = h62.c;
pp6Var2.b = h62.d;
pp6Var2.c = h62.a;
}
if (secureDocument2 != null) {
h26Var4.d = e(secureDocument2);
h26Var4.a |= 2;
}
if (secureDocument3 != null) {
h26Var4.e = e(secureDocument3);
h26Var4.a |= 4;
}
if (secureDocument != null) {
h26Var4.f = e(secureDocument);
h26Var4.a |= 8;
}
if (arrayList2 != null && !arrayList2.isEmpty()) {
h26Var4.a |= 64;
int size = arrayList2.size();
for (int i = 0; i < size; i++) {
h26Var4.g.add(e(arrayList2.get(i)));
}
}
if (arrayList != null && !arrayList.isEmpty()) {
h26Var4.a |= 16;
int size2 = arrayList.size();
for (int i2 = 0; i2 < size2; i2++) {
h26Var4.h.add(e(arrayList.get(i2)));
}
}
if (!this.b) {
h26Var2 = h26Var4;
kf5 kf5Var = new kf5();
kf5Var.a = h26Var;
kf5Var.b = w6.this.l1;
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(kf5Var, new a(a0Var, str, kf5Var, xp6Var2, xp6Var, arrayList, secureDocument, secureDocument2, secureDocument3, arrayList2, str2, str3, runnable, this, h26Var2));
}
h26Var = h26Var4;
}
h26Var2 = null;
kf5 kf5Var2 = new kf5();
kf5Var2.a = h26Var;
kf5Var2.b = w6.this.l1;
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(kf5Var2, new a(a0Var, str, kf5Var2, xp6Var2, xp6Var, arrayList, secureDocument, secureDocument2, secureDocument3, arrayList2, str2, str3, runnable, this, h26Var2));
}
@Override
public void b(xp6 xp6Var, xp6 xp6Var2, ArrayList<xp6> arrayList, boolean z, Runnable runnable, a0 a0Var) {
w6.this.f6(xp6Var, xp6Var2, arrayList, z, runnable, a0Var, this.b);
}
@Override
public SecureDocument c(qp6 qp6Var) {
String str = FileLoader.getDirectory(4) + "/" + qp6Var.d + "_" + qp6Var.a + ".jpg";
z b6 = w6.this.b6(str);
return new SecureDocument(b6.e, qp6Var, str, b6.d, b6.a);
}
}
public class n extends AnimatorListenerAdapter {
final boolean a;
n(boolean z) {
this.a = z;
}
@Override
public void onAnimationCancel(Animator animator) {
if (w6.this.W == null || !w6.this.W.equals(animator)) {
return;
}
w6.this.W = null;
}
@Override
public void onAnimationEnd(Animator animator) {
if (w6.this.W == null || !w6.this.W.equals(animator)) {
return;
}
if (this.a) {
w6.this.V.getContentView().setVisibility(4);
} else {
w6.this.X.setVisibility(4);
}
}
}
public class o extends AnimatorListenerAdapter {
final boolean a;
o(boolean z) {
this.a = z;
}
@Override
public void onAnimationCancel(Animator animator) {
if (w6.this.W == null || !w6.this.W.equals(animator)) {
return;
}
w6.this.W = null;
}
@Override
public void onAnimationEnd(Animator animator) {
if (w6.this.W == null || !w6.this.W.equals(animator)) {
return;
}
if (this.a) {
w6.this.Y.setVisibility(4);
} else {
w6.this.Z.setVisibility(4);
}
}
}
public class p extends AnimatorListenerAdapter {
final pz4 a;
final pz4 b;
p(w6 w6Var, pz4 pz4Var, pz4 pz4Var2) {
this.a = pz4Var;
this.b = pz4Var2;
}
@Override
public void onAnimationEnd(Animator animator) {
this.b.setVisibility(8);
this.b.setX(0.0f);
}
@Override
public void onAnimationStart(Animator animator) {
this.a.setVisibility(0);
}
}
public class q implements ChatAttachAlert.x {
q() {
}
@Override
public void a(f27 f27Var) {
}
@Override
public boolean b() {
return false;
}
@Override
public void c() {
q60.a(this);
}
@Override
public void d() {
AndroidUtilities.hideKeyboard(((org.telegram.ui.ActionBar.k) w6.this).e.findFocus());
}
@Override
public void e(int i, boolean z, boolean z2, int i2, boolean z3) {
if (w6.this.c0() == null || w6.this.b1 == null) {
return;
}
if (i != 8 && i != 7) {
if (w6.this.b1 != null) {
w6.this.b1.dismissWithButtonClick(i);
}
w6.this.e8(i);
return;
}
if (i != 8) {
w6.this.b1.dismiss();
}
HashMap<Object, Object> selectedPhotos = w6.this.b1.W1().getSelectedPhotos();
ArrayList<Object> selectedPhotosOrder = w6.this.b1.W1().getSelectedPhotosOrder();
if (selectedPhotos.isEmpty()) {
return;
}
ArrayList arrayList = new ArrayList();
for (int i3 = 0; i3 < selectedPhotosOrder.size(); i3++) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) selectedPhotos.get(selectedPhotosOrder.get(i3));
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
String str = photoEntry.imagePath;
if (str == null) {
str = photoEntry.path;
}
sendingMediaInfo.path = str;
arrayList.add(sendingMediaInfo);
photoEntry.reset();
}
w6.this.f8(arrayList);
}
@Override
public void f(Runnable runnable) {
runnable.run();
}
}
class r implements Comparator<dd5> {
r() {
}
@Override
public int compare(dd5 dd5Var, dd5 dd5Var2) {
int b = b(dd5Var);
int b2 = b(dd5Var2);
if (b < b2) {
return -1;
}
return b > b2 ? 1 : 0;
}
int b(dd5 dd5Var) {
if (dd5Var instanceof bq6) {
return 0;
}
if (dd5Var instanceof fq6) {
return 1;
}
if (dd5Var instanceof gq6) {
return 2;
}
if (dd5Var instanceof hq6) {
return 3;
}
if (dd5Var instanceof iq6) {
return 4;
}
if (dd5Var instanceof jq6) {
return 5;
}
if (dd5Var instanceof dq6) {
return 6;
}
if (dd5Var instanceof eq6) {
return 7;
}
if (dd5Var instanceof cq6) {
return w6.this.m6(((cq6) dd5Var).c);
}
return 100;
}
}
public class s extends a.h {
class a extends org.telegram.ui.Components.z8 {
a(String str) {
super(str);
}
@Override
public void onClick(View view) {
w6.this.A();
super.onClick(view);
}
}
class b implements a0 {
final Runnable a;
b(Runnable runnable) {
this.a = runnable;
}
@Override
public void a(String str, String str2) {
if (!"PHONE_VERIFICATION_NEEDED".equals(str)) {
w6.this.o8(true, false);
} else {
w6 w6Var = w6.this;
w6Var.p8(true, str2, this.a, this, w6Var.L1);
}
}
}
s() {
}
public void j(String str, String str2, String str3, Runnable runnable, a0 a0Var, DialogInterface dialogInterface, int i) {
w6.this.i0[0].setText(str);
w6.this.i0[1].setText(str2);
w6.this.i0[2].setText(str3);
w6.this.o8(true, true);
q(runnable, a0Var);
}
public void k(int i, DialogInterface dialogInterface, int i2) {
w6 w6Var = w6.this;
w6Var.Y7(w6Var.i0[i]);
}
public int l(String str, String str2) {
int m6 = w6.this.m6(str);
int m62 = w6.this.m6(str2);
if (m6 < m62) {
return -1;
}
return m6 > m62 ? 1 : 0;
}
public int m(String str, String str2) {
int m6 = w6.this.m6(str);
int m62 = w6.this.m6(str2);
if (m6 < m62) {
return -1;
}
return m6 > m62 ? 1 : 0;
}
public void n() {
w6.this.D();
}
public void o(ov5 ov5Var, Runnable runnable, a0 a0Var, jg5 jg5Var) {
if (ov5Var == null) {
w6.this.L1.a(w6.this.I, (String) w6.this.C1.get("email"), null, null, null, null, null, null, null, null, runnable, a0Var);
} else {
org.telegram.ui.Components.b.l4(((org.telegram.ui.ActionBar.k) w6.this).d, ov5Var, w6.this, jg5Var, new Object[0]);
a0Var.a(null, null);
}
}
public void p(final Runnable runnable, final a0 a0Var, final jg5 jg5Var, i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.s.this.o(ov5Var, runnable, a0Var, jg5Var);
}
});
}
private boolean q(final Runnable runnable, final a0 a0Var) {
JSONObject jSONObject;
JSONObject jSONObject2;
String obj;
String obj2;
String obj3;
String obj4;
if (!w6.this.y1.isEmpty() || w6.this.M5()) {
return false;
}
if (w6.this.E0) {
w6.this.E0 = false;
boolean z = false;
for (final int i = 0; i < w6.this.D0.length; i++) {
if (w6.this.D0[i]) {
w6.this.i0[i].setErrorText(LocaleController.getString("PassportUseLatinOnly", R.string.PassportUseLatinOnly));
if (!z) {
if (w6.this.D0[0]) {
w6 w6Var = w6.this;
obj2 = w6Var.s6(w6Var.k0[0].getText().toString());
} else {
obj2 = w6.this.i0[0].getText().toString();
}
final String str = obj2;
if (w6.this.D0[1]) {
w6 w6Var2 = w6.this;
obj3 = w6Var2.s6(w6Var2.k0[1].getText().toString());
} else {
obj3 = w6.this.i0[1].getText().toString();
}
final String str2 = obj3;
if (w6.this.D0[2]) {
w6 w6Var3 = w6.this;
obj4 = w6Var3.s6(w6Var3.k0[2].getText().toString());
} else {
obj4 = w6.this.i0[2].getText().toString();
}
final String str3 = obj4;
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2) || TextUtils.isEmpty(str3)) {
w6 w6Var4 = w6.this;
w6Var4.Y7(w6Var4.i0[i]);
} else {
i.C0142i c0142i = new i.C0142i(w6.this.c0());
c0142i.l(LocaleController.formatString("PassportNameCheckAlert", R.string.PassportNameCheckAlert, str, str2, str3));
c0142i.u(LocaleController.getString("AppName", R.string.AppName));
c0142i.s(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
w6.s.this.j(str, str2, str3, runnable, a0Var, dialogInterface, i2);
}
});
c0142i.n(LocaleController.getString("Edit", R.string.Edit), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
w6.s.this.k(i, dialogInterface, i2);
}
});
w6.this.o1(c0142i.a());
}
z = true;
}
}
}
if (z) {
return false;
}
}
if (w6.this.y6()) {
w6.this.D();
return false;
}
SecureDocument secureDocument = null;
try {
if (w6.this.F0) {
jSONObject = null;
} else {
HashMap hashMap = new HashMap(w6.this.C1);
if (w6.this.I.b) {
if (w6.this.A0.getVisibility() == 0) {
hashMap.put("first_name_native", w6.this.k0[0].getText().toString());
hashMap.put("middle_name_native", w6.this.k0[1].getText().toString());
obj = w6.this.k0[2].getText().toString();
} else {
hashMap.put("first_name_native", w6.this.i0[0].getText().toString());
hashMap.put("middle_name_native", w6.this.i0[1].getText().toString());
obj = w6.this.i0[2].getText().toString();
}
hashMap.put("last_name_native", obj);
}
hashMap.put("first_name", w6.this.i0[0].getText().toString());
hashMap.put("middle_name", w6.this.i0[1].getText().toString());
hashMap.put("last_name", w6.this.i0[2].getText().toString());
hashMap.put("birth_date", w6.this.i0[3].getText().toString());
hashMap.put("gender", w6.this.B);
hashMap.put("country_code", w6.this.z);
hashMap.put("residence_country_code", w6.this.A);
jSONObject = new JSONObject();
try {
ArrayList arrayList = new ArrayList(hashMap.keySet());
Collections.sort(arrayList, new Comparator() {
@Override
public final int compare(Object obj5, Object obj6) {
int l;
l = w6.s.this.l((String) obj5, (String) obj6);
return l;
}
});
int size = arrayList.size();
for (int i2 = 0; i2 < size; i2++) {
String str4 = (String) arrayList.get(i2);
jSONObject.put(str4, hashMap.get(str4));
}
} catch (Exception unused) {
}
}
} catch (Exception unused2) {
jSONObject = null;
jSONObject2 = null;
}
if (w6.this.J != null) {
HashMap hashMap2 = new HashMap(w6.this.D1);
hashMap2.put("document_no", w6.this.i0[7].getText().toString());
hashMap2.put("expiry_date", w6.this.G[0] != 0 ? String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(w6.this.G[2]), Integer.valueOf(w6.this.G[1]), Integer.valueOf(w6.this.G[0])) : BuildConfig.FLAVOR);
jSONObject2 = new JSONObject();
try {
ArrayList arrayList2 = new ArrayList(hashMap2.keySet());
Collections.sort(arrayList2, new Comparator() {
@Override
public final int compare(Object obj5, Object obj6) {
int m;
m = w6.s.this.m((String) obj5, (String) obj6);
return m;
}
});
int size2 = arrayList2.size();
for (int i3 = 0; i3 < size2; i3++) {
String str5 = (String) arrayList2.get(i3);
jSONObject2.put(str5, hashMap2.get(str5));
}
} catch (Exception unused3) {
}
if (w6.this.G1 != null) {
w6.this.G1.clear();
}
if (w6.this.H1 != null) {
w6.this.H1.clear();
}
c0 c0Var = w6.this.L1;
xp6 xp6Var = w6.this.I;
String jSONObject3 = jSONObject == null ? jSONObject.toString() : null;
xp6 xp6Var2 = w6.this.J;
String jSONObject4 = jSONObject2 == null ? jSONObject2.toString() : null;
SecureDocument secureDocument2 = w6.this.t1;
ArrayList<SecureDocument> arrayList3 = w6.this.u1;
SecureDocument secureDocument3 = w6.this.v1;
if (w6.this.p0 != null && w6.this.p0.getVisibility() == 0) {
secureDocument = w6.this.w1;
}
c0Var.a(xp6Var, null, jSONObject3, xp6Var2, jSONObject4, null, secureDocument2, arrayList3, secureDocument3, secureDocument, runnable, a0Var);
return true;
}
jSONObject2 = null;
if (w6.this.G1 != null) {
}
if (w6.this.H1 != null) {
}
c0 c0Var2 = w6.this.L1;
xp6 xp6Var3 = w6.this.I;
if (jSONObject == null) {
}
xp6 xp6Var22 = w6.this.J;
if (jSONObject2 == null) {
}
SecureDocument secureDocument22 = w6.this.t1;
ArrayList<SecureDocument> arrayList32 = w6.this.u1;
SecureDocument secureDocument32 = w6.this.v1;
if (w6.this.p0 != null) {
secureDocument = w6.this.w1;
}
c0Var2.a(xp6Var3, null, jSONObject3, xp6Var22, jSONObject4, null, secureDocument22, arrayList32, secureDocument32, secureDocument, runnable, a0Var);
return true;
}
@Override
public void b(int i) {
JSONObject jSONObject;
xp6 xp6Var;
String str;
String jSONObject2;
xp6 xp6Var2;
String str2;
ArrayList<SecureDocument> arrayList;
SecureDocument secureDocument;
ArrayList<SecureDocument> arrayList2;
SecureDocument secureDocument2;
SecureDocument secureDocument3;
c0 c0Var;
String str3;
if (i == -1) {
if (w6.this.K5()) {
return;
}
if (w6.this.r == 0 || w6.this.r == 5) {
w6.this.J5(false);
}
w6.this.D();
return;
}
if (i == 1) {
if (w6.this.c0() == null) {
return;
}
TextView textView = new TextView(w6.this.c0());
String string = LocaleController.getString("PassportInfo2", R.string.PassportInfo2);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
int indexOf = string.indexOf(42);
int lastIndexOf = string.lastIndexOf(42);
if (indexOf != -1 && lastIndexOf != -1) {
spannableStringBuilder.replace(lastIndexOf, lastIndexOf + 1, (CharSequence) BuildConfig.FLAVOR);
spannableStringBuilder.replace(indexOf, indexOf + 1, (CharSequence) BuildConfig.FLAVOR);
spannableStringBuilder.setSpan(new a(LocaleController.getString("PassportInfoUrl", R.string.PassportInfoUrl)), indexOf, lastIndexOf - 1, 33);
}
textView.setText(spannableStringBuilder);
textView.setTextSize(1, 16.0f);
textView.setLinkTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextLink"));
textView.setHighlightColor(org.telegram.ui.ActionBar.w.r1("dialogLinkSelection"));
textView.setPadding(AndroidUtilities.dp(23.0f), 0, AndroidUtilities.dp(23.0f), 0);
textView.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
textView.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"));
i.C0142i c0142i = new i.C0142i(w6.this.c0());
c0142i.A(textView);
c0142i.u(LocaleController.getString("PassportInfoTitle", R.string.PassportInfoTitle));
c0142i.n(LocaleController.getString("Close", R.string.Close), null);
w6.this.o1(c0142i.a());
return;
}
if (i == 2) {
if (w6.this.r == 5) {
w6.this.a8(false);
return;
}
if (w6.this.r == 7) {
w6.this.T1[w6.this.S1].f(null);
return;
}
final Runnable runnable = new Runnable() {
@Override
public final void run() {
w6.s.this.n();
}
};
final b bVar = new b(runnable);
if (w6.this.r == 4) {
if (w6.this.v) {
str3 = w6.this.n1;
} else if (w6.this.M5()) {
return;
} else {
str3 = w6.this.i0[0].getText().toString();
}
} else {
if (w6.this.r != 3) {
if (w6.this.r != 2) {
if (w6.this.r == 1) {
if (!q(runnable, bVar)) {
return;
}
} else if (w6.this.r == 6) {
final jg5 jg5Var = new jg5();
jg5Var.a = (String) w6.this.C1.get("email");
jg5Var.b = w6.this.i0[0].getText().toString();
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).bindRequestToGuid(ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(jg5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.s.this.p(runnable, bVar, jg5Var, i95Var, ov5Var);
}
}), ((org.telegram.ui.ActionBar.k) w6.this).k);
}
w6.this.o8(true, true);
}
if (!w6.this.y1.isEmpty() || w6.this.M5()) {
return;
}
if (w6.this.y6()) {
w6.this.D();
return;
}
if (!w6.this.F0) {
jSONObject = new JSONObject();
try {
jSONObject.put("street_line1", w6.this.i0[0].getText().toString());
jSONObject.put("street_line2", w6.this.i0[1].getText().toString());
jSONObject.put("post_code", w6.this.i0[2].getText().toString());
jSONObject.put("city", w6.this.i0[3].getText().toString());
jSONObject.put("state", w6.this.i0[4].getText().toString());
jSONObject.put("country_code", w6.this.z);
} catch (Exception unused) {
}
if (w6.this.G1 != null) {
w6.this.G1.clear();
}
if (w6.this.H1 != null) {
w6.this.H1.clear();
}
c0 c0Var2 = w6.this.L1;
xp6Var = w6.this.I;
str = null;
jSONObject2 = jSONObject != null ? jSONObject.toString() : null;
xp6Var2 = w6.this.J;
str2 = null;
arrayList = w6.this.s1;
secureDocument = w6.this.t1;
arrayList2 = w6.this.u1;
secureDocument2 = null;
secureDocument3 = null;
c0Var = c0Var2;
c0Var.a(xp6Var, str, jSONObject2, xp6Var2, str2, arrayList, secureDocument, arrayList2, secureDocument2, secureDocument3, runnable, bVar);
w6.this.o8(true, true);
}
jSONObject = null;
if (w6.this.G1 != null) {
}
if (w6.this.H1 != null) {
}
c0 c0Var22 = w6.this.L1;
xp6Var = w6.this.I;
str = null;
jSONObject2 = jSONObject != null ? jSONObject.toString() : null;
xp6Var2 = w6.this.J;
str2 = null;
arrayList = w6.this.s1;
secureDocument = w6.this.t1;
arrayList2 = w6.this.u1;
secureDocument2 = null;
secureDocument3 = null;
c0Var = c0Var22;
c0Var.a(xp6Var, str, jSONObject2, xp6Var2, str2, arrayList, secureDocument, arrayList2, secureDocument2, secureDocument3, runnable, bVar);
w6.this.o8(true, true);
}
if (w6.this.v) {
str3 = UserConfig.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).getCurrentUser().f;
} else {
if (w6.this.M5()) {
return;
}
str3 = w6.this.i0[1].getText().toString() + w6.this.i0[2].getText().toString();
}
}
str = str3;
c0Var = w6.this.L1;
xp6Var = w6.this.I;
jSONObject2 = null;
xp6Var2 = null;
str2 = null;
arrayList = null;
secureDocument = null;
arrayList2 = null;
secureDocument2 = null;
secureDocument3 = null;
c0Var.a(xp6Var, str, jSONObject2, xp6Var2, str2, arrayList, secureDocument, arrayList2, secureDocument2, secureDocument3, runnable, bVar);
w6.this.o8(true, true);
}
}
}
class t extends ScrollView {
t(Context context) {
super(context);
}
@Override
protected void onMeasure(int i, int i2) {
w6.this.C0 = View.MeasureSpec.getSize(i2) - AndroidUtilities.dp(30.0f);
super.onMeasure(i, i2);
}
@Override
protected boolean onRequestFocusInDescendants(int i, Rect rect) {
return false;
}
@Override
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
if (w6.this.S1 == 1 || w6.this.S1 == 2 || w6.this.S1 == 4) {
rect.bottom += AndroidUtilities.dp(40.0f);
}
return super.requestChildRectangleOnScreen(view, rect, z);
}
}
class u extends ScrollView {
u(w6 w6Var, Context context) {
super(context);
}
@Override
protected boolean onRequestFocusInDescendants(int i, Rect rect) {
return false;
}
@Override
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
rect.offset(view.getLeft() - view.getScrollX(), view.getTop() - view.getScrollY());
rect.top += AndroidUtilities.dp(20.0f);
rect.bottom += AndroidUtilities.dp(50.0f);
return super.requestChildRectangleOnScreen(view, rect, z);
}
}
public class v implements TextWatcher {
v() {
}
@Override
public void afterTextChanged(Editable editable) {
if (w6.this.j1 || w6.this.d1 == 0 || w6.this.i0[0].length() != w6.this.d1) {
return;
}
w6.this.V.callOnClick();
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
public class w implements ActionMode.Callback {
w(w6 w6Var) {
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
return false;
}
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
return false;
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
}
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
return false;
}
}
public class x implements RequestDelegate {
final boolean a;
final byte[] b;
final je5 c;
final String d;
x(boolean z, byte[] bArr, je5 je5Var, String str) {
this.a = z;
this.b = bArr;
this.c = je5Var;
this.d = str;
}
public void A(i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.x.this.z(ov5Var);
}
});
}
public void B(final boolean z, final i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.x.this.I(ov5Var, i95Var, z);
}
});
}
public void C() {
org.telegram.ui.Components.b.E4(w6.this.c0(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
}
public void D(i95 i95Var, ov5 ov5Var) {
if (i95Var == null) {
if ("APP_VERSION_OUTDATED".equals(ov5Var.b)) {
org.telegram.ui.Components.b.E4(w6.this.c0(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
} else {
w6.this.m8(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
}
w6.this.o8(true, false);
return;
}
w6.this.H = new ld5();
j27 j27Var = (j27) i95Var;
int size = j27Var.a.size();
for (int i = 0; i < size; i++) {
w6.this.H.c.add((aq6) j27Var.a.get(i));
}
J();
}
public void E(final i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.x.this.D(i95Var, ov5Var);
}
});
}
public void F(ve5 ve5Var, boolean z, byte[] bArr) {
w6.this.n1 = ve5Var.b;
if (z) {
w6 w6Var = w6.this;
w6Var.o1 = w6Var.Z0;
}
w6 w6Var2 = w6.this;
if (w6.O5(w6Var2.d6(w6Var2.m1, w6.this.o1), Long.valueOf(w6.this.l1)) && bArr.length != 0 && w6.this.l1 != 0) {
if (w6.this.s != 0) {
J();
return;
} else {
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(new zd5(), new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.x.this.E(i95Var, ov5Var);
}
});
return;
}
}
w6 w6Var3 = w6.this;
if (z) {
UserConfig.getInstance(((org.telegram.ui.ActionBar.k) w6Var3).d).resetSavedPassword();
w6.this.X0 = 0;
w6.this.s8();
return;
}
if (w6Var3.H != null) {
w6.this.H.c.clear();
w6.this.H.d.clear();
}
if (w6.this.m1 == null || w6.this.m1.length == 0) {
r();
} else {
K();
}
}
public void G(i95 i95Var, String str, final boolean z) {
final byte[] bArr;
final ve5 ve5Var = (ve5) i95Var;
zp6 zp6Var = ve5Var.c;
if (zp6Var != null) {
w6.this.m1 = zp6Var.b;
w6.this.l1 = ve5Var.c.c;
ad5 ad5Var = ve5Var.c.a;
if (ad5Var instanceof tp6) {
bArr = ((tp6) ad5Var).a;
w6.this.o1 = Utilities.computeSHA512(bArr, AndroidUtilities.getStringBytes(str), bArr);
} else if (ad5Var instanceof sp6) {
sp6 sp6Var = (sp6) ad5Var;
byte[] bArr2 = sp6Var.a;
w6.this.o1 = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), sp6Var.a);
bArr = bArr2;
} else {
if (ad5Var instanceof up6) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.x.this.C();
}
});
return;
}
bArr = new byte[0];
}
} else {
if (w6.this.T.k instanceof sp6) {
sp6 sp6Var2 = (sp6) w6.this.T.k;
byte[] bArr3 = sp6Var2.a;
w6.this.o1 = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), sp6Var2.a);
bArr = bArr3;
} else {
bArr = new byte[0];
}
w6.this.m1 = null;
w6.this.l1 = 0L;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.x.this.F(ve5Var, z, bArr);
}
});
}
public void H(boolean z, ov5 ov5Var) {
String str;
if (z) {
UserConfig.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).resetSavedPassword();
w6.this.X0 = 0;
w6.this.s8();
if (w6.this.j0 == null || w6.this.j0[0].getVisibility() != 0) {
return;
}
w6.this.i0[0].requestFocus();
AndroidUtilities.showKeyboard(w6.this.i0[0]);
return;
}
w6.this.o8(true, false);
if (ov5Var.b.equals("PASSWORD_HASH_INVALID")) {
w6.this.Z7(true);
return;
}
if (!ov5Var.b.startsWith("FLOOD_WAIT")) {
w6.this.m8(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
return;
}
int intValue = Utilities.parseInt(ov5Var.b).intValue();
if (intValue < 60) {
str = "Seconds";
} else {
intValue /= 60;
str = "Minutes";
}
w6.this.m8(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, LocaleController.formatPluralString(str, intValue)));
}
public void I(ov5 ov5Var, i95 i95Var, boolean z) {
if (ov5Var == null) {
w6.this.T = (te5) i95Var;
hf.u2(w6.this.T);
w6.this.a8(z);
}
}
private void J() {
if (w6.this.i0 == null) {
return;
}
if (!this.a) {
UserConfig.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).savePassword(this.b, w6.this.o1);
}
AndroidUtilities.hideKeyboard(w6.this.i0[0]);
w6.this.p1 = true;
w6 w6Var = new w6(w6.this.s == 0 ? 8 : 0, w6.this.s, w6.this.w, w6.this.y, w6.this.t, w6.this.u, w6.this.x, w6.this.H, w6.this.T);
w6Var.n1 = w6.this.n1;
((org.telegram.ui.ActionBar.k) w6Var).d = ((org.telegram.ui.ActionBar.k) w6.this).d;
w6Var.o1 = w6.this.o1;
w6Var.m1 = w6.this.m1;
w6Var.l1 = w6.this.l1;
w6Var.M1 = w6.this.M1;
if (((org.telegram.ui.ActionBar.k) w6.this).f == null || !((org.telegram.ui.ActionBar.k) w6.this).f.U()) {
w6.this.T0(w6Var, true);
} else {
w6.this.r1 = w6Var;
}
}
private void K() {
cg5 cg5Var = new cg5();
if (w6.this.T.e instanceof bk6) {
cg5Var.a = SRPHelper.startCheck(this.b, w6.this.T.g, w6.this.T.f, (bk6) w6.this.T.e);
}
ue5 ue5Var = new ue5();
cg5Var.b = ue5Var;
ue5Var.f = new zp6();
zp6 zp6Var = cg5Var.b.f;
zp6Var.b = new byte[0];
zp6Var.a = new up6();
ue5 ue5Var2 = cg5Var.b;
ue5Var2.f.c = 0L;
ue5Var2.a |= 4;
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(this.c, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.x.this.A(i95Var, ov5Var);
}
});
}
private void r() {
DispatchQueue dispatchQueue = Utilities.globalQueue;
final byte[] bArr = this.b;
final String str = this.d;
dispatchQueue.postRunnable(new Runnable() {
@Override
public final void run() {
w6.x.this.w(bArr, str);
}
});
}
public void s(ov5 ov5Var, i95 i95Var) {
if (ov5Var == null) {
w6.this.T = (te5) i95Var;
hf.u2(w6.this.T);
r();
}
}
public void t(final i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.x.this.s(ov5Var, i95Var);
}
});
}
public void u(ov5 ov5Var) {
if (ov5Var != null && "SRP_ID_INVALID".equals(ov5Var.b)) {
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(new ie5(), new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var2) {
w6.x.this.t(i95Var, ov5Var2);
}
}, 8);
} else {
if (w6.this.H == null) {
w6.this.H = new ld5();
}
J();
}
}
public void v(i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.x.this.u(ov5Var);
}
});
}
public void w(byte[] bArr, String str) {
Utilities.random.setSeed(w6.this.T.l);
cg5 cg5Var = new cg5();
if (w6.this.T.e instanceof bk6) {
cg5Var.a = SRPHelper.startCheck(bArr, w6.this.T.g, w6.this.T.f, (bk6) w6.this.T.e);
}
cg5Var.b = new ue5();
w6 w6Var = w6.this;
w6Var.m1 = w6Var.p6();
w6 w6Var2 = w6.this;
w6Var2.l1 = Utilities.bytesToLong(Utilities.computeSHA256(w6Var2.m1));
if (w6.this.T.k instanceof sp6) {
sp6 sp6Var = (sp6) w6.this.T.k;
w6.this.o1 = Utilities.computePBKDF2(AndroidUtilities.getStringBytes(str), sp6Var.a);
byte[] bArr2 = new byte[32];
System.arraycopy(w6.this.o1, 0, bArr2, 0, 32);
byte[] bArr3 = new byte[16];
System.arraycopy(w6.this.o1, 32, bArr3, 0, 16);
Utilities.aesCbcEncryptionByteArraySafe(w6.this.m1, bArr2, bArr3, 0, w6.this.m1.length, 0, 1);
cg5Var.b.f = new zp6();
zp6 zp6Var = cg5Var.b.f;
zp6Var.a = sp6Var;
zp6Var.b = w6.this.m1;
cg5Var.b.f.c = w6.this.l1;
cg5Var.b.a |= 4;
}
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(cg5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.x.this.v(i95Var, ov5Var);
}
});
}
public void x(ov5 ov5Var, i95 i95Var) {
if (ov5Var == null) {
w6.this.T = (te5) i95Var;
hf.u2(w6.this.T);
K();
}
}
public void y(final i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.x.this.x(ov5Var, i95Var);
}
});
}
public void z(ov5 ov5Var) {
if (ov5Var == null || !"SRP_ID_INVALID".equals(ov5Var.b)) {
r();
} else {
ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d).sendRequest(new ie5(), new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var2) {
w6.x.this.y(i95Var, ov5Var2);
}
}, 8);
}
}
@Override
public void run(final i95 i95Var, final ov5 ov5Var) {
if (ov5Var != null && "SRP_ID_INVALID".equals(ov5Var.b)) {
ie5 ie5Var = new ie5();
ConnectionsManager connectionsManager = ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) w6.this).d);
final boolean z = this.a;
connectionsManager.sendRequest(ie5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var2, ov5 ov5Var2) {
w6.x.this.B(z, i95Var2, ov5Var2);
}
}, 8);
return;
}
if (ov5Var != null) {
final boolean z2 = this.a;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.x.this.H(z2, ov5Var);
}
});
} else {
DispatchQueue dispatchQueue = Utilities.globalQueue;
final String str = this.d;
final boolean z3 = this.a;
dispatchQueue.postRunnable(new Runnable() {
@Override
public final void run() {
w6.x.this.G(i95Var, str, z3);
}
});
}
}
}
public class y implements TextWatcher {
y() {
}
@Override
public void afterTextChanged(Editable editable) {
String str;
boolean z;
boolean z2;
int indexOf;
if (w6.this.j1) {
return;
}
w6.this.j1 = true;
String h = uw3.h(w6.this.i0[1].getText().toString());
w6.this.i0[1].setText(h);
cs1 cs1Var = (cs1) w6.this.i0[2];
if (h.length() == 0) {
cs1Var.setHintText((String) null);
cs1Var.setHint(LocaleController.getString("PaymentShippingPhoneNumber", R.string.PaymentShippingPhoneNumber));
w6.this.i0[0].setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
} else {
int i = 4;
if (h.length() > 4) {
while (true) {
if (i < 1) {
str = null;
z = false;
break;
}
String substring = h.substring(0, i);
if (((String) w6.this.g1.get(substring)) != null) {
String str2 = h.substring(i) + w6.this.i0[2].getText().toString();
w6.this.i0[1].setText(substring);
z = true;
str = str2;
h = substring;
break;
}
i--;
}
if (!z) {
str = h.substring(1) + w6.this.i0[2].getText().toString();
EditTextBoldCursor editTextBoldCursor = w6.this.i0[1];
h = h.substring(0, 1);
editTextBoldCursor.setText(h);
}
} else {
str = null;
z = false;
}
String str3 = (String) w6.this.g1.get(h);
if (str3 == null || (indexOf = w6.this.e1.indexOf(str3)) == -1) {
z2 = false;
} else {
w6.this.i0[0].setText((CharSequence) w6.this.e1.get(indexOf));
String str4 = (String) w6.this.h1.get(h);
if (str4 != null) {
cs1Var.setHintText(str4.replace('X', (char) 8211));
cs1Var.setHint((CharSequence) null);
}
z2 = true;
}
if (!z2) {
cs1Var.setHintText((String) null);
cs1Var.setHint(LocaleController.getString("PaymentShippingPhoneNumber", R.string.PaymentShippingPhoneNumber));
w6.this.i0[0].setText(LocaleController.getString("WrongCountry", R.string.WrongCountry));
}
if (!z) {
w6.this.i0[1].setSelection(w6.this.i0[1].getText().length());
}
if (str != null) {
cs1Var.requestFocus();
cs1Var.setText(str);
cs1Var.setSelection(cs1Var.length());
}
}
w6.this.j1 = false;
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
public static class z {
byte[] a;
byte[] b;
byte[] c;
byte[] d;
SecureDocumentKey e;
public z(byte[] bArr, byte[] bArr2, byte[] bArr3, byte[] bArr4, byte[] bArr5, byte[] bArr6) {
this.c = bArr;
this.a = bArr2;
this.d = bArr4;
this.b = bArr3;
this.e = new SecureDocumentKey(bArr5, bArr6);
}
}
public w6(int i2, long j2, String str, String str2, String str3, String str4, String str5, ld5 ld5Var, te5 te5Var) {
this(i2, ld5Var, te5Var, (xp6) null, (aq6) null, (xp6) null, (aq6) null, (HashMap<String, String>) null, (HashMap<String, String>) null);
int i3;
boolean z2;
String o6;
String str6;
byte[] bArr;
String str7;
String str8;
HashMap<String, String> hashMap;
char c2;
String str9;
StringBuilder sb;
this.s = j2;
this.t = str3;
this.u = str4;
this.w = str;
this.y = str2;
this.x = str5;
if (i2 != 0 || ld5Var.d.isEmpty()) {
return;
}
try {
Collections.sort(ld5Var.d, new r());
int size = ld5Var.d.size();
int i4 = 0;
while (i4 < size) {
dd5 dd5Var = ld5Var.d.get(i4);
String str10 = null;
str10 = null;
str10 = null;
str10 = null;
str10 = null;
r6 = null;
str10 = null;
byte[] bArr2 = null;
if (dd5Var instanceof fq6) {
fq6 fq6Var = (fq6) dd5Var;
o6 = o6(fq6Var.a);
str6 = fq6Var.c;
bArr = fq6Var.b;
str7 = "front";
} else if (dd5Var instanceof gq6) {
gq6 gq6Var = (gq6) dd5Var;
o6 = o6(gq6Var.a);
str6 = gq6Var.c;
bArr = gq6Var.b;
str7 = "reverse";
} else if (dd5Var instanceof hq6) {
hq6 hq6Var = (hq6) dd5Var;
o6 = o6(hq6Var.a);
str6 = hq6Var.c;
bArr = hq6Var.b;
str7 = "selfie";
} else if (dd5Var instanceof iq6) {
iq6 iq6Var = (iq6) dd5Var;
o6 = o6(iq6Var.a);
str6 = iq6Var.c;
bArr = iq6Var.b;
str7 = "translation";
} else {
if (dd5Var instanceof jq6) {
jq6 jq6Var = (jq6) dd5Var;
o6 = o6(jq6Var.a);
str6 = jq6Var.c;
str8 = null;
str7 = "translation";
} else if (dd5Var instanceof dq6) {
dq6 dq6Var = (dq6) dd5Var;
o6 = o6(dq6Var.a);
str6 = dq6Var.c;
bArr = dq6Var.b;
str7 = "files";
} else if (dd5Var instanceof eq6) {
eq6 eq6Var = (eq6) dd5Var;
o6 = o6(eq6Var.a);
str6 = eq6Var.c;
str8 = null;
str7 = "files";
} else if (dd5Var instanceof bq6) {
bq6 bq6Var = (bq6) dd5Var;
o6 = o6(bq6Var.a);
str6 = bq6Var.c;
bArr = bq6Var.b;
str7 = "error_all";
} else {
if (dd5Var instanceof cq6) {
cq6 cq6Var = (cq6) dd5Var;
int i5 = 0;
while (true) {
if (i5 < ld5Var.c.size()) {
pp6 pp6Var = ld5Var.c.get(i5).c;
if (pp6Var == null || !Arrays.equals(pp6Var.b, cq6Var.b)) {
i5++;
} else {
z2 = true;
}
} else {
z2 = false;
}
}
if (z2) {
o6 = o6(cq6Var.a);
str6 = cq6Var.d;
str10 = cq6Var.c;
bArr = cq6Var.b;
str7 = com.batch.android.module.k.g;
}
}
i3 = size;
i4++;
size = i3;
}
hashMap = this.E1.get(o6);
if (hashMap != null) {
hashMap = new HashMap<>();
i3 = size;
this.E1.put(o6, hashMap);
this.F1.put(o6, str6);
} else {
i3 = size;
}
c2 = 2;
String encodeToString = bArr2 == null ? Base64.encodeToString(bArr2, 2) : BuildConfig.FLAVOR;
switch (str7.hashCode()) {
case -1840647503:
if (str7.equals("translation")) {
c2 = 3;
break;
}
break;
case -906020504:
if (str7.equals("selfie")) {
break;
}
break;
case 3076010:
if (str7.equals(com.batch.android.module.k.g)) {
c2 = 0;
break;
}
break;
case 97434231:
if (str7.equals("files")) {
c2 = 1;
break;
}
break;
case 97705513:
if (str7.equals("front")) {
c2 = 4;
break;
}
break;
case 329856746:
if (str7.equals("error_all")) {
c2 = 6;
break;
}
break;
case 1099846370:
if (str7.equals("reverse")) {
c2 = 5;
break;
}
break;
}
c2 = 65535;
switch (c2) {
case 0:
if (str8 == null) {
break;
} else {
hashMap.put(str8, str6);
break;
}
case 1:
if (bArr2 != null) {
sb = new StringBuilder();
sb.append("files");
sb.append(encodeToString);
str9 = sb.toString();
hashMap.put(str9, str6);
break;
} else {
str9 = "files_all";
hashMap.put(str9, str6);
}
case 2:
sb = new StringBuilder();
sb.append("selfie");
sb.append(encodeToString);
str9 = sb.toString();
hashMap.put(str9, str6);
break;
case 3:
if (bArr2 != null) {
sb = new StringBuilder();
sb.append("translation");
sb.append(encodeToString);
str9 = sb.toString();
hashMap.put(str9, str6);
break;
} else {
str9 = "translation_all";
hashMap.put(str9, str6);
}
case 4:
sb = new StringBuilder();
sb.append("front");
sb.append(encodeToString);
str9 = sb.toString();
hashMap.put(str9, str6);
break;
case 5:
sb = new StringBuilder();
sb.append("reverse");
sb.append(encodeToString);
str9 = sb.toString();
hashMap.put(str9, str6);
break;
case 6:
hashMap.put("error_all", str6);
break;
}
i4++;
size = i3;
}
String str11 = str10;
bArr2 = bArr;
str8 = str11;
hashMap = this.E1.get(o6);
if (hashMap != null) {
}
c2 = 2;
if (bArr2 == null) {
}
switch (str7.hashCode()) {
case -1840647503:
break;
case -906020504:
break;
case 3076010:
break;
case 97434231:
break;
case 97705513:
break;
case 329856746:
break;
case 1099846370:
break;
}
c2 = 65535;
switch (c2) {
}
i4++;
size = i3;
}
} catch (Exception unused) {
}
}
public w6(int i2, ld5 ld5Var, te5 te5Var, xp6 xp6Var, aq6 aq6Var, xp6 xp6Var2, aq6 aq6Var2, HashMap<String, String> hashMap, HashMap<String, String> hashMap2) {
this.z = BuildConfig.FLAVOR;
this.A = BuildConfig.FLAVOR;
this.G = new int[3];
this.u0 = new ArrayList<>();
this.D0 = new boolean[3];
this.E0 = true;
this.e1 = new ArrayList<>();
this.f1 = new HashMap<>();
this.g1 = new HashMap<>();
this.h1 = new HashMap<>();
this.s1 = new ArrayList<>();
this.u1 = new ArrayList<>();
this.x1 = new HashMap<>();
this.y1 = new HashMap<>();
this.z1 = new HashMap<>();
this.A1 = new HashMap<>();
this.B1 = new HashMap<>();
this.E1 = new HashMap<>();
this.F1 = new HashMap<>();
this.I1 = new HashMap<>();
this.N1 = new k();
this.r = i2;
this.H = ld5Var;
this.I = xp6Var;
if (xp6Var != null) {
this.E0 = xp6Var.b;
}
this.R = aq6Var;
this.J = xp6Var2;
this.S = aq6Var2;
this.T = te5Var;
this.C1 = hashMap;
this.D1 = hashMap2;
if (i2 == 3) {
this.W1 = new ArrayList<>();
} else if (i2 == 7) {
this.T1 = new pz4[3];
}
if (this.C1 == null) {
this.C1 = new HashMap<>();
}
if (this.D1 == null) {
this.D1 = new HashMap<>();
}
if (i2 == 5) {
if (UserConfig.getInstance(this.d).savedPasswordHash != null && UserConfig.getInstance(this.d).savedSaltedPassword != null) {
this.X0 = 1;
this.Y0 = UserConfig.getInstance(this.d).savedPasswordHash;
this.Z0 = UserConfig.getInstance(this.d).savedSaltedPassword;
}
te5 te5Var2 = this.T;
if (te5Var2 == null) {
V7();
} else {
hf.u2(te5Var2);
if (this.X0 == 1) {
a8(true);
}
}
if (SharedConfig.isPassportConfigLoaded()) {
return;
}
ax5 ax5Var = new ax5();
ax5Var.a = SharedConfig.passportConfigHash;
ConnectionsManager.getInstance(this.d).sendRequest(ax5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
org.telegram.ui.w6.K7(i95Var, ov5Var);
}
});
}
}
public void A6(int i2, View view) {
PhotoViewer L7;
ArrayList<SecureDocument> arrayList;
ArrayList<SecureDocument> arrayList2;
SecureDocument secureDocument;
this.c1 = i2;
this.s0 = i2 == 1 ? this.q0 : i2 == 4 ? this.r0 : i2 == 2 ? this.o0 : i2 == 3 ? this.p0 : this.n0;
SecureDocument secureDocument2 = (SecureDocument) view.getTag();
PhotoViewer.L7().Ja(c0());
if (i2 == 1) {
arrayList2 = new ArrayList<>();
secureDocument = this.t1;
} else if (i2 == 2) {
arrayList2 = new ArrayList<>();
secureDocument = this.v1;
} else {
if (i2 != 3) {
if (i2 == 0) {
L7 = PhotoViewer.L7();
arrayList = this.s1;
} else {
L7 = PhotoViewer.L7();
arrayList = this.u1;
}
L7.W9(arrayList, arrayList.indexOf(secureDocument2), this.N1);
return;
}
arrayList2 = new ArrayList<>();
secureDocument = this.w1;
}
arrayList2.add(secureDocument);
PhotoViewer.L7().W9(arrayList2, 0, this.N1);
}
public boolean A7(TextView textView, int i2, KeyEvent keyEvent) {
if (i2 == 5) {
this.i0[2].requestFocus();
return true;
}
if (i2 != 6) {
return false;
}
this.V.callOnClick();
return true;
}
public void B6(SecureDocument secureDocument, int i2, f0 f0Var, String str, DialogInterface dialogInterface, int i3) {
LinearLayout linearLayout;
this.x1.remove(secureDocument);
if (i2 == 1) {
this.t1 = null;
linearLayout = this.q0;
} else if (i2 == 4) {
this.u1.remove(secureDocument);
linearLayout = this.r0;
} else if (i2 == 2) {
this.v1 = null;
linearLayout = this.o0;
} else if (i2 == 3) {
this.w1 = null;
linearLayout = this.p0;
} else {
this.s1.remove(secureDocument);
linearLayout = this.n0;
}
linearLayout.removeView(f0Var);
if (str != null) {
HashMap<String, String> hashMap = this.H1;
if (hashMap != null) {
hashMap.remove(str);
}
HashMap<String, String> hashMap2 = this.I1;
if (hashMap2 != null) {
hashMap2.remove(str);
}
}
t8(i2);
String str2 = secureDocument.path;
if (str2 == null || this.y1.remove(str2) == null) {
return;
}
if (this.y1.isEmpty()) {
this.V.setEnabled(true);
this.V.setAlpha(1.0f);
}
FileLoader.getInstance(this.d).cancelFileUpload(secureDocument.path, false);
}
public boolean B7(View view, int i2, KeyEvent keyEvent) {
if (i2 != 67 || this.i0[2].length() != 0) {
return false;
}
this.i0[1].requestFocus();
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
editTextBoldCursorArr[1].setSelection(editTextBoldCursorArr[1].length());
this.i0[1].dispatchKeyEvent(keyEvent);
return true;
}
public boolean C6(final int i2, final SecureDocument secureDocument, final f0 f0Var, final String str, View view) {
int i3;
String str2;
i.C0142i c0142i = new i.C0142i(c0());
if (i2 == 1) {
i3 = R.string.PassportDeleteSelfie;
str2 = "PassportDeleteSelfie";
} else {
i3 = R.string.PassportDeleteScan;
str2 = "PassportDeleteScan";
}
c0142i.l(LocaleController.getString(str2, i3));
c0142i.n(LocaleController.getString("Cancel", R.string.Cancel), null);
c0142i.u(LocaleController.getString("AppName", R.string.AppName));
c0142i.s(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i4) {
org.telegram.ui.w6.this.B6(secureDocument, i2, f0Var, str, dialogInterface, i4);
}
});
o1(c0142i.a());
return true;
}
public void C7(ov5 ov5Var) {
if (ov5Var == null) {
this.p1 = true;
J5(true);
D();
} else {
o8(false, false);
if ("APP_VERSION_OUTDATED".equals(ov5Var.b)) {
org.telegram.ui.Components.b.E4(c0(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
} else {
m8(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
}
}
}
public void D6(xp6 xp6Var, ArrayList arrayList, boolean z2, DialogInterface dialogInterface, int i2) {
d8(xp6Var, (xp6) arrayList.get(i2), arrayList, z2);
}
public void D7(i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.C7(ov5Var);
}
});
}
private void E5(final SecureDocument secureDocument, final int i2) {
String string;
StringBuilder sb;
String str;
int i3;
String str2;
String formatDateForBan;
HashMap<String, String> hashMap;
if (i2 == 1) {
this.t1 = secureDocument;
if (this.q0 == null) {
return;
}
} else if (i2 == 4) {
this.u1.add(secureDocument);
if (this.r0 == null) {
return;
}
} else if (i2 == 2) {
this.v1 = secureDocument;
if (this.o0 == null) {
return;
}
} else if (i2 == 3) {
this.w1 = secureDocument;
if (this.p0 == null) {
return;
}
} else {
this.s1.add(secureDocument);
if (this.n0 == null) {
return;
}
}
if (c0() == null) {
return;
}
final f0 f0Var = new f0(c0());
f0Var.setTag(secureDocument);
f0Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.x1.put(secureDocument, f0Var);
String l6 = l6(secureDocument);
if (i2 == 1) {
string = LocaleController.getString("PassportSelfie", R.string.PassportSelfie);
this.q0.addView(f0Var, g52.f(-1, -2));
sb = new StringBuilder();
str = "selfie";
} else if (i2 == 4) {
string = LocaleController.getString("AttachPhoto", R.string.AttachPhoto);
this.r0.addView(f0Var, g52.f(-1, -2));
sb = new StringBuilder();
str = "translation";
} else if (i2 == 2) {
ed5 ed5Var = this.J.e;
if ((ed5Var instanceof rq6) || (ed5Var instanceof qq6)) {
i3 = R.string.PassportMainPage;
str2 = "PassportMainPage";
} else {
i3 = R.string.PassportFrontSide;
str2 = "PassportFrontSide";
}
string = LocaleController.getString(str2, i3);
this.o0.addView(f0Var, g52.f(-1, -2));
sb = new StringBuilder();
str = "front";
} else if (i2 == 3) {
string = LocaleController.getString("PassportReverseSide", R.string.PassportReverseSide);
this.p0.addView(f0Var, g52.f(-1, -2));
sb = new StringBuilder();
str = "reverse";
} else {
string = LocaleController.getString("AttachPhoto", R.string.AttachPhoto);
this.n0.addView(f0Var, g52.f(-1, -2));
sb = new StringBuilder();
str = "files";
}
sb.append(str);
sb.append(l6);
final String sb2 = sb.toString();
if (sb2 == null || (hashMap = this.H1) == null || (formatDateForBan = hashMap.get(sb2)) == null) {
formatDateForBan = LocaleController.formatDateForBan(secureDocument.secureFile.e);
} else {
f0Var.b.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3"));
this.I1.put(sb2, BuildConfig.FLAVOR);
}
f0Var.c(string, formatDateForBan, secureDocument);
f0Var.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.A6(i2, view);
}
});
f0Var.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
boolean C6;
C6 = org.telegram.ui.w6.this.C6(i2, secureDocument, f0Var, sb2, view);
return C6;
}
});
}
public void E6(String str, String str2) {
W7();
}
public void E7(View view) {
ArrayList arrayList;
int i2;
xp6 xp6Var;
ArrayList arrayList2 = new ArrayList();
int size = this.H.b.size();
for (int i3 = 0; i3 < size; i3++) {
cd5 cd5Var = this.H.b.get(i3);
if (cd5Var instanceof xp6) {
xp6Var = (xp6) cd5Var;
} else {
if (cd5Var instanceof yp6) {
yp6 yp6Var = (yp6) cd5Var;
if (!yp6Var.a.isEmpty()) {
cd5 cd5Var2 = yp6Var.a.get(0);
if (cd5Var2 instanceof xp6) {
xp6 xp6Var2 = (xp6) cd5Var2;
int size2 = yp6Var.a.size();
int i4 = 0;
while (true) {
if (i4 >= size2) {
xp6Var = xp6Var2;
break;
}
cd5 cd5Var3 = yp6Var.a.get(i4);
if (cd5Var3 instanceof xp6) {
xp6 xp6Var3 = (xp6) cd5Var3;
if (t6(xp6Var3, true) != null) {
xp6Var = xp6Var3;
break;
}
}
i4++;
}
} else {
continue;
}
} else {
continue;
}
} else {
continue;
}
}
aq6 t6 = t6(xp6Var, true);
if (t6 == null) {
Vibrator vibrator = (Vibrator) c0().getSystemService("vibrator");
if (vibrator != null) {
vibrator.vibrate(200L);
}
AndroidUtilities.shakeView(u6(xp6Var), 2.0f, 0);
return;
}
HashMap<String, String> hashMap = this.E1.get(o6(xp6Var.e));
if (hashMap != null && !hashMap.isEmpty()) {
Vibrator vibrator2 = (Vibrator) c0().getSystemService("vibrator");
if (vibrator2 != null) {
vibrator2.vibrate(200L);
}
AndroidUtilities.shakeView(u6(xp6Var), 2.0f, 0);
return;
}
arrayList2.add(new l(this, t6, xp6Var.c, xp6Var.d));
}
o8(false, true);
kd5 kd5Var = new kd5();
kd5Var.a = this.s;
kd5Var.b = this.w;
kd5Var.c = this.y;
JSONObject jSONObject = new JSONObject();
int size3 = arrayList2.size();
int i5 = 0;
while (i5 < size3) {
l lVar = (l) arrayList2.get(i5);
aq6 aq6Var = lVar.a;
JSONObject jSONObject2 = new JSONObject();
bd5 bd5Var = aq6Var.i;
if (bd5Var == null) {
try {
JSONObject jSONObject3 = new JSONObject();
pp6 pp6Var = aq6Var.c;
if (pp6Var != null) {
byte[] e6 = e6(pp6Var.c, pp6Var.b);
jSONObject2.put("data_hash", Base64.encodeToString(aq6Var.c.b, 2));
jSONObject2.put("secret", Base64.encodeToString(e6, 2));
jSONObject3.put(com.batch.android.module.k.g, jSONObject2);
}
if (aq6Var.h.isEmpty()) {
arrayList = arrayList2;
i2 = size3;
} else {
JSONArray jSONArray = new JSONArray();
int i6 = 0;
for (int size4 = aq6Var.h.size(); i6 < size4; size4 = size4) {
qp6 qp6Var = (qp6) aq6Var.h.get(i6);
arrayList = arrayList2;
try {
i2 = size3;
try {
byte[] e62 = e6(qp6Var.g, qp6Var.f);
JSONObject jSONObject4 = new JSONObject();
jSONObject4.put("file_hash", Base64.encodeToString(qp6Var.f, 2));
jSONObject4.put("secret", Base64.encodeToString(e62, 2));
jSONArray.put(jSONObject4);
i6++;
arrayList2 = arrayList;
size3 = i2;
} catch (Exception unused) {
}
} catch (Exception unused2) {
}
}
arrayList = arrayList2;
i2 = size3;
jSONObject3.put("files", jSONArray);
}
zc5 zc5Var = aq6Var.d;
if (zc5Var instanceof qp6) {
qp6 qp6Var2 = (qp6) zc5Var;
byte[] e63 = e6(qp6Var2.g, qp6Var2.f);
JSONObject jSONObject5 = new JSONObject();
jSONObject5.put("file_hash", Base64.encodeToString(qp6Var2.f, 2));
jSONObject5.put("secret", Base64.encodeToString(e63, 2));
jSONObject3.put("front_side", jSONObject5);
}
zc5 zc5Var2 = aq6Var.e;
if (zc5Var2 instanceof qp6) {
qp6 qp6Var3 = (qp6) zc5Var2;
byte[] e64 = e6(qp6Var3.g, qp6Var3.f);
JSONObject jSONObject6 = new JSONObject();
jSONObject6.put("file_hash", Base64.encodeToString(qp6Var3.f, 2));
jSONObject6.put("secret", Base64.encodeToString(e64, 2));
jSONObject3.put("reverse_side", jSONObject6);
}
if (lVar.b) {
zc5 zc5Var3 = aq6Var.f;
if (zc5Var3 instanceof qp6) {
qp6 qp6Var4 = (qp6) zc5Var3;
byte[] e65 = e6(qp6Var4.g, qp6Var4.f);
JSONObject jSONObject7 = new JSONObject();
jSONObject7.put("file_hash", Base64.encodeToString(qp6Var4.f, 2));
jSONObject7.put("secret", Base64.encodeToString(e65, 2));
jSONObject3.put("selfie", jSONObject7);
}
}
if (lVar.c && !aq6Var.g.isEmpty()) {
JSONArray jSONArray2 = new JSONArray();
int size5 = aq6Var.g.size();
for (int i7 = 0; i7 < size5; i7++) {
qp6 qp6Var5 = (qp6) aq6Var.g.get(i7);
byte[] e66 = e6(qp6Var5.g, qp6Var5.f);
JSONObject jSONObject8 = new JSONObject();
jSONObject8.put("file_hash", Base64.encodeToString(qp6Var5.f, 2));
jSONObject8.put("secret", Base64.encodeToString(e66, 2));
jSONArray2.put(jSONObject8);
}
jSONObject3.put("translation", jSONArray2);
}
jSONObject.put(o6(aq6Var.b), jSONObject3);
} catch (Exception unused3) {
}
kq6 kq6Var = new kq6();
kq6Var.a = aq6Var.b;
kq6Var.b = aq6Var.j;
kd5Var.d.add(kq6Var);
i5++;
arrayList2 = arrayList;
size3 = i2;
} else if (bd5Var instanceof vp6) {
} else if (bd5Var instanceof wp6) {
}
arrayList = arrayList2;
i2 = size3;
kq6 kq6Var2 = new kq6();
kq6Var2.a = aq6Var.b;
kq6Var2.b = aq6Var.j;
kd5Var.d.add(kq6Var2);
i5++;
arrayList2 = arrayList;
size3 = i2;
}
JSONObject jSONObject9 = new JSONObject();
try {
jSONObject9.put("secure_data", jSONObject);
} catch (Exception unused4) {
}
Object obj = this.t;
if (obj != null) {
try {
jSONObject9.put("payload", obj);
} catch (Exception unused5) {
}
}
Object obj2 = this.u;
if (obj2 != null) {
try {
jSONObject9.put("nonce", obj2);
} catch (Exception unused6) {
}
}
z h6 = h6(AndroidUtilities.getStringBytes(jSONObject9.toString()));
op6 op6Var = new op6();
kd5Var.e = op6Var;
op6Var.b = h6.d;
op6Var.a = h6.c;
try {
RSAPublicKey rSAPublicKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(Base64.decode(this.y.replaceAll("\\n", BuildConfig.FLAVOR).replace("-----BEGIN PUBLIC KEY-----", BuildConfig.FLAVOR).replace("-----END PUBLIC KEY-----", BuildConfig.FLAVOR), 0)));
Cipher cipher = Cipher.getInstance("RSA/NONE/OAEPWithSHA1AndMGF1Padding");
cipher.init(1, rSAPublicKey);
kd5Var.e.c = cipher.doFinal(h6.b);
} catch (Exception e2) {
FileLog.e(e2);
}
ConnectionsManager.getInstance(this.d).bindRequestToGuid(ConnectionsManager.getInstance(this.d).sendRequest(kd5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
org.telegram.ui.w6.this.D7(i95Var, ov5Var);
}
}), this.k);
}
private void F5(qp6 qp6Var, int i2) {
E5(new SecureDocument(q6(qp6Var.g, qp6Var.f), qp6Var, null, null, null), i2);
}
public void F6(xp6 xp6Var, boolean z2, DialogInterface dialogInterface, int i2) {
X7();
f6(xp6Var, null, null, true, new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.W7();
}
}, new a0() {
@Override
public final void a(String str, String str2) {
w6.this.E6(str, str2);
}
}, z2);
}
public void F7(ov5 ov5Var, a0 a0Var, boolean z2, xp6 xp6Var, xp6 xp6Var2, boolean z3, ArrayList arrayList, Runnable runnable) {
xp6 xp6Var3;
String str;
String str2;
pp6 pp6Var;
int i2;
String str3;
String str4 = null;
if (ov5Var != null) {
if (a0Var != null) {
a0Var.a(ov5Var.b, null);
}
m8(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
return;
}
if (z2) {
if (xp6Var == null) {
g8(xp6Var2);
if (this.r != 8) {
g0 remove = this.A1.remove(xp6Var2);
if (remove != null) {
this.m0.removeView(remove);
View childAt = this.m0.getChildAt(r0.getChildCount() - 6);
if (childAt instanceof g0) {
((g0) childAt).setNeedDivider(false);
}
}
r8();
} else {
if (xp6Var == null || arrayList == null || arrayList.size() <= 1) {
xp6Var3 = xp6Var;
str = null;
} else {
int size = arrayList.size();
int i3 = 0;
while (true) {
if (i3 >= size) {
xp6Var3 = xp6Var;
break;
}
xp6Var3 = (xp6) arrayList.get(i3);
aq6 t6 = t6(xp6Var3, false);
if (t6 != null) {
pp6 pp6Var2 = t6.c;
if (pp6Var2 != null) {
str3 = c6(pp6Var2.a, e6(pp6Var2.c, pp6Var2.b), t6.c.b);
}
} else {
i3++;
}
}
str3 = null;
if (xp6Var3 == null) {
str = str3;
xp6Var3 = (xp6) arrayList.get(0);
} else {
str = str3;
}
}
if (z3) {
str2 = null;
str4 = null;
} else {
aq6 t62 = t6(xp6Var2, false);
if (t62 != null && (pp6Var = t62.c) != null) {
str4 = c6(pp6Var.a, e6(pp6Var.c, pp6Var.b), t62.c.b);
}
str2 = null;
}
l8(xp6Var2, str2, str4, xp6Var3, str, z2, i2);
}
if (runnable == null) {
runnable.run();
return;
}
return;
}
} else if (z3) {
g8(xp6Var2);
}
g8(xp6Var);
if (this.r != 8) {
}
if (runnable == null) {
}
}
private void G5(ArrayList<zc5> arrayList) {
this.s1.clear();
int size = arrayList.size();
for (int i2 = 0; i2 < size; i2++) {
zc5 zc5Var = arrayList.get(i2);
if (zc5Var instanceof qp6) {
F5((qp6) zc5Var, 0);
}
}
}
public void G6(final ArrayList arrayList, final xp6 xp6Var, final boolean z2, View view) {
xp6 xp6Var2;
int i2;
String str;
int size;
int i3;
org.telegram.ui.ActionBar.i a2;
int i4;
String str2;
int i5;
String str3;
if (arrayList != null) {
int size2 = arrayList.size();
for (int i6 = 0; i6 < size2; i6++) {
xp6Var2 = (xp6) arrayList.get(i6);
if (t6(xp6Var2, false) != null || size2 == 1) {
break;
}
}
}
xp6Var2 = null;
ed5 ed5Var = xp6Var.e;
if (!(ed5Var instanceof tq6) && !(ed5Var instanceof lq6)) {
boolean z3 = ed5Var instanceof uq6;
if ((z3 || (ed5Var instanceof oq6)) && t6(xp6Var, false) != null) {
i.C0142i c0142i = new i.C0142i(c0());
c0142i.s(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i7) {
org.telegram.ui.w6.this.F6(xp6Var, z2, dialogInterface, i7);
}
});
c0142i.n(LocaleController.getString("Cancel", R.string.Cancel), null);
c0142i.u(LocaleController.getString("AppName", R.string.AppName));
if (z3) {
i5 = R.string.PassportDeletePhoneAlert;
str3 = "PassportDeletePhoneAlert";
} else {
i5 = R.string.PassportDeleteEmailAlert;
str3 = "PassportDeleteEmailAlert";
}
c0142i.l(LocaleController.getString(str3, i5));
a2 = c0142i.a();
o1(a2);
return;
}
d8(xp6Var, xp6Var2, arrayList, z2);
}
if (xp6Var2 == null && arrayList != null && !arrayList.isEmpty()) {
i.C0142i c0142i2 = new i.C0142i(c0());
c0142i2.s(LocaleController.getString("Cancel", R.string.Cancel), null);
ed5 ed5Var2 = xp6Var.e;
if (!(ed5Var2 instanceof tq6)) {
if (ed5Var2 instanceof lq6) {
i2 = R.string.PassportAddress;
str = "PassportAddress";
}
ArrayList arrayList2 = new ArrayList();
size = arrayList.size();
for (i3 = 0; i3 < size; i3++) {
ed5 ed5Var3 = ((xp6) arrayList.get(i3)).e;
if (ed5Var3 instanceof nq6) {
i4 = R.string.PassportAddLicence;
str2 = "PassportAddLicence";
} else if (ed5Var3 instanceof rq6) {
i4 = R.string.PassportAddPassport;
str2 = "PassportAddPassport";
} else if (ed5Var3 instanceof qq6) {
i4 = R.string.PassportAddInternalPassport;
str2 = "PassportAddInternalPassport";
} else if (ed5Var3 instanceof pq6) {
i4 = R.string.PassportAddCard;
str2 = "PassportAddCard";
} else if (ed5Var3 instanceof xq6) {
i4 = R.string.PassportAddBill;
str2 = "PassportAddBill";
} else if (ed5Var3 instanceof mq6) {
i4 = R.string.PassportAddBank;
str2 = "PassportAddBank";
} else if (ed5Var3 instanceof vq6) {
i4 = R.string.PassportAddAgreement;
str2 = "PassportAddAgreement";
} else if (ed5Var3 instanceof wq6) {
i4 = R.string.PassportAddTemporaryRegistration;
str2 = "PassportAddTemporaryRegistration";
} else if (ed5Var3 instanceof sq6) {
i4 = R.string.PassportAddPassportRegistration;
str2 = "PassportAddPassportRegistration";
}
arrayList2.add(LocaleController.getString(str2, i4));
}
c0142i2.j((CharSequence[]) arrayList2.toArray(new CharSequence[0]), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i7) {
org.telegram.ui.w6.this.D6(xp6Var, arrayList, z2, dialogInterface, i7);
}
});
a2 = c0142i2.a();
o1(a2);
return;
}
i2 = R.string.PassportIdentityDocument;
str = "PassportIdentityDocument";
c0142i2.u(LocaleController.getString(str, i2));
ArrayList arrayList22 = new ArrayList();
size = arrayList.size();
while (i3 < size) {
}
c0142i2.j((CharSequence[]) arrayList22.toArray(new CharSequence[0]), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i7) {
org.telegram.ui.w6.this.D6(xp6Var, arrayList, z2, dialogInterface, i7);
}
});
a2 = c0142i2.a();
o1(a2);
return;
}
d8(xp6Var, xp6Var2, arrayList, z2);
}
public void G7(final a0 a0Var, final boolean z2, final xp6 xp6Var, final xp6 xp6Var2, final boolean z3, final ArrayList arrayList, final Runnable runnable, i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.this.F7(ov5Var, a0Var, z2, xp6Var, xp6Var2, z3, arrayList, runnable);
}
});
}
private g0 H5(Context context, final xp6 xp6Var, final ArrayList<xp6> arrayList, final boolean z2, boolean z3) {
int i2;
String str;
String formatString;
String str2;
String str3;
String str4;
aq6 t6;
int size = arrayList != null ? arrayList.size() : 0;
g0 g0Var = new g0(this, context);
g0Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
ed5 ed5Var = xp6Var.e;
if (ed5Var instanceof tq6) {
if (arrayList == null || arrayList.isEmpty()) {
i2 = R.string.PassportPersonalDetails;
str = "PassportPersonalDetails";
} else {
if (!z2 || arrayList.size() != 1) {
if (z2 && arrayList.size() == 2) {
formatString = LocaleController.formatString("PassportTwoDocuments", R.string.PassportTwoDocuments, r6(arrayList.get(0).e), r6(arrayList.get(1).e));
g0Var.b(formatString, BuildConfig.FLAVOR, !z3);
} else {
i2 = R.string.PassportIdentityDocument;
str = "PassportIdentityDocument";
}
}
formatString = r6(arrayList.get(0).e);
g0Var.b(formatString, BuildConfig.FLAVOR, !z3);
}
formatString = LocaleController.getString(str, i2);
g0Var.b(formatString, BuildConfig.FLAVOR, !z3);
} else {
if (ed5Var instanceof lq6) {
if (arrayList == null || arrayList.isEmpty()) {
i2 = R.string.PassportAddress;
str = "PassportAddress";
} else {
if (!z2 || arrayList.size() != 1) {
if (z2 && arrayList.size() == 2) {
formatString = LocaleController.formatString("PassportTwoDocuments", R.string.PassportTwoDocuments, r6(arrayList.get(0).e), r6(arrayList.get(1).e));
g0Var.b(formatString, BuildConfig.FLAVOR, !z3);
} else {
i2 = R.string.PassportResidentialAddress;
str = "PassportResidentialAddress";
}
}
formatString = r6(arrayList.get(0).e);
g0Var.b(formatString, BuildConfig.FLAVOR, !z3);
}
} else if (ed5Var instanceof uq6) {
i2 = R.string.PassportPhone;
str = "PassportPhone";
} else if (ed5Var instanceof oq6) {
i2 = R.string.PassportEmail;
str = "PassportEmail";
}
formatString = LocaleController.getString(str, i2);
g0Var.b(formatString, BuildConfig.FLAVOR, !z3);
}
if (this.r == 8) {
this.m0.addView(g0Var, r4.getChildCount() - 5, g52.f(-1, -2));
} else {
this.m0.addView(g0Var, g52.f(-1, -2));
}
g0Var.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.G6(arrayList, xp6Var, z2, view);
}
});
this.A1.put(xp6Var, g0Var);
this.z1.put(xp6Var, new HashMap<>());
aq6 t62 = t6(xp6Var, false);
xp6 xp6Var2 = null;
if (t62 != null) {
bd5 bd5Var = t62.i;
if (bd5Var instanceof vp6) {
str2 = ((vp6) bd5Var).a;
} else if (bd5Var instanceof wp6) {
str2 = ((wp6) bd5Var).a;
} else {
pp6 pp6Var = t62.c;
if (pp6Var != null) {
str3 = c6(pp6Var.a, e6(pp6Var.c, pp6Var.b), t62.c.b);
str2 = null;
if (arrayList != null || arrayList.isEmpty()) {
str4 = null;
} else {
int size2 = arrayList.size();
str4 = null;
boolean z4 = false;
for (int i3 = 0; i3 < size2; i3++) {
xp6 xp6Var3 = arrayList.get(i3);
this.z1.put(xp6Var3, new HashMap<>());
this.B1.put(xp6Var3, xp6Var);
if (!z4 && (t6 = t6(xp6Var3, false)) != null) {
pp6 pp6Var2 = t6.c;
if (pp6Var2 != null) {
str4 = c6(pp6Var2.a, e6(pp6Var2.c, pp6Var2.b), t6.c.b);
}
xp6Var2 = xp6Var3;
z4 = true;
}
}
if (xp6Var2 == null) {
xp6Var2 = arrayList.get(0);
}
}
l8(xp6Var, str2, str3, xp6Var2, str4, z2, size);
return g0Var;
}
}
str3 = null;
if (arrayList != null) {
}
str4 = null;
l8(xp6Var, str2, str3, xp6Var2, str4, z2, size);
return g0Var;
}
str2 = null;
str3 = null;
if (arrayList != null) {
}
str4 = null;
l8(xp6Var, str2, str3, xp6Var2, str4, z2, size);
return g0Var;
}
public void H6(DialogInterface dialogInterface, int i2) {
D();
}
public void H7(i95 i95Var) {
if (i95Var != null) {
te5 te5Var = (te5) i95Var;
this.T = te5Var;
if (!hf.p2(te5Var, false)) {
org.telegram.ui.Components.b.E4(c0(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
return;
}
hf.u2(this.T);
s8();
if (this.j0[0].getVisibility() == 0) {
this.i0[0].requestFocus();
AndroidUtilities.showKeyboard(this.i0[0]);
}
if (this.X0 == 1) {
a8(true);
}
}
}
private void I5(ArrayList<zc5> arrayList) {
this.u1.clear();
int size = arrayList.size();
for (int i2 = 0; i2 < size; i2++) {
zc5 zc5Var = arrayList.get(i2);
if (zc5Var instanceof qp6) {
F5((qp6) zc5Var, 4);
}
}
}
public void I6() {
EditTextBoldCursor[] editTextBoldCursorArr = this.k0;
if (editTextBoldCursorArr != null) {
h8(editTextBoldCursorArr[0]);
}
}
public void I7(final i95 i95Var, ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.H7(i95Var);
}
});
}
public void J5(boolean z2) {
int i2;
int i3;
Activity c02;
StringBuilder sb;
String str;
if (this.q1) {
return;
}
if (!TextUtils.isEmpty(this.x)) {
if (z2) {
c02 = c0();
sb = new StringBuilder();
sb.append(this.x);
str = "&tg_passport=success";
} else if (!this.p1 && ((i3 = this.r) == 5 || i3 == 0)) {
c02 = c0();
sb = new StringBuilder();
sb.append(this.x);
str = "&tg_passport=cancel";
}
sb.append(str);
ok.t(c02, Uri.parse(sb.toString()));
} else {
if (!this.M1) {
return;
}
if (z2 || (!this.p1 && ((i2 = this.r) == 5 || i2 == 0))) {
c0().setResult(z2 ? -1 : 0);
}
}
this.q1 = true;
}
public void J6(View view) {
this.c1 = 0;
c8();
}
public static void J7(i95 i95Var) {
if (!(i95Var instanceof ix5)) {
SharedConfig.getCountryLangs();
} else {
ix5 ix5Var = (ix5) i95Var;
SharedConfig.setPassportConfig(ix5Var.b.a, ix5Var.a);
}
}
public boolean K5() {
if (y6()) {
return false;
}
i.C0142i c0142i = new i.C0142i(c0());
c0142i.s(LocaleController.getString("PassportDiscard", R.string.PassportDiscard), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
org.telegram.ui.w6.this.H6(dialogInterface, i2);
}
});
c0142i.n(LocaleController.getString("Cancel", R.string.Cancel), null);
c0142i.u(LocaleController.getString("DiscardChanges", R.string.DiscardChanges));
c0142i.l(LocaleController.getString("PassportDiscardChanges", R.string.PassportDiscardChanges));
o1(c0142i.a());
return true;
}
public void K6(View view) {
this.c1 = 4;
c8();
}
public static void K7(final i95 i95Var, ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.J7(i95.this);
}
});
}
public void L5(EditTextBoldCursor editTextBoldCursor, String str, Editable editable, boolean z2) {
String str2;
String str3;
String str4;
HashMap<String, String> hashMap = this.I1;
if (hashMap == null || (str2 = hashMap.get(str)) == null || !TextUtils.equals(str2, editable)) {
editTextBoldCursor.setErrorText(null);
} else {
HashMap<String, String> hashMap2 = this.G1;
if (hashMap2 == null || (str4 = hashMap2.get(str)) == null) {
HashMap<String, String> hashMap3 = this.H1;
if (hashMap3 != null && (str3 = hashMap3.get(str)) != null) {
editTextBoldCursor.setErrorText(str3);
}
} else {
editTextBoldCursor.setErrorText(str4);
}
}
String str5 = z2 ? "error_document_all" : "error_all";
HashMap<String, String> hashMap4 = this.I1;
if (hashMap4 == null || !hashMap4.containsKey(str5)) {
return;
}
this.I1.remove(str5);
P5(false);
}
public void L6(l3.d dVar) {
this.i0[5].setText(dVar.a);
this.z = dVar.c;
}
public void L7(boolean z2, String str) {
byte[] bArr;
byte[] x2;
hc5 hc5Var;
je5 je5Var = new je5();
if (z2) {
x2 = this.Y0;
} else {
if (!(this.T.e instanceof bk6)) {
bArr = null;
x xVar = new x(z2, bArr, je5Var, str);
te5 te5Var = this.T;
hc5Var = te5Var.e;
if (hc5Var instanceof bk6) {
ov5 ov5Var = new ov5();
ov5Var.b = "PASSWORD_HASH_INVALID";
xVar.run(null, ov5Var);
return;
}
ey5 startCheck = SRPHelper.startCheck(bArr, te5Var.g, te5Var.f, (bk6) hc5Var);
je5Var.a = startCheck;
if (startCheck != null) {
ConnectionsManager.getInstance(this.d).bindRequestToGuid(ConnectionsManager.getInstance(this.d).sendRequest(je5Var, xVar, 10), this.k);
return;
} else {
ov5 ov5Var2 = new ov5();
ov5Var2.b = "ALGO_INVALID";
xVar.run(null, ov5Var2);
return;
}
}
x2 = SRPHelper.getX(AndroidUtilities.getStringBytes(str), (bk6) this.T.e);
}
bArr = x2;
x xVar2 = new x(z2, bArr, je5Var, str);
te5 te5Var2 = this.T;
hc5Var = te5Var2.e;
if (hc5Var instanceof bk6) {
}
}
public boolean M5() {
EditTextBoldCursor[] editTextBoldCursorArr;
boolean z2;
View view;
e77 e77Var;
HashMap<SecureDocument, f0> hashMap;
SecureDocument secureDocument;
SecureDocument secureDocument2;
f0 f0Var;
if (this.J != null) {
if (this.I1.containsKey("error_all") || this.I1.containsKey("error_document_all")) {
view = this.z0;
} else {
if (this.b0 != null) {
if (!this.s1.isEmpty()) {
int size = this.s1.size();
for (int i2 = 0; i2 < size; i2++) {
secureDocument2 = this.s1.get(i2);
String str = "files" + l6(secureDocument2);
if (str != null && this.I1.containsKey(str)) {
break;
}
}
} else {
view = this.b0;
}
}
if (this.I1.containsKey("files_all") || this.I1.containsKey("translation_all")) {
view = this.x0;
} else {
e77 e77Var2 = this.e0;
if (e77Var2 != null) {
if (this.v1 == null) {
Y7(e77Var2);
return true;
}
if (this.I1.containsKey("front" + l6(this.v1))) {
hashMap = this.x1;
secureDocument = this.v1;
f0Var = hashMap.get(secureDocument);
view = f0Var;
break;
}
}
ed5 ed5Var = this.J.e;
if (((ed5Var instanceof pq6) || (ed5Var instanceof nq6)) && (e77Var = this.f0) != null) {
if (this.w1 == null) {
Y7(e77Var);
return true;
}
if (this.I1.containsKey("reverse" + l6(this.w1))) {
hashMap = this.x1;
secureDocument = this.w1;
f0Var = hashMap.get(secureDocument);
view = f0Var;
break;
}
}
e77 e77Var3 = this.g0;
if (e77Var3 != null && this.s != 0) {
if (this.t1 == null) {
Y7(e77Var3);
return true;
}
if (this.I1.containsKey("selfie" + l6(this.t1))) {
hashMap = this.x1;
secureDocument = this.t1;
f0Var = hashMap.get(secureDocument);
view = f0Var;
break;
}
}
if (this.h0 != null && this.s != 0) {
if (this.u1.isEmpty()) {
view = this.h0;
} else {
int size2 = this.u1.size();
for (int i3 = 0; i3 < size2; i3++) {
secureDocument2 = this.u1.get(i3);
if (this.I1.containsKey("translation" + l6(secureDocument2))) {
f0Var = this.x1.get(secureDocument2);
view = f0Var;
break;
}
}
}
}
}
}
Y7(view);
return true;
}
for (int i4 = 0; i4 < 2; i4++) {
if (i4 == 0) {
editTextBoldCursorArr = this.i0;
} else {
i77 i77Var = this.A0;
editTextBoldCursorArr = (i77Var == null || i77Var.getVisibility() != 0) ? null : this.k0;
}
if (editTextBoldCursorArr != null) {
int i5 = 0;
while (i5 < editTextBoldCursorArr.length) {
boolean C = editTextBoldCursorArr[i5].C();
if (!this.I1.isEmpty()) {
ed5 ed5Var2 = this.I.e;
String str2 = "country_code";
if (!(ed5Var2 instanceof tq6)) {
if (ed5Var2 instanceof lq6) {
if (i5 == 0) {
str2 = "street_line1";
} else if (i5 == 1) {
str2 = "street_line2";
} else if (i5 == 2) {
str2 = "post_code";
} else if (i5 == 3) {
str2 = "city";
} else if (i5 == 4) {
str2 = "state";
}
if (str2 != null) {
}
}
str2 = null;
if (str2 != null) {
}
} else if (i4 == 0) {
switch (i5) {
case 0:
str2 = "first_name";
break;
case 1:
str2 = "middle_name";
break;
case 2:
str2 = "last_name";
break;
case 3:
str2 = "birth_date";
break;
case 4:
str2 = "gender";
break;
case 5:
break;
case 6:
str2 = "residence_country_code";
break;
case 7:
str2 = "document_no";
break;
case 8:
str2 = "expiry_date";
break;
default:
str2 = null;
break;
}
} else {
if (i5 == 0) {
str2 = "first_name_native";
} else if (i5 != 1) {
if (i5 == 2) {
str2 = "last_name_native";
}
str2 = null;
} else {
str2 = "middle_name_native";
}
if (str2 != null) {
String str3 = this.I1.get(str2);
if (!TextUtils.isEmpty(str3) && str3.equals(editTextBoldCursorArr[i5].getText().toString())) {
C = true;
}
}
}
Y7(view);
return true;
}
if (!this.F0 || this.J == null || i5 >= 7) {
if (!C) {
int length = editTextBoldCursorArr[i5].length();
int i6 = this.r;
if (i6 != 1) {
if (i6 == 2) {
if (i5 == 1) {
continue;
} else if (i5 != 3) {
if (i5 == 4) {
if (!"US".equals(this.z)) {
continue;
}
} else if (i5 == 2) {
if (length >= 2) {
}
C = true;
}
}
}
z2 = false;
if (!C) {
}
} else if (i5 != 8) {
if ((i4 == 0 && (i5 == 0 || i5 == 2 || i5 == 1)) || (i4 == 1 && (i5 == 0 || i5 == 1 || i5 == 2))) {
if (length > 255) {
C = true;
}
if ((i4 == 0 && i5 == 1) || (i4 == 1 && i5 == 1)) {
z2 = true;
if (!C && !z2 && length == 0) {
C = true;
}
}
} else if (i5 == 7) {
}
z2 = false;
if (!C) {
C = true;
}
} else {
continue;
}
}
if (C) {
view = editTextBoldCursorArr[i5];
Y7(view);
return true;
}
}
i5++;
}
}
}
return false;
}
public boolean M6(View view, MotionEvent motionEvent) {
if (c0() == null) {
return false;
}
if (motionEvent.getAction() == 1) {
l3 l3Var = new l3(false);
l3Var.C1(new l3.g() {
@Override
public final void a(l3.d dVar) {
org.telegram.ui.w6.this.L6(dVar);
}
});
S0(l3Var);
}
return true;
}
public void M7(DialogInterface dialogInterface, int i2) {
try {
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName()));
c0().startActivity(intent);
} catch (Exception e2) {
FileLog.e(e2);
}
}
public void N5(boolean z2) {
iv4 iv4Var;
Drawable drawable;
EditTextBoldCursor editTextBoldCursor;
String formatString;
int i2;
String str;
EditTextBoldCursor[] editTextBoldCursorArr;
if (this.k0 == null) {
return;
}
String str2 = this.i1.get(this.A);
String str3 = SharedConfig.getCountryLangs().get(this.A);
int i3 = 0;
if (!this.I.b || TextUtils.isEmpty(this.A) || "EN".equals(str3)) {
if (this.A0.getVisibility() != 8) {
this.A0.setVisibility(8);
this.t0.setVisibility(8);
this.d0.setVisibility(8);
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr2 = this.k0;
if (i3 >= editTextBoldCursorArr2.length) {
break;
}
((View) editTextBoldCursorArr2[i3].getParent()).setVisibility(8);
i3++;
}
if (((this.s == 0 && this.J != null) || this.R == null || this.F0) && this.S == null) {
iv4Var = this.w0;
drawable = org.telegram.ui.ActionBar.w.h2(c0(), org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow");
} else {
iv4Var = this.w0;
drawable = org.telegram.ui.ActionBar.w.h2(c0(), org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow");
}
iv4Var.setBackgroundDrawable(drawable);
return;
}
return;
}
if (this.A0.getVisibility() != 0) {
this.A0.setVisibility(0);
this.t0.setVisibility(0);
this.d0.setVisibility(0);
int i4 = 0;
while (true) {
editTextBoldCursorArr = this.k0;
if (i4 >= editTextBoldCursorArr.length) {
break;
}
((View) editTextBoldCursorArr[i4].getParent()).setVisibility(0);
i4++;
}
if (editTextBoldCursorArr[0].length() == 0 && this.k0[1].length() == 0 && this.k0[2].length() == 0) {
int i5 = 0;
while (true) {
boolean[] zArr = this.D0;
if (i5 >= zArr.length) {
break;
}
if (zArr[i5]) {
this.k0[0].setText(this.i0[0].getText());
this.k0[1].setText(this.i0[1].getText());
this.k0[2].setText(this.i0[2].getText());
break;
}
i5++;
}
}
this.w0.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(c0(), org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
}
this.A0.setText(LocaleController.formatString("PassportNativeInfo", R.string.PassportNativeInfo, str2));
String serverString = str3 != null ? LocaleController.getServerString("PassportLanguage_" + str3) : null;
this.t0.setText(serverString != null ? LocaleController.formatString("PassportNativeHeaderLang", R.string.PassportNativeHeaderLang, serverString) : LocaleController.getString("PassportNativeHeader", R.string.PassportNativeHeader));
for (int i6 = 0; i6 < 3; i6++) {
if (i6 == 0) {
EditTextBoldCursor[] editTextBoldCursorArr3 = this.k0;
if (serverString != null) {
editTextBoldCursor = editTextBoldCursorArr3[i6];
i2 = R.string.PassportName;
str = "PassportName";
formatString = LocaleController.getString(str, i2);
editTextBoldCursor.setHintText(formatString);
} else {
editTextBoldCursor = editTextBoldCursorArr3[i6];
formatString = LocaleController.formatString("PassportNameCountry", R.string.PassportNameCountry, str2);
editTextBoldCursor.setHintText(formatString);
}
} else if (i6 == 1) {
EditTextBoldCursor[] editTextBoldCursorArr4 = this.k0;
if (serverString != null) {
editTextBoldCursor = editTextBoldCursorArr4[i6];
i2 = R.string.PassportMidname;
str = "PassportMidname";
formatString = LocaleController.getString(str, i2);
editTextBoldCursor.setHintText(formatString);
} else {
editTextBoldCursor = editTextBoldCursorArr4[i6];
formatString = LocaleController.formatString("PassportMidnameCountry", R.string.PassportMidnameCountry, str2);
editTextBoldCursor.setHintText(formatString);
}
} else if (i6 == 2) {
EditTextBoldCursor[] editTextBoldCursorArr5 = this.k0;
if (serverString != null) {
editTextBoldCursor = editTextBoldCursorArr5[i6];
i2 = R.string.PassportSurname;
str = "PassportSurname";
formatString = LocaleController.getString(str, i2);
editTextBoldCursor.setHintText(formatString);
} else {
editTextBoldCursor = editTextBoldCursorArr5[i6];
formatString = LocaleController.formatString("PassportSurnameCountry", R.string.PassportSurnameCountry, str2);
editTextBoldCursor.setHintText(formatString);
}
}
}
if (z2) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.I6();
}
});
}
}
public boolean N6(TextView textView, int i2, KeyEvent keyEvent) {
if (i2 != 5) {
return false;
}
int intValue = ((Integer) textView.getTag()).intValue() + 1;
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
if (intValue < editTextBoldCursorArr.length) {
if (editTextBoldCursorArr[intValue].isFocusable()) {
this.i0[intValue].requestFocus();
} else {
this.i0[intValue].dispatchTouchEvent(MotionEvent.obtain(0L, 0L, 1, 0.0f, 0.0f, 0));
textView.clearFocus();
AndroidUtilities.hideKeyboard(textView);
}
}
return true;
}
public void N7() {
ViewGroup[] viewGroupArr = this.j0;
if (viewGroupArr == null || viewGroupArr[0] == null || viewGroupArr[0].getVisibility() != 0) {
return;
}
this.i0[0].requestFocus();
AndroidUtilities.showKeyboard(this.i0[0]);
}
public static boolean O5(byte[] bArr, Long l2) {
if (bArr == null || bArr.length != 32) {
return false;
}
int i2 = 0;
for (byte b2 : bArr) {
i2 += b2 & 255;
}
if (i2 % 255 != 239) {
return false;
}
return l2 == null || Utilities.bytesToLong(Utilities.computeSHA256(bArr)) == l2.longValue();
}
public void O6(View view) {
S5();
}
public void O7() {
T0(this.r1, true);
this.r1 = null;
}
private void P5(boolean z2) {
String str;
String str2;
if (this.z0 == null) {
return;
}
SpannableStringBuilder spannableStringBuilder = null;
if (this.G1 != null && ((z2 || this.I1.containsKey("error_all")) && (str2 = this.G1.get("error_all")) != null)) {
spannableStringBuilder = new SpannableStringBuilder(str2);
if (z2) {
this.I1.put("error_all", BuildConfig.FLAVOR);
}
}
if (this.H1 != null && ((z2 || this.I1.containsKey("error_document_all")) && (str = this.H1.get("error_all")) != null)) {
if (spannableStringBuilder == null) {
spannableStringBuilder = new SpannableStringBuilder(str);
} else {
spannableStringBuilder.append((CharSequence) "\n\n").append((CharSequence) str);
}
if (z2) {
this.I1.put("error_document_all", BuildConfig.FLAVOR);
}
}
if (spannableStringBuilder != null) {
spannableStringBuilder.setSpan(new ForegroundColorSpan(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3")), 0, spannableStringBuilder.length(), 33);
this.z0.setText(spannableStringBuilder);
this.z0.setVisibility(0);
} else if (this.z0.getVisibility() != 8) {
this.z0.setVisibility(8);
}
}
public void P6(boolean[] zArr, DialogInterface dialogInterface, int i2) {
if (!this.F0) {
this.C1.clear();
}
this.D1.clear();
this.L1.b(this.I, this.J, this.Q, zArr[0], null, null);
D();
}
public void P7(ArrayList arrayList, DialogInterface dialogInterface, int i2) {
xp6 xp6Var;
xp6 xp6Var2;
ed5 lq6Var;
xp6 xp6Var3 = null;
try {
xp6Var = new xp6();
try {
xp6Var.e = (ed5) ((Class) arrayList.get(i2)).newInstance();
} catch (Exception unused) {
}
} catch (Exception unused2) {
xp6Var = null;
}
if (!z6(xp6Var.e)) {
if (x6(xp6Var.e)) {
xp6Var2 = new xp6();
lq6Var = new lq6();
}
d8(xp6Var, xp6Var3, new ArrayList<>(), xp6Var3 != null);
}
xp6Var.c = true;
xp6Var.d = true;
xp6Var2 = new xp6();
lq6Var = new tq6();
xp6Var2.e = lq6Var;
xp6Var3 = xp6Var;
xp6Var = xp6Var2;
d8(xp6Var, xp6Var3, new ArrayList<>(), xp6Var3 != null);
}
private void Q5(Context context) {
int i2;
String str;
String str2;
org.telegram.ui.ActionBar.a aVar;
int i3;
String str3;
int i4;
String str4;
HashMap<String, String> hashMap;
int i5;
String str5;
HashMap<String, String> hashMap2;
this.i1 = new HashMap<>();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("countries.txt")));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
String[] split = readLine.split(";");
this.i1.put(split[1], split[2]);
}
bufferedReader.close();
} catch (Exception e2) {
FileLog.e(e2);
}
i77 i77Var = new i77(context);
this.z0 = i77Var;
i77Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_top, "windowBackgroundGrayShadow"));
this.z0.setPadding(0, AndroidUtilities.dp(7.0f), 0, 0);
int i6 = -2;
this.m0.addView(this.z0, g52.f(-1, -2));
P5(true);
xp6 xp6Var = this.J;
if (xp6Var != null) {
ed5 ed5Var = xp6Var.e;
if (ed5Var instanceof vq6) {
aVar = this.g;
i3 = R.string.ActionBotDocumentRentalAgreement;
str3 = "ActionBotDocumentRentalAgreement";
} else if (ed5Var instanceof mq6) {
aVar = this.g;
i3 = R.string.ActionBotDocumentBankStatement;
str3 = "ActionBotDocumentBankStatement";
} else if (ed5Var instanceof xq6) {
aVar = this.g;
i3 = R.string.ActionBotDocumentUtilityBill;
str3 = "ActionBotDocumentUtilityBill";
} else if (ed5Var instanceof sq6) {
aVar = this.g;
i3 = R.string.ActionBotDocumentPassportRegistration;
str3 = "ActionBotDocumentPassportRegistration";
} else {
if (ed5Var instanceof wq6) {
aVar = this.g;
i3 = R.string.ActionBotDocumentTemporaryRegistration;
str3 = "ActionBotDocumentTemporaryRegistration";
}
rr1 rr1Var = new rr1(context);
this.t0 = rr1Var;
rr1Var.setText(LocaleController.getString("PassportDocuments", R.string.PassportDocuments));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
LinearLayout linearLayout = new LinearLayout(context);
this.n0 = linearLayout;
linearLayout.setOrientation(1);
this.m0.addView(this.n0, g52.f(-1, -2));
o87 o87Var = new o87(context);
this.b0 = o87Var;
o87Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.m0.addView(this.b0, g52.f(-1, -2));
this.b0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.J6(view);
}
});
i77 i77Var2 = new i77(context);
this.x0 = i77Var2;
i77Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
if (this.s == 0) {
i4 = R.string.PassportAddAddressUploadInfo;
str4 = "PassportAddAddressUploadInfo";
} else {
ed5 ed5Var2 = this.J.e;
if (ed5Var2 instanceof vq6) {
i4 = R.string.PassportAddAgreementInfo;
str4 = "PassportAddAgreementInfo";
} else if (ed5Var2 instanceof xq6) {
i4 = R.string.PassportAddBillInfo;
str4 = "PassportAddBillInfo";
} else if (ed5Var2 instanceof sq6) {
i4 = R.string.PassportAddPassportRegistrationInfo;
str4 = "PassportAddPassportRegistrationInfo";
} else if (ed5Var2 instanceof wq6) {
i4 = R.string.PassportAddTemporaryRegistrationInfo;
str4 = "PassportAddTemporaryRegistrationInfo";
} else if (ed5Var2 instanceof mq6) {
i4 = R.string.PassportAddBankInfo;
str4 = "PassportAddBankInfo";
} else {
this.J1 = BuildConfig.FLAVOR;
CharSequence charSequence = this.J1;
hashMap = this.H1;
CharSequence charSequence2 = charSequence;
if (hashMap != null) {
String str6 = hashMap.get("files_all");
charSequence2 = charSequence;
if (str6 != null) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(str6);
spannableStringBuilder.append((CharSequence) "\n\n");
spannableStringBuilder.append(this.J1);
spannableStringBuilder.setSpan(new ForegroundColorSpan(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3")), 0, str6.length(), 33);
this.I1.put("files_all", BuildConfig.FLAVOR);
charSequence2 = spannableStringBuilder;
}
}
this.x0.setText(charSequence2);
this.m0.addView(this.x0, g52.f(-1, -2));
if (this.J.d) {
rr1 rr1Var2 = new rr1(context);
this.t0 = rr1Var2;
rr1Var2.setText(LocaleController.getString("PassportTranslation", R.string.PassportTranslation));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
LinearLayout linearLayout2 = new LinearLayout(context);
this.r0 = linearLayout2;
linearLayout2.setOrientation(1);
this.m0.addView(this.r0, g52.f(-1, -2));
o87 o87Var2 = new o87(context);
this.h0 = o87Var2;
o87Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.m0.addView(this.h0, g52.f(-1, -2));
this.h0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.K6(view);
}
});
i77 i77Var3 = new i77(context);
this.y0 = i77Var3;
i77Var3.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
if (this.s != 0) {
i5 = R.string.PassportAddTranslationUploadInfo;
str5 = "PassportAddTranslationUploadInfo";
} else {
ed5 ed5Var3 = this.J.e;
if (ed5Var3 instanceof vq6) {
i5 = R.string.PassportAddTranslationAgreementInfo;
str5 = "PassportAddTranslationAgreementInfo";
} else if (ed5Var3 instanceof xq6) {
i5 = R.string.PassportAddTranslationBillInfo;
str5 = "PassportAddTranslationBillInfo";
} else if (ed5Var3 instanceof sq6) {
i5 = R.string.PassportAddTranslationPassportRegistrationInfo;
str5 = "PassportAddTranslationPassportRegistrationInfo";
} else if (ed5Var3 instanceof wq6) {
i5 = R.string.PassportAddTranslationTemporaryRegistrationInfo;
str5 = "PassportAddTranslationTemporaryRegistrationInfo";
} else if (ed5Var3 instanceof mq6) {
i5 = R.string.PassportAddTranslationBankInfo;
str5 = "PassportAddTranslationBankInfo";
} else {
this.K1 = BuildConfig.FLAVOR;
CharSequence charSequence3 = this.K1;
hashMap2 = this.H1;
CharSequence charSequence4 = charSequence3;
if (hashMap2 != null) {
String str7 = hashMap2.get("translation_all");
charSequence4 = charSequence3;
if (str7 != null) {
SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder(str7);
spannableStringBuilder2.append((CharSequence) "\n\n");
spannableStringBuilder2.append(this.K1);
spannableStringBuilder2.setSpan(new ForegroundColorSpan(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3")), 0, str7.length(), 33);
this.I1.put("translation_all", BuildConfig.FLAVOR);
charSequence4 = spannableStringBuilder2;
}
}
this.y0.setText(charSequence4);
this.m0.addView(this.y0, g52.f(-1, -2));
}
}
this.K1 = LocaleController.getString(str5, i5);
CharSequence charSequence32 = this.K1;
hashMap2 = this.H1;
CharSequence charSequence42 = charSequence32;
if (hashMap2 != null) {
}
this.y0.setText(charSequence42);
this.m0.addView(this.y0, g52.f(-1, -2));
}
}
}
this.J1 = LocaleController.getString(str4, i4);
CharSequence charSequence5 = this.J1;
hashMap = this.H1;
CharSequence charSequence22 = charSequence5;
if (hashMap != null) {
}
this.x0.setText(charSequence22);
this.m0.addView(this.x0, g52.f(-1, -2));
if (this.J.d) {
}
}
aVar.setTitle(LocaleController.getString(str3, i3));
rr1 rr1Var3 = new rr1(context);
this.t0 = rr1Var3;
rr1Var3.setText(LocaleController.getString("PassportDocuments", R.string.PassportDocuments));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
LinearLayout linearLayout3 = new LinearLayout(context);
this.n0 = linearLayout3;
linearLayout3.setOrientation(1);
this.m0.addView(this.n0, g52.f(-1, -2));
o87 o87Var3 = new o87(context);
this.b0 = o87Var3;
o87Var3.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.m0.addView(this.b0, g52.f(-1, -2));
this.b0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.J6(view);
}
});
i77 i77Var22 = new i77(context);
this.x0 = i77Var22;
i77Var22.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
if (this.s == 0) {
}
this.J1 = LocaleController.getString(str4, i4);
CharSequence charSequence52 = this.J1;
hashMap = this.H1;
CharSequence charSequence222 = charSequence52;
if (hashMap != null) {
}
this.x0.setText(charSequence222);
this.m0.addView(this.x0, g52.f(-1, -2));
if (this.J.d) {
}
} else {
this.g.setTitle(LocaleController.getString("PassportAddress", R.string.PassportAddress));
}
rr1 rr1Var4 = new rr1(context);
this.t0 = rr1Var4;
rr1Var4.setText(LocaleController.getString("PassportAddressHeader", R.string.PassportAddressHeader));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
int i7 = 6;
this.i0 = new EditTextBoldCursor[6];
int i8 = 0;
while (i8 < i7) {
EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
this.i0[i8] = editTextBoldCursor;
b bVar = new b(this, context, editTextBoldCursor);
bVar.setWillNotDraw(false);
this.m0.addView(bVar, g52.f(-1, i6));
bVar.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
if (i8 == 5) {
View view = new View(context);
this.c0 = view;
view.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.c0, g52.f(-1, i7));
}
if (this.F0 && this.J != null) {
bVar.setVisibility(8);
View view2 = this.c0;
if (view2 != null) {
view2.setVisibility(8);
}
}
this.i0[i8].setTag(Integer.valueOf(i8));
this.i0[i8].setSupportRtlHint(true);
this.i0[i8].setTextSize(1, 16.0f);
this.i0[i8].setHintColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
this.i0[i8].setHeaderHintColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueHeader"));
this.i0[i8].setTransformHintToHeader(true);
this.i0[i8].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i8].setBackgroundDrawable(null);
this.i0[i8].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i8].setCursorSize(AndroidUtilities.dp(20.0f));
this.i0[i8].setCursorWidth(1.5f);
this.i0[i8].H(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteInputField"), org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteInputFieldActivated"), org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3"));
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
if (i8 == 5) {
editTextBoldCursorArr[i8].setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view3, MotionEvent motionEvent) {
boolean M6;
M6 = org.telegram.ui.w6.this.M6(view3, motionEvent);
return M6;
}
});
this.i0[i8].setInputType(0);
this.i0[i8].setFocusable(false);
} else {
editTextBoldCursorArr[i8].setInputType(16385);
this.i0[i8].setImeOptions(268435461);
}
if (i8 == 0) {
this.i0[i8].setHintText(LocaleController.getString("PassportStreet1", R.string.PassportStreet1));
str2 = "street_line1";
} else if (i8 == 1) {
this.i0[i8].setHintText(LocaleController.getString("PassportStreet2", R.string.PassportStreet2));
str2 = "street_line2";
} else if (i8 == 2) {
this.i0[i8].setHintText(LocaleController.getString("PassportPostcode", R.string.PassportPostcode));
str2 = "post_code";
} else if (i8 == 3) {
this.i0[i8].setHintText(LocaleController.getString("PassportCity", R.string.PassportCity));
str2 = "city";
} else if (i8 == 4) {
this.i0[i8].setHintText(LocaleController.getString("PassportState", R.string.PassportState));
str2 = "state";
} else if (i8 != 5) {
i8++;
i7 = 6;
i6 = -2;
} else {
this.i0[i8].setHintText(LocaleController.getString("PassportCountry", R.string.PassportCountry));
str2 = "country_code";
}
i8(this.C1, this.i0[i8], str2);
if (i8 == 2) {
this.i0[i8].addTextChangedListener(new c(editTextBoldCursor, str2));
this.i0[i8].setFilters(new InputFilter[]{new InputFilter.LengthFilter(10)});
} else {
this.i0[i8].addTextChangedListener(new d(editTextBoldCursor, str2));
}
EditTextBoldCursor[] editTextBoldCursorArr2 = this.i0;
editTextBoldCursorArr2[i8].setSelection(editTextBoldCursorArr2[i8].length());
this.i0[i8].setPadding(0, 0, 0, 0);
this.i0[i8].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
bVar.addView(this.i0[i8], g52.b(-1, 64.0f, 51, 21.0f, 0.0f, 21.0f, 0.0f));
this.i0[i8].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i9, KeyEvent keyEvent) {
boolean N6;
N6 = org.telegram.ui.w6.this.N6(textView, i9, keyEvent);
return N6;
}
});
i8++;
i7 = 6;
i6 = -2;
}
iv4 iv4Var = new iv4(context);
this.v0 = iv4Var;
this.m0.addView(iv4Var, g52.f(-1, -2));
if (this.F0 && this.J != null) {
this.t0.setVisibility(8);
this.v0.setVisibility(8);
}
if (((this.s == 0 && this.J != null) || this.R == null || this.F0) && this.S == null) {
this.v0.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
if (this.F0 && this.J != null) {
this.x0.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
}
} else {
aq6 aq6Var = this.S;
if (aq6Var != null) {
G5(aq6Var.h);
I5(this.S.g);
}
this.v0.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
o87 o87Var4 = new o87(context);
o87Var4.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3"));
o87Var4.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
if (this.J == null) {
i2 = R.string.PassportDeleteInfo;
str = "PassportDeleteInfo";
} else {
i2 = R.string.PassportDeleteDocument;
str = "PassportDeleteDocument";
}
o87Var4.c(LocaleController.getString(str, i2), false);
this.m0.addView(o87Var4, g52.f(-1, -2));
o87Var4.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
org.telegram.ui.w6.this.O6(view3);
}
});
iv4 iv4Var2 = new iv4(context);
this.v0 = iv4Var2;
iv4Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.m0.addView(this.v0, g52.f(-1, -2));
}
t8(0);
t8(4);
}
public static void Q6(boolean[] zArr, View view) {
if (view.isEnabled()) {
zArr[0] = !zArr[0];
((pg0) view).d(zArr[0], true);
}
}
public void Q7(SecureDocument secureDocument, int i2) {
int i3 = this.c1;
if (i3 == 1) {
SecureDocument secureDocument2 = this.t1;
if (secureDocument2 != null) {
f0 remove = this.x1.remove(secureDocument2);
if (remove != null) {
this.q0.removeView(remove);
}
this.t1 = null;
}
} else if (i3 == 4) {
if (this.u1.size() >= 20) {
return;
}
} else if (i3 == 2) {
SecureDocument secureDocument3 = this.v1;
if (secureDocument3 != null) {
f0 remove2 = this.x1.remove(secureDocument3);
if (remove2 != null) {
this.o0.removeView(remove2);
}
this.v1 = null;
}
} else if (i3 == 3) {
SecureDocument secureDocument4 = this.w1;
if (secureDocument4 != null) {
f0 remove3 = this.x1.remove(secureDocument4);
if (remove3 != null) {
this.p0.removeView(remove3);
}
this.w1 = null;
}
} else if (i3 == 0 && this.s1.size() >= 20) {
return;
}
this.y1.put(secureDocument.path, secureDocument);
this.V.setEnabled(false);
this.V.setAlpha(0.5f);
FileLoader.getInstance(this.d).uploadFile(secureDocument.path, false, true, ConnectionsManager.FileTypePhoto);
E5(secureDocument, i2);
t8(i2);
}
private void R5() {
if (c0() != null && this.b1 == null) {
ChatAttachAlert chatAttachAlert = new ChatAttachAlert(c0(), this, false, false);
this.b1 = chatAttachAlert;
chatAttachAlert.E2(new q());
}
}
public void R6(View view) {
this.v = true;
this.V.callOnClick();
this.v = false;
}
public void R7(MrzRecognizer.Result result) {
xp6 xp6Var;
int i2;
int i3;
EditTextBoldCursor editTextBoldCursor;
int i4;
String str;
int i5 = result.type;
if (i5 == 2) {
if (!(this.J.e instanceof pq6)) {
int size = this.Q.size();
for (int i6 = 0; i6 < size; i6++) {
xp6Var = this.Q.get(i6);
if (xp6Var.e instanceof pq6) {
this.J = xp6Var;
q8();
break;
}
}
}
} else if (i5 == 1) {
if (!(this.J.e instanceof rq6)) {
int size2 = this.Q.size();
for (int i7 = 0; i7 < size2; i7++) {
xp6Var = this.Q.get(i7);
if (xp6Var.e instanceof rq6) {
this.J = xp6Var;
q8();
break;
}
}
}
} else if (i5 == 3) {
if (!(this.J.e instanceof qq6)) {
int size3 = this.Q.size();
for (int i8 = 0; i8 < size3; i8++) {
xp6Var = this.Q.get(i8);
if (xp6Var.e instanceof qq6) {
this.J = xp6Var;
q8();
break;
}
}
}
} else if (i5 == 4 && !(this.J.e instanceof nq6)) {
int size4 = this.Q.size();
for (int i9 = 0; i9 < size4; i9++) {
xp6Var = this.Q.get(i9);
if (xp6Var.e instanceof nq6) {
this.J = xp6Var;
q8();
break;
}
}
}
if (!TextUtils.isEmpty(result.firstName)) {
this.i0[0].setText(result.firstName);
}
if (!TextUtils.isEmpty(result.middleName)) {
this.i0[1].setText(result.middleName);
}
if (!TextUtils.isEmpty(result.lastName)) {
this.i0[2].setText(result.lastName);
}
if (!TextUtils.isEmpty(result.number)) {
this.i0[7].setText(result.number);
}
int i10 = result.gender;
if (i10 != 0) {
if (i10 == 1) {
this.B = "male";
editTextBoldCursor = this.i0[4];
i4 = R.string.PassportMale;
str = "PassportMale";
} else if (i10 == 2) {
this.B = "female";
editTextBoldCursor = this.i0[4];
i4 = R.string.PassportFemale;
str = "PassportFemale";
}
editTextBoldCursor.setText(LocaleController.getString(str, i4));
}
if (!TextUtils.isEmpty(result.nationality)) {
String str2 = result.nationality;
this.z = str2;
String str3 = this.i1.get(str2);
if (str3 != null) {
this.i0[5].setText(str3);
}
}
if (!TextUtils.isEmpty(result.issuingCountry)) {
String str4 = result.issuingCountry;
this.A = str4;
String str5 = this.i1.get(str4);
if (str5 != null) {
this.i0[6].setText(str5);
}
}
int i11 = result.birthDay;
if (i11 > 0 && result.birthMonth > 0 && result.birthYear > 0) {
this.i0[3].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(i11), Integer.valueOf(result.birthMonth), Integer.valueOf(result.birthYear)));
}
int i12 = result.expiryDay;
if (i12 <= 0 || (i2 = result.expiryMonth) <= 0 || (i3 = result.expiryYear) <= 0) {
int[] iArr = this.G;
iArr[2] = 0;
iArr[1] = 0;
iArr[0] = 0;
this.i0[8].setText(LocaleController.getString("PassportNoExpireDate", R.string.PassportNoExpireDate));
return;
}
int[] iArr2 = this.G;
iArr2[0] = i3;
iArr2[1] = i2;
iArr2[2] = i12;
this.i0[8].setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(i12), Integer.valueOf(result.expiryMonth), Integer.valueOf(result.expiryYear)));
}
private void S5() {
int i2;
String str;
int i3;
String str2;
final boolean[] zArr = {true};
i.C0142i c0142i = new i.C0142i(c0());
c0142i.s(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i4) {
org.telegram.ui.w6.this.P6(zArr, dialogInterface, i4);
}
});
c0142i.n(LocaleController.getString("Cancel", R.string.Cancel), null);
c0142i.u(LocaleController.getString("AppName", R.string.AppName));
boolean z2 = this.F0;
if (z2 && this.J == null && (this.I.e instanceof lq6)) {
i2 = R.string.PassportDeleteAddressAlert;
str = "PassportDeleteAddressAlert";
} else if (z2 && this.J == null && (this.I.e instanceof tq6)) {
i2 = R.string.PassportDeletePersonalAlert;
str = "PassportDeletePersonalAlert";
} else {
i2 = R.string.PassportDeleteDocumentAlert;
str = "PassportDeleteDocumentAlert";
}
c0142i.l(LocaleController.getString(str, i2));
if (!this.F0 && this.J != null) {
FrameLayout frameLayout = new FrameLayout(c0());
pg0 pg0Var = new pg0(c0(), 1);
pg0Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(false));
ed5 ed5Var = this.I.e;
if (ed5Var instanceof lq6) {
i3 = R.string.PassportDeleteDocumentAddress;
str2 = "PassportDeleteDocumentAddress";
} else {
if (ed5Var instanceof tq6) {
i3 = R.string.PassportDeleteDocumentPersonal;
str2 = "PassportDeleteDocumentPersonal";
}
pg0Var.setPadding(!LocaleController.isRTL ? AndroidUtilities.dp(16.0f) : AndroidUtilities.dp(8.0f), 0, !LocaleController.isRTL ? AndroidUtilities.dp(8.0f) : AndroidUtilities.dp(16.0f), 0);
frameLayout.addView(pg0Var, g52.c(-1, 48, 51));
pg0Var.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.Q6(zArr, view);
}
});
c0142i.A(frameLayout);
}
pg0Var.e(LocaleController.getString(str2, i3), BuildConfig.FLAVOR, true, false);
pg0Var.setPadding(!LocaleController.isRTL ? AndroidUtilities.dp(16.0f) : AndroidUtilities.dp(8.0f), 0, !LocaleController.isRTL ? AndroidUtilities.dp(8.0f) : AndroidUtilities.dp(16.0f), 0);
frameLayout.addView(pg0Var, g52.c(-1, 48, 51));
pg0Var.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.Q6(zArr, view);
}
});
c0142i.A(frameLayout);
}
o1(c0142i.a());
}
public boolean S6(TextView textView, int i2, KeyEvent keyEvent) {
if (i2 != 6 && i2 != 5) {
return false;
}
this.V.callOnClick();
return true;
}
public void S7(ArrayList arrayList, final int i2, boolean z2) {
qc5 scaleAndSaveImage;
int i3 = this.c1;
int min = Math.min((i3 == 0 || i3 == 4) ? 20 : 1, arrayList.size());
boolean z3 = false;
for (int i4 = 0; i4 < min; i4++) {
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = (SendMessagesHelper.SendingMediaInfo) arrayList.get(i4);
Bitmap loadBitmap = ImageLoader.loadBitmap(sendingMediaInfo.path, sendingMediaInfo.uri, 2048.0f, 2048.0f, false);
if (loadBitmap != null && (scaleAndSaveImage = ImageLoader.scaleAndSaveImage(loadBitmap, 2048.0f, 2048.0f, 89, false, 320, 320)) != null) {
qp6 qp6Var = new qp6();
qp6Var.d = (int) scaleAndSaveImage.b.b;
qp6Var.a = r9.c;
qp6Var.e = (int) (System.currentTimeMillis() / 1000);
final SecureDocument c2 = this.L1.c(qp6Var);
c2.type = i2;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.Q7(c2, i2);
}
});
if (z2 && !z3) {
try {
final MrzRecognizer.Result recognize = MrzRecognizer.recognize(loadBitmap, this.J.e instanceof nq6);
if (recognize != null) {
try {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.R7(recognize);
}
});
z3 = true;
} catch (Throwable th) {
th = th;
z3 = true;
FileLog.e(th);
}
}
} catch (Throwable th2) {
th = th2;
}
}
}
}
SharedConfig.saveConfig();
}
private void T5(Context context) {
this.g.setTitle(LocaleController.getString("PassportEmail", R.string.PassportEmail));
if (!TextUtils.isEmpty(this.n1)) {
o87 o87Var = new o87(context);
o87Var.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
o87Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
o87Var.c(LocaleController.formatString("PassportPhoneUseSame", R.string.PassportPhoneUseSame, this.n1), false);
this.m0.addView(o87Var, g52.f(-1, -2));
o87Var.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.R6(view);
}
});
i77 i77Var = new i77(context);
this.x0 = i77Var;
i77Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.x0.setText(LocaleController.getString("PassportPhoneUseSameEmailInfo", R.string.PassportPhoneUseSameEmailInfo));
this.m0.addView(this.x0, g52.f(-1, -2));
}
this.i0 = new EditTextBoldCursor[1];
for (int i2 = 0; i2 < 1; i2++) {
FrameLayout frameLayout = new FrameLayout(context);
this.m0.addView(frameLayout, g52.f(-1, 50));
frameLayout.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.i0[i2] = new EditTextBoldCursor(context);
this.i0[i2].setTag(Integer.valueOf(i2));
this.i0[i2].setTextSize(1, 16.0f);
this.i0[i2].setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
this.i0[i2].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i2].setBackgroundDrawable(null);
this.i0[i2].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i2].setCursorSize(AndroidUtilities.dp(20.0f));
this.i0[i2].setCursorWidth(1.5f);
this.i0[i2].setInputType(33);
this.i0[i2].setImeOptions(268435462);
this.i0[i2].setHint(LocaleController.getString("PaymentShippingEmailPlaceholder", R.string.PaymentShippingEmailPlaceholder));
aq6 aq6Var = this.R;
if (aq6Var != null) {
bd5 bd5Var = aq6Var.i;
if (bd5Var instanceof vp6) {
vp6 vp6Var = (vp6) bd5Var;
if (!TextUtils.isEmpty(vp6Var.a)) {
this.i0[i2].setText(vp6Var.a);
}
}
}
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
editTextBoldCursorArr[i2].setSelection(editTextBoldCursorArr[i2].length());
this.i0[i2].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
this.i0[i2].setGravity(LocaleController.isRTL ? 5 : 3);
frameLayout.addView(this.i0[i2], g52.b(-1, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
this.i0[i2].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i3, KeyEvent keyEvent) {
boolean S6;
S6 = org.telegram.ui.w6.this.S6(textView, i3, keyEvent);
return S6;
}
});
}
i77 i77Var2 = new i77(context);
this.x0 = i77Var2;
i77Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.x0.setText(LocaleController.getString("PassportEmailUploadInfo", R.string.PassportEmailUploadInfo));
this.m0.addView(this.x0, g52.f(-1, -2));
}
public boolean T6(TextView textView, int i2, KeyEvent keyEvent) {
if (i2 != 6 && i2 != 5) {
return false;
}
this.V.callOnClick();
return true;
}
public void T7(ov5 ov5Var, String str, c0 c0Var, i95 i95Var, qf5 qf5Var) {
if (ov5Var != null) {
org.telegram.ui.Components.b.l4(this.d, ov5Var, this, qf5Var, str);
return;
}
HashMap hashMap = new HashMap();
hashMap.put("phone", str);
w6 w6Var = new w6(7, this.H, this.T, this.I, (aq6) null, (xp6) null, (aq6) null, (HashMap<String, String>) hashMap, (HashMap<String, String>) null);
w6Var.d = this.d;
w6Var.o1 = this.o1;
w6Var.m1 = this.m1;
w6Var.L1 = c0Var;
w6Var.U = (lh5) i95Var;
T0(w6Var, true);
}
private void U5(Context context) {
this.g.setTitle(LocaleController.getString("PassportEmail", R.string.PassportEmail));
this.i0 = new EditTextBoldCursor[1];
for (int i2 = 0; i2 < 1; i2++) {
FrameLayout frameLayout = new FrameLayout(context);
this.m0.addView(frameLayout, g52.f(-1, 50));
frameLayout.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.i0[i2] = new EditTextBoldCursor(context);
this.i0[i2].setTag(Integer.valueOf(i2));
this.i0[i2].setTextSize(1, 16.0f);
this.i0[i2].setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
this.i0[i2].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i2].setBackgroundDrawable(null);
this.i0[i2].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i2].setCursorSize(AndroidUtilities.dp(20.0f));
this.i0[i2].setCursorWidth(1.5f);
int i3 = 3;
this.i0[i2].setInputType(3);
this.i0[i2].setImeOptions(268435462);
this.i0[i2].setHint(LocaleController.getString("PassportEmailCode", R.string.PassportEmailCode));
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
editTextBoldCursorArr[i2].setSelection(editTextBoldCursorArr[i2].length());
this.i0[i2].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
EditTextBoldCursor editTextBoldCursor = this.i0[i2];
if (LocaleController.isRTL) {
i3 = 5;
}
editTextBoldCursor.setGravity(i3);
frameLayout.addView(this.i0[i2], g52.b(-1, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
this.i0[i2].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i4, KeyEvent keyEvent) {
boolean T6;
T6 = org.telegram.ui.w6.this.T6(textView, i4, keyEvent);
return T6;
}
});
this.i0[i2].addTextChangedListener(new v());
}
i77 i77Var = new i77(context);
this.x0 = i77Var;
i77Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.x0.setText(LocaleController.formatString("PassportEmailVerifyInfo", R.string.PassportEmailVerifyInfo, this.C1.get("email")));
this.m0.addView(this.x0, g52.f(-1, -2));
}
public void U6(View view) {
this.c1 = 2;
c8();
}
public void U7(final String str, final c0 c0Var, final qf5 qf5Var, final i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
w6.this.T7(ov5Var, str, c0Var, i95Var, qf5Var);
}
});
}
private void V5(final Context context) {
LinearLayout linearLayout;
i77 i77Var;
int i2;
String str;
boolean z2;
String string;
HashMap<String, String> hashMap;
String str2;
EditTextBoldCursor editTextBoldCursor;
int i3;
String str3;
HashMap<String, String> hashMap2;
String str4;
EditTextBoldCursor editTextBoldCursor2;
int i4;
String str5;
EditTextBoldCursor editTextBoldCursor3;
int i5;
String str6;
boolean z3;
EditTextBoldCursor editTextBoldCursor4;
int i6;
String str7;
int i7;
String str8;
HashMap<String, String> hashMap3;
this.i1 = new HashMap<>();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("countries.txt")));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
String[] split = readLine.split(";");
this.i1.put(split[1], split[2]);
}
bufferedReader.close();
} catch (Exception e2) {
FileLog.e(e2);
}
i77 i77Var2 = new i77(context);
this.z0 = i77Var2;
i77Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_top, "windowBackgroundGrayShadow"));
this.z0.setPadding(0, AndroidUtilities.dp(7.0f), 0, 0);
int i8 = -1;
this.m0.addView(this.z0, g52.f(-1, -2));
P5(true);
if (this.J != null) {
rr1 rr1Var = new rr1(context);
this.t0 = rr1Var;
if (this.F0) {
i6 = R.string.PassportDocuments;
str7 = "PassportDocuments";
} else {
i6 = R.string.PassportRequiredDocuments;
str7 = "PassportRequiredDocuments";
}
rr1Var.setText(LocaleController.getString(str7, i6));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
LinearLayout linearLayout2 = new LinearLayout(context);
this.o0 = linearLayout2;
linearLayout2.setOrientation(1);
this.m0.addView(this.o0, g52.f(-1, -2));
e77 e77Var = new e77(context);
this.e0 = e77Var;
e77Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.m0.addView(this.e0, g52.f(-1, -2));
this.e0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.U6(view);
}
});
LinearLayout linearLayout3 = new LinearLayout(context);
this.p0 = linearLayout3;
linearLayout3.setOrientation(1);
this.m0.addView(this.p0, g52.f(-1, -2));
boolean z4 = this.J.c;
e77 e77Var2 = new e77(context);
this.f0 = e77Var2;
e77Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.f0.a(LocaleController.getString("PassportReverseSide", R.string.PassportReverseSide), LocaleController.getString("PassportReverseSideInfo", R.string.PassportReverseSideInfo), z4);
this.m0.addView(this.f0, g52.f(-1, -2));
this.f0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.V6(view);
}
});
if (this.J.c) {
LinearLayout linearLayout4 = new LinearLayout(context);
this.q0 = linearLayout4;
linearLayout4.setOrientation(1);
this.m0.addView(this.q0, g52.f(-1, -2));
e77 e77Var3 = new e77(context);
this.g0 = e77Var3;
e77Var3.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.g0.a(LocaleController.getString("PassportSelfie", R.string.PassportSelfie), LocaleController.getString("PassportSelfieInfo", R.string.PassportSelfieInfo), this.I.d);
this.m0.addView(this.g0, g52.f(-1, -2));
this.g0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.W6(view);
}
});
}
i77 i77Var3 = new i77(context);
this.x0 = i77Var3;
i77Var3.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
this.x0.setText(LocaleController.getString("PassportPersonalUploadInfo", R.string.PassportPersonalUploadInfo));
this.m0.addView(this.x0, g52.f(-1, -2));
if (this.J.d) {
rr1 rr1Var2 = new rr1(context);
this.t0 = rr1Var2;
rr1Var2.setText(LocaleController.getString("PassportTranslation", R.string.PassportTranslation));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
LinearLayout linearLayout5 = new LinearLayout(context);
this.r0 = linearLayout5;
linearLayout5.setOrientation(1);
this.m0.addView(this.r0, g52.f(-1, -2));
o87 o87Var = new o87(context);
this.h0 = o87Var;
o87Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.m0.addView(this.h0, g52.f(-1, -2));
this.h0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.X6(view);
}
});
i77 i77Var4 = new i77(context);
this.y0 = i77Var4;
i77Var4.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
if (this.s != 0) {
i7 = R.string.PassportAddTranslationUploadInfo;
str8 = "PassportAddTranslationUploadInfo";
} else {
ed5 ed5Var = this.J.e;
if (ed5Var instanceof rq6) {
i7 = R.string.PassportAddPassportInfo;
str8 = "PassportAddPassportInfo";
} else if (ed5Var instanceof qq6) {
i7 = R.string.PassportAddInternalPassportInfo;
str8 = "PassportAddInternalPassportInfo";
} else if (ed5Var instanceof pq6) {
i7 = R.string.PassportAddIdentityCardInfo;
str8 = "PassportAddIdentityCardInfo";
} else if (ed5Var instanceof nq6) {
i7 = R.string.PassportAddDriverLicenceInfo;
str8 = "PassportAddDriverLicenceInfo";
} else {
this.K1 = BuildConfig.FLAVOR;
CharSequence charSequence = this.K1;
hashMap3 = this.H1;
CharSequence charSequence2 = charSequence;
if (hashMap3 != null) {
String str9 = hashMap3.get("translation_all");
charSequence2 = charSequence;
if (str9 != null) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(str9);
spannableStringBuilder.append((CharSequence) "\n\n");
spannableStringBuilder.append(this.K1);
spannableStringBuilder.setSpan(new ForegroundColorSpan(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3")), 0, str9.length(), 33);
this.I1.put("translation_all", BuildConfig.FLAVOR);
charSequence2 = spannableStringBuilder;
}
}
this.y0.setText(charSequence2);
linearLayout = this.m0;
i77Var = this.y0;
linearLayout.addView(i77Var, g52.f(-1, -2));
}
}
this.K1 = LocaleController.getString(str8, i7);
CharSequence charSequence3 = this.K1;
hashMap3 = this.H1;
CharSequence charSequence22 = charSequence3;
if (hashMap3 != null) {
}
this.y0.setText(charSequence22);
linearLayout = this.m0;
i77Var = this.y0;
linearLayout.addView(i77Var, g52.f(-1, -2));
}
} else if (Build.VERSION.SDK_INT >= 18) {
o87 o87Var2 = new o87(context);
this.B0 = o87Var2;
o87Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.B0.c(LocaleController.getString("PassportScanPassport", R.string.PassportScanPassport), false);
this.m0.addView(this.B0, g52.f(-1, -2));
this.B0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.Y6(view);
}
});
i77 i77Var5 = new i77(context);
this.x0 = i77Var5;
i77Var5.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
this.x0.setText(LocaleController.getString("PassportScanPassportInfo", R.string.PassportScanPassportInfo));
linearLayout = this.m0;
i77Var = this.x0;
linearLayout.addView(i77Var, g52.f(-1, -2));
}
rr1 rr1Var3 = new rr1(context);
this.t0 = rr1Var3;
if (this.F0) {
i2 = R.string.PassportDocument;
str = "PassportDocument";
} else {
i2 = R.string.PassportPersonal;
str = "PassportPersonal";
}
rr1Var3.setText(LocaleController.getString(str, i2));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
int i9 = this.J != null ? 9 : 7;
this.i0 = new EditTextBoldCursor[i9];
int i10 = 0;
while (true) {
int i11 = 6;
if (i10 >= i9) {
iv4 iv4Var = new iv4(context);
this.w0 = iv4Var;
this.m0.addView(iv4Var, g52.f(-1, -2));
rr1 rr1Var4 = new rr1(context);
this.t0 = rr1Var4;
rr1Var4.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
int i12 = 3;
this.k0 = new EditTextBoldCursor[3];
int i13 = 0;
while (i13 < i12) {
EditTextBoldCursor editTextBoldCursor5 = new EditTextBoldCursor(context);
this.k0[i13] = editTextBoldCursor5;
i iVar = new i(this, context, editTextBoldCursor5);
iVar.setWillNotDraw(false);
this.m0.addView(iVar, g52.f(-1, 64));
iVar.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
if (i13 == 2) {
View view = new View(context);
this.d0 = view;
view.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.d0, g52.f(-1, i11));
}
this.k0[i13].setTag(Integer.valueOf(i13));
this.k0[i13].setSupportRtlHint(true);
this.k0[i13].setTextSize(1, 16.0f);
this.k0[i13].setHintColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
this.k0[i13].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.k0[i13].setHeaderHintColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueHeader"));
this.k0[i13].setTransformHintToHeader(true);
this.k0[i13].setBackgroundDrawable(null);
this.k0[i13].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.k0[i13].setCursorSize(AndroidUtilities.dp(20.0f));
this.k0[i13].setCursorWidth(1.5f);
this.k0[i13].H(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteInputField"), org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteInputFieldActivated"), org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3"));
this.k0[i13].setInputType(16385);
this.k0[i13].setImeOptions(268435461);
if (i13 == 0) {
hashMap = this.C1;
str2 = "first_name_native";
} else if (i13 == 1) {
hashMap = this.C1;
str2 = "middle_name_native";
} else if (i13 != 2) {
i13++;
i12 = 3;
i11 = 6;
} else {
hashMap = this.C1;
str2 = "last_name_native";
}
i8(hashMap, this.k0[i13], str2);
EditTextBoldCursor[] editTextBoldCursorArr = this.k0;
editTextBoldCursorArr[i13].setSelection(editTextBoldCursorArr[i13].length());
if (i13 == 0 || i13 == 2 || i13 == 1) {
this.k0[i13].addTextChangedListener(new j(editTextBoldCursor5, str2));
}
this.k0[i13].setPadding(0, 0, 0, 0);
this.k0[i13].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
iVar.addView(this.k0[i13], g52.b(-1, -1.0f, 51, 21.0f, 0.0f, 21.0f, 0.0f));
this.k0[i13].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i14, KeyEvent keyEvent) {
boolean h7;
h7 = org.telegram.ui.w6.this.h7(textView, i14, keyEvent);
return h7;
}
});
i13++;
i12 = 3;
i11 = 6;
}
i77 i77Var6 = new i77(context);
this.A0 = i77Var6;
this.m0.addView(i77Var6, g52.f(-1, -2));
if (((this.s == 0 && this.J != null) || this.R == null || this.F0) && this.S == null) {
this.A0.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
} else {
aq6 aq6Var = this.S;
if (aq6Var != null) {
G5(aq6Var.h);
zc5 zc5Var = this.S.d;
if (zc5Var instanceof qp6) {
F5((qp6) zc5Var, 2);
}
zc5 zc5Var2 = this.S.e;
if (zc5Var2 instanceof qp6) {
F5((qp6) zc5Var2, 3);
}
zc5 zc5Var3 = this.S.f;
if (zc5Var3 instanceof qp6) {
F5((qp6) zc5Var3, 1);
}
I5(this.S.g);
}
o87 o87Var3 = new o87(context);
o87Var3.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3"));
o87Var3.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
if (this.J == null) {
string = LocaleController.getString("PassportDeleteInfo", R.string.PassportDeleteInfo);
z2 = false;
} else {
z2 = false;
string = LocaleController.getString("PassportDeleteDocument", R.string.PassportDeleteDocument);
}
o87Var3.c(string, z2);
this.m0.addView(o87Var3, g52.f(-1, -2));
o87Var3.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
org.telegram.ui.w6.this.i7(view2);
}
});
this.A0.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
iv4 iv4Var2 = new iv4(context);
this.v0 = iv4Var2;
iv4Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.m0.addView(this.v0, g52.f(-1, -2));
}
q8();
N5(false);
return;
}
EditTextBoldCursor editTextBoldCursor6 = new EditTextBoldCursor(context);
this.i0[i10] = editTextBoldCursor6;
f fVar = new f(this, context, editTextBoldCursor6);
fVar.setWillNotDraw(false);
this.m0.addView(fVar, g52.f(i8, 64));
fVar.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
if (i10 == i9 - 1) {
View view2 = new View(context);
this.c0 = view2;
view2.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.c0, g52.f(i8, 6));
}
if (this.F0 && this.J != null) {
if (i10 < 7) {
fVar.setVisibility(8);
View view3 = this.c0;
if (view3 != null) {
view3.setVisibility(8);
}
}
}
this.i0[i10].setTag(Integer.valueOf(i10));
this.i0[i10].setSupportRtlHint(true);
this.i0[i10].setTextSize(1, 16.0f);
this.i0[i10].setHintColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
this.i0[i10].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i10].setHeaderHintColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueHeader"));
this.i0[i10].setTransformHintToHeader(true);
this.i0[i10].setBackgroundDrawable(null);
this.i0[i10].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i10].setCursorSize(AndroidUtilities.dp(20.0f));
this.i0[i10].setCursorWidth(1.5f);
this.i0[i10].H(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteInputField"), org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteInputFieldActivated"), org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3"));
if (i10 == 5 || i10 == 6) {
this.i0[i10].setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view4, MotionEvent motionEvent) {
boolean a7;
a7 = org.telegram.ui.w6.this.a7(view4, motionEvent);
return a7;
}
});
this.i0[i10].setInputType(0);
} else {
if (i10 == 3 || i10 == 8) {
this.i0[i10].setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view4, MotionEvent motionEvent) {
boolean d7;
d7 = org.telegram.ui.w6.this.d7(context, view4, motionEvent);
return d7;
}
});
z3 = false;
this.i0[i10].setInputType(0);
editTextBoldCursor4 = this.i0[i10];
} else if (i10 == 4) {
this.i0[i10].setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view4, MotionEvent motionEvent) {
boolean f7;
f7 = org.telegram.ui.w6.this.f7(view4, motionEvent);
return f7;
}
});
z3 = false;
this.i0[i10].setInputType(0);
editTextBoldCursor4 = this.i0[i10];
} else {
this.i0[i10].setInputType(16385);
this.i0[i10].setImeOptions(268435461);
}
editTextBoldCursor4.setFocusable(z3);
}
switch (i10) {
case 0:
if (this.I.b) {
editTextBoldCursor = this.i0[i10];
i3 = R.string.PassportNameLatin;
str3 = "PassportNameLatin";
} else {
editTextBoldCursor = this.i0[i10];
i3 = R.string.PassportName;
str3 = "PassportName";
}
editTextBoldCursor.setHintText(LocaleController.getString(str3, i3));
hashMap2 = this.C1;
str4 = "first_name";
break;
case 1:
if (this.I.b) {
editTextBoldCursor2 = this.i0[i10];
i4 = R.string.PassportMidnameLatin;
str5 = "PassportMidnameLatin";
} else {
editTextBoldCursor2 = this.i0[i10];
i4 = R.string.PassportMidname;
str5 = "PassportMidname";
}
editTextBoldCursor2.setHintText(LocaleController.getString(str5, i4));
hashMap2 = this.C1;
str4 = "middle_name";
break;
case 2:
if (this.I.b) {
editTextBoldCursor3 = this.i0[i10];
i5 = R.string.PassportSurnameLatin;
str6 = "PassportSurnameLatin";
} else {
editTextBoldCursor3 = this.i0[i10];
i5 = R.string.PassportSurname;
str6 = "PassportSurname";
}
editTextBoldCursor3.setHintText(LocaleController.getString(str6, i5));
hashMap2 = this.C1;
str4 = "last_name";
break;
case 3:
this.i0[i10].setHintText(LocaleController.getString("PassportBirthdate", R.string.PassportBirthdate));
hashMap2 = this.C1;
str4 = "birth_date";
break;
case 4:
this.i0[i10].setHintText(LocaleController.getString("PassportGender", R.string.PassportGender));
hashMap2 = this.C1;
str4 = "gender";
break;
case 5:
this.i0[i10].setHintText(LocaleController.getString("PassportCitizenship", R.string.PassportCitizenship));
hashMap2 = this.C1;
str4 = "country_code";
break;
case 6:
this.i0[i10].setHintText(LocaleController.getString("PassportResidence", R.string.PassportResidence));
hashMap2 = this.C1;
str4 = "residence_country_code";
break;
case 7:
this.i0[i10].setHintText(LocaleController.getString("PassportDocumentNumber", R.string.PassportDocumentNumber));
hashMap2 = this.D1;
str4 = "document_no";
break;
case 8:
this.i0[i10].setHintText(LocaleController.getString("PassportExpired", R.string.PassportExpired));
hashMap2 = this.D1;
str4 = "expiry_date";
break;
}
i8(hashMap2, this.i0[i10], str4);
EditTextBoldCursor[] editTextBoldCursorArr2 = this.i0;
editTextBoldCursorArr2[i10].setSelection(editTextBoldCursorArr2[i10].length());
if (i10 == 0 || i10 == 2 || i10 == 1) {
this.i0[i10].addTextChangedListener(new g(editTextBoldCursor6, str4));
} else {
this.i0[i10].addTextChangedListener(new h(editTextBoldCursor6, str4, hashMap2));
}
this.i0[i10].setPadding(0, 0, 0, 0);
this.i0[i10].setGravity((LocaleController.isRTL ? 5 : 3) | 16);
fVar.addView(this.i0[i10], g52.b(-1, -1.0f, 51, 21.0f, 0.0f, 21.0f, 0.0f));
this.i0[i10].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i14, KeyEvent keyEvent) {
boolean g7;
g7 = org.telegram.ui.w6.this.g7(textView, i14, keyEvent);
return g7;
}
});
i10++;
i8 = -1;
}
}
public void V6(View view) {
this.c1 = 3;
c8();
}
private void V7() {
ConnectionsManager.getInstance(this.d).bindRequestToGuid(ConnectionsManager.getInstance(this.d).sendRequest(new ie5(), new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
org.telegram.ui.w6.this.I7(i95Var, ov5Var);
}
}), this.k);
}
private void W5(Context context) {
LinearLayout linearLayout;
LinearLayout linearLayout2;
LinearLayout.LayoutParams layoutParams;
ArrayList<xp6> arrayList;
xp6 xp6Var;
boolean z2;
ArrayList<xp6> arrayList2;
xp6 xp6Var2;
ed5 lq6Var;
this.g.setTitle(LocaleController.getString("TelegramPassport", R.string.TelegramPassport));
this.g.z().b(1, org.telegram.messenger.R.drawable.profile_info);
rr1 rr1Var = new rr1(context);
this.t0 = rr1Var;
rr1Var.setText(LocaleController.getString("PassportProvidedInformation", R.string.PassportProvidedInformation));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
iv4 iv4Var = new iv4(context);
this.v0 = iv4Var;
iv4Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider, "windowBackgroundGrayShadow"));
this.m0.addView(this.v0, g52.f(-1, -2));
o87 o87Var = new o87(context);
this.H0 = o87Var;
o87Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.H0.c(LocaleController.getString("PassportNoDocumentsAdd", R.string.PassportNoDocumentsAdd), true);
this.m0.addView(this.H0, g52.f(-1, -2));
this.H0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.j7(view);
}
});
o87 o87Var2 = new o87(context);
this.I0 = o87Var2;
o87Var2.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText3"));
this.I0.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
this.I0.c(LocaleController.getString("TelegramPassportDelete", R.string.TelegramPassportDelete), false);
this.m0.addView(this.I0, g52.f(-1, -2));
this.I0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.n7(view);
}
});
iv4 iv4Var2 = new iv4(context);
this.J0 = iv4Var2;
iv4Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.m0.addView(this.J0, g52.f(-1, -2));
LinearLayout linearLayout3 = new LinearLayout(context);
this.K0 = linearLayout3;
linearLayout3.setOrientation(1);
this.K0.setGravity(17);
this.K0.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
if (AndroidUtilities.isTablet()) {
linearLayout = this.m0;
linearLayout2 = this.K0;
layoutParams = new LinearLayout.LayoutParams(-1, AndroidUtilities.dp(528.0f) - org.telegram.ui.ActionBar.a.getCurrentActionBarHeight());
} else {
linearLayout = this.m0;
linearLayout2 = this.K0;
layoutParams = new LinearLayout.LayoutParams(-1, AndroidUtilities.displaySize.y - org.telegram.ui.ActionBar.a.getCurrentActionBarHeight());
}
linearLayout.addView(linearLayout2, layoutParams);
ImageView imageView = new ImageView(context);
this.L0 = imageView;
imageView.setImageResource(org.telegram.messenger.R.drawable.no_passport);
this.L0.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("sessions_devicesImage"), PorterDuff.Mode.MULTIPLY));
this.K0.addView(this.L0, g52.f(-2, -2));
TextView textView = new TextView(context);
this.M0 = textView;
textView.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText2"));
this.M0.setGravity(17);
this.M0.setTextSize(1, 15.0f);
this.M0.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.M0.setText(LocaleController.getString("PassportNoDocuments", R.string.PassportNoDocuments));
this.K0.addView(this.M0, g52.m(-2, -2, 17, 0, 16, 0, 0));
TextView textView2 = new TextView(context);
this.N0 = textView2;
textView2.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText2"));
this.N0.setGravity(17);
this.N0.setTextSize(1, 14.0f);
this.N0.setPadding(AndroidUtilities.dp(20.0f), 0, AndroidUtilities.dp(20.0f), 0);
this.N0.setText(LocaleController.getString("PassportNoDocumentsInfo", R.string.PassportNoDocumentsInfo));
this.K0.addView(this.N0, g52.m(-2, -2, 17, 0, 14, 0, 0));
TextView textView3 = new TextView(context);
this.O0 = textView3;
textView3.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
this.O0.setGravity(17);
this.O0.setTextSize(1, 15.0f);
this.O0.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.O0.setGravity(17);
this.O0.setText(LocaleController.getString("PassportNoDocumentsAdd", R.string.PassportNoDocumentsAdd).toUpperCase());
this.K0.addView(this.O0, g52.m(-2, 30, 17, 0, 16, 0, 0));
this.O0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.o7(view);
}
});
int size = this.H.c.size();
int i2 = 0;
while (i2 < size) {
aq6 aq6Var = this.H.c.get(i2);
if (z6(aq6Var.b)) {
arrayList2 = new ArrayList<>();
xp6 xp6Var3 = new xp6();
xp6Var3.e = aq6Var.b;
xp6Var3.c = true;
xp6Var3.d = true;
arrayList2.add(xp6Var3);
xp6Var2 = new xp6();
lq6Var = new tq6();
} else if (x6(aq6Var.b)) {
arrayList2 = new ArrayList<>();
xp6 xp6Var4 = new xp6();
xp6Var4.e = aq6Var.b;
xp6Var4.d = true;
arrayList2.add(xp6Var4);
xp6Var2 = new xp6();
lq6Var = new lq6();
} else {
xp6 xp6Var5 = new xp6();
xp6Var5.e = aq6Var.b;
arrayList = null;
xp6Var = xp6Var5;
z2 = false;
H5(context, xp6Var, arrayList, z2, i2 != size + (-1));
i2++;
}
xp6Var2.e = lq6Var;
xp6Var = xp6Var2;
arrayList = arrayList2;
z2 = true;
H5(context, xp6Var, arrayList, z2, i2 != size + (-1));
i2++;
}
r8();
}
public void W6(View view) {
this.c1 = 1;
c8();
}
private void X5(Context context) {
f27 currentUser;
i77 i77Var;
CharSequence replaceTags;
if (this.H != null) {
int i2 = 0;
while (true) {
if (i2 >= this.H.e.size()) {
currentUser = null;
break;
}
currentUser = this.H.e.get(i2);
if (currentUser.a == this.s) {
break;
} else {
i2++;
}
}
} else {
currentUser = UserConfig.getInstance(this.d).getCurrentUser();
}
FrameLayout frameLayout = (FrameLayout) this.e;
this.g.setTitle(LocaleController.getString("TelegramPassport", R.string.TelegramPassport));
t51 t51Var = new t51(context);
this.P0 = t51Var;
t51Var.d();
frameLayout.addView(this.P0, g52.a(-1, -1.0f));
FrameLayout frameLayout2 = new FrameLayout(context);
this.V0 = frameLayout2;
this.m0.addView(frameLayout2, g52.f(-1, 100));
org.telegram.messenger.p110.pf pfVar = new org.telegram.messenger.p110.pf(context);
pfVar.setRoundRadius(AndroidUtilities.dp(32.0f));
this.V0.addView(pfVar, g52.b(64, 64.0f, 17, 0.0f, 8.0f, 0.0f, 0.0f));
pfVar.a(currentUser, new org.telegram.messenger.p110.xe(currentUser));
i77 i77Var2 = new i77(context);
this.Q0 = i77Var2;
i77Var2.getTextView().setGravity(1);
if (this.s == 0) {
i77Var = this.Q0;
replaceTags = LocaleController.getString("PassportSelfRequest", R.string.PassportSelfRequest);
} else {
i77Var = this.Q0;
replaceTags = AndroidUtilities.replaceTags(LocaleController.formatString("PassportRequest", R.string.PassportRequest, UserObject.getFirstName(currentUser)));
}
i77Var.setText(replaceTags);
((FrameLayout.LayoutParams) this.Q0.getTextView().getLayoutParams()).gravity = 1;
this.m0.addView(this.Q0, g52.b(-2, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 0.0f, 21.0f, 0.0f));
ImageView imageView = new ImageView(context);
this.S0 = imageView;
imageView.setImageResource(org.telegram.messenger.R.drawable.no_password);
this.S0.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("chat_messagePanelIcons"), PorterDuff.Mode.MULTIPLY));
this.m0.addView(this.S0, g52.m(-2, -2, 49, 0, 13, 0, 0));
TextView textView = new TextView(context);
this.T0 = textView;
textView.setTextSize(1, 14.0f);
this.T0.setGravity(1);
this.T0.setPadding(AndroidUtilities.dp(21.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(21.0f), AndroidUtilities.dp(17.0f));
this.T0.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText4"));
this.T0.setText(LocaleController.getString("TelegramPassportCreatePasswordInfo", R.string.TelegramPassportCreatePasswordInfo));
this.m0.addView(this.T0, g52.b(-2, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 10.0f, 21.0f, 0.0f));
TextView textView2 = new TextView(context);
this.U0 = textView2;
textView2.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText5"));
this.U0.setGravity(17);
this.U0.setTextSize(1, 16.0f);
this.U0.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.U0.setText(LocaleController.getString("TelegramPassportCreatePassword", R.string.TelegramPassportCreatePassword));
this.m0.addView(this.U0, g52.b(-1, 24.0f, (LocaleController.isRTL ? 5 : 3) | 48, 21.0f, 9.0f, 21.0f, 0.0f));
this.U0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.s7(view);
}
});
this.i0 = new EditTextBoldCursor[1];
this.j0 = new ViewGroup[1];
for (int i3 = 0; i3 < 1; i3++) {
this.j0[i3] = new FrameLayout(context);
this.m0.addView(this.j0[i3], g52.f(-1, 50));
this.j0[i3].setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.i0[i3] = new EditTextBoldCursor(context);
this.i0[i3].setTag(Integer.valueOf(i3));
this.i0[i3].setTextSize(1, 16.0f);
this.i0[i3].setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
this.i0[i3].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i3].setBackgroundDrawable(null);
this.i0[i3].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i3].setCursorSize(AndroidUtilities.dp(20.0f));
this.i0[i3].setCursorWidth(1.5f);
this.i0[i3].setInputType(129);
this.i0[i3].setMaxLines(1);
this.i0[i3].setLines(1);
this.i0[i3].setSingleLine(true);
this.i0[i3].setTransformationMethod(PasswordTransformationMethod.getInstance());
this.i0[i3].setTypeface(Typeface.DEFAULT);
this.i0[i3].setImeOptions(268435462);
this.i0[i3].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
this.i0[i3].setGravity(LocaleController.isRTL ? 5 : 3);
this.j0[i3].addView(this.i0[i3], g52.b(-1, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
this.i0[i3].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i4, KeyEvent keyEvent) {
boolean t7;
t7 = org.telegram.ui.w6.this.t7(textView3, i4, keyEvent);
return t7;
}
});
this.i0[i3].setCustomSelectionActionModeCallback(new w(this));
}
i77 i77Var3 = new i77(context);
this.R0 = i77Var3;
i77Var3.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.R0.setText(LocaleController.formatString("PassportRequestPasswordInfo", R.string.PassportRequestPasswordInfo, new Object[0]));
this.m0.addView(this.R0, g52.f(-1, -2));
TextView textView3 = new TextView(context);
this.W0 = textView3;
textView3.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
this.W0.setTextSize(1, 14.0f);
this.W0.setText(LocaleController.getString("ForgotPassword", R.string.ForgotPassword));
this.W0.setPadding(0, 0, 0, 0);
this.m0.addView(this.W0, g52.m(-2, 30, (LocaleController.isRTL ? 5 : 3) | 48, 21, 0, 21, 0));
this.W0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.r7(view);
}
});
s8();
}
public void X6(View view) {
this.c1 = 4;
c8();
}
private void Y5(Context context) {
String str;
String str2;
TelephonyManager telephonyManager;
FrameLayout frameLayout;
EditTextBoldCursor editTextBoldCursor;
int i2;
EditTextBoldCursor editTextBoldCursor2;
TextWatcher aVar;
FrameLayout frameLayout2;
this.g.setTitle(LocaleController.getString("PassportPhone", R.string.PassportPhone));
this.i1 = new HashMap<>();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("countries.txt")));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
String[] split = readLine.split(";");
this.e1.add(0, split[2]);
this.f1.put(split[2], split[0]);
this.g1.put(split[0], split[2]);
if (split.length > 3) {
this.h1.put(split[0], split[3]);
}
this.i1.put(split[1], split[2]);
}
bufferedReader.close();
} catch (Exception e2) {
FileLog.e(e2);
}
Collections.sort(this.e1, ur.a);
String str3 = UserConfig.getInstance(this.d).getCurrentUser().f;
o87 o87Var = new o87(context);
o87Var.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
o87Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.T1(true));
o87Var.c(LocaleController.formatString("PassportPhoneUseSame", R.string.PassportPhoneUseSame, uw3.d().c("+" + str3)), false);
int i3 = -1;
this.m0.addView(o87Var, g52.f(-1, -2));
o87Var.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.w7(view);
}
});
i77 i77Var = new i77(context);
this.x0 = i77Var;
i77Var.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.x0.setText(LocaleController.getString("PassportPhoneUseSameInfo", R.string.PassportPhoneUseSameInfo));
this.m0.addView(this.x0, g52.f(-1, -2));
rr1 rr1Var = new rr1(context);
this.t0 = rr1Var;
rr1Var.setText(LocaleController.getString("PassportPhoneUseOther", R.string.PassportPhoneUseOther));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
this.i0 = new EditTextBoldCursor[3];
int i4 = 0;
while (i4 < 3) {
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
if (i4 == 2) {
editTextBoldCursorArr[i4] = new cs1(context);
} else {
editTextBoldCursorArr[i4] = new EditTextBoldCursor(context);
}
if (i4 == 1) {
?? linearLayout = new LinearLayout(context);
linearLayout.setOrientation(0);
frameLayout2 = linearLayout;
} else if (i4 == 2) {
frameLayout = (ViewGroup) this.i0[1].getParent();
this.i0[i4].setTag(Integer.valueOf(i4));
this.i0[i4].setTextSize(1, 16.0f);
this.i0[i4].setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
this.i0[i4].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i4].setBackgroundDrawable(null);
this.i0[i4].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i4].setCursorSize(AndroidUtilities.dp(20.0f));
this.i0[i4].setCursorWidth(1.5f);
EditTextBoldCursor[] editTextBoldCursorArr2 = this.i0;
if (i4 != 0) {
editTextBoldCursorArr2[i4].setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
boolean z7;
z7 = org.telegram.ui.w6.this.z7(view, motionEvent);
return z7;
}
});
this.i0[i4].setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
this.i0[i4].setInputType(0);
this.i0[i4].setFocusable(false);
} else {
editTextBoldCursorArr2[i4].setInputType(3);
EditTextBoldCursor[] editTextBoldCursorArr3 = this.i0;
if (i4 == 2) {
editTextBoldCursor = editTextBoldCursorArr3[i4];
i2 = 268435462;
} else {
editTextBoldCursor = editTextBoldCursorArr3[i4];
i2 = 268435461;
}
editTextBoldCursor.setImeOptions(i2);
}
EditTextBoldCursor[] editTextBoldCursorArr4 = this.i0;
editTextBoldCursorArr4[i4].setSelection(editTextBoldCursorArr4[i4].length());
if (i4 != 1) {
TextView textView = new TextView(context);
this.G0 = textView;
textView.setText("+");
this.G0.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.G0.setTextSize(1, 16.0f);
frameLayout.addView(this.G0, g52.h(-2, -2, 21.0f, 12.0f, 0.0f, 6.0f));
this.i0[i4].setPadding(AndroidUtilities.dp(10.0f), 0, 0, 0);
this.i0[i4].setFilters(new InputFilter[]{new InputFilter.LengthFilter(5)});
this.i0[i4].setGravity(19);
frameLayout.addView(this.i0[i4], g52.h(55, -2, 0.0f, 12.0f, 16.0f, 6.0f));
editTextBoldCursor2 = this.i0[i4];
aVar = new y();
} else if (i4 == 2) {
this.i0[i4].setPadding(0, 0, 0, 0);
this.i0[i4].setGravity(19);
this.i0[i4].setHintText(null);
this.i0[i4].setHint(LocaleController.getString("PaymentShippingPhoneNumber", R.string.PaymentShippingPhoneNumber));
frameLayout.addView(this.i0[i4], g52.h(-1, -2, 0.0f, 12.0f, 21.0f, 6.0f));
editTextBoldCursor2 = this.i0[i4];
aVar = new a();
} else {
this.i0[i4].setPadding(0, 0, 0, AndroidUtilities.dp(6.0f));
this.i0[i4].setGravity(LocaleController.isRTL ? 5 : 3);
frameLayout.addView(this.i0[i4], g52.b(-1, -2.0f, 51, 21.0f, 12.0f, 21.0f, 6.0f));
this.i0[i4].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView2, int i5, KeyEvent keyEvent) {
boolean A7;
A7 = org.telegram.ui.w6.this.A7(textView2, i5, keyEvent);
return A7;
}
});
if (i4 == 2) {
this.i0[i4].setOnKeyListener(new View.OnKeyListener() {
@Override
public final boolean onKey(View view, int i5, KeyEvent keyEvent) {
boolean B7;
B7 = org.telegram.ui.w6.this.B7(view, i5, keyEvent);
return B7;
}
});
}
if (i4 == 0) {
View view = new View(context);
this.u0.add(view);
view.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("divider"));
frameLayout.addView(view, new FrameLayout.LayoutParams(-1, 1, 83));
}
i4++;
i3 = -1;
}
editTextBoldCursor2.addTextChangedListener(aVar);
this.i0[i4].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView2, int i5, KeyEvent keyEvent) {
boolean A7;
A7 = org.telegram.ui.w6.this.A7(textView2, i5, keyEvent);
return A7;
}
});
if (i4 == 2) {
}
if (i4 == 0) {
}
i4++;
i3 = -1;
} else {
frameLayout2 = new FrameLayout(context);
}
this.m0.addView(frameLayout2, g52.f(i3, 50));
frameLayout2.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
frameLayout = frameLayout2;
this.i0[i4].setTag(Integer.valueOf(i4));
this.i0[i4].setTextSize(1, 16.0f);
this.i0[i4].setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
this.i0[i4].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i4].setBackgroundDrawable(null);
this.i0[i4].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
this.i0[i4].setCursorSize(AndroidUtilities.dp(20.0f));
this.i0[i4].setCursorWidth(1.5f);
EditTextBoldCursor[] editTextBoldCursorArr22 = this.i0;
if (i4 != 0) {
}
EditTextBoldCursor[] editTextBoldCursorArr42 = this.i0;
editTextBoldCursorArr42[i4].setSelection(editTextBoldCursorArr42[i4].length());
if (i4 != 1) {
}
editTextBoldCursor2.addTextChangedListener(aVar);
this.i0[i4].setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView2, int i5, KeyEvent keyEvent) {
boolean A7;
A7 = org.telegram.ui.w6.this.A7(textView2, i5, keyEvent);
return A7;
}
});
if (i4 == 2) {
}
if (i4 == 0) {
}
i4++;
i3 = -1;
}
try {
telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
} catch (Exception e3) {
FileLog.e(e3);
}
if (telephonyManager != null) {
str = telephonyManager.getSimCountryIso().toUpperCase();
if (str != null && (str2 = this.i1.get(str)) != null && this.e1.indexOf(str2) != -1) {
this.i0[1].setText(this.f1.get(str2));
}
i77 i77Var2 = new i77(context);
this.x0 = i77Var2;
i77Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.x0.setText(LocaleController.getString("PassportPhoneUploadInfo", R.string.PassportPhoneUploadInfo));
this.m0.addView(this.x0, g52.f(-1, -2));
}
str = null;
if (str != null) {
this.i0[1].setText(this.f1.get(str2));
}
i77 i77Var22 = new i77(context);
this.x0 = i77Var22;
i77Var22.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.x0.setText(LocaleController.getString("PassportPhoneUploadInfo", R.string.PassportPhoneUploadInfo));
this.m0.addView(this.x0, g52.f(-1, -2));
}
public void Y6(View view) {
if (Build.VERSION.SDK_INT >= 23 && c0().checkSelfPermission("android.permission.CAMERA") != 0) {
c0().requestPermissions(new String[]{"android.permission.CAMERA"}, 22);
return;
}
org.telegram.ui.c0 c0Var = new org.telegram.ui.c0(0);
c0Var.j2(new e());
S0(c0Var);
}
public void Y7(View view) {
if (view == null) {
return;
}
Vibrator vibrator = (Vibrator) c0().getSystemService("vibrator");
if (vibrator != null) {
vibrator.vibrate(200L);
}
AndroidUtilities.shakeView(view, 2.0f, 0);
h8(view);
}
private void Z5(Context context) {
this.g.setTitle(LocaleController.getString("PassportPhone", R.string.PassportPhone));
FrameLayout frameLayout = new FrameLayout(context);
this.l0.addView(frameLayout, g52.s(-1, -2, 51));
for (int i2 = 0; i2 < 3; i2++) {
this.T1[i2] = new d0(context, i2 + 2);
this.T1[i2].setVisibility(8);
pz4 pz4Var = this.T1[i2];
float f2 = 18.0f;
float f3 = AndroidUtilities.isTablet() ? 26.0f : 18.0f;
if (AndroidUtilities.isTablet()) {
f2 = 26.0f;
}
frameLayout.addView(pz4Var, g52.b(-1, -1.0f, 51, f3, 30.0f, f2, 0.0f));
}
Bundle bundle = new Bundle();
bundle.putString("phone", this.C1.get("phone"));
j6(bundle, this.U, false);
}
public void Z6(View view, l3.d dVar) {
int intValue = ((Integer) view.getTag()).intValue();
EditTextBoldCursor editTextBoldCursor = this.i0[intValue];
if (intValue == 5) {
this.z = dVar.c;
} else {
this.A = dVar.c;
}
editTextBoldCursor.setText(dVar.a);
}
public void Z7(boolean z2) {
if (c0() == null) {
return;
}
Vibrator vibrator = (Vibrator) c0().getSystemService("vibrator");
if (vibrator != null) {
vibrator.vibrate(200L);
}
if (z2) {
this.i0[0].setText(BuildConfig.FLAVOR);
}
AndroidUtilities.shakeView(this.i0[0], 2.0f, 0);
}
private void a6(Context context) {
f27 f27Var;
i77 i77Var;
SpannableStringBuilder replaceTags;
xp6 xp6Var;
ed5 lq6Var;
ArrayList<xp6> arrayList;
boolean z2;
xp6 xp6Var2;
ArrayList<xp6> arrayList2;
int i2;
ArrayList<xp6> arrayList3;
xp6 xp6Var3;
ed5 lq6Var2;
ArrayList<xp6> arrayList4;
ArrayList<xp6> arrayList5;
int i3 = 0;
if (this.H != null) {
for (int i4 = 0; i4 < this.H.e.size(); i4++) {
f27 f27Var2 = this.H.e.get(i4);
if (f27Var2.a == this.s) {
f27Var = f27Var2;
break;
}
}
}
f27Var = null;
FrameLayout frameLayout = (FrameLayout) this.e;
this.g.setTitle(LocaleController.getString("TelegramPassport", R.string.TelegramPassport));
this.g.z().b(1, org.telegram.messenger.R.drawable.profile_info);
if (f27Var != null) {
FrameLayout frameLayout2 = new FrameLayout(context);
this.m0.addView(frameLayout2, g52.f(-1, 100));
org.telegram.messenger.p110.pf pfVar = new org.telegram.messenger.p110.pf(context);
pfVar.setRoundRadius(AndroidUtilities.dp(32.0f));
frameLayout2.addView(pfVar, g52.b(64, 64.0f, 17, 0.0f, 8.0f, 0.0f, 0.0f));
pfVar.a(f27Var, new org.telegram.messenger.p110.xe(f27Var));
i77 i77Var2 = new i77(context);
this.x0 = i77Var2;
i77Var2.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_top, "windowBackgroundGrayShadow"));
this.x0.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PassportRequest", R.string.PassportRequest, UserObject.getFirstName(f27Var))));
this.x0.getTextView().setGravity(1);
((FrameLayout.LayoutParams) this.x0.getTextView().getLayoutParams()).gravity = 1;
this.m0.addView(this.x0, g52.f(-1, -2));
}
rr1 rr1Var = new rr1(context);
this.t0 = rr1Var;
rr1Var.setText(LocaleController.getString("PassportRequestedInformation", R.string.PassportRequestedInformation));
this.t0.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite"));
this.m0.addView(this.t0, g52.f(-1, -2));
ld5 ld5Var = this.H;
if (ld5Var != null) {
int size = ld5Var.b.size();
ArrayList<xp6> arrayList6 = new ArrayList<>();
ArrayList<xp6> arrayList7 = new ArrayList<>();
int i5 = 0;
boolean z3 = false;
int i6 = 0;
int i7 = 0;
boolean z4 = false;
while (i5 < size) {
cd5 cd5Var = this.H.b.get(i5);
if (cd5Var instanceof xp6) {
xp6 xp6Var4 = (xp6) cd5Var;
if (z6(xp6Var4.e)) {
arrayList6.add(xp6Var4);
i6++;
arrayList5 = arrayList6;
} else {
if (x6(xp6Var4.e)) {
arrayList7.add(xp6Var4);
i7++;
} else {
ed5 ed5Var = xp6Var4.e;
if (ed5Var instanceof tq6) {
z3 = true;
} else if (ed5Var instanceof lq6) {
z4 = true;
}
}
arrayList5 = arrayList6;
}
} else {
if (cd5Var instanceof yp6) {
yp6 yp6Var = (yp6) cd5Var;
if (!yp6Var.a.isEmpty()) {
cd5 cd5Var2 = yp6Var.a.get(i3);
if (cd5Var2 instanceof xp6) {
xp6 xp6Var5 = (xp6) cd5Var2;
if (z6(xp6Var5.e)) {
int size2 = yp6Var.a.size();
int i8 = 0;
while (i8 < size2) {
cd5 cd5Var3 = yp6Var.a.get(i8);
int i9 = size2;
if (cd5Var3 instanceof xp6) {
arrayList6.add((xp6) cd5Var3);
}
i8++;
size2 = i9;
}
i6++;
} else if (x6(xp6Var5.e)) {
int size3 = yp6Var.a.size();
int i10 = 0;
while (i10 < size3) {
cd5 cd5Var4 = yp6Var.a.get(i10);
ArrayList<xp6> arrayList8 = arrayList6;
if (cd5Var4 instanceof xp6) {
arrayList7.add((xp6) cd5Var4);
}
i10++;
arrayList6 = arrayList8;
}
arrayList5 = arrayList6;
i7++;
}
}
}
}
arrayList5 = arrayList6;
}
i5++;
arrayList6 = arrayList5;
i3 = 0;
}
ArrayList<xp6> arrayList9 = arrayList6;
boolean z5 = !z3 || i6 > 1;
boolean z6 = !z4 || i7 > 1;
int i11 = 0;
while (i11 < size) {
cd5 cd5Var5 = this.H.b.get(i11);
if (cd5Var5 instanceof xp6) {
xp6 xp6Var6 = (xp6) cd5Var5;
ed5 ed5Var2 = xp6Var6.e;
if ((ed5Var2 instanceof uq6) || (ed5Var2 instanceof oq6)) {
xp6Var2 = xp6Var6;
arrayList = null;
} else if (ed5Var2 instanceof tq6) {
if (!z5) {
arrayList4 = arrayList9;
xp6Var2 = xp6Var6;
arrayList = arrayList4;
}
arrayList4 = null;
xp6Var2 = xp6Var6;
arrayList = arrayList4;
} else if (ed5Var2 instanceof lq6) {
if (!z6) {
arrayList4 = arrayList7;
xp6Var2 = xp6Var6;
arrayList = arrayList4;
}
arrayList4 = null;
xp6Var2 = xp6Var6;
arrayList = arrayList4;
} else {
if (z5 && z6(ed5Var2)) {
arrayList3 = new ArrayList<>();
arrayList3.add(xp6Var6);
xp6Var3 = new xp6();
lq6Var2 = new tq6();
} else {
if (z6 && x6(xp6Var6.e)) {
arrayList3 = new ArrayList<>();
arrayList3.add(xp6Var6);
xp6Var3 = new xp6();
lq6Var2 = new lq6();
}
arrayList2 = arrayList7;
i2 = size;
}
xp6Var3.e = lq6Var2;
xp6Var2 = xp6Var3;
arrayList = arrayList3;
z2 = true;
arrayList2 = arrayList7;
ArrayList<xp6> arrayList10 = arrayList;
boolean z7 = z2;
i2 = size;
H5(context, xp6Var2, arrayList10, z7, i11 == size + (-1));
}
z2 = false;
arrayList2 = arrayList7;
ArrayList<xp6> arrayList102 = arrayList;
boolean z72 = z2;
i2 = size;
H5(context, xp6Var2, arrayList102, z72, i11 == size + (-1));
} else {
if (cd5Var5 instanceof yp6) {
yp6 yp6Var2 = (yp6) cd5Var5;
if (!yp6Var2.a.isEmpty()) {
cd5 cd5Var6 = yp6Var2.a.get(0);
if (cd5Var6 instanceof xp6) {
xp6 xp6Var7 = (xp6) cd5Var6;
if ((z5 && z6(xp6Var7.e)) || (z6 && x6(xp6Var7.e))) {
ArrayList<xp6> arrayList11 = new ArrayList<>();
int size4 = yp6Var2.a.size();
int i12 = 0;
while (i12 < size4) {
cd5 cd5Var7 = yp6Var2.a.get(i12);
yp6 yp6Var3 = yp6Var2;
if (cd5Var7 instanceof xp6) {
arrayList11.add((xp6) cd5Var7);
}
i12++;
yp6Var2 = yp6Var3;
}
if (z6(xp6Var7.e)) {
xp6Var = new xp6();
lq6Var = new tq6();
} else {
xp6Var = new xp6();
lq6Var = new lq6();
}
xp6Var.e = lq6Var;
arrayList = arrayList11;
z2 = true;
xp6Var2 = xp6Var;
arrayList2 = arrayList7;
ArrayList<xp6> arrayList1022 = arrayList;
boolean z722 = z2;
i2 = size;
H5(context, xp6Var2, arrayList1022, z722, i11 == size + (-1));
}
}
}
}
arrayList2 = arrayList7;
i2 = size;
}
i11++;
size = i2;
arrayList7 = arrayList2;
}
}
if (f27Var != null) {
i77 i77Var3 = new i77(context);
this.x0 = i77Var3;
i77Var3.setBackgroundDrawable(org.telegram.ui.ActionBar.w.h2(context, org.telegram.messenger.R.drawable.greydivider_bottom, "windowBackgroundGrayShadow"));
this.x0.setLinkTextColorKey("windowBackgroundWhiteGrayText4");
if (TextUtils.isEmpty(this.H.f)) {
i77Var = this.x0;
replaceTags = AndroidUtilities.replaceTags(LocaleController.formatString("PassportNoPolicy", R.string.PassportNoPolicy, UserObject.getFirstName(f27Var), f27Var.d));
} else {
String formatString = LocaleController.formatString("PassportPolicy", R.string.PassportPolicy, UserObject.getFirstName(f27Var), f27Var.d);
replaceTags = new SpannableStringBuilder(formatString);
int indexOf = formatString.indexOf(42);
int lastIndexOf = formatString.lastIndexOf(42);
if (indexOf != -1 && lastIndexOf != -1) {
this.x0.getTextView().setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
replaceTags.replace(lastIndexOf, lastIndexOf + 1, (CharSequence) BuildConfig.FLAVOR);
replaceTags.replace(indexOf, indexOf + 1, (CharSequence) BuildConfig.FLAVOR);
replaceTags.setSpan(new b0(), indexOf, lastIndexOf - 1, 33);
}
i77Var = this.x0;
}
i77Var.setText(replaceTags);
this.x0.getTextView().setHighlightColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText4"));
this.x0.getTextView().setGravity(1);
this.m0.addView(this.x0, g52.f(-1, -2));
}
FrameLayout frameLayout3 = new FrameLayout(context);
this.a0 = frameLayout3;
frameLayout3.setBackgroundDrawable(org.telegram.ui.ActionBar.w.V0(org.telegram.ui.ActionBar.w.r1("passport_authorizeBackground"), org.telegram.ui.ActionBar.w.r1("passport_authorizeBackgroundSelected")));
frameLayout.addView(this.a0, g52.c(-1, 48, 80));
this.a0.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
org.telegram.ui.w6.this.E7(view);
}
});
TextView textView = new TextView(context);
this.Y = textView;
textView.setCompoundDrawablePadding(AndroidUtilities.dp(8.0f));
this.Y.setCompoundDrawablesWithIntrinsicBounds(org.telegram.messenger.R.drawable.authorize, 0, 0, 0);
this.Y.setTextColor(org.telegram.ui.ActionBar.w.r1("passport_authorizeText"));
this.Y.setText(LocaleController.getString("PassportAuthorize", R.string.PassportAuthorize));
this.Y.setTextSize(1, 14.0f);
this.Y.setGravity(17);
this.Y.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.a0.addView(this.Y, g52.c(-2, -1, 17));
rp0 rp0Var = new rp0(context, 0);
this.Z = rp0Var;
rp0Var.setVisibility(4);
this.a0.addView(this.Z, g52.a(-1, -1.0f));
View view = new View(context);
view.setBackgroundResource(org.telegram.messenger.R.drawable.header_shadow_reverse);
frameLayout.addView(view, g52.b(-1, 3.0f, 83, 0.0f, 0.0f, 0.0f, 48.0f));
}
public boolean a7(final View view, MotionEvent motionEvent) {
if (c0() == null) {
return false;
}
if (motionEvent.getAction() == 1) {
l3 l3Var = new l3(false);
l3Var.C1(new l3.g() {
@Override
public final void a(l3.d dVar) {
org.telegram.ui.w6.this.Z6(view, dVar);
}
});
S0(l3Var);
}
return true;
}
public void a8(final boolean z2) {
final String obj;
if (z2) {
obj = null;
} else {
obj = this.i0[0].getText().toString();
if (TextUtils.isEmpty(obj)) {
Z7(false);
return;
}
o8(true, true);
}
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.L7(z2, obj);
}
});
}
public z b6(String str) {
RandomAccessFile randomAccessFile;
byte[] bArr = new byte[(int) new File(str).length()];
RandomAccessFile randomAccessFile2 = null;
try {
randomAccessFile = new RandomAccessFile(str, "rws");
} catch (Exception unused) {
}
try {
randomAccessFile.readFully(bArr);
} catch (Exception unused2) {
randomAccessFile2 = randomAccessFile;
randomAccessFile = randomAccessFile2;
z h6 = h6(bArr);
randomAccessFile.seek(0L);
randomAccessFile.write(h6.c);
randomAccessFile.close();
return h6;
}
z h62 = h6(bArr);
randomAccessFile.seek(0L);
randomAccessFile.write(h62.c);
randomAccessFile.close();
return h62;
}
public void b7(int i2, EditTextBoldCursor editTextBoldCursor, int i3, int i4, int i5) {
if (i2 == 8) {
int[] iArr = this.G;
iArr[0] = i3;
iArr[1] = i4 + 1;
iArr[2] = i5;
}
editTextBoldCursor.setText(String.format(Locale.US, "%02d.%02d.%d", Integer.valueOf(i5), Integer.valueOf(i4 + 1), Integer.valueOf(i3)));
}
private void b8() {
Class<? extends ed5> cls;
Class<? extends ed5> cls2;
ArrayList arrayList = new ArrayList();
final ArrayList arrayList2 = new ArrayList();
if (v6(uq6.class)) {
cls = vq6.class;
cls2 = mq6.class;
arrayList.add(LocaleController.getString("ActionBotDocumentPhone", R.string.ActionBotDocumentPhone));
arrayList2.add(uq6.class);
} else {
cls = vq6.class;
cls2 = mq6.class;
}
if (v6(oq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentEmail", R.string.ActionBotDocumentEmail));
arrayList2.add(oq6.class);
}
if (v6(tq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentIdentity", R.string.ActionBotDocumentIdentity));
arrayList2.add(tq6.class);
}
if (v6(rq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentPassport", R.string.ActionBotDocumentPassport));
arrayList2.add(rq6.class);
}
if (v6(qq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentInternalPassport", R.string.ActionBotDocumentInternalPassport));
arrayList2.add(qq6.class);
}
if (v6(sq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentPassportRegistration", R.string.ActionBotDocumentPassportRegistration));
arrayList2.add(sq6.class);
}
if (v6(wq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentTemporaryRegistration", R.string.ActionBotDocumentTemporaryRegistration));
arrayList2.add(wq6.class);
}
if (v6(pq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentIdentityCard", R.string.ActionBotDocumentIdentityCard));
arrayList2.add(pq6.class);
}
if (v6(nq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentDriverLicence", R.string.ActionBotDocumentDriverLicence));
arrayList2.add(nq6.class);
}
if (v6(lq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentAddress", R.string.ActionBotDocumentAddress));
arrayList2.add(lq6.class);
}
if (v6(xq6.class)) {
arrayList.add(LocaleController.getString("ActionBotDocumentUtilityBill", R.string.ActionBotDocumentUtilityBill));
arrayList2.add(xq6.class);
}
Class<? extends ed5> cls3 = cls2;
if (v6(cls3)) {
arrayList.add(LocaleController.getString("ActionBotDocumentBankStatement", R.string.ActionBotDocumentBankStatement));
arrayList2.add(cls3);
}
Class<? extends ed5> cls4 = cls;
if (v6(cls4)) {
arrayList.add(LocaleController.getString("ActionBotDocumentRentalAgreement", R.string.ActionBotDocumentRentalAgreement));
arrayList2.add(cls4);
}
if (c0() == null || arrayList.isEmpty()) {
return;
}
i.C0142i c0142i = new i.C0142i(c0());
c0142i.u(LocaleController.getString("PassportNoDocumentsAdd", R.string.PassportNoDocumentsAdd));
c0142i.j((CharSequence[]) arrayList.toArray(new CharSequence[0]), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
org.telegram.ui.w6.this.P7(arrayList2, dialogInterface, i2);
}
});
o1(c0142i.a());
}
private String c6(byte[] bArr, byte[] bArr2, byte[] bArr3) {
if (bArr == null || bArr2 == null || bArr2.length != 32 || bArr3 == null || bArr3.length != 32) {
return null;
}
byte[] computeSHA512 = Utilities.computeSHA512(bArr2, bArr3);
byte[] bArr4 = new byte[32];
System.arraycopy(computeSHA512, 0, bArr4, 0, 32);
byte[] bArr5 = new byte[16];
System.arraycopy(computeSHA512, 32, bArr5, 0, 16);
int length = bArr.length;
byte[] bArr6 = new byte[length];
System.arraycopy(bArr, 0, bArr6, 0, bArr.length);
Utilities.aesCbcEncryptionByteArraySafe(bArr6, bArr4, bArr5, 0, length, 0, 0);
if (!Arrays.equals(Utilities.computeSHA256(bArr6), bArr3)) {
return null;
}
int i2 = bArr6[0] & 255;
return new String(bArr6, i2, length - i2);
}
public void c7(EditTextBoldCursor editTextBoldCursor, DialogInterface dialogInterface, int i2) {
int[] iArr = this.G;
iArr[2] = 0;
iArr[1] = 0;
iArr[0] = 0;
editTextBoldCursor.setText(LocaleController.getString("PassportNoExpireDate", R.string.PassportNoExpireDate));
}
private void c8() {
if (c0() == null) {
return;
}
if (this.c1 == 0 && this.s1.size() >= 20) {
m8(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("PassportUploadMaxReached", R.string.PassportUploadMaxReached, LocaleController.formatPluralString("Files", 20)));
return;
}
R5();
this.b1.H2(this.c1 == 1);
this.b1.G2(n6(), false);
this.b1.W1().P1();
int i2 = Build.VERSION.SDK_INT;
if (i2 == 21 || i2 == 22) {
AndroidUtilities.hideKeyboard(this.e.findFocus());
}
this.b1.X1();
o1(this.b1);
}
public byte[] d6(byte[] bArr, byte[] bArr2) {
if (bArr == null || bArr.length != 32) {
return null;
}
byte[] bArr3 = new byte[32];
System.arraycopy(bArr2, 0, bArr3, 0, 32);
byte[] bArr4 = new byte[16];
System.arraycopy(bArr2, 32, bArr4, 0, 16);
byte[] bArr5 = new byte[32];
System.arraycopy(bArr, 0, bArr5, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr5, bArr3, bArr4, 0, 32, 0, 0);
return bArr5;
}
public boolean d7(Context context, View view, MotionEvent motionEvent) {
String string;
int i2;
int i3;
int i4;
int i5;
int i6;
int i7;
if (c0() == null) {
return false;
}
if (motionEvent.getAction() == 1) {
Calendar calendar = Calendar.getInstance();
calendar.get(1);
calendar.get(2);
calendar.get(5);
try {
final EditTextBoldCursor editTextBoldCursor = (EditTextBoldCursor) view;
final int intValue = ((Integer) editTextBoldCursor.getTag()).intValue();
if (intValue == 8) {
string = LocaleController.getString("PassportSelectExpiredDate", R.string.PassportSelectExpiredDate);
i2 = 0;
i3 = 20;
i4 = 0;
} else {
string = LocaleController.getString("PassportSelectBithdayDate", R.string.PassportSelectBithdayDate);
i2 = -120;
i3 = 0;
i4 = -18;
}
String[] split = editTextBoldCursor.getText().toString().split("\\.");
if (split.length == 3) {
int intValue2 = Utilities.parseInt(split[0]).intValue();
int intValue3 = Utilities.parseInt(split[1]).intValue();
i7 = Utilities.parseInt(split[2]).intValue();
i5 = intValue2;
i6 = intValue3;
} else {
i5 = -1;
i6 = -1;
i7 = -1;
}
i.C0142i x1 = org.telegram.ui.Components.b.x1(context, i2, i3, i4, i5, i6, i7, string, intValue == 8, new b.y() {
@Override
public final void a(int i8, int i9, int i10) {
org.telegram.ui.w6.this.b7(intValue, editTextBoldCursor, i8, i9, i10);
}
});
if (intValue == 8) {
x1.n(LocaleController.getString("PassportSelectNotExpire", R.string.PassportSelectNotExpire), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i8) {
org.telegram.ui.w6.this.c7(editTextBoldCursor, dialogInterface, i8);
}
});
}
o1(x1.a());
} catch (Exception e2) {
FileLog.e(e2);
}
}
return true;
}
private void d8(xp6 xp6Var, xp6 xp6Var2, ArrayList<xp6> arrayList, boolean z2) {
te5 te5Var;
HashMap<String, String> hashMap;
int size = arrayList != null ? arrayList.size() : 0;
ed5 ed5Var = xp6Var.e;
ed5 ed5Var2 = xp6Var2 != null ? xp6Var2.e : null;
int i2 = ed5Var instanceof tq6 ? 1 : ed5Var instanceof lq6 ? 2 : ed5Var instanceof uq6 ? 3 : ed5Var instanceof oq6 ? 4 : -1;
if (i2 != -1) {
HashMap<String, String> hashMap2 = !z2 ? this.E1.get(o6(ed5Var)) : null;
HashMap<String, String> hashMap3 = this.E1.get(o6(ed5Var2));
aq6 t6 = t6(xp6Var, false);
aq6 t62 = t6(xp6Var2, false);
ld5 ld5Var = this.H;
te5 te5Var2 = this.T;
HashMap<String, String> hashMap4 = this.z1.get(xp6Var);
if (xp6Var2 != null) {
te5Var = te5Var2;
hashMap = this.z1.get(xp6Var2);
} else {
te5Var = te5Var2;
hashMap = null;
}
int i3 = i2;
w6 w6Var = new w6(i2, ld5Var, te5Var, xp6Var, t6, xp6Var2, t62, hashMap4, hashMap);
w6Var.L1 = new m(ed5Var, z2, size);
w6Var.d = this.d;
w6Var.o1 = this.o1;
w6Var.m1 = this.m1;
w6Var.s = this.s;
w6Var.G1 = hashMap2;
w6Var.F0 = z2;
w6Var.H1 = hashMap3;
w6Var.Q = arrayList;
if (i3 == 4) {
w6Var.n1 = this.n1;
}
S0(w6Var);
}
}
private byte[] e6(byte[] bArr, byte[] bArr2) {
if (bArr == null || bArr.length != 32 || bArr2 == null || bArr2.length != 32) {
return null;
}
byte[] bArr3 = new byte[32];
System.arraycopy(this.o1, 0, bArr3, 0, 32);
byte[] bArr4 = new byte[16];
System.arraycopy(this.o1, 32, bArr4, 0, 16);
byte[] bArr5 = new byte[32];
System.arraycopy(this.m1, 0, bArr5, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr5, bArr3, bArr4, 0, 32, 0, 0);
if (!O5(bArr5, null)) {
return null;
}
byte[] computeSHA512 = Utilities.computeSHA512(bArr5, bArr2);
byte[] bArr6 = new byte[32];
System.arraycopy(computeSHA512, 0, bArr6, 0, 32);
byte[] bArr7 = new byte[16];
System.arraycopy(computeSHA512, 32, bArr7, 0, 16);
byte[] bArr8 = new byte[32];
System.arraycopy(bArr, 0, bArr8, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr8, bArr6, bArr7, 0, 32, 0, 0);
return bArr8;
}
public void e7(DialogInterface dialogInterface, int i2) {
EditTextBoldCursor editTextBoldCursor;
int i3;
String str;
if (i2 == 0) {
this.B = "male";
editTextBoldCursor = this.i0[4];
i3 = R.string.PassportMale;
str = "PassportMale";
} else {
if (i2 != 1) {
return;
}
this.B = "female";
editTextBoldCursor = this.i0[4];
i3 = R.string.PassportFemale;
str = "PassportFemale";
}
editTextBoldCursor.setText(LocaleController.getString(str, i3));
}
public void e8(int i2) {
if (i2 == 0) {
int i3 = Build.VERSION.SDK_INT;
if (i3 >= 23 && c0().checkSelfPermission("android.permission.CAMERA") != 0) {
c0().requestPermissions(new String[]{"android.permission.CAMERA"}, 19);
return;
}
try {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File generatePicturePath = AndroidUtilities.generatePicturePath();
if (generatePicturePath != null) {
if (i3 >= 24) {
intent.putExtra("output", FileProvider.e(c0(), "co.cheetah.gram.provider", generatePicturePath));
intent.addFlags(2);
intent.addFlags(1);
} else {
intent.putExtra("output", Uri.fromFile(generatePicturePath));
}
this.a1 = generatePicturePath.getAbsolutePath();
}
r1(intent, 0);
} catch (Exception e2) {
FileLog.e(e2);
}
}
}
public void f6(final xp6 xp6Var, final xp6 xp6Var2, final ArrayList<xp6> arrayList, final boolean z2, final Runnable runnable, final a0 a0Var, final boolean z3) {
if (xp6Var == null) {
return;
}
xd5 xd5Var = new xd5();
if (!z3 || xp6Var2 == null) {
if (z2) {
xd5Var.a.add(xp6Var.e);
}
}
xd5Var.a.add(xp6Var2.e);
ConnectionsManager.getInstance(this.d).sendRequest(xd5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.this.G7(a0Var, z3, xp6Var2, xp6Var, z2, arrayList, runnable, i95Var, ov5Var);
}
});
}
public boolean f7(View view, MotionEvent motionEvent) {
if (c0() == null) {
return false;
}
if (motionEvent.getAction() == 1) {
i.C0142i c0142i = new i.C0142i(c0());
c0142i.u(LocaleController.getString("PassportSelectGender", R.string.PassportSelectGender));
c0142i.j(new CharSequence[]{LocaleController.getString("PassportMale", R.string.PassportMale), LocaleController.getString("PassportFemale", R.string.PassportFemale)}, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
org.telegram.ui.w6.this.e7(dialogInterface, i2);
}
});
c0142i.s(LocaleController.getString("Cancel", R.string.Cancel), null);
o1(c0142i.a());
}
return true;
}
public void f8(final ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList) {
if (arrayList.isEmpty()) {
return;
}
int i2 = this.c1;
boolean z2 = true;
final boolean z3 = false;
if (i2 != 1 && i2 != 4 && (this.I.e instanceof tq6)) {
int i3 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
if (i3 < editTextBoldCursorArr.length) {
if (i3 != 5 && i3 != 8 && i3 != 4 && i3 != 6 && editTextBoldCursorArr[i3].length() > 0) {
z2 = false;
break;
}
i3++;
} else {
break;
}
}
z3 = z2;
}
final int i4 = this.c1;
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.S7(arrayList, i4, z3);
}
});
}
public boolean g7(TextView textView, int i2, KeyEvent keyEvent) {
if (i2 != 5) {
return false;
}
int intValue = ((Integer) textView.getTag()).intValue() + 1;
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
if (intValue < editTextBoldCursorArr.length) {
if (editTextBoldCursorArr[intValue].isFocusable()) {
this.i0[intValue].requestFocus();
} else {
this.i0[intValue].dispatchTouchEvent(MotionEvent.obtain(0L, 0L, 1, 0.0f, 0.0f, 0));
textView.clearFocus();
AndroidUtilities.hideKeyboard(textView);
}
}
return true;
}
public aq6 g8(xp6 xp6Var) {
if (xp6Var == null) {
return null;
}
int size = this.H.c.size();
for (int i2 = 0; i2 < size; i2++) {
if (xp6Var.e.getClass() == this.H.c.get(i2).b.getClass()) {
return this.H.c.remove(i2);
}
}
return null;
}
public z h6(byte[] bArr) {
byte[] p6 = p6();
int nextInt = Utilities.random.nextInt(208) + 32;
while ((bArr.length + nextInt) % 16 != 0) {
nextInt++;
}
byte[] bArr2 = new byte[nextInt];
Utilities.random.nextBytes(bArr2);
bArr2[0] = (byte) nextInt;
int length = nextInt + bArr.length;
byte[] bArr3 = new byte[length];
System.arraycopy(bArr2, 0, bArr3, 0, nextInt);
System.arraycopy(bArr, 0, bArr3, nextInt, bArr.length);
byte[] computeSHA256 = Utilities.computeSHA256(bArr3);
byte[] computeSHA512 = Utilities.computeSHA512(p6, computeSHA256);
byte[] bArr4 = new byte[32];
System.arraycopy(computeSHA512, 0, bArr4, 0, 32);
byte[] bArr5 = new byte[16];
System.arraycopy(computeSHA512, 32, bArr5, 0, 16);
Utilities.aesCbcEncryptionByteArraySafe(bArr3, bArr4, bArr5, 0, length, 0, 1);
byte[] bArr6 = new byte[32];
System.arraycopy(this.o1, 0, bArr6, 0, 32);
byte[] bArr7 = new byte[16];
System.arraycopy(this.o1, 32, bArr7, 0, 16);
byte[] bArr8 = new byte[32];
System.arraycopy(this.m1, 0, bArr8, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr8, bArr6, bArr7, 0, 32, 0, 0);
byte[] computeSHA5122 = Utilities.computeSHA512(bArr8, computeSHA256);
byte[] bArr9 = new byte[32];
System.arraycopy(computeSHA5122, 0, bArr9, 0, 32);
byte[] bArr10 = new byte[16];
System.arraycopy(computeSHA5122, 32, bArr10, 0, 16);
byte[] bArr11 = new byte[32];
System.arraycopy(p6, 0, bArr11, 0, 32);
Utilities.aesCbcEncryptionByteArraySafe(bArr11, bArr9, bArr10, 0, 32, 0, 1);
return new z(bArr3, bArr11, p6, computeSHA256, bArr4, bArr5);
}
public boolean h7(TextView textView, int i2, KeyEvent keyEvent) {
if (i2 != 5) {
return false;
}
int intValue = ((Integer) textView.getTag()).intValue() + 1;
EditTextBoldCursor[] editTextBoldCursorArr = this.k0;
if (intValue < editTextBoldCursorArr.length) {
if (editTextBoldCursorArr[intValue].isFocusable()) {
this.k0[intValue].requestFocus();
} else {
this.k0[intValue].dispatchTouchEvent(MotionEvent.obtain(0L, 0L, 1, 0.0f, 0.0f, 0));
textView.clearFocus();
AndroidUtilities.hideKeyboard(textView);
}
}
return true;
}
private void h8(View view) {
while (view != null && this.m0.indexOfChild(view) < 0) {
view = (View) view.getParent();
}
if (view != null) {
this.l0.smoothScrollTo(0, view.getTop() - ((this.l0.getMeasuredHeight() - view.getMeasuredHeight()) / 2));
}
}
private void i6() {
if (this.q != null) {
return;
}
this.q = k6();
}
public void i7(View view) {
S5();
}
private void i8(HashMap<String, String> hashMap, EditTextBoldCursor editTextBoldCursor, String str) {
HashMap<String, String> hashMap2;
CharSequence charSequence;
int i2;
String str2;
boolean z2;
String str3 = hashMap.get(str);
if (str3 != null) {
str.hashCode();
char c2 = 65535;
switch (str.hashCode()) {
case -2006252145:
if (str.equals("residence_country_code")) {
c2 = 0;
break;
}
break;
case -1249512767:
if (str.equals("gender")) {
c2 = 1;
break;
}
break;
case 475919162:
if (str.equals("expiry_date")) {
c2 = 2;
break;
}
break;
case 1481071862:
if (str.equals("country_code")) {
c2 = 3;
break;
}
break;
}
switch (c2) {
case 0:
this.A = str3;
str3 = this.i1.get(str3);
break;
case 1:
if ("male".equals(str3)) {
this.B = str3;
i2 = R.string.PassportMale;
str2 = "PassportMale";
} else if ("female".equals(str3)) {
this.B = str3;
i2 = R.string.PassportFemale;
str2 = "PassportFemale";
}
str3 = LocaleController.getString(str2, i2);
editTextBoldCursor.setText(str3);
break;
case 2:
if (!TextUtils.isEmpty(str3)) {
String[] split = str3.split("\\.");
if (split.length == 3) {
this.G[0] = Utilities.parseInt(split[2]).intValue();
this.G[1] = Utilities.parseInt(split[1]).intValue();
this.G[2] = Utilities.parseInt(split[0]).intValue();
editTextBoldCursor.setText(str3);
z2 = true;
if (!z2) {
int[] iArr = this.G;
iArr[2] = 0;
iArr[1] = 0;
iArr[0] = 0;
i2 = R.string.PassportNoExpireDate;
str2 = "PassportNoExpireDate";
str3 = LocaleController.getString(str2, i2);
editTextBoldCursor.setText(str3);
break;
}
}
}
z2 = false;
if (!z2) {
}
break;
case 3:
this.z = str3;
str3 = this.i1.get(str3);
break;
default:
editTextBoldCursor.setText(str3);
break;
}
}
HashMap<String, String> hashMap3 = this.G1;
if ((hashMap3 == null || (charSequence = (String) hashMap3.get(str)) == null) && ((hashMap2 = this.H1) == null || (charSequence = (String) hashMap2.get(str)) == null)) {
return;
}
editTextBoldCursor.setErrorText(charSequence);
this.I1.put(str, editTextBoldCursor.getText().toString());
}
public void j6(Bundle bundle, lh5 lh5Var, boolean z2) {
int i2;
bundle.putString("phoneHash", lh5Var.c);
u27 u27Var = lh5Var.d;
if (u27Var instanceof zg5) {
bundle.putInt("nextType", 4);
} else if (u27Var instanceof ah5) {
bundle.putInt("nextType", 3);
} else if (u27Var instanceof ch5) {
bundle.putInt("nextType", 2);
}
if (lh5Var.e == 0) {
lh5Var.e = 60;
}
bundle.putInt("timeout", lh5Var.e * 1000);
v27 v27Var = lh5Var.b;
if (v27Var instanceof nh5) {
bundle.putInt("type", 4);
bundle.putInt("length", lh5Var.b.a);
k8(2, z2, bundle);
return;
}
if (v27Var instanceof oh5) {
bundle.putInt("type", 3);
bundle.putString("pattern", lh5Var.b.b);
i2 = 1;
} else {
if (!(v27Var instanceof qh5)) {
return;
}
bundle.putInt("type", 2);
bundle.putInt("length", lh5Var.b.a);
i2 = 0;
}
k8(i2, z2, bundle);
}
public void j7(View view) {
b8();
}
private String k6() {
StringBuilder sb = new StringBuilder();
int i2 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
if (i2 >= editTextBoldCursorArr.length) {
break;
}
sb.append((CharSequence) editTextBoldCursorArr[i2].getText());
sb.append(",");
i2++;
}
if (this.k0 != null) {
int i3 = 0;
while (true) {
EditTextBoldCursor[] editTextBoldCursorArr2 = this.k0;
if (i3 >= editTextBoldCursorArr2.length) {
break;
}
sb.append((CharSequence) editTextBoldCursorArr2[i3].getText());
sb.append(",");
i3++;
}
}
int size = this.s1.size();
for (int i4 = 0; i4 < size; i4++) {
sb.append(this.s1.get(i4).secureFile.a);
}
SecureDocument secureDocument = this.v1;
if (secureDocument != null) {
sb.append(secureDocument.secureFile.a);
}
SecureDocument secureDocument2 = this.w1;
if (secureDocument2 != null) {
sb.append(secureDocument2.secureFile.a);
}
SecureDocument secureDocument3 = this.t1;
if (secureDocument3 != null) {
sb.append(secureDocument3.secureFile.a);
}
int size2 = this.u1.size();
for (int i5 = 0; i5 < size2; i5++) {
sb.append(this.u1.get(i5).secureFile.a);
}
return sb.toString();
}
public void k7() {
int i2 = 0;
while (i2 < this.m0.getChildCount()) {
View childAt = this.m0.getChildAt(i2);
if (childAt instanceof g0) {
this.m0.removeView(childAt);
i2--;
}
i2++;
}
W7();
this.A1.clear();
this.z1.clear();
this.H.c.clear();
r8();
}
public String l6(SecureDocument secureDocument) {
byte[] bArr;
if (secureDocument == null) {
return BuildConfig.FLAVOR;
}
qp6 qp6Var = secureDocument.secureFile;
if (qp6Var != null && (bArr = qp6Var.f) != null) {
return Base64.encodeToString(bArr, 2);
}
byte[] bArr2 = secureDocument.fileHash;
return bArr2 != null ? Base64.encodeToString(bArr2, 2) : BuildConfig.FLAVOR;
}
public void l7(i95 i95Var, ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.k7();
}
});
}
public void l8(xp6 xp6Var, String str, String str2, xp6 xp6Var2, String str3, boolean z2, int i2) {
boolean z3;
aq6 aq6Var;
StringBuilder sb;
StringBuilder sb2;
aq6 aq6Var2;
g0 g0Var;
String str4;
Object obj;
String[] strArr;
String[] strArr2;
int i3;
JSONObject jSONObject;
String[] strArr3;
String str5;
String str6;
HashMap<String, String> hashMap;
Object obj2;
String[] strArr4;
HashMap<String, String> hashMap2;
JSONObject jSONObject2;
int i4;
String str7;
String str8;
HashMap<String, String> hashMap3;
JSONObject jSONObject3;
Object obj3;
StringBuilder sb3;
char c2;
String str9;
String str10;
int i5;
String sb4;
String string;
xp6 xp6Var3;
HashMap<String, String> hashMap4;
String str11;
int i6;
String str12;
int i7;
String str13;
g0 g0Var2;
boolean z4;
BufferedReader bufferedReader;
String str14 = str2;
String str15 = str3;
g0 g0Var3 = this.A1.get(xp6Var);
if (g0Var3 != null) {
z3 = true;
} else {
if (this.r != 8) {
return;
}
ArrayList<xp6> arrayList = new ArrayList<>();
if (xp6Var2 != null) {
arrayList.add(xp6Var2);
}
LinearLayout linearLayout = this.m0;
View childAt = linearLayout.getChildAt(linearLayout.getChildCount() - 6);
if (childAt instanceof g0) {
((g0) childAt).setNeedDivider(true);
}
z3 = true;
g0Var3 = H5(c0(), xp6Var, arrayList, true, true);
r8();
}
g0 g0Var4 = g0Var3;
HashMap<String, String> hashMap5 = this.z1.get(xp6Var);
HashMap<String, String> hashMap6 = xp6Var2 != null ? this.z1.get(xp6Var2) : null;
aq6 t6 = t6(xp6Var, z3);
aq6 t62 = t6(xp6Var2, z3);
if (str14 == null || this.i1 != null) {
aq6Var = t6;
sb = null;
this.i1 = null;
} else {
this.i1 = new HashMap<>();
try {
bufferedReader = new BufferedReader(new InputStreamReader(ApplicationLoader.applicationContext.getResources().getAssets().open("countries.txt")));
} catch (Exception e2) {
e = e2;
aq6Var = t6;
}
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
String[] split = readLine.split(";");
aq6Var = t6;
try {
this.i1.put(split[1], split[2]);
t6 = aq6Var;
} catch (Exception e3) {
e = e3;
}
e = e3;
FileLog.e(e);
sb = null;
}
aq6Var = t6;
bufferedReader.close();
sb = null;
}
if (str != null) {
ed5 ed5Var = xp6Var.e;
if (ed5Var instanceof uq6) {
sb4 = uw3.d().c("+" + str);
g0Var = g0Var4;
aq6Var2 = t62;
} else {
g0Var = g0Var4;
aq6Var2 = t62;
if (ed5Var instanceof oq6) {
sb4 = str;
} else {
str4 = "PassportDocuments";
sb4 = null;
}
}
str4 = "PassportDocuments";
} else {
if (this.r == 8 || xp6Var2 == null || (TextUtils.isEmpty(str3) && t62 == null)) {
sb2 = sb;
} else {
sb2 = new StringBuilder();
if (i2 > 1) {
string = r6(xp6Var2.e);
} else if (TextUtils.isEmpty(str3)) {
string = LocaleController.getString("PassportDocuments", R.string.PassportDocuments);
}
sb2.append(string);
}
if (str14 == null && str15 == null) {
g0Var = g0Var4;
aq6Var2 = t62;
str4 = "PassportDocuments";
} else {
if (hashMap5 == null) {
return;
}
hashMap5.clear();
ed5 ed5Var2 = xp6Var.e;
aq6Var2 = t62;
g0Var = g0Var4;
String str16 = "last_name";
str4 = "PassportDocuments";
HashMap<String, String> hashMap7 = hashMap5;
String str17 = "middle_name_native";
if (ed5Var2 instanceof tq6) {
int i8 = this.r;
if ((i8 != 0 || z2) && !(i8 == 8 && xp6Var2 == null)) {
obj = "gender";
i5 = 8;
strArr = null;
} else {
obj = "gender";
i5 = 8;
strArr = new String[]{"first_name", "middle_name", "last_name", "first_name_native", "middle_name_native", "last_name_native", "birth_date", "gender", "country_code", "residence_country_code"};
}
strArr2 = (i8 == 0 || (i8 == i5 && xp6Var2 != null)) ? new String[]{"document_no", "expiry_date"} : null;
} else {
obj = "gender";
strArr = (!(ed5Var2 instanceof lq6) || (((i3 = this.r) != 0 || z2) && !(i3 == 8 && xp6Var2 == null))) ? null : new String[]{"street_line1", "street_line2", "post_code", "city", "state", "country_code"};
strArr2 = null;
}
if (strArr != null || strArr2 != null) {
StringBuilder sb5 = sb2;
String[] strArr5 = strArr;
JSONObject jSONObject4 = null;
int i9 = 0;
int i10 = 2;
String[] strArr6 = null;
while (i9 < i10) {
if (i9 == 0) {
if (str14 != null) {
try {
jSONObject = new JSONObject(str14);
strArr3 = strArr5;
if (strArr3 != null || jSONObject == null) {
str5 = str16;
str6 = str17;
hashMap = hashMap6;
strArr4 = strArr2;
hashMap2 = hashMap7;
obj2 = obj;
jSONObject2 = jSONObject;
i10 = 2;
} else {
try {
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
Iterator<String> it = keys;
String next = keys.next();
if (i9 == 0) {
strArr4 = strArr2;
hashMap2 = hashMap7;
try {
hashMap2.put(next, jSONObject.getString(next));
} catch (Throwable th) {
th = th;
FileLog.e(th);
i4 = 0;
while (i4 < strArr3.length) {
}
str5 = str16;
str6 = str17;
hashMap = hashMap6;
jSONObject2 = jSONObject;
i10 = 2;
obj2 = obj;
jSONObject4 = jSONObject2;
i9++;
str15 = str3;
obj = obj2;
hashMap7 = hashMap2;
strArr2 = strArr4;
hashMap6 = hashMap;
str16 = str5;
str17 = str6;
strArr6 = strArr3;
str14 = str2;
}
} else {
strArr4 = strArr2;
hashMap2 = hashMap7;
hashMap6.put(next, jSONObject.getString(next));
}
hashMap7 = hashMap2;
strArr2 = strArr4;
keys = it;
}
strArr4 = strArr2;
hashMap2 = hashMap7;
} catch (Throwable th2) {
th = th2;
strArr4 = strArr2;
hashMap2 = hashMap7;
}
i4 = 0;
while (i4 < strArr3.length) {
if (jSONObject.has(strArr3[i4])) {
if (sb5 == null) {
sb3 = new StringBuilder();
hashMap3 = hashMap6;
} else {
hashMap3 = hashMap6;
sb3 = sb5;
}
try {
String string2 = jSONObject.getString(strArr3[i4]);
if (string2 == null || TextUtils.isEmpty(string2)) {
str7 = str16;
str8 = str17;
jSONObject3 = jSONObject;
} else {
jSONObject3 = jSONObject;
if (!"first_name_native".equals(strArr3[i4]) && !str17.equals(strArr3[i4]) && !"last_name_native".equals(strArr3[i4])) {
if (sb3.length() > 0) {
if (!str16.equals(strArr3[i4]) && !"last_name_native".equals(strArr3[i4]) && !"middle_name".equals(strArr3[i4]) && !str17.equals(strArr3[i4])) {
str10 = ", ";
sb3.append(str10);
}
str10 = " ";
sb3.append(str10);
}
String str18 = strArr3[i4];
str7 = str16;
int hashCode = str18.hashCode();
str8 = str17;
if (hashCode == -2006252145) {
obj3 = obj;
if (str18.equals("residence_country_code")) {
c2 = 1;
if (c2 != 0) {
}
str9 = this.i1.get(string2);
}
c2 = 65535;
if (c2 != 0) {
}
str9 = this.i1.get(string2);
} else if (hashCode == -1249512767) {
obj3 = obj;
if (str18.equals(obj3)) {
c2 = 2;
if (c2 != 0) {
}
str9 = this.i1.get(string2);
}
c2 = 65535;
if (c2 != 0) {
}
str9 = this.i1.get(string2);
} else if (hashCode == 1481071862 && str18.equals("country_code")) {
obj3 = obj;
c2 = 0;
if (c2 != 0 || c2 == 1) {
str9 = this.i1.get(string2);
} else if (c2 != 2) {
sb3.append(string2);
} else {
if ("male".equals(string2)) {
str9 = LocaleController.getString("PassportMale", R.string.PassportMale);
} else if ("female".equals(string2)) {
str9 = LocaleController.getString("PassportFemale", R.string.PassportFemale);
}
sb3.append(str9);
}
} else {
obj3 = obj;
c2 = 65535;
if (c2 != 0) {
}
str9 = this.i1.get(string2);
}
sb5 = sb3;
}
str7 = str16;
str8 = str17;
}
obj3 = obj;
sb5 = sb3;
} catch (Exception unused) {
sb2 = sb3;
}
} else {
str7 = str16;
str8 = str17;
hashMap3 = hashMap6;
jSONObject3 = jSONObject;
obj3 = obj;
}
i4++;
obj = obj3;
hashMap6 = hashMap3;
jSONObject = jSONObject3;
str16 = str7;
str17 = str8;
}
str5 = str16;
str6 = str17;
hashMap = hashMap6;
jSONObject2 = jSONObject;
i10 = 2;
obj2 = obj;
}
jSONObject4 = jSONObject2;
} catch (Exception unused2) {
}
}
jSONObject = jSONObject4;
strArr3 = strArr6;
if (strArr3 != null) {
}
str5 = str16;
str6 = str17;
hashMap = hashMap6;
strArr4 = strArr2;
hashMap2 = hashMap7;
obj2 = obj;
jSONObject2 = jSONObject;
i10 = 2;
jSONObject4 = jSONObject2;
} else if (hashMap6 == null) {
str5 = str16;
str6 = str17;
hashMap = hashMap6;
strArr3 = strArr6;
i10 = 2;
obj2 = obj;
strArr4 = strArr2;
hashMap2 = hashMap7;
} else {
if (str15 != null) {
jSONObject = new JSONObject(str15);
strArr3 = strArr2;
if (strArr3 != null) {
}
str5 = str16;
str6 = str17;
hashMap = hashMap6;
strArr4 = strArr2;
hashMap2 = hashMap7;
obj2 = obj;
jSONObject2 = jSONObject;
i10 = 2;
jSONObject4 = jSONObject2;
}
jSONObject = jSONObject4;
strArr3 = strArr6;
if (strArr3 != null) {
}
str5 = str16;
str6 = str17;
hashMap = hashMap6;
strArr4 = strArr2;
hashMap2 = hashMap7;
obj2 = obj;
jSONObject2 = jSONObject;
i10 = 2;
jSONObject4 = jSONObject2;
}
i9++;
str15 = str3;
obj = obj2;
hashMap7 = hashMap2;
strArr2 = strArr4;
hashMap6 = hashMap;
str16 = str5;
str17 = str6;
strArr6 = strArr3;
str14 = str2;
}
sb2 = sb5;
}
}
if (sb2 != null) {
sb4 = sb2.toString();
}
sb4 = null;
}
if (z2) {
xp6Var3 = xp6Var;
hashMap4 = null;
} else {
xp6Var3 = xp6Var;
hashMap4 = this.E1.get(o6(xp6Var3.e));
}
HashMap<String, String> hashMap8 = xp6Var2 != null ? this.E1.get(o6(xp6Var2.e)) : null;
if ((hashMap4 == null || hashMap4.size() <= 0) && (hashMap8 == null || hashMap8.size() <= 0)) {
ed5 ed5Var3 = xp6Var3.e;
if (ed5Var3 instanceof tq6) {
if (TextUtils.isEmpty(sb4)) {
if (xp6Var2 == null) {
i7 = R.string.PassportPersonalDetailsInfo;
str13 = "PassportPersonalDetailsInfo";
} else if (this.r == 8) {
str11 = str4;
sb4 = LocaleController.getString(str11, R.string.PassportDocuments);
g0Var2 = g0Var;
} else if (i2 == 1) {
ed5 ed5Var4 = xp6Var2.e;
if (ed5Var4 instanceof rq6) {
i7 = R.string.PassportIdentityPassport;
str13 = "PassportIdentityPassport";
} else if (ed5Var4 instanceof qq6) {
i7 = R.string.PassportIdentityInternalPassport;
str13 = "PassportIdentityInternalPassport";
} else if (ed5Var4 instanceof nq6) {
i7 = R.string.PassportIdentityDriverLicence;
str13 = "PassportIdentityDriverLicence";
} else if (ed5Var4 instanceof pq6) {
i7 = R.string.PassportIdentityID;
str13 = "PassportIdentityID";
}
} else {
i7 = R.string.PassportIdentityDocumentInfo;
str13 = "PassportIdentityDocumentInfo";
}
sb4 = LocaleController.getString(str13, i7);
g0Var2 = g0Var;
}
g0Var2 = g0Var;
} else {
str11 = str4;
if (ed5Var3 instanceof lq6) {
if (TextUtils.isEmpty(sb4)) {
if (xp6Var2 == null) {
i7 = R.string.PassportAddressNoUploadInfo;
str13 = "PassportAddressNoUploadInfo";
sb4 = LocaleController.getString(str13, i7);
g0Var2 = g0Var;
} else {
if (this.r != 8) {
if (i2 == 1) {
ed5 ed5Var5 = xp6Var2.e;
if (ed5Var5 instanceof vq6) {
i6 = R.string.PassportAddAgreementInfo;
str12 = "PassportAddAgreementInfo";
} else if (ed5Var5 instanceof xq6) {
i6 = R.string.PassportAddBillInfo;
str12 = "PassportAddBillInfo";
} else if (ed5Var5 instanceof sq6) {
i6 = R.string.PassportAddPassportRegistrationInfo;
str12 = "PassportAddPassportRegistrationInfo";
} else if (ed5Var5 instanceof wq6) {
i6 = R.string.PassportAddTemporaryRegistrationInfo;
str12 = "PassportAddTemporaryRegistrationInfo";
} else {
if (ed5Var5 instanceof mq6) {
i6 = R.string.PassportAddBankInfo;
str12 = "PassportAddBankInfo";
}
g0Var2 = g0Var;
}
} else {
i6 = R.string.PassportAddressInfo;
str12 = "PassportAddressInfo";
}
sb4 = LocaleController.getString(str12, i6);
g0Var2 = g0Var;
}
sb4 = LocaleController.getString(str11, R.string.PassportDocuments);
g0Var2 = g0Var;
}
}
g0Var2 = g0Var;
} else if (ed5Var3 instanceof uq6) {
if (TextUtils.isEmpty(sb4)) {
i6 = R.string.PassportPhoneInfo;
str12 = "PassportPhoneInfo";
sb4 = LocaleController.getString(str12, i6);
}
g0Var2 = g0Var;
} else {
if ((ed5Var3 instanceof oq6) && TextUtils.isEmpty(sb4)) {
i6 = R.string.PassportEmailInfo;
str12 = "PassportEmailInfo";
sb4 = LocaleController.getString(str12, i6);
}
g0Var2 = g0Var;
}
}
z4 = false;
} else {
String str19 = !z2 ? this.F1.get(o6(xp6Var3.e)) : null;
sb4 = str19 == null ? this.F1.get(o6(xp6Var2.e)) : str19;
g0Var2 = g0Var;
z4 = true;
}
g0Var2.setValue(sb4);
g0Var2.b.setTextColor(org.telegram.ui.ActionBar.w.r1(z4 ? "windowBackgroundWhiteRedText3" : "windowBackgroundWhiteGrayText2"));
g0Var2.setChecked((z4 || this.r == 8 || ((!z2 || xp6Var2 == null) && (z2 || aq6Var == null)) || (xp6Var2 != null && aq6Var2 == null)) ? false : true);
}
public int m6(String str) {
str.hashCode();
char c2 = 65535;
switch (str.hashCode()) {
case -2006252145:
if (str.equals("residence_country_code")) {
c2 = 0;
break;
}
break;
case -1537298398:
if (str.equals("last_name_native")) {
c2 = 1;
break;
}
break;
case -1249512767:
if (str.equals("gender")) {
c2 = 2;
break;
}
break;
case -796150911:
if (str.equals("street_line1")) {
c2 = 3;
break;
}
break;
case -796150910:
if (str.equals("street_line2")) {
c2 = 4;
break;
}
break;
case -160985414:
if (str.equals("first_name")) {
c2 = 5;
break;
}
break;
case 3053931:
if (str.equals("city")) {
c2 = 6;
break;
}
break;
case 109757585:
if (str.equals("state")) {
c2 = 7;
break;
}
break;
case 421072629:
if (str.equals("middle_name")) {
c2 = '\b';
break;
}
break;
case 451516732:
if (str.equals("first_name_native")) {
c2 = '\t';
break;
}
break;
case 475919162:
if (str.equals("expiry_date")) {
c2 = '\n';
break;
}
break;
case 506677093:
if (str.equals("document_no")) {
c2 = 11;
break;
}
break;
case 1168724782:
if (str.equals("birth_date")) {
c2 = '\f';
break;
}
break;
case 1181577377:
if (str.equals("middle_name_native")) {
c2 = '\r';
break;
}
break;
case 1481071862:
if (str.equals("country_code")) {
c2 = 14;
break;
}
break;
case 2002465324:
if (str.equals("post_code")) {
c2 = 15;
break;
}
break;
case 2013122196:
if (str.equals("last_name")) {
c2 = 16;
break;
}
break;
}
switch (c2) {
case 0:
return 26;
case 1:
case 16:
return 22;
case 2:
return 24;
case 3:
return 29;
case 4:
return 30;
case 5:
case '\t':
return 20;
case 6:
return 32;
case 7:
return 33;
case '\b':
case '\r':
return 21;
case '\n':
return 28;
case 11:
return 27;
case '\f':
return 23;
case 14:
return 25;
case 15:
return 31;
default:
return 100;
}
}
public void m7(DialogInterface dialogInterface, int i2) {
xd5 xd5Var = new xd5();
for (int i3 = 0; i3 < this.H.c.size(); i3++) {
xd5Var.a.add(this.H.c.get(i3).b);
}
X7();
ConnectionsManager.getInstance(this.d).sendRequest(xd5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
org.telegram.ui.w6.this.l7(i95Var, ov5Var);
}
});
}
public void m8(String str, String str2) {
if (c0() == null) {
return;
}
i.C0142i c0142i = new i.C0142i(c0());
c0142i.s(LocaleController.getString("OK", R.string.OK), null);
c0142i.u(str);
c0142i.l(str2);
o1(c0142i.a());
}
private int n6() {
ArrayList<SecureDocument> arrayList;
int i2 = this.c1;
if (i2 == 0) {
arrayList = this.s1;
} else {
if (i2 != 4) {
return 1;
}
arrayList = this.u1;
}
return 20 - arrayList.size();
}
public void n7(View view) {
i.C0142i c0142i = new i.C0142i(c0());
c0142i.u(LocaleController.getString("TelegramPassportDeleteTitle", R.string.TelegramPassportDeleteTitle));
c0142i.l(LocaleController.getString("TelegramPassportDeleteAlert", R.string.TelegramPassportDeleteAlert));
c0142i.s(LocaleController.getString("Delete", R.string.Delete), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
org.telegram.ui.w6.this.m7(dialogInterface, i2);
}
});
c0142i.n(LocaleController.getString("Cancel", R.string.Cancel), null);
org.telegram.ui.ActionBar.i a2 = c0142i.a();
o1(a2);
TextView textView = (TextView) a2.r0(-1);
if (textView != null) {
textView.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextRed2"));
}
}
private void n8() {
if (c0() == null) {
return;
}
Toast.makeText(c0(), LocaleController.getString("UnsupportedAttachment", R.string.UnsupportedAttachment), 0).show();
}
private String o6(ed5 ed5Var) {
return ed5Var instanceof tq6 ? "personal_details" : ed5Var instanceof rq6 ? "passport" : ed5Var instanceof qq6 ? "internal_passport" : ed5Var instanceof nq6 ? "driver_license" : ed5Var instanceof pq6 ? "identity_card" : ed5Var instanceof xq6 ? "utility_bill" : ed5Var instanceof lq6 ? "address" : ed5Var instanceof mq6 ? "bank_statement" : ed5Var instanceof vq6 ? "rental_agreement" : ed5Var instanceof wq6 ? "temporary_registration" : ed5Var instanceof sq6 ? "passport_registration" : ed5Var instanceof oq6 ? "email" : ed5Var instanceof uq6 ? "phone" : BuildConfig.FLAVOR;
}
public void o7(View view) {
b8();
}
public void o8(boolean z2, boolean z3) {
AnimatorSet animatorSet;
Animator.AnimatorListener oVar;
AnimatorSet animatorSet2 = this.W;
if (animatorSet2 != null) {
animatorSet2.cancel();
}
if (z2 && this.V != null) {
this.W = new AnimatorSet();
if (z3) {
this.X.setVisibility(0);
this.V.setEnabled(false);
this.W.playTogether(ObjectAnimator.ofFloat(this.V.getContentView(), (Property<View, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.V.getContentView(), (Property<View, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.V.getContentView(), (Property<View, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.X, (Property<rp0, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.X, (Property<rp0, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.X, (Property<rp0, Float>) View.ALPHA, 1.0f));
} else {
this.V.getContentView().setVisibility(0);
this.V.setEnabled(true);
this.W.playTogether(ObjectAnimator.ofFloat(this.X, (Property<rp0, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.X, (Property<rp0, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.X, (Property<rp0, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.V.getContentView(), (Property<View, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.V.getContentView(), (Property<View, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.V.getContentView(), (Property<View, Float>) View.ALPHA, 1.0f));
}
animatorSet = this.W;
oVar = new n(z3);
} else {
if (this.Y == null) {
return;
}
this.W = new AnimatorSet();
if (z3) {
this.Z.setVisibility(0);
this.a0.setEnabled(false);
this.W.playTogether(ObjectAnimator.ofFloat(this.Y, (Property<TextView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.Y, (Property<TextView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.Y, (Property<TextView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.Z, (Property<rp0, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.Z, (Property<rp0, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.Z, (Property<rp0, Float>) View.ALPHA, 1.0f));
} else {
this.Y.setVisibility(0);
this.a0.setEnabled(true);
this.W.playTogether(ObjectAnimator.ofFloat(this.Z, (Property<rp0, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.Z, (Property<rp0, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.Z, (Property<rp0, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.Y, (Property<TextView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.Y, (Property<TextView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.Y, (Property<TextView, Float>) View.ALPHA, 1.0f));
}
animatorSet = this.W;
oVar = new o(z3);
}
animatorSet.addListener(oVar);
this.W.setDuration(150L);
this.W.start();
}
public byte[] p6() {
byte[] bArr = new byte[32];
Utilities.random.nextBytes(bArr);
int i2 = 0;
for (int i3 = 0; i3 < 32; i3++) {
i2 += 255 & bArr[i3];
}
int i4 = i2 % 255;
if (i4 != 239) {
int nextInt = Utilities.random.nextInt(32);
int i5 = (bArr[nextInt] & 255) + (239 - i4);
if (i5 < 255) {
i5 += 255;
}
bArr[nextInt] = (byte) (i5 % 255);
}
return bArr;
}
public void p7(final i95 i95Var, final ov5 ov5Var) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.v7(ov5Var, i95Var);
}
});
}
public void p8(boolean z2, final String str, Runnable runnable, a0 a0Var, final c0 c0Var) {
boolean z3;
TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
boolean z4 = (telephonyManager.getSimState() == 1 || telephonyManager.getPhoneType() == 0) ? false : true;
if (c0() == null || Build.VERSION.SDK_INT < 23 || !z4) {
z3 = true;
} else {
z3 = c0().checkSelfPermission("android.permission.READ_PHONE_STATE") == 0;
if (z2) {
this.W1.clear();
if (!z3) {
this.W1.add("android.permission.READ_PHONE_STATE");
}
if (!this.W1.isEmpty()) {
if (c0().shouldShowRequestPermissionRationale("android.permission.READ_PHONE_STATE")) {
i.C0142i c0142i = new i.C0142i(c0());
c0142i.u(LocaleController.getString("AppName", R.string.AppName));
c0142i.s(LocaleController.getString("OK", R.string.OK), null);
c0142i.l(LocaleController.getString("AllowReadCall", R.string.AllowReadCall));
this.V1 = o1(c0142i.a());
} else {
c0().requestPermissions((String[]) this.W1.toArray(new String[0]), 6);
}
this.O1 = str;
this.Q1 = a0Var;
this.P1 = runnable;
this.R1 = c0Var;
return;
}
}
}
final qf5 qf5Var = new qf5();
qf5Var.a = str;
vq5 vq5Var = new vq5();
qf5Var.b = vq5Var;
vq5Var.b = z4 && z3;
vq5Var.d = ApplicationLoader.hasPlayServices;
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
boolean z5 = qf5Var.b.d;
SharedPreferences.Editor edit = sharedPreferences.edit();
(z5 ? edit.putString("sms_hash", BuildVars.SMS_HASH) : edit.remove("sms_hash")).commit();
if (qf5Var.b.b) {
try {
String line1Number = telephonyManager.getLine1Number();
if (TextUtils.isEmpty(line1Number)) {
qf5Var.b.c = false;
} else {
qf5Var.b.c = PhoneNumberUtils.compare(str, line1Number);
vq5 vq5Var2 = qf5Var.b;
if (!vq5Var2.c) {
vq5Var2.b = false;
}
}
} catch (Exception e2) {
qf5Var.b.b = false;
FileLog.e(e2);
}
}
ConnectionsManager.getInstance(this.d).sendRequest(qf5Var, new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
w6.this.U7(str, c0Var, qf5Var, i95Var, ov5Var);
}
}, 2);
}
private SecureDocumentKey q6(byte[] bArr, byte[] bArr2) {
byte[] computeSHA512 = Utilities.computeSHA512(e6(bArr, bArr2), bArr2);
byte[] bArr3 = new byte[32];
System.arraycopy(computeSHA512, 0, bArr3, 0, 32);
byte[] bArr4 = new byte[16];
System.arraycopy(computeSHA512, 32, bArr4, 0, 16);
return new SecureDocumentKey(bArr3, bArr4);
}
public void q7(DialogInterface dialogInterface, int i2) {
ok.w(c0(), "https://telegram.org/deactivate?phone=" + UserConfig.getInstance(this.d).getClientPhone());
}
private void q8() {
xp6 xp6Var = this.J;
if (xp6Var != null) {
this.g.setTitle(r6(xp6Var.e));
} else {
this.g.setTitle(LocaleController.getString("PassportPersonal", R.string.PassportPersonal));
}
t8(2);
t8(3);
t8(1);
t8(4);
}
private String r6(ed5 ed5Var) {
int i2;
String str;
if (ed5Var instanceof rq6) {
i2 = R.string.ActionBotDocumentPassport;
str = "ActionBotDocumentPassport";
} else if (ed5Var instanceof nq6) {
i2 = R.string.ActionBotDocumentDriverLicence;
str = "ActionBotDocumentDriverLicence";
} else if (ed5Var instanceof pq6) {
i2 = R.string.ActionBotDocumentIdentityCard;
str = "ActionBotDocumentIdentityCard";
} else if (ed5Var instanceof xq6) {
i2 = R.string.ActionBotDocumentUtilityBill;
str = "ActionBotDocumentUtilityBill";
} else if (ed5Var instanceof mq6) {
i2 = R.string.ActionBotDocumentBankStatement;
str = "ActionBotDocumentBankStatement";
} else if (ed5Var instanceof vq6) {
i2 = R.string.ActionBotDocumentRentalAgreement;
str = "ActionBotDocumentRentalAgreement";
} else if (ed5Var instanceof qq6) {
i2 = R.string.ActionBotDocumentInternalPassport;
str = "ActionBotDocumentInternalPassport";
} else if (ed5Var instanceof sq6) {
i2 = R.string.ActionBotDocumentPassportRegistration;
str = "ActionBotDocumentPassportRegistration";
} else if (ed5Var instanceof wq6) {
i2 = R.string.ActionBotDocumentTemporaryRegistration;
str = "ActionBotDocumentTemporaryRegistration";
} else if (ed5Var instanceof uq6) {
i2 = R.string.ActionBotDocumentPhone;
str = "ActionBotDocumentPhone";
} else {
if (!(ed5Var instanceof oq6)) {
return BuildConfig.FLAVOR;
}
i2 = R.string.ActionBotDocumentEmail;
str = "ActionBotDocumentEmail";
}
return LocaleController.getString(str, i2);
}
public void r7(View view) {
if (this.T.b) {
X7();
ConnectionsManager.getInstance(this.d).bindRequestToGuid(ConnectionsManager.getInstance(this.d).sendRequest(new hh5(), new RequestDelegate() {
@Override
public final void run(i95 i95Var, ov5 ov5Var) {
org.telegram.ui.w6.this.p7(i95Var, ov5Var);
}
}, 10), this.k);
return;
}
if (c0() == null) {
return;
}
i.C0142i c0142i = new i.C0142i(c0());
c0142i.s(LocaleController.getString("OK", R.string.OK), null);
c0142i.n(LocaleController.getString("RestorePasswordResetAccount", R.string.RestorePasswordResetAccount), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
org.telegram.ui.w6.this.q7(dialogInterface, i2);
}
});
c0142i.u(LocaleController.getString("RestorePasswordNoEmailTitle", R.string.RestorePasswordNoEmailTitle));
c0142i.l(LocaleController.getString("RestorePasswordNoEmailText", R.string.RestorePasswordNoEmailText));
o1(c0142i.a());
}
private void r8() {
if (this.H.c.isEmpty()) {
this.K0.setVisibility(0);
this.v0.setVisibility(8);
this.t0.setVisibility(8);
this.H0.setVisibility(8);
this.I0.setVisibility(8);
this.J0.setVisibility(8);
return;
}
this.K0.setVisibility(8);
this.v0.setVisibility(0);
this.t0.setVisibility(0);
this.I0.setVisibility(0);
this.J0.setVisibility(0);
if (w6()) {
this.H0.setVisibility(0);
} else {
this.H0.setVisibility(8);
}
}
public String s6(String str) {
return LocaleController.getInstance().getTranslitString(str, true);
}
public void s7(View view) {
ek7 ek7Var = new ek7(this.d, 0, this.T);
ek7Var.J3(true);
S0(ek7Var);
}
public void s8() {
EditTextBoldCursor editTextBoldCursor;
String string;
ImageView imageView = this.S0;
if (imageView == null) {
return;
}
te5 te5Var = this.T;
if (te5Var == null || this.X0 != 0) {
imageView.setVisibility(8);
this.T0.setVisibility(8);
this.U0.setVisibility(8);
this.V0.setVisibility(8);
this.j0[0].setVisibility(8);
this.V.setVisibility(8);
this.W0.setVisibility(8);
this.R0.setVisibility(8);
this.Q0.setVisibility(8);
this.P0.setVisibility(0);
return;
}
if (!te5Var.d) {
this.Q0.setVisibility(0);
this.S0.setVisibility(0);
this.T0.setVisibility(0);
this.U0.setVisibility(0);
this.V0.setVisibility(8);
this.j0[0].setVisibility(8);
this.V.setVisibility(8);
this.W0.setVisibility(8);
this.R0.setVisibility(8);
this.Q0.setLayoutParams(g52.h(-1, -2, 0.0f, 25.0f, 0.0f, 0.0f));
this.P0.setVisibility(8);
return;
}
this.Q0.setVisibility(0);
this.S0.setVisibility(8);
this.T0.setVisibility(8);
this.U0.setVisibility(8);
this.P0.setVisibility(8);
this.V0.setVisibility(0);
this.j0[0].setVisibility(0);
this.V.setVisibility(0);
this.W0.setVisibility(0);
this.R0.setVisibility(0);
this.Q0.setLayoutParams(g52.h(-1, -2, 0.0f, 0.0f, 0.0f, 0.0f));
if (this.i0 != null) {
te5 te5Var2 = this.T;
if (te5Var2 == null || TextUtils.isEmpty(te5Var2.h)) {
editTextBoldCursor = this.i0[0];
string = LocaleController.getString("LoginPassword", R.string.LoginPassword);
} else {
editTextBoldCursor = this.i0[0];
string = this.T.h;
}
editTextBoldCursor.setHint(string);
}
}
private aq6 t6(xp6 xp6Var, boolean z2) {
JSONObject jSONObject;
int i2;
if (xp6Var == null) {
return null;
}
int size = this.H.c.size();
for (int i3 = 0; i3 < size; i3++) {
aq6 aq6Var = this.H.c.get(i3);
if (xp6Var.e.getClass() == aq6Var.b.getClass()) {
if (z2) {
if (xp6Var.c && !(aq6Var.f instanceof qp6)) {
return null;
}
if (xp6Var.d && aq6Var.g.isEmpty()) {
return null;
}
if (x6(xp6Var.e) && aq6Var.h.isEmpty()) {
return null;
}
if (z6(xp6Var.e) && !(aq6Var.d instanceof qp6)) {
return null;
}
ed5 ed5Var = xp6Var.e;
if (((ed5Var instanceof nq6) || (ed5Var instanceof pq6)) && !(aq6Var.e instanceof qp6)) {
return null;
}
if ((ed5Var instanceof tq6) || (ed5Var instanceof lq6)) {
String[] strArr = ed5Var instanceof tq6 ? xp6Var.b ? new String[]{"first_name_native", "last_name_native", "birth_date", "gender", "country_code", "residence_country_code"} : new String[]{"first_name", "last_name", "birth_date", "gender", "country_code", "residence_country_code"} : new String[]{"street_line1", "street_line2", "post_code", "city", "state", "country_code"};
try {
pp6 pp6Var = aq6Var.c;
jSONObject = new JSONObject(c6(pp6Var.a, e6(pp6Var.c, pp6Var.b), aq6Var.c.b));
} catch (Throwable unused) {
}
while (i2 < strArr.length) {
i2 = (jSONObject.has(strArr[i2]) && !TextUtils.isEmpty(jSONObject.getString(strArr[i2]))) ? i2 + 1 : 0;
return null;
}
}
}
return aq6Var;
}
}
return null;
}
public boolean t7(TextView textView, int i2, KeyEvent keyEvent) {
if (i2 != 5 && i2 != 6) {
return false;
}
this.V.callOnClick();
return true;
}
public void t8(int i2) {
e77 e77Var;
ed5 ed5Var;
String string;
int i3;
String str;
o87 o87Var;
String string2;
boolean z2 = true;
int i4 = 0;
if (i2 == 0) {
if (this.b0 == null) {
return;
}
if (this.s1.size() >= 1) {
o87Var = this.b0;
string2 = LocaleController.getString("PassportUploadAdditinalDocument", R.string.PassportUploadAdditinalDocument);
} else {
o87Var = this.b0;
string2 = LocaleController.getString("PassportUploadDocument", R.string.PassportUploadDocument);
}
} else if (i2 == 1) {
e77Var = this.g0;
if (e77Var == null) {
return;
}
} else if (i2 == 4) {
if (this.h0 == null) {
return;
}
if (this.u1.size() >= 1) {
o87Var = this.h0;
string2 = LocaleController.getString("PassportUploadAdditinalDocument", R.string.PassportUploadAdditinalDocument);
} else {
o87Var = this.h0;
string2 = LocaleController.getString("PassportUploadDocument", R.string.PassportUploadDocument);
}
} else if (i2 == 2) {
e77 e77Var2 = this.e0;
if (e77Var2 == null) {
return;
}
xp6 xp6Var = this.J;
if (xp6Var != null) {
if (!xp6Var.c) {
ed5 ed5Var2 = xp6Var.e;
if (!(ed5Var2 instanceof pq6)) {
}
}
ed5Var = xp6Var.e;
if (!(ed5Var instanceof rq6) || (ed5Var instanceof qq6)) {
string = LocaleController.getString("PassportMainPage", R.string.PassportMainPage);
i3 = R.string.PassportMainPageInfo;
str = "PassportMainPageInfo";
} else {
string = LocaleController.getString("PassportFrontSide", R.string.PassportFrontSide);
i3 = R.string.PassportFrontSideInfo;
str = "PassportFrontSideInfo";
}
e77Var2.a(string, LocaleController.getString(str, i3), z2);
e77Var = this.e0;
}
z2 = false;
ed5Var = xp6Var.e;
if (ed5Var instanceof rq6) {
}
string = LocaleController.getString("PassportMainPage", R.string.PassportMainPage);
i3 = R.string.PassportMainPageInfo;
str = "PassportMainPageInfo";
e77Var2.a(string, LocaleController.getString(str, i3), z2);
e77Var = this.e0;
} else {
if (i2 != 3 || this.f0 == null) {
return;
}
ed5 ed5Var3 = this.J.e;
if (!(ed5Var3 instanceof pq6) && !(ed5Var3 instanceof nq6)) {
this.p0.setVisibility(8);
this.f0.setVisibility(8);
return;
} else {
this.p0.setVisibility(0);
e77Var = this.f0;
}
}
o87Var.c(string2, false);
}
private g0 u6(xp6 xp6Var) {
xp6 xp6Var2;
g0 g0Var = this.A1.get(xp6Var);
return (g0Var != null || (xp6Var2 = this.B1.get(xp6Var)) == null) ? g0Var : this.A1.get(xp6Var2);
}
public void u7(fh5 fh5Var, DialogInterface dialogInterface, int i2) {
te5 te5Var = this.T;
te5Var.i = fh5Var.a;
S0(new ek7(this.d, 4, te5Var));
}
private boolean v6(Class<? extends ed5> cls) {
int size = this.H.c.size();
for (int i2 = 0; i2 < size; i2++) {
if (this.H.c.get(i2).b.getClass() == cls) {
return false;
}
}
return true;
}
public void v7(ov5 ov5Var, i95 i95Var) {
String string;
String str;
String str2;
W7();
if (ov5Var == null) {
final fh5 fh5Var = (fh5) i95Var;
i.C0142i c0142i = new i.C0142i(c0());
c0142i.l(LocaleController.formatString("RestoreEmailSent", R.string.RestoreEmailSent, fh5Var.a));
c0142i.u(LocaleController.getString("RestoreEmailSentTitle", R.string.RestoreEmailSentTitle));
c0142i.s(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
org.telegram.ui.w6.this.u7(fh5Var, dialogInterface, i2);
}
});
Dialog o1 = o1(c0142i.a());
if (o1 != null) {
o1.setCanceledOnTouchOutside(false);
o1.setCancelable(false);
return;
}
return;
}
if (ov5Var.b.startsWith("FLOOD_WAIT")) {
int intValue = Utilities.parseInt(ov5Var.b).intValue();
if (intValue < 60) {
str2 = "Seconds";
} else {
intValue /= 60;
str2 = "Minutes";
}
String formatPluralString = LocaleController.formatPluralString(str2, intValue);
string = LocaleController.getString("AppName", R.string.AppName);
str = LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, formatPluralString);
} else {
string = LocaleController.getString("AppName", R.string.AppName);
str = ov5Var.b;
}
m8(string, str);
}
private boolean w6() {
return v6(uq6.class) || v6(oq6.class) || v6(tq6.class) || v6(rq6.class) || v6(qq6.class) || v6(pq6.class) || v6(nq6.class) || v6(lq6.class) || v6(xq6.class) || v6(sq6.class) || v6(wq6.class) || v6(mq6.class) || v6(vq6.class);
}
public void w7(View view) {
this.v = true;
this.V.callOnClick();
this.v = false;
}
private boolean x6(ed5 ed5Var) {
return (ed5Var instanceof xq6) || (ed5Var instanceof mq6) || (ed5Var instanceof sq6) || (ed5Var instanceof wq6) || (ed5Var instanceof vq6);
}
public void x7() {
AndroidUtilities.showKeyboard(this.i0[2]);
}
public boolean y6() {
String str = this.q;
return str == null || str.equals(k6());
}
public void y7(l3.d dVar) {
this.i0[0].setText(dVar.a);
if (this.e1.indexOf(dVar.a) != -1) {
this.j1 = true;
String str = this.f1.get(dVar.a);
this.i0[1].setText(str);
String str2 = this.h1.get(str);
this.i0[2].setHintText(str2 != null ? str2.replace('X', (char) 8211) : null);
this.j1 = false;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.x7();
}
}, 300L);
this.i0[2].requestFocus();
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
editTextBoldCursorArr[2].setSelection(editTextBoldCursorArr[2].length());
}
private boolean z6(ed5 ed5Var) {
return (ed5Var instanceof nq6) || (ed5Var instanceof rq6) || (ed5Var instanceof qq6) || (ed5Var instanceof pq6);
}
public boolean z7(View view, MotionEvent motionEvent) {
if (c0() == null) {
return false;
}
if (motionEvent.getAction() == 1) {
l3 l3Var = new l3(false);
l3Var.C1(new l3.g() {
@Override
public final void a(l3.d dVar) {
org.telegram.ui.w6.this.y7(dVar);
}
});
S0(l3Var);
}
return true;
}
@Override
public void A() {
ChatAttachAlert chatAttachAlert = this.b1;
if (chatAttachAlert == null || this.c != chatAttachAlert) {
super.A();
return;
}
chatAttachAlert.W1().u1(false);
this.b1.dismissInternal();
this.b1.W1().x1(true);
}
@Override
public boolean B(Dialog dialog) {
return dialog != this.b1 && super.B(dialog);
}
@Override
public void D0(Dialog dialog) {
if (this.r != 3 || Build.VERSION.SDK_INT < 23 || dialog != this.V1 || this.W1.isEmpty()) {
return;
}
c0().requestPermissions((String[]) this.W1.toArray(new String[0]), 6);
}
@Override
public boolean E0() {
NotificationCenter.getInstance(this.d).addObserver(this, NotificationCenter.fileUploaded);
NotificationCenter.getInstance(this.d).addObserver(this, NotificationCenter.fileUploadFailed);
NotificationCenter.getInstance(this.d).addObserver(this, NotificationCenter.twoStepPasswordChanged);
NotificationCenter.getInstance(this.d).addObserver(this, NotificationCenter.didRemoveTwoStepPassword);
return super.E0();
}
@Override
public void F0() {
super.F0();
NotificationCenter.getInstance(this.d).removeObserver(this, NotificationCenter.fileUploaded);
NotificationCenter.getInstance(this.d).removeObserver(this, NotificationCenter.fileUploadFailed);
NotificationCenter.getInstance(this.d).removeObserver(this, NotificationCenter.twoStepPasswordChanged);
NotificationCenter.getInstance(this.d).removeObserver(this, NotificationCenter.didRemoveTwoStepPassword);
int i2 = 0;
J5(false);
ChatAttachAlert chatAttachAlert = this.b1;
if (chatAttachAlert != null) {
chatAttachAlert.dismissInternal();
this.b1.u2();
}
if (this.r == 7) {
while (true) {
pz4[] pz4VarArr = this.T1;
if (i2 >= pz4VarArr.length) {
break;
}
if (pz4VarArr[i2] != null) {
pz4VarArr[i2].e();
}
i2++;
}
org.telegram.ui.ActionBar.i iVar = this.U1;
if (iVar != null) {
try {
iVar.dismiss();
} catch (Exception e2) {
FileLog.e(e2);
}
this.U1 = null;
}
}
}
@Override
public void H0() {
super.H0();
ChatAttachAlert chatAttachAlert = this.b1;
if (chatAttachAlert != null) {
chatAttachAlert.v2();
}
}
@Override
public void K0(int i2, String[] strArr, int[] iArr) {
ChatAttachAlert chatAttachAlert;
o87 o87Var;
int i3 = this.r;
if ((i3 != 1 && i3 != 2) || (chatAttachAlert = this.b1) == null) {
if (i3 == 3 && i2 == 6) {
p8(false, this.O1, this.P1, this.Q1, this.R1);
return;
}
return;
}
if (i2 == 17) {
chatAttachAlert.W1().q1(false);
return;
}
if (i2 == 21) {
if (c0() == null || iArr == null || iArr.length == 0 || iArr[0] == 0) {
return;
}
i.C0142i c0142i = new i.C0142i(c0());
c0142i.u(LocaleController.getString("AppName", R.string.AppName));
c0142i.l(LocaleController.getString("PermissionNoAudioVideo", R.string.PermissionNoAudioVideo));
c0142i.n(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i4) {
org.telegram.ui.w6.this.M7(dialogInterface, i4);
}
});
c0142i.s(LocaleController.getString("OK", R.string.OK), null);
c0142i.C();
return;
}
if (i2 == 19 && iArr != null && iArr.length > 0 && iArr[0] == 0) {
e8(0);
return;
}
if (i2 != 22 || iArr == null || iArr.length <= 0 || iArr[0] != 0 || (o87Var = this.B0) == null) {
return;
}
o87Var.callOnClick();
}
@Override
public void M0() {
ViewGroup[] viewGroupArr;
super.M0();
ChatAttachAlert chatAttachAlert = this.b1;
if (chatAttachAlert != null) {
chatAttachAlert.x2();
}
if (this.r == 5 && (viewGroupArr = this.j0) != null && viewGroupArr[0] != null && viewGroupArr[0].getVisibility() == 0) {
this.i0[0].requestFocus();
AndroidUtilities.showKeyboard(this.i0[0]);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.N7();
}
}, 200L);
}
AndroidUtilities.requestAdjustResize(c0(), this.k);
}
@Override
public void O0(boolean z2, boolean z3) {
EditTextBoldCursor editTextBoldCursor;
if (this.r1 != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
org.telegram.ui.w6.this.O7();
}
});
}
int i2 = this.r;
if (i2 == 5) {
if (z2) {
if (this.j0[0].getVisibility() == 0) {
this.i0[0].requestFocus();
AndroidUtilities.showKeyboard(this.i0[0]);
}
if (this.X0 == 2) {
a8(false);
return;
}
return;
}
return;
}
if (i2 == 7) {
if (z2) {
this.T1[this.S1].g();
return;
}
return;
}
if (i2 == 4) {
if (!z2) {
return;
}
this.i0[0].requestFocus();
editTextBoldCursor = this.i0[0];
} else {
if (i2 != 6) {
if ((i2 == 2 || i2 == 1) && Build.VERSION.SDK_INT >= 21) {
R5();
return;
}
return;
}
if (!z2) {
return;
}
this.i0[0].requestFocus();
editTextBoldCursor = this.i0[0];
}
AndroidUtilities.showKeyboard(editTextBoldCursor);
}
public void W7() {
org.telegram.ui.ActionBar.i iVar = this.U1;
if (iVar == null) {
return;
}
try {
iVar.dismiss();
} catch (Exception e2) {
FileLog.e(e2);
}
this.U1 = null;
}
public void X7() {
if (c0() == null || c0().isFinishing() || this.U1 != null) {
return;
}
org.telegram.ui.ActionBar.i iVar = new org.telegram.ui.ActionBar.i(c0(), 3);
this.U1 = iVar;
iVar.E0(false);
this.U1.show();
}
public void a(ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList, boolean z2, int i2) {
f8(arrayList);
}
@Override
public void a1(Bundle bundle) {
String str = this.a1;
if (str != null) {
bundle.putString("path", str);
}
}
@Override
public void didReceivedNotification(int i2, int i3, Object... objArr) {
HashMap<String, String> hashMap;
String str;
f0 f0Var;
org.telegram.ui.ActionBar.d dVar;
if (i2 != NotificationCenter.fileUploaded) {
if (i2 == NotificationCenter.fileUploadFailed) {
return;
}
if (i2 != NotificationCenter.twoStepPasswordChanged) {
int i4 = NotificationCenter.didRemoveTwoStepPassword;
return;
}
if (objArr == null || objArr.length <= 0) {
this.T = null;
V7();
} else {
if (objArr[7] != null) {
EditTextBoldCursor[] editTextBoldCursorArr = this.i0;
if (editTextBoldCursorArr[0] != null) {
editTextBoldCursorArr[0].setText((String) objArr[7]);
}
}
if (objArr[6] == null) {
te5 te5Var = new te5();
this.T = te5Var;
te5Var.e = (hc5) objArr[1];
te5Var.k = (ad5) objArr[2];
te5Var.l = (byte[]) objArr[3];
te5Var.b = !TextUtils.isEmpty((String) objArr[4]);
te5 te5Var2 = this.T;
te5Var2.h = (String) objArr[5];
te5Var2.g = -1L;
byte[] bArr = new byte[256];
te5Var2.f = bArr;
Utilities.random.nextBytes(bArr);
EditTextBoldCursor[] editTextBoldCursorArr2 = this.i0;
if (editTextBoldCursorArr2[0] != null && editTextBoldCursorArr2[0].length() > 0) {
this.X0 = 2;
}
}
}
s8();
return;
}
String str2 = (String) objArr[0];
SecureDocument secureDocument = this.y1.get(str2);
if (secureDocument != null) {
secureDocument.inputFile = (py5) objArr[1];
this.y1.remove(str2);
if (this.y1.isEmpty() && (dVar = this.V) != null) {
dVar.setEnabled(true);
this.V.setAlpha(1.0f);
}
HashMap<SecureDocument, f0> hashMap2 = this.x1;
if (hashMap2 != null && (f0Var = hashMap2.get(secureDocument)) != null) {
f0Var.d(true);
}
HashMap<String, String> hashMap3 = this.I1;
if (hashMap3 != null && hashMap3.containsKey("error_document_all")) {
this.I1.remove("error_document_all");
P5(false);
}
int i5 = secureDocument.type;
if (i5 == 0) {
if (this.x0 != null && !TextUtils.isEmpty(this.J1)) {
this.x0.setText(this.J1);
}
hashMap = this.I1;
str = "files_all";
} else {
if (i5 != 4) {
return;
}
if (this.y0 != null && !TextUtils.isEmpty(this.K1)) {
this.y0.setText(this.K1);
}
hashMap = this.I1;
str = "translation_all";
}
hashMap.remove(str);
}
}
public void g6(ArrayList<String> arrayList, String str, boolean z2, int i2) {
ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList2 = new ArrayList<>();
int size = arrayList.size();
for (int i3 = 0; i3 < size; i3++) {
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
sendingMediaInfo.path = arrayList.get(i3);
arrayList2.add(sendingMediaInfo);
}
f8(arrayList2);
}
@Override
public ArrayList<org.telegram.ui.ActionBar.a0> i0() {
ArrayList<org.telegram.ui.ActionBar.a0> arrayList = new ArrayList<>();
arrayList.add(new org.telegram.ui.ActionBar.a0(this.e, org.telegram.ui.ActionBar.a0.q, null, null, null, null, "windowBackgroundGray"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.q, null, null, null, null, "actionBarDefault"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.l0, org.telegram.ui.ActionBar.a0.F, null, null, null, null, "actionBarDefault"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.w, null, null, null, null, "actionBarDefaultIcon"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.x, null, null, null, null, "actionBarDefaultTitle"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.y, null, null, null, null, "actionBarDefaultSelector"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.R, null, null, null, null, "actionBarDefaultSearch"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.Q, null, null, null, null, "actionBarDefaultSearchPlaceholder"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, 0, new Class[]{View.class}, org.telegram.ui.ActionBar.w.l0, null, null, "divider"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.c0, org.telegram.ui.ActionBar.a0.q, null, null, null, null, "windowBackgroundWhite"));
if (this.d0 != null) {
arrayList.add(new org.telegram.ui.ActionBar.a0(this.d0, org.telegram.ui.ActionBar.a0.q, null, null, null, null, "windowBackgroundWhite"));
}
for (int i2 = 0; i2 < this.u0.size(); i2++) {
arrayList.add(new org.telegram.ui.ActionBar.a0(this.u0.get(i2), org.telegram.ui.ActionBar.a0.q, null, null, null, null, "divider"));
}
Iterator<Map.Entry<SecureDocument, f0>> it = this.x1.entrySet().iterator();
while (it.hasNext()) {
f0 value = it.next().getValue();
arrayList.add(new org.telegram.ui.ActionBar.a0(value, org.telegram.ui.ActionBar.a0.S, new Class[]{f0.class}, null, null, null, "windowBackgroundWhite"));
arrayList.add(new org.telegram.ui.ActionBar.a0(value, 0, new Class[]{f0.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteBlackText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(value, 0, new Class[]{f0.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText2"));
}
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.S, new Class[]{e77.class}, null, null, null, "windowBackgroundWhite"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, 0, new Class[]{e77.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteBlackText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, 0, new Class[]{e77.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText2"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.S, new Class[]{o87.class}, null, null, null, "windowBackgroundWhite"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, 0, new Class[]{o87.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteBlackText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, 0, new Class[]{o87.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteValueText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.v, new Class[]{iv4.class}, null, null, null, "windowBackgroundGrayShadow"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.S, new Class[]{g0.class}, null, null, null, "windowBackgroundWhite"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.s, new Class[]{g0.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteBlackText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.s, new Class[]{g0.class}, null, null, null, "divider"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.s, new Class[]{g0.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText2"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.t, new Class[]{g0.class}, new String[]{"checkImageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "featuredStickers_addedIcon"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.u, new Class[]{rr1.class}, null, null, null, "windowBackgroundWhite"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, 0, new Class[]{rr1.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteBlueHeader"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, org.telegram.ui.ActionBar.a0.v, new Class[]{i77.class}, null, null, null, "windowBackgroundGrayShadow"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.m0, 0, new Class[]{i77.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText4"));
if (this.i0 != null) {
for (int i3 = 0; i3 < this.i0.length; i3++) {
arrayList.add(new org.telegram.ui.ActionBar.a0((View) this.i0[i3].getParent(), org.telegram.ui.ActionBar.a0.q, null, null, null, null, "windowBackgroundWhite"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.i0[i3], org.telegram.ui.ActionBar.a0.s | org.telegram.ui.ActionBar.a0.O, null, null, null, null, "windowBackgroundWhiteBlackText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.i0[i3], org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteHintText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.i0[i3], org.telegram.ui.ActionBar.a0.N | org.telegram.ui.ActionBar.a0.B, null, null, null, null, "windowBackgroundWhiteBlueHeader"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.i0[i3], org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.i0[i3], org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.i0[i3], org.telegram.ui.ActionBar.a0.B | org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteRedText3"));
}
} else {
arrayList.add(new org.telegram.ui.ActionBar.a0(null, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(null, org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteHintText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(null, org.telegram.ui.ActionBar.a0.B | org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteBlueHeader"));
arrayList.add(new org.telegram.ui.ActionBar.a0(null, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
arrayList.add(new org.telegram.ui.ActionBar.a0(null, org.telegram.ui.ActionBar.a0.G | org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
arrayList.add(new org.telegram.ui.ActionBar.a0(null, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.B, null, null, null, null, "windowBackgroundWhiteRedText3"));
}
if (this.k0 != null) {
for (int i4 = 0; i4 < this.k0.length; i4++) {
arrayList.add(new org.telegram.ui.ActionBar.a0((View) this.k0[i4].getParent(), org.telegram.ui.ActionBar.a0.q, null, null, null, null, "windowBackgroundWhite"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.k0[i4], org.telegram.ui.ActionBar.a0.s | org.telegram.ui.ActionBar.a0.O, null, null, null, null, "windowBackgroundWhiteBlackText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.k0[i4], org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteHintText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.k0[i4], org.telegram.ui.ActionBar.a0.N | org.telegram.ui.ActionBar.a0.B, null, null, null, null, "windowBackgroundWhiteBlueHeader"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.k0[i4], org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.k0[i4], org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.k0[i4], org.telegram.ui.ActionBar.a0.B | org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteRedText3"));
}
}
arrayList.add(new org.telegram.ui.ActionBar.a0(this.P0, org.telegram.ui.ActionBar.a0.B, null, null, null, null, "progressCircle"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.S0, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "chat_messagePanelIcons"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.T0, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText4"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.U0, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText5"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.W0, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.G0, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.Y, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "passport_authorizeText"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.a0, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "passport_authorizeBackground"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.a0, org.telegram.ui.ActionBar.a0.G | org.telegram.ui.ActionBar.a0.v, null, null, null, null, "passport_authorizeBackgroundSelected"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.X, 0, null, null, null, null, "contextProgressInner2"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.X, 0, null, null, null, null, "contextProgressOuter2"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.Z, 0, null, null, null, null, "contextProgressInner2"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.Z, 0, null, null, null, null, "contextProgressOuter2"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.L0, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "sessions_devicesImage"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.M0, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText2"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.N0, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText2"));
arrayList.add(new org.telegram.ui.ActionBar.a0(this.O0, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
return arrayList;
}
public void j() {
try {
Intent intent = new Intent("android.intent.action.GET_CONTENT");
if (Build.VERSION.SDK_INT >= 18) {
intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
}
intent.setType("*/*");
r1(intent, 21);
} catch (Exception e2) {
FileLog.e(e2);
}
}
public void j8(boolean z2) {
this.M1 = z2;
}
public void k8(int i2, boolean z2, Bundle bundle) {
if (i2 == 3) {
this.V.setVisibility(8);
}
pz4[] pz4VarArr = this.T1;
pz4 pz4Var = pz4VarArr[this.S1];
pz4 pz4Var2 = pz4VarArr[i2];
this.S1 = i2;
pz4Var2.j(bundle, false);
pz4Var2.g();
if (!z2) {
pz4Var2.setTranslationX(0.0f);
pz4Var2.setVisibility(0);
if (pz4Var != pz4Var2) {
pz4Var.setVisibility(8);
return;
}
return;
}
pz4Var2.setTranslationX(AndroidUtilities.displaySize.x);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.setDuration(300L);
animatorSet.playTogether(ObjectAnimator.ofFloat(pz4Var, "translationX", -AndroidUtilities.displaySize.x), ObjectAnimator.ofFloat(pz4Var2, "translationX", 0.0f));
animatorSet.addListener(new p(this, pz4Var2, pz4Var));
animatorSet.start();
}
@Override
public void w0(int i2, int i3, Intent intent) {
if (i3 == -1) {
if (i2 == 0 || i2 == 2) {
R5();
ChatAttachAlert chatAttachAlert = this.b1;
if (chatAttachAlert != null) {
chatAttachAlert.t2(i2, intent, this.a1);
}
this.a1 = null;
return;
}
if (i2 == 1) {
if (intent == null || intent.getData() == null) {
n8();
return;
}
ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList = new ArrayList<>();
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
sendingMediaInfo.uri = intent.getData();
arrayList.add(sendingMediaInfo);
f8(arrayList);
}
}
}
@Override
public boolean x0() {
int i2 = this.r;
int i3 = 0;
if (i2 == 7) {
this.T1[this.S1].b(true);
while (true) {
pz4[] pz4VarArr = this.T1;
if (i3 >= pz4VarArr.length) {
break;
}
if (pz4VarArr[i3] != null) {
pz4VarArr[i3].e();
}
i3++;
}
} else if (i2 == 0 || i2 == 5) {
J5(false);
} else if (i2 == 1 || i2 == 2) {
return !K5();
}
return true;
}
@Override
public View z(Context context) {
ChatAttachAlert chatAttachAlert;
this.g.setBackButtonImage(org.telegram.messenger.R.drawable.ic_ab_back);
this.g.setAllowOverlayTitle(true);
this.g.setActionBarMenuOnItemClick(new s());
if (this.r == 7) {
t tVar = new t(context);
this.l0 = tVar;
this.e = tVar;
tVar.setFillViewport(true);
AndroidUtilities.setScrollViewEdgeEffectColor(this.l0, org.telegram.ui.ActionBar.w.r1("actionBarDefault"));
} else {
FrameLayout frameLayout = new FrameLayout(context);
this.e = frameLayout;
FrameLayout frameLayout2 = frameLayout;
frameLayout.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundGray"));
u uVar = new u(this, context);
this.l0 = uVar;
uVar.setFillViewport(true);
AndroidUtilities.setScrollViewEdgeEffectColor(this.l0, org.telegram.ui.ActionBar.w.r1("actionBarDefault"));
frameLayout2.addView(this.l0, g52.b(-1, -1.0f, 51, 0.0f, 0.0f, 0.0f, this.r == 0 ? 48.0f : 0.0f));
LinearLayout linearLayout = new LinearLayout(context);
this.m0 = linearLayout;
linearLayout.setOrientation(1);
this.l0.addView(this.m0, new FrameLayout.LayoutParams(-1, -2));
}
int i2 = this.r;
if (i2 != 0 && i2 != 8) {
this.V = this.g.z().j(2, org.telegram.messenger.R.drawable.ic_done, AndroidUtilities.dp(56.0f), LocaleController.getString("Done", R.string.Done));
rp0 rp0Var = new rp0(context, 1);
this.X = rp0Var;
rp0Var.setAlpha(0.0f);
this.X.setScaleX(0.1f);
this.X.setScaleY(0.1f);
this.X.setVisibility(4);
this.V.addView(this.X, g52.a(-1, -1.0f));
int i3 = this.r;
if ((i3 == 1 || i3 == 2) && (chatAttachAlert = this.b1) != null) {
try {
if (chatAttachAlert.isShowing()) {
this.b1.dismiss();
}
} catch (Exception unused) {
}
this.b1.u2();
this.b1 = null;
}
}
int i4 = this.r;
if (i4 == 5) {
X5(context);
} else if (i4 == 0) {
a6(context);
} else {
if (i4 == 1) {
V5(context);
} else if (i4 == 2) {
Q5(context);
} else if (i4 == 3) {
Y5(context);
} else if (i4 == 4) {
T5(context);
} else if (i4 == 6) {
U5(context);
} else if (i4 == 7) {
Z5(context);
} else if (i4 == 8) {
W5(context);
}
i6();
}
return this.e;
}
}