package com.kofax.mobile.sdk.w; import bolts.CancellationToken; import com.kofax.kmc.ken.engines.data.Image; import com.kofax.kmc.ken.engines.data.ImagePerfectionProfile; import com.kofax.kmc.kut.utilities.error.KmcRuntimeException; import com.kofax.mobile.sdk._internal.g; import o.InterfaceC13391fZD; /* loaded from: classes3.dex */ public class ak extends ae { private final a Qt; private final com.kofax.mobile.sdk._internal.extraction.id.m Qu; private final com.kofax.mobile.sdk._internal.g wM; /* loaded from: classes3.dex */ public interface a { com.kofax.mobile.sdk.u.b B(com.kofax.mobile.sdk.e.a aVar); boolean D(com.kofax.mobile.sdk.e.a aVar); ImagePerfectionProfile E(com.kofax.mobile.sdk.e.a aVar); void e(com.kofax.mobile.sdk.e.a aVar, Exception exc); } @Override // com.kofax.mobile.sdk.w.ae, com.kofax.mobile.sdk.e.c public /* bridge */ /* synthetic */ void a(Object obj, CancellationToken cancellationToken) { super.a(obj, cancellationToken); } @InterfaceC13391fZD public ak(a aVar, com.kofax.mobile.sdk._internal.extraction.id.m mVar, com.kofax.mobile.sdk._internal.g gVar) { this.Qt = aVar; this.Qu = mVar; this.wM = gVar; } @Override // com.kofax.mobile.sdk.w.ae public void a(com.kofax.mobile.sdk.e.a aVar) { try { C(aVar); e = null; } catch (Exception e) { e = e; } this.Qt.e(aVar, e); } private void C(com.kofax.mobile.sdk.e.a aVar) { com.kofax.mobile.sdk.u.b B = this.Qt.B(aVar); boolean D = this.Qt.D(aVar); if (B == null || B.originalImage == null) { return; } if (B.NV == null) { B.NV = w(B.originalImage); } if (D) { c(B); } else { a(aVar, B); } } private void c(com.kofax.mobile.sdk.u.b bVar) { bVar.NW = bVar.originalImage; bVar.NX = bVar.NV; } private void a(com.kofax.mobile.sdk.e.a aVar, com.kofax.mobile.sdk.u.b bVar) { ImagePerfectionProfile E = this.Qt.E(aVar); if (E != null) { bVar.NW = this.Qu.a(E, bVar.originalImage); bVar.NX = w(bVar.NW); } } private g.a w(Image image) { try { return this.wM.w(image); } catch (KmcRuntimeException unused) { return null; } } }