@gemx-dev/clarity-js 0.8.85 → 0.8.87

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/build/clarity.js CHANGED
@@ -4,6 +4,7 @@ var dom = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
5
5
  get add () { return add$1; },
6
6
  get get () { return get; },
7
+ get getHashes () { return getHashes; },
7
8
  get getId () { return getId$1; },
8
9
  get getNode () { return getNode; },
9
10
  get getValue () { return getValue; },
@@ -15,8 +16,8 @@ var dom = /*#__PURE__*/Object.freeze({
15
16
  get parse () { return parse; },
16
17
  get removeIFrame () { return removeIFrame; },
17
18
  get sameorigin () { return sameorigin; },
18
- get start () { return start$l; },
19
- get stop () { return stop$j; },
19
+ get start () { return start$m; },
20
+ get stop () { return stop$k; },
20
21
  get update () { return update; },
21
22
  get updates () { return updates$2; }
22
23
  });
@@ -24,24 +25,26 @@ var timeline = /*#__PURE__*/Object.freeze({
24
25
  __proto__: null,
25
26
  get compute () { return compute$5; },
26
27
  get reset () { return reset$5; },
27
- get start () { return start$j; },
28
- get stop () { return stop$h; },
28
+ get start () { return start$k; },
29
+ get stop () { return stop$i; },
29
30
  get track () { return track$2; },
30
31
  get updates () { return updates$1; }
31
32
  });
32
33
  var upload$1 = /*#__PURE__*/Object.freeze({
33
34
  __proto__: null,
34
- get flush () { return flush; },
35
+ get flush () { return flush$1; },
36
+ get inject () { return inject; },
35
37
  get queue () { return queue; },
36
- get start () { return start$h; },
37
- get stop () { return stop$f; },
38
- get track () { return track$1; }
38
+ get start () { return start$i; },
39
+ get stop () { return stop$g; },
40
+ get track () { return track$1; },
41
+ get uploadNow () { return uploadNow; }
39
42
  });
40
43
  var upgrade$1 = /*#__PURE__*/Object.freeze({
41
44
  __proto__: null,
42
45
  get data () { return data$6; },
43
- get start () { return start$c; },
44
- get stop () { return stop$c; },
46
+ get start () { return start$d; },
47
+ get stop () { return stop$d; },
45
48
  get upgrade () { return upgrade; }
46
49
  });
47
50
  var limit = /*#__PURE__*/Object.freeze({
@@ -49,8 +52,8 @@ var limit = /*#__PURE__*/Object.freeze({
49
52
  get check () { return check$2; },
50
53
  get compute () { return compute$4; },
51
54
  get data () { return data$5; },
52
- get start () { return start$b; },
53
- get stop () { return stop$b; },
55
+ get start () { return start$c; },
56
+ get stop () { return stop$c; },
54
57
  get trigger () { return trigger; }
55
58
  });
56
59
  var dimension = /*#__PURE__*/Object.freeze({
@@ -59,8 +62,8 @@ var dimension = /*#__PURE__*/Object.freeze({
59
62
  get data () { return data$4; },
60
63
  get log () { return log; },
61
64
  get reset () { return reset$3; },
62
- get start () { return start$a; },
63
- get stop () { return stop$a; },
65
+ get start () { return start$b; },
66
+ get stop () { return stop$b; },
64
67
  get updates () { return updates; }
65
68
  });
66
69
  var consent$2 = /*#__PURE__*/Object.freeze({
@@ -69,8 +72,8 @@ var consent$2 = /*#__PURE__*/Object.freeze({
69
72
  get config () { return config$1; },
70
73
  get consent () { return consent$1; },
71
74
  get data () { return data$3; },
72
- get start () { return start$9; },
73
- get stop () { return stop$9; },
75
+ get start () { return start$a; },
76
+ get stop () { return stop$a; },
74
77
  get trackConsentv2 () { return trackConsentv2; }
75
78
  });
76
79
  var metadata$1 = /*#__PURE__*/Object.freeze({
@@ -86,15 +89,15 @@ var metadata$1 = /*#__PURE__*/Object.freeze({
86
89
  get metadata () { return metadata; },
87
90
  get save () { return save; },
88
91
  get shortid () { return shortid; },
89
- get start () { return start$8; },
90
- get stop () { return stop$8; }
92
+ get start () { return start$9; },
93
+ get stop () { return stop$9; }
91
94
  });
92
95
  var envelope$1 = /*#__PURE__*/Object.freeze({
93
96
  __proto__: null,
94
97
  get data () { return data$1; },
95
98
  get envelope () { return envelope; },
96
- get start () { return start$7; },
97
- get stop () { return stop$7; }
99
+ get start () { return start$8; },
100
+ get stop () { return stop$8; }
98
101
  });
99
102
  var clarity = /*#__PURE__*/Object.freeze({
100
103
  __proto__: null,
@@ -111,7 +114,7 @@ var clarity = /*#__PURE__*/Object.freeze({
111
114
  get queue () { return queue; },
112
115
  get register () { return register; },
113
116
  get resume () { return resume; },
114
- get schedule () { return schedule; },
117
+ get schedule () { return schedule$1; },
115
118
  get set () { return set$1; },
116
119
  get signal () { return signal; },
117
120
  get start () { return start; },
@@ -159,7 +162,7 @@ function process$8() {
159
162
  }
160
163
  }
161
164
 
162
- var config$2 = {
165
+ var config$3 = {
163
166
  projectId: null,
164
167
  delay: 1 * 1000 /* Time.Second */,
165
168
  lean: false,
@@ -188,6 +191,7 @@ var config$2 = {
188
191
  externalSession: false,
189
192
  userId: null,
190
193
  sessionId: null,
194
+ mode: "gemx",
191
195
  };
192
196
 
193
197
  function api(method) {
@@ -201,7 +205,7 @@ var startTime = 0;
201
205
  function computeStartTime() {
202
206
  return performance.now() + performance.timeOrigin;
203
207
  }
204
- function start$P() {
208
+ function start$R() {
205
209
  startTime = computeStartTime();
206
210
  }
207
211
  // event.timestamp is number of milliseconds elapsed since the document was loaded
@@ -217,11 +221,11 @@ function time(event) {
217
221
  var origin = event && event.view ? event.view.performance.timeOrigin : performance.timeOrigin;
218
222
  return Math.max(Math.round(ts + origin - baseline), 0);
219
223
  }
220
- function stop$M() {
224
+ function stop$O() {
221
225
  startTime = 0;
222
226
  }
223
227
 
224
- var version$1 = "0.8.85";
228
+ var version$1 = "0.8.87";
225
229
 
226
230
  // tslint:disable: no-bitwise
227
231
  function hash (input, precision) {
@@ -341,7 +345,7 @@ function url$1(input, electron, truncate) {
341
345
  result = "".concat("https://" /* Data.Constant.HTTPS */).concat("Electron" /* Data.Constant.Electron */);
342
346
  }
343
347
  else {
344
- var drop_1 = config$2.drop;
348
+ var drop_1 = config$3.drop;
345
349
  if (drop_1 && drop_1.length > 0 && input && input.indexOf("?") > 0) {
346
350
  var _a = input.split("?"), path = _a[0], query = _a[1];
347
351
  var swap_1 = "*na*" /* Data.Constant.Dropped */;
@@ -439,9 +443,9 @@ function redact$1(value) {
439
443
  }
440
444
 
441
445
  var state$b = null;
442
- var buffer = null;
446
+ var buffer$1 = null;
443
447
  var update$2 = false;
444
- function start$O() {
448
+ function start$Q() {
445
449
  update$2 = false;
446
450
  reset$u();
447
451
  }
@@ -450,35 +454,35 @@ function reset$u() {
450
454
  // reset the state to current value after sending the previous state
451
455
  if (update$2) {
452
456
  state$b = { time: time(), event: 4 /* Event.Baseline */, data: {
453
- visible: buffer.visible,
454
- docWidth: buffer.docWidth,
455
- docHeight: buffer.docHeight,
456
- screenWidth: buffer.screenWidth,
457
- screenHeight: buffer.screenHeight,
458
- scrollX: buffer.scrollX,
459
- scrollY: buffer.scrollY,
460
- pointerX: buffer.pointerX,
461
- pointerY: buffer.pointerY,
462
- activityTime: buffer.activityTime,
463
- scrollTime: buffer.scrollTime,
464
- pointerTime: buffer.pointerTime,
465
- moveX: buffer.moveX,
466
- moveY: buffer.moveY,
467
- moveTime: buffer.moveTime,
468
- downX: buffer.downX,
469
- downY: buffer.downY,
470
- downTime: buffer.downTime,
471
- upX: buffer.upX,
472
- upY: buffer.upY,
473
- upTime: buffer.upTime,
474
- pointerPrevX: buffer.pointerPrevX,
475
- pointerPrevY: buffer.pointerPrevY,
476
- pointerPrevTime: buffer.pointerPrevTime,
477
- modules: buffer.modules,
457
+ visible: buffer$1.visible,
458
+ docWidth: buffer$1.docWidth,
459
+ docHeight: buffer$1.docHeight,
460
+ screenWidth: buffer$1.screenWidth,
461
+ screenHeight: buffer$1.screenHeight,
462
+ scrollX: buffer$1.scrollX,
463
+ scrollY: buffer$1.scrollY,
464
+ pointerX: buffer$1.pointerX,
465
+ pointerY: buffer$1.pointerY,
466
+ activityTime: buffer$1.activityTime,
467
+ scrollTime: buffer$1.scrollTime,
468
+ pointerTime: buffer$1.pointerTime,
469
+ moveX: buffer$1.moveX,
470
+ moveY: buffer$1.moveY,
471
+ moveTime: buffer$1.moveTime,
472
+ downX: buffer$1.downX,
473
+ downY: buffer$1.downY,
474
+ downTime: buffer$1.downTime,
475
+ upX: buffer$1.upX,
476
+ upY: buffer$1.upY,
477
+ upTime: buffer$1.upTime,
478
+ pointerPrevX: buffer$1.pointerPrevX,
479
+ pointerPrevY: buffer$1.pointerPrevY,
480
+ pointerPrevTime: buffer$1.pointerPrevTime,
481
+ modules: buffer$1.modules,
478
482
  }
479
483
  };
480
484
  }
481
- buffer = buffer ? buffer : {
485
+ buffer$1 = buffer$1 ? buffer$1 : {
482
486
  visible: 1 /* BooleanFlag.True */,
483
487
  docWidth: 0,
484
488
  docHeight: 0,
@@ -509,74 +513,74 @@ function reset$u() {
509
513
  function track$8(event, x, y, time) {
510
514
  switch (event) {
511
515
  case 8 /* Event.Document */:
512
- buffer.docWidth = x;
513
- buffer.docHeight = y;
516
+ buffer$1.docWidth = x;
517
+ buffer$1.docHeight = y;
514
518
  break;
515
519
  case 11 /* Event.Resize */:
516
- buffer.screenWidth = x;
517
- buffer.screenHeight = y;
520
+ buffer$1.screenWidth = x;
521
+ buffer$1.screenHeight = y;
518
522
  break;
519
523
  case 10 /* Event.Scroll */:
520
- buffer.scrollX = x;
521
- buffer.scrollY = y;
522
- buffer.scrollTime = time;
524
+ buffer$1.scrollX = x;
525
+ buffer$1.scrollY = y;
526
+ buffer$1.scrollTime = time;
523
527
  break;
524
528
  case 12 /* Event.MouseMove */:
525
- buffer.moveX = x;
526
- buffer.moveY = y;
527
- buffer.moveTime = time;
528
- buffer.pointerPrevX = buffer.pointerX;
529
- buffer.pointerPrevY = buffer.pointerY;
530
- buffer.pointerPrevTime = buffer.pointerTime;
531
- buffer.pointerX = x;
532
- buffer.pointerY = y;
533
- buffer.pointerTime = time;
529
+ buffer$1.moveX = x;
530
+ buffer$1.moveY = y;
531
+ buffer$1.moveTime = time;
532
+ buffer$1.pointerPrevX = buffer$1.pointerX;
533
+ buffer$1.pointerPrevY = buffer$1.pointerY;
534
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
535
+ buffer$1.pointerX = x;
536
+ buffer$1.pointerY = y;
537
+ buffer$1.pointerTime = time;
534
538
  break;
535
539
  case 13 /* Event.MouseDown */:
536
- buffer.downX = x;
537
- buffer.downY = y;
538
- buffer.downTime = time;
539
- buffer.pointerPrevX = buffer.pointerX;
540
- buffer.pointerPrevY = buffer.pointerY;
541
- buffer.pointerPrevTime = buffer.pointerTime;
542
- buffer.pointerX = x;
543
- buffer.pointerY = y;
544
- buffer.pointerTime = time;
540
+ buffer$1.downX = x;
541
+ buffer$1.downY = y;
542
+ buffer$1.downTime = time;
543
+ buffer$1.pointerPrevX = buffer$1.pointerX;
544
+ buffer$1.pointerPrevY = buffer$1.pointerY;
545
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
546
+ buffer$1.pointerX = x;
547
+ buffer$1.pointerY = y;
548
+ buffer$1.pointerTime = time;
545
549
  break;
546
550
  case 14 /* Event.MouseUp */:
547
- buffer.upX = x;
548
- buffer.upY = y;
549
- buffer.upTime = time;
550
- buffer.pointerPrevX = buffer.pointerX;
551
- buffer.pointerPrevY = buffer.pointerY;
552
- buffer.pointerPrevTime = buffer.pointerTime;
553
- buffer.pointerX = x;
554
- buffer.pointerY = y;
555
- buffer.pointerTime = time;
551
+ buffer$1.upX = x;
552
+ buffer$1.upY = y;
553
+ buffer$1.upTime = time;
554
+ buffer$1.pointerPrevX = buffer$1.pointerX;
555
+ buffer$1.pointerPrevY = buffer$1.pointerY;
556
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
557
+ buffer$1.pointerX = x;
558
+ buffer$1.pointerY = y;
559
+ buffer$1.pointerTime = time;
556
560
  break;
557
561
  default:
558
- buffer.pointerPrevX = buffer.pointerX;
559
- buffer.pointerPrevY = buffer.pointerY;
560
- buffer.pointerPrevTime = buffer.pointerTime;
561
- buffer.pointerX = x;
562
- buffer.pointerY = y;
563
- buffer.pointerTime = time;
562
+ buffer$1.pointerPrevX = buffer$1.pointerX;
563
+ buffer$1.pointerPrevY = buffer$1.pointerY;
564
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
565
+ buffer$1.pointerX = x;
566
+ buffer$1.pointerY = y;
567
+ buffer$1.pointerTime = time;
564
568
  break;
565
569
  }
566
570
  update$2 = true;
567
571
  }
568
572
  function activity(t) {
569
- buffer.activityTime = t;
573
+ buffer$1.activityTime = t;
570
574
  }
571
575
  function visibility$1(t, visible) {
572
- buffer.visible = visible;
573
- if (!buffer.visible) {
576
+ buffer$1.visible = visible;
577
+ if (!buffer$1.visible) {
574
578
  activity(t);
575
579
  }
576
580
  update$2 = true;
577
581
  }
578
582
  function dynamic$1(modules) {
579
- buffer.modules = Array.from(modules);
583
+ buffer$1.modules = Array.from(modules);
580
584
  update$2 = true;
581
585
  }
582
586
  function compute$g() {
@@ -584,7 +588,7 @@ function compute$g() {
584
588
  encode$1(4 /* Event.Baseline */);
585
589
  }
586
590
  }
587
- function stop$L() {
591
+ function stop$N() {
588
592
  reset$u();
589
593
  }
590
594
 
@@ -594,9 +598,9 @@ var baseline = /*#__PURE__*/Object.freeze({
594
598
  compute: compute$g,
595
599
  dynamic: dynamic$1,
596
600
  reset: reset$u,
597
- start: start$O,
601
+ start: start$Q,
598
602
  get state () { return state$b; },
599
- stop: stop$L,
603
+ stop: stop$N,
600
604
  track: track$8,
601
605
  visibility: visibility$1
602
606
  });
@@ -621,12 +625,12 @@ function event$1(a, b) {
621
625
 
622
626
  var data$k = null;
623
627
  var updates$3 = null;
624
- function start$N() {
628
+ function start$P() {
625
629
  data$k = {};
626
630
  updates$3 = {};
627
631
  count$1(5 /* Metric.InvokeCount */);
628
632
  }
629
- function stop$K() {
633
+ function stop$M() {
630
634
  data$k = {};
631
635
  updates$3 = {};
632
636
  }
@@ -682,7 +686,7 @@ var data$j;
682
686
  var last = 0;
683
687
  var interval = 0;
684
688
  var timeout$7 = null;
685
- function start$M() {
689
+ function start$O() {
686
690
  interval = 60000 /* Setting.PingInterval */;
687
691
  last = 0;
688
692
  }
@@ -704,7 +708,7 @@ function ping() {
704
708
  suspend();
705
709
  }
706
710
  }
707
- function stop$J() {
711
+ function stop$L() {
708
712
  clearTimeout$1(timeout$7);
709
713
  last = 0;
710
714
  interval = 0;
@@ -714,15 +718,15 @@ var ping$1 = /*#__PURE__*/Object.freeze({
714
718
  __proto__: null,
715
719
  get data () { return data$j; },
716
720
  reset: reset$s,
717
- start: start$M,
718
- stop: stop$J
721
+ start: start$O,
722
+ stop: stop$L
719
723
  });
720
724
 
721
725
  var data$i = null;
722
- function start$L() {
726
+ function start$N() {
723
727
  data$i = {};
724
728
  }
725
- function stop$I() {
729
+ function stop$K() {
726
730
  data$i = {};
727
731
  }
728
732
  function track$7(event, time) {
@@ -754,8 +758,8 @@ var summary = /*#__PURE__*/Object.freeze({
754
758
  compute: compute$e,
755
759
  get data () { return data$i; },
756
760
  reset: reset$r,
757
- start: start$L,
758
- stop: stop$I,
761
+ start: start$N,
762
+ stop: stop$K,
759
763
  track: track$7
760
764
  });
761
765
 
@@ -894,7 +898,7 @@ function read(stream) {
894
898
  }
895
899
 
896
900
  var data$h = null;
897
- function start$K() {
901
+ function start$M() {
898
902
  reset$q();
899
903
  }
900
904
  function set$1(variable, value) {
@@ -956,7 +960,7 @@ function compute$d() {
956
960
  function reset$q() {
957
961
  data$h = {};
958
962
  }
959
- function stop$H() {
963
+ function stop$J() {
960
964
  reset$q();
961
965
  }
962
966
  function redact(input) {
@@ -996,8 +1000,8 @@ var variable = /*#__PURE__*/Object.freeze({
996
1000
  identify: identify,
997
1001
  reset: reset$q,
998
1002
  set: set$1,
999
- start: start$K,
1000
- stop: stop$H
1003
+ start: start$M,
1004
+ stop: stop$J
1001
1005
  });
1002
1006
 
1003
1007
  var data$g = {};
@@ -1006,7 +1010,7 @@ var variables = {};
1006
1010
  var selectors = {};
1007
1011
  var hashes = {};
1008
1012
  var validation = {};
1009
- function start$J() {
1013
+ function start$L() {
1010
1014
  reset$p();
1011
1015
  }
1012
1016
  // Input string is of the following form:
@@ -1122,7 +1126,7 @@ function update$1(key, subkey, value) {
1122
1126
  }
1123
1127
  return;
1124
1128
  }
1125
- function stop$G() {
1129
+ function stop$I() {
1126
1130
  reset$p();
1127
1131
  }
1128
1132
  function parse$1(variable) {
@@ -1195,8 +1199,8 @@ var extract = /*#__PURE__*/Object.freeze({
1195
1199
  data: data$g,
1196
1200
  keys: keys,
1197
1201
  reset: reset$p,
1198
- start: start$J,
1199
- stop: stop$G,
1202
+ start: start$L,
1203
+ stop: stop$I,
1200
1204
  trigger: trigger$2,
1201
1205
  update: update$1
1202
1206
  });
@@ -1224,10 +1228,10 @@ function decodeCookieValue(value) {
1224
1228
 
1225
1229
  var rootDomain = null;
1226
1230
  var COOKIE_SEP = "^" /* Constant.Caret */;
1227
- function start$I() {
1231
+ function start$K() {
1228
1232
  rootDomain = null;
1229
1233
  }
1230
- function stop$F() {
1234
+ function stop$H() {
1231
1235
  rootDomain = null;
1232
1236
  }
1233
1237
  function getCookie(key, limit) {
@@ -1263,7 +1267,7 @@ function getCookie(key, limit) {
1263
1267
  function setCookie(key, value, time) {
1264
1268
  // only write cookies if we are currently in a cookie writing mode (and they are supported)
1265
1269
  // OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
1266
- if ((config$2.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1270
+ if ((config$3.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1267
1271
  // Some browsers automatically url encode cookie values if they are not url encoded.
1268
1272
  // We therefore encode and decode cookie values ourselves.
1269
1273
  var encodedValue = encodeCookieValue(value);
@@ -1309,21 +1313,25 @@ var cookie = /*#__PURE__*/Object.freeze({
1309
1313
  COOKIE_SEP: COOKIE_SEP,
1310
1314
  getCookie: getCookie,
1311
1315
  setCookie: setCookie,
1312
- start: start$I,
1313
- stop: stop$F
1316
+ start: start$K,
1317
+ stop: stop$H
1314
1318
  });
1315
1319
 
1316
1320
  var defaultConfig = {
1317
1321
  excludeClassNames: [],
1322
+ ignoreMutationClassNames: [],
1323
+ discoverTrigger: null,
1318
1324
  };
1319
1325
  var _config = __assign({}, defaultConfig);
1320
- function start$H() {
1321
- var _a, _b;
1326
+ function start$J() {
1327
+ var _a, _b, _c, _d, _e, _f;
1322
1328
  _config = {
1323
1329
  excludeClassNames: ((_b = (_a = window === null || window === void 0 ? void 0 : window.GemXHeatmap) === null || _a === void 0 ? void 0 : _a.excludeClassNames) !== null && _b !== void 0 ? _b : []),
1330
+ ignoreMutationClassNames: ((_d = (_c = window === null || window === void 0 ? void 0 : window.GemXHeatmap) === null || _c === void 0 ? void 0 : _c.ignoreMutationClassNames) !== null && _d !== void 0 ? _d : []),
1331
+ discoverTrigger: ((_f = (_e = window === null || window === void 0 ? void 0 : window.GemXHeatmap) === null || _e === void 0 ? void 0 : _e.discoverTrigger) !== null && _f !== void 0 ? _f : null),
1324
1332
  };
1325
1333
  }
1326
- function stop$E() {
1334
+ function stop$G() {
1327
1335
  _config = __assign({}, defaultConfig);
1328
1336
  }
1329
1337
  function set(config) {
@@ -1337,8 +1345,61 @@ var gemx = /*#__PURE__*/Object.freeze({
1337
1345
  __proto__: null,
1338
1346
  get: get$2,
1339
1347
  set: set,
1340
- start: start$H,
1341
- stop: stop$E
1348
+ start: start$J,
1349
+ stop: stop$G
1350
+ });
1351
+
1352
+ // Deferred upload buffer for GemX mode.
1353
+ // Buffers ALL playback events until discoverTrigger conditions are met.
1354
+ // Scheduling and trigger logic lives in layout/gemx-discover.ts.
1355
+ var buffer = [];
1356
+ var bufferBytes = 0;
1357
+ var active$4 = false;
1358
+ var maxBytes = 0;
1359
+ var onBytesLimit = null;
1360
+ function start$I() {
1361
+ buffer = [];
1362
+ bufferBytes = 0;
1363
+ active$4 = true;
1364
+ }
1365
+ function config$2(bytesLimit, onLimit) {
1366
+ maxBytes = bytesLimit !== null && bytesLimit !== void 0 ? bytesLimit : 0;
1367
+ onBytesLimit = onLimit !== null && onLimit !== void 0 ? onLimit : null;
1368
+ return true;
1369
+ }
1370
+ function stop$F() {
1371
+ buffer = [];
1372
+ bufferBytes = 0;
1373
+ active$4 = false;
1374
+ maxBytes = 0;
1375
+ onBytesLimit = null;
1376
+ }
1377
+ function isActive() { return active$4; }
1378
+ function getBytes() { return bufferBytes; }
1379
+ function hold(tokens, byteLength) {
1380
+ buffer.push(tokens);
1381
+ bufferBytes += byteLength;
1382
+ if (maxBytes > 0 && bufferBytes >= maxBytes && onBytesLimit) {
1383
+ onBytesLimit();
1384
+ }
1385
+ }
1386
+ function drain() {
1387
+ active$4 = false;
1388
+ var pending = buffer;
1389
+ buffer = [];
1390
+ bufferBytes = 0;
1391
+ return pending;
1392
+ }
1393
+
1394
+ var gemxUpload = /*#__PURE__*/Object.freeze({
1395
+ __proto__: null,
1396
+ config: config$2,
1397
+ drain: drain,
1398
+ getBytes: getBytes,
1399
+ hold: hold,
1400
+ isActive: isActive,
1401
+ start: start$I,
1402
+ stop: stop$F
1342
1403
  });
1343
1404
 
1344
1405
  var signalCallback = null;
@@ -1369,34 +1430,36 @@ function signalsEvent(signalsPayload) {
1369
1430
  }
1370
1431
  }
1371
1432
 
1372
- var modules$3 = [gemx, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1373
- function start$G() {
1433
+ var modules$3 = [gemx, gemxUpload, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1434
+ function start$H() {
1374
1435
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
1375
- start$N();
1436
+ start$P();
1376
1437
  modules$3.forEach(function (x) { return measure(x.start)(); });
1377
1438
  }
1378
- function stop$D() {
1439
+ function stop$E() {
1379
1440
  // Stop modules in the reverse order of their initialization
1380
1441
  // The ordering below should respect inter-module dependency.
1381
1442
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
1382
1443
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
1383
1444
  modules$3.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1384
- stop$K();
1445
+ stop$M();
1385
1446
  }
1386
1447
  function compute$b() {
1387
- compute$d();
1388
1448
  compute$g();
1389
- compute$3();
1390
- compute$f();
1391
- compute$e();
1392
1449
  compute$4();
1393
- compute$c();
1394
1450
  compute$2();
1451
+ if (config$3.mode !== "gemx") {
1452
+ compute$d();
1453
+ compute$3();
1454
+ compute$f();
1455
+ compute$e();
1456
+ compute$c();
1457
+ }
1395
1458
  }
1396
1459
 
1397
1460
  var history$5 = [];
1398
1461
  var data$f;
1399
- function start$F() {
1462
+ function start$G() {
1400
1463
  history$5 = [];
1401
1464
  max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
1402
1465
  try {
@@ -1409,7 +1472,7 @@ function start$F() {
1409
1472
  }
1410
1473
  function check$5(id, target, input) {
1411
1474
  // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
1412
- if (config$2.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1475
+ if (config$3.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1413
1476
  data$f = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1414
1477
  // Only encode this event if we haven't already reported this hash
1415
1478
  if (history$5.indexOf(data$f.checksum) < 0) {
@@ -1432,7 +1495,7 @@ var MaskTagsList = ["INPUT", "SELECT", "TEXTAREA"];
1432
1495
  var ExcludeClassNamesList = ["load", "active", "fixed", "visible", "focus", "show", "collaps", "animat"];
1433
1496
 
1434
1497
  var state$a = [];
1435
- function start$E() {
1498
+ function start$F() {
1436
1499
  reset$o();
1437
1500
  }
1438
1501
  function observe$c(root) {
@@ -1442,15 +1505,15 @@ function recompute$8(evt) {
1442
1505
  var element = target(evt);
1443
1506
  if (element) {
1444
1507
  var value = element.value;
1445
- var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$2.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1508
+ var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$3.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1446
1509
  state$a.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1447
- schedule(encode$4.bind(this, 42 /* Event.Change */));
1510
+ schedule$1(encode$4.bind(this, 42 /* Event.Change */));
1448
1511
  }
1449
1512
  }
1450
1513
  function reset$o() {
1451
1514
  state$a = [];
1452
1515
  }
1453
- function stop$C() {
1516
+ function stop$D() {
1454
1517
  reset$o();
1455
1518
  }
1456
1519
 
@@ -1458,9 +1521,9 @@ var change = /*#__PURE__*/Object.freeze({
1458
1521
  __proto__: null,
1459
1522
  observe: observe$c,
1460
1523
  reset: reset$o,
1461
- start: start$E,
1524
+ start: start$F,
1462
1525
  get state () { return state$a; },
1463
- stop: stop$C
1526
+ stop: stop$D
1464
1527
  });
1465
1528
 
1466
1529
  function offset(element) {
@@ -1482,7 +1545,9 @@ function offset(element) {
1482
1545
  var UserInputTags = ["input", "textarea", "radio", "button", "canvas", "select"];
1483
1546
  var VM_PATTERN = /VM\d/;
1484
1547
  var state$9 = [];
1485
- function start$D() {
1548
+ var trustedCallback$1 = null;
1549
+ function onTrustedClick(cb) { trustedCallback$1 = cb; }
1550
+ function start$E() {
1486
1551
  reset$n();
1487
1552
  }
1488
1553
  function observe$b(root) {
@@ -1520,7 +1585,7 @@ function handler$4(event, root, evt) {
1520
1585
  // Check for null values before processing this event
1521
1586
  if (x !== null && y !== null) {
1522
1587
  var textInfo = text(t);
1523
- if (config$2.diagnostics) {
1588
+ if (config$3.diagnostics) {
1524
1589
  var el = t;
1525
1590
  console.log("[clarity:click] text debug", {
1526
1591
  tag: el === null || el === void 0 ? void 0 : el.tagName,
@@ -1557,10 +1622,13 @@ function handler$4(event, root, evt) {
1557
1622
  tag: getElementAttribute(t, "tagName").substring(0, 10 /* Setting.ClickTag */),
1558
1623
  class: getElementAttribute(t, "className").substring(0, 50 /* Setting.ClickClass */),
1559
1624
  id: getElementAttribute(t, "id").substring(0, 25 /* Setting.ClickId */),
1560
- source: config$2.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1625
+ source: config$3.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1561
1626
  }
1562
1627
  });
1563
- schedule(encode$4.bind(this, event));
1628
+ if (evt.isTrusted && trustedCallback$1) {
1629
+ trustedCallback$1();
1630
+ }
1631
+ schedule$1(encode$4.bind(this, event));
1564
1632
  }
1565
1633
  }
1566
1634
  function link(node) {
@@ -1713,21 +1781,22 @@ function source() {
1713
1781
  function reset$n() {
1714
1782
  state$9 = [];
1715
1783
  }
1716
- function stop$B() {
1784
+ function stop$C() {
1717
1785
  reset$n();
1718
1786
  }
1719
1787
 
1720
1788
  var click = /*#__PURE__*/Object.freeze({
1721
1789
  __proto__: null,
1722
1790
  observe: observe$b,
1791
+ onTrustedClick: onTrustedClick,
1723
1792
  reset: reset$n,
1724
- start: start$D,
1793
+ start: start$E,
1725
1794
  get state () { return state$9; },
1726
- stop: stop$B
1795
+ stop: stop$C
1727
1796
  });
1728
1797
 
1729
1798
  var state$8 = [];
1730
- function start$C() {
1799
+ function start$D() {
1731
1800
  reset$m();
1732
1801
  }
1733
1802
  function observe$a(root) {
@@ -1737,12 +1806,12 @@ function observe$a(root) {
1737
1806
  }
1738
1807
  function recompute$7(action, evt) {
1739
1808
  state$8.push({ time: time(evt), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1740
- schedule(encode$4.bind(this, 38 /* Event.Clipboard */));
1809
+ schedule$1(encode$4.bind(this, 38 /* Event.Clipboard */));
1741
1810
  }
1742
1811
  function reset$m() {
1743
1812
  state$8 = [];
1744
1813
  }
1745
- function stop$A() {
1814
+ function stop$B() {
1746
1815
  reset$m();
1747
1816
  }
1748
1817
 
@@ -1750,14 +1819,14 @@ var clipboard = /*#__PURE__*/Object.freeze({
1750
1819
  __proto__: null,
1751
1820
  observe: observe$a,
1752
1821
  reset: reset$m,
1753
- start: start$C,
1822
+ start: start$D,
1754
1823
  get state () { return state$8; },
1755
- stop: stop$A
1824
+ stop: stop$B
1756
1825
  });
1757
1826
 
1758
1827
  var timeout$6 = null;
1759
1828
  var state$7 = [];
1760
- function start$B() {
1829
+ function start$C() {
1761
1830
  reset$l();
1762
1831
  }
1763
1832
  function observe$9(root) {
@@ -1786,12 +1855,12 @@ function recompute$6(evt) {
1786
1855
  }
1787
1856
  }
1788
1857
  function process$7(event) {
1789
- schedule(encode$4.bind(this, event));
1858
+ schedule$1(encode$4.bind(this, event));
1790
1859
  }
1791
1860
  function reset$l() {
1792
1861
  state$7 = [];
1793
1862
  }
1794
- function stop$z() {
1863
+ function stop$A() {
1795
1864
  clearTimeout$1(timeout$6);
1796
1865
  reset$l();
1797
1866
  }
@@ -1800,9 +1869,9 @@ var input = /*#__PURE__*/Object.freeze({
1800
1869
  __proto__: null,
1801
1870
  observe: observe$9,
1802
1871
  reset: reset$l,
1803
- start: start$B,
1872
+ start: start$C,
1804
1873
  get state () { return state$7; },
1805
- stop: stop$z
1874
+ stop: stop$A
1806
1875
  });
1807
1876
 
1808
1877
  var state$6 = [];
@@ -1810,7 +1879,7 @@ var timeout$5 = null;
1810
1879
  var hasPrimaryTouch = false;
1811
1880
  var primaryTouchId = 0;
1812
1881
  var activeTouchPointIds = new Set();
1813
- function start$A() {
1882
+ function start$B() {
1814
1883
  reset$k();
1815
1884
  }
1816
1885
  function observe$8(root) {
@@ -1904,7 +1973,7 @@ function handler$3(current) {
1904
1973
  }
1905
1974
  }
1906
1975
  function process$6(event) {
1907
- schedule(encode$4.bind(this, event));
1976
+ schedule$1(encode$4.bind(this, event));
1908
1977
  }
1909
1978
  function reset$k() {
1910
1979
  state$6 = [];
@@ -1918,7 +1987,7 @@ function similar$1(last, current) {
1918
1987
  var sameId = current.data.id !== undefined ? current.data.id === last.data.id : true;
1919
1988
  return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.PointerInterval */ && sameId;
1920
1989
  }
1921
- function stop$y() {
1990
+ function stop$z() {
1922
1991
  clearTimeout$1(timeout$5);
1923
1992
  // Send out any pending pointer events in the pipeline
1924
1993
  if (state$6.length > 0) {
@@ -1930,9 +1999,9 @@ var pointer = /*#__PURE__*/Object.freeze({
1930
1999
  __proto__: null,
1931
2000
  observe: observe$8,
1932
2001
  reset: reset$k,
1933
- start: start$A,
2002
+ start: start$B,
1934
2003
  get state () { return state$6; },
1935
- stop: stop$y
2004
+ stop: stop$z
1936
2005
  });
1937
2006
 
1938
2007
  /**
@@ -1987,7 +2056,7 @@ var data$e;
1987
2056
  var timeout$4 = null;
1988
2057
  var initialStateLogged = false;
1989
2058
  var throttledRecompute$1 = throttle(recompute$5, 500 /* Setting.LookAhead */);
1990
- function start$z() {
2059
+ function start$A() {
1991
2060
  initialStateLogged = false;
1992
2061
  bind(window, "resize", throttledRecompute$1);
1993
2062
  recompute$5();
@@ -2010,14 +2079,14 @@ function recompute$5() {
2010
2079
  }
2011
2080
  }
2012
2081
  function process$5(event) {
2013
- schedule(encode$4.bind(this, event));
2082
+ schedule$1(encode$4.bind(this, event));
2014
2083
  }
2015
2084
  function reset$j() {
2016
2085
  data$e = null;
2017
2086
  clearTimeout$1(timeout$4);
2018
2087
  throttledRecompute$1.cleanup();
2019
2088
  }
2020
- function stop$x() {
2089
+ function stop$y() {
2021
2090
  reset$j();
2022
2091
  }
2023
2092
 
@@ -2025,15 +2094,17 @@ var resize = /*#__PURE__*/Object.freeze({
2025
2094
  __proto__: null,
2026
2095
  get data () { return data$e; },
2027
2096
  reset: reset$j,
2028
- start: start$z,
2029
- stop: stop$x
2097
+ start: start$A,
2098
+ stop: stop$y
2030
2099
  });
2031
2100
 
2032
2101
  var state$5 = [];
2102
+ var trustedCallback = null;
2103
+ function onTrustedScroll(cb) { trustedCallback = cb; }
2033
2104
  var initialTop = null;
2034
2105
  var initialBottom = null;
2035
2106
  var timeout$3 = null;
2036
- function start$y() {
2107
+ function start$z() {
2037
2108
  state$5 = [];
2038
2109
  recompute$4();
2039
2110
  }
@@ -2072,6 +2143,9 @@ function recompute$4(event) {
2072
2143
  var top = getPositionNode(xPosition, startYPosition);
2073
2144
  var bottom = getPositionNode(xPosition, endYPosition);
2074
2145
  var trust = event && event.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
2146
+ if (event && event.isTrusted && trustedCallback) {
2147
+ trustedCallback();
2148
+ }
2075
2149
  var current = { time: time(event), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y, top: top, bottom: bottom, trust: trust } };
2076
2150
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
2077
2151
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
@@ -2112,7 +2186,7 @@ function reset$i() {
2112
2186
  initialBottom = null;
2113
2187
  }
2114
2188
  function process$4(event) {
2115
- schedule(encode$4.bind(this, event));
2189
+ schedule$1(encode$4.bind(this, event));
2116
2190
  }
2117
2191
  function similar(last, current) {
2118
2192
  var dx = last.data.x - current.data.x;
@@ -2130,7 +2204,7 @@ function compute$a() {
2130
2204
  log(32 /* Dimension.InitialScrollBottom */, (_b = bottom === null || bottom === void 0 ? void 0 : bottom.hash) === null || _b === void 0 ? void 0 : _b.join("." /* Constant.Dot */));
2131
2205
  }
2132
2206
  }
2133
- function stop$w() {
2207
+ function stop$x() {
2134
2208
  clearTimeout$1(timeout$3);
2135
2209
  throttledRecompute.cleanup();
2136
2210
  state$5 = [];
@@ -2142,16 +2216,17 @@ var scroll = /*#__PURE__*/Object.freeze({
2142
2216
  __proto__: null,
2143
2217
  compute: compute$a,
2144
2218
  observe: observe$7,
2219
+ onTrustedScroll: onTrustedScroll,
2145
2220
  reset: reset$i,
2146
- start: start$y,
2221
+ start: start$z,
2147
2222
  get state () { return state$5; },
2148
- stop: stop$w
2223
+ stop: stop$x
2149
2224
  });
2150
2225
 
2151
2226
  var data$d = null;
2152
2227
  var previous = null;
2153
2228
  var timeout$2 = null;
2154
- function start$x() {
2229
+ function start$y() {
2155
2230
  reset$h();
2156
2231
  }
2157
2232
  function observe$6(root) {
@@ -2189,13 +2264,13 @@ function recompute$3(root) {
2189
2264
  timeout$2 = setTimeout$1(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
2190
2265
  }
2191
2266
  function process$3(event) {
2192
- schedule(encode$4.bind(this, event));
2267
+ schedule$1(encode$4.bind(this, event));
2193
2268
  }
2194
2269
  function reset$h() {
2195
2270
  previous = null;
2196
2271
  data$d = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
2197
2272
  }
2198
- function stop$v() {
2273
+ function stop$w() {
2199
2274
  reset$h();
2200
2275
  clearTimeout$1(timeout$2);
2201
2276
  }
@@ -2205,12 +2280,12 @@ var selection = /*#__PURE__*/Object.freeze({
2205
2280
  get data () { return data$d; },
2206
2281
  observe: observe$6,
2207
2282
  reset: reset$h,
2208
- start: start$x,
2209
- stop: stop$v
2283
+ start: start$y,
2284
+ stop: stop$w
2210
2285
  });
2211
2286
 
2212
2287
  var state$4 = [];
2213
- function start$w() {
2288
+ function start$x() {
2214
2289
  reset$g();
2215
2290
  }
2216
2291
  function observe$5(root) {
@@ -2218,12 +2293,12 @@ function observe$5(root) {
2218
2293
  }
2219
2294
  function recompute$2(evt) {
2220
2295
  state$4.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
2221
- schedule(encode$4.bind(this, 39 /* Event.Submit */));
2296
+ schedule$1(encode$4.bind(this, 39 /* Event.Submit */));
2222
2297
  }
2223
2298
  function reset$g() {
2224
2299
  state$4 = [];
2225
2300
  }
2226
- function stop$u() {
2301
+ function stop$v() {
2227
2302
  reset$g();
2228
2303
  }
2229
2304
 
@@ -2231,18 +2306,18 @@ var submit = /*#__PURE__*/Object.freeze({
2231
2306
  __proto__: null,
2232
2307
  observe: observe$5,
2233
2308
  reset: reset$g,
2234
- start: start$w,
2309
+ start: start$x,
2235
2310
  get state () { return state$4; },
2236
- stop: stop$u
2311
+ stop: stop$v
2237
2312
  });
2238
2313
 
2239
2314
  var data$c;
2240
- function start$v() {
2315
+ function start$w() {
2241
2316
  bind(window, "pagehide", recompute$1);
2242
2317
  bind(window, "beforeunload", beforeUnload);
2243
2318
  }
2244
2319
  function beforeUnload() {
2245
- flush();
2320
+ flush$1();
2246
2321
  }
2247
2322
  function recompute$1(evt) {
2248
2323
  data$c = { name: evt.type, persisted: evt.persisted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */ };
@@ -2252,7 +2327,7 @@ function recompute$1(evt) {
2252
2327
  function reset$f() {
2253
2328
  data$c = null;
2254
2329
  }
2255
- function stop$t() {
2330
+ function stop$u() {
2256
2331
  reset$f();
2257
2332
  }
2258
2333
 
@@ -2260,12 +2335,12 @@ var unload = /*#__PURE__*/Object.freeze({
2260
2335
  __proto__: null,
2261
2336
  get data () { return data$c; },
2262
2337
  reset: reset$f,
2263
- start: start$v,
2264
- stop: stop$t
2338
+ start: start$w,
2339
+ stop: stop$u
2265
2340
  });
2266
2341
 
2267
2342
  var data$b;
2268
- function start$u() {
2343
+ function start$v() {
2269
2344
  bind(document, "visibilitychange", recompute);
2270
2345
  recompute();
2271
2346
  }
@@ -2280,7 +2355,7 @@ function recompute(evt) {
2280
2355
  function reset$e() {
2281
2356
  data$b = null;
2282
2357
  }
2283
- function stop$s() {
2358
+ function stop$t() {
2284
2359
  reset$e();
2285
2360
  }
2286
2361
 
@@ -2288,16 +2363,16 @@ var visibility = /*#__PURE__*/Object.freeze({
2288
2363
  __proto__: null,
2289
2364
  get data () { return data$b; },
2290
2365
  reset: reset$e,
2291
- start: start$u,
2292
- stop: stop$s
2366
+ start: start$v,
2367
+ stop: stop$t
2293
2368
  });
2294
2369
 
2295
2370
  var data$a;
2296
- function start$t() {
2371
+ function start$u() {
2297
2372
  bind(window, "focus", function () { return compute$9(1 /* BooleanFlag.True */); });
2298
2373
  bind(window, "blur", function () { return compute$9(0 /* BooleanFlag.False */); });
2299
2374
  }
2300
- function stop$r() {
2375
+ function stop$s() {
2301
2376
  reset$d();
2302
2377
  }
2303
2378
  function reset$d() {
@@ -2312,12 +2387,12 @@ var focus = /*#__PURE__*/Object.freeze({
2312
2387
  __proto__: null,
2313
2388
  get data () { return data$a; },
2314
2389
  reset: reset$d,
2315
- start: start$t,
2316
- stop: stop$r
2390
+ start: start$u,
2391
+ stop: stop$s
2317
2392
  });
2318
2393
 
2319
2394
  var bound = false;
2320
- function start$s() {
2395
+ function start$t() {
2321
2396
  // Only bind once - this listener must persist even when Clarity stops
2322
2397
  // to detect when the page is restored from bfcache
2323
2398
  if (!bound) {
@@ -2338,15 +2413,15 @@ function handler$2(evt) {
2338
2413
  log$1(11 /* Code.BFCache */, 0 /* Severity.Info */);
2339
2414
  }
2340
2415
  }
2341
- function stop$q() {
2416
+ function stop$r() {
2342
2417
  // Intentionally don't remove the listener or reset 'bound' flag
2343
2418
  // We need the listener to persist to detect bfcache restoration
2344
2419
  }
2345
2420
 
2346
2421
  var pageshow = /*#__PURE__*/Object.freeze({
2347
2422
  __proto__: null,
2348
- start: start$s,
2349
- stop: stop$q
2423
+ start: start$t,
2424
+ stop: stop$r
2350
2425
  });
2351
2426
 
2352
2427
  var GEMX$1 = [
@@ -2377,17 +2452,15 @@ var ALL$1 = [
2377
2452
  var GEMX_OBSERVE = { allRoots: [scroll], documentOnly: [click] };
2378
2453
  var ALL_OBSERVE = { allRoots: [scroll], documentOnly: [click, clipboard, pointer, input, selection, change, submit] };
2379
2454
  var modules$2 = ALL$1;
2380
- var observeModules = ALL_OBSERVE;
2381
- function start$r() {
2382
- var mode = config$2.mode;
2383
- modules$2 = mode === "gemx" ? GEMX$1 : ALL$1;
2384
- observeModules = mode === "gemx" ? GEMX_OBSERVE : ALL_OBSERVE;
2455
+ function start$s() {
2456
+ modules$2 = config$3.mode === "gemx" ? GEMX$1 : ALL$1;
2385
2457
  modules$2.forEach(function (m) { return m.start(); });
2386
2458
  }
2387
- function stop$p() {
2459
+ function stop$q() {
2388
2460
  modules$2.forEach(function (m) { return m.stop(); });
2389
2461
  }
2390
2462
  function observe$4(root) {
2463
+ var observeModules = config$3.mode === "gemx" ? GEMX_OBSERVE : ALL_OBSERVE;
2391
2464
  observeModules.allRoots.forEach(function (m) { return m.observe(root); });
2392
2465
  if (root.nodeType === Node.DOCUMENT_NODE) {
2393
2466
  observeModules.documentOnly.forEach(function (m) { return m.observe(root); });
@@ -2397,8 +2470,8 @@ function observe$4(root) {
2397
2470
  var interaction = /*#__PURE__*/Object.freeze({
2398
2471
  __proto__: null,
2399
2472
  observe: observe$4,
2400
- start: start$r,
2401
- stop: stop$p
2473
+ start: start$s,
2474
+ stop: stop$q
2402
2475
  });
2403
2476
 
2404
2477
  // Following code takes an array of tokens and transforms it to optimize for repeating tokens and make it efficient to send over the wire
@@ -2452,7 +2525,7 @@ var styleTimeMap = {};
2452
2525
  var documentNodes = [];
2453
2526
  var createdSheetIds = [];
2454
2527
  function proxyStyleRules$1(win) {
2455
- if ((config$2.lean && config$2.lite) || win === null || win === undefined) {
2528
+ if ((config$3.lean && config$3.lite) || win === null || win === undefined) {
2456
2529
  return;
2457
2530
  }
2458
2531
  win.clarityOverrides = win.clarityOverrides || {};
@@ -2487,11 +2560,11 @@ function proxyStyleRules$1(win) {
2487
2560
  }
2488
2561
  }
2489
2562
  }
2490
- function start$q() {
2563
+ function start$r() {
2491
2564
  proxyStyleRules$1(window);
2492
2565
  }
2493
2566
  function checkDocumentStyles(documentNode, timestamp) {
2494
- if (config$2.lean && config$2.lite) {
2567
+ if (config$3.lean && config$3.lite) {
2495
2568
  return;
2496
2569
  }
2497
2570
  if (documentNodes.indexOf(documentNode) === -1) {
@@ -2543,7 +2616,7 @@ function reset$c() {
2543
2616
  sheetAdoptionState = [];
2544
2617
  sheetUpdateState = [];
2545
2618
  }
2546
- function stop$o() {
2619
+ function stop$p() {
2547
2620
  styleSheetMap = {};
2548
2621
  styleTimeMap = {};
2549
2622
  documentNodes = [];
@@ -2591,7 +2664,7 @@ var animationFinish = null;
2591
2664
  var animationId = 'clarityAnimationId';
2592
2665
  var operationCount = 'clarityOperationCount';
2593
2666
  var maxOperations = 20;
2594
- function start$p() {
2667
+ function start$q() {
2595
2668
  if (window["Animation"] &&
2596
2669
  window["Animation"].prototype &&
2597
2670
  window["KeyframeEffect"] &&
@@ -2646,7 +2719,7 @@ function track$6(time, id, operation, keyFrames, timing, targetId, timeline) {
2646
2719
  });
2647
2720
  encode$5(44 /* Event.Animation */);
2648
2721
  }
2649
- function stop$n() {
2722
+ function stop$o() {
2650
2723
  reset$b();
2651
2724
  }
2652
2725
  function overrideAnimationHelper(functionToOverride, name) {
@@ -2703,7 +2776,7 @@ function register$1(tag) {
2703
2776
  if (!definedElements.has(tag)) {
2704
2777
  definedElements.add(tag);
2705
2778
  elements.push(tag);
2706
- schedule(encode$5.bind(this, 51 /* Event.CustomElement */));
2779
+ schedule$1(encode$5.bind(this, 51 /* Event.CustomElement */));
2707
2780
  }
2708
2781
  }
2709
2782
  function check$4(tag) {
@@ -2712,7 +2785,7 @@ function check$4(tag) {
2712
2785
  register$1(tag);
2713
2786
  }
2714
2787
  }
2715
- function start$o() {
2788
+ function start$p() {
2716
2789
  var _a;
2717
2790
  // Wrap in try-catch to handle Safari iOS where window properties or customElements.define may be readonly
2718
2791
  try {
@@ -2734,7 +2807,7 @@ function start$o() {
2734
2807
  function reset$a() {
2735
2808
  elements.length = 0;
2736
2809
  }
2737
- function stop$m() {
2810
+ function stop$n() {
2738
2811
  reset$a();
2739
2812
  definedElements.clear();
2740
2813
  }
@@ -2884,7 +2957,7 @@ function encode$5 (type, timer, ts) {
2884
2957
  if (type === 6 /* Event.Mutation */) {
2885
2958
  activity(eventTime);
2886
2959
  }
2887
- queue(tokenize(tokens), !config$2.lean);
2960
+ queue(tokenize(tokens), !config$3.lean);
2888
2961
  _o.label = 11;
2889
2962
  case 11: return [3 /*break*/, 13];
2890
2963
  case 12:
@@ -2926,7 +2999,7 @@ var data$9;
2926
2999
  function reset$9() {
2927
3000
  data$9 = null;
2928
3001
  }
2929
- function start$n() {
3002
+ function start$o() {
2930
3003
  reset$9();
2931
3004
  compute$7();
2932
3005
  }
@@ -2953,7 +3026,7 @@ function compute$7() {
2953
3026
  encode$5(8 /* Event.Document */);
2954
3027
  }
2955
3028
  }
2956
- function stop$l() {
3029
+ function stop$m() {
2957
3030
  reset$9();
2958
3031
  }
2959
3032
 
@@ -3005,7 +3078,7 @@ var history$4 = {};
3005
3078
  var observedNodes = new WeakMap();
3006
3079
  // We ignore mutations if these attributes are updated
3007
3080
  var IGNORED_ATTRIBUTES = ["data-google-query-id", "data-load-complete", "data-google-container-id"];
3008
- function start$m() {
3081
+ function start$n() {
3009
3082
  observers = new Set();
3010
3083
  queue$2 = [];
3011
3084
  timeout$1 = null;
@@ -3043,7 +3116,7 @@ function monitor(frame) {
3043
3116
  bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
3044
3117
  }
3045
3118
  }
3046
- function stop$k() {
3119
+ function stop$l() {
3047
3120
  for (var _i = 0, _a = Array.from(observers); _i < _a.length; _i++) {
3048
3121
  var observer = _a[_i];
3049
3122
  if (observer) {
@@ -3075,14 +3148,14 @@ function handle$1(m) {
3075
3148
  var now = time();
3076
3149
  track$7(6 /* Event.Mutation */, now);
3077
3150
  mutations.push({ time: now, mutations: m });
3078
- schedule(process$2, 1 /* Priority.High */).then(function () {
3151
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
3079
3152
  setTimeout$1(compute$7);
3080
3153
  measure(compute$6)();
3081
3154
  });
3082
3155
  }
3083
3156
  function processMutation(timer, mutation, instance, timestamp) {
3084
3157
  return __awaiter(this, void 0, void 0, function () {
3085
- var state$1, target, type;
3158
+ var state$1, target, ignoredClasses, el_1, type;
3086
3159
  return __generator(this, function (_a) {
3087
3160
  switch (_a.label) {
3088
3161
  case 0:
@@ -3097,7 +3170,14 @@ function processMutation(timer, mutation, instance, timestamp) {
3097
3170
  return [2 /*return*/];
3098
3171
  }
3099
3172
  target = mutation.target;
3100
- type = config$2.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
3173
+ ignoredClasses = get$2().ignoreMutationClassNames;
3174
+ if (ignoredClasses.length > 0 && target instanceof Element) {
3175
+ el_1 = target;
3176
+ if (ignoredClasses.some(function (cls) { return el_1.classList.contains(cls); })) {
3177
+ return [2 /*return*/];
3178
+ }
3179
+ }
3180
+ type = config$3.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
3101
3181
  if (type && target && target.ownerDocument) {
3102
3182
  parse(target.ownerDocument);
3103
3183
  }
@@ -3130,7 +3210,7 @@ function process$2() {
3130
3210
  switch (_d.label) {
3131
3211
  case 0:
3132
3212
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
3133
- start$e(timer);
3213
+ start$f(timer);
3134
3214
  _d.label = 1;
3135
3215
  case 1:
3136
3216
  if (!(mutations.length > 0)) return [3 /*break*/, 7];
@@ -3180,7 +3260,7 @@ function process$2() {
3180
3260
  _d.label = 13;
3181
3261
  case 13:
3182
3262
  cleanHistory();
3183
- stop$d(timer);
3263
+ stop$e(timer);
3184
3264
  return [2 /*return*/];
3185
3265
  }
3186
3266
  });
@@ -3289,10 +3369,10 @@ function processThrottledMutations() {
3289
3369
  clearTimeout$1(throttleDelay);
3290
3370
  }
3291
3371
  throttleDelay = setTimeout$1(function () {
3292
- schedule(process$2, 1 /* Priority.High */);
3372
+ schedule$1(process$2, 1 /* Priority.High */);
3293
3373
  }, 33 /* Setting.LookAhead */);
3294
3374
  }
3295
- function schedule$1(node) {
3375
+ function schedule$2(node) {
3296
3376
  // Only schedule manual trigger for this node if it's not already in the queue
3297
3377
  if (queue$2.indexOf(node) < 0) {
3298
3378
  queue$2.push(node);
@@ -3351,7 +3431,7 @@ function proxyStyleRules(win) {
3351
3431
  win.clarityOverrides.InsertRule = win.CSSStyleSheet.prototype.insertRule;
3352
3432
  win.CSSStyleSheet.prototype.insertRule = function () {
3353
3433
  if (active()) {
3354
- schedule$1(this.ownerNode);
3434
+ schedule$2(this.ownerNode);
3355
3435
  }
3356
3436
  return win.clarityOverrides.InsertRule.apply(this, arguments);
3357
3437
  };
@@ -3360,7 +3440,7 @@ function proxyStyleRules(win) {
3360
3440
  win.clarityOverrides.MediaInsertRule = win.CSSMediaRule.prototype.insertRule;
3361
3441
  win.CSSMediaRule.prototype.insertRule = function () {
3362
3442
  if (active()) {
3363
- schedule$1(this.parentStyleSheet.ownerNode);
3443
+ schedule$2(this.parentStyleSheet.ownerNode);
3364
3444
  }
3365
3445
  return win.clarityOverrides.MediaInsertRule.apply(this, arguments);
3366
3446
  };
@@ -3369,7 +3449,7 @@ function proxyStyleRules(win) {
3369
3449
  win.clarityOverrides.DeleteRule = win.CSSStyleSheet.prototype.deleteRule;
3370
3450
  win.CSSStyleSheet.prototype.deleteRule = function () {
3371
3451
  if (active()) {
3372
- schedule$1(this.ownerNode);
3452
+ schedule$2(this.ownerNode);
3373
3453
  }
3374
3454
  return win.clarityOverrides.DeleteRule.apply(this, arguments);
3375
3455
  };
@@ -3378,7 +3458,7 @@ function proxyStyleRules(win) {
3378
3458
  win.clarityOverrides.MediaDeleteRule = win.CSSMediaRule.prototype.deleteRule;
3379
3459
  win.CSSMediaRule.prototype.deleteRule = function () {
3380
3460
  if (active()) {
3381
- schedule$1(this.parentStyleSheet.ownerNode);
3461
+ schedule$2(this.parentStyleSheet.ownerNode);
3382
3462
  }
3383
3463
  return win.clarityOverrides.MediaDeleteRule.apply(this, arguments);
3384
3464
  };
@@ -3391,7 +3471,7 @@ function proxyStyleRules(win) {
3391
3471
  try {
3392
3472
  win.Element.prototype.attachShadow = function () {
3393
3473
  if (active()) {
3394
- return schedule$1(win.clarityOverrides.AttachShadow.apply(this, arguments));
3474
+ return schedule$2(win.clarityOverrides.AttachShadow.apply(this, arguments));
3395
3475
  }
3396
3476
  else {
3397
3477
  return win.clarityOverrides.AttachShadow.apply(this, arguments);
@@ -3923,11 +4003,11 @@ var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
3923
4003
  var iframeContentMap = null; // Maps parent iframe element => iframe's contentDocument & contentWindow
3924
4004
  var privacyMap = null; // Maps node => Privacy (enum)
3925
4005
  var fraudMap = null; // Maps node => FraudId (number)
3926
- function start$l() {
4006
+ function start$m() {
3927
4007
  reset$7();
3928
4008
  parse(document, true);
3929
4009
  }
3930
- function stop$j() {
4010
+ function stop$k() {
3931
4011
  reset$7();
3932
4012
  }
3933
4013
  function reset$7() {
@@ -3958,14 +4038,14 @@ function parse(root, init) {
3958
4038
  try {
3959
4039
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
3960
4040
  if (init) {
3961
- config$2.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
4041
+ config$3.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
3962
4042
  }
3963
4043
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
3964
4044
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
3965
4045
  if ("querySelectorAll" in root) {
3966
- config$2.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3967
- config$2.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3968
- config$2.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
4046
+ config$3.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
4047
+ config$3.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
4048
+ config$3.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
3969
4049
  unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
3970
4050
  }
3971
4051
  }
@@ -3996,7 +4076,7 @@ function add$1(node, parent, data, source) {
3996
4076
  var parentValue = null;
3997
4077
  var regionId = exists(node) ? id : null;
3998
4078
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
3999
- var privacyId = config$2.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
4079
+ var privacyId = config$3.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
4000
4080
  if (parentId >= 0 && values$1[parentId]) {
4001
4081
  parentValue = values$1[parentId];
4002
4082
  parentValue.children.push(id);
@@ -4229,6 +4309,9 @@ function get(node) {
4229
4309
  function lookup(hash) {
4230
4310
  return hash in hashMap ? hashMap[hash] : null;
4231
4311
  }
4312
+ function getHashes() {
4313
+ return Object.keys(hashMap);
4314
+ }
4232
4315
  function has$1(node) {
4233
4316
  return nodesMap.has(getId$1(node));
4234
4317
  }
@@ -4300,7 +4383,7 @@ function getPreviousId(node) {
4300
4383
  function track$4(id, source, changed, parentChanged) {
4301
4384
  if (changed === void 0) { changed = true; }
4302
4385
  if (parentChanged === void 0) { parentChanged = false; }
4303
- if (config$2.lean && config$2.lite) {
4386
+ if (config$3.lean && config$3.lite) {
4304
4387
  return;
4305
4388
  }
4306
4389
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -4322,7 +4405,7 @@ var regions = {};
4322
4405
  var queue$1 = [];
4323
4406
  var watch = false;
4324
4407
  var observer$1 = null;
4325
- function start$k() {
4408
+ function start$l() {
4326
4409
  reset$6();
4327
4410
  observer$1 = null;
4328
4411
  regionMap = new WeakMap();
@@ -4450,7 +4533,7 @@ function clone(r) {
4450
4533
  function reset$6() {
4451
4534
  state$2 = [];
4452
4535
  }
4453
- function stop$i() {
4536
+ function stop$j() {
4454
4537
  reset$6();
4455
4538
  regionMap = null;
4456
4539
  regions = {};
@@ -4474,10 +4557,10 @@ function metadata$2(node, event, text) {
4474
4557
  var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */ };
4475
4558
  if (node) {
4476
4559
  var value = get(node);
4477
- console.log("[GemX - Target - Metadata]", {
4478
- selector: value.selector,
4479
- hash: value.hash,
4480
- });
4560
+ if (!window.GemXHeatmap.__debug) {
4561
+ window.GemXHeatmap.__debug = [];
4562
+ }
4563
+ window.GemXHeatmap.__debug.push({ event: event, selector: value.selector, hash: value.hash });
4481
4564
  if (value !== null) {
4482
4565
  var metadata_1 = value.metadata;
4483
4566
  output.id = value.id;
@@ -4707,7 +4790,7 @@ function encode$4 (type, ts) {
4707
4790
 
4708
4791
  var state$1 = [];
4709
4792
  var updates$1 = [];
4710
- function start$j() {
4793
+ function start$k() {
4711
4794
  state$1 = [];
4712
4795
  reset$5();
4713
4796
  }
@@ -4754,7 +4837,7 @@ function compute$5() {
4754
4837
  state$1 = temp; // Drop events less than the min time
4755
4838
  encode$4(22 /* Event.Timeline */);
4756
4839
  }
4757
- function stop$h() {
4840
+ function stop$i() {
4758
4841
  state$1 = [];
4759
4842
  reset$5();
4760
4843
  }
@@ -4898,14 +4981,14 @@ function add(node, parent, data) {
4898
4981
  var stopCallbacks = [];
4899
4982
  var active$2 = false;
4900
4983
  var modules$1 = null;
4901
- function start$i() {
4984
+ function start$j() {
4902
4985
  active$2 = true;
4903
4986
  modules$1 = new Set();
4904
- if (config$2.modules && config$2.modules.length > 0) {
4905
- config$2.modules.forEach(function (m) { event(m); });
4987
+ if (config$3.modules && config$3.modules.length > 0) {
4988
+ config$3.modules.forEach(function (m) { event(m); });
4906
4989
  }
4907
4990
  }
4908
- function stop$g() {
4991
+ function stop$h() {
4909
4992
  stopCallbacks.reverse().forEach(function (callback) {
4910
4993
  try {
4911
4994
  callback();
@@ -4957,8 +5040,8 @@ var dynamic = /*#__PURE__*/Object.freeze({
4957
5040
  __proto__: null,
4958
5041
  event: event,
4959
5042
  register: register,
4960
- start: start$i,
4961
- stop: stop$g
5043
+ start: start$j,
5044
+ stop: stop$h
4962
5045
  });
4963
5046
 
4964
5047
  var discoverBytes = 0;
@@ -4970,12 +5053,14 @@ var transit;
4970
5053
  var active$1;
4971
5054
  var queuedTime = 0;
4972
5055
  var leanLimit = false;
5056
+ var hasGemxPayload = false;
4973
5057
  var track$1;
4974
- function start$h() {
5058
+ function start$i() {
4975
5059
  active$1 = true;
4976
5060
  discoverBytes = 0;
4977
5061
  playbackBytes = 0;
4978
5062
  leanLimit = false;
5063
+ hasGemxPayload = false;
4979
5064
  queuedTime = 0;
4980
5065
  playback = [];
4981
5066
  analysis = [];
@@ -4990,7 +5075,7 @@ function queue(tokens, transmit) {
4990
5075
  var now = time();
4991
5076
  var type = tokens.length > 1 ? tokens[1] : null;
4992
5077
  var event = JSON.stringify(tokens);
4993
- if (!config$2.lean) {
5078
+ if (!config$3.lean) {
4994
5079
  leanLimit = false;
4995
5080
  }
4996
5081
  else if (!leanLimit && playbackBytes + event.length > 10485760 /* Setting.PlaybackBytesLimit */) {
@@ -5002,6 +5087,10 @@ function queue(tokens, transmit) {
5002
5087
  if (leanLimit) {
5003
5088
  break;
5004
5089
  }
5090
+ if (isActive()) {
5091
+ hold(tokens, event.length);
5092
+ break; // only gemxPlayback, not playback
5093
+ }
5005
5094
  discoverBytes += event.length;
5006
5095
  case 37 /* Event.Box */:
5007
5096
  case 6 /* Event.Mutation */:
@@ -5013,6 +5102,9 @@ function queue(tokens, transmit) {
5013
5102
  if (leanLimit) {
5014
5103
  break;
5015
5104
  }
5105
+ if (isActive()) {
5106
+ hold(tokens, event.length); // also gemxPlayback, no break
5107
+ }
5016
5108
  playbackBytes += event.length;
5017
5109
  playback.push(event);
5018
5110
  break;
@@ -5042,7 +5134,7 @@ function queue(tokens, transmit) {
5042
5134
  check$2(playbackBytes);
5043
5135
  }
5044
5136
  }
5045
- function flush() {
5137
+ function flush$1() {
5046
5138
  if (!active$1) {
5047
5139
  return;
5048
5140
  }
@@ -5050,7 +5142,30 @@ function flush() {
5050
5142
  timeout = null;
5051
5143
  upload(true);
5052
5144
  }
5053
- function stop$f() {
5145
+ // Trigger an immediate non-beacon upload (used by gemx-discover after inject).
5146
+ // Unlike flush(), this does NOT set final=true, so playback data is never stripped.
5147
+ function uploadNow() {
5148
+ if (!active$1) {
5149
+ return;
5150
+ }
5151
+ clearTimeout$1(timeout);
5152
+ timeout = null;
5153
+ upload(false);
5154
+ }
5155
+ // Inject pre-buffered tokens directly into playback as discover events.
5156
+ // Used by gemx-discover when trigger fires: all buffered Discover tokens are
5157
+ // counted towards discoverBytes so upload uses MinUploadDelay (fast path).
5158
+ function inject(buffered) {
5159
+ hasGemxPayload = true;
5160
+ for (var _i = 0, buffered_1 = buffered; _i < buffered_1.length; _i++) {
5161
+ var tokens = buffered_1[_i];
5162
+ var e = JSON.stringify(tokens);
5163
+ discoverBytes += e.length;
5164
+ playbackBytes += e.length;
5165
+ playback.push(e);
5166
+ }
5167
+ }
5168
+ function stop$g() {
5054
5169
  clearTimeout$1(timeout);
5055
5170
  upload(true);
5056
5171
  discoverBytes = 0;
@@ -5074,7 +5189,7 @@ function upload(final) {
5074
5189
  return [2 /*return*/];
5075
5190
  }
5076
5191
  timeout = null;
5077
- sendPlaybackBytes = config$2.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
5192
+ sendPlaybackBytes = (hasGemxPayload || config$3.lean === false) && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
5078
5193
  if (sendPlaybackBytes) {
5079
5194
  max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
5080
5195
  }
@@ -5115,6 +5230,7 @@ function upload(final) {
5115
5230
  playbackBytes = 0;
5116
5231
  discoverBytes = 0;
5117
5232
  leanLimit = false;
5233
+ hasGemxPayload = false;
5118
5234
  }
5119
5235
  return [2 /*return*/];
5120
5236
  }
@@ -5127,8 +5243,8 @@ function stringify(encoded) {
5127
5243
  function send(payload, zipped, sequence, beacon) {
5128
5244
  if (beacon === void 0) { beacon = false; }
5129
5245
  // Upload data if a valid URL is defined in the config
5130
- if (typeof config$2.upload === "string" /* Constant.String */) {
5131
- var url_1 = config$2.upload;
5246
+ if (typeof config$3.upload === "string" /* Constant.String */) {
5247
+ var url_1 = config$3.upload;
5132
5248
  var dispatched = false;
5133
5249
  // If it's the last payload, attempt to upload using sendBeacon first.
5134
5250
  // The advantage to using sendBeacon is that browser can decide to upload asynchronously, improving chances of success
@@ -5179,9 +5295,10 @@ function send(payload, zipped, sequence, beacon) {
5179
5295
  }
5180
5296
  }
5181
5297
  }
5182
- else if (config$2.upload) {
5183
- var callback = config$2.upload;
5184
- callback(payload);
5298
+ else if (config$3.upload) {
5299
+ var callback = config$3.upload;
5300
+ var uploadType = hasGemxPayload ? "gemx-discover" : undefined;
5301
+ callback(payload, uploadType);
5185
5302
  done(sequence);
5186
5303
  }
5187
5304
  }
@@ -5202,7 +5319,7 @@ function check$3(xhr, sequence) {
5202
5319
  // 2: Safari will terminate pending XHR requests with status code 0 if the user navigates away from the page
5203
5320
  // In any case, we switch the upload URL to fallback configuration (if available) before re-trying one more time
5204
5321
  if (xhr.status === 0) {
5205
- config$2.upload = config$2.fallback ? config$2.fallback : config$2.upload;
5322
+ config$3.upload = config$3.fallback ? config$3.fallback : config$3.upload;
5206
5323
  }
5207
5324
  // Capture the status code and number of attempts so we can report it back to the server
5208
5325
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
@@ -5249,8 +5366,8 @@ function done(sequence) {
5249
5366
  function delay() {
5250
5367
  // Progressively increase delay as we continue to send more payloads from the client to the server
5251
5368
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
5252
- var gap = config$2.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$2.delay;
5253
- return typeof config$2.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$2.delay;
5369
+ var gap = config$3.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$3.delay;
5370
+ return typeof config$3.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$3.delay;
5254
5371
  }
5255
5372
  function response(payload) {
5256
5373
  var lines = payload && payload.length > 0 ? payload.split("\n") : [];
@@ -5268,8 +5385,8 @@ function response(payload) {
5268
5385
  break;
5269
5386
  case "ACTION" /* Constant.Action */:
5270
5387
  // Invoke action callback, if configured and has a valid value
5271
- if (config$2.action && parts.length > 1) {
5272
- config$2.action(parts[1]);
5388
+ if (config$3.action && parts.length > 1) {
5389
+ config$3.action(parts[1]);
5273
5390
  }
5274
5391
  break;
5275
5392
  case "EXTRACT" /* Constant.Extract */:
@@ -5288,7 +5405,7 @@ function response(payload) {
5288
5405
  }
5289
5406
  break;
5290
5407
  case "SNAPSHOT" /* Constant.Snapshot */:
5291
- config$2.lean = false; // Disable lean mode to ensure we can send playback information to server.
5408
+ config$3.lean = false; // Disable lean mode to ensure we can send playback information to server.
5292
5409
  snapshot();
5293
5410
  break;
5294
5411
  }
@@ -5297,7 +5414,7 @@ function response(payload) {
5297
5414
 
5298
5415
  var history$3 = {};
5299
5416
  var data$8;
5300
- function start$g() {
5417
+ function start$h() {
5301
5418
  bind(window, "error", handler);
5302
5419
  history$3 = {};
5303
5420
  }
@@ -5365,7 +5482,7 @@ function encode$2 (type) {
5365
5482
 
5366
5483
  var history$2 = {};
5367
5484
  var data$7;
5368
- function start$f() {
5485
+ function start$g() {
5369
5486
  history$2 = {};
5370
5487
  }
5371
5488
  function log$1(code, severity, name, message, stack) {
@@ -5388,7 +5505,7 @@ function log$1(code, severity, name, message, stack) {
5388
5505
  }
5389
5506
  encode$2(33 /* Event.Log */);
5390
5507
  }
5391
- function stop$e() {
5508
+ function stop$f() {
5392
5509
  history$2 = {};
5393
5510
  }
5394
5511
 
@@ -5421,7 +5538,7 @@ function reset$4() {
5421
5538
  activeTask = null;
5422
5539
  pauseTask = null;
5423
5540
  }
5424
- function schedule(task, priority) {
5541
+ function schedule$1(task, priority) {
5425
5542
  if (priority === void 0) { priority = 0 /* Priority.Normal */; }
5426
5543
  return __awaiter(this, void 0, void 0, function () {
5427
5544
  var _i, queuedTasks_1, q, promise;
@@ -5485,7 +5602,7 @@ function state(timer) {
5485
5602
  // If this task is no longer being tracked, send stop message to the caller
5486
5603
  return 2 /* Task.Stop */;
5487
5604
  }
5488
- function start$e(timer) {
5605
+ function start$f(timer) {
5489
5606
  tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
5490
5607
  }
5491
5608
  function restart$2(timer) {
@@ -5493,12 +5610,12 @@ function restart$2(timer) {
5493
5610
  if (tracker && tracker[id]) {
5494
5611
  var c = tracker[id].calls;
5495
5612
  var y = tracker[id].yield;
5496
- start$e(timer);
5613
+ start$f(timer);
5497
5614
  tracker[id].calls = c + 1;
5498
5615
  tracker[id].yield = y;
5499
5616
  }
5500
5617
  }
5501
- function stop$d(timer) {
5618
+ function stop$e(timer) {
5502
5619
  var end = performance.now();
5503
5620
  var id = key(timer);
5504
5621
  var duration = end - tracker[id].start;
@@ -5519,7 +5636,7 @@ function suspend$1(timer) {
5519
5636
  case 0:
5520
5637
  id = key(timer);
5521
5638
  if (!(id in tracker)) return [3 /*break*/, 2];
5522
- stop$d(timer);
5639
+ stop$e(timer);
5523
5640
  // some customer polyfills for requestIdleCallback return null
5524
5641
  _b = tracker[id];
5525
5642
  return [4 /*yield*/, wait()];
@@ -5590,8 +5707,8 @@ function requestIdleCallbackPolyfill(callback, options) {
5590
5707
  }
5591
5708
  var requestIdleCallback = window["requestIdleCallback"] || requestIdleCallbackPolyfill;
5592
5709
 
5593
- function start$d() {
5594
- schedule(discover, 1 /* Priority.High */).then(function () {
5710
+ function start$e() {
5711
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
5595
5712
  measure(compute$7)();
5596
5713
  measure(compute$6)();
5597
5714
  measure(compute$a)();
@@ -5605,7 +5722,7 @@ function discover() {
5605
5722
  case 0:
5606
5723
  ts = time();
5607
5724
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
5608
- start$e(timer);
5725
+ start$f(timer);
5609
5726
  return [4 /*yield*/, traverse$1(document, timer, 0 /* Source.Discover */, ts)];
5610
5727
  case 1:
5611
5728
  _a.sent();
@@ -5613,7 +5730,7 @@ function discover() {
5613
5730
  return [4 /*yield*/, encode$5(5 /* Event.Discover */, timer, ts)];
5614
5731
  case 2:
5615
5732
  _a.sent();
5616
- stop$d(timer);
5733
+ stop$e(timer);
5617
5734
  return [2 /*return*/];
5618
5735
  }
5619
5736
  });
@@ -5621,9 +5738,9 @@ function discover() {
5621
5738
  }
5622
5739
 
5623
5740
  var data$6 = null;
5624
- function start$c() {
5625
- if (!config$2.lean && config$2.upgrade) {
5626
- config$2.upgrade("Config" /* Constant.Config */);
5741
+ function start$d() {
5742
+ if (!config$3.lean && config$3.upgrade) {
5743
+ config$3.upgrade("Config" /* Constant.Config */);
5627
5744
  }
5628
5745
  data$6 = null;
5629
5746
  }
@@ -5633,24 +5750,24 @@ function start$c() {
5633
5750
  // and send all backed up layout events to the server.
5634
5751
  function upgrade(key) {
5635
5752
  // Upgrade only if Clarity was successfully activated on the page
5636
- if (active() && config$2.lean) {
5637
- config$2.lean = false;
5753
+ if (active() && config$3.lean) {
5754
+ config$3.lean = false;
5638
5755
  data$6 = { key: key };
5639
5756
  // Update metadata to track we have upgraded this session
5640
5757
  callback();
5641
5758
  save();
5642
5759
  // Callback upgrade handler, if configured
5643
- if (config$2.upgrade) {
5644
- config$2.upgrade(key);
5760
+ if (config$3.upgrade) {
5761
+ config$3.upgrade(key);
5645
5762
  }
5646
5763
  encode$1(3 /* Event.Upgrade */);
5647
- if (config$2.lite) {
5648
- start$d();
5649
- start$q();
5764
+ if (config$3.lite) {
5765
+ start$e();
5766
+ start$r();
5650
5767
  }
5651
5768
  }
5652
5769
  }
5653
- function stop$c() {
5770
+ function stop$d() {
5654
5771
  data$6 = null;
5655
5772
  }
5656
5773
 
@@ -5799,7 +5916,7 @@ function encode$1 (event) {
5799
5916
  }
5800
5917
 
5801
5918
  var data$5;
5802
- function start$b() {
5919
+ function start$c() {
5803
5920
  data$5 = { check: 0 /* Check.None */ };
5804
5921
  }
5805
5922
  function check$2(bytes) {
@@ -5827,19 +5944,19 @@ function compute$4() {
5827
5944
  encode$1(35 /* Event.Limit */);
5828
5945
  }
5829
5946
  }
5830
- function stop$b() {
5947
+ function stop$c() {
5831
5948
  data$5 = null;
5832
5949
  }
5833
5950
 
5834
5951
  var data$4 = null;
5835
5952
  var updates = null;
5836
5953
  var limited = false;
5837
- function start$a() {
5954
+ function start$b() {
5838
5955
  data$4 = {};
5839
5956
  updates = {};
5840
5957
  limited = false;
5841
5958
  }
5842
- function stop$a() {
5959
+ function stop$b() {
5843
5960
  data$4 = {};
5844
5961
  updates = {};
5845
5962
  limited = false;
@@ -5881,7 +5998,7 @@ function reset$3() {
5881
5998
 
5882
5999
  var data$3 = null;
5883
6000
  var updateConsent = true;
5884
- function start$9() {
6001
+ function start$a() {
5885
6002
  var _a;
5886
6003
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5887
6004
  updateConsent = true;
@@ -5889,7 +6006,7 @@ function start$9() {
5889
6006
  ics.addListener(["ad_storage" /* Constant.AdStorage */, "analytics_storage" /* Constant.AnalyticsStorage */], processConsent);
5890
6007
  }
5891
6008
  }
5892
- function stop$9() {
6009
+ function stop$a() {
5893
6010
  updateConsent = true;
5894
6011
  }
5895
6012
  function processConsent() {
@@ -5938,7 +6055,7 @@ function compute$2() {
5938
6055
  if (updateConsent) {
5939
6056
  encode$1(47 /* Event.Consent */);
5940
6057
  updateConsent = false;
5941
- if (!config$2.track) {
6058
+ if (!config$3.track) {
5942
6059
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5943
6060
  if (ics === null || ics === void 0 ? void 0 : ics.usedUpdate) {
5944
6061
  processConsent();
@@ -5953,7 +6070,7 @@ var electron = 0 /* BooleanFlag.False */;
5953
6070
  var consentStatus = null;
5954
6071
  var cookiesLogged = false;
5955
6072
  var defaultStatus = { source: 7 /* ConsentSource.Default */, ad_Storage: "denied" /* Constant.Denied */, analytics_Storage: "denied" /* Constant.Denied */ };
5956
- function start$8() {
6073
+ function start$9() {
5957
6074
  var _a, _b, _c;
5958
6075
  var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
5959
6076
  var timezone = (_c = (typeof Intl !== 'undefined' && ((_b = (_a = Intl === null || Intl === void 0 ? void 0 : Intl.DateTimeFormat()) === null || _a === void 0 ? void 0 : _a.resolvedOptions()) === null || _b === void 0 ? void 0 : _b.timeZone))) !== null && _c !== void 0 ? _c : '';
@@ -5964,13 +6081,13 @@ function start$8() {
5964
6081
  // Populate ids for this page
5965
6082
  var s = session();
5966
6083
  var u = user();
5967
- var projectId = config$2.projectId || hash(location.host);
5968
- var userId = config$2.externalSession && config$2.userId ? config$2.userId : u.id;
5969
- var sessionId = config$2.externalSession && config$2.sessionId ? config$2.sessionId : s.session;
6084
+ var projectId = config$3.projectId || hash(location.host);
6085
+ var userId = config$3.externalSession && config$3.userId ? config$3.userId : u.id;
6086
+ var sessionId = config$3.externalSession && config$3.sessionId ? config$3.sessionId : s.session;
5970
6087
  data$2 = { projectId: projectId, userId: userId, sessionId: sessionId, pageNum: s.count };
5971
6088
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
5972
- config$2.lean = config$2.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$2.lean;
5973
- config$2.upload = config$2.track && typeof config$2.upload === "string" /* Constant.String */ && s.upload && s.upload.length > "https://" /* Constant.HTTPS */.length ? s.upload : config$2.upload;
6089
+ config$3.lean = config$3.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$3.lean;
6090
+ config$3.upload = config$3.track && typeof config$3.upload === "string" /* Constant.String */ && s.upload && s.upload.length > "https://" /* Constant.HTTPS */.length ? s.upload : config$3.upload;
5974
6091
  // Log page metadata as dimensions
5975
6092
  log(0 /* Dimension.UserAgent */, ua);
5976
6093
  log(3 /* Dimension.PageTitle */, title);
@@ -6012,15 +6129,15 @@ function start$8() {
6012
6129
  if (consentStatus === null) {
6013
6130
  consentStatus = {
6014
6131
  source: u.consent ? 6 /* ConsentSource.Cookie */ : 0 /* ConsentSource.Implicit */,
6015
- ad_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6016
- analytics_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6132
+ ad_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6133
+ analytics_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6017
6134
  };
6018
6135
  }
6019
6136
  logCookies();
6020
6137
  var consent = getConsentData(consentStatus);
6021
6138
  config$1(consent);
6022
6139
  // Track ids using a cookie if configuration allows it, skip if using external session
6023
- if (!config$2.externalSession) {
6140
+ if (!config$3.externalSession) {
6024
6141
  track(u);
6025
6142
  }
6026
6143
  }
@@ -6045,7 +6162,7 @@ function logCookies() {
6045
6162
  if (cookiesLogged || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.analytics_Storage) !== "granted" /* Constant.Granted */ || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.ad_Storage) !== "granted" /* Constant.Granted */) {
6046
6163
  return;
6047
6164
  }
6048
- for (var _i = 0, _a = config$2.cookies; _i < _a.length; _i++) {
6165
+ for (var _i = 0, _a = config$3.cookies; _i < _a.length; _i++) {
6049
6166
  var key = _a[_i];
6050
6167
  var value = getCookie(key);
6051
6168
  if (value) {
@@ -6054,7 +6171,7 @@ function logCookies() {
6054
6171
  }
6055
6172
  cookiesLogged = true;
6056
6173
  }
6057
- function stop$8() {
6174
+ function stop$9() {
6058
6175
  data$2 = null;
6059
6176
  // Reset cookiesLogged so cookies are re-logged on restart. Each session generates new metadata
6060
6177
  // (sessionId, pageNum), and cookie values need to be recorded in the new session's data stream.
@@ -6065,14 +6182,14 @@ function metadata(cb, wait, recall, consentInfo) {
6065
6182
  if (wait === void 0) { wait = true; }
6066
6183
  if (recall === void 0) { recall = false; }
6067
6184
  if (consentInfo === void 0) { consentInfo = false; }
6068
- var upgraded = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6185
+ var upgraded = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6069
6186
  var called = false;
6070
6187
  // if caller hasn't specified that they want to skip waiting for upgrade but we've already upgraded, we need to
6071
6188
  // directly execute the callback in addition to adding to our list as we only process callbacks at the moment
6072
6189
  // we go through the upgrading flow.
6073
6190
  if (data$2 && (upgraded || wait === false)) {
6074
6191
  // Immediately invoke the callback if the caller explicitly doesn't want to wait for the upgrade confirmation
6075
- cb(data$2, !config$2.lean, consentInfo ? consentStatus : undefined);
6192
+ cb(data$2, !config$3.lean, consentInfo ? consentStatus : undefined);
6076
6193
  called = true;
6077
6194
  }
6078
6195
  if (recall || !called) {
@@ -6115,15 +6232,15 @@ function consentv2(consentState, source) {
6115
6232
  consentStatus = updatedStatus;
6116
6233
  callback(true);
6117
6234
  var consentData = getConsentData(consentStatus);
6118
- if (!consentData.analytics_Storage && config$2.track) {
6119
- config$2.track = false;
6235
+ if (!consentData.analytics_Storage && config$3.track) {
6236
+ config$3.track = false;
6120
6237
  clear(true);
6121
6238
  stop();
6122
6239
  window.setTimeout(start, 250 /* Setting.RestartDelay */);
6123
6240
  return;
6124
6241
  }
6125
6242
  if (active() && consentData.analytics_Storage) {
6126
- config$2.track = true;
6243
+ config$3.track = true;
6127
6244
  track(user(), 1 /* BooleanFlag.True */);
6128
6245
  save();
6129
6246
  }
@@ -6155,7 +6272,7 @@ function clear(all) {
6155
6272
  }
6156
6273
  function tab() {
6157
6274
  var id = shortid();
6158
- if (config$2.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6275
+ if (config$3.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6159
6276
  var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
6160
6277
  id = value ? value : id;
6161
6278
  sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
@@ -6164,15 +6281,15 @@ function tab() {
6164
6281
  }
6165
6282
  function callback(consentUpdate) {
6166
6283
  if (consentUpdate === void 0) { consentUpdate = false; }
6167
- var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6284
+ var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6168
6285
  processCallback(upgrade, consentUpdate);
6169
6286
  }
6170
6287
  function save() {
6171
- if (!data$2 || !config$2.track || config$2.externalSession)
6288
+ if (!data$2 || !config$3.track || config$3.externalSession)
6172
6289
  return;
6173
6290
  var ts = Math.round(Date.now());
6174
- var upload = config$2.upload && typeof config$2.upload === "string" /* Constant.String */ ? config$2.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6175
- var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6291
+ var upload = config$3.upload && typeof config$3.upload === "string" /* Constant.String */ ? config$3.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6292
+ var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6176
6293
  setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join(COOKIE_SEP), 1 /* Setting.SessionExpire */);
6177
6294
  }
6178
6295
  function processCallback(upgrade, consentUpdate) {
@@ -6183,7 +6300,7 @@ function processCallback(upgrade, consentUpdate) {
6183
6300
  if (cb.callback &&
6184
6301
  ((!cb.called && !consentUpdate) || (cb.consentInfo && consentUpdate)) && //If consentUpdate is true, we only call the callback if it has consentInfo
6185
6302
  (!cb.wait || upgrade)) {
6186
- cb.callback(data$2, !config$2.lean, cb.consentInfo ? consentStatus : undefined);
6303
+ cb.callback(data$2, !config$3.lean, cb.consentInfo ? consentStatus : undefined);
6187
6304
  cb.called = true;
6188
6305
  if (!cb.recall) {
6189
6306
  callbacks.splice(i, 1);
@@ -6201,7 +6318,7 @@ function track(u, consent) {
6201
6318
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
6202
6319
  var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
6203
6320
  // If DOB is not set in the user object, use the date set in the config as a DOB
6204
- var dob = u.dob === 0 ? (config$2.dob === null ? 0 : config$2.dob) : u.dob;
6321
+ var dob = u.dob === 0 ? (config$3.dob === null ? 0 : config$3.dob) : u.dob;
6205
6322
  // To avoid cookie churn, write user id cookie only once every day
6206
6323
  if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent || u.dob !== dob) {
6207
6324
  var cookieParts = [data$2.userId, 2 /* Setting.CookieVersion */, end.toString(36), consent, dob];
@@ -6217,7 +6334,7 @@ function shortid() {
6217
6334
  }
6218
6335
  function session() {
6219
6336
  var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
6220
- var value = getCookie("_clsk" /* Constant.SessionKey */, !config$2.includeSubdomains);
6337
+ var value = getCookie("_clsk" /* Constant.SessionKey */, !config$3.includeSubdomains);
6221
6338
  if (value) {
6222
6339
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
6223
6340
  var parts = value.includes("^" /* Constant.Caret */) ? value.split("^" /* Constant.Caret */) : value.split("|" /* Constant.Pipe */);
@@ -6238,7 +6355,7 @@ function num(string, base) {
6238
6355
  }
6239
6356
  function user() {
6240
6357
  var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
6241
- var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$2.includeSubdomains);
6358
+ var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$3.includeSubdomains);
6242
6359
  if (cookie && cookie.length > 0) {
6243
6360
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
6244
6361
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
@@ -6258,15 +6375,15 @@ function user() {
6258
6375
  output.dob = num(parts[4]);
6259
6376
  }
6260
6377
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
6261
- config$2.track = config$2.track || output.consent === 1 /* BooleanFlag.True */;
6378
+ config$3.track = config$3.track || output.consent === 1 /* BooleanFlag.True */;
6262
6379
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
6263
- output.id = config$2.track ? parts[0] : output.id;
6380
+ output.id = config$3.track ? parts[0] : output.id;
6264
6381
  }
6265
6382
  return output;
6266
6383
  }
6267
6384
 
6268
6385
  var data$1 = null;
6269
- function start$7() {
6386
+ function start$8() {
6270
6387
  var m = data$2;
6271
6388
  data$1 = {
6272
6389
  version: version$1,
@@ -6283,7 +6400,7 @@ function start$7() {
6283
6400
  url: ''
6284
6401
  };
6285
6402
  }
6286
- function stop$7() {
6403
+ function stop$8() {
6287
6404
  data$1 = null;
6288
6405
  }
6289
6406
  function envelope(last) {
@@ -6317,7 +6434,7 @@ function reset$2() {
6317
6434
  function report(e) {
6318
6435
  // Do not report the same message twice for the same page
6319
6436
  if (history$1 && history$1.indexOf(e.message) === -1) {
6320
- var url = config$2.report;
6437
+ var url = config$3.report;
6321
6438
  if (url && url.length > 0 && data$1) {
6322
6439
  var payload = { v: data$1.version, p: data$1.projectId, u: data$1.userId, s: data$1.sessionId, n: data$1.pageNum };
6323
6440
  if (e.message) {
@@ -6408,7 +6525,7 @@ var pushState = null;
6408
6525
  var replaceState = null;
6409
6526
  var url = null;
6410
6527
  var count = 0;
6411
- function start$6() {
6528
+ function start$7() {
6412
6529
  url = getCurrentUrl();
6413
6530
  count = 0;
6414
6531
  bind(window, "popstate", compute$1);
@@ -6469,26 +6586,26 @@ function restart$1() {
6469
6586
  function getCurrentUrl() {
6470
6587
  return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
6471
6588
  }
6472
- function stop$6() {
6589
+ function stop$7() {
6473
6590
  url = null;
6474
6591
  count = 0;
6475
6592
  }
6476
6593
 
6477
6594
  var status = false;
6478
- function start$5() {
6595
+ function start$6() {
6479
6596
  status = true;
6480
- start$P();
6597
+ start$R();
6481
6598
  reset$4();
6482
6599
  reset$1();
6483
6600
  reset$2();
6484
- start$6();
6601
+ start$7();
6485
6602
  }
6486
- function stop$5() {
6487
- stop$6();
6603
+ function stop$6() {
6604
+ stop$7();
6488
6605
  reset$2();
6489
6606
  reset$1();
6490
6607
  reset$4();
6491
- stop$M();
6608
+ stop$O();
6492
6609
  status = false;
6493
6610
  }
6494
6611
  function active() {
@@ -6516,8 +6633,8 @@ function config(override) {
6516
6633
  return false;
6517
6634
  }
6518
6635
  for (var key in override) {
6519
- if (key in config$2) {
6520
- config$2[key] = override[key];
6636
+ if (key in config$3) {
6637
+ config$3[key] = override[key];
6521
6638
  }
6522
6639
  }
6523
6640
  return true;
@@ -6543,51 +6660,111 @@ function restart() {
6543
6660
  event$1("clarityGemX" /* Constant.Clarity */, "restart" /* Constant.Restart */);
6544
6661
  }
6545
6662
 
6546
- function start$4() {
6547
- start$F();
6663
+ function start$5() {
6664
+ start$G();
6665
+ start$h();
6548
6666
  start$g();
6549
- start$f();
6550
6667
  }
6551
- function stop$4() {
6552
- stop$e();
6668
+ function stop$5() {
6669
+ stop$f();
6553
6670
  }
6554
6671
 
6555
6672
  var diagnostic = /*#__PURE__*/Object.freeze({
6556
6673
  __proto__: null,
6557
- start: start$4,
6558
- stop: stop$4
6674
+ start: start$5,
6675
+ stop: stop$5
6559
6676
  });
6560
6677
 
6678
+ // Called from layout/index.ts before discover.start().
6679
+ // Activates the upload buffer so Event.Discover is held until trigger fires.
6680
+ // discover.start() runs traverse immediately — click/scroll tracking gets valid node ids.
6681
+ function start$4() {
6682
+ var discoverTrigger = get$2().discoverTrigger;
6683
+ if (!discoverTrigger) {
6684
+ return;
6685
+ }
6686
+ config$2(discoverTrigger.maxPlaybackBytes, fire);
6687
+ schedule(discoverTrigger);
6688
+ }
6689
+ function stop$4() {
6690
+ stop$F();
6691
+ }
6692
+ var triggered = false;
6693
+ function fire() {
6694
+ if (triggered) {
6695
+ return;
6696
+ }
6697
+ triggered = true;
6698
+ if (window.GemXHeatmap) {
6699
+ var hashes = getHashes();
6700
+ window.GemXHeatmap.__domSnapshot = hashes;
6701
+ }
6702
+ onTrustedClick(null);
6703
+ onTrustedScroll(null);
6704
+ flush();
6705
+ }
6706
+ function schedule(trigger) {
6707
+ triggered = false;
6708
+ var clickCount = 0;
6709
+ if (trigger.scrollDepthPercent) {
6710
+ onTrustedScroll(function () {
6711
+ var scrolled = window.scrollY + window.innerHeight;
6712
+ var total = document.documentElement.scrollHeight;
6713
+ if ((scrolled / total) * 100 >= trigger.scrollDepthPercent) {
6714
+ fire();
6715
+ }
6716
+ });
6717
+ }
6718
+ if (trigger.clickCount) {
6719
+ onTrustedClick(function () {
6720
+ clickCount++;
6721
+ if (clickCount >= trigger.clickCount) {
6722
+ fire();
6723
+ }
6724
+ });
6725
+ }
6726
+ if (trigger.activeTimeMs) {
6727
+ setTimeout(fire, trigger.activeTimeMs);
6728
+ }
6729
+ // maxPlaybackBytes trigger is handled via gemxUpload.start() callback above
6730
+ }
6731
+ function flush() {
6732
+ inject(drain());
6733
+ uploadNow();
6734
+ }
6735
+
6561
6736
  function start$3() {
6562
6737
  // The order below is important
6563
6738
  // and is determined by interdependencies of modules
6564
- start$n();
6565
- start$k();
6739
+ start$o();
6566
6740
  start$l();
6567
- if (config$2.delayDom) {
6741
+ start$m();
6742
+ if (config$3.delayDom) {
6568
6743
  // Lazy load layout module as part of page load time performance improvements experiment
6569
6744
  bind(window, 'load', function () {
6570
- start$m();
6745
+ start$n();
6571
6746
  });
6572
6747
  }
6573
6748
  else {
6574
- start$m();
6749
+ start$n();
6575
6750
  }
6576
6751
  // IMPORTANT: Start custom element detection BEFORE discover
6577
6752
  // This ensures pre-existing custom elements are registered before DOM traversal
6578
- start$o();
6579
- start$d();
6580
- start$q();
6581
6753
  start$p();
6754
+ start$4(); // activates upload buffer before discover traverses
6755
+ start$e();
6756
+ start$r();
6757
+ start$q();
6582
6758
  }
6583
6759
  function stop$3() {
6584
- stop$i();
6585
6760
  stop$j();
6586
6761
  stop$k();
6587
6762
  stop$l();
6763
+ stop$m();
6764
+ stop$p();
6588
6765
  stop$o();
6589
6766
  stop$n();
6590
- stop$m();
6767
+ stop$4();
6591
6768
  }
6592
6769
 
6593
6770
  var layout = /*#__PURE__*/Object.freeze({
@@ -6815,7 +6992,7 @@ function process(entries) {
6815
6992
  case "resource" /* Constant.Resource */:
6816
6993
  var name_1 = entry.name;
6817
6994
  log(4 /* Dimension.NetworkHosts */, host(name_1));
6818
- if (name_1 === config$2.upload || name_1 === config$2.fallback) {
6995
+ if (name_1 === config$3.upload || name_1 === config$3.fallback) {
6819
6996
  max(28 /* Metric.UploadTime */, entry.duration);
6820
6997
  }
6821
6998
  break;
@@ -6890,8 +7067,8 @@ function start(config$1) {
6890
7067
  // Check that browser supports required APIs and we do not attempt to start Clarity multiple times
6891
7068
  if (check()) {
6892
7069
  config(config$1);
6893
- start$5();
6894
- start$G();
7070
+ start$6();
7071
+ start$H();
6895
7072
  modules.forEach(function (x) { return measure(x.start)(); });
6896
7073
  // If it's an internal call to start, without explicit configuration,
6897
7074
  // re-process any newly accumulated items in the queue
@@ -6922,8 +7099,8 @@ function stop() {
6922
7099
  if (active()) {
6923
7100
  // Stop modules in the reverse order of their initialization and start queuing up items again
6924
7101
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
6925
- stop$D();
6926
- stop$5();
7102
+ stop$E();
7103
+ stop$6();
6927
7104
  setup();
6928
7105
  }
6929
7106
  }