@microsoft/applicationinsights-debugplugin-js 2.7.5-nightly.2203-03 → 2.7.5

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.
Files changed (65) hide show
  1. package/browser/{ai.dbg.2.7.5-nightly.2203-03.cjs.js → ai.dbg.2.7.5.cjs.js} +483 -1040
  2. package/browser/ai.dbg.2.7.5.cjs.js.map +1 -0
  3. package/browser/ai.dbg.2.7.5.cjs.min.js +6 -0
  4. package/browser/ai.dbg.2.7.5.cjs.min.js.map +1 -0
  5. package/browser/{ai.dbg.2.7.5-nightly.2203-03.gbl.js → ai.dbg.2.7.5.gbl.js} +483 -1040
  6. package/browser/ai.dbg.2.7.5.gbl.js.map +1 -0
  7. package/browser/ai.dbg.2.7.5.gbl.min.js +6 -0
  8. package/browser/ai.dbg.2.7.5.gbl.min.js.map +1 -0
  9. package/browser/ai.dbg.2.7.5.integrity.json +66 -0
  10. package/browser/{ai.dbg.2.7.5-nightly.2203-03.js → ai.dbg.2.7.5.js} +483 -1040
  11. package/browser/ai.dbg.2.7.5.js.map +1 -0
  12. package/browser/ai.dbg.2.7.5.min.js +6 -0
  13. package/browser/ai.dbg.2.7.5.min.js.map +1 -0
  14. package/browser/ai.dbg.2.cjs.js +482 -1039
  15. package/browser/ai.dbg.2.cjs.js.map +1 -1
  16. package/browser/ai.dbg.2.cjs.min.js +2 -2
  17. package/browser/ai.dbg.2.cjs.min.js.map +1 -1
  18. package/browser/ai.dbg.2.gbl.js +482 -1039
  19. package/browser/ai.dbg.2.gbl.js.map +1 -1
  20. package/browser/ai.dbg.2.gbl.min.js +2 -2
  21. package/browser/ai.dbg.2.gbl.min.js.map +1 -1
  22. package/browser/ai.dbg.2.js +482 -1039
  23. package/browser/ai.dbg.2.js.map +1 -1
  24. package/browser/ai.dbg.2.min.js +2 -2
  25. package/browser/ai.dbg.2.min.js.map +1 -1
  26. package/dist/applicationinsights-debugplugin-js.api.json +17 -10
  27. package/dist/applicationinsights-debugplugin-js.d.ts +1 -1
  28. package/dist/applicationinsights-debugplugin-js.js +482 -1039
  29. package/dist/applicationinsights-debugplugin-js.js.map +1 -1
  30. package/dist/applicationinsights-debugplugin-js.min.js +2 -2
  31. package/dist/applicationinsights-debugplugin-js.min.js.map +1 -1
  32. package/dist/applicationinsights-debugplugin-js.rollup.d.ts +1 -1
  33. package/dist-esm/DebugPlugin.js +8 -8
  34. package/dist-esm/DebugPlugin.js.map +1 -1
  35. package/dist-esm/applicationinsights-debugplugin-js.js +1 -1
  36. package/dist-esm/components/Dashboard.js +5 -5
  37. package/dist-esm/components/Dashboard.js.map +1 -1
  38. package/dist-esm/components/LogEntry.js +3 -3
  39. package/dist-esm/components/LogEntry.js.map +1 -1
  40. package/dist-esm/components/debugBins.js +1 -1
  41. package/dist-esm/components/filterList.js +3 -2
  42. package/dist-esm/components/filterList.js.map +1 -1
  43. package/dist-esm/components/helpers.js +4 -4
  44. package/dist-esm/components/helpers.js.map +1 -1
  45. package/dist-esm/components/styleNodeSrc.js +1 -1
  46. package/dist-esm/interfaces/IDebugPluginConfig.js +1 -1
  47. package/package.json +54 -57
  48. package/src/DebugPlugin.ts +7 -7
  49. package/src/components/Dashboard.ts +4 -4
  50. package/src/components/LogEntry.ts +2 -2
  51. package/src/components/debugBins.ts +6 -7
  52. package/src/components/filterList.ts +3 -1
  53. package/src/components/helpers.ts +48 -58
  54. package/src/components/styleNodeSrc.ts +33 -33
  55. package/types/tsdoc-metadata.json +1 -1
  56. package/browser/ai.dbg.2.7.5-nightly.2203-03.cjs.js.map +0 -1
  57. package/browser/ai.dbg.2.7.5-nightly.2203-03.cjs.min.js +0 -6
  58. package/browser/ai.dbg.2.7.5-nightly.2203-03.cjs.min.js.map +0 -1
  59. package/browser/ai.dbg.2.7.5-nightly.2203-03.gbl.js.map +0 -1
  60. package/browser/ai.dbg.2.7.5-nightly.2203-03.gbl.min.js +0 -6
  61. package/browser/ai.dbg.2.7.5-nightly.2203-03.gbl.min.js.map +0 -1
  62. package/browser/ai.dbg.2.7.5-nightly.2203-03.integrity.json +0 -66
  63. package/browser/ai.dbg.2.7.5-nightly.2203-03.js.map +0 -1
  64. package/browser/ai.dbg.2.7.5-nightly.2203-03.min.js +0 -6
  65. package/browser/ai.dbg.2.7.5-nightly.2203-03.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Debug Plugin, 2.7.5-nightly.2203-03
2
+ * Application Insights JavaScript SDK - Debug Plugin, 2.7.5
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -62,9 +62,7 @@
62
62
  (getGlobal() || {})["Reflect"];
63
63
  var extendStaticsFn = function (d, b) {
64
64
  extendStaticsFn = ObjClass["setPrototypeOf"] ||
65
- ({ __proto__: [] } instanceof Array && function (d, b) {
66
- d.__proto__ = b;
67
- }) ||
65
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
68
66
  function (d, b) {
69
67
  for (var p in b) {
70
68
  if (b[strShimHasOwnProperty](p)) {
@@ -79,14 +77,12 @@
79
77
  throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
80
78
  }
81
79
  extendStaticsFn(d, b);
82
- function __() {
83
- this.constructor = d;
84
- }
80
+ function __() { this.constructor = d; }
85
81
  d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
86
82
  }
87
83
 
88
84
  /*!
89
- * Microsoft Dynamic Proto Utility, 1.1.4
85
+ * Microsoft Dynamic Proto Utility, 1.1.5
90
86
  * Copyright (c) Microsoft and contributors. All rights reserved.
91
87
  */
92
88
  var Constructor = 'constructor';
@@ -99,6 +95,7 @@
99
95
  var DynInstChkTag = '_dynInstChk';
100
96
  var DynAllowInstChkTag = DynInstChkTag;
101
97
  var DynProtoDefaultOptions = '_dfOpts';
98
+ var DynProtoPolyProto = "_dynProto";
102
99
  var UnknownValue = '_unknown_';
103
100
  var str__Proto$1 = "__proto__";
104
101
  var strUseBaseInst = 'useBaseInst';
@@ -120,8 +117,11 @@
120
117
  if (_objGetPrototypeOf$1) {
121
118
  return _objGetPrototypeOf$1(target);
122
119
  }
123
- var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
120
+ var newProto = target[DynProtoPolyProto] || target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
124
121
  if (newProto) {
122
+ if (!target[DynProtoPolyProto]) {
123
+ target[DynProtoPolyProto] = newProto;
124
+ }
125
125
  return newProto;
126
126
  }
127
127
  }
@@ -280,8 +280,9 @@
280
280
  visited.push(thisProto);
281
281
  thisProto = _getObjProto$1(thisProto);
282
282
  }
283
+ return false;
283
284
  }
284
- return false;
285
+ return true;
285
286
  }
286
287
  function _getObjName(target, unknownValue) {
287
288
  if (_hasOwnProperty(target, Prototype)) {
@@ -326,15 +327,99 @@
326
327
  };
327
328
  dynamicProto[DynProtoDefaultOptions] = perfDefaults;
328
329
 
329
- var strEmpty$1 = "";
330
- var strSetNextPlugin = "setNextPlugin";
331
- var strIsInitialized = "isInitialized";
332
- var strTeardown = "teardown";
333
- var strCore = "core";
334
- var strUpdate = "update";
335
- var strDisabled = "disabled";
336
- var strDoTeardown = "_doTeardown";
330
+ var LoggingSeverity;
331
+ (function (LoggingSeverity) {
332
+ LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
333
+ LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
334
+ })(LoggingSeverity || (LoggingSeverity = {}));
335
+ var _InternalMessageId = {
336
+ BrowserDoesNotSupportLocalStorage: 0,
337
+ BrowserCannotReadLocalStorage: 1,
338
+ BrowserCannotReadSessionStorage: 2,
339
+ BrowserCannotWriteLocalStorage: 3,
340
+ BrowserCannotWriteSessionStorage: 4,
341
+ BrowserFailedRemovalFromLocalStorage: 5,
342
+ BrowserFailedRemovalFromSessionStorage: 6,
343
+ CannotSendEmptyTelemetry: 7,
344
+ ClientPerformanceMathError: 8,
345
+ ErrorParsingAISessionCookie: 9,
346
+ ErrorPVCalc: 10,
347
+ ExceptionWhileLoggingError: 11,
348
+ FailedAddingTelemetryToBuffer: 12,
349
+ FailedMonitorAjaxAbort: 13,
350
+ FailedMonitorAjaxDur: 14,
351
+ FailedMonitorAjaxOpen: 15,
352
+ FailedMonitorAjaxRSC: 16,
353
+ FailedMonitorAjaxSend: 17,
354
+ FailedMonitorAjaxGetCorrelationHeader: 18,
355
+ FailedToAddHandlerForOnBeforeUnload: 19,
356
+ FailedToSendQueuedTelemetry: 20,
357
+ FailedToReportDataLoss: 21,
358
+ FlushFailed: 22,
359
+ MessageLimitPerPVExceeded: 23,
360
+ MissingRequiredFieldSpecification: 24,
361
+ NavigationTimingNotSupported: 25,
362
+ OnError: 26,
363
+ SessionRenewalDateIsZero: 27,
364
+ SenderNotInitialized: 28,
365
+ StartTrackEventFailed: 29,
366
+ StopTrackEventFailed: 30,
367
+ StartTrackFailed: 31,
368
+ StopTrackFailed: 32,
369
+ TelemetrySampledAndNotSent: 33,
370
+ TrackEventFailed: 34,
371
+ TrackExceptionFailed: 35,
372
+ TrackMetricFailed: 36,
373
+ TrackPVFailed: 37,
374
+ TrackPVFailedCalc: 38,
375
+ TrackTraceFailed: 39,
376
+ TransmissionFailed: 40,
377
+ FailedToSetStorageBuffer: 41,
378
+ FailedToRestoreStorageBuffer: 42,
379
+ InvalidBackendResponse: 43,
380
+ FailedToFixDepricatedValues: 44,
381
+ InvalidDurationValue: 45,
382
+ TelemetryEnvelopeInvalid: 46,
383
+ CreateEnvelopeError: 47,
384
+ CannotSerializeObject: 48,
385
+ CannotSerializeObjectNonSerializable: 49,
386
+ CircularReferenceDetected: 50,
387
+ ClearAuthContextFailed: 51,
388
+ ExceptionTruncated: 52,
389
+ IllegalCharsInName: 53,
390
+ ItemNotInArray: 54,
391
+ MaxAjaxPerPVExceeded: 55,
392
+ MessageTruncated: 56,
393
+ NameTooLong: 57,
394
+ SampleRateOutOfRange: 58,
395
+ SetAuthContextFailed: 59,
396
+ SetAuthContextFailedAccountName: 60,
397
+ StringValueTooLong: 61,
398
+ StartCalledMoreThanOnce: 62,
399
+ StopCalledWithoutStart: 63,
400
+ TelemetryInitializerFailed: 64,
401
+ TrackArgumentsNotSpecified: 65,
402
+ UrlTooLong: 66,
403
+ SessionStorageBufferFull: 67,
404
+ CannotAccessCookie: 68,
405
+ IdTooLong: 69,
406
+ InvalidEvent: 70,
407
+ FailedMonitorAjaxSetRequestHeader: 71,
408
+ SendBrowserInfoOnUserInit: 72,
409
+ PluginException: 73,
410
+ NotificationException: 74,
411
+ SnippetScriptLoadFailure: 99,
412
+ InvalidInstrumentationKey: 100,
413
+ CannotParseAiBlobValue: 101,
414
+ InvalidContentBlob: 102,
415
+ TrackPageActionEventFailed: 103,
416
+ FailedAddingCustomDefinedRequestContext: 104,
417
+ InMemoryStorageBufferFull: 105
418
+ };
337
419
 
420
+ var strOnPrefix = "on";
421
+ var strAttachEvent = "attachEvent";
422
+ var strAddEventHelper = "addEventListener";
338
423
  var strToISOString = "toISOString";
339
424
  var cStrEndsWith = "endsWith";
340
425
  var strIndexOf = "indexOf";
@@ -344,8 +429,7 @@
344
429
  var strToString = "toString";
345
430
  var str__Proto = "__proto__";
346
431
  var strConstructor$1 = "constructor";
347
- var _objDefineProperty$1 = ObjDefineProperty;
348
- var _objFreeze = ObjClass.freeze;
432
+ var _objDefineProperty = ObjDefineProperty;
349
433
  var _objKeys = ObjClass.keys;
350
434
  var StringProto = String[strShimPrototype];
351
435
  var _strTrim = StringProto[cStrTrim];
@@ -355,10 +439,7 @@
355
439
  var _isArray = Array.isArray;
356
440
  var _objToString = ObjProto[strToString];
357
441
  var _fnToString = ObjHasOwnProperty[strToString];
358
- var _objFunctionString = _fnToString.call(ObjClass);
359
- var rCamelCase = /-([a-z])/g;
360
- var rNormalizeInvalid = /([^\w\d_$])/g;
361
- var rLeadingNumeric = /^(\d+[\w\d_$])/;
442
+ _fnToString.call(ObjClass);
362
443
  var _objGetPrototypeOf = Object["getPrototypeOf"];
363
444
  function _getObjProto(target) {
364
445
  if (target) {
@@ -372,9 +453,6 @@
372
453
  }
373
454
  return null;
374
455
  }
375
- function objToString(obj) {
376
- return _objToString.call(obj);
377
- }
378
456
  function isTypeof(value, theType) {
379
457
  return typeof value === theType;
380
458
  }
@@ -396,18 +474,24 @@
396
474
  function isFunction(value) {
397
475
  return !!(value && typeof value === strShimFunction);
398
476
  }
399
- function normalizeJsName(name) {
400
- var value = name;
401
- if (value && isString(value)) {
402
- value = value.replace(rCamelCase, function (_all, letter) {
403
- return letter.toUpperCase();
404
- });
405
- value = value.replace(rNormalizeInvalid, "_");
406
- value = value.replace(rLeadingNumeric, function (_all, match) {
407
- return "_" + match;
408
- });
477
+ function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
478
+ if (useCapture === void 0) { useCapture = false; }
479
+ var result = false;
480
+ if (!isNullOrUndefined(obj)) {
481
+ try {
482
+ if (!isNullOrUndefined(obj[strAddEventHelper])) {
483
+ obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
484
+ result = true;
485
+ }
486
+ else if (!isNullOrUndefined(obj[strAttachEvent])) {
487
+ obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
488
+ result = true;
489
+ }
490
+ }
491
+ catch (e) {
492
+ }
409
493
  }
410
- return value;
494
+ return result;
411
495
  }
412
496
  function objForEachKey(target, callbackfn) {
413
497
  if (target) {
@@ -469,22 +553,6 @@
469
553
  function isSymbol(value) {
470
554
  return typeof value === "symbol";
471
555
  }
472
- function isPlainObject(value) {
473
- var result = false;
474
- if (value && typeof value === "object") {
475
- var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
476
- if (!proto) {
477
- result = true;
478
- }
479
- else {
480
- if (proto[strConstructor$1] && ObjHasOwnProperty.call(proto, strConstructor$1)) {
481
- proto = proto[strConstructor$1];
482
- }
483
- result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
484
- }
485
- }
486
- return result;
487
- }
488
556
  function toISOString(date) {
489
557
  if (date) {
490
558
  return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
@@ -630,7 +698,7 @@
630
698
  return result;
631
699
  }
632
700
  function objDefineAccessors(target, prop, getProp, setProp) {
633
- if (_objDefineProperty$1) {
701
+ if (_objDefineProperty) {
634
702
  try {
635
703
  var descriptor = {
636
704
  enumerable: true,
@@ -642,7 +710,7 @@
642
710
  if (setProp) {
643
711
  descriptor.set = setProp;
644
712
  }
645
- _objDefineProperty$1(target, prop, descriptor);
713
+ _objDefineProperty(target, prop, descriptor);
646
714
  return true;
647
715
  }
648
716
  catch (e) {
@@ -650,10 +718,6 @@
650
718
  }
651
719
  return false;
652
720
  }
653
- function _doNothing(value) {
654
- return value;
655
- }
656
- var objFreeze = _objFreeze || _doNothing;
657
721
  function dateNow() {
658
722
  var dt = Date;
659
723
  return dt.now ? dt.now() : new dt().getTime();
@@ -662,7 +726,7 @@
662
726
  if (isError(object)) {
663
727
  return object.name;
664
728
  }
665
- return strEmpty$1;
729
+ return "";
666
730
  }
667
731
  function setValue(target, field, value, valChk, srcChk) {
668
732
  var theValue = value;
@@ -678,91 +742,6 @@
678
742
  function isTruthy(value) {
679
743
  return !!value;
680
744
  }
681
- function throwError(message) {
682
- throw new Error(message);
683
- }
684
- function _createProxyFunction(source, funcName) {
685
- var srcFunc = null;
686
- var src = null;
687
- if (isFunction(source)) {
688
- srcFunc = source;
689
- }
690
- else {
691
- src = source;
692
- }
693
- return function () {
694
- var originalArguments = arguments;
695
- if (srcFunc) {
696
- src = srcFunc();
697
- }
698
- if (src) {
699
- return src[funcName].apply(src, originalArguments);
700
- }
701
- };
702
- }
703
- function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
704
- if (overwriteTarget === void 0) { overwriteTarget = true; }
705
- if (target && name && source) {
706
- if (overwriteTarget || isUndefined(target[name])) {
707
- target[name] = _createProxyFunction(source, theFunc);
708
- }
709
- }
710
- }
711
- function createEnumStyle(values) {
712
- var enumClass = {};
713
- objForEachKey(values, function (field, value) {
714
- enumClass[field] = value;
715
- if (!isUndefined(enumClass[value])) {
716
- throwError("[" + value + "] exists for " + field);
717
- }
718
- enumClass[value] = field;
719
- });
720
- return objFreeze(enumClass);
721
- }
722
- function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
723
- var theArgs = arguments;
724
- var extended = theArgs[0] || {};
725
- var argLen = theArgs.length;
726
- var deep = false;
727
- var idx = 1;
728
- if (argLen > 0 && isBoolean(extended)) {
729
- deep = extended;
730
- extended = theArgs[idx] || {};
731
- idx++;
732
- }
733
- if (!isObject(extended)) {
734
- extended = {};
735
- }
736
- for (; idx < argLen; idx++) {
737
- var arg = theArgs[idx];
738
- var isArgArray = isArray(arg);
739
- var isArgObj = isObject(arg);
740
- for (var prop in arg) {
741
- var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
742
- if (!propOk) {
743
- continue;
744
- }
745
- var newValue = arg[prop];
746
- var isNewArray = void 0;
747
- if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
748
- var clone = extended[prop];
749
- if (isNewArray) {
750
- if (!isArray(clone)) {
751
- clone = [];
752
- }
753
- }
754
- else if (!isPlainObject(clone)) {
755
- clone = {};
756
- }
757
- newValue = objExtend(deep, clone, newValue);
758
- }
759
- if (newValue !== undefined) {
760
- extended[prop] = newValue;
761
- }
762
- }
763
- }
764
- return extended;
765
- }
766
745
 
767
746
  var strWindow = "window";
768
747
  var strDocument = "document";
@@ -857,7 +836,7 @@
857
836
  var nav = getNavigator();
858
837
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
859
838
  _navUserAgentCheck = nav.userAgent;
860
- var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
839
+ var userAgent = (_navUserAgentCheck || "").toLowerCase();
861
840
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
862
841
  }
863
842
  return _isTrident;
@@ -866,9 +845,9 @@
866
845
  if (userAgentStr === void 0) { userAgentStr = null; }
867
846
  if (!userAgentStr) {
868
847
  var navigator_1 = getNavigator() || {};
869
- userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
848
+ userAgentStr = navigator_1 ? (navigator_1.userAgent || "").toLowerCase() : "";
870
849
  }
871
- var ua = (userAgentStr || strEmpty$1).toLowerCase();
850
+ var ua = (userAgentStr || "").toLowerCase();
872
851
  if (strContains(ua, strMsie)) {
873
852
  var doc = getDocument() || {};
874
853
  return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
@@ -883,7 +862,7 @@
883
862
  }
884
863
  function dumpObj(object) {
885
864
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
886
- var propertyValueDump = strEmpty$1;
865
+ var propertyValueDump = "";
887
866
  if (objectTypeDump === "[object Error]") {
888
867
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
889
868
  }
@@ -922,9 +901,9 @@
922
901
  var strWarnToConsole = "warnToConsole";
923
902
  function _sanitizeDiagnosticText(text) {
924
903
  if (text) {
925
- return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
904
+ return "\"" + text.replace(/\"/g, "") + "\"";
926
905
  }
927
- return strEmpty$1;
906
+ return "";
928
907
  }
929
908
  function _logToConsole(func, message) {
930
909
  var theConsole = getConsole();
@@ -946,12 +925,12 @@
946
925
  _self.message =
947
926
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
948
927
  msgId;
949
- var strProps = strEmpty$1;
928
+ var strProps = "";
950
929
  if (hasJSON()) {
951
930
  strProps = getJSON().stringify(properties);
952
931
  }
953
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
954
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
932
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
933
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
955
934
  _self.message += diagnosticText;
956
935
  }
957
936
  _InternalLogMessage.dataType = "MessageData";
@@ -978,10 +957,10 @@
978
957
  if (isUserAct === void 0) { isUserAct = false; }
979
958
  var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
980
959
  if (_self.enableDebugExceptions()) {
981
- throw message;
960
+ throw dumpObj(message);
982
961
  }
983
962
  else {
984
- var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
963
+ var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
985
964
  if (!isUndefined(message.message)) {
986
965
  var logLevel = _self.consoleLoggingLevel();
987
966
  if (isUserAct) {
@@ -999,7 +978,7 @@
999
978
  _self.logInternalMessage(severity, message);
1000
979
  }
1001
980
  else {
1002
- _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
981
+ _debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
1003
982
  }
1004
983
  }
1005
984
  };
@@ -1031,13 +1010,13 @@
1031
1010
  if (severity <= _self.telemetryLoggingLevel()) {
1032
1011
  _self.queue.push(message);
1033
1012
  _messageCount++;
1034
- _debugExtMsg((severity === 1 ? "error" : "warn"), message);
1013
+ _debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
1035
1014
  }
1036
1015
  if (_messageCount === _self.maxInternalMessageLimit()) {
1037
1016
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
1038
- var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
1017
+ var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
1039
1018
  _self.queue.push(throttleMessage);
1040
- if (severity === 1 ) {
1019
+ if (severity === LoggingSeverity.CRITICAL) {
1041
1020
  _self.errorToConsole(throttleLimitMessage);
1042
1021
  }
1043
1022
  else {
@@ -1066,10 +1045,6 @@
1066
1045
  }
1067
1046
  return DiagnosticLogger;
1068
1047
  }());
1069
- function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
1070
- if (isUserAct === void 0) { isUserAct = false; }
1071
- (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
1072
- }
1073
1048
 
1074
1049
  var strExecutionContextKey = "ctx";
1075
1050
  var PerfEvent = /** @class */ (function () {
@@ -1183,509 +1158,252 @@
1183
1158
  return func();
1184
1159
  }
1185
1160
 
1186
- var UInt32Mask = 0x100000000;
1187
- var MaxUInt32 = 0xffffffff;
1188
- var _mwcSeeded = false;
1189
- var _mwcW = 123456789;
1190
- var _mwcZ = 987654321;
1191
- function _mwcSeed(seedValue) {
1192
- if (seedValue < 0) {
1193
- seedValue >>>= 0;
1194
- }
1195
- _mwcW = (123456789 + seedValue) & MaxUInt32;
1196
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
1197
- _mwcSeeded = true;
1198
- }
1199
- function _autoSeedMwc() {
1200
- try {
1201
- var now = dateNow() & 0x7fffffff;
1202
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1203
- }
1204
- catch (e) {
1205
- }
1206
- }
1207
- function randomValue(maxValue) {
1208
- if (maxValue > 0) {
1209
- return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
1210
- }
1211
- return 0;
1212
- }
1213
- function random32(signed) {
1214
- var value = 0;
1215
- var c = getCrypto() || getMsCrypto();
1216
- if (c && c.getRandomValues) {
1217
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1218
- }
1219
- if (value === 0 && isIE()) {
1220
- if (!_mwcSeeded) {
1221
- _autoSeedMwc();
1222
- }
1223
- value = mwcRandom32() & MaxUInt32;
1224
- }
1225
- if (value === 0) {
1226
- value = Math.floor((UInt32Mask * Math.random()) | 0);
1227
- }
1228
- if (!signed) {
1229
- value >>>= 0;
1230
- }
1231
- return value;
1232
- }
1233
- function mwcRandomSeed(value) {
1234
- if (!value) {
1235
- _autoSeedMwc();
1236
- }
1237
- else {
1238
- _mwcSeed(value);
1239
- }
1240
- }
1241
- function mwcRandom32(signed) {
1242
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1243
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1244
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1245
- if (!signed) {
1246
- value >>>= 0;
1247
- }
1248
- return value;
1249
- }
1250
- function newId(maxLength) {
1251
- if (maxLength === void 0) { maxLength = 22; }
1252
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1253
- var number = random32() >>> 0;
1254
- var chars = 0;
1255
- var result = strEmpty$1;
1256
- while (result.length < maxLength) {
1257
- chars++;
1258
- result += base64chars.charAt(number & 0x3F);
1259
- number >>>= 6;
1260
- if (chars === 5) {
1261
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1262
- chars = 0;
1263
- }
1264
- }
1265
- return result;
1266
- }
1267
-
1268
- var _objDefineProperty = ObjDefineProperty;
1269
- var version = "2.7.5-nightly.2203-03";
1270
- var instanceName = "." + newId(6);
1271
- var _dataUid = 0;
1272
- function _createAccessor(target, prop, value) {
1273
- if (_objDefineProperty) {
1274
- try {
1275
- _objDefineProperty(target, prop, {
1276
- value: value,
1277
- enumerable: false,
1278
- configurable: true
1279
- });
1280
- return true;
1281
- }
1282
- catch (e) {
1283
- }
1284
- }
1285
- return false;
1286
- }
1287
- function _canAcceptData(target) {
1288
- return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
1289
- }
1290
- function _getCache(data, target) {
1291
- var theCache = target[data.id];
1292
- if (!theCache) {
1293
- theCache = {};
1294
- try {
1295
- if (_canAcceptData(target)) {
1296
- if (!_createAccessor(target, data.id, theCache)) {
1297
- target[data.id] = theCache;
1298
- }
1299
- }
1300
- }
1301
- catch (e) {
1302
- }
1303
- }
1304
- return theCache;
1305
- }
1306
- function createUniqueNamespace(name, includeVersion) {
1307
- if (includeVersion === void 0) { includeVersion = false; }
1308
- return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
1309
- }
1310
- function createElmNodeData(name) {
1311
- var data = {
1312
- id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
1313
- accept: function (target) {
1314
- return _canAcceptData(target);
1315
- },
1316
- get: function (target, name, defValue, addDefault) {
1317
- var theCache = target[data.id];
1318
- if (!theCache) {
1319
- if (addDefault) {
1320
- theCache = _getCache(data, target);
1321
- theCache[normalizeJsName(name)] = defValue;
1322
- }
1323
- return defValue;
1324
- }
1325
- return theCache[normalizeJsName(name)];
1326
- },
1327
- kill: function (target, name) {
1328
- if (target && target[name]) {
1329
- try {
1330
- delete target[name];
1331
- }
1332
- catch (e) {
1333
- }
1161
+ var TelemetryPluginChain = /** @class */ (function () {
1162
+ function TelemetryPluginChain(plugin, defItemCtx) {
1163
+ var _self = this;
1164
+ var _nextProxy = null;
1165
+ var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
1166
+ var _hasSetNext = isFunction(plugin.setNextPlugin);
1167
+ _self._hasRun = false;
1168
+ _self.getPlugin = function () {
1169
+ return plugin;
1170
+ };
1171
+ _self.getNext = function () {
1172
+ return _nextProxy;
1173
+ };
1174
+ _self.setNext = function (nextPlugin) {
1175
+ _nextProxy = nextPlugin;
1176
+ };
1177
+ _self.processTelemetry = function (env, itemCtx) {
1178
+ if (!itemCtx) {
1179
+ itemCtx = defItemCtx;
1334
1180
  }
1335
- }
1336
- };
1337
- return data;
1338
- }
1339
-
1340
- var pluginStateData = createElmNodeData("plugin");
1341
- function _getPluginState(plugin) {
1342
- return pluginStateData.get(plugin, "state", {}, true);
1343
- }
1344
-
1345
- var strTelemetryPluginChain = "TelemetryPluginChain";
1346
- var strHasRunFlags = "_hasRun";
1347
- var strGetTelCtx = "_getTelCtx";
1348
- var _chainId = 0;
1349
- function _getNextProxyStart(proxy, config, core, startAt) {
1350
- while (proxy) {
1351
- if (proxy.getPlugin() === startAt) {
1352
- return proxy;
1353
- }
1354
- proxy = proxy.getNext();
1355
- }
1356
- return createTelemetryProxyChain([startAt], config, core);
1357
- }
1358
- function _createInternalContext(telemetryChain, config, core, startAt) {
1359
- var _nextProxy = null;
1360
- var _onComplete = [];
1361
- if (startAt !== null) {
1362
- _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1363
- }
1364
- var context = {
1365
- _next: _moveNext,
1366
- ctx: {
1367
- core: function () {
1368
- return core;
1369
- },
1370
- diagLog: function () {
1371
- return safeGetLogger(core, config);
1372
- },
1373
- getCfg: function () {
1374
- return config;
1375
- },
1376
- getExtCfg: _getExtCfg,
1377
- getConfig: _getConfig,
1378
- hasNext: function () {
1379
- return !!_nextProxy;
1380
- },
1381
- getNext: function () {
1382
- return _nextProxy;
1383
- },
1384
- setNext: function (nextPlugin) {
1385
- _nextProxy = nextPlugin;
1386
- },
1387
- iterate: _iterateChain,
1388
- onComplete: _addOnComplete
1389
- }
1390
- };
1391
- function _addOnComplete(onComplete, that) {
1392
- var args = [];
1393
- for (var _i = 2; _i < arguments.length; _i++) {
1394
- args[_i - 2] = arguments[_i];
1395
- }
1396
- if (onComplete) {
1397
- _onComplete.push({
1398
- func: onComplete,
1399
- self: !isUndefined(that) ? that : context.ctx,
1400
- args: args
1401
- });
1402
- }
1403
- }
1404
- function _moveNext() {
1405
- var nextProxy = _nextProxy;
1406
- _nextProxy = nextProxy ? nextProxy.getNext() : null;
1407
- if (!nextProxy) {
1408
- var onComplete = _onComplete;
1409
- if (onComplete && onComplete.length > 0) {
1410
- arrForEach(onComplete, function (completeDetails) {
1181
+ var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
1182
+ doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
1183
+ if (plugin && _hasProcessTelemetry) {
1184
+ _self._hasRun = true;
1411
1185
  try {
1412
- completeDetails.func.call(completeDetails.self, completeDetails.args);
1413
- }
1414
- catch (e) {
1415
- _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1186
+ itemCtx.setNext(_nextProxy);
1187
+ if (_hasSetNext) {
1188
+ plugin.setNextPlugin(_nextProxy);
1189
+ }
1190
+ _nextProxy && (_nextProxy._hasRun = false);
1191
+ plugin.processTelemetry(env, itemCtx);
1416
1192
  }
1417
- });
1418
- _onComplete = [];
1419
- }
1420
- }
1421
- return nextProxy;
1422
- }
1423
- function _getExtCfg(identifier, defaultValue, mergeDefault) {
1424
- if (defaultValue === void 0) { defaultValue = {}; }
1425
- if (mergeDefault === void 0) { mergeDefault = 0 ; }
1426
- var theConfig;
1427
- if (config) {
1428
- var extConfig = config.extensionConfig;
1429
- if (extConfig && identifier) {
1430
- theConfig = extConfig[identifier];
1431
- }
1432
- }
1433
- if (!theConfig) {
1434
- theConfig = defaultValue;
1435
- }
1436
- else if (isObject(defaultValue)) {
1437
- if (mergeDefault !== 0 ) {
1438
- var newConfig_1 = objExtend(true, defaultValue, theConfig);
1439
- if (config && mergeDefault === 2 ) {
1440
- objForEachKey(defaultValue, function (field) {
1441
- if (isNullOrUndefined(newConfig_1[field])) {
1442
- var cfgValue = config[field];
1443
- if (!isNullOrUndefined(cfgValue)) {
1444
- newConfig_1[field] = cfgValue;
1445
- }
1193
+ catch (error) {
1194
+ var hasRun = _nextProxy && _nextProxy._hasRun;
1195
+ if (!_nextProxy || !hasRun) {
1196
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
1446
1197
  }
1447
- });
1198
+ if (_nextProxy && !hasRun) {
1199
+ _nextProxy.processTelemetry(env, itemCtx);
1200
+ }
1201
+ }
1448
1202
  }
1449
- }
1450
- }
1451
- return theConfig;
1452
- }
1453
- function _getConfig(identifier, field, defaultValue) {
1454
- if (defaultValue === void 0) { defaultValue = false; }
1455
- var theValue;
1456
- var extConfig = _getExtCfg(identifier, null);
1457
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
1458
- theValue = extConfig[field];
1459
- }
1460
- else if (config && !isNullOrUndefined(config[field])) {
1461
- theValue = config[field];
1462
- }
1463
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1203
+ else if (_nextProxy) {
1204
+ _self._hasRun = true;
1205
+ _nextProxy.processTelemetry(env, itemCtx);
1206
+ }
1207
+ }, function () { return ({ item: env }); }, !(env.sync));
1208
+ };
1464
1209
  }
1465
- function _iterateChain(cb) {
1466
- var nextPlugin;
1467
- while (!!(nextPlugin = context._next())) {
1468
- var plugin = nextPlugin.getPlugin();
1469
- if (plugin) {
1470
- cb(plugin);
1210
+ return TelemetryPluginChain;
1211
+ }());
1212
+
1213
+ function _createProxyChain(plugins, itemCtx) {
1214
+ var proxies = [];
1215
+ if (plugins && plugins.length > 0) {
1216
+ var lastProxy = null;
1217
+ for (var idx = 0; idx < plugins.length; idx++) {
1218
+ var thePlugin = plugins[idx];
1219
+ if (thePlugin && isFunction(thePlugin.processTelemetry)) {
1220
+ var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
1221
+ proxies.push(newProxy);
1222
+ if (lastProxy) {
1223
+ lastProxy.setNext(newProxy);
1224
+ }
1225
+ lastProxy = newProxy;
1471
1226
  }
1472
1227
  }
1473
1228
  }
1474
- return context;
1229
+ return proxies.length > 0 ? proxies[0] : null;
1475
1230
  }
1476
- function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1477
- var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1478
- var context = internalContext.ctx;
1479
- function _processNext(env) {
1480
- var nextPlugin = internalContext._next();
1481
- nextPlugin && nextPlugin.processTelemetry(env, context);
1482
- return !nextPlugin;
1483
- }
1484
- function _createNew(plugins, startAt) {
1485
- if (plugins === void 0) { plugins = null; }
1486
- if (isArray(plugins)) {
1487
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1231
+ function _copyProxyChain(proxy, itemCtx, startAt) {
1232
+ var plugins = [];
1233
+ var add = startAt ? false : true;
1234
+ if (proxy) {
1235
+ while (proxy) {
1236
+ var thePlugin = proxy.getPlugin();
1237
+ if (add || thePlugin === startAt) {
1238
+ add = true;
1239
+ plugins.push(thePlugin);
1240
+ }
1241
+ proxy = proxy.getNext();
1488
1242
  }
1489
- return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
1490
1243
  }
1491
- context.processNext = _processNext;
1492
- context.createNew = _createNew;
1493
- return context;
1494
- }
1495
- function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
1496
- var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1497
- var context = internalContext.ctx;
1498
- function _processNext(unloadState) {
1499
- var nextPlugin = internalContext._next();
1500
- nextPlugin && nextPlugin.unload(context, unloadState);
1501
- return !nextPlugin;
1502
- }
1503
- function _createNew(plugins, startAt) {
1504
- if (plugins === void 0) { plugins = null; }
1505
- if (isArray(plugins)) {
1506
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1507
- }
1508
- return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
1244
+ if (!add) {
1245
+ plugins.push(startAt);
1509
1246
  }
1510
- context.processNext = _processNext;
1511
- context.createNew = _createNew;
1512
- return context;
1247
+ return _createProxyChain(plugins, itemCtx);
1513
1248
  }
1514
- function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
1515
- var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1516
- var context = internalContext.ctx;
1517
- function _processNext(updateState) {
1518
- return context.iterate(function (plugin) {
1519
- if (isFunction(plugin[strUpdate])) {
1520
- plugin[strUpdate](context, updateState);
1249
+ function _copyPluginChain(srcPlugins, itemCtx, startAt) {
1250
+ var plugins = srcPlugins;
1251
+ var add = false;
1252
+ if (startAt && srcPlugins) {
1253
+ plugins = [];
1254
+ arrForEach(srcPlugins, function (thePlugin) {
1255
+ if (add || thePlugin === startAt) {
1256
+ add = true;
1257
+ plugins.push(thePlugin);
1521
1258
  }
1522
1259
  });
1523
1260
  }
1524
- function _createNew(plugins, startAt) {
1525
- if (plugins === void 0) { plugins = null; }
1526
- if (isArray(plugins)) {
1527
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1261
+ if (startAt && !add) {
1262
+ if (!plugins) {
1263
+ plugins = [];
1528
1264
  }
1529
- return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1265
+ plugins.push(startAt);
1530
1266
  }
1531
- context.processNext = _processNext;
1532
- context.createNew = _createNew;
1533
- return context;
1267
+ return _createProxyChain(plugins, itemCtx);
1534
1268
  }
1535
- function createTelemetryProxyChain(plugins, config, core, startAt) {
1536
- var firstProxy = null;
1537
- var add = startAt ? false : true;
1538
- if (isArray(plugins) && plugins.length > 0) {
1539
- var lastProxy_1 = null;
1540
- arrForEach(plugins, function (thePlugin) {
1541
- if (!add && startAt === thePlugin) {
1542
- add = true;
1269
+ var ProcessTelemetryContext = /** @class */ (function () {
1270
+ function ProcessTelemetryContext(plugins, config, core, startAt) {
1271
+ var _self = this;
1272
+ var _nextProxy = null;
1273
+ if (startAt !== null) {
1274
+ if (plugins && isFunction(plugins.getPlugin)) {
1275
+ _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
1543
1276
  }
1544
- if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
1545
- var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1546
- if (!firstProxy) {
1547
- firstProxy = newProxy;
1277
+ else {
1278
+ if (startAt) {
1279
+ _nextProxy = _copyPluginChain(plugins, _self, startAt);
1548
1280
  }
1549
- if (lastProxy_1) {
1550
- lastProxy_1._setNext(newProxy);
1281
+ else if (isUndefined(startAt)) {
1282
+ _nextProxy = _createProxyChain(plugins, _self);
1551
1283
  }
1552
- lastProxy_1 = newProxy;
1553
1284
  }
1554
- });
1555
- }
1556
- if (startAt && !firstProxy) {
1557
- return createTelemetryProxyChain([startAt], config, core);
1558
- }
1559
- return firstProxy;
1560
- }
1561
- function createTelemetryPluginProxy(plugin, config, core) {
1562
- var nextProxy = null;
1563
- var hasProcessTelemetry = isFunction(plugin.processTelemetry);
1564
- var hasSetNext = isFunction(plugin.setNextPlugin);
1565
- var chainId;
1566
- if (plugin) {
1567
- chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
1568
- }
1569
- else {
1570
- chainId = "Unknown-0-" + _chainId++;
1571
- }
1572
- var proxyChain = {
1573
- getPlugin: function () {
1574
- return plugin;
1575
- },
1576
- getNext: function () {
1577
- return nextProxy;
1578
- },
1579
- processTelemetry: _processTelemetry,
1580
- unload: _unloadPlugin,
1581
- update: _updatePlugin,
1582
- _id: chainId,
1583
- _setNext: function (nextPlugin) {
1584
- nextProxy = nextPlugin;
1585
1285
  }
1586
- };
1587
- function _getTelCtx() {
1588
- var itemCtx;
1589
- if (plugin && isFunction(plugin[strGetTelCtx])) {
1590
- itemCtx = plugin[strGetTelCtx]();
1591
- }
1592
- if (!itemCtx) {
1593
- itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1594
- }
1595
- return itemCtx;
1596
- }
1597
- function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
1598
- var hasRun = false;
1599
- var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1600
- var hasRunContext = itemCtx[strHasRunFlags];
1601
- if (!hasRunContext) {
1602
- hasRunContext = itemCtx[strHasRunFlags] = {};
1603
- }
1604
- itemCtx.setNext(nextProxy);
1605
- if (plugin) {
1606
- doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
1607
- hasRunContext[chainId] = true;
1608
- try {
1609
- var nextId = nextProxy ? nextProxy._id : strEmpty$1;
1610
- if (nextId) {
1611
- hasRunContext[nextId] = false;
1612
- }
1613
- hasRun = processPluginFn(itemCtx);
1614
- }
1615
- catch (error) {
1616
- var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
1617
- if (hasNextRun) {
1618
- hasRun = true;
1619
- }
1620
- if (!nextProxy || !hasNextRun) {
1621
- _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1622
- }
1286
+ _self.core = function () {
1287
+ return core;
1288
+ };
1289
+ _self.diagLog = function () {
1290
+ return safeGetLogger(core, config);
1291
+ };
1292
+ _self.getCfg = function () {
1293
+ return config;
1294
+ };
1295
+ _self.getExtCfg = function (identifier, defaultValue) {
1296
+ if (defaultValue === void 0) { defaultValue = {}; }
1297
+ var theConfig;
1298
+ if (config) {
1299
+ var extConfig = config.extensionConfig;
1300
+ if (extConfig && identifier) {
1301
+ theConfig = extConfig[identifier];
1623
1302
  }
1624
- }, details, isAsync);
1625
- }
1626
- return hasRun;
1627
- }
1628
- function _processTelemetry(env, itemCtx) {
1629
- itemCtx = itemCtx || _getTelCtx();
1630
- function _callProcessTelemetry(itemCtx) {
1631
- if (!plugin || !hasProcessTelemetry) {
1632
- return false;
1633
1303
  }
1634
- var pluginState = _getPluginState(plugin);
1635
- if (pluginState[strTeardown] || pluginState[strDisabled]) {
1636
- return false;
1304
+ return (theConfig ? theConfig : defaultValue);
1305
+ };
1306
+ _self.getConfig = function (identifier, field, defaultValue) {
1307
+ if (defaultValue === void 0) { defaultValue = false; }
1308
+ var theValue;
1309
+ var extConfig = _self.getExtCfg(identifier, null);
1310
+ if (extConfig && !isNullOrUndefined(extConfig[field])) {
1311
+ theValue = extConfig[field];
1637
1312
  }
1638
- if (hasSetNext) {
1639
- plugin.setNextPlugin(nextProxy);
1313
+ else if (config && !isNullOrUndefined(config[field])) {
1314
+ theValue = config[field];
1640
1315
  }
1641
- plugin.processTelemetry(env, itemCtx);
1642
- return true;
1643
- }
1644
- if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
1645
- itemCtx.processNext(env);
1646
- }
1647
- }
1648
- function _unloadPlugin(unloadCtx, unloadState) {
1649
- function _callTeardown() {
1650
- var hasRun = false;
1651
- if (plugin) {
1652
- var pluginState = _getPluginState(plugin);
1653
- var pluginCore = plugin[strCore] || pluginState.core;
1654
- if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
1655
- pluginState[strCore] = null;
1656
- pluginState[strTeardown] = true;
1657
- pluginState[strIsInitialized] = false;
1658
- if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
1659
- hasRun = true;
1660
- }
1661
- }
1316
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1317
+ };
1318
+ _self.hasNext = function () {
1319
+ return _nextProxy != null;
1320
+ };
1321
+ _self.getNext = function () {
1322
+ return _nextProxy;
1323
+ };
1324
+ _self.setNext = function (nextPlugin) {
1325
+ _nextProxy = nextPlugin;
1326
+ };
1327
+ _self.processNext = function (env) {
1328
+ var nextPlugin = _nextProxy;
1329
+ if (nextPlugin) {
1330
+ _nextProxy = nextPlugin.getNext();
1331
+ nextPlugin.processTelemetry(env, _self);
1662
1332
  }
1663
- return hasRun;
1664
- }
1665
- if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1666
- unloadCtx.processNext(unloadState);
1667
- }
1333
+ };
1334
+ _self.createNew = function (plugins, startAt) {
1335
+ if (plugins === void 0) { plugins = null; }
1336
+ return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1337
+ };
1668
1338
  }
1669
- function _updatePlugin(updateCtx, updateState) {
1670
- function _callUpdate() {
1671
- var hasRun = false;
1672
- if (plugin) {
1673
- var pluginState = _getPluginState(plugin);
1674
- var pluginCore = plugin[strCore] || pluginState.core;
1675
- if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1676
- if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1677
- hasRun = true;
1678
- }
1339
+ return ProcessTelemetryContext;
1340
+ }());
1341
+
1342
+ var strExtensionConfig = "extensionConfig";
1343
+
1344
+ var strGetPlugin = "getPlugin";
1345
+ var BaseTelemetryPlugin = /** @class */ (function () {
1346
+ function BaseTelemetryPlugin() {
1347
+ var _self = this;
1348
+ var _isinitialized = false;
1349
+ var _rootCtx = null;
1350
+ var _nextPlugin = null;
1351
+ _self.core = null;
1352
+ _self.diagLog = function (itemCtx) {
1353
+ return _self._getTelCtx(itemCtx).diagLog();
1354
+ };
1355
+ _self.isInitialized = function () {
1356
+ return _isinitialized;
1357
+ };
1358
+ _self.setInitialized = function (isInitialized) {
1359
+ _isinitialized = isInitialized;
1360
+ };
1361
+ _self.setNextPlugin = function (next) {
1362
+ _nextPlugin = next;
1363
+ };
1364
+ _self.processNext = function (env, itemCtx) {
1365
+ if (itemCtx) {
1366
+ itemCtx.processNext(env);
1367
+ }
1368
+ else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
1369
+ _nextPlugin.processTelemetry(env, null);
1370
+ }
1371
+ };
1372
+ _self._getTelCtx = function (currentCtx) {
1373
+ if (currentCtx === void 0) { currentCtx = null; }
1374
+ var itemCtx = currentCtx;
1375
+ if (!itemCtx) {
1376
+ var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
1377
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1378
+ itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1379
+ }
1380
+ else {
1381
+ itemCtx = rootCtx.createNew(null, _nextPlugin);
1679
1382
  }
1680
1383
  }
1681
- return hasRun;
1682
- }
1683
- if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1684
- updateCtx.processNext(updateState);
1685
- }
1384
+ return itemCtx;
1385
+ };
1386
+ _self._baseTelInit = function (config, core, extensions, pluginChain) {
1387
+ if (config) {
1388
+ setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1389
+ }
1390
+ if (!pluginChain && core) {
1391
+ pluginChain = core.getProcessTelContext().getNext();
1392
+ }
1393
+ var nextPlugin = _nextPlugin;
1394
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1395
+ nextPlugin = _nextPlugin[strGetPlugin]();
1396
+ }
1397
+ _self.core = core;
1398
+ _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1399
+ _isinitialized = true;
1400
+ };
1686
1401
  }
1687
- return objFreeze(proxyChain);
1688
- }
1402
+ BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
1403
+ this._baseTelInit(config, core, extensions, pluginChain);
1404
+ };
1405
+ return BaseTelemetryPlugin;
1406
+ }());
1689
1407
 
1690
1408
  var strToGMTString = "toGMTString";
1691
1409
  var strToUTCString = "toUTCString";
@@ -1695,6 +1413,7 @@
1695
1413
  var strIsCookieUseDisabled = "isCookieUseDisabled";
1696
1414
  var strDisableCookiesUsage = "disableCookiesUsage";
1697
1415
  var strConfigCookieMgr = "_ckMgr";
1416
+ var strEmpty = "";
1698
1417
  var _supportsCookies = null;
1699
1418
  var _allowUaSameSite = null;
1700
1419
  var _parsedCookieValue = null;
@@ -1752,7 +1471,7 @@
1752
1471
  var result = false;
1753
1472
  if (_isMgrEnabled(cookieMgr)) {
1754
1473
  var values = {};
1755
- var theValue = strTrim(value || strEmpty$1);
1474
+ var theValue = strTrim(value || strEmpty);
1756
1475
  var idx = theValue.indexOf(";");
1757
1476
  if (idx !== -1) {
1758
1477
  theValue = strTrim(value.substring(0, idx));
@@ -1767,11 +1486,11 @@
1767
1486
  if (expireMs > 0) {
1768
1487
  var expiry = new Date();
1769
1488
  expiry.setTime(expireMs);
1770
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
1489
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
1771
1490
  }
1772
1491
  }
1773
1492
  if (!_isIE) {
1774
- setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
1493
+ setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
1775
1494
  }
1776
1495
  }
1777
1496
  var location_1 = getLocation();
@@ -1792,7 +1511,7 @@
1792
1511
  return result;
1793
1512
  },
1794
1513
  get: function (name) {
1795
- var value = strEmpty$1;
1514
+ var value = strEmpty;
1796
1515
  if (_isMgrEnabled(cookieMgr)) {
1797
1516
  value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1798
1517
  }
@@ -1817,7 +1536,7 @@
1817
1536
  values["max-age"] = "0";
1818
1537
  }
1819
1538
  var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1820
- delCookie(name, _formatCookieValue(strEmpty$1, values));
1539
+ delCookie(name, _formatCookieValue(strEmpty, values));
1821
1540
  result = true;
1822
1541
  }
1823
1542
  return result;
@@ -1834,7 +1553,7 @@
1834
1553
  _supportsCookies = doc[strCookie] !== undefined;
1835
1554
  }
1836
1555
  catch (e) {
1837
- _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1556
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1838
1557
  }
1839
1558
  }
1840
1559
  return _supportsCookies;
@@ -1844,7 +1563,7 @@
1844
1563
  if (theValue && theValue.length) {
1845
1564
  var parts = strTrim(theValue).split(";");
1846
1565
  arrForEach(parts, function (thePart) {
1847
- thePart = strTrim(thePart || strEmpty$1);
1566
+ thePart = strTrim(thePart || strEmpty);
1848
1567
  if (thePart) {
1849
1568
  var idx = thePart.indexOf("=");
1850
1569
  if (idx === -1) {
@@ -1865,21 +1584,21 @@
1865
1584
  return null;
1866
1585
  }
1867
1586
  function _formatCookieValue(value, values) {
1868
- var cookieValue = value || strEmpty$1;
1587
+ var cookieValue = value || strEmpty;
1869
1588
  objForEachKey(values, function (name, theValue) {
1870
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
1589
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
1871
1590
  });
1872
1591
  return cookieValue;
1873
1592
  }
1874
1593
  function _getCookieValue(name) {
1875
- var cookieValue = strEmpty$1;
1594
+ var cookieValue = strEmpty;
1876
1595
  if (_doc) {
1877
- var theCookie = _doc[strCookie] || strEmpty$1;
1596
+ var theCookie = _doc[strCookie] || strEmpty;
1878
1597
  if (_parsedCookieValue !== theCookie) {
1879
1598
  _cookieCache = _extractParts(theCookie);
1880
1599
  _parsedCookieValue = theCookie;
1881
1600
  }
1882
- cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
1601
+ cookieValue = strTrim(_cookieCache[name] || strEmpty);
1883
1602
  }
1884
1603
  return cookieValue;
1885
1604
  }
@@ -1913,290 +1632,86 @@
1913
1632
  return false;
1914
1633
  }
1915
1634
 
1916
- var strExtensionConfig = "extensionConfig";
1917
-
1918
- function createUnloadHandlerContainer() {
1919
- var handlers = [];
1920
- function _addHandler(handler) {
1921
- if (handler) {
1922
- handlers.push(handler);
1923
- }
1924
- }
1925
- function _runHandlers(unloadCtx, unloadState) {
1926
- arrForEach(handlers, function (handler) {
1927
- try {
1928
- handler(unloadCtx, unloadState);
1929
- }
1930
- catch (e) {
1931
- _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1932
- }
1933
- });
1934
- handlers = [];
1635
+ var UInt32Mask = 0x100000000;
1636
+ var MaxUInt32 = 0xffffffff;
1637
+ var _mwcSeeded = false;
1638
+ var _mwcW = 123456789;
1639
+ var _mwcZ = 987654321;
1640
+ function _mwcSeed(seedValue) {
1641
+ if (seedValue < 0) {
1642
+ seedValue >>>= 0;
1935
1643
  }
1936
- return {
1937
- add: _addHandler,
1938
- run: _runHandlers
1939
- };
1644
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1645
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1646
+ _mwcSeeded = true;
1940
1647
  }
1941
-
1942
- var strGetPlugin = "getPlugin";
1943
- var BaseTelemetryPlugin = /** @class */ (function () {
1944
- function BaseTelemetryPlugin() {
1945
- var _self = this;
1946
- var _isinitialized;
1947
- var _rootCtx;
1948
- var _nextPlugin;
1949
- var _unloadHandlerContainer;
1950
- var _hooks;
1951
- _initDefaults();
1952
- dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
1953
- _self.initialize = function (config, core, extensions, pluginChain) {
1954
- _setDefaults(config, core, pluginChain);
1955
- _isinitialized = true;
1956
- };
1957
- _self.teardown = function (unloadCtx, unloadState) {
1958
- if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
1959
- return;
1960
- }
1961
- var result;
1962
- var unloadDone = false;
1963
- var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1964
- var theUnloadState = unloadState || {
1965
- reason: 0 ,
1966
- isAsync: false
1967
- };
1968
- function _unloadCallback() {
1969
- if (!unloadDone) {
1970
- unloadDone = true;
1971
- _unloadHandlerContainer.run(theUnloadCtx, unloadState);
1972
- arrForEach(_hooks, function (fn) {
1973
- fn.rm();
1974
- });
1975
- _hooks = [];
1976
- if (result === true) {
1977
- theUnloadCtx.processNext(theUnloadState);
1978
- }
1979
- _initDefaults();
1980
- }
1981
- }
1982
- if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
1983
- _unloadCallback();
1984
- }
1985
- else {
1986
- result = true;
1987
- }
1988
- return result;
1989
- };
1990
- _self.update = function (updateCtx, updateState) {
1991
- if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
1992
- return;
1993
- }
1994
- var result;
1995
- var updateDone = false;
1996
- var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1997
- var theUpdateState = updateState || {
1998
- reason: 0
1999
- };
2000
- function _updateCallback() {
2001
- if (!updateDone) {
2002
- updateDone = true;
2003
- _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
2004
- }
2005
- }
2006
- if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
2007
- _updateCallback();
2008
- }
2009
- else {
2010
- result = true;
2011
- }
2012
- return result;
2013
- };
2014
- _self._addHook = function (hooks) {
2015
- if (hooks) {
2016
- if (isArray(hooks)) {
2017
- _hooks = _hooks.concat(hooks);
2018
- }
2019
- else {
2020
- _hooks.push(hooks);
2021
- }
2022
- }
2023
- };
2024
- proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
2025
- });
2026
- _self.diagLog = function (itemCtx) {
2027
- return _getTelCtx(itemCtx).diagLog();
2028
- };
2029
- _self[strIsInitialized] = function () {
2030
- return _isinitialized;
2031
- };
2032
- _self.setInitialized = function (isInitialized) {
2033
- _isinitialized = isInitialized;
2034
- };
2035
- _self[strSetNextPlugin] = function (next) {
2036
- _nextPlugin = next;
2037
- };
2038
- _self.processNext = function (env, itemCtx) {
2039
- if (itemCtx) {
2040
- itemCtx.processNext(env);
2041
- }
2042
- else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
2043
- _nextPlugin.processTelemetry(env, null);
2044
- }
2045
- };
2046
- _self._getTelCtx = _getTelCtx;
2047
- function _getTelCtx(currentCtx) {
2048
- if (currentCtx === void 0) { currentCtx = null; }
2049
- var itemCtx = currentCtx;
2050
- if (!itemCtx) {
2051
- var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
2052
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
2053
- itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
2054
- }
2055
- else {
2056
- itemCtx = rootCtx.createNew(null, _nextPlugin);
2057
- }
2058
- }
2059
- return itemCtx;
2060
- }
2061
- function _setDefaults(config, core, pluginChain) {
2062
- if (config) {
2063
- setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
2064
- }
2065
- if (!pluginChain && core) {
2066
- pluginChain = core.getProcessTelContext().getNext();
2067
- }
2068
- var nextPlugin = _nextPlugin;
2069
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
2070
- nextPlugin = _nextPlugin[strGetPlugin]();
2071
- }
2072
- _self.core = core;
2073
- _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
2074
- }
2075
- function _initDefaults() {
2076
- _isinitialized = false;
2077
- _self.core = null;
2078
- _rootCtx = null;
2079
- _nextPlugin = null;
2080
- _hooks = [];
2081
- _unloadHandlerContainer = createUnloadHandlerContainer();
2082
- }
1648
+ function _autoSeedMwc() {
1649
+ try {
1650
+ var now = dateNow() & 0x7fffffff;
1651
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
2083
1652
  }
2084
- return BaseTelemetryPlugin;
2085
- }());
2086
-
2087
- var strOnPrefix = "on";
2088
- var strAttachEvent = "attachEvent";
2089
- var strAddEventHelper = "addEventListener";
2090
- var strEvents = "events";
2091
- createUniqueNamespace("aiEvtPageHide");
2092
- createUniqueNamespace("aiEvtPageShow");
2093
- var rRemoveEmptyNs = /\.[\.]+/g;
2094
- var rRemoveTrailingEmptyNs = /[\.]+$/;
2095
- var _guid = 1;
2096
- var elmNodeData = createElmNodeData("events");
2097
- var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
2098
- function _normalizeNamespace(name) {
2099
- if (name && name.replace) {
2100
- return name.replace(/^\s*\.*|\.*\s*$/g, "");
2101
- }
2102
- return name;
2103
- }
2104
- function _getEvtNamespace(eventName, evtNamespace) {
2105
- if (evtNamespace) {
2106
- var theNamespace_1 = "";
2107
- if (isArray(evtNamespace)) {
2108
- theNamespace_1 = "";
2109
- arrForEach(evtNamespace, function (name) {
2110
- name = _normalizeNamespace(name);
2111
- if (name) {
2112
- if (name[0] !== ".") {
2113
- name = "." + name;
2114
- }
2115
- theNamespace_1 += name;
2116
- }
2117
- });
2118
- }
2119
- else {
2120
- theNamespace_1 = _normalizeNamespace(evtNamespace);
2121
- }
2122
- if (theNamespace_1) {
2123
- if (theNamespace_1[0] !== ".") {
2124
- theNamespace_1 = "." + theNamespace_1;
2125
- }
2126
- eventName = (eventName || "") + theNamespace_1;
2127
- }
1653
+ catch (e) {
2128
1654
  }
2129
- var parsedEvent = (eventNamespace.exec(eventName || "") || []);
2130
- return {
2131
- type: parsedEvent[1],
2132
- ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
2133
- };
2134
1655
  }
2135
- function _getRegisteredEvents(target, evtName, addDefault) {
2136
- if (addDefault === void 0) { addDefault = true; }
2137
- var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
2138
- var registeredEvents = aiEvts[evtName];
2139
- if (!registeredEvents) {
2140
- registeredEvents = aiEvts[evtName] = [];
1656
+ function randomValue(maxValue) {
1657
+ if (maxValue > 0) {
1658
+ return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
2141
1659
  }
2142
- return registeredEvents;
1660
+ return 0;
2143
1661
  }
2144
- function _doAttach(obj, evtName, handlerRef, useCapture) {
2145
- var result = false;
2146
- if (obj && evtName && evtName.type && handlerRef) {
2147
- if (obj[strAddEventHelper]) {
2148
- obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
2149
- result = true;
2150
- }
2151
- else if (obj[strAttachEvent]) {
2152
- obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
2153
- result = true;
1662
+ function random32(signed) {
1663
+ var value;
1664
+ var c = getCrypto() || getMsCrypto();
1665
+ if (c && c.getRandomValues) {
1666
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1667
+ }
1668
+ else if (isIE()) {
1669
+ if (!_mwcSeeded) {
1670
+ _autoSeedMwc();
2154
1671
  }
1672
+ value = mwcRandom32() & MaxUInt32;
2155
1673
  }
2156
- return result;
1674
+ else {
1675
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1676
+ }
1677
+ if (!signed) {
1678
+ value >>>= 0;
1679
+ }
1680
+ return value;
2157
1681
  }
2158
- function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
2159
- if (useCapture === void 0) { useCapture = false; }
2160
- var result = false;
2161
- if (target) {
2162
- try {
2163
- var evtName = _getEvtNamespace(eventName, evtNamespace);
2164
- result = _doAttach(target, evtName, handlerRef, useCapture);
2165
- if (result && elmNodeData.accept(target)) {
2166
- var registeredEvent = {
2167
- guid: _guid++,
2168
- evtName: evtName,
2169
- handler: handlerRef,
2170
- capture: useCapture
2171
- };
2172
- _getRegisteredEvents(target, evtName.type).push(registeredEvent);
2173
- }
2174
- }
2175
- catch (e) {
2176
- }
1682
+ function mwcRandomSeed(value) {
1683
+ if (!value) {
1684
+ _autoSeedMwc();
1685
+ }
1686
+ else {
1687
+ _mwcSeed(value);
2177
1688
  }
2178
- return result;
2179
1689
  }
2180
- function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
2181
- if (useCapture === void 0) { useCapture = false; }
2182
- return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
1690
+ function mwcRandom32(signed) {
1691
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1692
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1693
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1694
+ if (!signed) {
1695
+ value >>>= 0;
1696
+ }
1697
+ return value;
2183
1698
  }
2184
- function addEventHandler(eventName, callback, evtNamespace) {
1699
+
1700
+ var _cookieMgrs = null;
1701
+ var _canUseCookies;
1702
+ function addEventHandler(eventName, callback) {
2185
1703
  var result = false;
2186
1704
  var w = getWindow();
2187
1705
  if (w) {
2188
- result = eventOn(w, eventName, callback, evtNamespace);
2189
- result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
1706
+ result = attachEvent(w, eventName, callback);
1707
+ result = attachEvent(w["body"], eventName, callback) || result;
2190
1708
  }
2191
1709
  var doc = getDocument();
2192
1710
  if (doc) {
2193
- result = eventOn(doc, eventName, callback, evtNamespace) || result;
1711
+ result = attachEvent(doc, eventName, callback) || result;
2194
1712
  }
2195
1713
  return result;
2196
1714
  }
2197
-
2198
- var _cookieMgrs = null;
2199
- var _canUseCookies;
2200
1715
  function newGuid() {
2201
1716
  function randomHexDigit() {
2202
1717
  return randomValue(15);
@@ -2213,9 +1728,26 @@
2213
1728
  }
2214
1729
  return dateNow();
2215
1730
  }
1731
+ function newId(maxLength) {
1732
+ if (maxLength === void 0) { maxLength = 22; }
1733
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1734
+ var number = random32() >>> 0;
1735
+ var chars = 0;
1736
+ var result = "";
1737
+ while (result.length < maxLength) {
1738
+ chars++;
1739
+ result += base64chars.charAt(number & 0x3F);
1740
+ number >>>= 6;
1741
+ if (chars === 5) {
1742
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1743
+ chars = 0;
1744
+ }
1745
+ }
1746
+ return result;
1747
+ }
2216
1748
  function generateW3CId() {
2217
1749
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
2218
- var oct = strEmpty$1, tmp;
1750
+ var oct = "", tmp;
2219
1751
  for (var a = 0; a < 4; a++) {
2220
1752
  tmp = random32();
2221
1753
  oct +=
@@ -2310,95 +1842,6 @@
2310
1842
  return _legacyCookieMgr(null, logger).del(name);
2311
1843
  }
2312
1844
 
2313
- createEnumStyle({
2314
- CRITICAL: 1 ,
2315
- WARNING: 2
2316
- });
2317
- var _InternalMessageId = createEnumStyle({
2318
- BrowserDoesNotSupportLocalStorage: 0 ,
2319
- BrowserCannotReadLocalStorage: 1 ,
2320
- BrowserCannotReadSessionStorage: 2 ,
2321
- BrowserCannotWriteLocalStorage: 3 ,
2322
- BrowserCannotWriteSessionStorage: 4 ,
2323
- BrowserFailedRemovalFromLocalStorage: 5 ,
2324
- BrowserFailedRemovalFromSessionStorage: 6 ,
2325
- CannotSendEmptyTelemetry: 7 ,
2326
- ClientPerformanceMathError: 8 ,
2327
- ErrorParsingAISessionCookie: 9 ,
2328
- ErrorPVCalc: 10 ,
2329
- ExceptionWhileLoggingError: 11 ,
2330
- FailedAddingTelemetryToBuffer: 12 ,
2331
- FailedMonitorAjaxAbort: 13 ,
2332
- FailedMonitorAjaxDur: 14 ,
2333
- FailedMonitorAjaxOpen: 15 ,
2334
- FailedMonitorAjaxRSC: 16 ,
2335
- FailedMonitorAjaxSend: 17 ,
2336
- FailedMonitorAjaxGetCorrelationHeader: 18 ,
2337
- FailedToAddHandlerForOnBeforeUnload: 19 ,
2338
- FailedToSendQueuedTelemetry: 20 ,
2339
- FailedToReportDataLoss: 21 ,
2340
- FlushFailed: 22 ,
2341
- MessageLimitPerPVExceeded: 23 ,
2342
- MissingRequiredFieldSpecification: 24 ,
2343
- NavigationTimingNotSupported: 25 ,
2344
- OnError: 26 ,
2345
- SessionRenewalDateIsZero: 27 ,
2346
- SenderNotInitialized: 28 ,
2347
- StartTrackEventFailed: 29 ,
2348
- StopTrackEventFailed: 30 ,
2349
- StartTrackFailed: 31 ,
2350
- StopTrackFailed: 32 ,
2351
- TelemetrySampledAndNotSent: 33 ,
2352
- TrackEventFailed: 34 ,
2353
- TrackExceptionFailed: 35 ,
2354
- TrackMetricFailed: 36 ,
2355
- TrackPVFailed: 37 ,
2356
- TrackPVFailedCalc: 38 ,
2357
- TrackTraceFailed: 39 ,
2358
- TransmissionFailed: 40 ,
2359
- FailedToSetStorageBuffer: 41 ,
2360
- FailedToRestoreStorageBuffer: 42 ,
2361
- InvalidBackendResponse: 43 ,
2362
- FailedToFixDepricatedValues: 44 ,
2363
- InvalidDurationValue: 45 ,
2364
- TelemetryEnvelopeInvalid: 46 ,
2365
- CreateEnvelopeError: 47 ,
2366
- CannotSerializeObject: 48 ,
2367
- CannotSerializeObjectNonSerializable: 49 ,
2368
- CircularReferenceDetected: 50 ,
2369
- ClearAuthContextFailed: 51 ,
2370
- ExceptionTruncated: 52 ,
2371
- IllegalCharsInName: 53 ,
2372
- ItemNotInArray: 54 ,
2373
- MaxAjaxPerPVExceeded: 55 ,
2374
- MessageTruncated: 56 ,
2375
- NameTooLong: 57 ,
2376
- SampleRateOutOfRange: 58 ,
2377
- SetAuthContextFailed: 59 ,
2378
- SetAuthContextFailedAccountName: 60 ,
2379
- StringValueTooLong: 61 ,
2380
- StartCalledMoreThanOnce: 62 ,
2381
- StopCalledWithoutStart: 63 ,
2382
- TelemetryInitializerFailed: 64 ,
2383
- TrackArgumentsNotSpecified: 65 ,
2384
- UrlTooLong: 66 ,
2385
- SessionStorageBufferFull: 67 ,
2386
- CannotAccessCookie: 68 ,
2387
- IdTooLong: 69 ,
2388
- InvalidEvent: 70 ,
2389
- FailedMonitorAjaxSetRequestHeader: 71 ,
2390
- SendBrowserInfoOnUserInit: 72 ,
2391
- PluginException: 73 ,
2392
- NotificationException: 74 ,
2393
- SnippetScriptLoadFailure: 99 ,
2394
- InvalidInstrumentationKey: 100 ,
2395
- CannotParseAiBlobValue: 101 ,
2396
- InvalidContentBlob: 102 ,
2397
- TrackPageActionEventFailed: 103 ,
2398
- FailedAddingCustomDefinedRequestContext: 104 ,
2399
- InMemoryStorageBufferFull: 105
2400
- });
2401
-
2402
1845
  var aiInstrumentHooks = "_aiHooks";
2403
1846
  var cbNames = [
2404
1847
  "req", "rsp", "hkErr", "fnErr"
@@ -2457,7 +1900,6 @@
2457
1900
  };
2458
1901
  var hookCtx = [];
2459
1902
  var cbArgs = _createArgs([funcArgs], orgArgs);
2460
- funcArgs.evt = getGlobalInst("event");
2461
1903
  function _createArgs(target, theArgs) {
2462
1904
  _arrLoop(theArgs, function (arg) {
2463
1905
  target.push(arg);
@@ -2551,7 +1993,6 @@
2551
1993
  return event;
2552
1994
  }
2553
1995
 
2554
- var strEmpty = "";
2555
1996
  function stringToBoolOrDefault(str, defaultValue) {
2556
1997
  if (defaultValue === void 0) { defaultValue = false; }
2557
1998
  if (str === undefined || str === null) {
@@ -2564,16 +2005,16 @@
2564
2005
  totalms = 0;
2565
2006
  }
2566
2007
  totalms = Math.round(totalms);
2567
- var ms = strEmpty + totalms % 1000;
2568
- var sec = strEmpty + Math.floor(totalms / 1000) % 60;
2569
- var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
2570
- var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2008
+ var ms = "" + totalms % 1000;
2009
+ var sec = "" + Math.floor(totalms / 1000) % 60;
2010
+ var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
2011
+ var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2571
2012
  var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
2572
2013
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
2573
2014
  sec = sec.length < 2 ? "0" + sec : sec;
2574
2015
  min = min.length < 2 ? "0" + min : min;
2575
2016
  hour = hour.length < 2 ? "0" + hour : hour;
2576
- return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
2017
+ return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
2577
2018
  }
2578
2019
  function getExtensionByName(extensions, identifier) {
2579
2020
  var extension = null;
@@ -2591,15 +2032,17 @@
2591
2032
 
2592
2033
  var strNotSpecified = "not_specified";
2593
2034
 
2594
- var StorageType = createEnumStyle({
2595
- LocalStorage: 0 ,
2596
- SessionStorage: 1
2597
- });
2598
- createEnumStyle({
2599
- AI: 0 ,
2600
- AI_AND_W3C: 1 ,
2601
- W3C: 2
2602
- });
2035
+ var StorageType;
2036
+ (function (StorageType) {
2037
+ StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
2038
+ StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
2039
+ })(StorageType || (StorageType = {}));
2040
+ var DistributedTracingModes;
2041
+ (function (DistributedTracingModes) {
2042
+ DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
2043
+ DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
2044
+ DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
2045
+ })(DistributedTracingModes || (DistributedTracingModes = {}));
2603
2046
 
2604
2047
  var _canUseLocalStorage = undefined;
2605
2048
  var _canUseSessionStorage = undefined;
@@ -2637,8 +2080,8 @@
2637
2080
  _canUseLocalStorage = false;
2638
2081
  _canUseSessionStorage = false;
2639
2082
  }
2640
- function utlCanUseLocalStorage(reset) {
2641
- if (reset || _canUseLocalStorage === undefined) {
2083
+ function utlCanUseLocalStorage() {
2084
+ if (_canUseLocalStorage === undefined) {
2642
2085
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
2643
2086
  }
2644
2087
  return _canUseLocalStorage;
@@ -2651,7 +2094,7 @@
2651
2094
  }
2652
2095
  catch (e) {
2653
2096
  _canUseLocalStorage = false;
2654
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2097
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2655
2098
  }
2656
2099
  }
2657
2100
  return null;
@@ -2665,7 +2108,7 @@
2665
2108
  }
2666
2109
  catch (e) {
2667
2110
  _canUseLocalStorage = false;
2668
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2111
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2669
2112
  }
2670
2113
  }
2671
2114
  return false;
@@ -2679,13 +2122,13 @@
2679
2122
  }
2680
2123
  catch (e) {
2681
2124
  _canUseLocalStorage = false;
2682
- _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2125
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2683
2126
  }
2684
2127
  }
2685
2128
  return false;
2686
2129
  }
2687
- function utlCanUseSessionStorage(reset) {
2688
- if (reset || _canUseSessionStorage === undefined) {
2130
+ function utlCanUseSessionStorage() {
2131
+ if (_canUseSessionStorage === undefined) {
2689
2132
  _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
2690
2133
  }
2691
2134
  return _canUseSessionStorage;
@@ -2707,7 +2150,7 @@
2707
2150
  }
2708
2151
  catch (e) {
2709
2152
  _canUseSessionStorage = false;
2710
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2153
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2711
2154
  }
2712
2155
  }
2713
2156
  return null;
@@ -2721,7 +2164,7 @@
2721
2164
  }
2722
2165
  catch (e) {
2723
2166
  _canUseSessionStorage = false;
2724
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2167
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2725
2168
  }
2726
2169
  }
2727
2170
  return false;
@@ -2735,7 +2178,7 @@
2735
2178
  }
2736
2179
  catch (e) {
2737
2180
  _canUseSessionStorage = false;
2738
- _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2181
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2739
2182
  }
2740
2183
  }
2741
2184
  return false;
@@ -2747,7 +2190,7 @@
2747
2190
  "https://dc-int.services.visualstudio.com/v2/track"
2748
2191
  ];
2749
2192
  function isInternalApplicationInsightsEndpoint(endpointUrl) {
2750
- return _internalEndpoints.indexOf(endpointUrl.toLowerCase()) !== -1;
2193
+ return arrIndexOf(_internalEndpoints, endpointUrl.toLowerCase()) !== -1;
2751
2194
  }
2752
2195
  var Util = {
2753
2196
  NotSpecified: strNotSpecified,
@@ -2866,7 +2309,7 @@
2866
2309
  ch.childNodes[0].className = "checkbox off";
2867
2310
  }
2868
2311
  }
2869
- _self.filterList.splice(_self.filterList.indexOf(t), 1);
2312
+ _self.filterList.splice(arrIndexOf(_self.filterList, t), 1);
2870
2313
  checkbox.className = "checkbox on";
2871
2314
  }
2872
2315
  else {
@@ -3116,7 +2559,7 @@
3116
2559
  if (propKeys) {
3117
2560
  arrForEach(propKeys, function (key) {
3118
2561
  var theKey = _toString(key);
3119
- if (theKey && keys.indexOf(theKey) === -1) {
2562
+ if (theKey && arrIndexOf(keys, theKey) === -1) {
3120
2563
  keys.push(key);
3121
2564
  }
3122
2565
  });
@@ -3132,7 +2575,7 @@
3132
2575
  return;
3133
2576
  }
3134
2577
  var theKey = _toString(key);
3135
- if (theKey && excludedKeys.indexOf(theKey) === -1) {
2578
+ if (theKey && arrIndexOf(excludedKeys, theKey) === -1) {
3136
2579
  theKeys.push(theKey);
3137
2580
  }
3138
2581
  });
@@ -3174,7 +2617,7 @@
3174
2617
  }
3175
2618
  for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
3176
2619
  var key_1 = keys_1[_i];
3177
- if (excludeKeys.indexOf(key_1) !== -1) {
2620
+ if (arrIndexOf(excludeKeys, key_1) !== -1) {
3178
2621
  continue;
3179
2622
  }
3180
2623
  var targetValue = target[key_1];
@@ -3364,7 +2807,7 @@
3364
2807
  }
3365
2808
  }
3366
2809
  else if (isString(value) || isNumber(value) || isBoolean(value)) {
3367
- return _testValue(rg, objToString(value));
2810
+ return _testValue(rg, value.toString());
3368
2811
  }
3369
2812
  }
3370
2813
  return false;
@@ -3507,11 +2950,11 @@
3507
2950
  return;
3508
2951
  }
3509
2952
  var type = entry.getKind();
3510
- var allowOther = excludedTypes_1.indexOf("other") === -1;
3511
- if (trackers.indexOf(type) === -1 && !allowOther) {
2953
+ var allowOther = arrIndexOf(excludedTypes_1, "other") === -1;
2954
+ if (arrIndexOf(trackers, type) === -1 && !allowOther) {
3512
2955
  return;
3513
2956
  }
3514
- else if (excludedTypes_1.indexOf(type) !== -1) {
2957
+ else if (arrIndexOf(excludedTypes_1, type) !== -1) {
3515
2958
  return;
3516
2959
  }
3517
2960
  var newEl = entry.render(textFilter, config.excludeKeys, config.includeFunctions);
@@ -3785,16 +3228,16 @@
3785
3228
  dashboard.newLogEntry(perfEvent, dateNow() - startTime, evtName, 0, "perfEvent");
3786
3229
  }
3787
3230
  });
3788
- if (trackers.indexOf("eventsSent") !== -1) {
3231
+ if (arrIndexOf(trackers, "eventsSent") !== -1) {
3789
3232
  foundTrackers_1.push("eventsSent");
3790
3233
  }
3791
- if (trackers.indexOf("eventsSendRequest") !== -1) {
3234
+ if (arrIndexOf(trackers, "eventsSendRequest") !== -1) {
3792
3235
  foundTrackers_1.push("eventsSendRequest");
3793
3236
  }
3794
- if (trackers.indexOf("eventsDiscarded") !== -1) {
3237
+ if (arrIndexOf(trackers, "eventsDiscarded") !== -1) {
3795
3238
  foundTrackers_1.push("eventsDiscarded");
3796
3239
  }
3797
- if (trackers.indexOf("perfEvent") !== -1) {
3240
+ if (arrIndexOf(trackers, "perfEvent") !== -1) {
3798
3241
  foundTrackers_1.push("perfEvent");
3799
3242
  }
3800
3243
  }
@@ -3830,7 +3273,7 @@
3830
3273
  rsp: _handleInstPostHook()
3831
3274
  }, true);
3832
3275
  if (val) {
3833
- if (foundTrackers_1.indexOf(tracker) === -1) {
3276
+ if (arrIndexOf(foundTrackers_1, tracker) === -1) {
3834
3277
  foundTrackers_1.push(tracker);
3835
3278
  }
3836
3279
  }
@@ -3867,7 +3310,7 @@
3867
3310
  }
3868
3311
  };
3869
3312
  function _addTarget(targetObjects, ext) {
3870
- if (ext && targetObjects.indexOf(ext) === -1) {
3313
+ if (ext && arrIndexOf(targetObjects, ext) === -1) {
3871
3314
  targetObjects.push(ext);
3872
3315
  return true;
3873
3316
  }