@sentry/replay 7.91.0 → 7.93.0

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/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
- import { addBreadcrumb, getClient, isSentryRequestUrl, getCurrentScope, addEventProcessor, prepareEvent, getIsolationScope, setContext, captureException } from '@sentry/core';
1
+ import { _nullishCoalesce, _optionalChain } from '@sentry/utils';
2
+ import { addBreadcrumb, getClient, isSentryRequestUrl, getCurrentScope, addEventProcessor, prepareEvent, getIsolationScope, setContext, captureException, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
2
3
  import { GLOBAL_OBJ, normalize, fill, htmlTreeAsString, browserPerformanceTimeOrigin, logger, uuid4, SENTRY_XHR_DATA_KEY, dropUndefinedKeys, stringMatchesSomePattern, addFetchInstrumentationHandler, addXhrInstrumentationHandler, addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, updateRateLimits, isRateLimited, consoleSandbox, isBrowser } from '@sentry/utils';
3
4
  import { addPerformanceInstrumentationHandler, addLcpInstrumentationHandler } from '@sentry-internal/tracing';
4
5
 
@@ -82,7 +83,7 @@ const CANVAS_QUALITY = {
82
83
  },
83
84
  };
84
85
 
85
- var NodeType$1;
86
+ function _nullishCoalesce$1(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var NodeType$1;
86
87
  (function (NodeType) {
87
88
  NodeType[NodeType["Document"] = 0] = "Document";
88
89
  NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
@@ -96,8 +97,8 @@ function isElement$1(n) {
96
97
  return n.nodeType === n.ELEMENT_NODE;
97
98
  }
98
99
  function isShadowRoot(n) {
99
- const host = n === null || n === void 0 ? void 0 : n.host;
100
- return Boolean((host === null || host === void 0 ? void 0 : host.shadowRoot) === n);
100
+ const host = _optionalChain$5([n, 'optionalAccess', _ => _.host]);
101
+ return Boolean(_optionalChain$5([host, 'optionalAccess', _2 => _2.shadowRoot]) === n);
101
102
  }
102
103
  function isNativeShadowDom(shadowRoot) {
103
104
  return Object.prototype.toString.call(shadowRoot) === '[object ShadowRoot]';
@@ -171,11 +172,10 @@ class Mirror {
171
172
  this.nodeMetaMap = new WeakMap();
172
173
  }
173
174
  getId(n) {
174
- var _a;
175
175
  if (!n)
176
176
  return -1;
177
- const id = (_a = this.getMeta(n)) === null || _a === void 0 ? void 0 : _a.id;
178
- return id !== null && id !== void 0 ? id : -1;
177
+ const id = _optionalChain$5([this, 'access', _3 => _3.getMeta, 'call', _4 => _4(n), 'optionalAccess', _5 => _5.id]);
178
+ return _nullishCoalesce$1(id, () => ( -1));
179
179
  }
180
180
  getNode(id) {
181
181
  return this.idNodeMap.get(id) || null;
@@ -697,7 +697,6 @@ function getRootId(doc, mirror) {
697
697
  return docId === 1 ? undefined : docId;
698
698
  }
699
699
  function serializeTextNode(n, options) {
700
- var _a;
701
700
  const { maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, maskTextFn, maskInputOptions, maskInputFn, rootId, } = options;
702
701
  const parentTagName = n.parentNode && n.parentNode.tagName;
703
702
  let textContent = n.textContent;
@@ -708,7 +707,7 @@ function serializeTextNode(n, options) {
708
707
  try {
709
708
  if (n.nextSibling || n.previousSibling) {
710
709
  }
711
- else if ((_a = n.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
710
+ else if (_optionalChain$5([n, 'access', _6 => _6.parentNode, 'access', _7 => _7.sheet, 'optionalAccess', _8 => _8.cssRules])) {
712
711
  textContent = stringifyStylesheet(n.parentNode.sheet);
713
712
  }
714
713
  }
@@ -1261,6 +1260,7 @@ function snapshot(n, options) {
1261
1260
  });
1262
1261
  }
1263
1262
 
1263
+ function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1264
1264
  function on(type, fn, target = document) {
1265
1265
  const options = { capture: true, passive: true };
1266
1266
  target.addEventListener(type, fn, options);
@@ -1367,7 +1367,7 @@ function patch(source, name, replacement) {
1367
1367
  source[name] = original;
1368
1368
  };
1369
1369
  }
1370
- catch (_a) {
1370
+ catch (e2) {
1371
1371
  return () => {
1372
1372
  };
1373
1373
  }
@@ -1377,24 +1377,23 @@ if (!(/[1-9][0-9]{12}/.test(Date.now().toString()))) {
1377
1377
  nowTimestamp = () => new Date().getTime();
1378
1378
  }
1379
1379
  function getWindowScroll(win) {
1380
- var _a, _b, _c, _d, _e, _f;
1381
1380
  const doc = win.document;
1382
1381
  return {
1383
1382
  left: doc.scrollingElement
1384
1383
  ? doc.scrollingElement.scrollLeft
1385
1384
  : win.pageXOffset !== undefined
1386
1385
  ? win.pageXOffset
1387
- : (doc === null || doc === void 0 ? void 0 : doc.documentElement.scrollLeft) ||
1388
- ((_b = (_a = doc === null || doc === void 0 ? void 0 : doc.body) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.scrollLeft) ||
1389
- ((_c = doc === null || doc === void 0 ? void 0 : doc.body) === null || _c === void 0 ? void 0 : _c.scrollLeft) ||
1386
+ : _optionalChain$4([doc, 'optionalAccess', _ => _.documentElement, 'access', _2 => _2.scrollLeft]) ||
1387
+ _optionalChain$4([doc, 'optionalAccess', _3 => _3.body, 'optionalAccess', _4 => _4.parentElement, 'optionalAccess', _5 => _5.scrollLeft]) ||
1388
+ _optionalChain$4([doc, 'optionalAccess', _6 => _6.body, 'optionalAccess', _7 => _7.scrollLeft]) ||
1390
1389
  0,
1391
1390
  top: doc.scrollingElement
1392
1391
  ? doc.scrollingElement.scrollTop
1393
1392
  : win.pageYOffset !== undefined
1394
1393
  ? win.pageYOffset
1395
- : (doc === null || doc === void 0 ? void 0 : doc.documentElement.scrollTop) ||
1396
- ((_e = (_d = doc === null || doc === void 0 ? void 0 : doc.body) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.scrollTop) ||
1397
- ((_f = doc === null || doc === void 0 ? void 0 : doc.body) === null || _f === void 0 ? void 0 : _f.scrollTop) ||
1394
+ : _optionalChain$4([doc, 'optionalAccess', _8 => _8.documentElement, 'access', _9 => _9.scrollTop]) ||
1395
+ _optionalChain$4([doc, 'optionalAccess', _10 => _10.body, 'optionalAccess', _11 => _11.parentElement, 'optionalAccess', _12 => _12.scrollTop]) ||
1396
+ _optionalChain$4([doc, 'optionalAccess', _13 => _13.body, 'optionalAccess', _14 => _14.scrollTop]) ||
1398
1397
  0,
1399
1398
  };
1400
1399
  }
@@ -1496,7 +1495,7 @@ function isSerializedStylesheet(n, mirror) {
1496
1495
  mirror.getMeta(n));
1497
1496
  }
1498
1497
  function hasShadowRoot(n) {
1499
- return Boolean(n === null || n === void 0 ? void 0 : n.shadowRoot);
1498
+ return Boolean(_optionalChain$4([n, 'optionalAccess', _18 => _18.shadowRoot]));
1500
1499
  }
1501
1500
  class StyleSheetMirror {
1502
1501
  constructor() {
@@ -1505,8 +1504,7 @@ class StyleSheetMirror {
1505
1504
  this.idStyleMap = new Map();
1506
1505
  }
1507
1506
  getId(stylesheet) {
1508
- var _a;
1509
- return (_a = this.styleIDMap.get(stylesheet)) !== null && _a !== void 0 ? _a : -1;
1507
+ return _nullishCoalesce(this.styleIDMap.get(stylesheet), () => ( -1));
1510
1508
  }
1511
1509
  has(stylesheet) {
1512
1510
  return this.styleIDMap.has(stylesheet);
@@ -1537,9 +1535,8 @@ class StyleSheetMirror {
1537
1535
  }
1538
1536
  }
1539
1537
  function getShadowHost(n) {
1540
- var _a, _b;
1541
1538
  let shadowHost = null;
1542
- if (((_b = (_a = n.getRootNode) === null || _a === void 0 ? void 0 : _a.call(n)) === null || _b === void 0 ? void 0 : _b.nodeType) === Node.DOCUMENT_FRAGMENT_NODE &&
1539
+ if (_optionalChain$4([n, 'access', _19 => _19.getRootNode, 'optionalCall', _20 => _20(), 'optionalAccess', _21 => _21.nodeType]) === Node.DOCUMENT_FRAGMENT_NODE &&
1543
1540
  n.getRootNode().host)
1544
1541
  shadowHost = n.getRootNode().host;
1545
1542
  return shadowHost;
@@ -1564,6 +1561,34 @@ function inDom(n) {
1564
1561
  return false;
1565
1562
  return doc.contains(n) || shadowHostInDom(n);
1566
1563
  }
1564
+ let cachedRequestAnimationFrameImplementation;
1565
+ function getRequestAnimationFrameImplementation() {
1566
+ if (cachedRequestAnimationFrameImplementation) {
1567
+ return cachedRequestAnimationFrameImplementation;
1568
+ }
1569
+ const document = window.document;
1570
+ let requestAnimationFrameImplementation = window.requestAnimationFrame;
1571
+ if (document && typeof document.createElement === 'function') {
1572
+ try {
1573
+ const sandbox = document.createElement('iframe');
1574
+ sandbox.hidden = true;
1575
+ document.head.appendChild(sandbox);
1576
+ const contentWindow = sandbox.contentWindow;
1577
+ if (contentWindow && contentWindow.requestAnimationFrame) {
1578
+ requestAnimationFrameImplementation =
1579
+ contentWindow.requestAnimationFrame;
1580
+ }
1581
+ document.head.removeChild(sandbox);
1582
+ }
1583
+ catch (e) {
1584
+ }
1585
+ }
1586
+ return (cachedRequestAnimationFrameImplementation =
1587
+ requestAnimationFrameImplementation.bind(window));
1588
+ }
1589
+ function onRequestAnimationFrame(...rest) {
1590
+ return getRequestAnimationFrameImplementation()(...rest);
1591
+ }
1567
1592
 
1568
1593
  var EventType = /* @__PURE__ */ ((EventType2) => {
1569
1594
  EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
@@ -1616,6 +1641,7 @@ var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
1616
1641
  return PointerTypes2;
1617
1642
  })(PointerTypes || {});
1618
1643
 
1644
+ function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1619
1645
  function isNodeInLinkedList(n) {
1620
1646
  return '__ln' in n;
1621
1647
  }
@@ -1631,7 +1657,7 @@ class DoubleLinkedList {
1631
1657
  }
1632
1658
  let current = this.head;
1633
1659
  for (let index = 0; index < position; index++) {
1634
- current = (current === null || current === void 0 ? void 0 : current.next) || null;
1660
+ current = _optionalChain$3([current, 'optionalAccess', _ => _.next]) || null;
1635
1661
  }
1636
1662
  return current;
1637
1663
  }
@@ -2218,6 +2244,7 @@ const callbackWrapper = (cb) => {
2218
2244
  return rrwebWrapped;
2219
2245
  };
2220
2246
 
2247
+ function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2221
2248
  const mutationBuffers = [];
2222
2249
  function getEventTarget(event) {
2223
2250
  try {
@@ -2231,18 +2258,17 @@ function getEventTarget(event) {
2231
2258
  return event.path[0];
2232
2259
  }
2233
2260
  }
2234
- catch (_a) {
2261
+ catch (e2) {
2235
2262
  }
2236
2263
  return event && event.target;
2237
2264
  }
2238
2265
  function initMutationObserver(options, rootEl) {
2239
- var _a, _b;
2240
2266
  const mutationBuffer = new MutationBuffer();
2241
2267
  mutationBuffers.push(mutationBuffer);
2242
2268
  mutationBuffer.init(options);
2243
2269
  let mutationObserverCtor = window.MutationObserver ||
2244
2270
  window.__rrMutationObserver;
2245
- const angularZoneSymbol = (_b = (_a = window === null || window === void 0 ? void 0 : window.Zone) === null || _a === void 0 ? void 0 : _a.__symbol__) === null || _b === void 0 ? void 0 : _b.call(_a, 'MutationObserver');
2271
+ const angularZoneSymbol = _optionalChain$2([window, 'optionalAccess', _ => _.Zone, 'optionalAccess', _2 => _2.__symbol__, 'optionalCall', _3 => _3('MutationObserver')]);
2246
2272
  if (angularZoneSymbol &&
2247
2273
  window[angularZoneSymbol]) {
2248
2274
  mutationObserverCtor = window[angularZoneSymbol];
@@ -2377,7 +2403,13 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc, mirror, blockCl
2377
2403
  }
2378
2404
  const id = mirror.getId(target);
2379
2405
  const { clientX, clientY } = e;
2380
- callbackWrapper(mouseInteractionCb)(Object.assign({ type: MouseInteractions[thisEventKey], id, x: clientX, y: clientY }, (pointerType !== null && { pointerType })));
2406
+ callbackWrapper(mouseInteractionCb)({
2407
+ type: MouseInteractions[thisEventKey],
2408
+ id,
2409
+ x: clientX,
2410
+ y: clientY,
2411
+ ...(pointerType !== null && { pointerType }),
2412
+ });
2381
2413
  };
2382
2414
  };
2383
2415
  Object.keys(MouseInteractions)
@@ -2514,7 +2546,10 @@ function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, un
2514
2546
  lastInputValue.isChecked !== v.isChecked) {
2515
2547
  lastInputValueMap.set(target, v);
2516
2548
  const id = mirror.getId(target);
2517
- callbackWrapper(inputCb)(Object.assign(Object.assign({}, v), { id }));
2549
+ callbackWrapper(inputCb)({
2550
+ ...v,
2551
+ id,
2552
+ });
2518
2553
  }
2519
2554
  }
2520
2555
  const events = sampling.input === 'last' ? ['change'] : ['input', 'change'];
@@ -2728,17 +2763,16 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror, stylesheetManager },
2728
2763
  });
2729
2764
  }
2730
2765
  function initAdoptedStyleSheetObserver({ mirror, stylesheetManager, }, host) {
2731
- var _a, _b, _c;
2732
2766
  let hostId = null;
2733
2767
  if (host.nodeName === '#document')
2734
2768
  hostId = mirror.getId(host);
2735
2769
  else
2736
2770
  hostId = mirror.getId(host.host);
2737
2771
  const patchTarget = host.nodeName === '#document'
2738
- ? (_a = host.defaultView) === null || _a === void 0 ? void 0 : _a.Document
2739
- : (_c = (_b = host.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) === null || _c === void 0 ? void 0 : _c.ShadowRoot;
2740
- const originalPropertyDescriptor = (patchTarget === null || patchTarget === void 0 ? void 0 : patchTarget.prototype)
2741
- ? Object.getOwnPropertyDescriptor(patchTarget === null || patchTarget === void 0 ? void 0 : patchTarget.prototype, 'adoptedStyleSheets')
2772
+ ? _optionalChain$2([host, 'access', _4 => _4.defaultView, 'optionalAccess', _5 => _5.Document])
2773
+ : _optionalChain$2([host, 'access', _6 => _6.ownerDocument, 'optionalAccess', _7 => _7.defaultView, 'optionalAccess', _8 => _8.ShadowRoot]);
2774
+ const originalPropertyDescriptor = _optionalChain$2([patchTarget, 'optionalAccess', _9 => _9.prototype])
2775
+ ? Object.getOwnPropertyDescriptor(_optionalChain$2([patchTarget, 'optionalAccess', _10 => _10.prototype]), 'adoptedStyleSheets')
2742
2776
  : undefined;
2743
2777
  if (hostId === null ||
2744
2778
  hostId === -1 ||
@@ -2750,12 +2784,10 @@ function initAdoptedStyleSheetObserver({ mirror, stylesheetManager, }, host) {
2750
2784
  configurable: originalPropertyDescriptor.configurable,
2751
2785
  enumerable: originalPropertyDescriptor.enumerable,
2752
2786
  get() {
2753
- var _a;
2754
- return (_a = originalPropertyDescriptor.get) === null || _a === void 0 ? void 0 : _a.call(this);
2787
+ return _optionalChain$2([originalPropertyDescriptor, 'access', _11 => _11.get, 'optionalAccess', _12 => _12.call, 'call', _13 => _13(this)]);
2755
2788
  },
2756
2789
  set(sheets) {
2757
- var _a;
2758
- const result = (_a = originalPropertyDescriptor.set) === null || _a === void 0 ? void 0 : _a.call(this, sheets);
2790
+ const result = _optionalChain$2([originalPropertyDescriptor, 'access', _14 => _14.set, 'optionalAccess', _15 => _15.call, 'call', _16 => _16(this, sheets)]);
2759
2791
  if (hostId !== null && hostId !== -1) {
2760
2792
  try {
2761
2793
  stylesheetManager.adoptStyleSheets(sheets, hostId);
@@ -2779,12 +2811,11 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror, ignoreCSSAtt
2779
2811
  const setProperty = win.CSSStyleDeclaration.prototype.setProperty;
2780
2812
  win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty, {
2781
2813
  apply: callbackWrapper((target, thisArg, argumentsList) => {
2782
- var _a;
2783
2814
  const [property, value, priority] = argumentsList;
2784
2815
  if (ignoreCSSAttributes.has(property)) {
2785
2816
  return setProperty.apply(thisArg, [property, value, priority]);
2786
2817
  }
2787
- const { id, styleId } = getIdAndStyleId((_a = thisArg.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet, mirror, stylesheetManager.styleMirror);
2818
+ const { id, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, 'access', _17 => _17.parentRule, 'optionalAccess', _18 => _18.parentStyleSheet]), mirror, stylesheetManager.styleMirror);
2788
2819
  if ((id && id !== -1) || (styleId && styleId !== -1)) {
2789
2820
  styleDeclarationCb({
2790
2821
  id,
@@ -2803,12 +2834,11 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror, ignoreCSSAtt
2803
2834
  const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
2804
2835
  win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {
2805
2836
  apply: callbackWrapper((target, thisArg, argumentsList) => {
2806
- var _a;
2807
2837
  const [property] = argumentsList;
2808
2838
  if (ignoreCSSAttributes.has(property)) {
2809
2839
  return removeProperty.apply(thisArg, [property]);
2810
2840
  }
2811
- const { id, styleId } = getIdAndStyleId((_a = thisArg.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet, mirror, stylesheetManager.styleMirror);
2841
+ const { id, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, 'access', _19 => _19.parentRule, 'optionalAccess', _20 => _20.parentStyleSheet]), mirror, stylesheetManager.styleMirror);
2812
2842
  if ((id && id !== -1) || (styleId && styleId !== -1)) {
2813
2843
  styleDeclarationCb({
2814
2844
  id,
@@ -2901,7 +2931,7 @@ function initSelectionObserver(param) {
2901
2931
  let collapsed = true;
2902
2932
  const updateSelection = callbackWrapper(() => {
2903
2933
  const selection = doc.getSelection();
2904
- if (!selection || (collapsed && (selection === null || selection === void 0 ? void 0 : selection.isCollapsed)))
2934
+ if (!selection || (collapsed && _optionalChain$2([selection, 'optionalAccess', _21 => _21.isCollapsed])))
2905
2935
  return;
2906
2936
  collapsed = selection.isCollapsed || false;
2907
2937
  const ranges = [];
@@ -3067,6 +3097,7 @@ class CrossOriginIframeMirror {
3067
3097
  }
3068
3098
  }
3069
3099
 
3100
+ function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3070
3101
  class IframeManagerNoop {
3071
3102
  constructor() {
3072
3103
  this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId);
@@ -3104,7 +3135,6 @@ class IframeManager {
3104
3135
  this.loadListener = cb;
3105
3136
  }
3106
3137
  attachIframe(iframeEl, childSn) {
3107
- var _a;
3108
3138
  this.mutationCb({
3109
3139
  adds: [
3110
3140
  {
@@ -3118,7 +3148,7 @@ class IframeManager {
3118
3148
  attributes: [],
3119
3149
  isAttachIframe: true,
3120
3150
  });
3121
- (_a = this.loadListener) === null || _a === void 0 ? void 0 : _a.call(this, iframeEl);
3151
+ _optionalChain$1([this, 'access', _ => _.loadListener, 'optionalCall', _2 => _2(iframeEl)]);
3122
3152
  if (iframeEl.contentDocument &&
3123
3153
  iframeEl.contentDocument.adoptedStyleSheets &&
3124
3154
  iframeEl.contentDocument.adoptedStyleSheets.length > 0)
@@ -3140,7 +3170,6 @@ class IframeManager {
3140
3170
  this.wrappedEmit(transformedEvent, crossOriginMessageEvent.data.isCheckout);
3141
3171
  }
3142
3172
  transformCrossOriginEvent(iframeEl, e) {
3143
- var _a;
3144
3173
  switch (e.type) {
3145
3174
  case EventType.FullSnapshot: {
3146
3175
  this.crossOriginIframeMirror.reset(iframeEl);
@@ -3241,9 +3270,9 @@ class IframeManager {
3241
3270
  case IncrementalSource.AdoptedStyleSheet: {
3242
3271
  this.replaceIds(e.data, iframeEl, ['id']);
3243
3272
  this.replaceStyleIds(e.data, iframeEl, ['styleIds']);
3244
- (_a = e.data.styles) === null || _a === void 0 ? void 0 : _a.forEach((style) => {
3273
+ _optionalChain$1([e, 'access', _3 => _3.data, 'access', _4 => _4.styles, 'optionalAccess', _5 => _5.forEach, 'call', _6 => _6((style) => {
3245
3274
  this.replaceStyleIds(style, iframeEl, ['styleId']);
3246
- });
3275
+ })]);
3247
3276
  return e;
3248
3277
  }
3249
3278
  }
@@ -3319,9 +3348,20 @@ class ShadowDomManager {
3319
3348
  if (this.shadowDoms.has(shadowRoot))
3320
3349
  return;
3321
3350
  this.shadowDoms.add(shadowRoot);
3322
- const observer = initMutationObserver(Object.assign(Object.assign({}, this.bypassOptions), { doc, mutationCb: this.mutationCb, mirror: this.mirror, shadowDomManager: this }), shadowRoot);
3351
+ const observer = initMutationObserver({
3352
+ ...this.bypassOptions,
3353
+ doc,
3354
+ mutationCb: this.mutationCb,
3355
+ mirror: this.mirror,
3356
+ shadowDomManager: this,
3357
+ }, shadowRoot);
3323
3358
  this.restoreHandlers.push(() => observer.disconnect());
3324
- this.restoreHandlers.push(initScrollObserver(Object.assign(Object.assign({}, this.bypassOptions), { scrollCb: this.scrollCb, doc: shadowRoot, mirror: this.mirror })));
3359
+ this.restoreHandlers.push(initScrollObserver({
3360
+ ...this.bypassOptions,
3361
+ scrollCb: this.scrollCb,
3362
+ doc: shadowRoot,
3363
+ mirror: this.mirror,
3364
+ }));
3325
3365
  setTimeout(() => {
3326
3366
  if (shadowRoot.adoptedStyleSheets &&
3327
3367
  shadowRoot.adoptedStyleSheets.length > 0)
@@ -3446,7 +3486,7 @@ class ProcessedNodeManager {
3446
3486
  this.periodicallyClear();
3447
3487
  }
3448
3488
  periodicallyClear() {
3449
- requestAnimationFrame(() => {
3489
+ onRequestAnimationFrame(() => {
3450
3490
  this.clear();
3451
3491
  if (this.loop)
3452
3492
  this.periodicallyClear();
@@ -3556,15 +3596,14 @@ function record(options = {}) {
3556
3596
  return e;
3557
3597
  };
3558
3598
  const wrappedEmit = (e, isCheckout) => {
3559
- var _a;
3560
- if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
3599
+ if (_optionalChain([mutationBuffers, 'access', _ => _[0], 'optionalAccess', _2 => _2.isFrozen, 'call', _3 => _3()]) &&
3561
3600
  e.type !== EventType.FullSnapshot &&
3562
3601
  !(e.type === EventType.IncrementalSnapshot &&
3563
3602
  e.data.source === IncrementalSource.Mutation)) {
3564
3603
  mutationBuffers.forEach((buf) => buf.unfreeze());
3565
3604
  }
3566
3605
  if (inEmittingFrame) {
3567
- emit === null || emit === void 0 ? void 0 : emit(eventProcessor(e), isCheckout);
3606
+ _optionalChain([emit, 'optionalCall', _4 => _4(eventProcessor(e), isCheckout)]);
3568
3607
  }
3569
3608
  else if (passEmitsToParent) {
3570
3609
  const message = {
@@ -3597,20 +3636,32 @@ function record(options = {}) {
3597
3636
  const wrappedMutationEmit = (m) => {
3598
3637
  wrappedEmit(wrapEvent({
3599
3638
  type: EventType.IncrementalSnapshot,
3600
- data: Object.assign({ source: IncrementalSource.Mutation }, m),
3639
+ data: {
3640
+ source: IncrementalSource.Mutation,
3641
+ ...m,
3642
+ },
3601
3643
  }));
3602
3644
  };
3603
3645
  const wrappedScrollEmit = (p) => wrappedEmit(wrapEvent({
3604
3646
  type: EventType.IncrementalSnapshot,
3605
- data: Object.assign({ source: IncrementalSource.Scroll }, p),
3647
+ data: {
3648
+ source: IncrementalSource.Scroll,
3649
+ ...p,
3650
+ },
3606
3651
  }));
3607
3652
  const wrappedCanvasMutationEmit = (p) => wrappedEmit(wrapEvent({
3608
3653
  type: EventType.IncrementalSnapshot,
3609
- data: Object.assign({ source: IncrementalSource.CanvasMutation }, p),
3654
+ data: {
3655
+ source: IncrementalSource.CanvasMutation,
3656
+ ...p,
3657
+ },
3610
3658
  }));
3611
3659
  const wrappedAdoptedStyleSheetEmit = (a) => wrappedEmit(wrapEvent({
3612
3660
  type: EventType.IncrementalSnapshot,
3613
- data: Object.assign({ source: IncrementalSource.AdoptedStyleSheet }, a),
3661
+ data: {
3662
+ source: IncrementalSource.AdoptedStyleSheet,
3663
+ ...a,
3664
+ },
3614
3665
  }));
3615
3666
  const stylesheetManager = new StylesheetManager({
3616
3667
  mutationCb: wrappedMutationEmit,
@@ -3745,7 +3796,6 @@ function record(options = {}) {
3745
3796
  try {
3746
3797
  const handlers = [];
3747
3798
  const observe = (doc) => {
3748
- var _a;
3749
3799
  return callbackWrapper(initObservers)({
3750
3800
  onMutation,
3751
3801
  mutationCb: wrappedMutationEmit,
@@ -3758,44 +3808,71 @@ function record(options = {}) {
3758
3808
  })),
3759
3809
  mouseInteractionCb: (d) => wrappedEmit(wrapEvent({
3760
3810
  type: EventType.IncrementalSnapshot,
3761
- data: Object.assign({ source: IncrementalSource.MouseInteraction }, d),
3811
+ data: {
3812
+ source: IncrementalSource.MouseInteraction,
3813
+ ...d,
3814
+ },
3762
3815
  })),
3763
3816
  scrollCb: wrappedScrollEmit,
3764
3817
  viewportResizeCb: (d) => wrappedEmit(wrapEvent({
3765
3818
  type: EventType.IncrementalSnapshot,
3766
- data: Object.assign({ source: IncrementalSource.ViewportResize }, d),
3819
+ data: {
3820
+ source: IncrementalSource.ViewportResize,
3821
+ ...d,
3822
+ },
3767
3823
  })),
3768
3824
  inputCb: (v) => wrappedEmit(wrapEvent({
3769
3825
  type: EventType.IncrementalSnapshot,
3770
- data: Object.assign({ source: IncrementalSource.Input }, v),
3826
+ data: {
3827
+ source: IncrementalSource.Input,
3828
+ ...v,
3829
+ },
3771
3830
  })),
3772
3831
  mediaInteractionCb: (p) => wrappedEmit(wrapEvent({
3773
3832
  type: EventType.IncrementalSnapshot,
3774
- data: Object.assign({ source: IncrementalSource.MediaInteraction }, p),
3833
+ data: {
3834
+ source: IncrementalSource.MediaInteraction,
3835
+ ...p,
3836
+ },
3775
3837
  })),
3776
3838
  styleSheetRuleCb: (r) => wrappedEmit(wrapEvent({
3777
3839
  type: EventType.IncrementalSnapshot,
3778
- data: Object.assign({ source: IncrementalSource.StyleSheetRule }, r),
3840
+ data: {
3841
+ source: IncrementalSource.StyleSheetRule,
3842
+ ...r,
3843
+ },
3779
3844
  })),
3780
3845
  styleDeclarationCb: (r) => wrappedEmit(wrapEvent({
3781
3846
  type: EventType.IncrementalSnapshot,
3782
- data: Object.assign({ source: IncrementalSource.StyleDeclaration }, r),
3847
+ data: {
3848
+ source: IncrementalSource.StyleDeclaration,
3849
+ ...r,
3850
+ },
3783
3851
  })),
3784
3852
  canvasMutationCb: wrappedCanvasMutationEmit,
3785
3853
  fontCb: (p) => wrappedEmit(wrapEvent({
3786
3854
  type: EventType.IncrementalSnapshot,
3787
- data: Object.assign({ source: IncrementalSource.Font }, p),
3855
+ data: {
3856
+ source: IncrementalSource.Font,
3857
+ ...p,
3858
+ },
3788
3859
  })),
3789
3860
  selectionCb: (p) => {
3790
3861
  wrappedEmit(wrapEvent({
3791
3862
  type: EventType.IncrementalSnapshot,
3792
- data: Object.assign({ source: IncrementalSource.Selection }, p),
3863
+ data: {
3864
+ source: IncrementalSource.Selection,
3865
+ ...p,
3866
+ },
3793
3867
  }));
3794
3868
  },
3795
3869
  customElementCb: (c) => {
3796
3870
  wrappedEmit(wrapEvent({
3797
3871
  type: EventType.IncrementalSnapshot,
3798
- data: Object.assign({ source: IncrementalSource.CustomElement }, c),
3872
+ data: {
3873
+ source: IncrementalSource.CustomElement,
3874
+ ...c,
3875
+ },
3799
3876
  }));
3800
3877
  },
3801
3878
  blockClass,
@@ -3829,7 +3906,9 @@ function record(options = {}) {
3829
3906
  processedNodeManager,
3830
3907
  canvasManager,
3831
3908
  ignoreCSSAttributes,
3832
- plugins: ((_a = plugins === null || plugins === void 0 ? void 0 : plugins.filter((p) => p.observer)) === null || _a === void 0 ? void 0 : _a.map((p) => ({
3909
+ plugins: _optionalChain([plugins
3910
+ , 'optionalAccess', _5 => _5.filter, 'call', _6 => _6((p) => p.observer)
3911
+ , 'optionalAccess', _7 => _7.map, 'call', _8 => _8((p) => ({
3833
3912
  observer: p.observer,
3834
3913
  options: p.options,
3835
3914
  callback: (payload) => wrappedEmit(wrapEvent({
@@ -3839,7 +3918,7 @@ function record(options = {}) {
3839
3918
  payload,
3840
3919
  },
3841
3920
  })),
3842
- }))) || [],
3921
+ }))]) || [],
3843
3922
  }, {});
3844
3923
  };
3845
3924
  iframeManager.addLoadListener((iframeEl) => {
@@ -3903,10 +3982,18 @@ record.mirror = mirror;
3903
3982
  record.takeFullSnapshot = takeFullSnapshot;
3904
3983
  function _getCanvasManager(getCanvasManagerFn, options) {
3905
3984
  return getCanvasManagerFn
3906
- ? getCanvasManagerFn(Object.assign(Object.assign({}, options), { mirror, win: window, mutationCb: (p) => wrappedEmit(wrapEvent({
3985
+ ? getCanvasManagerFn({
3986
+ ...options,
3987
+ mirror,
3988
+ win: window,
3989
+ mutationCb: (p) => wrappedEmit(wrapEvent({
3907
3990
  type: EventType.IncrementalSnapshot,
3908
- data: Object.assign({ source: IncrementalSource.CanvasMutation }, p),
3909
- })) }))
3991
+ data: {
3992
+ source: IncrementalSource.CanvasMutation,
3993
+ ...p,
3994
+ },
3995
+ })),
3996
+ })
3910
3997
  : new CanvasManagerNoop();
3911
3998
  }
3912
3999
 
@@ -8367,12 +8454,16 @@ class ReplayContainer {
8367
8454
  * This is only available if performance is enabled, and if an instrumented router is used.
8368
8455
  */
8369
8456
  getCurrentRoute() {
8457
+ // eslint-disable-next-line deprecation/deprecation
8370
8458
  const lastTransaction = this.lastTransaction || getCurrentScope().getTransaction();
8371
- if (!lastTransaction || !['route', 'custom'].includes(lastTransaction.metadata.source)) {
8459
+
8460
+ const attributes = (lastTransaction && spanToJSON(lastTransaction).data) || {};
8461
+ const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
8462
+ if (!lastTransaction || !source || !['route', 'custom'].includes(source)) {
8372
8463
  return undefined;
8373
8464
  }
8374
8465
 
8375
- return lastTransaction.name;
8466
+ return spanToJSON(lastTransaction).description;
8376
8467
  }
8377
8468
 
8378
8469
  /**
@@ -9357,7 +9448,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
9357
9448
  recordingOptions: this._recordingOptions,
9358
9449
  });
9359
9450
  }
9360
- } Replay.__initStatic();
9451
+ }Replay.__initStatic();
9361
9452
 
9362
9453
  /** Parse Replay-related options from SDK options */
9363
9454
  function loadReplayOptionsFromClient(initialOptions) {