{"version":3,"file":"ai.2.5.9.min.js","sources":["../../tools/shims/dist-esm/applicationinsights-shims.js","../../shared/AppInsightsCommon/dist-esm/Enums.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/EnvUtils.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/CoreUtils.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js","../../common/temp/node_modules/@microsoft/dynamicproto-js/lib/dist/esm/dynamicproto-js.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/DiagnosticLogger.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/PerfManager.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/TelemetryPluginChain.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/TelemetryHelpers.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/ChannelController.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/BaseCore.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/AppInsightsCore.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/NotificationManager.js","../../shared/AppInsightsCore/dist-esm/JavaScriptSDK/InstrumentHooks.js","../../shared/AppInsightsCommon/dist-esm/RequestResponseHeaders.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/Common/DataSanitizer.js","../../shared/AppInsightsCommon/dist-esm/Util.js","../../shared/AppInsightsCommon/dist-esm/Constants.js","../../shared/AppInsightsCommon/dist-esm/ConnectionStringParser.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/Base.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/Data.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/Envelope.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/Common/Envelope.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/Domain.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/EventData.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/Event.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/StackFrame.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/Exception.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/MetricData.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/DataPointType.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/DataPoint.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/Common/DataPoint.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/Metric.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/PageViewData.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/PageView.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/RemoteDependencyData.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/MessageData.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/Trace.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/PageViewPerformance.js","../../shared/AppInsightsCommon/dist-esm/Telemetry/Common/Data.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/SeverityLevel.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/IConfig.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/Contracts/Generated/ContextTagKeys.js","../../shared/AppInsightsCommon/dist-esm/TelemetryItemCreator.js","../../shared/AppInsightsCommon/dist-esm/Interfaces/PartAExtensions.js","../../shared/AppInsightsCommon/dist-esm/applicationinsights-common.js","../dist-esm/ApplicationInsightsDeprecated.js","../../extensions/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js","../../extensions/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js","../../extensions/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js","../../extensions/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/ApplicationInsights.js","../../channels/applicationinsights-channel-js/dist-esm/SendBuffer.js","../../channels/applicationinsights-channel-js/dist-esm/EnvelopeCreator.js","../../channels/applicationinsights-channel-js/dist-esm/Serializer.js","../../channels/applicationinsights-channel-js/dist-esm/Offline.js","../../channels/applicationinsights-channel-js/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js","../../channels/applicationinsights-channel-js/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js","../../channels/applicationinsights-channel-js/dist-esm/TelemetryProcessors/Sample.js","../../channels/applicationinsights-channel-js/dist-esm/Sender.js","../../extensions/applicationinsights-properties-js/dist-esm/Context/Session.js","../../extensions/applicationinsights-properties-js/dist-esm/Context/Application.js","../../extensions/applicationinsights-properties-js/dist-esm/Context/Device.js","../../extensions/applicationinsights-properties-js/dist-esm/Context/Internal.js","../../extensions/applicationinsights-properties-js/dist-esm/Context/User.js","../../extensions/applicationinsights-properties-js/dist-esm/Context/Location.js","../../extensions/applicationinsights-properties-js/dist-esm/Context/TelemetryTrace.js","../../extensions/applicationinsights-properties-js/dist-esm/TelemetryContext.js","../../extensions/applicationinsights-properties-js/dist-esm/PropertiesPlugin.js","../../extensions/applicationinsights-dependencies-js/dist-esm/ajaxRecord.js","../../extensions/applicationinsights-dependencies-js/dist-esm/TraceParent.js","../../extensions/applicationinsights-dependencies-js/dist-esm/ajax.js","../dist-esm/Initialization.js","../dist-esm/ApplicationInsightsContainer.js","../dist-esm/Init.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport var strShimFunction = \"function\";\r\nexport var strShimObject = \"object\";\r\nexport var strShimUndefined = \"undefined\";\r\nexport var strShimPrototype = \"prototype\";\r\nexport var strShimHasOwnProperty = \"hasOwnProperty\";\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() {\r\n if (typeof globalThis !== strShimUndefined && globalThis) {\r\n return globalThis;\r\n }\r\n if (typeof self !== strShimUndefined && self) {\r\n return self;\r\n }\r\n if (typeof window !== strShimUndefined && window) {\r\n return window;\r\n }\r\n if (typeof global !== strShimUndefined && global) {\r\n return global;\r\n }\r\n return null;\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) {\r\n var func = Object[\"create\"];\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 throw new TypeError('Object prototype may only be an Object:' + obj);\r\n }\r\n function tmpFunc() { }\r\n tmpFunc[strShimPrototype] = obj;\r\n return new tmpFunc();\r\n}\r\nexport function __assignFn(t) {\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 (Object[strShimPrototype][strShimHasOwnProperty].call(s, p)) {\r\n t[p] = s[p];\r\n }\r\n }\r\n }\r\n return t;\r\n}\r\n// tslint:disable-next-line: only-arrow-functions\r\nvar __extendStaticsFn = function (d, b) {\r\n __extendStaticsFn = Object[\"setPrototypeOf\"] ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n function (d, b) {\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\nexport function __extendsFn(d, b) {\r\n __extendStaticsFn(d, b);\r\n function __() { this.constructor = d; }\r\n // tslint:disable-next-line: ban-comma-operator\r\n d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());\r\n}\r\nvar globalObj = getGlobal() || {};\r\n// tslint:disable: only-arrow-functions\r\n(function (root, assignFn, extendsFn) {\r\n // Assign the globally scoped versions of the functions -- used when consuming individual ts files\r\n // If check is to support NativeScript where these are marked as readonly\r\n if (!root.__assign) {\r\n root.__assign = Object.assign || assignFn;\r\n }\r\n if (!root.__extends) {\r\n root.__extends = extendsFn;\r\n }\r\n})(globalObj, __assignFn, __extendsFn);\r\n// Assign local variables that will be used for embedded scenarios, if check is to support NativeScript where these are marked as readonly\r\nif (!__assign) {\r\n __assign = globalObj.__assign;\r\n}\r\nif (!__extends) {\r\n __extends = globalObj.__extends;\r\n}\r\n//# sourceMappingURL=applicationinsights-shims.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * Type of storage to differentiate between local storage and session storage\r\n */\r\nexport var StorageType;\r\n(function (StorageType) {\r\n StorageType[StorageType[\"LocalStorage\"] = 0] = \"LocalStorage\";\r\n StorageType[StorageType[\"SessionStorage\"] = 1] = \"SessionStorage\";\r\n})(StorageType || (StorageType = {}));\r\n/**\r\n * Enum is used in aiDataContract to describe how fields are serialized.\r\n * For instance: (Fieldtype.Required | FieldType.Array) will mark the field as required and indicate it's an array\r\n */\r\nexport var FieldType;\r\n(function (FieldType) {\r\n FieldType[FieldType[\"Default\"] = 0] = \"Default\";\r\n FieldType[FieldType[\"Required\"] = 1] = \"Required\";\r\n FieldType[FieldType[\"Array\"] = 2] = \"Array\";\r\n FieldType[FieldType[\"Hidden\"] = 4] = \"Hidden\";\r\n})(FieldType || (FieldType = {}));\r\n;\r\nexport var DistributedTracingModes;\r\n(function (DistributedTracingModes) {\r\n /**\r\n * (Default) Send Application Insights correlation headers\r\n */\r\n DistributedTracingModes[DistributedTracingModes[\"AI\"] = 0] = \"AI\";\r\n /**\r\n * Send both W3C Trace Context headers and back-compatibility Application Insights headers\r\n */\r\n DistributedTracingModes[DistributedTracingModes[\"AI_AND_W3C\"] = 1] = \"AI_AND_W3C\";\r\n /**\r\n * Send W3C Trace Context headers\r\n */\r\n DistributedTracingModes[DistributedTracingModes[\"W3C\"] = 2] = \"W3C\";\r\n})(DistributedTracingModes || (DistributedTracingModes = {}));\r\n//# sourceMappingURL=Enums.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\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 = {\r\n /**\r\n * Unknown.\r\n */\r\n Unknown: 0,\r\n /**\r\n * Status set to non-retryable.\r\n */\r\n NonRetryableStatus: 1,\r\n /**\r\n * The event is invalid.\r\n */\r\n InvalidEvent: 2,\r\n /**\r\n * The size of the event is too large.\r\n */\r\n SizeLimitExceeded: 3,\r\n /**\r\n * The server is not accepting events from this instrumentation key.\r\n */\r\n KillSwitch: 4,\r\n /**\r\n * The event queue is full.\r\n */\r\n QueueFull: 5\r\n};\r\n//# sourceMappingURL=EventsDiscardedReason.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { getGlobal as shimsGetGlobal, strShimUndefined, strShimObject, strShimPrototype, strShimFunction } from \"@microsoft/applicationinsights-shims\";\r\n/**\r\n * This file exists to hold environment utilities that are requied to check and\r\n * validate the current operating environment. Unless otherwise required, please\r\n * only 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\nexport var strUndefined = strShimUndefined;\r\nexport var strObject = strShimObject;\r\nexport var strPrototype = strShimPrototype;\r\nexport var strFunction = strShimFunction;\r\nvar strWindow = \"window\";\r\nvar strDocument = \"document\";\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\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 var getGlobal = shimsGetGlobal;\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 === strObject && 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 === strObject && 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 === strObject && 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 === strObject && 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() {\r\n if (typeof location === strObject && 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 !== strUndefined) {\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 === strObject && 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//# sourceMappingURL=EnvUtils.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { objCreateFn, strShimObject, strShimUndefined, strShimFunction, strShimPrototype } from \"@microsoft/applicationinsights-shims\";\r\nimport { getWindow, getDocument, getCrypto, getPerformance, getMsCrypto, getNavigator } from './EnvUtils';\r\n// Added to help with minfication\r\nexport var Undefined = strShimUndefined;\r\nvar strOnPrefix = \"on\";\r\nvar strAttachEvent = \"attachEvent\";\r\nvar strAddEventHelper = \"addEventListener\";\r\nvar strDetachEvent = \"detachEvent\";\r\nvar strRemoveEventListener = \"removeEventListener\";\r\nvar UInt32Mask = 0x100000000;\r\nvar MaxUInt32 = 0xffffffff;\r\nvar _isTrident = null;\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 _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 _mwcSeed((Math.random() * UInt32Mask) ^ new Date().getTime());\r\n}\r\nfunction _isTypeof(value, theType) {\r\n return typeof value === theType;\r\n}\r\n;\r\nfunction _isUndefined(value) {\r\n return _isTypeof(value, strShimUndefined) || value === undefined;\r\n}\r\n;\r\nfunction _isNullOrUndefined(value) {\r\n return (_isUndefined(value) || value === null);\r\n}\r\nfunction _hasOwnProperty(obj, prop) {\r\n return obj && Object[strShimPrototype].hasOwnProperty.call(obj, prop);\r\n}\r\n;\r\nfunction _isObject(value) {\r\n return _isTypeof(value, strShimObject);\r\n}\r\n;\r\nfunction _isFunction(value) {\r\n return _isTypeof(value, strShimFunction);\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\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\nfunction _attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n var result = false;\r\n if (!_isNullOrUndefined(obj)) {\r\n try {\r\n if (!_isNullOrUndefined(obj[strAddEventHelper])) {\r\n // all browsers except IE before version 9\r\n obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);\r\n result = true;\r\n }\r\n else if (!_isNullOrUndefined(obj[strAttachEvent])) {\r\n // IE before version 9 \r\n obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);\r\n result = true;\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 eventNameWithoutOn {string} - The name of the event\r\n * @param handlerRef {any} - The callback function that needs to be executed for the given event\r\n * @param useCapture [Optional] Defaults to false\r\n */\r\nfunction _detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n if (!_isNullOrUndefined(obj)) {\r\n try {\r\n if (!_isNullOrUndefined(obj[strRemoveEventListener])) {\r\n obj[strRemoveEventListener](eventNameWithoutOn, handlerRef, useCapture);\r\n }\r\n else if (!_isNullOrUndefined(obj[strDetachEvent])) {\r\n obj[strDetachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);\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 * 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 var match = /([^\\w\\d_$])/g;\r\n if (match.test(name)) {\r\n value = name.replace(match, \"_\");\r\n }\r\n return value;\r\n}\r\nvar CoreUtils = /** @class */ (function () {\r\n function CoreUtils() {\r\n }\r\n /**\r\n * Check if an object is of type Date\r\n */\r\n CoreUtils.isDate = function (obj) {\r\n return Object[strShimPrototype].toString.call(obj) === \"[object Date]\";\r\n };\r\n /**\r\n * Check if an object is of type Array\r\n */\r\n CoreUtils.isArray = function (obj) {\r\n return Object[strShimPrototype].toString.call(obj) === \"[object Array]\";\r\n };\r\n /**\r\n * Check if an object is of type Error\r\n */\r\n CoreUtils.isError = function (obj) {\r\n return Object[strShimPrototype].toString.call(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\n CoreUtils.isString = function (value) {\r\n return _isTypeof(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\n CoreUtils.isNumber = function (value) {\r\n return _isTypeof(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\n CoreUtils.isBoolean = function (value) {\r\n return _isTypeof(value, \"boolean\");\r\n };\r\n /**\r\n * Creates a new GUID.\r\n * @return {string} A GUID.\r\n */\r\n CoreUtils.disableCookies = function () {\r\n CoreUtils._canUseCookies = false;\r\n };\r\n CoreUtils.newGuid = function () {\r\n function randomHexDigit() {\r\n return CoreUtils.randomValue(15); // Get a random value from 0..15\r\n }\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(GuidRegex, function (c) {\r\n var r = (randomHexDigit() | 0), v = (c === 'x' ? r : r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n };\r\n /**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\n CoreUtils.toISOString = function (date) {\r\n if (CoreUtils.isDate(date)) {\r\n var pad = function (num) {\r\n var r = String(num);\r\n if (r.length === 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.\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\n CoreUtils.arrForEach = function (arr, callbackfn, thisArg) {\r\n var len = arr.length;\r\n for (var idx = 0; idx < len; idx++) {\r\n if (idx in arr) {\r\n callbackfn.call(thisArg || arr, arr[idx], idx, arr);\r\n }\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\n CoreUtils.arrIndexOf = function (arr, searchElement, fromIndex) {\r\n var len = arr.length;\r\n var from = fromIndex || 0;\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 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\n CoreUtils.arrMap = function (arr, callbackfn, thisArg) {\r\n var len = arr.length;\r\n var _this = thisArg || arr;\r\n var results = new Array(len);\r\n for (var lp = 0; lp < len; lp++) {\r\n if (lp in arr) {\r\n results[lp] = callbackfn.call(_this, arr[lp], arr);\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\n CoreUtils.arrReduce = function (arr, callbackfn, initialValue) {\r\n var len = arr.length;\r\n var lp = 0;\r\n var value;\r\n // Specifically checking the number of passed arguments as the value could be anything\r\n if (arguments.length >= 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 return value;\r\n };\r\n /**\r\n * helper method to trim strings (IE8 does not implement String.prototype.trim)\r\n */\r\n CoreUtils.strTrim = function (str) {\r\n if (!CoreUtils.isString(str)) {\r\n return str;\r\n }\r\n return str.replace(/^\\s+|\\s+$/g, \"\");\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\n CoreUtils.objKeys = function (obj) {\r\n var hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString');\r\n if (!_isFunction(obj) && (!_isObject(obj) || obj === null)) {\r\n throw new TypeError('objKeys called on non-object');\r\n }\r\n var result = [];\r\n for (var prop in obj) {\r\n if (_hasOwnProperty(obj, prop)) {\r\n result.push(prop);\r\n }\r\n }\r\n if (hasDontEnumBug) {\r\n var dontEnums = [\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 var dontEnumsLength = dontEnums.length;\r\n for (var lp = 0; lp < dontEnumsLength; lp++) {\r\n if (_hasOwnProperty(obj, dontEnums[lp])) {\r\n result.push(dontEnums[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\n CoreUtils.objDefineAccessors = function (target, prop, getProp, setProp) {\r\n var defineProp = Object[\"defineProperty\"];\r\n if (defineProp) {\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 defineProp(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\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 * @return {boolean} - true if the handler was successfully added\r\n */\r\n CoreUtils.addEventHandler = function (eventName, callback) {\r\n var result = false;\r\n var w = getWindow();\r\n if (w) {\r\n result = _attachEvent(w, eventName, callback);\r\n result = _attachEvent(w[\"body\"], eventName, callback) || result;\r\n }\r\n var doc = getDocument();\r\n if (doc) {\r\n result = EventHelper.Attach(doc, eventName, callback) || result;\r\n }\r\n return result;\r\n };\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\n CoreUtils.dateNow = function () {\r\n var dt = Date;\r\n if (dt.now) {\r\n return dt.now();\r\n }\r\n return new dt().getTime();\r\n };\r\n /**\r\n * Return the current value of the Performance Api now() function (if available) and fallback to CoreUtils.dateNow() if it is unavailable (IE9 or less)\r\n * https://caniuse.com/#search=performance.now\r\n */\r\n CoreUtils.perfNow = function () {\r\n var perf = getPerformance();\r\n if (perf && perf.now) {\r\n return perf.now();\r\n }\r\n return CoreUtils.dateNow();\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\n CoreUtils.newId = function (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 = CoreUtils.random32() >>> 0; // Make sure it's a +ve number\r\n var chars = 0;\r\n var result = \"\";\r\n while (result.length < 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 = (((CoreUtils.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 /**\r\n * Identifies whether the current environment appears to be IE\r\n */\r\n CoreUtils.isIE = function () {\r\n if (_isTrident === null) {\r\n var navigator_1 = getNavigator() || {};\r\n var userAgent = (navigator_1.userAgent || \"\").toLowerCase();\r\n _isTrident = (userAgent.indexOf(\"msie\") !== -1 || userAgent.indexOf(\"trident/\") !== -1);\r\n }\r\n return _isTrident;\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\n CoreUtils.randomValue = function (maxValue) {\r\n if (maxValue > 0) {\r\n return Math.floor((CoreUtils.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\n CoreUtils.random32 = function (signed) {\r\n var value;\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 else if (CoreUtils.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 = CoreUtils.mwcRandom32() & MaxUInt32;\r\n }\r\n else {\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\n CoreUtils.mwcRandomSeed = function (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\n CoreUtils.mwcRandom32 = function (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 W3C trace id\r\n */\r\n CoreUtils.generateW3CId = function () {\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 = \"\", tmp;\r\n for (var a = 0; a < 4; a++) {\r\n tmp = CoreUtils.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 + (CoreUtils.random32() & 0x03) | 0];\r\n return oct.substr(0, 8) + oct.substr(9, 4) + \"4\" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);\r\n };\r\n CoreUtils.isTypeof = _isTypeof;\r\n CoreUtils.isUndefined = _isUndefined;\r\n CoreUtils.isNullOrUndefined = _isNullOrUndefined;\r\n CoreUtils.hasOwnProperty = _hasOwnProperty;\r\n /**\r\n * Checks if the passed of value is a function.\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\n CoreUtils.isFunction = _isFunction;\r\n /**\r\n * Checks if the passed of value is a function.\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\n CoreUtils.isObject = _isObject;\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\n // tslint:disable-next-line: member-ordering\r\n CoreUtils.objCreate = objCreateFn;\r\n return CoreUtils;\r\n}());\r\nexport { CoreUtils };\r\nvar GuidRegex = /[xy]/g;\r\nvar EventHelper = /** @class */ (function () {\r\n function EventHelper() {\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\r\n * @param handlerRef Pointer that specifies the function to call when event fires\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\n EventHelper.Attach = _attachEvent;\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 * @deprecated Use {@link EventHelper#Attach} as we are already in a class call EventHelper the extra \"Event\" just causes a larger result\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\r\n * @param handlerRef Pointer that specifies the function to call when event fires\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\n EventHelper.AttachEvent = _attachEvent;\r\n /**\r\n * Removes an event handler for the specified event\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 * @return {boolean} - true if the handler was successfully added\r\n */\r\n EventHelper.Detach = _detachEvent;\r\n /**\r\n * Removes an event handler for the specified event\r\n * @deprecated Use {@link EventHelper#Detach} as we are already in a class call EventHelper the extra \"Event\" just causes a larger result\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 * @return {boolean} - true if the handler was successfully added\r\n */\r\n EventHelper.DetachEvent = _detachEvent;\r\n return EventHelper;\r\n}());\r\nexport { EventHelper };\r\n//# sourceMappingURL=CoreUtils.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport var LoggingSeverity;\r\n(function (LoggingSeverity) {\r\n /**\r\n * Error will be sent as internal telemetry\r\n */\r\n LoggingSeverity[LoggingSeverity[\"CRITICAL\"] = 1] = \"CRITICAL\";\r\n /**\r\n * Error will NOT be sent as internal telemetry, and will only be shown in browser console\r\n */\r\n LoggingSeverity[LoggingSeverity[\"WARNING\"] = 2] = \"WARNING\";\r\n})(LoggingSeverity || (LoggingSeverity = {}));\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 = {\r\n // Non user actionable\r\n BrowserDoesNotSupportLocalStorage: 0,\r\n BrowserCannotReadLocalStorage: 1,\r\n BrowserCannotReadSessionStorage: 2,\r\n BrowserCannotWriteLocalStorage: 3,\r\n BrowserCannotWriteSessionStorage: 4,\r\n BrowserFailedRemovalFromLocalStorage: 5,\r\n BrowserFailedRemovalFromSessionStorage: 6,\r\n CannotSendEmptyTelemetry: 7,\r\n ClientPerformanceMathError: 8,\r\n ErrorParsingAISessionCookie: 9,\r\n ErrorPVCalc: 10,\r\n ExceptionWhileLoggingError: 11,\r\n FailedAddingTelemetryToBuffer: 12,\r\n FailedMonitorAjaxAbort: 13,\r\n FailedMonitorAjaxDur: 14,\r\n FailedMonitorAjaxOpen: 15,\r\n FailedMonitorAjaxRSC: 16,\r\n FailedMonitorAjaxSend: 17,\r\n FailedMonitorAjaxGetCorrelationHeader: 18,\r\n FailedToAddHandlerForOnBeforeUnload: 19,\r\n FailedToSendQueuedTelemetry: 20,\r\n FailedToReportDataLoss: 21,\r\n FlushFailed: 22,\r\n MessageLimitPerPVExceeded: 23,\r\n MissingRequiredFieldSpecification: 24,\r\n NavigationTimingNotSupported: 25,\r\n OnError: 26,\r\n SessionRenewalDateIsZero: 27,\r\n SenderNotInitialized: 28,\r\n StartTrackEventFailed: 29,\r\n StopTrackEventFailed: 30,\r\n StartTrackFailed: 31,\r\n StopTrackFailed: 32,\r\n TelemetrySampledAndNotSent: 33,\r\n TrackEventFailed: 34,\r\n TrackExceptionFailed: 35,\r\n TrackMetricFailed: 36,\r\n TrackPVFailed: 37,\r\n TrackPVFailedCalc: 38,\r\n TrackTraceFailed: 39,\r\n TransmissionFailed: 40,\r\n FailedToSetStorageBuffer: 41,\r\n FailedToRestoreStorageBuffer: 42,\r\n InvalidBackendResponse: 43,\r\n FailedToFixDepricatedValues: 44,\r\n InvalidDurationValue: 45,\r\n TelemetryEnvelopeInvalid: 46,\r\n CreateEnvelopeError: 47,\r\n // User actionable\r\n CannotSerializeObject: 48,\r\n CannotSerializeObjectNonSerializable: 49,\r\n CircularReferenceDetected: 50,\r\n ClearAuthContextFailed: 51,\r\n ExceptionTruncated: 52,\r\n IllegalCharsInName: 53,\r\n ItemNotInArray: 54,\r\n MaxAjaxPerPVExceeded: 55,\r\n MessageTruncated: 56,\r\n NameTooLong: 57,\r\n SampleRateOutOfRange: 58,\r\n SetAuthContextFailed: 59,\r\n SetAuthContextFailedAccountName: 60,\r\n StringValueTooLong: 61,\r\n StartCalledMoreThanOnce: 62,\r\n StopCalledWithoutStart: 63,\r\n TelemetryInitializerFailed: 64,\r\n TrackArgumentsNotSpecified: 65,\r\n UrlTooLong: 66,\r\n SessionStorageBufferFull: 67,\r\n CannotAccessCookie: 68,\r\n IdTooLong: 69,\r\n InvalidEvent: 70,\r\n FailedMonitorAjaxSetRequestHeader: 71,\r\n SendBrowserInfoOnUserInit: 72,\r\n PluginException: 73,\r\n NotificationException: 74,\r\n SnippetScriptLoadFailure: 99,\r\n InvalidInstrumentationKey: 100\r\n};\r\n//# sourceMappingURL=LoggingEnums.js.map","/*!\n * Microsoft Dynamic Proto Utility, 1.0.0\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\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 * 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 * 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 * Internal Global used to generate a unique dynamic class name, every new class will increase this value\r\n * @ignore\r\n */\r\nvar _dynamicNames = 0;\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 && Object[Prototype].hasOwnProperty.call(obj, prop);\r\n}\r\n/**\r\n * Checks if the passed of value is a function.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a boolean, false otherwise.\r\n * @ignore\r\n */\r\nfunction _isFunction(value) {\r\n return typeof value === strFunction;\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 === Object[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 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[Prototype] || target[Constructor];\r\n if (newProto) {\r\n return newProto;\r\n }\r\n }\r\n return null;\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 prototpe 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 && _isFunction(target[funcName]) && (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 for (var name in thisTarget) {\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 pasing 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) {\r\n function _instFuncProxy(target, theFunc) {\r\n return function () {\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 for (var name in instFuncs) {\r\n // Create an instance callback for pasing 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 for (var name in baseProto) {\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 pasing 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\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 * @ignore\r\n */\r\nfunction _populatePrototype(proto, className, target, baseInstFuncs) {\r\n function _createDynamicPrototype(proto, funcName) {\r\n var dynProtoProxy = function () {\r\n var _this = this;\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 (_this && _hasOwnProperty(proto, DynClassName)) {\r\n var instFunc = ((_this[DynInstFuncTable] || {})[proto[DynClassName]] || {})[funcName];\r\n if (instFunc) {\r\n // Used the instance function property\r\n return instFunc.apply(_this, arguments);\r\n }\r\n // Avoid stack overflow from recursive calling the same function\r\n _throwTypeError(\"Missing [\" + funcName + \"] \" + strFunction);\r\n }\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 === dynProtoProxy) {\r\n // It is so lookup the base prototype\r\n protoFunc = _getObjProto(proto)[funcName];\r\n }\r\n if (!_isFunction(protoFunc)) {\r\n _throwTypeError(\"[\" + funcName + \"] is not a \" + strFunction);\r\n }\r\n return protoFunc.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 = instFuncTable[className] = (instFuncTable[className] || {}); // fetch and assign if as it may not exist yet\r\n for (var name in target) {\r\n // Only add overriden 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[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 heirarchy of the instance\r\n * @param classProto The class prototype instance\r\n * @param thisTarget The current instance that will be checked whther the passed prototype instance is in the heirarchy\r\n * @ignore\r\n */\r\nfunction _checkPrototype(classProto, thisTarget) {\r\n var thisProto = _getObjProto(thisTarget);\r\n while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto)) {\r\n if (thisProto === classProto) {\r\n return true;\r\n }\r\n thisProto = _getObjProto(thisProto);\r\n }\r\n return false;\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 */\r\nfunction dynamicProto(theClass, target, delegateFunc) {\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) + \"] is not in class heirarchy 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, \"_\") + \"$\" + _dynamicNames;\r\n _dynamicNames++;\r\n classProto[DynClassName] = className;\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 overriden)\r\n var baseFuncs = _getBaseFuncs(classProto, target, instFuncs);\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 // Populate the Prototype for any overidden instance functions\r\n _populatePrototype(classProto, className, target, instFuncs);\r\n}\n\nexport default dynamicProto;\n//# sourceMappingURL=dynamicproto-js.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { _InternalMessageId, LoggingSeverity } from \"../JavaScriptSDK.Enums/LoggingEnums\";\r\nimport { CoreUtils } from \"./CoreUtils\";\r\nimport { hasJSON, getJSON, getConsole } from \"./EnvUtils\";\r\nimport dynamicProto from '@microsoft/dynamicproto-js';\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.replace(/\\\"/g, \"\") + \"\\\"\";\r\n }\r\n return \"\";\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.messageId = msgId;\r\n _self.message =\r\n (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +\r\n msgId;\r\n var strProps = \"\";\r\n if (hasJSON()) {\r\n strProps = getJSON().stringify(properties);\r\n }\r\n var diagnosticText = (msg ? \" message:\" + _sanitizeDiagnosticText(msg) : \"\") +\r\n (properties ? \" props:\" + _sanitizeDiagnosticText(strProps) : \"\");\r\n _self.message += diagnosticText;\r\n }\r\n _InternalLogMessage.dataType = \"MessageData\";\r\n return _InternalLogMessage;\r\n}());\r\nexport { _InternalLogMessage };\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 dynamicProto(DiagnosticLogger, this, function (_self) {\r\n var isNullOrUndefined = CoreUtils.isNullOrUndefined;\r\n var isUndefined = CoreUtils.isUndefined;\r\n var isFunction = CoreUtils.isFunction;\r\n if (isNullOrUndefined(config)) {\r\n config = {};\r\n }\r\n _self.consoleLoggingLevel = function () { return _getConfigValue('loggingLevelConsole', 0); };\r\n _self.telemetryLoggingLevel = function () { return _getConfigValue('loggingLevelTelemetry', 1); };\r\n _self.maxInternalMessageLimit = function () { return _getConfigValue('maxMessageLimit', 25); };\r\n _self.enableDebugExceptions = function () { return _getConfigValue('enableDebugExceptions', false); };\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 (_self.enableDebugExceptions()) {\r\n throw message;\r\n }\r\n else {\r\n if (!isUndefined(message) && !!message) {\r\n if (!isUndefined(message.message)) {\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.messageId;\r\n if (!_messageLogged[messageKey] && _self.consoleLoggingLevel() >= LoggingSeverity.WARNING) {\r\n _self.warnToConsole(message.message);\r\n _messageLogged[messageKey] = true;\r\n }\r\n }\r\n else {\r\n // don't log internal AI traces in the console, unless the verbose logging is enabled\r\n if (_self.consoleLoggingLevel() >= LoggingSeverity.WARNING) {\r\n _self.warnToConsole(message.message);\r\n }\r\n }\r\n _self.logInternalMessage(severity, message);\r\n }\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.warnToConsole = function (message) {\r\n var theConsole = getConsole();\r\n if (!!theConsole) {\r\n var logFunc = 'log';\r\n if (theConsole.warn) {\r\n logFunc = 'warn';\r\n }\r\n if (isFunction(theConsole[logFunc])) {\r\n theConsole[logFunc](message);\r\n }\r\n }\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.logInternalMessage = function (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.messageId;\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 <= _self.telemetryLoggingLevel()) {\r\n _self.queue.push(message);\r\n _messageCount++;\r\n }\r\n // When throttle limit reached, send a special event\r\n if (_messageCount === _self.maxInternalMessageLimit()) {\r\n var throttleLimitMessage = \"Internal events throttle limit per PageView reached for this app.\";\r\n var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);\r\n _self.queue.push(throttleMessage);\r\n _self.warnToConsole(throttleLimitMessage);\r\n }\r\n }\r\n };\r\n function _getConfigValue(name, defValue) {\r\n var value = config[name];\r\n if (!isNullOrUndefined(value)) {\r\n return value;\r\n }\r\n return defValue;\r\n }\r\n function _areInternalMessagesThrottled() {\r\n return _messageCount >= _self.maxInternalMessageLimit();\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 * 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\n//# sourceMappingURL=DiagnosticLogger.js.map","import dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { CoreUtils } from \"./CoreUtils\";\r\nvar strExecutionContextKey = \"ctx\";\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 = CoreUtils.dateNow();\r\n _self.name = name;\r\n _self.isAsync = isAsync;\r\n _self.isChildEvt = function () { return false; };\r\n if (CoreUtils.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 = CoreUtils.objDefineAccessors(_self, 'payload', function () {\r\n // Delay the execution of the payloadDetails until needed\r\n if (!theDetails_1 && CoreUtils.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.getCtx = 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.ParentContextKey || key === PerfEvent.ChildrenContextKey) {\r\n return _self[key];\r\n }\r\n return (_self[strExecutionContextKey] || {})[key];\r\n }\r\n return null;\r\n };\r\n _self.setCtx = 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.ParentContextKey) {\r\n // Simple assumption, if we are setting a parent then we must be a child\r\n if (!_self[key]) {\r\n _self.isChildEvt = function () { return true; };\r\n }\r\n _self[key] = value;\r\n }\r\n else if (key === PerfEvent.ChildrenContextKey) {\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.complete = function () {\r\n var childTime = 0;\r\n var childEvts = _self.getCtx(PerfEvent.ChildrenContextKey);\r\n if (CoreUtils.isArray(childEvts)) {\r\n for (var lp = 0; lp < childEvts.length; lp++) {\r\n var childEvt = childEvts[lp];\r\n if (childEvt) {\r\n childTime += childEvt.time;\r\n }\r\n }\r\n }\r\n _self.time = CoreUtils.dateNow() - _self.start;\r\n _self.exTime = _self.time - childTime;\r\n _self.complete = function () { };\r\n if (!accessorDefined && CoreUtils.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.complete();\r\n if (manager) {\r\n manager.perfEvent(perfEvent);\r\n }\r\n }\r\n };\r\n _self.setCtx = 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.getCtx = 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 && CoreUtils.isFunction(perfMgr[\"getPerfMgr\"])) {\r\n // Looks like a perf manager provider object\r\n perfMgr = perfMgr[\"getPerfMgr\"]();\r\n }\r\n if (perfMgr) {\r\n var perfEvt = void 0;\r\n var currentActive = perfMgr.getCtx(doPerfActiveKey);\r\n try {\r\n perfEvt = perfMgr.create(getSource(), details, isAsync);\r\n if (perfEvt) {\r\n if (currentActive && perfEvt.setCtx) {\r\n perfEvt.setCtx(PerfEvent.ParentContextKey, currentActive);\r\n if (currentActive.getCtx && currentActive.setCtx) {\r\n var children = currentActive.getCtx(PerfEvent.ChildrenContextKey);\r\n if (!children) {\r\n children = [];\r\n currentActive.setCtx(PerfEvent.ChildrenContextKey, children);\r\n }\r\n children.push(perfEvt);\r\n }\r\n }\r\n // Set this event as the active event now\r\n perfMgr.setCtx(doPerfActiveKey, perfEvt);\r\n return func(perfEvt);\r\n }\r\n }\r\n catch (ex) {\r\n if (perfEvt && perfEvt.setCtx) {\r\n perfEvt.setCtx(\"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.setCtx(doPerfActiveKey, currentActive);\r\n }\r\n }\r\n }\r\n return func();\r\n}\r\n//# sourceMappingURL=PerfManager.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { CoreUtils } from \"./CoreUtils\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { LoggingSeverity, _InternalMessageId } from '../JavaScriptSDK.Enums/LoggingEnums';\r\nvar _isFunction = CoreUtils.isFunction;\r\nvar TelemetryPluginChain = /** @class */ (function () {\r\n function TelemetryPluginChain(plugin, defItemCtx) {\r\n var _self = this;\r\n var _nextProxy = null;\r\n var _hasProcessTelemetry = _isFunction(plugin.processTelemetry);\r\n var _hasSetNext = _isFunction(plugin.setNextPlugin);\r\n _self._hasRun = false;\r\n _self.getPlugin = function () {\r\n return plugin;\r\n };\r\n _self.getNext = function () {\r\n return _nextProxy;\r\n };\r\n _self.setNext = function (nextPlugin) {\r\n _nextProxy = nextPlugin;\r\n };\r\n _self.processTelemetry = function (env, itemCtx) {\r\n if (!itemCtx) {\r\n // Looks like a plugin didn't pass the (optional) context, so restore to the default\r\n itemCtx = defItemCtx;\r\n }\r\n var identifier = plugin ? plugin.identifier : \"TelemetryPluginChain\";\r\n doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + \":processTelemetry\"; }, function () {\r\n if (plugin && _hasProcessTelemetry) {\r\n _self._hasRun = true;\r\n try {\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 itemCtx.setNext(_nextProxy);\r\n if (_hasSetNext) {\r\n // Backward compatibility setting the next plugin on the instance\r\n plugin.setNextPlugin(_nextProxy);\r\n }\r\n // Set a flag on the next plugin so we know if it was attempted to be executed\r\n _nextProxy && (_nextProxy._hasRun = false);\r\n plugin.processTelemetry(env, itemCtx);\r\n }\r\n catch (error) {\r\n var hasRun = _nextProxy && _nextProxy._hasRun;\r\n if (!_nextProxy || !hasRun) {\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 itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, \"Plugin [\" + plugin.identifier + \"] failed during processTelemetry - \" + error);\r\n }\r\n if (_nextProxy && !hasRun) {\r\n // As part of the failure the current plugin did not attempt to call the next plugin in the cahin\r\n // So rather than leave the pipeline dead in the water we call the next plugin\r\n _nextProxy.processTelemetry(env, itemCtx);\r\n }\r\n }\r\n }\r\n else if (_nextProxy) {\r\n _self._hasRun = true;\r\n // The underlying plugin is either not defined or does not have a processTelemetry implementation\r\n // so we still want the next plugin to be executed.\r\n _nextProxy.processTelemetry(env, itemCtx);\r\n }\r\n }, function () { return ({ item: env }); }, !(env.sync));\r\n };\r\n }\r\n return TelemetryPluginChain;\r\n}());\r\nexport { TelemetryPluginChain };\r\n//# sourceMappingURL=TelemetryPluginChain.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { CoreUtils } from \"./CoreUtils\";\r\nimport { DiagnosticLogger } from \"./DiagnosticLogger\";\r\nimport { TelemetryPluginChain } from \"./TelemetryPluginChain\";\r\nvar _isNullOrUndefined = CoreUtils.isNullOrUndefined;\r\n/**\r\n * Creates the instance execution chain for the plugins\r\n */\r\nfunction _createProxyChain(plugins, itemCtx) {\r\n var proxies = [];\r\n if (plugins && plugins.length > 0) {\r\n // Create the proxies and wire up the next plugin chain\r\n var lastProxy = null;\r\n for (var idx = 0; idx < plugins.length; idx++) {\r\n var thePlugin = plugins[idx];\r\n if (thePlugin && CoreUtils.isFunction(thePlugin.processTelemetry)) {\r\n // Only add plugins that are processors\r\n var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);\r\n proxies.push(newProxy);\r\n if (lastProxy) {\r\n // Set this new proxy as the next for the previous one\r\n lastProxy.setNext(newProxy);\r\n }\r\n lastProxy = newProxy;\r\n }\r\n }\r\n }\r\n return proxies.length > 0 ? proxies[0] : null;\r\n}\r\nfunction _copyProxyChain(proxy, itemCtx, startAt) {\r\n var plugins = [];\r\n var add = startAt ? false : true;\r\n if (proxy) {\r\n while (proxy) {\r\n var thePlugin = proxy.getPlugin();\r\n if (add || thePlugin === startAt) {\r\n add = true;\r\n plugins.push(thePlugin);\r\n }\r\n proxy = proxy.getNext();\r\n }\r\n }\r\n if (!add) {\r\n plugins.push(startAt);\r\n }\r\n return _createProxyChain(plugins, itemCtx);\r\n}\r\nfunction _copyPluginChain(srcPlugins, itemCtx, startAt) {\r\n var plugins = srcPlugins;\r\n var add = false;\r\n if (startAt && srcPlugins) {\r\n plugins = [];\r\n CoreUtils.arrForEach(srcPlugins, function (thePlugin) {\r\n if (add || thePlugin === startAt) {\r\n add = true;\r\n plugins.push(thePlugin);\r\n }\r\n });\r\n }\r\n if (startAt && !add) {\r\n if (!plugins) {\r\n plugins = [];\r\n }\r\n plugins.push(startAt);\r\n }\r\n return _createProxyChain(plugins, itemCtx);\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(plugins, config, core, startAt) {\r\n var _self = this;\r\n var _nextProxy = null; // Null == No next plugin\r\n // There is no next element (null) vs not defined (undefined)\r\n if (startAt !== null) {\r\n if (plugins && CoreUtils.isFunction(plugins.getPlugin)) {\r\n // We have a proxy chain object\r\n _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());\r\n }\r\n else {\r\n // We just have an array\r\n if (startAt) {\r\n _nextProxy = _copyPluginChain(plugins, _self, startAt);\r\n }\r\n else if (CoreUtils.isUndefined(startAt)) {\r\n // Undefined means copy the existing chain\r\n _nextProxy = _createProxyChain(plugins, _self);\r\n }\r\n }\r\n }\r\n _self.core = function () {\r\n return core;\r\n };\r\n _self.diagLog = function () {\r\n var logger = (core || {}).logger;\r\n if (!logger) {\r\n // Fallback so we always have a logger\r\n logger = new DiagnosticLogger(config || {});\r\n }\r\n return logger;\r\n };\r\n _self.getCfg = function () {\r\n return config;\r\n };\r\n _self.getExtCfg = function (identifier, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = {}; }\r\n var theConfig;\r\n if (config) {\r\n var extConfig = config.extensionConfig;\r\n if (extConfig && identifier) {\r\n theConfig = extConfig[identifier];\r\n }\r\n }\r\n return (theConfig ? theConfig : defaultValue);\r\n };\r\n _self.getConfig = function (identifier, field, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n var theValue;\r\n var extConfig = _self.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 _self.hasNext = function () {\r\n return _nextProxy != null;\r\n };\r\n _self.getNext = function () {\r\n return _nextProxy;\r\n };\r\n _self.setNext = function (nextPlugin) {\r\n _nextProxy = nextPlugin;\r\n };\r\n _self.processNext = function (env) {\r\n var nextPlugin = _nextProxy;\r\n if (nextPlugin) {\r\n // Automatically move to the next plugin\r\n _nextProxy = nextPlugin.getNext();\r\n nextPlugin.processTelemetry(env, _self);\r\n }\r\n };\r\n _self.createNew = function (plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);\r\n };\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\n\"use strict\";\r\nimport { CoreUtils } from \"./CoreUtils\";\r\nimport { ProcessTelemetryContext } from './ProcessTelemetryContext';\r\nvar _isFunction = CoreUtils.isFunction;\r\nvar getPlugin = \"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;\r\n var _isinitialized = false;\r\n var _rootCtx = null; // Used as the root context, holding the current config and initialized core\r\n var _nextPlugin = null; // Used for backward compatibility where plugins don't call the main pipeline\r\n _self.core = null;\r\n _self.diagLog = function (itemCtx) {\r\n return _self._getTelCtx(itemCtx).diagLog();\r\n };\r\n _self.isInitialized = 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.setNextPlugin = function (next) {\r\n _nextPlugin = next;\r\n };\r\n _self.processNext = function (env, itemCtx) {\r\n if (itemCtx) {\r\n // Normal core execution sequence\r\n itemCtx.processNext(env);\r\n }\r\n else if (_nextPlugin && _isFunction(_nextPlugin.processTelemetry)) {\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.processTelemetry(env, null);\r\n }\r\n };\r\n _self._getTelCtx = function (currentCtx) {\r\n if (currentCtx === void 0) { currentCtx = null; }\r\n var itemCtx = currentCtx;\r\n if (!itemCtx) {\r\n var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);\r\n // tslint:disable-next-line: prefer-conditional-expression\r\n if (_nextPlugin && _nextPlugin[getPlugin]) {\r\n // Looks like a chain object\r\n itemCtx = rootCtx.createNew(null, _nextPlugin[getPlugin]);\r\n }\r\n else {\r\n itemCtx = rootCtx.createNew(null, _nextPlugin);\r\n }\r\n }\r\n return itemCtx;\r\n };\r\n _self._baseTelInit = function (config, core, extensions, pluginChain) {\r\n if (config) {\r\n // Make sure the extensionConfig exists\r\n config.extensionConfig = config.extensionConfig || [];\r\n }\r\n if (!pluginChain && core) {\r\n // Get the first plugin from the core\r\n pluginChain = core.getProcessTelContext().getNext();\r\n }\r\n var nextPlugin = _nextPlugin;\r\n if (_nextPlugin && _nextPlugin[getPlugin]) {\r\n // If it looks like a proxy/chain then get the plugin\r\n nextPlugin = _nextPlugin[getPlugin]();\r\n }\r\n // Support legacy plugins where core was defined as a property\r\n _self.core = core;\r\n _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);\r\n _isinitialized = true;\r\n };\r\n }\r\n BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n this._baseTelInit(config, core, extensions, pluginChain);\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\n\"use strict\";\r\nimport { CoreUtils } from \"./CoreUtils\";\r\nvar _isFunction = CoreUtils.isFunction;\r\nvar processTelemetry = \"processTelemetry\";\r\nvar priority = \"priority\";\r\nvar setNextPlugin = \"setNextPlugin\";\r\nvar isInitialized = \"isInitialized\";\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.getNext();\r\n while (proxy) {\r\n var thePlugin = proxy.getPlugin();\r\n if (thePlugin) {\r\n if (lastPlugin &&\r\n _isFunction(lastPlugin[setNextPlugin]) &&\r\n _isFunction(thePlugin[processTelemetry])) {\r\n // Set this plugin as the next for the previous one\r\n lastPlugin[setNextPlugin](thePlugin);\r\n }\r\n if (!_isFunction(thePlugin[isInitialized]) || !thePlugin[isInitialized]()) {\r\n initPlugins.push(thePlugin);\r\n }\r\n lastPlugin = thePlugin;\r\n proxy = proxy.getNext();\r\n }\r\n }\r\n // Now initiatilize the plugins\r\n CoreUtils.arrForEach(initPlugins, function (thePlugin) {\r\n thePlugin.initialize(processContext.getCfg(), processContext.core(), extensions, processContext.getNext());\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 var bHasProcess = _isFunction(extB[processTelemetry]);\r\n if (_isFunction(extA[processTelemetry])) {\r\n result = bHasProcess ? extA[priority] - extB[priority] : 1;\r\n }\r\n else if (bHasProcess) {\r\n result = -1;\r\n }\r\n return result;\r\n });\r\n // sort complete \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 { CoreUtils } from \"./CoreUtils\";\r\nimport { BaseTelemetryPlugin } from './BaseTelemetryPlugin';\r\nimport { ProcessTelemetryContext } from './ProcessTelemetryContext';\r\nimport { initializePlugins } from './TelemetryHelpers';\r\nimport dynamicProto from '@microsoft/dynamicproto-js';\r\nvar ChannelControllerPriority = 500;\r\nvar ChannelValidationMessage = \"Channel has invalid priority\";\r\nvar _objDefineAccessors = CoreUtils.objDefineAccessors;\r\nvar ChannelController = /** @class */ (function (_super) {\r\n __extends(ChannelController, _super);\r\n function ChannelController() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"ChannelControllerPlugin\";\r\n _this.priority = ChannelControllerPriority; // in reserved range 100 to 200\r\n var _arrForEach = CoreUtils.arrForEach;\r\n var _channelQueue;\r\n dynamicProto(ChannelController, _this, function (_self, _base) {\r\n _self.setNextPlugin = function (next) {\r\n // The Channel controller is last in pipeline\r\n };\r\n _self.processTelemetry = function (item, itemCtx) {\r\n if (_channelQueue) {\r\n _arrForEach(_channelQueue, function (queues) {\r\n // pass on to first item in queue\r\n if (queues.length > 0) {\r\n // Copying the item context as we could have mutiple chains that are executing asynchronously\r\n // and calling _getDefTelCtx as it's possible that the caller doesn't pass any context\r\n var chainCtx = _this._getTelCtx(itemCtx).createNew(queues);\r\n chainCtx.processNext(item);\r\n }\r\n });\r\n }\r\n };\r\n _self.getChannelControls = function () {\r\n return _channelQueue;\r\n };\r\n _self.initialize = function (config, core, extensions) {\r\n if (_self.isInitialized()) {\r\n // already initialized\r\n return;\r\n }\r\n _base.initialize(config, core, extensions);\r\n if (config.isCookieUseDisabled) {\r\n CoreUtils.disableCookies();\r\n }\r\n _createChannelQueues((config || {}).channels, extensions);\r\n // Initialize the Queues\r\n _arrForEach(_channelQueue, function (queue) { return initializePlugins(new ProcessTelemetryContext(queue, config, core), extensions); });\r\n };\r\n });\r\n function _checkQueuePriority(queue) {\r\n _arrForEach(queue, function (queueItem) {\r\n if (queueItem.priority < ChannelControllerPriority) {\r\n throw Error(ChannelValidationMessage + queueItem.identifier);\r\n }\r\n });\r\n }\r\n function _addChannelQueue(queue) {\r\n if (queue && queue.length > 0) {\r\n queue = queue.sort(function (a, b) {\r\n return a.priority - b.priority;\r\n });\r\n _checkQueuePriority(queue);\r\n _channelQueue.push(queue);\r\n }\r\n }\r\n function _createChannelQueues(channels, extensions) {\r\n _channelQueue = [];\r\n if (channels) {\r\n // Add and sort the configuration channel queues\r\n _arrForEach(channels, function (queue) { return _addChannelQueue(queue); });\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.priority > ChannelControllerPriority) {\r\n extensionQueue_1.push(plugin);\r\n }\r\n });\r\n _addChannelQueue(extensionQueue_1);\r\n }\r\n }\r\n return _this;\r\n }\r\n ChannelController.prototype.processTelemetry = function (item, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ;\r\n ChannelController.prototype.getChannelControls = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n ChannelController.prototype.initialize = function (config, core, extensions) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n // tslint:disable-next-line\r\n ChannelController._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n _objDefineAccessors(ChannelController.prototype, \"ChannelControls\", ChannelController.prototype.getChannelControls);\r\n _objDefineAccessors(ChannelController.prototype, \"channelQueue\", ChannelController.prototype.getChannelControls);\r\n })();\r\n return ChannelController;\r\n}(BaseTelemetryPlugin));\r\nexport { ChannelController };\r\n//# sourceMappingURL=ChannelController.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { CoreUtils } from \"./CoreUtils\";\r\nimport { ChannelController } from './ChannelController';\r\nimport { ProcessTelemetryContext } from './ProcessTelemetryContext';\r\nimport { initializePlugins, sortPlugins } from './TelemetryHelpers';\r\nimport dynamicProto from '@microsoft/dynamicproto-js';\r\nimport { PerfManager } from \"./PerfManager\";\r\nvar validationError = \"Extensions must provide callback to initialize\";\r\nvar _arrForEach = CoreUtils.arrForEach;\r\nvar _isNullOrUndefined = CoreUtils.isNullOrUndefined;\r\nvar strNotificationManager = \"_notificationManager\";\r\nvar BaseCore = /** @class */ (function () {\r\n function BaseCore() {\r\n var _isInitialized = false;\r\n var _eventQueue;\r\n var _channelController;\r\n var _notificationManager;\r\n var _perfManager;\r\n dynamicProto(BaseCore, this, function (_self) {\r\n _self._extensions = new Array();\r\n _channelController = new ChannelController();\r\n _eventQueue = [];\r\n _self.isInitialized = function () { return _isInitialized; };\r\n _self.initialize = function (config, extensions, logger, notificationManager) {\r\n // Make sure core is only initialized once\r\n if (_self.isInitialized()) {\r\n throw Error(\"Core should not be initialized more than once\");\r\n }\r\n if (!config || _isNullOrUndefined(config.instrumentationKey)) {\r\n throw Error(\"Please provide instrumentation key\");\r\n }\r\n _notificationManager = notificationManager;\r\n // For backward compatibility only\r\n _self[strNotificationManager] = notificationManager;\r\n _self.config = config || {};\r\n config.extensions = _isNullOrUndefined(config.extensions) ? [] : config.extensions;\r\n // add notification to the extensions in the config so other plugins can access it\r\n var extConfig = config.extensionConfig = _isNullOrUndefined(config.extensionConfig) ? {} : config.extensionConfig;\r\n extConfig.NotificationManager = notificationManager;\r\n if (!logger) {\r\n logger = CoreUtils.objCreate({\r\n throwInternal: function (severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n },\r\n warnToConsole: function (message) { },\r\n resetInternalMessageCount: function () { }\r\n });\r\n }\r\n _self.logger = logger;\r\n // Concat all available extensions\r\n var allExtensions = [];\r\n allExtensions.push.apply(allExtensions, extensions.concat(config.extensions));\r\n allExtensions = sortPlugins(allExtensions);\r\n var coreExtensions = [];\r\n var channelExtensions = [];\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 if (_isNullOrUndefined(ext) || _isNullOrUndefined(ext.initialize)) {\r\n throw Error(validationError);\r\n }\r\n var extPriority = ext.priority;\r\n var identifier = ext.identifier;\r\n if (ext && extPriority) {\r\n if (!_isNullOrUndefined(extPriorities[extPriority])) {\r\n logger.warnToConsole(\"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 < _channelController.priority) {\r\n // Add to core extension that will be managed by BaseCore\r\n coreExtensions.push(ext);\r\n }\r\n else {\r\n // Add all other extensions to be managed by the channel controller\r\n channelExtensions.push(ext);\r\n }\r\n });\r\n // Validation complete\r\n // Add the channelController to the complete extension collection and\r\n // to the end of the core extensions\r\n allExtensions.push(_channelController);\r\n coreExtensions.push(_channelController);\r\n // Sort the complete set of extensions by priority\r\n allExtensions = sortPlugins(allExtensions);\r\n _self._extensions = allExtensions;\r\n // initialize channel controller first, this will initialize all channel plugins\r\n initializePlugins(new ProcessTelemetryContext([_channelController], config, _self), allExtensions);\r\n initializePlugins(new ProcessTelemetryContext(coreExtensions, config, _self), allExtensions);\r\n // Now reset the extensions to just those being managed by Basecore\r\n _self._extensions = coreExtensions;\r\n if (_self.getTransmissionControls().length === 0) {\r\n throw new Error(\"No channels available\");\r\n }\r\n _isInitialized = true;\r\n _self.releaseQueue();\r\n };\r\n _self.getTransmissionControls = function () {\r\n return _channelController.getChannelControls();\r\n };\r\n _self.track = function (telemetryItem) {\r\n if (!telemetryItem.iKey) {\r\n // setup default iKey if not passed in\r\n telemetryItem.iKey = _self.config.instrumentationKey;\r\n }\r\n if (!telemetryItem.time) {\r\n // add default timestamp if not passed in\r\n telemetryItem.time = CoreUtils.toISOString(new Date());\r\n }\r\n if (_isNullOrUndefined(telemetryItem.ver)) {\r\n // CommonSchema 4.0\r\n telemetryItem.ver = \"4.0\";\r\n }\r\n if (_self.isInitialized()) {\r\n // Process the telemetry plugin chain\r\n _self.getProcessTelContext().processNext(telemetryItem);\r\n }\r\n else {\r\n // Queue events until all extensions are initialized\r\n _eventQueue.push(telemetryItem);\r\n }\r\n };\r\n _self.getProcessTelContext = function () {\r\n var extensions = _self._extensions;\r\n var thePlugins = extensions;\r\n // invoke any common telemetry processors before sending through pipeline\r\n if (!extensions || extensions.length === 0) {\r\n // Pass to Channel controller so data is sent to correct channel queues\r\n thePlugins = [_channelController];\r\n }\r\n return new ProcessTelemetryContext(thePlugins, _self.config, _self);\r\n };\r\n _self.getNotifyMgr = function () {\r\n if (!_notificationManager) {\r\n // Create Dummy notification manager\r\n _notificationManager = CoreUtils.objCreate({\r\n addNotificationListener: function (listener) { },\r\n removeNotificationListener: function (listener) { },\r\n eventsSent: function (events) { },\r\n eventsDiscarded: function (events, reason) { },\r\n eventsSendRequest: function (sendReason, isAsync) { }\r\n });\r\n // For backward compatibility only\r\n _self[strNotificationManager] = _notificationManager;\r\n }\r\n return _notificationManager;\r\n };\r\n _self.getPerfMgr = function () {\r\n if (!_perfManager) {\r\n if (_self.config && _self.config.enablePerfMgr) {\r\n _perfManager = new PerfManager(_self.getNotifyMgr());\r\n }\r\n }\r\n return _perfManager;\r\n };\r\n _self.setPerfMgr = function (perfMgr) {\r\n _perfManager = perfMgr;\r\n };\r\n _self.eventCnt = function () {\r\n return _eventQueue.length;\r\n };\r\n _self.releaseQueue = function () {\r\n if (_eventQueue.length > 0) {\r\n _arrForEach(_eventQueue, function (event) {\r\n _self.getProcessTelContext().processNext(event);\r\n });\r\n _eventQueue = [];\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 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 BaseCore.prototype.releaseQueue = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return BaseCore;\r\n}());\r\nexport { BaseCore };\r\n//# sourceMappingURL=BaseCore.js.map","import { BaseCore } from './BaseCore';\r\nimport { EventsDiscardedReason } from \"../JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { CoreUtils } from \"./CoreUtils\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { _InternalLogMessage, DiagnosticLogger } from \"./DiagnosticLogger\";\r\nimport dynamicProto from '@microsoft/dynamicproto-js';\r\n\"use strict\";\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.initialize = function (config, extensions, logger, notificationManager) {\r\n _base.initialize(config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));\r\n };\r\n _self.track = function (telemetryItem) {\r\n doPerf(_self.getPerfMgr(), function () { return \"AppInsightsCore:track\"; }, function () {\r\n if (telemetryItem === null) {\r\n _notifyInvalidEvent(telemetryItem);\r\n // throw error\r\n throw Error(\"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 /**\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.addNotificationListener = function (listener) {\r\n var manager = _self.getNotifyMgr();\r\n if (manager) {\r\n manager.addNotificationListener(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.removeNotificationListener = function (listener) {\r\n var manager = _self.getNotifyMgr();\r\n if (manager) {\r\n manager.removeNotificationListener(listener);\r\n }\r\n };\r\n /**\r\n * Periodically check logger.queue for\r\n */\r\n _self.pollInternalLogs = function (eventName) {\r\n var interval = _self.config.diagnosticLogInterval;\r\n if (!interval || !(interval > 0)) {\r\n interval = 10000;\r\n }\r\n return setInterval(function () {\r\n var queue = _self.logger ? _self.logger.queue : [];\r\n CoreUtils.arrForEach(queue, function (logMessage) {\r\n var item = {\r\n name: eventName ? eventName : \"InternalMessageId: \" + logMessage.messageId,\r\n iKey: _self.config.instrumentationKey,\r\n time: CoreUtils.toISOString(new Date()),\r\n baseType: _InternalLogMessage.dataType,\r\n baseData: { message: logMessage.message }\r\n };\r\n _self.track(item);\r\n });\r\n queue.length = 0;\r\n }, interval);\r\n };\r\n function _validateTelemetryItem(telemetryItem) {\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.name)) {\r\n _notifyInvalidEvent(telemetryItem);\r\n throw Error(\"telemetry name required\");\r\n }\r\n }\r\n function _notifyInvalidEvent(telemetryItem) {\r\n var manager = _self.getNotifyMgr();\r\n if (manager) {\r\n manager.eventsDiscarded([telemetryItem], EventsDiscardedReason.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 /**\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 AppInsightsCore.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 AppInsightsCore.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 * Periodically check logger.queue for\r\n */\r\n AppInsightsCore.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 return AppInsightsCore;\r\n}(BaseCore));\r\nexport { AppInsightsCore };\r\n//# sourceMappingURL=AppInsightsCore.js.map","import { CoreUtils, } from \"./CoreUtils\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\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 arrForEach = CoreUtils.arrForEach;\r\n var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;\r\n dynamicProto(NotificationManager, this, function (_self) {\r\n _self.addNotificationListener = function (listener) {\r\n _self.listeners.push(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.removeNotificationListener = function (listener) {\r\n var index = CoreUtils.arrIndexOf(_self.listeners, listener);\r\n while (index > -1) {\r\n _self.listeners.splice(index, 1);\r\n index = CoreUtils.arrIndexOf(_self.listeners, 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.eventsSent = function (events) {\r\n arrForEach(_self.listeners, function (listener) {\r\n if (listener && listener.eventsSent) {\r\n setTimeout(function () { return listener.eventsSent(events); }, 0);\r\n }\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.eventsDiscarded = function (events, reason) {\r\n arrForEach(_self.listeners, function (listener) {\r\n if (listener && listener.eventsDiscarded) {\r\n setTimeout(function () { return listener.eventsDiscarded(events, reason); }, 0);\r\n }\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.eventsSendRequest = function (sendReason, isAsync) {\r\n arrForEach(_self.listeners, function (listener) {\r\n if (listener && listener.eventsSendRequest) {\r\n if (isAsync) {\r\n setTimeout(function () { return listener.eventsSendRequest(sendReason, isAsync); }, 0);\r\n }\r\n else {\r\n try {\r\n listener.eventsSendRequest(sendReason, isAsync);\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 _self.perfEvent = function (perfEvent) {\r\n if (perfEvent) {\r\n // Send all events or only parent events\r\n if (perfEvtsSendAll || !perfEvent.isChildEvt()) {\r\n arrForEach(_self.listeners, function (listener) {\r\n if (listener && listener.perfEvent) {\r\n if (perfEvent.isAsync) {\r\n setTimeout(function () { return listener.perfEvent(perfEvent); }, 0);\r\n }\r\n else {\r\n try {\r\n listener.perfEvent(perfEvent);\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 };\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","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { strFunction, strPrototype } from \"./EnvUtils\";\r\nimport { CoreUtils } from './CoreUtils';\r\nvar aiInstrumentHooks = \"_aiHooks\";\r\n;\r\nvar cbNames = [\r\n \"req\", \"rsp\", \"hkErr\", \"fnErr\"\r\n];\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\n/** @ignore */\r\nfunction _arrLoop(arr, fn) {\r\n if (arr) {\r\n for (var lp = 0; lp < arr.length; lp++) {\r\n if (fn(arr[lp], lp)) {\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n/** @ignore */\r\nfunction _doCallbacks(hooks, callDetails, cbArgs, hookCtx, type) {\r\n if (type >= 0 /* Request */ && type <= 2 /* HookError */) {\r\n _arrLoop(hooks, function (hook, idx) {\r\n var cbks = hook.cbks;\r\n var cb = cbks[cbNames[type]];\r\n if (cb) {\r\n // Set the specific hook context implementation using a lazy creation pattern\r\n callDetails.ctx = function () {\r\n var ctx = hookCtx[idx] = (hookCtx[idx] || {});\r\n return ctx;\r\n };\r\n try {\r\n cb.apply(callDetails.inst, cbArgs);\r\n }\r\n catch (err) {\r\n var orgEx = callDetails.err;\r\n try {\r\n // Report Hook error via the callback\r\n var hookErrorCb = cbks[cbNames[2 /* HookError */]];\r\n if (hookErrorCb) {\r\n callDetails.err = err;\r\n hookErrorCb.apply(callDetails.inst, cbArgs);\r\n }\r\n }\r\n catch (e) {\r\n // Not much we can do here -- swallowing the exception to avoid crashing the hosting app\r\n }\r\n finally {\r\n // restore the original exception (if any)\r\n callDetails.err = orgEx;\r\n }\r\n }\r\n }\r\n });\r\n }\r\n}\r\n/** @ignore */\r\nfunction _createFunctionHook(aiHook) {\r\n // Define a temporary method that queues-up a the real method call\r\n return function () {\r\n var funcThis = this;\r\n // Capture the original arguments passed to the method\r\n var orgArgs = arguments;\r\n var hooks = aiHook.h;\r\n var funcArgs = {\r\n name: aiHook.n,\r\n inst: funcThis,\r\n ctx: null,\r\n set: _replaceArg\r\n };\r\n var hookCtx = [];\r\n var cbArgs = _createArgs([funcArgs], orgArgs);\r\n function _createArgs(target, theArgs) {\r\n _arrLoop(theArgs, function (arg) {\r\n target.push(arg);\r\n });\r\n return target;\r\n }\r\n function _replaceArg(idx, value) {\r\n orgArgs = _createArgs([], orgArgs);\r\n orgArgs[idx] = value;\r\n cbArgs = _createArgs([funcArgs], orgArgs);\r\n }\r\n // Call the pre-request hooks\r\n _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 0 /* Request */);\r\n // Call the original function was called\r\n var theFunc = aiHook.f;\r\n try {\r\n funcArgs.rslt = theFunc.apply(funcThis, orgArgs);\r\n }\r\n catch (err) {\r\n // Report the request callback\r\n funcArgs.err = err;\r\n _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 3 /* FunctionError */);\r\n // rethrow the original exception so anyone listening for it can catch the exception\r\n throw err;\r\n }\r\n // Call the post-request hooks\r\n _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 1 /* Response */);\r\n return funcArgs.rslt;\r\n };\r\n}\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\nfunction _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[strPrototype] || target[strConstructor];\r\n if (newProto) {\r\n return newProto;\r\n }\r\n }\r\n return null;\r\n}\r\n/** @ignore */\r\nfunction _getOwner(target, name, checkPrototype) {\r\n var owner = null;\r\n if (target) {\r\n if (CoreUtils.hasOwnProperty(target, name)) {\r\n owner = target;\r\n }\r\n else if (checkPrototype) {\r\n owner = _getOwner(_getObjProto(target), name, false);\r\n }\r\n }\r\n return owner;\r\n}\r\n/**\r\n * Intercept the named prototype functions for the target class / object\r\n * @param target - The target object\r\n * @param funcName - The function name\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n */\r\nexport function InstrumentProto(target, funcName, callbacks) {\r\n if (target) {\r\n return InstrumentFunc(target[strPrototype], funcName, callbacks, false);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Intercept the named prototype functions for the target class / object\r\n * @param target - The target object\r\n * @param funcNames - The function names to intercept and call\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n */\r\nexport function InstrumentProtos(target, funcNames, callbacks) {\r\n if (target) {\r\n return InstrumentFuncs(target[strPrototype], funcNames, callbacks, false);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Intercept the named prototype functions for the target class / object\r\n * @param target - The target object\r\n * @param funcName - The function name\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function\r\n */\r\nexport function InstrumentFunc(target, funcName, callbacks, checkPrototype) {\r\n if (checkPrototype === void 0) { checkPrototype = true; }\r\n if (target && funcName && callbacks) {\r\n var owner = _getOwner(target, funcName, checkPrototype);\r\n if (owner) {\r\n var fn = owner[funcName];\r\n if (typeof fn === strFunction) {\r\n var aiHook_1 = fn[aiInstrumentHooks];\r\n if (!aiHook_1) {\r\n // Only hook the function once\r\n aiHook_1 = {\r\n i: 0,\r\n n: funcName,\r\n f: fn,\r\n h: []\r\n };\r\n // Override (hook) the original function\r\n var newFunc = _createFunctionHook(aiHook_1);\r\n newFunc[aiInstrumentHooks] = aiHook_1; // Tag and store the function hooks\r\n owner[funcName] = newFunc;\r\n }\r\n var theHook = {\r\n // tslint:disable:object-literal-shorthand\r\n id: aiHook_1.i,\r\n cbks: callbacks,\r\n rm: function () {\r\n // DO NOT Use () => { shorthand for the function as the this gets replaced\r\n // with the outer this and not the this for theHook instance.\r\n var id = this.id;\r\n _arrLoop(aiHook_1.h, function (hook, idx) {\r\n if (hook.id === id) {\r\n aiHook_1.h.splice(idx, 1);\r\n return 1;\r\n }\r\n });\r\n }\r\n // tslint:enable:object-literal-shorthand\r\n };\r\n aiHook_1.i++;\r\n aiHook_1.h.push(theHook);\r\n return theHook;\r\n }\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Intercept the named functions for the target class / object\r\n * @param target - The target object\r\n * @param funcNames - The function names to intercept and call\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function\r\n */\r\nexport function InstrumentFuncs(target, funcNames, callbacks, checkPrototype) {\r\n if (checkPrototype === void 0) { checkPrototype = true; }\r\n var hooks = null;\r\n _arrLoop(funcNames, function (funcName) {\r\n var hook = InstrumentFunc(target, funcName, callbacks, checkPrototype);\r\n if (hook) {\r\n if (!hooks) {\r\n hooks = [];\r\n }\r\n hooks.push(hook);\r\n }\r\n });\r\n return hooks;\r\n}\r\n//# sourceMappingURL=InstrumentHooks.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar RequestHeaders = /** @class */ (function () {\r\n function RequestHeaders() {\r\n }\r\n /**\r\n * Request-Context header\r\n */\r\n RequestHeaders.requestContextHeader = \"Request-Context\";\r\n /**\r\n * Target instrumentation header that is added to the response and retrieved by the\r\n * calling application when processing incoming responses.\r\n */\r\n RequestHeaders.requestContextTargetKey = \"appId\";\r\n /**\r\n * Request-Context appId format\r\n */\r\n RequestHeaders.requestContextAppIdFormat = \"appId=cid-v1:\";\r\n /**\r\n * Request-Id header\r\n */\r\n RequestHeaders.requestIdHeader = \"Request-Id\";\r\n /**\r\n * W3C distributed tracing protocol header\r\n */\r\n RequestHeaders.traceParentHeader = \"traceparent\";\r\n /**\r\n * Sdk-Context header\r\n * If this header passed with appId in content then appId will be returned back by the backend.\r\n */\r\n RequestHeaders.sdkContextHeader = \"Sdk-Context\";\r\n /**\r\n * String to pass in header for requesting appId back from the backend.\r\n */\r\n RequestHeaders.sdkContextHeaderAppIdRequest = \"appId\";\r\n RequestHeaders.requestContextHeaderLowerCase = \"request-context\";\r\n return RequestHeaders;\r\n}());\r\nexport { RequestHeaders };\r\n//# sourceMappingURL=RequestResponseHeaders.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { LoggingSeverity, _InternalMessageId, CoreUtils, hasJSON, getJSON } from '@microsoft/applicationinsights-core-js';\r\nvar DataSanitizer = /** @class */ (function () {\r\n function DataSanitizer() {\r\n }\r\n DataSanitizer.sanitizeKeyAndAddUniqueness = function (logger, key, map) {\r\n var origLength = key.length;\r\n var field = DataSanitizer.sanitizeKey(logger, key);\r\n // validation truncated the length. We need to add uniqueness\r\n if (field.length !== origLength) {\r\n var i = 0;\r\n var uniqueField = field;\r\n while (map[uniqueField] !== undefined) {\r\n i++;\r\n uniqueField = field.substring(0, DataSanitizer.MAX_NAME_LENGTH - 3) + DataSanitizer.padNumber(i);\r\n }\r\n field = uniqueField;\r\n }\r\n return field;\r\n };\r\n DataSanitizer.sanitizeKey = function (logger, name) {\r\n var nameTrunc;\r\n if (name) {\r\n // Remove any leading or trailing whitepace\r\n name = DataSanitizer.trim(name.toString());\r\n // truncate the string to 150 chars\r\n if (name.length > DataSanitizer.MAX_NAME_LENGTH) {\r\n nameTrunc = name.substring(0, DataSanitizer.MAX_NAME_LENGTH);\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, \"name is too long. It has been truncated to \" + DataSanitizer.MAX_NAME_LENGTH + \" characters.\", { name: name }, true);\r\n }\r\n }\r\n return nameTrunc || name;\r\n };\r\n DataSanitizer.sanitizeString = function (logger, value, maxLength) {\r\n if (maxLength === void 0) { maxLength = DataSanitizer.MAX_STRING_LENGTH; }\r\n var valueTrunc;\r\n if (value) {\r\n maxLength = maxLength ? maxLength : DataSanitizer.MAX_STRING_LENGTH; // in case default parameters dont work\r\n value = DataSanitizer.trim(value);\r\n if (value.toString().length > maxLength) {\r\n valueTrunc = value.toString().substring(0, maxLength);\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, \"string value is too long. It has been truncated to \" + maxLength + \" characters.\", { value: value }, true);\r\n }\r\n }\r\n return valueTrunc || value;\r\n };\r\n DataSanitizer.sanitizeUrl = function (logger, url) {\r\n return DataSanitizer.sanitizeInput(logger, url, DataSanitizer.MAX_URL_LENGTH, _InternalMessageId.UrlTooLong);\r\n };\r\n DataSanitizer.sanitizeMessage = function (logger, message) {\r\n var messageTrunc;\r\n if (message) {\r\n if (message.length > DataSanitizer.MAX_MESSAGE_LENGTH) {\r\n messageTrunc = message.substring(0, DataSanitizer.MAX_MESSAGE_LENGTH);\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, \"message is too long, it has been truncated to \" + DataSanitizer.MAX_MESSAGE_LENGTH + \" characters.\", { message: message }, true);\r\n }\r\n }\r\n return messageTrunc || message;\r\n };\r\n DataSanitizer.sanitizeException = function (logger, exception) {\r\n var exceptionTrunc;\r\n if (exception) {\r\n if (exception.length > DataSanitizer.MAX_EXCEPTION_LENGTH) {\r\n exceptionTrunc = exception.substring(0, DataSanitizer.MAX_EXCEPTION_LENGTH);\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, \"exception is too long, it has been truncated to \" + DataSanitizer.MAX_EXCEPTION_LENGTH + \" characters.\", { exception: exception }, true);\r\n }\r\n }\r\n return exceptionTrunc || exception;\r\n };\r\n DataSanitizer.sanitizeProperties = function (logger, properties) {\r\n if (properties) {\r\n var tempProps = {};\r\n for (var prop in properties) {\r\n var value = properties[prop];\r\n if (CoreUtils.isObject(value) && hasJSON()) {\r\n // Stringify any part C properties\r\n try {\r\n value = getJSON().stringify(value);\r\n }\r\n catch (e) {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, \"custom property is not valid\", { exception: e }, true);\r\n }\r\n }\r\n value = DataSanitizer.sanitizeString(logger, value, DataSanitizer.MAX_PROPERTY_LENGTH);\r\n prop = DataSanitizer.sanitizeKeyAndAddUniqueness(logger, prop, tempProps);\r\n tempProps[prop] = value;\r\n }\r\n properties = tempProps;\r\n }\r\n return properties;\r\n };\r\n DataSanitizer.sanitizeMeasurements = function (logger, measurements) {\r\n if (measurements) {\r\n var tempMeasurements = {};\r\n for (var measure in measurements) {\r\n var value = measurements[measure];\r\n measure = DataSanitizer.sanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements);\r\n tempMeasurements[measure] = value;\r\n }\r\n measurements = tempMeasurements;\r\n }\r\n return measurements;\r\n };\r\n DataSanitizer.sanitizeId = function (logger, id) {\r\n return id ? DataSanitizer.sanitizeInput(logger, id, DataSanitizer.MAX_ID_LENGTH, _InternalMessageId.IdTooLong).toString() : id;\r\n };\r\n DataSanitizer.sanitizeInput = function (logger, input, maxLength, _msgId) {\r\n var inputTrunc;\r\n if (input) {\r\n input = DataSanitizer.trim(input);\r\n if (input.length > maxLength) {\r\n inputTrunc = input.substring(0, maxLength);\r\n logger.throwInternal(LoggingSeverity.WARNING, _msgId, \"input is too long, it has been truncated to \" + maxLength + \" characters.\", { data: input }, true);\r\n }\r\n }\r\n return inputTrunc || input;\r\n };\r\n DataSanitizer.padNumber = function (num) {\r\n var s = \"00\" + num;\r\n return s.substr(s.length - 3);\r\n };\r\n /**\r\n * helper method to trim strings (IE8 does not implement String.prototype.trim)\r\n */\r\n DataSanitizer.trim = function (str) {\r\n if (!CoreUtils.isString(str)) {\r\n return str;\r\n }\r\n return str.replace(/^\\s+|\\s+$/g, \"\");\r\n };\r\n /**\r\n * Max length allowed for custom names.\r\n */\r\n DataSanitizer.MAX_NAME_LENGTH = 150;\r\n /**\r\n * Max length allowed for Id field in page views.\r\n */\r\n DataSanitizer.MAX_ID_LENGTH = 128;\r\n /**\r\n * Max length allowed for custom values.\r\n */\r\n DataSanitizer.MAX_PROPERTY_LENGTH = 8192;\r\n /**\r\n * Max length allowed for names\r\n */\r\n DataSanitizer.MAX_STRING_LENGTH = 1024;\r\n /**\r\n * Max length allowed for url.\r\n */\r\n DataSanitizer.MAX_URL_LENGTH = 2048;\r\n /**\r\n * Max length allowed for messages.\r\n */\r\n DataSanitizer.MAX_MESSAGE_LENGTH = 32768;\r\n /**\r\n * Max length allowed for exceptions.\r\n */\r\n DataSanitizer.MAX_EXCEPTION_LENGTH = 32768;\r\n return DataSanitizer;\r\n}());\r\nexport { DataSanitizer };\r\n//# sourceMappingURL=DataSanitizer.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { StorageType } from \"./Enums\";\r\nimport { CoreUtils, EventHelper, _InternalMessageId, LoggingSeverity, getGlobal, getGlobalInst, getWindow, getDocument, getNavigator, getPerformance, getLocation, hasJSON, getJSON, strPrototype } from \"@microsoft/applicationinsights-core-js\";\r\nimport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nimport { DataSanitizer } from \"./Telemetry/Common/DataSanitizer\";\r\nvar _navigator = getNavigator();\r\nvar _isString = CoreUtils.isString;\r\nvar _uaDisallowsSameSiteNone = null;\r\nfunction _endsWith(value, search) {\r\n var len = value.length;\r\n var start = len - search.length;\r\n return value.substring(start >= 0 ? start : 0, len) === search;\r\n}\r\nvar Util = /** @class */ (function () {\r\n function Util() {\r\n }\r\n Util.createDomEvent = function (eventName) {\r\n var event = null;\r\n if (CoreUtils.isFunction(Event)) {\r\n event = new Event(eventName);\r\n }\r\n else {\r\n var doc = getDocument();\r\n if (doc && doc.createEvent) {\r\n event = doc.createEvent(\"Event\");\r\n event.initEvent(eventName, true, true);\r\n }\r\n }\r\n return event;\r\n };\r\n /*\r\n * Force the SDK not to use local and session storage\r\n */\r\n Util.disableStorage = function () {\r\n Util._canUseLocalStorage = false;\r\n Util._canUseSessionStorage = false;\r\n };\r\n /**\r\n * Gets the localStorage object if available\r\n * @return {Storage} - Returns the storage object if available else returns null\r\n */\r\n Util._getLocalStorageObject = function () {\r\n if (Util.canUseLocalStorage()) {\r\n return Util._getVerifiedStorageObject(StorageType.LocalStorage);\r\n }\r\n return null;\r\n };\r\n /**\r\n * Tests storage object (localStorage or sessionStorage) to verify that it is usable\r\n * More details here: https://mathiasbynens.be/notes/localstorage-pattern\r\n * @param storageType Type of storage\r\n * @return {Storage} Returns storage object verified that it is usable\r\n */\r\n Util._getVerifiedStorageObject = function (storageType) {\r\n var storage = null;\r\n var fail;\r\n var uid;\r\n try {\r\n if (CoreUtils.isNullOrUndefined(getGlobal())) {\r\n return null;\r\n }\r\n uid = new Date;\r\n storage = storageType === StorageType.LocalStorage ? getGlobalInst(\"localStorage\") : getGlobalInst(\"sessionStorage\");\r\n storage.setItem(uid.toString(), uid.toString());\r\n fail = storage.getItem(uid.toString()) !== uid.toString();\r\n storage.removeItem(uid.toString());\r\n if (fail) {\r\n storage = null;\r\n }\r\n }\r\n catch (exception) {\r\n storage = null;\r\n }\r\n return storage;\r\n };\r\n /**\r\n * Checks if endpoint URL is application insights internal injestion service URL.\r\n *\r\n * @param endpointUrl Endpoint URL to check.\r\n * @returns {boolean} True if if endpoint URL is application insights internal injestion service URL.\r\n */\r\n Util.isInternalApplicationInsightsEndpoint = function (endpointUrl) {\r\n return Util._internalEndpoints.indexOf(endpointUrl.toLowerCase()) !== -1;\r\n };\r\n /**\r\n * Check if the browser supports local storage.\r\n *\r\n * @returns {boolean} True if local storage is supported.\r\n */\r\n Util.canUseLocalStorage = function () {\r\n if (Util._canUseLocalStorage === undefined) {\r\n Util._canUseLocalStorage = !!Util._getVerifiedStorageObject(StorageType.LocalStorage);\r\n }\r\n return Util._canUseLocalStorage;\r\n };\r\n /**\r\n * Get an object from the browser's local storage\r\n *\r\n * @param {string} name - the name of the object to get from storage\r\n * @returns {string} The contents of the storage object with the given name. Null if storage is not supported.\r\n */\r\n Util.getStorage = function (logger, name) {\r\n var storage = Util._getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n return storage.getItem(name);\r\n }\r\n catch (e) {\r\n Util._canUseLocalStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, \"Browser failed read of local storage. \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Set the contents of an object in the browser's local storage\r\n *\r\n * @param {string} name - the name of the object to set in storage\r\n * @param {string} data - the contents of the object to set in storage\r\n * @returns {boolean} True if the storage object could be written.\r\n */\r\n Util.setStorage = function (logger, name, data) {\r\n var storage = Util._getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.setItem(name, data);\r\n return true;\r\n }\r\n catch (e) {\r\n Util._canUseLocalStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, \"Browser failed write to local storage. \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Remove an object from the browser's local storage\r\n *\r\n * @param {string} name - the name of the object to remove from storage\r\n * @returns {boolean} True if the storage object could be removed.\r\n */\r\n Util.removeStorage = function (logger, name) {\r\n var storage = Util._getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.removeItem(name);\r\n return true;\r\n }\r\n catch (e) {\r\n Util._canUseLocalStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, \"Browser failed removal of local storage item. \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the sessionStorage object if available\r\n * @return {Storage} - Returns the storage object if available else returns null\r\n */\r\n Util._getSessionStorageObject = function () {\r\n if (Util.canUseSessionStorage()) {\r\n return Util._getVerifiedStorageObject(StorageType.SessionStorage);\r\n }\r\n return null;\r\n };\r\n /**\r\n * Check if the browser supports session storage.\r\n *\r\n * @returns {boolean} True if session storage is supported.\r\n */\r\n Util.canUseSessionStorage = function () {\r\n if (Util._canUseSessionStorage === undefined) {\r\n Util._canUseSessionStorage = !!Util._getVerifiedStorageObject(StorageType.SessionStorage);\r\n }\r\n return Util._canUseSessionStorage;\r\n };\r\n /**\r\n * Gets the list of session storage keys\r\n *\r\n * @returns {string[]} List of session storage keys\r\n */\r\n Util.getSessionStorageKeys = function () {\r\n var keys = [];\r\n if (Util.canUseSessionStorage()) {\r\n for (var key in getGlobalInst(\"sessionStorage\")) {\r\n keys.push(key);\r\n }\r\n }\r\n return keys;\r\n };\r\n /**\r\n * Get an object from the browser's session storage\r\n *\r\n * @param {string} name - the name of the object to get from storage\r\n * @returns {string} The contents of the storage object with the given name. Null if storage is not supported.\r\n */\r\n Util.getSessionStorage = function (logger, name) {\r\n var storage = Util._getSessionStorageObject();\r\n if (storage !== null) {\r\n try {\r\n return storage.getItem(name);\r\n }\r\n catch (e) {\r\n Util._canUseSessionStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadSessionStorage, \"Browser failed read of session storage. \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Set the contents of an object in the browser's session storage\r\n *\r\n * @param {string} name - the name of the object to set in storage\r\n * @param {string} data - the contents of the object to set in storage\r\n * @returns {boolean} True if the storage object could be written.\r\n */\r\n Util.setSessionStorage = function (logger, name, data) {\r\n var storage = Util._getSessionStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.setItem(name, data);\r\n return true;\r\n }\r\n catch (e) {\r\n Util._canUseSessionStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteSessionStorage, \"Browser failed write to session storage. \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Remove an object from the browser's session storage\r\n *\r\n * @param {string} name - the name of the object to remove from storage\r\n * @returns {boolean} True if the storage object could be removed.\r\n */\r\n Util.removeSessionStorage = function (logger, name) {\r\n var storage = Util._getSessionStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.removeItem(name);\r\n return true;\r\n }\r\n catch (e) {\r\n Util._canUseSessionStorage = false;\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromSessionStorage, \"Browser failed removal of session storage item. \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }\r\n return false;\r\n };\r\n /*\r\n * Force the SDK not to store and read any data from cookies\r\n */\r\n Util.disableCookies = function () {\r\n CoreUtils.disableCookies();\r\n };\r\n /*\r\n * helper method to tell if document.cookie object is available\r\n */\r\n Util.canUseCookies = function (logger) {\r\n if (CoreUtils._canUseCookies === undefined) {\r\n CoreUtils._canUseCookies = false;\r\n try {\r\n CoreUtils._canUseCookies = Util.document.cookie !== undefined;\r\n }\r\n catch (e) {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, \"Cannot access document.cookie - \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n ;\r\n }\r\n return CoreUtils._canUseCookies;\r\n };\r\n Util.disallowsSameSiteNone = function (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 (userAgent.indexOf(\"CPU iPhone OS 12\") !== -1 || userAgent.indexOf(\"iPad; CPU OS 12\") !== -1) {\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 (userAgent.indexOf(\"Macintosh; Intel Mac OS X 10_14\") !== -1 && userAgent.indexOf(\"Version/\") !== -1 && userAgent.indexOf(\"Safari\") !== -1) {\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 (userAgent.indexOf(\"Macintosh; Intel Mac OS X 10_14\") !== -1 && _endsWith(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 (userAgent.indexOf(\"Chrome/5\") !== -1 || userAgent.indexOf(\"Chrome/6\") !== -1) {\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 (userAgent.indexOf(\"UnrealEngine\") !== -1 && userAgent.indexOf(\"Chrome\") === -1) {\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 (userAgent.indexOf(\"UCBrowser/12\") !== -1 || userAgent.indexOf(\"UCBrowser/11\") !== -1) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * helper method to set userId and sessionId cookie\r\n */\r\n Util.setCookie = function (logger, name, value, domain) {\r\n if (Util.canUseCookies(logger)) {\r\n var domainAttrib = \"\";\r\n var secureAttrib = \"\";\r\n if (domain) {\r\n domainAttrib = \";domain=\" + domain;\r\n }\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol === \"https:\") {\r\n secureAttrib = \";secure\";\r\n if (_uaDisallowsSameSiteNone === null) {\r\n _uaDisallowsSameSiteNone = Util.disallowsSameSiteNone((getNavigator() || {}).userAgent);\r\n }\r\n if (!_uaDisallowsSameSiteNone) {\r\n value = value + \";SameSite=None\"; // SameSite can only be set on secure pages\r\n }\r\n }\r\n Util.document.cookie = name + \"=\" + value + domainAttrib + \";path=/\" + secureAttrib;\r\n }\r\n };\r\n Util.stringToBoolOrDefault = function (str, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n if (str === undefined || str === null) {\r\n return defaultValue;\r\n }\r\n return str.toString().toLowerCase() === \"true\";\r\n };\r\n /**\r\n * helper method to access userId and sessionId cookie\r\n */\r\n Util.getCookie = function (logger, name) {\r\n if (!Util.canUseCookies(logger)) {\r\n return;\r\n }\r\n var value = \"\";\r\n if (name && name.length) {\r\n var cookieName = name + \"=\";\r\n var cookies = Util.document.cookie.split(\";\");\r\n for (var i = 0; i < cookies.length; i++) {\r\n var cookie = cookies[i];\r\n cookie = Util.trim(cookie);\r\n if (cookie && cookie.indexOf(cookieName) === 0) {\r\n value = cookie.substring(cookieName.length, cookies[i].length);\r\n break;\r\n }\r\n }\r\n }\r\n return value;\r\n };\r\n /**\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\n Util.deleteCookie = function (logger, name) {\r\n if (Util.canUseCookies(logger)) {\r\n // Setting the expiration date in the past immediately removes the cookie\r\n Util.document.cookie = name + \"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;\";\r\n }\r\n };\r\n /**\r\n * generate a random 32bit number (-0x80000000..0x7FFFFFFF).\r\n */\r\n Util.random32 = function () {\r\n return CoreUtils.random32(true);\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\n Util.getIEVersion = function (userAgentStr) {\r\n if (userAgentStr === void 0) { userAgentStr = null; }\r\n var myNav = userAgentStr ? userAgentStr.toLowerCase() : (_navigator ? (_navigator.userAgent || \"\").toLowerCase() : \"\");\r\n if (myNav.indexOf(\"msie\") !== -1) {\r\n return parseInt(myNav.split(\"msie\")[1]);\r\n }\r\n else if (myNav.indexOf(\"trident/\")) {\r\n var tridentVer = parseInt(myNav.split(\"trident/\")[1]);\r\n if (tridentVer) {\r\n return tridentVer + 4;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Convert ms to c# time span format\r\n */\r\n Util.msToTimeSpan = function (totalms) {\r\n if (isNaN(totalms) || totalms < 0) {\r\n totalms = 0;\r\n }\r\n totalms = Math.round(totalms);\r\n var ms = \"\" + totalms % 1000;\r\n var sec = \"\" + Math.floor(totalms / 1000) % 60;\r\n var min = \"\" + Math.floor(totalms / (1000 * 60)) % 60;\r\n var hour = \"\" + Math.floor(totalms / (1000 * 60 * 60)) % 24;\r\n var days = Math.floor(totalms / (1000 * 60 * 60 * 24));\r\n ms = ms.length === 1 ? \"00\" + ms : ms.length === 2 ? \"0\" + ms : ms;\r\n sec = sec.length < 2 ? \"0\" + sec : sec;\r\n min = min.length < 2 ? \"0\" + min : min;\r\n hour = hour.length < 2 ? \"0\" + hour : hour;\r\n return (days > 0 ? days + \".\" : \"\") + hour + \":\" + min + \":\" + sec + \".\" + ms;\r\n };\r\n /**\r\n * Checks if error has no meaningful data inside. Ususally such errors are received by window.onerror when error\r\n * happens in a script from other domain (cross origin, CORS).\r\n */\r\n Util.isCrossOriginError = function (message, url, lineNumber, columnNumber, error) {\r\n return (message === \"Script error.\" || message === \"Script error\") && !error;\r\n };\r\n /**\r\n * Returns string representation of an object suitable for diagnostics logging.\r\n */\r\n Util.dump = function (object) {\r\n var objectTypeDump = Object[strPrototype].toString.call(object);\r\n var propertyValueDump = \"\";\r\n if (objectTypeDump === \"[object Error]\") {\r\n propertyValueDump = \"{ stack: '\" + object.stack + \"', message: '\" + object.message + \"', name: '\" + object.name + \"'\";\r\n }\r\n else if (hasJSON()) {\r\n propertyValueDump = getJSON().stringify(object);\r\n }\r\n return objectTypeDump + propertyValueDump;\r\n };\r\n /**\r\n * Returns the name of object if it's an Error. Otherwise, returns empty string.\r\n */\r\n Util.getExceptionName = function (object) {\r\n var objectTypeDump = Object[strPrototype].toString.call(object);\r\n if (objectTypeDump === \"[object Error]\") {\r\n return object.name;\r\n }\r\n return \"\";\r\n };\r\n /**\r\n * Adds an event handler for the specified event to the window\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 * @return {boolean} - true if the handler was successfully added\r\n */\r\n Util.addEventHandler = function (eventName, callback) {\r\n return EventHelper.Attach(getWindow(), eventName, callback);\r\n };\r\n /**\r\n * Tells if a browser supports a Beacon API\r\n */\r\n Util.IsBeaconApiSupported = function () {\r\n return ('sendBeacon' in _navigator && _navigator.sendBeacon);\r\n };\r\n Util.getExtension = function (extensions, identifier) {\r\n var extension = null;\r\n var extIx = 0;\r\n while (!extension && extIx < extensions.length) {\r\n if (extensions[extIx] && extensions[extIx].identifier === identifier) {\r\n extension = extensions[extIx];\r\n }\r\n extIx++;\r\n }\r\n return extension;\r\n };\r\n Util.document = getDocument() || {};\r\n Util._canUseLocalStorage = undefined;\r\n Util._canUseSessionStorage = undefined;\r\n // listing only non-geo specific locations\r\n Util._internalEndpoints = [\r\n \"https://dc.services.visualstudio.com/v2/track\",\r\n \"https://breeze.aimon.applicationinsights.io/v2/track\",\r\n \"https://dc-int.services.visualstudio.com/v2/track\"\r\n ];\r\n Util.NotSpecified = \"not_specified\";\r\n /**\r\n * helper method to trim strings (IE8 does not implement String.prototype.trim)\r\n */\r\n Util.trim = CoreUtils.strTrim;\r\n /**\r\n * generate random id string\r\n */\r\n Util.newId = CoreUtils.newId;\r\n /**\r\n * generate W3C trace id\r\n */\r\n Util.generateW3CId = CoreUtils.generateW3CId;\r\n /**\r\n * Check if an object is of type Array\r\n */\r\n Util.isArray = CoreUtils.isArray;\r\n /**\r\n * Check if an object is of type Error\r\n */\r\n Util.isError = CoreUtils.isError;\r\n /**\r\n * Check if an object is of type Date\r\n */\r\n Util.isDate = CoreUtils.isDate;\r\n // Keeping this name for backward compatibility (for now)\r\n Util.toISOStringForIE8 = CoreUtils.toISOString;\r\n return Util;\r\n}());\r\nexport { Util };\r\nvar UrlHelper = /** @class */ (function () {\r\n function UrlHelper() {\r\n }\r\n UrlHelper.parseUrl = function (url) {\r\n var anchorIdx = UrlHelper._htmlAnchorIdx;\r\n var anchorCache = UrlHelper._htmlAnchorElement;\r\n var tempAnchor = anchorCache[anchorIdx];\r\n if (!UrlHelper.document.createElement) {\r\n // Always create the temp instance if createElement is not available\r\n tempAnchor = { host: UrlHelper.parseHost(url, true) };\r\n }\r\n else if (!anchorCache[anchorIdx]) {\r\n // Create and cache the unattached anchor instance \r\n tempAnchor = anchorCache[anchorIdx] = UrlHelper.document.createElement('a');\r\n }\r\n tempAnchor.href = url;\r\n // Move the cache index forward\r\n anchorIdx++;\r\n if (anchorIdx >= anchorCache.length) {\r\n anchorIdx = 0;\r\n }\r\n UrlHelper._htmlAnchorIdx = anchorIdx;\r\n return tempAnchor;\r\n };\r\n UrlHelper.getAbsoluteUrl = function (url) {\r\n var result;\r\n var a = UrlHelper.parseUrl(url);\r\n if (a) {\r\n result = a.href;\r\n }\r\n return result;\r\n };\r\n UrlHelper.getPathName = function (url) {\r\n var result;\r\n var a = UrlHelper.parseUrl(url);\r\n if (a) {\r\n result = a.pathname;\r\n }\r\n return result;\r\n };\r\n UrlHelper.getCompleteUrl = function (method, absoluteUrl) {\r\n if (method) {\r\n return method.toUpperCase() + \" \" + absoluteUrl;\r\n }\r\n else {\r\n return absoluteUrl;\r\n }\r\n };\r\n // Fallback method to grab host from url if document.createElement method is not available\r\n UrlHelper.parseHost = function (url, inclPort) {\r\n var fullHost = UrlHelper.parseFullHost(url, inclPort);\r\n if (fullHost) {\r\n var match = fullHost.match(/(www[0-9]?\\.)?(.[^/:]+)(\\:[\\d]+)?/i);\r\n if (match != null && match.length > 3 && _isString(match[2]) && match[2].length > 0) {\r\n return match[2] + (match[3] || \"\");\r\n }\r\n }\r\n return fullHost;\r\n };\r\n /**\r\n * Get the full host from the url, optionally including the port\r\n */\r\n UrlHelper.parseFullHost = function (url, inclPort) {\r\n var result = null;\r\n if (url) {\r\n var match = url.match(/(\\w*):\\/\\/(.[^/:]+)(\\:[\\d]+)?/i);\r\n if (match != null && match.length > 2 && _isString(match[2]) && match[2].length > 0) {\r\n result = match[2] || \"\";\r\n if (inclPort && match.length > 2) {\r\n var protocol = (match[1] || \"\").toLowerCase();\r\n var port = match[3] || \"\";\r\n // IE includes the standard port so pass it off if it's the same as the protocol\r\n if (protocol === \"http\" && port === \":80\") {\r\n port = \"\";\r\n }\r\n else if (protocol === \"https\" && port === \":443\") {\r\n port = \"\";\r\n }\r\n result += port;\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n UrlHelper.document = getDocument() || {};\r\n UrlHelper._htmlAnchorIdx = 0;\r\n // Use an array of temporary values as it's possible for multiple calls to parseUrl() will be called with different URLs\r\n // Using a cache size of 5 for now as it current depth usage is at least 2, so adding a minor buffer to handle future updates\r\n UrlHelper._htmlAnchorElement = [null, null, null, null, null];\r\n return UrlHelper;\r\n}());\r\nexport { UrlHelper };\r\nvar CorrelationIdHelper = /** @class */ (function () {\r\n function CorrelationIdHelper() {\r\n }\r\n /**\r\n * Checks if a request url is not on a excluded domain list and if it is safe to add correlation headers.\r\n * Headers are always included if the current domain matches the request domain. If they do not match (CORS),\r\n * they are regex-ed across correlationHeaderDomains and correlationHeaderExcludedDomains to determine if headers are included.\r\n * Some environments don't give information on currentHost via window.location.host (e.g. Cordova). In these cases, the user must\r\n * manually supply domains to include correlation headers on. Else, no headers will be included at all.\r\n */\r\n CorrelationIdHelper.canIncludeCorrelationHeader = function (config, requestUrl, currentHost) {\r\n if (!requestUrl || (config && config.disableCorrelationHeaders)) {\r\n return false;\r\n }\r\n if (config && config.correlationHeaderExcludePatterns) {\r\n for (var i = 0; i < config.correlationHeaderExcludePatterns.length; i++) {\r\n if (config.correlationHeaderExcludePatterns[i].test(requestUrl)) {\r\n return false;\r\n }\r\n }\r\n }\r\n var requestHost = UrlHelper.parseUrl(requestUrl).host.toLowerCase();\r\n if (requestHost && (requestHost.indexOf(\":443\") !== -1 || requestHost.indexOf(\":80\") !== -1)) {\r\n // [Bug #1260] IE can include the port even for http and https URLs so if present \r\n // try and parse it to remove if it matches the default protocol port\r\n requestHost = (UrlHelper.parseFullHost(requestUrl, true) || \"\").toLowerCase();\r\n }\r\n if ((!config || !config.enableCorsCorrelation) && requestHost !== currentHost) {\r\n return false;\r\n }\r\n var includedDomains = config && config.correlationHeaderDomains;\r\n if (includedDomains) {\r\n var matchExists_1;\r\n CoreUtils.arrForEach(includedDomains, function (domain) {\r\n var regex = new RegExp(domain.toLowerCase().replace(/\\./g, \"\\.\").replace(/\\*/g, \".*\"));\r\n matchExists_1 = matchExists_1 || regex.test(requestHost);\r\n });\r\n if (!matchExists_1) {\r\n return false;\r\n }\r\n }\r\n var excludedDomains = config && config.correlationHeaderExcludedDomains;\r\n if (!excludedDomains || excludedDomains.length === 0) {\r\n return true;\r\n }\r\n for (var i = 0; i < excludedDomains.length; i++) {\r\n var regex = new RegExp(excludedDomains[i].toLowerCase().replace(/\\./g, \"\\.\").replace(/\\*/g, \".*\"));\r\n if (regex.test(requestHost)) {\r\n return false;\r\n }\r\n }\r\n // if we don't know anything about the requestHost, require the user to use included/excludedDomains.\r\n // Previously we always returned false for a falsy requestHost\r\n return requestHost && requestHost.length > 0;\r\n };\r\n /**\r\n * Combines target appId and target role name from response header.\r\n */\r\n CorrelationIdHelper.getCorrelationContext = function (responseHeader) {\r\n if (responseHeader) {\r\n var correlationId = CorrelationIdHelper.getCorrelationContextValue(responseHeader, RequestHeaders.requestContextTargetKey);\r\n if (correlationId && correlationId !== CorrelationIdHelper.correlationIdPrefix) {\r\n return correlationId;\r\n }\r\n }\r\n };\r\n /**\r\n * Gets key from correlation response header\r\n */\r\n CorrelationIdHelper.getCorrelationContextValue = function (responseHeader, key) {\r\n if (responseHeader) {\r\n var keyValues = responseHeader.split(\",\");\r\n for (var i = 0; i < keyValues.length; ++i) {\r\n var keyValue = keyValues[i].split(\"=\");\r\n if (keyValue.length === 2 && keyValue[0] === key) {\r\n return keyValue[1];\r\n }\r\n }\r\n }\r\n };\r\n CorrelationIdHelper.correlationIdPrefix = \"cid-v1:\";\r\n return CorrelationIdHelper;\r\n}());\r\nexport { CorrelationIdHelper };\r\nvar AjaxHelper = /** @class */ (function () {\r\n function AjaxHelper() {\r\n }\r\n AjaxHelper.ParseDependencyPath = function (logger, absoluteUrl, method, commandName) {\r\n var target, name = commandName, data = commandName;\r\n if (absoluteUrl && absoluteUrl.length > 0) {\r\n var parsedUrl = UrlHelper.parseUrl(absoluteUrl);\r\n target = parsedUrl.host;\r\n if (!name) {\r\n if (parsedUrl.pathname != null) {\r\n var pathName = (parsedUrl.pathname.length === 0) ? \"/\" : parsedUrl.pathname;\r\n if (pathName.charAt(0) !== '/') {\r\n pathName = \"/\" + pathName;\r\n }\r\n data = parsedUrl.pathname;\r\n name = DataSanitizer.sanitizeString(logger, method ? method + \" \" + pathName : pathName);\r\n }\r\n else {\r\n name = DataSanitizer.sanitizeString(logger, absoluteUrl);\r\n }\r\n }\r\n }\r\n else {\r\n target = commandName;\r\n name = commandName;\r\n }\r\n return {\r\n target: target,\r\n name: name,\r\n data: data\r\n };\r\n };\r\n return AjaxHelper;\r\n}());\r\nexport { AjaxHelper };\r\n/**\r\n * A utility class that helps getting time related parameters\r\n */\r\nvar DateTimeUtils = /** @class */ (function () {\r\n function DateTimeUtils() {\r\n }\r\n /**\r\n * Get the number of milliseconds since 1970/01/01 in local timezone\r\n */\r\n DateTimeUtils.Now = function () {\r\n // returns the window or webworker performance object\r\n var perf = getPerformance();\r\n if (perf && perf.now && perf.timing) {\r\n var now = perf.now() + perf.timing.navigationStart;\r\n // Known issue with IE where this calculation can be negative, so if it is then ignore and fallback\r\n if (now > 0) {\r\n return now;\r\n }\r\n }\r\n return new Date().getTime();\r\n };\r\n /**\r\n * Gets duration between two timestamps\r\n */\r\n DateTimeUtils.GetDuration = function (start, end) {\r\n var result = null;\r\n if (start !== 0 && end !== 0 && !CoreUtils.isNullOrUndefined(start) && !CoreUtils.isNullOrUndefined(end)) {\r\n result = end - start;\r\n }\r\n return result;\r\n };\r\n return DateTimeUtils;\r\n}());\r\nexport { DateTimeUtils };\r\n//# sourceMappingURL=Util.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * This is an internal property used to cause internal (reporting) requests to be ignored from reporting\r\n * additional telemetry, to handle polyfil implementations ALL urls used with a disabled request will\r\n * also be ignored for future requests even when this property is not provided.\r\n * Tagging as Ignore as this is an internal value and is not expected to be used outside of the SDK\r\n * @ignore\r\n */\r\nexport var DisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nexport var SampleRate = \"sampleRate\";\r\nexport var ProcessLegacy = \"ProcessLegacy\";\r\nexport var HttpMethod = \"http.method\";\r\nexport var DEFAULT_BREEZE_ENDPOINT = \"https://dc.services.visualstudio.com\";\r\n//# sourceMappingURL=Constants.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { DEFAULT_BREEZE_ENDPOINT } from \"./Constants\";\r\nimport { CoreUtils } from \"@microsoft/applicationinsights-core-js\";\r\nvar ConnectionStringParser = /** @class */ (function () {\r\n function ConnectionStringParser() {\r\n }\r\n ConnectionStringParser.parse = function (connectionString) {\r\n if (!connectionString) {\r\n return {};\r\n }\r\n var kvPairs = connectionString.split(ConnectionStringParser._FIELDS_SEPARATOR);\r\n var result = CoreUtils.arrReduce(kvPairs, function (fields, kv) {\r\n var kvParts = kv.split(ConnectionStringParser._FIELD_KEY_VALUE_SEPARATOR);\r\n if (kvParts.length === 2) {\r\n var key = kvParts[0].toLowerCase();\r\n var value = kvParts[1];\r\n fields[key] = value;\r\n }\r\n return fields;\r\n }, {});\r\n if (CoreUtils.objKeys(result).length > 0) {\r\n // this is a valid connection string, so parse the results\r\n if (result.endpointsuffix) {\r\n // use endpoint suffix where overrides are not provided\r\n var locationPrefix = result.location ? result.location + \".\" : \"\";\r\n result.ingestionendpoint = result.ingestionendpoint || (\"https://\" + locationPrefix + \"dc.\" + result.endpointsuffix);\r\n }\r\n // apply the default endpoints\r\n result.ingestionendpoint = result.ingestionendpoint || DEFAULT_BREEZE_ENDPOINT;\r\n }\r\n return result;\r\n };\r\n ConnectionStringParser._FIELDS_SEPARATOR = \";\";\r\n ConnectionStringParser._FIELD_KEY_VALUE_SEPARATOR = \"=\";\r\n return ConnectionStringParser;\r\n}());\r\nexport { ConnectionStringParser };\r\n//# sourceMappingURL=ConnectionStringParser.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\n/**\r\n * Data struct to contain only C section with custom fields.\r\n */\r\nvar Base = /** @class */ (function () {\r\n function Base() {\r\n }\r\n return Base;\r\n}());\r\nexport { Base };\r\n//# sourceMappingURL=Base.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { Base } from './Base';\r\n/**\r\n * Data struct to contain both B and C sections.\r\n */\r\nvar Data = /** @class */ (function (_super) {\r\n __extends(Data, _super);\r\n function Data() {\r\n return _super.call(this) || this;\r\n }\r\n return Data;\r\n}(Base));\r\nexport { Data };\r\n//# sourceMappingURL=Data.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * System variables for a telemetry item.\r\n */\r\nvar Envelope = /** @class */ (function () {\r\n function Envelope() {\r\n this.ver = 1;\r\n this.sampleRate = 100.0;\r\n this.tags = {};\r\n }\r\n return Envelope;\r\n}());\r\nexport { Envelope };\r\n//# sourceMappingURL=Envelope.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Envelope as AIEnvelope } from '../../Interfaces/Contracts/Generated/Envelope';\r\nimport { DataSanitizer } from './DataSanitizer';\r\nimport { FieldType } from '../../Enums';\r\nimport { Util } from '../../Util';\r\nimport { CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nvar Envelope = /** @class */ (function (_super) {\r\n __extends(Envelope, _super);\r\n /**\r\n * Constructs a new instance of telemetry data.\r\n */\r\n function Envelope(logger, data, name) {\r\n var _this = _super.call(this) || this;\r\n _this.name = DataSanitizer.sanitizeString(logger, name) || Util.NotSpecified;\r\n _this.data = data;\r\n _this.time = CoreUtils.toISOString(new Date());\r\n _this.aiDataContract = {\r\n time: FieldType.Required,\r\n iKey: FieldType.Required,\r\n name: FieldType.Required,\r\n sampleRate: function () {\r\n return (_this.sampleRate === 100) ? FieldType.Hidden : FieldType.Required;\r\n },\r\n tags: FieldType.Required,\r\n data: FieldType.Required\r\n };\r\n return _this;\r\n }\r\n return Envelope;\r\n}(AIEnvelope));\r\nexport { Envelope };\r\n//# sourceMappingURL=Envelope.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\n/**\r\n * The abstract common base of all domains.\r\n */\r\nvar Domain = /** @class */ (function () {\r\n function Domain() {\r\n }\r\n return Domain;\r\n}());\r\nexport { Domain };\r\n//# sourceMappingURL=Domain.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { Domain } from './Domain';\r\n/**\r\n * Instances of Event represent structured event records that can be grouped and searched by their properties. Event data item also creates a metric of event count by name.\r\n */\r\nvar EventData = /** @class */ (function (_super) {\r\n __extends(EventData, _super);\r\n function EventData() {\r\n var _this = _super.call(this) || this;\r\n _this.ver = 2;\r\n _this.properties = {};\r\n _this.measurements = {};\r\n return _this;\r\n }\r\n return EventData;\r\n}(Domain));\r\nexport { EventData };\r\n//# sourceMappingURL=EventData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { EventData } from '../Interfaces/Contracts/Generated/EventData';\r\nimport { DataSanitizer } from './Common/DataSanitizer';\r\nimport { FieldType } from '../Enums';\r\nimport { Util } from '../Util';\r\nvar Event = /** @class */ (function (_super) {\r\n __extends(Event, _super);\r\n /**\r\n * Constructs a new instance of the EventTelemetry object\r\n */\r\n function Event(logger, name, properties, measurements) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: FieldType.Required,\r\n name: FieldType.Required,\r\n properties: FieldType.Default,\r\n measurements: FieldType.Default\r\n };\r\n _this.name = DataSanitizer.sanitizeString(logger, name) || Util.NotSpecified;\r\n _this.properties = DataSanitizer.sanitizeProperties(logger, properties);\r\n _this.measurements = DataSanitizer.sanitizeMeasurements(logger, measurements);\r\n return _this;\r\n }\r\n Event.envelopeType = \"Microsoft.ApplicationInsights.{0}.Event\";\r\n Event.dataType = \"EventData\";\r\n return Event;\r\n}(EventData));\r\nexport { Event };\r\n//# sourceMappingURL=Event.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\n/**\r\n * Stack frame information.\r\n */\r\nvar StackFrame = /** @class */ (function () {\r\n function StackFrame() {\r\n }\r\n return StackFrame;\r\n}());\r\nexport { StackFrame };\r\n//# sourceMappingURL=StackFrame.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Domain } from './Domain';\r\n/**\r\n * An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application.\r\n */\r\nvar ExceptionData = /** @class */ (function (_super) {\r\n __extends(ExceptionData, _super);\r\n function ExceptionData() {\r\n var _this = _super.call(this) || this;\r\n _this.ver = 2;\r\n _this.exceptions = [];\r\n _this.properties = {};\r\n _this.measurements = {};\r\n return _this;\r\n }\r\n return ExceptionData;\r\n}(Domain));\r\nexport { ExceptionData };\r\n//# sourceMappingURL=ExceptionData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n/**\r\n * Exception details of the exception in a chain.\r\n */\r\nvar ExceptionDetails = /** @class */ (function () {\r\n function ExceptionDetails() {\r\n this.hasFullStack = true;\r\n this.parsedStack = [];\r\n }\r\n return ExceptionDetails;\r\n}());\r\nexport { ExceptionDetails };\r\n//# sourceMappingURL=ExceptionDetails.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { StackFrame } from '../Interfaces/Contracts/Generated/StackFrame';\r\nimport { ExceptionData } from '../Interfaces/Contracts/Generated/ExceptionData';\r\nimport { ExceptionDetails } from '../Interfaces/Contracts/Generated/ExceptionDetails';\r\nimport { DataSanitizer } from './Common/DataSanitizer';\r\nimport { FieldType } from '../Enums';\r\nimport { Util } from '../Util';\r\nimport { CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nvar strError = \"error\";\r\nfunction _isExceptionDetailsInternal(value) {\r\n return \"hasFullStack\" in value && \"typeName\" in value;\r\n}\r\nfunction _isExceptionInternal(value) {\r\n return (\"ver\" in value && \"exceptions\" in value && \"properties\" in value);\r\n}\r\nfunction _getErrorType(errorType) {\r\n // Gets the Error Type by passing the constructor (used to get the true type of native error object).\r\n var typeName = \"\";\r\n if (errorType) {\r\n typeName = errorType.typeName || errorType.name || \"\";\r\n if (!typeName) {\r\n try {\r\n var funcNameRegex = /function (.{1,})\\(/;\r\n var results = (funcNameRegex).exec((errorType).constructor.toString());\r\n typeName = (results && results.length > 1) ? results[1] : \"\";\r\n }\r\n catch (e) {\r\n // Ignore\r\n }\r\n }\r\n }\r\n return typeName;\r\n}\r\nvar Exception = /** @class */ (function (_super) {\r\n __extends(Exception, _super);\r\n /**\r\n * Constructs a new instance of the ExceptionTelemetry object\r\n */\r\n function Exception(logger, exception, properties, measurements, severityLevel, id) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: FieldType.Required,\r\n exceptions: FieldType.Required,\r\n severityLevel: FieldType.Default,\r\n properties: FieldType.Default,\r\n measurements: FieldType.Default\r\n };\r\n if (!_isExceptionInternal(exception)) {\r\n _this.exceptions = [new _ExceptionDetails(logger, exception)];\r\n _this.properties = DataSanitizer.sanitizeProperties(logger, properties) || {};\r\n _this.measurements = DataSanitizer.sanitizeMeasurements(logger, measurements);\r\n if (severityLevel) {\r\n _this.severityLevel = severityLevel;\r\n }\r\n if (id) {\r\n _this.id = id;\r\n }\r\n }\r\n else {\r\n _this.exceptions = exception.exceptions;\r\n _this.properties = exception.properties;\r\n _this.measurements = exception.measurements;\r\n if (exception.severityLevel) {\r\n _this.severityLevel = exception.severityLevel;\r\n }\r\n if (exception.id) {\r\n _this.id = exception.id;\r\n }\r\n if (exception.problemGroup) {\r\n _this.problemGroup = exception.problemGroup;\r\n }\r\n // bool/int types, use isNullOrUndefined\r\n _this.ver = 2; // TODO: handle the CS\"4.0\" ==> breeze 2 conversion in a better way\r\n if (!CoreUtils.isNullOrUndefined(exception.isManual)) {\r\n _this.isManual = exception.isManual;\r\n }\r\n }\r\n return _this;\r\n }\r\n Exception.CreateFromInterface = function (logger, exception, properties, measurements) {\r\n var exceptions = exception.exceptions\r\n && CoreUtils.arrMap(exception.exceptions, function (ex) { return _ExceptionDetails.CreateFromInterface(logger, ex); });\r\n var exceptionData = new Exception(logger, __assign({}, exception, { exceptions: exceptions }), properties, measurements);\r\n return exceptionData;\r\n };\r\n Exception.prototype.toInterface = function () {\r\n var _a = this, exceptions = _a.exceptions, properties = _a.properties, measurements = _a.measurements, severityLevel = _a.severityLevel, ver = _a.ver, problemGroup = _a.problemGroup, id = _a.id, isManual = _a.isManual;\r\n var exceptionDetailsInterface = exceptions instanceof Array\r\n && CoreUtils.arrMap(exceptions, function (exception) { return exception.toInterface(); })\r\n || undefined;\r\n return {\r\n ver: \"4.0\",\r\n exceptions: exceptionDetailsInterface,\r\n severityLevel: severityLevel,\r\n properties: properties,\r\n measurements: measurements,\r\n problemGroup: problemGroup,\r\n id: id,\r\n isManual: isManual\r\n };\r\n };\r\n /**\r\n * Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.\r\n */\r\n Exception.CreateSimpleException = function (message, typeName, assembly, fileName, details, line) {\r\n return {\r\n exceptions: [\r\n {\r\n hasFullStack: true,\r\n message: message,\r\n stack: details,\r\n typeName: typeName\r\n }\r\n ]\r\n };\r\n };\r\n Exception.envelopeType = \"Microsoft.ApplicationInsights.{0}.Exception\";\r\n Exception.dataType = \"ExceptionData\";\r\n return Exception;\r\n}(ExceptionData));\r\nexport { Exception };\r\nvar _ExceptionDetails = /** @class */ (function (_super) {\r\n __extends(_ExceptionDetails, _super);\r\n function _ExceptionDetails(logger, exception) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n id: FieldType.Default,\r\n outerId: FieldType.Default,\r\n typeName: FieldType.Required,\r\n message: FieldType.Required,\r\n hasFullStack: FieldType.Default,\r\n stack: FieldType.Default,\r\n parsedStack: FieldType.Array\r\n };\r\n if (!_isExceptionDetailsInternal(exception)) {\r\n var error = exception;\r\n if (!Util.isError(error)) {\r\n error = error[strError] || error.evt || error;\r\n }\r\n _this.typeName = DataSanitizer.sanitizeString(logger, _getErrorType(error)) || Util.NotSpecified;\r\n _this.message = DataSanitizer.sanitizeMessage(logger, exception.message) || Util.NotSpecified;\r\n var stack = exception.stack;\r\n _this.parsedStack = _ExceptionDetails.parseStack(stack);\r\n _this.stack = DataSanitizer.sanitizeException(logger, stack);\r\n _this.hasFullStack = Util.isArray(_this.parsedStack) && _this.parsedStack.length > 0;\r\n }\r\n else {\r\n _this.typeName = exception.typeName;\r\n _this.message = exception.message;\r\n _this.stack = exception.stack;\r\n _this.parsedStack = exception.parsedStack;\r\n _this.hasFullStack = exception.hasFullStack;\r\n }\r\n return _this;\r\n }\r\n _ExceptionDetails.prototype.toInterface = function () {\r\n var parsedStack = this.parsedStack instanceof Array\r\n && CoreUtils.arrMap(this.parsedStack, function (frame) { return frame.toInterface(); });\r\n var exceptionDetailsInterface = {\r\n id: this.id,\r\n outerId: this.outerId,\r\n typeName: this.typeName,\r\n message: this.message,\r\n hasFullStack: this.hasFullStack,\r\n stack: this.stack,\r\n parsedStack: parsedStack || undefined\r\n };\r\n return exceptionDetailsInterface;\r\n };\r\n _ExceptionDetails.CreateFromInterface = function (logger, exception) {\r\n var parsedStack = (exception.parsedStack instanceof Array\r\n && CoreUtils.arrMap(exception.parsedStack, function (frame) { return _StackFrame.CreateFromInterface(frame); }))\r\n || exception.parsedStack;\r\n var exceptionDetails = new _ExceptionDetails(logger, __assign({}, exception, { parsedStack: parsedStack }));\r\n return exceptionDetails;\r\n };\r\n _ExceptionDetails.parseStack = function (stack) {\r\n var parsedStack;\r\n if (CoreUtils.isString(stack)) {\r\n var frames_1 = stack.split('\\n');\r\n parsedStack = [];\r\n var level = 0;\r\n var totalSizeInBytes = 0;\r\n for (var i = 0; i <= frames_1.length; i++) {\r\n var frame = frames_1[i];\r\n if (_StackFrame.regex.test(frame)) {\r\n var parsedFrame = new _StackFrame(frames_1[i], level++);\r\n totalSizeInBytes += parsedFrame.sizeInBytes;\r\n parsedStack.push(parsedFrame);\r\n }\r\n }\r\n // DP Constraint - exception parsed stack must be < 32KB\r\n // remove frames from the middle to meet the threshold\r\n var exceptionParsedStackThreshold = 32 * 1024;\r\n if (totalSizeInBytes > exceptionParsedStackThreshold) {\r\n var left = 0;\r\n var right = parsedStack.length - 1;\r\n var size = 0;\r\n var acceptedLeft = left;\r\n var acceptedRight = right;\r\n while (left < right) {\r\n // check size\r\n var lSize = parsedStack[left].sizeInBytes;\r\n var rSize = parsedStack[right].sizeInBytes;\r\n size += lSize + rSize;\r\n if (size > exceptionParsedStackThreshold) {\r\n // remove extra frames from the middle\r\n var howMany = acceptedRight - acceptedLeft + 1;\r\n parsedStack.splice(acceptedLeft, howMany);\r\n break;\r\n }\r\n // update pointers\r\n acceptedLeft = left;\r\n acceptedRight = right;\r\n left++;\r\n right--;\r\n }\r\n }\r\n }\r\n return parsedStack;\r\n };\r\n return _ExceptionDetails;\r\n}(ExceptionDetails));\r\nexport { _ExceptionDetails };\r\nvar _StackFrame = /** @class */ (function (_super) {\r\n __extends(_StackFrame, _super);\r\n function _StackFrame(sourceFrame, level) {\r\n var _this = _super.call(this) || this;\r\n _this.sizeInBytes = 0;\r\n _this.aiDataContract = {\r\n level: FieldType.Required,\r\n method: FieldType.Required,\r\n assembly: FieldType.Default,\r\n fileName: FieldType.Default,\r\n line: FieldType.Default\r\n };\r\n // Not converting this to CoreUtils.isString() as typescript uses this logic to \"understand\" the different\r\n // types for the 2 different code paths\r\n if (typeof sourceFrame === \"string\") {\r\n var frame = sourceFrame;\r\n _this.level = level;\r\n _this.method = \"\";\r\n _this.assembly = Util.trim(frame);\r\n _this.fileName = \"\";\r\n _this.line = 0;\r\n var matches = frame.match(_StackFrame.regex);\r\n if (matches && matches.length >= 5) {\r\n _this.method = Util.trim(matches[2]) || _this.method;\r\n _this.fileName = Util.trim(matches[4]);\r\n _this.line = parseInt(matches[5]) || 0;\r\n }\r\n }\r\n else {\r\n _this.level = sourceFrame.level;\r\n _this.method = sourceFrame.method;\r\n _this.assembly = sourceFrame.assembly;\r\n _this.fileName = sourceFrame.fileName;\r\n _this.line = sourceFrame.line;\r\n _this.sizeInBytes = 0;\r\n }\r\n _this.sizeInBytes += _this.method.length;\r\n _this.sizeInBytes += _this.fileName.length;\r\n _this.sizeInBytes += _this.assembly.length;\r\n // todo: these might need to be removed depending on how the back-end settles on their size calculation\r\n _this.sizeInBytes += _StackFrame.baseSize;\r\n _this.sizeInBytes += _this.level.toString().length;\r\n _this.sizeInBytes += _this.line.toString().length;\r\n return _this;\r\n }\r\n _StackFrame.CreateFromInterface = function (frame) {\r\n return new _StackFrame(frame, null /* level is available in frame interface */);\r\n };\r\n _StackFrame.prototype.toInterface = function () {\r\n return {\r\n level: this.level,\r\n method: this.method,\r\n assembly: this.assembly,\r\n fileName: this.fileName,\r\n line: this.line\r\n };\r\n };\r\n // regex to match stack frames from ie/chrome/ff\r\n // methodName=$2, fileName=$4, lineNo=$5, column=$6\r\n _StackFrame.regex = /^([\\s]+at)?(.*?)(\\@|\\s\\(|\\s)([^\\(\\@\\n]+):([0-9]+):([0-9]+)(\\)?)$/;\r\n _StackFrame.baseSize = 58; // '{\"method\":\"\",\"level\":,\"assembly\":\"\",\"fileName\":\"\",\"line\":}'.length\r\n return _StackFrame;\r\n}(StackFrame));\r\nexport { _StackFrame };\r\n//# sourceMappingURL=Exception.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { Domain } from './Domain';\r\n/**\r\n * An instance of the Metric item is a list of measurements (single data points) and/or aggregations.\r\n */\r\nvar MetricData = /** @class */ (function (_super) {\r\n __extends(MetricData, _super);\r\n function MetricData() {\r\n var _this = _super.call(this) || this;\r\n _this.ver = 2;\r\n _this.metrics = [];\r\n _this.properties = {};\r\n _this.measurements = {};\r\n return _this;\r\n }\r\n return MetricData;\r\n}(Domain));\r\nexport { MetricData };\r\n//# sourceMappingURL=MetricData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\n/**\r\n * Type of the metric data measurement.\r\n */\r\nexport var DataPointType;\r\n(function (DataPointType) {\r\n DataPointType[DataPointType[\"Measurement\"] = 0] = \"Measurement\";\r\n DataPointType[DataPointType[\"Aggregation\"] = 1] = \"Aggregation\";\r\n})(DataPointType || (DataPointType = {}));\r\n//# sourceMappingURL=DataPointType.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { DataPointType } from './DataPointType';\r\n/**\r\n * Metric data single measurement.\r\n */\r\nvar DataPoint = /** @class */ (function () {\r\n function DataPoint() {\r\n this.kind = DataPointType.Measurement;\r\n }\r\n return DataPoint;\r\n}());\r\nexport { DataPoint };\r\n//# sourceMappingURL=DataPoint.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { DataPoint as AIDataPoint } from '../../Interfaces/Contracts/Generated/DataPoint';\r\nimport { FieldType } from '../../Enums';\r\nvar DataPoint = /** @class */ (function (_super) {\r\n __extends(DataPoint, _super);\r\n function DataPoint() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * The data contract for serializing this object.\r\n */\r\n _this.aiDataContract = {\r\n name: FieldType.Required,\r\n kind: FieldType.Default,\r\n value: FieldType.Required,\r\n count: FieldType.Default,\r\n min: FieldType.Default,\r\n max: FieldType.Default,\r\n stdDev: FieldType.Default\r\n };\r\n return _this;\r\n }\r\n return DataPoint;\r\n}(AIDataPoint));\r\nexport { DataPoint };\r\n//# sourceMappingURL=DataPoint.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { MetricData } from '../Interfaces/Contracts/Generated/MetricData';\r\nimport { DataSanitizer } from './Common/DataSanitizer';\r\nimport { FieldType } from '../Enums';\r\nimport { DataPoint } from './Common/DataPoint';\r\nimport { Util } from '../Util';\r\nvar Metric = /** @class */ (function (_super) {\r\n __extends(Metric, _super);\r\n /**\r\n * Constructs a new instance of the MetricTelemetry object\r\n */\r\n function Metric(logger, name, value, count, min, max, properties, measurements) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: FieldType.Required,\r\n metrics: FieldType.Required,\r\n properties: FieldType.Default\r\n };\r\n var dataPoint = new DataPoint();\r\n dataPoint.count = count > 0 ? count : undefined;\r\n dataPoint.max = isNaN(max) || max === null ? undefined : max;\r\n dataPoint.min = isNaN(min) || min === null ? undefined : min;\r\n dataPoint.name = DataSanitizer.sanitizeString(logger, name) || Util.NotSpecified;\r\n dataPoint.value = value;\r\n _this.metrics = [dataPoint];\r\n _this.properties = DataSanitizer.sanitizeProperties(logger, properties);\r\n _this.measurements = DataSanitizer.sanitizeMeasurements(logger, measurements);\r\n return _this;\r\n }\r\n Metric.envelopeType = \"Microsoft.ApplicationInsights.{0}.Metric\";\r\n Metric.dataType = \"MetricData\";\r\n return Metric;\r\n}(MetricData));\r\nexport { Metric };\r\n//# sourceMappingURL=Metric.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { EventData } from './EventData';\r\n/**\r\n * An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView.\r\n */\r\nvar PageViewData = /** @class */ (function (_super) {\r\n __extends(PageViewData, _super);\r\n function PageViewData() {\r\n var _this = _super.call(this) || this;\r\n _this.ver = 2;\r\n _this.properties = {};\r\n _this.measurements = {};\r\n return _this;\r\n }\r\n return PageViewData;\r\n}(EventData));\r\nexport { PageViewData };\r\n//# sourceMappingURL=PageViewData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { PageViewData } from '../Interfaces/Contracts/Generated/PageViewData';\r\nimport { DataSanitizer } from './Common/DataSanitizer';\r\nimport { FieldType } from '../Enums';\r\nimport { Util } from '../Util';\r\nvar PageView = /** @class */ (function (_super) {\r\n __extends(PageView, _super);\r\n /**\r\n * Constructs a new instance of the PageEventTelemetry object\r\n */\r\n function PageView(logger, name, url, durationMs, properties, measurements, id) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: FieldType.Required,\r\n name: FieldType.Default,\r\n url: FieldType.Default,\r\n duration: FieldType.Default,\r\n properties: FieldType.Default,\r\n measurements: FieldType.Default,\r\n id: FieldType.Default\r\n };\r\n _this.id = DataSanitizer.sanitizeId(logger, id);\r\n _this.url = DataSanitizer.sanitizeUrl(logger, url);\r\n _this.name = DataSanitizer.sanitizeString(logger, name) || Util.NotSpecified;\r\n if (!isNaN(durationMs)) {\r\n _this.duration = Util.msToTimeSpan(durationMs);\r\n }\r\n _this.properties = DataSanitizer.sanitizeProperties(logger, properties);\r\n _this.measurements = DataSanitizer.sanitizeMeasurements(logger, measurements);\r\n return _this;\r\n }\r\n PageView.envelopeType = \"Microsoft.ApplicationInsights.{0}.Pageview\";\r\n PageView.dataType = \"PageviewData\";\r\n return PageView;\r\n}(PageViewData));\r\nexport { PageView };\r\n//# sourceMappingURL=PageView.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { Domain } from './Domain';\r\n/**\r\n * An instance of Remote Dependency represents an interaction of the monitored component with a remote component/service like SQL or an HTTP endpoint.\r\n */\r\nvar RemoteDependencyData = /** @class */ (function (_super) {\r\n __extends(RemoteDependencyData, _super);\r\n function RemoteDependencyData() {\r\n var _this = _super.call(this) || this;\r\n _this.ver = 2;\r\n _this.success = true;\r\n _this.properties = {};\r\n _this.measurements = {};\r\n return _this;\r\n }\r\n return RemoteDependencyData;\r\n}(Domain));\r\nexport { RemoteDependencyData };\r\n//# sourceMappingURL=RemoteDependencyData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { DataSanitizer } from './Common/DataSanitizer';\r\nimport { FieldType } from '../Enums';\r\nimport { Util, AjaxHelper } from '../Util';\r\nimport { RemoteDependencyData as GeneratedRemoteDependencyData } from '../Interfaces/Contracts/Generated/RemoteDependencyData';\r\nvar RemoteDependencyData = /** @class */ (function (_super) {\r\n __extends(RemoteDependencyData, _super);\r\n /**\r\n * Constructs a new instance of the RemoteDependencyData object\r\n */\r\n function RemoteDependencyData(logger, id, absoluteUrl, commandName, value, success, resultCode, method, requestAPI, correlationContext, properties, measurements) {\r\n if (requestAPI === void 0) { requestAPI = \"Ajax\"; }\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n id: FieldType.Required,\r\n ver: FieldType.Required,\r\n name: FieldType.Default,\r\n resultCode: FieldType.Default,\r\n duration: FieldType.Default,\r\n success: FieldType.Default,\r\n data: FieldType.Default,\r\n target: FieldType.Default,\r\n type: FieldType.Default,\r\n properties: FieldType.Default,\r\n measurements: FieldType.Default,\r\n kind: FieldType.Default,\r\n value: FieldType.Default,\r\n count: FieldType.Default,\r\n min: FieldType.Default,\r\n max: FieldType.Default,\r\n stdDev: FieldType.Default,\r\n dependencyKind: FieldType.Default,\r\n dependencySource: FieldType.Default,\r\n commandName: FieldType.Default,\r\n dependencyTypeName: FieldType.Default\r\n };\r\n _this.id = id;\r\n _this.duration = Util.msToTimeSpan(value);\r\n _this.success = success;\r\n _this.resultCode = resultCode + \"\";\r\n _this.type = DataSanitizer.sanitizeString(logger, requestAPI);\r\n var dependencyFields = AjaxHelper.ParseDependencyPath(logger, absoluteUrl, method, commandName);\r\n _this.data = DataSanitizer.sanitizeUrl(logger, commandName) || dependencyFields.data; // get a value from hosturl if commandName not available\r\n _this.target = DataSanitizer.sanitizeString(logger, dependencyFields.target);\r\n if (correlationContext) {\r\n _this.target = _this.target + \" | \" + correlationContext;\r\n }\r\n _this.name = DataSanitizer.sanitizeString(logger, dependencyFields.name);\r\n _this.properties = DataSanitizer.sanitizeProperties(logger, properties);\r\n _this.measurements = DataSanitizer.sanitizeMeasurements(logger, measurements);\r\n return _this;\r\n }\r\n RemoteDependencyData.envelopeType = \"Microsoft.ApplicationInsights.{0}.RemoteDependency\";\r\n RemoteDependencyData.dataType = \"RemoteDependencyData\";\r\n return RemoteDependencyData;\r\n}(GeneratedRemoteDependencyData));\r\nexport { RemoteDependencyData };\r\n//# sourceMappingURL=RemoteDependencyData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { Domain } from './Domain';\r\n/**\r\n * Instances of Message represent printf-like trace statements that are text-searched. Log4Net, NLog and other text-based log file entries are translated into intances of this type. The message does not have measurements.\r\n */\r\nvar MessageData = /** @class */ (function (_super) {\r\n __extends(MessageData, _super);\r\n function MessageData() {\r\n var _this = _super.call(this) || this;\r\n _this.ver = 2;\r\n _this.properties = {};\r\n _this.measurements = {};\r\n return _this;\r\n }\r\n return MessageData;\r\n}(Domain));\r\nexport { MessageData };\r\n//# sourceMappingURL=MessageData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { MessageData } from '../Interfaces/Contracts/Generated/MessageData';\r\nimport { DataSanitizer } from './Common/DataSanitizer';\r\nimport { FieldType } from '../Enums';\r\nimport { Util } from '../Util';\r\nvar Trace = /** @class */ (function (_super) {\r\n __extends(Trace, _super);\r\n /**\r\n * Constructs a new instance of the TraceTelemetry object\r\n */\r\n function Trace(logger, message, severityLevel, properties, measurements) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: FieldType.Required,\r\n message: FieldType.Required,\r\n severityLevel: FieldType.Default,\r\n properties: FieldType.Default\r\n };\r\n message = message || Util.NotSpecified;\r\n _this.message = DataSanitizer.sanitizeMessage(logger, message);\r\n _this.properties = DataSanitizer.sanitizeProperties(logger, properties);\r\n _this.measurements = DataSanitizer.sanitizeMeasurements(logger, measurements);\r\n if (severityLevel) {\r\n _this.severityLevel = severityLevel;\r\n }\r\n return _this;\r\n }\r\n Trace.envelopeType = \"Microsoft.ApplicationInsights.{0}.Message\";\r\n Trace.dataType = \"MessageData\";\r\n return Trace;\r\n}(MessageData));\r\nexport { Trace };\r\n//# sourceMappingURL=Trace.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\nimport { PageViewData } from './PageViewData';\r\n/**\r\n * An instance of PageViewPerf represents: a page view with no performance data, a page view with performance data, or just the performance data of an earlier page request.\r\n */\r\nvar PageViewPerfData = /** @class */ (function (_super) {\r\n __extends(PageViewPerfData, _super);\r\n function PageViewPerfData() {\r\n var _this = _super.call(this) || this;\r\n _this.ver = 2;\r\n _this.properties = {};\r\n _this.measurements = {};\r\n return _this;\r\n }\r\n return PageViewPerfData;\r\n}(PageViewData));\r\nexport { PageViewPerfData };\r\n//# sourceMappingURL=PageViewPerfData.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { PageViewPerfData } from '../Interfaces/Contracts/Generated/PageViewPerfData';\r\nimport { FieldType } from '../Enums';\r\nimport { DataSanitizer } from './Common/DataSanitizer';\r\nimport { Util } from '../Util';\r\nvar PageViewPerformance = /** @class */ (function (_super) {\r\n __extends(PageViewPerformance, _super);\r\n /**\r\n * Constructs a new instance of the PageEventTelemetry object\r\n */\r\n function PageViewPerformance(logger, name, url, unused, properties, measurements, cs4BaseData) {\r\n var _this = _super.call(this) || this;\r\n _this.aiDataContract = {\r\n ver: FieldType.Required,\r\n name: FieldType.Default,\r\n url: FieldType.Default,\r\n duration: FieldType.Default,\r\n perfTotal: FieldType.Default,\r\n networkConnect: FieldType.Default,\r\n sentRequest: FieldType.Default,\r\n receivedResponse: FieldType.Default,\r\n domProcessing: FieldType.Default,\r\n properties: FieldType.Default,\r\n measurements: FieldType.Default\r\n };\r\n _this.url = DataSanitizer.sanitizeUrl(logger, url);\r\n _this.name = DataSanitizer.sanitizeString(logger, name) || Util.NotSpecified;\r\n _this.properties = DataSanitizer.sanitizeProperties(logger, properties);\r\n _this.measurements = DataSanitizer.sanitizeMeasurements(logger, measurements);\r\n if (cs4BaseData) {\r\n _this.domProcessing = cs4BaseData.domProcessing;\r\n _this.duration = cs4BaseData.duration;\r\n _this.networkConnect = cs4BaseData.networkConnect;\r\n _this.perfTotal = cs4BaseData.perfTotal;\r\n _this.receivedResponse = cs4BaseData.receivedResponse;\r\n _this.sentRequest = cs4BaseData.sentRequest;\r\n }\r\n return _this;\r\n }\r\n PageViewPerformance.envelopeType = \"Microsoft.ApplicationInsights.{0}.PageviewPerformance\";\r\n PageViewPerformance.dataType = \"PageviewPerformanceData\";\r\n return PageViewPerformance;\r\n}(PageViewPerfData));\r\nexport { PageViewPerformance };\r\n//# sourceMappingURL=PageViewPerformance.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Data as AIData } from '../../Interfaces/Contracts/Generated/Data';\r\nimport { FieldType } from '../../Enums';\r\nvar Data = /** @class */ (function (_super) {\r\n __extends(Data, _super);\r\n /**\r\n * Constructs a new instance of telemetry data.\r\n */\r\n function Data(baseType, data) {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * The data contract for serializing this object.\r\n */\r\n _this.aiDataContract = {\r\n baseType: FieldType.Required,\r\n baseData: FieldType.Required\r\n };\r\n _this.baseType = baseType;\r\n _this.baseData = data;\r\n return _this;\r\n }\r\n return Data;\r\n}(AIData));\r\nexport { Data };\r\n//# sourceMappingURL=Data.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\n/**\r\n * Defines the level of severity for the event.\r\n */\r\nexport var SeverityLevel;\r\n(function (SeverityLevel) {\r\n SeverityLevel[SeverityLevel[\"Verbose\"] = 0] = \"Verbose\";\r\n SeverityLevel[SeverityLevel[\"Information\"] = 1] = \"Information\";\r\n SeverityLevel[SeverityLevel[\"Warning\"] = 2] = \"Warning\";\r\n SeverityLevel[SeverityLevel[\"Error\"] = 3] = \"Error\";\r\n SeverityLevel[SeverityLevel[\"Critical\"] = 4] = \"Critical\";\r\n})(SeverityLevel || (SeverityLevel = {}));\r\n//# sourceMappingURL=SeverityLevel.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nvar ConfigurationManager = /** @class */ (function () {\r\n function ConfigurationManager() {\r\n }\r\n ConfigurationManager.getConfig = function (config, field, identifier, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n var configValue;\r\n if (identifier && config.extensionConfig && config.extensionConfig[identifier] && !CoreUtils.isNullOrUndefined(config.extensionConfig[identifier][field])) {\r\n configValue = config.extensionConfig[identifier][field];\r\n }\r\n else {\r\n configValue = config[field];\r\n }\r\n return !CoreUtils.isNullOrUndefined(configValue) ? configValue : defaultValue;\r\n };\r\n return ConfigurationManager;\r\n}());\r\nexport { ConfigurationManager };\r\n//# sourceMappingURL=IConfig.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// THIS FILE WAS AUTOGENERATED\r\nvar ContextTagKeys = /** @class */ (function () {\r\n function ContextTagKeys() {\r\n this.applicationVersion = \"ai.application.ver\";\r\n this.applicationBuild = \"ai.application.build\";\r\n this.applicationTypeId = \"ai.application.typeId\";\r\n this.applicationId = \"ai.application.applicationId\";\r\n this.applicationLayer = \"ai.application.layer\";\r\n this.deviceId = \"ai.device.id\";\r\n this.deviceIp = \"ai.device.ip\";\r\n this.deviceLanguage = \"ai.device.language\";\r\n this.deviceLocale = \"ai.device.locale\";\r\n this.deviceModel = \"ai.device.model\";\r\n this.deviceFriendlyName = \"ai.device.friendlyName\";\r\n this.deviceNetwork = \"ai.device.network\";\r\n this.deviceNetworkName = \"ai.device.networkName\";\r\n this.deviceOEMName = \"ai.device.oemName\";\r\n this.deviceOS = \"ai.device.os\";\r\n this.deviceOSVersion = \"ai.device.osVersion\";\r\n this.deviceRoleInstance = \"ai.device.roleInstance\";\r\n this.deviceRoleName = \"ai.device.roleName\";\r\n this.deviceScreenResolution = \"ai.device.screenResolution\";\r\n this.deviceType = \"ai.device.type\";\r\n this.deviceMachineName = \"ai.device.machineName\";\r\n this.deviceVMName = \"ai.device.vmName\";\r\n this.deviceBrowser = \"ai.device.browser\";\r\n this.deviceBrowserVersion = \"ai.device.browserVersion\";\r\n this.locationIp = \"ai.location.ip\";\r\n this.locationCountry = \"ai.location.country\";\r\n this.locationProvince = \"ai.location.province\";\r\n this.locationCity = \"ai.location.city\";\r\n this.operationId = \"ai.operation.id\";\r\n this.operationName = \"ai.operation.name\";\r\n this.operationParentId = \"ai.operation.parentId\";\r\n this.operationRootId = \"ai.operation.rootId\";\r\n this.operationSyntheticSource = \"ai.operation.syntheticSource\";\r\n this.operationCorrelationVector = \"ai.operation.correlationVector\";\r\n this.sessionId = \"ai.session.id\";\r\n this.sessionIsFirst = \"ai.session.isFirst\";\r\n this.sessionIsNew = \"ai.session.isNew\";\r\n this.userAccountAcquisitionDate = \"ai.user.accountAcquisitionDate\";\r\n this.userAccountId = \"ai.user.accountId\";\r\n this.userAgent = \"ai.user.userAgent\";\r\n this.userId = \"ai.user.id\";\r\n this.userStoreRegion = \"ai.user.storeRegion\";\r\n this.userAuthUserId = \"ai.user.authUserId\";\r\n this.userAnonymousUserAcquisitionDate = \"ai.user.anonUserAcquisitionDate\";\r\n this.userAuthenticatedUserAcquisitionDate = \"ai.user.authUserAcquisitionDate\";\r\n this.cloudName = \"ai.cloud.name\";\r\n this.cloudRole = \"ai.cloud.role\";\r\n this.cloudRoleVer = \"ai.cloud.roleVer\";\r\n this.cloudRoleInstance = \"ai.cloud.roleInstance\";\r\n this.cloudEnvironment = \"ai.cloud.environment\";\r\n this.cloudLocation = \"ai.cloud.location\";\r\n this.cloudDeploymentUnit = \"ai.cloud.deploymentUnit\";\r\n this.internalNodeName = \"ai.internal.nodeName\";\r\n this.internalSdkVersion = \"ai.internal.sdkVersion\";\r\n this.internalAgentVersion = \"ai.internal.agentVersion\";\r\n this.internalSnippet = \"ai.internal.snippet\";\r\n this.internalSdkSrc = \"ai.internal.sdkSrc\";\r\n }\r\n return ContextTagKeys;\r\n}());\r\nexport { ContextTagKeys };\r\n//# sourceMappingURL=ContextTagKeys.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Util } from \"./Util\";\r\nimport { DataSanitizer } from \"./Telemetry/Common/DataSanitizer\";\r\nimport { CoreUtils } from \"@microsoft/applicationinsights-core-js\";\r\nvar TelemetryItemCreator = /** @class */ (function () {\r\n function TelemetryItemCreator() {\r\n }\r\n /**\r\n * Create a telemetry item that the 1DS channel understands\r\n * @param item domain specific properties; part B\r\n * @param baseType telemetry item type. ie PageViewData\r\n * @param envelopeName name of the envelope. ie Microsoft.ApplicationInsights..PageView\r\n * @param customProperties user defined custom properties; part C\r\n * @param systemProperties system properties that are added to the context; part A\r\n * @returns ITelemetryItem that is sent to channel\r\n */\r\n TelemetryItemCreator.create = function (item, baseType, envelopeName, logger, customProperties, systemProperties) {\r\n envelopeName = DataSanitizer.sanitizeString(logger, envelopeName) || Util.NotSpecified;\r\n if (CoreUtils.isNullOrUndefined(item) ||\r\n CoreUtils.isNullOrUndefined(baseType) ||\r\n CoreUtils.isNullOrUndefined(envelopeName)) {\r\n throw Error(\"Input doesn't contain all required fields\");\r\n }\r\n var telemetryItem = {\r\n name: envelopeName,\r\n time: CoreUtils.toISOString(new Date()),\r\n iKey: \"\",\r\n ext: systemProperties ? systemProperties : {},\r\n tags: [],\r\n data: {},\r\n baseType: baseType,\r\n baseData: item // Part B\r\n };\r\n // Part C\r\n if (!CoreUtils.isNullOrUndefined(customProperties)) {\r\n for (var prop in customProperties) {\r\n if (customProperties.hasOwnProperty(prop)) {\r\n telemetryItem.data[prop] = customProperties[prop];\r\n }\r\n }\r\n }\r\n return telemetryItem;\r\n };\r\n return TelemetryItemCreator;\r\n}());\r\nexport { TelemetryItemCreator };\r\n//# sourceMappingURL=TelemetryItemCreator.js.map","import { ContextTagKeys } from \"./Contracts/Generated/ContextTagKeys\";\r\nvar Extensions = /** @class */ (function () {\r\n function Extensions() {\r\n }\r\n Extensions.UserExt = \"user\";\r\n Extensions.DeviceExt = \"device\";\r\n Extensions.TraceExt = \"trace\";\r\n Extensions.WebExt = \"web\";\r\n Extensions.AppExt = \"app\";\r\n Extensions.OSExt = \"os\";\r\n Extensions.SessionExt = \"ses\";\r\n Extensions.SDKExt = \"sdk\";\r\n return Extensions;\r\n}());\r\nexport { Extensions };\r\nexport var CtxTagKeys = new ContextTagKeys();\r\n//# sourceMappingURL=PartAExtensions.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport '@microsoft/applicationinsights-shims';\r\nexport { Util, CorrelationIdHelper, UrlHelper, DateTimeUtils } from './Util';\r\nexport { ConnectionStringParser } from './ConnectionStringParser';\r\nexport { FieldType } from './Enums';\r\nexport { RequestHeaders } from './RequestResponseHeaders';\r\nexport { DisabledPropertyName, ProcessLegacy, SampleRate, HttpMethod, DEFAULT_BREEZE_ENDPOINT } from './Constants';\r\nexport { Data as AIData } from './Interfaces/Contracts/Generated/Data';\r\nexport { Base as AIBase } from './Interfaces/Contracts/Generated/Base';\r\nexport { Envelope } from './Telemetry/Common/Envelope';\r\nexport { Event } from './Telemetry/Event';\r\nexport { Exception } from './Telemetry/Exception';\r\nexport { Metric } from './Telemetry/Metric';\r\nexport { PageView } from './Telemetry/PageView';\r\nexport { PageViewData } from './Interfaces/Contracts/Generated/PageViewData';\r\nexport { RemoteDependencyData } from './Telemetry/RemoteDependencyData';\r\nexport { Trace } from './Telemetry/Trace';\r\nexport { PageViewPerformance } from './Telemetry/PageViewPerformance';\r\nexport { Data } from './Telemetry/Common/Data';\r\nexport { SeverityLevel } from './Interfaces/Contracts/Generated/SeverityLevel';\r\nexport { ConfigurationManager } from './Interfaces/IConfig';\r\nexport { ContextTagKeys } from './Interfaces/Contracts/Generated/ContextTagKeys';\r\nexport { DataSanitizer } from './Telemetry/Common/DataSanitizer';\r\nexport { TelemetryItemCreator } from './TelemetryItemCreator';\r\nexport { CtxTagKeys, Extensions } from './Interfaces/PartAExtensions';\r\nexport { DistributedTracingModes } from './Enums';\r\nexport var PropertiesPluginIdentifier = \"AppInsightsPropertiesPlugin\";\r\nexport var BreezeChannelIdentifier = \"AppInsightsChannelPlugin\";\r\nexport var AnalyticsPluginIdentifier = \"ApplicationInsightsAnalytics\";\r\n//# sourceMappingURL=applicationinsights-common.js.map","/*!\n * Application Insights JavaScript SDK - Web, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { Util, ProcessLegacy } from \"@microsoft/applicationinsights-common\";\r\n// ToDo: fix properties and measurements once updates are done to common\r\nvar AppInsightsDeprecated = /** @class */ (function () {\r\n function AppInsightsDeprecated(snippet, appInsightsNew) {\r\n this._hasLegacyInitializers = false;\r\n this._queue = [];\r\n this.config = AppInsightsDeprecated.getDefaultConfig(snippet.config);\r\n this.appInsightsNew = appInsightsNew;\r\n this.context = { addTelemetryInitializer: this.addTelemetryInitializers.bind(this) };\r\n }\r\n AppInsightsDeprecated.getDefaultConfig = function (config) {\r\n if (!config) {\r\n config = {};\r\n }\r\n // set default values\r\n config.endpointUrl = config.endpointUrl || \"https://dc.services.visualstudio.com/v2/track\";\r\n config.sessionRenewalMs = 30 * 60 * 1000;\r\n config.sessionExpirationMs = 24 * 60 * 60 * 1000;\r\n config.maxBatchSizeInBytes = config.maxBatchSizeInBytes > 0 ? config.maxBatchSizeInBytes : 102400; // 100kb\r\n config.maxBatchInterval = !isNaN(config.maxBatchInterval) ? config.maxBatchInterval : 15000;\r\n config.enableDebug = Util.stringToBoolOrDefault(config.enableDebug);\r\n config.disableExceptionTracking = Util.stringToBoolOrDefault(config.disableExceptionTracking);\r\n config.disableTelemetry = Util.stringToBoolOrDefault(config.disableTelemetry);\r\n config.verboseLogging = Util.stringToBoolOrDefault(config.verboseLogging);\r\n config.emitLineDelimitedJson = Util.stringToBoolOrDefault(config.emitLineDelimitedJson);\r\n config.diagnosticLogInterval = config.diagnosticLogInterval || 10000;\r\n config.autoTrackPageVisitTime = Util.stringToBoolOrDefault(config.autoTrackPageVisitTime);\r\n if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {\r\n config.samplingPercentage = 100;\r\n }\r\n config.disableAjaxTracking = Util.stringToBoolOrDefault(config.disableAjaxTracking);\r\n config.maxAjaxCallsPerView = !isNaN(config.maxAjaxCallsPerView) ? config.maxAjaxCallsPerView : 500;\r\n config.isBeaconApiDisabled = Util.stringToBoolOrDefault(config.isBeaconApiDisabled, true);\r\n config.disableCorrelationHeaders = Util.stringToBoolOrDefault(config.disableCorrelationHeaders);\r\n config.correlationHeaderExcludedDomains = config.correlationHeaderExcludedDomains || [\r\n \"*.blob.core.windows.net\",\r\n \"*.blob.core.chinacloudapi.cn\",\r\n \"*.blob.core.cloudapi.de\",\r\n \"*.blob.core.usgovcloudapi.net\"\r\n ];\r\n config.disableFlushOnBeforeUnload = Util.stringToBoolOrDefault(config.disableFlushOnBeforeUnload);\r\n config.disableFlushOnUnload = Util.stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);\r\n config.enableSessionStorageBuffer = Util.stringToBoolOrDefault(config.enableSessionStorageBuffer, true);\r\n config.isRetryDisabled = Util.stringToBoolOrDefault(config.isRetryDisabled);\r\n config.isCookieUseDisabled = Util.stringToBoolOrDefault(config.isCookieUseDisabled);\r\n config.isStorageUseDisabled = Util.stringToBoolOrDefault(config.isStorageUseDisabled);\r\n config.isBrowserLinkTrackingEnabled = Util.stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);\r\n config.enableCorsCorrelation = Util.stringToBoolOrDefault(config.enableCorsCorrelation);\r\n return config;\r\n };\r\n /**\r\n * The array of telemetry initializers to call before sending each telemetry item.\r\n */\r\n AppInsightsDeprecated.prototype.addTelemetryInitializers = function (callBack) {\r\n var _this = this;\r\n // Add initializer to current processing only if there is any old telemetry initializer\r\n if (!this._hasLegacyInitializers) {\r\n this.appInsightsNew.addTelemetryInitializer(function (item) {\r\n _this._processLegacyInitializers(item); // setup call back for each legacy processor\r\n });\r\n this._hasLegacyInitializers = true;\r\n }\r\n this._queue.push(callBack);\r\n };\r\n AppInsightsDeprecated.prototype.startTrackPage = function (name) {\r\n this.appInsightsNew.startTrackPage(name);\r\n };\r\n AppInsightsDeprecated.prototype.stopTrackPage = function (name, url, properties, measurements) {\r\n this.appInsightsNew.stopTrackPage(name, url, properties); // update\r\n };\r\n AppInsightsDeprecated.prototype.trackPageView = function (name, url, properties, measurements, duration) {\r\n var telemetry = {\r\n name: name,\r\n uri: url,\r\n properties: properties,\r\n measurements: measurements\r\n };\r\n // fix for props, measurements, duration\r\n this.appInsightsNew.trackPageView(telemetry);\r\n };\r\n AppInsightsDeprecated.prototype.trackEvent = function (name, properties, measurements) {\r\n this.appInsightsNew.trackEvent({ name: name });\r\n };\r\n AppInsightsDeprecated.prototype.trackDependency = function (id, method, absoluteUrl, pathName, totalTime, success, resultCode) {\r\n this.appInsightsNew.trackDependencyData({\r\n id: id,\r\n target: absoluteUrl,\r\n type: pathName,\r\n duration: totalTime,\r\n properties: { HttpMethod: method },\r\n success: success,\r\n responseCode: resultCode\r\n });\r\n };\r\n AppInsightsDeprecated.prototype.trackException = function (exception, handledAt, properties, measurements, severityLevel) {\r\n this.appInsightsNew.trackException({\r\n exception: exception\r\n });\r\n };\r\n AppInsightsDeprecated.prototype.trackMetric = function (name, average, sampleCount, min, max, properties) {\r\n this.appInsightsNew.trackMetric({ name: name, average: average, sampleCount: sampleCount, min: min, max: max });\r\n };\r\n AppInsightsDeprecated.prototype.trackTrace = function (message, properties, severityLevel) {\r\n this.appInsightsNew.trackTrace({ message: message, severityLevel: severityLevel });\r\n };\r\n AppInsightsDeprecated.prototype.flush = function (async) {\r\n this.appInsightsNew.flush(async);\r\n };\r\n AppInsightsDeprecated.prototype.setAuthenticatedUserContext = function (authenticatedUserId, accountId, storeInCookie) {\r\n this.appInsightsNew.context.user.setAuthenticatedUserContext(authenticatedUserId, accountId, storeInCookie);\r\n };\r\n AppInsightsDeprecated.prototype.clearAuthenticatedUserContext = function () {\r\n this.appInsightsNew.context.user.clearAuthenticatedUserContext();\r\n };\r\n AppInsightsDeprecated.prototype._onerror = function (message, url, lineNumber, columnNumber, error) {\r\n this.appInsightsNew._onerror({ message: message, url: url, lineNumber: lineNumber, columnNumber: columnNumber, error: error });\r\n };\r\n AppInsightsDeprecated.prototype.startTrackEvent = function (name) {\r\n this.appInsightsNew.startTrackEvent(name);\r\n };\r\n AppInsightsDeprecated.prototype.stopTrackEvent = function (name, properties, measurements) {\r\n this.appInsightsNew.stopTrackEvent(name, properties, measurements);\r\n };\r\n AppInsightsDeprecated.prototype.downloadAndSetup = function (config) {\r\n throw new Error(\"downloadAndSetup not implemented in web SKU\");\r\n };\r\n AppInsightsDeprecated.prototype.updateSnippetDefinitions = function (snippet) {\r\n // apply full appInsights to the global instance\r\n // Note: This must be called before loadAppInsights is called\r\n for (var field in this) {\r\n if (typeof field === 'string') {\r\n snippet[field] = this[field];\r\n }\r\n }\r\n };\r\n // note: these are split into methods to enable unit tests\r\n AppInsightsDeprecated.prototype.loadAppInsights = function () {\r\n // initialize global instance of appInsights\r\n // var appInsights = new Microsoft.ApplicationInsights.AppInsights(this.config);\r\n var _this = this;\r\n // implement legacy version of trackPageView for 0.10<\r\n if (this.config[\"iKey\"]) {\r\n var originalTrackPageView_1 = this.trackPageView;\r\n this.trackPageView = function (pagePath, properties, measurements) {\r\n originalTrackPageView_1.apply(_this, [null, pagePath, properties, measurements]);\r\n };\r\n }\r\n // implement legacy pageView interface if it is present in the snippet\r\n var legacyPageView = \"logPageView\";\r\n if (typeof this.snippet[legacyPageView] === \"function\") {\r\n this[legacyPageView] = function (pagePath, properties, measurements) {\r\n _this.trackPageView(null, pagePath, properties, measurements);\r\n };\r\n }\r\n // implement legacy event interface if it is present in the snippet\r\n var legacyEvent = \"logEvent\";\r\n if (typeof this.snippet[legacyEvent] === \"function\") {\r\n this[legacyEvent] = function (name, props, measurements) {\r\n _this.trackEvent(name, props, measurements);\r\n };\r\n }\r\n return this;\r\n };\r\n AppInsightsDeprecated.prototype._processLegacyInitializers = function (item) {\r\n // instead of mapping new to legacy and then back again and repeating in channel, attach callback for channel to call\r\n item.tags[ProcessLegacy] = this._queue;\r\n return item;\r\n };\r\n return AppInsightsDeprecated;\r\n}());\r\nexport { AppInsightsDeprecated };\r\n//# sourceMappingURL=ApplicationInsightsDeprecated.js.map","/*!\n * Application Insights JavaScript SDK - Web Analytics, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { DateTimeUtils, Util } from '@microsoft/applicationinsights-common';\r\nimport { CoreUtils, LoggingSeverity, _InternalMessageId, getDocument, getLocation } from '@microsoft/applicationinsights-core-js';\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\n/**\r\n * Class encapsulates sending page views and page view performance telemetry.\r\n */\r\nvar PageViewManager = /** @class */ (function () {\r\n function PageViewManager(appInsights, overridePageViewDuration, core, pageViewPerformanceManager) {\r\n dynamicProto(PageViewManager, this, function (_self) {\r\n var arrForEach = CoreUtils.arrForEach;\r\n var isNullOrUndefined = CoreUtils.isNullOrUndefined;\r\n var intervalHandle = null;\r\n var itemQueue = [];\r\n var pageViewPerformanceSent = false;\r\n var _logger;\r\n if (core) {\r\n _logger = core.logger;\r\n }\r\n function _flushChannels() {\r\n if (core) {\r\n arrForEach(core.getTransmissionControls(), function (queues) {\r\n arrForEach(queues, function (q) { return q.flush(true); });\r\n });\r\n }\r\n }\r\n function _addQueue(cb) {\r\n itemQueue.push(cb);\r\n if (!intervalHandle) {\r\n intervalHandle = setInterval((function () {\r\n var allItems = itemQueue.slice(0);\r\n var doFlush = false;\r\n itemQueue = [];\r\n arrForEach(allItems, function (item) {\r\n if (!item()) {\r\n // Not processed so rescheduled\r\n itemQueue.push(item);\r\n }\r\n else {\r\n doFlush = true;\r\n }\r\n });\r\n if (itemQueue.length === 0) {\r\n clearInterval(intervalHandle);\r\n intervalHandle = null;\r\n }\r\n if (doFlush) {\r\n // We process at least one item so flush the queue\r\n _flushChannels();\r\n }\r\n }), 100);\r\n }\r\n }\r\n _self.trackPageView = function (pageView, customProperties) {\r\n var name = pageView.name;\r\n if (isNullOrUndefined(name) || typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = pageView.name = doc && doc.title || \"\";\r\n }\r\n var uri = pageView.uri;\r\n if (isNullOrUndefined(uri) || typeof uri !== \"string\") {\r\n var location_1 = getLocation();\r\n uri = pageView.uri = location_1 && location_1.href || \"\";\r\n }\r\n // case 1a. if performance timing is not supported by the browser, send the page view telemetry with the duration provided by the user. If the user\r\n // do not provide the duration, set duration to undefined\r\n // Also this is case 4\r\n if (!pageViewPerformanceManager.isPerformanceTimingSupported()) {\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n _flushChannels();\r\n // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)\r\n _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NavigationTimingNotSupported, \"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.\");\r\n return;\r\n }\r\n var pageViewSent = false;\r\n var customDuration;\r\n // if the performance timing is supported by the browser, calculate the custom duration\r\n var start = pageViewPerformanceManager.getPerformanceTiming().navigationStart;\r\n if (start > 0) {\r\n customDuration = DateTimeUtils.GetDuration(start, +new Date);\r\n if (!pageViewPerformanceManager.shouldCollectDuration(customDuration)) {\r\n customDuration = undefined;\r\n }\r\n }\r\n // if the user has provided duration, send a page view telemetry with the provided duration. Otherwise, if\r\n // overridePageViewDuration is set to true, send a page view telemetry with the custom duration calculated earlier\r\n var duration;\r\n if (!isNullOrUndefined(customProperties) &&\r\n !isNullOrUndefined(customProperties.duration)) {\r\n duration = customProperties.duration;\r\n }\r\n if (overridePageViewDuration || !isNaN(duration)) {\r\n if (isNaN(duration)) {\r\n // case 3\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n customProperties[\"duration\"] = customDuration;\r\n }\r\n // case 2\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n _flushChannels();\r\n pageViewSent = true;\r\n }\r\n // now try to send the page view performance telemetry\r\n var maxDurationLimit = 60000;\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n // Queue the event for processing\r\n _addQueue(function () {\r\n var processed = false;\r\n try {\r\n if (pageViewPerformanceManager.isPerformanceTimingDataReady()) {\r\n processed = true;\r\n var pageViewPerformance = {\r\n name: name,\r\n uri: uri\r\n };\r\n pageViewPerformanceManager.populatePageViewPerformanceEvent(pageViewPerformance);\r\n if (!pageViewPerformance.isValid && !pageViewSent) {\r\n // If navigation timing gives invalid numbers, then go back to \"override page view duration\" mode.\r\n // That's the best value we can get that makes sense.\r\n customProperties[\"duration\"] = customDuration;\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n }\r\n else {\r\n if (!pageViewSent) {\r\n customProperties[\"duration\"] = pageViewPerformance.durationMs;\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n }\r\n if (!pageViewPerformanceSent) {\r\n appInsights.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);\r\n pageViewPerformanceSent = true;\r\n }\r\n }\r\n }\r\n else if (start > 0 && DateTimeUtils.GetDuration(start, +new Date) > maxDurationLimit) {\r\n // if performance timings are not ready but we exceeded the maximum duration limit, just log a page view telemetry\r\n // with the maximum duration limit. Otherwise, keep waiting until performance timings are ready\r\n processed = true;\r\n if (!pageViewSent) {\r\n customProperties[\"duration\"] = maxDurationLimit;\r\n appInsights.sendPageViewInternal(pageView, customProperties);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailedCalc, \"trackPageView failed on page load calculation: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n return processed;\r\n });\r\n };\r\n });\r\n }\r\n// Removed Stub for PageViewManager.prototype.trackPageView.\r\n return PageViewManager;\r\n}());\r\nexport { PageViewManager };\r\n//# sourceMappingURL=PageViewManager.js.map","/*!\n * Application Insights JavaScript SDK - Web Analytics, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { Util } from '@microsoft/applicationinsights-common';\r\nimport { hasJSON, getJSON, CoreUtils } from '@microsoft/applicationinsights-core-js';\r\n/**\r\n * Used to track page visit durations\r\n */\r\nvar PageVisitTimeManager = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of PageVisitTimeManager\r\n * @param pageVisitTimeTrackingHandler Delegate that will be called to send telemetry data to AI (when trackPreviousPageVisit is called)\r\n * @returns {}\r\n */\r\n function PageVisitTimeManager(logger, pageVisitTimeTrackingHandler) {\r\n this.prevPageVisitDataKeyName = \"prevPageVisitData\";\r\n this.pageVisitTimeTrackingHandler = pageVisitTimeTrackingHandler;\r\n this._logger = logger;\r\n }\r\n /**\r\n * Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time\r\n * @param currentPageName Name of page to begin timing for visit duration\r\n * @param currentPageUrl Url of page to begin timing for visit duration\r\n */\r\n PageVisitTimeManager.prototype.trackPreviousPageVisit = function (currentPageName, currentPageUrl) {\r\n try {\r\n // Restart timer for new page view\r\n var prevPageVisitTimeData = this.restartPageVisitTimer(currentPageName, currentPageUrl);\r\n // If there was a page already being timed, track the visit time for it now.\r\n if (prevPageVisitTimeData) {\r\n this.pageVisitTimeTrackingHandler(prevPageVisitTimeData.pageName, prevPageVisitTimeData.pageUrl, prevPageVisitTimeData.pageVisitTime);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.warnToConsole(\"Auto track page visit time failed, metric will not be collected: \" + Util.dump(e));\r\n }\r\n };\r\n /**\r\n * Stops timing of current page (if exists) and starts timing for duration of visit to pageName\r\n * @param pageName Name of page to begin timing visit duration\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from last call to start or restart, if exists. Null if not.\r\n */\r\n PageVisitTimeManager.prototype.restartPageVisitTimer = function (pageName, pageUrl) {\r\n try {\r\n var prevPageVisitData = this.stopPageVisitTimer();\r\n this.startPageVisitTimer(pageName, pageUrl);\r\n return prevPageVisitData;\r\n }\r\n catch (e) {\r\n this._logger.warnToConsole(\"Call to restart failed: \" + Util.dump(e));\r\n return null;\r\n }\r\n };\r\n /**\r\n * Starts timing visit duration of pageName\r\n * @param pageName\r\n * @returns {}\r\n */\r\n PageVisitTimeManager.prototype.startPageVisitTimer = function (pageName, pageUrl) {\r\n try {\r\n if (Util.canUseSessionStorage()) {\r\n if (Util.getSessionStorage(this._logger, this.prevPageVisitDataKeyName) != null) {\r\n throw new Error(\"Cannot call startPageVisit consecutively without first calling stopPageVisit\");\r\n }\r\n var currPageVisitData = new PageVisitData(pageName, pageUrl);\r\n var currPageVisitDataStr = getJSON().stringify(currPageVisitData);\r\n Util.setSessionStorage(this._logger, this.prevPageVisitDataKeyName, currPageVisitDataStr);\r\n }\r\n }\r\n catch (e) {\r\n // TODO: Remove this catch in next phase, since if start is called twice in a row the exception needs to be propagated out\r\n this._logger.warnToConsole(\"Call to start failed: \" + Util.dump(e));\r\n }\r\n };\r\n /**\r\n * Stops timing of current page, if exists.\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from call to start, if exists. Null if not.\r\n */\r\n PageVisitTimeManager.prototype.stopPageVisitTimer = function () {\r\n try {\r\n if (Util.canUseSessionStorage()) {\r\n // Define end time of page's visit\r\n var pageVisitEndTime = CoreUtils.dateNow();\r\n // Try to retrieve page name and start time from session storage\r\n var pageVisitDataJsonStr = Util.getSessionStorage(this._logger, this.prevPageVisitDataKeyName);\r\n if (pageVisitDataJsonStr && hasJSON()) {\r\n // if previous page data exists, set end time of visit\r\n var prevPageVisitData = getJSON().parse(pageVisitDataJsonStr);\r\n prevPageVisitData.pageVisitTime = pageVisitEndTime - prevPageVisitData.pageVisitStartTime;\r\n // Remove data from storage since we already used it\r\n Util.removeSessionStorage(this._logger, this.prevPageVisitDataKeyName);\r\n // Return page visit data\r\n return prevPageVisitData;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n return null;\r\n }\r\n catch (e) {\r\n this._logger.warnToConsole(\"Stop page visit timer failed: \" + Util.dump(e));\r\n return null;\r\n }\r\n };\r\n return PageVisitTimeManager;\r\n}());\r\nexport { PageVisitTimeManager };\r\nvar PageVisitData = /** @class */ (function () {\r\n function PageVisitData(pageName, pageUrl) {\r\n this.pageVisitStartTime = CoreUtils.dateNow();\r\n this.pageName = pageName;\r\n this.pageUrl = pageUrl;\r\n }\r\n return PageVisitData;\r\n}());\r\nexport { PageVisitData };\r\n//# sourceMappingURL=PageVisitTimeManager.js.map","/*!\n * Application Insights JavaScript SDK - Web Analytics, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { Util, DateTimeUtils } from '@microsoft/applicationinsights-common';\r\nimport { LoggingSeverity, _InternalMessageId, getNavigator, getPerformance } from '@microsoft/applicationinsights-core-js';\r\n/**\r\n * Class encapsulates sending page view performance telemetry.\r\n */\r\nvar PageViewPerformanceManager = /** @class */ (function () {\r\n function PageViewPerformanceManager(core) {\r\n this.MAX_DURATION_ALLOWED = 3600000; // 1h\r\n if (core) {\r\n this._logger = core.logger;\r\n }\r\n }\r\n PageViewPerformanceManager.prototype.populatePageViewPerformanceEvent = function (pageViewPerformance) {\r\n pageViewPerformance.isValid = false;\r\n /*\r\n * http://www.w3.org/TR/navigation-timing/#processing-model\r\n * |-navigationStart\r\n * | |-connectEnd\r\n * | ||-requestStart\r\n * | || |-responseStart\r\n * | || | |-responseEnd\r\n * | || | |\r\n * | || | | |-loadEventEnd\r\n * |---network---||---request---|---response---|---dom---|\r\n * |--------------------------total----------------------|\r\n */\r\n var navigationTiming = this.getPerformanceNavigationTiming();\r\n var timing = this.getPerformanceTiming();\r\n if (navigationTiming || timing) {\r\n if (navigationTiming) {\r\n var total = navigationTiming.duration;\r\n var network = DateTimeUtils.GetDuration(navigationTiming.startTime, navigationTiming.connectEnd);\r\n var request = DateTimeUtils.GetDuration(navigationTiming.requestStart, navigationTiming.responseStart);\r\n var response = DateTimeUtils.GetDuration(navigationTiming.responseStart, navigationTiming.responseEnd);\r\n var dom = DateTimeUtils.GetDuration(navigationTiming.responseEnd, navigationTiming.loadEventEnd);\r\n }\r\n else {\r\n var total = DateTimeUtils.GetDuration(timing.navigationStart, timing.loadEventEnd);\r\n var network = DateTimeUtils.GetDuration(timing.navigationStart, timing.connectEnd);\r\n var request = DateTimeUtils.GetDuration(timing.requestStart, timing.responseStart);\r\n var response = DateTimeUtils.GetDuration(timing.responseStart, timing.responseEnd);\r\n var dom = DateTimeUtils.GetDuration(timing.responseEnd, timing.loadEventEnd);\r\n }\r\n if (total === 0) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ErrorPVCalc, \"error calculating page view performance.\", { total: total, network: network, request: request, response: response, dom: dom });\r\n }\r\n else if (!this.shouldCollectDuration(total, network, request, response, dom)) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.InvalidDurationValue, \"Invalid page load duration value. Browser perf data won't be sent.\", { total: total, network: network, request: request, response: response, dom: dom });\r\n }\r\n else if (total < Math.floor(network) + Math.floor(request) + Math.floor(response) + Math.floor(dom)) {\r\n // some browsers may report individual components incorrectly so that the sum of the parts will be bigger than total PLT\r\n // in this case, don't report client performance from this page\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ClientPerformanceMathError, \"client performance math error.\", { total: total, network: network, request: request, response: response, dom: dom });\r\n }\r\n else {\r\n pageViewPerformance.durationMs = total;\r\n // // convert to timespans\r\n pageViewPerformance.perfTotal = pageViewPerformance.duration = Util.msToTimeSpan(total);\r\n pageViewPerformance.networkConnect = Util.msToTimeSpan(network);\r\n pageViewPerformance.sentRequest = Util.msToTimeSpan(request);\r\n pageViewPerformance.receivedResponse = Util.msToTimeSpan(response);\r\n pageViewPerformance.domProcessing = Util.msToTimeSpan(dom);\r\n pageViewPerformance.isValid = true;\r\n }\r\n }\r\n };\r\n PageViewPerformanceManager.prototype.getPerformanceTiming = function () {\r\n if (this.isPerformanceTimingSupported()) {\r\n return getPerformance().timing;\r\n }\r\n return null;\r\n };\r\n PageViewPerformanceManager.prototype.getPerformanceNavigationTiming = function () {\r\n if (this.isPerformanceNavigationTimingSupported()) {\r\n return getPerformance().getEntriesByType(\"navigation\")[0];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Returns true is window PerformanceNavigationTiming API is supported, false otherwise.\r\n */\r\n PageViewPerformanceManager.prototype.isPerformanceNavigationTimingSupported = function () {\r\n var perf = getPerformance();\r\n return perf && perf.getEntriesByType && perf.getEntriesByType(\"navigation\").length > 0;\r\n };\r\n /**\r\n * Returns true is window performance timing API is supported, false otherwise.\r\n */\r\n PageViewPerformanceManager.prototype.isPerformanceTimingSupported = function () {\r\n var perf = getPerformance();\r\n return perf && perf.timing;\r\n };\r\n /**\r\n * As page loads different parts of performance timing numbers get set. When all of them are set we can report it.\r\n * Returns true if ready, false otherwise.\r\n */\r\n PageViewPerformanceManager.prototype.isPerformanceTimingDataReady = function () {\r\n var perf = getPerformance();\r\n var timing = perf ? perf.timing : 0;\r\n return timing\r\n && timing.domainLookupStart > 0\r\n && timing.navigationStart > 0\r\n && timing.responseStart > 0\r\n && timing.requestStart > 0\r\n && timing.loadEventEnd > 0\r\n && timing.responseEnd > 0\r\n && timing.connectEnd > 0\r\n && timing.domLoading > 0;\r\n };\r\n /**\r\n * This method tells if given durations should be excluded from collection.\r\n */\r\n PageViewPerformanceManager.prototype.shouldCollectDuration = function () {\r\n var durations = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n durations[_i] = arguments[_i];\r\n }\r\n var _navigator = getNavigator() || {};\r\n // a full list of Google crawlers user agent strings - https://support.google.com/webmasters/answer/1061943?hl=en\r\n var botAgentNames = ['googlebot', 'adsbot-google', 'apis-google', 'mediapartners-google'];\r\n var userAgent = _navigator.userAgent;\r\n var isGoogleBot = false;\r\n if (userAgent) {\r\n for (var i = 0; i < botAgentNames.length; i++) {\r\n isGoogleBot = isGoogleBot || userAgent.toLowerCase().indexOf(botAgentNames[i]) !== -1;\r\n }\r\n }\r\n if (isGoogleBot) {\r\n // Don't report durations for GoogleBot, it is returning invalid values in performance.timing API.\r\n return false;\r\n }\r\n else {\r\n // for other page views, don't report if it's outside of a reasonable range\r\n for (var i = 0; i < durations.length; i++) {\r\n if (durations[i] < 0 || durations[i] >= this.MAX_DURATION_ALLOWED) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n return PageViewPerformanceManager;\r\n}());\r\nexport { PageViewPerformanceManager };\r\n//# sourceMappingURL=PageViewPerformanceManager.js.map","/*!\n * Application Insights JavaScript SDK - Web Analytics, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n/**\r\n * ApplicationInsights.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport { Util, PageViewPerformance, PageView, RemoteDependencyData, Event as EventTelemetry, TelemetryItemCreator, Metric, Exception, SeverityLevel, Trace, DateTimeUtils, PropertiesPluginIdentifier, AnalyticsPluginIdentifier } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, CoreUtils, LoggingSeverity, _InternalMessageId, getWindow, getDocument, getHistory, getLocation, doPerf } from \"@microsoft/applicationinsights-core-js\";\r\nimport { PageViewManager } from \"./Telemetry/PageViewManager\";\r\nimport { PageVisitTimeManager } from \"./Telemetry/PageVisitTimeManager\";\r\nimport { PageViewPerformanceManager } from './Telemetry/PageViewPerformanceManager';\r\n\"use strict\";\r\nvar durationProperty = \"duration\";\r\nfunction _dispatchEvent(target, evnt) {\r\n if (target && target.dispatchEvent && evnt) {\r\n target.dispatchEvent(evnt);\r\n }\r\n}\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 _this.identifier = AnalyticsPluginIdentifier; // do not change name or priority\r\n _this.priority = 180; // take from reserved priority range 100- 200\r\n _this.autoRoutePVDelay = 500; // ms; Time to wait after a route change before triggering a pageview to allow DOM changes to take place\r\n // Counts number of trackAjax invokations.\r\n // By default we only monitor X ajax call per view to avoid too much load.\r\n // Default value is set in config.\r\n // This counter keeps increasing even after the limit is reached.\r\n _this._trackAjaxAttempts = 0;\r\n var location = getLocation();\r\n _this._prevUri = location && location.href || \"\";\r\n return _this;\r\n }\r\n ApplicationInsights.getDefaultConfig = function (config) {\r\n if (!config) {\r\n config = {};\r\n }\r\n // set default values\r\n config.sessionRenewalMs = 30 * 60 * 1000;\r\n config.sessionExpirationMs = 24 * 60 * 60 * 1000;\r\n config.disableExceptionTracking = Util.stringToBoolOrDefault(config.disableExceptionTracking);\r\n config.autoTrackPageVisitTime = Util.stringToBoolOrDefault(config.autoTrackPageVisitTime);\r\n config.overridePageViewDuration = Util.stringToBoolOrDefault(config.overridePageViewDuration);\r\n config.enableUnhandledPromiseRejectionTracking = Util.stringToBoolOrDefault(config.enableUnhandledPromiseRejectionTracking);\r\n if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {\r\n config.samplingPercentage = 100;\r\n }\r\n config.isCookieUseDisabled = Util.stringToBoolOrDefault(config.isCookieUseDisabled);\r\n config.isStorageUseDisabled = Util.stringToBoolOrDefault(config.isStorageUseDisabled);\r\n config.isBrowserLinkTrackingEnabled = Util.stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);\r\n config.enableAutoRouteTracking = Util.stringToBoolOrDefault(config.enableAutoRouteTracking);\r\n config.namePrefix = config.namePrefix || \"\";\r\n return config;\r\n };\r\n ApplicationInsights.prototype.processTelemetry = function (env, itemCtx) {\r\n var _this = this;\r\n doPerf(this.core, function () { return _this.identifier + \":processTelemetry\"; }, function () {\r\n var doNotSendItem = false;\r\n var telemetryInitializersCount = _this._telemetryInitializers.length;\r\n itemCtx = _this._getTelCtx(itemCtx);\r\n for (var i = 0; i < telemetryInitializersCount; ++i) {\r\n var telemetryInitializer = _this._telemetryInitializers[i];\r\n if (telemetryInitializer) {\r\n try {\r\n if (telemetryInitializer.apply(null, [env]) === 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 itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, \"One of telemetry initializers failed, telemetry item will not be sent: \" + Util.getExceptionName(e), { exception: Util.dump(e) }, true);\r\n }\r\n }\r\n }\r\n if (!doNotSendItem) {\r\n _this.processNext(env, itemCtx);\r\n }\r\n }, function () { return ({ item: env }); }, !(env.sync));\r\n };\r\n ApplicationInsights.prototype.trackEvent = function (event, customProperties) {\r\n try {\r\n var telemetryItem = TelemetryItemCreator.create(event, EventTelemetry.dataType, EventTelemetry.envelopeType, this.diagLog(), customProperties);\r\n this.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, \"trackTrace failed, trace will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * Start timing an extended event. Call `stopTrackEvent` to log the event when it ends.\r\n * @param name A string that identifies this event uniquely within the document.\r\n */\r\n ApplicationInsights.prototype.startTrackEvent = function (name) {\r\n try {\r\n this._eventTracking.start(name);\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackEventFailed, \"startTrackEvent failed, event will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * Log an extended event that you started timing with `startTrackEvent`.\r\n * @param name The string you used to identify this event in `startTrackEvent`.\r\n * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n ApplicationInsights.prototype.stopTrackEvent = function (name, properties, measurements) {\r\n try {\r\n this._eventTracking.stop(name, undefined, properties); // Todo: Fix to pass measurements once type is updated\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackEventFailed, \"stopTrackEvent failed, event will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * @description Log a diagnostic message\r\n * @param {ITraceTelemetry} trace\r\n * @param ICustomProperties.\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.trackTrace = function (trace, customProperties) {\r\n try {\r\n var telemetryItem = TelemetryItemCreator.create(trace, Trace.dataType, Trace.envelopeType, this.diagLog(), customProperties);\r\n this.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, \"trackTrace failed, trace will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * @description Log a numeric value that is not associated with a specific event. Typically\r\n * used to send regular reports of performance indicators. To send single measurement, just\r\n * use the name and average fields of {@link IMetricTelemetry}. If you take measurements\r\n * frequently, you can reduce the telemetry bandwidth by aggregating multiple measurements\r\n * and sending the resulting average at intervals\r\n * @param {IMetricTelemetry} metric input object argument. Only name and average are mandatory.\r\n * @param {{[key: string]: any}} customProperties additional data used to filter metrics in the\r\n * portal. Defaults to empty.\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.trackMetric = function (metric, customProperties) {\r\n try {\r\n var telemetryItem = TelemetryItemCreator.create(metric, Metric.dataType, Metric.envelopeType, this.diagLog(), customProperties);\r\n this.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackMetricFailed, \"trackMetric failed, metric will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * Logs that a page or other item was viewed.\r\n * @param IPageViewTelemetry The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param customProperties Additional data used to filter events and metrics. Defaults to empty.\r\n * If a user wants to provide duration for pageLoad, it'll have to be in pageView.properties.duration\r\n */\r\n ApplicationInsights.prototype.trackPageView = function (pageView, customProperties) {\r\n try {\r\n var inPv = pageView || {};\r\n this._pageViewManager.trackPageView(inPv, __assign({}, inPv.properties, inPv.measurements, customProperties));\r\n if (this.config.autoTrackPageVisitTime) {\r\n this._pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri);\r\n }\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, \"trackPageView failed, page view will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * Create a page view telemetry item and send it to the SDK pipeline through the core.track API\r\n * @param pageView Page view item to be sent\r\n * @param properties Custom properties (Part C) that a user can add to the telemetry item\r\n * @param systemProperties System level properties (Part A) that a user can add to the telemetry item\r\n */\r\n ApplicationInsights.prototype.sendPageViewInternal = function (pageView, properties, systemProperties) {\r\n var doc = getDocument();\r\n if (doc) {\r\n pageView.refUri = pageView.refUri === undefined ? doc.referrer : pageView.refUri;\r\n }\r\n var telemetryItem = TelemetryItemCreator.create(pageView, PageView.dataType, PageView.envelopeType, this.diagLog(), properties, systemProperties);\r\n this.core.track(telemetryItem);\r\n // reset ajaxes counter\r\n this._trackAjaxAttempts = 0;\r\n };\r\n /**\r\n * @ignore INTERNAL ONLY\r\n * @param pageViewPerformance\r\n * @param properties\r\n */\r\n ApplicationInsights.prototype.sendPageViewPerformanceInternal = function (pageViewPerformance, properties, systemProperties) {\r\n var telemetryItem = TelemetryItemCreator.create(pageViewPerformance, PageViewPerformance.dataType, PageViewPerformance.envelopeType, this.diagLog(), properties, systemProperties);\r\n this.core.track(telemetryItem);\r\n };\r\n /**\r\n * Send browser performance metrics.\r\n * @param pageViewPerformance\r\n * @param customProperties\r\n */\r\n ApplicationInsights.prototype.trackPageViewPerformance = function (pageViewPerformance, customProperties) {\r\n try {\r\n this._pageViewPerformanceManager.populatePageViewPerformanceEvent(pageViewPerformance);\r\n this.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, \"trackPageViewPerformance failed, page view will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,\r\n * but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view\r\n * and send the event.\r\n * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.\r\n */\r\n ApplicationInsights.prototype.startTrackPage = function (name) {\r\n try {\r\n if (typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = doc && doc.title || \"\";\r\n }\r\n this._pageTracking.start(name);\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackFailed, \"startTrackPage failed, page view may not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.\r\n * The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.\r\n * @param name The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.\r\n * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n ApplicationInsights.prototype.stopTrackPage = function (name, url, properties, measurement) {\r\n try {\r\n if (typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = doc && doc.title || \"\";\r\n }\r\n if (typeof url !== \"string\") {\r\n var loc = getLocation();\r\n url = loc && loc.href || \"\";\r\n }\r\n this._pageTracking.stop(name, url, properties, measurement);\r\n if (this.config.autoTrackPageVisitTime) {\r\n this._pageVisitTimeManager.trackPreviousPageVisit(name, url);\r\n }\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackFailed, \"stopTrackPage failed, page view will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * @ignore INTERNAL ONLY\r\n * @param exception\r\n * @param properties\r\n * @param systemProperties\r\n */\r\n ApplicationInsights.prototype.sendExceptionInternal = function (exception, customProperties, systemProperties) {\r\n var exceptionPartB = new Exception(this.diagLog(), exception.exception || new Error(Util.NotSpecified), exception.properties, exception.measurements, exception.severityLevel, exception.id).toInterface();\r\n var telemetryItem = TelemetryItemCreator.create(exceptionPartB, Exception.dataType, Exception.envelopeType, this.diagLog(), customProperties, systemProperties);\r\n this.core.track(telemetryItem);\r\n };\r\n /**\r\n * Log an exception you have caught.\r\n *\r\n * @param {IExceptionTelemetry} exception Object which contains exception to be sent\r\n * @param {{[key: string]: any}} customProperties Additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n *\r\n * Any property of type double will be considered a measurement, and will be treated by Application Insights as a metric.\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.trackException = function (exception, customProperties) {\r\n try {\r\n this.sendExceptionInternal(exception, customProperties);\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackExceptionFailed, \"trackException failed, exception will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n /**\r\n * @description Custom error handler for Application Insights Analytics\r\n * @param {IAutoExceptionTelemetry} exception\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype._onerror = function (exception) {\r\n try {\r\n var properties_1 = {\r\n url: (exception && exception.url) || (getDocument() || {}).URL,\r\n lineNumber: exception.lineNumber,\r\n columnNumber: exception.columnNumber,\r\n message: exception.message\r\n };\r\n if (Util.isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception.error)) {\r\n this._sendCORSException(properties_1.url);\r\n }\r\n else {\r\n if (!Util.isError(exception.error)) {\r\n var stack = \"window.onerror@\" + properties_1.url + \":\" + exception.lineNumber + \":\" + (exception.columnNumber || 0);\r\n exception.error = new Error(exception.message);\r\n exception.error.stack = stack;\r\n }\r\n this.trackException({ exception: exception.error, severityLevel: SeverityLevel.Error }, properties_1);\r\n }\r\n }\r\n catch (e) {\r\n var errorString = exception.error ?\r\n (exception.error.name + \", \" + exception.error.message)\r\n : \"null\";\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ExceptionWhileLoggingError, \"_onError threw exception while logging error, error will not be collected: \"\r\n + Util.getExceptionName(e), { exception: Util.dump(e), errorString: errorString });\r\n }\r\n };\r\n ApplicationInsights.prototype.addTelemetryInitializer = function (telemetryInitializer) {\r\n this._telemetryInitializers.push(telemetryInitializer);\r\n };\r\n ApplicationInsights.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n var _this = this;\r\n if (this.isInitialized()) {\r\n return;\r\n }\r\n if (CoreUtils.isNullOrUndefined(core)) {\r\n throw Error(\"Error initializing\");\r\n }\r\n _super.prototype.initialize.call(this, config, core, extensions, pluginChain);\r\n this.setInitialized(false); // resetting the initialized state, just in case the following fails\r\n var ctx = this._getTelCtx();\r\n var identifier = this.identifier;\r\n this._globalconfig = {\r\n instrumentationKey: config.instrumentationKey,\r\n endpointUrl: config.endpointUrl || \"https://dc.services.visualstudio.com/v2/track\"\r\n };\r\n this.config = ctx.getExtCfg(identifier);\r\n // load default values if specified\r\n var defaults = ApplicationInsights.getDefaultConfig();\r\n if (defaults !== undefined) {\r\n for (var field in defaults) {\r\n // for each unspecified field, set the default value\r\n this.config[field] = ctx.getConfig(identifier, field, defaults[field]);\r\n }\r\n if (this._globalconfig) {\r\n for (var field in defaults) {\r\n if (this._globalconfig[field] === undefined) {\r\n this._globalconfig[field] = defaults[field];\r\n }\r\n }\r\n }\r\n }\r\n // Todo: move this out of static state\r\n if (this.config.isCookieUseDisabled) {\r\n Util.disableCookies();\r\n }\r\n // Todo: move this out of static state\r\n if (this.config.isStorageUseDisabled) {\r\n Util.disableStorage();\r\n }\r\n var configGetters = {\r\n instrumentationKey: function () { return config.instrumentationKey; },\r\n accountId: function () { return _this.config.accountId || config.accountId; },\r\n sessionRenewalMs: function () { return _this.config.sessionRenewalMs || config.sessionRenewalMs; },\r\n sessionExpirationMs: function () { return _this.config.sessionExpirationMs || config.sessionExpirationMs; },\r\n sampleRate: function () { return _this.config.samplingPercentage || config.samplingPercentage; },\r\n cookieDomain: function () { return _this.config.cookieDomain || config.cookieDomain; },\r\n sdkExtension: function () { return _this.config.sdkExtension || config.sdkExtension; },\r\n isBrowserLinkTrackingEnabled: function () { return _this.config.isBrowserLinkTrackingEnabled || config.isBrowserLinkTrackingEnabled; },\r\n appId: function () { return _this.config.appId || config.appId; }\r\n };\r\n this._pageViewPerformanceManager = new PageViewPerformanceManager(this.core);\r\n this._pageViewManager = new PageViewManager(this, this.config.overridePageViewDuration, this.core, this._pageViewPerformanceManager);\r\n this._pageVisitTimeManager = new PageVisitTimeManager(this.diagLog(), function (pageName, pageUrl, pageVisitTime) { return _this.trackPageVisitTime(pageName, pageUrl, pageVisitTime); });\r\n this._telemetryInitializers = this._telemetryInitializers || [];\r\n this._addDefaultTelemetryInitializers(configGetters);\r\n this._eventTracking = new Timing(this.diagLog(), \"trackEvent\");\r\n this._eventTracking.action =\r\n function (name, url, duration, properties) {\r\n if (!properties) {\r\n properties = {};\r\n }\r\n properties[durationProperty] = duration.toString();\r\n _this.trackEvent({ name: name, properties: properties });\r\n };\r\n // initialize page view timing\r\n this._pageTracking = new Timing(this.diagLog(), \"trackPageView\");\r\n this._pageTracking.action = function (name, url, duration, properties, measurements) {\r\n // duration must be a custom property in order for the collector to extract it\r\n if (CoreUtils.isNullOrUndefined(properties)) {\r\n properties = {};\r\n }\r\n properties[durationProperty] = duration.toString();\r\n var pageViewItem = {\r\n name: name,\r\n uri: url,\r\n properties: properties,\r\n measurements: measurements\r\n };\r\n _this.sendPageViewInternal(pageViewItem, properties);\r\n };\r\n var _window = getWindow();\r\n var _history = getHistory();\r\n var _location = getLocation();\r\n var instance = this;\r\n if (this.config.disableExceptionTracking === false &&\r\n !this.config.autoExceptionInstrumented && _window) {\r\n // We want to enable exception auto collection and it has not been done so yet\r\n var onerror_1 = \"onerror\";\r\n var originalOnError_1 = _window[onerror_1];\r\n _window.onerror = function (message, url, lineNumber, columnNumber, error) {\r\n var handled = originalOnError_1 && originalOnError_1(message, url, lineNumber, columnNumber, error);\r\n if (handled !== true) {\r\n instance._onerror({\r\n message: message,\r\n url: url,\r\n lineNumber: lineNumber,\r\n columnNumber: columnNumber,\r\n error: error\r\n });\r\n }\r\n return handled;\r\n };\r\n this.config.autoExceptionInstrumented = true;\r\n }\r\n if (this.config.disableExceptionTracking === false &&\r\n this.config.enableUnhandledPromiseRejectionTracking === true &&\r\n !this.config.autoUnhandledPromiseInstrumented && _window) {\r\n // We want to enable exception auto collection and it has not been done so yet\r\n var onunhandledrejection = \"onunhandledrejection\";\r\n var originalOnUnhandledRejection_1 = _window[onunhandledrejection];\r\n _window[onunhandledrejection] = function (error) {\r\n var handled = originalOnUnhandledRejection_1 && originalOnUnhandledRejection_1.call(_window, error);\r\n if (handled !== true) {\r\n instance._onerror({\r\n message: error.reason.toString(),\r\n error: error.reason instanceof Error ? error.reason : new Error(error.reason.toString()),\r\n url: _location ? _location.href : \"\",\r\n lineNumber: 0,\r\n columnNumber: 0\r\n });\r\n }\r\n return handled;\r\n };\r\n this.config.autoUnhandledPromiseInstrumented = true;\r\n }\r\n /**\r\n * Create a custom \"locationchange\" event which is triggered each time the history object is changed\r\n */\r\n if (this.config.enableAutoRouteTracking === true\r\n && _history && CoreUtils.isFunction(_history.pushState) && CoreUtils.isFunction(_history.replaceState)\r\n && _window\r\n && typeof Event !== \"undefined\") {\r\n var _self_1 = this;\r\n // Find the properties plugin\r\n CoreUtils.arrForEach(extensions, function (extension) {\r\n if (extension.identifier === PropertiesPluginIdentifier) {\r\n _this._properties = extension;\r\n }\r\n });\r\n _history.pushState = (function (f) { return function pushState() {\r\n var ret = f.apply(this, arguments);\r\n _dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + \"pushState\"));\r\n _dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + \"locationchange\"));\r\n return ret;\r\n }; })(_history.pushState);\r\n _history.replaceState = (function (f) { return function replaceState() {\r\n var ret = f.apply(this, arguments);\r\n _dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + \"replaceState\"));\r\n _dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + \"locationchange\"));\r\n return ret;\r\n }; })(_history.replaceState);\r\n if (_window.addEventListener) {\r\n _window.addEventListener(_self_1.config.namePrefix + \"popstate\", function () {\r\n _dispatchEvent(_window, Util.createDomEvent(_self_1.config.namePrefix + \"locationchange\"));\r\n });\r\n _window.addEventListener(_self_1.config.namePrefix + \"locationchange\", function () {\r\n if (_self_1._properties && _self_1._properties.context && _self_1._properties.context.telemetryTrace) {\r\n _self_1._properties.context.telemetryTrace.traceID = Util.generateW3CId();\r\n _self_1._properties.context.telemetryTrace.name = _location && _location.pathname || \"_unknown_\";\r\n }\r\n if (_this._currUri) {\r\n _this._prevUri = _this._currUri;\r\n _this._currUri = _location && _location.href || \"\";\r\n }\r\n else {\r\n _this._currUri = _location && _location.href || \"\";\r\n }\r\n setTimeout((function (uri) {\r\n // todo: override start time so that it is not affected by autoRoutePVDelay\r\n _self_1.trackPageView({ refUri: uri, properties: { duration: 0 } }); // SPA route change loading durations are undefined, so send 0\r\n }).bind(_this, _this._prevUri), _self_1.autoRoutePVDelay);\r\n });\r\n }\r\n }\r\n this.setInitialized(true);\r\n };\r\n /**\r\n * Log a page visit time\r\n * @param pageName Name of page\r\n * @param pageVisitDuration Duration of visit to the page in milleseconds\r\n */\r\n ApplicationInsights.prototype.trackPageVisitTime = function (pageName, pageUrl, pageVisitTime) {\r\n var properties = { PageName: pageName, PageUrl: pageUrl };\r\n this.trackMetric({\r\n name: \"PageVisitTime\",\r\n average: pageVisitTime,\r\n max: pageVisitTime,\r\n min: pageVisitTime,\r\n sampleCount: 1\r\n }, properties);\r\n };\r\n ApplicationInsights.prototype._addDefaultTelemetryInitializers = function (configGetters) {\r\n if (!configGetters.isBrowserLinkTrackingEnabled()) {\r\n var browserLinkPaths_1 = ['/browserLinkSignalR/', '/__browserLink/'];\r\n var dropBrowserLinkRequests = function (envelope) {\r\n if (envelope.baseType === RemoteDependencyData.dataType) {\r\n var remoteData = envelope.baseData;\r\n if (remoteData) {\r\n for (var i = 0; i < browserLinkPaths_1.length; i++) {\r\n if (remoteData.target && remoteData.target.indexOf(browserLinkPaths_1[i]) >= 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n this._addTelemetryInitializer(dropBrowserLinkRequests);\r\n }\r\n };\r\n ApplicationInsights.prototype._addTelemetryInitializer = function (telemetryInitializer) {\r\n this._telemetryInitializers.push(telemetryInitializer);\r\n };\r\n ApplicationInsights.prototype._sendCORSException = function (url) {\r\n var exception = {\r\n message: \"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.\",\r\n url: url,\r\n lineNumber: 0,\r\n columnNumber: 0,\r\n error: undefined\r\n };\r\n var telemetryItem = TelemetryItemCreator.create(exception, Exception.dataType, Exception.envelopeType, this.diagLog(), { url: url });\r\n this.core.track(telemetryItem);\r\n };\r\n ApplicationInsights.Version = \"2.5.9\"; // Not currently used anywhere\r\n return ApplicationInsights;\r\n}(BaseTelemetryPlugin));\r\nexport { ApplicationInsights };\r\n/**\r\n * Used to record timed events and page views.\r\n */\r\nvar Timing = /** @class */ (function () {\r\n function Timing(logger, name) {\r\n this._name = name;\r\n this._events = {};\r\n this._logger = logger;\r\n }\r\n Timing.prototype.start = function (name) {\r\n if (typeof this._events[name] !== \"undefined\") {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, \"start was called more than once for this event without calling stop.\", { name: this._name, key: name }, true);\r\n }\r\n this._events[name] = +new Date;\r\n };\r\n Timing.prototype.stop = function (name, url, properties, measurements) {\r\n var start = this._events[name];\r\n if (isNaN(start)) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, \"stop was called without a corresponding start.\", { name: this._name, key: name }, true);\r\n }\r\n else {\r\n var end = +new Date;\r\n var duration = DateTimeUtils.GetDuration(start, end);\r\n this.action(name, url, duration, properties, measurements);\r\n }\r\n delete this._events[name];\r\n this._events[name] = undefined;\r\n };\r\n return Timing;\r\n}());\r\n//# sourceMappingURL=ApplicationInsights.js.map","/*!\n * Application Insights JavaScript SDK - Channel, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { Util } from '@microsoft/applicationinsights-common';\r\nimport { LoggingSeverity, _InternalMessageId, getJSON, CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nimport dynamicProto from '@microsoft/dynamicproto-js';\r\n/*\r\n * An array based send buffer.\r\n */\r\nvar ArraySendBuffer = /** @class */ (function () {\r\n function ArraySendBuffer(config) {\r\n var _buffer = [];\r\n dynamicProto(ArraySendBuffer, this, function (_self) {\r\n _self.enqueue = function (payload) {\r\n _buffer.push(payload);\r\n };\r\n _self.count = function () {\r\n return _buffer.length;\r\n };\r\n _self.clear = function () {\r\n _buffer.length = 0;\r\n };\r\n _self.getItems = function () {\r\n return _buffer.slice(0);\r\n };\r\n _self.batchPayloads = function (payload) {\r\n if (payload && payload.length > 0) {\r\n var batch = config.emitLineDelimitedJson() ?\r\n payload.join(\"\\n\") :\r\n \"[\" + payload.join(\",\") + \"]\";\r\n return batch;\r\n }\r\n return null;\r\n };\r\n _self.markAsSent = function (payload) {\r\n _self.clear();\r\n };\r\n _self.clearSent = function (payload) {\r\n // not supported\r\n };\r\n });\r\n }\r\n// Removed Stub for ArraySendBuffer.prototype.enqueue.\r\n// Removed Stub for ArraySendBuffer.prototype.count.\r\n// Removed Stub for ArraySendBuffer.prototype.clear.\r\n// Removed Stub for ArraySendBuffer.prototype.getItems.\r\n// Removed Stub for ArraySendBuffer.prototype.batchPayloads.\r\n// Removed Stub for ArraySendBuffer.prototype.markAsSent.\r\n// Removed Stub for ArraySendBuffer.prototype.clearSent.\r\n return ArraySendBuffer;\r\n}());\r\nexport { ArraySendBuffer };\r\n/*\r\n * Session storage buffer holds a copy of all unsent items in the browser session storage.\r\n */\r\nvar SessionStorageSendBuffer = /** @class */ (function () {\r\n function SessionStorageSendBuffer(logger, config) {\r\n var _bufferFullMessageSent = false;\r\n // An in-memory copy of the buffer. A copy is saved to the session storage on enqueue() and clear().\r\n // The buffer is restored in a constructor and contains unsent events from a previous page.\r\n var _buffer;\r\n dynamicProto(SessionStorageSendBuffer, this, function (_self) {\r\n var bufferItems = _getBuffer(SessionStorageSendBuffer.BUFFER_KEY);\r\n var notDeliveredItems = _getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);\r\n _buffer = bufferItems.concat(notDeliveredItems);\r\n // If the buffer has too many items, drop items from the end.\r\n if (_buffer.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {\r\n _buffer.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;\r\n }\r\n _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, []);\r\n _setBuffer(SessionStorageSendBuffer.BUFFER_KEY, _buffer);\r\n _self.enqueue = function (payload) {\r\n if (_buffer.length >= SessionStorageSendBuffer.MAX_BUFFER_SIZE) {\r\n // sent internal log only once per page view\r\n if (!_bufferFullMessageSent) {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionStorageBufferFull, \"Maximum buffer size reached: \" + _buffer.length, true);\r\n _bufferFullMessageSent = true;\r\n }\r\n return;\r\n }\r\n _buffer.push(payload);\r\n _setBuffer(SessionStorageSendBuffer.BUFFER_KEY, _buffer);\r\n };\r\n _self.count = function () {\r\n return _buffer.length;\r\n };\r\n _self.clear = function () {\r\n _buffer = [];\r\n _setBuffer(SessionStorageSendBuffer.BUFFER_KEY, []);\r\n _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, []);\r\n _bufferFullMessageSent = false;\r\n };\r\n _self.getItems = function () {\r\n return _buffer.slice(0);\r\n };\r\n _self.batchPayloads = function (payload) {\r\n if (payload && payload.length > 0) {\r\n var batch = config.emitLineDelimitedJson() ?\r\n payload.join(\"\\n\") :\r\n \"[\" + payload.join(\",\") + \"]\";\r\n return batch;\r\n }\r\n return null;\r\n };\r\n _self.markAsSent = function (payload) {\r\n _buffer = _removePayloadsFromBuffer(payload, _buffer);\r\n _setBuffer(SessionStorageSendBuffer.BUFFER_KEY, _buffer);\r\n var sentElements = _getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);\r\n if (sentElements instanceof Array && payload instanceof Array) {\r\n sentElements = sentElements.concat(payload);\r\n if (sentElements.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {\r\n // We send telemetry normally. If the SENT_BUFFER is too big we don't add new elements\r\n // until we receive a response from the backend and the buffer has free space again (see clearSent method)\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SessionStorageBufferFull, \"Sent buffer reached its maximum size: \" + sentElements.length, true);\r\n sentElements.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;\r\n }\r\n _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);\r\n }\r\n };\r\n _self.clearSent = function (payload) {\r\n var sentElements = _getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);\r\n sentElements = _removePayloadsFromBuffer(payload, sentElements);\r\n _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);\r\n };\r\n function _removePayloadsFromBuffer(payloads, buffer) {\r\n var remaining = [];\r\n CoreUtils.arrForEach(buffer, function (value) {\r\n if (!CoreUtils.isFunction(value) && CoreUtils.arrIndexOf(payloads, value) === -1) {\r\n remaining.push(value);\r\n }\r\n });\r\n return remaining;\r\n }\r\n function _getBuffer(key) {\r\n var prefixedKey = key;\r\n try {\r\n prefixedKey = config.namePrefix && config.namePrefix() ? config.namePrefix() + \"_\" + prefixedKey : prefixedKey;\r\n var bufferJson = Util.getSessionStorage(logger, prefixedKey);\r\n if (bufferJson) {\r\n var buffer = getJSON().parse(bufferJson);\r\n if (CoreUtils.isString(buffer)) {\r\n // When using some version prototype.js the stringify / parse cycle does not decode array's correctly\r\n buffer = getJSON().parse(buffer);\r\n }\r\n if (buffer && Util.isArray(buffer)) {\r\n return buffer;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToRestoreStorageBuffer, \" storage key: \" + prefixedKey + \", \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n return [];\r\n }\r\n function _setBuffer(key, buffer) {\r\n var prefixedKey = key;\r\n try {\r\n prefixedKey = config.namePrefix && config.namePrefix() ? config.namePrefix() + \"_\" + prefixedKey : prefixedKey;\r\n var bufferJson = JSON.stringify(buffer);\r\n Util.setSessionStorage(logger, prefixedKey, bufferJson);\r\n }\r\n catch (e) {\r\n // if there was an error, clear the buffer\r\n // telemetry is stored in the _buffer array so we won't loose any items\r\n Util.setSessionStorage(logger, prefixedKey, JSON.stringify([]));\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedToSetStorageBuffer, \" storage key: \" + prefixedKey + \", \" + Util.getExceptionName(e) + \". Buffer cleared\", { exception: Util.dump(e) });\r\n }\r\n }\r\n });\r\n }\r\n// Removed Stub for SessionStorageSendBuffer.prototype.enqueue.\r\n// Removed Stub for SessionStorageSendBuffer.prototype.count.\r\n// Removed Stub for SessionStorageSendBuffer.prototype.clear.\r\n// Removed Stub for SessionStorageSendBuffer.prototype.getItems.\r\n// Removed Stub for SessionStorageSendBuffer.prototype.batchPayloads.\r\n// Removed Stub for SessionStorageSendBuffer.prototype.markAsSent.\r\n// Removed Stub for SessionStorageSendBuffer.prototype.clearSent.\r\n SessionStorageSendBuffer.BUFFER_KEY = \"AI_buffer\";\r\n SessionStorageSendBuffer.SENT_BUFFER_KEY = \"AI_sentBuffer\";\r\n // Maximum number of payloads stored in the buffer. If the buffer is full, new elements will be dropped.\r\n SessionStorageSendBuffer.MAX_BUFFER_SIZE = 2000;\r\n return SessionStorageSendBuffer;\r\n}());\r\nexport { SessionStorageSendBuffer };\r\n//# sourceMappingURL=SendBuffer.js.map","/*!\n * Application Insights JavaScript SDK - Channel, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { Data, Envelope, RemoteDependencyData, Event, Exception, Metric, PageView, Trace, PageViewPerformance, CtxTagKeys, HttpMethod, SampleRate, } from '@microsoft/applicationinsights-common';\r\nimport { CoreUtils, LoggingSeverity, _InternalMessageId, hasJSON, getJSON } from '@microsoft/applicationinsights-core-js';\r\n// these two constants are used to filter out properties not needed when trying to extract custom properties and measurements from the incoming payload\r\nvar strBaseType = 'baseType';\r\nvar strBaseData = 'baseData';\r\nvar strProperties = 'properties';\r\nvar strTrue = 'true';\r\nvar arrForEach = CoreUtils.arrForEach;\r\nvar objKeys = CoreUtils.objKeys;\r\nvar isNullOrUndefined = CoreUtils.isNullOrUndefined;\r\nfunction _setValueIf(target, field, value) {\r\n if (target && value) {\r\n target[field] = value;\r\n return target[field];\r\n }\r\n return null;\r\n}\r\nvar EnvelopeCreator = /** @class */ (function () {\r\n function EnvelopeCreator() {\r\n }\r\n EnvelopeCreator.extractPropsAndMeasurements = function (data, properties, measurements) {\r\n if (!isNullOrUndefined(data)) {\r\n arrForEach(objKeys(data), function (key) {\r\n var value = data[key];\r\n if (CoreUtils.isNumber(value)) {\r\n measurements[key] = value;\r\n }\r\n else if (CoreUtils.isString(value)) {\r\n properties[key] = value;\r\n }\r\n else if (hasJSON()) {\r\n properties[key] = getJSON().stringify(value);\r\n }\r\n });\r\n }\r\n };\r\n // TODO: Do we want this to take logger as arg or use this._logger as nonstatic?\r\n EnvelopeCreator.createEnvelope = function (logger, envelopeType, telemetryItem, data) {\r\n var envelope = new Envelope(logger, data, envelopeType);\r\n _setValueIf(envelope, 'sampleRate', telemetryItem[SampleRate]);\r\n if ((telemetryItem[strBaseData] || {}).startTime) {\r\n envelope.time = CoreUtils.toISOString(telemetryItem[strBaseData].startTime);\r\n }\r\n envelope.iKey = telemetryItem.iKey;\r\n var iKeyNoDashes = telemetryItem.iKey.replace(/-/g, \"\");\r\n envelope.name = envelope.name.replace(\"{0}\", iKeyNoDashes);\r\n // extract all extensions from ctx\r\n EnvelopeCreator.extractPartAExtensions(telemetryItem, envelope);\r\n // loop through the envelope tags (extension of Part A) and pick out the ones that should go in outgoing envelope tags\r\n telemetryItem.tags = telemetryItem.tags || [];\r\n return envelope;\r\n };\r\n /*\r\n * Maps Part A data from CS 4.0\r\n */\r\n EnvelopeCreator.extractPartAExtensions = function (item, env) {\r\n // todo: switch to keys from common in this method\r\n var envTags = env.tags = env.tags || {};\r\n var itmExt = item.ext = item.ext || {};\r\n var itmTags = item.tags = item.tags || [];\r\n var extUser = itmExt.user;\r\n if (extUser) {\r\n _setValueIf(envTags, CtxTagKeys.userAuthUserId, extUser.authId);\r\n _setValueIf(envTags, CtxTagKeys.userId, extUser.id || extUser.localId);\r\n }\r\n var extApp = itmExt.app;\r\n if (extApp) {\r\n _setValueIf(envTags, CtxTagKeys.sessionId, extApp.sesId);\r\n }\r\n var extDevice = itmExt.device;\r\n if (extDevice) {\r\n _setValueIf(envTags, CtxTagKeys.deviceId, extDevice.id || extDevice.localId);\r\n _setValueIf(envTags, CtxTagKeys.deviceType, extDevice.deviceClass);\r\n _setValueIf(envTags, CtxTagKeys.deviceIp, extDevice.ip);\r\n _setValueIf(envTags, CtxTagKeys.deviceModel, extDevice.model);\r\n _setValueIf(envTags, CtxTagKeys.deviceType, extDevice.deviceType);\r\n }\r\n var web = item.ext.web;\r\n if (web) {\r\n _setValueIf(envTags, CtxTagKeys.deviceLanguage, web.browserLang);\r\n _setValueIf(envTags, CtxTagKeys.deviceBrowserVersion, web.browserVer);\r\n _setValueIf(envTags, CtxTagKeys.deviceBrowser, web.browser);\r\n var envData = env.data = env.data || {};\r\n var envBaseData = envData[strBaseData] = envData[strBaseData] || {};\r\n var envProps = envBaseData[strProperties] = envBaseData[strProperties] || {};\r\n _setValueIf(envProps, 'domain', web.domain);\r\n _setValueIf(envProps, 'isManual', web.isManual ? strTrue : null);\r\n _setValueIf(envProps, 'screenRes', web.screenRes);\r\n _setValueIf(envProps, 'userConsent', web.userConsent ? strTrue : null);\r\n }\r\n var extOs = itmExt.os;\r\n if (extOs) {\r\n _setValueIf(envTags, CtxTagKeys.deviceOS, extOs.name);\r\n }\r\n // No support for mapping Trace.traceState to 2.0 as it is currently empty\r\n var extTrace = itmExt.trace;\r\n if (extTrace) {\r\n _setValueIf(envTags, CtxTagKeys.operationParentId, extTrace.parentID);\r\n _setValueIf(envTags, CtxTagKeys.operationName, extTrace.name);\r\n _setValueIf(envTags, CtxTagKeys.operationId, extTrace.traceID);\r\n }\r\n // Sample 4.0 schema\r\n // {\r\n // \"time\" : \"2018-09-05T22:51:22.4936Z\",\r\n // \"name\" : \"MetricWithNamespace\",\r\n // \"iKey\" : \"ABC-5a4cbd20-e601-4ef5-a3c6-5d6577e4398e\",\r\n // \"ext\": { \"cloud\": {\r\n // \"role\": \"WATSON3\",\r\n // \"roleInstance\": \"CO4AEAP00000260\"\r\n // },\r\n // \"device\": {}, \"correlation\": {} },\r\n // \"tags\": [\r\n // { \"amazon.region\" : \"east2\" },\r\n // { \"os.expid\" : \"wp:02df239\" }\r\n // ]\r\n // }\r\n var tgs = {};\r\n var _loop_1 = function (i) {\r\n var tg = itmTags[i];\r\n // CoreUtils.objKeys returns an array of keys\r\n arrForEach(objKeys(tg), function (key) {\r\n tgs[key] = tg[key];\r\n });\r\n itmTags.splice(i, 1);\r\n };\r\n // deals with tags.push({object})\r\n for (var i = itmTags.length - 1; i >= 0; i--) {\r\n _loop_1(i);\r\n }\r\n // deals with tags[key]=value (and handles hasOwnProperty)\r\n arrForEach(objKeys(itmTags), function (tg) {\r\n tgs[tg] = itmTags[tg];\r\n });\r\n env.tags = __assign({}, envTags, tgs);\r\n if (!env.tags[CtxTagKeys.internalSdkVersion]) {\r\n // Append a version in case it is not already set\r\n env.tags[CtxTagKeys.internalSdkVersion] = \"javascript:\" + EnvelopeCreator.Version;\r\n }\r\n };\r\n EnvelopeCreator.prototype.Init = function (logger, telemetryItem) {\r\n this._logger = logger;\r\n if (isNullOrUndefined(telemetryItem[strBaseData])) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"telemetryItem.baseData cannot be null.\");\r\n }\r\n };\r\n EnvelopeCreator.Version = \"2.5.9\";\r\n return EnvelopeCreator;\r\n}());\r\nexport { EnvelopeCreator };\r\nvar DependencyEnvelopeCreator = /** @class */ (function (_super) {\r\n __extends(DependencyEnvelopeCreator, _super);\r\n function DependencyEnvelopeCreator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n DependencyEnvelopeCreator.prototype.Create = function (logger, telemetryItem) {\r\n _super.prototype.Init.call(this, logger, telemetryItem);\r\n var customMeasurements = telemetryItem[strBaseData].measurements || {};\r\n var customProperties = telemetryItem[strBaseData][strProperties] || {};\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n var bd = telemetryItem[strBaseData];\r\n if (isNullOrUndefined(bd)) {\r\n logger.warnToConsole(\"Invalid input for dependency data\");\r\n return null;\r\n }\r\n var method = bd[strProperties] && bd[strProperties][HttpMethod] ? bd[strProperties][HttpMethod] : \"GET\";\r\n var remoteDepData = new RemoteDependencyData(logger, bd.id, bd.target, bd.name, bd.duration, bd.success, bd.responseCode, method, bd.type, bd.correlationContext, customProperties, customMeasurements);\r\n var data = new Data(RemoteDependencyData.dataType, remoteDepData);\r\n return EnvelopeCreator.createEnvelope(logger, RemoteDependencyData.envelopeType, telemetryItem, data);\r\n };\r\n DependencyEnvelopeCreator.DependencyEnvelopeCreator = new DependencyEnvelopeCreator();\r\n return DependencyEnvelopeCreator;\r\n}(EnvelopeCreator));\r\nexport { DependencyEnvelopeCreator };\r\nvar EventEnvelopeCreator = /** @class */ (function (_super) {\r\n __extends(EventEnvelopeCreator, _super);\r\n function EventEnvelopeCreator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n EventEnvelopeCreator.prototype.Create = function (logger, telemetryItem) {\r\n _super.prototype.Init.call(this, logger, telemetryItem);\r\n var customProperties = {};\r\n var customMeasurements = {};\r\n if (telemetryItem[strBaseType] !== Event.dataType) {\r\n customProperties['baseTypeSource'] = telemetryItem[strBaseType]; // save the passed in base type as a property\r\n }\r\n if (telemetryItem[strBaseType] === Event.dataType) {\r\n customProperties = telemetryItem[strBaseData][strProperties] || {};\r\n customMeasurements = telemetryItem[strBaseData].measurements || {};\r\n }\r\n else {\r\n if (telemetryItem[strBaseData]) {\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem[strBaseData], customProperties, customMeasurements);\r\n }\r\n }\r\n // Extract root level properties from part C telemetryItem.data\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n var eventName = telemetryItem[strBaseData].name;\r\n var eventData = new Event(logger, eventName, customProperties, customMeasurements);\r\n var data = new Data(Event.dataType, eventData);\r\n return EnvelopeCreator.createEnvelope(logger, Event.envelopeType, telemetryItem, data);\r\n };\r\n EventEnvelopeCreator.EventEnvelopeCreator = new EventEnvelopeCreator();\r\n return EventEnvelopeCreator;\r\n}(EnvelopeCreator));\r\nexport { EventEnvelopeCreator };\r\nvar ExceptionEnvelopeCreator = /** @class */ (function (_super) {\r\n __extends(ExceptionEnvelopeCreator, _super);\r\n function ExceptionEnvelopeCreator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ExceptionEnvelopeCreator.prototype.Create = function (logger, telemetryItem) {\r\n _super.prototype.Init.call(this, logger, telemetryItem);\r\n // Extract root level properties from part C telemetryItem.data\r\n var customMeasurements = telemetryItem[strBaseData].measurements || {};\r\n var customProperties = telemetryItem[strBaseData][strProperties] || {};\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n var bd = telemetryItem[strBaseData];\r\n var exData = Exception.CreateFromInterface(logger, bd, customProperties, customMeasurements);\r\n var data = new Data(Exception.dataType, exData);\r\n return EnvelopeCreator.createEnvelope(logger, Exception.envelopeType, telemetryItem, data);\r\n };\r\n ExceptionEnvelopeCreator.ExceptionEnvelopeCreator = new ExceptionEnvelopeCreator();\r\n return ExceptionEnvelopeCreator;\r\n}(EnvelopeCreator));\r\nexport { ExceptionEnvelopeCreator };\r\nvar MetricEnvelopeCreator = /** @class */ (function (_super) {\r\n __extends(MetricEnvelopeCreator, _super);\r\n function MetricEnvelopeCreator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n MetricEnvelopeCreator.prototype.Create = function (logger, telemetryItem) {\r\n _super.prototype.Init.call(this, logger, telemetryItem);\r\n var baseData = telemetryItem[strBaseData];\r\n var props = baseData[strProperties] || {};\r\n var measurements = baseData.measurements || {};\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, props, measurements);\r\n var baseMetricData = new Metric(logger, baseData.name, baseData.average, baseData.sampleCount, baseData.min, baseData.max, props, measurements);\r\n var data = new Data(Metric.dataType, baseMetricData);\r\n return EnvelopeCreator.createEnvelope(logger, Metric.envelopeType, telemetryItem, data);\r\n };\r\n MetricEnvelopeCreator.MetricEnvelopeCreator = new MetricEnvelopeCreator();\r\n return MetricEnvelopeCreator;\r\n}(EnvelopeCreator));\r\nexport { MetricEnvelopeCreator };\r\nvar PageViewEnvelopeCreator = /** @class */ (function (_super) {\r\n __extends(PageViewEnvelopeCreator, _super);\r\n function PageViewEnvelopeCreator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n PageViewEnvelopeCreator.prototype.Create = function (logger, telemetryItem) {\r\n _super.prototype.Init.call(this, logger, telemetryItem);\r\n // Since duration is not part of the domain properties in Common Schema, extract it from part C\r\n var strDuration = \"duration\";\r\n var duration;\r\n var baseData = telemetryItem[strBaseData];\r\n if (!isNullOrUndefined(baseData) &&\r\n !isNullOrUndefined(baseData[strProperties]) &&\r\n !isNullOrUndefined(baseData[strProperties][strDuration])) {\r\n duration = baseData[strProperties][strDuration];\r\n delete baseData[strProperties][strDuration];\r\n }\r\n else if (!isNullOrUndefined(telemetryItem.data) &&\r\n !isNullOrUndefined(telemetryItem.data[strDuration])) {\r\n duration = telemetryItem.data[strDuration];\r\n delete telemetryItem.data[strDuration];\r\n }\r\n var bd = telemetryItem[strBaseData];\r\n // special case: pageview.id is grabbed from current operation id. Analytics plugin is decoupled from properties plugin, so this is done here instead. This can be made a default telemetry intializer instead if needed to be decoupled from channel\r\n var currentContextId;\r\n if (((telemetryItem.ext || {}).trace || {}).traceID) {\r\n currentContextId = telemetryItem.ext.trace.traceID;\r\n }\r\n var id = bd.id || currentContextId;\r\n var name = bd.name;\r\n var url = bd.uri;\r\n var properties = bd[strProperties] || {};\r\n var measurements = bd.measurements || {};\r\n // refUri is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property\r\n if (!isNullOrUndefined(bd.refUri)) {\r\n properties[\"refUri\"] = bd.refUri;\r\n }\r\n // pageType is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property\r\n if (!isNullOrUndefined(bd.pageType)) {\r\n properties[\"pageType\"] = bd.pageType;\r\n }\r\n // isLoggedIn is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property\r\n if (!isNullOrUndefined(bd.isLoggedIn)) {\r\n properties[\"isLoggedIn\"] = bd.isLoggedIn.toString();\r\n }\r\n // pageTags is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property\r\n if (!isNullOrUndefined(bd[strProperties])) {\r\n var pageTags_1 = bd[strProperties];\r\n arrForEach(objKeys(pageTags_1), function (key) {\r\n properties[key] = pageTags_1[key];\r\n });\r\n }\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, properties, measurements);\r\n var pageViewData = new PageView(logger, name, url, duration, properties, measurements, id);\r\n var data = new Data(PageView.dataType, pageViewData);\r\n return EnvelopeCreator.createEnvelope(logger, PageView.envelopeType, telemetryItem, data);\r\n };\r\n PageViewEnvelopeCreator.PageViewEnvelopeCreator = new PageViewEnvelopeCreator();\r\n return PageViewEnvelopeCreator;\r\n}(EnvelopeCreator));\r\nexport { PageViewEnvelopeCreator };\r\nvar PageViewPerformanceEnvelopeCreator = /** @class */ (function (_super) {\r\n __extends(PageViewPerformanceEnvelopeCreator, _super);\r\n function PageViewPerformanceEnvelopeCreator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n PageViewPerformanceEnvelopeCreator.prototype.Create = function (logger, telemetryItem) {\r\n _super.prototype.Init.call(this, logger, telemetryItem);\r\n var bd = telemetryItem[strBaseData];\r\n var name = bd.name;\r\n var url = bd.uri || bd.url;\r\n var properties = bd[strProperties] || {};\r\n var measurements = bd.measurements || {};\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, properties, measurements);\r\n var baseData = new PageViewPerformance(logger, name, url, undefined, properties, measurements, bd);\r\n var data = new Data(PageViewPerformance.dataType, baseData);\r\n return EnvelopeCreator.createEnvelope(logger, PageViewPerformance.envelopeType, telemetryItem, data);\r\n };\r\n PageViewPerformanceEnvelopeCreator.PageViewPerformanceEnvelopeCreator = new PageViewPerformanceEnvelopeCreator();\r\n return PageViewPerformanceEnvelopeCreator;\r\n}(EnvelopeCreator));\r\nexport { PageViewPerformanceEnvelopeCreator };\r\nvar TraceEnvelopeCreator = /** @class */ (function (_super) {\r\n __extends(TraceEnvelopeCreator, _super);\r\n function TraceEnvelopeCreator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n TraceEnvelopeCreator.prototype.Create = function (logger, telemetryItem) {\r\n _super.prototype.Init.call(this, logger, telemetryItem);\r\n var message = telemetryItem[strBaseData].message;\r\n var severityLevel = telemetryItem[strBaseData].severityLevel;\r\n var props = telemetryItem[strBaseData][strProperties] || {};\r\n var measurements = telemetryItem[strBaseData].measurements || {};\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, props, measurements);\r\n var baseData = new Trace(logger, message, severityLevel, props, measurements);\r\n var data = new Data(Trace.dataType, baseData);\r\n return EnvelopeCreator.createEnvelope(logger, Trace.envelopeType, telemetryItem, data);\r\n };\r\n TraceEnvelopeCreator.TraceEnvelopeCreator = new TraceEnvelopeCreator();\r\n return TraceEnvelopeCreator;\r\n}(EnvelopeCreator));\r\nexport { TraceEnvelopeCreator };\r\n//# sourceMappingURL=EnvelopeCreator.js.map","/*!\n * Application Insights JavaScript SDK - Channel, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { Util, FieldType } from '@microsoft/applicationinsights-common';\r\nimport { LoggingSeverity, _InternalMessageId, CoreUtils, getJSON } from '@microsoft/applicationinsights-core-js';\r\nimport dynamicProto from '@microsoft/dynamicproto-js';\r\nvar Serializer = /** @class */ (function () {\r\n function Serializer(logger) {\r\n dynamicProto(Serializer, this, function (_self) {\r\n /**\r\n * Serializes the current object to a JSON string.\r\n */\r\n _self.serialize = function (input) {\r\n var output = _serializeObject(input, \"root\");\r\n try {\r\n return getJSON().stringify(output);\r\n }\r\n catch (e) {\r\n // if serialization fails return an empty string\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && CoreUtils.isFunction(e.toString)) ? e.toString() : \"Error serializing object\", null, true);\r\n }\r\n };\r\n function _serializeObject(source, name) {\r\n var circularReferenceCheck = \"__aiCircularRefCheck\";\r\n var output = {};\r\n if (!source) {\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, \"cannot serialize object because it is null or undefined\", { name: name }, true);\r\n return output;\r\n }\r\n if (source[circularReferenceCheck]) {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CircularReferenceDetected, \"Circular reference detected while serializing object\", { name: name }, true);\r\n return output;\r\n }\r\n if (!source.aiDataContract) {\r\n // special case for measurements/properties/tags\r\n if (name === \"measurements\") {\r\n output = _serializeStringMap(source, \"number\", name);\r\n }\r\n else if (name === \"properties\") {\r\n output = _serializeStringMap(source, \"string\", name);\r\n }\r\n else if (name === \"tags\") {\r\n output = _serializeStringMap(source, \"string\", name);\r\n }\r\n else if (Util.isArray(source)) {\r\n output = _serializeArray(source, name);\r\n }\r\n else {\r\n logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, \"Attempting to serialize an object which does not implement ISerializable\", { name: name }, true);\r\n try {\r\n // verify that the object can be stringified\r\n getJSON().stringify(source);\r\n output = source;\r\n }\r\n catch (e) {\r\n // if serialization fails return an empty string\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && CoreUtils.isFunction(e.toString)) ? e.toString() : \"Error serializing object\", null, true);\r\n }\r\n }\r\n return output;\r\n }\r\n source[circularReferenceCheck] = true;\r\n for (var field in source.aiDataContract) {\r\n var contract = source.aiDataContract[field];\r\n var isRequired = (CoreUtils.isFunction(contract)) ? (contract() & FieldType.Required) : (contract & FieldType.Required);\r\n var isHidden = (CoreUtils.isFunction(contract)) ? (contract() & FieldType.Hidden) : (contract & FieldType.Hidden);\r\n var isArray = contract & FieldType.Array;\r\n var isPresent = source[field] !== undefined;\r\n var isObject = CoreUtils.isObject(source[field]) && source[field] !== null;\r\n if (isRequired && !isPresent && !isArray) {\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.MissingRequiredFieldSpecification, \"Missing required field specification. The field is required but not present on source\", { field: field, name: name });\r\n // If not in debug mode, continue and hope the error is permissible\r\n continue;\r\n }\r\n if (isHidden) {\r\n // Don't serialize hidden fields\r\n continue;\r\n }\r\n var value = void 0;\r\n if (isObject) {\r\n if (isArray) {\r\n // special case; recurse on each object in the source array\r\n value = _serializeArray(source[field], field);\r\n }\r\n else {\r\n // recurse on the source object in this field\r\n value = _serializeObject(source[field], field);\r\n }\r\n }\r\n else {\r\n // assign the source field to the output even if undefined or required\r\n value = source[field];\r\n }\r\n // only emit this field if the value is defined\r\n if (value !== undefined) {\r\n output[field] = value;\r\n }\r\n }\r\n delete source[circularReferenceCheck];\r\n return output;\r\n }\r\n function _serializeArray(sources, name) {\r\n var output;\r\n if (!!sources) {\r\n if (!Util.isArray(sources)) {\r\n logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ItemNotInArray, \"This field was specified as an array in the contract but the item is not an array.\\r\\n\", { name: name }, true);\r\n }\r\n else {\r\n output = [];\r\n for (var i = 0; i < sources.length; i++) {\r\n var source = sources[i];\r\n var item = _serializeObject(source, name + \"[\" + i + \"]\");\r\n output.push(item);\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n function _serializeStringMap(map, expectedType, name) {\r\n var output;\r\n if (map) {\r\n output = {};\r\n for (var field in map) {\r\n var value = map[field];\r\n if (expectedType === \"string\") {\r\n if (value === undefined) {\r\n output[field] = \"undefined\";\r\n }\r\n else if (value === null) {\r\n output[field] = \"null\";\r\n }\r\n else if (!value.toString) {\r\n output[field] = \"invalid field: toString() is not defined.\";\r\n }\r\n else {\r\n output[field] = value.toString();\r\n }\r\n }\r\n else if (expectedType === \"number\") {\r\n if (value === undefined) {\r\n output[field] = \"undefined\";\r\n }\r\n else if (value === null) {\r\n output[field] = \"null\";\r\n }\r\n else {\r\n var num = parseFloat(value);\r\n if (isNaN(num)) {\r\n output[field] = \"NaN\";\r\n }\r\n else {\r\n output[field] = num;\r\n }\r\n }\r\n }\r\n else {\r\n output[field] = \"invalid field: \" + name + \" is of unknown type.\";\r\n logger.throwInternal(LoggingSeverity.CRITICAL, output[field], null, true);\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n });\r\n }\r\n// Removed Stub for Serializer.prototype.serialize.\r\n return Serializer;\r\n}());\r\nexport { Serializer };\r\n//# sourceMappingURL=Serializer.js.map","/*!\n * Application Insights JavaScript SDK - Channel, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { CoreUtils, EventHelper, getWindow, getDocument, getNavigator } from '@microsoft/applicationinsights-core-js';\r\nimport dynamicProto from '@microsoft/dynamicproto-js';\r\n/**\r\n * @description Monitors browser for offline events\r\n * @export default - Offline: Static instance of OfflineListener\r\n * @class OfflineListener\r\n */\r\nvar OfflineListener = /** @class */ (function () {\r\n function OfflineListener() {\r\n var _window = getWindow();\r\n var _document = getDocument();\r\n var isListening = false;\r\n var _onlineStatus = true;\r\n dynamicProto(OfflineListener, this, function (_self) {\r\n try {\r\n if (_window) {\r\n if (EventHelper.Attach(_window, 'online', _setOnline)) {\r\n EventHelper.Attach(_window, 'offline', _setOffline);\r\n isListening = true;\r\n }\r\n }\r\n if (_document) {\r\n // Also attach to the document.body or document\r\n var target = _document.body || _document;\r\n if (!CoreUtils.isUndefined(target.ononline)) {\r\n target.ononline = _setOnline;\r\n target.onoffline = _setOffline;\r\n isListening = true;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // this makes react-native less angry\r\n isListening = false;\r\n }\r\n _self.isListening = isListening;\r\n _self.isOnline = function () {\r\n var result = true;\r\n var _navigator = getNavigator();\r\n if (isListening) {\r\n result = _onlineStatus;\r\n }\r\n else if (_navigator && !CoreUtils.isNullOrUndefined(_navigator.onLine)) {\r\n result = _navigator.onLine;\r\n }\r\n return result;\r\n };\r\n _self.isOffline = function () {\r\n return !_self.isOnline();\r\n };\r\n function _setOnline() {\r\n _onlineStatus = true;\r\n }\r\n function _setOffline() {\r\n _onlineStatus = false;\r\n }\r\n });\r\n }\r\n// Removed Stub for OfflineListener.prototype.isOnline.\r\n// Removed Stub for OfflineListener.prototype.isOffline.\r\n OfflineListener.Offline = new OfflineListener;\r\n return OfflineListener;\r\n}());\r\nexport { OfflineListener };\r\nexport var Offline = OfflineListener.Offline;\r\n//# sourceMappingURL=Offline.js.map","/*!\n * Application Insights JavaScript SDK - Channel, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nvar HashCodeScoreGenerator = /** @class */ (function () {\r\n function HashCodeScoreGenerator() {\r\n }\r\n HashCodeScoreGenerator.prototype.getHashCodeScore = function (key) {\r\n var score = this.getHashCode(key) / HashCodeScoreGenerator.INT_MAX_VALUE;\r\n return score * 100;\r\n };\r\n HashCodeScoreGenerator.prototype.getHashCode = function (input) {\r\n if (input === \"\") {\r\n return 0;\r\n }\r\n while (input.length < HashCodeScoreGenerator.MIN_INPUT_LENGTH) {\r\n input = input.concat(input);\r\n }\r\n // 5381 is a magic number: http://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function\r\n var hash = 5381;\r\n for (var i = 0; i < input.length; ++i) {\r\n hash = ((hash << 5) + hash) + input.charCodeAt(i);\r\n // 'hash' is of number type which means 53 bit integer (http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types-number-type)\r\n // 'hash & hash' will keep it 32 bit integer - just to make it clearer what the result is.\r\n hash = hash & hash;\r\n }\r\n return Math.abs(hash);\r\n };\r\n // We're using 32 bit math, hence max value is (2^31 - 1)\r\n HashCodeScoreGenerator.INT_MAX_VALUE = 2147483647;\r\n // (Magic number) DJB algorithm can't work on shorter strings (results in poor distribution\r\n HashCodeScoreGenerator.MIN_INPUT_LENGTH = 8;\r\n return HashCodeScoreGenerator;\r\n}());\r\nexport { HashCodeScoreGenerator };\r\n//# sourceMappingURL=HashCodeScoreGenerator.js.map","/*!\n * Application Insights JavaScript SDK - Channel, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { HashCodeScoreGenerator } from './HashCodeScoreGenerator';\r\nimport { ContextTagKeys } from '@microsoft/applicationinsights-common';\r\nvar SamplingScoreGenerator = /** @class */ (function () {\r\n function SamplingScoreGenerator() {\r\n this.hashCodeGeneragor = new HashCodeScoreGenerator();\r\n this.keys = new ContextTagKeys();\r\n }\r\n SamplingScoreGenerator.prototype.getSamplingScore = function (item) {\r\n var score = 0;\r\n if (item.tags && item.tags[this.keys.userId]) {\r\n score = this.hashCodeGeneragor.getHashCodeScore(item.tags[this.keys.userId]);\r\n }\r\n else if (item.ext && item.ext.user && item.ext.user.id) {\r\n score = this.hashCodeGeneragor.getHashCodeScore(item.ext.user.id);\r\n }\r\n else if (item.tags && item.tags[this.keys.operationId]) {\r\n score = this.hashCodeGeneragor.getHashCodeScore(item.tags[this.keys.operationId]);\r\n }\r\n else if (item.ext && item.ext.telemetryTrace && item.ext.telemetryTrace.traceID) {\r\n score = this.hashCodeGeneragor.getHashCodeScore(item.ext.telemetryTrace.traceID);\r\n }\r\n else {\r\n // tslint:disable-next-line:insecure-random\r\n score = (Math.random() * 100);\r\n }\r\n return score;\r\n };\r\n return SamplingScoreGenerator;\r\n}());\r\nexport { SamplingScoreGenerator };\r\n//# sourceMappingURL=SamplingScoreGenerator.js.map","/*!\n * Application Insights JavaScript SDK - Channel, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { SamplingScoreGenerator } from './SamplingScoreGenerators/SamplingScoreGenerator';\r\nimport { Metric } from '@microsoft/applicationinsights-common';\r\nimport { _InternalMessageId, LoggingSeverity, DiagnosticLogger, CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nvar Sample = /** @class */ (function () {\r\n function Sample(sampleRate, logger) {\r\n // We're using 32 bit math, hence max value is (2^31 - 1)\r\n this.INT_MAX_VALUE = 2147483647;\r\n this._logger = CoreUtils.isNullOrUndefined(logger) ? new DiagnosticLogger() : logger;\r\n if (sampleRate > 100 || sampleRate < 0) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SampleRateOutOfRange, \"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.\", { samplingRate: sampleRate }, true);\r\n this.sampleRate = 100;\r\n }\r\n this.sampleRate = sampleRate;\r\n this.samplingScoreGenerator = new SamplingScoreGenerator();\r\n }\r\n /**\r\n * Determines if an envelope is sampled in (i.e. will be sent) or not (i.e. will be dropped).\r\n */\r\n Sample.prototype.isSampledIn = function (envelope) {\r\n var samplingPercentage = this.sampleRate; // 0 - 100\r\n var isSampledIn = false;\r\n if (samplingPercentage === null || samplingPercentage === undefined || samplingPercentage >= 100) {\r\n return true;\r\n }\r\n else if (envelope.baseType === Metric.dataType) {\r\n // exclude MetricData telemetry from sampling\r\n return true;\r\n }\r\n isSampledIn = this.samplingScoreGenerator.getSamplingScore(envelope) < samplingPercentage;\r\n return isSampledIn;\r\n };\r\n return Sample;\r\n}());\r\nexport { Sample };\r\n//# sourceMappingURL=Sample.js.map","/*!\n * Application Insights JavaScript SDK - Channel, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { SessionStorageSendBuffer, ArraySendBuffer } from './SendBuffer';\r\nimport { DependencyEnvelopeCreator, EventEnvelopeCreator, ExceptionEnvelopeCreator, MetricEnvelopeCreator, PageViewEnvelopeCreator, PageViewPerformanceEnvelopeCreator, TraceEnvelopeCreator } from './EnvelopeCreator';\r\nimport { Serializer } from './Serializer'; // todo move to channel\r\nimport { DisabledPropertyName, RequestHeaders, Util, PageView, Event, Trace, Exception, Metric, PageViewPerformance, RemoteDependencyData, ProcessLegacy, BreezeChannelIdentifier, SampleRate } from '@microsoft/applicationinsights-common';\r\nimport { CoreUtils, _InternalMessageId, LoggingSeverity, getWindow, getNavigator, getJSON, BaseTelemetryPlugin, getGlobalInst } from '@microsoft/applicationinsights-core-js';\r\nimport { Offline } from './Offline';\r\nimport { Sample } from './TelemetryProcessors/Sample';\r\nimport dynamicProto from '@microsoft/dynamicproto-js';\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 null;\r\n}\r\nvar Sender = /** @class */ (function (_super) {\r\n __extends(Sender, _super);\r\n function Sender() {\r\n var _this = _super.call(this) || this;\r\n _this.priority = 1001;\r\n _this.identifier = BreezeChannelIdentifier;\r\n /**\r\n * Whether XMLHttpRequest object is supported. Older version of IE (8,9) do not support it.\r\n */\r\n _this._XMLHttpRequestSupported = false;\r\n /**\r\n * How many times in a row a retryable error condition has occurred.\r\n */\r\n var _consecutiveErrors;\r\n /**\r\n * The time to retry at in milliseconds from 1970/01/01 (this makes the timer calculation easy).\r\n */\r\n var _retryAt;\r\n /**\r\n * The time of the last send operation.\r\n */\r\n var _lastSend;\r\n /**\r\n * Handle to the timer for delayed sending of batches of data.\r\n */\r\n var _timeoutHandle;\r\n var _serializer;\r\n dynamicProto(Sender, _this, function (_self, _base) {\r\n function _notImplemented() {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n _self.pause = _notImplemented;\r\n _self.resume = _notImplemented;\r\n _self.flush = function () {\r\n try {\r\n _self.triggerSend(true, null, 1 /* ManualFlush */);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, \"flush failed, telemetry will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n };\r\n _self.onunloadFlush = function () {\r\n if ((_self._senderConfig.onunloadDisableBeacon() === false || _self._senderConfig.isBeaconApiDisabled() === false) && Util.IsBeaconApiSupported()) {\r\n try {\r\n _self.triggerSend(true, _beaconSender, 2 /* Unload */);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, \"failed to flush with beacon sender on page unload, telemetry will not be collected: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }\r\n else {\r\n _self.flush();\r\n }\r\n };\r\n _self.teardown = _notImplemented;\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n _base.initialize(config, core, extensions, pluginChain);\r\n var ctx = _self._getTelCtx();\r\n var identifier = _self.identifier;\r\n _serializer = new Serializer(core.logger);\r\n _consecutiveErrors = 0;\r\n _retryAt = null;\r\n _lastSend = 0;\r\n _self._sender = null;\r\n var defaultConfig = Sender._getDefaultAppInsightsChannelConfig();\r\n _self._senderConfig = Sender._getEmptyAppInsightsChannelConfig();\r\n var _loop_1 = function (field) {\r\n _self._senderConfig[field] = function () { return ctx.getConfig(identifier, field, defaultConfig[field]()); };\r\n };\r\n for (var field in defaultConfig) {\r\n _loop_1(field);\r\n }\r\n _self._buffer = (_self._senderConfig.enableSessionStorageBuffer() && Util.canUseSessionStorage())\r\n ? new SessionStorageSendBuffer(_self.diagLog(), _self._senderConfig) : new ArraySendBuffer(_self._senderConfig);\r\n _self._sample = new Sample(_self._senderConfig.samplingPercentage(), _self.diagLog());\r\n if (!_validateInstrumentationKey(config)) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, \"Invalid Instrumentation key \" + config.instrumentationKey);\r\n }\r\n if (!_self._senderConfig.isBeaconApiDisabled() && Util.IsBeaconApiSupported()) {\r\n _self._sender = _beaconSender;\r\n }\r\n else {\r\n if (typeof XMLHttpRequest !== undefined) {\r\n var xhr = getGlobalInst(\"XMLHttpRequest\");\r\n if (xhr) {\r\n var testXhr = new xhr();\r\n if (\"withCredentials\" in testXhr) {\r\n _self._sender = _xhrSender;\r\n _self._XMLHttpRequestSupported = true;\r\n }\r\n else if (typeof XDomainRequest !== undefined) {\r\n _self._sender = _xdrSender; // IE 8 and 9\r\n }\r\n }\r\n }\r\n }\r\n };\r\n _self.processTelemetry = function (telemetryItem, itemCtx) {\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n try {\r\n // if master off switch is set, don't send any data\r\n if (_self._senderConfig.disableTelemetry()) {\r\n // Do not send/save data\r\n return;\r\n }\r\n // validate input\r\n if (!telemetryItem) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, \"Cannot send empty telemetry\");\r\n return;\r\n }\r\n // validate event\r\n if (telemetryItem.baseData && !telemetryItem.baseType) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, \"Cannot send telemetry without baseData and baseType\");\r\n return;\r\n }\r\n if (!telemetryItem.baseType) {\r\n // Default\r\n telemetryItem.baseType = \"EventData\";\r\n }\r\n // ensure a sender was constructed\r\n if (!_self._sender) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, \"Sender was not initialized\");\r\n return;\r\n }\r\n // check if this item should be sampled in, else add sampleRate tag\r\n if (!_isSampledIn(telemetryItem)) {\r\n // Item is sampled out, do not send it\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, \"Telemetry item was sampled out and not sent\", { SampleRate: _self._sample.sampleRate });\r\n return;\r\n }\r\n else {\r\n telemetryItem[SampleRate] = _self._sample.sampleRate;\r\n }\r\n // construct an envelope that Application Insights endpoint can understand\r\n var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, _self._senderConfig.instrumentationKey(), itemCtx.diagLog());\r\n if (!aiEnvelope_1) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, \"Unable to create an AppInsights envelope\");\r\n return;\r\n }\r\n var doNotSendItem_1 = false;\r\n // this is for running in legacy mode, where customer may already have a custom initializer present\r\n if (telemetryItem.tags && telemetryItem.tags[ProcessLegacy]) {\r\n CoreUtils.arrForEach(telemetryItem.tags[ProcessLegacy], function (callBack) {\r\n try {\r\n if (callBack && callBack(aiEnvelope_1) === false) {\r\n doNotSendItem_1 = true;\r\n itemCtx.diagLog().warnToConsole(\"Telemetry processor check returns false\");\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 itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, \"One of telemetry initializers failed, telemetry item will not be sent: \" + Util.getExceptionName(e), { exception: Util.dump(e) }, true);\r\n }\r\n });\r\n delete telemetryItem.tags[ProcessLegacy];\r\n }\r\n if (doNotSendItem_1) {\r\n return; // do not send, no need to execute next plugin\r\n }\r\n // check if the incoming payload is too large, truncate if necessary\r\n var payload = _serializer.serialize(aiEnvelope_1);\r\n // flush if we would exceed the max-size limit by adding this item\r\n var bufferPayload = _self._buffer.getItems();\r\n var batch = _self._buffer.batchPayloads(bufferPayload);\r\n if (batch && (batch.length + payload.length > _self._senderConfig.maxBatchSizeInBytes())) {\r\n _self.triggerSend(true, null, 10 /* MaxBatchSize */);\r\n }\r\n // enqueue the payload\r\n _self._buffer.enqueue(payload);\r\n // ensure an invocation timeout is set\r\n _setupTimer();\r\n }\r\n catch (e) {\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, \"Failed adding telemetry to the sender's buffer, some telemetry will be lost: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n // hand off the telemetry item to the next plugin\r\n _self.processNext(telemetryItem, itemCtx);\r\n };\r\n /**\r\n * xhr state changes\r\n */\r\n _self._xhrReadyStateChange = function (xhr, payload, countOfItemsInPayload) {\r\n if (xhr.readyState === 4) {\r\n var response = null;\r\n if (!_self._appId) {\r\n response = _parseResponse(_getResponseText(xhr) || xhr.response);\r\n if (response && response.appId) {\r\n _self._appId = response.appId;\r\n }\r\n }\r\n if ((xhr.status < 200 || xhr.status >= 300) && xhr.status !== 0) {\r\n if (!_self._senderConfig.isRetryDisabled() && _isRetriable(xhr.status)) {\r\n _resendPayload(payload);\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". \" +\r\n \"Response code \" + xhr.status + \". Will retry to send \" + payload.length + \" items.\");\r\n }\r\n else {\r\n _self._onError(payload, _formatErrorMessageXhr(xhr));\r\n }\r\n }\r\n else if (Offline.isOffline()) {\r\n // Note: Don't check for status == 0, since adblock gives this code\r\n if (!_self._senderConfig.isRetryDisabled()) {\r\n var offlineBackOffMultiplier = 10; // arbritrary number\r\n _resendPayload(payload, offlineBackOffMultiplier);\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". Offline - Response Code: \" + xhr.status + \". Offline status: \" + Offline.isOffline() + \". Will retry to send \" + payload.length + \" items.\");\r\n }\r\n }\r\n else {\r\n if (xhr.status === 206) {\r\n if (!response) {\r\n response = _parseResponse(_getResponseText(xhr) || xhr.response);\r\n }\r\n if (response && !_self._senderConfig.isRetryDisabled()) {\r\n _self._onPartialSuccess(payload, response);\r\n }\r\n else {\r\n _self._onError(payload, _formatErrorMessageXhr(xhr));\r\n }\r\n }\r\n else {\r\n _consecutiveErrors = 0;\r\n _self._onSuccess(payload, countOfItemsInPayload);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Immediately send buffered data\r\n * @param async {boolean} - Indicates if the events should be sent asynchronously\r\n * @param forcedSender {SenderFunction} - Indicates the forcedSender, undefined if not passed\r\n */\r\n _self.triggerSend = function (async, forcedSender, sendReason) {\r\n if (async === void 0) { async = true; }\r\n try {\r\n // Send data only if disableTelemetry is false\r\n if (!_self._senderConfig.disableTelemetry()) {\r\n if (_self._buffer.count() > 0) {\r\n var payload = _self._buffer.getItems();\r\n _notifySendRequest(sendReason || 0 /* Undefined */, async);\r\n // invoke send\r\n if (forcedSender) {\r\n forcedSender.call(_this, payload, async);\r\n }\r\n else {\r\n _self._sender(payload, async);\r\n }\r\n }\r\n // update lastSend time to enable throttling\r\n _lastSend = +new Date;\r\n }\r\n else {\r\n _self._buffer.clear();\r\n }\r\n clearTimeout(_timeoutHandle);\r\n _timeoutHandle = null;\r\n _retryAt = null;\r\n }\r\n catch (e) {\r\n /* Ignore this error for IE under v10 */\r\n var ieVer = Util.getIEVersion();\r\n if (!ieVer || ieVer > 9) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, \"Telemetry transmission failed, some telemetry will be lost: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }\r\n };\r\n /**\r\n * error handler\r\n */\r\n _self._onError = function (payload, message, event) {\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.OnError, \"Failed to send telemetry.\", { message: message });\r\n _self._buffer.clearSent(payload);\r\n };\r\n /**\r\n * partial success handler\r\n */\r\n _self._onPartialSuccess = function (payload, results) {\r\n var failed = [];\r\n var retry = [];\r\n // Iterate through the reversed array of errors so that splicing doesn't have invalid indexes after the first item.\r\n var errors = results.errors.reverse();\r\n for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {\r\n var error = errors_1[_i];\r\n var extracted = payload.splice(error.index, 1)[0];\r\n if (_isRetriable(error.statusCode)) {\r\n retry.push(extracted);\r\n }\r\n else {\r\n // All other errors, including: 402 (Monthly quota exceeded) and 439 (Too many requests and refresh cache).\r\n failed.push(extracted);\r\n }\r\n }\r\n if (payload.length > 0) {\r\n _self._onSuccess(payload, results.itemsAccepted);\r\n }\r\n if (failed.length > 0) {\r\n _self._onError(failed, _formatErrorMessageXhr(null, ['partial success', results.itemsAccepted, 'of', results.itemsReceived].join(' ')));\r\n }\r\n if (retry.length > 0) {\r\n _resendPayload(retry);\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \"Partial success. \" +\r\n \"Delivered: \" + payload.length + \", Failed: \" + failed.length +\r\n \". Will retry to send \" + retry.length + \" our of \" + results.itemsReceived + \" items\");\r\n }\r\n };\r\n /**\r\n * success handler\r\n */\r\n _self._onSuccess = function (payload, countOfItemsInPayload) {\r\n _self._buffer.clearSent(payload);\r\n };\r\n /**\r\n * xdr state changes\r\n */\r\n _self._xdrOnLoad = function (xdr, payload) {\r\n var responseText = _getResponseText(xdr);\r\n if (xdr && (responseText + \"\" === \"200\" || responseText === \"\")) {\r\n _consecutiveErrors = 0;\r\n _self._onSuccess(payload, 0);\r\n }\r\n else {\r\n var results = _parseResponse(responseText);\r\n if (results && results.itemsReceived && results.itemsReceived > results.itemsAccepted\r\n && !_self._senderConfig.isRetryDisabled()) {\r\n _self._onPartialSuccess(payload, results);\r\n }\r\n else {\r\n _self._onError(payload, _formatErrorMessageXdr(xdr));\r\n }\r\n }\r\n };\r\n function _isSampledIn(envelope) {\r\n return _self._sample.isSampledIn(envelope);\r\n }\r\n /**\r\n * Send Beacon API request\r\n * @param payload {string} - The data payload to be sent.\r\n * @param isAsync {boolean} - not used\r\n * Note: Beacon API does not support custom headers and we are not able to get\r\n * appId from the backend for the correct correlation.\r\n */\r\n function _beaconSender(payload, isAsync) {\r\n var url = _self._senderConfig.endpointUrl();\r\n var batch = _self._buffer.batchPayloads(payload);\r\n // Chrome only allows CORS-safelisted values for the sendBeacon data argument\r\n // see: https://bugs.chromium.org/p/chromium/issues/detail?id=720283\r\n var plainTextBatch = new Blob([batch], { type: 'text/plain;charset=UTF-8' });\r\n // The sendBeacon method returns true if the user agent is able to successfully queue the data for transfer. Otherwise it returns false.\r\n var queued = getNavigator().sendBeacon(url, plainTextBatch);\r\n if (queued) {\r\n _self._buffer.markAsSent(payload);\r\n // no response from beaconSender, clear buffer\r\n _self._onSuccess(payload, payload.length);\r\n }\r\n else {\r\n _xhrSender(payload, true);\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". \" + \"Failed to send telemetry with Beacon API, retried with xhrSender.\");\r\n }\r\n }\r\n /**\r\n * Send XMLHttpRequest\r\n * @param payload {string} - The data payload to be sent.\r\n * @param isAsync {boolean} - Indicates if the request should be sent asynchronously\r\n */\r\n function _xhrSender(payload, isAsync) {\r\n var xhr = new XMLHttpRequest();\r\n var endPointUrl = _self._senderConfig.endpointUrl();\r\n try {\r\n xhr[DisabledPropertyName] = true;\r\n }\r\n catch (e) {\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 }\r\n xhr.open(\"POST\", endPointUrl, isAsync);\r\n xhr.setRequestHeader(\"Content-type\", \"application/json\");\r\n // append Sdk-Context request header only in case of breeze endpoint\r\n if (Util.isInternalApplicationInsightsEndpoint(endPointUrl)) {\r\n xhr.setRequestHeader(RequestHeaders.sdkContextHeader, RequestHeaders.sdkContextHeaderAppIdRequest);\r\n }\r\n xhr.onreadystatechange = function () { return _self._xhrReadyStateChange(xhr, payload, payload.length); };\r\n xhr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXhr(xhr), event); };\r\n // compose an array of payloads\r\n var batch = _self._buffer.batchPayloads(payload);\r\n xhr.send(batch);\r\n _self._buffer.markAsSent(payload);\r\n }\r\n /**\r\n * Parses the response from the backend.\r\n * @param response - XMLHttpRequest or XDomainRequest response\r\n */\r\n function _parseResponse(response) {\r\n try {\r\n if (response && response !== \"\") {\r\n var result = getJSON().parse(response);\r\n if (result && result.itemsReceived && result.itemsReceived >= result.itemsAccepted &&\r\n result.itemsReceived - result.itemsAccepted === result.errors.length) {\r\n return result;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, \"Cannot parse the response. \" + Util.getExceptionName(e), {\r\n response: response\r\n });\r\n }\r\n return null;\r\n }\r\n /**\r\n * Resend payload. Adds payload back to the send buffer and setup a send timer (with exponential backoff).\r\n * @param payload\r\n */\r\n function _resendPayload(payload, linearFactor) {\r\n if (linearFactor === void 0) { linearFactor = 1; }\r\n if (!payload || payload.length === 0) {\r\n return;\r\n }\r\n _self._buffer.clearSent(payload);\r\n _consecutiveErrors++;\r\n for (var _i = 0, payload_1 = payload; _i < payload_1.length; _i++) {\r\n var item = payload_1[_i];\r\n _self._buffer.enqueue(item);\r\n }\r\n // setup timer\r\n _setRetryTime(linearFactor);\r\n _setupTimer();\r\n }\r\n /**\r\n * Calculates the time to wait before retrying in case of an error based on\r\n * http://en.wikipedia.org/wiki/Exponential_backoff\r\n */\r\n function _setRetryTime(linearFactor) {\r\n var SlotDelayInSeconds = 10;\r\n var delayInSeconds;\r\n if (_consecutiveErrors <= 1) {\r\n delayInSeconds = SlotDelayInSeconds;\r\n }\r\n else {\r\n var backOffSlot = (Math.pow(2, _consecutiveErrors) - 1) / 2;\r\n // tslint:disable-next-line:insecure-random\r\n var backOffDelay = Math.floor(Math.random() * backOffSlot * SlotDelayInSeconds) + 1;\r\n backOffDelay = linearFactor * backOffDelay;\r\n delayInSeconds = Math.max(Math.min(backOffDelay, 3600), SlotDelayInSeconds);\r\n }\r\n // TODO: Log the backoff time like the C# version does.\r\n var retryAfterTimeSpan = CoreUtils.dateNow() + (delayInSeconds * 1000);\r\n // TODO: Log the retry at time like the C# version does.\r\n _retryAt = retryAfterTimeSpan;\r\n }\r\n /**\r\n * Sets up the timer which triggers actually sending the data.\r\n */\r\n function _setupTimer() {\r\n if (!_timeoutHandle) {\r\n var retryInterval = _retryAt ? Math.max(0, _retryAt - CoreUtils.dateNow()) : 0;\r\n var timerValue = Math.max(_self._senderConfig.maxBatchInterval(), retryInterval);\r\n _timeoutHandle = setTimeout(function () {\r\n _self.triggerSend(true, null, 1 /* NormalSchedule */);\r\n }, timerValue);\r\n }\r\n }\r\n /**\r\n * Checks if the SDK should resend the payload after receiving this status code from the backend.\r\n * @param statusCode\r\n */\r\n function _isRetriable(statusCode) {\r\n return statusCode === 408 // Timeout\r\n || statusCode === 429 // Too many requests.\r\n || statusCode === 500 // Internal server error.\r\n || statusCode === 503; // Service unavailable.\r\n }\r\n function _formatErrorMessageXhr(xhr, message) {\r\n if (xhr) {\r\n return \"XMLHttpRequest,Status:\" + xhr.status + \",Response:\" + _getResponseText(xhr) || xhr.response || \"\";\r\n }\r\n return message;\r\n }\r\n /**\r\n * Send XDomainRequest\r\n * @param payload {string} - The data payload to be sent.\r\n * @param isAsync {boolean} - Indicates if the request should be sent asynchronously\r\n *\r\n * Note: XDomainRequest does not support sync requests. This 'isAsync' parameter is added\r\n * to maintain consistency with the xhrSender's contract\r\n * Note: XDomainRequest does not support custom headers and we are not able to get\r\n * appId from the backend for the correct correlation.\r\n */\r\n function _xdrSender(payload, isAsync) {\r\n var _window = getWindow();\r\n var xdr = new XDomainRequest();\r\n xdr.onload = function () { return _self._xdrOnLoad(xdr, payload); };\r\n xdr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXdr(xdr), event); };\r\n // XDomainRequest requires the same protocol as the hosting page.\r\n // If the protocol doesn't match, we can't send the telemetry :(.\r\n var hostingProtocol = _window && _window.location && _window.location.protocol || \"\";\r\n if (_self._senderConfig.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {\r\n _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". \" +\r\n \"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.\");\r\n _self._buffer.clear();\r\n return;\r\n }\r\n var endpointUrl = _self._senderConfig.endpointUrl().replace(/^(https?:)/, \"\");\r\n xdr.open('POST', endpointUrl);\r\n // compose an array of payloads\r\n var batch = _self._buffer.batchPayloads(payload);\r\n xdr.send(batch);\r\n _self._buffer.markAsSent(payload);\r\n }\r\n function _formatErrorMessageXdr(xdr, message) {\r\n if (xdr) {\r\n return \"XDomainRequest,Response:\" + _getResponseText(xdr) || \"\";\r\n }\r\n return message;\r\n }\r\n // Using function lookups for backward compatibility as the getNotifyMgr() did not exist until after v2.5.6\r\n function _getNotifyMgr() {\r\n var func = 'getNotifyMgr';\r\n if (_self.core[func]) {\r\n return _self.core[func]();\r\n }\r\n // using _self.core['_notificationManager'] for backward compatibility\r\n return _self.core['_notificationManager'];\r\n }\r\n function _notifySendRequest(sendRequest, isAsync) {\r\n var manager = _getNotifyMgr();\r\n if (manager && manager.eventsSendRequest) {\r\n try {\r\n manager.eventsSendRequest(sendRequest, isAsync);\r\n }\r\n catch (e) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, \"send request notification failed: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }\r\n }\r\n /**\r\n * Validate UUID Format\r\n * Specs taken from https://tools.ietf.org/html/rfc4122 and breeze repo\r\n */\r\n function _validateInstrumentationKey(config) {\r\n var disableIKeyValidationFlag = CoreUtils.isNullOrUndefined(config.disableInstrumentaionKeyValidation) ? false : config.disableInstrumentaionKeyValidation;\r\n if (disableIKeyValidationFlag) {\r\n return true;\r\n }\r\n var UUID_Regex = '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$';\r\n var regexp = new RegExp(UUID_Regex);\r\n return regexp.test(config.instrumentationKey);\r\n }\r\n });\r\n return _this;\r\n }\r\n Sender.constructEnvelope = function (orig, iKey, logger) {\r\n var envelope;\r\n if (iKey !== orig.iKey && !CoreUtils.isNullOrUndefined(iKey)) {\r\n envelope = __assign({}, orig, { iKey: iKey });\r\n }\r\n else {\r\n envelope = orig;\r\n }\r\n switch (envelope.baseType) {\r\n case Event.dataType:\r\n return EventEnvelopeCreator.EventEnvelopeCreator.Create(logger, envelope);\r\n case Trace.dataType:\r\n return TraceEnvelopeCreator.TraceEnvelopeCreator.Create(logger, envelope);\r\n case PageView.dataType:\r\n return PageViewEnvelopeCreator.PageViewEnvelopeCreator.Create(logger, envelope);\r\n case PageViewPerformance.dataType:\r\n return PageViewPerformanceEnvelopeCreator.PageViewPerformanceEnvelopeCreator.Create(logger, envelope);\r\n case Exception.dataType:\r\n return ExceptionEnvelopeCreator.ExceptionEnvelopeCreator.Create(logger, envelope);\r\n case Metric.dataType:\r\n return MetricEnvelopeCreator.MetricEnvelopeCreator.Create(logger, envelope);\r\n case RemoteDependencyData.dataType:\r\n return DependencyEnvelopeCreator.DependencyEnvelopeCreator.Create(logger, envelope);\r\n default:\r\n return EventEnvelopeCreator.EventEnvelopeCreator.Create(logger, envelope);\r\n }\r\n };\r\n Sender._getDefaultAppInsightsChannelConfig = function () {\r\n // set default values\r\n return {\r\n endpointUrl: function () { return \"https://dc.services.visualstudio.com/v2/track\"; },\r\n emitLineDelimitedJson: function () { return false; },\r\n maxBatchInterval: function () { return 15000; },\r\n maxBatchSizeInBytes: function () { return 102400; },\r\n disableTelemetry: function () { return false; },\r\n enableSessionStorageBuffer: function () { return true; },\r\n isRetryDisabled: function () { return false; },\r\n isBeaconApiDisabled: function () { return true; },\r\n onunloadDisableBeacon: function () { return false; },\r\n instrumentationKey: function () { return undefined; },\r\n namePrefix: function () { return undefined; },\r\n samplingPercentage: function () { return 100; }\r\n };\r\n };\r\n Sender._getEmptyAppInsightsChannelConfig = function () {\r\n return {\r\n endpointUrl: undefined,\r\n emitLineDelimitedJson: undefined,\r\n maxBatchInterval: undefined,\r\n maxBatchSizeInBytes: undefined,\r\n disableTelemetry: undefined,\r\n enableSessionStorageBuffer: undefined,\r\n isRetryDisabled: undefined,\r\n isBeaconApiDisabled: undefined,\r\n onunloadDisableBeacon: undefined,\r\n instrumentationKey: undefined,\r\n namePrefix: undefined,\r\n samplingPercentage: undefined\r\n };\r\n };\r\n// Removed Stub for Sender.prototype.pause.\r\n// Removed Stub for Sender.prototype.resume.\r\n// Removed Stub for Sender.prototype.flush.\r\n// Removed Stub for Sender.prototype.onunloadFlush.\r\n// Removed Stub for Sender.prototype.teardown.\r\n// Removed Stub for Sender.prototype.initialize.\r\n// Removed Stub for Sender.prototype.processTelemetry.\r\n// Removed Stub for Sender.prototype._xhrReadyStateChange.\r\n// Removed Stub for Sender.prototype.triggerSend.\r\n// Removed Stub for Sender.prototype._onError.\r\n// Removed Stub for Sender.prototype._onPartialSuccess.\r\n// Removed Stub for Sender.prototype._onSuccess.\r\n// Removed Stub for Sender.prototype._xdrOnLoad.\r\n return Sender;\r\n}(BaseTelemetryPlugin));\r\nexport { Sender };\r\n//# sourceMappingURL=Sender.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Util } from '@microsoft/applicationinsights-common';\r\nimport { _InternalMessageId, LoggingSeverity, CoreUtils, DiagnosticLogger } from '@microsoft/applicationinsights-core-js';\r\nvar Session = /** @class */ (function () {\r\n function Session() {\r\n }\r\n return Session;\r\n}());\r\nexport { Session };\r\nvar _SessionManager = /** @class */ (function () {\r\n function _SessionManager(config, logger) {\r\n var _this = this;\r\n if (CoreUtils.isNullOrUndefined(logger)) {\r\n this._logger = new DiagnosticLogger();\r\n }\r\n else {\r\n this._logger = logger;\r\n }\r\n if (!config) {\r\n config = {};\r\n }\r\n if (!(typeof config.sessionExpirationMs === \"function\")) {\r\n config.sessionExpirationMs = function () { return _SessionManager.acquisitionSpan; };\r\n }\r\n if (!(typeof config.sessionRenewalMs === \"function\")) {\r\n config.sessionRenewalMs = function () { return _SessionManager.renewalSpan; };\r\n }\r\n this.config = config;\r\n this._storageNamePrefix = function () { return _this.config.namePrefix && _this.config.namePrefix() ? _SessionManager.cookieNameConst + _this.config.namePrefix() : _SessionManager.cookieNameConst; };\r\n this.automaticSession = new Session();\r\n }\r\n _SessionManager.prototype.update = function () {\r\n if (!this.automaticSession.id) {\r\n this.initializeAutomaticSession();\r\n }\r\n // Always using Date getTime() as there is a bug in older IE instances that causes the performance timings to have the hi-bit set eg 0x800000000 causing\r\n // the number to be incorrect.\r\n var now = new Date().getTime();\r\n var acquisitionExpired = this.config.sessionExpirationMs() === 0 ? false : now - this.automaticSession.acquisitionDate > this.config.sessionExpirationMs();\r\n var renewalExpired = this.config.sessionExpirationMs() === 0 ? false : now - this.automaticSession.renewalDate > this.config.sessionRenewalMs();\r\n // renew if acquisitionSpan or renewalSpan has elapsed\r\n if (acquisitionExpired || renewalExpired) {\r\n // update automaticSession so session state has correct id\r\n this.renew();\r\n }\r\n else {\r\n // do not update the cookie more often than cookieUpdateInterval\r\n if (!this.cookieUpdatedTimestamp || now - this.cookieUpdatedTimestamp > _SessionManager.cookieUpdateInterval) {\r\n this.automaticSession.renewalDate = now;\r\n this.setCookie(this.automaticSession.id, this.automaticSession.acquisitionDate, this.automaticSession.renewalDate);\r\n }\r\n }\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 this.setStorage(this.automaticSession.id, this.automaticSession.acquisitionDate, this.automaticSession.renewalDate);\r\n };\r\n /**\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 _SessionManager.prototype.initializeAutomaticSession = function () {\r\n var cookie = Util.getCookie(this._logger, this._storageNamePrefix());\r\n if (cookie && typeof cookie.split === \"function\") {\r\n this.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 = Util.getStorage(this._logger, this._storageNamePrefix());\r\n if (storage) {\r\n this.initializeAutomaticSessionWithData(storage);\r\n }\r\n }\r\n if (!this.automaticSession.id) {\r\n this.renew();\r\n }\r\n };\r\n /**\r\n * Extract id, acquisitionDate, and renewalDate from an ai_session payload string and\r\n * use this data to initialize automaticSession.\r\n *\r\n * @param {string} sessionData - The string stored in an ai_session cookie or local storage backup\r\n */\r\n _SessionManager.prototype.initializeAutomaticSessionWithData = function (sessionData) {\r\n var params = sessionData.split(\"|\");\r\n if (params.length > 0) {\r\n this.automaticSession.id = params[0];\r\n }\r\n try {\r\n if (params.length > 1) {\r\n var acq = +params[1];\r\n this.automaticSession.acquisitionDate = +new Date(acq);\r\n this.automaticSession.acquisitionDate = this.automaticSession.acquisitionDate > 0 ? this.automaticSession.acquisitionDate : 0;\r\n }\r\n if (params.length > 2) {\r\n var renewal = +params[2];\r\n this.automaticSession.renewalDate = +new Date(renewal);\r\n this.automaticSession.renewalDate = this.automaticSession.renewalDate > 0 ? this.automaticSession.renewalDate : 0;\r\n }\r\n }\r\n catch (e) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ErrorParsingAISessionCookie, \"Error parsing ai_session cookie, session will be reset: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n if (this.automaticSession.renewalDate === 0) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, \"AI session renewal date is 0, session will be reset.\");\r\n }\r\n };\r\n _SessionManager.prototype.renew = function () {\r\n var now = new Date().getTime();\r\n this.automaticSession.id = Util.newId((this.config && this.config.idLength) ? this.config.idLength() : 22);\r\n this.automaticSession.acquisitionDate = now;\r\n this.automaticSession.renewalDate = now;\r\n this.setCookie(this.automaticSession.id, this.automaticSession.acquisitionDate, this.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 (!Util.canUseLocalStorage()) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserDoesNotSupportLocalStorage, \"Browser does not support local storage. Session durations will be inaccurate.\");\r\n }\r\n };\r\n _SessionManager.prototype.setCookie = function (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 + this.config.sessionExpirationMs();\r\n var renewalExpiry = renewal + this.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 = this.config.cookieDomain ? this.config.cookieDomain() : null;\r\n // if sessionExpirationMs is set to 0, it means the expiry is set to 0 for this session cookie\r\n // A cookie with 0 expiry in the session cookie will never expire for that browser session. If the browser is closed the cookie expires. \r\n // Another browser instance does not inherit this cookie.\r\n var UTCString = this.config.sessionExpirationMs() === 0 ? '0' : cookieExpiry.toUTCString();\r\n Util.setCookie(this._logger, this._storageNamePrefix(), cookie.join('|') + ';expires=' + UTCString, cookieDomain);\r\n this.cookieUpdatedTimestamp = new Date().getTime();\r\n };\r\n _SessionManager.prototype.setStorage = function (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 Util.setStorage(this._logger, this._storageNamePrefix(), [guid, acq, renewal].join('|'));\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 _SessionManager.cookieNameConst = 'ai_session';\r\n return _SessionManager;\r\n}());\r\nexport { _SessionManager };\r\n//# sourceMappingURL=Session.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Application = /** @class */ (function () {\r\n function Application() {\r\n }\r\n return Application;\r\n}());\r\nexport { Application };\r\n//# sourceMappingURL=Application.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Device = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the Device class\r\n */\r\n function Device() {\r\n // don't attempt to fingerprint browsers\r\n this.id = \"browser\";\r\n // Device type is a dimension in our data platform\r\n // Setting it to 'Browser' allows to separate client and server dependencies/exceptions\r\n this.deviceClass = \"Browser\";\r\n }\r\n return Device;\r\n}());\r\nexport { Device };\r\n//# sourceMappingURL=Device.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Version = \"2.5.9\";\r\nvar Internal = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the internal telemetry data class.\r\n */\r\n function Internal(config) {\r\n this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + \"_\" : \"\") + \"javascript:\" + Version;\r\n }\r\n return Internal;\r\n}());\r\nexport { Internal };\r\n//# sourceMappingURL=Internal.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Util } from '@microsoft/applicationinsights-common';\r\nimport { _InternalMessageId, LoggingSeverity, CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nvar User = /** @class */ (function () {\r\n function User(config, logger) {\r\n this.isNewUser = false;\r\n this._logger = logger;\r\n // get userId or create new one if none exists\r\n var cookie = Util.getCookie(this._logger, User.userCookieName);\r\n if (cookie) {\r\n this.isNewUser = false;\r\n var params = cookie.split(User.cookieSeparator);\r\n if (params.length > 0) {\r\n this.id = params[0];\r\n }\r\n }\r\n this.config = config;\r\n if (!this.id) {\r\n this.id = CoreUtils.newId(config && config.idLength ? config.idLength() : 22);\r\n var date = new Date();\r\n var acqStr = CoreUtils.toISOString(date);\r\n this.accountAcquisitionDate = acqStr;\r\n this.isNewUser = true;\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 = 31536000000 \r\n date.setTime(date.getTime() + 31536000000);\r\n var newCookie = [this.id, acqStr];\r\n var cookieDomain = this.config.cookieDomain ? this.config.cookieDomain() : undefined;\r\n Util.setCookie(this._logger, User.userCookieName, newCookie.join(User.cookieSeparator) + ';expires=' + date.toUTCString(), cookieDomain);\r\n // If we have an config.namePrefix() + ai_session in local storage this means the user actively removed our cookies.\r\n // We should respect their wishes and clear ourselves from local storage\r\n var name_1 = config.namePrefix && config.namePrefix() ? config.namePrefix() + 'ai_session' : 'ai_session';\r\n Util.removeStorage(this._logger, name_1);\r\n }\r\n // We still take the account id from the ctor param for backward compatibility. \r\n // But if the the customer set the accountId through the newer setAuthenticatedUserContext API, we will override it.\r\n this.accountId = config.accountId ? config.accountId() : undefined;\r\n // Get the auth user id and account id from the cookie if exists\r\n // Cookie is in the pattern: |\r\n var authCookie = Util.getCookie(this._logger, User.authUserCookieName);\r\n if (authCookie) {\r\n authCookie = decodeURI(authCookie);\r\n var authCookieString = authCookie.split(User.cookieSeparator);\r\n if (authCookieString[0]) {\r\n this.authenticatedId = authCookieString[0];\r\n }\r\n if (authCookieString.length > 1 && authCookieString[1]) {\r\n this.accountId = authCookieString[1];\r\n }\r\n }\r\n }\r\n /**\r\n * Sets the authenticated user id and the account id in this session.\r\n *\r\n * @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.\r\n * @param accountId {string} - An optional string to represent the account associated with the authenticated user.\r\n */\r\n User.prototype.setAuthenticatedUserContext = function (authenticatedUserId, accountId, storeInCookie) {\r\n if (storeInCookie === void 0) { storeInCookie = false; }\r\n // Validate inputs to ensure no cookie control characters.\r\n var isInvalidInput = !this.validateUserInput(authenticatedUserId) || (accountId && !this.validateUserInput(accountId));\r\n if (isInvalidInput) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SetAuthContextFailedAccountName, \"Setting auth user context failed. \" +\r\n \"User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.\", true);\r\n return;\r\n }\r\n // Create cookie string.\r\n this.authenticatedId = authenticatedUserId;\r\n var authCookie = this.authenticatedId;\r\n if (accountId) {\r\n this.accountId = accountId;\r\n authCookie = [this.authenticatedId, this.accountId].join(User.cookieSeparator);\r\n }\r\n if (storeInCookie) {\r\n // Set the cookie. No expiration date because this is a session cookie (expires when browser closed).\r\n // Encoding the cookie to handle unexpected unicode characters.\r\n Util.setCookie(this._logger, User.authUserCookieName, encodeURI(authCookie), this.config.cookieDomain());\r\n }\r\n };\r\n /**\r\n * Clears the authenticated user id and the account id from the user context.\r\n * @returns {}\r\n */\r\n User.prototype.clearAuthenticatedUserContext = function () {\r\n this.authenticatedId = null;\r\n this.accountId = null;\r\n Util.deleteCookie(this._logger, User.authUserCookieName);\r\n };\r\n User.prototype.validateUserInput = function (id) {\r\n // Validate:\r\n // 1. Id is a non-empty string.\r\n // 2. It does not contain special characters for cookies.\r\n if (typeof id !== 'string' ||\r\n !id ||\r\n id.match(/,|;|=| |\\|/)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n User.cookieSeparator = '|';\r\n User.userCookieName = 'ai_user';\r\n User.authUserCookieName = 'ai_authUser';\r\n return User;\r\n}());\r\nexport { User };\r\n//# sourceMappingURL=User.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Location = /** @class */ (function () {\r\n function Location() {\r\n }\r\n return Location;\r\n}());\r\nexport { Location };\r\n//# sourceMappingURL=Location.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Util, DataSanitizer } from '@microsoft/applicationinsights-common';\r\nimport { getLocation } from '@microsoft/applicationinsights-core-js';\r\nvar TelemetryTrace = /** @class */ (function () {\r\n function TelemetryTrace(id, parentId, name, logger) {\r\n this.traceID = id || Util.generateW3CId();\r\n this.parentID = parentId;\r\n this.name = name;\r\n var location = getLocation();\r\n if (!name && location && location.pathname) {\r\n this.name = location.pathname;\r\n }\r\n this.name = DataSanitizer.sanitizeString(logger, this.name);\r\n }\r\n return TelemetryTrace;\r\n}());\r\nexport { TelemetryTrace };\r\n//# sourceMappingURL=TelemetryTrace.js.map","/**\r\n * PropertiesPlugin.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport { CoreUtils, hasWindow, _InternalLogMessage } from '@microsoft/applicationinsights-core-js';\r\nimport { Session, _SessionManager } from './Context/Session';\r\nimport { Extensions, CtxTagKeys, PageView } from '@microsoft/applicationinsights-common';\r\nimport { Application } from './Context/Application';\r\nimport { Device } from './Context/Device';\r\nimport { Internal } from './Context/Internal';\r\nimport { User } from './Context/User';\r\nimport { Location } from './Context/Location';\r\nimport { TelemetryTrace } from './Context/TelemetryTrace';\r\nvar TelemetryContext = /** @class */ (function () {\r\n function TelemetryContext(logger, defaultConfig) {\r\n var _self = this;\r\n _self.application = new Application();\r\n _self.internal = new Internal(defaultConfig);\r\n if (hasWindow()) {\r\n _self.sessionManager = new _SessionManager(defaultConfig, logger);\r\n _self.device = new Device();\r\n _self.location = new Location();\r\n _self.user = new User(defaultConfig, logger);\r\n _self.telemetryTrace = new TelemetryTrace(undefined, undefined, undefined, logger);\r\n _self.session = new Session();\r\n }\r\n _self.appId = function () { return null; };\r\n }\r\n TelemetryContext.prototype.applySessionContext = function (event, itemCtx) {\r\n var session = this.session;\r\n var sessionManager = this.sessionManager;\r\n var sessionContext = session || (sessionManager && sessionManager.automaticSession);\r\n if (sessionContext) {\r\n if (CoreUtils.isString(sessionContext.id)) {\r\n event.ext.app.sesId = sessionContext.id;\r\n }\r\n }\r\n if (session) {\r\n // If customer set session info, apply his context; otherwise apply context automatically generated\r\n if (CoreUtils.isString(session.id)) {\r\n event.ext.app.sesId = session.id;\r\n }\r\n else {\r\n event.ext.app.sesId = sessionManager.automaticSession.id;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyOperatingSystemContxt = function (event, itemCtx) {\r\n var os = this.os;\r\n if (os && os.name) {\r\n event.ext.os = os;\r\n }\r\n };\r\n TelemetryContext.prototype.applyApplicationContext = function (event, itemCtx) {\r\n var application = this.application;\r\n if (application) {\r\n if (CoreUtils.isString(application.ver)) {\r\n event.tags[CtxTagKeys.applicationVersion] = application.ver;\r\n }\r\n if (CoreUtils.isString(application.build)) {\r\n event.tags[CtxTagKeys.applicationBuild] = application.build;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyDeviceContext = function (event, itemCtx) {\r\n var device = this.device;\r\n if (device) {\r\n if (CoreUtils.isString(device.id)) {\r\n event.ext.device.localId = device.id;\r\n }\r\n if (CoreUtils.isString(device.ip)) {\r\n event.ext.device.ip = device.ip;\r\n }\r\n if (CoreUtils.isString(device.model)) {\r\n event.ext.device.model = device.model;\r\n }\r\n if (CoreUtils.isString(device.deviceClass)) {\r\n event.ext.device.deviceClass = device.deviceClass;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyInternalContext = function (event, itemCtx) {\r\n var internal = this.internal;\r\n if (internal) {\r\n if (CoreUtils.isString(internal.agentVersion)) {\r\n event.tags[CtxTagKeys.internalAgentVersion] = internal.agentVersion; // not mapped in CS 4.0\r\n }\r\n if (CoreUtils.isString(internal.sdkVersion)) {\r\n event.tags[CtxTagKeys.internalSdkVersion] = internal.sdkVersion;\r\n }\r\n if (event.baseType === _InternalLogMessage.dataType || event.baseType === PageView.dataType) {\r\n if (CoreUtils.isString(internal.snippetVer)) {\r\n event.tags[CtxTagKeys.internalSnippet] = internal.snippetVer;\r\n }\r\n if (CoreUtils.isString(internal.sdkSrc)) {\r\n event.tags[CtxTagKeys.internalSdkSrc] = internal.sdkSrc;\r\n }\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyLocationContext = function (event, itemCtx) {\r\n var location = this.location;\r\n if (location) {\r\n if (CoreUtils.isString(location.ip)) {\r\n event.tags[CtxTagKeys.locationIp] = location.ip;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyOperationContext = function (event, itemCtx) {\r\n var telemetryTrace = this.telemetryTrace;\r\n if (telemetryTrace) {\r\n var trace = event.ext.trace || { traceID: undefined, parentID: undefined };\r\n if (CoreUtils.isString(telemetryTrace.traceID)) {\r\n trace.traceID = telemetryTrace.traceID;\r\n }\r\n if (CoreUtils.isString(telemetryTrace.name)) {\r\n trace.name = telemetryTrace.name;\r\n }\r\n if (CoreUtils.isString(telemetryTrace.parentID)) {\r\n trace.parentID = telemetryTrace.parentID;\r\n }\r\n event.ext.trace = trace;\r\n }\r\n };\r\n TelemetryContext.prototype.applyWebContext = function (event, itemCtx) {\r\n var web = this.web;\r\n if (web) {\r\n event.ext.web = event.ext.web || {};\r\n event.ext.web = web;\r\n }\r\n };\r\n TelemetryContext.prototype.applyUserContext = function (event, itemCtx) {\r\n var user = this.user;\r\n if (user) {\r\n if (!event.tags) {\r\n event.tags = [];\r\n }\r\n // stays in tags\r\n if (CoreUtils.isString(user.accountId)) {\r\n event.tags[CtxTagKeys.userAccountId] = user.accountId;\r\n }\r\n // CS 4.0\r\n if (CoreUtils.isString(user.id)) {\r\n event.ext.user.id = user.id;\r\n }\r\n if (CoreUtils.isString(user.authenticatedId)) {\r\n event.ext.user.authId = user.authenticatedId;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.cleanUp = function (event, itemCtx) {\r\n if (event.ext[Extensions.DeviceExt] && CoreUtils.objKeys(event.ext[Extensions.DeviceExt]).length === 0) {\r\n delete event.ext[Extensions.DeviceExt];\r\n }\r\n if (event.ext[Extensions.UserExt] && CoreUtils.objKeys(event.ext[Extensions.UserExt]).length === 0) {\r\n delete event.ext[Extensions.UserExt];\r\n }\r\n if (event.ext[Extensions.WebExt] && CoreUtils.objKeys(event.ext[Extensions.WebExt]).length === 0) {\r\n delete event.ext[Extensions.WebExt];\r\n }\r\n if (event.ext[Extensions.OSExt] && CoreUtils.objKeys(event.ext[Extensions.OSExt]).length === 0) {\r\n delete event.ext[Extensions.OSExt];\r\n }\r\n if (event.ext[Extensions.AppExt] && CoreUtils.objKeys(event.ext[Extensions.AppExt]).length === 0) {\r\n delete event.ext[Extensions.AppExt];\r\n }\r\n if (event.ext[Extensions.TraceExt] && CoreUtils.objKeys(event.ext[Extensions.TraceExt]).length === 0) {\r\n delete event.ext[Extensions.TraceExt];\r\n }\r\n };\r\n return TelemetryContext;\r\n}());\r\nexport { TelemetryContext };\r\n//# sourceMappingURL=TelemetryContext.js.map","/**\r\n * PropertiesPlugin.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport { BaseTelemetryPlugin, CoreUtils, _InternalLogMessage, LoggingSeverity, _InternalMessageId, getNavigator } from '@microsoft/applicationinsights-core-js';\r\nimport { TelemetryContext } from './TelemetryContext';\r\nimport { PageView, BreezeChannelIdentifier, PropertiesPluginIdentifier, Extensions, Util } from '@microsoft/applicationinsights-common';\r\nvar PropertiesPlugin = /** @class */ (function (_super) {\r\n __extends(PropertiesPlugin, _super);\r\n function PropertiesPlugin() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.priority = 110;\r\n _this.identifier = PropertiesPluginIdentifier;\r\n return _this;\r\n }\r\n PropertiesPlugin.getDefaultConfig = function () {\r\n var defaultConfig = {\r\n instrumentationKey: function () { return undefined; },\r\n accountId: function () { return null; },\r\n sessionRenewalMs: function () { return 30 * 60 * 1000; },\r\n samplingPercentage: function () { return 100; },\r\n sessionExpirationMs: function () { return 24 * 60 * 60 * 1000; },\r\n cookieDomain: function () { return null; },\r\n sdkExtension: function () { return null; },\r\n isBrowserLinkTrackingEnabled: function () { return false; },\r\n appId: function () { return null; },\r\n namePrefix: function () { return undefined; },\r\n idLength: function () { return 22; }\r\n };\r\n return defaultConfig;\r\n };\r\n PropertiesPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n var _this = this;\r\n _super.prototype.initialize.call(this, config, core, extensions, pluginChain);\r\n var ctx = this._getTelCtx();\r\n var identifier = this.identifier;\r\n var defaultConfig = PropertiesPlugin.getDefaultConfig();\r\n this._extensionConfig = this._extensionConfig || PropertiesPlugin.getDefaultConfig();\r\n var _loop_1 = function (field) {\r\n this_1._extensionConfig[field] = function () { return ctx.getConfig(identifier, field, defaultConfig[field]()); };\r\n };\r\n var this_1 = this;\r\n for (var field in defaultConfig) {\r\n _loop_1(field);\r\n }\r\n this.context = new TelemetryContext(core.logger, this._extensionConfig);\r\n this._breezeChannel = Util.getExtension(extensions, BreezeChannelIdentifier);\r\n this.context.appId = function () { return _this._breezeChannel ? _this._breezeChannel[\"_appId\"] : null; };\r\n };\r\n /**\r\n * Add Part A fields to the event\r\n * @param event The event that needs to be processed\r\n */\r\n PropertiesPlugin.prototype.processTelemetry = function (event, itemCtx) {\r\n if (CoreUtils.isNullOrUndefined(event)) {\r\n // TODO(barustum): throw an internal event once we have support for internal logging\r\n }\r\n else {\r\n itemCtx = this._getTelCtx(itemCtx);\r\n // If the envelope is PageView, reset the internal message count so that we can send internal telemetry for the new page.\r\n if (event.name === PageView.envelopeType) {\r\n itemCtx.diagLog().resetInternalMessageCount();\r\n }\r\n if (this.context.session) {\r\n // If customer did not provide custom session id update the session manager\r\n if (typeof this.context.session.id !== \"string\") {\r\n this.context.sessionManager.update();\r\n }\r\n }\r\n this._processTelemetryInternal(event, itemCtx);\r\n if (this.context && this.context.user && this.context.user.isNewUser) {\r\n this.context.user.isNewUser = false;\r\n var message = new _InternalLogMessage(_InternalMessageId.SendBrowserInfoOnUserInit, ((getNavigator() || {}).userAgent || \"\"));\r\n itemCtx.diagLog().logInternalMessage(LoggingSeverity.CRITICAL, message);\r\n }\r\n this.processNext(event, itemCtx);\r\n }\r\n };\r\n PropertiesPlugin.prototype._processTelemetryInternal = function (event, itemCtx) {\r\n // set part A fields\r\n if (!event.tags) {\r\n event.tags = [];\r\n }\r\n if (!event.ext) {\r\n event.ext = {};\r\n }\r\n var ext = event.ext;\r\n ext[Extensions.DeviceExt] = ext[Extensions.DeviceExt] || {};\r\n ext[Extensions.WebExt] = ext[Extensions.WebExt] || {};\r\n ext[Extensions.UserExt] = ext[Extensions.UserExt] || {};\r\n ext[Extensions.OSExt] = ext[Extensions.OSExt] || {};\r\n ext[Extensions.AppExt] = ext[Extensions.AppExt] || {};\r\n ext[Extensions.TraceExt] = ext[Extensions.TraceExt] || {};\r\n var context = this.context;\r\n context.applySessionContext(event, itemCtx);\r\n context.applyApplicationContext(event, itemCtx);\r\n context.applyDeviceContext(event, itemCtx);\r\n context.applyOperationContext(event, itemCtx);\r\n context.applyUserContext(event, itemCtx);\r\n context.applyOperatingSystemContxt(event, itemCtx);\r\n context.applyWebContext(event, itemCtx);\r\n context.applyLocationContext(event, itemCtx); // legacy tags\r\n context.applyInternalContext(event, itemCtx); // legacy tags\r\n context.cleanUp(event, itemCtx);\r\n };\r\n return PropertiesPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport default PropertiesPlugin;\r\n//# sourceMappingURL=PropertiesPlugin.js.map","/*!\n * Application Insights JavaScript SDK - Dependencies Plugin, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { DataSanitizer, UrlHelper, DateTimeUtils, Util } from '@microsoft/applicationinsights-common';\r\nimport { CoreUtils, normalizeJsName } from '@microsoft/applicationinsights-core-js';\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nvar strProperties = \"properties\";\r\nvar _objKeys = CoreUtils.objKeys;\r\nvar _arrForEach = CoreUtils.arrForEach;\r\n/** @ignore */\r\nfunction _calcPerfDuration(resourceEntry, start, end) {\r\n var result = 0;\r\n var from = resourceEntry[start];\r\n var to = resourceEntry[end];\r\n if (from && to) {\r\n result = DateTimeUtils.GetDuration(from, to);\r\n }\r\n return result;\r\n}\r\n/** @ignore */\r\nfunction _setPerfDuration(props, name, resourceEntry, start, end) {\r\n var result = 0;\r\n var value = _calcPerfDuration(resourceEntry, start, end);\r\n if (value) {\r\n result = _setPerfValue(props, name, Util.msToTimeSpan(value));\r\n }\r\n return result;\r\n}\r\n/** @ignore */\r\nfunction _setPerfValue(props, name, value) {\r\n var strPerf = \"ajaxPerf\";\r\n var result = 0;\r\n if (props && name && value) {\r\n var perfData = props[strPerf] = (props[strPerf] || {});\r\n perfData[name] = value;\r\n result = 1;\r\n }\r\n return result;\r\n}\r\n/** @ignore */\r\nfunction _populatePerfData(ajaxData, dependency) {\r\n /*\r\n * https://developer.mozilla.org/en-US/docs/Web/API/Resource_Timing_API/Using_the_Resource_Timing_API\r\n * | -startTime\r\n * | -redirectStart\r\n * | | -redirectEnd\r\n * | | | -fetchStart\r\n * | | | | -domainLookupStart\r\n * | | | | |- domainLookupEnd\r\n * | | | | | | -connectStart\r\n * | | | | | | | -secureConnectionStart\r\n * | | | | | | | | -connectEnd\r\n * | | | | | | | | | -requestStart\r\n * | | | | | | | | | | | -responseStart\r\n * | | | | | | | | | | | | | -responseEnd\r\n * +------------+-+---+----------------+-+--+--------+-+-----------+-+------------+-+\r\n * |--redirect--| |---|--domainLookup--| |--connect--| |--request--| |--response--| |\r\n * |-------------------networkConnect----------------|\r\n * | |---------sentRequest--------|\r\n * |------------------------------------perfTotal-----------------------------------|\r\n */\r\n var resourceEntry = ajaxData.perfTiming;\r\n var props = dependency[strProperties] || {};\r\n var propsSet = 0;\r\n var _isString = CoreUtils.isString;\r\n var strName = \"name\";\r\n var strStart = \"Start\";\r\n var strEnd = \"End\";\r\n var strDomainLookup = \"domainLookup\";\r\n var strConnect = \"connect\";\r\n var strRedirect = \"redirect\";\r\n var strRequest = \"request\";\r\n var strResponse = \"response\";\r\n var strDuration = \"duration\";\r\n var strStartTime = \"startTime\";\r\n var strDomainLookupStart = strDomainLookup + strStart;\r\n var strDomainLookupEnd = strDomainLookup + strEnd;\r\n var strConnectStart = strConnect + strStart;\r\n var strConnectEnd = strConnect + strEnd;\r\n var strRequestStart = strRequest + strStart;\r\n var strRequestEnd = strRequest + strEnd;\r\n var strResponseStart = strResponse + strStart;\r\n var strResponseEnd = strResponse + strEnd;\r\n var strRedirectStart = strRedirect + strStart;\r\n var strRedirectEnd = strRedirect = strEnd;\r\n var strTransferSize = \"transferSize\";\r\n var strEncodedBodySize = \"encodedBodySize\";\r\n var strDecodedBodySize = \"decodedBodySize\";\r\n var strServerTiming = \"serverTiming\";\r\n if (resourceEntry) {\r\n // redirect\r\n propsSet |= _setPerfDuration(props, strRedirect, resourceEntry, strRedirectStart, strRedirectEnd);\r\n // domainLookup\r\n propsSet |= _setPerfDuration(props, strDomainLookup, resourceEntry, strDomainLookupStart, strDomainLookupEnd);\r\n // connect\r\n propsSet |= _setPerfDuration(props, strConnect, resourceEntry, strConnectStart, strConnectEnd);\r\n // request\r\n propsSet |= _setPerfDuration(props, strRequest, resourceEntry, strRequestStart, strRequestEnd);\r\n // response\r\n propsSet |= _setPerfDuration(props, strResponse, resourceEntry, strResponseStart, strResponseEnd);\r\n // Network connection time\r\n propsSet |= _setPerfDuration(props, \"networkConnect\", resourceEntry, strStartTime, strConnectEnd);\r\n // Sent Request\r\n propsSet |= _setPerfDuration(props, \"sentRequest\", resourceEntry, strRequestStart, strResponseEnd);\r\n // PerfTotal / Duration\r\n var duration = resourceEntry[strDuration];\r\n if (!duration) {\r\n duration = _calcPerfDuration(resourceEntry, strStartTime, strResponseEnd) || 0;\r\n }\r\n propsSet |= _setPerfValue(props, strDuration, duration);\r\n propsSet |= _setPerfValue(props, \"perfTotal\", duration);\r\n var serverTiming = resourceEntry[strServerTiming];\r\n if (serverTiming) {\r\n var server_1 = {};\r\n _arrForEach(serverTiming, function (value, idx) {\r\n var name = normalizeJsName(value[strName] || \"\" + idx);\r\n var newValue = server_1[name] || {};\r\n _arrForEach(_objKeys(value), function (key) {\r\n var val = value[key];\r\n if (key !== strName && _isString(val) || CoreUtils.isNumber(val)) {\r\n if (newValue[key]) {\r\n val = newValue[key] + \";\" + val;\r\n }\r\n if (val || !_isString(val)) {\r\n // Only set the value if it has a value and it's not an empty string\r\n newValue[key] = val;\r\n }\r\n }\r\n });\r\n server_1[name] = newValue;\r\n });\r\n propsSet |= _setPerfValue(props, strServerTiming, server_1);\r\n }\r\n propsSet |= _setPerfValue(props, strTransferSize, resourceEntry[strTransferSize]);\r\n propsSet |= _setPerfValue(props, strEncodedBodySize, resourceEntry[strEncodedBodySize]);\r\n propsSet |= _setPerfValue(props, strDecodedBodySize, resourceEntry[strDecodedBodySize]);\r\n }\r\n else {\r\n if (ajaxData.perfMark) {\r\n propsSet |= _setPerfValue(props, \"missing\", ajaxData.perfAttempts);\r\n }\r\n }\r\n if (propsSet) {\r\n dependency[strProperties] = props;\r\n }\r\n}\r\nvar XHRMonitoringState = /** @class */ (function () {\r\n function XHRMonitoringState() {\r\n var self = this;\r\n self.openDone = false;\r\n self.setRequestHeaderDone = false;\r\n self.sendDone = false;\r\n self.abortDone = false;\r\n // True, if onreadyStateChangeCallback function attached to xhr, otherwise false\r\n self.stateChangeAttached = false;\r\n }\r\n return XHRMonitoringState;\r\n}());\r\nexport { XHRMonitoringState };\r\nvar ajaxRecord = /** @class */ (function () {\r\n function ajaxRecord(traceID, spanID, logger) {\r\n var self = this;\r\n var _logger = logger;\r\n var strResponseText = \"responseText\";\r\n // Assigning the initial/default values within the constructor to avoid typescript from creating a bunch of\r\n // this.XXXX = null\r\n self.perfMark = null;\r\n self.completed = false;\r\n self.requestHeadersSize = null;\r\n self.requestHeaders = null;\r\n self.responseReceivingDuration = null;\r\n self.callbackDuration = null;\r\n self.ajaxTotalDuration = null;\r\n self.aborted = 0;\r\n self.pageUrl = null;\r\n self.requestUrl = null;\r\n self.requestSize = 0;\r\n self.method = null;\r\n self.status = null;\r\n self.requestSentTime = null;\r\n self.responseStartedTime = null;\r\n self.responseFinishedTime = null;\r\n self.callbackFinishedTime = null;\r\n self.endTime = null;\r\n self.xhrMonitoringState = new XHRMonitoringState();\r\n self.clientFailure = 0;\r\n self.traceID = traceID;\r\n self.spanID = spanID;\r\n dynamicProto(ajaxRecord, self, function (self) {\r\n self.getAbsoluteUrl = function () {\r\n return self.requestUrl ? UrlHelper.getAbsoluteUrl(self.requestUrl) : null;\r\n };\r\n self.getPathName = function () {\r\n return self.requestUrl ? DataSanitizer.sanitizeUrl(_logger, UrlHelper.getCompleteUrl(self.method, self.requestUrl)) : null;\r\n };\r\n self.CreateTrackItem = function (ajaxType, enableRequestHeaderTracking, getResponse) {\r\n // round to 3 decimal points\r\n self.ajaxTotalDuration = Math.round(DateTimeUtils.GetDuration(self.requestSentTime, self.responseFinishedTime) * 1000) / 1000;\r\n if (self.ajaxTotalDuration < 0) {\r\n return null;\r\n }\r\n var dependency = (_a = {\r\n id: \"|\" + self.traceID + \".\" + self.spanID,\r\n target: self.getAbsoluteUrl(),\r\n name: self.getPathName(),\r\n type: ajaxType,\r\n duration: self.ajaxTotalDuration,\r\n success: (+(self.status)) >= 200 && (+(self.status)) < 400,\r\n responseCode: (+(self.status)),\r\n method: self.method\r\n },\r\n _a[strProperties] = { HttpMethod: self.method },\r\n _a);\r\n // Add Ajax perf details if available\r\n _populatePerfData(self, dependency);\r\n if (enableRequestHeaderTracking) {\r\n if (_objKeys(self.requestHeaders).length > 0) {\r\n dependency[strProperties] = dependency[strProperties] || {};\r\n dependency[strProperties].requestHeaders = self.requestHeaders;\r\n }\r\n }\r\n if (getResponse) {\r\n var response = getResponse();\r\n if (response) {\r\n // enrich dependency target with correlation context from the server\r\n var correlationContext = response.correlationContext;\r\n if (correlationContext) {\r\n dependency.correlationContext = /* dependency.target + \" | \" + */ correlationContext;\r\n }\r\n if (response.headerMap) {\r\n if (_objKeys(response.headerMap).length > 0) {\r\n dependency[strProperties] = dependency[strProperties] || {};\r\n dependency[strProperties].responseHeaders = response.headerMap;\r\n }\r\n }\r\n if (self.status >= 400) {\r\n var responseType = response.type;\r\n dependency[strProperties] = dependency[strProperties] || {};\r\n if (responseType === \"\" || responseType === \"text\") {\r\n dependency[strProperties][strResponseText] = response[strResponseText] ? response.statusText + \" - \" + response[strResponseText] : response.statusText;\r\n }\r\n if (responseType === \"json\") {\r\n dependency[strProperties][strResponseText] = response.response ? response.statusText + \" - \" + JSON.stringify(response.response) : response.statusText;\r\n }\r\n }\r\n }\r\n }\r\n return dependency;\r\n var _a;\r\n };\r\n });\r\n }\r\n// Removed Stub for ajaxRecord.prototype.getAbsoluteUrl.\r\n// Removed Stub for ajaxRecord.prototype.getPathName.\r\n// Removed Stub for ajaxRecord.prototype.CreateTrackItem.\r\n return ajaxRecord;\r\n}());\r\nexport { ajaxRecord };\r\n;\r\n//# sourceMappingURL=ajaxRecord.js.map","/*!\n * Application Insights JavaScript SDK - Dependencies Plugin, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { Util } from '@microsoft/applicationinsights-common';\r\nvar Traceparent = /** @class */ (function () {\r\n function Traceparent(traceId, spanId) {\r\n var self = this;\r\n self.traceFlag = Traceparent.DEFAULT_TRACE_FLAG;\r\n self.version = Traceparent.DEFAULT_VERSION;\r\n if (traceId && Traceparent.isValidTraceId(traceId)) {\r\n self.traceId = traceId;\r\n }\r\n else {\r\n self.traceId = Util.generateW3CId();\r\n }\r\n if (spanId && Traceparent.isValidSpanId(spanId)) {\r\n self.spanId = spanId;\r\n }\r\n else {\r\n self.spanId = Util.generateW3CId().substr(0, 16);\r\n }\r\n }\r\n Traceparent.isValidTraceId = function (id) {\r\n return id.match(/^[0-9a-f]{32}$/) && id !== \"00000000000000000000000000000000\";\r\n };\r\n Traceparent.isValidSpanId = function (id) {\r\n return id.match(/^[0-9a-f]{16}$/) && id !== \"0000000000000000\";\r\n };\r\n Traceparent.prototype.toString = function () {\r\n var self = this;\r\n return self.version + \"-\" + self.traceId + \"-\" + self.spanId + \"-\" + self.traceFlag;\r\n };\r\n Traceparent.DEFAULT_TRACE_FLAG = \"01\";\r\n Traceparent.DEFAULT_VERSION = \"00\";\r\n return Traceparent;\r\n}());\r\nexport { Traceparent };\r\n//# sourceMappingURL=TraceParent.js.map","/*!\n * Application Insights JavaScript SDK - Dependencies Plugin, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { RequestHeaders, Util, CorrelationIdHelper, TelemetryItemCreator, RemoteDependencyData, DateTimeUtils, DisabledPropertyName, PropertiesPluginIdentifier, DistributedTracingModes } from '@microsoft/applicationinsights-common';\r\nimport { CoreUtils, LoggingSeverity, _InternalMessageId, BaseTelemetryPlugin, getLocation, getGlobal, strUndefined, strPrototype, InstrumentFunc, InstrumentProto, getPerformance } from '@microsoft/applicationinsights-core-js';\r\nimport { ajaxRecord } from './ajaxRecord';\r\nimport { EventHelper } from './ajaxUtils';\r\nimport { Traceparent } from './TraceParent';\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nvar AJAX_MONITOR_PREFIX = \"ai.ajxmn.\";\r\nvar strDiagLog = \"diagLog\";\r\nvar strAjaxData = \"ajaxData\";\r\nvar strThrowInternal = \"throwInternal\";\r\nvar strFetch = \"fetch\";\r\nvar _isNullOrUndefined = CoreUtils.isNullOrUndefined;\r\nvar _arrForEach = CoreUtils.arrForEach;\r\nvar _objKeys = CoreUtils.objKeys;\r\n// Using a global value so that to handle same iKey with multiple app insights instances (mostly for testing)\r\nvar _markCount = 0;\r\n/** @Ignore */\r\nfunction _supportsFetch() {\r\n var _global = getGlobal();\r\n if (!_global ||\r\n _isNullOrUndefined(_global.Request) ||\r\n _isNullOrUndefined(_global.Request[strPrototype]) ||\r\n _isNullOrUndefined(_global[strFetch])) {\r\n return null;\r\n }\r\n return _global[strFetch];\r\n}\r\n/**\r\n * Determines whether ajax monitoring can be enabled on this document\r\n * @returns True if Ajax monitoring is supported on this page, otherwise false\r\n * @ignore\r\n */\r\nfunction _supportsAjaxMonitoring(ajaxMonitorInstance) {\r\n var result = false;\r\n if (typeof XMLHttpRequest !== strUndefined && !_isNullOrUndefined(XMLHttpRequest)) {\r\n var proto = XMLHttpRequest[strPrototype];\r\n result = !_isNullOrUndefined(proto) &&\r\n !_isNullOrUndefined(proto.open) &&\r\n !_isNullOrUndefined(proto.send) &&\r\n !_isNullOrUndefined(proto.abort);\r\n }\r\n var ieVer = Util.getIEVersion();\r\n if (ieVer && ieVer < 9) {\r\n result = false;\r\n }\r\n if (result) {\r\n // Disable if the XmlHttpRequest can't be extended or hooked\r\n try {\r\n var xhr = new XMLHttpRequest();\r\n xhr[strAjaxData] = {};\r\n // Check that we can update the prototype\r\n var theOpen = XMLHttpRequest[strPrototype].open;\r\n XMLHttpRequest[strPrototype].open = theOpen;\r\n }\r\n catch (e) {\r\n // We can't decorate the xhr object so disable monitoring\r\n result = false;\r\n _throwInternalCritical(ajaxMonitorInstance, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to enable XMLHttpRequest monitoring, extension is not supported\", {\r\n exception: Util.dump(e)\r\n });\r\n }\r\n }\r\n return result;\r\n}\r\n/** @Ignore */\r\nfunction _getFailedAjaxDiagnosticsMessage(xhr) {\r\n var result = \"\";\r\n try {\r\n if (!_isNullOrUndefined(xhr) &&\r\n !_isNullOrUndefined(xhr[strAjaxData]) &&\r\n !_isNullOrUndefined(xhr[strAjaxData].requestUrl)) {\r\n result += \"(url: '\" + xhr[strAjaxData].requestUrl + \"')\";\r\n }\r\n }\r\n catch (e) { }\r\n return result;\r\n}\r\n/** @ignore */\r\nfunction _throwInternalCritical(ajaxMonitorInstance, msgId, message, properties, isUserAct) {\r\n ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.CRITICAL, msgId, message, properties, isUserAct);\r\n}\r\n/** @ignore */\r\nfunction _throwInternalWarning(ajaxMonitorInstance, msgId, message, properties, isUserAct) {\r\n ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.WARNING, msgId, message, properties, isUserAct);\r\n}\r\n/** @Ignore */\r\nfunction _createErrorCallbackFunc(ajaxMonitorInstance, internalMessage, message) {\r\n // tslint:disable-next-line\r\n return function (args) {\r\n _throwInternalCritical(ajaxMonitorInstance, internalMessage, message, {\r\n ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(args.inst),\r\n exception: Util.dump(args.err)\r\n });\r\n };\r\n}\r\nfunction _indexOf(value, match) {\r\n if (value && match) {\r\n return value.indexOf(match);\r\n }\r\n return -1;\r\n}\r\nvar AjaxMonitor = /** @class */ (function (_super) {\r\n __extends(AjaxMonitor, _super);\r\n function AjaxMonitor() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = AjaxMonitor.identifier;\r\n _this.priority = 120;\r\n var strTrackDependencyDataInternal = \"trackDependencyDataInternal\"; // Using string to help with minification\r\n var location = getLocation();\r\n var _fetchInitialized = false; // fetch monitoring initialized\r\n var _xhrInitialized = false; // XHR monitoring initialized\r\n var _currentWindowHost = location && location.host && location.host.toLowerCase();\r\n var _config = AjaxMonitor.getEmptyConfig();\r\n var _enableRequestHeaderTracking = false;\r\n var _trackAjaxAttempts = 0;\r\n var _context;\r\n var _isUsingW3CHeaders;\r\n var _isUsingAIHeaders;\r\n var _markPrefix;\r\n var _enableAjaxPerfTracking = false;\r\n var _maxAjaxCallsPerView = 0;\r\n var _enableResponseHeaderTracking = false;\r\n var _hooks = [];\r\n var _disabledUrls = {};\r\n dynamicProto(AjaxMonitor, _this, function (_self, base) {\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n if (!_self.isInitialized()) {\r\n base.initialize(config, core, extensions, pluginChain);\r\n var ctx_1 = _self._getTelCtx();\r\n var defaultConfig_1 = AjaxMonitor.getDefaultConfig();\r\n _arrForEach(_objKeys(defaultConfig_1), function (field) {\r\n _config[field] = ctx_1.getConfig(AjaxMonitor.identifier, field, defaultConfig_1[field]);\r\n });\r\n var distributedTracingMode = _config.distributedTracingMode;\r\n _enableRequestHeaderTracking = _config.enableRequestHeaderTracking;\r\n _enableAjaxPerfTracking = _config.enableAjaxPerfTracking;\r\n _maxAjaxCallsPerView = _config.maxAjaxCallsPerView;\r\n _enableResponseHeaderTracking = _config.enableResponseHeaderTracking;\r\n _isUsingAIHeaders = distributedTracingMode === DistributedTracingModes.AI || distributedTracingMode === DistributedTracingModes.AI_AND_W3C;\r\n _isUsingW3CHeaders = distributedTracingMode === DistributedTracingModes.AI_AND_W3C || distributedTracingMode === DistributedTracingModes.W3C;\r\n if (_enableAjaxPerfTracking) {\r\n var iKey = config.instrumentationKey || \"unkwn\";\r\n if (iKey.length > 5) {\r\n _markPrefix = AJAX_MONITOR_PREFIX + iKey.substring(iKey.length - 5) + \".\";\r\n }\r\n else {\r\n _markPrefix = AJAX_MONITOR_PREFIX + iKey + \".\";\r\n }\r\n }\r\n if (_config.disableAjaxTracking === false) {\r\n _instrumentXhr();\r\n }\r\n _instrumentFetch();\r\n if (extensions.length > 0 && extensions) {\r\n var propExt = void 0, extIx = 0;\r\n while (!propExt && extIx < extensions.length) {\r\n if (extensions[extIx] && extensions[extIx].identifier === PropertiesPluginIdentifier) {\r\n propExt = extensions[extIx];\r\n }\r\n extIx++;\r\n }\r\n if (propExt) {\r\n _context = propExt.context; // we could move IPropertiesPlugin to common as well\r\n }\r\n }\r\n }\r\n };\r\n _self.teardown = function () {\r\n // Remove all instrumentation hooks\r\n _arrForEach(_hooks, function (fn) {\r\n fn.rm();\r\n });\r\n _hooks = [];\r\n _fetchInitialized = false;\r\n _xhrInitialized = false;\r\n _self.setInitialized(false);\r\n };\r\n _self.trackDependencyData = function (dependency, properties) {\r\n _self[strTrackDependencyDataInternal](dependency, properties);\r\n };\r\n _self.includeCorrelationHeaders = function (ajaxData, input, init, xhr) {\r\n // Test Hook to allow the overriding of the location host\r\n var currentWindowHost = _self[\"_currentWindowHost\"] || _currentWindowHost;\r\n if (input) {\r\n if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {\r\n if (!init) {\r\n init = {};\r\n }\r\n // init headers override original request headers\r\n // so, if they exist use only them, otherwise use request's because they should have been applied in the first place\r\n // not using original request headers will result in them being lost\r\n init.headers = new Headers(init.headers || (input instanceof Request ? (input.headers || {}) : {}));\r\n if (_isUsingAIHeaders) {\r\n var id = \"|\" + ajaxData.traceID + \".\" + ajaxData.spanID;\r\n init.headers.set(RequestHeaders.requestIdHeader, id);\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id;\r\n }\r\n }\r\n var appId = _config.appId || (_context && _context.appId());\r\n if (appId) {\r\n init.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId;\r\n }\r\n }\r\n if (_isUsingW3CHeaders) {\r\n var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID);\r\n init.headers.set(RequestHeaders.traceParentHeader, traceparent.toString());\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString();\r\n }\r\n }\r\n }\r\n return init;\r\n }\r\n else if (xhr) {\r\n if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {\r\n if (_isUsingAIHeaders) {\r\n var id = \"|\" + ajaxData.traceID + \".\" + ajaxData.spanID;\r\n xhr.setRequestHeader(RequestHeaders.requestIdHeader, id);\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id;\r\n }\r\n }\r\n var appId = _config.appId || (_context && _context.appId());\r\n if (appId) {\r\n xhr.setRequestHeader(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId;\r\n }\r\n }\r\n if (_isUsingW3CHeaders) {\r\n var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID);\r\n xhr.setRequestHeader(RequestHeaders.traceParentHeader, traceparent.toString());\r\n if (_enableRequestHeaderTracking) {\r\n ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString();\r\n }\r\n }\r\n }\r\n return xhr;\r\n }\r\n return undefined;\r\n };\r\n _self[strTrackDependencyDataInternal] = function (dependency, properties, systemProperties) {\r\n if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) {\r\n // Hack since expected format in w3c mode is |abc.def.\r\n // Non-w3c format is |abc.def\r\n // @todo Remove if better solution is available, e.g. handle in portal\r\n if ((_config.distributedTracingMode === DistributedTracingModes.W3C\r\n || _config.distributedTracingMode === DistributedTracingModes.AI_AND_W3C)\r\n && typeof dependency.id === \"string\" && dependency.id[dependency.id.length - 1] !== \".\") {\r\n dependency.id += \".\";\r\n }\r\n if (CoreUtils.isNullOrUndefined(dependency.startTime)) {\r\n dependency.startTime = new Date();\r\n }\r\n var item = TelemetryItemCreator.create(dependency, RemoteDependencyData.dataType, RemoteDependencyData.envelopeType, _self[strDiagLog](), properties, systemProperties);\r\n _self.core.track(item);\r\n }\r\n else if (_trackAjaxAttempts === _maxAjaxCallsPerView) {\r\n _throwInternalCritical(_self, _InternalMessageId.MaxAjaxPerPVExceeded, \"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.\", true);\r\n }\r\n ++_trackAjaxAttempts;\r\n };\r\n // Fetch Stuff\r\n function _instrumentFetch() {\r\n var fetch = _supportsFetch();\r\n if (!fetch) {\r\n return;\r\n }\r\n var global = getGlobal();\r\n var isPolyfill = fetch.polyfill;\r\n if (_config.disableFetchTracking === false) {\r\n _hooks.push(InstrumentFunc(global, strFetch, {\r\n // Add request hook\r\n req: function (callDetails, input, init) {\r\n var fetchData;\r\n if (_fetchInitialized &&\r\n !_isDisabledRequest(null, input, init) &&\r\n // If we have a polyfil and XHR instrumented then let XHR report otherwise we get duplicates\r\n !(isPolyfill && _xhrInitialized)) {\r\n var ctx = callDetails.ctx();\r\n fetchData = _createFetchRecord(input, init);\r\n var newInit = _self.includeCorrelationHeaders(fetchData, input, init);\r\n if (newInit !== init) {\r\n callDetails.set(1, newInit);\r\n }\r\n ctx.data = fetchData;\r\n }\r\n },\r\n rsp: function (callDetails, input) {\r\n var fetchData = callDetails.ctx().data;\r\n if (fetchData) {\r\n // Replace the result with the new promise from this code\r\n callDetails.rslt = callDetails.rslt.then(function (response) {\r\n _reportFetchMetrics(callDetails, (response || {}).status, response, fetchData, function () {\r\n var ajaxResponse = {\r\n statusText: response.statusText,\r\n headerMap: null,\r\n correlationContext: _getFetchCorrelationContext(response)\r\n };\r\n if (_enableResponseHeaderTracking) {\r\n var responseHeaderMap_1 = {};\r\n response.headers.forEach(function (value, name) {\r\n responseHeaderMap_1[name] = value;\r\n });\r\n ajaxResponse.headerMap = responseHeaderMap_1;\r\n }\r\n return ajaxResponse;\r\n });\r\n return response;\r\n })[\"catch\"](function (reason) {\r\n _reportFetchMetrics(callDetails, 0, input, fetchData, null, { error: reason.message });\r\n throw reason;\r\n });\r\n }\r\n },\r\n // Create an error callback to report any hook errors\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.\")\r\n }));\r\n _fetchInitialized = true;\r\n }\r\n else if (isPolyfill) {\r\n // If fetch is a polyfill we need to capture the request to ensure that we correctly track\r\n // disabled request URLS (i.e. internal urls) to ensure we don't end up in a constant loop\r\n // of reporting ourselves, for example React Native uses a polyfill for fetch\r\n // Note: Polyfill implementations that don't support the \"poyyfill\" tag are not supported\r\n // the workaround is to add a polyfill property to your fetch implementation before initializing\r\n // App Insights\r\n _hooks.push(InstrumentFunc(global, strFetch, {\r\n req: function (callDetails, input, init) {\r\n // Just call so that we record any disabled URL\r\n _isDisabledRequest(null, input, init);\r\n }\r\n }));\r\n }\r\n if (isPolyfill) {\r\n // retag the instrumented fetch with the same polyfill settings this is mostly for testing\r\n // But also supports multiple App Insights usages\r\n global[strFetch].polyfill = isPolyfill;\r\n }\r\n }\r\n function _hookProto(target, funcName, callbacks) {\r\n _hooks.push(InstrumentProto(target, funcName, callbacks));\r\n }\r\n function _instrumentXhr() {\r\n if (_supportsAjaxMonitoring(_self) && !_xhrInitialized) {\r\n // Instrument open\r\n _hookProto(XMLHttpRequest, \"open\", {\r\n req: function (args, method, url, async) {\r\n var xhr = args.inst;\r\n var ajaxData = xhr[strAjaxData];\r\n if (!_isDisabledRequest(xhr, url) && _isMonitoredXhrInstance(xhr, true) &&\r\n (!ajaxData || !ajaxData.xhrMonitoringState.openDone)) {\r\n _openHandler(xhr, method, url, async);\r\n }\r\n },\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.\")\r\n });\r\n // Instrument send\r\n _hookProto(XMLHttpRequest, \"send\", {\r\n req: function (args, context) {\r\n var xhr = args.inst;\r\n var ajaxData = xhr[strAjaxData];\r\n if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.sendDone) {\r\n _createMarkId(\"xhr\", ajaxData);\r\n ajaxData.requestSentTime = DateTimeUtils.Now();\r\n xhr = _self.includeCorrelationHeaders(ajaxData, undefined, undefined, xhr);\r\n ajaxData.xhrMonitoringState.sendDone = true;\r\n }\r\n },\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSend, \"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.\")\r\n });\r\n // Instrument abort\r\n _hookProto(XMLHttpRequest, \"abort\", {\r\n req: function (args) {\r\n var xhr = args.inst;\r\n var ajaxData = xhr[strAjaxData];\r\n if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.abortDone) {\r\n ajaxData.aborted = 1;\r\n ajaxData.xhrMonitoringState.abortDone = true;\r\n }\r\n },\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxAbort, \"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.\")\r\n });\r\n // Instrument setRequestHeader\r\n if (_enableRequestHeaderTracking) {\r\n _hookProto(XMLHttpRequest, \"setRequestHeader\", {\r\n req: function (args, header, value) {\r\n var xhr = args.inst;\r\n if (_isMonitoredXhrInstance(xhr)) {\r\n xhr[strAjaxData].requestHeaders[header] = value;\r\n }\r\n },\r\n hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSetRequestHeader, \"Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.\")\r\n });\r\n }\r\n _xhrInitialized = true;\r\n }\r\n }\r\n function _isDisabledRequest(xhr, request, init) {\r\n var isDisabled = false;\r\n var theUrl = ((!CoreUtils.isString(request) ? (request || {}).url || \"\" : request) || \"\").toLowerCase();\r\n var idx = _indexOf(theUrl, \"?\");\r\n var idx2 = _indexOf(theUrl, \"#\");\r\n if (idx === -1 || (idx2 !== -1 && idx2 < idx)) {\r\n idx = idx2;\r\n }\r\n if (idx !== -1) {\r\n // Strip off any Query string\r\n theUrl = theUrl.substring(0, idx);\r\n }\r\n // check that this instance is not not used by ajax call performed inside client side monitoring to send data to collector\r\n if (!_isNullOrUndefined(xhr)) {\r\n // Look on the XMLHttpRequest of the URL string value\r\n isDisabled = xhr[DisabledPropertyName] === true || theUrl[DisabledPropertyName] === true;\r\n }\r\n else if (!_isNullOrUndefined(request)) {\r\n // Look for DisabledPropertyName in either Request or RequestInit\r\n isDisabled = (typeof request === 'object' ? request[DisabledPropertyName] === true : false) ||\r\n (init ? init[DisabledPropertyName] === true : false);\r\n }\r\n if (isDisabled) {\r\n // Add the disabled url if not present\r\n if (!_disabledUrls[theUrl]) {\r\n _disabledUrls[theUrl] = 1;\r\n }\r\n }\r\n else {\r\n // Check to see if the url is listed as disabled\r\n if (_disabledUrls[theUrl]) {\r\n isDisabled = true;\r\n }\r\n }\r\n return isDisabled;\r\n }\r\n /// Verifies that particalar instance of XMLHttpRequest needs to be monitored\r\n /// Optional parameter. True if ajaxData must be excluded from verification\r\n /// True if instance needs to be monitored, otherwise false\r\n function _isMonitoredXhrInstance(xhr, excludeAjaxDataValidation) {\r\n var ajaxValidation = true;\r\n var initialized = _xhrInitialized;\r\n if (!_isNullOrUndefined(xhr)) {\r\n ajaxValidation = excludeAjaxDataValidation === true || !_isNullOrUndefined(xhr[strAjaxData]);\r\n }\r\n // checking to see that all interested functions on xhr were instrumented\r\n return initialized\r\n // checking on ajaxData to see that it was not removed in user code\r\n && ajaxValidation;\r\n }\r\n function _openHandler(xhr, method, url, async) {\r\n var traceID = (_context && _context.telemetryTrace && _context.telemetryTrace.traceID) || Util.generateW3CId();\r\n var spanID = Util.generateW3CId().substr(0, 16);\r\n var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());\r\n ajaxData.method = method;\r\n ajaxData.requestUrl = url;\r\n ajaxData.xhrMonitoringState.openDone = true;\r\n ajaxData.requestHeaders = {};\r\n ajaxData.async = async;\r\n xhr[strAjaxData] = ajaxData;\r\n _attachToOnReadyStateChange(xhr);\r\n }\r\n function _attachToOnReadyStateChange(xhr) {\r\n xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = EventHelper.Attach(xhr, \"readystatechange\", function () {\r\n try {\r\n if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr)) {\r\n _onAjaxComplete(xhr);\r\n }\r\n }\r\n catch (e) {\r\n var exceptionText = Util.dump(e);\r\n // ignore messages with c00c023f, as this a known IE9 XHR abort issue\r\n if (!exceptionText || _indexOf(exceptionText.toLowerCase(), \"c00c023f\") === -1) {\r\n _throwInternalCritical(_self, _InternalMessageId.FailedMonitorAjaxRSC, \"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.\", {\r\n ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),\r\n exception: exceptionText\r\n });\r\n }\r\n }\r\n });\r\n }\r\n function _getResponseText(xhr) {\r\n try {\r\n var responseType = xhr.responseType;\r\n if (responseType === \"\" || responseType === \"text\") {\r\n // As per the specification responseText is only valid if the type is an empty string or \"text\"\r\n return xhr.responseText;\r\n }\r\n }\r\n catch (e) {\r\n // This shouldn't happend because of the above check -- but just in case, so just ignore\r\n }\r\n return null;\r\n }\r\n function _onAjaxComplete(xhr) {\r\n var ajaxData = xhr[strAjaxData];\r\n ajaxData.responseFinishedTime = DateTimeUtils.Now();\r\n ajaxData.status = xhr.status;\r\n function _reportXhrError(e, failedProps) {\r\n var errorProps = failedProps || {};\r\n errorProps[\"ajaxDiagnosticsMessage\"] = _getFailedAjaxDiagnosticsMessage(xhr);\r\n if (e) {\r\n errorProps[\"exception\"] = Util.dump(e);\r\n }\r\n _throwInternalWarning(_self, _InternalMessageId.FailedMonitorAjaxDur, \"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.\", errorProps);\r\n }\r\n _findPerfResourceEntry(\"xmlhttprequest\", ajaxData, function () {\r\n try {\r\n var dependency = ajaxData.CreateTrackItem(\"Ajax\", _enableRequestHeaderTracking, function () {\r\n var ajaxResponse = {\r\n statusText: xhr.statusText,\r\n headerMap: null,\r\n correlationContext: _getAjaxCorrelationContext(xhr),\r\n type: xhr.responseType,\r\n responseText: _getResponseText(xhr),\r\n response: xhr.response\r\n };\r\n if (_enableResponseHeaderTracking) {\r\n var headers = xhr.getAllResponseHeaders();\r\n if (headers) {\r\n // xhr.getAllResponseHeaders() method returns all the response headers, separated by CRLF, as a string or null\r\n // the regex converts the header string into an array of individual headers\r\n var arr = CoreUtils.strTrim(headers).split(/[\\r\\n]+/);\r\n var responseHeaderMap_2 = {};\r\n _arrForEach(arr, function (line) {\r\n var parts = line.split(': ');\r\n var header = parts.shift();\r\n var value = parts.join(': ');\r\n responseHeaderMap_2[header] = value;\r\n });\r\n ajaxResponse.headerMap = responseHeaderMap_2;\r\n }\r\n }\r\n return ajaxResponse;\r\n });\r\n if (dependency) {\r\n _self[strTrackDependencyDataInternal](dependency);\r\n }\r\n else {\r\n _reportXhrError(null, {\r\n requestSentTime: ajaxData.requestSentTime,\r\n responseFinishedTime: ajaxData.responseFinishedTime\r\n });\r\n }\r\n }\r\n finally {\r\n // cleanup telemetry data\r\n try {\r\n xhr[strAjaxData] = null;\r\n }\r\n catch (e) {\r\n // May throw in environments that prevent extension or freeze xhr\r\n }\r\n }\r\n }, function (e) {\r\n _reportXhrError(e, null);\r\n });\r\n }\r\n function _getAjaxCorrelationContext(xhr) {\r\n try {\r\n var responseHeadersString = xhr.getAllResponseHeaders();\r\n if (responseHeadersString !== null) {\r\n var index = _indexOf(responseHeadersString.toLowerCase(), RequestHeaders.requestContextHeaderLowerCase);\r\n if (index !== -1) {\r\n var responseHeader = xhr.getResponseHeader(RequestHeaders.requestContextHeader);\r\n return CorrelationIdHelper.getCorrelationContext(responseHeader);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _throwInternalWarning(_self, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, \"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.\", {\r\n ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n }\r\n function _createMarkId(type, ajaxData) {\r\n if (ajaxData.requestUrl && _markPrefix && _enableAjaxPerfTracking) {\r\n var performance_1 = getPerformance();\r\n if (performance_1 && CoreUtils.isFunction(performance_1.mark)) {\r\n _markCount++;\r\n var markId = _markPrefix + type + \"#\" + _markCount;\r\n performance_1.mark(markId);\r\n var entries = performance_1.getEntriesByName(markId);\r\n if (entries && entries.length === 1) {\r\n ajaxData.perfMark = entries[0];\r\n }\r\n }\r\n }\r\n }\r\n function _findPerfResourceEntry(initiatorType, ajaxData, trackCallback, reportError) {\r\n var perfMark = ajaxData.perfMark;\r\n var performance = getPerformance();\r\n var maxAttempts = _config.maxAjaxPerfLookupAttempts;\r\n var retryDelay = _config.ajaxPerfLookupDelay;\r\n var requestUrl = ajaxData.requestUrl;\r\n var attempt = 0;\r\n (function locateResourceTiming() {\r\n try {\r\n if (performance && perfMark) {\r\n attempt++;\r\n var perfTiming = null;\r\n var entries = performance.getEntries();\r\n for (var lp = entries.length - 1; lp >= 0; lp--) {\r\n var entry = entries[lp];\r\n if (entry) {\r\n if (entry.entryType === \"resource\") {\r\n if (entry.initiatorType === initiatorType &&\r\n (_indexOf(entry.name, requestUrl) !== -1 || _indexOf(requestUrl, entry.name) !== -1)) {\r\n perfTiming = entry;\r\n }\r\n }\r\n else if (entry.entryType === \"mark\" && entry.name === perfMark.name) {\r\n // We hit the start event\r\n ajaxData.perfTiming = perfTiming;\r\n break;\r\n }\r\n if (entry.startTime < perfMark.startTime - 1000) {\r\n // Fallback to try and reduce the time spent looking for the perf entry\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (!perfMark || // - we don't have a perfMark or\r\n ajaxData.perfTiming || // - we have not found the perf entry or\r\n attempt >= maxAttempts || // - we have tried too many attempts or\r\n ajaxData.async === false) {\r\n if (perfMark && CoreUtils.isFunction(performance.clearMarks)) {\r\n // Remove the mark so we don't fill up the performance resources too much\r\n performance.clearMarks(perfMark.name);\r\n }\r\n ajaxData.perfAttempts = attempt;\r\n // just continue and report the track event\r\n trackCallback();\r\n }\r\n else {\r\n // We need to wait for the browser to populate the window.performance entry\r\n // This needs to be at least 1ms as waiting <= 1 (on firefox) is not enough time for fetch or xhr,\r\n // this is a scheduling issue for the browser implementation\r\n setTimeout(locateResourceTiming, retryDelay);\r\n }\r\n }\r\n catch (e) {\r\n reportError(e);\r\n }\r\n })();\r\n }\r\n function _createFetchRecord(input, init) {\r\n var traceID = (_context && _context.telemetryTrace && _context.telemetryTrace.traceID) || Util.generateW3CId();\r\n var spanID = Util.generateW3CId().substr(0, 16);\r\n var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());\r\n ajaxData.requestSentTime = DateTimeUtils.Now();\r\n if (input instanceof Request) {\r\n ajaxData.requestUrl = input ? input.url : \"\";\r\n }\r\n else {\r\n ajaxData.requestUrl = input;\r\n }\r\n var method = \"GET\";\r\n if (init && init.method) {\r\n method = init.method;\r\n }\r\n else if (input && input instanceof Request) {\r\n method = input.method;\r\n }\r\n ajaxData.method = method;\r\n var requestHeaders = {};\r\n if (_enableRequestHeaderTracking) {\r\n var headers = new Headers((init ? init.headers : 0) || (input instanceof Request ? (input.headers || {}) : {}));\r\n headers.forEach(function (value, key) {\r\n requestHeaders[key] = value;\r\n });\r\n }\r\n ajaxData.requestHeaders = requestHeaders;\r\n _createMarkId(\"fetch\", ajaxData);\r\n return ajaxData;\r\n }\r\n function _getFailedFetchDiagnosticsMessage(input) {\r\n var result = \"\";\r\n try {\r\n if (!_isNullOrUndefined(input)) {\r\n if (typeof (input) === \"string\") {\r\n result += \"(url: '\" + input + \"')\";\r\n }\r\n else {\r\n result += \"(url: '\" + input.url + \"')\";\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _throwInternalCritical(_self, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to grab failed fetch diagnostics message\", { exception: Util.dump(e) });\r\n }\r\n return result;\r\n }\r\n function _reportFetchMetrics(callDetails, status, input, ajaxData, getResponse, properties) {\r\n if (!ajaxData) {\r\n return;\r\n }\r\n function _reportFetchError(msgId, e, failedProps) {\r\n var errorProps = failedProps || {};\r\n errorProps[\"fetchDiagnosticsMessage\"] = _getFailedFetchDiagnosticsMessage(input);\r\n if (e) {\r\n errorProps[\"exception\"] = Util.dump(e);\r\n }\r\n _throwInternalWarning(_self, msgId, \"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.\", errorProps);\r\n }\r\n ajaxData.responseFinishedTime = DateTimeUtils.Now();\r\n ajaxData.status = status;\r\n _findPerfResourceEntry(\"fetch\", ajaxData, function () {\r\n var dependency = ajaxData.CreateTrackItem(\"Fetch\", _enableRequestHeaderTracking, getResponse);\r\n if (dependency) {\r\n _self[strTrackDependencyDataInternal](dependency);\r\n }\r\n else {\r\n _reportFetchError(_InternalMessageId.FailedMonitorAjaxDur, null, {\r\n requestSentTime: ajaxData.requestSentTime,\r\n responseFinishedTime: ajaxData.responseFinishedTime\r\n });\r\n }\r\n }, function (e) {\r\n _reportFetchError(_InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, e, null);\r\n });\r\n }\r\n function _getFetchCorrelationContext(response) {\r\n if (response && response.headers) {\r\n try {\r\n var responseHeader = response.headers.get(RequestHeaders.requestContextHeader);\r\n return CorrelationIdHelper.getCorrelationContext(responseHeader);\r\n }\r\n catch (e) {\r\n _throwInternalWarning(_self, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, \"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.\", {\r\n fetchDiagnosticsMessage: _getFailedFetchDiagnosticsMessage(response),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n }\r\n }\r\n });\r\n return _this;\r\n }\r\n AjaxMonitor.getDefaultConfig = function () {\r\n var config = {\r\n maxAjaxCallsPerView: 500,\r\n disableAjaxTracking: false,\r\n disableFetchTracking: true,\r\n disableCorrelationHeaders: false,\r\n distributedTracingMode: DistributedTracingModes.AI,\r\n correlationHeaderExcludedDomains: [\r\n \"*.blob.core.windows.net\",\r\n \"*.blob.core.chinacloudapi.cn\",\r\n \"*.blob.core.cloudapi.de\",\r\n \"*.blob.core.usgovcloudapi.net\"\r\n ],\r\n correlationHeaderDomains: undefined,\r\n appId: undefined,\r\n enableCorsCorrelation: false,\r\n enableRequestHeaderTracking: false,\r\n enableResponseHeaderTracking: false,\r\n enableAjaxErrorStatusText: false,\r\n enableAjaxPerfTracking: false,\r\n maxAjaxPerfLookupAttempts: 3,\r\n ajaxPerfLookupDelay: 25\r\n };\r\n return config;\r\n };\r\n AjaxMonitor.getEmptyConfig = function () {\r\n var emptyConfig = this.getDefaultConfig();\r\n _arrForEach(_objKeys(emptyConfig), function (value) {\r\n emptyConfig[value] = undefined;\r\n });\r\n return emptyConfig;\r\n };\r\n// Removed Stub for AjaxMonitor.prototype.initialize.\r\n// Removed Stub for AjaxMonitor.prototype.teardown.\r\n AjaxMonitor.prototype.processTelemetry = function (item, itemCtx) {\r\n this.processNext(item, itemCtx);\r\n };\r\n// Removed Stub for AjaxMonitor.prototype.trackDependencyData.\r\n// Removed Stub for AjaxMonitor.prototype.includeCorrelationHeaders.\r\n// Removed Stub for AjaxMonitor.prototype.trackDependencyDataInternal.\r\n AjaxMonitor.identifier = \"AjaxDependencyPlugin\";\r\n return AjaxMonitor;\r\n}(BaseTelemetryPlugin));\r\nexport { AjaxMonitor };\r\n//# sourceMappingURL=ajax.js.map","/*!\n * Application Insights JavaScript SDK - Web, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { CoreUtils, AppInsightsCore, LoggingSeverity, _InternalMessageId, hasWindow, hasDocument, isReactNative, doPerf } from \"@microsoft/applicationinsights-core-js\";\r\nimport { ApplicationInsights } from \"@microsoft/applicationinsights-analytics-js\";\r\nimport { Sender } from \"@microsoft/applicationinsights-channel-js\";\r\nimport { PropertiesPlugin } from \"@microsoft/applicationinsights-properties-js\";\r\nimport { AjaxPlugin as DependenciesPlugin } from '@microsoft/applicationinsights-dependencies-js';\r\nimport * as Common from \"@microsoft/applicationinsights-common\";\r\n\"use strict\";\r\nvar _internalSdkSrc;\r\n;\r\n/**\r\n * Telemetry type classes, e.g. PageView, Exception, etc\r\n */\r\nexport var Telemetry = Common;\r\n/**\r\n * Application Insights API\r\n * @class Initialization\r\n * @implements {IApplicationInsights}\r\n */\r\nvar Initialization = /** @class */ (function () {\r\n function Initialization(snippet) {\r\n var _self = this;\r\n // initialize the queue and config in case they are undefined\r\n _self._snippetVersion = \"\" + (snippet.sv || snippet.version || \"\");\r\n snippet.queue = snippet.queue || [];\r\n snippet.version = snippet.version || 2.0; // Default to new version\r\n var config = snippet.config || {};\r\n if (config.connectionString) {\r\n var cs = Common.ConnectionStringParser.parse(config.connectionString);\r\n var ingest = cs.ingestionendpoint;\r\n config.endpointUrl = ingest ? ingest + \"/v2/track\" : config.endpointUrl; // only add /v2/track when from connectionstring\r\n config.instrumentationKey = cs.instrumentationkey || config.instrumentationKey;\r\n }\r\n _self.appInsights = new ApplicationInsights();\r\n _self.properties = new PropertiesPlugin();\r\n _self.dependencies = new DependenciesPlugin();\r\n _self.core = new AppInsightsCore();\r\n _self.snippet = snippet;\r\n _self.config = config;\r\n _self.getSKUDefaults();\r\n }\r\n // Analytics Plugin\r\n /**\r\n * Log a user action or other occurrence.\r\n * @param {IEventTelemetry} event\r\n * @param {ICustomProperties} [customProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackEvent = function (event, customProperties) {\r\n this.appInsights.trackEvent(event, customProperties);\r\n };\r\n /**\r\n * Logs that a page, or similar container was displayed to the user.\r\n * @param {IPageViewTelemetry} pageView\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackPageView = function (pageView) {\r\n var inPv = pageView || {};\r\n this.appInsights.trackPageView(inPv);\r\n };\r\n /**\r\n * Log a bag of performance information via the customProperties field.\r\n * @param {IPageViewPerformanceTelemetry} pageViewPerformance\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackPageViewPerformance = function (pageViewPerformance) {\r\n var inPvp = pageViewPerformance || {};\r\n this.appInsights.trackPageViewPerformance(inPvp);\r\n };\r\n /**\r\n * Log an exception that you have caught.\r\n * @param {IExceptionTelemetry} exception\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackException = function (exception) {\r\n if (!exception.exception && exception.error) {\r\n exception.exception = exception.error;\r\n }\r\n this.appInsights.trackException(exception);\r\n };\r\n /**\r\n * Manually send uncaught exception telemetry. This method is automatically triggered\r\n * on a window.onerror event.\r\n * @param {IAutoExceptionTelemetry} exception\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype._onerror = function (exception) {\r\n this.appInsights._onerror(exception);\r\n };\r\n /**\r\n * Log a diagnostic scenario such entering or leaving a function.\r\n * @param {ITraceTelemetry} trace\r\n * @param {ICustomProperties} [customProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackTrace = function (trace, customProperties) {\r\n this.appInsights.trackTrace(trace, customProperties);\r\n };\r\n /**\r\n * Log a numeric value that is not associated with a specific event. Typically used\r\n * to send regular reports of performance indicators.\r\n *\r\n * To send a single measurement, just use the `name` and `average` fields\r\n * of {@link IMetricTelemetry}.\r\n *\r\n * If you take measurements frequently, you can reduce the telemetry bandwidth by\r\n * aggregating multiple measurements and sending the resulting average and modifying\r\n * the `sampleCount` field of {@link IMetricTelemetry}.\r\n * @param {IMetricTelemetry} metric input object argument. Only `name` and `average` are mandatory.\r\n * @param {ICustomProperties} [customProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackMetric = function (metric, customProperties) {\r\n this.appInsights.trackMetric(metric, customProperties);\r\n };\r\n /**\r\n * Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,\r\n * but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view\r\n * and send the event.\r\n * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.\r\n */\r\n Initialization.prototype.startTrackPage = function (name) {\r\n this.appInsights.startTrackPage(name);\r\n };\r\n /**\r\n * Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.\r\n * The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.\r\n * @param name The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.\r\n * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n Initialization.prototype.stopTrackPage = function (name, url, customProperties, measurements) {\r\n this.appInsights.stopTrackPage(name, url, customProperties, measurements);\r\n };\r\n Initialization.prototype.startTrackEvent = function (name) {\r\n this.appInsights.startTrackEvent(name);\r\n };\r\n /**\r\n * Log an extended event that you started timing with `startTrackEvent`.\r\n * @param name The string you used to identify this event in `startTrackEvent`.\r\n * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n Initialization.prototype.stopTrackEvent = function (name, properties, measurements) {\r\n this.appInsights.stopTrackEvent(name, properties, measurements); // Todo: Fix to pass measurements once type is updated\r\n };\r\n Initialization.prototype.addTelemetryInitializer = function (telemetryInitializer) {\r\n return this.appInsights.addTelemetryInitializer(telemetryInitializer);\r\n };\r\n // Properties Plugin\r\n /**\r\n * Set the authenticated user id and the account id. Used for identifying a specific signed-in user. Parameters must not contain whitespace or ,;=|\r\n *\r\n * The method will only set the `authenticatedUserId` and `accountId` in the current page view. To set them for the whole session, you should set `storeInCookie = true`\r\n * @param {string} authenticatedUserId\r\n * @param {string} [accountId]\r\n * @param {boolean} [storeInCookie=false]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.setAuthenticatedUserContext = function (authenticatedUserId, accountId, storeInCookie) {\r\n if (storeInCookie === void 0) { storeInCookie = false; }\r\n this.properties.context.user.setAuthenticatedUserContext(authenticatedUserId, accountId, storeInCookie);\r\n };\r\n /**\r\n * Clears the authenticated user id and account id. The associated cookie is cleared, if present.\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.clearAuthenticatedUserContext = function () {\r\n this.properties.context.user.clearAuthenticatedUserContext();\r\n };\r\n // Dependencies Plugin\r\n /**\r\n * Log a dependency call (e.g. ajax)\r\n * @param {IDependencyTelemetry} dependency\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackDependencyData = function (dependency) {\r\n this.dependencies.trackDependencyData(dependency);\r\n };\r\n // Misc\r\n /**\r\n * Manually trigger an immediate send of all telemetry still in the buffer.\r\n * @param {boolean} [async=true]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.flush = function (async) {\r\n var _this = this;\r\n if (async === void 0) { async = true; }\r\n doPerf(this.core, function () { return \"AISKU.flush\"; }, function () {\r\n CoreUtils.arrForEach(_this.core.getTransmissionControls(), function (channels) {\r\n CoreUtils.arrForEach(channels, function (channel) {\r\n channel.flush(async);\r\n });\r\n });\r\n }, null, async);\r\n };\r\n /**\r\n * Manually trigger an immediate send of all telemetry still in the buffer using beacon Sender.\r\n * Fall back to xhr sender if beacon is not supported.\r\n * @param {boolean} [async=true]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.onunloadFlush = function (async) {\r\n if (async === void 0) { async = true; }\r\n CoreUtils.arrForEach(this.core.getTransmissionControls(), function (channels) {\r\n CoreUtils.arrForEach(channels, function (channel) {\r\n if (channel.onunloadFlush) {\r\n channel.onunloadFlush();\r\n }\r\n else {\r\n channel.flush(async);\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Initialize this instance of ApplicationInsights\r\n * @returns {IApplicationInsights}\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.loadAppInsights = function (legacyMode, logger, notificationManager) {\r\n var _this = this;\r\n if (legacyMode === void 0) { legacyMode = false; }\r\n var _self = this;\r\n function _updateSnippetProperties(snippet) {\r\n if (snippet) {\r\n var snippetVer = \"\";\r\n if (!CoreUtils.isNullOrUndefined(_self._snippetVersion)) {\r\n snippetVer += _self._snippetVersion;\r\n }\r\n if (legacyMode) {\r\n snippetVer += \".lg\";\r\n }\r\n if (_self.context && _self.context.internal) {\r\n _self.context.internal.snippetVer = snippetVer || \"-\";\r\n }\r\n // apply updated properties to the global instance (snippet)\r\n for (var field in _self) {\r\n if (CoreUtils.isString(field) &&\r\n !CoreUtils.isFunction(_self[field]) &&\r\n field.substring(0, 1) !== \"_\") {\r\n snippet[field] = _self[field];\r\n }\r\n }\r\n }\r\n }\r\n // dont allow additional channels/other extensions for legacy mode; legacy mode is only to allow users to switch with no code changes!\r\n if (legacyMode && _self.config.extensions && _self.config.extensions.length > 0) {\r\n throw new Error(\"Extensions not allowed in legacy mode\");\r\n }\r\n doPerf(_self.core, function () { return \"AISKU.loadAppInsights\"; }, function () {\r\n var extensions = [];\r\n var appInsightsChannel = new Sender();\r\n extensions.push(appInsightsChannel);\r\n extensions.push(_self.properties);\r\n extensions.push(_self.dependencies);\r\n extensions.push(_self.appInsights);\r\n // initialize core\r\n _self.core.initialize(_self.config, extensions, logger, notificationManager);\r\n _self.context = _self.properties.context;\r\n if (_internalSdkSrc && _self.context) {\r\n _self.context.internal.sdkSrc = _internalSdkSrc;\r\n }\r\n _updateSnippetProperties(_self.snippet);\r\n // Empty queue of all api calls logged prior to sdk download\r\n _self.emptyQueue();\r\n _self.pollInternalLogs();\r\n _self.addHousekeepingBeforeUnload(_this);\r\n });\r\n return _self;\r\n };\r\n /**\r\n * Overwrite the lazy loaded fields of global window snippet to contain the\r\n * actual initialized API methods\r\n * @param {Snippet} snippet\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.updateSnippetDefinitions = function (snippet) {\r\n // apply full appInsights to the global instance\r\n // Note: This must be called before loadAppInsights is called\r\n for (var field in this) {\r\n if (CoreUtils.isString(field)) {\r\n snippet[field] = this[field];\r\n }\r\n }\r\n };\r\n /**\r\n * Call any functions that were queued before the main script was loaded\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.emptyQueue = function () {\r\n var _self = this;\r\n // call functions that were queued before the main script was loaded\r\n try {\r\n if (Common.Util.isArray(_self.snippet.queue)) {\r\n // note: do not check length in the for-loop conditional in case something goes wrong and the stub methods are not overridden.\r\n var length_1 = _self.snippet.queue.length;\r\n for (var i = 0; i < length_1; i++) {\r\n var call = _self.snippet.queue[i];\r\n call();\r\n }\r\n _self.snippet.queue = undefined;\r\n delete _self.snippet.queue;\r\n }\r\n }\r\n catch (exception) {\r\n var properties = {};\r\n if (exception && CoreUtils.isFunction(exception.toString)) {\r\n properties.exception = exception.toString();\r\n }\r\n // need from core\r\n // Microsoft.ApplicationInsights._InternalLogging.throwInternal(\r\n // LoggingSeverity.WARNING,\r\n // _InternalMessageId.FailedToSendQueuedTelemetry,\r\n // \"Failed to send queued telemetry\",\r\n // properties);\r\n }\r\n };\r\n Initialization.prototype.pollInternalLogs = function () {\r\n this.core.pollInternalLogs();\r\n };\r\n Initialization.prototype.addHousekeepingBeforeUnload = function (appInsightsInstance) {\r\n // Add callback to push events when the user navigates away\r\n if (hasWindow() || hasDocument()) {\r\n var performHousekeeping = function () {\r\n // Adds the ability to flush all data before the page unloads.\r\n // Note: This approach tries to push a sync request with all the pending events onbeforeunload.\r\n // Firefox does not respect this.Other browsers DO push out the call with < 100% hit rate.\r\n // Telemetry here will help us analyze how effective this approach is.\r\n // Another approach would be to make this call sync with a acceptable timeout to reduce the\r\n // impact on user experience.\r\n // appInsightsInstance.context._sender.triggerSend();\r\n appInsightsInstance.onunloadFlush(false);\r\n // Back up the current session to local storage\r\n // This lets us close expired sessions after the cookies themselves expire\r\n var ext = appInsightsInstance.appInsights.core['_extensions'][Common.PropertiesPluginIdentifier];\r\n if (ext && ext.context && ext.context._sessionManager) {\r\n ext.context._sessionManager.backup();\r\n }\r\n };\r\n if (!appInsightsInstance.appInsights.config.disableFlushOnBeforeUnload) {\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 navigations.\r\n var added = CoreUtils.addEventHandler('beforeunload', performHousekeeping);\r\n added = CoreUtils.addEventHandler('pagehide', performHousekeeping) || added;\r\n // A reactNative app may not have a window and therefore the beforeunload/pagehide events -- so don't\r\n // log the failure in this case\r\n if (!added && !isReactNative()) {\r\n appInsightsInstance.appInsights.core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToAddHandlerForOnBeforeUnload, 'Could not add handler for beforeunload and pagehide');\r\n }\r\n }\r\n // We also need to hook the pagehide event as not all versions of Safari support load/unload events.\r\n if (!appInsightsInstance.appInsights.config.disableFlushOnUnload) {\r\n // Not adding any telemetry as pagehide as it's not supported on all browsers\r\n CoreUtils.addEventHandler('pagehide', performHousekeeping);\r\n }\r\n }\r\n };\r\n Initialization.prototype.getSKUDefaults = function () {\r\n var _self = this;\r\n _self.config.diagnosticLogInterval =\r\n _self.config.diagnosticLogInterval && _self.config.diagnosticLogInterval > 0 ? _self.config.diagnosticLogInterval : 10000;\r\n };\r\n return Initialization;\r\n}());\r\nexport { Initialization };\r\n// tslint:disable-next-line\r\n(function () {\r\n var sdkSrc = null;\r\n var isModule = false;\r\n var cdns = [\r\n \"://az416426.vo.msecnd.net/\"\r\n ];\r\n try {\r\n // Try and determine whether the sdk is being loaded from the CDN\r\n // currentScript is only valid during initial processing\r\n var scrpt = (document || {}).currentScript;\r\n if (scrpt) {\r\n sdkSrc = scrpt.src;\r\n // } else {\r\n // // We need to update to at least typescript 2.9 for this to work :-(\r\n // // Leaving as a stub for now so after we upgrade this breadcrumb is available\r\n // let meta = import.meta;\r\n // sdkSrc = (meta || {}).url;\r\n // isModule = true;\r\n }\r\n }\r\n catch (e) {\r\n }\r\n if (sdkSrc) {\r\n try {\r\n var url = sdkSrc.toLowerCase();\r\n if (url) {\r\n var src = \"\";\r\n for (var idx = 0; idx < cdns.length; idx++) {\r\n if (url.indexOf(cdns[idx]) !== -1) {\r\n src = \"cdn\" + (idx + 1);\r\n if (url.indexOf(\"/scripts/\") === -1) {\r\n if (url.indexOf(\"/next/\") !== -1) {\r\n src += \"-next\";\r\n }\r\n else if (url.indexOf(\"/beta/\") !== -1) {\r\n src += \"-beta\";\r\n }\r\n }\r\n _internalSdkSrc = src + (isModule ? \".mod\" : \"\");\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n catch (e) {\r\n }\r\n }\r\n})();\r\n//# sourceMappingURL=Initialization.js.map","/*!\n * Application Insights JavaScript SDK - Web, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { AppInsightsDeprecated } from \"./ApplicationInsightsDeprecated\";\r\nimport { Initialization as ApplicationInsights } from \"./Initialization\";\r\nvar ApplicationInsightsContainer = /** @class */ (function () {\r\n function ApplicationInsightsContainer() {\r\n }\r\n ApplicationInsightsContainer.getAppInsights = function (snippet, version) {\r\n var initialization = new ApplicationInsights(snippet);\r\n var legacyMode = version !== 2.0 ? true : false;\r\n // Two target scenarios:\r\n // 1. Customer runs v1 snippet + runtime. If customer updates just cdn location to new SDK, it will run in compat mode so old apis work\r\n // 2. Customer updates to new snippet (that uses cdn location to new SDK. This is same as a new customer onboarding\r\n // and all api signatures are expected to map to new SDK. Note new snippet specifies version\r\n if (version === 2.0) {\r\n initialization.updateSnippetDefinitions(snippet);\r\n initialization.loadAppInsights(legacyMode);\r\n return initialization; // default behavior with new snippet\r\n }\r\n else {\r\n var legacy = new AppInsightsDeprecated(snippet, initialization); // target scenario old snippet + updated endpoint\r\n legacy.updateSnippetDefinitions(snippet);\r\n initialization.loadAppInsights(legacyMode);\r\n return legacy;\r\n }\r\n };\r\n return ApplicationInsightsContainer;\r\n}());\r\nexport { ApplicationInsightsContainer };\r\n//# sourceMappingURL=ApplicationInsightsContainer.js.map","/*!\n * Application Insights JavaScript SDK - Web, 2.5.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { ApplicationInsightsContainer } from \"./ApplicationInsightsContainer\";\r\nexport { Initialization as ApplicationInsights, Telemetry } from \"./Initialization\";\r\n\"use strict\";\r\nvar Undefined = \"undefined\";\r\nfunction _logWarn(aiName, message) {\r\n // TODO: Find better place to warn to console when SDK initialization fails\r\n var _console = typeof console !== Undefined ? console : null;\r\n if (_console && _console.warn) {\r\n _console.warn('Failed to initialize AppInsights JS SDK for instance ' + (aiName || '') + ' - ' + message);\r\n }\r\n}\r\n// should be global function that should load as soon as SDK loads\r\ntry {\r\n // E2E sku on load initializes core and pipeline using snippet as input for configuration\r\n // tslint:disable-next-line: no-var-keyword\r\n var aiName;\r\n if (typeof window !== Undefined) {\r\n var _window = window;\r\n aiName = _window[\"appInsightsSDK\"] || \"appInsights\";\r\n if (typeof JSON !== Undefined) {\r\n // get snippet or initialize to an empty object\r\n if (_window[aiName] !== undefined) {\r\n // this is the typical case for browser+snippet\r\n var snippet = _window[aiName] || { version: 2.0 };\r\n // overwrite snippet with full appInsights\r\n // only initiaize if required and detected snippet version is >= 2 or not defined\r\n if ((snippet.version >= 2.0 && _window[aiName].initialize) || snippet.version === undefined) {\r\n ApplicationInsightsContainer.getAppInsights(snippet, snippet.version);\r\n }\r\n }\r\n }\r\n else {\r\n _logWarn(aiName, \"Missing JSON - you must supply a JSON polyfill!\");\r\n }\r\n }\r\n else {\r\n _logWarn(aiName, \"Missing window\");\r\n }\r\n // Hack: If legacy SDK exists, skip this step (Microsoft.ApplicationInsights exists).\r\n // else write what was there for v2 SDK prior to rollup bundle output name change.\r\n // e.g Microsoft.ApplicationInsights.ApplicationInsights, Microsoft.ApplicationInsights.Telemetry\r\n // @todo uncomment once integration tests for this can be added\r\n // if (typeof window !== Undefined && window && ((window as any).Microsoft && !(window as any).Microsoft.ApplicationInsights)) {\r\n // (window as any).Microsoft = (window as any).Microsoft || {};\r\n // (window as any).Microsoft.ApplicationInsights = {\r\n // ApplicationInsights, Telemetry\r\n // };\r\n // }\r\n}\r\ncatch (e) {\r\n _logWarn(aiName, e.message);\r\n}\r\n//# sourceMappingURL=Init.js.map"],"names":["strShimFunction","strShimObject","strShimUndefined","strShimPrototype","strShimHasOwnProperty","getGlobal","globalThis","self","window","global","objCreateFn","obj","func","Object","type","TypeError","tmpFunc","StorageType","FieldType","DistributedTracingModes","__extendStaticsFn","d","b","__proto__","Array","p","extendsFn","__","this","constructor","root","globalObj","__assign","assign","t","s","i","n","arguments","length","call","__extends","EventsDiscardedReason","Unknown","NonRetryableStatus","InvalidEvent","SizeLimitExceeded","KillSwitch","QueueFull","strUndefined","strObject","strPrototype","strFunction","strWindow","strDocument","strNavigator","strLocation","strPerformance","strJSON","shimsGetGlobal","getGlobalInst","name","gbl","hasWindow","getWindow","hasDocument","document","getDocument","getNavigator","navigator","getLocation","location","getPerformance","hasJSON","JSON","getJSON","strAttachEvent","strAddEventHelper","strDetachEvent","strRemoveEventListener","UInt32Mask","MaxUInt32","_isTrident","_mwcSeeded","_mwcW","_mwcZ","_mwcSeed","seedValue","_autoSeedMwc","Math","random","Date","getTime","_isTypeof","value","theType","_isUndefined","undefined","_isNullOrUndefined","_hasOwnProperty","prop","hasOwnProperty","_isObject","_isFunction","_attachEvent","eventNameWithoutOn","handlerRef","useCapture","result","e","_detachEvent","CoreUtils","isDate","toString","isArray","isError","isString","isNumber","isBoolean","disableCookies","_canUseCookies","newGuid","replace","GuidRegex","c","r","randomValue","toISOString","date","pad","num","String","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","toFixed","slice","arrForEach","arr","callbackfn","thisArg","len","idx","arrIndexOf","searchElement","fromIndex","lp","max","from","abs","arrMap","_this","results","arrReduce","initialValue","strTrim","str","objKeys","hasDontEnumBug","propertyIsEnumerable","push","dontEnums","dontEnumsLength","objDefineAccessors","target","getProp","setProp","defineProp","descriptor","enumerable","configurable","get","set","addEventHandler","eventName","callback","w","doc","EventHelper","Attach","dateNow","dt","now","perfNow","perf","newId","maxLength","number","random32","chars","base64chars","isIE","userAgent","toLowerCase","indexOf","maxValue","floor","signed","getRandomValues","Uint32Array","mwcRandom32","mwcRandomSeed","generateW3CId","tmp","hexValues","oct","a","clockSequenceHi","substr","isTypeof","isUndefined","isNullOrUndefined","isFunction","isObject","objCreate","LoggingSeverity","AttachEvent","Detach","DetachEvent","_InternalMessageId","BrowserDoesNotSupportLocalStorage","BrowserCannotReadLocalStorage","BrowserCannotReadSessionStorage","BrowserCannotWriteLocalStorage","BrowserCannotWriteSessionStorage","BrowserFailedRemovalFromLocalStorage","BrowserFailedRemovalFromSessionStorage","CannotSendEmptyTelemetry","ClientPerformanceMathError","ErrorParsingAISessionCookie","ErrorPVCalc","ExceptionWhileLoggingError","FailedAddingTelemetryToBuffer","FailedMonitorAjaxAbort","FailedMonitorAjaxDur","FailedMonitorAjaxOpen","FailedMonitorAjaxRSC","FailedMonitorAjaxSend","FailedMonitorAjaxGetCorrelationHeader","FailedToAddHandlerForOnBeforeUnload","FailedToSendQueuedTelemetry","FailedToReportDataLoss","FlushFailed","MessageLimitPerPVExceeded","MissingRequiredFieldSpecification","NavigationTimingNotSupported","OnError","SessionRenewalDateIsZero","SenderNotInitialized","StartTrackEventFailed","StopTrackEventFailed","StartTrackFailed","StopTrackFailed","TelemetrySampledAndNotSent","TrackEventFailed","TrackExceptionFailed","TrackMetricFailed","TrackPVFailed","TrackPVFailedCalc","TrackTraceFailed","TransmissionFailed","FailedToSetStorageBuffer","FailedToRestoreStorageBuffer","InvalidBackendResponse","FailedToFixDepricatedValues","InvalidDurationValue","TelemetryEnvelopeInvalid","CreateEnvelopeError","CannotSerializeObject","CannotSerializeObjectNonSerializable","CircularReferenceDetected","ClearAuthContextFailed","ExceptionTruncated","IllegalCharsInName","ItemNotInArray","MaxAjaxPerPVExceeded","MessageTruncated","NameTooLong","SampleRateOutOfRange","SetAuthContextFailed","SetAuthContextFailedAccountName","StringValueTooLong","StartCalledMoreThanOnce","StopCalledWithoutStart","TelemetryInitializerFailed","TrackArgumentsNotSpecified","UrlTooLong","SessionStorageBufferFull","CannotAccessCookie","IdTooLong","FailedMonitorAjaxSetRequestHeader","SendBrowserInfoOnUserInit","PluginException","NotificationException","SnippetScriptLoadFailure","InvalidInstrumentationKey","Constructor","Prototype","DynInstFuncTable","DynProxyTag","DynClassName","DynClassNamePrefix","UnknownValue","str__Proto","_objGetPrototypeOf","_dynamicNames","_isObjectOrArrayPrototype","_isObjectArrayOrFunctionPrototype","Function","_getObjProto","newProto","_isDynamicCandidate","funcName","skipOwn","_throwTypeError","message","_getObjName","unknownValue","dynamicProto","theClass","delegateFunc","classProto","thisProto","_checkPrototype","className","thisTarget","instFuncs","_instFuncProxy","theFunc","apply","baseFuncs","baseProto","visited","values","_hasVisited","_getBaseFuncs","_getInstanceFuncs","proto","baseInstFuncs","instFuncTable","dynProtoProxy","instFunc","protoFunc","_createDynamicPrototype","_populatePrototype","_sanitizeDiagnosticText","text","_InternalLogMessage","dataType","msgId","msg","isUserAct","properties","messageId","strProps","stringify","diagnosticText","DiagnosticLogger","config","identifier","queue","_messageCount","_messageLogged","_self","_getConfigValue","defValue","consoleLoggingLevel","telemetryLoggingLevel","maxInternalMessageLimit","enableDebugExceptions","throwInternal","severity","messageKey","WARNING","warnToConsole","logInternalMessage","logFunc","theConsole","console","warn","resetInternalMessageCount","logMessage","throttleLimitMessage","throttleMessage","strExecutionContextKey","PerfEvent","ParentContextKey","ChildrenContextKey","payloadDetails","isAsync","theDetails_1","accessorDefined","start","isChildEvt","getCtx","key","setCtx","complete","childTime","childEvts","childEvt","time","exTime","payload","PerfManager","manager","ctx","create","src","fire","perfEvent","doPerfActiveKey","doPerf","mgrSource","getSource","details","perfMgr","children","perfEvt","currentActive","ex","TelemetryPluginChain","plugin","defItemCtx","_nextProxy","_hasProcessTelemetry","processTelemetry","_hasSetNext","setNextPlugin","_hasRun","getPlugin","getNext","setNext","nextPlugin","env","itemCtx","core","error","hasRun","diagLog","CRITICAL","item","_createProxyChain","plugins","proxies","lastProxy","thePlugin","newProxy","ProcessTelemetryContext","startAt","add","proxy","_copyProxyChain","logger","getCfg","getExtCfg","defaultValue","theConfig","extConfig","extensionConfig","getConfig","field","theValue","hasNext","processNext","createNew","BaseTelemetryPlugin","prototype","initialize","extensions","pluginChain","_baseTelInit","_isinitialized","_rootCtx","_nextPlugin","_getTelCtx","isInitialized","setInitialized","next","currentCtx","rootCtx","getProcessTelContext","priority","initializePlugins","processContext","initPlugins","lastPlugin","sortPlugins","sort","extA","extB","bHasProcess","_super","ChannelControllerPriority","ChannelValidationMessage","_objDefineAccessors","ChannelController","_staticInit","getChannelControls","_channelQueue","_arrForEach","_addChannelQueue","queueItem","Error","_base","queues","channels","extensionQueue_1","isCookieUseDisabled","strNotificationManager","NotificationManager","listeners","perfEvtsSendAll","addNotificationListener","listener","removeNotificationListener","index","splice","eventsSent","events","setTimeout","eventsDiscarded","reason","eventsSendRequest","sendReason","AppInsightsCore","BaseCore","_eventQueue","_channelController","_notificationManager","_perfManager","_isInitialized","_extensions","notificationManager","instrumentationKey","allExtensions","concat","coreExtensions","extPriorities","ext","extPriority","getTransmissionControls","releaseQueue","track","telemetryItem","iKey","ver","thePlugins","getNotifyMgr","getPerfMgr","enablePerfMgr","setPerfMgr","eventCnt","event","_notifyInvalidEvent","_validateTelemetryItem","pollInternalLogs","interval","diagnosticLogInterval","setInterval","baseType","baseData","aiInstrumentHooks","cbNames","strConstructor","_arrLoop","fn","_doCallbacks","hooks","callDetails","cbArgs","hookCtx","hook","cbks","cb","inst","err","orgEx","hookErrorCb","_createFunctionHook","aiHook","orgArgs","h","funcArgs","_createArgs","theArgs","arg","f","rslt","InstrumentFunc","callbacks","checkPrototype","owner","_getOwner","aiHook_1","newFunc","theHook","id","rm","RequestHeaders","requestContextHeader","requestContextTargetKey","requestContextAppIdFormat","requestIdHeader","traceParentHeader","sdkContextHeader","sdkContextHeaderAppIdRequest","requestContextHeaderLowerCase","DataSanitizer","sanitizeKeyAndAddUniqueness","map","origLength","sanitizeKey","uniqueField","substring","MAX_NAME_LENGTH","padNumber","nameTrunc","trim","sanitizeString","valueTrunc","MAX_STRING_LENGTH","sanitizeUrl","url","sanitizeInput","MAX_URL_LENGTH","sanitizeMessage","messageTrunc","MAX_MESSAGE_LENGTH","sanitizeException","exception","exceptionTrunc","MAX_EXCEPTION_LENGTH","sanitizeProperties","tempProps","MAX_PROPERTY_LENGTH","sanitizeMeasurements","measurements","tempMeasurements","measure","sanitizeId","MAX_ID_LENGTH","input","_msgId","inputTrunc","data","_navigator","_isString","_uaDisallowsSameSiteNone","Util","createDomEvent","Event","createEvent","initEvent","disableStorage","_canUseLocalStorage","_canUseSessionStorage","_getLocalStorageObject","canUseLocalStorage","_getVerifiedStorageObject","LocalStorage","storageType","fail","uid","storage","setItem","getItem","removeItem","isInternalApplicationInsightsEndpoint","endpointUrl","_internalEndpoints","getStorage","getExceptionName","dump","setStorage","removeStorage","_getSessionStorageObject","canUseSessionStorage","SessionStorage","getSessionStorageKeys","keys","getSessionStorage","setSessionStorage","removeSessionStorage","canUseCookies","cookie","disallowsSameSiteNone","search","setCookie","domain","domainAttrib","secureAttrib","location_1","protocol","stringToBoolOrDefault","getCookie","cookieName","cookies","split","deleteCookie","getIEVersion","userAgentStr","myNav","parseInt","tridentVer","msToTimeSpan","totalms","isNaN","ms","round","sec","min","hour","days","isCrossOriginError","lineNumber","columnNumber","object","objectTypeDump","propertyValueDump","stack","IsBeaconApiSupported","sendBeacon","getExtension","extension","extIx","NotSpecified","toISOStringForIE8","UrlHelper","parseUrl","anchorIdx","_htmlAnchorIdx","anchorCache","_htmlAnchorElement","tempAnchor","createElement","host","parseHost","href","getAbsoluteUrl","getPathName","pathname","getCompleteUrl","method","absoluteUrl","toUpperCase","inclPort","fullHost","parseFullHost","match","port","CorrelationIdHelper","canIncludeCorrelationHeader","requestUrl","currentHost","disableCorrelationHeaders","correlationHeaderExcludePatterns","test","matchExists_1","requestHost","enableCorsCorrelation","includedDomains","correlationHeaderDomains","regex","RegExp","excludedDomains","correlationHeaderExcludedDomains","getCorrelationContext","responseHeader","correlationId","getCorrelationContextValue","correlationIdPrefix","keyValues","keyValue","AjaxHelper","ParseDependencyPath","commandName","parsedUrl","pathName","DateTimeUtils","Now","timing","navigationStart","GetDuration","end","DisabledPropertyName","SampleRate","ProcessLegacy","HttpMethod","DEFAULT_BREEZE_ENDPOINT","ConnectionStringParser","parse","connectionString","kvPairs","_FIELDS_SEPARATOR","fields","kv","kvParts","_FIELD_KEY_VALUE_SEPARATOR","endpointsuffix","locationPrefix","ingestionendpoint","Data","Base","Envelope","sampleRate","tags","aiDataContract","Required","Hidden","EventData","Domain","envelopeType","Default","StackFrame","ExceptionData","exceptions","ExceptionDetails","hasFullStack","parsedStack","strError","Exception","CreateFromInterface","_ExceptionDetails","toInterface","severityLevel","problemGroup","isManual","CreateSimpleException","typeName","assembly","fileName","line","frame","outerId","_StackFrame","parseStack","frames_1","level","totalSizeInBytes","parsedFrame","sizeInBytes","left","right","size","acceptedLeft","acceptedRight","howMany","evt","errorType","exec","_getErrorType","baseSize","sourceFrame","matches","DataPointType","MetricData","metrics","DataPoint","kind","Measurement","count","stdDev","Metric","dataPoint","PageViewData","PageView","durationMs","duration","RemoteDependencyData","success","GeneratedRemoteDependencyData","resultCode","requestAPI","correlationContext","dependencyKind","dependencySource","dependencyTypeName","dependencyFields","MessageData","Trace","PageViewPerfData","PageViewPerformance","unused","cs4BaseData","perfTotal","networkConnect","sentRequest","receivedResponse","domProcessing","SeverityLevel","AIData","ConfigurationManager","configValue","ContextTagKeys","applicationVersion","applicationBuild","applicationTypeId","applicationId","applicationLayer","deviceId","deviceIp","deviceLanguage","deviceLocale","deviceModel","deviceFriendlyName","deviceNetwork","deviceNetworkName","deviceOEMName","deviceOS","deviceOSVersion","deviceRoleInstance","deviceRoleName","deviceScreenResolution","deviceType","deviceMachineName","deviceVMName","deviceBrowser","deviceBrowserVersion","locationIp","locationCountry","locationProvince","locationCity","operationId","operationName","operationParentId","operationRootId","operationSyntheticSource","operationCorrelationVector","sessionId","sessionIsFirst","sessionIsNew","userAccountAcquisitionDate","userAccountId","userId","userStoreRegion","userAuthUserId","userAnonymousUserAcquisitionDate","userAuthenticatedUserAcquisitionDate","cloudName","cloudRole","cloudRoleVer","cloudRoleInstance","cloudEnvironment","cloudLocation","cloudDeploymentUnit","internalNodeName","internalSdkVersion","internalAgentVersion","internalSnippet","internalSdkSrc","TelemetryItemCreator","envelopeName","customProperties","systemProperties","Extensions","UserExt","DeviceExt","TraceExt","WebExt","AppExt","OSExt","SessionExt","SDKExt","CtxTagKeys","PropertiesPluginIdentifier","BreezeChannelIdentifier","AnalyticsPluginIdentifier","AppInsightsDeprecated","getDefaultConfig","sessionRenewalMs","sessionExpirationMs","maxBatchSizeInBytes","maxBatchInterval","enableDebug","disableExceptionTracking","disableTelemetry","verboseLogging","emitLineDelimitedJson","autoTrackPageVisitTime","samplingPercentage","disableAjaxTracking","maxAjaxCallsPerView","isBeaconApiDisabled","disableFlushOnBeforeUnload","disableFlushOnUnload","enableSessionStorageBuffer","isRetryDisabled","isStorageUseDisabled","isBrowserLinkTrackingEnabled","addTelemetryInitializers","callBack","_hasLegacyInitializers","appInsightsNew","addTelemetryInitializer","_processLegacyInitializers","_queue","startTrackPage","stopTrackPage","trackPageView","telemetry","uri","trackEvent","trackDependency","totalTime","trackDependencyData","responseCode","trackException","handledAt","trackMetric","average","sampleCount","trackTrace","flush","async","setAuthenticatedUserContext","authenticatedUserId","accountId","storeInCookie","context","user","clearAuthenticatedUserContext","_onerror","startTrackEvent","stopTrackEvent","downloadAndSetup","updateSnippetDefinitions","snippet","loadAppInsights","originalTrackPageView_1","pagePath","legacyPageView","legacyEvent","props","bind","PageViewManager","appInsights","overridePageViewDuration","pageViewPerformanceManager","_logger","intervalHandle","itemQueue","pageViewPerformanceSent","_flushChannels","q","pageView","title","isPerformanceTimingSupported","sendPageViewInternal","customDuration","pageViewSent","getPerformanceTiming","shouldCollectDuration","pageViewPerformance","processed","isPerformanceTimingDataReady","populatePageViewPerformanceEvent","isValid","sendPageViewPerformanceInternal","allItems","doFlush","clearInterval","PageVisitTimeManager","trackPreviousPageVisit","currentPageName","currentPageUrl","prevPageVisitTimeData","restartPageVisitTimer","pageVisitTimeTrackingHandler","pageName","pageUrl","pageVisitTime","prevPageVisitData","stopPageVisitTimer","startPageVisitTimer","prevPageVisitDataKeyName","currPageVisitData","PageVisitData","currPageVisitDataStr","pageVisitEndTime","pageVisitDataJsonStr","pageVisitStartTime","PageViewPerformanceManager","total","network","request","response","navigationTiming","getPerformanceNavigationTiming","dom","startTime","connectEnd","requestStart","responseStart","responseEnd","loadEventEnd","isPerformanceNavigationTimingSupported","getEntriesByType","domainLookupStart","domLoading","durations","_i","botAgentNames","isGoogleBot","MAX_DURATION_ALLOWED","durationProperty","_dispatchEvent","evnt","dispatchEvent","ApplicationInsights","enableUnhandledPromiseRejectionTracking","enableAutoRouteTracking","namePrefix","doNotSendItem","telemetryInitializersCount","_telemetryInitializers","telemetryInitializer","EventTelemetry","_eventTracking","stop","trace","metric","inPv","_pageViewManager","_pageVisitTimeManager","refUri","referrer","_trackAjaxAttempts","trackPageViewPerformance","_pageViewPerformanceManager","_pageTracking","measurement","loc","sendExceptionInternal","exceptionPartB","properties_1","URL","_sendCORSException","errorString","_globalconfig","defaults","configGetters","cookieDomain","sdkExtension","appId","trackPageVisitTime","_addDefaultTelemetryInitializers","Timing","action","pageViewItem","originalOnError_1","originalOnUnhandledRejection_1","_self_1","_window","_history","history","_location","instance","autoExceptionInstrumented","onerror","handled","autoUnhandledPromiseInstrumented","onunhandledrejection","pushState","replaceState","_properties","ret","addEventListener","telemetryTrace","traceID","_currUri","_prevUri","autoRoutePVDelay","PageName","PageUrl","browserLinkPaths_1","_addTelemetryInitializer","envelope","remoteData","Version","_events","_name","ArraySendBuffer","_buffer","enqueue","clear","getItems","batchPayloads","join","markAsSent","clearSent","SessionStorageSendBuffer","BUFFER_KEY","SENT_BUFFER_KEY","MAX_BUFFER_SIZE","_bufferFullMessageSent","bufferItems","_getBuffer","notDeliveredItems","_removePayloadsFromBuffer","payloads","buffer","remaining","prefixedKey","bufferJson","_setBuffer","sentElements","strBaseType","strBaseData","strProperties","_setValueIf","EnvelopeCreator","extractPropsAndMeasurements","createEnvelope","iKeyNoDashes","extractPartAExtensions","envTags","itmExt","itmTags","extUser","authId","localId","extApp","app","sesId","extDevice","device","deviceClass","ip","model","web","browserLang","browserVer","browser","envProps","envBaseData","envData","screenRes","userConsent","extOs","os","extTrace","parentID","tgs","tg","_loop_1","Init","DependencyEnvelopeCreator","Create","customMeasurements","bd","remoteDepData","EventEnvelopeCreator","eventData","ExceptionEnvelopeCreator","exData","MetricEnvelopeCreator","baseMetricData","PageViewEnvelopeCreator","strDuration","currentContextId","pageTags_1","pageType","isLoggedIn","pageViewData","PageViewPerformanceEnvelopeCreator","TraceEnvelopeCreator","Serializer","_serializeObject","source","circularReferenceCheck","output","_serializeStringMap","_serializeArray","contract","isRequired","isHidden","isPresent","sources","expectedType","parseFloat","serialize","OfflineListener","_document","isListening","_onlineStatus","_setOnline","_setOffline","body","ononline","onoffline","isOnline","onLine","isOffline","Offline","HashCodeScoreGenerator","getHashCodeScore","getHashCode","INT_MAX_VALUE","MIN_INPUT_LENGTH","hash","charCodeAt","SamplingScoreGenerator","getSamplingScore","hashCodeGeneragor","Sample","isSampledIn","samplingScoreGenerator","samplingRate","_getResponseText","xhr","responseText","Sender","constructEnvelope","orig","_getDefaultAppInsightsChannelConfig","onunloadDisableBeacon","_getEmptyAppInsightsChannelConfig","_consecutiveErrors","_retryAt","_timeoutHandle","_serializer","_XMLHttpRequestSupported","_notImplemented","_beaconSender","_senderConfig","batch","plainTextBatch","Blob","_onSuccess","_xhrSender","XMLHttpRequest","endPointUrl","open","setRequestHeader","onreadystatechange","_xhrReadyStateChange","_onError","_formatErrorMessageXhr","send","_parseResponse","itemsReceived","itemsAccepted","errors","_resendPayload","linearFactor","payload_1","delayInSeconds","backOffSlot","pow","backOffDelay","retryAfterTimeSpan","_setRetryTime","_setupTimer","timerValue","retryInterval","triggerSend","_isRetriable","statusCode","status","_xdrSender","xdr","XDomainRequest","onload","_xdrOnLoad","_formatErrorMessageXdr","hostingProtocol","lastIndexOf","_notifySendRequest","sendRequest","pause","resume","onunloadFlush","teardown","_sender","defaultConfig","_sample","disableInstrumentaionKeyValidation","aiEnvelope_1","doNotSendItem_1","bufferPayload","countOfItemsInPayload","readyState","_appId","_onPartialSuccess","forcedSender","clearTimeout","ieVer","failed","retry","errors_1","reverse","extracted","Session","_SessionManager","update","automaticSession","initializeAutomaticSession","acquisitionExpired","acquisitionDate","renewalExpired","renewalDate","renew","cookieUpdatedTimestamp","cookieUpdateInterval","backup","_storageNamePrefix","initializeAutomaticSessionWithData","sessionData","renewal","params","acq","idLength","guid","acquisitionExpiry","renewalExpiry","cookieExpiry","setTime","UTCString","toUTCString","acquisitionSpan","renewalSpan","cookieNameConst","Application","Device","Internal","sdkVersion","User","validateUserInput","authenticatedId","authCookie","cookieSeparator","authUserCookieName","encodeURI","userCookieName","isNewUser","newCookie","acqStr","accountAcquisitionDate","name_1","authCookieString","decodeURI","Location","TelemetryTrace","parentId","TelemetryContext","applySessionContext","session","sessionManager","sessionContext","applyOperatingSystemContxt","applyApplicationContext","application","build","applyDeviceContext","applyInternalContext","internal","agentVersion","snippetVer","sdkSrc","applyLocationContext","applyOperationContext","applyWebContext","applyUserContext","cleanUp","PropertiesPlugin","_extensionConfig","this_1","_breezeChannel","_processTelemetryInternal","_objKeys","_calcPerfDuration","resourceEntry","to","_setPerfDuration","_setPerfValue","strPerf","XHRMonitoringState","openDone","setRequestHeaderDone","sendDone","abortDone","stateChangeAttached","ajaxRecord","spanID","strResponseText","perfMark","completed","requestHeadersSize","requestHeaders","responseReceivingDuration","callbackDuration","ajaxTotalDuration","aborted","requestSize","requestSentTime","responseStartedTime","responseFinishedTime","callbackFinishedTime","endTime","xhrMonitoringState","clientFailure","CreateTrackItem","ajaxType","enableRequestHeaderTracking","getResponse","_a","dependency","ajaxData","perfTiming","propsSet","strStartTime","strConnectEnd","strRequestStart","strResponseEnd","strTransferSize","strEncodedBodySize","strDecodedBodySize","strServerTiming","strEnd","strRedirect","strDomainLookup","strConnect","strRequest","strResponse","serverTiming","server_1","newValue","val","perfAttempts","headerMap","responseHeaders","responseType","statusText","Traceparent","isValidTraceId","isValidSpanId","version","traceId","spanId","traceFlag","DEFAULT_TRACE_FLAG","DEFAULT_VERSION","AJAX_MONITOR_PREFIX","strDiagLog","strAjaxData","strThrowInternal","strFetch","_markCount","_supportsAjaxMonitoring","ajaxMonitorInstance","abort","theOpen","_throwInternalCritical","_getFailedAjaxDiagnosticsMessage","_throwInternalWarning","_createErrorCallbackFunc","internalMessage","args","ajaxDiagnosticsMessage","_indexOf","_internalSdkSrc","AjaxMonitor","disableFetchTracking","distributedTracingMode","AI","enableResponseHeaderTracking","enableAjaxErrorStatusText","enableAjaxPerfTracking","maxAjaxPerfLookupAttempts","ajaxPerfLookupDelay","getEmptyConfig","emptyConfig","_context","_isUsingW3CHeaders","_isUsingAIHeaders","_markPrefix","_enableAjaxPerfTracking","_enableResponseHeaderTracking","strTrackDependencyDataInternal","_fetchInitialized","_xhrInitialized","_currentWindowHost","_config","_enableRequestHeaderTracking","_maxAjaxCallsPerView","_hooks","_disabledUrls","base","_hookProto","_isDisabledRequest","init","isDisabled","theUrl","idx2","_isMonitoredXhrInstance","excludeAjaxDataValidation","ajaxValidation","initialized","_attachToOnReadyStateChange","_findPerfResourceEntry","responseHeaderMap_2","ajaxResponse","_getAjaxCorrelationContext","headers","getAllResponseHeaders","header","parts","shift","_reportXhrError","exceptionText","failedProps","errorProps","responseHeadersString","getResponseHeader","_createMarkId","performance_1","mark","markId","entries","getEntriesByName","initiatorType","trackCallback","reportError","performance","maxAttempts","retryDelay","attempt","locateResourceTiming","getEntries","entry","entryType","clearMarks","_getFailedFetchDiagnosticsMessage","_reportFetchMetrics","_reportFetchError","_getFetchCorrelationContext","fetchDiagnosticsMessage","ctx_1","defaultConfig_1","AI_AND_W3C","W3C","req","hkErr","includeCorrelationHeaders","fetch","_global","Request","isPolyfill","polyfill","fetchData","Headers","forEach","_createFetchRecord","newInit","rsp","then","responseHeaderMap_1","propExt","traceparent","currentWindowHost","Telemetry","Common","Initialization","inPvp","dependencies","channel","legacyMode","appInsightsChannel","_snippetVersion","_updateSnippetProperties","emptyQueue","addHousekeepingBeforeUnload","Common.Util","length_1","appInsightsInstance","performHousekeeping","nav","Common.PropertiesPluginIdentifier","_sessionManager","added","product","getSKUDefaults","sv","cs","ingest","Common.ConnectionStringParser","instrumentationkey","DependenciesPlugin","cdns","scrpt","currentScript","ApplicationInsightsContainer","getAppInsights","initialization","legacy","aiName","Undefined","_logWarn","_console"],"mappings":";;;;sCAEO,IAAIA,EAAkB,WAClBC,EAAgB,SAChBC,EAAmB,YACnBC,EAAmB,YACnBC,EAAwB,iBAa5B,SAASC,IACZ,cAAWC,aAAeJ,GAAoBI,WACnCA,kBAEAC,OAASL,GAAoBK,KAC7BA,YAEAC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