@microsoft/1ds-core-js 4.1.2-nightly3.2403-07 → 4.1.3-nightly3.2403-09

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 (43) hide show
  1. package/bundle/es5/{ms.core-4.1.2-nightly3.2403-07.gbl.js → ms.core-4.1.3-nightly3.2403-09.gbl.js} +1056 -1038
  2. package/bundle/es5/ms.core-4.1.3-nightly3.2403-09.gbl.js.map +1 -0
  3. package/bundle/es5/ms.core-4.1.3-nightly3.2403-09.gbl.min.js +7 -0
  4. package/bundle/es5/ms.core-4.1.3-nightly3.2403-09.gbl.min.js.map +1 -0
  5. package/bundle/es5/ms.core-4.1.3-nightly3.2403-09.integrity.json +46 -0
  6. package/bundle/es5/{ms.core-4.1.2-nightly3.2403-07.js → ms.core-4.1.3-nightly3.2403-09.js} +1056 -1038
  7. package/bundle/es5/ms.core-4.1.3-nightly3.2403-09.js.map +1 -0
  8. package/bundle/es5/ms.core-4.1.3-nightly3.2403-09.min.js +7 -0
  9. package/bundle/es5/ms.core-4.1.3-nightly3.2403-09.min.js.map +1 -0
  10. package/bundle/es5/ms.core.gbl.js +1055 -1037
  11. package/bundle/es5/ms.core.gbl.js.map +1 -1
  12. package/bundle/es5/ms.core.gbl.min.js +2 -2
  13. package/bundle/es5/ms.core.gbl.min.js.map +1 -1
  14. package/bundle/es5/ms.core.integrity.json +17 -17
  15. package/bundle/es5/ms.core.js +1055 -1037
  16. package/bundle/es5/ms.core.js.map +1 -1
  17. package/bundle/es5/ms.core.min.js +2 -2
  18. package/bundle/es5/ms.core.min.js.map +1 -1
  19. package/dist/es5/ms.core.js +1054 -1036
  20. package/dist/es5/ms.core.js.map +1 -1
  21. package/dist/es5/ms.core.min.js +2 -2
  22. package/dist/es5/ms.core.min.js.map +1 -1
  23. package/dist-es5/AppInsightsCore.js +1 -1
  24. package/dist-es5/BaseCore.js +1 -1
  25. package/dist-es5/DataModels.js +1 -1
  26. package/dist-es5/Enums.js +1 -1
  27. package/dist-es5/Index.js +4 -2
  28. package/dist-es5/Index.js.map +1 -1
  29. package/dist-es5/InternalConstants.js +1 -1
  30. package/dist-es5/Utils.js +2 -2
  31. package/dist-es5/Utils.js.map +1 -1
  32. package/dist-es5/ValueSanitizer.js +1 -1
  33. package/dist-es5/__DynamicConstants.js +1 -1
  34. package/package.json +3 -3
  35. package/types/1ds-core-js.d.ts +5 -2
  36. package/types/1ds-core-js.namespaced.d.ts +15 -6
  37. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.gbl.js.map +0 -1
  38. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.gbl.min.js +0 -7
  39. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.gbl.min.js.map +0 -1
  40. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.integrity.json +0 -46
  41. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.js.map +0 -1
  42. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.min.js +0 -7
  43. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * 1DS JS SDK Core, 4.1.2-nightly3.2403-07
2
+ * 1DS JS SDK Core, 4.1.3-nightly3.2403-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -8,8 +8,8 @@
8
8
  typeof exports === "object" && typeof module !== undef ? factory(exports) :
9
9
  typeof define === "function" && define.amd ? define(["exports"], factory) :
10
10
  (function(global){
11
- var nsKey, key, nm, theExports = {}, modName = "es5_ms_core_4_1_2_nightly3_2403_07", msMod="__ms$mod__";
12
- var mods={}, modDetail=mods[modName]={}, ver="4.1.2-nightly3.2403-07";
11
+ var nsKey, key, nm, theExports = {}, modName = "es5_ms_core_4_1_3_nightly3_2403_09", msMod="__ms$mod__";
12
+ var mods={}, modDetail=mods[modName]={}, ver="4.1.3-nightly3.2403-09";
13
13
  // Versioned namespace "oneDS4"
14
14
  var exportNs=global, nsKey="oneDS4", exportNs=exportNs[nsKey]=(exportNs[nsKey]||{});
15
15
  // Global namespace "oneDS"
@@ -40,23 +40,16 @@ var ObjProto$1 = ObjClass$1[strShimPrototype];
40
40
  var UNDEF_VALUE = undefined;
41
41
  var NULL_VALUE = null;
42
42
  var EMPTY = "";
43
- var BOOLEAN = "boolean";
44
43
  var FUNCTION = "function";
45
- var NUMBER = "number";
46
44
  var OBJECT = "object";
47
45
  var PROTOTYPE = "prototype";
48
46
  var __PROTO__ = "__proto__";
49
- var STRING = "string";
50
47
  var UNDEFINED = "undefined";
51
48
  var CONSTRUCTOR = "constructor";
52
49
  var SYMBOL = "Symbol";
53
50
  var POLYFILL_TAG = "_polyfill";
54
- var INDEX_OF = "indexOf";
55
51
  var LENGTH = "length";
56
- var DONE = "done";
57
- var VALUE = "value";
58
52
  var NAME = "name";
59
- var SLICE = "slice";
60
53
  var CALL = "call";
61
54
  var TO_STRING = "toString";
62
55
  var ObjClass = Object;
@@ -66,6 +59,7 @@ var StrProto = StrCls[PROTOTYPE];
66
59
  var MathCls = Math;
67
60
  var ArrCls = Array;
68
61
  var ArrProto = ArrCls[PROTOTYPE];
62
+ var ArrSlice = ArrProto["slice"];
69
63
 
70
64
  function safe(func, argArray) {
71
65
  try {
@@ -78,12 +72,13 @@ function safe(func, argArray) {
78
72
  }
79
73
  }
80
74
 
75
+ /*#__NO_SIDE_EFFECTS__*/
81
76
  function safeGet(cb, defValue) {
82
77
  var result = safe(cb);
83
78
  return result.e ? defValue : result.v;
84
79
  }
85
80
 
86
- var PRIMITIVE_TYPES = [STRING, NUMBER, BOOLEAN, UNDEFINED, "symbol", "bigint"];
81
+ var _primitiveTypes;
87
82
  /*#__NO_SIDE_EFFECTS__*/
88
83
  function _createIs(theType) {
89
84
  return function (value) {
@@ -123,9 +118,10 @@ function isDefined(arg) {
123
118
  }
124
119
  /*#__NO_SIDE_EFFECTS__*/
125
120
  function isPrimitiveType(theType) {
126
- return theType !== OBJECT && PRIMITIVE_TYPES.indexOf(theType) !== -1;
121
+ !_primitiveTypes && (_primitiveTypes = ["string", "number", "boolean", UNDEFINED, "symbol", "bigint"]);
122
+ return theType !== OBJECT && _primitiveTypes.indexOf(theType) !== -1;
127
123
  }
128
- var isString = ( /*#__PURE__*/_createIs(STRING));
124
+ var isString = ( /*#__PURE__*/_createIs("string"));
129
125
  var isFunction = ( /*#__PURE__*/_createIs(FUNCTION));
130
126
  /*#__NO_SIDE_EFFECTS__*/
131
127
  function isObject(value) {
@@ -136,8 +132,8 @@ function isObject(value) {
136
132
  }
137
133
  var isArray = ArrCls.isArray;
138
134
  var isDate = ( /*#__PURE__*/_createObjIs("Date"));
139
- var isNumber = ( /*#__PURE__*/_createIs(NUMBER));
140
- var isBoolean = ( /*#__PURE__*/_createIs(BOOLEAN));
135
+ var isNumber = ( /*#__PURE__*/_createIs("number"));
136
+ var isBoolean = ( /*#__PURE__*/_createIs("boolean"));
141
137
  var isError = ( /*#__PURE__*/_createObjIs("Error"));
142
138
  /*#__NO_SIDE_EFFECTS__*/
143
139
  function isPromiseLike(value) {
@@ -247,6 +243,7 @@ var asString = StrCls;
247
243
 
248
244
  var GLOBAL_CONFIG_KEY = "__tsUtils$gblCfg";
249
245
  var _globalCfg;
246
+ /*#__NO_SIDE_EFFECTS__*/
250
247
  function _getGlobalValue() {
251
248
  var result;
252
249
  if (typeof globalThis !== UNDEFINED) {
@@ -281,7 +278,7 @@ function dumpObj(object, format) {
281
278
  object = { stack: asString(object.stack), message: asString(object.message), name: asString(object.name) };
282
279
  }
283
280
  try {
284
- propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? ((typeof format === NUMBER) ? format : 4) : UNDEF_VALUE);
281
+ propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? ((typeof format === "number") ? format : 4) : UNDEF_VALUE);
285
282
  propertyValueDump = (propertyValueDump && propertyValueDump.replace(/"(\w+)"\s*:\s{0,1}/g, "$1: ")) || asString(object);
286
283
  }
287
284
  catch (e) {
@@ -290,18 +287,15 @@ function dumpObj(object, format) {
290
287
  return objType + ": " + propertyValueDump;
291
288
  }
292
289
 
293
- var _slice;
294
- var _unwrapInstFunction = _unwrapFunctionWithPoly;
295
290
  var _unwrapFunction = _unwrapFunctionWithPoly;
296
291
  /*#__NO_SIDE_EFFECTS__*/
297
292
  function _unwrapFunctionWithPoly(funcName, clsProto, polyFunc) {
298
- _slice = _slice || ArrProto[SLICE];
299
293
  var clsFn = clsProto && clsProto[funcName];
300
294
  return function (thisArg) {
301
295
  var theFunc = (thisArg && thisArg[funcName]) || clsFn;
302
296
  if (theFunc || polyFunc) {
303
297
  var theArgs = arguments;
304
- return (theFunc || polyFunc).apply(thisArg, theFunc ? _slice[CALL](theArgs, 1) : theArgs);
298
+ return (theFunc || polyFunc).apply(thisArg, theFunc ? ArrSlice[CALL](theArgs, 1) : theArgs);
305
299
  }
306
300
  throwTypeError("\"" + asString(funcName) + "\" not defined for " + dumpObj(thisArg));
307
301
  };
@@ -315,7 +309,7 @@ function _unwrapProp(propName) {
315
309
 
316
310
  var mathMax = MathCls.max;
317
311
 
318
- var strSlice = ( /*#__PURE__*/_unwrapFunction(SLICE, StrProto));
312
+ var strSlice = ( /*#__PURE__*/_unwrapFunction("slice", StrProto));
319
313
 
320
314
  var strSubstring = ( /*#__PURE__*/_unwrapFunction("substring", StrProto));
321
315
  var strSubstr = ( /*#__PURE__*/_unwrapFunctionWithPoly("substr", StrProto, polyStrSubstr));
@@ -387,7 +381,7 @@ function polyGetKnownSymbol(name) {
387
381
  var propMap = {
388
382
  e: "enumerable",
389
383
  c: "configurable",
390
- v: VALUE,
384
+ v: "value",
391
385
  w: "writable",
392
386
  g: "get",
393
387
  s: "set"
@@ -433,6 +427,7 @@ var _globalLazyTestHooks;
433
427
  function _initTestHooks() {
434
428
  _globalLazyTestHooks = _getGlobalConfig();
435
429
  }
430
+ /*#__NO_SIDE_EFFECTS__*/
436
431
  function getLazy(cb) {
437
432
  var lazyValue = {};
438
433
  !_globalLazyTestHooks && _initTestHooks();
@@ -470,11 +465,14 @@ function createCachedValue(value) {
470
465
 
471
466
  var WINDOW = "window";
472
467
  var _cachedGlobal;
473
- var _cachedWindow;
474
- var _cachedDocument;
475
- var _cachedNavigator;
476
- var _cachedHistory;
477
- var _isNode;
468
+ function _getGlobalInstFn(getFn, theArgs) {
469
+ var cachedValue;
470
+ return function () {
471
+ !_globalLazyTestHooks && _initTestHooks();
472
+ (!cachedValue || _globalLazyTestHooks.lzy) && (cachedValue = createCachedValue(safe(getFn, theArgs).v));
473
+ return cachedValue.v;
474
+ };
475
+ }
478
476
  /*#__NO_SIDE_EFFECTS__*/
479
477
  function lazySafeGetInst(name) {
480
478
  return getLazy(function () { return safe((getInst), [name]).v || UNDEF_VALUE; });
@@ -491,8 +489,8 @@ function getInst(name, useCached) {
491
489
  if (gbl && gbl[name]) {
492
490
  return gbl[name];
493
491
  }
494
- if (name === WINDOW && _cachedWindow) {
495
- return _cachedWindow.v;
492
+ if (name === WINDOW) {
493
+ return getWindow();
496
494
  }
497
495
  return NULL_VALUE;
498
496
  }
@@ -500,46 +498,25 @@ function getInst(name, useCached) {
500
498
  function hasDocument() {
501
499
  return !!getDocument();
502
500
  }
503
- /*#__NO_SIDE_EFFECTS__*/
504
- function getDocument() {
505
- !_globalLazyTestHooks && _initTestHooks();
506
- (!_cachedDocument || _globalLazyTestHooks.lzy) && (_cachedDocument = createCachedValue(safe((getInst), ["document"]).v));
507
- return _cachedDocument.v;
508
- }
501
+ var getDocument = ( /*#__PURE__*/_getGlobalInstFn(getInst, ["document"]));
509
502
  /*#__NO_SIDE_EFFECTS__*/
510
503
  function hasWindow() {
511
504
  return !!getWindow();
512
505
  }
513
- /*#__NO_SIDE_EFFECTS__*/
514
- function getWindow() {
515
- !_globalLazyTestHooks && _initTestHooks();
516
- (!_cachedWindow || _globalLazyTestHooks.lzy) && (_cachedWindow = createCachedValue(safe((getInst), [WINDOW]).v));
517
- return _cachedWindow.v;
518
- }
506
+ var getWindow = ( /*#__PURE__*/_getGlobalInstFn(getInst, [WINDOW]));
519
507
  /*#__NO_SIDE_EFFECTS__*/
520
508
  function hasNavigator() {
521
509
  return !!getNavigator();
522
510
  }
523
- /*#__NO_SIDE_EFFECTS__*/
524
- function getNavigator() {
525
- !_globalLazyTestHooks && _initTestHooks();
526
- (!_cachedNavigator || _globalLazyTestHooks.lzy) && (_cachedNavigator = createCachedValue(safe((getInst), ["navigator"]).v));
527
- return _cachedNavigator.v;
528
- }
511
+ var getNavigator = ( /*#__PURE__*/_getGlobalInstFn(getInst, ["navigator"]));
529
512
  /*#__NO_SIDE_EFFECTS__*/
530
513
  function hasHistory() {
531
514
  return !!getHistory();
532
515
  }
533
- /*#__NO_SIDE_EFFECTS__*/
534
- function getHistory() {
535
- !_globalLazyTestHooks && _initTestHooks();
536
- (!_cachedHistory || _globalLazyTestHooks.lzy) && (_cachedHistory = createCachedValue(safe((getInst), ["history"]).v));
537
- return _cachedHistory.v;
538
- }
539
- function isNode() {
540
- !_isNode && (_isNode = createCachedValue(!!safe(function () { return (process && (process.versions || {}).node); }).v));
541
- return _isNode.v;
542
- }
516
+ var getHistory = ( /*#__PURE__*/_getGlobalInstFn(getInst, ["history"]));
517
+ var isNode = ( /*#__PURE__*/_getGlobalInstFn(function () {
518
+ return !!safe(function () { return (process && (process.versions || {}).node); }).v;
519
+ }));
543
520
 
544
521
  var _symbol;
545
522
  var _symbolFor;
@@ -600,8 +577,8 @@ function iterForOf(iter, callbackfn, thisArg) {
600
577
  var iterResult = void 0;
601
578
  try {
602
579
  var count = 0;
603
- while (!(iterResult = iter.next())[DONE]) {
604
- if (callbackfn[CALL](thisArg || iter, iterResult[VALUE], count, iter) === -1) {
580
+ while (!(iterResult = iter.next()).done) {
581
+ if (callbackfn[CALL](thisArg || iter, iterResult.value, count, iter) === -1) {
605
582
  break;
606
583
  }
607
584
  count++;
@@ -616,7 +593,7 @@ function iterForOf(iter, callbackfn, thisArg) {
616
593
  }
617
594
  finally {
618
595
  try {
619
- if (iterResult && !iterResult[DONE]) {
596
+ if (iterResult && !iterResult.done) {
620
597
  iter.return && iter.return(iterResult);
621
598
  }
622
599
  }
@@ -630,7 +607,9 @@ function iterForOf(iter, callbackfn, thisArg) {
630
607
  }
631
608
  }
632
609
 
633
- var fnApply = ( /*#__PURE__*/_unwrapInstFunction("apply"));
610
+ function fnApply(fn, thisArg, argArray) {
611
+ return fn.apply(thisArg, argArray);
612
+ }
634
613
 
635
614
  function arrAppend(target, elms) {
636
615
  if (!isUndefined(elms) && target) {
@@ -662,11 +641,13 @@ function arrForEach(theArray, callbackfn, thisArg) {
662
641
  }
663
642
  }
664
643
 
665
- var arrIndexOf = ( /*#__PURE__*/_unwrapFunction(INDEX_OF, ArrProto));
644
+ var arrIndexOf = ( /*#__PURE__*/_unwrapFunction("indexOf", ArrProto));
666
645
 
667
646
  var arrMap = ( /*#__PURE__*/_unwrapFunction("map", ArrProto));
668
647
 
669
- var arrSlice = ( /*#__PURE__*/_unwrapFunction(SLICE, ArrProto));
648
+ function arrSlice(theArray, start, end) {
649
+ return ((theArray && theArray["slice"]) || ArrSlice).apply(theArray, ArrSlice[CALL](arguments, 1));
650
+ }
670
651
 
671
652
  /*#__NO_SIDE_EFFECTS__*/
672
653
  function polyArrIncludes(theArray, searchElement, fromIndex) {
@@ -705,6 +686,7 @@ function objSetPrototypeOf(obj, proto) {
705
686
  return fn(obj, proto);
706
687
  }
707
688
 
689
+ /*#__NO_SIDE_EFFECTS__*/
708
690
  function _createCustomError(name, d, b) {
709
691
  safe(objDefine, [d, NAME, { v: name, c: true, e: false }]);
710
692
  d = objSetPrototypeOf(d, b);
@@ -728,7 +710,7 @@ function createCustomError(name, constructCb, errorBase) {
728
710
  var theArgs = arguments;
729
711
  try {
730
712
  safe(_setName, [theBaseClass, name]);
731
- var _self = fnApply(theBaseClass, _this, ArrProto[SLICE][CALL](theArgs)) || _this;
713
+ var _self = fnApply(theBaseClass, _this, ArrSlice[CALL](theArgs)) || _this;
732
714
  if (_self !== _this) {
733
715
  var orgProto = objGetPrototypeOf(_this);
734
716
  if (orgProto !== objGetPrototypeOf(_self)) {
@@ -803,16 +785,18 @@ function isPlainObject(value) {
803
785
  return result;
804
786
  }
805
787
 
806
- var _defaultDeepCopyHandler = function (details) {
788
+ /*#__NO_SIDE_EFFECTS__*/
789
+ function _defaultDeepCopyHandler(details) {
807
790
  details.value && plainObjDeepCopyHandler(details);
808
791
  return true;
809
- };
792
+ }
810
793
  var defaultDeepCopyHandlers = [
811
794
  arrayDeepCopyHandler,
812
795
  plainObjDeepCopyHandler,
813
796
  functionDeepCopyHandler,
814
797
  dateDeepCopyHandler
815
798
  ];
799
+ /*#__NO_SIDE_EFFECTS__*/
816
800
  function _getSetVisited(visitMap, source, newPath, cb) {
817
801
  var theEntry;
818
802
  arrForEach(visitMap, function (entry) {
@@ -947,7 +931,7 @@ function _doExtend(target, theArgs) {
947
931
  return target;
948
932
  }
949
933
  function deepExtend(target, obj1, obj2, obj3, obj4, obj5, obj6) {
950
- return _doExtend(objDeepCopy(target) || {}, ArrProto[SLICE][CALL](arguments));
934
+ return _doExtend(objDeepCopy(target) || {}, ArrSlice[CALL](arguments));
951
935
  }
952
936
 
953
937
  var getLength = ( /*#__PURE__*/_unwrapProp(LENGTH));
@@ -979,7 +963,7 @@ function polyStrEndsWith(value, searchString, length) {
979
963
  return strSubstring(value, end - searchValue[LENGTH], end) === searchValue;
980
964
  }
981
965
 
982
- var strIndexOf = ( /*#__PURE__*/_unwrapFunction(INDEX_OF, StrProto));
966
+ var strIndexOf = ( /*#__PURE__*/_unwrapFunction("indexOf", StrProto));
983
967
 
984
968
  var strStartsWith = ( /*#__PURE__*/_unwrapFunctionWithPoly("startsWith", StrProto, polyStrStartsWith));
985
969
  /*#__NO_SIDE_EFFECTS__*/
@@ -993,55 +977,51 @@ function polyStrStartsWith(value, searchString, position) {
993
977
  }
994
978
 
995
979
  var REF = "ref";
996
- var UNREF = "un" + REF;
980
+ var UNREF = "unref";
997
981
  var HAS_REF = "hasRef";
998
982
  var ENABLED = "enabled";
983
+ /*#__NO_SIDE_EFFECTS__*/
999
984
  function _createTimerHandler(startTimer, refreshFn, cancelFn) {
1000
- var _a;
1001
985
  var ref = true;
1002
986
  var timerId = startTimer ? refreshFn(NULL_VALUE) : NULL_VALUE;
1003
987
  var theTimerHandler;
1004
- var _unref = function () {
988
+ function _unref() {
1005
989
  ref = false;
1006
990
  timerId && timerId[UNREF] && timerId[UNREF]();
1007
991
  return theTimerHandler;
1008
- };
1009
- var _ref = function () {
1010
- ref = true;
1011
- timerId && timerId[REF] && timerId[REF]();
992
+ }
993
+ function _cancel() {
994
+ timerId && cancelFn(timerId);
995
+ timerId = NULL_VALUE;
996
+ }
997
+ function _refresh() {
998
+ timerId = refreshFn(timerId);
999
+ if (!ref) {
1000
+ _unref();
1001
+ }
1012
1002
  return theTimerHandler;
1003
+ }
1004
+ function _setEnabled(value) {
1005
+ !value && timerId && _cancel();
1006
+ value && !timerId && _refresh();
1007
+ }
1008
+ theTimerHandler = {
1009
+ cancel: _cancel,
1010
+ refresh: _refresh
1013
1011
  };
1014
- var _hasRef = function () {
1012
+ theTimerHandler[HAS_REF] = function () {
1015
1013
  if (timerId && timerId[HAS_REF]) {
1016
1014
  return timerId[HAS_REF]();
1017
1015
  }
1018
1016
  return ref;
1019
1017
  };
1020
- var _refresh = function () {
1021
- timerId = refreshFn(timerId);
1022
- if (!ref) {
1023
- _unref();
1024
- }
1018
+ theTimerHandler[REF] = function () {
1019
+ ref = true;
1020
+ timerId && timerId[REF] && timerId[REF]();
1025
1021
  return theTimerHandler;
1026
1022
  };
1027
- var _cancel = function () {
1028
- timerId && cancelFn(timerId);
1029
- timerId = NULL_VALUE;
1030
- };
1031
- var _setEnabled = function (value) {
1032
- !value && timerId && _cancel();
1033
- value && !timerId && _refresh();
1034
- };
1035
- theTimerHandler = (_a = {
1036
- cancel: _cancel,
1037
- refresh: _refresh
1038
- },
1039
- _a[HAS_REF] = _hasRef,
1040
- _a[REF] = _ref,
1041
- _a[UNREF] = _unref,
1042
- _a[ENABLED] = false,
1043
- _a);
1044
- objDefineProp(theTimerHandler, ENABLED, {
1023
+ theTimerHandler[UNREF] = _unref;
1024
+ theTimerHandler = objDefineProp(theTimerHandler, ENABLED, {
1045
1025
  get: function () { return !!timerId; },
1046
1026
  set: _setEnabled
1047
1027
  });
@@ -1053,7 +1033,7 @@ function _createTimerHandler(startTimer, refreshFn, cancelFn) {
1053
1033
  };
1054
1034
  }
1055
1035
 
1056
- function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
1036
+ function _createTimeoutWith(startTimer, overrideFn, theArgs) {
1057
1037
  var isArr = isArray(overrideFn);
1058
1038
  var len = isArr ? overrideFn.length : 0;
1059
1039
  var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;
@@ -1061,7 +1041,7 @@ function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
1061
1041
  var timerFn = theArgs[0];
1062
1042
  theArgs[0] = function () {
1063
1043
  handler.dn();
1064
- fnApply(timerFn, self, ArrProto[SLICE][CALL](arguments));
1044
+ fnApply(timerFn, UNDEF_VALUE, ArrSlice[CALL](arguments));
1065
1045
  };
1066
1046
  var handler = _createTimerHandler(startTimer, function (timerId) {
1067
1047
  if (timerId) {
@@ -1069,19 +1049,19 @@ function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
1069
1049
  timerId.refresh();
1070
1050
  return timerId;
1071
1051
  }
1072
- fnApply(clearFn, self, [timerId]);
1052
+ fnApply(clearFn, UNDEF_VALUE, [timerId]);
1073
1053
  }
1074
- return fnApply(setFn, self, theArgs);
1054
+ return fnApply(setFn, UNDEF_VALUE, theArgs);
1075
1055
  }, function (timerId) {
1076
- fnApply(clearFn, self, [timerId]);
1056
+ fnApply(clearFn, UNDEF_VALUE, [timerId]);
1077
1057
  });
1078
1058
  return handler.h;
1079
1059
  }
1080
1060
  function scheduleTimeout(callback, timeout) {
1081
- return _createTimeoutWith(this, true, UNDEF_VALUE, ArrProto[SLICE][CALL](arguments));
1061
+ return _createTimeoutWith(true, UNDEF_VALUE, ArrSlice[CALL](arguments));
1082
1062
  }
1083
1063
  function createTimeout(callback, timeout) {
1084
- return _createTimeoutWith(this, false, UNDEF_VALUE, ArrProto[SLICE][CALL](arguments));
1064
+ return _createTimeoutWith(false, UNDEF_VALUE, ArrSlice[CALL](arguments));
1085
1065
  }
1086
1066
 
1087
1067
  var strHasOwnProperty = "hasOwnProperty";
@@ -1396,16 +1376,16 @@ var _DYN_HDLR = "hdlr";
1396
1376
  var _DYN_CANCEL = "cancel";
1397
1377
  var _DYN_INITIALIZE$1 = "initialize";
1398
1378
  var _DYN_IDENTIFIER = "identifier";
1379
+ var _DYN_REMOVE_NOTIFICATION_0 = "removeNotificationListener";
1380
+ var _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener";
1399
1381
  var _DYN_IS_INITIALIZED = "isInitialized";
1382
+ var _DYN_GET_NOTIFY_MGR = "getNotifyMgr";
1400
1383
  var _DYN_GET_PLUGIN = "getPlugin";
1401
1384
  var _DYN_POLL_INTERNAL_LOGS$1 = "pollInternalLogs";
1402
1385
  var _DYN_NAME = "name";
1403
1386
  var _DYN_TIME = "time";
1404
1387
  var _DYN_PROCESS_NEXT = "processNext";
1405
- var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
1406
- var _DYN_GET_NOTIFY_MGR = "getNotifyMgr";
1407
- var _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener";
1408
- var _DYN_REMOVE_NOTIFICATION_2 = "removeNotificationListener";
1388
+ var _DYN_GET_PROCESS_TEL_CONT2 = "getProcessTelContext";
1409
1389
  var _DYN_ENABLED = "enabled";
1410
1390
  var _DYN_STOP_POLLING_INTERNA3 = "stopPollingInternalLogs";
1411
1391
  var _DYN_UNLOAD = "unload";
@@ -1431,7 +1411,6 @@ var _DYN_LOG_INTERNAL_MESSAGE = "logInternalMessage";
1431
1411
  var _DYN_TYPE = "type";
1432
1412
  var _DYN_HANDLER = "handler";
1433
1413
  var _DYN_STATUS = "status";
1434
- var _DYN_ITEMS_RECEIVED = "itemsReceived";
1435
1414
  var _DYN_GET_RESPONSE_HEADER = "getResponseHeader";
1436
1415
  var _DYN_GET_ALL_RESPONSE_HEA5 = "getAllResponseHeaders";
1437
1416
  var _DYN_IS_CHILD_EVT = "isChildEvt";
@@ -1439,6 +1418,7 @@ var _DYN_DATA = "data";
1439
1418
  var _DYN_GET_CTX = "getCtx";
1440
1419
  var _DYN_SET_CTX = "setCtx";
1441
1420
  var _DYN_COMPLETE = "complete";
1421
+ var _DYN_ITEMS_RECEIVED = "itemsReceived";
1442
1422
  var _DYN_URL_STRING = "urlString";
1443
1423
  var _DYN_SEND_POST = "sendPOST";
1444
1424
  var _DYN_HEADERS = "headers";
@@ -1816,105 +1796,305 @@ var STR_DOMAIN = "domain";
1816
1796
  var STR_PATH = "path";
1817
1797
  var STR_NOT_DYNAMIC_ERROR = "Not dynamic - ";
1818
1798
 
1819
- var listenerFuncs = [STR_EVENTS_SENT, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_PERF_EVENT];
1820
- var _aiNamespace = null;
1821
- var _debugListener;
1822
- function _listenerProxyFunc(name, config) {
1823
- return function () {
1824
- var args = arguments;
1825
- var dbgExt = getDebugExt(config);
1826
- if (dbgExt) {
1827
- var listener = dbgExt.listener;
1828
- if (listener && listener[name]) {
1829
- listener[name][_DYN_APPLY ](listener, args);
1830
- }
1831
- }
1832
- };
1799
+ var rCamelCase = /-([a-z])/g;
1800
+ var rNormalizeInvalid = /([^\w\d_$])/g;
1801
+ var rLeadingNumeric = /^(\d+[\w\d_$])/;
1802
+ function isNotNullOrUndefined(value) {
1803
+ return !isNullOrUndefined(value);
1833
1804
  }
1834
- function _getExtensionNamespace() {
1835
- var target = getInst("Microsoft");
1836
- if (target) {
1837
- _aiNamespace = target["ApplicationInsights"];
1805
+ function normalizeJsName(name) {
1806
+ var value = name;
1807
+ if (value && isString(value)) {
1808
+ value = value[_DYN_REPLACE ](rCamelCase, function (_all, letter) {
1809
+ return letter.toUpperCase();
1810
+ });
1811
+ value = value[_DYN_REPLACE ](rNormalizeInvalid, "_");
1812
+ value = value[_DYN_REPLACE ](rLeadingNumeric, function (_all, match) {
1813
+ return "_" + match;
1814
+ });
1838
1815
  }
1839
- return _aiNamespace;
1816
+ return value;
1840
1817
  }
1841
- function getDebugExt(config) {
1842
- var ns = _aiNamespace;
1843
- if (!ns && config.disableDbgExt !== true) {
1844
- ns = _aiNamespace || _getExtensionNamespace();
1818
+ function strContains(value, search) {
1819
+ if (value && search) {
1820
+ return strIndexOf(value, search) !== -1;
1845
1821
  }
1846
- return ns ? ns["ChromeDbgExt"] : null;
1822
+ return false;
1847
1823
  }
1848
- function getDebugListener(config) {
1849
- if (!_debugListener) {
1850
- _debugListener = {};
1851
- for (var lp = 0; lp < listenerFuncs[_DYN_LENGTH$1 ]; lp++) {
1852
- _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);
1824
+ function toISOString(date) {
1825
+ return date && date.toISOString() || "";
1826
+ }
1827
+ function getExceptionName(object) {
1828
+ if (isError(object)) {
1829
+ return object[_DYN_NAME ];
1830
+ }
1831
+ return STR_EMPTY$2;
1832
+ }
1833
+ function setValue(target, field, value, valChk, srcChk) {
1834
+ var theValue = value;
1835
+ if (target) {
1836
+ theValue = target[field];
1837
+ if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
1838
+ theValue = value;
1839
+ target[field] = theValue;
1853
1840
  }
1854
1841
  }
1855
- return _debugListener;
1842
+ return theValue;
1856
1843
  }
1857
-
1858
- var strDocumentMode = "documentMode";
1859
- var strLocation = "location";
1860
- var strConsole = "console";
1861
- var strJSON = "JSON";
1862
- var strCrypto = "crypto";
1863
- var strMsCrypto = "msCrypto";
1864
- var strReactNative = "ReactNative";
1865
- var strMsie = "msie";
1866
- var strTrident = "trident/";
1867
- var strXMLHttpRequest = "XMLHttpRequest";
1868
- var _isTrident = null;
1869
- var _navUserAgentCheck = null;
1870
- var _enableMocks = false;
1871
- var _useXDomainRequest = null;
1872
- var _beaconsSupported = null;
1873
- function _hasProperty(theClass, property) {
1874
- var supported = false;
1875
- if (theClass) {
1876
- try {
1877
- supported = property in theClass;
1878
- if (!supported) {
1879
- var proto = theClass[strShimPrototype];
1880
- if (proto) {
1881
- supported = property in proto;
1882
- }
1883
- }
1844
+ function getSetValue(target, field, defValue) {
1845
+ var theValue;
1846
+ if (target) {
1847
+ theValue = target[field];
1848
+ if (!theValue && isNullOrUndefined(theValue)) {
1849
+ theValue = !isUndefined(defValue) ? defValue : {};
1850
+ target[field] = theValue;
1884
1851
  }
1885
- catch (e) {
1852
+ }
1853
+ else {
1854
+ theValue = !isUndefined(defValue) ? defValue : {};
1855
+ }
1856
+ return theValue;
1857
+ }
1858
+ function _createProxyFunction(source, funcName) {
1859
+ var srcFunc = null;
1860
+ var src = null;
1861
+ if (isFunction(source)) {
1862
+ srcFunc = source;
1863
+ }
1864
+ else {
1865
+ src = source;
1866
+ }
1867
+ return function () {
1868
+ var originalArguments = arguments;
1869
+ if (srcFunc) {
1870
+ src = srcFunc();
1886
1871
  }
1887
- if (!supported) {
1888
- try {
1889
- var tmp = new theClass();
1890
- supported = !isUndefined(tmp[property]);
1891
- }
1892
- catch (e) {
1872
+ if (src) {
1873
+ return src[funcName][_DYN_APPLY ](src, originalArguments);
1874
+ }
1875
+ };
1876
+ }
1877
+ function proxyAssign(target, source, chkSet) {
1878
+ if (target && source && isObject(target) && isObject(source)) {
1879
+ var _loop_1 = function (field) {
1880
+ if (isString(field)) {
1881
+ var value = source[field];
1882
+ if (isFunction(value)) {
1883
+ if (!chkSet || chkSet(field, true, source, target)) {
1884
+ target[field] = _createProxyFunction(source, field);
1885
+ }
1886
+ }
1887
+ else if (!chkSet || chkSet(field, false, source, target)) {
1888
+ if (objHasOwn(target, field)) {
1889
+ delete target[field];
1890
+ }
1891
+ objDefine(target, field, {
1892
+ g: function () {
1893
+ return source[field];
1894
+ },
1895
+ s: function (theValue) {
1896
+ source[field] = theValue;
1897
+ }
1898
+ });
1899
+ }
1893
1900
  }
1901
+ };
1902
+ for (var field in source) {
1903
+ _loop_1(field);
1894
1904
  }
1895
1905
  }
1896
- return supported;
1897
- }
1898
- function setEnableEnvMocks(enabled) {
1899
- _enableMocks = enabled;
1906
+ return target;
1900
1907
  }
1901
- function getLocation(checkForMock) {
1902
- if (checkForMock && _enableMocks) {
1903
- var mockLocation = getInst("__mockLocation");
1904
- if (mockLocation) {
1905
- return mockLocation;
1908
+ function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
1909
+ if (target && name && source) {
1910
+ if (overwriteTarget !== false || isUndefined(target[name])) {
1911
+ target[name] = _createProxyFunction(source, theFunc);
1906
1912
  }
1907
1913
  }
1908
- if (typeof location === strShimObject && location) {
1909
- return location;
1914
+ }
1915
+ function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
1916
+ if (target && source && isObject(target) && isArray(functionsToProxy)) {
1917
+ arrForEach(functionsToProxy, function (theFuncName) {
1918
+ if (isString(theFuncName)) {
1919
+ proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
1920
+ }
1921
+ });
1910
1922
  }
1911
- return getInst(strLocation);
1923
+ return target;
1912
1924
  }
1913
- function getConsole() {
1914
- if (typeof console !== strShimUndefined) {
1915
- return console;
1925
+ function optimizeObject(theObject) {
1926
+ if (theObject && objAssign) {
1927
+ theObject = ObjClass$1(objAssign({}, theObject));
1916
1928
  }
1917
- return getInst(strConsole);
1929
+ return theObject;
1930
+ }
1931
+ function getResponseText(xhr) {
1932
+ try {
1933
+ return xhr.responseText;
1934
+ }
1935
+ catch (e) {
1936
+ }
1937
+ return null;
1938
+ }
1939
+ function formatErrorMessageXdr(xdr, message) {
1940
+ if (xdr) {
1941
+ return "XDomainRequest,Response:" + getResponseText(xdr) || "";
1942
+ }
1943
+ return message;
1944
+ }
1945
+ function formatErrorMessageXhr(xhr, message) {
1946
+ if (xhr) {
1947
+ return "XMLHttpRequest,Status:" + xhr[_DYN_STATUS ] + ",Response:" + getResponseText(xhr) || xhr.response || "";
1948
+ }
1949
+ return message;
1950
+ }
1951
+ function prependTransports(theTransports, newTransports) {
1952
+ if (newTransports) {
1953
+ if (isNumber(newTransports)) {
1954
+ theTransports = [newTransports].concat(theTransports);
1955
+ }
1956
+ else if (isArray(newTransports)) {
1957
+ theTransports = newTransports.concat(theTransports);
1958
+ }
1959
+ }
1960
+ return theTransports;
1961
+ }
1962
+ var strDisabledPropertyName$1 = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
1963
+ var strWithCredentials$1 = "withCredentials";
1964
+ var strTimeout$1 = "timeout";
1965
+ function openXhr$1(method, urlString, withCredentials, disabled, isSync, timeout) {
1966
+ if (disabled === void 0) { disabled = false; }
1967
+ if (isSync === void 0) { isSync = false; }
1968
+ function _wrapSetXhrProp(xhr, prop, value) {
1969
+ try {
1970
+ xhr[prop] = value;
1971
+ }
1972
+ catch (e) {
1973
+ }
1974
+ }
1975
+ var xhr = new XMLHttpRequest();
1976
+ if (disabled) {
1977
+ _wrapSetXhrProp(xhr, strDisabledPropertyName$1, disabled);
1978
+ }
1979
+ if (withCredentials) {
1980
+ _wrapSetXhrProp(xhr, strWithCredentials$1, withCredentials);
1981
+ }
1982
+ xhr.open(method, urlString, !isSync);
1983
+ if (withCredentials) {
1984
+ _wrapSetXhrProp(xhr, strWithCredentials$1, withCredentials);
1985
+ }
1986
+ if (!isSync && timeout) {
1987
+ _wrapSetXhrProp(xhr, strTimeout$1, timeout);
1988
+ }
1989
+ return xhr;
1990
+ }
1991
+ function convertAllHeadersToMap(headersString) {
1992
+ var headers = {};
1993
+ if (isString(headersString)) {
1994
+ var headersArray = strTrim(headersString)[_DYN_SPLIT ](/[\r\n]+/);
1995
+ arrForEach(headersArray, function (headerEntry) {
1996
+ if (headerEntry) {
1997
+ var idx = headerEntry.indexOf(": ");
1998
+ if (idx !== -1) {
1999
+ var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE ]();
2000
+ var value = strTrim(headerEntry.substring(idx + 1));
2001
+ headers[header] = value;
2002
+ }
2003
+ else {
2004
+ headers[strTrim(headerEntry)] = 1;
2005
+ }
2006
+ }
2007
+ });
2008
+ }
2009
+ return headers;
2010
+ }
2011
+ function _appendHeader(theHeaders, xhr, name) {
2012
+ if (!theHeaders[name] && xhr && xhr[_DYN_GET_RESPONSE_HEADER ]) {
2013
+ var value = xhr[_DYN_GET_RESPONSE_HEADER ](name);
2014
+ if (value) {
2015
+ theHeaders[name] = strTrim(value);
2016
+ }
2017
+ }
2018
+ return theHeaders;
2019
+ }
2020
+ var STR_KILL_DURATION_HEADER = "kill-duration";
2021
+ var STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds";
2022
+ var STR_TIME_DELTA_HEADER = "time-delta-millis";
2023
+ function _getAllResponseHeaders(xhr, isOneDs) {
2024
+ var theHeaders = {};
2025
+ if (!xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]) {
2026
+ if (!!isOneDs) {
2027
+ theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);
2028
+ theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);
2029
+ theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);
2030
+ }
2031
+ }
2032
+ else {
2033
+ theHeaders = convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]());
2034
+ }
2035
+ return theHeaders;
2036
+ }
2037
+
2038
+ var strDocumentMode = "documentMode";
2039
+ var strLocation = "location";
2040
+ var strConsole = "console";
2041
+ var strJSON = "JSON";
2042
+ var strCrypto = "crypto";
2043
+ var strMsCrypto = "msCrypto";
2044
+ var strReactNative = "ReactNative";
2045
+ var strMsie = "msie";
2046
+ var strTrident = "trident/";
2047
+ var strXMLHttpRequest = "XMLHttpRequest";
2048
+ var _isTrident = null;
2049
+ var _navUserAgentCheck = null;
2050
+ var _enableMocks = false;
2051
+ var _useXDomainRequest = null;
2052
+ var _beaconsSupported = null;
2053
+ function _hasProperty(theClass, property) {
2054
+ var supported = false;
2055
+ if (theClass) {
2056
+ try {
2057
+ supported = property in theClass;
2058
+ if (!supported) {
2059
+ var proto = theClass[strShimPrototype];
2060
+ if (proto) {
2061
+ supported = property in proto;
2062
+ }
2063
+ }
2064
+ }
2065
+ catch (e) {
2066
+ }
2067
+ if (!supported) {
2068
+ try {
2069
+ var tmp = new theClass();
2070
+ supported = !isUndefined(tmp[property]);
2071
+ }
2072
+ catch (e) {
2073
+ }
2074
+ }
2075
+ }
2076
+ return supported;
2077
+ }
2078
+ function setEnableEnvMocks(enabled) {
2079
+ _enableMocks = enabled;
2080
+ }
2081
+ function getLocation(checkForMock) {
2082
+ if (checkForMock && _enableMocks) {
2083
+ var mockLocation = getInst("__mockLocation");
2084
+ if (mockLocation) {
2085
+ return mockLocation;
2086
+ }
2087
+ }
2088
+ if (typeof location === strShimObject && location) {
2089
+ return location;
2090
+ }
2091
+ return getInst(strLocation);
2092
+ }
2093
+ function getConsole() {
2094
+ if (typeof console !== strShimUndefined) {
2095
+ return console;
2096
+ }
2097
+ return getInst(strConsole);
1918
2098
  }
1919
2099
  function hasJSON() {
1920
2100
  return Boolean((typeof JSON === strShimObject && JSON) || getInst(strJSON) !== null);
@@ -2034,478 +2214,34 @@ function findNamedServerTiming(name) {
2034
2214
  return value;
2035
2215
  }
2036
2216
 
2037
- var _a$4;
2038
- var STR_WARN_TO_CONSOLE = "warnToConsole";
2039
- var AiNonUserActionablePrefix = "AI (Internal): ";
2040
- var AiUserActionablePrefix = "AI: ";
2041
- var AIInternalMessagePrefix = "AITR_";
2042
- var defaultValues$2 = {
2043
- loggingLevelConsole: 0,
2044
- loggingLevelTelemetry: 1,
2045
- maxMessageLimit: 25,
2046
- enableDebug: false
2047
- };
2048
- var _logFuncs = (_a$4 = {},
2049
- _a$4[0 ] = null,
2050
- _a$4[1 ] = "errorToConsole",
2051
- _a$4[2 ] = STR_WARN_TO_CONSOLE,
2052
- _a$4[3 ] = "debugToConsole",
2053
- _a$4);
2054
- function _sanitizeDiagnosticText(text) {
2055
- if (text) {
2056
- return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY$2) + "\"";
2217
+ var UInt32Mask = 0x100000000;
2218
+ var MaxUInt32 = 0xffffffff;
2219
+ var SEED1 = 123456789;
2220
+ var SEED2 = 987654321;
2221
+ var _mwcSeeded = false;
2222
+ var _mwcW = SEED1;
2223
+ var _mwcZ = SEED2;
2224
+ function _mwcSeed(seedValue) {
2225
+ if (seedValue < 0) {
2226
+ seedValue >>>= 0;
2057
2227
  }
2058
- return STR_EMPTY$2;
2228
+ _mwcW = (SEED1 + seedValue) & MaxUInt32;
2229
+ _mwcZ = (SEED2 - seedValue) & MaxUInt32;
2230
+ _mwcSeeded = true;
2059
2231
  }
2060
- function _logToConsole(func, message) {
2061
- var theConsole = getConsole();
2062
- if (!!theConsole) {
2063
- var logFunc = "log";
2064
- if (theConsole[func]) {
2065
- logFunc = func;
2066
- }
2067
- if (isFunction(theConsole[logFunc])) {
2068
- theConsole[logFunc](message);
2069
- }
2232
+ function _autoSeedMwc() {
2233
+ try {
2234
+ var now = utcNow() & 0x7fffffff;
2235
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
2236
+ }
2237
+ catch (e) {
2070
2238
  }
2071
2239
  }
2072
- var _InternalLogMessage = /** @class */ (function () {
2073
- function _InternalLogMessage(msgId, msg, isUserAct, properties) {
2074
- if (isUserAct === void 0) { isUserAct = false; }
2075
- var _self = this;
2076
- _self[_DYN_MESSAGE_ID ] = msgId;
2077
- _self[_DYN_MESSAGE ] =
2078
- (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
2079
- msgId;
2080
- var strProps = STR_EMPTY$2;
2081
- if (hasJSON()) {
2082
- strProps = getJSON().stringify(properties);
2083
- }
2084
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$2) +
2085
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$2);
2086
- _self[_DYN_MESSAGE ] += diagnosticText;
2240
+ function randomValue(maxValue) {
2241
+ if (maxValue > 0) {
2242
+ return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
2087
2243
  }
2088
- _InternalLogMessage.dataType = "MessageData";
2089
- return _InternalLogMessage;
2090
- }());
2091
- function safeGetLogger(core, config) {
2092
- return (core || {})[_DYN_LOGGER$1 ] || new DiagnosticLogger(config);
2093
- }
2094
- var DiagnosticLogger = /** @class */ (function () {
2095
- function DiagnosticLogger(config) {
2096
- this.identifier = "DiagnosticLogger";
2097
- this.queue = [];
2098
- var _messageCount = 0;
2099
- var _messageLogged = {};
2100
- var _loggingLevelConsole;
2101
- var _loggingLevelTelemetry;
2102
- var _maxInternalMessageLimit;
2103
- var _enableDebug;
2104
- var _unloadHandler;
2105
- dynamicProto(DiagnosticLogger, this, function (_self) {
2106
- _unloadHandler = _setDefaultsFromConfig(config || {});
2107
- _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
2108
- _self[_DYN_THROW_INTERNAL ] = function (severity, msgId, msg, properties, isUserAct) {
2109
- if (isUserAct === void 0) { isUserAct = false; }
2110
- var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
2111
- if (_enableDebug) {
2112
- throw dumpObj(message);
2113
- }
2114
- else {
2115
- var logFunc = _logFuncs[severity] || STR_WARN_TO_CONSOLE;
2116
- if (!isUndefined(message[_DYN_MESSAGE ])) {
2117
- if (isUserAct) {
2118
- var messageKey = +message[_DYN_MESSAGE_ID ];
2119
- if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {
2120
- _self[logFunc](message[_DYN_MESSAGE ]);
2121
- _messageLogged[messageKey] = true;
2122
- }
2123
- }
2124
- else {
2125
- if (_loggingLevelConsole >= severity) {
2126
- _self[logFunc](message[_DYN_MESSAGE ]);
2127
- }
2128
- }
2129
- _logInternalMessage(severity, message);
2130
- }
2131
- else {
2132
- _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
2133
- }
2134
- }
2135
- };
2136
- _self.debugToConsole = function (message) {
2137
- _logToConsole("debug", message);
2138
- _debugExtMsg("warning", message);
2139
- };
2140
- _self[_DYN_WARN_TO_CONSOLE ] = function (message) {
2141
- _logToConsole("warn", message);
2142
- _debugExtMsg("warning", message);
2143
- };
2144
- _self.errorToConsole = function (message) {
2145
- _logToConsole("error", message);
2146
- _debugExtMsg("error", message);
2147
- };
2148
- _self.resetInternalMessageCount = function () {
2149
- _messageCount = 0;
2150
- _messageLogged = {};
2151
- };
2152
- _self[_DYN_LOG_INTERNAL_MESSAGE ] = _logInternalMessage;
2153
- _self[_DYN_UNLOAD ] = function (isAsync) {
2154
- _unloadHandler && _unloadHandler.rm();
2155
- _unloadHandler = null;
2156
- };
2157
- function _logInternalMessage(severity, message) {
2158
- if (_areInternalMessagesThrottled()) {
2159
- return;
2160
- }
2161
- var logMessage = true;
2162
- var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID ];
2163
- if (_messageLogged[messageKey]) {
2164
- logMessage = false;
2165
- }
2166
- else {
2167
- _messageLogged[messageKey] = true;
2168
- }
2169
- if (logMessage) {
2170
- if (severity <= _loggingLevelTelemetry) {
2171
- _self.queue[_DYN_PUSH ](message);
2172
- _messageCount++;
2173
- _debugExtMsg((severity === 1 ? "error" : "warn"), message);
2174
- }
2175
- if (_messageCount === _maxInternalMessageLimit) {
2176
- var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
2177
- var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
2178
- _self.queue[_DYN_PUSH ](throttleMessage);
2179
- if (severity === 1 ) {
2180
- _self.errorToConsole(throttleLimitMessage);
2181
- }
2182
- else {
2183
- _self[_DYN_WARN_TO_CONSOLE ](throttleLimitMessage);
2184
- }
2185
- }
2186
- }
2187
- }
2188
- function _setDefaultsFromConfig(config) {
2189
- return onConfigChange(createDynamicConfig(config, defaultValues$2, _self).cfg, function (details) {
2190
- var config = details.cfg;
2191
- _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 ];
2192
- _loggingLevelTelemetry = config.loggingLevelTelemetry;
2193
- _maxInternalMessageLimit = config.maxMessageLimit;
2194
- _enableDebug = config.enableDebug;
2195
- });
2196
- }
2197
- function _areInternalMessagesThrottled() {
2198
- return _messageCount >= _maxInternalMessageLimit;
2199
- }
2200
- function _debugExtMsg(name, data) {
2201
- var dbgExt = getDebugExt(config || {});
2202
- if (dbgExt && dbgExt[_DYN_DIAG_LOG ]) {
2203
- dbgExt[_DYN_DIAG_LOG ](name, data);
2204
- }
2205
- }
2206
- });
2207
- }
2208
- DiagnosticLogger.__ieDyn=1;
2209
- return DiagnosticLogger;
2210
- }());
2211
- function _getLogger(logger) {
2212
- return (logger || new DiagnosticLogger());
2213
- }
2214
- function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
2215
- if (isUserAct === void 0) { isUserAct = false; }
2216
- _getLogger(logger)[_DYN_THROW_INTERNAL ](severity, msgId, msg, properties, isUserAct);
2217
- }
2218
- function _warnToConsole(logger, message) {
2219
- _getLogger(logger)[_DYN_WARN_TO_CONSOLE ](message);
2220
- }
2221
- function _logInternalMessage(logger, severity, message) {
2222
- _getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE ](severity, message);
2223
- }
2224
-
2225
- var rCamelCase = /-([a-z])/g;
2226
- var rNormalizeInvalid = /([^\w\d_$])/g;
2227
- var rLeadingNumeric = /^(\d+[\w\d_$])/;
2228
- function isNotNullOrUndefined(value) {
2229
- return !isNullOrUndefined(value);
2230
- }
2231
- function normalizeJsName(name) {
2232
- var value = name;
2233
- if (value && isString(value)) {
2234
- value = value[_DYN_REPLACE ](rCamelCase, function (_all, letter) {
2235
- return letter.toUpperCase();
2236
- });
2237
- value = value[_DYN_REPLACE ](rNormalizeInvalid, "_");
2238
- value = value[_DYN_REPLACE ](rLeadingNumeric, function (_all, match) {
2239
- return "_" + match;
2240
- });
2241
- }
2242
- return value;
2243
- }
2244
- function strContains(value, search) {
2245
- if (value && search) {
2246
- return strIndexOf(value, search) !== -1;
2247
- }
2248
- return false;
2249
- }
2250
- function toISOString(date) {
2251
- return date && date.toISOString() || "";
2252
- }
2253
- function getExceptionName(object) {
2254
- if (isError(object)) {
2255
- return object[_DYN_NAME ];
2256
- }
2257
- return STR_EMPTY$2;
2258
- }
2259
- function setValue(target, field, value, valChk, srcChk) {
2260
- var theValue = value;
2261
- if (target) {
2262
- theValue = target[field];
2263
- if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
2264
- theValue = value;
2265
- target[field] = theValue;
2266
- }
2267
- }
2268
- return theValue;
2269
- }
2270
- function getSetValue(target, field, defValue) {
2271
- var theValue;
2272
- if (target) {
2273
- theValue = target[field];
2274
- if (!theValue && isNullOrUndefined(theValue)) {
2275
- theValue = !isUndefined(defValue) ? defValue : {};
2276
- target[field] = theValue;
2277
- }
2278
- }
2279
- else {
2280
- theValue = !isUndefined(defValue) ? defValue : {};
2281
- }
2282
- return theValue;
2283
- }
2284
- function _createProxyFunction(source, funcName) {
2285
- var srcFunc = null;
2286
- var src = null;
2287
- if (isFunction(source)) {
2288
- srcFunc = source;
2289
- }
2290
- else {
2291
- src = source;
2292
- }
2293
- return function () {
2294
- var originalArguments = arguments;
2295
- if (srcFunc) {
2296
- src = srcFunc();
2297
- }
2298
- if (src) {
2299
- return src[funcName][_DYN_APPLY ](src, originalArguments);
2300
- }
2301
- };
2302
- }
2303
- function proxyAssign(target, source, chkSet) {
2304
- if (target && source && isObject(target) && isObject(source)) {
2305
- var _loop_1 = function (field) {
2306
- if (isString(field)) {
2307
- var value = source[field];
2308
- if (isFunction(value)) {
2309
- if (!chkSet || chkSet(field, true, source, target)) {
2310
- target[field] = _createProxyFunction(source, field);
2311
- }
2312
- }
2313
- else if (!chkSet || chkSet(field, false, source, target)) {
2314
- if (objHasOwn(target, field)) {
2315
- delete target[field];
2316
- }
2317
- objDefine(target, field, {
2318
- g: function () {
2319
- return source[field];
2320
- },
2321
- s: function (theValue) {
2322
- source[field] = theValue;
2323
- }
2324
- });
2325
- }
2326
- }
2327
- };
2328
- for (var field in source) {
2329
- _loop_1(field);
2330
- }
2331
- }
2332
- return target;
2333
- }
2334
- function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
2335
- if (target && name && source) {
2336
- if (overwriteTarget !== false || isUndefined(target[name])) {
2337
- target[name] = _createProxyFunction(source, theFunc);
2338
- }
2339
- }
2340
- }
2341
- function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
2342
- if (target && source && isObject(target) && isArray(functionsToProxy)) {
2343
- arrForEach(functionsToProxy, function (theFuncName) {
2344
- if (isString(theFuncName)) {
2345
- proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
2346
- }
2347
- });
2348
- }
2349
- return target;
2350
- }
2351
- function optimizeObject(theObject) {
2352
- if (theObject && objAssign) {
2353
- theObject = ObjClass$1(objAssign({}, theObject));
2354
- }
2355
- return theObject;
2356
- }
2357
- function getResponseText(xhr) {
2358
- try {
2359
- return xhr.responseText;
2360
- }
2361
- catch (e) {
2362
- }
2363
- return null;
2364
- }
2365
- function formatErrorMessageXdr(xdr, message) {
2366
- if (xdr) {
2367
- return "XDomainRequest,Response:" + getResponseText(xdr) || "";
2368
- }
2369
- return message;
2370
- }
2371
- function formatErrorMessageXhr(xhr, message) {
2372
- if (xhr) {
2373
- return "XMLHttpRequest,Status:" + xhr[_DYN_STATUS ] + ",Response:" + getResponseText(xhr) || xhr.response || "";
2374
- }
2375
- return message;
2376
- }
2377
- function prependTransports(theTransports, newTransports) {
2378
- if (newTransports) {
2379
- if (isNumber(newTransports)) {
2380
- theTransports = [newTransports].concat(theTransports);
2381
- }
2382
- else if (isArray(newTransports)) {
2383
- theTransports = newTransports.concat(theTransports);
2384
- }
2385
- }
2386
- return theTransports;
2387
- }
2388
- function parseResponse(response, diagLog) {
2389
- try {
2390
- if (response && response !== "") {
2391
- var result = getJSON().parse(response);
2392
- if (result && result[_DYN_ITEMS_RECEIVED ] && result[_DYN_ITEMS_RECEIVED ] >= result.itemsAccepted &&
2393
- result.itemsReceived - result.itemsAccepted === result.errors[_DYN_LENGTH$1 ]) {
2394
- return result;
2395
- }
2396
- }
2397
- }
2398
- catch (e) {
2399
- _throwInternal(diagLog, 1 , 43 , "Cannot parse the response. " + getExceptionName(e), {
2400
- response: response
2401
- });
2402
- }
2403
- return null;
2404
- }
2405
- var strDisabledPropertyName$1 = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2406
- var strWithCredentials$1 = "withCredentials";
2407
- var strTimeout$1 = "timeout";
2408
- function openXhr$1(method, urlString, withCredentials, disabled, isSync, timeout) {
2409
- if (disabled === void 0) { disabled = false; }
2410
- if (isSync === void 0) { isSync = false; }
2411
- function _wrapSetXhrProp(xhr, prop, value) {
2412
- try {
2413
- xhr[prop] = value;
2414
- }
2415
- catch (e) {
2416
- }
2417
- }
2418
- var xhr = new XMLHttpRequest();
2419
- if (disabled) {
2420
- _wrapSetXhrProp(xhr, strDisabledPropertyName$1, disabled);
2421
- }
2422
- if (withCredentials) {
2423
- _wrapSetXhrProp(xhr, strWithCredentials$1, withCredentials);
2424
- }
2425
- xhr.open(method, urlString, !isSync);
2426
- if (withCredentials) {
2427
- _wrapSetXhrProp(xhr, strWithCredentials$1, withCredentials);
2428
- }
2429
- if (!isSync && timeout) {
2430
- _wrapSetXhrProp(xhr, strTimeout$1, timeout);
2431
- }
2432
- return xhr;
2433
- }
2434
- function convertAllHeadersToMap(headersString) {
2435
- var headers = {};
2436
- if (isString(headersString)) {
2437
- var headersArray = strTrim(headersString)[_DYN_SPLIT ](/[\r\n]+/);
2438
- arrForEach(headersArray, function (headerEntry) {
2439
- if (headerEntry) {
2440
- var idx = headerEntry.indexOf(": ");
2441
- if (idx !== -1) {
2442
- var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE ]();
2443
- var value = strTrim(headerEntry.substring(idx + 1));
2444
- headers[header] = value;
2445
- }
2446
- else {
2447
- headers[strTrim(headerEntry)] = 1;
2448
- }
2449
- }
2450
- });
2451
- }
2452
- return headers;
2453
- }
2454
- function _appendHeader(theHeaders, xhr, name) {
2455
- if (!theHeaders[name] && xhr && xhr[_DYN_GET_RESPONSE_HEADER ]) {
2456
- var value = xhr[_DYN_GET_RESPONSE_HEADER ](name);
2457
- if (value) {
2458
- theHeaders[name] = strTrim(value);
2459
- }
2460
- }
2461
- return theHeaders;
2462
- }
2463
- var STR_KILL_DURATION_HEADER = "kill-duration";
2464
- var STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds";
2465
- var STR_TIME_DELTA_HEADER = "time-delta-millis";
2466
- function _getAllResponseHeaders(xhr, isOneDs) {
2467
- var theHeaders = {};
2468
- if (!xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]) {
2469
- if (!!isOneDs) {
2470
- theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);
2471
- theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);
2472
- theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);
2473
- }
2474
- }
2475
- else {
2476
- theHeaders = convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]());
2477
- }
2478
- return theHeaders;
2479
- }
2480
-
2481
- var UInt32Mask = 0x100000000;
2482
- var MaxUInt32 = 0xffffffff;
2483
- var SEED1 = 123456789;
2484
- var SEED2 = 987654321;
2485
- var _mwcSeeded = false;
2486
- var _mwcW = SEED1;
2487
- var _mwcZ = SEED2;
2488
- function _mwcSeed(seedValue) {
2489
- if (seedValue < 0) {
2490
- seedValue >>>= 0;
2491
- }
2492
- _mwcW = (SEED1 + seedValue) & MaxUInt32;
2493
- _mwcZ = (SEED2 - seedValue) & MaxUInt32;
2494
- _mwcSeeded = true;
2495
- }
2496
- function _autoSeedMwc() {
2497
- try {
2498
- var now = utcNow() & 0x7fffffff;
2499
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
2500
- }
2501
- catch (e) {
2502
- }
2503
- }
2504
- function randomValue(maxValue) {
2505
- if (maxValue > 0) {
2506
- return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
2507
- }
2508
- return 0;
2244
+ return 0;
2509
2245
  }
2510
2246
  function random32(signed) {
2511
2247
  var value = 0;
@@ -2901,369 +2637,597 @@ function _createDynamicProperty(state, theConfig, name, value) {
2901
2637
  isObjectOrArray = false;
2902
2638
  }
2903
2639
  }
2904
- else if (value && value[CFG_HANDLER_LINK]) {
2905
- objForEachKey(value, function (key) {
2906
- var getter = _getOwnPropGetter(value, key);
2907
- if (getter) {
2908
- var valueState = getter[state.prop];
2909
- valueState && valueState.chng();
2910
- }
2911
- });
2640
+ else if (value && value[CFG_HANDLER_LINK]) {
2641
+ objForEachKey(value, function (key) {
2642
+ var getter = _getOwnPropGetter(value, key);
2643
+ if (getter) {
2644
+ var valueState = getter[state.prop];
2645
+ valueState && valueState.chng();
2646
+ }
2647
+ });
2648
+ }
2649
+ }
2650
+ if (newValue !== value) {
2651
+ var newIsObjectOrArray = newValue && _canMakeDynamic(_getProperty, state, newValue);
2652
+ if (!isReferenced && newIsObjectOrArray) {
2653
+ newValue = _makeDynamicObject(state, newValue, name, "Converting");
2654
+ }
2655
+ value = newValue;
2656
+ isObjectOrArray = newIsObjectOrArray;
2657
+ }
2658
+ state.add(detail);
2659
+ }
2660
+ }
2661
+ objDefine(theConfig, detail.n, { g: _getProperty, s: _setProperty });
2662
+ }
2663
+ function _setDynamicProperty(state, target, name, value) {
2664
+ if (target) {
2665
+ var getter = _getOwnPropGetter(target, name);
2666
+ var isDynamic = getter && !!getter[state.prop];
2667
+ if (!isDynamic) {
2668
+ _createDynamicProperty(state, target, name, value);
2669
+ }
2670
+ else {
2671
+ target[name] = value;
2672
+ }
2673
+ }
2674
+ return target;
2675
+ }
2676
+ function _setDynamicPropertyState(state, target, name, flags) {
2677
+ if (target) {
2678
+ var getter = _getOwnPropGetter(target, name);
2679
+ var isDynamic = getter && !!getter[state.prop];
2680
+ var inPlace = flags && flags[0 ];
2681
+ var rdOnly = flags && flags[1 ];
2682
+ var blkProp = flags && flags[2 ];
2683
+ if (!isDynamic) {
2684
+ if (blkProp) {
2685
+ try {
2686
+ blockDynamicConversion(target);
2687
+ }
2688
+ catch (e) {
2689
+ _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, "Blocking", e);
2690
+ }
2691
+ }
2692
+ try {
2693
+ _setDynamicProperty(state, target, name, target[name]);
2694
+ getter = _getOwnPropGetter(target, name);
2695
+ }
2696
+ catch (e) {
2697
+ _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, "State", e);
2698
+ }
2699
+ }
2700
+ if (inPlace) {
2701
+ getter[state.rf] = inPlace;
2702
+ }
2703
+ if (rdOnly) {
2704
+ getter[state.ro] = rdOnly;
2705
+ }
2706
+ if (blkProp) {
2707
+ getter[state.blkVal] = true;
2708
+ }
2709
+ }
2710
+ return target;
2711
+ }
2712
+ function _makeDynamicObject(state, target, name, desc) {
2713
+ try {
2714
+ objForEachKey(target, function (key, value) {
2715
+ _setDynamicProperty(state, target, key, value);
2716
+ });
2717
+ if (!target[CFG_HANDLER_LINK]) {
2718
+ objDefineProp(target, CFG_HANDLER_LINK, {
2719
+ get: function () {
2720
+ return state[_DYN_HDLR ];
2721
+ }
2722
+ });
2723
+ _patchArray(state, target, name);
2724
+ }
2725
+ }
2726
+ catch (e) {
2727
+ _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, desc, e);
2728
+ }
2729
+ return target;
2730
+ }
2731
+
2732
+ var symPrefix = "[[ai_";
2733
+ var symPostfix = "]]";
2734
+ function _createState(cfgHandler) {
2735
+ var _a;
2736
+ var dynamicPropertySymbol = newSymbol(symPrefix + "get" + cfgHandler.uid + symPostfix);
2737
+ var dynamicPropertyReadOnly = newSymbol(symPrefix + "ro" + cfgHandler.uid + symPostfix);
2738
+ var dynamicPropertyReferenced = newSymbol(symPrefix + "rf" + cfgHandler.uid + symPostfix);
2739
+ var dynamicPropertyBlockValue = newSymbol(symPrefix + "blkVal" + cfgHandler.uid + symPostfix);
2740
+ var dynamicPropertyDetail = newSymbol(symPrefix + "dtl" + cfgHandler.uid + symPostfix);
2741
+ var _waitingHandlers = null;
2742
+ var _watcherTimer = null;
2743
+ var theState;
2744
+ function _useHandler(activeHandler, callback) {
2745
+ var prevWatcher = theState.act;
2746
+ try {
2747
+ theState.act = activeHandler;
2748
+ if (activeHandler && activeHandler[dynamicPropertyDetail]) {
2749
+ arrForEach(activeHandler[dynamicPropertyDetail], function (detail) {
2750
+ detail.clr(activeHandler);
2751
+ });
2752
+ activeHandler[dynamicPropertyDetail] = [];
2753
+ }
2754
+ callback({
2755
+ cfg: cfgHandler.cfg,
2756
+ set: cfgHandler.set.bind(cfgHandler),
2757
+ setDf: cfgHandler[_DYN_SET_DF ].bind(cfgHandler),
2758
+ ref: cfgHandler.ref.bind(cfgHandler),
2759
+ rdOnly: cfgHandler[_DYN_RD_ONLY ].bind(cfgHandler)
2760
+ });
2761
+ }
2762
+ catch (e) {
2763
+ var logger = cfgHandler[_DYN_LOGGER$1 ];
2764
+ if (logger) {
2765
+ logger[_DYN_THROW_INTERNAL ](1 , 107 , dumpObj(e));
2766
+ }
2767
+ throw e;
2768
+ }
2769
+ finally {
2770
+ theState.act = prevWatcher || null;
2771
+ }
2772
+ }
2773
+ function _notifyWatchers() {
2774
+ if (_waitingHandlers) {
2775
+ var notifyHandlers = _waitingHandlers;
2776
+ _waitingHandlers = null;
2777
+ _watcherTimer && _watcherTimer[_DYN_CANCEL ]();
2778
+ _watcherTimer = null;
2779
+ var watcherFailures_1 = [];
2780
+ arrForEach(notifyHandlers, function (handler) {
2781
+ if (handler) {
2782
+ if (handler[dynamicPropertyDetail]) {
2783
+ arrForEach(handler[dynamicPropertyDetail], function (detail) {
2784
+ detail.clr(handler);
2785
+ });
2786
+ handler[dynamicPropertyDetail] = null;
2787
+ }
2788
+ if (handler.fn) {
2789
+ try {
2790
+ _useHandler(handler, handler.fn);
2791
+ }
2792
+ catch (e) {
2793
+ watcherFailures_1[_DYN_PUSH ](e);
2794
+ }
2795
+ }
2796
+ }
2797
+ });
2798
+ if (_waitingHandlers) {
2799
+ try {
2800
+ _notifyWatchers();
2801
+ }
2802
+ catch (e) {
2803
+ watcherFailures_1[_DYN_PUSH ](e);
2912
2804
  }
2913
2805
  }
2914
- if (newValue !== value) {
2915
- var newIsObjectOrArray = newValue && _canMakeDynamic(_getProperty, state, newValue);
2916
- if (!isReferenced && newIsObjectOrArray) {
2917
- newValue = _makeDynamicObject(state, newValue, name, "Converting");
2806
+ if (watcherFailures_1[_DYN_LENGTH$1 ] > 0) {
2807
+ throwAggregationError("Watcher error(s): ", watcherFailures_1);
2808
+ }
2809
+ }
2810
+ }
2811
+ function _addWatcher(detail) {
2812
+ if (detail && detail.h[_DYN_LENGTH$1 ] > 0) {
2813
+ if (!_waitingHandlers) {
2814
+ _waitingHandlers = [];
2815
+ }
2816
+ if (!_watcherTimer) {
2817
+ _watcherTimer = scheduleTimeout(function () {
2818
+ _watcherTimer = null;
2819
+ _notifyWatchers();
2820
+ }, 0);
2821
+ }
2822
+ for (var idx = 0; idx < detail.h[_DYN_LENGTH$1 ]; idx++) {
2823
+ var handler = detail.h[idx];
2824
+ if (handler && arrIndexOf(_waitingHandlers, handler) === -1) {
2825
+ _waitingHandlers[_DYN_PUSH ](handler);
2918
2826
  }
2919
- value = newValue;
2920
- isObjectOrArray = newIsObjectOrArray;
2921
2827
  }
2922
- state.add(detail);
2923
2828
  }
2924
2829
  }
2925
- objDefine(theConfig, detail.n, { g: _getProperty, s: _setProperty });
2830
+ function _trackHandler(handler, detail) {
2831
+ if (handler) {
2832
+ var details = handler[dynamicPropertyDetail] = handler[dynamicPropertyDetail] || [];
2833
+ if (arrIndexOf(details, detail) === -1) {
2834
+ details[_DYN_PUSH ](detail);
2835
+ }
2836
+ }
2837
+ }
2838
+ theState = (_a = {
2839
+ prop: dynamicPropertySymbol,
2840
+ ro: dynamicPropertyReadOnly,
2841
+ rf: dynamicPropertyReferenced
2842
+ },
2843
+ _a[_DYN_BLK_VAL ] = dynamicPropertyBlockValue,
2844
+ _a[_DYN_HDLR ] = cfgHandler,
2845
+ _a.add = _addWatcher,
2846
+ _a[_DYN_NOTIFY ] = _notifyWatchers,
2847
+ _a.use = _useHandler,
2848
+ _a.trk = _trackHandler,
2849
+ _a);
2850
+ return theState;
2926
2851
  }
2927
- function _setDynamicProperty(state, target, name, value) {
2928
- if (target) {
2929
- var getter = _getOwnPropGetter(target, name);
2930
- var isDynamic = getter && !!getter[state.prop];
2931
- if (!isDynamic) {
2932
- _createDynamicProperty(state, target, name, value);
2852
+
2853
+ function _createAndUseHandler(state, configHandler) {
2854
+ var handler = {
2855
+ fn: configHandler,
2856
+ rm: function () {
2857
+ handler.fn = null;
2858
+ state = null;
2859
+ configHandler = null;
2933
2860
  }
2934
- else {
2935
- target[name] = value;
2861
+ };
2862
+ objDefine(handler, "toJSON", { v: function () { return "WatcherHandler" + (handler.fn ? "" : "[X]"); } });
2863
+ state.use(handler, configHandler);
2864
+ return handler;
2865
+ }
2866
+ function _createDynamicHandler(logger, target, inPlace) {
2867
+ var _a;
2868
+ var dynamicHandler = getDynamicConfigHandler(target);
2869
+ if (dynamicHandler) {
2870
+ return dynamicHandler;
2871
+ }
2872
+ var uid = createUniqueNamespace("dyncfg", true);
2873
+ var newTarget = (target && inPlace !== false) ? target : _cfgDeepCopy(target);
2874
+ var theState;
2875
+ function _notifyWatchers() {
2876
+ theState[_DYN_NOTIFY ]();
2877
+ }
2878
+ function _setValue(target, name, value) {
2879
+ try {
2880
+ target = _setDynamicProperty(theState, target, name, value);
2881
+ }
2882
+ catch (e) {
2883
+ _throwDynamicError(logger, name, "Setting value", e);
2936
2884
  }
2885
+ return target[name];
2937
2886
  }
2938
- return target;
2939
- }
2940
- function _setDynamicPropertyState(state, target, name, flags) {
2941
- if (target) {
2942
- var getter = _getOwnPropGetter(target, name);
2943
- var isDynamic = getter && !!getter[state.prop];
2944
- var inPlace = flags && flags[0 ];
2945
- var rdOnly = flags && flags[1 ];
2946
- var blkProp = flags && flags[2 ];
2947
- if (!isDynamic) {
2948
- if (blkProp) {
2949
- try {
2950
- blockDynamicConversion(target);
2951
- }
2952
- catch (e) {
2953
- _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, "Blocking", e);
2954
- }
2955
- }
2887
+ function _watch(configHandler) {
2888
+ return _createAndUseHandler(theState, configHandler);
2889
+ }
2890
+ function _block(configHandler, allowUpdate) {
2891
+ theState.use(null, function (details) {
2892
+ var prevUpd = theState.upd;
2956
2893
  try {
2957
- _setDynamicProperty(state, target, name, target[name]);
2958
- getter = _getOwnPropGetter(target, name);
2894
+ if (!isUndefined(allowUpdate)) {
2895
+ theState.upd = allowUpdate;
2896
+ }
2897
+ configHandler(details);
2959
2898
  }
2960
- catch (e) {
2961
- _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, "State", e);
2899
+ finally {
2900
+ theState.upd = prevUpd;
2962
2901
  }
2902
+ });
2903
+ }
2904
+ function _ref(target, name) {
2905
+ var _a;
2906
+ return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[0 ] = true, _a))[name];
2907
+ }
2908
+ function _rdOnly(target, name) {
2909
+ var _a;
2910
+ return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[1 ] = true, _a))[name];
2911
+ }
2912
+ function _blkPropValue(target, name) {
2913
+ var _a;
2914
+ return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[2 ] = true, _a))[name];
2915
+ }
2916
+ function _applyDefaults(theConfig, defaultValues) {
2917
+ if (defaultValues) {
2918
+ objForEachKey(defaultValues, function (name, value) {
2919
+ _applyDefaultValue(cfgHandler, theConfig, name, value);
2920
+ });
2963
2921
  }
2964
- if (inPlace) {
2965
- getter[state.rf] = inPlace;
2966
- }
2967
- if (rdOnly) {
2968
- getter[state.ro] = rdOnly;
2969
- }
2970
- if (blkProp) {
2971
- getter[state.blkVal] = true;
2922
+ return theConfig;
2923
+ }
2924
+ var cfgHandler = (_a = {
2925
+ uid: null,
2926
+ cfg: newTarget
2927
+ },
2928
+ _a[_DYN_LOGGER$1 ] = logger,
2929
+ _a[_DYN_NOTIFY ] = _notifyWatchers,
2930
+ _a.set = _setValue,
2931
+ _a[_DYN_SET_DF ] = _applyDefaults,
2932
+ _a[_DYN_WATCH ] = _watch,
2933
+ _a.ref = _ref,
2934
+ _a[_DYN_RD_ONLY ] = _rdOnly,
2935
+ _a[_DYN_BLK_VAL ] = _blkPropValue,
2936
+ _a._block = _block,
2937
+ _a);
2938
+ objDefine(cfgHandler, "uid", {
2939
+ c: false,
2940
+ e: false,
2941
+ w: false,
2942
+ v: uid
2943
+ });
2944
+ theState = _createState(cfgHandler);
2945
+ _makeDynamicObject(theState, newTarget, "config", "Creating");
2946
+ return cfgHandler;
2947
+ }
2948
+ function _logInvalidAccess(logger, message) {
2949
+ if (logger) {
2950
+ logger[_DYN_WARN_TO_CONSOLE ](message);
2951
+ logger[_DYN_THROW_INTERNAL ](2 , 108 , message);
2952
+ }
2953
+ else {
2954
+ throwInvalidAccess(message);
2955
+ }
2956
+ }
2957
+ function createDynamicConfig(config, defaultConfig, logger, inPlace) {
2958
+ var dynamicHandler = _createDynamicHandler(logger, config || {}, inPlace);
2959
+ if (defaultConfig) {
2960
+ dynamicHandler[_DYN_SET_DF ](dynamicHandler.cfg, defaultConfig);
2961
+ }
2962
+ return dynamicHandler;
2963
+ }
2964
+ function onConfigChange(config, configHandler, logger) {
2965
+ var handler = config[CFG_HANDLER_LINK] || config;
2966
+ if (handler.cfg && (handler.cfg === config || handler.cfg[CFG_HANDLER_LINK] === handler)) {
2967
+ return handler[_DYN_WATCH ](configHandler);
2968
+ }
2969
+ _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + dumpObj(config));
2970
+ return createDynamicConfig(config, null, logger)[_DYN_WATCH ](configHandler);
2971
+ }
2972
+
2973
+ function runTargetUnload(target, isAsync) {
2974
+ if (target && target[_DYN_UNLOAD ]) {
2975
+ return target[_DYN_UNLOAD ](isAsync);
2976
+ }
2977
+ }
2978
+ function doUnloadAll(targets, isAsync, done) {
2979
+ var result;
2980
+ if (!done) {
2981
+ result = createPromise(function (resolved) {
2982
+ done = resolved;
2983
+ });
2984
+ }
2985
+ if (targets && getLength(targets) > 0) {
2986
+ doAwaitResponse(runTargetUnload(targets[0], isAsync), function () {
2987
+ doUnloadAll(arrSlice(targets, 1), isAsync, done);
2988
+ });
2989
+ }
2990
+ else {
2991
+ done();
2992
+ }
2993
+ return result;
2994
+ }
2995
+
2996
+ var ChannelControllerPriority = 500;
2997
+ var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2998
+
2999
+ function cfgDfMerge(defaultValue) {
3000
+ return {
3001
+ mrg: true,
3002
+ v: defaultValue
3003
+ };
3004
+ }
3005
+
3006
+ var listenerFuncs = [STR_EVENTS_SENT, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_PERF_EVENT];
3007
+ var _aiNamespace = null;
3008
+ var _debugListener;
3009
+ function _listenerProxyFunc(name, config) {
3010
+ return function () {
3011
+ var args = arguments;
3012
+ var dbgExt = getDebugExt(config);
3013
+ if (dbgExt) {
3014
+ var listener = dbgExt.listener;
3015
+ if (listener && listener[name]) {
3016
+ listener[name][_DYN_APPLY ](listener, args);
3017
+ }
2972
3018
  }
3019
+ };
3020
+ }
3021
+ function _getExtensionNamespace() {
3022
+ var target = getInst("Microsoft");
3023
+ if (target) {
3024
+ _aiNamespace = target["ApplicationInsights"];
2973
3025
  }
2974
- return target;
3026
+ return _aiNamespace;
2975
3027
  }
2976
- function _makeDynamicObject(state, target, name, desc) {
2977
- try {
2978
- objForEachKey(target, function (key, value) {
2979
- _setDynamicProperty(state, target, key, value);
2980
- });
2981
- if (!target[CFG_HANDLER_LINK]) {
2982
- objDefineProp(target, CFG_HANDLER_LINK, {
2983
- get: function () {
2984
- return state[_DYN_HDLR ];
2985
- }
2986
- });
2987
- _patchArray(state, target, name);
2988
- }
3028
+ function getDebugExt(config) {
3029
+ var ns = _aiNamespace;
3030
+ if (!ns && config.disableDbgExt !== true) {
3031
+ ns = _aiNamespace || _getExtensionNamespace();
2989
3032
  }
2990
- catch (e) {
2991
- _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, desc, e);
3033
+ return ns ? ns["ChromeDbgExt"] : null;
3034
+ }
3035
+ function getDebugListener(config) {
3036
+ if (!_debugListener) {
3037
+ _debugListener = {};
3038
+ for (var lp = 0; lp < listenerFuncs[_DYN_LENGTH$1 ]; lp++) {
3039
+ _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);
3040
+ }
2992
3041
  }
2993
- return target;
3042
+ return _debugListener;
2994
3043
  }
2995
3044
 
2996
- var symPrefix = "[[ai_";
2997
- var symPostfix = "]]";
2998
- function _createState(cfgHandler) {
2999
- var _a;
3000
- var dynamicPropertySymbol = newSymbol(symPrefix + "get" + cfgHandler.uid + symPostfix);
3001
- var dynamicPropertyReadOnly = newSymbol(symPrefix + "ro" + cfgHandler.uid + symPostfix);
3002
- var dynamicPropertyReferenced = newSymbol(symPrefix + "rf" + cfgHandler.uid + symPostfix);
3003
- var dynamicPropertyBlockValue = newSymbol(symPrefix + "blkVal" + cfgHandler.uid + symPostfix);
3004
- var dynamicPropertyDetail = newSymbol(symPrefix + "dtl" + cfgHandler.uid + symPostfix);
3005
- var _waitingHandlers = null;
3006
- var _watcherTimer = null;
3007
- var theState;
3008
- function _useHandler(activeHandler, callback) {
3009
- var prevWatcher = theState.act;
3010
- try {
3011
- theState.act = activeHandler;
3012
- if (activeHandler && activeHandler[dynamicPropertyDetail]) {
3013
- arrForEach(activeHandler[dynamicPropertyDetail], function (detail) {
3014
- detail.clr(activeHandler);
3015
- });
3016
- activeHandler[dynamicPropertyDetail] = [];
3017
- }
3018
- callback({
3019
- cfg: cfgHandler.cfg,
3020
- set: cfgHandler.set.bind(cfgHandler),
3021
- setDf: cfgHandler[_DYN_SET_DF ].bind(cfgHandler),
3022
- ref: cfgHandler.ref.bind(cfgHandler),
3023
- rdOnly: cfgHandler[_DYN_RD_ONLY ].bind(cfgHandler)
3024
- });
3045
+ var _a$4;
3046
+ var STR_WARN_TO_CONSOLE = "warnToConsole";
3047
+ var AiNonUserActionablePrefix = "AI (Internal): ";
3048
+ var AiUserActionablePrefix = "AI: ";
3049
+ var AIInternalMessagePrefix = "AITR_";
3050
+ var defaultValues$2 = {
3051
+ loggingLevelConsole: 0,
3052
+ loggingLevelTelemetry: 1,
3053
+ maxMessageLimit: 25,
3054
+ enableDebug: false
3055
+ };
3056
+ var _logFuncs = (_a$4 = {},
3057
+ _a$4[0 ] = null,
3058
+ _a$4[1 ] = "errorToConsole",
3059
+ _a$4[2 ] = STR_WARN_TO_CONSOLE,
3060
+ _a$4[3 ] = "debugToConsole",
3061
+ _a$4);
3062
+ function _sanitizeDiagnosticText(text) {
3063
+ if (text) {
3064
+ return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY$2) + "\"";
3065
+ }
3066
+ return STR_EMPTY$2;
3067
+ }
3068
+ function _logToConsole(func, message) {
3069
+ var theConsole = getConsole();
3070
+ if (!!theConsole) {
3071
+ var logFunc = "log";
3072
+ if (theConsole[func]) {
3073
+ logFunc = func;
3025
3074
  }
3026
- catch (e) {
3027
- var logger = cfgHandler[_DYN_LOGGER$1 ];
3028
- if (logger) {
3029
- logger[_DYN_THROW_INTERNAL ](1 , 107 , dumpObj(e));
3030
- }
3031
- throw e;
3075
+ if (isFunction(theConsole[logFunc])) {
3076
+ theConsole[logFunc](message);
3032
3077
  }
3033
- finally {
3034
- theState.act = prevWatcher || null;
3078
+ }
3079
+ }
3080
+ var _InternalLogMessage = /** @class */ (function () {
3081
+ function _InternalLogMessage(msgId, msg, isUserAct, properties) {
3082
+ if (isUserAct === void 0) { isUserAct = false; }
3083
+ var _self = this;
3084
+ _self[_DYN_MESSAGE_ID ] = msgId;
3085
+ _self[_DYN_MESSAGE ] =
3086
+ (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
3087
+ msgId;
3088
+ var strProps = STR_EMPTY$2;
3089
+ if (hasJSON()) {
3090
+ strProps = getJSON().stringify(properties);
3035
3091
  }
3092
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$2) +
3093
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$2);
3094
+ _self[_DYN_MESSAGE ] += diagnosticText;
3036
3095
  }
3037
- function _notifyWatchers() {
3038
- if (_waitingHandlers) {
3039
- var notifyHandlers = _waitingHandlers;
3040
- _waitingHandlers = null;
3041
- _watcherTimer && _watcherTimer[_DYN_CANCEL ]();
3042
- _watcherTimer = null;
3043
- var watcherFailures_1 = [];
3044
- arrForEach(notifyHandlers, function (handler) {
3045
- if (handler) {
3046
- if (handler[dynamicPropertyDetail]) {
3047
- arrForEach(handler[dynamicPropertyDetail], function (detail) {
3048
- detail.clr(handler);
3049
- });
3050
- handler[dynamicPropertyDetail] = null;
3051
- }
3052
- if (handler.fn) {
3053
- try {
3054
- _useHandler(handler, handler.fn);
3096
+ _InternalLogMessage.dataType = "MessageData";
3097
+ return _InternalLogMessage;
3098
+ }());
3099
+ function safeGetLogger(core, config) {
3100
+ return (core || {})[_DYN_LOGGER$1 ] || new DiagnosticLogger(config);
3101
+ }
3102
+ var DiagnosticLogger = /** @class */ (function () {
3103
+ function DiagnosticLogger(config) {
3104
+ this.identifier = "DiagnosticLogger";
3105
+ this.queue = [];
3106
+ var _messageCount = 0;
3107
+ var _messageLogged = {};
3108
+ var _loggingLevelConsole;
3109
+ var _loggingLevelTelemetry;
3110
+ var _maxInternalMessageLimit;
3111
+ var _enableDebug;
3112
+ var _unloadHandler;
3113
+ dynamicProto(DiagnosticLogger, this, function (_self) {
3114
+ _unloadHandler = _setDefaultsFromConfig(config || {});
3115
+ _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
3116
+ _self[_DYN_THROW_INTERNAL ] = function (severity, msgId, msg, properties, isUserAct) {
3117
+ if (isUserAct === void 0) { isUserAct = false; }
3118
+ var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
3119
+ if (_enableDebug) {
3120
+ throw dumpObj(message);
3121
+ }
3122
+ else {
3123
+ var logFunc = _logFuncs[severity] || STR_WARN_TO_CONSOLE;
3124
+ if (!isUndefined(message[_DYN_MESSAGE ])) {
3125
+ if (isUserAct) {
3126
+ var messageKey = +message[_DYN_MESSAGE_ID ];
3127
+ if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {
3128
+ _self[logFunc](message[_DYN_MESSAGE ]);
3129
+ _messageLogged[messageKey] = true;
3130
+ }
3055
3131
  }
3056
- catch (e) {
3057
- watcherFailures_1[_DYN_PUSH ](e);
3132
+ else {
3133
+ if (_loggingLevelConsole >= severity) {
3134
+ _self[logFunc](message[_DYN_MESSAGE ]);
3135
+ }
3058
3136
  }
3137
+ _logInternalMessage(severity, message);
3138
+ }
3139
+ else {
3140
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
3059
3141
  }
3060
3142
  }
3061
- });
3062
- if (_waitingHandlers) {
3063
- try {
3064
- _notifyWatchers();
3143
+ };
3144
+ _self.debugToConsole = function (message) {
3145
+ _logToConsole("debug", message);
3146
+ _debugExtMsg("warning", message);
3147
+ };
3148
+ _self[_DYN_WARN_TO_CONSOLE ] = function (message) {
3149
+ _logToConsole("warn", message);
3150
+ _debugExtMsg("warning", message);
3151
+ };
3152
+ _self.errorToConsole = function (message) {
3153
+ _logToConsole("error", message);
3154
+ _debugExtMsg("error", message);
3155
+ };
3156
+ _self.resetInternalMessageCount = function () {
3157
+ _messageCount = 0;
3158
+ _messageLogged = {};
3159
+ };
3160
+ _self[_DYN_LOG_INTERNAL_MESSAGE ] = _logInternalMessage;
3161
+ _self[_DYN_UNLOAD ] = function (isAsync) {
3162
+ _unloadHandler && _unloadHandler.rm();
3163
+ _unloadHandler = null;
3164
+ };
3165
+ function _logInternalMessage(severity, message) {
3166
+ if (_areInternalMessagesThrottled()) {
3167
+ return;
3065
3168
  }
3066
- catch (e) {
3067
- watcherFailures_1[_DYN_PUSH ](e);
3169
+ var logMessage = true;
3170
+ var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID ];
3171
+ if (_messageLogged[messageKey]) {
3172
+ logMessage = false;
3068
3173
  }
3069
- }
3070
- if (watcherFailures_1[_DYN_LENGTH$1 ] > 0) {
3071
- throwAggregationError("Watcher error(s): ", watcherFailures_1);
3072
- }
3073
- }
3074
- }
3075
- function _addWatcher(detail) {
3076
- if (detail && detail.h[_DYN_LENGTH$1 ] > 0) {
3077
- if (!_waitingHandlers) {
3078
- _waitingHandlers = [];
3079
- }
3080
- if (!_watcherTimer) {
3081
- _watcherTimer = scheduleTimeout(function () {
3082
- _watcherTimer = null;
3083
- _notifyWatchers();
3084
- }, 0);
3085
- }
3086
- for (var idx = 0; idx < detail.h[_DYN_LENGTH$1 ]; idx++) {
3087
- var handler = detail.h[idx];
3088
- if (handler && arrIndexOf(_waitingHandlers, handler) === -1) {
3089
- _waitingHandlers[_DYN_PUSH ](handler);
3174
+ else {
3175
+ _messageLogged[messageKey] = true;
3176
+ }
3177
+ if (logMessage) {
3178
+ if (severity <= _loggingLevelTelemetry) {
3179
+ _self.queue[_DYN_PUSH ](message);
3180
+ _messageCount++;
3181
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
3182
+ }
3183
+ if (_messageCount === _maxInternalMessageLimit) {
3184
+ var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
3185
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
3186
+ _self.queue[_DYN_PUSH ](throttleMessage);
3187
+ if (severity === 1 ) {
3188
+ _self.errorToConsole(throttleLimitMessage);
3189
+ }
3190
+ else {
3191
+ _self[_DYN_WARN_TO_CONSOLE ](throttleLimitMessage);
3192
+ }
3193
+ }
3090
3194
  }
3091
3195
  }
3092
- }
3093
- }
3094
- function _trackHandler(handler, detail) {
3095
- if (handler) {
3096
- var details = handler[dynamicPropertyDetail] = handler[dynamicPropertyDetail] || [];
3097
- if (arrIndexOf(details, detail) === -1) {
3098
- details[_DYN_PUSH ](detail);
3196
+ function _setDefaultsFromConfig(config) {
3197
+ return onConfigChange(createDynamicConfig(config, defaultValues$2, _self).cfg, function (details) {
3198
+ var config = details.cfg;
3199
+ _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 ];
3200
+ _loggingLevelTelemetry = config.loggingLevelTelemetry;
3201
+ _maxInternalMessageLimit = config.maxMessageLimit;
3202
+ _enableDebug = config.enableDebug;
3203
+ });
3099
3204
  }
3100
- }
3101
- }
3102
- theState = (_a = {
3103
- prop: dynamicPropertySymbol,
3104
- ro: dynamicPropertyReadOnly,
3105
- rf: dynamicPropertyReferenced
3106
- },
3107
- _a[_DYN_BLK_VAL ] = dynamicPropertyBlockValue,
3108
- _a[_DYN_HDLR ] = cfgHandler,
3109
- _a.add = _addWatcher,
3110
- _a[_DYN_NOTIFY ] = _notifyWatchers,
3111
- _a.use = _useHandler,
3112
- _a.trk = _trackHandler,
3113
- _a);
3114
- return theState;
3115
- }
3116
-
3117
- function _createAndUseHandler(state, configHandler) {
3118
- var handler = {
3119
- fn: configHandler,
3120
- rm: function () {
3121
- handler.fn = null;
3122
- state = null;
3123
- configHandler = null;
3124
- }
3125
- };
3126
- state.use(handler, configHandler);
3127
- return handler;
3128
- }
3129
- function _createDynamicHandler(logger, target, inPlace) {
3130
- var _a;
3131
- var dynamicHandler = getDynamicConfigHandler(target);
3132
- if (dynamicHandler) {
3133
- return dynamicHandler;
3134
- }
3135
- var uid = createUniqueNamespace("dyncfg", true);
3136
- var newTarget = (target && inPlace !== false) ? target : _cfgDeepCopy(target);
3137
- var theState;
3138
- function _notifyWatchers() {
3139
- theState[_DYN_NOTIFY ]();
3140
- }
3141
- function _setValue(target, name, value) {
3142
- try {
3143
- target = _setDynamicProperty(theState, target, name, value);
3144
- }
3145
- catch (e) {
3146
- _throwDynamicError(logger, name, "Setting value", e);
3147
- }
3148
- return target[name];
3149
- }
3150
- function _watch(configHandler) {
3151
- return _createAndUseHandler(theState, configHandler);
3152
- }
3153
- function _block(configHandler, allowUpdate) {
3154
- theState.use(null, function (details) {
3155
- var prevUpd = theState.upd;
3156
- try {
3157
- if (!isUndefined(allowUpdate)) {
3158
- theState.upd = allowUpdate;
3159
- }
3160
- configHandler(details);
3205
+ function _areInternalMessagesThrottled() {
3206
+ return _messageCount >= _maxInternalMessageLimit;
3161
3207
  }
3162
- finally {
3163
- theState.upd = prevUpd;
3208
+ function _debugExtMsg(name, data) {
3209
+ var dbgExt = getDebugExt(config || {});
3210
+ if (dbgExt && dbgExt[_DYN_DIAG_LOG ]) {
3211
+ dbgExt[_DYN_DIAG_LOG ](name, data);
3212
+ }
3164
3213
  }
3165
3214
  });
3166
3215
  }
3167
- function _ref(target, name) {
3168
- var _a;
3169
- return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[0 ] = true, _a))[name];
3170
- }
3171
- function _rdOnly(target, name) {
3172
- var _a;
3173
- return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[1 ] = true, _a))[name];
3174
- }
3175
- function _blkPropValue(target, name) {
3176
- var _a;
3177
- return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[2 ] = true, _a))[name];
3178
- }
3179
- function _applyDefaults(theConfig, defaultValues) {
3180
- if (defaultValues) {
3181
- objForEachKey(defaultValues, function (name, value) {
3182
- _applyDefaultValue(cfgHandler, theConfig, name, value);
3183
- });
3184
- }
3185
- return theConfig;
3186
- }
3187
- var cfgHandler = (_a = {
3188
- uid: null,
3189
- cfg: newTarget
3190
- },
3191
- _a[_DYN_LOGGER$1 ] = logger,
3192
- _a[_DYN_NOTIFY ] = _notifyWatchers,
3193
- _a.set = _setValue,
3194
- _a[_DYN_SET_DF ] = _applyDefaults,
3195
- _a[_DYN_WATCH ] = _watch,
3196
- _a.ref = _ref,
3197
- _a[_DYN_RD_ONLY ] = _rdOnly,
3198
- _a[_DYN_BLK_VAL ] = _blkPropValue,
3199
- _a._block = _block,
3200
- _a);
3201
- objDefine(cfgHandler, "uid", {
3202
- c: false,
3203
- e: false,
3204
- w: false,
3205
- v: uid
3206
- });
3207
- theState = _createState(cfgHandler);
3208
- _makeDynamicObject(theState, newTarget, "config", "Creating");
3209
- return cfgHandler;
3210
- }
3211
- function _logInvalidAccess(logger, message) {
3212
- if (logger) {
3213
- logger[_DYN_WARN_TO_CONSOLE ](message);
3214
- logger[_DYN_THROW_INTERNAL ](2 , 108 , message);
3215
- }
3216
- else {
3217
- throwInvalidAccess(message);
3218
- }
3219
- }
3220
- function createDynamicConfig(config, defaultConfig, logger, inPlace) {
3221
- var dynamicHandler = _createDynamicHandler(logger, config || {}, inPlace);
3222
- if (defaultConfig) {
3223
- dynamicHandler[_DYN_SET_DF ](dynamicHandler.cfg, defaultConfig);
3224
- }
3225
- return dynamicHandler;
3226
- }
3227
- function onConfigChange(config, configHandler, logger) {
3228
- var handler = config[CFG_HANDLER_LINK] || config;
3229
- if (handler.cfg && (handler.cfg === config || handler.cfg[CFG_HANDLER_LINK] === handler)) {
3230
- return handler[_DYN_WATCH ](configHandler);
3231
- }
3232
- _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + dumpObj(config));
3233
- return createDynamicConfig(config, null, logger)[_DYN_WATCH ](configHandler);
3216
+ DiagnosticLogger.__ieDyn=1;
3217
+ return DiagnosticLogger;
3218
+ }());
3219
+ function _getLogger(logger) {
3220
+ return (logger || new DiagnosticLogger());
3234
3221
  }
3235
-
3236
- function runTargetUnload(target, isAsync) {
3237
- if (target && target[_DYN_UNLOAD ]) {
3238
- return target[_DYN_UNLOAD ](isAsync);
3239
- }
3222
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
3223
+ if (isUserAct === void 0) { isUserAct = false; }
3224
+ _getLogger(logger)[_DYN_THROW_INTERNAL ](severity, msgId, msg, properties, isUserAct);
3240
3225
  }
3241
- function doUnloadAll(targets, isAsync, done) {
3242
- var result;
3243
- if (!done) {
3244
- result = createPromise(function (resolved) {
3245
- done = resolved;
3246
- });
3247
- }
3248
- if (targets && getLength(targets) > 0) {
3249
- doAwaitResponse(runTargetUnload(targets[0], isAsync), function () {
3250
- doUnloadAll(arrSlice(targets, 1), isAsync, done);
3251
- });
3252
- }
3253
- else {
3254
- done();
3255
- }
3256
- return result;
3226
+ function _warnToConsole(logger, message) {
3227
+ _getLogger(logger)[_DYN_WARN_TO_CONSOLE ](message);
3257
3228
  }
3258
-
3259
- var ChannelControllerPriority = 500;
3260
- var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
3261
-
3262
- function cfgDfMerge(defaultValue) {
3263
- return {
3264
- mrg: true,
3265
- v: defaultValue
3266
- };
3229
+ function _logInternalMessage(logger, severity, message) {
3230
+ _getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE ](severity, message);
3267
3231
  }
3268
3232
 
3269
3233
  var _a$3, _b;
@@ -3565,18 +3529,26 @@ function uaDisallowsSameSiteNone(userAgent) {
3565
3529
  var defaultValues$1 = {
3566
3530
  perfEvtsSendAll: false
3567
3531
  };
3568
- function _runListeners(listeners, name, isAsync, callback) {
3532
+ function _runScheduledListeners(asyncNotifications) {
3533
+ asyncNotifications.h = null;
3534
+ var callbacks = asyncNotifications.cb;
3535
+ asyncNotifications.cb = [];
3536
+ arrForEach(callbacks, function (cb) {
3537
+ safe(cb.fn, [cb.arg]);
3538
+ });
3539
+ }
3540
+ function _runListeners(listeners, name, asyncNotifications, callback) {
3569
3541
  arrForEach(listeners, function (listener) {
3570
3542
  if (listener && listener[name]) {
3571
- if (isAsync) {
3572
- scheduleTimeout(function () { return callback(listener); }, 0);
3543
+ if (asyncNotifications) {
3544
+ asyncNotifications.cb[_DYN_PUSH ]({
3545
+ fn: callback,
3546
+ arg: listener
3547
+ });
3548
+ asyncNotifications.h = asyncNotifications.h || scheduleTimeout(_runScheduledListeners, 0, asyncNotifications);
3573
3549
  }
3574
3550
  else {
3575
- try {
3576
- callback(listener);
3577
- }
3578
- catch (e) {
3579
- }
3551
+ safe(callback, [listener]);
3580
3552
  }
3581
3553
  }
3582
3554
  });
@@ -3587,6 +3559,10 @@ var NotificationManager = /** @class */ (function () {
3587
3559
  var perfEvtsSendAll;
3588
3560
  var unloadHandler;
3589
3561
  var _listeners = [];
3562
+ var _asyncNotifications = {
3563
+ h: null,
3564
+ cb: []
3565
+ };
3590
3566
  var cfgHandler = createDynamicConfig(config, defaultValues$1);
3591
3567
  unloadHandler = cfgHandler[_DYN_WATCH ](function (details) {
3592
3568
  perfEvtsSendAll = !!details.cfg.perfEvtsSendAll;
@@ -3598,7 +3574,7 @@ var NotificationManager = /** @class */ (function () {
3598
3574
  _self[_DYN_ADD_NOTIFICATION_LIS1 ] = function (listener) {
3599
3575
  _listeners[_DYN_PUSH ](listener);
3600
3576
  };
3601
- _self[_DYN_REMOVE_NOTIFICATION_2 ] = function (listener) {
3577
+ _self[_DYN_REMOVE_NOTIFICATION_0 ] = function (listener) {
3602
3578
  var index = arrIndexOf(_listeners, listener);
3603
3579
  while (index > -1) {
3604
3580
  _listeners[_DYN_SPLICE ](index, 1);
@@ -3606,24 +3582,24 @@ var NotificationManager = /** @class */ (function () {
3606
3582
  }
3607
3583
  };
3608
3584
  _self[STR_EVENTS_SENT ] = function (events) {
3609
- _runListeners(_listeners, STR_EVENTS_SENT, true, function (listener) {
3585
+ _runListeners(_listeners, STR_EVENTS_SENT, _asyncNotifications, function (listener) {
3610
3586
  listener[STR_EVENTS_SENT ](events);
3611
3587
  });
3612
3588
  };
3613
3589
  _self[STR_EVENTS_DISCARDED ] = function (events, reason) {
3614
- _runListeners(_listeners, STR_EVENTS_DISCARDED, true, function (listener) {
3590
+ _runListeners(_listeners, STR_EVENTS_DISCARDED, _asyncNotifications, function (listener) {
3615
3591
  listener[STR_EVENTS_DISCARDED ](events, reason);
3616
3592
  });
3617
3593
  };
3618
3594
  _self[STR_EVENTS_SEND_REQUEST ] = function (sendReason, isAsync) {
3619
- _runListeners(_listeners, STR_EVENTS_SEND_REQUEST, isAsync, function (listener) {
3595
+ _runListeners(_listeners, STR_EVENTS_SEND_REQUEST, isAsync ? _asyncNotifications : null, function (listener) {
3620
3596
  listener[STR_EVENTS_SEND_REQUEST ](sendReason, isAsync);
3621
3597
  });
3622
3598
  };
3623
3599
  _self[STR_PERF_EVENT ] = function (perfEvent) {
3624
3600
  if (perfEvent) {
3625
3601
  if (perfEvtsSendAll || !perfEvent[_DYN_IS_CHILD_EVT ]()) {
3626
- _runListeners(_listeners, STR_PERF_EVENT, false, function (listener) {
3602
+ _runListeners(_listeners, STR_PERF_EVENT, null, function (listener) {
3627
3603
  if (perfEvent[_DYN_IS_ASYNC ]) {
3628
3604
  scheduleTimeout(function () { return listener[STR_PERF_EVENT ](perfEvent); }, 0);
3629
3605
  }
@@ -3636,14 +3612,14 @@ var NotificationManager = /** @class */ (function () {
3636
3612
  };
3637
3613
  _self[STR_OFFLINE_STORE ] = function (events) {
3638
3614
  if (events && events[_DYN_LENGTH$1 ]) {
3639
- _runListeners(_listeners, STR_OFFLINE_STORE, true, function (listener) {
3615
+ _runListeners(_listeners, STR_OFFLINE_STORE, _asyncNotifications, function (listener) {
3640
3616
  listener[STR_OFFLINE_STORE ](events);
3641
3617
  });
3642
3618
  }
3643
3619
  };
3644
3620
  _self[STR_OFFLINE_SENT ] = function (batch) {
3645
3621
  if (batch && batch[_DYN_DATA ]) {
3646
- _runListeners(_listeners, STR_OFFLINE_SENT, true, function (listener) {
3622
+ _runListeners(_listeners, STR_OFFLINE_SENT, _asyncNotifications, function (listener) {
3647
3623
  listener[STR_OFFLINE_SENT ](batch);
3648
3624
  });
3649
3625
  }
@@ -3651,7 +3627,7 @@ var NotificationManager = /** @class */ (function () {
3651
3627
  _self[STR_OFFLINE_DROP ] = function (cnt, reason) {
3652
3628
  if (cnt > 0) {
3653
3629
  var rn_1 = reason || 0;
3654
- _runListeners(_listeners, STR_OFFLINE_DROP, true, function (listener) {
3630
+ _runListeners(_listeners, STR_OFFLINE_DROP, _asyncNotifications, function (listener) {
3655
3631
  listener[STR_OFFLINE_DROP ](cnt, rn_1);
3656
3632
  });
3657
3633
  }
@@ -3661,9 +3637,12 @@ var NotificationManager = /** @class */ (function () {
3661
3637
  unloadHandler && unloadHandler.rm();
3662
3638
  unloadHandler = null;
3663
3639
  _listeners = [];
3640
+ _asyncNotifications.h && _asyncNotifications.h[_DYN_CANCEL ]();
3641
+ _asyncNotifications.h = null;
3642
+ _asyncNotifications.cb = [];
3664
3643
  };
3665
3644
  var waiting;
3666
- _runListeners(_listeners, "unload", false, function (listener) {
3645
+ _runListeners(_listeners, "unload", null, function (listener) {
3667
3646
  var asyncUnload = listener[_DYN_UNLOAD ](isAsync);
3668
3647
  if (asyncUnload) {
3669
3648
  if (!waiting) {
@@ -4456,6 +4435,12 @@ function createUnloadHandlerContainer() {
4456
4435
  };
4457
4436
  }
4458
4437
 
4438
+ var _maxHooks;
4439
+ var _hookAddMonitor;
4440
+ function _testHookMaxUnloadHooksCb(maxHooks, addMonitor) {
4441
+ _maxHooks = maxHooks;
4442
+ _hookAddMonitor = addMonitor;
4443
+ }
4459
4444
  function createUnloadHookContainer() {
4460
4445
  var _hooks = [];
4461
4446
  function _doUnload(logger) {
@@ -4469,10 +4454,16 @@ function createUnloadHookContainer() {
4469
4454
  _throwInternal(logger, 2 , 73 , "Unloading:" + dumpObj(e));
4470
4455
  }
4471
4456
  });
4457
+ if (_maxHooks && oldHooks[_DYN_LENGTH$1 ] > _maxHooks) {
4458
+ _hookAddMonitor ? _hookAddMonitor("doUnload", oldHooks) : _throwInternal(null, 1 , 48 , "Max unload hooks exceeded. An excessive number of unload hooks has been detected.");
4459
+ }
4472
4460
  }
4473
4461
  function _addHook(hooks) {
4474
4462
  if (hooks) {
4475
4463
  arrAppend(_hooks, hooks);
4464
+ if (_maxHooks && _hooks[_DYN_LENGTH$1 ] > _maxHooks) {
4465
+ _hookAddMonitor ? _hookAddMonitor("Add", _hooks) : _throwInternal(null, 1 , 48 , "Max unload hooks exceeded. An excessive number of unload hooks has been detected.");
4466
+ }
4476
4467
  }
4477
4468
  }
4478
4469
  return {
@@ -4600,7 +4591,7 @@ var BaseTelemetryPlugin = /** @class */ (function () {
4600
4591
  function _setDefaults(config, core, pluginChain) {
4601
4592
  createDynamicConfig(config, defaultValues, safeGetLogger(core));
4602
4593
  if (!pluginChain && core) {
4603
- pluginChain = core[_DYN_GET_PROCESS_TEL_CONT0 ]()[_DYN_GET_NEXT ]();
4594
+ pluginChain = core[_DYN_GET_PROCESS_TEL_CONT2 ]()[_DYN_GET_NEXT ]();
4604
4595
  }
4605
4596
  var nextPlugin = _nextPlugin;
4606
4597
  if (_nextPlugin && _nextPlugin[strGetPlugin]) {
@@ -4804,6 +4795,27 @@ function _registerDelayedCfgListener(config, listeners, logger) {
4804
4795
  };
4805
4796
  });
4806
4797
  }
4798
+ function _initDebugListener(configHandler, unloadContainer, notificationManager, debugListener) {
4799
+ unloadContainer.add(configHandler[_DYN_WATCH ](function (details) {
4800
+ var disableDbgExt = details.cfg.disableDbgExt;
4801
+ if (disableDbgExt === true && debugListener) {
4802
+ notificationManager[_DYN_REMOVE_NOTIFICATION_0 ](debugListener);
4803
+ debugListener = null;
4804
+ }
4805
+ if (notificationManager && !debugListener && disableDbgExt !== true) {
4806
+ debugListener = getDebugListener(details.cfg);
4807
+ notificationManager[_DYN_ADD_NOTIFICATION_LIS1 ](debugListener);
4808
+ }
4809
+ }));
4810
+ return debugListener;
4811
+ }
4812
+ function _createUnloadHook(unloadHook) {
4813
+ return objDefine({
4814
+ rm: function () {
4815
+ unloadHook.rm();
4816
+ }
4817
+ }, "toJSON", { v: function () { return "aicore::onCfgChange<" + JSON.stringify(unloadHook) + ">"; } });
4818
+ }
4807
4819
  var AppInsightsCore$1 = /** @class */ (function () {
4808
4820
  function AppInsightsCore() {
4809
4821
  var _configHandler;
@@ -4860,7 +4872,7 @@ var AppInsightsCore$1 = /** @class */ (function () {
4860
4872
  }
4861
4873
  }));
4862
4874
  _notificationManager = notificationManager;
4863
- _initDebugListener();
4875
+ _debugListener = _initDebugListener(_configHandler, _hookContainer, _notificationManager && _self[_DYN_GET_NOTIFY_MGR ](), _debugListener);
4864
4876
  _initPerfManager();
4865
4877
  _self[_DYN_LOGGER$1 ] = logger;
4866
4878
  var cfgExtensions = config[STR_EXTENSIONS ];
@@ -4913,7 +4925,7 @@ var AppInsightsCore$1 = /** @class */ (function () {
4913
4925
  }
4914
4926
  }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
4915
4927
  };
4916
- _self[_DYN_GET_PROCESS_TEL_CONT0 ] = _createTelCtx;
4928
+ _self[_DYN_GET_PROCESS_TEL_CONT2 ] = _createTelCtx;
4917
4929
  _self[_DYN_GET_NOTIFY_MGR ] = function () {
4918
4930
  if (!_notificationManager) {
4919
4931
  _notificationManager = new NotificationManager(_configHandler.cfg);
@@ -4922,11 +4934,11 @@ var AppInsightsCore$1 = /** @class */ (function () {
4922
4934
  return _notificationManager;
4923
4935
  };
4924
4936
  _self[_DYN_ADD_NOTIFICATION_LIS1 ] = function (listener) {
4925
- _self[_DYN_GET_NOTIFY_MGR ]()[_DYN_ADD_NOTIFICATION_LIS1 ](listener);
4937
+ _self.getNotifyMgr()[_DYN_ADD_NOTIFICATION_LIS1 ](listener);
4926
4938
  };
4927
- _self[_DYN_REMOVE_NOTIFICATION_2 ] = function (listener) {
4939
+ _self[_DYN_REMOVE_NOTIFICATION_0 ] = function (listener) {
4928
4940
  if (_notificationManager) {
4929
- _notificationManager[_DYN_REMOVE_NOTIFICATION_2 ](listener);
4941
+ _notificationManager[_DYN_REMOVE_NOTIFICATION_0 ](listener);
4930
4942
  }
4931
4943
  };
4932
4944
  _self.getCookieMgr = function () {
@@ -4942,16 +4954,6 @@ var AppInsightsCore$1 = /** @class */ (function () {
4942
4954
  }
4943
4955
  };
4944
4956
  _self[STR_GET_PERF_MGR ] = function () {
4945
- if (!_perfManager && !_cfgPerfManager) {
4946
- _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
4947
- if (details.cfg.enablePerfMgr) {
4948
- var createPerfMgr = details.cfg[STR_CREATE_PERF_MGR ];
4949
- if (isFunction(createPerfMgr)) {
4950
- _cfgPerfManager = createPerfMgr(_self, _self[_DYN_GET_NOTIFY_MGR ]());
4951
- }
4952
- }
4953
- }));
4954
- }
4955
4957
  return _perfManager || _cfgPerfManager || getGblPerfMgr();
4956
4958
  };
4957
4959
  _self.setPerfMgr = function (perfMgr) {
@@ -5146,11 +5148,7 @@ var AppInsightsCore$1 = /** @class */ (function () {
5146
5148
  else {
5147
5149
  unloadHook = onConfigChange(_configHandler.cfg, handler, _self[_DYN_LOGGER$1 ]);
5148
5150
  }
5149
- return {
5150
- rm: function () {
5151
- unloadHook.rm();
5152
- }
5153
- };
5151
+ return _createUnloadHook(unloadHook);
5154
5152
  };
5155
5153
  _self.getWParam = function () {
5156
5154
  return (hasDocument() || !!_configHandler.cfg.enableWParam) ? 0 : -1;
@@ -5250,6 +5248,8 @@ var AppInsightsCore$1 = /** @class */ (function () {
5250
5248
  _pluginVersionString = null;
5251
5249
  _pluginVersionStringArr = null;
5252
5250
  _forceStopInternalLogPoller = false;
5251
+ _internalLogPoller = null;
5252
+ _internalLogPollerListening = false;
5253
5253
  }
5254
5254
  function _createTelCtx() {
5255
5255
  var theCtx = createProcessTelemetryContext(_getPluginChain(), _configHandler.cfg, _self);
@@ -5444,28 +5444,27 @@ var AppInsightsCore$1 = /** @class */ (function () {
5444
5444
  doCallback();
5445
5445
  return true;
5446
5446
  }
5447
- function _initDebugListener() {
5448
- !_notificationManager && _self[_DYN_GET_NOTIFY_MGR ]();
5449
- _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
5450
- var disableDbgExt = details.cfg.disableDbgExt;
5451
- if (disableDbgExt === true && _debugListener) {
5452
- _notificationManager[_DYN_REMOVE_NOTIFICATION_2 ](_debugListener);
5453
- _debugListener = null;
5454
- }
5455
- if (_notificationManager && !_debugListener && disableDbgExt !== true) {
5456
- _debugListener = getDebugListener(details.cfg);
5457
- _notificationManager[_DYN_ADD_NOTIFICATION_LIS1 ](_debugListener);
5458
- }
5459
- }));
5460
- }
5461
5447
  function _initPerfManager() {
5448
+ var prevCfgPerfMgr;
5462
5449
  _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
5463
5450
  var enablePerfMgr = details.cfg.enablePerfMgr;
5464
- if (!enablePerfMgr && _cfgPerfManager) {
5465
- _cfgPerfManager = null;
5466
- }
5467
5451
  if (enablePerfMgr) {
5468
- getSetValue(details.cfg, STR_CREATE_PERF_MGR, _createPerfManager);
5452
+ var createPerfMgr = details.cfg[STR_CREATE_PERF_MGR ];
5453
+ if (prevCfgPerfMgr !== createPerfMgr) {
5454
+ if (!createPerfMgr) {
5455
+ createPerfMgr = _createPerfManager;
5456
+ }
5457
+ getSetValue(details.cfg, STR_CREATE_PERF_MGR, createPerfMgr);
5458
+ prevCfgPerfMgr = createPerfMgr;
5459
+ _cfgPerfManager = null;
5460
+ }
5461
+ if (!_perfManager && !_cfgPerfManager && isFunction(createPerfMgr)) {
5462
+ _cfgPerfManager = createPerfMgr(_self, _self[_DYN_GET_NOTIFY_MGR ]());
5463
+ }
5464
+ }
5465
+ else {
5466
+ _cfgPerfManager = null;
5467
+ prevCfgPerfMgr = null;
5469
5468
  }
5470
5469
  }));
5471
5470
  }
@@ -5501,6 +5500,24 @@ var AppInsightsCore$1 = /** @class */ (function () {
5501
5500
  return AppInsightsCore;
5502
5501
  }());
5503
5502
 
5503
+ function parseResponse(response, diagLog) {
5504
+ try {
5505
+ if (response && response !== "") {
5506
+ var result = getJSON().parse(response);
5507
+ if (result && result[_DYN_ITEMS_RECEIVED ] && result[_DYN_ITEMS_RECEIVED ] >= result.itemsAccepted &&
5508
+ result.itemsReceived - result.itemsAccepted === result.errors[_DYN_LENGTH$1 ]) {
5509
+ return result;
5510
+ }
5511
+ }
5512
+ }
5513
+ catch (e) {
5514
+ _throwInternal(diagLog, 1 , 43 , "Cannot parse the response. " + (e[_DYN_NAME ] || dumpObj(e)), {
5515
+ response: response
5516
+ });
5517
+ }
5518
+ return null;
5519
+ }
5520
+
5504
5521
  var STR_EMPTY$1 = "";
5505
5522
  var STR_NO_RESPONSE_BODY = "NoResponseBody";
5506
5523
  var _noResponseQs = "&" + STR_NO_RESPONSE_BODY + "=true";
@@ -6269,7 +6286,7 @@ var _DYN_RM_FIELD_SANITIZER = "rmFieldSanitizer";
6269
6286
  var _DYN_CAN_HANDLE = "canHandle";
6270
6287
 
6271
6288
  var _a;
6272
- var Version = '4.1.2-nightly3.2403-07';
6289
+ var Version = '4.1.3-nightly3.2403-09';
6273
6290
  var FullVersionString = "1DS-Web-JS-" + Version;
6274
6291
  var ObjHasOwnProperty = ObjProto$1.hasOwnProperty;
6275
6292
  var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
@@ -6871,6 +6888,7 @@ exports.__getRegisteredEvents = __getRegisteredEvents;
6871
6888
  exports._appendHeader = _appendHeader;
6872
6889
  exports._getAllResponseHeaders = _getAllResponseHeaders;
6873
6890
  exports._logInternalMessage = _logInternalMessage;
6891
+ exports._testHookMaxUnloadHooksCb = _testHookMaxUnloadHooksCb;
6874
6892
  exports._throwInternal = _throwInternal;
6875
6893
  exports._warnToConsole = _warnToConsole;
6876
6894
  exports.addEventHandler = addEventHandler;
@@ -7014,4 +7032,4 @@ exports.toISOString = toISOString;
7014
7032
  exports.useXDomainRequest = useXDomainRequest;
7015
7033
 
7016
7034
  }));
7017
- //# sourceMappingURL=ms.core-4.1.2-nightly3.2403-07.js.map
7035
+ //# sourceMappingURL=ms.core-4.1.3-nightly3.2403-09.js.map