@microsoft/1ds-core-js 3.2.2 → 3.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CODE_OF_CONDUCT.md +9 -0
  2. package/CONTRIBUTING.md +14 -0
  3. package/LICENSE.TXT +3 -3
  4. package/NOTICE +17 -0
  5. package/PRIVACY +3 -0
  6. package/README.md +15 -1
  7. package/SECURITY.md +41 -0
  8. package/SUPPORT.md +14 -0
  9. package/bundle/{ms.core-3.2.2.gbl.js → ms.core-3.2.5.gbl.js} +1728 -1431
  10. package/bundle/ms.core-3.2.5.gbl.js.map +1 -0
  11. package/bundle/ms.core-3.2.5.gbl.min.js +7 -0
  12. package/bundle/ms.core-3.2.5.gbl.min.js.map +1 -0
  13. package/bundle/ms.core-3.2.5.integrity.json +46 -0
  14. package/bundle/{ms.core-3.2.2.js → ms.core-3.2.5.js} +1728 -1431
  15. package/bundle/ms.core-3.2.5.js.map +1 -0
  16. package/bundle/ms.core-3.2.5.min.js +7 -0
  17. package/bundle/ms.core-3.2.5.min.js.map +1 -0
  18. package/bundle/ms.core.gbl.js +1727 -1430
  19. package/bundle/ms.core.gbl.js.map +1 -1
  20. package/bundle/ms.core.gbl.min.js +2 -2
  21. package/bundle/ms.core.gbl.min.js.map +1 -1
  22. package/bundle/ms.core.integrity.json +17 -17
  23. package/bundle/ms.core.js +1727 -1430
  24. package/bundle/ms.core.js.map +1 -1
  25. package/bundle/ms.core.min.js +2 -2
  26. package/bundle/ms.core.min.js.map +1 -1
  27. package/dist/ms.core.js +44 -35
  28. package/dist/ms.core.js.map +1 -1
  29. package/dist/ms.core.min.js +2 -2
  30. package/dist/ms.core.min.js.map +1 -1
  31. package/dist-esm/src/AppInsightsCore.d.ts +2 -7
  32. package/dist-esm/src/AppInsightsCore.js +27 -29
  33. package/dist-esm/src/AppInsightsCore.js.map +1 -1
  34. package/dist-esm/src/BaseCore.d.ts +2 -2
  35. package/dist-esm/src/BaseCore.js +18 -12
  36. package/dist-esm/src/BaseCore.js.map +1 -1
  37. package/dist-esm/src/DataModels.d.ts +5 -0
  38. package/dist-esm/src/DataModels.js +1 -1
  39. package/dist-esm/src/ESPromise.d.ts +5 -5
  40. package/dist-esm/src/ESPromise.js +15 -15
  41. package/dist-esm/src/ESPromise.js.map +1 -1
  42. package/dist-esm/src/ESPromiseScheduler.d.ts +4 -4
  43. package/dist-esm/src/ESPromiseScheduler.js +8 -8
  44. package/dist-esm/src/ESPromiseScheduler.js.map +1 -1
  45. package/dist-esm/src/Enums.d.ts +6 -5
  46. package/dist-esm/src/Enums.js +61 -61
  47. package/dist-esm/src/Enums.js.map +1 -1
  48. package/dist-esm/src/Index.d.ts +1 -2
  49. package/dist-esm/src/Index.js +3 -3
  50. package/dist-esm/src/Index.js.map +1 -1
  51. package/dist-esm/src/InternalConstants.d.ts +6 -0
  52. package/dist-esm/src/InternalConstants.js +19 -0
  53. package/dist-esm/src/InternalConstants.js.map +1 -0
  54. package/dist-esm/src/Utils.d.ts +9 -3
  55. package/dist-esm/src/Utils.js +40 -39
  56. package/dist-esm/src/Utils.js.map +1 -1
  57. package/dist-esm/src/ValueSanitizer.d.ts +1 -1
  58. package/dist-esm/src/ValueSanitizer.js +19 -18
  59. package/dist-esm/src/ValueSanitizer.js.map +1 -1
  60. package/package.json +4 -3
  61. package/src/AppInsightsCore.ts +29 -31
  62. package/src/BaseCore.ts +14 -11
  63. package/src/DataModels.ts +6 -0
  64. package/src/ESPromise.ts +6 -6
  65. package/src/ESPromiseScheduler.ts +8 -8
  66. package/src/Enums.ts +5 -5
  67. package/src/Index.ts +3 -3
  68. package/src/InternalConstants.ts +16 -0
  69. package/src/Utils.ts +24 -24
  70. package/src/ValueSanitizer.ts +5 -4
  71. package/bundle/ms.core-3.2.2.gbl.js.map +0 -1
  72. package/bundle/ms.core-3.2.2.gbl.min.js +0 -7
  73. package/bundle/ms.core-3.2.2.gbl.min.js.map +0 -1
  74. package/bundle/ms.core-3.2.2.integrity.json +0 -46
  75. package/bundle/ms.core-3.2.2.js.map +0 -1
  76. package/bundle/ms.core-3.2.2.min.js +0 -7
  77. package/bundle/ms.core-3.2.2.min.js.map +0 -1
package/bundle/ms.core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * 1DS JS SDK Core, 3.2.2
2
+ * 1DS JS SDK Core, 3.2.5
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -103,26 +103,79 @@
103
103
 
104
104
  var MinChannelPriorty = 100;
105
105
 
106
- var strEmpty = "";
107
- var strProcessTelemetry = "processTelemetry";
108
- var strPriority = "priority";
109
- var strSetNextPlugin = "setNextPlugin";
110
- var strIsInitialized = "isInitialized";
111
- var strTeardown = "teardown";
112
- var strCore = "core";
113
- var strUpdate = "update";
114
- var strDisabled = "disabled";
115
- var strDoTeardown = "_doTeardown";
116
- var strProcessNext = "processNext";
117
- var strResume = "resume";
118
- var strPause = "pause";
119
- var strNotificationListener = "NotificationListener";
120
- var strAddNotificationListener = "add" + strNotificationListener;
121
- var strRemoveNotificationListener = "remove" + strNotificationListener;
122
- var strEventsSent = "eventsSent";
123
- var strEventsDiscarded = "eventsDiscarded";
124
- var strEventsSendRequest = "eventsSendRequest";
125
- var strPerfEvent = "perfEvent";
106
+ var _DYN_INITIALIZE = "initialize";
107
+ var _DYN_NAME = "name";
108
+ var _DYN_GET_NOTIFY_MGR = "getNotifyMgr";
109
+ var _DYN_IDENTIFIER = "identifier";
110
+ var _DYN_PUSH = "push";
111
+ var _DYN_IS_INITIALIZED = "isInitialized";
112
+ var _DYN_CONFIG = "config";
113
+ var _DYN_INSTRUMENTATION_KEY = "instrumentationKey";
114
+ var _DYN_LOGGER = "logger";
115
+ var _DYN_LENGTH = "length";
116
+ var _DYN_TIME = "time";
117
+ var _DYN_PROCESS_NEXT = "processNext";
118
+ var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
119
+ var _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener";
120
+ var _DYN_REMOVE_NOTIFICATION_2 = "removeNotificationListener";
121
+ var _DYN_STOP_POLLING_INTERNA3 = "stopPollingInternalLogs";
122
+ var _DYN_ON_COMPLETE = "onComplete";
123
+ var _DYN_GET_PLUGIN = "getPlugin";
124
+ var _DYN_FLUSH = "flush";
125
+ var _DYN__EXTENSIONS = "_extensions";
126
+ var _DYN_SPLICE = "splice";
127
+ var _DYN_TEARDOWN = "teardown";
128
+ var _DYN_MESSAGE_ID = "messageId";
129
+ var _DYN_MESSAGE = "message";
130
+ var _DYN_IS_ASYNC = "isAsync";
131
+ var _DYN__DO_TEARDOWN = "_doTeardown";
132
+ var _DYN_UPDATE = "update";
133
+ var _DYN_GET_NEXT = "getNext";
134
+ var _DYN_DIAG_LOG = "diagLog";
135
+ var _DYN_SET_NEXT_PLUGIN = "setNextPlugin";
136
+ var _DYN_CREATE_NEW = "createNew";
137
+ var _DYN_COOKIE_CFG = "cookieCfg";
138
+ var _DYN_INDEX_OF = "indexOf";
139
+ var _DYN_SUBSTRING = "substring";
140
+ var _DYN_USER_AGENT = "userAgent";
141
+ var _DYN_SPLIT = "split";
142
+ var _DYN_SET_ENABLED = "setEnabled";
143
+ var _DYN_SUBSTR = "substr";
144
+ var _DYN_NODE_TYPE = "nodeType";
145
+ var _DYN_APPLY = "apply";
146
+ var _DYN_REPLACE = "replace";
147
+ var _DYN_ENABLE_DEBUG_EXCEPTI4 = "enableDebugExceptions";
148
+ var _DYN_LOG_INTERNAL_MESSAGE = "logInternalMessage";
149
+ var _DYN_TO_LOWER_CASE = "toLowerCase";
150
+ var _DYN_CALL = "call";
151
+ var _DYN_TYPE = "type";
152
+ var _DYN_HANDLER = "handler";
153
+ var _DYN_LISTENERS = "listeners";
154
+ var _DYN_IS_CHILD_EVT = "isChildEvt";
155
+ var _DYN_GET_CTX = "getCtx";
156
+ var _DYN_SET_CTX = "setCtx";
157
+ var _DYN_COMPLETE = "complete";
158
+ var _DYN_TRACE_ID = "traceId";
159
+ var _DYN_SPAN_ID = "spanId";
160
+ var _DYN_TRACE_FLAGS = "traceFlags";
161
+ var _DYN_VERSION = "version";
162
+
163
+ var STR_EMPTY$1 = "";
164
+ var STR_CHANNELS = "channels";
165
+ var STR_CORE = "core";
166
+ var STR_CREATE_PERF_MGR = "createPerfMgr";
167
+ var STR_DISABLED = "disabled";
168
+ var STR_EXTENSION_CONFIG = "extensionConfig";
169
+ var STR_EXTENSIONS = "extensions";
170
+ var STR_PROCESS_TELEMETRY = "processTelemetry";
171
+ var STR_PRIORITY = "priority";
172
+ var STR_EVENTS_SENT = "eventsSent";
173
+ var STR_EVENTS_DISCARDED = "eventsDiscarded";
174
+ var STR_EVENTS_SEND_REQUEST = "eventsSendRequest";
175
+ var STR_PERF_EVENT = "perfEvent";
176
+ var STR_ERROR_TO_CONSOLE = "errorToConsole";
177
+ var STR_WARN_TO_CONSOLE = "warnToConsole";
178
+ var STR_GET_PERF_MGR = "getPerfMgr";
126
179
 
127
180
  var strToISOString = "toISOString";
128
181
  var cStrEndsWith = "endsWith";
@@ -147,7 +200,7 @@
147
200
  var _isArray = Array.isArray;
148
201
  var _objToString = ObjProto[strToString];
149
202
  var _fnToString = ObjHasOwnProperty[strToString];
150
- var _objFunctionString = _fnToString.call(ObjClass);
203
+ var _objFunctionString = _fnToString[_DYN_CALL ](ObjClass);
151
204
  var rCamelCase = /-([a-z])/g;
152
205
  var rNormalizeInvalid = /([^\w\d_$])/g;
153
206
  var rLeadingNumeric = /^(\d+[\w\d_$])/;
@@ -177,7 +230,7 @@
177
230
  return !isNullOrUndefined(value);
178
231
  }
179
232
  function hasOwnProperty(obj, prop) {
180
- return !!(obj && ObjHasOwnProperty.call(obj, prop));
233
+ return !!(obj && ObjHasOwnProperty[_DYN_CALL ](obj, prop));
181
234
  }
182
235
  function isObject(value) {
183
236
  return !!(value && typeof value === strShimObject);
@@ -188,11 +241,11 @@
188
241
  function normalizeJsName(name) {
189
242
  var value = name;
190
243
  if (value && isString(value)) {
191
- value = value.replace(rCamelCase, function (_all, letter) {
244
+ value = value[_DYN_REPLACE ](rCamelCase, function (_all, letter) {
192
245
  return letter.toUpperCase();
193
246
  });
194
- value = value.replace(rNormalizeInvalid, "_");
195
- value = value.replace(rLeadingNumeric, function (_all, match) {
247
+ value = value[_DYN_REPLACE ](rNormalizeInvalid, "_");
248
+ value = value[_DYN_REPLACE ](rLeadingNumeric, function (_all, match) {
196
249
  return "_" + match;
197
250
  });
198
251
  }
@@ -201,8 +254,8 @@
201
254
  function objForEachKey(target, callbackfn) {
202
255
  if (target) {
203
256
  for (var prop in target) {
204
- if (ObjHasOwnProperty.call(target, prop)) {
205
- callbackfn.call(target, prop, target[prop]);
257
+ if (ObjHasOwnProperty[_DYN_CALL ](target, prop)) {
258
+ callbackfn[_DYN_CALL ](target, prop, target[prop]);
206
259
  }
207
260
  }
208
261
  }
@@ -216,8 +269,8 @@
216
269
  }
217
270
  function _strEndsWithPoly(value, search) {
218
271
  var result = false;
219
- var searchLen = search ? search.length : 0;
220
- var valLen = value ? value.length : 0;
272
+ var searchLen = search ? search[_DYN_LENGTH ] : 0;
273
+ var valLen = value ? value[_DYN_LENGTH ] : 0;
221
274
  if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {
222
275
  var pos = valLen - 1;
223
276
  for (var lp = searchLen - 1; lp >= 0; lp--) {
@@ -239,8 +292,8 @@
239
292
  }
240
293
  function _strStartsWithPoly(value, checkValue) {
241
294
  var result = false;
242
- var chkLen = checkValue ? checkValue.length : 0;
243
- if (value && chkLen && value.length >= chkLen && !(result = value === checkValue)) {
295
+ var chkLen = checkValue ? checkValue[_DYN_LENGTH ] : 0;
296
+ if (value && chkLen && value[_DYN_LENGTH ] >= chkLen && !(result = value === checkValue)) {
244
297
  for (var lp = 0; lp < chkLen; lp++) {
245
298
  if (value[lp] !== checkValue[lp]) {
246
299
  return false;
@@ -252,19 +305,19 @@
252
305
  }
253
306
  function strContains(value, search) {
254
307
  if (value && search) {
255
- return value.indexOf(search) !== -1;
308
+ return value[_DYN_INDEX_OF ](search) !== -1;
256
309
  }
257
310
  return false;
258
311
  }
259
312
  function isDate(obj) {
260
- return !!(obj && _objToString.call(obj) === "[object Date]");
313
+ return !!(obj && _objToString[_DYN_CALL ](obj) === "[object Date]");
261
314
  }
262
315
  var isArray = _isArray || _isArrayPoly;
263
316
  function _isArrayPoly(obj) {
264
- return !!(obj && _objToString.call(obj) === "[object Array]");
317
+ return !!(obj && _objToString[_DYN_CALL ](obj) === "[object Array]");
265
318
  }
266
319
  function isError(obj) {
267
- return !!(obj && _objToString.call(obj) === "[object Error]");
320
+ return !!(obj && _objToString[_DYN_CALL ](obj) === "[object Error]");
268
321
  }
269
322
  function isString(value) {
270
323
  return typeof value === "string";
@@ -283,10 +336,10 @@
283
336
  result = true;
284
337
  }
285
338
  else {
286
- if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
339
+ if (proto[strConstructor] && ObjHasOwnProperty[_DYN_CALL ](proto, strConstructor)) {
287
340
  proto = proto[strConstructor];
288
341
  }
289
- result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
342
+ result = typeof proto === strShimFunction && _fnToString[_DYN_CALL ](proto) === _objFunctionString;
290
343
  }
291
344
  }
292
345
  return result;
@@ -300,7 +353,7 @@
300
353
  if (date && date.getUTCFullYear) {
301
354
  var pad = function (num) {
302
355
  var r = String(num);
303
- if (r.length === 1) {
356
+ if (r[_DYN_LENGTH ] === 1) {
304
357
  r = "0" + r;
305
358
  }
306
359
  return r;
@@ -316,11 +369,11 @@
316
369
  }
317
370
  }
318
371
  function arrForEach(arr, callbackfn, thisArg) {
319
- var len = arr.length;
372
+ var len = arr[_DYN_LENGTH ];
320
373
  try {
321
374
  for (var idx = 0; idx < len; idx++) {
322
375
  if (idx in arr) {
323
- if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
376
+ if (callbackfn[_DYN_CALL ](thisArg || arr, arr[idx], idx, arr) === -1) {
324
377
  break;
325
378
  }
326
379
  }
@@ -334,7 +387,7 @@
334
387
  if (arr[strIndexOf]) {
335
388
  return arr[strIndexOf](searchElement, fromIndex);
336
389
  }
337
- var len = arr.length;
390
+ var len = arr[_DYN_LENGTH ];
338
391
  var from = fromIndex || 0;
339
392
  try {
340
393
  for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
@@ -354,13 +407,13 @@
354
407
  if (arr[strMap]) {
355
408
  return arr[strMap](callbackfn, thisArg);
356
409
  }
357
- var len = arr.length;
410
+ var len = arr[_DYN_LENGTH ];
358
411
  var _this = thisArg || arr;
359
412
  results = new Array(len);
360
413
  try {
361
414
  for (var lp = 0; lp < len; lp++) {
362
415
  if (lp in arr) {
363
- results[lp] = callbackfn.call(_this, arr[lp], arr);
416
+ results[lp] = callbackfn[_DYN_CALL ](_this, arr[lp], arr);
364
417
  }
365
418
  }
366
419
  }
@@ -375,9 +428,9 @@
375
428
  if (arr[strReduce]) {
376
429
  return arr[strReduce](callbackfn, initialValue);
377
430
  }
378
- var len = arr.length;
431
+ var len = arr[_DYN_LENGTH ];
379
432
  var lp = 0;
380
- if (arguments.length >= 3) {
433
+ if (arguments[_DYN_LENGTH ] >= 3) {
381
434
  value = arguments[2];
382
435
  }
383
436
  else {
@@ -397,7 +450,7 @@
397
450
  }
398
451
  function strTrim(str) {
399
452
  if (str) {
400
- str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
453
+ str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str[_DYN_REPLACE ] ? str[_DYN_REPLACE ](/^\s+|\s+$/g, STR_EMPTY$1) : str);
401
454
  }
402
455
  return str;
403
456
  }
@@ -421,15 +474,15 @@
421
474
  }
422
475
  var result = [];
423
476
  for (var prop in obj) {
424
- if (obj && ObjHasOwnProperty.call(obj, prop)) {
425
- result.push(prop);
477
+ if (obj && ObjHasOwnProperty[_DYN_CALL ](obj, prop)) {
478
+ result[_DYN_PUSH ](prop);
426
479
  }
427
480
  }
428
481
  if (_objKeysHasDontEnumBug) {
429
- var dontEnumsLength = _objKeysDontEnums.length;
482
+ var dontEnumsLength = _objKeysDontEnums[_DYN_LENGTH ];
430
483
  for (var lp = 0; lp < dontEnumsLength; lp++) {
431
- if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
432
- result.push(_objKeysDontEnums[lp]);
484
+ if (obj && ObjHasOwnProperty[_DYN_CALL ](obj, _objKeysDontEnums[lp])) {
485
+ result[_DYN_PUSH ](_objKeysDontEnums[lp]);
433
486
  }
434
487
  }
435
488
  }
@@ -477,9 +530,9 @@
477
530
  }
478
531
  function getExceptionName(object) {
479
532
  if (isError(object)) {
480
- return object.name;
533
+ return object[_DYN_NAME ];
481
534
  }
482
- return strEmpty;
535
+ return STR_EMPTY$1;
483
536
  }
484
537
  function setValue(target, field, value, valChk, srcChk) {
485
538
  var theValue = value;
@@ -506,6 +559,9 @@
506
559
  }
507
560
  return theValue;
508
561
  }
562
+ function getCfgValue(theValue, defaultValue) {
563
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
564
+ }
509
565
  function isNotTruthy(value) {
510
566
  return !value;
511
567
  }
@@ -530,7 +586,7 @@
530
586
  src = srcFunc();
531
587
  }
532
588
  if (src) {
533
- return src[funcName].apply(src, originalArguments);
589
+ return src[funcName][_DYN_APPLY ](src, originalArguments);
534
590
  }
535
591
  };
536
592
  }
@@ -590,7 +646,7 @@
590
646
  function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
591
647
  var theArgs = arguments;
592
648
  var extended = theArgs[0] || {};
593
- var argLen = theArgs.length;
649
+ var argLen = theArgs[_DYN_LENGTH ];
594
650
  var deep = false;
595
651
  var idx = 1;
596
652
  if (argLen > 0 && isBoolean(extended)) {
@@ -606,7 +662,7 @@
606
662
  var isArgArray = isArray(arg);
607
663
  var isArgObj = isObject(arg);
608
664
  for (var prop in arg) {
609
- var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
665
+ var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty[_DYN_CALL ](arg, prop)));
610
666
  if (!propOk) {
611
667
  continue;
612
668
  }
@@ -1037,9 +1093,9 @@
1037
1093
  }
1038
1094
  function isIE() {
1039
1095
  var nav = getNavigator();
1040
- if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
1041
- _navUserAgentCheck = nav.userAgent;
1042
- var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
1096
+ if (nav && (nav[_DYN_USER_AGENT ] !== _navUserAgentCheck || _isTrident === null)) {
1097
+ _navUserAgentCheck = nav[_DYN_USER_AGENT ];
1098
+ var userAgent = (_navUserAgentCheck || STR_EMPTY$1)[_DYN_TO_LOWER_CASE ]();
1043
1099
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
1044
1100
  }
1045
1101
  return _isTrident;
@@ -1048,15 +1104,15 @@
1048
1104
  if (userAgentStr === void 0) { userAgentStr = null; }
1049
1105
  if (!userAgentStr) {
1050
1106
  var navigator_1 = getNavigator() || {};
1051
- userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty).toLowerCase() : strEmpty;
1107
+ userAgentStr = navigator_1 ? (navigator_1[_DYN_USER_AGENT ] || STR_EMPTY$1)[_DYN_TO_LOWER_CASE ]() : STR_EMPTY$1;
1052
1108
  }
1053
- var ua = (userAgentStr || strEmpty).toLowerCase();
1109
+ var ua = (userAgentStr || STR_EMPTY$1)[_DYN_TO_LOWER_CASE ]();
1054
1110
  if (strContains(ua, strMsie)) {
1055
1111
  var doc = getDocument() || {};
1056
- return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
1112
+ return Math.max(parseInt(ua[_DYN_SPLIT ](strMsie)[1]), (doc[strDocumentMode] || 0));
1057
1113
  }
1058
1114
  else if (strContains(ua, strTrident)) {
1059
- var tridentVer = parseInt(ua.split(strTrident)[1]);
1115
+ var tridentVer = parseInt(ua[_DYN_SPLIT ](strTrident)[1]);
1060
1116
  if (tridentVer) {
1061
1117
  return tridentVer + 4;
1062
1118
  }
@@ -1064,10 +1120,10 @@
1064
1120
  return null;
1065
1121
  }
1066
1122
  function dumpObj(object) {
1067
- var objectTypeDump = Object[strShimPrototype].toString.call(object);
1068
- var propertyValueDump = strEmpty;
1123
+ var objectTypeDump = Object[strShimPrototype].toString[_DYN_CALL ](object);
1124
+ var propertyValueDump = STR_EMPTY$1;
1069
1125
  if (objectTypeDump === "[object Error]") {
1070
- propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
1126
+ propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object[_DYN_NAME ] + "'";
1071
1127
  }
1072
1128
  else if (hasJSON()) {
1073
1129
  propertyValueDump = getJSON().stringify(object);
@@ -1112,6 +1168,35 @@
1112
1168
  }
1113
1169
  return isSupported;
1114
1170
  }
1171
+ function _getNamedValue(values, name) {
1172
+ if (values) {
1173
+ for (var i = 0; i < values[_DYN_LENGTH ]; i++) {
1174
+ var value = values[i];
1175
+ if (value[_DYN_NAME ]) {
1176
+ if (value[_DYN_NAME ] === name) {
1177
+ return value;
1178
+ }
1179
+ }
1180
+ }
1181
+ }
1182
+ return {};
1183
+ }
1184
+ function findMetaTag(name) {
1185
+ var doc = getDocument();
1186
+ if (doc && name) {
1187
+ return _getNamedValue(doc.querySelectorAll("meta"), name).content;
1188
+ }
1189
+ return null;
1190
+ }
1191
+ function findNamedServerTiming(name) {
1192
+ var value;
1193
+ var perf = getPerformance();
1194
+ if (perf) {
1195
+ var navPerf = perf.getEntriesByType("navigation") || [];
1196
+ value = _getNamedValue((navPerf[_DYN_LENGTH ] > 0 ? navPerf[0] : {}).serverTiming, name).description;
1197
+ }
1198
+ return value;
1199
+ }
1115
1200
 
1116
1201
  var listenerFuncs = ["eventsSent", "eventsDiscarded", "eventsSendRequest", "perfEvent"];
1117
1202
  var _aiNamespace = null;
@@ -1123,7 +1208,7 @@
1123
1208
  if (dbgExt) {
1124
1209
  var listener = dbgExt.listener;
1125
1210
  if (listener && listener[name]) {
1126
- listener[name].apply(listener, args);
1211
+ listener[name][_DYN_APPLY ](listener, args);
1127
1212
  }
1128
1213
  }
1129
1214
  };
@@ -1145,7 +1230,7 @@
1145
1230
  function getDebugListener(config) {
1146
1231
  if (!_debugListener) {
1147
1232
  _debugListener = {};
1148
- for (var lp = 0; lp < listenerFuncs.length; lp++) {
1233
+ for (var lp = 0; lp < listenerFuncs[_DYN_LENGTH ]; lp++) {
1149
1234
  _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);
1150
1235
  }
1151
1236
  }
@@ -1155,13 +1240,11 @@
1155
1240
  var AiNonUserActionablePrefix = "AI (Internal): ";
1156
1241
  var AiUserActionablePrefix = "AI: ";
1157
1242
  var AIInternalMessagePrefix = "AITR_";
1158
- var strErrorToConsole = "errorToConsole";
1159
- var strWarnToConsole = "warnToConsole";
1160
1243
  function _sanitizeDiagnosticText(text) {
1161
1244
  if (text) {
1162
- return "\"" + text.replace(/\"/g, strEmpty) + "\"";
1245
+ return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY$1) + "\"";
1163
1246
  }
1164
- return strEmpty;
1247
+ return STR_EMPTY$1;
1165
1248
  }
1166
1249
  function _logToConsole(func, message) {
1167
1250
  var theConsole = getConsole();
@@ -1179,23 +1262,23 @@
1179
1262
  function _InternalLogMessage(msgId, msg, isUserAct, properties) {
1180
1263
  if (isUserAct === void 0) { isUserAct = false; }
1181
1264
  var _self = this;
1182
- _self.messageId = msgId;
1183
- _self.message =
1265
+ _self[_DYN_MESSAGE_ID ] = msgId;
1266
+ _self[_DYN_MESSAGE ] =
1184
1267
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
1185
1268
  msgId;
1186
- var strProps = strEmpty;
1269
+ var strProps = STR_EMPTY$1;
1187
1270
  if (hasJSON()) {
1188
1271
  strProps = getJSON().stringify(properties);
1189
1272
  }
1190
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty) +
1191
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty);
1192
- _self.message += diagnosticText;
1273
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$1) +
1274
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$1);
1275
+ _self[_DYN_MESSAGE ] += diagnosticText;
1193
1276
  }
1194
1277
  _InternalLogMessage.dataType = "MessageData";
1195
1278
  return _InternalLogMessage;
1196
1279
  }());
1197
1280
  function safeGetLogger(core, config) {
1198
- return (core || {}).logger || new DiagnosticLogger(config);
1281
+ return (core || {})[_DYN_LOGGER ] || new DiagnosticLogger(config);
1199
1282
  }
1200
1283
  var DiagnosticLogger = /** @class */ (function () {
1201
1284
  function DiagnosticLogger(config) {
@@ -1203,48 +1286,49 @@
1203
1286
  this.queue = [];
1204
1287
  var _messageCount = 0;
1205
1288
  var _messageLogged = {};
1289
+ var _loggingLevelConsole;
1290
+ var _loggingLevelTelemetry;
1291
+ var _maxInternalMessageLimit;
1292
+ var _enableDebugExceptions;
1206
1293
  dynamicProto(DiagnosticLogger, this, function (_self) {
1207
- if (isNullOrUndefined(config)) {
1208
- config = {};
1209
- }
1210
- _self.consoleLoggingLevel = function () { return _getConfigValue("loggingLevelConsole", 0); };
1211
- _self.telemetryLoggingLevel = function () { return _getConfigValue("loggingLevelTelemetry", 1); };
1212
- _self.maxInternalMessageLimit = function () { return _getConfigValue("maxMessageLimit", 25); };
1213
- _self.enableDebugExceptions = function () { return _getConfigValue("enableDebugExceptions", false); };
1294
+ _setDefaultsFromConfig(config || {});
1295
+ _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
1296
+ _self.telemetryLoggingLevel = function () { return _loggingLevelTelemetry; };
1297
+ _self.maxInternalMessageLimit = function () { return _maxInternalMessageLimit; };
1298
+ _self[_DYN_ENABLE_DEBUG_EXCEPTI4 ] = function () { return _enableDebugExceptions; };
1214
1299
  _self.throwInternal = function (severity, msgId, msg, properties, isUserAct) {
1215
1300
  if (isUserAct === void 0) { isUserAct = false; }
1216
1301
  var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
1217
- if (_self.enableDebugExceptions()) {
1302
+ if (_enableDebugExceptions) {
1218
1303
  throw dumpObj(message);
1219
1304
  }
1220
1305
  else {
1221
- var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
1222
- if (!isUndefined(message.message)) {
1223
- var logLevel = _self.consoleLoggingLevel();
1306
+ var logFunc = severity === 1 ? STR_ERROR_TO_CONSOLE : STR_WARN_TO_CONSOLE;
1307
+ if (!isUndefined(message[_DYN_MESSAGE ])) {
1224
1308
  if (isUserAct) {
1225
- var messageKey = +message.messageId;
1226
- if (!_messageLogged[messageKey] && logLevel >= severity) {
1227
- _self[logFunc](message.message);
1309
+ var messageKey = +message[_DYN_MESSAGE_ID ];
1310
+ if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {
1311
+ _self[logFunc](message[_DYN_MESSAGE ]);
1228
1312
  _messageLogged[messageKey] = true;
1229
1313
  }
1230
1314
  }
1231
1315
  else {
1232
- if (logLevel >= severity) {
1233
- _self[logFunc](message.message);
1316
+ if (_loggingLevelConsole >= severity) {
1317
+ _self[logFunc](message[_DYN_MESSAGE ]);
1234
1318
  }
1235
1319
  }
1236
- _self.logInternalMessage(severity, message);
1320
+ _logInternalMessage(severity, message);
1237
1321
  }
1238
1322
  else {
1239
1323
  _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
1240
1324
  }
1241
1325
  }
1242
1326
  };
1243
- _self.warnToConsole = function (message) {
1327
+ _self[STR_WARN_TO_CONSOLE ] = function (message) {
1244
1328
  _logToConsole("warn", message);
1245
1329
  _debugExtMsg("warning", message);
1246
1330
  };
1247
- _self.errorToConsole = function (message) {
1331
+ _self[STR_ERROR_TO_CONSOLE ] = function (message) {
1248
1332
  _logToConsole("error", message);
1249
1333
  _debugExtMsg("error", message);
1250
1334
  };
@@ -1252,12 +1336,13 @@
1252
1336
  _messageCount = 0;
1253
1337
  _messageLogged = {};
1254
1338
  };
1255
- _self.logInternalMessage = function (severity, message) {
1339
+ _self[_DYN_LOG_INTERNAL_MESSAGE ] = _logInternalMessage;
1340
+ function _logInternalMessage(severity, message) {
1256
1341
  if (_areInternalMessagesThrottled()) {
1257
1342
  return;
1258
1343
  }
1259
1344
  var logMessage = true;
1260
- var messageKey = AIInternalMessagePrefix + message.messageId;
1345
+ var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID ];
1261
1346
  if (_messageLogged[messageKey]) {
1262
1347
  logMessage = false;
1263
1348
  }
@@ -1265,42 +1350,42 @@
1265
1350
  _messageLogged[messageKey] = true;
1266
1351
  }
1267
1352
  if (logMessage) {
1268
- if (severity <= _self.telemetryLoggingLevel()) {
1269
- _self.queue.push(message);
1353
+ if (severity <= _loggingLevelTelemetry) {
1354
+ _self.queue[_DYN_PUSH ](message);
1270
1355
  _messageCount++;
1271
1356
  _debugExtMsg((severity === 1 ? "error" : "warn"), message);
1272
1357
  }
1273
- if (_messageCount === _self.maxInternalMessageLimit()) {
1358
+ if (_messageCount === _maxInternalMessageLimit) {
1274
1359
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
1275
1360
  var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
1276
- _self.queue.push(throttleMessage);
1361
+ _self.queue[_DYN_PUSH ](throttleMessage);
1277
1362
  if (severity === 1 ) {
1278
- _self.errorToConsole(throttleLimitMessage);
1363
+ _self[STR_ERROR_TO_CONSOLE ](throttleLimitMessage);
1279
1364
  }
1280
1365
  else {
1281
- _self.warnToConsole(throttleLimitMessage);
1366
+ _self[STR_WARN_TO_CONSOLE ](throttleLimitMessage);
1282
1367
  }
1283
1368
  }
1284
1369
  }
1285
- };
1286
- function _getConfigValue(name, defValue) {
1287
- var value = config[name];
1288
- if (!isNullOrUndefined(value)) {
1289
- return value;
1290
- }
1291
- return defValue;
1370
+ }
1371
+ function _setDefaultsFromConfig(config) {
1372
+ _loggingLevelConsole = getCfgValue(config.loggingLevelConsole, 0);
1373
+ _loggingLevelTelemetry = getCfgValue(config.loggingLevelTelemetry, 1);
1374
+ _maxInternalMessageLimit = getCfgValue(config.maxMessageLimit, 25);
1375
+ _enableDebugExceptions = getCfgValue(config[_DYN_ENABLE_DEBUG_EXCEPTI4 ], false);
1292
1376
  }
1293
1377
  function _areInternalMessagesThrottled() {
1294
- return _messageCount >= _self.maxInternalMessageLimit();
1378
+ return _messageCount >= _maxInternalMessageLimit;
1295
1379
  }
1296
1380
  function _debugExtMsg(name, data) {
1297
- var dbgExt = getDebugExt(config);
1298
- if (dbgExt && dbgExt.diagLog) {
1299
- dbgExt.diagLog(name, data);
1381
+ var dbgExt = getDebugExt(config || {});
1382
+ if (dbgExt && dbgExt[_DYN_DIAG_LOG ]) {
1383
+ dbgExt[_DYN_DIAG_LOG ](name, data);
1300
1384
  }
1301
1385
  }
1302
1386
  });
1303
1387
  }
1388
+ DiagnosticLogger.__ieDyn=1;
1304
1389
  return DiagnosticLogger;
1305
1390
  }());
1306
1391
  function _getLogger(logger) {
@@ -1308,22 +1393,27 @@
1308
1393
  }
1309
1394
  function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
1310
1395
  if (isUserAct === void 0) { isUserAct = false; }
1311
- (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
1396
+ _getLogger(logger).throwInternal(severity, msgId, msg, properties, isUserAct);
1312
1397
  }
1313
1398
  function _warnToConsole(logger, message) {
1314
- _getLogger(logger).warnToConsole(message);
1399
+ _getLogger(logger)[STR_WARN_TO_CONSOLE ](message);
1400
+ }
1401
+ function _logInternalMessage(logger, severity, message) {
1402
+ _getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE ](severity, message);
1315
1403
  }
1316
1404
 
1317
1405
  var strExecutionContextKey = "ctx";
1406
+ var strParentContextKey = "ParentContextKey";
1407
+ var strChildrenContextKey = "ChildrenContextKey";
1318
1408
  var _defaultPerfManager = null;
1319
1409
  var PerfEvent = /** @class */ (function () {
1320
1410
  function PerfEvent(name, payloadDetails, isAsync) {
1321
1411
  var _self = this;
1322
1412
  var accessorDefined = false;
1323
1413
  _self.start = dateNow();
1324
- _self.name = name;
1325
- _self.isAsync = isAsync;
1326
- _self.isChildEvt = function () { return false; };
1414
+ _self[_DYN_NAME ] = name;
1415
+ _self[_DYN_IS_ASYNC ] = isAsync;
1416
+ _self[_DYN_IS_CHILD_EVT ] = function () { return false; };
1327
1417
  if (isFunction(payloadDetails)) {
1328
1418
  var theDetails_1;
1329
1419
  accessorDefined = objDefineAccessors(_self, "payload", function () {
@@ -1334,24 +1424,24 @@
1334
1424
  return theDetails_1;
1335
1425
  });
1336
1426
  }
1337
- _self.getCtx = function (key) {
1427
+ _self[_DYN_GET_CTX ] = function (key) {
1338
1428
  if (key) {
1339
- if (key === PerfEvent.ParentContextKey || key === PerfEvent.ChildrenContextKey) {
1429
+ if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {
1340
1430
  return _self[key];
1341
1431
  }
1342
1432
  return (_self[strExecutionContextKey] || {})[key];
1343
1433
  }
1344
1434
  return null;
1345
1435
  };
1346
- _self.setCtx = function (key, value) {
1436
+ _self[_DYN_SET_CTX ] = function (key, value) {
1347
1437
  if (key) {
1348
- if (key === PerfEvent.ParentContextKey) {
1438
+ if (key === PerfEvent[strParentContextKey]) {
1349
1439
  if (!_self[key]) {
1350
- _self.isChildEvt = function () { return true; };
1440
+ _self[_DYN_IS_CHILD_EVT ] = function () { return true; };
1351
1441
  }
1352
1442
  _self[key] = value;
1353
1443
  }
1354
- else if (key === PerfEvent.ChildrenContextKey) {
1444
+ else if (key === PerfEvent[strChildrenContextKey]) {
1355
1445
  _self[key] = value;
1356
1446
  }
1357
1447
  else {
@@ -1360,20 +1450,20 @@
1360
1450
  }
1361
1451
  }
1362
1452
  };
1363
- _self.complete = function () {
1453
+ _self[_DYN_COMPLETE ] = function () {
1364
1454
  var childTime = 0;
1365
- var childEvts = _self.getCtx(PerfEvent.ChildrenContextKey);
1455
+ var childEvts = _self[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
1366
1456
  if (isArray(childEvts)) {
1367
- for (var lp = 0; lp < childEvts.length; lp++) {
1457
+ for (var lp = 0; lp < childEvts[_DYN_LENGTH ]; lp++) {
1368
1458
  var childEvt = childEvts[lp];
1369
1459
  if (childEvt) {
1370
- childTime += childEvt.time;
1460
+ childTime += childEvt[_DYN_TIME ];
1371
1461
  }
1372
1462
  }
1373
1463
  }
1374
- _self.time = dateNow() - _self.start;
1375
- _self.exTime = _self.time - childTime;
1376
- _self.complete = function () { };
1464
+ _self[_DYN_TIME ] = dateNow() - _self.start;
1465
+ _self.exTime = _self[_DYN_TIME ] - childTime;
1466
+ _self[_DYN_COMPLETE ] = function () { };
1377
1467
  if (!accessorDefined && isFunction(payloadDetails)) {
1378
1468
  _self.payload = payloadDetails();
1379
1469
  }
@@ -1392,63 +1482,64 @@
1392
1482
  };
1393
1483
  _self.fire = function (perfEvent) {
1394
1484
  if (perfEvent) {
1395
- perfEvent.complete();
1396
- if (manager && isFunction(manager.perfEvent)) {
1397
- manager.perfEvent(perfEvent);
1485
+ perfEvent[_DYN_COMPLETE ]();
1486
+ if (manager && isFunction(manager[STR_PERF_EVENT ])) {
1487
+ manager[STR_PERF_EVENT ](perfEvent);
1398
1488
  }
1399
1489
  }
1400
1490
  };
1401
- _self.setCtx = function (key, value) {
1491
+ _self[_DYN_SET_CTX ] = function (key, value) {
1402
1492
  if (key) {
1403
1493
  var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
1404
1494
  ctx[key] = value;
1405
1495
  }
1406
1496
  };
1407
- _self.getCtx = function (key) {
1497
+ _self[_DYN_GET_CTX ] = function (key) {
1408
1498
  return (_self[strExecutionContextKey] || {})[key];
1409
1499
  };
1410
1500
  });
1411
1501
  }
1502
+ PerfManager.__ieDyn=1;
1412
1503
  return PerfManager;
1413
1504
  }());
1414
1505
  var doPerfActiveKey = "CoreUtils.doPerf";
1415
1506
  function doPerf(mgrSource, getSource, func, details, isAsync) {
1416
1507
  if (mgrSource) {
1417
1508
  var perfMgr = mgrSource;
1418
- if (isFunction(perfMgr["getPerfMgr"])) {
1419
- perfMgr = perfMgr["getPerfMgr"]();
1509
+ if (perfMgr[STR_GET_PERF_MGR]) {
1510
+ perfMgr = perfMgr[STR_GET_PERF_MGR]();
1420
1511
  }
1421
1512
  if (perfMgr) {
1422
1513
  var perfEvt = void 0;
1423
- var currentActive = perfMgr.getCtx(doPerfActiveKey);
1514
+ var currentActive = perfMgr[_DYN_GET_CTX ](doPerfActiveKey);
1424
1515
  try {
1425
1516
  perfEvt = perfMgr.create(getSource(), details, isAsync);
1426
1517
  if (perfEvt) {
1427
- if (currentActive && perfEvt.setCtx) {
1428
- perfEvt.setCtx(PerfEvent.ParentContextKey, currentActive);
1429
- if (currentActive.getCtx && currentActive.setCtx) {
1430
- var children = currentActive.getCtx(PerfEvent.ChildrenContextKey);
1518
+ if (currentActive && perfEvt[_DYN_SET_CTX ]) {
1519
+ perfEvt[_DYN_SET_CTX ](PerfEvent[strParentContextKey], currentActive);
1520
+ if (currentActive[_DYN_GET_CTX ] && currentActive[_DYN_SET_CTX ]) {
1521
+ var children = currentActive[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
1431
1522
  if (!children) {
1432
1523
  children = [];
1433
- currentActive.setCtx(PerfEvent.ChildrenContextKey, children);
1524
+ currentActive[_DYN_SET_CTX ](PerfEvent[strChildrenContextKey], children);
1434
1525
  }
1435
- children.push(perfEvt);
1526
+ children[_DYN_PUSH ](perfEvt);
1436
1527
  }
1437
1528
  }
1438
- perfMgr.setCtx(doPerfActiveKey, perfEvt);
1529
+ perfMgr[_DYN_SET_CTX ](doPerfActiveKey, perfEvt);
1439
1530
  return func(perfEvt);
1440
1531
  }
1441
1532
  }
1442
1533
  catch (ex) {
1443
- if (perfEvt && perfEvt.setCtx) {
1444
- perfEvt.setCtx("exception", ex);
1534
+ if (perfEvt && perfEvt[_DYN_SET_CTX ]) {
1535
+ perfEvt[_DYN_SET_CTX ]("exception", ex);
1445
1536
  }
1446
1537
  }
1447
1538
  finally {
1448
1539
  if (perfEvt) {
1449
1540
  perfMgr.fire(perfEvt);
1450
1541
  }
1451
- perfMgr.setCtx(doPerfActiveKey, currentActive);
1542
+ perfMgr[_DYN_SET_CTX ](doPerfActiveKey, currentActive);
1452
1543
  }
1453
1544
  }
1454
1545
  }
@@ -1527,8 +1618,8 @@
1527
1618
  var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1528
1619
  var number = random32() >>> 0;
1529
1620
  var chars = 0;
1530
- var result = strEmpty;
1531
- while (result.length < maxLength) {
1621
+ var result = STR_EMPTY$1;
1622
+ while (result[_DYN_LENGTH ] < maxLength) {
1532
1623
  chars++;
1533
1624
  result += base64chars.charAt(number & 0x3F);
1534
1625
  number >>>= 6;
@@ -1541,7 +1632,7 @@
1541
1632
  }
1542
1633
 
1543
1634
  var _objDefineProperty = ObjDefineProperty;
1544
- var version = "2.8.3";
1635
+ var version = '2.8.6';
1545
1636
  var instanceName = "." + newId(6);
1546
1637
  var _dataUid = 0;
1547
1638
  function _createAccessor(target, prop, value) {
@@ -1560,7 +1651,7 @@
1560
1651
  return false;
1561
1652
  }
1562
1653
  function _canAcceptData(target) {
1563
- return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
1654
+ return target[_DYN_NODE_TYPE ] === 1 || target[_DYN_NODE_TYPE ] === 9 || !(+target[_DYN_NODE_TYPE ]);
1564
1655
  }
1565
1656
  function _getCache(data, target) {
1566
1657
  var theCache = target[data.id];
@@ -1580,11 +1671,11 @@
1580
1671
  }
1581
1672
  function createUniqueNamespace(name, includeVersion) {
1582
1673
  if (includeVersion === void 0) { includeVersion = false; }
1583
- return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
1674
+ return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : STR_EMPTY$1) + instanceName);
1584
1675
  }
1585
1676
  function createElmNodeData(name) {
1586
1677
  var data = {
1587
- id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
1678
+ id: createUniqueNamespace("_aiData-" + (name || STR_EMPTY$1) + "." + version),
1588
1679
  accept: function (target) {
1589
1680
  return _canAcceptData(target);
1590
1681
  },
@@ -1612,201 +1703,943 @@
1612
1703
  return data;
1613
1704
  }
1614
1705
 
1615
- var pluginStateData = createElmNodeData("plugin");
1616
- function _getPluginState(plugin) {
1617
- return pluginStateData.get(plugin, "state", {}, true);
1706
+ var strToGMTString = "toGMTString";
1707
+ var strToUTCString = "toUTCString";
1708
+ var strCookie = "cookie";
1709
+ var strExpires = "expires";
1710
+ var strEnabled = "enabled";
1711
+ var strIsCookieUseDisabled = "isCookieUseDisabled";
1712
+ var strDisableCookiesUsage = "disableCookiesUsage";
1713
+ var strConfigCookieMgr = "_ckMgr";
1714
+ var _supportsCookies = null;
1715
+ var _allowUaSameSite = null;
1716
+ var _parsedCookieValue = null;
1717
+ var _doc = getDocument();
1718
+ var _cookieCache = {};
1719
+ var _globalCookieConfig = {};
1720
+ function _gblCookieMgr(config, logger) {
1721
+ var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
1722
+ if (!inst) {
1723
+ inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
1724
+ _globalCookieConfig[strConfigCookieMgr] = inst;
1725
+ }
1726
+ return inst;
1618
1727
  }
1619
- function initializePlugins(processContext, extensions) {
1620
- var initPlugins = [];
1621
- var lastPlugin = null;
1622
- var proxy = processContext.getNext();
1623
- var pluginState;
1624
- while (proxy) {
1625
- var thePlugin = proxy.getPlugin();
1626
- if (thePlugin) {
1627
- if (lastPlugin &&
1628
- isFunction(lastPlugin[strSetNextPlugin]) &&
1629
- isFunction(thePlugin[strProcessTelemetry])) {
1630
- lastPlugin[strSetNextPlugin](thePlugin);
1631
- }
1632
- var isInitialized = false;
1633
- if (isFunction(thePlugin[strIsInitialized])) {
1634
- isInitialized = thePlugin[strIsInitialized]();
1635
- }
1636
- else {
1637
- pluginState = _getPluginState(thePlugin);
1638
- isInitialized = pluginState[strIsInitialized];
1639
- }
1640
- if (!isInitialized) {
1641
- initPlugins.push(thePlugin);
1642
- }
1643
- lastPlugin = thePlugin;
1644
- proxy = proxy.getNext();
1645
- }
1728
+ function _isMgrEnabled(cookieMgr) {
1729
+ if (cookieMgr) {
1730
+ return cookieMgr.isEnabled();
1646
1731
  }
1647
- arrForEach(initPlugins, function (thePlugin) {
1648
- var core = processContext.core();
1649
- thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
1650
- pluginState = _getPluginState(thePlugin);
1651
- if (!thePlugin[strCore] && !pluginState[strCore]) {
1652
- pluginState[strCore] = core;
1653
- }
1654
- pluginState[strIsInitialized] = true;
1655
- delete pluginState[strTeardown];
1656
- });
1732
+ return true;
1657
1733
  }
1658
- function sortPlugins(plugins) {
1659
- return plugins.sort(function (extA, extB) {
1660
- var result = 0;
1661
- var bHasProcess = isFunction(extB[strProcessTelemetry]);
1662
- if (isFunction(extA[strProcessTelemetry])) {
1663
- result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
1664
- }
1665
- else if (bHasProcess) {
1666
- result = -1;
1734
+ function _createCookieMgrConfig(rootConfig) {
1735
+ var cookieMgrCfg = rootConfig[_DYN_COOKIE_CFG ] = rootConfig[_DYN_COOKIE_CFG ] || {};
1736
+ setValue(cookieMgrCfg, "domain", rootConfig.cookieDomain, isNotNullOrUndefined, isNullOrUndefined);
1737
+ setValue(cookieMgrCfg, "path", rootConfig.cookiePath || "/", null, isNullOrUndefined);
1738
+ if (isNullOrUndefined(cookieMgrCfg[strEnabled])) {
1739
+ var cookieEnabled = void 0;
1740
+ if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
1741
+ cookieEnabled = !rootConfig[strIsCookieUseDisabled];
1667
1742
  }
1668
- return result;
1669
- });
1670
- }
1671
-
1672
- var strTelemetryPluginChain = "TelemetryPluginChain";
1673
- var strHasRunFlags = "_hasRun";
1674
- var strGetTelCtx = "_getTelCtx";
1675
- var _chainId = 0;
1676
- function _getNextProxyStart(proxy, core, startAt) {
1677
- while (proxy) {
1678
- if (proxy.getPlugin() === startAt) {
1679
- return proxy;
1743
+ if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
1744
+ cookieEnabled = !rootConfig[strDisableCookiesUsage];
1680
1745
  }
1681
- proxy = proxy.getNext();
1746
+ cookieMgrCfg[strEnabled] = cookieEnabled;
1682
1747
  }
1683
- return createTelemetryProxyChain([startAt], core.config || {}, core);
1748
+ return cookieMgrCfg;
1684
1749
  }
1685
- function _createInternalContext(telemetryChain, config, core, startAt) {
1686
- var _nextProxy = null;
1687
- var _onComplete = [];
1688
- if (startAt !== null) {
1689
- _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
1750
+ function safeGetCookieMgr(core, config) {
1751
+ var cookieMgr;
1752
+ if (core) {
1753
+ cookieMgr = core.getCookieMgr();
1690
1754
  }
1691
- var context = {
1692
- _next: _moveNext,
1693
- ctx: {
1694
- core: function () {
1695
- return core;
1696
- },
1697
- diagLog: function () {
1698
- return safeGetLogger(core, config);
1699
- },
1700
- getCfg: function () {
1701
- return config;
1702
- },
1703
- getExtCfg: _getExtCfg,
1704
- getConfig: _getConfig,
1705
- hasNext: function () {
1706
- return !!_nextProxy;
1707
- },
1708
- getNext: function () {
1709
- return _nextProxy;
1710
- },
1711
- setNext: function (nextPlugin) {
1712
- _nextProxy = nextPlugin;
1713
- },
1714
- iterate: _iterateChain,
1715
- onComplete: _addOnComplete
1716
- }
1717
- };
1718
- function _addOnComplete(onComplete, that) {
1719
- var args = [];
1720
- for (var _i = 2; _i < arguments.length; _i++) {
1721
- args[_i - 2] = arguments[_i];
1755
+ else if (config) {
1756
+ var cookieCfg = config[_DYN_COOKIE_CFG ];
1757
+ if (cookieCfg[strConfigCookieMgr]) {
1758
+ cookieMgr = cookieCfg[strConfigCookieMgr];
1722
1759
  }
1723
- if (onComplete) {
1724
- _onComplete.push({
1725
- func: onComplete,
1726
- self: !isUndefined(that) ? that : context.ctx,
1727
- args: args
1728
- });
1760
+ else {
1761
+ cookieMgr = createCookieMgr(config);
1729
1762
  }
1730
1763
  }
1731
- function _moveNext() {
1732
- var nextProxy = _nextProxy;
1733
- _nextProxy = nextProxy ? nextProxy.getNext() : null;
1734
- if (!nextProxy) {
1735
- var onComplete = _onComplete;
1736
- if (onComplete && onComplete.length > 0) {
1737
- arrForEach(onComplete, function (completeDetails) {
1738
- try {
1739
- completeDetails.func.call(completeDetails.self, completeDetails.args);
1740
- }
1741
- catch (e) {
1742
- _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1743
- }
1744
- });
1745
- _onComplete = [];
1746
- }
1747
- }
1748
- return nextProxy;
1764
+ if (!cookieMgr) {
1765
+ cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER ]);
1749
1766
  }
1750
- function _getExtCfg(identifier, defaultValue, mergeDefault) {
1751
- if (defaultValue === void 0) { defaultValue = {}; }
1752
- if (mergeDefault === void 0) { mergeDefault = 0 ; }
1753
- var theConfig;
1754
- if (config) {
1755
- var extConfig = config.extensionConfig;
1756
- if (extConfig && identifier) {
1757
- theConfig = extConfig[identifier];
1767
+ return cookieMgr;
1768
+ }
1769
+ function createCookieMgr(rootConfig, logger) {
1770
+ var _a;
1771
+ var cookieMgrConfig = _createCookieMgrConfig(rootConfig || _globalCookieConfig);
1772
+ var _path = cookieMgrConfig.path || "/";
1773
+ var _domain = cookieMgrConfig.domain;
1774
+ var _enabled = cookieMgrConfig[strEnabled] !== false;
1775
+ var cookieMgr = (_a = {
1776
+ isEnabled: function () {
1777
+ var enabled = _enabled && areCookiesSupported(logger);
1778
+ var gblManager = _globalCookieConfig[strConfigCookieMgr];
1779
+ if (enabled && gblManager && cookieMgr !== gblManager) {
1780
+ enabled = _isMgrEnabled(gblManager);
1781
+ }
1782
+ return enabled;
1758
1783
  }
1759
- }
1760
- if (!theConfig) {
1761
- theConfig = defaultValue;
1762
- }
1763
- else if (isObject(defaultValue)) {
1764
- if (mergeDefault !== 0 ) {
1765
- var newConfig_1 = objExtend(true, defaultValue, theConfig);
1766
- if (config && mergeDefault === 2 ) {
1767
- objForEachKey(defaultValue, function (field) {
1768
- if (isNullOrUndefined(newConfig_1[field])) {
1769
- var cfgValue = config[field];
1770
- if (!isNullOrUndefined(cfgValue)) {
1771
- newConfig_1[field] = cfgValue;
1772
- }
1784
+ },
1785
+ _a[_DYN_SET_ENABLED ] = function (value) {
1786
+ _enabled = value !== false;
1787
+ },
1788
+ _a.set = function (name, value, maxAgeSec, domain, path) {
1789
+ var result = false;
1790
+ if (_isMgrEnabled(cookieMgr)) {
1791
+ var values = {};
1792
+ var theValue = strTrim(value || STR_EMPTY$1);
1793
+ var idx = theValue[_DYN_INDEX_OF ](";");
1794
+ if (idx !== -1) {
1795
+ theValue = strTrim(value[_DYN_SUBSTRING ](0, idx));
1796
+ values = _extractParts(value[_DYN_SUBSTRING ](idx + 1));
1797
+ }
1798
+ setValue(values, "domain", domain || _domain, isTruthy, isUndefined);
1799
+ if (!isNullOrUndefined(maxAgeSec)) {
1800
+ var _isIE = isIE();
1801
+ if (isUndefined(values[strExpires])) {
1802
+ var nowMs = dateNow();
1803
+ var expireMs = nowMs + (maxAgeSec * 1000);
1804
+ if (expireMs > 0) {
1805
+ var expiry = new Date();
1806
+ expiry.setTime(expireMs);
1807
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY$1, isTruthy);
1773
1808
  }
1774
- });
1809
+ }
1810
+ if (!_isIE) {
1811
+ setValue(values, "max-age", STR_EMPTY$1 + maxAgeSec, null, isUndefined);
1812
+ }
1775
1813
  }
1776
- theConfig = newConfig_1;
1814
+ var location_1 = getLocation();
1815
+ if (location_1 && location_1.protocol === "https:") {
1816
+ setValue(values, "secure", null, null, isUndefined);
1817
+ if (_allowUaSameSite === null) {
1818
+ _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
1819
+ }
1820
+ if (_allowUaSameSite) {
1821
+ setValue(values, "SameSite", "None", null, isUndefined);
1822
+ }
1823
+ }
1824
+ setValue(values, "path", path || _path, null, isUndefined);
1825
+ var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
1826
+ setCookieFn(name, _formatCookieValue(theValue, values));
1827
+ result = true;
1777
1828
  }
1778
- }
1779
- return theConfig;
1780
- }
1781
- function _getConfig(identifier, field, defaultValue) {
1782
- if (defaultValue === void 0) { defaultValue = false; }
1783
- var theValue;
1784
- var extConfig = _getExtCfg(identifier, null);
1785
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
1786
- theValue = extConfig[field];
1787
- }
1788
- else if (config && !isNullOrUndefined(config[field])) {
1789
- theValue = config[field];
1790
- }
1791
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1792
- }
1793
- function _iterateChain(cb) {
1794
- var nextPlugin;
1795
- while (!!(nextPlugin = context._next())) {
1796
- var plugin = nextPlugin.getPlugin();
1797
- if (plugin) {
1798
- cb(plugin);
1829
+ return result;
1830
+ },
1831
+ _a.get = function (name) {
1832
+ var value = STR_EMPTY$1;
1833
+ if (_isMgrEnabled(cookieMgr)) {
1834
+ value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1799
1835
  }
1800
- }
1801
- }
1802
- return context;
1836
+ return value;
1837
+ },
1838
+ _a.del = function (name, path) {
1839
+ var result = false;
1840
+ if (_isMgrEnabled(cookieMgr)) {
1841
+ result = cookieMgr.purge(name, path);
1842
+ }
1843
+ return result;
1844
+ },
1845
+ _a.purge = function (name, path) {
1846
+ var _a;
1847
+ var result = false;
1848
+ if (areCookiesSupported(logger)) {
1849
+ var values = (_a = {},
1850
+ _a["path"] = path ? path : "/",
1851
+ _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
1852
+ _a);
1853
+ if (!isIE()) {
1854
+ values["max-age"] = "0";
1855
+ }
1856
+ var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1857
+ delCookie(name, _formatCookieValue(STR_EMPTY$1, values));
1858
+ result = true;
1859
+ }
1860
+ return result;
1861
+ },
1862
+ _a);
1863
+ cookieMgr[strConfigCookieMgr] = cookieMgr;
1864
+ return cookieMgr;
1865
+ }
1866
+ function areCookiesSupported(logger) {
1867
+ if (_supportsCookies === null) {
1868
+ _supportsCookies = false;
1869
+ try {
1870
+ var doc = _doc || {};
1871
+ _supportsCookies = doc[strCookie] !== undefined;
1872
+ }
1873
+ catch (e) {
1874
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1875
+ }
1876
+ }
1877
+ return _supportsCookies;
1878
+ }
1879
+ function _extractParts(theValue) {
1880
+ var values = {};
1881
+ if (theValue && theValue[_DYN_LENGTH ]) {
1882
+ var parts = strTrim(theValue)[_DYN_SPLIT ](";");
1883
+ arrForEach(parts, function (thePart) {
1884
+ thePart = strTrim(thePart || STR_EMPTY$1);
1885
+ if (thePart) {
1886
+ var idx = thePart[_DYN_INDEX_OF ]("=");
1887
+ if (idx === -1) {
1888
+ values[thePart] = null;
1889
+ }
1890
+ else {
1891
+ values[strTrim(thePart[_DYN_SUBSTRING ](0, idx))] = strTrim(thePart[_DYN_SUBSTRING ](idx + 1));
1892
+ }
1893
+ }
1894
+ });
1895
+ }
1896
+ return values;
1897
+ }
1898
+ function _formatDate(theDate, func) {
1899
+ if (isFunction(theDate[func])) {
1900
+ return theDate[func]();
1901
+ }
1902
+ return null;
1903
+ }
1904
+ function _formatCookieValue(value, values) {
1905
+ var cookieValue = value || STR_EMPTY$1;
1906
+ objForEachKey(values, function (name, theValue) {
1907
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY$1);
1908
+ });
1909
+ return cookieValue;
1910
+ }
1911
+ function _getCookieValue(name) {
1912
+ var cookieValue = STR_EMPTY$1;
1913
+ if (_doc) {
1914
+ var theCookie = _doc[strCookie] || STR_EMPTY$1;
1915
+ if (_parsedCookieValue !== theCookie) {
1916
+ _cookieCache = _extractParts(theCookie);
1917
+ _parsedCookieValue = theCookie;
1918
+ }
1919
+ cookieValue = strTrim(_cookieCache[name] || STR_EMPTY$1);
1920
+ }
1921
+ return cookieValue;
1922
+ }
1923
+ function _setCookieValue(name, cookieValue) {
1924
+ if (_doc) {
1925
+ _doc[strCookie] = name + "=" + cookieValue;
1926
+ }
1927
+ }
1928
+ function uaDisallowsSameSiteNone(userAgent) {
1929
+ if (!isString(userAgent)) {
1930
+ return false;
1931
+ }
1932
+ if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
1933
+ return true;
1934
+ }
1935
+ if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
1936
+ return true;
1937
+ }
1938
+ if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
1939
+ return true;
1940
+ }
1941
+ if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
1942
+ return true;
1943
+ }
1944
+ if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
1945
+ return true;
1946
+ }
1947
+ if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
1948
+ return true;
1949
+ }
1950
+ return false;
1951
+ }
1952
+
1953
+ var strOnPrefix = "on";
1954
+ var strAttachEvent = "attachEvent";
1955
+ var strAddEventHelper = "addEventListener";
1956
+ var strDetachEvent = "detachEvent";
1957
+ var strRemoveEventListener = "removeEventListener";
1958
+ var strEvents = "events";
1959
+ var strVisibilityChangeEvt = "visibilitychange";
1960
+ var strPageHide = "pagehide";
1961
+ var strPageShow = "pageshow";
1962
+ var strUnload = "unload";
1963
+ var strBeforeUnload = "beforeunload";
1964
+ var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
1965
+ var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
1966
+ var rRemoveEmptyNs = /\.[\.]+/g;
1967
+ var rRemoveTrailingEmptyNs = /[\.]+$/;
1968
+ var _guid = 1;
1969
+ var elmNodeData = createElmNodeData("events");
1970
+ var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
1971
+ function _normalizeNamespace(name) {
1972
+ if (name && name[_DYN_REPLACE ]) {
1973
+ return name.replace(/^\s*\.*|\.*\s*$/g, STR_EMPTY$1);
1974
+ }
1975
+ return name;
1976
+ }
1977
+ function _getEvtNamespace(eventName, evtNamespace) {
1978
+ var _a;
1979
+ if (evtNamespace) {
1980
+ var theNamespace_1 = STR_EMPTY$1;
1981
+ if (isArray(evtNamespace)) {
1982
+ theNamespace_1 = STR_EMPTY$1;
1983
+ arrForEach(evtNamespace, function (name) {
1984
+ name = _normalizeNamespace(name);
1985
+ if (name) {
1986
+ if (name[0] !== ".") {
1987
+ name = "." + name;
1988
+ }
1989
+ theNamespace_1 += name;
1990
+ }
1991
+ });
1992
+ }
1993
+ else {
1994
+ theNamespace_1 = _normalizeNamespace(evtNamespace);
1995
+ }
1996
+ if (theNamespace_1) {
1997
+ if (theNamespace_1[0] !== ".") {
1998
+ theNamespace_1 = "." + theNamespace_1;
1999
+ }
2000
+ eventName = (eventName || STR_EMPTY$1) + theNamespace_1;
2001
+ }
2002
+ }
2003
+ var parsedEvent = (eventNamespace.exec(eventName || STR_EMPTY$1) || []);
2004
+ return _a = {},
2005
+ _a[_DYN_TYPE ] = parsedEvent[1],
2006
+ _a.ns = ((parsedEvent[2] || STR_EMPTY$1).replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, STR_EMPTY$1)[_DYN_SPLIT ](".").sort()).join("."),
2007
+ _a;
2008
+ }
2009
+ function __getRegisteredEvents(target, eventName, evtNamespace) {
2010
+ var theEvents = [];
2011
+ var eventCache = elmNodeData.get(target, strEvents, {}, false);
2012
+ var evtName = _getEvtNamespace(eventName, evtNamespace);
2013
+ objForEachKey(eventCache, function (evtType, registeredEvents) {
2014
+ arrForEach(registeredEvents, function (value) {
2015
+ var _a;
2016
+ if (!evtName[_DYN_TYPE ] || evtName[_DYN_TYPE ] === value.evtName[_DYN_TYPE ]) {
2017
+ if (!evtName.ns || evtName.ns === evtName.ns) {
2018
+ theEvents[_DYN_PUSH ]((_a = {},
2019
+ _a[_DYN_NAME ] = value.evtName[_DYN_TYPE ] + (value.evtName.ns ? "." + value.evtName.ns : STR_EMPTY$1),
2020
+ _a.handler = value[_DYN_HANDLER ],
2021
+ _a));
2022
+ }
2023
+ }
2024
+ });
2025
+ });
2026
+ return theEvents;
2027
+ }
2028
+ function _getRegisteredEvents(target, evtName, addDefault) {
2029
+ if (addDefault === void 0) { addDefault = true; }
2030
+ var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
2031
+ var registeredEvents = aiEvts[evtName];
2032
+ if (!registeredEvents) {
2033
+ registeredEvents = aiEvts[evtName] = [];
2034
+ }
2035
+ return registeredEvents;
2036
+ }
2037
+ function _doDetach(obj, evtName, handlerRef, useCapture) {
2038
+ if (obj && evtName && evtName[_DYN_TYPE ]) {
2039
+ if (obj[strRemoveEventListener]) {
2040
+ obj[strRemoveEventListener](evtName[_DYN_TYPE ], handlerRef, useCapture);
2041
+ }
2042
+ else if (obj[strDetachEvent]) {
2043
+ obj[strDetachEvent](strOnPrefix + evtName[_DYN_TYPE ], handlerRef);
2044
+ }
2045
+ }
2046
+ }
2047
+ function _doAttach(obj, evtName, handlerRef, useCapture) {
2048
+ var result = false;
2049
+ if (obj && evtName && evtName[_DYN_TYPE ] && handlerRef) {
2050
+ if (obj[strAddEventHelper]) {
2051
+ obj[strAddEventHelper](evtName[_DYN_TYPE ], handlerRef, useCapture);
2052
+ result = true;
2053
+ }
2054
+ else if (obj[strAttachEvent]) {
2055
+ obj[strAttachEvent](strOnPrefix + evtName[_DYN_TYPE ], handlerRef);
2056
+ result = true;
2057
+ }
2058
+ }
2059
+ return result;
2060
+ }
2061
+ function _doUnregister(target, events, evtName, unRegFn) {
2062
+ var idx = events[_DYN_LENGTH ];
2063
+ while (idx--) {
2064
+ var theEvent = events[idx];
2065
+ if (theEvent) {
2066
+ if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
2067
+ if (!unRegFn || unRegFn(theEvent)) {
2068
+ _doDetach(target, theEvent.evtName, theEvent[_DYN_HANDLER ], theEvent.capture);
2069
+ events[_DYN_SPLICE ](idx, 1);
2070
+ }
2071
+ }
2072
+ }
2073
+ }
2074
+ }
2075
+ function _unregisterEvents(target, evtName, unRegFn) {
2076
+ if (evtName[_DYN_TYPE ]) {
2077
+ _doUnregister(target, _getRegisteredEvents(target, evtName[_DYN_TYPE ]), evtName, unRegFn);
2078
+ }
2079
+ else {
2080
+ var eventCache = elmNodeData.get(target, strEvents, {});
2081
+ objForEachKey(eventCache, function (evtType, events) {
2082
+ _doUnregister(target, events, evtName, unRegFn);
2083
+ });
2084
+ if (objKeys(eventCache)[_DYN_LENGTH ] === 0) {
2085
+ elmNodeData.kill(target, strEvents);
2086
+ }
2087
+ }
2088
+ }
2089
+ function mergeEvtNamespace(theNamespace, namespaces) {
2090
+ var newNamespaces;
2091
+ if (namespaces) {
2092
+ if (isArray(namespaces)) {
2093
+ newNamespaces = [theNamespace].concat(namespaces);
2094
+ }
2095
+ else {
2096
+ newNamespaces = [theNamespace, namespaces];
2097
+ }
2098
+ newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns)[_DYN_SPLIT ](".");
2099
+ }
2100
+ else {
2101
+ newNamespaces = theNamespace;
2102
+ }
2103
+ return newNamespaces;
2104
+ }
2105
+ function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
2106
+ var _a;
2107
+ if (useCapture === void 0) { useCapture = false; }
2108
+ var result = false;
2109
+ if (target) {
2110
+ try {
2111
+ var evtName = _getEvtNamespace(eventName, evtNamespace);
2112
+ result = _doAttach(target, evtName, handlerRef, useCapture);
2113
+ if (result && elmNodeData.accept(target)) {
2114
+ var registeredEvent = (_a = {
2115
+ guid: _guid++,
2116
+ evtName: evtName
2117
+ },
2118
+ _a[_DYN_HANDLER ] = handlerRef,
2119
+ _a.capture = useCapture,
2120
+ _a);
2121
+ _getRegisteredEvents(target, evtName.type)[_DYN_PUSH ](registeredEvent);
2122
+ }
2123
+ }
2124
+ catch (e) {
2125
+ }
2126
+ }
2127
+ return result;
2128
+ }
2129
+ function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
2130
+ if (useCapture === void 0) { useCapture = false; }
2131
+ if (target) {
2132
+ try {
2133
+ var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
2134
+ var found_1 = false;
2135
+ _unregisterEvents(target, evtName_1, function (regEvent) {
2136
+ if ((evtName_1.ns && !handlerRef) || regEvent[_DYN_HANDLER ] === handlerRef) {
2137
+ found_1 = true;
2138
+ return true;
2139
+ }
2140
+ return false;
2141
+ });
2142
+ if (!found_1) {
2143
+ _doDetach(target, evtName_1, handlerRef, useCapture);
2144
+ }
2145
+ }
2146
+ catch (e) {
2147
+ }
2148
+ }
2149
+ }
2150
+ function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
2151
+ if (useCapture === void 0) { useCapture = false; }
2152
+ return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
2153
+ }
2154
+ function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
2155
+ if (useCapture === void 0) { useCapture = false; }
2156
+ eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);
2157
+ }
2158
+ function addEventHandler(eventName, callback, evtNamespace) {
2159
+ var result = false;
2160
+ var w = getWindow();
2161
+ if (w) {
2162
+ result = eventOn(w, eventName, callback, evtNamespace);
2163
+ result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
2164
+ }
2165
+ var doc = getDocument();
2166
+ if (doc) {
2167
+ result = eventOn(doc, eventName, callback, evtNamespace) || result;
2168
+ }
2169
+ return result;
2170
+ }
2171
+ function removeEventHandler(eventName, callback, evtNamespace) {
2172
+ var w = getWindow();
2173
+ if (w) {
2174
+ eventOff(w, eventName, callback, evtNamespace);
2175
+ eventOff(w["body"], eventName, callback, evtNamespace);
2176
+ }
2177
+ var doc = getDocument();
2178
+ if (doc) {
2179
+ eventOff(doc, eventName, callback, evtNamespace);
2180
+ }
2181
+ }
2182
+ function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
2183
+ var added = false;
2184
+ if (listener && events && events[_DYN_LENGTH ] > 0) {
2185
+ arrForEach(events, function (name) {
2186
+ if (name) {
2187
+ if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
2188
+ added = addEventHandler(name, listener, evtNamespace) || added;
2189
+ }
2190
+ }
2191
+ });
2192
+ }
2193
+ return added;
2194
+ }
2195
+ function addEventListeners(events, listener, excludeEvents, evtNamespace) {
2196
+ var added = false;
2197
+ if (listener && events && isArray(events)) {
2198
+ added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
2199
+ if (!added && excludeEvents && excludeEvents[_DYN_LENGTH ] > 0) {
2200
+ added = _addEventListeners(events, listener, null, evtNamespace);
2201
+ }
2202
+ }
2203
+ return added;
2204
+ }
2205
+ function removeEventListeners(events, listener, evtNamespace) {
2206
+ if (events && isArray(events)) {
2207
+ arrForEach(events, function (name) {
2208
+ if (name) {
2209
+ removeEventHandler(name, listener, evtNamespace);
2210
+ }
2211
+ });
2212
+ }
2213
+ }
2214
+ function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
2215
+ return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
2216
+ }
2217
+ function removePageUnloadEventListener(listener, evtNamespace) {
2218
+ removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);
2219
+ }
2220
+ function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
2221
+ function _handlePageVisibility(evt) {
2222
+ var doc = getDocument();
2223
+ if (listener && doc && doc.visibilityState === "hidden") {
2224
+ listener(evt);
2225
+ }
2226
+ }
2227
+ var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
2228
+ var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
2229
+ if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
2230
+ pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
2231
+ }
2232
+ if (!pageUnloadAdded && excludeEvents) {
2233
+ pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
2234
+ }
2235
+ return pageUnloadAdded;
2236
+ }
2237
+ function removePageHideEventListener(listener, evtNamespace) {
2238
+ var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
2239
+ removeEventListeners([strPageHide], listener, newNamespaces);
2240
+ removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
2241
+ }
2242
+ function addPageShowEventListener(listener, excludeEvents, evtNamespace) {
2243
+ function _handlePageVisibility(evt) {
2244
+ var doc = getDocument();
2245
+ if (listener && doc && doc.visibilityState === "visible") {
2246
+ listener(evt);
2247
+ }
2248
+ }
2249
+ var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
2250
+ var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);
2251
+ pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;
2252
+ if (!pageShowAdded && excludeEvents) {
2253
+ pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);
2254
+ }
2255
+ return pageShowAdded;
2256
+ }
2257
+ function removePageShowEventListener(listener, evtNamespace) {
2258
+ var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
2259
+ removeEventListeners([strPageShow], listener, newNamespaces);
2260
+ removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
2261
+ }
2262
+
2263
+ function newGuid() {
2264
+ var uuid = generateW3CId();
2265
+ return uuid[_DYN_SUBSTRING ](0, 8) + "-" + uuid[_DYN_SUBSTRING ](8, 12) + "-" + uuid[_DYN_SUBSTRING ](12, 16) + "-" + uuid[_DYN_SUBSTRING ](16, 20) + "-" + uuid[_DYN_SUBSTRING ](20);
2266
+ }
2267
+ function perfNow() {
2268
+ var perf = getPerformance();
2269
+ if (perf && perf.now) {
2270
+ return perf.now();
2271
+ }
2272
+ return dateNow();
2273
+ }
2274
+ function generateW3CId() {
2275
+ var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
2276
+ var oct = STR_EMPTY$1, tmp;
2277
+ for (var a = 0; a < 4; a++) {
2278
+ tmp = random32();
2279
+ oct +=
2280
+ hexValues[tmp & 0xF] +
2281
+ hexValues[tmp >> 4 & 0xF] +
2282
+ hexValues[tmp >> 8 & 0xF] +
2283
+ hexValues[tmp >> 12 & 0xF] +
2284
+ hexValues[tmp >> 16 & 0xF] +
2285
+ hexValues[tmp >> 20 & 0xF] +
2286
+ hexValues[tmp >> 24 & 0xF] +
2287
+ hexValues[tmp >> 28 & 0xF];
2288
+ }
2289
+ var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
2290
+ return oct[_DYN_SUBSTR ](0, 8) + oct[_DYN_SUBSTR ](9, 4) + "4" + oct[_DYN_SUBSTR ](13, 3) + clockSequenceHi + oct[_DYN_SUBSTR ](16, 3) + oct[_DYN_SUBSTR ](19, 12);
2291
+ }
2292
+ var EventHelper = {
2293
+ Attach: attachEvent,
2294
+ AttachEvent: attachEvent,
2295
+ Detach: detachEvent,
2296
+ DetachEvent: detachEvent
2297
+ };
2298
+
2299
+ var TRACE_PARENT_REGEX = /^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})(-[^\s]*)?$/;
2300
+ var DEFAULT_VERSION = "00";
2301
+ var INVALID_VERSION = "ff";
2302
+ var INVALID_TRACE_ID = "00000000000000000000000000000000";
2303
+ var INVALID_SPAN_ID = "0000000000000000";
2304
+ var SAMPLED_FLAG = 0x01;
2305
+ function _isValid(value, len, invalidValue) {
2306
+ if (value && value[_DYN_LENGTH ] === len && value !== invalidValue) {
2307
+ return !!value.match(/^[\da-f]*$/);
2308
+ }
2309
+ return false;
2310
+ }
2311
+ function _formatValue(value, len, defValue) {
2312
+ if (_isValid(value, len)) {
2313
+ return value;
2314
+ }
2315
+ return defValue;
2316
+ }
2317
+ function _formatFlags(value) {
2318
+ if (isNaN(value) || value < 0 || value > 255) {
2319
+ value = 0x01;
2320
+ }
2321
+ var result = value.toString(16);
2322
+ while (result[_DYN_LENGTH ] < 2) {
2323
+ result = "0" + result;
2324
+ }
2325
+ return result;
2326
+ }
2327
+ function createTraceParent(traceId, spanId, flags, version) {
2328
+ var _a;
2329
+ return _a = {},
2330
+ _a[_DYN_VERSION ] = _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,
2331
+ _a[_DYN_TRACE_ID ] = isValidTraceId(traceId) ? traceId : generateW3CId(),
2332
+ _a.spanId = isValidSpanId(spanId) ? spanId : generateW3CId()[_DYN_SUBSTR ](0, 16),
2333
+ _a.traceFlags = flags >= 0 && flags <= 0xFF ? flags : 1,
2334
+ _a;
2335
+ }
2336
+ function parseTraceParent(value) {
2337
+ var _a;
2338
+ if (!value) {
2339
+ return null;
2340
+ }
2341
+ if (isArray(value)) {
2342
+ value = value[0] || "";
2343
+ }
2344
+ if (!value || !isString(value) || value[_DYN_LENGTH ] > 8192) {
2345
+ return null;
2346
+ }
2347
+ var match = TRACE_PARENT_REGEX.exec(strTrim(value));
2348
+ if (!match ||
2349
+ match[1] === INVALID_VERSION ||
2350
+ match[2] === INVALID_TRACE_ID ||
2351
+ match[3] === INVALID_SPAN_ID) {
2352
+ return null;
2353
+ }
2354
+ return _a = {},
2355
+ _a[_DYN_VERSION ] = match[1],
2356
+ _a[_DYN_TRACE_ID ] = match[2],
2357
+ _a[_DYN_SPAN_ID ] = match[3],
2358
+ _a[_DYN_TRACE_FLAGS ] = parseInt(match[4], 16),
2359
+ _a;
2360
+ }
2361
+ function isValidTraceId(value) {
2362
+ return _isValid(value, 32, INVALID_TRACE_ID);
2363
+ }
2364
+ function isValidSpanId(value) {
2365
+ return _isValid(value, 16, INVALID_SPAN_ID);
2366
+ }
2367
+ function isValidTraceParent(value) {
2368
+ if (!value ||
2369
+ !_isValid(value[_DYN_VERSION ], 2, INVALID_VERSION) ||
2370
+ !_isValid(value[_DYN_TRACE_ID ], 32, INVALID_TRACE_ID) ||
2371
+ !_isValid(value[_DYN_SPAN_ID ], 16, INVALID_SPAN_ID) ||
2372
+ !_isValid(_formatFlags(value[_DYN_TRACE_FLAGS ]), 2)) {
2373
+ return false;
2374
+ }
2375
+ return true;
2376
+ }
2377
+ function isSampledFlag(value) {
2378
+ if (isValidTraceParent(value)) {
2379
+ return (value[_DYN_TRACE_FLAGS ] & SAMPLED_FLAG) === SAMPLED_FLAG;
2380
+ }
2381
+ return false;
2382
+ }
2383
+ function formatTraceParent(value) {
2384
+ if (value) {
2385
+ var flags = _formatFlags(value[_DYN_TRACE_FLAGS ]);
2386
+ if (!_isValid(flags, 2)) {
2387
+ flags = "01";
2388
+ }
2389
+ var version = value[_DYN_VERSION ] || DEFAULT_VERSION;
2390
+ if (version !== "00" && version !== "ff") {
2391
+ version = DEFAULT_VERSION;
2392
+ }
2393
+ return "".concat(version, "-").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID), "-").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID), "-").concat(flags);
2394
+ }
2395
+ return "";
2396
+ }
2397
+ function findW3cTraceParent() {
2398
+ var name = "traceparent";
2399
+ var traceParent = parseTraceParent(findMetaTag(name));
2400
+ if (!traceParent) {
2401
+ traceParent = parseTraceParent(findNamedServerTiming(name));
2402
+ }
2403
+ return traceParent;
2404
+ }
2405
+
2406
+ var pluginStateData = createElmNodeData("plugin");
2407
+ function _getPluginState(plugin) {
2408
+ return pluginStateData.get(plugin, "state", {}, true);
2409
+ }
2410
+ function initializePlugins(processContext, extensions) {
2411
+ var initPlugins = [];
2412
+ var lastPlugin = null;
2413
+ var proxy = processContext[_DYN_GET_NEXT ]();
2414
+ var pluginState;
2415
+ while (proxy) {
2416
+ var thePlugin = proxy[_DYN_GET_PLUGIN ]();
2417
+ if (thePlugin) {
2418
+ if (lastPlugin &&
2419
+ isFunction(lastPlugin[_DYN_SET_NEXT_PLUGIN ]) &&
2420
+ isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
2421
+ lastPlugin[_DYN_SET_NEXT_PLUGIN ](thePlugin);
2422
+ }
2423
+ var isInitialized = false;
2424
+ if (isFunction(thePlugin[_DYN_IS_INITIALIZED ])) {
2425
+ isInitialized = thePlugin[_DYN_IS_INITIALIZED ]();
2426
+ }
2427
+ else {
2428
+ pluginState = _getPluginState(thePlugin);
2429
+ isInitialized = pluginState[_DYN_IS_INITIALIZED ];
2430
+ }
2431
+ if (!isInitialized) {
2432
+ initPlugins[_DYN_PUSH ](thePlugin);
2433
+ }
2434
+ lastPlugin = thePlugin;
2435
+ proxy = proxy[_DYN_GET_NEXT ]();
2436
+ }
2437
+ }
2438
+ arrForEach(initPlugins, function (thePlugin) {
2439
+ var core = processContext[STR_CORE]();
2440
+ thePlugin[_DYN_INITIALIZE ](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT ]());
2441
+ pluginState = _getPluginState(thePlugin);
2442
+ if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {
2443
+ pluginState[STR_CORE] = core;
2444
+ }
2445
+ pluginState[_DYN_IS_INITIALIZED ] = true;
2446
+ delete pluginState[_DYN_TEARDOWN ];
2447
+ });
2448
+ }
2449
+ function sortPlugins(plugins) {
2450
+ return plugins.sort(function (extA, extB) {
2451
+ var result = 0;
2452
+ if (extB) {
2453
+ var bHasProcess = isFunction(extB[STR_PROCESS_TELEMETRY]);
2454
+ if (isFunction(extA[STR_PROCESS_TELEMETRY])) {
2455
+ result = bHasProcess ? extA[STR_PRIORITY] - extB[STR_PRIORITY] : 1;
2456
+ }
2457
+ else if (bHasProcess) {
2458
+ result = -1;
2459
+ }
2460
+ }
2461
+ else {
2462
+ result = extA ? 1 : -1;
2463
+ }
2464
+ return result;
2465
+ });
2466
+ }
2467
+ function createDistributedTraceContext(parentCtx) {
2468
+ var trace = {};
2469
+ return {
2470
+ getName: function () {
2471
+ return trace[_DYN_NAME ];
2472
+ },
2473
+ setName: function (newValue) {
2474
+ parentCtx && parentCtx.setName(newValue);
2475
+ trace[_DYN_NAME ] = newValue;
2476
+ },
2477
+ getTraceId: function () {
2478
+ return trace[_DYN_TRACE_ID ];
2479
+ },
2480
+ setTraceId: function (newValue) {
2481
+ parentCtx && parentCtx.setTraceId(newValue);
2482
+ if (isValidTraceId(newValue)) {
2483
+ trace[_DYN_TRACE_ID ] = newValue;
2484
+ }
2485
+ },
2486
+ getSpanId: function () {
2487
+ return trace[_DYN_SPAN_ID ];
2488
+ },
2489
+ setSpanId: function (newValue) {
2490
+ parentCtx && parentCtx.setSpanId(newValue);
2491
+ if (isValidSpanId(newValue)) {
2492
+ trace[_DYN_SPAN_ID ] = newValue;
2493
+ }
2494
+ },
2495
+ getTraceFlags: function () {
2496
+ return trace[_DYN_TRACE_FLAGS ];
2497
+ },
2498
+ setTraceFlags: function (newTraceFlags) {
2499
+ parentCtx && parentCtx.setTraceFlags(newTraceFlags);
2500
+ trace[_DYN_TRACE_FLAGS ] = newTraceFlags;
2501
+ }
2502
+ };
2503
+ }
2504
+
2505
+ var strTelemetryPluginChain = "TelemetryPluginChain";
2506
+ var strHasRunFlags = "_hasRun";
2507
+ var strGetTelCtx = "_getTelCtx";
2508
+ var _chainId = 0;
2509
+ function _getNextProxyStart(proxy, core, startAt) {
2510
+ while (proxy) {
2511
+ if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
2512
+ return proxy;
2513
+ }
2514
+ proxy = proxy[_DYN_GET_NEXT ]();
2515
+ }
2516
+ return createTelemetryProxyChain([startAt], core[_DYN_CONFIG ] || {}, core);
2517
+ }
2518
+ function _createInternalContext(telemetryChain, config, core, startAt) {
2519
+ var _nextProxy = null;
2520
+ var _onComplete = [];
2521
+ if (startAt !== null) {
2522
+ _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
2523
+ }
2524
+ var context = {
2525
+ _next: _moveNext,
2526
+ ctx: {
2527
+ core: function () {
2528
+ return core;
2529
+ },
2530
+ diagLog: function () {
2531
+ return safeGetLogger(core, config);
2532
+ },
2533
+ getCfg: function () {
2534
+ return config;
2535
+ },
2536
+ getExtCfg: _getExtCfg,
2537
+ getConfig: _getConfig,
2538
+ hasNext: function () {
2539
+ return !!_nextProxy;
2540
+ },
2541
+ getNext: function () {
2542
+ return _nextProxy;
2543
+ },
2544
+ setNext: function (nextPlugin) {
2545
+ _nextProxy = nextPlugin;
2546
+ },
2547
+ iterate: _iterateChain,
2548
+ onComplete: _addOnComplete
2549
+ }
2550
+ };
2551
+ function _addOnComplete(onComplete, that) {
2552
+ var args = [];
2553
+ for (var _i = 2; _i < arguments.length; _i++) {
2554
+ args[_i - 2] = arguments[_i];
2555
+ }
2556
+ if (onComplete) {
2557
+ _onComplete[_DYN_PUSH ]({
2558
+ func: onComplete,
2559
+ self: !isUndefined(that) ? that : context.ctx,
2560
+ args: args
2561
+ });
2562
+ }
2563
+ }
2564
+ function _moveNext() {
2565
+ var nextProxy = _nextProxy;
2566
+ _nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT ]() : null;
2567
+ if (!nextProxy) {
2568
+ var onComplete = _onComplete;
2569
+ if (onComplete && onComplete[_DYN_LENGTH ] > 0) {
2570
+ arrForEach(onComplete, function (completeDetails) {
2571
+ try {
2572
+ completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
2573
+ }
2574
+ catch (e) {
2575
+ _throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
2576
+ }
2577
+ });
2578
+ _onComplete = [];
2579
+ }
2580
+ }
2581
+ return nextProxy;
2582
+ }
2583
+ function _getExtCfg(identifier, defaultValue, mergeDefault) {
2584
+ if (defaultValue === void 0) { defaultValue = {}; }
2585
+ if (mergeDefault === void 0) { mergeDefault = 0 ; }
2586
+ var theConfig;
2587
+ if (config) {
2588
+ var extConfig = config[STR_EXTENSION_CONFIG ];
2589
+ if (extConfig && identifier) {
2590
+ theConfig = extConfig[identifier];
2591
+ }
2592
+ }
2593
+ if (!theConfig) {
2594
+ theConfig = defaultValue;
2595
+ }
2596
+ else if (isObject(defaultValue)) {
2597
+ if (mergeDefault !== 0 ) {
2598
+ var newConfig_1 = objExtend(true, defaultValue, theConfig);
2599
+ if (config && mergeDefault === 2 ) {
2600
+ objForEachKey(defaultValue, function (field) {
2601
+ if (isNullOrUndefined(newConfig_1[field])) {
2602
+ var cfgValue = config[field];
2603
+ if (!isNullOrUndefined(cfgValue)) {
2604
+ newConfig_1[field] = cfgValue;
2605
+ }
2606
+ }
2607
+ });
2608
+ }
2609
+ theConfig = newConfig_1;
2610
+ }
2611
+ }
2612
+ return theConfig;
2613
+ }
2614
+ function _getConfig(identifier, field, defaultValue) {
2615
+ if (defaultValue === void 0) { defaultValue = false; }
2616
+ var theValue;
2617
+ var extConfig = _getExtCfg(identifier, null);
2618
+ if (extConfig && !isNullOrUndefined(extConfig[field])) {
2619
+ theValue = extConfig[field];
2620
+ }
2621
+ else if (config && !isNullOrUndefined(config[field])) {
2622
+ theValue = config[field];
2623
+ }
2624
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
2625
+ }
2626
+ function _iterateChain(cb) {
2627
+ var nextPlugin;
2628
+ while (!!(nextPlugin = context._next())) {
2629
+ var plugin = nextPlugin[_DYN_GET_PLUGIN ]();
2630
+ if (plugin) {
2631
+ cb(plugin);
2632
+ }
2633
+ }
2634
+ }
2635
+ return context;
1803
2636
  }
1804
2637
  function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1805
2638
  var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1806
2639
  var context = internalContext.ctx;
1807
2640
  function _processNext(env) {
1808
2641
  var nextPlugin = internalContext._next();
1809
- nextPlugin && nextPlugin.processTelemetry(env, context);
2642
+ nextPlugin && nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
1810
2643
  return !nextPlugin;
1811
2644
  }
1812
2645
  function _createNew(plugins, startAt) {
@@ -1814,14 +2647,14 @@
1814
2647
  if (isArray(plugins)) {
1815
2648
  plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1816
2649
  }
1817
- return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
2650
+ return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT ](), config, core, startAt);
1818
2651
  }
1819
- context.processNext = _processNext;
1820
- context.createNew = _createNew;
2652
+ context[_DYN_PROCESS_NEXT ] = _processNext;
2653
+ context[_DYN_CREATE_NEW ] = _createNew;
1821
2654
  return context;
1822
2655
  }
1823
2656
  function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
1824
- var config = core.config || {};
2657
+ var config = core[_DYN_CONFIG ] || {};
1825
2658
  var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1826
2659
  var context = internalContext.ctx;
1827
2660
  function _processNext(unloadState) {
@@ -1834,20 +2667,20 @@
1834
2667
  if (isArray(plugins)) {
1835
2668
  plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1836
2669
  }
1837
- return createProcessTelemetryUnloadContext(plugins || context.getNext(), core, startAt);
2670
+ return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
1838
2671
  }
1839
- context.processNext = _processNext;
1840
- context.createNew = _createNew;
2672
+ context[_DYN_PROCESS_NEXT ] = _processNext;
2673
+ context[_DYN_CREATE_NEW ] = _createNew;
1841
2674
  return context;
1842
2675
  }
1843
2676
  function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
1844
- var config = core.config || {};
2677
+ var config = core[_DYN_CONFIG ] || {};
1845
2678
  var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1846
2679
  var context = internalContext.ctx;
1847
2680
  function _processNext(updateState) {
1848
2681
  return context.iterate(function (plugin) {
1849
- if (isFunction(plugin.update)) {
1850
- plugin.update(context, updateState);
2682
+ if (isFunction(plugin[_DYN_UPDATE ])) {
2683
+ plugin[_DYN_UPDATE ](context, updateState);
1851
2684
  }
1852
2685
  });
1853
2686
  }
@@ -1856,22 +2689,22 @@
1856
2689
  if (isArray(plugins)) {
1857
2690
  plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1858
2691
  }
1859
- return createProcessTelemetryUpdateContext(plugins || context.getNext(), core, startAt);
2692
+ return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
1860
2693
  }
1861
- context.processNext = _processNext;
1862
- context.createNew = _createNew;
2694
+ context[_DYN_PROCESS_NEXT ] = _processNext;
2695
+ context[_DYN_CREATE_NEW ] = _createNew;
1863
2696
  return context;
1864
2697
  }
1865
2698
  function createTelemetryProxyChain(plugins, config, core, startAt) {
1866
2699
  var firstProxy = null;
1867
2700
  var add = startAt ? false : true;
1868
- if (isArray(plugins) && plugins.length > 0) {
2701
+ if (isArray(plugins) && plugins[_DYN_LENGTH ] > 0) {
1869
2702
  var lastProxy_1 = null;
1870
2703
  arrForEach(plugins, function (thePlugin) {
1871
2704
  if (!add && startAt === thePlugin) {
1872
2705
  add = true;
1873
2706
  }
1874
- if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
2707
+ if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
1875
2708
  var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1876
2709
  if (!firstProxy) {
1877
2710
  firstProxy = newProxy;
@@ -1890,11 +2723,11 @@
1890
2723
  }
1891
2724
  function createTelemetryPluginProxy(plugin, config, core) {
1892
2725
  var nextProxy = null;
1893
- var hasProcessTelemetry = isFunction(plugin.processTelemetry);
1894
- var hasSetNext = isFunction(plugin.setNextPlugin);
2726
+ var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
2727
+ var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
1895
2728
  var chainId;
1896
2729
  if (plugin) {
1897
- chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
2730
+ chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
1898
2731
  }
1899
2732
  else {
1900
2733
  chainId = "Unknown-0-" + _chainId++;
@@ -1926,17 +2759,17 @@
1926
2759
  }
1927
2760
  function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
1928
2761
  var hasRun = false;
1929
- var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
2762
+ var identifier = plugin ? plugin[_DYN_IDENTIFIER ] : strTelemetryPluginChain;
1930
2763
  var hasRunContext = itemCtx[strHasRunFlags];
1931
2764
  if (!hasRunContext) {
1932
2765
  hasRunContext = itemCtx[strHasRunFlags] = {};
1933
2766
  }
1934
2767
  itemCtx.setNext(nextProxy);
1935
2768
  if (plugin) {
1936
- doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
2769
+ doPerf(itemCtx[STR_CORE ](), function () { return identifier + ":" + name; }, function () {
1937
2770
  hasRunContext[chainId] = true;
1938
2771
  try {
1939
- var nextId = nextProxy ? nextProxy._id : strEmpty;
2772
+ var nextId = nextProxy ? nextProxy._id : STR_EMPTY$1;
1940
2773
  if (nextId) {
1941
2774
  hasRunContext[nextId] = false;
1942
2775
  }
@@ -1948,7 +2781,7 @@
1948
2781
  hasRun = true;
1949
2782
  }
1950
2783
  if (!nextProxy || !hasNextRun) {
1951
- _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
2784
+ _throwInternal(itemCtx[_DYN_DIAG_LOG ](), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1952
2785
  }
1953
2786
  }
1954
2787
  }, details, isAsync);
@@ -1962,17 +2795,17 @@
1962
2795
  return false;
1963
2796
  }
1964
2797
  var pluginState = _getPluginState(plugin);
1965
- if (pluginState.teardown || pluginState[strDisabled]) {
2798
+ if (pluginState[_DYN_TEARDOWN ] || pluginState[STR_DISABLED]) {
1966
2799
  return false;
1967
2800
  }
1968
2801
  if (hasSetNext) {
1969
- plugin.setNextPlugin(nextProxy);
2802
+ plugin[_DYN_SET_NEXT_PLUGIN ](nextProxy);
1970
2803
  }
1971
- plugin.processTelemetry(env, itemCtx);
2804
+ plugin[STR_PROCESS_TELEMETRY ](env, itemCtx);
1972
2805
  return true;
1973
2806
  }
1974
2807
  if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
1975
- itemCtx.processNext(env);
2808
+ itemCtx[_DYN_PROCESS_NEXT ](env);
1976
2809
  }
1977
2810
  }
1978
2811
  function _unloadPlugin(unloadCtx, unloadState) {
@@ -1980,20 +2813,20 @@
1980
2813
  var hasRun = false;
1981
2814
  if (plugin) {
1982
2815
  var pluginState = _getPluginState(plugin);
1983
- var pluginCore = plugin[strCore] || pluginState.core;
1984
- if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
1985
- pluginState[strCore] = null;
1986
- pluginState[strTeardown] = true;
1987
- pluginState[strIsInitialized] = false;
1988
- if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
2816
+ var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
2817
+ if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
2818
+ pluginState[STR_CORE ] = null;
2819
+ pluginState[_DYN_TEARDOWN ] = true;
2820
+ pluginState[_DYN_IS_INITIALIZED ] = false;
2821
+ if (plugin[_DYN_TEARDOWN ] && plugin[_DYN_TEARDOWN ](unloadCtx, unloadState) === true) {
1989
2822
  hasRun = true;
1990
2823
  }
1991
2824
  }
1992
2825
  }
1993
2826
  return hasRun;
1994
2827
  }
1995
- if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1996
- unloadCtx.processNext(unloadState);
2828
+ if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState[_DYN_IS_ASYNC ])) {
2829
+ unloadCtx[_DYN_PROCESS_NEXT ](unloadState);
1997
2830
  }
1998
2831
  }
1999
2832
  function _updatePlugin(updateCtx, updateState) {
@@ -2001,9 +2834,9 @@
2001
2834
  var hasRun = false;
2002
2835
  if (plugin) {
2003
2836
  var pluginState = _getPluginState(plugin);
2004
- var pluginCore = plugin[strCore] || pluginState.core;
2005
- if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
2006
- if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
2837
+ var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
2838
+ if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
2839
+ if (plugin[_DYN_UPDATE ] && plugin[_DYN_UPDATE ](updateCtx, updateState) === true) {
2007
2840
  hasRun = true;
2008
2841
  }
2009
2842
  }
@@ -2011,7 +2844,7 @@
2011
2844
  return hasRun;
2012
2845
  }
2013
2846
  if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
2014
- updateCtx.processNext(updateState);
2847
+ updateCtx[_DYN_PROCESS_NEXT ](updateState);
2015
2848
  }
2016
2849
  }
2017
2850
  return objFreeze(proxyChain);
@@ -2025,279 +2858,30 @@
2025
2858
  return ProcessTelemetryContext;
2026
2859
  }());
2027
2860
 
2028
- var strToGMTString = "toGMTString";
2029
- var strToUTCString = "toUTCString";
2030
- var strCookie = "cookie";
2031
- var strExpires = "expires";
2032
- var strEnabled = "enabled";
2033
- var strIsCookieUseDisabled = "isCookieUseDisabled";
2034
- var strDisableCookiesUsage = "disableCookiesUsage";
2035
- var strConfigCookieMgr = "_ckMgr";
2036
- var _supportsCookies = null;
2037
- var _allowUaSameSite = null;
2038
- var _parsedCookieValue = null;
2039
- var _doc = getDocument();
2040
- var _cookieCache = {};
2041
- var _globalCookieConfig = {};
2042
- function _gblCookieMgr(config, logger) {
2043
- var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
2044
- if (!inst) {
2045
- inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
2046
- _globalCookieConfig[strConfigCookieMgr] = inst;
2047
- }
2048
- return inst;
2049
- }
2050
- function _isMgrEnabled(cookieMgr) {
2051
- if (cookieMgr) {
2052
- return cookieMgr.isEnabled();
2053
- }
2054
- return true;
2055
- }
2056
- function _createCookieMgrConfig(rootConfig) {
2057
- var cookieMgrCfg = rootConfig.cookieCfg = rootConfig.cookieCfg || {};
2058
- setValue(cookieMgrCfg, "domain", rootConfig.cookieDomain, isNotNullOrUndefined, isNullOrUndefined);
2059
- setValue(cookieMgrCfg, "path", rootConfig.cookiePath || "/", null, isNullOrUndefined);
2060
- if (isNullOrUndefined(cookieMgrCfg[strEnabled])) {
2061
- var cookieEnabled = void 0;
2062
- if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
2063
- cookieEnabled = !rootConfig[strIsCookieUseDisabled];
2064
- }
2065
- if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
2066
- cookieEnabled = !rootConfig[strDisableCookiesUsage];
2067
- }
2068
- cookieMgrCfg[strEnabled] = cookieEnabled;
2069
- }
2070
- return cookieMgrCfg;
2071
- }
2072
- function safeGetCookieMgr(core, config) {
2073
- var cookieMgr;
2074
- if (core) {
2075
- cookieMgr = core.getCookieMgr();
2076
- }
2077
- else if (config) {
2078
- var cookieCfg = config.cookieCfg;
2079
- if (cookieCfg[strConfigCookieMgr]) {
2080
- cookieMgr = cookieCfg[strConfigCookieMgr];
2081
- }
2082
- else {
2083
- cookieMgr = createCookieMgr(config);
2084
- }
2085
- }
2086
- if (!cookieMgr) {
2087
- cookieMgr = _gblCookieMgr(config, (core || {}).logger);
2088
- }
2089
- return cookieMgr;
2090
- }
2091
- function createCookieMgr(rootConfig, logger) {
2092
- var cookieMgrConfig = _createCookieMgrConfig(rootConfig || _globalCookieConfig);
2093
- var _path = cookieMgrConfig.path || "/";
2094
- var _domain = cookieMgrConfig.domain;
2095
- var _enabled = cookieMgrConfig[strEnabled] !== false;
2096
- var cookieMgr = {
2097
- isEnabled: function () {
2098
- var enabled = _enabled && areCookiesSupported(logger);
2099
- var gblManager = _globalCookieConfig[strConfigCookieMgr];
2100
- if (enabled && gblManager && cookieMgr !== gblManager) {
2101
- enabled = _isMgrEnabled(gblManager);
2102
- }
2103
- return enabled;
2104
- },
2105
- setEnabled: function (value) {
2106
- _enabled = value !== false;
2107
- },
2108
- set: function (name, value, maxAgeSec, domain, path) {
2109
- var result = false;
2110
- if (_isMgrEnabled(cookieMgr)) {
2111
- var values = {};
2112
- var theValue = strTrim(value || strEmpty);
2113
- var idx = theValue.indexOf(";");
2114
- if (idx !== -1) {
2115
- theValue = strTrim(value.substring(0, idx));
2116
- values = _extractParts(value.substring(idx + 1));
2117
- }
2118
- setValue(values, "domain", domain || _domain, isTruthy, isUndefined);
2119
- if (!isNullOrUndefined(maxAgeSec)) {
2120
- var _isIE = isIE();
2121
- if (isUndefined(values[strExpires])) {
2122
- var nowMs = dateNow();
2123
- var expireMs = nowMs + (maxAgeSec * 1000);
2124
- if (expireMs > 0) {
2125
- var expiry = new Date();
2126
- expiry.setTime(expireMs);
2127
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
2128
- }
2129
- }
2130
- if (!_isIE) {
2131
- setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
2132
- }
2133
- }
2134
- var location_1 = getLocation();
2135
- if (location_1 && location_1.protocol === "https:") {
2136
- setValue(values, "secure", null, null, isUndefined);
2137
- if (_allowUaSameSite === null) {
2138
- _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {}).userAgent);
2139
- }
2140
- if (_allowUaSameSite) {
2141
- setValue(values, "SameSite", "None", null, isUndefined);
2142
- }
2143
- }
2144
- setValue(values, "path", path || _path, null, isUndefined);
2145
- var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
2146
- setCookieFn(name, _formatCookieValue(theValue, values));
2147
- result = true;
2148
- }
2149
- return result;
2150
- },
2151
- get: function (name) {
2152
- var value = strEmpty;
2153
- if (_isMgrEnabled(cookieMgr)) {
2154
- value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
2155
- }
2156
- return value;
2157
- },
2158
- del: function (name, path) {
2159
- var result = false;
2160
- if (_isMgrEnabled(cookieMgr)) {
2161
- result = cookieMgr.purge(name, path);
2162
- }
2163
- return result;
2164
- },
2165
- purge: function (name, path) {
2166
- var _a;
2167
- var result = false;
2168
- if (areCookiesSupported(logger)) {
2169
- var values = (_a = {},
2170
- _a["path"] = path ? path : "/",
2171
- _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2172
- _a);
2173
- if (!isIE()) {
2174
- values["max-age"] = "0";
2175
- }
2176
- var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
2177
- delCookie(name, _formatCookieValue(strEmpty, values));
2178
- result = true;
2179
- }
2180
- return result;
2181
- }
2182
- };
2183
- cookieMgr[strConfigCookieMgr] = cookieMgr;
2184
- return cookieMgr;
2185
- }
2186
- function areCookiesSupported(logger) {
2187
- if (_supportsCookies === null) {
2188
- _supportsCookies = false;
2189
- try {
2190
- var doc = _doc || {};
2191
- _supportsCookies = doc[strCookie] !== undefined;
2192
- }
2193
- catch (e) {
2194
- _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
2195
- }
2196
- }
2197
- return _supportsCookies;
2198
- }
2199
- function _extractParts(theValue) {
2200
- var values = {};
2201
- if (theValue && theValue.length) {
2202
- var parts = strTrim(theValue).split(";");
2203
- arrForEach(parts, function (thePart) {
2204
- thePart = strTrim(thePart || strEmpty);
2205
- if (thePart) {
2206
- var idx = thePart.indexOf("=");
2207
- if (idx === -1) {
2208
- values[thePart] = null;
2209
- }
2210
- else {
2211
- values[strTrim(thePart.substring(0, idx))] = strTrim(thePart.substring(idx + 1));
2212
- }
2213
- }
2214
- });
2215
- }
2216
- return values;
2217
- }
2218
- function _formatDate(theDate, func) {
2219
- if (isFunction(theDate[func])) {
2220
- return theDate[func]();
2221
- }
2222
- return null;
2223
- }
2224
- function _formatCookieValue(value, values) {
2225
- var cookieValue = value || strEmpty;
2226
- objForEachKey(values, function (name, theValue) {
2227
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
2228
- });
2229
- return cookieValue;
2230
- }
2231
- function _getCookieValue(name) {
2232
- var cookieValue = strEmpty;
2233
- if (_doc) {
2234
- var theCookie = _doc[strCookie] || strEmpty;
2235
- if (_parsedCookieValue !== theCookie) {
2236
- _cookieCache = _extractParts(theCookie);
2237
- _parsedCookieValue = theCookie;
2238
- }
2239
- cookieValue = strTrim(_cookieCache[name] || strEmpty);
2240
- }
2241
- return cookieValue;
2242
- }
2243
- function _setCookieValue(name, cookieValue) {
2244
- if (_doc) {
2245
- _doc[strCookie] = name + "=" + cookieValue;
2246
- }
2247
- }
2248
- function uaDisallowsSameSiteNone(userAgent) {
2249
- if (!isString(userAgent)) {
2250
- return false;
2251
- }
2252
- if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
2253
- return true;
2254
- }
2255
- if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
2256
- return true;
2257
- }
2258
- if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
2259
- return true;
2260
- }
2261
- if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
2262
- return true;
2263
- }
2264
- if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
2265
- return true;
2266
- }
2267
- if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
2268
- return true;
2269
- }
2270
- return false;
2271
- }
2272
-
2273
- var strIKey = "iKey";
2274
- var strExtensionConfig = "extensionConfig";
2275
-
2276
2861
  var ChannelControllerPriority = 500;
2277
2862
  var ChannelValidationMessage = "Channel has invalid priority - ";
2278
- function _addChannelQueue(channelQueue, queue, config, core) {
2279
- if (queue && isArray(queue) && queue.length > 0) {
2863
+ function _addChannelQueue(channelQueue, queue, core) {
2864
+ if (queue && isArray(queue) && queue[_DYN_LENGTH ] > 0) {
2280
2865
  queue = queue.sort(function (a, b) {
2281
- return a.priority - b.priority;
2866
+ return a[STR_PRIORITY ] - b[STR_PRIORITY ];
2282
2867
  });
2283
2868
  arrForEach(queue, function (queueItem) {
2284
- if (queueItem.priority < ChannelControllerPriority) {
2285
- throwError(ChannelValidationMessage + queueItem.identifier);
2869
+ if (queueItem[STR_PRIORITY ] < ChannelControllerPriority) {
2870
+ throwError(ChannelValidationMessage + queueItem[_DYN_IDENTIFIER ]);
2286
2871
  }
2287
2872
  });
2288
- channelQueue.push({
2873
+ channelQueue[_DYN_PUSH ]({
2289
2874
  queue: objFreeze(queue),
2290
- chain: createTelemetryProxyChain(queue, config, core)
2875
+ chain: createTelemetryProxyChain(queue, core[_DYN_CONFIG ], core)
2291
2876
  });
2292
2877
  }
2293
2878
  }
2294
2879
  function createChannelControllerPlugin(channelQueue, core) {
2295
- var _a;
2296
2880
  function _getTelCtx() {
2297
- return createProcessTelemetryContext(null, core.config, core, null);
2881
+ return createProcessTelemetryContext(null, core[_DYN_CONFIG ], core, null);
2298
2882
  }
2299
2883
  function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
2300
- var waiting = theChannels ? (theChannels.length + 1) : 1;
2884
+ var waiting = theChannels ? (theChannels[_DYN_LENGTH ] + 1) : 1;
2301
2885
  function _runChainOnComplete() {
2302
2886
  waiting--;
2303
2887
  if (waiting === 0) {
@@ -2307,10 +2891,10 @@
2307
2891
  }
2308
2892
  if (waiting > 0) {
2309
2893
  arrForEach(theChannels, function (channels) {
2310
- if (channels && channels.queue.length > 0) {
2894
+ if (channels && channels.queue[_DYN_LENGTH ] > 0) {
2311
2895
  var channelChain = channels.chain;
2312
- var chainCtx = itemCtx.createNew(channelChain);
2313
- chainCtx.onComplete(_runChainOnComplete);
2896
+ var chainCtx = itemCtx[_DYN_CREATE_NEW ](channelChain);
2897
+ chainCtx[_DYN_ON_COMPLETE ](_runChainOnComplete);
2314
2898
  processFn(chainCtx);
2315
2899
  }
2316
2900
  else {
@@ -2325,9 +2909,9 @@
2325
2909
  reason: 0
2326
2910
  };
2327
2911
  _processChannelQueue(channelQueue, updateCtx, function (chainCtx) {
2328
- chainCtx[strProcessNext](theUpdateState);
2912
+ chainCtx[_DYN_PROCESS_NEXT ](theUpdateState);
2329
2913
  }, function () {
2330
- updateCtx[strProcessNext](theUpdateState);
2914
+ updateCtx[_DYN_PROCESS_NEXT ](theUpdateState);
2331
2915
  });
2332
2916
  return true;
2333
2917
  }
@@ -2337,20 +2921,20 @@
2337
2921
  isAsync: false
2338
2922
  };
2339
2923
  _processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
2340
- chainCtx[strProcessNext](theUnloadState);
2924
+ chainCtx[_DYN_PROCESS_NEXT ](theUnloadState);
2341
2925
  }, function () {
2342
- unloadCtx[strProcessNext](theUnloadState);
2926
+ unloadCtx[_DYN_PROCESS_NEXT ](theUnloadState);
2343
2927
  isInitialized = false;
2344
2928
  });
2345
2929
  return true;
2346
2930
  }
2347
2931
  function _getChannel(pluginIdentifier) {
2348
2932
  var thePlugin = null;
2349
- if (channelQueue && channelQueue.length > 0) {
2933
+ if (channelQueue && channelQueue[_DYN_LENGTH ] > 0) {
2350
2934
  arrForEach(channelQueue, function (channels) {
2351
- if (channels && channels.queue.length > 0) {
2935
+ if (channels && channels.queue[_DYN_LENGTH ] > 0) {
2352
2936
  arrForEach(channels.queue, function (ext) {
2353
- if (ext.identifier === pluginIdentifier) {
2937
+ if (ext[_DYN_IDENTIFIER ] === pluginIdentifier) {
2354
2938
  thePlugin = ext;
2355
2939
  return -1;
2356
2940
  }
@@ -2364,46 +2948,45 @@
2364
2948
  return thePlugin;
2365
2949
  }
2366
2950
  var isInitialized = false;
2367
- var channelController = (_a = {
2368
- identifier: "ChannelControllerPlugin",
2369
- priority: ChannelControllerPriority,
2370
- initialize: function (config, core, extensions, pluginChain) {
2371
- isInitialized = true;
2372
- arrForEach(channelQueue, function (channels) {
2373
- if (channels && channels.queue.length > 0) {
2374
- initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
2375
- }
2376
- });
2377
- },
2378
- isInitialized: function () {
2379
- return isInitialized;
2380
- },
2381
- processTelemetry: function (item, itemCtx) {
2382
- _processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
2383
- chainCtx[strProcessNext](item);
2384
- }, function () {
2385
- itemCtx[strProcessNext](item);
2386
- });
2387
- },
2388
- update: _doUpdate
2951
+ var channelController = {
2952
+ identifier: "ChannelControllerPlugin",
2953
+ priority: ChannelControllerPriority,
2954
+ initialize: function (config, core, extensions, pluginChain) {
2955
+ isInitialized = true;
2956
+ arrForEach(channelQueue, function (channels) {
2957
+ if (channels && channels.queue[_DYN_LENGTH ] > 0) {
2958
+ initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
2959
+ }
2960
+ });
2961
+ },
2962
+ isInitialized: function () {
2963
+ return isInitialized;
2389
2964
  },
2390
- _a[strPause] = function () {
2965
+ processTelemetry: function (item, itemCtx) {
2966
+ _processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
2967
+ chainCtx[_DYN_PROCESS_NEXT ](item);
2968
+ }, function () {
2969
+ itemCtx[_DYN_PROCESS_NEXT ](item);
2970
+ });
2971
+ },
2972
+ update: _doUpdate,
2973
+ pause: function () {
2391
2974
  _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
2392
2975
  chainCtx.iterate(function (plugin) {
2393
- plugin[strPause] && plugin[strPause]();
2976
+ plugin.pause && plugin.pause();
2394
2977
  });
2395
2978
  }, null);
2396
2979
  },
2397
- _a[strResume] = function () {
2980
+ resume: function () {
2398
2981
  _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
2399
2982
  chainCtx.iterate(function (plugin) {
2400
- plugin[strResume] && plugin[strResume]();
2983
+ plugin.resume && plugin.resume();
2401
2984
  });
2402
2985
  }, null);
2403
2986
  },
2404
- _a[strTeardown] = _doTeardown,
2405
- _a.getChannel = _getChannel,
2406
- _a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
2987
+ teardown: _doTeardown,
2988
+ getChannel: _getChannel,
2989
+ flush: function (isAsync, callBack, sendReason, cbTimeout) {
2407
2990
  var waiting = 1;
2408
2991
  var doneIterating = false;
2409
2992
  var cbTimer = null;
@@ -2421,10 +3004,10 @@
2421
3004
  }
2422
3005
  _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
2423
3006
  chainCtx.iterate(function (plugin) {
2424
- if (plugin.flush) {
3007
+ if (plugin[_DYN_FLUSH ]) {
2425
3008
  waiting++;
2426
3009
  var handled_1 = false;
2427
- if (!plugin.flush(isAsync, function () {
3010
+ if (!plugin[_DYN_FLUSH ](isAsync, function () {
2428
3011
  handled_1 = true;
2429
3012
  doCallback();
2430
3013
  }, sendReason)) {
@@ -2448,25 +3031,25 @@
2448
3031
  });
2449
3032
  return true;
2450
3033
  },
2451
- _a._setQueue = function (queue) {
3034
+ _setQueue: function (queue) {
2452
3035
  channelQueue = queue;
2453
- },
2454
- _a);
3036
+ }
3037
+ };
2455
3038
  return channelController;
2456
3039
  }
2457
- function createChannelQueues(channels, extensions, config, core) {
3040
+ function createChannelQueues(channels, extensions, core) {
2458
3041
  var channelQueue = [];
2459
3042
  if (channels) {
2460
- arrForEach(channels, function (queue) { return _addChannelQueue(channelQueue, queue, config, core); });
3043
+ arrForEach(channels, function (queue) { return _addChannelQueue(channelQueue, queue, core); });
2461
3044
  }
2462
3045
  if (extensions) {
2463
3046
  var extensionQueue_1 = [];
2464
3047
  arrForEach(extensions, function (plugin) {
2465
- if (plugin.priority > ChannelControllerPriority) {
2466
- extensionQueue_1.push(plugin);
3048
+ if (plugin[STR_PRIORITY ] > ChannelControllerPriority) {
3049
+ extensionQueue_1[_DYN_PUSH ](plugin);
2467
3050
  }
2468
3051
  });
2469
- _addChannelQueue(channelQueue, extensionQueue_1, config, core);
3052
+ _addChannelQueue(channelQueue, extensionQueue_1, core);
2470
3053
  }
2471
3054
  return channelQueue;
2472
3055
  }
@@ -2475,7 +3058,7 @@
2475
3058
  var handlers = [];
2476
3059
  function _addHandler(handler) {
2477
3060
  if (handler) {
2478
- handlers.push(handler);
3061
+ handlers[_DYN_PUSH ](handler);
2479
3062
  }
2480
3063
  }
2481
3064
  function _runHandlers(unloadCtx, unloadState) {
@@ -2484,7 +3067,7 @@
2484
3067
  handler(unloadCtx, unloadState);
2485
3068
  }
2486
3069
  catch (e) {
2487
- _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
3070
+ _throwInternal(unloadCtx[_DYN_DIAG_LOG ](), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
2488
3071
  }
2489
3072
  });
2490
3073
  handlers = [];
@@ -2506,37 +3089,40 @@
2506
3089
  var _hooks;
2507
3090
  _initDefaults();
2508
3091
  dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
2509
- _self.initialize = function (config, core, extensions, pluginChain) {
3092
+ _self[_DYN_INITIALIZE ] = function (config, core, extensions, pluginChain) {
2510
3093
  _setDefaults(config, core, pluginChain);
2511
3094
  _isinitialized = true;
2512
3095
  };
2513
- _self.teardown = function (unloadCtx, unloadState) {
2514
- var core = _self.core;
2515
- if (!core || (unloadCtx && core !== unloadCtx.core())) {
3096
+ _self[_DYN_TEARDOWN ] = function (unloadCtx, unloadState) {
3097
+ var _a;
3098
+ var core = _self[STR_CORE ];
3099
+ if (!core || (unloadCtx && core !== unloadCtx[STR_CORE ]())) {
2516
3100
  return;
2517
3101
  }
2518
3102
  var result;
2519
3103
  var unloadDone = false;
2520
3104
  var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
2521
- var theUnloadState = unloadState || {
2522
- reason: 0 ,
2523
- isAsync: false
2524
- };
3105
+ var theUnloadState = unloadState || (_a = {
3106
+ reason: 0
3107
+ },
3108
+ _a[_DYN_IS_ASYNC ] = false,
3109
+ _a);
2525
3110
  function _unloadCallback() {
2526
3111
  if (!unloadDone) {
2527
3112
  unloadDone = true;
2528
3113
  _unloadHandlerContainer.run(theUnloadCtx, unloadState);
2529
- arrForEach(_hooks, function (fn) {
3114
+ var oldHooks = _hooks;
3115
+ _hooks = [];
3116
+ arrForEach(oldHooks, function (fn) {
2530
3117
  fn.rm();
2531
3118
  });
2532
- _hooks = [];
2533
3119
  if (result === true) {
2534
- theUnloadCtx.processNext(theUnloadState);
3120
+ theUnloadCtx[_DYN_PROCESS_NEXT ](theUnloadState);
2535
3121
  }
2536
3122
  _initDefaults();
2537
3123
  }
2538
3124
  }
2539
- if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
3125
+ if (!_self[_DYN__DO_TEARDOWN ] || _self[_DYN__DO_TEARDOWN ](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
2540
3126
  _unloadCallback();
2541
3127
  }
2542
3128
  else {
@@ -2544,9 +3130,9 @@
2544
3130
  }
2545
3131
  return result;
2546
3132
  };
2547
- _self.update = function (updateCtx, updateState) {
2548
- var core = _self.core;
2549
- if (!core || (updateCtx && core !== updateCtx.core())) {
3133
+ _self[_DYN_UPDATE ] = function (updateCtx, updateState) {
3134
+ var core = _self[STR_CORE ];
3135
+ if (!core || (updateCtx && core !== updateCtx[STR_CORE ]())) {
2550
3136
  return;
2551
3137
  }
2552
3138
  var result;
@@ -2558,7 +3144,7 @@
2558
3144
  function _updateCallback() {
2559
3145
  if (!updateDone) {
2560
3146
  updateDone = true;
2561
- _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
3147
+ _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx[_DYN_GET_NEXT ]());
2562
3148
  }
2563
3149
  }
2564
3150
  if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
@@ -2575,30 +3161,30 @@
2575
3161
  _hooks = _hooks.concat(hooks);
2576
3162
  }
2577
3163
  else {
2578
- _hooks.push(hooks);
3164
+ _hooks[_DYN_PUSH ](hooks);
2579
3165
  }
2580
3166
  }
2581
3167
  };
2582
3168
  proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
2583
3169
  });
2584
- _self.diagLog = function (itemCtx) {
2585
- return _getTelCtx(itemCtx).diagLog();
3170
+ _self[_DYN_DIAG_LOG ] = function (itemCtx) {
3171
+ return _getTelCtx(itemCtx)[_DYN_DIAG_LOG ]();
2586
3172
  };
2587
- _self[strIsInitialized] = function () {
3173
+ _self[_DYN_IS_INITIALIZED ] = function () {
2588
3174
  return _isinitialized;
2589
3175
  };
2590
3176
  _self.setInitialized = function (isInitialized) {
2591
3177
  _isinitialized = isInitialized;
2592
3178
  };
2593
- _self[strSetNextPlugin] = function (next) {
3179
+ _self[_DYN_SET_NEXT_PLUGIN ] = function (next) {
2594
3180
  _nextPlugin = next;
2595
3181
  };
2596
- _self.processNext = function (env, itemCtx) {
3182
+ _self[_DYN_PROCESS_NEXT ] = function (env, itemCtx) {
2597
3183
  if (itemCtx) {
2598
- itemCtx.processNext(env);
3184
+ itemCtx[_DYN_PROCESS_NEXT ](env);
2599
3185
  }
2600
- else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
2601
- _nextPlugin.processTelemetry(env, null);
3186
+ else if (_nextPlugin && isFunction(_nextPlugin[STR_PROCESS_TELEMETRY ])) {
3187
+ _nextPlugin[STR_PROCESS_TELEMETRY ](env, null);
2602
3188
  }
2603
3189
  };
2604
3190
  _self._getTelCtx = _getTelCtx;
@@ -2606,39 +3192,40 @@
2606
3192
  if (currentCtx === void 0) { currentCtx = null; }
2607
3193
  var itemCtx = currentCtx;
2608
3194
  if (!itemCtx) {
2609
- var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
3195
+ var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self[STR_CORE ]);
2610
3196
  if (_nextPlugin && _nextPlugin[strGetPlugin]) {
2611
- itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
3197
+ itemCtx = rootCtx[_DYN_CREATE_NEW ](null, _nextPlugin[strGetPlugin]);
2612
3198
  }
2613
3199
  else {
2614
- itemCtx = rootCtx.createNew(null, _nextPlugin);
3200
+ itemCtx = rootCtx[_DYN_CREATE_NEW ](null, _nextPlugin);
2615
3201
  }
2616
3202
  }
2617
3203
  return itemCtx;
2618
3204
  }
2619
3205
  function _setDefaults(config, core, pluginChain) {
2620
3206
  if (config) {
2621
- setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
3207
+ setValue(config, STR_EXTENSION_CONFIG, [], null, isNullOrUndefined);
2622
3208
  }
2623
3209
  if (!pluginChain && core) {
2624
- pluginChain = core.getProcessTelContext().getNext();
3210
+ pluginChain = core[_DYN_GET_PROCESS_TEL_CONT0 ]()[_DYN_GET_NEXT ]();
2625
3211
  }
2626
3212
  var nextPlugin = _nextPlugin;
2627
3213
  if (_nextPlugin && _nextPlugin[strGetPlugin]) {
2628
3214
  nextPlugin = _nextPlugin[strGetPlugin]();
2629
3215
  }
2630
- _self.core = core;
3216
+ _self[STR_CORE ] = core;
2631
3217
  _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
2632
3218
  }
2633
3219
  function _initDefaults() {
2634
3220
  _isinitialized = false;
2635
- _self.core = null;
3221
+ _self[STR_CORE ] = null;
2636
3222
  _rootCtx = null;
2637
3223
  _nextPlugin = null;
2638
3224
  _hooks = [];
2639
3225
  _unloadHandlerContainer = createUnloadHandlerContainer();
2640
3226
  }
2641
3227
  }
3228
+ BaseTelemetryPlugin.__ieDyn=1;
2642
3229
  return BaseTelemetryPlugin;
2643
3230
  }());
2644
3231
 
@@ -2657,12 +3244,12 @@
2657
3244
  id: _id++,
2658
3245
  fn: telemetryInitializer
2659
3246
  };
2660
- _initializers.push(theInitializer);
3247
+ _initializers[_DYN_PUSH ](theInitializer);
2661
3248
  var handler = {
2662
3249
  remove: function () {
2663
3250
  arrForEach(_initializers, function (initializer, idx) {
2664
3251
  if (initializer.id === theInitializer.id) {
2665
- _initializers.splice(idx, 1);
3252
+ _initializers[_DYN_SPLICE ](idx, 1);
2666
3253
  return -1;
2667
3254
  }
2668
3255
  });
@@ -2670,28 +3257,28 @@
2670
3257
  };
2671
3258
  return handler;
2672
3259
  };
2673
- _self.processTelemetry = function (item, itemCtx) {
3260
+ _self[STR_PROCESS_TELEMETRY ] = function (item, itemCtx) {
2674
3261
  var doNotSendItem = false;
2675
- var telemetryInitializersCount = _initializers.length;
3262
+ var telemetryInitializersCount = _initializers[_DYN_LENGTH ];
2676
3263
  for (var i = 0; i < telemetryInitializersCount; ++i) {
2677
3264
  var telemetryInitializer = _initializers[i];
2678
3265
  if (telemetryInitializer) {
2679
3266
  try {
2680
- if (telemetryInitializer.fn.apply(null, [item]) === false) {
3267
+ if (telemetryInitializer.fn[_DYN_APPLY ](null, [item]) === false) {
2681
3268
  doNotSendItem = true;
2682
3269
  break;
2683
3270
  }
2684
3271
  }
2685
3272
  catch (e) {
2686
- _throwInternal(itemCtx.diagLog(), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
3273
+ _throwInternal(itemCtx[_DYN_DIAG_LOG ](), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
2687
3274
  }
2688
3275
  }
2689
3276
  }
2690
3277
  if (!doNotSendItem) {
2691
- _self.processNext(item, itemCtx);
3278
+ _self[_DYN_PROCESS_NEXT ](item, itemCtx);
2692
3279
  }
2693
3280
  };
2694
- _self[strDoTeardown] = function () {
3281
+ _self[_DYN__DO_TEARDOWN ] = function () {
2695
3282
  _initDefaults();
2696
3283
  };
2697
3284
  });
@@ -2701,6 +3288,7 @@
2701
3288
  }
2702
3289
  return _this;
2703
3290
  }
3291
+ TelemetryInitializerPlugin.__ieDyn=1;
2704
3292
  return TelemetryInitializerPlugin;
2705
3293
  }(BaseTelemetryPlugin));
2706
3294
 
@@ -2715,14 +3303,15 @@
2715
3303
  return new PerfManager(notificationMgr);
2716
3304
  }
2717
3305
  function _validateExtensions(logger, channelPriority, allExtensions) {
3306
+ var _a;
2718
3307
  var coreExtensions = [];
2719
3308
  var extPriorities = {};
2720
3309
  arrForEach(allExtensions, function (ext) {
2721
- if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
3310
+ if (isNullOrUndefined(ext) || isNullOrUndefined(ext[_DYN_INITIALIZE ])) {
2722
3311
  throwError(strValidationError);
2723
3312
  }
2724
- var extPriority = ext.priority;
2725
- var identifier = ext.identifier;
3313
+ var extPriority = ext[STR_PRIORITY ];
3314
+ var identifier = ext[_DYN_IDENTIFIER ];
2726
3315
  if (ext && extPriority) {
2727
3316
  if (!isNullOrUndefined(extPriorities[extPriority])) {
2728
3317
  _warnToConsole(logger, "Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
@@ -2732,13 +3321,14 @@
2732
3321
  }
2733
3322
  }
2734
3323
  if (!extPriority || extPriority < channelPriority) {
2735
- coreExtensions.push(ext);
3324
+ coreExtensions[_DYN_PUSH ](ext);
2736
3325
  }
2737
3326
  });
2738
- return {
2739
- all: allExtensions,
2740
- core: coreExtensions
2741
- };
3327
+ return _a = {
3328
+ all: allExtensions
3329
+ },
3330
+ _a[STR_CORE ] = coreExtensions,
3331
+ _a;
2742
3332
  }
2743
3333
  function _isPluginPresent(thePlugin, plugins) {
2744
3334
  var exists = false;
@@ -2753,15 +3343,16 @@
2753
3343
  function _createDummyNotificationManager() {
2754
3344
  var _a;
2755
3345
  return objCreateFn((_a = {},
2756
- _a[strAddNotificationListener] = function (listener) { },
2757
- _a[strRemoveNotificationListener] = function (listener) { },
2758
- _a[strEventsSent] = function (events) { },
2759
- _a[strEventsDiscarded] = function (events, reason) { },
2760
- _a[strEventsSendRequest] = function (sendReason, isAsync) { },
3346
+ _a[_DYN_ADD_NOTIFICATION_LIS1 ] = function (listener) { },
3347
+ _a[_DYN_REMOVE_NOTIFICATION_2 ] = function (listener) { },
3348
+ _a[STR_EVENTS_SENT ] = function (events) { },
3349
+ _a[STR_EVENTS_DISCARDED ] = function (events, reason) { },
3350
+ _a[STR_EVENTS_SEND_REQUEST ] = function (sendReason, isAsync) { },
2761
3351
  _a));
2762
3352
  }
2763
3353
  var BaseCore$2 = /** @class */ (function () {
2764
3354
  function BaseCore() {
3355
+ var _config;
2765
3356
  var _isInitialized;
2766
3357
  var _eventQueue;
2767
3358
  var _notificationManager;
@@ -2780,36 +3371,38 @@
2780
3371
  var _evtNamespace;
2781
3372
  var _unloadHandlers;
2782
3373
  var _debugListener;
3374
+ var _traceCtx;
2783
3375
  var _internalLogPoller = 0;
2784
3376
  dynamicProto(BaseCore, this, function (_self) {
2785
3377
  _initDefaults();
2786
- _self.isInitialized = function () { return _isInitialized; };
2787
- _self.initialize = function (config, extensions, logger, notificationManager) {
3378
+ _self[_DYN_IS_INITIALIZED ] = function () { return _isInitialized; };
3379
+ _self[_DYN_INITIALIZE ] = function (config, extensions, logger, notificationManager) {
2788
3380
  if (_isUnloading) {
2789
3381
  throwError(strSdkUnloadingError);
2790
3382
  }
2791
- if (_self.isInitialized()) {
3383
+ if (_self[_DYN_IS_INITIALIZED ]()) {
2792
3384
  throwError("Core should not be initialized more than once");
2793
3385
  }
2794
- if (!config || isNullOrUndefined(config.instrumentationKey)) {
3386
+ _config = config || {};
3387
+ _self[_DYN_CONFIG ] = _config;
3388
+ if (isNullOrUndefined(config[_DYN_INSTRUMENTATION_KEY ])) {
2795
3389
  throwError("Please provide instrumentation key");
2796
3390
  }
2797
3391
  _notificationManager = notificationManager;
2798
3392
  _self[strNotificationManager] = notificationManager;
2799
- _self.config = config || {};
2800
- _initDebugListener(config);
2801
- _initPerfManager(config);
2802
- config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
2803
- _initExtConfig(config);
3393
+ _initDebugListener();
3394
+ _initPerfManager();
3395
+ _initExtConfig();
2804
3396
  if (logger) {
2805
- _self.logger = logger;
3397
+ _self[_DYN_LOGGER ] = logger;
2806
3398
  }
3399
+ var cfgExtensions = getSetValue(_config, STR_EXTENSIONS, []);
2807
3400
  _configExtensions = [];
2808
- _configExtensions.push.apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), config.extensions));
2809
- _channelConfig = (config || {}).channels;
2810
- _initPluginChain(config, null);
2811
- if (!_channelQueue || _channelQueue.length === 0) {
2812
- throwError("No channels available");
3401
+ _configExtensions[_DYN_PUSH ].apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), cfgExtensions));
3402
+ _channelConfig = getSetValue(_config, STR_CHANNELS, []);
3403
+ _initPluginChain(null);
3404
+ if (!_channelQueue || _channelQueue[_DYN_LENGTH ] === 0) {
3405
+ throwError("No " + STR_CHANNELS + " available");
2813
3406
  }
2814
3407
  _isInitialized = true;
2815
3408
  _self.releaseQueue();
@@ -2818,53 +3411,56 @@
2818
3411
  var controls = [];
2819
3412
  if (_channelQueue) {
2820
3413
  arrForEach(_channelQueue, function (channels) {
2821
- controls.push(channels.queue);
3414
+ controls[_DYN_PUSH ](channels.queue);
2822
3415
  });
2823
3416
  }
2824
3417
  return objFreeze(controls);
2825
3418
  };
2826
3419
  _self.track = function (telemetryItem) {
2827
- setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);
2828
- setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
2829
- setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
2830
- if (!_isUnloading && _self.isInitialized()) {
2831
- _createTelCtx().processNext(telemetryItem);
3420
+ telemetryItem.iKey = telemetryItem.iKey || _config[_DYN_INSTRUMENTATION_KEY ];
3421
+ telemetryItem[_DYN_TIME ] = telemetryItem[_DYN_TIME ] || toISOString(new Date());
3422
+ telemetryItem.ver = telemetryItem.ver || "4.0";
3423
+ if (!_isUnloading && _self[_DYN_IS_INITIALIZED ]()) {
3424
+ _createTelCtx()[_DYN_PROCESS_NEXT ](telemetryItem);
2832
3425
  }
2833
3426
  else {
2834
- _eventQueue.push(telemetryItem);
3427
+ _eventQueue[_DYN_PUSH ](telemetryItem);
2835
3428
  }
2836
3429
  };
2837
- _self.getProcessTelContext = _createTelCtx;
2838
- _self.getNotifyMgr = function () {
3430
+ _self[_DYN_GET_PROCESS_TEL_CONT0 ] = _createTelCtx;
3431
+ _self[_DYN_GET_NOTIFY_MGR ] = function () {
2839
3432
  if (!_notificationManager) {
2840
3433
  _notificationManager = _createDummyNotificationManager();
2841
3434
  _self[strNotificationManager] = _notificationManager;
2842
3435
  }
2843
3436
  return _notificationManager;
2844
3437
  };
2845
- _self[strAddNotificationListener] = function (listener) {
3438
+ _self[_DYN_ADD_NOTIFICATION_LIS1 ] = function (listener) {
2846
3439
  if (_notificationManager) {
2847
- _notificationManager[strAddNotificationListener](listener);
3440
+ _notificationManager[_DYN_ADD_NOTIFICATION_LIS1 ](listener);
2848
3441
  }
2849
3442
  };
2850
- _self[strRemoveNotificationListener] = function (listener) {
3443
+ _self[_DYN_REMOVE_NOTIFICATION_2 ] = function (listener) {
2851
3444
  if (_notificationManager) {
2852
- _notificationManager[strRemoveNotificationListener](listener);
3445
+ _notificationManager[_DYN_REMOVE_NOTIFICATION_2 ](listener);
2853
3446
  }
2854
3447
  };
2855
3448
  _self.getCookieMgr = function () {
2856
3449
  if (!_cookieManager) {
2857
- _cookieManager = createCookieMgr(_self.config, _self.logger);
3450
+ _cookieManager = createCookieMgr(_config, _self[_DYN_LOGGER ]);
2858
3451
  }
2859
3452
  return _cookieManager;
2860
3453
  };
2861
3454
  _self.setCookieMgr = function (cookieMgr) {
2862
3455
  _cookieManager = cookieMgr;
2863
3456
  };
2864
- _self.getPerfMgr = function () {
3457
+ _self[STR_GET_PERF_MGR ] = function () {
2865
3458
  if (!_perfManager && !_cfgPerfManager) {
2866
- if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
2867
- _cfgPerfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
3459
+ if (getCfgValue(_config.enablePerfMgr)) {
3460
+ var createPerfMgr = getCfgValue(_config[STR_CREATE_PERF_MGR ]);
3461
+ if (isFunction(createPerfMgr)) {
3462
+ _cfgPerfManager = createPerfMgr(_self, _self[_DYN_GET_NOTIFY_MGR ]());
3463
+ }
2868
3464
  }
2869
3465
  }
2870
3466
  return _perfManager || _cfgPerfManager || getGblPerfMgr();
@@ -2873,20 +3469,20 @@
2873
3469
  _perfManager = perfMgr;
2874
3470
  };
2875
3471
  _self.eventCnt = function () {
2876
- return _eventQueue.length;
3472
+ return _eventQueue[_DYN_LENGTH ];
2877
3473
  };
2878
3474
  _self.releaseQueue = function () {
2879
- if (_isInitialized && _eventQueue.length > 0) {
3475
+ if (_isInitialized && _eventQueue[_DYN_LENGTH ] > 0) {
2880
3476
  var eventQueue = _eventQueue;
2881
3477
  _eventQueue = [];
2882
3478
  arrForEach(eventQueue, function (event) {
2883
- _createTelCtx().processNext(event);
3479
+ _createTelCtx()[_DYN_PROCESS_NEXT ](event);
2884
3480
  });
2885
3481
  }
2886
3482
  };
2887
3483
  _self.pollInternalLogs = function (eventName) {
2888
3484
  _internalLogsEventName = eventName || null;
2889
- var interval = _self.config.diagnosticLogInterval;
3485
+ var interval = getCfgValue(_config.diagnosticLogInterval);
2890
3486
  if (!interval || !(interval > 0)) {
2891
3487
  interval = 10000;
2892
3488
  }
@@ -2898,7 +3494,7 @@
2898
3494
  }, interval);
2899
3495
  return _internalLogPoller;
2900
3496
  };
2901
- _self.stopPollingInternalLogs = function () {
3497
+ _self[_DYN_STOP_POLLING_INTERNA3 ] = function () {
2902
3498
  if (_internalLogPoller) {
2903
3499
  clearInterval(_internalLogPoller);
2904
3500
  _internalLogPoller = 0;
@@ -2907,6 +3503,7 @@
2907
3503
  };
2908
3504
  proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
2909
3505
  _self.unload = function (isAsync, unloadComplete, cbTimeout) {
3506
+ var _a;
2910
3507
  if (isAsync === void 0) { isAsync = true; }
2911
3508
  if (!_isInitialized) {
2912
3509
  throwError(strSdkNotInitialized);
@@ -2914,13 +3511,14 @@
2914
3511
  if (_isUnloading) {
2915
3512
  throwError(strSdkUnloadingError);
2916
3513
  }
2917
- var unloadState = {
2918
- reason: 50 ,
2919
- isAsync: isAsync,
2920
- flushComplete: false
2921
- };
3514
+ var unloadState = (_a = {
3515
+ reason: 50
3516
+ },
3517
+ _a[_DYN_IS_ASYNC ] = isAsync,
3518
+ _a.flushComplete = false,
3519
+ _a);
2922
3520
  var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self);
2923
- processUnloadCtx.onComplete(function () {
3521
+ processUnloadCtx[_DYN_ON_COMPLETE ](function () {
2924
3522
  _initDefaults();
2925
3523
  unloadComplete && unloadComplete(unloadState);
2926
3524
  }, _self);
@@ -2928,33 +3526,33 @@
2928
3526
  unloadState.flushComplete = flushComplete;
2929
3527
  _isUnloading = true;
2930
3528
  _unloadHandlers.run(processUnloadCtx, unloadState);
2931
- _self.stopPollingInternalLogs();
2932
- processUnloadCtx.processNext(unloadState);
3529
+ _self[_DYN_STOP_POLLING_INTERNA3 ]();
3530
+ processUnloadCtx[_DYN_PROCESS_NEXT ](unloadState);
2933
3531
  }
2934
3532
  if (!_flushChannels(isAsync, _doUnload, 6 , cbTimeout)) {
2935
3533
  _doUnload(false);
2936
3534
  }
2937
3535
  };
2938
- _self.getPlugin = _getPlugin;
3536
+ _self[_DYN_GET_PLUGIN ] = _getPlugin;
2939
3537
  _self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
2940
3538
  if (!plugin) {
2941
3539
  addCb && addCb(false);
2942
3540
  _logOrThrowError(strValidationError);
2943
3541
  return;
2944
3542
  }
2945
- var existingPlugin = _getPlugin(plugin.identifier);
3543
+ var existingPlugin = _getPlugin(plugin[_DYN_IDENTIFIER ]);
2946
3544
  if (existingPlugin && !replaceExisting) {
2947
3545
  addCb && addCb(false);
2948
- _logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
3546
+ _logOrThrowError("Plugin [" + plugin[_DYN_IDENTIFIER ] + "] is already loaded!");
2949
3547
  return;
2950
3548
  }
2951
3549
  var updateState = {
2952
3550
  reason: 16
2953
3551
  };
2954
3552
  function _addPlugin(removed) {
2955
- _configExtensions.push(plugin);
3553
+ _configExtensions[_DYN_PUSH ](plugin);
2956
3554
  updateState.added = [plugin];
2957
- _initPluginChain(_self.config, updateState);
3555
+ _initPluginChain(updateState);
2958
3556
  addCb && addCb(true);
2959
3557
  }
2960
3558
  if (existingPlugin) {
@@ -2981,13 +3579,23 @@
2981
3579
  _self.evtNamespace = function () {
2982
3580
  return _evtNamespace;
2983
3581
  };
2984
- _self.flush = _flushChannels;
3582
+ _self[_DYN_FLUSH ] = _flushChannels;
3583
+ _self.getTraceCtx = function (createNew) {
3584
+ if (!_traceCtx) {
3585
+ _traceCtx = createDistributedTraceContext();
3586
+ }
3587
+ return _traceCtx;
3588
+ };
3589
+ _self.setTraceCtx = function (traceCtx) {
3590
+ _traceCtx = traceCtx || null;
3591
+ };
2985
3592
  proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
2986
3593
  function _initDefaults() {
2987
3594
  _isInitialized = false;
2988
- _self.config = objExtend(true, {}, defaultInitConfig);
2989
- _self.logger = new DiagnosticLogger(_self.config);
2990
- _self._extensions = [];
3595
+ _config = objExtend(true, {}, defaultInitConfig);
3596
+ _self[_DYN_CONFIG ] = _config;
3597
+ _self[_DYN_LOGGER ] = new DiagnosticLogger(_config);
3598
+ _self[_DYN__EXTENSIONS ] = [];
2991
3599
  _telemetryInitializerPlugin = new TelemetryInitializerPlugin();
2992
3600
  _eventQueue = [];
2993
3601
  _notificationManager = null;
@@ -3004,45 +3612,47 @@
3004
3612
  _internalLogsEventName = null;
3005
3613
  _evtNamespace = createUniqueNamespace("AIBaseCore", true);
3006
3614
  _unloadHandlers = createUnloadHandlerContainer();
3615
+ _traceCtx = null;
3007
3616
  }
3008
3617
  function _createTelCtx() {
3009
- return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
3618
+ return createProcessTelemetryContext(_getPluginChain(), _config, _self);
3010
3619
  }
3011
- function _initPluginChain(config, updateState) {
3012
- var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
3013
- _coreExtensions = theExtensions.core;
3620
+ function _initPluginChain(updateState) {
3621
+ var theExtensions = _validateExtensions(_self[_DYN_LOGGER ], ChannelControllerPriority, _configExtensions);
3622
+ _coreExtensions = theExtensions[STR_CORE ];
3014
3623
  _pluginChain = null;
3015
3624
  var allExtensions = theExtensions.all;
3016
- _channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
3625
+ _channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, _self));
3017
3626
  if (_channelControl) {
3018
3627
  var idx = arrIndexOf(allExtensions, _channelControl);
3019
3628
  if (idx !== -1) {
3020
- allExtensions.splice(idx, 1);
3629
+ allExtensions[_DYN_SPLICE ](idx, 1);
3021
3630
  }
3022
3631
  idx = arrIndexOf(_coreExtensions, _channelControl);
3023
3632
  if (idx !== -1) {
3024
- _coreExtensions.splice(idx, 1);
3633
+ _coreExtensions[_DYN_SPLICE ](idx, 1);
3025
3634
  }
3026
3635
  _channelControl._setQueue(_channelQueue);
3027
3636
  }
3028
3637
  else {
3029
3638
  _channelControl = createChannelControllerPlugin(_channelQueue, _self);
3030
3639
  }
3031
- allExtensions.push(_channelControl);
3032
- _coreExtensions.push(_channelControl);
3033
- _self._extensions = sortPlugins(allExtensions);
3034
- _channelControl.initialize(config, _self, allExtensions);
3640
+ allExtensions[_DYN_PUSH ](_channelControl);
3641
+ _coreExtensions[_DYN_PUSH ](_channelControl);
3642
+ _self[_DYN__EXTENSIONS ] = sortPlugins(allExtensions);
3643
+ _channelControl[_DYN_INITIALIZE ](_config, _self, allExtensions);
3035
3644
  initializePlugins(_createTelCtx(), allExtensions);
3036
- _self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
3645
+ _self[_DYN__EXTENSIONS ] = objFreeze(sortPlugins(_coreExtensions || [])).slice();
3037
3646
  if (updateState) {
3038
3647
  _doUpdate(updateState);
3039
3648
  }
3040
3649
  }
3041
3650
  function _getPlugin(pluginIdentifier) {
3651
+ var _a;
3042
3652
  var theExt = null;
3043
3653
  var thePlugin = null;
3044
- arrForEach(_self._extensions, function (ext) {
3045
- if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
3654
+ arrForEach(_self[_DYN__EXTENSIONS ], function (ext) {
3655
+ if (ext[_DYN_IDENTIFIER ] === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
3046
3656
  thePlugin = ext;
3047
3657
  return -1;
3048
3658
  }
@@ -3051,33 +3661,36 @@
3051
3661
  thePlugin = _channelControl.getChannel(pluginIdentifier);
3052
3662
  }
3053
3663
  if (thePlugin) {
3054
- theExt = {
3055
- plugin: thePlugin,
3056
- setEnabled: function (enabled) {
3057
- _getPluginState(thePlugin)[strDisabled] = !enabled;
3664
+ theExt = (_a = {
3665
+ plugin: thePlugin
3058
3666
  },
3059
- isEnabled: function () {
3667
+ _a[_DYN_SET_ENABLED ] = function (enabled) {
3668
+ _getPluginState(thePlugin)[STR_DISABLED] = !enabled;
3669
+ },
3670
+ _a.isEnabled = function () {
3060
3671
  var pluginState = _getPluginState(thePlugin);
3061
- return !pluginState[strTeardown] && !pluginState[strDisabled];
3672
+ return !pluginState[_DYN_TEARDOWN ] && !pluginState[STR_DISABLED];
3062
3673
  },
3063
- remove: function (isAsync, removeCb) {
3674
+ _a.remove = function (isAsync, removeCb) {
3675
+ var _a;
3064
3676
  if (isAsync === void 0) { isAsync = true; }
3065
3677
  var pluginsToRemove = [thePlugin];
3066
- var unloadState = {
3067
- reason: 1 ,
3068
- isAsync: isAsync
3069
- };
3678
+ var unloadState = (_a = {
3679
+ reason: 1
3680
+ },
3681
+ _a[_DYN_IS_ASYNC ] = isAsync,
3682
+ _a);
3070
3683
  _removePlugins(pluginsToRemove, unloadState, function (removed) {
3071
3684
  if (removed) {
3072
- _initPluginChain(_self.config, {
3685
+ _initPluginChain({
3073
3686
  reason: 32 ,
3074
3687
  removed: pluginsToRemove
3075
3688
  });
3076
3689
  }
3077
3690
  removeCb && removeCb(removed);
3078
3691
  });
3079
- }
3080
- };
3692
+ },
3693
+ _a);
3081
3694
  }
3082
3695
  return theExt;
3083
3696
  }
@@ -3085,22 +3698,22 @@
3085
3698
  if (!_pluginChain) {
3086
3699
  var extensions = (_coreExtensions || []).slice();
3087
3700
  if (arrIndexOf(extensions, _telemetryInitializerPlugin) === -1) {
3088
- extensions.push(_telemetryInitializerPlugin);
3701
+ extensions[_DYN_PUSH ](_telemetryInitializerPlugin);
3089
3702
  }
3090
- _pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
3703
+ _pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _config, _self);
3091
3704
  }
3092
3705
  return _pluginChain;
3093
3706
  }
3094
3707
  function _removePlugins(thePlugins, unloadState, removeComplete) {
3095
- if (thePlugins && thePlugins.length > 0) {
3096
- var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
3708
+ if (thePlugins && thePlugins[_DYN_LENGTH ] > 0) {
3709
+ var unloadChain = createTelemetryProxyChain(thePlugins, _config, _self);
3097
3710
  var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self);
3098
- unloadCtx.onComplete(function () {
3711
+ unloadCtx[_DYN_ON_COMPLETE ](function () {
3099
3712
  var removed = false;
3100
3713
  var newConfigExtensions = [];
3101
3714
  arrForEach(_configExtensions, function (plugin, idx) {
3102
3715
  if (!_isPluginPresent(plugin, thePlugins)) {
3103
- newConfigExtensions.push(plugin);
3716
+ newConfigExtensions[_DYN_PUSH ](plugin);
3104
3717
  }
3105
3718
  else {
3106
3719
  removed = true;
@@ -3113,626 +3726,301 @@
3113
3726
  var newQueue = [];
3114
3727
  arrForEach(queue, function (channel) {
3115
3728
  if (!_isPluginPresent(channel, thePlugins)) {
3116
- newQueue.push(channel);
3729
+ newQueue[_DYN_PUSH ](channel);
3117
3730
  }
3118
3731
  else {
3119
3732
  removed = true;
3120
3733
  }
3121
3734
  });
3122
- newChannelConfig.push(newQueue);
3735
+ newChannelConfig[_DYN_PUSH ](newQueue);
3123
3736
  });
3124
3737
  _channelConfig = newChannelConfig;
3125
3738
  }
3126
3739
  removeComplete && removeComplete(removed);
3127
3740
  });
3128
- unloadCtx.processNext(unloadState);
3741
+ unloadCtx[_DYN_PROCESS_NEXT ](unloadState);
3129
3742
  }
3130
3743
  else {
3131
3744
  removeComplete(false);
3132
3745
  }
3133
3746
  }
3134
3747
  function _flushInternalLogs() {
3135
- var queue = _self.logger ? _self.logger.queue : [];
3748
+ var queue = _self[_DYN_LOGGER ] ? _self[_DYN_LOGGER ].queue : [];
3136
3749
  if (queue) {
3137
3750
  arrForEach(queue, function (logMessage) {
3138
- var item = {
3139
- name: _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage.messageId,
3140
- iKey: _self.config.instrumentationKey,
3141
- time: toISOString(new Date()),
3142
- baseType: _InternalLogMessage.dataType,
3143
- baseData: { message: logMessage.message }
3144
- };
3751
+ var _a;
3752
+ var item = (_a = {},
3753
+ _a[_DYN_NAME ] = _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage[_DYN_MESSAGE_ID ],
3754
+ _a.iKey = getCfgValue(_config[_DYN_INSTRUMENTATION_KEY ]),
3755
+ _a.time = toISOString(new Date()),
3756
+ _a.baseType = _InternalLogMessage.dataType,
3757
+ _a.baseData = { message: logMessage[_DYN_MESSAGE ] },
3758
+ _a);
3145
3759
  _self.track(item);
3146
3760
  });
3147
- queue.length = 0;
3761
+ queue[_DYN_LENGTH ] = 0;
3148
3762
  }
3149
3763
  }
3150
3764
  function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
3151
3765
  if (_channelControl) {
3152
- return _channelControl.flush(isAsync, callBack, sendReason || 6 , cbTimeout);
3153
- }
3154
- callBack && callBack(false);
3155
- return true;
3156
- }
3157
- function _initDebugListener(config) {
3158
- if (config.disableDbgExt === true && _debugListener) {
3159
- _notificationManager[strRemoveNotificationListener](_debugListener);
3160
- _debugListener = null;
3161
- }
3162
- if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
3163
- _debugListener = getDebugListener(config);
3164
- _notificationManager[strAddNotificationListener](_debugListener);
3165
- }
3166
- }
3167
- function _initPerfManager(config) {
3168
- if (!config.enablePerfMgr && _cfgPerfManager) {
3169
- _cfgPerfManager = null;
3170
- }
3171
- if (config.enablePerfMgr) {
3172
- setValue(_self.config, "createPerfMgr", _createPerfManager);
3173
- }
3174
- }
3175
- function _initExtConfig(config) {
3176
- var extConfig = getSetValue(config, strExtensionConfig);
3177
- extConfig.NotificationManager = _notificationManager;
3178
- }
3179
- function _doUpdate(updateState) {
3180
- var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self);
3181
- if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
3182
- updateCtx.processNext(updateState);
3183
- }
3184
- }
3185
- function _logOrThrowError(message) {
3186
- var logger = _self.logger;
3187
- if (logger) {
3188
- _throwInternal(logger, 2 , 73 , message);
3189
- }
3190
- else {
3191
- throwError(message);
3192
- }
3193
- }
3194
- });
3195
- }
3196
- return BaseCore;
3197
- }());
3198
-
3199
- function _runListeners(listeners, name, isAsync, callback) {
3200
- arrForEach(listeners, function (listener) {
3201
- if (listener && listener[name]) {
3202
- if (isAsync) {
3203
- setTimeout(function () { return callback(listener); }, 0);
3204
- }
3205
- else {
3206
- try {
3207
- callback(listener);
3208
- }
3209
- catch (e) {
3210
- }
3211
- }
3212
- }
3213
- });
3214
- }
3215
- var NotificationManager = /** @class */ (function () {
3216
- function NotificationManager(config) {
3217
- this.listeners = [];
3218
- var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
3219
- dynamicProto(NotificationManager, this, function (_self) {
3220
- _self[strAddNotificationListener] = function (listener) {
3221
- _self.listeners.push(listener);
3222
- };
3223
- _self[strRemoveNotificationListener] = function (listener) {
3224
- var index = arrIndexOf(_self.listeners, listener);
3225
- while (index > -1) {
3226
- _self.listeners.splice(index, 1);
3227
- index = arrIndexOf(_self.listeners, listener);
3228
- }
3229
- };
3230
- _self[strEventsSent] = function (events) {
3231
- _runListeners(_self.listeners, strEventsSent, true, function (listener) {
3232
- listener[strEventsSent](events);
3233
- });
3234
- };
3235
- _self[strEventsDiscarded] = function (events, reason) {
3236
- _runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
3237
- listener[strEventsDiscarded](events, reason);
3238
- });
3239
- };
3240
- _self[strEventsSendRequest] = function (sendReason, isAsync) {
3241
- _runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
3242
- listener[strEventsSendRequest](sendReason, isAsync);
3243
- });
3244
- };
3245
- _self[strPerfEvent] = function (perfEvent) {
3246
- if (perfEvent) {
3247
- if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
3248
- _runListeners(_self.listeners, strPerfEvent, false, function (listener) {
3249
- if (perfEvent.isAsync) {
3250
- setTimeout(function () { return listener[strPerfEvent](perfEvent); }, 0);
3251
- }
3252
- else {
3253
- listener[strPerfEvent](perfEvent);
3254
- }
3255
- });
3256
- }
3257
- }
3258
- };
3259
- });
3260
- }
3261
- return NotificationManager;
3262
- }());
3263
-
3264
- var AppInsightsCore$2 = /** @class */ (function (_super) {
3265
- __extendsFn(AppInsightsCore, _super);
3266
- function AppInsightsCore() {
3267
- var _this = _super.call(this) || this;
3268
- dynamicProto(AppInsightsCore, _this, function (_self, _base) {
3269
- _self.initialize = function (config, extensions, logger, notificationManager) {
3270
- _base.initialize(config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));
3271
- };
3272
- _self.track = function (telemetryItem) {
3273
- doPerf(_self.getPerfMgr(), function () { return "AppInsightsCore:track"; }, function () {
3274
- if (telemetryItem === null) {
3275
- _notifyInvalidEvent(telemetryItem);
3276
- throwError("Invalid telemetry item");
3277
- }
3278
- _validateTelemetryItem(telemetryItem);
3279
- _base.track(telemetryItem);
3280
- }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
3281
- };
3282
- function _validateTelemetryItem(telemetryItem) {
3283
- if (isNullOrUndefined(telemetryItem.name)) {
3284
- _notifyInvalidEvent(telemetryItem);
3285
- throwError("telemetry name required");
3286
- }
3287
- }
3288
- function _notifyInvalidEvent(telemetryItem) {
3289
- var manager = _self.getNotifyMgr();
3290
- if (manager) {
3291
- manager.eventsDiscarded([telemetryItem], 2 );
3292
- }
3293
- }
3294
- });
3295
- return _this;
3296
- }
3297
- return AppInsightsCore;
3298
- }(BaseCore$2));
3299
-
3300
- var strOnPrefix = "on";
3301
- var strAttachEvent = "attachEvent";
3302
- var strAddEventHelper = "addEventListener";
3303
- var strDetachEvent = "detachEvent";
3304
- var strRemoveEventListener = "removeEventListener";
3305
- var strEvents = "events";
3306
- var strVisibilityChangeEvt = "visibilitychange";
3307
- var strPageHide = "pagehide";
3308
- var strPageShow = "pageshow";
3309
- var strUnload = "unload";
3310
- var strBeforeUnload = "beforeunload";
3311
- var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
3312
- var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
3313
- var rRemoveEmptyNs = /\.[\.]+/g;
3314
- var rRemoveTrailingEmptyNs = /[\.]+$/;
3315
- var _guid = 1;
3316
- var elmNodeData = createElmNodeData("events");
3317
- var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
3318
- function _normalizeNamespace(name) {
3319
- if (name && name.replace) {
3320
- return name.replace(/^\s*\.*|\.*\s*$/g, "");
3321
- }
3322
- return name;
3323
- }
3324
- function _getEvtNamespace(eventName, evtNamespace) {
3325
- if (evtNamespace) {
3326
- var theNamespace_1 = "";
3327
- if (isArray(evtNamespace)) {
3328
- theNamespace_1 = "";
3329
- arrForEach(evtNamespace, function (name) {
3330
- name = _normalizeNamespace(name);
3331
- if (name) {
3332
- if (name[0] !== ".") {
3333
- name = "." + name;
3334
- }
3335
- theNamespace_1 += name;
3336
- }
3337
- });
3338
- }
3339
- else {
3340
- theNamespace_1 = _normalizeNamespace(evtNamespace);
3341
- }
3342
- if (theNamespace_1) {
3343
- if (theNamespace_1[0] !== ".") {
3344
- theNamespace_1 = "." + theNamespace_1;
3345
- }
3346
- eventName = (eventName || "") + theNamespace_1;
3347
- }
3348
- }
3349
- var parsedEvent = (eventNamespace.exec(eventName || "") || []);
3350
- return {
3351
- type: parsedEvent[1],
3352
- ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
3353
- };
3354
- }
3355
- function __getRegisteredEvents(target, eventName, evtNamespace) {
3356
- var theEvents = [];
3357
- var eventCache = elmNodeData.get(target, strEvents, {}, false);
3358
- var evtName = _getEvtNamespace(eventName, evtNamespace);
3359
- objForEachKey(eventCache, function (evtType, registeredEvents) {
3360
- arrForEach(registeredEvents, function (value) {
3361
- if (!evtName.type || evtName.type === value.evtName.type) {
3362
- if (!evtName.ns || evtName.ns === evtName.ns) {
3363
- theEvents.push({
3364
- name: value.evtName.type + (value.evtName.ns ? "." + value.evtName.ns : ""),
3365
- handler: value.handler
3366
- });
3367
- }
3368
- }
3369
- });
3370
- });
3371
- return theEvents;
3372
- }
3373
- function _getRegisteredEvents(target, evtName, addDefault) {
3374
- if (addDefault === void 0) { addDefault = true; }
3375
- var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
3376
- var registeredEvents = aiEvts[evtName];
3377
- if (!registeredEvents) {
3378
- registeredEvents = aiEvts[evtName] = [];
3379
- }
3380
- return registeredEvents;
3381
- }
3382
- function _doDetach(obj, evtName, handlerRef, useCapture) {
3383
- if (obj && evtName && evtName.type) {
3384
- if (obj[strRemoveEventListener]) {
3385
- obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
3386
- }
3387
- else if (obj[strDetachEvent]) {
3388
- obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
3389
- }
3390
- }
3391
- }
3392
- function _doAttach(obj, evtName, handlerRef, useCapture) {
3393
- var result = false;
3394
- if (obj && evtName && evtName.type && handlerRef) {
3395
- if (obj[strAddEventHelper]) {
3396
- obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
3397
- result = true;
3398
- }
3399
- else if (obj[strAttachEvent]) {
3400
- obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
3401
- result = true;
3402
- }
3403
- }
3404
- return result;
3405
- }
3406
- function _doUnregister(target, events, evtName, unRegFn) {
3407
- var idx = events.length;
3408
- while (idx--) {
3409
- var theEvent = events[idx];
3410
- if (theEvent) {
3411
- if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
3412
- if (!unRegFn || unRegFn(theEvent)) {
3413
- _doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
3414
- events.splice(idx, 1);
3766
+ return _channelControl[_DYN_FLUSH ](isAsync, callBack, sendReason || 6 , cbTimeout);
3415
3767
  }
3768
+ callBack && callBack(false);
3769
+ return true;
3416
3770
  }
3417
- }
3418
- }
3419
- }
3420
- function _unregisterEvents(target, evtName, unRegFn) {
3421
- if (evtName.type) {
3422
- _doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
3423
- }
3424
- else {
3425
- var eventCache = elmNodeData.get(target, strEvents, {});
3426
- objForEachKey(eventCache, function (evtType, events) {
3427
- _doUnregister(target, events, evtName, unRegFn);
3428
- });
3429
- if (objKeys(eventCache).length === 0) {
3430
- elmNodeData.kill(target, strEvents);
3431
- }
3432
- }
3433
- }
3434
- function mergeEvtNamespace(theNamespace, namespaces) {
3435
- var newNamespaces;
3436
- if (namespaces) {
3437
- if (isArray(namespaces)) {
3438
- newNamespaces = [theNamespace].concat(namespaces);
3439
- }
3440
- else {
3441
- newNamespaces = [theNamespace, namespaces];
3442
- }
3443
- newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
3444
- }
3445
- else {
3446
- newNamespaces = theNamespace;
3447
- }
3448
- return newNamespaces;
3449
- }
3450
- function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
3451
- if (useCapture === void 0) { useCapture = false; }
3452
- var result = false;
3453
- if (target) {
3454
- try {
3455
- var evtName = _getEvtNamespace(eventName, evtNamespace);
3456
- result = _doAttach(target, evtName, handlerRef, useCapture);
3457
- if (result && elmNodeData.accept(target)) {
3458
- var registeredEvent = {
3459
- guid: _guid++,
3460
- evtName: evtName,
3461
- handler: handlerRef,
3462
- capture: useCapture
3463
- };
3464
- _getRegisteredEvents(target, evtName.type).push(registeredEvent);
3465
- }
3466
- }
3467
- catch (e) {
3468
- }
3469
- }
3470
- return result;
3471
- }
3472
- function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
3473
- if (useCapture === void 0) { useCapture = false; }
3474
- if (target) {
3475
- try {
3476
- var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
3477
- var found_1 = false;
3478
- _unregisterEvents(target, evtName_1, function (regEvent) {
3479
- if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
3480
- found_1 = true;
3481
- return true;
3771
+ function _initDebugListener() {
3772
+ var disableDbgExt = getCfgValue(_config.disableDbgExt);
3773
+ if (disableDbgExt === true && _debugListener) {
3774
+ _notificationManager[_DYN_REMOVE_NOTIFICATION_2 ](_debugListener);
3775
+ _debugListener = null;
3776
+ }
3777
+ if (_notificationManager && !_debugListener && disableDbgExt !== true) {
3778
+ _debugListener = getDebugListener(_config);
3779
+ _notificationManager[_DYN_ADD_NOTIFICATION_LIS1 ](_debugListener);
3482
3780
  }
3483
- return false;
3484
- });
3485
- if (!found_1) {
3486
- _doDetach(target, evtName_1, handlerRef, useCapture);
3487
3781
  }
3488
- }
3489
- catch (e) {
3490
- }
3491
- }
3492
- }
3493
- function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
3494
- if (useCapture === void 0) { useCapture = false; }
3495
- return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
3496
- }
3497
- function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
3498
- if (useCapture === void 0) { useCapture = false; }
3499
- eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);
3500
- }
3501
- function addEventHandler(eventName, callback, evtNamespace) {
3502
- var result = false;
3503
- var w = getWindow();
3504
- if (w) {
3505
- result = eventOn(w, eventName, callback, evtNamespace);
3506
- result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
3507
- }
3508
- var doc = getDocument();
3509
- if (doc) {
3510
- result = eventOn(doc, eventName, callback, evtNamespace) || result;
3511
- }
3512
- return result;
3513
- }
3514
- function removeEventHandler(eventName, callback, evtNamespace) {
3515
- var w = getWindow();
3516
- if (w) {
3517
- eventOff(w, eventName, callback, evtNamespace);
3518
- eventOff(w["body"], eventName, callback, evtNamespace);
3519
- }
3520
- var doc = getDocument();
3521
- if (doc) {
3522
- eventOff(doc, eventName, callback, evtNamespace);
3523
- }
3524
- }
3525
- function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
3526
- var added = false;
3527
- if (listener && events && events.length > 0) {
3528
- arrForEach(events, function (name) {
3529
- if (name) {
3530
- if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
3531
- added = addEventHandler(name, listener, evtNamespace) || added;
3782
+ function _initPerfManager() {
3783
+ var enablePerfMgr = getCfgValue(_config.enablePerfMgr);
3784
+ if (!enablePerfMgr && _cfgPerfManager) {
3785
+ _cfgPerfManager = null;
3786
+ }
3787
+ if (enablePerfMgr) {
3788
+ getSetValue(_config, STR_CREATE_PERF_MGR, _createPerfManager);
3532
3789
  }
3533
3790
  }
3534
- });
3535
- }
3536
- return added;
3537
- }
3538
- function addEventListeners(events, listener, excludeEvents, evtNamespace) {
3539
- var added = false;
3540
- if (listener && events && isArray(events)) {
3541
- added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
3542
- if (!added && excludeEvents && excludeEvents.length > 0) {
3543
- added = _addEventListeners(events, listener, null, evtNamespace);
3544
- }
3545
- }
3546
- return added;
3547
- }
3548
- function removeEventListeners(events, listener, evtNamespace) {
3549
- if (events && isArray(events)) {
3550
- arrForEach(events, function (name) {
3551
- if (name) {
3552
- removeEventHandler(name, listener, evtNamespace);
3791
+ function _initExtConfig() {
3792
+ var extConfig = getSetValue(_config, STR_EXTENSION_CONFIG, {});
3793
+ extConfig.NotificationManager = _notificationManager;
3794
+ }
3795
+ function _doUpdate(updateState) {
3796
+ var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self);
3797
+ if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
3798
+ updateCtx[_DYN_PROCESS_NEXT ](updateState);
3799
+ }
3800
+ }
3801
+ function _logOrThrowError(message) {
3802
+ var logger = _self[_DYN_LOGGER ];
3803
+ if (logger) {
3804
+ _throwInternal(logger, 2 , 73 , message);
3805
+ }
3806
+ else {
3807
+ throwError(message);
3808
+ }
3553
3809
  }
3554
3810
  });
3555
3811
  }
3556
- }
3557
- function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
3558
- return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
3559
- }
3560
- function removePageUnloadEventListener(listener, evtNamespace) {
3561
- removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);
3562
- }
3563
- function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
3564
- function _handlePageVisibility(evt) {
3565
- var doc = getDocument();
3566
- if (listener && doc && doc.visibilityState === "hidden") {
3567
- listener(evt);
3568
- }
3569
- }
3570
- var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
3571
- var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
3572
- if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
3573
- pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
3574
- }
3575
- if (!pageUnloadAdded && excludeEvents) {
3576
- pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
3577
- }
3578
- return pageUnloadAdded;
3579
- }
3580
- function removePageHideEventListener(listener, evtNamespace) {
3581
- var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
3582
- removeEventListeners([strPageHide], listener, newNamespaces);
3583
- removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
3584
- }
3585
- function addPageShowEventListener(listener, excludeEvents, evtNamespace) {
3586
- function _handlePageVisibility(evt) {
3587
- var doc = getDocument();
3588
- if (listener && doc && doc.visibilityState === "visible") {
3589
- listener(evt);
3590
- }
3591
- }
3592
- var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
3593
- var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);
3594
- pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;
3595
- if (!pageShowAdded && excludeEvents) {
3596
- pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);
3597
- }
3598
- return pageShowAdded;
3599
- }
3600
- function removePageShowEventListener(listener, evtNamespace) {
3601
- var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
3602
- removeEventListeners([strPageShow], listener, newNamespaces);
3603
- removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
3604
- }
3812
+ BaseCore.__ieDyn=1;
3813
+ return BaseCore;
3814
+ }());
3605
3815
 
3606
- function newGuid() {
3607
- function randomHexDigit() {
3608
- return randomValue(15);
3609
- }
3610
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(GuidRegex, function (c) {
3611
- var r = (randomHexDigit() | 0), v = (c === "x" ? r : r & 0x3 | 0x8);
3612
- return v.toString(16);
3816
+ function _runListeners(listeners, name, isAsync, callback) {
3817
+ arrForEach(listeners, function (listener) {
3818
+ if (listener && listener[name]) {
3819
+ if (isAsync) {
3820
+ setTimeout(function () { return callback(listener); }, 0);
3821
+ }
3822
+ else {
3823
+ try {
3824
+ callback(listener);
3825
+ }
3826
+ catch (e) {
3827
+ }
3828
+ }
3829
+ }
3613
3830
  });
3614
3831
  }
3615
- function perfNow() {
3616
- var perf = getPerformance();
3617
- if (perf && perf.now) {
3618
- return perf.now();
3832
+ var NotificationManager = /** @class */ (function () {
3833
+ function NotificationManager(config) {
3834
+ this.listeners = [];
3835
+ var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
3836
+ dynamicProto(NotificationManager, this, function (_self) {
3837
+ _self[_DYN_ADD_NOTIFICATION_LIS1 ] = function (listener) {
3838
+ _self.listeners[_DYN_PUSH ](listener);
3839
+ };
3840
+ _self[_DYN_REMOVE_NOTIFICATION_2 ] = function (listener) {
3841
+ var index = arrIndexOf(_self[_DYN_LISTENERS ], listener);
3842
+ while (index > -1) {
3843
+ _self.listeners[_DYN_SPLICE ](index, 1);
3844
+ index = arrIndexOf(_self[_DYN_LISTENERS ], listener);
3845
+ }
3846
+ };
3847
+ _self[STR_EVENTS_SENT ] = function (events) {
3848
+ _runListeners(_self[_DYN_LISTENERS ], STR_EVENTS_SENT, true, function (listener) {
3849
+ listener[STR_EVENTS_SENT ](events);
3850
+ });
3851
+ };
3852
+ _self[STR_EVENTS_DISCARDED ] = function (events, reason) {
3853
+ _runListeners(_self[_DYN_LISTENERS ], STR_EVENTS_DISCARDED, true, function (listener) {
3854
+ listener[STR_EVENTS_DISCARDED ](events, reason);
3855
+ });
3856
+ };
3857
+ _self[STR_EVENTS_SEND_REQUEST ] = function (sendReason, isAsync) {
3858
+ _runListeners(_self[_DYN_LISTENERS ], STR_EVENTS_SEND_REQUEST, isAsync, function (listener) {
3859
+ listener[STR_EVENTS_SEND_REQUEST ](sendReason, isAsync);
3860
+ });
3861
+ };
3862
+ _self[STR_PERF_EVENT ] = function (perfEvent) {
3863
+ if (perfEvent) {
3864
+ if (perfEvtsSendAll || !perfEvent[_DYN_IS_CHILD_EVT ]()) {
3865
+ _runListeners(_self[_DYN_LISTENERS ], STR_PERF_EVENT, false, function (listener) {
3866
+ if (perfEvent[_DYN_IS_ASYNC ]) {
3867
+ setTimeout(function () { return listener[STR_PERF_EVENT ](perfEvent); }, 0);
3868
+ }
3869
+ else {
3870
+ listener[STR_PERF_EVENT ](perfEvent);
3871
+ }
3872
+ });
3873
+ }
3874
+ }
3875
+ };
3876
+ });
3619
3877
  }
3620
- return dateNow();
3621
- }
3622
- function generateW3CId() {
3623
- var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
3624
- var oct = strEmpty, tmp;
3625
- for (var a = 0; a < 4; a++) {
3626
- tmp = random32();
3627
- oct +=
3628
- hexValues[tmp & 0xF] +
3629
- hexValues[tmp >> 4 & 0xF] +
3630
- hexValues[tmp >> 8 & 0xF] +
3631
- hexValues[tmp >> 12 & 0xF] +
3632
- hexValues[tmp >> 16 & 0xF] +
3633
- hexValues[tmp >> 20 & 0xF] +
3634
- hexValues[tmp >> 24 & 0xF] +
3635
- hexValues[tmp >> 28 & 0xF];
3878
+ NotificationManager.__ieDyn=1;
3879
+ return NotificationManager;
3880
+ }());
3881
+
3882
+ var AppInsightsCore$2 = /** @class */ (function (_super) {
3883
+ __extendsFn(AppInsightsCore, _super);
3884
+ function AppInsightsCore() {
3885
+ var _this = _super.call(this) || this;
3886
+ dynamicProto(AppInsightsCore, _this, function (_self, _base) {
3887
+ _self[_DYN_INITIALIZE ] = function (config, extensions, logger, notificationManager) {
3888
+ _base[_DYN_INITIALIZE ](config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));
3889
+ };
3890
+ _self.track = function (telemetryItem) {
3891
+ doPerf(_self[STR_GET_PERF_MGR ](), function () { return "AppInsightsCore:track"; }, function () {
3892
+ if (telemetryItem === null) {
3893
+ _notifyInvalidEvent(telemetryItem);
3894
+ throwError("Invalid telemetry item");
3895
+ }
3896
+ _validateTelemetryItem(telemetryItem);
3897
+ _base.track(telemetryItem);
3898
+ }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
3899
+ };
3900
+ function _validateTelemetryItem(telemetryItem) {
3901
+ if (isNullOrUndefined(telemetryItem[_DYN_NAME ])) {
3902
+ _notifyInvalidEvent(telemetryItem);
3903
+ throwError("telemetry name required");
3904
+ }
3905
+ }
3906
+ function _notifyInvalidEvent(telemetryItem) {
3907
+ var manager = _self[_DYN_GET_NOTIFY_MGR ]();
3908
+ if (manager) {
3909
+ manager[STR_EVENTS_DISCARDED ]([telemetryItem], 2 );
3910
+ }
3911
+ }
3912
+ });
3913
+ return _this;
3636
3914
  }
3637
- var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
3638
- return oct.substr(0, 8) + oct.substr(9, 4) + "4" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);
3639
- }
3640
- var GuidRegex = /[xy]/g;
3641
- var EventHelper = {
3642
- Attach: attachEvent,
3643
- AttachEvent: attachEvent,
3644
- Detach: detachEvent,
3645
- DetachEvent: detachEvent
3646
- };
3915
+ AppInsightsCore.__ieDyn=1;
3916
+ return AppInsightsCore;
3917
+ }(BaseCore$2));
3647
3918
 
3919
+ var _a$1;
3920
+ var FAILED = "Failed";
3921
+ var FAILED_MONITOR_AJAX = FAILED + "MonitorAjax";
3922
+ var TRACK = "Track";
3923
+ var START = "Start";
3924
+ var STOP = "Stop";
3925
+ var EVENT = "Event";
3926
+ var AUTH_CONTEXT = "AuthContext";
3927
+ var EXCEPTION = "Exception";
3928
+ var LOCAL = "Local";
3929
+ var SESSION = "Session";
3930
+ var STORAGE = "Storage";
3931
+ var BROWSER = "Browser";
3932
+ var CANNOT = "Cannot";
3933
+ var BUFFER = "Buffer";
3934
+ var INSTRUMENTATION_KEY = "InstrumentationKey";
3648
3935
  var LoggingSeverity = createEnumStyle({
3649
3936
  CRITICAL: 1 ,
3650
3937
  WARNING: 2
3651
3938
  });
3652
- var _InternalMessageId = createEnumStyle({
3653
- BrowserDoesNotSupportLocalStorage: 0 ,
3654
- BrowserCannotReadLocalStorage: 1 ,
3655
- BrowserCannotReadSessionStorage: 2 ,
3656
- BrowserCannotWriteLocalStorage: 3 ,
3657
- BrowserCannotWriteSessionStorage: 4 ,
3658
- BrowserFailedRemovalFromLocalStorage: 5 ,
3659
- BrowserFailedRemovalFromSessionStorage: 6 ,
3660
- CannotSendEmptyTelemetry: 7 ,
3661
- ClientPerformanceMathError: 8 ,
3662
- ErrorParsingAISessionCookie: 9 ,
3663
- ErrorPVCalc: 10 ,
3664
- ExceptionWhileLoggingError: 11 ,
3665
- FailedAddingTelemetryToBuffer: 12 ,
3666
- FailedMonitorAjaxAbort: 13 ,
3667
- FailedMonitorAjaxDur: 14 ,
3668
- FailedMonitorAjaxOpen: 15 ,
3669
- FailedMonitorAjaxRSC: 16 ,
3670
- FailedMonitorAjaxSend: 17 ,
3671
- FailedMonitorAjaxGetCorrelationHeader: 18 ,
3672
- FailedToAddHandlerForOnBeforeUnload: 19 ,
3673
- FailedToSendQueuedTelemetry: 20 ,
3674
- FailedToReportDataLoss: 21 ,
3675
- FlushFailed: 22 ,
3676
- MessageLimitPerPVExceeded: 23 ,
3677
- MissingRequiredFieldSpecification: 24 ,
3678
- NavigationTimingNotSupported: 25 ,
3679
- OnError: 26 ,
3680
- SessionRenewalDateIsZero: 27 ,
3681
- SenderNotInitialized: 28 ,
3682
- StartTrackEventFailed: 29 ,
3683
- StopTrackEventFailed: 30 ,
3684
- StartTrackFailed: 31 ,
3685
- StopTrackFailed: 32 ,
3686
- TelemetrySampledAndNotSent: 33 ,
3687
- TrackEventFailed: 34 ,
3688
- TrackExceptionFailed: 35 ,
3689
- TrackMetricFailed: 36 ,
3690
- TrackPVFailed: 37 ,
3691
- TrackPVFailedCalc: 38 ,
3692
- TrackTraceFailed: 39 ,
3693
- TransmissionFailed: 40 ,
3694
- FailedToSetStorageBuffer: 41 ,
3695
- FailedToRestoreStorageBuffer: 42 ,
3696
- InvalidBackendResponse: 43 ,
3697
- FailedToFixDepricatedValues: 44 ,
3698
- InvalidDurationValue: 45 ,
3699
- TelemetryEnvelopeInvalid: 46 ,
3700
- CreateEnvelopeError: 47 ,
3701
- CannotSerializeObject: 48 ,
3702
- CannotSerializeObjectNonSerializable: 49 ,
3703
- CircularReferenceDetected: 50 ,
3704
- ClearAuthContextFailed: 51 ,
3705
- ExceptionTruncated: 52 ,
3706
- IllegalCharsInName: 53 ,
3707
- ItemNotInArray: 54 ,
3708
- MaxAjaxPerPVExceeded: 55 ,
3709
- MessageTruncated: 56 ,
3710
- NameTooLong: 57 ,
3711
- SampleRateOutOfRange: 58 ,
3712
- SetAuthContextFailed: 59 ,
3713
- SetAuthContextFailedAccountName: 60 ,
3714
- StringValueTooLong: 61 ,
3715
- StartCalledMoreThanOnce: 62 ,
3716
- StopCalledWithoutStart: 63 ,
3717
- TelemetryInitializerFailed: 64 ,
3718
- TrackArgumentsNotSpecified: 65 ,
3719
- UrlTooLong: 66 ,
3720
- SessionStorageBufferFull: 67 ,
3721
- CannotAccessCookie: 68 ,
3722
- IdTooLong: 69 ,
3723
- InvalidEvent: 70 ,
3724
- FailedMonitorAjaxSetRequestHeader: 71 ,
3725
- SendBrowserInfoOnUserInit: 72 ,
3726
- PluginException: 73 ,
3727
- NotificationException: 74 ,
3728
- SnippetScriptLoadFailure: 99 ,
3729
- InvalidInstrumentationKey: 100 ,
3730
- CannotParseAiBlobValue: 101 ,
3731
- InvalidContentBlob: 102 ,
3732
- TrackPageActionEventFailed: 103 ,
3733
- FailedAddingCustomDefinedRequestContext: 104 ,
3734
- InMemoryStorageBufferFull: 105
3735
- });
3939
+ var _InternalMessageId = createEnumStyle((_a$1 = {},
3940
+ _a$1[BROWSER + "DoesNotSupport" + LOCAL + STORAGE] = 0 ,
3941
+ _a$1[BROWSER + CANNOT + "Read" + LOCAL + STORAGE] = 1 ,
3942
+ _a$1[BROWSER + CANNOT + "Read" + SESSION + STORAGE] = 2 ,
3943
+ _a$1[BROWSER + CANNOT + "Write" + LOCAL + STORAGE] = 3 ,
3944
+ _a$1[BROWSER + CANNOT + "Write" + SESSION + STORAGE] = 4 ,
3945
+ _a$1[BROWSER + FAILED + "RemovalFrom" + LOCAL + STORAGE] = 5 ,
3946
+ _a$1[BROWSER + FAILED + "RemovalFrom" + SESSION + STORAGE] = 6 ,
3947
+ _a$1[CANNOT + "SendEmptyTelemetry"] = 7 ,
3948
+ _a$1.ClientPerformanceMathError = 8 ,
3949
+ _a$1["ErrorParsingAI" + SESSION + "Cookie"] = 9 ,
3950
+ _a$1.ErrorPVCalc = 10 ,
3951
+ _a$1[EXCEPTION + "WhileLoggingError"] = 11 ,
3952
+ _a$1[FAILED + "AddingTelemetryTo" + BUFFER] = 12 ,
3953
+ _a$1[FAILED_MONITOR_AJAX + "Abort"] = 13 ,
3954
+ _a$1[FAILED_MONITOR_AJAX + "Dur"] = 14 ,
3955
+ _a$1[FAILED_MONITOR_AJAX + "Open"] = 15 ,
3956
+ _a$1[FAILED_MONITOR_AJAX + "RSC"] = 16 ,
3957
+ _a$1[FAILED_MONITOR_AJAX + "Send"] = 17 ,
3958
+ _a$1[FAILED_MONITOR_AJAX + "GetCorrelationHeader"] = 18 ,
3959
+ _a$1[FAILED + "ToAddHandlerForOnBeforeUnload"] = 19 ,
3960
+ _a$1[FAILED + "ToSendQueuedTelemetry"] = 20 ,
3961
+ _a$1[FAILED + "ToReportDataLoss"] = 21 ,
3962
+ _a$1["Flush" + FAILED] = 22 ,
3963
+ _a$1.MessageLimitPerPVExceeded = 23 ,
3964
+ _a$1.MissingRequiredFieldSpecification = 24 ,
3965
+ _a$1.NavigationTimingNotSupported = 25 ,
3966
+ _a$1.OnError = 26 ,
3967
+ _a$1[SESSION + "RenewalDateIsZero"] = 27 ,
3968
+ _a$1.SenderNotInitialized = 28 ,
3969
+ _a$1[START + TRACK + EVENT + FAILED] = 29 ,
3970
+ _a$1[STOP + TRACK + EVENT + FAILED] = 30 ,
3971
+ _a$1[START + TRACK + FAILED] = 31 ,
3972
+ _a$1[STOP + TRACK + FAILED] = 32 ,
3973
+ _a$1.TelemetrySampledAndNotSent = 33 ,
3974
+ _a$1[TRACK + EVENT + FAILED] = 34 ,
3975
+ _a$1[TRACK + EXCEPTION + FAILED] = 35 ,
3976
+ _a$1[TRACK + "Metric" + FAILED] = 36 ,
3977
+ _a$1[TRACK + "PV" + FAILED] = 37 ,
3978
+ _a$1[TRACK + "PV" + FAILED + "Calc"] = 38 ,
3979
+ _a$1[TRACK + "Trace" + FAILED] = 39 ,
3980
+ _a$1["Transmission" + FAILED] = 40 ,
3981
+ _a$1[FAILED + "ToSet" + STORAGE + BUFFER] = 41 ,
3982
+ _a$1[FAILED + "ToRestore" + STORAGE + BUFFER] = 42 ,
3983
+ _a$1.InvalidBackendResponse = 43 ,
3984
+ _a$1[FAILED + "ToFixDepricatedValues"] = 44 ,
3985
+ _a$1.InvalidDurationValue = 45 ,
3986
+ _a$1.TelemetryEnvelopeInvalid = 46 ,
3987
+ _a$1.CreateEnvelopeError = 47 ,
3988
+ _a$1[CANNOT + "SerializeObject"] = 48 ,
3989
+ _a$1[CANNOT + "SerializeObjectNonSerializable"] = 49 ,
3990
+ _a$1.CircularReferenceDetected = 50 ,
3991
+ _a$1["Clear" + AUTH_CONTEXT + FAILED] = 51 ,
3992
+ _a$1[EXCEPTION + "Truncated"] = 52 ,
3993
+ _a$1.IllegalCharsInName = 53 ,
3994
+ _a$1.ItemNotInArray = 54 ,
3995
+ _a$1.MaxAjaxPerPVExceeded = 55 ,
3996
+ _a$1.MessageTruncated = 56 ,
3997
+ _a$1.NameTooLong = 57 ,
3998
+ _a$1.SampleRateOutOfRange = 58 ,
3999
+ _a$1["Set" + AUTH_CONTEXT + FAILED] = 59 ,
4000
+ _a$1["Set" + AUTH_CONTEXT + FAILED + "AccountName"] = 60 ,
4001
+ _a$1.StringValueTooLong = 61 ,
4002
+ _a$1.StartCalledMoreThanOnce = 62 ,
4003
+ _a$1.StopCalledWithoutStart = 63 ,
4004
+ _a$1["TelemetryInitializer" + FAILED] = 64 ,
4005
+ _a$1.TrackArgumentsNotSpecified = 65 ,
4006
+ _a$1.UrlTooLong = 66 ,
4007
+ _a$1[SESSION + STORAGE + BUFFER + "Full"] = 67 ,
4008
+ _a$1[CANNOT + "AccessCookie"] = 68 ,
4009
+ _a$1.IdTooLong = 69 ,
4010
+ _a$1.InvalidEvent = 70 ,
4011
+ _a$1[FAILED_MONITOR_AJAX + "SetRequestHeader"] = 71 ,
4012
+ _a$1["Send" + BROWSER + "InfoOnUserInit"] = 72 ,
4013
+ _a$1["Plugin" + EXCEPTION] = 73 ,
4014
+ _a$1["Notification" + EXCEPTION] = 74 ,
4015
+ _a$1.SnippetScriptLoadFailure = 99 ,
4016
+ _a$1["Invalid" + INSTRUMENTATION_KEY] = 100 ,
4017
+ _a$1[CANNOT + "ParseAiBlobValue"] = 101 ,
4018
+ _a$1.InvalidContentBlob = 102 ,
4019
+ _a$1[TRACK + "PageAction" + EVENT + FAILED] = 103 ,
4020
+ _a$1[FAILED + "AddingCustomDefinedRequestContext"] = 104 ,
4021
+ _a$1["InMemory" + STORAGE + BUFFER + "Full"] = 105 ,
4022
+ _a$1[INSTRUMENTATION_KEY + "Deprecation"] = 106 ,
4023
+ _a$1));
3736
4024
 
3737
4025
  var ValueKind = createEnumStyle({
3738
4026
  NotSet: 0 ,
@@ -3802,8 +4090,13 @@
3802
4090
  SDKNotInitialized: 520
3803
4091
  })));
3804
4092
 
4093
+ var STR_EMPTY = "";
4094
+ var STR_DEFAULT_ENDPOINT_URL = "https://browser.events.data.microsoft.com/OneCollector/1.0/";
4095
+ var STR_VERSION = "version";
4096
+ var STR_PROPERTIES = "properties";
4097
+
3805
4098
  var _a;
3806
- var Version = '3.2.2';
4099
+ var Version = '3.2.5';
3807
4100
  var FullVersionString = "1DS-Web-JS-" + Version;
3808
4101
  var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
3809
4102
  var strWithCredentials = "withCredentials";
@@ -3821,7 +4114,7 @@
3821
4114
  var isDocumentObjectAvailable = Boolean(getDocument());
3822
4115
  var isWindowObjectAvailable = Boolean(getWindow());
3823
4116
  function isValueAssigned(value) {
3824
- return !(value === "" || isNullOrUndefined(value));
4117
+ return !(value === STR_EMPTY || isNullOrUndefined(value));
3825
4118
  }
3826
4119
  function getTenantId(apiKey) {
3827
4120
  if (apiKey) {
@@ -3830,7 +4123,7 @@
3830
4123
  return apiKey.substring(0, indexTenantId);
3831
4124
  }
3832
4125
  }
3833
- return "";
4126
+ return STR_EMPTY;
3834
4127
  }
3835
4128
  function isUint8ArrayAvailable() {
3836
4129
  if (uInt8ArraySupported === null) {
@@ -3852,11 +4145,11 @@
3852
4145
  if (propType === "string" || propType === "number" || propType === "boolean" || isArray(property)) {
3853
4146
  property = { value: property };
3854
4147
  }
3855
- else if (propType === "object" && !property.hasOwnProperty("value")) {
4148
+ else if (propType === "object" && !ObjHasOwnProperty.call(property, "value")) {
3856
4149
  property = { value: stringifyObjects ? JSON.stringify(property) : property };
3857
4150
  }
3858
4151
  else if (isNullOrUndefined(property.value)
3859
- || property.value === "" || (!isString(property.value)
4152
+ || property.value === STR_EMPTY || (!isString(property.value)
3860
4153
  && !isNumber(property.value) && !isBoolean(property.value)
3861
4154
  && !isArray(property.value))) {
3862
4155
  return null;
@@ -3919,7 +4212,7 @@
3919
4212
  if (areCookiesSupported(null)) {
3920
4213
  return getCookieValue(safeGetCookieMgr(null), name);
3921
4214
  }
3922
- return "";
4215
+ return STR_EMPTY;
3923
4216
  }
3924
4217
  function getCookieValue(cookieMgr, name, decode) {
3925
4218
  if (decode === void 0) { decode = true; }
@@ -3930,7 +4223,7 @@
3930
4223
  cookieValue = decodeURIComponent(cookieValue);
3931
4224
  }
3932
4225
  }
3933
- return cookieValue || "";
4226
+ return cookieValue || STR_EMPTY;
3934
4227
  }
3935
4228
  function createGuid(style) {
3936
4229
  if (style === void 0) { style = "D" ; }
@@ -3942,7 +4235,7 @@
3942
4235
  theGuid = "(" + theGuid + ")";
3943
4236
  }
3944
4237
  else if (style === "N" ) {
3945
- theGuid = theGuid.replace(/-/g, "");
4238
+ theGuid = theGuid.replace(/-/g, STR_EMPTY);
3946
4239
  }
3947
4240
  return theGuid;
3948
4241
  }
@@ -4036,7 +4329,7 @@
4036
4329
  theType |= getFieldValueType(value[0]);
4037
4330
  }
4038
4331
  }
4039
- else if (hasOwnProperty(value, "value")) {
4332
+ else if (ObjHasOwnProperty.call(value, "value")) {
4040
4333
  theType = 8192 | getFieldValueType(value.value);
4041
4334
  }
4042
4335
  }
@@ -4158,27 +4451,25 @@
4158
4451
  return xhr;
4159
4452
  }
4160
4453
 
4161
- var PropVersion = "version";
4162
- var properties = "properties";
4163
4454
  var AppInsightsCore = /** @class */ (function (_super) {
4164
4455
  __extendsFn(AppInsightsCore, _super);
4165
4456
  function AppInsightsCore() {
4166
4457
  var _this = _super.call(this) || this;
4167
4458
  _this.pluginVersionStringArr = [];
4168
- _this.pluginVersionString = "";
4169
4459
  dynamicProto(AppInsightsCore, _this, function (_self, _base) {
4170
4460
  if (!_self.logger || !_self.logger.queue) {
4171
4461
  _self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
4172
4462
  }
4173
4463
  _self.initialize = function (config, extensions, logger, notificationManager) {
4174
4464
  doPerf(_self, function () { return "AppInsightsCore.initialize"; }, function () {
4465
+ var _pluginVersionStringArr = _self.pluginVersionStringArr;
4175
4466
  if (config) {
4176
4467
  if (!config.endpointUrl) {
4177
- config.endpointUrl = "https://browser.events.data.microsoft.com/OneCollector/1.0/";
4468
+ config.endpointUrl = STR_DEFAULT_ENDPOINT_URL;
4178
4469
  }
4179
4470
  var propertyStorageOverride = config.propertyStorageOverride;
4180
4471
  if (propertyStorageOverride && (!propertyStorageOverride.getProperty || !propertyStorageOverride.setProperty)) {
4181
- throw new Error("Invalid property storage override passed.");
4472
+ throwError("Invalid property storage override passed.");
4182
4473
  }
4183
4474
  if (config.channels) {
4184
4475
  arrForEach(config.channels, function (channels) {
@@ -4186,7 +4477,7 @@
4186
4477
  arrForEach(channels, function (channel) {
4187
4478
  if (channel.identifier && channel.version) {
4188
4479
  var ver = channel.identifier + "=" + channel.version;
4189
- _self.pluginVersionStringArr.push(ver);
4480
+ _pluginVersionStringArr.push(ver);
4190
4481
  }
4191
4482
  });
4192
4483
  }
@@ -4194,17 +4485,18 @@
4194
4485
  }
4195
4486
  }
4196
4487
  _self.getWParam = function () {
4197
- return typeof document !== "undefined" ? 0 : -1;
4488
+ return (typeof document !== "undefined" || !!config.enableWParam) ? 0 : -1;
4198
4489
  };
4199
4490
  if (extensions) {
4200
4491
  arrForEach(extensions, function (ext) {
4201
4492
  if (ext && ext.identifier && ext.version) {
4202
4493
  var ver = ext.identifier + "=" + ext.version;
4203
- _self.pluginVersionStringArr.push(ver);
4494
+ _pluginVersionStringArr.push(ver);
4204
4495
  }
4205
4496
  });
4206
4497
  }
4207
- _self.pluginVersionString = _self.pluginVersionStringArr.join(";");
4498
+ _self.pluginVersionString = _pluginVersionStringArr.join(";");
4499
+ _self.pluginVersionStringArr = _pluginVersionStringArr;
4208
4500
  try {
4209
4501
  _base.initialize(config, extensions, logger, notificationManager);
4210
4502
  _self.pollInternalLogs("InternalLog");
@@ -4215,7 +4507,7 @@
4215
4507
  if (message.indexOf("channels") !== -1) {
4216
4508
  message += "\n - Channels must be provided through config.channels only!";
4217
4509
  }
4218
- logger_1.throwInternal(1 , 514 , "SDK Initialization Failed - no telemetry will be sent: " + message);
4510
+ _throwInternal(logger_1, 1 , 514 , "SDK Initialization Failed - no telemetry will be sent: " + message);
4219
4511
  }
4220
4512
  }, function () { return ({ config: config, extensions: extensions, logger: logger, notificationManager: notificationManager }); });
4221
4513
  };
@@ -4232,16 +4524,9 @@
4232
4524
  itemExt.sdk = itemExt.sdk || {};
4233
4525
  itemExt.sdk.ver = FullVersionString;
4234
4526
  var baseData = telemetryItem.baseData = telemetryItem.baseData || {};
4235
- if (!baseData[properties]) {
4236
- baseData[properties] = {};
4237
- }
4238
- var itemProperties = baseData[properties];
4239
- if (!itemProperties[PropVersion]) {
4240
- itemProperties[PropVersion] = "";
4241
- }
4242
- if (_self.pluginVersionString !== "") {
4243
- itemProperties[PropVersion] = _self.pluginVersionString;
4244
- }
4527
+ baseData[STR_PROPERTIES] = baseData[STR_PROPERTIES] || {};
4528
+ var itemProperties = baseData[STR_PROPERTIES];
4529
+ itemProperties[STR_VERSION] = itemProperties[STR_VERSION] || _self.pluginVersionString || STR_EMPTY;
4245
4530
  }
4246
4531
  _base.track(telemetryItem);
4247
4532
  }, function () { return ({ item: item }); }, !(item.sync));
@@ -4249,6 +4534,7 @@
4249
4534
  });
4250
4535
  return _this;
4251
4536
  }
4537
+ AppInsightsCore.__ieDyn=1;
4252
4538
  return AppInsightsCore;
4253
4539
  }(AppInsightsCore$2));
4254
4540
  var AppInsightsCore$1 = AppInsightsCore;
@@ -4260,10 +4546,10 @@
4260
4546
  dynamicProto(BaseCore, _this, function (_self, _base) {
4261
4547
  _self.initialize = function (config, extensions, logger, notificationManager) {
4262
4548
  if (config && !config.endpointUrl) {
4263
- config.endpointUrl = "https://browser.events.data.microsoft.com/OneCollector/1.0/";
4549
+ config.endpointUrl = STR_DEFAULT_ENDPOINT_URL;
4264
4550
  }
4265
4551
  _self.getWParam = function () {
4266
- return isDocumentObjectAvailable ? 0 : -1;
4552
+ return (isDocumentObjectAvailable || !!config.enableWParam) ? 0 : -1;
4267
4553
  };
4268
4554
  try {
4269
4555
  _base.initialize(config, extensions, logger, notificationManager);
@@ -4284,6 +4570,7 @@
4284
4570
  });
4285
4571
  return _this;
4286
4572
  }
4573
+ BaseCore.__ieDyn=1;
4287
4574
  return BaseCore;
4288
4575
  }(BaseCore$2));
4289
4576
  var BaseCore$1 = BaseCore;
@@ -4665,7 +4952,7 @@
4665
4952
  }
4666
4953
  }
4667
4954
  function _warnLog(message) {
4668
- diagLog && diagLog.warnToConsole("ESPromiseScheduler[" + _scheduledName + "] " + message);
4955
+ _warnToConsole(diagLog, "ESPromiseScheduler[" + _scheduledName + "] " + message);
4669
4956
  }
4670
4957
  }
4671
4958
  ESPromiseScheduler.incomplete = function () {
@@ -4757,7 +5044,7 @@
4757
5044
  if (mapValue.handler) {
4758
5045
  return mapValue.handler.value(path, name, value, stringifyObjects);
4759
5046
  }
4760
- if (!isString(name) || isNullOrUndefined(value) || value === "") {
5047
+ if (!isString(name) || isNullOrUndefined(value) || value === STR_EMPTY) {
4761
5048
  return null;
4762
5049
  }
4763
5050
  var property = null;
@@ -4889,7 +5176,9 @@
4889
5176
  exports._InternalLogMessage = _InternalLogMessage;
4890
5177
  exports._InternalMessageId = _InternalMessageId;
4891
5178
  exports.__getRegisteredEvents = __getRegisteredEvents;
5179
+ exports._logInternalMessage = _logInternalMessage;
4892
5180
  exports._throwInternal = _throwInternal;
5181
+ exports._warnToConsole = _warnToConsole;
4893
5182
  exports.addEventHandler = addEventHandler;
4894
5183
  exports.addEventListeners = addEventListeners;
4895
5184
  exports.addPageHideEventListener = addPageHideEventListener;
@@ -4906,6 +5195,7 @@
4906
5195
  exports.createEnumStyle = createEnumStyle;
4907
5196
  exports.createGuid = createGuid;
4908
5197
  exports.createProcessTelemetryContext = createProcessTelemetryContext;
5198
+ exports.createTraceParent = createTraceParent;
4909
5199
  exports.createUniqueNamespace = createUniqueNamespace;
4910
5200
  exports.createUnloadHandlerContainer = createUnloadHandlerContainer;
4911
5201
  exports.dateNow = dateNow;
@@ -4918,6 +5208,8 @@
4918
5208
  exports.eventOff = eventOff;
4919
5209
  exports.eventOn = eventOn;
4920
5210
  exports.extend = extend;
5211
+ exports.findW3cTraceParent = findW3cTraceParent;
5212
+ exports.formatTraceParent = formatTraceParent;
4921
5213
  exports.generateW3CId = generateW3CId;
4922
5214
  exports.getCommonSchemaMetaData = getCommonSchemaMetaData;
4923
5215
  exports.getConsole = getConsole;
@@ -4964,11 +5256,15 @@
4964
5256
  exports.isNumber = isNumber;
4965
5257
  exports.isObject = isObject;
4966
5258
  exports.isReactNative = isReactNative;
5259
+ exports.isSampledFlag = isSampledFlag;
4967
5260
  exports.isString = isString;
4968
5261
  exports.isTruthy = isTruthy;
4969
5262
  exports.isTypeof = isTypeof;
4970
5263
  exports.isUint8ArrayAvailable = isUint8ArrayAvailable;
4971
5264
  exports.isUndefined = isUndefined;
5265
+ exports.isValidSpanId = isValidSpanId;
5266
+ exports.isValidTraceId = isValidTraceId;
5267
+ exports.isValidTraceParent = isValidTraceParent;
4972
5268
  exports.isValueAssigned = isValueAssigned;
4973
5269
  exports.isValueKind = isValueKind;
4974
5270
  exports.isWindowObjectAvailable = isWindowObjectAvailable;
@@ -4985,6 +5281,7 @@
4985
5281
  exports.objSeal = objSeal;
4986
5282
  exports.openXhr = openXhr;
4987
5283
  exports.optimizeObject = optimizeObject;
5284
+ exports.parseTraceParent = parseTraceParent;
4988
5285
  exports.perfNow = perfNow;
4989
5286
  exports.proxyAssign = proxyAssign;
4990
5287
  exports.proxyFunctionAs = proxyFunctionAs;