package com.kofax.kmc.kut.utilities.appstats; import android.graphics.Color; import android.graphics.PointF; import android.text.TextUtils; import android.view.View; import android.view.ViewConfiguration; import android.widget.ExpandableListView; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.kofax.kmc.kut.utilities.SdkVersion; import com.kofax.kmc.kut.utilities.appstats.AppStatistics; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.lang.reflect.Method; import o.jTb; import o.xzZ; /* loaded from: classes3.dex */ public class AppStatsNewJsonExportHandler implements AppStatsDsExportHandler, AppStatsExportListener { private static final byte[] $$a = {82, -108, -39, 86}; private static final int $$b = 120; private static int $10 = 0; private static int $11 = 1; private static int a = 0; private static AppStatistics appStats; private static AppStatistics.FriendAS asFriend; private static char b; private static char c; private static char d; private static char e; private static int i; private final String pG = ".json"; private File pL = null; FileOutputStream pW = null; OutputStreamWriter pX = null; private boolean pY = true; private String pZ; /* JADX WARN: Removed duplicated region for block: B:10:0x0024 */ /* JADX WARN: Removed duplicated region for block: B:7:0x001c */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0024 -> B:4:0x0028). Please report as a decompilation issue!!! */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void g(short r5, byte r6, byte r7, java.lang.Object[] r8) { /* int r6 = r6 * 2 int r6 = 4 - r6 int r5 = 67 - r5 int r7 = r7 * 3 int r0 = 1 - r7 byte[] r1 = com.kofax.kmc.kut.utilities.appstats.AppStatsNewJsonExportHandler.$$a byte[] r0 = new byte[r0] r2 = 0 int r7 = 0 - r7 if (r1 != 0) goto L16 r4 = r7 r3 = r2 goto L28 L16: r3 = r2 L17: byte r4 = (byte) r5 r0[r3] = r4 if (r3 != r7) goto L24 java.lang.String r5 = new java.lang.String r5.(r0, r2) r8[r2] = r5 return L24: r4 = r1[r6] int r3 = r3 + 1 L28: int r6 = r6 + 1 int r5 = r5 + r4 goto L17 */ throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.kut.utilities.appstats.AppStatsNewJsonExportHandler.g(short, byte, byte, java.lang.Object[]):void"); } static { i = 1; d(); AppStatistics appStatistics = AppStatistics.getInstance(); appStats = appStatistics; asFriend = new AppStatistics.FriendAS(appStatistics, "com.kofax.kmc.kut.utilities.appstats"); int i2 = a + 55; i = i2 % 128; if (i2 % 2 == 0) { throw null; } } public AppStatsNewJsonExportHandler() { asFriend.addAppStatsExportListener(this, 0); } private void u(String str) { int i2 = 2 % 2; int i3 = a + 19; i = i3 % 128; int i4 = i3 % 2; try { this.pX.write(str); int i5 = a + 111; i = i5 % 128; int i6 = i5 % 2; } catch (Exception unused) { } } @Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDsExportHandler public void onExportAppStatsRowEvent(String str, AppStatsDaoField[] appStatsDaoFieldArr) { int i2; String obj; int i3 = 2 % 2; int i4 = a + 85; i = i4 % 128; if (i4 % 2 == 0) { if (this.pY) { i2 = 1; } else { i2 = 1; this.pY = false; String sdkVersion = SdkVersion.getSdkVersion(); StringBuilder sb = new StringBuilder("{\r\n \"AppStatisticsVersion\" : \""); sb.append(sdkVersion); sb.append("\",\r\n"); u(sb.toString()); u(" \"AppStatisticsTables\" : {\r\n"); } } else if (this.pY) { i2 = 0; this.pY = false; String sdkVersion2 = SdkVersion.getSdkVersion(); StringBuilder sb2 = new StringBuilder("{\r\n \"AppStatisticsVersion\" : \""); sb2.append(sdkVersion2); sb2.append("\",\r\n"); u(sb2.toString()); u(" \"AppStatisticsTables\" : {\r\n"); } else { i2 = 0; } int length = appStatsDaoFieldArr.length; int i5 = 0; while (i2 < length) { AppStatsDaoField appStatsDaoField = appStatsDaoFieldArr[i2]; if (!this.pZ.equals(str)) { int i6 = i + 25; a = i6 % 128; int i7 = i6 % 2; if (!this.pZ.equals("")) { u("\r\n ],\r\n"); } this.pZ = str; StringBuilder sb3 = new StringBuilder(" \""); sb3.append(str); sb3.append("s\" : [\r\n"); u(sb3.toString()); } else if (i5 == 0) { u(",\r\n"); } if (i5 == 0) { u(" {\r\n"); } else { u(",\r\n"); } i5++; String dsFieldName = appStatsDaoField.getDsFieldName(); String dsValueString = appStatsDaoField.getDsValueString(); f(new char[]{20248, 27613, 6226, 3358}, View.MeasureSpec.makeMeasureSpec(0, 0) + 4, new Object[1]); if (!(!dsValueString.equals(((String) r8[0]).intern())) || dsValueString == null) { StringBuilder sb4 = new StringBuilder(" \""); sb4.append(dsFieldName); sb4.append("\": null"); obj = sb4.toString(); } else { String replace = dsValueString.replace("\"", "\\\"").replace("'", "\\'").replace("\n", "\\\n").replace("\r", "\\\r").replace("\t", "\\\t"); StringBuilder sb5 = new StringBuilder(" \""); sb5.append(dsFieldName); sb5.append("\": \""); sb5.append(replace); sb5.append("\""); obj = sb5.toString(); } u(obj); i2++; } u("\r\n }"); } private static void f(char[] cArr, int i2, Object[] objArr) { int i3 = 2 % 2; jTb jtb = new jTb(); char[] cArr2 = new char[cArr.length]; int i4 = 0; jtb.b = 0; char[] cArr3 = new char[2]; while (true) { char c2 = 3; if (jtb.b >= cArr.length) { String str = new String(cArr2, 0, i2); int i5 = $10 + 3; $11 = i5 % 128; int i6 = i5 % 2; objArr[0] = str; return; } int i7 = $11 + 1; $10 = i7 % 128; int i8 = i7 % 2; cArr3[i4] = cArr[jtb.b]; cArr3[1] = cArr[jtb.b + 1]; int i9 = $10 + 49; $11 = i9 % 128; int i10 = i9 % 2; int i11 = 58224; int i12 = i4; while (i12 < 16) { int i13 = $10 + 41; $11 = i13 % 128; int i14 = i13 % 2; char c3 = cArr3[1]; char c4 = cArr3[i4]; int i15 = (c4 + i11) ^ ((c4 << 4) + ((char) (b ^ 41718355337583039L))); int i16 = c4 >>> 5; try { Object[] objArr2 = new Object[4]; objArr2[c2] = Integer.valueOf(c); objArr2[2] = Integer.valueOf(i16); objArr2[1] = Integer.valueOf(i15); objArr2[0] = Integer.valueOf(c3); Object obj = xzZ.y.get(597144044); if (obj == null) { Class cls = (Class) xzZ.c(View.resolveSize(0, 0) + 412, (ViewConfiguration.getScrollDefaultDelay() >> 16) + 5, (char) (1 - (ViewConfiguration.getScrollFriction() > BitmapDescriptorFactory.HUE_RED ? 1 : (ViewConfiguration.getScrollFriction() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)))); byte b2 = (byte) 1; byte b3 = (byte) (b2 - 1); Object[] objArr3 = new Object[1]; g(b2, b3, b3, objArr3); obj = cls.getMethod((String) objArr3[0], Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE); xzZ.y.put(597144044, obj); } char charValue = ((Character) ((Method) obj).invoke(null, objArr2)).charValue(); cArr3[1] = charValue; Object[] objArr4 = {Integer.valueOf(cArr3[0]), Integer.valueOf((charValue + i11) ^ ((charValue << 4) + ((char) (e ^ 41718355337583039L)))), Integer.valueOf(charValue >>> 5), Integer.valueOf(d)}; Object obj2 = xzZ.y.get(597144044); if (obj2 == null) { Class cls2 = (Class) xzZ.c(TextUtils.lastIndexOf("", '0') + 413, 5 - (PointF.length(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) > BitmapDescriptorFactory.HUE_RED ? 1 : (PointF.length(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) == BitmapDescriptorFactory.HUE_RED ? 0 : -1)), (char) View.resolveSizeAndState(0, 0, 0)); byte b4 = (byte) 1; byte b5 = (byte) (b4 - 1); Object[] objArr5 = new Object[1]; g(b4, b5, b5, objArr5); obj2 = cls2.getMethod((String) objArr5[0], Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE); xzZ.y.put(597144044, obj2); } cArr3[0] = ((Character) ((Method) obj2).invoke(null, objArr4)).charValue(); i11 -= 40503; i12++; i4 = 0; c2 = 3; } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } cArr2[jtb.b] = cArr3[0]; cArr2[jtb.b + 1] = cArr3[1]; Object[] objArr6 = {jtb, jtb}; Object obj3 = xzZ.y.get(943004485); if (obj3 == null) { Class cls3 = (Class) xzZ.c(TextUtils.indexOf((CharSequence) "", '0') + 99, 5 - Color.red(0), (char) ExpandableListView.getPackedPositionType(0L)); byte b6 = (byte) 0; byte b7 = b6; Object[] objArr7 = new Object[1]; g(b6, b7, b7, objArr7); obj3 = cls3.getMethod((String) objArr7[0], Object.class, Object.class); xzZ.y.put(943004485, obj3); } ((Method) obj3).invoke(null, objArr6); i4 = 0; } } /* JADX WARN: Code restructure failed: missing block: B:16:0x0021, code lost: r1 = new java.lang.StringBuilder(); r1.append(r5); r1.append(".json"); r5 = r1.toString(); */ /* JADX WARN: Code restructure failed: missing block: B:18:0x001f, code lost: if (r5.endsWith(".json") == false) goto L9; */ /* JADX WARN: Code restructure failed: missing block: B:4:0x0018, code lost: if (r5.endsWith(".json") == false) goto L9; */ @Override // com.kofax.kmc.kut.utilities.appstats.AppStatsDsExportHandler /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public void configDsExpFilePath(java.lang.String r5) { /* r4 = this; r0 = 2 int r1 = r0 % r0 int r1 = com.kofax.kmc.kut.utilities.appstats.AppStatsNewJsonExportHandler.i int r1 = r1 + 125 int r2 = r1 % 128 com.kofax.kmc.kut.utilities.appstats.AppStatsNewJsonExportHandler.a = r2 int r1 = r1 % r0 java.lang.String r2 = ".json" if (r1 == 0) goto L1b boolean r1 = r5.endsWith(r2) r3 = 69 int r3 = r3 / 0 if (r1 != 0) goto L30 goto L21 L1b: boolean r1 = r5.endsWith(r2) if (r1 != 0) goto L30 L21: java.lang.StringBuilder r1 = new java.lang.StringBuilder r1.() r1.append(r5) r1.append(r2) java.lang.String r5 = r1.toString() L30: java.io.File r1 = new java.io.File r1.(r5) r4.pL = r1 java.io.FileOutputStream r5 = new java.io.FileOutputStream // Catch: java.lang.Exception -> L49 java.io.File r1 = r4.pL // Catch: java.lang.Exception -> L49 r5.(r1) // Catch: java.lang.Exception -> L49 r4.pW = r5 // Catch: java.lang.Exception -> L49 java.io.OutputStreamWriter r5 = new java.io.OutputStreamWriter // Catch: java.lang.Exception -> L49 java.io.FileOutputStream r1 = r4.pW // Catch: java.lang.Exception -> L49 r5.(r1) // Catch: java.lang.Exception -> L49 r4.pX = r5 // Catch: java.lang.Exception -> L49 L49: r5 = 1 r4.pY = r5 java.lang.String r5 = "" r4.pZ = r5 int r5 = com.kofax.kmc.kut.utilities.appstats.AppStatsNewJsonExportHandler.a int r5 = r5 + 95 int r1 = r5 % 128 com.kofax.kmc.kut.utilities.appstats.AppStatsNewJsonExportHandler.i = r1 int r5 = r5 % r0 if (r5 != 0) goto L5f r5 = 24 int r5 = r5 / 0 L5f: return */ throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.kut.utilities.appstats.AppStatsNewJsonExportHandler.configDsExpFilePath(java.lang.String):void"); } @Override // com.kofax.kmc.kut.utilities.appstats.AppStatsExportListener public void exportStatusEvent(AppStatsExportEvent appStatsExportEvent) { int i2 = 2 % 2; int i3 = a + 71; i = i3 % 128; if (i3 % 2 != 0 ? appStatsExportEvent.getPercentComplete() == 100 : appStatsExportEvent.getPercentComplete() == 8) { int i4 = i + 79; a = i4 % 128; try { if (i4 % 2 != 0) { u("\r\n ]\r\n }\r\n}\r\n"); this.pX.close(); this.pW.close(); int i5 = 66 / 0; } else { u("\r\n ]\r\n }\r\n}\r\n"); this.pX.close(); this.pW.close(); } int i6 = i + 53; a = i6 % 128; int i7 = i6 % 2; } catch (Exception unused) { } appStats.removeAppStatsExportListener(this); } int i8 = a + 75; i = i8 % 128; int i9 = i8 % 2; } static void d() { e = (char) 42026; d = (char) 11150; b = (char) 61958; c = (char) 22442; } }