@pendo/agent 2.276.0 → 2.277.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.
@@ -430,15 +430,6 @@ function getPolicy(pendo) {
430
430
  return policy;
431
431
  }
432
432
 
433
- /*
434
- * NOTE: gulpfile.js line 296 -- actually writes the line of code that uses this
435
- * CODE to the agent. It's presumably done there to guarantee its early position
436
- * in resulting agent code.
437
- *
438
- * If you want to add any libraries for use in the preamble (we currently have
439
- * b64 and sha1 available here now) then you'll need to update `gulpfile.js`
440
- * line 35 for the `eslint` task and `karma.conf.js` line 31.
441
- */
442
433
  var STAGING_SERVER_HASHES = 'stagingServerHashes';
443
434
  var pendo$1;
444
435
  var _pendoConfig = {};
@@ -3891,8 +3882,8 @@ var SERVER = '';
3891
3882
  var ASSET_HOST = '';
3892
3883
  var ASSET_PATH = '';
3893
3884
  var DESIGNER_ENV = '';
3894
- var VERSION = '2.276.0_';
3895
- var PACKAGE_VERSION = '2.276.0';
3885
+ var VERSION = '2.277.0_';
3886
+ var PACKAGE_VERSION = '2.277.0';
3896
3887
  var LOADER = 'xhr';
3897
3888
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3898
3889
  /**
@@ -10097,14 +10088,15 @@ function roundOffsetPosition(position) {
10097
10088
  });
10098
10089
  return position;
10099
10090
  }
10100
- function getOffsetPosition(element) {
10091
+ function getOffsetPosition(element, _win) {
10092
+ if (_win === void 0) { _win = window; }
10101
10093
  if (isPositionFixed(element)) {
10102
10094
  var fixedPosition = getScreenPosition(element);
10103
10095
  fixedPosition.fixed = true;
10104
10096
  return roundOffsetPosition(fixedPosition);
10105
10097
  }
10106
10098
  else {
10107
- var absolutePosition = getAbsolutePosition(element, getBody());
10099
+ var absolutePosition = getAbsolutePosition(element, getBody(_win.document), _win);
10108
10100
  return roundOffsetPosition(absolutePosition);
10109
10101
  }
10110
10102
  }
@@ -11255,11 +11247,23 @@ var WeakRef = (function(global, factory) {
11255
11247
  return nativeWeakRef;
11256
11248
  })(window, WeakRefFactory);
11257
11249
 
11250
+ var trimString = function (str, limit) {
11251
+ var len = str.length;
11252
+ if (len <= limit)
11253
+ return str;
11254
+ return trimSurrogate(str.substring(0, limit));
11255
+ };
11256
+ function getTextValue(elem, limit) {
11257
+ if (elem.tagName && ['textarea', 'input'].indexOf(elem.tagName.toLowerCase()) > -1) {
11258
+ return trimString(elem.value, limit);
11259
+ }
11260
+ return getText(elem, limit);
11261
+ }
11258
11262
  function getText(elem, limit) {
11263
+ if (limit === void 0) { limit = 128; }
11259
11264
  var ret = '';
11260
11265
  var nodeType = elem.nodeType;
11261
11266
  var sub;
11262
- limit = limit || 128;
11263
11267
  if (nodeType === TEXT || nodeType === CDATA_SECTION) {
11264
11268
  return elem.nodeValue;
11265
11269
  }
@@ -11372,7 +11376,7 @@ var ElementGetter = /** @class */ (function () {
11372
11376
  ElementGetter.prototype.getText = function (limit) {
11373
11377
  if (limit === void 0) { limit = 1024; }
11374
11378
  // XXX not sure about size limit
11375
- return getText(this.get(), limit);
11379
+ return getTextValue(this.get(), limit);
11376
11380
  };
11377
11381
  ElementGetter.prototype.addEventListener = function (event, callback) {
11378
11382
  var _this = this;
@@ -17011,10 +17015,10 @@ var FlexboxPolyfill = (function () {
17011
17015
  return classes && classes.indexOf('pendo-mock-flexbox-element') > -1;
17012
17016
  });
17013
17017
  }
17014
- function createFlexContainer(isElementPosAbsolute) {
17018
+ function createFlexContainer(isElementPosAbsolute, useNativeFlexbox) {
17015
17019
  var container = document.createElement('div');
17016
17020
  container.style.display = 'inline-block';
17017
- if (!isElementPosAbsolute) {
17021
+ if (!isElementPosAbsolute && !useNativeFlexbox) {
17018
17022
  container.style.position = 'absolute';
17019
17023
  }
17020
17024
  // Sibling inline-block elements will attempt to align with a common baseline (think about it like a horizontal line)
@@ -17229,19 +17233,33 @@ var FlexboxPolyfill = (function () {
17229
17233
  var computedStyles = getComputedStyle_safe(row);
17230
17234
  return parseInt(width, 10) - parseInt(computedStyles.paddingLeft, 10) - parseInt(computedStyles.paddingRight, 10);
17231
17235
  }
17232
- function initializeFlexRows(row, justifyContent, rowVerticalAlignment) {
17233
- var flexElements = getFlexboxElements(row.children);
17234
- if (flexElements.length === 0)
17235
- return;
17236
- // In the following steps, we remove and add elements to the guide.
17237
- // Therefore we precalculation the rowWidth to ensure it won't change
17238
- // in case of scrollbar will be added or removed from the screen.
17239
- var rowWidth = FlexboxPolyfill.getRowWidth(row);
17240
- var flexRows = FlexboxPolyfill.wrapFlexElementsInFlexRows(flexElements, row, rowWidth);
17241
- // Once we have all the pendo-mock-flexbox-element elements placed in to
17242
- // pendo-mock-flexbox-row rows, loop through each pendo-mock-flexbox-row and set the
17243
- // height and alignment
17244
- FlexboxPolyfill.formatFlexRows(flexRows, row, justifyContent, rowVerticalAlignment, rowWidth);
17236
+ function initializeFlexRows(row, justifyContent, rowVerticalAlignment, useNativeFlexbox) {
17237
+ if (useNativeFlexbox === void 0) { useNativeFlexbox = false; }
17238
+ if (useNativeFlexbox) {
17239
+ var alignments = {
17240
+ 'top': 'flex-start',
17241
+ 'center': 'center',
17242
+ 'bottom': 'flex-end'
17243
+ };
17244
+ row.style.display = 'flex';
17245
+ row.style.flexWrap = 'wrap';
17246
+ row.style.justifyContent = justifyContent;
17247
+ row.style.alignItems = alignments[rowVerticalAlignment] || 'flex-start';
17248
+ }
17249
+ else {
17250
+ var flexElements = getFlexboxElements(row.children);
17251
+ if (flexElements.length === 0)
17252
+ return;
17253
+ // In the following steps, we remove and add elements to the guide.
17254
+ // Therefore we precalculation the rowWidth to ensure it won't change
17255
+ // in case of scrollbar will be added or removed from the screen.
17256
+ var rowWidth = FlexboxPolyfill.getRowWidth(row);
17257
+ var flexRows = FlexboxPolyfill.wrapFlexElementsInFlexRows(flexElements, row, rowWidth);
17258
+ // Once we have all the pendo-mock-flexbox-element elements placed in to
17259
+ // pendo-mock-flexbox-row rows, loop through each pendo-mock-flexbox-row and set the
17260
+ // height and alignment
17261
+ FlexboxPolyfill.formatFlexRows(flexRows, row, justifyContent, rowVerticalAlignment, rowWidth);
17262
+ }
17245
17263
  }
17246
17264
  function wrapFlexElementsInFlexRows(flexElements, row, rowWidthPreCalc) {
17247
17265
  var rowWidth = rowWidthPreCalc || getRowWidth(row);
@@ -17318,21 +17336,24 @@ var FlexboxPolyfill = (function () {
17318
17336
  return true;
17319
17337
  return false;
17320
17338
  }
17321
- function flexElement(ele) {
17339
+ function flexElement(ele, useNativeFlexbox) {
17322
17340
  var rowsToBeFlexed = dom('[data-pendo-display-flex]', ele);
17323
17341
  _.each(rowsToBeFlexed, function (row) {
17324
- var rowWithFlexedElements = FlexboxPolyfill.initializeFlexElements(row);
17342
+ var rowWithFlexedElements = useNativeFlexbox ? row : FlexboxPolyfill.initializeFlexElements(row);
17325
17343
  var horizontalAlignment = row.getAttribute('data-pendo-justify-content');
17326
17344
  var rowVerticalAlignment = row.getAttribute('data-row-vertical-alignment');
17327
- FlexboxPolyfill.initializeFlexRows(rowWithFlexedElements, horizontalAlignment, rowVerticalAlignment);
17345
+ FlexboxPolyfill.initializeFlexRows(rowWithFlexedElements, horizontalAlignment, rowVerticalAlignment, useNativeFlexbox);
17328
17346
  });
17329
17347
  }
17330
- function flexAllThings(containerId, context) {
17348
+ function flexAllThings(containerId, step) {
17349
+ var _a;
17350
+ var useNativeFlexbox = (_a = step === null || step === void 0 ? void 0 : step.attributes) === null || _a === void 0 ? void 0 : _a.useFlexbox;
17351
+ var context = (step === null || step === void 0 ? void 0 : step.guideElement) || document;
17331
17352
  var guideContainer = dom('#' + containerId, context)[0];
17332
17353
  if (!guideContainer)
17333
17354
  return;
17334
17355
  maintainAspectRatios(guideContainer);
17335
- FlexboxPolyfill.flexElement(guideContainer);
17356
+ FlexboxPolyfill.flexElement(guideContainer, useNativeFlexbox);
17336
17357
  }
17337
17358
  function maintainAspectRatios(ele) {
17338
17359
  var dataAspectRatio = 'data-aspect-ratio';
@@ -17587,7 +17608,7 @@ function recalculateGuideHeightOnImgLoad(node, step) {
17587
17608
  if (guideContainer && step.attributes.imgCount <= 0) {
17588
17609
  recalculateGuideWidth(containerId, step.guideElement);
17589
17610
  adjustGuideContentWidth(containerId, step.guideElement);
17590
- FlexboxPolyfill.flexAllThings(containerId, step.guideElement);
17611
+ FlexboxPolyfill.flexAllThings(containerId, step);
17591
17612
  var guide = step.getGuide();
17592
17613
  // calling recalculateGuideHeight with an announcement guide or Announcements Module breaks announcements display
17593
17614
  // in resource center
@@ -17598,7 +17619,7 @@ function recalculateGuideHeightOnImgLoad(node, step) {
17598
17619
  var containerHasOverflow = domContainer && domContainer.style && domContainer.style.overflow === 'auto';
17599
17620
  if (containerHasOverflow) {
17600
17621
  adjustGuideContentWidth(containerId, step.guideElement);
17601
- FlexboxPolyfill.flexAllThings(step.containerId, step.guideElement);
17622
+ FlexboxPolyfill.flexAllThings(step.containerId, step);
17602
17623
  }
17603
17624
  }
17604
17625
  if (step.attributes.calculatedType === 'tooltip') {
@@ -17624,7 +17645,7 @@ function recalculateGuideHeightOnImgLoad(node, step) {
17624
17645
  }
17625
17646
  guideContainer.style.visibility = 'visible';
17626
17647
  guideContainer.parentNode.style.visibility = 'visible';
17627
- FlexboxPolyfill.flexAllThings(step.containerId, step.guideElement);
17648
+ FlexboxPolyfill.flexAllThings(step.containerId, step);
17628
17649
  });
17629
17650
  }
17630
17651
  function bindActionToNode(node, actionObject, step) {
@@ -18347,7 +18368,7 @@ var BuildingBlockResourceCenter = (function () {
18347
18368
  }, []);
18348
18369
  adjustGuideContentWidth(containerIds, step.guideElement);
18349
18370
  _.each(containerIds, function (containerId) {
18350
- FlexboxPolyfill.flexAllThings(containerId, step.guideElement);
18371
+ FlexboxPolyfill.flexAllThings(containerId, step);
18351
18372
  });
18352
18373
  }
18353
18374
  else {
@@ -21481,7 +21502,7 @@ function startPreviewMode(window) {
21481
21502
  function updatePreviewUI() {
21482
21503
  if (store.getters['frames/isFollower']())
21483
21504
  return true;
21484
- updatePreview(document, getActiveGuides(), getLastGuideStepSeen());
21505
+ updatePreview(document, getDisplayableGuides(), getLastGuideStepSeen());
21485
21506
  return true;
21486
21507
  }
21487
21508
  function addPreviewUI(window) {
@@ -21545,7 +21566,7 @@ function previewMessageHandler(e) {
21545
21566
  store.dispatch('frames/stopPreview', { 'preventWindowClose': preventWindowClose });
21546
21567
  }
21547
21568
  else if (type === pendoPreview$1 + '::restart') {
21548
- var lastGuideStepSeen = restartPreview(getActiveGuides(), getLastGuideStepSeen(), e.data.language);
21569
+ var lastGuideStepSeen = restartPreview(getDisplayableGuides(), getLastGuideStepSeen(), e.data.language);
21549
21570
  store.dispatch('guideState/forceExpire');
21550
21571
  store.dispatch('guideState/updateLastGuideStepSeen', lastGuideStepSeen);
21551
21572
  store.dispatch('frames/restartPreview');
@@ -24805,11 +24826,22 @@ var resetPendoUI = function () {
24805
24826
  removeAllBadges();
24806
24827
  flushLater();
24807
24828
  };
24829
+ /**
24830
+ * If a visitor has been marked as "Do Not Process" then this value will be set to true.
24831
+ *
24832
+ * @access public
24833
+ * @name doNotProcess
24834
+ * @type {string}
24835
+ * @category Events
24836
+ * @example
24837
+ * pendo.doNotProcess => true
24838
+ */
24808
24839
  function handleDoNotProcess() {
24809
24840
  stopGuides();
24810
24841
  lockEvents();
24811
24842
  pendo$1.segmentFlags = [];
24812
24843
  pendo$1.doNotProcess = true;
24844
+ store.commit('debugger/doNotProcess', true);
24813
24845
  log.info('not tracking visitor due to 451 response');
24814
24846
  }
24815
24847
  function guidesPayload(guidesJson) {
@@ -24844,16 +24876,6 @@ function isGuideRequestPending() {
24844
24876
  return false;
24845
24877
  }
24846
24878
  var mostRecentGuideRequest;
24847
- /**
24848
- * If a visitor has been marked as "Do Not Process" then this value will be set to true.
24849
- *
24850
- * @access public
24851
- * @name doNotProcess
24852
- * @type {string}
24853
- * @category Events
24854
- * @example
24855
- * pendo.doNotProcess => true
24856
- */
24857
24879
  var loadGuideJs = function (apiKey, params) {
24858
24880
  var isAdoptPartner = treatAsAdoptPartner();
24859
24881
  var guideRequestId = _.uniqueId();
@@ -25871,7 +25893,7 @@ var EventRouter = function () {
25871
25893
  containerJSON = findGuideContainerJSON(evt.step.domJson);
25872
25894
  recalculateGuideWidth(containerJSON.props.id, guideElement);
25873
25895
  adjustGuideContentWidth(containerJSON.props.id, guideElement);
25874
- FlexboxPolyfill.flexAllThings(containerJSON.props.id, guideElement);
25896
+ FlexboxPolyfill.flexAllThings(containerJSON.props.id, evt.step);
25875
25897
  recalculateGuideHeight(containerJSON.props.id, guideElement);
25876
25898
  break;
25877
25899
  case actionKeys.hideElements:
@@ -25879,7 +25901,7 @@ var EventRouter = function () {
25879
25901
  containerJSON = findGuideContainerJSON(evt.step.domJson);
25880
25902
  recalculateGuideWidth(containerJSON.props.id, guideElement);
25881
25903
  adjustGuideContentWidth(containerJSON.props.id, guideElement);
25882
- FlexboxPolyfill.flexAllThings(containerJSON.props.id, guideElement);
25904
+ FlexboxPolyfill.flexAllThings(containerJSON.props.id, evt.step);
25883
25905
  recalculateGuideHeight(containerJSON.props.id, guideElement);
25884
25906
  break;
25885
25907
  case actionKeys.slideElement:
@@ -27289,7 +27311,7 @@ var BuildingBlockGuides = (function () {
27289
27311
  // Note: Announcement guides have their own special handling for deferring flexAllThings until
27290
27312
  // all images have loaded. See the if (isResourceCenter) check below
27291
27313
  if ((!hasImageCount && !isResourceCenter)) {
27292
- BuildingBlockGuides.flexAllThings(step.containerId, step.guideElement);
27314
+ BuildingBlockGuides.flexAllThings(step.containerId, step);
27293
27315
  }
27294
27316
  if (!isFullyCustomResourceCenter) {
27295
27317
  BuildingBlockGuides.recalculateGuideHeight(step.containerId, step.guideElement);
@@ -27327,7 +27349,7 @@ var BuildingBlockGuides = (function () {
27327
27349
  announcementModules = [guide.attributes.resourceCenter];
27328
27350
  }
27329
27351
  else {
27330
- BuildingBlockGuides.flexAllThings(step.containerId, step.guideElement);
27352
+ BuildingBlockGuides.flexAllThings(step.containerId, step);
27331
27353
  }
27332
27354
  if (announcementModules.length) {
27333
27355
  _.forEach(announcementModules, function (announcementModule) {
@@ -27345,7 +27367,7 @@ var BuildingBlockGuides = (function () {
27345
27367
  // pendo-g- can actually be the guideId OR the stepId. see fetchAndMigrateGuide in
27346
27368
  // the designer repo
27347
27369
  var containerIdToFlex = dom('#pendo-g-' + stepId).length ? stepId : guideId;
27348
- BuildingBlockGuides.flexAllThings('pendo-g-' + containerIdToFlex, step.guideElement);
27370
+ BuildingBlockGuides.flexAllThings('pendo-g-' + containerIdToFlex, step);
27349
27371
  }
27350
27372
  });
27351
27373
  });
@@ -30335,7 +30357,7 @@ function GuideStep(guide) {
30335
30357
  // the designer repo
30336
30358
  var containerIdToFlex = dom(guideContainer).find('#pendo-g-' + stepId)[0] ? stepId : guide.id;
30337
30359
  BuildingBlockGuides.adjustGuideContentWidth('pendo-g-' + containerIdToFlex, step.guideElement);
30338
- BuildingBlockGuides.flexAllThings('pendo-g-' + containerIdToFlex, step.guideElement);
30360
+ BuildingBlockGuides.flexAllThings('pendo-g-' + containerIdToFlex, step);
30339
30361
  }
30340
30362
  });
30341
30363
  }
@@ -30344,7 +30366,7 @@ function GuideStep(guide) {
30344
30366
  }
30345
30367
  }
30346
30368
  else {
30347
- BuildingBlockGuides.flexAllThings(containerId, step.guideElement);
30369
+ BuildingBlockGuides.flexAllThings(containerId, step);
30348
30370
  }
30349
30371
  if (!isFullyCustomResourceCenter) {
30350
30372
  BuildingBlockGuides.recalculateGuideHeight(containerId, step.guideElement);
@@ -32257,7 +32279,8 @@ var DebuggerModule = (function () {
32257
32279
  'enableEventLogging': false,
32258
32280
  'eventsCaptured': [],
32259
32281
  'cspErrors': [],
32260
- 'installType': null
32282
+ 'installType': null,
32283
+ 'doNotProcess': false
32261
32284
  };
32262
32285
  var SYNC_TYPES = {
32263
32286
  'TOP_DOWN': 'top-down',
@@ -32456,6 +32479,9 @@ var DebuggerModule = (function () {
32456
32479
  if (state.cspErrors.length > 10) {
32457
32480
  state.cspErrors.pop();
32458
32481
  }
32482
+ },
32483
+ 'doNotProcess': function (state, doNotProcess) {
32484
+ state.doNotProcess = doNotProcess;
32459
32485
  }
32460
32486
  };
32461
32487
  function autoDisplayFn(evt) {
@@ -33209,7 +33235,8 @@ var PromoteMetadata = (function () {
33209
33235
  'hasPromotedMetadataKind': hasPromotedMetadataKind,
33210
33236
  'setSchemaGroup': setSchemaGroup,
33211
33237
  'getSchemaGroup': getSchemaGroup,
33212
- 'resetSchemaGroup': resetSchemaGroup
33238
+ 'resetSchemaGroup': resetSchemaGroup,
33239
+ 'resetCachedSchemaGroup': resetCachedSchemaGroup
33213
33240
  };
33214
33241
  function init(pendo, PluginAPI) {
33215
33242
  pluginApi = PluginAPI;
@@ -33224,13 +33251,13 @@ var PromoteMetadata = (function () {
33224
33251
  * @access public
33225
33252
  * @label SCHEMA_GROUP
33226
33253
  */
33227
- agentStorage.registry.addLocal(SCHEMA_GROUP);
33254
+ pluginApi.agentStorage.registry.addLocal(SCHEMA_GROUP);
33228
33255
  if (shouldPersist()) {
33229
33256
  try {
33230
- cachedSchemaGroup = JSON.parse(agentStorage.read(SCHEMA_GROUP)) || {};
33257
+ cachedSchemaGroup = JSON.parse(pluginApi.agentStorage.read(SCHEMA_GROUP)) || {};
33231
33258
  }
33232
33259
  catch (e) {
33233
- cachedSchemaGroup = {};
33260
+ resetCachedSchemaGroup();
33234
33261
  }
33235
33262
  }
33236
33263
  if (promotedAgentMetadata && promotedAgentMetadata.length) {
@@ -33271,16 +33298,19 @@ var PromoteMetadata = (function () {
33271
33298
  function clearSession(event) {
33272
33299
  var eventData = event.data[0];
33273
33300
  if (_.get(eventData, 'wasCleared')) {
33274
- agentStorage.clear(SCHEMA_GROUP);
33301
+ pluginApi.agentStorage.clear(SCHEMA_GROUP);
33275
33302
  resetSchemaGroup();
33276
33303
  }
33277
33304
  }
33278
33305
  function resetSchemaGroup() {
33279
33306
  schemaGroup = {};
33280
33307
  }
33308
+ function resetCachedSchemaGroup() {
33309
+ cachedSchemaGroup = {};
33310
+ }
33281
33311
  function createSchemaGroup(metadata) {
33282
33312
  if (shouldPersist()) {
33283
- cachedSchemaGroup = JSON.parse(agentStorage.read(SCHEMA_GROUP)) || {};
33313
+ cachedSchemaGroup = JSON.parse(pluginApi.agentStorage.read(SCHEMA_GROUP)) || {};
33284
33314
  cachedSchemaGroup = removePrefixes(cachedSchemaGroup);
33285
33315
  }
33286
33316
  var __sg__ = getSchemaGroup();
@@ -33301,7 +33331,7 @@ var PromoteMetadata = (function () {
33301
33331
  }
33302
33332
  });
33303
33333
  if (shouldPersist()) {
33304
- agentStorage.write(SCHEMA_GROUP, JSON.stringify(__sg__), undefined, false, true);
33334
+ pluginApi.agentStorage.write(SCHEMA_GROUP, JSON.stringify(__sg__), undefined, false, true);
33305
33335
  }
33306
33336
  return __sg__;
33307
33337
  }
@@ -35337,6 +35367,7 @@ var ActionAutomation = (function () {
35337
35367
  'getElement': getElement,
35338
35368
  'getValue': getValue,
35339
35369
  'injectText': injectText,
35370
+ 'simulateClick': simulateClick,
35340
35371
  'isAutomationInQueue': isAutomationInQueue,
35341
35372
  'popQueue': popQueue,
35342
35373
  'setActive': setActive
@@ -35386,6 +35417,13 @@ var ActionAutomation = (function () {
35386
35417
  changeEvent.simulated = true; // for React ≤ 15.6.0
35387
35418
  element.dispatchEvent(changeEvent);
35388
35419
  }
35420
+ function simulateClick(element) {
35421
+ element.dispatchEvent(new MouseEvent('pointerdown', { 'bubbles': true, 'cancelable': true }));
35422
+ element.dispatchEvent(new MouseEvent('mousedown', { 'bubbles': true, 'cancelable': true }));
35423
+ element.dispatchEvent(new MouseEvent('pointerup', { 'bubbles': true, 'cancelable': true }));
35424
+ element.dispatchEvent(new MouseEvent('mouseup', { 'bubbles': true, 'cancelable': true }));
35425
+ element.click();
35426
+ }
35389
35427
  function isAutomationInQueue(automation) {
35390
35428
  return !!_.find(this.automationQueue, function (item) {
35391
35429
  return automation.id === item.id;
@@ -35451,9 +35489,7 @@ var ActionAutomation = (function () {
35451
35489
  break;
35452
35490
  }
35453
35491
  case 'autoclick':
35454
- element.dispatchEvent(new MouseEvent('mousedown', { 'bubbles': true, 'cancelable': true }));
35455
- element.dispatchEvent(new MouseEvent('mouseup', { 'bubbles': true, 'cancelable': true }));
35456
- element.click();
35492
+ this.simulateClick(element);
35457
35493
  break;
35458
35494
  }
35459
35495
  this.automationQueue.shift();
@@ -36340,7 +36376,44 @@ var FrustrationEvent = (function () {
36340
36376
  // A guide that show nested inside another element.
36341
36377
  // Multiple embedded guides can show at the same time.
36342
36378
  var buildGuideBehaviors = function (_a) {
36343
- var _ = _a._, store = _a.store;
36379
+ var store = _a.store, globalPendo = _a.globalPendo;
36380
+ var _ = globalPendo._;
36381
+ var handleShow = function () {
36382
+ var guide = this;
36383
+ var guideElement = null;
36384
+ var containerSelector = '[id^="pendo-guide-container"]';
36385
+ var selector = _.get(guide, 'attributes.embedConfig.selector');
36386
+ var method = _.get(guide, 'attributes.embedConfig.method');
36387
+ var element = _.first(globalPendo.Sizzle(selector));
36388
+ var isShown = guide.isShownInThisFrame();
36389
+ if (element && isShown) {
36390
+ var guideElementSelector = "#pendo-guide-container-".concat(_.get(this.getActiveStep(), 'id'));
36391
+ guideElement = !!globalPendo.Sizzle(guideElementSelector, element).length;
36392
+ }
36393
+ if (!isShown && !!element && this.shouldAutoDisplay()) {
36394
+ if (method === 'replace' && !!globalPendo.Sizzle(containerSelector, element).length) {
36395
+ return;
36396
+ }
36397
+ guide.show('embed');
36398
+ }
36399
+ else if (isShown && (!element || !guideElement)) {
36400
+ guide.hide();
36401
+ }
36402
+ };
36403
+ var getActiveStep = function () {
36404
+ var guide = this;
36405
+ if (!guide)
36406
+ return null;
36407
+ return _.find(guide.steps, function (step) {
36408
+ return step.isShown();
36409
+ });
36410
+ };
36411
+ var shouldAutoDisplay = function () {
36412
+ var guide = this;
36413
+ return (guide.shouldShowSnoozedGuide() || guide.shouldRepeatGuide() || _.all(guide.steps, function (step) {
36414
+ return step.shouldRepeat() || (!step.isSnoozed() && step.seenState !== 'dismissed');
36415
+ }));
36416
+ };
36344
36417
  var show = function (reason) {
36345
36418
  var guide = this;
36346
36419
  var firstStep = _.first(guide.steps);
@@ -36365,7 +36438,7 @@ var buildGuideBehaviors = function (_a) {
36365
36438
  return step.isRendered() || step.isLocked();
36366
36439
  });
36367
36440
  };
36368
- return { show: show, isShownInThisFrame: isShownInThisFrame };
36441
+ return { show: show, isShownInThisFrame: isShownInThisFrame, getActiveStep: getActiveStep, handleShow: handleShow, shouldAutoDisplay: shouldAutoDisplay };
36369
36442
  };
36370
36443
  var buildStepBehaviors = function (_a) {
36371
36444
  var pluginApi = _a.pluginApi; _a._;
@@ -36406,7 +36479,7 @@ var EmbeddedGuides = (function () {
36406
36479
  globalPendo = pendo;
36407
36480
  _ = globalPendo._;
36408
36481
  exportPublicEmbeddedGuideApi(pendo);
36409
- embeddedGuideBehaviors = buildGuideBehaviors({ _: _, 'store': pluginApi.store, globalPendo: globalPendo });
36482
+ embeddedGuideBehaviors = buildGuideBehaviors({ 'store': pluginApi.store, globalPendo: globalPendo });
36410
36483
  pluginApi.Events.on('deliverablesLoaded', clearEmbeddedGuides);
36411
36484
  pluginApi.Events.on('guideLoopStopped', hideAllEmbeddedGuides);
36412
36485
  pluginApi.Events.on('guideListChanged', initializeEmbeddedGuides);
@@ -36425,24 +36498,11 @@ var EmbeddedGuides = (function () {
36425
36498
  pluginApi.GuideActivity.removeGuideResolver(getGuideObjectFromEvent);
36426
36499
  if (this.removeResizeEvent)
36427
36500
  this.removeResizeEvent();
36501
+ _oldEmbeddedGuides.length = 0;
36428
36502
  }
36429
36503
  function showAllEmbeddedGuides() {
36430
- var Sizzle = globalPendo.Sizzle;
36431
36504
  _.forEach(embeddedGuides, function (guide) {
36432
- var guideElement = null;
36433
- var selector = _.get(guide, 'attributes.embedConfig.selector');
36434
- var element = _.first(Sizzle(selector));
36435
- var isShown = guide.isShownInThisFrame();
36436
- if (element && isShown) {
36437
- var guideElementSelector = "#pendo-guide-container-".concat(_.get(getActiveStep(guide), 'id'));
36438
- guideElement = _.first(Sizzle(guideElementSelector, element));
36439
- }
36440
- if (!isShown && !!element && shouldAutoDisplay(guide)) {
36441
- guide.show('embed');
36442
- }
36443
- else if (isShown && (!element || !guideElement)) {
36444
- guide.hide();
36445
- }
36505
+ guide.handleShow();
36446
36506
  });
36447
36507
  }
36448
36508
  function hideAllEmbeddedGuides() {
@@ -36466,24 +36526,16 @@ var EmbeddedGuides = (function () {
36466
36526
  })) {
36467
36527
  embeddedGuides.push(guide);
36468
36528
  }
36469
- // special case only a single guide is served when in preview mode
36470
- return pluginApi.store.getters['preview/isInPreviewMode']();
36529
+ return false;
36471
36530
  }
36472
36531
  return true;
36473
36532
  }
36474
36533
  function isEmbedded(guide) {
36475
36534
  return !!(guide && guide.launchMethod && guide.launchMethod === 'embed');
36476
36535
  }
36477
- function getActiveStep(guide) {
36478
- if (!guide)
36479
- return null;
36480
- return _.find(guide.steps, function (step) {
36481
- return step.isShown();
36482
- });
36483
- }
36484
36536
  function redrawEmbeddedGuides() {
36485
36537
  _.forEach(embeddedGuides, function (guide) {
36486
- var step = getActiveStep(guide);
36538
+ var step = guide.getActiveStep();
36487
36539
  if (step && !globalPendo.ignoreResize) {
36488
36540
  step.redraw();
36489
36541
  }
@@ -36518,14 +36570,9 @@ var EmbeddedGuides = (function () {
36518
36570
  return !!step;
36519
36571
  });
36520
36572
  if (!guide || !step)
36521
- return;
36573
+ return null;
36522
36574
  return { guide: guide, step: step };
36523
36575
  }
36524
- function shouldAutoDisplay(guide) {
36525
- return (guide.shouldShowSnoozedGuide() || guide.shouldRepeatGuide() || _.all(guide.steps, function (step) {
36526
- return step.shouldRepeat() || (!step.isSnoozed() && step.seenState !== 'dismissed');
36527
- }));
36528
- }
36529
36576
  function initializeEmbeddedGuides() {
36530
36577
  restoreFromPreviouseGuides();
36531
36578
  pluginApi.guides.registerDisplayableGuides('embeddedGuides', embeddedGuides);
@@ -37689,23 +37736,28 @@ var DOMPrompt = /** @class */ (function () {
37689
37736
  this.q = PluginAPI.q;
37690
37737
  this.inputEl = new this.dom.Element(inputCssSelector);
37691
37738
  this.submitEl = new this.dom.Element(submitCssSelector);
37692
- this.inputEl.addEventListener('keyup', function (evt) {
37693
- _this.latestPromptValue = _this.getPromptValue();
37694
- if (evt.code === 'Enter') {
37739
+ this.inputEl.addEventListener('change', function (evt) {
37740
+ // capture value from copy / paste
37741
+ _this.capturePromptValue();
37742
+ }, true);
37743
+ this.inputEl.addEventListener('keydown', function (evt) {
37744
+ var wasEnterKey = evt.code === 'Enter';
37745
+ _this.capturePromptValue(wasEnterKey);
37746
+ if (wasEnterKey) {
37695
37747
  _this.waitThenCheckForSubmit().then(function (wasSubmitted) {
37696
37748
  if (wasSubmitted) {
37697
37749
  _this.submit(_this.latestPromptValue);
37698
37750
  }
37699
37751
  });
37700
37752
  }
37701
- });
37753
+ }, true);
37702
37754
  this.submitEl.addEventListener('click', function () {
37703
37755
  _this.waitThenCheckForSubmit().then(function (wasSubmitted) {
37704
37756
  if (wasSubmitted) {
37705
37757
  _this.submit(_this.latestPromptValue);
37706
37758
  }
37707
37759
  });
37708
- });
37760
+ }, true);
37709
37761
  this.promptContainer = new this.dom.Observer();
37710
37762
  this.promptContainer.addObservers(this.inputEl, this.submitEl);
37711
37763
  }
@@ -37728,6 +37780,18 @@ var DOMPrompt = /** @class */ (function () {
37728
37780
  this._.each(this.listeners, function (cb) { return cb(val); });
37729
37781
  this.latestPromptValue = '';
37730
37782
  };
37783
+ /*
37784
+ * Genernally we want to capture the value from "input" but there can be implementation
37785
+ * dependent scenarios where the input's value has already been cleared by the time we
37786
+ * get the event handler is called. So, in that case, we don't want to throw our saved value out.
37787
+ */
37788
+ DOMPrompt.prototype.capturePromptValue = function (onlyUpdateIfNotEmpty) {
37789
+ if (onlyUpdateIfNotEmpty === void 0) { onlyUpdateIfNotEmpty = false; }
37790
+ var tmp = this.getPromptValue();
37791
+ if (tmp || !onlyUpdateIfNotEmpty) {
37792
+ this.latestPromptValue = tmp;
37793
+ }
37794
+ };
37731
37795
  DOMPrompt.prototype.getPromptValue = function () {
37732
37796
  return this.inputEl.getText();
37733
37797
  };
@@ -44662,7 +44726,7 @@ var _a;
44662
44726
  var __defProp$1 = Object.defineProperty;
44663
44727
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44664
44728
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
44665
- var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
44729
+ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
44666
44730
  NodeType2[NodeType2["Document"] = 0] = "Document";
44667
44731
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
44668
44732
  NodeType2[NodeType2["Element"] = 2] = "Element";
@@ -44670,7 +44734,7 @@ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
44670
44734
  NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
44671
44735
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
44672
44736
  return NodeType2;
44673
- })(NodeType$2 || {});
44737
+ })(NodeType$3 || {});
44674
44738
  const testableAccessors$1 = {
44675
44739
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
44676
44740
  ShadowRoot: ["host", "styleSheets"],
@@ -44805,6 +44869,32 @@ function querySelectorAll$1(n2, selectors) {
44805
44869
  function mutationObserverCtor$1() {
44806
44870
  return getUntaintedPrototype$1("MutationObserver").constructor;
44807
44871
  }
44872
+ function patch$1(source, name, replacement) {
44873
+ try {
44874
+ if (!(name in source)) {
44875
+ return () => {
44876
+ };
44877
+ }
44878
+ const original = source[name];
44879
+ const wrapped = replacement(original);
44880
+ if (typeof wrapped === "function") {
44881
+ wrapped.prototype = wrapped.prototype || {};
44882
+ Object.defineProperties(wrapped, {
44883
+ __rrweb_original__: {
44884
+ enumerable: false,
44885
+ value: original
44886
+ }
44887
+ });
44888
+ }
44889
+ source[name] = wrapped;
44890
+ return () => {
44891
+ source[name] = original;
44892
+ };
44893
+ } catch {
44894
+ return () => {
44895
+ };
44896
+ }
44897
+ }
44808
44898
  const index$1 = {
44809
44899
  childNodes: childNodes$1,
44810
44900
  parentNode: parentNode$1,
@@ -44817,7 +44907,8 @@ const index$1 = {
44817
44907
  shadowRoot: shadowRoot$1,
44818
44908
  querySelector: querySelector$1,
44819
44909
  querySelectorAll: querySelectorAll$1,
44820
- mutationObserver: mutationObserverCtor$1
44910
+ mutationObserver: mutationObserverCtor$1,
44911
+ patch: patch$1
44821
44912
  };
44822
44913
  function isElement(n2) {
44823
44914
  return n2.nodeType === n2.ELEMENT_NODE;
@@ -45121,6 +45212,111 @@ function absolutifyURLs(cssText, href) {
45121
45212
  }
45122
45213
  );
45123
45214
  }
45215
+ function normalizeCssString(cssText, _testNoPxNorm = false) {
45216
+ if (_testNoPxNorm) {
45217
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
45218
+ } else {
45219
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "").replace(/0px/g, "0");
45220
+ }
45221
+ }
45222
+ function splitCssText(cssText, style, _testNoPxNorm = false) {
45223
+ const childNodes2 = Array.from(style.childNodes);
45224
+ const splits = [];
45225
+ let iterCount = 0;
45226
+ if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
45227
+ let cssTextNorm = normalizeCssString(cssText, _testNoPxNorm);
45228
+ const normFactor = cssTextNorm.length / cssText.length;
45229
+ for (let i2 = 1; i2 < childNodes2.length; i2++) {
45230
+ if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
45231
+ const textContentNorm = normalizeCssString(
45232
+ childNodes2[i2].textContent,
45233
+ _testNoPxNorm
45234
+ );
45235
+ const jLimit = 100;
45236
+ let j = 3;
45237
+ for (; j < textContentNorm.length; j++) {
45238
+ if (
45239
+ // keep consuming css identifiers (to get a decent chunk more quickly)
45240
+ textContentNorm[j].match(/[a-zA-Z0-9]/) || // substring needs to be unique to this section
45241
+ textContentNorm.indexOf(textContentNorm.substring(0, j), 1) !== -1
45242
+ ) {
45243
+ continue;
45244
+ }
45245
+ break;
45246
+ }
45247
+ for (; j < textContentNorm.length; j++) {
45248
+ let startSubstring = textContentNorm.substring(0, j);
45249
+ let cssNormSplits = cssTextNorm.split(startSubstring);
45250
+ let splitNorm = -1;
45251
+ if (cssNormSplits.length === 2) {
45252
+ splitNorm = cssNormSplits[0].length;
45253
+ } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
45254
+ splitNorm = cssTextNorm.indexOf(startSubstring, 1);
45255
+ } else if (cssNormSplits.length === 1) {
45256
+ startSubstring = startSubstring.substring(
45257
+ 0,
45258
+ startSubstring.length - 1
45259
+ );
45260
+ cssNormSplits = cssTextNorm.split(startSubstring);
45261
+ if (cssNormSplits.length <= 1) {
45262
+ splits.push(cssText);
45263
+ return splits;
45264
+ }
45265
+ j = jLimit + 1;
45266
+ } else if (j === textContentNorm.length - 1) {
45267
+ splitNorm = cssTextNorm.indexOf(startSubstring);
45268
+ }
45269
+ if (cssNormSplits.length >= 2 && j > jLimit) {
45270
+ const prevTextContent = childNodes2[i2 - 1].textContent;
45271
+ if (prevTextContent && typeof prevTextContent === "string") {
45272
+ const prevMinLength = normalizeCssString(prevTextContent).length;
45273
+ splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);
45274
+ }
45275
+ if (splitNorm === -1) {
45276
+ splitNorm = cssNormSplits[0].length;
45277
+ }
45278
+ }
45279
+ if (splitNorm !== -1) {
45280
+ let k = Math.floor(splitNorm / normFactor);
45281
+ for (; k > 0 && k < cssText.length; ) {
45282
+ iterCount += 1;
45283
+ if (iterCount > 50 * childNodes2.length) {
45284
+ splits.push(cssText);
45285
+ return splits;
45286
+ }
45287
+ const normPart = normalizeCssString(
45288
+ cssText.substring(0, k),
45289
+ _testNoPxNorm
45290
+ );
45291
+ if (normPart.length === splitNorm) {
45292
+ splits.push(cssText.substring(0, k));
45293
+ cssText = cssText.substring(k);
45294
+ cssTextNorm = cssTextNorm.substring(splitNorm);
45295
+ break;
45296
+ } else if (normPart.length < splitNorm) {
45297
+ k += Math.max(
45298
+ 1,
45299
+ Math.floor((splitNorm - normPart.length) / normFactor)
45300
+ );
45301
+ } else {
45302
+ k -= Math.max(
45303
+ 1,
45304
+ Math.floor((normPart.length - splitNorm) * normFactor)
45305
+ );
45306
+ }
45307
+ }
45308
+ break;
45309
+ }
45310
+ }
45311
+ }
45312
+ }
45313
+ }
45314
+ splits.push(cssText);
45315
+ return splits;
45316
+ }
45317
+ function markCssSplits(cssText, style) {
45318
+ return splitCssText(cssText, style).join("/* rr_split */");
45319
+ }
45124
45320
  let _id = 1;
45125
45321
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
45126
45322
  const IGNORED_NODE = -2;
@@ -45381,27 +45577,28 @@ function serializeNode(n2, options) {
45381
45577
  inlineImages,
45382
45578
  recordCanvas,
45383
45579
  keepIframeSrcFn,
45384
- newlyAddedElement = false
45580
+ newlyAddedElement = false,
45581
+ cssCaptured = false
45385
45582
  } = options;
45386
45583
  const rootId = getRootId(doc, mirror2);
45387
45584
  switch (n2.nodeType) {
45388
45585
  case n2.DOCUMENT_NODE:
45389
45586
  if (n2.compatMode !== "CSS1Compat") {
45390
45587
  return {
45391
- type: NodeType$2.Document,
45588
+ type: NodeType$3.Document,
45392
45589
  childNodes: [],
45393
45590
  compatMode: n2.compatMode
45394
45591
  // probably "BackCompat"
45395
45592
  };
45396
45593
  } else {
45397
45594
  return {
45398
- type: NodeType$2.Document,
45595
+ type: NodeType$3.Document,
45399
45596
  childNodes: []
45400
45597
  };
45401
45598
  }
45402
45599
  case n2.DOCUMENT_TYPE_NODE:
45403
45600
  return {
45404
- type: NodeType$2.DocumentType,
45601
+ type: NodeType$3.DocumentType,
45405
45602
  name: n2.name,
45406
45603
  publicId: n2.publicId,
45407
45604
  systemId: n2.systemId,
@@ -45430,17 +45627,18 @@ function serializeNode(n2, options) {
45430
45627
  maskTextFn,
45431
45628
  maskInputOptions,
45432
45629
  maskInputFn,
45433
- rootId
45630
+ rootId,
45631
+ cssCaptured
45434
45632
  });
45435
45633
  case n2.CDATA_SECTION_NODE:
45436
45634
  return {
45437
- type: NodeType$2.CDATA,
45635
+ type: NodeType$3.CDATA,
45438
45636
  textContent: "",
45439
45637
  rootId
45440
45638
  };
45441
45639
  case n2.COMMENT_NODE:
45442
45640
  return {
45443
- type: NodeType$2.Comment,
45641
+ type: NodeType$3.Comment,
45444
45642
  textContent: index$1.textContent(n2) || "",
45445
45643
  rootId
45446
45644
  };
@@ -45455,18 +45653,26 @@ function getRootId(doc, mirror2) {
45455
45653
  }
45456
45654
  function serializeTextNode(n2, options) {
45457
45655
  var _a2;
45458
- const { needsMask, maskTextFn, rootId, maskInputOptions, maskInputFn } = options;
45459
- const parent = index$1.parentNode(n2);
45460
- const parentTagName = parent && parent.tagName;
45461
- let text = index$1.textContent(n2);
45656
+ const {
45657
+ needsMask,
45658
+ maskTextFn,
45659
+ maskInputOptions,
45660
+ maskInputFn,
45661
+ rootId,
45662
+ cssCaptured
45663
+ } = options;
45664
+ const parentTagName = n2.parentNode && n2.parentNode.tagName;
45665
+ let textContent2 = "";
45462
45666
  const isStyle = parentTagName === "STYLE" ? true : void 0;
45463
45667
  const isScript = parentTagName === "SCRIPT" ? true : void 0;
45464
45668
  const isTextarea = parentTagName === "TEXTAREA" ? true : void 0;
45465
- if (isStyle && text) {
45669
+ if (isStyle && textContent2) {
45466
45670
  try {
45467
45671
  if (n2.nextSibling || n2.previousSibling) {
45468
- } else if ((_a2 = parent.sheet) == null ? void 0 : _a2.cssRules) {
45469
- text = stringifyStylesheet(parent.sheet);
45672
+ } else if ((_a2 = n2.parentNode.sheet) == null ? void 0 : _a2.cssRules) {
45673
+ textContent2 = stringifyStylesheet(
45674
+ n2.parentNode.sheet
45675
+ );
45470
45676
  }
45471
45677
  } catch (err) {
45472
45678
  console.warn(
@@ -45474,21 +45680,25 @@ function serializeTextNode(n2, options) {
45474
45680
  n2
45475
45681
  );
45476
45682
  }
45477
- text = absolutifyURLs(text, getHref(options.doc));
45683
+ textContent2 = absolutifyURLs(textContent2, getHref(options.doc));
45478
45684
  }
45479
45685
  if (isScript) {
45480
- text = "SCRIPT_PLACEHOLDER";
45686
+ textContent2 = "SCRIPT_PLACEHOLDER";
45687
+ } else if (!cssCaptured) {
45688
+ textContent2 = index$1.textContent(n2);
45689
+ if (isStyle && textContent2) {
45690
+ textContent2 = absolutifyURLs(textContent2, getHref(options.doc));
45691
+ }
45481
45692
  }
45482
- if (!isStyle && !isScript && text && needsMask) {
45483
- text = maskTextFn ? maskTextFn(text, index$1.parentElement(n2)) : text.replace(/[\S]/g, "*");
45693
+ if (!isStyle && !isScript && textContent2 && needsMask) {
45694
+ textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
45484
45695
  }
45485
- if (isTextarea && text && maskInputOptions.textarea) {
45486
- text = maskInputFn ? maskInputFn(text, n2.parentNode) : text.replace(/[\S]/g, "*");
45696
+ if (isTextarea && textContent2 && maskInputOptions.textarea) {
45697
+ textContent2 = maskInputFn ? maskInputFn(textContent2, n2.parentNode) : textContent2.replace(/[\S]/g, "*");
45487
45698
  }
45488
45699
  return {
45489
- type: NodeType$2.Text,
45490
- textContent: text || "",
45491
- isStyle,
45700
+ type: NodeType$3.Text,
45701
+ textContent: textContent2 || "",
45492
45702
  rootId
45493
45703
  };
45494
45704
  }
@@ -45537,12 +45747,14 @@ function serializeElementNode(n2, options) {
45537
45747
  attributes._cssText = cssText;
45538
45748
  }
45539
45749
  }
45540
- if (tagName === "style" && n2.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
45541
- !(n2.innerText || index$1.textContent(n2) || "").trim().length) {
45542
- const cssText = stringifyStylesheet(
45750
+ if (tagName === "style" && n2.sheet) {
45751
+ let cssText = stringifyStylesheet(
45543
45752
  n2.sheet
45544
45753
  );
45545
45754
  if (cssText) {
45755
+ if (n2.childNodes.length > 1) {
45756
+ cssText = markCssSplits(cssText, n2);
45757
+ }
45546
45758
  attributes._cssText = cssText;
45547
45759
  }
45548
45760
  }
@@ -45673,7 +45885,7 @@ function serializeElementNode(n2, options) {
45673
45885
  } catch (e2) {
45674
45886
  }
45675
45887
  return {
45676
- type: NodeType$2.Element,
45888
+ type: NodeType$3.Element,
45677
45889
  tagName,
45678
45890
  attributes,
45679
45891
  childNodes: [],
@@ -45691,12 +45903,12 @@ function lowerIfExists(maybeAttr) {
45691
45903
  }
45692
45904
  }
45693
45905
  function slimDOMExcluded(sn, slimDOMOptions) {
45694
- if (slimDOMOptions.comment && sn.type === NodeType$2.Comment) {
45906
+ if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) {
45695
45907
  return true;
45696
- } else if (sn.type === NodeType$2.Element) {
45908
+ } else if (sn.type === NodeType$3.Element) {
45697
45909
  if (slimDOMOptions.script && // script tag
45698
45910
  (sn.tagName === "script" || // (module)preload link
45699
- sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
45911
+ sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
45700
45912
  sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
45701
45913
  return true;
45702
45914
  } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
@@ -45745,7 +45957,8 @@ function serializeNodeWithId(n2, options) {
45745
45957
  onStylesheetLoad,
45746
45958
  stylesheetLoadTimeout = 5e3,
45747
45959
  keepIframeSrcFn = () => false,
45748
- newlyAddedElement = false
45960
+ newlyAddedElement = false,
45961
+ cssCaptured = false
45749
45962
  } = options;
45750
45963
  let { needsMask } = options;
45751
45964
  let { preserveWhiteSpace = true } = options;
@@ -45772,7 +45985,8 @@ function serializeNodeWithId(n2, options) {
45772
45985
  inlineImages,
45773
45986
  recordCanvas,
45774
45987
  keepIframeSrcFn,
45775
- newlyAddedElement
45988
+ newlyAddedElement,
45989
+ cssCaptured
45776
45990
  });
45777
45991
  if (!_serializedNode) {
45778
45992
  console.warn(n2, "not serialized");
@@ -45781,7 +45995,7 @@ function serializeNodeWithId(n2, options) {
45781
45995
  let id;
45782
45996
  if (mirror2.hasNode(n2)) {
45783
45997
  id = mirror2.getId(n2);
45784
- } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$2.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
45998
+ } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
45785
45999
  id = IGNORED_NODE;
45786
46000
  } else {
45787
46001
  id = genId();
@@ -45795,15 +46009,15 @@ function serializeNodeWithId(n2, options) {
45795
46009
  onSerialize(n2);
45796
46010
  }
45797
46011
  let recordChild = !skipChild;
45798
- if (serializedNode.type === NodeType$2.Element) {
46012
+ if (serializedNode.type === NodeType$3.Element) {
45799
46013
  recordChild = recordChild && !serializedNode.needBlock;
45800
46014
  delete serializedNode.needBlock;
45801
46015
  const shadowRootEl = index$1.shadowRoot(n2);
45802
46016
  if (shadowRootEl && isNativeShadowDom(shadowRootEl))
45803
46017
  serializedNode.isShadowHost = true;
45804
46018
  }
45805
- if ((serializedNode.type === NodeType$2.Document || serializedNode.type === NodeType$2.Element) && recordChild) {
45806
- if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$2.Element && serializedNode.tagName === "head") {
46019
+ if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) {
46020
+ if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") {
45807
46021
  preserveWhiteSpace = false;
45808
46022
  }
45809
46023
  const bypassOptions = {
@@ -45829,10 +46043,14 @@ function serializeNodeWithId(n2, options) {
45829
46043
  iframeLoadTimeout,
45830
46044
  onStylesheetLoad,
45831
46045
  stylesheetLoadTimeout,
45832
- keepIframeSrcFn
46046
+ keepIframeSrcFn,
46047
+ cssCaptured: false
45833
46048
  };
45834
- if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
46049
+ if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
45835
46050
  else {
46051
+ if (serializedNode.type === NodeType$3.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
46052
+ bypassOptions.cssCaptured = true;
46053
+ }
45836
46054
  for (const childN of Array.from(index$1.childNodes(n2))) {
45837
46055
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
45838
46056
  if (serializedChildNode) {
@@ -45855,7 +46073,7 @@ function serializeNodeWithId(n2, options) {
45855
46073
  if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
45856
46074
  serializedNode.isShadow = true;
45857
46075
  }
45858
- if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "iframe") {
46076
+ if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") {
45859
46077
  onceIframeLoaded(
45860
46078
  n2,
45861
46079
  () => {
@@ -45897,7 +46115,7 @@ function serializeNodeWithId(n2, options) {
45897
46115
  iframeLoadTimeout
45898
46116
  );
45899
46117
  }
45900
- if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {
46118
+ if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {
45901
46119
  onceStylesheetLoaded(
45902
46120
  n2,
45903
46121
  () => {
@@ -46232,6 +46450,32 @@ function querySelectorAll(n2, selectors) {
46232
46450
  function mutationObserverCtor() {
46233
46451
  return getUntaintedPrototype("MutationObserver").constructor;
46234
46452
  }
46453
+ function patch(source, name, replacement) {
46454
+ try {
46455
+ if (!(name in source)) {
46456
+ return () => {
46457
+ };
46458
+ }
46459
+ const original = source[name];
46460
+ const wrapped = replacement(original);
46461
+ if (typeof wrapped === "function") {
46462
+ wrapped.prototype = wrapped.prototype || {};
46463
+ Object.defineProperties(wrapped, {
46464
+ __rrweb_original__: {
46465
+ enumerable: false,
46466
+ value: original
46467
+ }
46468
+ });
46469
+ }
46470
+ source[name] = wrapped;
46471
+ return () => {
46472
+ source[name] = original;
46473
+ };
46474
+ } catch {
46475
+ return () => {
46476
+ };
46477
+ }
46478
+ }
46235
46479
  const index = {
46236
46480
  childNodes,
46237
46481
  parentNode,
@@ -46244,7 +46488,8 @@ const index = {
46244
46488
  shadowRoot,
46245
46489
  querySelector,
46246
46490
  querySelectorAll,
46247
- mutationObserver: mutationObserverCtor
46491
+ mutationObserver: mutationObserverCtor,
46492
+ patch
46248
46493
  };
46249
46494
  function getWindow(documentOrWindow) {
46250
46495
  const defaultView = documentOrWindow.defaultView;
@@ -46337,35 +46582,6 @@ function hookSetter(target, key, d, isRevoked, win = window) {
46337
46582
  );
46338
46583
  return () => hookSetter(target, key, original || {}, true);
46339
46584
  }
46340
- function patch(source, name, replacement) {
46341
- try {
46342
- if (!(name in source)) {
46343
- return () => {
46344
- };
46345
- }
46346
- const original = source[name];
46347
- const wrapped = replacement(original);
46348
- if (typeof wrapped === "function") {
46349
- wrapped.toString = function() {
46350
- return original.toString();
46351
- };
46352
- wrapped.prototype = wrapped.prototype || {};
46353
- Object.defineProperties(wrapped, {
46354
- __rrweb_original__: {
46355
- enumerable: false,
46356
- value: original
46357
- }
46358
- });
46359
- }
46360
- source[name] = wrapped;
46361
- return () => {
46362
- source[name] = original;
46363
- };
46364
- } catch {
46365
- return () => {
46366
- };
46367
- }
46368
- }
46369
46585
  let nowTimestamp = Date.now;
46370
46586
  if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
46371
46587
  nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
@@ -46592,6 +46808,15 @@ var MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {
46592
46808
  MediaInteractions2[MediaInteractions2["RateChange"] = 4] = "RateChange";
46593
46809
  return MediaInteractions2;
46594
46810
  })(MediaInteractions || {});
46811
+ var NodeType = /* @__PURE__ */ ((NodeType2) => {
46812
+ NodeType2[NodeType2["Document"] = 0] = "Document";
46813
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
46814
+ NodeType2[NodeType2["Element"] = 2] = "Element";
46815
+ NodeType2[NodeType2["Text"] = 3] = "Text";
46816
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
46817
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
46818
+ return NodeType2;
46819
+ })(NodeType || {});
46595
46820
  function isNodeInLinkedList(n2) {
46596
46821
  return "__ln" in n2;
46597
46822
  }
@@ -46754,9 +46979,18 @@ class MutationBuffer {
46754
46979
  };
46755
46980
  const pushAdd = (n2) => {
46756
46981
  const parent = index.parentNode(n2);
46757
- if (!parent || !inDom(n2) || parent.tagName === "TEXTAREA") {
46982
+ if (!parent || !inDom(n2)) {
46758
46983
  return;
46759
46984
  }
46985
+ let cssCaptured = false;
46986
+ if (n2.nodeType === Node.TEXT_NODE) {
46987
+ const parentTag = parent.tagName;
46988
+ if (parentTag === "TEXTAREA") {
46989
+ return;
46990
+ } else if (parentTag === "STYLE" && this.addedSet.has(parent)) {
46991
+ cssCaptured = true;
46992
+ }
46993
+ }
46760
46994
  const parentId = isShadowRoot(parent) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(parent);
46761
46995
  const nextId = getNextId(n2);
46762
46996
  if (parentId === -1 || nextId === -1) {
@@ -46798,7 +47032,8 @@ class MutationBuffer {
46798
47032
  },
46799
47033
  onStylesheetLoad: (link, childSn) => {
46800
47034
  this.stylesheetManager.attachLinkElement(link, childSn);
46801
- }
47035
+ },
47036
+ cssCaptured
46802
47037
  });
46803
47038
  if (sn) {
46804
47039
  adds.push({
@@ -46936,10 +47171,18 @@ class MutationBuffer {
46936
47171
  this.attributes.push(item);
46937
47172
  this.attributeMap.set(textarea, item);
46938
47173
  }
46939
- item.attributes.value = Array.from(
47174
+ const value = Array.from(
46940
47175
  index.childNodes(textarea),
46941
47176
  (cn) => index.textContent(cn) || ""
46942
47177
  ).join("");
47178
+ item.attributes.value = maskInputValue({
47179
+ element: textarea,
47180
+ maskInputOptions: this.maskInputOptions,
47181
+ tagName: textarea.tagName,
47182
+ type: getInputType(textarea),
47183
+ value,
47184
+ maskInputFn: this.maskInputFn
47185
+ });
46943
47186
  });
46944
47187
  __publicField(this, "processMutation", (m) => {
46945
47188
  if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
@@ -48559,7 +48802,7 @@ class IframeManager {
48559
48802
  }
48560
48803
  }
48561
48804
  patchRootIdOnNode(node, rootId) {
48562
- if (node.type !== NodeType$2.Document && !node.rootId) node.rootId = rootId;
48805
+ if (node.type !== NodeType.Document && !node.rootId) node.rootId = rootId;
48563
48806
  if ("childNodes" in node) {
48564
48807
  node.childNodes.forEach((child) => {
48565
48808
  this.patchRootIdOnNode(child, rootId);