@microsoft/1ds-core-js 3.1.9 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/bundle/{ms.core-3.1.9.gbl.js → ms.core-3.2.0.gbl.js} +2560 -1200
  3. package/bundle/ms.core-3.2.0.gbl.js.map +1 -0
  4. package/bundle/ms.core-3.2.0.gbl.min.js +7 -0
  5. package/bundle/ms.core-3.2.0.gbl.min.js.map +1 -0
  6. package/bundle/ms.core-3.2.0.integrity.json +46 -0
  7. package/bundle/{ms.core-3.1.9.js → ms.core-3.2.0.js} +2560 -1200
  8. package/bundle/ms.core-3.2.0.js.map +1 -0
  9. package/bundle/ms.core-3.2.0.min.js +7 -0
  10. package/bundle/ms.core-3.2.0.min.js.map +1 -0
  11. package/bundle/ms.core.gbl.js +2559 -1199
  12. package/bundle/ms.core.gbl.js.map +1 -1
  13. package/bundle/ms.core.gbl.min.js +2 -2
  14. package/bundle/ms.core.gbl.min.js.map +1 -1
  15. package/bundle/ms.core.integrity.json +17 -17
  16. package/bundle/ms.core.js +2559 -1199
  17. package/bundle/ms.core.js.map +1 -1
  18. package/bundle/ms.core.min.js +2 -2
  19. package/bundle/ms.core.min.js.map +1 -1
  20. package/dist/ms.core.js +97 -56
  21. package/dist/ms.core.js.map +1 -1
  22. package/dist/ms.core.min.js +2 -2
  23. package/dist/ms.core.min.js.map +1 -1
  24. package/dist-esm/src/AppInsightsCore.js +5 -6
  25. package/dist-esm/src/AppInsightsCore.js.map +1 -1
  26. package/dist-esm/src/BaseCore.d.ts +0 -8
  27. package/dist-esm/src/BaseCore.js +4 -5
  28. package/dist-esm/src/BaseCore.js.map +1 -1
  29. package/dist-esm/src/DataModels.js +1 -1
  30. package/dist-esm/src/ESPromise.js +1 -1
  31. package/dist-esm/src/ESPromiseScheduler.js +1 -1
  32. package/dist-esm/src/Enums.d.ts +174 -172
  33. package/dist-esm/src/Enums.js +63 -103
  34. package/dist-esm/src/Enums.js.map +1 -1
  35. package/dist-esm/src/Index.d.ts +4 -3
  36. package/dist-esm/src/Index.js +4 -6
  37. package/dist-esm/src/Index.js.map +1 -1
  38. package/dist-esm/src/Utils.d.ts +6 -5
  39. package/dist-esm/src/Utils.js +21 -14
  40. package/dist-esm/src/Utils.js.map +1 -1
  41. package/dist-esm/src/ValueSanitizer.js +1 -1
  42. package/package.json +4 -4
  43. package/src/AppInsightsCore.ts +6 -6
  44. package/src/BaseCore.ts +6 -6
  45. package/src/Enums.ts +155 -65
  46. package/src/Index.ts +14 -7
  47. package/src/Utils.ts +23 -14
  48. package/bundle/ms.core-3.1.9.gbl.js.map +0 -1
  49. package/bundle/ms.core-3.1.9.gbl.min.js +0 -7
  50. package/bundle/ms.core-3.1.9.gbl.min.js.map +0 -1
  51. package/bundle/ms.core-3.1.9.integrity.json +0 -46
  52. package/bundle/ms.core-3.1.9.js.map +0 -1
  53. package/bundle/ms.core-3.1.9.min.js +0 -7
  54. package/bundle/ms.core-3.1.9.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * 1DS JS SDK Core, 3.1.9
2
+ * 1DS JS SDK Core, 3.2.0
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -18,20 +18,24 @@
18
18
  var ObjDefineProperty = ObjClass["defineProperty"];
19
19
  var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];
20
20
 
21
- function getGlobal() {
22
- if (typeof globalThis !== strShimUndefined && globalThis) {
23
- return globalThis;
24
- }
25
- if (typeof self !== strShimUndefined && self) {
26
- return self;
27
- }
28
- if (typeof window !== strShimUndefined && window) {
29
- return window;
30
- }
31
- if (typeof global !== strShimUndefined && global) {
32
- return global;
21
+ var _cachedGlobal = null;
22
+ function getGlobal(useCached) {
23
+ if (useCached === void 0) { useCached = true; }
24
+ if (!_cachedGlobal || !useCached) {
25
+ if (typeof globalThis !== strShimUndefined && globalThis) {
26
+ _cachedGlobal = globalThis;
27
+ }
28
+ if (typeof self !== strShimUndefined && self) {
29
+ _cachedGlobal = self;
30
+ }
31
+ if (typeof window !== strShimUndefined && window) {
32
+ _cachedGlobal = window;
33
+ }
34
+ if (typeof global !== strShimUndefined && global) {
35
+ _cachedGlobal = global;
36
+ }
33
37
  }
34
- return null;
38
+ return _cachedGlobal;
35
39
  }
36
40
  function throwTypeError(message) {
37
41
  throw new TypeError(message);
@@ -46,7 +50,7 @@
46
50
  }
47
51
  var type = typeof obj;
48
52
  if (type !== strShimObject && type !== strShimFunction) {
49
- throwTypeError('Object prototype may only be an Object:' + obj);
53
+ throwTypeError("Object prototype may only be an Object:" + obj);
50
54
  }
51
55
  function tmpFunc() { }
52
56
  tmpFunc[strShimPrototype] = obj;
@@ -96,577 +100,303 @@
96
100
 
97
101
  var MinChannelPriorty = 100;
98
102
 
99
- var EventsDiscardedReason = {
100
- Unknown: 0,
101
- NonRetryableStatus: 1,
102
- InvalidEvent: 2,
103
- SizeLimitExceeded: 3,
104
- KillSwitch: 4,
105
- QueueFull: 5
106
- };
103
+ var strEmpty = "";
104
+ var strProcessTelemetry = "processTelemetry";
105
+ var strPriority = "priority";
106
+ var strSetNextPlugin = "setNextPlugin";
107
+ var strIsInitialized = "isInitialized";
108
+ var strTeardown = "teardown";
109
+ var strCore = "core";
110
+ var strUpdate = "update";
111
+ var strDisabled = "disabled";
112
+ var strDoTeardown = "_doTeardown";
113
+ var strProcessNext = "processNext";
114
+ var strResume = "resume";
115
+ var strPause = "pause";
116
+ var strNotificationListener = "NotificationListener";
117
+ var strAddNotificationListener = "add" + strNotificationListener;
118
+ var strRemoveNotificationListener = "remove" + strNotificationListener;
119
+ var strEventsSent = "eventsSent";
120
+ var strEventsDiscarded = "eventsDiscarded";
121
+ var strEventsSendRequest = "eventsSendRequest";
122
+ var strPerfEvent = "perfEvent";
107
123
 
108
- /*!
109
- * Microsoft Dynamic Proto Utility, 1.1.4
110
- * Copyright (c) Microsoft and contributors. All rights reserved.
111
- */
112
- var Constructor = 'constructor';
113
- var Prototype = 'prototype';
114
- var strFunction = 'function';
115
- var DynInstFuncTable = '_dynInstFuncs';
116
- var DynProxyTag = '_isDynProxy';
117
- var DynClassName = '_dynClass';
118
- var DynClassNamePrefix = '_dynCls$';
119
- var DynInstChkTag = '_dynInstChk';
120
- var DynAllowInstChkTag = DynInstChkTag;
121
- var DynProtoDefaultOptions = '_dfOpts';
122
- var UnknownValue = '_unknown_';
123
- var str__Proto = "__proto__";
124
- var strUseBaseInst = 'useBaseInst';
125
- var strSetInstFuncs = 'setInstFuncs';
126
- var Obj = Object;
127
- var _objGetPrototypeOf = Obj["getPrototypeOf"];
128
- var _dynamicNames = 0;
129
- function _hasOwnProperty(obj, prop) {
130
- return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
131
- }
132
- function _isObjectOrArrayPrototype(target) {
133
- return target && (target === Obj[Prototype] || target === Array[Prototype]);
134
- }
135
- function _isObjectArrayOrFunctionPrototype(target) {
136
- return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
137
- }
138
- function _getObjProto(target) {
124
+ var strToISOString = "toISOString";
125
+ var cStrEndsWith = "endsWith";
126
+ var cStrStartsWith = "startsWith";
127
+ var strIndexOf = "indexOf";
128
+ var strMap = "map";
129
+ var strReduce = "reduce";
130
+ var cStrTrim = "trim";
131
+ var strToString = "toString";
132
+ var str__Proto$1 = "__proto__";
133
+ var strConstructor = "constructor";
134
+ var _objDefineProperty$1 = ObjDefineProperty;
135
+ var _objFreeze = ObjClass.freeze;
136
+ var _objSeal = ObjClass.seal;
137
+ var _objKeys = ObjClass.keys;
138
+ var StringProto = String[strShimPrototype];
139
+ var _strTrim = StringProto[cStrTrim];
140
+ var _strEndsWith = StringProto[cStrEndsWith];
141
+ var _strStartsWith = StringProto[cStrStartsWith];
142
+ var DateProto = Date[strShimPrototype];
143
+ var _dataToISOString = DateProto[strToISOString];
144
+ var _isArray = Array.isArray;
145
+ var _objToString = ObjProto[strToString];
146
+ var _fnToString = ObjHasOwnProperty[strToString];
147
+ var _objFunctionString = _fnToString.call(ObjClass);
148
+ var rCamelCase = /-([a-z])/g;
149
+ var rNormalizeInvalid = /([^\w\d_$])/g;
150
+ var rLeadingNumeric = /^(\d+[\w\d_$])/;
151
+ var _objGetPrototypeOf$1 = Object["getPrototypeOf"];
152
+ function _getObjProto$1(target) {
139
153
  if (target) {
140
- if (_objGetPrototypeOf) {
141
- return _objGetPrototypeOf(target);
154
+ if (_objGetPrototypeOf$1) {
155
+ return _objGetPrototypeOf$1(target);
142
156
  }
143
- var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
157
+ var newProto = target[str__Proto$1] || target[strShimPrototype] || target[strConstructor];
144
158
  if (newProto) {
145
159
  return newProto;
146
160
  }
147
161
  }
148
162
  return null;
149
163
  }
150
- function _forEachProp(target, func) {
151
- var props = [];
152
- var getOwnProps = Obj["getOwnPropertyNames"];
153
- if (getOwnProps) {
154
- props = getOwnProps(target);
164
+ function isTypeof(value, theType) {
165
+ return typeof value === theType;
166
+ }
167
+ function isUndefined(value) {
168
+ return value === undefined || typeof value === strShimUndefined;
169
+ }
170
+ function isNullOrUndefined(value) {
171
+ return (value === null || isUndefined(value));
172
+ }
173
+ function isNotNullOrUndefined(value) {
174
+ return !isNullOrUndefined(value);
175
+ }
176
+ function hasOwnProperty(obj, prop) {
177
+ return !!(obj && ObjHasOwnProperty.call(obj, prop));
178
+ }
179
+ function isObject(value) {
180
+ return !!(value && typeof value === strShimObject);
181
+ }
182
+ function isFunction(value) {
183
+ return !!(value && typeof value === strShimFunction);
184
+ }
185
+ function normalizeJsName(name) {
186
+ var value = name;
187
+ if (value && isString(value)) {
188
+ value = value.replace(rCamelCase, function (_all, letter) {
189
+ return letter.toUpperCase();
190
+ });
191
+ value = value.replace(rNormalizeInvalid, "_");
192
+ value = value.replace(rLeadingNumeric, function (_all, match) {
193
+ return "_" + match;
194
+ });
155
195
  }
156
- else {
157
- for (var name_1 in target) {
158
- if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
159
- props.push(name_1);
196
+ return value;
197
+ }
198
+ function objForEachKey(target, callbackfn) {
199
+ if (target) {
200
+ for (var prop in target) {
201
+ if (ObjHasOwnProperty.call(target, prop)) {
202
+ callbackfn.call(target, prop, target[prop]);
160
203
  }
161
204
  }
162
205
  }
163
- if (props && props.length > 0) {
164
- for (var lp = 0; lp < props.length; lp++) {
165
- func(props[lp]);
166
- }
206
+ }
207
+ function strEndsWith(value, search) {
208
+ var result = false;
209
+ if (value && search && !(result = value === search)) {
210
+ result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);
167
211
  }
212
+ return result;
168
213
  }
169
- function _isDynamicCandidate(target, funcName, skipOwn) {
170
- return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
214
+ function _strEndsWithPoly(value, search) {
215
+ var result = false;
216
+ var searchLen = search ? search.length : 0;
217
+ var valLen = value ? value.length : 0;
218
+ if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {
219
+ var pos = valLen - 1;
220
+ for (var lp = searchLen - 1; lp >= 0; lp--) {
221
+ if (value[pos] != search[lp]) {
222
+ return false;
223
+ }
224
+ pos--;
225
+ }
226
+ result = true;
227
+ }
228
+ return result;
171
229
  }
172
- function _throwTypeError(message) {
173
- throw new TypeError("DynamicProto: " + message);
230
+ function strStartsWith(value, checkValue) {
231
+ var result = false;
232
+ if (value && checkValue && !(result = value === checkValue)) {
233
+ result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);
234
+ }
235
+ return result;
174
236
  }
175
- function _getInstanceFuncs(thisTarget) {
176
- var instFuncs = {};
177
- _forEachProp(thisTarget, function (name) {
178
- if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
179
- instFuncs[name] = thisTarget[name];
237
+ function _strStartsWithPoly(value, checkValue) {
238
+ var result = false;
239
+ var chkLen = checkValue ? checkValue.length : 0;
240
+ if (value && chkLen && value.length >= chkLen && !(result = value === checkValue)) {
241
+ for (var lp = 0; lp < chkLen; lp++) {
242
+ if (value[lp] !== checkValue[lp]) {
243
+ return false;
244
+ }
180
245
  }
181
- });
182
- return instFuncs;
246
+ result = true;
247
+ }
248
+ return result;
183
249
  }
184
- function _hasVisited(values, value) {
185
- for (var lp = values.length - 1; lp >= 0; lp--) {
186
- if (values[lp] === value) {
187
- return true;
188
- }
250
+ function strContains(value, search) {
251
+ if (value && search) {
252
+ return value.indexOf(search) !== -1;
189
253
  }
190
254
  return false;
191
255
  }
192
- function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
193
- function _instFuncProxy(target, funcHost, funcName) {
194
- var theFunc = funcHost[funcName];
195
- if (theFunc[DynProxyTag] && useBaseInst) {
196
- var instFuncTable = target[DynInstFuncTable] || {};
197
- if (instFuncTable[DynAllowInstChkTag] !== false) {
198
- theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
256
+ function isDate(obj) {
257
+ return !!(obj && _objToString.call(obj) === "[object Date]");
258
+ }
259
+ var isArray = _isArray || _isArrayPoly;
260
+ function _isArrayPoly(obj) {
261
+ return !!(obj && _objToString.call(obj) === "[object Array]");
262
+ }
263
+ function isError(obj) {
264
+ return !!(obj && _objToString.call(obj) === "[object Error]");
265
+ }
266
+ function isString(value) {
267
+ return typeof value === "string";
268
+ }
269
+ function isNumber(value) {
270
+ return typeof value === "number";
271
+ }
272
+ function isBoolean(value) {
273
+ return typeof value === "boolean";
274
+ }
275
+ function isPlainObject(value) {
276
+ var result = false;
277
+ if (value && typeof value === "object") {
278
+ var proto = _objGetPrototypeOf$1 ? _objGetPrototypeOf$1(value) : _getObjProto$1(value);
279
+ if (!proto) {
280
+ result = true;
281
+ }
282
+ else {
283
+ if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
284
+ proto = proto[strConstructor];
199
285
  }
286
+ result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
200
287
  }
201
- return function () {
202
- return theFunc.apply(target, arguments);
203
- };
204
288
  }
205
- var baseFuncs = {};
206
- _forEachProp(instFuncs, function (name) {
207
- baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
208
- });
209
- var baseProto = _getObjProto(classProto);
210
- var visited = [];
211
- while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
212
- _forEachProp(baseProto, function (name) {
213
- if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
214
- baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
289
+ return result;
290
+ }
291
+ function toISOString(date) {
292
+ if (date) {
293
+ return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
294
+ }
295
+ }
296
+ function _toISOStringPoly(date) {
297
+ if (date && date.getUTCFullYear) {
298
+ var pad = function (num) {
299
+ var r = String(num);
300
+ if (r.length === 1) {
301
+ r = "0" + r;
215
302
  }
216
- });
217
- visited.push(baseProto);
218
- baseProto = _getObjProto(baseProto);
303
+ return r;
304
+ };
305
+ return date.getUTCFullYear()
306
+ + "-" + pad(date.getUTCMonth() + 1)
307
+ + "-" + pad(date.getUTCDate())
308
+ + "T" + pad(date.getUTCHours())
309
+ + ":" + pad(date.getUTCMinutes())
310
+ + ":" + pad(date.getUTCSeconds())
311
+ + "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
312
+ + "Z";
219
313
  }
220
- return baseFuncs;
221
314
  }
222
- function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
223
- var instFunc = null;
224
- if (target && _hasOwnProperty(proto, DynClassName)) {
225
- var instFuncTable = target[DynInstFuncTable] || {};
226
- instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
227
- if (!instFunc) {
228
- _throwTypeError("Missing [" + funcName + "] " + strFunction);
229
- }
230
- if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
231
- var canAddInst = !_hasOwnProperty(target, funcName);
232
- var objProto = _getObjProto(target);
233
- var visited = [];
234
- while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
235
- var protoFunc = objProto[funcName];
236
- if (protoFunc) {
237
- canAddInst = (protoFunc === currentDynProtoProxy);
315
+ function arrForEach(arr, callbackfn, thisArg) {
316
+ var len = arr.length;
317
+ try {
318
+ for (var idx = 0; idx < len; idx++) {
319
+ if (idx in arr) {
320
+ if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
238
321
  break;
239
322
  }
240
- visited.push(objProto);
241
- objProto = _getObjProto(objProto);
242
- }
243
- try {
244
- if (canAddInst) {
245
- target[funcName] = instFunc;
246
- }
247
- instFunc[DynInstChkTag] = 1;
248
- }
249
- catch (e) {
250
- instFuncTable[DynAllowInstChkTag] = false;
251
323
  }
252
324
  }
253
325
  }
254
- return instFunc;
255
- }
256
- function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
257
- var protoFunc = proto[funcName];
258
- if (protoFunc === currentDynProtoProxy) {
259
- protoFunc = _getObjProto(proto)[funcName];
260
- }
261
- if (typeof protoFunc !== strFunction) {
262
- _throwTypeError("[" + funcName + "] is not a " + strFunction);
326
+ catch (e) {
263
327
  }
264
- return protoFunc;
265
328
  }
266
- function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
267
- function _createDynamicPrototype(proto, funcName) {
268
- var dynProtoProxy = function () {
269
- var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
270
- return instFunc.apply(this, arguments);
271
- };
272
- dynProtoProxy[DynProxyTag] = 1;
273
- return dynProtoProxy;
274
- }
275
- if (!_isObjectOrArrayPrototype(proto)) {
276
- var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
277
- var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
278
- if (instFuncTable[DynAllowInstChkTag] !== false) {
279
- instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
329
+ function arrIndexOf(arr, searchElement, fromIndex) {
330
+ if (arr) {
331
+ if (arr[strIndexOf]) {
332
+ return arr[strIndexOf](searchElement, fromIndex);
280
333
  }
281
- _forEachProp(target, function (name) {
282
- if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
283
- instFuncs_1[name] = target[name];
284
- delete target[name];
285
- if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
286
- proto[name] = _createDynamicPrototype(proto, name);
334
+ var len = arr.length;
335
+ var from = fromIndex || 0;
336
+ try {
337
+ for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
338
+ if (lp in arr && arr[lp] === searchElement) {
339
+ return lp;
287
340
  }
288
341
  }
289
- });
342
+ }
343
+ catch (e) {
344
+ }
290
345
  }
346
+ return -1;
291
347
  }
292
- function _checkPrototype(classProto, thisTarget) {
293
- if (_objGetPrototypeOf) {
294
- var visited = [];
295
- var thisProto = _getObjProto(thisTarget);
296
- while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
297
- if (thisProto === classProto) {
298
- return true;
299
- }
300
- visited.push(thisProto);
301
- thisProto = _getObjProto(thisProto);
302
- }
303
- }
304
- return false;
305
- }
306
- function _getObjName(target, unknownValue) {
307
- if (_hasOwnProperty(target, Prototype)) {
308
- return target.name || unknownValue || UnknownValue;
309
- }
310
- return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
311
- }
312
- function dynamicProto(theClass, target, delegateFunc, options) {
313
- if (!_hasOwnProperty(theClass, Prototype)) {
314
- _throwTypeError("theClass is an invalid class definition.");
315
- }
316
- var classProto = theClass[Prototype];
317
- if (!_checkPrototype(classProto, target)) {
318
- _throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
319
- }
320
- var className = null;
321
- if (_hasOwnProperty(classProto, DynClassName)) {
322
- className = classProto[DynClassName];
323
- }
324
- else {
325
- className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
326
- _dynamicNames++;
327
- classProto[DynClassName] = className;
328
- }
329
- var perfOptions = dynamicProto[DynProtoDefaultOptions];
330
- var useBaseInst = !!perfOptions[strUseBaseInst];
331
- if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
332
- useBaseInst = !!options[strUseBaseInst];
333
- }
334
- var instFuncs = _getInstanceFuncs(target);
335
- var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
336
- delegateFunc(target, baseFuncs);
337
- var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
338
- if (setInstanceFunc && options) {
339
- setInstanceFunc = !!options[strSetInstFuncs];
340
- }
341
- _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
342
- }
343
- var perfDefaults = {
344
- setInstFuncs: true,
345
- useBaseInst: true
346
- };
347
- dynamicProto[DynProtoDefaultOptions] = perfDefaults;
348
-
349
- exports.LoggingSeverity = void 0;
350
- (function (LoggingSeverity) {
351
- LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
352
- LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
353
- })(exports.LoggingSeverity || (exports.LoggingSeverity = {}));
354
- var _InternalMessageId = {
355
- BrowserDoesNotSupportLocalStorage: 0,
356
- BrowserCannotReadLocalStorage: 1,
357
- BrowserCannotReadSessionStorage: 2,
358
- BrowserCannotWriteLocalStorage: 3,
359
- BrowserCannotWriteSessionStorage: 4,
360
- BrowserFailedRemovalFromLocalStorage: 5,
361
- BrowserFailedRemovalFromSessionStorage: 6,
362
- CannotSendEmptyTelemetry: 7,
363
- ClientPerformanceMathError: 8,
364
- ErrorParsingAISessionCookie: 9,
365
- ErrorPVCalc: 10,
366
- ExceptionWhileLoggingError: 11,
367
- FailedAddingTelemetryToBuffer: 12,
368
- FailedMonitorAjaxAbort: 13,
369
- FailedMonitorAjaxDur: 14,
370
- FailedMonitorAjaxOpen: 15,
371
- FailedMonitorAjaxRSC: 16,
372
- FailedMonitorAjaxSend: 17,
373
- FailedMonitorAjaxGetCorrelationHeader: 18,
374
- FailedToAddHandlerForOnBeforeUnload: 19,
375
- FailedToSendQueuedTelemetry: 20,
376
- FailedToReportDataLoss: 21,
377
- FlushFailed: 22,
378
- MessageLimitPerPVExceeded: 23,
379
- MissingRequiredFieldSpecification: 24,
380
- NavigationTimingNotSupported: 25,
381
- OnError: 26,
382
- SessionRenewalDateIsZero: 27,
383
- SenderNotInitialized: 28,
384
- StartTrackEventFailed: 29,
385
- StopTrackEventFailed: 30,
386
- StartTrackFailed: 31,
387
- StopTrackFailed: 32,
388
- TelemetrySampledAndNotSent: 33,
389
- TrackEventFailed: 34,
390
- TrackExceptionFailed: 35,
391
- TrackMetricFailed: 36,
392
- TrackPVFailed: 37,
393
- TrackPVFailedCalc: 38,
394
- TrackTraceFailed: 39,
395
- TransmissionFailed: 40,
396
- FailedToSetStorageBuffer: 41,
397
- FailedToRestoreStorageBuffer: 42,
398
- InvalidBackendResponse: 43,
399
- FailedToFixDepricatedValues: 44,
400
- InvalidDurationValue: 45,
401
- TelemetryEnvelopeInvalid: 46,
402
- CreateEnvelopeError: 47,
403
- CannotSerializeObject: 48,
404
- CannotSerializeObjectNonSerializable: 49,
405
- CircularReferenceDetected: 50,
406
- ClearAuthContextFailed: 51,
407
- ExceptionTruncated: 52,
408
- IllegalCharsInName: 53,
409
- ItemNotInArray: 54,
410
- MaxAjaxPerPVExceeded: 55,
411
- MessageTruncated: 56,
412
- NameTooLong: 57,
413
- SampleRateOutOfRange: 58,
414
- SetAuthContextFailed: 59,
415
- SetAuthContextFailedAccountName: 60,
416
- StringValueTooLong: 61,
417
- StartCalledMoreThanOnce: 62,
418
- StopCalledWithoutStart: 63,
419
- TelemetryInitializerFailed: 64,
420
- TrackArgumentsNotSpecified: 65,
421
- UrlTooLong: 66,
422
- SessionStorageBufferFull: 67,
423
- CannotAccessCookie: 68,
424
- IdTooLong: 69,
425
- InvalidEvent: 70,
426
- FailedMonitorAjaxSetRequestHeader: 71,
427
- SendBrowserInfoOnUserInit: 72,
428
- PluginException: 73,
429
- NotificationException: 74,
430
- SnippetScriptLoadFailure: 99,
431
- InvalidInstrumentationKey: 100,
432
- CannotParseAiBlobValue: 101,
433
- InvalidContentBlob: 102,
434
- TrackPageActionEventFailed: 103,
435
- FailedAddingCustomDefinedRequestContext: 104,
436
- InMemoryStorageBufferFull: 105
437
- };
438
-
439
- var strOnPrefix = "on";
440
- var strAttachEvent = "attachEvent";
441
- var strAddEventHelper = "addEventListener";
442
- var strDetachEvent = "detachEvent";
443
- var strRemoveEventListener = "removeEventListener";
444
- var _objDefineProperty = ObjDefineProperty;
445
- function objToString(obj) {
446
- return ObjProto.toString.call(obj);
447
- }
448
- function isTypeof(value, theType) {
449
- return typeof value === theType;
450
- }
451
- function isUndefined(value) {
452
- return value === undefined || typeof value === strShimUndefined;
453
- }
454
- function isNullOrUndefined(value) {
455
- return (value === null || isUndefined(value));
456
- }
457
- function isNotNullOrUndefined(value) {
458
- return !isNullOrUndefined(value);
459
- }
460
- function hasOwnProperty(obj, prop) {
461
- return obj && ObjHasOwnProperty.call(obj, prop);
462
- }
463
- function isObject(value) {
464
- return typeof value === strShimObject;
465
- }
466
- function isFunction(value) {
467
- return typeof value === strShimFunction;
468
- }
469
- function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
470
- if (useCapture === void 0) { useCapture = false; }
471
- var result = false;
472
- if (!isNullOrUndefined(obj)) {
473
- try {
474
- if (!isNullOrUndefined(obj[strAddEventHelper])) {
475
- obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
476
- result = true;
477
- }
478
- else if (!isNullOrUndefined(obj[strAttachEvent])) {
479
- obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
480
- result = true;
481
- }
482
- }
483
- catch (e) {
348
+ function arrMap(arr, callbackfn, thisArg) {
349
+ var results;
350
+ if (arr) {
351
+ if (arr[strMap]) {
352
+ return arr[strMap](callbackfn, thisArg);
484
353
  }
485
- }
486
- return result;
487
- }
488
- function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
489
- if (useCapture === void 0) { useCapture = false; }
490
- if (!isNullOrUndefined(obj)) {
354
+ var len = arr.length;
355
+ var _this = thisArg || arr;
356
+ results = new Array(len);
491
357
  try {
492
- if (!isNullOrUndefined(obj[strRemoveEventListener])) {
493
- obj[strRemoveEventListener](eventNameWithoutOn, handlerRef, useCapture);
494
- }
495
- else if (!isNullOrUndefined(obj[strDetachEvent])) {
496
- obj[strDetachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
358
+ for (var lp = 0; lp < len; lp++) {
359
+ if (lp in arr) {
360
+ results[lp] = callbackfn.call(_this, arr[lp], arr);
361
+ }
497
362
  }
498
363
  }
499
364
  catch (e) {
500
365
  }
501
366
  }
367
+ return results;
502
368
  }
503
- function normalizeJsName(name) {
504
- var value = name;
505
- var match = /([^\w\d_$])/g;
506
- if (match.test(name)) {
507
- value = name.replace(match, "_");
508
- }
509
- return value;
510
- }
511
- function objForEachKey(target, callbackfn) {
512
- if (target) {
513
- for (var prop in target) {
514
- if (ObjHasOwnProperty.call(target, prop)) {
515
- callbackfn.call(target, prop, target[prop]);
516
- }
517
- }
518
- }
519
- }
520
- function strEndsWith(value, search) {
521
- if (value && search) {
522
- var searchLen = search.length;
523
- var valLen = value.length;
524
- if (value === search) {
525
- return true;
526
- }
527
- else if (valLen >= searchLen) {
528
- var pos = valLen - 1;
529
- for (var lp = searchLen - 1; lp >= 0; lp--) {
530
- if (value[pos] != search[lp]) {
531
- return false;
532
- }
533
- pos--;
534
- }
535
- return true;
536
- }
537
- }
538
- return false;
539
- }
540
- function strStartsWith(value, checkValue) {
541
- var result = false;
542
- if (value && checkValue) {
543
- var chkLen = checkValue.length;
544
- if (value === checkValue) {
545
- return true;
546
- }
547
- else if (value.length >= chkLen) {
548
- for (var lp = 0; lp < chkLen; lp++) {
549
- if (value[lp] !== checkValue[lp]) {
550
- return false;
551
- }
552
- }
553
- result = true;
369
+ function arrReduce(arr, callbackfn, initialValue) {
370
+ var value;
371
+ if (arr) {
372
+ if (arr[strReduce]) {
373
+ return arr[strReduce](callbackfn, initialValue);
554
374
  }
555
- }
556
- return result;
557
- }
558
- function strContains(value, search) {
559
- if (value && search) {
560
- return value.indexOf(search) !== -1;
561
- }
562
- return false;
563
- }
564
- function isDate(obj) {
565
- return objToString(obj) === "[object Date]";
566
- }
567
- function isArray(obj) {
568
- return objToString(obj) === "[object Array]";
569
- }
570
- function isError(obj) {
571
- return objToString(obj) === "[object Error]";
572
- }
573
- function isString(value) {
574
- return typeof value === "string";
575
- }
576
- function isNumber(value) {
577
- return typeof value === "number";
578
- }
579
- function isBoolean(value) {
580
- return typeof value === "boolean";
581
- }
582
- function toISOString(date) {
583
- if (isDate(date)) {
584
- var pad = function (num) {
585
- var r = String(num);
586
- if (r.length === 1) {
587
- r = "0" + r;
588
- }
589
- return r;
590
- };
591
- return date.getUTCFullYear()
592
- + "-" + pad(date.getUTCMonth() + 1)
593
- + "-" + pad(date.getUTCDate())
594
- + "T" + pad(date.getUTCHours())
595
- + ":" + pad(date.getUTCMinutes())
596
- + ":" + pad(date.getUTCSeconds())
597
- + "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
598
- + "Z";
599
- }
600
- }
601
- function arrForEach(arr, callbackfn, thisArg) {
602
- var len = arr.length;
603
- try {
604
- for (var idx = 0; idx < len; idx++) {
605
- if (idx in arr) {
606
- if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
607
- break;
608
- }
609
- }
375
+ var len = arr.length;
376
+ var lp = 0;
377
+ if (arguments.length >= 3) {
378
+ value = arguments[2];
610
379
  }
611
- }
612
- catch (e) {
613
- }
614
- }
615
- function arrIndexOf(arr, searchElement, fromIndex) {
616
- var len = arr.length;
617
- var from = fromIndex || 0;
618
- try {
619
- for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
620
- if (lp in arr && arr[lp] === searchElement) {
621
- return lp;
380
+ else {
381
+ while (lp < len && !(lp in arr)) {
382
+ lp++;
622
383
  }
384
+ value = arr[lp++];
623
385
  }
624
- }
625
- catch (e) {
626
- }
627
- return -1;
628
- }
629
- function arrMap(arr, callbackfn, thisArg) {
630
- var len = arr.length;
631
- var _this = thisArg || arr;
632
- var results = new Array(len);
633
- try {
634
- for (var lp = 0; lp < len; lp++) {
386
+ while (lp < len) {
635
387
  if (lp in arr) {
636
- results[lp] = callbackfn.call(_this, arr[lp], arr);
388
+ value = callbackfn(value, arr[lp], lp, arr);
637
389
  }
638
- }
639
- }
640
- catch (e) {
641
- }
642
- return results;
643
- }
644
- function arrReduce(arr, callbackfn, initialValue) {
645
- var len = arr.length;
646
- var lp = 0;
647
- var value;
648
- if (arguments.length >= 3) {
649
- value = arguments[2];
650
- }
651
- else {
652
- while (lp < len && !(lp in arr)) {
653
390
  lp++;
654
391
  }
655
- value = arr[lp++];
656
- }
657
- while (lp < len) {
658
- if (lp in arr) {
659
- value = callbackfn(value, arr[lp], lp, arr);
660
- }
661
- lp++;
662
392
  }
663
393
  return value;
664
394
  }
665
395
  function strTrim(str) {
666
- if (typeof str !== "string") {
667
- return str;
396
+ if (str) {
397
+ str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
668
398
  }
669
- return str.replace(/^\s+|\s+$/g, "");
399
+ return str;
670
400
  }
671
401
  var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
672
402
  var _objKeysDontEnums = [
@@ -683,6 +413,9 @@
683
413
  if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
684
414
  throwTypeError("objKeys called on non-object");
685
415
  }
416
+ if (!_objKeysHasDontEnumBug && _objKeys) {
417
+ return _objKeys(obj);
418
+ }
686
419
  var result = [];
687
420
  for (var prop in obj) {
688
421
  if (obj && ObjHasOwnProperty.call(obj, prop)) {
@@ -700,7 +433,7 @@
700
433
  return result;
701
434
  }
702
435
  function objDefineAccessors(target, prop, getProp, setProp) {
703
- if (_objDefineProperty) {
436
+ if (_objDefineProperty$1) {
704
437
  try {
705
438
  var descriptor = {
706
439
  enumerable: true,
@@ -712,7 +445,7 @@
712
445
  if (setProp) {
713
446
  descriptor.set = setProp;
714
447
  }
715
- _objDefineProperty(target, prop, descriptor);
448
+ _objDefineProperty$1(target, prop, descriptor);
716
449
  return true;
717
450
  }
718
451
  catch (e) {
@@ -720,18 +453,30 @@
720
453
  }
721
454
  return false;
722
455
  }
456
+ function _doNothing(value) {
457
+ return value;
458
+ }
459
+ function deepFreeze(obj) {
460
+ if (_objFreeze) {
461
+ objForEachKey(obj, function (name, value) {
462
+ if (isArray(value) || isObject(value)) {
463
+ _objFreeze(value);
464
+ }
465
+ });
466
+ }
467
+ return objFreeze(obj);
468
+ }
469
+ var objFreeze = _objFreeze || _doNothing;
470
+ var objSeal = _objSeal || _doNothing;
723
471
  function dateNow() {
724
472
  var dt = Date;
725
- if (dt.now) {
726
- return dt.now();
727
- }
728
- return new dt().getTime();
473
+ return dt.now ? dt.now() : new dt().getTime();
729
474
  }
730
475
  function getExceptionName(object) {
731
476
  if (isError(object)) {
732
477
  return object.name;
733
478
  }
734
- return "";
479
+ return strEmpty;
735
480
  }
736
481
  function setValue(target, field, value, valChk, srcChk) {
737
482
  var theValue = value;
@@ -767,19 +512,33 @@
767
512
  function throwError(message) {
768
513
  throw new Error(message);
769
514
  }
515
+ function _createProxyFunction(source, funcName) {
516
+ var srcFunc = null;
517
+ var src = null;
518
+ if (isFunction(source)) {
519
+ srcFunc = source;
520
+ }
521
+ else {
522
+ src = source;
523
+ }
524
+ return function () {
525
+ var originalArguments = arguments;
526
+ if (srcFunc) {
527
+ src = srcFunc();
528
+ }
529
+ if (src) {
530
+ return src[funcName].apply(src, originalArguments);
531
+ }
532
+ };
533
+ }
770
534
  function proxyAssign(target, source, chkSet) {
771
- if (target && source && target !== source && isObject(target) && isObject(source)) {
535
+ if (target && source && isObject(target) && isObject(source)) {
772
536
  var _loop_1 = function (field) {
773
537
  if (isString(field)) {
774
538
  var value = source[field];
775
539
  if (isFunction(value)) {
776
540
  if (!chkSet || chkSet(field, true, source, target)) {
777
- target[field] = (function (funcName) {
778
- return function () {
779
- var originalArguments = arguments;
780
- return source[funcName].apply(source, originalArguments);
781
- };
782
- })(field);
541
+ target[field] = _createProxyFunction(source, field);
783
542
  }
784
543
  }
785
544
  else if (!chkSet || chkSet(field, false, source, target)) {
@@ -802,15 +561,336 @@
802
561
  }
803
562
  return target;
804
563
  }
564
+ function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
565
+ if (target && name && source) {
566
+ if (overwriteTarget !== false || isUndefined(target[name])) {
567
+ target[name] = _createProxyFunction(source, theFunc);
568
+ }
569
+ }
570
+ }
571
+ function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
572
+ if (target && source && isObject(target) && isArray(functionsToProxy)) {
573
+ arrForEach(functionsToProxy, function (theFuncName) {
574
+ if (isString(theFuncName)) {
575
+ proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
576
+ }
577
+ });
578
+ }
579
+ return target;
580
+ }
805
581
  function optimizeObject(theObject) {
806
- if (theObject) {
807
- theObject = ObjClass(ObjAssign ? ObjAssign({}, theObject) : theObject);
582
+ if (theObject && ObjAssign) {
583
+ theObject = ObjClass(ObjAssign({}, theObject));
808
584
  }
809
585
  return theObject;
810
586
  }
587
+ function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
588
+ var theArgs = arguments;
589
+ var extended = theArgs[0] || {};
590
+ var argLen = theArgs.length;
591
+ var deep = false;
592
+ var idx = 1;
593
+ if (argLen > 0 && isBoolean(extended)) {
594
+ deep = extended;
595
+ extended = theArgs[idx] || {};
596
+ idx++;
597
+ }
598
+ if (!isObject(extended)) {
599
+ extended = {};
600
+ }
601
+ for (; idx < argLen; idx++) {
602
+ var arg = theArgs[idx];
603
+ var isArgArray = isArray(arg);
604
+ var isArgObj = isObject(arg);
605
+ for (var prop in arg) {
606
+ var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
607
+ if (!propOk) {
608
+ continue;
609
+ }
610
+ var newValue = arg[prop];
611
+ var isNewArray = void 0;
612
+ if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
613
+ var clone = extended[prop];
614
+ if (isNewArray) {
615
+ if (!isArray(clone)) {
616
+ clone = [];
617
+ }
618
+ }
619
+ else if (!isPlainObject(clone)) {
620
+ clone = {};
621
+ }
622
+ newValue = objExtend(deep, clone, newValue);
623
+ }
624
+ if (newValue !== undefined) {
625
+ extended[prop] = newValue;
626
+ }
627
+ }
628
+ }
629
+ return extended;
630
+ }
811
631
 
812
- var strWindow = "window";
632
+ function createEnumStyle(values) {
633
+ var enumClass = {};
634
+ objForEachKey(values, function (field, value) {
635
+ enumClass[field] = value;
636
+ enumClass[value] = field;
637
+ });
638
+ return deepFreeze(enumClass);
639
+ }
640
+
641
+ var EventsDiscardedReason = createEnumStyle({
642
+ Unknown: 0 ,
643
+ NonRetryableStatus: 1 ,
644
+ InvalidEvent: 2 ,
645
+ SizeLimitExceeded: 3 ,
646
+ KillSwitch: 4 ,
647
+ QueueFull: 5
648
+ });
649
+
650
+ /*!
651
+ * Microsoft Dynamic Proto Utility, 1.1.4
652
+ * Copyright (c) Microsoft and contributors. All rights reserved.
653
+ */
654
+ var Constructor = 'constructor';
655
+ var Prototype = 'prototype';
656
+ var strFunction = 'function';
657
+ var DynInstFuncTable = '_dynInstFuncs';
658
+ var DynProxyTag = '_isDynProxy';
659
+ var DynClassName = '_dynClass';
660
+ var DynClassNamePrefix = '_dynCls$';
661
+ var DynInstChkTag = '_dynInstChk';
662
+ var DynAllowInstChkTag = DynInstChkTag;
663
+ var DynProtoDefaultOptions = '_dfOpts';
664
+ var UnknownValue = '_unknown_';
665
+ var str__Proto = "__proto__";
666
+ var strUseBaseInst = 'useBaseInst';
667
+ var strSetInstFuncs = 'setInstFuncs';
668
+ var Obj = Object;
669
+ var _objGetPrototypeOf = Obj["getPrototypeOf"];
670
+ var _dynamicNames = 0;
671
+ function _hasOwnProperty(obj, prop) {
672
+ return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
673
+ }
674
+ function _isObjectOrArrayPrototype(target) {
675
+ return target && (target === Obj[Prototype] || target === Array[Prototype]);
676
+ }
677
+ function _isObjectArrayOrFunctionPrototype(target) {
678
+ return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
679
+ }
680
+ function _getObjProto(target) {
681
+ if (target) {
682
+ if (_objGetPrototypeOf) {
683
+ return _objGetPrototypeOf(target);
684
+ }
685
+ var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
686
+ if (newProto) {
687
+ return newProto;
688
+ }
689
+ }
690
+ return null;
691
+ }
692
+ function _forEachProp(target, func) {
693
+ var props = [];
694
+ var getOwnProps = Obj["getOwnPropertyNames"];
695
+ if (getOwnProps) {
696
+ props = getOwnProps(target);
697
+ }
698
+ else {
699
+ for (var name_1 in target) {
700
+ if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
701
+ props.push(name_1);
702
+ }
703
+ }
704
+ }
705
+ if (props && props.length > 0) {
706
+ for (var lp = 0; lp < props.length; lp++) {
707
+ func(props[lp]);
708
+ }
709
+ }
710
+ }
711
+ function _isDynamicCandidate(target, funcName, skipOwn) {
712
+ return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
713
+ }
714
+ function _throwTypeError(message) {
715
+ throw new TypeError("DynamicProto: " + message);
716
+ }
717
+ function _getInstanceFuncs(thisTarget) {
718
+ var instFuncs = {};
719
+ _forEachProp(thisTarget, function (name) {
720
+ if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
721
+ instFuncs[name] = thisTarget[name];
722
+ }
723
+ });
724
+ return instFuncs;
725
+ }
726
+ function _hasVisited(values, value) {
727
+ for (var lp = values.length - 1; lp >= 0; lp--) {
728
+ if (values[lp] === value) {
729
+ return true;
730
+ }
731
+ }
732
+ return false;
733
+ }
734
+ function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
735
+ function _instFuncProxy(target, funcHost, funcName) {
736
+ var theFunc = funcHost[funcName];
737
+ if (theFunc[DynProxyTag] && useBaseInst) {
738
+ var instFuncTable = target[DynInstFuncTable] || {};
739
+ if (instFuncTable[DynAllowInstChkTag] !== false) {
740
+ theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
741
+ }
742
+ }
743
+ return function () {
744
+ return theFunc.apply(target, arguments);
745
+ };
746
+ }
747
+ var baseFuncs = {};
748
+ _forEachProp(instFuncs, function (name) {
749
+ baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
750
+ });
751
+ var baseProto = _getObjProto(classProto);
752
+ var visited = [];
753
+ while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
754
+ _forEachProp(baseProto, function (name) {
755
+ if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
756
+ baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
757
+ }
758
+ });
759
+ visited.push(baseProto);
760
+ baseProto = _getObjProto(baseProto);
761
+ }
762
+ return baseFuncs;
763
+ }
764
+ function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
765
+ var instFunc = null;
766
+ if (target && _hasOwnProperty(proto, DynClassName)) {
767
+ var instFuncTable = target[DynInstFuncTable] || {};
768
+ instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
769
+ if (!instFunc) {
770
+ _throwTypeError("Missing [" + funcName + "] " + strFunction);
771
+ }
772
+ if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
773
+ var canAddInst = !_hasOwnProperty(target, funcName);
774
+ var objProto = _getObjProto(target);
775
+ var visited = [];
776
+ while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
777
+ var protoFunc = objProto[funcName];
778
+ if (protoFunc) {
779
+ canAddInst = (protoFunc === currentDynProtoProxy);
780
+ break;
781
+ }
782
+ visited.push(objProto);
783
+ objProto = _getObjProto(objProto);
784
+ }
785
+ try {
786
+ if (canAddInst) {
787
+ target[funcName] = instFunc;
788
+ }
789
+ instFunc[DynInstChkTag] = 1;
790
+ }
791
+ catch (e) {
792
+ instFuncTable[DynAllowInstChkTag] = false;
793
+ }
794
+ }
795
+ }
796
+ return instFunc;
797
+ }
798
+ function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
799
+ var protoFunc = proto[funcName];
800
+ if (protoFunc === currentDynProtoProxy) {
801
+ protoFunc = _getObjProto(proto)[funcName];
802
+ }
803
+ if (typeof protoFunc !== strFunction) {
804
+ _throwTypeError("[" + funcName + "] is not a " + strFunction);
805
+ }
806
+ return protoFunc;
807
+ }
808
+ function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
809
+ function _createDynamicPrototype(proto, funcName) {
810
+ var dynProtoProxy = function () {
811
+ var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
812
+ return instFunc.apply(this, arguments);
813
+ };
814
+ dynProtoProxy[DynProxyTag] = 1;
815
+ return dynProtoProxy;
816
+ }
817
+ if (!_isObjectOrArrayPrototype(proto)) {
818
+ var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
819
+ var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
820
+ if (instFuncTable[DynAllowInstChkTag] !== false) {
821
+ instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
822
+ }
823
+ _forEachProp(target, function (name) {
824
+ if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
825
+ instFuncs_1[name] = target[name];
826
+ delete target[name];
827
+ if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
828
+ proto[name] = _createDynamicPrototype(proto, name);
829
+ }
830
+ }
831
+ });
832
+ }
833
+ }
834
+ function _checkPrototype(classProto, thisTarget) {
835
+ if (_objGetPrototypeOf) {
836
+ var visited = [];
837
+ var thisProto = _getObjProto(thisTarget);
838
+ while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
839
+ if (thisProto === classProto) {
840
+ return true;
841
+ }
842
+ visited.push(thisProto);
843
+ thisProto = _getObjProto(thisProto);
844
+ }
845
+ }
846
+ return false;
847
+ }
848
+ function _getObjName(target, unknownValue) {
849
+ if (_hasOwnProperty(target, Prototype)) {
850
+ return target.name || unknownValue || UnknownValue;
851
+ }
852
+ return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
853
+ }
854
+ function dynamicProto(theClass, target, delegateFunc, options) {
855
+ if (!_hasOwnProperty(theClass, Prototype)) {
856
+ _throwTypeError("theClass is an invalid class definition.");
857
+ }
858
+ var classProto = theClass[Prototype];
859
+ if (!_checkPrototype(classProto, target)) {
860
+ _throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
861
+ }
862
+ var className = null;
863
+ if (_hasOwnProperty(classProto, DynClassName)) {
864
+ className = classProto[DynClassName];
865
+ }
866
+ else {
867
+ className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
868
+ _dynamicNames++;
869
+ classProto[DynClassName] = className;
870
+ }
871
+ var perfOptions = dynamicProto[DynProtoDefaultOptions];
872
+ var useBaseInst = !!perfOptions[strUseBaseInst];
873
+ if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
874
+ useBaseInst = !!options[strUseBaseInst];
875
+ }
876
+ var instFuncs = _getInstanceFuncs(target);
877
+ var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
878
+ delegateFunc(target, baseFuncs);
879
+ var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
880
+ if (setInstanceFunc && options) {
881
+ setInstanceFunc = !!options[strSetInstFuncs];
882
+ }
883
+ _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
884
+ }
885
+ var perfDefaults = {
886
+ setInstFuncs: true,
887
+ useBaseInst: true
888
+ };
889
+ dynamicProto[DynProtoDefaultOptions] = perfDefaults;
890
+
891
+ var strWindow = "window";
813
892
  var strDocument = "document";
893
+ var strDocumentMode = "documentMode";
814
894
  var strNavigator = "navigator";
815
895
  var strHistory = "history";
816
896
  var strLocation = "location";
@@ -822,6 +902,7 @@
822
902
  var strReactNative = "ReactNative";
823
903
  var strMsie = "msie";
824
904
  var strTrident = "trident/";
905
+ var strXMLHttpRequest = "XMLHttpRequest";
825
906
  var _isTrident = null;
826
907
  var _navUserAgentCheck = null;
827
908
  var _enableMocks = false;
@@ -948,7 +1029,7 @@
948
1029
  var nav = getNavigator();
949
1030
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
950
1031
  _navUserAgentCheck = nav.userAgent;
951
- var userAgent = (_navUserAgentCheck || "").toLowerCase();
1032
+ var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
952
1033
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
953
1034
  }
954
1035
  return _isTrident;
@@ -957,11 +1038,12 @@
957
1038
  if (userAgentStr === void 0) { userAgentStr = null; }
958
1039
  if (!userAgentStr) {
959
1040
  var navigator_1 = getNavigator() || {};
960
- userAgentStr = navigator_1 ? (navigator_1.userAgent || "").toLowerCase() : "";
1041
+ userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty).toLowerCase() : strEmpty;
961
1042
  }
962
- var ua = (userAgentStr || "").toLowerCase();
1043
+ var ua = (userAgentStr || strEmpty).toLowerCase();
963
1044
  if (strContains(ua, strMsie)) {
964
- return parseInt(ua.split(strMsie)[1]);
1045
+ var doc = getDocument() || {};
1046
+ return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
965
1047
  }
966
1048
  else if (strContains(ua, strTrident)) {
967
1049
  var tridentVer = parseInt(ua.split(strTrident)[1]);
@@ -973,7 +1055,7 @@
973
1055
  }
974
1056
  function dumpObj(object) {
975
1057
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
976
- var propertyValueDump = "";
1058
+ var propertyValueDump = strEmpty;
977
1059
  if (objectTypeDump === "[object Error]") {
978
1060
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
979
1061
  }
@@ -991,8 +1073,7 @@
991
1073
  function isFetchSupported(withKeepAlive) {
992
1074
  var isSupported = false;
993
1075
  try {
994
- var fetchApi = getGlobalInst("fetch");
995
- isSupported = !!fetchApi;
1076
+ isSupported = !!getGlobalInst("fetch");
996
1077
  var request = getGlobalInst("Request");
997
1078
  if (isSupported && withKeepAlive && request) {
998
1079
  isSupported = _hasProperty(request, "keepalive");
@@ -1004,9 +1085,9 @@
1004
1085
  }
1005
1086
  function useXDomainRequest() {
1006
1087
  if (_useXDomainRequest === null) {
1007
- _useXDomainRequest = (typeof XDomainRequest !== undefined);
1088
+ _useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);
1008
1089
  if (_useXDomainRequest && isXhrSupported()) {
1009
- _useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst("XMLHttpRequest"), "withCredentials");
1090
+ _useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(strXMLHttpRequest), "withCredentials");
1010
1091
  }
1011
1092
  }
1012
1093
  return _useXDomainRequest;
@@ -1014,7 +1095,7 @@
1014
1095
  function isXhrSupported() {
1015
1096
  var isSupported = false;
1016
1097
  try {
1017
- var xmlHttpRequest = getGlobalInst("XMLHttpRequest");
1098
+ var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);
1018
1099
  isSupported = !!xmlHttpRequest;
1019
1100
  }
1020
1101
  catch (e) {
@@ -1022,16 +1103,55 @@
1022
1103
  return isSupported;
1023
1104
  }
1024
1105
 
1025
- var AiNonUserActionablePrefix = "AI (Internal): ";
1026
- var AiUserActionablePrefix = "AI: ";
1027
- var AIInternalMessagePrefix = "AITR_";
1028
- var strErrorToConsole = "errorToConsole";
1029
- var strWarnToConsole = "warnToConsole";
1030
- function _sanitizeDiagnosticText(text) {
1031
- if (text) {
1032
- return "\"" + text.replace(/\"/g, "") + "\"";
1033
- }
1034
- return "";
1106
+ var listenerFuncs = ["eventsSent", "eventsDiscarded", "eventsSendRequest", "perfEvent"];
1107
+ var _aiNamespace = null;
1108
+ var _debugListener;
1109
+ function _listenerProxyFunc(name, config) {
1110
+ return function () {
1111
+ var args = arguments;
1112
+ var dbgExt = getDebugExt(config);
1113
+ if (dbgExt) {
1114
+ var listener = dbgExt.listener;
1115
+ if (listener && listener[name]) {
1116
+ listener[name].apply(listener, args);
1117
+ }
1118
+ }
1119
+ };
1120
+ }
1121
+ function _getExtensionNamespace() {
1122
+ var target = getGlobalInst("Microsoft");
1123
+ if (target) {
1124
+ _aiNamespace = target["ApplicationInsights"];
1125
+ }
1126
+ return _aiNamespace;
1127
+ }
1128
+ function getDebugExt(config) {
1129
+ var ns = _aiNamespace;
1130
+ if (!ns && config.disableDbgExt !== true) {
1131
+ ns = _aiNamespace || _getExtensionNamespace();
1132
+ }
1133
+ return ns ? ns["ChromeDbgExt"] : null;
1134
+ }
1135
+ function getDebugListener(config) {
1136
+ if (!_debugListener) {
1137
+ _debugListener = {};
1138
+ for (var lp = 0; lp < listenerFuncs.length; lp++) {
1139
+ _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);
1140
+ }
1141
+ }
1142
+ return _debugListener;
1143
+ }
1144
+
1145
+ var AiNonUserActionablePrefix = "AI (Internal): ";
1146
+ var AiUserActionablePrefix = "AI: ";
1147
+ var AIInternalMessagePrefix = "AITR_";
1148
+ var strErrorToConsole = "errorToConsole";
1149
+ var strWarnToConsole = "warnToConsole";
1150
+ function _sanitizeDiagnosticText(text) {
1151
+ if (text) {
1152
+ return "\"" + text.replace(/\"/g, strEmpty) + "\"";
1153
+ }
1154
+ return strEmpty;
1035
1155
  }
1036
1156
  function _logToConsole(func, message) {
1037
1157
  var theConsole = getConsole();
@@ -1053,12 +1173,12 @@
1053
1173
  _self.message =
1054
1174
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
1055
1175
  msgId;
1056
- var strProps = "";
1176
+ var strProps = strEmpty;
1057
1177
  if (hasJSON()) {
1058
1178
  strProps = getJSON().stringify(properties);
1059
1179
  }
1060
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
1061
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
1180
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty) +
1181
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty);
1062
1182
  _self.message += diagnosticText;
1063
1183
  }
1064
1184
  _InternalLogMessage.dataType = "MessageData";
@@ -1088,7 +1208,7 @@
1088
1208
  throw message;
1089
1209
  }
1090
1210
  else {
1091
- var logFunc = severity === exports.LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
1211
+ var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
1092
1212
  if (!isUndefined(message.message)) {
1093
1213
  var logLevel = _self.consoleLoggingLevel();
1094
1214
  if (isUserAct) {
@@ -1105,13 +1225,18 @@
1105
1225
  }
1106
1226
  _self.logInternalMessage(severity, message);
1107
1227
  }
1228
+ else {
1229
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
1230
+ }
1108
1231
  }
1109
1232
  };
1110
1233
  _self.warnToConsole = function (message) {
1111
1234
  _logToConsole("warn", message);
1235
+ _debugExtMsg("warning", message);
1112
1236
  };
1113
1237
  _self.errorToConsole = function (message) {
1114
1238
  _logToConsole("error", message);
1239
+ _debugExtMsg("error", message);
1115
1240
  };
1116
1241
  _self.resetInternalMessageCount = function () {
1117
1242
  _messageCount = 0;
@@ -1133,12 +1258,18 @@
1133
1258
  if (severity <= _self.telemetryLoggingLevel()) {
1134
1259
  _self.queue.push(message);
1135
1260
  _messageCount++;
1261
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
1136
1262
  }
1137
1263
  if (_messageCount === _self.maxInternalMessageLimit()) {
1138
1264
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
1139
- var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
1265
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
1140
1266
  _self.queue.push(throttleMessage);
1141
- _self.warnToConsole(throttleLimitMessage);
1267
+ if (severity === 1 ) {
1268
+ _self.errorToConsole(throttleLimitMessage);
1269
+ }
1270
+ else {
1271
+ _self.warnToConsole(throttleLimitMessage);
1272
+ }
1142
1273
  }
1143
1274
  }
1144
1275
  };
@@ -1152,10 +1283,26 @@
1152
1283
  function _areInternalMessagesThrottled() {
1153
1284
  return _messageCount >= _self.maxInternalMessageLimit();
1154
1285
  }
1286
+ function _debugExtMsg(name, data) {
1287
+ var dbgExt = getDebugExt(config);
1288
+ if (dbgExt && dbgExt.diagLog) {
1289
+ dbgExt.diagLog(name, data);
1290
+ }
1291
+ }
1155
1292
  });
1156
1293
  }
1157
1294
  return DiagnosticLogger;
1158
1295
  }());
1296
+ function _getLogger(logger) {
1297
+ return (logger || new DiagnosticLogger());
1298
+ }
1299
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
1300
+ if (isUserAct === void 0) { isUserAct = false; }
1301
+ (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
1302
+ }
1303
+ function _warnToConsole(logger, message) {
1304
+ _getLogger(logger).warnToConsole(message);
1305
+ }
1159
1306
 
1160
1307
  var strExecutionContextKey = "ctx";
1161
1308
  var _defaultPerfManager = null;
@@ -1301,271 +1448,186 @@
1301
1448
  return _defaultPerfManager;
1302
1449
  }
1303
1450
 
1304
- var TelemetryPluginChain = /** @class */ (function () {
1305
- function TelemetryPluginChain(plugin, defItemCtx) {
1306
- var _self = this;
1307
- var _nextProxy = null;
1308
- var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
1309
- var _hasSetNext = isFunction(plugin.setNextPlugin);
1310
- _self._hasRun = false;
1311
- _self.getPlugin = function () {
1312
- return plugin;
1313
- };
1314
- _self.getNext = function () {
1315
- return _nextProxy;
1316
- };
1317
- _self.setNext = function (nextPlugin) {
1318
- _nextProxy = nextPlugin;
1319
- };
1320
- _self.processTelemetry = function (env, itemCtx) {
1321
- if (!itemCtx) {
1322
- itemCtx = defItemCtx;
1323
- }
1324
- var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
1325
- doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
1326
- if (plugin && _hasProcessTelemetry) {
1327
- _self._hasRun = true;
1328
- try {
1329
- itemCtx.setNext(_nextProxy);
1330
- if (_hasSetNext) {
1331
- plugin.setNextPlugin(_nextProxy);
1332
- }
1333
- _nextProxy && (_nextProxy._hasRun = false);
1334
- plugin.processTelemetry(env, itemCtx);
1335
- }
1336
- catch (error) {
1337
- var hasRun = _nextProxy && _nextProxy._hasRun;
1338
- if (!_nextProxy || !hasRun) {
1339
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
1340
- }
1341
- if (_nextProxy && !hasRun) {
1342
- _nextProxy.processTelemetry(env, itemCtx);
1343
- }
1344
- }
1345
- }
1346
- else if (_nextProxy) {
1347
- _self._hasRun = true;
1348
- _nextProxy.processTelemetry(env, itemCtx);
1349
- }
1350
- }, function () { return ({ item: env }); }, !(env.sync));
1351
- };
1451
+ var UInt32Mask = 0x100000000;
1452
+ var MaxUInt32 = 0xffffffff;
1453
+ var _mwcSeeded = false;
1454
+ var _mwcW = 123456789;
1455
+ var _mwcZ = 987654321;
1456
+ function _mwcSeed(seedValue) {
1457
+ if (seedValue < 0) {
1458
+ seedValue >>>= 0;
1352
1459
  }
1353
- return TelemetryPluginChain;
1354
- }());
1355
-
1356
- function _createProxyChain(plugins, itemCtx) {
1357
- var proxies = [];
1358
- if (plugins && plugins.length > 0) {
1359
- var lastProxy = null;
1360
- for (var idx = 0; idx < plugins.length; idx++) {
1361
- var thePlugin = plugins[idx];
1362
- if (thePlugin && isFunction(thePlugin.processTelemetry)) {
1363
- var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
1364
- proxies.push(newProxy);
1365
- if (lastProxy) {
1366
- lastProxy.setNext(newProxy);
1367
- }
1368
- lastProxy = newProxy;
1369
- }
1370
- }
1460
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1461
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1462
+ _mwcSeeded = true;
1463
+ }
1464
+ function _autoSeedMwc() {
1465
+ try {
1466
+ var now = dateNow() & 0x7fffffff;
1467
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1468
+ }
1469
+ catch (e) {
1371
1470
  }
1372
- return proxies.length > 0 ? proxies[0] : null;
1373
1471
  }
1374
- function _copyProxyChain(proxy, itemCtx, startAt) {
1375
- var plugins = [];
1376
- var add = startAt ? false : true;
1377
- if (proxy) {
1378
- while (proxy) {
1379
- var thePlugin = proxy.getPlugin();
1380
- if (add || thePlugin === startAt) {
1381
- add = true;
1382
- plugins.push(thePlugin);
1383
- }
1384
- proxy = proxy.getNext();
1472
+ function randomValue(maxValue) {
1473
+ if (maxValue > 0) {
1474
+ return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
1475
+ }
1476
+ return 0;
1477
+ }
1478
+ function random32(signed) {
1479
+ var value = 0;
1480
+ var c = getCrypto() || getMsCrypto();
1481
+ if (c && c.getRandomValues) {
1482
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1483
+ }
1484
+ if (value === 0 && isIE()) {
1485
+ if (!_mwcSeeded) {
1486
+ _autoSeedMwc();
1385
1487
  }
1488
+ value = mwcRandom32() & MaxUInt32;
1386
1489
  }
1387
- if (!add) {
1388
- plugins.push(startAt);
1490
+ if (value === 0) {
1491
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1492
+ }
1493
+ if (!signed) {
1494
+ value >>>= 0;
1389
1495
  }
1390
- return _createProxyChain(plugins, itemCtx);
1496
+ return value;
1391
1497
  }
1392
- function _copyPluginChain(srcPlugins, itemCtx, startAt) {
1393
- var plugins = srcPlugins;
1394
- var add = false;
1395
- if (startAt && srcPlugins) {
1396
- plugins = [];
1397
- arrForEach(srcPlugins, function (thePlugin) {
1398
- if (add || thePlugin === startAt) {
1399
- add = true;
1400
- plugins.push(thePlugin);
1401
- }
1402
- });
1498
+ function mwcRandomSeed(value) {
1499
+ if (!value) {
1500
+ _autoSeedMwc();
1501
+ }
1502
+ else {
1503
+ _mwcSeed(value);
1504
+ }
1505
+ }
1506
+ function mwcRandom32(signed) {
1507
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1508
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1509
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1510
+ if (!signed) {
1511
+ value >>>= 0;
1403
1512
  }
1404
- if (startAt && !add) {
1405
- if (!plugins) {
1406
- plugins = [];
1513
+ return value;
1514
+ }
1515
+ function newId(maxLength) {
1516
+ if (maxLength === void 0) { maxLength = 22; }
1517
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1518
+ var number = random32() >>> 0;
1519
+ var chars = 0;
1520
+ var result = strEmpty;
1521
+ while (result.length < maxLength) {
1522
+ chars++;
1523
+ result += base64chars.charAt(number & 0x3F);
1524
+ number >>>= 6;
1525
+ if (chars === 5) {
1526
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1527
+ chars = 0;
1407
1528
  }
1408
- plugins.push(startAt);
1409
1529
  }
1410
- return _createProxyChain(plugins, itemCtx);
1530
+ return result;
1411
1531
  }
1412
- var ProcessTelemetryContext = /** @class */ (function () {
1413
- function ProcessTelemetryContext(plugins, config, core, startAt) {
1414
- var _self = this;
1415
- var _nextProxy = null;
1416
- if (startAt !== null) {
1417
- if (plugins && isFunction(plugins.getPlugin)) {
1418
- _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
1419
- }
1420
- else {
1421
- if (startAt) {
1422
- _nextProxy = _copyPluginChain(plugins, _self, startAt);
1423
- }
1424
- else if (isUndefined(startAt)) {
1425
- _nextProxy = _createProxyChain(plugins, _self);
1426
- }
1427
- }
1532
+
1533
+ var _objDefineProperty = ObjDefineProperty;
1534
+ var version = "2.8.0";
1535
+ var instanceName = "." + newId(6);
1536
+ var _dataUid = 0;
1537
+ function _createAccessor(target, prop, value) {
1538
+ if (_objDefineProperty) {
1539
+ try {
1540
+ _objDefineProperty(target, prop, {
1541
+ value: value,
1542
+ enumerable: false,
1543
+ configurable: true
1544
+ });
1545
+ return true;
1428
1546
  }
1429
- _self.core = function () {
1430
- return core;
1431
- };
1432
- _self.diagLog = function () {
1433
- return safeGetLogger(core, config);
1434
- };
1435
- _self.getCfg = function () {
1436
- return config;
1437
- };
1438
- _self.getExtCfg = function (identifier, defaultValue) {
1439
- if (defaultValue === void 0) { defaultValue = {}; }
1440
- var theConfig;
1441
- if (config) {
1442
- var extConfig = config.extensionConfig;
1443
- if (extConfig && identifier) {
1444
- theConfig = extConfig[identifier];
1547
+ catch (e) {
1548
+ }
1549
+ }
1550
+ return false;
1551
+ }
1552
+ function _canAcceptData(target) {
1553
+ return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
1554
+ }
1555
+ function _getCache(data, target) {
1556
+ var theCache = target[data.id];
1557
+ if (!theCache) {
1558
+ theCache = {};
1559
+ try {
1560
+ if (_canAcceptData(target)) {
1561
+ if (!_createAccessor(target, data.id, theCache)) {
1562
+ target[data.id] = theCache;
1445
1563
  }
1446
1564
  }
1447
- return (theConfig ? theConfig : defaultValue);
1448
- };
1449
- _self.getConfig = function (identifier, field, defaultValue) {
1450
- if (defaultValue === void 0) { defaultValue = false; }
1451
- var theValue;
1452
- var extConfig = _self.getExtCfg(identifier, null);
1453
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
1454
- theValue = extConfig[field];
1455
- }
1456
- else if (config && !isNullOrUndefined(config[field])) {
1457
- theValue = config[field];
1458
- }
1459
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1460
- };
1461
- _self.hasNext = function () {
1462
- return _nextProxy != null;
1463
- };
1464
- _self.getNext = function () {
1465
- return _nextProxy;
1466
- };
1467
- _self.setNext = function (nextPlugin) {
1468
- _nextProxy = nextPlugin;
1469
- };
1470
- _self.processNext = function (env) {
1471
- var nextPlugin = _nextProxy;
1472
- if (nextPlugin) {
1473
- _nextProxy = nextPlugin.getNext();
1474
- nextPlugin.processTelemetry(env, _self);
1475
- }
1476
- };
1477
- _self.createNew = function (plugins, startAt) {
1478
- if (plugins === void 0) { plugins = null; }
1479
- return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1480
- };
1565
+ }
1566
+ catch (e) {
1567
+ }
1481
1568
  }
1482
- return ProcessTelemetryContext;
1483
- }());
1484
-
1485
- var strIKey = "iKey";
1486
- var strExtensionConfig = "extensionConfig";
1487
-
1488
- var strGetPlugin = "getPlugin";
1489
- var BaseTelemetryPlugin = /** @class */ (function () {
1490
- function BaseTelemetryPlugin() {
1491
- var _self = this;
1492
- var _isinitialized = false;
1493
- var _rootCtx = null;
1494
- var _nextPlugin = null;
1495
- _self.core = null;
1496
- _self.diagLog = function (itemCtx) {
1497
- return _self._getTelCtx(itemCtx).diagLog();
1498
- };
1499
- _self.isInitialized = function () {
1500
- return _isinitialized;
1501
- };
1502
- _self.setInitialized = function (isInitialized) {
1503
- _isinitialized = isInitialized;
1504
- };
1505
- _self.setNextPlugin = function (next) {
1506
- _nextPlugin = next;
1507
- };
1508
- _self.processNext = function (env, itemCtx) {
1509
- if (itemCtx) {
1510
- itemCtx.processNext(env);
1511
- }
1512
- else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
1513
- _nextPlugin.processTelemetry(env, null);
1569
+ return theCache;
1570
+ }
1571
+ function createUniqueNamespace(name, includeVersion) {
1572
+ if (includeVersion === void 0) { includeVersion = false; }
1573
+ return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
1574
+ }
1575
+ function createElmNodeData(name) {
1576
+ var data = {
1577
+ id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
1578
+ accept: function (target) {
1579
+ return _canAcceptData(target);
1580
+ },
1581
+ get: function (target, name, defValue, addDefault) {
1582
+ var theCache = target[data.id];
1583
+ if (!theCache) {
1584
+ if (addDefault) {
1585
+ theCache = _getCache(data, target);
1586
+ theCache[normalizeJsName(name)] = defValue;
1587
+ }
1588
+ return defValue;
1514
1589
  }
1515
- };
1516
- _self._getTelCtx = function (currentCtx) {
1517
- if (currentCtx === void 0) { currentCtx = null; }
1518
- var itemCtx = currentCtx;
1519
- if (!itemCtx) {
1520
- var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
1521
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1522
- itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1590
+ return theCache[normalizeJsName(name)];
1591
+ },
1592
+ kill: function (target, name) {
1593
+ if (target && target[name]) {
1594
+ try {
1595
+ delete target[name];
1523
1596
  }
1524
- else {
1525
- itemCtx = rootCtx.createNew(null, _nextPlugin);
1597
+ catch (e) {
1526
1598
  }
1527
1599
  }
1528
- return itemCtx;
1529
- };
1530
- _self._baseTelInit = function (config, core, extensions, pluginChain) {
1531
- if (config) {
1532
- setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1533
- }
1534
- if (!pluginChain && core) {
1535
- pluginChain = core.getProcessTelContext().getNext();
1536
- }
1537
- var nextPlugin = _nextPlugin;
1538
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1539
- nextPlugin = _nextPlugin[strGetPlugin]();
1540
- }
1541
- _self.core = core;
1542
- _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1543
- _isinitialized = true;
1544
- };
1545
- }
1546
- BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
1547
- this._baseTelInit(config, core, extensions, pluginChain);
1600
+ }
1548
1601
  };
1549
- return BaseTelemetryPlugin;
1550
- }());
1602
+ return data;
1603
+ }
1551
1604
 
1552
- var processTelemetry = "processTelemetry";
1553
- var priority = "priority";
1554
- var setNextPlugin = "setNextPlugin";
1555
- var isInitialized = "isInitialized";
1605
+ var pluginStateData = createElmNodeData("plugin");
1606
+ function _getPluginState(plugin) {
1607
+ return pluginStateData.get(plugin, "state", {}, true);
1608
+ }
1556
1609
  function initializePlugins(processContext, extensions) {
1557
1610
  var initPlugins = [];
1558
1611
  var lastPlugin = null;
1559
1612
  var proxy = processContext.getNext();
1613
+ var pluginState;
1560
1614
  while (proxy) {
1561
1615
  var thePlugin = proxy.getPlugin();
1562
1616
  if (thePlugin) {
1563
1617
  if (lastPlugin &&
1564
- isFunction(lastPlugin[setNextPlugin]) &&
1565
- isFunction(thePlugin[processTelemetry])) {
1566
- lastPlugin[setNextPlugin](thePlugin);
1618
+ isFunction(lastPlugin[strSetNextPlugin]) &&
1619
+ isFunction(thePlugin[strProcessTelemetry])) {
1620
+ lastPlugin[strSetNextPlugin](thePlugin);
1567
1621
  }
1568
- if (!isFunction(thePlugin[isInitialized]) || !thePlugin[isInitialized]()) {
1622
+ var isInitialized = false;
1623
+ if (isFunction(thePlugin[strIsInitialized])) {
1624
+ isInitialized = thePlugin[strIsInitialized]();
1625
+ }
1626
+ else {
1627
+ pluginState = _getPluginState(thePlugin);
1628
+ isInitialized = pluginState[strIsInitialized];
1629
+ }
1630
+ if (!isInitialized) {
1569
1631
  initPlugins.push(thePlugin);
1570
1632
  }
1571
1633
  lastPlugin = thePlugin;
@@ -1573,15 +1635,22 @@
1573
1635
  }
1574
1636
  }
1575
1637
  arrForEach(initPlugins, function (thePlugin) {
1576
- thePlugin.initialize(processContext.getCfg(), processContext.core(), extensions, processContext.getNext());
1638
+ var core = processContext.core();
1639
+ thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
1640
+ pluginState = _getPluginState(thePlugin);
1641
+ if (!thePlugin[strCore] && !pluginState[strCore]) {
1642
+ pluginState[strCore] = core;
1643
+ }
1644
+ pluginState[strIsInitialized] = true;
1645
+ delete pluginState[strTeardown];
1577
1646
  });
1578
1647
  }
1579
1648
  function sortPlugins(plugins) {
1580
1649
  return plugins.sort(function (extA, extB) {
1581
1650
  var result = 0;
1582
- var bHasProcess = isFunction(extB[processTelemetry]);
1583
- if (isFunction(extA[processTelemetry])) {
1584
- result = bHasProcess ? extA[priority] - extB[priority] : 1;
1651
+ var bHasProcess = isFunction(extB[strProcessTelemetry]);
1652
+ if (isFunction(extA[strProcessTelemetry])) {
1653
+ result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
1585
1654
  }
1586
1655
  else if (bHasProcess) {
1587
1656
  result = -1;
@@ -1590,80 +1659,361 @@
1590
1659
  });
1591
1660
  }
1592
1661
 
1593
- var ChannelControllerPriority = 500;
1594
- var ChannelValidationMessage = "Channel has invalid priority";
1595
- var ChannelController = /** @class */ (function (_super) {
1596
- __extendsFn(ChannelController, _super);
1597
- function ChannelController() {
1598
- var _this = _super.call(this) || this;
1599
- _this.identifier = "ChannelControllerPlugin";
1600
- _this.priority = ChannelControllerPriority;
1601
- var _channelQueue;
1602
- dynamicProto(ChannelController, _this, function (_self, _base) {
1603
- _self.setNextPlugin = function (next) {
1604
- };
1605
- _self.processTelemetry = function (item, itemCtx) {
1606
- if (_channelQueue) {
1607
- arrForEach(_channelQueue, function (queues) {
1608
- if (queues.length > 0) {
1609
- var chainCtx = _this._getTelCtx(itemCtx).createNew(queues);
1610
- chainCtx.processNext(item);
1611
- }
1612
- });
1613
- }
1614
- };
1615
- _self.getChannelControls = function () {
1616
- return _channelQueue;
1617
- };
1618
- _self.initialize = function (config, core, extensions) {
1619
- if (_self.isInitialized()) {
1620
- return;
1621
- }
1622
- _base.initialize(config, core, extensions);
1623
- _createChannelQueues((config || {}).channels, extensions);
1624
- arrForEach(_channelQueue, function (queue) { return initializePlugins(new ProcessTelemetryContext(queue, config, core), extensions); });
1625
- };
1626
- });
1627
- function _checkQueuePriority(queue) {
1628
- arrForEach(queue, function (queueItem) {
1629
- if (queueItem.priority < ChannelControllerPriority) {
1630
- throwError(ChannelValidationMessage + queueItem.identifier);
1631
- }
1662
+ var strTelemetryPluginChain = "TelemetryPluginChain";
1663
+ var strHasRunFlags = "_hasRun";
1664
+ var strGetTelCtx = "_getTelCtx";
1665
+ var _chainId = 0;
1666
+ function _getNextProxyStart(proxy, core, startAt) {
1667
+ while (proxy) {
1668
+ if (proxy.getPlugin() === startAt) {
1669
+ return proxy;
1670
+ }
1671
+ proxy = proxy.getNext();
1672
+ }
1673
+ return createTelemetryProxyChain([startAt], core.config || {}, core);
1674
+ }
1675
+ function _createInternalContext(telemetryChain, config, core, startAt) {
1676
+ var _nextProxy = null;
1677
+ var _onComplete = [];
1678
+ if (startAt !== null) {
1679
+ _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
1680
+ }
1681
+ var context = {
1682
+ _next: _moveNext,
1683
+ ctx: {
1684
+ core: function () {
1685
+ return core;
1686
+ },
1687
+ diagLog: function () {
1688
+ return safeGetLogger(core, config);
1689
+ },
1690
+ getCfg: function () {
1691
+ return config;
1692
+ },
1693
+ getExtCfg: _getExtCfg,
1694
+ getConfig: _getConfig,
1695
+ hasNext: function () {
1696
+ return !!_nextProxy;
1697
+ },
1698
+ getNext: function () {
1699
+ return _nextProxy;
1700
+ },
1701
+ setNext: function (nextPlugin) {
1702
+ _nextProxy = nextPlugin;
1703
+ },
1704
+ iterate: _iterateChain,
1705
+ onComplete: _addOnComplete
1706
+ }
1707
+ };
1708
+ function _addOnComplete(onComplete, that) {
1709
+ var args = [];
1710
+ for (var _i = 2; _i < arguments.length; _i++) {
1711
+ args[_i - 2] = arguments[_i];
1712
+ }
1713
+ if (onComplete) {
1714
+ _onComplete.push({
1715
+ func: onComplete,
1716
+ self: !isUndefined(that) ? that : context.ctx,
1717
+ args: args
1632
1718
  });
1633
1719
  }
1634
- function _addChannelQueue(queue) {
1635
- if (queue && queue.length > 0) {
1636
- queue = queue.sort(function (a, b) {
1637
- return a.priority - b.priority;
1720
+ }
1721
+ function _moveNext() {
1722
+ var nextProxy = _nextProxy;
1723
+ _nextProxy = nextProxy ? nextProxy.getNext() : null;
1724
+ if (!nextProxy) {
1725
+ var onComplete = _onComplete;
1726
+ if (onComplete && onComplete.length > 0) {
1727
+ arrForEach(onComplete, function (completeDetails) {
1728
+ try {
1729
+ completeDetails.func.call(completeDetails.self, completeDetails.args);
1730
+ }
1731
+ catch (e) {
1732
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1733
+ }
1638
1734
  });
1639
- _checkQueuePriority(queue);
1640
- _channelQueue.push(queue);
1735
+ _onComplete = [];
1641
1736
  }
1642
1737
  }
1643
- function _createChannelQueues(channels, extensions) {
1644
- _channelQueue = [];
1645
- if (channels) {
1646
- arrForEach(channels, function (queue) { return _addChannelQueue(queue); });
1738
+ return nextProxy;
1739
+ }
1740
+ function _getExtCfg(identifier, defaultValue, mergeDefault) {
1741
+ if (defaultValue === void 0) { defaultValue = {}; }
1742
+ if (mergeDefault === void 0) { mergeDefault = 0 ; }
1743
+ var theConfig;
1744
+ if (config) {
1745
+ var extConfig = config.extensionConfig;
1746
+ if (extConfig && identifier) {
1747
+ theConfig = extConfig[identifier];
1647
1748
  }
1648
- if (extensions) {
1649
- var extensionQueue_1 = [];
1650
- arrForEach(extensions, function (plugin) {
1651
- if (plugin.priority > ChannelControllerPriority) {
1652
- extensionQueue_1.push(plugin);
1653
- }
1654
- });
1655
- _addChannelQueue(extensionQueue_1);
1749
+ }
1750
+ if (!theConfig) {
1751
+ theConfig = defaultValue;
1752
+ }
1753
+ else if (isObject(defaultValue)) {
1754
+ if (mergeDefault !== 0 ) {
1755
+ var newConfig_1 = objExtend(true, defaultValue, theConfig);
1756
+ if (config && mergeDefault === 2 ) {
1757
+ objForEachKey(defaultValue, function (field) {
1758
+ if (isNullOrUndefined(newConfig_1[field])) {
1759
+ var cfgValue = config[field];
1760
+ if (!isNullOrUndefined(cfgValue)) {
1761
+ newConfig_1[field] = cfgValue;
1762
+ }
1763
+ }
1764
+ });
1765
+ }
1766
+ theConfig = newConfig_1;
1767
+ }
1768
+ }
1769
+ return theConfig;
1770
+ }
1771
+ function _getConfig(identifier, field, defaultValue) {
1772
+ if (defaultValue === void 0) { defaultValue = false; }
1773
+ var theValue;
1774
+ var extConfig = _getExtCfg(identifier, null);
1775
+ if (extConfig && !isNullOrUndefined(extConfig[field])) {
1776
+ theValue = extConfig[field];
1777
+ }
1778
+ else if (config && !isNullOrUndefined(config[field])) {
1779
+ theValue = config[field];
1780
+ }
1781
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1782
+ }
1783
+ function _iterateChain(cb) {
1784
+ var nextPlugin;
1785
+ while (!!(nextPlugin = context._next())) {
1786
+ var plugin = nextPlugin.getPlugin();
1787
+ if (plugin) {
1788
+ cb(plugin);
1656
1789
  }
1657
1790
  }
1658
- return _this;
1659
1791
  }
1660
- ChannelController._staticInit = (function () {
1661
- var proto = ChannelController.prototype;
1662
- objDefineAccessors(proto, "ChannelControls", proto.getChannelControls);
1663
- objDefineAccessors(proto, "channelQueue", proto.getChannelControls);
1664
- })();
1665
- return ChannelController;
1666
- }(BaseTelemetryPlugin));
1792
+ return context;
1793
+ }
1794
+ function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1795
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1796
+ var context = internalContext.ctx;
1797
+ function _processNext(env) {
1798
+ var nextPlugin = internalContext._next();
1799
+ nextPlugin && nextPlugin.processTelemetry(env, context);
1800
+ return !nextPlugin;
1801
+ }
1802
+ function _createNew(plugins, startAt) {
1803
+ if (plugins === void 0) { plugins = null; }
1804
+ if (isArray(plugins)) {
1805
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1806
+ }
1807
+ return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
1808
+ }
1809
+ context.processNext = _processNext;
1810
+ context.createNew = _createNew;
1811
+ return context;
1812
+ }
1813
+ function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
1814
+ var config = core.config || {};
1815
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1816
+ var context = internalContext.ctx;
1817
+ function _processNext(unloadState) {
1818
+ var nextPlugin = internalContext._next();
1819
+ nextPlugin && nextPlugin.unload(context, unloadState);
1820
+ return !nextPlugin;
1821
+ }
1822
+ function _createNew(plugins, startAt) {
1823
+ if (plugins === void 0) { plugins = null; }
1824
+ if (isArray(plugins)) {
1825
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1826
+ }
1827
+ return createProcessTelemetryUnloadContext(plugins || context.getNext(), core, startAt);
1828
+ }
1829
+ context.processNext = _processNext;
1830
+ context.createNew = _createNew;
1831
+ return context;
1832
+ }
1833
+ function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
1834
+ var config = core.config || {};
1835
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1836
+ var context = internalContext.ctx;
1837
+ function _processNext(updateState) {
1838
+ return context.iterate(function (plugin) {
1839
+ if (isFunction(plugin.update)) {
1840
+ plugin.update(context, updateState);
1841
+ }
1842
+ });
1843
+ }
1844
+ function _createNew(plugins, startAt) {
1845
+ if (plugins === void 0) { plugins = null; }
1846
+ if (isArray(plugins)) {
1847
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1848
+ }
1849
+ return createProcessTelemetryUpdateContext(plugins || context.getNext(), core, startAt);
1850
+ }
1851
+ context.processNext = _processNext;
1852
+ context.createNew = _createNew;
1853
+ return context;
1854
+ }
1855
+ function createTelemetryProxyChain(plugins, config, core, startAt) {
1856
+ var firstProxy = null;
1857
+ var add = startAt ? false : true;
1858
+ if (isArray(plugins) && plugins.length > 0) {
1859
+ var lastProxy_1 = null;
1860
+ arrForEach(plugins, function (thePlugin) {
1861
+ if (!add && startAt === thePlugin) {
1862
+ add = true;
1863
+ }
1864
+ if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
1865
+ var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1866
+ if (!firstProxy) {
1867
+ firstProxy = newProxy;
1868
+ }
1869
+ if (lastProxy_1) {
1870
+ lastProxy_1._setNext(newProxy);
1871
+ }
1872
+ lastProxy_1 = newProxy;
1873
+ }
1874
+ });
1875
+ }
1876
+ if (startAt && !firstProxy) {
1877
+ return createTelemetryProxyChain([startAt], config, core);
1878
+ }
1879
+ return firstProxy;
1880
+ }
1881
+ function createTelemetryPluginProxy(plugin, config, core) {
1882
+ var nextProxy = null;
1883
+ var hasProcessTelemetry = isFunction(plugin.processTelemetry);
1884
+ var hasSetNext = isFunction(plugin.setNextPlugin);
1885
+ var chainId;
1886
+ if (plugin) {
1887
+ chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
1888
+ }
1889
+ else {
1890
+ chainId = "Unknown-0-" + _chainId++;
1891
+ }
1892
+ var proxyChain = {
1893
+ getPlugin: function () {
1894
+ return plugin;
1895
+ },
1896
+ getNext: function () {
1897
+ return nextProxy;
1898
+ },
1899
+ processTelemetry: _processTelemetry,
1900
+ unload: _unloadPlugin,
1901
+ update: _updatePlugin,
1902
+ _id: chainId,
1903
+ _setNext: function (nextPlugin) {
1904
+ nextProxy = nextPlugin;
1905
+ }
1906
+ };
1907
+ function _getTelCtx() {
1908
+ var itemCtx;
1909
+ if (plugin && isFunction(plugin[strGetTelCtx])) {
1910
+ itemCtx = plugin[strGetTelCtx]();
1911
+ }
1912
+ if (!itemCtx) {
1913
+ itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1914
+ }
1915
+ return itemCtx;
1916
+ }
1917
+ function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
1918
+ var hasRun = false;
1919
+ var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1920
+ var hasRunContext = itemCtx[strHasRunFlags];
1921
+ if (!hasRunContext) {
1922
+ hasRunContext = itemCtx[strHasRunFlags] = {};
1923
+ }
1924
+ itemCtx.setNext(nextProxy);
1925
+ if (plugin) {
1926
+ doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
1927
+ hasRunContext[chainId] = true;
1928
+ try {
1929
+ var nextId = nextProxy ? nextProxy._id : strEmpty;
1930
+ if (nextId) {
1931
+ hasRunContext[nextId] = false;
1932
+ }
1933
+ hasRun = processPluginFn(itemCtx);
1934
+ }
1935
+ catch (error) {
1936
+ var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
1937
+ if (hasNextRun) {
1938
+ hasRun = true;
1939
+ }
1940
+ if (!nextProxy || !hasNextRun) {
1941
+ _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1942
+ }
1943
+ }
1944
+ }, details, isAsync);
1945
+ }
1946
+ return hasRun;
1947
+ }
1948
+ function _processTelemetry(env, itemCtx) {
1949
+ itemCtx = itemCtx || _getTelCtx();
1950
+ function _callProcessTelemetry(itemCtx) {
1951
+ if (!plugin || !hasProcessTelemetry) {
1952
+ return false;
1953
+ }
1954
+ var pluginState = _getPluginState(plugin);
1955
+ if (pluginState.teardown || pluginState[strDisabled]) {
1956
+ return false;
1957
+ }
1958
+ if (hasSetNext) {
1959
+ plugin.setNextPlugin(nextProxy);
1960
+ }
1961
+ plugin.processTelemetry(env, itemCtx);
1962
+ return true;
1963
+ }
1964
+ if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
1965
+ itemCtx.processNext(env);
1966
+ }
1967
+ }
1968
+ function _unloadPlugin(unloadCtx, unloadState) {
1969
+ function _callTeardown() {
1970
+ var hasRun = false;
1971
+ if (plugin) {
1972
+ var pluginState = _getPluginState(plugin);
1973
+ var pluginCore = plugin[strCore] || pluginState.core;
1974
+ if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
1975
+ pluginState[strCore] = null;
1976
+ pluginState[strTeardown] = true;
1977
+ pluginState[strIsInitialized] = false;
1978
+ if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
1979
+ hasRun = true;
1980
+ }
1981
+ }
1982
+ }
1983
+ return hasRun;
1984
+ }
1985
+ if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1986
+ unloadCtx.processNext(unloadState);
1987
+ }
1988
+ }
1989
+ function _updatePlugin(updateCtx, updateState) {
1990
+ function _callUpdate() {
1991
+ var hasRun = false;
1992
+ if (plugin) {
1993
+ var pluginState = _getPluginState(plugin);
1994
+ var pluginCore = plugin[strCore] || pluginState.core;
1995
+ if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1996
+ if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1997
+ hasRun = true;
1998
+ }
1999
+ }
2000
+ }
2001
+ return hasRun;
2002
+ }
2003
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
2004
+ updateCtx.processNext(updateState);
2005
+ }
2006
+ }
2007
+ return objFreeze(proxyChain);
2008
+ }
2009
+ var ProcessTelemetryContext = /** @class */ (function () {
2010
+ function ProcessTelemetryContext(pluginChain, config, core, startAt) {
2011
+ var _self = this;
2012
+ var context = createProcessTelemetryContext(pluginChain, config, core, startAt);
2013
+ proxyFunctions(_self, context, objKeys(context));
2014
+ }
2015
+ return ProcessTelemetryContext;
2016
+ }());
1667
2017
 
1668
2018
  var strToGMTString = "toGMTString";
1669
2019
  var strToUTCString = "toUTCString";
@@ -1673,7 +2023,6 @@
1673
2023
  var strIsCookieUseDisabled = "isCookieUseDisabled";
1674
2024
  var strDisableCookiesUsage = "disableCookiesUsage";
1675
2025
  var strConfigCookieMgr = "_ckMgr";
1676
- var strEmpty = "";
1677
2026
  var _supportsCookies = null;
1678
2027
  var _allowUaSameSite = null;
1679
2028
  var _parsedCookieValue = null;
@@ -1832,7 +2181,7 @@
1832
2181
  _supportsCookies = doc[strCookie] !== undefined;
1833
2182
  }
1834
2183
  catch (e) {
1835
- logger && logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
2184
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1836
2185
  }
1837
2186
  }
1838
2187
  return _supportsCookies;
@@ -1911,26 +2260,524 @@
1911
2260
  return false;
1912
2261
  }
1913
2262
 
1914
- var validationError = "Extensions must provide callback to initialize";
2263
+ var strIKey = "iKey";
2264
+ var strExtensionConfig = "extensionConfig";
2265
+
2266
+ var ChannelControllerPriority = 500;
2267
+ var ChannelValidationMessage = "Channel has invalid priority - ";
2268
+ function _addChannelQueue(channelQueue, queue, config, core) {
2269
+ if (queue && isArray(queue) && queue.length > 0) {
2270
+ queue = queue.sort(function (a, b) {
2271
+ return a.priority - b.priority;
2272
+ });
2273
+ arrForEach(queue, function (queueItem) {
2274
+ if (queueItem.priority < ChannelControllerPriority) {
2275
+ throwError(ChannelValidationMessage + queueItem.identifier);
2276
+ }
2277
+ });
2278
+ channelQueue.push({
2279
+ queue: objFreeze(queue),
2280
+ chain: createTelemetryProxyChain(queue, config, core)
2281
+ });
2282
+ }
2283
+ }
2284
+ function createChannelControllerPlugin(channelQueue, core) {
2285
+ var _a;
2286
+ function _getTelCtx() {
2287
+ return createProcessTelemetryContext(null, core.config, core, null);
2288
+ }
2289
+ function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
2290
+ var waiting = theChannels ? (theChannels.length + 1) : 1;
2291
+ function _runChainOnComplete() {
2292
+ waiting--;
2293
+ if (waiting === 0) {
2294
+ onComplete && onComplete();
2295
+ onComplete = null;
2296
+ }
2297
+ }
2298
+ if (waiting > 0) {
2299
+ arrForEach(theChannels, function (channels) {
2300
+ if (channels && channels.queue.length > 0) {
2301
+ var channelChain = channels.chain;
2302
+ var chainCtx = itemCtx.createNew(channelChain);
2303
+ chainCtx.onComplete(_runChainOnComplete);
2304
+ processFn(chainCtx);
2305
+ }
2306
+ else {
2307
+ waiting--;
2308
+ }
2309
+ });
2310
+ }
2311
+ _runChainOnComplete();
2312
+ }
2313
+ function _doUpdate(updateCtx, updateState) {
2314
+ var theUpdateState = updateState || {
2315
+ reason: 0
2316
+ };
2317
+ _processChannelQueue(channelQueue, updateCtx, function (chainCtx) {
2318
+ chainCtx[strProcessNext](theUpdateState);
2319
+ }, function () {
2320
+ updateCtx[strProcessNext](theUpdateState);
2321
+ });
2322
+ return true;
2323
+ }
2324
+ function _doTeardown(unloadCtx, unloadState) {
2325
+ var theUnloadState = unloadState || {
2326
+ reason: 0 ,
2327
+ isAsync: false
2328
+ };
2329
+ _processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
2330
+ chainCtx[strProcessNext](theUnloadState);
2331
+ }, function () {
2332
+ unloadCtx[strProcessNext](theUnloadState);
2333
+ isInitialized = false;
2334
+ });
2335
+ return true;
2336
+ }
2337
+ function _getChannel(pluginIdentifier) {
2338
+ var thePlugin = null;
2339
+ if (channelQueue && channelQueue.length > 0) {
2340
+ arrForEach(channelQueue, function (channels) {
2341
+ if (channels && channels.queue.length > 0) {
2342
+ arrForEach(channels.queue, function (ext) {
2343
+ if (ext.identifier === pluginIdentifier) {
2344
+ thePlugin = ext;
2345
+ return -1;
2346
+ }
2347
+ });
2348
+ if (thePlugin) {
2349
+ return -1;
2350
+ }
2351
+ }
2352
+ });
2353
+ }
2354
+ return thePlugin;
2355
+ }
2356
+ var isInitialized = false;
2357
+ var channelController = (_a = {
2358
+ identifier: "ChannelControllerPlugin",
2359
+ priority: ChannelControllerPriority,
2360
+ initialize: function (config, core, extensions, pluginChain) {
2361
+ isInitialized = true;
2362
+ arrForEach(channelQueue, function (channels) {
2363
+ if (channels && channels.queue.length > 0) {
2364
+ initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
2365
+ }
2366
+ });
2367
+ },
2368
+ isInitialized: function () {
2369
+ return isInitialized;
2370
+ },
2371
+ processTelemetry: function (item, itemCtx) {
2372
+ _processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
2373
+ chainCtx[strProcessNext](item);
2374
+ }, function () {
2375
+ itemCtx[strProcessNext](item);
2376
+ });
2377
+ },
2378
+ update: _doUpdate
2379
+ },
2380
+ _a[strPause] = function () {
2381
+ _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
2382
+ chainCtx.iterate(function (plugin) {
2383
+ plugin[strPause] && plugin[strPause]();
2384
+ });
2385
+ }, null);
2386
+ },
2387
+ _a[strResume] = function () {
2388
+ _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
2389
+ chainCtx.iterate(function (plugin) {
2390
+ plugin[strResume] && plugin[strResume]();
2391
+ });
2392
+ }, null);
2393
+ },
2394
+ _a[strTeardown] = _doTeardown,
2395
+ _a.getChannel = _getChannel,
2396
+ _a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
2397
+ var waiting = 1;
2398
+ var doneIterating = false;
2399
+ var cbTimer = null;
2400
+ cbTimeout = cbTimeout || 5000;
2401
+ function doCallback() {
2402
+ waiting--;
2403
+ if (doneIterating && waiting === 0) {
2404
+ if (cbTimer) {
2405
+ clearTimeout(cbTimer);
2406
+ cbTimer = null;
2407
+ }
2408
+ callBack && callBack(doneIterating);
2409
+ callBack = null;
2410
+ }
2411
+ }
2412
+ _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
2413
+ chainCtx.iterate(function (plugin) {
2414
+ if (plugin.flush) {
2415
+ waiting++;
2416
+ var handled_1 = false;
2417
+ if (!plugin.flush(isAsync, function () {
2418
+ handled_1 = true;
2419
+ doCallback();
2420
+ }, sendReason)) {
2421
+ if (!handled_1) {
2422
+ if (isAsync && cbTimer == null) {
2423
+ cbTimer = setTimeout(function () {
2424
+ cbTimer = null;
2425
+ doCallback();
2426
+ }, cbTimeout);
2427
+ }
2428
+ else {
2429
+ doCallback();
2430
+ }
2431
+ }
2432
+ }
2433
+ }
2434
+ });
2435
+ }, function () {
2436
+ doneIterating = true;
2437
+ doCallback();
2438
+ });
2439
+ return true;
2440
+ },
2441
+ _a._setQueue = function (queue) {
2442
+ channelQueue = queue;
2443
+ },
2444
+ _a);
2445
+ return channelController;
2446
+ }
2447
+ function createChannelQueues(channels, extensions, config, core) {
2448
+ var channelQueue = [];
2449
+ if (channels) {
2450
+ arrForEach(channels, function (queue) { return _addChannelQueue(channelQueue, queue, config, core); });
2451
+ }
2452
+ if (extensions) {
2453
+ var extensionQueue_1 = [];
2454
+ arrForEach(extensions, function (plugin) {
2455
+ if (plugin.priority > ChannelControllerPriority) {
2456
+ extensionQueue_1.push(plugin);
2457
+ }
2458
+ });
2459
+ _addChannelQueue(channelQueue, extensionQueue_1, config, core);
2460
+ }
2461
+ return channelQueue;
2462
+ }
2463
+
2464
+ function createUnloadHandlerContainer() {
2465
+ var handlers = [];
2466
+ function _addHandler(handler) {
2467
+ if (handler) {
2468
+ handlers.push(handler);
2469
+ }
2470
+ }
2471
+ function _runHandlers(unloadCtx, unloadState) {
2472
+ arrForEach(handlers, function (handler) {
2473
+ try {
2474
+ handler(unloadCtx, unloadState);
2475
+ }
2476
+ catch (e) {
2477
+ _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
2478
+ }
2479
+ });
2480
+ handlers = [];
2481
+ }
2482
+ return {
2483
+ add: _addHandler,
2484
+ run: _runHandlers
2485
+ };
2486
+ }
2487
+
2488
+ var strGetPlugin = "getPlugin";
2489
+ var BaseTelemetryPlugin = /** @class */ (function () {
2490
+ function BaseTelemetryPlugin() {
2491
+ var _self = this;
2492
+ var _isinitialized;
2493
+ var _rootCtx;
2494
+ var _nextPlugin;
2495
+ var _unloadHandlerContainer;
2496
+ var _hooks;
2497
+ _initDefaults();
2498
+ dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
2499
+ _self.initialize = function (config, core, extensions, pluginChain) {
2500
+ _setDefaults(config, core, pluginChain);
2501
+ _isinitialized = true;
2502
+ };
2503
+ _self.teardown = function (unloadCtx, unloadState) {
2504
+ var core = _self.core;
2505
+ if (!core || (unloadCtx && core !== unloadCtx.core())) {
2506
+ return;
2507
+ }
2508
+ var result;
2509
+ var unloadDone = false;
2510
+ var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
2511
+ var theUnloadState = unloadState || {
2512
+ reason: 0 ,
2513
+ isAsync: false
2514
+ };
2515
+ function _unloadCallback() {
2516
+ if (!unloadDone) {
2517
+ unloadDone = true;
2518
+ _unloadHandlerContainer.run(theUnloadCtx, unloadState);
2519
+ arrForEach(_hooks, function (fn) {
2520
+ fn.rm();
2521
+ });
2522
+ _hooks = [];
2523
+ if (result === true) {
2524
+ theUnloadCtx.processNext(theUnloadState);
2525
+ }
2526
+ _initDefaults();
2527
+ }
2528
+ }
2529
+ if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
2530
+ _unloadCallback();
2531
+ }
2532
+ else {
2533
+ result = true;
2534
+ }
2535
+ return result;
2536
+ };
2537
+ _self.update = function (updateCtx, updateState) {
2538
+ var core = _self.core;
2539
+ if (!core || (updateCtx && core !== updateCtx.core())) {
2540
+ return;
2541
+ }
2542
+ var result;
2543
+ var updateDone = false;
2544
+ var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
2545
+ var theUpdateState = updateState || {
2546
+ reason: 0
2547
+ };
2548
+ function _updateCallback() {
2549
+ if (!updateDone) {
2550
+ updateDone = true;
2551
+ _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
2552
+ }
2553
+ }
2554
+ if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
2555
+ _updateCallback();
2556
+ }
2557
+ else {
2558
+ result = true;
2559
+ }
2560
+ return result;
2561
+ };
2562
+ _self._addHook = function (hooks) {
2563
+ if (hooks) {
2564
+ if (isArray(hooks)) {
2565
+ _hooks = _hooks.concat(hooks);
2566
+ }
2567
+ else {
2568
+ _hooks.push(hooks);
2569
+ }
2570
+ }
2571
+ };
2572
+ proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
2573
+ });
2574
+ _self.diagLog = function (itemCtx) {
2575
+ return _getTelCtx(itemCtx).diagLog();
2576
+ };
2577
+ _self[strIsInitialized] = function () {
2578
+ return _isinitialized;
2579
+ };
2580
+ _self.setInitialized = function (isInitialized) {
2581
+ _isinitialized = isInitialized;
2582
+ };
2583
+ _self[strSetNextPlugin] = function (next) {
2584
+ _nextPlugin = next;
2585
+ };
2586
+ _self.processNext = function (env, itemCtx) {
2587
+ if (itemCtx) {
2588
+ itemCtx.processNext(env);
2589
+ }
2590
+ else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
2591
+ _nextPlugin.processTelemetry(env, null);
2592
+ }
2593
+ };
2594
+ _self._getTelCtx = _getTelCtx;
2595
+ function _getTelCtx(currentCtx) {
2596
+ if (currentCtx === void 0) { currentCtx = null; }
2597
+ var itemCtx = currentCtx;
2598
+ if (!itemCtx) {
2599
+ var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
2600
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
2601
+ itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
2602
+ }
2603
+ else {
2604
+ itemCtx = rootCtx.createNew(null, _nextPlugin);
2605
+ }
2606
+ }
2607
+ return itemCtx;
2608
+ }
2609
+ function _setDefaults(config, core, pluginChain) {
2610
+ if (config) {
2611
+ setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
2612
+ }
2613
+ if (!pluginChain && core) {
2614
+ pluginChain = core.getProcessTelContext().getNext();
2615
+ }
2616
+ var nextPlugin = _nextPlugin;
2617
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
2618
+ nextPlugin = _nextPlugin[strGetPlugin]();
2619
+ }
2620
+ _self.core = core;
2621
+ _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
2622
+ }
2623
+ function _initDefaults() {
2624
+ _isinitialized = false;
2625
+ _self.core = null;
2626
+ _rootCtx = null;
2627
+ _nextPlugin = null;
2628
+ _hooks = [];
2629
+ _unloadHandlerContainer = createUnloadHandlerContainer();
2630
+ }
2631
+ }
2632
+ return BaseTelemetryPlugin;
2633
+ }());
2634
+
2635
+ var TelemetryInitializerPlugin = /** @class */ (function (_super) {
2636
+ __extendsFn(TelemetryInitializerPlugin, _super);
2637
+ function TelemetryInitializerPlugin() {
2638
+ var _this = _super.call(this) || this;
2639
+ _this.identifier = "TelemetryInitializerPlugin";
2640
+ _this.priority = 199;
2641
+ var _id;
2642
+ var _initializers;
2643
+ _initDefaults();
2644
+ dynamicProto(TelemetryInitializerPlugin, _this, function (_self, _base) {
2645
+ _self.addTelemetryInitializer = function (telemetryInitializer) {
2646
+ var theInitializer = {
2647
+ id: _id++,
2648
+ fn: telemetryInitializer
2649
+ };
2650
+ _initializers.push(theInitializer);
2651
+ var handler = {
2652
+ remove: function () {
2653
+ arrForEach(_initializers, function (initializer, idx) {
2654
+ if (initializer.id === theInitializer.id) {
2655
+ _initializers.splice(idx, 1);
2656
+ return -1;
2657
+ }
2658
+ });
2659
+ }
2660
+ };
2661
+ return handler;
2662
+ };
2663
+ _self.processTelemetry = function (item, itemCtx) {
2664
+ var doNotSendItem = false;
2665
+ var telemetryInitializersCount = _initializers.length;
2666
+ for (var i = 0; i < telemetryInitializersCount; ++i) {
2667
+ var telemetryInitializer = _initializers[i];
2668
+ if (telemetryInitializer) {
2669
+ try {
2670
+ if (telemetryInitializer.fn.apply(null, [item]) === false) {
2671
+ doNotSendItem = true;
2672
+ break;
2673
+ }
2674
+ }
2675
+ catch (e) {
2676
+ _throwInternal(itemCtx.diagLog(), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
2677
+ }
2678
+ }
2679
+ }
2680
+ if (!doNotSendItem) {
2681
+ _self.processNext(item, itemCtx);
2682
+ }
2683
+ };
2684
+ _self[strDoTeardown] = function () {
2685
+ _initDefaults();
2686
+ };
2687
+ });
2688
+ function _initDefaults() {
2689
+ _id = 0;
2690
+ _initializers = [];
2691
+ }
2692
+ return _this;
2693
+ }
2694
+ return TelemetryInitializerPlugin;
2695
+ }(BaseTelemetryPlugin));
2696
+
2697
+ var strValidationError = "Plugins must provide initialize method";
1915
2698
  var strNotificationManager = "_notificationManager";
2699
+ var strSdkUnloadingError = "SDK is still unloading...";
2700
+ var strSdkNotInitialized = "SDK is not initialized";
2701
+ var defaultInitConfig = {
2702
+ loggingLevelConsole: 1
2703
+ };
1916
2704
  function _createPerfManager(core, notificationMgr) {
1917
2705
  return new PerfManager(notificationMgr);
1918
2706
  }
2707
+ function _validateExtensions(logger, channelPriority, allExtensions) {
2708
+ var coreExtensions = [];
2709
+ var extPriorities = {};
2710
+ arrForEach(allExtensions, function (ext) {
2711
+ if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
2712
+ throwError(strValidationError);
2713
+ }
2714
+ var extPriority = ext.priority;
2715
+ var identifier = ext.identifier;
2716
+ if (ext && extPriority) {
2717
+ if (!isNullOrUndefined(extPriorities[extPriority])) {
2718
+ _warnToConsole(logger, "Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
2719
+ }
2720
+ else {
2721
+ extPriorities[extPriority] = identifier;
2722
+ }
2723
+ }
2724
+ if (!extPriority || extPriority < channelPriority) {
2725
+ coreExtensions.push(ext);
2726
+ }
2727
+ });
2728
+ return {
2729
+ all: allExtensions,
2730
+ core: coreExtensions
2731
+ };
2732
+ }
2733
+ function _isPluginPresent(thePlugin, plugins) {
2734
+ var exists = false;
2735
+ arrForEach(plugins, function (plugin) {
2736
+ if (plugin === thePlugin) {
2737
+ exists = true;
2738
+ return -1;
2739
+ }
2740
+ });
2741
+ return exists;
2742
+ }
2743
+ function _createDummyNotificationManager() {
2744
+ var _a;
2745
+ return objCreateFn((_a = {},
2746
+ _a[strAddNotificationListener] = function (listener) { },
2747
+ _a[strRemoveNotificationListener] = function (listener) { },
2748
+ _a[strEventsSent] = function (events) { },
2749
+ _a[strEventsDiscarded] = function (events, reason) { },
2750
+ _a[strEventsSendRequest] = function (sendReason, isAsync) { },
2751
+ _a));
2752
+ }
1919
2753
  var BaseCore$2 = /** @class */ (function () {
1920
2754
  function BaseCore() {
1921
- var _isInitialized = false;
2755
+ var _isInitialized;
1922
2756
  var _eventQueue;
1923
- var _channelController;
1924
2757
  var _notificationManager;
1925
2758
  var _perfManager;
2759
+ var _cfgPerfManager;
1926
2760
  var _cookieManager;
2761
+ var _pluginChain;
2762
+ var _configExtensions;
2763
+ var _coreExtensions;
2764
+ var _channelControl;
2765
+ var _channelConfig;
2766
+ var _channelQueue;
2767
+ var _isUnloading;
2768
+ var _telemetryInitializerPlugin;
2769
+ var _internalLogsEventName;
2770
+ var _evtNamespace;
2771
+ var _unloadHandlers;
2772
+ var _debugListener;
2773
+ var _internalLogPoller = 0;
1927
2774
  dynamicProto(BaseCore, this, function (_self) {
1928
- _self._extensions = new Array();
1929
- _channelController = new ChannelController();
1930
- _self.logger = new DiagnosticLogger({ loggingLevelConsole: exports.LoggingSeverity.CRITICAL });
1931
- _eventQueue = [];
2775
+ _initDefaults();
1932
2776
  _self.isInitialized = function () { return _isInitialized; };
1933
2777
  _self.initialize = function (config, extensions, logger, notificationManager) {
2778
+ if (_isUnloading) {
2779
+ throwError(strSdkUnloadingError);
2780
+ }
1934
2781
  if (_self.isInitialized()) {
1935
2782
  throwError("Core should not be initialized more than once");
1936
2783
  }
@@ -1940,182 +2787,460 @@
1940
2787
  _notificationManager = notificationManager;
1941
2788
  _self[strNotificationManager] = notificationManager;
1942
2789
  _self.config = config || {};
1943
- if (_self.config.enablePerfMgr) {
1944
- setValue(_self.config, "createPerfMgr", _createPerfManager);
1945
- }
2790
+ _initDebugListener(config);
2791
+ _initPerfManager(config);
1946
2792
  config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
1947
- var extConfig = getSetValue(config, strExtensionConfig);
1948
- extConfig.NotificationManager = notificationManager;
2793
+ _initExtConfig(config);
1949
2794
  if (logger) {
1950
2795
  _self.logger = logger;
1951
2796
  }
1952
- var allExtensions = [];
1953
- allExtensions.push.apply(allExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), config.extensions));
1954
- allExtensions = sortPlugins(allExtensions);
1955
- var coreExtensions = [];
1956
- var extPriorities = {};
1957
- arrForEach(allExtensions, function (ext) {
1958
- if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
1959
- throwError(validationError);
1960
- }
1961
- var extPriority = ext.priority;
1962
- var identifier = ext.identifier;
1963
- if (ext && extPriority) {
1964
- if (!isNullOrUndefined(extPriorities[extPriority])) {
1965
- logger.warnToConsole("Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
1966
- }
1967
- else {
1968
- extPriorities[extPriority] = identifier;
1969
- }
1970
- }
1971
- if (!extPriority || extPriority < _channelController.priority) {
1972
- coreExtensions.push(ext);
1973
- }
1974
- });
1975
- allExtensions.push(_channelController);
1976
- coreExtensions.push(_channelController);
1977
- allExtensions = sortPlugins(allExtensions);
1978
- _self._extensions = allExtensions;
1979
- initializePlugins(new ProcessTelemetryContext([_channelController], config, _self), allExtensions);
1980
- initializePlugins(new ProcessTelemetryContext(coreExtensions, config, _self), allExtensions);
1981
- _self._extensions = coreExtensions;
1982
- if (_self.getTransmissionControls().length === 0) {
2797
+ _configExtensions = [];
2798
+ _configExtensions.push.apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), config.extensions));
2799
+ _channelConfig = (config || {}).channels;
2800
+ _initPluginChain(config, null);
2801
+ if (!_channelQueue || _channelQueue.length === 0) {
1983
2802
  throwError("No channels available");
1984
2803
  }
1985
2804
  _isInitialized = true;
1986
2805
  _self.releaseQueue();
1987
2806
  };
1988
2807
  _self.getTransmissionControls = function () {
1989
- return _channelController.getChannelControls();
2808
+ var controls = [];
2809
+ if (_channelQueue) {
2810
+ arrForEach(_channelQueue, function (channels) {
2811
+ controls.push(channels.queue);
2812
+ });
2813
+ }
2814
+ return objFreeze(controls);
1990
2815
  };
1991
2816
  _self.track = function (telemetryItem) {
1992
2817
  setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);
1993
2818
  setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
1994
2819
  setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
1995
- if (_self.isInitialized()) {
1996
- _self.getProcessTelContext().processNext(telemetryItem);
2820
+ if (!_isUnloading && _self.isInitialized()) {
2821
+ _createTelCtx().processNext(telemetryItem);
1997
2822
  }
1998
2823
  else {
1999
2824
  _eventQueue.push(telemetryItem);
2000
2825
  }
2001
2826
  };
2002
- _self.getProcessTelContext = function () {
2003
- var extensions = _self._extensions;
2004
- var thePlugins = extensions;
2005
- if (!extensions || extensions.length === 0) {
2006
- thePlugins = [_channelController];
2007
- }
2008
- return new ProcessTelemetryContext(thePlugins, _self.config, _self);
2009
- };
2827
+ _self.getProcessTelContext = _createTelCtx;
2010
2828
  _self.getNotifyMgr = function () {
2011
2829
  if (!_notificationManager) {
2012
- _notificationManager = objCreateFn({
2013
- addNotificationListener: function (listener) { },
2014
- removeNotificationListener: function (listener) { },
2015
- eventsSent: function (events) { },
2016
- eventsDiscarded: function (events, reason) { },
2017
- eventsSendRequest: function (sendReason, isAsync) { }
2018
- });
2830
+ _notificationManager = _createDummyNotificationManager();
2019
2831
  _self[strNotificationManager] = _notificationManager;
2020
2832
  }
2021
2833
  return _notificationManager;
2022
2834
  };
2835
+ _self[strAddNotificationListener] = function (listener) {
2836
+ if (_notificationManager) {
2837
+ _notificationManager[strAddNotificationListener](listener);
2838
+ }
2839
+ };
2840
+ _self[strRemoveNotificationListener] = function (listener) {
2841
+ if (_notificationManager) {
2842
+ _notificationManager[strRemoveNotificationListener](listener);
2843
+ }
2844
+ };
2023
2845
  _self.getCookieMgr = function () {
2024
2846
  if (!_cookieManager) {
2025
2847
  _cookieManager = createCookieMgr(_self.config, _self.logger);
2026
2848
  }
2027
- return _cookieManager;
2028
- };
2029
- _self.setCookieMgr = function (cookieMgr) {
2030
- _cookieManager = cookieMgr;
2031
- };
2032
- _self.getPerfMgr = function () {
2033
- if (!_perfManager) {
2034
- if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
2035
- _perfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
2036
- }
2849
+ return _cookieManager;
2850
+ };
2851
+ _self.setCookieMgr = function (cookieMgr) {
2852
+ _cookieManager = cookieMgr;
2853
+ };
2854
+ _self.getPerfMgr = function () {
2855
+ if (!_perfManager && !_cfgPerfManager) {
2856
+ if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
2857
+ _cfgPerfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
2858
+ }
2859
+ }
2860
+ return _perfManager || _cfgPerfManager || getGblPerfMgr();
2861
+ };
2862
+ _self.setPerfMgr = function (perfMgr) {
2863
+ _perfManager = perfMgr;
2864
+ };
2865
+ _self.eventCnt = function () {
2866
+ return _eventQueue.length;
2867
+ };
2868
+ _self.releaseQueue = function () {
2869
+ if (_isInitialized && _eventQueue.length > 0) {
2870
+ var eventQueue = _eventQueue;
2871
+ _eventQueue = [];
2872
+ arrForEach(eventQueue, function (event) {
2873
+ _createTelCtx().processNext(event);
2874
+ });
2875
+ }
2876
+ };
2877
+ _self.pollInternalLogs = function (eventName) {
2878
+ _internalLogsEventName = eventName || null;
2879
+ var interval = _self.config.diagnosticLogInterval;
2880
+ if (!interval || !(interval > 0)) {
2881
+ interval = 10000;
2882
+ }
2883
+ if (_internalLogPoller) {
2884
+ clearInterval(_internalLogPoller);
2885
+ }
2886
+ _internalLogPoller = setInterval(function () {
2887
+ _flushInternalLogs();
2888
+ }, interval);
2889
+ return _internalLogPoller;
2890
+ };
2891
+ _self.stopPollingInternalLogs = function () {
2892
+ if (_internalLogPoller) {
2893
+ clearInterval(_internalLogPoller);
2894
+ _internalLogPoller = 0;
2895
+ _flushInternalLogs();
2896
+ }
2897
+ };
2898
+ proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
2899
+ _self.unload = function (isAsync, unloadComplete, cbTimeout) {
2900
+ if (isAsync === void 0) { isAsync = true; }
2901
+ if (!_isInitialized) {
2902
+ throwError(strSdkNotInitialized);
2903
+ }
2904
+ if (_isUnloading) {
2905
+ throwError(strSdkUnloadingError);
2906
+ }
2907
+ var unloadState = {
2908
+ reason: 50 ,
2909
+ isAsync: isAsync,
2910
+ flushComplete: false
2911
+ };
2912
+ var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self);
2913
+ processUnloadCtx.onComplete(function () {
2914
+ _initDefaults();
2915
+ unloadComplete && unloadComplete(unloadState);
2916
+ }, _self);
2917
+ function _doUnload(flushComplete) {
2918
+ unloadState.flushComplete = flushComplete;
2919
+ _isUnloading = true;
2920
+ _unloadHandlers.run(processUnloadCtx, unloadState);
2921
+ _self.stopPollingInternalLogs();
2922
+ processUnloadCtx.processNext(unloadState);
2923
+ }
2924
+ if (!_flushChannels(isAsync, _doUnload, 6 , cbTimeout)) {
2925
+ _doUnload(false);
2926
+ }
2927
+ };
2928
+ _self.getPlugin = _getPlugin;
2929
+ _self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
2930
+ if (!plugin) {
2931
+ addCb && addCb(false);
2932
+ _logOrThrowError(strValidationError);
2933
+ return;
2934
+ }
2935
+ var existingPlugin = _getPlugin(plugin.identifier);
2936
+ if (existingPlugin && !replaceExisting) {
2937
+ addCb && addCb(false);
2938
+ _logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
2939
+ return;
2940
+ }
2941
+ var updateState = {
2942
+ reason: 16
2943
+ };
2944
+ function _addPlugin(removed) {
2945
+ _configExtensions.push(plugin);
2946
+ updateState.added = [plugin];
2947
+ _initPluginChain(_self.config, updateState);
2948
+ addCb && addCb(true);
2949
+ }
2950
+ if (existingPlugin) {
2951
+ var removedPlugins_1 = [existingPlugin.plugin];
2952
+ var unloadState = {
2953
+ reason: 2 ,
2954
+ isAsync: !!isAsync
2955
+ };
2956
+ _removePlugins(removedPlugins_1, unloadState, function (removed) {
2957
+ if (!removed) {
2958
+ addCb && addCb(false);
2959
+ }
2960
+ else {
2961
+ updateState.removed = removedPlugins_1;
2962
+ updateState.reason |= 32 ;
2963
+ _addPlugin();
2964
+ }
2965
+ });
2966
+ }
2967
+ else {
2968
+ _addPlugin();
2969
+ }
2970
+ };
2971
+ _self.evtNamespace = function () {
2972
+ return _evtNamespace;
2973
+ };
2974
+ _self.flush = _flushChannels;
2975
+ proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
2976
+ function _initDefaults() {
2977
+ _isInitialized = false;
2978
+ _self.config = objExtend(true, {}, defaultInitConfig);
2979
+ _self.logger = new DiagnosticLogger(_self.config);
2980
+ _self._extensions = [];
2981
+ _telemetryInitializerPlugin = new TelemetryInitializerPlugin();
2982
+ _eventQueue = [];
2983
+ _notificationManager = null;
2984
+ _perfManager = null;
2985
+ _cfgPerfManager = null;
2986
+ _cookieManager = null;
2987
+ _pluginChain = null;
2988
+ _coreExtensions = null;
2989
+ _configExtensions = [];
2990
+ _channelControl = null;
2991
+ _channelConfig = null;
2992
+ _channelQueue = null;
2993
+ _isUnloading = false;
2994
+ _internalLogsEventName = null;
2995
+ _evtNamespace = createUniqueNamespace("AIBaseCore", true);
2996
+ _unloadHandlers = createUnloadHandlerContainer();
2997
+ }
2998
+ function _createTelCtx() {
2999
+ return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
3000
+ }
3001
+ function _initPluginChain(config, updateState) {
3002
+ var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
3003
+ _coreExtensions = theExtensions.core;
3004
+ _pluginChain = null;
3005
+ var allExtensions = theExtensions.all;
3006
+ _channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
3007
+ if (_channelControl) {
3008
+ var idx = allExtensions.indexOf(_channelControl);
3009
+ if (idx !== -1) {
3010
+ allExtensions.splice(idx, 1);
3011
+ }
3012
+ idx = _coreExtensions.indexOf(_channelControl);
3013
+ if (idx !== -1) {
3014
+ _coreExtensions.splice(idx, 1);
3015
+ }
3016
+ _channelControl._setQueue(_channelQueue);
3017
+ }
3018
+ else {
3019
+ _channelControl = createChannelControllerPlugin(_channelQueue, _self);
3020
+ }
3021
+ allExtensions.push(_channelControl);
3022
+ _coreExtensions.push(_channelControl);
3023
+ _self._extensions = sortPlugins(allExtensions);
3024
+ _channelControl.initialize(config, _self, allExtensions);
3025
+ initializePlugins(_createTelCtx(), allExtensions);
3026
+ _self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
3027
+ if (updateState) {
3028
+ _doUpdate(updateState);
3029
+ }
3030
+ }
3031
+ function _getPlugin(pluginIdentifier) {
3032
+ var theExt = null;
3033
+ var thePlugin = null;
3034
+ arrForEach(_self._extensions, function (ext) {
3035
+ if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
3036
+ thePlugin = ext;
3037
+ return -1;
3038
+ }
3039
+ });
3040
+ if (!thePlugin && _channelControl) {
3041
+ thePlugin = _channelControl.getChannel(pluginIdentifier);
3042
+ }
3043
+ if (thePlugin) {
3044
+ theExt = {
3045
+ plugin: thePlugin,
3046
+ setEnabled: function (enabled) {
3047
+ _getPluginState(thePlugin)[strDisabled] = !enabled;
3048
+ },
3049
+ isEnabled: function () {
3050
+ var pluginState = _getPluginState(thePlugin);
3051
+ return !pluginState[strTeardown] && !pluginState[strDisabled];
3052
+ },
3053
+ remove: function (isAsync, removeCb) {
3054
+ if (isAsync === void 0) { isAsync = true; }
3055
+ var pluginsToRemove = [thePlugin];
3056
+ var unloadState = {
3057
+ reason: 1 ,
3058
+ isAsync: isAsync
3059
+ };
3060
+ _removePlugins(pluginsToRemove, unloadState, function (removed) {
3061
+ if (removed) {
3062
+ _initPluginChain(_self.config, {
3063
+ reason: 32 ,
3064
+ removed: pluginsToRemove
3065
+ });
3066
+ }
3067
+ removeCb && removeCb(removed);
3068
+ });
3069
+ }
3070
+ };
3071
+ }
3072
+ return theExt;
3073
+ }
3074
+ function _getPluginChain() {
3075
+ if (!_pluginChain) {
3076
+ var extensions = (_coreExtensions || []).slice();
3077
+ if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
3078
+ extensions.push(_telemetryInitializerPlugin);
3079
+ }
3080
+ _pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
3081
+ }
3082
+ return _pluginChain;
3083
+ }
3084
+ function _removePlugins(thePlugins, unloadState, removeComplete) {
3085
+ if (thePlugins && thePlugins.length > 0) {
3086
+ var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
3087
+ var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self);
3088
+ unloadCtx.onComplete(function () {
3089
+ var removed = false;
3090
+ var newConfigExtensions = [];
3091
+ arrForEach(_configExtensions, function (plugin, idx) {
3092
+ if (!_isPluginPresent(plugin, thePlugins)) {
3093
+ newConfigExtensions.push(plugin);
3094
+ }
3095
+ else {
3096
+ removed = true;
3097
+ }
3098
+ });
3099
+ _configExtensions = newConfigExtensions;
3100
+ var newChannelConfig = [];
3101
+ if (_channelConfig) {
3102
+ arrForEach(_channelConfig, function (queue, idx) {
3103
+ var newQueue = [];
3104
+ arrForEach(queue, function (channel) {
3105
+ if (!_isPluginPresent(channel, thePlugins)) {
3106
+ newQueue.push(channel);
3107
+ }
3108
+ else {
3109
+ removed = true;
3110
+ }
3111
+ });
3112
+ newChannelConfig.push(newQueue);
3113
+ });
3114
+ _channelConfig = newChannelConfig;
3115
+ }
3116
+ removeComplete && removeComplete(removed);
3117
+ });
3118
+ unloadCtx.processNext(unloadState);
3119
+ }
3120
+ else {
3121
+ removeComplete(false);
3122
+ }
3123
+ }
3124
+ function _flushInternalLogs() {
3125
+ var queue = _self.logger ? _self.logger.queue : [];
3126
+ if (queue) {
3127
+ arrForEach(queue, function (logMessage) {
3128
+ var item = {
3129
+ name: _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage.messageId,
3130
+ iKey: _self.config.instrumentationKey,
3131
+ time: toISOString(new Date()),
3132
+ baseType: _InternalLogMessage.dataType,
3133
+ baseData: { message: logMessage.message }
3134
+ };
3135
+ _self.track(item);
3136
+ });
3137
+ queue.length = 0;
3138
+ }
3139
+ }
3140
+ function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
3141
+ if (_channelControl) {
3142
+ return _channelControl.flush(isAsync, callBack, sendReason || 6 , cbTimeout);
3143
+ }
3144
+ callBack && callBack(false);
3145
+ return true;
3146
+ }
3147
+ function _initDebugListener(config) {
3148
+ if (config.disableDbgExt === true && _debugListener) {
3149
+ _notificationManager[strRemoveNotificationListener](_debugListener);
3150
+ _debugListener = null;
3151
+ }
3152
+ if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
3153
+ _debugListener = getDebugListener(config);
3154
+ _notificationManager[strAddNotificationListener](_debugListener);
3155
+ }
3156
+ }
3157
+ function _initPerfManager(config) {
3158
+ if (!config.enablePerfMgr && _cfgPerfManager) {
3159
+ _cfgPerfManager = null;
3160
+ }
3161
+ if (config.enablePerfMgr) {
3162
+ setValue(_self.config, "createPerfMgr", _createPerfManager);
3163
+ }
3164
+ }
3165
+ function _initExtConfig(config) {
3166
+ var extConfig = getSetValue(config, strExtensionConfig);
3167
+ extConfig.NotificationManager = _notificationManager;
3168
+ }
3169
+ function _doUpdate(updateState) {
3170
+ var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self);
3171
+ if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
3172
+ updateCtx.processNext(updateState);
2037
3173
  }
2038
- return _perfManager || getGblPerfMgr();
2039
- };
2040
- _self.setPerfMgr = function (perfMgr) {
2041
- _perfManager = perfMgr;
2042
- };
2043
- _self.eventCnt = function () {
2044
- return _eventQueue.length;
2045
- };
2046
- _self.releaseQueue = function () {
2047
- if (_eventQueue.length > 0) {
2048
- arrForEach(_eventQueue, function (event) {
2049
- _self.getProcessTelContext().processNext(event);
2050
- });
2051
- _eventQueue = [];
3174
+ }
3175
+ function _logOrThrowError(message) {
3176
+ var logger = _self.logger;
3177
+ if (logger) {
3178
+ _throwInternal(logger, 2 , 73 , message);
2052
3179
  }
2053
- };
3180
+ else {
3181
+ throwError(message);
3182
+ }
3183
+ }
2054
3184
  });
2055
3185
  }
2056
3186
  return BaseCore;
2057
3187
  }());
2058
3188
 
3189
+ function _runListeners(listeners, name, isAsync, callback) {
3190
+ arrForEach(listeners, function (listener) {
3191
+ if (listener && listener[name]) {
3192
+ if (isAsync) {
3193
+ setTimeout(function () { return callback(listener); }, 0);
3194
+ }
3195
+ else {
3196
+ try {
3197
+ callback(listener);
3198
+ }
3199
+ catch (e) {
3200
+ }
3201
+ }
3202
+ }
3203
+ });
3204
+ }
2059
3205
  var NotificationManager = /** @class */ (function () {
2060
3206
  function NotificationManager(config) {
2061
3207
  this.listeners = [];
2062
3208
  var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
2063
3209
  dynamicProto(NotificationManager, this, function (_self) {
2064
- _self.addNotificationListener = function (listener) {
3210
+ _self[strAddNotificationListener] = function (listener) {
2065
3211
  _self.listeners.push(listener);
2066
3212
  };
2067
- _self.removeNotificationListener = function (listener) {
3213
+ _self[strRemoveNotificationListener] = function (listener) {
2068
3214
  var index = arrIndexOf(_self.listeners, listener);
2069
3215
  while (index > -1) {
2070
3216
  _self.listeners.splice(index, 1);
2071
3217
  index = arrIndexOf(_self.listeners, listener);
2072
3218
  }
2073
3219
  };
2074
- _self.eventsSent = function (events) {
2075
- arrForEach(_self.listeners, function (listener) {
2076
- if (listener && listener.eventsSent) {
2077
- setTimeout(function () { return listener.eventsSent(events); }, 0);
2078
- }
3220
+ _self[strEventsSent] = function (events) {
3221
+ _runListeners(_self.listeners, strEventsSent, true, function (listener) {
3222
+ listener[strEventsSent](events);
2079
3223
  });
2080
3224
  };
2081
- _self.eventsDiscarded = function (events, reason) {
2082
- arrForEach(_self.listeners, function (listener) {
2083
- if (listener && listener.eventsDiscarded) {
2084
- setTimeout(function () { return listener.eventsDiscarded(events, reason); }, 0);
2085
- }
3225
+ _self[strEventsDiscarded] = function (events, reason) {
3226
+ _runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
3227
+ listener[strEventsDiscarded](events, reason);
2086
3228
  });
2087
3229
  };
2088
- _self.eventsSendRequest = function (sendReason, isAsync) {
2089
- arrForEach(_self.listeners, function (listener) {
2090
- if (listener && listener.eventsSendRequest) {
2091
- if (isAsync) {
2092
- setTimeout(function () { return listener.eventsSendRequest(sendReason, isAsync); }, 0);
2093
- }
2094
- else {
2095
- try {
2096
- listener.eventsSendRequest(sendReason, isAsync);
2097
- }
2098
- catch (e) {
2099
- }
2100
- }
2101
- }
3230
+ _self[strEventsSendRequest] = function (sendReason, isAsync) {
3231
+ _runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
3232
+ listener[strEventsSendRequest](sendReason, isAsync);
2102
3233
  });
2103
3234
  };
2104
- _self.perfEvent = function (perfEvent) {
3235
+ _self[strPerfEvent] = function (perfEvent) {
2105
3236
  if (perfEvent) {
2106
3237
  if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
2107
- arrForEach(_self.listeners, function (listener) {
2108
- if (listener && listener.perfEvent) {
2109
- if (perfEvent.isAsync) {
2110
- setTimeout(function () { return listener.perfEvent(perfEvent); }, 0);
2111
- }
2112
- else {
2113
- try {
2114
- listener.perfEvent(perfEvent);
2115
- }
2116
- catch (e) {
2117
- }
2118
- }
3238
+ _runListeners(_self.listeners, strPerfEvent, false, function (listener) {
3239
+ if (perfEvent.isAsync) {
3240
+ setTimeout(function () { return listener[strPerfEvent](perfEvent); }, 0);
3241
+ }
3242
+ else {
3243
+ listener[strPerfEvent](perfEvent);
2119
3244
  }
2120
3245
  });
2121
3246
  }
@@ -2130,7 +3255,6 @@
2130
3255
  __extendsFn(AppInsightsCore, _super);
2131
3256
  function AppInsightsCore() {
2132
3257
  var _this = _super.call(this) || this;
2133
- var _internalLogPoller = 0;
2134
3258
  dynamicProto(AppInsightsCore, _this, function (_self, _base) {
2135
3259
  _self.initialize = function (config, extensions, logger, notificationManager) {
2136
3260
  _base.initialize(config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));
@@ -2145,58 +3269,16 @@
2145
3269
  _base.track(telemetryItem);
2146
3270
  }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
2147
3271
  };
2148
- _self.addNotificationListener = function (listener) {
2149
- var manager = _self.getNotifyMgr();
2150
- if (manager) {
2151
- manager.addNotificationListener(listener);
2152
- }
2153
- };
2154
- _self.removeNotificationListener = function (listener) {
2155
- var manager = _self.getNotifyMgr();
2156
- if (manager) {
2157
- manager.removeNotificationListener(listener);
2158
- }
2159
- };
2160
- _self.pollInternalLogs = function (eventName) {
2161
- var interval = _self.config.diagnosticLogInterval;
2162
- if (!interval || !(interval > 0)) {
2163
- interval = 10000;
2164
- }
2165
- if (_internalLogPoller) {
2166
- _self.stopPollingInternalLogs();
2167
- }
2168
- _internalLogPoller = setInterval(function () {
2169
- var queue = _self.logger ? _self.logger.queue : [];
2170
- arrForEach(queue, function (logMessage) {
2171
- var item = {
2172
- name: eventName ? eventName : "InternalMessageId: " + logMessage.messageId,
2173
- iKey: _self.config.instrumentationKey,
2174
- time: toISOString(new Date()),
2175
- baseType: _InternalLogMessage.dataType,
2176
- baseData: { message: logMessage.message }
2177
- };
2178
- _self.track(item);
2179
- });
2180
- queue.length = 0;
2181
- }, interval);
2182
- return _internalLogPoller;
2183
- };
2184
- _self.stopPollingInternalLogs = function () {
2185
- if (!_internalLogPoller)
2186
- return;
2187
- clearInterval(_internalLogPoller);
2188
- _internalLogPoller = 0;
2189
- };
2190
3272
  function _validateTelemetryItem(telemetryItem) {
2191
3273
  if (isNullOrUndefined(telemetryItem.name)) {
2192
3274
  _notifyInvalidEvent(telemetryItem);
2193
- throw Error("telemetry name required");
3275
+ throwError("telemetry name required");
2194
3276
  }
2195
3277
  }
2196
3278
  function _notifyInvalidEvent(telemetryItem) {
2197
3279
  var manager = _self.getNotifyMgr();
2198
3280
  if (manager) {
2199
- manager.eventsDiscarded([telemetryItem], EventsDiscardedReason.InvalidEvent);
3281
+ manager.eventsDiscarded([telemetryItem], 2 );
2200
3282
  }
2201
3283
  }
2202
3284
  });
@@ -2205,148 +3287,312 @@
2205
3287
  return AppInsightsCore;
2206
3288
  }(BaseCore$2));
2207
3289
 
2208
- var UInt32Mask = 0x100000000;
2209
- var MaxUInt32 = 0xffffffff;
2210
- var _mwcSeeded = false;
2211
- var _mwcW = 123456789;
2212
- var _mwcZ = 987654321;
2213
- function _mwcSeed(seedValue) {
2214
- if (seedValue < 0) {
2215
- seedValue >>>= 0;
3290
+ var strOnPrefix = "on";
3291
+ var strAttachEvent = "attachEvent";
3292
+ var strAddEventHelper = "addEventListener";
3293
+ var strDetachEvent = "detachEvent";
3294
+ var strRemoveEventListener = "removeEventListener";
3295
+ var strEvents = "events";
3296
+ var strVisibilityChangeEvt = "visibilitychange";
3297
+ var strPageHide = "pagehide";
3298
+ var strPageShow = "pageshow";
3299
+ var strUnload = "unload";
3300
+ var strBeforeUnload = "beforeunload";
3301
+ var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
3302
+ var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
3303
+ var rRemoveEmptyNs = /\.[\.]+/g;
3304
+ var rRemoveTrailingEmptyNs = /[\.]+$/;
3305
+ var _guid = 1;
3306
+ var elmNodeData = createElmNodeData("events");
3307
+ var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
3308
+ function _normalizeNamespace(name) {
3309
+ if (name && name.replace) {
3310
+ return name.replace(/^\s*\.*|\.*\s*$/g, "");
3311
+ }
3312
+ return name;
3313
+ }
3314
+ function _getEvtNamespace(eventName, evtNamespace) {
3315
+ if (evtNamespace) {
3316
+ var theNamespace_1 = "";
3317
+ if (isArray(evtNamespace)) {
3318
+ theNamespace_1 = "";
3319
+ arrForEach(evtNamespace, function (name) {
3320
+ name = _normalizeNamespace(name);
3321
+ if (name) {
3322
+ if (name[0] !== ".") {
3323
+ name = "." + name;
3324
+ }
3325
+ theNamespace_1 += name;
3326
+ }
3327
+ });
3328
+ }
3329
+ else {
3330
+ theNamespace_1 = _normalizeNamespace(evtNamespace);
3331
+ }
3332
+ if (theNamespace_1) {
3333
+ if (theNamespace_1[0] !== ".") {
3334
+ theNamespace_1 = "." + theNamespace_1;
3335
+ }
3336
+ eventName = (eventName || "") + theNamespace_1;
3337
+ }
2216
3338
  }
2217
- _mwcW = (123456789 + seedValue) & MaxUInt32;
2218
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
2219
- _mwcSeeded = true;
3339
+ var parsedEvent = (eventNamespace.exec(eventName || "") || []);
3340
+ return {
3341
+ type: parsedEvent[1],
3342
+ ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
3343
+ };
2220
3344
  }
2221
- function _autoSeedMwc() {
2222
- try {
2223
- var now = dateNow() & 0x7fffffff;
2224
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
2225
- }
2226
- catch (e) {
3345
+ function __getRegisteredEvents(target, eventName, evtNamespace) {
3346
+ var theEvents = [];
3347
+ var eventCache = elmNodeData.get(target, strEvents, {}, false);
3348
+ var evtName = _getEvtNamespace(eventName, evtNamespace);
3349
+ objForEachKey(eventCache, function (evtType, registeredEvents) {
3350
+ arrForEach(registeredEvents, function (value) {
3351
+ if (!evtName.type || evtName.type === value.evtName.type) {
3352
+ if (!evtName.ns || evtName.ns === evtName.ns) {
3353
+ theEvents.push({
3354
+ name: value.evtName.type + (value.evtName.ns ? "." + value.evtName.ns : ""),
3355
+ handler: value.handler
3356
+ });
3357
+ }
3358
+ }
3359
+ });
3360
+ });
3361
+ return theEvents;
3362
+ }
3363
+ function _getRegisteredEvents(target, evtName, addDefault) {
3364
+ if (addDefault === void 0) { addDefault = true; }
3365
+ var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
3366
+ var registeredEvents = aiEvts[evtName];
3367
+ if (!registeredEvents) {
3368
+ registeredEvents = aiEvts[evtName] = [];
2227
3369
  }
3370
+ return registeredEvents;
2228
3371
  }
2229
- function randomValue(maxValue) {
2230
- if (maxValue > 0) {
2231
- return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
3372
+ function _doDetach(obj, evtName, handlerRef, useCapture) {
3373
+ if (obj && evtName && evtName.type) {
3374
+ if (obj[strRemoveEventListener]) {
3375
+ obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
3376
+ }
3377
+ else if (obj[strDetachEvent]) {
3378
+ obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
3379
+ }
2232
3380
  }
2233
- return 0;
2234
3381
  }
2235
- function random32(signed) {
2236
- var value;
2237
- var c = getCrypto() || getMsCrypto();
2238
- if (c && c.getRandomValues) {
2239
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
3382
+ function _doAttach(obj, evtName, handlerRef, useCapture) {
3383
+ var result = false;
3384
+ if (obj && evtName && evtName.type && handlerRef) {
3385
+ if (obj[strAddEventHelper]) {
3386
+ obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
3387
+ result = true;
3388
+ }
3389
+ else if (obj[strAttachEvent]) {
3390
+ obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
3391
+ result = true;
3392
+ }
2240
3393
  }
2241
- else if (isIE()) {
2242
- if (!_mwcSeeded) {
2243
- _autoSeedMwc();
3394
+ return result;
3395
+ }
3396
+ function _doUnregister(target, events, evtName, unRegFn) {
3397
+ var idx = events.length;
3398
+ while (idx--) {
3399
+ var theEvent = events[idx];
3400
+ if (theEvent) {
3401
+ if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
3402
+ if (!unRegFn || unRegFn(theEvent)) {
3403
+ _doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
3404
+ events.splice(idx, 1);
3405
+ }
3406
+ }
2244
3407
  }
2245
- value = mwcRandom32() & MaxUInt32;
2246
3408
  }
2247
- else {
2248
- value = Math.floor((UInt32Mask * Math.random()) | 0);
3409
+ }
3410
+ function _unregisterEvents(target, evtName, unRegFn) {
3411
+ if (evtName.type) {
3412
+ _doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
2249
3413
  }
2250
- if (!signed) {
2251
- value >>>= 0;
3414
+ else {
3415
+ var eventCache = elmNodeData.get(target, strEvents, {});
3416
+ objForEachKey(eventCache, function (evtType, events) {
3417
+ _doUnregister(target, events, evtName, unRegFn);
3418
+ });
3419
+ if (objKeys(eventCache).length === 0) {
3420
+ elmNodeData.kill(target, strEvents);
3421
+ }
2252
3422
  }
2253
- return value;
2254
3423
  }
2255
- function mwcRandomSeed(value) {
2256
- if (!value) {
2257
- _autoSeedMwc();
3424
+ function mergeEvtNamespace(theNamespace, namespaces) {
3425
+ var newNamespaces;
3426
+ if (namespaces) {
3427
+ if (isArray(namespaces)) {
3428
+ newNamespaces = [theNamespace].concat(namespaces);
3429
+ }
3430
+ else {
3431
+ newNamespaces = [theNamespace, namespaces];
3432
+ }
3433
+ newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
2258
3434
  }
2259
3435
  else {
2260
- _mwcSeed(value);
3436
+ newNamespaces = theNamespace;
2261
3437
  }
3438
+ return newNamespaces;
2262
3439
  }
2263
- function mwcRandom32(signed) {
2264
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
2265
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
2266
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
2267
- if (!signed) {
2268
- value >>>= 0;
3440
+ function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
3441
+ if (useCapture === void 0) { useCapture = false; }
3442
+ var result = false;
3443
+ if (target) {
3444
+ try {
3445
+ var evtName = _getEvtNamespace(eventName, evtNamespace);
3446
+ result = _doAttach(target, evtName, handlerRef, useCapture);
3447
+ if (result && elmNodeData.accept(target)) {
3448
+ var registeredEvent = {
3449
+ guid: _guid++,
3450
+ evtName: evtName,
3451
+ handler: handlerRef,
3452
+ capture: useCapture
3453
+ };
3454
+ _getRegisteredEvents(target, evtName.type).push(registeredEvent);
3455
+ }
3456
+ }
3457
+ catch (e) {
3458
+ }
2269
3459
  }
2270
- return value;
3460
+ return result;
2271
3461
  }
2272
-
2273
- var strVisibilityChangeEvt = "visibilitychange";
2274
- var strPageHide = "pagehide";
2275
- var strPageShow = "pageshow";
2276
- function addEventHandler(eventName, callback) {
3462
+ function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
3463
+ if (useCapture === void 0) { useCapture = false; }
3464
+ if (target) {
3465
+ try {
3466
+ var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
3467
+ var found_1 = false;
3468
+ _unregisterEvents(target, evtName_1, function (regEvent) {
3469
+ if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
3470
+ found_1 = true;
3471
+ return true;
3472
+ }
3473
+ return false;
3474
+ });
3475
+ if (!found_1) {
3476
+ _doDetach(target, evtName_1, handlerRef, useCapture);
3477
+ }
3478
+ }
3479
+ catch (e) {
3480
+ }
3481
+ }
3482
+ }
3483
+ function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
3484
+ if (useCapture === void 0) { useCapture = false; }
3485
+ return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
3486
+ }
3487
+ function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
3488
+ if (useCapture === void 0) { useCapture = false; }
3489
+ eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);
3490
+ }
3491
+ function addEventHandler(eventName, callback, evtNamespace) {
2277
3492
  var result = false;
2278
3493
  var w = getWindow();
2279
3494
  if (w) {
2280
- result = attachEvent(w, eventName, callback);
2281
- result = attachEvent(w["body"], eventName, callback) || result;
3495
+ result = eventOn(w, eventName, callback, evtNamespace);
3496
+ result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
2282
3497
  }
2283
3498
  var doc = getDocument();
2284
3499
  if (doc) {
2285
- result = attachEvent(doc, eventName, callback) || result;
3500
+ result = eventOn(doc, eventName, callback, evtNamespace) || result;
2286
3501
  }
2287
3502
  return result;
2288
3503
  }
2289
- function addEventListeners(events, listener, excludeEvents) {
3504
+ function removeEventHandler(eventName, callback, evtNamespace) {
3505
+ var w = getWindow();
3506
+ if (w) {
3507
+ eventOff(w, eventName, callback, evtNamespace);
3508
+ eventOff(w["body"], eventName, callback, evtNamespace);
3509
+ }
3510
+ var doc = getDocument();
3511
+ if (doc) {
3512
+ eventOff(doc, eventName, callback, evtNamespace);
3513
+ }
3514
+ }
3515
+ function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
2290
3516
  var added = false;
2291
- if (listener && events && isArray(events)) {
2292
- var excluded_1 = [];
3517
+ if (listener && events && events.length > 0) {
2293
3518
  arrForEach(events, function (name) {
2294
- if (isString(name)) {
3519
+ if (name) {
2295
3520
  if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
2296
- added = addEventHandler(name, listener) || added;
2297
- }
2298
- else {
2299
- excluded_1.push(name);
3521
+ added = addEventHandler(name, listener, evtNamespace) || added;
2300
3522
  }
2301
3523
  }
2302
3524
  });
2303
- if (!added && excluded_1.length > 0) {
2304
- added = addEventListeners(excluded_1, listener);
3525
+ }
3526
+ return added;
3527
+ }
3528
+ function addEventListeners(events, listener, excludeEvents, evtNamespace) {
3529
+ var added = false;
3530
+ if (listener && events && isArray(events)) {
3531
+ added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
3532
+ if (!added && excludeEvents && excludeEvents.length > 0) {
3533
+ added = _addEventListeners(events, listener, null, evtNamespace);
2305
3534
  }
2306
3535
  }
2307
3536
  return added;
2308
3537
  }
2309
- function addPageUnloadEventListener(listener, excludeEvents) {
2310
- return addEventListeners(["beforeunload", "unload", "pagehide"], listener, excludeEvents);
3538
+ function removeEventListeners(events, listener, evtNamespace) {
3539
+ if (events && isArray(events)) {
3540
+ arrForEach(events, function (name) {
3541
+ if (name) {
3542
+ removeEventHandler(name, listener, evtNamespace);
3543
+ }
3544
+ });
3545
+ }
3546
+ }
3547
+ function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
3548
+ return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
2311
3549
  }
2312
- function addPageHideEventListener(listener, excludeEvents) {
3550
+ function removePageUnloadEventListener(listener, evtNamespace) {
3551
+ removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);
3552
+ }
3553
+ function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
2313
3554
  function _handlePageVisibility(evt) {
2314
3555
  var doc = getDocument();
2315
3556
  if (listener && doc && doc.visibilityState === "hidden") {
2316
3557
  listener(evt);
2317
3558
  }
2318
3559
  }
2319
- var pageUnloadAdded = false;
2320
- if (!excludeEvents || arrIndexOf(excludeEvents, strPageHide) === -1) {
2321
- pageUnloadAdded = addEventHandler(strPageHide, listener);
2322
- }
3560
+ var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
3561
+ var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
2323
3562
  if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
2324
- pageUnloadAdded = addEventHandler(strVisibilityChangeEvt, _handlePageVisibility) || pageUnloadAdded;
3563
+ pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
2325
3564
  }
2326
3565
  if (!pageUnloadAdded && excludeEvents) {
2327
- pageUnloadAdded = addPageHideEventListener(listener);
3566
+ pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
2328
3567
  }
2329
3568
  return pageUnloadAdded;
2330
3569
  }
2331
- function addPageShowEventListener(listener, excludeEvents) {
3570
+ function removePageHideEventListener(listener, evtNamespace) {
3571
+ var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
3572
+ removeEventListeners([strPageHide], listener, newNamespaces);
3573
+ removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
3574
+ }
3575
+ function addPageShowEventListener(listener, excludeEvents, evtNamespace) {
2332
3576
  function _handlePageVisibility(evt) {
2333
3577
  var doc = getDocument();
2334
3578
  if (listener && doc && doc.visibilityState === "visible") {
2335
3579
  listener(evt);
2336
3580
  }
2337
3581
  }
2338
- var pageShowAdded = false;
2339
- if (!excludeEvents || arrIndexOf(excludeEvents, strPageShow) === -1) {
2340
- pageShowAdded = addEventHandler(strPageShow, listener);
2341
- }
2342
- if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
2343
- pageShowAdded = addEventHandler(strVisibilityChangeEvt, _handlePageVisibility) || pageShowAdded;
2344
- }
3582
+ var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
3583
+ var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);
3584
+ pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;
2345
3585
  if (!pageShowAdded && excludeEvents) {
2346
- pageShowAdded = addPageShowEventListener(listener);
3586
+ pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);
2347
3587
  }
2348
3588
  return pageShowAdded;
2349
3589
  }
3590
+ function removePageShowEventListener(listener, evtNamespace) {
3591
+ var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
3592
+ removeEventListeners([strPageShow], listener, newNamespaces);
3593
+ removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
3594
+ }
3595
+
2350
3596
  function newGuid() {
2351
3597
  function randomHexDigit() {
2352
3598
  return randomValue(15);
@@ -2363,26 +3609,9 @@
2363
3609
  }
2364
3610
  return dateNow();
2365
3611
  }
2366
- function newId(maxLength) {
2367
- if (maxLength === void 0) { maxLength = 22; }
2368
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2369
- var number = random32() >>> 0;
2370
- var chars = 0;
2371
- var result = "";
2372
- while (result.length < maxLength) {
2373
- chars++;
2374
- result += base64chars.charAt(number & 0x3F);
2375
- number >>>= 6;
2376
- if (chars === 5) {
2377
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
2378
- chars = 0;
2379
- }
2380
- }
2381
- return result;
2382
- }
2383
3612
  function generateW3CId() {
2384
3613
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
2385
- var oct = "", tmp;
3614
+ var oct = strEmpty, tmp;
2386
3615
  for (var a = 0; a < 4; a++) {
2387
3616
  tmp = random32();
2388
3617
  oct +=
@@ -2406,66 +3635,177 @@
2406
3635
  DetachEvent: detachEvent
2407
3636
  };
2408
3637
 
2409
- var ValueKind = {
2410
- NotSet: 0,
2411
- Pii_DistinguishedName: 1,
2412
- Pii_GenericData: 2,
2413
- Pii_IPV4Address: 3,
2414
- Pii_IPv6Address: 4,
2415
- Pii_MailSubject: 5,
2416
- Pii_PhoneNumber: 6,
2417
- Pii_QueryString: 7,
2418
- Pii_SipAddress: 8,
2419
- Pii_SmtpAddress: 9,
2420
- Pii_Identity: 10,
2421
- Pii_Uri: 11,
2422
- Pii_Fqdn: 12,
2423
- Pii_IPV4AddressLegacy: 13,
3638
+ var LoggingSeverity = createEnumStyle({
3639
+ CRITICAL: 1 ,
3640
+ WARNING: 2
3641
+ });
3642
+ var _InternalMessageId = createEnumStyle({
3643
+ BrowserDoesNotSupportLocalStorage: 0 ,
3644
+ BrowserCannotReadLocalStorage: 1 ,
3645
+ BrowserCannotReadSessionStorage: 2 ,
3646
+ BrowserCannotWriteLocalStorage: 3 ,
3647
+ BrowserCannotWriteSessionStorage: 4 ,
3648
+ BrowserFailedRemovalFromLocalStorage: 5 ,
3649
+ BrowserFailedRemovalFromSessionStorage: 6 ,
3650
+ CannotSendEmptyTelemetry: 7 ,
3651
+ ClientPerformanceMathError: 8 ,
3652
+ ErrorParsingAISessionCookie: 9 ,
3653
+ ErrorPVCalc: 10 ,
3654
+ ExceptionWhileLoggingError: 11 ,
3655
+ FailedAddingTelemetryToBuffer: 12 ,
3656
+ FailedMonitorAjaxAbort: 13 ,
3657
+ FailedMonitorAjaxDur: 14 ,
3658
+ FailedMonitorAjaxOpen: 15 ,
3659
+ FailedMonitorAjaxRSC: 16 ,
3660
+ FailedMonitorAjaxSend: 17 ,
3661
+ FailedMonitorAjaxGetCorrelationHeader: 18 ,
3662
+ FailedToAddHandlerForOnBeforeUnload: 19 ,
3663
+ FailedToSendQueuedTelemetry: 20 ,
3664
+ FailedToReportDataLoss: 21 ,
3665
+ FlushFailed: 22 ,
3666
+ MessageLimitPerPVExceeded: 23 ,
3667
+ MissingRequiredFieldSpecification: 24 ,
3668
+ NavigationTimingNotSupported: 25 ,
3669
+ OnError: 26 ,
3670
+ SessionRenewalDateIsZero: 27 ,
3671
+ SenderNotInitialized: 28 ,
3672
+ StartTrackEventFailed: 29 ,
3673
+ StopTrackEventFailed: 30 ,
3674
+ StartTrackFailed: 31 ,
3675
+ StopTrackFailed: 32 ,
3676
+ TelemetrySampledAndNotSent: 33 ,
3677
+ TrackEventFailed: 34 ,
3678
+ TrackExceptionFailed: 35 ,
3679
+ TrackMetricFailed: 36 ,
3680
+ TrackPVFailed: 37 ,
3681
+ TrackPVFailedCalc: 38 ,
3682
+ TrackTraceFailed: 39 ,
3683
+ TransmissionFailed: 40 ,
3684
+ FailedToSetStorageBuffer: 41 ,
3685
+ FailedToRestoreStorageBuffer: 42 ,
3686
+ InvalidBackendResponse: 43 ,
3687
+ FailedToFixDepricatedValues: 44 ,
3688
+ InvalidDurationValue: 45 ,
3689
+ TelemetryEnvelopeInvalid: 46 ,
3690
+ CreateEnvelopeError: 47 ,
3691
+ CannotSerializeObject: 48 ,
3692
+ CannotSerializeObjectNonSerializable: 49 ,
3693
+ CircularReferenceDetected: 50 ,
3694
+ ClearAuthContextFailed: 51 ,
3695
+ ExceptionTruncated: 52 ,
3696
+ IllegalCharsInName: 53 ,
3697
+ ItemNotInArray: 54 ,
3698
+ MaxAjaxPerPVExceeded: 55 ,
3699
+ MessageTruncated: 56 ,
3700
+ NameTooLong: 57 ,
3701
+ SampleRateOutOfRange: 58 ,
3702
+ SetAuthContextFailed: 59 ,
3703
+ SetAuthContextFailedAccountName: 60 ,
3704
+ StringValueTooLong: 61 ,
3705
+ StartCalledMoreThanOnce: 62 ,
3706
+ StopCalledWithoutStart: 63 ,
3707
+ TelemetryInitializerFailed: 64 ,
3708
+ TrackArgumentsNotSpecified: 65 ,
3709
+ UrlTooLong: 66 ,
3710
+ SessionStorageBufferFull: 67 ,
3711
+ CannotAccessCookie: 68 ,
3712
+ IdTooLong: 69 ,
3713
+ InvalidEvent: 70 ,
3714
+ FailedMonitorAjaxSetRequestHeader: 71 ,
3715
+ SendBrowserInfoOnUserInit: 72 ,
3716
+ PluginException: 73 ,
3717
+ NotificationException: 74 ,
3718
+ SnippetScriptLoadFailure: 99 ,
3719
+ InvalidInstrumentationKey: 100 ,
3720
+ CannotParseAiBlobValue: 101 ,
3721
+ InvalidContentBlob: 102 ,
3722
+ TrackPageActionEventFailed: 103 ,
3723
+ FailedAddingCustomDefinedRequestContext: 104 ,
3724
+ InMemoryStorageBufferFull: 105
3725
+ });
3726
+
3727
+ var ValueKind = createEnumStyle({
3728
+ NotSet: 0 ,
3729
+ Pii_DistinguishedName: 1 ,
3730
+ Pii_GenericData: 2 ,
3731
+ Pii_IPV4Address: 3 ,
3732
+ Pii_IPv6Address: 4 ,
3733
+ Pii_MailSubject: 5 ,
3734
+ Pii_PhoneNumber: 6 ,
3735
+ Pii_QueryString: 7 ,
3736
+ Pii_SipAddress: 8 ,
3737
+ Pii_SmtpAddress: 9 ,
3738
+ Pii_Identity: 10 ,
3739
+ Pii_Uri: 11 ,
3740
+ Pii_Fqdn: 12 ,
3741
+ Pii_IPV4AddressLegacy: 13 ,
2424
3742
  CustomerContent_GenericContent: 32
2425
- };
2426
- var EventLatency = {
3743
+ });
3744
+ var EventLatency = createEnumStyle({
2427
3745
  Normal: 1 ,
2428
3746
  CostDeferred: 2 ,
2429
3747
  RealTime: 3 ,
2430
3748
  Immediate: 4
2431
- };
2432
- var EventPropertyType = {
2433
- Unspecified: 0,
2434
- String: 1,
2435
- Int32: 2,
2436
- UInt32: 3,
2437
- Int64: 4,
2438
- UInt64: 5,
2439
- Double: 6,
2440
- Bool: 7,
2441
- Guid: 8,
3749
+ });
3750
+ var EventPropertyType = createEnumStyle({
3751
+ Unspecified: 0 ,
3752
+ String: 1 ,
3753
+ Int32: 2 ,
3754
+ UInt32: 3 ,
3755
+ Int64: 4 ,
3756
+ UInt64: 5 ,
3757
+ Double: 6 ,
3758
+ Bool: 7 ,
3759
+ Guid: 8 ,
2442
3760
  DateTime: 9
2443
- };
2444
- var EventPersistence = {
3761
+ });
3762
+ var EventPersistence = createEnumStyle({
2445
3763
  Normal: 1 ,
2446
3764
  Critical: 2
2447
- };
2448
- var TraceLevel = {
2449
- NONE: 0,
2450
- ERROR: 1,
2451
- WARNING: 2,
3765
+ });
3766
+ var TraceLevel = createEnumStyle({
3767
+ NONE: 0 ,
3768
+ ERROR: 1 ,
3769
+ WARNING: 2 ,
2452
3770
  INFORMATION: 3
2453
- };
2454
- var _ExtendedInternalMessageId = __assignFn(__assignFn({}, _InternalMessageId), { AuthHandShakeError: 501, AuthRedirectFail: 502, BrowserCannotReadLocalStorage: 503, BrowserCannotWriteLocalStorage: 504, BrowserDoesNotSupportLocalStorage: 505, CannotParseBiBlobValue: 506, CannotParseDataAttribute: 507, CVPluginNotAvailable: 508, DroppedEvent: 509, ErrorParsingAISessionCookie: 510, ErrorProvidedChannels: 511, FailedToGetCookies: 512, FailedToInitializeCorrelationVector: 513, FailedToInitializeSDK: 514, InvalidContentBlob: 515, InvalidCorrelationValue: 516, SessionRenewalDateIsZero: 517, SendPostOnCompleteFailure: 518, PostResponseHandler: 519, SDKNotInitialized: 520 });
3771
+ });
3772
+ var _ExtendedInternalMessageId = objFreeze(__assignFn(__assignFn({}, _InternalMessageId), createEnumStyle({
3773
+ AuthHandShakeError: 501 ,
3774
+ AuthRedirectFail: 502 ,
3775
+ BrowserCannotReadLocalStorage: 503 ,
3776
+ BrowserCannotWriteLocalStorage: 504 ,
3777
+ BrowserDoesNotSupportLocalStorage: 505 ,
3778
+ CannotParseBiBlobValue: 506 ,
3779
+ CannotParseDataAttribute: 507 ,
3780
+ CVPluginNotAvailable: 508 ,
3781
+ DroppedEvent: 509 ,
3782
+ ErrorParsingAISessionCookie: 510 ,
3783
+ ErrorProvidedChannels: 511 ,
3784
+ FailedToGetCookies: 512 ,
3785
+ FailedToInitializeCorrelationVector: 513 ,
3786
+ FailedToInitializeSDK: 514 ,
3787
+ InvalidContentBlob: 515 ,
3788
+ InvalidCorrelationValue: 516 ,
3789
+ SessionRenewalDateIsZero: 517 ,
3790
+ SendPostOnCompleteFailure: 518 ,
3791
+ PostResponseHandler: 519 ,
3792
+ SDKNotInitialized: 520
3793
+ })));
2455
3794
 
2456
3795
  var _a;
2457
- var Version = '3.1.9';
3796
+ var Version = '3.2.0';
2458
3797
  var FullVersionString = "1DS-Web-JS-" + Version;
2459
3798
  var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2460
3799
  var strWithCredentials = "withCredentials";
3800
+ var strTimeout = "timeout";
2461
3801
  var _fieldTypeEventPropMap = (_a = {},
2462
- _a[0 ] = EventPropertyType.Unspecified,
2463
- _a[2 ] = EventPropertyType.Double,
2464
- _a[1 ] = EventPropertyType.String,
2465
- _a[3 ] = EventPropertyType.Bool,
2466
- _a[4096 | 2 ] = EventPropertyType.Double,
2467
- _a[4096 | 1 ] = EventPropertyType.String,
2468
- _a[4096 | 3 ] = EventPropertyType.Bool,
3802
+ _a[0 ] = 0 ,
3803
+ _a[2 ] = 6 ,
3804
+ _a[1 ] = 1 ,
3805
+ _a[3 ] = 7 ,
3806
+ _a[4096 | 2 ] = 6 ,
3807
+ _a[4096 | 1 ] = 1 ,
3808
+ _a[4096 | 3 ] = 7 ,
2469
3809
  _a);
2470
3810
  var uInt8ArraySupported = null;
2471
3811
  var isDocumentObjectAvailable = Boolean(getDocument());
@@ -2489,7 +3829,7 @@
2489
3829
  return uInt8ArraySupported;
2490
3830
  }
2491
3831
  function isLatency(value) {
2492
- if (value && isNumber(value) && value >= EventLatency.Normal && value <= EventLatency.Immediate) {
3832
+ if (value && isNumber(value) && value >= 1 && value <= 4 ) {
2493
3833
  return true;
2494
3834
  }
2495
3835
  return false;
@@ -2545,7 +3885,7 @@
2545
3885
  if (encodedTypeValue !== -1 && propType !== -1) {
2546
3886
  encodedTypeValue |= propType;
2547
3887
  }
2548
- else if (propType === EventPropertyType.Double) {
3888
+ else if (propType === 6 ) {
2549
3889
  encodedTypeValue = propType;
2550
3890
  }
2551
3891
  }
@@ -2635,7 +3975,7 @@
2635
3975
  }
2636
3976
  var getTime = perfNow;
2637
3977
  function isValueKind(value) {
2638
- if (value === ValueKind.NotSet || ((value > ValueKind.NotSet && value <= ValueKind.Pii_IPV4AddressLegacy) || value === ValueKind.CustomerContent_GenericContent)) {
3978
+ if (value === 0 || ((value > 0 && value <= 13 ) || value === 32 )) {
2639
3979
  return true;
2640
3980
  }
2641
3981
  return false;
@@ -2781,7 +4121,7 @@
2781
4121
  function isChromium() {
2782
4122
  return !!getGlobalInst("chrome");
2783
4123
  }
2784
- function openXhr(method, urlString, withCredentials, disabled, isSync) {
4124
+ function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {
2785
4125
  if (disabled === void 0) { disabled = false; }
2786
4126
  if (isSync === void 0) { isSync = false; }
2787
4127
  function _wrapSetXhrProp(xhr, prop, value) {
@@ -2802,6 +4142,9 @@
2802
4142
  if (withCredentials) {
2803
4143
  _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
2804
4144
  }
4145
+ if (!isSync && timeout) {
4146
+ _wrapSetXhrProp(xhr, strTimeout, timeout);
4147
+ }
2805
4148
  return xhr;
2806
4149
  }
2807
4150
 
@@ -2815,7 +4158,7 @@
2815
4158
  _this.pluginVersionString = "";
2816
4159
  dynamicProto(AppInsightsCore, _this, function (_self, _base) {
2817
4160
  if (!_self.logger || !_self.logger.queue) {
2818
- _self.logger = new DiagnosticLogger({ loggingLevelConsole: exports.LoggingSeverity.CRITICAL });
4161
+ _self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
2819
4162
  }
2820
4163
  _self.initialize = function (config, extensions, logger, notificationManager) {
2821
4164
  doPerf(_self, function () { return "AppInsightsCore.initialize"; }, function () {
@@ -2862,7 +4205,7 @@
2862
4205
  if (message.indexOf("channels") !== -1) {
2863
4206
  message += "\n - Channels must be provided through config.channels only!";
2864
4207
  }
2865
- logger_1.throwInternal(exports.LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.FailedToInitializeSDK, "SDK Initialization Failed - no telemetry will be sent: " + message);
4208
+ logger_1.throwInternal(1 , 514 , "SDK Initialization Failed - no telemetry will be sent: " + message);
2866
4209
  }
2867
4210
  }, function () { return ({ config: config, extensions: extensions, logger: logger, notificationManager: notificationManager }); });
2868
4211
  };
@@ -2873,7 +4216,7 @@
2873
4216
  telemetryItem.timings = telemetryItem.timings || {};
2874
4217
  telemetryItem.timings.trackStart = getTime();
2875
4218
  if (!isLatency(telemetryItem.latency)) {
2876
- telemetryItem.latency = EventLatency.Normal;
4219
+ telemetryItem.latency = 1 ;
2877
4220
  }
2878
4221
  var itemExt = telemetryItem.ext = telemetryItem.ext || {};
2879
4222
  itemExt.sdk = itemExt.sdk || {};
@@ -2916,7 +4259,7 @@
2916
4259
  _base.initialize(config, extensions, logger, notificationManager);
2917
4260
  }
2918
4261
  catch (e) {
2919
- _self.logger.throwInternal(exports.LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.FailedToInitializeSDK, "Initialization Failed: " + dumpObj(e) + "\n - Note: Channels must be provided through config.channels only");
4262
+ _throwInternal(_self.logger, 1 , 514 , "Initialization Failed: " + dumpObj(e) + "\n - Note: Channels must be provided through config.channels only");
2920
4263
  }
2921
4264
  };
2922
4265
  _self.track = function (item) {
@@ -3520,6 +4863,7 @@
3520
4863
  exports.FullVersionString = FullVersionString;
3521
4864
  exports.InternalAppInsightsCore = AppInsightsCore$2;
3522
4865
  exports.InternalBaseCore = BaseCore$2;
4866
+ exports.LoggingSeverity = LoggingSeverity;
3523
4867
  exports.MinChannelPriorty = MinChannelPriorty;
3524
4868
  exports.NotificationManager = NotificationManager;
3525
4869
  exports.PerfEvent = PerfEvent;
@@ -3534,6 +4878,8 @@
3534
4878
  exports._ExtendedInternalMessageId = _ExtendedInternalMessageId;
3535
4879
  exports._InternalLogMessage = _InternalLogMessage;
3536
4880
  exports._InternalMessageId = _InternalMessageId;
4881
+ exports.__getRegisteredEvents = __getRegisteredEvents;
4882
+ exports._throwInternal = _throwInternal;
3537
4883
  exports.addEventHandler = addEventHandler;
3538
4884
  exports.addEventListeners = addEventListeners;
3539
4885
  exports.addPageHideEventListener = addPageHideEventListener;
@@ -3547,7 +4893,11 @@
3547
4893
  exports.attachEvent = attachEvent;
3548
4894
  exports.cookieAvailable = areCookiesSupported;
3549
4895
  exports.createCookieMgr = createCookieMgr;
4896
+ exports.createEnumStyle = createEnumStyle;
3550
4897
  exports.createGuid = createGuid;
4898
+ exports.createProcessTelemetryContext = createProcessTelemetryContext;
4899
+ exports.createUniqueNamespace = createUniqueNamespace;
4900
+ exports.createUnloadHandlerContainer = createUnloadHandlerContainer;
3551
4901
  exports.dateNow = dateNow;
3552
4902
  exports.deleteCookie = deleteCookie;
3553
4903
  exports.detachEvent = detachEvent;
@@ -3555,6 +4905,8 @@
3555
4905
  exports.disallowsSameSiteNone = uaDisallowsSameSiteNone;
3556
4906
  exports.doPerf = doPerf;
3557
4907
  exports.dumpObj = dumpObj;
4908
+ exports.eventOff = eventOff;
4909
+ exports.eventOn = eventOn;
3558
4910
  exports.extend = extend;
3559
4911
  exports.generateW3CId = generateW3CId;
3560
4912
  exports.getCommonSchemaMetaData = getCommonSchemaMetaData;
@@ -3611,19 +4963,29 @@
3611
4963
  exports.isValueKind = isValueKind;
3612
4964
  exports.isWindowObjectAvailable = isWindowObjectAvailable;
3613
4965
  exports.isXhrSupported = isXhrSupported;
4966
+ exports.mergeEvtNamespace = mergeEvtNamespace;
3614
4967
  exports.newGuid = newGuid;
3615
4968
  exports.newId = newId;
3616
4969
  exports.normalizeJsName = normalizeJsName;
3617
4970
  exports.objCreate = objCreateFn;
3618
4971
  exports.objDefineAccessors = objDefineAccessors;
3619
4972
  exports.objForEachKey = objForEachKey;
4973
+ exports.objFreeze = objFreeze;
3620
4974
  exports.objKeys = objKeys;
4975
+ exports.objSeal = objSeal;
3621
4976
  exports.openXhr = openXhr;
3622
4977
  exports.optimizeObject = optimizeObject;
3623
4978
  exports.perfNow = perfNow;
3624
4979
  exports.proxyAssign = proxyAssign;
4980
+ exports.proxyFunctionAs = proxyFunctionAs;
4981
+ exports.proxyFunctions = proxyFunctions;
3625
4982
  exports.random32 = random32;
3626
4983
  exports.randomValue = randomValue;
4984
+ exports.removeEventHandler = removeEventHandler;
4985
+ exports.removeEventListeners = removeEventListeners;
4986
+ exports.removePageHideEventListener = removePageHideEventListener;
4987
+ exports.removePageShowEventListener = removePageShowEventListener;
4988
+ exports.removePageUnloadEventListener = removePageUnloadEventListener;
3627
4989
  exports.safeGetCookieMgr = safeGetCookieMgr;
3628
4990
  exports.safeGetLogger = safeGetLogger;
3629
4991
  exports.sanitizeProperty = sanitizeProperty;
@@ -3633,9 +4995,7 @@
3633
4995
  exports.setValue = setValue;
3634
4996
  exports.strContains = strContains;
3635
4997
  exports.strEndsWith = strEndsWith;
3636
- exports.strExtensionConfig = strExtensionConfig;
3637
4998
  exports.strFunction = strShimFunction;
3638
- exports.strIKey = strIKey;
3639
4999
  exports.strObject = strShimObject;
3640
5000
  exports.strPrototype = strShimPrototype;
3641
5001
  exports.strStartsWith = strStartsWith;
@@ -3648,4 +5008,4 @@
3648
5008
  (function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
3649
5009
 
3650
5010
  })(this.oneDS = this.oneDS || {});
3651
- //# sourceMappingURL=ms.core-3.1.9.gbl.js.map
5011
+ //# sourceMappingURL=ms.core-3.2.0.gbl.js.map