package xa3; import android.accounts.Account; import android.content.Context; import android.content.Intent; import android.os.Bundle; import com.google.android.gms.auth.UserRecoverableAuthException; import j.q; import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.concurrent.Executor; import jp.naver.line.android.R; import lg.e; import lw.l; import ly2.f; import ly2.f0; import ly2.u; import og.a; import pg.k; import rg.a; import va3.c; import xy2.b; import z8.e0; public class d { /* renamed from: g reason: collision with root package name */ public static final String[] f180864g = {"https://www.googleapis.com/auth/drive.appdata"}; /* renamed from: a reason: collision with root package name */ public final fg.a f180865a; /* renamed from: b reason: collision with root package name */ public b<String> f180866b; /* renamed from: c reason: collision with root package name */ public b<c.C3089c> f180867c; /* renamed from: d reason: collision with root package name */ public final Context f180868d; /* renamed from: e reason: collision with root package name */ public final String f180869e; /* renamed from: f reason: collision with root package name */ public final Executor f180870f; public static /* synthetic */ class a { /* renamed from: a reason: collision with root package name */ public static final /* synthetic */ int[] f180871a; static { int[] iArr = new int[hg.a.a().length]; f180871a = iArr; try { iArr[q.e(4)] = 1; } catch (NoSuchFieldError unused) { } } } public d(Context context, String str, String str2, Executor executor) { this.f180868d = context; fg.a e14 = fg.a.e(context, Arrays.asList(f180864g)); e14.f72138f = new k(); this.f180865a = e14; e14.d(str2); this.f180869e = str; this.f180870f = executor; } public final void a(rg.a aVar, String str, String str2) throws IOException { List<sg.c> i14 = i(aVar, str); if (!(i14 == null || i14.isEmpty())) { for (sg.c cVar : i14) { if (!str2.equals(cVar.getId())) { try { new a.c.b(new a.c(), cVar.getId()).h(); } catch (Exception unused) { } } } } } public final rg.a b(fg.a aVar) { a.b bVar = new a.b(new e(), a.C2197a.f122925a, aVar); bVar.f87660f = this.f180868d.getString(R.string.app_name_RES_2131952796); return new rg.a(bVar); } public c.b c() throws c.a { try { File f14 = wa3.b.f(this.f180868d, this.f180869e); rg.a b14 = b(this.f180865a); sg.c h14 = h(b14, f14.getName()); if (h14 != null) { new a.c.b(new a.c(), h14.getId()).h(); return c.b.f170829c; } throw e(c.a.EnumC3088a.NO_BACKUP_FILE); } catch (IOException e14) { throw new c.a(c.a.EnumC3088a.GOOGLE_DRIVE_UNKNOWN, e14); } } public zx2.q<c> d(String str) { return new ly2.d(new mj0.a(this, str, 1)).B(wy2.a.a(this.f180870f)); } public final c.a e(c.a.EnumC3088a aVar) { return new c.a(aVar, null); } public final zx2.q<c.b> f() { return new u(new b12.d(this, 1)).B(wy2.a.a(this.f180870f)); } public final Intent g(String str) throws Exception { try { Bundle bundle = new Bundle(); Context context = this.f180868d; Account account = new Account(this.f180865a.f72136d, "com.google"); int i14 = nb.b.f116840d; nb.k.a(context, account, str, bundle); throw new Exception("Permission Intent isn't exist"); } catch (UserRecoverableAuthException e14) { Intent intent = e14.f28364b; if (intent == null) { return null; } return new Intent(intent); } } public final sg.c h(rg.a aVar, String str) throws IOException { List<sg.c> i14 = i(aVar, str); if (i14 == null || i14.isEmpty()) { return null; } return (sg.c) g1.c.a(i14, -1); } public final List<sg.c> i(rg.a aVar, String str) throws IOException { Objects.requireNonNull(aVar); a.c.d dVar = new a.c.d(new a.c()); Objects.requireNonNull(aVar); dVar.s("appDataFolder"); dVar.r("name ='" + str + "'"); dVar.p("files(id, name, size, createdTime)"); dVar.q("createdTime"); return ((sg.d) dVar.h()).k(); } public zx2.q<c.C3089c> j(Intent intent, androidx.activity.result.c<Intent> cVar) { return new f(new a(this, cVar, intent)).B(yx2.b.a()); } public zx2.q<c.C3089c> k(androidx.activity.result.c<Intent> cVar) { return new f0(new u(new l(this, 1)).B(wy2.a.a(this.f180870f)).f(new cj0.q(this, cVar, 3)), new e0(this, cVar, 3)); } public zx2.q<c> l(String str) { return new ly2.d(new s21.d(this, str)).B(wy2.a.a(this.f180870f)); } }