clarity-js 0.6.34 → 0.6.37

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
@@ -62,7 +62,6 @@ var metadata$1 = /*#__PURE__*/Object.freeze({
62
62
  get data () { return data$2; },
63
63
  get callbacks () { return callbacks; },
64
64
  get start () { return start$9; },
65
- get userAgentData () { return userAgentData; },
66
65
  get stop () { return stop$8; },
67
66
  get metadata () { return metadata; },
68
67
  get id () { return id; },
@@ -80,7 +79,7 @@ var envelope$1 = /*#__PURE__*/Object.freeze({
80
79
 
81
80
  var config$1 = {
82
81
  projectId: null,
83
- delay: 1 * 1000 /* Second */,
82
+ delay: 1 * 1000 /* Time.Second */,
84
83
  lean: false,
85
84
  track: true,
86
85
  content: true,
@@ -89,6 +88,7 @@ var config$1 = {
89
88
  regions: [],
90
89
  extract: [],
91
90
  cookies: [],
91
+ fraud: [],
92
92
  report: null,
93
93
  upload: null,
94
94
  fallback: null,
@@ -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;
@@ -111,11 +111,11 @@ function time(ts) {
111
111
  ts = ts ? ts : performance.now();
112
112
  return Math.max(Math.round(ts - startTime), 0);
113
113
  }
114
- function stop$C() {
114
+ function stop$B() {
115
115
  startTime = 0;
116
116
  }
117
117
 
118
- var version$1 = "0.6.34";
118
+ var version$1 = "0.6.37";
119
119
 
120
120
  // tslint:disable: no-bitwise
121
121
  function hash (input) {
@@ -142,13 +142,13 @@ var buffer = null;
142
142
  var update$2 = false;
143
143
  function start$E() {
144
144
  update$2 = false;
145
- reset$p();
145
+ reset$o();
146
146
  }
147
- function reset$p() {
147
+ 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$p() {
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$p() {
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,31 +200,31 @@ 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
  }
207
207
  update$2 = true;
208
208
  }
209
- function compute$d() {
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
- function stop$B() {
215
- reset$p();
214
+ function stop$A() {
215
+ reset$o();
216
216
  }
217
217
 
218
218
  var baseline = /*#__PURE__*/Object.freeze({
219
219
  __proto__: null,
220
220
  get state () { return state$9; },
221
221
  start: start$E,
222
- reset: reset$p,
222
+ reset: reset$o,
223
223
  track: track$7,
224
224
  activity: activity,
225
225
  visibility: visibility,
226
- compute: compute$d,
227
- stop: stop$B
226
+ compute: compute$c,
227
+ stop: stop$A
228
228
  });
229
229
 
230
230
  var data$j = null;
@@ -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,22 +246,21 @@ 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
- function stop$A() {
251
+ function stop$z() {
252
252
  data$i = {};
253
253
  updates$3 = {};
254
254
  }
255
- function count$1(metric, increment) {
256
- if (increment === void 0) { increment = 1; }
255
+ function count$1(metric) {
257
256
  if (!(metric in data$i)) {
258
257
  data$i[metric] = 0;
259
258
  }
260
259
  if (!(metric in updates$3)) {
261
260
  updates$3[metric] = 0;
262
261
  }
263
- data$i[metric] += increment;
264
- updates$3[metric] += increment;
262
+ data$i[metric]++;
263
+ updates$3[metric]++;
265
264
  }
266
265
  function sum(metric, value) {
267
266
  if (value !== null) {
@@ -287,10 +286,10 @@ function max(metric, value) {
287
286
  }
288
287
  }
289
288
  }
290
- function compute$c() {
291
- encode$1(0 /* Metric */);
289
+ function compute$b() {
290
+ encode$1(0 /* Event.Metric */);
292
291
  }
293
- function reset$o() {
292
+ function reset$n() {
294
293
  updates$3 = {};
295
294
  }
296
295
 
@@ -306,10 +305,10 @@ var last = 0;
306
305
  var interval = 0;
307
306
  var timeout$6 = null;
308
307
  function start$C() {
309
- interval = 60000 /* PingInterval */;
308
+ interval = 60000 /* Setting.PingInterval */;
310
309
  last = 0;
311
310
  }
312
- function reset$n() {
311
+ function reset$m() {
313
312
  if (timeout$6) {
314
313
  clearTimeout(timeout$6);
315
314
  }
@@ -319,15 +318,15 @@ function reset$n() {
319
318
  function ping() {
320
319
  var now = time();
321
320
  data$h = { gap: now - last };
322
- encode$1(25 /* Ping */);
323
- if (data$h.gap < 300000 /* PingTimeout */) {
321
+ encode$1(25 /* Event.Ping */);
322
+ if (data$h.gap < 300000 /* Setting.PingTimeout */) {
324
323
  timeout$6 = setTimeout(ping, interval);
325
324
  }
326
325
  else {
327
326
  suspend();
328
327
  }
329
328
  }
330
- function stop$z() {
329
+ function stop$y() {
331
330
  clearTimeout(timeout$6);
332
331
  last = 0;
333
332
  interval = 0;
@@ -337,15 +336,15 @@ var ping$1 = /*#__PURE__*/Object.freeze({
337
336
  __proto__: null,
338
337
  get data () { return data$h; },
339
338
  start: start$C,
340
- reset: reset$n,
341
- stop: stop$z
339
+ reset: reset$m,
340
+ stop: stop$y
342
341
  });
343
342
 
344
343
  var data$g = null;
345
344
  function start$B() {
346
345
  data$g = {};
347
346
  }
348
- function stop$y() {
347
+ function stop$x() {
349
348
  data$g = {};
350
349
  }
351
350
  function track$6(event, time) {
@@ -357,7 +356,7 @@ function track$6(event, time) {
357
356
  var last = e[e.length - 1];
358
357
  // Add a new entry only if the new event occurs after configured interval
359
358
  // Otherwise, extend the duration of the previous entry
360
- if (time - last[0] > 100 /* SummaryInterval */) {
359
+ if (time - last[0] > 100 /* Setting.SummaryInterval */) {
361
360
  data$g[event].push([time, 0]);
362
361
  }
363
362
  else {
@@ -365,10 +364,10 @@ function track$6(event, time) {
365
364
  }
366
365
  }
367
366
  }
368
- function compute$b() {
369
- encode$1(36 /* Summary */);
367
+ function compute$a() {
368
+ encode$1(36 /* Event.Summary */);
370
369
  }
371
- function reset$m() {
370
+ function reset$l() {
372
371
  data$g = {};
373
372
  }
374
373
 
@@ -376,16 +375,16 @@ var summary = /*#__PURE__*/Object.freeze({
376
375
  __proto__: null,
377
376
  get data () { return data$g; },
378
377
  start: start$B,
379
- stop: stop$y,
378
+ stop: stop$x,
380
379
  track: track$6,
381
- compute: compute$b,
382
- reset: reset$m
380
+ compute: compute$a,
381
+ reset: reset$l
383
382
  });
384
383
 
385
384
  var data$f = null;
386
385
  function start$A() {
387
386
  if (!config$1.lean && config$1.upgrade) {
388
- config$1.upgrade("Config" /* Config */);
387
+ config$1.upgrade("Config" /* Constant.Config */);
389
388
  }
390
389
  data$f = null;
391
390
  }
@@ -404,10 +403,10 @@ function upgrade(key) {
404
403
  if (config$1.upgrade) {
405
404
  config$1.upgrade(key);
406
405
  }
407
- encode$1(3 /* Upgrade */);
406
+ encode$1(3 /* Event.Upgrade */);
408
407
  }
409
408
  }
410
- function stop$x() {
409
+ function stop$w() {
411
410
  data$f = null;
412
411
  }
413
412
 
@@ -416,47 +415,47 @@ var upgrade$1 = /*#__PURE__*/Object.freeze({
416
415
  get data () { return data$f; },
417
416
  start: start$A,
418
417
  upgrade: upgrade,
419
- stop: stop$x
418
+ stop: stop$w
420
419
  });
421
420
 
422
421
  var data$e = null;
423
422
  function start$z() {
424
- reset$l();
423
+ reset$k();
425
424
  }
426
425
  function set(variable, value) {
427
- var values = typeof value === "string" /* String */ ? [value] : value;
426
+ var values = typeof value === "string" /* Constant.String */ ? [value] : value;
428
427
  log$2(variable, values);
429
428
  }
430
429
  function identify(userId, sessionId, pageId) {
431
430
  if (sessionId === void 0) { sessionId = null; }
432
431
  if (pageId === void 0) { pageId = null; }
433
- log$2("userId" /* UserId */, [userId]);
434
- log$2("sessionId" /* SessionId */, [sessionId]);
435
- 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]);
436
435
  }
437
436
  function log$2(variable, value) {
438
437
  if (active() &&
439
438
  variable &&
440
439
  value &&
441
- typeof variable === "string" /* String */ &&
440
+ typeof variable === "string" /* Constant.String */ &&
442
441
  variable.length < 255) {
443
442
  var validValues = variable in data$e ? data$e[variable] : [];
444
443
  for (var i = 0; i < value.length; i++) {
445
- if (typeof value[i] === "string" /* String */ && value[i].length < 255) {
444
+ if (typeof value[i] === "string" /* Constant.String */ && value[i].length < 255) {
446
445
  validValues.push(value[i]);
447
446
  }
448
447
  }
449
448
  data$e[variable] = validValues;
450
449
  }
451
450
  }
452
- function compute$a() {
453
- encode$1(34 /* Variable */);
451
+ function compute$9() {
452
+ encode$1(34 /* Event.Variable */);
454
453
  }
455
- function reset$l() {
454
+ function reset$k() {
456
455
  data$e = {};
457
456
  }
458
- function stop$w() {
459
- reset$l();
457
+ function stop$v() {
458
+ reset$k();
460
459
  }
461
460
 
462
461
  var variable = /*#__PURE__*/Object.freeze({
@@ -465,12 +464,12 @@ var variable = /*#__PURE__*/Object.freeze({
465
464
  start: start$z,
466
465
  set: set,
467
466
  identify: identify,
468
- compute: compute$a,
469
- reset: reset$l,
470
- stop: stop$w
467
+ compute: compute$9,
468
+ reset: reset$k,
469
+ stop: stop$v
471
470
  });
472
471
 
473
- /*! *****************************************************************************
472
+ /******************************************************************************
474
473
  Copyright (c) Microsoft Corporation.
475
474
 
476
475
  Permission to use, copy, modify, and/or distribute this software for any
@@ -523,7 +522,7 @@ function __generator(thisArg, body) {
523
522
  }
524
523
  }
525
524
 
526
- var supported$1 = "CompressionStream" /* CompressionStream */ in window;
525
+ var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
527
526
  function compress (input) {
528
527
  return __awaiter(this, void 0, void 0, function () {
529
528
  var stream, _a;
@@ -540,7 +539,7 @@ function compress (input) {
540
539
  return [2 /*return*/];
541
540
  });
542
541
  });
543
- } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* CompressionStream */]("gzip"));
542
+ } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* Constant.CompressionStream */]("gzip"));
544
543
  _a = Uint8Array.bind;
545
544
  return [4 /*yield*/, read(stream)];
546
545
  case 1: return [2 /*return*/, new (_a.apply(Uint8Array, [void 0, _c.sent()]))()];
@@ -587,20 +586,20 @@ function start$y() {
587
586
  start$D();
588
587
  modules$1.forEach(function (x) { return measure(x.start)(); });
589
588
  }
590
- function stop$v() {
589
+ function stop$u() {
591
590
  // Stop modules in the reverse order of their initialization
592
591
  // The ordering below should respect inter-module dependency.
593
592
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
594
593
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
595
594
  modules$1.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
596
- stop$A();
595
+ stop$z();
597
596
  }
598
- function compute$9() {
599
- compute$a();
600
- compute$d();
601
- compute$2();
597
+ function compute$8() {
598
+ compute$9();
602
599
  compute$c();
600
+ compute$2();
603
601
  compute$b();
602
+ compute$a();
604
603
  compute$3();
605
604
  compute$4();
606
605
  }
@@ -609,11 +608,11 @@ function scrub (value, hint, privacy, mangle) {
609
608
  if (mangle === void 0) { mangle = false; }
610
609
  if (value) {
611
610
  switch (privacy) {
612
- case 0 /* None */:
611
+ case 0 /* Privacy.None */:
613
612
  return value;
614
- case 1 /* Sensitive */:
613
+ case 1 /* Privacy.Sensitive */:
615
614
  switch (hint) {
616
- case "*T" /* TextTag */:
615
+ case "*T" /* Layout.Constant.TextTag */:
617
616
  case "value":
618
617
  case "placeholder":
619
618
  return redact(value);
@@ -621,16 +620,16 @@ function scrub (value, hint, privacy, mangle) {
621
620
  return mangleToken(value);
622
621
  }
623
622
  return value;
624
- case 2 /* Text */:
625
- case 3 /* TextImage */:
623
+ case 2 /* Privacy.Text */:
624
+ case 3 /* Privacy.TextImage */:
626
625
  switch (hint) {
627
- case "*T" /* TextTag */:
626
+ case "*T" /* Layout.Constant.TextTag */:
628
627
  return mangle ? mangleText(value) : mask(value);
629
628
  case "src":
630
629
  case "srcset":
631
630
  case "title":
632
631
  case "alt":
633
- return privacy === 3 /* TextImage */ ? "" /* Empty */ : value;
632
+ return privacy === 3 /* Privacy.TextImage */ ? "" /* Data.Constant.Empty */ : value;
634
633
  case "value":
635
634
  case "click":
636
635
  case "input":
@@ -650,18 +649,18 @@ function mangleText(value) {
650
649
  var index = value.indexOf(first);
651
650
  var prefix = value.substr(0, index);
652
651
  var suffix = value.substr(index + trimmed.length);
653
- return "" + prefix + trimmed.length.toString(36) + suffix;
652
+ return "".concat(prefix).concat(trimmed.length.toString(36)).concat(suffix);
654
653
  }
655
654
  return value;
656
655
  }
657
656
  function mask(value) {
658
- return value.replace(/\S/gi, "\u2022" /* Mask */);
657
+ return value.replace(/\S/gi, "\u2022" /* Data.Constant.Mask */);
659
658
  }
660
659
  function mangleToken(value) {
661
- var length = ((Math.floor(value.length / 5 /* WordLength */) + 1) * 5 /* WordLength */);
662
- var output = "" /* Empty */;
660
+ var length = ((Math.floor(value.length / 5 /* Data.Setting.WordLength */) + 1) * 5 /* Data.Setting.WordLength */);
661
+ var output = "" /* Layout.Constant.Empty */;
663
662
  for (var i = 0; i < length; i++) {
664
- output += i > 0 && i % 5 /* WordLength */ === 0 ? " " /* Space */ : "\u2022" /* Mask */;
663
+ output += i > 0 && i % 5 /* Data.Setting.WordLength */ === 0 ? " " /* Data.Constant.Space */ : "\u2022" /* Data.Constant.Mask */;
665
664
  }
666
665
  return output;
667
666
  }
@@ -673,15 +672,15 @@ function redact(value) {
673
672
  var array = null;
674
673
  for (var i = 0; i < value.length; i++) {
675
674
  var c = value.charCodeAt(i);
676
- hasDigit = hasDigit || (c >= 48 /* Zero */ && c <= 57 /* Nine */); // Check for digits in the current word
677
- hasEmail = hasEmail || c === 64 /* At */; // Check for @ sign anywhere within the current word
678
- hasWhitespace = c === 9 /* Tab */ || c === 10 /* NewLine */ || c === 13 /* Return */ || c === 32 /* Blank */;
675
+ hasDigit = hasDigit || (c >= 48 /* Data.Character.Zero */ && c <= 57 /* Data.Character.Nine */); // Check for digits in the current word
676
+ hasEmail = hasEmail || c === 64 /* Data.Character.At */; // Check for @ sign anywhere within the current word
677
+ hasWhitespace = c === 9 /* Data.Character.Tab */ || c === 10 /* Data.Character.NewLine */ || c === 13 /* Data.Character.Return */ || c === 32 /* Data.Character.Blank */;
679
678
  // Process each word as an individual token to redact any sensitive information
680
679
  if (i === 0 || i === value.length - 1 || hasWhitespace) {
681
680
  // Performance optimization: Lazy load string -> array conversion only when required
682
681
  if (hasDigit || hasEmail) {
683
682
  if (array === null) {
684
- array = value.split("" /* Empty */);
683
+ array = value.split("" /* Data.Constant.Empty */);
685
684
  }
686
685
  mutate(array, spaceIndex, hasWhitespace ? i : i + 1);
687
686
  }
@@ -693,11 +692,29 @@ function redact(value) {
693
692
  }
694
693
  }
695
694
  }
696
- return array ? array.join("" /* Empty */) : value;
695
+ return array ? array.join("" /* Data.Constant.Empty */) : value;
697
696
  }
698
697
  function mutate(array, start, end) {
699
698
  for (var i = start + 1; i < end; i++) {
700
- array[i] = "\u2022" /* Mask */;
699
+ array[i] = "\u2022" /* Data.Constant.Mask */;
700
+ }
701
+ }
702
+
703
+ var history$5 = [];
704
+ var data$d;
705
+ function start$x() {
706
+ history$5 = [];
707
+ max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
708
+ }
709
+ function check$4(id, target, input) {
710
+ // Compute hash for fraud detection. Hash is computed only if input meets the minimum length criteria
711
+ if (id !== null && input && input.length >= 5 /* Setting.WordLength */) {
712
+ data$d = { id: id, target: target, hash: hash(input) };
713
+ // Only encode this event if we haven't already reported this hash
714
+ if (history$5.indexOf(data$d.hash) < 0) {
715
+ history$5.push(data$d.hash);
716
+ encode$2(41 /* Event.Fraud */);
717
+ }
701
718
  }
702
719
  }
703
720
 
@@ -705,45 +722,45 @@ var TAGS = ["DIV", "TR", "P", "LI", "UL", "A", "BUTTON"];
705
722
  function selector (input, beta) {
706
723
  if (beta === void 0) { beta = false; }
707
724
  var a = input.attributes;
708
- var prefix = input.prefix ? input.prefix[beta ? 1 /* Beta */ : 0 /* Stable */] : null;
709
- var suffix = beta || ((a && !("class" /* Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(" + input.position + ")" : "" /* Empty */;
725
+ var prefix = input.prefix ? input.prefix[beta ? 1 /* Selector.Beta */ : 0 /* Selector.Stable */] : null;
726
+ var suffix = beta || ((a && !("class" /* Constant.Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(".concat(input.position, ")") : "" /* Constant.Empty */;
710
727
  switch (input.tag) {
711
728
  case "STYLE":
712
729
  case "TITLE":
713
730
  case "LINK":
714
731
  case "META":
715
- case "*T" /* TextTag */:
716
- case "*D" /* DocumentTag */:
717
- return "" /* Empty */;
732
+ case "*T" /* Constant.TextTag */:
733
+ case "*D" /* Constant.DocumentTag */:
734
+ return "" /* Constant.Empty */;
718
735
  case "HTML":
719
- return "HTML" /* HTML */;
736
+ return "HTML" /* Constant.HTML */;
720
737
  default:
721
738
  if (prefix === null) {
722
- return "" /* Empty */;
739
+ return "" /* Constant.Empty */;
723
740
  }
724
- prefix = prefix + ">";
725
- input.tag = input.tag.indexOf("svg:" /* SvgPrefix */) === 0 ? input.tag.substr("svg:" /* SvgPrefix */.length) : input.tag;
726
- var selector = "" + prefix + input.tag + suffix;
727
- var classes = "class" /* Class */ in a && a["class" /* Class */].length > 0 ? a["class" /* Class */].trim().split(/\s+/) : null;
741
+ prefix = "".concat(prefix, ">");
742
+ input.tag = input.tag.indexOf("svg:" /* Constant.SvgPrefix */) === 0 ? input.tag.substr("svg:" /* Constant.SvgPrefix */.length) : input.tag;
743
+ var selector = "".concat(prefix).concat(input.tag).concat(suffix);
744
+ var classes = "class" /* Constant.Class */ in a && a["class" /* Constant.Class */].length > 0 ? a["class" /* Constant.Class */].trim().split(/\s+/) : null;
728
745
  if (beta) {
729
746
  // In beta mode, update selector to use "id" field when available. There are two exceptions:
730
747
  // (1) if "id" appears to be an auto generated string token, e.g. guid or a random id containing digits
731
748
  // (2) if "id" appears inside a shadow DOM, in which case we continue to prefix up to shadow DOM to prevent conflicts
732
- var id = "id" /* Id */ in a && a["id" /* Id */].length > 0 ? a["id" /* Id */] : null;
733
- classes = input.tag !== "BODY" /* BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
734
- selector = classes.length > 0 ? "" + prefix + input.tag + "." + classes.join(".") + suffix : selector;
735
- selector = id && hasDigits(id) === false ? getDomPrefix(prefix) + "#" + id : selector;
749
+ var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
750
+ classes = input.tag !== "BODY" /* Constant.BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
751
+ selector = classes.length > 0 ? "".concat(prefix).concat(input.tag, ".").concat(classes.join(".")).concat(suffix) : selector;
752
+ selector = id && hasDigits(id) === false ? "".concat(getDomPrefix(prefix), "#").concat(id) : selector;
736
753
  }
737
754
  else {
738
755
  // Otherwise, fallback to stable mode, where we include class names as part of the selector
739
- selector = classes ? "" + prefix + input.tag + "." + classes.join(".") + suffix : selector;
756
+ selector = classes ? "".concat(prefix).concat(input.tag, ".").concat(classes.join(".")).concat(suffix) : selector;
740
757
  }
741
758
  return selector;
742
759
  }
743
760
  }
744
761
  function getDomPrefix(prefix) {
745
- var shadowDomStart = prefix.lastIndexOf("*S" /* ShadowDomTag */);
746
- var iframeDomStart = prefix.lastIndexOf("" + "iframe:" /* IFramePrefix */ + "HTML" /* HTML */);
762
+ var shadowDomStart = prefix.lastIndexOf("*S" /* Constant.ShadowDomTag */);
763
+ var iframeDomStart = prefix.lastIndexOf("".concat("iframe:" /* Constant.IFramePrefix */).concat("HTML" /* Constant.HTML */));
747
764
  var domStart = Math.max(shadowDomStart, iframeDomStart);
748
765
  if (domStart < 0) {
749
766
  return "";
@@ -755,7 +772,7 @@ function getDomPrefix(prefix) {
755
772
  function hasDigits(value) {
756
773
  for (var i = 0; i < value.length; i++) {
757
774
  var c = value.charCodeAt(i);
758
- if (c >= 48 /* Zero */ && c <= 57 /* Nine */) {
775
+ if (c >= 48 /* Character.Zero */ && c <= 57 /* Character.Nine */) {
759
776
  return true;
760
777
  }
761
778
  }
@@ -785,14 +802,14 @@ function resume$1() {
785
802
  }
786
803
  }
787
804
  }
788
- function reset$k() {
805
+ function reset$j() {
789
806
  tracker = {};
790
807
  queuedTasks = [];
791
808
  activeTask = null;
792
809
  pauseTask = null;
793
810
  }
794
811
  function schedule$1(task, priority) {
795
- if (priority === void 0) { priority = 0 /* Normal */; }
812
+ if (priority === void 0) { priority = 0 /* Priority.Normal */; }
796
813
  return __awaiter(this, void 0, void 0, function () {
797
814
  var _i, queuedTasks_1, q, promise;
798
815
  return __generator(this, function (_a) {
@@ -804,7 +821,7 @@ function schedule$1(task, priority) {
804
821
  }
805
822
  }
806
823
  promise = new Promise(function (resolve) {
807
- var insert = priority === 1 /* High */ ? "unshift" : "push";
824
+ var insert = priority === 1 /* Priority.High */ ? "unshift" : "push";
808
825
  // Queue this task for asynchronous execution later
809
826
  // We also store a unique page identifier (id) along with the task to ensure
810
827
  // ensure that we do not accidentally execute this task in context of a different page
@@ -839,7 +856,7 @@ function run() {
839
856
  return;
840
857
  }
841
858
  if (error) {
842
- log$1(0 /* RunTask */, 1 /* Warning */, error.name, error.message, error.stack);
859
+ log$1(0 /* Code.RunTask */, 1 /* Severity.Warning */, error.name, error.message, error.stack);
843
860
  }
844
861
  activeTask = null;
845
862
  run();
@@ -850,34 +867,34 @@ function state$8(timer) {
850
867
  var id = key(timer);
851
868
  if (id in tracker) {
852
869
  var elapsed = performance.now() - tracker[id].start;
853
- return (elapsed > tracker[id].yield) ? 0 /* Wait */ : 1 /* Run */;
870
+ return (elapsed > tracker[id].yield) ? 0 /* Task.Wait */ : 1 /* Task.Run */;
854
871
  }
855
872
  // If this task is no longer being tracked, send stop message to the caller
856
- return 2 /* Stop */;
873
+ return 2 /* Task.Stop */;
857
874
  }
858
- function start$x(timer) {
859
- tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* LongTask */ };
875
+ function start$w(timer) {
876
+ tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
860
877
  }
861
- function restart$1(timer) {
878
+ function restart$2(timer) {
862
879
  var id = key(timer);
863
880
  if (tracker && tracker[id]) {
864
881
  var c = tracker[id].calls;
865
882
  var y = tracker[id].yield;
866
- start$x(timer);
883
+ start$w(timer);
867
884
  tracker[id].calls = c + 1;
868
885
  tracker[id].yield = y;
869
886
  }
870
887
  }
871
- function stop$u(timer) {
888
+ function stop$t(timer) {
872
889
  var end = performance.now();
873
890
  var id = key(timer);
874
891
  var duration = end - tracker[id].start;
875
892
  sum(timer.cost, duration);
876
- count$1(5 /* InvokeCount */);
893
+ count$1(5 /* Metric.InvokeCount */);
877
894
  // For the first execution, which is synchronous, time is automatically counted towards TotalDuration.
878
895
  // However, for subsequent asynchronous runs, we need to manually update TotalDuration metric.
879
896
  if (tracker[id].calls > 0) {
880
- sum(4 /* TotalCost */, duration);
897
+ sum(4 /* Metric.TotalCost */, duration);
881
898
  }
882
899
  }
883
900
  function suspend$1(timer) {
@@ -888,23 +905,23 @@ function suspend$1(timer) {
888
905
  case 0:
889
906
  id = key(timer);
890
907
  if (!(id in tracker)) return [3 /*break*/, 2];
891
- stop$u(timer);
908
+ stop$t(timer);
892
909
  _a = tracker[id];
893
910
  return [4 /*yield*/, wait()];
894
911
  case 1:
895
912
  _a.yield = (_b.sent()).timeRemaining();
896
- restart$1(timer);
913
+ restart$2(timer);
897
914
  _b.label = 2;
898
915
  case 2:
899
916
  // After we are done with suspending task, ensure that we are still operating in the right context
900
917
  // If the task is still being tracked, continue running the task, otherwise ask caller to stop execution
901
- return [2 /*return*/, id in tracker ? 1 /* Run */ : 2 /* Stop */];
918
+ return [2 /*return*/, id in tracker ? 1 /* Task.Run */ : 2 /* Task.Stop */];
902
919
  }
903
920
  });
904
921
  });
905
922
  }
906
923
  function key(timer) {
907
- return timer.id + "." + timer.cost;
924
+ return "".concat(timer.id, ".").concat(timer.cost);
908
925
  }
909
926
  function wait() {
910
927
  return __awaiter(this, void 0, void 0, function () {
@@ -942,14 +959,14 @@ function requestIdleCallbackPolyfill(callback, options) {
942
959
  var currentTime = performance.now();
943
960
  var elapsed = currentTime - startTime;
944
961
  var duration = currentTime - event.data;
945
- if (duration > 30 /* LongTask */ && elapsed < options.timeout) {
962
+ if (duration > 30 /* Setting.LongTask */ && elapsed < options.timeout) {
946
963
  requestAnimationFrame(function () { outgoing.postMessage(currentTime); });
947
964
  }
948
965
  else {
949
966
  var didTimeout_1 = elapsed > options.timeout;
950
967
  callback({
951
968
  didTimeout: didTimeout_1,
952
- timeRemaining: function () { return didTimeout_1 ? 30 /* LongTask */ : Math.max(0, 30 /* LongTask */ - duration); }
969
+ timeRemaining: function () { return didTimeout_1 ? 30 /* Setting.LongTask */ : Math.max(0, 30 /* Setting.LongTask */ - duration); }
953
970
  });
954
971
  }
955
972
  };
@@ -970,7 +987,7 @@ function tokenize (tokens) {
970
987
  var reference = null;
971
988
  for (var i = 0; i < tokens.length; i++) {
972
989
  // Only optimize for string values
973
- if (typeof tokens[i] === "string" /* String */) {
990
+ if (typeof tokens[i] === "string" /* Constant.String */) {
974
991
  var token = tokens[i];
975
992
  var index = lookup[token] || -1;
976
993
  if (index >= 0) {
@@ -1000,114 +1017,35 @@ function tokenize (tokens) {
1000
1017
  return output;
1001
1018
  }
1002
1019
 
1003
- var data$d = [];
1004
- var enabled = false;
1005
- var observer$2 = null;
1006
- function start$w() {
1007
- reset$j();
1008
- observer$2 = null;
1009
- enabled = window["ResizeObserver"] ? true : false;
1010
- }
1011
- function compute$8(id) {
1012
- if (enabled === false) {
1013
- return;
1014
- }
1015
- observer$2 = observer$2 === null ? new ResizeObserver(handler$4) : observer$2;
1016
- if (observer$2) {
1017
- var value = getValue(id);
1018
- // If this is the first time computing size for this node, go ahead and wire up ResizeObserver
1019
- // In all other cases, value.metadata.size will be null or an array with two elements [width, height]
1020
- // And, in those cases, we will skip through the following section and not attach the observer
1021
- if (value && value.metadata.size !== null && value.metadata.size.length === 0) {
1022
- var node = getNode(id);
1023
- if (node && node.nodeType === Node.ELEMENT_NODE) {
1024
- var e = node;
1025
- var r = e.getBoundingClientRect();
1026
- value.metadata.size = [Math.floor(r.width * 100 /* BoxPrecision */), Math.floor(r.height * 100 /* BoxPrecision */)];
1027
- observer$2.observe(e);
1028
- }
1029
- }
1030
- }
1031
- }
1032
- function handler$4(entries) {
1033
- window.requestAnimationFrame(function () {
1034
- for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
1035
- var entry = entries_1[_i];
1036
- var target = entry.target;
1037
- var id = target ? getId(target) : null;
1038
- if (id) {
1039
- var v = getValue(id);
1040
- var s = v.metadata.size;
1041
- var b = entry.borderBoxSize;
1042
- var w = null;
1043
- var h = null;
1044
- // Check if browser supports borderBoxSize property on ResizeObserverEntry object
1045
- // Otherwise, fall back to using getBoundingClientRect() to be cross browser compatible
1046
- // Reference: https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/borderBoxSize
1047
- if (b && b.length > 0) {
1048
- w = Math.floor(b[0].inlineSize * 100 /* BoxPrecision */);
1049
- h = Math.floor(b[0].blockSize * 100 /* BoxPrecision */);
1050
- }
1051
- else {
1052
- var r = target.getBoundingClientRect();
1053
- w = Math.floor(r.width * 100 /* BoxPrecision */);
1054
- h = Math.floor(r.height * 100 /* BoxPrecision */);
1055
- }
1056
- // Capture new width & height only if they are different from what we have in in-memory cache
1057
- if (w !== s[0] && h !== s[1]) {
1058
- s = [w, h];
1059
- data$d.push({ id: id, width: w, height: h });
1060
- }
1061
- }
1062
- }
1063
- // Schedule encode only when we have at least one valid data entry
1064
- if (data$d.length > 0) {
1065
- encode$4(37 /* Box */);
1066
- }
1067
- });
1068
- }
1069
- function reset$j() {
1070
- data$d = [];
1071
- }
1072
- function stop$t() {
1073
- reset$j();
1074
- if (observer$2) {
1075
- observer$2.disconnect();
1076
- observer$2 = null;
1077
- }
1078
- enabled = false;
1079
- }
1080
-
1081
1020
  function encode$4 (type, timer, ts) {
1082
1021
  if (timer === void 0) { timer = null; }
1083
1022
  if (ts === void 0) { ts = null; }
1084
1023
  return __awaiter(this, void 0, void 0, function () {
1085
- var eventTime, tokens, _a, d, _i, _b, r, b, _c, b_1, entry, values, _d, values_1, value, state, data, active, suspend, privacy, mangle, keys, _e, keys_1, key, size, factor, attr;
1086
- return __generator(this, function (_f) {
1087
- switch (_f.label) {
1024
+ var eventTime, tokens, _a, d, _i, _b, r, values, _c, values_1, value, state, data, active, suspend, privacy, mangle, keys, _d, keys_1, key, box, factor, attr;
1025
+ return __generator(this, function (_e) {
1026
+ switch (_e.label) {
1088
1027
  case 0:
1089
1028
  eventTime = ts || time();
1090
1029
  tokens = [eventTime, type];
1091
1030
  _a = type;
1092
1031
  switch (_a) {
1093
- case 8 /* Document */: return [3 /*break*/, 1];
1094
- case 7 /* Region */: return [3 /*break*/, 2];
1095
- case 37 /* Box */: return [3 /*break*/, 3];
1096
- case 5 /* Discover */: return [3 /*break*/, 4];
1097
- case 6 /* Mutation */: return [3 /*break*/, 4];
1032
+ case 8 /* Event.Document */: return [3 /*break*/, 1];
1033
+ case 7 /* Event.Region */: return [3 /*break*/, 2];
1034
+ case 5 /* Event.Discover */: return [3 /*break*/, 3];
1035
+ case 6 /* Event.Mutation */: return [3 /*break*/, 3];
1098
1036
  }
1099
- return [3 /*break*/, 11];
1037
+ return [3 /*break*/, 10];
1100
1038
  case 1:
1101
1039
  d = data$c;
1102
1040
  tokens.push(d.width);
1103
1041
  tokens.push(d.height);
1104
1042
  track$7(type, d.width, d.height);
1105
1043
  queue(tokens);
1106
- return [3 /*break*/, 11];
1044
+ return [3 /*break*/, 10];
1107
1045
  case 2:
1108
1046
  for (_i = 0, _b = state$1; _i < _b.length; _i++) {
1109
1047
  r = _b[_i];
1110
- tokens = [r.time, 7 /* Region */];
1048
+ tokens = [r.time, 7 /* Event.Region */];
1111
1049
  tokens.push(r.data.id);
1112
1050
  tokens.push(r.data.interaction);
1113
1051
  tokens.push(r.data.visibility);
@@ -1115,39 +1053,28 @@ function encode$4 (type, timer, ts) {
1115
1053
  queue(tokens);
1116
1054
  }
1117
1055
  reset$6();
1118
- return [3 /*break*/, 11];
1056
+ return [3 /*break*/, 10];
1119
1057
  case 3:
1120
- b = data$d;
1121
- for (_c = 0, b_1 = b; _c < b_1.length; _c++) {
1122
- entry = b_1[_c];
1123
- tokens.push(entry.id);
1124
- tokens.push(entry.width);
1125
- tokens.push(entry.height);
1126
- }
1127
- reset$j();
1128
- queue(tokens);
1129
- return [3 /*break*/, 11];
1130
- case 4:
1131
1058
  // Check if we are operating within the context of the current page
1132
- if (state$8(timer) === 2 /* Stop */) {
1133
- return [3 /*break*/, 11];
1059
+ if (state$8(timer) === 2 /* Task.Stop */) {
1060
+ return [3 /*break*/, 10];
1134
1061
  }
1135
1062
  values = updates$2();
1136
- if (!(values.length > 0)) return [3 /*break*/, 10];
1137
- _d = 0, values_1 = values;
1138
- _f.label = 5;
1139
- case 5:
1140
- if (!(_d < values_1.length)) return [3 /*break*/, 9];
1141
- value = values_1[_d];
1063
+ if (!(values.length > 0)) return [3 /*break*/, 9];
1064
+ _c = 0, values_1 = values;
1065
+ _e.label = 4;
1066
+ case 4:
1067
+ if (!(_c < values_1.length)) return [3 /*break*/, 8];
1068
+ value = values_1[_c];
1142
1069
  state = state$8(timer);
1143
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 7];
1070
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 6];
1144
1071
  return [4 /*yield*/, suspend$1(timer)];
1072
+ case 5:
1073
+ state = _e.sent();
1074
+ _e.label = 6;
1145
1075
  case 6:
1146
- state = _f.sent();
1147
- _f.label = 7;
1148
- case 7:
1149
- if (state === 2 /* Stop */) {
1150
- return [3 /*break*/, 9];
1076
+ if (state === 2 /* Task.Stop */) {
1077
+ return [3 /*break*/, 8];
1151
1078
  }
1152
1079
  data = value.data;
1153
1080
  active = value.metadata.active;
@@ -1155,13 +1082,12 @@ function encode$4 (type, timer, ts) {
1155
1082
  privacy = value.metadata.privacy;
1156
1083
  mangle = shouldMangle(value);
1157
1084
  keys = active ? ["tag", "attributes", "value"] : ["tag"];
1158
- compute$8(value.id);
1159
- for (_e = 0, keys_1 = keys; _e < keys_1.length; _e++) {
1160
- key = keys_1[_e];
1085
+ for (_d = 0, keys_1 = keys; _d < keys_1.length; _d++) {
1086
+ key = keys_1[_d];
1161
1087
  if (data[key]) {
1162
1088
  switch (key) {
1163
1089
  case "tag":
1164
- size = value.metadata.size;
1090
+ box = size$1(value);
1165
1091
  factor = mangle ? -1 : 1;
1166
1092
  tokens.push(value.id * factor);
1167
1093
  if (value.parent && active) {
@@ -1170,9 +1096,9 @@ function encode$4 (type, timer, ts) {
1170
1096
  if (value.previous && active) {
1171
1097
  tokens.push(value.previous);
1172
1098
  }
1173
- tokens.push(suspend ? "*M" /* SuspendMutationTag */ : data[key]);
1174
- if (size && size.length === 2) {
1175
- tokens.push("" + "#" /* Box */ + str$1(size[0]) + "." + str$1(size[1]));
1099
+ tokens.push(suspend ? "*M" /* Constant.SuspendMutationTag */ : data[key]);
1100
+ if (box && box.length === 2) {
1101
+ tokens.push("".concat("#" /* Constant.Box */).concat(str$1(box[0]), ".").concat(str$1(box[1])));
1176
1102
  }
1177
1103
  break;
1178
1104
  case "attributes":
@@ -1183,36 +1109,46 @@ function encode$4 (type, timer, ts) {
1183
1109
  }
1184
1110
  break;
1185
1111
  case "value":
1112
+ check$4(value.metadata.fraud, value.id, data[key]);
1186
1113
  tokens.push(scrub(data[key], data.tag, privacy, mangle));
1187
1114
  break;
1188
1115
  }
1189
1116
  }
1190
1117
  }
1191
- _f.label = 8;
1118
+ _e.label = 7;
1119
+ case 7:
1120
+ _c++;
1121
+ return [3 /*break*/, 4];
1192
1122
  case 8:
1193
- _d++;
1194
- return [3 /*break*/, 5];
1195
- case 9:
1196
- if (type === 6 /* Mutation */) {
1123
+ if (type === 6 /* Event.Mutation */) {
1197
1124
  activity(eventTime);
1198
1125
  }
1199
1126
  queue(tokenize(tokens), !config$1.lean);
1200
- _f.label = 10;
1201
- case 10: return [3 /*break*/, 11];
1202
- case 11: return [2 /*return*/];
1127
+ _e.label = 9;
1128
+ case 9: return [3 /*break*/, 10];
1129
+ case 10: return [2 /*return*/];
1203
1130
  }
1204
1131
  });
1205
1132
  });
1206
1133
  }
1207
1134
  function shouldMangle(value) {
1208
1135
  var privacy = value.metadata.privacy;
1209
- return value.data.tag === "*T" /* TextTag */ && !(privacy === 0 /* None */ || privacy === 1 /* Sensitive */);
1136
+ return value.data.tag === "*T" /* Constant.TextTag */ && !(privacy === 0 /* Privacy.None */ || privacy === 1 /* Privacy.Sensitive */);
1137
+ }
1138
+ function size$1(value) {
1139
+ if (value.metadata.size !== null && value.metadata.size.length === 0) {
1140
+ var img = getNode(value.id);
1141
+ if (img) {
1142
+ return [Math.floor(img.offsetWidth * 100 /* Setting.BoxPrecision */), Math.floor(img.offsetHeight * 100 /* Setting.BoxPrecision */)];
1143
+ }
1144
+ }
1145
+ return value.metadata.size;
1210
1146
  }
1211
1147
  function str$1(input) {
1212
1148
  return input.toString(36);
1213
1149
  }
1214
1150
  function attribute(key, value, privacy) {
1215
- return key + "=" + scrub(value, key, privacy);
1151
+ return "".concat(key, "=").concat(scrub(value, key, privacy));
1216
1152
  }
1217
1153
 
1218
1154
  var data$c;
@@ -1243,7 +1179,7 @@ function compute$7() {
1243
1179
  // Check that width or height has changed from before, and also that width & height are not null values
1244
1180
  if ((data$c === null || width !== data$c.width || height !== data$c.height) && width !== null && height !== null) {
1245
1181
  data$c = { width: width, height: height };
1246
- encode$4(8 /* Document */);
1182
+ encode$4(8 /* Event.Document */);
1247
1183
  }
1248
1184
  }
1249
1185
  function end() {
@@ -1272,7 +1208,7 @@ function start$u() {
1272
1208
  reset$h();
1273
1209
  }
1274
1210
  function observe$b(root) {
1275
- bind(root, "click", handler$3.bind(this, 9 /* Click */, root), true);
1211
+ bind(root, "click", handler$3.bind(this, 9 /* Event.Click */, root), true);
1276
1212
  }
1277
1213
  function handler$3(event, root, evt) {
1278
1214
  var frame = iframe(root);
@@ -1298,8 +1234,8 @@ function handler$3(event, root, evt) {
1298
1234
  x = Math.round(l.x + (l.w / 2));
1299
1235
  y = Math.round(l.y + (l.h / 2));
1300
1236
  }
1301
- var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* ClickPrecision */), 0) : 0;
1302
- var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* ClickPrecision */), 0) : 0;
1237
+ var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1238
+ var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1303
1239
  // Check for null values before processing this event
1304
1240
  if (x !== null && y !== null) {
1305
1241
  state$7.push({
@@ -1316,7 +1252,8 @@ function handler$3(event, root, evt) {
1316
1252
  context: context(a),
1317
1253
  text: text(t),
1318
1254
  link: a ? a.href : null,
1319
- hash: null
1255
+ hash: null,
1256
+ trust: evt.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */
1320
1257
  }
1321
1258
  });
1322
1259
  schedule$1(encode$3.bind(this, event));
@@ -1331,7 +1268,7 @@ function text(element) {
1331
1268
  // Trim any spaces at the beginning or at the end of string
1332
1269
  // Also, replace multiple occurrence of space characters with a single white space
1333
1270
  // Finally, send only first few characters as specified by the Setting
1334
- output = t.trim().replace(/\s+/g, " " /* Space */).substr(0, 25 /* ClickText */);
1271
+ output = t.trim().replace(/\s+/g, " " /* Constant.Space */).substr(0, 25 /* Setting.ClickText */);
1335
1272
  }
1336
1273
  }
1337
1274
  return output;
@@ -1340,10 +1277,10 @@ function reaction(element) {
1340
1277
  if (element.nodeType === Node.ELEMENT_NODE) {
1341
1278
  var tag = element.tagName.toLowerCase();
1342
1279
  if (UserInputTags.indexOf(tag) >= 0) {
1343
- return 0 /* False */;
1280
+ return 0 /* BooleanFlag.False */;
1344
1281
  }
1345
1282
  }
1346
- return 1 /* True */;
1283
+ return 1 /* BooleanFlag.True */;
1347
1284
  }
1348
1285
  function layout$1(element) {
1349
1286
  var box = null;
@@ -1367,14 +1304,14 @@ function layout$1(element) {
1367
1304
  return box;
1368
1305
  }
1369
1306
  function context(a) {
1370
- if (a && a.hasAttribute("target" /* Target */)) {
1371
- switch (a.getAttribute("target" /* Target */)) {
1372
- case "_blank" /* Blank */: return 1 /* Blank */;
1373
- case "_parent" /* Parent */: return 2 /* Parent */;
1374
- case "_top" /* Top */: return 3 /* Top */;
1307
+ if (a && a.hasAttribute("target" /* Constant.Target */)) {
1308
+ switch (a.getAttribute("target" /* Constant.Target */)) {
1309
+ case "_blank" /* Constant.Blank */: return 1 /* BrowsingContext.Blank */;
1310
+ case "_parent" /* Constant.Parent */: return 2 /* BrowsingContext.Parent */;
1311
+ case "_top" /* Constant.Top */: return 3 /* BrowsingContext.Top */;
1375
1312
  }
1376
1313
  }
1377
- return 0 /* Self */;
1314
+ return 0 /* BrowsingContext.Self */;
1378
1315
  }
1379
1316
  function reset$h() {
1380
1317
  state$7 = [];
@@ -1388,13 +1325,13 @@ function start$t() {
1388
1325
  reset$g();
1389
1326
  }
1390
1327
  function observe$a(root) {
1391
- bind(root, "cut", recompute$7.bind(this, 0 /* Cut */), true);
1392
- bind(root, "copy", recompute$7.bind(this, 1 /* Copy */), true);
1393
- bind(root, "paste", recompute$7.bind(this, 2 /* Paste */), true);
1328
+ bind(root, "cut", recompute$7.bind(this, 0 /* Clipboard.Cut */), true);
1329
+ bind(root, "copy", recompute$7.bind(this, 1 /* Clipboard.Copy */), true);
1330
+ bind(root, "paste", recompute$7.bind(this, 2 /* Clipboard.Paste */), true);
1394
1331
  }
1395
1332
  function recompute$7(action, evt) {
1396
- state$6.push({ time: time(), event: 38 /* Clipboard */, data: { target: target(evt), action: action } });
1397
- schedule$1(encode$3.bind(this, 38 /* Clipboard */));
1333
+ state$6.push({ time: time(), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1334
+ schedule$1(encode$3.bind(this, 38 /* Event.Clipboard */));
1398
1335
  }
1399
1336
  function reset$g() {
1400
1337
  state$6 = [];
@@ -1415,27 +1352,21 @@ function recompute$6(evt) {
1415
1352
  var input = target(evt);
1416
1353
  var value = get(input);
1417
1354
  if (input && input.type && value) {
1418
- var v = void 0;
1355
+ var v = input.value;
1419
1356
  switch (input.type) {
1420
1357
  case "radio":
1421
1358
  case "checkbox":
1422
1359
  v = input.checked ? "true" : "false";
1423
1360
  break;
1424
- case "range":
1425
- v = input.value;
1426
- break;
1427
- default:
1428
- v = scrub(input.value, "input", value.metadata.privacy);
1429
- break;
1430
1361
  }
1431
1362
  var data = { target: input, value: v };
1432
1363
  // If last entry in the queue is for the same target node as the current one, remove it so we can later swap it with current data.
1433
1364
  if (state$5.length > 0 && (state$5[state$5.length - 1].data.target === data.target)) {
1434
1365
  state$5.pop();
1435
1366
  }
1436
- state$5.push({ time: time(), event: 27 /* Input */, data: data });
1367
+ state$5.push({ time: time(), event: 27 /* Event.Input */, data: data });
1437
1368
  clearTimeout(timeout$5);
1438
- timeout$5 = setTimeout(process$6, 500 /* LookAhead */, 27 /* Input */);
1369
+ timeout$5 = setTimeout(process$6, 500 /* Setting.LookAhead */, 27 /* Event.Input */);
1439
1370
  }
1440
1371
  }
1441
1372
  function process$6(event) {
@@ -1455,15 +1386,15 @@ function start$r() {
1455
1386
  reset$e();
1456
1387
  }
1457
1388
  function observe$8(root) {
1458
- bind(root, "mousedown", mouse.bind(this, 13 /* MouseDown */, root), true);
1459
- bind(root, "mouseup", mouse.bind(this, 14 /* MouseUp */, root), true);
1460
- bind(root, "mousemove", mouse.bind(this, 12 /* MouseMove */, root), true);
1461
- bind(root, "mousewheel", mouse.bind(this, 15 /* MouseWheel */, root), true);
1462
- bind(root, "dblclick", mouse.bind(this, 16 /* DoubleClick */, root), true);
1463
- bind(root, "touchstart", touch.bind(this, 17 /* TouchStart */, root), true);
1464
- bind(root, "touchend", touch.bind(this, 18 /* TouchEnd */, root), true);
1465
- bind(root, "touchmove", touch.bind(this, 19 /* TouchMove */, root), true);
1466
- bind(root, "touchcancel", touch.bind(this, 20 /* TouchCancel */, root), true);
1389
+ bind(root, "mousedown", mouse.bind(this, 13 /* Event.MouseDown */, root), true);
1390
+ bind(root, "mouseup", mouse.bind(this, 14 /* Event.MouseUp */, root), true);
1391
+ bind(root, "mousemove", mouse.bind(this, 12 /* Event.MouseMove */, root), true);
1392
+ bind(root, "mousewheel", mouse.bind(this, 15 /* Event.MouseWheel */, root), true);
1393
+ bind(root, "dblclick", mouse.bind(this, 16 /* Event.DoubleClick */, root), true);
1394
+ bind(root, "touchstart", touch.bind(this, 17 /* Event.TouchStart */, root), true);
1395
+ bind(root, "touchend", touch.bind(this, 18 /* Event.TouchEnd */, root), true);
1396
+ bind(root, "touchmove", touch.bind(this, 19 /* Event.TouchMove */, root), true);
1397
+ bind(root, "touchcancel", touch.bind(this, 20 /* Event.TouchCancel */, root), true);
1467
1398
  }
1468
1399
  function mouse(event, root, evt) {
1469
1400
  var frame = iframe(root);
@@ -1502,9 +1433,9 @@ function touch(event, root, evt) {
1502
1433
  }
1503
1434
  function handler$2(current) {
1504
1435
  switch (current.event) {
1505
- case 12 /* MouseMove */:
1506
- case 15 /* MouseWheel */:
1507
- case 19 /* TouchMove */:
1436
+ case 12 /* Event.MouseMove */:
1437
+ case 15 /* Event.MouseWheel */:
1438
+ case 19 /* Event.TouchMove */:
1508
1439
  var length_1 = state$4.length;
1509
1440
  var last = length_1 > 1 ? state$4[length_1 - 2] : null;
1510
1441
  if (last && similar$1(last, current)) {
@@ -1512,7 +1443,7 @@ function handler$2(current) {
1512
1443
  }
1513
1444
  state$4.push(current);
1514
1445
  clearTimeout(timeout$4);
1515
- timeout$4 = setTimeout(process$5, 500 /* LookAhead */, current.event);
1446
+ timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, current.event);
1516
1447
  break;
1517
1448
  default:
1518
1449
  state$4.push(current);
@@ -1532,7 +1463,7 @@ function similar$1(last, current) {
1532
1463
  var distance = Math.sqrt(dx * dx + dy * dy);
1533
1464
  var gap = current.time - last.time;
1534
1465
  var match = current.data.target === last.data.target;
1535
- return current.event === last.event && match && distance < 20 /* Distance */ && gap < 25 /* Interval */;
1466
+ return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.Interval */;
1536
1467
  }
1537
1468
  function stop$p() {
1538
1469
  clearTimeout(timeout$4);
@@ -1555,7 +1486,7 @@ function recompute$5() {
1555
1486
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
1556
1487
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
1557
1488
  };
1558
- encode$3(11 /* Resize */);
1489
+ encode$3(11 /* Event.Resize */);
1559
1490
  }
1560
1491
  function reset$d() {
1561
1492
  data$b = null;
@@ -1591,7 +1522,7 @@ function recompute$4(event) {
1591
1522
  // And, if for some reason that is not available, fall back to looking up scrollTop on document.documentElement.
1592
1523
  var x = element === de && "pageXOffset" in w ? Math.round(w.pageXOffset) : Math.round(element.scrollLeft);
1593
1524
  var y = element === de && "pageYOffset" in w ? Math.round(w.pageYOffset) : Math.round(element.scrollTop);
1594
- var current = { time: time(), event: 10 /* Scroll */, data: { target: element, x: x, y: y } };
1525
+ var current = { time: time(), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y } };
1595
1526
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
1596
1527
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
1597
1528
  return;
@@ -1603,7 +1534,7 @@ function recompute$4(event) {
1603
1534
  }
1604
1535
  state$3.push(current);
1605
1536
  clearTimeout(timeout$3);
1606
- timeout$3 = setTimeout(process$4, 500 /* LookAhead */, 10 /* Scroll */);
1537
+ timeout$3 = setTimeout(process$4, 500 /* Setting.LookAhead */, 10 /* Event.Scroll */);
1607
1538
  }
1608
1539
  function reset$c() {
1609
1540
  state$3 = [];
@@ -1614,7 +1545,7 @@ function process$4(event) {
1614
1545
  function similar(last, current) {
1615
1546
  var dx = last.data.x - current.data.x;
1616
1547
  var dy = last.data.y - current.data.y;
1617
- return (dx * dx + dy * dy < 20 /* Distance */ * 20 /* Distance */) && (current.time - last.time < 25 /* Interval */);
1548
+ return (dx * dx + dy * dy < 20 /* Setting.Distance */ * 20 /* Setting.Distance */) && (current.time - last.time < 25 /* Setting.Interval */);
1618
1549
  }
1619
1550
  function stop$n() {
1620
1551
  clearTimeout(timeout$3);
@@ -1649,7 +1580,7 @@ function recompute$3(root) {
1649
1580
  var startNode = data$a.start ? data$a.start : null;
1650
1581
  if (previous !== null && data$a.start !== null && startNode !== current.anchorNode) {
1651
1582
  clearTimeout(timeout$2);
1652
- process$3(21 /* Selection */);
1583
+ process$3(21 /* Event.Selection */);
1653
1584
  }
1654
1585
  data$a = {
1655
1586
  start: current.anchorNode,
@@ -1659,7 +1590,7 @@ function recompute$3(root) {
1659
1590
  };
1660
1591
  previous = current;
1661
1592
  clearTimeout(timeout$2);
1662
- timeout$2 = setTimeout(process$3, 500 /* LookAhead */, 21 /* Selection */);
1593
+ timeout$2 = setTimeout(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
1663
1594
  }
1664
1595
  function process$3(event) {
1665
1596
  schedule$1(encode$3.bind(this, event));
@@ -1681,8 +1612,8 @@ function observe$5(root) {
1681
1612
  bind(root, "submit", recompute$2, true);
1682
1613
  }
1683
1614
  function recompute$2(evt) {
1684
- state$2.push({ time: time(), event: 39 /* Submit */, data: { target: target(evt) } });
1685
- schedule$1(encode$3.bind(this, 39 /* Submit */));
1615
+ state$2.push({ time: time(), event: 39 /* Event.Submit */, data: { target: target(evt) } });
1616
+ schedule$1(encode$3.bind(this, 39 /* Event.Submit */));
1686
1617
  }
1687
1618
  function reset$a() {
1688
1619
  state$2 = [];
@@ -1697,7 +1628,7 @@ function start$m() {
1697
1628
  }
1698
1629
  function recompute$1(evt) {
1699
1630
  data$9 = { name: evt.type };
1700
- encode$3(26 /* Unload */);
1631
+ encode$3(26 /* Event.Unload */);
1701
1632
  stop();
1702
1633
  }
1703
1634
  function reset$9() {
@@ -1714,7 +1645,7 @@ function start$l() {
1714
1645
  }
1715
1646
  function recompute() {
1716
1647
  data$8 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1717
- encode$3(28 /* Visibility */);
1648
+ encode$3(28 /* Event.Visibility */);
1718
1649
  }
1719
1650
  function reset$8() {
1720
1651
  data$8 = null;
@@ -1776,51 +1707,51 @@ function ld(json) {
1776
1707
  for (var _i = 0, _a = Object.keys(json); _i < _a.length; _i++) {
1777
1708
  var key = _a[_i];
1778
1709
  var value = json[key];
1779
- if (key === "@type" /* Type */ && typeof value === "string") {
1710
+ if (key === "@type" /* JsonLD.Type */ && typeof value === "string") {
1780
1711
  value = value.toLowerCase();
1781
1712
  /* Normalizations */
1782
- value = value.indexOf("article" /* Article */) >= 0 || value.indexOf("posting" /* Posting */) >= 0 ? "article" /* Article */ : value;
1713
+ value = value.indexOf("article" /* JsonLD.Article */) >= 0 || value.indexOf("posting" /* JsonLD.Posting */) >= 0 ? "article" /* JsonLD.Article */ : value;
1783
1714
  switch (value) {
1784
- case "article" /* Article */:
1785
- case "recipe" /* Recipe */:
1786
- log(5 /* SchemaType */, json[key]);
1787
- log(8 /* AuthorName */, json["creator" /* Creator */]);
1788
- log(18 /* Headline */, json["headline" /* Headline */]);
1715
+ case "article" /* JsonLD.Article */:
1716
+ case "recipe" /* JsonLD.Recipe */:
1717
+ log(5 /* Dimension.SchemaType */, json[key]);
1718
+ log(8 /* Dimension.AuthorName */, json["creator" /* JsonLD.Creator */]);
1719
+ log(18 /* Dimension.Headline */, json["headline" /* JsonLD.Headline */]);
1789
1720
  break;
1790
- case "product" /* Product */:
1791
- log(5 /* SchemaType */, json[key]);
1792
- log(10 /* ProductName */, json["name" /* Name */]);
1793
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1794
- if (json["brand" /* Brand */]) {
1795
- log(6 /* ProductBrand */, json["brand" /* Brand */]["name" /* Name */]);
1721
+ case "product" /* JsonLD.Product */:
1722
+ log(5 /* Dimension.SchemaType */, json[key]);
1723
+ log(10 /* Dimension.ProductName */, json["name" /* JsonLD.Name */]);
1724
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1725
+ if (json["brand" /* JsonLD.Brand */]) {
1726
+ log(6 /* Dimension.ProductBrand */, json["brand" /* JsonLD.Brand */]["name" /* JsonLD.Name */]);
1796
1727
  }
1797
1728
  break;
1798
- case "aggregaterating" /* AggregateRating */:
1799
- if (json["ratingValue" /* RatingValue */]) {
1800
- max(11 /* RatingValue */, num$1(json["ratingValue" /* RatingValue */], 100 /* RatingScale */));
1801
- max(18 /* BestRating */, num$1(json["bestRating" /* BestRating */]));
1802
- max(19 /* WorstRating */, num$1(json["worstRating" /* WorstRating */]));
1729
+ case "aggregaterating" /* JsonLD.AggregateRating */:
1730
+ if (json["ratingValue" /* JsonLD.RatingValue */]) {
1731
+ max(11 /* Metric.RatingValue */, num$1(json["ratingValue" /* JsonLD.RatingValue */], 100 /* Setting.RatingScale */));
1732
+ max(18 /* Metric.BestRating */, num$1(json["bestRating" /* JsonLD.BestRating */]));
1733
+ max(19 /* Metric.WorstRating */, num$1(json["worstRating" /* JsonLD.WorstRating */]));
1803
1734
  }
1804
- max(12 /* RatingCount */, num$1(json["ratingCount" /* RatingCount */]));
1805
- max(17 /* ReviewCount */, num$1(json["reviewCount" /* ReviewCount */]));
1735
+ max(12 /* Metric.RatingCount */, num$1(json["ratingCount" /* JsonLD.RatingCount */]));
1736
+ max(17 /* Metric.ReviewCount */, num$1(json["reviewCount" /* JsonLD.ReviewCount */]));
1806
1737
  break;
1807
- case "person" /* Author */:
1808
- log(8 /* AuthorName */, json["name" /* Name */]);
1738
+ case "person" /* JsonLD.Author */:
1739
+ log(8 /* Dimension.AuthorName */, json["name" /* JsonLD.Name */]);
1809
1740
  break;
1810
- case "offer" /* Offer */:
1811
- log(7 /* ProductAvailability */, json["availability" /* Availability */]);
1812
- log(14 /* ProductCondition */, json["itemCondition" /* ItemCondition */]);
1813
- log(13 /* ProductCurrency */, json["priceCurrency" /* PriceCurrency */]);
1814
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1815
- max(13 /* ProductPrice */, num$1(json["price" /* Price */]));
1741
+ case "offer" /* JsonLD.Offer */:
1742
+ log(7 /* Dimension.ProductAvailability */, json["availability" /* JsonLD.Availability */]);
1743
+ log(14 /* Dimension.ProductCondition */, json["itemCondition" /* JsonLD.ItemCondition */]);
1744
+ log(13 /* Dimension.ProductCurrency */, json["priceCurrency" /* JsonLD.PriceCurrency */]);
1745
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1746
+ max(13 /* Metric.ProductPrice */, num$1(json["price" /* JsonLD.Price */]));
1816
1747
  break;
1817
- case "brand" /* Brand */:
1818
- log(6 /* ProductBrand */, json["name" /* Name */]);
1748
+ case "brand" /* JsonLD.Brand */:
1749
+ log(6 /* Dimension.ProductBrand */, json["name" /* JsonLD.Name */]);
1819
1750
  break;
1820
1751
  }
1821
1752
  }
1822
1753
  // Continue parsing nested objects
1823
- if (value !== null && typeof (value) === "object" /* Object */) {
1754
+ if (value !== null && typeof (value) === "object" /* Constant.Object */) {
1824
1755
  ld(value);
1825
1756
  }
1826
1757
  }
@@ -1829,23 +1760,23 @@ function num$1(input, scale) {
1829
1760
  if (scale === void 0) { scale = 1; }
1830
1761
  if (input !== null) {
1831
1762
  switch (typeof input) {
1832
- case "number" /* Number */: return Math.round(input * scale);
1833
- case "string" /* String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Empty */)) * scale);
1763
+ case "number" /* Constant.Number */: return Math.round(input * scale);
1764
+ case "string" /* Constant.String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Constant.Empty */)) * scale);
1834
1765
  }
1835
1766
  }
1836
1767
  return null;
1837
1768
  }
1838
1769
 
1839
- var IGNORE_ATTRIBUTES = ["title", "alt", "onload", "onfocus", "onerror"];
1770
+ var IGNORE_ATTRIBUTES = ["title", "alt", "onload", "onfocus", "onerror", "data-drupal-form-submit-last"];
1840
1771
  var newlineRegex = /[\r\n]+/g;
1841
1772
  function processNode (node, source) {
1842
1773
  var child = null;
1843
1774
  // Do not track this change if we are attempting to remove a node before discovering it
1844
- if (source === 2 /* ChildListRemove */ && has(node) === false) {
1775
+ if (source === 2 /* Source.ChildListRemove */ && has(node) === false) {
1845
1776
  return child;
1846
1777
  }
1847
1778
  // Special handling for text nodes that belong to style nodes
1848
- if (source !== 0 /* Discover */ &&
1779
+ if (source !== 0 /* Source.Discover */ &&
1849
1780
  node.nodeType === Node.TEXT_NODE &&
1850
1781
  node.parentElement &&
1851
1782
  node.parentElement.tagName === "STYLE") {
@@ -1858,10 +1789,10 @@ function processNode (node, source) {
1858
1789
  switch (node.nodeType) {
1859
1790
  case Node.DOCUMENT_TYPE_NODE:
1860
1791
  parent = insideFrame && node.parentNode ? iframe(node.parentNode) : parent;
1861
- var docTypePrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1792
+ var docTypePrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1862
1793
  var doctype = node;
1863
1794
  var docAttributes = { name: doctype.name, publicId: doctype.publicId, systemId: doctype.systemId };
1864
- var docData = { tag: docTypePrefix + "*D" /* DocumentTag */, attributes: docAttributes };
1795
+ var docData = { tag: docTypePrefix + "*D" /* Constant.DocumentTag */, attributes: docAttributes };
1865
1796
  dom[call](node, parent, docData, source);
1866
1797
  break;
1867
1798
  case Node.DOCUMENT_NODE:
@@ -1876,26 +1807,26 @@ function processNode (node, source) {
1876
1807
  if (shadowRoot.host) {
1877
1808
  parse$1(shadowRoot);
1878
1809
  var type = typeof (shadowRoot.constructor);
1879
- if (type === "function" /* Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* NativeCode */) >= 0) {
1810
+ if (type === "function" /* Constant.Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* Constant.NativeCode */) >= 0) {
1880
1811
  observe$3(shadowRoot);
1881
1812
  // See: https://wicg.github.io/construct-stylesheets/ for more details on adoptedStyleSheets.
1882
1813
  // At the moment, we are only able to capture "open" shadow DOM nodes. If they are closed, they are not accessible.
1883
1814
  // In future we may decide to proxy "attachShadow" call to gain access, but at the moment, we don't want to
1884
1815
  // cause any unintended side effect to the page. We will re-evaluate after we gather more real world data on this.
1885
- var style = "" /* Empty */;
1816
+ var style = "" /* Constant.Empty */;
1886
1817
  var adoptedStyleSheets = "adoptedStyleSheets" in shadowRoot ? shadowRoot["adoptedStyleSheets"] : [];
1887
1818
  for (var _i = 0, adoptedStyleSheets_1 = adoptedStyleSheets; _i < adoptedStyleSheets_1.length; _i++) {
1888
1819
  var styleSheet = adoptedStyleSheets_1[_i];
1889
1820
  style += getCssRules(styleSheet);
1890
1821
  }
1891
- var fragementData = { tag: "*S" /* ShadowDomTag */, attributes: { style: style } };
1822
+ var fragementData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
1892
1823
  dom[call](node, shadowRoot.host, fragementData, source);
1893
1824
  }
1894
1825
  else {
1895
1826
  // If the browser doesn't support shadow DOM natively, we detect that, and send appropriate tag back.
1896
1827
  // The differentiation is important because we don't have to observe pollyfill shadow DOM nodes,
1897
1828
  // the same way we observe real shadow DOM nodes (encapsulation provided by the browser).
1898
- dom[call](node, shadowRoot.host, { tag: "*P" /* PolyfillShadowDomTag */, attributes: {} }, source);
1829
+ dom[call](node, shadowRoot.host, { tag: "*P" /* Constant.PolyfillShadowDomTag */, attributes: {} }, source);
1899
1830
  }
1900
1831
  }
1901
1832
  break;
@@ -1908,7 +1839,7 @@ function processNode (node, source) {
1908
1839
  // The only exception is when we receive a mutation to remove the text node, in that case
1909
1840
  // parent will be null, but we can still process the node by checking it's an update call.
1910
1841
  if (call === "update" || (parent && has(parent) && parent.tagName !== "STYLE")) {
1911
- var textData = { tag: "*T" /* TextTag */, value: node.nodeValue };
1842
+ var textData = { tag: "*T" /* Constant.TextTag */, value: node.nodeValue };
1912
1843
  dom[call](node, parent, textData, source);
1913
1844
  }
1914
1845
  break;
@@ -1920,20 +1851,20 @@ function processNode (node, source) {
1920
1851
  // For correctness, we first look at parentElement and if it not present then fall back to using parentNode
1921
1852
  parent = node.parentElement ? node.parentElement : (node.parentNode ? node.parentNode : null);
1922
1853
  // If we encounter a node that is part of SVG namespace, prefix the tag with SVG_PREFIX
1923
- if (element.namespaceURI === "http://www.w3.org/2000/svg" /* SvgNamespace */) {
1924
- tag = "svg:" /* SvgPrefix */ + tag;
1854
+ if (element.namespaceURI === "http://www.w3.org/2000/svg" /* Constant.SvgNamespace */) {
1855
+ tag = "svg:" /* Constant.SvgPrefix */ + tag;
1925
1856
  }
1926
1857
  switch (tag) {
1927
1858
  case "HTML":
1928
1859
  parent = insideFrame && parent ? iframe(parent) : null;
1929
- var htmlPrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1860
+ var htmlPrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1930
1861
  var htmlData = { tag: htmlPrefix + tag, attributes: attributes };
1931
1862
  dom[call](node, parent, htmlData, source);
1932
1863
  break;
1933
1864
  case "SCRIPT":
1934
- if ("type" /* Type */ in attributes && attributes["type" /* Type */] === "application/ld+json" /* JsonLD */) {
1865
+ if ("type" /* Constant.Type */ in attributes && attributes["type" /* Constant.Type */] === "application/ld+json" /* Constant.JsonLD */) {
1935
1866
  try {
1936
- ld(JSON.parse(element.text.replace(newlineRegex, "" /* Empty */)));
1867
+ ld(JSON.parse(element.text.replace(newlineRegex, "" /* Constant.Empty */)));
1937
1868
  }
1938
1869
  catch ( /* do nothing */_a) { /* do nothing */ }
1939
1870
  }
@@ -1941,20 +1872,20 @@ function processNode (node, source) {
1941
1872
  case "NOSCRIPT":
1942
1873
  break;
1943
1874
  case "META":
1944
- var key = ("property" /* Property */ in attributes ?
1945
- "property" /* Property */ :
1946
- ("name" /* Name */ in attributes ? "name" /* Name */ : null));
1947
- if (key && "content" /* Content */ in attributes) {
1948
- var content = attributes["content" /* Content */];
1875
+ var key = ("property" /* Constant.Property */ in attributes ?
1876
+ "property" /* Constant.Property */ :
1877
+ ("name" /* Constant.Name */ in attributes ? "name" /* Constant.Name */ : null));
1878
+ if (key && "content" /* Constant.Content */ in attributes) {
1879
+ var content = attributes["content" /* Constant.Content */];
1949
1880
  switch (attributes[key]) {
1950
- case "og:title" /* ogTitle */:
1951
- log(20 /* MetaTitle */, content);
1881
+ case "og:title" /* Constant.ogTitle */:
1882
+ log(20 /* Dimension.MetaTitle */, content);
1952
1883
  break;
1953
- case "og:type" /* ogType */:
1954
- log(19 /* MetaType */, content);
1884
+ case "og:type" /* Constant.ogType */:
1885
+ log(19 /* Dimension.MetaType */, content);
1955
1886
  break;
1956
- case "generator" /* Generator */:
1957
- log(21 /* Generator */, content);
1887
+ case "generator" /* Constant.Generator */:
1888
+ log(21 /* Dimension.Generator */, content);
1958
1889
  break;
1959
1890
  }
1960
1891
  }
@@ -1962,7 +1893,7 @@ function processNode (node, source) {
1962
1893
  case "HEAD":
1963
1894
  var head = { tag: tag, attributes: attributes };
1964
1895
  if (location) {
1965
- head.attributes["*B" /* Base */] = location.protocol + "//" + location.hostname;
1896
+ head.attributes["*B" /* Constant.Base */] = location.protocol + "//" + location.hostname;
1966
1897
  }
1967
1898
  dom[call](node, parent, head, source);
1968
1899
  break;
@@ -1975,7 +1906,7 @@ function processNode (node, source) {
1975
1906
  var frameData = { tag: tag, attributes: attributes };
1976
1907
  if (sameorigin(iframe$1)) {
1977
1908
  monitor(iframe$1);
1978
- frameData.attributes["*O" /* SameOrigin */] = "true";
1909
+ frameData.attributes["*O" /* Constant.SameOrigin */] = "true";
1979
1910
  if (iframe$1.contentDocument && iframe$1.contentWindow && iframe$1.contentDocument.readyState !== "loading") {
1980
1911
  child = iframe$1.contentDocument;
1981
1912
  }
@@ -2004,7 +1935,7 @@ function observe$3(root) {
2004
1935
  function getStyleValue(style) {
2005
1936
  // Call trim on the text content to ensure we do not process white spaces ( , \n, \r\n, \t, etc.)
2006
1937
  // Also, check if stylesheet has any data-* attribute, if so process rules instead of looking up text
2007
- var value = style.textContent ? style.textContent.trim() : "" /* Empty */;
1938
+ var value = style.textContent ? style.textContent.trim() : "" /* Constant.Empty */;
2008
1939
  var dataset = style.dataset ? Object.keys(style.dataset).length : 0;
2009
1940
  if (value.length === 0 || dataset > 0) {
2010
1941
  value = getCssRules(style.sheet);
@@ -2012,14 +1943,14 @@ function getStyleValue(style) {
2012
1943
  return value;
2013
1944
  }
2014
1945
  function getCssRules(sheet) {
2015
- var value = "" /* Empty */;
1946
+ var value = "" /* Constant.Empty */;
2016
1947
  var cssRules = null;
2017
1948
  // Firefox throws a SecurityError when trying to access cssRules of a stylesheet from a different domain
2018
1949
  try {
2019
1950
  cssRules = sheet ? sheet.cssRules : [];
2020
1951
  }
2021
1952
  catch (e) {
2022
- log$1(1 /* CssRules */, 1 /* Warning */, e ? e.name : null);
1953
+ log$1(1 /* Code.CssRules */, 1 /* Severity.Warning */, e ? e.name : null);
2023
1954
  if (e && e.name !== "SecurityError") {
2024
1955
  throw e;
2025
1956
  }
@@ -2043,8 +1974,8 @@ function getAttributes(element) {
2043
1974
  }
2044
1975
  }
2045
1976
  // For INPUT tags read the dynamic "value" property if an explicit "value" attribute is not set
2046
- if (element.tagName === "INPUT" /* InputTag */ && !("value" /* Value */ in output) && element.value) {
2047
- output["value" /* Value */] = element.value;
1977
+ if (element.tagName === "INPUT" /* Constant.InputTag */ && !("value" /* Constant.Value */ in output) && element.value) {
1978
+ output["value" /* Constant.Value */] = element.value;
2048
1979
  }
2049
1980
  return output;
2050
1981
  }
@@ -2066,13 +1997,13 @@ function traverse (root, timer, source) {
2066
1997
  next = next.nextSibling;
2067
1998
  }
2068
1999
  state = state$8(timer);
2069
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 3];
2000
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
2070
2001
  return [4 /*yield*/, suspend$1(timer)];
2071
2002
  case 2:
2072
2003
  state = _a.sent();
2073
2004
  _a.label = 3;
2074
2005
  case 3:
2075
- if (state === 2 /* Stop */) {
2006
+ if (state === 2 /* Task.Stop */) {
2076
2007
  return [3 /*break*/, 4];
2077
2008
  }
2078
2009
  subnode = processNode(node, source);
@@ -2149,7 +2080,7 @@ function observe$2(node) {
2149
2080
  // For this reason, we need to wire up mutations every time we see a new shadow dom.
2150
2081
  // Also, wrap it inside a try / catch. In certain browsers (e.g. legacy Edge), observer on shadow dom can throw errors
2151
2082
  try {
2152
- var m = api("MutationObserver" /* MutationObserver */);
2083
+ var m = api("MutationObserver" /* Constant.MutationObserver */);
2153
2084
  var observer = m in window ? new window[m](measure(handle$1)) : null;
2154
2085
  if (observer) {
2155
2086
  observer.observe(node, { attributes: true, childList: true, characterData: true, subtree: true });
@@ -2157,7 +2088,7 @@ function observe$2(node) {
2157
2088
  }
2158
2089
  }
2159
2090
  catch (e) {
2160
- log$1(2 /* MutationObserver */, 0 /* Info */, e ? e.name : null);
2091
+ log$1(2 /* Code.MutationObserver */, 0 /* Severity.Info */, e ? e.name : null);
2161
2092
  }
2162
2093
  }
2163
2094
  function monitor(frame) {
@@ -2165,7 +2096,7 @@ function monitor(frame) {
2165
2096
  // This includes cases where iframe location is updated without explicitly updating src attribute
2166
2097
  // E.g. iframe.contentWindow.location.href = "new-location";
2167
2098
  if (has(frame) === false) {
2168
- bind(frame, "load" /* LoadEvent */, generate.bind(this, frame, "childList" /* ChildList */), true);
2099
+ bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
2169
2100
  }
2170
2101
  }
2171
2102
  function stop$h() {
@@ -2183,15 +2114,15 @@ function stop$h() {
2183
2114
  timeout$1 = null;
2184
2115
  }
2185
2116
  function active$2() {
2186
- activePeriod = time() + 3000 /* MutationActivePeriod */;
2117
+ activePeriod = time() + 3000 /* Setting.MutationActivePeriod */;
2187
2118
  }
2188
2119
  function handle$1(m) {
2189
2120
  // Queue up mutation records for asynchronous processing
2190
2121
  var now = time();
2191
- track$6(6 /* Mutation */, now);
2122
+ track$6(6 /* Event.Mutation */, now);
2192
2123
  mutations.push({ time: now, mutations: m });
2193
- schedule$1(process$2, 1 /* High */).then(function () {
2194
- measure(compute$7)();
2124
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
2125
+ setTimeout(compute$7);
2195
2126
  measure(compute$6)();
2196
2127
  });
2197
2128
  }
@@ -2201,8 +2132,8 @@ function process$2() {
2201
2132
  return __generator(this, function (_b) {
2202
2133
  switch (_b.label) {
2203
2134
  case 0:
2204
- timer = { id: id(), cost: 3 /* LayoutCost */ };
2205
- start$x(timer);
2135
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2136
+ start$w(timer);
2206
2137
  _b.label = 1;
2207
2138
  case 1:
2208
2139
  if (!(mutations.length > 0)) return [3 /*break*/, 8];
@@ -2213,13 +2144,13 @@ function process$2() {
2213
2144
  if (!(_i < _a.length)) return [3 /*break*/, 6];
2214
2145
  mutation = _a[_i];
2215
2146
  state = state$8(timer);
2216
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2147
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2217
2148
  return [4 /*yield*/, suspend$1(timer)];
2218
2149
  case 3:
2219
2150
  state = _b.sent();
2220
2151
  _b.label = 4;
2221
2152
  case 4:
2222
- if (state === 2 /* Stop */) {
2153
+ if (state === 2 /* Task.Stop */) {
2223
2154
  return [3 /*break*/, 6];
2224
2155
  }
2225
2156
  target = mutation.target;
@@ -2231,17 +2162,17 @@ function process$2() {
2231
2162
  parse$1(target);
2232
2163
  }
2233
2164
  switch (type) {
2234
- case "attributes" /* Attributes */:
2235
- processNode(target, 3 /* Attributes */);
2165
+ case "attributes" /* Constant.Attributes */:
2166
+ processNode(target, 3 /* Source.Attributes */);
2236
2167
  break;
2237
- case "characterData" /* CharacterData */:
2238
- processNode(target, 4 /* CharacterData */);
2168
+ case "characterData" /* Constant.CharacterData */:
2169
+ processNode(target, 4 /* Source.CharacterData */);
2239
2170
  break;
2240
- case "childList" /* ChildList */:
2241
- processNodeList(mutation.addedNodes, 1 /* ChildListAdd */, timer);
2242
- processNodeList(mutation.removedNodes, 2 /* ChildListRemove */, timer);
2171
+ case "childList" /* Constant.ChildList */:
2172
+ processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer);
2173
+ processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer);
2243
2174
  break;
2244
- case "suspend" /* Suspend */:
2175
+ case "suspend" /* Constant.Suspend */:
2245
2176
  value = get(target);
2246
2177
  if (value) {
2247
2178
  value.metadata.suspend = true;
@@ -2252,12 +2183,12 @@ function process$2() {
2252
2183
  case 5:
2253
2184
  _i++;
2254
2185
  return [3 /*break*/, 2];
2255
- case 6: return [4 /*yield*/, encode$4(6 /* Mutation */, timer, record.time)];
2186
+ case 6: return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
2256
2187
  case 7:
2257
2188
  _b.sent();
2258
2189
  return [3 /*break*/, 1];
2259
2190
  case 8:
2260
- stop$u(timer);
2191
+ stop$t(timer);
2261
2192
  return [2 /*return*/];
2262
2193
  }
2263
2194
  });
@@ -2266,11 +2197,11 @@ function process$2() {
2266
2197
  function track$5(m, timer) {
2267
2198
  var value = m.target ? get(m.target.parentNode) : null;
2268
2199
  // Check if the parent is already discovered and that the parent is not the document root
2269
- if (value && value.data.tag !== "HTML" /* HTML */) {
2200
+ if (value && value.data.tag !== "HTML" /* Constant.HTML */) {
2270
2201
  var inactive = time() > activePeriod;
2271
2202
  var target = get(m.target);
2272
2203
  var element = target && target.selector ? target.selector.join() : m.target.nodeName;
2273
- var parent_1 = value.selector ? value.selector.join() : "" /* Empty */;
2204
+ var parent_1 = value.selector ? value.selector.join() : "" /* Constant.Empty */;
2274
2205
  // We use selector, instead of id, to determine the key (signature for the mutation) because in some cases
2275
2206
  // repeated mutations can cause elements to be destroyed and then recreated as new DOM nodes
2276
2207
  // In those cases, IDs will change however the selector (which is relative to DOM xPath) remains the same
@@ -2279,20 +2210,20 @@ function track$5(m, timer) {
2279
2210
  history$4[key] = key in history$4 ? history$4[key] : [0];
2280
2211
  var h = history$4[key];
2281
2212
  // Lookup any pending nodes queued up for removal, and process them now if we suspended a mutation before
2282
- if (inactive === false && h[0] >= 10 /* MutationSuspendThreshold */) {
2283
- processNodeList(h[1], 2 /* ChildListRemove */, timer);
2213
+ if (inactive === false && h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
2214
+ processNodeList(h[1], 2 /* Source.ChildListRemove */, timer);
2284
2215
  }
2285
2216
  // Update the counter
2286
2217
  h[0] = inactive ? h[0] + 1 : 1;
2287
2218
  // Return updated mutation type based on if we have already hit the threshold or not
2288
- if (h[0] === 10 /* MutationSuspendThreshold */) {
2219
+ if (h[0] === 10 /* Setting.MutationSuspendThreshold */) {
2289
2220
  // Store a reference to removedNodes so we can process them later
2290
2221
  // when we resume mutations again on user interactions
2291
2222
  h[1] = m.removedNodes;
2292
- return "suspend" /* Suspend */;
2223
+ return "suspend" /* Constant.Suspend */;
2293
2224
  }
2294
- else if (h[0] > 10 /* MutationSuspendThreshold */) {
2295
- return "" /* Empty */;
2225
+ else if (h[0] > 10 /* Setting.MutationSuspendThreshold */) {
2226
+ return "" /* Constant.Empty */;
2296
2227
  }
2297
2228
  }
2298
2229
  return m.type;
@@ -2315,18 +2246,18 @@ function processNodeList(list, source, timer) {
2315
2246
  _a.label = 1;
2316
2247
  case 1:
2317
2248
  if (!(i < length)) return [3 /*break*/, 6];
2318
- if (!(source === 1 /* ChildListAdd */)) return [3 /*break*/, 2];
2249
+ if (!(source === 1 /* Source.ChildListAdd */)) return [3 /*break*/, 2];
2319
2250
  traverse(list[i], timer, source);
2320
2251
  return [3 /*break*/, 5];
2321
2252
  case 2:
2322
2253
  state = state$8(timer);
2323
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2254
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2324
2255
  return [4 /*yield*/, suspend$1(timer)];
2325
2256
  case 3:
2326
2257
  state = _a.sent();
2327
2258
  _a.label = 4;
2328
2259
  case 4:
2329
- if (state === 2 /* Stop */) {
2260
+ if (state === 2 /* Task.Stop */) {
2330
2261
  return [3 /*break*/, 6];
2331
2262
  }
2332
2263
  processNode(list[i], source);
@@ -2351,7 +2282,7 @@ function schedule(node, fragment) {
2351
2282
  if (timeout$1) {
2352
2283
  clearTimeout(timeout$1);
2353
2284
  }
2354
- timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* LookAhead */);
2285
+ timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* Setting.LookAhead */);
2355
2286
  return node;
2356
2287
  }
2357
2288
  function trigger$1(fragment) {
@@ -2364,7 +2295,7 @@ function trigger$1(fragment) {
2364
2295
  if (shadowRoot && has(node)) {
2365
2296
  continue;
2366
2297
  }
2367
- generate(node, shadowRoot || fragment ? "childList" /* ChildList */ : "characterData" /* CharacterData */);
2298
+ generate(node, shadowRoot || fragment ? "childList" /* Constant.ChildList */ : "characterData" /* Constant.CharacterData */);
2368
2299
  }
2369
2300
  }
2370
2301
  queue$2 = [];
@@ -2384,10 +2315,6 @@ function generate(target, type) {
2384
2315
  }
2385
2316
 
2386
2317
  var index = 1;
2387
- // Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#%3Cinput%3E_types
2388
- var DISALLOWED_TYPES = ["password", "hidden", "email", "tel"];
2389
- var DISALLOWED_NAMES = ["addr", "cell", "code", "dob", "email", "mob", "name", "phone", "secret", "social", "ssn", "tel", "zip", "pass", "card", "account", "cvv", "ccv"];
2390
- var DISALLOWED_MATCH = ["address", "password", "contact"];
2391
2318
  var nodes = [];
2392
2319
  var values = [];
2393
2320
  var updateMap = [];
@@ -2395,10 +2322,13 @@ var hashMap = {};
2395
2322
  var override = [];
2396
2323
  var unmask = [];
2397
2324
  var updatedFragments = {};
2325
+ var maskText = [];
2326
+ var maskDisable = [];
2398
2327
  // The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced
2399
2328
  var idMap = null; // Maps node => id.
2400
2329
  var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
2401
2330
  var privacyMap = null; // Maps node => Privacy (enum)
2331
+ var fraudMap = null; // Maps node => FraudId (number)
2402
2332
  function start$i() {
2403
2333
  reset$7();
2404
2334
  parse$1(document, true);
@@ -2414,9 +2344,12 @@ function reset$7() {
2414
2344
  hashMap = {};
2415
2345
  override = [];
2416
2346
  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" /* Mask.Text */.split("," /* Constant.Comma */);
2348
+ maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
2417
2349
  idMap = new WeakMap();
2418
2350
  iframeMap = new WeakMap();
2419
2351
  privacyMap = new WeakMap();
2352
+ fraudMap = new WeakMap();
2420
2353
  }
2421
2354
  // We parse new root nodes for any regions or masked nodes in the beginning (document) and
2422
2355
  // later whenever there are new additions or modifications to DOM (mutations)
@@ -2427,18 +2360,19 @@ function parse$1(root, init) {
2427
2360
  try {
2428
2361
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
2429
2362
  if (init) {
2430
- config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2363
+ config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2431
2364
  }
2432
2365
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
2433
2366
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
2434
2367
  if ("querySelectorAll" in root) {
2435
- config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "" + x[0]); }); }); // Regions
2436
- config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* TextImage */); }); }); // Masked Elements
2437
- unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* None */); }); }); // Unmasked Elements
2368
+ 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 /* Privacy.TextImage */); }); }); // Masked Elements
2370
+ 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 /* Privacy.None */); }); }); // Unmasked Elements
2438
2372
  }
2439
2373
  }
2440
2374
  catch (e) {
2441
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
2375
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
2442
2376
  }
2443
2377
  }
2444
2378
  function getId(node, autogen) {
@@ -2457,22 +2391,22 @@ function add(node, parent, data, source) {
2457
2391
  var id = getId(node, true);
2458
2392
  var parentId = parent ? getId(parent) : null;
2459
2393
  var previousId = getPreviousId(node);
2460
- var privacy = config$1.content ? 1 /* Sensitive */ : 2 /* Text */;
2461
2394
  var parentValue = null;
2462
2395
  var regionId = exists(node) ? id : null;
2463
2396
  var fragmentId = null;
2397
+ var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
2398
+ var privacyId = config$1.content ? 1 /* Privacy.Sensitive */ : 2 /* Privacy.Text */;
2464
2399
  if (parentId >= 0 && values[parentId]) {
2465
2400
  parentValue = values[parentId];
2466
2401
  parentValue.children.push(id);
2467
2402
  regionId = regionId === null ? parentValue.region : regionId;
2468
2403
  fragmentId = parentValue.fragment;
2469
- privacy = parentValue.metadata.privacy;
2404
+ fraudId = fraudId === null ? parentValue.metadata.fraud : fraudId;
2405
+ privacyId = parentValue.metadata.privacy;
2470
2406
  }
2471
- // Check to see if this particular node should be masked or not
2472
- privacy = getPrivacy(node, data, parentValue, privacy);
2473
2407
  // If there's an explicit region attribute set on the element, use it to mark a region on the page
2474
- if (data.attributes && "data-clarity-region" /* RegionData */ in data.attributes) {
2475
- observe$1(node, data.attributes["data-clarity-region" /* RegionData */]);
2408
+ if (data.attributes && "data-clarity-region" /* Constant.RegionData */ in data.attributes) {
2409
+ observe$1(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
2476
2410
  regionId = id;
2477
2411
  }
2478
2412
  nodes[id] = node;
@@ -2485,11 +2419,12 @@ function add(node, parent, data, source) {
2485
2419
  selector: null,
2486
2420
  hash: null,
2487
2421
  region: regionId,
2488
- metadata: { active: true, suspend: false, privacy: privacy, position: null, size: null },
2422
+ metadata: { active: true, suspend: false, privacy: privacyId, position: null, fraud: fraudId, size: null },
2489
2423
  fragment: fragmentId,
2490
2424
  };
2425
+ privacy(node, values[id], parentValue);
2491
2426
  updateSelector(values[id]);
2492
- size(values[id], parentValue);
2427
+ size(values[id]);
2493
2428
  track$4(id, source, values[id].fragment);
2494
2429
  }
2495
2430
  function update$1(node, parent, data, source) {
@@ -2549,7 +2484,7 @@ function update$1(node, parent, data, source) {
2549
2484
  }
2550
2485
  function sameorigin(node) {
2551
2486
  var output = false;
2552
- if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* IFrameTag */) {
2487
+ if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* Constant.IFrameTag */) {
2553
2488
  var frame = node;
2554
2489
  // To determine if the iframe is same-origin or not, we try accessing it's contentDocument.
2555
2490
  // If the browser throws an exception, we assume it's cross-origin and move on.
@@ -2569,75 +2504,61 @@ function iframe(node) {
2569
2504
  var doc = node.nodeType === Node.DOCUMENT_NODE ? node : null;
2570
2505
  return doc && iframeMap.has(doc) ? iframeMap.get(doc) : null;
2571
2506
  }
2572
- function getPrivacy(node, data, parent, privacy) {
2573
- var attributes = data.attributes;
2507
+ function privacy(node, value, parent) {
2508
+ var data = value.data;
2509
+ var metadata = value.metadata;
2510
+ var current = metadata.privacy;
2511
+ var attributes = data.attributes || {};
2574
2512
  var tag = data.tag.toUpperCase();
2575
- // If this node was explicitly configured to contain sensitive content, use that information and return the value
2576
- if (privacyMap.has(node)) {
2577
- return privacyMap.get(node);
2578
- }
2579
- // If it's a text node belonging to a STYLE or TITLE tag;
2580
- // Or, the text node belongs to one of SCRUB_EXCEPTIONS
2581
- // then reset the privacy setting to ensure we capture the content
2582
- if (tag === "*T" /* TextTag */ && parent && parent.data) {
2583
- var path = parent.selector ? parent.selector[0 /* Stable */] : "" /* Empty */;
2584
- privacy = parent.data.tag === "STYLE" /* StyleTag */ || parent.data.tag === "TITLE" /* TitleTag */ ? 0 /* None */ : privacy;
2585
- for (var _i = 0, override_1 = override; _i < override_1.length; _i++) {
2586
- var entry = override_1[_i];
2587
- if (path.indexOf(entry) >= 0) {
2588
- privacy = 0 /* None */;
2589
- break;
2590
- }
2591
- }
2592
- }
2593
- // Do not proceed if attributes are missing for the node
2594
- if (attributes === null || attributes === undefined) {
2595
- return privacy;
2596
- }
2597
- // Look up for sensitive fields
2598
- if ("class" /* Class */ in attributes && privacy === 1 /* Sensitive */) {
2599
- for (var _a = 0, DISALLOWED_MATCH_1 = DISALLOWED_MATCH; _a < DISALLOWED_MATCH_1.length; _a++) {
2600
- var match = DISALLOWED_MATCH_1[_a];
2601
- if (attributes["class" /* Class */].indexOf(match) >= 0) {
2602
- privacy = 2 /* Text */;
2603
- break;
2604
- }
2605
- }
2606
- }
2607
- // Check for disallowed list of fields (e.g. address, phone, etc.) only if the input node is not already masked
2608
- if (tag === "INPUT" /* InputTag */) {
2609
- if (privacy === 0 /* None */) {
2610
- var field = "" /* Empty */;
2611
- // Be aggressive in looking up any attribute (id, class, name, etc.) for disallowed names
2612
- for (var _b = 0, _c = Object.keys(attributes); _b < _c.length; _b++) {
2613
- var attribute = _c[_b];
2614
- field += attributes[attribute].toLowerCase();
2615
- }
2616
- for (var _d = 0, DISALLOWED_NAMES_1 = DISALLOWED_NAMES; _d < DISALLOWED_NAMES_1.length; _d++) {
2617
- var name_1 = DISALLOWED_NAMES_1[_d];
2618
- if (field.indexOf(name_1) >= 0) {
2619
- privacy = 2 /* Text */;
2620
- break;
2621
- }
2622
- }
2623
- }
2624
- else if (privacy === 1 /* Sensitive */) {
2625
- // Mask all input fields with an exception of type=submit; since they do not accept user input
2626
- privacy = attributes && attributes["type" /* Type */] === "submit" /* Submit */ ? 0 /* None */ : 2 /* Text */;
2627
- }
2628
- }
2629
- // Check for disallowed list of types (e.g. password, email, etc.) and set the masked property appropriately
2630
- if ("type" /* Type */ in attributes && DISALLOWED_TYPES.indexOf(attributes["type" /* Type */]) >= 0) {
2631
- privacy = 2 /* Text */;
2632
- }
2633
- // Following two conditions supersede any of the above. If there are explicit instructions to mask / unmask a field, we honor that.
2634
- if ("data-clarity-mask" /* MaskData */ in attributes) {
2635
- privacy = 3 /* TextImage */;
2513
+ switch (true) {
2514
+ case "data-clarity-mask" /* Constant.MaskData */ in attributes:
2515
+ metadata.privacy = 3 /* Privacy.TextImage */;
2516
+ break;
2517
+ case "data-clarity-unmask" /* Constant.UnmaskData */ in attributes:
2518
+ metadata.privacy = 0 /* Privacy.None */;
2519
+ break;
2520
+ case privacyMap.has(node):
2521
+ // If this node was explicitly configured to contain sensitive content, honor that privacy setting
2522
+ metadata.privacy = privacyMap.get(node);
2523
+ break;
2524
+ case fraudMap.has(node):
2525
+ // If this node was explicitly configured to be evaluated for fraud, then also mask content
2526
+ metadata.privacy = 2 /* Privacy.Text */;
2527
+ break;
2528
+ case tag === "*T" /* Constant.TextTag */:
2529
+ // If it's a text node belonging to a STYLE or TITLE tag or one of SCRUB_EXCEPTIONS, then capture content
2530
+ var pTag = parent && parent.data ? parent.data.tag : "" /* Constant.Empty */;
2531
+ var pSelector_1 = parent && parent.selector ? parent.selector[0 /* Selector.Stable */] : "" /* Constant.Empty */;
2532
+ metadata.privacy = pTag === "STYLE" /* Constant.StyleTag */ || pTag === "TITLE" /* Constant.TitleTag */ || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* Privacy.None */ : current;
2533
+ break;
2534
+ case "type" /* Constant.Type */ in attributes:
2535
+ // If this node has an explicit type assigned to it, go through masking rules to determine right privacy setting
2536
+ metadata.privacy = inspect(attributes["type" /* Constant.Type */], metadata);
2537
+ break;
2538
+ case tag === "INPUT" /* Constant.InputTag */ && current === 0 /* Privacy.None */:
2539
+ // If even default privacy setting is to not mask, we still scan through input fields for any sensitive information
2540
+ var field_1 = "" /* Constant.Empty */;
2541
+ Object.keys(attributes).forEach(function (x) { return field_1 += attributes[x].toLowerCase(); });
2542
+ metadata.privacy = inspect(field_1, metadata);
2543
+ break;
2544
+ case current === 1 /* Privacy.Sensitive */ && tag === "INPUT" /* Constant.InputTag */:
2545
+ // If it's a button or an input option, make an exception to disable masking
2546
+ metadata.privacy = maskDisable.indexOf(attributes["type" /* Constant.Type */]) >= 0 ? 0 /* Privacy.None */ : current;
2547
+ break;
2548
+ case current === 1 /* Privacy.Sensitive */:
2549
+ // In a mode where we mask sensitive information by default, look through class names to aggressively mask content
2550
+ metadata.privacy = inspect(attributes["class" /* Constant.Class */], metadata);
2551
+ break;
2552
+ default:
2553
+ metadata.privacy = parent ? parent.metadata.privacy : metadata.privacy;
2554
+ break;
2636
2555
  }
2637
- if ("data-clarity-unmask" /* UnmaskData */ in attributes) {
2638
- privacy = 0 /* None */;
2556
+ }
2557
+ function inspect(input, metadata) {
2558
+ if (input && maskText.some(function (x) { return input.indexOf(x) >= 0; })) {
2559
+ return 2 /* Privacy.Text */;
2639
2560
  }
2640
- return privacy;
2561
+ return metadata.privacy;
2641
2562
  }
2642
2563
  function diff(a, b, field) {
2643
2564
  if (typeof a[field] === "object" && typeof b[field] === "object") {
@@ -2725,17 +2646,9 @@ function remove(id, source) {
2725
2646
  track$4(id, source);
2726
2647
  }
2727
2648
  }
2728
- function size(value, parent) {
2729
- var data = value.data;
2730
- var tag = data.tag;
2731
- // If this element is a text node, is masked, and longer than configured length, then track box model for the parent element
2732
- var isLongText = tag === "*T" /* TextTag */ && data.value && data.value.length > 15 /* ResizeObserverThreshold */;
2733
- var isMasked = value.metadata.privacy === 2 /* Text */ || value.metadata.privacy === 3 /* TextImage */;
2734
- if (isLongText && isMasked && parent && parent.metadata.size === null) {
2735
- parent.metadata.size = [];
2736
- }
2649
+ function size(value) {
2737
2650
  // If this element is a image node, and is masked, then track box model for the current element
2738
- if (data.tag === "IMG" /* ImageTag */ && value.metadata.privacy === 3 /* TextImage */) {
2651
+ if (value.data.tag === "IMG" /* Constant.ImageTag */ && value.metadata.privacy === 3 /* Privacy.TextImage */) {
2739
2652
  value.metadata.size = [];
2740
2653
  }
2741
2654
  }
@@ -2770,7 +2683,7 @@ function track$4(id, source, fragment, changed, parentChanged) {
2770
2683
  // Edge case: If an element is added later on, and pre-discovered element is moved as a child.
2771
2684
  // In that case, we need to reorder the pre-discovered element in the update list to keep visualization consistent.
2772
2685
  var uIndex = updateMap.indexOf(id);
2773
- if (uIndex >= 0 && source === 1 /* ChildListAdd */ && parentChanged) {
2686
+ if (uIndex >= 0 && source === 1 /* Source.ChildListAdd */ && parentChanged) {
2774
2687
  updateMap.splice(uIndex, 1);
2775
2688
  updateMap.push(id);
2776
2689
  }
@@ -2816,15 +2729,15 @@ function exists(node) {
2816
2729
  }
2817
2730
  function track$3(id, event) {
2818
2731
  var node = getNode(id);
2819
- var data = id in regions ? regions[id] : { id: id, visibility: 0 /* Rendered */, interaction: 16 /* None */, name: regionMap.get(node) };
2732
+ var data = id in regions ? regions[id] : { id: id, visibility: 0 /* RegionVisibility.Rendered */, interaction: 16 /* InteractionState.None */, name: regionMap.get(node) };
2820
2733
  // Determine the interaction state based on incoming event
2821
- var interaction = 16 /* None */;
2734
+ var interaction = 16 /* InteractionState.None */;
2822
2735
  switch (event) {
2823
- case 9 /* Click */:
2824
- interaction = 20 /* Clicked */;
2736
+ case 9 /* Event.Click */:
2737
+ interaction = 20 /* InteractionState.Clicked */;
2825
2738
  break;
2826
- case 27 /* Input */:
2827
- interaction = 30 /* Input */;
2739
+ case 27 /* Event.Input */:
2740
+ interaction = 30 /* InteractionState.Input */;
2828
2741
  break;
2829
2742
  }
2830
2743
  // Process updates to this region, if applicable
@@ -2852,7 +2765,7 @@ function compute$6() {
2852
2765
  queue$1 = q;
2853
2766
  // Schedule encode only when we have at least one valid data entry
2854
2767
  if (state$1.length > 0) {
2855
- encode$4(7 /* Region */);
2768
+ encode$4(7 /* Event.Region */);
2856
2769
  }
2857
2770
  }
2858
2771
  function handler$1(entries) {
@@ -2868,27 +2781,27 @@ function handler$1(entries) {
2868
2781
  // 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
2869
2782
  if (regionMap.has(target) && rect.width + rect.height > 0 && viewport.width > 0 && viewport.height > 0) {
2870
2783
  var id = target ? getId(target) : null;
2871
- var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* None */, visibility: 0 /* Rendered */ };
2784
+ var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* InteractionState.None */, visibility: 0 /* RegionVisibility.Rendered */ };
2872
2785
  // For regions that have relatively smaller area, we look at intersection ratio and see the overlap relative to element's area
2873
2786
  // However, for larger regions, area of regions could be bigger than viewport and therefore comparison is relative to visible area
2874
2787
  var viewportRatio = overlap ? (overlap.width * overlap.height * 1.0) / (viewport.width * viewport.height) : 0;
2875
- var visible = viewportRatio > 0.05 /* ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* IntersectionRatio */;
2788
+ var visible = viewportRatio > 0.05 /* Setting.ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* Setting.IntersectionRatio */;
2876
2789
  // If an element is either visible or was visible and has been scrolled to the end
2877
2790
  // 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.
2878
2791
  // 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
2879
- var scrolledToEnd = (visible || data.visibility == 10 /* Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2792
+ var scrolledToEnd = (visible || data.visibility == 10 /* RegionVisibility.Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2880
2793
  // Process updates to this region, if applicable
2881
2794
  process$1(target, data, data.interaction, (scrolledToEnd ?
2882
- 13 /* ScrolledToEnd */ :
2883
- (visible ? 10 /* Visible */ : 0 /* Rendered */)));
2795
+ 13 /* RegionVisibility.ScrolledToEnd */ :
2796
+ (visible ? 10 /* RegionVisibility.Visible */ : 0 /* RegionVisibility.Rendered */)));
2884
2797
  // Stop observing this element now that we have already received scrolled signal
2885
- if (data.visibility >= 13 /* ScrolledToEnd */ && observer$1) {
2798
+ if (data.visibility >= 13 /* RegionVisibility.ScrolledToEnd */ && observer$1) {
2886
2799
  observer$1.unobserve(target);
2887
2800
  }
2888
2801
  }
2889
2802
  }
2890
2803
  if (state$1.length > 0) {
2891
- encode$4(7 /* Region */);
2804
+ encode$4(7 /* Event.Region */);
2892
2805
  }
2893
2806
  }
2894
2807
  function process$1(n, d, s, v) {
@@ -2944,18 +2857,23 @@ function link(node) {
2944
2857
  }
2945
2858
  return null;
2946
2859
  }
2947
- function metadata$2(node, event) {
2860
+ function metadata$2(node, event, text) {
2861
+ if (text === void 0) { text = null; }
2948
2862
  // If the node is null, we return a reserved value for id: 0. Valid assignment of id begins from 1+.
2949
- var output = { id: 0, hash: null, privacy: 2 /* Text */, node: node };
2863
+ var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */, node: node };
2950
2864
  if (node) {
2951
2865
  var value = get(node);
2952
2866
  if (value !== null) {
2867
+ var metadata_1 = value.metadata;
2953
2868
  output.id = value.id;
2954
2869
  output.hash = value.hash;
2955
- output.privacy = value.metadata.privacy;
2870
+ output.privacy = metadata_1.privacy;
2956
2871
  if (value.region) {
2957
2872
  track$3(value.region, event);
2958
2873
  }
2874
+ if (metadata_1.fraud) {
2875
+ check$4(metadata_1.fraud, value.id, text || value.data.value);
2876
+ }
2959
2877
  }
2960
2878
  }
2961
2879
  return output;
@@ -2968,15 +2886,15 @@ function encode$3 (type) {
2968
2886
  t = time();
2969
2887
  tokens = [t, type];
2970
2888
  switch (type) {
2971
- case 13 /* MouseDown */:
2972
- case 14 /* MouseUp */:
2973
- case 12 /* MouseMove */:
2974
- case 15 /* MouseWheel */:
2975
- case 16 /* DoubleClick */:
2976
- case 17 /* TouchStart */:
2977
- case 18 /* TouchEnd */:
2978
- case 19 /* TouchMove */:
2979
- case 20 /* TouchCancel */:
2889
+ case 13 /* Event.MouseDown */:
2890
+ case 14 /* Event.MouseUp */:
2891
+ case 12 /* Event.MouseMove */:
2892
+ case 15 /* Event.MouseWheel */:
2893
+ case 16 /* Event.DoubleClick */:
2894
+ case 17 /* Event.TouchStart */:
2895
+ case 18 /* Event.TouchEnd */:
2896
+ case 19 /* Event.TouchMove */:
2897
+ case 20 /* Event.TouchCancel */:
2980
2898
  for (_i = 0, _a = state$4; _i < _a.length; _i++) {
2981
2899
  entry = _a[_i];
2982
2900
  pTarget = metadata$2(entry.data.target, entry.event);
@@ -2991,12 +2909,12 @@ function encode$3 (type) {
2991
2909
  }
2992
2910
  reset$e();
2993
2911
  break;
2994
- case 9 /* Click */:
2912
+ case 9 /* Event.Click */:
2995
2913
  for (_b = 0, _c = state$7; _b < _c.length; _b++) {
2996
2914
  entry = _c[_b];
2997
- cTarget = metadata$2(entry.data.target, entry.event);
2915
+ cTarget = metadata$2(entry.data.target, entry.event, entry.data.text);
2998
2916
  tokens = [entry.time, entry.event];
2999
- cHash = cTarget.hash.join("." /* Dot */);
2917
+ cHash = cTarget.hash.join("." /* Constant.Dot */);
3000
2918
  tokens.push(cTarget.id);
3001
2919
  tokens.push(entry.data.x);
3002
2920
  tokens.push(entry.data.y);
@@ -3008,12 +2926,13 @@ function encode$3 (type) {
3008
2926
  tokens.push(scrub(entry.data.text, "click", cTarget.privacy));
3009
2927
  tokens.push(entry.data.link);
3010
2928
  tokens.push(cHash);
2929
+ tokens.push(entry.data.trust);
3011
2930
  queue(tokens);
3012
2931
  track$2(entry.time, entry.event, cHash, entry.data.x, entry.data.y, entry.data.reaction, entry.data.context);
3013
2932
  }
3014
2933
  reset$h();
3015
2934
  break;
3016
- case 38 /* Clipboard */:
2935
+ case 38 /* Event.Clipboard */:
3017
2936
  for (_d = 0, _e = state$6; _d < _e.length; _d++) {
3018
2937
  entry = _e[_d];
3019
2938
  tokens = [entry.time, entry.event];
@@ -3026,7 +2945,7 @@ function encode$3 (type) {
3026
2945
  }
3027
2946
  reset$g();
3028
2947
  break;
3029
- case 11 /* Resize */:
2948
+ case 11 /* Event.Resize */:
3030
2949
  r = data$b;
3031
2950
  tokens.push(r.width);
3032
2951
  tokens.push(r.height);
@@ -3034,24 +2953,24 @@ function encode$3 (type) {
3034
2953
  reset$d();
3035
2954
  queue(tokens);
3036
2955
  break;
3037
- case 26 /* Unload */:
2956
+ case 26 /* Event.Unload */:
3038
2957
  u = data$9;
3039
2958
  tokens.push(u.name);
3040
2959
  reset$9();
3041
2960
  queue(tokens);
3042
2961
  break;
3043
- case 27 /* Input */:
2962
+ case 27 /* Event.Input */:
3044
2963
  for (_f = 0, _g = state$5; _f < _g.length; _f++) {
3045
2964
  entry = _g[_f];
3046
- iTarget = metadata$2(entry.data.target, entry.event);
2965
+ iTarget = metadata$2(entry.data.target, entry.event, entry.data.value);
3047
2966
  tokens = [entry.time, entry.event];
3048
2967
  tokens.push(iTarget.id);
3049
- tokens.push(entry.data.value);
2968
+ tokens.push(scrub(entry.data.value, "input", iTarget.privacy));
3050
2969
  queue(tokens);
3051
2970
  }
3052
2971
  reset$f();
3053
2972
  break;
3054
- case 21 /* Selection */:
2973
+ case 21 /* Event.Selection */:
3055
2974
  s = data$a;
3056
2975
  if (s) {
3057
2976
  startTarget = metadata$2(s.start, type);
@@ -3064,7 +2983,7 @@ function encode$3 (type) {
3064
2983
  queue(tokens);
3065
2984
  }
3066
2985
  break;
3067
- case 10 /* Scroll */:
2986
+ case 10 /* Event.Scroll */:
3068
2987
  for (_h = 0, _j = state$3; _h < _j.length; _h++) {
3069
2988
  entry = _j[_h];
3070
2989
  sTarget = metadata$2(entry.data.target, entry.event);
@@ -3079,7 +2998,7 @@ function encode$3 (type) {
3079
2998
  }
3080
2999
  reset$c();
3081
3000
  break;
3082
- case 39 /* Submit */:
3001
+ case 39 /* Event.Submit */:
3083
3002
  for (_k = 0, _l = state$2; _k < _l.length; _k++) {
3084
3003
  entry = _l[_k];
3085
3004
  tokens = [entry.time, entry.event];
@@ -3091,7 +3010,7 @@ function encode$3 (type) {
3091
3010
  }
3092
3011
  reset$a();
3093
3012
  break;
3094
- case 22 /* Timeline */:
3013
+ case 22 /* Event.Timeline */:
3095
3014
  for (_m = 0, _o = updates$1; _m < _o.length; _m++) {
3096
3015
  entry = _o[_m];
3097
3016
  tokens = [entry.time, entry.event];
@@ -3105,7 +3024,7 @@ function encode$3 (type) {
3105
3024
  }
3106
3025
  reset$5();
3107
3026
  break;
3108
- case 28 /* Visibility */:
3027
+ case 28 /* Event.Visibility */:
3109
3028
  v = data$8;
3110
3029
  tokens.push(v.visible);
3111
3030
  queue(tokens);
@@ -3128,11 +3047,11 @@ function reset$5() {
3128
3047
  updates$1 = [];
3129
3048
  }
3130
3049
  function track$2(time, event, hash, x, y, reaction, context) {
3131
- if (reaction === void 0) { reaction = 1 /* True */; }
3132
- if (context === void 0) { context = 0 /* Self */; }
3050
+ if (reaction === void 0) { reaction = 1 /* BooleanFlag.True */; }
3051
+ if (context === void 0) { context = 0 /* BrowsingContext.Self */; }
3133
3052
  state.push({
3134
3053
  time: time,
3135
- event: 22 /* Timeline */,
3054
+ event: 22 /* Event.Timeline */,
3136
3055
  data: {
3137
3056
  type: event,
3138
3057
  hash: hash,
@@ -3151,7 +3070,7 @@ function compute$5() {
3151
3070
  var temp = [];
3152
3071
  updates$1 = [];
3153
3072
  var max = data$1.start + data$1.duration;
3154
- var min = Math.max(max - 2000 /* TimelineSpan */, 0);
3073
+ var min = Math.max(max - 2000 /* Setting.TimelineSpan */, 0);
3155
3074
  for (var _i = 0, state_1 = state; _i < state_1.length; _i++) {
3156
3075
  var s = state_1[_i];
3157
3076
  if (s.time >= min) {
@@ -3162,7 +3081,7 @@ function compute$5() {
3162
3081
  }
3163
3082
  }
3164
3083
  state = temp; // Drop events less than the min time
3165
- encode$3(22 /* Timeline */);
3084
+ encode$3(22 /* Event.Timeline */);
3166
3085
  }
3167
3086
  function stop$e() {
3168
3087
  state = [];
@@ -3195,10 +3114,10 @@ function queue(tokens, transmit) {
3195
3114
  var type = tokens.length > 1 ? tokens[1] : null;
3196
3115
  var event_1 = JSON.stringify(tokens);
3197
3116
  switch (type) {
3198
- case 5 /* Discover */:
3117
+ case 5 /* Event.Discover */:
3199
3118
  discoverBytes += event_1.length;
3200
- case 37 /* Box */:
3201
- case 6 /* Mutation */:
3119
+ case 37 /* Event.Box */:
3120
+ case 6 /* Event.Mutation */:
3202
3121
  playbackBytes += event_1.length;
3203
3122
  playback.push(event_1);
3204
3123
  break;
@@ -3207,7 +3126,7 @@ function queue(tokens, transmit) {
3207
3126
  break;
3208
3127
  }
3209
3128
  // Increment event count metric
3210
- count$1(25 /* EventCount */);
3129
+ count$1(25 /* Metric.EventCount */);
3211
3130
  // Following two checks are precautionary and act as a fail safe mechanism to get out of unexpected situations.
3212
3131
  // Check 1: If for any reason the upload hasn't happened after waiting for 2x the config.delay time,
3213
3132
  // reset the timer. This allows Clarity to attempt an upload again.
@@ -3220,8 +3139,8 @@ function queue(tokens, transmit) {
3220
3139
  // However, in certain scenarios - like metric calculation - which are triggered as part of an existing upload
3221
3140
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
3222
3141
  if (transmit && timeout === null) {
3223
- if (type !== 25 /* Ping */) {
3224
- reset$n();
3142
+ if (type !== 25 /* Event.Ping */) {
3143
+ reset$m();
3225
3144
  }
3226
3145
  timeout = setTimeout(upload, gap);
3227
3146
  queuedTime = now;
@@ -3249,19 +3168,19 @@ function upload(final) {
3249
3168
  switch (_b.label) {
3250
3169
  case 0:
3251
3170
  timeout = null;
3252
- sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* MaxFirstPayloadBytes */ || data$1.sequence > 0);
3171
+ sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
3253
3172
  if (sendPlaybackBytes) {
3254
- max(1 /* Playback */, 1 /* True */);
3173
+ max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
3255
3174
  }
3256
3175
  // CAUTION: Ensure "transmit" is set to false in the queue function for following events
3257
3176
  // Otherwise you run a risk of infinite loop.
3258
3177
  compute$6();
3259
3178
  compute$5();
3260
- compute$9();
3179
+ compute$8();
3261
3180
  last = final === true;
3262
3181
  e = JSON.stringify(envelope(last));
3263
- a = "[" + analysis.join() + "]";
3264
- p = sendPlaybackBytes ? "[" + playback.join() + "]" : "" /* Empty */;
3182
+ a = "[".concat(analysis.join(), "]");
3183
+ p = sendPlaybackBytes ? "[".concat(playback.join(), "]") : "" /* Constant.Empty */;
3265
3184
  encoded = { e: e, a: a, p: p };
3266
3185
  payload = stringify(encoded);
3267
3186
  if (!last) return [3 /*break*/, 1];
@@ -3273,7 +3192,7 @@ function upload(final) {
3273
3192
  _b.label = 3;
3274
3193
  case 3:
3275
3194
  zipped = _a;
3276
- sum(2 /* TotalBytes */, zipped ? zipped.length : payload.length);
3195
+ sum(2 /* Metric.TotalBytes */, zipped ? zipped.length : payload.length);
3277
3196
  send(payload, zipped, data$1.sequence, last);
3278
3197
  // Clear out events now that payload has been dispatched
3279
3198
  analysis = [];
@@ -3288,12 +3207,12 @@ function upload(final) {
3288
3207
  });
3289
3208
  }
3290
3209
  function stringify(encoded) {
3291
- return encoded.p.length > 0 ? "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + ",\"p\":" + encoded.p + "}" : "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + "}";
3210
+ return encoded.p.length > 0 ? "{\"e\":".concat(encoded.e, ",\"a\":").concat(encoded.a, ",\"p\":").concat(encoded.p, "}") : "{\"e\":".concat(encoded.e, ",\"a\":").concat(encoded.a, "}");
3292
3211
  }
3293
3212
  function send(payload, zipped, sequence, beacon) {
3294
3213
  if (beacon === void 0) { beacon = false; }
3295
3214
  // Upload data if a valid URL is defined in the config
3296
- if (typeof config$1.upload === "string" /* String */) {
3215
+ if (typeof config$1.upload === "string" /* Constant.String */) {
3297
3216
  var url = config$1.upload;
3298
3217
  var dispatched = false;
3299
3218
  // If it's the last payload, attempt to upload using sendBeacon first.
@@ -3332,7 +3251,7 @@ function send(payload, zipped, sequence, beacon) {
3332
3251
  xhr_1.withCredentials = true;
3333
3252
  if (zipped) {
3334
3253
  // If we do have valid compressed array, send it with appropriate HTTP headers so server can decode it appropriately
3335
- xhr_1.setRequestHeader("Accept" /* Accept */, "application/x-clarity-gzip" /* ClarityGzip */);
3254
+ xhr_1.setRequestHeader("Accept" /* Constant.Accept */, "application/x-clarity-gzip" /* Constant.ClarityGzip */);
3336
3255
  xhr_1.send(zipped);
3337
3256
  }
3338
3257
  else {
@@ -3349,13 +3268,13 @@ function send(payload, zipped, sequence, beacon) {
3349
3268
  }
3350
3269
  function check$3(xhr, sequence) {
3351
3270
  var transitData = transit[sequence];
3352
- if (xhr && xhr.readyState === 4 /* Done */ && transitData) {
3271
+ if (xhr && xhr.readyState === 4 /* XMLReadyState.Done */ && transitData) {
3353
3272
  // Attempt send payload again (as configured in settings) if we do not receive a success (2XX) response code back from the server
3354
- if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* RetryLimit */) {
3273
+ if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* Setting.RetryLimit */) {
3355
3274
  // We re-attempt in all cases except when server explicitly rejects our request with 4XX error
3356
3275
  if (xhr.status >= 400 && xhr.status < 500) {
3357
3276
  // In case of a 4XX response from the server, we bail out instead of trying again
3358
- trigger(6 /* Server */);
3277
+ trigger(6 /* Check.Server */);
3359
3278
  }
3360
3279
  else {
3361
3280
  // Browser will send status = 0 when it refuses to put network request over the wire
@@ -3376,7 +3295,7 @@ function check$3(xhr, sequence) {
3376
3295
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
3377
3296
  // Send back an event only if we were not successful in our first attempt
3378
3297
  if (transitData.attempts > 1) {
3379
- encode$1(2 /* Upload */);
3298
+ encode$1(2 /* Event.Upload */);
3380
3299
  }
3381
3300
  // Handle response if it was a 200 response with a valid body
3382
3301
  if (xhr.status === 200 && xhr.responseText) {
@@ -3387,7 +3306,7 @@ function check$3(xhr, sequence) {
3387
3306
  // And, right before we terminate the session, we will attempt one last time to see if we can use
3388
3307
  // different transport option (sendBeacon vs. XHR) to get this data to the server for analysis purposes
3389
3308
  send(transitData.data, null, sequence, true);
3390
- trigger(3 /* Retry */);
3309
+ trigger(3 /* Check.Retry */);
3391
3310
  }
3392
3311
  // Signal that this request completed successfully
3393
3312
  if (xhr.status >= 200 && xhr.status <= 208) {
@@ -3407,19 +3326,19 @@ function done(sequence) {
3407
3326
  function delay() {
3408
3327
  // Progressively increase delay as we continue to send more payloads from the client to the server
3409
3328
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
3410
- var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* MinUploadDelay */ : data$1.sequence * config$1.delay;
3411
- return typeof config$1.upload === "string" /* String */ ? Math.max(Math.min(gap, 30000 /* MaxUploadDelay */), 100 /* MinUploadDelay */) : config$1.delay;
3329
+ var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$1.delay;
3330
+ return typeof config$1.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$1.delay;
3412
3331
  }
3413
3332
  function response(payload) {
3414
- var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Empty */;
3333
+ var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Constant.Empty */;
3415
3334
  switch (key) {
3416
- case "END" /* End */:
3335
+ case "END" /* Constant.End */:
3417
3336
  // Clear out session storage and end the session so we can start fresh the next time
3418
- trigger(6 /* Server */);
3337
+ trigger(6 /* Check.Server */);
3419
3338
  break;
3420
- case "UPGRADE" /* Upgrade */:
3339
+ case "UPGRADE" /* Constant.Upgrade */:
3421
3340
  // Upgrade current session to send back playback information
3422
- upgrade("Auto" /* Auto */);
3341
+ upgrade("Auto" /* Constant.Auto */);
3423
3342
  break;
3424
3343
  }
3425
3344
  }
@@ -3437,7 +3356,7 @@ function handler(error) {
3437
3356
  if (!(e.message in history$3)) {
3438
3357
  history$3[e.message] = 0;
3439
3358
  }
3440
- if (history$3[e.message]++ >= 5 /* ScriptErrorLimit */) {
3359
+ if (history$3[e.message]++ >= 5 /* Setting.ScriptErrorLimit */) {
3441
3360
  return true;
3442
3361
  }
3443
3362
  // Send back information only if the handled error has valid information
@@ -3449,15 +3368,7 @@ function handler(error) {
3449
3368
  stack: e.stack,
3450
3369
  source: error["filename"]
3451
3370
  };
3452
- // In certain cases, ResizeObserver could lead to flood of benign errors - especially when video element is involved.
3453
- // Reference Chromium issue: https://bugs.chromium.org/p/chromium/issues/detail?id=809574
3454
- // Even though it doesn't impact user experience, or show up in console, it can still flood error reporting through on error
3455
- // To mitigate that, we turn off Clarity's ResizeObserver on getting the first instance of this error
3456
- if (e.message.indexOf("ResizeObserver" /* ResizeObserver */) >= 0) {
3457
- stop$t();
3458
- return false;
3459
- }
3460
- encode$2(31 /* ScriptError */);
3371
+ encode$2(31 /* Event.ScriptError */);
3461
3372
  }
3462
3373
  return true;
3463
3374
  }
@@ -3468,7 +3379,7 @@ function encode$2 (type) {
3468
3379
  return __generator(this, function (_a) {
3469
3380
  tokens = [time(), type];
3470
3381
  switch (type) {
3471
- case 31 /* ScriptError */:
3382
+ case 31 /* Event.ScriptError */:
3472
3383
  tokens.push(data$7.message);
3473
3384
  tokens.push(data$7.line);
3474
3385
  tokens.push(data$7.column);
@@ -3476,7 +3387,7 @@ function encode$2 (type) {
3476
3387
  tokens.push(data$7.source);
3477
3388
  queue(tokens);
3478
3389
  break;
3479
- case 33 /* Log */:
3390
+ case 33 /* Event.Log */:
3480
3391
  if (data$6) {
3481
3392
  tokens.push(data$6.code);
3482
3393
  tokens.push(data$6.name);
@@ -3486,6 +3397,14 @@ function encode$2 (type) {
3486
3397
  queue(tokens, false);
3487
3398
  }
3488
3399
  break;
3400
+ case 41 /* Event.Fraud */:
3401
+ if (data$d) {
3402
+ tokens.push(data$d.id);
3403
+ tokens.push(data$d.target);
3404
+ tokens.push(data$d.hash);
3405
+ queue(tokens, false);
3406
+ }
3407
+ break;
3489
3408
  }
3490
3409
  return [2 /*return*/];
3491
3410
  });
@@ -3501,7 +3420,7 @@ function log$1(code, severity, name, message, stack) {
3501
3420
  if (name === void 0) { name = null; }
3502
3421
  if (message === void 0) { message = null; }
3503
3422
  if (stack === void 0) { stack = null; }
3504
- var key = name ? name + "|" + message : "";
3423
+ var key = name ? "".concat(name, "|").concat(message) : "";
3505
3424
  // While rare, it's possible for code to fail repeatedly during the lifetime of the same page
3506
3425
  // In those cases, we only want to log the failure once and not spam logs with redundant information.
3507
3426
  if (code in history$2 && history$2[code].indexOf(key) >= 0) {
@@ -3515,7 +3434,7 @@ function log$1(code, severity, name, message, stack) {
3515
3434
  else {
3516
3435
  history$2[code] = [key];
3517
3436
  }
3518
- encode$2(33 /* Log */);
3437
+ encode$2(33 /* Event.Log */);
3519
3438
  }
3520
3439
  function stop$c() {
3521
3440
  history$2 = {};
@@ -3536,25 +3455,25 @@ function start$c() {
3536
3455
  var source = e[i];
3537
3456
  var key = e[i + 1];
3538
3457
  switch (source) {
3539
- case 0 /* Javascript */:
3458
+ case 0 /* ExtractSource.Javascript */:
3540
3459
  var variable = e[i + 2];
3541
3460
  variables[key] = parse(variable);
3542
3461
  break;
3543
- case 1 /* Cookie */:
3462
+ case 1 /* ExtractSource.Cookie */:
3544
3463
  /*Todo: Add cookie extract logic*/
3545
3464
  break;
3546
- case 2 /* Text */:
3465
+ case 2 /* ExtractSource.Text */:
3547
3466
  var match_1 = e[i + 2];
3548
3467
  selectors[key] = match_1;
3549
3468
  break;
3550
- case 3 /* Fragment */:
3469
+ case 3 /* ExtractSource.Fragment */:
3551
3470
  fragments = e[i + 2];
3552
3471
  break;
3553
3472
  }
3554
3473
  }
3555
3474
  }
3556
3475
  catch (e) {
3557
- log$1(8 /* Config */, 1 /* Warning */, e ? e.name : null);
3476
+ log$1(8 /* Code.Config */, 1 /* Severity.Warning */, e ? e.name : null);
3558
3477
  }
3559
3478
  }
3560
3479
  function clone(v) {
@@ -3576,9 +3495,9 @@ function compute$4() {
3576
3495
  }
3577
3496
  }
3578
3497
  catch (e) {
3579
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
3498
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
3580
3499
  }
3581
- encode$1(40 /* Extract */);
3500
+ encode$1(40 /* Event.Extract */);
3582
3501
  }
3583
3502
  function reset$4() {
3584
3503
  keys = [];
@@ -3598,15 +3517,15 @@ function stop$b() {
3598
3517
  }
3599
3518
  function parse(variable) {
3600
3519
  var syntax = [];
3601
- var parts = variable.split("." /* Dot */);
3520
+ var parts = variable.split("." /* Constant.Dot */);
3602
3521
  while (parts.length > 0) {
3603
3522
  var part = parts.shift();
3604
- var arrayStart = part.indexOf("[" /* ArrayStart */);
3605
- var conditionStart = part.indexOf("{" /* ConditionStart */);
3606
- var conditionEnd = part.indexOf("}" /* ConditionEnd */);
3523
+ var arrayStart = part.indexOf("[" /* Constant.ArrayStart */);
3524
+ var conditionStart = part.indexOf("{" /* Constant.ConditionStart */);
3525
+ var conditionEnd = part.indexOf("}" /* Constant.ConditionEnd */);
3607
3526
  syntax.push({
3608
3527
  name: arrayStart > 0 ? part.substring(0, arrayStart) : (conditionStart > 0 ? part.substring(0, conditionStart) : part),
3609
- type: arrayStart > 0 ? 1 /* Array */ : (conditionStart > 0 ? 2 /* Object */ : 3 /* Simple */),
3528
+ type: arrayStart > 0 ? 1 /* Type.Array */ : (conditionStart > 0 ? 2 /* Type.Object */ : 3 /* Type.Simple */),
3610
3529
  condition: conditionStart > 0 ? part.substring(conditionStart + 1, conditionEnd) : null
3611
3530
  });
3612
3531
  }
@@ -3624,7 +3543,7 @@ function evaluate(variable, base) {
3624
3543
  var output;
3625
3544
  if (base && base[part.name]) {
3626
3545
  var obj = base[part.name];
3627
- if (part.type !== 1 /* Array */ && match(obj, part.condition)) {
3546
+ if (part.type !== 1 /* Type.Array */ && match(obj, part.condition)) {
3628
3547
  output = evaluate(variable, obj);
3629
3548
  }
3630
3549
  else if (Array.isArray(obj)) {
@@ -3646,7 +3565,7 @@ function evaluate(variable, base) {
3646
3565
  }
3647
3566
  function str(input) {
3648
3567
  // Automatically trim string to max of Setting.ExtractLimit to avoid fetching long strings
3649
- return input ? JSON.stringify(input).substring(0, 10000 /* ExtractLimit */) : input;
3568
+ return input ? JSON.stringify(input).substring(0, 10000 /* Setting.ExtractLimit */) : input;
3650
3569
  }
3651
3570
  function match(base, condition) {
3652
3571
  if (condition) {
@@ -3660,7 +3579,7 @@ function encode$1 (event) {
3660
3579
  var t = time();
3661
3580
  var tokens = [t, event];
3662
3581
  switch (event) {
3663
- case 4 /* Baseline */:
3582
+ case 4 /* Event.Baseline */:
3664
3583
  var b = state$9;
3665
3584
  if (b) {
3666
3585
  tokens = [b.time, b.event];
@@ -3676,32 +3595,32 @@ function encode$1 (event) {
3676
3595
  tokens.push(b.data.activityTime);
3677
3596
  queue(tokens, false);
3678
3597
  }
3679
- reset$p();
3598
+ reset$o();
3680
3599
  break;
3681
- case 25 /* Ping */:
3600
+ case 25 /* Event.Ping */:
3682
3601
  tokens.push(data$h.gap);
3683
3602
  queue(tokens);
3684
3603
  break;
3685
- case 35 /* Limit */:
3604
+ case 35 /* Event.Limit */:
3686
3605
  tokens.push(data$4.check);
3687
3606
  queue(tokens, false);
3688
3607
  break;
3689
- case 3 /* Upgrade */:
3608
+ case 3 /* Event.Upgrade */:
3690
3609
  tokens.push(data$f.key);
3691
3610
  queue(tokens);
3692
3611
  break;
3693
- case 2 /* Upload */:
3612
+ case 2 /* Event.Upload */:
3694
3613
  tokens.push(track$1.sequence);
3695
3614
  tokens.push(track$1.attempts);
3696
3615
  tokens.push(track$1.status);
3697
3616
  queue(tokens, false);
3698
3617
  break;
3699
- case 24 /* Custom */:
3618
+ case 24 /* Event.Custom */:
3700
3619
  tokens.push(data$j.key);
3701
3620
  tokens.push(data$j.value);
3702
3621
  queue(tokens);
3703
3622
  break;
3704
- case 34 /* Variable */:
3623
+ case 34 /* Event.Variable */:
3705
3624
  var variableKeys = Object.keys(data$e);
3706
3625
  if (variableKeys.length > 0) {
3707
3626
  for (var _i = 0, variableKeys_1 = variableKeys; _i < variableKeys_1.length; _i++) {
@@ -3709,11 +3628,11 @@ function encode$1 (event) {
3709
3628
  tokens.push(v);
3710
3629
  tokens.push(data$e[v]);
3711
3630
  }
3712
- reset$l();
3631
+ reset$k();
3713
3632
  queue(tokens, false);
3714
3633
  }
3715
3634
  break;
3716
- case 0 /* Metric */:
3635
+ case 0 /* Event.Metric */:
3717
3636
  var metricKeys = Object.keys(updates$3);
3718
3637
  if (metricKeys.length > 0) {
3719
3638
  for (var _a = 0, metricKeys_1 = metricKeys; _a < metricKeys_1.length; _a++) {
@@ -3724,11 +3643,11 @@ function encode$1 (event) {
3724
3643
  // However, for data over the wire, we round it off to milliseconds precision.
3725
3644
  tokens.push(Math.round(updates$3[m]));
3726
3645
  }
3727
- reset$o();
3646
+ reset$n();
3728
3647
  queue(tokens, false);
3729
3648
  }
3730
3649
  break;
3731
- case 1 /* Dimension */:
3650
+ case 1 /* Event.Dimension */:
3732
3651
  var dimensionKeys = Object.keys(updates);
3733
3652
  if (dimensionKeys.length > 0) {
3734
3653
  for (var _b = 0, dimensionKeys_1 = dimensionKeys; _b < dimensionKeys_1.length; _b++) {
@@ -3741,7 +3660,7 @@ function encode$1 (event) {
3741
3660
  queue(tokens, false);
3742
3661
  }
3743
3662
  break;
3744
- case 36 /* Summary */:
3663
+ case 36 /* Event.Summary */:
3745
3664
  var eventKeys = Object.keys(data$g);
3746
3665
  if (eventKeys.length > 0) {
3747
3666
  for (var _c = 0, eventKeys_1 = eventKeys; _c < eventKeys_1.length; _c++) {
@@ -3750,11 +3669,11 @@ function encode$1 (event) {
3750
3669
  tokens.push(key);
3751
3670
  tokens.push([].concat.apply([], data$g[e]));
3752
3671
  }
3753
- reset$m();
3672
+ reset$l();
3754
3673
  queue(tokens, false);
3755
3674
  }
3756
3675
  break;
3757
- case 40 /* Extract */:
3676
+ case 40 /* Event.Extract */:
3758
3677
  var extractKeys = keys;
3759
3678
  for (var _d = 0, extractKeys_1 = extractKeys; _d < extractKeys_1.length; _d++) {
3760
3679
  var e = extractKeys_1[_d];
@@ -3768,14 +3687,14 @@ function encode$1 (event) {
3768
3687
 
3769
3688
  var data$4;
3770
3689
  function start$b() {
3771
- data$4 = { check: 0 /* None */ };
3690
+ data$4 = { check: 0 /* Check.None */ };
3772
3691
  }
3773
3692
  function check$2(bytes) {
3774
- if (data$4.check === 0 /* None */) {
3693
+ if (data$4.check === 0 /* Check.None */) {
3775
3694
  var reason = data$4.check;
3776
- reason = data$1.sequence >= 128 /* PayloadLimit */ ? 1 /* Payload */ : reason;
3777
- reason = time() > 7200000 /* ShutdownLimit */ ? 2 /* Shutdown */ : reason;
3778
- reason = bytes > 10485760 /* PlaybackBytesLimit */ ? 2 /* Shutdown */ : reason;
3695
+ reason = data$1.sequence >= 128 /* Setting.PayloadLimit */ ? 1 /* Check.Payload */ : reason;
3696
+ reason = time() > 7200000 /* Setting.ShutdownLimit */ ? 2 /* Check.Shutdown */ : reason;
3697
+ reason = bytes > 10485760 /* Setting.PlaybackBytesLimit */ ? 2 /* Check.Shutdown */ : reason;
3779
3698
  if (reason !== data$4.check) {
3780
3699
  trigger(reason);
3781
3700
  }
@@ -3787,8 +3706,8 @@ function trigger(reason) {
3787
3706
  stop();
3788
3707
  }
3789
3708
  function compute$3() {
3790
- if (data$4.check !== 0 /* None */) {
3791
- encode$1(35 /* Limit */);
3709
+ if (data$4.check !== 0 /* Check.None */) {
3710
+ encode$1(35 /* Event.Limit */);
3792
3711
  }
3793
3712
  }
3794
3713
  function stop$a() {
@@ -3809,7 +3728,7 @@ function log(dimension, value) {
3809
3728
  // Check valid value before moving ahead
3810
3729
  if (value) {
3811
3730
  // Ensure received value is casted into a string if it wasn't a string to begin with
3812
- value = "" + value;
3731
+ value = "".concat(value);
3813
3732
  if (!(dimension in data$3)) {
3814
3733
  data$3[dimension] = [];
3815
3734
  }
@@ -3822,14 +3741,14 @@ function log(dimension, value) {
3822
3741
  }
3823
3742
  updates[dimension].push(value);
3824
3743
  // Limit check to ensure we have a cap on number of dimensions we can collect
3825
- if (data$3[dimension].length > 128 /* CollectionLimit */) {
3826
- trigger(5 /* Collection */);
3744
+ if (data$3[dimension].length > 128 /* Setting.CollectionLimit */) {
3745
+ trigger(5 /* Check.Collection */);
3827
3746
  }
3828
3747
  }
3829
3748
  }
3830
3749
  }
3831
3750
  function compute$2() {
3832
- encode$1(1 /* Dimension */);
3751
+ encode$1(1 /* Event.Dimension */);
3833
3752
  }
3834
3753
  function reset$3() {
3835
3754
  updates = {};
@@ -3840,8 +3759,8 @@ var callbacks = [];
3840
3759
  var rootDomain = null;
3841
3760
  function start$9() {
3842
3761
  rootDomain = null;
3843
- var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Empty */;
3844
- var title = document && document.title ? document.title : "" /* Empty */;
3762
+ var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
3763
+ var title = document && document.title ? document.title : "" /* Constant.Empty */;
3845
3764
  // Populate ids for this page
3846
3765
  var s = session();
3847
3766
  var u = user();
@@ -3852,28 +3771,27 @@ function start$9() {
3852
3771
  pageNum: s.count
3853
3772
  };
3854
3773
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
3855
- config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* False */ : config$1.lean;
3856
- 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;
3774
+ config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$1.lean;
3775
+ 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;
3857
3776
  // Log dimensions
3858
- log(0 /* UserAgent */, ua);
3859
- log(3 /* PageTitle */, title);
3860
- log(1 /* Url */, location.href);
3861
- log(2 /* Referrer */, document.referrer);
3862
- log(15 /* TabId */, tab());
3863
- log(16 /* PageLanguage */, document.documentElement.lang);
3864
- log(17 /* DocumentDirection */, document.dir);
3777
+ log(0 /* Dimension.UserAgent */, ua);
3778
+ log(3 /* Dimension.PageTitle */, title);
3779
+ log(1 /* Dimension.Url */, location.href);
3780
+ log(2 /* Dimension.Referrer */, document.referrer);
3781
+ log(15 /* Dimension.TabId */, tab());
3782
+ log(16 /* Dimension.PageLanguage */, document.documentElement.lang);
3783
+ log(17 /* Dimension.DocumentDirection */, document.dir);
3865
3784
  if (navigator) {
3866
- log(9 /* Language */, navigator.userLanguage || navigator.language);
3867
- max(26 /* Automation */, navigator.webdriver ? 1 /* True */ : 0 /* False */);
3785
+ log(9 /* Dimension.Language */, navigator.userLanguage || navigator.language);
3868
3786
  userAgentData();
3869
3787
  }
3870
3788
  // Metrics
3871
- max(0 /* ClientTimestamp */, s.ts);
3872
- max(1 /* Playback */, 0 /* False */);
3789
+ max(0 /* Metric.ClientTimestamp */, s.ts);
3790
+ max(1 /* Metric.Playback */, 0 /* BooleanFlag.False */);
3873
3791
  if (screen) {
3874
- max(14 /* ScreenWidth */, Math.round(screen.width));
3875
- max(15 /* ScreenHeight */, Math.round(screen.height));
3876
- max(16 /* ColorDepth */, Math.round(screen.colorDepth));
3792
+ max(14 /* Metric.ScreenWidth */, Math.round(screen.width));
3793
+ max(15 /* Metric.ScreenHeight */, Math.round(screen.height));
3794
+ max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
3877
3795
  }
3878
3796
  // Read cookies specified in configuration
3879
3797
  for (var _i = 0, _a = config$1.cookies; _i < _a.length; _i++) {
@@ -3894,13 +3812,13 @@ function userAgentData() {
3894
3812
  "uaFullVersion"])
3895
3813
  .then(function (ua) {
3896
3814
  var _a;
3897
- log(22 /* Platform */, ua.platform);
3898
- log(23 /* PlatformVersion */, ua.platformVersion);
3815
+ log(22 /* Dimension.Platform */, ua.platform);
3816
+ log(23 /* Dimension.PlatformVersion */, ua.platformVersion);
3899
3817
  (_a = ua.brands) === null || _a === void 0 ? void 0 : _a.forEach(function (brand) {
3900
- log(24 /* Brand */, brand.name + "~" /* Tilde */ + brand.version);
3818
+ log(24 /* Dimension.Brand */, brand.name + "~" /* Constant.Tilde */ + brand.version);
3901
3819
  });
3902
- log(25 /* Model */, ua.model);
3903
- max(27 /* Mobile */, ua.mobile ? 1 /* True */ : 0 /* False */);
3820
+ log(25 /* Dimension.Model */, ua.model);
3821
+ max(27 /* Metric.Mobile */, ua.mobile ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
3904
3822
  });
3905
3823
  }
3906
3824
  }
@@ -3917,33 +3835,33 @@ function metadata(cb, wait) {
3917
3835
  callbacks.push({ callback: cb, wait: wait });
3918
3836
  }
3919
3837
  function id() {
3920
- return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Dot */) : "" /* Empty */;
3838
+ return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Constant.Dot */) : "" /* Constant.Empty */;
3921
3839
  }
3922
3840
  function consent() {
3923
3841
  if (active()) {
3924
3842
  config$1.track = true;
3925
- track(user(), 1 /* True */);
3843
+ track(user(), 1 /* BooleanFlag.True */);
3926
3844
  }
3927
3845
  }
3928
3846
  function clear() {
3929
3847
  // Clear any stored information in the cookie that tracks session information so we can restart fresh the next time
3930
- setCookie("_clsk" /* SessionKey */, "" /* Empty */, 0);
3848
+ setCookie("_clsk" /* Constant.SessionKey */, "" /* Constant.Empty */, 0);
3931
3849
  }
3932
3850
  function tab() {
3933
3851
  var id = shortid();
3934
- if (config$1.track && supported(window, "sessionStorage" /* SessionStorage */)) {
3935
- var value = sessionStorage.getItem("_cltk" /* TabKey */);
3852
+ if (config$1.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
3853
+ var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
3936
3854
  id = value ? value : id;
3937
- sessionStorage.setItem("_cltk" /* TabKey */, id);
3855
+ sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
3938
3856
  }
3939
3857
  return id;
3940
3858
  }
3941
3859
  function save() {
3942
3860
  var ts = Math.round(Date.now());
3943
- var upload = config$1.upload && typeof config$1.upload === "string" /* String */ ? config$1.upload.replace("https://" /* HTTPS */, "" /* Empty */) : "" /* Empty */;
3944
- var upgrade = config$1.lean ? 0 /* False */ : 1 /* True */;
3861
+ var upload = config$1.upload && typeof config$1.upload === "string" /* Constant.String */ ? config$1.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
3862
+ var upgrade = config$1.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
3945
3863
  processCallback(upgrade);
3946
- setCookie("_clsk" /* SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Pipe */), 1 /* SessionExpire */);
3864
+ setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Constant.Pipe */), 1 /* Setting.SessionExpire */);
3947
3865
  }
3948
3866
  function processCallback(upgrade) {
3949
3867
  if (callbacks.length > 0) {
@@ -3968,10 +3886,10 @@ function track(u, consent) {
3968
3886
  consent = consent === null ? u.consent : consent;
3969
3887
  // Convert time precision into days to reduce number of bytes we have to write in a cookie
3970
3888
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
3971
- var end = Math.ceil((Date.now() + (365 /* Expire */ * 86400000 /* Day */)) / 86400000 /* Day */);
3889
+ var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
3972
3890
  // To avoid cookie churn, write user id cookie only once every day
3973
- if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* CookieInterval */ || u.consent !== consent) {
3974
- setCookie("_clck" /* CookieKey */, [data$2.userId, 1 /* CookieVersion */, end.toString(36), consent].join("|" /* Pipe */), 365 /* Expire */);
3891
+ if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent) {
3892
+ setCookie("_clck" /* Constant.CookieKey */, [data$2.userId, 1 /* Setting.CookieVersion */, end.toString(36), consent].join("|" /* Constant.Pipe */), 365 /* Setting.Expire */);
3975
3893
  }
3976
3894
  }
3977
3895
  function shortid() {
@@ -3982,17 +3900,17 @@ function shortid() {
3982
3900
  return id.toString(36);
3983
3901
  }
3984
3902
  function session() {
3985
- var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Empty */ };
3986
- var value = getCookie("_clsk" /* SessionKey */);
3903
+ var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
3904
+ var value = getCookie("_clsk" /* Constant.SessionKey */);
3987
3905
  if (value) {
3988
- var parts = value.split("|" /* Pipe */);
3906
+ var parts = value.split("|" /* Constant.Pipe */);
3989
3907
  // Making it backward & forward compatible by using greater than comparison (v0.6.21)
3990
3908
  // In future version, we can reduce the parts length to be 5 where the last part contains the full upload URL
3991
- if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* SessionTimeout */) {
3909
+ if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* Setting.SessionTimeout */) {
3992
3910
  output.session = parts[0];
3993
3911
  output.count = num(parts[2]) + 1;
3994
3912
  output.upgrade = num(parts[3]);
3995
- output.upload = parts.length >= 6 ? "" + "https://" /* HTTPS */ + parts[5] + "/" + parts[4] : "" + "https://" /* HTTPS */ + parts[4];
3913
+ output.upload = parts.length >= 6 ? "".concat("https://" /* Constant.HTTPS */).concat(parts[5], "/").concat(parts[4]) : "".concat("https://" /* Constant.HTTPS */).concat(parts[4]);
3996
3914
  }
3997
3915
  }
3998
3916
  return output;
@@ -4002,26 +3920,26 @@ function num(string, base) {
4002
3920
  return parseInt(string, base);
4003
3921
  }
4004
3922
  function user() {
4005
- var output = { id: shortid(), expiry: null, consent: 0 /* False */ };
4006
- var cookie = getCookie("_clck" /* CookieKey */);
3923
+ var output = { id: shortid(), expiry: null, consent: 0 /* BooleanFlag.False */ };
3924
+ var cookie = getCookie("_clck" /* Constant.CookieKey */);
4007
3925
  if (cookie && cookie.length > 0) {
4008
3926
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
4009
- var parts = cookie.split("|" /* Pipe */);
3927
+ var parts = cookie.split("|" /* Constant.Pipe */);
4010
3928
  // For backward compatibility introduced in v0.6.18; following code can be removed with future iterations
4011
3929
  // 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)
4012
3930
  var count = 0;
4013
- for (var _i = 0, _a = document.cookie.split(";" /* Semicolon */); _i < _a.length; _i++) {
3931
+ for (var _i = 0, _a = document.cookie.split(";" /* Constant.Semicolon */); _i < _a.length; _i++) {
4014
3932
  var c = _a[_i];
4015
- count += c.split("=" /* Equals */)[0].trim() === "_clck" /* CookieKey */ ? 1 : 0;
3933
+ count += c.split("=" /* Constant.Equals */)[0].trim() === "_clck" /* Constant.CookieKey */ ? 1 : 0;
4016
3934
  }
4017
3935
  // Check if we either got version-less cookie value or saw multiple copies of the user cookie crumbs
4018
3936
  // In both these cases, we go ahead and delete the existing cookie set on current domain
4019
3937
  if (parts.length === 1 || count > 1) {
4020
- var deleted = "" + ";" /* Semicolon */ + "expires=" /* Expires */ + (new Date(0)).toUTCString() + ";path=/" /* Path */;
3938
+ var deleted = "".concat(";" /* Constant.Semicolon */).concat("expires=" /* Constant.Expires */).concat((new Date(0)).toUTCString()).concat(";path=/" /* Constant.Path */);
4021
3939
  // First, delete current user cookie which might be set on current sub-domain vs. root domain
4022
- document.cookie = "_clck" /* CookieKey */ + "=" + deleted;
3940
+ document.cookie = "".concat("_clck" /* Constant.CookieKey */, "=").concat(deleted);
4023
3941
  // Second, same thing for current session cookie so it can be re-written later with the root domain
4024
- document.cookie = "_clsk" /* SessionKey */ + "=" + deleted;
3942
+ document.cookie = "".concat("_clsk" /* Constant.SessionKey */, "=").concat(deleted);
4025
3943
  }
4026
3944
  // End code for backward compatibility
4027
3945
  // Read version information and timestamp from cookie, if available
@@ -4030,21 +3948,21 @@ function user() {
4030
3948
  }
4031
3949
  // Check if we have explicit consent to track this user
4032
3950
  if (parts.length > 3 && num(parts[3]) === 1) {
4033
- output.consent = 1 /* True */;
3951
+ output.consent = 1 /* BooleanFlag.True */;
4034
3952
  }
4035
3953
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
4036
- config$1.track = config$1.track || output.consent === 1 /* True */;
3954
+ config$1.track = config$1.track || output.consent === 1 /* BooleanFlag.True */;
4037
3955
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
4038
3956
  output.id = config$1.track ? parts[0] : output.id;
4039
3957
  }
4040
3958
  return output;
4041
3959
  }
4042
3960
  function getCookie(key) {
4043
- if (supported(document, "cookie" /* Cookie */)) {
4044
- var cookies = document.cookie.split(";" /* Semicolon */);
3961
+ if (supported(document, "cookie" /* Constant.Cookie */)) {
3962
+ var cookies = document.cookie.split(";" /* Constant.Semicolon */);
4045
3963
  if (cookies) {
4046
3964
  for (var i = 0; i < cookies.length; i++) {
4047
- var pair = cookies[i].split("=" /* Equals */);
3965
+ var pair = cookies[i].split("=" /* Constant.Equals */);
4048
3966
  if (pair.length > 1 && pair[0] && pair[0].trim() === key) {
4049
3967
  return pair[1];
4050
3968
  }
@@ -4054,23 +3972,23 @@ function getCookie(key) {
4054
3972
  return null;
4055
3973
  }
4056
3974
  function setCookie(key, value, time) {
4057
- if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Cookie */))) {
3975
+ if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
4058
3976
  var expiry = new Date();
4059
3977
  expiry.setDate(expiry.getDate() + time);
4060
- var expires = expiry ? "expires=" /* Expires */ + expiry.toUTCString() : "" /* Empty */;
4061
- var cookie = key + "=" + value + ";" /* Semicolon */ + expires + ";path=/" /* Path */;
3978
+ var expires = expiry ? "expires=" /* Constant.Expires */ + expiry.toUTCString() : "" /* Constant.Empty */;
3979
+ var cookie = "".concat(key, "=").concat(value).concat(";" /* Constant.Semicolon */).concat(expires).concat(";path=/" /* Constant.Path */);
4062
3980
  try {
4063
3981
  // Attempt to get the root domain only once and fall back to writing cookie on the current domain.
4064
3982
  if (rootDomain === null) {
4065
- var hostname = location.hostname ? location.hostname.split("." /* Dot */) : [];
3983
+ var hostname = location.hostname ? location.hostname.split("." /* Constant.Dot */) : [];
4066
3984
  // Walk backwards on a domain and attempt to set a cookie, until successful
4067
3985
  for (var i = hostname.length - 1; i >= 0; i--) {
4068
- rootDomain = "." + hostname[i] + (rootDomain ? rootDomain : "" /* Empty */);
3986
+ rootDomain = ".".concat(hostname[i]).concat(rootDomain ? rootDomain : "" /* Constant.Empty */);
4069
3987
  // We do not wish to attempt writing a cookie on the absolute last part of the domain, e.g. .com or .net.
4070
3988
  // So we start attempting after second-last part, e.g. .domain.com (PASS) or .co.uk (FAIL)
4071
3989
  if (i < hostname.length - 1) {
4072
3990
  // Write the cookie on the current computed top level domain
4073
- document.cookie = "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain;
3991
+ document.cookie = "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain);
4074
3992
  // Once written, check if the cookie exists and its value matches exactly with what we intended to set
4075
3993
  // Checking for exact value match helps us eliminate a corner case where the cookie may already be present with a different value
4076
3994
  // If the check is successful, no more action is required and we can return from the function since rootDomain cookie is already set
@@ -4082,13 +4000,13 @@ function setCookie(key, value, time) {
4082
4000
  }
4083
4001
  // Finally, if we were not successful and gone through all the options, play it safe and reset rootDomain to be empty
4084
4002
  // This forces our code to fall back to always writing cookie to the current domain
4085
- rootDomain = "" /* Empty */;
4003
+ rootDomain = "" /* Constant.Empty */;
4086
4004
  }
4087
4005
  }
4088
4006
  catch (_a) {
4089
- rootDomain = "" /* Empty */;
4007
+ rootDomain = "" /* Constant.Empty */;
4090
4008
  }
4091
- document.cookie = rootDomain ? "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain : cookie;
4009
+ document.cookie = rootDomain ? "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain) : cookie;
4092
4010
  }
4093
4011
  }
4094
4012
 
@@ -4104,8 +4022,8 @@ function start$8() {
4104
4022
  userId: m.userId,
4105
4023
  sessionId: m.sessionId,
4106
4024
  pageNum: m.pageNum,
4107
- upload: 0 /* Async */,
4108
- end: 0 /* False */
4025
+ upload: 0 /* Upload.Async */,
4026
+ end: 0 /* BooleanFlag.False */
4109
4027
  };
4110
4028
  }
4111
4029
  function stop$7() {
@@ -4115,8 +4033,8 @@ function envelope(last) {
4115
4033
  data$1.start = data$1.start + data$1.duration;
4116
4034
  data$1.duration = time() - data$1.start;
4117
4035
  data$1.sequence++;
4118
- data$1.upload = last && "sendBeacon" in navigator ? 1 /* Beacon */ : 0 /* Async */;
4119
- data$1.end = last ? 1 /* True */ : 0 /* False */;
4036
+ data$1.upload = last && "sendBeacon" in navigator ? 1 /* Upload.Beacon */ : 0 /* Upload.Async */;
4037
+ data$1.end = last ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
4120
4038
  return [
4121
4039
  data$1.version,
4122
4040
  data$1.sequence,
@@ -4169,10 +4087,10 @@ function measure (method) {
4169
4087
  throw report(ex);
4170
4088
  }
4171
4089
  var duration = performance.now() - start;
4172
- sum(4 /* TotalCost */, duration);
4173
- if (duration > 30 /* LongTask */) {
4174
- count$1(7 /* LongTaskCount */);
4175
- max(6 /* ThreadBlockedTime */, duration);
4090
+ sum(4 /* Metric.TotalCost */, duration);
4091
+ if (duration > 30 /* Setting.LongTask */) {
4092
+ count$1(7 /* Metric.LongTaskCount */);
4093
+ max(6 /* Metric.ThreadBlockedTime */, duration);
4176
4094
  }
4177
4095
  };
4178
4096
  }
@@ -4184,7 +4102,7 @@ function bind(target, event, listener, capture) {
4184
4102
  // Wrapping following lines inside try / catch to cover edge cases where we might try to access an inaccessible element.
4185
4103
  // E.g. Iframe may start off as same-origin but later turn into cross-origin, and the following lines will throw an exception.
4186
4104
  try {
4187
- target[api("addEventListener" /* AddEventListener */)](event, listener, capture);
4105
+ target[api("addEventListener" /* Constant.AddEventListener */)](event, listener, capture);
4188
4106
  bindings.push({ event: event, target: target, listener: listener, capture: capture });
4189
4107
  }
4190
4108
  catch ( /* do nothing */_a) { /* do nothing */ }
@@ -4195,7 +4113,7 @@ function reset$1() {
4195
4113
  var binding = bindings_1[_i];
4196
4114
  // Wrapping inside try / catch to avoid situations where the element may be destroyed before we get a chance to unbind
4197
4115
  try {
4198
- binding.target[api("removeEventListener" /* RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4116
+ binding.target[api("removeEventListener" /* Constant.RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4199
4117
  }
4200
4118
  catch ( /* do nothing */_a) { /* do nothing */ }
4201
4119
  }
@@ -4232,8 +4150,8 @@ function start$7() {
4232
4150
  }
4233
4151
  }
4234
4152
  function check$1() {
4235
- if (count++ > 20 /* CallStackDepth */) {
4236
- log$1(4 /* CallStackDepth */, 0 /* Info */);
4153
+ if (count++ > 20 /* Setting.CallStackDepth */) {
4154
+ log$1(4 /* Code.CallStackDepth */, 0 /* Severity.Info */);
4237
4155
  return false;
4238
4156
  }
4239
4157
  return true;
@@ -4243,11 +4161,15 @@ function compute$1() {
4243
4161
  if (url !== getCurrentUrl()) {
4244
4162
  // If the url changed, start tracking it as a new page
4245
4163
  stop();
4246
- window.setTimeout(start, 250 /* RestartDelay */);
4164
+ window.setTimeout(restart$1, 250 /* Setting.RestartDelay */);
4247
4165
  }
4248
4166
  }
4167
+ function restart$1() {
4168
+ start();
4169
+ max(29 /* Metric.SinglePage */, 1 /* BooleanFlag.True */);
4170
+ }
4249
4171
  function getCurrentUrl() {
4250
- return location.href ? location.href.replace(location.hash, "" /* Empty */) : location.href;
4172
+ return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
4251
4173
  }
4252
4174
  function stop$6() {
4253
4175
  url = null;
@@ -4258,7 +4180,7 @@ var status = false;
4258
4180
  function start$6() {
4259
4181
  status = true;
4260
4182
  start$F();
4261
- reset$k();
4183
+ reset$j();
4262
4184
  reset$1();
4263
4185
  reset$2();
4264
4186
  start$7();
@@ -4267,8 +4189,8 @@ function stop$5() {
4267
4189
  stop$6();
4268
4190
  reset$2();
4269
4191
  reset$1();
4270
- reset$k();
4271
- stop$C();
4192
+ reset$j();
4193
+ stop$B();
4272
4194
  status = false;
4273
4195
  }
4274
4196
  function active() {
@@ -4310,7 +4232,7 @@ function config(override) {
4310
4232
  // not holding the session during inactive time periods.
4311
4233
  function suspend() {
4312
4234
  if (status) {
4313
- event("clarity" /* Clarity */, "suspend" /* Suspend */);
4235
+ event("clarity" /* Constant.Clarity */, "suspend" /* Constant.Suspend */);
4314
4236
  stop();
4315
4237
  ["mousemove", "touchstart"].forEach(function (x) { return bind(document, x, restart); });
4316
4238
  ["resize", "scroll", "pageshow"].forEach(function (x) { return bind(window, x, restart); });
@@ -4318,10 +4240,11 @@ function suspend() {
4318
4240
  }
4319
4241
  function restart() {
4320
4242
  start();
4321
- event("clarity" /* Clarity */, "restart" /* Restart */);
4243
+ event("clarity" /* Constant.Clarity */, "restart" /* Constant.Restart */);
4322
4244
  }
4323
4245
 
4324
4246
  function start$5() {
4247
+ start$x();
4325
4248
  start$e();
4326
4249
  start$d();
4327
4250
  }
@@ -4336,7 +4259,7 @@ var diagnostic = /*#__PURE__*/Object.freeze({
4336
4259
  });
4337
4260
 
4338
4261
  function start$4() {
4339
- schedule$1(discover, 1 /* High */).then(function () {
4262
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
4340
4263
  measure(compute$7)();
4341
4264
  measure(compute$6)();
4342
4265
  });
@@ -4348,15 +4271,15 @@ function discover() {
4348
4271
  switch (_a.label) {
4349
4272
  case 0:
4350
4273
  ts = time();
4351
- timer = { id: id(), cost: 3 /* LayoutCost */ };
4352
- start$x(timer);
4353
- return [4 /*yield*/, traverse(document, timer, 0 /* Discover */)];
4274
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
4275
+ start$w(timer);
4276
+ return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
4354
4277
  case 1:
4355
4278
  _a.sent();
4356
- return [4 /*yield*/, encode$4(5 /* Discover */, timer, ts)];
4279
+ return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
4357
4280
  case 2:
4358
4281
  _a.sent();
4359
- stop$u(timer);
4282
+ stop$t(timer);
4360
4283
  return [2 /*return*/];
4361
4284
  }
4362
4285
  });
@@ -4371,13 +4294,11 @@ function start$3() {
4371
4294
  start$i();
4372
4295
  start$j();
4373
4296
  start$4();
4374
- start$w();
4375
4297
  }
4376
4298
  function stop$3() {
4377
4299
  stop$f();
4378
4300
  stop$g();
4379
4301
  stop$h();
4380
- stop$t();
4381
4302
  end();
4382
4303
  }
4383
4304
 
@@ -4394,7 +4315,7 @@ function encode (type) {
4394
4315
  t = time();
4395
4316
  tokens = [t, type];
4396
4317
  switch (type) {
4397
- case 29 /* Navigation */:
4318
+ case 29 /* Event.Navigation */:
4398
4319
  tokens.push(data.fetchStart);
4399
4320
  tokens.push(data.connectStart);
4400
4321
  tokens.push(data.connectEnd);
@@ -4443,11 +4364,11 @@ function compute(entry) {
4443
4364
  encodedSize: entry.encodedBodySize ? entry.encodedBodySize : 0,
4444
4365
  decodedSize: entry.decodedBodySize ? entry.decodedBodySize : 0
4445
4366
  };
4446
- encode(29 /* Navigation */);
4367
+ encode(29 /* Event.Navigation */);
4447
4368
  }
4448
4369
 
4449
4370
  var observer;
4450
- var types = ["navigation" /* Navigation */, "resource" /* Resource */, "longtask" /* LongTask */, "first-input" /* FID */, "layout-shift" /* CLS */, "largest-contentful-paint" /* LCP */];
4371
+ var types = ["navigation" /* Constant.Navigation */, "resource" /* Constant.Resource */, "longtask" /* Constant.LongTask */, "first-input" /* Constant.FID */, "layout-shift" /* Constant.CLS */, "largest-contentful-paint" /* Constant.LCP */];
4451
4372
  function start$2() {
4452
4373
  // Check the browser support performance observer as a pre-requisite for any performance measurement
4453
4374
  if (window["PerformanceObserver"] && PerformanceObserver.supportedEntryTypes) {
@@ -4462,7 +4383,7 @@ function start$2() {
4462
4383
  }
4463
4384
  }
4464
4385
  else {
4465
- log$1(3 /* PerformanceObserver */, 0 /* Info */);
4386
+ log$1(3 /* Code.PerformanceObserver */, 0 /* Severity.Info */);
4466
4387
  }
4467
4388
  }
4468
4389
  function observe() {
@@ -4482,15 +4403,15 @@ function observe() {
4482
4403
  if (PerformanceObserver.supportedEntryTypes.indexOf(x) >= 0) {
4483
4404
  // Initialize CLS with a value of zero. It's possible (and recommended) for sites to not have any cumulative layout shift.
4484
4405
  // In those cases, we want to still initialize the metric in Clarity
4485
- if (x === "layout-shift" /* CLS */) {
4486
- sum(9 /* CumulativeLayoutShift */, 0);
4406
+ if (x === "layout-shift" /* Constant.CLS */) {
4407
+ sum(9 /* Metric.CumulativeLayoutShift */, 0);
4487
4408
  }
4488
4409
  observer.observe({ type: x, buffered: true });
4489
4410
  }
4490
4411
  }
4491
4412
  }
4492
4413
  catch (_a) {
4493
- log$1(3 /* PerformanceObserver */, 1 /* Warning */);
4414
+ log$1(3 /* Code.PerformanceObserver */, 1 /* Severity.Warning */);
4494
4415
  }
4495
4416
  }
4496
4417
  function handle(entries) {
@@ -4501,33 +4422,42 @@ function process(entries) {
4501
4422
  for (var i = 0; i < entries.length; i++) {
4502
4423
  var entry = entries[i];
4503
4424
  switch (entry.entryType) {
4504
- case "navigation" /* Navigation */:
4425
+ case "navigation" /* Constant.Navigation */:
4505
4426
  compute(entry);
4506
4427
  break;
4507
- case "resource" /* Resource */:
4508
- log(4 /* NetworkHosts */, host(entry.name));
4428
+ case "resource" /* Constant.Resource */:
4429
+ var name_1 = entry.name;
4430
+ log(4 /* Dimension.NetworkHosts */, host(name_1));
4431
+ if (name_1 === config$1.upload || name_1 === config$1.fallback) {
4432
+ max(28 /* Metric.UploadTime */, entry.duration);
4433
+ }
4509
4434
  break;
4510
- case "longtask" /* LongTask */:
4511
- count$1(7 /* LongTaskCount */);
4435
+ case "longtask" /* Constant.LongTask */:
4436
+ count$1(7 /* Metric.LongTaskCount */);
4512
4437
  break;
4513
- case "first-input" /* FID */:
4438
+ case "first-input" /* Constant.FID */:
4514
4439
  if (visible) {
4515
- max(10 /* FirstInputDelay */, entry["processingStart"] - entry.startTime);
4440
+ max(10 /* Metric.FirstInputDelay */, entry["processingStart"] - entry.startTime);
4516
4441
  }
4517
4442
  break;
4518
- case "layout-shift" /* CLS */:
4443
+ case "layout-shift" /* Constant.CLS */:
4519
4444
  // Scale the value to avoid sending back floating point number
4520
4445
  if (visible && !entry["hadRecentInput"]) {
4521
- sum(9 /* CumulativeLayoutShift */, entry["value"] * 1000);
4446
+ sum(9 /* Metric.CumulativeLayoutShift */, entry["value"] * 1000);
4522
4447
  }
4523
4448
  break;
4524
- case "largest-contentful-paint" /* LCP */:
4449
+ case "largest-contentful-paint" /* Constant.LCP */:
4525
4450
  if (visible) {
4526
- max(8 /* LargestPaint */, entry.startTime);
4451
+ max(8 /* Metric.LargestPaint */, entry.startTime);
4527
4452
  }
4528
4453
  break;
4529
4454
  }
4530
4455
  }
4456
+ if (performance && "memory" /* Constant.Memory */ in performance && performance["memory" /* Constant.Memory */].usedJSHeapSize) {
4457
+ // Track consumed memory (MBs) where "memory" API is available
4458
+ // Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
4459
+ max(30 /* Metric.UsedMemory */, Math.abs(performance["memory" /* Constant.Memory */].usedJSHeapSize / 1048576 /* Setting.MegaByte */));
4460
+ }
4531
4461
  }
4532
4462
  function stop$2() {
4533
4463
  if (observer) {
@@ -4574,7 +4504,7 @@ function start(config$1) {
4574
4504
  // performance impact even further. For reference, we are talking single digit milliseconds optimization here, not seconds.
4575
4505
  function pause() {
4576
4506
  if (active()) {
4577
- event("clarity" /* Clarity */, "pause" /* Pause */);
4507
+ event("clarity" /* Constant.Clarity */, "pause" /* Constant.Pause */);
4578
4508
  pause$1();
4579
4509
  }
4580
4510
  }
@@ -4582,14 +4512,14 @@ function pause() {
4582
4512
  function resume() {
4583
4513
  if (active()) {
4584
4514
  resume$1();
4585
- event("clarity" /* Clarity */, "resume" /* Resume */);
4515
+ event("clarity" /* Constant.Clarity */, "resume" /* Constant.Resume */);
4586
4516
  }
4587
4517
  }
4588
4518
  function stop() {
4589
4519
  if (active()) {
4590
4520
  // Stop modules in the reverse order of their initialization
4591
4521
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
4592
- stop$v();
4522
+ stop$u();
4593
4523
  stop$5();
4594
4524
  }
4595
4525
  }