@blueking/open-telemetry 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -24
- package/dist/bk-rum.global.js +1 -1
- package/dist/bk-rum.global.js.map +1 -1
- package/dist/index.js +368 -357
- package/dist/index.js.map +1 -1
- package/dist/schema/attributes.d.ts +1 -0
- package/package.json +1 -1
- package/skills/bk-rum-otele/references/actions.md +16 -10
- package/skills/bk-rum-otele/references/api.md +5 -2
- package/skills/bk-rum-otele/references/architecture.md +2 -2
- package/skills/bk-rum-otele/references/blank-screen.md +8 -17
- package/skills/bk-rum-otele/references/capabilities.md +2 -2
- package/skills/bk-rum-otele/references/configuration.md +4 -4
- package/skills/bk-rum-otele/references/data-model.md +14 -14
- package/skills/bk-rum-otele/references/errors-security.md +5 -4
- package/skills/bk-rum-otele/references/extensions.md +8 -0
- package/skills/bk-rum-otele/references/framework-integration.md +1 -1
- package/skills/bk-rum-otele/references/getting-started.md +19 -1
- package/skills/bk-rum-otele/references/network.md +22 -19
- package/skills/bk-rum-otele/references/performance.md +12 -23
- package/skills/bk-rum-otele/references/privacy.md +2 -2
- package/skills/bk-rum-otele/references/session-context.md +13 -9
- package/skills/bk-rum-otele/references/span-protocol.md +265 -100
- package/skills/bk-rum-otele/references/telemetry-reference.md +75 -79
- package/skills/bk-rum-otele/references/transport-sampling.md +18 -13
- package/skills/bk-rum-otele/references/troubleshooting.md +1 -1
- package/skills/bk-rum-otele/references/views-routing.md +5 -3
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { resourceFromAttributes as c } from "@opentelemetry/resources";
|
|
|
6
6
|
import { BatchSpanProcessor as l, SamplingDecision as u, SimpleSpanProcessor as d } from "@opentelemetry/sdk-trace-base";
|
|
7
7
|
import { WebTracerProvider as f } from "@opentelemetry/sdk-trace-web";
|
|
8
8
|
//#region package.json
|
|
9
|
-
var p = "0.0.
|
|
9
|
+
var p = "0.0.32", m = (e) => {
|
|
10
10
|
let t = 5381;
|
|
11
11
|
for (let n = 0; n < e.length; n++) t = t * 33 ^ e.charCodeAt(n);
|
|
12
12
|
return (t >>> 0).toString(36);
|
|
@@ -52,6 +52,7 @@ var p = "0.0.30", m = (e) => {
|
|
|
52
52
|
viewName: "view.name",
|
|
53
53
|
viewPhase: "view.phase",
|
|
54
54
|
viewPrevious: "view.previous",
|
|
55
|
+
viewPreviousUrlTemplate: "view.previous_url_template",
|
|
55
56
|
viewReferrer: "view.referrer",
|
|
56
57
|
viewStartedAt: "view.started_at",
|
|
57
58
|
viewUrl: "view.url",
|
|
@@ -223,22 +224,22 @@ var C = "BK_RUM_DEVICE_ID", w = 250, T = () => navigator.connection, ee = () =>
|
|
|
223
224
|
}, ue = /^(?:\d+|[0-9a-f]{8}-[0-9a-f-]{27,}|[0-9a-f]{16,})$/i, de = (e) => e.split(/[?#]/, 1)[0].split("/").map((e) => ue.test(e) ? ":id" : e).join("/"), fe = (e) => e.length > 1 ? e.replace(/\/+$/, "") : e, pe = (e, t) => {
|
|
224
225
|
let n = (e) => fe(e.replace(/[?#].*$/, ""));
|
|
225
226
|
return n(e) === n(t);
|
|
226
|
-
}, me = (e, t) => pe(E(t), E(e.transport.endpoint)),
|
|
227
|
+
}, me = (e, t) => pe(E(t), E(e.transport.endpoint)), D = (e, t) => me(e, t), he = (e, t) => typeof e == "function" ? e(t) : typeof e == "string" ? t.includes(e) : (e.lastIndex = 0, e.test(t)), O = (e, t) => (Array.isArray(e) ? e : e ? [e] : []).some((e) => he(e, t)), ge = (e) => typeof e.tracking.request == "object" ? e.tracking.request : void 0, _e = (e, t) => {
|
|
227
228
|
var n;
|
|
228
|
-
return
|
|
229
|
-
},
|
|
229
|
+
return D(e, t) || O((n = ge(e)) == null ? void 0 : n.excludedUrls, E(t));
|
|
230
|
+
}, ve = (e, t) => {
|
|
230
231
|
var n;
|
|
231
|
-
return
|
|
232
|
-
},
|
|
232
|
+
return O((n = ge(e)) == null ? void 0 : n.allowedTracingUrls, E(t));
|
|
233
|
+
}, ye = (e) => e.trim().replace(/\/+$/, ""), be = (e) => {
|
|
233
234
|
var t;
|
|
234
235
|
let n = e.token || e.headers ? S(S({}, e.token ? { Authorization: `Bearer ${e.token}` } : {}), (t = e.headers) == null ? {} : t) : void 0;
|
|
235
236
|
return {
|
|
236
237
|
concurrencyLimit: e.concurrencyLimit,
|
|
237
|
-
endpoint: `${
|
|
238
|
+
endpoint: `${ye(e.endpoint)}/v1/rum`,
|
|
238
239
|
headers: n,
|
|
239
240
|
timeoutMillis: e.timeoutMillis
|
|
240
241
|
};
|
|
241
|
-
},
|
|
242
|
+
}, xe = (e) => typeof e != "number" || !Number.isFinite(e) ? 1 : Math.max(0, Math.min(1, e)), Se = (e) => e, Ce = (e) => {
|
|
242
243
|
if (!e) return e;
|
|
243
244
|
try {
|
|
244
245
|
let t = new URL(e, typeof location > "u" ? "http://localhost" : location.href);
|
|
@@ -246,13 +247,13 @@ var C = "BK_RUM_DEVICE_ID", w = 250, T = () => navigator.connection, ee = () =>
|
|
|
246
247
|
} catch (t) {
|
|
247
248
|
return e.replace(/[?#].*$/, "");
|
|
248
249
|
}
|
|
249
|
-
},
|
|
250
|
+
}, we = (e) => {
|
|
250
251
|
try {
|
|
251
252
|
return new URL(e, typeof location > "u" ? "http://localhost" : location.href).pathname || "/";
|
|
252
253
|
} catch (t) {
|
|
253
254
|
return e || "/";
|
|
254
255
|
}
|
|
255
|
-
},
|
|
256
|
+
}, Te = (e) => de(we(e)), Ee = (e, t) => (n) => {
|
|
256
257
|
try {
|
|
257
258
|
let e = t == null ? void 0 : t(n);
|
|
258
259
|
if (e) return e;
|
|
@@ -260,40 +261,40 @@ var C = "BK_RUM_DEVICE_ID", w = 250, T = () => navigator.connection, ee = () =>
|
|
|
260
261
|
var r;
|
|
261
262
|
e.debug && ((r = globalThis.console) == null || r.warn("[bk-ot] url template hook failed:", t));
|
|
262
263
|
}
|
|
263
|
-
return
|
|
264
|
-
},
|
|
264
|
+
return Te(n);
|
|
265
|
+
}, De = (e) => {
|
|
265
266
|
var t;
|
|
266
267
|
return {
|
|
267
268
|
environment: (t = e.environment) == null ? "production" : t,
|
|
268
269
|
name: e.name,
|
|
269
270
|
version: e.version
|
|
270
271
|
};
|
|
271
|
-
},
|
|
272
|
+
}, Oe = (e, t, n) => S(S(S({ [g.deploymentEnvironmentName]: e.environment }, t === !1 ? {} : oe()), {}, { [g.serviceName]: e.name }, e.version ? { [g.serviceVersion]: e.version } : {}), {}, {
|
|
272
273
|
[g.sessionSampleRate]: n,
|
|
273
274
|
"telemetry.sdk.language": "webjs",
|
|
274
275
|
"telemetry.sdk.name": "blueking",
|
|
275
276
|
"telemetry.sdk.version": p
|
|
276
|
-
}),
|
|
277
|
+
}), ke = (e) => {
|
|
277
278
|
var t;
|
|
278
279
|
if (!e) throw Error("[bk-ot] transport is required.");
|
|
279
280
|
if (!((t = e.endpoint) != null && t.trim())) throw Error("[bk-ot] transport.endpoint is required.");
|
|
280
|
-
},
|
|
281
|
+
}, Ae = (e) => {
|
|
281
282
|
var t, n, r, i, a, o, s, c, l, u, d, f, p;
|
|
282
283
|
return {
|
|
283
284
|
beforeSend: (t = e.tracking) == null ? void 0 : t.beforeSend,
|
|
284
285
|
getPageAttributes: (n = (r = e.context) == null || (r = r.attributes) == null ? void 0 : r.page) == null ? (() => ({})) : n,
|
|
285
286
|
getErrorAttributes: (i = (a = e.context) == null || (a = a.attributes) == null ? void 0 : a.error) == null ? (() => ({})) : i,
|
|
286
287
|
getCustomAttributes: (o = (s = e.context) == null || (s = s.attributes) == null ? void 0 : s.custom) == null ? (() => ({})) : o,
|
|
287
|
-
getRequestUrlTemplate:
|
|
288
|
-
getViewUrlTemplate:
|
|
289
|
-
redactAttributes: (u = (d = e.privacy) == null ? void 0 : d.redactAttributes) == null ?
|
|
290
|
-
redactUrl: (f = (p = e.privacy) == null ? void 0 : p.redactUrl) == null ?
|
|
288
|
+
getRequestUrlTemplate: Ee(e, typeof ((c = e.tracking) == null ? void 0 : c.request) == "object" ? e.tracking.request.getUrlTemplate : void 0),
|
|
289
|
+
getViewUrlTemplate: Ee(e, typeof ((l = e.tracking) == null ? void 0 : l.view) == "object" ? e.tracking.view.getUrlTemplate : void 0),
|
|
290
|
+
redactAttributes: (u = (d = e.privacy) == null ? void 0 : d.redactAttributes) == null ? Se : u,
|
|
291
|
+
redactUrl: (f = (p = e.privacy) == null ? void 0 : p.redactUrl) == null ? Ce : f
|
|
291
292
|
};
|
|
292
|
-
},
|
|
293
|
+
}, je = (e) => {
|
|
293
294
|
var t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g;
|
|
294
295
|
if (!(!((t = e.application) == null || (t = t.name) == null) && t.trim())) throw Error("[bk-ot] application.name is required.");
|
|
295
|
-
|
|
296
|
-
let _ =
|
|
296
|
+
ke(e.transport);
|
|
297
|
+
let _ = De(e.application), v = typeof ((n = e.tracking) == null ? void 0 : n.view) == "object" ? e.tracking.view : void 0, y = Ae(e), b = xe((r = e.session) == null ? void 0 : r.sampleRate);
|
|
297
298
|
return {
|
|
298
299
|
application: _,
|
|
299
300
|
autoStart: (i = e.autoStart) == null ? !0 : i,
|
|
@@ -304,13 +305,13 @@ var C = "BK_RUM_DEVICE_ID", w = 250, T = () => navigator.connection, ee = () =>
|
|
|
304
305
|
plugins: [...(l = (u = e.extensions) == null ? void 0 : u.plugins) == null ? [] : l]
|
|
305
306
|
},
|
|
306
307
|
hooks: y,
|
|
307
|
-
resourceAttributes: y.redactAttributes(
|
|
308
|
+
resourceAttributes: y.redactAttributes(Oe(_, (d = e.tracking) == null ? void 0 : d.device, b)),
|
|
308
309
|
session: S(S({}, e.session), {}, { sampleRate: b }),
|
|
309
310
|
spanBatch: e.transport.batch,
|
|
310
311
|
spanProcessor: (f = e.transport.processor) == null ? "batch" : f,
|
|
311
312
|
tracking: (p = e.tracking) == null ? {} : p,
|
|
312
313
|
trackingConsent: (m = (h = e.privacy) == null ? void 0 : h.trackingConsent) == null ? "granted" : m,
|
|
313
|
-
transport:
|
|
314
|
+
transport: be(e.transport),
|
|
314
315
|
user: (g = e.context) == null ? void 0 : g.user,
|
|
315
316
|
view: {
|
|
316
317
|
excludedActivityUrls: v == null ? void 0 : v.excludedActivityUrls,
|
|
@@ -321,7 +322,7 @@ var C = "BK_RUM_DEVICE_ID", w = 250, T = () => navigator.connection, ee = () =>
|
|
|
321
322
|
};
|
|
322
323
|
//#endregion
|
|
323
324
|
//#region \0@oxc-project+runtime@0.128.0/helpers/asyncToGenerator.js
|
|
324
|
-
function
|
|
325
|
+
function Me(e, t, n, r, i, a, o) {
|
|
325
326
|
try {
|
|
326
327
|
var s = e[a](o), c = s.value;
|
|
327
328
|
} catch (e) {
|
|
@@ -330,16 +331,16 @@ function Ne(e, t, n, r, i, a, o) {
|
|
|
330
331
|
}
|
|
331
332
|
s.done ? t(c) : Promise.resolve(c).then(r, i);
|
|
332
333
|
}
|
|
333
|
-
function
|
|
334
|
+
function k(e) {
|
|
334
335
|
return function() {
|
|
335
336
|
var t = this, n = arguments;
|
|
336
337
|
return new Promise(function(r, i) {
|
|
337
338
|
var a = e.apply(t, n);
|
|
338
339
|
function o(e) {
|
|
339
|
-
|
|
340
|
+
Me(a, r, i, o, s, "next", e);
|
|
340
341
|
}
|
|
341
342
|
function s(e) {
|
|
342
|
-
|
|
343
|
+
Me(a, r, i, o, s, "throw", e);
|
|
343
344
|
}
|
|
344
345
|
o(void 0);
|
|
345
346
|
});
|
|
@@ -347,13 +348,13 @@ function O(e) {
|
|
|
347
348
|
}
|
|
348
349
|
//#endregion
|
|
349
350
|
//#region src/core/plugin.ts
|
|
350
|
-
var
|
|
351
|
+
var Ne = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !== !1, Pe = (e) => e, Fe = class {
|
|
351
352
|
constructor(e) {
|
|
352
353
|
b(this, "plugins", void 0), b(this, "startedPlugins", []), this.plugins = e;
|
|
353
354
|
}
|
|
354
355
|
flush() {
|
|
355
356
|
var e = this;
|
|
356
|
-
return
|
|
357
|
+
return k(function* () {
|
|
357
358
|
yield Promise.all(e.startedPlugins.map((e) => Promise.resolve().then(() => {
|
|
358
359
|
var t;
|
|
359
360
|
return (t = e.flush) == null ? void 0 : t.call(e);
|
|
@@ -362,7 +363,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
362
363
|
}
|
|
363
364
|
shutdown() {
|
|
364
365
|
var e = this;
|
|
365
|
-
return
|
|
366
|
+
return k(function* () {
|
|
366
367
|
let t = [...e.startedPlugins].reverse();
|
|
367
368
|
for (let e of t) {
|
|
368
369
|
var n;
|
|
@@ -373,8 +374,8 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
373
374
|
}
|
|
374
375
|
start(e) {
|
|
375
376
|
var t = this;
|
|
376
|
-
return
|
|
377
|
-
for (let r of t.plugins) if (
|
|
377
|
+
return k(function* () {
|
|
378
|
+
for (let r of t.plugins) if (Ne(r, e.config)) try {
|
|
378
379
|
yield r.init(e), t.startedPlugins.push(r);
|
|
379
380
|
} catch (t) {
|
|
380
381
|
if (e.config.debug) {
|
|
@@ -384,21 +385,21 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
384
385
|
}
|
|
385
386
|
})();
|
|
386
387
|
}
|
|
387
|
-
},
|
|
388
|
-
|
|
389
|
-
},
|
|
390
|
-
for (let n of
|
|
388
|
+
}, Ie = ["http.url", "url.full"], Le = /* @__PURE__ */ new WeakSet(), Re = (e) => {
|
|
389
|
+
Le.add(e);
|
|
390
|
+
}, ze = (e) => {
|
|
391
|
+
for (let n of Ie) {
|
|
391
392
|
var t;
|
|
392
393
|
let r = (t = e.attributes) == null ? void 0 : t[n];
|
|
393
394
|
if (typeof r == "string") return r;
|
|
394
395
|
}
|
|
395
|
-
},
|
|
396
|
+
}, Be = (e) => {
|
|
396
397
|
let t = e == null ? void 0 : e[g.sessionId];
|
|
397
398
|
return typeof t == "string" && t.length > 0;
|
|
398
|
-
},
|
|
399
|
+
}, Ve = (e) => {
|
|
399
400
|
let t = e == null ? void 0 : e[g.viewId];
|
|
400
401
|
return typeof t == "string" && t.length > 0;
|
|
401
|
-
},
|
|
402
|
+
}, He = (e) => Be(e) && Ve(e), Ue = class {
|
|
402
403
|
constructor(e, t, n) {
|
|
403
404
|
this.inner = e, this.config = t, this.getRuntimeAttributes = n;
|
|
404
405
|
}
|
|
@@ -406,8 +407,8 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
406
407
|
return this.inner.forceFlush();
|
|
407
408
|
}
|
|
408
409
|
onEnd(e) {
|
|
409
|
-
let t =
|
|
410
|
-
if (!(
|
|
410
|
+
let t = ze(e);
|
|
411
|
+
if (!(Le.delete(e) || t && me(this.config, t) || !He(e.attributes) && !(e.name === "browser.session" && Be(e.attributes)))) {
|
|
411
412
|
try {
|
|
412
413
|
var n, r;
|
|
413
414
|
if (((n = this.config.hooks) == null || (r = n.beforeSend) == null ? void 0 : r.call(n, {
|
|
@@ -431,7 +432,13 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
431
432
|
shutdown() {
|
|
432
433
|
return this.inner.shutdown();
|
|
433
434
|
}
|
|
434
|
-
},
|
|
435
|
+
}, We = new Set(Object.values(g)), Ge = (e) => {
|
|
436
|
+
if (typeof e == "string" && e.length > 0) return e;
|
|
437
|
+
if (Array.isArray(e)) for (let t = e.length - 1; t >= 0; --t) {
|
|
438
|
+
let n = e[t];
|
|
439
|
+
if (typeof n == "string" && n.length > 0) return n;
|
|
440
|
+
}
|
|
441
|
+
}, Ke = class {
|
|
435
442
|
constructor(e = {}, t) {
|
|
436
443
|
b(this, "actionHistory", []), b(this, "attributes", {}), b(this, "queuedViewCommands", []), b(this, "recordAssociation", (e, t, n, r) => {
|
|
437
444
|
let i = e.at(-1);
|
|
@@ -484,8 +491,8 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
484
491
|
this.attributes[t] = n;
|
|
485
492
|
}
|
|
486
493
|
if (g.sessionId in e && this.recordAssociation(this.sessionHistory, [g.sessionId, g.sessionHasReplay], t, typeof this.attributes[g.sessionId] == "string"), g.actionId in e) {
|
|
487
|
-
let e = this.attributes[g.actionId];
|
|
488
|
-
this.recordAssociation(this.actionHistory, [g.actionId], t,
|
|
494
|
+
let e = Ge(this.attributes[g.actionId]);
|
|
495
|
+
e === void 0 ? delete this.attributes[g.actionId] : this.attributes[g.actionId] = e, this.recordAssociation(this.actionHistory, [g.actionId], t, typeof this.attributes[g.actionId] == "string");
|
|
489
496
|
}
|
|
490
497
|
}), b(this, "setUser", (e) => {
|
|
491
498
|
if (this.user = S(S({}, this.user), e), "id" in e) {
|
|
@@ -506,7 +513,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
506
513
|
var n;
|
|
507
514
|
this.viewAttributeKeys.forEach((e) => delete this.attributes[e]), this.viewAttributeKeys.clear();
|
|
508
515
|
let r = {};
|
|
509
|
-
for (let [t, i] of Object.entries((n = e.attributes) == null ? {} : n)) i === void 0 ||
|
|
516
|
+
for (let [t, i] of Object.entries((n = e.attributes) == null ? {} : n)) i === void 0 || We.has(t) || (r[t] = i, this.attributes[t] = i, this.viewAttributeKeys.add(t), this.viewScopedAttributeKeys.add(t));
|
|
510
517
|
this.view = S(S({}, e), {}, { attributes: r }), this.setOptionalAttribute(g.viewId, e.id), this.setOptionalAttribute(g.viewUrl, e.url), this.setOptionalAttribute(g.viewUrlTemplate, e.urlTemplate), this.setOptionalAttribute(g.viewLoadingType, e.loadingType), this.setOptionalAttribute(g.viewName, e.name), [
|
|
511
518
|
g.viewId,
|
|
512
519
|
g.viewUrl,
|
|
@@ -516,13 +523,13 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
516
523
|
].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()));
|
|
517
524
|
}), this.setAttributes(e), t && this.setUser(t);
|
|
518
525
|
}
|
|
519
|
-
},
|
|
526
|
+
}, A = {
|
|
520
527
|
abort: "abort",
|
|
521
528
|
error: "error",
|
|
522
529
|
success: "success",
|
|
523
530
|
timeout: "timeout",
|
|
524
531
|
warning: "warning"
|
|
525
|
-
},
|
|
532
|
+
}, j = {
|
|
526
533
|
action: "action",
|
|
527
534
|
custom: "custom",
|
|
528
535
|
error: "error",
|
|
@@ -532,7 +539,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
532
539
|
vital: "vital",
|
|
533
540
|
view: "view",
|
|
534
541
|
websocket: "websocket"
|
|
535
|
-
}, qe = (e) => e === 408 || e === 504 ?
|
|
542
|
+
}, qe = (e) => e === 408 || e === 504 ? A.timeout : typeof e == "number" && e >= 400 ? A.error : A.success, Je = (e) => e === "good" ? A.success : A.warning, Ye = (e) => {
|
|
536
543
|
if (!e) return {};
|
|
537
544
|
try {
|
|
538
545
|
let t = new URL(e, typeof location > "u" ? "http://localhost" : location.href);
|
|
@@ -543,35 +550,35 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
543
550
|
} catch (e) {
|
|
544
551
|
return {};
|
|
545
552
|
}
|
|
546
|
-
},
|
|
553
|
+
}, M = ({ outcome: e = A.success, spanType: t }) => ({
|
|
547
554
|
[g.spanType]: t,
|
|
548
555
|
[g.outcomeType]: e
|
|
549
556
|
}), Xe = ({ initiatorType: e = "other", method: t, outcome: n, url: r }) => {
|
|
550
|
-
let i = Ye(r), a = (n == null ? void 0 : n.type) === "response" && typeof n.statusCode == "number" && n.statusCode > 0 ? n.statusCode : void 0, o = (n == null ? void 0 : n.type) === "abort" ?
|
|
551
|
-
return S(S(S(S(S({},
|
|
557
|
+
let i = Ye(r), a = (n == null ? void 0 : n.type) === "response" && typeof n.statusCode == "number" && n.statusCode > 0 ? n.statusCode : void 0, o = (n == null ? void 0 : n.type) === "abort" ? A.abort : (n == null ? void 0 : n.type) === "timeout" ? A.timeout : (n == null ? void 0 : n.type) === "network_error" ? A.error : typeof a == "number" ? qe(a) : A.success, s = t == null ? void 0 : t.toUpperCase();
|
|
558
|
+
return S(S(S(S(S({}, M({
|
|
552
559
|
outcome: o,
|
|
553
|
-
spanType:
|
|
560
|
+
spanType: j.resource
|
|
554
561
|
})), i.serverAddress ? { "server.address": i.serverAddress } : {}), i.serverPort === void 0 ? {} : { "server.port": i.serverPort }), {}, { "resource.type": e }, s ? { "http.request.method": s } : {}), typeof a == "number" ? { "http.response.status_code": a } : {});
|
|
555
|
-
}, Ze = 100, Qe = 100, $e = 1e3, et = 100, tt = 1e4, nt = "data-bk-action-name", rt = 100, it = 10,
|
|
562
|
+
}, Ze = 100, Qe = 100, $e = 1e3, et = 100, tt = 1e4, nt = "data-bk-action-name", rt = 100, it = 10, at = (e) => e.replace(/\s+/g, " ").trim().slice(0, rt), N = (e) => {
|
|
556
563
|
var t;
|
|
557
564
|
if (e.parentElement) return e.parentElement;
|
|
558
565
|
let n = (t = e.getRootNode) == null ? void 0 : t.call(e);
|
|
559
566
|
return typeof ShadowRoot < "u" && n instanceof ShadowRoot ? n.host : null;
|
|
560
|
-
},
|
|
567
|
+
}, ot = (e, t) => {
|
|
561
568
|
let n = e;
|
|
562
569
|
for (; n;) {
|
|
563
570
|
let e = n.getAttribute(t);
|
|
564
|
-
if (e) return
|
|
571
|
+
if (e) return at(e);
|
|
565
572
|
n = N(n);
|
|
566
573
|
}
|
|
567
|
-
}, ot = (e) => {
|
|
568
|
-
var t;
|
|
569
|
-
return e.isContentEditable ? "" : M((t = e.textContent) == null ? "" : t);
|
|
570
574
|
}, st = (e) => {
|
|
575
|
+
var t;
|
|
576
|
+
return e.isContentEditable ? "" : at((t = e.textContent) == null ? "" : t);
|
|
577
|
+
}, ct = (e) => {
|
|
571
578
|
var t, n;
|
|
572
579
|
let r = e, i = (t = r.labels) == null ? void 0 : t[0];
|
|
573
580
|
if (i) {
|
|
574
|
-
let e =
|
|
581
|
+
let e = st(i);
|
|
575
582
|
if (e) return e;
|
|
576
583
|
}
|
|
577
584
|
let a = e.tagName.toLowerCase(), o = (n = e.getAttribute("type")) == null ? void 0 : n.toLowerCase();
|
|
@@ -581,11 +588,11 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
581
588
|
"submit"
|
|
582
589
|
].includes(o == null ? "" : o)) {
|
|
583
590
|
var s;
|
|
584
|
-
let e =
|
|
591
|
+
let e = at((s = r.value) == null ? "" : s);
|
|
585
592
|
if (e) return e;
|
|
586
593
|
}
|
|
587
594
|
if (a === "button" || a === "label" || e.getAttribute("role") === "button") {
|
|
588
|
-
let t =
|
|
595
|
+
let t = st(e);
|
|
589
596
|
if (t) return t;
|
|
590
597
|
}
|
|
591
598
|
for (let t of [
|
|
@@ -596,18 +603,18 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
596
603
|
"placeholder"
|
|
597
604
|
]) {
|
|
598
605
|
var c;
|
|
599
|
-
let n =
|
|
606
|
+
let n = at((c = e.getAttribute(t)) == null ? "" : c);
|
|
600
607
|
if (n) return n;
|
|
601
608
|
}
|
|
602
|
-
},
|
|
603
|
-
let r =
|
|
609
|
+
}, lt = (e, t = nt, n = !1) => {
|
|
610
|
+
let r = ot(e, t);
|
|
604
611
|
if (r) return r;
|
|
605
612
|
if (!n) return e.tagName.toLowerCase();
|
|
606
613
|
let i = e, a = 0;
|
|
607
614
|
for (; i && a <= it;) {
|
|
608
615
|
let e = i.tagName.toLowerCase();
|
|
609
616
|
if (e === "body" || e === "html" || e === "head") break;
|
|
610
|
-
let t =
|
|
617
|
+
let t = ct(i);
|
|
611
618
|
if (t) return t;
|
|
612
619
|
if (e === "form") break;
|
|
613
620
|
i = N(i), a += 1;
|
|
@@ -615,20 +622,20 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
615
622
|
for (i = e, a = 0; i && a <= it;) {
|
|
616
623
|
let e = i.tagName.toLowerCase();
|
|
617
624
|
if (e === "body" || e === "html" || e === "head") break;
|
|
618
|
-
let t =
|
|
625
|
+
let t = st(i);
|
|
619
626
|
if (t) return t;
|
|
620
627
|
if (e === "form") break;
|
|
621
628
|
i = N(i), a += 1;
|
|
622
629
|
}
|
|
623
630
|
return e.tagName.toLowerCase();
|
|
624
|
-
},
|
|
631
|
+
}, ut = (e) => {
|
|
625
632
|
var t;
|
|
626
633
|
let n = (t = e.composedPath) == null ? void 0 : t.call(e)[0];
|
|
627
634
|
return n instanceof Element ? n : e.target instanceof Element ? e.target : void 0;
|
|
628
|
-
},
|
|
635
|
+
}, dt = (e) => {
|
|
629
636
|
let t = e.timeStamp;
|
|
630
637
|
return !Number.isFinite(t) || t <= 0 ? Date.now() : t > 0xe8d4a51000 ? t : typeof performance > "u" ? Date.now() : performance.timeOrigin + t;
|
|
631
|
-
},
|
|
638
|
+
}, ft = (e, t) => typeof e == "number" && Number.isFinite(e) && e > 0 ? e : t, pt = (e) => {
|
|
632
639
|
let t = e;
|
|
633
640
|
if (t.tagName.toLowerCase() === "label" && t.hasAttribute("for")) {
|
|
634
641
|
var n;
|
|
@@ -651,10 +658,10 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
651
658
|
t = N(t);
|
|
652
659
|
}
|
|
653
660
|
return !1;
|
|
654
|
-
},
|
|
655
|
-
let t = [], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = e.actionNameAttribute || nt, a =
|
|
656
|
-
s == null || s.setRuntimeAttributes({ [g.actionId]:
|
|
657
|
-
}, l = (e) => !e.hadActivity && !e.userActivity.input && !e.userActivity.scroll && !e.userActivity.selection && !
|
|
661
|
+
}, mt = (e = {}) => {
|
|
662
|
+
let t = [], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = e.actionNameAttribute || nt, a = ft(e.maxDuration, tt), o = [], s, c = () => {
|
|
663
|
+
s == null || s.setRuntimeAttributes({ [g.actionId]: [...n.keys()].at(-1) });
|
|
664
|
+
}, l = (e) => !e.hadActivity && !e.userActivity.input && !e.userActivity.scroll && !e.userActivity.selection && !pt(e.target), u = (e) => {
|
|
658
665
|
if (!r.delete(e) || !s || !e.completed) return;
|
|
659
666
|
clearTimeout(e.reportTimer), e.hadError && e.frustrations.add("error_click"), l(e) && e.frustrations.add("dead_click");
|
|
660
667
|
let t = [
|
|
@@ -662,9 +669,9 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
662
669
|
"dead_click",
|
|
663
670
|
"error_click"
|
|
664
671
|
].filter((t) => e.frustrations.has(t)), { endTime: n, hasLoadingTime: i } = e.completed, a = e.hadError || t.length > 0;
|
|
665
|
-
s.startSpan("action.click", S(S(S(S({}, s.config.hooks.getPageAttributes()),
|
|
666
|
-
outcome: a ?
|
|
667
|
-
spanType:
|
|
672
|
+
s.startSpan("action.click", S(S(S(S({}, s.config.hooks.getPageAttributes()), M({
|
|
673
|
+
outcome: a ? A.warning : A.success,
|
|
674
|
+
spanType: j.action
|
|
668
675
|
})), e.runtimeAttributes), {}, {
|
|
669
676
|
[g.actionId]: e.id,
|
|
670
677
|
[g.actionType]: "click",
|
|
@@ -691,7 +698,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
691
698
|
for (let i of n.values()) {
|
|
692
699
|
if (e.type === "request_start") {
|
|
693
700
|
var t;
|
|
694
|
-
if (e.url &&
|
|
701
|
+
if (e.url && O(s == null || (t = s.config.view) == null ? void 0 : t.excludedActivityUrls, e.url) || !_(i, e.time)) continue;
|
|
695
702
|
i.pendingRequests.add(e.id), m(i, e.time);
|
|
696
703
|
continue;
|
|
697
704
|
}
|
|
@@ -702,7 +709,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
702
709
|
}
|
|
703
710
|
if (e.type === "long_task" || e.type === "resource") {
|
|
704
711
|
var r;
|
|
705
|
-
if (e.type === "resource" && e.url &&
|
|
712
|
+
if (e.type === "resource" && e.url && O(s == null || (r = s.config.view) == null ? void 0 : r.excludedActivityUrls, e.url) || e.startTime > i.startTime + a || (e.type === "resource" ? e.startTime < i.startTime : e.endTime < i.startTime)) continue;
|
|
706
713
|
m(i, e.endTime);
|
|
707
714
|
continue;
|
|
708
715
|
}
|
|
@@ -735,9 +742,9 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
735
742
|
passive: !0
|
|
736
743
|
}, p = (t) => {
|
|
737
744
|
if (!l.isSampled() || "button" in t && typeof t.button == "number" && t.button !== 0) return;
|
|
738
|
-
let r =
|
|
745
|
+
let r = ut(t);
|
|
739
746
|
if (!r) return;
|
|
740
|
-
let o =
|
|
747
|
+
let o = dt(t), s = h("action"), u = {
|
|
741
748
|
frustrations: /* @__PURE__ */ new Set(),
|
|
742
749
|
hadActivity: !1,
|
|
743
750
|
hadError: !1,
|
|
@@ -748,7 +755,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
748
755
|
runtimeAttributes: l.getRuntimeAttributes(),
|
|
749
756
|
startTime: o,
|
|
750
757
|
target: r,
|
|
751
|
-
targetName:
|
|
758
|
+
targetName: lt(r, i, e.nameCollection === "text"),
|
|
752
759
|
targetTag: r.tagName.toLowerCase(),
|
|
753
760
|
userActivity: {
|
|
754
761
|
input: !1,
|
|
@@ -791,16 +798,16 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
791
798
|
o = [], s = void 0;
|
|
792
799
|
}
|
|
793
800
|
};
|
|
794
|
-
},
|
|
801
|
+
}, ht = "data-bk-excluded-activity-mutations", gt = (e) => {
|
|
795
802
|
let t = e.type === "characterData" ? e.target.parentElement : e.target;
|
|
796
803
|
return t instanceof Element && !!t.closest("[data-bk-excluded-activity-mutations]");
|
|
797
|
-
},
|
|
804
|
+
}, _t = () => {
|
|
798
805
|
let e, t = [];
|
|
799
806
|
return {
|
|
800
807
|
name: "activity",
|
|
801
808
|
init(n) {
|
|
802
809
|
if (typeof document < "u" && typeof MutationObserver < "u" && (e = new MutationObserver((e) => {
|
|
803
|
-
e.length && !e.every(
|
|
810
|
+
e.length && !e.every(gt) && n.notifyActivity({
|
|
804
811
|
time: Date.now(),
|
|
805
812
|
type: "dom_mutation"
|
|
806
813
|
});
|
|
@@ -824,7 +831,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
824
831
|
for (e == null || e.disconnect(), e = void 0; t.length;) (n = t.pop()) == null || n();
|
|
825
832
|
}
|
|
826
833
|
};
|
|
827
|
-
},
|
|
834
|
+
}, vt = (e, t) => !!(t && O(e.config.view.excludedActivityUrls, t)), yt = (e, t, n) => {
|
|
828
835
|
let r = /* @__PURE__ */ new Set(), i = !1, a = !1, o = t, s, c = (e) => {
|
|
829
836
|
i || (i = !0, clearTimeout(f), clearTimeout(s), d(), n(e));
|
|
830
837
|
}, l = () => {
|
|
@@ -837,7 +844,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
837
844
|
}, d = e.onActivity((n) => {
|
|
838
845
|
if (!(n.type === "error" || n.type === "long_task")) {
|
|
839
846
|
if (n.type === "request_start") {
|
|
840
|
-
if (n.time < t ||
|
|
847
|
+
if (n.time < t || vt(e, n.url)) return;
|
|
841
848
|
r.add(n.id), u(n.time);
|
|
842
849
|
return;
|
|
843
850
|
}
|
|
@@ -847,7 +854,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
847
854
|
return;
|
|
848
855
|
}
|
|
849
856
|
if (n.type === "resource") {
|
|
850
|
-
if (n.endTime < t ||
|
|
857
|
+
if (n.endTime < t || vt(e, n.url)) return;
|
|
851
858
|
u(n.endTime);
|
|
852
859
|
return;
|
|
853
860
|
}
|
|
@@ -859,7 +866,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
859
866
|
return () => {
|
|
860
867
|
i || (i = !0, clearTimeout(f), clearTimeout(s), d());
|
|
861
868
|
};
|
|
862
|
-
},
|
|
869
|
+
}, bt = 1e3, xt = 200, St = "body", Ct = .8, wt = [
|
|
863
870
|
"[data-loading=\"true\"]",
|
|
864
871
|
"[aria-busy=\"true\"]",
|
|
865
872
|
".loading",
|
|
@@ -867,7 +874,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
867
874
|
".spinner",
|
|
868
875
|
".skeleton",
|
|
869
876
|
".bk-loading"
|
|
870
|
-
],
|
|
877
|
+
], Tt = [
|
|
871
878
|
[.2, .2],
|
|
872
879
|
[.5, .2],
|
|
873
880
|
[.8, .2],
|
|
@@ -877,32 +884,32 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
877
884
|
[.2, .8],
|
|
878
885
|
[.5, .8],
|
|
879
886
|
[.8, .8]
|
|
880
|
-
],
|
|
887
|
+
], Et = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, Dt = (e, t) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.min(1, e)) : t, Ot = (e, t) => t.some((t) => {
|
|
881
888
|
try {
|
|
882
889
|
return e.matches(t) || !!e.closest(t);
|
|
883
890
|
} catch (e) {
|
|
884
891
|
return !1;
|
|
885
892
|
}
|
|
886
|
-
}),
|
|
893
|
+
}), kt = (e) => {
|
|
887
894
|
if (typeof getComputedStyle != "function") return !0;
|
|
888
895
|
let t = getComputedStyle(e);
|
|
889
896
|
return t.display !== "none" && t.visibility !== "hidden" && Number(t.opacity || 1) > 0;
|
|
890
|
-
},
|
|
897
|
+
}, At = (e, t) => {
|
|
891
898
|
if (typeof document.elementsFromPoint == "function") return document.elementsFromPoint(e, t);
|
|
892
899
|
let n = document.elementFromPoint(e, t);
|
|
893
900
|
return n ? [n] : [];
|
|
894
|
-
},
|
|
901
|
+
}, jt = (e, t) => {
|
|
895
902
|
var n;
|
|
896
903
|
let r = document.querySelector(e), i = (n = r == null ? document.body : r) == null ? document.documentElement : n, a = 0, o = 0;
|
|
897
|
-
for (let [e, n] of
|
|
898
|
-
let r =
|
|
899
|
-
if (r.some((e) =>
|
|
904
|
+
for (let [e, n] of Tt) {
|
|
905
|
+
let r = At(window.innerWidth * e, window.innerHeight * n);
|
|
906
|
+
if (r.some((e) => Ot(e, t))) {
|
|
900
907
|
o += 1;
|
|
901
908
|
continue;
|
|
902
909
|
}
|
|
903
|
-
r.some((e) => e !== i && e !== document.body && e !== document.documentElement && i.contains(e) &&
|
|
910
|
+
r.some((e) => e !== i && e !== document.body && e !== document.documentElement && i.contains(e) && kt(e)) || (a += 1);
|
|
904
911
|
}
|
|
905
|
-
let s =
|
|
912
|
+
let s = Tt.length - o;
|
|
906
913
|
return {
|
|
907
914
|
emptyCount: a,
|
|
908
915
|
ignoredCount: o,
|
|
@@ -910,9 +917,9 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
910
917
|
score: s ? a / s : 0,
|
|
911
918
|
validCount: s
|
|
912
919
|
};
|
|
913
|
-
},
|
|
920
|
+
}, Mt = (e = {}) => {
|
|
914
921
|
var t;
|
|
915
|
-
let n =
|
|
922
|
+
let n = Et(e.checkDelay, bt), r = Et(e.confirmationDelay, xt), i = e.rootSelector || St, a = Dt(e.threshold, Ct), o = [...wt, ...(t = e.ignoreSelectors) == null ? [] : t], s, c, l, u, d = () => {}, f;
|
|
916
923
|
return {
|
|
917
924
|
name: "blank-screen",
|
|
918
925
|
init(e) {
|
|
@@ -923,9 +930,9 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
923
930
|
if (s !== t || c === t || !e.isSampled()) return;
|
|
924
931
|
c = t;
|
|
925
932
|
let r = Date.now();
|
|
926
|
-
e.startSpan("browser.blank_screen", S(S({},
|
|
927
|
-
outcome:
|
|
928
|
-
spanType:
|
|
933
|
+
e.startSpan("browser.blank_screen", S(S({}, M({
|
|
934
|
+
outcome: A.error,
|
|
935
|
+
spanType: j.error
|
|
929
936
|
})), {}, {
|
|
930
937
|
"blank_screen.empty_ratio": n.score,
|
|
931
938
|
"blank_screen.empty_sample_count": n.emptyCount,
|
|
@@ -935,7 +942,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
935
942
|
if (s !== t || c === t || document.visibilityState === "hidden") return;
|
|
936
943
|
let n;
|
|
937
944
|
try {
|
|
938
|
-
n =
|
|
945
|
+
n = jt(i, o);
|
|
939
946
|
} catch (t) {
|
|
940
947
|
var l;
|
|
941
948
|
e.config.debug && ((l = globalThis.console) == null || l.warn("[bk-ot][blank-screen] detection failed:", t));
|
|
@@ -945,7 +952,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
945
952
|
if (s !== t || document.visibilityState === "hidden") return;
|
|
946
953
|
let n;
|
|
947
954
|
try {
|
|
948
|
-
n =
|
|
955
|
+
n = jt(i, o);
|
|
949
956
|
} catch (t) {
|
|
950
957
|
var r;
|
|
951
958
|
e.config.debug && ((r = globalThis.console) == null || r.warn("[bk-ot][blank-screen] confirmation failed:", t));
|
|
@@ -959,7 +966,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
959
966
|
d = e.onViewChange((n) => {
|
|
960
967
|
if (n.id !== s && (t(), l == null || l(), l = void 0, s = n.id, c = void 0, n.id)) {
|
|
961
968
|
let t = n.id;
|
|
962
|
-
l =
|
|
969
|
+
l = yt(e, Date.now(), () => {
|
|
963
970
|
l = void 0, h(t);
|
|
964
971
|
});
|
|
965
972
|
}
|
|
@@ -973,45 +980,45 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
973
980
|
clearTimeout(u), u = void 0, d(), l == null || l(), l = void 0, f == null || f(), f = void 0, s = void 0, c = void 0;
|
|
974
981
|
}
|
|
975
982
|
};
|
|
976
|
-
},
|
|
983
|
+
}, Nt = 100, Pt = 200, P = [], Ft = (e) => e.replace(/#.*$/, ""), It = (e) => {
|
|
977
984
|
let t = P.indexOf(e);
|
|
978
985
|
t >= 0 && P.splice(t, 1), e.timer !== void 0 && clearTimeout(e.timer);
|
|
979
986
|
}, F = (e, t) => {
|
|
980
987
|
let n = e.callback;
|
|
981
|
-
|
|
982
|
-
},
|
|
983
|
-
let t = performance.timeOrigin + e.startTime, n = P.filter((n) => !n.entry &&
|
|
988
|
+
It(e), e.callback = void 0, n == null || n(t);
|
|
989
|
+
}, Lt = (e) => {
|
|
990
|
+
let t = performance.timeOrigin + e.startTime, n = P.filter((n) => !n.entry && Ft(n.url) === Ft(e.name) && t >= n.startTime - 50).sort((e, n) => Math.abs(e.startTime - t) - Math.abs(n.startTime - t))[0];
|
|
984
991
|
n && (n.entry = e, n.callback && F(n, e));
|
|
985
|
-
},
|
|
992
|
+
}, Rt = (e, t = Date.now()) => {
|
|
986
993
|
let n = {
|
|
987
994
|
startTime: t,
|
|
988
995
|
url: e
|
|
989
996
|
};
|
|
990
|
-
return P.push(n), P.length >
|
|
997
|
+
return P.push(n), P.length > Nt && F(P[0]), {
|
|
991
998
|
cancel: () => F(n),
|
|
992
999
|
complete: (e) => {
|
|
993
1000
|
if (n.callback = e, n.entry) {
|
|
994
1001
|
F(n, n.entry);
|
|
995
1002
|
return;
|
|
996
1003
|
}
|
|
997
|
-
n.timer = setTimeout(() => F(n),
|
|
1004
|
+
n.timer = setTimeout(() => F(n), Pt);
|
|
998
1005
|
}
|
|
999
1006
|
};
|
|
1000
|
-
}, I = "traceparent", L = 32, R = 16,
|
|
1007
|
+
}, I = "traceparent", L = 32, R = 16, zt = "0123456789abcdef", Bt = /^[\da-f]+$/, Vt = /^0+$/, Ht = /^\d+$/, Ut = /^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})(?:-.*)?$/, Wt = /^([\da-f]{32})-([\da-f]{16})(?:-([01]))?$/, Gt = /(?:^|,)_dd\.p\.tid=([\da-f]{16})(?:,|$)/, Kt = "0000000000000000", z = (e, t) => e.length === t && Bt.test(e) && !Vt.test(e), qt = (e) => {
|
|
1001
1008
|
let t = e.toLowerCase();
|
|
1002
1009
|
return z(t, L) ? t : z(t, R) ? t.padStart(L, "0") : void 0;
|
|
1003
|
-
},
|
|
1010
|
+
}, Jt = (e) => {
|
|
1004
1011
|
let t = e.toLowerCase();
|
|
1005
1012
|
return z(t, R) ? t : void 0;
|
|
1006
|
-
},
|
|
1013
|
+
}, Yt = (e) => {
|
|
1007
1014
|
let t = new Uint8Array(e / 2);
|
|
1008
1015
|
if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") crypto.getRandomValues(t);
|
|
1009
1016
|
else for (let e = 0; e < t.length; e += 1) t[e] = Math.floor(Math.random() * 256);
|
|
1010
1017
|
let n = "";
|
|
1011
|
-
for (let e of t) n +=
|
|
1012
|
-
return
|
|
1013
|
-
},
|
|
1014
|
-
if (!
|
|
1018
|
+
for (let e of t) n += zt[e >> 4] + zt[e & 15];
|
|
1019
|
+
return Vt.test(n) ? `${n.slice(1)}1` : n;
|
|
1020
|
+
}, Xt = (e) => {
|
|
1021
|
+
if (!Ht.test(e)) return;
|
|
1015
1022
|
let t = [];
|
|
1016
1023
|
for (let n = 0; n < e.length; n += 1) {
|
|
1017
1024
|
let r = e.charCodeAt(n) - 48;
|
|
@@ -1023,9 +1030,9 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1023
1030
|
}
|
|
1024
1031
|
if (t.length > R) return;
|
|
1025
1032
|
let n = "";
|
|
1026
|
-
for (let e = t.length - 1; e >= 0; --e) n +=
|
|
1033
|
+
for (let e = t.length - 1; e >= 0; --e) n += zt[t[e]];
|
|
1027
1034
|
return n.padStart(R, "0");
|
|
1028
|
-
},
|
|
1035
|
+
}, B = (e, t) => {
|
|
1029
1036
|
let n = {};
|
|
1030
1037
|
for (let i of t) {
|
|
1031
1038
|
var r;
|
|
@@ -1033,17 +1040,17 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1033
1040
|
t && (n[i] = t);
|
|
1034
1041
|
}
|
|
1035
1042
|
return n;
|
|
1036
|
-
},
|
|
1043
|
+
}, Zt = [
|
|
1037
1044
|
(e) => {
|
|
1038
1045
|
var t;
|
|
1039
1046
|
let n = (t = e("traceparent")) == null ? void 0 : t.trim().toLowerCase();
|
|
1040
1047
|
if (!n) return;
|
|
1041
|
-
let r =
|
|
1048
|
+
let r = Ut.exec(n);
|
|
1042
1049
|
if (!r || r[1] === "ff") return;
|
|
1043
1050
|
let [, , i, a, o] = r;
|
|
1044
1051
|
if (!(!z(i, L) || !z(a, R))) return {
|
|
1045
1052
|
format: "traceparent",
|
|
1046
|
-
headers:
|
|
1053
|
+
headers: B(e, [I]),
|
|
1047
1054
|
sampled: (Number.parseInt(o, 16) & 1) == 1,
|
|
1048
1055
|
spanId: a,
|
|
1049
1056
|
traceId: i
|
|
@@ -1053,7 +1060,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1053
1060
|
var t;
|
|
1054
1061
|
let n = (t = e("sentry-trace")) == null ? void 0 : t.trim().toLowerCase();
|
|
1055
1062
|
if (!n) return;
|
|
1056
|
-
let r =
|
|
1063
|
+
let r = B(e, ["sentry-trace"]), i = Wt.exec(n);
|
|
1057
1064
|
if (!i) return {
|
|
1058
1065
|
format: "sentry-trace",
|
|
1059
1066
|
headers: r
|
|
@@ -1071,10 +1078,10 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1071
1078
|
var t;
|
|
1072
1079
|
let n = (t = e("b3")) == null ? void 0 : t.trim().toLowerCase();
|
|
1073
1080
|
if (!n) return;
|
|
1074
|
-
let [r, i, a] = n.split("-"), o = r ?
|
|
1081
|
+
let [r, i, a] = n.split("-"), o = r ? qt(r) : void 0, s = i ? Jt(i) : void 0;
|
|
1075
1082
|
return S(S({
|
|
1076
1083
|
format: "b3",
|
|
1077
|
-
headers:
|
|
1084
|
+
headers: B(e, ["b3"])
|
|
1078
1085
|
}, o && s ? {
|
|
1079
1086
|
spanId: s,
|
|
1080
1087
|
traceId: o
|
|
@@ -1084,10 +1091,10 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1084
1091
|
var t, n, r;
|
|
1085
1092
|
let i = (t = e("x-b3-traceid")) == null ? void 0 : t.trim().toLowerCase(), a = (n = e("x-b3-spanid")) == null ? void 0 : n.trim().toLowerCase(), o = (r = e("x-b3-sampled")) == null ? void 0 : r.trim().toLowerCase();
|
|
1086
1093
|
if (!i && !a && !o) return;
|
|
1087
|
-
let s = i ?
|
|
1094
|
+
let s = i ? qt(i) : void 0, c = a ? Jt(a) : void 0;
|
|
1088
1095
|
return S(S({
|
|
1089
1096
|
format: "b3-multi",
|
|
1090
|
-
headers:
|
|
1097
|
+
headers: B(e, [
|
|
1091
1098
|
"x-b3-traceid",
|
|
1092
1099
|
"x-b3-spanid",
|
|
1093
1100
|
"x-b3-parentspanid",
|
|
@@ -1103,10 +1110,10 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1103
1110
|
var t, n, r, i, a, o;
|
|
1104
1111
|
let s = (t = e("x-datadog-trace-id")) == null ? void 0 : t.trim(), c = (n = e("x-datadog-parent-id")) == null ? void 0 : n.trim(), l = (r = e("x-datadog-sampling-priority")) == null ? void 0 : r.trim();
|
|
1105
1112
|
if (!s && !c && !l) return;
|
|
1106
|
-
let u = (i = e("x-datadog-tags")) == null ? void 0 : i.trim().toLowerCase(), d = (a = u ? (o =
|
|
1113
|
+
let u = (i = e("x-datadog-tags")) == null ? void 0 : i.trim().toLowerCase(), d = (a = u ? (o = Gt.exec(u)) == null ? void 0 : o[1] : void 0) == null ? Kt : a, f = s ? Xt(s) : void 0, p = f ? qt(`${d}${f}`) : void 0, m = c ? Xt(c) : void 0, h = m ? Jt(m) : void 0;
|
|
1107
1114
|
return S(S({
|
|
1108
1115
|
format: "datadog",
|
|
1109
|
-
headers:
|
|
1116
|
+
headers: B(e, [
|
|
1110
1117
|
"x-datadog-trace-id",
|
|
1111
1118
|
"x-datadog-parent-id",
|
|
1112
1119
|
"x-datadog-sampling-priority",
|
|
@@ -1125,28 +1132,28 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1125
1132
|
let r = n.split("-")[0];
|
|
1126
1133
|
return S({
|
|
1127
1134
|
format: "sw8",
|
|
1128
|
-
headers:
|
|
1135
|
+
headers: B(e, ["sw8"])
|
|
1129
1136
|
}, r ? { sampled: r === "1" } : {});
|
|
1130
1137
|
}
|
|
1131
|
-
],
|
|
1132
|
-
for (let t of
|
|
1138
|
+
], Qt = (e) => {
|
|
1139
|
+
for (let t of Zt) {
|
|
1133
1140
|
let n = t(e);
|
|
1134
1141
|
if (n) return n;
|
|
1135
1142
|
}
|
|
1136
|
-
},
|
|
1143
|
+
}, $t = (e, t, r, i) => ({
|
|
1137
1144
|
attributes: r,
|
|
1138
1145
|
context: {
|
|
1139
1146
|
spanId: t,
|
|
1140
1147
|
traceFlags: i === !1 ? n.NONE : n.SAMPLED,
|
|
1141
1148
|
traceId: e
|
|
1142
1149
|
}
|
|
1143
|
-
}),
|
|
1150
|
+
}), en = (e) => {
|
|
1144
1151
|
var t, n;
|
|
1145
|
-
let r =
|
|
1152
|
+
let r = Qt(e);
|
|
1146
1153
|
if (!r) {
|
|
1147
|
-
let e =
|
|
1154
|
+
let e = Yt(L), t = Yt(R), n = `00-${e}-${t}-01`;
|
|
1148
1155
|
return {
|
|
1149
|
-
links: [
|
|
1156
|
+
links: [$t(e, t, {
|
|
1150
1157
|
format: "traceparent",
|
|
1151
1158
|
injected: !0,
|
|
1152
1159
|
[I]: n
|
|
@@ -1154,13 +1161,13 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1154
1161
|
traceparent: n
|
|
1155
1162
|
};
|
|
1156
1163
|
}
|
|
1157
|
-
return { links: [
|
|
1164
|
+
return { links: [$t((t = r.traceId) == null ? Yt(L) : t, (n = r.spanId) == null ? Yt(R) : n, S({
|
|
1158
1165
|
format: r.format,
|
|
1159
1166
|
injected: !1
|
|
1160
1167
|
}, r.headers), r.sampled)] };
|
|
1161
|
-
},
|
|
1162
|
-
|
|
1163
|
-
},
|
|
1168
|
+
}, tn = (e) => e.deliveryType === "cache" || e.transferSize === 0 && e.decodedBodySize > 0 ? !0 : void 0, nn = (e) => e.transferSize === 0 && e.encodedBodySize === 0 && e.decodedBodySize === 0 && e.requestStart === 0 && e.responseStart === 0 && !e.nextHopProtocol, rn = (...e) => e.every((t, n) => n === 0 || e[n - 1] <= t), V = (e, t, n, r, i) => {
|
|
1169
|
+
rn(n, r, i) && (e[`resource.${t}.start`] = r - n, e[`resource.${t}.duration`] = i - r);
|
|
1170
|
+
}, an = (e) => {
|
|
1164
1171
|
let t = {}, n = [
|
|
1165
1172
|
e.startTime,
|
|
1166
1173
|
e.fetchStart,
|
|
@@ -1172,16 +1179,16 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1172
1179
|
e.responseStart,
|
|
1173
1180
|
e.responseEnd
|
|
1174
1181
|
];
|
|
1175
|
-
return !n.every(Number.isFinite) || !
|
|
1176
|
-
},
|
|
1177
|
-
let t =
|
|
1178
|
-
return S(S(S(S(S({ [g.cacheHit]:
|
|
1182
|
+
return !n.every(Number.isFinite) || !rn(...n) ? t : (V(t, "first_byte", e.startTime, e.requestStart, e.responseStart), V(t, "download", e.startTime, e.responseStart, e.responseEnd), e.workerStart > 0 && e.workerStart < e.fetchStart && V(t, "worker", e.startTime, e.workerStart, e.fetchStart), e.fetchStart < e.domainLookupEnd && V(t, "dns", e.startTime, e.domainLookupStart, e.domainLookupEnd), e.fetchStart < e.connectEnd && (V(t, "connect", e.startTime, e.connectStart, e.connectEnd), e.connectStart <= e.secureConnectionStart && e.secureConnectionStart <= e.connectEnd && V(t, "ssl", e.startTime, e.secureConnectionStart, e.connectEnd)), e.redirectEnd > e.startTime && rn(e.startTime, e.redirectStart, e.redirectEnd, e.fetchStart) && V(t, "redirect", e.startTime, e.redirectStart, e.redirectEnd), t);
|
|
1183
|
+
}, on = (e) => e.duration === 0 && e.responseEnd > e.startTime ? e.responseEnd - e.startTime : e.duration, sn = (e) => {
|
|
1184
|
+
let t = nn(e), n = typeof e.deliveryType == "string" && e.deliveryType ? e.deliveryType : void 0;
|
|
1185
|
+
return S(S(S(S(S({ [g.cacheHit]: tn(e) }, e.nextHopProtocol ? { [g.nextHopProtocol]: e.nextHopProtocol } : {}), an(e)), n ? { "resource.delivery_type": n } : {}), e.renderBlockingStatus ? { "resource.render_blocking_status": e.renderBlockingStatus } : {}), t ? {} : {
|
|
1179
1186
|
"resource.size": e.decodedBodySize,
|
|
1180
1187
|
"resource.encoded_body_size": e.encodedBodySize,
|
|
1181
1188
|
"resource.decoded_body_size": e.decodedBodySize,
|
|
1182
1189
|
"resource.transfer_size": e.transferSize
|
|
1183
1190
|
});
|
|
1184
|
-
},
|
|
1191
|
+
}, cn = (t = !0) => {
|
|
1185
1192
|
let n;
|
|
1186
1193
|
return {
|
|
1187
1194
|
name: "resource",
|
|
@@ -1189,13 +1196,13 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1189
1196
|
var i;
|
|
1190
1197
|
if (typeof PerformanceObserver > "u" || !((i = PerformanceObserver.supportedEntryTypes) != null && i.includes("resource"))) return;
|
|
1191
1198
|
let a = (n) => {
|
|
1192
|
-
if (!r.isSampled() || !n.name ||
|
|
1199
|
+
if (!r.isSampled() || !n.name || D(r.config, n.name)) return;
|
|
1193
1200
|
if (n.initiatorType === "fetch" || n.initiatorType === "xmlhttprequest") {
|
|
1194
|
-
|
|
1201
|
+
Lt(n);
|
|
1195
1202
|
return;
|
|
1196
1203
|
}
|
|
1197
1204
|
if (n.duration < 0) return;
|
|
1198
|
-
let i = r.config.hooks.redactUrl(n.name), a =
|
|
1205
|
+
let i = r.config.hooks.redactUrl(n.name), a = on(n), o = performance.timeOrigin + n.startTime, s = o + a;
|
|
1199
1206
|
t && r.isSampled() && r.startSpan("browser.resource", S(S(S({}, r.config.hooks.getPageAttributes()), Xe({
|
|
1200
1207
|
initiatorType: n.initiatorType || "other",
|
|
1201
1208
|
outcome: typeof n.responseStatus == "number" ? {
|
|
@@ -1203,7 +1210,10 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1203
1210
|
type: "response"
|
|
1204
1211
|
} : void 0,
|
|
1205
1212
|
url: i
|
|
1206
|
-
})), {}, {
|
|
1213
|
+
})), {}, {
|
|
1214
|
+
"url.full": i,
|
|
1215
|
+
"url.template": r.config.hooks.getRequestUrlTemplate(i)
|
|
1216
|
+
}, sn(n)), {
|
|
1207
1217
|
kind: e.CLIENT,
|
|
1208
1218
|
startTime: o
|
|
1209
1219
|
}).end(s), r.notifyActivity({
|
|
@@ -1228,31 +1238,31 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1228
1238
|
n == null || n.disconnect(), n = void 0;
|
|
1229
1239
|
}
|
|
1230
1240
|
};
|
|
1231
|
-
},
|
|
1241
|
+
}, ln = (e) => typeof e.config.tracking.request == "object" ? e.config.tracking.request : void 0, un = (e) => {
|
|
1232
1242
|
var t;
|
|
1233
|
-
let n = (t =
|
|
1243
|
+
let n = (t = ln(e)) == null ? void 0 : t.allowedTracingUrls;
|
|
1234
1244
|
return Array.isArray(n) ? n.length > 0 : n !== void 0;
|
|
1235
|
-
},
|
|
1245
|
+
}, dn = (e) => typeof e == "object" && e && "name" in e && typeof e.name == "string" ? e.name : "", fn = (e, t) => {
|
|
1236
1246
|
let n = e.signal;
|
|
1237
|
-
return
|
|
1247
|
+
return dn(n == null ? void 0 : n.reason) === "TimeoutError" || dn(t) === "TimeoutError" ? {
|
|
1238
1248
|
error: t,
|
|
1239
1249
|
type: "timeout"
|
|
1240
|
-
} : n != null && n.aborted ||
|
|
1250
|
+
} : n != null && n.aborted || dn(t) === "AbortError" ? { type: "abort" } : {
|
|
1241
1251
|
error: t,
|
|
1242
1252
|
type: "network_error"
|
|
1243
1253
|
};
|
|
1244
|
-
},
|
|
1254
|
+
}, pn = (e, t) => e === "abort" ? { type: "abort" } : e === "timeout" ? { type: "timeout" } : e === "error" || t.status === 0 ? { type: "network_error" } : {
|
|
1245
1255
|
statusCode: t.status,
|
|
1246
1256
|
type: "response"
|
|
1247
|
-
},
|
|
1257
|
+
}, mn = (e) => e.type === "network_error" || e.type === "timeout" || e.type === "response" && typeof e.statusCode == "number" && e.statusCode >= 400, hn = (e) => typeof e == "string" || e instanceof URL ? E(String(e)) : E(e.url), gn = (e, t) => {
|
|
1248
1258
|
var n;
|
|
1249
1259
|
return ((n = t == null ? void 0 : t.method) == null ? typeof Request < "u" && e instanceof Request ? e.method : "GET" : n).toUpperCase();
|
|
1250
|
-
},
|
|
1260
|
+
}, _n = (e, t) => typeof Request < "u" && e instanceof Request ? e : t == null ? {} : t, vn = (e, t) => {
|
|
1251
1261
|
var n;
|
|
1252
1262
|
let r = typeof Request < "u" && e instanceof Request ? e.headers : void 0;
|
|
1253
1263
|
return new Headers((n = t == null ? void 0 : t.headers) == null ? r : n);
|
|
1254
|
-
},
|
|
1255
|
-
if (
|
|
1264
|
+
}, yn = (e, t, n) => n.traceparent ? (t.set(I, n.traceparent), S(S({}, e), {}, { headers: t })) : e, bn = (e) => (t) => e == null ? void 0 : e[t.toLowerCase()], xn = (e, t) => D(e.config, t) || O(e.config.view.excludedActivityUrls, t), Sn = (e, t) => {
|
|
1265
|
+
if (xn(e, t)) return () => {};
|
|
1256
1266
|
let n = h("request");
|
|
1257
1267
|
e.notifyActivity({
|
|
1258
1268
|
id: n,
|
|
@@ -1268,12 +1278,12 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1268
1278
|
type: "request_end"
|
|
1269
1279
|
}));
|
|
1270
1280
|
};
|
|
1271
|
-
},
|
|
1281
|
+
}, Cn = (e, t) => e.isSampled() ? Rt(t) : {
|
|
1272
1282
|
cancel() {},
|
|
1273
1283
|
complete(e) {
|
|
1274
1284
|
e();
|
|
1275
1285
|
}
|
|
1276
|
-
},
|
|
1286
|
+
}, wn = (t, n, r, i) => {
|
|
1277
1287
|
var a, o;
|
|
1278
1288
|
let s = (a = r.startedAt) == null ? Date.now() : a;
|
|
1279
1289
|
return t.startSpan("browser.resource", S(S(S({}, t.config.hooks.getPageAttributes()), Xe({
|
|
@@ -1287,7 +1297,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1287
1297
|
kind: e.CLIENT,
|
|
1288
1298
|
startTime: s
|
|
1289
1299
|
}, i ? { links: i.links } : {}));
|
|
1290
|
-
},
|
|
1300
|
+
}, Tn = (e, n, r, i, a, o = {}) => {
|
|
1291
1301
|
let s = o.url, c = s ? e.config.hooks.redactUrl(s) : void 0, l = o.method, u = {
|
|
1292
1302
|
attributes: S(S(S(S({}, e.config.hooks.getPageAttributes()), Xe({
|
|
1293
1303
|
initiatorType: r,
|
|
@@ -1305,17 +1315,17 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1305
1315
|
}, d = !0;
|
|
1306
1316
|
try {
|
|
1307
1317
|
var f, p;
|
|
1308
|
-
d = (f =
|
|
1318
|
+
d = (f = ln(e)) == null || (p = f.beforeSend) == null ? void 0 : p.call(f, u, i);
|
|
1309
1319
|
} catch (t) {
|
|
1310
1320
|
var m;
|
|
1311
1321
|
e.config.debug && ((m = globalThis.console) == null || m.warn("[bk-ot] request.beforeSend failed:", t));
|
|
1312
1322
|
}
|
|
1313
1323
|
if (n.setAttributes(e.applyRedact(u.attributes)), d === !1) {
|
|
1314
|
-
|
|
1324
|
+
Re(n);
|
|
1315
1325
|
return;
|
|
1316
1326
|
}
|
|
1317
|
-
|
|
1318
|
-
},
|
|
1327
|
+
mn(a) && n.setStatus({ code: t.ERROR });
|
|
1328
|
+
}, En = (e) => {
|
|
1319
1329
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
1320
1330
|
return {
|
|
1321
1331
|
name: "request",
|
|
@@ -1324,20 +1334,20 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1324
1334
|
if (!(typeof window > "u")) {
|
|
1325
1335
|
if (typeof window.fetch == "function") {
|
|
1326
1336
|
let r = window.fetch, i = /* @__PURE__ */ function() {
|
|
1327
|
-
var t =
|
|
1328
|
-
let a =
|
|
1329
|
-
if (!e.isSampled() ||
|
|
1337
|
+
var t = k(function* (t, i) {
|
|
1338
|
+
let a = hn(t);
|
|
1339
|
+
if (!e.isSampled() || _e(e.config, a)) return r.call(this, t, i);
|
|
1330
1340
|
let o = {
|
|
1331
|
-
method:
|
|
1341
|
+
method: gn(t, i),
|
|
1332
1342
|
startedAt: Date.now(),
|
|
1333
1343
|
url: a
|
|
1334
|
-
}, s =
|
|
1344
|
+
}, s = ve(e.config, a) ? vn(t, i) : void 0, c = s ? en((e) => {
|
|
1335
1345
|
var t;
|
|
1336
1346
|
return (t = s.get(e)) == null ? void 0 : t;
|
|
1337
|
-
}) : void 0, l =
|
|
1347
|
+
}) : void 0, l = wn(e, "fetch", o, c), u = Cn(e, a), d = Sn(e, a), f = _n(t, i), p = s && c ? yn(i, s, c) : i, m = !1, h = (t, r = Date.now()) => {
|
|
1338
1348
|
if (!m) {
|
|
1339
1349
|
if (m = !0, n.delete(g), t) {
|
|
1340
|
-
l.setAttributes(e.applyRedact(
|
|
1350
|
+
l.setAttributes(e.applyRedact(sn(t))), l.end(performance.timeOrigin + t.startTime + on(t));
|
|
1341
1351
|
return;
|
|
1342
1352
|
}
|
|
1343
1353
|
l.end(r);
|
|
@@ -1348,7 +1358,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1348
1358
|
n.add(g);
|
|
1349
1359
|
try {
|
|
1350
1360
|
let n = yield r.call(this, t, p), i = S(S({}, n.status > 0 ? { statusCode: n.status } : {}), {}, { type: "response" });
|
|
1351
|
-
|
|
1361
|
+
Tn(e, l, "fetch", {
|
|
1352
1362
|
request: f,
|
|
1353
1363
|
response: n,
|
|
1354
1364
|
type: "fetch"
|
|
@@ -1356,8 +1366,8 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1356
1366
|
let a = Date.now();
|
|
1357
1367
|
return u.complete((e) => h(e, a)), n;
|
|
1358
1368
|
} catch (t) {
|
|
1359
|
-
let n =
|
|
1360
|
-
|
|
1369
|
+
let n = fn(f, t);
|
|
1370
|
+
Tn(e, l, "fetch", {
|
|
1361
1371
|
error: t,
|
|
1362
1372
|
request: f,
|
|
1363
1373
|
type: "fetch"
|
|
@@ -1385,9 +1395,9 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1385
1395
|
}, c = function(t) {
|
|
1386
1396
|
var a;
|
|
1387
1397
|
let s = (a = r.get(this)) == null ? {} : a;
|
|
1388
|
-
if (!e.isSampled() || !s.url ||
|
|
1398
|
+
if (!e.isSampled() || !s.url || _e(e.config, s.url)) return o.call(this, t);
|
|
1389
1399
|
s.startedAt = Date.now();
|
|
1390
|
-
let c =
|
|
1400
|
+
let c = ve(e.config, s.url) ? en(bn(i.get(this))) : void 0, l = wn(e, "xhr", s, c), u = Cn(e, s.url), d = Sn(e, s.url);
|
|
1391
1401
|
c != null && c.traceparent && this.setRequestHeader(I, c.traceparent);
|
|
1392
1402
|
let f = !1, p = !1, m = () => {}, h = () => {
|
|
1393
1403
|
m(), u.cancel(), !p && (p = !0, n.delete(h), d(), l.end());
|
|
@@ -1396,8 +1406,8 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1396
1406
|
let g = (t) => {
|
|
1397
1407
|
if (f || p) return;
|
|
1398
1408
|
f = !0, m();
|
|
1399
|
-
let r =
|
|
1400
|
-
|
|
1409
|
+
let r = pn(t, this);
|
|
1410
|
+
Tn(e, l, "xhr", {
|
|
1401
1411
|
type: "xhr",
|
|
1402
1412
|
xhr: this
|
|
1403
1413
|
}, r, s), d();
|
|
@@ -1405,7 +1415,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1405
1415
|
u.complete((t) => {
|
|
1406
1416
|
if (!p) {
|
|
1407
1417
|
if (p = !0, n.delete(h), t) {
|
|
1408
|
-
l.setAttributes(e.applyRedact(
|
|
1418
|
+
l.setAttributes(e.applyRedact(sn(t))), l.end(performance.timeOrigin + t.startTime + on(t));
|
|
1409
1419
|
return;
|
|
1410
1420
|
}
|
|
1411
1421
|
l.end(i);
|
|
@@ -1423,7 +1433,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1423
1433
|
};
|
|
1424
1434
|
if (XMLHttpRequest.prototype.open = s, XMLHttpRequest.prototype.send = c, t.push(() => {
|
|
1425
1435
|
XMLHttpRequest.prototype.open === s && (XMLHttpRequest.prototype.open = a), XMLHttpRequest.prototype.send === c && (XMLHttpRequest.prototype.send = o);
|
|
1426
|
-
}),
|
|
1436
|
+
}), un(e) && typeof XMLHttpRequest.prototype.setRequestHeader == "function") {
|
|
1427
1437
|
let e = XMLHttpRequest.prototype.setRequestHeader, n = function(t, n) {
|
|
1428
1438
|
var r;
|
|
1429
1439
|
let a = t.toLowerCase(), o = (r = i.get(this)) == null ? {} : r;
|
|
@@ -1442,9 +1452,9 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1442
1452
|
for (; t.length;) (e = t.pop()) == null || e();
|
|
1443
1453
|
}
|
|
1444
1454
|
};
|
|
1445
|
-
},
|
|
1446
|
-
if (t) return
|
|
1447
|
-
},
|
|
1455
|
+
}, Dn = /^https?:|^\/\//i, On = (e, t) => {
|
|
1456
|
+
if (t) return Dn.test(t) ? e(t) : t;
|
|
1457
|
+
}, kn = () => {
|
|
1448
1458
|
let e;
|
|
1449
1459
|
return {
|
|
1450
1460
|
name: "csp-violation",
|
|
@@ -1452,10 +1462,10 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1452
1462
|
if (typeof window > "u" || typeof document > "u") return;
|
|
1453
1463
|
let n = (e) => {
|
|
1454
1464
|
if (!t.isSampled()) return;
|
|
1455
|
-
let n = Date.now(), r =
|
|
1456
|
-
t.startSpan("csp.violation", S(S(S({}, t.config.hooks.getPageAttributes()),
|
|
1457
|
-
outcome:
|
|
1458
|
-
spanType:
|
|
1465
|
+
let n = Date.now(), r = On(t.config.hooks.redactUrl, e.blockedURI), i = e.sourceFile ? t.config.hooks.redactUrl(e.sourceFile) : void 0;
|
|
1466
|
+
t.startSpan("csp.violation", S(S(S({}, t.config.hooks.getPageAttributes()), M({
|
|
1467
|
+
outcome: A.error,
|
|
1468
|
+
spanType: j.error
|
|
1459
1469
|
})), {}, {
|
|
1460
1470
|
"csp.blocked_uri": r,
|
|
1461
1471
|
"csp.violated_directive": e.violatedDirective,
|
|
@@ -1475,7 +1485,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1475
1485
|
e == null || e(), e = void 0;
|
|
1476
1486
|
}
|
|
1477
1487
|
};
|
|
1478
|
-
},
|
|
1488
|
+
}, An = (e) => {
|
|
1479
1489
|
if (e instanceof Error) return e.message;
|
|
1480
1490
|
if (typeof e == "string") return e;
|
|
1481
1491
|
try {
|
|
@@ -1483,9 +1493,9 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1483
1493
|
} catch (t) {
|
|
1484
1494
|
return String(e);
|
|
1485
1495
|
}
|
|
1486
|
-
},
|
|
1496
|
+
}, jn = ({ context: e, error: n, exceptionType: r, extra: i = {}, source: a, spanName: o }) => {
|
|
1487
1497
|
if (!e.isSampled()) return;
|
|
1488
|
-
let s = Date.now(), c =
|
|
1498
|
+
let s = Date.now(), c = An(n);
|
|
1489
1499
|
e.notifyActivity({
|
|
1490
1500
|
time: s,
|
|
1491
1501
|
type: "error"
|
|
@@ -1493,9 +1503,9 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1493
1503
|
let l = n instanceof Error ? n : {
|
|
1494
1504
|
message: c,
|
|
1495
1505
|
name: r == null ? a : r
|
|
1496
|
-
}, u = S(S(S(S({}, e.config.hooks.getPageAttributes()), e.config.hooks.getErrorAttributes()),
|
|
1497
|
-
outcome:
|
|
1498
|
-
spanType:
|
|
1506
|
+
}, u = S(S(S(S({}, e.config.hooks.getPageAttributes()), e.config.hooks.getErrorAttributes()), M({
|
|
1507
|
+
outcome: A.error,
|
|
1508
|
+
spanType: j.error
|
|
1499
1509
|
})), {}, {
|
|
1500
1510
|
"error.message": c,
|
|
1501
1511
|
"error.handled": !1,
|
|
@@ -1505,7 +1515,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1505
1515
|
code: t.ERROR,
|
|
1506
1516
|
message: c
|
|
1507
1517
|
}), d.end();
|
|
1508
|
-
},
|
|
1518
|
+
}, Mn = () => {
|
|
1509
1519
|
let e = [];
|
|
1510
1520
|
return {
|
|
1511
1521
|
name: "error",
|
|
@@ -1513,7 +1523,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1513
1523
|
if (typeof window > "u") return;
|
|
1514
1524
|
let n = (e) => {
|
|
1515
1525
|
var n;
|
|
1516
|
-
|
|
1526
|
+
jn({
|
|
1517
1527
|
context: t,
|
|
1518
1528
|
spanName: "browser.error",
|
|
1519
1529
|
source: "window.error",
|
|
@@ -1525,7 +1535,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1525
1535
|
}
|
|
1526
1536
|
});
|
|
1527
1537
|
}, r = (e) => {
|
|
1528
|
-
|
|
1538
|
+
jn({
|
|
1529
1539
|
context: t,
|
|
1530
1540
|
spanName: "browser.unhandledrejection",
|
|
1531
1541
|
source: "unhandledrejection",
|
|
@@ -1537,7 +1547,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1537
1547
|
let n = e.target;
|
|
1538
1548
|
if (!(n instanceof Element)) return;
|
|
1539
1549
|
let r = n, i = r.src || r.href || n.currentSrc || "";
|
|
1540
|
-
|
|
1550
|
+
jn({
|
|
1541
1551
|
context: t,
|
|
1542
1552
|
spanName: "browser.resource_error",
|
|
1543
1553
|
source: "resource",
|
|
@@ -1555,7 +1565,7 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1555
1565
|
}
|
|
1556
1566
|
}
|
|
1557
1567
|
};
|
|
1558
|
-
},
|
|
1568
|
+
}, Nn = 50, Pn = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : t, H = (e) => Number.isFinite(e) ? e : void 0, Fn = (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 } : {}), In = (e, t) => ({
|
|
1559
1569
|
"long_task.script.duration": e.duration,
|
|
1560
1570
|
"long_task.script.execution_start": e.executionStart,
|
|
1561
1571
|
"long_task.script.forced_style_and_layout_duration": e.forcedStyleAndLayoutDuration,
|
|
@@ -1567,8 +1577,8 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1567
1577
|
"long_task.script.source_url": e.sourceURL ? t(e.sourceURL) : "",
|
|
1568
1578
|
"long_task.script.start_time": e.startTime,
|
|
1569
1579
|
"long_task.script.window_attribution": e.windowAttribution
|
|
1570
|
-
}),
|
|
1571
|
-
let t =
|
|
1580
|
+
}), Ln = (e = {}) => {
|
|
1581
|
+
let t = Pn(e.threshold, Nn), n, r, i = [];
|
|
1572
1582
|
return {
|
|
1573
1583
|
name: "long-task",
|
|
1574
1584
|
init(e) {
|
|
@@ -1579,15 +1589,15 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1579
1589
|
let c = (n) => {
|
|
1580
1590
|
var r, i;
|
|
1581
1591
|
if (!e.isSampled() || !Number.isFinite(n.duration) || n.duration < t) return;
|
|
1582
|
-
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({}, e.config.hooks.getPageAttributes()),
|
|
1592
|
+
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({}, e.config.hooks.getPageAttributes()), M({ spanType: j.longTask })), H(o == null ? void 0 : o.blockingDuration) === void 0 ? {} : { [g.longTaskBlockingDuration]: o.blockingDuration }), {}, {
|
|
1583
1593
|
[g.longTaskEntryType]: d,
|
|
1584
1594
|
[g.longTaskId]: c,
|
|
1585
1595
|
"long_task.name": n.name
|
|
1586
|
-
},
|
|
1596
|
+
}, H(o == null ? void 0 : o.firstUIEventTimestamp) === void 0 ? {} : { "long_task.first_ui_event_timestamp": o.firstUIEventTimestamp }), H(o == null ? void 0 : o.renderStart) === void 0 ? {} : { "long_task.render_start": o.renderStart }), H(o == null ? void 0 : o.styleAndLayoutStart) === void 0 ? {} : { "long_task.style_and_layout_start": o.styleAndLayoutStart }), { startTime: l });
|
|
1587
1597
|
s.forEach((t) => {
|
|
1588
|
-
p.addEvent("long_task.script", e.applyRedact(
|
|
1598
|
+
p.addEvent("long_task.script", e.applyRedact(In(t, e.config.hooks.redactUrl)), performance.timeOrigin + t.startTime);
|
|
1589
1599
|
}), f.forEach((t, n) => {
|
|
1590
|
-
p.addEvent("long_task.attribution", e.applyRedact(S({ "long_task.attribution.index": n },
|
|
1600
|
+
p.addEvent("long_task.attribution", e.applyRedact(S({ "long_task.attribution.index": n }, Fn(t, e.config.hooks.redactUrl))), l);
|
|
1591
1601
|
}), p.end(u), e.notifyActivity({
|
|
1592
1602
|
endTime: u,
|
|
1593
1603
|
startTime: l,
|
|
@@ -1614,43 +1624,43 @@ var Pe = (e, t) => typeof e.enabled == "function" ? e.enabled(t) : e.enabled !==
|
|
|
1614
1624
|
n == null || n.disconnect(), n = void 0, clearTimeout(r), r = void 0, i = [];
|
|
1615
1625
|
}
|
|
1616
1626
|
};
|
|
1617
|
-
},
|
|
1618
|
-
let n =
|
|
1619
|
-
|
|
1627
|
+
}, U = /* @__PURE__ */ new Set(), W = "", G, K, q = !1, J = () => typeof location > "u" ? "" : location.href, Y = (e, t) => {
|
|
1628
|
+
let n = J();
|
|
1629
|
+
W = n;
|
|
1620
1630
|
let r = {
|
|
1621
1631
|
fromUrl: t,
|
|
1622
1632
|
source: e,
|
|
1623
1633
|
toUrl: n
|
|
1624
1634
|
};
|
|
1625
|
-
for (let e of Array.from(
|
|
1626
|
-
}, Ln = () => {
|
|
1627
|
-
In("popstate", G || Y());
|
|
1635
|
+
for (let e of Array.from(U)) e(r);
|
|
1628
1636
|
}, Rn = () => {
|
|
1629
|
-
|
|
1637
|
+
Y("popstate", W || J());
|
|
1630
1638
|
}, zn = () => {
|
|
1631
|
-
|
|
1632
|
-
|
|
1639
|
+
Y("hashchange", W || J());
|
|
1640
|
+
}, Bn = () => {
|
|
1641
|
+
q || typeof window > "u" || typeof history > "u" || (q = !0, W = J(), G = history.pushState, K = history.replaceState, history.pushState = function(e, t, n) {
|
|
1642
|
+
let r = W || J(), i = G == null ? void 0 : G.apply(this, [
|
|
1633
1643
|
e,
|
|
1634
1644
|
t,
|
|
1635
1645
|
n
|
|
1636
1646
|
]);
|
|
1637
|
-
return
|
|
1647
|
+
return Y("pushState", r), i;
|
|
1638
1648
|
}, history.replaceState = function(e, t, n) {
|
|
1639
|
-
let r =
|
|
1649
|
+
let r = W || J(), i = K == null ? void 0 : K.apply(this, [
|
|
1640
1650
|
e,
|
|
1641
1651
|
t,
|
|
1642
1652
|
n
|
|
1643
1653
|
]);
|
|
1644
|
-
return
|
|
1645
|
-
}, window.addEventListener("popstate",
|
|
1646
|
-
},
|
|
1647
|
-
!
|
|
1648
|
-
},
|
|
1649
|
-
|
|
1654
|
+
return Y("replaceState", r), i;
|
|
1655
|
+
}, window.addEventListener("popstate", Rn), window.addEventListener("hashchange", zn));
|
|
1656
|
+
}, Vn = () => {
|
|
1657
|
+
!q || typeof window > "u" || typeof history > "u" || (G && (history.pushState = G), K && (history.replaceState = K), window.removeEventListener("popstate", Rn), window.removeEventListener("hashchange", zn), G = void 0, K = void 0, q = !1, W = "");
|
|
1658
|
+
}, Hn = (e) => typeof window > "u" || typeof history > "u" ? () => {} : (Bn(), U.add(e), () => {
|
|
1659
|
+
U.delete(e), U.size === 0 && Vn();
|
|
1650
1660
|
});
|
|
1651
1661
|
//#endregion
|
|
1652
1662
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutPropertiesLoose.js
|
|
1653
|
-
function
|
|
1663
|
+
function Un(e, t) {
|
|
1654
1664
|
if (e == null) return {};
|
|
1655
1665
|
var n = {};
|
|
1656
1666
|
for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
|
|
@@ -1661,9 +1671,9 @@ function Hn(e, t) {
|
|
|
1661
1671
|
}
|
|
1662
1672
|
//#endregion
|
|
1663
1673
|
//#region \0@oxc-project+runtime@0.128.0/helpers/objectWithoutProperties.js
|
|
1664
|
-
function
|
|
1674
|
+
function Wn(e, t) {
|
|
1665
1675
|
if (e == null) return {};
|
|
1666
|
-
var n, r, i =
|
|
1676
|
+
var n, r, i = Un(e, t);
|
|
1667
1677
|
if (Object.getOwnPropertySymbols) {
|
|
1668
1678
|
var a = Object.getOwnPropertySymbols(e);
|
|
1669
1679
|
for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
|
|
@@ -1672,7 +1682,7 @@ function Un(e, t) {
|
|
|
1672
1682
|
}
|
|
1673
1683
|
//#endregion
|
|
1674
1684
|
//#region src/plugins/page-view.ts
|
|
1675
|
-
var
|
|
1685
|
+
var Gn = ["stopLoadingTime"], Kn = new Set(Object.values(g)), qn = () => typeof location > "u" ? "" : location.href, Jn = () => {
|
|
1676
1686
|
if (typeof performance > "u") return {};
|
|
1677
1687
|
let e = performance.getEntriesByType("navigation")[0];
|
|
1678
1688
|
if (!e) return {};
|
|
@@ -1680,10 +1690,10 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1680
1690
|
Number.isFinite(n) && n > 0 && (t[e] = n);
|
|
1681
1691
|
};
|
|
1682
1692
|
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;
|
|
1683
|
-
},
|
|
1693
|
+
}, Yn = (e) => {
|
|
1684
1694
|
let t = e.indexOf("?");
|
|
1685
1695
|
return t < 0 ? e : e.slice(0, t);
|
|
1686
|
-
},
|
|
1696
|
+
}, Xn = (e) => {
|
|
1687
1697
|
let t = e.slice(1);
|
|
1688
1698
|
if (!t || typeof document > "u" || typeof document.getElementById != "function") return !1;
|
|
1689
1699
|
try {
|
|
@@ -1691,14 +1701,14 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1691
1701
|
} catch (e) {
|
|
1692
1702
|
return !!document.getElementById(t);
|
|
1693
1703
|
}
|
|
1694
|
-
},
|
|
1704
|
+
}, Zn = (e, t) => {
|
|
1695
1705
|
try {
|
|
1696
1706
|
let n = typeof location > "u" ? "http://localhost" : location.href, r = new URL(e, n), i = new URL(t, n);
|
|
1697
|
-
return r.pathname !== i.pathname || !
|
|
1707
|
+
return r.pathname !== i.pathname || !Xn(i.hash) && Yn(r.hash) !== Yn(i.hash);
|
|
1698
1708
|
} catch (n) {
|
|
1699
1709
|
return e !== t;
|
|
1700
1710
|
}
|
|
1701
|
-
},
|
|
1711
|
+
}, Qn = () => {
|
|
1702
1712
|
let e = [];
|
|
1703
1713
|
return {
|
|
1704
1714
|
name: "page-view",
|
|
@@ -1725,10 +1735,10 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1725
1735
|
let s = S({}, n);
|
|
1726
1736
|
(i = n.stopLoadingTime) == null || i.call(n), o(n, "end", r, e), n = void 0, t && a(r);
|
|
1727
1737
|
let { stopLoadingTime: c } = s;
|
|
1728
|
-
return
|
|
1738
|
+
return Wn(s, Gn);
|
|
1729
1739
|
}, c = (e, t, r) => {
|
|
1730
1740
|
if (n !== e || !Number.isFinite(t) || t < 0) return;
|
|
1731
|
-
let i = S(S({}, e.loadingType === "initial_load" ?
|
|
1741
|
+
let i = S(S({}, e.loadingType === "initial_load" ? Jn() : {}), {}, {
|
|
1732
1742
|
[g.viewLoadingTime]: t,
|
|
1733
1743
|
[g.viewLoadingTimeSource]: r
|
|
1734
1744
|
});
|
|
@@ -1753,7 +1763,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1753
1763
|
};
|
|
1754
1764
|
window.addEventListener("load", t, { once: !0 }), s = () => window.removeEventListener("load", t);
|
|
1755
1765
|
}
|
|
1756
|
-
let p =
|
|
1766
|
+
let p = yt(t, e.startedAt, (t) => {
|
|
1757
1767
|
r = !0, t.hadActivity && (i = Math.max(0, t.endTime - e.startedAt)), d();
|
|
1758
1768
|
}), m = () => {
|
|
1759
1769
|
var t;
|
|
@@ -1764,38 +1774,39 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1764
1774
|
}, d();
|
|
1765
1775
|
}, u = (e) => {
|
|
1766
1776
|
let n = t.applyRedact(e == null ? {} : e);
|
|
1767
|
-
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !
|
|
1777
|
+
return Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0 && !Kn.has(e)));
|
|
1768
1778
|
}, d = (e, r, i, a = ((e) => (e = n == null ? void 0 : n.rawUrl) == null ? "" : e)()) => {
|
|
1769
1779
|
var c;
|
|
1770
1780
|
if (!t.isSessionActive()) return;
|
|
1771
|
-
let d = (c = e.url) == null ?
|
|
1781
|
+
let d = (c = e.url) == null ? qn() : c, f = t.config.hooks.getViewUrlTemplate(d), p = a ? t.config.hooks.getViewUrlTemplate(a) : "", m = e.name, _ = u(e.attributes);
|
|
1772
1782
|
s(r, !1);
|
|
1773
|
-
let
|
|
1783
|
+
let v = h("view"), y = t.config.hooks.redactUrl(d), b = t.config.hooks.redactUrl(a), x = i === "initial_load", C = x && typeof performance < "u" ? performance.timeOrigin : Date.now(), w = x ? Jn() : {};
|
|
1774
1784
|
t.setView({
|
|
1775
|
-
attributes:
|
|
1776
|
-
id:
|
|
1785
|
+
attributes: _,
|
|
1786
|
+
id: v,
|
|
1777
1787
|
loadingType: i,
|
|
1778
|
-
name:
|
|
1779
|
-
startedAt:
|
|
1780
|
-
url:
|
|
1788
|
+
name: m,
|
|
1789
|
+
startedAt: C,
|
|
1790
|
+
url: y,
|
|
1781
1791
|
urlTemplate: f
|
|
1782
|
-
},
|
|
1783
|
-
attributes:
|
|
1792
|
+
}, C), n = {
|
|
1793
|
+
attributes: _,
|
|
1784
1794
|
version: 0,
|
|
1785
|
-
id:
|
|
1795
|
+
id: v,
|
|
1786
1796
|
loadingType: i,
|
|
1787
|
-
name:
|
|
1797
|
+
name: m,
|
|
1788
1798
|
rawUrl: d,
|
|
1789
|
-
snapshotAttributes: S(S(S(S(S(S({},
|
|
1790
|
-
[g.viewUrl]:
|
|
1799
|
+
snapshotAttributes: S(S(S(S(S(S({}, _), t.config.hooks.getPageAttributes()), w), M({ spanType: j.view })), {}, { [g.viewId]: v }, m ? { [g.viewName]: m } : {}), {}, {
|
|
1800
|
+
[g.viewUrl]: y,
|
|
1791
1801
|
[g.viewUrlTemplate]: f,
|
|
1792
1802
|
[g.viewLoadingType]: i,
|
|
1793
|
-
[g.viewPrevious]:
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1803
|
+
[g.viewPrevious]: b,
|
|
1804
|
+
[g.viewPreviousUrlTemplate]: p
|
|
1805
|
+
}, x && document.referrer ? { [g.viewReferrer]: t.config.hooks.redactUrl(document.referrer) } : {}),
|
|
1806
|
+
startedAt: C,
|
|
1807
|
+
url: y,
|
|
1797
1808
|
urlTemplate: f
|
|
1798
|
-
}, o(n, "start",
|
|
1809
|
+
}, o(n, "start", C), l(n);
|
|
1799
1810
|
}, f = t.onViewCommand((e) => {
|
|
1800
1811
|
if (e.type === "start") {
|
|
1801
1812
|
d(e.options, "manual", n ? "route_change" : "initial_load");
|
|
@@ -1818,8 +1829,8 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1818
1829
|
}), o(n, "update"));
|
|
1819
1830
|
}
|
|
1820
1831
|
}), p = () => {};
|
|
1821
|
-
t.config.view.tracking === "auto" && (n || d({}, "load", "initial_load"), p =
|
|
1822
|
-
|
|
1832
|
+
t.config.view.tracking === "auto" && (n || d({}, "load", "initial_load"), p = Hn((e) => {
|
|
1833
|
+
Zn(e.fromUrl, e.toUrl) && d({}, e.source, "route_change", e.fromUrl);
|
|
1823
1834
|
}));
|
|
1824
1835
|
let m = (e) => {
|
|
1825
1836
|
if (e.persisted) {
|
|
@@ -1861,7 +1872,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1861
1872
|
}
|
|
1862
1873
|
}
|
|
1863
1874
|
};
|
|
1864
|
-
},
|
|
1875
|
+
}, $n = 5e3, er = (e) => typeof e == "number" && Number.isFinite(e) && e > 0, tr = (e, t, n, r) => ({
|
|
1865
1876
|
expiresAt: Math.min(t + n, t + r),
|
|
1866
1877
|
id: e,
|
|
1867
1878
|
startedAt: t,
|
|
@@ -1869,19 +1880,19 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1869
1880
|
}), X = (e, t, n) => {
|
|
1870
1881
|
if (t >= e.startedAt + n) return "maxLifetime";
|
|
1871
1882
|
if (t >= e.expiresAt) return "inactivity";
|
|
1872
|
-
},
|
|
1883
|
+
}, nr = (e, t, n, r) => S(S({}, e), {}, { expiresAt: Math.min(t + n, e.startedAt + r) }), rr = (e, t, n) => {
|
|
1873
1884
|
if (!e) return null;
|
|
1874
1885
|
try {
|
|
1875
1886
|
let r = JSON.parse(e);
|
|
1876
|
-
if (r.status === "active" && typeof r.id == "string" && r.id.length > 0 &&
|
|
1887
|
+
if (r.status === "active" && typeof r.id == "string" && r.id.length > 0 && er(r.startedAt) && r.startedAt <= t + $n && er(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") && er(r.expiredAt) && r.expiredAt <= t + $n) return r;
|
|
1877
1888
|
} catch (e) {}
|
|
1878
1889
|
return null;
|
|
1879
|
-
},
|
|
1890
|
+
}, ir = 900 * 1e3, Z = 14400 * 1e3, ar = 1e3, or = 6e4, sr = [
|
|
1880
1891
|
"click",
|
|
1881
1892
|
"keydown",
|
|
1882
1893
|
"scroll",
|
|
1883
1894
|
"touchstart"
|
|
1884
|
-
],
|
|
1895
|
+
], cr = /* @__PURE__ */ new Map(), lr = (e) => {
|
|
1885
1896
|
let t = typeof window < "u", n = () => {
|
|
1886
1897
|
var n;
|
|
1887
1898
|
if (t) try {
|
|
@@ -1889,21 +1900,21 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1889
1900
|
} catch (e) {
|
|
1890
1901
|
t = !1;
|
|
1891
1902
|
}
|
|
1892
|
-
return (n =
|
|
1903
|
+
return (n = cr.get(e)) == null ? null : n;
|
|
1893
1904
|
};
|
|
1894
1905
|
return n(), {
|
|
1895
1906
|
isLocalStorage: () => t,
|
|
1896
1907
|
read: n,
|
|
1897
1908
|
write: (n) => {
|
|
1898
1909
|
let r = JSON.stringify(n);
|
|
1899
|
-
if (
|
|
1910
|
+
if (cr.set(e, r), t) try {
|
|
1900
1911
|
window.localStorage.setItem(e, r);
|
|
1901
1912
|
} catch (e) {
|
|
1902
1913
|
t = !1;
|
|
1903
1914
|
}
|
|
1904
1915
|
}
|
|
1905
1916
|
};
|
|
1906
|
-
},
|
|
1917
|
+
}, ur = (e, t) => {
|
|
1907
1918
|
let n = "";
|
|
1908
1919
|
try {
|
|
1909
1920
|
n = new URL(e).host;
|
|
@@ -1911,8 +1922,8 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1911
1922
|
n = e;
|
|
1912
1923
|
}
|
|
1913
1924
|
return `bk_ot_session__${m(`${t}\0${n || "default"}`)}`;
|
|
1914
|
-
},
|
|
1915
|
-
e.startSpan("browser.session", S(S(S({}, e.config.hooks.getPageAttributes()),
|
|
1925
|
+
}, dr = (e, t, n, r) => {
|
|
1926
|
+
e.startSpan("browser.session", S(S(S({}, e.config.hooks.getPageAttributes()), M({ spanType: j.session })), {}, {
|
|
1916
1927
|
[g.sessionPhase]: t,
|
|
1917
1928
|
[g.sessionHasReplay]: !1,
|
|
1918
1929
|
[g.sessionId]: n,
|
|
@@ -1921,7 +1932,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1921
1932
|
contextTime: r,
|
|
1922
1933
|
startTime: r
|
|
1923
1934
|
}).end(r);
|
|
1924
|
-
},
|
|
1935
|
+
}, fr = (e = {}) => {
|
|
1925
1936
|
let t = [];
|
|
1926
1937
|
return {
|
|
1927
1938
|
name: "session",
|
|
@@ -1936,7 +1947,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1936
1947
|
}, e);
|
|
1937
1948
|
return;
|
|
1938
1949
|
}
|
|
1939
|
-
let i = (r = e.storageKey) == null ?
|
|
1950
|
+
let i = (r = e.storageKey) == null ? ur(n.config.transport.endpoint, n.config.application.name) : r, a = lr(i), o = typeof performance < "u" && Number.isFinite(performance.timeOrigin) ? performance.timeOrigin : Date.now(), s, c, l = (e = Date.now()) => rr(a.read(), e, Z), u = () => {
|
|
1940
1951
|
c !== void 0 && (clearTimeout(c), c = void 0);
|
|
1941
1952
|
}, d = (e, t = Date.now()) => {
|
|
1942
1953
|
let r = s;
|
|
@@ -1945,7 +1956,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1945
1956
|
id: r,
|
|
1946
1957
|
reason: e,
|
|
1947
1958
|
type: "expired"
|
|
1948
|
-
}),
|
|
1959
|
+
}), dr(n, "end", r, t), u(), s = void 0, n.setRuntimeAttributes({
|
|
1949
1960
|
[g.sessionHasReplay]: void 0,
|
|
1950
1961
|
[g.sessionId]: void 0,
|
|
1951
1962
|
[g.sessionType]: void 0
|
|
@@ -1996,15 +2007,15 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
1996
2007
|
}, _ = (e = !1) => {
|
|
1997
2008
|
let t = Date.now(), r = l(t);
|
|
1998
2009
|
if ((r == null ? void 0 : r.status) === "active" && !X(r, t, Z)) {
|
|
1999
|
-
let e =
|
|
2010
|
+
let e = nr(r, t, ir, Z);
|
|
2000
2011
|
a.write(e), m(e, s ? void 0 : { reason: "shared" });
|
|
2001
2012
|
return;
|
|
2002
2013
|
}
|
|
2003
|
-
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 ? X(r, t, Z) : e ? "init" : void 0, c =
|
|
2014
|
+
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 ? X(r, t, Z) : e ? "init" : void 0, c = tr(h("session"), t, ir, Z);
|
|
2004
2015
|
a.write(c), m(c, {
|
|
2005
2016
|
previousId: i,
|
|
2006
2017
|
reason: o == null ? "init" : o
|
|
2007
|
-
}),
|
|
2018
|
+
}), dr(n, (o == null ? "init" : o) === "init" ? "start" : "rotate", c.id, c.startedAt);
|
|
2008
2019
|
}, v = () => {
|
|
2009
2020
|
if (!s) return;
|
|
2010
2021
|
let e = Date.now(), t = l(e);
|
|
@@ -2012,31 +2023,31 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2012
2023
|
f();
|
|
2013
2024
|
return;
|
|
2014
2025
|
}
|
|
2015
|
-
let n =
|
|
2026
|
+
let n = nr(t, e, ir, Z);
|
|
2016
2027
|
a.write(n), m(n);
|
|
2017
2028
|
};
|
|
2018
2029
|
_(!0);
|
|
2019
2030
|
let y = 0, b = () => {
|
|
2020
2031
|
let e = Date.now();
|
|
2021
|
-
e - y <
|
|
2032
|
+
e - y < ar || (y = e, _());
|
|
2022
2033
|
}, x = {
|
|
2023
2034
|
capture: !0,
|
|
2024
2035
|
passive: !0
|
|
2025
2036
|
};
|
|
2026
|
-
|
|
2027
|
-
|
|
2037
|
+
sr.forEach((e) => window.addEventListener(e, b, x)), t.push(() => {
|
|
2038
|
+
sr.forEach((e) => window.removeEventListener(e, b, x));
|
|
2028
2039
|
});
|
|
2029
2040
|
let S = () => {
|
|
2030
2041
|
document.visibilityState === "visible" && v();
|
|
2031
2042
|
};
|
|
2032
2043
|
document.addEventListener("visibilitychange", S);
|
|
2033
|
-
let C = window.setInterval(S,
|
|
2044
|
+
let C = window.setInterval(S, or);
|
|
2034
2045
|
t.push(() => {
|
|
2035
2046
|
document.removeEventListener("visibilitychange", S), window.clearInterval(C);
|
|
2036
2047
|
});
|
|
2037
2048
|
let w = (e) => {
|
|
2038
2049
|
if (!a.isLocalStorage() || e.storageArea !== window.localStorage || e.key !== i) return;
|
|
2039
|
-
let t = Date.now(), n =
|
|
2050
|
+
let t = Date.now(), n = rr(e.newValue, t, Z);
|
|
2040
2051
|
if ((n == null ? void 0 : n.status) === "active" && n.id === s && !X(n, t, Z)) {
|
|
2041
2052
|
p(n);
|
|
2042
2053
|
return;
|
|
@@ -2049,38 +2060,38 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2049
2060
|
for (var e; t.length;) (e = t.pop()) == null || e();
|
|
2050
2061
|
}
|
|
2051
2062
|
};
|
|
2052
|
-
},
|
|
2063
|
+
}, pr = 10, mr = 6e4, hr = 5e3, gr = 1e3, _r = (e, t) => !!t && e === t, vr = (e, t) => {
|
|
2053
2064
|
let [n, r] = e === "CLS" ? [.1, .25] : [200, 500];
|
|
2054
2065
|
return t <= n ? "good" : t <= r ? "needs-improvement" : "poor";
|
|
2055
|
-
},
|
|
2066
|
+
}, yr = (e) => {
|
|
2056
2067
|
var t, n, r;
|
|
2057
2068
|
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;
|
|
2058
|
-
},
|
|
2069
|
+
}, br = () => {
|
|
2059
2070
|
if (typeof performance > "u") return;
|
|
2060
2071
|
let e = performance.interactionCount;
|
|
2061
2072
|
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
2062
|
-
},
|
|
2073
|
+
}, xr = (e, t) => {
|
|
2063
2074
|
var n, r;
|
|
2064
2075
|
let i = (n = t.value) == null ? 0 : n;
|
|
2065
|
-
t.hadRecentInput || !Number.isFinite(i) || (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >=
|
|
2066
|
-
},
|
|
2076
|
+
t.hadRecentInput || !Number.isFinite(i) || (e.clsWindowStart === void 0 || t.startTime - ((r = e.clsWindowEnd) == null ? t.startTime : r) >= gr || t.startTime - e.clsWindowStart >= hr ? (e.clsWindowStart = t.startTime, e.clsWindowValue = i) : e.clsWindowValue += i, e.clsWindowEnd = t.startTime, e.clsWindowValue > e.cls && (e.cls = Math.round(e.clsWindowValue * 1e4) / 1e4));
|
|
2077
|
+
}, Sr = (e, t) => {
|
|
2067
2078
|
var n, r;
|
|
2068
2079
|
if (!t.interactionId || !Number.isFinite(t.duration)) return;
|
|
2069
2080
|
e.interactionIdMin = Math.min(e.interactionIdMin, t.interactionId), e.interactionIdMax = Math.max(e.interactionIdMax, t.interactionId);
|
|
2070
2081
|
let i = (n = t.processingStart) == null ? t.startTime : n, a = (r = t.processingEnd) == null ? i : r, o = {
|
|
2071
|
-
duration: Math.min(t.duration,
|
|
2082
|
+
duration: Math.min(t.duration, mr),
|
|
2072
2083
|
inputDelay: Math.max(0, i - t.startTime),
|
|
2073
2084
|
interactionId: t.interactionId,
|
|
2074
|
-
interactionTarget:
|
|
2085
|
+
interactionTarget: yr(t.target),
|
|
2075
2086
|
interactionType: t.name,
|
|
2076
2087
|
presentationDelay: Math.max(0, t.startTime + t.duration - a),
|
|
2077
2088
|
processingDuration: Math.max(0, a - i)
|
|
2078
2089
|
}, s = e.inpCandidates.findIndex((e) => e.interactionId === t.interactionId);
|
|
2079
|
-
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(
|
|
2080
|
-
},
|
|
2081
|
-
let t =
|
|
2090
|
+
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(pr);
|
|
2091
|
+
}, Cr = (e) => {
|
|
2092
|
+
let t = br(), n = t !== void 0 && e.interactionCountAtStart !== void 0 ? Math.max(0, t - e.interactionCountAtStart) : e.interactionIdMin === Infinity ? 0 : (e.interactionIdMax - e.interactionIdMin) / 7 + 1;
|
|
2082
2093
|
if (e.inpCandidates.length) return e.inpCandidates[Math.min(e.inpCandidates.length - 1, Math.floor(n / 50))];
|
|
2083
|
-
},
|
|
2094
|
+
}, wr = (e, t) => {
|
|
2084
2095
|
var n;
|
|
2085
2096
|
let r = (n = e.attribution) == null ? {} : n, i = {}, a = (e) => r[e], o = (e, t, n) => {
|
|
2086
2097
|
t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") && (i[e] = typeof t == "string" && n ? n(t) : t);
|
|
@@ -2101,12 +2112,12 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2101
2112
|
default: break;
|
|
2102
2113
|
}
|
|
2103
2114
|
return i;
|
|
2104
|
-
},
|
|
2115
|
+
}, Tr = () => {
|
|
2105
2116
|
let e, t = !1;
|
|
2106
2117
|
return {
|
|
2107
2118
|
name: "web-vitals",
|
|
2108
2119
|
init(n) {
|
|
2109
|
-
return
|
|
2120
|
+
return k(function* () {
|
|
2110
2121
|
if (typeof window > "u") return;
|
|
2111
2122
|
let r;
|
|
2112
2123
|
try {
|
|
@@ -2122,14 +2133,14 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2122
2133
|
let { onFCP: a, onLCP: o, onTTFB: s } = r, c = (e, t, r, i = r == null ? Date.now() : r) => {
|
|
2123
2134
|
if (!n.isSampled()) return;
|
|
2124
2135
|
let a = e.name.toLowerCase();
|
|
2125
|
-
n.startSpan("browser.web_vital", S(S(S(S({}, n.config.hooks.getPageAttributes()), t),
|
|
2136
|
+
n.startSpan("browser.web_vital", S(S(S(S({}, n.config.hooks.getPageAttributes()), t), M({
|
|
2126
2137
|
outcome: Je(e.rating),
|
|
2127
|
-
spanType:
|
|
2138
|
+
spanType: j.vital
|
|
2128
2139
|
})), {}, {
|
|
2129
2140
|
[g.vitalMetric]: a,
|
|
2130
2141
|
[g.vitalValue]: e.value,
|
|
2131
2142
|
"vital.id": e.id
|
|
2132
|
-
},
|
|
2143
|
+
}, wr(e, n.config.hooks.redactUrl)), {
|
|
2133
2144
|
contextTime: r,
|
|
2134
2145
|
startTime: i
|
|
2135
2146
|
}).end(i);
|
|
@@ -2147,10 +2158,10 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2147
2158
|
entries: [],
|
|
2148
2159
|
id: h("vital"),
|
|
2149
2160
|
name: "CLS",
|
|
2150
|
-
rating:
|
|
2161
|
+
rating: vr("CLS", e.cls),
|
|
2151
2162
|
value: e.cls
|
|
2152
2163
|
}, e.runtimeAttributes, e.startedAt);
|
|
2153
|
-
let t =
|
|
2164
|
+
let t = Cr(e);
|
|
2154
2165
|
t && p({
|
|
2155
2166
|
attribution: {
|
|
2156
2167
|
inputDelay: t.inputDelay,
|
|
@@ -2162,13 +2173,13 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2162
2173
|
entries: [],
|
|
2163
2174
|
id: h("vital"),
|
|
2164
2175
|
name: "INP",
|
|
2165
|
-
rating:
|
|
2176
|
+
rating: vr("INP", t.duration),
|
|
2166
2177
|
value: t.duration
|
|
2167
2178
|
}, e.runtimeAttributes, e.startedAt);
|
|
2168
2179
|
}, _ = n.onViewChange((e) => {
|
|
2169
2180
|
var t;
|
|
2170
2181
|
let r = u;
|
|
2171
|
-
if (r &&
|
|
2182
|
+
if (r && _r(r.id, e.id)) {
|
|
2172
2183
|
r.runtimeAttributes = S(S(S({}, r.runtimeAttributes), {}, { [g.viewId]: e.id }, e.name ? { [g.viewName]: e.name } : {}), {}, {
|
|
2173
2184
|
[g.viewUrl]: e.url,
|
|
2174
2185
|
[g.viewUrlTemplate]: e.urlTemplate
|
|
@@ -2178,7 +2189,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2178
2189
|
m(), u = e.id ? {
|
|
2179
2190
|
cls: 0,
|
|
2180
2191
|
clsWindowValue: 0,
|
|
2181
|
-
interactionCountAtStart:
|
|
2192
|
+
interactionCountAtStart: br(),
|
|
2182
2193
|
interactionIdMax: 0,
|
|
2183
2194
|
interactionIdMin: Infinity,
|
|
2184
2195
|
inpCandidates: [],
|
|
@@ -2190,12 +2201,12 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2190
2201
|
if (typeof PerformanceObserver < "u") {
|
|
2191
2202
|
var v, y;
|
|
2192
2203
|
(v = PerformanceObserver.supportedEntryTypes) != null && v.includes("layout-shift") && (f = new PerformanceObserver((e) => {
|
|
2193
|
-
if (u) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < u.startedAt ||
|
|
2204
|
+
if (u) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < u.startedAt || xr(u, t);
|
|
2194
2205
|
}), f.observe({
|
|
2195
2206
|
buffered: !0,
|
|
2196
2207
|
type: "layout-shift"
|
|
2197
2208
|
})), (y = PerformanceObserver.supportedEntryTypes) != null && y.includes("event") && (d = new PerformanceObserver((e) => {
|
|
2198
|
-
if (u) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < u.startedAt || !t.interactionId || !Number.isFinite(t.duration) ||
|
|
2209
|
+
if (u) for (let t of e.getEntries()) performance.timeOrigin + t.startTime < u.startedAt || !t.interactionId || !Number.isFinite(t.duration) || Sr(u, t);
|
|
2199
2210
|
}), d.observe({
|
|
2200
2211
|
buffered: !0,
|
|
2201
2212
|
durationThreshold: 40,
|
|
@@ -2211,7 +2222,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2211
2222
|
t = !0, e == null || e(), e = void 0;
|
|
2212
2223
|
}
|
|
2213
2224
|
};
|
|
2214
|
-
},
|
|
2225
|
+
}, Er = (e, t) => {
|
|
2215
2226
|
let n = {
|
|
2216
2227
|
"network.protocol.name": "websocket",
|
|
2217
2228
|
"url.full": t(e)
|
|
@@ -2221,13 +2232,13 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2221
2232
|
n["server.address"] = t.hostname, t.port && (n["server.port"] = Number(t.port)), n["url.scheme"] = t.protocol.replace(":", "");
|
|
2222
2233
|
} catch (e) {}
|
|
2223
2234
|
return n;
|
|
2224
|
-
},
|
|
2225
|
-
let a = h("websocket"), o =
|
|
2235
|
+
}, Dr = (t, n, r, i) => {
|
|
2236
|
+
let a = h("websocket"), o = Er(r, n.config.hooks.redactUrl), s = !1, c = (t, r, s = {}) => {
|
|
2226
2237
|
if (i() || !n.isSampled()) return;
|
|
2227
2238
|
let c = t === "error";
|
|
2228
|
-
n.startSpan("browser.websocket", S(S(S({}, o),
|
|
2229
|
-
outcome: c ?
|
|
2230
|
-
spanType:
|
|
2239
|
+
n.startSpan("browser.websocket", S(S(S({}, o), M({
|
|
2240
|
+
outcome: c ? A.error : A.success,
|
|
2241
|
+
spanType: j.websocket
|
|
2231
2242
|
})), {}, {
|
|
2232
2243
|
[g.websocketPhase]: t,
|
|
2233
2244
|
"websocket.connection.id": a
|
|
@@ -2247,7 +2258,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2247
2258
|
"websocket.close.was_clean": e.wasClean
|
|
2248
2259
|
});
|
|
2249
2260
|
});
|
|
2250
|
-
},
|
|
2261
|
+
}, Or = () => {
|
|
2251
2262
|
let e, t, n = !1;
|
|
2252
2263
|
return {
|
|
2253
2264
|
name: "websocket",
|
|
@@ -2258,29 +2269,29 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2258
2269
|
let a = Reflect.construct(e, t, i);
|
|
2259
2270
|
if (n || !r.isSampled()) return a;
|
|
2260
2271
|
let o = t[0] == null ? "" : String(t[0]);
|
|
2261
|
-
return o && !
|
|
2272
|
+
return o && !D(r.config, o) && Dr(a, r, o, () => n), a;
|
|
2262
2273
|
} }), window.WebSocket = t;
|
|
2263
2274
|
},
|
|
2264
2275
|
shutdown() {
|
|
2265
2276
|
n = !0, typeof window < "u" && e && window.WebSocket === t && (window.WebSocket = e), t = void 0, e = void 0;
|
|
2266
2277
|
}
|
|
2267
2278
|
};
|
|
2268
|
-
},
|
|
2279
|
+
}, kr = class {
|
|
2269
2280
|
constructor() {
|
|
2270
2281
|
b(this, "listeners", /* @__PURE__ */ new Set()), b(this, "notify", (e) => {
|
|
2271
2282
|
this.listeners.forEach((t) => t(e));
|
|
2272
2283
|
}), b(this, "subscribe", (e) => (this.listeners.add(e), () => this.listeners.delete(e)));
|
|
2273
2284
|
}
|
|
2274
|
-
},
|
|
2285
|
+
}, Ar = (e) => {
|
|
2275
2286
|
let t = 2166136261;
|
|
2276
2287
|
for (let n = 0; n < e.length; n += 1) t = Math.imul(t ^ e.charCodeAt(n), 16777619);
|
|
2277
2288
|
return t += t << 13, t ^= t >>> 7, t += t << 3, t ^= t >>> 17, t += t << 5, (t >>> 0) / 4294967296;
|
|
2278
|
-
},
|
|
2289
|
+
}, jr = ({ application: e, session: t }, n) => t.sampleRate <= 0 ? !1 : t.sampleRate >= 1 ? !0 : Ar(`${e.name}\0${n}`) < t.sampleRate, Mr = (e) => ({
|
|
2279
2290
|
url: e.endpoint,
|
|
2280
2291
|
headers: e.headers,
|
|
2281
2292
|
concurrencyLimit: e.concurrencyLimit,
|
|
2282
2293
|
timeoutMillis: e.timeoutMillis
|
|
2283
|
-
}),
|
|
2294
|
+
}), Nr = "bk-rum", Pr = class {
|
|
2284
2295
|
constructor(e) {
|
|
2285
2296
|
this.isSampled = e;
|
|
2286
2297
|
}
|
|
@@ -2290,7 +2301,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2290
2301
|
toString() {
|
|
2291
2302
|
return "RumSessionSampler";
|
|
2292
2303
|
}
|
|
2293
|
-
}, Q,
|
|
2304
|
+
}, Q, Fr = () => {
|
|
2294
2305
|
if (Q) Q.users += 1;
|
|
2295
2306
|
else {
|
|
2296
2307
|
let e = new a().enable(), t = r.setGlobalContextManager(e);
|
|
@@ -2305,28 +2316,28 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2305
2316
|
return () => {
|
|
2306
2317
|
e || !Q || (e = !0, --Q.users, !(Q.users > 0) && (Q.ownsContext && r.disable(), Q.ownsPropagator && i.disable(), Q = void 0));
|
|
2307
2318
|
};
|
|
2308
|
-
},
|
|
2319
|
+
}, Ir = (e, t) => t ? new Proxy(e, { get(e, t, n) {
|
|
2309
2320
|
if (t === "export") return (t, n) => {
|
|
2310
2321
|
var r;
|
|
2311
2322
|
return (r = globalThis.console) == null || r.log("[bk-ot][rum]", t), e.export(t, n);
|
|
2312
2323
|
};
|
|
2313
2324
|
let r = Reflect.get(e, t, n);
|
|
2314
2325
|
return typeof r == "function" ? r.bind(e) : r;
|
|
2315
|
-
} }) : e,
|
|
2316
|
-
|
|
2326
|
+
} }) : e, Lr = (e) => [En(e.tracking.request)], Rr = (e) => [
|
|
2327
|
+
fr(e.session),
|
|
2317
2328
|
...$(e.tracking.device, !0, ce),
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
],
|
|
2322
|
-
...$(e.error, !0,
|
|
2323
|
-
...$(e.webVitals, !0,
|
|
2324
|
-
...$(e.blankScreen, !0,
|
|
2325
|
-
...$(e.action, !0,
|
|
2326
|
-
...$(e.websocket, !1,
|
|
2327
|
-
...$(e.longTask, !1,
|
|
2328
|
-
...$(e.cspViolation, !1,
|
|
2329
|
-
],
|
|
2329
|
+
_t(),
|
|
2330
|
+
Qn(),
|
|
2331
|
+
cn(zr(e.tracking.resource, !0))
|
|
2332
|
+
], zr = (e, t) => e === void 0 ? t : e !== !1, Br = (e) => typeof e == "object" && e ? e : void 0, $ = (e, t, n) => zr(e, t) ? [n(Br(e))] : [], Vr = (e) => [
|
|
2333
|
+
...$(e.error, !0, Mn),
|
|
2334
|
+
...$(e.webVitals, !0, Tr),
|
|
2335
|
+
...$(e.blankScreen, !0, Mt),
|
|
2336
|
+
...$(e.action, !0, mt),
|
|
2337
|
+
...$(e.websocket, !1, Or),
|
|
2338
|
+
...$(e.longTask, !1, Ln),
|
|
2339
|
+
...$(e.cspViolation, !1, kn)
|
|
2340
|
+
], Hr = class {
|
|
2330
2341
|
assertBeforeStart(e) {
|
|
2331
2342
|
if (this.phase !== "idle") throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`);
|
|
2332
2343
|
}
|
|
@@ -2356,20 +2367,20 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2356
2367
|
}
|
|
2357
2368
|
createPluginManager() {
|
|
2358
2369
|
var e;
|
|
2359
|
-
return new
|
|
2370
|
+
return new Fe([
|
|
2371
|
+
...Rr(this.config),
|
|
2360
2372
|
...Lr(this.config),
|
|
2361
|
-
...
|
|
2362
|
-
...Br(this.config.tracking),
|
|
2373
|
+
...Vr(this.config.tracking),
|
|
2363
2374
|
...(e = this.config.extensions.plugins) == null ? [] : e
|
|
2364
2375
|
]);
|
|
2365
2376
|
}
|
|
2366
2377
|
constructor(n) {
|
|
2367
2378
|
var r = this;
|
|
2368
|
-
b(this, "activityObserver", new
|
|
2379
|
+
b(this, "activityObserver", new kr()), b(this, "flushProviders", k(function* () {
|
|
2369
2380
|
yield r.tracerProvider.forceFlush();
|
|
2370
|
-
})), 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",
|
|
2381
|
+
})), 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", k(function* () {
|
|
2371
2382
|
if (r.pluginManager || !r.config.enabled || r.config.trackingConsent !== "granted") return;
|
|
2372
|
-
r.releaseOtelGlobals =
|
|
2383
|
+
r.releaseOtelGlobals = Fr();
|
|
2373
2384
|
let e = r.createPluginManager();
|
|
2374
2385
|
r.pluginManager = e;
|
|
2375
2386
|
try {
|
|
@@ -2381,7 +2392,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2381
2392
|
throw (a = r.releaseOtelGlobals) == null || a.call(r), r.releaseOtelGlobals = void 0, t;
|
|
2382
2393
|
}
|
|
2383
2394
|
})), b(this, "stopCollection", function() {
|
|
2384
|
-
var e =
|
|
2395
|
+
var e = k(function* (e) {
|
|
2385
2396
|
var t, n, i;
|
|
2386
2397
|
let a = r.pluginManager;
|
|
2387
2398
|
if (a) {
|
|
@@ -2395,7 +2406,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2395
2406
|
return function(t) {
|
|
2396
2407
|
return e.apply(this, arguments);
|
|
2397
2408
|
};
|
|
2398
|
-
}()), 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",
|
|
2409
|
+
}()), 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", k(function* () {
|
|
2399
2410
|
var e;
|
|
2400
2411
|
yield (e = r.pluginManager) == null ? void 0 : e.flush(), yield r.flushProviders();
|
|
2401
2412
|
})), 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) => {
|
|
@@ -2407,7 +2418,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2407
2418
|
}), b(this, "reportAction", ({ attributes: e = {}, name: t }) => {
|
|
2408
2419
|
if (!this.isSampled()) return;
|
|
2409
2420
|
let n = h("action"), r = Date.now();
|
|
2410
|
-
this.startSpan(`action.${t}`, S(S(S(S({}, this.config.hooks.getPageAttributes()), e),
|
|
2421
|
+
this.startSpan(`action.${t}`, S(S(S(S({}, this.config.hooks.getPageAttributes()), e), M({ spanType: j.action })), {}, {
|
|
2411
2422
|
[g.actionId]: n,
|
|
2412
2423
|
[g.actionType]: "custom"
|
|
2413
2424
|
}), { startTime: r }).end(r);
|
|
@@ -2419,9 +2430,9 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2419
2430
|
}
|
|
2420
2431
|
return;
|
|
2421
2432
|
}
|
|
2422
|
-
let a = Date.now(), o = this.startSpan(`custom.${r}`, S(S(S(S({}, this.config.hooks.getPageAttributes()), this.config.hooks.getCustomAttributes()), e),
|
|
2423
|
-
outcome: n ?
|
|
2424
|
-
spanType:
|
|
2433
|
+
let a = Date.now(), o = this.startSpan(`custom.${r}`, S(S(S(S({}, this.config.hooks.getPageAttributes()), this.config.hooks.getCustomAttributes()), e), M({
|
|
2434
|
+
outcome: n ? A.error : A.success,
|
|
2435
|
+
spanType: j.custom
|
|
2425
2436
|
})), { startTime: a });
|
|
2426
2437
|
n && (o.recordException(n), o.setStatus({
|
|
2427
2438
|
code: t.ERROR,
|
|
@@ -2431,11 +2442,11 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2431
2442
|
let n = S({}, e), r = t == null ? Date.now() : t;
|
|
2432
2443
|
if (g.sessionId in e) {
|
|
2433
2444
|
let t = e[g.sessionId];
|
|
2434
|
-
this.sampled = this.config.enabled && typeof t == "string" && t.length > 0 ?
|
|
2445
|
+
this.sampled = this.config.enabled && typeof t == "string" && t.length > 0 ? jr(this.config, t) : !1, this.runtimeContext.setSessionSampled(this.sampled, r);
|
|
2435
2446
|
}
|
|
2436
2447
|
this.runtimeContext.setAttributes(n, r);
|
|
2437
2448
|
}), b(this, "setTrackingConsent", function() {
|
|
2438
|
-
var e =
|
|
2449
|
+
var e = k(function* (e) {
|
|
2439
2450
|
r.config.trackingConsent !== e && (r.config.trackingConsent = e, r.phase === "started" && (e === "granted" ? yield r.startCollection() : yield r.stopCollection(!0)));
|
|
2440
2451
|
});
|
|
2441
2452
|
return function(t) {
|
|
@@ -2453,7 +2464,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2453
2464
|
name: e,
|
|
2454
2465
|
type: "set_name"
|
|
2455
2466
|
});
|
|
2456
|
-
}), b(this, "shutdown",
|
|
2467
|
+
}), b(this, "shutdown", k(function* () {
|
|
2457
2468
|
if (r.phase !== "stopped") {
|
|
2458
2469
|
for (yield r.stopCollection(!1), yield r.flushProviders(); r.teardownCallbacks.length;) {
|
|
2459
2470
|
var e;
|
|
@@ -2461,7 +2472,7 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2461
2472
|
}
|
|
2462
2473
|
yield r.tracerProvider.shutdown(), r.phase = "stopped";
|
|
2463
2474
|
}
|
|
2464
|
-
})), b(this, "start",
|
|
2475
|
+
})), b(this, "start", k(function* () {
|
|
2465
2476
|
if (!(r.phase === "started" || r.phase === "starting")) {
|
|
2466
2477
|
if (r.phase === "stopped") throw Error("[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.");
|
|
2467
2478
|
if (!r.config.enabled) {
|
|
@@ -2509,20 +2520,20 @@ var Wn = ["stopLoadingTime"], Gn = new Set(Object.values(g)), Kn = () => typeof
|
|
|
2509
2520
|
}), b(this, "useInstrumentation", (e) => {
|
|
2510
2521
|
var t;
|
|
2511
2522
|
return this.assertBeforeStart("useInstrumentation"), this.config.enabled && ((t = this.config.extensions.instrumentations) == null || t.push(e)), this;
|
|
2512
|
-
}), this.config =
|
|
2523
|
+
}), this.config = je(n), this.runtimeContext = new Ke({}, this.config.user);
|
|
2513
2524
|
let i = c(this.config.resourceAttributes), a = (() => {
|
|
2514
|
-
let e =
|
|
2515
|
-
return [new
|
|
2525
|
+
let e = Ir(new s(Mr(this.config.transport)), this.config.debug);
|
|
2526
|
+
return [new Ue(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())))];
|
|
2516
2527
|
})();
|
|
2517
2528
|
this.tracerProvider = new f({
|
|
2518
2529
|
resource: i,
|
|
2519
|
-
sampler: new
|
|
2530
|
+
sampler: new Pr(this.isSampled),
|
|
2520
2531
|
spanProcessors: a
|
|
2521
|
-
}), this.tracer = this.tracerProvider.getTracer(
|
|
2532
|
+
}), this.tracer = this.tracerProvider.getTracer(Nr), this.registeredInstrumentations = [], this.config.autoStart && this.start().catch((e) => {
|
|
2522
2533
|
var t;
|
|
2523
2534
|
(t = globalThis.console) == null || t.warn("[bk-ot] auto start failed:", e);
|
|
2524
2535
|
});
|
|
2525
2536
|
}
|
|
2526
2537
|
};
|
|
2527
2538
|
//#endregion
|
|
2528
|
-
export {
|
|
2539
|
+
export { Hr as BkOpenTelemetry, ht as EXCLUDED_ACTIVITY_MUTATIONS_ATTRIBUTE, Ue as FilteringSpanProcessor, g as RUM_ATTRIBUTES, A as RUM_SPAN_OUTCOME, j as RUM_SPAN_TYPE, Ke as RumRuntimeContext, M as buildRumSpanAttributes, mt as createActionPlugin, Mt as createBlankScreenPlugin, En as createCommonInstrumentationsPlugin, kn as createCspViolationPlugin, ce as createDevicePlugin, Mn as createErrorPlugin, Ln as createLongTaskPlugin, Pe as createPlugin, cn as createResourcePlugin, fr as createSessionPlugin, Or as createWebSocketPlugin, Tr as createWebVitalsPlugin, je as resolveConfig };
|