{"version":3,"file":"ai.1.min.js","sources":["../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js","../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js","../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CoreUtils.js","../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/NotificationManager.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Enums.js","../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DiagnosticLogger.js","../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/AppInsightsCore.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/RequestResponseHeaders.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/DataSanitizer.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Util.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Constants.js","../node_modules/tslib/tslib.es6.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/Base.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/DataPointType.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/Data.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/Envelope.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/Envelope.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/Domain.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/EventData.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Event.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/StackFrame.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Exception.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/MetricData.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/DataPoint.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/SeverityLevel.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/DataPoint.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Metric.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/PageViewData.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/PageView.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/RemoteDependencyData.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Trace.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/MessageData.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/PageViewPerformance.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/Data.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/IConfig.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/Generated/ContextTagKeys.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/TelemetryItemCreator.js","../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/PartAExtensions.js","../node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js","../node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/ApplicationInsights.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/SendBuffer.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/EnvelopeCreator.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryValidation/EventValidator.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryValidation/TraceValidator.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryValidation/ExceptionValidator.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryValidation/MetricValidator.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryValidation/PageViewPerformanceValidator.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryValidation/PageViewValidator.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryValidation/RemoteDepdencyValidator.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/Serializer.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/Offline.js","../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/Sender.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Session.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Application.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Device.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Internal.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Location.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Operation.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/User.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/HashCodeScoreGenerator.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/SamplingScoreGenerator.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Sample.js","../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/PropertiesPlugin.js","../node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/ajaxRecord.js","../node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/ajaxUtils.js","../node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/ajax.js","../dist-esm/Initialization.js","../dist-esm/Init.js"],"sourcesContent":["// 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\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};\r\n//# sourceMappingURL=LoggingEnums.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nvar CoreUtils = /** @class */ (function () {\r\n function CoreUtils() {\r\n }\r\n CoreUtils.isNullOrUndefined = function (input) {\r\n return input === null || input === undefined;\r\n };\r\n /**\r\n* Creates a new GUID.\r\n* @return {string} A GUID.\r\n*/\r\n CoreUtils.newGuid = function () {\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(GuidRegex, function (c) {\r\n // tslint:disable-next-line:insecure-random\r\n var r = (Math.random() * 16 | 0), v = (c === 'x' ? r : r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n };\r\n return CoreUtils;\r\n}());\r\nexport { CoreUtils };\r\nvar GuidRegex = /[xy]/g;\r\n//# sourceMappingURL=CoreUtils.js.map","/**\r\n * Class to manage sending notifications to all the listeners.\r\n */\r\nvar NotificationManager = /** @class */ (function () {\r\n function NotificationManager() {\r\n this.listeners = [];\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 this.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 NotificationManager.prototype.removeNotificationListener = function (listener) {\r\n var index = this.listeners.indexOf(listener);\r\n while (index > -1) {\r\n this.listeners.splice(index, 1);\r\n index = this.listeners.indexOf(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 NotificationManager.prototype.eventsSent = function (events) {\r\n var _this = this;\r\n var _loop_1 = function (i) {\r\n if (this_1.listeners[i].eventsSent) {\r\n setTimeout(function () { return _this.listeners[i].eventsSent(events); }, 0);\r\n }\r\n };\r\n var this_1 = this;\r\n for (var i = 0; i < this.listeners.length; ++i) {\r\n _loop_1(i);\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 NotificationManager.prototype.eventsDiscarded = function (events, reason) {\r\n var _this = this;\r\n var _loop_2 = function (i) {\r\n if (this_2.listeners[i].eventsDiscarded) {\r\n setTimeout(function () { return _this.listeners[i].eventsDiscarded(events, reason); }, 0);\r\n }\r\n };\r\n var this_2 = this;\r\n for (var i = 0; i < this.listeners.length; ++i) {\r\n _loop_2(i);\r\n }\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\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\n//# sourceMappingURL=Enums.js.map","// 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\nvar _InternalLogMessage = /** @class */ (function () {\r\n function _InternalLogMessage(msgId, msg, isUserAct, properties) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n this.messageId = msgId;\r\n this.message =\r\n (isUserAct ? _InternalLogMessage.AiUserActionablePrefix : _InternalLogMessage.AiNonUserActionablePrefix) +\r\n msgId;\r\n var diagnosticText = (msg ? \" message:\" + _InternalLogMessage.sanitizeDiagnosticText(msg) : \"\") +\r\n (properties ? \" props:\" + _InternalLogMessage.sanitizeDiagnosticText(JSON.stringify(properties)) : \"\");\r\n this.message += diagnosticText;\r\n }\r\n _InternalLogMessage.sanitizeDiagnosticText = function (text) {\r\n return \"\\\"\" + text.replace(/\\\"/g, \"\") + \"\\\"\";\r\n };\r\n _InternalLogMessage.dataType = \"MessageData\";\r\n /**\r\n * For user non actionable traces use AI Internal prefix.\r\n */\r\n _InternalLogMessage.AiNonUserActionablePrefix = \"AI (Internal): \";\r\n /**\r\n * Prefix of the traces in portal.\r\n */\r\n _InternalLogMessage.AiUserActionablePrefix = \"AI: \";\r\n return _InternalLogMessage;\r\n}());\r\nexport { _InternalLogMessage };\r\nvar DiagnosticLogger = /** @class */ (function () {\r\n function DiagnosticLogger(config) {\r\n /**\r\n * Session storage key for the prefix for the key indicating message type already logged\r\n */\r\n this.AIInternalMessagePrefix = \"AITR_\";\r\n /**\r\n * When this is true the SDK will throw exceptions to aid in debugging.\r\n */\r\n this.enableDebugExceptions = function () { return false; };\r\n /**\r\n * 0: OFF\r\n * 1: CRITICAL (default)\r\n * 2: >= WARNING\r\n */\r\n this.consoleLoggingLevel = function () { return 1; };\r\n /**\r\n * 0: OFF (default)\r\n * 1: CRITICAL\r\n * 2: >= WARNING\r\n */\r\n this.telemetryLoggingLevel = function () { return 0; };\r\n /**\r\n * The maximum number of internal messages allowed to be sent per page view\r\n */\r\n this.maxInternalMessageLimit = function () { return 25; };\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 this._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 this._messageLogged = {};\r\n if (CoreUtils.isNullOrUndefined(config)) {\r\n // TODO: Use default config\r\n // config = AppInsightsCore.defaultConfig;\r\n // For now, use defaults specified in DiagnosticLogger members;\r\n return;\r\n }\r\n if (!CoreUtils.isNullOrUndefined(config.loggingLevelConsole)) {\r\n this.consoleLoggingLevel = function () { return config.loggingLevelConsole; };\r\n }\r\n if (!CoreUtils.isNullOrUndefined(config.loggingLevelTelemetry)) {\r\n this.telemetryLoggingLevel = function () { return config.loggingLevelTelemetry; };\r\n }\r\n if (!CoreUtils.isNullOrUndefined(config.maxMessageLimit)) {\r\n this.maxInternalMessageLimit = function () { return config.maxMessageLimit; };\r\n }\r\n if (!CoreUtils.isNullOrUndefined(config.enableDebugExceptions)) {\r\n this.enableDebugExceptions = function () { return config.enableDebugExceptions; };\r\n }\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 var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);\r\n if (this.enableDebugExceptions()) {\r\n throw message;\r\n }\r\n else {\r\n if (typeof (message) !== \"undefined\" && !!message) {\r\n if (typeof (message.message) !== \"undefined\") {\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 (!this._messageLogged[messageKey] || this.consoleLoggingLevel() >= LoggingSeverity.WARNING) {\r\n this.warnToConsole(message.message);\r\n this._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 (this.consoleLoggingLevel() >= LoggingSeverity.WARNING) {\r\n this.warnToConsole(message.message);\r\n }\r\n }\r\n this.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 DiagnosticLogger.prototype.warnToConsole = function (message) {\r\n if (typeof console !== \"undefined\" && !!console) {\r\n if (typeof console.warn === \"function\") {\r\n console.warn(message);\r\n }\r\n else if (typeof console.log === \"function\") {\r\n console.log(message);\r\n }\r\n }\r\n };\r\n /**\r\n * Resets the internal message count\r\n */\r\n DiagnosticLogger.prototype.resetInternalMessageCount = function () {\r\n this._messageCount = 0;\r\n this._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 DiagnosticLogger.prototype.logInternalMessage = function (severity, message) {\r\n if (this._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 = this.AIInternalMessagePrefix + message.messageId;\r\n // if the session storage is not available, limit to only one message type per page view\r\n if (this._messageLogged[messageKey]) {\r\n logMessage = false;\r\n }\r\n else {\r\n this._messageLogged[messageKey] = true;\r\n }\r\n if (logMessage) {\r\n // Push the event in the internal queue\r\n if (severity <= this.telemetryLoggingLevel()) {\r\n this.queue.push(message);\r\n this._messageCount++;\r\n }\r\n // When throttle limit reached, send a special event\r\n if (this._messageCount == this.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 this.queue.push(throttleMessage);\r\n this.warnToConsole(throttleLimitMessage);\r\n }\r\n }\r\n };\r\n /**\r\n * Indicates whether the internal events are throttled\r\n */\r\n DiagnosticLogger.prototype._areInternalMessagesThrottled = function () {\r\n return this._messageCount >= this.maxInternalMessageLimit();\r\n };\r\n return DiagnosticLogger;\r\n}());\r\nexport { DiagnosticLogger };\r\n//# sourceMappingURL=DiagnosticLogger.js.map","import { EventsDiscardedReason } from \"../JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nimport { CoreUtils } from \"./CoreUtils\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { _InternalLogMessage, DiagnosticLogger } from \"./DiagnosticLogger\";\r\n\"use strict\";\r\nvar AppInsightsCore = /** @class */ (function () {\r\n function AppInsightsCore() {\r\n this._isInitialized = false;\r\n this._extensions = new Array();\r\n this._channelController = new ChannelController();\r\n }\r\n AppInsightsCore.prototype.initialize = function (config, extensions) {\r\n var _this = this;\r\n // Make sure core is only initialized once\r\n if (this._isInitialized) {\r\n throw Error(\"Core should not be initialized more than once\");\r\n }\r\n if (!config || CoreUtils.isNullOrUndefined(config.instrumentationKey)) {\r\n throw Error(\"Please provide instrumentation key\");\r\n }\r\n this.config = config;\r\n this._notificationManager = new NotificationManager();\r\n this.config.extensions = CoreUtils.isNullOrUndefined(this.config.extensions) ? [] : this.config.extensions;\r\n // add notification to the extensions in the config so other plugins can access it\r\n this.config.extensionConfig = CoreUtils.isNullOrUndefined(this.config.extensionConfig) ? {} : this.config.extensionConfig;\r\n this.config.extensionConfig.NotificationManager = this._notificationManager;\r\n this.logger = new DiagnosticLogger(config);\r\n // Initial validation\r\n extensions.forEach(function (extension) {\r\n if (CoreUtils.isNullOrUndefined(extension.initialize)) {\r\n throw Error(validationError);\r\n }\r\n });\r\n if (this.config.extensions.length > 0) {\r\n var isValid_1 = true;\r\n this.config.extensions.forEach(function (item) {\r\n if (CoreUtils.isNullOrUndefined(item)) {\r\n isValid_1 = false;\r\n }\r\n });\r\n if (!isValid_1) {\r\n throw Error(validationError);\r\n }\r\n }\r\n // Initial validation complete\r\n // Concat all available extensions before sorting by priority\r\n (_a = this._extensions).push.apply(_a, [this._channelController].concat(extensions, this.config.extensions));\r\n this._extensions = this._extensions.sort(function (a, b) {\r\n var extA = a;\r\n var extB = b;\r\n var typeExtA = typeof extA.processTelemetry;\r\n var typeExtB = typeof extB.processTelemetry;\r\n if (typeExtA === 'function' && typeExtB === 'function') {\r\n return extA.priority - extB.priority;\r\n }\r\n if (typeExtA === 'function' && typeExtB !== 'function') {\r\n // keep non telemetryplugin specific extensions at start\r\n return 1;\r\n }\r\n if (typeExtA !== 'function' && typeExtB === 'function') {\r\n return -1;\r\n }\r\n });\r\n // sort complete\r\n // Check if any two extensions have the same priority, then warn to console\r\n var priority = {};\r\n this._extensions.forEach(function (ext) {\r\n var t = ext;\r\n if (t && t.priority) {\r\n if (!CoreUtils.isNullOrUndefined(priority[t.priority])) {\r\n _this.logger.warnToConsole(\"Two extensions have same priority\" + priority[t.priority] + \", \" + t.identifier);\r\n }\r\n else {\r\n priority[t.priority] = t.identifier; // set a value\r\n }\r\n }\r\n });\r\n var c = -1;\r\n // Set next plugin for all until channel controller\r\n for (var idx = 0; idx < this._extensions.length - 1; idx++) {\r\n var curr = (this._extensions[idx]);\r\n if (curr && typeof curr.processTelemetry !== 'function') {\r\n // these are initialized only, allowing an entry point for extensions to be initialized when SDK initializes\r\n continue;\r\n }\r\n if (curr.priority === ChannelControllerPriority) {\r\n c = idx + 1;\r\n break; // channel controller will set remaining pipeline\r\n }\r\n this._extensions[idx].setNextPlugin(this._extensions[idx + 1]); // set next plugin\r\n }\r\n // initialize channel controller first, this will initialize all channel plugins\r\n this._channelController.initialize(this.config, this, this._extensions);\r\n // initialize remaining regular plugins\r\n this._extensions.forEach(function (ext) {\r\n var e = ext;\r\n if (e && e.priority < ChannelControllerPriority) {\r\n ext.initialize(_this.config, _this, _this._extensions); // initialize\r\n }\r\n });\r\n // Remove sender channels from main list\r\n if (c < this._extensions.length) {\r\n this._extensions.splice(c);\r\n }\r\n if (this.getTransmissionControls().length === 0) {\r\n throw new Error(\"No channels available\");\r\n }\r\n this._isInitialized = true;\r\n var _a;\r\n };\r\n AppInsightsCore.prototype.getTransmissionControls = function () {\r\n return this._channelController.ChannelControls;\r\n };\r\n AppInsightsCore.prototype.track = function (telemetryItem) {\r\n if (telemetryItem === null) {\r\n this._notifiyInvalidEvent(telemetryItem);\r\n // throw error\r\n throw Error(\"Invalid telemetry item\");\r\n }\r\n if (telemetryItem.baseData && !telemetryItem.baseType) {\r\n this._notifiyInvalidEvent(telemetryItem);\r\n throw Error(\"Provide data.baseType for data.baseData\");\r\n }\r\n if (!telemetryItem.baseType) {\r\n // Hard coded from Common::Event.ts::Event.dataType\r\n telemetryItem.baseType = \"EventData\";\r\n }\r\n if (!telemetryItem.instrumentationKey) {\r\n // setup default ikey if not passed in\r\n telemetryItem.instrumentationKey = this.config.instrumentationKey;\r\n }\r\n if (!telemetryItem.timestamp) {\r\n // add default timestamp if not passed in\r\n telemetryItem.timestamp = new Date();\r\n }\r\n // do basic validation before sending it through the pipeline\r\n this._validateTelmetryItem(telemetryItem);\r\n // invoke any common telemetry processors before sending through pipeline\r\n var i = 0;\r\n while (i < this._extensions.length) {\r\n if (this._extensions[i].processTelemetry) {\r\n this._extensions[i].processTelemetry(telemetryItem); // pass on to first extension that can support processing\r\n break;\r\n }\r\n i++;\r\n }\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 this._notificationManager.addNotificationListener(listener);\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 this._notificationManager.removeNotificationListener(listener);\r\n };\r\n /**\r\n * Periodically check logger.queue for\r\n */\r\n AppInsightsCore.prototype.pollInternalLogs = function () {\r\n var _this = this;\r\n var interval = this.config.diagnosticLogInterval;\r\n if (!(interval > 0)) {\r\n interval = 10000;\r\n }\r\n return setInterval(function () {\r\n var queue = _this.logger.queue;\r\n queue.forEach(function (logMessage) {\r\n var item = {\r\n name: \"InternalMessageId: \" + logMessage.messageId,\r\n instrumentationKey: _this.config.instrumentationKey,\r\n timestamp: new Date(),\r\n baseType: _InternalLogMessage.dataType,\r\n baseData: { message: logMessage.message }\r\n };\r\n _this.track(item);\r\n });\r\n queue.length = 0;\r\n }, interval);\r\n };\r\n AppInsightsCore.prototype._validateTelmetryItem = function (telemetryItem) {\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.name)) {\r\n this._notifiyInvalidEvent(telemetryItem);\r\n throw Error(\"telemetry name required\");\r\n }\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.timestamp)) {\r\n this._notifiyInvalidEvent(telemetryItem);\r\n throw Error(\"telemetry timestamp required\");\r\n }\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.instrumentationKey)) {\r\n this._notifiyInvalidEvent(telemetryItem);\r\n throw Error(\"telemetry instrumentationKey required\");\r\n }\r\n };\r\n AppInsightsCore.prototype._notifiyInvalidEvent = function (telemetryItem) {\r\n this._notificationManager.eventsDiscarded([telemetryItem], EventsDiscardedReason.InvalidEvent);\r\n };\r\n return AppInsightsCore;\r\n}());\r\nexport { AppInsightsCore };\r\nvar ChannelController = /** @class */ (function () {\r\n function ChannelController() {\r\n this.identifier = \"ChannelControllerPlugin\";\r\n this.priority = ChannelControllerPriority; // in reserved range 100 to 200\r\n }\r\n ChannelController.prototype.processTelemetry = function (item) {\r\n this.channelQueue.forEach(function (queues) {\r\n // pass on to first item in queue\r\n if (queues.length > 0) {\r\n queues[0].processTelemetry(item);\r\n }\r\n });\r\n };\r\n Object.defineProperty(ChannelController.prototype, \"ChannelControls\", {\r\n get: function () {\r\n return this.channelQueue;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ChannelController.prototype.initialize = function (config, core, extensions) {\r\n var _this = this;\r\n this.channelQueue = new Array();\r\n if (config.channels) {\r\n config.channels.forEach(function (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 // Initialize each plugin\r\n queue.forEach(function (queueItem) { return queueItem.initialize(config, core, extensions); });\r\n for (var i = 1; i < queue.length; i++) {\r\n queue[i - 1].setNextPlugin(queue[i]); // setup processing chain\r\n }\r\n _this.channelQueue.push(queue);\r\n }\r\n });\r\n }\r\n else {\r\n var arr = new Array();\r\n for (var i = 0; i < extensions.length; i++) {\r\n var plugin = extensions[i];\r\n if (plugin.priority > ChannelControllerPriority) {\r\n arr.push(plugin);\r\n }\r\n }\r\n if (arr.length > 0) {\r\n // sort if not sorted\r\n arr = arr.sort(function (a, b) {\r\n return a.priority - b.priority;\r\n });\r\n // Initialize each plugin\r\n arr.forEach(function (queueItem) { return queueItem.initialize(config, core, extensions); });\r\n // setup next plugin\r\n for (var i = 1; i < arr.length; i++) {\r\n arr[i - 1].setNextPlugin(arr[i]);\r\n }\r\n this.channelQueue.push(arr);\r\n }\r\n }\r\n };\r\n return ChannelController;\r\n}());\r\nvar validationError = \"Extensions must provide callback to initialize\";\r\nvar ChannelControllerPriority = 200;\r\nvar duplicatePriority = \"One or more extensions are set at same priority\";\r\n//# sourceMappingURL=AppInsightsCore.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 * 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 } 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 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 name = 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 name;\r\n };\r\n DataSanitizer.sanitizeString = function (logger, value, maxLength) {\r\n if (maxLength === void 0) { maxLength = DataSanitizer.MAX_STRING_LENGTH; }\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 value = 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 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 if (message) {\r\n if (message.length > DataSanitizer.MAX_MESSAGE_LENGTH) {\r\n message = 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 message;\r\n };\r\n DataSanitizer.sanitizeException = function (logger, exception) {\r\n if (exception) {\r\n if (exception.length > DataSanitizer.MAX_EXCEPTION_LENGTH) {\r\n exception = 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 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 = DataSanitizer.sanitizeString(logger, properties[prop], 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 if (input) {\r\n input = DataSanitizer.trim(input);\r\n if (input.length > maxLength) {\r\n input = 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 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 (typeof str !== \"string\")\r\n return str;\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, _InternalMessageId, LoggingSeverity } from \"@microsoft/applicationinsights-core-js\";\r\nimport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nimport { DataSanitizer } from \"./Telemetry/Common/DataSanitizer\";\r\nvar Util = /** @class */ (function () {\r\n function Util() {\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 (typeof window === 'undefined') {\r\n return null;\r\n }\r\n uid = new Date;\r\n storage = storageType === StorageType.LocalStorage ? window.localStorage : window.sessionStorage;\r\n storage.setItem(uid, uid);\r\n fail = storage.getItem(uid) != uid;\r\n storage.removeItem(uid);\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 window.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 Util._canUseCookies = false;\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 (Util._canUseCookies === undefined) {\r\n Util._canUseCookies = false;\r\n try {\r\n Util._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 Util._canUseCookies;\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 var domainAttrib = \"\";\r\n var secureAttrib = \"\";\r\n if (domain) {\r\n domainAttrib = \";domain=\" + domain;\r\n }\r\n if (Util.document.location && Util.document.location.protocol === \"https:\") {\r\n secureAttrib = \";secure\";\r\n }\r\n if (Util.canUseCookies(logger)) {\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 * helper method to trim strings (IE8 does not implement String.prototype.trim)\r\n */\r\n Util.trim = function (str) {\r\n if (typeof str !== \"string\")\r\n return str;\r\n return str.replace(/^\\s+|\\s+$/g, \"\");\r\n };\r\n /**\r\n * generate random id string\r\n */\r\n Util.newId = function () {\r\n var base64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\r\n var result = \"\";\r\n // tslint:disable-next-line:insecure-random\r\n var random = Math.random() * 1073741824; //5 symbols in base64, almost maxint\r\n while (random > 0) {\r\n var char = base64chars.charAt(random % 64);\r\n result += char;\r\n random = Math.floor(random / 64);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Check if an object is of type Array\r\n */\r\n Util.isArray = function (obj) {\r\n return Object.prototype.toString.call(obj) === \"[object Array]\";\r\n };\r\n /**\r\n * Check if an object is of type Error\r\n */\r\n Util.isError = function (obj) {\r\n return Object.prototype.toString.call(obj) === \"[object Error]\";\r\n };\r\n /**\r\n * Check if an object is of type Date\r\n */\r\n Util.isDate = function (obj) {\r\n return Object.prototype.toString.call(obj) === \"[object Date]\";\r\n };\r\n /**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\n Util.toISOStringForIE8 = function (date) {\r\n if (Util.isDate(date)) {\r\n if (Date.prototype.toISOString) {\r\n return date.toISOString();\r\n }\r\n else {\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 /**\r\n * Gets IE version 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.userAgent.toLowerCase();\r\n return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : 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.prototype.toString.call(object);\r\n var propertyValueDump = JSON.stringify(object);\r\n if (objectTypeDump === \"[object Error]\") {\r\n propertyValueDump = \"{ stack: '\" + object.stack + \"', message: '\" + object.message + \"', name: '\" + object.name + \"'\";\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.prototype.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\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 if (typeof window === 'undefined' || !window || typeof eventName !== 'string' || typeof callback !== 'function') {\r\n return false;\r\n }\r\n // Create verb for the event\r\n var verbEventName = 'on' + eventName;\r\n // check if addEventListener is available\r\n if (window.addEventListener) {\r\n window.addEventListener(eventName, callback, false);\r\n }\r\n else if (window[\"attachEvent\"]) {\r\n window[\"attachEvent\"](verbEventName, callback);\r\n }\r\n else {\r\n return false;\r\n }\r\n return true;\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.document = typeof document !== \"undefined\" ? document : {};\r\n Util._canUseCookies = undefined;\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 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 if (!UrlHelper.htmlAnchorElement) {\r\n UrlHelper.htmlAnchorElement = !!UrlHelper.document.createElement ? UrlHelper.document.createElement('a') : {};\r\n }\r\n UrlHelper.htmlAnchorElement.href = url;\r\n return UrlHelper.htmlAnchorElement;\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 UrlHelper.document = typeof document !== \"undefined\" ? document : {};\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 */\r\n CorrelationIdHelper.canIncludeCorrelationHeader = function (config, requestUrl, currentHost) {\r\n if (config && config.disableCorrelationHeaders) {\r\n return false;\r\n }\r\n if (!requestUrl) {\r\n return false;\r\n }\r\n var requestHost = UrlHelper.parseUrl(requestUrl).host.toLowerCase();\r\n if ((!config || !config.enableCorsCorrelation) && requestHost !== currentHost) {\r\n return false;\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 return true;\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, pathName) {\r\n var target, name;\r\n if (absoluteUrl && absoluteUrl.length > 0) {\r\n var parsedUrl = UrlHelper.parseUrl(absoluteUrl);\r\n target = parsedUrl.host;\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 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 else {\r\n target = pathName;\r\n name = pathName;\r\n }\r\n return {\r\n target: target,\r\n name: name\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 = (typeof window === 'undefined') ? function () { return new Date().getTime(); } :\r\n (window.performance && window.performance.now && window.performance.timing) ?\r\n function () {\r\n return window.performance.now() + window.performance.timing.navigationStart;\r\n }\r\n :\r\n function () {\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\nexport var DisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\n//# sourceMappingURL=Constants.js.map","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(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) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","// 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\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\nimport * as tslib_1 from \"tslib\";\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 tslib_1.__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\nimport * as tslib_1 from \"tslib\";\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\nvar Envelope = /** @class */ (function (_super) {\r\n tslib_1.__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 = Util.toISOStringForIE8(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/**\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\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\nimport * as tslib_1 from \"tslib\";\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 tslib_1.__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 * as tslib_1 from \"tslib\";\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 tslib_1.__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\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 * as tslib_1 from \"tslib\";\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\nvar Exception = /** @class */ (function (_super) {\r\n tslib_1.__extends(Exception, _super);\r\n /**\r\n * Constructs a new isntance of the ExceptionTelemetry object\r\n */\r\n function Exception(logger, exception, properties, measurements, severityLevel) {\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 _this.properties = DataSanitizer.sanitizeProperties(logger, properties);\r\n _this.measurements = DataSanitizer.sanitizeMeasurements(logger, measurements);\r\n _this.exceptions = [new _ExceptionDetails(logger, exception)];\r\n if (severityLevel) {\r\n _this.severityLevel = severityLevel;\r\n }\r\n return _this;\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 tslib_1.__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 _this.typeName = DataSanitizer.sanitizeString(logger, exception.name) || Util.NotSpecified;\r\n _this.message = DataSanitizer.sanitizeMessage(logger, exception.message) || Util.NotSpecified;\r\n var stack = exception[\"stack\"];\r\n _this.parsedStack = _this.parseStack(stack);\r\n _this.stack = DataSanitizer.sanitizeException(logger, stack);\r\n _this.hasFullStack = Util.isArray(_this.parsedStack) && _this.parsedStack.length > 0;\r\n return _this;\r\n }\r\n _ExceptionDetails.prototype.parseStack = function (stack) {\r\n var parsedStack = undefined;\r\n if (typeof stack === \"string\") {\r\n var frames = stack.split('\\n');\r\n parsedStack = [];\r\n var level = 0;\r\n var totalSizeInBytes = 0;\r\n for (var i = 0; i <= frames.length; i++) {\r\n var frame = frames[i];\r\n if (_StackFrame.regex.test(frame)) {\r\n var parsedFrame = new _StackFrame(frames[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\nvar _StackFrame = /** @class */ (function (_super) {\r\n tslib_1.__extends(_StackFrame, _super);\r\n function _StackFrame(frame, 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 _this.level = level;\r\n _this.method = \"\";\r\n _this.assembly = Util.trim(frame);\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 _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 // 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\nimport * as tslib_1 from \"tslib\";\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 tslib_1.__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\nimport * as tslib_1 from \"tslib\";\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 tslib_1.__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 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\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\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 * as tslib_1 from \"tslib\";\r\nimport { DataPoint as AIDataPoint } from '../../Interfaces/Contracts/Generated/DataPoint';\r\nimport { FieldType } from '../../Enums';\r\nvar DataPoint = /** @class */ (function (_super) {\r\n tslib_1.__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 * as tslib_1 from \"tslib\";\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 tslib_1.__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) {\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 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\nimport * as tslib_1 from \"tslib\";\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 tslib_1.__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 * as tslib_1 from \"tslib\";\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 tslib_1.__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\nimport * as tslib_1 from \"tslib\";\r\nimport { DataSanitizer } from './Common/DataSanitizer';\r\nimport { FieldType } from '../Enums';\r\nimport { Util } from '../Util';\r\nimport { AjaxHelper } from '../Util';\r\nimport { RemoteDependencyData as GeneratedRemoteDependencyData } from '../Interfaces/Contracts/Generated/RemoteDependencyData';\r\nvar RemoteDependencyData = /** @class */ (function (_super) {\r\n tslib_1.__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, properties, measurements) {\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 = \"Ajax\";\r\n _this.data = DataSanitizer.sanitizeUrl(logger, commandName);\r\n var dependencyFields = AjaxHelper.ParseDependencyPath(logger, absoluteUrl, method, commandName);\r\n _this.target = dependencyFields.target;\r\n _this.name = 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\nimport * as tslib_1 from \"tslib\";\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 tslib_1.__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 * as tslib_1 from \"tslib\";\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 tslib_1.__extends(Trace, _super);\r\n /**\r\n * Constructs a new instance of the TraceTelemetry object\r\n */\r\n function Trace(logger, message, properties, severityLevel) {\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 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\nimport * as tslib_1 from \"tslib\";\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 tslib_1.__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 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 * as tslib_1 from \"tslib\";\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\nimport { _InternalMessageId, LoggingSeverity } from '@microsoft/applicationinsights-core-js';\r\nvar PageViewPerformance = /** @class */ (function (_super) {\r\n tslib_1.__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) {\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.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 timing = PageViewPerformance.getPerformanceTiming();\r\n if (timing) {\r\n var total = PageViewPerformance.getDuration(timing.navigationStart, timing.loadEventEnd);\r\n var network = PageViewPerformance.getDuration(timing.navigationStart, timing.connectEnd);\r\n var request = PageViewPerformance.getDuration(timing.requestStart, timing.responseStart);\r\n var response = PageViewPerformance.getDuration(timing.responseStart, timing.responseEnd);\r\n var dom = PageViewPerformance.getDuration(timing.responseEnd, timing.loadEventEnd);\r\n if (total == 0) {\r\n 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 (!PageViewPerformance.shouldCollectDuration(total, network, request, response, dom)) {\r\n 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 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 _this.durationMs = total;\r\n // convert to timespans\r\n _this.perfTotal = _this.duration = Util.msToTimeSpan(total);\r\n _this.networkConnect = Util.msToTimeSpan(network);\r\n _this.sentRequest = Util.msToTimeSpan(request);\r\n _this.receivedResponse = Util.msToTimeSpan(response);\r\n _this.domProcessing = Util.msToTimeSpan(dom);\r\n _this.isValid = true;\r\n }\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 return _this;\r\n }\r\n /**\r\n * Indicates whether this instance of PageViewPerformance is valid and should be sent\r\n */\r\n PageViewPerformance.prototype.getIsValid = function () {\r\n return this.isValid;\r\n };\r\n /**\r\n * Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.\r\n */\r\n PageViewPerformance.prototype.getDurationMs = function () {\r\n return this.durationMs;\r\n };\r\n PageViewPerformance.getPerformanceTiming = function () {\r\n if (PageViewPerformance.isPerformanceTimingSupported()) {\r\n return window.performance.timing;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Returns true is window performance timing API is supported, false otherwise.\r\n */\r\n PageViewPerformance.isPerformanceTimingSupported = function () {\r\n return typeof window != \"undefined\" && window.performance && window.performance.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 PageViewPerformance.isPerformanceTimingDataReady = function () {\r\n var timing = window.performance.timing;\r\n return 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 PageViewPerformance.getDuration = function (start, end) {\r\n var duration = undefined;\r\n if (!(isNaN(start) || isNaN(end))) {\r\n duration = Math.max(end - start, 0);\r\n }\r\n return duration;\r\n };\r\n /**\r\n * This method tells if given durations should be excluded from collection.\r\n */\r\n PageViewPerformance.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 // 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_1 = 0; i_1 < botAgentNames.length; i_1++) {\r\n isGoogleBot = isGoogleBot || userAgent.toLowerCase().indexOf(botAgentNames[i_1]) !== -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] >= PageViewPerformance.MAX_DURATION_ALLOWED) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n PageViewPerformance.envelopeType = \"Microsoft.ApplicationInsights.{0}.PageviewPerformance\";\r\n PageViewPerformance.dataType = \"PageviewPerformanceData\";\r\n PageViewPerformance.MAX_DURATION_ALLOWED = 3600000; // 1h\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 * as tslib_1 from \"tslib\";\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 tslib_1.__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 * as tslib_1 from \"tslib\";\r\nimport { Data as AIData } from '../../Interfaces/Contracts/Generated/Data';\r\nimport { FieldType } from '../../Enums';\r\nvar Data = /** @class */ (function (_super) {\r\n tslib_1.__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\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]) {\r\n configValue = config[field];\r\n }\r\n else {\r\n configValue = config.extensionConfig[identifier][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 }\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 timestamp: new Date(),\r\n instrumentationKey: \"\",\r\n ctx: systemProperties ? systemProperties : {},\r\n tags: [],\r\n data: {},\r\n baseType: baseType,\r\n baseData: item\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 '../Interfaces/Contracts/Generated/ContextTagKeys';\r\nvar PartAExtensions = /** @class */ (function () {\r\n function PartAExtensions(mapTags) {\r\n this.UserExtensionName = \"User\";\r\n this.WebExtensionName = \"Web\";\r\n this.AppExtensionName = \"App\";\r\n // Approved tags in 4.0\r\n this.accountIdTag = \"User.AccountId\";\r\n this.userTagsKeysMap = {};\r\n // user.tags mapping\r\n this.userTagsKeysMap[this.accountIdTag] = mapTags.userAccountId;\r\n this.ctxKeys = { id: \"id\", authId: \"authId\", localId: \"localId\" };\r\n // user.ctx mapping\r\n this.userExtKeysMap = {};\r\n this.userExtKeysMap[this.ctxKeys.localId] = mapTags.userId;\r\n this.userExtKeysMap[this.ctxKeys.authId] = mapTags.userAuthUserId;\r\n }\r\n return PartAExtensions;\r\n}());\r\nexport { PartAExtensions };\r\nvar kys = new ContextTagKeys();\r\nexport var partAExtensions = new PartAExtensions(kys); // export global instance\r\n//# sourceMappingURL=PartAExtensions.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { PageViewPerformance, Util } from '@microsoft/applicationinsights-common';\r\nimport { CoreUtils, LoggingSeverity, _InternalMessageId } from '@microsoft/applicationinsights-core-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) {\r\n this.pageViewPerformanceSent = false;\r\n this.overridePageViewDuration = false;\r\n this.overridePageViewDuration = overridePageViewDuration;\r\n this.appInsights = appInsights;\r\n if (core) {\r\n this._channel = function () { return (core.getTransmissionControls()); };\r\n this._logger = core.logger;\r\n }\r\n }\r\n /**\r\n * Currently supported cases:\r\n * 1) (default case) track page view called with default parameters, overridePageViewDuration = false. Page view is sent with page view performance when navigation timing data is available.\r\n * a. If navigation timing is not supported then page view is sent right away with undefined duration. Page view performance is not sent.\r\n * 2) overridePageViewDuration = true, custom duration provided. Custom duration is used, page view sends right away.\r\n * 3) overridePageViewDuration = true, custom duration NOT provided. Page view is sent right away, duration is time spent from page load till now (or undefined if navigation timing is not supported).\r\n * 4) overridePageViewDuration = false, custom duration is provided. Page view is sent right away with custom duration.\r\n *\r\n * In all cases page view performance is sent once (only for the 1st call of trackPageView), or not sent if navigation timing is not supported.\r\n */\r\n PageViewManager.prototype.trackPageView = function (pageView, customProperties) {\r\n var _this = this;\r\n var name = pageView.name;\r\n if (CoreUtils.isNullOrUndefined(name) || typeof name !== \"string\") {\r\n pageView.name = window.document && window.document.title || \"\";\r\n }\r\n var uri = pageView.uri;\r\n if (CoreUtils.isNullOrUndefined(uri) || typeof uri !== \"string\") {\r\n pageView.uri = window.location && window.location.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 (!PageViewPerformance.isPerformanceTimingSupported()) {\r\n this.appInsights.sendPageViewInternal(pageView, customProperties);\r\n this._channel().forEach(function (queues) { queues.forEach(function (q) { return q.flush(true); }); });\r\n // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)\r\n this._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 = undefined;\r\n // if the performance timing is supported by the browser, calculate the custom duration\r\n var start = PageViewPerformance.getPerformanceTiming().navigationStart;\r\n customDuration = PageViewPerformance.getDuration(start, +new Date);\r\n if (!PageViewPerformance.shouldCollectDuration(customDuration)) {\r\n customDuration = undefined;\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 = undefined;\r\n if (!CoreUtils.isNullOrUndefined(customProperties) &&\r\n !CoreUtils.isNullOrUndefined(customProperties.duration)) {\r\n duration = customProperties.duration;\r\n }\r\n if (this.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 this.appInsights.sendPageViewInternal(pageView, customProperties);\r\n this._channel().forEach(function (queues) { queues.forEach(function (q) { return q.flush(true); }); });\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 var handle = setInterval((function () {\r\n try {\r\n if (PageViewPerformance.isPerformanceTimingDataReady()) {\r\n clearInterval(handle);\r\n var pageViewPerformance = new PageViewPerformance(_this._logger, name, uri, null);\r\n if (!pageViewPerformance.getIsValid() && !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 _this.appInsights.sendPageViewInternal(pageView, customProperties);\r\n _this._channel().forEach(function (queues) { queues.forEach(function (q) { return q.flush(true); }); });\r\n }\r\n else {\r\n if (!pageViewSent) {\r\n customProperties[\"duration\"] = pageViewPerformance.getDurationMs();\r\n _this.appInsights.sendPageViewInternal(pageView, customProperties);\r\n }\r\n if (!_this.pageViewPerformanceSent) {\r\n _this.appInsights.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);\r\n _this.pageViewPerformanceSent = true;\r\n }\r\n _this._channel().forEach(function (queues) { queues.forEach(function (q) { return q.flush(true); }); });\r\n }\r\n }\r\n else if (PageViewPerformance.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 clearInterval(handle);\r\n if (!pageViewSent) {\r\n customProperties[\"duration\"] = maxDurationLimit;\r\n _this.appInsights.sendPageViewInternal(pageView, customProperties);\r\n _this._channel().forEach(function (queues) { queues.forEach(function (q) { return q.flush(true); }); });\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailedCalc, \"trackPageView failed on page load calculation: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n }), 100);\r\n };\r\n return PageViewManager;\r\n}());\r\nexport { PageViewManager };\r\n//# sourceMappingURL=PageViewManager.js.map","/**\r\n * ApplicationInsights.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport { Util, PageViewPerformance, PageView, RemoteDependencyData, Event, TelemetryItemCreator, Metric, Exception, SeverityLevel, Trace, ConfigurationManager } from \"@microsoft/applicationinsights-common\";\r\nimport { CoreUtils, LoggingSeverity, _InternalMessageId } from \"@microsoft/applicationinsights-core-js\";\r\nimport { PageViewManager } from \"./Telemetry/PageViewManager\";\r\n\"use strict\";\r\nvar durationProperty = \"duration\";\r\nvar ApplicationInsights = /** @class */ (function () {\r\n function ApplicationInsights() {\r\n this.identifier = \"ApplicationInsightsAnalytics\";\r\n this.priority = 160; // take from reserved priority range 100- 200\r\n this._isInitialized = false;\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 this.initialize = this._initialize.bind(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 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 return config;\r\n };\r\n ApplicationInsights.prototype.processTelemetry = function (env) {\r\n var doNotSendItem = false;\r\n try {\r\n var telemetryInitializersCount = this._telemetryInitializers.length;\r\n for (var i = 0; i < telemetryInitializersCount; ++i) {\r\n var telemetryInitializer = this._telemetryInitializers[i];\r\n if (telemetryInitializer) {\r\n if (telemetryInitializer.apply(null, [env]) === false) {\r\n doNotSendItem = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n catch (e) {\r\n doNotSendItem = true;\r\n this._logger.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 if (!doNotSendItem && !CoreUtils.isNullOrUndefined(this._nextPlugin)) {\r\n this._nextPlugin.processTelemetry(env);\r\n }\r\n };\r\n ApplicationInsights.prototype.setNextPlugin = function (next) {\r\n this._nextPlugin = next;\r\n };\r\n ApplicationInsights.prototype.trackEvent = function (event, customProperties) {\r\n try {\r\n var telemetryItem = TelemetryItemCreator.create(event, Event.dataType, Event.envelopeType, this._logger, customProperties);\r\n this._setTelemetryNameAndIKey(telemetryItem);\r\n this.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n this._logger.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 diagnostic message\r\n * @param {ITraceTelemetry} trace\r\n * @param {{[key: string]: any}} [customProperties]\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._logger, customProperties);\r\n this._setTelemetryNameAndIKey(telemetryItem);\r\n this.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n this._logger.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._logger, customProperties);\r\n this._setTelemetryNameAndIKey(telemetryItem);\r\n this.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n this._logger.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. If a user wants\r\n * to provide a custom duration, it'll have to be in customProperties\r\n */\r\n ApplicationInsights.prototype.trackPageView = function (pageView, customProperties) {\r\n try {\r\n this._pageViewManager.trackPageView(pageView, customProperties);\r\n if (this.config.autoTrackPageVisitTime) {\r\n this._pageVisitTimeManager.trackPreviousPageVisit(pageView.name, pageView.uri);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.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 telemetryItem = TelemetryItemCreator.create(pageView, PageView.dataType, PageView.envelopeType, this._logger, properties, systemProperties);\r\n // set instrumentation key\r\n this._setTelemetryNameAndIKey(telemetryItem);\r\n this.core.track(telemetryItem);\r\n // reset ajaxes counter\r\n this._trackAjaxAttempts = 0;\r\n };\r\n ApplicationInsights.prototype.sendPageViewPerformanceInternal = function (pageViewPerformance, properties) {\r\n var telemetryItem = TelemetryItemCreator.create(pageViewPerformance, PageViewPerformance.dataType, PageViewPerformance.envelopeType, this._logger, properties);\r\n // set instrumentation key\r\n this._setTelemetryNameAndIKey(telemetryItem);\r\n this.core.track(telemetryItem);\r\n };\r\n ApplicationInsights.prototype.trackPageViewPerformance = function (pageViewPerformance, customProperties) {\r\n var item = new PageViewPerformance(this.core.logger, pageViewPerformance.name, pageViewPerformance.url, undefined, customProperties);\r\n this.sendPageViewPerformanceInternal(item, customProperties);\r\n };\r\n /**\r\n * Starts timing how long the user views a page or other item. Call this when the page opens.\r\n * This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.\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 name = window.document && window.document.title || \"\";\r\n }\r\n this._pageTracking.start(name);\r\n }\r\n catch (e) {\r\n this._logger.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 * Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.\r\n * @param name The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param url A relative or absolute URL that identifies the page or other item. Defaults to the window location.\r\n * @param properties Additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n * Any property of type double will be considered a measurement, and will be treated by Application Insights as a metric\r\n */\r\n ApplicationInsights.prototype.stopTrackPage = function (name, url, properties) {\r\n try {\r\n if (typeof name !== \"string\") {\r\n name = window.document && window.document.title || \"\";\r\n }\r\n if (typeof url !== \"string\") {\r\n url = window.location && window.location.href || \"\";\r\n }\r\n this._pageTracking.stop(name, url, properties);\r\n if (this.config.autoTrackPageVisitTime) {\r\n this._pageVisitTimeManager.trackPreviousPageVisit(name, url);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.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 * 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 var telemetryItem = TelemetryItemCreator.create(exception, Exception.dataType, Exception.envelopeType, this._logger, customProperties);\r\n this._setTelemetryNameAndIKey(telemetryItem);\r\n this.core.track(telemetryItem);\r\n }\r\n catch (e) {\r\n this._logger.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 = {\r\n url: (exception && exception.url) || document.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.url);\r\n }\r\n else {\r\n if (!Util.isError(exception.error)) {\r\n var stack = \"window.onerror@\" + properties.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({ error: exception.error, severityLevel: SeverityLevel.Error }, properties);\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._logger.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) {\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 this.core = core;\r\n this._logger = core.logger;\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 = config.extensionConfig && config.extensionConfig[this.identifier] ? config.extensionConfig[this.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] = ConfigurationManager.getConfig(config, field, this.identifier, 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._pageViewManager = new PageViewManager(this, this.config.overridePageViewDuration, this.core);\r\n this._telemetryInitializers = [];\r\n this._addDefaultTelemetryInitializers(configGetters);\r\n // initialize page view timing\r\n this._pageTracking = new Timing(this._logger, \"trackPageView\");\r\n this._pageTracking.action = function (name, url, duration, properties) {\r\n var pageViewItem = {\r\n name: name,\r\n uri: url\r\n };\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;\r\n _this.sendPageViewInternal(pageViewItem, properties);\r\n };\r\n if (this.config.disableExceptionTracking === false &&\r\n !this.config.autoExceptionInstrumented) {\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 var instance_1 = this;\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_1._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 this._isInitialized = true;\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.absoluteUrl && remoteData.absoluteUrl.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._logger, { url: url });\r\n this.core.track(telemetryItem);\r\n };\r\n // Mutate telemetryItem inplace to add boilerplate iKey & name info\r\n ApplicationInsights.prototype._setTelemetryNameAndIKey = function (telemetryItem) {\r\n telemetryItem.instrumentationKey = this._globalconfig.instrumentationKey;\r\n var iKeyNoDashes = this._globalconfig.instrumentationKey.replace(/-/g, \"\");\r\n telemetryItem.name = telemetryItem.name.replace(\"{0}\", iKeyNoDashes);\r\n };\r\n ApplicationInsights.Version = \"2.0.1-beta\";\r\n return ApplicationInsights;\r\n}());\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) {\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 = PageViewPerformance.getDuration(start, end);\r\n this.action(name, url, duration, properties);\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","import { Util } from '@microsoft/applicationinsights-common';\r\nimport { LoggingSeverity, _InternalMessageId } from '@microsoft/applicationinsights-core-js';\r\n/*\r\n * An array based send buffer.\r\n */\r\nvar ArraySendBuffer = /** @class */ (function () {\r\n function ArraySendBuffer(config) {\r\n this._config = config;\r\n this._buffer = [];\r\n }\r\n ArraySendBuffer.prototype.enqueue = function (payload) {\r\n this._buffer.push(payload);\r\n };\r\n ArraySendBuffer.prototype.count = function () {\r\n return this._buffer.length;\r\n };\r\n ArraySendBuffer.prototype.clear = function () {\r\n this._buffer.length = 0;\r\n };\r\n ArraySendBuffer.prototype.getItems = function () {\r\n return this._buffer.slice(0);\r\n };\r\n ArraySendBuffer.prototype.batchPayloads = function (payload) {\r\n if (payload && payload.length > 0) {\r\n var batch = this._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 ArraySendBuffer.prototype.markAsSent = function (payload) {\r\n this.clear();\r\n };\r\n ArraySendBuffer.prototype.clearSent = function (payload) {\r\n // not supported\r\n };\r\n return ArraySendBuffer;\r\n}());\r\nexport { ArraySendBuffer };\r\n/*\r\n * Session storege 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 this._bufferFullMessageSent = false;\r\n this._logger = logger;\r\n this._config = config;\r\n var bufferItems = this.getBuffer(SessionStorageSendBuffer.BUFFER_KEY);\r\n var notDeliveredItems = this.getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);\r\n this._buffer = bufferItems.concat(notDeliveredItems);\r\n // If the buffer has too many items, drop items from the end.\r\n if (this._buffer.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {\r\n this._buffer.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;\r\n }\r\n // update DataLossAnalyzer with the number of recovered items\r\n // Uncomment if you want to use DataLossanalyzer\r\n // DataLossAnalyzer.itemsRestoredFromSessionBuffer = this._buffer.length;\r\n this.setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, []);\r\n this.setBuffer(SessionStorageSendBuffer.BUFFER_KEY, this._buffer);\r\n }\r\n SessionStorageSendBuffer.prototype.enqueue = function (payload) {\r\n if (this._buffer.length >= SessionStorageSendBuffer.MAX_BUFFER_SIZE) {\r\n // sent internal log only once per page view\r\n if (!this._bufferFullMessageSent) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionStorageBufferFull, \"Maximum buffer size reached: \" + this._buffer.length, true);\r\n this._bufferFullMessageSent = true;\r\n }\r\n return;\r\n }\r\n this._buffer.push(payload);\r\n this.setBuffer(SessionStorageSendBuffer.BUFFER_KEY, this._buffer);\r\n };\r\n SessionStorageSendBuffer.prototype.count = function () {\r\n return this._buffer.length;\r\n };\r\n SessionStorageSendBuffer.prototype.clear = function () {\r\n this._buffer.length = 0;\r\n this.setBuffer(SessionStorageSendBuffer.BUFFER_KEY, []);\r\n this.setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, []);\r\n this._bufferFullMessageSent = false;\r\n };\r\n SessionStorageSendBuffer.prototype.getItems = function () {\r\n return this._buffer.slice(0);\r\n };\r\n SessionStorageSendBuffer.prototype.batchPayloads = function (payload) {\r\n if (payload && payload.length > 0) {\r\n var batch = this._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 SessionStorageSendBuffer.prototype.markAsSent = function (payload) {\r\n this._buffer = this.removePayloadsFromBuffer(payload, this._buffer);\r\n this.setBuffer(SessionStorageSendBuffer.BUFFER_KEY, this._buffer);\r\n var sentElements = this.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 this._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 this.setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);\r\n }\r\n };\r\n SessionStorageSendBuffer.prototype.clearSent = function (payload) {\r\n var sentElements = this.getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);\r\n sentElements = this.removePayloadsFromBuffer(payload, sentElements);\r\n this.setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);\r\n };\r\n SessionStorageSendBuffer.prototype.removePayloadsFromBuffer = function (payloads, buffer) {\r\n var remaining = [];\r\n for (var i in buffer) {\r\n var contains = false;\r\n for (var j in payloads) {\r\n if (payloads[j] === buffer[i]) {\r\n contains = true;\r\n break;\r\n }\r\n }\r\n if (!contains) {\r\n remaining.push(buffer[i]);\r\n }\r\n }\r\n ;\r\n return remaining;\r\n };\r\n SessionStorageSendBuffer.prototype.getBuffer = function (key) {\r\n try {\r\n var bufferJson = Util.getSessionStorage(this._logger, key);\r\n if (bufferJson) {\r\n var buffer = JSON.parse(bufferJson);\r\n if (buffer) {\r\n return buffer;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToRestoreStorageBuffer, \" storage key: \" + key + \", \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n return [];\r\n };\r\n SessionStorageSendBuffer.prototype.setBuffer = function (key, buffer) {\r\n try {\r\n var bufferJson = JSON.stringify(buffer);\r\n Util.setSessionStorage(this._logger, key, 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(this._logger, key, JSON.stringify([]));\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedToSetStorageBuffer, \" storage key: \" + key + \", \" + Util.getExceptionName(e) + \". Buffer cleared\", { exception: Util.dump(e) });\r\n }\r\n };\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","import * as tslib_1 from \"tslib\";\r\nimport { Data, Envelope, RemoteDependencyData, Event, Exception, Metric, PageView, Trace, PageViewPerformance, partAExtensions } from '@microsoft/applicationinsights-common';\r\nimport { CoreUtils, LoggingSeverity, _InternalMessageId } from '@microsoft/applicationinsights-core-js';\r\nexport var ContextTagKeys = [\r\n \"ai.application.ver\",\r\n \"ai.application.build\",\r\n \"ai.application.typeId\",\r\n \"ai.application.applicationId\",\r\n \"ai.application.layer\",\r\n \"ai.device.id\",\r\n \"ai.device.ip\",\r\n \"ai.device.language\",\r\n \"ai.device.locale\",\r\n \"ai.device.model\",\r\n \"ai.device.friendlyName\",\r\n \"ai.device.network\",\r\n \"ai.device.networkName\",\r\n \"ai.device.oemName\",\r\n \"ai.device.os\",\r\n \"ai.device.osVersion\",\r\n \"ai.device.roleInstance\",\r\n \"ai.device.roleName\",\r\n \"ai.device.screenResolution\",\r\n \"ai.device.type\",\r\n \"ai.device.machineName\",\r\n \"ai.device.vmName\",\r\n \"ai.device.browser\",\r\n \"ai.device.browserVersion\",\r\n \"ai.location.ip\",\r\n \"ai.location.country\",\r\n \"ai.location.province\",\r\n \"ai.location.city\",\r\n \"ai.operation.id\",\r\n \"ai.operation.name\",\r\n \"ai.operation.parentId\",\r\n \"ai.operation.rootId\",\r\n \"ai.operation.syntheticSource\",\r\n \"ai.operation.correlationVector\",\r\n \"ai.session.id\",\r\n \"ai.session.isFirst\",\r\n \"ai.session.isNew\",\r\n \"ai.user.accountAcquisitionDate\",\r\n \"ai.user.accountId\",\r\n \"ai.user.userAgent\",\r\n \"ai.user.id\",\r\n \"ai.user.storeRegion\",\r\n \"ai.user.authUserId\",\r\n \"ai.user.anonUserAcquisitionDate\",\r\n \"ai.user.authUserAcquisitionDate\",\r\n \"ai.cloud.name\",\r\n \"ai.cloud.role\",\r\n \"ai.cloud.roleVer\",\r\n \"ai.cloud.roleInstance\",\r\n \"ai.cloud.environment\",\r\n \"ai.cloud.location\",\r\n \"ai.cloud.deploymentUnit\",\r\n \"ai.internal.sdkVersion\",\r\n \"ai.internal.agentVersion\",\r\n \"ai.internal.nodeName\",\r\n];\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 baseType = \"baseType\";\r\nvar baseData = \"baseData\";\r\nvar EnvelopeCreator = /** @class */ (function () {\r\n function EnvelopeCreator() {\r\n }\r\n EnvelopeCreator.extractProperties = function (data) {\r\n var customProperties = null;\r\n for (var key in data) {\r\n if (data.hasOwnProperty(key)) {\r\n var value = data[key];\r\n if (typeof value !== \"number\") {\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n customProperties[key] = value;\r\n }\r\n }\r\n }\r\n return customProperties;\r\n };\r\n EnvelopeCreator.extractPropsAndMeasurements = function (data, properties, measurements) {\r\n if (!CoreUtils.isNullOrUndefined(data)) {\r\n for (var key in data) {\r\n if (data.hasOwnProperty(key)) {\r\n var value = data[key];\r\n if (typeof value === \"number\") {\r\n measurements[key] = value;\r\n }\r\n else {\r\n properties[key] = value;\r\n }\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 envelope.iKey = telemetryItem.instrumentationKey;\r\n var iKeyNoDashes = telemetryItem.instrumentationKey.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 if (!telemetryItem.tags) {\r\n telemetryItem.tags = [];\r\n }\r\n telemetryItem.tags.forEach(function (tag) {\r\n for (var key in tag) {\r\n if (tag.hasOwnProperty(key)) {\r\n if (ContextTagKeys.indexOf(key) >= 0) {\r\n envelope.tags[key] = tag[key];\r\n }\r\n }\r\n }\r\n });\r\n return envelope;\r\n };\r\n EnvelopeCreator.extractPartAExtensions = function (telemetryItem, envelope) {\r\n var extensions = [];\r\n extensions.push(partAExtensions.UserExtensionName);\r\n extensions.forEach(function (extName) {\r\n var e = telemetryItem.tags[extName] || {};\r\n EnvelopeCreator.parseProperties(envelope, e, partAExtensions.userTagsKeysMap);\r\n var t = telemetryItem.ctx[extName] || {};\r\n EnvelopeCreator.parseProperties(envelope, t, partAExtensions.userExtKeysMap);\r\n });\r\n };\r\n EnvelopeCreator.parseProperties = function (env, source, map) {\r\n Object.keys(source).forEach(function (ky) {\r\n var val = source[ky];\r\n var envKey = map[ky]; // look up mapped field for existing schema\r\n if (envKey && val) {\r\n env.tags[envKey] = val;\r\n }\r\n });\r\n };\r\n return EnvelopeCreator;\r\n}());\r\nexport { EnvelopeCreator };\r\nvar DependencyEnvelopeCreator = /** @class */ (function (_super) {\r\n tslib_1.__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 this._logger = logger;\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.baseData)) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"telemetryItem.baseData cannot be null.\");\r\n }\r\n var customMeasurements = {};\r\n var customProperties = {};\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n var bd = telemetryItem.baseData;\r\n if (CoreUtils.isNullOrUndefined(bd)) {\r\n logger.warnToConsole(\"Invalid input for dependency data\");\r\n return null;\r\n }\r\n var id = bd.id;\r\n var absoluteUrl = bd.absoluteUrl;\r\n var command = bd.commandName;\r\n var duration = bd.duration;\r\n var success = bd.success;\r\n var resultCode = bd.resultCode;\r\n var method = bd.method;\r\n var baseData = new RemoteDependencyData(logger, id, absoluteUrl, command, duration, success, resultCode, method, customProperties, customMeasurements);\r\n var data = new Data(RemoteDependencyData.dataType, baseData);\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 tslib_1.__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 this._logger = logger;\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.baseData)) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"telemetryItem.baseData cannot be null.\");\r\n }\r\n var customProperties = {};\r\n var customMeasurements = {};\r\n if (telemetryItem.baseType !== Event.dataType) {\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.baseData, customProperties, customMeasurements);\r\n }\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n var eventName = telemetryItem.baseData.name;\r\n var baseData = new Event(logger, eventName, customProperties, customMeasurements);\r\n var data = new Data(Event.dataType, baseData);\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 tslib_1.__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 this._logger = logger;\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.baseData)) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"telemetryItem.baseData cannot be null.\");\r\n }\r\n var customProperties = {};\r\n var customMeasurements = {};\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n var exception = telemetryItem.baseData.error;\r\n var severityLevel = telemetryItem.baseData.severityLevel;\r\n var baseData = new Exception(logger, exception, customProperties, customMeasurements, severityLevel);\r\n var data = new Data(Exception.dataType, baseData);\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 tslib_1.__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 this._logger = logger;\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.baseData)) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"telemetryItem.baseData cannot be null.\");\r\n }\r\n var customProperties = EnvelopeCreator.extractProperties(telemetryItem.data);\r\n var name = telemetryItem.baseData.name;\r\n var average = telemetryItem.baseData.average;\r\n var sampleCount = telemetryItem.baseData.sampleCount;\r\n var min = telemetryItem.baseData.min;\r\n var max = telemetryItem.baseData.max;\r\n var baseData = new Metric(logger, name, average, sampleCount, min, max, customProperties);\r\n var data = new Data(Metric.dataType, baseData);\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 tslib_1.__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 this._logger = logger;\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.baseData)) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"telemetryItem.baseData cannot be null.\");\r\n }\r\n // Since duration is not part of the domain properties in Common Schema, extract it from part C \r\n var duration = undefined;\r\n if (!CoreUtils.isNullOrUndefined(telemetryItem.data) &&\r\n !CoreUtils.isNullOrUndefined(telemetryItem.data.duration)) {\r\n duration = telemetryItem.data.duration;\r\n delete telemetryItem.data.duration;\r\n }\r\n var customProperties = {};\r\n var customMeasurements = {};\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n var name = telemetryItem.baseData.name;\r\n var url = telemetryItem.baseData.uri;\r\n // Todo: move IPageViewTelemetry to common as we are missing type checks on baseData here\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 (!CoreUtils.isNullOrUndefined(telemetryItem.baseData.refUri)) {\r\n customProperties[\"refUri\"] = telemetryItem.baseData.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 (!CoreUtils.isNullOrUndefined(telemetryItem.baseData.pageType)) {\r\n customProperties[\"pageType\"] = telemetryItem.baseData.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 (!CoreUtils.isNullOrUndefined(telemetryItem.baseData.isLoggedIn)) {\r\n customProperties[\"isLoggedIn\"] = telemetryItem.baseData.isLoggedIn;\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 (!CoreUtils.isNullOrUndefined(telemetryItem.baseData.pageTags)) {\r\n var pageTags = telemetryItem.baseData.pageTags;\r\n for (var key in pageTags) {\r\n if (pageTags.hasOwnProperty(key)) {\r\n customProperties[key] = pageTags[key];\r\n }\r\n }\r\n }\r\n var baseData = new PageView(logger, name, url, duration, customProperties, customMeasurements);\r\n var data = new Data(PageView.dataType, baseData);\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 tslib_1.__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 this._logger = logger;\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.baseData)) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"telemetryItem.baseData cannot be null.\");\r\n }\r\n var customProperties = {};\r\n var customMeasurements = {};\r\n EnvelopeCreator.extractPropsAndMeasurements(telemetryItem.data, customProperties, customMeasurements);\r\n var name = telemetryItem.baseData.name;\r\n var url = telemetryItem.baseData.uri;\r\n var duration = telemetryItem.baseData.duration;\r\n var baseData = new PageViewPerformance(logger, name, url, duration, customProperties, customMeasurements);\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 tslib_1.__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 this._logger = logger;\r\n if (CoreUtils.isNullOrUndefined(telemetryItem.baseData)) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"telemetryItem.baseData cannot be null.\");\r\n }\r\n var message = telemetryItem.baseData.message;\r\n var severityLevel = telemetryItem.baseData.severityLevel;\r\n var customProperties = EnvelopeCreator.extractProperties(telemetryItem.data);\r\n var baseData = new Trace(logger, message, customProperties, severityLevel);\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","var EventValidator = /** @class */ (function () {\r\n function EventValidator() {\r\n }\r\n EventValidator.prototype.Validate = function (item) {\r\n /* TODO re-enable once design of iTelemetryItem is finalized. Task used to track this:\r\n https://mseng.visualstudio.com/AppInsights/_workitems/edit/1310871\r\n\r\n // verify system properties has a ver field\r\n if (!item.sytemProperties || !item.sytemProperties[\"ver\"]) {\r\n return false;\r\n }\r\n \r\n if (!item.domainProperties || !item.domainProperties[\"name\"]) {\r\n return false;\r\n }\r\n */\r\n return true;\r\n };\r\n EventValidator.EventValidator = new EventValidator();\r\n return EventValidator;\r\n}());\r\nexport { EventValidator };\r\n//# sourceMappingURL=EventValidator.js.map","var TraceValidator = /** @class */ (function () {\r\n function TraceValidator() {\r\n }\r\n TraceValidator.prototype.Validate = function (item) {\r\n /* TODO re-enable once design of iTelemetryItem is finalized. Task used to track this:\r\n https://mseng.visualstudio.com/AppInsights/_workitems/edit/1310871\r\n\r\n // verify system properties has a ver field\r\n if (!item.sytemProperties ||\r\n !item.sytemProperties[\"ver\"]) {\r\n return false;\r\n }\r\n \r\n if (!item.domainProperties ||\r\n !item.domainProperties[\"message\"] ||\r\n !item.domainProperties[\"severityLevel\"]) {\r\n return false;\r\n }\r\n */\r\n return true;\r\n };\r\n TraceValidator.TraceValidator = new TraceValidator();\r\n return TraceValidator;\r\n}());\r\nexport { TraceValidator };\r\n//# sourceMappingURL=TraceValidator.js.map","var ExceptionValidator = /** @class */ (function () {\r\n function ExceptionValidator() {\r\n }\r\n ExceptionValidator.prototype.Validate = function (item) {\r\n /* TODO re-enable once design of iTelemetryItem is finalized. Task used to track this:\r\n https://mseng.visualstudio.com/AppInsights/_workitems/edit/1310871\r\n\r\n // verify system properties has a ver field\r\n if (!item.sytemProperties ||\r\n !item.sytemProperties[\"ver\"]) {\r\n return false;\r\n }\r\n\r\n if (!item.domainProperties ||\r\n !item.domainProperties[\"exceptions\"] ||\r\n !ExceptionValidator._validateExceptions(item.domainProperties[\"exceptions\"])) {\r\n return false;\r\n }\r\n */\r\n return true;\r\n };\r\n // TODO implement validation of exceptions\r\n ExceptionValidator._validateExceptions = function (exceptions) {\r\n // typeName\r\n // message\r\n // parsedStack\r\n // stack\r\n // hasFullStack\r\n return true;\r\n };\r\n ExceptionValidator.ExceptionValidator = new ExceptionValidator();\r\n return ExceptionValidator;\r\n}());\r\nexport { ExceptionValidator };\r\n//# sourceMappingURL=ExceptionValidator.js.map","var MetricValidator = /** @class */ (function () {\r\n function MetricValidator() {\r\n }\r\n MetricValidator.prototype.Validate = function (event) {\r\n return true;\r\n };\r\n MetricValidator.MetricValidator = new MetricValidator();\r\n return MetricValidator;\r\n}());\r\nexport { MetricValidator };\r\n//# sourceMappingURL=MetricValidator.js.map","var PageViewPerformanceValidator = /** @class */ (function () {\r\n function PageViewPerformanceValidator() {\r\n }\r\n PageViewPerformanceValidator.prototype.Validate = function (item) {\r\n /* TODO re-enable once design of iTelemetryItem is finalized. Task used to track this:\r\n https://mseng.visualstudio.com/AppInsights/_workitems/edit/1310871\r\n \r\n // verify system properties has a ver field\r\n if (!item.sytemProperties ||\r\n !item.sytemProperties[\"ver\"]) {\r\n return false;\r\n }\r\n\r\n if (!item.domainProperties ||\r\n !item.domainProperties[\"domProcessing\"] ||\r\n !item.domainProperties[\"duration\"] ||\r\n !item.domainProperties[\"name\"] ||\r\n !item.domainProperties[\"networkConnect\"] ||\r\n !item.domainProperties[\"perfTotal\"] ||\r\n !item.domainProperties[\"receivedResponse\"] ||\r\n !item.domainProperties[\"sentRequest\"] ||\r\n !item.domainProperties[\"url\"]) {\r\n return false;\r\n }\r\n */\r\n return true;\r\n };\r\n PageViewPerformanceValidator.PageViewPerformanceValidator = new PageViewPerformanceValidator();\r\n return PageViewPerformanceValidator;\r\n}());\r\nexport { PageViewPerformanceValidator };\r\n//# sourceMappingURL=PageViewPerformanceValidator.js.map","var PageViewValidator = /** @class */ (function () {\r\n function PageViewValidator() {\r\n }\r\n PageViewValidator.prototype.Validate = function (item) {\r\n /* TODO re-enable once design of iTelemetryItem is finalized. Task used to track this:\r\n https://mseng.visualstudio.com/AppInsights/_workitems/edit/1310871\r\n\r\n // verify system properties has a ver field\r\n if (!item.sytemProperties ||\r\n !item.sytemProperties[\"ver\"]) {\r\n return false;\r\n }\r\n\r\n if (!item.domainProperties ||\r\n !item.domainProperties[\"id\"] ||\r\n !item.domainProperties[\"name\"] ||\r\n !item.domainProperties[\"duration\"] ||\r\n !item.domainProperties[\"url\"]) {\r\n return false;\r\n }\r\n */\r\n return true;\r\n };\r\n PageViewValidator.PageViewValidator = new PageViewValidator();\r\n return PageViewValidator;\r\n}());\r\nexport { PageViewValidator };\r\n//# sourceMappingURL=PageViewValidator.js.map","var RemoteDepdencyValidator = /** @class */ (function () {\r\n function RemoteDepdencyValidator() {\r\n }\r\n RemoteDepdencyValidator.prototype.Validate = function (item) {\r\n /* TODO re-enable once design of iTelemetryItem is finalized. Task used to track this:\r\n https://mseng.visualstudio.com/AppInsights/_workitems/edit/1310871\r\n\r\n // verify system properties has a ver field\r\n if (!item.sytemProperties ||\r\n !item.sytemProperties[\"ver\"]) {\r\n return false;\r\n }\r\n\r\n if (!item.domainProperties ||\r\n !item.domainProperties[\"id\"] ||\r\n !item.domainProperties[\"name\"] ||\r\n !item.domainProperties[\"resultCode\"] ||\r\n !item.domainProperties[\"duration\"] ||\r\n !item.domainProperties[\"success\"] ||\r\n !item.domainProperties[\"data\"] ||\r\n !item.domainProperties[\"target\"] ||\r\n !item.domainProperties[\"type\"]) {\r\n return false;\r\n }\r\n */\r\n return true;\r\n };\r\n RemoteDepdencyValidator.RemoteDepdencyValidator = new RemoteDepdencyValidator();\r\n return RemoteDepdencyValidator;\r\n}());\r\nexport { RemoteDepdencyValidator };\r\n//# sourceMappingURL=RemoteDepdencyValidator.js.map","import { Util, FieldType } from '@microsoft/applicationinsights-common';\r\nimport { LoggingSeverity, _InternalMessageId } from '@microsoft/applicationinsights-core-js';\r\nvar Serializer = /** @class */ (function () {\r\n function Serializer(logger) {\r\n this._logger = logger;\r\n }\r\n /**\r\n * Serializes the current object to a JSON string.\r\n */\r\n Serializer.prototype.serialize = function (input) {\r\n var output = this._serializeObject(input, \"root\");\r\n return JSON.stringify(output);\r\n };\r\n Serializer.prototype._serializeObject = function (source, name) {\r\n var circularReferenceCheck = \"__aiCircularRefCheck\";\r\n var output = {};\r\n if (!source) {\r\n this._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 this._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 = this._serializeStringMap(source, \"number\", name);\r\n }\r\n else if (name === \"properties\") {\r\n output = this._serializeStringMap(source, \"string\", name);\r\n }\r\n else if (name === \"tags\") {\r\n output = this._serializeStringMap(source, \"string\", name);\r\n }\r\n else if (Util.isArray(source)) {\r\n output = this._serializeArray(source, name);\r\n }\r\n else {\r\n this._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 JSON.stringify(source);\r\n output = source;\r\n }\r\n catch (e) {\r\n // if serialization fails return an empty string\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && typeof e.toString === 'function') ? 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 = (typeof contract === \"function\") ? (contract() & FieldType.Required) : (contract & FieldType.Required);\r\n var isHidden = (typeof contract === \"function\") ? (contract() & FieldType.Hidden) : (contract & FieldType.Hidden);\r\n var isArray = contract & FieldType.Array;\r\n var isPresent = source[field] !== undefined;\r\n var isObject = typeof source[field] === \"object\" && source[field] !== null;\r\n if (isRequired && !isPresent && !isArray) {\r\n this._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;\r\n if (isObject) {\r\n if (isArray) {\r\n // special case; resurse on each object in the source array\r\n value = this._serializeArray(source[field], field);\r\n }\r\n else {\r\n // recurse on the source object in this field\r\n value = this._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 Serializer.prototype._serializeArray = function (sources, name) {\r\n var output = undefined;\r\n if (!!sources) {\r\n if (!Util.isArray(sources)) {\r\n this._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 = this._serializeObject(source, name + \"[\" + i + \"]\");\r\n output.push(item);\r\n }\r\n }\r\n }\r\n return output;\r\n };\r\n Serializer.prototype._serializeStringMap = function (map, expectedType, name) {\r\n var output = undefined;\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 this._logger.throwInternal(LoggingSeverity.CRITICAL, output[field], null, true);\r\n }\r\n }\r\n }\r\n return output;\r\n };\r\n return Serializer;\r\n}());\r\nexport { Serializer };\r\n//# sourceMappingURL=Serializer.js.map","/**\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 this._onlineStatus = true;\r\n if (typeof window === 'undefined') {\r\n this.isListening = false;\r\n }\r\n else if (window && window.addEventListener) {\r\n window.addEventListener('online', this._setOnline.bind(this), false);\r\n window.addEventListener('offline', this._setOffline.bind(this), false);\r\n this.isListening = true;\r\n }\r\n else if (document && document.body) {\r\n document.body.ononline = this._setOnline.bind(this);\r\n document.body.onoffline = this._setOffline.bind(this);\r\n this.isListening = true;\r\n }\r\n else if (document) {\r\n document.ononline = this._setOnline.bind(this);\r\n document.onoffline = this._setOffline.bind(this);\r\n this.isListening = true;\r\n }\r\n else {\r\n // Could not find a place to add event listener\r\n this.isListening = false;\r\n }\r\n }\r\n OfflineListener.prototype._setOnline = function () {\r\n this._onlineStatus = true;\r\n };\r\n OfflineListener.prototype._setOffline = function () {\r\n this._onlineStatus = false;\r\n };\r\n OfflineListener.prototype.isOnline = function () {\r\n if (this.isListening) {\r\n return this._onlineStatus;\r\n }\r\n else if (navigator) {\r\n return navigator.onLine;\r\n }\r\n else {\r\n // Cannot determine online status - report as online\r\n return true;\r\n }\r\n };\r\n OfflineListener.prototype.isOffline = function () {\r\n return !this.isOnline();\r\n };\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","import { SessionStorageSendBuffer, ArraySendBuffer } from './SendBuffer';\r\nimport { DependencyEnvelopeCreator, EventEnvelopeCreator, ExceptionEnvelopeCreator, MetricEnvelopeCreator, PageViewEnvelopeCreator, PageViewPerformanceEnvelopeCreator, TraceEnvelopeCreator } from './EnvelopeCreator';\r\nimport { EventValidator } from './TelemetryValidation/EventValidator';\r\nimport { TraceValidator } from './TelemetryValidation/TraceValidator';\r\nimport { ExceptionValidator } from './TelemetryValidation/ExceptionValidator';\r\nimport { MetricValidator } from './TelemetryValidation/MetricValidator';\r\nimport { PageViewPerformanceValidator } from './TelemetryValidation/PageViewPerformanceValidator';\r\nimport { PageViewValidator } from './TelemetryValidation/PageViewValidator';\r\nimport { RemoteDepdencyValidator } from './TelemetryValidation/RemoteDepdencyValidator';\r\nimport { Serializer } from './Serializer'; // todo move to channel\r\nimport { DisabledPropertyName, RequestHeaders, Util, PageView, Event, Trace, Exception, Metric, PageViewPerformance, RemoteDependencyData, ConfigurationManager } from '@microsoft/applicationinsights-common';\r\nimport { _InternalMessageId, LoggingSeverity, } from '@microsoft/applicationinsights-core-js';\r\nimport { CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nimport { Offline } from './Offline';\r\nvar Sender = /** @class */ (function () {\r\n function Sender() {\r\n this.priority = 201;\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 this.identifier = \"AppInsightsChannelPlugin\";\r\n }\r\n Sender.prototype.pause = function () {\r\n throw new Error(\"Method not implemented.\");\r\n };\r\n Sender.prototype.resume = function () {\r\n throw new Error(\"Method not implemented.\");\r\n };\r\n Sender.prototype.flush = function () {\r\n try {\r\n this.triggerSend();\r\n }\r\n catch (e) {\r\n this._logger.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 Sender.prototype.teardown = function () {\r\n throw new Error(\"Method not implemented.\");\r\n };\r\n Sender.prototype.initialize = function (config, core, extensions) {\r\n var _this = this;\r\n this._logger = core.logger;\r\n this._serializer = new Serializer(core.logger);\r\n this._consecutiveErrors = 0;\r\n this._retryAt = null;\r\n this._lastSend = 0;\r\n this._sender = null;\r\n var defaultConfig = Sender._getDefaultAppInsightsChannelConfig();\r\n this._config = Sender._getEmptyAppInsightsChannelConfig();\r\n var _loop_1 = function (field) {\r\n this_1._config[field] = function () { return ConfigurationManager.getConfig(config, field, _this.identifier, 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._buffer = (Util.canUseSessionStorage() && this._config.enableSessionStorageBuffer)\r\n ? new SessionStorageSendBuffer(this._logger, this._config) : new ArraySendBuffer(this._config);\r\n if (!this._config.isBeaconApiDisabled() && Util.IsBeaconApiSupported()) {\r\n this._sender = this._beaconSender;\r\n }\r\n else {\r\n if (typeof XMLHttpRequest != \"undefined\") {\r\n var testXhr = new XMLHttpRequest();\r\n if (\"withCredentials\" in testXhr) {\r\n this._sender = this._xhrSender;\r\n this._XMLHttpRequestSupported = true;\r\n }\r\n else if (typeof XDomainRequest !== \"undefined\") {\r\n this._sender = this._xdrSender; //IE 8 and 9\r\n }\r\n }\r\n }\r\n };\r\n Sender.prototype.processTelemetry = function (telemetryItem) {\r\n try {\r\n // if master off switch is set, don't send any data\r\n if (this._config.disableTelemetry()) {\r\n // Do not send/save data\r\n return;\r\n }\r\n // validate input\r\n if (!telemetryItem) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, \"Cannot send empty telemetry\");\r\n return;\r\n }\r\n // ensure a sender was constructed\r\n if (!this._sender) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, \"Sender was not initialized\");\r\n return;\r\n }\r\n // first we need to validate that the envelope passed down is valid\r\n var isValid = Sender._validate(telemetryItem);\r\n if (!isValid) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, \"Invalid telemetry envelope\");\r\n return;\r\n }\r\n // construct an envelope that Application Insights endpoint can understand\r\n var aiEnvelope = this._constructEnvelope(telemetryItem);\r\n if (!aiEnvelope) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, \"Unable to create an AppInsights envelope\");\r\n return;\r\n }\r\n // check if the incoming payload is too large, truncate if necessary\r\n var payload = this._serializer.serialize(aiEnvelope);\r\n // flush if we would exceed the max-size limit by adding this item\r\n var bufferPayload = this._buffer.getItems();\r\n var batch = this._buffer.batchPayloads(bufferPayload);\r\n if (batch && (batch.length + payload.length > this._config.maxBatchSizeInBytes())) {\r\n this.triggerSend();\r\n }\r\n // enqueue the payload\r\n this._buffer.enqueue(payload);\r\n // ensure an invocation timeout is set\r\n this._setupTimer();\r\n }\r\n catch (e) {\r\n this._logger.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 if (!CoreUtils.isNullOrUndefined(this._nextPlugin)) {\r\n this._nextPlugin.processTelemetry(telemetryItem);\r\n }\r\n };\r\n Sender.prototype.setNextPlugin = function (next) {\r\n this._nextPlugin = next;\r\n };\r\n /**\r\n * xhr state changes\r\n */\r\n Sender.prototype._xhrReadyStateChange = function (xhr, payload, countOfItemsInPayload) {\r\n if (xhr.readyState === 4) {\r\n var response = null;\r\n if (!this._appId) {\r\n response = this._parseResponse(xhr.responseText || xhr.response);\r\n if (response && response.appId) {\r\n this._appId = response.appId;\r\n }\r\n }\r\n if ((xhr.status < 200 || xhr.status >= 300) && xhr.status !== 0) {\r\n if (!this._config.isRetryDisabled() && this._isRetriable(xhr.status)) {\r\n this._resendPayload(payload);\r\n this._logger.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 this._onError(payload, this._formatErrorMessageXhr(xhr));\r\n }\r\n }\r\n else if (xhr.status === 0 || Offline.isOffline()) {\r\n if (!this._config.isRetryDisabled()) {\r\n var offlineBackOffMultiplier = 10; // arbritrary number\r\n this._resendPayload(payload, offlineBackOffMultiplier);\r\n this._logger.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 = this._parseResponse(xhr.responseText || xhr.response);\r\n }\r\n if (response && !this._config.isRetryDisabled()) {\r\n this._onPartialSuccess(payload, response);\r\n }\r\n else {\r\n this._onError(payload, this._formatErrorMessageXhr(xhr));\r\n }\r\n }\r\n else {\r\n this._consecutiveErrors = 0;\r\n this._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 */\r\n Sender.prototype.triggerSend = function (async) {\r\n if (async === void 0) { async = true; }\r\n try {\r\n // Send data only if disableTelemetry is false\r\n if (!this._config.disableTelemetry()) {\r\n if (this._buffer.count() > 0) {\r\n var payload = this._buffer.getItems();\r\n // invoke send\r\n this._sender(payload, async);\r\n }\r\n // update lastSend time to enable throttling\r\n this._lastSend = +new Date;\r\n }\r\n else {\r\n this._buffer.clear();\r\n }\r\n clearTimeout(this._timeoutHandle);\r\n this._timeoutHandle = null;\r\n this._retryAt = null;\r\n }\r\n catch (e) {\r\n /* Ignore this error for IE under v10 */\r\n if (!Util.getIEVersion() || Util.getIEVersion() > 9) {\r\n this._logger.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 Sender.prototype._onError = function (payload, message, event) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.OnError, \"Failed to send telemetry.\", { message: message });\r\n this._buffer.clearSent(payload);\r\n };\r\n /**\r\n * partial success handler\r\n */\r\n Sender.prototype._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 (this._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 this._onSuccess(payload, results.itemsAccepted);\r\n }\r\n if (failed.length > 0) {\r\n this._onError(failed, this._formatErrorMessageXhr(null, ['partial success', results.itemsAccepted, 'of', results.itemsReceived].join(' ')));\r\n }\r\n if (retry.length > 0) {\r\n this._resendPayload(retry);\r\n this._logger.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 Sender.prototype._onSuccess = function (payload, countOfItemsInPayload) {\r\n this._buffer.clearSent(payload);\r\n };\r\n /**\r\n * xdr state changes\r\n */\r\n Sender.prototype._xdrOnLoad = function (xdr, payload) {\r\n if (xdr && (xdr.responseText + \"\" === \"200\" || xdr.responseText === \"\")) {\r\n this._consecutiveErrors = 0;\r\n this._onSuccess(payload, 0);\r\n }\r\n else {\r\n var results = this._parseResponse(xdr.responseText);\r\n if (results && results.itemsReceived && results.itemsReceived > results.itemsAccepted\r\n && !this._config.isRetryDisabled()) {\r\n this._onPartialSuccess(payload, results);\r\n }\r\n else {\r\n this._onError(payload, this._formatErrorMessageXdr(xdr));\r\n }\r\n }\r\n };\r\n Sender.prototype._constructEnvelope = function (envelope) {\r\n switch (envelope.baseType) {\r\n case Event.dataType:\r\n return EventEnvelopeCreator.EventEnvelopeCreator.Create(this._logger, envelope);\r\n case Trace.dataType:\r\n return TraceEnvelopeCreator.TraceEnvelopeCreator.Create(this._logger, envelope);\r\n case PageView.dataType:\r\n return PageViewEnvelopeCreator.PageViewEnvelopeCreator.Create(this._logger, envelope);\r\n case PageViewPerformance.dataType:\r\n return PageViewPerformanceEnvelopeCreator.PageViewPerformanceEnvelopeCreator.Create(this._logger, envelope);\r\n case Exception.dataType:\r\n return ExceptionEnvelopeCreator.ExceptionEnvelopeCreator.Create(this._logger, envelope);\r\n case Metric.dataType:\r\n return MetricEnvelopeCreator.MetricEnvelopeCreator.Create(this._logger, envelope);\r\n case RemoteDependencyData.dataType:\r\n return DependencyEnvelopeCreator.DependencyEnvelopeCreator.Create(this._logger, envelope);\r\n default:\r\n // default create custom event type\r\n return EventEnvelopeCreator.EventEnvelopeCreator.Create(this._logger, envelope);\r\n }\r\n };\r\n Sender._getDefaultAppInsightsChannelConfig = function () {\r\n var resultConfig = {};\r\n // set default values\r\n resultConfig.endpointUrl = function () { return \"https://dc.services.visualstudio.com/v2/track\"; };\r\n resultConfig.emitLineDelimitedJson = function () { return false; };\r\n resultConfig.maxBatchInterval = function () { return 15000; };\r\n resultConfig.maxBatchSizeInBytes = function () { return 102400; }; // 100kb\r\n resultConfig.disableTelemetry = function () { return false; };\r\n resultConfig.enableSessionStorageBuffer = function () { return true; };\r\n resultConfig.isRetryDisabled = function () { return false; };\r\n resultConfig.isBeaconApiDisabled = function () { return true; };\r\n return resultConfig;\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 };\r\n };\r\n Sender._validate = function (envelope) {\r\n // call the appropriate Validate depending on the baseType\r\n switch (envelope.baseType) {\r\n case Event.dataType:\r\n return EventValidator.EventValidator.Validate(envelope);\r\n case Trace.dataType:\r\n return TraceValidator.TraceValidator.Validate(envelope);\r\n case Exception.dataType:\r\n return ExceptionValidator.ExceptionValidator.Validate(envelope);\r\n case Metric.dataType:\r\n return MetricValidator.MetricValidator.Validate(envelope);\r\n case PageView.dataType:\r\n return PageViewValidator.PageViewValidator.Validate(envelope);\r\n case PageViewPerformance.dataType:\r\n return PageViewPerformanceValidator.PageViewPerformanceValidator.Validate(envelope);\r\n case RemoteDependencyData.dataType:\r\n return RemoteDepdencyValidator.RemoteDepdencyValidator.Validate(envelope);\r\n default:\r\n return EventValidator.EventValidator.Validate(envelope);\r\n }\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 Sender.prototype._beaconSender = function (payload, isAsync) {\r\n var url = this._config.endpointUrl();\r\n var batch = this._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 = navigator.sendBeacon(url, plainTextBatch);\r\n if (queued) {\r\n this._buffer.markAsSent(payload);\r\n }\r\n else {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, \". \" + \"Failed to send telemetry with Beacon API.\");\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 Sender.prototype._xhrSender = function (payload, isAsync) {\r\n var _this = this;\r\n var xhr = new XMLHttpRequest();\r\n xhr[DisabledPropertyName] = true;\r\n xhr.open(\"POST\", this._config.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(this._config.endpointUrl())) {\r\n xhr.setRequestHeader(RequestHeaders.sdkContextHeader, RequestHeaders.sdkContextHeaderAppIdRequest);\r\n }\r\n xhr.onreadystatechange = function () { return _this._xhrReadyStateChange(xhr, payload, payload.length); };\r\n xhr.onerror = function (event) { return _this._onError(payload, _this._formatErrorMessageXhr(xhr), event); };\r\n // compose an array of payloads\r\n var batch = this._buffer.batchPayloads(payload);\r\n xhr.send(batch);\r\n this._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 Sender.prototype._parseResponse = function (response) {\r\n try {\r\n if (response && response !== \"\") {\r\n var result = JSON.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 this._logger.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 Sender.prototype._resendPayload = function (payload, linearFactor) {\r\n if (linearFactor === void 0) { linearFactor = 1; }\r\n if (!payload || payload.length === 0) {\r\n return;\r\n }\r\n this._buffer.clearSent(payload);\r\n this._consecutiveErrors++;\r\n for (var _i = 0, payload_1 = payload; _i < payload_1.length; _i++) {\r\n var item = payload_1[_i];\r\n this._buffer.enqueue(item);\r\n }\r\n // setup timer\r\n this._setRetryTime(linearFactor);\r\n this._setupTimer();\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 Sender.prototype._setRetryTime = function (linearFactor) {\r\n var SlotDelayInSeconds = 10;\r\n var delayInSeconds;\r\n if (this._consecutiveErrors <= 1) {\r\n delayInSeconds = SlotDelayInSeconds;\r\n }\r\n else {\r\n var backOffSlot = (Math.pow(2, this._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 = Date.now() + (delayInSeconds * 1000);\r\n // TODO: Log the retry at time like the C# version does.\r\n this._retryAt = retryAfterTimeSpan;\r\n };\r\n /**\r\n * Sets up the timer which triggers actually sending the data.\r\n */\r\n Sender.prototype._setupTimer = function () {\r\n var _this = this;\r\n if (!this._timeoutHandle) {\r\n var retryInterval = this._retryAt ? Math.max(0, this._retryAt - Date.now()) : 0;\r\n var timerValue = Math.max(this._config.maxBatchInterval(), retryInterval);\r\n this._timeoutHandle = setTimeout(function () {\r\n _this.triggerSend();\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 Sender.prototype._isRetriable = function (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 Sender.prototype._formatErrorMessageXhr = function (xhr, message) {\r\n if (xhr) {\r\n return \"XMLHttpRequest,Status:\" + xhr.status + \",Response:\" + xhr.responseText || 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 Sender.prototype._xdrSender = function (payload, isAsync) {\r\n var _this = this;\r\n var xdr = new XDomainRequest();\r\n xdr.onload = function () { return _this._xdrOnLoad(xdr, payload); };\r\n xdr.onerror = function (event) { return _this._onError(payload, _this._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.location.protocol;\r\n if (this._config.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, \". \" +\r\n \"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.\");\r\n this._buffer.clear();\r\n return;\r\n }\r\n var endpointUrl = this._config.endpointUrl().replace(/^(https?:)/, \"\");\r\n xdr.open('POST', endpointUrl);\r\n // compose an array of payloads\r\n var batch = this._buffer.batchPayloads(payload);\r\n xdr.send(batch);\r\n this._buffer.markAsSent(payload);\r\n };\r\n Sender.prototype._formatErrorMessageXdr = function (xdr, message) {\r\n if (xdr) {\r\n return \"XDomainRequest,Response:\" + xdr.responseText || \"\";\r\n }\r\n return message;\r\n };\r\n return Sender;\r\n}());\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, DateTimeUtils } 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 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.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 var now = DateTimeUtils.Now();\r\n var acquisitionExpired = now - this.automaticSession.acquisitionDate > this.config.sessionExpirationMs();\r\n var renewalExpired = now - this.automaticSession.renewalDate > this.config.sessionRenewalMs();\r\n // renew if acquisitionSpan or renewalSpan has ellapsed\r\n if (acquisitionExpired || renewalExpired) {\r\n // update automaticSession so session state has correct id \r\n this.automaticSession.isFirst = undefined;\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 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, 'ai_session');\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, 'ai_session');\r\n if (storage) {\r\n this.initializeAutomaticSessionWithData(storage);\r\n }\r\n }\r\n if (!this.automaticSession.id) {\r\n this.automaticSession.isFirst = true;\r\n this.renew();\r\n }\r\n };\r\n /**\r\n * Extract id, aquisitionDate, and renewalDate from an ai_session payload string and\r\n * use this data to initialize automaticSession.\r\n *\r\n * @param {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 = DateTimeUtils.Now();\r\n this.automaticSession.id = Util.newId();\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 cookieDomnain = this.config.cookieDomain ? this.config.cookieDomain() : null;\r\n Util.setCookie(this._logger, 'ai_session', cookie.join('|') + ';expires=' + cookieExpiry.toUTCString(), cookieDomnain);\r\n this.cookieUpdatedTimestamp = DateTimeUtils.Now();\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, 'ai_session', [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 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.type = \"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.0.1-beta\";\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\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 } from '@microsoft/applicationinsights-common';\r\nvar Operation = /** @class */ (function () {\r\n function Operation() {\r\n this.id = Util.newId();\r\n if (window && window.location && window.location.pathname) {\r\n this.name = window.location.pathname;\r\n }\r\n }\r\n return Operation;\r\n}());\r\nexport { Operation };\r\n//# sourceMappingURL=Operation.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 } from '@microsoft/applicationinsights-core-js';\r\nvar User = /** @class */ (function () {\r\n function User(config, logger) {\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 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 = Util.newId();\r\n var date = new Date();\r\n var acqStr = Util.toISOStringForIE8(date);\r\n this.accountAcquisitionDate = acqStr;\r\n // without expiration, cookies expire at the end of the session\r\n // set it to 365 days from now\r\n // 365 * 24 * 60 * 60 * 1000 = 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 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 Util.removeStorage(this._logger, 'ai_session');\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 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","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\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 }\r\n SamplingScoreGenerator.prototype.getSamplingScore = function (envelope) {\r\n var tagKeys = new ContextTagKeys();\r\n var score = 0;\r\n if (envelope.tags[tagKeys.userId]) {\r\n score = this.hashCodeGeneragor.getHashCodeScore(envelope.tags[tagKeys.userId]);\r\n }\r\n else if (envelope.tags[tagKeys.operationId]) {\r\n score = this.hashCodeGeneragor.getHashCodeScore(envelope.tags[tagKeys.operationId]);\r\n }\r\n else {\r\n // tslint:disable-next-line:insecure-random\r\n score = Math.random();\r\n }\r\n return score;\r\n };\r\n return SamplingScoreGenerator;\r\n}());\r\nexport { SamplingScoreGenerator };\r\n//# sourceMappingURL=SamplingScoreGenerator.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { SamplingScoreGenerator } from '../SamplingScoreGenerator';\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 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 (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 // return true as sampling will move to different extension\r\n return true;\r\n };\r\n return Sample;\r\n}());\r\nexport { Sample };\r\n//# sourceMappingURL=Sample.js.map","/**\r\n * PropertiesPlugin.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport { CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nimport { ContextTagKeys, PageView, ConfigurationManager, partAExtensions } from '@microsoft/applicationinsights-common';\r\nimport { Session, _SessionManager } from './Context/Session';\r\nimport { Application } from './Context/Application';\r\nimport { Device } from './Context/Device';\r\nimport { Internal } from './Context/Internal';\r\nimport { Location } from './Context/Location';\r\nimport { Operation } from './Context/Operation';\r\nimport { User } from './Context/User';\r\nimport { Sample } from './Context/Sample';\r\nvar PropertiesPlugin = /** @class */ (function () {\r\n function PropertiesPlugin() {\r\n this.priority = 170;\r\n this.identifier = \"AppInsightsPropertiesPlugin\";\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 enableOldTags: function () { return false; }\r\n };\r\n return defaultConfig;\r\n };\r\n PropertiesPlugin.prototype.initialize = function (config, core, extensions) {\r\n var _this = this;\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 ConfigurationManager.getConfig(config, field, _this.identifier, 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 if (typeof window !== 'undefined') {\r\n this._sessionManager = new _SessionManager(this._extensionConfig, core.logger);\r\n this.application = new Application();\r\n this.device = new Device();\r\n this.internal = new Internal(this._extensionConfig);\r\n this.location = new Location();\r\n this.user = new User(this._extensionConfig, core.logger);\r\n this.operation = new Operation();\r\n this.session = new Session();\r\n this.sample = new Sample(this._extensionConfig.samplingPercentage(), core.logger);\r\n }\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) {\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 // if the event is not sampled in, do not bother going through the pipeline\r\n if (this.sample.isSampledIn(event)) {\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 // TODO(barustum): resetInternalMessageCount once we have support for internal logging\r\n //_InternalLogging.resetInternalMessageCount();\r\n }\r\n if (this.session) {\r\n // If customer did not provide custom session id update the session manager\r\n if (typeof this.session.id !== \"string\") {\r\n this._sessionManager.update();\r\n }\r\n }\r\n this._processTelemetryInternal(event);\r\n }\r\n if (!CoreUtils.isNullOrUndefined(this._nextPlugin)) {\r\n this._nextPlugin.processTelemetry(event);\r\n }\r\n }\r\n };\r\n /**\r\n * Sets the next plugin that comes after this plugin\r\n * @param nextPlugin The next plugin\r\n */\r\n PropertiesPlugin.prototype.setNextPlugin = function (nextPlugin) {\r\n this._nextPlugin = nextPlugin;\r\n };\r\n PropertiesPlugin.prototype._processTelemetryInternal = function (event) {\r\n var tagsItem = {};\r\n if (this.session) {\r\n // If customer set id, apply his context; otherwise apply context generated from cookies \r\n if (typeof this.session.id === \"string\") {\r\n PropertiesPlugin._applySessionContext(tagsItem, this.session);\r\n }\r\n else {\r\n PropertiesPlugin._applySessionContext(tagsItem, this._sessionManager.automaticSession);\r\n }\r\n }\r\n if (this._extensionConfig.enableOldTags()) {\r\n // set part A fields\r\n PropertiesPlugin._applyApplicationContext(tagsItem, this.application);\r\n PropertiesPlugin._applyDeviceContext(tagsItem, this.device);\r\n PropertiesPlugin._applyInternalContext(tagsItem, this.internal);\r\n PropertiesPlugin._applyLocationContext(tagsItem, this.location);\r\n PropertiesPlugin._applySampleContext(tagsItem, this.sample);\r\n PropertiesPlugin._applyOperationContext(tagsItem, this.operation);\r\n }\r\n this._applyUserContext(event, this.user);\r\n var tgs = [];\r\n Object.keys(tagsItem).forEach(function (item) {\r\n var p = {};\r\n p[item] = tagsItem[item];\r\n tgs.push(p);\r\n });\r\n event.tags.forEach(function (item) {\r\n tgs.push(item);\r\n });\r\n event.tags = tgs;\r\n };\r\n PropertiesPlugin._applySessionContext = function (tags, sessionContext) {\r\n if (sessionContext) {\r\n var tagKeys = new ContextTagKeys();\r\n if (typeof sessionContext.id === \"string\") {\r\n tags[tagKeys.sessionId] = sessionContext.id;\r\n }\r\n if (typeof sessionContext.isFirst !== \"undefined\") {\r\n tags[tagKeys.sessionIsFirst] = sessionContext.isFirst;\r\n }\r\n }\r\n };\r\n PropertiesPlugin._applyApplicationContext = function (tagsItem, appContext) {\r\n if (appContext) {\r\n var tagKeys = new ContextTagKeys();\r\n if (typeof appContext.ver === \"string\") {\r\n tagsItem[tagKeys.applicationVersion] = appContext.ver;\r\n }\r\n if (typeof appContext.build === \"string\") {\r\n tagsItem[tagKeys.applicationBuild] = appContext.build;\r\n }\r\n }\r\n };\r\n PropertiesPlugin._applyDeviceContext = function (tagsItem, deviceContext) {\r\n var tagKeys = new ContextTagKeys();\r\n if (deviceContext) {\r\n if (typeof deviceContext.id === \"string\") {\r\n tagsItem[tagKeys.deviceId] = deviceContext.id;\r\n }\r\n if (typeof deviceContext.ip === \"string\") {\r\n tagsItem[tagKeys.deviceIp] = deviceContext.ip;\r\n }\r\n if (typeof deviceContext.language === \"string\") {\r\n tagsItem[tagKeys.deviceLanguage] = deviceContext.language;\r\n }\r\n if (typeof deviceContext.locale === \"string\") {\r\n tagsItem[tagKeys.deviceLocale] = deviceContext.locale;\r\n }\r\n if (typeof deviceContext.model === \"string\") {\r\n tagsItem[tagKeys.deviceModel] = deviceContext.model;\r\n }\r\n if (typeof deviceContext.network !== \"undefined\") {\r\n tagsItem[tagKeys.deviceNetwork] = deviceContext.network;\r\n }\r\n if (typeof deviceContext.oemName === \"string\") {\r\n tagsItem[tagKeys.deviceOEMName] = deviceContext.oemName;\r\n }\r\n if (typeof deviceContext.os === \"string\") {\r\n tagsItem[tagKeys.deviceOS] = deviceContext.os;\r\n }\r\n if (typeof deviceContext.osversion === \"string\") {\r\n tagsItem[tagKeys.deviceOSVersion] = deviceContext.osversion;\r\n }\r\n if (typeof deviceContext.resolution === \"string\") {\r\n tagsItem[tagKeys.deviceScreenResolution] = deviceContext.resolution;\r\n }\r\n if (typeof deviceContext.type === \"string\") {\r\n tagsItem[tagKeys.deviceType] = deviceContext.type;\r\n }\r\n }\r\n };\r\n PropertiesPlugin._applyInternalContext = function (tagsItem, internalContext) {\r\n if (internalContext) {\r\n var tagKeys = new ContextTagKeys();\r\n if (typeof internalContext.agentVersion === \"string\") {\r\n tagsItem[tagKeys.internalAgentVersion] = internalContext.agentVersion;\r\n }\r\n if (typeof internalContext.sdkVersion === \"string\") {\r\n tagsItem[tagKeys.internalSdkVersion] = internalContext.sdkVersion;\r\n }\r\n }\r\n };\r\n PropertiesPlugin._applyLocationContext = function (tagsItem, locationContext) {\r\n if (locationContext) {\r\n var tagKeys = new ContextTagKeys();\r\n if (typeof locationContext.ip === \"string\") {\r\n tagsItem[tagKeys.locationIp] = locationContext.ip;\r\n }\r\n }\r\n };\r\n PropertiesPlugin._applySampleContext = function (tagsItem, sampleContext) {\r\n if (sampleContext) {\r\n tagsItem.sampleRate = sampleContext.sampleRate;\r\n }\r\n };\r\n PropertiesPlugin._applyOperationContext = function (tagsItem, operationContext) {\r\n if (operationContext) {\r\n var tagKeys = new ContextTagKeys();\r\n if (typeof operationContext.id === \"string\") {\r\n tagsItem[tagKeys.operationId] = operationContext.id;\r\n }\r\n if (typeof operationContext.name === \"string\") {\r\n tagsItem[tagKeys.operationName] = operationContext.name;\r\n }\r\n if (typeof operationContext.parentId === \"string\") {\r\n tagsItem[tagKeys.operationParentId] = operationContext.parentId;\r\n }\r\n if (typeof operationContext.rootId === \"string\") {\r\n tagsItem[tagKeys.operationRootId] = operationContext.rootId;\r\n }\r\n if (typeof operationContext.syntheticSource === \"string\") {\r\n tagsItem[tagKeys.operationSyntheticSource] = operationContext.syntheticSource;\r\n }\r\n }\r\n };\r\n PropertiesPlugin.prototype._applyUserContext = function (event, userContext) {\r\n if (userContext) {\r\n if (!event.tags) {\r\n event.tags = [];\r\n }\r\n var tagKeys = new ContextTagKeys();\r\n if (this._extensionConfig.enableOldTags()) {\r\n if (typeof userContext.agent === \"string\") {\r\n var val = userContext.agent;\r\n var ky = tagKeys.userAgent;\r\n event.tags.push({ ky: val });\r\n }\r\n if (typeof userContext.storeRegion === \"string\") {\r\n var ky = tagKeys.userStoreRegion;\r\n var val = userContext.storeRegion;\r\n event.tags.push({ ky: val });\r\n }\r\n }\r\n // stays in tags under User extension\r\n if (typeof userContext.accountId === \"string\") {\r\n var item = {};\r\n item[partAExtensions.accountIdTag] = userContext.accountId;\r\n event.tags.push(item);\r\n }\r\n var ctxExt = {};\r\n // CS 4.0 \r\n if (typeof userContext.id === \"string\") {\r\n ctxExt.localId = userContext.id;\r\n }\r\n if (typeof userContext.authenticatedId === \"string\") {\r\n ctxExt.authId = userContext.authenticatedId;\r\n }\r\n event.ctx[partAExtensions.UserExtensionName] = ctxExt; // part A extension\r\n // CS 4.0\r\n }\r\n };\r\n return PropertiesPlugin;\r\n}());\r\nexport default PropertiesPlugin;\r\n//# sourceMappingURL=PropertiesPlugin.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { DataSanitizer, UrlHelper, DateTimeUtils } from '@microsoft/applicationinsights-common';\r\nvar XHRMonitoringState = /** @class */ (function () {\r\n function XHRMonitoringState() {\r\n this.openDone = false;\r\n this.setRequestHeaderDone = false;\r\n this.sendDone = false;\r\n this.abortDone = false;\r\n //True, if onreadyStateChangeCallback function attached to xhr, otherwise false\r\n this.onreadystatechangeCallbackAttached = false;\r\n }\r\n return XHRMonitoringState;\r\n}());\r\nexport { XHRMonitoringState };\r\nvar ajaxRecord = /** @class */ (function () {\r\n function ajaxRecord(id, logger) {\r\n this.completed = false;\r\n this.requestHeadersSize = null;\r\n this.ttfb = null;\r\n this.responseReceivingDuration = null;\r\n this.callbackDuration = null;\r\n this.ajaxTotalDuration = null;\r\n this.aborted = null;\r\n this.pageUrl = null;\r\n this.requestUrl = null;\r\n this.requestSize = 0;\r\n this.method = null;\r\n ///Returns the HTTP status code.\r\n this.status = null;\r\n //The timestamp when open method was invoked\r\n this.requestSentTime = null;\r\n //The timestamps when first byte was received\r\n this.responseStartedTime = null;\r\n //The timestamp when last byte was received\r\n this.responseFinishedTime = null;\r\n //The timestamp when onreadystatechange callback in readyState 4 finished\r\n this.callbackFinishedTime = null;\r\n //The timestamp at which ajax was ended\r\n this.endTime = null;\r\n //The original xhr onreadystatechange event\r\n this.originalOnreadystatechage = null;\r\n this.xhrMonitoringState = new XHRMonitoringState();\r\n //Determines whether or not JavaScript exception occured in xhr.onreadystatechange code. 1 if occured, otherwise 0.\r\n this.clientFailure = 0;\r\n this.CalculateMetrics = function () {\r\n var self = this;\r\n // round to 3 decimal points\r\n self.ajaxTotalDuration = Math.round(DateTimeUtils.GetDuration(self.requestSentTime, self.responseFinishedTime) * 1000) / 1000;\r\n };\r\n this.id = id;\r\n this._logger = logger;\r\n }\r\n ajaxRecord.prototype.getAbsoluteUrl = function () {\r\n return this.requestUrl ? UrlHelper.getAbsoluteUrl(this.requestUrl) : null;\r\n };\r\n ajaxRecord.prototype.getPathName = function () {\r\n return this.requestUrl ? DataSanitizer.sanitizeUrl(this._logger, UrlHelper.getCompleteUrl(this.method, this.requestUrl)) : null;\r\n };\r\n return ajaxRecord;\r\n}());\r\nexport { ajaxRecord };\r\n;\r\n//# sourceMappingURL=ajaxRecord.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 stringUtils = /** @class */ (function () {\r\n function stringUtils() {\r\n }\r\n stringUtils.GetLength = function (strObject) {\r\n var res = 0;\r\n if (!CoreUtils.isNullOrUndefined(strObject)) {\r\n var stringified = \"\";\r\n try {\r\n stringified = strObject.toString();\r\n }\r\n catch (ex) {\r\n // some troubles with complex object\r\n }\r\n res = stringified.length;\r\n res = isNaN(res) ? 0 : res;\r\n }\r\n return res;\r\n };\r\n return stringUtils;\r\n}());\r\nexport { stringUtils };\r\nvar EventHelper = /** @class */ (function () {\r\n function EventHelper() {\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 ///Object to which \r\n ///String that specifies any of the standard DHTML Events without \"on\" prefix\r\n ///Pointer that specifies the function to call when event fires\r\n ///True if the function was bound successfully to the event, otherwise false\r\n EventHelper.AttachEvent = function (obj, eventNameWithoutOn, handlerRef) {\r\n var result = false;\r\n if (!CoreUtils.isNullOrUndefined(obj)) {\r\n if (!CoreUtils.isNullOrUndefined(obj.attachEvent)) {\r\n // IE before version 9 \r\n obj.attachEvent(\"on\" + eventNameWithoutOn, handlerRef);\r\n result = true;\r\n }\r\n else {\r\n if (!CoreUtils.isNullOrUndefined(obj.addEventListener)) {\r\n // all browsers except IE before version 9\r\n obj.addEventListener(eventNameWithoutOn, handlerRef, false);\r\n result = true;\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n EventHelper.DetachEvent = function (obj, eventNameWithoutOn, handlerRef) {\r\n if (!CoreUtils.isNullOrUndefined(obj)) {\r\n if (!CoreUtils.isNullOrUndefined(obj.detachEvent)) {\r\n obj.detachEvent(\"on\" + eventNameWithoutOn, handlerRef);\r\n }\r\n else {\r\n if (!CoreUtils.isNullOrUndefined(obj.removeEventListener)) {\r\n obj.removeEventListener(eventNameWithoutOn, handlerRef, false);\r\n }\r\n }\r\n }\r\n };\r\n return EventHelper;\r\n}());\r\nexport { EventHelper };\r\n//# sourceMappingURL=ajaxUtils.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { RequestHeaders, Util, CorrelationIdHelper, TelemetryItemCreator, RemoteDependencyData, DateTimeUtils, DisabledPropertyName, ConfigurationManager } from '@microsoft/applicationinsights-common';\r\nimport { CoreUtils, LoggingSeverity, _InternalMessageId } from '@microsoft/applicationinsights-core-js';\r\nimport { ajaxRecord } from './ajaxRecord';\r\nimport { EventHelper } from './ajaxUtils';\r\nvar AjaxMonitor = /** @class */ (function () {\r\n function AjaxMonitor() {\r\n this._trackAjaxAttempts = 0;\r\n this.identifier = AjaxMonitor.identifier;\r\n this.priority = 161;\r\n this.currentWindowHost = window && window.location.host && window.location.host.toLowerCase();\r\n this.initialized = false;\r\n this._fetchInitialized = false;\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 AjaxMonitor.prototype.isMonitoredInstance = function (xhr, excludeAjaxDataValidation) {\r\n // checking to see that all interested functions on xhr were instrumented\r\n return this.initialized\r\n // checking on ajaxData to see that it was not removed in user code\r\n && (excludeAjaxDataValidation === true || !CoreUtils.isNullOrUndefined(xhr.ajaxData))\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 && xhr[DisabledPropertyName] !== true;\r\n };\r\n ///Determines whether ajax monitoring can be enabled on this document\r\n ///True if Ajax monitoring is supported on this page, otherwise false\r\n AjaxMonitor.prototype.supportsAjaxMonitoring = function () {\r\n var result = true;\r\n if (CoreUtils.isNullOrUndefined(XMLHttpRequest) ||\r\n CoreUtils.isNullOrUndefined(XMLHttpRequest.prototype) ||\r\n CoreUtils.isNullOrUndefined(XMLHttpRequest.prototype.open) ||\r\n CoreUtils.isNullOrUndefined(XMLHttpRequest.prototype.send) ||\r\n CoreUtils.isNullOrUndefined(XMLHttpRequest.prototype.abort)) {\r\n result = false;\r\n }\r\n // disable in IE8 or older (https://www.w3schools.com/jsref/jsref_trim_string.asp)\r\n try {\r\n \" a \".trim();\r\n }\r\n catch (ex) {\r\n result = false;\r\n }\r\n return result;\r\n };\r\n AjaxMonitor.prototype.instrumentOpen = function () {\r\n var originalOpen = XMLHttpRequest.prototype.open;\r\n var ajaxMonitorInstance = this;\r\n XMLHttpRequest.prototype.open = function (method, url, async) {\r\n try {\r\n if (ajaxMonitorInstance.isMonitoredInstance(this, true) &&\r\n (!this.ajaxData ||\r\n !this.ajaxData.xhrMonitoringState.openDone)) {\r\n ajaxMonitorInstance.openHandler(this, method, url, async);\r\n }\r\n }\r\n catch (e) {\r\n this._core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.\", {\r\n ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(this),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n return originalOpen.apply(this, arguments);\r\n };\r\n };\r\n AjaxMonitor.prototype.openHandler = function (xhr, method, url, async) {\r\n /* todo:\r\n Disabling the following block of code as CV is not yet supported in 1DS for 3rd Part.\r\n // this format corresponds with activity logic on server-side and is required for the correct correlation\r\n var id = \"|\" + this.appInsights.context.operation.id + \".\" + Util.newId();\r\n */\r\n var id = Util.newId();\r\n var ajaxData = new ajaxRecord(id, this._core.logger);\r\n ajaxData.method = method;\r\n ajaxData.requestUrl = url;\r\n ajaxData.xhrMonitoringState.openDone = true;\r\n xhr.ajaxData = ajaxData;\r\n this.attachToOnReadyStateChange(xhr);\r\n };\r\n AjaxMonitor.getFailedAjaxDiagnosticsMessage = function (xhr) {\r\n var result = \"\";\r\n try {\r\n if (!CoreUtils.isNullOrUndefined(xhr) &&\r\n !CoreUtils.isNullOrUndefined(xhr.ajaxData) &&\r\n !CoreUtils.isNullOrUndefined(xhr.ajaxData.requestUrl)) {\r\n result += \"(url: '\" + xhr.ajaxData.requestUrl + \"')\";\r\n }\r\n }\r\n catch (e) { }\r\n return result;\r\n };\r\n AjaxMonitor.prototype.instrumentSend = function () {\r\n var originalSend = XMLHttpRequest.prototype.send;\r\n var ajaxMonitorInstance = this;\r\n XMLHttpRequest.prototype.send = function (content) {\r\n try {\r\n if (ajaxMonitorInstance.isMonitoredInstance(this) && !this.ajaxData.xhrMonitoringState.sendDone) {\r\n ajaxMonitorInstance.sendHandler(this, content);\r\n }\r\n }\r\n catch (e) {\r\n this._core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedMonitorAjaxSend, \"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.\", {\r\n ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(this),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n return originalSend.apply(this, arguments);\r\n };\r\n };\r\n AjaxMonitor.prototype.sendHandler = function (xhr, content) {\r\n xhr.ajaxData.requestSentTime = DateTimeUtils.Now();\r\n xhr = this.includeCorrelationHeaders(xhr.ajaxData, undefined, undefined, xhr);\r\n xhr.ajaxData.xhrMonitoringState.sendDone = true;\r\n };\r\n AjaxMonitor.prototype.instrumentAbort = function () {\r\n var originalAbort = XMLHttpRequest.prototype.abort;\r\n var ajaxMonitorInstance = this;\r\n XMLHttpRequest.prototype.abort = function () {\r\n try {\r\n if (ajaxMonitorInstance.isMonitoredInstance(this) && !this.ajaxData.xhrMonitoringState.abortDone) {\r\n this.ajaxData.aborted = 1;\r\n this.ajaxData.xhrMonitoringState.abortDone = true;\r\n }\r\n }\r\n catch (e) {\r\n this._core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedMonitorAjaxAbort, \"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.\", {\r\n ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(this),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n return originalAbort.apply(this, arguments);\r\n };\r\n };\r\n AjaxMonitor.prototype.attachToOnReadyStateChange = function (xhr) {\r\n var _this = this;\r\n var ajaxMonitorInstance = this;\r\n xhr.ajaxData.xhrMonitoringState.onreadystatechangeCallbackAttached = EventHelper.AttachEvent(xhr, \"readystatechange\", function () {\r\n try {\r\n if (ajaxMonitorInstance.isMonitoredInstance(xhr)) {\r\n if (xhr.readyState === 4) {\r\n ajaxMonitorInstance.onAjaxComplete(xhr);\r\n }\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 || exceptionText.toLowerCase().indexOf(\"c00c023f\") == -1) {\r\n _this._core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedMonitorAjaxRSC, \"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.\", {\r\n ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(xhr),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n }\r\n });\r\n };\r\n AjaxMonitor.prototype.onAjaxComplete = function (xhr) {\r\n xhr.ajaxData.responseFinishedTime = DateTimeUtils.Now();\r\n xhr.ajaxData.status = xhr.status;\r\n xhr.ajaxData.CalculateMetrics();\r\n if (xhr.ajaxData.ajaxTotalDuration < 0) {\r\n this._core.logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedMonitorAjaxDur, \"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.\", {\r\n ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(xhr),\r\n requestSentTime: xhr.ajaxData.requestSentTime,\r\n responseFinishedTime: xhr.ajaxData.responseFinishedTime\r\n });\r\n }\r\n else {\r\n var dependency = {\r\n id: xhr.ajaxData.id,\r\n absoluteUrl: xhr.ajaxData.getAbsoluteUrl(),\r\n commandName: xhr.ajaxData.getPathName(),\r\n duration: xhr.ajaxData.ajaxTotalDuration,\r\n success: (+(xhr.ajaxData.status)) >= 200 && (+(xhr.ajaxData.status)) < 400,\r\n resultCode: +xhr.ajaxData.status,\r\n method: xhr.ajaxData.method\r\n };\r\n // enrich dependency target with correlation context from the server\r\n var correlationContext = this.getAjaxCorrelationContext(xhr);\r\n if (correlationContext) {\r\n dependency.correlationContext = /* dependency.target + \" | \" + */ correlationContext;\r\n }\r\n this.trackDependencyDataInternal(dependency);\r\n xhr.ajaxData = null;\r\n }\r\n };\r\n AjaxMonitor.prototype.getAjaxCorrelationContext = function (xhr) {\r\n try {\r\n var responseHeadersString = xhr.getAllResponseHeaders();\r\n if (responseHeadersString !== null) {\r\n var index = responseHeadersString.toLowerCase().indexOf(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 this._core.logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, \"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.\", {\r\n ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(xhr),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n };\r\n /**\r\n * Logs dependency call\r\n * @param dependencyData dependency data object\r\n */\r\n AjaxMonitor.prototype.trackDependencyDataInternal = function (dependency, properties, systemProperties) {\r\n if (this._config.maxAjaxCallsPerView === -1 || this._trackAjaxAttempts < this._config.maxAjaxCallsPerView) {\r\n var item = TelemetryItemCreator.create(dependency, RemoteDependencyData.dataType, RemoteDependencyData.envelopeType, this._core.logger, properties, systemProperties);\r\n this._core.track(item);\r\n }\r\n else if (this._trackAjaxAttempts === this._config.maxAjaxCallsPerView) {\r\n this._core.logger.throwInternal(LoggingSeverity.CRITICAL, _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 ++this._trackAjaxAttempts;\r\n };\r\n AjaxMonitor.prototype.trackDependencyData = function (dependency, properties) {\r\n this.trackDependencyDataInternal(dependency, properties);\r\n };\r\n AjaxMonitor.prototype.processTelemetry = function (item) {\r\n if (this._nextPlugin && this._nextPlugin.processTelemetry) {\r\n this._nextPlugin.processTelemetry(item);\r\n }\r\n };\r\n AjaxMonitor.prototype.setNextPlugin = function (next) {\r\n if (next) {\r\n this._nextPlugin = next;\r\n }\r\n };\r\n // Fetch Stuff\r\n AjaxMonitor.prototype.instrumentFetch = function () {\r\n if (!this.supportsFetch() || this._fetchInitialized) {\r\n return;\r\n }\r\n var originalFetch = window.fetch;\r\n var fetchMonitorInstance = this;\r\n window.fetch = function fetch(input, init) {\r\n var fetchData;\r\n if (fetchMonitorInstance.isFetchInstrumented(input)) {\r\n try {\r\n fetchData = fetchMonitorInstance.createFetchRecord(input, init);\r\n init = fetchMonitorInstance.includeCorrelationHeaders(fetchData, input, init);\r\n }\r\n catch (e) {\r\n fetchMonitorInstance._core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.\", {\r\n ajaxDiagnosticsMessage: this.getFailedFetchDiagnosticsMessage(input),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n }\r\n return originalFetch(input, init)\r\n .then(function (response) {\r\n fetchMonitorInstance.onFetchComplete(response, fetchData);\r\n return response;\r\n })\r\n .catch(function (reason) {\r\n fetchMonitorInstance.onFetchFailed(input, fetchData, reason);\r\n throw reason;\r\n });\r\n };\r\n this._fetchInitialized = true;\r\n };\r\n AjaxMonitor.prototype.isFetchInstrumented = function (input) {\r\n return this._fetchInitialized && input[DisabledPropertyName] !== true;\r\n };\r\n AjaxMonitor.prototype.supportsFetch = function () {\r\n var result = true;\r\n if (!window || CoreUtils.isNullOrUndefined(window.Request) ||\r\n CoreUtils.isNullOrUndefined(window.Request.prototype) ||\r\n CoreUtils.isNullOrUndefined(window.fetch)) {\r\n result = false;\r\n }\r\n return result;\r\n };\r\n AjaxMonitor.prototype.createFetchRecord = function (input, init) {\r\n /* todo:\r\n Disabling the following block of code as CV is not yet supported in 1DS for 3rd Part.\r\n // this format corresponds with activity logic on server-side and is required for the correct correlation\r\n var id = \"|\" + this.appInsights.context.operation.id + \".\" + Util.newId();\r\n */\r\n var id = Util.newId();\r\n var ajaxData = new ajaxRecord(id, this._core.logger);\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 if (init && init.method) {\r\n ajaxData.method = init.method;\r\n }\r\n else if (input && input instanceof Request) {\r\n ajaxData.method = input.method;\r\n }\r\n else {\r\n ajaxData.method = \"GET\";\r\n }\r\n return ajaxData;\r\n };\r\n AjaxMonitor.prototype.includeCorrelationHeaders = function (ajaxData, input, init, xhr) {\r\n if (input) {\r\n if (CorrelationIdHelper.canIncludeCorrelationHeader(this._config, ajaxData.getAbsoluteUrl(), this.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 init.headers.set(RequestHeaders.requestIdHeader, ajaxData.id);\r\n // let appId: string = this.appInsights.context ? this.appInsights.context.appId() : null;\r\n // if (appId) {\r\n // init.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);\r\n // }\r\n return init;\r\n }\r\n }\r\n else if (xhr) {\r\n if (this.currentWindowHost && CorrelationIdHelper.canIncludeCorrelationHeader(this._config, xhr.ajaxData.getAbsoluteUrl(), this.currentWindowHost)) {\r\n xhr.setRequestHeader(RequestHeaders.requestIdHeader, xhr.ajaxData.id);\r\n var appId = this._config.appId; // Todo: also, get appId from channel as breeze returns it\r\n if (appId) {\r\n xhr.setRequestHeader(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);\r\n }\r\n }\r\n return xhr;\r\n }\r\n return undefined;\r\n };\r\n AjaxMonitor.prototype.getFailedFetchDiagnosticsMessage = function (input) {\r\n var result = \"\";\r\n try {\r\n if (!CoreUtils.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 this._core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedMonitorAjaxOpen, \"Failed to grab failed fetch diagnostics message\", { exception: Util.dump(e) });\r\n }\r\n return result;\r\n };\r\n AjaxMonitor.prototype.onFetchComplete = function (response, ajaxData) {\r\n if (!ajaxData) {\r\n return;\r\n }\r\n try {\r\n ajaxData.responseFinishedTime = DateTimeUtils.Now();\r\n ajaxData.CalculateMetrics();\r\n if (ajaxData.ajaxTotalDuration < 0) {\r\n this._core.logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedMonitorAjaxDur, \"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.\", {\r\n fetchDiagnosticsMessage: this.getFailedFetchDiagnosticsMessage(response),\r\n requestSentTime: ajaxData.requestSentTime,\r\n responseFinishedTime: ajaxData.responseFinishedTime\r\n });\r\n }\r\n else {\r\n var dependency = {\r\n id: ajaxData.id,\r\n absoluteUrl: ajaxData.getAbsoluteUrl(),\r\n commandName: ajaxData.getPathName(),\r\n duration: ajaxData.ajaxTotalDuration,\r\n success: response.status >= 200 && response.status < 400,\r\n resultCode: response.status,\r\n method: ajaxData.method\r\n };\r\n // enrich dependency target with correlation context from the server\r\n var correlationContext = this.getFetchCorrelationContext(response);\r\n if (correlationContext) {\r\n dependency.correlationContext = correlationContext;\r\n }\r\n this.trackDependencyDataInternal(dependency);\r\n }\r\n }\r\n catch (e) {\r\n this._core.logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, \"Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.\", {\r\n fetchDiagnosticsMessage: this.getFailedFetchDiagnosticsMessage(response),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n };\r\n AjaxMonitor.prototype.onFetchFailed = function (input, ajaxData, reason) {\r\n if (!ajaxData) {\r\n return;\r\n }\r\n try {\r\n ajaxData.responseFinishedTime = DateTimeUtils.Now();\r\n ajaxData.CalculateMetrics();\r\n if (ajaxData.ajaxTotalDuration < 0) {\r\n this._core.logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedMonitorAjaxDur, \"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.\", {\r\n fetchDiagnosticsMessage: this.getFailedFetchDiagnosticsMessage(input),\r\n requestSentTime: ajaxData.requestSentTime,\r\n responseFinishedTime: ajaxData.responseFinishedTime\r\n });\r\n }\r\n else {\r\n var dependency = {\r\n id: ajaxData.id,\r\n absoluteUrl: ajaxData.getAbsoluteUrl(),\r\n commandName: ajaxData.getPathName(),\r\n duration: ajaxData.ajaxTotalDuration,\r\n success: false,\r\n resultCode: 0,\r\n method: ajaxData.method\r\n };\r\n this.trackDependencyDataInternal(dependency, { error: reason.message });\r\n }\r\n }\r\n catch (e) {\r\n this._core.logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, \"Failed to calculate the duration of the failed fetch call, monitoring data for this fetch call won't be sent.\", {\r\n fetchDiagnosticsMessage: this.getFailedFetchDiagnosticsMessage(input),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n };\r\n AjaxMonitor.prototype.getFetchCorrelationContext = function (response) {\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 this._core.logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, \"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.\", {\r\n fetchDiagnosticsMessage: this.getFailedFetchDiagnosticsMessage(response),\r\n exception: Util.dump(e)\r\n });\r\n }\r\n };\r\n AjaxMonitor.prototype.instrumentXhr = function () {\r\n if (this.supportsAjaxMonitoring() && !this.initialized) {\r\n this.instrumentOpen();\r\n this.instrumentSend();\r\n this.instrumentAbort();\r\n this.initialized = true;\r\n }\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 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 appId: undefined,\r\n enableCorsCorrelation: false\r\n };\r\n return config;\r\n };\r\n AjaxMonitor.getEmptyConfig = function () {\r\n return {\r\n maxAjaxCallsPerView: undefined,\r\n disableAjaxTracking: undefined,\r\n disableFetchTracking: undefined,\r\n disableCorrelationHeaders: undefined,\r\n correlationHeaderExcludedDomains: undefined,\r\n appId: undefined,\r\n enableCorsCorrelation: undefined\r\n };\r\n };\r\n AjaxMonitor.prototype.initialize = function (config, core, extensions) {\r\n if (!this.initialized && !this._fetchInitialized) {\r\n this._core = core;\r\n var defaultConfig = AjaxMonitor.getDefaultConfig();\r\n this._config = AjaxMonitor.getEmptyConfig();\r\n for (var field in defaultConfig) {\r\n this._config[field] = ConfigurationManager.getConfig(config, field, AjaxMonitor.identifier, defaultConfig[field]);\r\n }\r\n if (this._config.disableAjaxTracking === false) {\r\n this.instrumentXhr();\r\n }\r\n if (this._config.disableFetchTracking === false) {\r\n this.instrumentFetch();\r\n }\r\n }\r\n };\r\n AjaxMonitor.identifier = \"AjaxDependencyPlugin\";\r\n return AjaxMonitor;\r\n}());\r\nexport { AjaxMonitor };\r\n//# sourceMappingURL=ajax.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { AppInsightsCore, LoggingSeverity, _InternalMessageId } from \"@microsoft/applicationinsights-core-js\";\r\nimport { ApplicationInsights } from \"@microsoft/applicationinsights-analytics-js\";\r\nimport { Util, ConfigurationManager } from \"@microsoft/applicationinsights-common\";\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\n\"use strict\";\r\n;\r\nvar propertiesPlugin = \"AppInsightsPropertiesPlugin\";\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 // initialize the queue and config in case they are undefined\r\n snippet.queue = snippet.queue || [];\r\n var config = snippet.config || {};\r\n // ensure instrumentationKey is specified\r\n if (config && !config.instrumentationKey) {\r\n config = snippet;\r\n ApplicationInsights.Version = \"2.0.0\";\r\n }\r\n this.appInsights = new ApplicationInsights();\r\n this.properties = new PropertiesPlugin();\r\n this.dependencies = new DependenciesPlugin();\r\n this.snippet = snippet;\r\n this.config = config;\r\n this.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 {{ [key:string]: any }} [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 * @param {{ [key: string]: any; }} [customProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackPageView = function (pageView, customProperties) {\r\n this.appInsights.trackPageView(pageView, customProperties);\r\n };\r\n /**\r\n * Log a bag of performance information via the customProperties field.\r\n * @param {IPageViewPerformanceTelemetry} pageViewPerformance\r\n * @param {{ [key:string]: any }} [customProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackPageViewPerformance = function (pageViewPerformance, customProperties) {\r\n this.appInsights.trackPageViewPerformance(pageViewPerformance, customProperties);\r\n };\r\n /**\r\n * Log an exception that you have caught.\r\n * @param {IExceptionTelemetry} exception\r\n * @param {{ [key: string]: any; }} [customProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackException = function (exception, customProperties) {\r\n this.appInsights.trackException(exception, customProperties);\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 {{ [key: string]: any; }} [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 {{ [key: string]: any; }} [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 Initialization.prototype.startTrackPage = function (name) {\r\n this.appInsights.startTrackPage(name);\r\n };\r\n Initialization.prototype.stopTrackPage = function (name, url, customProperties) {\r\n this.appInsights.stopTrackPage(name, url, customProperties);\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 `authenicatedUserId` and `accountId` in the curent page view. To set them for the whole sesion, 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.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.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 * @param {{[key: string]: any}} [customProperties]\r\n * @param {{[key: string]: any}} [systemProperties]\r\n * @memberof Initialization\r\n */\r\n Initialization.prototype.trackDependencyData = function (dependency, customProperties) {\r\n this.dependencies.trackDependencyData(dependency, customProperties);\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 if (async === void 0) { async = true; }\r\n this.core.getTransmissionControls().forEach(function (channels) {\r\n channels.forEach(function (channel) {\r\n channel.flush(async);\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 () {\r\n this.core = new AppInsightsCore();\r\n var extensions = [];\r\n var appInsightsChannel = new Sender();\r\n extensions.push(appInsightsChannel);\r\n extensions.push(this.properties);\r\n extensions.push(this.dependencies);\r\n extensions.push(this.appInsights);\r\n // initialize core\r\n this.core.initialize(this.config, extensions);\r\n // Empty queue of all api calls logged prior to sdk download\r\n this.emptyQueue();\r\n this.pollInternalLogs();\r\n this.addHousekeepingBeforeUnload(this);\r\n return this;\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 // call functions that were queued before the main script was loaded\r\n try {\r\n if (Util.isArray(this.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 = this.snippet.queue.length;\r\n for (var i = 0; i < length; i++) {\r\n var call = this.snippet.queue[i];\r\n call();\r\n }\r\n this.snippet.queue = undefined;\r\n delete this.snippet.queue;\r\n }\r\n }\r\n catch (exception) {\r\n var properties = {};\r\n if (exception && typeof exception.toString === \"function\") {\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 (!appInsightsInstance.appInsights.config.disableFlushOnBeforeUnload && ('onbeforeunload' in window)) {\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 an async 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.appInsights.core.getTransmissionControls().forEach(function (queues) {\r\n queues.forEach(function (channel) { return channel.flush(true); });\r\n });\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 // Todo: move this against interface behavior\r\n if (appInsightsInstance.appInsights.core['_extensions'][propertiesPlugin] &&\r\n appInsightsInstance.appInsights.core['_extensions'][propertiesPlugin]._sessionManager) {\r\n appInsightsInstance.appInsights.core['_extensions'][propertiesPlugin]._sessionManager.backup();\r\n }\r\n };\r\n if (!Util.addEventHandler('beforeunload', performHousekeeping)) {\r\n appInsightsInstance.appInsights.core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToAddHandlerForOnBeforeUnload, 'Could not add handler for beforeunload');\r\n }\r\n }\r\n };\r\n Initialization.prototype.getSKUDefaults = function () {\r\n var enableOldTags = ConfigurationManager.getConfig(this.config, \"enableOldTags\", propertiesPlugin, true);\r\n this.config.enableOldTags = enableOldTags;\r\n this.config.diagnosticLogInterval =\r\n this.config.diagnosticLogInterval && this.config.diagnosticLogInterval > 0 ? this.config.diagnosticLogInterval : 10000;\r\n };\r\n return Initialization;\r\n}());\r\nexport { Initialization };\r\n//# sourceMappingURL=Initialization.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Initialization as ApplicationInsights } from \"./Initialization\";\r\nexport { Initialization as ApplicationInsights } from \"./Initialization\";\r\n\"use strict\";\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 var aiName;\r\n if (typeof window !== \"undefined\" && typeof JSON !== \"undefined\") {\r\n // get snippet or initialize to an empty object\r\n // get sdk instance name should not conflict if page uses existing sdk for a layer of instrumentation\r\n aiName = window[\"appInsightsSDK\"];\r\n if (window[aiName] !== undefined) {\r\n if (window[aiName].initialize) {\r\n // this is the typical case for browser+snippet\r\n var snippet = window[aiName] || {};\r\n // overwrite snippet with full appInsights\r\n var initialization = new ApplicationInsights(snippet);\r\n // apply full appInsights to the global instance that was initialized in the snippet\r\n for (var field in initialization) {\r\n snippet[field] = initialization[field];\r\n }\r\n initialization.loadAppInsights();\r\n }\r\n }\r\n }\r\n}\r\ncatch (e) {\r\n // TODO: Find better place to warn to console when SDK initialization fails\r\n if (console) {\r\n console.warn('Failed to initialize AppInsights JS SDK for instance ' + aiName + e.message);\r\n }\r\n}\r\n//# sourceMappingURL=Init.js.map"],"names":["LoggingSeverity","EventsDiscardedReason","CoreUtils","isNullOrUndefined","input","newGuid","replace","GuidRegex","c","r","Math","random","toString","NotificationManager","this","listeners","prototype","addNotificationListener","listener","push","removeNotificationListener","index","indexOf","splice","eventsSent","events","_this","_loop_1","i","this_1","setTimeout","length","eventsDiscarded","reason","_loop_2","this_2","StorageType","FieldType","_InternalMessageId","_InternalLogMessage","msgId","msg","isUserAct","properties","messageId","message","AiUserActionablePrefix","AiNonUserActionablePrefix","diagnosticText","sanitizeDiagnosticText","JSON","stringify","text","dataType","DiagnosticLogger","config","AIInternalMessagePrefix","enableDebugExceptions","consoleLoggingLevel","telemetryLoggingLevel","maxInternalMessageLimit","queue","_messageCount","_messageLogged","loggingLevelConsole","loggingLevelTelemetry","maxMessageLimit","throwInternal","severity","messageKey","WARNING","warnToConsole","logInternalMessage","console","warn","log","resetInternalMessageCount","_areInternalMessagesThrottled","logMessage","throttleLimitMessage","throttleMessage","AppInsightsCore","_isInitialized","_extensions","Array","_channelController","ChannelController","initialize","extensions","Error","instrumentationKey","_notificationManager","extensionConfig","logger","forEach","extension","validationError","isValid_1","item","_a","apply","concat","sort","a","b","extA","extB","typeExtA","processTelemetry","typeExtB","priority","ext","t","identifier","idx","curr","ChannelControllerPriority","setNextPlugin","getTransmissionControls","ChannelControls","track","telemetryItem","_notifiyInvalidEvent","baseData","baseType","timestamp","Date","_validateTelmetryItem","pollInternalLogs","interval","diagnosticLogInterval","setInterval","name","channelQueue","queues","Object","defineProperty","get","enumerable","configurable","core","channels","queueItem","arr","plugin","RequestHeaders","requestContextHeader","requestContextTargetKey","requestContextAppIdFormat","requestIdHeader","sdkContextHeader","sdkContextHeaderAppIdRequest","requestContextHeaderLowerCase","DataSanitizer","sanitizeKeyAndAddUniqueness","key","map","origLength","field","sanitizeKey","uniqueField","undefined","substring","MAX_NAME_LENGTH","padNumber","trim","sanitizeString","value","maxLength","MAX_STRING_LENGTH","sanitizeUrl","url","sanitizeInput","MAX_URL_LENGTH","sanitizeMessage","MAX_MESSAGE_LENGTH","sanitizeException","exception","MAX_EXCEPTION_LENGTH","sanitizeProperties","tempProps","prop","MAX_PROPERTY_LENGTH","sanitizeMeasurements","measurements","tempMeasurements","measure","sanitizeId","id","MAX_ID_LENGTH","_msgId","data","num","s","substr","str","Util","disableStorage","_canUseLocalStorage","_canUseSessionStorage","_getLocalStorageObject","canUseLocalStorage","_getVerifiedStorageObject","LocalStorage","storageType","fail","uid","storage","window","localStorage","sessionStorage","setItem","getItem","removeItem","isInternalApplicationInsightsEndpoint","endpointUrl","_internalEndpoints","toLowerCase","getStorage","e","getExceptionName","dump","setStorage","removeStorage","_getSessionStorageObject","canUseSessionStorage","SessionStorage","getSessionStorageKeys","keys","getSessionStorage","setSessionStorage","removeSessionStorage","disableCookies","_canUseCookies","canUseCookies","document","cookie","setCookie","domain","domainAttrib","secureAttrib","location","protocol","stringToBoolOrDefault","defaultValue","getCookie","cookieName","cookies","split","deleteCookie","newId","result","charAt","floor","isArray","obj","call","isError","isDate","toISOStringForIE8","date","toISOString","pad","String","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","toFixed","slice","getIEVersion","userAgentStr","myNav","navigator","userAgent","parseInt","msToTimeSpan","totalms","isNaN","ms","round","sec","min","hour","days","isCrossOriginError","lineNumber","columnNumber","error","object","objectTypeDump","propertyValueDump","stack","addEventHandler","eventName","callback","verbEventName","addEventListener","IsBeaconApiSupported","sendBeacon","NotSpecified","UrlHelper","parseUrl","htmlAnchorElement","createElement","href","getAbsoluteUrl","getPathName","pathname","getCompleteUrl","method","absoluteUrl","toUpperCase","CorrelationIdHelper","canIncludeCorrelationHeader","requestUrl","currentHost","disableCorrelationHeaders","requestHost","host","enableCorsCorrelation","excludedDomains","correlationHeaderExcludedDomains","RegExp","test","getCorrelationContext","responseHeader","correlationId","getCorrelationContextValue","correlationIdPrefix","keyValues","keyValue","AjaxHelper","ParseDependencyPath","pathName","target","parsedUrl","DateTimeUtils","Now","getTime","performance","now","timing","navigationStart","GetDuration","start","end","DisabledPropertyName","extendStatics","d","setPrototypeOf","__proto__","p","hasOwnProperty","__extends","__","constructor","create","DataPointType","Data","_super","tslib_1.__extends","Envelope","time","aiDataContract","Required","iKey","sampleRate","Hidden","tags","ver","Domain","EventData","Event","Default","envelopeType","StackFrame","ExceptionDetails","hasFullStack","parsedStack","Exception","severityLevel","exceptions","_ExceptionDetails","CreateSimpleException","typeName","assembly","fileName","details","line","ExceptionData","outerId","parseStack","frames","level","totalSizeInBytes","frame","_StackFrame","regex","parsedFrame","sizeInBytes","left","right","size","acceptedLeft","acceptedRight","howMany","matches","match","baseSize","MetricData","metrics","SeverityLevel","DataPoint","arguments","kind","count","max","stdDev","Measurement","Metric","dataPoint","PageViewData","PageView","durationMs","duration","RemoteDependencyData","commandName","success","resultCode","type","dependencyKind","dependencySource","dependencyTypeName","dependencyFields","Trace","MessageData","PageViewPerformance","unused","perfTotal","networkConnect","sentRequest","receivedResponse","domProcessing","isValid","getPerformanceTiming","total","getDuration","loadEventEnd","network","connectEnd","request","requestStart","responseStart","response","responseEnd","dom","shouldCollectDuration","getIsValid","getDurationMs","isPerformanceTimingSupported","isPerformanceTimingDataReady","domainLookupStart","domLoading","durations","_i","botAgentNames","isGoogleBot","i_1","MAX_DURATION_ALLOWED","PageViewPerfData","AIData","ConfigurationManager","getConfig","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","TelemetryItemCreator","envelopeName","customProperties","systemProperties","ctx","partAExtensions","mapTags","UserExtensionName","WebExtensionName","AppExtensionName","accountIdTag","userTagsKeysMap","ctxKeys","authId","localId","userExtKeysMap","PageViewManager","appInsights","overridePageViewDuration","pageViewPerformanceSent","_channel","_logger","trackPageView","pageView","title","uri","sendPageViewInternal","q","flush","pageViewSent","customDuration","handle","clearInterval","pageViewPerformance","sendPageViewPerformanceInternal","CRITICAL","ApplicationInsights","_trackAjaxAttempts","_initialize","bind","getDefaultConfig","sessionRenewalMs","sessionExpirationMs","disableExceptionTracking","autoTrackPageVisitTime","samplingPercentage","isCookieUseDisabled","isStorageUseDisabled","isBrowserLinkTrackingEnabled","env","doNotSendItem","telemetryInitializersCount","_telemetryInitializers","telemetryInitializer","_nextPlugin","next","trackEvent","event","_setTelemetryNameAndIKey","trackTrace","trace","trackMetric","metric","_pageViewManager","_pageVisitTimeManager","trackPreviousPageVisit","trackPageViewPerformance","startTrackPage","_pageTracking","stopTrackPage","stop","trackException","_onerror","URL","_sendCORSException","errorString","addTelemetryInitializer","_globalconfig","defaults","configGetters","accountId","cookieDomain","sdkExtension","appId","_addDefaultTelemetryInitializers","Timing","action","pageViewItem","autoExceptionInstrumented","originalOnError_1","instance_1","onerror","handled","browserLinkPaths_1","_addTelemetryInitializer","envelope","remoteData","iKeyNoDashes","Version","_name","_events","ArraySendBuffer","_config","_buffer","enqueue","payload","clear","getItems","batchPayloads","emitLineDelimitedJson","join","markAsSent","clearSent","SessionStorageSendBuffer","_bufferFullMessageSent","bufferItems","getBuffer","BUFFER_KEY","notDeliveredItems","SENT_BUFFER_KEY","MAX_BUFFER_SIZE","setBuffer","removePayloadsFromBuffer","sentElements","payloads","buffer","remaining","contains","j","bufferJson","parse","EnvelopeCreator","extractProperties","extractPropsAndMeasurements","createEnvelope","extractPartAExtensions","tag","extName","parseProperties","source","ky","val","envKey","DependencyEnvelopeCreator","Create","customMeasurements","bd","command","EventEnvelopeCreator","ExceptionEnvelopeCreator","MetricEnvelopeCreator","average","sampleCount","PageViewEnvelopeCreator","refUri","pageType","isLoggedIn","pageTags","PageViewPerformanceEnvelopeCreator","TraceEnvelopeCreator","EventValidator","Validate","TraceValidator","ExceptionValidator","_validateExceptions","MetricValidator","PageViewPerformanceValidator","PageViewValidator","RemoteDepdencyValidator","Serializer","serialize","output","_serializeObject","circularReferenceCheck","_serializeStringMap","_serializeArray","contract","isRequired","isHidden","isPresent","isObject","sources","expectedType","parseFloat","Offline","OfflineListener","_onlineStatus","isListening","_setOnline","_setOffline","body","ononline","onoffline","isOnline","onLine","isOffline","Sender","_XMLHttpRequestSupported","pause","resume","triggerSend","teardown","_serializer","_consecutiveErrors","_retryAt","_lastSend","_sender","defaultConfig","_getDefaultAppInsightsChannelConfig","_getEmptyAppInsightsChannelConfig","enableSessionStorageBuffer","isBeaconApiDisabled","_beaconSender","XMLHttpRequest","_xhrSender","XDomainRequest","_xdrSender","disableTelemetry","_validate","aiEnvelope","_constructEnvelope","bufferPayload","batch","maxBatchSizeInBytes","_setupTimer","_xhrReadyStateChange","xhr","countOfItemsInPayload","readyState","_appId","_parseResponse","responseText","status","isRetryDisabled","_isRetriable","_resendPayload","_onError","_formatErrorMessageXhr","_onPartialSuccess","_onSuccess","async","clearTimeout","_timeoutHandle","results","failed","retry","errors_1","errors","reverse","extracted","statusCode","itemsAccepted","itemsReceived","_xdrOnLoad","xdr","_formatErrorMessageXdr","resultConfig","maxBatchInterval","isAsync","plainTextBatch","Blob","open","setRequestHeader","onreadystatechange","send","linearFactor","payload_1","_setRetryTime","delayInSeconds","backOffSlot","pow","backOffDelay","retryAfterTimeSpan","retryInterval","timerValue","onload","hostingProtocol","lastIndexOf","Session","_SessionManager","acquisitionSpan","renewalSpan","automaticSession","update","initializeAutomaticSession","acquisitionExpired","acquisitionDate","renewalExpired","renewalDate","isFirst","renew","cookieUpdatedTimestamp","cookieUpdateInterval","backup","initializeAutomaticSessionWithData","sessionData","params","acq","renewal","guid","acquisitionExpiry","renewalExpiry","cookieExpiry","setTime","cookieDomnain","toUTCString","Application","Device","Internal","sdkVersion","Location","Operation","User","userCookieName","cookieSeparator","acqStr","accountAcquisitionDate","newCookie","authCookie","authUserCookieName","authCookieString","decodeURI","authenticatedId","setAuthenticatedUserContext","authenticatedUserId","storeInCookie","validateUserInput","encodeURI","clearAuthenticatedUserContext","HashCodeScoreGenerator","getHashCodeScore","getHashCode","INT_MAX_VALUE","MIN_INPUT_LENGTH","hash","charCodeAt","abs","SamplingScoreGenerator","hashCodeGeneragor","getSamplingScore","tagKeys","Sample","samplingRate","samplingScoreGenerator","isSampledIn","PropertiesPlugin","enableOldTags","_extensionConfig","_sessionManager","application","device","internal","user","operation","session","sample","_processTelemetryInternal","nextPlugin","tagsItem","_applySessionContext","_applyApplicationContext","_applyDeviceContext","_applyInternalContext","_applyLocationContext","_applySampleContext","_applyOperationContext","_applyUserContext","tgs","sessionContext","appContext","build","deviceContext","ip","language","locale","model","oemName","os","osversion","resolution","internalContext","agentVersion","locationContext","sampleContext","operationContext","parentId","rootId","syntheticSource","userContext","agent","storeRegion","ctxExt","XHRMonitoringState","openDone","setRequestHeaderDone","sendDone","abortDone","onreadystatechangeCallbackAttached","ajaxRecord","completed","requestHeadersSize","ttfb","responseReceivingDuration","callbackDuration","ajaxTotalDuration","aborted","pageUrl","requestSize","requestSentTime","responseStartedTime","responseFinishedTime","callbackFinishedTime","endTime","originalOnreadystatechage","xhrMonitoringState","clientFailure","CalculateMetrics","EventHelper","AttachEvent","eventNameWithoutOn","handlerRef","attachEvent","DetachEvent","detachEvent","removeEventListener","AjaxMonitor","currentWindowHost","initialized","_fetchInitialized","isMonitoredInstance","excludeAjaxDataValidation","ajaxData","supportsAjaxMonitoring","abort","instrumentOpen","originalOpen","ajaxMonitorInstance","openHandler","_core","ajaxDiagnosticsMessage","getFailedAjaxDiagnosticsMessage","attachToOnReadyStateChange","instrumentSend","originalSend","content","sendHandler","includeCorrelationHeaders","instrumentAbort","originalAbort","onAjaxComplete","exceptionText","dependency","correlationContext","getAjaxCorrelationContext","trackDependencyDataInternal","responseHeadersString","getAllResponseHeaders","getResponseHeader","maxAjaxCallsPerView","trackDependencyData","instrumentFetch","supportsFetch","originalFetch","fetch","fetchMonitorInstance","init","fetchData","isFetchInstrumented","createFetchRecord","getFailedFetchDiagnosticsMessage","then","onFetchComplete","catch","onFetchFailed","Request","headers","Headers","set","fetchDiagnosticsMessage","getFetchCorrelationContext","instrumentXhr","disableAjaxTracking","disableFetchTracking","getEmptyConfig","propertiesPlugin","Initialization","snippet","dependencies","DependenciesPlugin","getSKUDefaults","channel","loadAppInsights","appInsightsChannel","emptyQueue","addHousekeepingBeforeUnload","appInsightsInstance","disableFlushOnBeforeUnload","aiName","initialization"],"mappings":";;;;4LAKO,ICHIA,EACAA,EDEAC,EAYO,EEddC,EAA2B,WAC3B,SAASA,KAgBT,OAdAA,EAAUC,kBAAoB,SAAUC,GACpC,OAAOA,MAAAA,GAMXF,EAAUG,QAAU,WAChB,MAAO,uCAAuCC,QAAQC,EAAW,SAAUC,GAEvE,IAAIC,EAAqB,GAAhBC,KAAKC,SAAgB,EAC9B,OAD6C,MAANH,EAAYC,EAAQ,EAAJA,EAAU,GACxDG,SAAS,OAGnBV,KAGPK,EAAY,QCpBZM,EAAqC,WACrC,SAASA,IACLC,KAAKC,UAAY,GAsDrB,OAhDAF,EAAoBG,UAAUC,wBAA0B,SAAUC,GAC9DJ,KAAKC,UAAUI,KAAKD,IAMxBL,EAAoBG,UAAUI,2BAA6B,SAAUF,GAEjE,IADA,IAAIG,EAAQP,KAAKC,UAAUO,QAAQJ,IACnB,EAATG,GACHP,KAAKC,UAAUQ,OAAOF,EAAO,GAC7BA,EAAQP,KAAKC,UAAUO,QAAQJ,IAOvCL,EAAoBG,UAAUQ,WAAa,SAAUC,GAQjD,IAPA,IAAIC,EAAQZ,KACRa,EAAU,SAAUC,GAChBC,EAAOd,UAAUa,GAAGJ,YACpBM,WAAW,WAAc,OAAOJ,EAAMX,UAAUa,GAAGJ,WAAWC,IAAY,IAG9EI,EAASf,KACJc,EAAI,EAAGA,EAAId,KAAKC,UAAUgB,SAAUH,EACzCD,EAAQC,IAShBf,EAAoBG,UAAUgB,gBAAkB,SAAUP,EAAQQ,GAQ9D,IAPA,IAAIP,EAAQZ,KACRoB,EAAU,SAAUN,GAChBO,EAAOpB,UAAUa,GAAGI,iBACpBF,WAAW,WAAc,OAAOJ,EAAMX,UAAUa,GAAGI,gBAAgBP,EAAQQ,IAAY,IAG3FE,EA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