package com.tencent.mm.plugin.backup.bakoldlogic.b;

import com.google.android.gms.common.internal.ImagesContract;
import com.google.firebase.analytics.FirebaseAnalytics$b;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.af.o;
import com.tencent.mm.af.p;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.biz.a.a;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.ytcommon.BuildConfig;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

class b$a {
    public static String jrk = "<msg>";
    public static String jrl = "</msg>";
    public static String jvr = "]]>";

    public static String Fh(String str) {
        AppMethodBeat.i(17777);
        o b = ((a) g.K(a.class)).b(0, str);
        a aVar = new a(str);
        String str2;
        if (aVar.bYN) {
            String str3;
            String str4;
            String str5;
            b bVar = new b();
            List list = b.fjr;
            HashMap hashMap = new HashMap();
            bVar.Fi("msg");
            hashMap.put("appid", (String) aVar.jvs.get(".msg.appmsg.$appid"));
            hashMap.put("sdkver", (String) aVar.jvs.get(".msg.appmsg.$sdkver"));
            bVar.m("appmsg", hashMap);
            if (list == null) {
                list = new LinkedList();
            }
            if (list.size() == 0) {
                str3 = BuildConfig.FLAVOR;
                str4 = BuildConfig.FLAVOR;
                str5 = BuildConfig.FLAVOR;
            } else {
                str3 = ((p) list.get(0)).title;
                str4 = ((p) list.get(0)).url;
                list.get(0);
                str5 = ((p) list.get(0)).fjz;
            }
            bVar.cY("title", str3);
            bVar.cY("des", (String) aVar.jvs.get(".msg.appmsg.des"));
            bVar.cY("action", (String) aVar.jvs.get(".msg.appmsg.action"));
            bVar.bE("type", aVar.getInt(".msg.appmsg.type"));
            bVar.bE("showtype", aVar.getInt(".msg.appmsg.showtype"));
            bVar.cY(FirebaseAnalytics$b.CONTENT, (String) aVar.jvs.get(".msg.appmsg.content"));
            bVar.cY(ImagesContract.URL, str4);
            bVar.cY("lowurl", (String) aVar.jvs.get(".msg.appmsg.lowurl"));
            bVar.Fi("appattach");
            bVar.bE("totallen", aVar.getInt(".msg.appmsg.appattach.totallen"));
            bVar.cY("attachid", (String) aVar.jvs.get(".msg.appmsg.appattach.attachid"));
            bVar.cY("fileext", (String) aVar.jvs.get(".msg.appmsg.appattach.fileext"));
            bVar.Fj("appattach");
            bVar.Fi("mmreader");
            hashMap.put("type", b.type);
            hashMap.put("convMsgCount", list.size());
            bVar.m("category", hashMap);
            bVar.cY("name", b.cMh);
            bVar.Fi("topnew");
            bVar.cY("cover", (String) aVar.jvs.get(".msg.appmsg.mmreader.category.topnew.cover"));
            bVar.cY("width", (String) aVar.jvs.get(".msg.appmsg.mmreader.category.topnew.width"));
            bVar.cY("height", (String) aVar.jvs.get(".msg.appmsg.mmreader.category.topnew.height"));
            bVar.cY("digest", str5);
            bVar.Fj("topnew");
            int i = 0;
            while (i < list.size()) {
                bVar.Fi("item");
                if (list.get(i) != null) {
                    str4 = ((p) list.get(i)).title;
                    str3 = ((p) list.get(i)).url;
                    String str6 = ((p) list.get(i)).fjv;
                    String str7 = ((p) list.get(i)).fjw;
                    String str8 = ((p) list.get(i)).time;
                    String str9 = ((p) list.get(i)).fjx;
                    String str10 = ((p) list.get(i)).fjy;
                    str2 = ((p) list.get(i)).fjz;
                    bVar.cY("title", str4);
                    bVar.cY(ImagesContract.URL, str3);
                    bVar.cY("shorturl", str6);
                    bVar.cY("longurl", str7);
                    bVar.cY("pub_time", str8);
                    bVar.cY("cover", str9);
                    bVar.cY("tweetid", str10);
                    bVar.cY("digest", str2);
                    bVar.cY("fileid", (String) aVar.jvs.get((".msg.appmsg.mmreader.category.item" + (i == 0 ? BuildConfig.FLAVOR : String.valueOf(i))) + ".fileid"));
                    bVar.Fi(FirebaseAnalytics$b.SOURCE);
                    bVar.Fi(FirebaseAnalytics$b.SOURCE);
                    bVar.cY("name", b.cMh);
                    bVar.Fj(FirebaseAnalytics$b.SOURCE);
                    bVar.Fj(FirebaseAnalytics$b.SOURCE);
                    bVar.Fj("item");
                }
                i++;
            }
            bVar.Fj("category");
            bVar.Fi("publisher");
            bVar.cY("convName", b.cMg);
            bVar.cY("nickname", b.cMh);
            bVar.Fj("publisher");
            bVar.Fj("mmreader");
            bVar.Fj("appmsg");
            bVar.cY("fromusername", b.cMg);
            bVar.bE("scene", aVar.getInt(".msg.scene"));
            bVar.Fi("appinfo");
            bVar.cY("version", (String) aVar.jvs.get(".msg.appinfo.appname"));
            bVar.cY("appname", (String) aVar.jvs.get(".msg.appinfo.version"));
            bVar.Fj("appinfo");
            bVar.cY("commenturl", b.dJv);
            bVar.Fj("msg");
            ab.d("MicroMsg.AppmsgConvert", "xml " + bVar.jvt.toString());
            str2 = bVar.jvt.toString();
            AppMethodBeat.o(17777);
            return str2;
        }
        ab.e("MicroMsg.AppmsgConvert", "buffer error");
        str2 = BuildConfig.FLAVOR;
        AppMethodBeat.o(17777);
        return str2;
    }
}
