@skillbuilder/miniapp-simulator 0.2.4 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/docs/assets/road-king-controls.png +0 -0
- package/docs/audit-data-collection.codex.md +76 -393
- package/docs/audit-local-validation.codex.md +1 -1
- package/docs/audit-score-design.codex.md +23 -22
- package/docs/audit-score-design.md +39 -92
- package/docs/audit-score-tech-plan.md +6 -4
- package/docs/audit-tech-design.codex.md +36 -19
- package/docs/desktop-gesture-design.redoc.xml +96 -0
- package/docs/electron-review.md +1 -1
- package/docs/quality-evaluation-redoc.xml +4 -4
- package/docs/tracker.md +3 -2
- package/lib/client-C59iNO5u.mjs +1371 -0
- package/lib/{index-7MeYFlk_.mjs → index-BSj1bmle.mjs} +158 -140
- package/lib/index.js +4484 -3027
- package/lib/remote-client.js +2 -2
- package/lib/types/core/simulator.d.ts +2 -0
- package/lib/types/gesture/host-bus.d.ts +27 -2
- package/lib/types/gesture/input-scheduler.d.ts +29 -0
- package/lib/types/gesture/keyboard-panel-view.d.ts +16 -0
- package/lib/types/gesture/keyboard-panel.d.ts +54 -0
- package/lib/types/gesture/plugins/index.d.ts +11 -14
- package/lib/types/gesture/plugins/keyboard-touch.d.ts +4 -0
- package/lib/types/gesture/plugins/multi-touch-hint.d.ts +1 -9
- package/lib/types/gesture/plugins/multi-touch-switch.d.ts +1 -1
- package/lib/types/gesture/plugins/touch-emitter.d.ts +1 -9
- package/lib/types/gesture/plugins/wheel-pinch.d.ts +3 -0
- package/lib/types/gesture/plugins/wheel-scroll.d.ts +1 -1
- package/lib/types/gesture/touch-cursor.d.ts +4 -0
- package/lib/types/gesture/touch-sequence.d.ts +12 -0
- package/lib/types/gesture/types.d.ts +33 -9
- package/lib/types/host/shadow-host.d.ts +15 -5
- package/lib/types/inspector/host-inspector.d.ts +1 -1
- package/lib/types/remote/audit-controller.d.ts +7 -0
- package/lib/types/remote/audit-leave-monitor.d.ts +2 -0
- package/lib/types/remote/audit-package-sources.d.ts +9 -0
- package/lib/types/remote/audit-telemetry.d.ts +25 -12
- package/lib/types/remote/client.d.ts +2 -0
- package/lib/types/remote/keyboard-panel-host.d.ts +19 -0
- package/lib/types/remote/protocol.d.ts +38 -4
- package/lib/types/remote/runtime-entry.d.ts +2 -1
- package/lib/types/remote/runtime.d.ts +1 -1
- package/lib/types/runtime/jsapi-modules/interaction.d.ts +1 -1
- package/lib/types/runtime/jsapi-modules/local-media.d.ts +4 -0
- package/lib/types/runtime/jsapi-modules/media.d.ts +1 -1
- package/lib/types/runtime/jsapi-modules/note-publish-media.d.ts +9 -0
- package/lib/types/tracker/constants.d.ts +1 -1
- package/lib/types/tracker/default-tracker.d.ts +1 -1
- package/lib/types/types/options.d.ts +6 -2
- package/lib/types/types/renderer.d.ts +8 -0
- package/lib/types/utils/screen-coordinates.d.ts +31 -0
- package/lib/workbench.js +1 -1
- package/package.json +1 -1
- package/lib/client-BDt3WDu_.mjs +0 -1118
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const T = "0.2.8", v = /* @__PURE__ */ new Set();
|
|
2
|
+
function Z(e, n) {
|
|
3
3
|
const t = () => {
|
|
4
4
|
let r = !document.hidden && e.isConnected;
|
|
5
5
|
for (let s = e; r && s; ) {
|
|
6
|
-
const
|
|
7
|
-
r =
|
|
8
|
-
const
|
|
9
|
-
s = s.parentElement ?? (
|
|
6
|
+
const a = getComputedStyle(s);
|
|
7
|
+
r = a.display !== "none" && a.visibility !== "hidden" && a.visibility !== "collapse";
|
|
8
|
+
const c = s.getRootNode();
|
|
9
|
+
s = s.parentElement ?? (c instanceof ShadowRoot ? c.host : null);
|
|
10
10
|
}
|
|
11
11
|
n(r);
|
|
12
12
|
}, o = new MutationObserver(t);
|
|
@@ -19,7 +19,7 @@ function X(e, n) {
|
|
|
19
19
|
o.disconnect(), document.removeEventListener("visibilitychange", t), window.removeEventListener("resize", t), window.removeEventListener("pageshow", t);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function J(e, n) {
|
|
23
23
|
let t = "", o = 0;
|
|
24
24
|
const r = () => {
|
|
25
25
|
if (document.hidden || !e.isConnected) return !1;
|
|
@@ -27,8 +27,8 @@ function Y(e, n) {
|
|
|
27
27
|
const u = getComputedStyle(i);
|
|
28
28
|
if (u.display === "none" || u.visibility === "hidden" || u.visibility === "collapse")
|
|
29
29
|
return !1;
|
|
30
|
-
const
|
|
31
|
-
i = i.parentElement ?? (
|
|
30
|
+
const l = i.getRootNode();
|
|
31
|
+
i = i.parentElement ?? (l instanceof ShadowRoot ? l.host : null);
|
|
32
32
|
}
|
|
33
33
|
return !0;
|
|
34
34
|
}, s = () => {
|
|
@@ -46,7 +46,7 @@ function Y(e, n) {
|
|
|
46
46
|
);
|
|
47
47
|
} catch {
|
|
48
48
|
}
|
|
49
|
-
},
|
|
49
|
+
}, a = (i) => {
|
|
50
50
|
if (!(!i.isTrusted || i.source !== e.contentWindow || i.data?.type !== "mini-app:worker-ready" || typeof i.data.sessionId != "string")) {
|
|
51
51
|
try {
|
|
52
52
|
if (i.origin !== new URL(n(), location.href).origin || e.contentWindow?.__MINITOOL_WORKER_CONTEXT__?.sessionId !== i.data.sessionId)
|
|
@@ -56,21 +56,21 @@ function Y(e, n) {
|
|
|
56
56
|
}
|
|
57
57
|
t = i.data.sessionId, s();
|
|
58
58
|
}
|
|
59
|
-
},
|
|
59
|
+
}, c = new MutationObserver(s);
|
|
60
60
|
for (let i = e; i; ) {
|
|
61
|
-
|
|
61
|
+
c.observe(i, { attributes: !0, attributeFilter: ["style", "class", "hidden"] });
|
|
62
62
|
const u = i.getRootNode();
|
|
63
63
|
i = i.parentElement ?? (u instanceof ShadowRoot ? u.host : null);
|
|
64
64
|
}
|
|
65
|
-
return window.addEventListener("message",
|
|
66
|
-
|
|
65
|
+
return window.addEventListener("message", a), window.addEventListener("resize", s), window.addEventListener("pageshow", s), document.addEventListener("visibilitychange", s), v.add(s), () => {
|
|
66
|
+
v.delete(s), c.disconnect(), window.removeEventListener("message", a), window.removeEventListener("resize", s), window.removeEventListener("pageshow", s), document.removeEventListener("visibilitychange", s);
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
function
|
|
69
|
+
var f = /* @__PURE__ */ ((e) => (e[e.INVALID_PARAM = 10001] = "INVALID_PARAM", e[e.API_UNAVAILABLE = 10002] = "API_UNAVAILABLE", e[e.URL_SCHEME_NOT_ALLOWED = 10003] = "URL_SCHEME_NOT_ALLOWED", e[e.REQUEST_TIMEOUT = 10101] = "REQUEST_TIMEOUT", e[e.REQUEST_ABORTED = 10102] = "REQUEST_ABORTED", e[e.REQUEST_FAILED = 15201] = "REQUEST_FAILED", e[e.STORAGE_IO_ERROR = 50101] = "STORAGE_IO_ERROR", e[e.STORAGE_QUOTA_EXCEEDED = 50201] = "STORAGE_QUOTA_EXCEEDED", e[e.FILE_NOT_FOUND = 50202] = "FILE_NOT_FOUND", e[e.PATH_INVALID = 50203] = "PATH_INVALID", e[e.FILE_ALREADY_EXISTS = 50204] = "FILE_ALREADY_EXISTS", e[e.NOT_A_FILE = 50205] = "NOT_A_FILE", e[e.NOT_A_DIRECTORY = 50206] = "NOT_A_DIRECTORY", e))(f || {});
|
|
70
|
+
function m(e, n) {
|
|
71
71
|
return Object.assign(new Error(n), { code: e });
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class I {
|
|
74
74
|
constructor() {
|
|
75
75
|
this.buffer = "";
|
|
76
76
|
}
|
|
@@ -86,42 +86,42 @@ class E {
|
|
|
86
86
|
const t = [];
|
|
87
87
|
let o = 0, r = 0, s = 0;
|
|
88
88
|
for (; s < this.buffer.length; ) {
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
89
|
+
const a = this.buffer[s];
|
|
90
|
+
if (a !== "\r" && a !== `
|
|
91
91
|
`) {
|
|
92
92
|
s += 1;
|
|
93
93
|
continue;
|
|
94
94
|
}
|
|
95
|
-
let
|
|
96
|
-
if (
|
|
97
|
-
if (
|
|
98
|
-
this.buffer[
|
|
99
|
-
` && (
|
|
95
|
+
let c = s + 1;
|
|
96
|
+
if (a === "\r") {
|
|
97
|
+
if (c === this.buffer.length && !n) break;
|
|
98
|
+
this.buffer[c] === `
|
|
99
|
+
` && (c += 1);
|
|
100
100
|
}
|
|
101
|
-
s === r && (t.push(this.buffer.slice(o,
|
|
101
|
+
s === r && (t.push(this.buffer.slice(o, c)), o = c), r = c, s = c;
|
|
102
102
|
}
|
|
103
103
|
return o > 0 && (this.buffer = this.buffer.slice(o)), t;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function ee() {
|
|
107
107
|
let e = "";
|
|
108
108
|
const n = (t) => {
|
|
109
109
|
const o = [];
|
|
110
|
-
let r = 0, s = 0,
|
|
111
|
-
for (;
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
110
|
+
let r = 0, s = 0, a = 0;
|
|
111
|
+
for (; a < e.length; ) {
|
|
112
|
+
const c = e[a];
|
|
113
|
+
if (c !== "\r" && c !== `
|
|
114
114
|
`) {
|
|
115
|
-
|
|
115
|
+
a += 1;
|
|
116
116
|
continue;
|
|
117
117
|
}
|
|
118
|
-
let i =
|
|
119
|
-
if (
|
|
118
|
+
let i = a + 1;
|
|
119
|
+
if (c === "\r") {
|
|
120
120
|
if (i === e.length && !t) break;
|
|
121
121
|
e[i] === `
|
|
122
122
|
` && (i += 1);
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
a === s && (o.push(e.slice(r, i)), r = i), s = i, a = i;
|
|
125
125
|
}
|
|
126
126
|
return r > 0 && (e = e.slice(r)), o;
|
|
127
127
|
};
|
|
@@ -135,30 +135,30 @@ function K() {
|
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function S(e) {
|
|
139
139
|
return e?.toLowerCase().includes("text/event-stream") ?? !1;
|
|
140
140
|
}
|
|
141
|
-
const
|
|
142
|
-
async function
|
|
143
|
-
|
|
144
|
-
const o =
|
|
141
|
+
const R = /* @__PURE__ */ new WeakMap();
|
|
142
|
+
async function te(e, n, t) {
|
|
143
|
+
N(n.data);
|
|
144
|
+
const o = R.get(e);
|
|
145
145
|
if (o) return o(n, t);
|
|
146
|
-
const r = await e(
|
|
146
|
+
const r = await e(L(n, t.signal));
|
|
147
147
|
if (t.signal.aborted)
|
|
148
|
-
throw f
|
|
149
|
-
|
|
150
|
-
const s =
|
|
151
|
-
return t.onHeaders({ taskId: n.taskId, statusCode: r.statusCode, header: s }), n.enableChunked &&
|
|
148
|
+
throw m(f.REQUEST_ABORTED, "request aborted");
|
|
149
|
+
U(r);
|
|
150
|
+
const s = A(r.header);
|
|
151
|
+
return t.onHeaders({ taskId: n.taskId, statusCode: r.statusCode, header: s }), n.enableChunked && S(s["content-type"]) && (typeof r.data == "string" || C(r.data)) ? (await P(r.data, n.taskId, t), { taskId: n.taskId, statusCode: r.statusCode, data: "", header: s }) : {
|
|
152
152
|
taskId: n.taskId,
|
|
153
153
|
statusCode: r.statusCode,
|
|
154
|
-
data: await
|
|
154
|
+
data: await B(r.data, n),
|
|
155
155
|
header: s
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function L(e, n) {
|
|
159
159
|
const t = e.data, o = { ...e.header }, r = e.method.toUpperCase();
|
|
160
160
|
return r === "GET" || r === "HEAD" ? {
|
|
161
|
-
url:
|
|
161
|
+
url: O(e.url, k(t)),
|
|
162
162
|
method: e.method,
|
|
163
163
|
header: o,
|
|
164
164
|
responseType: e.responseType,
|
|
@@ -168,48 +168,48 @@ function R(e, n) {
|
|
|
168
168
|
url: e.url,
|
|
169
169
|
method: e.method,
|
|
170
170
|
header: o,
|
|
171
|
-
data:
|
|
171
|
+
data: D(t, o),
|
|
172
172
|
responseType: e.responseType,
|
|
173
173
|
enableChunked: e.enableChunked,
|
|
174
174
|
signal: n
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function O(e, n) {
|
|
178
178
|
if (!n) return e;
|
|
179
179
|
const t = e.indexOf("#"), o = t >= 0 ? e.slice(t) : "", r = t >= 0 ? e.slice(0, t) : e;
|
|
180
180
|
return `${r}${r.includes("?") ? "&" : "?"}${n}${o}`;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function k(e) {
|
|
183
183
|
return e == null ? "" : typeof e == "string" ? e : typeof e != "object" || Array.isArray(e) ? String(e) : Object.entries(e).map(([n, t]) => `${encodeURIComponent(n)}=${encodeURIComponent(String(t))}`).join("&");
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function D(e, n) {
|
|
186
186
|
if (e == null || typeof e == "string") return e;
|
|
187
|
-
let t =
|
|
188
|
-
return t || (t = "application/json", n["content-type"] = t), t.toLowerCase().includes("application/json") ? JSON.stringify(e) : t.toLowerCase().includes("application/x-www-form-urlencoded") ?
|
|
187
|
+
let t = x(n, "content-type");
|
|
188
|
+
return t || (t = "application/json", n["content-type"] = t), t.toLowerCase().includes("application/json") ? JSON.stringify(e) : t.toLowerCase().includes("application/x-www-form-urlencoded") ? k(e) : String(e);
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function x(e, n) {
|
|
191
191
|
const t = Object.keys(e).find((o) => o.toLowerCase() === n);
|
|
192
192
|
return t ? String(e[t]) : void 0;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function N(e) {
|
|
195
195
|
if (!(!(e instanceof ArrayBuffer) && !ArrayBuffer.isView(e)))
|
|
196
|
-
throw
|
|
197
|
-
|
|
196
|
+
throw m(
|
|
197
|
+
f.INVALID_PARAM,
|
|
198
198
|
"request data does not support ArrayBuffer"
|
|
199
199
|
);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function U(e) {
|
|
202
202
|
if (!e || typeof e != "object" || typeof e.statusCode != "number")
|
|
203
|
-
throw
|
|
204
|
-
|
|
203
|
+
throw m(
|
|
204
|
+
f.REQUEST_FAILED,
|
|
205
205
|
"host request adapter returned an invalid response"
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function C(e) {
|
|
209
209
|
return !!(e && typeof e == "object" && "getReader" in e);
|
|
210
210
|
}
|
|
211
|
-
async function
|
|
212
|
-
const o = new
|
|
211
|
+
async function P(e, n, t) {
|
|
212
|
+
const o = new I(), r = (i) => {
|
|
213
213
|
for (const u of o.push(i)) t.onChunk({ taskId: n, chunk: u });
|
|
214
214
|
};
|
|
215
215
|
if (typeof e == "string") {
|
|
@@ -217,34 +217,34 @@ async function U(e, n, t) {
|
|
|
217
217
|
for (const i of o.finish()) t.onChunk({ taskId: n, chunk: i });
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
|
-
const s = e.getReader(),
|
|
220
|
+
const s = e.getReader(), a = new TextDecoder(), c = () => void s.cancel().catch(() => {
|
|
221
221
|
});
|
|
222
|
-
t.signal.addEventListener("abort",
|
|
222
|
+
t.signal.addEventListener("abort", c, { once: !0 });
|
|
223
223
|
try {
|
|
224
224
|
for (; ; ) {
|
|
225
225
|
if (t.signal.aborted) return;
|
|
226
226
|
const u = await s.read();
|
|
227
227
|
if (u.done) break;
|
|
228
|
-
const
|
|
229
|
-
|
|
228
|
+
const l = typeof u.value == "string" ? u.value : a.decode(u.value, { stream: !0 });
|
|
229
|
+
l && r(l);
|
|
230
230
|
}
|
|
231
|
-
const i =
|
|
231
|
+
const i = a.decode();
|
|
232
232
|
i && r(i);
|
|
233
233
|
for (const u of o.finish()) t.onChunk({ taskId: n, chunk: u });
|
|
234
234
|
} finally {
|
|
235
|
-
t.signal.removeEventListener("abort",
|
|
235
|
+
t.signal.removeEventListener("abort", c), s.releaseLock();
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function A(e) {
|
|
239
239
|
const n = {};
|
|
240
240
|
for (const [t, o] of Object.entries(e ?? {}))
|
|
241
241
|
t.toLowerCase() !== "set-cookie" && (n[t.toLowerCase()] = String(o));
|
|
242
242
|
return n;
|
|
243
243
|
}
|
|
244
|
-
async function
|
|
244
|
+
async function B(e, n) {
|
|
245
245
|
if (e instanceof ArrayBuffer || ArrayBuffer.isView(e))
|
|
246
|
-
throw
|
|
247
|
-
|
|
246
|
+
throw m(
|
|
247
|
+
f.REQUEST_FAILED,
|
|
248
248
|
"request response does not support ArrayBuffer"
|
|
249
249
|
);
|
|
250
250
|
if (n.dataType === "json" && typeof e == "string")
|
|
@@ -255,7 +255,7 @@ async function A(e, n) {
|
|
|
255
255
|
}
|
|
256
256
|
return e;
|
|
257
257
|
}
|
|
258
|
-
const
|
|
258
|
+
const F = "miniapp_simulator_event", q = "skillbuilder-miniapp", j = {
|
|
259
259
|
cn: {
|
|
260
260
|
production: "https://apm-fe.xiaohongshu.com/api/data",
|
|
261
261
|
development: "https://apm-fe-test.xiaohongshu.com/api/data"
|
|
@@ -264,11 +264,11 @@ const B = "miniapp_simulator_event", C = "skillbuilder-miniapp", F = {
|
|
|
264
264
|
production: "https://apm-fe.rnote.com/api/data",
|
|
265
265
|
development: "https://apm-fe.rnote.com/api/data"
|
|
266
266
|
}
|
|
267
|
-
},
|
|
268
|
-
function
|
|
267
|
+
}, b = 10, H = 1e4;
|
|
268
|
+
function w() {
|
|
269
269
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function V(e) {
|
|
272
272
|
return Object.fromEntries(
|
|
273
273
|
Object.entries(e).map(([n, t]) => [
|
|
274
274
|
n,
|
|
@@ -276,7 +276,7 @@ function q(e) {
|
|
|
276
276
|
])
|
|
277
277
|
);
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function Q(e, n) {
|
|
280
280
|
const t = typeof window < "u";
|
|
281
281
|
return {
|
|
282
282
|
clientTime: Date.now(),
|
|
@@ -296,21 +296,37 @@ function V(e, n) {
|
|
|
296
296
|
context_matchedPath: t ? window.location.pathname : "",
|
|
297
297
|
context_route: t ? window.location.href : "",
|
|
298
298
|
context_userAgent: typeof navigator < "u" ? navigator.userAgent : "",
|
|
299
|
-
context_artifactName:
|
|
300
|
-
context_artifactVersion:
|
|
299
|
+
context_artifactName: q,
|
|
300
|
+
context_artifactVersion: T,
|
|
301
301
|
context_deviceLevel: "unknown",
|
|
302
302
|
context_feSdkVersion: "1.3.13",
|
|
303
303
|
context_userId: n.userId,
|
|
304
|
-
measurement_name:
|
|
304
|
+
measurement_name: F,
|
|
305
305
|
measurement_data: {
|
|
306
306
|
event_name: e.name,
|
|
307
307
|
timestamp: e.timestamp,
|
|
308
|
-
...
|
|
308
|
+
...V(e.payload)
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
|
|
312
|
+
const y = [250, 1e3], M = 5e3;
|
|
313
|
+
let E = Promise.resolve();
|
|
314
|
+
function W(e, n) {
|
|
315
|
+
const t = async () => {
|
|
316
|
+
let o;
|
|
317
|
+
try {
|
|
318
|
+
o = await z(e.endpoint, n);
|
|
319
|
+
} catch {
|
|
320
|
+
o = { ok: !1, attempts: 0, eventCount: n.length };
|
|
321
|
+
}
|
|
322
|
+
try {
|
|
323
|
+
e.onDelivery?.(o);
|
|
324
|
+
} catch {
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
E = E.then(t, t);
|
|
328
|
+
}
|
|
329
|
+
async function z(e, n) {
|
|
314
330
|
const t = n.length;
|
|
315
331
|
if (typeof fetch != "function" || t === 0)
|
|
316
332
|
return { ok: !1, attempts: 0, eventCount: t };
|
|
@@ -325,91 +341,93 @@ async function Q(e, n) {
|
|
|
325
341
|
keepalive: !0
|
|
326
342
|
};
|
|
327
343
|
let r;
|
|
328
|
-
for (let s = 0; s <=
|
|
344
|
+
for (let s = 0; s <= y.length; s += 1) {
|
|
345
|
+
const a = new AbortController(), c = setTimeout(() => a.abort(), M);
|
|
329
346
|
try {
|
|
330
|
-
const
|
|
331
|
-
if (r =
|
|
332
|
-
return { ok: !0, status:
|
|
333
|
-
if (
|
|
334
|
-
return { ok: !1, status:
|
|
347
|
+
const u = await fetch(e, { ...o, signal: a.signal });
|
|
348
|
+
if (r = u.status, u.ok)
|
|
349
|
+
return { ok: !0, status: u.status, attempts: s + 1, eventCount: t };
|
|
350
|
+
if (u.status >= 400 && u.status < 500)
|
|
351
|
+
return { ok: !1, status: u.status, attempts: s + 1, eventCount: t };
|
|
335
352
|
} catch {
|
|
353
|
+
} finally {
|
|
354
|
+
clearTimeout(c);
|
|
336
355
|
}
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
356
|
+
const i = y[s];
|
|
357
|
+
if (i === void 0)
|
|
339
358
|
return { ok: !1, status: r, attempts: s + 1, eventCount: t };
|
|
340
|
-
await new Promise((
|
|
359
|
+
await new Promise((u) => setTimeout(u, i));
|
|
341
360
|
}
|
|
342
|
-
return { ok: !1, status: r, attempts:
|
|
361
|
+
return { ok: !1, status: r, attempts: y.length + 1, eventCount: t };
|
|
343
362
|
}
|
|
344
|
-
function
|
|
363
|
+
function $(e) {
|
|
345
364
|
if (typeof console > "u") return;
|
|
346
365
|
const n = e.measurement_name ?? "apm";
|
|
347
366
|
console.groupCollapsed(`[apm] ${n}`), console.log(e), console.groupEnd();
|
|
348
367
|
}
|
|
349
|
-
function
|
|
350
|
-
const n = e.debug === !0, t =
|
|
351
|
-
let r = 0, s = [],
|
|
368
|
+
function G(e) {
|
|
369
|
+
const n = e.debug === !0, t = w(), o = w();
|
|
370
|
+
let r = 0, s = [], a = null, c = 0, i = !1;
|
|
352
371
|
const u = () => {
|
|
353
|
-
if (i = !1,
|
|
372
|
+
if (i = !1, a !== null && (clearTimeout(a), a = null), s.length === 0) return;
|
|
354
373
|
const h = s;
|
|
355
|
-
s = []
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
if (c !== null && (clearTimeout(c), c = null), a > 0) {
|
|
374
|
+
s = [];
|
|
375
|
+
for (let d = 0; d < h.length; d += b) {
|
|
376
|
+
const _ = h.slice(d, d + b);
|
|
377
|
+
W(e, _);
|
|
378
|
+
}
|
|
379
|
+
}, l = () => {
|
|
380
|
+
if (a !== null && (clearTimeout(a), a = null), c > 0) {
|
|
363
381
|
i = !0;
|
|
364
382
|
return;
|
|
365
383
|
}
|
|
366
384
|
u();
|
|
367
|
-
},
|
|
368
|
-
|
|
385
|
+
}, p = () => {
|
|
386
|
+
a === null && (a = setTimeout(l, H));
|
|
369
387
|
};
|
|
370
388
|
return {
|
|
371
389
|
sendCustomPoint(h) {
|
|
372
|
-
const
|
|
373
|
-
|
|
390
|
+
const d = r++;
|
|
391
|
+
c += 1, Promise.resolve().then(() => e.resolveUserId()).catch(() => "").then((_) => {
|
|
374
392
|
try {
|
|
375
|
-
const
|
|
393
|
+
const g = Q(h, {
|
|
376
394
|
sessionId: t,
|
|
377
395
|
pageSessionId: o,
|
|
378
|
-
seqId:
|
|
379
|
-
userId:
|
|
396
|
+
seqId: d,
|
|
397
|
+
userId: _,
|
|
380
398
|
region: e.region
|
|
381
399
|
});
|
|
382
400
|
if (n) {
|
|
383
|
-
|
|
401
|
+
$(g);
|
|
384
402
|
return;
|
|
385
403
|
}
|
|
386
|
-
s.push(
|
|
404
|
+
s.push(g), s.length >= b ? setTimeout(() => l()) : p();
|
|
387
405
|
} catch {
|
|
388
406
|
}
|
|
389
407
|
}).finally(() => {
|
|
390
|
-
|
|
408
|
+
c -= 1, c === 0 && i && u();
|
|
391
409
|
});
|
|
392
410
|
},
|
|
393
|
-
flush:
|
|
411
|
+
flush: l
|
|
394
412
|
};
|
|
395
413
|
}
|
|
396
|
-
function
|
|
414
|
+
function X(e) {
|
|
397
415
|
const n = e.region ?? "cn";
|
|
398
416
|
if (e.endpoint) return e.endpoint;
|
|
399
|
-
const t =
|
|
400
|
-
return
|
|
417
|
+
const t = Y();
|
|
418
|
+
return j[n][t];
|
|
401
419
|
}
|
|
402
|
-
function
|
|
420
|
+
function Y() {
|
|
403
421
|
if (typeof window > "u") return "production";
|
|
404
422
|
const e = window.location.hostname.toLowerCase();
|
|
405
423
|
return e === "localhost" || e === "127.0.0.1" || e === "0.0.0.0" || e.includes(".sit.") || // hostname.includes(".beta.") ||
|
|
406
424
|
e.startsWith("local.") ? "development" : "production";
|
|
407
425
|
}
|
|
408
|
-
function
|
|
426
|
+
function K(e, n) {
|
|
409
427
|
if (e === !1) return null;
|
|
410
428
|
try {
|
|
411
|
-
const t = e.region ?? "cn", o =
|
|
412
|
-
endpoint:
|
|
429
|
+
const t = e.region ?? "cn", o = G({
|
|
430
|
+
endpoint: X(e),
|
|
413
431
|
region: t,
|
|
414
432
|
resolveUserId: n ?? (() => Promise.resolve("")),
|
|
415
433
|
debug: e.debug
|
|
@@ -419,7 +437,7 @@ function G(e, n) {
|
|
|
419
437
|
return null;
|
|
420
438
|
}
|
|
421
439
|
}
|
|
422
|
-
class
|
|
440
|
+
class ne {
|
|
423
441
|
constructor(n, t, o, r) {
|
|
424
442
|
this.resolveContext = r, this.unsubscribers = [], this.common = {
|
|
425
443
|
business_line: "",
|
|
@@ -427,7 +445,7 @@ class J {
|
|
|
427
445
|
content_mode: "",
|
|
428
446
|
renderer: ""
|
|
429
447
|
};
|
|
430
|
-
const s =
|
|
448
|
+
const s = K(n, o);
|
|
431
449
|
if (!s) {
|
|
432
450
|
this.send = () => {
|
|
433
451
|
}, this.flush = () => {
|
|
@@ -583,20 +601,20 @@ class J {
|
|
|
583
601
|
this.unsubscribers.length = 0;
|
|
584
602
|
}
|
|
585
603
|
}
|
|
586
|
-
function
|
|
604
|
+
function se(e) {
|
|
587
605
|
return !(e === void 0 || e === !1);
|
|
588
606
|
}
|
|
589
607
|
export {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
608
|
+
f as M,
|
|
609
|
+
J as a,
|
|
610
|
+
m as b,
|
|
611
|
+
G as c,
|
|
612
|
+
ee as d,
|
|
613
|
+
te as e,
|
|
614
|
+
se as f,
|
|
615
|
+
ne as g,
|
|
616
|
+
S as i,
|
|
617
|
+
Z as o,
|
|
618
|
+
X as r,
|
|
619
|
+
T as v
|
|
602
620
|
};
|