UNPKG

xverse-components-utils

Version:

xverse components utils

1,206 lines (1,205 loc) 560 kB
var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; (function(global2, factory) { typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@xverse/tracker"), require("axios"), require("react-dom"), require("xverse-components-toast"), require("xverse-components-modal"), require("@xverse/core"), require("@tanstack/react-query"), require("react-i18next"), require("@xverse/matrix-shared-utils")) : typeof define === "function" && define.amd ? define(["exports", "react", "@xverse/tracker", "axios", "react-dom", "xverse-components-toast", "xverse-components-modal", "@xverse/core", "@tanstack/react-query", "react-i18next", "@xverse/matrix-shared-utils"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.Utils = {}, global2.React, global2.XverseTracker, global2.Axios, global2.ReactDOM, global2.Toast, global2.Modal, global2.XverseSDK, global2.TanstackReactQuery, global2.ReactI18Next, global2.XverseMatrixSharedUtils)); })(this, function(exports2, require$$0, tracker, axios, require$$0$1, xverseComponentsToast, xverseComponentsModal, core, reactQuery, reactI18next, matrixSharedUtils) { var _a, _b, _c, _d, _e; "use strict"; var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null; const wrapToArray = (param) => { if (Array.isArray(param)) return param; return [param]; }; const getRandomItem = (arr) => { if (!arr || arr.length === 0) return void 0; return arr[Math.floor(Math.random() * arr.length)]; }; const shuffleArray = (array) => { for (let i2 = array.length - 1; i2 > 0; i2--) { const j2 = Math.floor(Math.random() * (i2 + 1)); [array[i2], array[j2]] = [array[j2], array[i2]]; } return array; }; const px2rem = function(val) { if (typeof val === "string") { if (val.endsWith("px")) { val = parseInt(val); } else { return val; } } return `${parseFloat(String(val)) / 100}rem`; }; function uuid() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => { const r2 = Math.random() * 16 | 0; const v = c2 === "x" ? r2 : r2 & 3 | 8; return v.toString(16); }); } function e$i(r2) { if (r2 instanceof Error) { return Object.getOwnPropertyNames(r2).reduce((t2, n2) => { const s2 = r2[n2]; return t2[n2] = s2 instanceof Error ? e$i(s2) : s2, t2; }, { name: r2.name, message: r2.message, stack: r2.stack }); } return r2; } function e$h(e2) { const t2 = e2.getMonth() + 1, n2 = e2.getDate(), o2 = e2.getHours(), g2 = e2.getMinutes(), s2 = e2.getSeconds(), i2 = e2.getMilliseconds(), r2 = (t2 < 10 ? "0" : "") + t2, u2 = (n2 < 10 ? "0" : "") + n2, c2 = (o2 < 10 ? "0" : "") + o2, a2 = (g2 < 10 ? "0" : "") + g2, f2 = (s2 < 10 ? "0" : "") + s2; return e2.getFullYear() + "-" + r2 + "-" + u2 + " " + c2 + ":" + a2 + ":" + f2 + "." + i2; } function t$d(e2) { const t2 = (/* @__PURE__ */ new Date()).getTimezoneOffset(); return new Date((/* @__PURE__ */ new Date()).getTime() + 60 * t2 * 1e3 - 60 * e2 * 60 * 1e3); } const r$f = (r2) => Array.isArray(r2) ? r2 : [r2]; const e$g = "undefined" != typeof wx && (wx == null ? void 0 : wx.openSystemBluetoothSetting), t$c = e$g ? async function(e2, t2) { return new Promise((n2, r2) => { try { const o2 = JSON.stringify(t2); o2.length >= 102400 && console.warn("report messages oversize", o2), wx.request({ url: `${e2}`, method: "POST", header: { "content-type": "application/json" }, data: o2, fail: (e3) => { r2(`log request failed, error=${e3}`); }, success: () => { n2(); } }); } catch (e3) { console.error("log report failed"), r2(e3); } }); } : async function(e2, t2) { return new Promise((n2, r2) => { const o2 = new XMLHttpRequest(); o2.open("POST", e2), o2.setRequestHeader("Content-Type", "application/json"); try { const e3 = JSON.stringify(t2); e3.length >= 102400 && console.warn("report messages oversize", e3), o2.send(e3); } catch (e3) { console.error("log report failed"), r2(e3); } o2.addEventListener("readystatechange", () => { if (4 == o2.readyState) { if (200 == o2.status) return n2(o2); return r2("Unable to send log"); } }); }); }; var e$f = "@xverse/log", s$6 = "1.0.38", d$4 = "./lib/bundle.umd.js", l$2 = "./lib/src/index.js", n$d = "./lib/src/index.d.ts", c$6 = { docs: "typedoc", test: "jest" }, t$b = { access: "public" }, o$b = ["lib"], r$e = [], b = { "@jest/globals": "^29.5.0" }, u$4 = {}, g = { name: e$f, version: s$6, description: "", main: d$4, module: l$2, typings: n$d, scripts: c$6, publishConfig: t$b, files: o$b, keywords: r$e, author: "", license: "ISC", devDependencies: b, dependencies: u$4 }; const a$8 = { sit: "https://sit-online.xverse.cn/public/statreport-service/statReport", uat: "https://uat-online.xverse.cn/public/statreport-service/statReport", prod: "https://online.xverse.cn/public/statreport-service/statReport" }; let h$1 = (_a = class { constructor() { __publicField(this, "_header", {}); __publicField(this, "_queue", []); __publicField(this, "_disabled", false); __publicField(this, "_reportUrl"); __publicField(this, "loopTimer"); __publicField(this, "echoTimer"); __publicField(this, "_debug", false); __publicField(this, "_logInterval", 3e3); __publicField(this, "_reportNumPerRequest", 20); this.debug && console.log(`%c [Log]${g.version} Initialized`, "background: #0092ca; color: #111;"); } get debug() { return this._debug; } get isReadyToSend() { return void 0 !== this._reportUrl && (this._reportUrl, true); } disable() { this._disabled = true; } updateHeader(e2) { Object.assign(this._header, e2); } setReportUrl(e2) { this._reportUrl = e2; } async reportNow() { await this._flushReport(true); } setReportInterval(e2) { e2 && e2 > 0 && (this._logInterval = e2), this.startLogPolling(); } startReportEcho() { this.startLogEcho(); } setReportNumPerRequest(e2) { e2 > 0 && (this._reportNumPerRequest = e2); } report(s2, r2, i2) { if (this._disabled) return; i2 || (i2 = {}); const { immediate: n2, sampleRate: c2 } = i2; if (c2 && c2 > Math.random()) return; const a2 = (o2) => { const r3 = { logTime: e$h(t$d(-8)), logTimestamp: Date.now(), type: s2, ...o2 }; this._queue.push(r3); }; r$f(r2).forEach((e2) => a2(e2)), (n2 || this._queue.length >= this._reportNumPerRequest) && this._flushReport(); } async _flushEcho() { this.report("log", { event: "ReportEcho" }); } async _flushReport(e2) { if (this._disabled) return; if (!this._queue.length) return; if (!e$g && !e2) return; if (!this.isReadyToSend) return; const t2 = { header: this._header, body: this._queue.splice(0, this._reportNumPerRequest) }; await this._post(t2); } async _post(e2) { const t2 = this._reportUrl || a$8[_a.ReportEnv]; t2 && (await _a.request(t2, e2), this.debug && (console.log("%c [Log] %c header ", "background: #0092ca; color: #111;", "background: #0092ca; color: #ffffff;"), console.log(this._header), console.log("%c 数据: ", "background: #0092ca; color: #111;"), e2.body.forEach((e3) => { console.log(e3); }))); } _beaconPost(e2) { const t2 = this._reportUrl || a$8[_a.ReportEnv]; if (!t2) return; const o2 = JSON.stringify(e2); o2.length >= 102400 && console.warn("report messages oversize", o2); const s2 = navigator.sendBeacon(t2, o2); s2 || console.error("beacon add failed", this._header, e2), this.debug && (console.log("beacon state", s2), console.log("%c [Log] %c header ", "background: #0092ca; color: #111;", "background: #0092ca; color: #ffffff;"), console.log(this._header), console.log("%c 数据: ", "background: #0092ca; color: #111;"), console.log(e2)); } static get Instance() { return this.instance || (this.instance = new this()), this.instance; } toggleDebug() { this._debug = !this._debug; } startLogEcho() { this._flushEcho(); const e2 = () => { this._flushEcho(), this.echoTimer = window.setTimeout(e2, 5e3); }; this.echoTimer = window.setTimeout(e2, 5e3); } startLogPolling() { const e2 = () => { this.reportNow(), this.loopTimer = window.setTimeout(e2, this._logInterval); }; this.loopTimer = window.setTimeout(e2, this._logInterval); } }, __publicField(_a, "instance"), __publicField(_a, "ReportEnv", "sit"), __publicField(_a, "scheduleRes"), __publicField(_a, "request", t$c), _a); const e$e = { markMap: /* @__PURE__ */ new Map(), setMark: (a2, r2) => { let t2 = Date.now(); r2 && r2.startTime && (t2 = r2.startTime), e$e.markMap.set(a2, { ...r2 || {}, startTime: t2, event: a2 }); }, getMark: (a2) => { const r2 = e$e.markMap.get(a2); return r2 ? (e$e.markMap.delete(a2), r2) : (console.warn(`[appLog]SpeedMeasureHelper.getMark: ${a2} not found or has been reported`), null); }, removeMark: (a2) => { e$e.markMap.delete(a2); } }; var i$8; !function(e2) { e2[e2.Debug = 0] = "Debug", e2[e2.Time = 1] = "Time", e2[e2.Info = 2] = "Info", e2[e2.Warn = 3] = "Warn", e2[e2.Error = 4] = "Error", e2[e2.Off = 5] = "Off"; }(i$8 || (i$8 = {})); let s$5 = (_b = class { constructor(e2) { __publicField(this, "module", "log"); __publicField(this, "level", i$8.Debug); __publicField(this, "enginelogCnts", 0); this.module = e2; } static setLevel(e2) { this.level = e2; } setLevel(e2) { this.level = e2; } atleast(e2) { return e2 >= this.level && e2 >= _b.level; } print(e2, t2, ...r2) { const n2 = this.formatInput(e2, ...r2); if (this.atleast(t2)) { const t3 = ["time"].includes(e2) ? "info" : e2, r3 = this.prefix(e2); console[t3].call(null, r3, n2); } if ("debug" !== e2) { if ("engine" == this.module && (this.enginelogCnts++, this.enginelogCnts > 500)) return; this.report(n2); } return this; } async reportNow() { await h$1.Instance.reportNow(); } engineError(e2, t2) { this.error({ event: t2 || "engineError", error: e2 }); } formatInput(t2, ...r2) { var _a2; let n2, o2 = "", i2 = r2[0], a2 = 0, l2 = 0, m2 = 0, p2 = null, u2 = 0; "string" == typeof i2 && (i2 = { event: i2 }); const c2 = Object.assign({}, i2); if (delete c2.event, delete c2.payload, delete c2.error, i2 && i2.event) { if (o2 = i2.event, n2 = i2.payload, a2 = i2.value, i2.startTime) { const e2 = Date.now(); l2 = i2.startTime, m2 = e2, a2 || (a2 = (e2 - l2) / 1e3); } i2.error ? (u2 = ((_a2 = i2.error) == null ? void 0 : _a2.code) || "Unknown", p2 = e$i(i2.error)) : u2 = 0, n2 && n2 instanceof Error && (n2 = e$i(n2)); } else o2 = r2.map((e2) => { if (!(e2 instanceof Object)) return e2; try { return JSON.stringify(e2); } catch (t3) { return console.error("log stringify error", t3), e2; } }).join(","); return { event: o2, payload: n2, level: t2, module: this.module, startTime: l2, endTime: m2, duration: a2, code: u2, error: p2, ...c2, ..._b.commonContent }; } report(e2) { h$1.Instance.report("log", e2); } debug(...e2) { return this.print("debug", i$8.Debug, ...e2); } info(...e2) { return this.print("info", i$8.Info, ...e2); } warn(...e2) { return this.print("warn", i$8.Warn, ...e2); } error(...e2) { return this.print("error", i$8.Error, ...e2); } speedMarkStart(e2) { "string" == typeof e2 ? e$e.setMark(e2) : e2.event ? e$e.setMark(e2.event, e2) : console.warn("[appLog]speedMarkStart event should have event field"); } speedMarkEnd(e2) { if ("string" == typeof e2) { const t2 = e$e.getMark(e2); t2 && this.print("time", i$8.Time, t2); } else { if (!e2.event) return void console.warn("[appLog]speedMarkEnd event should have event field"); const t2 = e$e.getMark(e2.event); e2.startTime ? (e$e.removeMark(e2.event), this.print("time", i$8.Time, { ...t2 || {}, ...e2 })) : t2 && this.print("time", i$8.Time, { ...t2, ...e2 }); } this.reportNow(); } prefix(e2) { return `[${this.module}][${e2}] ${e$h(t$d(-8))}:`; } static assignCommonCtx(e2) { Object.assign(_b.commonContent, e2); } }, __publicField(_b, "level", i$8.Warn), __publicField(_b, "commonContent", {}), _b); function e$d(e2) { return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2; } var e$c = { exports: {} }; var r$d = function(r2, n2) { return function() { for (var t2 = new Array(arguments.length), e2 = 0; e2 < t2.length; e2++) t2[e2] = arguments[e2]; return r2.apply(n2, t2); }; }; var t$a = r$d, n$c = Object.prototype.toString; function e$b(r2) { return "[object Array]" === n$c.call(r2); } function o$a(r2) { return void 0 === r2; } function i$7(r2) { return null !== r2 && "object" == typeof r2; } function u$3(r2) { if ("[object Object]" !== n$c.call(r2)) return false; var t2 = Object.getPrototypeOf(r2); return null === t2 || t2 === Object.prototype; } function f$3(r2) { return "[object Function]" === n$c.call(r2); } function c$5(r2, t2) { if (null != r2) if ("object" != typeof r2 && (r2 = [r2]), e$b(r2)) for (var n2 = 0, o2 = r2.length; n2 < o2; n2++) t2.call(null, r2[n2], n2, r2); else for (var i2 in r2) Object.prototype.hasOwnProperty.call(r2, i2) && t2.call(null, r2[i2], i2, r2); } var a$7 = { isArray: e$b, isArrayBuffer: function(r2) { return "[object ArrayBuffer]" === n$c.call(r2); }, isBuffer: function(r2) { return null !== r2 && !o$a(r2) && null !== r2.constructor && !o$a(r2.constructor) && "function" == typeof r2.constructor.isBuffer && r2.constructor.isBuffer(r2); }, isFormData: function(r2) { return "undefined" != typeof FormData && r2 instanceof FormData; }, isArrayBufferView: function(r2) { return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(r2) : r2 && r2.buffer && r2.buffer instanceof ArrayBuffer; }, isString: function(r2) { return "string" == typeof r2; }, isNumber: function(r2) { return "number" == typeof r2; }, isObject: i$7, isPlainObject: u$3, isUndefined: o$a, isDate: function(r2) { return "[object Date]" === n$c.call(r2); }, isFile: function(r2) { return "[object File]" === n$c.call(r2); }, isBlob: function(r2) { return "[object Blob]" === n$c.call(r2); }, isFunction: f$3, isStream: function(r2) { return i$7(r2) && f$3(r2.pipe); }, isURLSearchParams: function(r2) { return "undefined" != typeof URLSearchParams && r2 instanceof URLSearchParams; }, isStandardBrowserEnv: function() { return ("undefined" == typeof navigator || "ReactNative" !== navigator.product && "NativeScript" !== navigator.product && "NS" !== navigator.product) && ("undefined" != typeof window && "undefined" != typeof document); }, forEach: c$5, merge: function r2() { var t2 = {}; function n2(n3, o3) { u$3(t2[o3]) && u$3(n3) ? t2[o3] = r2(t2[o3], n3) : u$3(n3) ? t2[o3] = r2({}, n3) : e$b(n3) ? t2[o3] = n3.slice() : t2[o3] = n3; } for (var o2 = 0, i2 = arguments.length; o2 < i2; o2++) c$5(arguments[o2], n2); return t2; }, extend: function(r2, n2, e2) { return c$5(n2, function(n3, o2) { r2[o2] = e2 && "function" == typeof n3 ? t$a(n3, e2) : n3; }), r2; }, trim: function(r2) { return r2.trim ? r2.trim() : r2.replace(/^\s+|\s+$/g, ""); }, stripBOM: function(r2) { return 65279 === r2.charCodeAt(0) && (r2 = r2.slice(1)), r2; } }; var r$c = a$7; function i$6(e2) { return encodeURIComponent(e2).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); } var n$b = function(e2, n2, a2) { if (!n2) return e2; var t2; if (a2) t2 = a2(n2); else if (r$c.isURLSearchParams(n2)) t2 = n2.toString(); else { var c2 = []; r$c.forEach(n2, function(e3, n3) { null != e3 && (r$c.isArray(e3) ? n3 += "[]" : e3 = [e3], r$c.forEach(e3, function(e4) { r$c.isDate(e4) ? e4 = e4.toISOString() : r$c.isObject(e4) && (e4 = JSON.stringify(e4)), c2.push(i$6(n3) + "=" + i$6(e4)); })); }), t2 = c2.join("&"); } if (t2) { var o2 = e2.indexOf("#"); -1 !== o2 && (e2 = e2.slice(0, o2)), e2 += (-1 === e2.indexOf("?") ? "?" : "&") + t2; } return e2; }; var t$9 = a$7; function r$b() { this.handlers = []; } r$b.prototype.use = function(n2, t2, r2) { return this.handlers.push({ fulfilled: n2, rejected: t2, synchronous: !!r2 && r2.synchronous, runWhen: r2 ? r2.runWhen : null }), this.handlers.length - 1; }, r$b.prototype.eject = function(n2) { this.handlers[n2] && (this.handlers[n2] = null); }, r$b.prototype.forEach = function(n2) { t$9.forEach(this.handlers, function(t2) { null !== t2 && n2(t2); }); }; var s$4 = r$b; var o$9 = a$7, t$8 = function(e2, t2) { o$9.forEach(e2, function(o2, r2) { r2 !== t2 && r2.toUpperCase() === t2.toUpperCase() && (e2[t2] = o2, delete e2[r2]); }); }; var s$3 = function(s2, e2, t2, i2, n2) { return s2.config = e2, t2 && (s2.code = t2), s2.request = i2, s2.response = n2, s2.isAxiosError = true, s2.toJSON = function() { return { message: this.message, name: this.name, description: this.description, number: this.number, fileName: this.fileName, lineNumber: this.lineNumber, columnNumber: this.columnNumber, stack: this.stack, config: this.config, code: this.code, status: this.response && this.response.status ? this.response.status : null }; }, s2; }; var e$a, n$a; function o$8() { if (n$a) return e$a; n$a = 1; var o2 = s$3; return e$a = function(r2, e2, n2, t2, a2) { var u2 = new Error(r2); return o2(u2, e2, n2, t2, a2); }; } var r$a, e$9; function a$6() { if (e$9) return r$a; e$9 = 1; var a2 = o$8(); return r$a = function(t2, r2, e2) { var s2 = e2.config.validateStatus; e2.status && s2 && !s2(e2.status) ? r2(a2("Request failed with status code " + e2.status, e2.config, null, e2.request, e2)) : t2(e2); }; } var n$9, r$9; function t$7() { if (r$9) return n$9; r$9 = 1; var t2 = a$7; return n$9 = t2.isStandardBrowserEnv() ? { write: function(e2, n2, r2, o2, i2, u2) { var s2 = []; s2.push(e2 + "=" + encodeURIComponent(n2)), t2.isNumber(r2) && s2.push("expires=" + new Date(r2).toGMTString()), t2.isString(o2) && s2.push("path=" + o2), t2.isString(i2) && s2.push("domain=" + i2), true === u2 && s2.push("secure"), document.cookie = s2.join("; "); }, read: function(e2) { var n2 = document.cookie.match(new RegExp("(^|;\\s*)(" + e2 + ")=([^;]*)")); return n2 ? decodeURIComponent(n2[3]) : null; }, remove: function(e2) { this.write(e2, "", Date.now() - 864e5); } } : { write: function() { }, read: function() { return null; }, remove: function() { } }; } var r$8, t$6; function e$8() { return t$6 ? r$8 : (t$6 = 1, r$8 = function(r2) { return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(r2); }); } var r$7, e$7; function n$8() { return e$7 ? r$7 : (e$7 = 1, r$7 = function(r2, e2) { return e2 ? r2.replace(/\/+$/, "") + "/" + e2.replace(/^\/+/, "") : r2; }); } var i$5, s$2; function o$7() { if (s$2) return i$5; s$2 = 1; var o2 = e$8(), t2 = n$8(); return i$5 = function(r2, e2) { return r2 && !o2(e2) ? t2(r2, e2) : e2; }; } var t$5, e$6; function i$4() { if (e$6) return t$5; e$6 = 1; var i2 = a$7, o2 = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"]; return t$5 = function(r2) { var t2, e2, n2, a2 = {}; return r2 ? (i2.forEach(r2.split("\n"), function(r3) { if (n2 = r3.indexOf(":"), t2 = i2.trim(r3.substr(0, n2)).toLowerCase(), e2 = i2.trim(r3.substr(n2 + 1)), t2) { if (a2[t2] && o2.indexOf(t2) >= 0) return; a2[t2] = "set-cookie" === t2 ? (a2[t2] ? a2[t2] : []).concat([e2]) : a2[t2] ? a2[t2] + ", " + e2 : e2; } }), a2) : a2; }; } var t$4, e$5; function o$6() { if (e$5) return t$4; e$5 = 1; var o2 = a$7; return t$4 = o2.isStandardBrowserEnv() ? function() { var r2, t2 = /(msie|trident)/i.test(navigator.userAgent), e2 = document.createElement("a"); function a2(r3) { var o3 = r3; return t2 && (e2.setAttribute("href", o3), o3 = e2.href), e2.setAttribute("href", o3), { href: e2.href, protocol: e2.protocol ? e2.protocol.replace(/:$/, "") : "", host: e2.host, search: e2.search ? e2.search.replace(/^\?/, "") : "", hash: e2.hash ? e2.hash.replace(/^#/, "") : "", hostname: e2.hostname, port: e2.port, pathname: "/" === e2.pathname.charAt(0) ? e2.pathname : "/" + e2.pathname }; } return r2 = a2(window.location.href), function(t3) { var e3 = o2.isString(t3) ? a2(t3) : t3; return e3.protocol === r2.protocol && e3.host === r2.host; }; }() : function() { return true; }; } var t$3, e$4; function r$6() { if (e$4) return t$3; function r2(t2) { this.message = t2; } return e$4 = 1, r2.prototype.toString = function() { return "Cancel" + (this.message ? ": " + this.message : ""); }, r2.prototype.__CANCEL__ = true, t$3 = r2; } var d$3, p$1; function c$4() { if (p$1) return d$3; p$1 = 1; var c2 = a$7, m2 = a$6(), f2 = t$7(), g2 = n$b, h2 = o$7(), T = i$4(), _2 = o$6(), v = o$8(), E2 = a$5(), b2 = r$6(); return d$3 = function(e2) { return new Promise(function(r2, o2) { var t2, s2 = e2.data, n2 = e2.headers, a2 = e2.responseType; function i2() { e2.cancelToken && e2.cancelToken.unsubscribe(t2), e2.signal && e2.signal.removeEventListener("abort", t2); } c2.isFormData(s2) && delete n2["Content-Type"]; var u2 = new XMLHttpRequest(); if (e2.auth) { var l2 = e2.auth.username || "", d2 = e2.auth.password ? unescape(encodeURIComponent(e2.auth.password)) : ""; n2.Authorization = "Basic " + btoa(l2 + ":" + d2); } var p2 = h2(e2.baseURL, e2.url); function q() { if (u2) { var t3 = "getAllResponseHeaders" in u2 ? T(u2.getAllResponseHeaders()) : null, s3 = { data: a2 && "text" !== a2 && "json" !== a2 ? u2.response : u2.responseText, status: u2.status, statusText: u2.statusText, headers: t3, config: e2, request: u2 }; m2(function(e3) { r2(e3), i2(); }, function(e3) { o2(e3), i2(); }, s3), u2 = null; } } if (u2.open(e2.method.toUpperCase(), g2(p2, e2.params, e2.paramsSerializer), true), u2.timeout = e2.timeout, "onloadend" in u2 ? u2.onloadend = q : u2.onreadystatechange = function() { u2 && 4 === u2.readyState && (0 !== u2.status || u2.responseURL && 0 === u2.responseURL.indexOf("file:")) && setTimeout(q); }, u2.onabort = function() { u2 && (o2(v("Request aborted", e2, "ECONNABORTED", u2)), u2 = null); }, u2.onerror = function() { o2(v("Network Error", e2, null, u2)), u2 = null; }, u2.ontimeout = function() { var r3 = e2.timeout ? "timeout of " + e2.timeout + "ms exceeded" : "timeout exceeded", t3 = e2.transitional || E2.transitional; e2.timeoutErrorMessage && (r3 = e2.timeoutErrorMessage), o2(v(r3, e2, t3.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED", u2)), u2 = null; }, c2.isStandardBrowserEnv()) { var w = (e2.withCredentials || _2(p2)) && e2.xsrfCookieName ? f2.read(e2.xsrfCookieName) : void 0; w && (n2[e2.xsrfHeaderName] = w); } "setRequestHeader" in u2 && c2.forEach(n2, function(e3, r3) { void 0 === s2 && "content-type" === r3.toLowerCase() ? delete n2[r3] : u2.setRequestHeader(r3, e3); }), c2.isUndefined(e2.withCredentials) || (u2.withCredentials = !!e2.withCredentials), a2 && "json" !== a2 && (u2.responseType = e2.responseType), "function" == typeof e2.onDownloadProgress && u2.addEventListener("progress", e2.onDownloadProgress), "function" == typeof e2.onUploadProgress && u2.upload && u2.upload.addEventListener("progress", e2.onUploadProgress), (e2.cancelToken || e2.signal) && (t2 = function(e3) { u2 && (o2(!e3 || e3 && e3.type ? new b2("canceled") : e3), u2.abort(), u2 = null); }, e2.cancelToken && e2.cancelToken.subscribe(t2), e2.signal && (e2.signal.aborted ? t2() : e2.signal.addEventListener("abort", t2))), s2 || (s2 = null), u2.send(s2); }); }; } var i$3, o$5; function a$5() { if (o$5) return i$3; o$5 = 1; var a2 = a$7, s2 = t$8, f2 = s$3, p2 = { "Content-Type": "application/x-www-form-urlencoded" }; function c2(e2, r2) { !a2.isUndefined(e2) && a2.isUndefined(e2["Content-Type"]) && (e2["Content-Type"] = r2); } var u2, m2 = { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: (("undefined" != typeof XMLHttpRequest || "undefined" != typeof process && "[object process]" === Object.prototype.toString.call(process)) && (u2 = c$4()), u2), transformRequest: [function(e2, r2) { return s2(r2, "Accept"), s2(r2, "Content-Type"), a2.isFormData(e2) || a2.isArrayBuffer(e2) || a2.isBuffer(e2) || a2.isStream(e2) || a2.isFile(e2) || a2.isBlob(e2) ? e2 : a2.isArrayBufferView(e2) ? e2.buffer : a2.isURLSearchParams(e2) ? (c2(r2, "application/x-www-form-urlencoded;charset=utf-8"), e2.toString()) : a2.isObject(e2) || r2 && "application/json" === r2["Content-Type"] ? (c2(r2, "application/json"), function(e3, r3, t2) { if (a2.isString(e3)) try { return (r3 || JSON.parse)(e3), a2.trim(e3); } catch (e4) { if ("SyntaxError" !== e4.name) throw e4; } return (t2 || JSON.stringify)(e3); }(e2)) : e2; }], transformResponse: [function(e2) { var r2 = this.transitional || m2.transitional, t2 = r2 && r2.silentJSONParsing, n2 = r2 && r2.forcedJSONParsing, i2 = !t2 && "json" === this.responseType; if (i2 || n2 && a2.isString(e2) && e2.length) try { return JSON.parse(e2); } catch (e3) { if (i2) { if ("SyntaxError" === e3.name) throw f2(e3, this, "E_JSON_PARSE"); throw e3; } } return e2; }], timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", maxContentLength: -1, maxBodyLength: -1, validateStatus: function(e2) { return e2 >= 200 && e2 < 300; }, headers: { common: { Accept: "application/json, text/plain, */*" } } }; return a2.forEach(["delete", "get", "head"], function(e2) { m2.headers[e2] = {}; }), a2.forEach(["post", "put", "patch"], function(e2) { m2.headers[e2] = a2.merge(p2); }), i$3 = m2; } var a$4 = a$7, o$4 = a$5(), s$1 = function(r2, t2, s2) { var i2 = this || o$4; return a$4.forEach(s2, function(a2) { r2 = a2.call(i2, r2, t2); }), r2; }; var r$5, n$7; function _$1() { return n$7 ? r$5 : (n$7 = 1, r$5 = function(r2) { return !(!r2 || !r2.__CANCEL__); }); } var o$3 = a$7, n$6 = s$1, d$2 = _$1(), c$3 = a$5(), m$1 = r$6(); function i$2(e2) { if (e2.cancelToken && e2.cancelToken.throwIfRequested(), e2.signal && e2.signal.aborted) throw new m$1("canceled"); } var l$1 = function(e2) { return i$2(e2), e2.headers = e2.headers || {}, e2.data = n$6.call(e2, e2.data, e2.headers, e2.transformRequest), e2.headers = o$3.merge(e2.headers.common || {}, e2.headers[e2.method] || {}, e2.headers), o$3.forEach(["delete", "get", "head", "post", "put", "patch", "common"], function(a2) { delete e2.headers[a2]; }), (e2.adapter || c$3.adapter)(e2).then(function(a2) { return i$2(e2), a2.data = n$6.call(e2, a2.data, a2.headers, e2.transformResponse), a2; }, function(a2) { return d$2(a2) || (i$2(e2), a2 && a2.response && (a2.response.data = n$6.call(e2, a2.response.data, a2.response.headers, e2.transformResponse))), Promise.reject(a2); }); }; var n$5 = a$7, t$2 = function(e2, t2) { t2 = t2 || {}; var i2 = {}; function r2(e3, t3) { return n$5.isPlainObject(e3) && n$5.isPlainObject(t3) ? n$5.merge(e3, t3) : n$5.isPlainObject(t3) ? n$5.merge({}, t3) : n$5.isArray(t3) ? t3.slice() : t3; } function o2(i3) { return n$5.isUndefined(t2[i3]) ? n$5.isUndefined(e2[i3]) ? void 0 : r2(void 0, e2[i3]) : r2(e2[i3], t2[i3]); } function s2(e3) { if (!n$5.isUndefined(t2[e3])) return r2(void 0, t2[e3]); } function a2(i3) { return n$5.isUndefined(t2[i3]) ? n$5.isUndefined(e2[i3]) ? void 0 : r2(void 0, e2[i3]) : r2(void 0, t2[i3]); } function d2(n2) { return n2 in t2 ? r2(e2[n2], t2[n2]) : n2 in e2 ? r2(void 0, e2[n2]) : void 0; } var c2 = { url: s2, method: s2, data: s2, baseURL: a2, transformRequest: a2, transformResponse: a2, paramsSerializer: a2, timeout: a2, timeoutMessage: a2, withCredentials: a2, adapter: a2, responseType: a2, xsrfCookieName: a2, xsrfHeaderName: a2, onUploadProgress: a2, onDownloadProgress: a2, decompress: a2, maxContentLength: a2, maxBodyLength: a2, transport: a2, httpAgent: a2, httpsAgent: a2, cancelToken: a2, socketPath: a2, responseEncoding: a2, validateStatus: d2 }; return n$5.forEach(Object.keys(e2).concat(Object.keys(t2)), function(e3) { var t3 = c2[e3] || o2, r3 = t3(e3); n$5.isUndefined(r3) && t3 !== d2 || (i2[e3] = r3); }), i2; }; var r$4, e$3; function n$4() { return e$3 ? r$4 : (e$3 = 1, r$4 = { version: "0.24.0" }); } var r$3 = n$4().version, o$2 = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach(function(n2, r2) { o$2[n2] = function(o2) { return typeof o2 === n2 || "a" + (r2 < 1 ? "n " : " ") + n2; }; }); var e$2 = {}; o$2.transitional = function(n2, o2, t2) { function i2(n3, o3) { return "[Axios v" + r$3 + "] Transitional option '" + n3 + "'" + o3 + (t2 ? ". " + t2 : ""); } return function(r2, t3, a2) { if (false === n2) throw new Error(i2(t3, " has been removed" + (o2 ? " in " + o2 : ""))); return o2 && !e$2[t3] && (e$2[t3] = true, console.warn(i2(t3, " has been deprecated since v" + o2 + " and will be removed in the near future"))), !n2 || n2(r2, t3, a2); }; }; var t$1 = { assertOptions: function(n2, r2, o2) { if ("object" != typeof n2) throw new TypeError("options must be an object"); for (var e2 = Object.keys(n2), t2 = e2.length; t2-- > 0; ) { var i2 = e2[t2], a2 = r2[i2]; if (a2) { var s2 = n2[i2], f2 = void 0 === s2 || a2(s2, i2, n2); if (true !== f2) throw new TypeError("option " + i2 + " must be " + f2); } else if (true !== o2) throw Error("Unknown option " + i2); } }, validators: o$2 }; var a$3 = a$7, n$3 = n$b, h = s$4, f$2 = l$1, u$2 = t$2, p = t$1, l = p.validators; function c$2(t2) { this.defaults = t2, this.interceptors = { request: new h(), response: new h() }; } c$2.prototype.request = function(t2) { "string" == typeof t2 ? (t2 = arguments[1] || {}).url = arguments[0] : t2 = t2 || {}, (t2 = u$2(this.defaults, t2)).method ? t2.method = t2.method.toLowerCase() : this.defaults.method ? t2.method = this.defaults.method.toLowerCase() : t2.method = "get"; var e2 = t2.transitional; void 0 !== e2 && p.assertOptions(e2, { silentJSONParsing: l.transitional(l.boolean), forcedJSONParsing: l.transitional(l.boolean), clarifyTimeoutError: l.transitional(l.boolean) }, false); var r2 = [], o2 = true; this.interceptors.request.forEach(function(e3) { "function" == typeof e3.runWhen && false === e3.runWhen(t2) || (o2 = o2 && e3.synchronous, r2.unshift(e3.fulfilled, e3.rejected)); }); var s2, i2 = []; if (this.interceptors.response.forEach(function(t3) { i2.push(t3.fulfilled, t3.rejected); }), !o2) { var a2 = [f$2, void 0]; for (Array.prototype.unshift.apply(a2, r2), a2 = a2.concat(i2), s2 = Promise.resolve(t2); a2.length; ) s2 = s2.then(a2.shift(), a2.shift()); return s2; } for (var n2 = t2; r2.length; ) { var h2 = r2.shift(), c2 = r2.shift(); try { n2 = h2(n2); } catch (t3) { c2(t3); break; } } try { s2 = f$2(n2); } catch (t3) { return Promise.reject(t3); } for (; i2.length; ) s2 = s2.then(i2.shift(), i2.shift()); return s2; }, c$2.prototype.getUri = function(t2) { return t2 = u$2(this.defaults, t2), n$3(t2.url, t2.params, t2.paramsSerializer).replace(/^\?/, ""); }, a$3.forEach(["delete", "get", "head", "options"], function(t2) { c$2.prototype[t2] = function(e2, r2) { return this.request(u$2(r2 || {}, { method: t2, url: e2, data: (r2 || {}).data })); }; }), a$3.forEach(["post", "put", "patch"], function(t2) { c$2.prototype[t2] = function(e2, r2, o2) { return this.request(u$2(o2 || {}, { method: t2, url: e2, data: r2 })); }; }); var d$1 = c$2; var n$2, t; function s() { if (t) return n$2; t = 1; var s2 = r$6(); function r2(e2) { if ("function" != typeof e2) throw new TypeError("executor must be a function."); var n2; this.promise = new Promise(function(e3) { n2 = e3; }); var t2 = this; this.promise.then(function(e3) { if (t2._listeners) { var n3, s3 = t2._listeners.length; for (n3 = 0; n3 < s3; n3++) t2._listeners[n3](e3); t2._listeners = null; } }), this.promise.then = function(e3) { var n3, s3 = new Promise(function(e4) { t2.subscribe(e4), n3 = e4; }).then(e3); return s3.cancel = function() { t2.unsubscribe(n3); }, s3; }, e2(function(e3) { t2.reason || (t2.reason = new s2(e3), n2(t2.reason)); }); } return r2.prototype.throwIfRequested = function() { if (this.reason) throw this.reason; }, r2.prototype.subscribe = function(e2) { this.reason ? e2(this.reason) : this._listeners ? this._listeners.push(e2) : this._listeners = [e2]; }, r2.prototype.unsubscribe = function(e2) { if (this._listeners) { var n2 = this._listeners.indexOf(e2); -1 !== n2 && this._listeners.splice(n2, 1); } }, r2.source = function() { var e2; return { token: new r2(function(n2) { e2 = n2; }), cancel: e2 }; }, n$2 = r2; } var n$1, r$2; function u$1() { return r$2 ? n$1 : (r$2 = 1, n$1 = function(n2) { return function(r2) { return n2.apply(null, r2); }; }); } var r$1, e$1; function o$1() { return e$1 ? r$1 : (e$1 = 1, r$1 = function(r2) { return "object" == typeof r2 && true === r2.isAxiosError; }); } var c$1 = a$7, f$1 = r$d, _ = d$1, j = t$2; var x = function r2(e2) { var o2 = new _(e2), s2 = f$1(_.prototype.request, o2); return c$1.extend(s2, _.prototype, o2), c$1.extend(s2, o2), s2.create = function(o3) { return r2(j(e2, o3)); }, s2; }(a$5()); x.Axios = _, x.Cancel = r$6(), x.CancelToken = s(), x.isCancel = _$1(), x.VERSION = n$4().version, x.all = function(r2) { return Promise.all(r2); }, x.spread = u$1(), x.isAxiosError = o$1(), e$c.exports = x, e$c.exports.default = x; var d = e$c.exports; var a$2 = e$d(d); const r = { sit: "https://sit-schedule.xverse.cn/sit-public/unified-schedule-service/getBaseUrl", uat: "https://uat-schedule.xverse.cn/uat-public/unified-schedule-service/getBaseUrl", prod: "https://schedule.xverse.cn/prd-public/unified-schedule-service/getBaseUrl" }, c = async (e2) => { let t2; const c2 = a$2.create(); try { t2 = (await c2.request({ url: e2.scheduleUrl || r[e2.env], timeout: 6e3, data: e2, method: "POST" })).data; } catch (e3) { throw console.error(e3), e3; } if (!(t2 == null ? void 0 : t2.reportURL)) throw new Error("urlEmpty"); return t2; }, n = (e2) => new Promise((s2, t2) => { wx.request({ url: e2.scheduleUrl || r[e2.env], method: "POST", header: { "content-type": "application/json" }, data: JSON.stringify(e2), fail: (e3) => { t2("weAppGetReportUrl request failed"); }, success: (e3) => { s2(e3.data); } }); }), o = (s2, t2) => { h$1.Instance.updateHeader(t2), h$1.Instance.setReportUrl(s2); }; const a$1 = e$g ? async (s2) => { if (h$1.ReportEnv = s2.env, h$1.scheduleRes) return void o(h$1.scheduleRes.reportURL, s2); const t2 = await n(s2); h$1.scheduleRes = t2, o(h$1.scheduleRes.reportURL, s2); } : async (s2) => { if (h$1.ReportEnv = s2.env, h$1.scheduleRes) return void o(h$1.scheduleRes.reportURL, s2); const t2 = await c(s2); h$1.scheduleRes = t2, o(h$1.scheduleRes.reportURL, s2); }; const urlParam = new window.URLSearchParams(location.search); const debug = Boolean(urlParam.get("logDebug") || ""); const appLog = new s$5("appLog"); function appLogWrapper(type, props) { if (debug) { console.log(`log: ${type} ---`, props); } appLog[type].call(appLog, props); } const log = { init: async (reqOptions) => { if (!h$1.Instance.isReadyToSend) { await a$1(reqOptions); } }, info: appLogWrapper.bind(appLog, "info"), debug: appLogWrapper.bind(appLog, "debug"), warn: appLogWrapper.bind(appLog, "warn"), error: appLogWrapper.bind(appLog, "error"), reportNow: () => { appLog.reportNow(); } }; class MatrixTracker extends tracker.Tracker { constructor(options) { super(options); } static setTrackerInitOptions(options) { this.trackInitOptions = options; } static getInstance() { if (!this.instance) { if (!this.trackInitOptions) { throw new Error("tracker实例化未传入参数"); } this.instance = new this(this.trackInitOptions); } return this.instance; } } __publicField(MatrixTracker, "instance", null); __publicField(MatrixTracker, "trackInitOptions", null); var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; var uaParser$1 = { exports: {} }; (function(module2, exports3) { (function(window2, undefined$1) { var LIBVERSION = "1.0.38", EMPTY = "", UNKNOWN = "?", FUNC_TYPE = "function", UNDEF_TYPE = "undefined", OBJ_TYPE = "object", STR_TYPE = "string", MAJOR = "major", MODEL = "model", NAME = "name", TYPE = "type", VENDOR = "vendor", VERSION = "version", ARCHITECTURE = "architecture", CONSOLE = "console", MOBILE = "mobile", TABLET = "tablet", SMARTTV = "smarttv", WEARABLE = "wearable", EMBEDDED = "embedded", UA_MAX_LENGTH = 500; var AMAZON = "Amazon", APPLE = "Apple", ASUS = "ASUS", BLACKBERRY = "BlackBerry", BROWSER = "Browser", CHROME = "Chrome", EDGE = "Edge", FIREFOX = "Firefox", GOOGLE = "Google", HUAWEI = "Huawei", LG = "LG", MICROSOFT = "Microsoft", MOTOROLA = "Motorola", OPERA = "Opera", SAMSUNG = "Samsung", SHARP = "Sharp", SONY = "Sony", XIAOMI = "Xiaomi", ZEBRA = "Zebra", FACEBOOK = "Facebook", CHROMIUM_OS = "Chromium OS", MAC_OS = "Mac OS"; var extend = function(regexes2, extensions) { var mergedRegexes = {}; for (var i2 in regexes2) { if (extensions[i2] && extensions[i2].length % 2 === 0) { mergedRegexes[i2] = extensions[i2].concat(regexes2[i2]); } else { mergedRegexes[i2] = regexes2[i2]; } } return mergedRegexes; }, enumerize = function(arr) { var enums = {}; for (var i2 = 0; i2 < arr.length; i2++) { enums[arr[i2].toUpperCase()] = arr[i2]; } return enums; }, has = function(str1, str2) { return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false; }, lowerize = function(str) { return str.toLowerCase(); }, majorize = function(version) { return typeof version === STR_TYPE ? version.replace(/[^\d\.]/g, EMPTY).split(".")[0] : undefined$1; }, trim = function(str, len) { if (typeof str === STR_TYPE) { str = str.replace(/^\s\s*/, EMPTY); return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH); } }; var rgxMapper = function(ua2, arrays) { var i2 = 0, j2, k, p2, q, matches, match; while (i2 < arrays.length && !matches) { var regex = arrays[i2], props = arrays[i2 + 1]; j2 = k = 0; while (j2 < regex.length && !matches) { if (!regex[j2]) { break; } matches = regex[j2++].exec(ua2); if (!!matches) { for (p2 = 0; p2 < props.length; p2++) { match = matches[++k]; q = props[p2]; if (typeof q === OBJ_TYPE && q.length > 0) { if (q.length === 2) { if (typeof q[1] == FUNC_TYPE) { this[q[0]] = q[1].call(this, match); } else { this[q[0]] = q[1]; } } else if (q.length === 3) { if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) { this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined$1; } else { this[q[0]] = match ? match.replace(q[1], q[2]) : undefined$1; } } else if (q.length === 4) { this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined$1; } } else { this[q] = match ? match : undefined$1; } } } } i2 += 2; } }, strMapper = function(str, map) { for (var i2 in map) { if (typeof map[i2] === OBJ_TYPE && map[i2].length > 0) { for (var j2 = 0; j2 < map[i2].length; j2++) { if (has(map[i2][j2], str)) { return i2 === UNKNOWN ? undefined$1 : i2; } } } else if (has(map[i2], str)) { return i2 === UNKNOWN ? undefined$1 : i2; } } return str; }; var oldSafariMap = { "1.0": "/8", "1.2": "/1", "1.3": "/3", "2.0": "/412", "2.0.2": "/416", "2.0.3": "/417", "2.0.4": "/419", "?": "/" }, windowsVersionMap = { "ME": "4.90", "NT 3.11": "NT3.51", "NT 4.0": "NT4.0", "2000": "NT 5.0", "XP": ["NT 5.1", "NT 5.2"], "Vista": "NT 6.0", "7": "NT 6.1", "8": "NT 6.2", "8.1": "NT 6.3", "10": ["NT 6.4", "NT 10.0"], "RT": "ARM" }; var regexes = { browser: [ [ /\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [VERSION, [NAME, "Chrome"]], [ /edg(?:e|ios|a)?\/([\w\.]+)/i // Microsoft Edge ], [VERSION, [NAME, "Edge"]], [ // Presto based /(opera mini)\/([-\w\.]+)/i, // Opera Mini /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, // Opera Mobi/Tablet /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera ], [NAME, VERSION], [ /opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0 ], [VERSION, [NAME, OPERA + " Mini"]], [ /\bop(?:rg)?x\/([\w\.]+)/i // Opera GX ], [VERSION, [NAME, OPERA + " GX"]], [ /\bopr\/([\w\.]+)/i // Opera Webkit ], [VERSION, [NAME, OPERA]], [ // Mixed /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu ], [VERSION, [NAME, "Baidu"]], [ /(kindle)\/([\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer // Trident based /(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser /(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon /(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i, // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ /(heytap|ovi)browser\/([\d\.]+)/i, // Heytap/Ovi /(weibo)__([\d\.]+)/i // Weibo ], [NAME, VERSION], [ /\bddg\/([\w\.]+)/i // DuckDuckGo ], [VERSION, [NAME, "DuckDuckGo"]], [ /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser ], [VERSION, [NAME, "UC" + BROWSER]], [ /microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser /\bqbcore\/([\w\.]+).+microm/i, /micromessenger\/([\w\.]+)/i // WeChat ], [VERSION, [NAME, "WeChat"]], [ /konqueror\/([\w\.]+)/i // Konqueror ], [VERSION, [NAME, "Konqueror"]], [ /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11 ], [VERSION, [NAME, "IE"]], [ /ya(?:search)?browser\/([\w\.]+)/i // Yandex ], [VERSION, [NAME, "Yandex"]], [ /slbrowser\/([\w\.]+)/i // Smart Lenovo Browser ], [VERSION, [NAME, "Smart Lenovo " + BROWSER]], [ /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser ], [[NAME, /(.+)/, "$1 Secure " + BROWSER], VERSION], [ /\bfocus\/([\w\.]+)/i // Firefox Focus ], [VERSION, [NAME, FIREFOX + " Focus"]], [ /\bopt\/([\w\.]+)/i // Opera Touch ], [VERSION, [NAME, OPERA + " Touch"]], [ /coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser ], [VERSION, [NAME, "Coc Coc"]], [ /dolfin\/([\w\.]+)/i // Dolphin ], [VERSION, [NAME, "Dolphin"]], [ /coast\/([\w\.]+)/i // Opera Coast ], [VERSION, [NAME, OPERA + " Coast"]], [ /miuibrowser\/([\w\.]+)/i // MIUI Browser ], [VERSION, [NAME, "MIUI " + BROWSER]], [ /fxios\/([-\w\.]+)/i // Firefox for iOS ], [VERSION, [NAME, FIREFOX]], [ /\bqihu|(qi?ho?o?|360)browser/i // 360 ], [[NAME, "360 " + BROWSER]], [ /(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i ], [[NAME, /(.+)/, "$1 " + BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser /samsungbrowser\/([\w\.]+)/i // Samsung Internet ], [VERSION, [NAME, SAMSUNG + " Internet"]], [ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, " "], VERSION], [ /metasr[\/ ]?([\d\.]+)/i // Sogou Explorer ], [VERSION, [NAME, "Sogou Explorer"]], [ /(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile ], [[NAME, "Sogou Mobile"], VERSION], [