package z5; import android.os.Handler; import android.os.Looper; import android.view.View; import androidx.appcompat.app.m; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.concurrent.TimeUnit; import org.json.JSONObject; import v5.a; import w5.f; import z5.b; /* loaded from: classes2.dex */ public class a implements a.InterfaceC0247a { /* renamed from: g, reason: collision with root package name */ private static a f15870g = new a(); /* renamed from: h, reason: collision with root package name */ private static Handler f15871h = new Handler(Looper.getMainLooper()); /* renamed from: i, reason: collision with root package name */ private static Handler f15872i = null; /* renamed from: j, reason: collision with root package name */ private static final Runnable f15873j = new b(); /* renamed from: k, reason: collision with root package name */ private static final Runnable f15874k = new c(); /* renamed from: b, reason: collision with root package name */ private int f15876b; /* renamed from: f, reason: collision with root package name */ private long f15880f; /* renamed from: a, reason: collision with root package name */ private List f15875a = new ArrayList(); /* renamed from: d, reason: collision with root package name */ private z5.b f15878d = new z5.b(); /* renamed from: c, reason: collision with root package name */ private v5.b f15877c = new v5.b(); /* renamed from: e, reason: collision with root package name */ private z5.c f15879e = new z5.c(new a6.c()); /* renamed from: z5.a$a, reason: collision with other inner class name */ class RunnableC0271a implements Runnable { RunnableC0271a() { } @Override // java.lang.Runnable public void run() { a.this.f15879e.c(); } } static class b implements Runnable { b() { } @Override // java.lang.Runnable public void run() { a.p().q(); } } static class c implements Runnable { c() { } @Override // java.lang.Runnable public void run() { if (a.f15872i != null) { a.f15872i.post(a.f15873j); a.f15872i.postDelayed(a.f15874k, 200L); } } } a() { } private void d(long j10) { if (this.f15875a.size() > 0) { Iterator it = this.f15875a.iterator(); if (it.hasNext()) { m.a(it.next()); TimeUnit.NANOSECONDS.toMillis(j10); throw null; } } } private void e(View view, v5.a aVar, JSONObject jSONObject, d dVar) { aVar.b(view, jSONObject, this, dVar == d.PARENT_VIEW); } private void f(String str, View view, JSONObject jSONObject) { v5.a b10 = this.f15877c.b(); String b11 = this.f15878d.b(str); if (b11 != null) { JSONObject a10 = b10.a(view); w5.b.e(a10, str); w5.b.k(a10, b11); w5.b.g(jSONObject, a10); } } private boolean g(View view, JSONObject jSONObject) { String a10 = this.f15878d.a(view); if (a10 == null) { return false; } w5.b.e(jSONObject, a10); this.f15878d.m(); return true; } private void i(View view, JSONObject jSONObject) { b.a h10 = this.f15878d.h(view); if (h10 != null) { w5.b.h(jSONObject, h10); } } public static a p() { return f15870g; } /* JADX INFO: Access modifiers changed from: private */ public void q() { r(); l(); s(); } private void r() { this.f15876b = 0; this.f15880f = w5.d.a(); } private void s() { d(w5.d.a() - this.f15880f); } private void t() { if (f15872i == null) { Handler handler = new Handler(Looper.getMainLooper()); f15872i = handler; handler.post(f15873j); f15872i.postDelayed(f15874k, 200L); } } private void u() { Handler handler = f15872i; if (handler != null) { handler.removeCallbacks(f15874k); f15872i = null; } } @Override // v5.a.InterfaceC0247a public void a(View view, v5.a aVar, JSONObject jSONObject) { d i10; if (f.d(view) && (i10 = this.f15878d.i(view)) != d.UNDERLYING_VIEW) { JSONObject a10 = aVar.a(view); w5.b.g(jSONObject, a10); if (!g(view, a10)) { i(view, a10); e(view, aVar, a10, i10); } this.f15876b++; } } public void c() { t(); } public void h() { k(); this.f15875a.clear(); f15871h.post(new RunnableC0271a()); } public void k() { u(); } void l() { this.f15878d.j(); long a10 = w5.d.a(); v5.a a11 = this.f15877c.a(); if (this.f15878d.g().size() > 0) { Iterator it = this.f15878d.g().iterator(); while (it.hasNext()) { String str = (String) it.next(); JSONObject a12 = a11.a(null); f(str, this.f15878d.f(str), a12); w5.b.d(a12); HashSet hashSet = new HashSet(); hashSet.add(str); this.f15879e.e(a12, hashSet, a10); } } if (this.f15878d.c().size() > 0) { JSONObject a13 = a11.a(null); e(null, a11, a13, d.PARENT_VIEW); w5.b.d(a13); this.f15879e.d(a13, this.f15878d.c(), a10); } else { this.f15879e.c(); } this.f15878d.l(); } }