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FC,IACE,wBAAFC,IACE,yBAAFC,IACE,0BAAFC,IACE,oBAAFC,IACE,kBAAFC,QCxG+B","sources":["webpack://@msidentity/sisu-msa/../src/Constants.ts","webpack://@msidentity/sisu-msa/../src/Helpers.ts","webpack://@msidentity/sisu-msa/../src/TsLibShims.ts","webpack://@msidentity/sisu-msa/../../out/lib/src/DynamicProto.js","webpack://@msidentity/sisu-msa/__DynamicConstants.js","webpack://@msidentity/sisu-msa/InternalConstants.js","webpack://@msidentity/sisu-msa/HelperFuncs.js","webpack://@msidentity/sisu-msa/EnvUtils.js","webpack://@msidentity/sisu-msa/DbgExtensionUtils.js","webpack://@msidentity/sisu-msa/DiagnosticLogger.js","webpack://@msidentity/sisu-msa/CookieMgr.js","webpack://@msidentity/sisu-msa/RandomHelper.js","webpack://@msidentity/sisu-msa/DataCacheHelper.js","webpack://@msidentity/sisu-msa/EventHelpers.js","webpack://@msidentity/sisu-msa/CoreUtils.js","webpack://@msidentity/sisu-msa/Utils.js","webpack://@msidentity/sisu-msa/PerfManager.js","webpack://@msidentity/sisu-msa/W3cTraceParent.js","webpack://@msidentity/sisu-msa/TelemetryHelpers.js","webpack://@msidentity/sisu-msa/ProcessTelemetryContext.js","webpack://@msidentity/sisu-msa/UnloadHandlerContainer.js","webpack://@msidentity/sisu-msa/BaseTelemetryPlugin.js","webpack://@msidentity/sisu-msa/EnumHelperFuncs.js","webpack://@msidentity/sisu-msa/ExtensionKeys.js","webpack://@msidentity/sisu-msa/Session.js","webpack://@msidentity/sisu-msa/SessionManager.js","webpack://@msidentity/sisu-msa/Application.js","webpack://@msidentity/sisu-msa/Cloud.js","webpack://@msidentity/sisu-msa/Device.js","webpack://@msidentity/sisu-msa/IntWeb.js","webpack://@msidentity/sisu-msa/Loc.js","webpack://@msidentity/sisu-msa/OperatingSystem.js","webpack://@msidentity/sisu-msa/Sdk.js","webpack://@msidentity/sisu-msa/Trace.js","webpack://@msidentity/sisu-msa/User.js","webpack://@msidentity/sisu-msa/Utc.js","webpack://@msidentity/sisu-msa/Web.js","webpack://@msidentity/sisu-msa/TelemetryContext.js","webpack://@msidentity/sisu-msa/PropertiesPlugin.js","webpack://@msidentity/sisu-msa/ChannelController.js","webpack://@msidentity/sisu-msa/TelemetryInitializerPlugin.js","webpack://@msidentity/sisu-msa/BaseCore.js","webpack://@msidentity/sisu-msa/NotificationManager.js","webpack://@msidentity/sisu-msa/AppInsightsCore.js","webpack://@msidentity/sisu-msa/EventsDiscardedReason.js","webpack://@msidentity/sisu-msa/DataModels.js","webpack://@msidentity/sisu-msa/EventBatch.js","webpack://@msidentity/sisu-msa/ClockSkewManager.js","webpack://@msidentity/sisu-msa/KillSwitch.js","webpack://@msidentity/sisu-msa/RetryPolicy.js","webpack://@msidentity/sisu-msa/Serializer.js","webpack://@msidentity/sisu-msa/HttpManager.js","webpack://@msidentity/sisu-msa/TimeoutOverrideWrapper.js","webpack://@msidentity/sisu-msa/PostChannel.js","webpack://@msidentity/sisu-msa/LoggingEnums.js","webpack://@msidentity/sisu-msa/ApplicationInsights.js","webpack://@msidentity/sisu-msa/Enums.js","webpack://@msidentity/sisu-msa/IChannelControls.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\r\nexport const strShimFunction = \"function\";\r\nexport const strShimObject = \"object\";\r\nexport const strShimUndefined = \"undefined\";\r\nexport const strShimPrototype = \"prototype\";\r\nexport const strShimHasOwnProperty = \"hasOwnProperty\";\r\nexport const strDefault = \"default\";\r\n\r\nexport const ObjClass = Object;\r\nexport const ObjProto = ObjClass[strShimPrototype];\r\nexport const ObjAssign = ObjClass[\"assign\"];\r\nexport const ObjCreate = ObjClass[\"create\"];\r\nexport const ObjDefineProperty = ObjClass[\"defineProperty\"];\r\nexport const ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\r\nimport { ObjCreate, strShimFunction, strShimObject, strShimPrototype, strShimUndefined } from \"./Constants\";\r\n\r\ndeclare var globalThis: Window;\r\ndeclare var global: Window;\r\n\r\nlet _cachedGlobal: Window = null;\r\n\r\n/**\r\n * Returns the current global scope object, for a normal web page this will be the current\r\n * window, for a Web Worker this will be current worker global scope via \"self\". The internal\r\n * implementation returns the first available instance object in the following order\r\n * - globalThis (New standard)\r\n * - self (Will return the current window instance for supported browsers)\r\n * - window (fallback for older browser implementations)\r\n * - global (NodeJS standard)\r\n * - (When all else fails)\r\n * While the return type is a Window for the normal case, not all environments will support all\r\n * of the properties or functions.\r\n */\r\nexport function getGlobal(useCached: boolean = true): Window {\r\n let result = useCached === false ? null : _cachedGlobal;\r\n\r\n if (!result) {\r\n if (typeof globalThis !== strShimUndefined) {\r\n result = globalThis;\r\n }\r\n\r\n if (!result && typeof self !== strShimUndefined) {\r\n result = self;\r\n }\r\n\r\n if (!result && typeof window !== strShimUndefined) {\r\n result = window;\r\n }\r\n \r\n if (!result && typeof global !== strShimUndefined) {\r\n result = global;\r\n }\r\n\r\n _cachedGlobal = result;\r\n }\r\n\r\n return result;\r\n}\r\n\r\nexport function throwTypeError(message: string): never {\r\n throw new TypeError(message);\r\n}\r\n\r\n/**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties. This helper exists to avoid adding a polyfil\r\n * for older browsers that do not define Object.create eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.create implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param obj Object to use as a prototype. May be null\r\n */\r\nexport function objCreateFn(obj: any): any {\r\n var func = ObjCreate;\r\n // Use build in Object.create\r\n if (func) {\r\n // Use Object create method if it exists\r\n return func(obj);\r\n }\r\n if (obj == null) {\r\n return {};\r\n }\r\n var type = typeof obj;\r\n if (type !== strShimObject && type !== strShimFunction) {\r\n throwTypeError(\"Object prototype may only be an Object:\" + obj);\r\n }\r\n\r\n function tmpFunc() {}\r\n tmpFunc[strShimPrototype] = obj;\r\n\r\n return new (tmpFunc as any)();\r\n}\r\n\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\r\nimport {\r\n ObjAssign, ObjClass, ObjCreate, ObjDefineProperty, ObjHasOwnProperty, ObjProto,\r\n strDefault, strShimFunction, strShimHasOwnProperty, strShimPrototype\r\n} from \"./Constants\";\r\nimport { getGlobal, objCreateFn, throwTypeError } from \"./Helpers\";\r\n\r\n// Most of these functions have been directly shamelessly \"lifted\" from the https://github.com/@microsoft/tslib and\r\n// modified to be ES3 compatible and applying several minification and tree-shaking techniques so that Application Insights\r\n// can successfully use TypeScript \"importHelpers\" which imports tslib during compilation but it will use these at runtime\r\n// Which is also why all of the functions have not been included as Application Insights currently doesn't use or require\r\n// them.\r\n\r\nexport const SymbolObj = (getGlobal()||{})[\"Symbol\"];\r\nexport const ReflectObj = (getGlobal()||{})[\"Reflect\"];\r\nexport const __hasSymbol = !!SymbolObj;\r\nexport const __hasReflect = !!ReflectObj;\r\n\r\nconst strDecorate = \"decorate\";\r\nconst strMetadata = \"metadata\";\r\nconst strGetOwnPropertySymbols = \"getOwnPropertySymbols\";\r\nconst strIterator = \"iterator\";\r\n\r\nexport declare type ObjAssignFunc = (t: any, ...sources:any[]) => any;\r\n\r\nexport var __objAssignFnImpl: ObjAssignFunc = function(t: any): any {\r\n // tslint:disable-next-line: ban-comma-operator\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) {\r\n if (ObjProto[strShimHasOwnProperty].call(s, p)) {\r\n (t as any)[p] = s[p];\r\n }\r\n }\r\n }\r\n return t;\r\n};\r\n\r\nexport var __assignFn: ObjAssignFunc = ObjAssign || __objAssignFnImpl;\r\n\r\n// tslint:disable-next-line: only-arrow-functions\r\nvar extendStaticsFn = function(d: any, b: any): any {\r\n extendStaticsFn = ObjClass[\"setPrototypeOf\"] ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n ({ __proto__: [] } instanceof Array && function (d: any, b: any) {\r\n d.__proto__ = b;\r\n }) ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n function (d: any, b: any) {\r\n for (var p in b) {\r\n if (b[strShimHasOwnProperty](p)) {\r\n d[p] = b[p];\r\n }\r\n }\r\n };\r\n return extendStaticsFn(d, b);\r\n};\r\n\r\nexport function __extendsFn(d: any, b: any) {\r\n if (typeof b !== strShimFunction && b !== null) {\r\n throwTypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n }\r\n extendStaticsFn(d, b);\r\n function __(this: any) {\r\n this.constructor = d;\r\n }\r\n // tslint:disable-next-line: ban-comma-operator\r\n d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new (__ as any)());\r\n}\r\n\r\nexport function __restFn(s: any, e: any) {\r\n var t = {};\r\n for (var k in s) {\r\n if (ObjHasOwnProperty.call(s, k) && e.indexOf(k) < 0) {\r\n t[k] = s[k];\r\n }\r\n }\r\n if (s != null && typeof ObjClass[strGetOwnPropertySymbols] === strShimFunction) {\r\n for (var i = 0, p = ObjClass[strGetOwnPropertySymbols](s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && ObjProto[\"propertyIsEnumerable\"].call(s, p[i])) {\r\n t[p[i]] = s[p[i]];\r\n }\r\n }\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorateFn(decorators: any, target: any, key: any, desc: any) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = ObjClass[\"getOwnPropertyDescriptor\"](target, key) : desc, d;\r\n if (__hasReflect && typeof ReflectObj[strDecorate] === strShimFunction) {\r\n r = ReflectObj[strDecorate](decorators, target, key, desc);\r\n } else {\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n // eslint-disable-next-line no-cond-assign\r\n if (d = decorators[i]) {\r\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n }\r\n }\r\n }\r\n\r\n // tslint:disable-next-line:ban-comma-operator\r\n return c > 3 && r && ObjDefineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __paramFn(paramIndex: number, decorator: Function) {\r\n return function (target: any, key: any) {\r\n decorator(target, key, paramIndex);\r\n }\r\n}\r\n\r\nexport function __metadataFn(metadataKey: any, metadataValue: any) {\r\n if (__hasReflect && ReflectObj[strMetadata] === strShimFunction) {\r\n return ReflectObj[strMetadata](metadataKey, metadataValue);\r\n }\r\n}\r\n\r\nexport function __exportStarFn(m: any, o: any) {\r\n for (var p in m) {\r\n if (p !== strDefault && !ObjHasOwnProperty.call(o, p)) {\r\n __createBindingFn(o, m, p);\r\n }\r\n }\r\n}\r\n\r\nexport function __createBindingFn(o: any, m: any, k: any, k2?: any) {\r\n if (k2 === undefined) {\r\n k2 = k;\r\n }\r\n \r\n if (!!ObjCreate) {\r\n ObjDefineProperty(o, k2, {\r\n enumerable: true,\r\n get() {\r\n return m[k];\r\n }\r\n });\r\n } else {\r\n o[k2] = m[k];\r\n }\r\n}\r\n\r\nexport function __valuesFn(o: any) {\r\n var s = typeof SymbolObj === strShimFunction && SymbolObj[strIterator], m = s && o[s], i = 0;\r\n if (m) {\r\n return m.call(o);\r\n }\r\n\r\n if (o && typeof o.length === \"number\") {\r\n return {\r\n next () {\r\n if (o && i >= o.length) {\r\n o = void 0;\r\n }\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n }\r\n\r\n throwTypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __readFn(o: any, n: any) {\r\n var m = typeof SymbolObj === strShimFunction && o[SymbolObj[strIterator]];\r\n if (!m) {\r\n return o;\r\n }\r\n\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\r\n ar.push(r.value);\r\n }\r\n } catch (error) {\r\n e = {\r\n error\r\n };\r\n } finally {\r\n try {\r\n // tslint:disable-next-line:no-conditional-assignment\r\n if (r && !r.done && (m = i[\"return\"])) {\r\n m.call(i);\r\n }\r\n } finally {\r\n if (e) {\r\n // eslint-disable-next-line no-unsafe-finally\r\n throw e.error;\r\n }\r\n }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArraysFn() {\r\n var theArgs = arguments;\r\n // Calculate new total size\r\n for (var s = 0, i = 0, il = theArgs.length; i < il; i++) {\r\n s += theArgs[i].length;\r\n }\r\n\r\n // Create new full array\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\r\n for (var a = theArgs[i], j = 0, jl = a.length; j < jl; j++, k++) {\r\n r[k] = a[j];\r\n }\r\n }\r\n\r\n return r;\r\n}\r\n\r\nexport function __spreadArrayFn(to: any, from: any) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {\r\n to[j] = from[i];\r\n }\r\n\r\n return to;\r\n}\r\n\r\nexport function __makeTemplateObjectFn(cooked: any, raw: any) {\r\n if (ObjDefineProperty) {\r\n ObjDefineProperty(cooked, \"raw\", { value: raw });\r\n } else {\r\n cooked.raw = raw;\r\n }\r\n\r\n return cooked;\r\n}\r\n\r\nexport function __importStarFn(mod: any) {\r\n if (mod && mod.__esModule) {\r\n return mod;\r\n }\r\n\r\n var result = {};\r\n if (mod != null) {\r\n for (var k in mod) {\r\n if (k !== strDefault && Object.prototype.hasOwnProperty.call(mod, k)) {\r\n __createBindingFn(result, mod, k);\r\n }\r\n }\r\n }\r\n\r\n // Set default module\r\n if (!!ObjCreate) {\r\n ObjDefineProperty( result, strDefault, { enumerable: true, value: mod });\r\n } else {\r\n result[strDefault] = mod;\r\n }\r\n\r\n return result;\r\n}\r\n\r\nexport function __importDefaultFn(mod:any) {\r\n return (mod && mod.__esModule) ? mod : { strDefault: mod };\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar _a;\r\n;\r\nvar UNDEFINED = \"undefined\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Constructor = 'constructor';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Prototype = 'prototype';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strFunction = 'function';\r\n/**\r\n * Used to define the name of the instance function lookup table\r\n * @ignore\r\n */\r\nvar DynInstFuncTable = '_dynInstFuncs';\r\n/**\r\n * Name used to tag the dynamic prototype function\r\n * @ignore\r\n */\r\nvar DynProxyTag = '_isDynProxy';\r\n/**\r\n * Name added to a prototype to define the dynamic prototype \"class\" name used to lookup the function table\r\n * @ignore\r\n */\r\nvar DynClassName = '_dynClass';\r\n/**\r\n * Prefix added to the classname to avoid any name clashes with other instance level properties\r\n * @ignore\r\n */\r\nvar DynClassNamePrefix = '_dynCls$';\r\n/**\r\n * A tag which is used to check if we have already to attempted to set the instance function if one is not present\r\n * @ignore\r\n */\r\nvar DynInstChkTag = '_dynInstChk';\r\n/**\r\n * A tag which is used to check if we are allows to try and set an instance function is one is not present. Using the same\r\n * tag name as the function level but a different const name for readability only.\r\n */\r\nvar DynAllowInstChkTag = DynInstChkTag;\r\n/**\r\n * The global (imported) instances where the global performance options are stored\r\n */\r\nvar DynProtoDefaultOptions = '_dfOpts';\r\n/**\r\n * Value used as the name of a class when it cannot be determined\r\n * @ignore\r\n */\r\nvar UnknownValue = '_unknown_';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * The polyfill version of __proto__ so that it doesn't cause issues for anyone not expecting it to exist\r\n */\r\nvar DynProtoBaseProto = \"_dyn\" + str__Proto;\r\n/**\r\n * Runtime Global holder for dynamicProto settings\r\n */\r\nvar DynProtoGlobalSettings = \"__dynProto$Gbl\";\r\n/**\r\n * Track the current prototype for IE8 as you can't look back to get the prototype\r\n */\r\nvar DynProtoCurrent = \"_dynInstProto\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strUseBaseInst = 'useBaseInst';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strSetInstFuncs = 'setInstFuncs';\r\nvar Obj = Object;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Obj[\"getPrototypeOf\"];\r\n/**\r\n * Pre-lookup to check for the existence of this function\r\n */\r\nvar _objGetOwnProps = Obj[\"getOwnPropertyNames\"];\r\n/**\r\n * Gets the runtime global reference\r\n * @returns\r\n */\r\nfunction _getGlobal() {\r\n var result;\r\n if (typeof globalThis !== UNDEFINED) {\r\n result = globalThis;\r\n }\r\n if (!result && typeof self !== UNDEFINED) {\r\n result = self;\r\n }\r\n if (!result && typeof window !== UNDEFINED) {\r\n result = window;\r\n }\r\n if (!result && typeof global !== UNDEFINED) {\r\n result = global;\r\n }\r\n return result || {};\r\n}\r\n// Since 1.1.7 moving these to the runtime global to work around mixed version and module issues\r\n// See Issue https://github.com/microsoft/DynamicProto-JS/issues/57 for details\r\nvar _gbl = _getGlobal();\r\nvar _gblInst = _gbl[DynProtoGlobalSettings] || (_gbl[DynProtoGlobalSettings] = {\r\n o: (_a = {},\r\n _a[strSetInstFuncs] = true,\r\n _a[strUseBaseInst] = true,\r\n _a),\r\n n: 1000 // Start new global index @ 1000 so we \"fix\" some cases when mixed with 1.1.6 or earlier\r\n});\r\n/**\r\n * Helper to check if the object contains a property of the name\r\n * @ignore\r\n */\r\nfunction _hasOwnProperty(obj, prop) {\r\n return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype or Array prototype\r\n * @ignore\r\n */\r\nfunction _isObjectOrArrayPrototype(target) {\r\n return target && (target === Obj[Prototype] || target === Array[Prototype]);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype, Array prototype or Function prototype\r\n * @ignore\r\n */\r\nfunction _isObjectArrayOrFunctionPrototype(target) {\r\n return _isObjectOrArrayPrototype(target) || target === Function[Prototype];\r\n}\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nfunction _getObjProto(target) {\r\n var newProto;\r\n if (target) {\r\n // This method doesn't exist in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);\r\n // Using the pre-calculated value as IE8 doesn't support looking up the prototype of a prototype and thus fails for more than 1 base class\r\n newProto = target[DynProtoBaseProto] || curProto;\r\n if (!_hasOwnProperty(target, DynProtoBaseProto)) {\r\n // As this prototype doesn't have this property then this is from an inherited class so newProto is the base to return so save it\r\n // so we can look it up value (which for a multiple hierarchy dynamicProto will be the base class)\r\n delete target[DynProtoCurrent]; // Delete any current value allocated to this instance so we pick up the value from prototype hierarchy\r\n newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];\r\n target[DynProtoCurrent] = curProto;\r\n }\r\n }\r\n return newProto;\r\n}\r\n/**\r\n * Helper to get the properties of an object, including none enumerable ones as functions on a prototype in ES6\r\n * are not enumerable.\r\n * @param target\r\n */\r\nfunction _forEachProp(target, func) {\r\n var props = [];\r\n if (_objGetOwnProps) {\r\n props = _objGetOwnProps(target);\r\n }\r\n else {\r\n for (var name_1 in target) {\r\n if (typeof name_1 === \"string\" && _hasOwnProperty(target, name_1)) {\r\n props.push(name_1);\r\n }\r\n }\r\n }\r\n if (props && props.length > 0) {\r\n for (var lp = 0; lp < props.length; lp++) {\r\n func(props[lp]);\r\n }\r\n }\r\n}\r\n/**\r\n * Helper function to check whether the provided function name is a potential candidate for dynamic\r\n * callback and prototype generation.\r\n * @param target The target object, may be a prototype or class object\r\n * @param funcName The function name\r\n * @param skipOwn Skips the check for own property\r\n * @ignore\r\n */\r\nfunction _isDynamicCandidate(target, funcName, skipOwn) {\r\n return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));\r\n}\r\n/**\r\n * Helper to throw a TypeError exception\r\n * @param message the message\r\n * @ignore\r\n */\r\nfunction _throwTypeError(message) {\r\n throw new TypeError(\"DynamicProto: \" + message);\r\n}\r\n/**\r\n * Returns a collection of the instance functions that are defined directly on the thisTarget object, it does\r\n * not return any inherited functions\r\n * @param thisTarget The object to get the instance functions from\r\n * @ignore\r\n */\r\nfunction _getInstanceFuncs(thisTarget) {\r\n // Get the base proto\r\n var instFuncs = {};\r\n // Save any existing instance functions\r\n _forEachProp(thisTarget, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {\r\n // Create an instance callback for passing the base function to the caller\r\n instFuncs[name] = thisTarget[name];\r\n }\r\n });\r\n return instFuncs;\r\n}\r\n/**\r\n * Returns whether the value is included in the array\r\n * @param values The array of values\r\n * @param value The value\r\n */\r\nfunction _hasVisited(values, value) {\r\n for (var lp = values.length - 1; lp >= 0; lp--) {\r\n if (values[lp] === value) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Returns an object that contains callback functions for all \"base/super\" functions, this is used to \"save\"\r\n * enabling calling super.xxx() functions without requiring that the base \"class\" has defined a prototype references\r\n * @param target The current instance\r\n * @ignore\r\n */\r\nfunction _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {\r\n function _instFuncProxy(target, funcHost, funcName) {\r\n var theFunc = funcHost[funcName];\r\n if (theFunc[DynProxyTag] && useBaseInst) {\r\n // grab and reuse the hosted looking function (if available) otherwise the original passed function\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;\r\n }\r\n }\r\n return function () {\r\n // eslint-disable-next-line prefer-rest-params\r\n return theFunc.apply(target, arguments);\r\n };\r\n }\r\n // Start creating a new baseFuncs by creating proxies for the instance functions (as they may get replaced)\r\n var baseFuncs = {};\r\n _forEachProp(instFuncs, function (name) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);\r\n });\r\n // Get the base prototype functions\r\n var baseProto = _getObjProto(classProto);\r\n var visited = [];\r\n // Don't include base object functions for Object, Array or Function\r\n while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {\r\n // look for prototype functions\r\n _forEachProp(baseProto, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n // For IE 7/8 the prototype lookup doesn't provide the full chain so we need to bypass the \r\n // hasOwnProperty check we get all of the methods, main difference is that IE7/8 doesn't return\r\n // the Object prototype methods while bypassing the check\r\n if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);\r\n }\r\n });\r\n // We need to find all possible functions that might be overloaded by walking the entire prototype chain\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(baseProto);\r\n baseProto = _getObjProto(baseProto);\r\n }\r\n return baseFuncs;\r\n}\r\nfunction _getInstFunc(target, funcName, proto, currentDynProtoProxy) {\r\n var instFunc = null;\r\n // We need to check whether the class name is defined directly on this prototype otherwise\r\n // it will walk the proto chain and return any parent proto classname.\r\n if (target && _hasOwnProperty(proto, DynClassName)) {\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];\r\n if (!instFunc) {\r\n // Avoid stack overflow from recursive calling the same function\r\n _throwTypeError(\"Missing [\" + funcName + \"] \" + strFunction);\r\n }\r\n // We have the instance function, lets check it we can speed up further calls\r\n // by adding the instance function back directly on the instance (avoiding the dynamic func lookup)\r\n if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {\r\n // If the instance already has an instance function we can't replace it\r\n var canAddInst = !_hasOwnProperty(target, funcName);\r\n // Get current prototype\r\n var objProto = _getObjProto(target);\r\n var visited = [];\r\n // Lookup the function starting at the top (instance level prototype) and traverse down, if the first matching function\r\n // if nothing is found or if the first hit is a dynamic proto instance then we can safely add an instance shortcut\r\n while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {\r\n var protoFunc = objProto[funcName];\r\n if (protoFunc) {\r\n canAddInst = (protoFunc === currentDynProtoProxy);\r\n break;\r\n }\r\n // We need to find all possible initial functions to ensure that we don't bypass a valid override function\r\n visited.push(objProto);\r\n objProto = _getObjProto(objProto);\r\n }\r\n try {\r\n if (canAddInst) {\r\n // This instance doesn't have an instance func and the class hierarchy does have a higher level prototype version\r\n // so it's safe to directly assign for any subsequent calls (for better performance)\r\n target[funcName] = instFunc;\r\n }\r\n // Block further attempts to set the instance function for any\r\n instFunc[DynInstChkTag] = 1;\r\n }\r\n catch (e) {\r\n // Don't crash if the object is readonly or the runtime doesn't allow changing this\r\n // And set a flag so we don't try again for any function\r\n instFuncTable[DynAllowInstChkTag] = false;\r\n }\r\n }\r\n }\r\n return instFunc;\r\n}\r\nfunction _getProtoFunc(funcName, proto, currentDynProtoProxy) {\r\n var protoFunc = proto[funcName];\r\n // Check that the prototype function is not a self reference -- try to avoid stack overflow!\r\n if (protoFunc === currentDynProtoProxy) {\r\n // It is so lookup the base prototype\r\n protoFunc = _getObjProto(proto)[funcName];\r\n }\r\n if (typeof protoFunc !== strFunction) {\r\n _throwTypeError(\"[\" + funcName + \"] is not a \" + strFunction);\r\n }\r\n return protoFunc;\r\n}\r\n/**\r\n * Add the required dynamic prototype methods to the the class prototype\r\n * @param proto - The class prototype\r\n * @param className - The instance classname\r\n * @param target - The target instance\r\n * @param baseInstFuncs - The base instance functions\r\n * @param setInstanceFunc - Flag to allow prototype function to reset the instance function if one does not exist\r\n * @ignore\r\n */\r\nfunction _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {\r\n function _createDynamicPrototype(proto, funcName) {\r\n var dynProtoProxy = function () {\r\n // Use the instance or prototype function\r\n var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);\r\n // eslint-disable-next-line prefer-rest-params\r\n return instFunc.apply(this, arguments);\r\n };\r\n // Tag this function as a proxy to support replacing dynamic proxy elements (primary use case is for unit testing\r\n // via which can dynamically replace the prototype function reference)\r\n dynProtoProxy[DynProxyTag] = 1;\r\n return dynProtoProxy;\r\n }\r\n if (!_isObjectOrArrayPrototype(proto)) {\r\n var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};\r\n var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {}); // fetch and assign if as it may not exist yet\r\n // Set whether we are allow to lookup instances, if someone has set to false then do not re-enable\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;\r\n }\r\n _forEachProp(target, function (name) {\r\n // Only add overridden functions\r\n if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {\r\n // Save the instance Function to the lookup table and remove it from the instance as it's not a dynamic proto function\r\n instFuncs_1[name] = target[name];\r\n delete target[name];\r\n // Add a dynamic proto if one doesn't exist or if a prototype function exists and it's not a dynamic one\r\n if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {\r\n proto[name] = _createDynamicPrototype(proto, name);\r\n }\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Checks whether the passed prototype object appears to be correct by walking the prototype hierarchy of the instance\r\n * @param classProto The class prototype instance\r\n * @param thisTarget The current instance that will be checked whether the passed prototype instance is in the hierarchy\r\n * @ignore\r\n */\r\nfunction _checkPrototype(classProto, thisTarget) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n // As this is primarily a coding time check, don't bother checking if running in IE8 or lower\r\n var visited = [];\r\n var thisProto = _getObjProto(thisTarget);\r\n while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {\r\n if (thisProto === classProto) {\r\n return true;\r\n }\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(thisProto);\r\n thisProto = _getObjProto(thisProto);\r\n }\r\n return false;\r\n }\r\n // If objGetPrototypeOf doesn't exist then just assume everything is ok.\r\n return true;\r\n}\r\n/**\r\n * Gets the current prototype name using the ES6 name if available otherwise falling back to a use unknown as the name.\r\n * It's not critical for this to return a name, it's used to decorate the generated unique name for easier debugging only.\r\n * @param target\r\n * @param unknownValue\r\n * @ignore\r\n */\r\nfunction _getObjName(target, unknownValue) {\r\n if (_hasOwnProperty(target, Prototype)) {\r\n // Look like a prototype\r\n return target.name || unknownValue || UnknownValue;\r\n }\r\n return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;\r\n}\r\n/**\r\n * Helper function when creating dynamic (inline) functions for classes, this helper performs the following tasks :-\r\n * - Saves references to all defined base class functions\r\n * - Calls the delegateFunc with the current target (this) and a base object reference that can be used to call all \"super\" functions.\r\n * - Will populate the class prototype for all overridden functions to support class extension that call the prototype instance.\r\n * Callers should use this helper when declaring all function within the constructor of a class, as mentioned above the delegateFunc is\r\n * passed both the target \"this\" and an object that can be used to call any base (super) functions, using this based object in place of\r\n * super.XXX() (which gets expanded to _super.prototype.XXX()) provides a better minification outcome and also ensures the correct \"this\"\r\n * context is maintained as TypeScript creates incorrect references using super.XXXX() for dynamically defined functions i.e. Functions\r\n * defined in the constructor or some other function (rather than declared as complete typescript functions).\r\n * ### Usage\r\n * ```typescript\r\n * import dynamicProto from \"@microsoft/dynamicproto-js\";\r\n * class ExampleClass extends BaseClass {\r\n * constructor() {\r\n * dynamicProto(ExampleClass, this, (_self, base) => {\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.newFunc = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * ...\r\n * }\r\n * }\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.myFunction = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * // Call the base version of the function that we are overriding\r\n * base.myFunction();\r\n * }\r\n * ...\r\n * }\r\n * _self.initialize = () => {\r\n * ...\r\n * }\r\n * // Warnings: While the following will work as _self is simply a reference to\r\n * // this, if anyone overrides myFunction() the overridden will be called first\r\n * // as the normal JavaScript method resolution will occur and the defined\r\n * // _self.initialize() function is actually gets removed from the instance and\r\n * // a proxy prototype version is created to reference the created method.\r\n * _self.initialize();\r\n * });\r\n * }\r\n * }\r\n * ```\r\n * @typeparam DPType This is the generic type of the class, used to keep intellisense valid\r\n * @typeparam DPCls The type that contains the prototype of the current class\r\n * @param theClass - This is the current class instance which contains the prototype for the current class\r\n * @param target - The current \"this\" (target) reference, when the class has been extended this.prototype will not be the 'theClass' value.\r\n * @param delegateFunc - The callback function (closure) that will create the dynamic function\r\n * @param options - Additional options to configure how the dynamic prototype operates\r\n */\r\nexport default function dynamicProto(theClass, target, delegateFunc, options) {\r\n // Make sure that the passed theClass argument looks correct\r\n if (!_hasOwnProperty(theClass, Prototype)) {\r\n _throwTypeError(\"theClass is an invalid class definition.\");\r\n }\r\n // Quick check to make sure that the passed theClass argument looks correct (this is a common copy/paste error)\r\n var classProto = theClass[Prototype];\r\n if (!_checkPrototype(classProto, target)) {\r\n _throwTypeError(\"[\" + _getObjName(theClass) + \"] not in hierarchy of [\" + _getObjName(target) + \"]\");\r\n }\r\n var className = null;\r\n if (_hasOwnProperty(classProto, DynClassName)) {\r\n // Only grab the class name if it's defined on this prototype (i.e. don't walk the prototype chain)\r\n className = classProto[DynClassName];\r\n }\r\n else {\r\n // As not all browser support name on the prototype creating a unique dynamic one if we have not already\r\n // assigned one, so we can use a simple string as the lookup rather than an object for the dynamic instance\r\n // function table lookup.\r\n className = DynClassNamePrefix + _getObjName(theClass, \"_\") + \"$\" + _gblInst.n;\r\n _gblInst.n++;\r\n classProto[DynClassName] = className;\r\n }\r\n var perfOptions = dynamicProto[DynProtoDefaultOptions];\r\n var useBaseInst = !!perfOptions[strUseBaseInst];\r\n if (useBaseInst && options && options[strUseBaseInst] !== undefined) {\r\n useBaseInst = !!options[strUseBaseInst];\r\n }\r\n // Get the current instance functions\r\n var instFuncs = _getInstanceFuncs(target);\r\n // Get all of the functions for any base instance (before they are potentially overridden)\r\n var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);\r\n // Execute the delegate passing in both the current target \"this\" and \"base\" function references\r\n // Note casting the same type as we don't actually have the base class here and this will provide some intellisense support\r\n delegateFunc(target, baseFuncs);\r\n // Don't allow setting instance functions for older IE instances\r\n var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];\r\n if (setInstanceFunc && options) {\r\n setInstanceFunc = !!options[strSetInstFuncs];\r\n }\r\n // Populate the Prototype for any overridden instance functions\r\n _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);\r\n}\r\n/**\r\n * Exposes the default global options to allow global configuration, if the global values are disabled these will override\r\n * any passed values. This is primarily exposed to support unit-testing without the need for individual classes to expose\r\n * their internal usage of dynamic proto.\r\n */\r\ndynamicProto[DynProtoDefaultOptions] = _gblInst.o;\r\n//# sourceMappingURL=DynamicProto.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 8\r\nexport var _DYN_NAME = \"name\"; // Count: 11\r\nexport var _DYN_GET_NOTIFY_MGR = \"getNotifyMgr\"; // Count: 3\r\nexport var _DYN_IDENTIFIER = \"identifier\"; // Count: 8\r\nexport var _DYN_PUSH = \"push\"; // Count: 30\r\nexport var _DYN_IS_INITIALIZED = \"isInitialized\"; // Count: 10\r\nexport var _DYN_CONFIG = \"config\"; // Count: 7\r\nexport var _DYN_INSTRUMENTATION_KEY = \"instrumentationKey\"; // Count: 3\r\nexport var _DYN_LOGGER = \"logger\"; // Count: 10\r\nexport var _DYN_LENGTH = \"length\"; // Count: 45\r\nexport var _DYN_TIME = \"time\"; // Count: 5\r\nexport var _DYN_PROCESS_NEXT = \"processNext\"; // Count: 21\r\nexport var _DYN_GET_PROCESS_TEL_CONT0 = \"getProcessTelContext\"; // Count: 2\r\nexport var _DYN_ADD_NOTIFICATION_LIS1 = \"addNotificationListener\"; // Count: 5\r\nexport var _DYN_REMOVE_NOTIFICATION_2 = \"removeNotificationListener\"; // Count: 5\r\nexport var _DYN_STOP_POLLING_INTERNA3 = \"stopPollingInternalLogs\"; // Count: 2\r\nexport var _DYN_ON_COMPLETE = \"onComplete\"; // Count: 6\r\nexport var _DYN_GET_PLUGIN = \"getPlugin\"; // Count: 5\r\nexport var _DYN_FLUSH = \"flush\"; // Count: 5\r\nexport var _DYN__EXTENSIONS = \"_extensions\"; // Count: 4\r\nexport var _DYN_SPLICE = \"splice\"; // Count: 6\r\nexport var _DYN_TEARDOWN = \"teardown\"; // Count: 10\r\nexport var _DYN_MESSAGE_ID = \"messageId\"; // Count: 4\r\nexport var _DYN_MESSAGE = \"message\"; // Count: 7\r\nexport var _DYN_IS_ASYNC = \"isAsync\"; // Count: 7\r\nexport var _DYN__DO_TEARDOWN = \"_doTeardown\"; // Count: 4\r\nexport var _DYN_UPDATE = \"update\"; // Count: 7\r\nexport var _DYN_GET_NEXT = \"getNext\"; // Count: 12\r\nexport var _DYN_DIAG_LOG = \"diagLog\"; // Count: 8\r\nexport var _DYN_SET_NEXT_PLUGIN = \"setNextPlugin\"; // Count: 5\r\nexport var _DYN_CREATE_NEW = \"createNew\"; // Count: 6\r\nexport var _DYN_COOKIE_CFG = \"cookieCfg\"; // Count: 3\r\nexport var _DYN_INDEX_OF = \"indexOf\"; // Count: 7\r\nexport var _DYN_SUBSTRING = \"substring\"; // Count: 10\r\nexport var _DYN_USER_AGENT = \"userAgent\"; // Count: 5\r\nexport var _DYN_SPLIT = \"split\"; // Count: 6\r\nexport var _DYN_SET_ENABLED = \"setEnabled\"; // Count: 5\r\nexport var _DYN_SUBSTR = \"substr\"; // Count: 6\r\nexport var _DYN_NODE_TYPE = \"nodeType\"; // Count: 3\r\nexport var _DYN_APPLY = \"apply\"; // Count: 6\r\nexport var _DYN_REPLACE = \"replace\"; // Count: 10\r\nexport var _DYN_ENABLE_DEBUG_EXCEPTI4 = \"enableDebugExceptions\"; // Count: 2\r\nexport var _DYN_LOG_INTERNAL_MESSAGE = \"logInternalMessage\"; // Count: 2\r\nexport var _DYN_TO_LOWER_CASE = \"toLowerCase\"; // Count: 8\r\nexport var _DYN_CALL = \"call\"; // Count: 18\r\nexport var _DYN_TYPE = \"type\"; // Count: 14\r\nexport var _DYN_HANDLER = \"handler\"; // Count: 5\r\nexport var _DYN_LISTENERS = \"listeners\"; // Count: 6\r\nexport var _DYN_IS_CHILD_EVT = \"isChildEvt\"; // Count: 3\r\nexport var _DYN_GET_CTX = \"getCtx\"; // Count: 6\r\nexport var _DYN_SET_CTX = \"setCtx\"; // Count: 10\r\nexport var _DYN_COMPLETE = \"complete\"; // Count: 3\r\nexport var _DYN_TRACE_ID = \"traceId\"; // Count: 5\r\nexport var _DYN_SPAN_ID = \"spanId\"; // Count: 5\r\nexport var _DYN_TRACE_FLAGS = \"traceFlags\"; // Count: 6\r\nexport var _DYN_VERSION = \"version\"; // Count: 4\r\n//# sourceMappingURL=__DynamicConstants.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// ###################################################################################################################################################\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// ###################################################################################################################################################\r\nexport var STR_EMPTY = \"\";\r\nexport var STR_CHANNELS = \"channels\";\r\nexport var STR_CORE = \"core\";\r\nexport var STR_CREATE_PERF_MGR = \"createPerfMgr\";\r\nexport var STR_DISABLED = \"disabled\";\r\nexport var STR_EXTENSION_CONFIG = \"extensionConfig\";\r\nexport var STR_EXTENSIONS = \"extensions\";\r\nexport var STR_PROCESS_TELEMETRY = \"processTelemetry\";\r\nexport var STR_PRIORITY = \"priority\";\r\nexport var STR_EVENTS_SENT = \"eventsSent\";\r\nexport var STR_EVENTS_DISCARDED = \"eventsDiscarded\";\r\nexport var STR_EVENTS_SEND_REQUEST = \"eventsSendRequest\";\r\nexport var STR_PERF_EVENT = \"perfEvent\";\r\nexport var STR_ERROR_TO_CONSOLE = \"errorToConsole\";\r\nexport var STR_WARN_TO_CONSOLE = \"warnToConsole\";\r\nexport var STR_GET_PERF_MGR = \"getPerfMgr\";\r\n//# sourceMappingURL=InternalConstants.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjAssign, ObjClass, ObjDefineProperty, ObjHasOwnProperty, ObjProto, strShimFunction, strShimObject, strShimPrototype, strShimUndefined, throwTypeError } from \"@microsoft/applicationinsights-shims\";\r\nimport { _DYN_APPLY, _DYN_CALL, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_REPLACE } from \"../__DynamicConstants\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n// RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly\r\n// Added to help with minfication\r\nvar strToISOString = \"toISOString\";\r\nvar cStrEndsWith = \"endsWith\";\r\nvar cStrStartsWith = \"startsWith\";\r\nvar strIndexOf = \"indexOf\";\r\nvar strMap = \"map\";\r\nvar strReduce = \"reduce\";\r\nvar cStrTrim = \"trim\";\r\nvar strToString = \"toString\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strConstructor = \"constructor\";\r\nvar _objDefineProperty = ObjDefineProperty;\r\nvar _objFreeze = ObjClass.freeze;\r\nvar _objSeal = ObjClass.seal;\r\nvar _objKeys = ObjClass.keys;\r\nvar StringProto = String[strShimPrototype];\r\nvar _strTrim = StringProto[cStrTrim];\r\nvar _strEndsWith = StringProto[cStrEndsWith];\r\nvar _strStartsWith = StringProto[cStrStartsWith];\r\nvar DateProto = Date[strShimPrototype];\r\nvar _dataToISOString = DateProto[strToISOString];\r\nvar _isArray = Array.isArray;\r\nvar _objToString = ObjProto[strToString];\r\nvar _fnToString = ObjHasOwnProperty[strToString];\r\n// Cache what this browser reports as the object function constructor (as a string)\r\nvar _objFunctionString = _fnToString[_DYN_CALL /* @min:%2ecall */](ObjClass);\r\nvar rCamelCase = /-([a-z])/g;\r\nvar rNormalizeInvalid = /([^\\w\\d_$])/g;\r\nvar rLeadingNumeric = /^(\\d+[\\w\\d_$])/;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Object[\"getPrototypeOf\"];\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nexport function _getObjProto(target) {\r\n if (target) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n // target[Constructor] May break if the constructor has been changed or removed\r\n var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];\r\n if (newProto) {\r\n return newProto;\r\n }\r\n }\r\n return null;\r\n}\r\nexport function objToString(obj) {\r\n return _objToString[_DYN_CALL /* @min:%2ecall */](obj);\r\n}\r\nexport function isTypeof(value, theType) {\r\n return typeof value === theType;\r\n}\r\nexport function isUndefined(value) {\r\n return value === undefined || typeof value === strShimUndefined;\r\n}\r\nexport function isNotUndefined(value) {\r\n return !isUndefined(value);\r\n}\r\nexport function isNullOrUndefined(value) {\r\n return (value === null || isUndefined(value));\r\n}\r\nexport function isNotNullOrUndefined(value) {\r\n return !isNullOrUndefined(value);\r\n}\r\nexport function hasOwnProperty(obj, prop) {\r\n return !!(obj && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](obj, prop));\r\n}\r\nexport function isObject(value) {\r\n // Changing to inline for performance\r\n return !!(value && typeof value === strShimObject);\r\n}\r\nexport function isFunction(value) {\r\n // Changing to inline for performance\r\n return !!(value && typeof value === strShimFunction);\r\n}\r\nexport function isPromiseLike(value) {\r\n return value && isFunction(value.then);\r\n}\r\n/**\r\n * Validates that the string name conforms to the JS IdentifierName specification and if not\r\n * normalizes the name so that it would. This method does not identify or change any keywords\r\n * meaning that if you pass in a known keyword the same value will be returned.\r\n * This is a simplified version\r\n * @param name The name to validate\r\n */\r\nexport function normalizeJsName(name) {\r\n var value = name;\r\n if (value && isString(value)) {\r\n // CamelCase everything after the \"-\" and remove the dash\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rCamelCase, function (_all, letter) {\r\n return letter.toUpperCase();\r\n });\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rNormalizeInvalid, \"_\");\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rLeadingNumeric, function (_all, match) {\r\n return \"_\" + match;\r\n });\r\n }\r\n return value;\r\n}\r\n/**\r\n * This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a\r\n * performance optimization to avoid the creation of a new array for large objects\r\n * @param target The target object to find and process the keys\r\n * @param callbackfn The function to call with the details\r\n */\r\nexport function objForEachKey(target, callbackfn) {\r\n if (target) {\r\n for (var prop in target) {\r\n if (ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](target, prop)) {\r\n callbackfn[_DYN_CALL /* @min:%2ecall */](target, prop, target[prop]);\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function strEndsWith(value, search) {\r\n var result = false;\r\n if (value && search && !(result = value === search)) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);\r\n }\r\n return result;\r\n}\r\n/**\r\n * The _strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function _strEndsWithPoly(value, search) {\r\n var result = false;\r\n var searchLen = search ? search[_DYN_LENGTH /* @min:%2elength */] : 0;\r\n var valLen = value ? value[_DYN_LENGTH /* @min:%2elength */] : 0;\r\n if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {\r\n var pos = valLen - 1;\r\n for (var lp = searchLen - 1; lp >= 0; lp--) {\r\n if (value[pos] != search[lp]) {\r\n return false;\r\n }\r\n pos--;\r\n }\r\n result = true;\r\n }\r\n return result;\r\n}\r\n/**\r\n * The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param checkValue - The characters to be searched for at the start of the value.\r\n * @returns true if the given search value is found at the start of the string, otherwise false.\r\n */\r\nexport function strStartsWith(value, checkValue) {\r\n var result = false;\r\n if (value && checkValue && !(result = value === checkValue)) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);\r\n }\r\n return result;\r\n}\r\n/**\r\n * The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param checkValue - The characters to be searched for at the start of the value.\r\n * @returns true if the given search value is found at the start of the string, otherwise false.\r\n */\r\nexport function _strStartsWithPoly(value, checkValue) {\r\n // Using helper for performance and because string startsWith() is not available on IE\r\n var result = false;\r\n var chkLen = checkValue ? checkValue[_DYN_LENGTH /* @min:%2elength */] : 0;\r\n if (value && chkLen && value[_DYN_LENGTH /* @min:%2elength */] >= chkLen && !(result = value === checkValue)) {\r\n for (var lp = 0; lp < chkLen; lp++) {\r\n if (value[lp] !== checkValue[lp]) {\r\n return false;\r\n }\r\n }\r\n result = true;\r\n }\r\n return result;\r\n}\r\n/**\r\n * A simple wrapper (for minification support) to check if the value contains the search string.\r\n * @param value - The string value to check for the existence of the search value\r\n * @param search - The value search within the value\r\n */\r\nexport function strContains(value, search) {\r\n if (value && search) {\r\n return value[_DYN_INDEX_OF /* @min:%2eindexOf */](search) !== -1;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Check if an object is of type Date\r\n */\r\nexport function isDate(obj) {\r\n return !!(obj && _objToString[_DYN_CALL /* @min:%2ecall */](obj) === \"[object Date]\");\r\n}\r\n/**\r\n * Check if an object is of type Array with optional generic T, the generic type is not validated\r\n * and exists to help with TypeScript validation only.\r\n */\r\nexport var isArray = _isArray || _isArrayPoly;\r\nfunction _isArrayPoly(obj) {\r\n return !!(obj && _objToString[_DYN_CALL /* @min:%2ecall */](obj) === \"[object Array]\");\r\n}\r\n/**\r\n * Check if an object is of type Error\r\n */\r\nexport function isError(obj) {\r\n return !!(obj && _objToString[_DYN_CALL /* @min:%2ecall */](obj) === \"[object Error]\");\r\n}\r\n/**\r\n * Checks if the type of value is a string.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a string, false otherwise.\r\n */\r\nexport function isString(value) {\r\n // Changing to inline for performance\r\n return typeof value === \"string\";\r\n}\r\n/**\r\n * Checks if the type of value is a number.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a number, false otherwise.\r\n */\r\nexport function isNumber(value) {\r\n // Changing to inline for performance\r\n return typeof value === \"number\";\r\n}\r\n/**\r\n * Checks if the type of value is a boolean.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a boolean, false otherwise.\r\n */\r\nexport function isBoolean(value) {\r\n // Changing to inline for performance\r\n return typeof value === \"boolean\";\r\n}\r\n/**\r\n * Checks if the type of value is a Symbol.\r\n * This only returns a boolean as returning value is Symbol will cause issues for older TypeScript consumers\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a Symbol, false otherwise.\r\n */\r\nexport function isSymbol(value) {\r\n return typeof value === \"symbol\";\r\n}\r\n/**\r\n * Checks if the type of the value is a normal plain object (not a null or data)\r\n * @param value\r\n */\r\nexport function isPlainObject(value) {\r\n var result = false;\r\n if (value && typeof value === \"object\") {\r\n // Inlining _objGetPrototypeOf for performance to avoid an additional function call\r\n var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);\r\n if (!proto) {\r\n // No prototype found so this is a plain Object eg. 'Object.create(null)'\r\n result = true;\r\n }\r\n else {\r\n // Objects that have a prototype are plain only if they were created using the Object global (native) function\r\n if (proto[strConstructor] && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](proto, strConstructor)) {\r\n proto = proto[strConstructor];\r\n }\r\n result = typeof proto === strShimFunction && _fnToString[_DYN_CALL /* @min:%2ecall */](proto) === _objFunctionString;\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\nexport function toISOString(date) {\r\n if (date) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);\r\n }\r\n}\r\n/**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\nexport function _toISOStringPoly(date) {\r\n if (date && date.getUTCFullYear) {\r\n var pad = function (num) {\r\n var r = String(num);\r\n if (r[_DYN_LENGTH /* @min:%2elength */] === 1) {\r\n r = \"0\" + r;\r\n }\r\n return r;\r\n };\r\n return date.getUTCFullYear()\r\n + \"-\" + pad(date.getUTCMonth() + 1)\r\n + \"-\" + pad(date.getUTCDate())\r\n + \"T\" + pad(date.getUTCHours())\r\n + \":\" + pad(date.getUTCMinutes())\r\n + \":\" + pad(date.getUTCSeconds())\r\n + \".\" + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)\r\n + \"Z\";\r\n }\r\n}\r\n/**\r\n * Performs the specified action for each element in an array. This helper exists to avoid adding a polyfil for older browsers\r\n * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype\r\n * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would\r\n * cause a testing requirement to test with and without the implementations\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop\r\n * @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\nexport function arrForEach(arr, callbackfn, thisArg) {\r\n var len = arr[_DYN_LENGTH /* @min:%2elength */];\r\n try {\r\n for (var idx = 0; idx < len; idx++) {\r\n if (idx in arr) {\r\n if (callbackfn[_DYN_CALL /* @min:%2ecall */](thisArg || arr, arr[idx], idx, arr) === -1) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers\r\n * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype\r\n * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would\r\n * cause a testing requirement to test with and without the implementations\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\nexport function arrIndexOf(arr, searchElement, fromIndex) {\r\n if (arr) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (arr[strIndexOf]) {\r\n return arr[strIndexOf](searchElement, fromIndex);\r\n }\r\n var len = arr[_DYN_LENGTH /* @min:%2elength */];\r\n var from = fromIndex || 0;\r\n try {\r\n for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {\r\n if (lp in arr && arr[lp] === searchElement) {\r\n return lp;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n }\r\n return -1;\r\n}\r\n/**\r\n * Calls a defined callback function on each element of an array, and returns an array that contains the results. This helper exists\r\n * to avoid adding a polyfil for older browsers that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page\r\n * checks for presence/absence of the prototype implementation. Note: For consistency this will not use the Array.prototype.xxxx\r\n * implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\nexport function arrMap(arr, callbackfn, thisArg) {\r\n var results;\r\n if (arr) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (arr[strMap]) {\r\n return arr[strMap](callbackfn, thisArg);\r\n }\r\n var len = arr[_DYN_LENGTH /* @min:%2elength */];\r\n var _this = thisArg || arr;\r\n results = new Array(len);\r\n try {\r\n for (var lp = 0; lp < len; lp++) {\r\n if (lp in arr) {\r\n results[lp] = callbackfn[_DYN_CALL /* @min:%2ecall */](_this, arr[lp], arr);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n }\r\n return results;\r\n}\r\n/**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is\r\n * provided as an argument in the next call to the callback function. This helper exists to avoid adding a polyfil for older browsers that do not define\r\n * Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype implementation. Note: For consistency\r\n * this will not use the Array.prototype.xxxx implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\nexport function arrReduce(arr, callbackfn, initialValue) {\r\n var value;\r\n if (arr) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (arr[strReduce]) {\r\n return arr[strReduce](callbackfn, initialValue);\r\n }\r\n var len = arr[_DYN_LENGTH /* @min:%2elength */];\r\n var lp = 0;\r\n // Specifically checking the number of passed arguments as the value could be anything\r\n if (arguments[_DYN_LENGTH /* @min:%2elength */] >= 3) {\r\n value = arguments[2];\r\n }\r\n else {\r\n while (lp < len && !(lp in arr)) {\r\n lp++;\r\n }\r\n value = arr[lp++];\r\n }\r\n while (lp < len) {\r\n if (lp in arr) {\r\n value = callbackfn(value, arr[lp], lp, arr);\r\n }\r\n lp++;\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * helper method to trim strings (IE8 does not implement String.prototype.trim)\r\n */\r\nexport function strTrim(str) {\r\n if (str) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str[_DYN_REPLACE /* @min:%2ereplace */] ? str[_DYN_REPLACE /* @min:%2ereplace */](/^\\s+|(?=\\s)\\s+$/g, STR_EMPTY) : str);\r\n }\r\n return str;\r\n}\r\nvar _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable(\"toString\");\r\nvar _objKeysDontEnums = [\r\n \"toString\",\r\n \"toLocaleString\",\r\n \"valueOf\",\r\n \"hasOwnProperty\",\r\n \"isPrototypeOf\",\r\n \"propertyIsEnumerable\",\r\n \"constructor\"\r\n];\r\n/**\r\n * Returns the names of the enumerable string properties and methods of an object. This helper exists to avoid adding a polyfil for older browsers\r\n * that do not define Object.keys eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.keys implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param obj Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\r\n */\r\nexport function objKeys(obj) {\r\n var objType = typeof obj;\r\n if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {\r\n throwTypeError(\"objKeys called on non-object\");\r\n }\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (!_objKeysHasDontEnumBug && _objKeys) {\r\n return _objKeys(obj);\r\n }\r\n var result = [];\r\n for (var prop in obj) {\r\n if (obj && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](obj, prop)) {\r\n result[_DYN_PUSH /* @min:%2epush */](prop);\r\n }\r\n }\r\n if (_objKeysHasDontEnumBug) {\r\n var dontEnumsLength = _objKeysDontEnums[_DYN_LENGTH /* @min:%2elength */];\r\n for (var lp = 0; lp < dontEnumsLength; lp++) {\r\n if (obj && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](obj, _objKeysDontEnums[lp])) {\r\n result[_DYN_PUSH /* @min:%2epush */](_objKeysDontEnums[lp]);\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Try to define get/set object property accessors for the target object/prototype, this will provide compatibility with\r\n * existing API definition when run within an ES5+ container that supports accessors but still enable the code to be loaded\r\n * and executed in an ES3 container, providing basic IE8 compatibility.\r\n * @param target The object on which to define the property.\r\n * @param prop The name of the property to be defined or modified.\r\n * @param getProp The getter function to wire against the getter.\r\n * @param setProp The setter function to wire against the setter.\r\n * @returns True if it was able to create the accessors otherwise false\r\n */\r\nexport function objDefineAccessors(target, prop, getProp, setProp) {\r\n if (_objDefineProperty) {\r\n try {\r\n var descriptor = {\r\n enumerable: true,\r\n configurable: true\r\n };\r\n if (getProp) {\r\n descriptor.get = getProp;\r\n }\r\n if (setProp) {\r\n descriptor.set = setProp;\r\n }\r\n _objDefineProperty(target, prop, descriptor);\r\n return true;\r\n }\r\n catch (e) {\r\n // IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw\r\n // We will just ignore this here.\r\n }\r\n }\r\n return false;\r\n}\r\nfunction _doNothing(value) {\r\n return value;\r\n}\r\nexport function deepFreeze(obj) {\r\n if (_objFreeze) {\r\n objForEachKey(obj, function (name, value) {\r\n if (isArray(value) || isObject(value)) {\r\n _objFreeze(value);\r\n }\r\n });\r\n }\r\n return objFreeze(obj);\r\n}\r\nexport var objFreeze = _objFreeze || _doNothing;\r\nexport var objSeal = _objSeal || _doNothing;\r\n/**\r\n * Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)\r\n * https://caniuse.com/#search=Date.now\r\n */\r\nexport function dateNow() {\r\n var dt = Date;\r\n return dt.now ? dt.now() : new dt().getTime();\r\n}\r\n/**\r\n * Returns the name of object if it's an Error. Otherwise, returns empty string.\r\n */\r\nexport function getExceptionName(object) {\r\n if (isError(object)) {\r\n return object[_DYN_NAME /* @min:%2ename */];\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Sets the provided value on the target instance using the field name when the provided chk function returns true, the chk\r\n * function will only be called if the new value is no equal to the original value.\r\n * @param target - The target object\r\n * @param field - The key of the target\r\n * @param value - The value to set\r\n * @param valChk - [Optional] Callback to check the value that if supplied will be called check if the new value can be set\r\n * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)\r\n * @returns The existing or new value, depending what was set\r\n */\r\nexport function setValue(target, field, value, valChk, srcChk) {\r\n var theValue = value;\r\n if (target) {\r\n theValue = target[field];\r\n if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {\r\n theValue = value;\r\n target[field] = theValue;\r\n }\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it\r\n * @param target - The target object to return or set the default value\r\n * @param field - The key for the field to set on the target\r\n * @param defValue - [Optional] The value to set if not already present, when not provided a empty object will be added\r\n */\r\nexport function getSetValue(target, field, defValue) {\r\n var theValue;\r\n if (target) {\r\n theValue = target[field];\r\n if (!theValue && isNullOrUndefined(theValue)) {\r\n // Supports having the default as null\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n target[field] = theValue;\r\n }\r\n }\r\n else {\r\n // Expanded for performance so we only check defValue if required\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Get the mapped config value, if null or undefined any supplied defaultValue will be returned.\r\n * @param field - The name of the field as the named enum value (number) or the string name.\r\n * @param defaultValue - The default value to return if the config field is not present, null or undefined.\r\n */\r\nexport function getCfgValue(theValue, defaultValue) {\r\n return !isNullOrUndefined(theValue) ? theValue : defaultValue;\r\n}\r\nexport function isNotTruthy(value) {\r\n return !value;\r\n}\r\nexport function isTruthy(value) {\r\n return !!value;\r\n}\r\nexport function throwError(message) {\r\n throw new Error(message);\r\n}\r\nfunction _createProxyFunction(source, funcName) {\r\n var srcFunc = null;\r\n var src = null;\r\n if (isFunction(source)) {\r\n srcFunc = source;\r\n }\r\n else {\r\n src = source;\r\n }\r\n return function () {\r\n // Capture the original arguments passed to the method\r\n var originalArguments = arguments;\r\n if (srcFunc) {\r\n src = srcFunc();\r\n }\r\n if (src) {\r\n return src[funcName][_DYN_APPLY /* @min:%2eapply */](src, originalArguments);\r\n }\r\n };\r\n}\r\n/**\r\n * Effectively assigns all enumerable properties (not just own properties) and functions (including inherited prototype) from\r\n * the source object to the target, it attempts to use proxy getters / setters (if possible) and proxy functions to avoid potential\r\n * implementation issues by assigning prototype functions as instance ones\r\n *\r\n * This method is the primary method used to \"update\" the snippet proxy with the ultimate implementations.\r\n *\r\n * Special ES3 Notes:\r\n * Updates (setting) of direct property values on the target or indirectly on the source object WILL NOT WORK PROPERLY, updates to the\r\n * properties of \"referenced\" object will work (target.context.newValue = 10 => will be reflected in the source.context as it's the\r\n * same object). ES3 Failures: assigning target.myProp = 3 -> Won't change source.myProp = 3, likewise the reverse would also fail.\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param chkSet - An optional callback to determine whether a specific property/function should be proxied\r\n */\r\nexport function proxyAssign(target, source, chkSet) {\r\n if (target && source && isObject(target) && isObject(source)) {\r\n var _loop_1 = function (field) {\r\n if (isString(field)) {\r\n var value = source[field];\r\n if (isFunction(value)) {\r\n if (!chkSet || chkSet(field, true, source, target)) {\r\n // Create a proxy function rather than just copying the (possible) prototype to the new object as an instance function\r\n target[field] = _createProxyFunction(source, field);\r\n }\r\n }\r\n else if (!chkSet || chkSet(field, false, source, target)) {\r\n if (hasOwnProperty(target, field)) {\r\n // Remove any previous instance property\r\n delete target[field];\r\n }\r\n if (!objDefineAccessors(target, field, function () {\r\n return source[field];\r\n }, function (theValue) {\r\n source[field] = theValue;\r\n })) {\r\n // Unable to create an accessor, so just assign the values as a fallback\r\n // -- this will (mostly) work for objects\r\n // -- but will fail for accessing primitives (if the source changes it) and all types of \"setters\" as the source won't be modified\r\n target[field] = value;\r\n }\r\n }\r\n }\r\n };\r\n // effectively apply/proxy full source to the target instance\r\n for (var field in source) {\r\n _loop_1(field);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * Creates a proxy function on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param name - The function name that will be added on the target\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param theFunc - The function name on the source that will be proxied on the target\r\n * @param overwriteTarget - If `false` this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {\r\n if (target && name && source) {\r\n if (overwriteTarget !== false || isUndefined(target[name])) {\r\n target[name] = _createProxyFunction(source, theFunc);\r\n }\r\n }\r\n}\r\n/**\r\n * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param functionsToProxy - An array of function names that will be proxied on the target\r\n * @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {\r\n if (target && source && isObject(target) && isArray(functionsToProxy)) {\r\n arrForEach(functionsToProxy, function (theFuncName) {\r\n if (isString(theFuncName)) {\r\n proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);\r\n }\r\n });\r\n }\r\n return target;\r\n}\r\n/**\r\n * Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.\r\n * Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance\r\n * @param defaults Simple helper\r\n */\r\nexport function createClassFromInterface(defaults) {\r\n return /** @class */ (function () {\r\n function class_1() {\r\n var _this_1 = this;\r\n if (defaults) {\r\n objForEachKey(defaults, function (field, value) {\r\n _this_1[field] = value;\r\n });\r\n }\r\n }\r\n return class_1;\r\n }());\r\n}\r\n/**\r\n * A helper function to assist with JIT performance for objects that have properties added / removed dynamically\r\n * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this\r\n * function after you have finished \"updating\" the object, calling this within loops reduces or defeats the benefits.\r\n * This helps when iterating using for..in, objKeys() and objForEach()\r\n * @param theObject - The object to be optimized if possible\r\n */\r\nexport function optimizeObject(theObject) {\r\n // V8 Optimization to cause the JIT compiler to create a new optimized object for looking up the own properties\r\n // primarily for object with <= 19 properties for >= 20 the effect is reduced or non-existent\r\n if (theObject && ObjAssign) {\r\n theObject = ObjClass(ObjAssign({}, theObject));\r\n }\r\n return theObject;\r\n}\r\nexport function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {\r\n // Variables\r\n var theArgs = arguments;\r\n var extended = theArgs[0] || {};\r\n var argLen = theArgs[_DYN_LENGTH /* @min:%2elength */];\r\n var deep = false;\r\n var idx = 1;\r\n // Check for \"Deep\" flag\r\n if (argLen > 0 && isBoolean(extended)) {\r\n deep = extended;\r\n extended = theArgs[idx] || {};\r\n idx++;\r\n }\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if (!isObject(extended)) {\r\n extended = {};\r\n }\r\n // Loop through each remaining object and conduct a merge\r\n for (; idx < argLen; idx++) {\r\n var arg = theArgs[idx];\r\n var isArgArray = isArray(arg);\r\n var isArgObj = isObject(arg);\r\n for (var prop in arg) {\r\n var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](arg, prop)));\r\n if (!propOk) {\r\n continue;\r\n }\r\n var newValue = arg[prop];\r\n var isNewArray = void 0;\r\n // If deep merge and property is an object, merge properties\r\n if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {\r\n // Grab the current value of the extended object\r\n var clone = extended[prop];\r\n if (isNewArray) {\r\n if (!isArray(clone)) {\r\n // We can't \"merge\" an array with a non-array so overwrite the original\r\n clone = [];\r\n }\r\n }\r\n else if (!isPlainObject(clone)) {\r\n // We can't \"merge\" an object with a non-object\r\n clone = {};\r\n }\r\n // Never move the original objects always clone them\r\n newValue = objExtend(deep, clone, newValue);\r\n }\r\n // Assign the new (or previous) value (unless undefined)\r\n if (newValue !== undefined) {\r\n extended[prop] = newValue;\r\n }\r\n }\r\n }\r\n return extended;\r\n}\r\n//# sourceMappingURL=HelperFuncs.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { getGlobal, strShimObject, strShimPrototype, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { _DYN_CALL, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_NAME, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_USER_AGENT } from \"../__DynamicConstants\";\r\nimport { isFunction, isString, isUndefined, strContains } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n/**\r\n * This file exists to hold environment utilities that are required to check and\r\n * validate the current operating environment. Unless otherwise required, please\r\n * only use defined methods (functions) in this class so that users of these\r\n * functions/properties only need to include those that are used within their own modules.\r\n */\r\nvar strWindow = \"window\";\r\nvar strDocument = \"document\";\r\nvar strDocumentMode = \"documentMode\";\r\nvar strNavigator = \"navigator\";\r\nvar strHistory = \"history\";\r\nvar strLocation = \"location\";\r\nvar strConsole = \"console\";\r\nvar strPerformance = \"performance\";\r\nvar strJSON = \"JSON\";\r\nvar strCrypto = \"crypto\";\r\nvar strMsCrypto = \"msCrypto\";\r\nvar strReactNative = \"ReactNative\";\r\nvar strMsie = \"msie\";\r\nvar strTrident = \"trident/\";\r\nvar strXMLHttpRequest = \"XMLHttpRequest\";\r\nvar _isTrident = null;\r\nvar _navUserAgentCheck = null;\r\nvar _enableMocks = false;\r\nvar _useXDomainRequest = null;\r\nvar _beaconsSupported = null;\r\nfunction _hasProperty(theClass, property) {\r\n var supported = false;\r\n if (theClass) {\r\n try {\r\n supported = property in theClass;\r\n if (!supported) {\r\n var proto = theClass[strShimPrototype];\r\n if (proto) {\r\n supported = property in proto;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Do Nothing\r\n }\r\n if (!supported) {\r\n try {\r\n var tmp = new theClass();\r\n supported = !isUndefined(tmp[property]);\r\n }\r\n catch (e) {\r\n // Do Nothing\r\n }\r\n }\r\n }\r\n return supported;\r\n}\r\n/**\r\n * Enable the lookup of test mock objects if requested\r\n * @param enabled\r\n */\r\nexport function setEnableEnvMocks(enabled) {\r\n _enableMocks = enabled;\r\n}\r\n/**\r\n * Return the named global object if available, will return null if the object is not available.\r\n * @param name The globally named object\r\n */\r\nexport function getGlobalInst(name) {\r\n var gbl = getGlobal();\r\n if (gbl && gbl[name]) {\r\n return gbl[name];\r\n }\r\n // Test workaround, for environments where .window (when global == window) doesn't return the base window\r\n if (name === strWindow && hasWindow()) {\r\n // tslint:disable-next-line: no-angle-bracket-type-assertion\r\n return window;\r\n }\r\n return null;\r\n}\r\n/**\r\n * Checks if window object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a window\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: window is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasWindow() {\r\n return Boolean(typeof window === strShimObject && window);\r\n}\r\n/**\r\n * Returns the global window object if it is present otherwise null.\r\n * This helper is used to access the window object without causing an exception\r\n * \"Uncaught ReferenceError: window is not defined\"\r\n */\r\nexport function getWindow() {\r\n if (hasWindow()) {\r\n return window;\r\n }\r\n // Return the global instance or null\r\n return getGlobalInst(strWindow);\r\n}\r\n/**\r\n * Checks if document object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a document\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: document is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasDocument() {\r\n return Boolean(typeof document === strShimObject && document);\r\n}\r\n/**\r\n * Returns the global document object if it is present otherwise null.\r\n * This helper is used to access the document object without causing an exception\r\n * \"Uncaught ReferenceError: document is not defined\"\r\n */\r\nexport function getDocument() {\r\n if (hasDocument()) {\r\n return document;\r\n }\r\n return getGlobalInst(strDocument);\r\n}\r\n/**\r\n * Checks if navigator object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a navigator\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: navigator is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasNavigator() {\r\n return Boolean(typeof navigator === strShimObject && navigator);\r\n}\r\n/**\r\n * Returns the global navigator object if it is present otherwise null.\r\n * This helper is used to access the navigator object without causing an exception\r\n * \"Uncaught ReferenceError: navigator is not defined\"\r\n */\r\nexport function getNavigator() {\r\n if (hasNavigator()) {\r\n return navigator;\r\n }\r\n return getGlobalInst(strNavigator);\r\n}\r\n/**\r\n * Checks if history object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a history\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: history is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasHistory() {\r\n return Boolean(typeof history === strShimObject && history);\r\n}\r\n/**\r\n * Returns the global history object if it is present otherwise null.\r\n * This helper is used to access the history object without causing an exception\r\n * \"Uncaught ReferenceError: history is not defined\"\r\n */\r\nexport function getHistory() {\r\n if (hasHistory()) {\r\n return history;\r\n }\r\n return getGlobalInst(strHistory);\r\n}\r\n/**\r\n * Returns the global location object if it is present otherwise null.\r\n * This helper is used to access the location object without causing an exception\r\n * \"Uncaught ReferenceError: location is not defined\"\r\n */\r\nexport function getLocation(checkForMock) {\r\n if (checkForMock && _enableMocks) {\r\n var mockLocation = getGlobalInst(\"__mockLocation\");\r\n if (mockLocation) {\r\n return mockLocation;\r\n }\r\n }\r\n if (typeof location === strShimObject && location) {\r\n return location;\r\n }\r\n return getGlobalInst(strLocation);\r\n}\r\n/**\r\n * Returns the global console object\r\n */\r\nexport function getConsole() {\r\n if (typeof console !== strShimUndefined) {\r\n return console;\r\n }\r\n return getGlobalInst(strConsole);\r\n}\r\n/**\r\n * Returns the performance object if it is present otherwise null.\r\n * This helper is used to access the performance object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getPerformance() {\r\n return getGlobalInst(strPerformance);\r\n}\r\n/**\r\n * Checks if JSON object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a history\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: JSON is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasJSON() {\r\n return Boolean((typeof JSON === strShimObject && JSON) || getGlobalInst(strJSON) !== null);\r\n}\r\n/**\r\n * Returns the global JSON object if it is present otherwise null.\r\n * This helper is used to access the JSON object without causing an exception\r\n * \"Uncaught ReferenceError: JSON is not defined\"\r\n */\r\nexport function getJSON() {\r\n if (hasJSON()) {\r\n return JSON || getGlobalInst(strJSON);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Returns the crypto object if it is present otherwise null.\r\n * This helper is used to access the crypto object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getCrypto() {\r\n return getGlobalInst(strCrypto);\r\n}\r\n/**\r\n * Returns the crypto object if it is present otherwise null.\r\n * This helper is used to access the crypto object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getMsCrypto() {\r\n return getGlobalInst(strMsCrypto);\r\n}\r\n/**\r\n * Returns whether the environment is reporting that we are running in a React Native Environment\r\n */\r\nexport function isReactNative() {\r\n // If running in React Native, navigator.product will be populated\r\n var nav = getNavigator();\r\n if (nav && nav.product) {\r\n return nav.product === strReactNative;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Identifies whether the current environment appears to be IE\r\n */\r\nexport function isIE() {\r\n var nav = getNavigator();\r\n if (nav && (nav[_DYN_USER_AGENT /* @min:%2euserAgent */] !== _navUserAgentCheck || _isTrident === null)) {\r\n // Added to support test mocking of the user agent\r\n _navUserAgentCheck = nav[_DYN_USER_AGENT /* @min:%2euserAgent */];\r\n var userAgent = (_navUserAgentCheck || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));\r\n }\r\n return _isTrident;\r\n}\r\n/**\r\n * Gets IE version returning the document emulation mode if we are running on IE, or null otherwise\r\n */\r\nexport function getIEVersion(userAgentStr) {\r\n if (userAgentStr === void 0) { userAgentStr = null; }\r\n if (!userAgentStr) {\r\n var navigator_1 = getNavigator() || {};\r\n userAgentStr = navigator_1 ? (navigator_1[_DYN_USER_AGENT /* @min:%2euserAgent */] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() : STR_EMPTY;\r\n }\r\n var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n // Also check for documentMode in case X-UA-Compatible meta tag was included in HTML.\r\n if (strContains(ua, strMsie)) {\r\n var doc = getDocument() || {};\r\n return Math.max(parseInt(ua[_DYN_SPLIT /* @min:%2esplit */](strMsie)[1]), (doc[strDocumentMode] || 0));\r\n }\r\n else if (strContains(ua, strTrident)) {\r\n var tridentVer = parseInt(ua[_DYN_SPLIT /* @min:%2esplit */](strTrident)[1]);\r\n if (tridentVer) {\r\n return tridentVer + 4;\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Returns string representation of an object suitable for diagnostics logging.\r\n */\r\nexport function dumpObj(object) {\r\n var objectTypeDump = Object[strShimPrototype].toString[_DYN_CALL /* @min:%2ecall */](object);\r\n var propertyValueDump = STR_EMPTY;\r\n if (objectTypeDump === \"[object Error]\") {\r\n propertyValueDump = \"{ stack: '\" + object.stack + \"', message: '\" + object.message + \"', name: '\" + object[_DYN_NAME /* @min:%2ename */] + \"'\";\r\n }\r\n else if (hasJSON()) {\r\n propertyValueDump = getJSON().stringify(object);\r\n }\r\n return objectTypeDump + propertyValueDump;\r\n}\r\nexport function isSafari(userAgentStr) {\r\n if (!userAgentStr || !isString(userAgentStr)) {\r\n var navigator_2 = getNavigator() || {};\r\n userAgentStr = navigator_2 ? (navigator_2[_DYN_USER_AGENT /* @min:%2euserAgent */] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() : STR_EMPTY;\r\n }\r\n var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n return (ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"safari\") >= 0);\r\n}\r\n/**\r\n * Checks if HTML5 Beacons are supported in the current environment.\r\n * @returns True if supported, false otherwise.\r\n */\r\nexport function isBeaconsSupported() {\r\n if (_beaconsSupported === null) {\r\n _beaconsSupported = hasNavigator() && Boolean(getNavigator().sendBeacon);\r\n }\r\n return _beaconsSupported;\r\n}\r\n/**\r\n * Checks if the Fetch API is supported in the current environment.\r\n * @param withKeepAlive - [Optional] If True, check if fetch is available and it supports the keepalive feature, otherwise only check if fetch is supported\r\n * @returns True if supported, otherwise false\r\n */\r\nexport function isFetchSupported(withKeepAlive) {\r\n var isSupported = false;\r\n try {\r\n isSupported = !!getGlobalInst(\"fetch\");\r\n var request = getGlobalInst(\"Request\");\r\n if (isSupported && withKeepAlive && request) {\r\n isSupported = _hasProperty(request, \"keepalive\");\r\n }\r\n }\r\n catch (e) {\r\n // Just Swallow any failure during availability checks\r\n }\r\n return isSupported;\r\n}\r\nexport function useXDomainRequest() {\r\n if (_useXDomainRequest === null) {\r\n _useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);\r\n if (_useXDomainRequest && isXhrSupported()) {\r\n _useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(strXMLHttpRequest), \"withCredentials\");\r\n }\r\n }\r\n return _useXDomainRequest;\r\n}\r\n/**\r\n * Checks if XMLHttpRequest is supported\r\n * @returns True if supported, otherwise false\r\n */\r\nexport function isXhrSupported() {\r\n var isSupported = false;\r\n try {\r\n var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);\r\n isSupported = !!xmlHttpRequest;\r\n }\r\n catch (e) {\r\n // Just Swallow any failure during availability checks\r\n }\r\n return isSupported;\r\n}\r\nfunction _getNamedValue(values, name) {\r\n if (values) {\r\n for (var i = 0; i < values[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var value = values[i];\r\n if (value[_DYN_NAME /* @min:%2ename */]) {\r\n if (value[_DYN_NAME /* @min:%2ename */] === name) {\r\n return value;\r\n }\r\n }\r\n }\r\n }\r\n return {};\r\n}\r\n/**\r\n * Helper function to fetch the named meta-tag from the page.\r\n * @param name\r\n */\r\nexport function findMetaTag(name) {\r\n var doc = getDocument();\r\n if (doc && name) {\r\n // Look for a meta-tag\r\n return _getNamedValue(doc.querySelectorAll(\"meta\"), name).content;\r\n }\r\n return null;\r\n}\r\n/**\r\n * Helper function to fetch the named server timing value from the page response (first navigation event).\r\n * @param name\r\n */\r\nexport function findNamedServerTiming(name) {\r\n var value;\r\n var perf = getPerformance();\r\n if (perf) {\r\n // Try looking for a server-timing header\r\n var navPerf = perf.getEntriesByType(\"navigation\") || [];\r\n value = _getNamedValue((navPerf[_DYN_LENGTH /* @min:%2elength */] > 0 ? navPerf[0] : {}).serverTiming, name).description;\r\n }\r\n return value;\r\n}\r\n// TODO: should reuse this method for analytics plugin\r\nexport function dispatchEvent(target, evnt) {\r\n if (target && target.dispatchEvent && evnt) {\r\n target.dispatchEvent(evnt);\r\n return true;\r\n }\r\n return false;\r\n}\r\nexport function createCustomDomEvent(eventName, details) {\r\n var event = null;\r\n var detail = { detail: details || null };\r\n if (isFunction(CustomEvent)) { // Use CustomEvent constructor when available\r\n event = new CustomEvent(eventName, detail);\r\n }\r\n else { // CustomEvent has no constructor in IE\r\n var doc = getDocument();\r\n if (doc && doc.createEvent) {\r\n event = doc.createEvent(\"CustomEvent\");\r\n event.initCustomEvent(eventName, true, true, detail);\r\n }\r\n }\r\n return event;\r\n}\r\nexport function sendCustomEvent(evtName, cfg, customDetails) {\r\n var global = getGlobal();\r\n if (global && global.CustomEvent) {\r\n try {\r\n var details = { cfg: cfg || null, customDetails: customDetails || null };\r\n return dispatchEvent(global, createCustomDomEvent(evtName, details));\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=EnvUtils.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { _DYN_APPLY, _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { getGlobalInst } from \"./EnvUtils\";\r\nvar listenerFuncs = [\"eventsSent\", \"eventsDiscarded\", \"eventsSendRequest\", \"perfEvent\"];\r\nvar _aiNamespace = null;\r\nvar _debugListener;\r\nfunction _listenerProxyFunc(name, config) {\r\n return function () {\r\n var args = arguments;\r\n var dbgExt = getDebugExt(config);\r\n if (dbgExt) {\r\n var listener = dbgExt.listener;\r\n if (listener && listener[name]) {\r\n listener[name][_DYN_APPLY /* @min:%2eapply */](listener, args);\r\n }\r\n }\r\n };\r\n}\r\nfunction _getExtensionNamespace() {\r\n // Cache the lookup of the global namespace object\r\n var target = getGlobalInst(\"Microsoft\");\r\n if (target) {\r\n _aiNamespace = target[\"ApplicationInsights\"];\r\n }\r\n return _aiNamespace;\r\n}\r\nexport function getDebugExt(config) {\r\n var ns = _aiNamespace;\r\n if (!ns && config.disableDbgExt !== true) {\r\n ns = _aiNamespace || _getExtensionNamespace();\r\n }\r\n return ns ? ns[\"ChromeDbgExt\"] : null;\r\n}\r\nexport function getDebugListener(config) {\r\n if (!_debugListener) {\r\n _debugListener = {};\r\n for (var lp = 0; lp < listenerFuncs[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);\r\n }\r\n }\r\n return _debugListener;\r\n}\r\n//# sourceMappingURL=DbgExtensionUtils.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_DIAG_LOG, _DYN_ENABLE_DEBUG_EXCEPTI4, _DYN_LOGGER, _DYN_LOG_INTERNAL_MESSAGE, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_PUSH, _DYN_REPLACE } from \"../__DynamicConstants\";\r\nimport { getDebugExt } from \"./DbgExtensionUtils\";\r\nimport { dumpObj, getConsole, getJSON, hasJSON } from \"./EnvUtils\";\r\nimport { getCfgValue, isFunction, isUndefined } from \"./HelperFuncs\";\r\nimport { STR_EMPTY, STR_ERROR_TO_CONSOLE, STR_WARN_TO_CONSOLE } from \"./InternalConstants\";\r\n/**\r\n * For user non actionable traces use AI Internal prefix.\r\n */\r\nvar AiNonUserActionablePrefix = \"AI (Internal): \";\r\n/**\r\n * Prefix of the traces in portal.\r\n */\r\nvar AiUserActionablePrefix = \"AI: \";\r\n/**\r\n * Session storage key for the prefix for the key indicating message type already logged\r\n */\r\nvar AIInternalMessagePrefix = \"AITR_\";\r\nfunction _sanitizeDiagnosticText(text) {\r\n if (text) {\r\n return \"\\\"\" + text[_DYN_REPLACE /* @min:%2ereplace */](/\\\"/g, STR_EMPTY) + \"\\\"\";\r\n }\r\n return STR_EMPTY;\r\n}\r\nfunction _logToConsole(func, message) {\r\n var theConsole = getConsole();\r\n if (!!theConsole) {\r\n var logFunc = \"log\";\r\n if (theConsole[func]) {\r\n logFunc = func;\r\n }\r\n if (isFunction(theConsole[logFunc])) {\r\n theConsole[logFunc](message);\r\n }\r\n }\r\n}\r\nvar _InternalLogMessage = /** @class */ (function () {\r\n function _InternalLogMessage(msgId, msg, isUserAct, properties) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n var _self = this;\r\n _self[_DYN_MESSAGE_ID /* @min:%2emessageId */] = msgId;\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] =\r\n (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +\r\n msgId;\r\n var strProps = STR_EMPTY;\r\n if (hasJSON()) {\r\n strProps = getJSON().stringify(properties);\r\n }\r\n var diagnosticText = (msg ? \" message:\" + _sanitizeDiagnosticText(msg) : STR_EMPTY) +\r\n (properties ? \" props:\" + _sanitizeDiagnosticText(strProps) : STR_EMPTY);\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] += diagnosticText;\r\n }\r\n _InternalLogMessage.dataType = \"MessageData\";\r\n return _InternalLogMessage;\r\n}());\r\nexport { _InternalLogMessage };\r\nexport function safeGetLogger(core, config) {\r\n return (core || {})[_DYN_LOGGER /* @min:%2elogger */] || new DiagnosticLogger(config);\r\n}\r\nvar DiagnosticLogger = /** @class */ (function () {\r\n function DiagnosticLogger(config) {\r\n this.identifier = \"DiagnosticLogger\";\r\n /**\r\n * The internal logging queue\r\n */\r\n this.queue = [];\r\n /**\r\n * Count of internal messages sent\r\n */\r\n var _messageCount = 0;\r\n /**\r\n * Holds information about what message types were already logged to console or sent to server.\r\n */\r\n var _messageLogged = {};\r\n var _loggingLevelConsole;\r\n var _loggingLevelTelemetry;\r\n var _maxInternalMessageLimit;\r\n var _enableDebug;\r\n dynamicProto(DiagnosticLogger, this, function (_self) {\r\n _setDefaultsFromConfig(config || {});\r\n _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };\r\n _self.telemetryLoggingLevel = function () { return _loggingLevelTelemetry; };\r\n _self.maxInternalMessageLimit = function () { return _maxInternalMessageLimit; };\r\n _self[_DYN_ENABLE_DEBUG_EXCEPTI4 /* @min:%2eenableDebugExceptions */] = function () { return _enableDebug; };\r\n /**\r\n * This method will throw exceptions in debug mode or attempt to log the error as a console warning.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\n _self.throwInternal = function (severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);\r\n if (_enableDebug) {\r\n throw dumpObj(message);\r\n }\r\n else {\r\n // Get the logging function and fallback to warnToConsole of for some reason errorToConsole doesn't exist\r\n var logFunc = severity === 1 /* eLoggingSeverity.CRITICAL */ ? STR_ERROR_TO_CONSOLE : STR_WARN_TO_CONSOLE;\r\n if (!isUndefined(message[_DYN_MESSAGE /* @min:%2emessage */])) {\r\n if (isUserAct) {\r\n // check if this message type was already logged to console for this page view and if so, don't log it again\r\n var messageKey = +message[_DYN_MESSAGE_ID /* @min:%2emessageId */];\r\n if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {\r\n _self[logFunc](message[_DYN_MESSAGE /* @min:%2emessage */]);\r\n _messageLogged[messageKey] = true;\r\n }\r\n }\r\n else {\r\n // Only log traces if the console Logging Level is >= the throwInternal severity level\r\n if (_loggingLevelConsole >= severity) {\r\n _self[logFunc](message[_DYN_MESSAGE /* @min:%2emessage */]);\r\n }\r\n }\r\n _logInternalMessage(severity, message);\r\n }\r\n else {\r\n _debugExtMsg(\"throw\" + (severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"Critical\" : \"Warning\"), message);\r\n }\r\n }\r\n };\r\n /**\r\n * This will write a warning to the console if possible\r\n * @param message {string} - The warning message\r\n */\r\n _self[STR_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */] = function (message) {\r\n _logToConsole(\"warn\", message);\r\n _debugExtMsg(\"warning\", message);\r\n };\r\n /**\r\n * This will write an error to the console if possible\r\n * @param message {string} - The error message\r\n */\r\n _self[STR_ERROR_TO_CONSOLE /* @min:%2eerrorToConsole */] = function (message) {\r\n _logToConsole(\"error\", message);\r\n _debugExtMsg(\"error\", message);\r\n };\r\n /**\r\n * Resets the internal message count\r\n */\r\n _self.resetInternalMessageCount = function () {\r\n _messageCount = 0;\r\n _messageLogged = {};\r\n };\r\n /**\r\n * Logs a message to the internal queue.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The message to log.\r\n */\r\n _self[_DYN_LOG_INTERNAL_MESSAGE /* @min:%2elogInternalMessage */] = _logInternalMessage;\r\n function _logInternalMessage(severity, message) {\r\n if (_areInternalMessagesThrottled()) {\r\n return;\r\n }\r\n // check if this message type was already logged for this session and if so, don't log it again\r\n var logMessage = true;\r\n var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID /* @min:%2emessageId */];\r\n // if the session storage is not available, limit to only one message type per page view\r\n if (_messageLogged[messageKey]) {\r\n logMessage = false;\r\n }\r\n else {\r\n _messageLogged[messageKey] = true;\r\n }\r\n if (logMessage) {\r\n // Push the event in the internal queue\r\n if (severity <= _loggingLevelTelemetry) {\r\n _self.queue[_DYN_PUSH /* @min:%2epush */](message);\r\n _messageCount++;\r\n _debugExtMsg((severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"error\" : \"warn\"), message);\r\n }\r\n // When throttle limit reached, send a special event\r\n if (_messageCount === _maxInternalMessageLimit) {\r\n var throttleLimitMessage = \"Internal events throttle limit per PageView reached for this app.\";\r\n var throttleMessage = new _InternalLogMessage(23 /* _eInternalMessageId.MessageLimitPerPVExceeded */, throttleLimitMessage, false);\r\n _self.queue[_DYN_PUSH /* @min:%2epush */](throttleMessage);\r\n if (severity === 1 /* eLoggingSeverity.CRITICAL */) {\r\n _self[STR_ERROR_TO_CONSOLE /* @min:%2eerrorToConsole */](throttleLimitMessage);\r\n }\r\n else {\r\n _self[STR_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](throttleLimitMessage);\r\n }\r\n }\r\n }\r\n }\r\n function _setDefaultsFromConfig(config) {\r\n _loggingLevelConsole = getCfgValue(config.loggingLevelConsole, 0);\r\n _loggingLevelTelemetry = getCfgValue(config.loggingLevelTelemetry, 1);\r\n _maxInternalMessageLimit = getCfgValue(config.maxMessageLimit, 25);\r\n _enableDebug = getCfgValue(config.enableDebug, getCfgValue(config[_DYN_ENABLE_DEBUG_EXCEPTI4 /* @min:%2eenableDebugExceptions */], false));\r\n }\r\n function _areInternalMessagesThrottled() {\r\n return _messageCount >= _maxInternalMessageLimit;\r\n }\r\n function _debugExtMsg(name, data) {\r\n var dbgExt = getDebugExt(config || {});\r\n if (dbgExt && dbgExt[_DYN_DIAG_LOG /* @min:%2ediagLog */]) {\r\n dbgExt[_DYN_DIAG_LOG /* @min:%2ediagLog */](name, data);\r\n }\r\n }\r\n });\r\n }\r\n /**\r\n * When this is true the SDK will throw exceptions to aid in debugging.\r\n */\r\n DiagnosticLogger.prototype.enableDebugExceptions = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * 0: OFF (default)\r\n * 1: CRITICAL\r\n * 2: >= WARNING\r\n */\r\n DiagnosticLogger.prototype.consoleLoggingLevel = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 0;\r\n };\r\n /**\r\n * 0: OFF\r\n * 1: CRITICAL (default)\r\n * 2: >= WARNING\r\n */\r\n DiagnosticLogger.prototype.telemetryLoggingLevel = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 1;\r\n };\r\n /**\r\n * The maximum number of internal messages allowed to be sent per page view\r\n */\r\n DiagnosticLogger.prototype.maxInternalMessageLimit = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 25;\r\n };\r\n /**\r\n * This method will throw exceptions in debug mode or attempt to log the error as a console warning.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\n DiagnosticLogger.prototype.throwInternal = function (severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * This will write a warning to the console if possible\r\n * @param message {string} - The warning message\r\n */\r\n DiagnosticLogger.prototype.warnToConsole = function (message) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * This will write an error to the console if possible\r\n * @param message {string} - The warning message\r\n */\r\n DiagnosticLogger.prototype.errorToConsole = function (message) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Resets the internal message count\r\n */\r\n DiagnosticLogger.prototype.resetInternalMessageCount = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Logs a message to the internal queue.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The message to log.\r\n */\r\n DiagnosticLogger.prototype.logInternalMessage = function (severity, message) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return DiagnosticLogger;\r\n}());\r\nexport { DiagnosticLogger };\r\nfunction _getLogger(logger) {\r\n return (logger || new DiagnosticLogger());\r\n}\r\n/**\r\n * This is a helper method which will call throwInternal on the passed logger, will throw exceptions in\r\n * debug mode or attempt to log the error as a console warning. This helper is provided mostly to better\r\n * support minification as logger.throwInternal() will not compress the publish \"throwInternal\" used throughout\r\n * the code.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\nexport function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n _getLogger(logger).throwInternal(severity, msgId, msg, properties, isUserAct);\r\n}\r\n/**\r\n * This is a helper method which will call warnToConsole on the passed logger with the provided message.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\nexport function _warnToConsole(logger, message) {\r\n _getLogger(logger)[STR_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](message);\r\n}\r\n/**\r\n * Logs a message to the internal queue.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The message to log.\r\n */\r\nexport function _logInternalMessage(logger, severity, message) {\r\n _getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE /* @min:%2elogInternalMessage */](severity, message);\r\n}\r\n//# sourceMappingURL=DiagnosticLogger.js.map","import { _DYN_COOKIE_CFG, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_LOGGER, _DYN_SET_ENABLED, _DYN_SPLIT, _DYN_SUBSTRING, _DYN_USER_AGENT } from \"../__DynamicConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { dumpObj, getDocument, getLocation, getNavigator, isIE } from \"./EnvUtils\";\r\nimport { arrForEach, dateNow, getExceptionName, isArray, isFunction, isNotNullOrUndefined, isNullOrUndefined, isString, isTruthy, isUndefined, objForEachKey, setValue, strContains, strEndsWith, strTrim } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nvar strToGMTString = \"toGMTString\";\r\nvar strToUTCString = \"toUTCString\";\r\nvar strCookie = \"cookie\";\r\nvar strExpires = \"expires\";\r\nvar strEnabled = \"enabled\";\r\nvar strIsCookieUseDisabled = \"isCookieUseDisabled\";\r\nvar strDisableCookiesUsage = \"disableCookiesUsage\";\r\nvar strConfigCookieMgr = \"_ckMgr\";\r\nvar _supportsCookies = null;\r\nvar _allowUaSameSite = null;\r\nvar _parsedCookieValue = null;\r\nvar _doc = getDocument();\r\nvar _cookieCache = {};\r\nvar _globalCookieConfig = {};\r\n/**\r\n * @ignore\r\n * DO NOT USE or export from the module, this is exposed as public to support backward compatibility of previous static utility methods only.\r\n * If you want to manager cookies either use the ICookieMgr available from the core instance via getCookieMgr() or create\r\n * your own instance of the CookieMgr and use that.\r\n * Using this directly for enabling / disabling cookie handling will not only affect your usage but EVERY user of cookies.\r\n * Example, if you are using a shared component that is also using Application Insights you will affect their cookie handling.\r\n * @param logger - The DiagnosticLogger to use for reporting errors.\r\n */\r\nexport function _gblCookieMgr(config, logger) {\r\n // Stash the global instance against the BaseCookieMgr class\r\n var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];\r\n if (!inst) {\r\n // Note: not using the getSetValue() helper as that would require always creating a temporary cookieMgr\r\n // that ultimately is never used\r\n inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);\r\n _globalCookieConfig[strConfigCookieMgr] = inst;\r\n }\r\n return inst;\r\n}\r\nfunction _isMgrEnabled(cookieMgr) {\r\n if (cookieMgr) {\r\n return cookieMgr.isEnabled();\r\n }\r\n return true;\r\n}\r\nfunction _createCookieMgrConfig(rootConfig) {\r\n var cookieMgrCfg = rootConfig[_DYN_COOKIE_CFG /* @min:%2ecookieCfg */] = rootConfig[_DYN_COOKIE_CFG /* @min:%2ecookieCfg */] || {};\r\n // Sets the values from the root config if not already present on the cookieMgrCfg\r\n setValue(cookieMgrCfg, \"domain\", rootConfig.cookieDomain, isNotNullOrUndefined, isNullOrUndefined);\r\n setValue(cookieMgrCfg, \"path\", rootConfig.cookiePath || \"/\", null, isNullOrUndefined);\r\n if (isNullOrUndefined(cookieMgrCfg[strEnabled])) {\r\n // Set the enabled from the provided setting or the legacy root values\r\n var cookieEnabled = void 0;\r\n if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {\r\n cookieEnabled = !rootConfig[strIsCookieUseDisabled];\r\n }\r\n if (!isUndefined(rootConfig[strDisableCookiesUsage])) {\r\n cookieEnabled = !rootConfig[strDisableCookiesUsage];\r\n }\r\n cookieMgrCfg[strEnabled] = cookieEnabled;\r\n }\r\n return cookieMgrCfg;\r\n}\r\nfunction _isIgnoredCookie(cookieMgrCfg, name) {\r\n if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {\r\n return cookieMgrCfg.ignoreCookies[_DYN_INDEX_OF /* @min:%2eindexOf */](name) !== -1;\r\n }\r\n return false;\r\n}\r\nfunction _isBlockedCookie(cookieMgrCfg, name) {\r\n if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {\r\n if (cookieMgrCfg.blockedCookies[_DYN_INDEX_OF /* @min:%2eindexOf */](name) !== -1) {\r\n return true;\r\n }\r\n }\r\n return _isIgnoredCookie(cookieMgrCfg, name);\r\n}\r\n/**\r\n * Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation\r\n * associated with the configuration or a legacy default.\r\n * @param core\r\n * @param config\r\n * @returns\r\n */\r\nexport function safeGetCookieMgr(core, config) {\r\n var cookieMgr;\r\n if (core) {\r\n // Always returns an instance\r\n cookieMgr = core.getCookieMgr();\r\n }\r\n else if (config) {\r\n var cookieCfg = config[_DYN_COOKIE_CFG /* @min:%2ecookieCfg */];\r\n if (cookieCfg[strConfigCookieMgr]) {\r\n cookieMgr = cookieCfg[strConfigCookieMgr];\r\n }\r\n else {\r\n cookieMgr = createCookieMgr(config);\r\n }\r\n }\r\n if (!cookieMgr) {\r\n // Get or initialize the default global (legacy) cookie manager if we couldn't find one\r\n cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER /* @min:%2elogger */]);\r\n }\r\n return cookieMgr;\r\n}\r\nexport function createCookieMgr(rootConfig, logger) {\r\n var _a;\r\n var cookieMgrConfig = _createCookieMgrConfig(rootConfig || _globalCookieConfig);\r\n var _path = cookieMgrConfig.path || \"/\";\r\n var _domain = cookieMgrConfig.domain;\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n var _enabled = cookieMgrConfig[strEnabled] !== false;\r\n var cookieMgr = (_a = {\r\n isEnabled: function () {\r\n var enabled = _enabled && areCookiesSupported(logger);\r\n // Using an indirect lookup for any global cookie manager to support tree shaking for SDK's\r\n // that don't use the \"applicationinsights-core\" version of the default cookie function\r\n var gblManager = _globalCookieConfig[strConfigCookieMgr];\r\n if (enabled && gblManager && cookieMgr !== gblManager) {\r\n // Make sure the GlobalCookie Manager instance (if not this instance) is also enabled.\r\n // As the global (deprecated) functions may have been called (for backward compatibility)\r\n enabled = _isMgrEnabled(gblManager);\r\n }\r\n return enabled;\r\n }\r\n },\r\n _a[_DYN_SET_ENABLED /* @min:setEnabled */] = function (value) {\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n _enabled = value !== false;\r\n },\r\n _a.set = function (name, value, maxAgeSec, domain, path) {\r\n var result = false;\r\n if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {\r\n var values = {};\r\n var theValue = strTrim(value || STR_EMPTY);\r\n var idx = theValue[_DYN_INDEX_OF /* @min:%2eindexOf */](\";\");\r\n if (idx !== -1) {\r\n theValue = strTrim(value[_DYN_SUBSTRING /* @min:%2esubstring */](0, idx));\r\n values = _extractParts(value[_DYN_SUBSTRING /* @min:%2esubstring */](idx + 1));\r\n }\r\n // Only update domain if not already present (isUndefined) and the value is truthy (not null, undefined or empty string)\r\n setValue(values, \"domain\", domain || _domain, isTruthy, isUndefined);\r\n if (!isNullOrUndefined(maxAgeSec)) {\r\n var _isIE = isIE();\r\n if (isUndefined(values[strExpires])) {\r\n var nowMs = dateNow();\r\n // Only add expires if not already present\r\n var expireMs = nowMs + (maxAgeSec * 1000);\r\n // Sanity check, if zero or -ve then ignore\r\n if (expireMs > 0) {\r\n var expiry = new Date();\r\n expiry.setTime(expireMs);\r\n setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);\r\n }\r\n }\r\n if (!_isIE) {\r\n // Only replace if not already present\r\n setValue(values, \"max-age\", STR_EMPTY + maxAgeSec, null, isUndefined);\r\n }\r\n }\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol === \"https:\") {\r\n setValue(values, \"secure\", null, null, isUndefined);\r\n // Only set same site if not also secure\r\n if (_allowUaSameSite === null) {\r\n _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT /* @min:%2euserAgent */]);\r\n }\r\n if (_allowUaSameSite) {\r\n setValue(values, \"SameSite\", \"None\", null, isUndefined);\r\n }\r\n }\r\n setValue(values, \"path\", path || _path, null, isUndefined);\r\n var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;\r\n setCookieFn(name, _formatCookieValue(theValue, values));\r\n result = true;\r\n }\r\n return result;\r\n },\r\n _a.get = function (name) {\r\n var value = STR_EMPTY;\r\n if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {\r\n value = (cookieMgrConfig.getCookie || _getCookieValue)(name);\r\n }\r\n return value;\r\n },\r\n _a.del = function (name, path) {\r\n var result = false;\r\n if (_isMgrEnabled(cookieMgr)) {\r\n // Only remove the cookie if the manager and cookie support has not been disabled\r\n result = cookieMgr.purge(name, path);\r\n }\r\n return result;\r\n },\r\n _a.purge = function (name, path) {\r\n var _a;\r\n var result = false;\r\n if (areCookiesSupported(logger)) {\r\n // Setting the expiration date in the past immediately removes the cookie\r\n var values = (_a = {},\r\n _a[\"path\"] = path ? path : \"/\",\r\n _a[strExpires] = \"Thu, 01 Jan 1970 00:00:01 GMT\",\r\n _a);\r\n if (!isIE()) {\r\n // Set max age to expire now\r\n values[\"max-age\"] = \"0\";\r\n }\r\n var delCookie = cookieMgrConfig.delCookie || _setCookieValue;\r\n delCookie(name, _formatCookieValue(STR_EMPTY, values));\r\n result = true;\r\n }\r\n return result;\r\n },\r\n _a);\r\n // Associated this cookie manager with the config\r\n cookieMgr[strConfigCookieMgr] = cookieMgr;\r\n return cookieMgr;\r\n}\r\n/*\r\n* Helper method to tell if document.cookie object is supported by the runtime\r\n*/\r\nexport function areCookiesSupported(logger) {\r\n if (_supportsCookies === null) {\r\n _supportsCookies = false;\r\n try {\r\n var doc = _doc || {};\r\n _supportsCookies = doc[strCookie] !== undefined;\r\n }\r\n catch (e) {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 68 /* _eInternalMessageId.CannotAccessCookie */, \"Cannot access document.cookie - \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return _supportsCookies;\r\n}\r\nfunction _extractParts(theValue) {\r\n var values = {};\r\n if (theValue && theValue[_DYN_LENGTH /* @min:%2elength */]) {\r\n var parts = strTrim(theValue)[_DYN_SPLIT /* @min:%2esplit */](\";\");\r\n arrForEach(parts, function (thePart) {\r\n thePart = strTrim(thePart || STR_EMPTY);\r\n if (thePart) {\r\n var idx = thePart[_DYN_INDEX_OF /* @min:%2eindexOf */](\"=\");\r\n if (idx === -1) {\r\n values[thePart] = null;\r\n }\r\n else {\r\n values[strTrim(thePart[_DYN_SUBSTRING /* @min:%2esubstring */](0, idx))] = strTrim(thePart[_DYN_SUBSTRING /* @min:%2esubstring */](idx + 1));\r\n }\r\n }\r\n });\r\n }\r\n return values;\r\n}\r\nfunction _formatDate(theDate, func) {\r\n if (isFunction(theDate[func])) {\r\n return theDate[func]();\r\n }\r\n return null;\r\n}\r\nfunction _formatCookieValue(value, values) {\r\n var cookieValue = value || STR_EMPTY;\r\n objForEachKey(values, function (name, theValue) {\r\n cookieValue += \"; \" + name + (!isNullOrUndefined(theValue) ? \"=\" + theValue : STR_EMPTY);\r\n });\r\n return cookieValue;\r\n}\r\nfunction _getCookieValue(name) {\r\n var cookieValue = STR_EMPTY;\r\n if (_doc) {\r\n var theCookie = _doc[strCookie] || STR_EMPTY;\r\n if (_parsedCookieValue !== theCookie) {\r\n _cookieCache = _extractParts(theCookie);\r\n _parsedCookieValue = theCookie;\r\n }\r\n cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);\r\n }\r\n return cookieValue;\r\n}\r\nfunction _setCookieValue(name, cookieValue) {\r\n if (_doc) {\r\n _doc[strCookie] = name + \"=\" + cookieValue;\r\n }\r\n}\r\nexport function uaDisallowsSameSiteNone(userAgent) {\r\n if (!isString(userAgent)) {\r\n return false;\r\n }\r\n // Cover all iOS based browsers here. This includes:\r\n // - Safari on iOS 12 for iPhone, iPod Touch, iPad\r\n // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad\r\n // - Chrome on iOS 12 for iPhone, iPod Touch, iPad\r\n // All of which are broken by SameSite=None, because they use the iOS networking stack\r\n if (strContains(userAgent, \"CPU iPhone OS 12\") || strContains(userAgent, \"iPad; CPU OS 12\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X based browsers that use the Mac OS networking stack. This includes:\r\n // - Safari on Mac OS X\r\n // This does not include:\r\n // - Internal browser on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strContains(userAgent, \"Version/\") && strContains(userAgent, \"Safari\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X internal browsers that use the Mac OS networking stack. This includes:\r\n // - Internal browser on Mac OS X\r\n // This does not include:\r\n // - Safari on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strEndsWith(userAgent, \"AppleWebKit/605.1.15 (KHTML, like Gecko)\")) {\r\n return true;\r\n }\r\n // Cover Chrome 50-69, because some versions are broken by SameSite=None, and none in this range require it.\r\n // Note: this covers some pre-Chromium Edge versions, but pre-Chromim Edge does not require SameSite=None, so this is fine.\r\n // Note: this regex applies to Windows, Mac OS X, and Linux, deliberately.\r\n if (strContains(userAgent, \"Chrome/5\") || strContains(userAgent, \"Chrome/6\")) {\r\n return true;\r\n }\r\n // Unreal Engine runs Chromium 59, but does not advertise as Chrome until 4.23. Treat versions of Unreal\r\n // that don't specify their Chrome version as lacking support for SameSite=None.\r\n if (strContains(userAgent, \"UnrealEngine\") && !strContains(userAgent, \"Chrome\")) {\r\n return true;\r\n }\r\n // UCBrowser < 12.13.2 ignores Set-Cookie headers with SameSite=None\r\n // NB: this rule isn't complete - you need regex to make a complete rule.\r\n // See: https://www.chromium.org/updates/same-site/incompatible-clients\r\n if (strContains(userAgent, \"UCBrowser/12\") || strContains(userAgent, \"UCBrowser/11\")) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=CookieMgr.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { getCrypto, getMsCrypto, isIE } from \"./EnvUtils\";\r\nimport { dateNow } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nvar UInt32Mask = 0x100000000;\r\nvar MaxUInt32 = 0xffffffff;\r\n// MWC based Random generator (for IE)\r\nvar _mwcSeeded = false;\r\nvar _mwcW = 123456789;\r\nvar _mwcZ = 987654321;\r\n// Takes any integer\r\nfunction _mwcSeed(seedValue) {\r\n if (seedValue < 0) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n seedValue >>>= 0;\r\n }\r\n _mwcW = (123456789 + seedValue) & MaxUInt32;\r\n _mwcZ = (987654321 - seedValue) & MaxUInt32;\r\n _mwcSeeded = true;\r\n}\r\nfunction _autoSeedMwc() {\r\n // Simple initialization using default Math.random() - So we inherit any entropy from the browser\r\n // and bitwise XOR with the current milliseconds\r\n try {\r\n var now = dateNow() & 0x7fffffff;\r\n _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);\r\n }\r\n catch (e) {\r\n // Don't crash if something goes wrong\r\n }\r\n}\r\n/**\r\n * Generate a random value between 0 and maxValue, max value should be limited to a 32-bit maximum.\r\n * So maxValue(16) will produce a number from 0..16 (range of 17)\r\n * @param maxValue\r\n */\r\nexport function randomValue(maxValue) {\r\n if (maxValue > 0) {\r\n return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;\r\n }\r\n return 0;\r\n}\r\n/**\r\n * generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function random32(signed) {\r\n var value = 0;\r\n var c = getCrypto() || getMsCrypto();\r\n if (c && c.getRandomValues) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;\r\n }\r\n if (value === 0 && isIE()) {\r\n // For IE 6, 7, 8 (especially on XP) Math.random is not very random\r\n if (!_mwcSeeded) {\r\n // Set the seed for the Mwc algorithm\r\n _autoSeedMwc();\r\n }\r\n // Don't use Math.random for IE\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = mwcRandom32() & MaxUInt32;\r\n }\r\n if (value === 0) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = Math.floor((UInt32Mask * Math.random()) | 0);\r\n }\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Seed the MWC random number generator with the specified seed or a random value\r\n * @param value - optional the number to used as the seed, if undefined, null or zero a random value will be chosen\r\n */\r\nexport function mwcRandomSeed(value) {\r\n if (!value) {\r\n _autoSeedMwc();\r\n }\r\n else {\r\n _mwcSeed(value);\r\n }\r\n}\r\n/**\r\n * Generate a random 32-bit number between (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), using MWC (Multiply with carry)\r\n * instead of Math.random() defaults to un-signed.\r\n * Used as a replacement random generator for IE to avoid issues with older IE instances.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function mwcRandom32(signed) {\r\n _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;\r\n _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;\r\n var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Generate random base64 id string.\r\n * The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)\r\n * @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22\r\n */\r\nexport function newId(maxLength) {\r\n if (maxLength === void 0) { maxLength = 22; }\r\n var base64chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n // Start with an initial random number, consuming the value in reverse byte order\r\n var number = random32() >>> 0; // Make sure it's a +ve number\r\n var chars = 0;\r\n var result = STR_EMPTY;\r\n while (result[_DYN_LENGTH /* @min:%2elength */] < maxLength) {\r\n chars++;\r\n result += base64chars.charAt(number & 0x3F);\r\n number >>>= 6; // Zero fill with right shift\r\n if (chars === 5) {\r\n // 5 base64 characters === 30 bits so we don't have enough bits for another base64 char\r\n // So add on another 30 bits and make sure it's +ve\r\n number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;\r\n chars = 0; // We need to reset the number every 5 chars (30 bits)\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=RandomHelper.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjDefineProperty } from \"@microsoft/applicationinsights-shims\";\r\nimport { _DYN_NODE_TYPE } from \"../__DynamicConstants\";\r\nimport { normalizeJsName } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { newId } from \"./RandomHelper\";\r\nvar _objDefineProperty = ObjDefineProperty;\r\nvar version = '2.8.16';\r\nvar instanceName = \".\" + newId(6);\r\nvar _dataUid = 0;\r\nfunction _createAccessor(target, prop, value) {\r\n if (_objDefineProperty) {\r\n try {\r\n _objDefineProperty(target, prop, {\r\n value: value,\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return true;\r\n }\r\n catch (e) {\r\n // IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw\r\n // We will just ignore this here.\r\n }\r\n }\r\n return false;\r\n}\r\n// Accepts only:\r\n// - Node\r\n// - Node.ELEMENT_NODE\r\n// - Node.DOCUMENT_NODE\r\n// - Object\r\n// - Any\r\nfunction _canAcceptData(target) {\r\n return target[_DYN_NODE_TYPE /* @min:%2enodeType */] === 1 || target[_DYN_NODE_TYPE /* @min:%2enodeType */] === 9 || !(+target[_DYN_NODE_TYPE /* @min:%2enodeType */]);\r\n}\r\nfunction _getCache(data, target) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n theCache = {};\r\n try {\r\n if (_canAcceptData(target)) {\r\n if (!_createAccessor(target, data.id, theCache)) {\r\n // Environment doesn't support accessor, so just use direct assignment\r\n target[data.id] = theCache;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Not all environments allow extending all objects, so just ignore the cache in those cases\r\n }\r\n }\r\n return theCache;\r\n}\r\nexport function createUniqueNamespace(name, includeVersion) {\r\n if (includeVersion === void 0) { includeVersion = false; }\r\n return normalizeJsName(name + (_dataUid++) + (includeVersion ? \".\" + version : STR_EMPTY) + instanceName);\r\n}\r\nexport function createElmNodeData(name) {\r\n var data = {\r\n id: createUniqueNamespace(\"_aiData-\" + (name || STR_EMPTY) + \".\" + version),\r\n accept: function (target) {\r\n return _canAcceptData(target);\r\n },\r\n get: function (target, name, defValue, addDefault) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n if (addDefault) {\r\n // Side effect is adds the cache\r\n theCache = _getCache(data, target);\r\n theCache[normalizeJsName(name)] = defValue;\r\n }\r\n return defValue;\r\n }\r\n return theCache[normalizeJsName(name)];\r\n },\r\n kill: function (target, name) {\r\n if (target && target[name]) {\r\n try {\r\n delete target[name];\r\n }\r\n catch (e) {\r\n // Just cleaning up, so if this fails -- ignore\r\n }\r\n }\r\n }\r\n };\r\n return data;\r\n}\r\n//# sourceMappingURL=DataCacheHelper.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { _DYN_HANDLER, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_REPLACE, _DYN_SPLICE, _DYN_SPLIT, _DYN_TYPE } from \"../__DynamicConstants\";\r\nimport { createElmNodeData, createUniqueNamespace } from \"./DataCacheHelper\";\r\nimport { getDocument, getWindow } from \"./EnvUtils\";\r\nimport { arrForEach, arrIndexOf, isArray, objForEachKey, objKeys } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n// Added to help with minfication\r\nvar strOnPrefix = \"on\";\r\nvar strAttachEvent = \"attachEvent\";\r\nvar strAddEventHelper = \"addEventListener\";\r\nvar strDetachEvent = \"detachEvent\";\r\nvar strRemoveEventListener = \"removeEventListener\";\r\nvar strEvents = \"events\";\r\nvar strVisibilityChangeEvt = \"visibilitychange\";\r\nvar strPageHide = \"pagehide\";\r\nvar strPageShow = \"pageshow\";\r\nvar strUnload = \"unload\";\r\nvar strBeforeUnload = \"beforeunload\";\r\nvar strPageHideNamespace = createUniqueNamespace(\"aiEvtPageHide\");\r\nvar strPageShowNamespace = createUniqueNamespace(\"aiEvtPageShow\");\r\nvar rRemoveEmptyNs = /\\.[\\.]+/g;\r\nvar rRemoveTrailingEmptyNs = /[\\.]+$/;\r\nvar _guid = 1;\r\nvar elmNodeData = createElmNodeData(\"events\");\r\nvar eventNamespace = /^([^.]*)(?:\\.(.+)|)/;\r\nfunction _normalizeNamespace(name) {\r\n if (name && name[_DYN_REPLACE /* @min:%2ereplace */]) {\r\n return name[_DYN_REPLACE /* @min:%2ereplace */](/^[\\s\\.]+|(?=[\\s\\.])[\\.\\s]+$/g, STR_EMPTY);\r\n }\r\n return name;\r\n}\r\nfunction _getEvtNamespace(eventName, evtNamespace) {\r\n var _a;\r\n if (evtNamespace) {\r\n var theNamespace_1 = STR_EMPTY;\r\n if (isArray(evtNamespace)) {\r\n theNamespace_1 = STR_EMPTY;\r\n arrForEach(evtNamespace, function (name) {\r\n name = _normalizeNamespace(name);\r\n if (name) {\r\n if (name[0] !== \".\") {\r\n name = \".\" + name;\r\n }\r\n theNamespace_1 += name;\r\n }\r\n });\r\n }\r\n else {\r\n theNamespace_1 = _normalizeNamespace(evtNamespace);\r\n }\r\n if (theNamespace_1) {\r\n if (theNamespace_1[0] !== \".\") {\r\n theNamespace_1 = \".\" + theNamespace_1;\r\n }\r\n // We may only have the namespace and not an eventName\r\n eventName = (eventName || STR_EMPTY) + theNamespace_1;\r\n }\r\n }\r\n var parsedEvent = (eventNamespace.exec(eventName || STR_EMPTY) || []);\r\n return _a = {},\r\n _a[_DYN_TYPE /* @min:type */] = parsedEvent[1],\r\n _a.ns = ((parsedEvent[2] || STR_EMPTY).replace(rRemoveEmptyNs, \".\").replace(rRemoveTrailingEmptyNs, STR_EMPTY)[_DYN_SPLIT /* @min:%2esplit */](\".\").sort()).join(\".\"),\r\n _a;\r\n}\r\n/**\r\n * Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by\r\n * applications to remove their own events\r\n * @param target - The EventTarget that has registered events\r\n * @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n */\r\nexport function __getRegisteredEvents(target, eventName, evtNamespace) {\r\n var theEvents = [];\r\n var eventCache = elmNodeData.get(target, strEvents, {}, false);\r\n var evtName = _getEvtNamespace(eventName, evtNamespace);\r\n objForEachKey(eventCache, function (evtType, registeredEvents) {\r\n arrForEach(registeredEvents, function (value) {\r\n var _a;\r\n if (!evtName[_DYN_TYPE /* @min:%2etype */] || evtName[_DYN_TYPE /* @min:%2etype */] === value.evtName[_DYN_TYPE /* @min:%2etype */]) {\r\n if (!evtName.ns || evtName.ns === evtName.ns) {\r\n theEvents[_DYN_PUSH /* @min:%2epush */]((_a = {},\r\n _a[_DYN_NAME /* @min:name */] = value.evtName[_DYN_TYPE /* @min:%2etype */] + (value.evtName.ns ? \".\" + value.evtName.ns : STR_EMPTY),\r\n _a.handler = value[_DYN_HANDLER /* @min:%2ehandler */],\r\n _a));\r\n }\r\n }\r\n });\r\n });\r\n return theEvents;\r\n}\r\n// Exported for internal unit testing only\r\nfunction _getRegisteredEvents(target, evtName, addDefault) {\r\n if (addDefault === void 0) { addDefault = true; }\r\n var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);\r\n var registeredEvents = aiEvts[evtName];\r\n if (!registeredEvents) {\r\n registeredEvents = aiEvts[evtName] = [];\r\n }\r\n return registeredEvents;\r\n}\r\nfunction _doDetach(obj, evtName, handlerRef, useCapture) {\r\n if (obj && evtName && evtName[_DYN_TYPE /* @min:%2etype */]) {\r\n if (obj[strRemoveEventListener]) {\r\n obj[strRemoveEventListener](evtName[_DYN_TYPE /* @min:%2etype */], handlerRef, useCapture);\r\n }\r\n else if (obj[strDetachEvent]) {\r\n obj[strDetachEvent](strOnPrefix + evtName[_DYN_TYPE /* @min:%2etype */], handlerRef);\r\n }\r\n }\r\n}\r\nfunction _doAttach(obj, evtName, handlerRef, useCapture) {\r\n var result = false;\r\n if (obj && evtName && evtName[_DYN_TYPE /* @min:%2etype */] && handlerRef) {\r\n if (obj[strAddEventHelper]) {\r\n // all browsers except IE before version 9\r\n obj[strAddEventHelper](evtName[_DYN_TYPE /* @min:%2etype */], handlerRef, useCapture);\r\n result = true;\r\n }\r\n else if (obj[strAttachEvent]) {\r\n // IE before version 9\r\n obj[strAttachEvent](strOnPrefix + evtName[_DYN_TYPE /* @min:%2etype */], handlerRef);\r\n result = true;\r\n }\r\n }\r\n return result;\r\n}\r\nfunction _doUnregister(target, events, evtName, unRegFn) {\r\n var idx = events[_DYN_LENGTH /* @min:%2elength */];\r\n while (idx--) {\r\n var theEvent = events[idx];\r\n if (theEvent) {\r\n if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {\r\n if (!unRegFn || unRegFn(theEvent)) {\r\n _doDetach(target, theEvent.evtName, theEvent[_DYN_HANDLER /* @min:%2ehandler */], theEvent.capture);\r\n // Remove the registered event\r\n events[_DYN_SPLICE /* @min:%2esplice */](idx, 1);\r\n }\r\n }\r\n }\r\n }\r\n}\r\nfunction _unregisterEvents(target, evtName, unRegFn) {\r\n if (evtName[_DYN_TYPE /* @min:%2etype */]) {\r\n _doUnregister(target, _getRegisteredEvents(target, evtName[_DYN_TYPE /* @min:%2etype */]), evtName, unRegFn);\r\n }\r\n else {\r\n var eventCache = elmNodeData.get(target, strEvents, {});\r\n objForEachKey(eventCache, function (evtType, events) {\r\n _doUnregister(target, events, evtName, unRegFn);\r\n });\r\n // Cleanup\r\n if (objKeys(eventCache)[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n elmNodeData.kill(target, strEvents);\r\n }\r\n }\r\n}\r\nexport function mergeEvtNamespace(theNamespace, namespaces) {\r\n var newNamespaces;\r\n if (namespaces) {\r\n if (isArray(namespaces)) {\r\n newNamespaces = [theNamespace].concat(namespaces);\r\n }\r\n else {\r\n newNamespaces = [theNamespace, namespaces];\r\n }\r\n // resort the namespaces so they are always in order\r\n newNamespaces = (_getEvtNamespace(\"xx\", newNamespaces).ns)[_DYN_SPLIT /* @min:%2esplit */](\".\");\r\n }\r\n else {\r\n newNamespaces = theNamespace;\r\n }\r\n return newNamespaces;\r\n}\r\n/**\r\n * Binds the specified function to an event, so that the function gets called whenever the event fires on the object\r\n * @param obj Object to add the event too.\r\n * @param eventName String that specifies any of the standard DHTML Events without \"on\" prefix, if may also include an optional (dot \".\" prefixed)\r\n * namespaces \"click\" \"click.mynamespace\" in addition to specific namespaces.\r\n * @param handlerRef Pointer that specifies the function to call when event fires\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n * @param useCapture [Optional] Defaults to false\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\nexport function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {\r\n var _a;\r\n if (useCapture === void 0) { useCapture = false; }\r\n var result = false;\r\n if (target) {\r\n try {\r\n var evtName = _getEvtNamespace(eventName, evtNamespace);\r\n result = _doAttach(target, evtName, handlerRef, useCapture);\r\n if (result && elmNodeData.accept(target)) {\r\n var registeredEvent = (_a = {\r\n guid: _guid++,\r\n evtName: evtName\r\n },\r\n _a[_DYN_HANDLER /* @min:handler */] = handlerRef,\r\n _a.capture = useCapture,\r\n _a);\r\n _getRegisteredEvents(target, evtName.type)[_DYN_PUSH /* @min:%2epush */](registeredEvent);\r\n }\r\n }\r\n catch (e) {\r\n // Just Ignore any error so that we don't break any execution path\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Removes an event handler for the specified event\r\n * @param Object to remove the event from\r\n * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n * @param useCapture [Optional] Defaults to false\r\n */\r\nexport function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n if (target) {\r\n try {\r\n var evtName_1 = _getEvtNamespace(eventName, evtNamespace);\r\n var found_1 = false;\r\n _unregisterEvents(target, evtName_1, function (regEvent) {\r\n if ((evtName_1.ns && !handlerRef) || regEvent[_DYN_HANDLER /* @min:%2ehandler */] === handlerRef) {\r\n found_1 = true;\r\n return true;\r\n }\r\n return false;\r\n });\r\n if (!found_1) {\r\n // fallback to try and remove as requested\r\n _doDetach(target, evtName_1, handlerRef, useCapture);\r\n }\r\n }\r\n catch (e) {\r\n // Just Ignore any error so that we don't break any execution path\r\n }\r\n }\r\n}\r\n/**\r\n * Binds the specified function to an event, so that the function gets called whenever the event fires on the object\r\n * @param obj Object to add the event too.\r\n * @param eventNameWithoutOn String that specifies any of the standard DHTML Events without \"on\" prefix and optional (dot \".\" prefixed) namespaces \"click\" \"click.mynamespace\".\r\n * @param handlerRef Pointer that specifies the function to call when event fires\r\n * @param useCapture [Optional] Defaults to false\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\nexport function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);\r\n}\r\n/**\r\n * Removes an event handler for the specified event\r\n * @param Object to remove the event from\r\n * @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param useCapture [Optional] Defaults to false\r\n */\r\nexport function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);\r\n}\r\n/**\r\n * Trys to add an event handler for the specified event to the window, body and document\r\n * @param eventName {string} - The name of the event\r\n * @param callback {any} - The callback function that needs to be executed for the given event\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @return {boolean} - true if the handler was successfully added\r\n */\r\nexport function addEventHandler(eventName, callback, evtNamespace) {\r\n var result = false;\r\n var w = getWindow();\r\n if (w) {\r\n result = eventOn(w, eventName, callback, evtNamespace);\r\n result = eventOn(w[\"body\"], eventName, callback, evtNamespace) || result;\r\n }\r\n var doc = getDocument();\r\n if (doc) {\r\n result = eventOn(doc, eventName, callback, evtNamespace) || result;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Trys to remove event handler(s) for the specified event/namespace to the window, body and document\r\n * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param callback {any} - - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n */\r\nexport function removeEventHandler(eventName, callback, evtNamespace) {\r\n var w = getWindow();\r\n if (w) {\r\n eventOff(w, eventName, callback, evtNamespace);\r\n eventOff(w[\"body\"], eventName, callback, evtNamespace);\r\n }\r\n var doc = getDocument();\r\n if (doc) {\r\n eventOff(doc, eventName, callback, evtNamespace);\r\n }\r\n}\r\n/**\r\n * Bind the listener to the array of events\r\n * @param events An string array of event names to bind the listener to\r\n * @param listener The event callback to call when the event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nfunction _addEventListeners(events, listener, excludeEvents, evtNamespace) {\r\n var added = false;\r\n if (listener && events && events[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(events, function (name) {\r\n if (name) {\r\n if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {\r\n added = addEventHandler(name, listener, evtNamespace) || added;\r\n }\r\n }\r\n });\r\n }\r\n return added;\r\n}\r\n/**\r\n * Bind the listener to the array of events\r\n * @param events An string array of event names to bind the listener to\r\n * @param listener The event callback to call when the event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addEventListeners(events, listener, excludeEvents, evtNamespace) {\r\n var added = false;\r\n if (listener && events && isArray(events)) {\r\n added = _addEventListeners(events, listener, excludeEvents, evtNamespace);\r\n if (!added && excludeEvents && excludeEvents[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Failed to add any listeners and we excluded some, so just attempt to add the excluded events\r\n added = _addEventListeners(events, listener, null, evtNamespace);\r\n }\r\n }\r\n return added;\r\n}\r\n/**\r\n * Remove the listener from the array of events\r\n * @param events An string array of event names to bind the listener to\r\n * @param listener The event callback to call when the event is triggered\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n */\r\nexport function removeEventListeners(events, listener, evtNamespace) {\r\n if (events && isArray(events)) {\r\n arrForEach(events, function (name) {\r\n if (name) {\r\n removeEventHandler(name, listener, evtNamespace);\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,\r\n * this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden\r\n * it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is\r\n * just navigating to a different Tab and may come back (without unloading the page). As such you may also\r\n * need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.\r\n * @param listener - The event callback to call when a page unload event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {\r\n // Hook the unload event for the document, window and body to ensure that the client events are flushed to the server\r\n // As just hooking the window does not always fire (on chrome) for page navigation's.\r\n return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);\r\n}\r\n/**\r\n * Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,\r\n * addEventListeners, addPageUnloadEventListener or addPageHideEventListener.\r\n * @param listener - The specific event callback to to be removed\r\n * @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function removePageUnloadEventListener(listener, evtNamespace) {\r\n removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);\r\n}\r\n/**\r\n * Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call\r\n * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The event callback to call when a page hide event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed\r\n * based on this namespace. This call also adds an additional unique \"pageshow\" namespace to the events\r\n * so that only the matching \"removePageHideEventListener\" can remove these events.\r\n * Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageHideEventListener(listener, excludeEvents, evtNamespace) {\r\n function _handlePageVisibility(evt) {\r\n var doc = getDocument();\r\n if (listener && doc && doc.visibilityState === \"hidden\") {\r\n listener(evt);\r\n }\r\n }\r\n // add the unique page show namespace to any provided namespace so we can only remove the ones added by \"pagehide\"\r\n var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);\r\n var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);\r\n if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {\r\n pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;\r\n }\r\n if (!pageUnloadAdded && excludeEvents) {\r\n // Failed to add any listeners and we where requested to exclude some, so just call again without excluding anything\r\n pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);\r\n }\r\n return pageUnloadAdded;\r\n}\r\n/**\r\n * Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener\r\n * as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')\r\n * @param evtNamespace - The unique namespace used when calling addPageShowEventListener\r\n */\r\nexport function removePageHideEventListener(listener, evtNamespace) {\r\n // add the unique page show namespace to any provided namespace so we only remove the ones added by \"pagehide\"\r\n var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);\r\n removeEventListeners([strPageHide], listener, newNamespaces);\r\n removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);\r\n}\r\n/**\r\n * Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call\r\n * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The event callback to call when a page is show event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely\r\n * identified and removed based on this namespace. This call also adds an additional unique \"pageshow\" namespace to the events\r\n * so that only the matching \"removePageShowEventListener\" can remove these events.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageShowEventListener(listener, excludeEvents, evtNamespace) {\r\n function _handlePageVisibility(evt) {\r\n var doc = getDocument();\r\n if (listener && doc && doc.visibilityState === \"visible\") {\r\n listener(evt);\r\n }\r\n }\r\n // add the unique page show namespace to any provided namespace so we can only remove the ones added by \"pageshow\"\r\n var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);\r\n var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);\r\n pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;\r\n if (!pageShowAdded && excludeEvents) {\r\n // Failed to add any listeners and we where requested to exclude some, so just call again without excluding anything\r\n pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);\r\n }\r\n return pageShowAdded;\r\n}\r\n/**\r\n * Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener\r\n * as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')\r\n * @param evtNamespace - The unique namespace used when calling addPageShowEventListener\r\n */\r\nexport function removePageShowEventListener(listener, evtNamespace) {\r\n // add the unique page show namespace to any provided namespace so we only remove the ones added by \"pageshow\"\r\n var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);\r\n removeEventListeners([strPageShow], listener, newNamespaces);\r\n removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);\r\n}\r\n//# sourceMappingURL=EventHelpers.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { objCreateFn, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { _DYN_LENGTH, _DYN_PUSH, _DYN_SET_ENABLED, _DYN_SUBSTR, _DYN_SUBSTRING } from \"../__DynamicConstants\";\r\nimport { _gblCookieMgr } from \"./CookieMgr\";\r\nimport { getPerformance, isIE } from \"./EnvUtils\";\r\nimport { addEventHandler, attachEvent, detachEvent } from \"./EventHelpers\";\r\nimport { arrForEach, arrIndexOf, arrMap, arrReduce, dateNow, hasOwnProperty, isArray, isBoolean, isDate, isError, isFunction, isNullOrUndefined, isNumber, isObject, isString, isTypeof, isUndefined, objDefineAccessors, objKeys, strTrim, toISOString } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { mwcRandom32, mwcRandomSeed, newId, random32, randomValue } from \"./RandomHelper\";\r\nvar _cookieMgrs = null;\r\nvar _canUseCookies; // legacy supported config\r\n// Added to help with minfication\r\nexport var Undefined = strShimUndefined;\r\nexport function newGuid() {\r\n var uuid = generateW3CId();\r\n return uuid[_DYN_SUBSTRING /* @min:%2esubstring */](0, 8) + \"-\" + uuid[_DYN_SUBSTRING /* @min:%2esubstring */](8, 12) + \"-\" + uuid[_DYN_SUBSTRING /* @min:%2esubstring */](12, 16) + \"-\" + uuid[_DYN_SUBSTRING /* @min:%2esubstring */](16, 20) + \"-\" + uuid[_DYN_SUBSTRING /* @min:%2esubstring */](20);\r\n}\r\n/**\r\n * Return the current value of the Performance Api now() function (if available) and fallback to dateNow() if it is unavailable (IE9 or less)\r\n * https://caniuse.com/#search=performance.now\r\n */\r\nexport function perfNow() {\r\n var perf = getPerformance();\r\n if (perf && perf.now) {\r\n return perf.now();\r\n }\r\n return dateNow();\r\n}\r\n/**\r\n * The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function strEndsWith(value, search) {\r\n if (value && search) {\r\n var len = value[_DYN_LENGTH /* @min:%2elength */];\r\n var start = len - search[_DYN_LENGTH /* @min:%2elength */];\r\n return value[_DYN_SUBSTRING /* @min:%2esubstring */](start >= 0 ? start : 0, len) === search;\r\n }\r\n return false;\r\n}\r\n/**\r\n * generate W3C trace id\r\n */\r\nexport function generateW3CId() {\r\n var hexValues = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\r\n // rfc4122 version 4 UUID without dashes and with lowercase letters\r\n var oct = STR_EMPTY, tmp;\r\n for (var a = 0; a < 4; a++) {\r\n tmp = random32();\r\n oct +=\r\n hexValues[tmp & 0xF] +\r\n hexValues[tmp >> 4 & 0xF] +\r\n hexValues[tmp >> 8 & 0xF] +\r\n hexValues[tmp >> 12 & 0xF] +\r\n hexValues[tmp >> 16 & 0xF] +\r\n hexValues[tmp >> 20 & 0xF] +\r\n hexValues[tmp >> 24 & 0xF] +\r\n hexValues[tmp >> 28 & 0xF];\r\n }\r\n // \"Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively\"\r\n var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];\r\n return oct[_DYN_SUBSTR /* @min:%2esubstr */](0, 8) + oct[_DYN_SUBSTR /* @min:%2esubstr */](9, 4) + \"4\" + oct[_DYN_SUBSTR /* @min:%2esubstr */](13, 3) + clockSequenceHi + oct[_DYN_SUBSTR /* @min:%2esubstr */](16, 3) + oct[_DYN_SUBSTR /* @min:%2esubstr */](19, 12);\r\n}\r\n/**\r\n * Provides a collection of utility functions, included for backward compatibility with previous releases.\r\n * @deprecated Marking this instance as deprecated in favor of direct usage of the helper functions\r\n * as direct usage provides better tree-shaking and minification by avoiding the inclusion of the unused items\r\n * in your resulting code.\r\n */\r\nexport var CoreUtils = {\r\n _canUseCookies: undefined,\r\n isTypeof: isTypeof,\r\n isUndefined: isUndefined,\r\n isNullOrUndefined: isNullOrUndefined,\r\n hasOwnProperty: hasOwnProperty,\r\n isFunction: isFunction,\r\n isObject: isObject,\r\n isDate: isDate,\r\n isArray: isArray,\r\n isError: isError,\r\n isString: isString,\r\n isNumber: isNumber,\r\n isBoolean: isBoolean,\r\n toISOString: toISOString,\r\n arrForEach: arrForEach,\r\n arrIndexOf: arrIndexOf,\r\n arrMap: arrMap,\r\n arrReduce: arrReduce,\r\n strTrim: strTrim,\r\n objCreate: objCreateFn,\r\n objKeys: objKeys,\r\n objDefineAccessors: objDefineAccessors,\r\n addEventHandler: addEventHandler,\r\n dateNow: dateNow,\r\n isIE: isIE,\r\n disableCookies: disableCookies,\r\n newGuid: newGuid,\r\n perfNow: perfNow,\r\n newId: newId,\r\n randomValue: randomValue,\r\n random32: random32,\r\n mwcRandomSeed: mwcRandomSeed,\r\n mwcRandom32: mwcRandom32,\r\n generateW3CId: generateW3CId\r\n};\r\nvar GuidRegex = /[xy]/g;\r\nexport var EventHelper = {\r\n Attach: attachEvent,\r\n AttachEvent: attachEvent,\r\n Detach: detachEvent,\r\n DetachEvent: detachEvent\r\n};\r\n/**\r\n * Helper to support backward compatibility for users that use the legacy cookie handling functions and the use the internal\r\n * CoreUtils._canUseCookies global flag to enable/disable cookies usage.\r\n * Note: This has the following deliberate side-effects\r\n * - Creates the global (legacy) cookie manager if it does not already exist\r\n * - Attempts to add \"listeners\" to the CoreUtils._canUseCookies property to support the legacy usage\r\n * @param config\r\n * @param logger\r\n * @returns\r\n */\r\nexport function _legacyCookieMgr(config, logger) {\r\n var cookieMgr = _gblCookieMgr(config, logger);\r\n var legacyCanUseCookies = CoreUtils._canUseCookies;\r\n if (_cookieMgrs === null) {\r\n _cookieMgrs = [];\r\n _canUseCookies = legacyCanUseCookies;\r\n // Dynamically create get/set property accessors for backward compatibility for enabling / disabling cookies\r\n // this WILL NOT work for ES3 browsers (< IE8)\r\n objDefineAccessors(CoreUtils, \"_canUseCookies\", function () {\r\n return _canUseCookies;\r\n }, function (value) {\r\n _canUseCookies = value;\r\n arrForEach(_cookieMgrs, function (mgr) {\r\n mgr[_DYN_SET_ENABLED /* @min:%2esetEnabled */](value);\r\n });\r\n });\r\n }\r\n if (arrIndexOf(_cookieMgrs, cookieMgr) === -1) {\r\n _cookieMgrs[_DYN_PUSH /* @min:%2epush */](cookieMgr);\r\n }\r\n if (isBoolean(legacyCanUseCookies)) {\r\n cookieMgr[_DYN_SET_ENABLED /* @min:%2esetEnabled */](legacyCanUseCookies);\r\n }\r\n if (isBoolean(_canUseCookies)) {\r\n cookieMgr[_DYN_SET_ENABLED /* @min:%2esetEnabled */](_canUseCookies);\r\n }\r\n return cookieMgr;\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().disable()\r\n * Force the SDK not to store and read any data from cookies.\r\n */\r\nexport function disableCookies() {\r\n _legacyCookieMgr()[_DYN_SET_ENABLED /* @min:%2esetEnabled */](false);\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().isEnabled()\r\n * Helper method to tell if document.cookie object is available and whether it can be used.\r\n */\r\nexport function canUseCookies(logger) {\r\n return _legacyCookieMgr(null, logger).isEnabled();\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().get()\r\n * helper method to access userId and sessionId cookie\r\n */\r\nexport function getCookie(logger, name) {\r\n return _legacyCookieMgr(null, logger).get(name);\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().set()\r\n * helper method to set userId and sessionId cookie\r\n */\r\nexport function setCookie(logger, name, value, domain) {\r\n _legacyCookieMgr(null, logger).set(name, value, null, domain);\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().del()\r\n * Deletes a cookie by setting it's expiration time in the past.\r\n * @param name - The name of the cookie to delete.\r\n */\r\nexport function deleteCookie(logger, name) {\r\n return _legacyCookieMgr(null, logger).del(name);\r\n}\r\n//# sourceMappingURL=CoreUtils.js.map","var _a;\r\n/**\r\n* Utils.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n* File containing utility functions.\r\n*/\r\nimport { addEventHandler, addPageUnloadEventListener, areCookiesSupported, arrForEach, arrIndexOf, arrMap, arrReduce, dateNow, generateW3CId, getDocument, getGlobalInst, getNavigator, getWindow, hasOwnProperty, isArray, isBeaconsSupported, isBoolean, isDate, isError, isFunction, isIE, isNullOrUndefined, isNumber, isObject, isReactNative, isString, isTypeof, isUndefined, mwcRandom32, mwcRandomSeed, newGuid, newId, objDefineAccessors, objForEachKey, objKeys, perfNow, random32, randomValue, safeGetCookieMgr, strEndsWith, strObject, strTrim, strUndefined, toISOString, uaDisallowsSameSiteNone, useXDomainRequest } from \"@microsoft/applicationinsights-core-js\";\r\nimport { ObjHasOwnProperty, objCreateFn, strShimObject, strShimPrototype } from \"@microsoft/applicationinsights-shims\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nexport var Version = '3.2.15';\r\nexport var FullVersionString = \"1DS-Web-JS-\" + Version;\r\n// Defining here so we don't need to take (import) the ApplicationInsights Common module\r\nvar strDisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nvar strWithCredentials = \"withCredentials\";\r\nvar strTimeout = \"timeout\";\r\n// If value is array just get the type for the first element\r\nvar _fieldTypeEventPropMap = (_a = {},\r\n _a[0 /* FieldValueSanitizerType.NotSet */] = 0 /* eEventPropertyType.Unspecified */,\r\n _a[2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a);\r\n/**\r\n * @ignore\r\n */\r\n// let _uaDisallowsSameSiteNone = null;\r\nvar uInt8ArraySupported = null;\r\n// var _areCookiesAvailable: boolean | undefined;\r\n/**\r\n * Checks if document object is available\r\n */\r\nexport var isDocumentObjectAvailable = Boolean(getDocument());\r\n/**\r\n * Checks if window object is available\r\n */\r\nexport var isWindowObjectAvailable = Boolean(getWindow());\r\n/**\r\n * Checks if value is assigned to the given param.\r\n * @param value - The token from which the tenant id is to be extracted.\r\n * @returns True/false denoting if value is assigned to the param.\r\n */\r\nexport function isValueAssigned(value) {\r\n /// takes a value and checks for undefined, null and empty string \r\n /// value to be tested \r\n /// true if value is null undefined or emptyString \r\n return !(value === STR_EMPTY || isNullOrUndefined(value));\r\n}\r\n/**\r\n * Gets the tenant id from the tenant token.\r\n * @param apiKey - The token from which the tenant id is to be extracted.\r\n * @returns The tenant id.\r\n */\r\nexport function getTenantId(apiKey) {\r\n if (apiKey) {\r\n var indexTenantId = apiKey.indexOf(\"-\");\r\n if (indexTenantId > -1) {\r\n return apiKey.substring(0, indexTenantId);\r\n }\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Checks if Uint8Array are available in the current environment. Safari and Firefox along with\r\n * ReactNative are known to not support Uint8Array properly.\r\n * @returns True if available, false otherwise.\r\n */\r\nexport function isUint8ArrayAvailable() {\r\n if (uInt8ArraySupported === null) {\r\n uInt8ArraySupported = !isUndefined(Uint8Array) && !isSafariOrFirefox() && !isReactNative();\r\n }\r\n return uInt8ArraySupported;\r\n}\r\n/**\r\n * Checks if the value is a valid EventLatency.\r\n * @param value - The value that needs to be checked.\r\n * @returns True if the value is in AWTEventLatency, false otherwise.\r\n */\r\nexport function isLatency(value) {\r\n if (value && isNumber(value) && value >= 1 /* EventLatencyValue.Normal */ && value <= 4 /* EventLatencyValue.Immediate */) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Sanitizes the Property. It checks the that the property name and value are valid. It also\r\n * checks/populates the correct type and pii of the property value.\r\n * @param name - property name - The property name.\r\n * @param property - The property value or an IEventProperty containing value,\r\n * type ,pii and customer content.\r\n * @returns IEventProperty containing valid name, value, pii and type or null if invalid.\r\n */\r\nexport function sanitizeProperty(name, property, stringifyObjects) {\r\n // Check that property is valid\r\n if ((!property && !isValueAssigned(property)) || typeof name !== \"string\") {\r\n return null;\r\n }\r\n // Perf optimization -- only need to get the type once not multiple times\r\n var propType = typeof property;\r\n // If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.\r\n if (propType === \"string\" || propType === \"number\" || propType === \"boolean\" || isArray(property)) {\r\n property = { value: property };\r\n }\r\n else if (propType === \"object\" && !ObjHasOwnProperty.call(property, \"value\")) {\r\n property = { value: stringifyObjects ? JSON.stringify(property) : property };\r\n }\r\n else if (isNullOrUndefined(property.value)\r\n || property.value === STR_EMPTY || (!isString(property.value)\r\n && !isNumber(property.value) && !isBoolean(property.value)\r\n && !isArray(property.value))) {\r\n // Since property is IEventProperty, we need to validate its value\r\n return null;\r\n }\r\n // We need to check that if the property value is an array, it is valid\r\n if (isArray(property.value) &&\r\n !isArrayValid(property.value)) {\r\n return null;\r\n }\r\n // If either pii or cc is set convert value to string (since only string pii/cc is allowed).\r\n // If the value is a complex type like an array that can't be converted to string we will drop\r\n // the property.\r\n if (!isNullOrUndefined(property.kind)) {\r\n if (isArray(property.value) || !isValueKind(property.kind)) {\r\n return null;\r\n }\r\n property.value = property.value.toString();\r\n }\r\n return property;\r\n}\r\nexport function getCommonSchemaMetaData(value, kind, type) {\r\n var encodedTypeValue = -1;\r\n if (!isUndefined(value)) {\r\n if (kind > 0) {\r\n if (kind === 32) {\r\n // encode customer content. Value can only be string. bit 13-16 are for cc\r\n encodedTypeValue = (1 << 13);\r\n }\r\n else if (kind <= 13) {\r\n // encode PII. Value can only be string. bits 5-12 are for Pii\r\n encodedTypeValue = (kind << 5);\r\n }\r\n }\r\n // isDataType checks that the \"type\" is a number so we don't need to check for undefined\r\n if (isDataType(type)) {\r\n // Data Type is provided and valid, so use that\r\n if (encodedTypeValue === -1) {\r\n // Don't return -1\r\n encodedTypeValue = 0;\r\n }\r\n encodedTypeValue |= type;\r\n }\r\n else {\r\n var propType = _fieldTypeEventPropMap[getFieldValueType(value)] || -1;\r\n if (encodedTypeValue !== -1 && propType !== -1) {\r\n // pii exists so we must return correct type\r\n encodedTypeValue |= propType;\r\n }\r\n else if (propType === 6 /* eEventPropertyType.Double */) {\r\n encodedTypeValue = propType;\r\n }\r\n }\r\n }\r\n return encodedTypeValue;\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().disable()\r\n * Force the SDK not to store and read any data from cookies.\r\n * Overriding the applicationinsights-core version for tree-shaking\r\n */\r\nexport function disableCookies() {\r\n safeGetCookieMgr(null).setEnabled(false);\r\n}\r\n/**\r\n * @deprecated - Use the oneDs.getCookieMgr().set()\r\n * Sets the value of a cookie.\r\n * @param name - Cookie name.\r\n * @param value - Cookie value.\r\n * @param days - Expiration days.\r\n */\r\nexport function setCookie(name, value, days) {\r\n if (areCookiesSupported(null)) {\r\n safeGetCookieMgr(null).set(name, value, days * 86400, null, \"/\");\r\n }\r\n}\r\n/**\r\n * @deprecated - Use the oneDs.getCookieMgr().del()\r\n * Deletes a cookie, by setting its expiration to -1.\r\n * @param name - Cookie name to delete.\r\n */\r\nexport function deleteCookie(name) {\r\n if (areCookiesSupported(null)) {\r\n safeGetCookieMgr(null).del(name);\r\n }\r\n}\r\n/**\r\n * @deprecated - Use the oneDs.getCookieMgr().get()\r\n * Gets the cookie value for the specified cookie.\r\n * if value is k1=v1&k2==v2 then will return 'v1' for key 'k1'\r\n * @param cookieName - Cookie name.\r\n */\r\nexport function getCookie(name) {\r\n if (areCookiesSupported(null)) {\r\n return getCookieValue(safeGetCookieMgr(null), name);\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Helper to get and decode the cookie value using decodeURIComponent, this is for historical\r\n * backward compatibility where the document.cookie value was decoded before parsing.\r\n * @param cookieMgr - The cookie manager to use\r\n * @param name - The name of the cookie to get\r\n * @param decode - A flag to indicate whether the cookie value should be decoded\r\n * @returns The decoded cookie value (if available) otherwise an empty string.\r\n */\r\nexport function getCookieValue(cookieMgr, name, decode) {\r\n if (decode === void 0) { decode = true; }\r\n var cookieValue;\r\n if (cookieMgr) {\r\n cookieValue = cookieMgr.get(name);\r\n if (decode && cookieValue && decodeURIComponent) {\r\n cookieValue = decodeURIComponent(cookieValue);\r\n }\r\n }\r\n return cookieValue || STR_EMPTY;\r\n}\r\n/**\r\n * Create a new guid.\r\n * @param style - The style of guid to generated, defaults to Digits\r\n * Digits (Default) : 32 digits separated by hyphens: 00000000-0000-0000-0000-000000000000\r\n * Braces - 32 digits separated by hyphens, enclosed in braces: {00000000-0000-0000-0000-000000000000}\r\n * Parentheses - 32 digits separated by hyphens, enclosed in parentheses: (00000000-0000-0000-0000-000000000000)\r\n * Numeric - 32 digits: 00000000000000000000000000000000\r\n * @returns The formatted guid.\r\n */\r\nexport function createGuid(style) {\r\n if (style === void 0) { style = \"D\" /* GuidStyle.Digits */; }\r\n var theGuid = newGuid();\r\n if (style === \"B\" /* GuidStyle.Braces */) {\r\n theGuid = \"{\" + theGuid + \"}\";\r\n }\r\n else if (style === \"P\" /* GuidStyle.Parentheses */) {\r\n theGuid = \"(\" + theGuid + \")\";\r\n }\r\n else if (style === \"N\" /* GuidStyle.Numeric */) {\r\n theGuid = theGuid.replace(/-/g, STR_EMPTY);\r\n }\r\n return theGuid;\r\n}\r\n/**\r\n * Pass in the objects to merge as arguments.\r\n * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.\r\n * @param obj2 - object to merge.\r\n * @param obj3 - object to merge.\r\n * @param obj4 - object to merge.\r\n * @param obj5 - object to merge.\r\n * @returns The extended object.\r\n */\r\nexport function extend(obj, obj2, obj3, obj4, obj5) {\r\n // Variables\r\n var extended = {};\r\n var deep = false;\r\n var i = 0;\r\n var length = arguments.length;\r\n var objProto = Object[strShimPrototype];\r\n var theArgs = arguments;\r\n // Check if a deep merge\r\n if (objProto.toString.call(theArgs[0]) === \"[object Boolean]\") {\r\n deep = theArgs[0];\r\n i++;\r\n }\r\n // Loop through each object and conduct a merge\r\n for (; i < length; i++) {\r\n var obj = theArgs[i];\r\n objForEachKey(obj, function (prop, value) {\r\n // If deep merge and property is an object, merge properties\r\n if (deep && value && isObject(value)) {\r\n if (isArray(value)) {\r\n extended[prop] = extended[prop] || [];\r\n arrForEach(value, function (arrayValue, arrayIndex) {\r\n if (arrayValue && isObject(arrayValue)) {\r\n extended[prop][arrayIndex] = extend(true, extended[prop][arrayIndex], arrayValue);\r\n }\r\n else {\r\n extended[prop][arrayIndex] = arrayValue;\r\n }\r\n });\r\n }\r\n else {\r\n extended[prop] = extend(true, extended[prop], value);\r\n }\r\n }\r\n else {\r\n extended[prop] = value;\r\n }\r\n });\r\n }\r\n return extended;\r\n}\r\nexport var getTime = perfNow;\r\nexport function isValueKind(value) {\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value === 0 /* eValueKind.NotSet */ || ((value > 0 /* eValueKind.NotSet */ && value <= 13 /* eValueKind.Pii_IPV4AddressLegacy */) || value === 32 /* eValueKind.CustomerContent_GenericContent */)) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isDataType(value) {\r\n // Remark: 0 returns false, but it doesn't affect encoding anyways\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value >= 0 && value <= 9) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isSafariOrFirefox() {\r\n var nav = getNavigator();\r\n // If non-browser navigator will be undefined\r\n if (!isUndefined(nav) && nav.userAgent) {\r\n var ua = nav.userAgent.toLowerCase();\r\n if ((ua.indexOf(\"safari\") >= 0 || ua.indexOf(\"firefox\") >= 0) && ua.indexOf(\"chrome\") < 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nexport function isArrayValid(value) {\r\n return value.length > 0;\r\n}\r\nexport function setProcessTelemetryTimings(event, identifier) {\r\n var evt = event;\r\n evt.timings = evt.timings || {};\r\n evt.timings.processTelemetryStart = evt.timings.processTelemetryStart || {};\r\n evt.timings.processTelemetryStart[identifier] = getTime();\r\n}\r\n/**\r\n * Returns a bitwise value for the FieldValueSanitizerType enum representing the decoded type of the passed value\r\n * @param value The value to determine the type\r\n */\r\nexport function getFieldValueType(value) {\r\n var theType = 0 /* FieldValueSanitizerType.NotSet */;\r\n if (value !== null && value !== undefined) {\r\n var objType = typeof value;\r\n if (objType === \"string\") {\r\n theType = 1 /* FieldValueSanitizerType.String */;\r\n }\r\n else if (objType === \"number\") {\r\n theType = 2 /* FieldValueSanitizerType.Number */;\r\n }\r\n else if (objType === \"boolean\") {\r\n theType = 3 /* FieldValueSanitizerType.Boolean */;\r\n }\r\n else if (objType === strShimObject) {\r\n theType = 4 /* FieldValueSanitizerType.Object */;\r\n if (isArray(value)) {\r\n theType = 4096 /* FieldValueSanitizerType.Array */;\r\n if (value.length > 0) {\r\n // Empty arrays are not supported and are considered to be the same as null\r\n theType |= getFieldValueType(value[0]);\r\n }\r\n }\r\n else if (ObjHasOwnProperty.call(value, \"value\")) {\r\n // Looks like an IEventProperty\r\n theType = 8192 /* FieldValueSanitizerType.EventProperty */ | getFieldValueType(value.value);\r\n }\r\n }\r\n }\r\n return theType;\r\n}\r\nexport var Utils = {\r\n Version: Version,\r\n FullVersionString: FullVersionString,\r\n strUndefined: strUndefined,\r\n strObject: strObject,\r\n Undefined: strUndefined,\r\n arrForEach: arrForEach,\r\n arrIndexOf: arrIndexOf,\r\n arrMap: arrMap,\r\n arrReduce: arrReduce,\r\n objKeys: objKeys,\r\n toISOString: toISOString,\r\n isReactNative: isReactNative,\r\n isString: isString,\r\n isNumber: isNumber,\r\n isBoolean: isBoolean,\r\n isFunction: isFunction,\r\n isArray: isArray,\r\n isObject: isObject,\r\n strTrim: strTrim,\r\n isDocumentObjectAvailable: isDocumentObjectAvailable,\r\n isWindowObjectAvailable: isWindowObjectAvailable,\r\n isValueAssigned: isValueAssigned,\r\n getTenantId: getTenantId,\r\n isBeaconsSupported: isBeaconsSupported,\r\n isUint8ArrayAvailable: isUint8ArrayAvailable,\r\n isLatency: isLatency,\r\n sanitizeProperty: sanitizeProperty,\r\n getISOString: toISOString,\r\n useXDomainRequest: useXDomainRequest,\r\n getCommonSchemaMetaData: getCommonSchemaMetaData,\r\n cookieAvailable: areCookiesSupported,\r\n disallowsSameSiteNone: uaDisallowsSameSiteNone,\r\n setCookie: setCookie,\r\n deleteCookie: deleteCookie,\r\n getCookie: getCookie,\r\n createGuid: createGuid,\r\n extend: extend,\r\n getTime: getTime,\r\n isValueKind: isValueKind,\r\n isArrayValid: isArrayValid,\r\n objDefineAccessors: objDefineAccessors,\r\n addPageUnloadEventListener: addPageUnloadEventListener,\r\n setProcessTelemetryTimings: setProcessTelemetryTimings,\r\n addEventHandler: addEventHandler,\r\n getFieldValueType: getFieldValueType,\r\n strEndsWith: strEndsWith,\r\n objForEachKey: objForEachKey\r\n};\r\n/**\r\n * Provides a collection of utility functions, included for backward compatibility with previous releases.\r\n * @deprecated Marking this instance as deprecated in favor of direct usage of the helper functions\r\n * as direct usage provides better tree-shaking and minification by avoiding the inclusion of the unused items\r\n * in your resulting code.\r\n * Overriding the applicationinsights-core version for tree-shaking\r\n */\r\nexport var CoreUtils = {\r\n _canUseCookies: undefined,\r\n isTypeof: isTypeof,\r\n isUndefined: isUndefined,\r\n isNullOrUndefined: isNullOrUndefined,\r\n hasOwnProperty: hasOwnProperty,\r\n isFunction: isFunction,\r\n isObject: isObject,\r\n isDate: isDate,\r\n isArray: isArray,\r\n isError: isError,\r\n isString: isString,\r\n isNumber: isNumber,\r\n isBoolean: isBoolean,\r\n toISOString: toISOString,\r\n arrForEach: arrForEach,\r\n arrIndexOf: arrIndexOf,\r\n arrMap: arrMap,\r\n arrReduce: arrReduce,\r\n strTrim: strTrim,\r\n objCreate: objCreateFn,\r\n objKeys: objKeys,\r\n objDefineAccessors: objDefineAccessors,\r\n addEventHandler: addEventHandler,\r\n dateNow: dateNow,\r\n isIE: isIE,\r\n disableCookies: disableCookies,\r\n newGuid: newGuid,\r\n perfNow: perfNow,\r\n newId: newId,\r\n randomValue: randomValue,\r\n random32: random32,\r\n mwcRandomSeed: mwcRandomSeed,\r\n mwcRandom32: mwcRandom32,\r\n generateW3CId: generateW3CId\r\n};\r\n/**\r\n * Helper to identify whether we are running in a chromium based browser environment\r\n */\r\nexport function isChromium() {\r\n return !!getGlobalInst(\"chrome\");\r\n}\r\n/**\r\n * Create and open an XMLHttpRequest object\r\n * @param method - The request method\r\n * @param urlString - The url\r\n * @param withCredentials - Option flag indicating that credentials should be sent\r\n * @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)\r\n * @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)\r\n * @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request\r\n * @returns A new opened XHR request\r\n */\r\nexport function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {\r\n if (disabled === void 0) { disabled = false; }\r\n if (isSync === void 0) { isSync = false; }\r\n function _wrapSetXhrProp(xhr, prop, value) {\r\n try {\r\n xhr[prop] = value;\r\n }\r\n catch (e) {\r\n // - Wrapping as depending on the environment setting the property may fail (non-terminally)\r\n }\r\n }\r\n var xhr = new XMLHttpRequest();\r\n if (disabled) {\r\n // Tag the instance so it's not tracked (trackDependency)\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);\r\n }\r\n if (withCredentials) {\r\n // Some libraries require that the withCredentials flag is set \"before\" open and\r\n // - Wrapping as IE 10 has started throwing when setting before open\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n xhr.open(method, urlString, !isSync);\r\n if (withCredentials) {\r\n // withCredentials should be set AFTER open (https://xhr.spec.whatwg.org/#the-withcredentials-attribute)\r\n // And older firefox instances from 11+ will throw for sync events (current versions don't) which happens during unload processing\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n // Only set the timeout for asynchronous requests as\r\n // \"Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.\"\"\r\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout\r\n if (!isSync && timeout) {\r\n _wrapSetXhrProp(xhr, strTimeout, timeout);\r\n }\r\n return xhr;\r\n}\r\n//# sourceMappingURL=Utils.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_COMPLETE, _DYN_GET_CTX, _DYN_IS_ASYNC, _DYN_IS_CHILD_EVT, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_CTX, _DYN_TIME } from \"../__DynamicConstants\";\r\nimport { dateNow, isArray, isFunction, objDefineAccessors } from \"./HelperFuncs\";\r\nimport { STR_GET_PERF_MGR, STR_PERF_EVENT } from \"./InternalConstants\";\r\nvar strExecutionContextKey = \"ctx\";\r\nvar strParentContextKey = \"ParentContextKey\";\r\nvar strChildrenContextKey = \"ChildrenContextKey\";\r\nvar _defaultPerfManager = null;\r\nvar PerfEvent = /** @class */ (function () {\r\n function PerfEvent(name, payloadDetails, isAsync) {\r\n var _self = this;\r\n var accessorDefined = false;\r\n _self.start = dateNow();\r\n _self[_DYN_NAME /* @min:%2ename */] = name;\r\n _self[_DYN_IS_ASYNC /* @min:%2eisAsync */] = isAsync;\r\n _self[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */] = function () { return false; };\r\n if (isFunction(payloadDetails)) {\r\n // Create an accessor to minimize the potential performance impact of executing the payloadDetails callback\r\n var theDetails_1;\r\n accessorDefined = objDefineAccessors(_self, \"payload\", function () {\r\n // Delay the execution of the payloadDetails until needed\r\n if (!theDetails_1 && isFunction(payloadDetails)) {\r\n theDetails_1 = payloadDetails();\r\n // clear it out now so the referenced objects can be garbage collected\r\n payloadDetails = null;\r\n }\r\n return theDetails_1;\r\n });\r\n }\r\n _self[_DYN_GET_CTX /* @min:%2egetCtx */] = function (key) {\r\n if (key) {\r\n // The parent and child links are located directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {\r\n return _self[key];\r\n }\r\n return (_self[strExecutionContextKey] || {})[key];\r\n }\r\n return null;\r\n };\r\n _self[_DYN_SET_CTX /* @min:%2esetCtx */] = function (key, value) {\r\n if (key) {\r\n // Put the parent and child links directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent[strParentContextKey]) {\r\n // Simple assumption, if we are setting a parent then we must be a child\r\n if (!_self[key]) {\r\n _self[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */] = function () { return true; };\r\n }\r\n _self[key] = value;\r\n }\r\n else if (key === PerfEvent[strChildrenContextKey]) {\r\n _self[key] = value;\r\n }\r\n else {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n }\r\n };\r\n _self[_DYN_COMPLETE /* @min:%2ecomplete */] = function () {\r\n var childTime = 0;\r\n var childEvts = _self[_DYN_GET_CTX /* @min:%2egetCtx */](PerfEvent[strChildrenContextKey]);\r\n if (isArray(childEvts)) {\r\n for (var lp = 0; lp < childEvts[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n var childEvt = childEvts[lp];\r\n if (childEvt) {\r\n childTime += childEvt[_DYN_TIME /* @min:%2etime */];\r\n }\r\n }\r\n }\r\n _self[_DYN_TIME /* @min:%2etime */] = dateNow() - _self.start;\r\n _self.exTime = _self[_DYN_TIME /* @min:%2etime */] - childTime;\r\n _self[_DYN_COMPLETE /* @min:%2ecomplete */] = function () { };\r\n if (!accessorDefined && isFunction(payloadDetails)) {\r\n // If we couldn't define the property set during complete -- to minimize the perf impact until after the time\r\n _self.payload = payloadDetails();\r\n }\r\n };\r\n }\r\n PerfEvent.ParentContextKey = \"parent\";\r\n PerfEvent.ChildrenContextKey = \"childEvts\";\r\n return PerfEvent;\r\n}());\r\nexport { PerfEvent };\r\nvar PerfManager = /** @class */ (function () {\r\n function PerfManager(manager) {\r\n /**\r\n * General bucket used for execution context set and retrieved via setCtx() and getCtx.\r\n * Defined as private so it can be visualized via the DebugPlugin\r\n */\r\n this.ctx = {};\r\n dynamicProto(PerfManager, this, function (_self) {\r\n _self.create = function (src, payloadDetails, isAsync) {\r\n // TODO (@MSNev): at some point we will want to add additional configuration to \"select\" which events to instrument\r\n // for now this is just a simple do everything.\r\n return new PerfEvent(src, payloadDetails, isAsync);\r\n };\r\n _self.fire = function (perfEvent) {\r\n if (perfEvent) {\r\n perfEvent[_DYN_COMPLETE /* @min:%2ecomplete */]();\r\n if (manager && isFunction(manager[STR_PERF_EVENT /* @min:%2eperfEvent */])) {\r\n manager[STR_PERF_EVENT /* @min:%2eperfEvent */](perfEvent);\r\n }\r\n }\r\n };\r\n _self[_DYN_SET_CTX /* @min:%2esetCtx */] = function (key, value) {\r\n if (key) {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n };\r\n _self[_DYN_GET_CTX /* @min:%2egetCtx */] = function (key) {\r\n return (_self[strExecutionContextKey] || {})[key];\r\n };\r\n });\r\n }\r\n /**\r\n * Create a new event and start timing, the manager may return null/undefined to indicate that it does not\r\n * want to monitor this source event.\r\n * @param src The source name of the event\r\n * @param payloadDetails - An optional callback function to fetch the payload details for the event.\r\n * @param isAsync - Is the event occurring from a async event\r\n */\r\n PerfManager.prototype.create = function (src, payload, isAsync) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Complete the perfEvent and fire any notifications.\r\n * @param perfEvent Fire the event which will also complete the passed event\r\n */\r\n PerfManager.prototype.fire = function (perfEvent) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Set an execution context value\r\n * @param key - The context key name\r\n * @param value - The value\r\n */\r\n PerfManager.prototype.setCtx = function (key, value) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Get the execution context value\r\n * @param key - The context key\r\n */\r\n PerfManager.prototype.getCtx = function (key) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return PerfManager;\r\n}());\r\nexport { PerfManager };\r\nvar doPerfActiveKey = \"CoreUtils.doPerf\";\r\n/**\r\n * Helper function to wrap a function with a perf event\r\n * @param mgrSource - The Performance Manager or a Performance provider source (may be null)\r\n * @param getSource - The callback to create the source name for the event (if perf monitoring is enabled)\r\n * @param func - The function to call and measure\r\n * @param details - A function to return the payload details\r\n * @param isAsync - Is the event / function being call asynchronously or synchronously\r\n */\r\nexport function doPerf(mgrSource, getSource, func, details, isAsync) {\r\n if (mgrSource) {\r\n var perfMgr = mgrSource;\r\n if (perfMgr[STR_GET_PERF_MGR]) {\r\n // Looks like a perf manager provider object\r\n perfMgr = perfMgr[STR_GET_PERF_MGR]();\r\n }\r\n if (perfMgr) {\r\n var perfEvt = void 0;\r\n var currentActive = perfMgr[_DYN_GET_CTX /* @min:%2egetCtx */](doPerfActiveKey);\r\n try {\r\n perfEvt = perfMgr.create(getSource(), details, isAsync);\r\n if (perfEvt) {\r\n if (currentActive && perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */](PerfEvent[strParentContextKey], currentActive);\r\n if (currentActive[_DYN_GET_CTX /* @min:%2egetCtx */] && currentActive[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n var children = currentActive[_DYN_GET_CTX /* @min:%2egetCtx */](PerfEvent[strChildrenContextKey]);\r\n if (!children) {\r\n children = [];\r\n currentActive[_DYN_SET_CTX /* @min:%2esetCtx */](PerfEvent[strChildrenContextKey], children);\r\n }\r\n children[_DYN_PUSH /* @min:%2epush */](perfEvt);\r\n }\r\n }\r\n // Set this event as the active event now\r\n perfMgr[_DYN_SET_CTX /* @min:%2esetCtx */](doPerfActiveKey, perfEvt);\r\n return func(perfEvt);\r\n }\r\n }\r\n catch (ex) {\r\n if (perfEvt && perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */](\"exception\", ex);\r\n }\r\n }\r\n finally {\r\n // fire the perf event\r\n if (perfEvt) {\r\n perfMgr.fire(perfEvt);\r\n }\r\n // Reset the active event to the previous value\r\n perfMgr[_DYN_SET_CTX /* @min:%2esetCtx */](doPerfActiveKey, currentActive);\r\n }\r\n }\r\n }\r\n return func();\r\n}\r\n/**\r\n * Set the global performance manager to use when there is no core instance or it has not been initialized yet.\r\n * @param perfManager - The IPerfManager instance to use when no performance manager is supplied.\r\n */\r\nexport function setGblPerfMgr(perfManager) {\r\n _defaultPerfManager = perfManager;\r\n}\r\n/**\r\n * Get the current global performance manager that will be used with no performance manager is supplied.\r\n * @returns - The current default manager\r\n */\r\nexport function getGblPerfMgr() {\r\n return _defaultPerfManager;\r\n}\r\n//# sourceMappingURL=PerfManager.js.map","import { _DYN_INDEX_OF, _DYN_LENGTH, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_SUBSTR, _DYN_TO_LOWER_CASE, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN_VERSION } from \"../__DynamicConstants\";\r\nimport { generateW3CId } from \"./CoreUtils\";\r\nimport { findMetaTag, findNamedServerTiming } from \"./EnvUtils\";\r\nimport { isArray, isString, strTrim } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n// using {0,16} for leading and trailing whitespace just to constrain the possible runtime of a random string\r\nvar TRACE_PARENT_REGEX = /^([\\da-f]{2})-([\\da-f]{32})-([\\da-f]{16})-([\\da-f]{2})(-[^\\s]{1,64})?$/i;\r\nvar DEFAULT_VERSION = \"00\";\r\nvar INVALID_VERSION = \"ff\";\r\nvar INVALID_TRACE_ID = \"00000000000000000000000000000000\";\r\nvar INVALID_SPAN_ID = \"0000000000000000\";\r\nvar SAMPLED_FLAG = 0x01;\r\nfunction _isValid(value, len, invalidValue) {\r\n if (value && value[_DYN_LENGTH /* @min:%2elength */] === len && value !== invalidValue) {\r\n return !!value.match(/^[\\da-f]*$/i);\r\n }\r\n return false;\r\n}\r\nfunction _formatValue(value, len, defValue) {\r\n if (_isValid(value, len)) {\r\n return value;\r\n }\r\n return defValue;\r\n}\r\nfunction _formatFlags(value) {\r\n if (isNaN(value) || value < 0 || value > 255) {\r\n value = 0x01;\r\n }\r\n var result = value.toString(16);\r\n while (result[_DYN_LENGTH /* @min:%2elength */] < 2) {\r\n result = \"0\" + result;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Create a new ITraceParent instance using the provided values.\r\n * @param traceId - The traceId to use, when invalid a new random W3C id will be generated.\r\n * @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.\r\n * @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid\r\n * @param version - The version to used, defaults to version \"01\" if not supplied or invalid.\r\n * @returns\r\n */\r\nexport function createTraceParent(traceId, spanId, flags, version) {\r\n var _a;\r\n return _a = {},\r\n _a[_DYN_VERSION /* @min:version */] = _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,\r\n _a[_DYN_TRACE_ID /* @min:traceId */] = isValidTraceId(traceId) ? traceId : generateW3CId(),\r\n _a.spanId = isValidSpanId(spanId) ? spanId : generateW3CId()[_DYN_SUBSTR /* @min:%2esubstr */](0, 16),\r\n _a.traceFlags = flags >= 0 && flags <= 0xFF ? flags : 1,\r\n _a;\r\n}\r\n/**\r\n * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)\r\n *\r\n * @param value - The value to be parsed\r\n * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first\r\n * @returns\r\n */\r\nexport function parseTraceParent(value, selectIdx) {\r\n var _a;\r\n if (!value) {\r\n // Don't pass a null/undefined or empty string\r\n return null;\r\n }\r\n if (isArray(value)) {\r\n // The value may have been encoded on the page into an array so handle this automatically\r\n value = value[0] || \"\";\r\n }\r\n if (!value || !isString(value) || value[_DYN_LENGTH /* @min:%2elength */] > 8192) {\r\n // limit potential processing based on total length\r\n return null;\r\n }\r\n if (value[_DYN_INDEX_OF /* @min:%2eindexOf */](\",\") !== -1) {\r\n var values = value[_DYN_SPLIT /* @min:%2esplit */](\",\");\r\n value = values[selectIdx > 0 && values[_DYN_LENGTH /* @min:%2elength */] > selectIdx ? selectIdx : 0];\r\n }\r\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\r\n var match = TRACE_PARENT_REGEX.exec(strTrim(value));\r\n if (!match || // No match\r\n match[1] === INVALID_VERSION || // version ff is forbidden\r\n match[2] === INVALID_TRACE_ID || // All zeros is considered to be invalid\r\n match[3] === INVALID_SPAN_ID) { // All zeros is considered to be invalid\r\n return null;\r\n }\r\n return _a = {\r\n version: (match[1] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n traceId: (match[2] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n spanId: (match[3] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]()\r\n },\r\n _a[_DYN_TRACE_FLAGS /* @min:traceFlags */] = parseInt(match[4], 16),\r\n _a;\r\n}\r\n/**\r\n * Is the provided W3c Trace Id a valid string representation, it must be a 32-character string\r\n * of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.\r\n * If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.\r\n * @param value - The W3c trace Id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\nexport function isValidTraceId(value) {\r\n return _isValid(value, 32, INVALID_TRACE_ID);\r\n}\r\n/**\r\n * Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character\r\n * string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.\r\n * If all characters are zero (0000000000000000) this is considered an invalid value.\r\n * @param value - The W3c span id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\nexport function isValidSpanId(value) {\r\n return _isValid(value, 16, INVALID_SPAN_ID);\r\n}\r\n/**\r\n * Validates that the provided ITraceParent instance conforms to the currently supported specifications\r\n * @param value\r\n * @returns\r\n */\r\nexport function isValidTraceParent(value) {\r\n if (!value ||\r\n !_isValid(value[_DYN_VERSION /* @min:%2eversion */], 2, INVALID_VERSION) ||\r\n !_isValid(value[_DYN_TRACE_ID /* @min:%2etraceId */], 32, INVALID_TRACE_ID) ||\r\n !_isValid(value[_DYN_SPAN_ID /* @min:%2espanId */], 16, INVALID_SPAN_ID) ||\r\n !_isValid(_formatFlags(value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]), 2)) {\r\n // Each known field must contain a valid value\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n * Is the parsed traceParent indicating that the trace is currently sampled.\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\nexport function isSampledFlag(value) {\r\n if (isValidTraceParent(value)) {\r\n return (value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] & SAMPLED_FLAG) === SAMPLED_FLAG;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Format the ITraceParent value as a string using the supported and know version formats.\r\n * So even if the passed traceParent is a later version the string value returned from this\r\n * function will convert it to only the known version formats.\r\n * This currently only supports version \"00\" and invalid \"ff\"\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\nexport function formatTraceParent(value) {\r\n if (value) {\r\n // Special Note: This only supports formatting as version 00, future versions should encode any known supported version\r\n // So parsing a future version will populate the correct version value but reformatting will reduce it to version 00.\r\n var flags = _formatFlags(value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]);\r\n if (!_isValid(flags, 2)) {\r\n flags = \"01\";\r\n }\r\n var version = value[_DYN_VERSION /* @min:%2eversion */] || DEFAULT_VERSION;\r\n if (version !== \"00\" && version !== \"ff\") {\r\n // Reduce version to \"00\"\r\n version = DEFAULT_VERSION;\r\n }\r\n // Format as version 00\r\n return \"\".concat(version.toLowerCase(), \"-\").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID).toLowerCase(), \"-\").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID).toLowerCase(), \"-\").concat(flags.toLowerCase());\r\n }\r\n return \"\";\r\n}\r\n/**\r\n * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.\r\n * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first\r\n * @returns\r\n */\r\nexport function findW3cTraceParent(selectIdx) {\r\n var name = \"traceparent\";\r\n var traceParent = parseTraceParent(findMetaTag(name), selectIdx);\r\n if (!traceParent) {\r\n traceParent = parseTraceParent(findNamedServerTiming(name), selectIdx);\r\n }\r\n return traceParent;\r\n}\r\n//# sourceMappingURL=W3cTraceParent.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { _DYN_CALL, _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_INITIALIZE, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_SPAN_ID, _DYN_TEARDOWN, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { createElmNodeData } from \"./DataCacheHelper\";\r\nimport { arrForEach, isFunction } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { isValidSpanId, isValidTraceId } from \"./W3cTraceParent\";\r\nvar pluginStateData = createElmNodeData(\"plugin\");\r\nexport function _getPluginState(plugin) {\r\n return pluginStateData.get(plugin, \"state\", {}, true);\r\n}\r\n/**\r\n * Initialize the queue of plugins\r\n * @param plugins - The array of plugins to initialize and setting of the next plugin\r\n * @param config The current config for the instance\r\n * @param core THe current core instance\r\n * @param extensions The extensions\r\n */\r\nexport function initializePlugins(processContext, extensions) {\r\n // Set the next plugin and identified the uninitialized plugins\r\n var initPlugins = [];\r\n var lastPlugin = null;\r\n var proxy = processContext[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n var pluginState;\r\n while (proxy) {\r\n var thePlugin = proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (thePlugin) {\r\n if (lastPlugin &&\r\n isFunction(lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */]) &&\r\n isFunction(thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Set this plugin as the next for the previous one\r\n lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](thePlugin);\r\n }\r\n var isInitialized = false;\r\n if (isFunction(thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */])) {\r\n isInitialized = thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]();\r\n }\r\n else {\r\n pluginState = _getPluginState(thePlugin);\r\n isInitialized = pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */];\r\n }\r\n if (!isInitialized) {\r\n initPlugins[_DYN_PUSH /* @min:%2epush */](thePlugin);\r\n }\r\n lastPlugin = thePlugin;\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n }\r\n // Now initialize the plugins\r\n arrForEach(initPlugins, function (thePlugin) {\r\n var core = processContext[STR_CORE]();\r\n thePlugin[_DYN_INITIALIZE /* @min:%2einitialize */](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n pluginState = _getPluginState(thePlugin);\r\n // Only add the core to the state if the plugin didn't set it (doesn't extent from BaseTelemetryPlugin)\r\n if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {\r\n pluginState[STR_CORE] = core;\r\n }\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = true;\r\n delete pluginState[_DYN_TEARDOWN /* @min:%2eteardown */];\r\n });\r\n}\r\nexport function sortPlugins(plugins) {\r\n // Sort by priority\r\n return plugins.sort(function (extA, extB) {\r\n var result = 0;\r\n if (extB) {\r\n var bHasProcess = isFunction(extB[STR_PROCESS_TELEMETRY]);\r\n if (isFunction(extA[STR_PROCESS_TELEMETRY])) {\r\n result = bHasProcess ? extA[STR_PRIORITY] - extB[STR_PRIORITY] : 1;\r\n }\r\n else if (bHasProcess) {\r\n result = -1;\r\n }\r\n }\r\n else {\r\n result = extA ? 1 : -1;\r\n }\r\n return result;\r\n });\r\n // sort complete\r\n}\r\n/**\r\n * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any\r\n * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.\r\n * @param components - The components you want to unload\r\n * @param unloadCtx - This is the context that should be used during unloading.\r\n * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.\r\n * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.\r\n * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.\r\n */\r\nexport function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {\r\n var idx = 0;\r\n function _doUnload() {\r\n while (idx < components[_DYN_LENGTH /* @min:%2elength */]) {\r\n var component = components[idx++];\r\n if (component) {\r\n var func = component._doUnload || component[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */];\r\n if (isFunction(func)) {\r\n if (func[_DYN_CALL /* @min:%2ecall */](component, unloadCtx, unloadState, _doUnload) === true) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return _doUnload();\r\n}\r\n/**\r\n * Creates a IDistributedTraceContext which optionally also \"sets\" the value on a parent\r\n * @param parentCtx - An optional parent distributed trace instance\r\n * @returns A new IDistributedTraceContext instance that uses an internal temporary object\r\n */\r\nexport function createDistributedTraceContext(parentCtx) {\r\n var trace = {};\r\n return {\r\n getName: function () {\r\n return trace[_DYN_NAME /* @min:%2ename */];\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace[_DYN_NAME /* @min:%2ename */] = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace[_DYN_TRACE_ID /* @min:%2etraceId */];\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace[_DYN_TRACE_ID /* @min:%2etraceId */] = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace[_DYN_SPAN_ID /* @min:%2espanId */];\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace[_DYN_SPAN_ID /* @min:%2espanId */] = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */];\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TelemetryHelpers.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { _DYN_CALL, _DYN_CONFIG, _DYN_CREATE_NEW, _DYN_DIAG_LOG, _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_IDENTIFIER, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_LOGGER, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_TEARDOWN, _DYN_UPDATE } from \"../__DynamicConstants\";\r\nimport { _throwInternal, safeGetLogger } from \"./DiagnosticLogger\";\r\nimport { dumpObj } from \"./EnvUtils\";\r\nimport { arrForEach, isArray, isFunction, isNullOrUndefined, isObject, isUndefined, objExtend, objForEachKey, objFreeze, objKeys, proxyFunctions } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_DISABLED, STR_EMPTY, STR_EXTENSION_CONFIG, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { _getPluginState } from \"./TelemetryHelpers\";\r\nvar strTelemetryPluginChain = \"TelemetryPluginChain\";\r\nvar strHasRunFlags = \"_hasRun\";\r\nvar strGetTelCtx = \"_getTelCtx\";\r\nvar _chainId = 0;\r\nfunction _getNextProxyStart(proxy, core, startAt) {\r\n while (proxy) {\r\n if (proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]() === startAt) {\r\n return proxy;\r\n }\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n // This wasn't found in the existing chain so create an isolated one with just this plugin\r\n return createTelemetryProxyChain([startAt], core[_DYN_CONFIG /* @min:%2econfig */] || {}, core);\r\n}\r\n/**\r\n * @ignore\r\n * @param telemetryChain\r\n * @param config\r\n * @param core\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n * @returns\r\n */\r\nfunction _createInternalContext(telemetryChain, config, core, startAt) {\r\n // We have a special case where we want to start execution from this specific plugin\r\n // or we simply reuse the existing telemetry plugin chain (normal execution case)\r\n var _nextProxy = null; // By Default set as no next plugin\r\n var _onComplete = [];\r\n if (startAt !== null) {\r\n // There is no next element (null) vs not defined (undefined) so use the full chain\r\n _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;\r\n }\r\n var context = {\r\n _next: _moveNext,\r\n ctx: {\r\n core: function () {\r\n return core;\r\n },\r\n diagLog: function () {\r\n return safeGetLogger(core, config);\r\n },\r\n getCfg: function () {\r\n return config;\r\n },\r\n getExtCfg: _getExtCfg,\r\n getConfig: _getConfig,\r\n hasNext: function () {\r\n return !!_nextProxy;\r\n },\r\n getNext: function () {\r\n return _nextProxy;\r\n },\r\n setNext: function (nextPlugin) {\r\n _nextProxy = nextPlugin;\r\n },\r\n iterate: _iterateChain,\r\n onComplete: _addOnComplete\r\n }\r\n };\r\n function _addOnComplete(onComplete, that) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n if (onComplete) {\r\n _onComplete[_DYN_PUSH /* @min:%2epush */]({\r\n func: onComplete,\r\n self: !isUndefined(that) ? that : context.ctx,\r\n args: args\r\n });\r\n }\r\n }\r\n function _moveNext() {\r\n var nextProxy = _nextProxy;\r\n // Automatically move to the next plugin\r\n _nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT /* @min:%2egetNext */]() : null;\r\n if (!nextProxy) {\r\n var onComplete = _onComplete;\r\n if (onComplete && onComplete[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(onComplete, function (completeDetails) {\r\n try {\r\n completeDetails.func[_DYN_CALL /* @min:%2ecall */](completeDetails.self, completeDetails.args);\r\n }\r\n catch (e) {\r\n _throwInternal(core[_DYN_LOGGER /* @min:%2elogger */], 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected Exception during onComplete - \" + dumpObj(e));\r\n }\r\n });\r\n _onComplete = [];\r\n }\r\n }\r\n return nextProxy;\r\n }\r\n function _getExtCfg(identifier, defaultValue, mergeDefault) {\r\n if (defaultValue === void 0) { defaultValue = {}; }\r\n if (mergeDefault === void 0) { mergeDefault = 0 /* GetExtCfgMergeType.None */; }\r\n var theConfig;\r\n if (config) {\r\n var extConfig = config[STR_EXTENSION_CONFIG /* @min:%2eextensionConfig */];\r\n if (extConfig && identifier) {\r\n theConfig = extConfig[identifier];\r\n }\r\n }\r\n if (!theConfig) {\r\n // Just use the defaults\r\n theConfig = defaultValue;\r\n }\r\n else if (isObject(defaultValue)) {\r\n if (mergeDefault !== 0 /* GetExtCfgMergeType.None */) {\r\n // Merge the defaults and configured values\r\n var newConfig_1 = objExtend(true, defaultValue, theConfig);\r\n if (config && mergeDefault === 2 /* GetExtCfgMergeType.MergeDefaultFromRootOrDefault */) {\r\n // Enumerate over the defaultValues and if not already populated attempt to\r\n // find a value from the root config\r\n objForEachKey(defaultValue, function (field) {\r\n // for each unspecified field, set the default value\r\n if (isNullOrUndefined(newConfig_1[field])) {\r\n var cfgValue = config[field];\r\n if (!isNullOrUndefined(cfgValue)) {\r\n newConfig_1[field] = cfgValue;\r\n }\r\n }\r\n });\r\n }\r\n theConfig = newConfig_1;\r\n }\r\n }\r\n return theConfig;\r\n }\r\n function _getConfig(identifier, field, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n var theValue;\r\n var extConfig = _getExtCfg(identifier, null);\r\n if (extConfig && !isNullOrUndefined(extConfig[field])) {\r\n theValue = extConfig[field];\r\n }\r\n else if (config && !isNullOrUndefined(config[field])) {\r\n theValue = config[field];\r\n }\r\n return !isNullOrUndefined(theValue) ? theValue : defaultValue;\r\n }\r\n function _iterateChain(cb) {\r\n // Keep processing until we reach the end of the chain\r\n var nextPlugin;\r\n while (!!(nextPlugin = context._next())) {\r\n var plugin = nextPlugin[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (plugin) {\r\n // callback with the current on\r\n cb(plugin);\r\n }\r\n }\r\n }\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryContext(telemetryChain, config, core, startAt) {\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(env) {\r\n var nextPlugin = internalContext._next();\r\n // Run the next plugin which will call \"processNext()\"\r\n nextPlugin && nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, context);\r\n return !nextPlugin;\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config, core, startAt);\r\n }\r\n return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), config, core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for handling the unloading of the chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {\r\n var config = core[_DYN_CONFIG /* @min:%2econfig */] || {};\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(unloadState) {\r\n var nextPlugin = internalContext._next();\r\n nextPlugin && nextPlugin.unload(context, unloadState);\r\n return !nextPlugin;\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config, core, startAt);\r\n }\r\n return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for updating the configuration\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {\r\n var config = core[_DYN_CONFIG /* @min:%2econfig */] || {};\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(updateState) {\r\n return context.iterate(function (plugin) {\r\n if (isFunction(plugin[_DYN_UPDATE /* @min:%2eupdate */])) {\r\n plugin[_DYN_UPDATE /* @min:%2eupdate */](context, updateState);\r\n }\r\n });\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config, core, startAt);\r\n }\r\n return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates an execution chain from the array of plugins\r\n * @param plugins - The array of plugins that will be executed in this order\r\n * @param defItemCtx - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n */\r\nexport function createTelemetryProxyChain(plugins, config, core, startAt) {\r\n var firstProxy = null;\r\n var add = startAt ? false : true;\r\n if (isArray(plugins) && plugins[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Create the proxies and wire up the next plugin chain\r\n var lastProxy_1 = null;\r\n arrForEach(plugins, function (thePlugin) {\r\n if (!add && startAt === thePlugin) {\r\n add = true;\r\n }\r\n if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Only add plugins that are processors\r\n var newProxy = createTelemetryPluginProxy(thePlugin, config, core);\r\n if (!firstProxy) {\r\n firstProxy = newProxy;\r\n }\r\n if (lastProxy_1) {\r\n // Set this new proxy as the next for the previous one\r\n lastProxy_1._setNext(newProxy);\r\n }\r\n lastProxy_1 = newProxy;\r\n }\r\n });\r\n }\r\n if (startAt && !firstProxy) {\r\n // Special case where the \"startAt\" was not in the original list of plugins\r\n return createTelemetryProxyChain([startAt], config, core);\r\n }\r\n return firstProxy;\r\n}\r\n/**\r\n * Create the processing telemetry proxy instance, the proxy is used to abstract the current plugin to allow monitoring and\r\n * execution plugins while passing around the dynamic execution state (IProcessTelemetryContext), the proxy instance no longer\r\n * contains any execution state and can be reused between requests (this was not the case for 2.7.2 and earlier with the\r\n * TelemetryPluginChain class).\r\n * @param plugin - The plugin instance to proxy\r\n * @param config - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n * @returns\r\n */\r\nexport function createTelemetryPluginProxy(plugin, config, core) {\r\n var nextProxy = null;\r\n var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */]);\r\n var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */]);\r\n var chainId;\r\n if (plugin) {\r\n chainId = plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] + \"-\" + plugin[STR_PRIORITY /* @min:%2epriority */] + \"-\" + _chainId++;\r\n }\r\n else {\r\n chainId = \"Unknown-0-\" + _chainId++;\r\n }\r\n var proxyChain = {\r\n getPlugin: function () {\r\n return plugin;\r\n },\r\n getNext: function () {\r\n return nextProxy;\r\n },\r\n processTelemetry: _processTelemetry,\r\n unload: _unloadPlugin,\r\n update: _updatePlugin,\r\n _id: chainId,\r\n _setNext: function (nextPlugin) {\r\n nextProxy = nextPlugin;\r\n }\r\n };\r\n function _getTelCtx() {\r\n var itemCtx;\r\n // Looks like a plugin didn't pass the (optional) context, so create a new one\r\n if (plugin && isFunction(plugin[strGetTelCtx])) {\r\n // This plugin extends from the BaseTelemetryPlugin so lets use it\r\n itemCtx = plugin[strGetTelCtx]();\r\n }\r\n if (!itemCtx) {\r\n // Create a temporary one\r\n itemCtx = createProcessTelemetryContext(proxyChain, config, core);\r\n }\r\n return itemCtx;\r\n }\r\n function _processChain(itemCtx, processPluginFn, name, details, isAsync) {\r\n var hasRun = false;\r\n var identifier = plugin ? plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] : strTelemetryPluginChain;\r\n var hasRunContext = itemCtx[strHasRunFlags];\r\n if (!hasRunContext) {\r\n // Assign and populate\r\n hasRunContext = itemCtx[strHasRunFlags] = {};\r\n }\r\n // Ensure that we keep the context in sync\r\n itemCtx.setNext(nextProxy);\r\n if (plugin) {\r\n doPerf(itemCtx[STR_CORE /* @min:%2ecore */](), function () { return identifier + \":\" + name; }, function () {\r\n // Mark this component as having run\r\n hasRunContext[chainId] = true;\r\n try {\r\n // Set a flag on the next plugin so we know if it was attempted to be executed\r\n var nextId = nextProxy ? nextProxy._id : STR_EMPTY;\r\n if (nextId) {\r\n hasRunContext[nextId] = false;\r\n }\r\n hasRun = processPluginFn(itemCtx);\r\n }\r\n catch (error) {\r\n var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;\r\n if (hasNextRun) {\r\n // The next plugin after us has already run so set this one as complete\r\n hasRun = true;\r\n }\r\n if (!nextProxy || !hasNextRun) {\r\n // Either we have no next plugin or the current one did not attempt to call the next plugin\r\n // Which means the current one is the root of the failure so log/report this failure\r\n _throwInternal(itemCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, \"Plugin [\" + identifier + \"] failed during \" + name + \" - \" + dumpObj(error) + \", run flags: \" + dumpObj(hasRunContext));\r\n }\r\n }\r\n }, details, isAsync);\r\n }\r\n return hasRun;\r\n }\r\n function _processTelemetry(env, itemCtx) {\r\n itemCtx = itemCtx || _getTelCtx();\r\n function _callProcessTelemetry(itemCtx) {\r\n if (!plugin || !hasProcessTelemetry) {\r\n return false;\r\n }\r\n var pluginState = _getPluginState(plugin);\r\n if (pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] || pluginState[STR_DISABLED]) {\r\n return false;\r\n }\r\n // Ensure that we keep the context in sync (for processNext()), just in case a plugin\r\n // doesn't calls processTelemetry() instead of itemContext.processNext() or some\r\n // other form of error occurred\r\n if (hasSetNext) {\r\n // Backward compatibility setting the next plugin on the instance\r\n plugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](nextProxy);\r\n }\r\n plugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, itemCtx);\r\n // Process Telemetry is expected to call itemCtx.processNext() or nextPlugin.processTelemetry()\r\n return true;\r\n }\r\n if (!_processChain(itemCtx, _callProcessTelemetry, \"processTelemetry\", function () { return ({ item: env }); }, !(env.sync))) {\r\n // The underlying plugin is either not defined, not enabled or does not have a processTelemetry implementation\r\n // so we still want the next plugin to be executed.\r\n itemCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](env);\r\n }\r\n }\r\n function _unloadPlugin(unloadCtx, unloadState) {\r\n function _callTeardown() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE /* @min:%2ecore */];\r\n // Only teardown the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */]) {\r\n // Handle plugins that don't extend from the BaseTelemetryPlugin\r\n pluginState[STR_CORE /* @min:%2ecore */] = null;\r\n pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] = true;\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = false;\r\n if (plugin[_DYN_TEARDOWN /* @min:%2eteardown */] && plugin[_DYN_TEARDOWN /* @min:%2eteardown */](unloadCtx, unloadState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(unloadCtx, _callTeardown, \"unload\", function () { }, unloadState[_DYN_IS_ASYNC /* @min:%2eisAsync */])) {\r\n // Only called if we hasRun was not true\r\n unloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);\r\n }\r\n }\r\n function _updatePlugin(updateCtx, updateState) {\r\n function _callUpdate() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE /* @min:%2ecore */];\r\n // Only update the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */]) {\r\n if (plugin[_DYN_UPDATE /* @min:%2eupdate */] && plugin[_DYN_UPDATE /* @min:%2eupdate */](updateCtx, updateState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(updateCtx, _callUpdate, \"update\", function () { }, false)) {\r\n // Only called if we hasRun was not true\r\n updateCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](updateState);\r\n }\r\n }\r\n return objFreeze(proxyChain);\r\n}\r\n/**\r\n * This class will be removed!\r\n * @deprecated use createProcessTelemetryContext() instead\r\n */\r\nvar ProcessTelemetryContext = /** @class */ (function () {\r\n /**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n */\r\n function ProcessTelemetryContext(pluginChain, config, core, startAt) {\r\n var _self = this;\r\n var context = createProcessTelemetryContext(pluginChain, config, core, startAt);\r\n // Proxy all functions of the context to this object\r\n proxyFunctions(_self, context, objKeys(context));\r\n }\r\n return ProcessTelemetryContext;\r\n}());\r\nexport { ProcessTelemetryContext };\r\n//# sourceMappingURL=ProcessTelemetryContext.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { _DYN_DIAG_LOG, _DYN_PUSH } from \"../__DynamicConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { dumpObj } from \"./EnvUtils\";\r\nimport { arrForEach } from \"./HelperFuncs\";\r\nexport function createUnloadHandlerContainer() {\r\n var handlers = [];\r\n function _addHandler(handler) {\r\n if (handler) {\r\n handlers[_DYN_PUSH /* @min:%2epush */](handler);\r\n }\r\n }\r\n function _runHandlers(unloadCtx, unloadState) {\r\n arrForEach(handlers, function (handler) {\r\n try {\r\n handler(unloadCtx, unloadState);\r\n }\r\n catch (e) {\r\n _throwInternal(unloadCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected error calling unload handler - \" + dumpObj(e));\r\n }\r\n });\r\n handlers = [];\r\n }\r\n return {\r\n add: _addHandler,\r\n run: _runHandlers\r\n };\r\n}\r\n//# sourceMappingURL=UnloadHandlerContainer.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_CREATE_NEW, _DYN_DIAG_LOG, _DYN_GET_NEXT, _DYN_GET_PROCESS_TEL_CONT0, _DYN_INITIALIZE, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_TEARDOWN, _DYN_UPDATE, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { arrForEach, isArray, isFunction, isNullOrUndefined, proxyFunctionAs, setValue } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_EXTENSION_CONFIG, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext } from \"./ProcessTelemetryContext\";\r\nimport { createUnloadHandlerContainer } from \"./UnloadHandlerContainer\";\r\nvar strGetPlugin = \"getPlugin\";\r\n/**\r\n * BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins\r\n * can avoid implementation the same set of boiler plate code as well as provide a base\r\n * implementation so that new default implementations can be added without breaking all plugins.\r\n */\r\nvar BaseTelemetryPlugin = /** @class */ (function () {\r\n function BaseTelemetryPlugin() {\r\n var _self = this; // Setting _self here as it's used outside of the dynamicProto as well\r\n // NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()\r\n var _isinitialized;\r\n var _rootCtx; // Used as the root context, holding the current config and initialized core\r\n var _nextPlugin; // Used for backward compatibility where plugins don't call the main pipeline\r\n var _unloadHandlerContainer;\r\n var _hooks;\r\n _initDefaults();\r\n dynamicProto(BaseTelemetryPlugin, _self, function (_self) {\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, core, extensions, pluginChain) {\r\n _setDefaults(config, core, pluginChain);\r\n _isinitialized = true;\r\n };\r\n _self[_DYN_TEARDOWN /* @min:%2eteardown */] = function (unloadCtx, unloadState) {\r\n var _a;\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self[STR_CORE /* @min:%2ecore */];\r\n if (!core || (unloadCtx && core !== unloadCtx[STR_CORE /* @min:%2ecore */]())) {\r\n // Do Nothing as either the plugin is not initialized or was not initialized by the current core\r\n return;\r\n }\r\n var result;\r\n var unloadDone = false;\r\n var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUnloadState = unloadState || (_a = {\r\n reason: 0 /* TelemetryUnloadReason.ManualTeardown */\r\n },\r\n _a[_DYN_IS_ASYNC /* @min:isAsync */] = false,\r\n _a);\r\n function _unloadCallback() {\r\n if (!unloadDone) {\r\n unloadDone = true;\r\n _unloadHandlerContainer.run(theUnloadCtx, unloadState);\r\n var oldHooks = _hooks;\r\n _hooks = [];\r\n // Remove all instrumentation hooks\r\n arrForEach(oldHooks, function (fn) {\r\n fn.rm();\r\n });\r\n if (result === true) {\r\n theUnloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](theUnloadState);\r\n }\r\n _initDefaults();\r\n }\r\n }\r\n if (!_self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */] || _self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {\r\n _unloadCallback();\r\n }\r\n else {\r\n // Tell the caller that we will be calling processNext()\r\n result = true;\r\n }\r\n return result;\r\n };\r\n _self[_DYN_UPDATE /* @min:%2eupdate */] = function (updateCtx, updateState) {\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self[STR_CORE /* @min:%2ecore */];\r\n if (!core || (updateCtx && core !== updateCtx[STR_CORE /* @min:%2ecore */]())) {\r\n // Do Nothing\r\n return;\r\n }\r\n var result;\r\n var updateDone = false;\r\n var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUpdateState = updateState || {\r\n reason: 0 /* TelemetryUpdateReason.Unknown */\r\n };\r\n function _updateCallback() {\r\n if (!updateDone) {\r\n updateDone = true;\r\n _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n }\r\n }\r\n if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {\r\n _updateCallback();\r\n }\r\n else {\r\n result = true;\r\n }\r\n return result;\r\n };\r\n _self._addHook = function (hooks) {\r\n if (hooks) {\r\n if (isArray(hooks)) {\r\n _hooks = _hooks.concat(hooks);\r\n }\r\n else {\r\n _hooks[_DYN_PUSH /* @min:%2epush */](hooks);\r\n }\r\n }\r\n };\r\n proxyFunctionAs(_self, \"_addUnloadCb\", function () { return _unloadHandlerContainer; }, \"add\");\r\n });\r\n // These are added after the dynamicProto so that are not moved to the prototype\r\n _self[_DYN_DIAG_LOG /* @min:%2ediagLog */] = function (itemCtx) {\r\n return _getTelCtx(itemCtx)[_DYN_DIAG_LOG /* @min:%2ediagLog */]();\r\n };\r\n _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = function () {\r\n return _isinitialized;\r\n };\r\n _self.setInitialized = function (isInitialized) {\r\n _isinitialized = isInitialized;\r\n };\r\n // _self.getNextPlugin = () => DO NOT IMPLEMENT\r\n // Sub-classes of this base class *should* not be relying on this value and instead\r\n // should use processNext() function. If you require access to the plugin use the\r\n // IProcessTelemetryContext.getNext().getPlugin() while in the pipeline, Note getNext() may return null.\r\n _self[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */] = function (next) {\r\n _nextPlugin = next;\r\n };\r\n _self[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = function (env, itemCtx) {\r\n if (itemCtx) {\r\n // Normal core execution sequence\r\n itemCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](env);\r\n }\r\n else if (_nextPlugin && isFunction(_nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Looks like backward compatibility or out of band processing. And as it looks\r\n // like a ITelemetryPlugin or ITelemetryPluginChain, just call processTelemetry\r\n _nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, null);\r\n }\r\n };\r\n _self._getTelCtx = _getTelCtx;\r\n function _getTelCtx(currentCtx) {\r\n if (currentCtx === void 0) { currentCtx = null; }\r\n var itemCtx = currentCtx;\r\n if (!itemCtx) {\r\n var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self[STR_CORE /* @min:%2ecore */]);\r\n // tslint:disable-next-line: prefer-conditional-expression\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // Looks like a chain object\r\n itemCtx = rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](null, _nextPlugin[strGetPlugin]);\r\n }\r\n else {\r\n itemCtx = rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](null, _nextPlugin);\r\n }\r\n }\r\n return itemCtx;\r\n }\r\n function _setDefaults(config, core, pluginChain) {\r\n if (config) {\r\n // Make sure the extensionConfig exists\r\n setValue(config, STR_EXTENSION_CONFIG, [], null, isNullOrUndefined);\r\n }\r\n if (!pluginChain && core) {\r\n // Get the first plugin from the core\r\n pluginChain = core[_DYN_GET_PROCESS_TEL_CONT0 /* @min:%2egetProcessTelContext */]()[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n var nextPlugin = _nextPlugin;\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // If it looks like a proxy/chain then get the plugin\r\n nextPlugin = _nextPlugin[strGetPlugin]();\r\n }\r\n // Support legacy plugins where core was defined as a property\r\n _self[STR_CORE /* @min:%2ecore */] = core;\r\n _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);\r\n }\r\n function _initDefaults() {\r\n _isinitialized = false;\r\n _self[STR_CORE /* @min:%2ecore */] = null;\r\n _rootCtx = null;\r\n _nextPlugin = null;\r\n _hooks = [];\r\n _unloadHandlerContainer = createUnloadHandlerContainer();\r\n }\r\n }\r\n BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and\r\n * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further\r\n * processTelemetry calls are ignored and it just calls the processNext() with the provided context.\r\n * @param unloadCtx - This is the context that should be used during unloading.\r\n * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.\r\n * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.\r\n */\r\n BaseTelemetryPlugin.prototype.teardown = function (unloadCtx, unloadState) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * The the plugin should re-evaluate configuration and update any cached configuration settings.\r\n * @param updateCtx - This is the context that should be used during updating.\r\n * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.\r\n * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.\r\n */\r\n BaseTelemetryPlugin.prototype.update = function (updateCtx, updateState) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add an unload handler that will be called when the SDK is being unloaded\r\n * @param handler - the handler\r\n */\r\n BaseTelemetryPlugin.prototype._addUnloadCb = function (handler) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add this hook so that it is automatically removed during unloading\r\n * @param hooks - The single hook or an array of IInstrumentHook objects\r\n */\r\n BaseTelemetryPlugin.prototype._addHook = function (hooks) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return BaseTelemetryPlugin;\r\n}());\r\nexport { BaseTelemetryPlugin };\r\n//# sourceMappingURL=BaseTelemetryPlugin.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { deepFreeze, objForEachKey } from \"../JavaScriptSDK/HelperFuncs\";\r\n/**\r\n * Create an enum style object which has both the key => value and value => key mappings\r\n * @param values - The values to populate on the new object\r\n * @returns\r\n */\r\nexport function createEnumStyle(values) {\r\n var enumClass = {};\r\n objForEachKey(values, function (field, value) {\r\n enumClass[field] = value;\r\n enumClass[value] = field;\r\n });\r\n return deepFreeze(enumClass);\r\n}\r\n/**\r\n * Create a 2 index map that maps an enum's key as both the key and value, X[\"key\"] => \"key\" and X[0] => \"keyof 0\".\r\n * @param values - The values to populate on the new object\r\n * @returns\r\n */\r\nexport function createEnumMap(values) {\r\n var mapClass = {};\r\n objForEachKey(values, function (field, value) {\r\n mapClass[field] = field;\r\n mapClass[value] = field;\r\n });\r\n return deepFreeze(mapClass);\r\n}\r\n/**\r\n * Create a 2 index map that maps an enum's key and value to the defined map value, X[\"key\"] => mapValue and X[0] => mapValue.\r\n * Generic values\r\n * - E = the const enum type (typeof eRequestHeaders);\r\n * - V = Identifies the valid values for the keys, this should include both the enum numeric and string key of the type. The\r\n * resulting \"Value\" of each entry identifies the valid values withing the assignments.\r\n * @param values - The values to populate on the new object\r\n * @returns\r\n */\r\nexport function createValueMap(values) {\r\n var mapClass = {};\r\n objForEachKey(values, function (field, value) {\r\n mapClass[field] = value[1];\r\n mapClass[value[0]] = value[1];\r\n });\r\n return deepFreeze(mapClass);\r\n}\r\n//# sourceMappingURL=EnumHelperFuncs.js.map","/**\r\n* TelemetryContext.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\n// @skip-file-minify - Skip attempting to minify this file\r\nimport { createValueMap } from \"@microsoft/applicationinsights-core-js\";\r\nimport { STR_BROWSER, STR_BROWSER_VER, STR_DEVICE, STR_EVENT_FLAGS, STR_LOCALE, STR_NAME, STR_POP_SAMPLE, STR_SERVICE_NAME, STR_VER } from \"./InternalConstants\";\r\nexport var Extensions = createValueMap({\r\n UserExt: [0 /* eExtensions.UserExt */, \"user\"],\r\n DeviceExt: [1 /* eExtensions.DeviceExt */, STR_DEVICE],\r\n TraceExt: [2 /* eExtensions.TraceExt */, \"trace\"],\r\n WebExt: [3 /* eExtensions.WebExt */, \"web\"],\r\n AppExt: [4 /* eExtensions.AppExt */, \"app\"],\r\n OSExt: [5 /* eExtensions.OSExt */, \"os\"],\r\n SdkExt: [6 /* eExtensions.SdkExt */, \"sdk\"],\r\n IntWebExt: [7 /* eExtensions.IntWebExt */, \"intweb\"],\r\n UtcExt: [8 /* eExtensions.UtcExt */, \"utc\"],\r\n LocExt: [9 /* eExtensions.LocExt */, \"loc\"],\r\n CloudExt: [10 /* eExtensions.CloudExt */, \"cloud\"],\r\n DtExt: [11 /* eExtensions.DtExt */, \"dt\"]\r\n});\r\nexport var AppExtensionKeys = createValueMap({\r\n id: [0 /* eAppExtensionKeys.id */, \"id\"],\r\n ver: [1 /* eAppExtensionKeys.ver */, STR_VER],\r\n appName: [2 /* eAppExtensionKeys.appName */, STR_NAME],\r\n locale: [3 /* eAppExtensionKeys.locale */, STR_LOCALE],\r\n expId: [4 /* eAppExtensionKeys.expId */, \"expId\"],\r\n env: [5 /* eAppExtensionKeys.env */, \"env\"]\r\n});\r\nexport var WebExtensionKeys = createValueMap({\r\n domain: [0 /* eWebExtensionKeys.domain */, \"domain\"],\r\n browser: [1 /* eWebExtensionKeys.browser */, STR_BROWSER],\r\n browserVer: [2 /* eWebExtensionKeys.browserVer */, STR_BROWSER_VER],\r\n screenRes: [3 /* eWebExtensionKeys.screenRes */, \"screenRes\"],\r\n userConsent: [4 /* eWebExtensionKeys.userConsent */, \"userConsent\"],\r\n consentDetails: [5 /* eWebExtensionKeys.consentDetails */, \"consentDetails\"]\r\n});\r\nexport var UserExtensionKeys = createValueMap({\r\n locale: [0 /* eUserExtensionKeys.locale */, STR_LOCALE],\r\n localId: [1 /* eUserExtensionKeys.localId */, \"localId\"],\r\n id: [2 /* eUserExtensionKeys.id */, \"id\"]\r\n});\r\nexport var OSExtKeys = createValueMap({\r\n osName: [0 /* eOSExtKeys.osName */, STR_NAME],\r\n ver: [1 /* eOSExtKeys.ver */, STR_VER]\r\n});\r\nexport var SDKExtKeys = createValueMap({\r\n ver: [0 /* eSDKExtKeys.ver */, STR_VER],\r\n seq: [1 /* eSDKExtKeys.seq */, \"seq\"],\r\n installId: [2 /* eSDKExtKeys.installId */, \"installId\"],\r\n epoch: [3 /* eSDKExtKeys.epoch */, \"epoch\"]\r\n});\r\nexport var IntWebExtKeys = createValueMap({\r\n msfpc: [0 /* eIntWebExtKeys.msfpc */, \"msfpc\"],\r\n anid: [1 /* eIntWebExtKeys.anid */, \"anid\"],\r\n serviceName: [2 /* eIntWebExtKeys.serviceName */, STR_SERVICE_NAME]\r\n});\r\nexport var UtcExtKeys = createValueMap({\r\n popSample: [0 /* eUtcExtKeys.popSample */, STR_POP_SAMPLE],\r\n eventFlags: [1 /* eUtcExtKeys.eventFlags */, STR_EVENT_FLAGS]\r\n});\r\nexport var LocExtKeys = createValueMap({\r\n tz: [0 /* eLocExtKeys.tz */, \"tz\"]\r\n});\r\nexport var SessionExtKeys = createValueMap({\r\n sessionId: [0 /* eSessionExtKeys.sessionId */, \"sesId\"]\r\n});\r\nexport var DeviceExtKeys = createValueMap({\r\n localId: [0 /* eDeviceExtKeys.localId */, \"localId\"],\r\n deviceClass: [1 /* eDeviceExtKeys.deviceClass */, \"deviceClass\"],\r\n make: [2 /* eDeviceExtKeys.make */, \"make\"],\r\n model: [3 /* eDeviceExtKeys.model */, \"model\"]\r\n});\r\nexport var CloudExtKeys = createValueMap({\r\n role: [0 /* eCloudExtKeys.role */, \"role\"],\r\n roleInstance: [1 /* eCloudExtKeys.roleInstance */, \"roleInstance\"],\r\n roleVer: [2 /* eCloudExtKeys.roleVer */, \"roleVer\"]\r\n});\r\nexport var TraceExtKeys = createValueMap({\r\n traceId: [0 /* eTraceExtKeys.traceId */, \"traceID\"],\r\n traceName: [1 /* eTraceExtKeys.traceName */, STR_NAME],\r\n parentId: [2 /* eTraceExtKeys.parentId */, \"parentID\"]\r\n});\r\nexport var DistributedTraceExtKeys = createValueMap({\r\n traceId: [0 /* eDistributedTraceExtKeys.traceId */, \"traceId\"],\r\n spanId: [1 /* eDistributedTraceExtKeys.spanId */, \"spanId\"],\r\n traceFlags: [2 /* eDistributedTraceExtKeys.traceFlags */, \"traceFlags\"]\r\n});\r\n//# sourceMappingURL=ExtensionKeys.js.map","/**\r\n* Session.ts\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isString, objDefineAccessors } from \"@microsoft/1ds-core-js\";\r\nfunction _getId() {\r\n return this.getId();\r\n}\r\nfunction _setId(id) {\r\n this.setId(id);\r\n}\r\nvar Session = /** @class */ (function () {\r\n function Session() {\r\n dynamicProto(Session, this, function (_self) {\r\n _self.setId = function (id) {\r\n _self.customId = id;\r\n };\r\n _self.getId = function () {\r\n if (isString(_self.customId)) {\r\n return _self.customId;\r\n }\r\n else {\r\n return _self.automaticId;\r\n }\r\n };\r\n });\r\n }\r\n Session.prototype.setId = function (id) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n Session.prototype.getId = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n Session._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n objDefineAccessors(Session.prototype, \"id\", _getId, _setId);\r\n })();\r\n return Session;\r\n}());\r\nexport { Session };\r\n//# sourceMappingURL=Session.js.map","/**\r\n* SessionManager.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _throwInternal, createGuid, isBoolean, isFunction, isUndefined, newId, safeGetCookieMgr, safeGetLogger } from \"@microsoft/1ds-core-js\";\r\nimport { canUseLocalStorage, getStorage, setStorage } from \"./Utils\";\r\nimport { Session } from \"./context/Session\";\r\nvar cookieNameConst = \"ai_session\";\r\nvar SessionManager = /** @class */ (function () {\r\n function SessionManager(core, propConfig) {\r\n var _cookieUpdatedTimestamp;\r\n var _logger = safeGetLogger(core);\r\n var cookieMgr = safeGetCookieMgr(core);\r\n var _storageNamePrefix;\r\n dynamicProto(SessionManager, this, function (_self) {\r\n var functionalConfig = getDefaultConfig(propConfig);\r\n if (!isFunction(propConfig.sessionExpirationMs)) {\r\n functionalConfig.sessionExpirationMs = function () { return SessionManager.acquisitionSpan; };\r\n }\r\n if (!isFunction(propConfig.sessionRenewalMs)) {\r\n functionalConfig.sessionRenewalMs = function () { return SessionManager.renewalSpan; };\r\n }\r\n _self.config = functionalConfig;\r\n _storageNamePrefix = function () { return _self.config.namePrefix && _self.config.namePrefix() ? cookieNameConst + _self.config.namePrefix() : cookieNameConst; };\r\n _self.automaticSession = new Session();\r\n _self.update = function () {\r\n if (!_self.automaticSession.getId()) {\r\n _initializeAutomaticSession();\r\n }\r\n var autoSession = _self.automaticSession;\r\n var config = _self.config;\r\n var now = new Date().getTime();\r\n var acquisitionExpired = now - autoSession.acquisitionDate > config.sessionExpirationMs();\r\n var renewalExpired = now - autoSession.renewalDate > config.sessionRenewalMs();\r\n // renew if acquisitionSpan or renewalSpan has ellapsed\r\n if (acquisitionExpired || renewalExpired) {\r\n // update automaticSession so session state has correct id\r\n _renew();\r\n }\r\n else {\r\n // do not update the cookie more often than cookieUpdateInterval\r\n var cookieUpdatedTimestamp = _cookieUpdatedTimestamp;\r\n if (!cookieUpdatedTimestamp || now - cookieUpdatedTimestamp > SessionManager.cookieUpdateInterval) {\r\n autoSession.renewalDate = now;\r\n _setCookie(autoSession.getId(), autoSession.acquisitionDate, autoSession.renewalDate);\r\n }\r\n }\r\n };\r\n _self.backup = function () {\r\n var automaticSession = _self.automaticSession;\r\n _setStorage(automaticSession.getId(), automaticSession.acquisitionDate, automaticSession.renewalDate);\r\n };\r\n /**\r\n * @ignore\r\n * Create functional configs if value is provided, else SessionManager provides the defaults\r\n * @param config - Property configuration\r\n */\r\n function getDefaultConfig(config) {\r\n return {\r\n sessionRenewalMs: config.sessionRenewalMs && (function () { return config.sessionRenewalMs; }),\r\n sessionExpirationMs: config.sessionExpirationMs && (function () { return config.sessionExpirationMs; }),\r\n cookieDomain: config.cookieDomain && (function () { return config.cookieDomain; }),\r\n namePrefix: config.namePrefix && (function () { return config.namePrefix; }),\r\n sessionAsGuid: (function () { return config.sessionAsGuid; }),\r\n idLength: (function () { return config.idLength ? config.idLength : 22; })\r\n };\r\n }\r\n /**\r\n * @ignore\r\n * Use config.namePrefix + ai_session cookie data or local storage data (when the cookie is unavailable) to\r\n * initialize the automatic session.\r\n */\r\n function _initializeAutomaticSession() {\r\n var cookie = cookieMgr.get(_storageNamePrefix());\r\n if (cookie && isFunction(cookie.split)) {\r\n _initializeAutomaticSessionWithData(cookie);\r\n }\r\n else {\r\n // There's no cookie, but we might have session data in local storage\r\n // This can happen if the session expired or the user actively deleted the cookie\r\n // We only want to recover data if the cookie is missing from expiry. We should respect the user's wishes if the cookie was deleted actively.\r\n // The User class handles this for us and deletes our local storage object if the persistent user cookie was removed.\r\n var storage = getStorage(_logger, _storageNamePrefix());\r\n if (storage) {\r\n _initializeAutomaticSessionWithData(storage);\r\n }\r\n }\r\n if (!_self.automaticSession.getId()) {\r\n _renew();\r\n }\r\n }\r\n /**\r\n * @ignore\r\n * Extract id, aquisitionDate, and renewalDate from an ai_session payload string and\r\n * use this data to initialize automaticSession.\r\n *\r\n * @param sessionData - The string stored in an ai_session cookie or local storage backup\r\n */\r\n function _initializeAutomaticSessionWithData(sessionData) {\r\n var automaticSession = _self.automaticSession;\r\n var params = sessionData.split(\"|\");\r\n if (params.length > 0) {\r\n automaticSession.setId(params[0]);\r\n }\r\n try {\r\n if (params.length > 1) {\r\n var acq = +params[1];\r\n automaticSession.acquisitionDate = +new Date(acq);\r\n automaticSession.acquisitionDate = automaticSession.acquisitionDate > 0 ? automaticSession.acquisitionDate : 0;\r\n }\r\n if (params.length > 2) {\r\n var renewal = +params[2];\r\n automaticSession.renewalDate = +new Date(renewal);\r\n automaticSession.renewalDate = automaticSession.renewalDate > 0 ? automaticSession.renewalDate : 0;\r\n }\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 510 /* _eExtendedInternalMessageId.ErrorParsingAISessionCookie */, \"Error parsing ai_session cookie, session will be reset: \" + e);\r\n }\r\n if (automaticSession.renewalDate === 0) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 517 /* _eExtendedInternalMessageId.SessionRenewalDateIsZero */, \"AI session renewal date is 0, session will be reset.\");\r\n }\r\n }\r\n function _renew() {\r\n var automaticSession = _self.automaticSession;\r\n var now = new Date().getTime();\r\n var sessionAsGuid = _self.config.sessionAsGuid();\r\n if (!isUndefined(sessionAsGuid) && sessionAsGuid) {\r\n if (!isBoolean(sessionAsGuid)) {\r\n automaticSession.setId(createGuid(sessionAsGuid));\r\n }\r\n else {\r\n automaticSession.setId(createGuid());\r\n }\r\n }\r\n else {\r\n automaticSession.setId(newId((functionalConfig && functionalConfig.idLength) ? functionalConfig.idLength() : 22));\r\n }\r\n automaticSession.acquisitionDate = now;\r\n automaticSession.renewalDate = now;\r\n _setCookie(automaticSession.getId(), automaticSession.acquisitionDate, automaticSession.renewalDate);\r\n // If this browser does not support local storage, fire an internal log to keep track of it at this point\r\n if (!canUseLocalStorage()) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 505 /* _eExtendedInternalMessageId.BrowserDoesNotSupportLocalStorage */, \"Browser does not support local storage. Session durations will be inaccurate.\");\r\n }\r\n }\r\n function _setCookie(guid, acq, renewal) {\r\n // Set cookie to expire after the session expiry time passes or the session renewal deadline, whichever is sooner\r\n // Expiring the cookie will cause the session to expire even if the user isn't on the page\r\n var acquisitionExpiry = acq + _self.config.sessionExpirationMs();\r\n var renewalExpiry = renewal + _self.config.sessionRenewalMs();\r\n var cookieExpiry = new Date();\r\n var cookie = [guid, acq, renewal];\r\n if (acquisitionExpiry < renewalExpiry) {\r\n cookieExpiry.setTime(acquisitionExpiry);\r\n }\r\n else {\r\n cookieExpiry.setTime(renewalExpiry);\r\n }\r\n var cookieDomain = _self.config.cookieDomain ? _self.config.cookieDomain() : null;\r\n cookieMgr.set(_storageNamePrefix(), cookie.join(\"|\") + \";expires=\" + cookieExpiry.toUTCString(), null, cookieDomain);\r\n _cookieUpdatedTimestamp = new Date().getTime();\r\n }\r\n function _setStorage(guid, acq, renewal) {\r\n // Keep data in local storage to retain the last session id, allowing us to cleanly end the session when it expires\r\n // Browsers that don't support local storage won't be able to end sessions cleanly from the client\r\n // The server will notice this and end the sessions itself, with loss of accurate session duration\r\n setStorage(_logger, _storageNamePrefix(), [guid, acq, renewal].join(\"|\"));\r\n }\r\n });\r\n }\r\n SessionManager.prototype.update = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Record the current state of the automatic session and store it in our cookie string format\r\n * into the browser's local storage. This is used to restore the session data when the cookie\r\n * expires.\r\n */\r\n SessionManager.prototype.backup = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n SessionManager.acquisitionSpan = 86400000; // 24 hours in ms\r\n SessionManager.renewalSpan = 1800000; // 30 minutes in ms\r\n SessionManager.cookieUpdateInterval = 60000; // 1 minute in ms\r\n return SessionManager;\r\n}());\r\nexport { SessionManager };\r\n//# sourceMappingURL=SessionManager.js.map","/**\r\n* Application.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, getDocument, hasDocument, objDefineAccessors, safeGetCookieMgr } from \"@microsoft/1ds-core-js\";\r\nexport var defaultFlightIdNameSpaces = [\r\n \"AX\",\r\n \"EX\",\r\n \"SF\",\r\n \"CS\",\r\n \"CF\",\r\n \"CT\",\r\n \"CU\",\r\n \"DC\",\r\n \"DF\",\r\n \"H5\",\r\n \"HL\",\r\n \"WS\",\r\n \"WP\" // WINDOWSPHONE\r\n];\r\n/// Validate each flight id in appExpId against the app flight ID\r\n/// format and create a comma seperated appExpId with valid flight ids.Ignore invalid flight IDs< /summary>\r\n/// A list of comma seperated appExpId\r\n/// none\r\nfunction _validateAppExpId(appExpIdNew, flightIdNameSpaces) {\r\n if (flightIdNameSpaces === void 0) { flightIdNameSpaces = defaultFlightIdNameSpaces; }\r\n var appExpId = null;\r\n if (appExpIdNew) {\r\n var expIdArray = appExpIdNew.split(\",\");\r\n for (var i = 0; i < expIdArray.length; i++) {\r\n if (_isValidAppFlightId(expIdArray[i], flightIdNameSpaces)) {\r\n if (!appExpId) {\r\n appExpId = expIdArray[i];\r\n }\r\n else {\r\n appExpId += \",\" + expIdArray[i];\r\n }\r\n }\r\n else {\r\n // this._traceLogger.w('Unsupported flight id format for this app expId: ' + expIdArray[i]);\r\n }\r\n }\r\n }\r\n return appExpId;\r\n}\r\n/// Verify an expId against the CS2.1 spec\r\n/// expId to verify in string format\r\n/// true if expId is valid, false otherwise\r\nfunction _isValidAppFlightId(appFlightId, flightIdNameSpaces) {\r\n if (flightIdNameSpaces === void 0) { flightIdNameSpaces = defaultFlightIdNameSpaces; }\r\n if (!appFlightId || appFlightId.length < 4) {\r\n return false;\r\n }\r\n var isValid = false;\r\n var MAXFLIGHTIDLENGTH = 256;\r\n var curNameSpace = (appFlightId.substring(0, 3)).toString().toUpperCase();\r\n // The prefix check must include ':', else strings starting with prefixes will slip through\r\n for (var i = 0; i < flightIdNameSpaces.length; i++) {\r\n if (flightIdNameSpaces[i] + \":\" === curNameSpace && appFlightId.length <= MAXFLIGHTIDLENGTH) {\r\n isValid = true;\r\n break;\r\n }\r\n }\r\n return isValid;\r\n}\r\nfunction _getExpId() {\r\n return this.getExpId();\r\n}\r\nvar Application = /** @class */ (function () {\r\n function Application(propertiesConfig, core) {\r\n var _appExpId = null;\r\n // Create a copy of the defaultNamespaces\r\n var flightIdNameSpaces = defaultFlightIdNameSpaces.slice(0);\r\n var expIdCookieName = \"Treatments\";\r\n var _cookieMgr = safeGetCookieMgr(core);\r\n var _propertiesConfig = propertiesConfig;\r\n dynamicProto(Application, this, function (_self) {\r\n // Add app language\r\n if (hasDocument()) {\r\n var documentElement = getDocument().documentElement;\r\n if (documentElement) {\r\n _self.locale = documentElement.lang;\r\n }\r\n }\r\n _self.env = propertiesConfig.env ? propertiesConfig.env : _getMetaDataFromDOM(\"awa-\")[\"env\"];\r\n _self.getExpId = function () {\r\n return _propertiesConfig.expId ? _readExpIdFromCoreData(_propertiesConfig.expId) : _readExpIdFromCookie();\r\n };\r\n /**\r\n * Retrieve a specified metadata tag value from the DOM.\r\n * @param prefix - Prefix to search the metatags with.\r\n * @returns Metadata collection/property bag\r\n */\r\n function _getMetaDataFromDOM(prefix) {\r\n var metaElements;\r\n var metaData = {};\r\n var doc = getDocument();\r\n if (doc) {\r\n metaElements = doc && doc.querySelectorAll(\"meta\");\r\n for (var i = 0; i < metaElements.length; i++) {\r\n var meta = metaElements[i];\r\n if (meta.name) {\r\n var mt = meta.name.toLowerCase();\r\n if (mt.indexOf(prefix) === 0) {\r\n var name = meta.name.replace(prefix, \"\");\r\n metaData[name] = meta.content;\r\n }\r\n }\r\n }\r\n }\r\n return metaData;\r\n }\r\n /// Validate each flight id in appExpId against the app flight ID\r\n /// format and create a comma seperated appExpId with valid flight ids.Ignore invalid flight IDs< /summary>\r\n /// A list of comma seperated appExpId\r\n /// none\r\n function _setAppExpId(appExpIdNew) {\r\n if (appExpIdNew === _appExpId) {\r\n return; // Nothing to do if seen before\r\n }\r\n // Reset to empty first. The new but invalid appExpId should not be logged and we cannot leave the old one hanging around\r\n // since it means old experiment id cannot represent the new experiment with an invalid appExpId.\r\n _appExpId = _validateAppExpId(appExpIdNew, flightIdNameSpaces);\r\n }\r\n function _readExpIdFromCookie() {\r\n var cookieValue = getCookieValue(_cookieMgr, expIdCookieName);\r\n _setAppExpId(cookieValue);\r\n return _appExpId;\r\n }\r\n function _readExpIdFromCoreData(expId) {\r\n _setAppExpId(expId);\r\n return _appExpId;\r\n }\r\n });\r\n }\r\n /**\r\n * The application experiment Id.\r\n */\r\n Application.prototype.getExpId = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /// Validate each flight id in appExpId against the app flight ID\r\n /// format and create a comma seperated appExpId with valid flight ids.Ignore invalid flight IDs< /summary>\r\n /// A list of comma seperated appExpId\r\n /// none\r\n /**\r\n * Validate each flight id in appExpId against the app flight ID format and create\r\n * a comma seperated appExpId with valid flight ids.Ignore invalid flight IDs\r\n * @param appExpId - The current experiment id\r\n * @param appExpIdNew - The new experiment id to set (if valid)\r\n * @param flightIdNameSpaces - The valid set of flight id names\r\n * @returns The validated experiment id,\r\n */\r\n Application.validateAppExpId = _validateAppExpId;\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n Application._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n objDefineAccessors(Application.prototype, \"expId\", _getExpId);\r\n })();\r\n return Application;\r\n}());\r\nexport { Application };\r\n//# sourceMappingURL=Application.js.map","/**\r\n* Cloud.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2020\r\n*/\r\nvar Cloud = /** @class */ (function () {\r\n function Cloud() {\r\n }\r\n return Cloud;\r\n}());\r\nexport { Cloud };\r\n//# sourceMappingURL=Cloud.js.map","/**\r\n* Device.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nvar Device = /** @class */ (function () {\r\n function Device() {\r\n }\r\n return Device;\r\n}());\r\nexport { Device };\r\n//# sourceMappingURL=Device.js.map","/**\r\n* IntWeb.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, objDefineAccessors, safeGetCookieMgr } from \"@microsoft/1ds-core-js\";\r\nfunction _getMsfpc() {\r\n return this.getMsfpc();\r\n}\r\nfunction _getAnid() {\r\n return this.getAnid();\r\n}\r\nvar IntWeb = /** @class */ (function () {\r\n function IntWeb(propertiesConfig, core) {\r\n var _cookieMgr = safeGetCookieMgr(core);\r\n dynamicProto(IntWeb, this, function (_self) {\r\n if (propertiesConfig.serviceName) {\r\n _self.serviceName = propertiesConfig.serviceName;\r\n }\r\n _self.getMsfpc = function () {\r\n return getCookieValue(_cookieMgr, \"MSFPC\");\r\n };\r\n _self.getAnid = function () {\r\n return getCookieValue(_cookieMgr, \"ANON\").slice(0, 34);\r\n };\r\n });\r\n }\r\n /**\r\n * Anonymous visitor Id in hosting domain.\r\n */\r\n IntWeb.prototype.getMsfpc = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * ANON - MSA Anonymous ID.\r\n */\r\n IntWeb.prototype.getAnid = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n IntWeb._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n var proto = IntWeb.prototype;\r\n objDefineAccessors(proto, \"msfpc\", _getMsfpc);\r\n objDefineAccessors(proto, \"anid\", _getAnid);\r\n })();\r\n return IntWeb;\r\n}());\r\nexport { IntWeb };\r\n//# sourceMappingURL=IntWeb.js.map","/**\r\n* Loc.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nvar Loc = /** @class */ (function () {\r\n function Loc() {\r\n // Add time zone\r\n var timeZone = new Date().getTimezoneOffset();\r\n var minutes = timeZone % 60;\r\n var hours = (timeZone - minutes) / 60;\r\n var timeZonePrefix = \"+\";\r\n if (hours > 0) {\r\n timeZonePrefix = \"-\";\r\n }\r\n hours = Math.abs(hours);\r\n minutes = Math.abs(minutes);\r\n this.tz = timeZonePrefix + (hours < 10 ? \"0\" + hours : hours.toString()) + \":\"\r\n + (minutes < 10 ? \"0\" + minutes : minutes.toString());\r\n }\r\n return Loc;\r\n}());\r\nexport { Loc };\r\n//# sourceMappingURL=Loc.js.map","/**\r\n* OperatingSystem.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport { getNavigator, isString } from \"@microsoft/1ds-core-js\";\r\nvar OSNAMEREGEX = {\r\n WIN: /(windows|win32)/i,\r\n WINRT: / arm;/i,\r\n WINPHONE: /windows\\sphone\\s\\d+\\.\\d+/i,\r\n OSX: /(macintosh|mac os x)/i,\r\n IOS: /(ipad|iphone|ipod)(?=.*like mac os x)/i,\r\n LINUX: /(linux|joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)/i,\r\n ANDROID: /android/i,\r\n CROS: /CrOS/i\r\n};\r\nvar VERSION_MAPPINGS = {\r\n \"5.1\": \"XP\",\r\n \"6.0\": \"Vista\",\r\n \"6.1\": \"7\",\r\n \"6.2\": \"8\",\r\n \"6.3\": \"8.1\",\r\n \"10.0\": \"10\"\r\n};\r\nvar REGEX_VERSION = \"([\\\\d,.]+)\";\r\nvar REGEX_VERSION_MAC = \"([\\\\d,_,.]+)\";\r\nvar UNKNOWN = \"Unknown\";\r\nvar OSNAMES = [\r\n { r: OSNAMEREGEX.WINPHONE, os: \"Windows Phone\" },\r\n { r: OSNAMEREGEX.WINRT, os: \"Windows RT\" },\r\n { r: OSNAMEREGEX.WIN, os: \"Windows\" /* OPERATING_SYSTEMS.WINDOWS */ },\r\n { r: OSNAMEREGEX.IOS, os: \"iOS\" /* OPERATING_SYSTEMS.IOS */ },\r\n { r: OSNAMEREGEX.ANDROID, os: \"Android\" /* OPERATING_SYSTEMS.ANDROID */ },\r\n { r: OSNAMEREGEX.LINUX, os: \"Linux\" },\r\n { r: OSNAMEREGEX.CROS, os: \"Chrome OS\" },\r\n { s: \"x11\", os: \"Unix\" },\r\n { s: \"blackberry\", os: \"BlackBerry\" },\r\n { s: \"symbian\", os: \"Symbian\" },\r\n { s: \"nokia\", os: \"Nokia\" },\r\n { r: OSNAMEREGEX.OSX, os: \"Mac OS X\" /* OPERATING_SYSTEMS.MACOSX */ }\r\n];\r\nfunction _getOsName(lowerCaseUserAgent) {\r\n for (var lp = 0; lp < OSNAMES.length; lp++) {\r\n var match = OSNAMES[lp];\r\n if (match.r && lowerCaseUserAgent.match(match.r)) {\r\n return match.os;\r\n }\r\n else if (match.s && lowerCaseUserAgent.indexOf(match.s) !== -1) {\r\n return match.os;\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getOsVersion(userAgent, osName) {\r\n if (osName === \"Windows\" /* OPERATING_SYSTEMS.WINDOWS */) {\r\n return _getGenericOsVersion(userAgent, \"Windows NT\");\r\n }\r\n if (osName === \"Android\" /* OPERATING_SYSTEMS.ANDROID */) {\r\n return _getGenericOsVersion(userAgent, osName);\r\n }\r\n if (osName === \"Mac OS X\" /* OPERATING_SYSTEMS.MACOSX */) {\r\n return _getMacOsxVersion(userAgent);\r\n }\r\n if (osName === \"iOS\" /* OPERATING_SYSTEMS.IOS */) {\r\n return _getIosVersion(userAgent);\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getGenericOsVersion(userAgent, osName) {\r\n var ntVersionMatches = userAgent.match(new RegExp(osName + \" \" + REGEX_VERSION));\r\n if (ntVersionMatches) {\r\n if (VERSION_MAPPINGS[ntVersionMatches[1]]) {\r\n return VERSION_MAPPINGS[ntVersionMatches[1]];\r\n }\r\n return ntVersionMatches[1];\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getMacOsxVersion(userAgent) {\r\n var macOsxVersionInUserAgentMatches = userAgent.match(new RegExp(\"Mac OS X\" /* OPERATING_SYSTEMS.MACOSX */ + \" \" + REGEX_VERSION_MAC));\r\n if (macOsxVersionInUserAgentMatches) {\r\n var versionString = macOsxVersionInUserAgentMatches[1].replace(/_/g, \".\");\r\n if (versionString) {\r\n var delimiter = _getDelimiter(versionString);\r\n if (delimiter) {\r\n var components = versionString.split(delimiter);\r\n return components[0];\r\n }\r\n else {\r\n return versionString;\r\n }\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getIosVersion(userAgent) {\r\n var iosVersionInUserAgentMatches = userAgent.match(new RegExp(\"OS \" + REGEX_VERSION_MAC));\r\n if (iosVersionInUserAgentMatches) {\r\n var versionString = iosVersionInUserAgentMatches[1].replace(/_/g, \".\");\r\n if (versionString) {\r\n var delimiter = _getDelimiter(versionString);\r\n if (delimiter) {\r\n var components = versionString.split(delimiter);\r\n return components[0];\r\n }\r\n else {\r\n return versionString;\r\n }\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getDelimiter(versionString) {\r\n if (versionString.indexOf(\".\") > -1) {\r\n return \".\";\r\n }\r\n if (versionString.indexOf(\"_\") > -1) {\r\n return \"_\";\r\n }\r\n return null;\r\n}\r\nvar OperatingSystem = /** @class */ (function () {\r\n function OperatingSystem(propertiesConfig) {\r\n if (propertiesConfig.populateOperatingSystemInfo) {\r\n var self_1 = this;\r\n var theNav = getNavigator() || {};\r\n var userAgent = propertiesConfig.userAgent || theNav.userAgent || \"\";\r\n var userAgentData = propertiesConfig.userAgentData || theNav.userAgentData || {};\r\n if (userAgent) {\r\n var osName = _getOsName(userAgent.toLowerCase());\r\n self_1.name = osName;\r\n self_1.ver = _getOsVersion(userAgent, osName);\r\n }\r\n if ((!self_1.name || self_1.name === UNKNOWN) && isString(userAgentData.platform)) {\r\n self_1.name = userAgentData.platform;\r\n }\r\n }\r\n }\r\n return OperatingSystem;\r\n}());\r\nexport { OperatingSystem };\r\n//# sourceMappingURL=OperatingSystem.js.map","/**\r\n* Sdk.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, newGuid, random32, safeGetCookieMgr } from \"@microsoft/1ds-core-js\";\r\nvar DEVICE_ID_COOKIE = \"MicrosoftApplicationsTelemetryDeviceId\";\r\nfunction _saveData(mgr, propertyStorage, name, value) {\r\n if (propertyStorage) {\r\n propertyStorage.setProperty(name, value);\r\n }\r\n else {\r\n // Expires in 365 days (365 * 24 * 60 * 60)\r\n mgr.set(name, value, 31536000);\r\n }\r\n}\r\nfunction _getData(mgr, propertyStorage, name) {\r\n if (propertyStorage) {\r\n return propertyStorage.getProperty(name) || \"\";\r\n }\r\n return getCookieValue(mgr, name);\r\n}\r\nvar Sdk = /** @class */ (function () {\r\n function Sdk(coreConfig, core) {\r\n var _sequenceId = 0;\r\n dynamicProto(Sdk, this, function (_self) {\r\n var propertyStorage = coreConfig.propertyStorageOverride;\r\n // Start sequence\r\n _self.seq = _sequenceId;\r\n _self.epoch = random32(false).toString();\r\n var mgr = safeGetCookieMgr(core, coreConfig);\r\n if (mgr.isEnabled() || propertyStorage) {\r\n // Only collect device id if it can be stored\r\n var deviceId = _getData(mgr, propertyStorage, DEVICE_ID_COOKIE);\r\n if (!deviceId) {\r\n deviceId = newGuid();\r\n }\r\n _saveData(mgr, propertyStorage, DEVICE_ID_COOKIE, deviceId);\r\n _self.installId = deviceId;\r\n }\r\n else {\r\n mgr.purge(DEVICE_ID_COOKIE);\r\n }\r\n _self.getSequenceId = function () {\r\n return ++_sequenceId;\r\n };\r\n });\r\n }\r\n // Get seq value\r\n Sdk.prototype.getSequenceId = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return -1;\r\n };\r\n return Sdk;\r\n}());\r\nexport { Sdk };\r\n//# sourceMappingURL=Sdk.js.map","/**\r\n* AITrace.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport { generateW3CId, getLocation } from \"@microsoft/1ds-core-js\";\r\nvar Trace = /** @class */ (function () {\r\n function Trace(propertiesConfig, id, parentId, name) {\r\n var self = this;\r\n self.traceId = id || generateW3CId();\r\n if (propertiesConfig.enableDistributedTracing && !parentId) {\r\n // When dt is enabled, both the traceId and spanId are required\r\n parentId = generateW3CId().substring(0, 16);\r\n }\r\n self.parentId = parentId;\r\n if (propertiesConfig.enableApplicationInsightsTrace) {\r\n self.name = name;\r\n var loc = getLocation();\r\n if (loc && loc.pathname) {\r\n self.name = loc.pathname;\r\n }\r\n }\r\n }\r\n return Trace;\r\n}());\r\nexport { Trace };\r\n//# sourceMappingURL=Trace.js.map","/**\r\n* User.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, getISOString, isUndefined, newId, objDefineAccessors, safeGetCookieMgr } from \"@microsoft/1ds-core-js\";\r\nvar strSetLocalId = \"setLocalId\";\r\nfunction _getLocalId() {\r\n return this.getLocalId();\r\n}\r\nfunction _setLocalId(value) {\r\n this[strSetLocalId](value);\r\n}\r\nvar User = /** @class */ (function () {\r\n function User(coreConfig, propertiesConfig, core) {\r\n var _propertiesConfig = propertiesConfig;\r\n var _customLocalId;\r\n var _cookieMgr = safeGetCookieMgr(core, coreConfig);\r\n dynamicProto(User, this, function (_self) {\r\n // Add MUID in user localId\r\n if (_cookieMgr && _cookieMgr.isEnabled()) {\r\n _populateMuidFromCookie();\r\n if (_propertiesConfig.enableApplicationInsightsUser) {\r\n // get userId or create new one if none exists\r\n var aiUser = getCookieValue(_cookieMgr, User.userCookieName);\r\n if (aiUser) {\r\n var params = aiUser.split(User.cookieSeparator);\r\n if (params.length > 0) {\r\n _self.id = params[0];\r\n }\r\n }\r\n if (!_self.id) {\r\n _self.id = newId((coreConfig && !isUndefined(coreConfig.idLength)) ? coreConfig.idLength : 22);\r\n var acqStr = getISOString(new Date());\r\n _self.accountAcquisitionDate = acqStr;\r\n // without expiration, cookies expire at the end of the session\r\n // set it to 365 days from now\r\n // 365 * 24 * 60 * 60 * 1000 = 31536000\r\n var newCookie = [_self.id, acqStr];\r\n var cookieDomain = _propertiesConfig.cookieDomain ? _propertiesConfig.cookieDomain : undefined;\r\n _cookieMgr.set(User.userCookieName, newCookie.join(User.cookieSeparator), 31536000, cookieDomain);\r\n }\r\n }\r\n }\r\n // Add user language\r\n if (typeof navigator !== \"undefined\") {\r\n var nav = navigator;\r\n _self.locale = nav.userLanguage || nav.language;\r\n }\r\n _self.getLocalId = function () {\r\n if (_customLocalId) {\r\n return _customLocalId;\r\n }\r\n return _populateMuidFromCookie();\r\n };\r\n _self[strSetLocalId] = function (value) {\r\n _customLocalId = value;\r\n };\r\n function _populateMuidFromCookie() {\r\n // Only add default local ID is hash or drop config are not enabled\r\n if (!_propertiesConfig.hashIdentifiers && !_propertiesConfig.dropIdentifiers) {\r\n var muidValue = getCookieValue(_cookieMgr, \"MUID\");\r\n if (muidValue) {\r\n _customLocalId = \"t:\" + muidValue;\r\n }\r\n }\r\n return _customLocalId;\r\n }\r\n });\r\n }\r\n /**\r\n * The userId as known by the logging library.\r\n */\r\n User.prototype.getLocalId = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return undefined;\r\n };\r\n User.prototype.setLocalId = function (value) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n User.cookieSeparator = \"|\";\r\n User.userCookieName = \"ai_user\";\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n User._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n objDefineAccessors(User.prototype, \"localId\", _getLocalId, _setLocalId);\r\n })();\r\n return User;\r\n}());\r\nexport { User };\r\n//# sourceMappingURL=User.js.map","/**\r\n* Utc.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\n/**\r\n * See details {@link https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events | here}.\r\n * Client has hashed or dropped any PII information in the event. Vortex will hash any server-supplied PII fields such\r\n * as PUID or Global Device ID. This value is used to populate the `ext.utc.eventFlags`.\r\n * See https://1dsdocs.azurewebsites.net/schema/PartA/utc.html#eventflags and\r\n * further details https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events.\r\n */\r\nexport var HASH_IDENTIFIERS_FLAG = 0x100000;\r\n/**\r\n * See details {@link https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events | here}.\r\n * Client has dropped any PII information in the event. Information contained within attached MSA token will not be inserted.\r\n * This value is used to populate the `ext.utc.eventFlags`.\r\n * See https://1dsdocs.azurewebsites.net/schema/PartA/utc.html#eventflags and\r\n * further details https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events.\r\n */\r\nexport var DROP_IDENTIFIERS_FLAG = 0x200000;\r\n/**\r\n * See details {@link https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events | here}. Collector to scrub `ext.ingest.clientIp`\r\n * field stamped server-side. This takes precedence over both Hash Identifier and Drop Identifier flags above, so as long as this bit is set,\r\n * the client IP will be scrubbed as \"xxx.xxx.xxx.*\" for IPv4 and will not be dropped. The main use case for this flag is Interchange customers\r\n * that need to use OriginalMessage feature but wish not to have IP info in Geneva data store. For more details on this scenario, please see link\r\n * here: {@link https://eng.ms/docs/products/geneva/connectors/asimov_to_geneva/management#default-commonschema | 1DS Interchange Default CommonSchema }\r\n * See also {@link https://www.osgwiki.com/wiki/CommonSchema/flags | CommonSchema/flags}\r\n * @since 3.2.11\r\n */\r\nexport var SCRUB_IP_FLAG = 0x400000;\r\nvar Utc = /** @class */ (function () {\r\n function Utc(propertiesConfig) {\r\n var self = this;\r\n self.popSample = 100;\r\n self.eventFlags = 0;\r\n if (propertiesConfig.hashIdentifiers) {\r\n self.eventFlags = self.eventFlags | HASH_IDENTIFIERS_FLAG;\r\n }\r\n if (propertiesConfig.dropIdentifiers) {\r\n self.eventFlags = self.eventFlags | DROP_IDENTIFIERS_FLAG;\r\n }\r\n if (propertiesConfig.scrubIpOnly) {\r\n // set value when user didn't set values\r\n self.eventFlags = self.eventFlags | SCRUB_IP_FLAG;\r\n }\r\n }\r\n return Utc;\r\n}());\r\nexport { Utc };\r\n//# sourceMappingURL=Utc.js.map","/**\r\n* Web.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, getLocation, getNavigator, getWindow, isArray, objDefineAccessors, safeGetCookieMgr, isUndefined } from \"@microsoft/1ds-core-js\";\r\nvar USER_CONSENT_DETAILS = [\r\n \"Required\", \"Analytics\", \"SocialMedia\", \"Advertising\"\r\n];\r\nvar REGEX_VERSION = \"([\\\\d,.]+)\";\r\nvar UNKNOWN = \"Unknown\";\r\nvar EDGE_CHROMIUM = \"Edg/\";\r\nvar USER_AGENTS = [\r\n { ua: \"OPR/\", b: \"Opera\" /* BROWSERS.OPERA */ },\r\n { ua: \"PhantomJS\" /* BROWSERS.PHANTOMJS */, b: \"PhantomJS\" /* BROWSERS.PHANTOMJS */ },\r\n { ua: \"Edge\" /* BROWSERS.EDGE */, b: \"Edge\" /* BROWSERS.EDGE */ },\r\n { ua: EDGE_CHROMIUM, b: \"Edge\" /* BROWSERS.EDGE */ },\r\n { ua: \"Electron\" /* BROWSERS.ELECTRON */, b: \"Electron\" /* BROWSERS.ELECTRON */ },\r\n { ua: \"Chrome\" /* BROWSERS.CHROME */, b: \"Chrome\" /* BROWSERS.CHROME */ },\r\n { ua: \"Trident\", b: \"MSIE\" /* BROWSERS.MSIE */ },\r\n { ua: \"MSIE \", b: \"MSIE\" /* BROWSERS.MSIE */ },\r\n { ua: \"Firefox\" /* BROWSERS.FIREFOX */, b: \"Firefox\" /* BROWSERS.FIREFOX */ },\r\n { ua: \"Safari\" /* BROWSERS.SAFARI */, b: \"Safari\" /* BROWSERS.SAFARI */ },\r\n { ua: \"SkypeShell\" /* BROWSERS.SKYPE_SHELL */, b: \"SkypeShell\" /* BROWSERS.SKYPE_SHELL */ } // Check for Skype shell\r\n];\r\nvar BRANDS = [\r\n { br: \"Microsoft Edge\", b: \"Edge\" /* BROWSERS.EDGE */ },\r\n { br: \"Google Chrome\", b: \"Chrome\" /* BROWSERS.CHROME */ },\r\n { br: \"Opera\", b: \"Opera\" /* BROWSERS.OPERA */ }\r\n];\r\nfunction _userAgentContainsString(searchString, userAgent) {\r\n return userAgent.indexOf(searchString) > -1;\r\n}\r\nfunction _getBrandVersion(match, brands) {\r\n for (var lp = 0; lp < brands.length; lp++) {\r\n if (match == brands[lp].brand) {\r\n return brands[lp].version;\r\n }\r\n }\r\n return null;\r\n}\r\nfunction _getBrowserName(userAgent) {\r\n if (userAgent) {\r\n for (var lp = 0; lp < USER_AGENTS.length; lp++) {\r\n var ua = USER_AGENTS[lp].ua;\r\n if (_userAgentContainsString(ua, userAgent)) {\r\n return USER_AGENTS[lp].b;\r\n }\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getBrowserVersion(userAgent, browserName) {\r\n if (browserName === \"MSIE\" /* BROWSERS.MSIE */) {\r\n return _getIeVersion(userAgent);\r\n }\r\n return _getOtherVersion(browserName, userAgent);\r\n}\r\nfunction _getIeVersion(userAgent) {\r\n var classicIeVersionMatches = userAgent.match(new RegExp(\"MSIE\" /* BROWSERS.MSIE */ + \" \" + REGEX_VERSION));\r\n if (classicIeVersionMatches) {\r\n return classicIeVersionMatches[1];\r\n }\r\n var ieVersionMatches = userAgent.match(new RegExp(\"rv:\" + REGEX_VERSION));\r\n if (ieVersionMatches) {\r\n return ieVersionMatches[1];\r\n }\r\n}\r\nfunction _getOtherVersion(browserString, userAgent) {\r\n if (browserString === \"Safari\" /* BROWSERS.SAFARI */) {\r\n browserString = \"Version\";\r\n }\r\n else if (browserString === \"Edge\" /* BROWSERS.EDGE */) {\r\n if (_userAgentContainsString(EDGE_CHROMIUM, userAgent)) {\r\n browserString = \"Edg\";\r\n }\r\n }\r\n var matches = userAgent.match(new RegExp(browserString + \"/\" + REGEX_VERSION));\r\n if (matches) {\r\n return matches[1];\r\n }\r\n if (browserString === \"Opera\" /* BROWSERS.OPERA */) {\r\n matches = userAgent.match(new RegExp(\"OPR/\" + REGEX_VERSION));\r\n if (matches) {\r\n return matches[1];\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\n/**\r\n* Get Screen resolution\r\n* @returns {ScreenResolution} - Screen resolution\r\n*/\r\nfunction _getScreenResolution() {\r\n var screenRes = { h: 0, w: 0 };\r\n var win = getWindow();\r\n if (win && win.screen) {\r\n screenRes.h = screen.height;\r\n screenRes.w = screen.width;\r\n }\r\n return screenRes;\r\n}\r\nfunction _getUserConsent() {\r\n return this.getUserConsent();\r\n}\r\nvar Web = /** @class */ (function () {\r\n function Web(propertiesConfig, core) {\r\n var _cookieMgr = safeGetCookieMgr(core);\r\n var _propertiesConfig = propertiesConfig || {};\r\n dynamicProto(Web, this, function (_self) {\r\n // Add the domain\r\n var windowLocation = getLocation();\r\n if (windowLocation) {\r\n var domain = windowLocation.hostname;\r\n if (domain) {\r\n _self.domain = windowLocation.protocol === \"file:\" ? \"local\" : domain;\r\n }\r\n }\r\n if (_propertiesConfig.populateBrowserInfo) {\r\n var userAgent = _propertiesConfig.userAgent;\r\n var userAgentBrands = (_propertiesConfig.userAgentData || {}).brands;\r\n var theNav = getNavigator();\r\n if (theNav) {\r\n userAgent = userAgent || theNav.userAgent || \"\";\r\n userAgentBrands = userAgentBrands || (theNav.userAgentData || {}).brands;\r\n }\r\n _parseUserAgent(userAgent, userAgentBrands);\r\n var screenRes = _getScreenResolution();\r\n _self.screenRes = screenRes.w + \"X\" + screenRes.h;\r\n }\r\n // Only set if the configuration was provided\r\n if (!isUndefined(_propertiesConfig.gpcDataSharingOptIn)) {\r\n _self.gpcDataSharingOptIn = _propertiesConfig.gpcDataSharingOptIn;\r\n }\r\n else {\r\n _self.gpcDataSharingOptIn = null;\r\n }\r\n _self.getUserConsent = function () {\r\n return _propertiesConfig.userConsented || (getCookieValue(_cookieMgr, _propertiesConfig.userConsentCookieName || \"MSCC\") ? true : false);\r\n };\r\n /**\r\n *\r\n ** Function to retrieve user consent details.\r\n * @param callback - Callback function to get user consent details\r\n * @returns IUserContentDetails stringified object\r\n */\r\n _self.getUserConsentDetails = function () {\r\n var consentDetails = null;\r\n try {\r\n var callback = _propertiesConfig.callback;\r\n if (callback && callback.userConsentDetails) {\r\n var result = callback.userConsentDetails();\r\n if (result) {\r\n if (_propertiesConfig.disableConsentDetailsSanitize) {\r\n consentDetails = result;\r\n }\r\n else {\r\n consentDetails = {};\r\n }\r\n // Apply default values if missing\r\n for (var lp = 0; lp < USER_CONSENT_DETAILS.length; lp++) {\r\n var key = USER_CONSENT_DETAILS[lp];\r\n consentDetails[key] = result[key] || false;\r\n }\r\n }\r\n }\r\n var gpcDataSharingOption = _self.gpcDataSharingOptIn;\r\n // Only set if the configuration was provided\r\n if (gpcDataSharingOption !== null) {\r\n consentDetails = consentDetails || {};\r\n consentDetails.GPC_DataSharingOptIn = !!gpcDataSharingOption;\r\n }\r\n return consentDetails ? JSON.stringify(consentDetails) : null;\r\n }\r\n catch (e) {\r\n // Unexpected - Just making sure we don't crash\r\n }\r\n };\r\n function _parseUserAgent(userAgent, userAgentBrands) {\r\n if (isArray(userAgentBrands)) {\r\n try {\r\n // Go through the ordered list of \"known\" brands and use the first matching value\r\n for (var lp = 0; lp < BRANDS.length; lp++) {\r\n var version = _getBrandVersion(BRANDS[lp].br, userAgentBrands);\r\n if (version) {\r\n _self.browser = BRANDS[lp].b;\r\n _self.browserVer = version;\r\n return;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Unexpected - Just making sure we don't crash\r\n }\r\n }\r\n if (userAgent) {\r\n var browserName = _getBrowserName(userAgent);\r\n _self.browser = browserName;\r\n _self.browserVer = _getBrowserVersion(userAgent, browserName);\r\n }\r\n }\r\n // Remap this get userContext for this instance\r\n objDefineAccessors(_self, \"userConsent\", _self.getUserConsent);\r\n });\r\n }\r\n /**\r\n * Describes whether the user has given consent for Cookies.\r\n * This is configurable by users to define which cookie to look for marking this flag as true or false.\r\n */\r\n Web.prototype.getUserConsent = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Function to retrieve user consent details.\r\n * @param callback - Callback function to get user consent details\r\n * @returns IUserContentDetails stringified object\r\n */\r\n Web.prototype.getUserConsentDetails = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n Web._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n objDefineAccessors(Web.prototype, \"userConsent\", _getUserConsent);\r\n })();\r\n return Web;\r\n}());\r\nexport { Web };\r\n//# sourceMappingURL=Web.js.map","/**\r\n* TelemetryContext.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isBoolean, isNullOrUndefined, isNumber, isString, isValidSpanId, isValidTraceId, objForEachKey } from \"@microsoft/1ds-core-js\";\r\nimport { AppExtensionKeys, CloudExtKeys, DeviceExtKeys, DistributedTraceExtKeys, Extensions, IntWebExtKeys, LocExtKeys, OSExtKeys, SDKExtKeys, SessionExtKeys, TraceExtKeys, UserExtensionKeys, UtcExtKeys, WebExtensionKeys } from \"./ExtensionKeys\";\r\nimport { SessionManager } from \"./SessionManager\";\r\nimport { Application } from \"./context/Application\";\r\nimport { Cloud } from \"./context/Cloud\";\r\nimport { Device } from \"./context/Device\";\r\nimport { IntWeb } from \"./context/IntWeb\";\r\nimport { Loc } from \"./context/Loc\";\r\nimport { OperatingSystem } from \"./context/OperatingSystem\";\r\nimport { Sdk } from \"./context/Sdk\";\r\nimport { Session } from \"./context/Session\";\r\nimport { Trace } from \"./context/Trace\";\r\nimport { User } from \"./context/User\";\r\nimport { Utc } from \"./context/Utc\";\r\nimport { Web } from \"./context/Web\";\r\nfunction _applyExtValues(extension, event, names, map, overwriteTarget) {\r\n var target = event.ext[Extensions[extension]];\r\n if (target) {\r\n try {\r\n objForEachKey(map, function (field, value) {\r\n if (isString(value) || isNumber(value) || isBoolean(value)) {\r\n var targetValue = target[names[field]];\r\n if (!overwriteTarget && (targetValue || isString(targetValue) || isNumber(targetValue) || isBoolean(targetValue))) {\r\n value = targetValue;\r\n }\r\n target[names[field]] = value;\r\n }\r\n });\r\n }\r\n catch (e) {\r\n // During unload some accesses may cause a TypeError due to accessing a dead object\r\n }\r\n }\r\n return target;\r\n}\r\nvar TelemetryContext = /** @class */ (function () {\r\n function TelemetryContext(coreConfig, propertiesConfig, core) {\r\n dynamicProto(TelemetryContext, this, function (_self) {\r\n _self.app = new Application(propertiesConfig, core);\r\n _self.cloud = new Cloud();\r\n _self.user = new User(coreConfig, propertiesConfig, core);\r\n _self.os = new OperatingSystem(propertiesConfig);\r\n _self.web = new Web(propertiesConfig, core);\r\n var _sdk = new Sdk(coreConfig, core);\r\n var _intWeb = new IntWeb(propertiesConfig, core);\r\n var _utc = new Utc(propertiesConfig);\r\n _self.loc = new Loc();\r\n _self.device = new Device();\r\n var _sessionManager = new SessionManager(core, propertiesConfig);\r\n _self.session = new Session();\r\n var _distributedTraceCtx = createDistributedTraceContextFromTraceCtx(new Trace(propertiesConfig), _getTraceCtx());\r\n var _overwriteEventPartA = !(propertiesConfig || {}).eventContainExtFields;\r\n function _getSessionId() {\r\n var session = _self.session;\r\n if (session && isString(session.customId)) {\r\n return session.customId;\r\n }\r\n _sessionManager.update();\r\n var autoSession = _sessionManager.automaticSession;\r\n if (autoSession) {\r\n var autoId = autoSession.getId();\r\n if (autoId && isString(autoId)) {\r\n session.automaticId = autoId;\r\n }\r\n }\r\n return session.automaticId;\r\n }\r\n _self.getTraceCtx = function () {\r\n return _distributedTraceCtx;\r\n };\r\n _self.getSessionId = _getSessionId;\r\n _self.applyApplicationContext = function (event) {\r\n var _a;\r\n var app = _self.app;\r\n _applyExtValues(4 /* eExtensions.AppExt */, event, AppExtensionKeys, (_a = {},\r\n _a[0 /* eAppExtensionKeys.id */] = app.id,\r\n _a[1 /* eAppExtensionKeys.ver */] = app.ver,\r\n _a[2 /* eAppExtensionKeys.appName */] = app.name,\r\n _a[3 /* eAppExtensionKeys.locale */] = app.locale,\r\n _a[4 /* eAppExtensionKeys.expId */] = app.getExpId(),\r\n _a[5 /* eAppExtensionKeys.env */] = app.env,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyUserContext = function (event) {\r\n var _a;\r\n var user = _self.user;\r\n _applyExtValues(0 /* eExtensions.UserExt */, event, UserExtensionKeys, (_a = {},\r\n _a[1 /* eUserExtensionKeys.localId */] = user.getLocalId(),\r\n _a[0 /* eUserExtensionKeys.locale */] = user.locale,\r\n _a[2 /* eUserExtensionKeys.id */] = user.id,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyWebContext = function (event) {\r\n var _a;\r\n var web = _self.web;\r\n _applyExtValues(3 /* eExtensions.WebExt */, event, WebExtensionKeys, (_a = {},\r\n _a[0 /* eWebExtensionKeys.domain */] = web.domain,\r\n _a[1 /* eWebExtensionKeys.browser */] = web.browser,\r\n _a[2 /* eWebExtensionKeys.browserVer */] = web.browserVer,\r\n _a[3 /* eWebExtensionKeys.screenRes */] = web.screenRes,\r\n _a[5 /* eWebExtensionKeys.consentDetails */] = web.getUserConsentDetails(),\r\n _a[4 /* eWebExtensionKeys.userConsent */] = web.getUserConsent(),\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyOsContext = function (event) {\r\n var _a;\r\n var os = _self.os;\r\n _applyExtValues(5 /* eExtensions.OSExt */, event, OSExtKeys, (_a = {},\r\n _a[0 /* eOSExtKeys.osName */] = os.name,\r\n _a[1 /* eOSExtKeys.ver */] = os.ver,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applySdkContext = function (event) {\r\n var _a;\r\n _applyExtValues(6 /* eExtensions.SdkExt */, event, SDKExtKeys, (_a = {},\r\n _a[2 /* eSDKExtKeys.installId */] = _sdk.installId,\r\n _a[1 /* eSDKExtKeys.seq */] = _sdk.getSequenceId(),\r\n _a[3 /* eSDKExtKeys.epoch */] = _sdk.epoch,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyIntWebContext = function (event) {\r\n var _a;\r\n _applyExtValues(7 /* eExtensions.IntWebExt */, event, IntWebExtKeys, (_a = {},\r\n _a[0 /* eIntWebExtKeys.msfpc */] = _intWeb.getMsfpc(),\r\n _a[1 /* eIntWebExtKeys.anid */] = _intWeb.getAnid(),\r\n _a[2 /* eIntWebExtKeys.serviceName */] = _intWeb.serviceName,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyUtcContext = function (event) {\r\n var _a;\r\n var utcFields = (_a = {},\r\n _a[0 /* eUtcExtKeys.popSample */] = _utc.popSample,\r\n _a);\r\n if (_utc.eventFlags > 0) {\r\n utcFields[1 /* eUtcExtKeys.eventFlags */] = _utc.eventFlags;\r\n }\r\n _applyExtValues(8 /* eExtensions.UtcExt */, event, UtcExtKeys, utcFields, _overwriteEventPartA);\r\n };\r\n _self.applyLocContext = function (event) {\r\n var _a;\r\n _applyExtValues(9 /* eExtensions.LocExt */, event, LocExtKeys, (_a = {},\r\n _a[0 /* eLocExtKeys.tz */] = _self.loc.tz,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applySessionContext = function (event) {\r\n var _a;\r\n _applyExtValues(4 /* eExtensions.AppExt */, event, SessionExtKeys, (_a = {},\r\n _a[0 /* eSessionExtKeys.sessionId */] = _getSessionId(),\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyDeviceContext = function (event) {\r\n var _a;\r\n var device = _self.device;\r\n _applyExtValues(1 /* eExtensions.DeviceExt */, event, DeviceExtKeys, (_a = {},\r\n _a[0 /* eDeviceExtKeys.localId */] = device.localId,\r\n _a[2 /* eDeviceExtKeys.make */] = device.make,\r\n _a[3 /* eDeviceExtKeys.model */] = device.model,\r\n _a[1 /* eDeviceExtKeys.deviceClass */] = device.deviceClass,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyCloudContext = function (event) {\r\n var _a;\r\n var cloud = _self.cloud;\r\n _applyExtValues(10 /* eExtensions.CloudExt */, event, CloudExtKeys, (_a = {},\r\n _a[0 /* eCloudExtKeys.role */] = cloud.role,\r\n _a[1 /* eCloudExtKeys.roleInstance */] = cloud.roleInstance,\r\n _a[2 /* eCloudExtKeys.roleVer */] = cloud.roleVer,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyAITraceContext = function (event) {\r\n var _a;\r\n if (propertiesConfig.enableApplicationInsightsTrace) {\r\n var distributedTrace = _getTraceCtx();\r\n if (distributedTrace) {\r\n _applyExtValues(2 /* eExtensions.TraceExt */, event, TraceExtKeys, (_a = {},\r\n _a[0 /* eTraceExtKeys.traceId */] = distributedTrace.getTraceId(),\r\n _a[1 /* eTraceExtKeys.traceName */] = distributedTrace.getName(),\r\n _a[2 /* eTraceExtKeys.parentId */] = distributedTrace.getSpanId(),\r\n _a), false); // Always allow the event to define these values\r\n }\r\n }\r\n };\r\n _self.applyDistributedTraceContext = function (event) {\r\n var _a;\r\n var distributedTrace = _getTraceCtx();\r\n if (distributedTrace) {\r\n var traceFields = (_a = {},\r\n _a[0 /* eDistributedTraceExtKeys.traceId */] = distributedTrace.getTraceId(),\r\n _a[1 /* eDistributedTraceExtKeys.spanId */] = distributedTrace.getSpanId(),\r\n _a);\r\n var traceFlags = distributedTrace.getTraceFlags();\r\n if (!isNullOrUndefined(traceFlags)) {\r\n traceFields[2 /* eDistributedTraceExtKeys.traceFlags */] = traceFlags;\r\n }\r\n // Always allow the event to define these values\r\n _applyExtValues(11 /* eExtensions.DtExt */, event, DistributedTraceExtKeys, traceFields, false);\r\n }\r\n };\r\n function _getTraceCtx() {\r\n var traceCtx = _distributedTraceCtx;\r\n if (core && core.getTraceCtx) {\r\n traceCtx = core.getTraceCtx(false) || _distributedTraceCtx;\r\n }\r\n return traceCtx;\r\n }\r\n });\r\n }\r\n /**\r\n * Gets the current distributed trace context for this instance if available\r\n */\r\n TelemetryContext.prototype.getTraceCtx = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Returns the current session id, if one does not already exist a new one will be attempted to be created.\r\n * If you have set a specific custom id via session.setId(), this function will return that value.\r\n */\r\n TelemetryContext.prototype.getSessionId = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n TelemetryContext.prototype.applyApplicationContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyUserContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyWebContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyOsContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applySdkContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyIntWebContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyUtcContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyLocContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applySessionContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyDeviceContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyCloudContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyAITraceContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n TelemetryContext.prototype.applyDistributedTraceContext = function (event) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return TelemetryContext;\r\n}());\r\nexport { TelemetryContext };\r\n/**\r\n * Creates a IDistributedTraceContext from an optional telemetryTrace\r\n * @param traceContext - The ITraceContext instance that is being wrapped\r\n * @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.\r\n * @returns A new IDistributedTraceContext instance that is backed by the traceContext or temporary object\r\n */\r\nfunction createDistributedTraceContextFromTraceCtx(traceContext, parentCtx) {\r\n var trace = traceContext || {};\r\n return {\r\n getName: function () {\r\n return trace.name;\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace.name = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace.traceId;\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace.traceId = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace.parentId;\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace.parentId = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace.traceFlags;\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace.traceFlags = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TelemetryContext.js.map","import { __extends } from \"tslib\";\r\n/**\r\n* PropertiesPlugin.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin, arrForEach, objForEachKey, objKeys, setProcessTelemetryTimings } from \"@microsoft/1ds-core-js\";\r\nimport { Extensions } from \"./ExtensionKeys\";\r\nimport { TelemetryContext } from \"./TelemetryContext\";\r\nvar extensions = [\r\n Extensions[4 /* eExtensions.AppExt */],\r\n Extensions[0 /* eExtensions.UserExt */],\r\n Extensions[3 /* eExtensions.WebExt */],\r\n Extensions[5 /* eExtensions.OSExt */],\r\n Extensions[6 /* eExtensions.SdkExt */],\r\n Extensions[7 /* eExtensions.IntWebExt */],\r\n Extensions[8 /* eExtensions.UtcExt */],\r\n Extensions[9 /* eExtensions.LocExt */],\r\n Extensions[1 /* eExtensions.DeviceExt */],\r\n Extensions[2 /* eExtensions.TraceExt */],\r\n Extensions[11 /* eExtensions.DtExt */],\r\n Extensions[10 /* eExtensions.CloudExt */]\r\n];\r\nvar PropertiesPlugin = /** @class */ (function (_super) {\r\n __extends(PropertiesPlugin, _super);\r\n function PropertiesPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"SystemPropertiesCollector\";\r\n _this.priority = 3;\r\n _this.version = '3.2.15';\r\n // Do not set default values here, set them in the _initDefaults() which is also called during teardown()\r\n var _context;\r\n var _properties;\r\n var _config;\r\n dynamicProto(PropertiesPlugin, _this, function (_self, _base) {\r\n _initDefaults();\r\n _self.initialize = function (coreConfig, core, extensions) {\r\n _base.initialize(coreConfig, core, extensions);\r\n _config = _self._getTelCtx().getExtCfg(_self.identifier);\r\n _context = new TelemetryContext(coreConfig, _config, core);\r\n if (core && core.setTraceCtx) {\r\n core.setTraceCtx(_context.getTraceCtx());\r\n }\r\n };\r\n /**\r\n * Process the event and add part A fields to it.\r\n * @param event - The event that needs to be stored.\r\n * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances\r\n * can optionally use this to access the current core instance or define / pass additional information\r\n * to later plugins (vs appending items to the telemetry item)\r\n */\r\n _self.processTelemetry = function (event, itemCtx) {\r\n setProcessTelemetryTimings(event, _self.identifier);\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n var evtExt = event.ext = event.ext ? event.ext : {};\r\n event.data = event.data ? event.data : {};\r\n arrForEach(extensions, function (value) {\r\n evtExt[value] = evtExt[value] || {};\r\n });\r\n if (_context) {\r\n // Always apply the utc properties first as this sets the `ext.utc.eventFlags` which is required to tell\r\n // the collector to mask some fields\r\n _context.applyUtcContext(event);\r\n _context.applyApplicationContext(event);\r\n _context.applyUserContext(event);\r\n _context.applyWebContext(event);\r\n _context.applyOsContext(event);\r\n _context.applySdkContext(event);\r\n _context.applyIntWebContext(event);\r\n _context.applyLocContext(event);\r\n _context.applySessionContext(event);\r\n _context.applyDeviceContext(event);\r\n if (_config.enableApplicationInsightsTrace) {\r\n _context.applyAITraceContext(event);\r\n }\r\n if (_config.enableDistributedTracing) {\r\n _context.applyDistributedTraceContext(event);\r\n }\r\n _context.applyCloudContext(event);\r\n }\r\n // Delete empty ext fields\r\n arrForEach(objKeys(evtExt), function (key) {\r\n if (objKeys(evtExt[key]).length === 0) {\r\n delete evtExt[key];\r\n }\r\n });\r\n // Add custom properties\r\n _addPropertiesIfAbsent(_properties, event.data);\r\n _self.processNext(event, itemCtx);\r\n };\r\n /**\r\n * Get properties context to override or specify specific part A properties\r\n * @returns the Context\r\n */\r\n _self.getPropertiesContext = function () {\r\n return _context;\r\n };\r\n /**\r\n * Sets a custom property to be sent with every event. IEventProperty can be used to tag the property as\r\n * pii or customer content.\r\n * @param name - The name of the property.\r\n * @param value - The context property's value.\r\n */\r\n _self.setProperty = function (name, value) {\r\n _properties[name] = value;\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n var core = (unloadCtx || {}).core();\r\n if (core && core.getTraceCtx && _context) {\r\n var traceCtx = core.getTraceCtx(false);\r\n if (traceCtx && traceCtx === _context.getTraceCtx()) {\r\n core.setTraceCtx(null);\r\n }\r\n }\r\n _initDefaults();\r\n };\r\n function _initDefaults() {\r\n _context = null;\r\n _properties = {};\r\n }\r\n function _addPropertiesIfAbsent(inputMap, outputMap) {\r\n if (inputMap) {\r\n objForEachKey(inputMap, function (name, inputValue) {\r\n if (!outputMap[name]) {\r\n outputMap[name] = inputValue;\r\n }\r\n });\r\n }\r\n }\r\n });\r\n return _this;\r\n }\r\n PropertiesPlugin.prototype.initialize = function (coreConfig, core, extensions) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Process the event and add part A fields to it.\r\n * @param event - The event that needs to be stored.\r\n * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances\r\n * can optionally use this to access the current core instance or define / pass additional information\r\n * to later plugins (vs appending items to the telemetry item)\r\n */\r\n PropertiesPlugin.prototype.processTelemetry = function (event, itemCtx) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Get properties context to override or specify specific part A properties\r\n * @returns the Context\r\n */\r\n PropertiesPlugin.prototype.getPropertiesContext = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Sets a custom property to be sent with every event. IEventProperty can be used to tag the property as\r\n * pii or customer content.\r\n * @param name - The name of the property.\r\n * @param value - The context property's value.\r\n */\r\n PropertiesPlugin.prototype.setProperty = function (name, value) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return PropertiesPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport default PropertiesPlugin;\r\n//# sourceMappingURL=PropertiesPlugin.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// // Licensed under the MIT License.\r\nimport { _DYN_CONFIG, _DYN_CREATE_NEW, _DYN_FLUSH, _DYN_IDENTIFIER, _DYN_LENGTH, _DYN_ON_COMPLETE, _DYN_PROCESS_NEXT, _DYN_PUSH } from \"../__DynamicConstants\";\r\nimport { arrForEach, isArray, objFreeze, throwError } from \"./HelperFuncs\";\r\nimport { STR_PRIORITY } from \"./InternalConstants\";\r\nimport { createProcessTelemetryContext, createTelemetryProxyChain } from \"./ProcessTelemetryContext\";\r\nimport { initializePlugins } from \"./TelemetryHelpers\";\r\nexport var ChannelControllerPriority = 500;\r\nvar ChannelValidationMessage = \"Channel has invalid priority - \";\r\nfunction _addChannelQueue(channelQueue, queue, core) {\r\n if (queue && isArray(queue) && queue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n queue = queue.sort(function (a, b) {\r\n return a[STR_PRIORITY /* @min:%2epriority */] - b[STR_PRIORITY /* @min:%2epriority */];\r\n });\r\n arrForEach(queue, function (queueItem) {\r\n if (queueItem[STR_PRIORITY /* @min:%2epriority */] < ChannelControllerPriority) {\r\n throwError(ChannelValidationMessage + queueItem[_DYN_IDENTIFIER /* @min:%2eidentifier */]);\r\n }\r\n });\r\n channelQueue[_DYN_PUSH /* @min:%2epush */]({\r\n queue: objFreeze(queue),\r\n chain: createTelemetryProxyChain(queue, core[_DYN_CONFIG /* @min:%2econfig */], core)\r\n });\r\n }\r\n}\r\nexport function createChannelControllerPlugin(channelQueue, core) {\r\n function _getTelCtx() {\r\n return createProcessTelemetryContext(null, core[_DYN_CONFIG /* @min:%2econfig */], core, null);\r\n }\r\n function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {\r\n var waiting = theChannels ? (theChannels[_DYN_LENGTH /* @min:%2elength */] + 1) : 1;\r\n function _runChainOnComplete() {\r\n waiting--;\r\n if (waiting === 0) {\r\n onComplete && onComplete();\r\n onComplete = null;\r\n }\r\n }\r\n if (waiting > 0) {\r\n arrForEach(theChannels, function (channels) {\r\n // pass on to first item in queue\r\n if (channels && channels.queue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var channelChain = channels.chain;\r\n var chainCtx = itemCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](channelChain);\r\n chainCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](_runChainOnComplete);\r\n // Cause this chain to start processing\r\n processFn(chainCtx);\r\n }\r\n else {\r\n waiting--;\r\n }\r\n });\r\n }\r\n _runChainOnComplete();\r\n }\r\n function _doUpdate(updateCtx, updateState) {\r\n var theUpdateState = updateState || {\r\n reason: 0 /* TelemetryUpdateReason.Unknown */\r\n };\r\n _processChannelQueue(channelQueue, updateCtx, function (chainCtx) {\r\n chainCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](theUpdateState);\r\n }, function () {\r\n updateCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](theUpdateState);\r\n });\r\n return true;\r\n }\r\n function _doTeardown(unloadCtx, unloadState) {\r\n var theUnloadState = unloadState || {\r\n reason: 0 /* TelemetryUnloadReason.ManualTeardown */,\r\n isAsync: false\r\n };\r\n _processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {\r\n chainCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](theUnloadState);\r\n }, function () {\r\n unloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](theUnloadState);\r\n isInitialized = false;\r\n });\r\n return true;\r\n }\r\n function _getChannel(pluginIdentifier) {\r\n var thePlugin = null;\r\n if (channelQueue && channelQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(channelQueue, function (channels) {\r\n // pass on to first item in queue\r\n if (channels && channels.queue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(channels.queue, function (ext) {\r\n if (ext[_DYN_IDENTIFIER /* @min:%2eidentifier */] === pluginIdentifier) {\r\n thePlugin = ext;\r\n // Cause arrForEach to stop iterating\r\n return -1;\r\n }\r\n });\r\n if (thePlugin) {\r\n // Cause arrForEach to stop iterating\r\n return -1;\r\n }\r\n }\r\n });\r\n }\r\n return thePlugin;\r\n }\r\n var isInitialized = false;\r\n var channelController = {\r\n identifier: \"ChannelControllerPlugin\",\r\n priority: ChannelControllerPriority,\r\n initialize: function (config, core, extensions, pluginChain) {\r\n isInitialized = true;\r\n arrForEach(channelQueue, function (channels) {\r\n if (channels && channels.queue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);\r\n }\r\n });\r\n },\r\n isInitialized: function () {\r\n return isInitialized;\r\n },\r\n processTelemetry: function (item, itemCtx) {\r\n _processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {\r\n chainCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](item);\r\n }, function () {\r\n itemCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](item);\r\n });\r\n },\r\n update: _doUpdate,\r\n pause: function () {\r\n _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {\r\n chainCtx.iterate(function (plugin) {\r\n plugin.pause && plugin.pause();\r\n });\r\n }, null);\r\n },\r\n resume: function () {\r\n _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {\r\n chainCtx.iterate(function (plugin) {\r\n plugin.resume && plugin.resume();\r\n });\r\n }, null);\r\n },\r\n teardown: _doTeardown,\r\n getChannel: _getChannel,\r\n flush: function (isAsync, callBack, sendReason, cbTimeout) {\r\n // Setting waiting to one so that we don't call the callBack until we finish iterating\r\n var waiting = 1;\r\n var doneIterating = false;\r\n var cbTimer = null;\r\n cbTimeout = cbTimeout || 5000;\r\n function doCallback() {\r\n waiting--;\r\n if (doneIterating && waiting === 0) {\r\n if (cbTimer) {\r\n clearTimeout(cbTimer);\r\n cbTimer = null;\r\n }\r\n callBack && callBack(doneIterating);\r\n callBack = null;\r\n }\r\n }\r\n _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {\r\n chainCtx.iterate(function (plugin) {\r\n if (plugin[_DYN_FLUSH /* @min:%2eflush */]) {\r\n waiting++;\r\n var handled_1 = false;\r\n // Not all channels will call this callback for every scenario\r\n if (!plugin[_DYN_FLUSH /* @min:%2eflush */](isAsync, function () {\r\n handled_1 = true;\r\n doCallback();\r\n }, sendReason)) {\r\n if (!handled_1) {\r\n // If any channel doesn't return true and it didn't call the callback, then we should assume that the callback\r\n // will never be called, so use a timeout to allow the channel(s) some time to \"finish\" before triggering any\r\n // followup function (such as unloading)\r\n if (isAsync && cbTimer == null) {\r\n cbTimer = setTimeout(function () {\r\n cbTimer = null;\r\n doCallback();\r\n }, cbTimeout);\r\n }\r\n else {\r\n doCallback();\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }, function () {\r\n doneIterating = true;\r\n doCallback();\r\n });\r\n return true;\r\n },\r\n _setQueue: function (queue) {\r\n channelQueue = queue;\r\n }\r\n };\r\n return channelController;\r\n}\r\nexport function createChannelQueues(channels, extensions, core) {\r\n var channelQueue = [];\r\n if (channels) {\r\n // Add and sort the configuration channel queues\r\n arrForEach(channels, function (queue) { return _addChannelQueue(channelQueue, queue, core); });\r\n }\r\n if (extensions) {\r\n // Create a new channel queue for any extensions with a priority > the ChannelControllerPriority\r\n var extensionQueue_1 = [];\r\n arrForEach(extensions, function (plugin) {\r\n if (plugin[STR_PRIORITY /* @min:%2epriority */] > ChannelControllerPriority) {\r\n extensionQueue_1[_DYN_PUSH /* @min:%2epush */](plugin);\r\n }\r\n });\r\n _addChannelQueue(channelQueue, extensionQueue_1, core);\r\n }\r\n return channelQueue;\r\n}\r\n//# sourceMappingURL=ChannelController.js.map","// // Copyright (c) Microsoft Corporation. All rights reserved.\r\n// // Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_APPLY, _DYN_DIAG_LOG, _DYN_LENGTH, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_SPLICE, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { BaseTelemetryPlugin } from \"./BaseTelemetryPlugin\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { dumpObj } from \"./EnvUtils\";\r\nimport { arrForEach, getExceptionName } from \"./HelperFuncs\";\r\nimport { STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nvar TelemetryInitializerPlugin = /** @class */ (function (_super) {\r\n __extends(TelemetryInitializerPlugin, _super);\r\n function TelemetryInitializerPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"TelemetryInitializerPlugin\";\r\n _this.priority = 199;\r\n // NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()\r\n var _id;\r\n var _initializers;\r\n _initDefaults();\r\n dynamicProto(TelemetryInitializerPlugin, _this, function (_self, _base) {\r\n _self.addTelemetryInitializer = function (telemetryInitializer) {\r\n var theInitializer = {\r\n id: _id++,\r\n fn: telemetryInitializer\r\n };\r\n _initializers[_DYN_PUSH /* @min:%2epush */](theInitializer);\r\n var handler = {\r\n remove: function () {\r\n arrForEach(_initializers, function (initializer, idx) {\r\n if (initializer.id === theInitializer.id) {\r\n _initializers[_DYN_SPLICE /* @min:%2esplice */](idx, 1);\r\n return -1;\r\n }\r\n });\r\n }\r\n };\r\n return handler;\r\n };\r\n _self[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */] = function (item, itemCtx) {\r\n var doNotSendItem = false;\r\n var telemetryInitializersCount = _initializers[_DYN_LENGTH /* @min:%2elength */];\r\n for (var i = 0; i < telemetryInitializersCount; ++i) {\r\n var telemetryInitializer = _initializers[i];\r\n if (telemetryInitializer) {\r\n try {\r\n if (telemetryInitializer.fn[_DYN_APPLY /* @min:%2eapply */](null, [item]) === false) {\r\n doNotSendItem = true;\r\n break;\r\n }\r\n }\r\n catch (e) {\r\n // log error but dont stop executing rest of the telemetry initializers\r\n // doNotSendItem = true;\r\n _throwInternal(itemCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 64 /* _eInternalMessageId.TelemetryInitializerFailed */, \"One of telemetry initializers failed, telemetry item will not be sent: \" + getExceptionName(e), { exception: dumpObj(e) }, true);\r\n }\r\n }\r\n }\r\n if (!doNotSendItem) {\r\n _self[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](item, itemCtx);\r\n }\r\n };\r\n _self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */] = function () {\r\n _initDefaults();\r\n };\r\n });\r\n function _initDefaults() {\r\n _id = 0;\r\n _initializers = [];\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Add a telemetry processor to decorate or drop telemetry events.\r\n * @param telemetryInitializer - The Telemetry Initializer function\r\n * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed\r\n */\r\n TelemetryInitializerPlugin.prototype.addTelemetryInitializer = function (telemetryInitializer) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n TelemetryInitializerPlugin.prototype.processTelemetry = function (env, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return TelemetryInitializerPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { TelemetryInitializerPlugin };\r\n//# sourceMappingURL=TelemetryInitializerPlugin.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { __spreadArray } from \"tslib\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { objCreateFn } from \"@microsoft/applicationinsights-shims\";\r\nimport { _DYN_ADD_NOTIFICATION_LIS1, _DYN_CONFIG, _DYN_FLUSH, _DYN_GET_NOTIFY_MGR, _DYN_GET_PLUGIN, _DYN_GET_PROCESS_TEL_CONT0, _DYN_IDENTIFIER, _DYN_INITIALIZE, _DYN_INSTRUMENTATION_KEY, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_LOGGER, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_NAME, _DYN_ON_COMPLETE, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_REMOVE_NOTIFICATION_2, _DYN_SET_ENABLED, _DYN_SPLICE, _DYN_STOP_POLLING_INTERNA3, _DYN_TEARDOWN, _DYN_TIME, _DYN__EXTENSIONS } from \"../__DynamicConstants\";\r\nimport { ChannelControllerPriority, createChannelControllerPlugin, createChannelQueues } from \"./ChannelController\";\r\nimport { createCookieMgr } from \"./CookieMgr\";\r\nimport { createUniqueNamespace } from \"./DataCacheHelper\";\r\nimport { getDebugListener } from \"./DbgExtensionUtils\";\r\nimport { DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole } from \"./DiagnosticLogger\";\r\nimport { arrForEach, arrIndexOf, getCfgValue, getSetValue, isFunction, isNullOrUndefined, objExtend, objFreeze, proxyFunctionAs, proxyFunctions, throwError, toISOString } from \"./HelperFuncs\";\r\nimport { STR_CHANNELS, STR_CORE, STR_CREATE_PERF_MGR, STR_DISABLED, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_EVENTS_SENT, STR_EXTENSIONS, STR_EXTENSION_CONFIG, STR_GET_PERF_MGR, STR_PRIORITY } from \"./InternalConstants\";\r\nimport { PerfManager, getGblPerfMgr } from \"./PerfManager\";\r\nimport { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext, createTelemetryProxyChain } from \"./ProcessTelemetryContext\";\r\nimport { _getPluginState, createDistributedTraceContext, initializePlugins, sortPlugins } from \"./TelemetryHelpers\";\r\nimport { TelemetryInitializerPlugin } from \"./TelemetryInitializerPlugin\";\r\nimport { createUnloadHandlerContainer } from \"./UnloadHandlerContainer\";\r\nvar strValidationError = \"Plugins must provide initialize method\";\r\nvar strNotificationManager = \"_notificationManager\";\r\nvar strSdkUnloadingError = \"SDK is still unloading...\";\r\nvar strSdkNotInitialized = \"SDK is not initialized\";\r\n// const strPluginUnloadFailed = \"Failed to unload plugin\";\r\nvar defaultInitConfig = {\r\n // Have the Diagnostic Logger default to log critical errors to the console\r\n loggingLevelConsole: 1 /* eLoggingSeverity.CRITICAL */\r\n};\r\n/**\r\n * Helper to create the default performance manager\r\n * @param core\r\n * @param notificationMgr\r\n */\r\nfunction _createPerfManager(core, notificationMgr) {\r\n return new PerfManager(notificationMgr);\r\n}\r\nfunction _validateExtensions(logger, channelPriority, allExtensions) {\r\n var _a;\r\n // Concat all available extensions\r\n var coreExtensions = [];\r\n // Check if any two extensions have the same priority, then warn to console\r\n // And extract the local extensions from the\r\n var extPriorities = {};\r\n // Extension validation\r\n arrForEach(allExtensions, function (ext) {\r\n // Check for ext.initialize\r\n if (isNullOrUndefined(ext) || isNullOrUndefined(ext[_DYN_INITIALIZE /* @min:%2einitialize */])) {\r\n throwError(strValidationError);\r\n }\r\n var extPriority = ext[STR_PRIORITY /* @min:%2epriority */];\r\n var identifier = ext[_DYN_IDENTIFIER /* @min:%2eidentifier */];\r\n if (ext && extPriority) {\r\n if (!isNullOrUndefined(extPriorities[extPriority])) {\r\n _warnToConsole(logger, \"Two extensions have same priority #\" + extPriority + \" - \" + extPriorities[extPriority] + \", \" + identifier);\r\n }\r\n else {\r\n // set a value\r\n extPriorities[extPriority] = identifier;\r\n }\r\n }\r\n // Split extensions to core and channelController\r\n if (!extPriority || extPriority < channelPriority) {\r\n // Add to core extension that will be managed by BaseCore\r\n coreExtensions[_DYN_PUSH /* @min:%2epush */](ext);\r\n }\r\n });\r\n return _a = {\r\n all: allExtensions\r\n },\r\n _a[STR_CORE /* @min:core */] = coreExtensions,\r\n _a;\r\n}\r\nfunction _isPluginPresent(thePlugin, plugins) {\r\n var exists = false;\r\n arrForEach(plugins, function (plugin) {\r\n if (plugin === thePlugin) {\r\n exists = true;\r\n return -1;\r\n }\r\n });\r\n return exists;\r\n}\r\nfunction _createDummyNotificationManager() {\r\n var _a;\r\n return objCreateFn((_a = {},\r\n _a[_DYN_ADD_NOTIFICATION_LIS1 /* @min:addNotificationListener */] = function (listener) { },\r\n _a[_DYN_REMOVE_NOTIFICATION_2 /* @min:removeNotificationListener */] = function (listener) { },\r\n _a[STR_EVENTS_SENT /* @min:eventsSent */] = function (events) { },\r\n _a[STR_EVENTS_DISCARDED /* @min:eventsDiscarded */] = function (events, reason) { },\r\n _a[STR_EVENTS_SEND_REQUEST /* @min:eventsSendRequest */] = function (sendReason, isAsync) { },\r\n _a));\r\n}\r\nvar BaseCore = /** @class */ (function () {\r\n function BaseCore() {\r\n // NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()\r\n var _config;\r\n var _isInitialized;\r\n var _eventQueue;\r\n var _notificationManager;\r\n var _perfManager;\r\n var _cfgPerfManager;\r\n var _cookieManager;\r\n var _pluginChain;\r\n var _configExtensions;\r\n var _coreExtensions;\r\n var _channelControl;\r\n var _channelConfig;\r\n var _channelQueue;\r\n var _isUnloading;\r\n var _telemetryInitializerPlugin;\r\n var _internalLogsEventName;\r\n var _evtNamespace;\r\n var _unloadHandlers;\r\n var _debugListener;\r\n var _traceCtx;\r\n /**\r\n * Internal log poller\r\n */\r\n var _internalLogPoller = 0;\r\n var _forceStopInternalLogPoller = false;\r\n dynamicProto(BaseCore, this, function (_self) {\r\n // Set the default values (also called during teardown)\r\n _initDefaults();\r\n _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = function () { return _isInitialized; };\r\n // Creating the self.initialize = ()\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {\r\n if (_isUnloading) {\r\n throwError(strSdkUnloadingError);\r\n }\r\n // Make sure core is only initialized once\r\n if (_self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]()) {\r\n throwError(\"Core should not be initialized more than once\");\r\n }\r\n _config = config || {};\r\n _self[_DYN_CONFIG /* @min:%2econfig */] = _config;\r\n if (isNullOrUndefined(config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */])) {\r\n throwError(\"Please provide instrumentation key\");\r\n }\r\n _notificationManager = notificationManager;\r\n // For backward compatibility only\r\n _self[strNotificationManager] = notificationManager;\r\n _initDebugListener();\r\n _initPerfManager();\r\n // add notification to the extensions in the config so other plugins can access it\r\n _initExtConfig();\r\n if (logger) {\r\n _self[_DYN_LOGGER /* @min:%2elogger */] = logger;\r\n }\r\n var cfgExtensions = getSetValue(_config, STR_EXTENSIONS, []);\r\n // Extension validation\r\n _configExtensions = [];\r\n _configExtensions[_DYN_PUSH /* @min:%2epush */].apply(_configExtensions, __spreadArray(__spreadArray([], extensions, false), cfgExtensions, false));\r\n _channelConfig = getSetValue(_config, STR_CHANNELS, []);\r\n _initPluginChain(null);\r\n if (!_channelQueue || _channelQueue[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n throwError(\"No \" + STR_CHANNELS + \" available\");\r\n }\r\n _isInitialized = true;\r\n _self.releaseQueue();\r\n };\r\n _self.getTransmissionControls = function () {\r\n var controls = [];\r\n if (_channelQueue) {\r\n arrForEach(_channelQueue, function (channels) {\r\n controls[_DYN_PUSH /* @min:%2epush */](channels.queue);\r\n });\r\n }\r\n return objFreeze(controls);\r\n };\r\n _self.track = function (telemetryItem) {\r\n // setup default iKey if not passed in\r\n telemetryItem.iKey = telemetryItem.iKey || _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];\r\n // add default timestamp if not passed in\r\n telemetryItem[_DYN_TIME /* @min:%2etime */] = telemetryItem[_DYN_TIME /* @min:%2etime */] || toISOString(new Date());\r\n // Common Schema 4.0\r\n telemetryItem.ver = telemetryItem.ver || \"4.0\";\r\n if (!_isUnloading && _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]()) {\r\n // Process the telemetry plugin chain\r\n _createTelCtx()[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](telemetryItem);\r\n }\r\n else {\r\n // Queue events until all extensions are initialized\r\n _eventQueue[_DYN_PUSH /* @min:%2epush */](telemetryItem);\r\n }\r\n };\r\n _self[_DYN_GET_PROCESS_TEL_CONT0 /* @min:%2egetProcessTelContext */] = _createTelCtx;\r\n _self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */] = function () {\r\n if (!_notificationManager) {\r\n // Create Dummy notification manager\r\n _notificationManager = _createDummyNotificationManager();\r\n // For backward compatibility only\r\n _self[strNotificationManager] = _notificationManager;\r\n }\r\n return _notificationManager;\r\n };\r\n /**\r\n * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.\r\n * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be\r\n * called.\r\n * @param {INotificationListener} listener - An INotificationListener object.\r\n */\r\n _self[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */] = function (listener) {\r\n if (_notificationManager) {\r\n _notificationManager[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */](listener);\r\n }\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - INotificationListener to remove.\r\n */\r\n _self[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */] = function (listener) {\r\n if (_notificationManager) {\r\n _notificationManager[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */](listener);\r\n }\r\n };\r\n _self.getCookieMgr = function () {\r\n if (!_cookieManager) {\r\n _cookieManager = createCookieMgr(_config, _self[_DYN_LOGGER /* @min:%2elogger */]);\r\n }\r\n return _cookieManager;\r\n };\r\n _self.setCookieMgr = function (cookieMgr) {\r\n _cookieManager = cookieMgr;\r\n };\r\n _self[STR_GET_PERF_MGR /* @min:%2egetPerfMgr */] = function () {\r\n if (!_perfManager && !_cfgPerfManager) {\r\n if (getCfgValue(_config.enablePerfMgr)) {\r\n var createPerfMgr = getCfgValue(_config[STR_CREATE_PERF_MGR /* @min:%2ecreatePerfMgr */]);\r\n if (isFunction(createPerfMgr)) {\r\n _cfgPerfManager = createPerfMgr(_self, _self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */]());\r\n }\r\n }\r\n }\r\n return _perfManager || _cfgPerfManager || getGblPerfMgr();\r\n };\r\n _self.setPerfMgr = function (perfMgr) {\r\n _perfManager = perfMgr;\r\n };\r\n _self.eventCnt = function () {\r\n return _eventQueue[_DYN_LENGTH /* @min:%2elength */];\r\n };\r\n _self.releaseQueue = function () {\r\n if (_isInitialized && _eventQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var eventQueue = _eventQueue;\r\n _eventQueue = [];\r\n arrForEach(eventQueue, function (event) {\r\n _createTelCtx()[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](event);\r\n });\r\n }\r\n };\r\n _self.pollInternalLogs = function (eventName) {\r\n _internalLogsEventName = eventName || null;\r\n _forceStopInternalLogPoller = false;\r\n if (_internalLogPoller) {\r\n clearInterval(_internalLogPoller);\r\n _internalLogPoller = null;\r\n }\r\n return _startInternalLogTimer(true);\r\n };\r\n function _startInternalLogTimer(alwaysStart) {\r\n if (!_internalLogPoller && !_forceStopInternalLogPoller) {\r\n var shouldStart = alwaysStart || (_self[_DYN_LOGGER /* @min:%2elogger */] && _self[_DYN_LOGGER /* @min:%2elogger */].queue[_DYN_LENGTH /* @min:%2elength */] > 0);\r\n if (shouldStart) {\r\n var interval = getCfgValue(_config.diagnosticLogInterval);\r\n if (!interval || !(interval > 0)) {\r\n interval = 10000;\r\n }\r\n // Keeping as an interval timer for backward compatibility as it returns the result\r\n _internalLogPoller = setInterval(function () {\r\n clearInterval(_internalLogPoller);\r\n _internalLogPoller = 0;\r\n _flushInternalLogs();\r\n }, interval);\r\n }\r\n }\r\n return _internalLogPoller;\r\n }\r\n _self[_DYN_STOP_POLLING_INTERNA3 /* @min:%2estopPollingInternalLogs */] = function () {\r\n _forceStopInternalLogPoller = true;\r\n if (_internalLogPoller) {\r\n clearInterval(_internalLogPoller);\r\n _internalLogPoller = 0;\r\n _flushInternalLogs();\r\n }\r\n };\r\n // Add addTelemetryInitializer\r\n proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, [\"addTelemetryInitializer\"]);\r\n _self.unload = function (isAsync, unloadComplete, cbTimeout) {\r\n var _a;\r\n if (isAsync === void 0) { isAsync = true; }\r\n if (!_isInitialized) {\r\n // The SDK is not initialized\r\n throwError(strSdkNotInitialized);\r\n }\r\n // Check if the SDK still unloading so throw\r\n if (_isUnloading) {\r\n // The SDK is already unloading\r\n throwError(strSdkUnloadingError);\r\n }\r\n var unloadState = (_a = {\r\n reason: 50 /* TelemetryUnloadReason.SdkUnload */\r\n },\r\n _a[_DYN_IS_ASYNC /* @min:isAsync */] = isAsync,\r\n _a.flushComplete = false,\r\n _a);\r\n var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self);\r\n processUnloadCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](function () {\r\n _initDefaults();\r\n unloadComplete && unloadComplete(unloadState);\r\n }, _self);\r\n function _doUnload(flushComplete) {\r\n unloadState.flushComplete = flushComplete;\r\n _isUnloading = true;\r\n // Run all of the unload handlers first (before unloading the plugins)\r\n _unloadHandlers.run(processUnloadCtx, unloadState);\r\n // Stop polling the internal logs\r\n _self[_DYN_STOP_POLLING_INTERNA3 /* @min:%2estopPollingInternalLogs */]();\r\n // Start unloading the components, from this point onwards the SDK should be considered to be in an unstable state\r\n processUnloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);\r\n }\r\n _flushInternalLogs();\r\n if (!_flushChannels(isAsync, _doUnload, 6 /* SendRequestReason.SdkUnload */, cbTimeout)) {\r\n _doUnload(false);\r\n }\r\n };\r\n _self[_DYN_GET_PLUGIN /* @min:%2egetPlugin */] = _getPlugin;\r\n _self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {\r\n if (!plugin) {\r\n addCb && addCb(false);\r\n _logOrThrowError(strValidationError);\r\n return;\r\n }\r\n var existingPlugin = _getPlugin(plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */]);\r\n if (existingPlugin && !replaceExisting) {\r\n addCb && addCb(false);\r\n _logOrThrowError(\"Plugin [\" + plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] + \"] is already loaded!\");\r\n return;\r\n }\r\n var updateState = {\r\n reason: 16 /* TelemetryUpdateReason.PluginAdded */\r\n };\r\n function _addPlugin(removed) {\r\n _configExtensions[_DYN_PUSH /* @min:%2epush */](plugin);\r\n updateState.added = [plugin];\r\n // Re-Initialize the plugin chain\r\n _initPluginChain(updateState);\r\n addCb && addCb(true);\r\n }\r\n if (existingPlugin) {\r\n var removedPlugins_1 = [existingPlugin.plugin];\r\n var unloadState = {\r\n reason: 2 /* TelemetryUnloadReason.PluginReplace */,\r\n isAsync: !!isAsync\r\n };\r\n _removePlugins(removedPlugins_1, unloadState, function (removed) {\r\n if (!removed) {\r\n // Previous plugin was successfully removed or was not installed\r\n addCb && addCb(false);\r\n }\r\n else {\r\n updateState.removed = removedPlugins_1;\r\n updateState.reason |= 32 /* TelemetryUpdateReason.PluginRemoved */;\r\n _addPlugin(true);\r\n }\r\n });\r\n }\r\n else {\r\n _addPlugin(false);\r\n }\r\n };\r\n _self.evtNamespace = function () {\r\n return _evtNamespace;\r\n };\r\n _self[_DYN_FLUSH /* @min:%2eflush */] = _flushChannels;\r\n _self.getTraceCtx = function (createNew) {\r\n if (!_traceCtx) {\r\n _traceCtx = createDistributedTraceContext();\r\n }\r\n return _traceCtx;\r\n };\r\n _self.setTraceCtx = function (traceCtx) {\r\n _traceCtx = traceCtx || null;\r\n };\r\n // Create the addUnloadCb\r\n proxyFunctionAs(_self, \"addUnloadCb\", function () { return _unloadHandlers; }, \"add\");\r\n function _initDefaults() {\r\n _isInitialized = false;\r\n // Use a default logger so initialization errors are not dropped on the floor with full logging\r\n _config = objExtend(true, {}, defaultInitConfig);\r\n _self[_DYN_CONFIG /* @min:%2econfig */] = _config;\r\n _self[_DYN_LOGGER /* @min:%2elogger */] = new DiagnosticLogger(_config);\r\n _self[_DYN__EXTENSIONS /* @min:%2e_extensions */] = [];\r\n _telemetryInitializerPlugin = new TelemetryInitializerPlugin();\r\n _eventQueue = [];\r\n _notificationManager = null;\r\n _perfManager = null;\r\n _cfgPerfManager = null;\r\n _cookieManager = null;\r\n _pluginChain = null;\r\n _coreExtensions = null;\r\n _configExtensions = [];\r\n _channelControl = null;\r\n _channelConfig = null;\r\n _channelQueue = null;\r\n _isUnloading = false;\r\n _internalLogsEventName = null;\r\n _evtNamespace = createUniqueNamespace(\"AIBaseCore\", true);\r\n _unloadHandlers = createUnloadHandlerContainer();\r\n _traceCtx = null;\r\n }\r\n function _createTelCtx() {\r\n var theCtx = createProcessTelemetryContext(_getPluginChain(), _config, _self);\r\n theCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](_startInternalLogTimer);\r\n return theCtx;\r\n }\r\n // Initialize or Re-initialize the plugins\r\n function _initPluginChain(updateState) {\r\n // Extension validation\r\n var theExtensions = _validateExtensions(_self[_DYN_LOGGER /* @min:%2elogger */], ChannelControllerPriority, _configExtensions);\r\n _coreExtensions = theExtensions[STR_CORE /* @min:%2ecore */];\r\n _pluginChain = null;\r\n // Sort the complete set of extensions by priority\r\n var allExtensions = theExtensions.all;\r\n // Initialize the Channel Queues and the channel plugins first\r\n _channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, _self));\r\n if (_channelControl) {\r\n // During add / remove of a plugin this may get called again, so don't re-add if already present\r\n // But we also want the controller as the last, so remove if already present\r\n // And reusing the existing instance, just in case an installed plugin has a reference and\r\n // is using it.\r\n var idx = arrIndexOf(allExtensions, _channelControl);\r\n if (idx !== -1) {\r\n allExtensions[_DYN_SPLICE /* @min:%2esplice */](idx, 1);\r\n }\r\n idx = arrIndexOf(_coreExtensions, _channelControl);\r\n if (idx !== -1) {\r\n _coreExtensions[_DYN_SPLICE /* @min:%2esplice */](idx, 1);\r\n }\r\n _channelControl._setQueue(_channelQueue);\r\n }\r\n else {\r\n _channelControl = createChannelControllerPlugin(_channelQueue, _self);\r\n }\r\n // Add on \"channelController\" as the last \"plugin\"\r\n allExtensions[_DYN_PUSH /* @min:%2epush */](_channelControl);\r\n _coreExtensions[_DYN_PUSH /* @min:%2epush */](_channelControl);\r\n // Required to allow plugins to call core.getPlugin() during their own initialization\r\n _self[_DYN__EXTENSIONS /* @min:%2e_extensions */] = sortPlugins(allExtensions);\r\n // Initialize the controls\r\n _channelControl[_DYN_INITIALIZE /* @min:%2einitialize */](_config, _self, allExtensions);\r\n var initCtx = _createTelCtx();\r\n initializePlugins(initCtx, allExtensions);\r\n // Now reset the extensions to just those being managed by Basecore\r\n _self[_DYN__EXTENSIONS /* @min:%2e_extensions */] = objFreeze(sortPlugins(_coreExtensions || [])).slice();\r\n if (updateState) {\r\n _doUpdate(updateState);\r\n }\r\n }\r\n function _getPlugin(pluginIdentifier) {\r\n var _a;\r\n var theExt = null;\r\n var thePlugin = null;\r\n arrForEach(_self[_DYN__EXTENSIONS /* @min:%2e_extensions */], function (ext) {\r\n if (ext[_DYN_IDENTIFIER /* @min:%2eidentifier */] === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {\r\n thePlugin = ext;\r\n return -1;\r\n }\r\n });\r\n if (!thePlugin && _channelControl) {\r\n // Check the channel Controller\r\n thePlugin = _channelControl.getChannel(pluginIdentifier);\r\n }\r\n if (thePlugin) {\r\n theExt = (_a = {\r\n plugin: thePlugin\r\n },\r\n _a[_DYN_SET_ENABLED /* @min:setEnabled */] = function (enabled) {\r\n _getPluginState(thePlugin)[STR_DISABLED] = !enabled;\r\n },\r\n _a.isEnabled = function () {\r\n var pluginState = _getPluginState(thePlugin);\r\n return !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] && !pluginState[STR_DISABLED];\r\n },\r\n _a.remove = function (isAsync, removeCb) {\r\n var _a;\r\n if (isAsync === void 0) { isAsync = true; }\r\n var pluginsToRemove = [thePlugin];\r\n var unloadState = (_a = {\r\n reason: 1 /* TelemetryUnloadReason.PluginUnload */\r\n },\r\n _a[_DYN_IS_ASYNC /* @min:isAsync */] = isAsync,\r\n _a);\r\n _removePlugins(pluginsToRemove, unloadState, function (removed) {\r\n if (removed) {\r\n // Re-Initialize the plugin chain\r\n _initPluginChain({\r\n reason: 32 /* TelemetryUpdateReason.PluginRemoved */,\r\n removed: pluginsToRemove\r\n });\r\n }\r\n removeCb && removeCb(removed);\r\n });\r\n },\r\n _a);\r\n }\r\n return theExt;\r\n }\r\n function _getPluginChain() {\r\n if (!_pluginChain) {\r\n // copy the collection of extensions\r\n var extensions = (_coreExtensions || []).slice();\r\n // During add / remove this may get called again, so don't readd if already present\r\n if (arrIndexOf(extensions, _telemetryInitializerPlugin) === -1) {\r\n extensions[_DYN_PUSH /* @min:%2epush */](_telemetryInitializerPlugin);\r\n }\r\n _pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _config, _self);\r\n }\r\n return _pluginChain;\r\n }\r\n function _removePlugins(thePlugins, unloadState, removeComplete) {\r\n if (thePlugins && thePlugins[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var unloadChain = createTelemetryProxyChain(thePlugins, _config, _self);\r\n var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self);\r\n unloadCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](function () {\r\n var removed = false;\r\n // Remove the listed config extensions\r\n var newConfigExtensions = [];\r\n arrForEach(_configExtensions, function (plugin, idx) {\r\n if (!_isPluginPresent(plugin, thePlugins)) {\r\n newConfigExtensions[_DYN_PUSH /* @min:%2epush */](plugin);\r\n }\r\n else {\r\n removed = true;\r\n }\r\n });\r\n _configExtensions = newConfigExtensions;\r\n // Re-Create the channel config\r\n var newChannelConfig = [];\r\n if (_channelConfig) {\r\n arrForEach(_channelConfig, function (queue, idx) {\r\n var newQueue = [];\r\n arrForEach(queue, function (channel) {\r\n if (!_isPluginPresent(channel, thePlugins)) {\r\n newQueue[_DYN_PUSH /* @min:%2epush */](channel);\r\n }\r\n else {\r\n removed = true;\r\n }\r\n });\r\n newChannelConfig[_DYN_PUSH /* @min:%2epush */](newQueue);\r\n });\r\n _channelConfig = newChannelConfig;\r\n }\r\n removeComplete && removeComplete(removed);\r\n _startInternalLogTimer();\r\n });\r\n unloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);\r\n }\r\n else {\r\n removeComplete(false);\r\n }\r\n }\r\n function _flushInternalLogs() {\r\n if (_self[_DYN_LOGGER /* @min:%2elogger */] && _self[_DYN_LOGGER /* @min:%2elogger */].queue) {\r\n var queue = _self[_DYN_LOGGER /* @min:%2elogger */].queue.slice(0);\r\n _self[_DYN_LOGGER /* @min:%2elogger */].queue[_DYN_LENGTH /* @min:%2elength */] = 0;\r\n arrForEach(queue, function (logMessage) {\r\n var _a;\r\n var item = (_a = {},\r\n _a[_DYN_NAME /* @min:name */] = _internalLogsEventName ? _internalLogsEventName : \"InternalMessageId: \" + logMessage[_DYN_MESSAGE_ID /* @min:%2emessageId */],\r\n _a.iKey = getCfgValue(_config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */]),\r\n _a.time = toISOString(new Date()),\r\n _a.baseType = _InternalLogMessage.dataType,\r\n _a.baseData = { message: logMessage[_DYN_MESSAGE /* @min:%2emessage */] },\r\n _a);\r\n _self.track(item);\r\n });\r\n }\r\n }\r\n function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {\r\n if (_channelControl) {\r\n return _channelControl[_DYN_FLUSH /* @min:%2eflush */](isAsync, callBack, sendReason || 6 /* SendRequestReason.SdkUnload */, cbTimeout);\r\n }\r\n callBack && callBack(false);\r\n return true;\r\n }\r\n function _initDebugListener() {\r\n var disableDbgExt = getCfgValue(_config.disableDbgExt);\r\n if (disableDbgExt === true && _debugListener) {\r\n // Remove any previously loaded debug listener\r\n _notificationManager[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */](_debugListener);\r\n _debugListener = null;\r\n }\r\n if (_notificationManager && !_debugListener && disableDbgExt !== true) {\r\n _debugListener = getDebugListener(_config);\r\n _notificationManager[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */](_debugListener);\r\n }\r\n }\r\n function _initPerfManager() {\r\n var enablePerfMgr = getCfgValue(_config.enablePerfMgr);\r\n if (!enablePerfMgr && _cfgPerfManager) {\r\n // Remove any existing config based performance manager\r\n _cfgPerfManager = null;\r\n }\r\n if (enablePerfMgr) {\r\n // Set the performance manager creation function if not defined\r\n getSetValue(_config, STR_CREATE_PERF_MGR, _createPerfManager);\r\n }\r\n }\r\n function _initExtConfig() {\r\n var extConfig = getSetValue(_config, STR_EXTENSION_CONFIG, {});\r\n extConfig.NotificationManager = _notificationManager;\r\n }\r\n function _doUpdate(updateState) {\r\n var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self);\r\n updateCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](_startInternalLogTimer);\r\n if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {\r\n updateCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](updateState);\r\n }\r\n }\r\n function _logOrThrowError(message) {\r\n var logger = _self[_DYN_LOGGER /* @min:%2elogger */];\r\n if (logger) {\r\n // there should always be a logger\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, message);\r\n _startInternalLogTimer();\r\n }\r\n else {\r\n throwError(message);\r\n }\r\n }\r\n });\r\n }\r\n BaseCore.prototype.initialize = function (config, extensions, logger, notificationManager) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.getTransmissionControls = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n BaseCore.prototype.track = function (telemetryItem) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.getProcessTelContext = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n BaseCore.prototype.getNotifyMgr = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.\r\n * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be\r\n * called.\r\n * @param {INotificationListener} listener - An INotificationListener object.\r\n */\r\n BaseCore.prototype.addNotificationListener = function (listener) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - INotificationListener to remove.\r\n */\r\n BaseCore.prototype.removeNotificationListener = function (listener) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Get the current cookie manager for this instance\r\n */\r\n BaseCore.prototype.getCookieMgr = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Set the current cookie manager for this instance\r\n * @param cookieMgr - The manager, if set to null/undefined will cause the default to be created\r\n */\r\n BaseCore.prototype.setCookieMgr = function (cookieMgr) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.getPerfMgr = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n BaseCore.prototype.setPerfMgr = function (perfMgr) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.eventCnt = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 0;\r\n };\r\n /**\r\n * Enable the timer that checks the logger.queue for log messages to be flushed.\r\n * Note: Since 3.0.1 and 2.8.13 this is no longer an interval timer but is a normal\r\n * timer that is only started when this function is called and then subsequently\r\n * only _if_ there are any logger.queue messages to be sent.\r\n */\r\n BaseCore.prototype.pollInternalLogs = function (eventName) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 0;\r\n };\r\n /**\r\n * Stop the timer that log messages from logger.queue when available\r\n */\r\n BaseCore.prototype.stopPollingInternalLogs = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add a telemetry processor to decorate or drop telemetry events.\r\n * @param telemetryInitializer - The Telemetry Initializer function\r\n * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed\r\n */\r\n BaseCore.prototype.addTelemetryInitializer = function (telemetryInitializer) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered\r\n * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous\r\n * unload call return `true` stating that all plugins reported that they also unloaded, the recommended\r\n * approach is to create a new instance and initialize that instance.\r\n * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable\r\n * to successfully remove any global references or they may just be completing the unload process asynchronously.\r\n * @param isAsync - Can the unload be performed asynchronously (default)\r\n * @param unloadComplete - An optional callback that will be called once the unload has completed\r\n * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.\r\n */\r\n BaseCore.prototype.unload = function (isAsync, unloadComplete, cbTimeout) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.getPlugin = function (pluginIdentifier) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Add a new plugin to the installation\r\n * @param plugin - The new plugin to add\r\n * @param replaceExisting - should any existing plugin be replaced, default is false\r\n * @param doAsync - Should the add be performed asynchronously\r\n * @param addCb - [Optional] callback to call after the plugin has been added\r\n */\r\n BaseCore.prototype.addPlugin = function (plugin, replaceExisting, doAsync, addCb) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Returns the unique event namespace that should be used\r\n */\r\n BaseCore.prototype.evtNamespace = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Add an unload handler that will be called when the SDK is being unloaded\r\n * @param handler - the handler\r\n */\r\n BaseCore.prototype.addUnloadCb = function (handler) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Flush and send any batched / cached data immediately\r\n * @param async - send data asynchronously when true (defaults to true)\r\n * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.\r\n * If the caller doesn't return true the caller should assume that it may never be called.\r\n * @param sendReason - specify the reason that you are calling \"flush\" defaults to ManualFlush (1) if not specified\r\n * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called\r\n */\r\n BaseCore.prototype.flush = function (isAsync, callBack, sendReason) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Gets the current distributed trace context for this instance if available\r\n * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true\r\n */\r\n BaseCore.prototype.getTraceCtx = function (createNew) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Sets the current distributed trace context for this instance if available\r\n */\r\n BaseCore.prototype.setTraceCtx = function (newTracectx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.releaseQueue = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.\r\n * @param updateCtx - The plugin update context\r\n * @param updateState - The Update State\r\n * @returns boolean - True means the extension class will call updateState otherwise the Core will\r\n */\r\n BaseCore.prototype._updateHook = function (updateCtx, updateState) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n return BaseCore;\r\n}());\r\nexport { BaseCore };\r\n//# sourceMappingURL=BaseCore.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_ADD_NOTIFICATION_LIS1, _DYN_IS_ASYNC, _DYN_IS_CHILD_EVT, _DYN_LISTENERS, _DYN_PUSH, _DYN_REMOVE_NOTIFICATION_2, _DYN_SPLICE } from \"../__DynamicConstants\";\r\nimport { arrForEach, arrIndexOf } from \"./HelperFuncs\";\r\nimport { STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_EVENTS_SENT, STR_PERF_EVENT } from \"./InternalConstants\";\r\nfunction _runListeners(listeners, name, isAsync, callback) {\r\n arrForEach(listeners, function (listener) {\r\n if (listener && listener[name]) {\r\n if (isAsync) {\r\n setTimeout(function () { return callback(listener); }, 0);\r\n }\r\n else {\r\n try {\r\n callback(listener);\r\n }\r\n catch (e) {\r\n // Catch errors to ensure we don't block sending the requests\r\n }\r\n }\r\n }\r\n });\r\n}\r\n/**\r\n * Class to manage sending notifications to all the listeners.\r\n */\r\nvar NotificationManager = /** @class */ (function () {\r\n function NotificationManager(config) {\r\n this.listeners = [];\r\n var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;\r\n dynamicProto(NotificationManager, this, function (_self) {\r\n _self[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */] = function (listener) {\r\n _self.listeners[_DYN_PUSH /* @min:%2epush */](listener);\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - AWTNotificationListener to remove.\r\n */\r\n _self[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */] = function (listener) {\r\n var index = arrIndexOf(_self[_DYN_LISTENERS /* @min:%2elisteners */], listener);\r\n while (index > -1) {\r\n _self.listeners[_DYN_SPLICE /* @min:%2esplice */](index, 1);\r\n index = arrIndexOf(_self[_DYN_LISTENERS /* @min:%2elisteners */], listener);\r\n }\r\n };\r\n /**\r\n * Notification for events sent.\r\n * @param {ITelemetryItem[]} events - The array of events that have been sent.\r\n */\r\n _self[STR_EVENTS_SENT /* @min:%2eeventsSent */] = function (events) {\r\n _runListeners(_self[_DYN_LISTENERS /* @min:%2elisteners */], STR_EVENTS_SENT, true, function (listener) {\r\n listener[STR_EVENTS_SENT /* @min:%2eeventsSent */](events);\r\n });\r\n };\r\n /**\r\n * Notification for events being discarded.\r\n * @param {ITelemetryItem[]} events - The array of events that have been discarded by the SDK.\r\n * @param {number} reason - The reason for which the SDK discarded the events. The EventsDiscardedReason\r\n * constant should be used to check the different values.\r\n */\r\n _self[STR_EVENTS_DISCARDED /* @min:%2eeventsDiscarded */] = function (events, reason) {\r\n _runListeners(_self[_DYN_LISTENERS /* @min:%2elisteners */], STR_EVENTS_DISCARDED, true, function (listener) {\r\n listener[STR_EVENTS_DISCARDED /* @min:%2eeventsDiscarded */](events, reason);\r\n });\r\n };\r\n /**\r\n * [Optional] A function called when the events have been requested to be sent to the sever.\r\n * @param {number} sendReason - The reason why the event batch is being sent.\r\n * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.\r\n */\r\n _self[STR_EVENTS_SEND_REQUEST /* @min:%2eeventsSendRequest */] = function (sendReason, isAsync) {\r\n _runListeners(_self[_DYN_LISTENERS /* @min:%2elisteners */], STR_EVENTS_SEND_REQUEST, isAsync, function (listener) {\r\n listener[STR_EVENTS_SEND_REQUEST /* @min:%2eeventsSendRequest */](sendReason, isAsync);\r\n });\r\n };\r\n _self[STR_PERF_EVENT /* @min:%2eperfEvent */] = function (perfEvent) {\r\n if (perfEvent) {\r\n // Send all events or only parent events\r\n if (perfEvtsSendAll || !perfEvent[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */]()) {\r\n _runListeners(_self[_DYN_LISTENERS /* @min:%2elisteners */], STR_PERF_EVENT, false, function (listener) {\r\n if (perfEvent[_DYN_IS_ASYNC /* @min:%2eisAsync */]) {\r\n setTimeout(function () { return listener[STR_PERF_EVENT /* @min:%2eperfEvent */](perfEvent); }, 0);\r\n }\r\n else {\r\n listener[STR_PERF_EVENT /* @min:%2eperfEvent */](perfEvent);\r\n }\r\n });\r\n }\r\n }\r\n };\r\n });\r\n }\r\n /**\r\n * Adds a notification listener.\r\n * @param {INotificationListener} listener - The notification listener to be added.\r\n */\r\n NotificationManager.prototype.addNotificationListener = function (listener) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - AWTNotificationListener to remove.\r\n */\r\n NotificationManager.prototype.removeNotificationListener = function (listener) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Notification for events sent.\r\n * @param {ITelemetryItem[]} events - The array of events that have been sent.\r\n */\r\n NotificationManager.prototype.eventsSent = function (events) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Notification for events being discarded.\r\n * @param {ITelemetryItem[]} events - The array of events that have been discarded by the SDK.\r\n * @param {number} reason - The reason for which the SDK discarded the events. The EventsDiscardedReason\r\n * constant should be used to check the different values.\r\n */\r\n NotificationManager.prototype.eventsDiscarded = function (events, reason) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * [Optional] A function called when the events have been requested to be sent to the sever.\r\n * @param {number} sendReason - The reason why the event batch is being sent.\r\n * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.\r\n */\r\n NotificationManager.prototype.eventsSendRequest = function (sendReason, isAsync) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return NotificationManager;\r\n}());\r\nexport { NotificationManager };\r\n//# sourceMappingURL=NotificationManager.js.map","import { __extends } from \"tslib\";\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_GET_NOTIFY_MGR, _DYN_INITIALIZE, _DYN_NAME } from \"../__DynamicConstants\";\r\nimport { BaseCore } from \"./BaseCore\";\r\nimport { DiagnosticLogger } from \"./DiagnosticLogger\";\r\nimport { isNullOrUndefined, throwError } from \"./HelperFuncs\";\r\nimport { STR_EVENTS_DISCARDED, STR_GET_PERF_MGR } from \"./InternalConstants\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { doPerf } from \"./PerfManager\";\r\nvar AppInsightsCore = /** @class */ (function (_super) {\r\n __extends(AppInsightsCore, _super);\r\n function AppInsightsCore() {\r\n var _this = _super.call(this) || this;\r\n dynamicProto(AppInsightsCore, _this, function (_self, _base) {\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {\r\n _base[_DYN_INITIALIZE /* @min:%2einitialize */](config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));\r\n };\r\n _self.track = function (telemetryItem) {\r\n doPerf(_self[STR_GET_PERF_MGR /* @min:%2egetPerfMgr */](), function () { return \"AppInsightsCore:track\"; }, function () {\r\n if (telemetryItem === null) {\r\n _notifyInvalidEvent(telemetryItem);\r\n // throw error\r\n throwError(\"Invalid telemetry item\");\r\n }\r\n // do basic validation before sending it through the pipeline\r\n _validateTelemetryItem(telemetryItem);\r\n _base.track(telemetryItem);\r\n }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));\r\n };\r\n function _validateTelemetryItem(telemetryItem) {\r\n if (isNullOrUndefined(telemetryItem[_DYN_NAME /* @min:%2ename */])) {\r\n _notifyInvalidEvent(telemetryItem);\r\n throwError(\"telemetry name required\");\r\n }\r\n }\r\n function _notifyInvalidEvent(telemetryItem) {\r\n var manager = _self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */]();\r\n if (manager) {\r\n manager[STR_EVENTS_DISCARDED /* @min:%2eeventsDiscarded */]([telemetryItem], 2 /* eEventsDiscardedReason.InvalidEvent */);\r\n }\r\n }\r\n });\r\n return _this;\r\n }\r\n AppInsightsCore.prototype.initialize = function (config, extensions, logger, notificationManager) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n AppInsightsCore.prototype.track = function (telemetryItem) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return AppInsightsCore;\r\n}(BaseCore));\r\nexport { AppInsightsCore };\r\n//# sourceMappingURL=AppInsightsCore.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { createEnumStyle } from \"../JavaScriptSDK.Enums/EnumHelperFuncs\";\r\n/**\r\n * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.\r\n */\r\nexport var EventsDiscardedReason = createEnumStyle({\r\n /**\r\n * Unknown.\r\n */\r\n Unknown: 0 /* eEventsDiscardedReason.Unknown */,\r\n /**\r\n * Status set to non-retryable.\r\n */\r\n NonRetryableStatus: 1 /* eEventsDiscardedReason.NonRetryableStatus */,\r\n /**\r\n * The event is invalid.\r\n */\r\n InvalidEvent: 2 /* eEventsDiscardedReason.InvalidEvent */,\r\n /**\r\n * The size of the event is too large.\r\n */\r\n SizeLimitExceeded: 3 /* eEventsDiscardedReason.SizeLimitExceeded */,\r\n /**\r\n * The server is not accepting events from this instrumentation key.\r\n */\r\n KillSwitch: 4 /* eEventsDiscardedReason.KillSwitch */,\r\n /**\r\n * The event queue is full.\r\n */\r\n QueueFull: 5 /* eEventsDiscardedReason.QueueFull */\r\n});\r\n//# sourceMappingURL=EventsDiscardedReason.js.map","/**\r\n * Real Time profile (default profile). RealTime Latency events are sent every 1 sec and\r\n * Normal Latency events are sent every 2 sec.\r\n */\r\nexport var RT_PROFILE = \"REAL_TIME\";\r\n/**\r\n * Near Real Time profile. RealTime Latency events are sent every 3 sec and\r\n * Normal Latency events are sent every 6 sec.\r\n */\r\nexport var NRT_PROFILE = \"NEAR_REAL_TIME\";\r\n/**\r\n * Best Effort. RealTime Latency events are sent every 9 sec and\r\n * Normal Latency events are sent every 18 sec.\r\n */\r\nexport var BE_PROFILE = \"BEST_EFFORT\";\r\n//# sourceMappingURL=DataModels.js.map","/**\r\n* EventBatch.ts\r\n* @author Nev Wylie (newylie)\r\n* @copyright Microsoft 2020\r\n*/\r\nimport { isNullOrUndefined, isValueAssigned } from \"@microsoft/1ds-core-js\";\r\nimport { STR_EMPTY, STR_MSFPC } from \"./InternalConstants\";\r\nfunction _getEventMsfpc(theEvent) {\r\n var intWeb = ((theEvent.ext || {})[\"intweb\"]);\r\n if (intWeb && isValueAssigned(intWeb[STR_MSFPC])) {\r\n return intWeb[STR_MSFPC];\r\n }\r\n return null;\r\n}\r\nfunction _getMsfpc(theEvents) {\r\n var msfpc = null;\r\n for (var lp = 0; msfpc === null && lp < theEvents.length; lp++) {\r\n msfpc = _getEventMsfpc(theEvents[lp]);\r\n }\r\n return msfpc;\r\n}\r\n/**\r\n* This class defines a \"batch\" events related to a specific iKey, it is used by the PostChannel and HttpManager\r\n* to collect and transfer ownership of events without duplicating them in-memory. This reduces the previous\r\n* array duplication and shared ownership issues that occurred due to race conditions caused by the async nature\r\n* of sending requests.\r\n*/\r\nvar EventBatch = /** @class */ (function () {\r\n /**\r\n * Private constructor so that caller is forced to use the static create method.\r\n * @param iKey - The iKey to associate with the events (not validated)\r\n * @param addEvents - The optional collection of events to assign to this batch - defaults to an empty array.\r\n */\r\n function EventBatch(iKey, addEvents) {\r\n var events = addEvents ? [].concat(addEvents) : [];\r\n var _self = this;\r\n var _msfpc = _getMsfpc(events);\r\n _self.iKey = function () {\r\n return iKey;\r\n };\r\n _self.Msfpc = function () {\r\n // return the cached value unless it's undefined -- used to avoid cpu\r\n return _msfpc || STR_EMPTY;\r\n };\r\n _self.count = function () {\r\n return events.length;\r\n };\r\n _self.events = function () {\r\n return events;\r\n };\r\n _self.addEvent = function (theEvent) {\r\n if (theEvent) {\r\n events.push(theEvent);\r\n if (!_msfpc) {\r\n // Not found so try and find one\r\n _msfpc = _getEventMsfpc(theEvent);\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n _self.split = function (fromEvent, numEvents) {\r\n // Create a new batch with the same iKey\r\n var theEvents;\r\n if (fromEvent < events.length) {\r\n var cnt = events.length - fromEvent;\r\n if (!isNullOrUndefined(numEvents)) {\r\n cnt = numEvents < cnt ? numEvents : cnt;\r\n }\r\n theEvents = events.splice(fromEvent, cnt);\r\n // reset the fetched msfpc value\r\n _msfpc = _getMsfpc(events);\r\n }\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n }\r\n /**\r\n * Creates a new Event Batch object\r\n * @param iKey The iKey associated with this batch of events\r\n */\r\n EventBatch.create = function (iKey, theEvents) {\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n return EventBatch;\r\n}());\r\nexport { EventBatch };\r\n//# sourceMappingURL=EventBatch.js.map","/**\r\n* ClockSkewManager.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\n/**\r\n* Class to manage clock skew correction.\r\n*/\r\nvar ClockSkewManager = /** @class */ (function () {\r\n function ClockSkewManager() {\r\n var _allowRequestSending = true;\r\n var _shouldAddClockSkewHeaders = true;\r\n var _isFirstRequest = true;\r\n var _clockSkewHeaderValue = \"use-collector-delta\";\r\n var _clockSkewSet = false;\r\n dynamicProto(ClockSkewManager, this, function (_self) {\r\n /**\r\n * Determine if requests can be sent.\r\n * @returns True if requests can be sent, false otherwise.\r\n */\r\n _self.allowRequestSending = function () {\r\n return _allowRequestSending;\r\n };\r\n /**\r\n * Tells the ClockSkewManager that it should assume that the first request has now been sent,\r\n * If this method had not yet been called AND the clock Skew had not been set this will set\r\n * allowRequestSending to false until setClockSet() is called.\r\n */\r\n _self.firstRequestSent = function () {\r\n if (_isFirstRequest) {\r\n _isFirstRequest = false;\r\n if (!_clockSkewSet) {\r\n // Block sending until we get the first clock Skew\r\n _allowRequestSending = false;\r\n }\r\n }\r\n };\r\n /**\r\n * Determine if clock skew headers should be added to the request.\r\n * @returns True if clock skew headers should be added, false otherwise.\r\n */\r\n _self.shouldAddClockSkewHeaders = function () {\r\n return _shouldAddClockSkewHeaders;\r\n };\r\n /**\r\n * Gets the clock skew header value.\r\n * @returns The clock skew header value.\r\n */\r\n _self.getClockSkewHeaderValue = function () {\r\n return _clockSkewHeaderValue;\r\n };\r\n /**\r\n * Sets the clock skew header value. Once clock skew is set this method\r\n * is no-op.\r\n * @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.\r\n */\r\n _self.setClockSkew = function (timeDeltaInMillis) {\r\n if (!_clockSkewSet) {\r\n if (timeDeltaInMillis) {\r\n _clockSkewHeaderValue = timeDeltaInMillis;\r\n _shouldAddClockSkewHeaders = true;\r\n _clockSkewSet = true;\r\n }\r\n else {\r\n _shouldAddClockSkewHeaders = false;\r\n }\r\n // Unblock sending\r\n _allowRequestSending = true;\r\n }\r\n };\r\n });\r\n }\r\n /**\r\n * Determine if the request can be sent.\r\n * @returns True if requests can be sent, false otherwise.\r\n */\r\n ClockSkewManager.prototype.allowRequestSending = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Tells the ClockSkewManager that it should assume that the first request has now been sent,\r\n * If this method had not yet been called AND the clock Skew had not been set this will set\r\n * allowRequestSending to false until setClockSet() is called.\r\n */\r\n ClockSkewManager.prototype.firstRequestSent = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Determine if clock skew headers should be added to the request.\r\n * @returns True if clock skew headers should be added, false otherwise.\r\n */\r\n ClockSkewManager.prototype.shouldAddClockSkewHeaders = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Gets the clock skew header value.\r\n * @returns The clock skew header value.\r\n */\r\n ClockSkewManager.prototype.getClockSkewHeaderValue = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Sets the clock skew header value. Once clock skew is set this method\r\n * is no-op.\r\n * @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.\r\n */\r\n ClockSkewManager.prototype.setClockSkew = function (timeDeltaInMillis) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return ClockSkewManager;\r\n}());\r\nexport default ClockSkewManager;\r\n//# sourceMappingURL=ClockSkewManager.js.map","/**\r\n* KillSwitch.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrForEach, dateNow, strTrim } from \"@microsoft/1ds-core-js\";\r\nvar SecToMsMultiplier = 1000;\r\n/**\r\n* Class to stop certain tenants sending events.\r\n*/\r\nvar KillSwitch = /** @class */ (function () {\r\n function KillSwitch() {\r\n var _killedTokenDictionary = {};\r\n function _normalizeTenants(values) {\r\n var result = [];\r\n if (values) {\r\n arrForEach(values, function (value) {\r\n result.push(strTrim(value));\r\n });\r\n }\r\n return result;\r\n }\r\n dynamicProto(KillSwitch, this, function (_self) {\r\n _self.setKillSwitchTenants = function (killTokens, killDuration) {\r\n if (killTokens && killDuration) {\r\n try {\r\n var killedTokens = _normalizeTenants(killTokens.split(\",\"));\r\n if (killDuration === \"this-request-only\") {\r\n return killedTokens;\r\n }\r\n var durationMs = parseInt(killDuration, 10) * SecToMsMultiplier;\r\n for (var i = 0; i < killedTokens.length; ++i) {\r\n _killedTokenDictionary[killedTokens[i]] = dateNow() + durationMs;\r\n }\r\n }\r\n catch (ex) {\r\n return [];\r\n }\r\n }\r\n return [];\r\n };\r\n _self.isTenantKilled = function (tenantToken) {\r\n var killDictionary = _killedTokenDictionary;\r\n var name = strTrim(tenantToken);\r\n if (killDictionary[name] !== undefined && killDictionary[name] > dateNow()) {\r\n return true;\r\n }\r\n delete killDictionary[name];\r\n return false;\r\n };\r\n });\r\n }\r\n /**\r\n * Set the tenants that are to be killed along with the duration. If the duration is\r\n * a special value identifying that the tokens are too be killed for only this request, then\r\n * a array of tokens is returned.\r\n * @param killedTokens - Tokens that are too be marked to be killed.\r\n * @param killDuration - The duration for which the tokens are to be killed.\r\n * @returns The tokens that are killed only for this given request.\r\n */\r\n KillSwitch.prototype.setKillSwitchTenants = function (killTokens, killDuration) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return [];\r\n };\r\n /**\r\n * Determing if the given tenant token has been killed for the moment.\r\n * @param tenantToken - The token to be checked.\r\n * @returns True if token has been killed, false otherwise.\r\n */\r\n KillSwitch.prototype.isTenantKilled = function (tenantToken) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n return KillSwitch;\r\n}());\r\nexport default KillSwitch;\r\n//# sourceMappingURL=KillSwitch.js.map","/**\r\n* RetryPolicy.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nvar RandomizationLowerThreshold = 0.8;\r\nvar RandomizationUpperThreshold = 1.2;\r\nvar BaseBackoff = 3000;\r\nvar MaxBackoff = 600000;\r\n/**\r\n * Determine if the request should be retried for the given status code.\r\n * The below expression reads that we should only retry for:\r\n * - HttpStatusCodes that are smaller than 300.\r\n * - HttpStatusCodes greater or equal to 500 (except for 501-NotImplement\r\n * and 505-HttpVersionNotSupport).\r\n * - HttpStatusCode 408-RequestTimeout.\r\n * - HttpStatusCode 429.\r\n * This is based on Microsoft.WindowsAzure.Storage.RetryPolicies.ExponentialRetry class\r\n * @param httpStatusCode - The status code returned for the request.\r\n * @returns True if request should be retried, false otherwise.\r\n */\r\nexport function retryPolicyShouldRetryForStatus(httpStatusCode) {\r\n /* tslint:disable:triple-equals */\r\n // Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value\r\n return !((httpStatusCode >= 300 && httpStatusCode < 500 && httpStatusCode != 408 && httpStatusCode != 429)\r\n || (httpStatusCode == 501)\r\n || (httpStatusCode == 505));\r\n /* tslint:enable:triple-equals */\r\n}\r\n/**\r\n * Gets the number of milliseconds to back off before retrying the request. The\r\n * back off duration is exponentially scaled based on the number of retries already\r\n * done for the request.\r\n * @param retriesSoFar - The number of times the request has already been retried.\r\n * @returns The back off duration for the request before it can be retried.\r\n */\r\nexport function retryPolicyGetMillisToBackoffForRetry(retriesSoFar) {\r\n var waitDuration = 0;\r\n var minBackoff = BaseBackoff * RandomizationLowerThreshold;\r\n var maxBackoff = BaseBackoff * RandomizationUpperThreshold;\r\n var randomBackoff = Math.floor(Math.random() * (maxBackoff - minBackoff)) + minBackoff;\r\n waitDuration = Math.pow(2, retriesSoFar) * randomBackoff;\r\n return Math.min(waitDuration, MaxBackoff);\r\n}\r\n//# sourceMappingURL=RetryPolicy.js.map","/**\r\n* Serializer.ts\r\n* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)\r\n* @copyright Microsoft 2018-2020\r\n*/\r\n// @skip-file-minify\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrIndexOf, doPerf, getCommonSchemaMetaData, getTenantId, isArray, isValueAssigned, objForEachKey, sanitizeProperty, strStartsWith } from \"@microsoft/1ds-core-js\";\r\nimport { EventBatch } from \"./EventBatch\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n/**\r\n * Note: This is an optimization for V8-based browsers. When V8 concatenates a string,\r\n * the strings are only joined logically using a \"cons string\" or \"constructed/concatenated\r\n * string\". These containers keep references to one another and can result in very large\r\n * memory usage. For example, if a 2MB string is constructed by concatenating 4 bytes\r\n * together at a time, the memory usage will be ~44MB; so ~22x increase. The strings are\r\n * only joined together when an operation requiring their joining takes place, such as\r\n * substr(). This function is called when adding data to this buffer to ensure these\r\n * types of strings are periodically joined to reduce the memory footprint.\r\n * Setting to every 20 events as the JSON.stringify() may have joined many strings\r\n * and calling this too much causes a minor delay while processing.\r\n */\r\nvar _MAX_STRING_JOINS = 20;\r\nvar RequestSizeLimitBytes = 3984588; // approx 3.8 Mb\r\nvar BeaconRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)\r\nvar MaxRecordSize = 2000000; // approx 2 Mb\r\nvar MaxBeaconRecordSize = Math.min(MaxRecordSize, BeaconRequestSizeLimitBytes);\r\nvar metadata = \"metadata\";\r\nvar f = \"f\";\r\nvar rCheckDot = /\\./;\r\n/**\r\n* Class to handle serialization of event and request.\r\n* Currently uses Bond for serialization. Please note that this may be subject to change.\r\n*/\r\nvar Serializer = /** @class */ (function () {\r\n function Serializer(perfManager, valueSanitizer, stringifyObjects, enableCompoundKey) {\r\n var strData = \"data\";\r\n var strBaseData = \"baseData\";\r\n var strExt = \"ext\";\r\n var _checkForCompoundkey = !!enableCompoundKey;\r\n var _processSubMetaData = true;\r\n var _theSanitizer = valueSanitizer;\r\n var _isReservedCache = {};\r\n dynamicProto(Serializer, this, function (_self) {\r\n _self.createPayload = function (retryCnt, isTeardown, isSync, isReducedPayload, sendReason, sendType) {\r\n return {\r\n apiKeys: [],\r\n payloadBlob: STR_EMPTY,\r\n overflow: null,\r\n sizeExceed: [],\r\n failedEvts: [],\r\n batches: [],\r\n numEvents: 0,\r\n retryCnt: retryCnt,\r\n isTeardown: isTeardown,\r\n isSync: isSync,\r\n isBeacon: isReducedPayload,\r\n sendType: sendType,\r\n sendReason: sendReason\r\n };\r\n };\r\n _self.appendPayload = function (payload, theBatch, maxEventsPerBatch) {\r\n var canAddEvents = payload && theBatch && !payload.overflow;\r\n if (canAddEvents) {\r\n doPerf(perfManager, function () { return \"Serializer:appendPayload\"; }, function () {\r\n var theEvents = theBatch.events();\r\n var payloadBlob = payload.payloadBlob;\r\n var payloadEvents = payload.numEvents;\r\n var eventsAdded = false;\r\n var sizeExceeded = [];\r\n var failedEvts = [];\r\n var isBeaconPayload = payload.isBeacon;\r\n var requestMaxSize = isBeaconPayload ? BeaconRequestSizeLimitBytes : RequestSizeLimitBytes;\r\n var recordMaxSize = isBeaconPayload ? MaxBeaconRecordSize : MaxRecordSize;\r\n var lp = 0;\r\n var joinCount = 0;\r\n while (lp < theEvents.length) {\r\n var theEvent = theEvents[lp];\r\n if (theEvent) {\r\n if (payloadEvents >= maxEventsPerBatch) {\r\n // Maximum events per payload reached, so don't add any more\r\n payload.overflow = theBatch.split(lp);\r\n break;\r\n }\r\n var eventBlob = _self.getEventBlob(theEvent);\r\n if (eventBlob && eventBlob.length <= recordMaxSize) {\r\n // This event will fit into the payload\r\n var blobLength = eventBlob.length;\r\n var currentSize = payloadBlob.length;\r\n if (currentSize + blobLength > requestMaxSize) {\r\n // Request or batch size exceeded, so don't add any more to the payload\r\n payload.overflow = theBatch.split(lp);\r\n break;\r\n }\r\n if (payloadBlob) {\r\n payloadBlob += \"\\n\";\r\n }\r\n payloadBlob += eventBlob;\r\n joinCount++;\r\n // v8 memory optimization only\r\n if (joinCount > _MAX_STRING_JOINS) {\r\n // this substr() should cause the constructed string to join\r\n payloadBlob.substr(0, 1);\r\n joinCount = 0;\r\n }\r\n eventsAdded = true;\r\n payloadEvents++;\r\n }\r\n else {\r\n if (eventBlob) {\r\n // Single event size exceeded so remove from the batch\r\n sizeExceeded.push(theEvent);\r\n }\r\n else {\r\n failedEvts.push(theEvent);\r\n }\r\n // We also need to remove this event from the existing array, otherwise a notification will be sent\r\n // indicating that it was successfully sent\r\n theEvents.splice(lp, 1);\r\n lp--;\r\n }\r\n }\r\n lp++;\r\n }\r\n if (sizeExceeded && sizeExceeded.length > 0) {\r\n payload.sizeExceed.push(EventBatch.create(theBatch.iKey(), sizeExceeded));\r\n // Remove the exceeded events from the batch\r\n }\r\n if (failedEvts && failedEvts.length > 0) {\r\n payload.failedEvts.push(EventBatch.create(theBatch.iKey(), failedEvts));\r\n // Remove the failed events from the batch\r\n }\r\n if (eventsAdded) {\r\n payload.batches.push(theBatch);\r\n payload.payloadBlob = payloadBlob;\r\n payload.numEvents = payloadEvents;\r\n var apiKey = theBatch.iKey();\r\n if (arrIndexOf(payload.apiKeys, apiKey) === -1) {\r\n payload.apiKeys.push(apiKey);\r\n }\r\n }\r\n }, function () { return ({ payload: payload, theBatch: { iKey: theBatch.iKey(), evts: theBatch.events() }, max: maxEventsPerBatch }); });\r\n }\r\n return canAddEvents;\r\n };\r\n _self.getEventBlob = function (eventData) {\r\n try {\r\n return doPerf(perfManager, function () { return \"Serializer.getEventBlob\"; }, function () {\r\n var serializedEvent = {};\r\n // Adding as dynamic keys for v8 performance\r\n serializedEvent.name = eventData.name;\r\n serializedEvent.time = eventData.time;\r\n serializedEvent.ver = eventData.ver;\r\n serializedEvent.iKey = \"o:\" + getTenantId(eventData.iKey);\r\n // Assigning local var so usage in part b/c don't throw if there is no ext\r\n var serializedExt = {};\r\n // Part A\r\n var eventExt = eventData[strExt];\r\n if (eventExt) {\r\n // Only assign ext if the event had one (There are tests covering this use case)\r\n serializedEvent[strExt] = serializedExt;\r\n objForEachKey(eventExt, function (key, value) {\r\n var data = serializedExt[key] = {};\r\n // Don't include a metadata callback as we don't currently set metadata Part A fields\r\n _processPathKeys(value, data, \"ext.\" + key, true, null, null, true);\r\n });\r\n }\r\n var serializedData = serializedEvent[strData] = {};\r\n serializedData.baseType = eventData.baseType;\r\n var serializedBaseData = serializedData[strBaseData] = {};\r\n // Part B\r\n _processPathKeys(eventData.baseData, serializedBaseData, strBaseData, false, [strBaseData], function (pathKeys, name, value) {\r\n _addJSONPropertyMetaData(serializedExt, pathKeys, name, value);\r\n }, _processSubMetaData);\r\n // Part C\r\n _processPathKeys(eventData.data, serializedData, strData, false, [], function (pathKeys, name, value) {\r\n _addJSONPropertyMetaData(serializedExt, pathKeys, name, value);\r\n }, _processSubMetaData);\r\n return JSON.stringify(serializedEvent);\r\n }, function () { return ({ item: eventData }); });\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n };\r\n function _isReservedField(path, name) {\r\n var result = _isReservedCache[path];\r\n if (result === undefined) {\r\n if (path.length >= 7) {\r\n // Do not allow the changing of fields located in the ext.metadata or ext.web extension\r\n result = strStartsWith(path, \"ext.metadata\") || strStartsWith(path, \"ext.web\");\r\n }\r\n _isReservedCache[path] = result;\r\n }\r\n return result;\r\n }\r\n function _processPathKeys(srcObj, target, thePath, checkReserved, metadataPathKeys, metadataCallback, processSubKeys) {\r\n objForEachKey(srcObj, function (key, srcValue) {\r\n var prop = null;\r\n if (srcValue || isValueAssigned(srcValue)) {\r\n var path = thePath;\r\n var name_1 = key;\r\n var theMetaPathKeys = metadataPathKeys;\r\n var destObj = target;\r\n // Handle keys with embedded '.', like \"TestObject.testProperty\"\r\n if (_checkForCompoundkey && !checkReserved && rCheckDot.test(key)) {\r\n var subKeys = key.split(\".\");\r\n var keyLen = subKeys.length;\r\n if (keyLen > 1) {\r\n if (theMetaPathKeys) {\r\n // Create a copy of the meta path keys so we can add the extra ones\r\n theMetaPathKeys = theMetaPathKeys.slice();\r\n }\r\n for (var lp = 0; lp < keyLen - 1; lp++) {\r\n var subKey = subKeys[lp];\r\n // Add/reuse the sub key object\r\n destObj = destObj[subKey] = destObj[subKey] || {};\r\n path += \".\" + subKey;\r\n if (theMetaPathKeys) {\r\n theMetaPathKeys.push(subKey);\r\n }\r\n }\r\n name_1 = subKeys[keyLen - 1];\r\n }\r\n }\r\n var isReserved = checkReserved && _isReservedField(path, name_1);\r\n if (!isReserved && _theSanitizer && _theSanitizer.handleField(path, name_1)) {\r\n prop = _theSanitizer.value(path, name_1, srcValue, stringifyObjects);\r\n }\r\n else {\r\n prop = sanitizeProperty(name_1, srcValue, stringifyObjects);\r\n }\r\n if (prop) {\r\n // Set the value\r\n var newValue = prop.value;\r\n destObj[name_1] = newValue;\r\n if (metadataCallback) {\r\n metadataCallback(theMetaPathKeys, name_1, prop);\r\n }\r\n if (processSubKeys && typeof newValue === \"object\" && !isArray(newValue)) {\r\n var newPath = theMetaPathKeys;\r\n if (newPath) {\r\n newPath = newPath.slice();\r\n newPath.push(name_1);\r\n }\r\n // Make sure we process sub objects as well (for value sanitization and metadata)\r\n _processPathKeys(srcValue, newValue, path + \".\" + name_1, checkReserved, newPath, metadataCallback, processSubKeys);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n });\r\n }\r\n /**\r\n * Create a serializer payload package\r\n * @param retryCnt The retry count for the events in this payload\r\n * @param isTeardown Is this payload being created as part of a teardown request\r\n * @param isSync Should this payload be sent as a synchronous request\r\n * @param isReducedPayload Is this payload going to be sent via sendBeacon() API\r\n * @param sendReason The reason the payload is being sent\r\n * @param sendType Identifies how this payload will be sent\r\n */\r\n Serializer.prototype.createPayload = function (retryCnt, isTeardown, isSync, isReducedPayload, sendReason, sendType) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Append the batched events into the payload\r\n * @param payload The serialized payload detail object\r\n * @param theBatch The batched events to append to the payload\r\n * @param maxEventsPerBatch The maximum number of events to allow in the payload\r\n * @returns True if the events from the new batch where attempted to be added to the payload otherwise false\r\n */\r\n Serializer.prototype.appendPayload = function (payload, theBatch, maxEventsPerBatch) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Bond serialize the event.\r\n * @param eventData - The event that needs to be serialized.\r\n * @returns The serialized json event.\r\n */\r\n Serializer.prototype.getEventBlob = function (eventData) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Does this field value sanitizer handle this path / field combination\r\n * @param path - The field path\r\n * @param name - The name of the field\r\n */\r\n Serializer.prototype.handleField = function (path, name) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Get the field sanitizer for this type of field based on the field type, value kind and/or event property type\r\n * @param path - The field path\r\n * @param name - The name of the field\r\n * @param theType - The type of field\r\n * @param theKind - The value kind of the field\r\n * @param propType - The property type of the field\r\n */\r\n Serializer.prototype.getSanitizer = function (path, name, theType, theKind, propType) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return Serializer;\r\n}());\r\nexport { Serializer };\r\n/**\r\n * @ignore\r\n */\r\nfunction _addJSONPropertyMetaData(json, propKeys, name, propertyValue) {\r\n if (propertyValue && json) {\r\n var encodedTypeValue = getCommonSchemaMetaData(propertyValue.value, propertyValue.kind, propertyValue.propertyType);\r\n if (encodedTypeValue > -1) {\r\n // Add the root metadata\r\n var metaData = json[metadata];\r\n if (!metaData) {\r\n // Sets the root 'f'\r\n metaData = json[metadata] = { f: {} };\r\n }\r\n var metaTarget = metaData[f];\r\n if (!metaTarget) {\r\n // This can occur if someone has manually added an ext.metadata object\r\n // Such as ext.metadata.privLevel and ext.metadata.privTags\r\n metaTarget = metaData[f] = {};\r\n }\r\n // Traverse the metadata path and build each object (contains an 'f' key) -- if required\r\n if (propKeys) {\r\n for (var lp = 0; lp < propKeys.length; lp++) {\r\n var key = propKeys[lp];\r\n if (!metaTarget[key]) {\r\n metaTarget[key] = { f: {} };\r\n }\r\n var newTarget = metaTarget[key][f];\r\n if (!newTarget) {\r\n // Not expected, but can occur if the metadata context was pre-created as part of the event\r\n newTarget = metaTarget[key][f] = {};\r\n }\r\n metaTarget = newTarget;\r\n }\r\n }\r\n metaTarget = metaTarget[name] = {};\r\n if (isArray(propertyValue.value)) {\r\n metaTarget[\"a\"] = {\r\n t: encodedTypeValue\r\n };\r\n }\r\n else {\r\n metaTarget[\"t\"] = encodedTypeValue;\r\n }\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=Serializer.js.map","var _a;\r\n/**\r\n* HttpManager.ts\r\n* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)\r\n* @copyright Microsoft 2018-2020\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport EVTClockSkewManager from \"./ClockSkewManager\";\r\nimport EVTKillSwitch from \"./KillSwitch\";\r\nimport { FullVersionString, _throwInternal, _warnToConsole, arrForEach, dateNow, doPerf, dumpObj, extend, getLocation, getNavigator, getTime, hasOwnProperty, isArray, isBeaconsSupported, isFetchSupported, isNullOrUndefined, isNumber, isReactNative, isString, isUndefined, isValueAssigned, isXhrSupported, objForEachKey, objKeys, openXhr, strTrim, strUndefined, useXDomainRequest } from \"@microsoft/1ds-core-js\";\r\nimport { DEFAULT_CACHE_CONTROL, DEFAULT_CONTENT_TYPE, STR_API_KEY, STR_AUTH_XTOKEN, STR_CACHE_CONTROL, STR_CLIENT_ID, STR_CLIENT_VERSION, STR_CONTENT_TYPE_HEADER, STR_DISABLED_PROPERTY_NAME, STR_DROPPED, STR_EMPTY, STR_KILL_DURATION_HEADER, STR_KILL_DURATION_SECONDS_HEADER, STR_KILL_TOKENS_HEADER, STR_MSA_DEVICE_TICKET, STR_MSFPC, STR_NO_RESPONSE_BODY, STR_OTHER, STR_POST_METHOD, STR_REQUEUE, STR_RESPONSE_FAIL, STR_SENDING, STR_TIME_DELTA_HEADER, STR_TIME_DELTA_TO_APPLY, STR_UPLOAD_TIME } from \"./InternalConstants\";\r\nimport { retryPolicyGetMillisToBackoffForRetry, retryPolicyShouldRetryForStatus } from \"./RetryPolicy\";\r\nimport { Serializer } from \"./Serializer\";\r\nvar strSendAttempt = \"sendAttempt\";\r\nvar _noResponseQs = \"&\" + STR_NO_RESPONSE_BODY + \"=true\";\r\n/**\r\n * Identifies the default notification reason to the action names\r\n */\r\nvar _eventActionMap = (_a = {},\r\n _a[1 /* EventBatchNotificationReason.Paused */] = STR_REQUEUE,\r\n _a[100 /* EventBatchNotificationReason.RequeueEvents */] = STR_REQUEUE,\r\n _a[200 /* EventBatchNotificationReason.Complete */] = \"sent\",\r\n _a[8004 /* EventBatchNotificationReason.KillSwitch */] = STR_DROPPED,\r\n _a[8003 /* EventBatchNotificationReason.SizeLimitExceeded */] = STR_DROPPED,\r\n _a);\r\nvar _collectorQsHeaders = {};\r\nvar _collectorHeaderToQs = {};\r\nfunction _addCollectorHeaderQsMapping(qsName, headerName, allowQs) {\r\n _collectorQsHeaders[qsName] = headerName;\r\n if (allowQs !== false) {\r\n _collectorHeaderToQs[headerName] = qsName;\r\n }\r\n}\r\n_addCollectorHeaderQsMapping(STR_MSA_DEVICE_TICKET, STR_MSA_DEVICE_TICKET, false);\r\n_addCollectorHeaderQsMapping(STR_CLIENT_VERSION, STR_CLIENT_VERSION);\r\n_addCollectorHeaderQsMapping(STR_CLIENT_ID, \"Client-Id\");\r\n_addCollectorHeaderQsMapping(STR_API_KEY, STR_API_KEY);\r\n_addCollectorHeaderQsMapping(STR_TIME_DELTA_TO_APPLY, STR_TIME_DELTA_TO_APPLY);\r\n_addCollectorHeaderQsMapping(STR_UPLOAD_TIME, STR_UPLOAD_TIME);\r\n_addCollectorHeaderQsMapping(STR_AUTH_XTOKEN, STR_AUTH_XTOKEN);\r\nfunction _getResponseText(xhr) {\r\n try {\r\n return xhr.responseText;\r\n }\r\n catch (e) {\r\n // Best effort, as XHR may throw while XDR wont so just ignore\r\n }\r\n return STR_EMPTY;\r\n}\r\nfunction _hasHeader(headers, header) {\r\n var hasHeader = false;\r\n if (headers && header) {\r\n var keys = objKeys(headers);\r\n if (keys && keys.length > 0) {\r\n var lowerHeader = header.toLowerCase();\r\n for (var lp = 0; lp < keys.length; lp++) {\r\n var value = keys[lp];\r\n if (value && hasOwnProperty(header, value) &&\r\n value.toLowerCase() === lowerHeader) {\r\n hasHeader = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return hasHeader;\r\n}\r\nfunction _addRequestDetails(details, name, value, useHeaders) {\r\n if (name && value && value.length > 0) {\r\n if (useHeaders && _collectorQsHeaders[name]) {\r\n details.hdrs[_collectorQsHeaders[name]] = value;\r\n details.useHdrs = true;\r\n }\r\n else {\r\n details.url += \"&\" + name + \"=\" + value;\r\n }\r\n }\r\n}\r\nfunction _prependTransports(theTransports, newTransports) {\r\n if (newTransports) {\r\n if (isNumber(newTransports)) {\r\n theTransports = [newTransports].concat(theTransports);\r\n }\r\n else if (isArray(newTransports)) {\r\n theTransports = newTransports.concat(theTransports);\r\n }\r\n }\r\n return theTransports;\r\n}\r\n/**\r\n * Class managing the sending of requests.\r\n */\r\nvar HttpManager = /** @class */ (function () {\r\n /**\r\n * @constructor\r\n * @param requestQueue - The queue that contains the requests to be sent.\r\n */\r\n function HttpManager(maxEventsPerBatch, maxConnections, maxRequestRetriesBeforeBackoff, actions, timeoutOverride) {\r\n this._responseHandlers = [];\r\n var _urlString = \"?cors=true&\" + STR_CONTENT_TYPE_HEADER.toLowerCase() + \"=\" + DEFAULT_CONTENT_TYPE;\r\n var _killSwitch = new EVTKillSwitch();\r\n var _paused = false;\r\n var _clockSkewManager = new EVTClockSkewManager();\r\n var _useBeacons = false;\r\n var _outstandingRequests = 0; // Holds the number of outstanding async requests that have not returned a response yet\r\n var _postManager;\r\n var _logger;\r\n var _sendInterfaces;\r\n var _core;\r\n var _customHttpInterface = true;\r\n var _queryStringParameters = [];\r\n var _headers = {};\r\n var _batchQueue = [];\r\n var _serializer = null;\r\n var _enableEventTimings = false;\r\n var _cookieMgr;\r\n var _isUnloading = false;\r\n var _useHeaders = false;\r\n var _xhrTimeout;\r\n var _disableXhrSync;\r\n var _disableFetchKeepAlive;\r\n var _canHaveReducedPayload;\r\n var _addNoResponse;\r\n dynamicProto(HttpManager, this, function (_self) {\r\n var _sendCredentials = true;\r\n _self.initialize = function (endpointUrl, core, postChannel, httpInterface, channelConfig) {\r\n var _a;\r\n if (!channelConfig) {\r\n channelConfig = {};\r\n }\r\n _urlString = endpointUrl + _urlString;\r\n _useHeaders = !isUndefined(channelConfig.avoidOptions) ? !channelConfig.avoidOptions : true;\r\n _core = core;\r\n _cookieMgr = core.getCookieMgr();\r\n _enableEventTimings = !_core.config.disableEventTimings;\r\n var enableCompoundKey = !!_core.config.enableCompoundKey;\r\n _postManager = postChannel;\r\n _logger = _postManager.diagLog();\r\n var valueSanitizer = channelConfig.valueSanitizer;\r\n var stringifyObjects = channelConfig.stringifyObjects;\r\n if (!isUndefined(channelConfig.enableCompoundKey)) {\r\n enableCompoundKey = !!channelConfig.enableCompoundKey;\r\n }\r\n _xhrTimeout = channelConfig.xhrTimeout;\r\n _disableXhrSync = !!channelConfig.disableXhrSync;\r\n _disableFetchKeepAlive = !!channelConfig.disableFetchKeepAlive;\r\n _addNoResponse = channelConfig.addNoResponse !== false;\r\n _useBeacons = !isReactNative(); // Only use beacons if not running in React Native\r\n _serializer = new Serializer(_core, valueSanitizer, stringifyObjects, enableCompoundKey);\r\n if (!isNullOrUndefined(channelConfig.useSendBeacon)) {\r\n _useBeacons = !!channelConfig.useSendBeacon;\r\n }\r\n var syncHttpInterface = httpInterface;\r\n var beaconHttpInterface = channelConfig.alwaysUseXhrOverride ? httpInterface : null;\r\n var fetchSyncHttpInterface = channelConfig.alwaysUseXhrOverride ? httpInterface : null;\r\n var beaconUnloadTransports = [3 /* TransportType.Beacon */, 2 /* TransportType.Fetch */];\r\n if (!httpInterface) {\r\n _customHttpInterface = false;\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol && location_1.protocol.toLowerCase() === \"file:\") {\r\n // Special case where a local html file fails with a CORS error on Chromium browsers\r\n _sendCredentials = false;\r\n }\r\n var theTransports = [];\r\n if (isReactNative()) {\r\n // Use Fetch or XDR/XHR\r\n theTransports = [2 /* TransportType.Fetch */, 1 /* TransportType.Xhr */];\r\n beaconUnloadTransports = [2 /* TransportType.Fetch */, 1 /* TransportType.Xhr */, 3 /* TransportType.Beacon */];\r\n }\r\n else {\r\n // Use XDR/XHR, Fetch or beacons\r\n theTransports = [1 /* TransportType.Xhr */, 2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */];\r\n }\r\n // Prefix any user requested transport(s) values\r\n theTransports = _prependTransports(theTransports, channelConfig.transports);\r\n httpInterface = _getSenderInterface(theTransports, false);\r\n if (!httpInterface) {\r\n _warnToConsole(_logger, \"No available transport to send events\");\r\n }\r\n syncHttpInterface = _getSenderInterface(theTransports, true);\r\n }\r\n if (!beaconHttpInterface) {\r\n // Allow overriding the usage of sendBeacon\r\n beaconUnloadTransports = _prependTransports(beaconUnloadTransports, channelConfig.unloadTransports);\r\n beaconHttpInterface = _getSenderInterface(beaconUnloadTransports, true);\r\n }\r\n _canHaveReducedPayload = !_customHttpInterface && ((_useBeacons && isBeaconsSupported()) || (!_disableFetchKeepAlive && isFetchSupported(true)));\r\n _sendInterfaces = (_a = {},\r\n _a[0 /* EventSendType.Batched */] = httpInterface,\r\n _a[1 /* EventSendType.Synchronous */] = syncHttpInterface || _getSenderInterface([1 /* TransportType.Xhr */, 2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */], true),\r\n _a[2 /* EventSendType.SendBeacon */] = beaconHttpInterface || syncHttpInterface || _getSenderInterface([1 /* TransportType.Xhr */], true),\r\n _a[3 /* EventSendType.SyncFetch */] = fetchSyncHttpInterface || _getSenderInterface([2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */], true) || syncHttpInterface || _getSenderInterface([1 /* TransportType.Xhr */], true),\r\n _a);\r\n };\r\n // Special internal method to allow the DebugPlugin to hook embedded objects\r\n function _getSenderInterface(transports, syncSupport) {\r\n var transportType = 0 /* TransportType.NotSet */;\r\n var sendPostFunc = null;\r\n var lp = 0;\r\n while (sendPostFunc == null && lp < transports.length) {\r\n transportType = transports[lp];\r\n if (transportType === 1 /* TransportType.Xhr */) {\r\n if (useXDomainRequest()) {\r\n sendPostFunc = _xdrSendPost;\r\n }\r\n else if (isXhrSupported()) {\r\n sendPostFunc = _xhrSendPost;\r\n }\r\n }\r\n else if (transportType === 2 /* TransportType.Fetch */ && isFetchSupported(syncSupport) && (!syncSupport || (syncSupport && !_disableFetchKeepAlive))) {\r\n sendPostFunc = _fetchSendPost;\r\n }\r\n else if (_useBeacons && transportType === 3 /* TransportType.Beacon */ && isBeaconsSupported()) {\r\n sendPostFunc = _beaconSendPost;\r\n }\r\n lp++;\r\n }\r\n if (sendPostFunc) {\r\n return {\r\n _transport: transportType,\r\n _isSync: syncSupport,\r\n sendPOST: sendPostFunc\r\n };\r\n }\r\n return null;\r\n }\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_sendInterfaces[0 /* EventSendType.Batched */], _killSwitch, _serializer, _sendInterfaces];\r\n };\r\n function _xdrSendPost(payload, oncomplete, sync) {\r\n // It doesn't support custom headers, so no action is taken with current requestHeaders\r\n var xdr = new XDomainRequest();\r\n xdr.open(STR_POST_METHOD, payload.urlString);\r\n if (payload.timeout) {\r\n xdr.timeout = payload.timeout;\r\n }\r\n // can't get the status code in xdr.\r\n xdr.onload = function () {\r\n // we will assume onload means the request succeeded.\r\n var response = _getResponseText(xdr);\r\n _doOnComplete(oncomplete, 200, {}, response);\r\n _handleCollectorResponse(response);\r\n };\r\n // we will assume onerror means we need to drop the events.\r\n xdr.onerror = function () {\r\n _doOnComplete(oncomplete, 400, {});\r\n };\r\n // we will assume ontimeout means we need to retry the events.\r\n xdr.ontimeout = function () {\r\n _doOnComplete(oncomplete, 500, {});\r\n };\r\n // https://cypressnorth.com/web-programming-and-development/internet-explorer-aborting-ajax-requests-fixed/\r\n // tslint:disable-next-line:no-empty\r\n xdr.onprogress = function () { };\r\n if (sync) {\r\n xdr.send(payload.data);\r\n }\r\n else {\r\n timeoutOverride.set(function () {\r\n xdr.send(payload.data);\r\n }, 0);\r\n }\r\n }\r\n function _fetchSendPost(payload, oncomplete, sync) {\r\n var _a;\r\n var theUrl = payload.urlString;\r\n var ignoreResponse = false;\r\n var responseHandled = false;\r\n var requestInit = (_a = {\r\n body: payload.data,\r\n method: STR_POST_METHOD\r\n },\r\n _a[STR_DISABLED_PROPERTY_NAME] = true,\r\n _a);\r\n if (sync) {\r\n requestInit.keepalive = true;\r\n if (payload._sendReason === 2 /* SendRequestReason.Unload */) {\r\n // As a sync request (during unload), it is unlikely that we will get a chance to process the response so\r\n // just like beacon send assume that the events have been accepted and processed\r\n ignoreResponse = true;\r\n if (_addNoResponse) {\r\n theUrl += _noResponseQs;\r\n }\r\n }\r\n }\r\n if (_sendCredentials) {\r\n // Don't send credentials when URL is file://\r\n requestInit.credentials = \"include\";\r\n }\r\n // Only add headers if there are headers to add, due to issue with some polyfills\r\n if (payload.headers && objKeys(payload.headers).length > 0) {\r\n requestInit.headers = payload.headers;\r\n }\r\n fetch(theUrl, requestInit).then(function (response) {\r\n var headerMap = {};\r\n var responseText = STR_EMPTY;\r\n var headers = response.headers;\r\n if (headers) {\r\n headers[\"forEach\"](function (value, name) {\r\n headerMap[name] = value;\r\n });\r\n }\r\n if (response.body) {\r\n response.text().then(function (text) {\r\n responseText = text;\r\n });\r\n }\r\n if (!responseHandled) {\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, response.status, headerMap, responseText);\r\n _handleCollectorResponse(responseText);\r\n }\r\n })[\"catch\"](function (error) {\r\n // In case there is an error in the request. Set the status to 0\r\n // so that the events can be retried later.\r\n if (!responseHandled) {\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 0, {});\r\n }\r\n });\r\n if (ignoreResponse && !responseHandled) {\r\n // Assume success during unload processing\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 200, {});\r\n }\r\n if (!responseHandled && payload.timeout > 0) {\r\n // Simulate timeout\r\n timeoutOverride.set(function () {\r\n if (!responseHandled) {\r\n // Assume a 500 response (which will cause a retry)\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 500, {});\r\n }\r\n }, payload.timeout);\r\n }\r\n }\r\n function _xhrSendPost(payload, oncomplete, sync) {\r\n var theUrl = payload.urlString;\r\n function _appendHeader(theHeaders, xhr, name) {\r\n if (!theHeaders[name] && xhr && xhr.getResponseHeader) {\r\n var value = xhr.getResponseHeader(name);\r\n if (value) {\r\n theHeaders[name] = strTrim(value);\r\n }\r\n }\r\n return theHeaders;\r\n }\r\n function _getAllResponseHeaders(xhr) {\r\n var theHeaders = {};\r\n if (!xhr.getAllResponseHeaders) {\r\n // Firefox 2-63 doesn't have getAllResponseHeaders function but it does have getResponseHeader\r\n // Only call these if getAllResponseHeaders doesn't exist, otherwise we can get invalid response errors\r\n // as collector is not currently returning the correct header to allow JS to access these headers\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);\r\n }\r\n else {\r\n theHeaders = _convertAllHeadersToMap(xhr.getAllResponseHeaders());\r\n }\r\n return theHeaders;\r\n }\r\n function xhrComplete(xhr, responseTxt) {\r\n _doOnComplete(oncomplete, xhr.status, _getAllResponseHeaders(xhr), responseTxt);\r\n }\r\n if (sync && payload.disableXhrSync) {\r\n sync = false;\r\n }\r\n var xhrRequest = openXhr(STR_POST_METHOD, theUrl, _sendCredentials, true, sync, payload.timeout);\r\n // Set custom headers (e.g. gzip) here (after open())\r\n objForEachKey(payload.headers, function (name, value) {\r\n xhrRequest.setRequestHeader(name, value);\r\n });\r\n xhrRequest.onload = function () {\r\n var response = _getResponseText(xhrRequest);\r\n xhrComplete(xhrRequest, response);\r\n _handleCollectorResponse(response);\r\n };\r\n xhrRequest.onerror = function () {\r\n xhrComplete(xhrRequest);\r\n };\r\n xhrRequest.ontimeout = function () {\r\n xhrComplete(xhrRequest);\r\n };\r\n xhrRequest.send(payload.data);\r\n }\r\n function _doOnComplete(oncomplete, status, headers, response) {\r\n try {\r\n oncomplete(status, headers, response);\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 518 /* _eExtendedInternalMessageId.SendPostOnCompleteFailure */, dumpObj(e));\r\n }\r\n }\r\n function _beaconSendPost(payload, oncomplete, sync) {\r\n // Custom headers not supported in sendBeacon payload.headers would be ignored\r\n var internalPayloadData = payload;\r\n var status = 200;\r\n var thePayload = internalPayloadData._thePayload;\r\n var theUrl = payload.urlString + (_addNoResponse ? _noResponseQs : STR_EMPTY);\r\n try {\r\n var nav_1 = getNavigator();\r\n if (!nav_1.sendBeacon(theUrl, payload.data)) {\r\n if (thePayload) {\r\n // Failed to send entire payload so try and split data and try to send as much events as possible\r\n var droppedBatches_1 = [];\r\n arrForEach(thePayload.batches, function (theBatch) {\r\n if (droppedBatches_1 && theBatch && theBatch.count() > 0) {\r\n var theEvents = theBatch.events();\r\n for (var lp = 0; lp < theEvents.length; lp++) {\r\n if (!nav_1.sendBeacon(theUrl, _serializer.getEventBlob(theEvents[lp]))) {\r\n // Can't send anymore, so split the batch and drop the rest\r\n droppedBatches_1.push(theBatch.split(lp));\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n // Remove all of the events from the existing batch in the payload as the copy includes the original\r\n droppedBatches_1.push(theBatch.split(0));\r\n }\r\n });\r\n _sendBatchesNotification(droppedBatches_1, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload.sendType, true);\r\n }\r\n else {\r\n status = 0;\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n _warnToConsole(_logger, \"Failed to send telemetry using sendBeacon API. Ex:\" + dumpObj(ex));\r\n status = 0;\r\n }\r\n finally {\r\n _doOnComplete(oncomplete, status, {}, STR_EMPTY);\r\n }\r\n }\r\n function _isBeaconPayload(sendType) {\r\n // Sync Fetch has the same payload limitation as sendBeacon -- 64kb limit, so treat both as a beacon send\r\n return sendType === 2 /* EventSendType.SendBeacon */ || sendType === 3 /* EventSendType.SyncFetch */;\r\n }\r\n function _adjustSendType(sendType) {\r\n if (_isUnloading && _isBeaconPayload(sendType)) {\r\n sendType = 2 /* EventSendType.SendBeacon */;\r\n }\r\n return sendType;\r\n }\r\n _self.addQueryStringParameter = function (name, value) {\r\n for (var i = 0; i < _queryStringParameters.length; i++) {\r\n if (_queryStringParameters[i].name === name) {\r\n _queryStringParameters[i].value = value;\r\n return;\r\n }\r\n }\r\n _queryStringParameters.push({ name: name, value: value });\r\n };\r\n _self.addHeader = function (name, value) {\r\n _headers[name] = value;\r\n };\r\n _self.canSendRequest = function () {\r\n return _hasIdleConnection() && _clockSkewManager.allowRequestSending();\r\n };\r\n _self.sendQueuedRequests = function (sendType, sendReason) {\r\n if (isUndefined(sendType)) {\r\n sendType = 0 /* EventSendType.Batched */;\r\n }\r\n if (_isUnloading) {\r\n sendType = _adjustSendType(sendType);\r\n sendReason = 2 /* SendRequestReason.Unload */;\r\n }\r\n if (_canSendPayload(_batchQueue, sendType, 0)) {\r\n _sendBatches(_clearQueue(), 0, false, sendType, sendReason || 0 /* SendRequestReason.Undefined */);\r\n }\r\n };\r\n _self.isCompletelyIdle = function () {\r\n return !_paused && _outstandingRequests === 0 && _batchQueue.length === 0;\r\n };\r\n _self.setUnloading = function (value) {\r\n _isUnloading = value;\r\n };\r\n _self.addBatch = function (theBatch) {\r\n if (theBatch && theBatch.count() > 0) {\r\n // Try and kill the event faster\r\n if (_killSwitch.isTenantKilled(theBatch.iKey())) {\r\n return false;\r\n }\r\n _batchQueue.push(theBatch);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Queue all the remaining requests to be sent. The requests will be\r\n * sent using HTML5 Beacons if they are available.\r\n */\r\n _self.teardown = function () {\r\n if (_batchQueue.length > 0) {\r\n _sendBatches(_clearQueue(), 0, true, 2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n };\r\n /**\r\n * Pause the sending of requests. No new requests will be sent.\r\n */\r\n _self.pause = function () {\r\n _paused = true;\r\n };\r\n /**\r\n * Resume the sending of requests.\r\n */\r\n _self.resume = function () {\r\n _paused = false;\r\n _self.sendQueuedRequests(0 /* EventSendType.Batched */, 4 /* SendRequestReason.Resumed */);\r\n };\r\n /**\r\n * Sends a request synchronously to the Aria collector. This api is used to send\r\n * a request containing a single immediate event.\r\n *\r\n * @param batch - The request to be sent.\r\n * @param sendReason - The token used to send the request.\r\n */\r\n _self.sendSynchronousBatch = function (batch, sendType, sendReason) {\r\n // This will not take into account the max connections restriction. Since this is sync, we can\r\n // only send one of this request at a time and thus should not worry about multiple connections\r\n // being used to send synchronous events.\r\n // Increment active connection since we are still going to use a connection to send the request.\r\n if (batch && batch.count() > 0) {\r\n if (isNullOrUndefined(sendType)) {\r\n sendType = 1 /* EventSendType.Synchronous */;\r\n }\r\n if (_isUnloading) {\r\n sendType = _adjustSendType(sendType);\r\n sendReason = 2 /* SendRequestReason.Unload */;\r\n }\r\n // For sync requests we will not wait for the clock skew.\r\n _sendBatches([batch], 0, false, sendType, sendReason || 0 /* SendRequestReason.Undefined */);\r\n }\r\n };\r\n function _hasIdleConnection() {\r\n return !_paused && _outstandingRequests < maxConnections;\r\n }\r\n function _clearQueue() {\r\n var theQueue = _batchQueue;\r\n _batchQueue = [];\r\n return theQueue;\r\n }\r\n function _canSendPayload(theBatches, sendType, retryCnt) {\r\n var result = false;\r\n if (theBatches && theBatches.length > 0 && !_paused && _sendInterfaces[sendType] && _serializer) {\r\n // Always attempt to send synchronous events don't wait for idle or clockSkew\r\n // and don't block retry requests if clockSkew is not yet set\r\n result = (sendType !== 0 /* EventSendType.Batched */) || (_hasIdleConnection() && (retryCnt > 0 || _clockSkewManager.allowRequestSending()));\r\n }\r\n return result;\r\n }\r\n function _createDebugBatches(theBatches) {\r\n var values = {};\r\n if (theBatches) {\r\n arrForEach(theBatches, function (theBatch, idx) {\r\n values[idx] = {\r\n iKey: theBatch.iKey(),\r\n evts: theBatch.events()\r\n };\r\n });\r\n }\r\n return values;\r\n }\r\n function _sendBatches(theBatches, retryCount, isTeardown, sendType, sendReason) {\r\n if (!theBatches || theBatches.length === 0) {\r\n // Nothing to do\r\n return;\r\n }\r\n if (_paused) {\r\n _sendBatchesNotification(theBatches, 1 /* EventBatchNotificationReason.Paused */, sendType);\r\n return;\r\n }\r\n // Make sure that if we are unloading the sendType is a supported version\r\n sendType = _adjustSendType(sendType);\r\n try {\r\n var orgBatches_1 = theBatches;\r\n var isSynchronous_1 = sendType !== 0 /* EventSendType.Batched */;\r\n doPerf(_core, function () { return \"HttpManager:_sendBatches\"; }, function (perfEvt) {\r\n if (perfEvt) {\r\n // Perf Monitoring is enabled, so create a \"Quick\" copy of the original batches so we still report\r\n // the original values as part of the perfEvent. This is because theBatches uses .shift() to remove each\r\n // batch as they are processed - removing from the original array, so by the time the _createDebugBatches()\r\n // function is called the passed in value has changed and therefore the reported value for the perfEvent is incorrect\r\n theBatches = theBatches.slice(0);\r\n }\r\n var droppedBatches = [];\r\n var thePayload = null;\r\n var serializationStart = getTime();\r\n var sendInterface = _sendInterfaces[sendType] || (isSynchronous_1 ? _sendInterfaces[1 /* EventSendType.Synchronous */] : _sendInterfaces[0 /* EventSendType.Batched */]);\r\n var sendTransport = sendInterface && sendInterface._transport;\r\n // Sync Fetch has the same payload limitation as sendBeacon -- 64kb limit\r\n var isReducedPayload = _canHaveReducedPayload && (_isUnloading || _isBeaconPayload(sendType) || (sendTransport === 3 /* TransportType.Beacon */ || (sendInterface._isSync && sendTransport === 2 /* TransportType.Fetch */)));\r\n while (_canSendPayload(theBatches, sendType, retryCount)) {\r\n var theBatch = theBatches.shift();\r\n if (theBatch && theBatch.count() > 0) {\r\n if (!_killSwitch.isTenantKilled(theBatch.iKey())) {\r\n // Make sure we have a payload object\r\n thePayload = thePayload || _serializer.createPayload(retryCount, isTeardown, isSynchronous_1, isReducedPayload, sendReason, sendType);\r\n // Add the batch to the current payload\r\n if (!_serializer.appendPayload(thePayload, theBatch, maxEventsPerBatch)) {\r\n // Entire batch was not added so send the payload and retry adding this batch\r\n _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);\r\n serializationStart = getTime();\r\n theBatches = [theBatch].concat(theBatches);\r\n thePayload = null;\r\n }\r\n else if (thePayload.overflow !== null) {\r\n // Total Payload size was exceeded so send the payload and add the unsent as the next batch to send\r\n theBatches = [thePayload.overflow].concat(theBatches);\r\n thePayload.overflow = null;\r\n _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);\r\n serializationStart = getTime();\r\n thePayload = null;\r\n }\r\n }\r\n else {\r\n droppedBatches.push(theBatch);\r\n }\r\n }\r\n }\r\n // Make sure to flush any remaining payload\r\n if (thePayload) {\r\n _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);\r\n }\r\n if (theBatches.length > 0) {\r\n // Add any unsent batches back to the head of the queue\r\n _batchQueue = theBatches.concat(_batchQueue);\r\n }\r\n // Now send notification about any dropped events\r\n _sendBatchesNotification(droppedBatches, 8004 /* EventBatchNotificationReason.KillSwitch */, sendType);\r\n }, function () { return ({ batches: _createDebugBatches(orgBatches_1), retryCount: retryCount, isTeardown: isTeardown, isSynchronous: isSynchronous_1, sendReason: sendReason, useSendBeacon: _isBeaconPayload(sendType), sendType: sendType }); }, !isSynchronous_1);\r\n }\r\n catch (ex) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 48 /* _eInternalMessageId.CannotSerializeObject */, \"Unexpected Exception sending batch: \" + dumpObj(ex));\r\n }\r\n }\r\n function _buildRequestDetails(thePayload, useHeaders) {\r\n var requestDetails = {\r\n url: _urlString,\r\n hdrs: {},\r\n useHdrs: false // Assume no headers\r\n };\r\n if (!useHeaders) {\r\n // Attempt to map headers to a query string if possible\r\n objForEachKey(_headers, function (name, value) {\r\n if (_collectorHeaderToQs[name]) {\r\n _addRequestDetails(requestDetails, _collectorHeaderToQs[name], value, false);\r\n }\r\n else {\r\n // No mapping, so just include in the headers anyway (may not get sent if using sendBeacon())\r\n requestDetails.hdrs[name] = value;\r\n requestDetails.useHdrs = true;\r\n }\r\n });\r\n }\r\n else {\r\n // Copy the pre-defined headers into the payload headers\r\n requestDetails.hdrs = extend(requestDetails.hdrs, _headers);\r\n requestDetails.useHdrs = (objKeys(requestDetails.hdrs).length > 0);\r\n }\r\n _addRequestDetails(requestDetails, STR_CLIENT_ID, \"NO_AUTH\", useHeaders);\r\n _addRequestDetails(requestDetails, STR_CLIENT_VERSION, FullVersionString, useHeaders);\r\n var apiQsKeys = STR_EMPTY;\r\n arrForEach(thePayload.apiKeys, function (apiKey) {\r\n if (apiQsKeys.length > 0) {\r\n apiQsKeys += \",\";\r\n }\r\n apiQsKeys += apiKey;\r\n });\r\n _addRequestDetails(requestDetails, STR_API_KEY, apiQsKeys, useHeaders);\r\n _addRequestDetails(requestDetails, STR_UPLOAD_TIME, dateNow().toString(), useHeaders);\r\n var msfpc = _getMsfpc(thePayload);\r\n if (isValueAssigned(msfpc)) {\r\n requestDetails.url += \"&ext.intweb.msfpc=\" + msfpc;\r\n }\r\n if (_clockSkewManager.shouldAddClockSkewHeaders()) {\r\n _addRequestDetails(requestDetails, STR_TIME_DELTA_TO_APPLY, _clockSkewManager.getClockSkewHeaderValue(), useHeaders);\r\n }\r\n if (_core.getWParam) {\r\n var wParam = _core.getWParam();\r\n if (wParam >= 0) {\r\n requestDetails.url += \"&w=\" + wParam;\r\n }\r\n }\r\n for (var i = 0; i < _queryStringParameters.length; i++) {\r\n requestDetails.url += \"&\" + _queryStringParameters[i].name + \"=\" + _queryStringParameters[i].value;\r\n }\r\n return requestDetails;\r\n }\r\n function _setTimingValue(timings, name, value) {\r\n timings[name] = timings[name] || {};\r\n timings[name][_postManager.identifier] = value;\r\n }\r\n function _doPayloadSend(thePayload, serializationStart, serializationCompleted, sendReason) {\r\n if (thePayload && thePayload.payloadBlob && thePayload.payloadBlob.length > 0) {\r\n var useSendHook_1 = !!_self.sendHook;\r\n var sendInterface_1 = _sendInterfaces[thePayload.sendType];\r\n // Send all data using a beacon style transport if closing mode is on or channel was teared down\r\n if (!_isBeaconPayload(thePayload.sendType) && thePayload.isBeacon && thePayload.sendReason === 2 /* SendRequestReason.Unload */) {\r\n sendInterface_1 = _sendInterfaces[2 /* EventSendType.SendBeacon */] || _sendInterfaces[3 /* EventSendType.SyncFetch */] || sendInterface_1;\r\n }\r\n var useHeaders_1 = _useHeaders;\r\n // Disable header usage if we know we are using sendBeacon as additional headers are not supported\r\n if (thePayload.isBeacon || sendInterface_1._transport === 3 /* TransportType.Beacon */) {\r\n useHeaders_1 = false;\r\n }\r\n var requestDetails_1 = _buildRequestDetails(thePayload, useHeaders_1);\r\n useHeaders_1 = useHeaders_1 || requestDetails_1.useHdrs;\r\n var sendEventStart_1 = getTime();\r\n doPerf(_core, function () { return \"HttpManager:_doPayloadSend\"; }, function () {\r\n // Increment the send attempt count and add timings after packaging (So it's not serialized in the 1st attempt)\r\n for (var batchLp = 0; batchLp < thePayload.batches.length; batchLp++) {\r\n var theBatch = thePayload.batches[batchLp];\r\n var theEvents = theBatch.events();\r\n for (var evtLp = 0; evtLp < theEvents.length; evtLp++) {\r\n var telemetryItem = theEvents[evtLp];\r\n if (_enableEventTimings) {\r\n var timings = telemetryItem.timings = telemetryItem.timings || {};\r\n _setTimingValue(timings, \"sendEventStart\", sendEventStart_1);\r\n _setTimingValue(timings, \"serializationStart\", serializationStart);\r\n _setTimingValue(timings, \"serializationCompleted\", serializationCompleted);\r\n }\r\n telemetryItem[strSendAttempt] > 0 ? telemetryItem[strSendAttempt]++ : telemetryItem[strSendAttempt] = 1;\r\n }\r\n }\r\n // Note: always sending this notification in a synchronous manner.\r\n _sendBatchesNotification(thePayload.batches, (1000 /* EventBatchNotificationReason.SendingUndefined */ + (sendReason || 0 /* SendRequestReason.Undefined */)), thePayload.sendType, true);\r\n // Disabling the use of const because of Issue: \r\n // - Task 9227844: [1DS] Some environments and packagers automatically \"freeze\" objects which are defined as const which causes any mutations to throw\r\n // eslint-disable-next-line prefer-const\r\n var orgPayloadData = {\r\n data: thePayload.payloadBlob,\r\n urlString: requestDetails_1.url,\r\n headers: requestDetails_1.hdrs,\r\n _thePayload: thePayload,\r\n _sendReason: sendReason,\r\n timeout: _xhrTimeout,\r\n disableXhrSync: _disableXhrSync,\r\n disableFetchKeepAlive: _disableFetchKeepAlive\r\n };\r\n // Only automatically add the following headers if already sending headers and we are not attempting to avoid an options call\r\n if (useHeaders_1) {\r\n if (!_hasHeader(orgPayloadData.headers, STR_CACHE_CONTROL)) {\r\n orgPayloadData.headers[STR_CACHE_CONTROL] = DEFAULT_CACHE_CONTROL;\r\n }\r\n if (!_hasHeader(orgPayloadData.headers, STR_CONTENT_TYPE_HEADER)) {\r\n orgPayloadData.headers[STR_CONTENT_TYPE_HEADER] = DEFAULT_CONTENT_TYPE;\r\n }\r\n }\r\n var sender = null;\r\n if (sendInterface_1) {\r\n // Send sync requests if the request is immediate or we are tearing down telemetry.\r\n sender = function (payload) {\r\n // Notify the clock skew manager that we are sending the first request (Potentially blocking all further requests)\r\n _clockSkewManager.firstRequestSent();\r\n var onComplete = function (status, headers) {\r\n _retryRequestIfNeeded(status, headers, thePayload, sendReason);\r\n };\r\n var isSync = thePayload.isTeardown || thePayload.isSync;\r\n try {\r\n sendInterface_1.sendPOST(payload, onComplete, isSync);\r\n if (_self.sendListener) {\r\n // Send the original payload to the listener\r\n _self.sendListener(orgPayloadData, payload, isSync, thePayload.isBeacon);\r\n }\r\n }\r\n catch (ex) {\r\n _warnToConsole(_logger, \"Unexpected exception sending payload. Ex:\" + dumpObj(ex));\r\n _doOnComplete(onComplete, 0, {});\r\n }\r\n };\r\n }\r\n doPerf(_core, function () { return \"HttpManager:_doPayloadSend.sender\"; }, function () {\r\n if (sender) {\r\n if (thePayload.sendType === 0 /* EventSendType.Batched */) {\r\n _outstandingRequests++;\r\n }\r\n // Only call the hook if it's defined and we are not using sendBeacon as additional headers are not supported\r\n if (useSendHook_1 && !thePayload.isBeacon && sendInterface_1._transport !== 3 /* TransportType.Beacon */) {\r\n // Create a new IPayloadData that is sent into the hook method, so that the hook method\r\n // can't change the object references to the orgPayloadData (it can still change the content -- mainly the headers)\r\n // Disabling the use of const because of Issue: \r\n // - Task 9227844: [1DS] Some environments and packagers automatically \"freeze\" objects which are defined as const which causes any mutations to throw\r\n // eslint-disable-next-line prefer-const\r\n var hookData_1 = {\r\n data: orgPayloadData.data,\r\n urlString: orgPayloadData.urlString,\r\n headers: extend({}, orgPayloadData.headers),\r\n timeout: orgPayloadData.timeout,\r\n disableXhrSync: orgPayloadData.disableXhrSync,\r\n disableFetchKeepAlive: orgPayloadData.disableFetchKeepAlive\r\n };\r\n var senderCalled_1 = false;\r\n doPerf(_core, function () { return \"HttpManager:_doPayloadSend.sendHook\"; }, function () {\r\n try {\r\n _self.sendHook(hookData_1, function (payload) {\r\n senderCalled_1 = true;\r\n // Add back the internal properties\r\n if (!_customHttpInterface && !payload._thePayload) {\r\n payload._thePayload = payload._thePayload || orgPayloadData._thePayload;\r\n payload._sendReason = payload._sendReason || orgPayloadData._sendReason;\r\n }\r\n sender(payload);\r\n }, thePayload.isSync || thePayload.isTeardown);\r\n }\r\n catch (ex) {\r\n if (!senderCalled_1) {\r\n // The hook never called the sender -- assume that it never will\r\n sender(orgPayloadData);\r\n }\r\n }\r\n });\r\n }\r\n else {\r\n sender(orgPayloadData);\r\n }\r\n }\r\n });\r\n }, function () { return ({ thePayload: thePayload, serializationStart: serializationStart, serializationCompleted: serializationCompleted, sendReason: sendReason }); }, thePayload.isSync);\r\n }\r\n if (thePayload.sizeExceed && thePayload.sizeExceed.length > 0) {\r\n // Ensure that we send any discard events for oversize events even when there was no payload to send\r\n _sendBatchesNotification(thePayload.sizeExceed, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload.sendType);\r\n }\r\n if (thePayload.failedEvts && thePayload.failedEvts.length > 0) {\r\n // Ensure that we send any discard events for events that could not be serialized even when there was no payload to send\r\n _sendBatchesNotification(thePayload.failedEvts, 8002 /* EventBatchNotificationReason.InvalidEvent */, thePayload.sendType);\r\n }\r\n }\r\n function _addEventCompletedTimings(theEvents, sendEventCompleted) {\r\n if (_enableEventTimings) {\r\n arrForEach(theEvents, function (theEvent) {\r\n var timings = theEvent.timings = theEvent.timings || {};\r\n _setTimingValue(timings, \"sendEventCompleted\", sendEventCompleted);\r\n });\r\n }\r\n }\r\n function _retryRequestIfNeeded(status, headers, thePayload, sendReason) {\r\n var reason = 9000 /* EventBatchNotificationReason.ResponseFailure */;\r\n var droppedBatches = null;\r\n var isRetrying = false;\r\n var backOffTrans = false;\r\n try {\r\n var shouldRetry = true;\r\n if (typeof status !== strUndefined) {\r\n if (headers) {\r\n _clockSkewManager.setClockSkew(headers[STR_TIME_DELTA_HEADER]);\r\n var killDuration = headers[STR_KILL_DURATION_HEADER] || headers[\"kill-duration-seconds\"];\r\n arrForEach(_killSwitch.setKillSwitchTenants(headers[STR_KILL_TOKENS_HEADER], killDuration), function (killToken) {\r\n arrForEach(thePayload.batches, function (theBatch) {\r\n if (theBatch.iKey() === killToken) {\r\n // Make sure we have initialized the array\r\n droppedBatches = droppedBatches || [];\r\n // Create a copy of the batch with all of the events (and more importantly the action functions)\r\n var removedEvents = theBatch.split(0);\r\n // And then remove the events for the payload batch and reduce the actual number of processed\r\n thePayload.numEvents -= removedEvents.count();\r\n droppedBatches.push(removedEvents);\r\n }\r\n });\r\n });\r\n }\r\n // Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value\r\n // tslint:disable-next-line:triple-equals\r\n if (status == 200 || status == 204) {\r\n // Response was successfully sent\r\n reason = 200 /* EventBatchNotificationReason.Complete */;\r\n return;\r\n }\r\n if (!retryPolicyShouldRetryForStatus(status) || thePayload.numEvents <= 0) {\r\n // Only retry for specific response codes and if there is still events after kill switch processing\r\n shouldRetry = false;\r\n }\r\n // Derive the notification response from the HttpStatus Code\r\n reason = 9000 /* EventBatchNotificationReason.ResponseFailure */ + (status % 1000);\r\n }\r\n if (shouldRetry) {\r\n // The events should be retried -- so change notification to requeue them\r\n reason = 100 /* EventBatchNotificationReason.RequeueEvents */;\r\n var retryCount_1 = thePayload.retryCnt;\r\n if (thePayload.sendType === 0 /* EventSendType.Batched */) {\r\n // attempt to resend the entire batch\r\n if (retryCount_1 < maxRequestRetriesBeforeBackoff) {\r\n isRetrying = true;\r\n _doAction(function () {\r\n // try to resend the same batches\r\n if (thePayload.sendType === 0 /* EventSendType.Batched */) {\r\n // Reduce the outstanding request count (if this was an async request) as we didn't reduce the count\r\n // previously and we are about to reschedule our retry attempt and we want an attempt to send\r\n // to occur, it's also required to ensure that a follow up handleRequestFinished() call occurs\r\n _outstandingRequests--;\r\n }\r\n _sendBatches(thePayload.batches, retryCount_1 + 1, thePayload.isTeardown, _isUnloading ? 2 /* EventSendType.SendBeacon */ : thePayload.sendType, 5 /* SendRequestReason.Retry */);\r\n }, _isUnloading, retryPolicyGetMillisToBackoffForRetry(retryCount_1));\r\n }\r\n else {\r\n backOffTrans = true;\r\n if (_isUnloading) {\r\n // we are unloading so don't try and requeue the events otherwise let the events get requeued and resent during the backoff sending\r\n // This will also cause the events to be purged based on the priority (if necessary)\r\n reason = 8001 /* EventBatchNotificationReason.NonRetryableStatus */;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n if (!isRetrying) {\r\n // Make sure the clockSkewManager doesn't blocking further sending of requests once we have a proper response\r\n // This won't override any previously sent clock Skew value\r\n _clockSkewManager.setClockSkew();\r\n _handleRequestFinished(thePayload, reason, sendReason, backOffTrans);\r\n }\r\n _sendBatchesNotification(droppedBatches, 8004 /* EventBatchNotificationReason.KillSwitch */, thePayload.sendType);\r\n }\r\n }\r\n function _handleRequestFinished(thePayload, batchReason, sendReason, backOffTrans) {\r\n try {\r\n if (backOffTrans) {\r\n // Slow down the transmission requests\r\n _postManager._backOffTransmission();\r\n }\r\n if (batchReason === 200 /* EventBatchNotificationReason.Complete */) {\r\n if (!backOffTrans && !thePayload.isSync) {\r\n // We have a successful async response, so the lets open the floodgates\r\n // The reason for checking isSync is to avoid unblocking if beacon send occurred as it\r\n // doesn't wait for a response.\r\n _postManager._clearBackOff();\r\n }\r\n _addCompleteTimings(thePayload.batches);\r\n }\r\n // Send the notifications synchronously\r\n _sendBatchesNotification(thePayload.batches, batchReason, thePayload.sendType, true);\r\n }\r\n finally {\r\n if (thePayload.sendType === 0 /* EventSendType.Batched */) {\r\n // we always need to decrement this value otherwise the httpmanager locks up and won't send any more events\r\n _outstandingRequests--;\r\n // Don't try to send additional queued events if this is a retry operation as the retried\r\n // response will eventually call _handleRequestFinished for the retried event\r\n if (sendReason !== 5 /* SendRequestReason.Retry */) {\r\n // Try and send any other queued batched events\r\n _self.sendQueuedRequests(thePayload.sendType, sendReason);\r\n }\r\n }\r\n }\r\n }\r\n function _addCompleteTimings(theBatches) {\r\n if (_enableEventTimings) {\r\n var sendEventCompleted_1 = getTime();\r\n arrForEach(theBatches, function (theBatch) {\r\n if (theBatch && theBatch.count() > 0) {\r\n _addEventCompletedTimings(theBatch.events(), sendEventCompleted_1);\r\n }\r\n });\r\n }\r\n }\r\n function _doAction(cb, isSync, interval) {\r\n if (isSync) {\r\n cb();\r\n }\r\n else {\r\n timeoutOverride.set(cb, interval);\r\n }\r\n }\r\n /**\r\n * Converts the XHR getAllResponseHeaders to a map containing the header key and value.\r\n */\r\n // tslint:disable-next-line: align\r\n function _convertAllHeadersToMap(headersString) {\r\n var headers = {};\r\n if (isString(headersString)) {\r\n var headersArray = strTrim(headersString).split(/[\\r\\n]+/);\r\n arrForEach(headersArray, function (headerEntry) {\r\n if (headerEntry) {\r\n var idx = headerEntry.indexOf(\": \");\r\n if (idx !== -1) {\r\n // The new spec has the headers returning all as lowercase -- but not all browsers do this yet\r\n var header = strTrim(headerEntry.substring(0, idx)).toLowerCase();\r\n var value = strTrim(headerEntry.substring(idx + 1));\r\n headers[header] = value;\r\n }\r\n else {\r\n headers[strTrim(headerEntry)] = 1;\r\n }\r\n }\r\n });\r\n }\r\n return headers;\r\n }\r\n function _getMsfpc(thePayload) {\r\n for (var lp = 0; lp < thePayload.batches.length; lp++) {\r\n var msfpc = thePayload.batches[lp].Msfpc();\r\n if (msfpc) {\r\n return encodeURIComponent(msfpc);\r\n }\r\n }\r\n return STR_EMPTY;\r\n }\r\n function _handleCollectorResponse(responseText) {\r\n var responseHandlers = _self._responseHandlers;\r\n try {\r\n for (var i = 0; i < responseHandlers.length; i++) {\r\n try {\r\n responseHandlers[i](responseText);\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 519 /* _eExtendedInternalMessageId.PostResponseHandler */, \"Response handler failed: \" + e);\r\n }\r\n }\r\n if (responseText) {\r\n var response = JSON.parse(responseText);\r\n if (isValueAssigned(response.webResult) && isValueAssigned(response.webResult[STR_MSFPC])) {\r\n // Set cookie\r\n _cookieMgr.set(\"MSFPC\", response.webResult[STR_MSFPC], 365 * 86400);\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n // Doing nothing\r\n }\r\n }\r\n function _sendBatchesNotification(theBatches, batchReason, sendType, sendSync) {\r\n if (theBatches && theBatches.length > 0 && actions) {\r\n var theAction_1 = actions[_getNotificationAction(batchReason)];\r\n if (theAction_1) {\r\n var isSyncRequest_1 = sendType !== 0 /* EventSendType.Batched */;\r\n doPerf(_core, function () { return \"HttpManager:_sendBatchesNotification\"; }, function () {\r\n _doAction(function () {\r\n try {\r\n theAction_1.call(actions, theBatches, batchReason, isSyncRequest_1, sendType);\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 74 /* _eInternalMessageId.NotificationException */, \"send request notification failed: \" + e);\r\n }\r\n }, sendSync || isSyncRequest_1, 0);\r\n }, function () { return ({ batches: _createDebugBatches(theBatches), reason: batchReason, isSync: isSyncRequest_1, sendSync: sendSync, sendType: sendType }); }, !isSyncRequest_1);\r\n }\r\n }\r\n }\r\n function _getNotificationAction(reason) {\r\n var action = _eventActionMap[reason];\r\n if (!isValueAssigned(action)) {\r\n action = STR_OTHER;\r\n if (reason >= 9000 /* EventBatchNotificationReason.ResponseFailure */ && reason <= 9999 /* EventBatchNotificationReason.ResponseFailureMax */) {\r\n action = STR_RESPONSE_FAIL;\r\n }\r\n else if (reason >= 8000 /* EventBatchNotificationReason.EventsDropped */ && reason <= 8999 /* EventBatchNotificationReason.EventsDroppedMax */) {\r\n action = STR_DROPPED;\r\n }\r\n else if (reason >= 1000 /* EventBatchNotificationReason.SendingUndefined */ && reason <= 1999 /* EventBatchNotificationReason.SendingEventMax */) {\r\n action = STR_SENDING;\r\n }\r\n }\r\n return action;\r\n }\r\n });\r\n }\r\n /**\r\n * @constructor\r\n * @param requestQueue - The queue that contains the requests to be sent.\r\n * @param endpointUrl - The collector url to which the requests must be sent.\r\n * @param postManager - The post manager that we should add requests back to if needed.\r\n * @param httpInterface - The http interface that should be used to send HTTP requests.\r\n * @param channelConfig - The IChannelConfiguration the should be used to get additional configuration\r\n */\r\n HttpManager.prototype.initialize = function (endpointUrl, core, postChannel, httpInterface, channelConfig) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add query string parameter to url\r\n * @param name - Query string name.\r\n * @param value - Query string value.\r\n */\r\n HttpManager.prototype.addQueryStringParameter = function (name, value) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add header to request\r\n * @param name - Header name.\r\n * @param value - Header value.\r\n */\r\n HttpManager.prototype.addHeader = function (name, value) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add the batch of events to the queue for sending\r\n * @param batch The batch with the events to send\r\n * @returns True if the http manager has accepted the batch (including if the batch is empty) otherwise false\r\n */\r\n HttpManager.prototype.addBatch = function (batch) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Check if there is an idle connection and we can send a request.\r\n * @returns True if there is an idle connection, false otherwise.\r\n */\r\n HttpManager.prototype.canSendRequest = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Send requests in the request queue up if there is an idle connection, sending is\r\n * not pause and clock skew manager allows sending request.\r\n * @param sendType - Identifies how the batched events should be send, defaults to Batched\r\n * @param sendReason - The reason the batch is being sent\r\n */\r\n HttpManager.prototype.sendQueuedRequests = function (sendType, sendReason) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Check if there are no active requests being sent.\r\n * @returns True if idle, false otherwise.\r\n */\r\n HttpManager.prototype.isCompletelyIdle = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Inform the HttpManager that a page unload event was received\r\n */\r\n HttpManager.prototype.setUnloading = function (value) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Queue all the remaining requests to be sent. The requests will be\r\n * sent using HTML5 Beacons if they are available.\r\n */\r\n HttpManager.prototype.teardown = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Pause the sending of requests. No new requests will be sent.\r\n */\r\n HttpManager.prototype.pause = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Resume the sending of requests.\r\n */\r\n HttpManager.prototype.resume = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Sends the batches synchronously to the collector. This api is used to send a batches immediate event.\r\n *\r\n * @param batch - The batch of events to be sent.\r\n * @param sendReason - The reason the batch is being sent\r\n * @param sendType - Identifies the sending type to use when sending the batch\r\n */\r\n HttpManager.prototype.sendSynchronousBatch = function (batch, sendType, sendReason) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return HttpManager;\r\n}());\r\nexport { HttpManager };\r\n//# sourceMappingURL=HttpManager.js.map","/**\r\n* TimeoutOverrideWrapper.ts\r\n* @author Nev Wylie (newylie)\r\n* @copyright Microsoft 2022\r\n* Simple internal timeout wrapper\r\n*/\r\nexport function defaultSetTimeout(callback, ms) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n return setTimeout(callback, ms, args);\r\n}\r\nexport function defaultClearTimeout(timeoutId) {\r\n clearTimeout(timeoutId);\r\n}\r\nexport function createTimeoutWrapper(argSetTimeout, argClearTimeout) {\r\n return {\r\n set: argSetTimeout || defaultSetTimeout,\r\n clear: argClearTimeout || defaultClearTimeout\r\n };\r\n}\r\n//# sourceMappingURL=TimeoutOverrideWrapper.js.map","import { __extends } from \"tslib\";\r\n/**\r\n* PostManager.ts\r\n* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)\r\n* @copyright Microsoft 2018-2020\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin, EventsDiscardedReason, _throwInternal, addPageHideEventListener, addPageShowEventListener, addPageUnloadEventListener, arrForEach, createUniqueNamespace, doPerf, getWindow, isChromium, isNumber, isValueAssigned, mergeEvtNamespace, objDefineAccessors, objForEachKey, optimizeObject, removePageHideEventListener, removePageShowEventListener, removePageUnloadEventListener, setProcessTelemetryTimings } from \"@microsoft/1ds-core-js\";\r\nimport { BE_PROFILE, NRT_PROFILE, RT_PROFILE } from \"./DataModels\";\r\nimport { EventBatch } from \"./EventBatch\";\r\nimport { HttpManager } from \"./HttpManager\";\r\nimport { STR_MSA_DEVICE_TICKET, STR_TRACE, STR_USER } from \"./InternalConstants\";\r\nimport { retryPolicyGetMillisToBackoffForRetry } from \"./RetryPolicy\";\r\nimport { createTimeoutWrapper } from \"./TimeoutOverrideWrapper\";\r\nvar FlushCheckTimer = 0.250; // This needs to be in seconds, so this is 250ms\r\nvar MaxNumberEventPerBatch = 500;\r\nvar EventsDroppedAtOneTime = 20;\r\nvar MaxSendAttempts = 6;\r\nvar MaxSyncUnloadSendAttempts = 2; // Assuming 2 based on beforeunload and unload\r\nvar MaxBackoffCount = 4;\r\nvar MaxConnections = 2;\r\nvar MaxRequestRetriesBeforeBackoff = 1;\r\nvar strEventsDiscarded = \"eventsDiscarded\";\r\nvar strOverrideInstrumentationKey = \"overrideInstrumentationKey\";\r\nvar strMaxEventRetryAttempts = \"maxEventRetryAttempts\";\r\nvar strMaxUnloadEventRetryAttempts = \"maxUnloadEventRetryAttempts\";\r\nvar strAddUnloadCb = \"addUnloadCb\";\r\n/**\r\n * Class that manages adding events to inbound queues and batching of events\r\n * into requests.\r\n */\r\nvar PostChannel = /** @class */ (function (_super) {\r\n __extends(PostChannel, _super);\r\n function PostChannel() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"PostChannel\";\r\n _this.priority = 1011;\r\n _this.version = '3.2.15';\r\n var _config;\r\n var _isTeardownCalled = false;\r\n var _flushCallbackQueue = [];\r\n var _flushCallbackTimerId = null;\r\n var _paused = false;\r\n var _immediateQueueSize = 0;\r\n var _immediateQueueSizeLimit = 500;\r\n var _queueSize = 0;\r\n var _queueSizeLimit = 10000;\r\n var _profiles = {};\r\n var _currentProfile = RT_PROFILE;\r\n var _scheduledTimerId = null;\r\n var _immediateTimerId = null;\r\n var _currentBackoffCount = 0;\r\n var _timerCount = 0;\r\n var _xhrOverride;\r\n var _httpManager;\r\n var _batchQueues = {};\r\n var _autoFlushEventsLimit;\r\n // either MaxBatchSize * (1+ Max Connections) or _queueLimit / 6 (where 3 latency Queues [normal, realtime, cost deferred] * 2 [allow half full -- allow for retry])\r\n var _autoFlushBatchLimit;\r\n var _delayedBatchSendLatency = -1;\r\n var _delayedBatchReason;\r\n var _optimizeObject = true;\r\n var _isPageUnloadTriggered = false;\r\n var _maxEventSendAttempts = MaxSendAttempts;\r\n var _maxUnloadEventSendAttempts = MaxSyncUnloadSendAttempts;\r\n var _evtNamespace;\r\n var _timeoutWrapper;\r\n dynamicProto(PostChannel, _this, function (_self, _base) {\r\n _initDefaults();\r\n // Special internal method to allow the DebugPlugin to hook embedded objects\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_httpManager];\r\n };\r\n _self.initialize = function (coreConfig, core, extensions) {\r\n doPerf(core, function () { return \"PostChannel:initialize\"; }, function () {\r\n var extendedCore = core;\r\n _base.initialize(coreConfig, core, extensions);\r\n try {\r\n var hasAddUnloadCb = !!core[strAddUnloadCb];\r\n _evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self.identifier), core.evtNamespace && core.evtNamespace());\r\n var ctx = _self._getTelCtx();\r\n coreConfig.extensionConfig[_self.identifier] = coreConfig.extensionConfig[_self.identifier] || {};\r\n _config = ctx.getExtCfg(_self.identifier);\r\n _timeoutWrapper = createTimeoutWrapper(_config.setTimeoutOverride, _config.clearTimeoutOverride);\r\n // Only try and use the optimizeObject() if this appears to be a chromium based browser and it has not been explicitly disabled\r\n _optimizeObject = !_config.disableOptimizeObj && isChromium();\r\n _hookWParam(extendedCore);\r\n if (_config.eventsLimitInMem > 0) {\r\n _queueSizeLimit = _config.eventsLimitInMem;\r\n }\r\n if (_config.immediateEventLimit > 0) {\r\n _immediateQueueSizeLimit = _config.immediateEventLimit;\r\n }\r\n if (_config.autoFlushEventsLimit > 0) {\r\n _autoFlushEventsLimit = _config.autoFlushEventsLimit;\r\n }\r\n if (isNumber(_config[strMaxEventRetryAttempts])) {\r\n _maxEventSendAttempts = _config[strMaxEventRetryAttempts];\r\n }\r\n if (isNumber(_config[strMaxUnloadEventRetryAttempts])) {\r\n _maxUnloadEventSendAttempts = _config[strMaxUnloadEventRetryAttempts];\r\n }\r\n _setAutoLimits();\r\n if (_config.httpXHROverride && _config.httpXHROverride.sendPOST) {\r\n _xhrOverride = _config.httpXHROverride;\r\n }\r\n if (isValueAssigned(coreConfig.anonCookieName)) {\r\n _httpManager.addQueryStringParameter(\"anoncknm\", coreConfig.anonCookieName);\r\n }\r\n _httpManager.sendHook = _config.payloadPreprocessor;\r\n _httpManager.sendListener = _config.payloadListener;\r\n // Override endpointUrl if provided in Post config\r\n var endpointUrl = _config.overrideEndpointUrl ? _config.overrideEndpointUrl : coreConfig.endpointUrl;\r\n _self._notificationManager = core.getNotifyMgr();\r\n _httpManager.initialize(endpointUrl, _self.core, _self, _xhrOverride, _config);\r\n var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents || [];\r\n // When running in Web browsers try to send all telemetry if page is unloaded\r\n addPageUnloadEventListener(_handleUnloadEvents, excludePageUnloadEvents, _evtNamespace);\r\n addPageHideEventListener(_handleUnloadEvents, excludePageUnloadEvents, _evtNamespace);\r\n addPageShowEventListener(_handleShowEvents, coreConfig.disablePageShowEvents, _evtNamespace);\r\n }\r\n catch (e) {\r\n // resetting the initialized state because of failure\r\n _self.setInitialized(false);\r\n throw e;\r\n }\r\n }, function () { return ({ coreConfig: coreConfig, core: core, extensions: extensions }); });\r\n };\r\n _self.processTelemetry = function (ev, itemCtx) {\r\n setProcessTelemetryTimings(ev, _self.identifier);\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n // Get the channel instance from the current request/instance\r\n var channelConfig = itemCtx.getExtCfg(_self.identifier);\r\n // DisableTelemetry was defined in the config provided during initialization\r\n var disableTelemetry = !!_config.disableTelemetry;\r\n if (channelConfig) {\r\n // DisableTelemetry is defined in the config for this request/instance\r\n disableTelemetry = disableTelemetry || !!channelConfig.disableTelemetry;\r\n }\r\n var event = ev;\r\n if (!disableTelemetry && !_isTeardownCalled) {\r\n // Override iKey if provided in Post config if provided for during initialization\r\n if (_config[strOverrideInstrumentationKey]) {\r\n event.iKey = _config[strOverrideInstrumentationKey];\r\n }\r\n // Override iKey if provided in Post config if provided for this instance\r\n if (channelConfig && channelConfig[strOverrideInstrumentationKey]) {\r\n event.iKey = channelConfig[strOverrideInstrumentationKey];\r\n }\r\n _addEventToQueues(event, true);\r\n if (_isPageUnloadTriggered) {\r\n // Unload event has been received so we need to try and flush new events\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n else {\r\n _scheduleTimer();\r\n }\r\n }\r\n _self.processNext(event, itemCtx);\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n _isTeardownCalled = true;\r\n _httpManager.teardown();\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n removePageShowEventListener(null, _evtNamespace);\r\n // Just register to remove all events associated with this namespace\r\n _initDefaults();\r\n };\r\n function _hookWParam(extendedCore) {\r\n var existingGetWParamMethod = extendedCore.getWParam;\r\n extendedCore.getWParam = function () {\r\n var wparam = 0;\r\n if (_config.ignoreMc1Ms0CookieProcessing) {\r\n wparam = wparam | 2;\r\n }\r\n return wparam | existingGetWParamMethod();\r\n };\r\n }\r\n // Moving event handlers out from the initialize closure so that any local variables can be garbage collected\r\n function _handleUnloadEvents(evt) {\r\n var theEvt = evt || getWindow().event; // IE 8 does not pass the event\r\n if (theEvt.type !== \"beforeunload\") {\r\n // Only set the unload trigger if not beforeunload event as beforeunload can be cancelled while the other events can't\r\n _isPageUnloadTriggered = true;\r\n _httpManager.setUnloading(_isPageUnloadTriggered);\r\n }\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n function _handleShowEvents(evt) {\r\n // Handle the page becoming visible again\r\n _isPageUnloadTriggered = false;\r\n _httpManager.setUnloading(_isPageUnloadTriggered);\r\n }\r\n function _addEventToQueues(event, append) {\r\n // If send attempt field is undefined we should set it to 0.\r\n if (!event.sendAttempt) {\r\n event.sendAttempt = 0;\r\n }\r\n // Add default latency\r\n if (!event.latency) {\r\n event.latency = 1 /* EventLatencyValue.Normal */;\r\n }\r\n // Remove extra AI properties if present\r\n if (event.ext && event.ext[STR_TRACE]) {\r\n delete (event.ext[STR_TRACE]);\r\n }\r\n if (event.ext && event.ext[STR_USER] && event.ext[STR_USER][\"id\"]) {\r\n delete (event.ext[STR_USER][\"id\"]);\r\n }\r\n // v8 performance optimization for iterating over the keys\r\n if (_optimizeObject) {\r\n setProcessTelemetryTimings;\r\n event.ext = optimizeObject(event.ext);\r\n if (event.baseData) {\r\n event.baseData = optimizeObject(event.baseData);\r\n }\r\n if (event.data) {\r\n event.data = optimizeObject(event.data);\r\n }\r\n }\r\n if (event.sync) {\r\n // If the transmission is backed off then do not send synchronous events.\r\n // We will convert these events to Real time latency instead.\r\n if (_currentBackoffCount || _paused) {\r\n event.latency = 3 /* EventLatencyValue.RealTime */;\r\n event.sync = false;\r\n }\r\n else {\r\n // Log the event synchronously\r\n if (_httpManager) {\r\n // v8 performance optimization for iterating over the keys\r\n if (_optimizeObject) {\r\n event = optimizeObject(event);\r\n }\r\n _httpManager.sendSynchronousBatch(EventBatch.create(event.iKey, [event]), event.sync === true ? 1 /* EventSendType.Synchronous */ : event.sync, 3 /* SendRequestReason.SyncEvent */);\r\n return;\r\n }\r\n }\r\n }\r\n var evtLatency = event.latency;\r\n var queueSize = _queueSize;\r\n var queueLimit = _queueSizeLimit;\r\n if (evtLatency === 4 /* EventLatencyValue.Immediate */) {\r\n queueSize = _immediateQueueSize;\r\n queueLimit = _immediateQueueSizeLimit;\r\n }\r\n var eventDropped = false;\r\n // Only add the event if the queue isn't full or it's a direct event (which don't add to the queue sizes)\r\n if (queueSize < queueLimit) {\r\n eventDropped = !_addEventToProperQueue(event, append);\r\n }\r\n else {\r\n var dropLatency = 1 /* EventLatencyValue.Normal */;\r\n var dropNumber = EventsDroppedAtOneTime;\r\n if (evtLatency === 4 /* EventLatencyValue.Immediate */) {\r\n // Only drop other immediate events as they are not technically sharing the general queue\r\n dropLatency = 4 /* EventLatencyValue.Immediate */;\r\n dropNumber = 1;\r\n }\r\n // Drop old event from lower or equal latency\r\n eventDropped = true;\r\n if (_dropEventWithLatencyOrLess(event.iKey, event.latency, dropLatency, dropNumber)) {\r\n eventDropped = !_addEventToProperQueue(event, append);\r\n }\r\n }\r\n if (eventDropped) {\r\n // Can't drop events from current queues because the all the slots are taken by queues that are being flushed.\r\n _notifyEvents(strEventsDiscarded, [event], EventsDiscardedReason.QueueFull);\r\n }\r\n }\r\n _self.setEventQueueLimits = function (eventLimit, autoFlushLimit) {\r\n _queueSizeLimit = eventLimit > 0 ? eventLimit : 10000;\r\n _autoFlushEventsLimit = autoFlushLimit > 0 ? autoFlushLimit : 0;\r\n _setAutoLimits();\r\n // We only do this check here as during normal event addition if the queue is > then events start getting dropped\r\n var doFlush = _queueSize > eventLimit;\r\n if (!doFlush && _autoFlushBatchLimit > 0) {\r\n // Check the auto flush max batch size\r\n for (var latency = 1 /* EventLatencyValue.Normal */; !doFlush && latency <= 3 /* EventLatencyValue.RealTime */; latency++) {\r\n var batchQueue = _batchQueues[latency];\r\n if (batchQueue && batchQueue.batches) {\r\n arrForEach(batchQueue.batches, function (theBatch) {\r\n if (theBatch && theBatch.count() >= _autoFlushBatchLimit) {\r\n // If any 1 batch is > than the limit then trigger an auto flush\r\n doFlush = true;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n _performAutoFlush(true, doFlush);\r\n };\r\n _self.pause = function () {\r\n _clearScheduledTimer();\r\n _paused = true;\r\n _httpManager.pause();\r\n };\r\n _self.resume = function () {\r\n _paused = false;\r\n _httpManager.resume();\r\n _scheduleTimer();\r\n };\r\n _self.addResponseHandler = function (responseHandler) {\r\n _httpManager._responseHandlers.push(responseHandler);\r\n };\r\n _self._loadTransmitProfiles = function (profiles) {\r\n _resetTransmitProfiles();\r\n objForEachKey(profiles, function (profileName, profileValue) {\r\n var profLen = profileValue.length;\r\n if (profLen >= 2) {\r\n var directValue = (profLen > 2 ? profileValue[2] : 0);\r\n profileValue.splice(0, profLen - 2);\r\n // Make sure if a higher latency is set to not send then don't send lower latency\r\n if (profileValue[1] < 0) {\r\n profileValue[0] = -1;\r\n }\r\n // Make sure each latency is multiple of the latency higher then it. If not a multiple\r\n // we round up so that it becomes a multiple.\r\n if (profileValue[1] > 0 && profileValue[0] > 0) {\r\n var timerMultiplier = profileValue[0] / profileValue[1];\r\n profileValue[0] = Math.ceil(timerMultiplier) * profileValue[1];\r\n }\r\n // Add back the direct profile timeout\r\n if (directValue >= 0 && profileValue[1] >= 0 && directValue > profileValue[1]) {\r\n // Make sure if it's not disabled (< 0) then make sure it's not larger than RealTime\r\n directValue = profileValue[1];\r\n }\r\n profileValue.push(directValue);\r\n _profiles[profileName] = profileValue;\r\n }\r\n });\r\n };\r\n _self.flush = function (async, callback, sendReason) {\r\n if (async === void 0) { async = true; }\r\n if (!_paused) {\r\n sendReason = sendReason || 1 /* SendRequestReason.ManualFlush */;\r\n if (async) {\r\n if (_flushCallbackTimerId == null) {\r\n // Clear the normal schedule timer as we are going to try and flush ASAP\r\n _clearScheduledTimer();\r\n // Move all queued events to the HttpManager so that we don't discard new events (Auto flush scenario)\r\n _queueBatches(1 /* EventLatencyValue.Normal */, 0 /* EventSendType.Batched */, sendReason);\r\n _flushCallbackTimerId = _createTimer(function () {\r\n _flushCallbackTimerId = null;\r\n _flushImpl(callback, sendReason);\r\n }, 0);\r\n }\r\n else {\r\n // Even if null (no callback) this will ensure after the flushImpl finishes waiting\r\n // for a completely idle connection it will attempt to re-flush any queued events on the next cycle\r\n _flushCallbackQueue.push(callback);\r\n }\r\n }\r\n else {\r\n // Clear the normal schedule timer as we are going to try and flush ASAP\r\n var cleared = _clearScheduledTimer();\r\n // Now cause all queued events to be sent synchronously\r\n _sendEventsForLatencyAndAbove(1 /* EventLatencyValue.Normal */, 1 /* EventSendType.Synchronous */, sendReason);\r\n if (callback !== null && callback !== undefined) {\r\n callback();\r\n }\r\n if (cleared) {\r\n // restart the normal event timer if it was cleared\r\n _scheduleTimer();\r\n }\r\n }\r\n }\r\n };\r\n _self.setMsaAuthTicket = function (ticket) {\r\n _httpManager.addHeader(STR_MSA_DEVICE_TICKET, ticket);\r\n };\r\n _self.hasEvents = _hasEvents;\r\n _self._setTransmitProfile = function (profileName) {\r\n if (_currentProfile !== profileName && _profiles[profileName] !== undefined) {\r\n _clearScheduledTimer();\r\n _currentProfile = profileName;\r\n _scheduleTimer();\r\n }\r\n };\r\n /**\r\n * Batch and send events currently in the queue for the given latency.\r\n * @param latency - Latency for which to send events.\r\n */\r\n function _sendEventsForLatencyAndAbove(latency, sendType, sendReason) {\r\n var queued = _queueBatches(latency, sendType, sendReason);\r\n // Always trigger the request as while the post channel may not have queued additional events, the httpManager may already have waiting events\r\n _httpManager.sendQueuedRequests(sendType, sendReason);\r\n return queued;\r\n }\r\n function _hasEvents() {\r\n return _queueSize > 0;\r\n }\r\n /**\r\n * Try to schedule the timer after which events will be sent. If there are\r\n * no events to be sent, or there is already a timer scheduled, or the\r\n * http manager doesn't have any idle connections this method is no-op.\r\n */\r\n function _scheduleTimer() {\r\n // If we had previously attempted to send requests, but the http manager didn't have any idle connections then the requests where delayed\r\n // so try and requeue then again now\r\n if (_delayedBatchSendLatency >= 0 && _queueBatches(_delayedBatchSendLatency, 0 /* EventSendType.Batched */, _delayedBatchReason)) {\r\n _httpManager.sendQueuedRequests(0 /* EventSendType.Batched */, _delayedBatchReason);\r\n }\r\n if (_immediateQueueSize > 0 && !_immediateTimerId && !_paused) {\r\n // During initialization _profiles enforce that the direct [2] is less than real time [1] timer value\r\n // If the immediateTimeout is disabled the immediate events will be sent with Real Time events\r\n var immediateTimeOut = _profiles[_currentProfile][2];\r\n if (immediateTimeOut >= 0) {\r\n _immediateTimerId = _createTimer(function () {\r\n _immediateTimerId = null;\r\n // Only try to send direct events\r\n _sendEventsForLatencyAndAbove(4 /* EventLatencyValue.Immediate */, 0 /* EventSendType.Batched */, 1 /* SendRequestReason.NormalSchedule */);\r\n _scheduleTimer();\r\n }, immediateTimeOut);\r\n }\r\n }\r\n // During initialization the _profiles enforce that the normal [0] is a multiple of the real time [1] timer value\r\n var timeOut = _profiles[_currentProfile][1];\r\n if (!_scheduledTimerId && !_flushCallbackTimerId && timeOut >= 0 && !_paused) {\r\n if (_hasEvents()) {\r\n _scheduledTimerId = _createTimer(function () {\r\n _scheduledTimerId = null;\r\n _sendEventsForLatencyAndAbove(_timerCount === 0 ? 3 /* EventLatencyValue.RealTime */ : 1 /* EventLatencyValue.Normal */, 0 /* EventSendType.Batched */, 1 /* SendRequestReason.NormalSchedule */);\r\n // Increment the count for next cycle\r\n _timerCount++;\r\n _timerCount %= 2;\r\n _scheduleTimer();\r\n }, timeOut);\r\n }\r\n else {\r\n _timerCount = 0;\r\n }\r\n }\r\n }\r\n _self._backOffTransmission = function () {\r\n if (_currentBackoffCount < MaxBackoffCount) {\r\n _currentBackoffCount++;\r\n _clearScheduledTimer();\r\n _scheduleTimer();\r\n }\r\n };\r\n _self._clearBackOff = function () {\r\n if (_currentBackoffCount) {\r\n _currentBackoffCount = 0;\r\n _clearScheduledTimer();\r\n _scheduleTimer();\r\n }\r\n };\r\n function _initDefaults() {\r\n _config = null;\r\n _isTeardownCalled = false;\r\n _flushCallbackQueue = [];\r\n _flushCallbackTimerId = null;\r\n _paused = false;\r\n _immediateQueueSize = 0;\r\n _immediateQueueSizeLimit = 500;\r\n _queueSize = 0;\r\n _queueSizeLimit = 10000;\r\n _profiles = {};\r\n _currentProfile = RT_PROFILE;\r\n _scheduledTimerId = null;\r\n _immediateTimerId = null;\r\n _currentBackoffCount = 0;\r\n _timerCount = 0;\r\n _xhrOverride = null;\r\n _batchQueues = {};\r\n _autoFlushEventsLimit = undefined;\r\n // either MaxBatchSize * (1+ Max Connections) or _queueLimit / 6 (where 3 latency Queues [normal, realtime, cost deferred] * 2 [allow half full -- allow for retry])\r\n _autoFlushBatchLimit = 0;\r\n _delayedBatchSendLatency = -1;\r\n _delayedBatchReason = null;\r\n _optimizeObject = true;\r\n _isPageUnloadTriggered = false;\r\n _maxEventSendAttempts = MaxSendAttempts;\r\n _maxUnloadEventSendAttempts = MaxSyncUnloadSendAttempts;\r\n _evtNamespace = null;\r\n _timeoutWrapper = createTimeoutWrapper();\r\n _httpManager = new HttpManager(MaxNumberEventPerBatch, MaxConnections, MaxRequestRetriesBeforeBackoff, {\r\n requeue: _requeueEvents,\r\n send: _sendingEvent,\r\n sent: _eventsSentEvent,\r\n drop: _eventsDropped,\r\n rspFail: _eventsResponseFail,\r\n oth: _otherEvent\r\n }, _timeoutWrapper);\r\n _initializeProfiles();\r\n _clearQueues();\r\n _setAutoLimits();\r\n }\r\n function _createTimer(theTimerFunc, timeOut) {\r\n // If the transmission is backed off make the timer at least 1 sec to allow for back off.\r\n if (timeOut === 0 && _currentBackoffCount) {\r\n timeOut = 1;\r\n }\r\n var timerMultiplier = 1000;\r\n if (_currentBackoffCount) {\r\n timerMultiplier = retryPolicyGetMillisToBackoffForRetry(_currentBackoffCount - 1);\r\n }\r\n return _timeoutWrapper.set(theTimerFunc, timeOut * timerMultiplier);\r\n }\r\n function _clearScheduledTimer() {\r\n if (_scheduledTimerId !== null) {\r\n _timeoutWrapper.clear(_scheduledTimerId);\r\n _scheduledTimerId = null;\r\n _timerCount = 0;\r\n return true;\r\n }\r\n return false;\r\n }\r\n // Try to send all queued events using beacons if available\r\n function _releaseAllQueues(sendType, sendReason) {\r\n _clearScheduledTimer();\r\n // Cancel all flush callbacks\r\n if (_flushCallbackTimerId) {\r\n _timeoutWrapper.clear(_flushCallbackTimerId);\r\n _flushCallbackTimerId = null;\r\n }\r\n if (!_paused) {\r\n // Queue all the remaining requests to be sent. The requests will be sent using HTML5 Beacons if they are available.\r\n _sendEventsForLatencyAndAbove(1 /* EventLatencyValue.Normal */, sendType, sendReason);\r\n }\r\n }\r\n /**\r\n * Add empty queues for all latencies in the inbound queues map. This is called\r\n * when Transmission Manager is being flushed. This ensures that new events added\r\n * after flush are stored separately till we flush the current events.\r\n */\r\n function _clearQueues() {\r\n _batchQueues[4 /* EventLatencyValue.Immediate */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n _batchQueues[3 /* EventLatencyValue.RealTime */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n _batchQueues[2 /* EventLatencyValue.CostDeferred */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n _batchQueues[1 /* EventLatencyValue.Normal */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n }\r\n function _getEventBatch(iKey, latency, create) {\r\n var batchQueue = _batchQueues[latency];\r\n if (!batchQueue) {\r\n latency = 1 /* EventLatencyValue.Normal */;\r\n batchQueue = _batchQueues[latency];\r\n }\r\n var eventBatch = batchQueue.iKeyMap[iKey];\r\n if (!eventBatch && create) {\r\n eventBatch = EventBatch.create(iKey);\r\n batchQueue.batches.push(eventBatch);\r\n batchQueue.iKeyMap[iKey] = eventBatch;\r\n }\r\n return eventBatch;\r\n }\r\n function _performAutoFlush(isAsync, doFlush) {\r\n // Only perform the auto flush check if the httpManager has an idle connection and we are not in a backoff situation\r\n if (_httpManager.canSendRequest() && !_currentBackoffCount) {\r\n if (_autoFlushEventsLimit > 0 && _queueSize > _autoFlushEventsLimit) {\r\n // Force flushing\r\n doFlush = true;\r\n }\r\n if (doFlush && _flushCallbackTimerId == null) {\r\n // Auto flush the queue\r\n _self.flush(isAsync, null, 20 /* SendRequestReason.MaxQueuedEvents */);\r\n }\r\n }\r\n }\r\n function _addEventToProperQueue(event, append) {\r\n // v8 performance optimization for iterating over the keys\r\n if (_optimizeObject) {\r\n event = optimizeObject(event);\r\n }\r\n var latency = event.latency;\r\n var eventBatch = _getEventBatch(event.iKey, latency, true);\r\n if (eventBatch.addEvent(event)) {\r\n if (latency !== 4 /* EventLatencyValue.Immediate */) {\r\n _queueSize++;\r\n // Check for auto flushing based on total events in the queue, but not for requeued or retry events\r\n if (append && event.sendAttempt === 0) {\r\n // Force the flushing of the batch if the batch (specific iKey / latency combination) reaches it's auto flush limit\r\n _performAutoFlush(!event.sync, _autoFlushBatchLimit > 0 && eventBatch.count() >= _autoFlushBatchLimit);\r\n }\r\n }\r\n else {\r\n // Direct events don't need auto flushing as they are scheduled (by default) for immediate delivery\r\n _immediateQueueSize++;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n function _dropEventWithLatencyOrLess(iKey, latency, currentLatency, dropNumber) {\r\n while (currentLatency <= latency) {\r\n var eventBatch = _getEventBatch(iKey, latency, true);\r\n if (eventBatch && eventBatch.count() > 0) {\r\n // Dropped oldest events from lowest possible latency\r\n var droppedEvents = eventBatch.split(0, dropNumber);\r\n var droppedCount = droppedEvents.count();\r\n if (droppedCount > 0) {\r\n if (currentLatency === 4 /* EventLatencyValue.Immediate */) {\r\n _immediateQueueSize -= droppedCount;\r\n }\r\n else {\r\n _queueSize -= droppedCount;\r\n }\r\n _notifyBatchEvents(strEventsDiscarded, [droppedEvents], EventsDiscardedReason.QueueFull);\r\n return true;\r\n }\r\n }\r\n currentLatency++;\r\n }\r\n // Unable to drop any events -- lets just make sure the queue counts are correct to avoid exhaustion\r\n _resetQueueCounts();\r\n return false;\r\n }\r\n /**\r\n * Internal helper to reset the queue counts, used as a backstop to avoid future queue exhaustion errors\r\n * that might occur because of counting issues.\r\n */\r\n function _resetQueueCounts() {\r\n var immediateQueue = 0;\r\n var normalQueue = 0;\r\n var _loop_1 = function (latency) {\r\n var batchQueue = _batchQueues[latency];\r\n if (batchQueue && batchQueue.batches) {\r\n arrForEach(batchQueue.batches, function (theBatch) {\r\n if (latency === 4 /* EventLatencyValue.Immediate */) {\r\n immediateQueue += theBatch.count();\r\n }\r\n else {\r\n normalQueue += theBatch.count();\r\n }\r\n });\r\n }\r\n };\r\n for (var latency = 1 /* EventLatencyValue.Normal */; latency <= 4 /* EventLatencyValue.Immediate */; latency++) {\r\n _loop_1(latency);\r\n }\r\n _queueSize = normalQueue;\r\n _immediateQueueSize = immediateQueue;\r\n }\r\n function _queueBatches(latency, sendType, sendReason) {\r\n var eventsQueued = false;\r\n var isAsync = sendType === 0 /* EventSendType.Batched */;\r\n // Only queue batches (to the HttpManager) if this is a sync request or the httpManager has an idle connection\r\n // Thus keeping the events within the PostChannel until the HttpManager has a connection available\r\n // This is so we can drop \"old\" events if the queue is getting full because we can't successfully send events\r\n if (!isAsync || _httpManager.canSendRequest()) {\r\n doPerf(_self.core, function () { return \"PostChannel._queueBatches\"; }, function () {\r\n var droppedEvents = [];\r\n var latencyToProcess = 4 /* EventLatencyValue.Immediate */;\r\n while (latencyToProcess >= latency) {\r\n var batchQueue = _batchQueues[latencyToProcess];\r\n if (batchQueue && batchQueue.batches && batchQueue.batches.length > 0) {\r\n arrForEach(batchQueue.batches, function (theBatch) {\r\n // Add the batch to the http manager to send the requests\r\n if (!_httpManager.addBatch(theBatch)) {\r\n // The events from this iKey are being dropped (killed)\r\n droppedEvents = droppedEvents.concat(theBatch.events());\r\n }\r\n else {\r\n eventsQueued = eventsQueued || (theBatch && theBatch.count() > 0);\r\n }\r\n if (latencyToProcess === 4 /* EventLatencyValue.Immediate */) {\r\n _immediateQueueSize -= theBatch.count();\r\n }\r\n else {\r\n _queueSize -= theBatch.count();\r\n }\r\n });\r\n // Remove all batches from this Queue\r\n batchQueue.batches = [];\r\n batchQueue.iKeyMap = {};\r\n }\r\n latencyToProcess--;\r\n }\r\n if (droppedEvents.length > 0) {\r\n _notifyEvents(strEventsDiscarded, droppedEvents, EventsDiscardedReason.KillSwitch);\r\n }\r\n if (eventsQueued && _delayedBatchSendLatency >= latency) {\r\n // We have queued events at the same level as the delayed values so clear the setting\r\n _delayedBatchSendLatency = -1;\r\n _delayedBatchReason = 0 /* SendRequestReason.Undefined */;\r\n }\r\n }, function () { return ({ latency: latency, sendType: sendType, sendReason: sendReason }); }, !isAsync);\r\n }\r\n else {\r\n // remember the min latency so that we can re-trigger later\r\n _delayedBatchSendLatency = _delayedBatchSendLatency >= 0 ? Math.min(_delayedBatchSendLatency, latency) : latency;\r\n _delayedBatchReason = Math.max(_delayedBatchReason, sendReason);\r\n }\r\n return eventsQueued;\r\n }\r\n /**\r\n * This is the callback method is called as part of the manual flushing process.\r\n * @param callback\r\n * @param sendReason\r\n */\r\n function _flushImpl(callback, sendReason) {\r\n // Add any additional queued events and cause all queued events to be sent asynchronously\r\n _sendEventsForLatencyAndAbove(1 /* EventLatencyValue.Normal */, 0 /* EventSendType.Batched */, sendReason);\r\n // All events (should) have been queue -- lets just make sure the queue counts are correct to avoid queue exhaustion (previous bug #9685112)\r\n _resetQueueCounts();\r\n _waitForIdleManager(function () {\r\n // Only called AFTER the httpManager does not have any outstanding requests\r\n if (callback) {\r\n callback();\r\n }\r\n if (_flushCallbackQueue.length > 0) {\r\n _flushCallbackTimerId = _createTimer(function () {\r\n _flushCallbackTimerId = null;\r\n _flushImpl(_flushCallbackQueue.shift(), sendReason);\r\n }, 0);\r\n }\r\n else {\r\n // No more flush requests\r\n _flushCallbackTimerId = null;\r\n // Restart the normal timer schedule\r\n _scheduleTimer();\r\n }\r\n });\r\n }\r\n function _waitForIdleManager(callback) {\r\n if (_httpManager.isCompletelyIdle()) {\r\n callback();\r\n }\r\n else {\r\n _flushCallbackTimerId = _createTimer(function () {\r\n _flushCallbackTimerId = null;\r\n _waitForIdleManager(callback);\r\n }, FlushCheckTimer);\r\n }\r\n }\r\n /**\r\n * Resets the transmit profiles to the default profiles of Real Time, Near Real Time\r\n * and Best Effort. This removes all the custom profiles that were loaded.\r\n */\r\n function _resetTransmitProfiles() {\r\n _clearScheduledTimer();\r\n _initializeProfiles();\r\n _currentProfile = RT_PROFILE;\r\n _scheduleTimer();\r\n }\r\n function _initializeProfiles() {\r\n _profiles = {};\r\n _profiles[RT_PROFILE] = [2, 1, 0];\r\n _profiles[NRT_PROFILE] = [6, 3, 0];\r\n _profiles[BE_PROFILE] = [18, 9, 0];\r\n }\r\n /**\r\n * The notification handler for requeue events\r\n * @ignore\r\n */\r\n function _requeueEvents(batches, reason) {\r\n var droppedEvents = [];\r\n var maxSendAttempts = _maxEventSendAttempts;\r\n if (_isPageUnloadTriggered) {\r\n // If a page unlaod has been triggered reduce the number of times we try to \"retry\"\r\n maxSendAttempts = _maxUnloadEventSendAttempts;\r\n }\r\n arrForEach(batches, function (theBatch) {\r\n if (theBatch && theBatch.count() > 0) {\r\n arrForEach(theBatch.events(), function (theEvent) {\r\n if (theEvent) {\r\n // Check if the request being added back is for a sync event in which case mark it no longer a sync event\r\n if (theEvent.sync) {\r\n theEvent.latency = 4 /* EventLatencyValue.Immediate */;\r\n theEvent.sync = false;\r\n }\r\n if (theEvent.sendAttempt < maxSendAttempts) {\r\n // Reset the event timings\r\n setProcessTelemetryTimings(theEvent, _self.identifier);\r\n _addEventToQueues(theEvent, false);\r\n }\r\n else {\r\n droppedEvents.push(theEvent);\r\n }\r\n }\r\n });\r\n }\r\n });\r\n if (droppedEvents.length > 0) {\r\n _notifyEvents(strEventsDiscarded, droppedEvents, EventsDiscardedReason.NonRetryableStatus);\r\n }\r\n if (_isPageUnloadTriggered) {\r\n // Unload event has been received so we need to try and flush new events\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n }\r\n function _callNotification(evtName, theArgs) {\r\n var manager = (_self._notificationManager || {});\r\n var notifyFunc = manager[evtName];\r\n if (notifyFunc) {\r\n try {\r\n notifyFunc.apply(manager, theArgs);\r\n }\r\n catch (e) {\r\n _throwInternal(_self.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 74 /* _eInternalMessageId.NotificationException */, evtName + \" notification failed: \" + e);\r\n }\r\n }\r\n }\r\n function _notifyEvents(evtName, theEvents) {\r\n var extraArgs = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n extraArgs[_i - 2] = arguments[_i];\r\n }\r\n if (theEvents && theEvents.length > 0) {\r\n _callNotification(evtName, [theEvents].concat(extraArgs));\r\n }\r\n }\r\n function _notifyBatchEvents(evtName, batches) {\r\n var extraArgs = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n extraArgs[_i - 2] = arguments[_i];\r\n }\r\n if (batches && batches.length > 0) {\r\n arrForEach(batches, function (theBatch) {\r\n if (theBatch && theBatch.count() > 0) {\r\n _callNotification(evtName, [theBatch.events()].concat(extraArgs));\r\n }\r\n });\r\n }\r\n }\r\n /**\r\n * The notification handler for when batches are about to be sent\r\n * @ignore\r\n */\r\n function _sendingEvent(batches, reason, isSyncRequest) {\r\n if (batches && batches.length > 0) {\r\n _callNotification(\"eventsSendRequest\", [(reason >= 1000 /* EventBatchNotificationReason.SendingUndefined */ && reason <= 1999 /* EventBatchNotificationReason.SendingEventMax */ ?\r\n reason - 1000 /* EventBatchNotificationReason.SendingUndefined */ :\r\n 0 /* SendRequestReason.Undefined */), isSyncRequest !== true]);\r\n }\r\n }\r\n /**\r\n * This event represents that a batch of events have been successfully sent and a response received\r\n * @param batches The notification handler for when the batches have been successfully sent\r\n * @param reason For this event the reason will always be EventBatchNotificationReason.Complete\r\n */\r\n function _eventsSentEvent(batches, reason) {\r\n _notifyBatchEvents(\"eventsSent\", batches, reason);\r\n // Try and schedule the processing timer if we have events\r\n _scheduleTimer();\r\n }\r\n function _eventsDropped(batches, reason) {\r\n _notifyBatchEvents(strEventsDiscarded, batches, (reason >= 8000 /* EventBatchNotificationReason.EventsDropped */ && reason <= 8999 /* EventBatchNotificationReason.EventsDroppedMax */ ?\r\n reason - 8000 /* EventBatchNotificationReason.EventsDropped */ :\r\n EventsDiscardedReason.Unknown));\r\n }\r\n function _eventsResponseFail(batches) {\r\n _notifyBatchEvents(strEventsDiscarded, batches, EventsDiscardedReason.NonRetryableStatus);\r\n // Try and schedule the processing timer if we have events\r\n _scheduleTimer();\r\n }\r\n function _otherEvent(batches, reason) {\r\n _notifyBatchEvents(strEventsDiscarded, batches, EventsDiscardedReason.Unknown);\r\n // Try and schedule the processing timer if we have events\r\n _scheduleTimer();\r\n }\r\n function _setAutoLimits() {\r\n if (!_config || !_config.disableAutoBatchFlushLimit) {\r\n _autoFlushBatchLimit = Math.max(MaxNumberEventPerBatch * (MaxConnections + 1), _queueSizeLimit / 6);\r\n }\r\n else {\r\n _autoFlushBatchLimit = 0;\r\n }\r\n }\r\n // Provided for backward compatibility they are not \"expected\" to be in current use but they are public\r\n objDefineAccessors(_self, \"_setTimeoutOverride\", function () { return _timeoutWrapper.set; }, function (value) {\r\n // Recreate the timeout wrapper\r\n _timeoutWrapper = createTimeoutWrapper(value, _timeoutWrapper.clear);\r\n });\r\n objDefineAccessors(_self, \"_clearTimeoutOverride\", function () { return _timeoutWrapper.clear; }, function (value) {\r\n // Recreate the timeout wrapper\r\n _timeoutWrapper = createTimeoutWrapper(_timeoutWrapper.set, value);\r\n });\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Start the queue manager to batch and send events via post.\r\n * @param config - The core configuration.\r\n */\r\n PostChannel.prototype.initialize = function (coreConfig, core, extensions) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add an event to the appropriate inbound queue based on its latency.\r\n * @param ev - The event to be added to the queue.\r\n * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances\r\n * can optionally use this to access the current core instance or define / pass additional information\r\n * to later plugins (vs appending items to the telemetry item)\r\n */\r\n PostChannel.prototype.processTelemetry = function (ev, itemCtx) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Sets the event queue limits at runtime (after initialization), if the number of queued events is greater than the\r\n * eventLimit or autoFlushLimit then a flush() operation will be scheduled.\r\n * @param eventLimit The number of events that can be kept in memory before the SDK starts to drop events. If the value passed is less than or\r\n * equal to zero the value will be reset to the default (10,000).\r\n * @param autoFlushLimit When defined, once this number of events has been queued the system perform a flush() to send the queued events\r\n * without waiting for the normal schedule timers. Passing undefined, null or a value less than or equal to zero will disable the auto flush.\r\n */\r\n PostChannel.prototype.setEventQueueLimits = function (eventLimit, autoFlushLimit) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Pause the transmission of any requests\r\n */\r\n PostChannel.prototype.pause = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Resumes transmission of events.\r\n */\r\n PostChannel.prototype.resume = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Add handler to be executed with request response text.\r\n */\r\n PostChannel.prototype.addResponseHandler = function (responseHanlder) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Flush to send data immediately; channel should default to sending data asynchronously\r\n * @param async - send data asynchronously when true\r\n * @param callback - if specified, notify caller when send is complete\r\n */\r\n PostChannel.prototype.flush = function (async, callback, sendReason) {\r\n if (async === void 0) { async = true; }\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Set AuthMsaDeviceTicket header\r\n * @param ticket - Ticket value.\r\n */\r\n PostChannel.prototype.setMsaAuthTicket = function (ticket) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Check if there are any events waiting to be scheduled for sending.\r\n * @returns True if there are events, false otherwise.\r\n */\r\n PostChannel.prototype.hasEvents = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Load custom transmission profiles. Each profile should have timers for real time, and normal and can\r\n * optionally specify the immediate latency time in ms (defaults to 0 when not defined). Each profile should\r\n * make sure that a each normal latency timer is a multiple of the real-time latency and the immediate\r\n * is smaller than the real-time.\r\n * Setting the timer value to -1 means that the events for that latency will not be scheduled to be sent.\r\n * Note that once a latency has been set to not send, all latencies below it will also not be sent. The\r\n * timers should be in the form of [normal, high, [immediate]].\r\n * e.g Custom:\r\n * [10,5] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate will default to 0ms\r\n * [10,5,1] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate will default to 1ms\r\n * [10,5,0] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate will default to 0ms\r\n * [10,5,-1] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate events will not be\r\n * scheduled on their own and but they will be included with real-time or normal events as the first events in a batch.\r\n * This also removes any previously loaded custom profiles.\r\n * @param profiles - A dictionary containing the transmit profiles.\r\n */\r\n PostChannel.prototype._loadTransmitProfiles = function (profiles) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Set the transmit profile to be used. This will change the transmission timers\r\n * based on the transmit profile.\r\n * @param profileName - The name of the transmit profile to be used.\r\n */\r\n PostChannel.prototype._setTransmitProfile = function (profileName) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Backs off transmission. This exponentially increases all the timers.\r\n */\r\n PostChannel.prototype._backOffTransmission = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Clears backoff for transmission.\r\n */\r\n PostChannel.prototype._clearBackOff = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return PostChannel;\r\n}(BaseTelemetryPlugin));\r\nexport default PostChannel;\r\n//# sourceMappingURL=PostChannel.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\nvar _a;\r\nimport { createEnumStyle } from \"../JavaScriptSDK.Enums/EnumHelperFuncs\";\r\nvar FAILED = \"Failed\";\r\nvar FAILED_MONITOR_AJAX = FAILED + \"MonitorAjax\";\r\nvar TRACK = \"Track\";\r\nvar START = \"Start\";\r\nvar STOP = \"Stop\";\r\nvar EVENT = \"Event\";\r\nvar AUTH_CONTEXT = \"AuthContext\";\r\nvar EXCEPTION = \"Exception\";\r\nvar LOCAL = \"Local\";\r\nvar SESSION = \"Session\";\r\nvar STORAGE = \"Storage\";\r\nvar BROWSER = \"Browser\";\r\nvar CANNOT = \"Cannot\";\r\nvar BUFFER = \"Buffer\";\r\nvar INSTRUMENTATION_KEY = \"InstrumentationKey\";\r\nexport var LoggingSeverity = createEnumStyle({\r\n CRITICAL: 1 /* eLoggingSeverity.CRITICAL */,\r\n WARNING: 2 /* eLoggingSeverity.WARNING */\r\n});\r\n/**\r\n * Internal message ID. Please create a new one for every conceptually different message. Please keep alphabetically ordered\r\n */\r\nexport var _InternalMessageId = createEnumStyle((_a = {},\r\n // Non user actionable\r\n _a[BROWSER + \"DoesNotSupport\" + LOCAL + STORAGE] = 0 /* _eInternalMessageId.BrowserDoesNotSupportLocalStorage */,\r\n _a[BROWSER + CANNOT + \"Read\" + LOCAL + STORAGE] = 1 /* _eInternalMessageId.BrowserCannotReadLocalStorage */,\r\n _a[BROWSER + CANNOT + \"Read\" + SESSION + STORAGE] = 2 /* _eInternalMessageId.BrowserCannotReadSessionStorage */,\r\n _a[BROWSER + CANNOT + \"Write\" + LOCAL + STORAGE] = 3 /* _eInternalMessageId.BrowserCannotWriteLocalStorage */,\r\n _a[BROWSER + CANNOT + \"Write\" + SESSION + STORAGE] = 4 /* _eInternalMessageId.BrowserCannotWriteSessionStorage */,\r\n _a[BROWSER + FAILED + \"RemovalFrom\" + LOCAL + STORAGE] = 5 /* _eInternalMessageId.BrowserFailedRemovalFromLocalStorage */,\r\n _a[BROWSER + FAILED + \"RemovalFrom\" + SESSION + STORAGE] = 6 /* _eInternalMessageId.BrowserFailedRemovalFromSessionStorage */,\r\n _a[CANNOT + \"SendEmptyTelemetry\"] = 7 /* _eInternalMessageId.CannotSendEmptyTelemetry */,\r\n _a.ClientPerformanceMathError = 8 /* _eInternalMessageId.ClientPerformanceMathError */,\r\n _a[\"ErrorParsingAI\" + SESSION + \"Cookie\"] = 9 /* _eInternalMessageId.ErrorParsingAISessionCookie */,\r\n _a.ErrorPVCalc = 10 /* _eInternalMessageId.ErrorPVCalc */,\r\n _a[EXCEPTION + \"WhileLoggingError\"] = 11 /* _eInternalMessageId.ExceptionWhileLoggingError */,\r\n _a[FAILED + \"AddingTelemetryTo\" + BUFFER] = 12 /* _eInternalMessageId.FailedAddingTelemetryToBuffer */,\r\n _a[FAILED_MONITOR_AJAX + \"Abort\"] = 13 /* _eInternalMessageId.FailedMonitorAjaxAbort */,\r\n _a[FAILED_MONITOR_AJAX + \"Dur\"] = 14 /* _eInternalMessageId.FailedMonitorAjaxDur */,\r\n _a[FAILED_MONITOR_AJAX + \"Open\"] = 15 /* _eInternalMessageId.FailedMonitorAjaxOpen */,\r\n _a[FAILED_MONITOR_AJAX + \"RSC\"] = 16 /* _eInternalMessageId.FailedMonitorAjaxRSC */,\r\n _a[FAILED_MONITOR_AJAX + \"Send\"] = 17 /* _eInternalMessageId.FailedMonitorAjaxSend */,\r\n _a[FAILED_MONITOR_AJAX + \"GetCorrelationHeader\"] = 18 /* _eInternalMessageId.FailedMonitorAjaxGetCorrelationHeader */,\r\n _a[FAILED + \"ToAddHandlerForOnBeforeUnload\"] = 19 /* _eInternalMessageId.FailedToAddHandlerForOnBeforeUnload */,\r\n _a[FAILED + \"ToSendQueuedTelemetry\"] = 20 /* _eInternalMessageId.FailedToSendQueuedTelemetry */,\r\n _a[FAILED + \"ToReportDataLoss\"] = 21 /* _eInternalMessageId.FailedToReportDataLoss */,\r\n _a[\"Flush\" + FAILED] = 22 /* _eInternalMessageId.FlushFailed */,\r\n _a.MessageLimitPerPVExceeded = 23 /* _eInternalMessageId.MessageLimitPerPVExceeded */,\r\n _a.MissingRequiredFieldSpecification = 24 /* _eInternalMessageId.MissingRequiredFieldSpecification */,\r\n _a.NavigationTimingNotSupported = 25 /* _eInternalMessageId.NavigationTimingNotSupported */,\r\n _a.OnError = 26 /* _eInternalMessageId.OnError */,\r\n _a[SESSION + \"RenewalDateIsZero\"] = 27 /* _eInternalMessageId.SessionRenewalDateIsZero */,\r\n _a.SenderNotInitialized = 28 /* _eInternalMessageId.SenderNotInitialized */,\r\n _a[START + TRACK + EVENT + FAILED] = 29 /* _eInternalMessageId.StartTrackEventFailed */,\r\n _a[STOP + TRACK + EVENT + FAILED] = 30 /* _eInternalMessageId.StopTrackEventFailed */,\r\n _a[START + TRACK + FAILED] = 31 /* _eInternalMessageId.StartTrackFailed */,\r\n _a[STOP + TRACK + FAILED] = 32 /* _eInternalMessageId.StopTrackFailed */,\r\n _a.TelemetrySampledAndNotSent = 33 /* _eInternalMessageId.TelemetrySampledAndNotSent */,\r\n _a[TRACK + EVENT + FAILED] = 34 /* _eInternalMessageId.TrackEventFailed */,\r\n _a[TRACK + EXCEPTION + FAILED] = 35 /* _eInternalMessageId.TrackExceptionFailed */,\r\n _a[TRACK + \"Metric\" + FAILED] = 36 /* _eInternalMessageId.TrackMetricFailed */,\r\n _a[TRACK + \"PV\" + FAILED] = 37 /* _eInternalMessageId.TrackPVFailed */,\r\n _a[TRACK + \"PV\" + FAILED + \"Calc\"] = 38 /* _eInternalMessageId.TrackPVFailedCalc */,\r\n _a[TRACK + \"Trace\" + FAILED] = 39 /* _eInternalMessageId.TrackTraceFailed */,\r\n _a[\"Transmission\" + FAILED] = 40 /* _eInternalMessageId.TransmissionFailed */,\r\n _a[FAILED + \"ToSet\" + STORAGE + BUFFER] = 41 /* _eInternalMessageId.FailedToSetStorageBuffer */,\r\n _a[FAILED + \"ToRestore\" + STORAGE + BUFFER] = 42 /* _eInternalMessageId.FailedToRestoreStorageBuffer */,\r\n _a.InvalidBackendResponse = 43 /* _eInternalMessageId.InvalidBackendResponse */,\r\n _a[FAILED + \"ToFixDepricatedValues\"] = 44 /* _eInternalMessageId.FailedToFixDepricatedValues */,\r\n _a.InvalidDurationValue = 45 /* _eInternalMessageId.InvalidDurationValue */,\r\n _a.TelemetryEnvelopeInvalid = 46 /* _eInternalMessageId.TelemetryEnvelopeInvalid */,\r\n _a.CreateEnvelopeError = 47 /* _eInternalMessageId.CreateEnvelopeError */,\r\n // User actionable\r\n _a[CANNOT + \"SerializeObject\"] = 48 /* _eInternalMessageId.CannotSerializeObject */,\r\n _a[CANNOT + \"SerializeObjectNonSerializable\"] = 49 /* _eInternalMessageId.CannotSerializeObjectNonSerializable */,\r\n _a.CircularReferenceDetected = 50 /* _eInternalMessageId.CircularReferenceDetected */,\r\n _a[\"Clear\" + AUTH_CONTEXT + FAILED] = 51 /* _eInternalMessageId.ClearAuthContextFailed */,\r\n _a[EXCEPTION + \"Truncated\"] = 52 /* _eInternalMessageId.ExceptionTruncated */,\r\n _a.IllegalCharsInName = 53 /* _eInternalMessageId.IllegalCharsInName */,\r\n _a.ItemNotInArray = 54 /* _eInternalMessageId.ItemNotInArray */,\r\n _a.MaxAjaxPerPVExceeded = 55 /* _eInternalMessageId.MaxAjaxPerPVExceeded */,\r\n _a.MessageTruncated = 56 /* _eInternalMessageId.MessageTruncated */,\r\n _a.NameTooLong = 57 /* _eInternalMessageId.NameTooLong */,\r\n _a.SampleRateOutOfRange = 58 /* _eInternalMessageId.SampleRateOutOfRange */,\r\n _a[\"Set\" + AUTH_CONTEXT + FAILED] = 59 /* _eInternalMessageId.SetAuthContextFailed */,\r\n _a[\"Set\" + AUTH_CONTEXT + FAILED + \"AccountName\"] = 60 /* _eInternalMessageId.SetAuthContextFailedAccountName */,\r\n _a.StringValueTooLong = 61 /* _eInternalMessageId.StringValueTooLong */,\r\n _a.StartCalledMoreThanOnce = 62 /* _eInternalMessageId.StartCalledMoreThanOnce */,\r\n _a.StopCalledWithoutStart = 63 /* _eInternalMessageId.StopCalledWithoutStart */,\r\n _a[\"TelemetryInitializer\" + FAILED] = 64 /* _eInternalMessageId.TelemetryInitializerFailed */,\r\n _a.TrackArgumentsNotSpecified = 65 /* _eInternalMessageId.TrackArgumentsNotSpecified */,\r\n _a.UrlTooLong = 66 /* _eInternalMessageId.UrlTooLong */,\r\n _a[SESSION + STORAGE + BUFFER + \"Full\"] = 67 /* _eInternalMessageId.SessionStorageBufferFull */,\r\n _a[CANNOT + \"AccessCookie\"] = 68 /* _eInternalMessageId.CannotAccessCookie */,\r\n _a.IdTooLong = 69 /* _eInternalMessageId.IdTooLong */,\r\n _a.InvalidEvent = 70 /* _eInternalMessageId.InvalidEvent */,\r\n _a[FAILED_MONITOR_AJAX + \"SetRequestHeader\"] = 71 /* _eInternalMessageId.FailedMonitorAjaxSetRequestHeader */,\r\n _a[\"Send\" + BROWSER + \"InfoOnUserInit\"] = 72 /* _eInternalMessageId.SendBrowserInfoOnUserInit */,\r\n _a[\"Plugin\" + EXCEPTION] = 73 /* _eInternalMessageId.PluginException */,\r\n _a[\"Notification\" + EXCEPTION] = 74 /* _eInternalMessageId.NotificationException */,\r\n _a.SnippetScriptLoadFailure = 99 /* _eInternalMessageId.SnippetScriptLoadFailure */,\r\n _a[\"Invalid\" + INSTRUMENTATION_KEY] = 100 /* _eInternalMessageId.InvalidInstrumentationKey */,\r\n _a[CANNOT + \"ParseAiBlobValue\"] = 101 /* _eInternalMessageId.CannotParseAiBlobValue */,\r\n _a.InvalidContentBlob = 102 /* _eInternalMessageId.InvalidContentBlob */,\r\n _a[TRACK + \"PageAction\" + EVENT + FAILED] = 103 /* _eInternalMessageId.TrackPageActionEventFailed */,\r\n _a[FAILED + \"AddingCustomDefinedRequestContext\"] = 104 /* _eInternalMessageId.FailedAddingCustomDefinedRequestContext */,\r\n _a[\"InMemory\" + STORAGE + BUFFER + \"Full\"] = 105 /* _eInternalMessageId.InMemoryStorageBufferFull */,\r\n _a[INSTRUMENTATION_KEY + \"Deprecation\"] = 106 /* _eInternalMessageId.InstrumentationKeyDeprecation */,\r\n _a));\r\n//# sourceMappingURL=LoggingEnums.js.map","import { __extends } from \"tslib\";\r\n/**\r\n* ApplicationInsights.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n* Main class containing all the APIs.\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AppInsightsCore, doPerf, dumpObj, throwError, _throwInternal } from \"@microsoft/1ds-core-js\";\r\nimport { PropertiesPlugin } from \"@microsoft/1ds-properties-js\";\r\nimport { PostChannel } from \"@microsoft/1ds-post-js\";\r\nvar ApplicationInsights = /** @class */ (function (_super) {\r\n __extends(ApplicationInsights, _super);\r\n function ApplicationInsights() {\r\n var _this = _super.call(this) || this;\r\n var _postChannel;\r\n var _propertyManager;\r\n dynamicProto(ApplicationInsights, _this, function (_self, _base) {\r\n _self.initialize = function (config, extensions) {\r\n var _self = _this;\r\n doPerf(_this, function () { return \"ApplicationInsights:initialize\"; }, function () {\r\n _postChannel = new PostChannel();\r\n _propertyManager = new PropertiesPlugin();\r\n var plugins = [_propertyManager];\r\n if (extensions) {\r\n plugins = plugins.concat(extensions);\r\n }\r\n if (!config) {\r\n throwError(\"You must provide a config object!\");\r\n }\r\n var channels = config.channels;\r\n if (channels && channels.length > 0) {\r\n // Add post channel to first fork if not available\r\n var postFound = false;\r\n for (var j = 0; j < channels[0].length; j++) {\r\n if (channels[0][j].identifier === _postChannel.identifier) {\r\n postFound = true;\r\n break;\r\n }\r\n }\r\n if (!postFound) {\r\n channels[0].push(_postChannel);\r\n }\r\n }\r\n else {\r\n config.channels = [[_postChannel]];\r\n }\r\n var extConfig = config.extensionConfig = config.extensionConfig || [];\r\n extConfig[_postChannel.identifier] = extConfig[_postChannel.identifier] || (config && config.channelConfiguration) || {};\r\n extConfig[_propertyManager.identifier] = extConfig[_propertyManager.identifier] || (config && config.propertyConfiguration) || {};\r\n try {\r\n _base.initialize(config, plugins);\r\n }\r\n catch (error) {\r\n _throwInternal(_self.logger, 1 /* eLoggingSeverity.CRITICAL */, 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */, \"Failed to initialize SDK.\" + dumpObj(error));\r\n }\r\n }, function () { return ({ config: config, extensions: extensions }); });\r\n };\r\n /**\r\n * Gets the property manager to set custom properties and system properties (part A), that should be applied\r\n * to all events or events with a specific instrumentation key.\r\n * @returns The property manager object.\r\n */\r\n _self.getPropertyManager = function () {\r\n return _propertyManager;\r\n };\r\n /**\r\n * Gets the post channel to configure and set the transmission profiles.\r\n * @returns The post channel object.\r\n */\r\n _self.getPostChannel = function () {\r\n return _postChannel;\r\n };\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Initialize the sdk.\r\n * @param config - The configuration to initialize the SDK.\r\n * @param extensions - An array of extensions that are to be used by the core.\r\n */\r\n ApplicationInsights.prototype.initialize = function (config, extensions) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Gets the property manager to set custom properties and system properties (part A), that should be applied\r\n * to all events or events with a specific instrumentation key.\r\n * @returns The property manager object.\r\n */\r\n ApplicationInsights.prototype.getPropertyManager = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Gets the post channel to configure and set the transmission profiles.\r\n * @returns The post channel object.\r\n */\r\n ApplicationInsights.prototype.getPostChannel = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return ApplicationInsights;\r\n}(AppInsightsCore));\r\nexport default ApplicationInsights;\r\n//# sourceMappingURL=ApplicationInsights.js.map","/**\r\n* Enums.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n* File containing the enums as constants.\r\n*/\r\nimport { __assign } from \"tslib\";\r\nimport { _InternalMessageId, createEnumStyle, objFreeze } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * The ValueKind contains a set of values that specify value kind of the property.\r\n * Either PII (Personal Identifiable Information) or customer content.\r\n */\r\nexport var ValueKind = createEnumStyle({\r\n NotSet: 0 /* eValueKind.NotSet */,\r\n Pii_DistinguishedName: 1 /* eValueKind.Pii_DistinguishedName */,\r\n Pii_GenericData: 2 /* eValueKind.Pii_GenericData */,\r\n Pii_IPV4Address: 3 /* eValueKind.Pii_IPV4Address */,\r\n Pii_IPv6Address: 4 /* eValueKind.Pii_IPv6Address */,\r\n Pii_MailSubject: 5 /* eValueKind.Pii_MailSubject */,\r\n Pii_PhoneNumber: 6 /* eValueKind.Pii_PhoneNumber */,\r\n Pii_QueryString: 7 /* eValueKind.Pii_QueryString */,\r\n Pii_SipAddress: 8 /* eValueKind.Pii_SipAddress */,\r\n Pii_SmtpAddress: 9 /* eValueKind.Pii_SmtpAddress */,\r\n Pii_Identity: 10 /* eValueKind.Pii_Identity */,\r\n Pii_Uri: 11 /* eValueKind.Pii_Uri */,\r\n Pii_Fqdn: 12 /* eValueKind.Pii_Fqdn */,\r\n Pii_IPV4AddressLegacy: 13 /* eValueKind.Pii_IPV4AddressLegacy */,\r\n CustomerContent_GenericContent: 32 /* eValueKind.CustomerContent_GenericContent */\r\n});\r\n/**\r\n * The EventLatency contains a set of values that specify the latency with which an event is sent.\r\n */\r\nexport var EventLatency = createEnumStyle({\r\n /**\r\n * Normal latency.\r\n */\r\n Normal: 1 /* EventLatencyValue.Normal */,\r\n /**\r\n * Cost deferred latency. At the moment this latency is treated as Normal latency.\r\n */\r\n CostDeferred: 2 /* EventLatencyValue.CostDeferred */,\r\n /**\r\n * Real time latency.\r\n */\r\n RealTime: 3 /* EventLatencyValue.RealTime */,\r\n /**\r\n * Bypass normal batching/timing and send as soon as possible, this will still send asynchronously.\r\n * Added in v3.1.1\r\n */\r\n Immediate: 4 /* EventLatencyValue.Immediate */\r\n});\r\n/**\r\n * Enum for property types.\r\n */\r\nexport var EventPropertyType = createEnumStyle({\r\n Unspecified: 0 /* eEventPropertyType.Unspecified */,\r\n String: 1 /* eEventPropertyType.String */,\r\n Int32: 2 /* eEventPropertyType.Int32 */,\r\n UInt32: 3 /* eEventPropertyType.UInt32 */,\r\n Int64: 4 /* eEventPropertyType.Int64 */,\r\n UInt64: 5 /* eEventPropertyType.UInt64 */,\r\n Double: 6 /* eEventPropertyType.Double */,\r\n Bool: 7 /* eEventPropertyType.Bool */,\r\n Guid: 8 /* eEventPropertyType.Guid */,\r\n DateTime: 9 /* eEventPropertyType.DateTime */\r\n});\r\n/**\r\n * The EventPersistence contains a set of values that specify the event's persistence.\r\n */\r\nexport var EventPersistence = createEnumStyle({\r\n /**\r\n * Normal persistence.\r\n */\r\n Normal: 1 /* EventPersistenceValue.Normal */,\r\n /**\r\n * Critical persistence.\r\n */\r\n Critical: 2 /* EventPersistenceValue.Critical */\r\n});\r\nexport var TraceLevel = createEnumStyle({\r\n NONE: 0 /* eTraceLevel.NONE */,\r\n ERROR: 1 /* eTraceLevel.ERROR */,\r\n WARNING: 2 /* eTraceLevel.WARNING */,\r\n INFORMATION: 3 /* eTraceLevel.INFORMATION */\r\n});\r\nexport var _ExtendedInternalMessageId = objFreeze(__assign(__assign({}, _InternalMessageId), createEnumStyle({\r\n AuthHandShakeError: 501 /* _eExtendedInternalMessageId.AuthHandShakeError */,\r\n AuthRedirectFail: 502 /* _eExtendedInternalMessageId.AuthRedirectFail */,\r\n BrowserCannotReadLocalStorage: 503 /* _eExtendedInternalMessageId.BrowserCannotReadLocalStorage */,\r\n BrowserCannotWriteLocalStorage: 504 /* _eExtendedInternalMessageId.BrowserCannotWriteLocalStorage */,\r\n BrowserDoesNotSupportLocalStorage: 505 /* _eExtendedInternalMessageId.BrowserDoesNotSupportLocalStorage */,\r\n CannotParseBiBlobValue: 506 /* _eExtendedInternalMessageId.CannotParseBiBlobValue */,\r\n CannotParseDataAttribute: 507 /* _eExtendedInternalMessageId.CannotParseDataAttribute */,\r\n CVPluginNotAvailable: 508 /* _eExtendedInternalMessageId.CVPluginNotAvailable */,\r\n DroppedEvent: 509 /* _eExtendedInternalMessageId.DroppedEvent */,\r\n ErrorParsingAISessionCookie: 510 /* _eExtendedInternalMessageId.ErrorParsingAISessionCookie */,\r\n ErrorProvidedChannels: 511 /* _eExtendedInternalMessageId.ErrorProvidedChannels */,\r\n FailedToGetCookies: 512 /* _eExtendedInternalMessageId.FailedToGetCookies */,\r\n FailedToInitializeCorrelationVector: 513 /* _eExtendedInternalMessageId.FailedToInitializeCorrelationVector */,\r\n FailedToInitializeSDK: 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */,\r\n InvalidContentBlob: 515 /* _eExtendedInternalMessageId.InvalidContentBlob */,\r\n InvalidCorrelationValue: 516 /* _eExtendedInternalMessageId.InvalidCorrelationValue */,\r\n SessionRenewalDateIsZero: 517 /* _eExtendedInternalMessageId.SessionRenewalDateIsZero */,\r\n SendPostOnCompleteFailure: 518 /* _eExtendedInternalMessageId.SendPostOnCompleteFailure */,\r\n PostResponseHandler: 519 /* _eExtendedInternalMessageId.PostResponseHandler */,\r\n SDKNotInitialized: 520 /* _eExtendedInternalMessageId.SDKNotInitialized */\r\n})));\r\n//# sourceMappingURL=Enums.js.map","\"use strict\";\r\nexport var MinChannelPriorty = 100;\r\n//# sourceMappingURL=IChannelControls.js.map"],"names":["strShimFunction","strShimObject","strShimUndefined","ObjClass","Object","ObjProto","ObjAssign","ObjCreate","ObjDefineProperty","ObjHasOwnProperty","_cachedGlobal","getGlobal","useCached","result","globalThis","self","window","global","throwTypeError","message","TypeError","objCreateFn","obj","type","tmpFunc","_a","__assignFn","t","s","i","n","arguments","length","p","call","extendStaticsFn","d","b","__proto__","Array","__extendsFn","__","this","constructor","String","__spreadArrayFn","to","from","il","j","UNDEFINED","Constructor","Prototype","strFunction","DynClassName","UnknownValue","DynProtoBaseProto","Obj","_objGetPrototypeOf","_objGetOwnProps","_gbl","_gblInst","o","_hasOwnProperty","prop","hasOwnProperty","_isObjectOrArrayPrototype","target","_isObjectArrayOrFunctionPrototype","Function","_getObjProto","newProto","curProto","_forEachProp","func","props","name_1","push","lp","_isDynamicCandidate","funcName","skipOwn","_throwTypeError","_hasVisited","values","value","_getInstFunc","proto","currentDynProtoProxy","instFunc","instFuncTable","canAddInst","objProto","visited","protoFunc","e","_getProtoFunc","_populatePrototype","className","baseInstFuncs","setInstanceFunc","instFuncs_1","name","dynProtoProxy","apply","_createDynamicPrototype","_getObjName","unknownValue","dynamicProto","theClass","delegateFunc","options","classProto","thisTarget","thisProto","_checkPrototype","perfOptions","useBaseInst","undefined","instFuncs","_getInstanceFuncs","baseFuncs","_instFuncProxy","funcHost","theFunc","baseProto","_getBaseFuncs","STR_CHANNELS","STR_CREATE_PERF_MGR","STR_EXTENSION_CONFIG","STR_EVENTS_SENT","STR_EVENTS_DISCARDED","STR_EVENTS_SEND_REQUEST","STR_PERF_EVENT","STR_ERROR_TO_CONSOLE","STR_WARN_TO_CONSOLE","strConstructor","_objDefineProperty","_objFreeze","freeze","_objKeys","seal","keys","StringProto","_strTrim","_strEndsWith","_strStartsWith","_dataToISOString","Date","_isArray","isArray","_objToString","_fnToString","_objFunctionString","rCamelCase","rNormalizeInvalid","rLeadingNumeric","isTypeof","theType","isUndefined","isNullOrUndefined","isNotNullOrUndefined","isObject","normalizeJsName","callbackfn","strEndsWith","search","strStartsWith","checkValue","isDate","isError","isNumber","isBoolean","isPlainObject","toISOString","date","r","pad","arr","thisArg","arrIndexOf","searchElement","fromIndex","arrMap","results","arrReduce","initialValue","str","_objKeysHasDontEnumBug","toString","_objKeysDontEnums","objKeys","objDefineAccessors","getProp","setProp","enumerable","configurable","descriptor","_doNothing","objForEachKey","objFreeze","dateNow","getExceptionName","object","setValue","field","valChk","srcChk","theValue","getSetValue","defValue","getCfgValue","defaultValue","isTruthy","throwError","_createProxyFunction","source","srcFunc","src","proxyFunctionAs","overwriteTarget","proxyFunctions","functionsToProxy","arrForEach","optimizeObject","theObject","objExtend","obj1","obj2","obj3","obj4","obj5","obj6","deep","extended","clone","newValue","strWindow","strJSON","strMsie","strTrident","strXMLHttpRequest","_isTrident","_navUserAgentCheck","_enableMocks","_useXDomainRequest","_beaconsSupported","_hasProperty","property","supported","getGlobalInst","hasWindow","getWindow","hasDocument","getDocument","hasNavigator","getNavigator","getLocation","checkForMock","getPerformance","hasJSON","getJSON","isReactNative","isIE","dumpObj","propertyValueDump","isBeaconsSupported","isFetchSupported","withKeepAlive","isSupported","useXDomainRequest","isXhrSupported","_debugListener","listenerFuncs","_aiNamespace","_listenerProxyFunc","config","listener","getDebugExt","ns","getDebugListener","_sanitizeDiagnosticText","text","_logToConsole","logFunc","theConsole","_InternalLogMessage","isUserAct","msgId","strProps","properties","safeGetLogger","core","DiagnosticLogger","logMessage","_messageLogged","_self","_debugExtMsg","_loggingLevelConsole","_loggingLevelTelemetry","_maxInternalMessageLimit","_enableDebug","_setDefaultsFromConfig","_logInternalMessage","_messageCount","_getLogger","logger","_throwInternal","severity","msg","_warnToConsole","strToGMTString","strToUTCString","strExpires","_supportsCookies","_allowUaSameSite","_parsedCookieValue","_doc","_cookieCache","_globalCookieConfig","_gblCookieMgr","inst","_isMgrEnabled","cookieMgr","_isIgnoredCookie","cookieMgrCfg","safeGetCookieMgr","createCookieMgr","rootConfig","cookieEnabled","isEnabled","enabled","_enabled","expiry","setCookieFn","delCookie","areCookiesSupported","exception","_extractParts","thePart","_formatDate","theDate","_formatCookieValue","cookieValue","_getCookieValue","_setCookieValue","uaDisallowsSameSiteNone","userAgent","UInt32Mask","MaxUInt32","_mwcSeeded","_mwcW","_mwcZ","_mwcSeed","seedValue","_autoSeedMwc","randomValue","maxValue","random32","signed","mwcRandomSeed","mwcRandom32","newId","maxLength","number","chars","version","instanceName","_dataUid","_canAcceptData","_getCache","data","theCache","createUniqueNamespace","includeVersion","createElmNodeData","id","accept","get","kill","strEvents","strVisibilityChangeEvt","strPageHide","strPageShow","strUnload","strBeforeUnload","strPageHideNamespace","strPageShowNamespace","rRemoveEmptyNs","rRemoveTrailingEmptyNs","_guid","elmNodeData","eventNamespace","_normalizeNamespace","_getEvtNamespace","eventName","evtNamespace","theNamespace_1","_getRegisteredEvents","evtName","addDefault","registeredEvents","_doDetach","handlerRef","useCapture","_doUnregister","events","unRegFn","mergeEvtNamespace","theNamespace","namespaces","newNamespaces","eventOn","guid","eventOff","_unregisterEvents","found_1","addEventHandler","callback","_addEventListeners","excludeEvents","added","removeEventListeners","removeEventHandler","addPageUnloadEventListener","addPageHideEventListener","pageUnloadAdded","addPageShowEventListener","pageShowAdded","newGuid","perfNow","hexValues","tmp","FullVersionString","strWithCredentials","_fieldTypeEventPropMap","uInt8ArraySupported","Boolean","isValueAssigned","getTenantId","apiKey","isUint8ArrayAvailable","isLatency","sanitizeProperty","stringifyObjects","getCommonSchemaMetaData","kind","encodedTypeValue","getCookieValue","decode","createGuid","style","theGuid","extend","getTime","isValueKind","isArrayValid","setProcessTelemetryTimings","event","identifier","evt","getFieldValueType","_canUseCookies","isFunction","isString","strTrim","objCreate","generateW3CId","_defaultPerfManager","PerfEvent","accessorDefined","theDetails_1","payloadDetails","ctx","childTime","PerfManager","doPerfActiveKey","doPerf","mgrSource","getSource","details","isAsync","perfMgr","perfEvt","children","INVALID_TRACE_ID","INVALID_SPAN_ID","_isValid","len","invalidValue","isValidTraceId","isValidSpanId","pluginStateData","_getPluginState","plugin","initializePlugins","processContext","extensions","isInitialized","pluginState","lastPlugin","proxy","sortPlugins","plugins","strTelemetryPluginChain","_chainId","_createInternalContext","telemetryChain","_nextProxy","startAt","completeDetails","_onComplete","diagLog","getCfg","getExtCfg","hasNext","getNext","setNext","cb","args","mergeDefault","theConfig","newConfig_1","createProcessTelemetryContext","nextPlugin","createProcessTelemetryUnloadContext","createProcessTelemetryUpdateContext","createTelemetryProxyChain","add","chainId","getPlugin","processTelemetry","unload","update","_id","_setNext","nextProxy","itemCtx","hasRunContext","hasRun","item","firstProxy","lastProxy_1","createUnloadHandlerContainer","handler","handlers","BaseTelemetryPlugin","currentCtx","pluginChain","_rootCtx","_isinitialized","_nextPlugin","_hooks","_unloadHandlerContainer","_setDefaults","reason","unloadDone","fn","updateDone","createEnumStyle","enumClass","createValueMap","mapClass","Extensions","UserExt","DeviceExt","TraceExt","WebExt","AppExt","OSExt","SdkExt","IntWebExt","UtcExt","LocExt","CloudExt","DtExt","AppExtensionKeys","ver","appName","locale","expId","env","WebExtensionKeys","domain","browser","browserVer","screenRes","userConsent","consentDetails","UserExtensionKeys","localId","OSExtKeys","osName","SDKExtKeys","seq","installId","epoch","IntWebExtKeys","msfpc","anid","serviceName","UtcExtKeys","popSample","eventFlags","LocExtKeys","tz","SessionExtKeys","sessionId","DeviceExtKeys","deviceClass","make","model","CloudExtKeys","role","roleInstance","roleVer","TraceExtKeys","traceId","traceName","parentId","DistributedTraceExtKeys","spanId","traceFlags","_canUseLocalStorage","uid","storage","fail","_getId","_setId","Session","cookieNameConst","SessionManager","sessionRenewalMs","sessionExpirationMs","cookieDomain","namePrefix","sessionAsGuid","idLength","automaticSession","_setCookie","cookieExpiry","_cookieUpdatedTimestamp","functionalConfig","_storageNamePrefix","_initializeAutomaticSessionWithData","autoSession","_setStorage","setStorage","defaultFlightIdNameSpaces","_validateAppExpId","appExpIdNew","flightIdNameSpaces","appExpId","_isValidAppFlightId","appFlightId","isValid","_getExpId","Application","_appExpId","metaElements","metaData","Cloud","Device","_getMsfpc","_getAnid","IntWeb","Loc","timeZonePrefix","hours","minutes","OSNAMEREGEX","WIN","WINRT","WINPHONE","OSX","IOS","LINUX","ANDROID","CROS","VERSION_MAPPINGS","UNKNOWN","OSNAMES","os","_getOsVersion","_getGenericOsVersion","_getDelimiter","versionString","OperatingSystem","lowerCaseUserAgent","self_1","DEVICE_ID_COOKIE","Sdk","mgr","propertyStorage","deviceId","_saveData","Trace","_getLocalId","_setLocalId","User","_cookieMgr","_customLocalId","Utc","USER_CONSENT_DETAILS","EDGE_CHROMIUM","USER_AGENTS","ua","BRANDS","br","_userAgentContainsString","searchString","_getBrandVersion","match","brands","_getBrowserVersion","browserName","browserString","matches","_getUserConsent","Web","userAgentBrands","_parseUserAgent","h","w","_applyExtValues","extension","names","map","TelemetryContext","traceContext","parentCtx","getName","setName","trace","getTraceId","setTraceId","getSpanId","setSpanId","getTraceFlags","setTraceFlags","_sessionManager","session","traceCtx","_overwriteEventPartA","utcFields","traceFields","_this","_context","_properties","_base","_config","evtExt","_addPropertiesIfAbsent","outputMap","__extends","ChannelControllerPriority","_addChannelQueue","channelQueue","queue","chain","TelemetryInitializerPlugin","_initializers","remove","doNotSendItem","strValidationError","strSdkUnloadingError","defaultInitConfig","loggingLevelConsole","_createPerfManager","notificationMgr","_isPluginPresent","thePlugin","exists","BaseCore","interval","_internalLogPoller","clearInterval","_isInitialized","_telemetryInitializerPlugin","_eventQueue","_notificationManager","_perfManager","_cfgPerfManager","_cookieManager","_pluginChain","_coreExtensions","_configExtensions","_channelControl","_channelConfig","_channelQueue","_isUnloading","_internalLogsEventName","_evtNamespace","_unloadHandlers","_traceCtx","channelPriority","allExtensions","extPriorities","all","channels","idx","onComplete","processFn","priority","initialize","_processChannelQueue","pause","chainCtx","resume","flush","clearTimeout","cbTimer","callBack","cbTimeout","handled_1","sendReason","doneIterating","_setQueue","_doUpdate","theExt","_removePlugins","_initPluginChain","removed","removeCb","removeComplete","extConfig","telemetryItem","_forceStopInternalLogPoller","unloadState","unloadComplete","_doUnload","addCb","_logOrThrowError","updateState","_runListeners","listeners","setTimeout","NotificationManager","index","AppInsightsCore","_notifyInvalidEvent","_validateTelemetryItem","_pluginVersionStringArr","notificationManager","itemExt","baseData","itemProperties","InternalCore","EventsDiscardedReason","Unknown","NonRetryableStatus","InvalidEvent","SizeLimitExceeded","KillSwitch","QueueFull","RT_PROFILE","NRT_PROFILE","BE_PROFILE","_getEventMsfpc","theEvent","theEvents","EventBatch","_msfpc","cnt","_isFirstRequest","_allowRequestSending","_clockSkewHeaderValue","_shouldAddClockSkewHeaders","_clockSkewSet","_killedTokenDictionary","retryPolicyGetMillisToBackoffForRetry","retriesSoFar","waitDuration","MaxRecordSize","MaxBeaconRecordSize","Math","min","rCheckDot","Serializer","theMetaPathKeys","destObj","path","_isReservedCache","metadataCallback","newPath","_processPathKeys","apiKeys","payloadBlob","overflow","sizeExceed","failedEvts","batches","numEvents","retryCnt","isTeardown","isSync","isBeacon","sendType","payload","joinCount","eventsAdded","sizeExceeded","theBatch","iKey","evts","max","serializedEvent","serializedData","_addJSONPropertyMetaData","json","propKeys","propertyValue","f","metaTarget","newTarget","_noResponseQs","_eventActionMap","_collectorQsHeaders","_collectorHeaderToQs","_addCollectorHeaderQsMapping","qsName","headerName","allowQs","_getResponseText","xhr","_hasHeader","headers","header","hasHeader","_addRequestDetails","useHeaders","_prependTransports","theTransports","newTransports","HttpManager","transportType","sendPostFunc","_transport","_isSync","sendPOST","xdr","_doOnComplete","_handleCollectorResponse","timeoutOverride","body","method","requestInit","ignoreResponse","theUrl","fetch","headerMap","response","responseText","responseHandled","theHeaders","sync","urlString","withCredentials","disabled","timeout","_wrapSetXhrProp","xhrRequest","xhrComplete","oncomplete","droppedBatches_1","_sendBatchesNotification","status","_batchQueue","theBatches","droppedBatches","thePayload","_doPayloadSend","serializationStart","retryCount","isSynchronous","useSendBeacon","url","hdrs","useHdrs","requestDetails","apiQsKeys","timings","sendInterface_1","useHeaders_1","_setTimingValue","_thePayload","_sendReason","disableXhrSync","disableFetchKeepAlive","orgPayloadData","sender","_clockSkewManager","httpStatusCode","shouldRetry","isRetrying","_doAction","_sendBatches","backOffTrans","_postManager","_addEventCompletedTimings","_addCompleteTimings","_handleRequestFinished","_retryRequestIfNeeded","senderCalled_1","serializationCompleted","responseHandlers","action","theAction_1","sendSync","channelConfig","_urlString","_useHeaders","_core","_enableEventTimings","_logger","enableCompoundKey","_xhrTimeout","_disableXhrSync","_disableFetchKeepAlive","_addNoResponse","_useBeacons","_serializer","_customHttpInterface","_sendCredentials","beaconUnloadTransports","httpInterface","syncHttpInterface","beaconHttpInterface","_canHaveReducedPayload","_sendInterfaces","_queryStringParameters","_headers","_paused","defaultSetTimeout","ms","defaultClearTimeout","timeoutId","createTimeoutWrapper","argSetTimeout","argClearTimeout","set","clear","strEventsDiscarded","PostChannel","_isPageUnloadTriggered","_httpManager","_releaseAllQueues","queueSize","queueLimit","eventDropped","dropLatency","dropNumber","_immediateQueueSize","_queueSize","_notifyBatchEvents","_notifyEvents","_immediateTimerId","_sendEventsForLatencyAndAbove","immediateTimeOut","_scheduledTimerId","_timerCount","timeOut","_isTeardownCalled","_flushCallbackQueue","_flushCallbackTimerId","_immediateQueueSizeLimit","_queueSizeLimit","_profiles","_currentProfile","_currentBackoffCount","_xhrOverride","_batchQueues","_autoFlushEventsLimit","_autoFlushBatchLimit","_delayedBatchSendLatency","_delayedBatchReason","_optimizeObject","_timeoutWrapper","requeue","send","sent","drop","rspFail","oth","iKeyMap","timerMultiplier","batchQueue","latency","eventBatch","doFlush","_performAutoFlush","immediateQueue","normalQueue","_loop_1","eventsQueued","droppedEvents","_waitForIdleManager","_flushImpl","maxSendAttempts","_addEventToQueues","notifyFunc","extraArgs","_callNotification","isSyncRequest","coreConfig","extendedCore","wparam","_hookWParam","_maxEventSendAttempts","_maxUnloadEventSendAttempts","disableTelemetry","removePageUnloadEventListener","removePageHideEventListener","removePageShowEventListener","profileValue","directValue","async","_queueBatches","ApplicationInsights","_postChannel","_propertyManager","postFound","LoggingSeverity","CRITICAL","WARNING","_InternalMessageId","ValueKind","NotSet","Pii_DistinguishedName","Pii_GenericData","Pii_IPV4Address","Pii_IPv6Address","Pii_MailSubject","Pii_PhoneNumber","Pii_QueryString","Pii_SipAddress","Pii_SmtpAddress","Pii_Identity","Pii_Uri","Pii_Fqdn","Pii_IPV4AddressLegacy","CustomerContent_GenericContent","EventLatency","Normal","CostDeferred","RealTime","Immediate","EventPersistence","Unspecified","Int32","UInt32","Int64","UInt64","Double","Bool","Guid","DateTime","Critical","TraceLevel","NONE","ERROR","INFORMATION","MinChannelPriorty","AuthHandShakeError","AuthRedirectFail","BrowserCannotReadLocalStorage","BrowserCannotWriteLocalStorage","BrowserDoesNotSupportLocalStorage","CannotParseBiBlobValue","CannotParseDataAttribute","CVPluginNotAvailable","DroppedEvent","ErrorParsingAISessionCookie","ErrorProvidedChannels","FailedToGetCookies","FailedToInitializeCorrelationVector","FailedToInitializeSDK","InvalidContentBlob","InvalidCorrelationValue","SessionRenewalDateIsZero","SendPostOnCompleteFailure","PostResponseHandler","SDKNotInitialized"],"sourceRoot":""}