in static/js/tracker.js [1340:1848]
function (e, t, n) {
'use strict';
n.r(t),
n.d(t, 'sendApi', function () {
return s;
});
var r = n(0),
o = n.n(r);
function i(e, t) {
for (var n in t) e[n] = t[n];
return e;
}
function a(e) {
var t =
arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1e3;
if ('string' == typeof e)
return e.length > t && (e = e.substr(0, t - 3) + '...'), e;
}
var s = function (e) {
var t = e.url,
n = e.success,
r = e.msg,
i = e.status,
s = e.code,
c = e.duration,
u = e.traceId,
f = e.params,
p = e.body,
d = e.response,
l = e.headers,
y = e.rtype,
h = e.method,
g = o.a.getConfig('plugin_api') || {},
v = g.ignoreList,
m = g.sendResponseOnSuccess;
if (
!v ||
!v.some(function (n) {
if ('string' == typeof n) return n === t;
if ('function' == typeof n)
try {
return n(t, e);
} catch (e) {}
else if (n instanceof RegExp) return n.test(t);
})
) {
var w = (function () {
if (!('object' == typeof my)) return !1;
try {
var e = '';
try {
e = navigator
? navigator.userAgent || navigator.swuserAgent
: '';
} catch (e) {}
if (!e)
try {
e = clientInformation ? clientInformation.appVersion : '';
} catch (e) {}
var t = !1;
try {
t = !!dd;
} catch (e) {}
return (
t ||
/AliApp\(AP/.test(e) ||
/AliApp\(DingTalk/.test(e) ||
/micromessenger/.test(e)
);
} catch (e) {
return !1;
}
})();
o.a.log('api', {
url: t,
method: 'string' == typeof h ? h.toUpperCase() : void 0,
success: n,
msg: r,
status: i,
code: s,
duration: c,
trace_id: u,
params: f,
body: a(p, w ? 2e3 : 1e4),
response: !n || m ? a(d, w ? 1e3 : 1e4) : void 0,
headers: l,
rtype: y,
});
}
};
function c(e, t) {
return (
(void 0 === t || (t >= 200 && t < 300)) &&
(void 0 !== e.success
? !0 === e.success || 'true' === e.success
: void 0 !== e.isSuccess
? !0 === e.isSuccess || 'true' === e.isSuccess
: void 0 !== e.isOk
? !0 === e.isOk || 'true' === e.isOk
: void 0 !== e.ok
? !0 === e.ok || 'true' === e.ok
: isNaN(e.status)
? !!isNaN(e.code) || 200 == e.code
: 200 == e.status)
);
}
function u(e) {
return e.code;
}
function f(e) {
var t = e.msg || e.message || e.errMsg || e.errorMessage || e.errorMsg;
return t && t.length > 50 && (t = t.substring(1, 50)), t;
}
function p(e, t) {
if (((t = t.toUpperCase()), e && ('POST' === t || 'PUT' === t))) {
if ('string' == typeof e) return e;
if (window.FormData && e instanceof FormData) {
var n = [];
return (
e.forEach(function (e, t) {
n.push(
''
.concat(t, '=')
.concat(
'string' == typeof e
? e
: Object.prototype.toString.call(e)
)
);
}),
n.join('&')
);
}
return window.URLSearchParams && e instanceof URLSearchParams
? e.toString()
: window.Request && e instanceof Request
? e.clone().text()
: Object.prototype.toString.call(e);
}
}
function d(e, t, n) {
var r,
i = e;
if ('string' == typeof i)
try {
i = JSON.parse(e);
} catch (e) {}
r =
'[object Object]' === Object.prototype.toString.call(i)
? { msg: f(i), code: u(i), success: c(i, t) }
: { success: void 0 === t || (t >= 200 && t < 300) };
var a = o.a.getConfig('plugin_api') || {};
if ('function' == typeof a.parseResponse)
try {
var s = a.parseResponse(i, t, n) || {};
for (var p in s) r[p] = s[p];
} catch (e) {}
return r;
}
function l(e) {
return (
!e ||
(-1 !== e.indexOf('api=') &&
-1 !== e.indexOf('v=') &&
-1 !== e.indexOf('jsv=')) ||
-1 !== e.indexOf('.mmstat.com=') ||
e.match(/\.(js|css|png|jpg|gif|jpeg|webp|ico|svg)(\?.*)?$/)
);
}
function y(e) {
return 'undefined' != typeof Promise && e instanceof Promise;
}
function h(e) {
if (window.Headers && e instanceof Headers) {
var t = {};
return (
e.forEach(function (e, n) {
t[n] = e;
}),
t
);
}
}
function g(e, t) {
if (t.originResponse) return e;
if ('jsonp' === t.method) return e.text();
var n =
e.headers && e.headers.get ? e.headers.get('content-type') : null;
return n &&
-1 === n.toLowerCase().indexOf('json') &&
-1 === n.toLowerCase().indexOf('text')
? '['.concat(n, ']')
: e.text();
}
var v = function () {
if (
!(
'function' != typeof window.fetch ||
(window.fetch && window.fetch.polyfill)
)
) {
var e = window.fetch;
window.fetch = function (t) {
var n =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: {},
r = o.a.getConfig('plugin_api') || {};
if ('HEAD' === n.method || 'no-cors' === n.mode)
return e.apply(window, arguments);
var a = 'object' == typeof t ? t.url || t.href : t;
if (l(a)) return e.apply(window, arguments);
var c,
u,
f = a.split('?'),
v = f[0],
m = f[1],
w = n.method || t.method || 'GET';
try {
u = h(n.headers || t.headers);
} catch (e) {}
try {
y((c = p(n.body || t, w))) &&
c.then(function (e) {
c = e;
});
} catch (e) {}
var b = new Date().getTime();
return e.apply(window, arguments).then(
function (e) {
try {
if ('[object Response]' !== Object.prototype.toString.call(e))
return e;
var t,
o = new Date().getTime() - b,
a = e.clone ? e.clone() : e,
f = a.status;
a.headers.has('eagleeye-traceid')
? (t = a.headers.get('eagleeye-traceid'))
: a.headers.has('x-eagleeye-id') &&
(t = a.headers.get('x-eagleeye-id'));
var p = function (e) {
(!1 !==
(a = d(e, f, {
type: 'fetch',
params: m,
url: v,
body: n.body,
})).success &&
r.disable_send_on_success) ||
s(
i(
{
url: v,
method: w,
status: f,
duration: o,
traceId: t,
params: m,
headers: u,
body: c,
response: e,
rtype: 'fetch',
},
a
)
);
},
l = g(a, n);
y(l) ? l.then(p) : p(l);
} catch (e) {}
return e;
},
function (e) {
var t = new Date().getTime() - b,
n = d('', -1, { type: 'fetch', params: m, url: v });
throw (
(s(
i(
{
url: v,
method: w,
success: !1,
msg: e.message,
status: -1,
duration: t,
params: m,
body: c,
headers: u,
rtype: 'fetch',
},
n
)
),
e)
);
}
);
};
}
};
var m = function () {
if (
'function' == typeof window.XMLHttpRequest &&
window.addEventListener
) {
var e = window.XMLHttpRequest,
t = e.prototype,
n = t.open,
r = t.send,
a = t.setRequestHeader;
(e.prototype.open = function (e, t) {
n.apply(this, arguments), (this._aesHook = { method: e, url: t });
}),
(e.prototype.setRequestHeader = function (e, t) {
a.apply(this, arguments),
this._aesHook.headers || (this._aesHook.headers = {}),
(this._aesHook.headers[e] = t);
}),
(e.prototype.send = function (e) {
r.apply(this, arguments);
try {
var t = this._aesHook,
n = t.url,
a = t.method,
c = void 0 === a ? 'GET' : a,
u = t.headers;
delete this._aesHook;
var f = n ? n.href || n : '';
if (l(f)) return;
var y,
h = f.split('?'),
g = this,
v = 0,
m = h[1],
w = new Date().getTime();
n = h[0];
try {
y = p(e, c);
} catch (e) {}
var b = function () {
v = g.status || v;
var t,
r = new Date().getTime() - w;
try {
var a = g.getAllResponseHeaders();
-1 !== a.indexOf('eagleeye-traceid')
? (t = g.getResponseHeader('eagleeye-traceid'))
: -1 !== a.indexOf('x-eagleeye-id') &&
(t = g.getResponseHeader('x-eagleeye-id'));
} catch (e) {}
var f,
p = g.responseType || 'text';
'text' === p || 'json' === p
? (f = g.response)
: g.response &&
(f = Object.prototype.toString.call(g.response));
var l = d(f || '', v, {
type: 'xhr',
params: m,
url: n,
body: e,
}),
h = o.a.getConfig('plugin_api') || {};
(l.success && h.disable_send_on_success) ||
s(
i(
{
url: n,
method: c,
status: v,
duration: r,
traceId: t,
params: m,
headers: u,
body: y,
response: f,
rtype: 'xhr',
},
l
)
);
};
void 0 !== g.onloadend
? (g.addEventListener('abort', function (e) {
v = -2;
}),
g.addEventListener('timeout', function (e) {
v = -3;
}),
g.addEventListener('loadend', b))
: g.addEventListener('readystatechange', function () {
4 === g.readyState && b();
});
} catch (e) {}
});
}
},
w = n(8),
b = n.n(w),
x = n(4),
_ = n.n(x);
var O = {
hookFetch: v,
hookXHR: m,
hookMtop: function () {
function e(e) {
var t = this.options,
n = this.params,
r = new Date().getTime();
return e().then(function () {
var e = t.retJson.ret,
a = new Date().getTime() - r;
e instanceof Array && (e = e.join(','));
var c = o.a.getConfig('plugin_api') || {},
u = {};
if ('function' == typeof c.parseResponse)
try {
u =
c.parseResponse(t.retJson, '', {
type: 'mtop',
params: n.data,
url: n.api,
}) || {};
} catch (e) {}
var f =
void 0 === u.success ? -1 === e.indexOf('SUCCESS') : !u.success;
if (f || !c.disable_send_on_success) {
var p,
d,
l,
y = t.retJson.code || 200,
h = t.retJson.responseHeaders;
if ('string' == typeof h) {
var g = h.match(
/(x-eagleeye-id|eagleeye-traceid):\s*([a-z0-9]+)/
);
g && (p = g[2]);
var v = h.match(/status:\s*(\d+)/);
v && (y = v[1]);
}
if (e) {
var m = e.split('::');
(d = m[0]), (l = m[1]);
}
s(
i(
{
url: n.api,
success: !f,
method: n.type || 'GET',
msg: l,
status: y,
code: d,
duration: a,
traceId: p,
params: n.data,
response: b()(t.retJson),
rtype: 'mtop',
},
u
)
);
}
});
}
var t;
window.lib || (window.lib = {}),
lib.mtop
? lib.mtop.middlewares && lib.mtop.middlewares.push(e)
: _()(lib, 'mtop', {
configurable: !0,
set: function (n) {
var r;
(t = n).middlewares
? -1 === t.middlewares.indexOf(e) && t.middlewares.push(e)
: _()(t, 'middlewares', {
configurable: !0,
set: function (t) {
-1 === (r = t).indexOf(e) && r.push(e);
},
get: function () {
return r;
},
});
},
get: function () {
return t;
},
});
},
};
!(function () {
if (!window.__AES_PLUGIN_API__) {
window.__AES_PLUGIN_API__ = !0;
var e = o.a.getConfig('plugin_api') || {},
t = e.disableHook,
n = e.disableHookFetch,
r = e.disableHookXHR,
i = e.disableHookMtop;
if (!0 !== t) {
var a = O.hookXHR,
s = O.hookMtop;
!0 !== n && (0, O.hookFetch)(), !0 !== r && a(), !0 !== i && s();
}
}
})();
t.default = { sendApi: s };
},