@blueking/open-telemetry 0.0.22-beta.1 → 0.0.22
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/dist/bk-rum.global.js +2 -2
- package/dist/bk-rum.global.js.map +1 -1
- package/dist/core/config.d.ts +6 -8
- package/dist/core/runtime-context.d.ts +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +555 -539
- package/dist/index.js.map +1 -1
- package/dist/plugins/device.d.ts +2 -2
- package/dist/plugins/resource.d.ts +1 -0
- package/dist/plugins/web-vitals.d.ts +1 -3
- package/package.json +1 -1
- package/skills/bk-rum-otele/SKILL.md +9 -11
- package/skills/bk-rum-otele/references/api.md +1 -1
- package/skills/bk-rum-otele/references/configuration.md +3 -3
- package/skills/bk-rum-otele/references/plugins-error-security.md +4 -7
- package/skills/bk-rum-otele/references/plugins-experience.md +4 -4
- package/skills/bk-rum-otele/references/telemetry-reference.md +1 -1
package/dist/index.js
CHANGED
|
@@ -2,16 +2,15 @@ import { SpanKind as e, SpanStatusCode as t, context as n, propagation as r, tra
|
|
|
2
2
|
import { ZoneContextManager as a } from "@opentelemetry/context-zone";
|
|
3
3
|
import { W3CTraceContextPropagator as o } from "@opentelemetry/core";
|
|
4
4
|
import { OTLPTraceExporter as s } from "@opentelemetry/exporter-trace-otlp-http";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { WebTracerProvider as p } from "@opentelemetry/sdk-trace-web";
|
|
5
|
+
import { resourceFromAttributes as c } from "@opentelemetry/resources";
|
|
6
|
+
import { BatchSpanProcessor as l, SamplingDecision as u, SimpleSpanProcessor as d } from "@opentelemetry/sdk-trace-base";
|
|
7
|
+
import { WebTracerProvider as f } from "@opentelemetry/sdk-trace-web";
|
|
9
8
|
//#region package.json
|
|
10
|
-
var
|
|
9
|
+
var p = "0.0.22", m = (e) => {
|
|
11
10
|
let t = 5381;
|
|
12
11
|
for (let n = 0; n < e.length; n++) t = t * 33 ^ e.charCodeAt(n);
|
|
13
12
|
return (t >>> 0).toString(36);
|
|
14
|
-
},
|
|
13
|
+
}, h = (e) => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`, g = {
|
|
15
14
|
actionFrustrationType: "action.frustration.type",
|
|
16
15
|
actionId: "action.id",
|
|
17
16
|
actionLoadingTime: "action.loading_time",
|
|
@@ -70,36 +69,36 @@ var m = "0.0.22-beta.1", h = (e) => typeof crypto < "u" && typeof crypto.randomU
|
|
|
70
69
|
};
|
|
71
70
|
//#endregion
|
|
72
71
|
//#region \0@oxc-project+runtime@0.128.0/helpers/typeof.js
|
|
73
|
-
function
|
|
72
|
+
function _(e) {
|
|
74
73
|
"@babel/helpers - typeof";
|
|
75
|
-
return
|
|
74
|
+
return _ = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
76
75
|
return typeof e;
|
|
77
76
|
} : function(e) {
|
|
78
77
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
79
|
-
},
|
|
78
|
+
}, _(e);
|
|
80
79
|
}
|
|
81
80
|
//#endregion
|
|
82
81
|
//#region \0@oxc-project+runtime@0.128.0/helpers/toPrimitive.js
|
|
83
|
-
function
|
|
84
|
-
if (
|
|
82
|
+
function v(e, t) {
|
|
83
|
+
if (_(e) != "object" || !e) return e;
|
|
85
84
|
var n = e[Symbol.toPrimitive];
|
|
86
85
|
if (n !== void 0) {
|
|
87
86
|
var r = n.call(e, t || "default");
|
|
88
|
-
if (
|
|
87
|
+
if (_(r) != "object") return r;
|
|
89
88
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
90
89
|
}
|
|
91
90
|
return (t === "string" ? String : Number)(e);
|
|
92
91
|
}
|
|
93
92
|
//#endregion
|
|
94
93
|
//#region \0@oxc-project+runtime@0.128.0/helpers/toPropertyKey.js
|
|
95
|
-
function
|
|
96
|
-
var t =
|
|
97
|
-
return
|
|
94
|
+
function y(e) {
|
|
95
|
+
var t = v(e, "string");
|
|
96
|
+
return _(t) == "symbol" ? t : t + "";
|
|
98
97
|
}
|
|
99
98
|
//#endregion
|
|
100
99
|
//#region \0@oxc-project+runtime@0.128.0/helpers/defineProperty.js
|
|
101
|
-
function
|
|
102
|
-
return (t =
|
|
100
|
+
function b(e, t, n) {
|
|
101
|
+
return (t = y(t)) in e ? Object.defineProperty(e, t, {
|
|
103
102
|
value: n,
|
|
104
103
|
enumerable: !0,
|
|
105
104
|
configurable: !0,
|
|
@@ -108,7 +107,7 @@ function x(e, t, n) {
|
|
|
108
107
|
}
|
|
109
108
|
//#endregion
|
|
110
109
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectSpread2.js
|
|
111
|
-
function
|
|
110
|
+
function x(e, t) {
|
|
112
111
|
var n = Object.keys(e);
|
|
113
112
|
if (Object.getOwnPropertySymbols) {
|
|
114
113
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -118,12 +117,12 @@ function S(e, t) {
|
|
|
118
117
|
}
|
|
119
118
|
return n;
|
|
120
119
|
}
|
|
121
|
-
function
|
|
120
|
+
function S(e) {
|
|
122
121
|
for (var t = 1; t < arguments.length; t++) {
|
|
123
122
|
var n = arguments[t] == null ? {} : arguments[t];
|
|
124
|
-
t % 2 ?
|
|
125
|
-
|
|
126
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) :
|
|
123
|
+
t % 2 ? x(Object(n), !0).forEach(function(t) {
|
|
124
|
+
b(e, t, n[t]);
|
|
125
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : x(Object(n)).forEach(function(t) {
|
|
127
126
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
128
127
|
});
|
|
129
128
|
}
|
|
@@ -131,7 +130,7 @@ function C(e) {
|
|
|
131
130
|
}
|
|
132
131
|
//#endregion
|
|
133
132
|
//#region src/plugins/device.ts
|
|
134
|
-
var
|
|
133
|
+
var C = "BK_RUM_DEVICE_ID", w = 250, T = () => navigator.connection, ee = () => navigator.userAgentData, te = (e) => {
|
|
135
134
|
for (let [t, n] of [
|
|
136
135
|
["Edge", /Edg\/([\d.]+)/],
|
|
137
136
|
["Chrome", /Chrome\/([\d.]+)/],
|
|
@@ -148,10 +147,10 @@ var w = "BK_RUM_DEVICE_ID", T = 250, ee = () => navigator.connection, te = () =>
|
|
|
148
147
|
name: "Other",
|
|
149
148
|
version: void 0
|
|
150
149
|
};
|
|
151
|
-
},
|
|
150
|
+
}, ne = (e, t) => {
|
|
152
151
|
let n = `${t == null ? "" : t} ${e}`;
|
|
153
152
|
return /iphone|ipad|ipod/i.test(n) ? "iOS" : /android/i.test(n) ? "Android" : /mac/i.test(n) ? "macOS" : /win/i.test(n) ? "Windows" : /linux/i.test(n) ? "Linux" : "Other";
|
|
154
|
-
},
|
|
153
|
+
}, re = (e) => {
|
|
155
154
|
let t = null;
|
|
156
155
|
try {
|
|
157
156
|
t = window.localStorage.getItem(e);
|
|
@@ -162,7 +161,7 @@ var w = "BK_RUM_DEVICE_ID", T = 250, ee = () => navigator.connection, te = () =>
|
|
|
162
161
|
window.localStorage.setItem(e, n);
|
|
163
162
|
} catch (e) {}
|
|
164
163
|
return n;
|
|
165
|
-
},
|
|
164
|
+
}, ie = () => {
|
|
166
165
|
var e, t;
|
|
167
166
|
return typeof window > "u" ? {} : {
|
|
168
167
|
"browser.viewport.width": window.innerWidth,
|
|
@@ -170,8 +169,8 @@ var w = "BK_RUM_DEVICE_ID", T = 250, ee = () => navigator.connection, te = () =>
|
|
|
170
169
|
"browser.screen.width": (e = window.screen) == null ? void 0 : e.width,
|
|
171
170
|
"browser.screen.height": (t = window.screen) == null ? void 0 : t.height
|
|
172
171
|
};
|
|
173
|
-
},
|
|
174
|
-
let e =
|
|
172
|
+
}, ae = () => {
|
|
173
|
+
let e = T();
|
|
175
174
|
return e ? {
|
|
176
175
|
"network.effective_type": e.effectiveType,
|
|
177
176
|
"network.connection_type": e.type,
|
|
@@ -179,40 +178,40 @@ var w = "BK_RUM_DEVICE_ID", T = 250, ee = () => navigator.connection, te = () =>
|
|
|
179
178
|
"network.rtt": e.rtt,
|
|
180
179
|
"network.save_data": e.saveData
|
|
181
180
|
} : {};
|
|
182
|
-
},
|
|
181
|
+
}, oe = () => {
|
|
183
182
|
if (typeof navigator > "u") return {};
|
|
184
|
-
let e =
|
|
183
|
+
let e = ee(), t = navigator.userAgent, n = te(t), r = ne(t, e == null ? void 0 : e.platform), i = e != null && e.mobile || /mobi|android|iphone|ipad|ipod/i.test(t) ? "mobile" : "desktop";
|
|
185
184
|
return {
|
|
186
|
-
[
|
|
187
|
-
[
|
|
188
|
-
[
|
|
189
|
-
[
|
|
190
|
-
[
|
|
191
|
-
[
|
|
185
|
+
[g.deviceMemoryGib]: navigator.deviceMemory,
|
|
186
|
+
[g.deviceLogicalProcessorCount]: navigator.hardwareConcurrency,
|
|
187
|
+
[g.browserName]: n.name,
|
|
188
|
+
[g.browserVersion]: n.version,
|
|
189
|
+
[g.deviceType]: i,
|
|
190
|
+
[g.osName]: r
|
|
192
191
|
};
|
|
193
|
-
},
|
|
192
|
+
}, se = (e, t) => {
|
|
194
193
|
let n;
|
|
195
194
|
return () => {
|
|
196
195
|
n !== void 0 && window.clearTimeout(n), n = window.setTimeout(() => {
|
|
197
196
|
n = void 0, e();
|
|
198
197
|
}, t);
|
|
199
198
|
};
|
|
200
|
-
},
|
|
199
|
+
}, ce = (e = {}) => {
|
|
201
200
|
let t = [];
|
|
202
201
|
return {
|
|
203
202
|
name: "device",
|
|
204
203
|
init(n) {
|
|
205
204
|
var r;
|
|
206
|
-
let i = (r = e.storageKey) == null ? `${
|
|
207
|
-
if (n.setRuntimeAttributes(
|
|
208
|
-
let o =
|
|
209
|
-
n.setRuntimeAttributes(
|
|
210
|
-
},
|
|
205
|
+
let i = (r = e.storageKey) == null ? `${C}_${m(n.config.application.name)}` : r, a = typeof window > "u" || e.persistentId !== !0 ? h("device") : re(i);
|
|
206
|
+
if (n.setRuntimeAttributes(S(S(S({ "device.id": a }, n.config.tracking.device === !1 ? oe() : {}), ie()), ae())), typeof window > "u") return;
|
|
207
|
+
let o = se(() => {
|
|
208
|
+
n.setRuntimeAttributes(ie());
|
|
209
|
+
}, w);
|
|
211
210
|
window.addEventListener("resize", o), window.addEventListener("orientationchange", o), t.push(() => window.removeEventListener("resize", o), () => window.removeEventListener("orientationchange", o));
|
|
212
|
-
let s =
|
|
211
|
+
let s = T();
|
|
213
212
|
if (s && typeof s.addEventListener == "function") {
|
|
214
213
|
let e = () => {
|
|
215
|
-
n.setRuntimeAttributes(
|
|
214
|
+
n.setRuntimeAttributes(ae());
|
|
216
215
|
};
|
|
217
216
|
s.addEventListener("change", e), t.push(() => {
|
|
218
217
|
var t;
|
|
@@ -227,48 +226,49 @@ var w = "BK_RUM_DEVICE_ID", T = 250, ee = () => navigator.connection, te = () =>
|
|
|
227
226
|
}
|
|
228
227
|
}
|
|
229
228
|
};
|
|
230
|
-
},
|
|
229
|
+
}, le = (e) => e.trim().replace(/\/+$/, ""), ue = (e) => {
|
|
231
230
|
var t;
|
|
232
|
-
let n = e.token || e.headers ?
|
|
231
|
+
let n = e.token || e.headers ? S(S({}, e.token ? { Authorization: `Bearer ${e.token}` } : {}), (t = e.headers) == null ? {} : t) : void 0;
|
|
233
232
|
return {
|
|
234
233
|
concurrencyLimit: e.concurrencyLimit,
|
|
235
|
-
endpoint: `${
|
|
234
|
+
endpoint: `${le(e.endpoint)}/v1/rum`,
|
|
236
235
|
headers: n,
|
|
237
236
|
timeoutMillis: e.timeoutMillis
|
|
238
237
|
};
|
|
239
|
-
},
|
|
238
|
+
}, de = (e) => typeof e != "number" || !Number.isFinite(e) ? 1 : Math.max(0, Math.min(1, e)), fe = (e) => e, pe = (e) => {
|
|
239
|
+
if (!e) return e;
|
|
240
240
|
try {
|
|
241
241
|
let t = new URL(e, typeof location > "u" ? "http://localhost" : location.href);
|
|
242
242
|
return t.username = "", t.password = "", t.search = "", t.hash = "", t.href;
|
|
243
243
|
} catch (t) {
|
|
244
244
|
return e.replace(/[?#].*$/, "");
|
|
245
245
|
}
|
|
246
|
-
},
|
|
246
|
+
}, me = (e) => {
|
|
247
247
|
try {
|
|
248
248
|
return new URL(e, typeof location > "u" ? "http://localhost" : location.href).pathname || "/";
|
|
249
249
|
} catch (t) {
|
|
250
250
|
return e || "/";
|
|
251
251
|
}
|
|
252
|
-
},
|
|
252
|
+
}, he = (e) => {
|
|
253
253
|
var t;
|
|
254
254
|
return {
|
|
255
255
|
environment: (t = e.environment) == null ? "production" : t,
|
|
256
256
|
name: e.name,
|
|
257
257
|
version: e.version
|
|
258
258
|
};
|
|
259
|
-
},
|
|
260
|
-
[
|
|
261
|
-
[
|
|
262
|
-
}, e.version ? { [
|
|
263
|
-
[
|
|
259
|
+
}, ge = (e, t, n) => S(S(S({ [g.deploymentEnvironmentName]: e.environment }, t === !1 ? {} : oe()), {}, {
|
|
260
|
+
[g.rumSchemaVersion]: "2",
|
|
261
|
+
[g.serviceName]: e.name
|
|
262
|
+
}, e.version ? { [g.serviceVersion]: e.version } : {}), {}, {
|
|
263
|
+
[g.sessionSampleRate]: n,
|
|
264
264
|
"telemetry.sdk.language": "webjs",
|
|
265
265
|
"telemetry.sdk.name": "@blueking/open-telemetry",
|
|
266
|
-
"telemetry.sdk.version":
|
|
267
|
-
}),
|
|
266
|
+
"telemetry.sdk.version": p
|
|
267
|
+
}), _e = (e) => {
|
|
268
268
|
var t;
|
|
269
269
|
if (!e) throw Error("[bk-ot] transport is required.");
|
|
270
270
|
if (!((t = e.endpoint) != null && t.trim())) throw Error("[bk-ot] transport.endpoint is required.");
|
|
271
|
-
},
|
|
271
|
+
}, ve = (e) => {
|
|
272
272
|
var t, n, r, i, a, o, s, c, l, u, d;
|
|
273
273
|
return {
|
|
274
274
|
beforeSend: (t = e.tracking) == null ? void 0 : t.beforeSend,
|
|
@@ -280,16 +280,16 @@ var w = "BK_RUM_DEVICE_ID", T = 250, ee = () => navigator.connection, te = () =>
|
|
|
280
280
|
getCustomAttributes: (o = (s = e.context) == null || (s = s.attributes) == null ? void 0 : s.custom) == null ? (() => ({})) : o,
|
|
281
281
|
getViewPathGroup: (t) => {
|
|
282
282
|
var n, r, i, a;
|
|
283
|
-
return (n = typeof ((r = e.tracking) == null ? void 0 : r.view) == "object" ? (i = (a = e.tracking.view).getPathGroup) == null ? void 0 : i.call(a, t) : void 0) == null ?
|
|
283
|
+
return (n = typeof ((r = e.tracking) == null ? void 0 : r.view) == "object" ? (i = (a = e.tracking.view).getPathGroup) == null ? void 0 : i.call(a, t) : void 0) == null ? me(t) : n;
|
|
284
284
|
},
|
|
285
|
-
redactAttributes: (c = (l = e.privacy) == null ? void 0 : l.redactAttributes) == null ?
|
|
286
|
-
redactUrl: (u = (d = e.privacy) == null ? void 0 : d.redactUrl) == null ?
|
|
285
|
+
redactAttributes: (c = (l = e.privacy) == null ? void 0 : l.redactAttributes) == null ? fe : c,
|
|
286
|
+
redactUrl: (u = (d = e.privacy) == null ? void 0 : d.redactUrl) == null ? pe : u
|
|
287
287
|
};
|
|
288
|
-
},
|
|
288
|
+
}, ye = (e) => {
|
|
289
289
|
var t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g;
|
|
290
290
|
if (!(!((t = e.application) == null || (t = t.name) == null) && t.trim())) throw Error("[bk-ot] application.name is required.");
|
|
291
|
-
|
|
292
|
-
let _ =
|
|
291
|
+
_e(e.transport);
|
|
292
|
+
let _ = he(e.application), v = typeof ((n = e.tracking) == null ? void 0 : n.view) == "object" ? e.tracking.view : void 0, y = ve(e), b = de((r = e.session) == null ? void 0 : r.sampleRate);
|
|
293
293
|
return {
|
|
294
294
|
application: _,
|
|
295
295
|
autoStart: (i = e.autoStart) == null ? !0 : i,
|
|
@@ -300,13 +300,13 @@ var w = "BK_RUM_DEVICE_ID", T = 250, ee = () => navigator.connection, te = () =>
|
|
|
300
300
|
plugins: [...(l = (u = e.extensions) == null ? void 0 : u.plugins) == null ? [] : l]
|
|
301
301
|
},
|
|
302
302
|
hooks: y,
|
|
303
|
-
resourceAttributes: y.redactAttributes(
|
|
304
|
-
session:
|
|
303
|
+
resourceAttributes: y.redactAttributes(ge(_, (d = e.tracking) == null ? void 0 : d.device, b)),
|
|
304
|
+
session: S(S({}, e.session), {}, { sampleRate: b }),
|
|
305
305
|
spanBatch: e.transport.batch,
|
|
306
306
|
spanProcessor: (f = e.transport.processor) == null ? "batch" : f,
|
|
307
307
|
tracking: (p = e.tracking) == null ? {} : p,
|
|
308
308
|
trackingConsent: (m = (h = e.privacy) == null ? void 0 : h.trackingConsent) == null ? "granted" : m,
|
|
309
|
-
transport:
|
|
309
|
+
transport: ue(e.transport),
|
|
310
310
|
user: (g = e.context) == null ? void 0 : g.user,
|
|
311
311
|
view: {
|
|
312
312
|
excludedActivityUrls: v == null ? void 0 : v.excludedActivityUrls,
|
|
@@ -317,7 +317,7 @@ var w = "BK_RUM_DEVICE_ID", T = 250, ee = () => navigator.connection, te = () =>
|
|
|
317
317
|
};
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region \0@oxc-project+runtime@0.128.0/helpers/asyncToGenerator.js
|
|
320
|
-
function
|
|
320
|
+
function be(e, t, n, r, i, a, o) {
|
|
321
321
|
try {
|
|
322
322
|
var s = e[a](o), c = s.value;
|
|
323
323
|
} catch (e) {
|
|
@@ -332,10 +332,10 @@ function E(e) {
|
|
|
332
332
|
return new Promise(function(r, i) {
|
|
333
333
|
var a = e.apply(t, n);
|
|
334
334
|
function o(e) {
|
|
335
|
-
|
|
335
|
+
be(a, r, i, o, s, "next", e);
|
|
336
336
|
}
|
|
337
337
|
function s(e) {
|
|
338
|
-
|
|
338
|
+
be(a, r, i, o, s, "throw", e);
|
|
339
339
|
}
|
|
340
340
|
o(void 0);
|
|
341
341
|
});
|
|
@@ -343,9 +343,9 @@ function E(e) {
|
|
|
343
343
|
}
|
|
344
344
|
//#endregion
|
|
345
345
|
//#region src/core/plugin.ts
|
|
346
|
-
var
|
|
346
|
+
var xe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !== !1, Se = (e) => e, Ce = class {
|
|
347
347
|
constructor(e) {
|
|
348
|
-
|
|
348
|
+
b(this, "plugins", void 0), b(this, "startedPlugins", []), this.plugins = e;
|
|
349
349
|
}
|
|
350
350
|
flush() {
|
|
351
351
|
var e = this;
|
|
@@ -370,7 +370,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
370
370
|
start(e) {
|
|
371
371
|
var t = this;
|
|
372
372
|
return E(function* () {
|
|
373
|
-
for (let r of t.plugins) if (
|
|
373
|
+
for (let r of t.plugins) if (xe(r, e.config)) try {
|
|
374
374
|
yield r.init(e), t.startedPlugins.push(r);
|
|
375
375
|
} catch (t) {
|
|
376
376
|
if (e.config.debug) {
|
|
@@ -380,38 +380,38 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
380
380
|
}
|
|
381
381
|
})();
|
|
382
382
|
}
|
|
383
|
-
}, D = "bk.rum.sampled",
|
|
383
|
+
}, D = "bk.rum.sampled", we = (e) => {
|
|
384
384
|
let t = 2166136261;
|
|
385
385
|
for (let n = 0; n < e.length; n += 1) t = Math.imul(t ^ e.charCodeAt(n), 16777619);
|
|
386
386
|
return t += t << 13, t ^= t >>> 7, t += t << 3, t ^= t >>> 17, t += t << 5, (t >>> 0) / 4294967296;
|
|
387
|
-
},
|
|
387
|
+
}, Te = ({ application: e, session: t }, n) => t.sampleRate <= 0 ? !1 : t.sampleRate >= 1 ? !0 : we(`${e.name}\0${n}`) < t.sampleRate, Ee = () => typeof window > "u" ? "http://localhost" : window.location.origin, O = (e) => {
|
|
388
388
|
try {
|
|
389
|
-
return new URL(e,
|
|
389
|
+
return new URL(e, Ee()).href;
|
|
390
390
|
} catch (t) {
|
|
391
391
|
return e;
|
|
392
392
|
}
|
|
393
|
-
},
|
|
394
|
-
let n = (e) =>
|
|
393
|
+
}, De = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, Oe = (e, t) => {
|
|
394
|
+
let n = (e) => De(e.replace(/[?#].*$/, ""));
|
|
395
395
|
return n(e) === n(t);
|
|
396
|
-
},
|
|
396
|
+
}, ke = (e, t) => Oe(O(t), O(e.transport.endpoint)), k = (e, t) => ke(e, t), Ae = (e, t) => typeof e == "function" ? e(t) : typeof e == "string" ? t.includes(e) : (e.lastIndex = 0, e.test(t)), A = (e, t) => (Array.isArray(e) ? e : e ? [e] : []).some((e) => Ae(e, t)), je = (e) => typeof e.tracking.request == "object" ? e.tracking.request : void 0, Me = (e, t) => {
|
|
397
397
|
var n;
|
|
398
|
-
return k(e, t) || A((n =
|
|
399
|
-
},
|
|
398
|
+
return k(e, t) || A((n = je(e)) == null ? void 0 : n.excludedUrls, O(t));
|
|
399
|
+
}, Ne = (e, t) => {
|
|
400
400
|
var n;
|
|
401
|
-
return A((n =
|
|
402
|
-
},
|
|
403
|
-
for (let n of
|
|
401
|
+
return A((n = je(e)) == null ? void 0 : n.allowedTracingUrls, O(t));
|
|
402
|
+
}, Pe = ["http.url", "url.full"], Fe = "bk.rum.request.discard", Ie = (e) => {
|
|
403
|
+
for (let n of Pe) {
|
|
404
404
|
var t;
|
|
405
405
|
let r = (t = e.attributes) == null ? void 0 : t[n];
|
|
406
406
|
if (typeof r == "string") return r;
|
|
407
407
|
}
|
|
408
|
-
},
|
|
409
|
-
let t = e == null ? void 0 : e[
|
|
408
|
+
}, Le = (e) => {
|
|
409
|
+
let t = e == null ? void 0 : e[g.sessionId];
|
|
410
410
|
return typeof t == "string" && t.length > 0;
|
|
411
|
-
},
|
|
412
|
-
let t = e == null ? void 0 : e[
|
|
411
|
+
}, Re = (e) => {
|
|
412
|
+
let t = e == null ? void 0 : e[g.viewId];
|
|
413
413
|
return typeof t == "string" && t.length > 0;
|
|
414
|
-
},
|
|
414
|
+
}, ze = (e) => (e == null ? void 0 : e["bk.rum.sampled"]) === !0 && Le(e) && Re(e), Be = class {
|
|
415
415
|
constructor(e, t, n) {
|
|
416
416
|
this.inner = e, this.config = t, this.getRuntimeAttributes = n;
|
|
417
417
|
}
|
|
@@ -419,8 +419,8 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
419
419
|
return this.inner.forceFlush();
|
|
420
420
|
}
|
|
421
421
|
onEnd(e) {
|
|
422
|
-
let t =
|
|
423
|
-
if (!(e.attributes["bk.rum.request.discard"] === !0 || t &&
|
|
422
|
+
let t = Ie(e);
|
|
423
|
+
if (!(e.attributes["bk.rum.request.discard"] === !0 || t && ke(this.config, t) || !ze(e.attributes) && !(e.name === "browser.session" && e.attributes["bk.rum.sampled"] === !0 && Le(e.attributes)))) {
|
|
424
424
|
delete e.attributes[D];
|
|
425
425
|
try {
|
|
426
426
|
var n, r;
|
|
@@ -445,9 +445,9 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
445
445
|
shutdown() {
|
|
446
446
|
return this.inner.shutdown();
|
|
447
447
|
}
|
|
448
|
-
},
|
|
448
|
+
}, Ve = new Set([...Object.values(g), D]), He = class {
|
|
449
449
|
constructor(e = {}, t) {
|
|
450
|
-
|
|
450
|
+
b(this, "actionHistory", []), b(this, "attributes", {}), b(this, "queuedViewCommands", []), b(this, "recordAssociation", (e, t, n, r) => {
|
|
451
451
|
let i = e.at(-1);
|
|
452
452
|
if (i && i.endedAt === void 0 && (i.endedAt = Math.max(i.startedAt, n)), r) {
|
|
453
453
|
let r = {};
|
|
@@ -461,19 +461,19 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
463
|
e.length > 100 && e.splice(0, e.length - 100);
|
|
464
|
-
}),
|
|
464
|
+
}), b(this, "sessionHistory", []), b(this, "sessionLifecycleListeners", /* @__PURE__ */ new Set()), b(this, "setOptionalAttribute", (e, t) => {
|
|
465
465
|
if (t === void 0) {
|
|
466
466
|
delete this.attributes[e];
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
this.attributes[e] = t;
|
|
470
|
-
}),
|
|
470
|
+
}), b(this, "user", {}), b(this, "view", {}), b(this, "viewAttributeKeys", /* @__PURE__ */ new Set()), b(this, "viewChangeListeners", /* @__PURE__ */ new Set()), b(this, "viewCommandListeners", /* @__PURE__ */ new Set()), b(this, "viewHistory", []), b(this, "viewScopedAttributeKeys", /* @__PURE__ */ new Set()), b(this, "dispatchViewCommand", (e) => {
|
|
471
471
|
if (this.viewCommandListeners.size === 0) {
|
|
472
472
|
this.queuedViewCommands.push(e);
|
|
473
473
|
return;
|
|
474
474
|
}
|
|
475
475
|
this.viewCommandListeners.forEach((t) => t(e));
|
|
476
|
-
}),
|
|
476
|
+
}), b(this, "getAttributes", () => S({}, this.attributes)), b(this, "getAttributesAt", (e) => {
|
|
477
477
|
if (!Number.isFinite(e)) return this.getAttributes();
|
|
478
478
|
let t = this.getAttributes(), n = (n, r) => {
|
|
479
479
|
for (let e of r) delete t[e];
|
|
@@ -481,16 +481,16 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
481
481
|
i && Object.assign(t, i.attributes);
|
|
482
482
|
};
|
|
483
483
|
return n(this.sessionHistory, [
|
|
484
|
-
|
|
485
|
-
|
|
484
|
+
g.sessionId,
|
|
485
|
+
g.sessionHasReplay,
|
|
486
486
|
D
|
|
487
|
-
]), n(this.viewHistory, this.viewScopedAttributeKeys), n(this.actionHistory, [
|
|
488
|
-
}),
|
|
487
|
+
]), n(this.viewHistory, this.viewScopedAttributeKeys), n(this.actionHistory, [g.actionId]), t;
|
|
488
|
+
}), b(this, "getUser", () => S({}, this.user)), b(this, "getView", () => S({}, this.view)), b(this, "isSessionActive", () => typeof this.attributes[g.sessionId] == "string"), b(this, "isViewActive", () => typeof this.attributes[g.viewId] == "string"), b(this, "notifySessionLifecycle", (e) => {
|
|
489
489
|
this.sessionLifecycleListeners.forEach((t) => t(e));
|
|
490
|
-
}),
|
|
490
|
+
}), b(this, "onSessionLifecycle", (e) => (this.sessionLifecycleListeners.add(e), () => this.sessionLifecycleListeners.delete(e))), b(this, "onViewChange", (e) => (this.viewChangeListeners.add(e), this.view.id && e(this.getView()), () => this.viewChangeListeners.delete(e))), b(this, "onViewCommand", (e) => {
|
|
491
491
|
for (this.viewCommandListeners.add(e); this.queuedViewCommands.length;) e(this.queuedViewCommands.shift());
|
|
492
492
|
return () => this.viewCommandListeners.delete(e);
|
|
493
|
-
}),
|
|
493
|
+
}), b(this, "setAttributes", (e, t = Date.now()) => {
|
|
494
494
|
for (let [t, n] of Object.entries(e)) {
|
|
495
495
|
if (n === void 0) {
|
|
496
496
|
delete this.attributes[t];
|
|
@@ -498,33 +498,33 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
498
498
|
}
|
|
499
499
|
this.attributes[t] = n;
|
|
500
500
|
}
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
|
|
501
|
+
if (g.sessionId in e && this.recordAssociation(this.sessionHistory, [
|
|
502
|
+
g.sessionId,
|
|
503
|
+
g.sessionHasReplay,
|
|
504
504
|
D
|
|
505
|
-
], t, typeof this.attributes[
|
|
506
|
-
let e = this.attributes[
|
|
507
|
-
this.recordAssociation(this.actionHistory, [
|
|
505
|
+
], t, typeof this.attributes[g.sessionId] == "string"), g.actionId in e) {
|
|
506
|
+
let e = this.attributes[g.actionId];
|
|
507
|
+
this.recordAssociation(this.actionHistory, [g.actionId], t, Array.isArray(e) ? e.length > 0 : typeof e == "string");
|
|
508
508
|
}
|
|
509
|
-
}),
|
|
510
|
-
if (this.user =
|
|
509
|
+
}), b(this, "setUser", (e) => {
|
|
510
|
+
if (this.user = S(S({}, this.user), e), "id" in e) {
|
|
511
511
|
if (e.id === void 0) {
|
|
512
|
-
delete this.attributes[
|
|
512
|
+
delete this.attributes[g.userId];
|
|
513
513
|
return;
|
|
514
514
|
}
|
|
515
|
-
this.attributes[
|
|
515
|
+
this.attributes[g.userId] = e.id;
|
|
516
516
|
}
|
|
517
|
-
}),
|
|
517
|
+
}), b(this, "setView", (e, t = ((t) => (t = e.startedAt) == null ? Date.now() : t)()) => {
|
|
518
518
|
var n;
|
|
519
519
|
this.viewAttributeKeys.forEach((e) => delete this.attributes[e]), this.viewAttributeKeys.clear();
|
|
520
520
|
let r = {};
|
|
521
|
-
for (let [t, i] of Object.entries((n = e.attributes) == null ? {} : n)) i === void 0 ||
|
|
522
|
-
this.view =
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
521
|
+
for (let [t, i] of Object.entries((n = e.attributes) == null ? {} : n)) i === void 0 || Ve.has(t) || (r[t] = i, this.attributes[t] = i, this.viewAttributeKeys.add(t), this.viewScopedAttributeKeys.add(t));
|
|
522
|
+
this.view = S(S({}, e), {}, { attributes: r }), this.setOptionalAttribute(g.viewId, e.id), this.setOptionalAttribute(g.viewUrl, e.url), this.setOptionalAttribute(g.viewUrlPathGroup, e.urlPathGroup), this.setOptionalAttribute(g.viewLoadingType, e.loadingType), this.setOptionalAttribute(g.viewName, e.name), [
|
|
523
|
+
g.viewId,
|
|
524
|
+
g.viewUrl,
|
|
525
|
+
g.viewUrlPathGroup,
|
|
526
|
+
g.viewLoadingType,
|
|
527
|
+
g.viewName
|
|
528
528
|
].forEach((e) => this.viewScopedAttributeKeys.add(e)), this.recordAssociation(this.viewHistory, this.viewScopedAttributeKeys, t, typeof e.id == "string" && e.id.length > 0), this.viewChangeListeners.forEach((e) => e(this.getView()));
|
|
529
529
|
}), this.setAttributes(e), t && this.setUser(t);
|
|
530
530
|
}
|
|
@@ -545,7 +545,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
545
545
|
session: "session",
|
|
546
546
|
vital: "vital",
|
|
547
547
|
websocket: "websocket"
|
|
548
|
-
},
|
|
548
|
+
}, Ue = (e) => e === 408 || e === 504 ? j.timeout : typeof e == "number" && e >= 400 ? j.error : j.success, We = (e) => e === 408 || e === 504 ? "network_timeout" : typeof e != "number" || e < 400 ? "none" : e >= 500 ? "http_5xx" : "http_4xx", Ge = (e) => e === "good" ? j.success : j.warning, Ke = (e) => {
|
|
549
549
|
if (!e) return {};
|
|
550
550
|
try {
|
|
551
551
|
let t = new URL(e, typeof location > "u" ? "http://localhost" : location.href);
|
|
@@ -557,24 +557,24 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
557
557
|
return {};
|
|
558
558
|
}
|
|
559
559
|
}, N = ({ errorType: e = "none", result: t = j.success, spanSubtype: n, spanType: r }) => ({
|
|
560
|
-
[
|
|
561
|
-
[
|
|
562
|
-
[
|
|
563
|
-
[
|
|
564
|
-
}),
|
|
565
|
-
let o =
|
|
566
|
-
return
|
|
567
|
-
errorType: n ? "network" : typeof r == "number" ?
|
|
560
|
+
[g.spanType]: r,
|
|
561
|
+
[g.spanSubtype]: n,
|
|
562
|
+
[g.result]: t,
|
|
563
|
+
[g.errorType]: e
|
|
564
|
+
}), qe = ({ initiatorType: e = "other", method: t, networkError: n = !1, responseStatus: r, transferSize: i, url: a }) => {
|
|
565
|
+
let o = Ke(a), s = n ? j.error : typeof r == "number" ? Ue(r) : j.success, c = t == null ? void 0 : t.toUpperCase();
|
|
566
|
+
return S(S(S(S(S(S({}, N({
|
|
567
|
+
errorType: n ? "network" : typeof r == "number" ? We(r) : "none",
|
|
568
568
|
result: s,
|
|
569
569
|
spanSubtype: e,
|
|
570
570
|
spanType: M.resource
|
|
571
571
|
})), o.serverAddress ? { "server.address": o.serverAddress } : {}), o.serverPort === void 0 ? {} : { "server.port": o.serverPort }), {}, { "resource.type": e }, c ? { "http.request.method": c } : {}), typeof i == "number" ? { "resource.size": i } : {}), typeof r == "number" ? { "http.response.status_code": r } : {});
|
|
572
|
-
},
|
|
572
|
+
}, Je = 100, Ye = 100, Xe = 1e3, Ze = 100, Qe = 1e4, $e = "data-bk-action-name", et = 100, tt = 10, P = (e) => e.replace(/\s+/g, " ").trim().slice(0, et), F = (e) => {
|
|
573
573
|
var t;
|
|
574
574
|
if (e.parentElement) return e.parentElement;
|
|
575
575
|
let n = (t = e.getRootNode) == null ? void 0 : t.call(e);
|
|
576
576
|
return typeof ShadowRoot < "u" && n instanceof ShadowRoot ? n.host : null;
|
|
577
|
-
},
|
|
577
|
+
}, nt = (e, t) => {
|
|
578
578
|
let n = e;
|
|
579
579
|
for (; n;) {
|
|
580
580
|
let e = n.getAttribute(t);
|
|
@@ -584,7 +584,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
584
584
|
}, I = (e) => {
|
|
585
585
|
var t;
|
|
586
586
|
return e.isContentEditable ? "" : P((t = e.textContent) == null ? "" : t);
|
|
587
|
-
},
|
|
587
|
+
}, rt = (e) => {
|
|
588
588
|
var t, n;
|
|
589
589
|
let r = e, i = (t = r.labels) == null ? void 0 : t[0];
|
|
590
590
|
if (i) {
|
|
@@ -616,20 +616,20 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
616
616
|
let n = P((c = e.getAttribute(t)) == null ? "" : c);
|
|
617
617
|
if (n) return n;
|
|
618
618
|
}
|
|
619
|
-
},
|
|
620
|
-
let r =
|
|
619
|
+
}, it = (e, t = $e, n = !1) => {
|
|
620
|
+
let r = nt(e, t);
|
|
621
621
|
if (r) return r;
|
|
622
622
|
if (!n) return e.tagName.toLowerCase();
|
|
623
623
|
let i = e, a = 0;
|
|
624
|
-
for (; i && a <=
|
|
624
|
+
for (; i && a <= tt;) {
|
|
625
625
|
let e = i.tagName.toLowerCase();
|
|
626
626
|
if (e === "body" || e === "html" || e === "head") break;
|
|
627
|
-
let t =
|
|
627
|
+
let t = rt(i);
|
|
628
628
|
if (t) return t;
|
|
629
629
|
if (e === "form") break;
|
|
630
630
|
i = F(i), a += 1;
|
|
631
631
|
}
|
|
632
|
-
for (i = e, a = 0; i && a <=
|
|
632
|
+
for (i = e, a = 0; i && a <= tt;) {
|
|
633
633
|
let e = i.tagName.toLowerCase();
|
|
634
634
|
if (e === "body" || e === "html" || e === "head") break;
|
|
635
635
|
let t = I(i);
|
|
@@ -638,14 +638,14 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
638
638
|
i = F(i), a += 1;
|
|
639
639
|
}
|
|
640
640
|
return e.tagName.toLowerCase();
|
|
641
|
-
},
|
|
641
|
+
}, at = (e) => {
|
|
642
642
|
var t;
|
|
643
643
|
let n = (t = e.composedPath) == null ? void 0 : t.call(e)[0];
|
|
644
644
|
return n instanceof Element ? n : e.target instanceof Element ? e.target : void 0;
|
|
645
|
-
},
|
|
645
|
+
}, ot = (e) => {
|
|
646
646
|
let t = e.timeStamp;
|
|
647
647
|
return !Number.isFinite(t) || t <= 0 ? Date.now() : t > 0xe8d4a51000 ? t : typeof performance > "u" ? Date.now() : performance.timeOrigin + t;
|
|
648
|
-
},
|
|
648
|
+
}, st = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, ct = (e) => {
|
|
649
649
|
let t = e;
|
|
650
650
|
if (t.tagName.toLowerCase() === "label" && t.hasAttribute("for")) {
|
|
651
651
|
var n;
|
|
@@ -668,54 +668,53 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
668
668
|
t = F(t);
|
|
669
669
|
}
|
|
670
670
|
return !1;
|
|
671
|
-
},
|
|
672
|
-
let t = [], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = e.actionNameAttribute ||
|
|
673
|
-
s == null || s.setRuntimeAttributes({ [
|
|
674
|
-
}, l = (e) => !e.hadActivity && !e.userActivity.input && !e.userActivity.scroll && !e.userActivity.selection && !
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
let n = [
|
|
671
|
+
}, lt = (e = {}) => {
|
|
672
|
+
let t = [], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = e.actionNameAttribute || $e, a = st(e.maxDuration, Qe), o = [], s, c = () => {
|
|
673
|
+
s == null || s.setRuntimeAttributes({ [g.actionId]: n.size ? [...n.keys()] : void 0 });
|
|
674
|
+
}, l = (e) => !e.hadActivity && !e.userActivity.input && !e.userActivity.scroll && !e.userActivity.selection && !ct(e.target), u = (e) => {
|
|
675
|
+
if (!r.delete(e) || !s || !e.completed) return;
|
|
676
|
+
clearTimeout(e.reportTimer), e.hadError && e.frustrations.add("error_click"), l(e) && e.frustrations.add("dead_click");
|
|
677
|
+
let t = [
|
|
679
678
|
"rage_click",
|
|
680
679
|
"dead_click",
|
|
681
680
|
"error_click"
|
|
682
|
-
].filter((t) => e.frustrations.has(t)), { endTime:
|
|
683
|
-
s.startSpan("action.click",
|
|
684
|
-
errorType: e.hadError ? "js" :
|
|
685
|
-
result:
|
|
681
|
+
].filter((t) => e.frustrations.has(t)), { endTime: n, hasLoadingTime: i } = e.completed, a = Math.max(0, n - e.startTime), o = e.hadError || t.length > 0;
|
|
682
|
+
s.startSpan("action.click", S(S(S(S(S({}, s.config.hooks.getPageAttributes()), N({
|
|
683
|
+
errorType: e.hadError ? "js" : t.length ? "frustration" : "none",
|
|
684
|
+
result: o ? j.warning : j.success,
|
|
686
685
|
spanSubtype: "click",
|
|
687
686
|
spanType: M.action
|
|
688
687
|
})), e.runtimeAttributes), {}, {
|
|
689
|
-
[
|
|
690
|
-
[
|
|
691
|
-
[
|
|
692
|
-
[
|
|
693
|
-
[
|
|
694
|
-
[
|
|
695
|
-
[
|
|
696
|
-
[
|
|
697
|
-
},
|
|
688
|
+
[g.eventId]: h("event"),
|
|
689
|
+
[g.eventTimestamp]: e.startTime,
|
|
690
|
+
[g.eventType]: "action",
|
|
691
|
+
[g.actionId]: e.id,
|
|
692
|
+
[g.actionType]: "click",
|
|
693
|
+
[g.actionName]: `Click on ${e.targetName}`,
|
|
694
|
+
[g.actionTargetName]: e.targetName,
|
|
695
|
+
[g.actionTargetTag]: e.targetTag
|
|
696
|
+
}, t.length ? { [g.actionFrustrationType]: t } : {}), i ? { [g.actionLoadingTime]: a } : {}), { startTime: e.startTime }).end(i ? n : e.startTime);
|
|
698
697
|
}, d = (e, t, i) => {
|
|
699
698
|
if (!n.delete(e.id) || !s) return;
|
|
700
699
|
clearTimeout(e.validationTimer), clearTimeout(e.quietTimer), clearTimeout(e.maxDurationTimer), c(), e.completed = {
|
|
701
700
|
endTime: t,
|
|
702
701
|
hasLoadingTime: i
|
|
703
702
|
}, r.add(e);
|
|
704
|
-
let a = Math.max(0, e.startTime +
|
|
703
|
+
let a = Math.max(0, e.startTime + Xe - Date.now());
|
|
705
704
|
e.reportTimer = setTimeout(() => u(e), a);
|
|
706
705
|
}, f = () => {
|
|
707
706
|
[...r].forEach(u);
|
|
708
707
|
}, p = (e) => {
|
|
709
708
|
if (clearTimeout(e.quietTimer), !e.hadActivity || e.pendingRequests.size) return;
|
|
710
|
-
let t = Math.max(0, e.lastActivityTime +
|
|
709
|
+
let t = Math.max(0, e.lastActivityTime + Ye - Date.now());
|
|
711
710
|
e.quietTimer = setTimeout(() => d(e, e.lastActivityTime, !0), t);
|
|
712
711
|
}, m = (e, t) => {
|
|
713
712
|
e.hadActivity = !0, e.lastActivityTime = Math.max(e.lastActivityTime, t), p(e);
|
|
714
|
-
},
|
|
713
|
+
}, _ = (e, t) => t >= e.startTime && t <= e.startTime + a, v = (e) => {
|
|
715
714
|
for (let i of n.values()) {
|
|
716
715
|
if (e.type === "request_start") {
|
|
717
716
|
var t;
|
|
718
|
-
if (e.url && A(s == null || (t = s.config.view) == null ? void 0 : t.excludedActivityUrls, e.url) || !
|
|
717
|
+
if (e.url && A(s == null || (t = s.config.view) == null ? void 0 : t.excludedActivityUrls, e.url) || !_(i, e.time)) continue;
|
|
719
718
|
i.pendingRequests.add(e.id), m(i, e.time);
|
|
720
719
|
continue;
|
|
721
720
|
}
|
|
@@ -731,28 +730,23 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
731
730
|
continue;
|
|
732
731
|
}
|
|
733
732
|
if (e.type === "dom_mutation" || e.type === "window_open") {
|
|
734
|
-
|
|
733
|
+
_(i, e.time) && m(i, e.time);
|
|
735
734
|
continue;
|
|
736
735
|
}
|
|
737
|
-
e.type === "error" &&
|
|
736
|
+
e.type === "error" && _(i, e.time) && (i.hadError = !0, m(i, e.time));
|
|
738
737
|
}
|
|
739
738
|
}, y = (e = Date.now()) => {
|
|
740
739
|
[...n.values()].forEach((t) => d(t, e, t.hadActivity));
|
|
741
740
|
}, b = (e, t) => {
|
|
742
741
|
let n = "clientX" in t && typeof t.clientX == "number" ? t.clientX : 0, r = "clientY" in t && typeof t.clientY == "number" ? t.clientY : 0;
|
|
743
|
-
o = o.filter((t) => e.startTime - t.action.startTime <=
|
|
744
|
-
let i = o.at(-1), a = o.some((e) => e.action.userActivity.scroll || e.action.userActivity.selection), s = (i == null ? void 0 : i.target) === e.target && Math.hypot(i.x - n, i.y - r) <=
|
|
745
|
-
|
|
742
|
+
o = o.filter((t) => e.startTime - t.action.startTime <= Xe);
|
|
743
|
+
let i = o.at(-1), a = o.some((e) => e.action.userActivity.scroll || e.action.userActivity.selection), s = (i == null ? void 0 : i.target) === e.target && Math.hypot(i.x - n, i.y - r) <= Ze;
|
|
744
|
+
(a || i && !s) && (o = []), o.push({
|
|
746
745
|
action: e,
|
|
747
746
|
target: e.target,
|
|
748
747
|
x: n,
|
|
749
748
|
y: r
|
|
750
|
-
}), o.length >= 3 && e.startTime - o[o.length - 3].action.startTime <=
|
|
751
|
-
let t = o.slice(-3).map((e) => e.action);
|
|
752
|
-
t.slice(0, -1).forEach((e) => {
|
|
753
|
-
e.discardedByRage = !0;
|
|
754
|
-
}), e.frustrations.add("rage_click"), e.rageSources = t, o = [];
|
|
755
|
-
}
|
|
749
|
+
}), o.length >= 3 && e.startTime - o[o.length - 3].action.startTime <= Xe && (o.slice(-3).map((e) => e.action).forEach((e) => e.frustrations.add("rage_click")), o = []);
|
|
756
750
|
};
|
|
757
751
|
return {
|
|
758
752
|
name: "action",
|
|
@@ -764,9 +758,9 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
764
758
|
passive: !0
|
|
765
759
|
}, p = (t) => {
|
|
766
760
|
if (!l.isSampled() || "button" in t && typeof t.button == "number" && t.button !== 0) return;
|
|
767
|
-
let r =
|
|
761
|
+
let r = at(t);
|
|
768
762
|
if (!r) return;
|
|
769
|
-
let o =
|
|
763
|
+
let o = ot(t), s = h("action"), u = {
|
|
770
764
|
frustrations: /* @__PURE__ */ new Set(),
|
|
771
765
|
hadActivity: !1,
|
|
772
766
|
hadError: !1,
|
|
@@ -777,7 +771,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
777
771
|
runtimeAttributes: l.getRuntimeAttributes(),
|
|
778
772
|
startTime: o,
|
|
779
773
|
target: r,
|
|
780
|
-
targetName:
|
|
774
|
+
targetName: it(r, i, e.nameCollection === "text"),
|
|
781
775
|
targetTag: r.tagName.toLowerCase(),
|
|
782
776
|
userActivity: {
|
|
783
777
|
input: !1,
|
|
@@ -786,7 +780,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
786
780
|
},
|
|
787
781
|
validationTimer: setTimeout(() => {
|
|
788
782
|
u.hadActivity || d(u, u.startTime, !1);
|
|
789
|
-
},
|
|
783
|
+
}, Je)
|
|
790
784
|
};
|
|
791
785
|
n.set(s, u), b(u, t), c();
|
|
792
786
|
};
|
|
@@ -807,12 +801,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
807
801
|
...r,
|
|
808
802
|
...o.map((e) => e.action)
|
|
809
803
|
]).forEach((t) => {
|
|
810
|
-
|
|
811
|
-
var n;
|
|
812
|
-
(n = t.rageSources) == null || n.slice(0, -1).forEach((e) => {
|
|
813
|
-
e.discardedByRage = !1;
|
|
814
|
-
}), t.rageSources = void 0;
|
|
815
|
-
}
|
|
804
|
+
t.userActivity[e] = !0, e !== "input" && t.frustrations.delete("rage_click");
|
|
816
805
|
});
|
|
817
806
|
}, C = () => S("input"), w = () => S("scroll"), T = () => S("selection");
|
|
818
807
|
window.addEventListener("input", C, u), window.addEventListener("scroll", w, u), document.addEventListener("selectionchange", T, u), t.push(() => window.removeEventListener("input", C, u), () => window.removeEventListener("scroll", w, u), () => document.removeEventListener("selectionchange", T, u));
|
|
@@ -825,16 +814,16 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
825
814
|
o = [], s = void 0;
|
|
826
815
|
}
|
|
827
816
|
};
|
|
828
|
-
},
|
|
817
|
+
}, ut = "data-bk-excluded-activity-mutations", dt = (e) => {
|
|
829
818
|
let t = e.type === "characterData" ? e.target.parentElement : e.target;
|
|
830
819
|
return t instanceof Element && !!t.closest("[data-bk-excluded-activity-mutations]");
|
|
831
|
-
},
|
|
820
|
+
}, ft = () => {
|
|
832
821
|
let e, t = [];
|
|
833
822
|
return {
|
|
834
823
|
name: "activity",
|
|
835
824
|
init(n) {
|
|
836
825
|
if (typeof document < "u" && typeof MutationObserver < "u" && (e = new MutationObserver((e) => {
|
|
837
|
-
e.length && !e.every(
|
|
826
|
+
e.length && !e.every(dt) && n.notifyActivity({
|
|
838
827
|
time: Date.now(),
|
|
839
828
|
type: "dom_mutation"
|
|
840
829
|
});
|
|
@@ -858,7 +847,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
858
847
|
for (e == null || e.disconnect(), e = void 0; t.length;) (n = t.pop()) == null || n();
|
|
859
848
|
}
|
|
860
849
|
};
|
|
861
|
-
},
|
|
850
|
+
}, pt = (e, t) => !!(t && A(e.config.view.excludedActivityUrls, t)), mt = (e, t, n) => {
|
|
862
851
|
let r = /* @__PURE__ */ new Set(), i = !1, a = !1, o = t, s, c = (e) => {
|
|
863
852
|
i || (i = !0, clearTimeout(f), clearTimeout(s), d(), n(e));
|
|
864
853
|
}, l = () => {
|
|
@@ -871,7 +860,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
871
860
|
}, d = e.onActivity((n) => {
|
|
872
861
|
if (!(n.type === "error" || n.type === "long_task")) {
|
|
873
862
|
if (n.type === "request_start") {
|
|
874
|
-
if (n.time < t ||
|
|
863
|
+
if (n.time < t || pt(e, n.url)) return;
|
|
875
864
|
r.add(n.id), u(n.time);
|
|
876
865
|
return;
|
|
877
866
|
}
|
|
@@ -881,7 +870,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
881
870
|
return;
|
|
882
871
|
}
|
|
883
872
|
if (n.type === "resource") {
|
|
884
|
-
if (n.endTime < t ||
|
|
873
|
+
if (n.endTime < t || pt(e, n.url)) return;
|
|
885
874
|
u(n.endTime);
|
|
886
875
|
return;
|
|
887
876
|
}
|
|
@@ -893,7 +882,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
893
882
|
return () => {
|
|
894
883
|
i || (i = !0, clearTimeout(f), clearTimeout(s), d());
|
|
895
884
|
};
|
|
896
|
-
},
|
|
885
|
+
}, ht = 1e3, gt = 200, _t = "body", vt = .8, yt = [
|
|
897
886
|
"[data-loading=\"true\"]",
|
|
898
887
|
"[aria-busy=\"true\"]",
|
|
899
888
|
".loading",
|
|
@@ -911,28 +900,28 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
911
900
|
[.2, .8],
|
|
912
901
|
[.5, .8],
|
|
913
902
|
[.8, .8]
|
|
914
|
-
],
|
|
903
|
+
], bt = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, xt = (e, t) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.min(1, e)) : t, St = (e) => {
|
|
915
904
|
if (!e) return "";
|
|
916
905
|
let t = e.tagName.toLowerCase();
|
|
917
906
|
return e.id ? `${t}#${e.id}` : t;
|
|
918
|
-
},
|
|
907
|
+
}, Ct = (e, t) => t.some((t) => {
|
|
919
908
|
try {
|
|
920
909
|
return e.matches(t) || !!e.closest(t);
|
|
921
910
|
} catch (e) {
|
|
922
911
|
return !1;
|
|
923
912
|
}
|
|
924
|
-
}),
|
|
913
|
+
}), wt = (e) => {
|
|
925
914
|
if (typeof getComputedStyle != "function") return !0;
|
|
926
915
|
let t = getComputedStyle(e);
|
|
927
916
|
return t.display !== "none" && t.visibility !== "hidden" && Number(t.opacity || 1) > 0;
|
|
928
|
-
},
|
|
917
|
+
}, Tt = (e, t) => {
|
|
929
918
|
if (typeof document.elementsFromPoint == "function") return document.elementsFromPoint(e, t);
|
|
930
919
|
let n = document.elementFromPoint(e, t);
|
|
931
920
|
return n ? [n] : [];
|
|
932
|
-
},
|
|
921
|
+
}, Et = (e, t) => {
|
|
933
922
|
let n = document.querySelector(e);
|
|
934
923
|
if (!n) return {
|
|
935
|
-
centerElement:
|
|
924
|
+
centerElement: St(Tt(window.innerWidth / 2, window.innerHeight / 2)[0]),
|
|
936
925
|
emptyCount: L.length,
|
|
937
926
|
ignoredCount: 0,
|
|
938
927
|
reason: "missing_root",
|
|
@@ -942,12 +931,12 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
942
931
|
};
|
|
943
932
|
let r = 0, i = 0, a = "";
|
|
944
933
|
for (let [e, o] of L) {
|
|
945
|
-
let s =
|
|
946
|
-
if (e === .5 && o === .5 && (a =
|
|
934
|
+
let s = Tt(window.innerWidth * e, window.innerHeight * o);
|
|
935
|
+
if (e === .5 && o === .5 && (a = St(s[0])), s.some((e) => Ct(e, t))) {
|
|
947
936
|
i += 1;
|
|
948
937
|
continue;
|
|
949
938
|
}
|
|
950
|
-
s.some((e) => e !== n && e !== document.body && e !== document.documentElement && n.contains(e) &&
|
|
939
|
+
s.some((e) => e !== n && e !== document.body && e !== document.documentElement && n.contains(e) && wt(e)) || (r += 1);
|
|
951
940
|
}
|
|
952
941
|
let o = L.length - i;
|
|
953
942
|
return {
|
|
@@ -959,9 +948,9 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
959
948
|
score: o ? r / o : 0,
|
|
960
949
|
validCount: o
|
|
961
950
|
};
|
|
962
|
-
},
|
|
951
|
+
}, Dt = (e = {}) => {
|
|
963
952
|
var t;
|
|
964
|
-
let n =
|
|
953
|
+
let n = bt(e.checkDelay, ht), r = bt(e.confirmationDelay, gt), i = e.rootSelector || _t, a = xt(e.threshold, vt), o = [...yt, ...(t = e.ignoreSelectors) == null ? [] : t], s, c, l, u, d = () => {}, f;
|
|
965
954
|
return {
|
|
966
955
|
name: "blank-screen",
|
|
967
956
|
init(e) {
|
|
@@ -972,7 +961,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
972
961
|
if (s !== t || c === t || !e.isSampled()) return;
|
|
973
962
|
c = t;
|
|
974
963
|
let r = Date.now();
|
|
975
|
-
e.startSpan("browser.blank_screen",
|
|
964
|
+
e.startSpan("browser.blank_screen", S(S({}, N({
|
|
976
965
|
errorType: "blank_screen",
|
|
977
966
|
result: j.error,
|
|
978
967
|
spanSubtype: n.reason,
|
|
@@ -987,15 +976,15 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
987
976
|
"blank_screen.root_selector": i,
|
|
988
977
|
"blank_screen.sample_count": L.length,
|
|
989
978
|
"blank_screen.valid_sample_count": n.validCount,
|
|
990
|
-
[
|
|
991
|
-
[
|
|
992
|
-
[
|
|
979
|
+
[g.eventId]: h("event"),
|
|
980
|
+
[g.eventTimestamp]: r,
|
|
981
|
+
[g.eventType]: "error"
|
|
993
982
|
}), { startTime: r }).end(r);
|
|
994
983
|
}, m = (t) => {
|
|
995
984
|
if (s !== t || c === t || document.visibilityState === "hidden") return;
|
|
996
985
|
let n;
|
|
997
986
|
try {
|
|
998
|
-
n =
|
|
987
|
+
n = Et(i, o);
|
|
999
988
|
} catch (t) {
|
|
1000
989
|
var l;
|
|
1001
990
|
e.config.debug && ((l = globalThis.console) == null || l.warn("[bk-ot][blank-screen] detection failed:", t));
|
|
@@ -1005,7 +994,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1005
994
|
if (s !== t || document.visibilityState === "hidden") return;
|
|
1006
995
|
let n;
|
|
1007
996
|
try {
|
|
1008
|
-
n =
|
|
997
|
+
n = Et(i, o);
|
|
1009
998
|
} catch (t) {
|
|
1010
999
|
var r;
|
|
1011
1000
|
e.config.debug && ((r = globalThis.console) == null || r.warn("[bk-ot][blank-screen] confirmation failed:", t));
|
|
@@ -1013,19 +1002,19 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1013
1002
|
}
|
|
1014
1003
|
n.validCount && n.score >= a && p(t, n);
|
|
1015
1004
|
}, r));
|
|
1016
|
-
},
|
|
1005
|
+
}, _ = (r) => {
|
|
1017
1006
|
t(), !(document.visibilityState === "hidden" || !e.isSampled()) && (u = setTimeout(() => m(r), n));
|
|
1018
1007
|
};
|
|
1019
1008
|
d = e.onViewChange((n) => {
|
|
1020
1009
|
if (n.id !== s && (t(), l == null || l(), l = void 0, s = n.id, c = void 0, n.id)) {
|
|
1021
1010
|
let t = n.id;
|
|
1022
|
-
l =
|
|
1023
|
-
l = void 0,
|
|
1011
|
+
l = mt(e, Date.now(), () => {
|
|
1012
|
+
l = void 0, _(t);
|
|
1024
1013
|
});
|
|
1025
1014
|
}
|
|
1026
1015
|
});
|
|
1027
1016
|
let v = () => {
|
|
1028
|
-
document.visibilityState === "hidden" ? t() : s && c !== s &&
|
|
1017
|
+
document.visibilityState === "hidden" ? t() : s && c !== s && _(s);
|
|
1029
1018
|
};
|
|
1030
1019
|
document.addEventListener("visibilitychange", v), f = () => document.removeEventListener("visibilitychange", v);
|
|
1031
1020
|
},
|
|
@@ -1033,32 +1022,32 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1033
1022
|
clearTimeout(u), u = void 0, d(), l == null || l(), l = void 0, f == null || f(), f = void 0, s = void 0, c = void 0;
|
|
1034
1023
|
}
|
|
1035
1024
|
};
|
|
1036
|
-
},
|
|
1025
|
+
}, Ot = 100, kt = 200, R = [], At = (e) => e.replace(/#.*$/, ""), jt = (e) => {
|
|
1037
1026
|
let t = R.indexOf(e);
|
|
1038
1027
|
t >= 0 && R.splice(t, 1), e.timer !== void 0 && clearTimeout(e.timer);
|
|
1039
1028
|
}, z = (e, t) => {
|
|
1040
1029
|
let n = e.callback;
|
|
1041
|
-
|
|
1042
|
-
},
|
|
1043
|
-
let t = performance.timeOrigin + e.startTime, n = R.filter((n) => !n.entry &&
|
|
1030
|
+
jt(e), e.callback = void 0, n == null || n(t);
|
|
1031
|
+
}, Mt = (e) => {
|
|
1032
|
+
let t = performance.timeOrigin + e.startTime, n = R.filter((n) => !n.entry && At(n.url) === At(e.name) && t >= n.startTime - 50).sort((e, n) => Math.abs(e.startTime - t) - Math.abs(n.startTime - t))[0];
|
|
1044
1033
|
n && (n.entry = e, n.callback && z(n, e));
|
|
1045
|
-
},
|
|
1034
|
+
}, Nt = (e, t = Date.now()) => {
|
|
1046
1035
|
let n = {
|
|
1047
1036
|
startTime: t,
|
|
1048
1037
|
url: e
|
|
1049
1038
|
};
|
|
1050
|
-
return R.push(n), R.length >
|
|
1039
|
+
return R.push(n), R.length > Ot && z(R[0]), {
|
|
1051
1040
|
cancel: () => z(n),
|
|
1052
1041
|
complete: (e) => {
|
|
1053
1042
|
if (n.callback = e, n.entry) {
|
|
1054
1043
|
z(n, n.entry);
|
|
1055
1044
|
return;
|
|
1056
1045
|
}
|
|
1057
|
-
n.timer = setTimeout(() => z(n),
|
|
1046
|
+
n.timer = setTimeout(() => z(n), kt);
|
|
1058
1047
|
}
|
|
1059
1048
|
};
|
|
1060
|
-
},
|
|
1061
|
-
|
|
1049
|
+
}, Pt = (e) => e.deliveryType === "cache" || e.transferSize === 0 && e.decodedBodySize > 0 ? !0 : void 0, Ft = (...e) => e.every((t, n) => n === 0 || e[n - 1] <= t), B = (e, t, n, r, i) => {
|
|
1050
|
+
Ft(n, r, i) && (e[`resource.${t}.start`] = r - n, e[`resource.${t}.duration`] = i - r);
|
|
1062
1051
|
}, It = (e) => {
|
|
1063
1052
|
let t = {}, n = [
|
|
1064
1053
|
e.startTime,
|
|
@@ -1071,12 +1060,12 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1071
1060
|
e.responseStart,
|
|
1072
1061
|
e.responseEnd
|
|
1073
1062
|
];
|
|
1074
|
-
return !n.every(Number.isFinite) || !
|
|
1063
|
+
return !n.every(Number.isFinite) || !Ft(...n) ? t : (B(t, "first_byte", e.startTime, e.requestStart, e.responseStart), B(t, "download", e.startTime, e.responseStart, e.responseEnd), e.workerStart > 0 && e.workerStart < e.fetchStart && B(t, "worker", e.startTime, e.workerStart, e.fetchStart), e.fetchStart < e.domainLookupEnd && B(t, "dns", e.startTime, e.domainLookupStart, e.domainLookupEnd), e.fetchStart < e.connectEnd && (B(t, "connect", e.startTime, e.connectStart, e.connectEnd), e.connectStart <= e.secureConnectionStart && e.secureConnectionStart <= e.connectEnd && B(t, "ssl", e.startTime, e.secureConnectionStart, e.connectEnd)), e.redirectEnd > e.startTime && Ft(e.startTime, e.redirectStart, e.redirectEnd, e.fetchStart) && B(t, "redirect", e.startTime, e.redirectStart, e.redirectEnd), t);
|
|
1075
1064
|
}, Lt = (e) => e.duration === 0 && e.responseEnd > e.startTime ? e.responseEnd - e.startTime : e.duration, Rt = (e) => {
|
|
1076
1065
|
let t = typeof e.deliveryType == "string" ? e.deliveryType || "other" : void 0;
|
|
1077
|
-
return
|
|
1078
|
-
[
|
|
1079
|
-
[
|
|
1066
|
+
return S(S(S(S({
|
|
1067
|
+
[g.cacheHit]: Pt(e),
|
|
1068
|
+
[g.nextHopProtocol]: e.nextHopProtocol
|
|
1080
1069
|
}, It(e)), t ? { "resource.delivery_type": t } : {}), e.renderBlockingStatus ? { "resource.render_blocking_status": e.renderBlockingStatus } : {}), {}, {
|
|
1081
1070
|
"resource.encoded_body_size": e.encodedBodySize,
|
|
1082
1071
|
"resource.decoded_body_size": e.decodedBodySize
|
|
@@ -1091,20 +1080,20 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1091
1080
|
let a = (n) => {
|
|
1092
1081
|
if (!r.isSampled() || !n.name || k(r.config, n.name)) return;
|
|
1093
1082
|
if (n.initiatorType === "fetch" || n.initiatorType === "xmlhttprequest") {
|
|
1094
|
-
|
|
1083
|
+
Mt(n);
|
|
1095
1084
|
return;
|
|
1096
1085
|
}
|
|
1097
1086
|
if (n.duration < 0) return;
|
|
1098
1087
|
let i = r.config.hooks.redactUrl(n.name), a = Lt(n), o = performance.timeOrigin + n.startTime, s = o + a;
|
|
1099
|
-
t && r.isSampled() && r.startSpan("browser.resource",
|
|
1088
|
+
t && r.isSampled() && r.startSpan("browser.resource", S(S(S({}, r.config.hooks.getPageAttributes()), qe({
|
|
1100
1089
|
initiatorType: n.initiatorType || "other",
|
|
1101
1090
|
responseStatus: n.responseStatus,
|
|
1102
1091
|
transferSize: n.transferSize,
|
|
1103
1092
|
url: i
|
|
1104
1093
|
})), {}, {
|
|
1105
|
-
[
|
|
1106
|
-
[
|
|
1107
|
-
[
|
|
1094
|
+
[g.eventId]: h("event"),
|
|
1095
|
+
[g.eventTimestamp]: o,
|
|
1096
|
+
[g.eventType]: "resource",
|
|
1108
1097
|
"url.full": i
|
|
1109
1098
|
}, Rt(n)), {
|
|
1110
1099
|
kind: e.CLIENT,
|
|
@@ -1144,7 +1133,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1144
1133
|
}, Wt = (e, t) => typeof Request < "u" && e instanceof Request ? e : t == null ? {} : t, Gt = (e, t, a) => {
|
|
1145
1134
|
var o;
|
|
1146
1135
|
let s = typeof Request < "u" && e instanceof Request ? e.headers : void 0, c = new Headers((o = t == null ? void 0 : t.headers) == null ? s : o);
|
|
1147
|
-
return r.inject(i.setSpan(n.active(), a), c, { set: (e, t, n) => e.set(t, n) }),
|
|
1136
|
+
return r.inject(i.setSpan(n.active(), a), c, { set: (e, t, n) => e.set(t, n) }), S(S({}, t), {}, { headers: c });
|
|
1148
1137
|
}, Kt = (e, t) => {
|
|
1149
1138
|
let a = {};
|
|
1150
1139
|
r.inject(i.setSpan(n.active(), t), a);
|
|
@@ -1166,7 +1155,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1166
1155
|
type: "request_end"
|
|
1167
1156
|
}));
|
|
1168
1157
|
};
|
|
1169
|
-
}, Yt = (e, t) => e.isSampled() ?
|
|
1158
|
+
}, Yt = (e, t) => e.isSampled() ? Nt(t) : {
|
|
1170
1159
|
cancel() {},
|
|
1171
1160
|
complete(e) {
|
|
1172
1161
|
e();
|
|
@@ -1174,21 +1163,21 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1174
1163
|
}, Xt = (t, n, r) => {
|
|
1175
1164
|
var i, a;
|
|
1176
1165
|
let o = (i = r.startedAt) == null ? Date.now() : i;
|
|
1177
|
-
return t.startSpan("browser.resource",
|
|
1166
|
+
return t.startSpan("browser.resource", S(S(S({}, t.config.hooks.getPageAttributes()), qe({
|
|
1178
1167
|
initiatorType: n,
|
|
1179
1168
|
method: r.method,
|
|
1180
1169
|
url: (a = r.url) == null ? "" : a
|
|
1181
1170
|
})), {}, {
|
|
1182
|
-
[
|
|
1183
|
-
[
|
|
1184
|
-
[
|
|
1171
|
+
[g.eventId]: h("event"),
|
|
1172
|
+
[g.eventTimestamp]: o,
|
|
1173
|
+
[g.eventType]: "resource"
|
|
1185
1174
|
}, r.url ? { "url.full": t.config.hooks.redactUrl(r.url) } : {}), {
|
|
1186
1175
|
kind: e.CLIENT,
|
|
1187
1176
|
startTime: o
|
|
1188
1177
|
});
|
|
1189
1178
|
}, Zt = (e, n, r, i, a = {}) => {
|
|
1190
1179
|
let o = a.url, s = o ? e.config.hooks.redactUrl(o) : void 0, c = Vt(i), l = a.method, u = {
|
|
1191
|
-
attributes:
|
|
1180
|
+
attributes: S(S(S({}, e.config.hooks.getPageAttributes()), qe({
|
|
1192
1181
|
initiatorType: r,
|
|
1193
1182
|
method: l,
|
|
1194
1183
|
networkError: i.type === "fetch" ? !i.response : i.xhr.status === 0,
|
|
@@ -1211,7 +1200,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1211
1200
|
e.config.debug && ((m = globalThis.console) == null || m.warn("[bk-ot] request.beforeSend failed:", t));
|
|
1212
1201
|
}
|
|
1213
1202
|
if (n.setAttributes(e.applyRedact(u.attributes)), d === !1) {
|
|
1214
|
-
n.setAttribute(
|
|
1203
|
+
n.setAttribute(Fe, !0);
|
|
1215
1204
|
return;
|
|
1216
1205
|
}
|
|
1217
1206
|
((c == null ? 0 : c) >= 400 || c === 0 || i.type === "fetch" && i.error) && n.setStatus({ code: t.ERROR });
|
|
@@ -1226,30 +1215,40 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1226
1215
|
let r = window.fetch, i = /* @__PURE__ */ function() {
|
|
1227
1216
|
var t = E(function* (t, i) {
|
|
1228
1217
|
let a = Ht(t);
|
|
1229
|
-
if (!e.isSampled() ||
|
|
1218
|
+
if (!e.isSampled() || Me(e.config, a)) return r.call(this, t, i);
|
|
1230
1219
|
let o = {
|
|
1231
1220
|
method: Ut(t, i),
|
|
1232
1221
|
startedAt: Date.now(),
|
|
1233
1222
|
url: a
|
|
1234
|
-
}, s = Xt(e, "fetch", o), c = Yt(e, a), l = Jt(e, a), u = Wt(t, i), d =
|
|
1235
|
-
|
|
1223
|
+
}, s = Xt(e, "fetch", o), c = Yt(e, a), l = Jt(e, a), u = Wt(t, i), d = Ne(e.config, a) ? Gt(t, i, s) : i, f = !1, p = (t, r = Date.now()) => {
|
|
1224
|
+
if (!f) {
|
|
1225
|
+
if (f = !0, n.delete(m), t) {
|
|
1226
|
+
s.setAttributes(e.applyRedact(Rt(t))), s.end(performance.timeOrigin + t.startTime + Lt(t));
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
s.end(r);
|
|
1230
|
+
}
|
|
1236
1231
|
}, m = () => {
|
|
1237
1232
|
c.cancel(), p();
|
|
1238
1233
|
};
|
|
1239
1234
|
n.add(m);
|
|
1240
1235
|
try {
|
|
1241
1236
|
let n = yield r.call(this, t, d);
|
|
1242
|
-
|
|
1237
|
+
Zt(e, s, "fetch", {
|
|
1243
1238
|
request: u,
|
|
1244
1239
|
response: n,
|
|
1245
1240
|
type: "fetch"
|
|
1246
|
-
}, o)
|
|
1241
|
+
}, o);
|
|
1242
|
+
let i = Date.now();
|
|
1243
|
+
return c.complete((e) => p(e, i)), n;
|
|
1247
1244
|
} catch (t) {
|
|
1248
|
-
|
|
1245
|
+
Zt(e, s, "fetch", {
|
|
1249
1246
|
error: t,
|
|
1250
1247
|
request: u,
|
|
1251
1248
|
type: "fetch"
|
|
1252
|
-
}, o), t instanceof Error && s.recordException(t)
|
|
1249
|
+
}, o), t instanceof Error && s.recordException(t);
|
|
1250
|
+
let n = Date.now();
|
|
1251
|
+
throw c.complete((e) => p(e, n)), t;
|
|
1253
1252
|
} finally {
|
|
1254
1253
|
l();
|
|
1255
1254
|
}
|
|
@@ -1271,22 +1270,30 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1271
1270
|
}, s = function(t) {
|
|
1272
1271
|
var i;
|
|
1273
1272
|
let o = (i = r.get(this)) == null ? {} : i;
|
|
1274
|
-
if (!e.isSampled() || !o.url ||
|
|
1273
|
+
if (!e.isSampled() || !o.url || Me(e.config, o.url)) return a.call(this, t);
|
|
1275
1274
|
o.startedAt = Date.now();
|
|
1276
1275
|
let s = Xt(e, "xhr", o), c = Yt(e, o.url), l = Jt(e, o.url);
|
|
1277
|
-
|
|
1276
|
+
Ne(e.config, o.url) && Kt(this, s);
|
|
1278
1277
|
let u = !1, d = () => {
|
|
1279
1278
|
c.cancel(), !u && (u = !0, n.delete(d), l(), s.end());
|
|
1280
1279
|
};
|
|
1281
1280
|
n.add(d);
|
|
1282
1281
|
let f = () => {
|
|
1283
|
-
|
|
1284
|
-
|
|
1282
|
+
if (u) return;
|
|
1283
|
+
Zt(e, s, "xhr", {
|
|
1285
1284
|
type: "xhr",
|
|
1286
1285
|
xhr: this
|
|
1287
|
-
}, o), l()
|
|
1288
|
-
|
|
1289
|
-
|
|
1286
|
+
}, o), l();
|
|
1287
|
+
let t = Date.now();
|
|
1288
|
+
c.complete((r) => {
|
|
1289
|
+
if (!u) {
|
|
1290
|
+
if (u = !0, n.delete(d), r) {
|
|
1291
|
+
s.setAttributes(e.applyRedact(Rt(r))), s.end(performance.timeOrigin + r.startTime + Lt(r));
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
s.end(t);
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1290
1297
|
};
|
|
1291
1298
|
this.addEventListener("loadend", f, { once: !0 });
|
|
1292
1299
|
try {
|
|
@@ -1318,7 +1325,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1318
1325
|
let n = (e) => {
|
|
1319
1326
|
if (!t.isSampled()) return;
|
|
1320
1327
|
let n = Date.now(), r = en(t.config.hooks.redactUrl, e.blockedURI), i = e.sourceFile ? t.config.hooks.redactUrl(e.sourceFile) : void 0;
|
|
1321
|
-
t.startSpan("csp.violation",
|
|
1328
|
+
t.startSpan("csp.violation", S(S(S({}, t.config.hooks.getPageAttributes()), N({
|
|
1322
1329
|
errorType: "csp",
|
|
1323
1330
|
result: j.error,
|
|
1324
1331
|
spanSubtype: "csp",
|
|
@@ -1333,9 +1340,9 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1333
1340
|
"csp.column_number": e.columnNumber,
|
|
1334
1341
|
"csp.status_code": e.statusCode,
|
|
1335
1342
|
"csp.original_policy": e.originalPolicy,
|
|
1336
|
-
[
|
|
1337
|
-
[
|
|
1338
|
-
[
|
|
1343
|
+
[g.eventId]: h("event"),
|
|
1344
|
+
[g.eventTimestamp]: n,
|
|
1345
|
+
[g.eventType]: "error",
|
|
1339
1346
|
"error.source": "csp"
|
|
1340
1347
|
}), { startTime: n }).end(n);
|
|
1341
1348
|
};
|
|
@@ -1363,15 +1370,15 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1363
1370
|
let l = n instanceof Error ? n : {
|
|
1364
1371
|
message: c,
|
|
1365
1372
|
name: r == null ? a : r
|
|
1366
|
-
}, u =
|
|
1373
|
+
}, u = S(S(S(S({}, e.config.hooks.getPageAttributes()), e.config.hooks.getErrorAttributes()), N({
|
|
1367
1374
|
errorType: rn(a),
|
|
1368
1375
|
result: j.error,
|
|
1369
1376
|
spanSubtype: rn(a),
|
|
1370
1377
|
spanType: M.error
|
|
1371
1378
|
})), {}, {
|
|
1372
|
-
[
|
|
1373
|
-
[
|
|
1374
|
-
[
|
|
1379
|
+
[g.eventId]: h("event"),
|
|
1380
|
+
[g.eventTimestamp]: s,
|
|
1381
|
+
[g.eventType]: "error",
|
|
1375
1382
|
"error.message": c,
|
|
1376
1383
|
"error.handled": !1,
|
|
1377
1384
|
"error.source": a
|
|
@@ -1394,7 +1401,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1394
1401
|
spanName: "browser.error",
|
|
1395
1402
|
source: "window.error",
|
|
1396
1403
|
error: (n = e.error) == null ? e.message : n,
|
|
1397
|
-
extra:
|
|
1404
|
+
extra: S({
|
|
1398
1405
|
"code.filepath": e.filename,
|
|
1399
1406
|
"code.lineno": e.lineno,
|
|
1400
1407
|
"code.column": e.colno
|
|
@@ -1434,11 +1441,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1434
1441
|
}
|
|
1435
1442
|
}
|
|
1436
1443
|
};
|
|
1437
|
-
}, sn = 50, cn = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t,
|
|
1438
|
-
var n;
|
|
1439
|
-
let r = (n = e.attribution) == null ? void 0 : n[0];
|
|
1440
|
-
return r != null && r.containerSrc ? t(r.containerSrc) : (r == null ? void 0 : r.containerName) || (r == null ? void 0 : r.name) || e.name || "unknown";
|
|
1441
|
-
}, dn = (e, t) => ({
|
|
1444
|
+
}, sn = 50, cn = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, V = (e) => Number.isFinite(e) ? e : void 0, ln = (e, t) => S(S(S(S(S({}, e.containerId ? { "long_task.attribution.container_id": e.containerId } : {}), e.containerName ? { "long_task.attribution.container_name": e.containerName } : {}), e.containerSrc ? { "long_task.attribution.container_src": t(e.containerSrc) } : {}), e.containerType ? { "long_task.attribution.container_type": e.containerType } : {}), e.name ? { "long_task.attribution.name": e.name } : {}), un = (e, t) => ({
|
|
1442
1445
|
"long_task.script.duration": e.duration,
|
|
1443
1446
|
"long_task.script.execution_start": e.executionStart,
|
|
1444
1447
|
"long_task.script.forced_style_and_layout_duration": e.forcedStyleAndLayoutDuration,
|
|
@@ -1450,7 +1453,7 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1450
1453
|
"long_task.script.source_url": e.sourceURL ? t(e.sourceURL) : "",
|
|
1451
1454
|
"long_task.script.start_time": e.startTime,
|
|
1452
1455
|
"long_task.script.window_attribution": e.windowAttribution
|
|
1453
|
-
}),
|
|
1456
|
+
}), dn = (e = {}) => {
|
|
1454
1457
|
let t = cn(e.threshold, sn), n, r, i = [];
|
|
1455
1458
|
return {
|
|
1456
1459
|
name: "long-task",
|
|
@@ -1462,22 +1465,24 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1462
1465
|
let c = (n) => {
|
|
1463
1466
|
var r, i;
|
|
1464
1467
|
if (!e.isSampled() || !Number.isFinite(n.duration) || n.duration < t) return;
|
|
1465
|
-
let a = n.entryType === "long-animation-frame", o = a ? n : void 0, s = (r = o == null ? void 0 : o.scripts) == null ? [] : r, c = h("long-task"), l = performance.timeOrigin + n.startTime, u = l + n.duration, d = a ? "long-animation-frame" : "long-task", f = a
|
|
1468
|
+
let a = n.entryType === "long-animation-frame", o = a ? n : void 0, s = (r = o == null ? void 0 : o.scripts) == null ? [] : r, c = h("long-task"), l = performance.timeOrigin + n.startTime, u = l + n.duration, d = a ? "long-animation-frame" : "long-task", f = a || (i = n.attribution) == null ? [] : i, p = e.startSpan("browser.long_task", S(S(S(S(S(S(S({}, e.config.hooks.getPageAttributes()), N({
|
|
1466
1469
|
errorType: "none",
|
|
1467
1470
|
result: j.success,
|
|
1468
1471
|
spanSubtype: d,
|
|
1469
1472
|
spanType: M.longtask
|
|
1470
|
-
})), {}, {
|
|
1471
|
-
[
|
|
1472
|
-
[
|
|
1473
|
-
[
|
|
1474
|
-
[
|
|
1475
|
-
[
|
|
1476
|
-
[
|
|
1477
|
-
|
|
1478
|
-
},
|
|
1473
|
+
})), V(o == null ? void 0 : o.blockingDuration) === void 0 ? {} : { [g.longTaskBlockingDuration]: o.blockingDuration }), {}, {
|
|
1474
|
+
[g.longTaskDuration]: n.duration,
|
|
1475
|
+
[g.longTaskEntryType]: d,
|
|
1476
|
+
[g.longTaskId]: c,
|
|
1477
|
+
[g.eventId]: h("event"),
|
|
1478
|
+
[g.eventTimestamp]: l,
|
|
1479
|
+
[g.eventType]: "long_task",
|
|
1480
|
+
"long_task.name": n.name
|
|
1481
|
+
}, V(o == null ? void 0 : o.firstUIEventTimestamp) === void 0 ? {} : { "long_task.first_ui_event_timestamp": o.firstUIEventTimestamp }), V(o == null ? void 0 : o.renderStart) === void 0 ? {} : { "long_task.render_start": o.renderStart }), V(o == null ? void 0 : o.styleAndLayoutStart) === void 0 ? {} : { "long_task.style_and_layout_start": o.styleAndLayoutStart }), o ? { [g.longTaskStartTime]: o.startTime } : {}), { startTime: l });
|
|
1479
1482
|
s.forEach((t) => {
|
|
1480
|
-
p.addEvent("long_task.script", e.applyRedact(
|
|
1483
|
+
p.addEvent("long_task.script", e.applyRedact(un(t, e.config.hooks.redactUrl)), performance.timeOrigin + t.startTime);
|
|
1484
|
+
}), f.forEach((t, n) => {
|
|
1485
|
+
p.addEvent("long_task.attribution", e.applyRedact(S({ "long_task.attribution.index": n }, ln(t, e.config.hooks.redactUrl))), l);
|
|
1481
1486
|
}), p.end(u), e.notifyActivity({
|
|
1482
1487
|
endTime: u,
|
|
1483
1488
|
startTime: l,
|
|
@@ -1513,11 +1518,11 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1513
1518
|
toUrl: n
|
|
1514
1519
|
};
|
|
1515
1520
|
for (let e of Array.from(H)) e(r);
|
|
1516
|
-
},
|
|
1521
|
+
}, fn = () => {
|
|
1517
1522
|
J("popstate", U || q());
|
|
1518
|
-
},
|
|
1523
|
+
}, pn = () => {
|
|
1519
1524
|
J("hashchange", U || q());
|
|
1520
|
-
},
|
|
1525
|
+
}, mn = () => {
|
|
1521
1526
|
K || typeof window > "u" || typeof history > "u" || (K = !0, U = q(), W = history.pushState, G = history.replaceState, history.pushState = function(e, t, n) {
|
|
1522
1527
|
let r = U || q(), i = W == null ? void 0 : W.apply(this, [
|
|
1523
1528
|
e,
|
|
@@ -1532,15 +1537,15 @@ var Se = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1532
1537
|
n
|
|
1533
1538
|
]);
|
|
1534
1539
|
return J("replaceState", r), i;
|
|
1535
|
-
}, window.addEventListener("popstate",
|
|
1536
|
-
},
|
|
1537
|
-
!K || typeof window > "u" || typeof history > "u" || (W && (history.pushState = W), G && (history.replaceState = G), window.removeEventListener("popstate",
|
|
1538
|
-
},
|
|
1539
|
-
H.delete(e), H.size === 0 &&
|
|
1540
|
+
}, window.addEventListener("popstate", fn), window.addEventListener("hashchange", pn));
|
|
1541
|
+
}, hn = () => {
|
|
1542
|
+
!K || typeof window > "u" || typeof history > "u" || (W && (history.pushState = W), G && (history.replaceState = G), window.removeEventListener("popstate", fn), window.removeEventListener("hashchange", pn), W = void 0, G = void 0, K = !1, U = "");
|
|
1543
|
+
}, gn = (e) => typeof window > "u" || typeof history > "u" ? () => {} : (mn(), H.add(e), () => {
|
|
1544
|
+
H.delete(e), H.size === 0 && hn();
|
|
1540
1545
|
});
|
|
1541
1546
|
//#endregion
|
|
1542
1547
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutPropertiesLoose.js
|
|
1543
|
-
function
|
|
1548
|
+
function _n(e, t) {
|
|
1544
1549
|
if (e == null) return {};
|
|
1545
1550
|
var n = {};
|
|
1546
1551
|
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
@@ -1551,9 +1556,9 @@ function vn(e, t) {
|
|
|
1551
1556
|
}
|
|
1552
1557
|
//#endregion
|
|
1553
1558
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutProperties.js
|
|
1554
|
-
function
|
|
1559
|
+
function vn(e, t) {
|
|
1555
1560
|
if (e == null) return {};
|
|
1556
|
-
var n, r, i =
|
|
1561
|
+
var n, r, i = _n(e, t);
|
|
1557
1562
|
if (Object.getOwnPropertySymbols) {
|
|
1558
1563
|
var a = Object.getOwnPropertySymbols(e);
|
|
1559
1564
|
for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
@@ -1562,18 +1567,18 @@ function yn(e, t) {
|
|
|
1562
1567
|
}
|
|
1563
1568
|
//#endregion
|
|
1564
1569
|
//#region src/plugins/page-view.ts
|
|
1565
|
-
var
|
|
1570
|
+
var yn = ["stopLoadingTime"], bn = new Set([...Object.values(g), D]), xn = () => typeof location > "u" ? "" : location.href, Sn = () => {
|
|
1566
1571
|
if (typeof performance > "u") return {};
|
|
1567
1572
|
let e = performance.getEntriesByType("navigation")[0];
|
|
1568
1573
|
if (!e) return {};
|
|
1569
1574
|
let t = {}, n = (e, n) => {
|
|
1570
1575
|
Number.isFinite(n) && n > 0 && (t[e] = n);
|
|
1571
1576
|
};
|
|
1572
|
-
return n(
|
|
1573
|
-
},
|
|
1577
|
+
return n(g.viewFirstByte, e.responseStart), n(g.viewDomInteractive, e.domInteractive), n(g.viewDomContentLoaded, e.domContentLoadedEventEnd), n(g.viewDomComplete, e.domComplete), n(g.viewLoadEvent, e.loadEventEnd), t;
|
|
1578
|
+
}, Cn = (e) => {
|
|
1574
1579
|
let t = e.indexOf("?");
|
|
1575
1580
|
return t < 0 ? e : e.slice(0, t);
|
|
1576
|
-
},
|
|
1581
|
+
}, wn = (e) => {
|
|
1577
1582
|
let t = e.slice(1);
|
|
1578
1583
|
if (!t || typeof document > "u" || typeof document.getElementById != "function") return !1;
|
|
1579
1584
|
try {
|
|
@@ -1581,58 +1586,58 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1581
1586
|
} catch (e) {
|
|
1582
1587
|
return !!document.getElementById(t);
|
|
1583
1588
|
}
|
|
1584
|
-
},
|
|
1589
|
+
}, Tn = (e, t) => {
|
|
1585
1590
|
try {
|
|
1586
1591
|
let n = typeof location > "u" ? "http://localhost" : location.href, r = new URL(e, n), i = new URL(t, n);
|
|
1587
|
-
return r.pathname !== i.pathname || !
|
|
1592
|
+
return r.pathname !== i.pathname || !wn(i.hash) && Cn(r.hash) !== Cn(i.hash);
|
|
1588
1593
|
} catch (n) {
|
|
1589
1594
|
return e !== t;
|
|
1590
1595
|
}
|
|
1591
|
-
},
|
|
1596
|
+
}, En = () => {
|
|
1592
1597
|
let e = [];
|
|
1593
1598
|
return {
|
|
1594
1599
|
name: "page-view",
|
|
1595
1600
|
init(t) {
|
|
1596
1601
|
if (typeof window > "u") return;
|
|
1597
|
-
let n, r, i = (e = Date.now()) => t.setView({}, e),
|
|
1598
|
-
e.version += 1, t.startSpan("browser.view",
|
|
1599
|
-
[
|
|
1600
|
-
[
|
|
1601
|
-
[
|
|
1602
|
-
[
|
|
1603
|
-
[
|
|
1604
|
-
[
|
|
1602
|
+
let n, r, i, a = (e = Date.now()) => t.setView({}, e), o = (e, n, r = Date.now(), i) => {
|
|
1603
|
+
e.version += 1, t.startSpan("browser.view", S(S(S(S(S({}, t.config.hooks.getPageAttributes()), e.attributes), e.snapshotAttributes), {}, {
|
|
1604
|
+
[g.eventId]: h("event"),
|
|
1605
|
+
[g.eventPhase]: n,
|
|
1606
|
+
[g.eventTimestamp]: r,
|
|
1607
|
+
[g.eventType]: "view",
|
|
1608
|
+
[g.viewStartedAt]: e.startedAt,
|
|
1609
|
+
[g.viewVersion]: e.version
|
|
1605
1610
|
}, i ? { "view.end_reason": i } : {}), e.loadingTime === void 0 ? {} : {
|
|
1606
|
-
[
|
|
1611
|
+
[g.viewLoadingTime]: e.loadingTime,
|
|
1607
1612
|
"view.loading_time.source": e.loadingTimeSource
|
|
1608
1613
|
}), {
|
|
1609
1614
|
contextTime: r,
|
|
1610
1615
|
startTime: r
|
|
1611
1616
|
}).end(r);
|
|
1612
|
-
},
|
|
1613
|
-
var
|
|
1617
|
+
}, s = (e, t = !0, r = Date.now()) => {
|
|
1618
|
+
var i;
|
|
1614
1619
|
if (!n) {
|
|
1615
|
-
t &&
|
|
1620
|
+
t && a(r);
|
|
1616
1621
|
return;
|
|
1617
1622
|
}
|
|
1618
|
-
let s =
|
|
1619
|
-
(
|
|
1623
|
+
let s = S({}, n);
|
|
1624
|
+
(i = n.stopLoadingTime) == null || i.call(n), o(n, "end", r, e), n = void 0, t && a(r);
|
|
1620
1625
|
let { stopLoadingTime: c } = s;
|
|
1621
|
-
return
|
|
1622
|
-
},
|
|
1626
|
+
return vn(s, yn);
|
|
1627
|
+
}, c = (e, t, r) => {
|
|
1623
1628
|
if (n !== e || !Number.isFinite(t) || t < 0) return;
|
|
1624
|
-
let i =
|
|
1625
|
-
[
|
|
1629
|
+
let i = S(S({}, e.loadingType === "initial_load" ? Sn() : {}), {}, {
|
|
1630
|
+
[g.viewLoadingTime]: t,
|
|
1626
1631
|
"view.loading_time.source": r
|
|
1627
1632
|
});
|
|
1628
|
-
Object.assign(e.snapshotAttributes, i), e.loadingTime = t, e.loadingTimeSource = r,
|
|
1629
|
-
},
|
|
1633
|
+
Object.assign(e.snapshotAttributes, i), e.loadingTime = t, e.loadingTimeSource = r, o(e, "update");
|
|
1634
|
+
}, l = (e) => {
|
|
1630
1635
|
if (!t.config.view.loadingTime || document.visibilityState === "hidden") return;
|
|
1631
|
-
let r = !1, i, a = e.loadingType !== "initial_load", o,
|
|
1636
|
+
let r = !1, i, a = e.loadingType !== "initial_load", o, s, l = !1, u, d = () => {
|
|
1632
1637
|
var t;
|
|
1633
1638
|
if (l || !r || !a || n !== e) return;
|
|
1634
|
-
let
|
|
1635
|
-
|
|
1639
|
+
let s = [i, o].filter((e) => e !== void 0);
|
|
1640
|
+
s.length && c(e, Math.max(...s), "auto"), (t = e.stopLoadingTime) == null || t.call(e), e.stopLoadingTime = void 0;
|
|
1636
1641
|
}, f = () => {
|
|
1637
1642
|
var t, n;
|
|
1638
1643
|
let r = (t = (n = performance).getEntriesByType) == null ? void 0 : t.call(n, "navigation")[0];
|
|
@@ -1644,70 +1649,70 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1644
1649
|
n === e && (f(), a = !0, d());
|
|
1645
1650
|
});
|
|
1646
1651
|
};
|
|
1647
|
-
window.addEventListener("load", t, { once: !0 }),
|
|
1652
|
+
window.addEventListener("load", t, { once: !0 }), s = () => window.removeEventListener("load", t);
|
|
1648
1653
|
}
|
|
1649
|
-
let p =
|
|
1654
|
+
let p = mt(t, e.startedAt, (t) => {
|
|
1650
1655
|
r = !0, t.hadActivity && (i = Math.max(0, t.endTime - e.startedAt)), d();
|
|
1651
1656
|
}), m = () => {
|
|
1652
1657
|
var t;
|
|
1653
1658
|
document.visibilityState === "hidden" && (l = !0, (t = e.stopLoadingTime) == null || t.call(e), e.stopLoadingTime = void 0);
|
|
1654
1659
|
};
|
|
1655
1660
|
document.addEventListener("visibilitychange", m), u = () => document.removeEventListener("visibilitychange", m), e.stopLoadingTime = () => {
|
|
1656
|
-
p(),
|
|
1661
|
+
p(), s == null || s(), s = void 0, u == null || u(), u = void 0;
|
|
1657
1662
|
}, d();
|
|
1658
|
-
},
|
|
1663
|
+
}, u = (e) => {
|
|
1659
1664
|
let n = t.applyRedact(e == null ? {} : e);
|
|
1660
|
-
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !
|
|
1661
|
-
},
|
|
1662
|
-
var
|
|
1665
|
+
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !bn.has(e)));
|
|
1666
|
+
}, d = (e, r, i, a = ((e) => (e = n == null ? void 0 : n.rawUrl) == null ? "" : e)()) => {
|
|
1667
|
+
var c, d;
|
|
1663
1668
|
if (!t.isSessionActive()) return;
|
|
1664
|
-
let f = (
|
|
1665
|
-
|
|
1666
|
-
let v = h("view"), y = t.config.hooks.redactUrl(f), b = t.config.hooks.redactUrl(
|
|
1669
|
+
let f = (c = e.url) == null ? xn() : c, p = t.config.hooks.getViewPathGroup(f), m = (d = e.name) == null ? p : d, _ = u(e.attributes);
|
|
1670
|
+
s(r, !1);
|
|
1671
|
+
let v = h("view"), y = t.config.hooks.redactUrl(f), b = t.config.hooks.redactUrl(a), x = i === "initial_load", C = x && typeof performance < "u" ? performance.timeOrigin : Date.now(), w = x ? Sn() : {};
|
|
1667
1672
|
t.setView({
|
|
1668
|
-
attributes:
|
|
1673
|
+
attributes: _,
|
|
1669
1674
|
id: v,
|
|
1670
1675
|
loadingType: i,
|
|
1671
1676
|
name: m,
|
|
1672
|
-
startedAt:
|
|
1677
|
+
startedAt: C,
|
|
1673
1678
|
url: y,
|
|
1674
1679
|
urlPathGroup: p
|
|
1675
|
-
},
|
|
1676
|
-
attributes:
|
|
1680
|
+
}, C), n = {
|
|
1681
|
+
attributes: _,
|
|
1677
1682
|
version: 0,
|
|
1678
1683
|
id: v,
|
|
1679
1684
|
loadingType: i,
|
|
1680
1685
|
name: m,
|
|
1681
1686
|
rawUrl: f,
|
|
1682
|
-
snapshotAttributes:
|
|
1687
|
+
snapshotAttributes: S(S(S(S(S({}, _), t.config.hooks.getPageAttributes()), w), N({
|
|
1683
1688
|
errorType: "none",
|
|
1684
1689
|
spanSubtype: x ? "navigate" : r,
|
|
1685
1690
|
spanType: x ? M.document : M.route
|
|
1686
1691
|
})), {}, {
|
|
1687
|
-
[
|
|
1688
|
-
[
|
|
1689
|
-
[
|
|
1690
|
-
[
|
|
1691
|
-
[
|
|
1692
|
+
[g.viewId]: v,
|
|
1693
|
+
[g.viewName]: m,
|
|
1694
|
+
[g.viewUrl]: y,
|
|
1695
|
+
[g.viewUrlPathGroup]: p,
|
|
1696
|
+
[g.viewLoadingType]: i,
|
|
1692
1697
|
"url.previous": b,
|
|
1693
1698
|
"event.source": r
|
|
1694
1699
|
}, x ? { "document.referrer": t.config.hooks.redactUrl(document.referrer || "") } : {}),
|
|
1695
|
-
startedAt:
|
|
1700
|
+
startedAt: C,
|
|
1696
1701
|
url: y,
|
|
1697
1702
|
urlPathGroup: p
|
|
1698
|
-
},
|
|
1699
|
-
},
|
|
1703
|
+
}, o(n, "start", C), l(n);
|
|
1704
|
+
}, f = t.onViewCommand((e) => {
|
|
1700
1705
|
if (e.type === "start") {
|
|
1701
|
-
|
|
1706
|
+
d(e.options, "manual", n ? "route_change" : "initial_load");
|
|
1702
1707
|
return;
|
|
1703
1708
|
}
|
|
1704
1709
|
if (n) {
|
|
1705
1710
|
if (e.type === "set_loading_time") {
|
|
1706
1711
|
var r;
|
|
1707
|
-
(r = n.stopLoadingTime) == null || r.call(n), n.stopLoadingTime = void 0,
|
|
1712
|
+
(r = n.stopLoadingTime) == null || r.call(n), n.stopLoadingTime = void 0, c(n, Math.max(0, e.time - n.startedAt), "manual");
|
|
1708
1713
|
return;
|
|
1709
1714
|
}
|
|
1710
|
-
n.name !== e.name && (n.name = e.name, n.snapshotAttributes[
|
|
1715
|
+
n.name !== e.name && (n.name = e.name, n.snapshotAttributes[g.viewName] = e.name, t.setView({
|
|
1711
1716
|
attributes: n.attributes,
|
|
1712
1717
|
id: n.id,
|
|
1713
1718
|
loadingType: n.loadingType,
|
|
@@ -1715,28 +1720,44 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1715
1720
|
startedAt: n.startedAt,
|
|
1716
1721
|
url: n.url,
|
|
1717
1722
|
urlPathGroup: n.urlPathGroup
|
|
1718
|
-
}),
|
|
1723
|
+
}), o(n, "update"));
|
|
1719
1724
|
}
|
|
1720
|
-
}),
|
|
1721
|
-
t.config.view.tracking === "auto" && (n ||
|
|
1722
|
-
|
|
1725
|
+
}), p = () => {};
|
|
1726
|
+
t.config.view.tracking === "auto" && (n || d({}, "load", "initial_load"), p = gn((e) => {
|
|
1727
|
+
Tn(e.fromUrl, e.toUrl) && d({}, e.source, "route_change", e.fromUrl);
|
|
1723
1728
|
}));
|
|
1724
|
-
let
|
|
1725
|
-
e.persisted
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
+
let m = (e) => {
|
|
1730
|
+
if (e.persisted) {
|
|
1731
|
+
r = s("bfcache");
|
|
1732
|
+
return;
|
|
1733
|
+
}
|
|
1734
|
+
r = void 0, s("pagehide");
|
|
1735
|
+
}, _ = (e) => {
|
|
1736
|
+
if (e.persisted && t.config.view.tracking === "auto") {
|
|
1737
|
+
let e = r;
|
|
1738
|
+
if (r = void 0, !t.isSessionActive()) {
|
|
1739
|
+
i = e;
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
d(e ? {
|
|
1743
|
+
attributes: e.attributes,
|
|
1744
|
+
name: e.name,
|
|
1745
|
+
url: e.rawUrl
|
|
1746
|
+
} : {}, "bfCache", "bf_cache", e == null ? void 0 : e.rawUrl);
|
|
1747
|
+
}
|
|
1748
|
+
}, v = t.onSessionLifecycle((e) => {
|
|
1729
1749
|
if (e.type === "expired") {
|
|
1730
|
-
|
|
1750
|
+
var t;
|
|
1751
|
+
i = (t = s("session_expired", !0, e.expiredAt)) == null ? r : t, r = void 0;
|
|
1731
1752
|
return;
|
|
1732
1753
|
}
|
|
1733
|
-
|
|
1734
|
-
attributes:
|
|
1735
|
-
name:
|
|
1736
|
-
url:
|
|
1737
|
-
}, "sessionRenewal", "session_renewal",
|
|
1754
|
+
i && (d({
|
|
1755
|
+
attributes: i.attributes,
|
|
1756
|
+
name: i.name,
|
|
1757
|
+
url: i.rawUrl
|
|
1758
|
+
}, "sessionRenewal", "session_renewal", i.rawUrl), i = void 0);
|
|
1738
1759
|
});
|
|
1739
|
-
window.addEventListener("pagehide",
|
|
1760
|
+
window.addEventListener("pagehide", m), window.addEventListener("pageshow", _), e.push(p, v, f, () => window.removeEventListener("pagehide", m), () => window.removeEventListener("pageshow", _), () => s("shutdown"));
|
|
1740
1761
|
},
|
|
1741
1762
|
shutdown() {
|
|
1742
1763
|
for (; e.length;) {
|
|
@@ -1745,7 +1766,7 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1745
1766
|
}
|
|
1746
1767
|
}
|
|
1747
1768
|
};
|
|
1748
|
-
},
|
|
1769
|
+
}, Dn = 5e3, On = (e) => typeof e == "number" && Number.isFinite(e) && e > 0, kn = (e, t, n, r) => ({
|
|
1749
1770
|
expiresAt: Math.min(t + n, t + r),
|
|
1750
1771
|
id: e,
|
|
1751
1772
|
startedAt: t,
|
|
@@ -1753,19 +1774,19 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1753
1774
|
}), Y = (e, t, n) => {
|
|
1754
1775
|
if (t >= e.startedAt + n) return "maxLifetime";
|
|
1755
1776
|
if (t >= e.expiresAt) return "inactivity";
|
|
1756
|
-
},
|
|
1777
|
+
}, An = (e, t, n, r) => S(S({}, e), {}, { expiresAt: Math.min(t + n, e.startedAt + r) }), jn = (e, t, n) => {
|
|
1757
1778
|
if (!e) return null;
|
|
1758
1779
|
try {
|
|
1759
1780
|
let r = JSON.parse(e);
|
|
1760
|
-
if (r.status === "active" && typeof r.id == "string" && r.id.length > 0 &&
|
|
1781
|
+
if (r.status === "active" && typeof r.id == "string" && r.id.length > 0 && On(r.startedAt) && r.startedAt <= t + Dn && On(r.expiresAt) && r.expiresAt >= r.startedAt && r.expiresAt <= r.startedAt + n || r.status === "expired" && typeof r.previousId == "string" && r.previousId.length > 0 && (r.reason === "inactivity" || r.reason === "maxLifetime") && On(r.expiredAt) && r.expiredAt <= t + Dn) return r;
|
|
1761
1782
|
} catch (e) {}
|
|
1762
1783
|
return null;
|
|
1763
|
-
},
|
|
1784
|
+
}, Mn = 900 * 1e3, X = 14400 * 1e3, Nn = 1e3, Pn = 6e4, Fn = [
|
|
1764
1785
|
"click",
|
|
1765
1786
|
"keydown",
|
|
1766
1787
|
"scroll",
|
|
1767
1788
|
"touchstart"
|
|
1768
|
-
],
|
|
1789
|
+
], In = /* @__PURE__ */ new Map(), Ln = (e) => {
|
|
1769
1790
|
let t = typeof window < "u", n = () => {
|
|
1770
1791
|
var n;
|
|
1771
1792
|
if (t) try {
|
|
@@ -1773,47 +1794,47 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1773
1794
|
} catch (e) {
|
|
1774
1795
|
t = !1;
|
|
1775
1796
|
}
|
|
1776
|
-
return (n =
|
|
1797
|
+
return (n = In.get(e)) == null ? null : n;
|
|
1777
1798
|
};
|
|
1778
1799
|
return n(), {
|
|
1779
1800
|
isLocalStorage: () => t,
|
|
1780
1801
|
read: n,
|
|
1781
1802
|
write: (n) => {
|
|
1782
1803
|
let r = JSON.stringify(n);
|
|
1783
|
-
if (
|
|
1804
|
+
if (In.set(e, r), t) try {
|
|
1784
1805
|
window.localStorage.setItem(e, r);
|
|
1785
1806
|
} catch (e) {
|
|
1786
1807
|
t = !1;
|
|
1787
1808
|
}
|
|
1788
1809
|
}
|
|
1789
1810
|
};
|
|
1790
|
-
},
|
|
1811
|
+
}, Rn = (e, t) => {
|
|
1791
1812
|
let n = "";
|
|
1792
1813
|
try {
|
|
1793
1814
|
n = new URL(e).host;
|
|
1794
1815
|
} catch (t) {
|
|
1795
1816
|
n = e;
|
|
1796
1817
|
}
|
|
1797
|
-
return `bk_ot_session__${
|
|
1798
|
-
},
|
|
1799
|
-
e.startSpan("browser.session",
|
|
1818
|
+
return `bk_ot_session__${m(`${t}\0${n || "default"}`)}`;
|
|
1819
|
+
}, zn = (e, t, n, r, i, a, o) => {
|
|
1820
|
+
e.startSpan("browser.session", S(S(S({}, e.config.hooks.getPageAttributes()), N({
|
|
1800
1821
|
spanSubtype: t,
|
|
1801
1822
|
spanType: M.session
|
|
1802
1823
|
})), {}, {
|
|
1803
|
-
[
|
|
1804
|
-
[
|
|
1805
|
-
[
|
|
1806
|
-
[
|
|
1807
|
-
[
|
|
1808
|
-
[
|
|
1809
|
-
[
|
|
1810
|
-
[
|
|
1824
|
+
[g.eventId]: h("event"),
|
|
1825
|
+
[g.eventPhase]: t,
|
|
1826
|
+
[g.eventTimestamp]: i,
|
|
1827
|
+
[g.eventType]: "session",
|
|
1828
|
+
[g.sessionHasReplay]: !1,
|
|
1829
|
+
[g.sessionId]: n,
|
|
1830
|
+
[g.sessionStartTime]: r,
|
|
1831
|
+
[g.sessionType]: "user",
|
|
1811
1832
|
"session.lifecycle.reason": a
|
|
1812
1833
|
}, o ? { "session.previous_id": o } : {}), {
|
|
1813
1834
|
contextTime: i,
|
|
1814
1835
|
startTime: i
|
|
1815
1836
|
}).end(i);
|
|
1816
|
-
},
|
|
1837
|
+
}, Bn = (e = {}) => {
|
|
1817
1838
|
let t = [];
|
|
1818
1839
|
return {
|
|
1819
1840
|
name: "session",
|
|
@@ -1822,14 +1843,14 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1822
1843
|
if (typeof window > "u" || typeof document > "u") {
|
|
1823
1844
|
let e = Date.now(), t = h("session");
|
|
1824
1845
|
n.setRuntimeAttributes({
|
|
1825
|
-
[
|
|
1826
|
-
[
|
|
1827
|
-
[
|
|
1828
|
-
[
|
|
1846
|
+
[g.sessionHasReplay]: !1,
|
|
1847
|
+
[g.sessionId]: t,
|
|
1848
|
+
[g.sessionStartTime]: e,
|
|
1849
|
+
[g.sessionType]: "user"
|
|
1829
1850
|
}, e);
|
|
1830
1851
|
return;
|
|
1831
1852
|
}
|
|
1832
|
-
let i = (r = e.storageKey) == null ?
|
|
1853
|
+
let i = (r = e.storageKey) == null ? Rn(n.config.transport.endpoint, n.config.application.name) : r, a = Ln(i), o = typeof performance < "u" && Number.isFinite(performance.timeOrigin) ? performance.timeOrigin : Date.now(), s, c, l, u = (e = Date.now()) => jn(a.read(), e, X), d = () => {
|
|
1833
1854
|
l !== void 0 && (clearTimeout(l), l = void 0);
|
|
1834
1855
|
}, f = (e, t = Date.now()) => {
|
|
1835
1856
|
var r;
|
|
@@ -1839,11 +1860,11 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1839
1860
|
id: i,
|
|
1840
1861
|
reason: e,
|
|
1841
1862
|
type: "expired"
|
|
1842
|
-
}),
|
|
1843
|
-
[
|
|
1844
|
-
[
|
|
1845
|
-
[
|
|
1846
|
-
[
|
|
1863
|
+
}), zn(n, "end", i, (r = c) == null ? t : r, t, e), d(), s = void 0, c = void 0, n.setRuntimeAttributes({
|
|
1864
|
+
[g.sessionHasReplay]: void 0,
|
|
1865
|
+
[g.sessionId]: void 0,
|
|
1866
|
+
[g.sessionStartTime]: void 0,
|
|
1867
|
+
[g.sessionType]: void 0
|
|
1847
1868
|
}, t), n.flush());
|
|
1848
1869
|
}, p = () => {
|
|
1849
1870
|
let e = Date.now(), t = u(e);
|
|
@@ -1875,13 +1896,13 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1875
1896
|
d();
|
|
1876
1897
|
let t = Math.min(e.expiresAt, e.startedAt + X);
|
|
1877
1898
|
l = setTimeout(p, Math.max(0, t - Date.now()));
|
|
1878
|
-
},
|
|
1899
|
+
}, _ = (e, t) => {
|
|
1879
1900
|
let r = e.id !== s;
|
|
1880
1901
|
s = e.id, c = e.startedAt, n.setRuntimeAttributes({
|
|
1881
|
-
[
|
|
1882
|
-
[
|
|
1883
|
-
[
|
|
1884
|
-
[
|
|
1902
|
+
[g.sessionHasReplay]: !1,
|
|
1903
|
+
[g.sessionId]: e.id,
|
|
1904
|
+
[g.sessionStartTime]: e.startedAt,
|
|
1905
|
+
[g.sessionType]: "user"
|
|
1885
1906
|
}, Math.min(e.startedAt, o)), m(e), r && t && n.notifySessionLifecycle({
|
|
1886
1907
|
id: e.id,
|
|
1887
1908
|
previousId: t.previousId,
|
|
@@ -1892,17 +1913,17 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1892
1913
|
}, v = (e = !1) => {
|
|
1893
1914
|
let t = Date.now(), r = u(t);
|
|
1894
1915
|
if ((r == null ? void 0 : r.status) === "active" && !Y(r, t, X)) {
|
|
1895
|
-
let e =
|
|
1896
|
-
a.write(e),
|
|
1916
|
+
let e = An(r, t, Mn, X);
|
|
1917
|
+
a.write(e), _(e, s ? void 0 : { reason: "shared" });
|
|
1897
1918
|
return;
|
|
1898
1919
|
}
|
|
1899
|
-
let i = (r == null ? void 0 : r.status) === "expired" ? r.previousId : r == null ? void 0 : r.id, o = (r == null ? void 0 : r.status) === "expired" ? r.reason : r ? Y(r, t, X) : e ? "init" : void 0, c =
|
|
1900
|
-
a.write(c),
|
|
1920
|
+
let i = (r == null ? void 0 : r.status) === "expired" ? r.previousId : r == null ? void 0 : r.id, o = (r == null ? void 0 : r.status) === "expired" ? r.reason : r ? Y(r, t, X) : e ? "init" : void 0, c = kn(h("session"), t, Mn, X);
|
|
1921
|
+
a.write(c), _(c, {
|
|
1901
1922
|
previousId: i,
|
|
1902
1923
|
reason: o == null ? "init" : o
|
|
1903
1924
|
});
|
|
1904
1925
|
let l = o == null ? "init" : o;
|
|
1905
|
-
|
|
1926
|
+
zn(n, l === "init" ? "start" : "rotate", c.id, c.startedAt, c.startedAt, l, i);
|
|
1906
1927
|
}, y = () => {
|
|
1907
1928
|
if (!s) return;
|
|
1908
1929
|
let e = Date.now(), t = u(e);
|
|
@@ -1910,31 +1931,31 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1910
1931
|
p();
|
|
1911
1932
|
return;
|
|
1912
1933
|
}
|
|
1913
|
-
let n =
|
|
1914
|
-
a.write(n),
|
|
1934
|
+
let n = An(t, e, Mn, X);
|
|
1935
|
+
a.write(n), _(n);
|
|
1915
1936
|
};
|
|
1916
1937
|
v(!0);
|
|
1917
1938
|
let b = 0, x = () => {
|
|
1918
1939
|
let e = Date.now();
|
|
1919
|
-
e - b <
|
|
1940
|
+
e - b < Nn || (b = e, v());
|
|
1920
1941
|
}, S = {
|
|
1921
1942
|
capture: !0,
|
|
1922
1943
|
passive: !0
|
|
1923
1944
|
};
|
|
1924
|
-
|
|
1925
|
-
|
|
1945
|
+
Fn.forEach((e) => window.addEventListener(e, x, S)), t.push(() => {
|
|
1946
|
+
Fn.forEach((e) => window.removeEventListener(e, x, S));
|
|
1926
1947
|
});
|
|
1927
1948
|
let C = () => {
|
|
1928
1949
|
document.visibilityState === "visible" && y();
|
|
1929
1950
|
};
|
|
1930
1951
|
document.addEventListener("visibilitychange", C);
|
|
1931
|
-
let w = window.setInterval(C,
|
|
1952
|
+
let w = window.setInterval(C, Pn);
|
|
1932
1953
|
t.push(() => {
|
|
1933
1954
|
document.removeEventListener("visibilitychange", C), window.clearInterval(w);
|
|
1934
1955
|
});
|
|
1935
1956
|
let T = (e) => {
|
|
1936
1957
|
if (!a.isLocalStorage() || e.storageArea !== window.localStorage || e.key !== i) return;
|
|
1937
|
-
let t = Date.now(), n =
|
|
1958
|
+
let t = Date.now(), n = jn(e.newValue, t, X);
|
|
1938
1959
|
if ((n == null ? void 0 : n.status) === "active" && n.id === s && !Y(n, t, X)) {
|
|
1939
1960
|
m(n);
|
|
1940
1961
|
return;
|
|
@@ -1947,25 +1968,25 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1947
1968
|
for (var e; t.length;) (e = t.pop()) == null || e();
|
|
1948
1969
|
}
|
|
1949
1970
|
};
|
|
1950
|
-
},
|
|
1951
|
-
if (typeof performance > "u") return
|
|
1971
|
+
}, Vn = "unknown", Hn = 10, Un = 6e4, Wn = 5e3, Gn = 1e3, Kn = (e, t) => !!t && e === t, qn = (e) => e ? e.replace(/_/g, "-") : Vn, Jn = () => {
|
|
1972
|
+
if (typeof performance > "u") return Vn;
|
|
1952
1973
|
let e = performance.getEntriesByType("navigation")[0];
|
|
1953
|
-
return
|
|
1954
|
-
},
|
|
1974
|
+
return qn(e == null ? void 0 : e.type);
|
|
1975
|
+
}, Yn = (e, t) => {
|
|
1955
1976
|
let [n, r] = e === "CLS" ? [.1, .25] : [200, 500];
|
|
1956
1977
|
return t <= n ? "good" : t <= r ? "needs-improvement" : "poor";
|
|
1957
1978
|
}, Z = (e) => {
|
|
1958
1979
|
var t, n, r;
|
|
1959
1980
|
if (!(typeof Element > "u" || !(e instanceof Element))) return (t = (n = (r = e.getAttribute("data-bk-action-name")) == null ? e.getAttribute("aria-label") : r) == null ? e.getAttribute("name") : n) == null ? e.tagName.toLowerCase() : t;
|
|
1960
|
-
},
|
|
1981
|
+
}, Xn = () => {
|
|
1961
1982
|
if (typeof performance > "u") return;
|
|
1962
1983
|
let e = performance.interactionCount;
|
|
1963
1984
|
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
1964
|
-
},
|
|
1985
|
+
}, Zn = (e, t) => {
|
|
1965
1986
|
var n, r;
|
|
1966
1987
|
let i = (n = t.value) == null ? 0 : n;
|
|
1967
1988
|
if (!(t.hadRecentInput || !Number.isFinite(i))) {
|
|
1968
|
-
if (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >=
|
|
1989
|
+
if (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >= Gn || t.startTime - e.clsWindowStart >= Wn) {
|
|
1969
1990
|
var a;
|
|
1970
1991
|
e.clsWindowStart = t.startTime, e.clsWindowValue = i, e.clsWindowLargestShiftValue = i, e.clsWindowLargestShiftTarget = Z((a = t.sources) == null || (a = a[0]) == null ? void 0 : a.node);
|
|
1971
1992
|
} else if (e.clsWindowValue += i, i > e.clsWindowLargestShiftValue) {
|
|
@@ -1974,12 +1995,12 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1974
1995
|
}
|
|
1975
1996
|
e.clsWindowEnd = t.startTime, e.clsWindowValue > e.cls && (e.cls = Math.round(e.clsWindowValue * 1e4) / 1e4, e.largestShiftValue = e.clsWindowLargestShiftValue, e.largestShiftTarget = e.clsWindowLargestShiftTarget);
|
|
1976
1997
|
}
|
|
1977
|
-
},
|
|
1998
|
+
}, Qn = (e, t) => {
|
|
1978
1999
|
var n, r;
|
|
1979
2000
|
if (!t.interactionId || !Number.isFinite(t.duration)) return;
|
|
1980
2001
|
e.interactionIdMin = Math.min(e.interactionIdMin, t.interactionId), e.interactionIdMax = Math.max(e.interactionIdMax, t.interactionId);
|
|
1981
2002
|
let i = (n = t.processingStart) == null ? t.startTime : n, a = (r = t.processingEnd) == null ? i : r, o = {
|
|
1982
|
-
duration: Math.min(t.duration,
|
|
2003
|
+
duration: Math.min(t.duration, Un),
|
|
1983
2004
|
inputDelay: Math.max(0, i - t.startTime),
|
|
1984
2005
|
interactionId: t.interactionId,
|
|
1985
2006
|
interactionTarget: Z(t.target),
|
|
@@ -1987,18 +2008,14 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
1987
2008
|
presentationDelay: Math.max(0, t.startTime + t.duration - a),
|
|
1988
2009
|
processingDuration: Math.max(0, a - i)
|
|
1989
2010
|
}, s = e.inpCandidates.findIndex((e) => e.interactionId === t.interactionId);
|
|
1990
|
-
s >= 0 ? o.duration > e.inpCandidates[s].duration && (e.inpCandidates[s] = o) : e.inpCandidates.push(o), e.inpCandidates.sort((e, t) => t.duration - e.duration).splice(
|
|
1991
|
-
},
|
|
1992
|
-
let t =
|
|
2011
|
+
s >= 0 ? o.duration > e.inpCandidates[s].duration && (e.inpCandidates[s] = o) : e.inpCandidates.push(o), e.inpCandidates.sort((e, t) => t.duration - e.duration).splice(Hn);
|
|
2012
|
+
}, $n = (e) => {
|
|
2013
|
+
let t = Xn(), n = t !== void 0 && e.interactionCountAtStart !== void 0 ? Math.max(0, t - e.interactionCountAtStart) : e.interactionIdMin === Infinity ? 0 : (e.interactionIdMax - e.interactionIdMin) / 7 + 1;
|
|
1993
2014
|
if (e.inpCandidates.length) return e.inpCandidates[Math.min(e.inpCandidates.length - 1, Math.floor(n / 50))];
|
|
1994
|
-
},
|
|
2015
|
+
}, er = (e, t) => {
|
|
1995
2016
|
var n;
|
|
1996
|
-
return {
|
|
1997
|
-
|
|
1998
|
-
[_.vitalMetric]: e.name.toLowerCase(),
|
|
1999
|
-
[_.vitalRating]: e.rating
|
|
2000
|
-
};
|
|
2001
|
-
}, nr = (e, t) => {
|
|
2017
|
+
return { "rum.navigation.type": (n = e.navigationType) == null ? t : n };
|
|
2018
|
+
}, tr = (e, t) => {
|
|
2002
2019
|
var n;
|
|
2003
2020
|
let r = (n = e.attribution) == null ? {} : n, i = {}, a = (e) => r[e], o = (e, t, n) => {
|
|
2004
2021
|
t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") && (i[e] = typeof t == "string" && n ? n(t) : t);
|
|
@@ -2022,7 +2039,7 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2022
2039
|
default: break;
|
|
2023
2040
|
}
|
|
2024
2041
|
return i;
|
|
2025
|
-
},
|
|
2042
|
+
}, nr = () => {
|
|
2026
2043
|
let e, t = !1;
|
|
2027
2044
|
return {
|
|
2028
2045
|
name: "web-vitals",
|
|
@@ -2040,23 +2057,23 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2040
2057
|
return;
|
|
2041
2058
|
}
|
|
2042
2059
|
if (t) return;
|
|
2043
|
-
let { onFCP: a, onLCP: o, onTTFB: s } = r, c =
|
|
2060
|
+
let { onFCP: a, onLCP: o, onTTFB: s } = r, c = Jn(), l = (e, t, r, i = r == null ? Date.now() : r) => {
|
|
2044
2061
|
if (!n.isSampled()) return;
|
|
2045
2062
|
let a = e.name.toLowerCase();
|
|
2046
|
-
n.startSpan("browser.web_vital",
|
|
2063
|
+
n.startSpan("browser.web_vital", S(S(S(S(S({}, n.config.hooks.getPageAttributes()), t), er(e, c)), N({
|
|
2047
2064
|
errorType: e.rating === "good" ? "none" : "slow",
|
|
2048
|
-
result:
|
|
2065
|
+
result: Ge(e.rating),
|
|
2049
2066
|
spanSubtype: a,
|
|
2050
2067
|
spanType: M.vital
|
|
2051
2068
|
})), {}, {
|
|
2052
|
-
[
|
|
2053
|
-
[
|
|
2054
|
-
[
|
|
2055
|
-
[
|
|
2056
|
-
[
|
|
2057
|
-
[
|
|
2069
|
+
[g.vitalMetric]: a,
|
|
2070
|
+
[g.vitalValue]: e.value,
|
|
2071
|
+
[g.vitalRating]: e.rating,
|
|
2072
|
+
[g.eventId]: h("event"),
|
|
2073
|
+
[g.eventTimestamp]: i,
|
|
2074
|
+
[g.eventType]: "vital",
|
|
2058
2075
|
"vital.id": e.id
|
|
2059
|
-
},
|
|
2076
|
+
}, tr(e, n.config.hooks.redactUrl)), {
|
|
2060
2077
|
contextTime: r,
|
|
2061
2078
|
startTime: i
|
|
2062
2079
|
}).end(i);
|
|
@@ -2066,7 +2083,7 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2066
2083
|
l(e, i === void 0 ? n.getRuntimeAttributes() : n.getRuntimeAttributesAt(i), i);
|
|
2067
2084
|
}, d, f, p, m = (e, t, n) => {
|
|
2068
2085
|
l(e, t, n, Date.now());
|
|
2069
|
-
},
|
|
2086
|
+
}, _ = () => {
|
|
2070
2087
|
let e = d;
|
|
2071
2088
|
if (!e || !n.isSampled()) return;
|
|
2072
2089
|
m({
|
|
@@ -2078,10 +2095,10 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2078
2095
|
id: h("vital"),
|
|
2079
2096
|
name: "CLS",
|
|
2080
2097
|
navigationType: c,
|
|
2081
|
-
rating:
|
|
2098
|
+
rating: Yn("CLS", e.cls),
|
|
2082
2099
|
value: e.cls
|
|
2083
2100
|
}, e.runtimeAttributes, e.startedAt);
|
|
2084
|
-
let t =
|
|
2101
|
+
let t = $n(e);
|
|
2085
2102
|
t && m({
|
|
2086
2103
|
attribution: {
|
|
2087
2104
|
inputDelay: t.inputDelay,
|
|
@@ -2094,26 +2111,26 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2094
2111
|
id: h("vital"),
|
|
2095
2112
|
name: "INP",
|
|
2096
2113
|
navigationType: c,
|
|
2097
|
-
rating:
|
|
2114
|
+
rating: Yn("INP", t.duration),
|
|
2098
2115
|
value: t.duration
|
|
2099
2116
|
}, e.runtimeAttributes, e.startedAt);
|
|
2100
2117
|
}, v = n.onViewChange((e) => {
|
|
2101
2118
|
var t;
|
|
2102
2119
|
let r = d;
|
|
2103
|
-
if (r &&
|
|
2104
|
-
r.runtimeAttributes =
|
|
2105
|
-
[
|
|
2106
|
-
[
|
|
2107
|
-
[
|
|
2108
|
-
[
|
|
2120
|
+
if (r && Kn(r.id, e.id)) {
|
|
2121
|
+
r.runtimeAttributes = S(S({}, r.runtimeAttributes), {}, {
|
|
2122
|
+
[g.viewId]: e.id,
|
|
2123
|
+
[g.viewName]: e.name,
|
|
2124
|
+
[g.viewUrl]: e.url,
|
|
2125
|
+
[g.viewUrlPathGroup]: e.urlPathGroup
|
|
2109
2126
|
});
|
|
2110
2127
|
return;
|
|
2111
2128
|
}
|
|
2112
|
-
|
|
2129
|
+
_(), d = e.id ? {
|
|
2113
2130
|
cls: 0,
|
|
2114
2131
|
clsWindowLargestShiftValue: 0,
|
|
2115
2132
|
clsWindowValue: 0,
|
|
2116
|
-
interactionCountAtStart:
|
|
2133
|
+
interactionCountAtStart: Xn(),
|
|
2117
2134
|
interactionIdMax: 0,
|
|
2118
2135
|
interactionIdMin: Infinity,
|
|
2119
2136
|
inpCandidates: [],
|
|
@@ -2126,12 +2143,12 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2126
2143
|
if (typeof PerformanceObserver < "u") {
|
|
2127
2144
|
var y, b;
|
|
2128
2145
|
(y = PerformanceObserver.supportedEntryTypes) != null && y.includes("layout-shift") && (p = new PerformanceObserver((e) => {
|
|
2129
|
-
if (d) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < d.startedAt ||
|
|
2146
|
+
if (d) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < d.startedAt || Zn(d, t);
|
|
2130
2147
|
}), p.observe({
|
|
2131
2148
|
buffered: !0,
|
|
2132
2149
|
type: "layout-shift"
|
|
2133
2150
|
})), (b = PerformanceObserver.supportedEntryTypes) != null && b.includes("event") && (f = new PerformanceObserver((e) => {
|
|
2134
|
-
if (d) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < d.startedAt || !t.interactionId || !Number.isFinite(t.duration) ||
|
|
2151
|
+
if (d) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < d.startedAt || !t.interactionId || !Number.isFinite(t.duration) || Qn(d, t);
|
|
2135
2152
|
}), f.observe({
|
|
2136
2153
|
buffered: !0,
|
|
2137
2154
|
durationThreshold: 40,
|
|
@@ -2139,7 +2156,7 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2139
2156
|
}));
|
|
2140
2157
|
}
|
|
2141
2158
|
a(u), o(u), s(u), e = () => {
|
|
2142
|
-
|
|
2159
|
+
_(), d = void 0, v(), p == null || p.disconnect(), f == null || f.disconnect();
|
|
2143
2160
|
};
|
|
2144
2161
|
})();
|
|
2145
2162
|
},
|
|
@@ -2147,7 +2164,7 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2147
2164
|
t = !0, e == null || e(), e = void 0;
|
|
2148
2165
|
}
|
|
2149
2166
|
};
|
|
2150
|
-
},
|
|
2167
|
+
}, rr = (e, t) => {
|
|
2151
2168
|
let n = {
|
|
2152
2169
|
"network.protocol.name": "websocket",
|
|
2153
2170
|
"url.full": t(e)
|
|
@@ -2157,20 +2174,20 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2157
2174
|
n["server.address"] = t.hostname, t.port && (n["server.port"] = Number(t.port)), n["url.scheme"] = t.protocol.replace(":", "");
|
|
2158
2175
|
} catch (e) {}
|
|
2159
2176
|
return n;
|
|
2160
|
-
},
|
|
2161
|
-
let a = h("websocket"), o =
|
|
2177
|
+
}, ir = (t, n, r, i) => {
|
|
2178
|
+
let a = h("websocket"), o = rr(r, n.config.hooks.redactUrl), s = !1, c = (t, r, s = {}) => {
|
|
2162
2179
|
if (i() || !n.isSampled()) return;
|
|
2163
2180
|
let c = t === "error";
|
|
2164
|
-
n.startSpan("browser.websocket",
|
|
2181
|
+
n.startSpan("browser.websocket", S(S(S({}, o), N({
|
|
2165
2182
|
errorType: c ? "network" : "none",
|
|
2166
2183
|
result: c ? j.error : j.success,
|
|
2167
2184
|
spanSubtype: t,
|
|
2168
2185
|
spanType: M.websocket
|
|
2169
2186
|
})), {}, {
|
|
2170
|
-
[
|
|
2171
|
-
[
|
|
2172
|
-
[
|
|
2173
|
-
[
|
|
2187
|
+
[g.eventId]: h("event"),
|
|
2188
|
+
[g.eventPhase]: t,
|
|
2189
|
+
[g.eventTimestamp]: r,
|
|
2190
|
+
[g.eventType]: "websocket",
|
|
2174
2191
|
"websocket.connection.id": a
|
|
2175
2192
|
}, s), {
|
|
2176
2193
|
kind: e.CLIENT,
|
|
@@ -2188,7 +2205,7 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2188
2205
|
"websocket.close.was_clean": e.wasClean
|
|
2189
2206
|
});
|
|
2190
2207
|
});
|
|
2191
|
-
},
|
|
2208
|
+
}, ar = () => {
|
|
2192
2209
|
let e, t, n = !1;
|
|
2193
2210
|
return {
|
|
2194
2211
|
name: "websocket",
|
|
@@ -2199,35 +2216,35 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2199
2216
|
let a = Reflect.construct(e, t, i);
|
|
2200
2217
|
if (n || !r.isSampled()) return a;
|
|
2201
2218
|
let o = t[0] == null ? "" : String(t[0]);
|
|
2202
|
-
return o && !k(r.config, o) &&
|
|
2219
|
+
return o && !k(r.config, o) && ir(a, r, o, () => n), a;
|
|
2203
2220
|
} }), window.WebSocket = t;
|
|
2204
2221
|
},
|
|
2205
2222
|
shutdown() {
|
|
2206
2223
|
n = !0, typeof window < "u" && e && window.WebSocket === t && (window.WebSocket = e), t = void 0, e = void 0;
|
|
2207
2224
|
}
|
|
2208
2225
|
};
|
|
2209
|
-
},
|
|
2226
|
+
}, or = class {
|
|
2210
2227
|
constructor() {
|
|
2211
|
-
|
|
2228
|
+
b(this, "listeners", /* @__PURE__ */ new Set()), b(this, "notify", (e) => {
|
|
2212
2229
|
this.listeners.forEach((t) => t(e));
|
|
2213
|
-
}),
|
|
2230
|
+
}), b(this, "subscribe", (e) => (this.listeners.add(e), () => this.listeners.delete(e)));
|
|
2214
2231
|
}
|
|
2215
|
-
},
|
|
2232
|
+
}, sr = (e) => ({
|
|
2216
2233
|
url: e.endpoint,
|
|
2217
2234
|
headers: e.headers,
|
|
2218
2235
|
concurrencyLimit: e.concurrencyLimit,
|
|
2219
2236
|
timeoutMillis: e.timeoutMillis
|
|
2220
|
-
}),
|
|
2237
|
+
}), cr = "bk-rum", lr = class {
|
|
2221
2238
|
constructor(e) {
|
|
2222
2239
|
this.isSampled = e;
|
|
2223
2240
|
}
|
|
2224
2241
|
shouldSample() {
|
|
2225
|
-
return { decision: this.isSampled() ?
|
|
2242
|
+
return { decision: this.isSampled() ? u.RECORD_AND_SAMPLED : u.NOT_RECORD };
|
|
2226
2243
|
}
|
|
2227
2244
|
toString() {
|
|
2228
2245
|
return "RumSessionSampler";
|
|
2229
2246
|
}
|
|
2230
|
-
}, Q,
|
|
2247
|
+
}, Q, ur = () => {
|
|
2231
2248
|
if (Q) Q.users += 1;
|
|
2232
2249
|
else {
|
|
2233
2250
|
let e = new a().enable(), t = n.setGlobalContextManager(e);
|
|
@@ -2242,28 +2259,28 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2242
2259
|
return () => {
|
|
2243
2260
|
e || !Q || (e = !0, --Q.users, !(Q.users > 0) && (Q.ownsContext && n.disable(), Q.ownsPropagator && r.disable(), Q = void 0));
|
|
2244
2261
|
};
|
|
2245
|
-
},
|
|
2262
|
+
}, dr = (e, t) => t ? new Proxy(e, { get(e, t, n) {
|
|
2246
2263
|
if (t === "export") return (t, n) => {
|
|
2247
2264
|
var r;
|
|
2248
2265
|
return (r = globalThis.console) == null || r.log("[bk-ot][rum]", t), e.export(t, n);
|
|
2249
2266
|
};
|
|
2250
2267
|
let r = Reflect.get(e, t, n);
|
|
2251
2268
|
return typeof r == "function" ? r.bind(e) : r;
|
|
2252
|
-
} }) : e,
|
|
2253
|
-
|
|
2254
|
-
...$(e.tracking.device, !0,
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
zt(
|
|
2258
|
-
],
|
|
2269
|
+
} }) : e, fr = (e) => [Qt(e.tracking.request)], pr = (e) => [
|
|
2270
|
+
Bn(e.session),
|
|
2271
|
+
...$(e.tracking.device, !0, ce),
|
|
2272
|
+
ft(),
|
|
2273
|
+
En(),
|
|
2274
|
+
zt(mr(e.tracking.resource, !0))
|
|
2275
|
+
], mr = (e, t) => e === void 0 ? t : e !== !1, hr = (e) => typeof e == "object" && e ? e : void 0, $ = (e, t, n) => mr(e, t) ? [n(hr(e))] : [], gr = (e) => [
|
|
2259
2276
|
...$(e.error, !0, on),
|
|
2260
|
-
...$(e.webVitals, !0,
|
|
2261
|
-
...$(e.blankScreen, !0,
|
|
2262
|
-
...$(e.action, !0,
|
|
2263
|
-
...$(e.websocket, !1,
|
|
2264
|
-
...$(e.longTask, !1,
|
|
2277
|
+
...$(e.webVitals, !0, nr),
|
|
2278
|
+
...$(e.blankScreen, !0, Dt),
|
|
2279
|
+
...$(e.action, !0, lt),
|
|
2280
|
+
...$(e.websocket, !1, ar),
|
|
2281
|
+
...$(e.longTask, !1, dn),
|
|
2265
2282
|
...$(e.cspViolation, !1, tn)
|
|
2266
|
-
],
|
|
2283
|
+
], _r = class {
|
|
2267
2284
|
assertBeforeStart(e) {
|
|
2268
2285
|
if (this.phase !== "idle") throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`);
|
|
2269
2286
|
}
|
|
@@ -2293,20 +2310,20 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2293
2310
|
}
|
|
2294
2311
|
createPluginManager() {
|
|
2295
2312
|
var e;
|
|
2296
|
-
return new
|
|
2297
|
-
...mr(this.config),
|
|
2313
|
+
return new Ce([
|
|
2298
2314
|
...pr(this.config),
|
|
2299
|
-
...
|
|
2315
|
+
...fr(this.config),
|
|
2316
|
+
...gr(this.config.tracking),
|
|
2300
2317
|
...(e = this.config.extensions.plugins) == null ? [] : e
|
|
2301
2318
|
]);
|
|
2302
2319
|
}
|
|
2303
2320
|
constructor(n) {
|
|
2304
2321
|
var r = this;
|
|
2305
|
-
|
|
2322
|
+
b(this, "activityObserver", new or()), b(this, "flushProviders", E(function* () {
|
|
2306
2323
|
yield r.tracerProvider.forceFlush();
|
|
2307
|
-
})),
|
|
2324
|
+
})), b(this, "phase", "idle"), b(this, "pluginManager", void 0), b(this, "registeredInstrumentations", void 0), b(this, "releaseOtelGlobals", void 0), b(this, "runtimeContext", void 0), b(this, "sampled", !1), b(this, "startCollection", E(function* () {
|
|
2308
2325
|
if (r.pluginManager || !r.config.enabled || r.config.trackingConsent !== "granted") return;
|
|
2309
|
-
r.releaseOtelGlobals =
|
|
2326
|
+
r.releaseOtelGlobals = ur();
|
|
2310
2327
|
let e = r.createPluginManager();
|
|
2311
2328
|
r.pluginManager = e;
|
|
2312
2329
|
try {
|
|
@@ -2317,47 +2334,46 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2317
2334
|
for (yield e.shutdown(), r.pluginManager = void 0; r.registeredInstrumentations.length;) (n = r.registeredInstrumentations.pop()) == null || (i = n.disable) == null || i.call(n);
|
|
2318
2335
|
throw (a = r.releaseOtelGlobals) == null || a.call(r), r.releaseOtelGlobals = void 0, t;
|
|
2319
2336
|
}
|
|
2320
|
-
})),
|
|
2337
|
+
})), b(this, "stopCollection", function() {
|
|
2321
2338
|
var e = E(function* (e) {
|
|
2322
2339
|
var t, n, i;
|
|
2323
2340
|
let a = r.pluginManager;
|
|
2324
2341
|
if (a) {
|
|
2325
2342
|
for (yield a.shutdown(), r.pluginManager = void 0; r.registeredInstrumentations.length;) (t = r.registeredInstrumentations.pop()) == null || (n = t.disable) == null || n.call(t);
|
|
2326
2343
|
r.setRuntimeAttributes({
|
|
2327
|
-
[
|
|
2328
|
-
[
|
|
2344
|
+
[g.sessionHasReplay]: void 0,
|
|
2345
|
+
[g.sessionId]: void 0
|
|
2329
2346
|
}), e && (yield r.flushProviders()), (i = r.releaseOtelGlobals) == null || i.call(r), r.releaseOtelGlobals = void 0;
|
|
2330
2347
|
}
|
|
2331
2348
|
});
|
|
2332
2349
|
return function(t) {
|
|
2333
2350
|
return e.apply(this, arguments);
|
|
2334
2351
|
};
|
|
2335
|
-
}()),
|
|
2352
|
+
}()), b(this, "teardownCallbacks", []), b(this, "tracerProvider", void 0), b(this, "applyRedact", (e) => this.config.hooks.redactAttributes(e)), b(this, "config", void 0), b(this, "flush", E(function* () {
|
|
2336
2353
|
var e;
|
|
2337
2354
|
yield (e = r.pluginManager) == null ? void 0 : e.flush(), yield r.flushProviders();
|
|
2338
|
-
})),
|
|
2355
|
+
})), b(this, "getRuntimeAttributes", () => this.runtimeContext.getAttributes()), b(this, "getRuntimeAttributesAt", (e) => this.runtimeContext.getAttributesAt(e)), b(this, "isSampled", () => this.sampled), b(this, "isSessionActive", () => this.runtimeContext.isSessionActive()), b(this, "isViewActive", () => this.runtimeContext.isViewActive()), b(this, "notifySessionLifecycle", (e) => {
|
|
2339
2356
|
this.runtimeContext.notifySessionLifecycle(e);
|
|
2340
|
-
}),
|
|
2341
|
-
e.length && (
|
|
2342
|
-
|
|
2343
|
-
tracerProvider: this.tracerProvider
|
|
2357
|
+
}), b(this, "onSessionLifecycle", (e) => this.runtimeContext.onSessionLifecycle(e)), b(this, "registerInstrumentations", (e) => {
|
|
2358
|
+
e.length && (e.forEach((e) => {
|
|
2359
|
+
e.setTracerProvider(this.tracerProvider), e.getConfig().enabled || e.enable();
|
|
2344
2360
|
}), this.registeredInstrumentations.push(...e));
|
|
2345
|
-
}),
|
|
2361
|
+
}), b(this, "reportAction", ({ attributes: e = {}, name: t }) => {
|
|
2346
2362
|
if (!this.isSampled()) return;
|
|
2347
2363
|
let n = h("action"), r = Date.now();
|
|
2348
|
-
this.startSpan("action.custom",
|
|
2364
|
+
this.startSpan("action.custom", S(S(S(S({}, this.config.hooks.getPageAttributes()), e), N({
|
|
2349
2365
|
errorType: "none",
|
|
2350
2366
|
spanSubtype: "custom",
|
|
2351
2367
|
spanType: M.action
|
|
2352
2368
|
})), {}, {
|
|
2353
|
-
[
|
|
2354
|
-
[
|
|
2355
|
-
[
|
|
2356
|
-
[
|
|
2357
|
-
[
|
|
2358
|
-
[
|
|
2369
|
+
[g.actionId]: n,
|
|
2370
|
+
[g.actionName]: t,
|
|
2371
|
+
[g.actionType]: "custom",
|
|
2372
|
+
[g.eventId]: h("event"),
|
|
2373
|
+
[g.eventTimestamp]: r,
|
|
2374
|
+
[g.eventType]: "action"
|
|
2359
2375
|
}), { startTime: r }).end(r);
|
|
2360
|
-
}),
|
|
2376
|
+
}), b(this, "reportCustomEvent", ({ attributes: e = {}, error: n, name: r }) => {
|
|
2361
2377
|
if (!this.isSampled()) {
|
|
2362
2378
|
if (this.config.debug) {
|
|
2363
2379
|
var i;
|
|
@@ -2365,48 +2381,48 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2365
2381
|
}
|
|
2366
2382
|
return;
|
|
2367
2383
|
}
|
|
2368
|
-
let a = Date.now(), o = this.startSpan(`custom.${r}`,
|
|
2384
|
+
let a = Date.now(), o = this.startSpan(`custom.${r}`, S(S(S(S(S({}, this.config.hooks.getPageAttributes()), this.config.hooks.getCustomAttributes()), N({
|
|
2369
2385
|
errorType: n ? "custom" : "none",
|
|
2370
2386
|
result: n ? j.error : j.success,
|
|
2371
2387
|
spanSubtype: r,
|
|
2372
2388
|
spanType: M.custom
|
|
2373
2389
|
})), e), {}, {
|
|
2374
|
-
[
|
|
2375
|
-
[
|
|
2376
|
-
[
|
|
2390
|
+
[g.eventId]: h("event"),
|
|
2391
|
+
[g.eventTimestamp]: a,
|
|
2392
|
+
[g.eventType]: "custom",
|
|
2377
2393
|
"rum.custom.name": r
|
|
2378
2394
|
}), { startTime: a });
|
|
2379
2395
|
n && (o.recordException(n), o.setStatus({
|
|
2380
2396
|
code: t.ERROR,
|
|
2381
2397
|
message: n.message
|
|
2382
2398
|
})), o.end(a);
|
|
2383
|
-
}),
|
|
2384
|
-
let n =
|
|
2385
|
-
if (
|
|
2386
|
-
let t = e[
|
|
2387
|
-
this.sampled = this.config.enabled && typeof t == "string" && t.length > 0 ?
|
|
2399
|
+
}), b(this, "setRuntimeAttributes", (e, t) => {
|
|
2400
|
+
let n = S({}, e);
|
|
2401
|
+
if (g.sessionId in e) {
|
|
2402
|
+
let t = e[g.sessionId];
|
|
2403
|
+
this.sampled = this.config.enabled && typeof t == "string" && t.length > 0 ? Te(this.config, t) : !1, n[D] = this.sampled;
|
|
2388
2404
|
}
|
|
2389
2405
|
this.runtimeContext.setAttributes(n, t);
|
|
2390
|
-
}),
|
|
2406
|
+
}), b(this, "setTrackingConsent", function() {
|
|
2391
2407
|
var e = E(function* (e) {
|
|
2392
2408
|
r.config.trackingConsent !== e && (r.config.trackingConsent = e, r.phase === "started" && (e === "granted" ? yield r.startCollection() : yield r.stopCollection(!0)));
|
|
2393
2409
|
});
|
|
2394
2410
|
return function(t) {
|
|
2395
2411
|
return e.apply(this, arguments);
|
|
2396
2412
|
};
|
|
2397
|
-
}()),
|
|
2413
|
+
}()), b(this, "setUser", (e) => {
|
|
2398
2414
|
this.runtimeContext.setUser(e);
|
|
2399
|
-
}),
|
|
2415
|
+
}), b(this, "setViewLoadingTime", () => {
|
|
2400
2416
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
2401
2417
|
time: Date.now(),
|
|
2402
2418
|
type: "set_loading_time"
|
|
2403
2419
|
});
|
|
2404
|
-
}),
|
|
2420
|
+
}), b(this, "setViewName", (e) => {
|
|
2405
2421
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
2406
2422
|
name: e,
|
|
2407
2423
|
type: "set_name"
|
|
2408
2424
|
});
|
|
2409
|
-
}),
|
|
2425
|
+
}), b(this, "shutdown", E(function* () {
|
|
2410
2426
|
if (r.phase !== "stopped") {
|
|
2411
2427
|
for (yield r.stopCollection(!1), yield r.flushProviders(); r.teardownCallbacks.length;) {
|
|
2412
2428
|
var e;
|
|
@@ -2414,7 +2430,7 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2414
2430
|
}
|
|
2415
2431
|
yield r.tracerProvider.shutdown(), r.phase = "stopped";
|
|
2416
2432
|
}
|
|
2417
|
-
})),
|
|
2433
|
+
})), b(this, "start", E(function* () {
|
|
2418
2434
|
if (!(r.phase === "started" || r.phase === "starting")) {
|
|
2419
2435
|
if (r.phase === "stopped") throw Error("[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.");
|
|
2420
2436
|
if (!r.config.enabled) {
|
|
@@ -2440,40 +2456,40 @@ var bn = ["stopLoadingTime"], xn = new Set([...Object.values(_), D]), Sn = () =>
|
|
|
2440
2456
|
}
|
|
2441
2457
|
r.phase = "started";
|
|
2442
2458
|
}
|
|
2443
|
-
})),
|
|
2459
|
+
})), b(this, "startSpan", (t, n = {}, r) => {
|
|
2444
2460
|
var i, a;
|
|
2445
2461
|
if (!this.isSampled()) return this.tracer.startSpan(t);
|
|
2446
2462
|
let o = (i = r == null ? void 0 : r.contextTime) == null ? typeof (r == null ? void 0 : r.startTime) == "number" ? r.startTime : void 0 : i, s = o === void 0 ? this.getRuntimeAttributes() : this.runtimeContext.getAttributesAt(o);
|
|
2447
2463
|
return this.tracer.startSpan(t, {
|
|
2448
2464
|
kind: (a = r == null ? void 0 : r.kind) == null ? e.INTERNAL : a,
|
|
2449
2465
|
startTime: r == null ? void 0 : r.startTime,
|
|
2450
|
-
attributes: this.applyRedact(
|
|
2466
|
+
attributes: this.applyRedact(S(S({}, s), n))
|
|
2451
2467
|
});
|
|
2452
|
-
}),
|
|
2468
|
+
}), b(this, "startView", (e = {}) => {
|
|
2453
2469
|
this.isSampled() && this.runtimeContext.dispatchViewCommand({
|
|
2454
2470
|
options: e,
|
|
2455
2471
|
type: "start"
|
|
2456
2472
|
});
|
|
2457
|
-
}),
|
|
2473
|
+
}), b(this, "tracer", void 0), b(this, "use", (e) => {
|
|
2458
2474
|
var t;
|
|
2459
2475
|
return this.assertBeforeStart("use"), (t = this.config.extensions.plugins) == null || t.push(e), this;
|
|
2460
|
-
}),
|
|
2476
|
+
}), b(this, "useInstrumentation", (e) => {
|
|
2461
2477
|
var t;
|
|
2462
2478
|
return this.assertBeforeStart("useInstrumentation"), this.config.enabled && ((t = this.config.extensions.instrumentations) == null || t.push(e)), this;
|
|
2463
|
-
}), this.config =
|
|
2464
|
-
let i =
|
|
2465
|
-
let e =
|
|
2466
|
-
return [new
|
|
2479
|
+
}), this.config = ye(n), this.runtimeContext = new He({ [D]: !1 }, this.config.user);
|
|
2480
|
+
let i = c(this.config.resourceAttributes), a = (() => {
|
|
2481
|
+
let e = dr(new s(sr(this.config.transport)), this.config.debug);
|
|
2482
|
+
return [new Be(this.config.spanProcessor === "simple" ? new d(e) : new l(e, this.config.spanBatch), this.config, () => this.applyRedact(S(S({}, this.runtimeContext.getAttributes()), this.config.hooks.getPageAttributes())))];
|
|
2467
2483
|
})();
|
|
2468
|
-
this.tracerProvider = new
|
|
2484
|
+
this.tracerProvider = new f({
|
|
2469
2485
|
resource: i,
|
|
2470
|
-
sampler: new
|
|
2486
|
+
sampler: new lr(this.isSampled),
|
|
2471
2487
|
spanProcessors: a
|
|
2472
|
-
}), this.tracer = this.tracerProvider.getTracer(
|
|
2488
|
+
}), this.tracer = this.tracerProvider.getTracer(cr), this.registeredInstrumentations = [], this.config.autoStart && this.start().catch((e) => {
|
|
2473
2489
|
var t;
|
|
2474
2490
|
(t = globalThis.console) == null || t.warn("[bk-ot] auto start failed:", e);
|
|
2475
2491
|
});
|
|
2476
2492
|
}
|
|
2477
2493
|
};
|
|
2478
2494
|
//#endregion
|
|
2479
|
-
export {
|
|
2495
|
+
export { _r as BkOpenTelemetry, ut as EXCLUDED_ACTIVITY_MUTATIONS_ATTRIBUTE, Be as FilteringSpanProcessor, g as RUM_ATTRIBUTES, j as RUM_SPAN_RESULT, M as RUM_SPAN_TYPE, He as RumRuntimeContext, N as buildRumSpanAttributes, lt as createActionPlugin, Dt as createBlankScreenPlugin, Qt as createCommonInstrumentationsPlugin, tn as createCspViolationPlugin, ce as createDevicePlugin, on as createErrorPlugin, dn as createLongTaskPlugin, Se as createPlugin, zt as createResourcePlugin, Bn as createSessionPlugin, ar as createWebSocketPlugin, nr as createWebVitalsPlugin, ye as resolveConfig };
|