package if2; import android.content.Context; import android.os.Build; import android.util.Base64; import android.view.Display; import android.view.Surface; import android.view.WindowManager; import android.webkit.ValueCallback; import com.eclipsesource.mmv8.Platform; import com.eclipsesource.mmv8.V8ScriptEvaluateRequest; import com.eclipsesource.mmv8.V8ScriptFileDescriptor; import com.eclipsesource.mmv8.V8ScriptWxaFileDescriptor; import com.google.android.gms.dynamite.ProviderConstants; import com.tencent.kinda.framework.widget.tools.ConstantsKinda; import com.tencent.magicbrush.a; import com.tencent.magicbrush.biz.MBBizManager; import com.tencent.magicbrush.handler.JsTouchEventHandler; import com.tencent.magicbrush.ui.MagicBrushView; import com.tencent.mm.appbrand.commonjni.AppBrandCommonBindingJni; import com.tencent.mm.appbrand.commonjni.AppBrandJsBridgeBinding; import com.tencent.mm.appbrand.commonjni.BatchRequestWxaFileDescriptorsResponse; import com.tencent.mm.appbrand.commonjni.buffer.BufferURLManager; import com.tencent.mm.appbrand.v8.IJSRuntime; import com.tencent.mm.libwxaudio.WxAudioNative; import com.tencent.mm.plugin.magicbrush.IMBAppBrandExportFeature; import com.tencent.mm.plugin.magicbrush.MBBuildConfig; import com.tencent.mm.plugin.magicbrush.base.MBJsEventBase; import com.tencent.mm.plugin.magicbrush.f0; import com.tencent.mm.plugin.magicbrush.p0; import com.tencent.mm.plugin.magicbrush.report.IMagicBrushMonitor; import com.tencent.mm.plugin.magicbrush.v0; import com.tencent.mm.plugin.mmsight.segment.FFmpegMetadataRetriever; import com.tencent.mm.sdk.crash.CrashReportFactory; import com.tencent.mm.sdk.platformtools.BuildInfo; import com.tencent.mm.sdk.platformtools.ChannelUtil; import com.tencent.mm.sdk.platformtools.LocaleUtil; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.MMApplicationContext; import com.tencent.mm.sdk.platformtools.Util; import com.tencent.mm.sdk.platformtools.WeChatEnvironment; import com.tencent.mm.ui.x4; import com.tencent.mm.wemedia.WeMediaBinding; import com.tencent.xweb.internal.ConstValue; import com.tencent.xweb.updater.IXWebBroadcastListener; import com.tencent.youtu.sdkkitframework.common.StateEvent; import ek4.g0; import gn.i0; import ie1.h; import ih.t0; import ih.u0; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import org.json.JSONException; import org.json.JSONObject; import ug2.t; import xg4.q0; import xg4.r0; public class a extends df2.q implements gf2.d, mh.a, a.d { public static final wg4.g<Integer> M = wg4.h.a(C3142a.f232744d); public final String A; public final wg4.g B; public final wg4.g C; public int D; public final wg4.g E; public final wg4.g F; public boolean G; public final wg4.g H; public final wg4.g I; public final Map<String, df2.m<df2.q>> J; public final wg4.g K; public final String L; /* renamed from: d reason: collision with root package name */ public final Context f232724d; /* renamed from: e reason: collision with root package name */ public final String f232725e; /* renamed from: f reason: collision with root package name */ public final MBBizManager f232726f; /* renamed from: g reason: collision with root package name */ public final gf2.a f232727g; /* renamed from: h reason: collision with root package name */ public final ef2.c f232728h; /* renamed from: i reason: collision with root package name */ public MBBuildConfig<?> f232729i; /* renamed from: j reason: collision with root package name */ public bf2.f f232730j; /* renamed from: n reason: collision with root package name */ public final wg4.g f232731n = wg4.h.a(new l(this)); /* renamed from: o reason: collision with root package name */ public kf2.a f232732o; /* renamed from: p reason: collision with root package name */ public bf2.p f232733p; /* renamed from: q reason: collision with root package name */ public AppBrandJsBridgeBinding f232734q; /* renamed from: r reason: collision with root package name */ public com.tencent.magicbrush.a f232735r; /* renamed from: s reason: collision with root package name */ public final HashMap<Integer, ff2.a> f232736s = new HashMap<>(); /* renamed from: t reason: collision with root package name */ public final AppBrandCommonBindingJni f232737t = new AppBrandCommonBindingJni(this); /* renamed from: u reason: collision with root package name */ public final wg4.g f232738u = wg4.h.a(e.f232750d); /* renamed from: v reason: collision with root package name */ public WxAudioNative f232739v; /* renamed from: w reason: collision with root package name */ public WeMediaBinding f232740w; /* renamed from: x reason: collision with root package name */ public final JsTouchEventHandler f232741x = new JsTouchEventHandler(); /* renamed from: y reason: collision with root package name */ public List<? extends df2.p> f232742y; /* renamed from: z reason: collision with root package name */ public kh4.l<? super List<? extends df2.p>, wg4.b0> f232743z; /* renamed from: if2.a$a reason: collision with other inner class name */ public static final class C3142a extends lh4.o implements kh4.a<Integer> { /* renamed from: d reason: collision with root package name */ public static final C3142a f232744d = new C3142a(); public C3142a() { super(0); } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public Integer invoke() { int i15 = 60; try { Object systemService = MMApplicationContext.getContext().getSystemService("window"); WindowManager windowManager = systemService instanceof WindowManager ? (WindowManager) systemService : null; if (windowManager != null) { Display.Mode[] supportedModes = windowManager.getDefaultDisplay().getSupportedModes(); lh4.m.f(supportedModes, "manager.defaultDisplay.supportedModes"); for (Display.Mode mode : supportedModes) { int b15 = nh4.c.b(mode.getRefreshRate()); if (b15 > i15 && b15 <= 144) { i15 = b15; } } } } catch (Exception e15) { Log.printErrStackTrace("MBServerUtil", e15, "getRefreshRate error", new Object[0]); } Log.i("MBServerUtil", "findMaxRefreshRate " + i15); return Integer.valueOf(i15); } } public static final class a0<T> implements ValueCallback { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ a f232745a; public a0(a aVar) { this.f232745a = aVar; } @Override // android.webkit.ValueCallback public void onReceiveValue(Object obj) { String str = (String) obj; this.f232745a.onCreated(); } } public static final class b { public b(lh4.h hVar) { } } public /* synthetic */ class b0 extends lh4.l implements kh4.q<String, String, String, wg4.b0> { public b0(Object obj) { super(3, obj, a.class, "onJsException", "onJsException(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", 0); } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object, java.lang.Object] */ @Override // kh4.q public wg4.b0 invoke(String str, String str2, String str3) { String str4 = str; String str5 = str2; String str6 = str3; lh4.m.g(str4, "p0"); lh4.m.g(str5, "p1"); lh4.m.g(str6, "p2"); ((a) this.receiver).R(str4, str5, str6); return wg4.b0.f332794a; } } public static final class c extends lh4.o implements kh4.a<String[]> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232746d; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public c(a aVar) { super(0); this.f232746d = aVar; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public String[] invoke() { bf2.f fVar = this.f232746d.f232730j; if (fVar != null) { Collection<String> f15 = fVar.f(); MBBuildConfig<?> mBBuildConfig = this.f232746d.f232729i; if (mBBuildConfig != null) { HashSet<wg4.l<String, Boolean>> hashSet = mBBuildConfig.f132139d; ArrayList arrayList = new ArrayList(); for (T t15 : hashSet) { if (!t15.f332808e.booleanValue()) { arrayList.add(t15); } } ArrayList arrayList2 = new ArrayList(xg4.v.m(arrayList, 10)); Iterator it = arrayList.iterator(); while (it.hasNext()) { arrayList2.add(((wg4.l) it.next()).f332807d); } List i05 = xg4.c0.i0(f15, arrayList2); Map<String, df2.m<df2.q>> map = this.f232746d.J; LinkedHashMap linkedHashMap = new LinkedHashMap(); for (Map.Entry entry : ((LinkedHashMap) map).entrySet()) { if (!((df2.m) entry.getValue()).e()) { linkedHashMap.put(entry.getKey(), entry.getValue()); } } ArrayList arrayList3 = new ArrayList(linkedHashMap.size()); for (Map.Entry entry2 : linkedHashMap.entrySet()) { arrayList3.add((String) entry2.getKey()); } return (String[]) ((ArrayList) xg4.c0.i0(i05, arrayList3)).toArray(new String[0]); } lh4.m.p("config"); throw null; } lh4.m.p("mbAdaptor"); throw null; } } public static final class c0 extends lh4.o implements kh4.l<List<? extends df2.p>, wg4.b0> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232747d; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public c0(a aVar) { super(1); this.f232747d = aVar; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kh4.l public wg4.b0 invoke(List<? extends df2.p> list) { List<? extends df2.p> list2 = list; lh4.m.g(list2, "descriptors"); String str = this.f232747d.L; StringBuilder sb5 = new StringBuilder(); sb5.append("mainScriptProvided with descriptors: "); ArrayList arrayList = new ArrayList(xg4.v.m(list2, 10)); Iterator<T> it = list2.iterator(); while (it.hasNext()) { arrayList.add(it.next().toString()); } sb5.append(arrayList); Log.i(str, sb5.toString()); if (!((Boolean) ((wg4.n) this.f232747d.B).getValue()).booleanValue()) { ef2.a aVar = (ef2.a) ((wg4.n) this.f232747d.f232731n).getValue(); a aVar2 = this.f232747d; String str2 = aVar2.L; StringBuilder sb6 = new StringBuilder(); sb6.append("not parallel mode. manually trigger load config "); MBBuildConfig<?> mBBuildConfig = aVar2.f232729i; if (mBBuildConfig != null) { sb6.append(mBBuildConfig.f132141f); Log.i(str2, sb6.toString()); } else { lh4.m.p("config"); throw null; } } a aVar3 = this.f232747d; aVar3.e0().C(new p(aVar3)); aVar3.e0().t(-8); aVar3.e0().resume(); this.f232747d.e0().post(new r(this.f232747d, list2)); return wg4.b0.f332794a; } } public static final class d extends lh4.o implements kh4.a<Map<String, ? extends String>> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232748d; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public d(a aVar) { super(0); this.f232748d = aVar; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public Map<String, ? extends String> invoke() { LinkedList<String> PT = ((p0) yz3.j.c(p0.class)).PT(this.f232748d.A, "magicbrush"); int a15 = q0.a(xg4.v.m(PT, 10)); if (a15 < 16) { a15 = 16; } LinkedHashMap linkedHashMap = new LinkedHashMap(a15); for (T t15 : PT) { linkedHashMap.put(t15, t15); } return linkedHashMap; } } public static final class d0 extends lh4.o implements kh4.a<String> { /* renamed from: d reason: collision with root package name */ public static final d0 f232749d = new d0(); public d0() { super(0); } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public String invoke() { return ((i0) yz3.j.c(i0.class)).jt0(); } } public static final class e extends lh4.o implements kh4.a<BufferURLManager> { /* renamed from: d reason: collision with root package name */ public static final e f232750d = new e(); public e() { super(0); } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public BufferURLManager invoke() { return new BufferURLManager(); } } public static final class f extends lh4.o implements kh4.a<j> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232751d; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public f(a aVar) { super(0); this.f232751d = aVar; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public j invoke() { return new j(this.f232751d); } } public static final class g extends lh4.o implements kh4.a<wg4.b0> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232752d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ int f232753e; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public g(a aVar, int i15) { super(0); this.f232752d = aVar; this.f232753e = i15; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public wg4.b0 invoke() { a aVar = this.f232752d; aVar.G = true; aVar.EM0(this.f232753e); return wg4.b0.f332794a; } } public static final class h extends lh4.o implements kh4.a<Boolean> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232754d; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public h(a aVar) { super(0); this.f232754d = aVar; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public Boolean invoke() { boolean z15; if (BuildInfo.ext.getBoolean("ENABLE_DEVTOOLS")) { MBBuildConfig<?> mBBuildConfig = this.f232754d.f232729i; if (mBBuildConfig == null) { lh4.m.p("config"); throw null; } else if (mBBuildConfig.f132143h) { z15 = true; return Boolean.valueOf(z15); } } z15 = false; return Boolean.valueOf(z15); } } public static final class i<T> implements ValueCallback { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ a f232755a; /* renamed from: b reason: collision with root package name */ public final /* synthetic */ int f232756b; public i(a aVar, int i15) { this.f232755a = aVar; this.f232756b = i15; } @Override // android.webkit.ValueCallback public void onReceiveValue(Object obj) { String str = (String) obj; gf2.a aVar = this.f232755a.f232727g; int i15 = this.f232756b; lh4.m.f(str, "res"); aVar.d(i15, str); } } public static final class j extends lh4.o implements kh4.a<Boolean> { /* renamed from: d reason: collision with root package name */ public static final j f232757d = new j(); public j() { super(0); } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public Boolean invoke() { return Boolean.valueOf(ug2.t.f318038a.a(t.b.f318042d)); } } public static final class k extends lh4.o implements kh4.a<Boolean> { /* renamed from: d reason: collision with root package name */ public static final k f232758d = new k(); public k() { super(0); } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public Boolean invoke() { return Boolean.valueOf(ug2.t.f318038a.a(t.c.f318043d)); } } public static final class l extends lh4.o implements kh4.a<ef2.a> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232759d; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public l(a aVar) { super(0); this.f232759d = aVar; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public ef2.a invoke() { ef2.a aVar; Iterator<String> keys; Iterator<String> keys2; bf2.p pVar = this.f232759d.f232733p; T t15 = null; if (pVar != null) { gx0.m<ByteBuffer> mVar = new gx0.m<>(); com.tencent.mm.plugin.appbrand.appstorage.b0 readFile = pVar.b().readFile("magicbrush.json", mVar); lh4.m.f(readFile, "pkgManagement.provideFil…).readFile(path, pointer)"); if (readFile == com.tencent.mm.plugin.appbrand.appstorage.b0.OK) { t15 = mVar.f222594a; } if (t15 != null) { String charBuffer = StandardCharsets.UTF_8.decode(t15).toString(); lh4.m.f(charBuffer, "UTF_8.decode(buffer).toString()"); ef2.a aVar2 = ef2.a.f207164c; HashMap hashMap = new HashMap(); HashMap hashMap2 = new HashMap(); try { JSONObject jSONObject = new JSONObject(charBuffer); JSONObject optJSONObject = jSONObject.optJSONObject("plugins"); if (!(optJSONObject == null || (keys2 = optJSONObject.keys()) == null)) { for (keys2 = optJSONObject.keys(); keys2.hasNext(); keys2 = keys2) { String next = keys2.next(); JSONObject jSONObject2 = optJSONObject.getJSONObject(next); lh4.m.f(next, "pluginName"); lh4.m.f(jSONObject2, "pluginInfo"); String string = jSONObject2.getString(ProviderConstants.API_COLNAME_FEATURE_VERSION); lh4.m.f(string, "obj.getString(\"version\")"); String string2 = jSONObject2.getString("provider"); lh4.m.f(string2, "obj.getString(\"provider\")"); hashMap.put(next, new ef2.b(string, ek4.y.q(string2, "wx2f3fb5db9f226462", "MagicSclPublicService", false))); optJSONObject = optJSONObject; } } JSONObject optJSONObject2 = jSONObject.optJSONObject("publicservices"); if (!(optJSONObject2 == null || (keys = optJSONObject2.keys()) == null)) { while (keys.hasNext()) { String next2 = keys.next(); JSONObject jSONObject3 = optJSONObject2.getJSONObject(next2); lh4.m.f(next2, "publicServiceName"); lh4.m.f(jSONObject3, "publicServiceInfo"); String string3 = jSONObject3.getString(ProviderConstants.API_COLNAME_FEATURE_VERSION); lh4.m.f(string3, "obj.getString(\"version\")"); String string4 = jSONObject3.getString("provider"); lh4.m.f(string4, "obj.getString(\"provider\")"); hashMap2.put(next2, new ef2.b(string3, ek4.y.q(string4, "wx2f3fb5db9f226462", "MagicSclPublicService", false))); optJSONObject2 = optJSONObject2; } } aVar = new ef2.a(hashMap, hashMap2); } catch (JSONException unused) { Log.i("MBBizConfigInfo", "generate biz config failed, src = " + charBuffer); aVar = ef2.a.f207164c; } if (aVar != null) { return aVar; } } ef2.a aVar3 = ef2.a.f207164c; String str = this.f232759d.L; Log.i(str, "Read MB config = " + aVar3); return aVar3; } lh4.m.p("pkgManagement"); throw null; } } public static final class m extends lh4.o implements kh4.l<df2.k, wg4.b0> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232760d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ int f232761e; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public m(a aVar, int i15) { super(1); this.f232760d = aVar; this.f232761e = i15; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kh4.l public wg4.b0 invoke(df2.k kVar) { df2.k kVar2 = kVar; lh4.m.g(kVar2, "res"); AppBrandJsBridgeBinding appBrandJsBridgeBinding = this.f232760d.f232734q; if (appBrandJsBridgeBinding != null) { appBrandJsBridgeBinding.invokeCallbackHandler(this.f232761e, kVar2.a()); return wg4.b0.f332794a; } lh4.m.p("jsBridge"); throw null; } } public static final class n implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ Exception f232762d; public n(Exception exc) { this.f232762d = exc; } public final void run() { throw this.f232762d; } } public static final class o<T> implements ValueCallback { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ a f232763a; public o(a aVar) { this.f232763a = aVar; } @Override // android.webkit.ValueCallback public void onReceiveValue(Object obj) { wg4.l lVar = (wg4.l) obj; a aVar = this.f232763a; A a15 = lVar.f332807d; lh4.m.f(a15, "it.first"); B b15 = lVar.f332808e; lh4.m.f(b15, "it.second"); aVar.R(a15, b15, "JSBridge"); } } public static final class p implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ kh4.l<ByteBuffer, wg4.b0> f232764d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ a f232765e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ String f232766f; /* JADX DEBUG: Multi-variable search result rejected for r1v0, resolved type: kh4.l<? super java.nio.ByteBuffer, wg4.b0> */ /* JADX WARN: Multi-variable type inference failed */ public p(kh4.l<? super ByteBuffer, wg4.b0> lVar, a aVar, String str) { this.f232764d = lVar; this.f232765e = aVar; this.f232766f = str; } public final void run() { kh4.l<ByteBuffer, wg4.b0> lVar = this.f232764d; bf2.p pVar = this.f232765e.f232733p; T t15 = null; if (pVar != null) { String str = this.f232766f; lh4.m.g(str, ConstantsKinda.INTENT_LITEAPP_PATH); gx0.m<ByteBuffer> mVar = new gx0.m<>(); com.tencent.mm.plugin.appbrand.appstorage.b0 readFile = pVar.b().readFile(str, mVar); lh4.m.f(readFile, "pkgManagement.provideFil…).readFile(path, pointer)"); if (readFile == com.tencent.mm.plugin.appbrand.appstorage.b0.OK) { t15 = mVar.f222594a; } lVar.invoke(t15); return; } lh4.m.p("pkgManagement"); throw null; } } public static final class q implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232767d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ String f232768e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ String f232769f; public q(a aVar, String str, String str2) { this.f232767d = aVar; this.f232768e = str; this.f232769f = str2; } public final void run() { this.f232767d.f232726f.g(this.f232768e, this.f232769f); } } public static final class r implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232770d; public r(a aVar) { this.f232770d = aVar; } public final void run() { this.f232770d.f232737t.notifyPause(); } } public static final class s implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232771d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ int f232772e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ int f232773f; /* renamed from: g reason: collision with root package name */ public final /* synthetic */ long f232774g; /* renamed from: h reason: collision with root package name */ public final /* synthetic */ List<JsTouchEventHandler.b> f232775h; /* renamed from: i reason: collision with root package name */ public final /* synthetic */ int f232776i; /* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: java.util.List<? extends com.tencent.magicbrush.handler.JsTouchEventHandler$b> */ /* JADX WARN: Multi-variable type inference failed */ public s(a aVar, int i15, int i16, long j15, List<? extends JsTouchEventHandler.b> list, int i17) { this.f232771d = aVar; this.f232772e = i15; this.f232773f = i16; this.f232774g = j15; this.f232775h = list; this.f232776i = i17; } public final void run() { wg4.b0 b0Var; a aVar = this.f232771d; com.tencent.magicbrush.a aVar2 = aVar.f232735r; if (aVar2 != null) { aVar2.f(this.f232776i, aVar.f232741x.c(this.f232772e, this.f232773f, this.f232774g, this.f232775h, aVar2.f56065b.device_pixel_ratio_), aVar.f232741x.f56122c); b0Var = wg4.b0.f332794a; } else { b0Var = null; } if (b0Var == null) { Log.e(this.f232771d.L, "post canvas touch event without magicbrush??"); } } } public static final class t implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232777d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ int f232778e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ Surface f232779f; /* renamed from: g reason: collision with root package name */ public final /* synthetic */ int f232780g; /* renamed from: h reason: collision with root package name */ public final /* synthetic */ int f232781h; public t(a aVar, int i15, Surface surface, int i16, int i17) { this.f232777d = aVar; this.f232778e = i15; this.f232779f = surface; this.f232780g = i16; this.f232781h = i17; } public final void run() { ff2.a aVar = this.f232777d.f232736s.get(Integer.valueOf(this.f232778e)); if (aVar != null) { Surface surface = this.f232779f; int i15 = this.f232780g; int i16 = this.f232781h; lh4.m.g(surface, "surface"); aVar.f214352e = surface; MagicBrushView.c cVar = aVar.f214351d; if (cVar != null) { MagicBrushView.c.a.a(cVar, surface, i15, i16, false, false, 16, null); } } } } public static final class u implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232782d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ int f232783e; public u(a aVar, int i15) { this.f232782d = aVar; this.f232783e = i15; } public final void run() { ff2.a aVar = this.f232782d.f232736s.get(Integer.valueOf(this.f232783e)); if (aVar != null) { Surface surface = aVar.f214352e; if (surface == null) { Log.w("MicroMsg.MBRendererView", "destroyService: try to destroy an empty surface"); return; } aVar.f214352e = null; MagicBrushView.c cVar = aVar.f214351d; if (cVar != null) { cVar.e(surface, false); } } } } public static final class v implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232784d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ int f232785e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ int f232786f; /* renamed from: g reason: collision with root package name */ public final /* synthetic */ int f232787g; public v(a aVar, int i15, int i16, int i17) { this.f232784d = aVar; this.f232785e = i15; this.f232786f = i16; this.f232787g = i17; } public final void run() { ff2.a aVar = this.f232784d.f232736s.get(Integer.valueOf(this.f232785e)); if (aVar != null) { int i15 = this.f232786f; int i16 = this.f232787g; Surface surface = aVar.f214352e; if (surface == null) { Log.w("MicroMsg.MBRendererView", "updateSurfaceSize: surface is empty"); return; } MagicBrushView.c cVar = aVar.f214351d; if (cVar != null) { cVar.b(surface, i15, i16); } } } } public static final class w implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232788d; public w(a aVar) { this.f232788d = aVar; } public final void run() { this.f232788d.f232737t.notifyResume(); } } public static final class x implements Runnable { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ kh4.a f232789d; public x(kh4.a aVar) { this.f232789d = aVar; } public final /* synthetic */ void run() { this.f232789d.invoke(); } } public static final class y extends lh4.o implements kh4.a<wg4.b0> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232790d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ boolean f232791e; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public y(a aVar, boolean z15) { super(0); this.f232790d = aVar; this.f232791e = z15; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kh4.a public wg4.b0 invoke() { WxAudioNative wxAudioNative = this.f232790d.f232739v; if (wxAudioNative != null) { wxAudioNative.setMute(this.f232791e); } return wg4.b0.f332794a; } } public static final class z extends lh4.o implements kh4.l<List<? extends df2.p>, wg4.b0> { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ a f232792d; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public z(a aVar) { super(1); this.f232792d = aVar; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kh4.l public wg4.b0 invoke(List<? extends df2.p> list) { List<? extends df2.p> list2 = list; lh4.m.g(list2, "mainScripts"); Log.i(this.f232792d.L, "hy: on main scripts provided from parallel setup!"); ef2.a aVar = (ef2.a) ((wg4.n) this.f232792d.f232731n).getValue(); a aVar2 = this.f232792d; if (((Boolean) ((wg4.n) aVar2.C).getValue()).booleanValue()) { for (T t15 : aVar.f207166b.keySet()) { String str = aVar2.L; Log.i(str, "hy: preloading public service " + ((String) t15)); MBBizManager mBBizManager = aVar2.f232726f; mBBizManager.getClass(); lh4.m.g(t15, "serviceName"); mBBizManager.f56113a.S(t15, mBBizManager.f56114b, true); } } else { Log.i(aVar2.L, "hy: not preload public service, just load"); } a aVar3 = this.f232792d; synchronized (aVar3) { kh4.l<? super List<? extends df2.p>, wg4.b0> lVar = aVar3.f232743z; if (lVar != null) { lVar.invoke(list2); } else { aVar3.f232742y = list2; } } return wg4.b0.f332794a; } } static { new b(null); ((i0) yz3.j.c(i0.class)).f20(); long currentTicks = Util.currentTicks(); Log.i("MBServerUtil", "start load so"); be.b.c(new ug2.n()); be.b.a(); be.b.b("wxa-runtime-binding"); be.b.b("gamelog_delegate"); Log.i("MBServerUtil", "load so done"); IMagicBrushMonitor.a.d(lg2.c.f253114e, "", "magicbrush", IMagicBrushMonitor.TimeCostScene.LOAD_SO, Util.ticksToNow(currentTicks), null, 0.01f, 16, null); ug2.l lVar = new ug2.l(); be.h.f11996a = lVar; r6.b.f293185a = new be.g(lVar); } public a(Context context, String str, MBBizManager mBBizManager, gf2.a aVar) { lh4.m.g(context, "context"); lh4.m.g(str, "instanceName"); lh4.m.g(mBBizManager, "bizManager"); lh4.m.g(aVar, "client"); this.f232724d = context; this.f232725e = str; this.f232726f = mBBizManager; this.f232727g = aVar; this.f232728h = new ef2.c(str); String j05 = ek4.d0.j0(str, "-", str); this.A = j05; this.B = wg4.h.a(j.f232757d); this.C = wg4.h.a(k.f232758d); this.D = 1; this.E = wg4.h.a(new f(this)); this.F = wg4.h.a(new h(this)); this.H = wg4.h.a(d0.f232749d); this.I = wg4.h.a(new d(this)); List<df2.m<df2.q>> xx02 = ((f0) yz3.j.c(f0.class)).xx0(j05); int a15 = q0.a(xg4.v.m(xx02, 10)); LinkedHashMap linkedHashMap = new LinkedHashMap(a15 < 16 ? 16 : a15); for (T t15 : xx02) { linkedHashMap.put(t15.d(), t15); } this.J = linkedHashMap; this.K = wg4.h.a(new c(this)); StringBuilder sb5 = new StringBuilder(); sb5.append("MBBizServer_"); String str2 = this.f232725e; lh4.m.g(str2, "instanceName"); String g05 = ek4.d0.g0(str2, "-", ""); sb5.append(ek4.d0.j0(str2, "-", str2) + g0.t0(g05, 5)); this.L = sb5.toString(); } @Override // mh.a public void A(int i15, String str) { lh4.m.g(str, "value"); try { ww2.d.INSTANCE.kvStat(i15, str); } catch (Exception unused) { } } @Override // mh.a public String C(String str, String str2, String str3, int i15, boolean z15) { T t15; lh4.m.g(str, ProviderConstants.API_PATH); lh4.m.g(str2, "data"); lh4.m.g(str3, "privateData"); if (this.D == 1) { Log.e(this.L, "invoke jsapi " + str + " after destroy with data: " + str2); AppBrandJsBridgeBinding appBrandJsBridgeBinding = this.f232734q; if (appBrandJsBridgeBinding != null) { appBrandJsBridgeBinding.invokeCallbackHandler(i15, "{\"errMsg\":\"Not handled\", \"errCode\": -1}"); return ""; } lh4.m.p("jsBridge"); throw null; } Map map = (Map) ((wg4.n) this.I).getValue(); if (map == null || ((String) map.get(str)) == null) { try { df2.m mVar = (df2.m) ((LinkedHashMap) this.J).get(str); if (mVar == null) { MBBuildConfig<?> mBBuildConfig = this.f232729i; if (mBBuildConfig != null) { Iterator<T> it = mBBuildConfig.f132139d.iterator(); while (true) { if (!it.hasNext()) { t15 = null; break; } t15 = it.next(); if (lh4.m.b(t15.f332807d, str)) { break; } } T t16 = t15; if (t16 == null) { bf2.f fVar = this.f232730j; if (fVar != null) { return fVar.g(str, str2, str3, i15); } lh4.m.p("mbAdaptor"); throw null; } else if (t16.f332808e.booleanValue()) { AppBrandJsBridgeBinding appBrandJsBridgeBinding2 = this.f232734q; if (appBrandJsBridgeBinding2 != null) { appBrandJsBridgeBinding2.invokeCallbackHandler(i15, this.f232727g.v(str, str2, str3)); return ""; } lh4.m.p("jsBridge"); throw null; } else { this.f232727g.q(str, str2, str3, i15); return ""; } } else { lh4.m.p("config"); throw null; } } else if (mVar instanceof df2.l) { df2.l o15 = ((df2.l) mVar).o(); o15.f200265a = this; o15.m(this.f232728h); o15.f200264d = new m(this, i15); o15.q(new df2.k(str2)); return ""; } else if (mVar instanceof df2.n) { mVar.f200265a = this; mVar.m(this.f232728h); String a15 = ((df2.n) mVar).o(new df2.k(str2)).a(); mVar.f200265a = null; AppBrandJsBridgeBinding appBrandJsBridgeBinding3 = this.f232734q; if (appBrandJsBridgeBinding3 != null) { appBrandJsBridgeBinding3.invokeCallbackHandler(i15, a15); return ""; } lh4.m.p("jsBridge"); throw null; } else { throw new IllegalAccessError("Illegal jsapi"); } } catch (Exception e15) { Log.printErrStackTrace(this.L, e15, "Catch jsapi exception " + str + ", data = " + str2, new Object[0]); ((xc4.j) xc4.j.f338034d).z(new n(e15)); return "{\"errMsg\":\"jsapi exception\", \"errCode\": -4}"; } } else { Log.e(this.L, "invoke jsapi " + str + " have not permission"); AppBrandJsBridgeBinding appBrandJsBridgeBinding4 = this.f232734q; if (appBrandJsBridgeBinding4 != null) { appBrandJsBridgeBinding4.invokeCallbackHandler(i15, "{\"errMsg\":\"no permission\", \"errCode\": -5}"); return ""; } lh4.m.p("jsBridge"); throw null; } } @Override // gf2.d public void D(int i15, int i16, int i17, long j15, List<? extends JsTouchEventHandler.b> list) { lh4.m.g(list, "touches"); e0().post(new s(this, i16, i17, j15, list, i15)); } public void EM0(int i15) { String str = this.L; Log.i(str, "onDestroy, reason " + i15); this.D = 1; if (i0(i15)) { this.f232727g.onDestroy(); } bf2.p pVar = this.f232733p; if (pVar != null) { pVar.release(); this.f232726f.c(); AppBrandJsBridgeBinding appBrandJsBridgeBinding = this.f232734q; if (appBrandJsBridgeBinding != null) { appBrandJsBridgeBinding.destroyRuntime(); ((BufferURLManager) ((wg4.n) this.f232738u).getValue()).b(); com.tencent.magicbrush.a aVar = this.f232735r; if (aVar != null) { aVar.p(); } this.f232737t.notifyDestroy(); WxAudioNative wxAudioNative = this.f232739v; if (wxAudioNative != null) { wxAudioNative.destroyWebAudioContext(); } WeMediaBinding weMediaBinding = this.f232740w; if (weMediaBinding != null) { weMediaBinding.uint(); } v0 v0Var = v0.f132388a; String str2 = this.f232725e; lh4.m.g(str2, "instanceName"); Set<String> set = v0.f132392e; synchronized (set) { set.remove(str2); v0.f132391d = v0Var.a(set); wg4.b0 b0Var = wg4.b0.f332794a; } return; } lh4.m.p("jsBridge"); throw null; } lh4.m.p("pkgManagement"); throw null; } @Override // mh.a public void F(int i15, int i16, int i17) { try { ww2.d.INSTANCE.p((long) i15, (long) i16, (long) i17); } catch (Exception unused) { } } @Override // gf2.d public void H(String str, String str2) { lh4.m.g(str, "event"); lh4.m.g(str2, "data"); if (this.D < 2) { String str3 = this.L; Log.e(str3, "event " + str + " discard, data = " + g0.s0(str2, 100)); return; } AppBrandJsBridgeBinding appBrandJsBridgeBinding = this.f232734q; if (appBrandJsBridgeBinding != null) { appBrandJsBridgeBinding.subscribeHandler(str, str2, 0, "{\"nativeTime\": " + System.currentTimeMillis() + '}'); return; } lh4.m.p("jsBridge"); throw null; } @Override // mh.a public ByteBuffer I(String str) { lh4.m.g(str, ConstantsKinda.INTENT_LITEAPP_PATH); return null; } @Override // gf2.d public ef2.a J() { return (ef2.a) ((wg4.n) this.f232731n).getValue(); } @Override // gf2.d public void K(int i15) { String str = this.L; Log.i(str, "destroy with " + i15 + " localStatus:" + this.D); W(); if (d0()) { ((u0) yz3.j.c(u0.class)).vC0((t0) ((wg4.n) this.E).getValue()); } if (this.D >= 2) { e0().J(new g(this, i15)); e0().destroy(); } } @Override // com.tencent.magicbrush.a.d public void L(MagicBrushView magicBrushView, float[] fArr, float[] fArr2, float[] fArr3, float[] fArr4) { lh4.m.g(magicBrushView, "view"); lh4.m.g(fArr, "left"); lh4.m.g(fArr2, "top"); lh4.m.g(fArr3, "width"); lh4.m.g(fArr4, "height"); String str = this.L; Log.i(str, "onSetTouchableRectList: count = " + fArr.length); this.f232727g.o(magicBrushView.getVirtualElementId(), fArr, fArr2, fArr3, fArr4); } @Override // gf2.d public void M(String str, String str2, kh4.l<? super ByteBuffer, wg4.b0> lVar) { lh4.m.g(str, "serviceName"); lh4.m.g(str2, ConstantsKinda.INTENT_LITEAPP_PATH); lh4.m.g(lVar, "cb"); ((xc4.j) xc4.j.f338034d).o(new p(lVar, this, str2)); } @Override // com.tencent.magicbrush.a.d public void O(MagicBrushView magicBrushView, int i15, int i16, int i17, int i18, int i19) { lh4.m.g(magicBrushView, "view"); this.f232727g.t(magicBrushView.getVirtualElementId(), i15, i16, i17, i18, i19); } @Override // gf2.d public void Q() { if (!ug2.q.a(this.D, 4)) { e0().post(new r(this)); e0().t(10); e0().pause(); e0().C(new o(this)); this.D = 8; } } @Override // gf2.d public void R(String str, String str2, String str3) { boolean z15; String str4; lh4.m.g(str, "msg"); lh4.m.g(str2, "stack"); lh4.m.g(str3, "source"); Log.e(this.L, str3 + ": " + str + '\n' + str2); if (str2.length() == 0) { z15 = true; } else { z15 = false; } if (z15) { str4 = str; } else { str4 = str2; } if (!this.G || !ek4.d0.x(str4, "illegal access", false)) { JSONObject jSONObject = new JSONObject(); jSONObject.put("source", str3); jSONObject.put(StateEvent.Name.MESSAGE, str); jSONObject.put("stack", str2); String jSONObject2 = jSONObject.toString(); lh4.m.f(jSONObject2, "JSONObject().apply {\n …ack)\n }.toString()"); H("onJsError", jSONObject2); this.f232727g.f("", str4); lg2.c.f253114e.F90(this.A, "js-exception", str4, str3, 1.0f); } } @Override // gf2.d public String S() { MBBuildConfig<?> mBBuildConfig = this.f232729i; if (mBBuildConfig != null) { return mBBuildConfig.f132142g; } lh4.m.p("config"); throw null; } @Override // mh.a public String T(String str) { boolean z15; if (str == null || str.length() == 0) { z15 = true; } else { z15 = false; } if (z15) { return null; } bf2.p pVar = this.f232733p; if (pVar != null) { return pVar.a(str); } lh4.m.p("pkgManagement"); throw null; } @Override // com.tencent.magicbrush.a.d public void U(MagicBrushView magicBrushView, int i15, int i16, int i17, int i18, int i19) { lh4.m.g(magicBrushView, "view"); this.f232727g.s(magicBrushView.getVirtualElementId(), i15, i16, i17, i18, i19); } @Override // gf2.d public void V() { wg4.b0 b0Var; Log.i(this.L, IXWebBroadcastListener.STAGE_START); c0 c0Var = new c0(this); if (((Boolean) ((wg4.n) this.B).getValue()).booleanValue()) { synchronized (this) { List<? extends df2.p> list = this.f232742y; if (list != null) { c0Var.invoke(list); b0Var = wg4.b0.f332794a; } else { b0Var = null; } if (b0Var == null) { Log.i(this.L, "hy: parallel reading not ready. pending wait"); this.f232743z = c0Var; } this.f232742y = null; } return; } bf2.p pVar = this.f232733p; if (pVar != null) { pVar.c(c0Var); } else { lh4.m.p("pkgManagement"); throw null; } } @Override // gf2.d public void W() { if (!ug2.q.a(this.D, 8)) { e0().C(new p(this)); e0().t(-8); e0().resume(); e0().post(new w(this)); this.D = 4; } } @Override // com.tencent.magicbrush.a.d public void X(MagicBrushView magicBrushView) { lh4.m.g(magicBrushView, "view"); ff2.a remove = this.f232736s.remove(Integer.valueOf(magicBrushView.getVirtualElementId())); if (remove != null) { Log.i("MicroMsg.MBRendererView", "destroy"); Surface surface = remove.f214352e; if (surface == null) { Log.w("MicroMsg.MBRendererView", "destroyService: try to destroy an empty surface"); } else { remove.f214352e = null; MagicBrushView.c cVar = remove.f214351d; if (cVar != null) { cVar.e(surface, false); } } remove.f214351d = null; } this.f232727g.p(magicBrushView.getVirtualElementId()); } @Override // gf2.d public void Y(df2.p pVar) { lh4.m.g(pVar, "descriptor"); e0().Q(xg4.u.c(f0(pVar)), (String) ((wg4.n) this.H).getValue(), null); } @Override // mh.a public void a() { e0().a(); } @Override // df2.q public void a0(MBJsEventBase mBJsEventBase) { lh4.m.g(mBJsEventBase, "event"); H(mBJsEventBase.f132198d, mBJsEventBase.f132199e); } @Override // mh.a public void b(String str) { lh4.m.g(str, "msg"); if (d0()) { ((u0) yz3.j.c(u0.class)).H50((t0) ((wg4.n) this.E).getValue(), str); } } @Override // df2.q public void b0(String str, ValueCallback<String> valueCallback) { lh4.m.g(str, "script"); if (this.D < 2) { String str2 = this.L; Log.e(str2, "evaluate discard, script is " + g0.s0(str, 100)); return; } e0().evaluateJavascript(str, valueCallback); } @Override // gf2.d public void c(int i15) { e0().post(new u(this, i15)); } @Override // df2.q public int c0() { return this.D; } @Override // mh.a public boolean d() { return e0().d(); } public final boolean d0() { return ((Boolean) ((wg4.n) this.F).getValue()).booleanValue(); } @Override // gf2.d public void e(int i15, int i16, int i17) { e0().post(new v(this, i15, i16, i17)); } public final kf2.a e0() { kf2.a aVar = this.f232732o; if (aVar != null) { return aVar; } lh4.m.p("jsRuntime"); throw null; } public final V8ScriptEvaluateRequest f0(df2.p pVar) { String str; if (pVar instanceof df2.s) { V8ScriptEvaluateRequest v8ScriptEvaluateRequest = new V8ScriptEvaluateRequest(); v8ScriptEvaluateRequest.scriptType = 3; v8ScriptEvaluateRequest.scriptText = ((df2.s) pVar).f200270a; return v8ScriptEvaluateRequest; } boolean z15 = true; if (pVar instanceof df2.d) { V8ScriptEvaluateRequest v8ScriptEvaluateRequest2 = new V8ScriptEvaluateRequest(); v8ScriptEvaluateRequest2.scriptType = 1; V8ScriptFileDescriptor v8ScriptFileDescriptor = new V8ScriptFileDescriptor(); v8ScriptEvaluateRequest2.scriptFd = v8ScriptFileDescriptor; df2.d dVar = (df2.d) pVar; v8ScriptFileDescriptor.f50922fd = dVar.f200235a.getParcelFileDescriptor().detachFd(); v8ScriptEvaluateRequest2.scriptFd.startOffset = dVar.f200235a.getStartOffset(); v8ScriptEvaluateRequest2.scriptFd.length = dVar.f200235a.getLength(); return v8ScriptEvaluateRequest2; } else if (pVar instanceof df2.t) { V8ScriptEvaluateRequest v8ScriptEvaluateRequest3 = new V8ScriptEvaluateRequest(); v8ScriptEvaluateRequest3.scriptType = 2; V8ScriptWxaFileDescriptor v8ScriptWxaFileDescriptor = new V8ScriptWxaFileDescriptor(); v8ScriptEvaluateRequest3.scriptWxaFd = v8ScriptWxaFileDescriptor; df2.t tVar = (df2.t) pVar; v8ScriptWxaFileDescriptor.wxaPkgPath = tVar.f200271a; String str2 = tVar.f200272b; v8ScriptWxaFileDescriptor.wxaFileName = str2; lh4.m.g(str2, "str"); if (ek4.y.v(str2, "/", false)) { str2 = str2.substring(1); lh4.m.f(str2, "this as java.lang.String).substring(startIndex)"); } v8ScriptEvaluateRequest3.scriptName = "https://mm.tencent.com/" + str2; bf2.p pVar2 = this.f232733p; if (pVar2 != null) { String e15 = pVar2.e(); if (e15.length() <= 0) { z15 = false; } if (z15) { str = e15 + '_' + str2; } else { str = ""; } v8ScriptEvaluateRequest3.cacheKey = str; v8ScriptEvaluateRequest3.cacheCategory = this.A; v8ScriptEvaluateRequest3.cacheType = 0; return v8ScriptEvaluateRequest3; } lh4.m.p("pkgManagement"); throw null; } else { throw new wg4.j(); } } @Override // gf2.d public void g(int i15, Surface surface, int i16, int i17) { lh4.m.g(surface, "surface"); e0().post(new t(this, i15, surface, i16, i17)); } public void g0() { Log.i(this.L, "onStarted"); this.D = 4; this.f232737t.notifyResume(); com.tencent.magicbrush.a aVar = this.f232735r; if (aVar != null) { aVar.e(); } this.f232727g.x(); if (d0()) { ((u0) yz3.j.c(u0.class)).IG((t0) ((wg4.n) this.E).getValue()); } } /* JADX WARNING: Removed duplicated region for block: B:20:0x0110 */ /* JADX WARNING: Removed duplicated region for block: B:29:0x013f */ /* JADX WARNING: Removed duplicated region for block: B:32:0x0195 */ /* JADX WARNING: Removed duplicated region for block: B:41:0x0317 */ public void h0(MBBuildConfig<?> mBBuildConfig) { boolean z15; om0.m Kp; wg4.b0 b0Var; AppBrandJsBridgeBinding appBrandJsBridgeBinding; lh4.m.g(mBBuildConfig, "config"); Log.i(this.L, "setupConfig"); this.f232729i = mBBuildConfig; v0 v0Var = v0.f132388a; String str = this.f232725e; lh4.m.g(str, "instanceName"); Set<String> set = v0.f132392e; synchronized (set) { set.add(str); v0.f132391d = v0Var.a(set); wg4.b0 b0Var2 = wg4.b0.f332794a; } this.f232733p = ((com.tencent.mm.plugin.magicbrush.q0) yz3.j.c(com.tencent.mm.plugin.magicbrush.q0.class)).Tr(this.f232725e, mBBuildConfig.f132146n); if (((Boolean) ((wg4.n) this.B).getValue()).booleanValue()) { Log.i(this.L, "hy: parallel load main script"); bf2.p pVar = this.f232733p; if (pVar != null) { pVar.c(new z(this)); } else { lh4.m.p("pkgManagement"); throw null; } } kf2.d dVar = new kf2.d(); this.f232732o = dVar; String str2 = this.A; b0 b0Var3 = new b0(this); lh4.m.g(str2, "bizName"); IJSRuntime.Config config = new IJSRuntime.Config(); config.f61621a = ((i0) yz3.j.c(i0.class)).nj(); config.f61626f = "1"; config.f61627g = true; config.f61629i = true; config.f61630j = false; config.f61631k = g0.s0(ek4.d0.P(str2, "Magic"), 10); if (lh4.m.b(str2, "MagicEmojiCocos")) { String lowerCase = ("clicfg_magicbrush_disable_delay_js_cache_" + str2).toLowerCase(Locale.ROOT); lh4.m.f(lowerCase, "this as java.lang.String).toLowerCase(Locale.ROOT)"); if (!Boolean.parseBoolean(((ie1.h) yz3.j.c(ie1.h.class)).b6(lowerCase, "false"))) { z15 = true; config.f61633m = z15; Log.i("MBNodeJSRuntimeWrapper", "enable delay js code cache: " + z15); int Xj0 = ((ie1.h) yz3.j.c(ie1.h.class)).Xj0(h.b.f231660v2, 1); Kp = ((om0.g) yz3.j.c(om0.g.class)).Kp(); if (Kp != null) { if (!(Xj0 == 1)) { Kp = null; } if (Kp != null) { Log.i("MBNodeJSRuntimeWrapper", "hy: has node snapshot " + Kp); config.f61623c = true; config.f61622b = Kp.f277589a; config.f61625e = Kp.f277590b; b0Var = wg4.b0.f332794a; if (b0Var == null) { Log.i("MBNodeJSRuntimeWrapper", "hy: abtest use node snapshot " + Xj0); config.f61623c = false; config.f61624d = null; } config.f61637q = new kf2.b(config); com.tencent.mm.plugin.appbrand.jsruntime.z zVar = new com.tencent.mm.plugin.appbrand.jsruntime.z(config); zVar.setJsExceptionHandler(new kf2.c(b0Var3)); dVar.f246326d = zVar; IJSRuntime iJSRuntime = zVar.f90888f; lh4.m.f(iJSRuntime, "runtime.jsRuntime"); this.f232734q = new jf2.c(iJSRuntime); IMBAppBrandExportFeature iMBAppBrandExportFeature = (IMBAppBrandExportFeature) yz3.j.c(IMBAppBrandExportFeature.class); Object[] objArr = new Object[6]; objArr[0] = this.f232724d; objArr[1] = this.f232725e; objArr[2] = zVar; appBrandJsBridgeBinding = this.f232734q; if (appBrandJsBridgeBinding != null) { objArr[3] = appBrandJsBridgeBinding; bf2.p pVar2 = this.f232733p; if (pVar2 != null) { objArr[4] = pVar2; objArr[5] = mBBuildConfig.f132140e; this.f232730j = iMBAppBrandExportFeature.fz0(objArr); e0().post(new b(this)); if (mBBuildConfig.f132144i) { v(new i(this)); } e0().post(new q(this)); String e15 = gx0.e.e("magic_emoji/magic_brush_common_lib.js"); HashMap e16 = r0.e(new wg4.l("platform", Platform.ANDROID), new wg4.l("system", Build.VERSION.RELEASE), new wg4.l("model", vj.r.k()), new wg4.l("brand", Build.BRAND), new wg4.l(FFmpegMetadataRetriever.METADATA_KEY_LANGUAGE, LocaleUtil.getCurrentLanguage(this.f232724d)), new wg4.l("pixelRatio", Float.valueOf(hy3.d.d().density)), new wg4.l(ProviderConstants.API_COLNAME_FEATURE_VERSION, ChannelUtil.formatVersion(null, BuildInfo.CLIENT_VERSION_INT)), new wg4.l(ConstValue.INIT_CONFIG_KEY_CLIENT_VERSION, Integer.valueOf(BuildInfo.CLIENT_VERSION_INT)), new wg4.l("isDarkMode", Boolean.valueOf(x4.B())), new wg4.l("isDebugEnv", Boolean.valueOf(WeChatEnvironment.hasDebugger())), new wg4.l("bizName", this.A), new wg4.l("maxFps", Integer.valueOf(((Number) ((wg4.n) M).getValue()).intValue())), new wg4.l("USER_DATA_PATH", "wxfile://usr"), new wg4.l("experimental", r0.e(new wg4.l("supportCreateCanvasAheadOfTime", Boolean.TRUE)))); String str3 = ";mb.env = " + new JSONObject(e16) + ';'; Log.i(this.L, "mbEnv:" + str3); e0().evaluateJavascript(e15 + str3, new a0(this)); return; } lh4.m.p("pkgManagement"); throw null; } lh4.m.p("jsBridge"); throw null; } } b0Var = null; if (b0Var == null) { } config.f61637q = new kf2.b(config); com.tencent.mm.plugin.appbrand.jsruntime.z zVar2 = new com.tencent.mm.plugin.appbrand.jsruntime.z(config); zVar2.setJsExceptionHandler(new kf2.c(b0Var3)); dVar.f246326d = zVar2; IJSRuntime iJSRuntime2 = zVar2.f90888f; lh4.m.f(iJSRuntime2, "runtime.jsRuntime"); this.f232734q = new jf2.c(iJSRuntime2); IMBAppBrandExportFeature iMBAppBrandExportFeature2 = (IMBAppBrandExportFeature) yz3.j.c(IMBAppBrandExportFeature.class); Object[] objArr2 = new Object[6]; objArr2[0] = this.f232724d; objArr2[1] = this.f232725e; objArr2[2] = zVar2; appBrandJsBridgeBinding = this.f232734q; if (appBrandJsBridgeBinding != null) { } } } z15 = false; config.f61633m = z15; Log.i("MBNodeJSRuntimeWrapper", "enable delay js code cache: " + z15); int Xj02 = ((ie1.h) yz3.j.c(ie1.h.class)).Xj0(h.b.f231660v2, 1); Kp = ((om0.g) yz3.j.c(om0.g.class)).Kp(); if (Kp != null) { } b0Var = null; if (b0Var == null) { } config.f61637q = new kf2.b(config); com.tencent.mm.plugin.appbrand.jsruntime.z zVar22 = new com.tencent.mm.plugin.appbrand.jsruntime.z(config); zVar22.setJsExceptionHandler(new kf2.c(b0Var3)); dVar.f246326d = zVar22; IJSRuntime iJSRuntime22 = zVar22.f90888f; lh4.m.f(iJSRuntime22, "runtime.jsRuntime"); this.f232734q = new jf2.c(iJSRuntime22); IMBAppBrandExportFeature iMBAppBrandExportFeature22 = (IMBAppBrandExportFeature) yz3.j.c(IMBAppBrandExportFeature.class); Object[] objArr22 = new Object[6]; objArr22[0] = this.f232724d; objArr22[1] = this.f232725e; objArr22[2] = zVar22; appBrandJsBridgeBinding = this.f232734q; if (appBrandJsBridgeBinding != null) { } } public boolean i0(int i15) { return i15 == 1; } @Override // mh.a public boolean j(String str, String str2) { lh4.m.g(str, "moduleName"); lh4.m.g(str2, "paramsJson"); String str3 = this.L; Log.i(str3, "lazy load module " + str); int hashCode = str.hashCode(); if (hashCode != -1809564299) { if (hashCode != -1425794666) { if (hashCode == -937619447 && str.equals("Profiler")) { if (this.f232735r != null) { return true; } v(new i(this)); lh4.m.d(this.f232735r); return true; } } else if (str.equals("WeMedia")) { synchronized (ug2.o.f318029a) { if (!ug2.o.f318031c) { Log.i("MBServerUtil", "start load wemedia so"); be.b.b("c++_shared"); be.b.b("voipVideoCodec"); be.b.b("xffmpeg"); be.b.b("mmmedia"); be.b.b("wemedia"); Log.i("MBServerUtil", "load wemedia so done"); ug2.o.f318031c = true; } } Log.i(this.L, "initWeMedia"); if (this.f232740w != null) { return true; } k94.a.f245491b = new k(); k94.b.f245492a = new l(); WeMediaBinding weMediaBinding = new WeMediaBinding(this.f232724d); long m15 = e0().m(); long N0 = e0().N0(); long k15 = e0().k(); weMediaBinding.init(m15, N0, k15, z80.b.E() + "/mbbiz/", new m(this)); this.f232740w = weMediaBinding; Log.i(this.L, "initWeMedia done"); return true; } } else if (str.equals("WXAUDIO")) { synchronized (ug2.o.f318029a) { if (!ug2.o.f318030b) { Log.i("MBServerUtil", "start load web audio so"); be.b.b("c++_shared"); be.b.b("xffmpeg"); be.b.b("wxaudio"); Log.i("MBServerUtil", "load web audio so done"); WxAudioNative.initAndroidAssetMgr(MMApplicationContext.getContext().getAssets()); ug2.o.f318030b = true; } } WxAudioNative wxAudioNative = new WxAudioNative(e0().m(), e0().N0(), e0().k()); wxAudioNative.InitCallBack(new n(this)); this.f232739v = wxAudioNative; return true; } return false; } @Override // mh.a public BatchRequestWxaFileDescriptorsResponse k(String[] strArr, Map<String, ? extends Object> map) { boolean z15 = true; if (strArr != null) { if (!(strArr.length == 0)) { z15 = false; } } if (z15) { return null; } ArrayList arrayList = new ArrayList(); for (String str : strArr) { bf2.p pVar = this.f232733p; if (pVar != null) { df2.t d15 = pVar.d(str, map); if (d15 != null) { arrayList.add(d15); } } else { lh4.m.p("pkgManagement"); throw null; } } if (arrayList.isEmpty()) { return null; } BatchRequestWxaFileDescriptorsResponse batchRequestWxaFileDescriptorsResponse = new BatchRequestWxaFileDescriptorsResponse(); batchRequestWxaFileDescriptorsResponse.keyPath = (String) ((wg4.n) this.H).getValue(); ArrayList arrayList2 = new ArrayList(xg4.v.m(arrayList, 10)); Iterator it = arrayList.iterator(); while (it.hasNext()) { df2.t tVar = (df2.t) it.next(); com.tencent.mm.appbrand.commonjni.V8ScriptWxaFileDescriptor v8ScriptWxaFileDescriptor = new com.tencent.mm.appbrand.commonjni.V8ScriptWxaFileDescriptor(); v8ScriptWxaFileDescriptor.wxaFileName = tVar.f200272b; v8ScriptWxaFileDescriptor.wxaPkgPath = tVar.f200271a; arrayList2.add(v8ScriptWxaFileDescriptor); } batchRequestWxaFileDescriptorsResponse.fds = (com.tencent.mm.appbrand.commonjni.V8ScriptWxaFileDescriptor[]) arrayList2.toArray(new com.tencent.mm.appbrand.commonjni.V8ScriptWxaFileDescriptor[0]); return batchRequestWxaFileDescriptorsResponse; } @Override // mh.a public void l(String str) { lh4.m.g(str, "msg"); byte[] bytes = str.getBytes(ek4.c.f208058a); lh4.m.f(bytes, "this as java.lang.String).getBytes(charset)"); CrashReportFactory.reportRawMessage(Base64.encodeToString(bytes, 2), "appbrand_commonbinding"); } @Override // gf2.d public void m(int i15, String str) { lh4.m.g(str, "result"); AppBrandJsBridgeBinding appBrandJsBridgeBinding = this.f232734q; if (appBrandJsBridgeBinding != null) { appBrandJsBridgeBinding.invokeCallbackHandler(i15, str); } else { lh4.m.p("jsBridge"); throw null; } } @Override // mh.a public String[] n() { return (String[]) ((wg4.n) this.K).getValue(); } @Override // com.tencent.magicbrush.a.d public MagicBrushView o() { Context context = this.f232724d; com.tencent.magicbrush.a aVar = this.f232735r; lh4.m.d(aVar); ff2.a aVar2 = new ff2.a(context, aVar); this.f232736s.put(Integer.valueOf(aVar2.f214353f.getVirtualElementId()), aVar2); return aVar2.f214353f; } public void onCreated() { com.tencent.mm.plugin.appbrand.jsruntime.m mVar; Log.i(this.L, "onCreated"); AppBrandJsBridgeBinding appBrandJsBridgeBinding = this.f232734q; if (appBrandJsBridgeBinding != null) { appBrandJsBridgeBinding.createRuntime(e0().m(), e0().N0(), "JSBridge", true); AppBrandJsBridgeBinding appBrandJsBridgeBinding2 = this.f232734q; if (appBrandJsBridgeBinding2 != null) { appBrandJsBridgeBinding2.setJsExceptionCallback(new o(this)); this.D = 2; e0().evaluateJavascript("\n JSBridge.on(\"onJsError\", function(res) {\n if (res.stack == '') {\n console.error(res.message);\n } else {\n console.error(res.stack);\n }\n });\n JSBridge.on('devtools:receive', function(msg) {\n const devtools = global.DevtoolsMessage;\n if (devtools && devtools.onreceive) {\n devtools.onreceive.call(devtools, msg);\n }\n });\n ", null); if (d0() && (mVar = (com.tencent.mm.plugin.appbrand.jsruntime.m) e0().q0(com.tencent.mm.plugin.appbrand.jsruntime.m.class)) != null) { mVar.Y0("_console"); } e0().pause(); this.f232727g.onCreated(); return; } lh4.m.p("jsBridge"); throw null; } lh4.m.p("jsBridge"); throw null; } @Override // gf2.d public void p(String str, int i15) { lh4.m.g(str, "script"); if (this.D < 2) { String str2 = this.L; Log.e(str2, "evaluate discard, script is " + g0.s0(str, 100)); } else if (i15 > 0) { e0().evaluateJavascript(str, new i(this, i15)); } else { e0().evaluateJavascript(str, null); } } @Override // gf2.d public void setMute(boolean z15) { e0().C(new y(this, z15)); } @Override // mh.a public ByteBuffer u(String str) { lh4.m.g(str, ConstantsKinda.INTENT_LITEAPP_PATH); bf2.p pVar = this.f232733p; if (pVar != null) { gx0.m<ByteBuffer> mVar = new gx0.m<>(); com.tencent.mm.plugin.appbrand.appstorage.b0 readFile = pVar.b().readFile(str, mVar); lh4.m.f(readFile, "pkgManagement.provideFil…).readFile(path, pointer)"); if (readFile == com.tencent.mm.plugin.appbrand.appstorage.b0.OK) { return mVar.f222594a; } return null; } lh4.m.p("pkgManagement"); throw null; } @Override // gf2.d public void v(kh4.a<wg4.b0> aVar) { lh4.m.g(aVar, "r"); e0().post(new x(aVar)); } @Override // gf2.d public void y(String str, String str2) { lh4.m.g(str, "serviceName"); lh4.m.g(str2, "msg"); e0().post(new q(this, str, str2)); } }