var Dl = "payload=";
    var Gl = "appId=";
    var Ql = "tag=";
    var kl = "uuid=";
    var Xl = "xuuid=";
    var Yl = "ft=";
    var Hl = "seq=";
    var Ll = "cs=";
    var Zl = "pc=";
    var jl = "sid=";
    var zl = "vid=";
    var Jl = "jsc=";
    var Kl = "ci=";
    var ql = "pxhd=";
    var $l = "en=";
    var ts = "rsc=";
    var es = "cts=";
    var ns = "/api/v2/collector";
    var rs = "application/x-www-form-urlencoded";
    var is = "NTA";
var tu = "_pxAction";
var eu = "_pxMobile";
var nu = "_pxMonitorAbr";
var ru = "_pxAbr";
var iu = "_pxUuid";
var au = "px-captcha";
var ou = "g-recaptcha";
var cu = "_pxhd";
var fu = "isTrusted";
var uu = "pxsid";

function rl() {
    return p[tu];
}


function Vc() {
    var t;
    var i = o;
    switch (!0) {
        case function () {
            var t = rl();
            return t === hc || t === sc;
        }():
            t = "PX11745";
            break;
        case rl() === "c":
            t = "PX11978";
            break;
        default:
            t = null;
    }
    return t;
}
let Bu = undefined;

let Us = {
    "Dakc": [
        "https://collector-PXVb73hTEg.px-cloud.net/b/c",
        "https://collector-PXVb73hTEg.px-cloud.net/api/v2/collector",
        "https://collector-PXVb73hTEg.px-cloud.net/b/s",
        "https://collector-PXVb73hTEg.px-cdn.net/b/c",
        "https://collector-PXVb73hTEg.px-cdn.net/api/v2/collector",
        "https://collector-PXVb73hTEg.px-cdn.net/b/s",
        "https://collector-PXVb73hTEg.pxchk.net/b/c",
        "https://collector-PXVb73hTEg.pxchk.net/api/v2/collector",
        "https://collector-PXVb73hTEg.pxchk.net/b/s"
    ],
    "aI36": 0,
    "Ek9V": 4,
    "1nzv": "PXVb73hTEg",
    "Y03R": "v8.7.2",
    "gt7B": "317",
    "channels": {
        "xhrSuccess": [
            {
                "once": false
            }
        ],
        "xhrResponse": [
            {
                "once": false
            }
        ],
        "xhrFailure": [
            {
                "once": false
            }
        ]
    },
    "params": null
}
let In = "Y03R";
let Un = "1nzv";
let _n = 'diTK';
let xn = 'ekDu';

export function getPayload(uuid, vid, sid, ci, t) {

    let vh = null;
    // console.log('now', le(), JSON.stringify(t))
    for (var m = Vc(), M = 0; M < t["length"]; M++) {
        var g = t[M];
        g["d"]["PX11379"] = false;
        m && (g["d"]["PX12307"] = m);
        g["d"]["PX12615"] = Bu;
        vh && (g["d"]["PX11375"] = vh);
        var y = rl();
        y && (g["d"]["PX11668"] = y, g["d"]["PX12348"] = sl());
    }
    !function (t) {
        t[0] && t[0]["d"] && ((t[0] && t[0]["d"])["PX11645"] = su);
    }(t);
    // console.log('now', le(), JSON.stringify(t))
    // var A = $u();
    var A = p.cs;
    var V = se(ht(t), function (t, e) {
        return [uuid, t, e]['join'](":");
    }(Us[In], Us[Sn]));
    var b = {
        "vid": vid,
        "tag": Us[In],
        "appID": Us[Un],
        "cu": uuid,
        "cs": A,
        "pc": V
    };
    var w = bl(t, b);
    // console.log("ts", fl())
    // console.log('res', w)
    var E = [Dl + w, Gl + Us[Un], Ql + Us[In], kl + uuid, Yl + Us[Sn], Hl + ls++, $l + is];
    var T = zu();
    T && E["push"](Xl + T);
    A && E["push"](Ll + A);
    V && E["push"](Zl + V);
    var O = Us[_n]();
    var U = Ol(fl());
    (O || U) && E["push"](jl + (O || sid) + U);
    var I = Us[xn]();
    vid && E["push"](zl + vid);
    mu && E["push"](Jl + mu);
    var S = ci;
    S && E["push"](Kl + S);
    Ru || (Ru = Df(cu));
    var C = Ru;
    C && E["push"](ql + C);
    Qf && E["push"](es + Qf);
    I["length"] >= 0 && E["push"]["apply"](E, I);
    return E;
}
function u(t) {
    u = "function" == typeof Symbol && "symbol" == typeof Symbol["iterator"] ? function (t) {
        return typeof t;
    } : function (t) {
        return t && "function" == typeof Symbol && t["constructor"] === Symbol && t !== Symbol["prototype"] ? "symbol" : typeof t;
    };
    return u(t);
}
let tt = {
    "\b": "\\b",
    "\t": "\\t",
    "\n": "\\n",
    "\f": "\\f",
    "\r": "\\r",
    "\u000b": "\\v",
    "\"": "\\\"",
    "\\": "\\\\"
}
function ft(t) {
    return tt[t] || "\\u" + ("0000" + t["charCodeAt"](0)["toString"](16))["slice"](-4);
}

function vt(t) {
    /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g["lastIndex"] = 0;
    return '"' + (/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g["test"](t) ? t["replace"](/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, ft) : t) + '"';
}
function ht(t) {
    var e;
    switch (u(t)) {
        case "undefined":
            return "null";
        case "boolean":
            return String(t);
        case "number":
            var n = String(t);
            return "NaN" === n || "Infinity" === n ? "null" : n;
        case "string":
            return vt(t);
    }
    if (null === t || t instanceof RegExp) {
        return "null";
    }
    if (t instanceof Date) {
        return ['"', t["getFullYear"](), "-", t["getMonth"]() + 1, "-", t["getDate"](), "T", t["getHours"](), ":", t["getMinutes"](), ":", t["getSeconds"](), ".", t["getMilliseconds"](), '"']["join"]("");
    }
    if (t instanceof Array) {
        var r;
        e = ["["];
        for (r = 0; r < t["length"]; r++) {
            e["push"](ht(t[r]) || '"undefined"', ",");
        }
        e[e["length"] > 1 ? e["length"] - 1 : e["length"]] = "]";
        return e["join"]("");
    }
    e = ["{"];
    for (var i in t) {
        t["hasOwnProperty"](i) && void 0 !== t[i] && e["push"](vt(i), ":", ht(t[i]) || '"undefined"', ",");
    }
    e[e["length"] > 1 ? e["length"] - 1 : e["length"]] = "}";
    return e["join"]("");
}