Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
web-monitor-ukl
Advanced tools
- debug 调试
- info 信息
- notice 通知,注意
- warning 警告
- error 错误
- critical 危险的
- alert 弹出警告
- emergency 紧急情况,突发事件
后三个,危险的、警告、紧急情况,这三者应该都在系统运行时检测到了一个不正常的状态。
使用
什么时候使用 debug,info,notice,warning,error
疑问: 错误格式的统一问题(js 语法报错,资源加载类型的错误,资源载错误的严重程度)
开会的目的
!function() {
var e = window;
function n(n) {
if (e.g_monitor && e.g_monitor.events) {
var t = e.g_monitor.events;
t.length < 20 && t.push(n)
}
}
e.g_monitor = e.g_monitor || {
listener: {},
events: []
};
var r = e.g_monitor.listener;
function t(t, n) {
try {
e.addEventListener ? e.addEventListener(t, n, !0) : e.attachEvent ? e.attachEvent("on" + t, n) : e[t] = n,
r[t] = n
} catch(n) {
console.warn("Tracert 监控事件注册失败:" + t, n)
}
}
r.error || t("error", n),
r.unhandledrejection || t("unhandledrejection", n)
} ();
!
function(t, e) {
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = t || self).YuyanMonitor = e()
} (this, (function() {
"use strict";
function _typeof(t) {
return (_typeof = "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
})(t)
}
function asyncGeneratorStep(t, e, r, n, o, i, a) {
try {
var c = t[i](a),
s = c.value
} catch(t) {
return void r(t)
}
c.done ? e(s) : Promise.resolve(s).then(n, o)
}
function _asyncToGenerator(t) {
return function() {
var e = this,
r = arguments;
return new Promise((function(n, o) {
var i = t.apply(e, r);
function a(t) {
asyncGeneratorStep(i, n, o, a, c, "next", t)
}
function c(t) {
asyncGeneratorStep(i, n, o, a, c, "throw", t)
}
a(void 0)
}))
}
}
function _classCallCheck(t, e) {
if (! (t instanceof e)) throw new TypeError("Cannot call a class as a function")
}
function _defineProperties(t, e) {
for (var r = 0; e.length > r; r++) {
var n = e[r];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value" in n && (n.writable = !0),
Object.defineProperty(t, n.key, n)
}
}
function _createClass(t, e, r) {
return e && _defineProperties(t.prototype, e),
r && _defineProperties(t, r),
t
}
function _defineProperty(t, e, r) {
return e in t ? Object.defineProperty(t, e, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[e] = r,
t
}
function ownKeys(t, e) {
var r = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(t);
e && (n = n.filter((function(e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
}))),
r.push.apply(r, n)
}
return r
}
function _objectSpread2(t) {
for (var e = 1; arguments.length > e; e++) {
var r = null != arguments[e] ? arguments[e] : {};
e % 2 ? ownKeys(Object(r), !0).forEach((function(e) {
_defineProperty(t, e, r[e])
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : ownKeys(Object(r)).forEach((function(e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e))
}))
}
return t
}
function _inherits(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
writable: !0,
configurable: !0
}
}),
e && _setPrototypeOf(t, e)
}
function _getPrototypeOf(t) {
return (_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf: function(t) {
return t.__proto__ || Object.getPrototypeOf(t)
})(t)
}
function _setPrototypeOf(t, e) {
return (_setPrototypeOf = Object.setPrototypeOf ||
function(t, e) {
return t.__proto__ = e,
t
})(t, e)
}
function _isNativeReflectConstruct() {
if ("undefined" == typeof Reflect || !Reflect.construct) return ! 1;
if (Reflect.construct.sham) return ! 1;
if ("function" == typeof Proxy) return ! 0;
try {
return Date.prototype.toString.call(Reflect.construct(Date, [], (function() {}))),
!0
} catch(t) {
return ! 1
}
}
function _assertThisInitialized(t) {
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t
}
function _possibleConstructorReturn(t, e) {
return ! e || "object" != typeof e && "function" != typeof e ? _assertThisInitialized(t) : e
}
function _createSuper(t) {
var e = _isNativeReflectConstruct();
return function() {
var r, n = _getPrototypeOf(t);
if (e) {
var o = _getPrototypeOf(this).constructor;
r = Reflect.construct(n, arguments, o)
} else r = n.apply(this, arguments);
return _possibleConstructorReturn(this, r)
}
}
function _toArray(t) {
return _arrayWithHoles(t) || _iterableToArray(t) || _unsupportedIterableToArray(t) || _nonIterableRest()
}
function _arrayWithHoles(t) {
if (Array.isArray(t)) return t
}
function _iterableToArray(t) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(t)) return Array.from(t)
}
function _unsupportedIterableToArray(t, e) {
if (t) {
if ("string" == typeof t) return _arrayLikeToArray(t, e);
var r = Object.prototype.toString.call(t).slice(8, -1);
return "Object" === r && t.constructor && (r = t.constructor.name),
"Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _arrayLikeToArray(t, e) : void 0
}
}
function _arrayLikeToArray(t, e) { (null == e || e > t.length) && (e = t.length);
for (var r = 0,
n = Array(e); e > r; r++) n[r] = t[r];
return n
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}
var commonjsGlobal = "undefined" != typeof globalThis ? globalThis: "undefined" != typeof window ? window: "undefined" != typeof global ? global: "undefined" != typeof self ? self: {};
function createCommonjsModule(t, e) {
return t(e = {
exports: {}
},
e.exports),
e.exports
}
var runtime_1 = createCommonjsModule((function(t) {
var e = function(t) {
var e = Object.prototype,
r = e.hasOwnProperty,
n = "function" == typeof Symbol ? Symbol: {},
o = n.iterator || "@@iterator",
i = n.asyncIterator || "@@asyncIterator",
a = n.toStringTag || "@@toStringTag";
function c(t, e, r) {
return Object.defineProperty(t, e, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}),
t[e]
}
try {
c({},
"")
} catch(t) {
c = function(t, e, r) {
return t[e] = r
}
}
function s(t, e, r, n) {
var o = Object.create((e && e.prototype instanceof l ? e: l).prototype),
i = new C(n || []);
return o._invoke = function(t, e, r) {
var n = "suspendedStart";
return function(o, i) {
if ("executing" === n) throw Error("Generator is already running");
if ("completed" === n) {
if ("throw" === o) throw i;
return A()
}
for (r.method = o, r.arg = i;;) {
var a = r.delegate;
if (a) {
var c = _(a, r);
if (c) {
if (c === f) continue;
return c
}
}
if ("next" === r.method) r.sent = r._sent = r.arg;
else if ("throw" === r.method) {
if ("suspendedStart" === n) throw n = "completed",
r.arg;
r.dispatchException(r.arg)
} else "return" === r.method && r.abrupt("return", r.arg);
n = "executing";
var s = u(t, e, r);
if ("normal" === s.type) {
if (n = r.done ? "completed": "suspendedYield", s.arg === f) continue;
return {
value: s.arg,
done: r.done
}
}
"throw" === s.type && (n = "completed", r.method = "throw", r.arg = s.arg)
}
}
} (t, r, i),
o
}
function u(t, e, r) {
try {
return {
type: "normal",
arg: t.call(e, r)
}
} catch(t) {
return {
type: "throw",
arg: t
}
}
}
t.wrap = s;
var f = {};
function l() {}
function d() {}
function p() {}
var h = {};
h[o] = function() {
return this
};
var y = Object.getPrototypeOf,
m = y && y(y(S([])));
m && m !== e && r.call(m, o) && (h = m);
var g = p.prototype = l.prototype = Object.create(h);
function v(t) { ["next", "throw", "return"].forEach((function(e) {
c(t, e, (function(t) {
return this._invoke(e, t)
}))
}))
}
function b(t, e) {
var n;
this._invoke = function(o, i) {
function a() {
return new e((function(n, a) { !
function n(o, i, a, c) {
var s = u(t[o], t, i);
if ("throw" !== s.type) {
var f = s.arg,
l = f.value;
return l && "object" == typeof l && r.call(l, "__await") ? e.resolve(l.__await).then((function(t) {
n("next", t, a, c)
}), (function(t) {
n("throw", t, a, c)
})) : e.resolve(l).then((function(t) {
f.value = t,
a(f)
}), (function(t) {
return n("throw", t, a, c)
}))
}
c(s.arg)
} (o, i, n, a)
}))
}
return n = n ? n.then(a, a) : a()
}
}
function _(t, e) {
var r = t.iterator[e.method];
if (void 0 === r) {
if (e.delegate = null, "throw" === e.method) {
if (t.iterator.
return && (e.method = "return", e.arg = void 0, _(t, e), "throw" === e.method)) return f;
e.method = "throw",
e.arg = new TypeError("The iterator does not provide a 'throw' method")
}
return f
}
var n = u(r, t.iterator, e.arg);
if ("throw" === n.type) return e.method = "throw",
e.arg = n.arg,
e.delegate = null,
f;
var o = n.arg;
return o ? o.done ? (e[t.resultName] = o.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next", e.arg = void 0), e.delegate = null, f) : o: (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f)
}
function w(t) {
var e = {
tryLoc: t[0]
};
1 in t && (e.catchLoc = t[1]),
2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]),
this.tryEntries.push(e)
}
function E(t) {
var e = t.completion || {};
e.type = "normal",
delete e.arg,
t.completion = e
}
function C(t) {
this.tryEntries = [{
tryLoc: "root"
}],
t.forEach(w, this),
this.reset(!0)
}
function S(t) {
if (t) {
var e = t[o];
if (e) return e.call(t);
if ("function" == typeof t.next) return t;
if (!isNaN(t.length)) {
var n = -1,
i = function e() {
for (; ++n < t.length;) if (r.call(t, n)) return e.value = t[n],
e.done = !1,
e;
return e.value = void 0,
e.done = !0,
e
};
return i.next = i
}
}
return {
next: A
}
}
function A() {
return {
value: void 0,
done: !0
}
}
return d.prototype = g.constructor = p,
p.constructor = d,
d.displayName = c(p, a, "GeneratorFunction"),
t.isGeneratorFunction = function(t) {
var e = "function" == typeof t && t.constructor;
return !! e && (e === d || "GeneratorFunction" === (e.displayName || e.name))
},
t.mark = function(t) {
return Object.setPrototypeOf ? Object.setPrototypeOf(t, p) : (t.__proto__ = p, c(t, a, "GeneratorFunction")),
t.prototype = Object.create(g),
t
},
t.awrap = function(t) {
return {
__await: t
}
},
v(b.prototype),
b.prototype[i] = function() {
return this
},
t.AsyncIterator = b,
t.async = function(e, r, n, o, i) {
void 0 === i && (i = Promise);
var a = new b(s(e, r, n, o), i);
return t.isGeneratorFunction(r) ? a: a.next().then((function(t) {
return t.done ? t.value: a.next()
}))
},
v(g),
c(g, a, "Generator"),
g[o] = function() {
return this
},
g.toString = function() {
return "[object Generator]"
},
t.keys = function(t) {
var e = [];
for (var r in t) e.push(r);
return e.reverse(),
function r() {
for (; e.length;) {
var n = e.pop();
if (n in t) return r.value = n,
r.done = !1,
r
}
return r.done = !0,
r
}
},
t.values = S,
C.prototype = {
constructor: C,
reset: function(t) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(E), !t) for (var e in this)"t" === e.charAt(0) && r.call(this, e) && !isNaN( + e.slice(1)) && (this[e] = void 0)
},
stop: function() {
this.done = !0;
var t = this.tryEntries[0].completion;
if ("throw" === t.type) throw t.arg;
return this.rval
},
dispatchException: function(t) {
if (this.done) throw t;
var e = this;
function n(r, n) {
return a.type = "throw",
a.arg = t,
e.next = r,
n && (e.method = "next", e.arg = void 0),
!!n
}
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
var i = this.tryEntries[o],
a = i.completion;
if ("root" === i.tryLoc) return n("end");
if (this.prev >= i.tryLoc) {
var c = r.call(i, "catchLoc"),
s = r.call(i, "finallyLoc");
if (c && s) {
if (i.catchLoc > this.prev) return n(i.catchLoc, !0);
if (i.finallyLoc > this.prev) return n(i.finallyLoc)
} else if (c) {
if (i.catchLoc > this.prev) return n(i.catchLoc, !0)
} else {
if (!s) throw Error("try statement without catch or finally");
if (i.finallyLoc > this.prev) return n(i.finallyLoc)
}
}
}
},
abrupt: function(t, e) {
for (var n = this.tryEntries.length - 1; n >= 0; --n) {
var o = this.tryEntries[n];
if (this.prev >= o.tryLoc && r.call(o, "finallyLoc") && o.finallyLoc > this.prev) {
var i = o;
break
}
} ! i || "break" !== t && "continue" !== t || i.tryLoc > e || e > i.finallyLoc || (i = null);
var a = i ? i.completion: {};
return a.type = t,
a.arg = e,
i ? (this.method = "next", this.next = i.finallyLoc, f) : this.complete(a)
},
complete: function(t, e) {
if ("throw" === t.type) throw t.arg;
return "break" === t.type || "continue" === t.type ? this.next = t.arg: "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e),
f
},
finish: function(t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var r = this.tryEntries[e];
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc),
E(r),
f
}
},
catch: function(t) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var r = this.tryEntries[e];
if (r.tryLoc === t) {
var n = r.completion;
if ("throw" === n.type) {
var o = n.arg;
E(r)
}
return o
}
}
throw Error("illegal catch attempt")
},
delegateYield: function(t, e, r) {
return this.delegate = {
iterator: S(t),
resultName: e,
nextLoc: r
},
"next" === this.method && (this.arg = void 0),
f
}
},
t
} (t.exports);
try {
regeneratorRuntime = e
} catch(t) {
Function("r", "regeneratorRuntime = r")(e)
}
}));
function _typeof$1(t) {
return (_typeof$1 = "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
})(t)
}
function _classCallCheck$1(t, e) {
if (! (t instanceof e)) throw new TypeError("Cannot call a class as a function")
}
function _defineProperties$1(t, e) {
for (var r = 0; e.length > r; r++) {
var n = e[r];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value" in n && (n.writable = !0),
Object.defineProperty(t, n.key, n)
}
}
function _createClass$1(t, e, r) {
return e && _defineProperties$1(t.prototype, e),
r && _defineProperties$1(t, r),
t
}
function _slicedToArray(t, e) {
return _arrayWithHoles$1(t) || _iterableToArrayLimit(t, e) || _unsupportedIterableToArray$1(t, e) || _nonIterableRest$1()
}
function _toConsumableArray(t) {
return _arrayWithoutHoles(t) || _iterableToArray$1(t) || _unsupportedIterableToArray$1(t) || _nonIterableSpread()
}
function _arrayWithoutHoles(t) {
if (Array.isArray(t)) return _arrayLikeToArray$1(t)
}
function _arrayWithHoles$1(t) {
if (Array.isArray(t)) return t
}
function _iterableToArray$1(t) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(t)) return Array.from(t)
}
function _iterableToArrayLimit(t, e) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(t)) {
var r = [],
n = !0,
o = !1,
i = void 0;
try {
for (var a, c = t[Symbol.iterator](); ! (n = (a = c.next()).done) && (r.push(a.value), !e || r.length !== e); n = !0);
} catch(t) {
o = !0,
i = t
} finally {
try {
n || null == c.
return || c.
return ()
} finally {
if (o) throw i
}
}
return r
}
}
function _unsupportedIterableToArray$1(t, e) {
if (t) {
if ("string" == typeof t) return _arrayLikeToArray$1(t, e);
var r = Object.prototype.toString.call(t).slice(8, -1);
return "Object" === r && t.constructor && (r = t.constructor.name),
"Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _arrayLikeToArray$1(t, e) : void 0
}
}
function _arrayLikeToArray$1(t, e) { (null == e || e > t.length) && (e = t.length);
for (var r = 0,
n = Array(e); e > r; r++) n[r] = t[r];
return n
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}
function _nonIterableRest$1() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}
var checkEnv = function(t) {
return function() {
if (!t || !t.navigator || !t.navigator.userAgent) return "";
var e = t.navigator.userAgent,
r = "";
return !! e.match(/iphone|ipad|iPod/gi) && (r = "iOS"),
!!e.match(/android/gi) && (r = "Android"),
!!e.match(/Firefox/gi) && (r = "Firefox"),
!!e.match(/Chrome/gi) && (r = "Chrome"),
!e.match(/Chrome/gi) && !!e.match(/Safari/gi) && (r = "Safari"),
!!e.match(/Opera/gi) && (r = "Opera"),
!!e.match(/MSIE/gi) && (r = "IE"),
r
}
} (void 0);
function checkAndriodSpecial() {
return ! 0
}
var generateHandler = function(t) {
switch (t) {
case "iOS":
return {
filter:
function(t) {
return 0 > t.indexOf("[native code]") && t.indexOf("@") >= 0
}
};
case "Android":
return {
filter:
function(t, e) {
return e && 0 > t.indexOf("nonymous") && checkAndriodSpecial()
}
};
default:
return {
filter:
function() {
return ! 0
}
}
}
};
function safeAdd(t, e) {
var r = (65535 & t) + (65535 & e);
return (t >> 16) + (e >> 16) + (r >> 16) << 16 | 65535 & r
}
function bitRotateLeft(t, e) {
return t << e | t >>> 32 - e
}
function md5cmn(t, e, r, n, o, i) {
return safeAdd(bitRotateLeft(safeAdd(safeAdd(e, t), safeAdd(n, i)), o), r)
}
function md5ff(t, e, r, n, o, i, a) {
return md5cmn(e & r | ~e & n, t, e, o, i, a)
}
function md5gg(t, e, r, n, o, i, a) {
return md5cmn(e & n | r & ~n, t, e, o, i, a)
}
function md5hh(t, e, r, n, o, i, a) {
return md5cmn(e ^ r ^ n, t, e, o, i, a)
}
function md5ii(t, e, r, n, o, i, a) {
return md5cmn(r ^ (e | ~n), t, e, o, i, a)
}
function binlMD5(t, e) {
var r, n, o, i, a;
t[e >> 5] |= 128 << e % 32,
t[14 + (e + 64 >>> 9 << 4)] = e;
var c = 1732584193,
s = -271733879,
u = -1732584194,
f = 271733878;
for (r = 0; t.length > r; r += 16) n = c,
o = s,
i = u,
a = f,
c = md5ff(c, s, u, f, t[r], 7, -680876936),
f = md5ff(f, c, s, u, t[r + 1], 12, -389564586),
u = md5ff(u, f, c, s, t[r + 2], 17, 606105819),
s = md5ff(s, u, f, c, t[r + 3], 22, -1044525330),
c = md5ff(c, s, u, f, t[r + 4], 7, -176418897),
f = md5ff(f, c, s, u, t[r + 5], 12, 1200080426),
u = md5ff(u, f, c, s, t[r + 6], 17, -1473231341),
s = md5ff(s, u, f, c, t[r + 7], 22, -45705983),
c = md5ff(c, s, u, f, t[r + 8], 7, 1770035416),
f = md5ff(f, c, s, u, t[r + 9], 12, -1958414417),
u = md5ff(u, f, c, s, t[r + 10], 17, -42063),
s = md5ff(s, u, f, c, t[r + 11], 22, -1990404162),
c = md5ff(c, s, u, f, t[r + 12], 7, 1804603682),
f = md5ff(f, c, s, u, t[r + 13], 12, -40341101),
u = md5ff(u, f, c, s, t[r + 14], 17, -1502002290),
c = md5gg(c, s = md5ff(s, u, f, c, t[r + 15], 22, 1236535329), u, f, t[r + 1], 5, -165796510),
f = md5gg(f, c, s, u, t[r + 6], 9, -1069501632),
u = md5gg(u, f, c, s, t[r + 11], 14, 643717713),
s = md5gg(s, u, f, c, t[r], 20, -373897302),
c = md5gg(c, s, u, f, t[r + 5], 5, -701558691),
f = md5gg(f, c, s, u, t[r + 10], 9, 38016083),
u = md5gg(u, f, c, s, t[r + 15], 14, -660478335),
s = md5gg(s, u, f, c, t[r + 4], 20, -405537848),
c = md5gg(c, s, u, f, t[r + 9], 5, 568446438),
f = md5gg(f, c, s, u, t[r + 14], 9, -1019803690),
u = md5gg(u, f, c, s, t[r + 3], 14, -187363961),
s = md5gg(s, u, f, c, t[r + 8], 20, 1163531501),
c = md5gg(c, s, u, f, t[r + 13], 5, -1444681467),
f = md5gg(f, c, s, u, t[r + 2], 9, -51403784),
u = md5gg(u, f, c, s, t[r + 7], 14, 1735328473),
c = md5hh(c, s = md5gg(s, u, f, c, t[r + 12], 20, -1926607734), u, f, t[r + 5], 4, -378558),
f = md5hh(f, c, s, u, t[r + 8], 11, -2022574463),
u = md5hh(u, f, c, s, t[r + 11], 16, 1839030562),
s = md5hh(s, u, f, c, t[r + 14], 23, -35309556),
c = md5hh(c, s, u, f, t[r + 1], 4, -1530992060),
f = md5hh(f, c, s, u, t[r + 4], 11, 1272893353),
u = md5hh(u, f, c, s, t[r + 7], 16, -155497632),
s = md5hh(s, u, f, c, t[r + 10], 23, -1094730640),
c = md5hh(c, s, u, f, t[r + 13], 4, 681279174),
f = md5hh(f, c, s, u, t[r], 11, -358537222),
u = md5hh(u, f, c, s, t[r + 3], 16, -722521979),
s = md5hh(s, u, f, c, t[r + 6], 23, 76029189),
c = md5hh(c, s, u, f, t[r + 9], 4, -640364487),
f = md5hh(f, c, s, u, t[r + 12], 11, -421815835),
u = md5hh(u, f, c, s, t[r + 15], 16, 530742520),
c = md5ii(c, s = md5hh(s, u, f, c, t[r + 2], 23, -995338651), u, f, t[r], 6, -198630844),
f = md5ii(f, c, s, u, t[r + 7], 10, 1126891415),
u = md5ii(u, f, c, s, t[r + 14], 15, -1416354905),
s = md5ii(s, u, f, c, t[r + 5], 21, -57434055),
c = md5ii(c, s, u, f, t[r + 12], 6, 1700485571),
f = md5ii(f, c, s, u, t[r + 3], 10, -1894986606),
u = md5ii(u, f, c, s, t[r + 10], 15, -1051523),
s = md5ii(s, u, f, c, t[r + 1], 21, -2054922799),
c = md5ii(c, s, u, f, t[r + 8], 6, 1873313359),
f = md5ii(f, c, s, u, t[r + 15], 10, -30611744),
u = md5ii(u, f, c, s, t[r + 6], 15, -1560198380),
s = md5ii(s, u, f, c, t[r + 13], 21, 1309151649),
c = md5ii(c, s, u, f, t[r + 4], 6, -145523070),
f = md5ii(f, c, s, u, t[r + 11], 10, -1120210379),
u = md5ii(u, f, c, s, t[r + 2], 15, 718787259),
s = md5ii(s, u, f, c, t[r + 9], 21, -343485551),
c = safeAdd(c, n),
s = safeAdd(s, o),
u = safeAdd(u, i),
f = safeAdd(f, a);
return [c, s, u, f]
}
function binl2rstr(t) {
var e, r = "",
n = 32 * t.length;
for (e = 0; n > e; e += 8) r += String.fromCharCode(t[e >> 5] >>> e % 32 & 255);
return r
}
function rstr2binl(t) {
var e, r = [];
for (r[(t.length >> 2) - 1] = void 0, e = 0; r.length > e; e += 1) r[e] = 0;
var n = 8 * t.length;
for (e = 0; n > e; e += 8) r[e >> 5] |= (255 & t.charCodeAt(e / 8)) << e % 32;
return r
}
function rstrMD5(t) {
return binl2rstr(binlMD5(rstr2binl(t), 8 * t.length))
}
function rstrHMACMD5(t, e) {
var r, n, o = rstr2binl(t),
i = [],
a = [];
for (i[15] = a[15] = void 0, o.length > 16 && (o = binlMD5(o, 8 * t.length)), r = 0; 16 > r; r += 1) i[r] = 909522486 ^ o[r],
a[r] = 1549556828 ^ o[r];
return n = binlMD5(i.concat(rstr2binl(e)), 512 + 8 * e.length),
binl2rstr(binlMD5(a.concat(n), 640))
}
function rstr2hex(t) {
var e, r, n = "";
for (r = 0; t.length > r; r += 1) e = t.charCodeAt(r),
n += "0123456789abcdef".charAt(e >>> 4 & 15) + "0123456789abcdef".charAt(15 & e);
return n
}
function str2rstrUTF8(t) {
return unescape(encodeURIComponent(t))
}
function rawMD5(t) {
return rstrMD5(str2rstrUTF8(t))
}
function hexMD5(t) {
return rstr2hex(rawMD5(t))
}
function rawHMACMD5(t, e) {
return rstrHMACMD5(str2rstrUTF8(t), str2rstrUTF8(e))
}
function hexHMACMD5(t, e) {
return rstr2hex(rawHMACMD5(t, e))
}
function md5(t, e, r) {
return e ? r ? rawHMACMD5(e, t) : hexHMACMD5(e, t) : r ? rawMD5(t) : hexMD5(t)
}
var ErrorStack = function() {
function t(e) {
_classCallCheck$1(this, t),
this.env = e || checkEnv(),
this.stackFilter = generateHandler(this.env).filter
}
return _createClass$1(t, [{
key: "makeReg",
value: function() {
switch (this.env) {
case "iOS":
return /(?:\s*)\w+(?=@)|(?:@).*?(?=:\d*:)|(?::)\d*(?=:)|(?::)\d*$/g;
default:
return null
}
}
},
{
key: "stackFormatter",
value: function(t) {
var e = t.message,
r = [],
n = "Android" === this.env,
o = "iOS" === this.env,
i = t.stack.split("\n").filter(this.stackFilter);
i.shift();
var a = i.join("\n"),
c = this.makeReg();
return c ? i.map((function(t) {
var e = t.match(c);
if (e) {
var i = _slicedToArray(e, 4),
a = i[0],
s = void 0 === a ? "": a,
u = i[1],
f = void 0 === u ? "": u,
l = i[2],
d = void 0 === l ? "": l,
p = i[3],
h = void 0 === p ? "": p,
y = n ? s.split(".").reverse()[0] : s,
m = o ? 1 : 0;
r.push("at ".concat(y, " (").concat(f.substr(m), ":").concat(d.substr(m), ":").concat(h.substr(m), ")"))
} else r.push(t);
return null
})) : r = i,
{
hash: this.encryptStack(e, r),
message: e,
stackList: r,
stackStr: a
}
}
},
{
key: "encryptStack",
value: function(t, e) {
var r = [].concat(_toConsumableArray(e.slice(0, 6)), _toConsumableArray(e.slice(7, 8)), _toConsumableArray(e.slice(9, 10)), _toConsumableArray(e.slice(11, 12)), _toConsumableArray(e.slice(13, 14))).join(";");
return md5("".concat(t, ":").concat(r))
}
}]),
t
} (),
STACK_LENGTH_LIMIT = 20,
ChromeREGEX = /^\s*at .*? ?\(((?:file|https?|blob|chrome-extension|native|eval|<anonymous>).*?)(?::\d+)?(?::\d+)?\)?\s*$/i,
GeckoREGEX = /^\s*.*?(?:\(.*?\))?(?:^|@)((?:file|https?|blob|chrome|resource|\[native).*?)(?::\d+)?(?::\d+)?\s*$/i,
WinJSREGEX = /^\s*at (?:(?:\[object object\])?.+ )?\(?((?:file|ms-appx|https?|blob):.*?):\d+(?::\d+)?\)?\s*$/i;
function parseStack(t) {
for (var e = t.slice(0, STACK_LENGTH_LIMIT), r = ["", ""], n = {},
o = 1, i = 0; e.length > i; i += 1) {
var a = ChromeREGEX,
c = (e[i] || "").match(a);
if (null === c && (c = (e[i] || "").match(a = GeckoREGEX)), null === c && (c = (e[i] || "").match(a = WinJSREGEX)), null !== c) {
var s = c[1],
u = n[s];
void 0 === u && (n[s] = "#".concat(o, "#"), o += 1, u = n[s]),
e[i] = e[i].replace(s, u)
}
}
e.length > 0 && (r[1] = e.map((function(t) {
return t.trim()
})).join(""));
var f = "";
for (var l in n) n.hasOwnProperty(l) && (f += "".concat(l, "@").concat(n[l], ";"));
return f = f.replace(/;$/, ""),
r[0] = f,
r.join("").replace(/\^/g, "").replace(/=/g, "").replace(/,/g, "")
}
function unParseStack(t) {
var e = t && t.split("") || [];
if (!e[0] || !e[1]) return t;
for (var r = {},
n = e[0].split(";"), o = 0; n.length > o; o += 1) {
var i = n[o] && n[o].split("@#");
r["#".concat(i[1])] = i[0]
}
return e[1].replace(/#[0-9]+#/g, (function(t) {
return r[t] || ""
})).replace(/\u0004/g, "^").replace(/\u0005/g, "=").replace(/\u0006/g, ",").split("")
}
"undefined" == typeof process || _typeof$1(process);
var helper = {
compressStack: function(t) {
return parseStack(t)
},
uncompressStack: function(t) {
return unParseStack(t)
}
},
compressStack = helper.compressStack;
function _typeof$2(t) {
return (_typeof$2 = "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
})(t)
}
function _classCallCheck$2(t, e) {
if (! (t instanceof e)) throw new TypeError("Cannot call a class as a function")
}
function _defineProperties$2(t, e) {
for (var r = 0; e.length > r; r++) {
var n = e[r];
n.enumerable = n.enumerable || !1,
n.configurable = !0,
"value" in n && (n.writable = !0),
Object.defineProperty(t, n.key, n)
}
}
function _createClass$2(t, e, r) {
return e && _defineProperties$2(t.prototype, e),
r && _defineProperties$2(t, r),
t
}
function _defineProperty$1(t, e, r) {
return e in t ? Object.defineProperty(t, e, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[e] = r,
t
}
function ownKeys$1(t, e) {
var r = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(t);
e && (n = n.filter((function(e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
}))),
r.push.apply(r, n)
}
return r
}
function _objectSpread2$1(t) {
for (var e = 1; arguments.length > e; e++) {
var r = null != arguments[e] ? arguments[e] : {};
e % 2 ? ownKeys$1(Object(r), !0).forEach((function(e) {
_defineProperty$1(t, e, r[e])
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : ownKeys$1(Object(r)).forEach((function(e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e))
}))
}
return t
}
function _toConsumableArray$1(t) {
return _arrayWithoutHoles$1(t) || _iterableToArray$2(t) || _unsupportedIterableToArray$2(t) || _nonIterableSpread$1()
}
function _arrayWithoutHoles$1(t) {
if (Array.isArray(t)) return _arrayLikeToArray$2(t)
}
function _iterableToArray$2(t) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(t)) return Array.from(t)
}
function _unsupportedIterableToArray$2(t, e) {
if (t) {
if ("string" == typeof t) return _arrayLikeToArray$2(t, e);
var r = Object.prototype.toString.call(t).slice(8, -1);
return "Object" === r && t.constructor && (r = t.constructor.name),
"Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _arrayLikeToArray$2(t, e) : void 0
}
}
function _arrayLikeToArray$2(t, e) { (null == e || e > t.length) && (e = t.length);
for (var r = 0,
n = Array(e); e > r; r++) n[r] = t[r];
return n
}
function _nonIterableSpread$1() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}
function _createForOfIteratorHelper(t, e) {
var r;
if ("undefined" == typeof Symbol || null == t[Symbol.iterator]) {
if (Array.isArray(t) || (r = _unsupportedIterableToArray$2(t)) || e && t && "number" == typeof t.length) {
r && (t = r);
var n = 0,
o = function() {};
return {
s: o,
n: function() {
return t.length > n ? {
done: !1,
value: t[n++]
}: {
done: !0
}
},
e: function(t) {
throw t
},
f: o
}
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}
var i, a = !0,
c = !1;
return {
s: function() {
r = t[Symbol.iterator]()
},
n: function() {
var t = r.next();
return a = t.done,
t
},
e: function(t) {
c = !0,
i = t
},
f: function() {
try {
a || null == r.
return || r.
return ()
} finally {
if (c) throw i
}
}
}
}
function allFieldsReady(t) {
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [],
r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function() {};
if (!e.length) return ! 0;
var n, o = _createForOfIteratorHelper(e);
try {
for (o.s(); ! (n = o.n()).done;) {
var i = n.value;
if (null == t[i]) return r && r('Field "'.concat(i, '" is required. Log cached.')),
!1
}
} catch(t) {
o.e(t)
} finally {
o.f()
}
return ! 0
}
function shallowMerge(t, e) {
for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r])
}
function objectAssign(t, e) {
if (!e || "object" !== _typeof$2(e)) return t;
var r = t || {};
for (var n in e) e.hasOwnProperty(n) && void 0 !== e[n] && (r[n] = e[n]);
return r
}
function getProperty(t, e) {
for (var r = e.split("."), n = 0; r.length - 1 > n; n++) if ("object" !== _typeof$2(t = t[r[n]]) || !t || Array.isArray(t)) return "";
return t[r.pop()]
}
function setProperty(t, e, r) {
for (var n = e.split("."), o = 0; n.length - 1 > o; o++) {
if ("object" !== _typeof$2(t[n[o]]) && void 0 !== t[n[o]]) return;
if (Array.isArray(t[n[o]])) return;
t[n[o]] || (t[n[o]] = {}),
t = t[n[o]]
}
t[n.pop()] = r
}
var OptionsDefaulter = function() {
function t() {
_classCallCheck$2(this, t),
this.defaults = {},
this.configs = {}
}
return _createClass$2(t, [{
key: "set",
value: function(t, e, r) {
void 0 !== r ? (this.defaults[t] = r, this.configs[t] = e) : (this.defaults[t] = e, delete this.configs[t])
}
},
{
key: "process",
value: function(t) {
var e;
for (var r in t = objectAssign({},
t), this.defaults) if (this.defaults.hasOwnProperty(r)) switch (this.configs[r]) {
case "call":
setProperty(t, r, this.defaults[r].call(this, getProperty(t, r), t));
break;
case "make":
void 0 === getProperty(t, r) && setProperty(t, r, this.defaults[r].call(this, t));
break;
case "append":
var n = getProperty(t, r);
Array.isArray(n) || (n = []),
(e = n).push.apply(e, _toConsumableArray$1(this.defaults[r])),
setProperty(t, r, n);
break;
default:
void 0 === getProperty(t, r) && setProperty(t, r, this.defaults[r])
}
return t
}
}]),
t
} ();
function nodeListToArray(t) {
var e, r;
try {
return e = [].slice.call(t)
} catch(o) {
e = [],
r = t.length;
for (var n = 0; r > n; n++) e.push(t[n]);
return e
}
}
function getAttr(t, e) {
return t && t.getAttribute && t.getAttribute(e) || ""
}
var warnCache = {},
defaulterSingleton;
function warnDeprecated(t, e) {
console && console.warn && !warnCache[t] && (warnCache[t] = 1, console.warn("閰嶇疆椤� [".concat(t, "] 宸蹭笉鎺ㄨ崘浣跨敤銆傝浣跨敤 [").concat(e, "]銆�")))
}
function getGlobal() {
return eval ? (0, eval)("this") : global || window
}
function getOptionsDefaulter() {
return defaulterSingleton || (defaulterSingleton = createOptionsDefaulter()),
defaulterSingleton
}
var getMetaInfo = function(t) {
return function(e) {
var r;
if (! (null == t || null === (r = t.document) || void 0 === r ? void 0 : r.querySelectorAll)) return "";
for (var n = nodeListToArray(t.document.querySelectorAll("meta")), o = 0; n.length > o; o++) {
var i = n[o];
if (getAttr(i, "name") === e) return getAttr(i, "content")
}
return null
}
} (getGlobal()),
metaMap = {
_appId: "bm_app_id",
yuyanId: "yuyan_id",
sprintId: "bm_sprint_id"
};
function getMetaOptions() {
var t = {};
for (var e in metaMap) if (metaMap.hasOwnProperty(e)) {
var r = getMetaInfo(metaMap[e]);
r && (t[e] = r)
}
return t
}
function createOptionsDefaulter() {
var t = new OptionsDefaulter,
e = getMetaOptions();
return t.set("bmAppid", "call", (function(t, r) {
return t ? (warnDeprecated("bmAppid", "_appId"), t) : r.appid ? (warnDeprecated("appid", "_appId"), r.appid) : r._appId || e._appId
})),
t.set("yuyanId", "call", (function(t) {
return t || e.yuyanId
})),
t.set("userId", "call", (function(t, e) {
return e.roleId ? (warnDeprecated("roleId", "userId"), e.roleId) : t
})),
t.set("disableInterface", "call", (function(t) {
return t || !1
})),
t.set("oncePerSession", "call", (function(t) {
return t || !1
})),
t.set("autoCapture", "call", (function(t, e) {
return ! e.hasOwnProperty("autoCapture") || !!e.autoCapture
})),
t.set("defaults", "call", (function(t) {
return objectAssign({},
t)
})),
t.set("sprintId", "call", (function(t) {
return t || e.sprintId
})),
t.set("requiredFields", "call", (function(t) {
return Array.isArray(t) ? t: "string" == typeof t ? [t] : []
})),
t.set("eventId", "call", (function(t, e) {
return "PC" === e.appType ? "102022": "102023"
})),
t.set("beforeLog", "call", (function(t) {
if ("function" == typeof t) return t
})),
t.set("callBridge", "call", (function(t) {
if ("function" == typeof t) return t
})),
t.set("plugins", "call", (function(t) {
return Array.isArray(t) ? t: ["performance", "buc"]
})),
t
}
var ErrorCodeEnums = {
JS: 1,
REQUEST: 2,
PROMISEREJECTION: 3,
ASSETS: 4
},
enums = Object.freeze({
__proto__: null,
ErrorCodeEnums: ErrorCodeEnums
}),
es = new ErrorStack;
function logError(t, e, r) {
var n = r.log,
o = r._warn,
i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
try {
var a = (null == i ? void 0 : i.code) || ErrorCodeEnums.JS,
c = "";
if (t) if (t.stack) {
var s = es.stackFormatter(t),
u = s.hash,
f = s.stackList;
c = u,
u && f && f.length && e(u).then((function(t) {
t || n(_objectSpread2$1(_objectSpread2$1({},
i), {},
{
code: ErrorCodeEnums.JS,
s1: u,
s2: compressStack(f),
s3: 1
}))
})).
catch((function(t) {
o("hash妫€娴嬪け璐�", t)
})),
n(_objectSpread2$1({
code: a,
msg: t.message,
s10: c
},
i))
} else n(_objectSpread2$1({
code: a,
msg: t.message || t
},
i))
} catch(t) {
o("寮傚父涓婃姤澶辫触:", t)
}
}
var checkApp = function(t) {
var e = {},
r = t.match(/AliApp\S+\b\)/gi);
return e.is = !!/(T-UA)|(TBIOS)|(WindVane)|(AliApp)/i.test(t),
e.name = r ? r[0].match(/\(\w+\-*\w*/)[0].split("(")[1] : "",
e.version = r ? r[0].match(/(\d+\.*)+/gi)[0] : "",
e
},
checkApp_1 = checkApp,
encodeValue = function(t) {
return encodeURIComponent(t).replace(/'/g, "%27")
};
function objToStr(t) {
var e, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "^",
n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
o = [];
if (t instanceof Array) o = t;
else if (t instanceof Object) {
var i = n ? encodeValue: function(t) {
return t
};
for (e in t) if (t.hasOwnProperty(e)) {
var a = i(t[e]);
o.push("".concat(e, "=").concat(a))
}
}
return o.join(r)
}
function getTime() {
var t = new Date,
e = function(t) {
return 10 > t ? "0".concat(t) : "".concat(t)
};
return "".concat(t.getFullYear(), "-").concat(e(t.getMonth() + 1), "-").concat(e(t.getDate()), " ").concat(e(t.getHours()), ":").concat(e(t.getMinutes()), ":").concat(e(t.getSeconds()), ":").concat(t.getMilliseconds())
}
function parseItem(t) {
if (!t || "object" !== _typeof(t)) return [];
var e = t.eventId,
r = t.userId,
n = t.ua,
o = t.param4,
i = ["D-AE", getTime(), "", "", "2", "", "", r, "1000", e, "H5behavior", "2", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", n, "", "", "", "", "", ""];
return i.push(objToStr(o, "^", !0)),
i
}
function objectAssign$1(t, e) {
var r = t || {};
if (!e || "object" !== _typeof(e)) return r;
for (var n in e) e.hasOwnProperty(n) && void 0 !== e[n] && (r[n] = e[n]);
return r
}
function checkIsAlipay(t) {
var e = t && t.userAgent;
if (!e) return ! 1;
var r = checkApp_1(e);
return ["AP", "AF", "AFW", "BK", "AM", "APHK", "KB"].indexOf(r.name) >= 0
}
function applyMixins(t, e) {
e.forEach((function(e) {
Object.getOwnPropertyNames(e.prototype).forEach((function(r) {
"constructor" !== r && (t.prototype[r] = e.prototype[r])
}))
}))
}
function addEvent(t, e, r) {
var n = e || window.document;
n.addEventListener ? n.addEventListener(t, r, !0) : n.attachEvent ? n.attachEvent("on".concat(t), r) : n[t] = r
}
function removeEvent(t, e, r) {
var n = e || window.document;
n.removeEventListener ? n.removeEventListener(t, r, !0) : n.detachEvent ? n.detachEvent("on".concat(t), r) : n[t] = r
}
function generateIdentifier(t) {
return [t.code, t.uid, t.page, t.msg || ""].join("_")
}
function load(t) {
"interactive" === document.readyState || "complete" === document.readyState ? t() : addEvent("DOMContentLoaded", document, t)
}
function getAttr$1(t, e) {
return t && t.getAttribute && t.getAttribute(e) || ""
}
function nodeListToArray$1(t) {
var e, r;
try {
return e = [].slice.call(t)
} catch(o) {
e = [],
r = t.length;
for (var n = 0; r > n; n++) e.push(t[n]);
return e
}
}
function getXPath(t, e) {
var r = t.id ? "".concat(t.id) : "",
n = t.className ? "".concat(t.className) : "",
o = t.tagName.toLowerCase(),
i = r || n,
a = [];
r && a.push('[@id="'.concat(r, '"]')),
n && a.push('[@class="'.concat(n, '"]'));
var c = "".concat(o).concat(i ? a.join("") : "");
return t.parentNode && t.parentNode.tagName && e - 1 != 0 ? "".concat(getXPath(t.parentNode, e - 1), ">").concat(c) : c
}
function getResourceErrorSrc() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
e = t.src || t.href;
return "img" === t.tagName.toLowerCase() && 0 === e.indexOf("data:") && (e = e.split(",")[0]),
e
}
var spmDataKey = "data-aspm";
function getMetaSpm(t) {
for (var e, r, n, o, i = nodeListToArray$1(t || document.getElementsByTagName("meta")), a = i.length, c = 0; a > c; c++) if (r = getAttr$1(e = i[c], "name"), n = getAttr$1(e, "content"), r === spmDataKey && n) {
o = n;
break
}
var s = {};
return o && (s.spmAPos = o),
s
}
function getSpmBPos() {
return getAttr$1(document.body, spmDataKey)
}
var win = window;
function interfaceRegister(t) {
var e = !1;
if ("XMLHttpRequest" in win) {
var r = win.XMLHttpRequest.prototype,
n = r.open;
r.open = function(t, e) {
this.__interfaceMonitor__ = {
method: t,
url: e || "",
status_code: null
};
for (var r = Array(arguments.length), o = 0; r.length > o; ++o) r[o] = arguments[o];
n.apply(this, r)
};
var o = r.send;
r.send = function(r) {
var n = this;
function i() {
if (n.__interfaceMonitor__ && 4 === n.readyState) try {
var o = n.__interfaceMonitor__.url;
if (0 === n.status) return;
var i = o.split("?")[0],
a = o.split("?")[1] || "",
c = "string" == typeof r ? r: JSON.stringify(r),
s = n.response + "";
s.length > 2048 && (s = "[too large]");
if (200 > n.status || n.status > 299 || e) {
if (i === t.server) return void t._warn("涓婃姤寮傚父", c);
t.logRequestError({
type: "http",
status: n.status,
url: i,
method: n.__interfaceMonitor__.method,
query: a,
data: c,
response: s,
traceId: t.traceId || ""
})
}
} catch(e) {
t._warn("鎺ュ彛寮傚父涓婃姤澶辫触:", e)
}
}
if ("onreadystatechange" in n && "function" == typeof n.onreadystatechange) {
var a = n.onreadystatechange;
n.onreadystatechange = function() {
for (var t = Array(arguments.length), e = 0; t.length > e; ++e) t[e] = arguments[e];
i.apply(this, t),
a.apply(this, t)
}
} else n.onreadystatechange = i;
for (var c = Array(arguments.length), s = 0; c.length > s; ++s) c[s] = arguments[s];
return o.apply(this, arguments)
}
}
if ("fetch" in win) {
var i = win.fetch;
win.fetch = function() {
for (var r = Array(arguments.length), n = 0; r.length > n; ++n) r[n] = arguments[n];
var o = "GET";
return r[1] && r[1].method && (o = r[1].method.toUpperCase()),
i.apply(this, r).then((function(n) {
return new Promise((function(i) {
try {
var a = r[0],
c = a.split("?")[0],
s = a.split("?")[1] || "",
u = r[1] && r[1].body || "",
f = "string" == typeof u ? u: JSON.stringify(u);
n.clone().text().then((function(r) {
n.ok && !e || t.logRequestError({
type: "http",
status: n.status,
url: c,
method: o,
query: s,
data: f,
response: (r || "").length > 2048 ? "[too large]": r,
traceId: t.traceId || ""
})
})).then((function() {
i(n)
}), (function() {
i(n)
}))
} catch(t) {
i(n)
}
}))
}))
}
}
}
var version = "2.0.29",
spliter = "",
doc = document,
docEl = doc.documentElement,
LastAction = function() {
function t() {
var e = this;
_classCallCheck(this, t),
this.lastAction = "0".concat(getTime(), ""),
this.setLastActionTimer = !1,
addEvent("scroll", document, (function(t) {
e.setLastActionTimer || (e.setLastActionTimer = !0, setTimeout((function() {
e.setLastActionTimer = !1
}), 300), e.setLastAction(t))
})),
addEvent("click", document, (function(t) {
e.setLastAction(t)
}))
}
return _createClass(t, [{
key: "setLastAction",
value: function(t) {
try {
var e = [],
r = "click" === t.type;
e.push(r ? 1 : 2);
var n = r ? "".concat(getXPath(t.target, 5)) : "";
e.push(n),
e.push(getTime());
var o = r ? "".concat(t.x, "x").concat(t.y) : "".concat(docEl.scrollLeft + doc.body.scrollLeft, "x").concat(docEl.scrollTop + doc.body.scrollTop);
e.push(o);
var i = t.target && t.target.innerText,
a = i ? "".concat(i.slice(0, 8)) : "";
e.push(a),
this.lastAction = e.join(spliter)
} catch(t) {}
}
},
{
key: "get",
value: function() {
return this.lastAction
}
}]),
t
} (),
serverUrl = "https://mdap.alipay.com/loggw/dwcookieLogGet.do",
NAVIGATION_KEYS = ["connectEnd", "connectStart", "decodedBodySize", "domComplete", "domContentLoadedEventEnd", "domContentLoadedEventStart", "domInteractive", "domainLookupEnd", "domainLookupStart", "duration", "encodedBodySize", "fetchStart", "loadEventEnd", "loadEventStart", "redirectCount", "redirectEnd", "redirectStart", "requestStart", "responseEnd", "responseStart", "secureConnectionStart", "transferSize", "type", "unloadEventEnd", "unloadEventStart", "workerStart", "firstPaint", "firstContentfulPaint", "firstMeaningfulPaint"],
ErrorCodeEnums$1 = enums.ErrorCodeEnums,
doc$1 = document,
docEl$1 = doc$1.documentElement,
startTime = (new Date).getTime(),
Base = function() {
function t(e) {
_classCallCheck(this, t),
this.server = serverUrl,
this.userConfig = {},
this.defaults = {},
this.cOfflineVer = "",
this.cAppId = "",
this.cUserId = "",
this.trackedLogs = [],
this.requiredFields = [],
this.isErrorHandler = !1,
this.enabledPlugins = [];
var r = getOptionsDefaulter().process(e);
this.userConfig = r,
this.eventId = "102022",
this.bmAppid = r.bmAppid,
this.debug = r.debug || !1,
this.autoCapture = r.autoCapture,
this.disableInterface = r.disableInterface,
this.lastActionComp = new LastAction,
this.oncePerSession = r.oncePerSession,
this.beforeLog = r.beforeLog,
this.defaults = r.defaults || {},
this.requiredFields = r.requiredFields || [],
this.enabledPlugins = r.plugins
}
return _createClass(t, [{
key: "handleErrorEvent",
value: function(t, e) {
try {
var r = t.target || t.srcElement;
if (!r) return;
if ("unhandledrejection" === t.type) {
var n = t.reason || {};
if (n.message && n.stack) this.logError(n, {
code: ErrorCodeEnums$1.PROMISEREJECTION
});
else {
var o = n.message || ("string" == typeof n ? n: JSON.stringify(n));
e({
code: ErrorCodeEnums$1.PROMISEREJECTION,
msg: o
})
}
return
}
if (r instanceof HTMLElement) {
var i = getResourceErrorSrc(r),
a = r.tagName.toLowerCase(),
c = r.alt,
s = void 0 === c ? "": c;
return void e({
code: ErrorCodeEnums$1.ASSETS,
msg: i || "",
s1: a,
s2: getXPath(r, 5),
s3: s
})
}
if (t.error && t.error.stack) return void this.logError(t.error);
e({
code: ErrorCodeEnums$1.JS,
msg: t.message,
s3: 0
})
} catch(t) {
this._warn("handleErrorOptions failed", t)
}
}
},
{
key: "handlePreCapture",
value: function() {
var t = this,
e = window.g_monitor;
if (e) {
var r = e.listener,
n = void 0 === r ? {}: r,
o = e.events,
i = void 0 === o ? [] : o;
for (var a in n) n.hasOwnProperty(a) && (removeEvent(a, window, n[a]), delete n[a]);
for (var c = 0; i.length > c; c++) this.handleErrorEvent(i[c], (function(e) {
t.log(e)
}));
e.events = []
}
}
},
{
key: "register",
value: function() {
var t = this;
if (this.autoCapture) try {
if (!doc$1) return this._warn("褰撳墠涓洪潪 web 鐜锛屼笉鏀寔鎶ラ敊鐩戝惉涓庢彃浠朵娇鐢�"),
this;
if (this.isErrorHandler) return void this._warn("閿欒浜嬩欢宸茬洃鍚�");
var e = function(e) {
t.handleErrorEvent(e, (function(e) {
t.log(e)
}))
};
addEvent("error", window, e),
addEvent("unhandledrejection", window, e),
this.isErrorHandler = !0
} catch(t) {
this._warn("寮傚父鐩戝惉浜嬩欢娉ㄥ唽澶辫触", t)
} else this._warn("宸查€氳繃 autoCapture 绂佺敤寮傚父鎹曡幏")
}
},
{
key: "isBridgeReport",
value: function(t) {
return window.AlipayJSBridge && (Number(t) > 10 || 1 > Number(t))
}
},
{
key: "getNetwork",
value: function() {
var t = navigator;
return t && t.connection && t.connection.effectiveType ? t.connection.effectiveType: ""
}
},
{
key: "_warn",
value: function() {
var t = window;
if ("object" === _typeof(t) && t.console && "function" == typeof t.console.warn && this.debug) {
for (var e = arguments.length,
r = Array(e), n = 0; e > n; n++) r[n] = arguments[n];
var o = Array.prototype.slice.call(r);
t.console.warn.call(null, "[Monitor Debug]".concat(o[0]), o.slice(1))
}
}
},
{
key: "parseParam4",
value: function(t) {
if (!t || "object" !== _typeof(t)) return null;
var e = _objectSpread2(_objectSpread2({},
this.defaults), t); (t.bmAppid || this.bmAppid) && (e.bm_appid = t.bmAppid || this.bmAppid),
this.userConfig.sprintId && (e.bm_sid = this.userConfig.sprintId),
this.userConfig.env && (e.env = this.userConfig.env),
this.userConfig.yuyanId && (e.yuyan_id = this.userConfig.yuyanId),
e.monitor_ver = "websdk:".concat(version),
e.title = e.title || document.title,
e.dom_cnt = document.getElementsByTagName("*").length,
e.delay = (new Date).getTime() - startTime,
e.scroll_top = docEl$1.scrollTop + doc$1.body.scrollTop,
e.content_height = Math.max(docEl$1.clientHeight, docEl$1.offsetHeight, docEl$1.scrollHeight),
e.last_action = this.lastActionComp.get(),
e.network = this.getNetwork();
var r = this.userConfig.spmAPos && this.userConfig.spmBPos ? "".concat(this.userConfig.spmAPos, ".").concat(this.userConfig.spmBPos) : "";
if (r && (e.spmId = r), e.fullURL = e.fullURL || location.href, this.cOfflineVer && (e.c_offline_ver = this.cOfflineVer), this.cAppId && (e.c_app_id = this.cAppId), "object" === _typeof(e)) {
var n = e;
for (var o in n) if (n.hasOwnProperty(o) && "string" == typeof n[o]) {
var i = n[o].replace(/\s+/g, " ");
n[o] = "fullURL" === o && i.length > 300 ? i.slice(0, 300) : i
}
}
return e
}
},
{
key: "sendData",
value: function(t) {
var e = encodeURIComponent;
this.debug && console.log("send", t);
try {
var r = new XMLHttpRequest;
r.open("POST", this.server, !0),
r.setRequestHeader("Content-type", "application/x-www-form-urlencoded"),
r.send("data=".concat(e(t.join()), "&time=").concat((new Date).getTime()))
} catch(r) {
try { (new Image).src = "".concat(this.server, "?data=").concat(e(t.join()), "&time=").concat((new Date).getTime())
} catch(t) {
this._warn("閫氳繃 IMG 涓婃姤澶辫触.", t)
}
}
}
},
{
key: "bridgeLog",
value: function(t) {
window.AlipayJSBridge ? window.AlipayJSBridge.call("handleLoggingAction", {
actionType: "reportEvent",
params: {
eventId: this.eventId,
bizType: "bmmonitor",
extData: t || {}
}
}) : this._warn("闈炲鍣ㄧ幆澧冿紝涓嶈兘璋冪敤 handleLoggingAction")
}
}]),
t
} (),
monitorConfigCacheKey = "_YUYAN_COOKIE_monitor_config",
expireDelta = 9e5,
ConfigStorage = function() {
function t() {
_classCallCheck(this, t)
}
return _createClass(t, [{
key: "getStorageInfoMap",
value: function() {
try {
var t = window.localStorage;
if (!t) return {};
var e = t.getItem(monitorConfigCacheKey) || "{}";
return JSON.parse(e)
} catch(t) {
console && console.warn && console.warn("[MonitorSDK]浠嶴torage涓幏鍙栭厤缃け璐�", t)
}
return {}
}
},
{
key: "getMonitorConfig",
value: function(t) {
var e = this.getStorageInfoMap()[t];
return ! e || (new Date).valueOf() > e.expire ? null: e.config
}
},
{
key: "saveMonitorConfig",
value: function(t, e) {
var r = window.localStorage;
if (!r) return null;
var n = this.getStorageInfoMap();
n[t] = {
config: e,
expire: (new Date).valueOf() + expireDelta
},
r.setItem(monitorConfigCacheKey, JSON.stringify(n))
}
}]),
t
} (),
configStorage = new ConfigStorage;
function execScript(Monitor, configScript) {
var window = {
Tracert: Monitor
};
return eval(configScript),
window
}
var ServerConfig = function() {
function t() {
_classCallCheck(this, t),
this.monitorConfigInited = !1,
this.monitorConfigFailed = !1,
this.monitorOptions = []
}
return _createClass(t, [{
key: "fetchConfig",
value: function() {
var t = this;
if (this.bmAppid) {
var e = configStorage.getMonitorConfig(this.bmAppid);
if (e) this.setMonitorConfigs(e);
else {
var r = "https://render.alipay.com/p/alertserver".concat("pre" === this.userConfig.env ? "_pre": "", "/").concat(this.bmAppid, "_config/index.js");
window.AlipayJSBridge ? this.fetchConfigByJSBridge(r) : this.fetchConfigByRequest(r)
}
} else setTimeout((function() {
t.onFetchConfigError("娌℃湁 bmAppid")
}))
}
},
{
key: "fetchConfigByRequest",
value: function(t) {
var e = this;
window.XMLHttpRequest || this.onFetchConfigError("娌℃湁 XHR锛屾棤娉曡姹傞厤缃�");
try {
var r = new XMLHttpRequest;
r.open("GET", t, !0),
r.send(),
r.onreadystatechange = function() {
if (4 === r.readyState) if (200 === r.status || 304 === r.status) try {
execScript(e, r.responseText)
} catch(t) {
e.onFetchConfigError(t)
} else e.onFetchConfigError("鑾峰彇閰嶇疆澶辫触: ".concat(t))
}
} catch(t) {
this.onFetchConfigError(t)
}
}
},
{
key: "initMonitorConfigs",
value: function(t) {
this.setMonitorConfigs(t),
configStorage.saveMonitorConfig(this.bmAppid, t)
}
},
{
key: "setMonitorConfigs",
value: function(t) {
this.monitorOptions = t.monitors,
this.monitorConfigInited = !0,
this.onMonitorConfigInited()
}
},
{
key: "fetchConfigByJSBridge",
value: function(t) {
var e = this;
window.AlipayJSBridge.call("httpRequest", {
url: t,
method: "GET",
contentType: "application/json"
},
(function(t) {
if (t && 200 === t.status) try {
execScript(e, t.data),
setTimeout((function() {
e.monitorConfigInited || e.onFetchConfigError("鑾峰彇鏈嶅姟绔厤缃秴鏃�")
}), 3e3)
} catch(t) {
e.onFetchConfigError(t)
} else e.onFetchConfigError("鏈壘鍒伴厤缃�")
}))
}
}]),
t
} (),
lib = createCommonjsModule((function(t) {
var e, r;
e = "undefined" != typeof self ? self: commonjsGlobal,
r = function() {
if ("object" == typeof window) {
var t, e = window,
r = {
0 : "navigate",
1 : "reload",
2 : "back_forward"
},
n = ["unloadEventStart", "unloadEventEnd", "redirectStart", "redirectEnd", "fetchStart", "domainLookupStart", "domainLookupEnd", "connectStart", "connectEnd", "secureConnectionStart", "requestStart", "responseStart", "responseEnd", "domLoading", "domInteractive", "domContentLoadedEventStart", "domContentLoadedEventEnd", "domComplete", "loadEventStart"];
return e && e.performance && "object" == typeof e.performance ? "function" == typeof e.performance.getEntries && "function" == typeof e.performance.getEntriesByType && "function" == typeof e.performance.getEntriesByName && "function" == typeof e.performance.now && e.performance.timeOrigin ? e.performance: t = {
_entry: function() {
for (var t = e.performance.timing,
o = t.navigationStart || t.redirectStart || t.fetchStart,
i = {
entryType: "navigation",
initiatorType: "navigation",
name: e.location.href,
startTime: 0,
duration: t.loadEventEnd ? t.loadEventEnd - o: 0,
redirectCount: e.performance.navigation.redirectCount,
type: r[e.performance.navigation.type]
},
a = 0; n.length > a; a++) {
var c = n[a],
s = t[c];
i[c] = s ? s - o: 0
}
return i
} (),
timeOrigin: e.performance.timing.navigationStart,
getEntries: function() {
return [this._entry]
},
getEntriesByType: function(t) {
return "navigation" !== t ? [] : [this._entry]
},
getEntriesByName: function(t) {
return t !== e.location.href ? [] : [this._entry]
},
now: function() {
return Date.now() - e.performance.timing.navigationStart
}
}: t
}
},
t.exports ? t.exports = r() : e.timing2 = r()
}));
function getWeight(t) {
return Math.pow(.5, t)
}
var calculateFMP = function(t) {
var e = t.records,
r = t.start,
n = t.timeout,
o = t.load;
if (0 === e.length) return "number" == typeof n ? n: 0;
"number" == typeof o && e.forEach((function(t) {
t.weight = getWeight(Math.abs(parseFloat(t.t) - o) / 1e3)
}));
var i = e.map((function(t, r) {
if (0 === r) return 0;
var n = e[r - 1];
return t.domCnt === n.domCnt ? 0 : (t.domCnt - n.domCnt) / (t.t - n.t) * ("number" == typeof t.weight ? t.weight: 1)
})),
a = Math.max.apply(null, i),
c = i.indexOf(a);
return e[c].t - r
},
STACK_LIMIT = "number" == typeof __PAINTY_STACK_LIMIT__ ? __PAINTY_STACK_LIMIT__: 100;
function now() {
return "object" == typeof performance && "function" == typeof performance.now ? performance.now() : Date.now()
}
var _painty_0_3_3_painty = function(t, e) {
if ("object" == typeof window && "object" == typeof lib) {
"function" == typeof t && (e = t);
var r = [],
n = function t() {
if ("function" == typeof MutationObserver) {
var e = new MutationObserver((function() {
r.push({
t: now(),
domCnt: document.getElementsByTagName("*").length
}),
r.length === STACK_LIMIT && i()
}));
return e.observe(document, {
childList: !0,
subtree: !0
}),
e.disconnect.bind(e)
}
var n = setTimeout((function() {
r.push({
t: now(),
domCnt: document.getElementsByTagName("*").length
}),
r.length === STACK_LIMIT ? i() : t()
}), 200);
return function() {
clearTimeout(n)
}
} ();
if ("number" == typeof t) setTimeout(i, t);
else {
var o = !!navigator.userAgent.match(/iPhone|iPad|iPod/i);
window.addEventListener(o ? "pagehide": "beforeunload", i)
}
}
function i() {
if (n(), "object" == typeof lib && "function" == typeof lib.getEntriesByType) {
var o = lib.getEntriesByType("navigation");
if (o && o.length) {
var i = o[0];
e(calculateFMP({
records: r,
start: i.startTime,
timeout: t,
load: i.duration
}))
}
}
}
},
extractPaintMetrics = function(t) {
if ("object" !== _typeof(t)) return [];
var e = t.getEntriesByType("paint"),
r = {};
if (e.length) {
var n = (e.filter((function(t) {
return "first-paint" === t.name
}))[0] || {}).startTime,
o = (e.filter((function(t) {
return "first-contentful-paint" === t.name
}))[0] || {}).startTime;
r.firstPaint = parseFloat(n),
r.firstContentfulPaint = parseFloat(o)
}
return r
};
function extractPageMetrics(t, e) {
if ("object" !== _typeof(t) || "function" != typeof t.getEntriesByType) return null;
var r = t.getEntriesByType("navigation");
if (!r || 0 === r.length) return null;
var n = r[0],
o = extractPaintMetrics(t),
i = {
firstMeaningfulPaint: e
};
return NAVIGATION_KEYS.reduce((function(t, e) {
var r = n[e] || o[e] || i[e];
return _objectSpread2(_objectSpread2({},
t), {},
_defineProperty({},
"".concat(e), null == r || "number" == typeof r && isNaN(r) ? 0 : r))
}), {})
}
function getPerformanceMetrics(t, e) {
return t ? normalizeMetrics({
m1: e.duration || parseFloat(t.loadEventEnd) - e.startTime,
m2: parseFloat(t.domContentLoadedEventStart) - e.startTime,
m3: parseFloat(t.domComplete) - e.startTime,
m4: t.firstPaint,
m5: t.firstContentfulPaint,
m6: t.firstMeaningfulPaint,
m7: parseFloat(t.redirectEnd) - parseFloat(t.redirectStart),
m8: parseFloat(t.domainLookupStart) - parseFloat(t.fetchStart),
m9: parseFloat(t.domainLookupEnd) - parseFloat(t.domainLookupStart),
m10: parseFloat(t.connectEnd) - parseFloat(t.connectStart),
m11: parseFloat(t.connectEnd) - parseFloat(t.secureConnectionStart),
m12: parseFloat(t.responseStart) - parseFloat(t.requestStart),
m13: parseFloat(t.responseEnd) - parseFloat(t.responseStart),
m14: parseFloat(t.domComplete) - parseFloat(t.responseEnd),
m15: parseFloat(t.loadEventEnd) - parseFloat(t.responseEnd),
m16: parseFloat(t.domInteractive) - e.startTime,
m17: parseFloat(t.domContentLoadedEventEnd) - parseFloat(t.domContentLoadedEventStart),
m18: parseFloat(t.domComplete) - e.startTime
}) : {}
}
function normalizeMetrics(t) {
var e = {};
for (var r in t) t.hasOwnProperty(r) && (e[r] = isNaN(t[r]) ? 0 : Math.round(Math.min(Math.max(0, parseFloat(t[r])), 3e5)));
return e
}
var fmp = null,
RESOURCE_LIMIT = 500,
PERFORMANCE_PROJECT_ID = "5e85b985a00cad447680db5a",
PERFORMANCE_ERROR_CODE = 11,
SEND_METRICS_ERROR_CODE = 12,
PERFORMACE_RESERVED_CODE = "32767";
function logError$1(t, e, r) {
t.log({
bmAppid: PERFORMANCE_PROJECT_ID,
code: r,
msg: e.message,
page: location.href
})
}
function sendMetrics(t, e) {
if ("object" === _typeof(e) && !t.metricsSent) try {
var r, n, o = e.getEntriesByType("navigation")[0],
i = extractPageMetrics(e, fmp),
a = {
d1: (null === (r = navigator) || void 0 === r || null === (n = r.connection) || void 0 === n ? void 0 : n.effectiveType) || "-",
d2: 0 === o.duration ? 1 : 0,
d3: document.hidden ? 0 : 1
},
c = {
c1: document.title
};
t.log(_objectSpread2(_objectSpread2(_objectSpread2({
code: PERFORMACE_RESERVED_CODE,
msg: location.href
},
getPerformanceMetrics(i, o)), a), c)),
t.metricsSent = !0
} catch(e) {
logError$1(t, e, SEND_METRICS_ERROR_CODE)
}
}
var Performace = function() {
function t() {
_classCallCheck(this, t)
}
return _createClass(t, [{
key: "apply",
value: function(t) {
if (this.monitor = t, "object" === _typeof(lib)) try {
_painty_0_3_3_painty((function(t) {
fmp = t
})),
"function" == typeof lib.setResourceTimingBufferSize && lib.setResourceTimingBufferSize(RESOURCE_LIMIT);
var e = !!navigator.userAgent.match(/iPhone|iPad|iPod/i);
window.addEventListener(e ? "pagehide": "beforeunload", sendMetrics.bind(null, t, lib))
} catch(e) {
logError$1(t, e, PERFORMANCE_ERROR_CODE)
}
}
}]),
t
} (),
TracertHacker = function() {
function t() {
var e = this;
_classCallCheck(this, t),
this.injectedLog = function(t) {
var r;
return null === (r = e.monitor) || void 0 === r ? void 0 : r.log.call(e.monitor, t)
}
}
return _createClass(t, [{
key: "apply",
value: function(t) {
var e = this;
this.monitor = t,
load((function() {
var r = window.Tracert;
if (r) {
var n = {
log: function(n) {
var o = (null == n ? void 0 : n.bmAppId) || (null == n ? void 0 : n.bm_appid) || n._bmAppId,
i = r._bmAppId;
return t._warn('"Tracert.log" 宸蹭笉寤鸿浣跨敤銆傝杩佺Щ鍒� @alipay/yuyan-monitor-web銆�'),
e.injectedLog(_objectSpread2(_objectSpread2({},
n), {},
{
bmAppid: o || i
}))
}
};
r.call("after", "start", (function() {
r.call("set", _objectSpread2({},
n))
})),
r.call("set", _objectSpread2({},
n))
}
}))
}
}]),
t
} (),
iframeSrc = "https://tracert.alipay.com/cross.html",
CrossIframe = function() {
function t() {
_classCallCheck(this, t),
this._iframe = null
}
return _createClass(t, [{
key: "canLoadIframe",
value: function() {
var t = window;
return void 0 === t.WeixinJSBridge && void 0 === t.QQJSBridge && (!t.navigator || !(t.navigator.userAgent.toLowerCase().indexOf("micromessenger") > -1 || t.navigator.userAgent.toLowerCase().indexOf("qq") > -1 || t.navigator.userAgent.toLowerCase().indexOf("toutiaomicroapp") > -1 || void 0 !== t.navigator.wxuserAgent))
}
},
{
key: "initIframe",
value: function() {
if (!this.canLoadIframe()) return null;
if (this._iframe) return this._iframe;
var t = document.createElement("iframe");
t.style.width = "1px",
t.style.height = "1px",
t.style.position = "absolute",
t.style.left = "-100px",
t.style.bottom = "-100px",
t.style.width = "-100px",
t.setAttribute("src", iframeSrc),
t.onload = function() {
t.style.display = "none"
};
try {
document.body.appendChild(t)
} catch(t) {}
return this._iframe = t,
t
}
}]),
t
} (),
crossIframe = new CrossIframe,
bucUserKey = "_YUYAN_COOKIE_bucUserId";
function send(t, e, r) {
t.postMessage(JSON.stringify({
type: e,
content: r
}), "*")
}
var BucUserId = function() {
function t() {
_classCallCheck(this, t),
this.iframe = null,
this.iframeLoaded = !1,
this.pending = !1,
this.queue = [],
this.cachedQuery = []
}
return _createClass(t, [{
key: "apply",
value: function(t) {
var e = this;
this.monitor = t,
load((function() {
var t, r; (null === (t = e.monitor) || void 0 === t || null === (r = t.userConfig) || void 0 === r ? void 0 : r.userId) || (window.addEventListener("message", (function(t) {
return e.receive(t)
}), !1), e.pending = !0, e.iframe = crossIframe.initIframe(), e.getUserIdForMonitor((function(t) {
var r, n, o;
t && !(null === (r = e.monitor) || void 0 === r || null === (n = r.userConfig) || void 0 === n ? void 0 : n.userId) && (null === (o = e.monitor) || void 0 === o || o.config({
userId: t
}))
})))
}))
}
},
{
key: "getUserIdForMonitor",
value: function(t) {
var e = this,
r = window.localStorage;
if (r) {
var n, o = r.getItem(bucUserKey);
if (o) return t(o),
void(null === (n = this.monitor) || void 0 === n || n._warn("浠� localstorge 涓幏鍙� bucId:", o))
}
this.getBucUserId((function() {
var n = e.userId;
r && n && r.setItem(bucUserKey, n),
t(e.userId || "")
}))
}
},
{
key: "receive",
value: function(t) {
var e, r;
if (t.data) {
try {
r = JSON.parse(t.data)
} catch(t) {
return
}
if (r.type) switch (r.type) {
case "getBucUserId":
for (this.userId = r.content, this.pending = !1, null === (e = this.monitor) || void 0 === e || e._warn("浠庤法鍩� storage 鑾峰彇 bucId:", this.userId); this.queue.length;) { (0, this.queue[0])(r.content),
this.queue.shift()
}
break;
case "iframOnload":
this.iframeOnLoad()
}
}
}
},
{
key: "iframeOnLoad",
value: function() {
this.iframeLoaded = !0,
this.executeCachedQuery()
}
},
{
key: "executeCachedQuery",
value: function() {
if (this.cachedQuery.length) for (var t = 0; this.cachedQuery.length > t; t++) {
var e = _toArray(this.cachedQuery[t]),
r = e[0],
n = e.slice(1);
this[r].apply(this, n)
}
}
},
{
key: "getBucUserId",
value: function(t) {
this.iframeLoaded ? (this.queue.push(t), this.pending || (send(this.iframe.contentWindow, "getBucUserId"), this.pending = !0)) : this.cachedQuery.push(["getBucUserId", t])
}
}]),
t
} (),
hashMap = {};
function detectHash(t) {
return _detectHash.apply(this, arguments)
}
function _detectHash() {
return (_detectHash = _asyncToGenerator(regeneratorRuntime.mark((function t(e) {
return regeneratorRuntime.wrap((function(t) {
for (;;) switch (t.prev = t.next) {
case 0:
if (!hashMap[e]) {
t.next = 2;
break
}
return t.abrupt("return", Promise.resolve(!0));
case 2:
return t.abrupt("return", new Promise((function(t, r) {
try {
var n = new XMLHttpRequest;
n.open("GET", "https://dataservice.alipayobjects.com/alertserver/hash/".concat(e), !0),
n.send(),
n.onreadystatechange = function() {
if (4 === n.readyState) return 200 === n.status || 304 === n.status ? (hashMap[e] = !0, t(!0)) : t(!1)
}
} catch(t) {
return r(t)
}
})));
case 3:
case "end":
return t.stop()
}
}), t)
})))).apply(this, arguments)
}
var ErrorCodeEnums$2 = enums.ErrorCodeEnums,
win$1 = window,
MonitorWeb = function(t) {
_inherits(r, t);
var e = _createSuper(r);
function r() {
var t, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
appType: "H5"
};
return _classCallCheck(this, r),
(t = e.call(this, n)).jsBridgeReady = !1,
t.itemCache = [],
t.monitorOptionMap = {},
t.UserConfig = {},
t.monitorConfigInited = !1,
t.monitorConfigFailed = !1,
t.monitorOptions = [],
(new TracertHacker).apply(_assertThisInitialized(t)),
-1 !== t.enabledPlugins.indexOf("performance") && (new Performace).apply(_assertThisInitialized(t)),
-1 !== t.enabledPlugins.indexOf("buc") && (new BucUserId).apply(_assertThisInitialized(t)),
t.isAlipay = checkIsAlipay(win$1.navigator),
t.initJsBridge(),
t.fetchConfig(),
t.handlePreCapture(),
t.register(),
t
}
return _createClass(r, [{
key: "log",
value: function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
e = arguments.length > 1 ? arguments[1] : void 0;
if (t) {
var r = this.isAlipay && !this.jsBridgeReady; ! r && this.monitorConfigInited && allFieldsReady(this.userConfig, this.requiredFields, this._warn.bind(this)) ? this._log(t, e) : this.itemCache.push([t, e])
}
}
},
{
key: "logError",
value: function(t, e) {
logError(t, detectHash, {
log: this.log.bind(this),
_warn: this._warn.bind(this)
},
e)
}
},
{
key: "logRequestError",
value: function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
try {
if (!t) return;
var e = t.type,
r = void 0 === e ? "http": e;
if ("http" === r) {
var n = t.status,
o = t.url,
i = t.method,
a = t.query,
c = t.data,
s = t.response,
u = t.traceId,
f = t.code,
l = "".concat(i.toUpperCase(), " ").concat(o),
d = {
code: f || 2,
msg: l
};
n && (d.s1 = n),
a && (d.s2 = a),
c && (d.s3 = c),
s && (d.s4 = s),
u && (d.s5 = u),
this.log(d)
}
} catch(t) {
this._warn("鎺ュ彛寮傚父涓婃姤澶辫触:", t)
}
}
},
{
key: "config",
value: function(t) {
t && "object" === _typeof(t) && (shallowMerge(this.userConfig, t), allFieldsReady(this.userConfig, this.requiredFields, this._warn.bind(this)) && this.logCache())
}
},
{
key: "logCache",
value: function() {
for (var t = this.itemCache,
e = 0; t.length > e; e++) {
var r = t[e];
Array.isArray(r) && this._log(r[0], r[1])
}
this.itemCache = []
}
},
{
key: "preprocess",
value: function(t) {
var e;
if ("function" == typeof this.beforeLog) try {
t = this.beforeLog(t)
} catch(t) {
this._warn("beforeLog 澶辫触:", t)
}
if (!t || "object" !== _typeof(t) && Array.isArray(t)) this._warn("beforeLog杩斿洖鍊间笉鏄璞★紝涓嶈繘琛屼笂鎶�");
else {
for (var r = generateIdentifier(_objectSpread2(_objectSpread2({},
t), {},
{
uid: t.roleId || this.userConfig.userId || this.cUserId || "",
page: location.href
})), n = !1, o = 0; this.trackedLogs.length > o; o++) if (this.trackedLogs[o] === r) {
n = !0;
break
}
if (! (null !== (e = t.oncePerSession) && void 0 !== e ? e: this.oncePerSession) || !n) {
if ((t.bmAppid || this.bmAppid) === this.bmAppid) {
if (t.code === PERFORMACE_RESERVED_CODE) return t;
var i = this.monitorOptionMap[Number(t.code)] || this.monitorOptionMap["".concat(t.code)];
if (!this.monitorConfigFailed && !i) return void this._warn("鐩戞帶骞冲彴娌℃湁璇ョ洃鎺ч」鐨勯厤缃紝code: ".concat(t.code));
var a = i && i.sampleRate || t.sampleRate || 1;
if (Math.random() > a) return void this._warn("褰撳墠宸茶缃噰鏍风巼 ".concat(a, "锛屾湭琚噰闆�"));
if (i) {
for (var c = {},
s = i.fields || [], u = 0; s.length > u; u++) c[s[u]] = !0;
for (var f in t) ! c[f] && /^[dmc]\d+$/.test(f) && delete t[f]
}
}
return ! n && this.trackedLogs.push(r),
t
}
this._warn("褰撳墠鐢变簬 OncePerSession 绛栫暐锛屾湭琚噰闆�")
}
}
},
{
key: "_log",
value: function(t, e) {
var r = this.preprocess(t);
if (r) {
this.getSpmInfo();
var n = this.parseParam4(r);
if ( !! (null == e ? void 0 : e.forceHttpReport) || !this.isBridgeReport(n.code)) {
var o = r.roleId || this.userConfig.userId || this.cUserId || "";
delete r.roleId;
var i = navigator.userAgent ? navigator.userAgent.replace(/,/g, "%2C") : "",
a = parseItem({
eventId: this.eventId,
userId: o,
param4: n,
ua: i
});
if (!a.length) return;
return this.sendData(a)
}
n._ua = navigator.userAgent ? navigator.userAgent.replace(/,/g, "%2C") : "";
for (var c = 0,
s = Object.keys(n); s.length > c; c++) {
var u = s[c];
n[u] = encodeValue(n[u])
}
this.bridgeLog(n)
}
}
},
{
key: "getSpmInfo",
value: function() {
var t = window._to || {};
if (!this.userConfig.spmAPos) {
var e = getMetaSpm().spmAPos || t.spmAPos;
e && (this.userConfig.spmAPos = e)
}
if (!this.userConfig.spmBPos) {
var r = getSpmBPos() || t.spmBPos;
r && (this.userConfig.spmBPos = r)
}
}
},
{
key: "initJsBridge",
value: function() {
var t = this;
document.addEventListener("AlipayJSBridgeReady", (function() {
t.onJsBridgeReady()
}))
}
},
{
key: "getInfoFromBridge",
value: function(t) {
var e = this,
r = 2;
function n() {
0 === --r && t()
}
try {
var o = win$1.AlipayJSBridge;
o.call("getUserInfo", (function(t) {
e.cUserId = t.userId,
n()
})),
o.call("getStartupParams", (function(t) {
e.cOfflineVer = t.version,
t.version && (e.cAppId = t.appId),
n()
}))
} catch(e) {
t(),
this._warn("璋冪敤瀹瑰櫒鎺ュ彛鑾峰彇淇℃伅澶辫触", e)
}
}
},
{
key: "onJsBridgeReady",
value: function() {
var t = this;
this.getInfoFromBridge((function() {
t.jsBridgeReady = !0,
t.monitorConfigInited && t.logCache()
}))
}
},
{
key: "set",
value: function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
objectAssign$1(this, t)
}
},
{
key: "setMonitorConfigs",
value: function() {}
},
{
key: "initMonitorConfigs",
value: function() {}
},
{
key: "fetchConfig",
value: function() {}
},
{
key: "fetchConfigByRequest",
value: function() {}
},
{
key: "fetchConfigByJSBridge",
value: function() {}
},
{
key: "onMonitorConfigInited",
value: function() {
var t = this;
this.monitorOptions && this.monitorOptions.forEach((function(e) {
e && e.code && (t.monitorOptionMap[e.code] = e)
}));
var e = this.monitorOptionMap[ErrorCodeEnums$2.REQUEST]; ! this.disableInterface && e && (e.code === ErrorCodeEnums$2.REQUEST && e.isActive && !e.isDeleted && interfaceRegister(this));
this.isAlipay && !this.jsBridgeReady || this.logCache()
}
},
{
key: "onFetchConfigError",
value: function(t) {
this.monitorConfigInited = !0,
this.monitorConfigFailed = !0,
this.onMonitorConfigInited(),
this._warn("鑾峰彇鏈嶅姟绔厤缃け璐ワ細", t)
}
}]),
r
} (Base);
return applyMixins(MonitorWeb, [ServerConfig]),
MonitorWeb
}));
FAQs
web监控、js监控
The npm package web-monitor-ukl receives a total of 0 weekly downloads. As such, web-monitor-ukl popularity was classified as not popular.
We found that web-monitor-ukl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.