@microsoft/applicationinsights-dependencies-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-06

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-nightly.2204-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -75,7 +75,9 @@
75
75
  var __assignFn = ObjAssign || __objAssignFnImpl;
76
76
  var extendStaticsFn = function (d, b) {
77
77
  extendStaticsFn = ObjClass["setPrototypeOf"] ||
78
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
78
+ ({ __proto__: [] } instanceof Array && function (d, b) {
79
+ d.__proto__ = b;
80
+ }) ||
79
81
  function (d, b) {
80
82
  for (var p in b) {
81
83
  if (b[strShimHasOwnProperty](p)) {
@@ -90,10 +92,314 @@
90
92
  throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
91
93
  }
92
94
  extendStaticsFn(d, b);
93
- function __() { this.constructor = d; }
95
+ function __() {
96
+ this.constructor = d;
97
+ }
94
98
  d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
95
99
  }
96
100
 
101
+ var strEmpty$1 = "";
102
+ var strSetNextPlugin = "setNextPlugin";
103
+ var strIsInitialized = "isInitialized";
104
+ var strTeardown = "teardown";
105
+ var strCore = "core";
106
+ var strUpdate = "update";
107
+ var strDisabled = "disabled";
108
+ var strDoTeardown = "_doTeardown";
109
+
110
+ var strToISOString = "toISOString";
111
+ var cStrTrim = "trim";
112
+ var strToString = "toString";
113
+ var str__Proto$1 = "__proto__";
114
+ var strConstructor = "constructor";
115
+ var _objDefineProperty$1 = ObjDefineProperty;
116
+ var _objFreeze = ObjClass.freeze;
117
+ var _objKeys = ObjClass.keys;
118
+ var StringProto = String[strShimPrototype];
119
+ var _strTrim = StringProto[cStrTrim];
120
+ var DateProto = Date[strShimPrototype];
121
+ var _dataToISOString = DateProto[strToISOString];
122
+ var _isArray = Array.isArray;
123
+ var _objToString = ObjProto[strToString];
124
+ var _fnToString = ObjHasOwnProperty[strToString];
125
+ var _objFunctionString = _fnToString.call(ObjClass);
126
+ var rCamelCase = /-([a-z])/g;
127
+ var rNormalizeInvalid = /([^\w\d_$])/g;
128
+ var rLeadingNumeric = /^(\d+[\w\d_$])/;
129
+ var _objGetPrototypeOf$1 = Object["getPrototypeOf"];
130
+ function _getObjProto$1(target) {
131
+ if (target) {
132
+ if (_objGetPrototypeOf$1) {
133
+ return _objGetPrototypeOf$1(target);
134
+ }
135
+ var newProto = target[str__Proto$1] || target[strShimPrototype] || target[strConstructor];
136
+ if (newProto) {
137
+ return newProto;
138
+ }
139
+ }
140
+ return null;
141
+ }
142
+ function isUndefined(value) {
143
+ return value === undefined || typeof value === strShimUndefined;
144
+ }
145
+ function isNullOrUndefined(value) {
146
+ return (value === null || isUndefined(value));
147
+ }
148
+ function hasOwnProperty(obj, prop) {
149
+ return !!(obj && ObjHasOwnProperty.call(obj, prop));
150
+ }
151
+ function isObject(value) {
152
+ return !!(value && typeof value === strShimObject);
153
+ }
154
+ function isFunction(value) {
155
+ return !!(value && typeof value === strShimFunction);
156
+ }
157
+ function normalizeJsName(name) {
158
+ var value = name;
159
+ if (value && isString(value)) {
160
+ value = value.replace(rCamelCase, function (_all, letter) {
161
+ return letter.toUpperCase();
162
+ });
163
+ value = value.replace(rNormalizeInvalid, "_");
164
+ value = value.replace(rLeadingNumeric, function (_all, match) {
165
+ return "_" + match;
166
+ });
167
+ }
168
+ return value;
169
+ }
170
+ function objForEachKey(target, callbackfn) {
171
+ if (target) {
172
+ for (var prop in target) {
173
+ if (ObjHasOwnProperty.call(target, prop)) {
174
+ callbackfn.call(target, prop, target[prop]);
175
+ }
176
+ }
177
+ }
178
+ }
179
+ function strContains(value, search) {
180
+ if (value && search) {
181
+ return value.indexOf(search) !== -1;
182
+ }
183
+ return false;
184
+ }
185
+ var isArray = _isArray || _isArrayPoly;
186
+ function _isArrayPoly(obj) {
187
+ return !!(obj && _objToString.call(obj) === "[object Array]");
188
+ }
189
+ function isString(value) {
190
+ return typeof value === "string";
191
+ }
192
+ function isNumber(value) {
193
+ return typeof value === "number";
194
+ }
195
+ function isBoolean(value) {
196
+ return typeof value === "boolean";
197
+ }
198
+ function isPlainObject(value) {
199
+ var result = false;
200
+ if (value && typeof value === "object") {
201
+ var proto = _objGetPrototypeOf$1 ? _objGetPrototypeOf$1(value) : _getObjProto$1(value);
202
+ if (!proto) {
203
+ result = true;
204
+ }
205
+ else {
206
+ if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
207
+ proto = proto[strConstructor];
208
+ }
209
+ result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
210
+ }
211
+ }
212
+ return result;
213
+ }
214
+ function toISOString(date) {
215
+ if (date) {
216
+ return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
217
+ }
218
+ }
219
+ function _toISOStringPoly(date) {
220
+ if (date && date.getUTCFullYear) {
221
+ var pad = function (num) {
222
+ var r = String(num);
223
+ if (r.length === 1) {
224
+ r = "0" + r;
225
+ }
226
+ return r;
227
+ };
228
+ return date.getUTCFullYear()
229
+ + "-" + pad(date.getUTCMonth() + 1)
230
+ + "-" + pad(date.getUTCDate())
231
+ + "T" + pad(date.getUTCHours())
232
+ + ":" + pad(date.getUTCMinutes())
233
+ + ":" + pad(date.getUTCSeconds())
234
+ + "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
235
+ + "Z";
236
+ }
237
+ }
238
+ function arrForEach(arr, callbackfn, thisArg) {
239
+ var len = arr.length;
240
+ try {
241
+ for (var idx = 0; idx < len; idx++) {
242
+ if (idx in arr) {
243
+ if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
244
+ break;
245
+ }
246
+ }
247
+ }
248
+ }
249
+ catch (e) {
250
+ }
251
+ }
252
+ function strTrim(str) {
253
+ if (str) {
254
+ str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
255
+ }
256
+ return str;
257
+ }
258
+ var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
259
+ var _objKeysDontEnums = [
260
+ "toString",
261
+ "toLocaleString",
262
+ "valueOf",
263
+ "hasOwnProperty",
264
+ "isPrototypeOf",
265
+ "propertyIsEnumerable",
266
+ "constructor"
267
+ ];
268
+ function objKeys(obj) {
269
+ var objType = typeof obj;
270
+ if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
271
+ throwTypeError("objKeys called on non-object");
272
+ }
273
+ if (!_objKeysHasDontEnumBug && _objKeys) {
274
+ return _objKeys(obj);
275
+ }
276
+ var result = [];
277
+ for (var prop in obj) {
278
+ if (obj && ObjHasOwnProperty.call(obj, prop)) {
279
+ result.push(prop);
280
+ }
281
+ }
282
+ if (_objKeysHasDontEnumBug) {
283
+ var dontEnumsLength = _objKeysDontEnums.length;
284
+ for (var lp = 0; lp < dontEnumsLength; lp++) {
285
+ if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
286
+ result.push(_objKeysDontEnums[lp]);
287
+ }
288
+ }
289
+ }
290
+ return result;
291
+ }
292
+ function objDefineAccessors(target, prop, getProp, setProp) {
293
+ if (_objDefineProperty$1) {
294
+ try {
295
+ var descriptor = {
296
+ enumerable: true,
297
+ configurable: true
298
+ };
299
+ if (getProp) {
300
+ descriptor.get = getProp;
301
+ }
302
+ if (setProp) {
303
+ descriptor.set = setProp;
304
+ }
305
+ _objDefineProperty$1(target, prop, descriptor);
306
+ return true;
307
+ }
308
+ catch (e) {
309
+ }
310
+ }
311
+ return false;
312
+ }
313
+ function _doNothing(value) {
314
+ return value;
315
+ }
316
+ var objFreeze = _objFreeze || _doNothing;
317
+ function dateNow() {
318
+ var dt = Date;
319
+ return dt.now ? dt.now() : new dt().getTime();
320
+ }
321
+ function setValue(target, field, value, valChk, srcChk) {
322
+ var theValue = value;
323
+ if (target) {
324
+ theValue = target[field];
325
+ if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
326
+ theValue = value;
327
+ target[field] = theValue;
328
+ }
329
+ }
330
+ return theValue;
331
+ }
332
+ function _createProxyFunction(source, funcName) {
333
+ var srcFunc = null;
334
+ var src = null;
335
+ if (isFunction(source)) {
336
+ srcFunc = source;
337
+ }
338
+ else {
339
+ src = source;
340
+ }
341
+ return function () {
342
+ var originalArguments = arguments;
343
+ if (srcFunc) {
344
+ src = srcFunc();
345
+ }
346
+ if (src) {
347
+ return src[funcName].apply(src, originalArguments);
348
+ }
349
+ };
350
+ }
351
+ function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
352
+ if (target && name && source) {
353
+ if (overwriteTarget !== false || isUndefined(target[name])) {
354
+ target[name] = _createProxyFunction(source, theFunc);
355
+ }
356
+ }
357
+ }
358
+ function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
359
+ var theArgs = arguments;
360
+ var extended = theArgs[0] || {};
361
+ var argLen = theArgs.length;
362
+ var deep = false;
363
+ var idx = 1;
364
+ if (argLen > 0 && isBoolean(extended)) {
365
+ deep = extended;
366
+ extended = theArgs[idx] || {};
367
+ idx++;
368
+ }
369
+ if (!isObject(extended)) {
370
+ extended = {};
371
+ }
372
+ for (; idx < argLen; idx++) {
373
+ var arg = theArgs[idx];
374
+ var isArgArray = isArray(arg);
375
+ var isArgObj = isObject(arg);
376
+ for (var prop in arg) {
377
+ var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
378
+ if (!propOk) {
379
+ continue;
380
+ }
381
+ var newValue = arg[prop];
382
+ var isNewArray = void 0;
383
+ if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
384
+ var clone = extended[prop];
385
+ if (isNewArray) {
386
+ if (!isArray(clone)) {
387
+ clone = [];
388
+ }
389
+ }
390
+ else if (!isPlainObject(clone)) {
391
+ clone = {};
392
+ }
393
+ newValue = objExtend(deep, clone, newValue);
394
+ }
395
+ if (newValue !== undefined) {
396
+ extended[prop] = newValue;
397
+ }
398
+ }
399
+ }
400
+ return extended;
401
+ }
402
+
97
403
  /*!
98
404
  * Microsoft Dynamic Proto Utility, 1.1.4
99
405
  * Copyright (c) Microsoft and contributors. All rights reserved.
@@ -109,11 +415,11 @@
109
415
  var DynAllowInstChkTag = DynInstChkTag;
110
416
  var DynProtoDefaultOptions = '_dfOpts';
111
417
  var UnknownValue = '_unknown_';
112
- var str__Proto$1 = "__proto__";
418
+ var str__Proto = "__proto__";
113
419
  var strUseBaseInst = 'useBaseInst';
114
420
  var strSetInstFuncs = 'setInstFuncs';
115
421
  var Obj = Object;
116
- var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
422
+ var _objGetPrototypeOf = Obj["getPrototypeOf"];
117
423
  var _dynamicNames = 0;
118
424
  function _hasOwnProperty(obj, prop) {
119
425
  return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
@@ -124,12 +430,12 @@
124
430
  function _isObjectArrayOrFunctionPrototype(target) {
125
431
  return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
126
432
  }
127
- function _getObjProto$1(target) {
433
+ function _getObjProto(target) {
128
434
  if (target) {
129
- if (_objGetPrototypeOf$1) {
130
- return _objGetPrototypeOf$1(target);
435
+ if (_objGetPrototypeOf) {
436
+ return _objGetPrototypeOf(target);
131
437
  }
132
- var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
438
+ var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
133
439
  if (newProto) {
134
440
  return newProto;
135
441
  }
@@ -195,456 +501,145 @@
195
501
  _forEachProp(instFuncs, function (name) {
196
502
  baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
197
503
  });
198
- var baseProto = _getObjProto$1(classProto);
504
+ var baseProto = _getObjProto(classProto);
199
505
  var visited = [];
200
506
  while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
201
507
  _forEachProp(baseProto, function (name) {
202
- if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
508
+ if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
203
509
  baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
204
510
  }
205
511
  });
206
- visited.push(baseProto);
207
- baseProto = _getObjProto$1(baseProto);
208
- }
209
- return baseFuncs;
210
- }
211
- function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
212
- var instFunc = null;
213
- if (target && _hasOwnProperty(proto, DynClassName)) {
214
- var instFuncTable = target[DynInstFuncTable] || {};
215
- instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
216
- if (!instFunc) {
217
- _throwTypeError("Missing [" + funcName + "] " + strFunction);
218
- }
219
- if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
220
- var canAddInst = !_hasOwnProperty(target, funcName);
221
- var objProto = _getObjProto$1(target);
222
- var visited = [];
223
- while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
224
- var protoFunc = objProto[funcName];
225
- if (protoFunc) {
226
- canAddInst = (protoFunc === currentDynProtoProxy);
227
- break;
228
- }
229
- visited.push(objProto);
230
- objProto = _getObjProto$1(objProto);
231
- }
232
- try {
233
- if (canAddInst) {
234
- target[funcName] = instFunc;
235
- }
236
- instFunc[DynInstChkTag] = 1;
237
- }
238
- catch (e) {
239
- instFuncTable[DynAllowInstChkTag] = false;
240
- }
241
- }
242
- }
243
- return instFunc;
244
- }
245
- function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
246
- var protoFunc = proto[funcName];
247
- if (protoFunc === currentDynProtoProxy) {
248
- protoFunc = _getObjProto$1(proto)[funcName];
249
- }
250
- if (typeof protoFunc !== strFunction) {
251
- _throwTypeError("[" + funcName + "] is not a " + strFunction);
252
- }
253
- return protoFunc;
254
- }
255
- function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
256
- function _createDynamicPrototype(proto, funcName) {
257
- var dynProtoProxy = function () {
258
- var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
259
- return instFunc.apply(this, arguments);
260
- };
261
- dynProtoProxy[DynProxyTag] = 1;
262
- return dynProtoProxy;
263
- }
264
- if (!_isObjectOrArrayPrototype(proto)) {
265
- var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
266
- var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
267
- if (instFuncTable[DynAllowInstChkTag] !== false) {
268
- instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
269
- }
270
- _forEachProp(target, function (name) {
271
- if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
272
- instFuncs_1[name] = target[name];
273
- delete target[name];
274
- if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
275
- proto[name] = _createDynamicPrototype(proto, name);
276
- }
277
- }
278
- });
279
- }
280
- }
281
- function _checkPrototype(classProto, thisTarget) {
282
- if (_objGetPrototypeOf$1) {
283
- var visited = [];
284
- var thisProto = _getObjProto$1(thisTarget);
285
- while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
286
- if (thisProto === classProto) {
287
- return true;
288
- }
289
- visited.push(thisProto);
290
- thisProto = _getObjProto$1(thisProto);
291
- }
292
- }
293
- return false;
294
- }
295
- function _getObjName(target, unknownValue) {
296
- if (_hasOwnProperty(target, Prototype)) {
297
- return target.name || unknownValue || UnknownValue;
298
- }
299
- return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
300
- }
301
- function dynamicProto(theClass, target, delegateFunc, options) {
302
- if (!_hasOwnProperty(theClass, Prototype)) {
303
- _throwTypeError("theClass is an invalid class definition.");
304
- }
305
- var classProto = theClass[Prototype];
306
- if (!_checkPrototype(classProto, target)) {
307
- _throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
308
- }
309
- var className = null;
310
- if (_hasOwnProperty(classProto, DynClassName)) {
311
- className = classProto[DynClassName];
312
- }
313
- else {
314
- className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
315
- _dynamicNames++;
316
- classProto[DynClassName] = className;
317
- }
318
- var perfOptions = dynamicProto[DynProtoDefaultOptions];
319
- var useBaseInst = !!perfOptions[strUseBaseInst];
320
- if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
321
- useBaseInst = !!options[strUseBaseInst];
322
- }
323
- var instFuncs = _getInstanceFuncs(target);
324
- var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
325
- delegateFunc(target, baseFuncs);
326
- var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
327
- if (setInstanceFunc && options) {
328
- setInstanceFunc = !!options[strSetInstFuncs];
329
- }
330
- _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
331
- }
332
- var perfDefaults = {
333
- setInstFuncs: true,
334
- useBaseInst: true
335
- };
336
- dynamicProto[DynProtoDefaultOptions] = perfDefaults;
337
-
338
- var LoggingSeverity;
339
- (function (LoggingSeverity) {
340
- LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
341
- LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
342
- })(LoggingSeverity || (LoggingSeverity = {}));
343
- var _InternalMessageId = {
344
- BrowserDoesNotSupportLocalStorage: 0,
345
- BrowserCannotReadLocalStorage: 1,
346
- BrowserCannotReadSessionStorage: 2,
347
- BrowserCannotWriteLocalStorage: 3,
348
- BrowserCannotWriteSessionStorage: 4,
349
- BrowserFailedRemovalFromLocalStorage: 5,
350
- BrowserFailedRemovalFromSessionStorage: 6,
351
- CannotSendEmptyTelemetry: 7,
352
- ClientPerformanceMathError: 8,
353
- ErrorParsingAISessionCookie: 9,
354
- ErrorPVCalc: 10,
355
- ExceptionWhileLoggingError: 11,
356
- FailedAddingTelemetryToBuffer: 12,
357
- FailedMonitorAjaxAbort: 13,
358
- FailedMonitorAjaxDur: 14,
359
- FailedMonitorAjaxOpen: 15,
360
- FailedMonitorAjaxRSC: 16,
361
- FailedMonitorAjaxSend: 17,
362
- FailedMonitorAjaxGetCorrelationHeader: 18,
363
- FailedToAddHandlerForOnBeforeUnload: 19,
364
- FailedToSendQueuedTelemetry: 20,
365
- FailedToReportDataLoss: 21,
366
- FlushFailed: 22,
367
- MessageLimitPerPVExceeded: 23,
368
- MissingRequiredFieldSpecification: 24,
369
- NavigationTimingNotSupported: 25,
370
- OnError: 26,
371
- SessionRenewalDateIsZero: 27,
372
- SenderNotInitialized: 28,
373
- StartTrackEventFailed: 29,
374
- StopTrackEventFailed: 30,
375
- StartTrackFailed: 31,
376
- StopTrackFailed: 32,
377
- TelemetrySampledAndNotSent: 33,
378
- TrackEventFailed: 34,
379
- TrackExceptionFailed: 35,
380
- TrackMetricFailed: 36,
381
- TrackPVFailed: 37,
382
- TrackPVFailedCalc: 38,
383
- TrackTraceFailed: 39,
384
- TransmissionFailed: 40,
385
- FailedToSetStorageBuffer: 41,
386
- FailedToRestoreStorageBuffer: 42,
387
- InvalidBackendResponse: 43,
388
- FailedToFixDepricatedValues: 44,
389
- InvalidDurationValue: 45,
390
- TelemetryEnvelopeInvalid: 46,
391
- CreateEnvelopeError: 47,
392
- CannotSerializeObject: 48,
393
- CannotSerializeObjectNonSerializable: 49,
394
- CircularReferenceDetected: 50,
395
- ClearAuthContextFailed: 51,
396
- ExceptionTruncated: 52,
397
- IllegalCharsInName: 53,
398
- ItemNotInArray: 54,
399
- MaxAjaxPerPVExceeded: 55,
400
- MessageTruncated: 56,
401
- NameTooLong: 57,
402
- SampleRateOutOfRange: 58,
403
- SetAuthContextFailed: 59,
404
- SetAuthContextFailedAccountName: 60,
405
- StringValueTooLong: 61,
406
- StartCalledMoreThanOnce: 62,
407
- StopCalledWithoutStart: 63,
408
- TelemetryInitializerFailed: 64,
409
- TrackArgumentsNotSpecified: 65,
410
- UrlTooLong: 66,
411
- SessionStorageBufferFull: 67,
412
- CannotAccessCookie: 68,
413
- IdTooLong: 69,
414
- InvalidEvent: 70,
415
- FailedMonitorAjaxSetRequestHeader: 71,
416
- SendBrowserInfoOnUserInit: 72,
417
- PluginException: 73,
418
- NotificationException: 74,
419
- SnippetScriptLoadFailure: 99,
420
- InvalidInstrumentationKey: 100,
421
- CannotParseAiBlobValue: 101,
422
- InvalidContentBlob: 102,
423
- TrackPageActionEventFailed: 103,
424
- FailedAddingCustomDefinedRequestContext: 104,
425
- InMemoryStorageBufferFull: 105
426
- };
427
-
428
- var strOnPrefix = "on";
429
- var strAttachEvent = "attachEvent";
430
- var strAddEventHelper = "addEventListener";
431
- var strToISOString = "toISOString";
432
- var cStrTrim = "trim";
433
- var strToString = "toString";
434
- var str__Proto = "__proto__";
435
- var strConstructor = "constructor";
436
- var _objDefineProperty = ObjDefineProperty;
437
- var _objKeys = ObjClass.keys;
438
- var StringProto = String[strShimPrototype];
439
- var _strTrim = StringProto[cStrTrim];
440
- var DateProto = Date[strShimPrototype];
441
- var _dataToISOString = DateProto[strToISOString];
442
- var _isArray = Array.isArray;
443
- var _objToString = ObjProto[strToString];
444
- var _fnToString = ObjHasOwnProperty[strToString];
445
- _fnToString.call(ObjClass);
446
- var rCamelCase = /-([a-z])/g;
447
- var rNormalizeInvalid = /([^\w\d_$])/g;
448
- var rLeadingNumeric = /^(\d+[\w\d_$])/;
449
- var _objGetPrototypeOf = Object["getPrototypeOf"];
450
- function _getObjProto(target) {
451
- if (target) {
452
- if (_objGetPrototypeOf) {
453
- return _objGetPrototypeOf(target);
454
- }
455
- var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
456
- if (newProto) {
457
- return newProto;
458
- }
459
- }
460
- return null;
461
- }
462
- function isUndefined(value) {
463
- return value === undefined || typeof value === strShimUndefined;
464
- }
465
- function isNullOrUndefined(value) {
466
- return (value === null || isUndefined(value));
467
- }
468
- function hasOwnProperty(obj, prop) {
469
- return !!(obj && ObjHasOwnProperty.call(obj, prop));
470
- }
471
- function isObject(value) {
472
- return !!(value && typeof value === strShimObject);
473
- }
474
- function isFunction(value) {
475
- return !!(value && typeof value === strShimFunction);
476
- }
477
- function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
478
- if (useCapture === void 0) { useCapture = false; }
479
- var result = false;
480
- if (!isNullOrUndefined(obj)) {
481
- try {
482
- if (!isNullOrUndefined(obj[strAddEventHelper])) {
483
- obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
484
- result = true;
485
- }
486
- else if (!isNullOrUndefined(obj[strAttachEvent])) {
487
- obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
488
- result = true;
489
- }
490
- }
491
- catch (e) {
492
- }
493
- }
494
- return result;
495
- }
496
- function normalizeJsName(name) {
497
- var value = name;
498
- if (value && isString(value)) {
499
- value = value.replace(rCamelCase, function (_all, letter) {
500
- return letter.toUpperCase();
501
- });
502
- value = value.replace(rNormalizeInvalid, "_");
503
- value = value.replace(rLeadingNumeric, function (_all, match) {
504
- return "_" + match;
505
- });
506
- }
507
- return value;
508
- }
509
- function objForEachKey(target, callbackfn) {
510
- if (target) {
511
- for (var prop in target) {
512
- if (ObjHasOwnProperty.call(target, prop)) {
513
- callbackfn.call(target, prop, target[prop]);
514
- }
515
- }
516
- }
517
- }
518
- function strContains(value, search) {
519
- if (value && search) {
520
- return value.indexOf(search) !== -1;
521
- }
522
- return false;
523
- }
524
- var isArray = _isArray || _isArrayPoly;
525
- function _isArrayPoly(obj) {
526
- return !!(obj && _objToString.call(obj) === "[object Array]");
527
- }
528
- function isString(value) {
529
- return typeof value === "string";
530
- }
531
- function isNumber(value) {
532
- return typeof value === "number";
533
- }
534
- function toISOString(date) {
535
- if (date) {
536
- return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
537
- }
538
- }
539
- function _toISOStringPoly(date) {
540
- if (date && date.getUTCFullYear) {
541
- var pad = function (num) {
542
- var r = String(num);
543
- if (r.length === 1) {
544
- r = "0" + r;
545
- }
546
- return r;
547
- };
548
- return date.getUTCFullYear()
549
- + "-" + pad(date.getUTCMonth() + 1)
550
- + "-" + pad(date.getUTCDate())
551
- + "T" + pad(date.getUTCHours())
552
- + ":" + pad(date.getUTCMinutes())
553
- + ":" + pad(date.getUTCSeconds())
554
- + "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
555
- + "Z";
512
+ visited.push(baseProto);
513
+ baseProto = _getObjProto(baseProto);
556
514
  }
515
+ return baseFuncs;
557
516
  }
558
- function arrForEach(arr, callbackfn, thisArg) {
559
- var len = arr.length;
560
- try {
561
- for (var idx = 0; idx < len; idx++) {
562
- if (idx in arr) {
563
- if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
517
+ function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
518
+ var instFunc = null;
519
+ if (target && _hasOwnProperty(proto, DynClassName)) {
520
+ var instFuncTable = target[DynInstFuncTable] || {};
521
+ instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
522
+ if (!instFunc) {
523
+ _throwTypeError("Missing [" + funcName + "] " + strFunction);
524
+ }
525
+ if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
526
+ var canAddInst = !_hasOwnProperty(target, funcName);
527
+ var objProto = _getObjProto(target);
528
+ var visited = [];
529
+ while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
530
+ var protoFunc = objProto[funcName];
531
+ if (protoFunc) {
532
+ canAddInst = (protoFunc === currentDynProtoProxy);
564
533
  break;
565
534
  }
535
+ visited.push(objProto);
536
+ objProto = _getObjProto(objProto);
537
+ }
538
+ try {
539
+ if (canAddInst) {
540
+ target[funcName] = instFunc;
541
+ }
542
+ instFunc[DynInstChkTag] = 1;
543
+ }
544
+ catch (e) {
545
+ instFuncTable[DynAllowInstChkTag] = false;
566
546
  }
567
547
  }
568
548
  }
569
- catch (e) {
570
- }
549
+ return instFunc;
571
550
  }
572
- function strTrim(str) {
573
- if (str) {
574
- str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
551
+ function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
552
+ var protoFunc = proto[funcName];
553
+ if (protoFunc === currentDynProtoProxy) {
554
+ protoFunc = _getObjProto(proto)[funcName];
575
555
  }
576
- return str;
577
- }
578
- var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
579
- var _objKeysDontEnums = [
580
- "toString",
581
- "toLocaleString",
582
- "valueOf",
583
- "hasOwnProperty",
584
- "isPrototypeOf",
585
- "propertyIsEnumerable",
586
- "constructor"
587
- ];
588
- function objKeys(obj) {
589
- var objType = typeof obj;
590
- if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
591
- throwTypeError("objKeys called on non-object");
556
+ if (typeof protoFunc !== strFunction) {
557
+ _throwTypeError("[" + funcName + "] is not a " + strFunction);
592
558
  }
593
- if (!_objKeysHasDontEnumBug && _objKeys) {
594
- return _objKeys(obj);
559
+ return protoFunc;
560
+ }
561
+ function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
562
+ function _createDynamicPrototype(proto, funcName) {
563
+ var dynProtoProxy = function () {
564
+ var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
565
+ return instFunc.apply(this, arguments);
566
+ };
567
+ dynProtoProxy[DynProxyTag] = 1;
568
+ return dynProtoProxy;
595
569
  }
596
- var result = [];
597
- for (var prop in obj) {
598
- if (obj && ObjHasOwnProperty.call(obj, prop)) {
599
- result.push(prop);
570
+ if (!_isObjectOrArrayPrototype(proto)) {
571
+ var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
572
+ var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
573
+ if (instFuncTable[DynAllowInstChkTag] !== false) {
574
+ instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
600
575
  }
601
- }
602
- if (_objKeysHasDontEnumBug) {
603
- var dontEnumsLength = _objKeysDontEnums.length;
604
- for (var lp = 0; lp < dontEnumsLength; lp++) {
605
- if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
606
- result.push(_objKeysDontEnums[lp]);
576
+ _forEachProp(target, function (name) {
577
+ if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
578
+ instFuncs_1[name] = target[name];
579
+ delete target[name];
580
+ if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
581
+ proto[name] = _createDynamicPrototype(proto, name);
582
+ }
607
583
  }
608
- }
584
+ });
609
585
  }
610
- return result;
611
586
  }
612
- function objDefineAccessors(target, prop, getProp, setProp) {
613
- if (_objDefineProperty) {
614
- try {
615
- var descriptor = {
616
- enumerable: true,
617
- configurable: true
618
- };
619
- if (getProp) {
620
- descriptor.get = getProp;
621
- }
622
- if (setProp) {
623
- descriptor.set = setProp;
587
+ function _checkPrototype(classProto, thisTarget) {
588
+ if (_objGetPrototypeOf) {
589
+ var visited = [];
590
+ var thisProto = _getObjProto(thisTarget);
591
+ while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
592
+ if (thisProto === classProto) {
593
+ return true;
624
594
  }
625
- _objDefineProperty(target, prop, descriptor);
626
- return true;
627
- }
628
- catch (e) {
595
+ visited.push(thisProto);
596
+ thisProto = _getObjProto(thisProto);
629
597
  }
630
598
  }
631
599
  return false;
632
600
  }
633
- function dateNow() {
634
- var dt = Date;
635
- return dt.now ? dt.now() : new dt().getTime();
601
+ function _getObjName(target, unknownValue) {
602
+ if (_hasOwnProperty(target, Prototype)) {
603
+ return target.name || unknownValue || UnknownValue;
604
+ }
605
+ return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
636
606
  }
637
- function setValue(target, field, value, valChk, srcChk) {
638
- var theValue = value;
639
- if (target) {
640
- theValue = target[field];
641
- if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
642
- theValue = value;
643
- target[field] = theValue;
644
- }
607
+ function dynamicProto(theClass, target, delegateFunc, options) {
608
+ if (!_hasOwnProperty(theClass, Prototype)) {
609
+ _throwTypeError("theClass is an invalid class definition.");
645
610
  }
646
- return theValue;
611
+ var classProto = theClass[Prototype];
612
+ if (!_checkPrototype(classProto, target)) {
613
+ _throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
614
+ }
615
+ var className = null;
616
+ if (_hasOwnProperty(classProto, DynClassName)) {
617
+ className = classProto[DynClassName];
618
+ }
619
+ else {
620
+ className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
621
+ _dynamicNames++;
622
+ classProto[DynClassName] = className;
623
+ }
624
+ var perfOptions = dynamicProto[DynProtoDefaultOptions];
625
+ var useBaseInst = !!perfOptions[strUseBaseInst];
626
+ if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
627
+ useBaseInst = !!options[strUseBaseInst];
628
+ }
629
+ var instFuncs = _getInstanceFuncs(target);
630
+ var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
631
+ delegateFunc(target, baseFuncs);
632
+ var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
633
+ if (setInstanceFunc && options) {
634
+ setInstanceFunc = !!options[strSetInstFuncs];
635
+ }
636
+ _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
647
637
  }
638
+ var perfDefaults = {
639
+ setInstFuncs: true,
640
+ useBaseInst: true
641
+ };
642
+ dynamicProto[DynProtoDefaultOptions] = perfDefaults;
648
643
 
649
644
  var strWindow = "window";
650
645
  var strDocument = "document";
@@ -658,6 +653,7 @@
658
653
  var strMsCrypto = "msCrypto";
659
654
  var strMsie = "msie";
660
655
  var strTrident = "trident/";
656
+ var strXMLHttpRequest = "XMLHttpRequest";
661
657
  var _isTrident = null;
662
658
  var _navUserAgentCheck = null;
663
659
  var _enableMocks = false;
@@ -732,7 +728,7 @@
732
728
  var nav = getNavigator();
733
729
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
734
730
  _navUserAgentCheck = nav.userAgent;
735
- var userAgent = (_navUserAgentCheck || "").toLowerCase();
731
+ var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
736
732
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
737
733
  }
738
734
  return _isTrident;
@@ -741,9 +737,9 @@
741
737
  if (userAgentStr === void 0) { userAgentStr = null; }
742
738
  if (!userAgentStr) {
743
739
  var navigator_1 = getNavigator() || {};
744
- userAgentStr = navigator_1 ? (navigator_1.userAgent || "").toLowerCase() : "";
740
+ userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
745
741
  }
746
- var ua = (userAgentStr || "").toLowerCase();
742
+ var ua = (userAgentStr || strEmpty$1).toLowerCase();
747
743
  if (strContains(ua, strMsie)) {
748
744
  var doc = getDocument() || {};
749
745
  return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
@@ -758,7 +754,7 @@
758
754
  }
759
755
  function dumpObj(object) {
760
756
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
761
- var propertyValueDump = "";
757
+ var propertyValueDump = strEmpty$1;
762
758
  if (objectTypeDump === "[object Error]") {
763
759
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
764
760
  }
@@ -770,7 +766,7 @@
770
766
  function isXhrSupported() {
771
767
  var isSupported = false;
772
768
  try {
773
- var xmlHttpRequest = getGlobalInst("XMLHttpRequest");
769
+ var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);
774
770
  isSupported = !!xmlHttpRequest;
775
771
  }
776
772
  catch (e) {
@@ -801,9 +797,9 @@
801
797
  var strWarnToConsole = "warnToConsole";
802
798
  function _sanitizeDiagnosticText(text) {
803
799
  if (text) {
804
- return "\"" + text.replace(/\"/g, "") + "\"";
800
+ return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
805
801
  }
806
- return "";
802
+ return strEmpty$1;
807
803
  }
808
804
  function _logToConsole(func, message) {
809
805
  var theConsole = getConsole();
@@ -825,12 +821,12 @@
825
821
  _self.message =
826
822
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
827
823
  msgId;
828
- var strProps = "";
824
+ var strProps = strEmpty$1;
829
825
  if (hasJSON()) {
830
826
  strProps = getJSON().stringify(properties);
831
827
  }
832
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
833
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
828
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
829
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
834
830
  _self.message += diagnosticText;
835
831
  }
836
832
  _InternalLogMessage.dataType = "MessageData";
@@ -860,7 +856,7 @@
860
856
  throw message;
861
857
  }
862
858
  else {
863
- var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
859
+ var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
864
860
  if (!isUndefined(message.message)) {
865
861
  var logLevel = _self.consoleLoggingLevel();
866
862
  if (isUserAct) {
@@ -878,7 +874,7 @@
878
874
  _self.logInternalMessage(severity, message);
879
875
  }
880
876
  else {
881
- _debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
877
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
882
878
  }
883
879
  }
884
880
  };
@@ -910,13 +906,13 @@
910
906
  if (severity <= _self.telemetryLoggingLevel()) {
911
907
  _self.queue.push(message);
912
908
  _messageCount++;
913
- _debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
909
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
914
910
  }
915
911
  if (_messageCount === _self.maxInternalMessageLimit()) {
916
912
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
917
- var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
913
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
918
914
  _self.queue.push(throttleMessage);
919
- if (severity === LoggingSeverity.CRITICAL) {
915
+ if (severity === 1 ) {
920
916
  _self.errorToConsole(throttleLimitMessage);
921
917
  }
922
918
  else {
@@ -945,6 +941,10 @@
945
941
  }
946
942
  return DiagnosticLogger;
947
943
  }());
944
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
945
+ if (isUserAct === void 0) { isUserAct = false; }
946
+ (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
947
+ }
948
948
 
949
949
  var strExecutionContextKey = "ctx";
950
950
  var PerfEvent = /** @class */ (function () {
@@ -1054,211 +1054,620 @@
1054
1054
  perfMgr.setCtx(doPerfActiveKey, currentActive);
1055
1055
  }
1056
1056
  }
1057
- }
1058
- return func();
1057
+ }
1058
+ return func();
1059
+ }
1060
+
1061
+ var UInt32Mask = 0x100000000;
1062
+ var MaxUInt32 = 0xffffffff;
1063
+ var _mwcSeeded = false;
1064
+ var _mwcW = 123456789;
1065
+ var _mwcZ = 987654321;
1066
+ function _mwcSeed(seedValue) {
1067
+ if (seedValue < 0) {
1068
+ seedValue >>>= 0;
1069
+ }
1070
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1071
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1072
+ _mwcSeeded = true;
1073
+ }
1074
+ function _autoSeedMwc() {
1075
+ try {
1076
+ var now = dateNow() & 0x7fffffff;
1077
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1078
+ }
1079
+ catch (e) {
1080
+ }
1081
+ }
1082
+ function random32(signed) {
1083
+ var value = 0;
1084
+ var c = getCrypto() || getMsCrypto();
1085
+ if (c && c.getRandomValues) {
1086
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1087
+ }
1088
+ if (value === 0 && isIE()) {
1089
+ if (!_mwcSeeded) {
1090
+ _autoSeedMwc();
1091
+ }
1092
+ value = mwcRandom32() & MaxUInt32;
1093
+ }
1094
+ if (value === 0) {
1095
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1096
+ }
1097
+ if (!signed) {
1098
+ value >>>= 0;
1099
+ }
1100
+ return value;
1101
+ }
1102
+ function mwcRandom32(signed) {
1103
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1104
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1105
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1106
+ if (!signed) {
1107
+ value >>>= 0;
1108
+ }
1109
+ return value;
1110
+ }
1111
+ function newId(maxLength) {
1112
+ if (maxLength === void 0) { maxLength = 22; }
1113
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1114
+ var number = random32() >>> 0;
1115
+ var chars = 0;
1116
+ var result = strEmpty$1;
1117
+ while (result.length < maxLength) {
1118
+ chars++;
1119
+ result += base64chars.charAt(number & 0x3F);
1120
+ number >>>= 6;
1121
+ if (chars === 5) {
1122
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1123
+ chars = 0;
1124
+ }
1125
+ }
1126
+ return result;
1127
+ }
1128
+
1129
+ var _objDefineProperty = ObjDefineProperty;
1130
+ var version = "2.8.0-nightly.2204-06";
1131
+ var instanceName = "." + newId(6);
1132
+ var _dataUid = 0;
1133
+ function _createAccessor(target, prop, value) {
1134
+ if (_objDefineProperty) {
1135
+ try {
1136
+ _objDefineProperty(target, prop, {
1137
+ value: value,
1138
+ enumerable: false,
1139
+ configurable: true
1140
+ });
1141
+ return true;
1142
+ }
1143
+ catch (e) {
1144
+ }
1145
+ }
1146
+ return false;
1147
+ }
1148
+ function _canAcceptData(target) {
1149
+ return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
1150
+ }
1151
+ function _getCache(data, target) {
1152
+ var theCache = target[data.id];
1153
+ if (!theCache) {
1154
+ theCache = {};
1155
+ try {
1156
+ if (_canAcceptData(target)) {
1157
+ if (!_createAccessor(target, data.id, theCache)) {
1158
+ target[data.id] = theCache;
1159
+ }
1160
+ }
1161
+ }
1162
+ catch (e) {
1163
+ }
1164
+ }
1165
+ return theCache;
1166
+ }
1167
+ function createUniqueNamespace(name, includeVersion) {
1168
+ if (includeVersion === void 0) { includeVersion = false; }
1169
+ return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
1170
+ }
1171
+ function createElmNodeData(name) {
1172
+ var data = {
1173
+ id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
1174
+ accept: function (target) {
1175
+ return _canAcceptData(target);
1176
+ },
1177
+ get: function (target, name, defValue, addDefault) {
1178
+ var theCache = target[data.id];
1179
+ if (!theCache) {
1180
+ if (addDefault) {
1181
+ theCache = _getCache(data, target);
1182
+ theCache[normalizeJsName(name)] = defValue;
1183
+ }
1184
+ return defValue;
1185
+ }
1186
+ return theCache[normalizeJsName(name)];
1187
+ },
1188
+ kill: function (target, name) {
1189
+ if (target && target[name]) {
1190
+ try {
1191
+ delete target[name];
1192
+ }
1193
+ catch (e) {
1194
+ }
1195
+ }
1196
+ }
1197
+ };
1198
+ return data;
1059
1199
  }
1060
1200
 
1061
- var TelemetryPluginChain = /** @class */ (function () {
1062
- function TelemetryPluginChain(plugin, defItemCtx) {
1063
- var _self = this;
1064
- var _nextProxy = null;
1065
- var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
1066
- var _hasSetNext = isFunction(plugin.setNextPlugin);
1067
- _self._hasRun = false;
1068
- _self.getPlugin = function () {
1069
- return plugin;
1070
- };
1071
- _self.getNext = function () {
1072
- return _nextProxy;
1073
- };
1074
- _self.setNext = function (nextPlugin) {
1075
- _nextProxy = nextPlugin;
1076
- };
1077
- _self.processTelemetry = function (env, itemCtx) {
1078
- if (!itemCtx) {
1079
- itemCtx = defItemCtx;
1080
- }
1081
- var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
1082
- doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
1083
- if (plugin && _hasProcessTelemetry) {
1084
- _self._hasRun = true;
1201
+ var pluginStateData = createElmNodeData("plugin");
1202
+ function _getPluginState(plugin) {
1203
+ return pluginStateData.get(plugin, "state", {}, true);
1204
+ }
1205
+
1206
+ var strTelemetryPluginChain = "TelemetryPluginChain";
1207
+ var strHasRunFlags = "_hasRun";
1208
+ var strGetTelCtx = "_getTelCtx";
1209
+ var _chainId = 0;
1210
+ function _getNextProxyStart(proxy, config, core, startAt) {
1211
+ while (proxy) {
1212
+ if (proxy.getPlugin() === startAt) {
1213
+ return proxy;
1214
+ }
1215
+ proxy = proxy.getNext();
1216
+ }
1217
+ return createTelemetryProxyChain([startAt], config, core);
1218
+ }
1219
+ function _createInternalContext(telemetryChain, config, core, startAt) {
1220
+ var _nextProxy = null;
1221
+ var _onComplete = [];
1222
+ if (startAt !== null) {
1223
+ _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1224
+ }
1225
+ var context = {
1226
+ _next: _moveNext,
1227
+ ctx: {
1228
+ core: function () {
1229
+ return core;
1230
+ },
1231
+ diagLog: function () {
1232
+ return safeGetLogger(core, config);
1233
+ },
1234
+ getCfg: function () {
1235
+ return config;
1236
+ },
1237
+ getExtCfg: _getExtCfg,
1238
+ getConfig: _getConfig,
1239
+ hasNext: function () {
1240
+ return !!_nextProxy;
1241
+ },
1242
+ getNext: function () {
1243
+ return _nextProxy;
1244
+ },
1245
+ setNext: function (nextPlugin) {
1246
+ _nextProxy = nextPlugin;
1247
+ },
1248
+ iterate: _iterateChain,
1249
+ onComplete: _addOnComplete
1250
+ }
1251
+ };
1252
+ function _addOnComplete(onComplete, that) {
1253
+ var args = [];
1254
+ for (var _i = 2; _i < arguments.length; _i++) {
1255
+ args[_i - 2] = arguments[_i];
1256
+ }
1257
+ if (onComplete) {
1258
+ _onComplete.push({
1259
+ func: onComplete,
1260
+ self: !isUndefined(that) ? that : context.ctx,
1261
+ args: args
1262
+ });
1263
+ }
1264
+ }
1265
+ function _moveNext() {
1266
+ var nextProxy = _nextProxy;
1267
+ _nextProxy = nextProxy ? nextProxy.getNext() : null;
1268
+ if (!nextProxy) {
1269
+ var onComplete = _onComplete;
1270
+ if (onComplete && onComplete.length > 0) {
1271
+ arrForEach(onComplete, function (completeDetails) {
1085
1272
  try {
1086
- itemCtx.setNext(_nextProxy);
1087
- if (_hasSetNext) {
1088
- plugin.setNextPlugin(_nextProxy);
1089
- }
1090
- _nextProxy && (_nextProxy._hasRun = false);
1091
- plugin.processTelemetry(env, itemCtx);
1273
+ completeDetails.func.call(completeDetails.self, completeDetails.args);
1092
1274
  }
1093
- catch (error) {
1094
- var hasRun = _nextProxy && _nextProxy._hasRun;
1095
- if (!_nextProxy || !hasRun) {
1096
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
1097
- }
1098
- if (_nextProxy && !hasRun) {
1099
- _nextProxy.processTelemetry(env, itemCtx);
1100
- }
1275
+ catch (e) {
1276
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1101
1277
  }
1102
- }
1103
- else if (_nextProxy) {
1104
- _self._hasRun = true;
1105
- _nextProxy.processTelemetry(env, itemCtx);
1106
- }
1107
- }, function () { return ({ item: env }); }, !(env.sync));
1108
- };
1278
+ });
1279
+ _onComplete = [];
1280
+ }
1281
+ }
1282
+ return nextProxy;
1109
1283
  }
1110
- return TelemetryPluginChain;
1111
- }());
1112
-
1113
- function _createProxyChain(plugins, itemCtx) {
1114
- var proxies = [];
1115
- if (plugins && plugins.length > 0) {
1116
- var lastProxy = null;
1117
- for (var idx = 0; idx < plugins.length; idx++) {
1118
- var thePlugin = plugins[idx];
1119
- if (thePlugin && isFunction(thePlugin.processTelemetry)) {
1120
- var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
1121
- proxies.push(newProxy);
1122
- if (lastProxy) {
1123
- lastProxy.setNext(newProxy);
1284
+ function _getExtCfg(identifier, defaultValue, mergeDefault) {
1285
+ if (defaultValue === void 0) { defaultValue = {}; }
1286
+ if (mergeDefault === void 0) { mergeDefault = 0 ; }
1287
+ var theConfig;
1288
+ if (config) {
1289
+ var extConfig = config.extensionConfig;
1290
+ if (extConfig && identifier) {
1291
+ theConfig = extConfig[identifier];
1292
+ }
1293
+ }
1294
+ if (!theConfig) {
1295
+ theConfig = defaultValue;
1296
+ }
1297
+ else if (isObject(defaultValue)) {
1298
+ if (mergeDefault !== 0 ) {
1299
+ var newConfig_1 = objExtend(true, defaultValue, theConfig);
1300
+ if (config && mergeDefault === 2 ) {
1301
+ objForEachKey(defaultValue, function (field) {
1302
+ if (isNullOrUndefined(newConfig_1[field])) {
1303
+ var cfgValue = config[field];
1304
+ if (!isNullOrUndefined(cfgValue)) {
1305
+ newConfig_1[field] = cfgValue;
1306
+ }
1307
+ }
1308
+ });
1124
1309
  }
1125
- lastProxy = newProxy;
1126
1310
  }
1127
1311
  }
1312
+ return theConfig;
1128
1313
  }
1129
- return proxies.length > 0 ? proxies[0] : null;
1130
- }
1131
- function _copyProxyChain(proxy, itemCtx, startAt) {
1132
- var plugins = [];
1133
- var add = startAt ? false : true;
1134
- if (proxy) {
1135
- while (proxy) {
1136
- var thePlugin = proxy.getPlugin();
1137
- if (add || thePlugin === startAt) {
1138
- add = true;
1139
- plugins.push(thePlugin);
1314
+ function _getConfig(identifier, field, defaultValue) {
1315
+ if (defaultValue === void 0) { defaultValue = false; }
1316
+ var theValue;
1317
+ var extConfig = _getExtCfg(identifier, null);
1318
+ if (extConfig && !isNullOrUndefined(extConfig[field])) {
1319
+ theValue = extConfig[field];
1320
+ }
1321
+ else if (config && !isNullOrUndefined(config[field])) {
1322
+ theValue = config[field];
1323
+ }
1324
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1325
+ }
1326
+ function _iterateChain(cb) {
1327
+ var nextPlugin;
1328
+ while (!!(nextPlugin = context._next())) {
1329
+ var plugin = nextPlugin.getPlugin();
1330
+ if (plugin) {
1331
+ cb(plugin);
1140
1332
  }
1141
- proxy = proxy.getNext();
1142
1333
  }
1143
1334
  }
1144
- if (!add) {
1145
- plugins.push(startAt);
1335
+ return context;
1336
+ }
1337
+ function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1338
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1339
+ var context = internalContext.ctx;
1340
+ function _processNext(env) {
1341
+ var nextPlugin = internalContext._next();
1342
+ nextPlugin && nextPlugin.processTelemetry(env, context);
1343
+ return !nextPlugin;
1344
+ }
1345
+ function _createNew(plugins, startAt) {
1346
+ if (plugins === void 0) { plugins = null; }
1347
+ if (isArray(plugins)) {
1348
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1349
+ }
1350
+ return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
1146
1351
  }
1147
- return _createProxyChain(plugins, itemCtx);
1352
+ context.processNext = _processNext;
1353
+ context.createNew = _createNew;
1354
+ return context;
1148
1355
  }
1149
- function _copyPluginChain(srcPlugins, itemCtx, startAt) {
1150
- var plugins = srcPlugins;
1151
- var add = false;
1152
- if (startAt && srcPlugins) {
1153
- plugins = [];
1154
- arrForEach(srcPlugins, function (thePlugin) {
1155
- if (add || thePlugin === startAt) {
1156
- add = true;
1157
- plugins.push(thePlugin);
1356
+ function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
1357
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1358
+ var context = internalContext.ctx;
1359
+ function _processNext(unloadState) {
1360
+ var nextPlugin = internalContext._next();
1361
+ nextPlugin && nextPlugin.unload(context, unloadState);
1362
+ return !nextPlugin;
1363
+ }
1364
+ function _createNew(plugins, startAt) {
1365
+ if (plugins === void 0) { plugins = null; }
1366
+ if (isArray(plugins)) {
1367
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1368
+ }
1369
+ return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
1370
+ }
1371
+ context.processNext = _processNext;
1372
+ context.createNew = _createNew;
1373
+ return context;
1374
+ }
1375
+ function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
1376
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1377
+ var context = internalContext.ctx;
1378
+ function _processNext(updateState) {
1379
+ return context.iterate(function (plugin) {
1380
+ if (isFunction(plugin[strUpdate])) {
1381
+ plugin[strUpdate](context, updateState);
1158
1382
  }
1159
1383
  });
1160
1384
  }
1161
- if (startAt && !add) {
1162
- if (!plugins) {
1163
- plugins = [];
1385
+ function _createNew(plugins, startAt) {
1386
+ if (plugins === void 0) { plugins = null; }
1387
+ if (isArray(plugins)) {
1388
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1164
1389
  }
1165
- plugins.push(startAt);
1390
+ return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1166
1391
  }
1167
- return _createProxyChain(plugins, itemCtx);
1392
+ context.processNext = _processNext;
1393
+ context.createNew = _createNew;
1394
+ return context;
1168
1395
  }
1169
- var ProcessTelemetryContext = /** @class */ (function () {
1170
- function ProcessTelemetryContext(plugins, config, core, startAt) {
1171
- var _self = this;
1172
- var _nextProxy = null;
1173
- if (startAt !== null) {
1174
- if (plugins && isFunction(plugins.getPlugin)) {
1175
- _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
1396
+ function createTelemetryProxyChain(plugins, config, core, startAt) {
1397
+ var firstProxy = null;
1398
+ var add = startAt ? false : true;
1399
+ if (isArray(plugins) && plugins.length > 0) {
1400
+ var lastProxy_1 = null;
1401
+ arrForEach(plugins, function (thePlugin) {
1402
+ if (!add && startAt === thePlugin) {
1403
+ add = true;
1176
1404
  }
1177
- else {
1178
- if (startAt) {
1179
- _nextProxy = _copyPluginChain(plugins, _self, startAt);
1405
+ if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
1406
+ var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1407
+ if (!firstProxy) {
1408
+ firstProxy = newProxy;
1180
1409
  }
1181
- else if (isUndefined(startAt)) {
1182
- _nextProxy = _createProxyChain(plugins, _self);
1410
+ if (lastProxy_1) {
1411
+ lastProxy_1._setNext(newProxy);
1183
1412
  }
1413
+ lastProxy_1 = newProxy;
1184
1414
  }
1415
+ });
1416
+ }
1417
+ if (startAt && !firstProxy) {
1418
+ return createTelemetryProxyChain([startAt], config, core);
1419
+ }
1420
+ return firstProxy;
1421
+ }
1422
+ function createTelemetryPluginProxy(plugin, config, core) {
1423
+ var nextProxy = null;
1424
+ var hasProcessTelemetry = isFunction(plugin.processTelemetry);
1425
+ var hasSetNext = isFunction(plugin.setNextPlugin);
1426
+ var chainId;
1427
+ if (plugin) {
1428
+ chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
1429
+ }
1430
+ else {
1431
+ chainId = "Unknown-0-" + _chainId++;
1432
+ }
1433
+ var proxyChain = {
1434
+ getPlugin: function () {
1435
+ return plugin;
1436
+ },
1437
+ getNext: function () {
1438
+ return nextProxy;
1439
+ },
1440
+ processTelemetry: _processTelemetry,
1441
+ unload: _unloadPlugin,
1442
+ update: _updatePlugin,
1443
+ _id: chainId,
1444
+ _setNext: function (nextPlugin) {
1445
+ nextProxy = nextPlugin;
1185
1446
  }
1186
- _self.core = function () {
1187
- return core;
1188
- };
1189
- _self.diagLog = function () {
1190
- return safeGetLogger(core, config);
1191
- };
1192
- _self.getCfg = function () {
1193
- return config;
1194
- };
1195
- _self.getExtCfg = function (identifier, defaultValue) {
1196
- if (defaultValue === void 0) { defaultValue = {}; }
1197
- var theConfig;
1198
- if (config) {
1199
- var extConfig = config.extensionConfig;
1200
- if (extConfig && identifier) {
1201
- theConfig = extConfig[identifier];
1447
+ };
1448
+ function _getTelCtx() {
1449
+ var itemCtx;
1450
+ if (plugin && isFunction(plugin[strGetTelCtx])) {
1451
+ itemCtx = plugin[strGetTelCtx]();
1452
+ }
1453
+ if (!itemCtx) {
1454
+ itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1455
+ }
1456
+ return itemCtx;
1457
+ }
1458
+ function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
1459
+ var hasRun = false;
1460
+ var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1461
+ var hasRunContext = itemCtx[strHasRunFlags];
1462
+ if (!hasRunContext) {
1463
+ hasRunContext = itemCtx[strHasRunFlags] = {};
1464
+ }
1465
+ itemCtx.setNext(nextProxy);
1466
+ if (plugin) {
1467
+ doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
1468
+ hasRunContext[chainId] = true;
1469
+ try {
1470
+ var nextId = nextProxy ? nextProxy._id : strEmpty$1;
1471
+ if (nextId) {
1472
+ hasRunContext[nextId] = false;
1473
+ }
1474
+ hasRun = processPluginFn(itemCtx);
1202
1475
  }
1476
+ catch (error) {
1477
+ var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
1478
+ if (hasNextRun) {
1479
+ hasRun = true;
1480
+ }
1481
+ if (!nextProxy || !hasNextRun) {
1482
+ _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1483
+ }
1484
+ }
1485
+ }, details, isAsync);
1486
+ }
1487
+ return hasRun;
1488
+ }
1489
+ function _processTelemetry(env, itemCtx) {
1490
+ itemCtx = itemCtx || _getTelCtx();
1491
+ function _callProcessTelemetry(itemCtx) {
1492
+ if (!plugin || !hasProcessTelemetry) {
1493
+ return false;
1203
1494
  }
1204
- return (theConfig ? theConfig : defaultValue);
1205
- };
1206
- _self.getConfig = function (identifier, field, defaultValue) {
1207
- if (defaultValue === void 0) { defaultValue = false; }
1208
- var theValue;
1209
- var extConfig = _self.getExtCfg(identifier, null);
1210
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
1211
- theValue = extConfig[field];
1495
+ var pluginState = _getPluginState(plugin);
1496
+ if (pluginState[strTeardown] || pluginState[strDisabled]) {
1497
+ return false;
1212
1498
  }
1213
- else if (config && !isNullOrUndefined(config[field])) {
1214
- theValue = config[field];
1499
+ if (hasSetNext) {
1500
+ plugin.setNextPlugin(nextProxy);
1215
1501
  }
1216
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1217
- };
1218
- _self.hasNext = function () {
1219
- return _nextProxy != null;
1220
- };
1221
- _self.getNext = function () {
1222
- return _nextProxy;
1223
- };
1224
- _self.setNext = function (nextPlugin) {
1225
- _nextProxy = nextPlugin;
1226
- };
1227
- _self.processNext = function (env) {
1228
- var nextPlugin = _nextProxy;
1229
- if (nextPlugin) {
1230
- _nextProxy = nextPlugin.getNext();
1231
- nextPlugin.processTelemetry(env, _self);
1502
+ plugin.processTelemetry(env, itemCtx);
1503
+ return true;
1504
+ }
1505
+ if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
1506
+ itemCtx.processNext(env);
1507
+ }
1508
+ }
1509
+ function _unloadPlugin(unloadCtx, unloadState) {
1510
+ function _callTeardown() {
1511
+ var hasRun = false;
1512
+ if (plugin) {
1513
+ var pluginState = _getPluginState(plugin);
1514
+ var pluginCore = plugin[strCore] || pluginState.core;
1515
+ if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
1516
+ pluginState[strCore] = null;
1517
+ pluginState[strTeardown] = true;
1518
+ pluginState[strIsInitialized] = false;
1519
+ if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
1520
+ hasRun = true;
1521
+ }
1522
+ }
1232
1523
  }
1233
- };
1234
- _self.createNew = function (plugins, startAt) {
1235
- if (plugins === void 0) { plugins = null; }
1236
- return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1237
- };
1524
+ return hasRun;
1525
+ }
1526
+ if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1527
+ unloadCtx.processNext(unloadState);
1528
+ }
1238
1529
  }
1239
- return ProcessTelemetryContext;
1240
- }());
1530
+ function _updatePlugin(updateCtx, updateState) {
1531
+ function _callUpdate() {
1532
+ var hasRun = false;
1533
+ if (plugin) {
1534
+ var pluginState = _getPluginState(plugin);
1535
+ var pluginCore = plugin[strCore] || pluginState.core;
1536
+ if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1537
+ if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1538
+ hasRun = true;
1539
+ }
1540
+ }
1541
+ }
1542
+ return hasRun;
1543
+ }
1544
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1545
+ updateCtx.processNext(updateState);
1546
+ }
1547
+ }
1548
+ return objFreeze(proxyChain);
1549
+ }
1241
1550
 
1242
1551
  var strExtensionConfig = "extensionConfig";
1243
1552
 
1553
+ function createUnloadHandlerContainer() {
1554
+ var handlers = [];
1555
+ function _addHandler(handler) {
1556
+ if (handler) {
1557
+ handlers.push(handler);
1558
+ }
1559
+ }
1560
+ function _runHandlers(unloadCtx, unloadState) {
1561
+ arrForEach(handlers, function (handler) {
1562
+ try {
1563
+ handler(unloadCtx, unloadState);
1564
+ }
1565
+ catch (e) {
1566
+ _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1567
+ }
1568
+ });
1569
+ handlers = [];
1570
+ }
1571
+ return {
1572
+ add: _addHandler,
1573
+ run: _runHandlers
1574
+ };
1575
+ }
1576
+
1244
1577
  var strGetPlugin = "getPlugin";
1245
1578
  var BaseTelemetryPlugin = /** @class */ (function () {
1246
1579
  function BaseTelemetryPlugin() {
1247
1580
  var _self = this;
1248
- var _isinitialized = false;
1249
- var _rootCtx = null;
1250
- var _nextPlugin = null;
1251
- _self.core = null;
1581
+ var _isinitialized;
1582
+ var _rootCtx;
1583
+ var _nextPlugin;
1584
+ var _unloadHandlerContainer;
1585
+ var _hooks;
1586
+ _initDefaults();
1587
+ dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
1588
+ _self.initialize = function (config, core, extensions, pluginChain) {
1589
+ _setDefaults(config, core, pluginChain);
1590
+ _isinitialized = true;
1591
+ };
1592
+ _self.teardown = function (unloadCtx, unloadState) {
1593
+ if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
1594
+ return;
1595
+ }
1596
+ var result;
1597
+ var unloadDone = false;
1598
+ var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1599
+ var theUnloadState = unloadState || {
1600
+ reason: 0 ,
1601
+ isAsync: false
1602
+ };
1603
+ function _unloadCallback() {
1604
+ if (!unloadDone) {
1605
+ unloadDone = true;
1606
+ _unloadHandlerContainer.run(theUnloadCtx, unloadState);
1607
+ arrForEach(_hooks, function (fn) {
1608
+ fn.rm();
1609
+ });
1610
+ _hooks = [];
1611
+ if (result === true) {
1612
+ theUnloadCtx.processNext(theUnloadState);
1613
+ }
1614
+ _initDefaults();
1615
+ }
1616
+ }
1617
+ if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
1618
+ _unloadCallback();
1619
+ }
1620
+ else {
1621
+ result = true;
1622
+ }
1623
+ return result;
1624
+ };
1625
+ _self.update = function (updateCtx, updateState) {
1626
+ if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
1627
+ return;
1628
+ }
1629
+ var result;
1630
+ var updateDone = false;
1631
+ var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1632
+ var theUpdateState = updateState || {
1633
+ reason: 0
1634
+ };
1635
+ function _updateCallback() {
1636
+ if (!updateDone) {
1637
+ updateDone = true;
1638
+ _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
1639
+ }
1640
+ }
1641
+ if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
1642
+ _updateCallback();
1643
+ }
1644
+ else {
1645
+ result = true;
1646
+ }
1647
+ return result;
1648
+ };
1649
+ _self._addHook = function (hooks) {
1650
+ if (hooks) {
1651
+ if (isArray(hooks)) {
1652
+ _hooks = _hooks.concat(hooks);
1653
+ }
1654
+ else {
1655
+ _hooks.push(hooks);
1656
+ }
1657
+ }
1658
+ };
1659
+ proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
1660
+ });
1252
1661
  _self.diagLog = function (itemCtx) {
1253
- return _self._getTelCtx(itemCtx).diagLog();
1662
+ return _getTelCtx(itemCtx).diagLog();
1254
1663
  };
1255
- _self.isInitialized = function () {
1664
+ _self[strIsInitialized] = function () {
1256
1665
  return _isinitialized;
1257
1666
  };
1258
1667
  _self.setInitialized = function (isInitialized) {
1259
1668
  _isinitialized = isInitialized;
1260
1669
  };
1261
- _self.setNextPlugin = function (next) {
1670
+ _self[strSetNextPlugin] = function (next) {
1262
1671
  _nextPlugin = next;
1263
1672
  };
1264
1673
  _self.processNext = function (env, itemCtx) {
@@ -1269,11 +1678,12 @@
1269
1678
  _nextPlugin.processTelemetry(env, null);
1270
1679
  }
1271
1680
  };
1272
- _self._getTelCtx = function (currentCtx) {
1681
+ _self._getTelCtx = _getTelCtx;
1682
+ function _getTelCtx(currentCtx) {
1273
1683
  if (currentCtx === void 0) { currentCtx = null; }
1274
1684
  var itemCtx = currentCtx;
1275
1685
  if (!itemCtx) {
1276
- var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
1686
+ var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
1277
1687
  if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1278
1688
  itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1279
1689
  }
@@ -1282,8 +1692,8 @@
1282
1692
  }
1283
1693
  }
1284
1694
  return itemCtx;
1285
- };
1286
- _self._baseTelInit = function (config, core, extensions, pluginChain) {
1695
+ }
1696
+ function _setDefaults(config, core, pluginChain) {
1287
1697
  if (config) {
1288
1698
  setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1289
1699
  }
@@ -1295,70 +1705,133 @@
1295
1705
  nextPlugin = _nextPlugin[strGetPlugin]();
1296
1706
  }
1297
1707
  _self.core = core;
1298
- _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1299
- _isinitialized = true;
1300
- };
1708
+ _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1709
+ }
1710
+ function _initDefaults() {
1711
+ _isinitialized = false;
1712
+ _self.core = null;
1713
+ _rootCtx = null;
1714
+ _nextPlugin = null;
1715
+ _hooks = [];
1716
+ _unloadHandlerContainer = createUnloadHandlerContainer();
1717
+ }
1301
1718
  }
1302
- BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
1303
- this._baseTelInit(config, core, extensions, pluginChain);
1304
- };
1305
1719
  return BaseTelemetryPlugin;
1306
1720
  }());
1307
1721
 
1308
- var UInt32Mask = 0x100000000;
1309
- var MaxUInt32 = 0xffffffff;
1310
- var _mwcSeeded = false;
1311
- var _mwcW = 123456789;
1312
- var _mwcZ = 987654321;
1313
- function _mwcSeed(seedValue) {
1314
- if (seedValue < 0) {
1315
- seedValue >>>= 0;
1722
+ var strOnPrefix = "on";
1723
+ var strAttachEvent = "attachEvent";
1724
+ var strAddEventHelper = "addEventListener";
1725
+ var strEvents = "events";
1726
+ createUniqueNamespace("aiEvtPageHide");
1727
+ createUniqueNamespace("aiEvtPageShow");
1728
+ var rRemoveEmptyNs = /\.[\.]+/g;
1729
+ var rRemoveTrailingEmptyNs = /[\.]+$/;
1730
+ var _guid = 1;
1731
+ var elmNodeData = createElmNodeData("events");
1732
+ var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
1733
+ function _normalizeNamespace(name) {
1734
+ if (name && name.replace) {
1735
+ return name.replace(/^\s*\.*|\.*\s*$/g, "");
1736
+ }
1737
+ return name;
1738
+ }
1739
+ function _getEvtNamespace(eventName, evtNamespace) {
1740
+ if (evtNamespace) {
1741
+ var theNamespace_1 = "";
1742
+ if (isArray(evtNamespace)) {
1743
+ theNamespace_1 = "";
1744
+ arrForEach(evtNamespace, function (name) {
1745
+ name = _normalizeNamespace(name);
1746
+ if (name) {
1747
+ if (name[0] !== ".") {
1748
+ name = "." + name;
1749
+ }
1750
+ theNamespace_1 += name;
1751
+ }
1752
+ });
1753
+ }
1754
+ else {
1755
+ theNamespace_1 = _normalizeNamespace(evtNamespace);
1756
+ }
1757
+ if (theNamespace_1) {
1758
+ if (theNamespace_1[0] !== ".") {
1759
+ theNamespace_1 = "." + theNamespace_1;
1760
+ }
1761
+ eventName = (eventName || "") + theNamespace_1;
1762
+ }
1316
1763
  }
1317
- _mwcW = (123456789 + seedValue) & MaxUInt32;
1318
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
1319
- _mwcSeeded = true;
1764
+ var parsedEvent = (eventNamespace.exec(eventName || "") || []);
1765
+ return {
1766
+ type: parsedEvent[1],
1767
+ ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
1768
+ };
1320
1769
  }
1321
- function _autoSeedMwc() {
1322
- try {
1323
- var now = dateNow() & 0x7fffffff;
1324
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1325
- }
1326
- catch (e) {
1770
+ function _getRegisteredEvents(target, evtName, addDefault) {
1771
+ if (addDefault === void 0) { addDefault = true; }
1772
+ var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
1773
+ var registeredEvents = aiEvts[evtName];
1774
+ if (!registeredEvents) {
1775
+ registeredEvents = aiEvts[evtName] = [];
1327
1776
  }
1777
+ return registeredEvents;
1328
1778
  }
1329
- function random32(signed) {
1330
- var value;
1331
- var c = getCrypto() || getMsCrypto();
1332
- if (c && c.getRandomValues) {
1333
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1779
+ function _doAttach(obj, evtName, handlerRef, useCapture) {
1780
+ var result = false;
1781
+ if (obj && evtName && evtName.type && handlerRef) {
1782
+ if (obj[strAddEventHelper]) {
1783
+ obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
1784
+ result = true;
1785
+ }
1786
+ else if (obj[strAttachEvent]) {
1787
+ obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
1788
+ result = true;
1789
+ }
1334
1790
  }
1335
- else if (isIE()) {
1336
- if (!_mwcSeeded) {
1337
- _autoSeedMwc();
1791
+ return result;
1792
+ }
1793
+ function mergeEvtNamespace(theNamespace, namespaces) {
1794
+ var newNamespaces;
1795
+ if (namespaces) {
1796
+ if (isArray(namespaces)) {
1797
+ newNamespaces = [theNamespace].concat(namespaces);
1338
1798
  }
1339
- value = mwcRandom32() & MaxUInt32;
1799
+ else {
1800
+ newNamespaces = [theNamespace, namespaces];
1801
+ }
1802
+ newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
1340
1803
  }
1341
1804
  else {
1342
- value = Math.floor((UInt32Mask * Math.random()) | 0);
1343
- }
1344
- if (!signed) {
1345
- value >>>= 0;
1805
+ newNamespaces = theNamespace;
1346
1806
  }
1347
- return value;
1807
+ return newNamespaces;
1348
1808
  }
1349
- function mwcRandom32(signed) {
1350
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1351
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1352
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1353
- if (!signed) {
1354
- value >>>= 0;
1809
+ function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
1810
+ if (useCapture === void 0) { useCapture = false; }
1811
+ var result = false;
1812
+ if (target) {
1813
+ try {
1814
+ var evtName = _getEvtNamespace(eventName, evtNamespace);
1815
+ result = _doAttach(target, evtName, handlerRef, useCapture);
1816
+ if (result && elmNodeData.accept(target)) {
1817
+ var registeredEvent = {
1818
+ guid: _guid++,
1819
+ evtName: evtName,
1820
+ handler: handlerRef,
1821
+ capture: useCapture
1822
+ };
1823
+ _getRegisteredEvents(target, evtName.type).push(registeredEvent);
1824
+ }
1825
+ }
1826
+ catch (e) {
1827
+ }
1355
1828
  }
1356
- return value;
1829
+ return result;
1357
1830
  }
1358
1831
 
1359
1832
  function generateW3CId() {
1360
1833
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1361
- var oct = "", tmp;
1834
+ var oct = strEmpty$1, tmp;
1362
1835
  for (var a = 0; a < 4; a++) {
1363
1836
  tmp = random32();
1364
1837
  oct +=
@@ -1433,6 +1906,7 @@
1433
1906
  };
1434
1907
  var hookCtx = [];
1435
1908
  var cbArgs = _createArgs([funcArgs], orgArgs);
1909
+ funcArgs.evt = getGlobalInst("event");
1436
1910
  function _createArgs(target, theArgs) {
1437
1911
  _arrLoop(theArgs, function (arg) {
1438
1912
  target.push(arg);
@@ -1465,7 +1939,7 @@
1465
1939
  owner = target;
1466
1940
  }
1467
1941
  else if (checkPrototype) {
1468
- owner = _getOwner(_getObjProto(target), name, false);
1942
+ owner = _getOwner(_getObjProto$1(target), name, false);
1469
1943
  }
1470
1944
  }
1471
1945
  return owner;
@@ -1549,7 +2023,7 @@
1549
2023
  name = strTrim(name.toString());
1550
2024
  if (name.length > 150 ) {
1551
2025
  nameTrunc = name.substring(0, 150 );
1552
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2026
+ _throwInternal(logger, 2 , 57 , "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1553
2027
  }
1554
2028
  }
1555
2029
  return nameTrunc || name;
@@ -1562,13 +2036,13 @@
1562
2036
  value = strTrim(value);
1563
2037
  if (value.toString().length > maxLength) {
1564
2038
  valueTrunc = value.toString().substring(0, maxLength);
1565
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2039
+ _throwInternal(logger, 2 , 61 , "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1566
2040
  }
1567
2041
  }
1568
2042
  return valueTrunc || value;
1569
2043
  }
1570
2044
  function dataSanitizeUrl(logger, url) {
1571
- return dataSanitizeInput(logger, url, 2048 , _InternalMessageId.UrlTooLong);
2045
+ return dataSanitizeInput(logger, url, 2048 , 66 );
1572
2046
  }
1573
2047
  function dataSanitizeProperties(logger, properties) {
1574
2048
  if (properties) {
@@ -1579,7 +2053,7 @@
1579
2053
  value = getJSON().stringify(value);
1580
2054
  }
1581
2055
  catch (e) {
1582
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2056
+ _throwInternal(logger, 2 , 49 , "custom property is not valid", { exception: e }, true);
1583
2057
  }
1584
2058
  }
1585
2059
  value = dataSanitizeString(logger, value, 8192 );
@@ -1607,7 +2081,7 @@
1607
2081
  input = strTrim(input);
1608
2082
  if (input.length > maxLength) {
1609
2083
  inputTrunc = input.substring(0, maxLength);
1610
- logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
2084
+ _throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1611
2085
  }
1612
2086
  }
1613
2087
  return inputTrunc || input;
@@ -1617,39 +2091,28 @@
1617
2091
  return s.substr(s.length - 3);
1618
2092
  }
1619
2093
 
2094
+ var strEmpty = "";
1620
2095
  function msToTimeSpan(totalms) {
1621
2096
  if (isNaN(totalms) || totalms < 0) {
1622
2097
  totalms = 0;
1623
2098
  }
1624
2099
  totalms = Math.round(totalms);
1625
- var ms = "" + totalms % 1000;
1626
- var sec = "" + Math.floor(totalms / 1000) % 60;
1627
- var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
1628
- var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2100
+ var ms = strEmpty + totalms % 1000;
2101
+ var sec = strEmpty + Math.floor(totalms / 1000) % 60;
2102
+ var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
2103
+ var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
1629
2104
  var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
1630
2105
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
1631
2106
  sec = sec.length < 2 ? "0" + sec : sec;
1632
2107
  min = min.length < 2 ? "0" + min : min;
1633
2108
  hour = hour.length < 2 ? "0" + hour : hour;
1634
- return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
2109
+ return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
1635
2110
  }
1636
2111
 
1637
2112
  var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
1638
2113
  var strNotSpecified = "not_specified";
1639
2114
  var strIkey = "iKey";
1640
2115
 
1641
- var StorageType;
1642
- (function (StorageType) {
1643
- StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
1644
- StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
1645
- })(StorageType || (StorageType = {}));
1646
- var DistributedTracingModes;
1647
- (function (DistributedTracingModes) {
1648
- DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
1649
- DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
1650
- DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
1651
- })(DistributedTracingModes || (DistributedTracingModes = {}));
1652
-
1653
2116
  var _document = getDocument() || {};
1654
2117
  var _htmlAnchorIdx = 0;
1655
2118
  var _htmlAnchorElement = [null, null, null, null, null];
@@ -1835,22 +2298,10 @@
1835
2298
  return result;
1836
2299
  }
1837
2300
 
1838
- var RemoteDependencyData$1 = /** @class */ (function () {
1839
- function RemoteDependencyData() {
1840
- this.ver = 2;
1841
- this.success = true;
1842
- this.properties = {};
1843
- this.measurements = {};
1844
- }
1845
- return RemoteDependencyData;
1846
- }());
1847
-
1848
- var RemoteDependencyData = /** @class */ (function (_super) {
1849
- __extendsFn(RemoteDependencyData, _super);
2301
+ var RemoteDependencyData = /** @class */ (function () {
1850
2302
  function RemoteDependencyData(logger, id, absoluteUrl, commandName, value, success, resultCode, method, requestAPI, correlationContext, properties, measurements) {
1851
2303
  if (requestAPI === void 0) { requestAPI = "Ajax"; }
1852
- var _this = _super.call(this) || this;
1853
- _this.aiDataContract = {
2304
+ this.aiDataContract = {
1854
2305
  id: 1 ,
1855
2306
  ver: 1 ,
1856
2307
  name: 0 ,
@@ -1873,26 +2324,27 @@
1873
2324
  commandName: 0 ,
1874
2325
  dependencyTypeName: 0
1875
2326
  };
1876
- _this.id = id;
1877
- _this.duration = msToTimeSpan(value);
1878
- _this.success = success;
1879
- _this.resultCode = resultCode + "";
1880
- _this.type = dataSanitizeString(logger, requestAPI);
2327
+ var _self = this;
2328
+ _self.ver = 2;
2329
+ _self.id = id;
2330
+ _self.duration = msToTimeSpan(value);
2331
+ _self.success = success;
2332
+ _self.resultCode = resultCode + "";
2333
+ _self.type = dataSanitizeString(logger, requestAPI);
1881
2334
  var dependencyFields = AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName);
1882
- _this.data = dataSanitizeUrl(logger, commandName) || dependencyFields.data;
1883
- _this.target = dataSanitizeString(logger, dependencyFields.target);
2335
+ _self.data = dataSanitizeUrl(logger, commandName) || dependencyFields.data;
2336
+ _self.target = dataSanitizeString(logger, dependencyFields.target);
1884
2337
  if (correlationContext) {
1885
- _this.target = "".concat(_this.target, " | ").concat(correlationContext);
2338
+ _self.target = "".concat(_self.target, " | ").concat(correlationContext);
1886
2339
  }
1887
- _this.name = dataSanitizeString(logger, dependencyFields.name);
1888
- _this.properties = dataSanitizeProperties(logger, properties);
1889
- _this.measurements = dataSanitizeMeasurements(logger, measurements);
1890
- return _this;
2340
+ _self.name = dataSanitizeString(logger, dependencyFields.name);
2341
+ _self.properties = dataSanitizeProperties(logger, properties);
2342
+ _self.measurements = dataSanitizeMeasurements(logger, measurements);
1891
2343
  }
1892
2344
  RemoteDependencyData.envelopeType = "Microsoft.ApplicationInsights.{0}.RemoteDependency";
1893
2345
  RemoteDependencyData.dataType = "RemoteDependencyData";
1894
2346
  return RemoteDependencyData;
1895
- }(RemoteDependencyData$1));
2347
+ }());
1896
2348
 
1897
2349
  var TelemetryItemCreator = /** @class */ (function () {
1898
2350
  function TelemetryItemCreator() {
@@ -2179,6 +2631,7 @@
2179
2631
  var strAjaxData = "ajaxData";
2180
2632
  var strThrowInternal = "throwInternal";
2181
2633
  var strFetch = "fetch";
2634
+ var strTrackDependencyDataInternal = "trackDependencyDataInternal";
2182
2635
  var _markCount = 0;
2183
2636
  function _supportsFetch() {
2184
2637
  var _global = getGlobal();
@@ -2212,7 +2665,7 @@
2212
2665
  }
2213
2666
  catch (e) {
2214
2667
  result = false;
2215
- _throwInternalCritical(ajaxMonitorInstance, _InternalMessageId.FailedMonitorAjaxOpen, "Failed to enable XMLHttpRequest monitoring, extension is not supported", {
2668
+ _throwInternalCritical(ajaxMonitorInstance, 15 , "Failed to enable XMLHttpRequest monitoring, extension is not supported", {
2216
2669
  exception: dumpObj(e)
2217
2670
  });
2218
2671
  }
@@ -2233,10 +2686,10 @@
2233
2686
  return result;
2234
2687
  }
2235
2688
  function _throwInternalCritical(ajaxMonitorInstance, msgId, message, properties, isUserAct) {
2236
- ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.CRITICAL, msgId, message, properties, isUserAct);
2689
+ ajaxMonitorInstance[strDiagLog]()[strThrowInternal](1 , msgId, message, properties, isUserAct);
2237
2690
  }
2238
2691
  function _throwInternalWarning(ajaxMonitorInstance, msgId, message, properties, isUserAct) {
2239
- ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.WARNING, msgId, message, properties, isUserAct);
2692
+ ajaxMonitorInstance[strDiagLog]()[strThrowInternal](2 , msgId, message, properties, isUserAct);
2240
2693
  }
2241
2694
  function _createErrorCallbackFunc(ajaxMonitorInstance, internalMessage, message) {
2242
2695
  return function (args) {
@@ -2258,80 +2711,41 @@
2258
2711
  var _this = _super.call(this) || this;
2259
2712
  _this.identifier = AjaxMonitor.identifier;
2260
2713
  _this.priority = 120;
2261
- var strTrackDependencyDataInternal = "trackDependencyDataInternal";
2262
- var location = getLocation();
2263
- var _fetchInitialized = false;
2264
- var _xhrInitialized = false;
2265
- var _currentWindowHost = location && location.host && location.host.toLowerCase();
2266
- var _config = AjaxMonitor.getEmptyConfig();
2267
- var _enableRequestHeaderTracking = false;
2268
- var _enableAjaxErrorStatusText = false;
2269
- var _trackAjaxAttempts = 0;
2714
+ var _fetchInitialized;
2715
+ var _xhrInitialized;
2716
+ var _currentWindowHost;
2717
+ var _config;
2718
+ var _enableRequestHeaderTracking;
2719
+ var _enableAjaxErrorStatusText;
2720
+ var _trackAjaxAttempts;
2270
2721
  var _context;
2271
2722
  var _isUsingW3CHeaders;
2272
2723
  var _isUsingAIHeaders;
2273
2724
  var _markPrefix;
2274
- var _enableAjaxPerfTracking = false;
2275
- var _maxAjaxCallsPerView = 0;
2276
- var _enableResponseHeaderTracking = false;
2277
- var _hooks = [];
2278
- var _disabledUrls = {};
2725
+ var _enableAjaxPerfTracking;
2726
+ var _maxAjaxCallsPerView;
2727
+ var _enableResponseHeaderTracking;
2728
+ var _disabledUrls;
2729
+ var _disableAjaxTracking;
2730
+ var _disableFetchTracking;
2279
2731
  var _excludeRequestFromAutoTrackingPatterns;
2280
2732
  var _addRequestContext;
2281
- dynamicProto(AjaxMonitor, _this, function (_self, base) {
2733
+ var _evtNamespace;
2734
+ dynamicProto(AjaxMonitor, _this, function (_self, _base) {
2735
+ var _addHook = _base._addHook;
2736
+ _initDefaults();
2282
2737
  _self.initialize = function (config, core, extensions, pluginChain) {
2283
2738
  if (!_self.isInitialized()) {
2284
- base.initialize(config, core, extensions, pluginChain);
2285
- var ctx_1 = _self._getTelCtx();
2286
- var defaultConfig = AjaxMonitor.getDefaultConfig();
2287
- objForEachKey(defaultConfig, function (field, value) {
2288
- _config[field] = ctx_1.getConfig(AjaxMonitor.identifier, field, value);
2289
- });
2290
- var distributedTracingMode = _config.distributedTracingMode;
2291
- _enableRequestHeaderTracking = _config.enableRequestHeaderTracking;
2292
- _enableAjaxErrorStatusText = _config.enableAjaxErrorStatusText;
2293
- _enableAjaxPerfTracking = _config.enableAjaxPerfTracking;
2294
- _maxAjaxCallsPerView = _config.maxAjaxCallsPerView;
2295
- _enableResponseHeaderTracking = _config.enableResponseHeaderTracking;
2296
- _excludeRequestFromAutoTrackingPatterns = _config.excludeRequestFromAutoTrackingPatterns;
2297
- _addRequestContext = _config.addRequestContext;
2298
- _isUsingAIHeaders = distributedTracingMode === DistributedTracingModes.AI || distributedTracingMode === DistributedTracingModes.AI_AND_W3C;
2299
- _isUsingW3CHeaders = distributedTracingMode === DistributedTracingModes.AI_AND_W3C || distributedTracingMode === DistributedTracingModes.W3C;
2300
- if (_enableAjaxPerfTracking) {
2301
- var iKey = config.instrumentationKey || "unkwn";
2302
- if (iKey.length > 5) {
2303
- _markPrefix = AJAX_MONITOR_PREFIX + iKey.substring(iKey.length - 5) + ".";
2304
- }
2305
- else {
2306
- _markPrefix = AJAX_MONITOR_PREFIX + iKey + ".";
2307
- }
2308
- }
2309
- if (_config.disableAjaxTracking === false) {
2310
- _instrumentXhr();
2311
- }
2739
+ _base.initialize(config, core, extensions, pluginChain);
2740
+ _evtNamespace = mergeEvtNamespace(createUniqueNamespace("ajax"), core && core.evtNamespace && core.evtNamespace());
2741
+ _populateDefaults(config);
2742
+ _instrumentXhr();
2312
2743
  _instrumentFetch();
2313
- if (extensions.length > 0 && extensions) {
2314
- var propExt = void 0, extIx = 0;
2315
- while (!propExt && extIx < extensions.length) {
2316
- if (extensions[extIx] && extensions[extIx].identifier === PropertiesPluginIdentifier) {
2317
- propExt = extensions[extIx];
2318
- }
2319
- extIx++;
2320
- }
2321
- if (propExt) {
2322
- _context = propExt.context;
2323
- }
2324
- }
2744
+ _populateContext();
2325
2745
  }
2326
2746
  };
2327
- _self.teardown = function () {
2328
- arrForEach(_hooks, function (fn) {
2329
- fn.rm();
2330
- });
2331
- _hooks = [];
2332
- _fetchInitialized = false;
2333
- _xhrInitialized = false;
2334
- _self.setInitialized(false);
2747
+ _self._doTeardown = function () {
2748
+ _initDefaults();
2335
2749
  };
2336
2750
  _self.trackDependencyData = function (dependency, properties) {
2337
2751
  _self[strTrackDependencyDataInternal](dependency, properties);
@@ -2398,8 +2812,8 @@
2398
2812
  };
2399
2813
  _self[strTrackDependencyDataInternal] = function (dependency, properties, systemProperties) {
2400
2814
  if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) {
2401
- if ((_config.distributedTracingMode === DistributedTracingModes.W3C
2402
- || _config.distributedTracingMode === DistributedTracingModes.AI_AND_W3C)
2815
+ if ((_config.distributedTracingMode === 2
2816
+ || _config.distributedTracingMode === 1 )
2403
2817
  && typeof dependency.id === "string" && dependency.id[dependency.id.length - 1] !== ".") {
2404
2818
  dependency.id += ".";
2405
2819
  }
@@ -2410,10 +2824,68 @@
2410
2824
  _self.core.track(item);
2411
2825
  }
2412
2826
  else if (_trackAjaxAttempts === _maxAjaxCallsPerView) {
2413
- _throwInternalCritical(_self, _InternalMessageId.MaxAjaxPerPVExceeded, "Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.", true);
2827
+ _throwInternalCritical(_self, 55 , "Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.", true);
2414
2828
  }
2415
2829
  ++_trackAjaxAttempts;
2416
2830
  };
2831
+ function _initDefaults() {
2832
+ var location = getLocation();
2833
+ _fetchInitialized = false;
2834
+ _xhrInitialized = false;
2835
+ _currentWindowHost = location && location.host && location.host.toLowerCase();
2836
+ _config = AjaxMonitor.getEmptyConfig();
2837
+ _enableRequestHeaderTracking = false;
2838
+ _enableAjaxErrorStatusText = false;
2839
+ _trackAjaxAttempts = 0;
2840
+ _context = null;
2841
+ _isUsingW3CHeaders = false;
2842
+ _isUsingAIHeaders = false;
2843
+ _markPrefix = null;
2844
+ _enableAjaxPerfTracking = false;
2845
+ _maxAjaxCallsPerView = 0;
2846
+ _enableResponseHeaderTracking = false;
2847
+ _disabledUrls = {};
2848
+ _disableAjaxTracking = false;
2849
+ _disableFetchTracking = true;
2850
+ _excludeRequestFromAutoTrackingPatterns = null;
2851
+ _addRequestContext = null;
2852
+ _evtNamespace = null;
2853
+ }
2854
+ function _populateDefaults(config) {
2855
+ var ctx = createProcessTelemetryContext(null, config, _self.core);
2856
+ _config = AjaxMonitor.getEmptyConfig();
2857
+ var defaultConfig = AjaxMonitor.getDefaultConfig();
2858
+ objForEachKey(defaultConfig, function (field, value) {
2859
+ _config[field] = ctx.getConfig(AjaxMonitor.identifier, field, value);
2860
+ });
2861
+ var distributedTracingMode = _config.distributedTracingMode;
2862
+ _enableRequestHeaderTracking = _config.enableRequestHeaderTracking;
2863
+ _enableAjaxErrorStatusText = _config.enableAjaxErrorStatusText;
2864
+ _enableAjaxPerfTracking = _config.enableAjaxPerfTracking;
2865
+ _maxAjaxCallsPerView = _config.maxAjaxCallsPerView;
2866
+ _enableResponseHeaderTracking = _config.enableResponseHeaderTracking;
2867
+ _excludeRequestFromAutoTrackingPatterns = _config.excludeRequestFromAutoTrackingPatterns;
2868
+ _addRequestContext = _config.addRequestContext;
2869
+ _isUsingAIHeaders = distributedTracingMode === 0 || distributedTracingMode === 1 ;
2870
+ _isUsingW3CHeaders = distributedTracingMode === 1 || distributedTracingMode === 2 ;
2871
+ if (_enableAjaxPerfTracking) {
2872
+ var iKey = config.instrumentationKey || "unkwn";
2873
+ if (iKey.length > 5) {
2874
+ _markPrefix = AJAX_MONITOR_PREFIX + iKey.substring(iKey.length - 5) + ".";
2875
+ }
2876
+ else {
2877
+ _markPrefix = AJAX_MONITOR_PREFIX + iKey + ".";
2878
+ }
2879
+ }
2880
+ _disableAjaxTracking = !!_config.disableAjaxTracking;
2881
+ _disableFetchTracking = !!_config.disableFetchTracking;
2882
+ }
2883
+ function _populateContext() {
2884
+ var propExt = _self.core.getPlugin(PropertiesPluginIdentifier);
2885
+ if (propExt) {
2886
+ _context = propExt.plugin.context;
2887
+ }
2888
+ }
2417
2889
  function _canIncludeHeaders(header) {
2418
2890
  var rlt = true;
2419
2891
  if (header || _config.ignoreHeaders) {
@@ -2433,11 +2905,12 @@
2433
2905
  }
2434
2906
  var global = getGlobal();
2435
2907
  var isPolyfill = fetch.polyfill;
2436
- if (_config.disableFetchTracking === false) {
2437
- _hooks.push(InstrumentFunc(global, strFetch, {
2908
+ if (!_disableFetchTracking && !_fetchInitialized) {
2909
+ _addHook(InstrumentFunc(global, strFetch, {
2910
+ ns: _evtNamespace,
2438
2911
  req: function (callDetails, input, init) {
2439
2912
  var fetchData;
2440
- if (_fetchInitialized &&
2913
+ if (!_disableFetchTracking && _fetchInitialized &&
2441
2914
  !_isDisabledRequest(null, input, init) &&
2442
2915
  !(isPolyfill && _xhrInitialized)) {
2443
2916
  var ctx = callDetails.ctx();
@@ -2450,39 +2923,42 @@
2450
2923
  }
2451
2924
  },
2452
2925
  rsp: function (callDetails, input) {
2453
- var fetchData = callDetails.ctx().data;
2454
- if (fetchData) {
2455
- callDetails.rslt = callDetails.rslt.then(function (response) {
2456
- _reportFetchMetrics(callDetails, (response || {}).status, input, response, fetchData, function () {
2457
- var ajaxResponse = {
2458
- statusText: response.statusText,
2459
- headerMap: null,
2460
- correlationContext: _getFetchCorrelationContext(response)
2461
- };
2462
- if (_enableResponseHeaderTracking) {
2463
- var responseHeaderMap_1 = {};
2464
- response.headers.forEach(function (value, name) {
2465
- if (_canIncludeHeaders(name)) {
2466
- responseHeaderMap_1[name] = value;
2467
- }
2468
- });
2469
- ajaxResponse.headerMap = responseHeaderMap_1;
2470
- }
2471
- return ajaxResponse;
2926
+ if (!_disableFetchTracking) {
2927
+ var fetchData_1 = callDetails.ctx().data;
2928
+ if (fetchData_1) {
2929
+ callDetails.rslt = callDetails.rslt.then(function (response) {
2930
+ _reportFetchMetrics(callDetails, (response || {}).status, input, response, fetchData_1, function () {
2931
+ var ajaxResponse = {
2932
+ statusText: response.statusText,
2933
+ headerMap: null,
2934
+ correlationContext: _getFetchCorrelationContext(response)
2935
+ };
2936
+ if (_enableResponseHeaderTracking) {
2937
+ var responseHeaderMap_1 = {};
2938
+ response.headers.forEach(function (value, name) {
2939
+ if (_canIncludeHeaders(name)) {
2940
+ responseHeaderMap_1[name] = value;
2941
+ }
2942
+ });
2943
+ ajaxResponse.headerMap = responseHeaderMap_1;
2944
+ }
2945
+ return ajaxResponse;
2946
+ });
2947
+ return response;
2948
+ })["catch"](function (reason) {
2949
+ _reportFetchMetrics(callDetails, 0, input, null, fetchData_1, null, { error: reason.message });
2950
+ throw reason;
2472
2951
  });
2473
- return response;
2474
- })["catch"](function (reason) {
2475
- _reportFetchMetrics(callDetails, 0, input, null, fetchData, null, { error: reason.message });
2476
- throw reason;
2477
- });
2952
+ }
2478
2953
  }
2479
2954
  },
2480
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxOpen, "Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.")
2955
+ hkErr: _createErrorCallbackFunc(_self, 15 , "Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.")
2481
2956
  }));
2482
2957
  _fetchInitialized = true;
2483
2958
  }
2484
2959
  else if (isPolyfill) {
2485
- _hooks.push(InstrumentFunc(global, strFetch, {
2960
+ _addHook(InstrumentFunc(global, strFetch, {
2961
+ ns: _evtNamespace,
2486
2962
  req: function (callDetails, input, init) {
2487
2963
  _isDisabledRequest(null, input, init);
2488
2964
  }
@@ -2493,58 +2969,68 @@
2493
2969
  }
2494
2970
  }
2495
2971
  function _hookProto(target, funcName, callbacks) {
2496
- _hooks.push(InstrumentProto(target, funcName, callbacks));
2972
+ _addHook(InstrumentProto(target, funcName, callbacks));
2497
2973
  }
2498
2974
  function _instrumentXhr() {
2499
- if (_supportsAjaxMonitoring(_self) && !_xhrInitialized) {
2975
+ if (_supportsAjaxMonitoring(_self) && !_disableAjaxTracking && !_xhrInitialized) {
2500
2976
  _hookProto(XMLHttpRequest, "open", {
2977
+ ns: _evtNamespace,
2501
2978
  req: function (args, method, url, async) {
2502
- var xhr = args.inst;
2503
- var ajaxData = xhr[strAjaxData];
2504
- if (!_isDisabledRequest(xhr, url) && _isMonitoredXhrInstance(xhr, true)) {
2505
- if (!ajaxData || !ajaxData.xhrMonitoringState.openDone) {
2506
- _openHandler(xhr, method, url, async);
2979
+ if (!_disableAjaxTracking) {
2980
+ var xhr = args.inst;
2981
+ var ajaxData = xhr[strAjaxData];
2982
+ if (!_isDisabledRequest(xhr, url) && _isMonitoredXhrInstance(xhr, true)) {
2983
+ if (!ajaxData || !ajaxData.xhrMonitoringState.openDone) {
2984
+ _openHandler(xhr, method, url, async);
2985
+ }
2986
+ _attachToOnReadyStateChange(xhr);
2507
2987
  }
2508
- _attachToOnReadyStateChange(xhr);
2509
2988
  }
2510
2989
  },
2511
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxOpen, "Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.")
2990
+ hkErr: _createErrorCallbackFunc(_self, 15 , "Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.")
2512
2991
  });
2513
2992
  _hookProto(XMLHttpRequest, "send", {
2993
+ ns: _evtNamespace,
2514
2994
  req: function (args, context) {
2515
- var xhr = args.inst;
2516
- var ajaxData = xhr[strAjaxData];
2517
- if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.sendDone) {
2518
- _createMarkId("xhr", ajaxData);
2519
- ajaxData.requestSentTime = dateTimeUtilsNow();
2520
- _self.includeCorrelationHeaders(ajaxData, undefined, undefined, xhr);
2521
- ajaxData.xhrMonitoringState.sendDone = true;
2995
+ if (!_disableAjaxTracking) {
2996
+ var xhr = args.inst;
2997
+ var ajaxData = xhr[strAjaxData];
2998
+ if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.sendDone) {
2999
+ _createMarkId("xhr", ajaxData);
3000
+ ajaxData.requestSentTime = dateTimeUtilsNow();
3001
+ _self.includeCorrelationHeaders(ajaxData, undefined, undefined, xhr);
3002
+ ajaxData.xhrMonitoringState.sendDone = true;
3003
+ }
2522
3004
  }
2523
3005
  },
2524
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSend, "Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.")
3006
+ hkErr: _createErrorCallbackFunc(_self, 17 , "Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.")
2525
3007
  });
2526
3008
  _hookProto(XMLHttpRequest, "abort", {
3009
+ ns: _evtNamespace,
2527
3010
  req: function (args) {
2528
- var xhr = args.inst;
2529
- var ajaxData = xhr[strAjaxData];
2530
- if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.abortDone) {
2531
- ajaxData.aborted = 1;
2532
- ajaxData.xhrMonitoringState.abortDone = true;
3011
+ if (!_disableAjaxTracking) {
3012
+ var xhr = args.inst;
3013
+ var ajaxData = xhr[strAjaxData];
3014
+ if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.abortDone) {
3015
+ ajaxData.aborted = 1;
3016
+ ajaxData.xhrMonitoringState.abortDone = true;
3017
+ }
2533
3018
  }
2534
3019
  },
2535
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxAbort, "Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.")
3020
+ hkErr: _createErrorCallbackFunc(_self, 13 , "Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.")
2536
3021
  });
2537
- if (_enableRequestHeaderTracking) {
2538
- _hookProto(XMLHttpRequest, "setRequestHeader", {
2539
- req: function (args, header, value) {
3022
+ _hookProto(XMLHttpRequest, "setRequestHeader", {
3023
+ ns: _evtNamespace,
3024
+ req: function (args, header, value) {
3025
+ if (!_disableAjaxTracking && _enableRequestHeaderTracking) {
2540
3026
  var xhr = args.inst;
2541
3027
  if (_isMonitoredXhrInstance(xhr) && _canIncludeHeaders(header)) {
2542
3028
  xhr[strAjaxData].requestHeaders[header] = value;
2543
3029
  }
2544
- },
2545
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSetRequestHeader, "Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.")
2546
- });
2547
- }
3030
+ }
3031
+ },
3032
+ hkErr: _createErrorCallbackFunc(_self, 71 , "Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.")
3033
+ });
2548
3034
  _xhrInitialized = true;
2549
3035
  }
2550
3036
  }
@@ -2615,7 +3101,7 @@
2615
3101
  xhr[strAjaxData] = ajaxData;
2616
3102
  }
2617
3103
  function _attachToOnReadyStateChange(xhr) {
2618
- xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = attachEvent(xhr, "readystatechange", function () {
3104
+ xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = eventOn(xhr, "readystatechange", function () {
2619
3105
  try {
2620
3106
  if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr)) {
2621
3107
  _onAjaxComplete(xhr);
@@ -2624,13 +3110,13 @@
2624
3110
  catch (e) {
2625
3111
  var exceptionText = dumpObj(e);
2626
3112
  if (!exceptionText || _indexOf(exceptionText.toLowerCase(), "c00c023f") === -1) {
2627
- _throwInternalCritical(_self, _InternalMessageId.FailedMonitorAjaxRSC, "Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.", {
3113
+ _throwInternalCritical(_self, 16 , "Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.", {
2628
3114
  ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),
2629
3115
  exception: exceptionText
2630
3116
  });
2631
3117
  }
2632
3118
  }
2633
- });
3119
+ }, _evtNamespace);
2634
3120
  }
2635
3121
  function _getResponseText(xhr) {
2636
3122
  try {
@@ -2653,7 +3139,7 @@
2653
3139
  if (e) {
2654
3140
  errorProps["exception"] = dumpObj(e);
2655
3141
  }
2656
- _throwInternalWarning(_self, _InternalMessageId.FailedMonitorAjaxDur, "Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.", errorProps);
3142
+ _throwInternalWarning(_self, 14 , "Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.", errorProps);
2657
3143
  }
2658
3144
  _findPerfResourceEntry("xmlhttprequest", ajaxData, function () {
2659
3145
  try {
@@ -2691,7 +3177,7 @@
2691
3177
  }
2692
3178
  }
2693
3179
  catch (e) {
2694
- _throwInternalWarning(_self, _InternalMessageId.FailedAddingCustomDefinedRequestContext, "Failed to add custom defined request context as configured call back may missing a null check.");
3180
+ _throwInternalWarning(_self, 104 , "Failed to add custom defined request context as configured call back may missing a null check.");
2695
3181
  }
2696
3182
  if (dependency) {
2697
3183
  if (properties !== undefined) {
@@ -2729,7 +3215,7 @@
2729
3215
  }
2730
3216
  }
2731
3217
  catch (e) {
2732
- _throwInternalWarning(_self, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.", {
3218
+ _throwInternalWarning(_self, 18 , "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.", {
2733
3219
  ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),
2734
3220
  exception: dumpObj(e)
2735
3221
  });
@@ -2846,7 +3332,7 @@
2846
3332
  }
2847
3333
  }
2848
3334
  catch (e) {
2849
- _throwInternalCritical(_self, _InternalMessageId.FailedMonitorAjaxOpen, "Failed to grab failed fetch diagnostics message", { exception: dumpObj(e) });
3335
+ _throwInternalCritical(_self, 15 , "Failed to grab failed fetch diagnostics message", { exception: dumpObj(e) });
2850
3336
  }
2851
3337
  return result;
2852
3338
  }
@@ -2873,7 +3359,7 @@
2873
3359
  }
2874
3360
  }
2875
3361
  catch (e) {
2876
- _throwInternalWarning(_self, _InternalMessageId.FailedAddingCustomDefinedRequestContext, "Failed to add custom defined request context as configured call back may missing a null check.");
3362
+ _throwInternalWarning(_self, 104 , "Failed to add custom defined request context as configured call back may missing a null check.");
2877
3363
  }
2878
3364
  if (dependency) {
2879
3365
  if (properties !== undefined) {
@@ -2882,13 +3368,13 @@
2882
3368
  _self[strTrackDependencyDataInternal](dependency);
2883
3369
  }
2884
3370
  else {
2885
- _reportFetchError(_InternalMessageId.FailedMonitorAjaxDur, null, {
3371
+ _reportFetchError(14 , null, {
2886
3372
  requestSentTime: ajaxData.requestSentTime,
2887
3373
  responseFinishedTime: ajaxData.responseFinishedTime
2888
3374
  });
2889
3375
  }
2890
3376
  }, function (e) {
2891
- _reportFetchError(_InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, e, null);
3377
+ _reportFetchError(18 , e, null);
2892
3378
  });
2893
3379
  }
2894
3380
  function _getFetchCorrelationContext(response) {
@@ -2898,7 +3384,7 @@
2898
3384
  return CorrelationIdHelper.getCorrelationContext(responseHeader);
2899
3385
  }
2900
3386
  catch (e) {
2901
- _throwInternalWarning(_self, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.", {
3387
+ _throwInternalWarning(_self, 18 , "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.", {
2902
3388
  fetchDiagnosticsMessage: _getFailedFetchDiagnosticsMessage(response),
2903
3389
  exception: dumpObj(e)
2904
3390
  });
@@ -2915,7 +3401,7 @@
2915
3401
  disableFetchTracking: true,
2916
3402
  excludeRequestFromAutoTrackingPatterns: undefined,
2917
3403
  disableCorrelationHeaders: false,
2918
- distributedTracingMode: DistributedTracingModes.AI_AND_W3C,
3404
+ distributedTracingMode: 1 ,
2919
3405
  correlationHeaderExcludedDomains: [
2920
3406
  "*.blob.core.windows.net",
2921
3407
  "*.blob.core.chinacloudapi.cn",