clarity-js 0.8.25 → 0.8.27

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
@@ -83,6 +83,7 @@ var clarity = /*#__PURE__*/Object.freeze({
83
83
  get event () { return event; },
84
84
  get hashText () { return hashText; },
85
85
  get identify () { return identify; },
86
+ get measure () { return measure; },
86
87
  get metadata () { return metadata; },
87
88
  get pause () { return pause; },
88
89
  get queue () { return queue; },
@@ -172,7 +173,7 @@ var startTime = 0;
172
173
  function computeStartTime() {
173
174
  return performance.now() + performance.timeOrigin;
174
175
  }
175
- function start$K() {
176
+ function start$L() {
176
177
  startTime = computeStartTime();
177
178
  }
178
179
  // event.timestamp is number of milliseconds elapsed since the document was loaded
@@ -188,11 +189,11 @@ function time(event) {
188
189
  var origin = event && event.view ? event.view.performance.timeOrigin : performance.timeOrigin;
189
190
  return Math.max(Math.round(ts + origin - baseline), 0);
190
191
  }
191
- function stop$H() {
192
+ function stop$I() {
192
193
  startTime = 0;
193
194
  }
194
195
 
195
- var version$1 = "0.8.25";
196
+ var version$1 = "0.8.27";
196
197
 
197
198
  // tslint:disable: no-bitwise
198
199
  function hash (input, precision) {
@@ -413,11 +414,11 @@ function redact$1(value) {
413
414
  var state$b = null;
414
415
  var buffer = null;
415
416
  var update$2 = false;
416
- function start$J() {
417
+ function start$K() {
417
418
  update$2 = false;
418
- reset$s();
419
+ reset$t();
419
420
  }
420
- function reset$s() {
421
+ function reset$t() {
421
422
  // Baseline state holds the previous values - if it is updated in the current payload,
422
423
  // reset the state to current value after sending the previous state
423
424
  if (update$2) {
@@ -545,38 +546,38 @@ function visibility(t, visible) {
545
546
  }
546
547
  update$2 = true;
547
548
  }
548
- function compute$f() {
549
+ function compute$g() {
549
550
  if (update$2) {
550
551
  encode$1(4 /* Event.Baseline */);
551
552
  }
552
553
  }
553
- function stop$G() {
554
- reset$s();
554
+ function stop$H() {
555
+ reset$t();
555
556
  }
556
557
 
557
558
  var baseline = /*#__PURE__*/Object.freeze({
558
559
  __proto__: null,
559
560
  activity: activity,
560
- compute: compute$f,
561
- reset: reset$s,
562
- start: start$J,
561
+ compute: compute$g,
562
+ reset: reset$t,
563
+ start: start$K,
563
564
  get state () { return state$b; },
564
- stop: stop$G,
565
+ stop: stop$H,
565
566
  track: track$8,
566
567
  visibility: visibility
567
568
  });
568
569
 
569
- var data$k = null;
570
+ var data$l = null;
570
571
  var updateConsent = true;
571
- function start$I() {
572
+ function start$J() {
572
573
  updateConsent = true;
573
574
  }
574
- function stop$F() {
575
+ function stop$G() {
575
576
  updateConsent = true;
576
577
  }
577
578
  function config$1(consent) {
578
579
  trackConsent(consent.analytics_Storage ? 1 /* ConsentType.Implicit */ : 0 /* ConsentType.None */);
579
- data$k = consent;
580
+ data$l = consent;
580
581
  }
581
582
  // When we get consent signal as false, we restart the service and track config as false.
582
583
  function consent$1() {
@@ -586,11 +587,11 @@ function trackConsent(consent) {
586
587
  log(36 /* Dimension.Consent */, consent.toString());
587
588
  }
588
589
  function consentv2$1(consent) {
589
- data$k = consent;
590
+ data$l = consent;
590
591
  encode$1(47 /* Event.Consent */);
591
592
  }
592
593
  // Compute function is called every upload, but we only want to send consent data once.
593
- function compute$e() {
594
+ function compute$f() {
594
595
  if (updateConsent) {
595
596
  encode$1(47 /* Event.Consent */);
596
597
  updateConsent = false;
@@ -599,16 +600,16 @@ function compute$e() {
599
600
 
600
601
  var consent$2 = /*#__PURE__*/Object.freeze({
601
602
  __proto__: null,
602
- compute: compute$e,
603
+ compute: compute$f,
603
604
  config: config$1,
604
605
  consent: consent$1,
605
606
  consentv2: consentv2$1,
606
- get data () { return data$k; },
607
- start: start$I,
608
- stop: stop$F
607
+ get data () { return data$l; },
608
+ start: start$J,
609
+ stop: stop$G
609
610
  });
610
611
 
611
- var data$j = null;
612
+ var data$k = null;
612
613
  // custom events allow 2 parameters or 1 parameter to be passed. If 2 are passed we
613
614
  // consider it a key value pair. If only 1 is passed we only consider the event to have a value.
614
615
  function event(a, b) {
@@ -617,64 +618,64 @@ function event(a, b) {
617
618
  typeof a === "string" /* Constant.String */ &&
618
619
  a.length < 255) {
619
620
  if (b && typeof b === "string" /* Constant.String */ && b.length < 255) {
620
- data$j = { key: a, value: b };
621
+ data$k = { key: a, value: b };
621
622
  }
622
623
  else {
623
- data$j = { value: a };
624
+ data$k = { value: a };
624
625
  }
625
626
  encode$1(24 /* Event.Custom */);
626
627
  }
627
628
  }
628
629
 
629
- var data$i = null;
630
+ var data$j = null;
630
631
  var updates$3 = null;
631
- function start$H() {
632
- data$i = {};
632
+ function start$I() {
633
+ data$j = {};
633
634
  updates$3 = {};
634
635
  count$1(5 /* Metric.InvokeCount */);
635
636
  }
636
- function stop$E() {
637
- data$i = {};
637
+ function stop$F() {
638
+ data$j = {};
638
639
  updates$3 = {};
639
640
  }
640
641
  function count$1(metric) {
641
- if (!(metric in data$i)) {
642
- data$i[metric] = 0;
642
+ if (!(metric in data$j)) {
643
+ data$j[metric] = 0;
643
644
  }
644
645
  if (!(metric in updates$3)) {
645
646
  updates$3[metric] = 0;
646
647
  }
647
- data$i[metric]++;
648
+ data$j[metric]++;
648
649
  updates$3[metric]++;
649
650
  }
650
651
  function sum(metric, value) {
651
652
  if (value !== null) {
652
- if (!(metric in data$i)) {
653
- data$i[metric] = 0;
653
+ if (!(metric in data$j)) {
654
+ data$j[metric] = 0;
654
655
  }
655
656
  if (!(metric in updates$3)) {
656
657
  updates$3[metric] = 0;
657
658
  }
658
- data$i[metric] += value;
659
+ data$j[metric] += value;
659
660
  updates$3[metric] += value;
660
661
  }
661
662
  }
662
663
  function max(metric, value) {
663
664
  // Ensure that we do not process null or NaN values
664
665
  if (value !== null && isNaN(value) === false) {
665
- if (!(metric in data$i)) {
666
- data$i[metric] = 0;
666
+ if (!(metric in data$j)) {
667
+ data$j[metric] = 0;
667
668
  }
668
- if (value > data$i[metric] || data$i[metric] === 0) {
669
+ if (value > data$j[metric] || data$j[metric] === 0) {
669
670
  updates$3[metric] = value;
670
- data$i[metric] = value;
671
+ data$j[metric] = value;
671
672
  }
672
673
  }
673
674
  }
674
- function compute$d() {
675
+ function compute$e() {
675
676
  encode$1(0 /* Event.Metric */);
676
677
  }
677
- function reset$r() {
678
+ function reset$s() {
678
679
  updates$3 = {};
679
680
  }
680
681
 
@@ -685,15 +686,15 @@ function clearTimeout$1(handle) {
685
686
  return window.clearTimeout(handle);
686
687
  }
687
688
 
688
- var data$h;
689
+ var data$i;
689
690
  var last = 0;
690
691
  var interval = 0;
691
692
  var timeout$7 = null;
692
- function start$G() {
693
+ function start$H() {
693
694
  interval = 60000 /* Setting.PingInterval */;
694
695
  last = 0;
695
696
  }
696
- function reset$q() {
697
+ function reset$r() {
697
698
  if (timeout$7) {
698
699
  clearTimeout$1(timeout$7);
699
700
  }
@@ -702,16 +703,16 @@ function reset$q() {
702
703
  }
703
704
  function ping() {
704
705
  var now = time();
705
- data$h = { gap: now - last };
706
+ data$i = { gap: now - last };
706
707
  encode$1(25 /* Event.Ping */);
707
- if (data$h.gap < 300000 /* Setting.PingTimeout */) {
708
+ if (data$i.gap < 300000 /* Setting.PingTimeout */) {
708
709
  timeout$7 = setTimeout$1(ping, interval);
709
710
  }
710
711
  else {
711
712
  suspend();
712
713
  }
713
714
  }
714
- function stop$D() {
715
+ function stop$E() {
715
716
  clearTimeout$1(timeout$7);
716
717
  last = 0;
717
718
  interval = 0;
@@ -719,50 +720,50 @@ function stop$D() {
719
720
 
720
721
  var ping$1 = /*#__PURE__*/Object.freeze({
721
722
  __proto__: null,
722
- get data () { return data$h; },
723
- reset: reset$q,
724
- start: start$G,
725
- stop: stop$D
723
+ get data () { return data$i; },
724
+ reset: reset$r,
725
+ start: start$H,
726
+ stop: stop$E
726
727
  });
727
728
 
728
- var data$g = null;
729
- function start$F() {
730
- data$g = {};
729
+ var data$h = null;
730
+ function start$G() {
731
+ data$h = {};
731
732
  }
732
- function stop$C() {
733
- data$g = {};
733
+ function stop$D() {
734
+ data$h = {};
734
735
  }
735
736
  function track$7(event, time) {
736
- if (!(event in data$g)) {
737
- data$g[event] = [[time, 0]];
737
+ if (!(event in data$h)) {
738
+ data$h[event] = [[time, 0]];
738
739
  }
739
740
  else {
740
- var e = data$g[event];
741
+ var e = data$h[event];
741
742
  var last = e[e.length - 1];
742
743
  // Add a new entry only if the new event occurs after configured interval
743
744
  // Otherwise, extend the duration of the previous entry
744
745
  if (time - last[0] > 100 /* Setting.SummaryInterval */) {
745
- data$g[event].push([time, 0]);
746
+ data$h[event].push([time, 0]);
746
747
  }
747
748
  else {
748
749
  last[1] = time - last[0];
749
750
  }
750
751
  }
751
752
  }
752
- function compute$c() {
753
+ function compute$d() {
753
754
  encode$1(36 /* Event.Summary */);
754
755
  }
755
- function reset$p() {
756
- data$g = {};
756
+ function reset$q() {
757
+ data$h = {};
757
758
  }
758
759
 
759
760
  var summary = /*#__PURE__*/Object.freeze({
760
761
  __proto__: null,
761
- compute: compute$c,
762
- get data () { return data$g; },
763
- reset: reset$p,
764
- start: start$F,
765
- stop: stop$C,
762
+ compute: compute$d,
763
+ get data () { return data$h; },
764
+ reset: reset$q,
765
+ start: start$G,
766
+ stop: stop$D,
766
767
  track: track$7
767
768
  });
768
769
 
@@ -879,9 +880,9 @@ function read(stream) {
879
880
  });
880
881
  }
881
882
 
882
- var data$f = null;
883
- function start$E() {
884
- reset$o();
883
+ var data$g = null;
884
+ function start$F() {
885
+ reset$p();
885
886
  }
886
887
  function set(variable, value) {
887
888
  var values = typeof value === "string" /* Constant.String */ ? [value] : value;
@@ -927,23 +928,23 @@ function log$2(variable, value) {
927
928
  value &&
928
929
  typeof variable === "string" /* Constant.String */ &&
929
930
  variable.length < 255) {
930
- var validValues = variable in data$f ? data$f[variable] : [];
931
+ var validValues = variable in data$g ? data$g[variable] : [];
931
932
  for (var i = 0; i < value.length; i++) {
932
933
  if (typeof value[i] === "string" /* Constant.String */ && value[i].length < 255) {
933
934
  validValues.push(value[i]);
934
935
  }
935
936
  }
936
- data$f[variable] = validValues;
937
+ data$g[variable] = validValues;
937
938
  }
938
939
  }
939
- function compute$b() {
940
+ function compute$c() {
940
941
  encode$1(34 /* Event.Variable */);
941
942
  }
942
- function reset$o() {
943
- data$f = {};
943
+ function reset$p() {
944
+ data$g = {};
944
945
  }
945
- function stop$B() {
946
- reset$o();
946
+ function stop$C() {
947
+ reset$p();
947
948
  }
948
949
  function redact(input) {
949
950
  return input && input.length >= 5 /* Setting.WordLength */ ?
@@ -977,23 +978,23 @@ function detect(input) {
977
978
 
978
979
  var variable = /*#__PURE__*/Object.freeze({
979
980
  __proto__: null,
980
- compute: compute$b,
981
- get data () { return data$f; },
981
+ compute: compute$c,
982
+ get data () { return data$g; },
982
983
  identify: identify,
983
- reset: reset$o,
984
+ reset: reset$p,
984
985
  set: set,
985
- start: start$E,
986
- stop: stop$B
986
+ start: start$F,
987
+ stop: stop$C
987
988
  });
988
989
 
989
- var data$e = {};
990
+ var data$f = {};
990
991
  var keys = new Set();
991
992
  var variables = {};
992
993
  var selectors = {};
993
994
  var hashes = {};
994
995
  var validation = {};
995
- function start$D() {
996
- reset$n();
996
+ function start$E() {
997
+ reset$o();
997
998
  }
998
999
  // Input string is of the following form:
999
1000
  // EXTRACT 101|element { "1": ".class1", "2": "~window.a.b", "3": "!abc"}
@@ -1045,7 +1046,7 @@ function trigger$2(input) {
1045
1046
  function clone$1(v) {
1046
1047
  return JSON.parse(JSON.stringify(v));
1047
1048
  }
1048
- function compute$a() {
1049
+ function compute$b() {
1049
1050
  try {
1050
1051
  for (var v in variables) {
1051
1052
  var key = parseInt(v);
@@ -1089,27 +1090,27 @@ function compute$a() {
1089
1090
  log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
1090
1091
  }
1091
1092
  }
1092
- function reset$n() {
1093
+ function reset$o() {
1093
1094
  keys.clear();
1094
1095
  }
1095
1096
  function update$1(key, subkey, value) {
1096
1097
  var update = false;
1097
- if (!(key in data$e)) {
1098
- data$e[key] = {};
1098
+ if (!(key in data$f)) {
1099
+ data$f[key] = {};
1099
1100
  update = true;
1100
1101
  }
1101
1102
  if (!isEmpty(hashes[key])
1102
- && (!(subkey in data$e[key]) || data$e[key][subkey] != value)) {
1103
+ && (!(subkey in data$f[key]) || data$f[key][subkey] != value)) {
1103
1104
  update = true;
1104
1105
  }
1105
- data$e[key][subkey] = value;
1106
+ data$f[key][subkey] = value;
1106
1107
  if (update) {
1107
1108
  keys.add(key);
1108
1109
  }
1109
1110
  return;
1110
1111
  }
1111
- function stop$A() {
1112
- reset$n();
1112
+ function stop$B() {
1113
+ reset$o();
1113
1114
  }
1114
1115
  function parse$1(variable) {
1115
1116
  var syntax = [];
@@ -1177,12 +1178,12 @@ function isEmpty(obj) {
1177
1178
  var extract = /*#__PURE__*/Object.freeze({
1178
1179
  __proto__: null,
1179
1180
  clone: clone$1,
1180
- compute: compute$a,
1181
- data: data$e,
1181
+ compute: compute$b,
1182
+ data: data$f,
1182
1183
  keys: keys,
1183
- reset: reset$n,
1184
- start: start$D,
1185
- stop: stop$A,
1184
+ reset: reset$o,
1185
+ start: start$E,
1186
+ stop: stop$B,
1186
1187
  trigger: trigger$2,
1187
1188
  update: update$1
1188
1189
  });
@@ -1216,33 +1217,33 @@ function signalsEvent(signalsPayload) {
1216
1217
  }
1217
1218
 
1218
1219
  var modules$1 = [baseline, dimension, variable, limit, summary, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1219
- function start$C() {
1220
+ function start$D() {
1220
1221
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
1221
- start$H();
1222
+ start$I();
1222
1223
  modules$1.forEach(function (x) { return measure(x.start)(); });
1223
1224
  }
1224
- function stop$z() {
1225
+ function stop$A() {
1225
1226
  // Stop modules in the reverse order of their initialization
1226
1227
  // The ordering below should respect inter-module dependency.
1227
1228
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
1228
1229
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
1229
1230
  modules$1.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1230
- stop$E();
1231
+ stop$F();
1231
1232
  }
1232
- function compute$9() {
1233
- compute$b();
1234
- compute$f();
1233
+ function compute$a() {
1234
+ compute$c();
1235
+ compute$g();
1235
1236
  compute$2();
1237
+ compute$e();
1236
1238
  compute$d();
1237
- compute$c();
1238
1239
  compute$3();
1239
- compute$a();
1240
- compute$e();
1240
+ compute$b();
1241
+ compute$f();
1241
1242
  }
1242
1243
 
1243
1244
  var history$5 = [];
1244
- var data$d;
1245
- function start$B() {
1245
+ var data$e;
1246
+ function start$C() {
1246
1247
  history$5 = [];
1247
1248
  max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
1248
1249
  try {
@@ -1256,18 +1257,18 @@ function start$B() {
1256
1257
  function check$4(id, target, input) {
1257
1258
  // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
1258
1259
  if (config$2.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1259
- data$d = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1260
+ data$e = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1260
1261
  // Only encode this event if we haven't already reported this hash
1261
- if (history$5.indexOf(data$d.checksum) < 0) {
1262
- history$5.push(data$d.checksum);
1262
+ if (history$5.indexOf(data$e.checksum) < 0) {
1263
+ history$5.push(data$e.checksum);
1263
1264
  encode$2(41 /* Event.Fraud */);
1264
1265
  }
1265
1266
  }
1266
1267
  }
1267
1268
 
1268
1269
  var state$a = [];
1269
- function start$A() {
1270
- reset$m();
1270
+ function start$B() {
1271
+ reset$n();
1271
1272
  }
1272
1273
  function observe$c(root) {
1273
1274
  bind(root, "change", recompute$8, true);
@@ -1281,11 +1282,11 @@ function recompute$8(evt) {
1281
1282
  schedule(encode$4.bind(this, 42 /* Event.Change */));
1282
1283
  }
1283
1284
  }
1284
- function reset$m() {
1285
+ function reset$n() {
1285
1286
  state$a = [];
1286
1287
  }
1287
- function stop$y() {
1288
- reset$m();
1288
+ function stop$z() {
1289
+ reset$n();
1289
1290
  }
1290
1291
 
1291
1292
  function offset(element) {
@@ -1306,8 +1307,8 @@ function offset(element) {
1306
1307
 
1307
1308
  var UserInputTags = ["input", "textarea", "radio", "button", "canvas", "select"];
1308
1309
  var state$9 = [];
1309
- function start$z() {
1310
- reset$l();
1310
+ function start$A() {
1311
+ reset$m();
1311
1312
  }
1312
1313
  function observe$b(root) {
1313
1314
  bind(root, "click", handler$3.bind(this, 9 /* Event.Click */, root), true);
@@ -1433,16 +1434,16 @@ function context(a) {
1433
1434
  }
1434
1435
  return 0 /* BrowsingContext.Self */;
1435
1436
  }
1436
- function reset$l() {
1437
+ function reset$m() {
1437
1438
  state$9 = [];
1438
1439
  }
1439
- function stop$x() {
1440
- reset$l();
1440
+ function stop$y() {
1441
+ reset$m();
1441
1442
  }
1442
1443
 
1443
1444
  var state$8 = [];
1444
- function start$y() {
1445
- reset$k();
1445
+ function start$z() {
1446
+ reset$l();
1446
1447
  }
1447
1448
  function observe$a(root) {
1448
1449
  bind(root, "cut", recompute$7.bind(this, 0 /* Clipboard.Cut */), true);
@@ -1453,17 +1454,17 @@ function recompute$7(action, evt) {
1453
1454
  state$8.push({ time: time(evt), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1454
1455
  schedule(encode$4.bind(this, 38 /* Event.Clipboard */));
1455
1456
  }
1456
- function reset$k() {
1457
+ function reset$l() {
1457
1458
  state$8 = [];
1458
1459
  }
1459
- function stop$w() {
1460
- reset$k();
1460
+ function stop$x() {
1461
+ reset$l();
1461
1462
  }
1462
1463
 
1463
1464
  var timeout$6 = null;
1464
1465
  var state$7 = [];
1465
- function start$x() {
1466
- reset$j();
1466
+ function start$y() {
1467
+ reset$k();
1467
1468
  }
1468
1469
  function observe$9(root) {
1469
1470
  bind(root, "input", recompute$6, true);
@@ -1493,12 +1494,12 @@ function recompute$6(evt) {
1493
1494
  function process$7(event) {
1494
1495
  schedule(encode$4.bind(this, event));
1495
1496
  }
1496
- function reset$j() {
1497
+ function reset$k() {
1497
1498
  state$7 = [];
1498
1499
  }
1499
- function stop$v() {
1500
+ function stop$w() {
1500
1501
  clearTimeout$1(timeout$6);
1501
- reset$j();
1502
+ reset$k();
1502
1503
  }
1503
1504
 
1504
1505
  var state$6 = [];
@@ -1506,8 +1507,8 @@ var timeout$5 = null;
1506
1507
  var hasPrimaryTouch = false;
1507
1508
  var primaryTouchId = 0;
1508
1509
  var activeTouchPointIds = new Set();
1509
- function start$w() {
1510
- reset$i();
1510
+ function start$x() {
1511
+ reset$j();
1511
1512
  }
1512
1513
  function observe$8(root) {
1513
1514
  bind(root, "mousedown", mouse.bind(this, 13 /* Event.MouseDown */, root), true);
@@ -1602,7 +1603,7 @@ function handler$2(current) {
1602
1603
  function process$6(event) {
1603
1604
  schedule(encode$4.bind(this, event));
1604
1605
  }
1605
- function reset$i() {
1606
+ function reset$j() {
1606
1607
  state$6 = [];
1607
1608
  }
1608
1609
  function similar$1(last, current) {
@@ -1614,7 +1615,7 @@ function similar$1(last, current) {
1614
1615
  var sameId = current.data.id !== undefined ? current.data.id === last.data.id : true;
1615
1616
  return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.PointerInterval */ && sameId;
1616
1617
  }
1617
- function stop$u() {
1618
+ function stop$v() {
1618
1619
  clearTimeout$1(timeout$5);
1619
1620
  // Send out any pending pointer events in the pipeline
1620
1621
  if (state$6.length > 0) {
@@ -1670,11 +1671,11 @@ function throttle(func, duration) {
1670
1671
  return throttledFunction;
1671
1672
  }
1672
1673
 
1673
- var data$c;
1674
+ var data$d;
1674
1675
  var timeout$4 = null;
1675
1676
  var initialStateLogged = false;
1676
1677
  var throttledRecompute$1 = throttle(recompute$5, 500 /* Setting.LookAhead */);
1677
- function start$v() {
1678
+ function start$w() {
1678
1679
  initialStateLogged = false;
1679
1680
  bind(window, "resize", throttledRecompute$1);
1680
1681
  recompute$5();
@@ -1683,7 +1684,7 @@ function recompute$5() {
1683
1684
  var de = document.documentElement;
1684
1685
  // window.innerWidth includes width of the scrollbar and is not a true representation of the viewport width.
1685
1686
  // Therefore, when possible, use documentElement's clientWidth property.
1686
- data$c = {
1687
+ data$d = {
1687
1688
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
1688
1689
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
1689
1690
  };
@@ -1699,20 +1700,20 @@ function recompute$5() {
1699
1700
  function process$5(event) {
1700
1701
  schedule(encode$4.bind(this, event));
1701
1702
  }
1702
- function reset$h() {
1703
- data$c = null;
1703
+ function reset$i() {
1704
+ data$d = null;
1704
1705
  clearTimeout$1(timeout$4);
1705
1706
  throttledRecompute$1.cleanup();
1706
1707
  }
1707
- function stop$t() {
1708
- reset$h();
1708
+ function stop$u() {
1709
+ reset$i();
1709
1710
  }
1710
1711
 
1711
1712
  var state$5 = [];
1712
1713
  var initialTop = null;
1713
1714
  var initialBottom = null;
1714
1715
  var timeout$3 = null;
1715
- function start$u() {
1716
+ function start$v() {
1716
1717
  state$5 = [];
1717
1718
  recompute$4();
1718
1719
  }
@@ -1784,7 +1785,7 @@ function getPositionNode(x, y) {
1784
1785
  }
1785
1786
  return node;
1786
1787
  }
1787
- function reset$g() {
1788
+ function reset$h() {
1788
1789
  state$5 = [];
1789
1790
  initialTop = null;
1790
1791
  initialBottom = null;
@@ -1797,7 +1798,7 @@ function similar(last, current) {
1797
1798
  var dy = last.data.y - current.data.y;
1798
1799
  return (dx * dx + dy * dy < 20 /* Setting.Distance */ * 20 /* Setting.Distance */) && (current.time - last.time < 50 /* Setting.ScrollInterval */);
1799
1800
  }
1800
- function compute$8() {
1801
+ function compute$9() {
1801
1802
  var _a, _b;
1802
1803
  if (initialTop) {
1803
1804
  var top_1 = metadata$2(initialTop, null);
@@ -1808,7 +1809,7 @@ function compute$8() {
1808
1809
  log(32 /* Dimension.InitialScrollBottom */, (_b = bottom === null || bottom === void 0 ? void 0 : bottom.hash) === null || _b === void 0 ? void 0 : _b.join("." /* Constant.Dot */));
1809
1810
  }
1810
1811
  }
1811
- function stop$s() {
1812
+ function stop$t() {
1812
1813
  clearTimeout$1(timeout$3);
1813
1814
  throttledRecompute.cleanup();
1814
1815
  state$5 = [];
@@ -1816,11 +1817,11 @@ function stop$s() {
1816
1817
  initialBottom = null;
1817
1818
  }
1818
1819
 
1819
- var data$b = null;
1820
+ var data$c = null;
1820
1821
  var previous = null;
1821
1822
  var timeout$2 = null;
1822
- function start$t() {
1823
- reset$f();
1823
+ function start$u() {
1824
+ reset$g();
1824
1825
  }
1825
1826
  function observe$6(root) {
1826
1827
  bind(root, "selectstart", recompute$3.bind(this, root), true);
@@ -1841,12 +1842,12 @@ function recompute$3(root) {
1841
1842
  (current.anchorNode === current.focusNode && current.anchorOffset === current.focusOffset)) {
1842
1843
  return;
1843
1844
  }
1844
- var startNode = data$b.start ? data$b.start : null;
1845
- if (previous !== null && data$b.start !== null && startNode !== current.anchorNode) {
1845
+ var startNode = data$c.start ? data$c.start : null;
1846
+ if (previous !== null && data$c.start !== null && startNode !== current.anchorNode) {
1846
1847
  clearTimeout$1(timeout$2);
1847
1848
  process$3(21 /* Event.Selection */);
1848
1849
  }
1849
- data$b = {
1850
+ data$c = {
1850
1851
  start: current.anchorNode,
1851
1852
  startOffset: current.anchorOffset,
1852
1853
  end: current.focusNode,
@@ -1859,18 +1860,18 @@ function recompute$3(root) {
1859
1860
  function process$3(event) {
1860
1861
  schedule(encode$4.bind(this, event));
1861
1862
  }
1862
- function reset$f() {
1863
+ function reset$g() {
1863
1864
  previous = null;
1864
- data$b = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
1865
+ data$c = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
1865
1866
  }
1866
- function stop$r() {
1867
- reset$f();
1867
+ function stop$s() {
1868
+ reset$g();
1868
1869
  clearTimeout$1(timeout$2);
1869
1870
  }
1870
1871
 
1871
1872
  var state$4 = [];
1872
- function start$s() {
1873
- reset$e();
1873
+ function start$t() {
1874
+ reset$f();
1874
1875
  }
1875
1876
  function observe$5(root) {
1876
1877
  bind(root, "submit", recompute$2, true);
@@ -1879,22 +1880,39 @@ function recompute$2(evt) {
1879
1880
  state$4.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
1880
1881
  schedule(encode$4.bind(this, 39 /* Event.Submit */));
1881
1882
  }
1882
- function reset$e() {
1883
+ function reset$f() {
1883
1884
  state$4 = [];
1884
1885
  }
1885
- function stop$q() {
1886
- reset$e();
1886
+ function stop$r() {
1887
+ reset$f();
1887
1888
  }
1888
1889
 
1889
- var data$a;
1890
- function start$r() {
1890
+ var data$b;
1891
+ function start$s() {
1891
1892
  bind(window, "pagehide", recompute$1);
1892
1893
  }
1893
1894
  function recompute$1(evt) {
1894
- data$a = { name: evt.type, persisted: evt.persisted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */ };
1895
+ data$b = { name: evt.type, persisted: evt.persisted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */ };
1895
1896
  encode$4(26 /* Event.Unload */, time(evt));
1896
1897
  stop();
1897
1898
  }
1899
+ function reset$e() {
1900
+ data$b = null;
1901
+ }
1902
+ function stop$q() {
1903
+ reset$e();
1904
+ }
1905
+
1906
+ var data$a;
1907
+ function start$r() {
1908
+ bind(document, "visibilitychange", recompute);
1909
+ recompute();
1910
+ }
1911
+ function recompute(evt) {
1912
+ if (evt === void 0) { evt = null; }
1913
+ data$a = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1914
+ encode$4(28 /* Event.Visibility */, time(evt));
1915
+ }
1898
1916
  function reset$d() {
1899
1917
  data$a = null;
1900
1918
  }
@@ -1904,48 +1922,49 @@ function stop$p() {
1904
1922
 
1905
1923
  var data$9;
1906
1924
  function start$q() {
1907
- bind(document, "visibilitychange", recompute);
1908
- recompute();
1925
+ bind(window, "focus", function () { return compute$8(1 /* BooleanFlag.True */); });
1926
+ bind(window, "blur", function () { return compute$8(0 /* BooleanFlag.False */); });
1909
1927
  }
1910
- function recompute(evt) {
1911
- if (evt === void 0) { evt = null; }
1912
- data$9 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1913
- encode$4(28 /* Event.Visibility */, time(evt));
1928
+ function stop$o() {
1929
+ reset$c();
1914
1930
  }
1915
1931
  function reset$c() {
1916
1932
  data$9 = null;
1917
1933
  }
1918
- function stop$o() {
1919
- reset$c();
1934
+ function compute$8(focus) {
1935
+ data$9 = { focused: focus };
1936
+ encode$4(49 /* Event.Focus */);
1920
1937
  }
1921
1938
 
1922
1939
  function start$p() {
1923
1940
  start$i();
1941
+ start$A();
1924
1942
  start$z();
1943
+ start$x();
1925
1944
  start$y();
1926
1945
  start$w();
1927
- start$x();
1928
- start$v();
1946
+ start$r();
1929
1947
  start$q();
1948
+ start$v();
1930
1949
  start$u();
1950
+ start$B();
1931
1951
  start$t();
1932
- start$A();
1933
1952
  start$s();
1934
- start$r();
1935
1953
  }
1936
1954
  function stop$n() {
1937
1955
  stop$g();
1956
+ stop$y();
1938
1957
  stop$x();
1958
+ stop$v();
1939
1959
  stop$w();
1940
1960
  stop$u();
1941
- stop$v();
1942
- stop$t();
1961
+ stop$p();
1943
1962
  stop$o();
1963
+ stop$t();
1944
1964
  stop$s();
1965
+ stop$z();
1945
1966
  stop$r();
1946
- stop$y();
1947
1967
  stop$q();
1948
- stop$p();
1949
1968
  }
1950
1969
  function observe$4(root) {
1951
1970
  observe$7(root);
@@ -3940,7 +3959,7 @@ function metadata$2(node, event, text) {
3940
3959
  function encode$4 (type, ts) {
3941
3960
  if (ts === void 0) { ts = null; }
3942
3961
  return __awaiter(this, void 0, void 0, function () {
3943
- var t, tokens, _i, _a, entry, pTarget, _b, _c, entry, cTarget, cHash, _d, _e, entry, target, r, u, _f, _g, entry, iTarget, s, startTarget, endTarget, _h, _j, entry, sTarget, top_1, bottom, sTopHash, sBottomHash, _k, _l, entry, target, _m, _o, entry, target, _p, _q, entry, v;
3962
+ var t, tokens, _i, _a, entry, pTarget, _b, _c, entry, cTarget, cHash, _d, _e, entry, target, r, u, _f, _g, entry, iTarget, s, startTarget, endTarget, _h, _j, entry, sTarget, top_1, bottom, sTopHash, sBottomHash, _k, _l, entry, target, _m, _o, entry, target, _p, _q, entry, v, f;
3944
3963
  return __generator(this, function (_r) {
3945
3964
  t = ts || time();
3946
3965
  tokens = [t, type];
@@ -3974,7 +3993,7 @@ function encode$4 (type, ts) {
3974
3993
  }
3975
3994
  }
3976
3995
  }
3977
- reset$i();
3996
+ reset$j();
3978
3997
  break;
3979
3998
  case 9 /* Event.Click */:
3980
3999
  case 48 /* Event.ContextMenu */:
@@ -3999,7 +4018,7 @@ function encode$4 (type, ts) {
3999
4018
  queue(tokens);
4000
4019
  track$2(entry.time, entry.event, cHash, entry.data.x, entry.data.y, entry.data.reaction, entry.data.context);
4001
4020
  }
4002
- reset$l();
4021
+ reset$m();
4003
4022
  break;
4004
4023
  case 38 /* Event.Clipboard */:
4005
4024
  for (_d = 0, _e = state$8; _d < _e.length; _d++) {
@@ -4012,21 +4031,21 @@ function encode$4 (type, ts) {
4012
4031
  queue(tokens);
4013
4032
  }
4014
4033
  }
4015
- reset$k();
4034
+ reset$l();
4016
4035
  break;
4017
4036
  case 11 /* Event.Resize */:
4018
- r = data$c;
4037
+ r = data$d;
4019
4038
  tokens.push(r.width);
4020
4039
  tokens.push(r.height);
4021
4040
  track$8(type, r.width, r.height);
4022
- reset$h();
4041
+ reset$i();
4023
4042
  queue(tokens);
4024
4043
  break;
4025
4044
  case 26 /* Event.Unload */:
4026
- u = data$a;
4045
+ u = data$b;
4027
4046
  tokens.push(u.name);
4028
4047
  tokens.push(u.persisted);
4029
- reset$d();
4048
+ reset$e();
4030
4049
  queue(tokens);
4031
4050
  break;
4032
4051
  case 27 /* Event.Input */:
@@ -4039,10 +4058,10 @@ function encode$4 (type, ts) {
4039
4058
  tokens.push(entry.data.trust);
4040
4059
  queue(tokens);
4041
4060
  }
4042
- reset$j();
4061
+ reset$k();
4043
4062
  break;
4044
4063
  case 21 /* Event.Selection */:
4045
- s = data$b;
4064
+ s = data$c;
4046
4065
  if (s) {
4047
4066
  startTarget = metadata$2(s.start, type);
4048
4067
  endTarget = metadata$2(s.end, type);
@@ -4050,7 +4069,7 @@ function encode$4 (type, ts) {
4050
4069
  tokens.push(s.startOffset);
4051
4070
  tokens.push(endTarget.id);
4052
4071
  tokens.push(s.endOffset);
4053
- reset$f();
4072
+ reset$g();
4054
4073
  queue(tokens);
4055
4074
  }
4056
4075
  break;
@@ -4073,7 +4092,7 @@ function encode$4 (type, ts) {
4073
4092
  track$8(entry.event, entry.data.x, entry.data.y, entry.time);
4074
4093
  }
4075
4094
  }
4076
- reset$g();
4095
+ reset$h();
4077
4096
  break;
4078
4097
  case 42 /* Event.Change */:
4079
4098
  for (_k = 0, _l = state$a; _k < _l.length; _k++) {
@@ -4089,7 +4108,7 @@ function encode$4 (type, ts) {
4089
4108
  queue(tokens);
4090
4109
  }
4091
4110
  }
4092
- reset$m();
4111
+ reset$n();
4093
4112
  break;
4094
4113
  case 39 /* Event.Submit */:
4095
4114
  for (_m = 0, _o = state$4; _m < _o.length; _m++) {
@@ -4101,7 +4120,7 @@ function encode$4 (type, ts) {
4101
4120
  queue(tokens);
4102
4121
  }
4103
4122
  }
4104
- reset$e();
4123
+ reset$f();
4105
4124
  break;
4106
4125
  case 22 /* Event.Timeline */:
4107
4126
  for (_p = 0, _q = updates$1; _p < _q.length; _p++) {
@@ -4118,12 +4137,19 @@ function encode$4 (type, ts) {
4118
4137
  reset$5();
4119
4138
  break;
4120
4139
  case 28 /* Event.Visibility */:
4121
- v = data$9;
4140
+ v = data$a;
4122
4141
  tokens.push(v.visible);
4123
4142
  queue(tokens);
4124
4143
  visibility(t, v.visible);
4144
+ reset$d();
4145
+ break;
4146
+ case 49 /* Event.Focus */: {
4147
+ f = data$9;
4148
+ tokens.push(f.focused);
4149
+ queue(tokens, false);
4125
4150
  reset$c();
4126
4151
  break;
4152
+ }
4127
4153
  }
4128
4154
  return [2 /*return*/];
4129
4155
  });
@@ -4436,7 +4462,7 @@ function queue(tokens, transmit) {
4436
4462
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
4437
4463
  if (transmit && timeout === null) {
4438
4464
  if (type !== 25 /* Event.Ping */) {
4439
- reset$q();
4465
+ reset$r();
4440
4466
  }
4441
4467
  timeout = setTimeout$1(upload, gap);
4442
4468
  queuedTime = now;
@@ -4475,7 +4501,7 @@ function upload(final) {
4475
4501
  // Otherwise you run a risk of infinite loop.
4476
4502
  compute$5();
4477
4503
  compute$4();
4478
- compute$9();
4504
+ compute$a();
4479
4505
  compute$7();
4480
4506
  last = final === true;
4481
4507
  // In some cases envelope has null data because it's part of the shutdown process while there's one upload call queued which might introduce runtime error
@@ -4484,6 +4510,10 @@ function upload(final) {
4484
4510
  e = JSON.stringify(envelope(last));
4485
4511
  a = "[".concat(analysis.join(), "]");
4486
4512
  p = sendPlaybackBytes ? "[".concat(playback.join(), "]") : "" /* Constant.Empty */;
4513
+ // For final (beacon) payloads, If size is too large, we need to remove playback data
4514
+ if (last && p.length > 0 && (e.length + a.length + p.length > 65536 /* Setting.MaxBeaconPayloadBytes */)) {
4515
+ p = "" /* Constant.Empty */;
4516
+ }
4487
4517
  encoded = { e: e, a: a, p: p };
4488
4518
  payload = stringify(encoded);
4489
4519
  if (!last) return [3 /*break*/, 1];
@@ -4739,10 +4769,10 @@ function encode$2 (type) {
4739
4769
  }
4740
4770
  break;
4741
4771
  case 41 /* Event.Fraud */:
4742
- if (data$d) {
4743
- tokens.push(data$d.id);
4744
- tokens.push(data$d.target);
4745
- tokens.push(data$d.checksum);
4772
+ if (data$e) {
4773
+ tokens.push(data$e.id);
4774
+ tokens.push(data$e.target);
4775
+ tokens.push(data$e.checksum);
4746
4776
  queue(tokens, false);
4747
4777
  }
4748
4778
  break;
@@ -4983,7 +5013,7 @@ function start$c() {
4983
5013
  schedule(discover, 1 /* Priority.High */).then(function () {
4984
5014
  measure(compute$6)();
4985
5015
  measure(compute$5)();
4986
- measure(compute$8)();
5016
+ measure(compute$9)();
4987
5017
  });
4988
5018
  }
4989
5019
  function discover() {
@@ -5077,11 +5107,11 @@ function encode$1 (event) {
5077
5107
  tokens.push(b.data.pointerPrevTime);
5078
5108
  queue(tokens, false);
5079
5109
  }
5080
- reset$s();
5110
+ reset$t();
5081
5111
  break;
5082
5112
  }
5083
5113
  case 25 /* Event.Ping */:
5084
- tokens.push(data$h.gap);
5114
+ tokens.push(data$i.gap);
5085
5115
  queue(tokens);
5086
5116
  break;
5087
5117
  case 35 /* Event.Limit */:
@@ -5100,19 +5130,19 @@ function encode$1 (event) {
5100
5130
  break;
5101
5131
  case 24 /* Event.Custom */:
5102
5132
  // not all custom events have a key - if it wasn't passed server handles just value
5103
- data$j.key && tokens.push(data$j.key);
5104
- tokens.push(data$j.value);
5133
+ data$k.key && tokens.push(data$k.key);
5134
+ tokens.push(data$k.value);
5105
5135
  queue(tokens);
5106
5136
  break;
5107
5137
  case 34 /* Event.Variable */: {
5108
- var variableKeys = Object.keys(data$f);
5138
+ var variableKeys = Object.keys(data$g);
5109
5139
  if (variableKeys.length > 0) {
5110
5140
  for (var _i = 0, variableKeys_1 = variableKeys; _i < variableKeys_1.length; _i++) {
5111
5141
  var v = variableKeys_1[_i];
5112
5142
  tokens.push(v);
5113
- tokens.push(data$f[v]);
5143
+ tokens.push(data$g[v]);
5114
5144
  }
5115
- reset$o();
5145
+ reset$p();
5116
5146
  queue(tokens, false);
5117
5147
  }
5118
5148
  break;
@@ -5128,7 +5158,7 @@ function encode$1 (event) {
5128
5158
  // However, for data over the wire, we round it off to milliseconds precision.
5129
5159
  tokens.push(Math.round(updates$3[m]));
5130
5160
  }
5131
- reset$r();
5161
+ reset$s();
5132
5162
  queue(tokens, false);
5133
5163
  }
5134
5164
  break;
@@ -5148,15 +5178,15 @@ function encode$1 (event) {
5148
5178
  break;
5149
5179
  }
5150
5180
  case 36 /* Event.Summary */: {
5151
- var eventKeys = Object.keys(data$g);
5181
+ var eventKeys = Object.keys(data$h);
5152
5182
  if (eventKeys.length > 0) {
5153
5183
  for (var _c = 0, eventKeys_1 = eventKeys; _c < eventKeys_1.length; _c++) {
5154
5184
  var e = eventKeys_1[_c];
5155
5185
  var key = parseInt(e, 10);
5156
5186
  tokens.push(key);
5157
- tokens.push([].concat.apply([], data$g[e]));
5187
+ tokens.push([].concat.apply([], data$h[e]));
5158
5188
  }
5159
- reset$p();
5189
+ reset$q();
5160
5190
  queue(tokens, false);
5161
5191
  }
5162
5192
  break;
@@ -5166,21 +5196,21 @@ function encode$1 (event) {
5166
5196
  extractKeys.forEach(function (e) {
5167
5197
  tokens.push(e);
5168
5198
  var token = [];
5169
- for (var d in data$e[e]) {
5199
+ for (var d in data$f[e]) {
5170
5200
  var key = parseInt(d, 10);
5171
5201
  token.push(key);
5172
- token.push(data$e[e][d]);
5202
+ token.push(data$f[e][d]);
5173
5203
  }
5174
5204
  tokens.push(token);
5175
5205
  });
5176
- reset$n();
5206
+ reset$o();
5177
5207
  queue(tokens, false);
5178
5208
  break;
5179
5209
  }
5180
5210
  case 47 /* Event.Consent */:
5181
- tokens.push(data$k.source);
5182
- tokens.push(data$k.ad_Storage);
5183
- tokens.push(data$k.analytics_Storage);
5211
+ tokens.push(data$l.source);
5212
+ tokens.push(data$l.ad_Storage);
5213
+ tokens.push(data$l.analytics_Storage);
5184
5214
  queue(tokens, false);
5185
5215
  break;
5186
5216
  }
@@ -5731,6 +5761,7 @@ function measure (method) {
5731
5761
  if (duration > 30 /* Setting.LongTask */) {
5732
5762
  count$1(7 /* Metric.LongTaskCount */);
5733
5763
  max(6 /* Metric.ThreadBlockedTime */, duration);
5764
+ method.dn && log$1(9 /* Code.FunctionExecutionTime */, 0 /* Severity.Info */, "".concat(method.dn, "-").concat(duration));
5734
5765
  }
5735
5766
  };
5736
5767
  }
@@ -5841,7 +5872,7 @@ function stop$6() {
5841
5872
  var status = false;
5842
5873
  function start$5() {
5843
5874
  status = true;
5844
- start$K();
5875
+ start$L();
5845
5876
  reset$4();
5846
5877
  reset$1();
5847
5878
  reset$2();
@@ -5852,7 +5883,7 @@ function stop$5() {
5852
5883
  reset$2();
5853
5884
  reset$1();
5854
5885
  reset$4();
5855
- stop$H();
5886
+ stop$I();
5856
5887
  status = false;
5857
5888
  }
5858
5889
  function active() {
@@ -5908,7 +5939,7 @@ function restart() {
5908
5939
  }
5909
5940
 
5910
5941
  function start$4() {
5911
- start$B();
5942
+ start$C();
5912
5943
  start$f();
5913
5944
  start$e();
5914
5945
  }
@@ -6248,7 +6279,7 @@ function start(config$1) {
6248
6279
  if (check()) {
6249
6280
  config(config$1);
6250
6281
  start$5();
6251
- start$C();
6282
+ start$D();
6252
6283
  modules.forEach(function (x) { return measure(x.start)(); });
6253
6284
  // If it's an internal call to start, without explicit configuration,
6254
6285
  // re-process any newly accumulated items in the queue
@@ -6279,7 +6310,7 @@ function stop() {
6279
6310
  if (active()) {
6280
6311
  // Stop modules in the reverse order of their initialization and start queuing up items again
6281
6312
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
6282
- stop$z();
6313
+ stop$A();
6283
6314
  stop$5();
6284
6315
  setup();
6285
6316
  }