clarity-js 0.6.35 → 0.6.38

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
@@ -79,7 +79,7 @@ var envelope$1 = /*#__PURE__*/Object.freeze({
79
79
 
80
80
  var config$1 = {
81
81
  projectId: null,
82
- delay: 1 * 1000 /* Second */,
82
+ delay: 1 * 1000 /* Time.Second */,
83
83
  lean: false,
84
84
  track: true,
85
85
  content: true,
@@ -99,7 +99,7 @@ function api(method) {
99
99
  // Zone.js, a popular package for Angular, overrides native browser APIs which can lead to inconsistent state for single page applications.
100
100
  // Example issue: https://github.com/angular/angular/issues/31712
101
101
  // As a work around, we ensuring Clarity access APIs outside of Zone (and use native implementation instead)
102
- return window["Zone" /* Zone */] && "__symbol__" /* Symbol */ in window["Zone" /* Zone */] ? window["Zone" /* Zone */]["__symbol__" /* Symbol */](method) : method;
102
+ return window["Zone" /* Constant.Zone */] && "__symbol__" /* Constant.Symbol */ in window["Zone" /* Constant.Zone */] ? window["Zone" /* Constant.Zone */]["__symbol__" /* Constant.Symbol */](method) : method;
103
103
  }
104
104
 
105
105
  var startTime = 0;
@@ -115,7 +115,7 @@ function stop$B() {
115
115
  startTime = 0;
116
116
  }
117
117
 
118
- var version$1 = "0.6.35";
118
+ var version$1 = "0.6.38";
119
119
 
120
120
  // tslint:disable: no-bitwise
121
121
  function hash (input) {
@@ -148,7 +148,7 @@ function reset$o() {
148
148
  // Baseline state holds the previous values - if it is updated in the current payload,
149
149
  // reset the state to current value after sending the previous state
150
150
  if (update$2) {
151
- state$9 = { time: time(), event: 4 /* Baseline */, data: {
151
+ state$9 = { time: time(), event: 4 /* Event.Baseline */, data: {
152
152
  visible: buffer.visible,
153
153
  docWidth: buffer.docWidth,
154
154
  docHeight: buffer.docHeight,
@@ -163,7 +163,7 @@ function reset$o() {
163
163
  };
164
164
  }
165
165
  buffer = buffer ? buffer : {
166
- visible: 1 /* True */,
166
+ visible: 1 /* BooleanFlag.True */,
167
167
  docWidth: 0,
168
168
  docHeight: 0,
169
169
  screenWidth: 0,
@@ -177,15 +177,15 @@ function reset$o() {
177
177
  }
178
178
  function track$7(event, x, y) {
179
179
  switch (event) {
180
- case 8 /* Document */:
180
+ case 8 /* Event.Document */:
181
181
  buffer.docWidth = x;
182
182
  buffer.docHeight = y;
183
183
  break;
184
- case 11 /* Resize */:
184
+ case 11 /* Event.Resize */:
185
185
  buffer.screenWidth = x;
186
186
  buffer.screenHeight = y;
187
187
  break;
188
- case 10 /* Scroll */:
188
+ case 10 /* Event.Scroll */:
189
189
  buffer.scrollX = x;
190
190
  buffer.scrollY = y;
191
191
  break;
@@ -200,7 +200,7 @@ function activity(t) {
200
200
  buffer.activityTime = t;
201
201
  }
202
202
  function visibility(t, visible) {
203
- buffer.visible = visible === "visible" ? 1 /* True */ : 0 /* False */;
203
+ buffer.visible = visible === "visible" ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
204
204
  if (!buffer.visible) {
205
205
  activity(t);
206
206
  }
@@ -208,7 +208,7 @@ function visibility(t, visible) {
208
208
  }
209
209
  function compute$c() {
210
210
  if (update$2) {
211
- encode$1(4 /* Baseline */);
211
+ encode$1(4 /* Event.Baseline */);
212
212
  }
213
213
  }
214
214
  function stop$A() {
@@ -232,12 +232,12 @@ function event(key, value) {
232
232
  if (active() &&
233
233
  key &&
234
234
  value &&
235
- typeof key === "string" /* String */ &&
236
- typeof value === "string" /* String */ &&
235
+ typeof key === "string" /* Constant.String */ &&
236
+ typeof value === "string" /* Constant.String */ &&
237
237
  key.length < 255 &&
238
238
  value.length < 255) {
239
239
  data$j = { key: key, value: value };
240
- encode$1(24 /* Custom */);
240
+ encode$1(24 /* Event.Custom */);
241
241
  }
242
242
  }
243
243
 
@@ -246,7 +246,7 @@ var updates$3 = null;
246
246
  function start$D() {
247
247
  data$i = {};
248
248
  updates$3 = {};
249
- count$1(5 /* InvokeCount */);
249
+ count$1(5 /* Metric.InvokeCount */);
250
250
  }
251
251
  function stop$z() {
252
252
  data$i = {};
@@ -287,7 +287,7 @@ function max(metric, value) {
287
287
  }
288
288
  }
289
289
  function compute$b() {
290
- encode$1(0 /* Metric */);
290
+ encode$1(0 /* Event.Metric */);
291
291
  }
292
292
  function reset$n() {
293
293
  updates$3 = {};
@@ -305,7 +305,7 @@ var last = 0;
305
305
  var interval = 0;
306
306
  var timeout$6 = null;
307
307
  function start$C() {
308
- interval = 60000 /* PingInterval */;
308
+ interval = 60000 /* Setting.PingInterval */;
309
309
  last = 0;
310
310
  }
311
311
  function reset$m() {
@@ -318,8 +318,8 @@ function reset$m() {
318
318
  function ping() {
319
319
  var now = time();
320
320
  data$h = { gap: now - last };
321
- encode$1(25 /* Ping */);
322
- if (data$h.gap < 300000 /* PingTimeout */) {
321
+ encode$1(25 /* Event.Ping */);
322
+ if (data$h.gap < 300000 /* Setting.PingTimeout */) {
323
323
  timeout$6 = setTimeout(ping, interval);
324
324
  }
325
325
  else {
@@ -356,7 +356,7 @@ function track$6(event, time) {
356
356
  var last = e[e.length - 1];
357
357
  // Add a new entry only if the new event occurs after configured interval
358
358
  // Otherwise, extend the duration of the previous entry
359
- if (time - last[0] > 100 /* SummaryInterval */) {
359
+ if (time - last[0] > 100 /* Setting.SummaryInterval */) {
360
360
  data$g[event].push([time, 0]);
361
361
  }
362
362
  else {
@@ -365,7 +365,7 @@ function track$6(event, time) {
365
365
  }
366
366
  }
367
367
  function compute$a() {
368
- encode$1(36 /* Summary */);
368
+ encode$1(36 /* Event.Summary */);
369
369
  }
370
370
  function reset$l() {
371
371
  data$g = {};
@@ -384,7 +384,7 @@ var summary = /*#__PURE__*/Object.freeze({
384
384
  var data$f = null;
385
385
  function start$A() {
386
386
  if (!config$1.lean && config$1.upgrade) {
387
- config$1.upgrade("Config" /* Config */);
387
+ config$1.upgrade("Config" /* Constant.Config */);
388
388
  }
389
389
  data$f = null;
390
390
  }
@@ -403,7 +403,7 @@ function upgrade(key) {
403
403
  if (config$1.upgrade) {
404
404
  config$1.upgrade(key);
405
405
  }
406
- encode$1(3 /* Upgrade */);
406
+ encode$1(3 /* Event.Upgrade */);
407
407
  }
408
408
  }
409
409
  function stop$w() {
@@ -423,25 +423,25 @@ function start$z() {
423
423
  reset$k();
424
424
  }
425
425
  function set(variable, value) {
426
- var values = typeof value === "string" /* String */ ? [value] : value;
426
+ var values = typeof value === "string" /* Constant.String */ ? [value] : value;
427
427
  log$2(variable, values);
428
428
  }
429
429
  function identify(userId, sessionId, pageId) {
430
430
  if (sessionId === void 0) { sessionId = null; }
431
431
  if (pageId === void 0) { pageId = null; }
432
- log$2("userId" /* UserId */, [userId]);
433
- log$2("sessionId" /* SessionId */, [sessionId]);
434
- log$2("pageId" /* PageId */, [pageId]);
432
+ log$2("userId" /* Constant.UserId */, [userId]);
433
+ log$2("sessionId" /* Constant.SessionId */, [sessionId]);
434
+ log$2("pageId" /* Constant.PageId */, [pageId]);
435
435
  }
436
436
  function log$2(variable, value) {
437
437
  if (active() &&
438
438
  variable &&
439
439
  value &&
440
- typeof variable === "string" /* String */ &&
440
+ typeof variable === "string" /* Constant.String */ &&
441
441
  variable.length < 255) {
442
442
  var validValues = variable in data$e ? data$e[variable] : [];
443
443
  for (var i = 0; i < value.length; i++) {
444
- if (typeof value[i] === "string" /* String */ && value[i].length < 255) {
444
+ if (typeof value[i] === "string" /* Constant.String */ && value[i].length < 255) {
445
445
  validValues.push(value[i]);
446
446
  }
447
447
  }
@@ -449,7 +449,7 @@ function log$2(variable, value) {
449
449
  }
450
450
  }
451
451
  function compute$9() {
452
- encode$1(34 /* Variable */);
452
+ encode$1(34 /* Event.Variable */);
453
453
  }
454
454
  function reset$k() {
455
455
  data$e = {};
@@ -469,7 +469,7 @@ var variable = /*#__PURE__*/Object.freeze({
469
469
  stop: stop$v
470
470
  });
471
471
 
472
- /*! *****************************************************************************
472
+ /******************************************************************************
473
473
  Copyright (c) Microsoft Corporation.
474
474
 
475
475
  Permission to use, copy, modify, and/or distribute this software for any
@@ -522,7 +522,7 @@ function __generator(thisArg, body) {
522
522
  }
523
523
  }
524
524
 
525
- var supported$1 = "CompressionStream" /* CompressionStream */ in window;
525
+ var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
526
526
  function compress (input) {
527
527
  return __awaiter(this, void 0, void 0, function () {
528
528
  var stream, _a;
@@ -539,7 +539,7 @@ function compress (input) {
539
539
  return [2 /*return*/];
540
540
  });
541
541
  });
542
- } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* CompressionStream */]("gzip"));
542
+ } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* Constant.CompressionStream */]("gzip"));
543
543
  _a = Uint8Array.bind;
544
544
  return [4 /*yield*/, read(stream)];
545
545
  case 1: return [2 /*return*/, new (_a.apply(Uint8Array, [void 0, _c.sent()]))()];
@@ -604,32 +604,38 @@ function compute$8() {
604
604
  compute$4();
605
605
  }
606
606
 
607
+ // Regular expressions using unicode property escapes
608
+ // Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes
609
+ var digitRegex = /\p{N}/gu;
610
+ var letterRegex = /\p{L}/gu;
611
+ var currencyRegex = /\p{Sc}/u;
612
+ var catchallRegex = /\S/gi;
607
613
  function scrub (value, hint, privacy, mangle) {
608
614
  if (mangle === void 0) { mangle = false; }
609
615
  if (value) {
610
616
  switch (privacy) {
611
- case 0 /* None */:
617
+ case 0 /* Privacy.None */:
612
618
  return value;
613
- case 1 /* Sensitive */:
619
+ case 1 /* Privacy.Sensitive */:
614
620
  switch (hint) {
615
- case "*T" /* TextTag */:
621
+ case "*T" /* Layout.Constant.TextTag */:
616
622
  case "value":
617
623
  case "placeholder":
618
- return redact(value);
624
+ case "click":
619
625
  case "input":
620
- return mangleToken(value);
626
+ return redact(value);
621
627
  }
622
628
  return value;
623
- case 2 /* Text */:
624
- case 3 /* TextImage */:
629
+ case 2 /* Privacy.Text */:
630
+ case 3 /* Privacy.TextImage */:
625
631
  switch (hint) {
626
- case "*T" /* TextTag */:
632
+ case "*T" /* Layout.Constant.TextTag */:
627
633
  return mangle ? mangleText(value) : mask(value);
628
634
  case "src":
629
635
  case "srcset":
630
636
  case "title":
631
637
  case "alt":
632
- return privacy === 3 /* TextImage */ ? "" /* Empty */ : value;
638
+ return privacy === 3 /* Privacy.TextImage */ ? "" /* Data.Constant.Empty */ : value;
633
639
  case "value":
634
640
  case "click":
635
641
  case "input":
@@ -654,35 +660,48 @@ function mangleText(value) {
654
660
  return value;
655
661
  }
656
662
  function mask(value) {
657
- return value.replace(/\S/gi, "\u2022" /* Mask */);
663
+ return value.replace(catchallRegex, "\u2022" /* Data.Constant.Mask */);
658
664
  }
659
665
  function mangleToken(value) {
660
- var length = ((Math.floor(value.length / 5 /* WordLength */) + 1) * 5 /* WordLength */);
661
- var output = "" /* Empty */;
666
+ var length = ((Math.floor(value.length / 5 /* Data.Setting.WordLength */) + 1) * 5 /* Data.Setting.WordLength */);
667
+ var output = "" /* Layout.Constant.Empty */;
662
668
  for (var i = 0; i < length; i++) {
663
- output += i > 0 && i % 5 /* WordLength */ === 0 ? " " /* Space */ : "\u2022" /* Mask */;
669
+ output += i > 0 && i % 5 /* Data.Setting.WordLength */ === 0 ? " " /* Data.Constant.Space */ : "\u2022" /* Data.Constant.Mask */;
664
670
  }
665
671
  return output;
666
672
  }
667
673
  function redact(value) {
668
674
  var spaceIndex = -1;
675
+ var gap = 0;
669
676
  var hasDigit = false;
670
677
  var hasEmail = false;
671
678
  var hasWhitespace = false;
672
679
  var array = null;
673
680
  for (var i = 0; i < value.length; i++) {
674
681
  var c = value.charCodeAt(i);
675
- hasDigit = hasDigit || (c >= 48 /* Zero */ && c <= 57 /* Nine */); // Check for digits in the current word
676
- hasEmail = hasEmail || c === 64 /* At */; // Check for @ sign anywhere within the current word
677
- hasWhitespace = c === 9 /* Tab */ || c === 10 /* NewLine */ || c === 13 /* Return */ || c === 32 /* Blank */;
682
+ hasDigit = hasDigit || (c >= 48 /* Data.Character.Zero */ && c <= 57 /* Data.Character.Nine */); // Check for digits in the current word
683
+ hasEmail = hasEmail || c === 64 /* Data.Character.At */; // Check for @ sign anywhere within the current word
684
+ hasWhitespace = c === 9 /* Data.Character.Tab */ || c === 10 /* Data.Character.NewLine */ || c === 13 /* Data.Character.Return */ || c === 32 /* Data.Character.Blank */;
678
685
  // Process each word as an individual token to redact any sensitive information
679
686
  if (i === 0 || i === value.length - 1 || hasWhitespace) {
680
687
  // Performance optimization: Lazy load string -> array conversion only when required
681
688
  if (hasDigit || hasEmail) {
682
689
  if (array === null) {
683
- array = value.split("" /* Empty */);
690
+ array = value.split("" /* Data.Constant.Empty */);
691
+ }
692
+ // Work on a token at a time so we don't have to apply regex to a larger string
693
+ var token = value.substring(spaceIndex + 1, hasWhitespace ? i : i + 1);
694
+ // Check if unicode regex is supported, otherwise fallback to calling mask function on this token
695
+ if (currencyRegex.unicode) {
696
+ // Do not redact information if the token contains a currency symbol
697
+ token = token.match(currencyRegex) ? token : token.replace(letterRegex, "\u2022" /* Data.Constant.Letter */).replace(digitRegex, "\u2022" /* Data.Constant.Digit */);
698
+ }
699
+ else {
700
+ token = mask(token);
684
701
  }
685
- mutate(array, spaceIndex, hasWhitespace ? i : i + 1);
702
+ // Merge token back into array at the right place
703
+ array.splice(spaceIndex + 1 - gap, token.length, token);
704
+ gap += token.length - 1;
686
705
  }
687
706
  // Reset digit and email flags after every word boundary, except the beginning of string
688
707
  if (hasWhitespace) {
@@ -692,28 +711,23 @@ function redact(value) {
692
711
  }
693
712
  }
694
713
  }
695
- return array ? array.join("" /* Empty */) : value;
696
- }
697
- function mutate(array, start, end) {
698
- for (var i = start + 1; i < end; i++) {
699
- array[i] = "\u2022" /* Mask */;
700
- }
714
+ return array ? array.join("" /* Data.Constant.Empty */) : value;
701
715
  }
702
716
 
703
717
  var history$5 = [];
704
718
  var data$d;
705
719
  function start$x() {
706
720
  history$5 = [];
707
- max(26 /* Automation */, navigator.webdriver ? 1 /* True */ : 0 /* False */);
721
+ max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
708
722
  }
709
723
  function check$4(id, target, input) {
710
724
  // Compute hash for fraud detection. Hash is computed only if input meets the minimum length criteria
711
- if (id !== null && input && input.length >= 5 /* WordLength */) {
725
+ if (id !== null && input && input.length >= 5 /* Setting.WordLength */) {
712
726
  data$d = { id: id, target: target, hash: hash(input) };
713
727
  // Only encode this event if we haven't already reported this hash
714
728
  if (history$5.indexOf(data$d.hash) < 0) {
715
729
  history$5.push(data$d.hash);
716
- encode$2(41 /* Fraud */);
730
+ encode$2(41 /* Event.Fraud */);
717
731
  }
718
732
  }
719
733
  }
@@ -722,32 +736,32 @@ var TAGS = ["DIV", "TR", "P", "LI", "UL", "A", "BUTTON"];
722
736
  function selector (input, beta) {
723
737
  if (beta === void 0) { beta = false; }
724
738
  var a = input.attributes;
725
- var prefix = input.prefix ? input.prefix[beta ? 1 /* Beta */ : 0 /* Stable */] : null;
726
- var suffix = beta || ((a && !("class" /* Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(".concat(input.position, ")") : "" /* Empty */;
739
+ var prefix = input.prefix ? input.prefix[beta ? 1 /* Selector.Beta */ : 0 /* Selector.Stable */] : null;
740
+ var suffix = beta || ((a && !("class" /* Constant.Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(".concat(input.position, ")") : "" /* Constant.Empty */;
727
741
  switch (input.tag) {
728
742
  case "STYLE":
729
743
  case "TITLE":
730
744
  case "LINK":
731
745
  case "META":
732
- case "*T" /* TextTag */:
733
- case "*D" /* DocumentTag */:
734
- return "" /* Empty */;
746
+ case "*T" /* Constant.TextTag */:
747
+ case "*D" /* Constant.DocumentTag */:
748
+ return "" /* Constant.Empty */;
735
749
  case "HTML":
736
- return "HTML" /* HTML */;
750
+ return "HTML" /* Constant.HTML */;
737
751
  default:
738
752
  if (prefix === null) {
739
- return "" /* Empty */;
753
+ return "" /* Constant.Empty */;
740
754
  }
741
755
  prefix = "".concat(prefix, ">");
742
- input.tag = input.tag.indexOf("svg:" /* SvgPrefix */) === 0 ? input.tag.substr("svg:" /* SvgPrefix */.length) : input.tag;
756
+ input.tag = input.tag.indexOf("svg:" /* Constant.SvgPrefix */) === 0 ? input.tag.substr("svg:" /* Constant.SvgPrefix */.length) : input.tag;
743
757
  var selector = "".concat(prefix).concat(input.tag).concat(suffix);
744
- var classes = "class" /* Class */ in a && a["class" /* Class */].length > 0 ? a["class" /* Class */].trim().split(/\s+/) : null;
758
+ var classes = "class" /* Constant.Class */ in a && a["class" /* Constant.Class */].length > 0 ? a["class" /* Constant.Class */].trim().split(/\s+/) : null;
745
759
  if (beta) {
746
760
  // In beta mode, update selector to use "id" field when available. There are two exceptions:
747
761
  // (1) if "id" appears to be an auto generated string token, e.g. guid or a random id containing digits
748
762
  // (2) if "id" appears inside a shadow DOM, in which case we continue to prefix up to shadow DOM to prevent conflicts
749
- var id = "id" /* Id */ in a && a["id" /* Id */].length > 0 ? a["id" /* Id */] : null;
750
- classes = input.tag !== "BODY" /* BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
763
+ var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
764
+ classes = input.tag !== "BODY" /* Constant.BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
751
765
  selector = classes.length > 0 ? "".concat(prefix).concat(input.tag, ".").concat(classes.join(".")).concat(suffix) : selector;
752
766
  selector = id && hasDigits(id) === false ? "".concat(getDomPrefix(prefix), "#").concat(id) : selector;
753
767
  }
@@ -759,8 +773,8 @@ function selector (input, beta) {
759
773
  }
760
774
  }
761
775
  function getDomPrefix(prefix) {
762
- var shadowDomStart = prefix.lastIndexOf("*S" /* ShadowDomTag */);
763
- var iframeDomStart = prefix.lastIndexOf("".concat("iframe:" /* IFramePrefix */).concat("HTML" /* HTML */));
776
+ var shadowDomStart = prefix.lastIndexOf("*S" /* Constant.ShadowDomTag */);
777
+ var iframeDomStart = prefix.lastIndexOf("".concat("iframe:" /* Constant.IFramePrefix */).concat("HTML" /* Constant.HTML */));
764
778
  var domStart = Math.max(shadowDomStart, iframeDomStart);
765
779
  if (domStart < 0) {
766
780
  return "";
@@ -772,7 +786,7 @@ function getDomPrefix(prefix) {
772
786
  function hasDigits(value) {
773
787
  for (var i = 0; i < value.length; i++) {
774
788
  var c = value.charCodeAt(i);
775
- if (c >= 48 /* Zero */ && c <= 57 /* Nine */) {
789
+ if (c >= 48 /* Character.Zero */ && c <= 57 /* Character.Nine */) {
776
790
  return true;
777
791
  }
778
792
  }
@@ -809,7 +823,7 @@ function reset$j() {
809
823
  pauseTask = null;
810
824
  }
811
825
  function schedule$1(task, priority) {
812
- if (priority === void 0) { priority = 0 /* Normal */; }
826
+ if (priority === void 0) { priority = 0 /* Priority.Normal */; }
813
827
  return __awaiter(this, void 0, void 0, function () {
814
828
  var _i, queuedTasks_1, q, promise;
815
829
  return __generator(this, function (_a) {
@@ -821,7 +835,7 @@ function schedule$1(task, priority) {
821
835
  }
822
836
  }
823
837
  promise = new Promise(function (resolve) {
824
- var insert = priority === 1 /* High */ ? "unshift" : "push";
838
+ var insert = priority === 1 /* Priority.High */ ? "unshift" : "push";
825
839
  // Queue this task for asynchronous execution later
826
840
  // We also store a unique page identifier (id) along with the task to ensure
827
841
  // ensure that we do not accidentally execute this task in context of a different page
@@ -856,7 +870,7 @@ function run() {
856
870
  return;
857
871
  }
858
872
  if (error) {
859
- log$1(0 /* RunTask */, 1 /* Warning */, error.name, error.message, error.stack);
873
+ log$1(0 /* Code.RunTask */, 1 /* Severity.Warning */, error.name, error.message, error.stack);
860
874
  }
861
875
  activeTask = null;
862
876
  run();
@@ -867,13 +881,13 @@ function state$8(timer) {
867
881
  var id = key(timer);
868
882
  if (id in tracker) {
869
883
  var elapsed = performance.now() - tracker[id].start;
870
- return (elapsed > tracker[id].yield) ? 0 /* Wait */ : 1 /* Run */;
884
+ return (elapsed > tracker[id].yield) ? 0 /* Task.Wait */ : 1 /* Task.Run */;
871
885
  }
872
886
  // If this task is no longer being tracked, send stop message to the caller
873
- return 2 /* Stop */;
887
+ return 2 /* Task.Stop */;
874
888
  }
875
889
  function start$w(timer) {
876
- tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* LongTask */ };
890
+ tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
877
891
  }
878
892
  function restart$2(timer) {
879
893
  var id = key(timer);
@@ -890,11 +904,11 @@ function stop$t(timer) {
890
904
  var id = key(timer);
891
905
  var duration = end - tracker[id].start;
892
906
  sum(timer.cost, duration);
893
- count$1(5 /* InvokeCount */);
907
+ count$1(5 /* Metric.InvokeCount */);
894
908
  // For the first execution, which is synchronous, time is automatically counted towards TotalDuration.
895
909
  // However, for subsequent asynchronous runs, we need to manually update TotalDuration metric.
896
910
  if (tracker[id].calls > 0) {
897
- sum(4 /* TotalCost */, duration);
911
+ sum(4 /* Metric.TotalCost */, duration);
898
912
  }
899
913
  }
900
914
  function suspend$1(timer) {
@@ -915,7 +929,7 @@ function suspend$1(timer) {
915
929
  case 2:
916
930
  // After we are done with suspending task, ensure that we are still operating in the right context
917
931
  // If the task is still being tracked, continue running the task, otherwise ask caller to stop execution
918
- return [2 /*return*/, id in tracker ? 1 /* Run */ : 2 /* Stop */];
932
+ return [2 /*return*/, id in tracker ? 1 /* Task.Run */ : 2 /* Task.Stop */];
919
933
  }
920
934
  });
921
935
  });
@@ -959,14 +973,14 @@ function requestIdleCallbackPolyfill(callback, options) {
959
973
  var currentTime = performance.now();
960
974
  var elapsed = currentTime - startTime;
961
975
  var duration = currentTime - event.data;
962
- if (duration > 30 /* LongTask */ && elapsed < options.timeout) {
976
+ if (duration > 30 /* Setting.LongTask */ && elapsed < options.timeout) {
963
977
  requestAnimationFrame(function () { outgoing.postMessage(currentTime); });
964
978
  }
965
979
  else {
966
980
  var didTimeout_1 = elapsed > options.timeout;
967
981
  callback({
968
982
  didTimeout: didTimeout_1,
969
- timeRemaining: function () { return didTimeout_1 ? 30 /* LongTask */ : Math.max(0, 30 /* LongTask */ - duration); }
983
+ timeRemaining: function () { return didTimeout_1 ? 30 /* Setting.LongTask */ : Math.max(0, 30 /* Setting.LongTask */ - duration); }
970
984
  });
971
985
  }
972
986
  };
@@ -987,7 +1001,7 @@ function tokenize (tokens) {
987
1001
  var reference = null;
988
1002
  for (var i = 0; i < tokens.length; i++) {
989
1003
  // Only optimize for string values
990
- if (typeof tokens[i] === "string" /* String */) {
1004
+ if (typeof tokens[i] === "string" /* Constant.String */) {
991
1005
  var token = tokens[i];
992
1006
  var index = lookup[token] || -1;
993
1007
  if (index >= 0) {
@@ -1029,10 +1043,10 @@ function encode$4 (type, timer, ts) {
1029
1043
  tokens = [eventTime, type];
1030
1044
  _a = type;
1031
1045
  switch (_a) {
1032
- case 8 /* Document */: return [3 /*break*/, 1];
1033
- case 7 /* Region */: return [3 /*break*/, 2];
1034
- case 5 /* Discover */: return [3 /*break*/, 3];
1035
- case 6 /* Mutation */: return [3 /*break*/, 3];
1046
+ case 8 /* Event.Document */: return [3 /*break*/, 1];
1047
+ case 7 /* Event.Region */: return [3 /*break*/, 2];
1048
+ case 5 /* Event.Discover */: return [3 /*break*/, 3];
1049
+ case 6 /* Event.Mutation */: return [3 /*break*/, 3];
1036
1050
  }
1037
1051
  return [3 /*break*/, 10];
1038
1052
  case 1:
@@ -1045,7 +1059,7 @@ function encode$4 (type, timer, ts) {
1045
1059
  case 2:
1046
1060
  for (_i = 0, _b = state$1; _i < _b.length; _i++) {
1047
1061
  r = _b[_i];
1048
- tokens = [r.time, 7 /* Region */];
1062
+ tokens = [r.time, 7 /* Event.Region */];
1049
1063
  tokens.push(r.data.id);
1050
1064
  tokens.push(r.data.interaction);
1051
1065
  tokens.push(r.data.visibility);
@@ -1056,7 +1070,7 @@ function encode$4 (type, timer, ts) {
1056
1070
  return [3 /*break*/, 10];
1057
1071
  case 3:
1058
1072
  // Check if we are operating within the context of the current page
1059
- if (state$8(timer) === 2 /* Stop */) {
1073
+ if (state$8(timer) === 2 /* Task.Stop */) {
1060
1074
  return [3 /*break*/, 10];
1061
1075
  }
1062
1076
  values = updates$2();
@@ -1067,13 +1081,13 @@ function encode$4 (type, timer, ts) {
1067
1081
  if (!(_c < values_1.length)) return [3 /*break*/, 8];
1068
1082
  value = values_1[_c];
1069
1083
  state = state$8(timer);
1070
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 6];
1084
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 6];
1071
1085
  return [4 /*yield*/, suspend$1(timer)];
1072
1086
  case 5:
1073
1087
  state = _e.sent();
1074
1088
  _e.label = 6;
1075
1089
  case 6:
1076
- if (state === 2 /* Stop */) {
1090
+ if (state === 2 /* Task.Stop */) {
1077
1091
  return [3 /*break*/, 8];
1078
1092
  }
1079
1093
  data = value.data;
@@ -1096,9 +1110,9 @@ function encode$4 (type, timer, ts) {
1096
1110
  if (value.previous && active) {
1097
1111
  tokens.push(value.previous);
1098
1112
  }
1099
- tokens.push(suspend ? "*M" /* SuspendMutationTag */ : data[key]);
1113
+ tokens.push(suspend ? "*M" /* Constant.SuspendMutationTag */ : data[key]);
1100
1114
  if (box && box.length === 2) {
1101
- tokens.push("".concat("#" /* Box */).concat(str$1(box[0]), ".").concat(str$1(box[1])));
1115
+ tokens.push("".concat("#" /* Constant.Box */).concat(str$1(box[0]), ".").concat(str$1(box[1])));
1102
1116
  }
1103
1117
  break;
1104
1118
  case "attributes":
@@ -1120,7 +1134,7 @@ function encode$4 (type, timer, ts) {
1120
1134
  _c++;
1121
1135
  return [3 /*break*/, 4];
1122
1136
  case 8:
1123
- if (type === 6 /* Mutation */) {
1137
+ if (type === 6 /* Event.Mutation */) {
1124
1138
  activity(eventTime);
1125
1139
  }
1126
1140
  queue(tokenize(tokens), !config$1.lean);
@@ -1133,13 +1147,13 @@ function encode$4 (type, timer, ts) {
1133
1147
  }
1134
1148
  function shouldMangle(value) {
1135
1149
  var privacy = value.metadata.privacy;
1136
- return value.data.tag === "*T" /* TextTag */ && !(privacy === 0 /* None */ || privacy === 1 /* Sensitive */);
1150
+ return value.data.tag === "*T" /* Constant.TextTag */ && !(privacy === 0 /* Privacy.None */ || privacy === 1 /* Privacy.Sensitive */);
1137
1151
  }
1138
1152
  function size$1(value) {
1139
1153
  if (value.metadata.size !== null && value.metadata.size.length === 0) {
1140
1154
  var img = getNode(value.id);
1141
1155
  if (img) {
1142
- return [Math.floor(img.offsetWidth * 100 /* BoxPrecision */), Math.floor(img.offsetHeight * 100 /* BoxPrecision */)];
1156
+ return [Math.floor(img.offsetWidth * 100 /* Setting.BoxPrecision */), Math.floor(img.offsetHeight * 100 /* Setting.BoxPrecision */)];
1143
1157
  }
1144
1158
  }
1145
1159
  return value.metadata.size;
@@ -1179,7 +1193,7 @@ function compute$7() {
1179
1193
  // Check that width or height has changed from before, and also that width & height are not null values
1180
1194
  if ((data$c === null || width !== data$c.width || height !== data$c.height) && width !== null && height !== null) {
1181
1195
  data$c = { width: width, height: height };
1182
- encode$4(8 /* Document */);
1196
+ encode$4(8 /* Event.Document */);
1183
1197
  }
1184
1198
  }
1185
1199
  function end() {
@@ -1208,7 +1222,7 @@ function start$u() {
1208
1222
  reset$h();
1209
1223
  }
1210
1224
  function observe$b(root) {
1211
- bind(root, "click", handler$3.bind(this, 9 /* Click */, root), true);
1225
+ bind(root, "click", handler$3.bind(this, 9 /* Event.Click */, root), true);
1212
1226
  }
1213
1227
  function handler$3(event, root, evt) {
1214
1228
  var frame = iframe(root);
@@ -1234,8 +1248,8 @@ function handler$3(event, root, evt) {
1234
1248
  x = Math.round(l.x + (l.w / 2));
1235
1249
  y = Math.round(l.y + (l.h / 2));
1236
1250
  }
1237
- var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* ClickPrecision */), 0) : 0;
1238
- var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* ClickPrecision */), 0) : 0;
1251
+ var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1252
+ var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1239
1253
  // Check for null values before processing this event
1240
1254
  if (x !== null && y !== null) {
1241
1255
  state$7.push({
@@ -1253,7 +1267,7 @@ function handler$3(event, root, evt) {
1253
1267
  text: text(t),
1254
1268
  link: a ? a.href : null,
1255
1269
  hash: null,
1256
- trust: evt.isTrusted ? 1 /* True */ : 0 /* False */
1270
+ trust: evt.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */
1257
1271
  }
1258
1272
  });
1259
1273
  schedule$1(encode$3.bind(this, event));
@@ -1268,7 +1282,7 @@ function text(element) {
1268
1282
  // Trim any spaces at the beginning or at the end of string
1269
1283
  // Also, replace multiple occurrence of space characters with a single white space
1270
1284
  // Finally, send only first few characters as specified by the Setting
1271
- output = t.trim().replace(/\s+/g, " " /* Space */).substr(0, 25 /* ClickText */);
1285
+ output = t.trim().replace(/\s+/g, " " /* Constant.Space */).substr(0, 25 /* Setting.ClickText */);
1272
1286
  }
1273
1287
  }
1274
1288
  return output;
@@ -1277,10 +1291,10 @@ function reaction(element) {
1277
1291
  if (element.nodeType === Node.ELEMENT_NODE) {
1278
1292
  var tag = element.tagName.toLowerCase();
1279
1293
  if (UserInputTags.indexOf(tag) >= 0) {
1280
- return 0 /* False */;
1294
+ return 0 /* BooleanFlag.False */;
1281
1295
  }
1282
1296
  }
1283
- return 1 /* True */;
1297
+ return 1 /* BooleanFlag.True */;
1284
1298
  }
1285
1299
  function layout$1(element) {
1286
1300
  var box = null;
@@ -1304,14 +1318,14 @@ function layout$1(element) {
1304
1318
  return box;
1305
1319
  }
1306
1320
  function context(a) {
1307
- if (a && a.hasAttribute("target" /* Target */)) {
1308
- switch (a.getAttribute("target" /* Target */)) {
1309
- case "_blank" /* Blank */: return 1 /* Blank */;
1310
- case "_parent" /* Parent */: return 2 /* Parent */;
1311
- case "_top" /* Top */: return 3 /* Top */;
1321
+ if (a && a.hasAttribute("target" /* Constant.Target */)) {
1322
+ switch (a.getAttribute("target" /* Constant.Target */)) {
1323
+ case "_blank" /* Constant.Blank */: return 1 /* BrowsingContext.Blank */;
1324
+ case "_parent" /* Constant.Parent */: return 2 /* BrowsingContext.Parent */;
1325
+ case "_top" /* Constant.Top */: return 3 /* BrowsingContext.Top */;
1312
1326
  }
1313
1327
  }
1314
- return 0 /* Self */;
1328
+ return 0 /* BrowsingContext.Self */;
1315
1329
  }
1316
1330
  function reset$h() {
1317
1331
  state$7 = [];
@@ -1325,13 +1339,13 @@ function start$t() {
1325
1339
  reset$g();
1326
1340
  }
1327
1341
  function observe$a(root) {
1328
- bind(root, "cut", recompute$7.bind(this, 0 /* Cut */), true);
1329
- bind(root, "copy", recompute$7.bind(this, 1 /* Copy */), true);
1330
- bind(root, "paste", recompute$7.bind(this, 2 /* Paste */), true);
1342
+ bind(root, "cut", recompute$7.bind(this, 0 /* Clipboard.Cut */), true);
1343
+ bind(root, "copy", recompute$7.bind(this, 1 /* Clipboard.Copy */), true);
1344
+ bind(root, "paste", recompute$7.bind(this, 2 /* Clipboard.Paste */), true);
1331
1345
  }
1332
1346
  function recompute$7(action, evt) {
1333
- state$6.push({ time: time(), event: 38 /* Clipboard */, data: { target: target(evt), action: action } });
1334
- schedule$1(encode$3.bind(this, 38 /* Clipboard */));
1347
+ state$6.push({ time: time(), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1348
+ schedule$1(encode$3.bind(this, 38 /* Event.Clipboard */));
1335
1349
  }
1336
1350
  function reset$g() {
1337
1351
  state$6 = [];
@@ -1364,9 +1378,9 @@ function recompute$6(evt) {
1364
1378
  if (state$5.length > 0 && (state$5[state$5.length - 1].data.target === data.target)) {
1365
1379
  state$5.pop();
1366
1380
  }
1367
- state$5.push({ time: time(), event: 27 /* Input */, data: data });
1381
+ state$5.push({ time: time(), event: 27 /* Event.Input */, data: data });
1368
1382
  clearTimeout(timeout$5);
1369
- timeout$5 = setTimeout(process$6, 500 /* LookAhead */, 27 /* Input */);
1383
+ timeout$5 = setTimeout(process$6, 500 /* Setting.LookAhead */, 27 /* Event.Input */);
1370
1384
  }
1371
1385
  }
1372
1386
  function process$6(event) {
@@ -1386,15 +1400,15 @@ function start$r() {
1386
1400
  reset$e();
1387
1401
  }
1388
1402
  function observe$8(root) {
1389
- bind(root, "mousedown", mouse.bind(this, 13 /* MouseDown */, root), true);
1390
- bind(root, "mouseup", mouse.bind(this, 14 /* MouseUp */, root), true);
1391
- bind(root, "mousemove", mouse.bind(this, 12 /* MouseMove */, root), true);
1392
- bind(root, "mousewheel", mouse.bind(this, 15 /* MouseWheel */, root), true);
1393
- bind(root, "dblclick", mouse.bind(this, 16 /* DoubleClick */, root), true);
1394
- bind(root, "touchstart", touch.bind(this, 17 /* TouchStart */, root), true);
1395
- bind(root, "touchend", touch.bind(this, 18 /* TouchEnd */, root), true);
1396
- bind(root, "touchmove", touch.bind(this, 19 /* TouchMove */, root), true);
1397
- bind(root, "touchcancel", touch.bind(this, 20 /* TouchCancel */, root), true);
1403
+ bind(root, "mousedown", mouse.bind(this, 13 /* Event.MouseDown */, root), true);
1404
+ bind(root, "mouseup", mouse.bind(this, 14 /* Event.MouseUp */, root), true);
1405
+ bind(root, "mousemove", mouse.bind(this, 12 /* Event.MouseMove */, root), true);
1406
+ bind(root, "wheel", mouse.bind(this, 15 /* Event.MouseWheel */, root), true);
1407
+ bind(root, "dblclick", mouse.bind(this, 16 /* Event.DoubleClick */, root), true);
1408
+ bind(root, "touchstart", touch.bind(this, 17 /* Event.TouchStart */, root), true);
1409
+ bind(root, "touchend", touch.bind(this, 18 /* Event.TouchEnd */, root), true);
1410
+ bind(root, "touchmove", touch.bind(this, 19 /* Event.TouchMove */, root), true);
1411
+ bind(root, "touchcancel", touch.bind(this, 20 /* Event.TouchCancel */, root), true);
1398
1412
  }
1399
1413
  function mouse(event, root, evt) {
1400
1414
  var frame = iframe(root);
@@ -1433,9 +1447,9 @@ function touch(event, root, evt) {
1433
1447
  }
1434
1448
  function handler$2(current) {
1435
1449
  switch (current.event) {
1436
- case 12 /* MouseMove */:
1437
- case 15 /* MouseWheel */:
1438
- case 19 /* TouchMove */:
1450
+ case 12 /* Event.MouseMove */:
1451
+ case 15 /* Event.MouseWheel */:
1452
+ case 19 /* Event.TouchMove */:
1439
1453
  var length_1 = state$4.length;
1440
1454
  var last = length_1 > 1 ? state$4[length_1 - 2] : null;
1441
1455
  if (last && similar$1(last, current)) {
@@ -1443,7 +1457,7 @@ function handler$2(current) {
1443
1457
  }
1444
1458
  state$4.push(current);
1445
1459
  clearTimeout(timeout$4);
1446
- timeout$4 = setTimeout(process$5, 500 /* LookAhead */, current.event);
1460
+ timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, current.event);
1447
1461
  break;
1448
1462
  default:
1449
1463
  state$4.push(current);
@@ -1463,7 +1477,7 @@ function similar$1(last, current) {
1463
1477
  var distance = Math.sqrt(dx * dx + dy * dy);
1464
1478
  var gap = current.time - last.time;
1465
1479
  var match = current.data.target === last.data.target;
1466
- return current.event === last.event && match && distance < 20 /* Distance */ && gap < 25 /* Interval */;
1480
+ return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.Interval */;
1467
1481
  }
1468
1482
  function stop$p() {
1469
1483
  clearTimeout(timeout$4);
@@ -1486,7 +1500,7 @@ function recompute$5() {
1486
1500
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
1487
1501
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
1488
1502
  };
1489
- encode$3(11 /* Resize */);
1503
+ encode$3(11 /* Event.Resize */);
1490
1504
  }
1491
1505
  function reset$d() {
1492
1506
  data$b = null;
@@ -1522,7 +1536,7 @@ function recompute$4(event) {
1522
1536
  // And, if for some reason that is not available, fall back to looking up scrollTop on document.documentElement.
1523
1537
  var x = element === de && "pageXOffset" in w ? Math.round(w.pageXOffset) : Math.round(element.scrollLeft);
1524
1538
  var y = element === de && "pageYOffset" in w ? Math.round(w.pageYOffset) : Math.round(element.scrollTop);
1525
- var current = { time: time(), event: 10 /* Scroll */, data: { target: element, x: x, y: y } };
1539
+ var current = { time: time(), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y } };
1526
1540
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
1527
1541
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
1528
1542
  return;
@@ -1534,7 +1548,7 @@ function recompute$4(event) {
1534
1548
  }
1535
1549
  state$3.push(current);
1536
1550
  clearTimeout(timeout$3);
1537
- timeout$3 = setTimeout(process$4, 500 /* LookAhead */, 10 /* Scroll */);
1551
+ timeout$3 = setTimeout(process$4, 500 /* Setting.LookAhead */, 10 /* Event.Scroll */);
1538
1552
  }
1539
1553
  function reset$c() {
1540
1554
  state$3 = [];
@@ -1545,7 +1559,7 @@ function process$4(event) {
1545
1559
  function similar(last, current) {
1546
1560
  var dx = last.data.x - current.data.x;
1547
1561
  var dy = last.data.y - current.data.y;
1548
- return (dx * dx + dy * dy < 20 /* Distance */ * 20 /* Distance */) && (current.time - last.time < 25 /* Interval */);
1562
+ return (dx * dx + dy * dy < 20 /* Setting.Distance */ * 20 /* Setting.Distance */) && (current.time - last.time < 25 /* Setting.Interval */);
1549
1563
  }
1550
1564
  function stop$n() {
1551
1565
  clearTimeout(timeout$3);
@@ -1580,7 +1594,7 @@ function recompute$3(root) {
1580
1594
  var startNode = data$a.start ? data$a.start : null;
1581
1595
  if (previous !== null && data$a.start !== null && startNode !== current.anchorNode) {
1582
1596
  clearTimeout(timeout$2);
1583
- process$3(21 /* Selection */);
1597
+ process$3(21 /* Event.Selection */);
1584
1598
  }
1585
1599
  data$a = {
1586
1600
  start: current.anchorNode,
@@ -1590,7 +1604,7 @@ function recompute$3(root) {
1590
1604
  };
1591
1605
  previous = current;
1592
1606
  clearTimeout(timeout$2);
1593
- timeout$2 = setTimeout(process$3, 500 /* LookAhead */, 21 /* Selection */);
1607
+ timeout$2 = setTimeout(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
1594
1608
  }
1595
1609
  function process$3(event) {
1596
1610
  schedule$1(encode$3.bind(this, event));
@@ -1612,8 +1626,8 @@ function observe$5(root) {
1612
1626
  bind(root, "submit", recompute$2, true);
1613
1627
  }
1614
1628
  function recompute$2(evt) {
1615
- state$2.push({ time: time(), event: 39 /* Submit */, data: { target: target(evt) } });
1616
- schedule$1(encode$3.bind(this, 39 /* Submit */));
1629
+ state$2.push({ time: time(), event: 39 /* Event.Submit */, data: { target: target(evt) } });
1630
+ schedule$1(encode$3.bind(this, 39 /* Event.Submit */));
1617
1631
  }
1618
1632
  function reset$a() {
1619
1633
  state$2 = [];
@@ -1628,7 +1642,7 @@ function start$m() {
1628
1642
  }
1629
1643
  function recompute$1(evt) {
1630
1644
  data$9 = { name: evt.type };
1631
- encode$3(26 /* Unload */);
1645
+ encode$3(26 /* Event.Unload */);
1632
1646
  stop();
1633
1647
  }
1634
1648
  function reset$9() {
@@ -1645,7 +1659,7 @@ function start$l() {
1645
1659
  }
1646
1660
  function recompute() {
1647
1661
  data$8 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1648
- encode$3(28 /* Visibility */);
1662
+ encode$3(28 /* Event.Visibility */);
1649
1663
  }
1650
1664
  function reset$8() {
1651
1665
  data$8 = null;
@@ -1707,51 +1721,51 @@ function ld(json) {
1707
1721
  for (var _i = 0, _a = Object.keys(json); _i < _a.length; _i++) {
1708
1722
  var key = _a[_i];
1709
1723
  var value = json[key];
1710
- if (key === "@type" /* Type */ && typeof value === "string") {
1724
+ if (key === "@type" /* JsonLD.Type */ && typeof value === "string") {
1711
1725
  value = value.toLowerCase();
1712
1726
  /* Normalizations */
1713
- value = value.indexOf("article" /* Article */) >= 0 || value.indexOf("posting" /* Posting */) >= 0 ? "article" /* Article */ : value;
1727
+ value = value.indexOf("article" /* JsonLD.Article */) >= 0 || value.indexOf("posting" /* JsonLD.Posting */) >= 0 ? "article" /* JsonLD.Article */ : value;
1714
1728
  switch (value) {
1715
- case "article" /* Article */:
1716
- case "recipe" /* Recipe */:
1717
- log(5 /* SchemaType */, json[key]);
1718
- log(8 /* AuthorName */, json["creator" /* Creator */]);
1719
- log(18 /* Headline */, json["headline" /* Headline */]);
1729
+ case "article" /* JsonLD.Article */:
1730
+ case "recipe" /* JsonLD.Recipe */:
1731
+ log(5 /* Dimension.SchemaType */, json[key]);
1732
+ log(8 /* Dimension.AuthorName */, json["creator" /* JsonLD.Creator */]);
1733
+ log(18 /* Dimension.Headline */, json["headline" /* JsonLD.Headline */]);
1720
1734
  break;
1721
- case "product" /* Product */:
1722
- log(5 /* SchemaType */, json[key]);
1723
- log(10 /* ProductName */, json["name" /* Name */]);
1724
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1725
- if (json["brand" /* Brand */]) {
1726
- log(6 /* ProductBrand */, json["brand" /* Brand */]["name" /* Name */]);
1735
+ case "product" /* JsonLD.Product */:
1736
+ log(5 /* Dimension.SchemaType */, json[key]);
1737
+ log(10 /* Dimension.ProductName */, json["name" /* JsonLD.Name */]);
1738
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1739
+ if (json["brand" /* JsonLD.Brand */]) {
1740
+ log(6 /* Dimension.ProductBrand */, json["brand" /* JsonLD.Brand */]["name" /* JsonLD.Name */]);
1727
1741
  }
1728
1742
  break;
1729
- case "aggregaterating" /* AggregateRating */:
1730
- if (json["ratingValue" /* RatingValue */]) {
1731
- max(11 /* RatingValue */, num$1(json["ratingValue" /* RatingValue */], 100 /* RatingScale */));
1732
- max(18 /* BestRating */, num$1(json["bestRating" /* BestRating */]));
1733
- max(19 /* WorstRating */, num$1(json["worstRating" /* WorstRating */]));
1743
+ case "aggregaterating" /* JsonLD.AggregateRating */:
1744
+ if (json["ratingValue" /* JsonLD.RatingValue */]) {
1745
+ max(11 /* Metric.RatingValue */, num$1(json["ratingValue" /* JsonLD.RatingValue */], 100 /* Setting.RatingScale */));
1746
+ max(18 /* Metric.BestRating */, num$1(json["bestRating" /* JsonLD.BestRating */]));
1747
+ max(19 /* Metric.WorstRating */, num$1(json["worstRating" /* JsonLD.WorstRating */]));
1734
1748
  }
1735
- max(12 /* RatingCount */, num$1(json["ratingCount" /* RatingCount */]));
1736
- max(17 /* ReviewCount */, num$1(json["reviewCount" /* ReviewCount */]));
1749
+ max(12 /* Metric.RatingCount */, num$1(json["ratingCount" /* JsonLD.RatingCount */]));
1750
+ max(17 /* Metric.ReviewCount */, num$1(json["reviewCount" /* JsonLD.ReviewCount */]));
1737
1751
  break;
1738
- case "person" /* Author */:
1739
- log(8 /* AuthorName */, json["name" /* Name */]);
1752
+ case "person" /* JsonLD.Author */:
1753
+ log(8 /* Dimension.AuthorName */, json["name" /* JsonLD.Name */]);
1740
1754
  break;
1741
- case "offer" /* Offer */:
1742
- log(7 /* ProductAvailability */, json["availability" /* Availability */]);
1743
- log(14 /* ProductCondition */, json["itemCondition" /* ItemCondition */]);
1744
- log(13 /* ProductCurrency */, json["priceCurrency" /* PriceCurrency */]);
1745
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1746
- max(13 /* ProductPrice */, num$1(json["price" /* Price */]));
1755
+ case "offer" /* JsonLD.Offer */:
1756
+ log(7 /* Dimension.ProductAvailability */, json["availability" /* JsonLD.Availability */]);
1757
+ log(14 /* Dimension.ProductCondition */, json["itemCondition" /* JsonLD.ItemCondition */]);
1758
+ log(13 /* Dimension.ProductCurrency */, json["priceCurrency" /* JsonLD.PriceCurrency */]);
1759
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1760
+ max(13 /* Metric.ProductPrice */, num$1(json["price" /* JsonLD.Price */]));
1747
1761
  break;
1748
- case "brand" /* Brand */:
1749
- log(6 /* ProductBrand */, json["name" /* Name */]);
1762
+ case "brand" /* JsonLD.Brand */:
1763
+ log(6 /* Dimension.ProductBrand */, json["name" /* JsonLD.Name */]);
1750
1764
  break;
1751
1765
  }
1752
1766
  }
1753
1767
  // Continue parsing nested objects
1754
- if (value !== null && typeof (value) === "object" /* Object */) {
1768
+ if (value !== null && typeof (value) === "object" /* Constant.Object */) {
1755
1769
  ld(value);
1756
1770
  }
1757
1771
  }
@@ -1760,23 +1774,23 @@ function num$1(input, scale) {
1760
1774
  if (scale === void 0) { scale = 1; }
1761
1775
  if (input !== null) {
1762
1776
  switch (typeof input) {
1763
- case "number" /* Number */: return Math.round(input * scale);
1764
- case "string" /* String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Empty */)) * scale);
1777
+ case "number" /* Constant.Number */: return Math.round(input * scale);
1778
+ case "string" /* Constant.String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Constant.Empty */)) * scale);
1765
1779
  }
1766
1780
  }
1767
1781
  return null;
1768
1782
  }
1769
1783
 
1770
- var IGNORE_ATTRIBUTES = ["title", "alt", "onload", "onfocus", "onerror"];
1784
+ var IGNORE_ATTRIBUTES = ["title", "alt", "onload", "onfocus", "onerror", "data-drupal-form-submit-last"];
1771
1785
  var newlineRegex = /[\r\n]+/g;
1772
1786
  function processNode (node, source) {
1773
1787
  var child = null;
1774
1788
  // Do not track this change if we are attempting to remove a node before discovering it
1775
- if (source === 2 /* ChildListRemove */ && has(node) === false) {
1789
+ if (source === 2 /* Source.ChildListRemove */ && has(node) === false) {
1776
1790
  return child;
1777
1791
  }
1778
1792
  // Special handling for text nodes that belong to style nodes
1779
- if (source !== 0 /* Discover */ &&
1793
+ if (source !== 0 /* Source.Discover */ &&
1780
1794
  node.nodeType === Node.TEXT_NODE &&
1781
1795
  node.parentElement &&
1782
1796
  node.parentElement.tagName === "STYLE") {
@@ -1789,10 +1803,10 @@ function processNode (node, source) {
1789
1803
  switch (node.nodeType) {
1790
1804
  case Node.DOCUMENT_TYPE_NODE:
1791
1805
  parent = insideFrame && node.parentNode ? iframe(node.parentNode) : parent;
1792
- var docTypePrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1806
+ var docTypePrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1793
1807
  var doctype = node;
1794
1808
  var docAttributes = { name: doctype.name, publicId: doctype.publicId, systemId: doctype.systemId };
1795
- var docData = { tag: docTypePrefix + "*D" /* DocumentTag */, attributes: docAttributes };
1809
+ var docData = { tag: docTypePrefix + "*D" /* Constant.DocumentTag */, attributes: docAttributes };
1796
1810
  dom[call](node, parent, docData, source);
1797
1811
  break;
1798
1812
  case Node.DOCUMENT_NODE:
@@ -1807,26 +1821,26 @@ function processNode (node, source) {
1807
1821
  if (shadowRoot.host) {
1808
1822
  parse$1(shadowRoot);
1809
1823
  var type = typeof (shadowRoot.constructor);
1810
- if (type === "function" /* Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* NativeCode */) >= 0) {
1824
+ if (type === "function" /* Constant.Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* Constant.NativeCode */) >= 0) {
1811
1825
  observe$3(shadowRoot);
1812
1826
  // See: https://wicg.github.io/construct-stylesheets/ for more details on adoptedStyleSheets.
1813
1827
  // At the moment, we are only able to capture "open" shadow DOM nodes. If they are closed, they are not accessible.
1814
1828
  // In future we may decide to proxy "attachShadow" call to gain access, but at the moment, we don't want to
1815
1829
  // cause any unintended side effect to the page. We will re-evaluate after we gather more real world data on this.
1816
- var style = "" /* Empty */;
1830
+ var style = "" /* Constant.Empty */;
1817
1831
  var adoptedStyleSheets = "adoptedStyleSheets" in shadowRoot ? shadowRoot["adoptedStyleSheets"] : [];
1818
1832
  for (var _i = 0, adoptedStyleSheets_1 = adoptedStyleSheets; _i < adoptedStyleSheets_1.length; _i++) {
1819
1833
  var styleSheet = adoptedStyleSheets_1[_i];
1820
1834
  style += getCssRules(styleSheet);
1821
1835
  }
1822
- var fragementData = { tag: "*S" /* ShadowDomTag */, attributes: { style: style } };
1836
+ var fragementData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
1823
1837
  dom[call](node, shadowRoot.host, fragementData, source);
1824
1838
  }
1825
1839
  else {
1826
1840
  // If the browser doesn't support shadow DOM natively, we detect that, and send appropriate tag back.
1827
1841
  // The differentiation is important because we don't have to observe pollyfill shadow DOM nodes,
1828
1842
  // the same way we observe real shadow DOM nodes (encapsulation provided by the browser).
1829
- dom[call](node, shadowRoot.host, { tag: "*P" /* PolyfillShadowDomTag */, attributes: {} }, source);
1843
+ dom[call](node, shadowRoot.host, { tag: "*P" /* Constant.PolyfillShadowDomTag */, attributes: {} }, source);
1830
1844
  }
1831
1845
  }
1832
1846
  break;
@@ -1839,7 +1853,7 @@ function processNode (node, source) {
1839
1853
  // The only exception is when we receive a mutation to remove the text node, in that case
1840
1854
  // parent will be null, but we can still process the node by checking it's an update call.
1841
1855
  if (call === "update" || (parent && has(parent) && parent.tagName !== "STYLE")) {
1842
- var textData = { tag: "*T" /* TextTag */, value: node.nodeValue };
1856
+ var textData = { tag: "*T" /* Constant.TextTag */, value: node.nodeValue };
1843
1857
  dom[call](node, parent, textData, source);
1844
1858
  }
1845
1859
  break;
@@ -1851,20 +1865,20 @@ function processNode (node, source) {
1851
1865
  // For correctness, we first look at parentElement and if it not present then fall back to using parentNode
1852
1866
  parent = node.parentElement ? node.parentElement : (node.parentNode ? node.parentNode : null);
1853
1867
  // If we encounter a node that is part of SVG namespace, prefix the tag with SVG_PREFIX
1854
- if (element.namespaceURI === "http://www.w3.org/2000/svg" /* SvgNamespace */) {
1855
- tag = "svg:" /* SvgPrefix */ + tag;
1868
+ if (element.namespaceURI === "http://www.w3.org/2000/svg" /* Constant.SvgNamespace */) {
1869
+ tag = "svg:" /* Constant.SvgPrefix */ + tag;
1856
1870
  }
1857
1871
  switch (tag) {
1858
1872
  case "HTML":
1859
1873
  parent = insideFrame && parent ? iframe(parent) : null;
1860
- var htmlPrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1874
+ var htmlPrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1861
1875
  var htmlData = { tag: htmlPrefix + tag, attributes: attributes };
1862
1876
  dom[call](node, parent, htmlData, source);
1863
1877
  break;
1864
1878
  case "SCRIPT":
1865
- if ("type" /* Type */ in attributes && attributes["type" /* Type */] === "application/ld+json" /* JsonLD */) {
1879
+ if ("type" /* Constant.Type */ in attributes && attributes["type" /* Constant.Type */] === "application/ld+json" /* Constant.JsonLD */) {
1866
1880
  try {
1867
- ld(JSON.parse(element.text.replace(newlineRegex, "" /* Empty */)));
1881
+ ld(JSON.parse(element.text.replace(newlineRegex, "" /* Constant.Empty */)));
1868
1882
  }
1869
1883
  catch ( /* do nothing */_a) { /* do nothing */ }
1870
1884
  }
@@ -1872,20 +1886,20 @@ function processNode (node, source) {
1872
1886
  case "NOSCRIPT":
1873
1887
  break;
1874
1888
  case "META":
1875
- var key = ("property" /* Property */ in attributes ?
1876
- "property" /* Property */ :
1877
- ("name" /* Name */ in attributes ? "name" /* Name */ : null));
1878
- if (key && "content" /* Content */ in attributes) {
1879
- var content = attributes["content" /* Content */];
1889
+ var key = ("property" /* Constant.Property */ in attributes ?
1890
+ "property" /* Constant.Property */ :
1891
+ ("name" /* Constant.Name */ in attributes ? "name" /* Constant.Name */ : null));
1892
+ if (key && "content" /* Constant.Content */ in attributes) {
1893
+ var content = attributes["content" /* Constant.Content */];
1880
1894
  switch (attributes[key]) {
1881
- case "og:title" /* ogTitle */:
1882
- log(20 /* MetaTitle */, content);
1895
+ case "og:title" /* Constant.ogTitle */:
1896
+ log(20 /* Dimension.MetaTitle */, content);
1883
1897
  break;
1884
- case "og:type" /* ogType */:
1885
- log(19 /* MetaType */, content);
1898
+ case "og:type" /* Constant.ogType */:
1899
+ log(19 /* Dimension.MetaType */, content);
1886
1900
  break;
1887
- case "generator" /* Generator */:
1888
- log(21 /* Generator */, content);
1901
+ case "generator" /* Constant.Generator */:
1902
+ log(21 /* Dimension.Generator */, content);
1889
1903
  break;
1890
1904
  }
1891
1905
  }
@@ -1893,7 +1907,7 @@ function processNode (node, source) {
1893
1907
  case "HEAD":
1894
1908
  var head = { tag: tag, attributes: attributes };
1895
1909
  if (location) {
1896
- head.attributes["*B" /* Base */] = location.protocol + "//" + location.hostname;
1910
+ head.attributes["*B" /* Constant.Base */] = location.protocol + "//" + location.hostname;
1897
1911
  }
1898
1912
  dom[call](node, parent, head, source);
1899
1913
  break;
@@ -1906,7 +1920,7 @@ function processNode (node, source) {
1906
1920
  var frameData = { tag: tag, attributes: attributes };
1907
1921
  if (sameorigin(iframe$1)) {
1908
1922
  monitor(iframe$1);
1909
- frameData.attributes["*O" /* SameOrigin */] = "true";
1923
+ frameData.attributes["*O" /* Constant.SameOrigin */] = "true";
1910
1924
  if (iframe$1.contentDocument && iframe$1.contentWindow && iframe$1.contentDocument.readyState !== "loading") {
1911
1925
  child = iframe$1.contentDocument;
1912
1926
  }
@@ -1935,7 +1949,7 @@ function observe$3(root) {
1935
1949
  function getStyleValue(style) {
1936
1950
  // Call trim on the text content to ensure we do not process white spaces ( , \n, \r\n, \t, etc.)
1937
1951
  // Also, check if stylesheet has any data-* attribute, if so process rules instead of looking up text
1938
- var value = style.textContent ? style.textContent.trim() : "" /* Empty */;
1952
+ var value = style.textContent ? style.textContent.trim() : "" /* Constant.Empty */;
1939
1953
  var dataset = style.dataset ? Object.keys(style.dataset).length : 0;
1940
1954
  if (value.length === 0 || dataset > 0) {
1941
1955
  value = getCssRules(style.sheet);
@@ -1943,14 +1957,14 @@ function getStyleValue(style) {
1943
1957
  return value;
1944
1958
  }
1945
1959
  function getCssRules(sheet) {
1946
- var value = "" /* Empty */;
1960
+ var value = "" /* Constant.Empty */;
1947
1961
  var cssRules = null;
1948
1962
  // Firefox throws a SecurityError when trying to access cssRules of a stylesheet from a different domain
1949
1963
  try {
1950
1964
  cssRules = sheet ? sheet.cssRules : [];
1951
1965
  }
1952
1966
  catch (e) {
1953
- log$1(1 /* CssRules */, 1 /* Warning */, e ? e.name : null);
1967
+ log$1(1 /* Code.CssRules */, 1 /* Severity.Warning */, e ? e.name : null);
1954
1968
  if (e && e.name !== "SecurityError") {
1955
1969
  throw e;
1956
1970
  }
@@ -1974,8 +1988,8 @@ function getAttributes(element) {
1974
1988
  }
1975
1989
  }
1976
1990
  // For INPUT tags read the dynamic "value" property if an explicit "value" attribute is not set
1977
- if (element.tagName === "INPUT" /* InputTag */ && !("value" /* Value */ in output) && element.value) {
1978
- output["value" /* Value */] = element.value;
1991
+ if (element.tagName === "INPUT" /* Constant.InputTag */ && !("value" /* Constant.Value */ in output) && element.value) {
1992
+ output["value" /* Constant.Value */] = element.value;
1979
1993
  }
1980
1994
  return output;
1981
1995
  }
@@ -1997,13 +2011,13 @@ function traverse (root, timer, source) {
1997
2011
  next = next.nextSibling;
1998
2012
  }
1999
2013
  state = state$8(timer);
2000
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 3];
2014
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
2001
2015
  return [4 /*yield*/, suspend$1(timer)];
2002
2016
  case 2:
2003
2017
  state = _a.sent();
2004
2018
  _a.label = 3;
2005
2019
  case 3:
2006
- if (state === 2 /* Stop */) {
2020
+ if (state === 2 /* Task.Stop */) {
2007
2021
  return [3 /*break*/, 4];
2008
2022
  }
2009
2023
  subnode = processNode(node, source);
@@ -2080,7 +2094,7 @@ function observe$2(node) {
2080
2094
  // For this reason, we need to wire up mutations every time we see a new shadow dom.
2081
2095
  // Also, wrap it inside a try / catch. In certain browsers (e.g. legacy Edge), observer on shadow dom can throw errors
2082
2096
  try {
2083
- var m = api("MutationObserver" /* MutationObserver */);
2097
+ var m = api("MutationObserver" /* Constant.MutationObserver */);
2084
2098
  var observer = m in window ? new window[m](measure(handle$1)) : null;
2085
2099
  if (observer) {
2086
2100
  observer.observe(node, { attributes: true, childList: true, characterData: true, subtree: true });
@@ -2088,7 +2102,7 @@ function observe$2(node) {
2088
2102
  }
2089
2103
  }
2090
2104
  catch (e) {
2091
- log$1(2 /* MutationObserver */, 0 /* Info */, e ? e.name : null);
2105
+ log$1(2 /* Code.MutationObserver */, 0 /* Severity.Info */, e ? e.name : null);
2092
2106
  }
2093
2107
  }
2094
2108
  function monitor(frame) {
@@ -2096,7 +2110,7 @@ function monitor(frame) {
2096
2110
  // This includes cases where iframe location is updated without explicitly updating src attribute
2097
2111
  // E.g. iframe.contentWindow.location.href = "new-location";
2098
2112
  if (has(frame) === false) {
2099
- bind(frame, "load" /* LoadEvent */, generate.bind(this, frame, "childList" /* ChildList */), true);
2113
+ bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
2100
2114
  }
2101
2115
  }
2102
2116
  function stop$h() {
@@ -2114,15 +2128,15 @@ function stop$h() {
2114
2128
  timeout$1 = null;
2115
2129
  }
2116
2130
  function active$2() {
2117
- activePeriod = time() + 3000 /* MutationActivePeriod */;
2131
+ activePeriod = time() + 3000 /* Setting.MutationActivePeriod */;
2118
2132
  }
2119
2133
  function handle$1(m) {
2120
2134
  // Queue up mutation records for asynchronous processing
2121
2135
  var now = time();
2122
- track$6(6 /* Mutation */, now);
2136
+ track$6(6 /* Event.Mutation */, now);
2123
2137
  mutations.push({ time: now, mutations: m });
2124
- schedule$1(process$2, 1 /* High */).then(function () {
2125
- measure(compute$7)();
2138
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
2139
+ setTimeout(compute$7);
2126
2140
  measure(compute$6)();
2127
2141
  });
2128
2142
  }
@@ -2132,7 +2146,7 @@ function process$2() {
2132
2146
  return __generator(this, function (_b) {
2133
2147
  switch (_b.label) {
2134
2148
  case 0:
2135
- timer = { id: id(), cost: 3 /* LayoutCost */ };
2149
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2136
2150
  start$w(timer);
2137
2151
  _b.label = 1;
2138
2152
  case 1:
@@ -2144,13 +2158,13 @@ function process$2() {
2144
2158
  if (!(_i < _a.length)) return [3 /*break*/, 6];
2145
2159
  mutation = _a[_i];
2146
2160
  state = state$8(timer);
2147
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2161
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2148
2162
  return [4 /*yield*/, suspend$1(timer)];
2149
2163
  case 3:
2150
2164
  state = _b.sent();
2151
2165
  _b.label = 4;
2152
2166
  case 4:
2153
- if (state === 2 /* Stop */) {
2167
+ if (state === 2 /* Task.Stop */) {
2154
2168
  return [3 /*break*/, 6];
2155
2169
  }
2156
2170
  target = mutation.target;
@@ -2162,17 +2176,17 @@ function process$2() {
2162
2176
  parse$1(target);
2163
2177
  }
2164
2178
  switch (type) {
2165
- case "attributes" /* Attributes */:
2166
- processNode(target, 3 /* Attributes */);
2179
+ case "attributes" /* Constant.Attributes */:
2180
+ processNode(target, 3 /* Source.Attributes */);
2167
2181
  break;
2168
- case "characterData" /* CharacterData */:
2169
- processNode(target, 4 /* CharacterData */);
2182
+ case "characterData" /* Constant.CharacterData */:
2183
+ processNode(target, 4 /* Source.CharacterData */);
2170
2184
  break;
2171
- case "childList" /* ChildList */:
2172
- processNodeList(mutation.addedNodes, 1 /* ChildListAdd */, timer);
2173
- processNodeList(mutation.removedNodes, 2 /* ChildListRemove */, timer);
2185
+ case "childList" /* Constant.ChildList */:
2186
+ processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer);
2187
+ processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer);
2174
2188
  break;
2175
- case "suspend" /* Suspend */:
2189
+ case "suspend" /* Constant.Suspend */:
2176
2190
  value = get(target);
2177
2191
  if (value) {
2178
2192
  value.metadata.suspend = true;
@@ -2183,7 +2197,7 @@ function process$2() {
2183
2197
  case 5:
2184
2198
  _i++;
2185
2199
  return [3 /*break*/, 2];
2186
- case 6: return [4 /*yield*/, encode$4(6 /* Mutation */, timer, record.time)];
2200
+ case 6: return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
2187
2201
  case 7:
2188
2202
  _b.sent();
2189
2203
  return [3 /*break*/, 1];
@@ -2197,11 +2211,11 @@ function process$2() {
2197
2211
  function track$5(m, timer) {
2198
2212
  var value = m.target ? get(m.target.parentNode) : null;
2199
2213
  // Check if the parent is already discovered and that the parent is not the document root
2200
- if (value && value.data.tag !== "HTML" /* HTML */) {
2214
+ if (value && value.data.tag !== "HTML" /* Constant.HTML */) {
2201
2215
  var inactive = time() > activePeriod;
2202
2216
  var target = get(m.target);
2203
2217
  var element = target && target.selector ? target.selector.join() : m.target.nodeName;
2204
- var parent_1 = value.selector ? value.selector.join() : "" /* Empty */;
2218
+ var parent_1 = value.selector ? value.selector.join() : "" /* Constant.Empty */;
2205
2219
  // We use selector, instead of id, to determine the key (signature for the mutation) because in some cases
2206
2220
  // repeated mutations can cause elements to be destroyed and then recreated as new DOM nodes
2207
2221
  // In those cases, IDs will change however the selector (which is relative to DOM xPath) remains the same
@@ -2210,20 +2224,20 @@ function track$5(m, timer) {
2210
2224
  history$4[key] = key in history$4 ? history$4[key] : [0];
2211
2225
  var h = history$4[key];
2212
2226
  // Lookup any pending nodes queued up for removal, and process them now if we suspended a mutation before
2213
- if (inactive === false && h[0] >= 10 /* MutationSuspendThreshold */) {
2214
- processNodeList(h[1], 2 /* ChildListRemove */, timer);
2227
+ if (inactive === false && h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
2228
+ processNodeList(h[1], 2 /* Source.ChildListRemove */, timer);
2215
2229
  }
2216
2230
  // Update the counter
2217
2231
  h[0] = inactive ? h[0] + 1 : 1;
2218
2232
  // Return updated mutation type based on if we have already hit the threshold or not
2219
- if (h[0] === 10 /* MutationSuspendThreshold */) {
2233
+ if (h[0] === 10 /* Setting.MutationSuspendThreshold */) {
2220
2234
  // Store a reference to removedNodes so we can process them later
2221
2235
  // when we resume mutations again on user interactions
2222
2236
  h[1] = m.removedNodes;
2223
- return "suspend" /* Suspend */;
2237
+ return "suspend" /* Constant.Suspend */;
2224
2238
  }
2225
- else if (h[0] > 10 /* MutationSuspendThreshold */) {
2226
- return "" /* Empty */;
2239
+ else if (h[0] > 10 /* Setting.MutationSuspendThreshold */) {
2240
+ return "" /* Constant.Empty */;
2227
2241
  }
2228
2242
  }
2229
2243
  return m.type;
@@ -2246,18 +2260,18 @@ function processNodeList(list, source, timer) {
2246
2260
  _a.label = 1;
2247
2261
  case 1:
2248
2262
  if (!(i < length)) return [3 /*break*/, 6];
2249
- if (!(source === 1 /* ChildListAdd */)) return [3 /*break*/, 2];
2263
+ if (!(source === 1 /* Source.ChildListAdd */)) return [3 /*break*/, 2];
2250
2264
  traverse(list[i], timer, source);
2251
2265
  return [3 /*break*/, 5];
2252
2266
  case 2:
2253
2267
  state = state$8(timer);
2254
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2268
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2255
2269
  return [4 /*yield*/, suspend$1(timer)];
2256
2270
  case 3:
2257
2271
  state = _a.sent();
2258
2272
  _a.label = 4;
2259
2273
  case 4:
2260
- if (state === 2 /* Stop */) {
2274
+ if (state === 2 /* Task.Stop */) {
2261
2275
  return [3 /*break*/, 6];
2262
2276
  }
2263
2277
  processNode(list[i], source);
@@ -2282,7 +2296,7 @@ function schedule(node, fragment) {
2282
2296
  if (timeout$1) {
2283
2297
  clearTimeout(timeout$1);
2284
2298
  }
2285
- timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* LookAhead */);
2299
+ timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* Setting.LookAhead */);
2286
2300
  return node;
2287
2301
  }
2288
2302
  function trigger$1(fragment) {
@@ -2295,7 +2309,7 @@ function trigger$1(fragment) {
2295
2309
  if (shadowRoot && has(node)) {
2296
2310
  continue;
2297
2311
  }
2298
- generate(node, shadowRoot || fragment ? "childList" /* ChildList */ : "characterData" /* CharacterData */);
2312
+ generate(node, shadowRoot || fragment ? "childList" /* Constant.ChildList */ : "characterData" /* Constant.CharacterData */);
2299
2313
  }
2300
2314
  }
2301
2315
  queue$2 = [];
@@ -2323,6 +2337,7 @@ var override = [];
2323
2337
  var unmask = [];
2324
2338
  var updatedFragments = {};
2325
2339
  var maskText = [];
2340
+ var maskInput = [];
2326
2341
  var maskDisable = [];
2327
2342
  // The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced
2328
2343
  var idMap = null; // Maps node => id.
@@ -2344,8 +2359,9 @@ function reset$7() {
2344
2359
  hashMap = {};
2345
2360
  override = [];
2346
2361
  unmask = [];
2347
- maskText = "password,secret,pass,social,ssn,name,code,dob,cell,mob,contact,hidden,account,cvv,ccv,email,tel,phone,address,addr,card,zip" /* Text */.split("," /* Comma */);
2348
- maskDisable = "radio,checkbox,range,button,reset,submit" /* Disable */.split("," /* Comma */);
2362
+ maskText = "address,password,contact" /* Mask.Text */.split("," /* Constant.Comma */);
2363
+ maskInput = "password,secret,pass,social,ssn,name,code,dob,cell,mob,contact,hidden,account,cvv,ccv,email,tel,phone,address,addr,card,zip" /* Mask.Input */.split("," /* Constant.Comma */);
2364
+ maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
2349
2365
  idMap = new WeakMap();
2350
2366
  iframeMap = new WeakMap();
2351
2367
  privacyMap = new WeakMap();
@@ -2360,19 +2376,19 @@ function parse$1(root, init) {
2360
2376
  try {
2361
2377
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
2362
2378
  if (init) {
2363
- config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2379
+ config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2364
2380
  }
2365
2381
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
2366
2382
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
2367
2383
  if ("querySelectorAll" in root) {
2368
2384
  config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
2369
- config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* TextImage */); }); }); // Masked Elements
2385
+ config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
2370
2386
  config$1.fraud.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Check
2371
- unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* None */); }); }); // Unmasked Elements
2387
+ unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
2372
2388
  }
2373
2389
  }
2374
2390
  catch (e) {
2375
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
2391
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
2376
2392
  }
2377
2393
  }
2378
2394
  function getId(node, autogen) {
@@ -2395,17 +2411,18 @@ function add(node, parent, data, source) {
2395
2411
  var regionId = exists(node) ? id : null;
2396
2412
  var fragmentId = null;
2397
2413
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
2398
- var privacyId = config$1.content ? 1 /* Sensitive */ : 2 /* Text */;
2414
+ var privacyId = config$1.content ? 1 /* Privacy.Sensitive */ : 2 /* Privacy.Text */;
2399
2415
  if (parentId >= 0 && values[parentId]) {
2400
2416
  parentValue = values[parentId];
2401
2417
  parentValue.children.push(id);
2402
2418
  regionId = regionId === null ? parentValue.region : regionId;
2403
2419
  fragmentId = parentValue.fragment;
2404
2420
  fraudId = fraudId === null ? parentValue.metadata.fraud : fraudId;
2421
+ privacyId = parentValue.metadata.privacy;
2405
2422
  }
2406
2423
  // If there's an explicit region attribute set on the element, use it to mark a region on the page
2407
- if (data.attributes && "data-clarity-region" /* RegionData */ in data.attributes) {
2408
- observe$1(node, data.attributes["data-clarity-region" /* RegionData */]);
2424
+ if (data.attributes && "data-clarity-region" /* Constant.RegionData */ in data.attributes) {
2425
+ observe$1(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
2409
2426
  regionId = id;
2410
2427
  }
2411
2428
  nodes[id] = node;
@@ -2483,7 +2500,7 @@ function update$1(node, parent, data, source) {
2483
2500
  }
2484
2501
  function sameorigin(node) {
2485
2502
  var output = false;
2486
- if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* IFrameTag */) {
2503
+ if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* Constant.IFrameTag */) {
2487
2504
  var frame = node;
2488
2505
  // To determine if the iframe is same-origin or not, we try accessing it's contentDocument.
2489
2506
  // If the browser throws an exception, we assume it's cross-origin and move on.
@@ -2510,11 +2527,11 @@ function privacy(node, value, parent) {
2510
2527
  var attributes = data.attributes || {};
2511
2528
  var tag = data.tag.toUpperCase();
2512
2529
  switch (true) {
2513
- case "data-clarity-mask" /* MaskData */ in attributes:
2514
- metadata.privacy = 3 /* TextImage */;
2530
+ case "data-clarity-mask" /* Constant.MaskData */ in attributes:
2531
+ metadata.privacy = 3 /* Privacy.TextImage */;
2515
2532
  break;
2516
- case "data-clarity-unmask" /* UnmaskData */ in attributes:
2517
- metadata.privacy = 0 /* None */;
2533
+ case "data-clarity-unmask" /* Constant.UnmaskData */ in attributes:
2534
+ metadata.privacy = 0 /* Privacy.None */;
2518
2535
  break;
2519
2536
  case privacyMap.has(node):
2520
2537
  // If this node was explicitly configured to contain sensitive content, honor that privacy setting
@@ -2522,40 +2539,39 @@ function privacy(node, value, parent) {
2522
2539
  break;
2523
2540
  case fraudMap.has(node):
2524
2541
  // If this node was explicitly configured to be evaluated for fraud, then also mask content
2525
- metadata.privacy = 2 /* Text */;
2542
+ metadata.privacy = 2 /* Privacy.Text */;
2526
2543
  break;
2527
- case tag === "*T" /* TextTag */:
2544
+ case tag === "*T" /* Constant.TextTag */:
2528
2545
  // If it's a text node belonging to a STYLE or TITLE tag or one of SCRUB_EXCEPTIONS, then capture content
2529
- var pTag = parent && parent.data ? parent.data.tag : "" /* Empty */;
2530
- var pSelector_1 = parent && parent.selector ? parent.selector[0 /* Stable */] : "" /* Empty */;
2531
- metadata.privacy = pTag === "STYLE" /* StyleTag */ || pTag === "TITLE" /* TitleTag */ || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* None */ : current;
2546
+ var pTag = parent && parent.data ? parent.data.tag : "" /* Constant.Empty */;
2547
+ var pSelector_1 = parent && parent.selector ? parent.selector[0 /* Selector.Stable */] : "" /* Constant.Empty */;
2548
+ metadata.privacy = pTag === "STYLE" /* Constant.StyleTag */ || pTag === "TITLE" /* Constant.TitleTag */ || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* Privacy.None */ : current;
2532
2549
  break;
2533
- case "type" /* Type */ in attributes:
2550
+ case "type" /* Constant.Type */ in attributes:
2534
2551
  // If this node has an explicit type assigned to it, go through masking rules to determine right privacy setting
2535
- metadata.privacy = inspect(attributes["type" /* Type */], metadata);
2552
+ metadata.privacy = inspect(attributes["type" /* Constant.Type */], maskInput, metadata);
2536
2553
  break;
2537
- case tag === "INPUT" /* InputTag */ && current === 0 /* None */:
2554
+ case tag === "INPUT" /* Constant.InputTag */ && current === 0 /* Privacy.None */:
2538
2555
  // If even default privacy setting is to not mask, we still scan through input fields for any sensitive information
2539
- var field_1 = "" /* Empty */;
2556
+ var field_1 = "" /* Constant.Empty */;
2540
2557
  Object.keys(attributes).forEach(function (x) { return field_1 += attributes[x].toLowerCase(); });
2541
- metadata.privacy = inspect(field_1, metadata);
2558
+ metadata.privacy = inspect(field_1, maskInput, metadata);
2542
2559
  break;
2543
- case current === 1 /* Sensitive */ && tag === "INPUT" /* InputTag */:
2560
+ case current === 1 /* Privacy.Sensitive */ && tag === "INPUT" /* Constant.InputTag */:
2561
+ // Look through class names to aggressively mask content
2562
+ metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
2544
2563
  // If it's a button or an input option, make an exception to disable masking
2545
- metadata.privacy = maskDisable.indexOf(attributes["type" /* Type */]) >= 0 ? 0 /* None */ : current;
2564
+ metadata.privacy = maskDisable.indexOf(attributes["type" /* Constant.Type */]) >= 0 ? 0 /* Privacy.None */ : current;
2546
2565
  break;
2547
- case current === 1 /* Sensitive */:
2566
+ case current === 1 /* Privacy.Sensitive */:
2548
2567
  // In a mode where we mask sensitive information by default, look through class names to aggressively mask content
2549
- metadata.privacy = inspect(attributes["class" /* Class */], metadata);
2550
- break;
2551
- default:
2552
- metadata.privacy = parent ? parent.metadata.privacy : metadata.privacy;
2568
+ metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
2553
2569
  break;
2554
2570
  }
2555
2571
  }
2556
- function inspect(input, metadata) {
2557
- if (input && maskText.some(function (x) { return input.indexOf(x) >= 0; })) {
2558
- return 2 /* Text */;
2572
+ function inspect(input, lookup, metadata) {
2573
+ if (input && lookup.some(function (x) { return input.indexOf(x) >= 0; })) {
2574
+ return 2 /* Privacy.Text */;
2559
2575
  }
2560
2576
  return metadata.privacy;
2561
2577
  }
@@ -2647,7 +2663,7 @@ function remove(id, source) {
2647
2663
  }
2648
2664
  function size(value) {
2649
2665
  // If this element is a image node, and is masked, then track box model for the current element
2650
- if (value.data.tag === "IMG" /* ImageTag */ && value.metadata.privacy === 3 /* TextImage */) {
2666
+ if (value.data.tag === "IMG" /* Constant.ImageTag */ && value.metadata.privacy === 3 /* Privacy.TextImage */) {
2651
2667
  value.metadata.size = [];
2652
2668
  }
2653
2669
  }
@@ -2682,7 +2698,7 @@ function track$4(id, source, fragment, changed, parentChanged) {
2682
2698
  // Edge case: If an element is added later on, and pre-discovered element is moved as a child.
2683
2699
  // In that case, we need to reorder the pre-discovered element in the update list to keep visualization consistent.
2684
2700
  var uIndex = updateMap.indexOf(id);
2685
- if (uIndex >= 0 && source === 1 /* ChildListAdd */ && parentChanged) {
2701
+ if (uIndex >= 0 && source === 1 /* Source.ChildListAdd */ && parentChanged) {
2686
2702
  updateMap.splice(uIndex, 1);
2687
2703
  updateMap.push(id);
2688
2704
  }
@@ -2728,15 +2744,15 @@ function exists(node) {
2728
2744
  }
2729
2745
  function track$3(id, event) {
2730
2746
  var node = getNode(id);
2731
- var data = id in regions ? regions[id] : { id: id, visibility: 0 /* Rendered */, interaction: 16 /* None */, name: regionMap.get(node) };
2747
+ var data = id in regions ? regions[id] : { id: id, visibility: 0 /* RegionVisibility.Rendered */, interaction: 16 /* InteractionState.None */, name: regionMap.get(node) };
2732
2748
  // Determine the interaction state based on incoming event
2733
- var interaction = 16 /* None */;
2749
+ var interaction = 16 /* InteractionState.None */;
2734
2750
  switch (event) {
2735
- case 9 /* Click */:
2736
- interaction = 20 /* Clicked */;
2751
+ case 9 /* Event.Click */:
2752
+ interaction = 20 /* InteractionState.Clicked */;
2737
2753
  break;
2738
- case 27 /* Input */:
2739
- interaction = 30 /* Input */;
2754
+ case 27 /* Event.Input */:
2755
+ interaction = 30 /* InteractionState.Input */;
2740
2756
  break;
2741
2757
  }
2742
2758
  // Process updates to this region, if applicable
@@ -2764,7 +2780,7 @@ function compute$6() {
2764
2780
  queue$1 = q;
2765
2781
  // Schedule encode only when we have at least one valid data entry
2766
2782
  if (state$1.length > 0) {
2767
- encode$4(7 /* Region */);
2783
+ encode$4(7 /* Event.Region */);
2768
2784
  }
2769
2785
  }
2770
2786
  function handler$1(entries) {
@@ -2780,27 +2796,27 @@ function handler$1(entries) {
2780
2796
  // Also, if these regions ever become non-zero width or height (through AJAX, user action or orientation change) - we will automatically start monitoring them from that point onwards
2781
2797
  if (regionMap.has(target) && rect.width + rect.height > 0 && viewport.width > 0 && viewport.height > 0) {
2782
2798
  var id = target ? getId(target) : null;
2783
- var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* None */, visibility: 0 /* Rendered */ };
2799
+ var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* InteractionState.None */, visibility: 0 /* RegionVisibility.Rendered */ };
2784
2800
  // For regions that have relatively smaller area, we look at intersection ratio and see the overlap relative to element's area
2785
2801
  // However, for larger regions, area of regions could be bigger than viewport and therefore comparison is relative to visible area
2786
2802
  var viewportRatio = overlap ? (overlap.width * overlap.height * 1.0) / (viewport.width * viewport.height) : 0;
2787
- var visible = viewportRatio > 0.05 /* ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* IntersectionRatio */;
2803
+ var visible = viewportRatio > 0.05 /* Setting.ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* Setting.IntersectionRatio */;
2788
2804
  // If an element is either visible or was visible and has been scrolled to the end
2789
2805
  // i.e. Scrolled to end is determined by if the starting position of the element + the window height is more than the total element height.
2790
2806
  // starting position is relative to the viewport - so Intersection observer returns a negative value for rect.top to indicate that the element top is above the viewport
2791
- var scrolledToEnd = (visible || data.visibility == 10 /* Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2807
+ var scrolledToEnd = (visible || data.visibility == 10 /* RegionVisibility.Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2792
2808
  // Process updates to this region, if applicable
2793
2809
  process$1(target, data, data.interaction, (scrolledToEnd ?
2794
- 13 /* ScrolledToEnd */ :
2795
- (visible ? 10 /* Visible */ : 0 /* Rendered */)));
2810
+ 13 /* RegionVisibility.ScrolledToEnd */ :
2811
+ (visible ? 10 /* RegionVisibility.Visible */ : 0 /* RegionVisibility.Rendered */)));
2796
2812
  // Stop observing this element now that we have already received scrolled signal
2797
- if (data.visibility >= 13 /* ScrolledToEnd */ && observer$1) {
2813
+ if (data.visibility >= 13 /* RegionVisibility.ScrolledToEnd */ && observer$1) {
2798
2814
  observer$1.unobserve(target);
2799
2815
  }
2800
2816
  }
2801
2817
  }
2802
2818
  if (state$1.length > 0) {
2803
- encode$4(7 /* Region */);
2819
+ encode$4(7 /* Event.Region */);
2804
2820
  }
2805
2821
  }
2806
2822
  function process$1(n, d, s, v) {
@@ -2859,7 +2875,7 @@ function link(node) {
2859
2875
  function metadata$2(node, event, text) {
2860
2876
  if (text === void 0) { text = null; }
2861
2877
  // If the node is null, we return a reserved value for id: 0. Valid assignment of id begins from 1+.
2862
- var output = { id: 0, hash: null, privacy: 2 /* Text */, node: node };
2878
+ var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */, node: node };
2863
2879
  if (node) {
2864
2880
  var value = get(node);
2865
2881
  if (value !== null) {
@@ -2885,15 +2901,15 @@ function encode$3 (type) {
2885
2901
  t = time();
2886
2902
  tokens = [t, type];
2887
2903
  switch (type) {
2888
- case 13 /* MouseDown */:
2889
- case 14 /* MouseUp */:
2890
- case 12 /* MouseMove */:
2891
- case 15 /* MouseWheel */:
2892
- case 16 /* DoubleClick */:
2893
- case 17 /* TouchStart */:
2894
- case 18 /* TouchEnd */:
2895
- case 19 /* TouchMove */:
2896
- case 20 /* TouchCancel */:
2904
+ case 13 /* Event.MouseDown */:
2905
+ case 14 /* Event.MouseUp */:
2906
+ case 12 /* Event.MouseMove */:
2907
+ case 15 /* Event.MouseWheel */:
2908
+ case 16 /* Event.DoubleClick */:
2909
+ case 17 /* Event.TouchStart */:
2910
+ case 18 /* Event.TouchEnd */:
2911
+ case 19 /* Event.TouchMove */:
2912
+ case 20 /* Event.TouchCancel */:
2897
2913
  for (_i = 0, _a = state$4; _i < _a.length; _i++) {
2898
2914
  entry = _a[_i];
2899
2915
  pTarget = metadata$2(entry.data.target, entry.event);
@@ -2908,12 +2924,12 @@ function encode$3 (type) {
2908
2924
  }
2909
2925
  reset$e();
2910
2926
  break;
2911
- case 9 /* Click */:
2927
+ case 9 /* Event.Click */:
2912
2928
  for (_b = 0, _c = state$7; _b < _c.length; _b++) {
2913
2929
  entry = _c[_b];
2914
2930
  cTarget = metadata$2(entry.data.target, entry.event, entry.data.text);
2915
2931
  tokens = [entry.time, entry.event];
2916
- cHash = cTarget.hash.join("." /* Dot */);
2932
+ cHash = cTarget.hash.join("." /* Constant.Dot */);
2917
2933
  tokens.push(cTarget.id);
2918
2934
  tokens.push(entry.data.x);
2919
2935
  tokens.push(entry.data.y);
@@ -2931,7 +2947,7 @@ function encode$3 (type) {
2931
2947
  }
2932
2948
  reset$h();
2933
2949
  break;
2934
- case 38 /* Clipboard */:
2950
+ case 38 /* Event.Clipboard */:
2935
2951
  for (_d = 0, _e = state$6; _d < _e.length; _d++) {
2936
2952
  entry = _e[_d];
2937
2953
  tokens = [entry.time, entry.event];
@@ -2944,7 +2960,7 @@ function encode$3 (type) {
2944
2960
  }
2945
2961
  reset$g();
2946
2962
  break;
2947
- case 11 /* Resize */:
2963
+ case 11 /* Event.Resize */:
2948
2964
  r = data$b;
2949
2965
  tokens.push(r.width);
2950
2966
  tokens.push(r.height);
@@ -2952,13 +2968,13 @@ function encode$3 (type) {
2952
2968
  reset$d();
2953
2969
  queue(tokens);
2954
2970
  break;
2955
- case 26 /* Unload */:
2971
+ case 26 /* Event.Unload */:
2956
2972
  u = data$9;
2957
2973
  tokens.push(u.name);
2958
2974
  reset$9();
2959
2975
  queue(tokens);
2960
2976
  break;
2961
- case 27 /* Input */:
2977
+ case 27 /* Event.Input */:
2962
2978
  for (_f = 0, _g = state$5; _f < _g.length; _f++) {
2963
2979
  entry = _g[_f];
2964
2980
  iTarget = metadata$2(entry.data.target, entry.event, entry.data.value);
@@ -2969,7 +2985,7 @@ function encode$3 (type) {
2969
2985
  }
2970
2986
  reset$f();
2971
2987
  break;
2972
- case 21 /* Selection */:
2988
+ case 21 /* Event.Selection */:
2973
2989
  s = data$a;
2974
2990
  if (s) {
2975
2991
  startTarget = metadata$2(s.start, type);
@@ -2982,7 +2998,7 @@ function encode$3 (type) {
2982
2998
  queue(tokens);
2983
2999
  }
2984
3000
  break;
2985
- case 10 /* Scroll */:
3001
+ case 10 /* Event.Scroll */:
2986
3002
  for (_h = 0, _j = state$3; _h < _j.length; _h++) {
2987
3003
  entry = _j[_h];
2988
3004
  sTarget = metadata$2(entry.data.target, entry.event);
@@ -2997,7 +3013,7 @@ function encode$3 (type) {
2997
3013
  }
2998
3014
  reset$c();
2999
3015
  break;
3000
- case 39 /* Submit */:
3016
+ case 39 /* Event.Submit */:
3001
3017
  for (_k = 0, _l = state$2; _k < _l.length; _k++) {
3002
3018
  entry = _l[_k];
3003
3019
  tokens = [entry.time, entry.event];
@@ -3009,7 +3025,7 @@ function encode$3 (type) {
3009
3025
  }
3010
3026
  reset$a();
3011
3027
  break;
3012
- case 22 /* Timeline */:
3028
+ case 22 /* Event.Timeline */:
3013
3029
  for (_m = 0, _o = updates$1; _m < _o.length; _m++) {
3014
3030
  entry = _o[_m];
3015
3031
  tokens = [entry.time, entry.event];
@@ -3023,7 +3039,7 @@ function encode$3 (type) {
3023
3039
  }
3024
3040
  reset$5();
3025
3041
  break;
3026
- case 28 /* Visibility */:
3042
+ case 28 /* Event.Visibility */:
3027
3043
  v = data$8;
3028
3044
  tokens.push(v.visible);
3029
3045
  queue(tokens);
@@ -3046,11 +3062,11 @@ function reset$5() {
3046
3062
  updates$1 = [];
3047
3063
  }
3048
3064
  function track$2(time, event, hash, x, y, reaction, context) {
3049
- if (reaction === void 0) { reaction = 1 /* True */; }
3050
- if (context === void 0) { context = 0 /* Self */; }
3065
+ if (reaction === void 0) { reaction = 1 /* BooleanFlag.True */; }
3066
+ if (context === void 0) { context = 0 /* BrowsingContext.Self */; }
3051
3067
  state.push({
3052
3068
  time: time,
3053
- event: 22 /* Timeline */,
3069
+ event: 22 /* Event.Timeline */,
3054
3070
  data: {
3055
3071
  type: event,
3056
3072
  hash: hash,
@@ -3069,7 +3085,7 @@ function compute$5() {
3069
3085
  var temp = [];
3070
3086
  updates$1 = [];
3071
3087
  var max = data$1.start + data$1.duration;
3072
- var min = Math.max(max - 2000 /* TimelineSpan */, 0);
3088
+ var min = Math.max(max - 2000 /* Setting.TimelineSpan */, 0);
3073
3089
  for (var _i = 0, state_1 = state; _i < state_1.length; _i++) {
3074
3090
  var s = state_1[_i];
3075
3091
  if (s.time >= min) {
@@ -3080,7 +3096,7 @@ function compute$5() {
3080
3096
  }
3081
3097
  }
3082
3098
  state = temp; // Drop events less than the min time
3083
- encode$3(22 /* Timeline */);
3099
+ encode$3(22 /* Event.Timeline */);
3084
3100
  }
3085
3101
  function stop$e() {
3086
3102
  state = [];
@@ -3113,10 +3129,10 @@ function queue(tokens, transmit) {
3113
3129
  var type = tokens.length > 1 ? tokens[1] : null;
3114
3130
  var event_1 = JSON.stringify(tokens);
3115
3131
  switch (type) {
3116
- case 5 /* Discover */:
3132
+ case 5 /* Event.Discover */:
3117
3133
  discoverBytes += event_1.length;
3118
- case 37 /* Box */:
3119
- case 6 /* Mutation */:
3134
+ case 37 /* Event.Box */:
3135
+ case 6 /* Event.Mutation */:
3120
3136
  playbackBytes += event_1.length;
3121
3137
  playback.push(event_1);
3122
3138
  break;
@@ -3125,7 +3141,7 @@ function queue(tokens, transmit) {
3125
3141
  break;
3126
3142
  }
3127
3143
  // Increment event count metric
3128
- count$1(25 /* EventCount */);
3144
+ count$1(25 /* Metric.EventCount */);
3129
3145
  // Following two checks are precautionary and act as a fail safe mechanism to get out of unexpected situations.
3130
3146
  // Check 1: If for any reason the upload hasn't happened after waiting for 2x the config.delay time,
3131
3147
  // reset the timer. This allows Clarity to attempt an upload again.
@@ -3138,7 +3154,7 @@ function queue(tokens, transmit) {
3138
3154
  // However, in certain scenarios - like metric calculation - which are triggered as part of an existing upload
3139
3155
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
3140
3156
  if (transmit && timeout === null) {
3141
- if (type !== 25 /* Ping */) {
3157
+ if (type !== 25 /* Event.Ping */) {
3142
3158
  reset$m();
3143
3159
  }
3144
3160
  timeout = setTimeout(upload, gap);
@@ -3167,9 +3183,9 @@ function upload(final) {
3167
3183
  switch (_b.label) {
3168
3184
  case 0:
3169
3185
  timeout = null;
3170
- sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* MaxFirstPayloadBytes */ || data$1.sequence > 0);
3186
+ sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
3171
3187
  if (sendPlaybackBytes) {
3172
- max(1 /* Playback */, 1 /* True */);
3188
+ max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
3173
3189
  }
3174
3190
  // CAUTION: Ensure "transmit" is set to false in the queue function for following events
3175
3191
  // Otherwise you run a risk of infinite loop.
@@ -3179,7 +3195,7 @@ function upload(final) {
3179
3195
  last = final === true;
3180
3196
  e = JSON.stringify(envelope(last));
3181
3197
  a = "[".concat(analysis.join(), "]");
3182
- p = sendPlaybackBytes ? "[".concat(playback.join(), "]") : "" /* Empty */;
3198
+ p = sendPlaybackBytes ? "[".concat(playback.join(), "]") : "" /* Constant.Empty */;
3183
3199
  encoded = { e: e, a: a, p: p };
3184
3200
  payload = stringify(encoded);
3185
3201
  if (!last) return [3 /*break*/, 1];
@@ -3191,7 +3207,7 @@ function upload(final) {
3191
3207
  _b.label = 3;
3192
3208
  case 3:
3193
3209
  zipped = _a;
3194
- sum(2 /* TotalBytes */, zipped ? zipped.length : payload.length);
3210
+ sum(2 /* Metric.TotalBytes */, zipped ? zipped.length : payload.length);
3195
3211
  send(payload, zipped, data$1.sequence, last);
3196
3212
  // Clear out events now that payload has been dispatched
3197
3213
  analysis = [];
@@ -3211,7 +3227,7 @@ function stringify(encoded) {
3211
3227
  function send(payload, zipped, sequence, beacon) {
3212
3228
  if (beacon === void 0) { beacon = false; }
3213
3229
  // Upload data if a valid URL is defined in the config
3214
- if (typeof config$1.upload === "string" /* String */) {
3230
+ if (typeof config$1.upload === "string" /* Constant.String */) {
3215
3231
  var url = config$1.upload;
3216
3232
  var dispatched = false;
3217
3233
  // If it's the last payload, attempt to upload using sendBeacon first.
@@ -3250,7 +3266,7 @@ function send(payload, zipped, sequence, beacon) {
3250
3266
  xhr_1.withCredentials = true;
3251
3267
  if (zipped) {
3252
3268
  // If we do have valid compressed array, send it with appropriate HTTP headers so server can decode it appropriately
3253
- xhr_1.setRequestHeader("Accept" /* Accept */, "application/x-clarity-gzip" /* ClarityGzip */);
3269
+ xhr_1.setRequestHeader("Accept" /* Constant.Accept */, "application/x-clarity-gzip" /* Constant.ClarityGzip */);
3254
3270
  xhr_1.send(zipped);
3255
3271
  }
3256
3272
  else {
@@ -3267,13 +3283,13 @@ function send(payload, zipped, sequence, beacon) {
3267
3283
  }
3268
3284
  function check$3(xhr, sequence) {
3269
3285
  var transitData = transit[sequence];
3270
- if (xhr && xhr.readyState === 4 /* Done */ && transitData) {
3286
+ if (xhr && xhr.readyState === 4 /* XMLReadyState.Done */ && transitData) {
3271
3287
  // Attempt send payload again (as configured in settings) if we do not receive a success (2XX) response code back from the server
3272
- if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* RetryLimit */) {
3288
+ if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* Setting.RetryLimit */) {
3273
3289
  // We re-attempt in all cases except when server explicitly rejects our request with 4XX error
3274
3290
  if (xhr.status >= 400 && xhr.status < 500) {
3275
3291
  // In case of a 4XX response from the server, we bail out instead of trying again
3276
- trigger(6 /* Server */);
3292
+ trigger(6 /* Check.Server */);
3277
3293
  }
3278
3294
  else {
3279
3295
  // Browser will send status = 0 when it refuses to put network request over the wire
@@ -3294,7 +3310,7 @@ function check$3(xhr, sequence) {
3294
3310
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
3295
3311
  // Send back an event only if we were not successful in our first attempt
3296
3312
  if (transitData.attempts > 1) {
3297
- encode$1(2 /* Upload */);
3313
+ encode$1(2 /* Event.Upload */);
3298
3314
  }
3299
3315
  // Handle response if it was a 200 response with a valid body
3300
3316
  if (xhr.status === 200 && xhr.responseText) {
@@ -3305,7 +3321,7 @@ function check$3(xhr, sequence) {
3305
3321
  // And, right before we terminate the session, we will attempt one last time to see if we can use
3306
3322
  // different transport option (sendBeacon vs. XHR) to get this data to the server for analysis purposes
3307
3323
  send(transitData.data, null, sequence, true);
3308
- trigger(3 /* Retry */);
3324
+ trigger(3 /* Check.Retry */);
3309
3325
  }
3310
3326
  // Signal that this request completed successfully
3311
3327
  if (xhr.status >= 200 && xhr.status <= 208) {
@@ -3325,19 +3341,19 @@ function done(sequence) {
3325
3341
  function delay() {
3326
3342
  // Progressively increase delay as we continue to send more payloads from the client to the server
3327
3343
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
3328
- var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* MinUploadDelay */ : data$1.sequence * config$1.delay;
3329
- return typeof config$1.upload === "string" /* String */ ? Math.max(Math.min(gap, 30000 /* MaxUploadDelay */), 100 /* MinUploadDelay */) : config$1.delay;
3344
+ var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$1.delay;
3345
+ return typeof config$1.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$1.delay;
3330
3346
  }
3331
3347
  function response(payload) {
3332
- var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Empty */;
3348
+ var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Constant.Empty */;
3333
3349
  switch (key) {
3334
- case "END" /* End */:
3350
+ case "END" /* Constant.End */:
3335
3351
  // Clear out session storage and end the session so we can start fresh the next time
3336
- trigger(6 /* Server */);
3352
+ trigger(6 /* Check.Server */);
3337
3353
  break;
3338
- case "UPGRADE" /* Upgrade */:
3354
+ case "UPGRADE" /* Constant.Upgrade */:
3339
3355
  // Upgrade current session to send back playback information
3340
- upgrade("Auto" /* Auto */);
3356
+ upgrade("Auto" /* Constant.Auto */);
3341
3357
  break;
3342
3358
  }
3343
3359
  }
@@ -3355,7 +3371,7 @@ function handler(error) {
3355
3371
  if (!(e.message in history$3)) {
3356
3372
  history$3[e.message] = 0;
3357
3373
  }
3358
- if (history$3[e.message]++ >= 5 /* ScriptErrorLimit */) {
3374
+ if (history$3[e.message]++ >= 5 /* Setting.ScriptErrorLimit */) {
3359
3375
  return true;
3360
3376
  }
3361
3377
  // Send back information only if the handled error has valid information
@@ -3367,7 +3383,7 @@ function handler(error) {
3367
3383
  stack: e.stack,
3368
3384
  source: error["filename"]
3369
3385
  };
3370
- encode$2(31 /* ScriptError */);
3386
+ encode$2(31 /* Event.ScriptError */);
3371
3387
  }
3372
3388
  return true;
3373
3389
  }
@@ -3378,7 +3394,7 @@ function encode$2 (type) {
3378
3394
  return __generator(this, function (_a) {
3379
3395
  tokens = [time(), type];
3380
3396
  switch (type) {
3381
- case 31 /* ScriptError */:
3397
+ case 31 /* Event.ScriptError */:
3382
3398
  tokens.push(data$7.message);
3383
3399
  tokens.push(data$7.line);
3384
3400
  tokens.push(data$7.column);
@@ -3386,7 +3402,7 @@ function encode$2 (type) {
3386
3402
  tokens.push(data$7.source);
3387
3403
  queue(tokens);
3388
3404
  break;
3389
- case 33 /* Log */:
3405
+ case 33 /* Event.Log */:
3390
3406
  if (data$6) {
3391
3407
  tokens.push(data$6.code);
3392
3408
  tokens.push(data$6.name);
@@ -3396,7 +3412,7 @@ function encode$2 (type) {
3396
3412
  queue(tokens, false);
3397
3413
  }
3398
3414
  break;
3399
- case 41 /* Fraud */:
3415
+ case 41 /* Event.Fraud */:
3400
3416
  if (data$d) {
3401
3417
  tokens.push(data$d.id);
3402
3418
  tokens.push(data$d.target);
@@ -3433,7 +3449,7 @@ function log$1(code, severity, name, message, stack) {
3433
3449
  else {
3434
3450
  history$2[code] = [key];
3435
3451
  }
3436
- encode$2(33 /* Log */);
3452
+ encode$2(33 /* Event.Log */);
3437
3453
  }
3438
3454
  function stop$c() {
3439
3455
  history$2 = {};
@@ -3454,25 +3470,25 @@ function start$c() {
3454
3470
  var source = e[i];
3455
3471
  var key = e[i + 1];
3456
3472
  switch (source) {
3457
- case 0 /* Javascript */:
3473
+ case 0 /* ExtractSource.Javascript */:
3458
3474
  var variable = e[i + 2];
3459
3475
  variables[key] = parse(variable);
3460
3476
  break;
3461
- case 1 /* Cookie */:
3477
+ case 1 /* ExtractSource.Cookie */:
3462
3478
  /*Todo: Add cookie extract logic*/
3463
3479
  break;
3464
- case 2 /* Text */:
3480
+ case 2 /* ExtractSource.Text */:
3465
3481
  var match_1 = e[i + 2];
3466
3482
  selectors[key] = match_1;
3467
3483
  break;
3468
- case 3 /* Fragment */:
3484
+ case 3 /* ExtractSource.Fragment */:
3469
3485
  fragments = e[i + 2];
3470
3486
  break;
3471
3487
  }
3472
3488
  }
3473
3489
  }
3474
3490
  catch (e) {
3475
- log$1(8 /* Config */, 1 /* Warning */, e ? e.name : null);
3491
+ log$1(8 /* Code.Config */, 1 /* Severity.Warning */, e ? e.name : null);
3476
3492
  }
3477
3493
  }
3478
3494
  function clone(v) {
@@ -3494,9 +3510,9 @@ function compute$4() {
3494
3510
  }
3495
3511
  }
3496
3512
  catch (e) {
3497
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
3513
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
3498
3514
  }
3499
- encode$1(40 /* Extract */);
3515
+ encode$1(40 /* Event.Extract */);
3500
3516
  }
3501
3517
  function reset$4() {
3502
3518
  keys = [];
@@ -3516,15 +3532,15 @@ function stop$b() {
3516
3532
  }
3517
3533
  function parse(variable) {
3518
3534
  var syntax = [];
3519
- var parts = variable.split("." /* Dot */);
3535
+ var parts = variable.split("." /* Constant.Dot */);
3520
3536
  while (parts.length > 0) {
3521
3537
  var part = parts.shift();
3522
- var arrayStart = part.indexOf("[" /* ArrayStart */);
3523
- var conditionStart = part.indexOf("{" /* ConditionStart */);
3524
- var conditionEnd = part.indexOf("}" /* ConditionEnd */);
3538
+ var arrayStart = part.indexOf("[" /* Constant.ArrayStart */);
3539
+ var conditionStart = part.indexOf("{" /* Constant.ConditionStart */);
3540
+ var conditionEnd = part.indexOf("}" /* Constant.ConditionEnd */);
3525
3541
  syntax.push({
3526
3542
  name: arrayStart > 0 ? part.substring(0, arrayStart) : (conditionStart > 0 ? part.substring(0, conditionStart) : part),
3527
- type: arrayStart > 0 ? 1 /* Array */ : (conditionStart > 0 ? 2 /* Object */ : 3 /* Simple */),
3543
+ type: arrayStart > 0 ? 1 /* Type.Array */ : (conditionStart > 0 ? 2 /* Type.Object */ : 3 /* Type.Simple */),
3528
3544
  condition: conditionStart > 0 ? part.substring(conditionStart + 1, conditionEnd) : null
3529
3545
  });
3530
3546
  }
@@ -3542,7 +3558,7 @@ function evaluate(variable, base) {
3542
3558
  var output;
3543
3559
  if (base && base[part.name]) {
3544
3560
  var obj = base[part.name];
3545
- if (part.type !== 1 /* Array */ && match(obj, part.condition)) {
3561
+ if (part.type !== 1 /* Type.Array */ && match(obj, part.condition)) {
3546
3562
  output = evaluate(variable, obj);
3547
3563
  }
3548
3564
  else if (Array.isArray(obj)) {
@@ -3564,7 +3580,7 @@ function evaluate(variable, base) {
3564
3580
  }
3565
3581
  function str(input) {
3566
3582
  // Automatically trim string to max of Setting.ExtractLimit to avoid fetching long strings
3567
- return input ? JSON.stringify(input).substring(0, 10000 /* ExtractLimit */) : input;
3583
+ return input ? JSON.stringify(input).substring(0, 10000 /* Setting.ExtractLimit */) : input;
3568
3584
  }
3569
3585
  function match(base, condition) {
3570
3586
  if (condition) {
@@ -3578,7 +3594,7 @@ function encode$1 (event) {
3578
3594
  var t = time();
3579
3595
  var tokens = [t, event];
3580
3596
  switch (event) {
3581
- case 4 /* Baseline */:
3597
+ case 4 /* Event.Baseline */:
3582
3598
  var b = state$9;
3583
3599
  if (b) {
3584
3600
  tokens = [b.time, b.event];
@@ -3596,30 +3612,30 @@ function encode$1 (event) {
3596
3612
  }
3597
3613
  reset$o();
3598
3614
  break;
3599
- case 25 /* Ping */:
3615
+ case 25 /* Event.Ping */:
3600
3616
  tokens.push(data$h.gap);
3601
3617
  queue(tokens);
3602
3618
  break;
3603
- case 35 /* Limit */:
3619
+ case 35 /* Event.Limit */:
3604
3620
  tokens.push(data$4.check);
3605
3621
  queue(tokens, false);
3606
3622
  break;
3607
- case 3 /* Upgrade */:
3623
+ case 3 /* Event.Upgrade */:
3608
3624
  tokens.push(data$f.key);
3609
3625
  queue(tokens);
3610
3626
  break;
3611
- case 2 /* Upload */:
3627
+ case 2 /* Event.Upload */:
3612
3628
  tokens.push(track$1.sequence);
3613
3629
  tokens.push(track$1.attempts);
3614
3630
  tokens.push(track$1.status);
3615
3631
  queue(tokens, false);
3616
3632
  break;
3617
- case 24 /* Custom */:
3633
+ case 24 /* Event.Custom */:
3618
3634
  tokens.push(data$j.key);
3619
3635
  tokens.push(data$j.value);
3620
3636
  queue(tokens);
3621
3637
  break;
3622
- case 34 /* Variable */:
3638
+ case 34 /* Event.Variable */:
3623
3639
  var variableKeys = Object.keys(data$e);
3624
3640
  if (variableKeys.length > 0) {
3625
3641
  for (var _i = 0, variableKeys_1 = variableKeys; _i < variableKeys_1.length; _i++) {
@@ -3631,7 +3647,7 @@ function encode$1 (event) {
3631
3647
  queue(tokens, false);
3632
3648
  }
3633
3649
  break;
3634
- case 0 /* Metric */:
3650
+ case 0 /* Event.Metric */:
3635
3651
  var metricKeys = Object.keys(updates$3);
3636
3652
  if (metricKeys.length > 0) {
3637
3653
  for (var _a = 0, metricKeys_1 = metricKeys; _a < metricKeys_1.length; _a++) {
@@ -3646,7 +3662,7 @@ function encode$1 (event) {
3646
3662
  queue(tokens, false);
3647
3663
  }
3648
3664
  break;
3649
- case 1 /* Dimension */:
3665
+ case 1 /* Event.Dimension */:
3650
3666
  var dimensionKeys = Object.keys(updates);
3651
3667
  if (dimensionKeys.length > 0) {
3652
3668
  for (var _b = 0, dimensionKeys_1 = dimensionKeys; _b < dimensionKeys_1.length; _b++) {
@@ -3659,7 +3675,7 @@ function encode$1 (event) {
3659
3675
  queue(tokens, false);
3660
3676
  }
3661
3677
  break;
3662
- case 36 /* Summary */:
3678
+ case 36 /* Event.Summary */:
3663
3679
  var eventKeys = Object.keys(data$g);
3664
3680
  if (eventKeys.length > 0) {
3665
3681
  for (var _c = 0, eventKeys_1 = eventKeys; _c < eventKeys_1.length; _c++) {
@@ -3672,7 +3688,7 @@ function encode$1 (event) {
3672
3688
  queue(tokens, false);
3673
3689
  }
3674
3690
  break;
3675
- case 40 /* Extract */:
3691
+ case 40 /* Event.Extract */:
3676
3692
  var extractKeys = keys;
3677
3693
  for (var _d = 0, extractKeys_1 = extractKeys; _d < extractKeys_1.length; _d++) {
3678
3694
  var e = extractKeys_1[_d];
@@ -3686,14 +3702,14 @@ function encode$1 (event) {
3686
3702
 
3687
3703
  var data$4;
3688
3704
  function start$b() {
3689
- data$4 = { check: 0 /* None */ };
3705
+ data$4 = { check: 0 /* Check.None */ };
3690
3706
  }
3691
3707
  function check$2(bytes) {
3692
- if (data$4.check === 0 /* None */) {
3708
+ if (data$4.check === 0 /* Check.None */) {
3693
3709
  var reason = data$4.check;
3694
- reason = data$1.sequence >= 128 /* PayloadLimit */ ? 1 /* Payload */ : reason;
3695
- reason = time() > 7200000 /* ShutdownLimit */ ? 2 /* Shutdown */ : reason;
3696
- reason = bytes > 10485760 /* PlaybackBytesLimit */ ? 2 /* Shutdown */ : reason;
3710
+ reason = data$1.sequence >= 128 /* Setting.PayloadLimit */ ? 1 /* Check.Payload */ : reason;
3711
+ reason = time() > 7200000 /* Setting.ShutdownLimit */ ? 2 /* Check.Shutdown */ : reason;
3712
+ reason = bytes > 10485760 /* Setting.PlaybackBytesLimit */ ? 2 /* Check.Shutdown */ : reason;
3697
3713
  if (reason !== data$4.check) {
3698
3714
  trigger(reason);
3699
3715
  }
@@ -3705,8 +3721,8 @@ function trigger(reason) {
3705
3721
  stop();
3706
3722
  }
3707
3723
  function compute$3() {
3708
- if (data$4.check !== 0 /* None */) {
3709
- encode$1(35 /* Limit */);
3724
+ if (data$4.check !== 0 /* Check.None */) {
3725
+ encode$1(35 /* Event.Limit */);
3710
3726
  }
3711
3727
  }
3712
3728
  function stop$a() {
@@ -3740,14 +3756,14 @@ function log(dimension, value) {
3740
3756
  }
3741
3757
  updates[dimension].push(value);
3742
3758
  // Limit check to ensure we have a cap on number of dimensions we can collect
3743
- if (data$3[dimension].length > 128 /* CollectionLimit */) {
3744
- trigger(5 /* Collection */);
3759
+ if (data$3[dimension].length > 128 /* Setting.CollectionLimit */) {
3760
+ trigger(5 /* Check.Collection */);
3745
3761
  }
3746
3762
  }
3747
3763
  }
3748
3764
  }
3749
3765
  function compute$2() {
3750
- encode$1(1 /* Dimension */);
3766
+ encode$1(1 /* Event.Dimension */);
3751
3767
  }
3752
3768
  function reset$3() {
3753
3769
  updates = {};
@@ -3758,8 +3774,8 @@ var callbacks = [];
3758
3774
  var rootDomain = null;
3759
3775
  function start$9() {
3760
3776
  rootDomain = null;
3761
- var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Empty */;
3762
- var title = document && document.title ? document.title : "" /* Empty */;
3777
+ var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
3778
+ var title = document && document.title ? document.title : "" /* Constant.Empty */;
3763
3779
  // Populate ids for this page
3764
3780
  var s = session();
3765
3781
  var u = user();
@@ -3770,27 +3786,27 @@ function start$9() {
3770
3786
  pageNum: s.count
3771
3787
  };
3772
3788
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
3773
- config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* False */ : config$1.lean;
3774
- config$1.upload = config$1.track && typeof config$1.upload === "string" /* String */ && s.upload && s.upload.length > "https://" /* HTTPS */.length ? s.upload : config$1.upload;
3789
+ config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$1.lean;
3790
+ config$1.upload = config$1.track && typeof config$1.upload === "string" /* Constant.String */ && s.upload && s.upload.length > "https://" /* Constant.HTTPS */.length ? s.upload : config$1.upload;
3775
3791
  // Log dimensions
3776
- log(0 /* UserAgent */, ua);
3777
- log(3 /* PageTitle */, title);
3778
- log(1 /* Url */, location.href);
3779
- log(2 /* Referrer */, document.referrer);
3780
- log(15 /* TabId */, tab());
3781
- log(16 /* PageLanguage */, document.documentElement.lang);
3782
- log(17 /* DocumentDirection */, document.dir);
3792
+ log(0 /* Dimension.UserAgent */, ua);
3793
+ log(3 /* Dimension.PageTitle */, title);
3794
+ log(1 /* Dimension.Url */, location.href);
3795
+ log(2 /* Dimension.Referrer */, document.referrer);
3796
+ log(15 /* Dimension.TabId */, tab());
3797
+ log(16 /* Dimension.PageLanguage */, document.documentElement.lang);
3798
+ log(17 /* Dimension.DocumentDirection */, document.dir);
3783
3799
  if (navigator) {
3784
- log(9 /* Language */, navigator.userLanguage || navigator.language);
3800
+ log(9 /* Dimension.Language */, navigator.userLanguage || navigator.language);
3785
3801
  userAgentData();
3786
3802
  }
3787
3803
  // Metrics
3788
- max(0 /* ClientTimestamp */, s.ts);
3789
- max(1 /* Playback */, 0 /* False */);
3804
+ max(0 /* Metric.ClientTimestamp */, s.ts);
3805
+ max(1 /* Metric.Playback */, 0 /* BooleanFlag.False */);
3790
3806
  if (screen) {
3791
- max(14 /* ScreenWidth */, Math.round(screen.width));
3792
- max(15 /* ScreenHeight */, Math.round(screen.height));
3793
- max(16 /* ColorDepth */, Math.round(screen.colorDepth));
3807
+ max(14 /* Metric.ScreenWidth */, Math.round(screen.width));
3808
+ max(15 /* Metric.ScreenHeight */, Math.round(screen.height));
3809
+ max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
3794
3810
  }
3795
3811
  // Read cookies specified in configuration
3796
3812
  for (var _i = 0, _a = config$1.cookies; _i < _a.length; _i++) {
@@ -3811,13 +3827,13 @@ function userAgentData() {
3811
3827
  "uaFullVersion"])
3812
3828
  .then(function (ua) {
3813
3829
  var _a;
3814
- log(22 /* Platform */, ua.platform);
3815
- log(23 /* PlatformVersion */, ua.platformVersion);
3830
+ log(22 /* Dimension.Platform */, ua.platform);
3831
+ log(23 /* Dimension.PlatformVersion */, ua.platformVersion);
3816
3832
  (_a = ua.brands) === null || _a === void 0 ? void 0 : _a.forEach(function (brand) {
3817
- log(24 /* Brand */, brand.name + "~" /* Tilde */ + brand.version);
3833
+ log(24 /* Dimension.Brand */, brand.name + "~" /* Constant.Tilde */ + brand.version);
3818
3834
  });
3819
- log(25 /* Model */, ua.model);
3820
- max(27 /* Mobile */, ua.mobile ? 1 /* True */ : 0 /* False */);
3835
+ log(25 /* Dimension.Model */, ua.model);
3836
+ max(27 /* Metric.Mobile */, ua.mobile ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
3821
3837
  });
3822
3838
  }
3823
3839
  }
@@ -3834,33 +3850,33 @@ function metadata(cb, wait) {
3834
3850
  callbacks.push({ callback: cb, wait: wait });
3835
3851
  }
3836
3852
  function id() {
3837
- return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Dot */) : "" /* Empty */;
3853
+ return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Constant.Dot */) : "" /* Constant.Empty */;
3838
3854
  }
3839
3855
  function consent() {
3840
3856
  if (active()) {
3841
3857
  config$1.track = true;
3842
- track(user(), 1 /* True */);
3858
+ track(user(), 1 /* BooleanFlag.True */);
3843
3859
  }
3844
3860
  }
3845
3861
  function clear() {
3846
3862
  // Clear any stored information in the cookie that tracks session information so we can restart fresh the next time
3847
- setCookie("_clsk" /* SessionKey */, "" /* Empty */, 0);
3863
+ setCookie("_clsk" /* Constant.SessionKey */, "" /* Constant.Empty */, 0);
3848
3864
  }
3849
3865
  function tab() {
3850
3866
  var id = shortid();
3851
- if (config$1.track && supported(window, "sessionStorage" /* SessionStorage */)) {
3852
- var value = sessionStorage.getItem("_cltk" /* TabKey */);
3867
+ if (config$1.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
3868
+ var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
3853
3869
  id = value ? value : id;
3854
- sessionStorage.setItem("_cltk" /* TabKey */, id);
3870
+ sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
3855
3871
  }
3856
3872
  return id;
3857
3873
  }
3858
3874
  function save() {
3859
3875
  var ts = Math.round(Date.now());
3860
- var upload = config$1.upload && typeof config$1.upload === "string" /* String */ ? config$1.upload.replace("https://" /* HTTPS */, "" /* Empty */) : "" /* Empty */;
3861
- var upgrade = config$1.lean ? 0 /* False */ : 1 /* True */;
3876
+ var upload = config$1.upload && typeof config$1.upload === "string" /* Constant.String */ ? config$1.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
3877
+ var upgrade = config$1.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
3862
3878
  processCallback(upgrade);
3863
- setCookie("_clsk" /* SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Pipe */), 1 /* SessionExpire */);
3879
+ setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Constant.Pipe */), 1 /* Setting.SessionExpire */);
3864
3880
  }
3865
3881
  function processCallback(upgrade) {
3866
3882
  if (callbacks.length > 0) {
@@ -3885,10 +3901,10 @@ function track(u, consent) {
3885
3901
  consent = consent === null ? u.consent : consent;
3886
3902
  // Convert time precision into days to reduce number of bytes we have to write in a cookie
3887
3903
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
3888
- var end = Math.ceil((Date.now() + (365 /* Expire */ * 86400000 /* Day */)) / 86400000 /* Day */);
3904
+ var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
3889
3905
  // To avoid cookie churn, write user id cookie only once every day
3890
- if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* CookieInterval */ || u.consent !== consent) {
3891
- setCookie("_clck" /* CookieKey */, [data$2.userId, 1 /* CookieVersion */, end.toString(36), consent].join("|" /* Pipe */), 365 /* Expire */);
3906
+ if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent) {
3907
+ setCookie("_clck" /* Constant.CookieKey */, [data$2.userId, 1 /* Setting.CookieVersion */, end.toString(36), consent].join("|" /* Constant.Pipe */), 365 /* Setting.Expire */);
3892
3908
  }
3893
3909
  }
3894
3910
  function shortid() {
@@ -3899,17 +3915,17 @@ function shortid() {
3899
3915
  return id.toString(36);
3900
3916
  }
3901
3917
  function session() {
3902
- var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Empty */ };
3903
- var value = getCookie("_clsk" /* SessionKey */);
3918
+ var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
3919
+ var value = getCookie("_clsk" /* Constant.SessionKey */);
3904
3920
  if (value) {
3905
- var parts = value.split("|" /* Pipe */);
3921
+ var parts = value.split("|" /* Constant.Pipe */);
3906
3922
  // Making it backward & forward compatible by using greater than comparison (v0.6.21)
3907
3923
  // In future version, we can reduce the parts length to be 5 where the last part contains the full upload URL
3908
- if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* SessionTimeout */) {
3924
+ if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* Setting.SessionTimeout */) {
3909
3925
  output.session = parts[0];
3910
3926
  output.count = num(parts[2]) + 1;
3911
3927
  output.upgrade = num(parts[3]);
3912
- output.upload = parts.length >= 6 ? "".concat("https://" /* HTTPS */).concat(parts[5], "/").concat(parts[4]) : "".concat("https://" /* HTTPS */).concat(parts[4]);
3928
+ output.upload = parts.length >= 6 ? "".concat("https://" /* Constant.HTTPS */).concat(parts[5], "/").concat(parts[4]) : "".concat("https://" /* Constant.HTTPS */).concat(parts[4]);
3913
3929
  }
3914
3930
  }
3915
3931
  return output;
@@ -3919,26 +3935,26 @@ function num(string, base) {
3919
3935
  return parseInt(string, base);
3920
3936
  }
3921
3937
  function user() {
3922
- var output = { id: shortid(), expiry: null, consent: 0 /* False */ };
3923
- var cookie = getCookie("_clck" /* CookieKey */);
3938
+ var output = { id: shortid(), expiry: null, consent: 0 /* BooleanFlag.False */ };
3939
+ var cookie = getCookie("_clck" /* Constant.CookieKey */);
3924
3940
  if (cookie && cookie.length > 0) {
3925
3941
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
3926
- var parts = cookie.split("|" /* Pipe */);
3942
+ var parts = cookie.split("|" /* Constant.Pipe */);
3927
3943
  // For backward compatibility introduced in v0.6.18; following code can be removed with future iterations
3928
3944
  // Count number of times Clarity's user cookie crumb appears in document.cookie (could be on different sub-domains e.g. www.domain.com and .domain.com)
3929
3945
  var count = 0;
3930
- for (var _i = 0, _a = document.cookie.split(";" /* Semicolon */); _i < _a.length; _i++) {
3946
+ for (var _i = 0, _a = document.cookie.split(";" /* Constant.Semicolon */); _i < _a.length; _i++) {
3931
3947
  var c = _a[_i];
3932
- count += c.split("=" /* Equals */)[0].trim() === "_clck" /* CookieKey */ ? 1 : 0;
3948
+ count += c.split("=" /* Constant.Equals */)[0].trim() === "_clck" /* Constant.CookieKey */ ? 1 : 0;
3933
3949
  }
3934
3950
  // Check if we either got version-less cookie value or saw multiple copies of the user cookie crumbs
3935
3951
  // In both these cases, we go ahead and delete the existing cookie set on current domain
3936
3952
  if (parts.length === 1 || count > 1) {
3937
- var deleted = "".concat(";" /* Semicolon */).concat("expires=" /* Expires */).concat((new Date(0)).toUTCString()).concat(";path=/" /* Path */);
3953
+ var deleted = "".concat(";" /* Constant.Semicolon */).concat("expires=" /* Constant.Expires */).concat((new Date(0)).toUTCString()).concat(";path=/" /* Constant.Path */);
3938
3954
  // First, delete current user cookie which might be set on current sub-domain vs. root domain
3939
- document.cookie = "".concat("_clck" /* CookieKey */, "=").concat(deleted);
3955
+ document.cookie = "".concat("_clck" /* Constant.CookieKey */, "=").concat(deleted);
3940
3956
  // Second, same thing for current session cookie so it can be re-written later with the root domain
3941
- document.cookie = "".concat("_clsk" /* SessionKey */, "=").concat(deleted);
3957
+ document.cookie = "".concat("_clsk" /* Constant.SessionKey */, "=").concat(deleted);
3942
3958
  }
3943
3959
  // End code for backward compatibility
3944
3960
  // Read version information and timestamp from cookie, if available
@@ -3947,21 +3963,21 @@ function user() {
3947
3963
  }
3948
3964
  // Check if we have explicit consent to track this user
3949
3965
  if (parts.length > 3 && num(parts[3]) === 1) {
3950
- output.consent = 1 /* True */;
3966
+ output.consent = 1 /* BooleanFlag.True */;
3951
3967
  }
3952
3968
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
3953
- config$1.track = config$1.track || output.consent === 1 /* True */;
3969
+ config$1.track = config$1.track || output.consent === 1 /* BooleanFlag.True */;
3954
3970
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
3955
3971
  output.id = config$1.track ? parts[0] : output.id;
3956
3972
  }
3957
3973
  return output;
3958
3974
  }
3959
3975
  function getCookie(key) {
3960
- if (supported(document, "cookie" /* Cookie */)) {
3961
- var cookies = document.cookie.split(";" /* Semicolon */);
3976
+ if (supported(document, "cookie" /* Constant.Cookie */)) {
3977
+ var cookies = document.cookie.split(";" /* Constant.Semicolon */);
3962
3978
  if (cookies) {
3963
3979
  for (var i = 0; i < cookies.length; i++) {
3964
- var pair = cookies[i].split("=" /* Equals */);
3980
+ var pair = cookies[i].split("=" /* Constant.Equals */);
3965
3981
  if (pair.length > 1 && pair[0] && pair[0].trim() === key) {
3966
3982
  return pair[1];
3967
3983
  }
@@ -3971,23 +3987,23 @@ function getCookie(key) {
3971
3987
  return null;
3972
3988
  }
3973
3989
  function setCookie(key, value, time) {
3974
- if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Cookie */))) {
3990
+ if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
3975
3991
  var expiry = new Date();
3976
3992
  expiry.setDate(expiry.getDate() + time);
3977
- var expires = expiry ? "expires=" /* Expires */ + expiry.toUTCString() : "" /* Empty */;
3978
- var cookie = "".concat(key, "=").concat(value).concat(";" /* Semicolon */).concat(expires).concat(";path=/" /* Path */);
3993
+ var expires = expiry ? "expires=" /* Constant.Expires */ + expiry.toUTCString() : "" /* Constant.Empty */;
3994
+ var cookie = "".concat(key, "=").concat(value).concat(";" /* Constant.Semicolon */).concat(expires).concat(";path=/" /* Constant.Path */);
3979
3995
  try {
3980
3996
  // Attempt to get the root domain only once and fall back to writing cookie on the current domain.
3981
3997
  if (rootDomain === null) {
3982
- var hostname = location.hostname ? location.hostname.split("." /* Dot */) : [];
3998
+ var hostname = location.hostname ? location.hostname.split("." /* Constant.Dot */) : [];
3983
3999
  // Walk backwards on a domain and attempt to set a cookie, until successful
3984
4000
  for (var i = hostname.length - 1; i >= 0; i--) {
3985
- rootDomain = ".".concat(hostname[i]).concat(rootDomain ? rootDomain : "" /* Empty */);
4001
+ rootDomain = ".".concat(hostname[i]).concat(rootDomain ? rootDomain : "" /* Constant.Empty */);
3986
4002
  // We do not wish to attempt writing a cookie on the absolute last part of the domain, e.g. .com or .net.
3987
4003
  // So we start attempting after second-last part, e.g. .domain.com (PASS) or .co.uk (FAIL)
3988
4004
  if (i < hostname.length - 1) {
3989
4005
  // Write the cookie on the current computed top level domain
3990
- document.cookie = "".concat(cookie).concat(";" /* Semicolon */).concat("domain=" /* Domain */).concat(rootDomain);
4006
+ document.cookie = "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain);
3991
4007
  // Once written, check if the cookie exists and its value matches exactly with what we intended to set
3992
4008
  // Checking for exact value match helps us eliminate a corner case where the cookie may already be present with a different value
3993
4009
  // If the check is successful, no more action is required and we can return from the function since rootDomain cookie is already set
@@ -3999,13 +4015,13 @@ function setCookie(key, value, time) {
3999
4015
  }
4000
4016
  // Finally, if we were not successful and gone through all the options, play it safe and reset rootDomain to be empty
4001
4017
  // This forces our code to fall back to always writing cookie to the current domain
4002
- rootDomain = "" /* Empty */;
4018
+ rootDomain = "" /* Constant.Empty */;
4003
4019
  }
4004
4020
  }
4005
4021
  catch (_a) {
4006
- rootDomain = "" /* Empty */;
4022
+ rootDomain = "" /* Constant.Empty */;
4007
4023
  }
4008
- document.cookie = rootDomain ? "".concat(cookie).concat(";" /* Semicolon */).concat("domain=" /* Domain */).concat(rootDomain) : cookie;
4024
+ document.cookie = rootDomain ? "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain) : cookie;
4009
4025
  }
4010
4026
  }
4011
4027
 
@@ -4021,8 +4037,8 @@ function start$8() {
4021
4037
  userId: m.userId,
4022
4038
  sessionId: m.sessionId,
4023
4039
  pageNum: m.pageNum,
4024
- upload: 0 /* Async */,
4025
- end: 0 /* False */
4040
+ upload: 0 /* Upload.Async */,
4041
+ end: 0 /* BooleanFlag.False */
4026
4042
  };
4027
4043
  }
4028
4044
  function stop$7() {
@@ -4032,8 +4048,8 @@ function envelope(last) {
4032
4048
  data$1.start = data$1.start + data$1.duration;
4033
4049
  data$1.duration = time() - data$1.start;
4034
4050
  data$1.sequence++;
4035
- data$1.upload = last && "sendBeacon" in navigator ? 1 /* Beacon */ : 0 /* Async */;
4036
- data$1.end = last ? 1 /* True */ : 0 /* False */;
4051
+ data$1.upload = last && "sendBeacon" in navigator ? 1 /* Upload.Beacon */ : 0 /* Upload.Async */;
4052
+ data$1.end = last ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
4037
4053
  return [
4038
4054
  data$1.version,
4039
4055
  data$1.sequence,
@@ -4086,10 +4102,10 @@ function measure (method) {
4086
4102
  throw report(ex);
4087
4103
  }
4088
4104
  var duration = performance.now() - start;
4089
- sum(4 /* TotalCost */, duration);
4090
- if (duration > 30 /* LongTask */) {
4091
- count$1(7 /* LongTaskCount */);
4092
- max(6 /* ThreadBlockedTime */, duration);
4105
+ sum(4 /* Metric.TotalCost */, duration);
4106
+ if (duration > 30 /* Setting.LongTask */) {
4107
+ count$1(7 /* Metric.LongTaskCount */);
4108
+ max(6 /* Metric.ThreadBlockedTime */, duration);
4093
4109
  }
4094
4110
  };
4095
4111
  }
@@ -4101,7 +4117,7 @@ function bind(target, event, listener, capture) {
4101
4117
  // Wrapping following lines inside try / catch to cover edge cases where we might try to access an inaccessible element.
4102
4118
  // E.g. Iframe may start off as same-origin but later turn into cross-origin, and the following lines will throw an exception.
4103
4119
  try {
4104
- target[api("addEventListener" /* AddEventListener */)](event, listener, capture);
4120
+ target[api("addEventListener" /* Constant.AddEventListener */)](event, listener, capture);
4105
4121
  bindings.push({ event: event, target: target, listener: listener, capture: capture });
4106
4122
  }
4107
4123
  catch ( /* do nothing */_a) { /* do nothing */ }
@@ -4112,7 +4128,7 @@ function reset$1() {
4112
4128
  var binding = bindings_1[_i];
4113
4129
  // Wrapping inside try / catch to avoid situations where the element may be destroyed before we get a chance to unbind
4114
4130
  try {
4115
- binding.target[api("removeEventListener" /* RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4131
+ binding.target[api("removeEventListener" /* Constant.RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4116
4132
  }
4117
4133
  catch ( /* do nothing */_a) { /* do nothing */ }
4118
4134
  }
@@ -4149,8 +4165,8 @@ function start$7() {
4149
4165
  }
4150
4166
  }
4151
4167
  function check$1() {
4152
- if (count++ > 20 /* CallStackDepth */) {
4153
- log$1(4 /* CallStackDepth */, 0 /* Info */);
4168
+ if (count++ > 20 /* Setting.CallStackDepth */) {
4169
+ log$1(4 /* Code.CallStackDepth */, 0 /* Severity.Info */);
4154
4170
  return false;
4155
4171
  }
4156
4172
  return true;
@@ -4160,15 +4176,15 @@ function compute$1() {
4160
4176
  if (url !== getCurrentUrl()) {
4161
4177
  // If the url changed, start tracking it as a new page
4162
4178
  stop();
4163
- window.setTimeout(restart$1, 250 /* RestartDelay */);
4179
+ window.setTimeout(restart$1, 250 /* Setting.RestartDelay */);
4164
4180
  }
4165
4181
  }
4166
4182
  function restart$1() {
4167
4183
  start();
4168
- max(29 /* SinglePage */, 1 /* True */);
4184
+ max(29 /* Metric.SinglePage */, 1 /* BooleanFlag.True */);
4169
4185
  }
4170
4186
  function getCurrentUrl() {
4171
- return location.href ? location.href.replace(location.hash, "" /* Empty */) : location.href;
4187
+ return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
4172
4188
  }
4173
4189
  function stop$6() {
4174
4190
  url = null;
@@ -4231,7 +4247,7 @@ function config(override) {
4231
4247
  // not holding the session during inactive time periods.
4232
4248
  function suspend() {
4233
4249
  if (status) {
4234
- event("clarity" /* Clarity */, "suspend" /* Suspend */);
4250
+ event("clarity" /* Constant.Clarity */, "suspend" /* Constant.Suspend */);
4235
4251
  stop();
4236
4252
  ["mousemove", "touchstart"].forEach(function (x) { return bind(document, x, restart); });
4237
4253
  ["resize", "scroll", "pageshow"].forEach(function (x) { return bind(window, x, restart); });
@@ -4239,7 +4255,7 @@ function suspend() {
4239
4255
  }
4240
4256
  function restart() {
4241
4257
  start();
4242
- event("clarity" /* Clarity */, "restart" /* Restart */);
4258
+ event("clarity" /* Constant.Clarity */, "restart" /* Constant.Restart */);
4243
4259
  }
4244
4260
 
4245
4261
  function start$5() {
@@ -4258,7 +4274,7 @@ var diagnostic = /*#__PURE__*/Object.freeze({
4258
4274
  });
4259
4275
 
4260
4276
  function start$4() {
4261
- schedule$1(discover, 1 /* High */).then(function () {
4277
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
4262
4278
  measure(compute$7)();
4263
4279
  measure(compute$6)();
4264
4280
  });
@@ -4270,12 +4286,12 @@ function discover() {
4270
4286
  switch (_a.label) {
4271
4287
  case 0:
4272
4288
  ts = time();
4273
- timer = { id: id(), cost: 3 /* LayoutCost */ };
4289
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
4274
4290
  start$w(timer);
4275
- return [4 /*yield*/, traverse(document, timer, 0 /* Discover */)];
4291
+ return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
4276
4292
  case 1:
4277
4293
  _a.sent();
4278
- return [4 /*yield*/, encode$4(5 /* Discover */, timer, ts)];
4294
+ return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
4279
4295
  case 2:
4280
4296
  _a.sent();
4281
4297
  stop$t(timer);
@@ -4314,7 +4330,7 @@ function encode (type) {
4314
4330
  t = time();
4315
4331
  tokens = [t, type];
4316
4332
  switch (type) {
4317
- case 29 /* Navigation */:
4333
+ case 29 /* Event.Navigation */:
4318
4334
  tokens.push(data.fetchStart);
4319
4335
  tokens.push(data.connectStart);
4320
4336
  tokens.push(data.connectEnd);
@@ -4363,11 +4379,11 @@ function compute(entry) {
4363
4379
  encodedSize: entry.encodedBodySize ? entry.encodedBodySize : 0,
4364
4380
  decodedSize: entry.decodedBodySize ? entry.decodedBodySize : 0
4365
4381
  };
4366
- encode(29 /* Navigation */);
4382
+ encode(29 /* Event.Navigation */);
4367
4383
  }
4368
4384
 
4369
4385
  var observer;
4370
- var types = ["navigation" /* Navigation */, "resource" /* Resource */, "longtask" /* LongTask */, "first-input" /* FID */, "layout-shift" /* CLS */, "largest-contentful-paint" /* LCP */];
4386
+ var types = ["navigation" /* Constant.Navigation */, "resource" /* Constant.Resource */, "longtask" /* Constant.LongTask */, "first-input" /* Constant.FID */, "layout-shift" /* Constant.CLS */, "largest-contentful-paint" /* Constant.LCP */];
4371
4387
  function start$2() {
4372
4388
  // Check the browser support performance observer as a pre-requisite for any performance measurement
4373
4389
  if (window["PerformanceObserver"] && PerformanceObserver.supportedEntryTypes) {
@@ -4382,7 +4398,7 @@ function start$2() {
4382
4398
  }
4383
4399
  }
4384
4400
  else {
4385
- log$1(3 /* PerformanceObserver */, 0 /* Info */);
4401
+ log$1(3 /* Code.PerformanceObserver */, 0 /* Severity.Info */);
4386
4402
  }
4387
4403
  }
4388
4404
  function observe() {
@@ -4402,15 +4418,15 @@ function observe() {
4402
4418
  if (PerformanceObserver.supportedEntryTypes.indexOf(x) >= 0) {
4403
4419
  // Initialize CLS with a value of zero. It's possible (and recommended) for sites to not have any cumulative layout shift.
4404
4420
  // In those cases, we want to still initialize the metric in Clarity
4405
- if (x === "layout-shift" /* CLS */) {
4406
- sum(9 /* CumulativeLayoutShift */, 0);
4421
+ if (x === "layout-shift" /* Constant.CLS */) {
4422
+ sum(9 /* Metric.CumulativeLayoutShift */, 0);
4407
4423
  }
4408
4424
  observer.observe({ type: x, buffered: true });
4409
4425
  }
4410
4426
  }
4411
4427
  }
4412
4428
  catch (_a) {
4413
- log$1(3 /* PerformanceObserver */, 1 /* Warning */);
4429
+ log$1(3 /* Code.PerformanceObserver */, 1 /* Severity.Warning */);
4414
4430
  }
4415
4431
  }
4416
4432
  function handle(entries) {
@@ -4421,41 +4437,41 @@ function process(entries) {
4421
4437
  for (var i = 0; i < entries.length; i++) {
4422
4438
  var entry = entries[i];
4423
4439
  switch (entry.entryType) {
4424
- case "navigation" /* Navigation */:
4440
+ case "navigation" /* Constant.Navigation */:
4425
4441
  compute(entry);
4426
4442
  break;
4427
- case "resource" /* Resource */:
4443
+ case "resource" /* Constant.Resource */:
4428
4444
  var name_1 = entry.name;
4429
- log(4 /* NetworkHosts */, host(name_1));
4445
+ log(4 /* Dimension.NetworkHosts */, host(name_1));
4430
4446
  if (name_1 === config$1.upload || name_1 === config$1.fallback) {
4431
- max(28 /* UploadTime */, entry.duration);
4447
+ max(28 /* Metric.UploadTime */, entry.duration);
4432
4448
  }
4433
4449
  break;
4434
- case "longtask" /* LongTask */:
4435
- count$1(7 /* LongTaskCount */);
4450
+ case "longtask" /* Constant.LongTask */:
4451
+ count$1(7 /* Metric.LongTaskCount */);
4436
4452
  break;
4437
- case "first-input" /* FID */:
4453
+ case "first-input" /* Constant.FID */:
4438
4454
  if (visible) {
4439
- max(10 /* FirstInputDelay */, entry["processingStart"] - entry.startTime);
4455
+ max(10 /* Metric.FirstInputDelay */, entry["processingStart"] - entry.startTime);
4440
4456
  }
4441
4457
  break;
4442
- case "layout-shift" /* CLS */:
4458
+ case "layout-shift" /* Constant.CLS */:
4443
4459
  // Scale the value to avoid sending back floating point number
4444
4460
  if (visible && !entry["hadRecentInput"]) {
4445
- sum(9 /* CumulativeLayoutShift */, entry["value"] * 1000);
4461
+ sum(9 /* Metric.CumulativeLayoutShift */, entry["value"] * 1000);
4446
4462
  }
4447
4463
  break;
4448
- case "largest-contentful-paint" /* LCP */:
4464
+ case "largest-contentful-paint" /* Constant.LCP */:
4449
4465
  if (visible) {
4450
- max(8 /* LargestPaint */, entry.startTime);
4466
+ max(8 /* Metric.LargestPaint */, entry.startTime);
4451
4467
  }
4452
4468
  break;
4453
4469
  }
4454
4470
  }
4455
- if (performance && "memory" /* Memory */ in performance && performance["memory" /* Memory */].usedJSHeapSize) {
4471
+ if (performance && "memory" /* Constant.Memory */ in performance && performance["memory" /* Constant.Memory */].usedJSHeapSize) {
4456
4472
  // Track consumed memory (MBs) where "memory" API is available
4457
4473
  // Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
4458
- max(30 /* UsedMemory */, Math.abs(performance["memory" /* Memory */].usedJSHeapSize / 1048576 /* MegaByte */));
4474
+ max(30 /* Metric.UsedMemory */, Math.abs(performance["memory" /* Constant.Memory */].usedJSHeapSize / 1048576 /* Setting.MegaByte */));
4459
4475
  }
4460
4476
  }
4461
4477
  function stop$2() {
@@ -4503,7 +4519,7 @@ function start(config$1) {
4503
4519
  // performance impact even further. For reference, we are talking single digit milliseconds optimization here, not seconds.
4504
4520
  function pause() {
4505
4521
  if (active()) {
4506
- event("clarity" /* Clarity */, "pause" /* Pause */);
4522
+ event("clarity" /* Constant.Clarity */, "pause" /* Constant.Pause */);
4507
4523
  pause$1();
4508
4524
  }
4509
4525
  }
@@ -4511,7 +4527,7 @@ function pause() {
4511
4527
  function resume() {
4512
4528
  if (active()) {
4513
4529
  resume$1();
4514
- event("clarity" /* Clarity */, "resume" /* Resume */);
4530
+ event("clarity" /* Constant.Clarity */, "resume" /* Constant.Resume */);
4515
4531
  }
4516
4532
  }
4517
4533
  function stop() {