package com.tencent.mm.plugin.story.model;

import a.f.b.j;
import a.k.k;
import a.l;
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.protocal.protobuf.cej;
import com.tencent.mm.protocal.protobuf.cek;
import com.tencent.mm.protocal.protobuf.cfb;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.sdk.platformtools.br;
import com.tencent.sqlitelint.config.SharePluginInfo;
import com.tencent.ytcommon.BuildConfig;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;

@l(dWo = {1, 1, 13}, dWp = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\t\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\n\u001a\u00020\u00042\u0006\u0010\u000b\u001a\u00020\u0004J\u0010\u0010\f\u001a\u00020\u00042\b\u0010\u000b\u001a\u0004\u0018\u00010\u0004J\u000e\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u0004J\u0018\u0010\u0010\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00020\u00122\b\u0010\u0013\u001a\u0004\u0018\u00010\u0014R\u001a\u0010\u0003\u001a\u00020\u0004X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bR\u000e\u0010\t\u001a\u00020\u0004XD¢\u0006\u0002\n\u0000¨\u0006\u0015"}, dWq = {"Lcom/tencent/mm/plugin/story/model/StoryTimelineConvert$Companion;", "", "()V", "INVALID_TAG", "", "getINVALID_TAG", "()Ljava/lang/String;", "setINVALID_TAG", "(Ljava/lang/String;)V", "TAG", "filterId", "s", "filterNull", "isNumeric", "", "str", "pullTimeLineXml", "timeLine", "Lcom/tencent/mm/protocal/protobuf/StoryTimelineObject;", "editor", "Lcom/tencent/mm/protocal/protobuf/StoryMediaEditorInfo;", "plugin-story_release"})
public final class p$a {
    private p$a() {
    }

    public /* synthetic */ p$a(byte b) {
        this();
    }

    public static String a(cfb cfb, cej cej) {
        AppMethodBeat.i(109135);
        j.p(cfb, "timeLine");
        p$b p_b = new p$b();
        HashMap hashMap = new HashMap();
        p_b.Fi("StoryObject");
        p_b.Fi(SharePluginInfo.ISSUE_KEY_ID);
        if (cfb.Id == null || cfb.Id.equals(BuildConfig.FLAVOR)) {
            p_b.setText("0");
        } else {
            p_b.setText(cfb.Id);
        }
        p_b.Fj(SharePluginInfo.ISSUE_KEY_ID);
        if (cfb.jBB != null) {
            p_b.Fi("username");
            p_b.aaD(cfb.jBB);
            p_b.Fj("username");
        }
        p_b.Fi(SharePluginInfo.ISSUE_KEY_CREATE_TIME);
        p_b.aaD(String.valueOf(cfb.pcX));
        p_b.Fj(SharePluginInfo.ISSUE_KEY_CREATE_TIME);
        p_b.Fi("scope");
        p_b.setText(cfb.xeC);
        p_b.Fj("scope");
        p_b.Fi("featured");
        p_b.setText(cfb.xeD);
        p_b.Fj("featured");
        p_b.Fi("report");
        p_b.Fi("publish_obj_id");
        String str = cfb.xeB;
        if (str == null) {
            str = BuildConfig.FLAVOR;
        }
        p_b.aaD(str);
        p_b.Fj("publish_obj_id");
        ab.i("czf", "report ".concat(String.valueOf(cej)));
        if (cej != null) {
            p_b.Fi("music");
            if (cej.xef) {
                p_b.Fi("req_id");
                p_b.aaD(String.valueOf(cej.xee));
                p_b.Fj("req_id");
                p_b.Fi(SharePluginInfo.ISSUE_KEY_ID);
                p_b.setText(cej.rTW);
                p_b.Fj(SharePluginInfo.ISSUE_KEY_ID);
                p_b.Fi(FirebaseAnalytics$b.INDEX);
                p_b.setText(cej.xdZ);
                p_b.Fj(FirebaseAnalytics$b.INDEX);
            }
            p_b.Fj("music");
            p_b.Fi("emojiList");
            LinkedList<String> linkedList = cej.xeg;
            j.o(linkedList, "editor.emojiMd5");
            for (String str2 : linkedList) {
                p_b.Fi("emoji");
                j.o(str2, "it");
                p_b.aaD(str2);
                p_b.Fj("emoji");
            }
            p_b.Fj("emojiList");
            p_b.Fi("wordList");
            linkedList = cej.xeh;
            j.o(linkedList, "editor.wordText");
            for (String str22 : linkedList) {
                p_b.Fi("word");
                j.o(str22, "it");
                p_b.aaD(str22);
                p_b.Fj("word");
            }
            p_b.Fj("wordList");
        }
        p_b.Fj("report");
        p_b.Fi("ContentObject");
        p_b.Fi("title");
        p_b.aaD(YE(cfb.xeA.Title));
        p_b.Fj("title");
        if (cfb.xeA.wbK.size() > 0) {
            p_b.Fi("mediaList");
            Iterator it = cfb.xeA.wbK.iterator();
            while (it.hasNext()) {
                cek cek = (cek) it.next();
                p_b.Fi("media");
                p_b.Fi(SharePluginInfo.ISSUE_KEY_ID);
                str22 = cek.Id;
                j.o(str22, "media.Id");
                if (j.j(YF(str22), BuildConfig.FLAVOR)) {
                    p_b.aaD("0");
                } else {
                    str22 = cek.Id;
                    j.o(str22, "media.Id");
                    p_b.aaD(YF(str22));
                }
                p_b.Fj(SharePluginInfo.ISSUE_KEY_ID);
                p_b.Fi("type");
                p_b.aaD(String.valueOf(cek.jCt));
                p_b.Fj("type");
                p_b.Fi("duration");
                p_b.jvt.append(cek.duration);
                p_b.Fj("duration");
                hashMap.clear();
                hashMap.put("type", String.valueOf(cek.wEG));
                if (!bo.isNullOrNil(cek.cvZ)) {
                    hashMap.put("md5", cek.cvZ);
                }
                if (!bo.isNullOrNil(cek.wFc)) {
                    hashMap.put("videomd5", cek.wFc);
                }
                p_b.m(ImagesContract.URL, hashMap);
                p_b.aaD(YE(cek.Url));
                p_b.Fj(ImagesContract.URL);
                if (!(cek.wEH == null || cek.wEH.equals(BuildConfig.FLAVOR))) {
                    hashMap.clear();
                    hashMap.put("type", String.valueOf(cek.wEI));
                    p_b.m("thumb", hashMap);
                    p_b.aaD(YE(cek.wEH));
                    p_b.Fj("thumb");
                }
                if (cek.cuu > 0) {
                    p_b.Fi("subType");
                    p_b.aaD(String.valueOf(cek.cuu));
                    p_b.Fj("subType");
                }
                p_b.Fj("media");
            }
            p_b.Fj("mediaList");
        }
        p_b.Fj("ContentObject");
        p_b.Fj("StoryObject");
        str22 = p_b.jvt.toString();
        j.o(str22, "sb.toString()");
        ab.d(p.access$getTAG$cp(), "xmlContent: ".concat(String.valueOf(str22)));
        if (br.z(str22, "StoryObject") == null) {
            ab.e(p.access$getTAG$cp(), "xml is error");
            str22 = BuildConfig.FLAVOR;
            AppMethodBeat.o(109135);
            return str22;
        }
        AppMethodBeat.o(109135);
        return str22;
    }

    private static String YE(String str) {
        return str == null ? BuildConfig.FLAVOR : str;
    }

    private static String YF(String str) {
        AppMethodBeat.i(109136);
        j.p(str, "s");
        if (bo.isNullOrNil(str)) {
            str = BuildConfig.FLAVOR;
            AppMethodBeat.o(109136);
            return str;
        } else if (isNumeric(str)) {
            AppMethodBeat.o(109136);
            return str;
        } else {
            str = BuildConfig.FLAVOR;
            AppMethodBeat.o(109136);
            return str;
        }
    }

    private static boolean isNumeric(String str) {
        AppMethodBeat.i(109137);
        j.p(str, "str");
        boolean aq = new k("\\d*").aq(str);
        AppMethodBeat.o(109137);
        return aq;
    }
}
