Socket
Socket
Sign inDemoInstall

@microsoft/applicationinsights-web-basic

Package Overview
Dependencies
Maintainers
5
Versions
564
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/applicationinsights-web-basic - npm Package Compare versions

Comparing version 1.0.0-beta.4 to 1.0.0-beta.5

browser/aib.1.0.0-beta.5.js

4

browser/aib.1.min.js
/*!
* Application Insights JavaScript Web SDK - Basic, 1.0.0-beta.4
* Application Insights JavaScript Web SDK - Basic, 1.0.0-beta.5
* Copyright (c) Microsoft and contributors. All rights reserved.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.Azure={}))}(this,function(h){"use strict";var e,t=2,p=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),n=/[xy]/g,u=function(){function e(){this.listeners=[]}return e.prototype.addNotificationListener=function(e){this.listeners.push(e)},e.prototype.removeNotificationListener=function(e){for(var t=this.listeners.indexOf(e);-1<t;)this.listeners.splice(t,1),t=this.listeners.indexOf(e)},e.prototype.eventsSent=function(t){for(var n=this,e=function(e){i.listeners[e].eventsSent&&setTimeout(function(){return n.listeners[e].eventsSent(t)},0)},i=this,r=0;r<this.listeners.length;++r)e(r)},e.prototype.eventsDiscarded=function(t,n){for(var i=this,e=function(e){r.listeners[e].eventsDiscarded&&setTimeout(function(){return i.listeners[e].eventsDiscarded(t,n)},0)},r=this,o=0;o<this.listeners.length;++o)e(o)},e}();(e=h.LoggingSeverity||(h.LoggingSeverity={}))[e.CRITICAL=1]="CRITICAL",e[e.WARNING=2]="WARNING";var r,i,m,o,v={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69},s=function(){function o(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?o.AiUserActionablePrefix:o.AiNonUserActionablePrefix)+e;var r=(t?" message:"+o.sanitizeDiagnosticText(t):"")+(i?" props:"+o.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=r}return o.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},o.dataType="MessageData",o.AiNonUserActionablePrefix="AI (Internal): ",o.AiUserActionablePrefix="AI: ",o}(),c=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},p.isNullOrUndefined(e)||(p.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),p.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),p.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),p.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,r){void 0===r&&(r=!1);var o=new s(t,n,r,i);if(this.enableDebugExceptions())throw o;if(void 0!==o&&o&&void 0!==o.message){if(r){var a=+o.messageId;(!this._messageLogged[a]||this.consoleLoggingLevel()>=h.LoggingSeverity.WARNING)&&(this.warnToConsole(o.message),this._messageLogged[a]=!0)}else this.consoleLoggingLevel()>=h.LoggingSeverity.WARNING&&this.warnToConsole(o.message);this.logInternalMessage(e,o)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var r="Internal events throttle limit per PageView reached for this app.",o=new s(v.MessageLimitPerPVExceeded,r,!1);this.queue.push(o),this.warnToConsole(r)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),a=function(){function e(){this._isInitialized=!1,this._extensions=new Array,this._channelController=new l}return e.prototype.initialize=function(e,t){var n=this;if(this._isInitialized)throw Error("Core should not be initialized more than once");if(!e||p.isNullOrUndefined(e.instrumentationKey))throw Error("Please provide instrumentation key");if(this.config=e,this._notificationManager=new u,this.config.extensions=p.isNullOrUndefined(this.config.extensions)?[]:this.config.extensions,this.config.extensionConfig=p.isNullOrUndefined(this.config.extensionConfig)?{}:this.config.extensionConfig,this.config.extensionConfig.NotificationManager=this._notificationManager,this.logger=new c(e),t.forEach(function(e){if(p.isNullOrUndefined(e.initialize))throw Error(f)}),0<this.config.extensions.length){var i=!0;if(this.config.extensions.forEach(function(e){p.isNullOrUndefined(e)&&(i=!1)}),!i)throw Error(f)}(o=this._extensions).push.apply(o,[this._channelController].concat(t,this.config.extensions)),this._extensions=this._extensions.sort(function(e,t){var n=e,i=t,r=typeof n.processTelemetry,o=typeof i.processTelemetry;return"function"===r&&"function"===o?n.priority-i.priority:"function"===r&&"function"!==o?1:"function"!==r&&"function"===o?-1:void 0});var r={};this._extensions.forEach(function(e){var t=e;t&&t.priority&&(p.isNullOrUndefined(r[t.priority])?r[t.priority]=t.identifier:n.logger.warnToConsole("Two extensions have same priority"+r[t.priority]+", "+t.identifier))});for(var o,a=-1,s=0;s<this._extensions.length-1;s++){var l=this._extensions[s];if(!l||"function"==typeof l.processTelemetry){if(l.priority===g){a=s+1;break}this._extensions[s].setNextPlugin(this._extensions[s+1])}}if(this._channelController.initialize(this.config,this,this._extensions),this._extensions.forEach(function(e){e&&e.priority<g&&e.initialize(n.config,n,n._extensions)}),a<this._extensions.length&&this._extensions.splice(a),0===this.getTransmissionControls().length)throw new Error("No channels available");this._isInitialized=!0},e.prototype.getTransmissionControls=function(){return this._channelController.ChannelControls},e.prototype.track=function(e){if(null===e)throw this._notifiyInvalidEvent(e),Error("Invalid telemetry item");if(e.baseData&&!e.baseType)throw this._notifiyInvalidEvent(e),Error("Provide data.baseType for data.baseData");e.baseType||(e.baseType="EventData"),e.instrumentationKey||(e.instrumentationKey=this.config.instrumentationKey),e.timestamp||(e.timestamp=new Date),this._validateTelmetryItem(e);for(var t=0;t<this._extensions.length;){if(this._extensions[t].processTelemetry){this._extensions[t].processTelemetry(e);break}t++}},e.prototype.addNotificationListener=function(e){this._notificationManager.addNotificationListener(e)},e.prototype.removeNotificationListener=function(e){this._notificationManager.removeNotificationListener(e)},e.prototype.pollInternalLogs=function(){var n=this;if(!(0<this.config.diagnosticLoggingInterval))throw Error("config.diagnosticLoggingInterval must be a positive integer");return setInterval(function(){var e=n.logger.queue;e.forEach(function(e){var t={name:"InternalMessageId: "+e.messageId,instrumentationKey:n.config.instrumentationKey,timestamp:new Date,baseType:s.dataType,baseData:{message:e.message}};n.track(t)}),e.length=0},this.config.diagnosticLoggingInterval)},e.prototype._validateTelmetryItem=function(e){if(p.isNullOrUndefined(e.name))throw this._notifiyInvalidEvent(e),Error("telemetry name required");if(p.isNullOrUndefined(e.timestamp))throw this._notifiyInvalidEvent(e),Error("telemetry timestamp required");if(p.isNullOrUndefined(e.instrumentationKey))throw this._notifiyInvalidEvent(e),Error("telemetry instrumentationKey required")},e.prototype._notifiyInvalidEvent=function(e){this._notificationManager.eventsDiscarded([e],t)},e}(),l=function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=g}return e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,i,r){var o=this;if(this.channelQueue=new Array,n.channels)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,r)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);o.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<r.length;t++){var a=r[t];a.priority>g&&e.push(a)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,r)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}},e}(),f="Extensions must provide callback to initialize",g=200;(i=r||(r={}))[i.LocalStorage=0]="LocalStorage",i[i.SessionStorage=1]="SessionStorage",(o=m||(m={}))[o.Default=0]="Default",o[o.Required=1]="Required",o[o.Array=2]="Array",o[o.Hidden=4]="Hidden";var d=function(){function e(){}return e.requestContextHeader="Request-Context",e.requestContextTargetKey="appId",e.requestContextAppIdFormat="appId=cid-v1:",e.requestIdHeader="Request-Id",e.sdkContextHeader="Sdk-Context",e.sdkContextHeaderAppIdRequest="appId",e.requestContextHeaderLowerCase="request-context",e}(),y=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var i=t.length,r=s.sanitizeKey(e,t);if(r.length!==i){for(var o=0,a=r;void 0!==n[a];)o++,a=r.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(o);r=a}return r},s.sanitizeKey=function(e,t){return t&&(t=s.trim(t.toString())).length>s.MAX_NAME_LENGTH&&(t=t.substring(0,s.MAX_NAME_LENGTH),e.throwInternal(h.LoggingSeverity.WARNING,v.NameTooLong,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),t},s.sanitizeString=function(e,t,n){return void 0===n&&(n=s.MAX_STRING_LENGTH),t&&(n=n||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>n&&(t=t.toString().substring(0,n),e.throwInternal(h.LoggingSeverity.WARNING,v.StringValueTooLong,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,v.UrlTooLong)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(h.LoggingSeverity.WARNING,v.MessageTruncated,"message is too long, it has been truncated to "+s.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),t},s.sanitizeException=function(e,t){return t&&t.length>s.MAX_EXCEPTION_LENGTH&&(t=t.substring(0,s.MAX_EXCEPTION_LENGTH),e.throwInternal(h.LoggingSeverity.WARNING,v.ExceptionTruncated,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(e,t){if(t){var n={};for(var i in t){var r=s.sanitizeString(e,t[i],s.MAX_PROPERTY_LENGTH);n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=r}t=n}return t},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var i in t){var r=t[i];n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=r}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,v.IdTooLong).toString():t},s.sanitizeInput=function(e,t,n,i){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(h.LoggingSeverity.WARNING,i,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),t},s.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.MAX_NAME_LENGTH=150,s.MAX_ID_LENGTH=128,s.MAX_PROPERTY_LENGTH=8192,s.MAX_STRING_LENGTH=1024,s.MAX_URL_LENGTH=2048,s.MAX_MESSAGE_LENGTH=32768,s.MAX_EXCEPTION_LENGTH=32768,s}(),_=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(r.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,i=null;try{if("undefined"==typeof window)return null;n=new Date,(i=e===r.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=i.getItem(n)!=n,i.removeItem(n),t&&(i=null)}catch(e){i=null}return i},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(r.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserCannotReadLocalStorage,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var i=s._getLocalStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserCannotWriteLocalStorage,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserFailedRemovalFromLocalStorage,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(r.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(r.SessionStorage)),s._canUseSessionStorage},s.getSessionStorageKeys=function(){var e=[];if(s.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},s.getSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserCannotReadSessionStorage,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var i=s._getSessionStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserCannotWriteSessionStorage,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserFailedRemovalFromSessionStorage,"Browser failed removal of session storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.disableCookies=function(){s._canUseCookies=!1},s.canUseCookies=function(t){if(void 0===s._canUseCookies){s._canUseCookies=!1;try{s._canUseCookies=void 0!==s.document.cookie}catch(e){t.throwInternal(h.LoggingSeverity.WARNING,v.CannotAccessCookie,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,i){var r="",o="";i&&(r=";domain="+i),s.document.location&&"https:"===s.document.location.protocol&&(o=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+r+";path=/"+o)},s.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},s.getCookie=function(e,t){if(s.canUseCookies(e)){var n="";if(t&&t.length)for(var i=t+"=",r=s.document.cookie.split(";"),o=0;o<r.length;o++){var a=r[o];if((a=s.trim(a))&&0===a.indexOf(i)){n=a.substring(i.length,r[o].length);break}}return n}},s.deleteCookie=function(e,t){s.canUseCookies(e)&&(s.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.newId=function(){for(var e="",t=1073741824*Math.random();0<t;){e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64)}return e},s.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},s.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},s.toISOStringForIE8=function(e){if(s.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},s.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},s.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,i=""+Math.floor(e/6e4)%60,r=""+Math.floor(e/36e5)%24,o=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,i=i.length<2?"0"+i:i,(0<o?o+".":"")+(r=r.length<2?"0"+r:r)+":"+i+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,i,r){return("Script error."===e||"Script error"===e)&&!r},s.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},s.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},s.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},s.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},s.document="undefined"!=typeof document?document:{},s._canUseCookies=void 0,s._canUseLocalStorage=void 0,s._canUseSessionStorage=void 0,s._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],s.NotSpecified="not_specified",s}(),S=function(){function i(){}return i.parseUrl=function(e){return i.htmlAnchorElement||(i.htmlAnchorElement=i.document.createElement?i.document.createElement("a"):{}),i.htmlAnchorElement.href=e,i.htmlAnchorElement},i.getAbsoluteUrl=function(e){var t,n=i.parseUrl(e);return n&&(t=n.href),t},i.getPathName=function(e){var t,n=i.parseUrl(e);return n&&(t=n.pathname),t},i.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},i.document="undefined"!=typeof document?document:{},i}(),I=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,i){var r,o;if(t&&0<t.length){var a=S.parseUrl(t);if(r=a.host,null!=a.pathname)"/"!==(i=0===a.pathname.length?"/":a.pathname).charAt(0)&&(i="/"+i),o=y.sanitizeString(e,n?n+" "+i:i);else o=y.sanitizeString(e,t)}else o=r=i;return{target:r,name:o}},e}(),E=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||p.isNullOrUndefined(e)||p.isNullOrUndefined(t)||(n=t-e),n}}(),function(e,t){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)});function T(e,t){function n(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var w,b,C=function(e){function t(){return e.call(this)||this}return T(t,e),t}(function(){}),N=function(r){function e(e,t,n){var i=r.call(this)||this;return i.name=y.sanitizeString(e,n)||_.NotSpecified,i.data=t,i.time=_.toISOStringForIE8(new Date),i.aiDataContract={time:m.Required,iKey:m.Required,name:m.Required,sampleRate:function(){return 100==i.sampleRate?m.Hidden:m.Required},tags:m.Required,data:m.Required},i}return T(e,r),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),x=function(){},A=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return T(e,t),e}(x),L=function(o){function e(e,t,n,i){var r=o.call(this)||this;return r.aiDataContract={ver:m.Required,name:m.Required,properties:m.Default,measurements:m.Default},r.name=y.sanitizeString(e,t)||_.NotSpecified,r.properties=y.sanitizeProperties(e,n),r.measurements=y.sanitizeMeasurements(e,i),r}return T(e,o),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(A),D=function(){},R=function(){this.hasFullStack=!0,this.parsedStack=[]},M=function(a){function e(e,t,n,i,r){var o=a.call(this)||this;return o.aiDataContract={ver:m.Required,exceptions:m.Required,severityLevel:m.Default,properties:m.Default,measurements:m.Default},o.properties=y.sanitizeProperties(e,n),o.measurements=y.sanitizeMeasurements(e,i),o.exceptions=[new O(e,t)],r&&(o.severityLevel=r),o}return T(e,a),e.CreateSimpleException=function(e,t,n,i,r,o){return{exceptions:[{hasFullStack:!0,message:e,stack:r,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return T(e,t),e}(x)),O=function(r){function e(e,t){var n=r.call(this)||this;n.aiDataContract={id:m.Default,outerId:m.Default,typeName:m.Required,message:m.Required,hasFullStack:m.Default,stack:m.Default,parsedStack:m.Array},n.typeName=y.sanitizeString(e,t.name)||_.NotSpecified,n.message=y.sanitizeMessage(e,t.message)||_.NotSpecified;var i=t.stack;return n.parsedStack=n.parseStack(i),n.stack=y.sanitizeException(e,i),n.hasFullStack=_.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return T(e,r),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var i=0,r=0,o=0;o<=n.length;o++){var a=n[o];if(U.regex.test(a)){var s=new U(n[o],i++);r+=s.sizeInBytes,t.push(s)}}if(32768<r)for(var l=0,u=t.length-1,c=0,f=l,g=u;l<u;){if(32768<(c+=t[l].sizeInBytes+t[u].sizeInBytes)){var d=g-f+1;t.splice(f,d);break}f=l,g=u,l++,u--}}return t},e}(R),U=function(r){function o(e,t){var n=r.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:m.Required,method:m.Required,assembly:m.Default,fileName:m.Default,line:m.Default},n.level=t,n.method="<no_method>",n.assembly=_.trim(e);var i=e.match(o.regex);return i&&5<=i.length&&(n.method=_.trim(i[2])||n.method,n.fileName=_.trim(i[4]),n.line=parseInt(i[5])||0),n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=o.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}return T(o,r),o.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,o.baseSize=58,o}(D),F=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return T(e,t),e}(x);(b=w||(w={}))[b.Measurement=0]="Measurement",b[b.Aggregation=1]="Aggregation";var P,z,B=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:m.Required,kind:m.Default,value:m.Required,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default},e}return T(e,t),e}(function(){this.kind=w.Measurement}),k=function(u){function e(e,t,n,i,r,o,a){var s=u.call(this)||this;s.aiDataContract={ver:m.Required,metrics:m.Required,properties:m.Default};var l=new B;return l.count=0<i?i:void 0,l.max=isNaN(o)||null===o?void 0:o,l.min=isNaN(r)||null===r?void 0:r,l.name=y.sanitizeString(e,t)||_.NotSpecified,l.value=n,s.metrics=[l],s.properties=y.sanitizeProperties(e,a),s}return T(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(F),q=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return T(e,t),e}(A),V=function(l){function e(e,t,n,i,r,o,a){var s=l.call(this)||this;return s.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,properties:m.Default,measurements:m.Default,id:m.Default},s.id=y.sanitizeId(e,a),s.url=y.sanitizeUrl(e,n),s.name=y.sanitizeString(e,t)||_.NotSpecified,isNaN(i)||(s.duration=_.msToTimeSpan(i)),s.properties=y.sanitizeProperties(e,r),s.measurements=y.sanitizeMeasurements(e,o),s}return T(e,l),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(q),G=function(g){function e(e,t,n,i,r,o,a,s,l,u){var c=g.call(this)||this;c.aiDataContract={id:m.Required,ver:m.Required,name:m.Default,resultCode:m.Default,duration:m.Default,success:m.Default,data:m.Default,target:m.Default,type:m.Default,properties:m.Default,measurements:m.Default,kind:m.Default,value:m.Default,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default,dependencyKind:m.Default,dependencySource:m.Default,commandName:m.Default,dependencyTypeName:m.Default},c.id=t,c.duration=_.msToTimeSpan(r),c.success=o,c.resultCode=a+"",c.type="Ajax",c.data=y.sanitizeUrl(e,i);var f=I.ParseDependencyPath(e,n,s,i);return c.target=f.target,c.name=f.name,c.properties=y.sanitizeProperties(e,l),c.measurements=y.sanitizeMeasurements(e,u),c}return T(e,g),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return T(e,t),e}(x)),j=function(o){function e(e,t,n,i){var r=o.call(this)||this;return r.aiDataContract={ver:m.Required,message:m.Required,severityLevel:m.Default,properties:m.Default},t=t||_.NotSpecified,r.message=y.sanitizeMessage(e,t),r.properties=y.sanitizeProperties(e,n),i&&(r.severityLevel=i),r}return T(e,o),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return T(e,t),e}(x)),X=function(d){function p(e,t,n,i,r,o){var a=d.call(this)||this;a.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,perfTotal:m.Default,networkConnect:m.Default,sentRequest:m.Default,receivedResponse:m.Default,domProcessing:m.Default,properties:m.Default,measurements:m.Default},a.isValid=!1;var s=p.getPerformanceTiming();if(s){var l=p.getDuration(s.navigationStart,s.loadEventEnd),u=p.getDuration(s.navigationStart,s.connectEnd),c=p.getDuration(s.requestStart,s.responseStart),f=p.getDuration(s.responseStart,s.responseEnd),g=p.getDuration(s.responseEnd,s.loadEventEnd);0==l?e.throwInternal(h.LoggingSeverity.WARNING,v.ErrorPVCalc,"error calculating page view performance.",{total:l,network:u,request:c,response:f,dom:g}):p.shouldCollectDuration(l,u,c,f,g)?l<Math.floor(u)+Math.floor(c)+Math.floor(f)+Math.floor(g)?e.throwInternal(h.LoggingSeverity.WARNING,v.ClientPerformanceMathError,"client performance math error.",{total:l,network:u,request:c,response:f,dom:g}):(a.durationMs=l,a.perfTotal=a.duration=_.msToTimeSpan(l),a.networkConnect=_.msToTimeSpan(u),a.sentRequest=_.msToTimeSpan(c),a.receivedResponse=_.msToTimeSpan(f),a.domProcessing=_.msToTimeSpan(g),a.isValid=!0):e.throwInternal(h.LoggingSeverity.WARNING,v.InvalidDurationValue,"Invalid page load duration value. Browser perf data won't be sent.",{total:l,network:u,request:c,response:f,dom:g})}return a.url=y.sanitizeUrl(e,n),a.name=y.sanitizeString(e,t)||_.NotSpecified,a.properties=y.sanitizeProperties(e,r),a.measurements=y.sanitizeMeasurements(e,o),a}return T(p,d),p.prototype.getIsValid=function(){return this.isValid},p.prototype.getDurationMs=function(){return this.durationMs},p.getPerformanceTiming=function(){return p.isPerformanceTimingSupported()?window.performance.timing:null},p.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},p.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},p.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},p.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],i=navigator.userAgent,r=!1;if(i)for(var o=0;o<n.length;o++)r=r||-1!==i.toLowerCase().indexOf(n[o]);if(r)return!1;for(var a=0;a<e.length;a++)if(e[a]>=p.MAX_DURATION_ALLOWED)return!1;return!0},p.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",p.dataType="PageviewPerformanceData",p.MAX_DURATION_ALLOWED=36e5,p}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return T(e,t),e}(q)),H=function(i){function e(e,t){var n=i.call(this)||this;return n.aiDataContract={baseType:m.Required,baseData:m.Required},n.baseType=e,n.baseData=t,n}return T(e,i),e}(C);(z=P||(P={}))[z.Verbose=0]="Verbose",z[z.Information=1]="Information",z[z.Warning=2]="Warning",z[z.Error=3]="Error",z[z.Critical=4]="Critical";var W=function(){function e(e){this._config=e,this._buffer=[]}return e.prototype.enqueue=function(e){this._buffer.push(e)},e.prototype.count=function(){return this._buffer.length},e.prototype.clear=function(){this._buffer.length=0},e.prototype.getItems=function(){return this._buffer.slice(0)},e.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},e.prototype.markAsSent=function(e){this.clear()},e.prototype.clearSent=function(e){},e}(),K=function(){function r(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(r.BUFFER_KEY),i=this.getBuffer(r.SENT_BUFFER_KEY);this._buffer=n.concat(i),this._buffer.length>r.MAX_BUFFER_SIZE&&(this._buffer.length=r.MAX_BUFFER_SIZE),this.setBuffer(r.SENT_BUFFER_KEY,[]),this.setBuffer(r.BUFFER_KEY,this._buffer)}return r.prototype.enqueue=function(e){this._buffer.length>=r.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(this._logger.throwInternal(h.LoggingSeverity.WARNING,v.SessionStorageBufferFull,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(e),this.setBuffer(r.BUFFER_KEY,this._buffer))},r.prototype.count=function(){return this._buffer.length},r.prototype.clear=function(){this._buffer.length=0,this.setBuffer(r.BUFFER_KEY,[]),this.setBuffer(r.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},r.prototype.getItems=function(){return this._buffer.slice(0)},r.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},r.prototype.markAsSent=function(e){this._buffer=this.removePayloadsFromBuffer(e,this._buffer),this.setBuffer(r.BUFFER_KEY,this._buffer);var t=this.getBuffer(r.SENT_BUFFER_KEY);t instanceof Array&&e instanceof Array&&((t=t.concat(e)).length>r.MAX_BUFFER_SIZE&&(this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.SessionStorageBufferFull,"Sent buffer reached its maximum size: "+t.length,!0),t.length=r.MAX_BUFFER_SIZE),this.setBuffer(r.SENT_BUFFER_KEY,t))},r.prototype.clearSent=function(e){var t=this.getBuffer(r.SENT_BUFFER_KEY);t=this.removePayloadsFromBuffer(e,t),this.setBuffer(r.SENT_BUFFER_KEY,t)},r.prototype.removePayloadsFromBuffer=function(e,t){var n=[];for(var i in t){var r=!1;for(var o in e)if(e[o]===t[i]){r=!0;break}r||n.push(t[i])}return n},r.prototype.getBuffer=function(t){try{var e=_.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.FailedToRestoreStorageBuffer," storage key: "+t+", "+_.getExceptionName(e),{exception:_.dump(e)})}return[]},r.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);_.setSessionStorage(this._logger,t,n)}catch(e){_.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(h.LoggingSeverity.WARNING,v.FailedToSetStorageBuffer," storage key: "+t+", "+_.getExceptionName(e)+". Buffer cleared",{exception:_.dump(e)})}},r.BUFFER_KEY="AI_buffer",r.SENT_BUFFER_KEY="AI_sentBuffer",r.MAX_BUFFER_SIZE=2e3,r}(),Y=["ai.application.ver","ai.application.build","ai.application.typeId","ai.application.applicationId","ai.application.layer","ai.device.id","ai.device.ip","ai.device.language","ai.device.locale","ai.device.model","ai.device.friendlyName","ai.device.network","ai.device.networkName","ai.device.oemName","ai.device.os","ai.device.osVersion","ai.device.roleInstance","ai.device.roleName","ai.device.screenResolution","ai.device.type","ai.device.machineName","ai.device.vmName","ai.device.browser","ai.device.browserVersion","ai.location.ip","ai.location.country","ai.location.province","ai.location.city","ai.operation.id","ai.operation.name","ai.operation.parentId","ai.operation.rootId","ai.operation.syntheticSource","ai.operation.correlationVector","ai.session.id","ai.session.isFirst","ai.session.isNew","ai.user.accountAcquisitionDate","ai.user.accountId","ai.user.userAgent","ai.user.id","ai.user.storeRegion","ai.user.authUserId","ai.user.anonUserAcquisitionDate","ai.user.authUserAcquisitionDate","ai.cloud.name","ai.cloud.role","ai.cloud.roleVer","ai.cloud.roleInstance","ai.cloud.environment","ai.cloud.location","ai.cloud.deploymentUnit","ai.internal.sdkVersion","ai.internal.agentVersion","ai.internal.nodeName"],J=function(){function e(){}return e.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];"number"!=typeof i&&(t||(t={}),t[n]=i)}return t},e.extractPropsAndMeasurements=function(e,t,n){if(!p.isNullOrUndefined(e))for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];"number"==typeof r?n[i]=r:t[i]=r}},e.createEnvelope=function(e,t,n,i){var r=new N(e,i,t);r.iKey=n.instrumentationKey;var o=n.instrumentationKey.replace(/-/g,"");for(var a in r.name=r.name.replace("{0}",o),n.ctx)n.ctx.hasOwnProperty(a)&&0<=Y.indexOf(a)&&(r.tags[a]=n.ctx[a]);return n.tags||(n.tags=[]),n.tags.forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&0<=Y.indexOf(t)&&(r.tags[t]=e[t])}),r},e}(),Z=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n={},i={};J.extractPropsAndMeasurements(t.data,i,n);var r=t.baseData;if(p.isNullOrUndefined(r))return e.warnToConsole("Invalid input for dependency data"),null;var o=r.id,a=r.absoluteUrl,s=r.commandName,l=r.duration,u=r.success,c=r.resultCode,f=r.method,g=new G(e,o,a,s,l,u,c,f,i,n),d=new H(G.dataType,g);return J.createEnvelope(e,G.envelopeType,t,d)},t.DependencyEnvelopeCreator=new t,t}(J),Q=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n={},i={};t.baseType!==L.dataType&&J.extractPropsAndMeasurements(t.baseData,n,i),J.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.name,o=new L(e,r,n,i),a=new H(L.dataType,o);return J.createEnvelope(e,L.envelopeType,t,a)},t.EventEnvelopeCreator=new t,t}(J),$=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n={},i={};J.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.error,o=t.baseData.severityLevel,a=new M(e,r,n,i,o),s=new H(M.dataType,a);return J.createEnvelope(e,M.envelopeType,t,s)},t.ExceptionEnvelopeCreator=new t,t}(J),ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n=J.extractProperties(t.data),i=t.baseData.name,r=t.baseData.average,o=t.baseData.sampleCount,a=t.baseData.min,s=t.baseData.max,l=new k(e,i,r,o,a,s,n),u=new H(k.dataType,l);return J.createEnvelope(e,k.envelopeType,t,u)},t.MetricEnvelopeCreator=new t,t}(J),te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n=void 0;p.isNullOrUndefined(t.data)||p.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration);var i={},r={};J.extractPropsAndMeasurements(t.data,i,r);var o=t.baseData.name,a=t.baseData.uri;if(p.isNullOrUndefined(t.baseData.refUri)||(i.refUri=t.baseData.refUri),p.isNullOrUndefined(t.baseData.pageType)||(i.pageType=t.baseData.pageType),p.isNullOrUndefined(t.baseData.isLoggedIn)||(i.isLoggedIn=t.baseData.isLoggedIn),!p.isNullOrUndefined(t.baseData.pageTags)){var s=t.baseData.pageTags;for(var l in s)s.hasOwnProperty(l)&&(i[l]=s[l])}var u=new V(e,o,a,n,i,r),c=new H(V.dataType,u);return J.createEnvelope(e,V.envelopeType,t,c)},t.PageViewEnvelopeCreator=new t,t}(J),ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n={},i={};J.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.name,o=t.baseData.uri,a=t.baseData.duration,s=new X(e,r,o,a,n,i),l=new H(X.dataType,s);return J.createEnvelope(e,X.envelopeType,t,l)},t.PageViewPerformanceEnvelopeCreator=new t,t}(J),ie=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,i=t.baseData.severityLevel,r=J.extractProperties(t.data),o=new j(e,n,r,i),a=new H(j.dataType,o);return J.createEnvelope(e,j.envelopeType,t,a)},t.TraceEnvelopeCreator=new t,t}(J),re=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),ae=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),se=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),ce=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),fe=function(){function e(e){this._logger=e}return e.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},e.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",i={};if(!e)return this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.CannotSerializeObject,"cannot serialize object because it is null or undefined",{name:t},!0),i;if(e[n])return this._logger.throwInternal(h.LoggingSeverity.WARNING,v.CircularReferenceDetected,"Circular reference detected while serializing object",{name:t},!0),i;if(!e.aiDataContract){if("measurements"===t)i=this._serializeStringMap(e,"number",t);else if("properties"===t)i=this._serializeStringMap(e,"string",t);else if("tags"===t)i=this._serializeStringMap(e,"string",t);else if(_.isArray(e))i=this._serializeArray(e,t);else{this._logger.throwInternal(h.LoggingSeverity.WARNING,v.CannotSerializeObjectNonSerializable,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),i=e}catch(e){this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.CannotSerializeObject,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return i}for(var r in e[n]=!0,e.aiDataContract){var o,a=e.aiDataContract[r],s="function"==typeof a?a()&m.Required:a&m.Required,l="function"==typeof a?a()&m.Hidden:a&m.Hidden,u=a&m.Array,c=void 0!==e[r],f="object"==typeof e[r]&&null!==e[r];if(!s||c||u){if(!l)void 0!==(o=f?u?this._serializeArray(e[r],r):this._serializeObject(e[r],r):e[r])&&(i[r]=o)}else this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.MissingRequiredFieldSpecification,"Missing required field specification. The field is required but not present on source",{field:r,name:t})}return delete e[n],i},e.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(_.isArray(e)){n=[];for(var i=0;i<e.length;i++){var r=e[i],o=this._serializeObject(r,t+"["+i+"]");n.push(o)}}else this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.ItemNotInArray,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},e.prototype._serializeStringMap=function(e,t,n){var i=void 0;if(e)for(var r in i={},e){var o=e[r];if("string"===t)void 0===o?i[r]="undefined":null===o?i[r]="null":o.toString?i[r]=o.toString():i[r]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===o)i[r]="undefined";else if(null===o)i[r]="null";else{var a=parseFloat(o);isNaN(a)?i[r]="NaN":i[r]=a}else i[r]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(h.LoggingSeverity.CRITICAL,i[r],null,!0)}return i},e}(),ge=function(){function e(){this._onlineStatus=!0,"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,de=function(){function o(){this.priority=201,this._XMLHttpRequestSupported=!1}return o.prototype.pause=function(){throw new Error("Method not implemented.")},o.prototype.resume=function(){throw new Error("Method not implemented.")},o.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.FlushFailed,"flush failed, telemetry will not be collected: "+_.getExceptionName(e),{exception:_.dump(e)})}},o.prototype.teardown=function(){throw new Error("Method not implemented.")},o.prototype.initialize=function(e,t,n){(this.identifier="AppInsightsChannelPlugin",this._logger=t.logger,this._serializer=new fe(t.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._config=o._getDefaultAppInsightsChannelConfig(e,this.identifier),this._sender=null,this._buffer=_.canUseSessionStorage()&&this._config.enableSessionStorageBuffer?new K(this._logger,this._config):new W(this._config),!this._config.isBeaconApiDisabled()&&_.IsBeaconApiSupported())?this._sender=this._beaconSender:"undefined"!=typeof XMLHttpRequest&&("withCredentials"in new XMLHttpRequest?(this._sender=this._xhrSender,this._XMLHttpRequestSupported=!0):"undefined"!=typeof XDomainRequest&&(this._sender=this._xdrSender))},o.prototype.processTelemetry=function(e){try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.CannotSendEmptyTelemetry,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.SenderNotInitialized,"Sender was not initialized");if(!o._validate(e))return void this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"Invalid telemetry envelope");var t=this._constructEnvelope(e);if(!t)return void this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.CreateEnvelopeError,"Unable to create an AppInsights envelope");var n=this._serializer.serialize(t),i=this._buffer.getItems(),r=this._buffer.batchPayloads(i);r&&r.length+n.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(n),this._setupTimer()}catch(e){this._logger.throwInternal(h.LoggingSeverity.WARNING,v.FailedAddingTelemetryToBuffer,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+_.getExceptionName(e),{exception:_.dump(e)})}p.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},o.prototype.setNextPlugin=function(e){this._nextPlugin=e},o.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var i=null;if(this._appId||(i=this._parseResponse(e.responseText||e.response))&&i.appId&&(this._appId=i.appId),(e.status<200||300<=e.status)&&0!==e.status)!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(h.LoggingSeverity.WARNING,v.TransmissionFailed,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(0===e.status||ge.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(h.LoggingSeverity.WARNING,v.TransmissionFailed,". Offline - Response Code: "+e.status+". Offline status: "+ge.isOffline()+". Will retry to send "+t.length+" items.")}}else 206===e.status?(i||(i=this._parseResponse(e.responseText||e.response)),i&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,i):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},o.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!_.getIEVersion()||9<_.getIEVersion())&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TransmissionFailed,"Telemetry transmission failed, some telemetry will be lost: "+_.getExceptionName(e),{exception:_.dump(e)})}},o.prototype._onError=function(e,t,n){this._logger.throwInternal(h.LoggingSeverity.WARNING,v.OnError,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},o.prototype._onPartialSuccess=function(e,t){for(var n=[],i=[],r=0,o=t.errors.reverse();r<o.length;r++){var a=o[r],s=e.splice(a.index,1)[0];this._isRetriable(a.statusCode)?i.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<i.length&&(this._resendPayload(i),this._logger.throwInternal(h.LoggingSeverity.WARNING,v.TransmissionFailed,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+i.length+" our of "+t.itemsReceived+" items"))},o.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},o.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},o.prototype._constructEnvelope=function(e){switch(e.baseType){case L.dataType:return Q.EventEnvelopeCreator.Create(this._logger,e);case j.dataType:return ie.TraceEnvelopeCreator.Create(this._logger,e);case V.dataType:return te.PageViewEnvelopeCreator.Create(this._logger,e);case X.dataType:return ne.PageViewPerformanceEnvelopeCreator.Create(this._logger,e);case M.dataType:return $.ExceptionEnvelopeCreator.Create(this._logger,e);case k.dataType:return ee.MetricEnvelopeCreator.Create(this._logger,e);case G.dataType:return Z.DependencyEnvelopeCreator.Create(this._logger,e);default:return Q.EventEnvelopeCreator.Create(this._logger,e)}},o._getDefaultAppInsightsChannelConfig=function(e,t){var n={},i=e.extensionConfig&&e.extensionConfig[t]?e.extensionConfig[t]:{};return n.endpointUrl=function(){return e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},n.emitLineDelimitedJson=function(){return _.stringToBoolOrDefault(i.emitLineDelimitedJson)},n.maxBatchInterval=function(){return isNaN(i.maxBatchInterval)?15e3:i.maxBatchInterval},n.maxBatchSizeInBytes=function(){return 0<i.maxBatchSizeInBytes?i.maxBatchSizeInBytes:102400},n.disableTelemetry=function(){return _.stringToBoolOrDefault(i.disableTelemetry)},n.enableSessionStorageBuffer=function(){return _.stringToBoolOrDefault(i.enableSessionStorageBuffer,!0)},n.isRetryDisabled=function(){return _.stringToBoolOrDefault(i.isRetryDisabled)},n.isBeaconApiDisabled=function(){return _.stringToBoolOrDefault(i.isBeaconApiDisabled,!0)},n},o._validate=function(e){switch(e.baseType){case L.dataType:return re.EventValidator.Validate(e);case j.dataType:return oe.TraceValidator.Validate(e);case M.dataType:return ae.ExceptionValidator.Validate(e);case k.dataType:return se.MetricValidator.Validate(e);case V.dataType:return ue.PageViewValidator.Validate(e);case X.dataType:return le.PageViewPerformanceValidator.Validate(e);case G.dataType:return ce.RemoteDepdencyValidator.Validate(e);default:return re.EventValidator.Validate(e)}},o.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),i=this._buffer.batchPayloads(e),r=new Blob([i],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,r)?this._buffer.markAsSent(e):this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TransmissionFailed,". Failed to send telemetry with Beacon API.")},o.prototype._xhrSender=function(t,e){var n=this,i=new XMLHttpRequest;i.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,i.open("POST",this._config.endpointUrl(),e),i.setRequestHeader("Content-type","application/json"),_.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&i.setRequestHeader(d.sdkContextHeader,d.sdkContextHeaderAppIdRequest),i.onreadystatechange=function(){return n._xhrReadyStateChange(i,t,t.length)},i.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(i),e)};var r=this._buffer.batchPayloads(t);i.send(r),this._buffer.markAsSent(t)},o.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.InvalidBackendResponse,"Cannot parse the response. "+_.getExceptionName(e),{response:t})}return null},o.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,i=e;n<i.length;n++){var r=i[n];this._buffer.enqueue(r)}this._setRetryTime(t),this._setupTimer()}},o.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,i=Math.floor(Math.random()*n*10)+1;i*=e,t=Math.max(Math.min(i,3600),10)}var r=Date.now()+1e3*t;this._retryAt=r},o.prototype._setupTimer=function(){var e=this;if(!this._timeoutHandle){var t=this._retryAt?Math.max(0,this._retryAt-Date.now()):0,n=Math.max(this._config.maxBatchInterval(),t);this._timeoutHandle=setTimeout(function(){e.triggerSend()},n)}},o.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},o.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},o.prototype._xdrSender=function(t,e){var n=this,i=new XDomainRequest;i.onload=function(){return n._xdrOnLoad(i,t)},i.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(i),e)};var r=window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(r,0))return this._logger.throwInternal(h.LoggingSeverity.WARNING,v.TransmissionFailed,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var o=this._config.endpointUrl().replace(/^(https?:)/,"");i.open("POST",o);var a=this._buffer.batchPayloads(t);i.send(a),this._buffer.markAsSent(t)},o.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},o}(),pe=function(){function e(e){if(p.isNullOrUndefined(e)||p.isNullOrUndefined(e.instrumentationKey))throw new Error("Invalid input configuration");this.config=e,this.initialize()}return e.prototype.initialize=function(){this.core=new a;var e=[],t=new de;e.push(t),this.core.initialize(this.config,e),t.initialize(this.config,this.core,e)},e.prototype.track=function(e){this.core.track(e)},e.prototype.flush=function(t){void 0===t&&(t=!0),this.core.getTransmissionControls().forEach(function(e){e.forEach(function(e){t?e.flush():e.triggerSend(t)})})},e}();h.ApplicationInsights=pe,h.AppInsightsCore=a,h._InternalMessageId=v,h.CoreUtils=p,Object.defineProperty(h,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.Microsoft={})}(this,function(e){"use strict";var g,t,n=2,h=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(i,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),i=/[xy]/g,l=function(){function e(){this.listeners=[]}return e.prototype.addNotificationListener=function(e){this.listeners.push(e)},e.prototype.removeNotificationListener=function(e){for(var t=this.listeners.indexOf(e);-1<t;)this.listeners.splice(t,1),t=this.listeners.indexOf(e)},e.prototype.eventsSent=function(t){for(var n=this,e=function(e){i.listeners[e].eventsSent&&setTimeout(function(){return n.listeners[e].eventsSent(t)},0)},i=this,r=0;r<this.listeners.length;++r)e(r)},e.prototype.eventsDiscarded=function(t,n){for(var i=this,e=function(e){r.listeners[e].eventsDiscarded&&setTimeout(function(){return i.listeners[e].eventsDiscarded(t,n)},0)},r=this,o=0;o<this.listeners.length;++o)e(o)},e}();(t=g||(g={}))[t.CRITICAL=1]="CRITICAL",t[t.WARNING=2]="WARNING";var r,o,m,a,u=1,c=2,f=3,p=4,d=5,v=6,s=7,y=8,_=10,I=12,S=22,w=23,E=24,b=26,T=28,N=40,x=41,D=42,C=43,A=45,R=46,L=47,M=48,U=49,O=50,P=52,z=54,B=56,q=57,k=61,F=66,G=67,V=68,X=69,H=function(){function o(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?o.AiUserActionablePrefix:o.AiNonUserActionablePrefix)+e;var r=(t?" message:"+o.sanitizeDiagnosticText(t):"")+(i?" props:"+o.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=r}return o.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},o.dataType="MessageData",o.AiNonUserActionablePrefix="AI (Internal): ",o.AiUserActionablePrefix="AI: ",o}(),j=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},h.isNullOrUndefined(e)||(h.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),h.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),h.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),h.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,r){void 0===r&&(r=!1);var o=new H(t,n,r,i);if(this.enableDebugExceptions())throw o;if(void 0!==o&&o&&void 0!==o.message){if(r){var a=+o.messageId;(!this._messageLogged[a]||this.consoleLoggingLevel()>=g.WARNING)&&(this.warnToConsole(o.message),this._messageLogged[a]=!0)}else this.consoleLoggingLevel()>=g.WARNING&&this.warnToConsole(o.message);this.logInternalMessage(e,o)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var r="Internal events throttle limit per PageView reached for this app.",o=new H(w,r,!1);this.queue.push(o),this.warnToConsole(r)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),W=function(){function e(){this._isInitialized=!1,this._extensions=new Array,this._channelController=new K}return e.prototype.initialize=function(e,t){var n=this;if(this._isInitialized)throw Error("Core should not be initialized more than once");if(!e||h.isNullOrUndefined(e.instrumentationKey))throw Error("Please provide instrumentation key");if(this.config=e,this._notificationManager=new l,this.config.extensions=h.isNullOrUndefined(this.config.extensions)?[]:this.config.extensions,this.config.extensionConfig=h.isNullOrUndefined(this.config.extensionConfig)?{}:this.config.extensionConfig,this.config.extensionConfig.NotificationManager=this._notificationManager,this.logger=new j(e),t.forEach(function(e){if(h.isNullOrUndefined(e.initialize))throw Error(Y)}),0<this.config.extensions.length){var i=!0;if(this.config.extensions.forEach(function(e){h.isNullOrUndefined(e)&&(i=!1)}),!i)throw Error(Y)}(o=this._extensions).push.apply(o,[this._channelController].concat(t,this.config.extensions)),this._extensions=this._extensions.sort(function(e,t){var n=e,i=t,r=typeof n.processTelemetry,o=typeof i.processTelemetry;return"function"===r&&"function"===o?n.priority-i.priority:"function"===r&&"function"!==o?1:"function"!==r&&"function"===o?-1:void 0});var r={};this._extensions.forEach(function(e){var t=e;t&&t.priority&&(h.isNullOrUndefined(r[t.priority])?r[t.priority]=t.identifier:n.logger.warnToConsole("Two extensions have same priority"+r[t.priority]+", "+t.identifier))});for(var o,a=-1,s=0;s<this._extensions.length-1;s++){var u=this._extensions[s];if(!u||"function"==typeof u.processTelemetry){if(u.priority===J){a=s+1;break}this._extensions[s].setNextPlugin(this._extensions[s+1])}}if(this._channelController.initialize(this.config,this,this._extensions),this._extensions.forEach(function(e){e&&e.priority<J&&e.initialize(n.config,n,n._extensions)}),a<this._extensions.length&&this._extensions.splice(a),0===this.getTransmissionControls().length)throw new Error("No channels available");this._isInitialized=!0},e.prototype.getTransmissionControls=function(){return this._channelController.ChannelControls},e.prototype.track=function(e){if(null===e)throw this._notifiyInvalidEvent(e),Error("Invalid telemetry item");if(e.baseData&&!e.baseType)throw this._notifiyInvalidEvent(e),Error("Provide data.baseType for data.baseData");e.baseType||(e.baseType="EventData"),e.instrumentationKey||(e.instrumentationKey=this.config.instrumentationKey),e.timestamp||(e.timestamp=new Date),this._validateTelmetryItem(e);for(var t=0;t<this._extensions.length;){if(this._extensions[t].processTelemetry){this._extensions[t].processTelemetry(e);break}t++}},e.prototype.addNotificationListener=function(e){this._notificationManager.addNotificationListener(e)},e.prototype.removeNotificationListener=function(e){this._notificationManager.removeNotificationListener(e)},e.prototype.pollInternalLogs=function(){var n=this;if(!(0<this.config.diagnosticLoggingInterval))throw Error("config.diagnosticLoggingInterval must be a positive integer");return setInterval(function(){var e=n.logger.queue;e.forEach(function(e){var t={name:"InternalMessageId: "+e.messageId,instrumentationKey:n.config.instrumentationKey,timestamp:new Date,baseType:H.dataType,baseData:{message:e.message}};n.track(t)}),e.length=0},this.config.diagnosticLoggingInterval)},e.prototype._validateTelmetryItem=function(e){if(h.isNullOrUndefined(e.name))throw this._notifiyInvalidEvent(e),Error("telemetry name required");if(h.isNullOrUndefined(e.timestamp))throw this._notifiyInvalidEvent(e),Error("telemetry timestamp required");if(h.isNullOrUndefined(e.instrumentationKey))throw this._notifiyInvalidEvent(e),Error("telemetry instrumentationKey required")},e.prototype._notifiyInvalidEvent=function(e){this._notificationManager.eventsDiscarded([e],n)},e}(),K=function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=J}return e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,i,r){var o=this;if(this.channelQueue=new Array,n.channels)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,r)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);o.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<r.length;t++){var a=r[t];a.priority>J&&e.push(a)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,r)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}},e}(),Y="Extensions must provide callback to initialize",J=200;(o=r||(r={}))[o.LocalStorage=0]="LocalStorage",o[o.SessionStorage=1]="SessionStorage",(a=m||(m={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var Z=function(){function e(){}return e.requestContextHeader="Request-Context",e.requestContextTargetKey="appId",e.requestContextAppIdFormat="appId=cid-v1:",e.requestIdHeader="Request-Id",e.sdkContextHeader="Sdk-Context",e.sdkContextHeaderAppIdRequest="appId",e.requestContextHeaderLowerCase="request-context",e}(),Q=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var i=t.length,r=s.sanitizeKey(e,t);if(r.length!==i){for(var o=0,a=r;void 0!==n[a];)o++,a=r.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(o);r=a}return r},s.sanitizeKey=function(e,t){return t&&(t=s.trim(t.toString())).length>s.MAX_NAME_LENGTH&&(t=t.substring(0,s.MAX_NAME_LENGTH),e.throwInternal(g.WARNING,q,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),t},s.sanitizeString=function(e,t,n){return void 0===n&&(n=s.MAX_STRING_LENGTH),t&&(n=n||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>n&&(t=t.toString().substring(0,n),e.throwInternal(g.WARNING,k,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,F)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(g.WARNING,B,"message is too long, it has been truncated to "+s.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),t},s.sanitizeException=function(e,t){return t&&t.length>s.MAX_EXCEPTION_LENGTH&&(t=t.substring(0,s.MAX_EXCEPTION_LENGTH),e.throwInternal(g.WARNING,P,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(e,t){if(t){var n={};for(var i in t){var r=s.sanitizeString(e,t[i],s.MAX_PROPERTY_LENGTH);n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=r}t=n}return t},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var i in t){var r=t[i];n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=r}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,X).toString():t},s.sanitizeInput=function(e,t,n,i){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(g.WARNING,i,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),t},s.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.MAX_NAME_LENGTH=150,s.MAX_ID_LENGTH=128,s.MAX_PROPERTY_LENGTH=8192,s.MAX_STRING_LENGTH=1024,s.MAX_URL_LENGTH=2048,s.MAX_MESSAGE_LENGTH=32768,s.MAX_EXCEPTION_LENGTH=32768,s}(),$=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(r.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,i=null;try{if("undefined"==typeof window)return null;n=new Date,(i=e===r.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=i.getItem(n)!=n,i.removeItem(n),t&&(i=null)}catch(e){i=null}return i},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(r.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,u,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var i=s._getLocalStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,f,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,d,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(r.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(r.SessionStorage)),s._canUseSessionStorage},s.getSessionStorageKeys=function(){var e=[];if(s.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},s.getSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,c,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var i=s._getSessionStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,p,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,v,"Browser failed removal of session storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.disableCookies=function(){s._canUseCookies=!1},s.canUseCookies=function(t){if(void 0===s._canUseCookies){s._canUseCookies=!1;try{s._canUseCookies=void 0!==s.document.cookie}catch(e){t.throwInternal(g.WARNING,V,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,i){var r="",o="";i&&(r=";domain="+i),s.document.location&&"https:"===s.document.location.protocol&&(o=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+r+";path=/"+o)},s.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},s.getCookie=function(e,t){if(s.canUseCookies(e)){var n="";if(t&&t.length)for(var i=t+"=",r=s.document.cookie.split(";"),o=0;o<r.length;o++){var a=r[o];if((a=s.trim(a))&&0===a.indexOf(i)){n=a.substring(i.length,r[o].length);break}}return n}},s.deleteCookie=function(e,t){s.canUseCookies(e)&&(s.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.newId=function(){for(var e="",t=1073741824*Math.random();0<t;){e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64)}return e},s.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},s.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},s.toISOStringForIE8=function(e){if(s.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},s.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},s.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,i=""+Math.floor(e/6e4)%60,r=""+Math.floor(e/36e5)%24,o=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,i=i.length<2?"0"+i:i,(0<o?o+".":"")+(r=r.length<2?"0"+r:r)+":"+i+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,i,r){return("Script error."===e||"Script error"===e)&&!r},s.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},s.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},s.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},s.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},s.document="undefined"!=typeof document?document:{},s._canUseCookies=void 0,s._canUseLocalStorage=void 0,s._canUseSessionStorage=void 0,s._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],s.NotSpecified="not_specified",s}(),ee=function(){function i(){}return i.parseUrl=function(e){return i.htmlAnchorElement||(i.htmlAnchorElement=i.document.createElement?i.document.createElement("a"):{}),i.htmlAnchorElement.href=e,i.htmlAnchorElement},i.getAbsoluteUrl=function(e){var t,n=i.parseUrl(e);return n&&(t=n.href),t},i.getPathName=function(e){var t,n=i.parseUrl(e);return n&&(t=n.pathname),t},i.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},i.document="undefined"!=typeof document?document:{},i}(),te=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,i){var r,o;if(t&&0<t.length){var a=ee.parseUrl(t);if(r=a.host,null!=a.pathname)"/"!==(i=0===a.pathname.length?"/":a.pathname).charAt(0)&&(i="/"+i),o=Q.sanitizeString(e,n?n+" "+i:i);else o=Q.sanitizeString(e,t)}else o=r=i;return{target:r,name:o}},e}(),ne=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||h.isNullOrUndefined(e)||h.isNullOrUndefined(t)||(n=t-e),n}}(),function(e,t){return(ne=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)});function ie(e,t){function n(){this.constructor=e}ne(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var re,oe,ae=function(e){function t(){return e.call(this)||this}return ie(t,e),t}(function(){}),se=function(r){function e(e,t,n){var i=r.call(this)||this;return i.name=Q.sanitizeString(e,n)||$.NotSpecified,i.data=t,i.time=$.toISOStringForIE8(new Date),i.aiDataContract={time:m.Required,iKey:m.Required,name:m.Required,sampleRate:function(){return 100==i.sampleRate?m.Hidden:m.Required},tags:m.Required,data:m.Required},i}return ie(e,r),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ue=function(){},le=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return ie(e,t),e}(ue),ce=function(o){function e(e,t,n,i){var r=o.call(this)||this;return r.aiDataContract={ver:m.Required,name:m.Required,properties:m.Default,measurements:m.Default},r.name=Q.sanitizeString(e,t)||$.NotSpecified,r.properties=Q.sanitizeProperties(e,n),r.measurements=Q.sanitizeMeasurements(e,i),r}return ie(e,o),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(le),fe=function(){},pe=function(){this.hasFullStack=!0,this.parsedStack=[]},de=function(a){function e(e,t,n,i,r){var o=a.call(this)||this;return o.aiDataContract={ver:m.Required,exceptions:m.Required,severityLevel:m.Default,properties:m.Default,measurements:m.Default},o.properties=Q.sanitizeProperties(e,n),o.measurements=Q.sanitizeMeasurements(e,i),o.exceptions=[new he(e,t)],r&&(o.severityLevel=r),o}return ie(e,a),e.CreateSimpleException=function(e,t,n,i,r,o){return{exceptions:[{hasFullStack:!0,message:e,stack:r,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return ie(e,t),e}(ue)),he=function(r){function e(e,t){var n=r.call(this)||this;n.aiDataContract={id:m.Default,outerId:m.Default,typeName:m.Required,message:m.Required,hasFullStack:m.Default,stack:m.Default,parsedStack:m.Array},n.typeName=Q.sanitizeString(e,t.name)||$.NotSpecified,n.message=Q.sanitizeMessage(e,t.message)||$.NotSpecified;var i=t.stack;return n.parsedStack=n.parseStack(i),n.stack=Q.sanitizeException(e,i),n.hasFullStack=$.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return ie(e,r),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var i=0,r=0,o=0;o<=n.length;o++){var a=n[o];if(ge.regex.test(a)){var s=new ge(n[o],i++);r+=s.sizeInBytes,t.push(s)}}if(32768<r)for(var u=0,l=t.length-1,c=0,f=u,p=l;u<l;){if(32768<(c+=t[u].sizeInBytes+t[l].sizeInBytes)){var d=p-f+1;t.splice(f,d);break}f=u,p=l,u++,l--}}return t},e}(pe),ge=function(r){function o(e,t){var n=r.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:m.Required,method:m.Required,assembly:m.Default,fileName:m.Default,line:m.Default},n.level=t,n.method="<no_method>",n.assembly=$.trim(e);var i=e.match(o.regex);return i&&5<=i.length&&(n.method=$.trim(i[2])||n.method,n.fileName=$.trim(i[4]),n.line=parseInt(i[5])||0),n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=o.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}return ie(o,r),o.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,o.baseSize=58,o}(fe),me=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return ie(e,t),e}(ue);(oe=re||(re={}))[oe.Measurement=0]="Measurement",oe[oe.Aggregation=1]="Aggregation";var ve,ye=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:m.Required,kind:m.Default,value:m.Required,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default},e}return ie(e,t),e}(function(){this.kind=re.Measurement}),_e=function(l){function e(e,t,n,i,r,o,a){var s=l.call(this)||this;s.aiDataContract={ver:m.Required,metrics:m.Required,properties:m.Default};var u=new ye;return u.count=0<i?i:void 0,u.max=isNaN(o)||null===o?void 0:o,u.min=isNaN(r)||null===r?void 0:r,u.name=Q.sanitizeString(e,t)||$.NotSpecified,u.value=n,s.metrics=[u],s.properties=Q.sanitizeProperties(e,a),s}return ie(e,l),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(me),Ie=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return ie(e,t),e}(le),Se=function(u){function e(e,t,n,i,r,o,a){var s=u.call(this)||this;return s.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,properties:m.Default,measurements:m.Default,id:m.Default},s.id=Q.sanitizeId(e,a),s.url=Q.sanitizeUrl(e,n),s.name=Q.sanitizeString(e,t)||$.NotSpecified,isNaN(i)||(s.duration=$.msToTimeSpan(i)),s.properties=Q.sanitizeProperties(e,r),s.measurements=Q.sanitizeMeasurements(e,o),s}return ie(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(Ie),we=function(p){function e(e,t,n,i,r,o,a,s,u,l){var c=p.call(this)||this;c.aiDataContract={id:m.Required,ver:m.Required,name:m.Default,resultCode:m.Default,duration:m.Default,success:m.Default,data:m.Default,target:m.Default,type:m.Default,properties:m.Default,measurements:m.Default,kind:m.Default,value:m.Default,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default,dependencyKind:m.Default,dependencySource:m.Default,commandName:m.Default,dependencyTypeName:m.Default},c.id=t,c.duration=$.msToTimeSpan(r),c.success=o,c.resultCode=a+"",c.type="Ajax",c.data=Q.sanitizeUrl(e,i);var f=te.ParseDependencyPath(e,n,s,i);return c.target=f.target,c.name=f.name,c.properties=Q.sanitizeProperties(e,u),c.measurements=Q.sanitizeMeasurements(e,l),c}return ie(e,p),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return ie(e,t),e}(ue)),Ee=function(o){function e(e,t,n,i){var r=o.call(this)||this;return r.aiDataContract={ver:m.Required,message:m.Required,severityLevel:m.Default,properties:m.Default},t=t||$.NotSpecified,r.message=Q.sanitizeMessage(e,t),r.properties=Q.sanitizeProperties(e,n),i&&(r.severityLevel=i),r}return ie(e,o),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return ie(e,t),e}(ue)),be=function(d){function h(e,t,n,i,r,o){var a=d.call(this)||this;a.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,perfTotal:m.Default,networkConnect:m.Default,sentRequest:m.Default,receivedResponse:m.Default,domProcessing:m.Default,properties:m.Default,measurements:m.Default},a.isValid=!1;var s=h.getPerformanceTiming();if(s){var u=h.getDuration(s.navigationStart,s.loadEventEnd),l=h.getDuration(s.navigationStart,s.connectEnd),c=h.getDuration(s.requestStart,s.responseStart),f=h.getDuration(s.responseStart,s.responseEnd),p=h.getDuration(s.responseEnd,s.loadEventEnd);0==u?e.throwInternal(g.WARNING,_,"error calculating page view performance.",{total:u,network:l,request:c,response:f,dom:p}):h.shouldCollectDuration(u,l,c,f,p)?u<Math.floor(l)+Math.floor(c)+Math.floor(f)+Math.floor(p)?e.throwInternal(g.WARNING,y,"client performance math error.",{total:u,network:l,request:c,response:f,dom:p}):(a.durationMs=u,a.perfTotal=a.duration=$.msToTimeSpan(u),a.networkConnect=$.msToTimeSpan(l),a.sentRequest=$.msToTimeSpan(c),a.receivedResponse=$.msToTimeSpan(f),a.domProcessing=$.msToTimeSpan(p),a.isValid=!0):e.throwInternal(g.WARNING,A,"Invalid page load duration value. Browser perf data won't be sent.",{total:u,network:l,request:c,response:f,dom:p})}return a.url=Q.sanitizeUrl(e,n),a.name=Q.sanitizeString(e,t)||$.NotSpecified,a.properties=Q.sanitizeProperties(e,r),a.measurements=Q.sanitizeMeasurements(e,o),a}return ie(h,d),h.prototype.getIsValid=function(){return this.isValid},h.prototype.getDurationMs=function(){return this.durationMs},h.getPerformanceTiming=function(){return h.isPerformanceTimingSupported()?window.performance.timing:null},h.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},h.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},h.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},h.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],i=navigator.userAgent,r=!1;if(i)for(var o=0;o<n.length;o++)r=r||-1!==i.toLowerCase().indexOf(n[o]);if(r)return!1;for(var a=0;a<e.length;a++)if(e[a]>=h.MAX_DURATION_ALLOWED)return!1;return!0},h.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",h.dataType="PageviewPerformanceData",h.MAX_DURATION_ALLOWED=36e5,h}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return ie(e,t),e}(Ie)),Te=function(i){function e(e,t){var n=i.call(this)||this;return n.aiDataContract={baseType:m.Required,baseData:m.Required},n.baseType=e,n.baseData=t,n}return ie(e,i),e}(ae);(ve=e.SeverityLevel||(e.SeverityLevel={}))[ve.Verbose=0]="Verbose",ve[ve.Information=1]="Information",ve[ve.Warning=2]="Warning",ve[ve.Error=3]="Error",ve[ve.Critical=4]="Critical";var Ne=function(){function e(e){this._config=e,this._buffer=[]}return e.prototype.enqueue=function(e){this._buffer.push(e)},e.prototype.count=function(){return this._buffer.length},e.prototype.clear=function(){this._buffer.length=0},e.prototype.getItems=function(){return this._buffer.slice(0)},e.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},e.prototype.markAsSent=function(e){this.clear()},e.prototype.clearSent=function(e){},e}(),xe=function(){function r(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(r.BUFFER_KEY),i=this.getBuffer(r.SENT_BUFFER_KEY);this._buffer=n.concat(i),this._buffer.length>r.MAX_BUFFER_SIZE&&(this._buffer.length=r.MAX_BUFFER_SIZE),this.setBuffer(r.SENT_BUFFER_KEY,[]),this.setBuffer(r.BUFFER_KEY,this._buffer)}return r.prototype.enqueue=function(e){this._buffer.length>=r.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(this._logger.throwInternal(g.WARNING,G,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(e),this.setBuffer(r.BUFFER_KEY,this._buffer))},r.prototype.count=function(){return this._buffer.length},r.prototype.clear=function(){this._buffer.length=0,this.setBuffer(r.BUFFER_KEY,[]),this.setBuffer(r.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},r.prototype.getItems=function(){return this._buffer.slice(0)},r.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},r.prototype.markAsSent=function(e){this._buffer=this.removePayloadsFromBuffer(e,this._buffer),this.setBuffer(r.BUFFER_KEY,this._buffer);var t=this.getBuffer(r.SENT_BUFFER_KEY);t instanceof Array&&e instanceof Array&&((t=t.concat(e)).length>r.MAX_BUFFER_SIZE&&(this._logger.throwInternal(g.CRITICAL,G,"Sent buffer reached its maximum size: "+t.length,!0),t.length=r.MAX_BUFFER_SIZE),this.setBuffer(r.SENT_BUFFER_KEY,t))},r.prototype.clearSent=function(e){var t=this.getBuffer(r.SENT_BUFFER_KEY);t=this.removePayloadsFromBuffer(e,t),this.setBuffer(r.SENT_BUFFER_KEY,t)},r.prototype.removePayloadsFromBuffer=function(e,t){var n=[];for(var i in t){var r=!1;for(var o in e)if(e[o]===t[i]){r=!0;break}r||n.push(t[i])}return n},r.prototype.getBuffer=function(t){try{var e=$.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(g.CRITICAL,D," storage key: "+t+", "+$.getExceptionName(e),{exception:$.dump(e)})}return[]},r.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);$.setSessionStorage(this._logger,t,n)}catch(e){$.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(g.WARNING,x," storage key: "+t+", "+$.getExceptionName(e)+". Buffer cleared",{exception:$.dump(e)})}},r.BUFFER_KEY="AI_buffer",r.SENT_BUFFER_KEY="AI_sentBuffer",r.MAX_BUFFER_SIZE=2e3,r}(),De=["ai.application.ver","ai.application.build","ai.application.typeId","ai.application.applicationId","ai.application.layer","ai.device.id","ai.device.ip","ai.device.language","ai.device.locale","ai.device.model","ai.device.friendlyName","ai.device.network","ai.device.networkName","ai.device.oemName","ai.device.os","ai.device.osVersion","ai.device.roleInstance","ai.device.roleName","ai.device.screenResolution","ai.device.type","ai.device.machineName","ai.device.vmName","ai.device.browser","ai.device.browserVersion","ai.location.ip","ai.location.country","ai.location.province","ai.location.city","ai.operation.id","ai.operation.name","ai.operation.parentId","ai.operation.rootId","ai.operation.syntheticSource","ai.operation.correlationVector","ai.session.id","ai.session.isFirst","ai.session.isNew","ai.user.accountAcquisitionDate","ai.user.accountId","ai.user.userAgent","ai.user.id","ai.user.storeRegion","ai.user.authUserId","ai.user.anonUserAcquisitionDate","ai.user.authUserAcquisitionDate","ai.cloud.name","ai.cloud.role","ai.cloud.roleVer","ai.cloud.roleInstance","ai.cloud.environment","ai.cloud.location","ai.cloud.deploymentUnit","ai.internal.sdkVersion","ai.internal.agentVersion","ai.internal.nodeName"],Ce=function(){function e(){}return e.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];"number"!=typeof i&&(t||(t={}),t[n]=i)}return t},e.extractPropsAndMeasurements=function(e,t,n){if(!h.isNullOrUndefined(e))for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];"number"==typeof r?n[i]=r:t[i]=r}},e.createEnvelope=function(e,t,n,i){var r=new se(e,i,t);r.iKey=n.instrumentationKey;var o=n.instrumentationKey.replace(/-/g,"");for(var a in r.name=r.name.replace("{0}",o),n.ctx)n.ctx.hasOwnProperty(a)&&0<=De.indexOf(a)&&(r.tags[a]=n.ctx[a]);return n.tags||(n.tags=[]),n.tags.forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&0<=De.indexOf(t)&&(r.tags[t]=e[t])}),r},e}(),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},i={};Ce.extractPropsAndMeasurements(t.data,i,n);var r=t.baseData;if(h.isNullOrUndefined(r))return e.warnToConsole("Invalid input for dependency data"),null;var o=r.id,a=r.absoluteUrl,s=r.commandName,u=r.duration,l=r.success,c=r.resultCode,f=r.method,p=new we(e,o,a,s,u,l,c,f,i,n),d=new Te(we.dataType,p);return Ce.createEnvelope(e,we.envelopeType,t,d)},t.DependencyEnvelopeCreator=new t,t}(Ce),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},i={};t.baseType!==ce.dataType&&Ce.extractPropsAndMeasurements(t.baseData,n,i),Ce.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.name,o=new ce(e,r,n,i),a=new Te(ce.dataType,o);return Ce.createEnvelope(e,ce.envelopeType,t,a)},t.EventEnvelopeCreator=new t,t}(Ce),Le=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},i={};Ce.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.error,o=t.baseData.severityLevel,a=new de(e,r,n,i,o),s=new Te(de.dataType,a);return Ce.createEnvelope(e,de.envelopeType,t,s)},t.ExceptionEnvelopeCreator=new t,t}(Ce),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=Ce.extractProperties(t.data),i=t.baseData.name,r=t.baseData.average,o=t.baseData.sampleCount,a=t.baseData.min,s=t.baseData.max,u=new _e(e,i,r,o,a,s,n),l=new Te(_e.dataType,u);return Ce.createEnvelope(e,_e.envelopeType,t,l)},t.MetricEnvelopeCreator=new t,t}(Ce),Ue=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=void 0;h.isNullOrUndefined(t.data)||h.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration);var i={},r={};Ce.extractPropsAndMeasurements(t.data,i,r);var o=t.baseData.name,a=t.baseData.uri;if(h.isNullOrUndefined(t.baseData.refUri)||(i.refUri=t.baseData.refUri),h.isNullOrUndefined(t.baseData.pageType)||(i.pageType=t.baseData.pageType),h.isNullOrUndefined(t.baseData.isLoggedIn)||(i.isLoggedIn=t.baseData.isLoggedIn),!h.isNullOrUndefined(t.baseData.pageTags)){var s=t.baseData.pageTags;for(var u in s)s.hasOwnProperty(u)&&(i[u]=s[u])}var l=new Se(e,o,a,n,i,r),c=new Te(Se.dataType,l);return Ce.createEnvelope(e,Se.envelopeType,t,c)},t.PageViewEnvelopeCreator=new t,t}(Ce),Oe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},i={};Ce.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.name,o=t.baseData.uri,a=t.baseData.duration,s=new be(e,r,o,a,n,i),u=new Te(be.dataType,s);return Ce.createEnvelope(e,be.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(Ce),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,i=t.baseData.severityLevel,r=Ce.extractProperties(t.data),o=new Ee(e,n,r,i),a=new Te(Ee.dataType,o);return Ce.createEnvelope(e,Ee.envelopeType,t,a)},t.TraceEnvelopeCreator=new t,t}(Ce),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Be=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),qe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),ke=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),Fe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),Ge=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),Ve=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),Xe=function(){function e(e){this._logger=e}return e.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},e.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",i={};if(!e)return this._logger.throwInternal(g.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),i;if(e[n])return this._logger.throwInternal(g.WARNING,O,"Circular reference detected while serializing object",{name:t},!0),i;if(!e.aiDataContract){if("measurements"===t)i=this._serializeStringMap(e,"number",t);else if("properties"===t)i=this._serializeStringMap(e,"string",t);else if("tags"===t)i=this._serializeStringMap(e,"string",t);else if($.isArray(e))i=this._serializeArray(e,t);else{this._logger.throwInternal(g.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),i=e}catch(e){this._logger.throwInternal(g.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return i}for(var r in e[n]=!0,e.aiDataContract){var o,a=e.aiDataContract[r],s="function"==typeof a?a()&m.Required:a&m.Required,u="function"==typeof a?a()&m.Hidden:a&m.Hidden,l=a&m.Array,c=void 0!==e[r],f="object"==typeof e[r]&&null!==e[r];if(!s||c||l){if(!u)void 0!==(o=f?l?this._serializeArray(e[r],r):this._serializeObject(e[r],r):e[r])&&(i[r]=o)}else this._logger.throwInternal(g.CRITICAL,E,"Missing required field specification. The field is required but not present on source",{field:r,name:t})}return delete e[n],i},e.prototype._serializeArray=function(e,t){var n=void 0;if(e)if($.isArray(e)){n=[];for(var i=0;i<e.length;i++){var r=e[i],o=this._serializeObject(r,t+"["+i+"]");n.push(o)}}else this._logger.throwInternal(g.CRITICAL,z,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},e.prototype._serializeStringMap=function(e,t,n){var i=void 0;if(e)for(var r in i={},e){var o=e[r];if("string"===t)void 0===o?i[r]="undefined":null===o?i[r]="null":o.toString?i[r]=o.toString():i[r]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===o)i[r]="undefined";else if(null===o)i[r]="null";else{var a=parseFloat(o);isNaN(a)?i[r]="NaN":i[r]=a}else i[r]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(g.CRITICAL,i[r],null,!0)}return i},e}(),He=function(){function e(){this._onlineStatus=!0,"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,je=function(){function o(){this.priority=201,this._XMLHttpRequestSupported=!1}return o.prototype.pause=function(){throw new Error("Method not implemented.")},o.prototype.resume=function(){throw new Error("Method not implemented.")},o.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(g.CRITICAL,S,"flush failed, telemetry will not be collected: "+$.getExceptionName(e),{exception:$.dump(e)})}},o.prototype.teardown=function(){throw new Error("Method not implemented.")},o.prototype.initialize=function(e,t,n){(this.identifier="AppInsightsChannelPlugin",this._logger=t.logger,this._serializer=new Xe(t.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._config=o._getDefaultAppInsightsChannelConfig(e,this.identifier),this._sender=null,this._buffer=$.canUseSessionStorage()&&this._config.enableSessionStorageBuffer?new xe(this._logger,this._config):new Ne(this._config),!this._config.isBeaconApiDisabled()&&$.IsBeaconApiSupported())?this._sender=this._beaconSender:"undefined"!=typeof XMLHttpRequest&&("withCredentials"in new XMLHttpRequest?(this._sender=this._xhrSender,this._XMLHttpRequestSupported=!0):"undefined"!=typeof XDomainRequest&&(this._sender=this._xdrSender))},o.prototype.processTelemetry=function(e){try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(g.CRITICAL,s,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(g.CRITICAL,T,"Sender was not initialized");if(!o._validate(e))return void this._logger.throwInternal(g.CRITICAL,R,"Invalid telemetry envelope");var t=this._constructEnvelope(e);if(!t)return void this._logger.throwInternal(g.CRITICAL,L,"Unable to create an AppInsights envelope");var n=this._serializer.serialize(t),i=this._buffer.getItems(),r=this._buffer.batchPayloads(i);r&&r.length+n.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(n),this._setupTimer()}catch(e){this._logger.throwInternal(g.WARNING,I,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+$.getExceptionName(e),{exception:$.dump(e)})}h.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},o.prototype.setNextPlugin=function(e){this._nextPlugin=e},o.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var i=null;if(this._appId||(i=this._parseResponse(e.responseText||e.response))&&i.appId&&(this._appId=i.appId),(e.status<200||300<=e.status)&&0!==e.status)!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(g.WARNING,N,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(0===e.status||He.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(g.WARNING,N,". Offline - Response Code: "+e.status+". Offline status: "+He.isOffline()+". Will retry to send "+t.length+" items.")}}else 206===e.status?(i||(i=this._parseResponse(e.responseText||e.response)),i&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,i):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},o.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!$.getIEVersion()||9<$.getIEVersion())&&this._logger.throwInternal(g.CRITICAL,N,"Telemetry transmission failed, some telemetry will be lost: "+$.getExceptionName(e),{exception:$.dump(e)})}},o.prototype._onError=function(e,t,n){this._logger.throwInternal(g.WARNING,b,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},o.prototype._onPartialSuccess=function(e,t){for(var n=[],i=[],r=0,o=t.errors.reverse();r<o.length;r++){var a=o[r],s=e.splice(a.index,1)[0];this._isRetriable(a.statusCode)?i.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<i.length&&(this._resendPayload(i),this._logger.throwInternal(g.WARNING,N,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+i.length+" our of "+t.itemsReceived+" items"))},o.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},o.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},o.prototype._constructEnvelope=function(e){switch(e.baseType){case ce.dataType:return Re.EventEnvelopeCreator.Create(this._logger,e);case Ee.dataType:return Pe.TraceEnvelopeCreator.Create(this._logger,e);case Se.dataType:return Ue.PageViewEnvelopeCreator.Create(this._logger,e);case be.dataType:return Oe.PageViewPerformanceEnvelopeCreator.Create(this._logger,e);case de.dataType:return Le.ExceptionEnvelopeCreator.Create(this._logger,e);case _e.dataType:return Me.MetricEnvelopeCreator.Create(this._logger,e);case we.dataType:return Ae.DependencyEnvelopeCreator.Create(this._logger,e);default:return Re.EventEnvelopeCreator.Create(this._logger,e)}},o._getDefaultAppInsightsChannelConfig=function(e,t){var n={},i=e.extensionConfig&&e.extensionConfig[t]?e.extensionConfig[t]:{};return n.endpointUrl=function(){return e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},n.emitLineDelimitedJson=function(){return $.stringToBoolOrDefault(i.emitLineDelimitedJson)},n.maxBatchInterval=function(){return isNaN(i.maxBatchInterval)?15e3:i.maxBatchInterval},n.maxBatchSizeInBytes=function(){return 0<i.maxBatchSizeInBytes?i.maxBatchSizeInBytes:102400},n.disableTelemetry=function(){return $.stringToBoolOrDefault(i.disableTelemetry)},n.enableSessionStorageBuffer=function(){return $.stringToBoolOrDefault(i.enableSessionStorageBuffer,!0)},n.isRetryDisabled=function(){return $.stringToBoolOrDefault(i.isRetryDisabled)},n.isBeaconApiDisabled=function(){return $.stringToBoolOrDefault(i.isBeaconApiDisabled,!0)},n},o._validate=function(e){switch(e.baseType){case ce.dataType:return ze.EventValidator.Validate(e);case Ee.dataType:return Be.TraceValidator.Validate(e);case de.dataType:return qe.ExceptionValidator.Validate(e);case _e.dataType:return ke.MetricValidator.Validate(e);case Se.dataType:return Ge.PageViewValidator.Validate(e);case be.dataType:return Fe.PageViewPerformanceValidator.Validate(e);case we.dataType:return Ve.RemoteDepdencyValidator.Validate(e);default:return ze.EventValidator.Validate(e)}},o.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),i=this._buffer.batchPayloads(e),r=new Blob([i],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,r)?this._buffer.markAsSent(e):this._logger.throwInternal(g.CRITICAL,N,". Failed to send telemetry with Beacon API.")},o.prototype._xhrSender=function(t,e){var n=this,i=new XMLHttpRequest;i.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,i.open("POST",this._config.endpointUrl(),e),i.setRequestHeader("Content-type","application/json"),$.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&i.setRequestHeader(Z.sdkContextHeader,Z.sdkContextHeaderAppIdRequest),i.onreadystatechange=function(){return n._xhrReadyStateChange(i,t,t.length)},i.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(i),e)};var r=this._buffer.batchPayloads(t);i.send(r),this._buffer.markAsSent(t)},o.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(g.CRITICAL,C,"Cannot parse the response. "+$.getExceptionName(e),{response:t})}return null},o.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,i=e;n<i.length;n++){var r=i[n];this._buffer.enqueue(r)}this._setRetryTime(t),this._setupTimer()}},o.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,i=Math.floor(Math.random()*n*10)+1;i*=e,t=Math.max(Math.min(i,3600),10)}var r=Date.now()+1e3*t;this._retryAt=r},o.prototype._setupTimer=function(){var e=this;if(!this._timeoutHandle){var t=this._retryAt?Math.max(0,this._retryAt-Date.now()):0,n=Math.max(this._config.maxBatchInterval(),t);this._timeoutHandle=setTimeout(function(){e.triggerSend()},n)}},o.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},o.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},o.prototype._xdrSender=function(t,e){var n=this,i=new XDomainRequest;i.onload=function(){return n._xdrOnLoad(i,t)},i.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(i),e)};var r=window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(r,0))return this._logger.throwInternal(g.WARNING,N,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var o=this._config.endpointUrl().replace(/^(https?:)/,"");i.open("POST",o);var a=this._buffer.batchPayloads(t);i.send(a),this._buffer.markAsSent(t)},o.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},o}(),We=function(){function e(e){if(h.isNullOrUndefined(e)||h.isNullOrUndefined(e.instrumentationKey))throw new Error("Invalid input configuration");this.config=e,this.initialize()}return e.prototype.initialize=function(){this.core=new W;var e=[],t=new je;e.push(t),this.core.initialize(this.config,e),t.initialize(this.config,this.core,e)},e.prototype.track=function(e){this.core.track(e)},e.prototype.flush=function(t){void 0===t&&(t=!0),this.core.getTransmissionControls().forEach(function(e){e.forEach(function(e){t?e.flush():e.triggerSend(t)})})},e}();e.ApplicationInsights=We,e.AppInsightsCore=W,e.CoreUtils=h,e.Event=ce,e.Exception=de,e.Metric=_e,e.PageView=Se,e.PageViewPerformance=be,e.RemoteDependencyData=we,e.Trace=Ee,e.Sender=je,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=aib.1.min.js.map
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { AppInsightsCore, LoggingSeverity, _InternalMessageId, CoreUtils } from "@microsoft/applicationinsights-core-js";
import { AppInsightsCore, CoreUtils } from "@microsoft/applicationinsights-core-js";
import { Sender } from "@microsoft/applicationinsights-channel-js";

@@ -18,3 +18,4 @@ "use strict";

// initialize the queue and config in case they are undefined
if (CoreUtils.isNullOrUndefined(config) || CoreUtils.isNullOrUndefined(config.instrumentationKey)) {
if (CoreUtils.isNullOrUndefined(config) ||
CoreUtils.isNullOrUndefined(config.instrumentationKey)) {
throw new Error("Invalid input configuration");

@@ -58,3 +59,5 @@ }

controls.forEach(function (plugin) {
async ? plugin.flush() : plugin.triggerSend(async);
async
? plugin.flush()
: plugin.triggerSend(async);
});

@@ -66,3 +69,5 @@ });

export { ApplicationInsights };
export { AppInsightsCore, LoggingSeverity, _InternalMessageId, CoreUtils };
export { AppInsightsCore, CoreUtils } from "@microsoft/applicationinsights-core-js";
export { SeverityLevel, Event, Exception, Metric, PageView, PageViewPerformance, RemoteDependencyData, Trace } from "@microsoft/applicationinsights-common";
export { Sender } from "@microsoft/applicationinsights-channel-js";
//# sourceMappingURL=index.js.map
/*!
* Application Insights JavaScript Web SDK - Basic, 1.0.0-beta.4
* Application Insights JavaScript Web SDK - Basic, 1.0.0-beta.5
* Copyright (c) Microsoft and contributors. All rights reserved.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.aib={})}(this,function(h){"use strict";var e,t=2,p=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),n=/[xy]/g,u=function(){function e(){this.listeners=[]}return e.prototype.addNotificationListener=function(e){this.listeners.push(e)},e.prototype.removeNotificationListener=function(e){for(var t=this.listeners.indexOf(e);-1<t;)this.listeners.splice(t,1),t=this.listeners.indexOf(e)},e.prototype.eventsSent=function(t){for(var n=this,e=function(e){i.listeners[e].eventsSent&&setTimeout(function(){return n.listeners[e].eventsSent(t)},0)},i=this,r=0;r<this.listeners.length;++r)e(r)},e.prototype.eventsDiscarded=function(t,n){for(var i=this,e=function(e){r.listeners[e].eventsDiscarded&&setTimeout(function(){return i.listeners[e].eventsDiscarded(t,n)},0)},r=this,o=0;o<this.listeners.length;++o)e(o)},e}();(e=h.LoggingSeverity||(h.LoggingSeverity={}))[e.CRITICAL=1]="CRITICAL",e[e.WARNING=2]="WARNING";var r,i,m,o,v={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69},s=function(){function o(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?o.AiUserActionablePrefix:o.AiNonUserActionablePrefix)+e;var r=(t?" message:"+o.sanitizeDiagnosticText(t):"")+(i?" props:"+o.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=r}return o.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},o.dataType="MessageData",o.AiNonUserActionablePrefix="AI (Internal): ",o.AiUserActionablePrefix="AI: ",o}(),c=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},p.isNullOrUndefined(e)||(p.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),p.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),p.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),p.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,r){void 0===r&&(r=!1);var o=new s(t,n,r,i);if(this.enableDebugExceptions())throw o;if(void 0!==o&&o&&void 0!==o.message){if(r){var a=+o.messageId;(!this._messageLogged[a]||this.consoleLoggingLevel()>=h.LoggingSeverity.WARNING)&&(this.warnToConsole(o.message),this._messageLogged[a]=!0)}else this.consoleLoggingLevel()>=h.LoggingSeverity.WARNING&&this.warnToConsole(o.message);this.logInternalMessage(e,o)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var r="Internal events throttle limit per PageView reached for this app.",o=new s(v.MessageLimitPerPVExceeded,r,!1);this.queue.push(o),this.warnToConsole(r)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),a=function(){function e(){this._isInitialized=!1,this._extensions=new Array,this._channelController=new l}return e.prototype.initialize=function(e,t){var n=this;if(this._isInitialized)throw Error("Core should not be initialized more than once");if(!e||p.isNullOrUndefined(e.instrumentationKey))throw Error("Please provide instrumentation key");if(this.config=e,this._notificationManager=new u,this.config.extensions=p.isNullOrUndefined(this.config.extensions)?[]:this.config.extensions,this.config.extensionConfig=p.isNullOrUndefined(this.config.extensionConfig)?{}:this.config.extensionConfig,this.config.extensionConfig.NotificationManager=this._notificationManager,this.logger=new c(e),t.forEach(function(e){if(p.isNullOrUndefined(e.initialize))throw Error(f)}),0<this.config.extensions.length){var i=!0;if(this.config.extensions.forEach(function(e){p.isNullOrUndefined(e)&&(i=!1)}),!i)throw Error(f)}(o=this._extensions).push.apply(o,[this._channelController].concat(t,this.config.extensions)),this._extensions=this._extensions.sort(function(e,t){var n=e,i=t,r=typeof n.processTelemetry,o=typeof i.processTelemetry;return"function"===r&&"function"===o?n.priority-i.priority:"function"===r&&"function"!==o?1:"function"!==r&&"function"===o?-1:void 0});var r={};this._extensions.forEach(function(e){var t=e;t&&t.priority&&(p.isNullOrUndefined(r[t.priority])?r[t.priority]=t.identifier:n.logger.warnToConsole("Two extensions have same priority"+r[t.priority]+", "+t.identifier))});for(var o,a=-1,s=0;s<this._extensions.length-1;s++){var l=this._extensions[s];if(!l||"function"==typeof l.processTelemetry){if(l.priority===g){a=s+1;break}this._extensions[s].setNextPlugin(this._extensions[s+1])}}if(this._channelController.initialize(this.config,this,this._extensions),this._extensions.forEach(function(e){e&&e.priority<g&&e.initialize(n.config,n,n._extensions)}),a<this._extensions.length&&this._extensions.splice(a),0===this.getTransmissionControls().length)throw new Error("No channels available");this._isInitialized=!0},e.prototype.getTransmissionControls=function(){return this._channelController.ChannelControls},e.prototype.track=function(e){if(null===e)throw this._notifiyInvalidEvent(e),Error("Invalid telemetry item");if(e.baseData&&!e.baseType)throw this._notifiyInvalidEvent(e),Error("Provide data.baseType for data.baseData");e.baseType||(e.baseType="EventData"),e.instrumentationKey||(e.instrumentationKey=this.config.instrumentationKey),e.timestamp||(e.timestamp=new Date),this._validateTelmetryItem(e);for(var t=0;t<this._extensions.length;){if(this._extensions[t].processTelemetry){this._extensions[t].processTelemetry(e);break}t++}},e.prototype.addNotificationListener=function(e){this._notificationManager.addNotificationListener(e)},e.prototype.removeNotificationListener=function(e){this._notificationManager.removeNotificationListener(e)},e.prototype.pollInternalLogs=function(){var n=this;if(!(0<this.config.diagnosticLoggingInterval))throw Error("config.diagnosticLoggingInterval must be a positive integer");return setInterval(function(){var e=n.logger.queue;e.forEach(function(e){var t={name:"InternalMessageId: "+e.messageId,instrumentationKey:n.config.instrumentationKey,timestamp:new Date,baseType:s.dataType,baseData:{message:e.message}};n.track(t)}),e.length=0},this.config.diagnosticLoggingInterval)},e.prototype._validateTelmetryItem=function(e){if(p.isNullOrUndefined(e.name))throw this._notifiyInvalidEvent(e),Error("telemetry name required");if(p.isNullOrUndefined(e.timestamp))throw this._notifiyInvalidEvent(e),Error("telemetry timestamp required");if(p.isNullOrUndefined(e.instrumentationKey))throw this._notifiyInvalidEvent(e),Error("telemetry instrumentationKey required")},e.prototype._notifiyInvalidEvent=function(e){this._notificationManager.eventsDiscarded([e],t)},e}(),l=function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=g}return e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,i,r){var o=this;if(this.channelQueue=new Array,n.channels)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,r)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);o.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<r.length;t++){var a=r[t];a.priority>g&&e.push(a)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,r)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}},e}(),f="Extensions must provide callback to initialize",g=200;(i=r||(r={}))[i.LocalStorage=0]="LocalStorage",i[i.SessionStorage=1]="SessionStorage",(o=m||(m={}))[o.Default=0]="Default",o[o.Required=1]="Required",o[o.Array=2]="Array",o[o.Hidden=4]="Hidden";var d=function(){function e(){}return e.requestContextHeader="Request-Context",e.requestContextTargetKey="appId",e.requestContextAppIdFormat="appId=cid-v1:",e.requestIdHeader="Request-Id",e.sdkContextHeader="Sdk-Context",e.sdkContextHeaderAppIdRequest="appId",e.requestContextHeaderLowerCase="request-context",e}(),y=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var i=t.length,r=s.sanitizeKey(e,t);if(r.length!==i){for(var o=0,a=r;void 0!==n[a];)o++,a=r.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(o);r=a}return r},s.sanitizeKey=function(e,t){return t&&(t=s.trim(t.toString())).length>s.MAX_NAME_LENGTH&&(t=t.substring(0,s.MAX_NAME_LENGTH),e.throwInternal(h.LoggingSeverity.WARNING,v.NameTooLong,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),t},s.sanitizeString=function(e,t,n){return void 0===n&&(n=s.MAX_STRING_LENGTH),t&&(n=n||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>n&&(t=t.toString().substring(0,n),e.throwInternal(h.LoggingSeverity.WARNING,v.StringValueTooLong,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,v.UrlTooLong)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(h.LoggingSeverity.WARNING,v.MessageTruncated,"message is too long, it has been truncated to "+s.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),t},s.sanitizeException=function(e,t){return t&&t.length>s.MAX_EXCEPTION_LENGTH&&(t=t.substring(0,s.MAX_EXCEPTION_LENGTH),e.throwInternal(h.LoggingSeverity.WARNING,v.ExceptionTruncated,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(e,t){if(t){var n={};for(var i in t){var r=s.sanitizeString(e,t[i],s.MAX_PROPERTY_LENGTH);n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=r}t=n}return t},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var i in t){var r=t[i];n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=r}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,v.IdTooLong).toString():t},s.sanitizeInput=function(e,t,n,i){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(h.LoggingSeverity.WARNING,i,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),t},s.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.MAX_NAME_LENGTH=150,s.MAX_ID_LENGTH=128,s.MAX_PROPERTY_LENGTH=8192,s.MAX_STRING_LENGTH=1024,s.MAX_URL_LENGTH=2048,s.MAX_MESSAGE_LENGTH=32768,s.MAX_EXCEPTION_LENGTH=32768,s}(),_=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(r.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,i=null;try{if("undefined"==typeof window)return null;n=new Date,(i=e===r.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=i.getItem(n)!=n,i.removeItem(n),t&&(i=null)}catch(e){i=null}return i},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(r.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserCannotReadLocalStorage,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var i=s._getLocalStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserCannotWriteLocalStorage,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserFailedRemovalFromLocalStorage,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(r.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(r.SessionStorage)),s._canUseSessionStorage},s.getSessionStorageKeys=function(){var e=[];if(s.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},s.getSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserCannotReadSessionStorage,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var i=s._getSessionStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserCannotWriteSessionStorage,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(h.LoggingSeverity.WARNING,v.BrowserFailedRemovalFromSessionStorage,"Browser failed removal of session storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.disableCookies=function(){s._canUseCookies=!1},s.canUseCookies=function(t){if(void 0===s._canUseCookies){s._canUseCookies=!1;try{s._canUseCookies=void 0!==s.document.cookie}catch(e){t.throwInternal(h.LoggingSeverity.WARNING,v.CannotAccessCookie,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,i){var r="",o="";i&&(r=";domain="+i),s.document.location&&"https:"===s.document.location.protocol&&(o=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+r+";path=/"+o)},s.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},s.getCookie=function(e,t){if(s.canUseCookies(e)){var n="";if(t&&t.length)for(var i=t+"=",r=s.document.cookie.split(";"),o=0;o<r.length;o++){var a=r[o];if((a=s.trim(a))&&0===a.indexOf(i)){n=a.substring(i.length,r[o].length);break}}return n}},s.deleteCookie=function(e,t){s.canUseCookies(e)&&(s.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.newId=function(){for(var e="",t=1073741824*Math.random();0<t;){e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64)}return e},s.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},s.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},s.toISOStringForIE8=function(e){if(s.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},s.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},s.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,i=""+Math.floor(e/6e4)%60,r=""+Math.floor(e/36e5)%24,o=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,i=i.length<2?"0"+i:i,(0<o?o+".":"")+(r=r.length<2?"0"+r:r)+":"+i+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,i,r){return("Script error."===e||"Script error"===e)&&!r},s.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},s.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},s.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},s.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},s.document="undefined"!=typeof document?document:{},s._canUseCookies=void 0,s._canUseLocalStorage=void 0,s._canUseSessionStorage=void 0,s._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],s.NotSpecified="not_specified",s}(),S=function(){function i(){}return i.parseUrl=function(e){return i.htmlAnchorElement||(i.htmlAnchorElement=i.document.createElement?i.document.createElement("a"):{}),i.htmlAnchorElement.href=e,i.htmlAnchorElement},i.getAbsoluteUrl=function(e){var t,n=i.parseUrl(e);return n&&(t=n.href),t},i.getPathName=function(e){var t,n=i.parseUrl(e);return n&&(t=n.pathname),t},i.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},i.document="undefined"!=typeof document?document:{},i}(),I=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,i){var r,o;if(t&&0<t.length){var a=S.parseUrl(t);if(r=a.host,null!=a.pathname)"/"!==(i=0===a.pathname.length?"/":a.pathname).charAt(0)&&(i="/"+i),o=y.sanitizeString(e,n?n+" "+i:i);else o=y.sanitizeString(e,t)}else o=r=i;return{target:r,name:o}},e}(),E=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||p.isNullOrUndefined(e)||p.isNullOrUndefined(t)||(n=t-e),n}}(),function(e,t){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)});function T(e,t){function n(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var w,b,C=function(e){function t(){return e.call(this)||this}return T(t,e),t}(function(){}),N=function(r){function e(e,t,n){var i=r.call(this)||this;return i.name=y.sanitizeString(e,n)||_.NotSpecified,i.data=t,i.time=_.toISOStringForIE8(new Date),i.aiDataContract={time:m.Required,iKey:m.Required,name:m.Required,sampleRate:function(){return 100==i.sampleRate?m.Hidden:m.Required},tags:m.Required,data:m.Required},i}return T(e,r),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),x=function(){},L=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return T(e,t),e}(x),A=function(o){function e(e,t,n,i){var r=o.call(this)||this;return r.aiDataContract={ver:m.Required,name:m.Required,properties:m.Default,measurements:m.Default},r.name=y.sanitizeString(e,t)||_.NotSpecified,r.properties=y.sanitizeProperties(e,n),r.measurements=y.sanitizeMeasurements(e,i),r}return T(e,o),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(L),D=function(){},R=function(){this.hasFullStack=!0,this.parsedStack=[]},M=function(a){function e(e,t,n,i,r){var o=a.call(this)||this;return o.aiDataContract={ver:m.Required,exceptions:m.Required,severityLevel:m.Default,properties:m.Default,measurements:m.Default},o.properties=y.sanitizeProperties(e,n),o.measurements=y.sanitizeMeasurements(e,i),o.exceptions=[new O(e,t)],r&&(o.severityLevel=r),o}return T(e,a),e.CreateSimpleException=function(e,t,n,i,r,o){return{exceptions:[{hasFullStack:!0,message:e,stack:r,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return T(e,t),e}(x)),O=function(r){function e(e,t){var n=r.call(this)||this;n.aiDataContract={id:m.Default,outerId:m.Default,typeName:m.Required,message:m.Required,hasFullStack:m.Default,stack:m.Default,parsedStack:m.Array},n.typeName=y.sanitizeString(e,t.name)||_.NotSpecified,n.message=y.sanitizeMessage(e,t.message)||_.NotSpecified;var i=t.stack;return n.parsedStack=n.parseStack(i),n.stack=y.sanitizeException(e,i),n.hasFullStack=_.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return T(e,r),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var i=0,r=0,o=0;o<=n.length;o++){var a=n[o];if(U.regex.test(a)){var s=new U(n[o],i++);r+=s.sizeInBytes,t.push(s)}}if(32768<r)for(var l=0,u=t.length-1,c=0,f=l,g=u;l<u;){if(32768<(c+=t[l].sizeInBytes+t[u].sizeInBytes)){var d=g-f+1;t.splice(f,d);break}f=l,g=u,l++,u--}}return t},e}(R),U=function(r){function o(e,t){var n=r.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:m.Required,method:m.Required,assembly:m.Default,fileName:m.Default,line:m.Default},n.level=t,n.method="<no_method>",n.assembly=_.trim(e);var i=e.match(o.regex);return i&&5<=i.length&&(n.method=_.trim(i[2])||n.method,n.fileName=_.trim(i[4]),n.line=parseInt(i[5])||0),n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=o.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}return T(o,r),o.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,o.baseSize=58,o}(D),F=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return T(e,t),e}(x);(b=w||(w={}))[b.Measurement=0]="Measurement",b[b.Aggregation=1]="Aggregation";var P,z,B=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:m.Required,kind:m.Default,value:m.Required,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default},e}return T(e,t),e}(function(){this.kind=w.Measurement}),k=function(u){function e(e,t,n,i,r,o,a){var s=u.call(this)||this;s.aiDataContract={ver:m.Required,metrics:m.Required,properties:m.Default};var l=new B;return l.count=0<i?i:void 0,l.max=isNaN(o)||null===o?void 0:o,l.min=isNaN(r)||null===r?void 0:r,l.name=y.sanitizeString(e,t)||_.NotSpecified,l.value=n,s.metrics=[l],s.properties=y.sanitizeProperties(e,a),s}return T(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(F),q=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return T(e,t),e}(L),V=function(l){function e(e,t,n,i,r,o,a){var s=l.call(this)||this;return s.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,properties:m.Default,measurements:m.Default,id:m.Default},s.id=y.sanitizeId(e,a),s.url=y.sanitizeUrl(e,n),s.name=y.sanitizeString(e,t)||_.NotSpecified,isNaN(i)||(s.duration=_.msToTimeSpan(i)),s.properties=y.sanitizeProperties(e,r),s.measurements=y.sanitizeMeasurements(e,o),s}return T(e,l),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(q),G=function(g){function e(e,t,n,i,r,o,a,s,l,u){var c=g.call(this)||this;c.aiDataContract={id:m.Required,ver:m.Required,name:m.Default,resultCode:m.Default,duration:m.Default,success:m.Default,data:m.Default,target:m.Default,type:m.Default,properties:m.Default,measurements:m.Default,kind:m.Default,value:m.Default,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default,dependencyKind:m.Default,dependencySource:m.Default,commandName:m.Default,dependencyTypeName:m.Default},c.id=t,c.duration=_.msToTimeSpan(r),c.success=o,c.resultCode=a+"",c.type="Ajax",c.data=y.sanitizeUrl(e,i);var f=I.ParseDependencyPath(e,n,s,i);return c.target=f.target,c.name=f.name,c.properties=y.sanitizeProperties(e,l),c.measurements=y.sanitizeMeasurements(e,u),c}return T(e,g),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return T(e,t),e}(x)),j=function(o){function e(e,t,n,i){var r=o.call(this)||this;return r.aiDataContract={ver:m.Required,message:m.Required,severityLevel:m.Default,properties:m.Default},t=t||_.NotSpecified,r.message=y.sanitizeMessage(e,t),r.properties=y.sanitizeProperties(e,n),i&&(r.severityLevel=i),r}return T(e,o),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return T(e,t),e}(x)),X=function(d){function p(e,t,n,i,r,o){var a=d.call(this)||this;a.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,perfTotal:m.Default,networkConnect:m.Default,sentRequest:m.Default,receivedResponse:m.Default,domProcessing:m.Default,properties:m.Default,measurements:m.Default},a.isValid=!1;var s=p.getPerformanceTiming();if(s){var l=p.getDuration(s.navigationStart,s.loadEventEnd),u=p.getDuration(s.navigationStart,s.connectEnd),c=p.getDuration(s.requestStart,s.responseStart),f=p.getDuration(s.responseStart,s.responseEnd),g=p.getDuration(s.responseEnd,s.loadEventEnd);0==l?e.throwInternal(h.LoggingSeverity.WARNING,v.ErrorPVCalc,"error calculating page view performance.",{total:l,network:u,request:c,response:f,dom:g}):p.shouldCollectDuration(l,u,c,f,g)?l<Math.floor(u)+Math.floor(c)+Math.floor(f)+Math.floor(g)?e.throwInternal(h.LoggingSeverity.WARNING,v.ClientPerformanceMathError,"client performance math error.",{total:l,network:u,request:c,response:f,dom:g}):(a.durationMs=l,a.perfTotal=a.duration=_.msToTimeSpan(l),a.networkConnect=_.msToTimeSpan(u),a.sentRequest=_.msToTimeSpan(c),a.receivedResponse=_.msToTimeSpan(f),a.domProcessing=_.msToTimeSpan(g),a.isValid=!0):e.throwInternal(h.LoggingSeverity.WARNING,v.InvalidDurationValue,"Invalid page load duration value. Browser perf data won't be sent.",{total:l,network:u,request:c,response:f,dom:g})}return a.url=y.sanitizeUrl(e,n),a.name=y.sanitizeString(e,t)||_.NotSpecified,a.properties=y.sanitizeProperties(e,r),a.measurements=y.sanitizeMeasurements(e,o),a}return T(p,d),p.prototype.getIsValid=function(){return this.isValid},p.prototype.getDurationMs=function(){return this.durationMs},p.getPerformanceTiming=function(){return p.isPerformanceTimingSupported()?window.performance.timing:null},p.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},p.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},p.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},p.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],i=navigator.userAgent,r=!1;if(i)for(var o=0;o<n.length;o++)r=r||-1!==i.toLowerCase().indexOf(n[o]);if(r)return!1;for(var a=0;a<e.length;a++)if(e[a]>=p.MAX_DURATION_ALLOWED)return!1;return!0},p.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",p.dataType="PageviewPerformanceData",p.MAX_DURATION_ALLOWED=36e5,p}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return T(e,t),e}(q)),H=function(i){function e(e,t){var n=i.call(this)||this;return n.aiDataContract={baseType:m.Required,baseData:m.Required},n.baseType=e,n.baseData=t,n}return T(e,i),e}(C);(z=P||(P={}))[z.Verbose=0]="Verbose",z[z.Information=1]="Information",z[z.Warning=2]="Warning",z[z.Error=3]="Error",z[z.Critical=4]="Critical";var W=function(){function e(e){this._config=e,this._buffer=[]}return e.prototype.enqueue=function(e){this._buffer.push(e)},e.prototype.count=function(){return this._buffer.length},e.prototype.clear=function(){this._buffer.length=0},e.prototype.getItems=function(){return this._buffer.slice(0)},e.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},e.prototype.markAsSent=function(e){this.clear()},e.prototype.clearSent=function(e){},e}(),K=function(){function r(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(r.BUFFER_KEY),i=this.getBuffer(r.SENT_BUFFER_KEY);this._buffer=n.concat(i),this._buffer.length>r.MAX_BUFFER_SIZE&&(this._buffer.length=r.MAX_BUFFER_SIZE),this.setBuffer(r.SENT_BUFFER_KEY,[]),this.setBuffer(r.BUFFER_KEY,this._buffer)}return r.prototype.enqueue=function(e){this._buffer.length>=r.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(this._logger.throwInternal(h.LoggingSeverity.WARNING,v.SessionStorageBufferFull,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(e),this.setBuffer(r.BUFFER_KEY,this._buffer))},r.prototype.count=function(){return this._buffer.length},r.prototype.clear=function(){this._buffer.length=0,this.setBuffer(r.BUFFER_KEY,[]),this.setBuffer(r.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},r.prototype.getItems=function(){return this._buffer.slice(0)},r.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},r.prototype.markAsSent=function(e){this._buffer=this.removePayloadsFromBuffer(e,this._buffer),this.setBuffer(r.BUFFER_KEY,this._buffer);var t=this.getBuffer(r.SENT_BUFFER_KEY);t instanceof Array&&e instanceof Array&&((t=t.concat(e)).length>r.MAX_BUFFER_SIZE&&(this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.SessionStorageBufferFull,"Sent buffer reached its maximum size: "+t.length,!0),t.length=r.MAX_BUFFER_SIZE),this.setBuffer(r.SENT_BUFFER_KEY,t))},r.prototype.clearSent=function(e){var t=this.getBuffer(r.SENT_BUFFER_KEY);t=this.removePayloadsFromBuffer(e,t),this.setBuffer(r.SENT_BUFFER_KEY,t)},r.prototype.removePayloadsFromBuffer=function(e,t){var n=[];for(var i in t){var r=!1;for(var o in e)if(e[o]===t[i]){r=!0;break}r||n.push(t[i])}return n},r.prototype.getBuffer=function(t){try{var e=_.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.FailedToRestoreStorageBuffer," storage key: "+t+", "+_.getExceptionName(e),{exception:_.dump(e)})}return[]},r.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);_.setSessionStorage(this._logger,t,n)}catch(e){_.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(h.LoggingSeverity.WARNING,v.FailedToSetStorageBuffer," storage key: "+t+", "+_.getExceptionName(e)+". Buffer cleared",{exception:_.dump(e)})}},r.BUFFER_KEY="AI_buffer",r.SENT_BUFFER_KEY="AI_sentBuffer",r.MAX_BUFFER_SIZE=2e3,r}(),Y=["ai.application.ver","ai.application.build","ai.application.typeId","ai.application.applicationId","ai.application.layer","ai.device.id","ai.device.ip","ai.device.language","ai.device.locale","ai.device.model","ai.device.friendlyName","ai.device.network","ai.device.networkName","ai.device.oemName","ai.device.os","ai.device.osVersion","ai.device.roleInstance","ai.device.roleName","ai.device.screenResolution","ai.device.type","ai.device.machineName","ai.device.vmName","ai.device.browser","ai.device.browserVersion","ai.location.ip","ai.location.country","ai.location.province","ai.location.city","ai.operation.id","ai.operation.name","ai.operation.parentId","ai.operation.rootId","ai.operation.syntheticSource","ai.operation.correlationVector","ai.session.id","ai.session.isFirst","ai.session.isNew","ai.user.accountAcquisitionDate","ai.user.accountId","ai.user.userAgent","ai.user.id","ai.user.storeRegion","ai.user.authUserId","ai.user.anonUserAcquisitionDate","ai.user.authUserAcquisitionDate","ai.cloud.name","ai.cloud.role","ai.cloud.roleVer","ai.cloud.roleInstance","ai.cloud.environment","ai.cloud.location","ai.cloud.deploymentUnit","ai.internal.sdkVersion","ai.internal.agentVersion","ai.internal.nodeName"],J=function(){function e(){}return e.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];"number"!=typeof i&&(t||(t={}),t[n]=i)}return t},e.extractPropsAndMeasurements=function(e,t,n){if(!p.isNullOrUndefined(e))for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];"number"==typeof r?n[i]=r:t[i]=r}},e.createEnvelope=function(e,t,n,i){var r=new N(e,i,t);r.iKey=n.instrumentationKey;var o=n.instrumentationKey.replace(/-/g,"");for(var a in r.name=r.name.replace("{0}",o),n.ctx)n.ctx.hasOwnProperty(a)&&0<=Y.indexOf(a)&&(r.tags[a]=n.ctx[a]);return n.tags||(n.tags=[]),n.tags.forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&0<=Y.indexOf(t)&&(r.tags[t]=e[t])}),r},e}(),Z=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n={},i={};J.extractPropsAndMeasurements(t.data,i,n);var r=t.baseData;if(p.isNullOrUndefined(r))return e.warnToConsole("Invalid input for dependency data"),null;var o=r.id,a=r.absoluteUrl,s=r.commandName,l=r.duration,u=r.success,c=r.resultCode,f=r.method,g=new G(e,o,a,s,l,u,c,f,i,n),d=new H(G.dataType,g);return J.createEnvelope(e,G.envelopeType,t,d)},t.DependencyEnvelopeCreator=new t,t}(J),Q=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n={},i={};t.baseType!==A.dataType&&J.extractPropsAndMeasurements(t.baseData,n,i),J.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.name,o=new A(e,r,n,i),a=new H(A.dataType,o);return J.createEnvelope(e,A.envelopeType,t,a)},t.EventEnvelopeCreator=new t,t}(J),$=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n={},i={};J.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.error,o=t.baseData.severityLevel,a=new M(e,r,n,i,o),s=new H(M.dataType,a);return J.createEnvelope(e,M.envelopeType,t,s)},t.ExceptionEnvelopeCreator=new t,t}(J),ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n=J.extractProperties(t.data),i=t.baseData.name,r=t.baseData.average,o=t.baseData.sampleCount,a=t.baseData.min,s=t.baseData.max,l=new k(e,i,r,o,a,s,n),u=new H(k.dataType,l);return J.createEnvelope(e,k.envelopeType,t,u)},t.MetricEnvelopeCreator=new t,t}(J),te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n=void 0;p.isNullOrUndefined(t.data)||p.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration);var i={},r={};J.extractPropsAndMeasurements(t.data,i,r);var o=t.baseData.name,a=t.baseData.uri;if(p.isNullOrUndefined(t.baseData.refUri)||(i.refUri=t.baseData.refUri),p.isNullOrUndefined(t.baseData.pageType)||(i.pageType=t.baseData.pageType),p.isNullOrUndefined(t.baseData.isLoggedIn)||(i.isLoggedIn=t.baseData.isLoggedIn),!p.isNullOrUndefined(t.baseData.pageTags)){var s=t.baseData.pageTags;for(var l in s)s.hasOwnProperty(l)&&(i[l]=s[l])}var u=new V(e,o,a,n,i,r),c=new H(V.dataType,u);return J.createEnvelope(e,V.envelopeType,t,c)},t.PageViewEnvelopeCreator=new t,t}(J),ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n={},i={};J.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.name,o=t.baseData.uri,a=t.baseData.duration,s=new X(e,r,o,a,n,i),l=new H(X.dataType,s);return J.createEnvelope(e,X.envelopeType,t,l)},t.PageViewPerformanceEnvelopeCreator=new t,t}(J),ie=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.Create=function(e,t){this._logger=e,p.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,i=t.baseData.severityLevel,r=J.extractProperties(t.data),o=new j(e,n,r,i),a=new H(j.dataType,o);return J.createEnvelope(e,j.envelopeType,t,a)},t.TraceEnvelopeCreator=new t,t}(J),re=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),ae=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),se=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),ce=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),fe=function(){function e(e){this._logger=e}return e.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},e.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",i={};if(!e)return this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.CannotSerializeObject,"cannot serialize object because it is null or undefined",{name:t},!0),i;if(e[n])return this._logger.throwInternal(h.LoggingSeverity.WARNING,v.CircularReferenceDetected,"Circular reference detected while serializing object",{name:t},!0),i;if(!e.aiDataContract){if("measurements"===t)i=this._serializeStringMap(e,"number",t);else if("properties"===t)i=this._serializeStringMap(e,"string",t);else if("tags"===t)i=this._serializeStringMap(e,"string",t);else if(_.isArray(e))i=this._serializeArray(e,t);else{this._logger.throwInternal(h.LoggingSeverity.WARNING,v.CannotSerializeObjectNonSerializable,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),i=e}catch(e){this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.CannotSerializeObject,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return i}for(var r in e[n]=!0,e.aiDataContract){var o,a=e.aiDataContract[r],s="function"==typeof a?a()&m.Required:a&m.Required,l="function"==typeof a?a()&m.Hidden:a&m.Hidden,u=a&m.Array,c=void 0!==e[r],f="object"==typeof e[r]&&null!==e[r];if(!s||c||u){if(!l)void 0!==(o=f?u?this._serializeArray(e[r],r):this._serializeObject(e[r],r):e[r])&&(i[r]=o)}else this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.MissingRequiredFieldSpecification,"Missing required field specification. The field is required but not present on source",{field:r,name:t})}return delete e[n],i},e.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(_.isArray(e)){n=[];for(var i=0;i<e.length;i++){var r=e[i],o=this._serializeObject(r,t+"["+i+"]");n.push(o)}}else this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.ItemNotInArray,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},e.prototype._serializeStringMap=function(e,t,n){var i=void 0;if(e)for(var r in i={},e){var o=e[r];if("string"===t)void 0===o?i[r]="undefined":null===o?i[r]="null":o.toString?i[r]=o.toString():i[r]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===o)i[r]="undefined";else if(null===o)i[r]="null";else{var a=parseFloat(o);isNaN(a)?i[r]="NaN":i[r]=a}else i[r]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(h.LoggingSeverity.CRITICAL,i[r],null,!0)}return i},e}(),ge=function(){function e(){this._onlineStatus=!0,"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,de=function(){function o(){this.priority=201,this._XMLHttpRequestSupported=!1}return o.prototype.pause=function(){throw new Error("Method not implemented.")},o.prototype.resume=function(){throw new Error("Method not implemented.")},o.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.FlushFailed,"flush failed, telemetry will not be collected: "+_.getExceptionName(e),{exception:_.dump(e)})}},o.prototype.teardown=function(){throw new Error("Method not implemented.")},o.prototype.initialize=function(e,t,n){(this.identifier="AppInsightsChannelPlugin",this._logger=t.logger,this._serializer=new fe(t.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._config=o._getDefaultAppInsightsChannelConfig(e,this.identifier),this._sender=null,this._buffer=_.canUseSessionStorage()&&this._config.enableSessionStorageBuffer?new K(this._logger,this._config):new W(this._config),!this._config.isBeaconApiDisabled()&&_.IsBeaconApiSupported())?this._sender=this._beaconSender:"undefined"!=typeof XMLHttpRequest&&("withCredentials"in new XMLHttpRequest?(this._sender=this._xhrSender,this._XMLHttpRequestSupported=!0):"undefined"!=typeof XDomainRequest&&(this._sender=this._xdrSender))},o.prototype.processTelemetry=function(e){try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.CannotSendEmptyTelemetry,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.SenderNotInitialized,"Sender was not initialized");if(!o._validate(e))return void this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TelemetryEnvelopeInvalid,"Invalid telemetry envelope");var t=this._constructEnvelope(e);if(!t)return void this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.CreateEnvelopeError,"Unable to create an AppInsights envelope");var n=this._serializer.serialize(t),i=this._buffer.getItems(),r=this._buffer.batchPayloads(i);r&&r.length+n.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(n),this._setupTimer()}catch(e){this._logger.throwInternal(h.LoggingSeverity.WARNING,v.FailedAddingTelemetryToBuffer,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+_.getExceptionName(e),{exception:_.dump(e)})}p.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},o.prototype.setNextPlugin=function(e){this._nextPlugin=e},o.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var i=null;if(this._appId||(i=this._parseResponse(e.responseText||e.response))&&i.appId&&(this._appId=i.appId),(e.status<200||300<=e.status)&&0!==e.status)!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(h.LoggingSeverity.WARNING,v.TransmissionFailed,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(0===e.status||ge.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(h.LoggingSeverity.WARNING,v.TransmissionFailed,". Offline - Response Code: "+e.status+". Offline status: "+ge.isOffline()+". Will retry to send "+t.length+" items.")}}else 206===e.status?(i||(i=this._parseResponse(e.responseText||e.response)),i&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,i):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},o.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!_.getIEVersion()||9<_.getIEVersion())&&this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TransmissionFailed,"Telemetry transmission failed, some telemetry will be lost: "+_.getExceptionName(e),{exception:_.dump(e)})}},o.prototype._onError=function(e,t,n){this._logger.throwInternal(h.LoggingSeverity.WARNING,v.OnError,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},o.prototype._onPartialSuccess=function(e,t){for(var n=[],i=[],r=0,o=t.errors.reverse();r<o.length;r++){var a=o[r],s=e.splice(a.index,1)[0];this._isRetriable(a.statusCode)?i.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<i.length&&(this._resendPayload(i),this._logger.throwInternal(h.LoggingSeverity.WARNING,v.TransmissionFailed,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+i.length+" our of "+t.itemsReceived+" items"))},o.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},o.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},o.prototype._constructEnvelope=function(e){switch(e.baseType){case A.dataType:return Q.EventEnvelopeCreator.Create(this._logger,e);case j.dataType:return ie.TraceEnvelopeCreator.Create(this._logger,e);case V.dataType:return te.PageViewEnvelopeCreator.Create(this._logger,e);case X.dataType:return ne.PageViewPerformanceEnvelopeCreator.Create(this._logger,e);case M.dataType:return $.ExceptionEnvelopeCreator.Create(this._logger,e);case k.dataType:return ee.MetricEnvelopeCreator.Create(this._logger,e);case G.dataType:return Z.DependencyEnvelopeCreator.Create(this._logger,e);default:return Q.EventEnvelopeCreator.Create(this._logger,e)}},o._getDefaultAppInsightsChannelConfig=function(e,t){var n={},i=e.extensionConfig&&e.extensionConfig[t]?e.extensionConfig[t]:{};return n.endpointUrl=function(){return e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},n.emitLineDelimitedJson=function(){return _.stringToBoolOrDefault(i.emitLineDelimitedJson)},n.maxBatchInterval=function(){return isNaN(i.maxBatchInterval)?15e3:i.maxBatchInterval},n.maxBatchSizeInBytes=function(){return 0<i.maxBatchSizeInBytes?i.maxBatchSizeInBytes:102400},n.disableTelemetry=function(){return _.stringToBoolOrDefault(i.disableTelemetry)},n.enableSessionStorageBuffer=function(){return _.stringToBoolOrDefault(i.enableSessionStorageBuffer,!0)},n.isRetryDisabled=function(){return _.stringToBoolOrDefault(i.isRetryDisabled)},n.isBeaconApiDisabled=function(){return _.stringToBoolOrDefault(i.isBeaconApiDisabled,!0)},n},o._validate=function(e){switch(e.baseType){case A.dataType:return re.EventValidator.Validate(e);case j.dataType:return oe.TraceValidator.Validate(e);case M.dataType:return ae.ExceptionValidator.Validate(e);case k.dataType:return se.MetricValidator.Validate(e);case V.dataType:return ue.PageViewValidator.Validate(e);case X.dataType:return le.PageViewPerformanceValidator.Validate(e);case G.dataType:return ce.RemoteDepdencyValidator.Validate(e);default:return re.EventValidator.Validate(e)}},o.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),i=this._buffer.batchPayloads(e),r=new Blob([i],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,r)?this._buffer.markAsSent(e):this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.TransmissionFailed,". Failed to send telemetry with Beacon API.")},o.prototype._xhrSender=function(t,e){var n=this,i=new XMLHttpRequest;i.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,i.open("POST",this._config.endpointUrl(),e),i.setRequestHeader("Content-type","application/json"),_.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&i.setRequestHeader(d.sdkContextHeader,d.sdkContextHeaderAppIdRequest),i.onreadystatechange=function(){return n._xhrReadyStateChange(i,t,t.length)},i.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(i),e)};var r=this._buffer.batchPayloads(t);i.send(r),this._buffer.markAsSent(t)},o.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(h.LoggingSeverity.CRITICAL,v.InvalidBackendResponse,"Cannot parse the response. "+_.getExceptionName(e),{response:t})}return null},o.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,i=e;n<i.length;n++){var r=i[n];this._buffer.enqueue(r)}this._setRetryTime(t),this._setupTimer()}},o.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,i=Math.floor(Math.random()*n*10)+1;i*=e,t=Math.max(Math.min(i,3600),10)}var r=Date.now()+1e3*t;this._retryAt=r},o.prototype._setupTimer=function(){var e=this;if(!this._timeoutHandle){var t=this._retryAt?Math.max(0,this._retryAt-Date.now()):0,n=Math.max(this._config.maxBatchInterval(),t);this._timeoutHandle=setTimeout(function(){e.triggerSend()},n)}},o.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},o.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},o.prototype._xdrSender=function(t,e){var n=this,i=new XDomainRequest;i.onload=function(){return n._xdrOnLoad(i,t)},i.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(i),e)};var r=window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(r,0))return this._logger.throwInternal(h.LoggingSeverity.WARNING,v.TransmissionFailed,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var o=this._config.endpointUrl().replace(/^(https?:)/,"");i.open("POST",o);var a=this._buffer.batchPayloads(t);i.send(a),this._buffer.markAsSent(t)},o.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},o}(),pe=function(){function e(e){if(p.isNullOrUndefined(e)||p.isNullOrUndefined(e.instrumentationKey))throw new Error("Invalid input configuration");this.config=e,this.initialize()}return e.prototype.initialize=function(){this.core=new a;var e=[],t=new de;e.push(t),this.core.initialize(this.config,e),t.initialize(this.config,this.core,e)},e.prototype.track=function(e){this.core.track(e)},e.prototype.flush=function(t){void 0===t&&(t=!0),this.core.getTransmissionControls().forEach(function(e){e.forEach(function(e){t?e.flush():e.triggerSend(t)})})},e}();h.ApplicationInsights=pe,h.AppInsightsCore=a,h._InternalMessageId=v,h.CoreUtils=p,Object.defineProperty(h,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.Microsoft={})}(this,function(e){"use strict";var g,t,n=2,h=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(i,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),i=/[xy]/g,l=function(){function e(){this.listeners=[]}return e.prototype.addNotificationListener=function(e){this.listeners.push(e)},e.prototype.removeNotificationListener=function(e){for(var t=this.listeners.indexOf(e);-1<t;)this.listeners.splice(t,1),t=this.listeners.indexOf(e)},e.prototype.eventsSent=function(t){for(var n=this,e=function(e){i.listeners[e].eventsSent&&setTimeout(function(){return n.listeners[e].eventsSent(t)},0)},i=this,r=0;r<this.listeners.length;++r)e(r)},e.prototype.eventsDiscarded=function(t,n){for(var i=this,e=function(e){r.listeners[e].eventsDiscarded&&setTimeout(function(){return i.listeners[e].eventsDiscarded(t,n)},0)},r=this,o=0;o<this.listeners.length;++o)e(o)},e}();(t=g||(g={}))[t.CRITICAL=1]="CRITICAL",t[t.WARNING=2]="WARNING";var r,o,m,a,u=1,c=2,f=3,p=4,d=5,v=6,s=7,y=8,_=10,I=12,S=22,w=23,E=24,b=26,T=28,N=40,x=41,D=42,C=43,A=45,R=46,L=47,M=48,U=49,O=50,P=52,z=54,B=56,q=57,k=61,F=66,G=67,V=68,X=69,H=function(){function o(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?o.AiUserActionablePrefix:o.AiNonUserActionablePrefix)+e;var r=(t?" message:"+o.sanitizeDiagnosticText(t):"")+(i?" props:"+o.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=r}return o.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},o.dataType="MessageData",o.AiNonUserActionablePrefix="AI (Internal): ",o.AiUserActionablePrefix="AI: ",o}(),j=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},h.isNullOrUndefined(e)||(h.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),h.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),h.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),h.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,r){void 0===r&&(r=!1);var o=new H(t,n,r,i);if(this.enableDebugExceptions())throw o;if(void 0!==o&&o&&void 0!==o.message){if(r){var a=+o.messageId;(!this._messageLogged[a]||this.consoleLoggingLevel()>=g.WARNING)&&(this.warnToConsole(o.message),this._messageLogged[a]=!0)}else this.consoleLoggingLevel()>=g.WARNING&&this.warnToConsole(o.message);this.logInternalMessage(e,o)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var r="Internal events throttle limit per PageView reached for this app.",o=new H(w,r,!1);this.queue.push(o),this.warnToConsole(r)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),W=function(){function e(){this._isInitialized=!1,this._extensions=new Array,this._channelController=new K}return e.prototype.initialize=function(e,t){var n=this;if(this._isInitialized)throw Error("Core should not be initialized more than once");if(!e||h.isNullOrUndefined(e.instrumentationKey))throw Error("Please provide instrumentation key");if(this.config=e,this._notificationManager=new l,this.config.extensions=h.isNullOrUndefined(this.config.extensions)?[]:this.config.extensions,this.config.extensionConfig=h.isNullOrUndefined(this.config.extensionConfig)?{}:this.config.extensionConfig,this.config.extensionConfig.NotificationManager=this._notificationManager,this.logger=new j(e),t.forEach(function(e){if(h.isNullOrUndefined(e.initialize))throw Error(Y)}),0<this.config.extensions.length){var i=!0;if(this.config.extensions.forEach(function(e){h.isNullOrUndefined(e)&&(i=!1)}),!i)throw Error(Y)}(o=this._extensions).push.apply(o,[this._channelController].concat(t,this.config.extensions)),this._extensions=this._extensions.sort(function(e,t){var n=e,i=t,r=typeof n.processTelemetry,o=typeof i.processTelemetry;return"function"===r&&"function"===o?n.priority-i.priority:"function"===r&&"function"!==o?1:"function"!==r&&"function"===o?-1:void 0});var r={};this._extensions.forEach(function(e){var t=e;t&&t.priority&&(h.isNullOrUndefined(r[t.priority])?r[t.priority]=t.identifier:n.logger.warnToConsole("Two extensions have same priority"+r[t.priority]+", "+t.identifier))});for(var o,a=-1,s=0;s<this._extensions.length-1;s++){var u=this._extensions[s];if(!u||"function"==typeof u.processTelemetry){if(u.priority===J){a=s+1;break}this._extensions[s].setNextPlugin(this._extensions[s+1])}}if(this._channelController.initialize(this.config,this,this._extensions),this._extensions.forEach(function(e){e&&e.priority<J&&e.initialize(n.config,n,n._extensions)}),a<this._extensions.length&&this._extensions.splice(a),0===this.getTransmissionControls().length)throw new Error("No channels available");this._isInitialized=!0},e.prototype.getTransmissionControls=function(){return this._channelController.ChannelControls},e.prototype.track=function(e){if(null===e)throw this._notifiyInvalidEvent(e),Error("Invalid telemetry item");if(e.baseData&&!e.baseType)throw this._notifiyInvalidEvent(e),Error("Provide data.baseType for data.baseData");e.baseType||(e.baseType="EventData"),e.instrumentationKey||(e.instrumentationKey=this.config.instrumentationKey),e.timestamp||(e.timestamp=new Date),this._validateTelmetryItem(e);for(var t=0;t<this._extensions.length;){if(this._extensions[t].processTelemetry){this._extensions[t].processTelemetry(e);break}t++}},e.prototype.addNotificationListener=function(e){this._notificationManager.addNotificationListener(e)},e.prototype.removeNotificationListener=function(e){this._notificationManager.removeNotificationListener(e)},e.prototype.pollInternalLogs=function(){var n=this;if(!(0<this.config.diagnosticLoggingInterval))throw Error("config.diagnosticLoggingInterval must be a positive integer");return setInterval(function(){var e=n.logger.queue;e.forEach(function(e){var t={name:"InternalMessageId: "+e.messageId,instrumentationKey:n.config.instrumentationKey,timestamp:new Date,baseType:H.dataType,baseData:{message:e.message}};n.track(t)}),e.length=0},this.config.diagnosticLoggingInterval)},e.prototype._validateTelmetryItem=function(e){if(h.isNullOrUndefined(e.name))throw this._notifiyInvalidEvent(e),Error("telemetry name required");if(h.isNullOrUndefined(e.timestamp))throw this._notifiyInvalidEvent(e),Error("telemetry timestamp required");if(h.isNullOrUndefined(e.instrumentationKey))throw this._notifiyInvalidEvent(e),Error("telemetry instrumentationKey required")},e.prototype._notifiyInvalidEvent=function(e){this._notificationManager.eventsDiscarded([e],n)},e}(),K=function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=J}return e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,i,r){var o=this;if(this.channelQueue=new Array,n.channels)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,r)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);o.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<r.length;t++){var a=r[t];a.priority>J&&e.push(a)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,r)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}},e}(),Y="Extensions must provide callback to initialize",J=200;(o=r||(r={}))[o.LocalStorage=0]="LocalStorage",o[o.SessionStorage=1]="SessionStorage",(a=m||(m={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var Z=function(){function e(){}return e.requestContextHeader="Request-Context",e.requestContextTargetKey="appId",e.requestContextAppIdFormat="appId=cid-v1:",e.requestIdHeader="Request-Id",e.sdkContextHeader="Sdk-Context",e.sdkContextHeaderAppIdRequest="appId",e.requestContextHeaderLowerCase="request-context",e}(),Q=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var i=t.length,r=s.sanitizeKey(e,t);if(r.length!==i){for(var o=0,a=r;void 0!==n[a];)o++,a=r.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(o);r=a}return r},s.sanitizeKey=function(e,t){return t&&(t=s.trim(t.toString())).length>s.MAX_NAME_LENGTH&&(t=t.substring(0,s.MAX_NAME_LENGTH),e.throwInternal(g.WARNING,q,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),t},s.sanitizeString=function(e,t,n){return void 0===n&&(n=s.MAX_STRING_LENGTH),t&&(n=n||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>n&&(t=t.toString().substring(0,n),e.throwInternal(g.WARNING,k,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,F)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(g.WARNING,B,"message is too long, it has been truncated to "+s.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),t},s.sanitizeException=function(e,t){return t&&t.length>s.MAX_EXCEPTION_LENGTH&&(t=t.substring(0,s.MAX_EXCEPTION_LENGTH),e.throwInternal(g.WARNING,P,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(e,t){if(t){var n={};for(var i in t){var r=s.sanitizeString(e,t[i],s.MAX_PROPERTY_LENGTH);n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=r}t=n}return t},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var i in t){var r=t[i];n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=r}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,X).toString():t},s.sanitizeInput=function(e,t,n,i){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(g.WARNING,i,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),t},s.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.MAX_NAME_LENGTH=150,s.MAX_ID_LENGTH=128,s.MAX_PROPERTY_LENGTH=8192,s.MAX_STRING_LENGTH=1024,s.MAX_URL_LENGTH=2048,s.MAX_MESSAGE_LENGTH=32768,s.MAX_EXCEPTION_LENGTH=32768,s}(),$=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(r.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,i=null;try{if("undefined"==typeof window)return null;n=new Date,(i=e===r.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=i.getItem(n)!=n,i.removeItem(n),t&&(i=null)}catch(e){i=null}return i},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(r.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,u,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var i=s._getLocalStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,f,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,d,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(r.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(r.SessionStorage)),s._canUseSessionStorage},s.getSessionStorageKeys=function(){var e=[];if(s.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},s.getSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,c,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var i=s._getSessionStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,p,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,v,"Browser failed removal of session storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.disableCookies=function(){s._canUseCookies=!1},s.canUseCookies=function(t){if(void 0===s._canUseCookies){s._canUseCookies=!1;try{s._canUseCookies=void 0!==s.document.cookie}catch(e){t.throwInternal(g.WARNING,V,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,i){var r="",o="";i&&(r=";domain="+i),s.document.location&&"https:"===s.document.location.protocol&&(o=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+r+";path=/"+o)},s.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},s.getCookie=function(e,t){if(s.canUseCookies(e)){var n="";if(t&&t.length)for(var i=t+"=",r=s.document.cookie.split(";"),o=0;o<r.length;o++){var a=r[o];if((a=s.trim(a))&&0===a.indexOf(i)){n=a.substring(i.length,r[o].length);break}}return n}},s.deleteCookie=function(e,t){s.canUseCookies(e)&&(s.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.newId=function(){for(var e="",t=1073741824*Math.random();0<t;){e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64)}return e},s.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},s.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},s.toISOStringForIE8=function(e){if(s.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},s.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},s.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,i=""+Math.floor(e/6e4)%60,r=""+Math.floor(e/36e5)%24,o=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,i=i.length<2?"0"+i:i,(0<o?o+".":"")+(r=r.length<2?"0"+r:r)+":"+i+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,i,r){return("Script error."===e||"Script error"===e)&&!r},s.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},s.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},s.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},s.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},s.document="undefined"!=typeof document?document:{},s._canUseCookies=void 0,s._canUseLocalStorage=void 0,s._canUseSessionStorage=void 0,s._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],s.NotSpecified="not_specified",s}(),ee=function(){function i(){}return i.parseUrl=function(e){return i.htmlAnchorElement||(i.htmlAnchorElement=i.document.createElement?i.document.createElement("a"):{}),i.htmlAnchorElement.href=e,i.htmlAnchorElement},i.getAbsoluteUrl=function(e){var t,n=i.parseUrl(e);return n&&(t=n.href),t},i.getPathName=function(e){var t,n=i.parseUrl(e);return n&&(t=n.pathname),t},i.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},i.document="undefined"!=typeof document?document:{},i}(),te=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,i){var r,o;if(t&&0<t.length){var a=ee.parseUrl(t);if(r=a.host,null!=a.pathname)"/"!==(i=0===a.pathname.length?"/":a.pathname).charAt(0)&&(i="/"+i),o=Q.sanitizeString(e,n?n+" "+i:i);else o=Q.sanitizeString(e,t)}else o=r=i;return{target:r,name:o}},e}(),ne=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||h.isNullOrUndefined(e)||h.isNullOrUndefined(t)||(n=t-e),n}}(),function(e,t){return(ne=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)});function ie(e,t){function n(){this.constructor=e}ne(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var re,oe,ae=function(e){function t(){return e.call(this)||this}return ie(t,e),t}(function(){}),se=function(r){function e(e,t,n){var i=r.call(this)||this;return i.name=Q.sanitizeString(e,n)||$.NotSpecified,i.data=t,i.time=$.toISOStringForIE8(new Date),i.aiDataContract={time:m.Required,iKey:m.Required,name:m.Required,sampleRate:function(){return 100==i.sampleRate?m.Hidden:m.Required},tags:m.Required,data:m.Required},i}return ie(e,r),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ue=function(){},le=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return ie(e,t),e}(ue),ce=function(o){function e(e,t,n,i){var r=o.call(this)||this;return r.aiDataContract={ver:m.Required,name:m.Required,properties:m.Default,measurements:m.Default},r.name=Q.sanitizeString(e,t)||$.NotSpecified,r.properties=Q.sanitizeProperties(e,n),r.measurements=Q.sanitizeMeasurements(e,i),r}return ie(e,o),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(le),fe=function(){},pe=function(){this.hasFullStack=!0,this.parsedStack=[]},de=function(a){function e(e,t,n,i,r){var o=a.call(this)||this;return o.aiDataContract={ver:m.Required,exceptions:m.Required,severityLevel:m.Default,properties:m.Default,measurements:m.Default},o.properties=Q.sanitizeProperties(e,n),o.measurements=Q.sanitizeMeasurements(e,i),o.exceptions=[new he(e,t)],r&&(o.severityLevel=r),o}return ie(e,a),e.CreateSimpleException=function(e,t,n,i,r,o){return{exceptions:[{hasFullStack:!0,message:e,stack:r,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return ie(e,t),e}(ue)),he=function(r){function e(e,t){var n=r.call(this)||this;n.aiDataContract={id:m.Default,outerId:m.Default,typeName:m.Required,message:m.Required,hasFullStack:m.Default,stack:m.Default,parsedStack:m.Array},n.typeName=Q.sanitizeString(e,t.name)||$.NotSpecified,n.message=Q.sanitizeMessage(e,t.message)||$.NotSpecified;var i=t.stack;return n.parsedStack=n.parseStack(i),n.stack=Q.sanitizeException(e,i),n.hasFullStack=$.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return ie(e,r),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var i=0,r=0,o=0;o<=n.length;o++){var a=n[o];if(ge.regex.test(a)){var s=new ge(n[o],i++);r+=s.sizeInBytes,t.push(s)}}if(32768<r)for(var u=0,l=t.length-1,c=0,f=u,p=l;u<l;){if(32768<(c+=t[u].sizeInBytes+t[l].sizeInBytes)){var d=p-f+1;t.splice(f,d);break}f=u,p=l,u++,l--}}return t},e}(pe),ge=function(r){function o(e,t){var n=r.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:m.Required,method:m.Required,assembly:m.Default,fileName:m.Default,line:m.Default},n.level=t,n.method="<no_method>",n.assembly=$.trim(e);var i=e.match(o.regex);return i&&5<=i.length&&(n.method=$.trim(i[2])||n.method,n.fileName=$.trim(i[4]),n.line=parseInt(i[5])||0),n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=o.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}return ie(o,r),o.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,o.baseSize=58,o}(fe),me=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return ie(e,t),e}(ue);(oe=re||(re={}))[oe.Measurement=0]="Measurement",oe[oe.Aggregation=1]="Aggregation";var ve,ye=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:m.Required,kind:m.Default,value:m.Required,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default},e}return ie(e,t),e}(function(){this.kind=re.Measurement}),_e=function(l){function e(e,t,n,i,r,o,a){var s=l.call(this)||this;s.aiDataContract={ver:m.Required,metrics:m.Required,properties:m.Default};var u=new ye;return u.count=0<i?i:void 0,u.max=isNaN(o)||null===o?void 0:o,u.min=isNaN(r)||null===r?void 0:r,u.name=Q.sanitizeString(e,t)||$.NotSpecified,u.value=n,s.metrics=[u],s.properties=Q.sanitizeProperties(e,a),s}return ie(e,l),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(me),Ie=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return ie(e,t),e}(le),Se=function(u){function e(e,t,n,i,r,o,a){var s=u.call(this)||this;return s.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,properties:m.Default,measurements:m.Default,id:m.Default},s.id=Q.sanitizeId(e,a),s.url=Q.sanitizeUrl(e,n),s.name=Q.sanitizeString(e,t)||$.NotSpecified,isNaN(i)||(s.duration=$.msToTimeSpan(i)),s.properties=Q.sanitizeProperties(e,r),s.measurements=Q.sanitizeMeasurements(e,o),s}return ie(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(Ie),we=function(p){function e(e,t,n,i,r,o,a,s,u,l){var c=p.call(this)||this;c.aiDataContract={id:m.Required,ver:m.Required,name:m.Default,resultCode:m.Default,duration:m.Default,success:m.Default,data:m.Default,target:m.Default,type:m.Default,properties:m.Default,measurements:m.Default,kind:m.Default,value:m.Default,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default,dependencyKind:m.Default,dependencySource:m.Default,commandName:m.Default,dependencyTypeName:m.Default},c.id=t,c.duration=$.msToTimeSpan(r),c.success=o,c.resultCode=a+"",c.type="Ajax",c.data=Q.sanitizeUrl(e,i);var f=te.ParseDependencyPath(e,n,s,i);return c.target=f.target,c.name=f.name,c.properties=Q.sanitizeProperties(e,u),c.measurements=Q.sanitizeMeasurements(e,l),c}return ie(e,p),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return ie(e,t),e}(ue)),Ee=function(o){function e(e,t,n,i){var r=o.call(this)||this;return r.aiDataContract={ver:m.Required,message:m.Required,severityLevel:m.Default,properties:m.Default},t=t||$.NotSpecified,r.message=Q.sanitizeMessage(e,t),r.properties=Q.sanitizeProperties(e,n),i&&(r.severityLevel=i),r}return ie(e,o),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return ie(e,t),e}(ue)),be=function(d){function h(e,t,n,i,r,o){var a=d.call(this)||this;a.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,perfTotal:m.Default,networkConnect:m.Default,sentRequest:m.Default,receivedResponse:m.Default,domProcessing:m.Default,properties:m.Default,measurements:m.Default},a.isValid=!1;var s=h.getPerformanceTiming();if(s){var u=h.getDuration(s.navigationStart,s.loadEventEnd),l=h.getDuration(s.navigationStart,s.connectEnd),c=h.getDuration(s.requestStart,s.responseStart),f=h.getDuration(s.responseStart,s.responseEnd),p=h.getDuration(s.responseEnd,s.loadEventEnd);0==u?e.throwInternal(g.WARNING,_,"error calculating page view performance.",{total:u,network:l,request:c,response:f,dom:p}):h.shouldCollectDuration(u,l,c,f,p)?u<Math.floor(l)+Math.floor(c)+Math.floor(f)+Math.floor(p)?e.throwInternal(g.WARNING,y,"client performance math error.",{total:u,network:l,request:c,response:f,dom:p}):(a.durationMs=u,a.perfTotal=a.duration=$.msToTimeSpan(u),a.networkConnect=$.msToTimeSpan(l),a.sentRequest=$.msToTimeSpan(c),a.receivedResponse=$.msToTimeSpan(f),a.domProcessing=$.msToTimeSpan(p),a.isValid=!0):e.throwInternal(g.WARNING,A,"Invalid page load duration value. Browser perf data won't be sent.",{total:u,network:l,request:c,response:f,dom:p})}return a.url=Q.sanitizeUrl(e,n),a.name=Q.sanitizeString(e,t)||$.NotSpecified,a.properties=Q.sanitizeProperties(e,r),a.measurements=Q.sanitizeMeasurements(e,o),a}return ie(h,d),h.prototype.getIsValid=function(){return this.isValid},h.prototype.getDurationMs=function(){return this.durationMs},h.getPerformanceTiming=function(){return h.isPerformanceTimingSupported()?window.performance.timing:null},h.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},h.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},h.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},h.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],i=navigator.userAgent,r=!1;if(i)for(var o=0;o<n.length;o++)r=r||-1!==i.toLowerCase().indexOf(n[o]);if(r)return!1;for(var a=0;a<e.length;a++)if(e[a]>=h.MAX_DURATION_ALLOWED)return!1;return!0},h.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",h.dataType="PageviewPerformanceData",h.MAX_DURATION_ALLOWED=36e5,h}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return ie(e,t),e}(Ie)),Te=function(i){function e(e,t){var n=i.call(this)||this;return n.aiDataContract={baseType:m.Required,baseData:m.Required},n.baseType=e,n.baseData=t,n}return ie(e,i),e}(ae);(ve=e.SeverityLevel||(e.SeverityLevel={}))[ve.Verbose=0]="Verbose",ve[ve.Information=1]="Information",ve[ve.Warning=2]="Warning",ve[ve.Error=3]="Error",ve[ve.Critical=4]="Critical";var Ne=function(){function e(e){this._config=e,this._buffer=[]}return e.prototype.enqueue=function(e){this._buffer.push(e)},e.prototype.count=function(){return this._buffer.length},e.prototype.clear=function(){this._buffer.length=0},e.prototype.getItems=function(){return this._buffer.slice(0)},e.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},e.prototype.markAsSent=function(e){this.clear()},e.prototype.clearSent=function(e){},e}(),xe=function(){function r(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(r.BUFFER_KEY),i=this.getBuffer(r.SENT_BUFFER_KEY);this._buffer=n.concat(i),this._buffer.length>r.MAX_BUFFER_SIZE&&(this._buffer.length=r.MAX_BUFFER_SIZE),this.setBuffer(r.SENT_BUFFER_KEY,[]),this.setBuffer(r.BUFFER_KEY,this._buffer)}return r.prototype.enqueue=function(e){this._buffer.length>=r.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(this._logger.throwInternal(g.WARNING,G,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(e),this.setBuffer(r.BUFFER_KEY,this._buffer))},r.prototype.count=function(){return this._buffer.length},r.prototype.clear=function(){this._buffer.length=0,this.setBuffer(r.BUFFER_KEY,[]),this.setBuffer(r.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},r.prototype.getItems=function(){return this._buffer.slice(0)},r.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},r.prototype.markAsSent=function(e){this._buffer=this.removePayloadsFromBuffer(e,this._buffer),this.setBuffer(r.BUFFER_KEY,this._buffer);var t=this.getBuffer(r.SENT_BUFFER_KEY);t instanceof Array&&e instanceof Array&&((t=t.concat(e)).length>r.MAX_BUFFER_SIZE&&(this._logger.throwInternal(g.CRITICAL,G,"Sent buffer reached its maximum size: "+t.length,!0),t.length=r.MAX_BUFFER_SIZE),this.setBuffer(r.SENT_BUFFER_KEY,t))},r.prototype.clearSent=function(e){var t=this.getBuffer(r.SENT_BUFFER_KEY);t=this.removePayloadsFromBuffer(e,t),this.setBuffer(r.SENT_BUFFER_KEY,t)},r.prototype.removePayloadsFromBuffer=function(e,t){var n=[];for(var i in t){var r=!1;for(var o in e)if(e[o]===t[i]){r=!0;break}r||n.push(t[i])}return n},r.prototype.getBuffer=function(t){try{var e=$.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(g.CRITICAL,D," storage key: "+t+", "+$.getExceptionName(e),{exception:$.dump(e)})}return[]},r.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);$.setSessionStorage(this._logger,t,n)}catch(e){$.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(g.WARNING,x," storage key: "+t+", "+$.getExceptionName(e)+". Buffer cleared",{exception:$.dump(e)})}},r.BUFFER_KEY="AI_buffer",r.SENT_BUFFER_KEY="AI_sentBuffer",r.MAX_BUFFER_SIZE=2e3,r}(),De=["ai.application.ver","ai.application.build","ai.application.typeId","ai.application.applicationId","ai.application.layer","ai.device.id","ai.device.ip","ai.device.language","ai.device.locale","ai.device.model","ai.device.friendlyName","ai.device.network","ai.device.networkName","ai.device.oemName","ai.device.os","ai.device.osVersion","ai.device.roleInstance","ai.device.roleName","ai.device.screenResolution","ai.device.type","ai.device.machineName","ai.device.vmName","ai.device.browser","ai.device.browserVersion","ai.location.ip","ai.location.country","ai.location.province","ai.location.city","ai.operation.id","ai.operation.name","ai.operation.parentId","ai.operation.rootId","ai.operation.syntheticSource","ai.operation.correlationVector","ai.session.id","ai.session.isFirst","ai.session.isNew","ai.user.accountAcquisitionDate","ai.user.accountId","ai.user.userAgent","ai.user.id","ai.user.storeRegion","ai.user.authUserId","ai.user.anonUserAcquisitionDate","ai.user.authUserAcquisitionDate","ai.cloud.name","ai.cloud.role","ai.cloud.roleVer","ai.cloud.roleInstance","ai.cloud.environment","ai.cloud.location","ai.cloud.deploymentUnit","ai.internal.sdkVersion","ai.internal.agentVersion","ai.internal.nodeName"],Ce=function(){function e(){}return e.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];"number"!=typeof i&&(t||(t={}),t[n]=i)}return t},e.extractPropsAndMeasurements=function(e,t,n){if(!h.isNullOrUndefined(e))for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];"number"==typeof r?n[i]=r:t[i]=r}},e.createEnvelope=function(e,t,n,i){var r=new se(e,i,t);r.iKey=n.instrumentationKey;var o=n.instrumentationKey.replace(/-/g,"");for(var a in r.name=r.name.replace("{0}",o),n.ctx)n.ctx.hasOwnProperty(a)&&0<=De.indexOf(a)&&(r.tags[a]=n.ctx[a]);return n.tags||(n.tags=[]),n.tags.forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&0<=De.indexOf(t)&&(r.tags[t]=e[t])}),r},e}(),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},i={};Ce.extractPropsAndMeasurements(t.data,i,n);var r=t.baseData;if(h.isNullOrUndefined(r))return e.warnToConsole("Invalid input for dependency data"),null;var o=r.id,a=r.absoluteUrl,s=r.commandName,u=r.duration,l=r.success,c=r.resultCode,f=r.method,p=new we(e,o,a,s,u,l,c,f,i,n),d=new Te(we.dataType,p);return Ce.createEnvelope(e,we.envelopeType,t,d)},t.DependencyEnvelopeCreator=new t,t}(Ce),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},i={};t.baseType!==ce.dataType&&Ce.extractPropsAndMeasurements(t.baseData,n,i),Ce.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.name,o=new ce(e,r,n,i),a=new Te(ce.dataType,o);return Ce.createEnvelope(e,ce.envelopeType,t,a)},t.EventEnvelopeCreator=new t,t}(Ce),Le=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},i={};Ce.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.error,o=t.baseData.severityLevel,a=new de(e,r,n,i,o),s=new Te(de.dataType,a);return Ce.createEnvelope(e,de.envelopeType,t,s)},t.ExceptionEnvelopeCreator=new t,t}(Ce),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=Ce.extractProperties(t.data),i=t.baseData.name,r=t.baseData.average,o=t.baseData.sampleCount,a=t.baseData.min,s=t.baseData.max,u=new _e(e,i,r,o,a,s,n),l=new Te(_e.dataType,u);return Ce.createEnvelope(e,_e.envelopeType,t,l)},t.MetricEnvelopeCreator=new t,t}(Ce),Ue=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=void 0;h.isNullOrUndefined(t.data)||h.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration);var i={},r={};Ce.extractPropsAndMeasurements(t.data,i,r);var o=t.baseData.name,a=t.baseData.uri;if(h.isNullOrUndefined(t.baseData.refUri)||(i.refUri=t.baseData.refUri),h.isNullOrUndefined(t.baseData.pageType)||(i.pageType=t.baseData.pageType),h.isNullOrUndefined(t.baseData.isLoggedIn)||(i.isLoggedIn=t.baseData.isLoggedIn),!h.isNullOrUndefined(t.baseData.pageTags)){var s=t.baseData.pageTags;for(var u in s)s.hasOwnProperty(u)&&(i[u]=s[u])}var l=new Se(e,o,a,n,i,r),c=new Te(Se.dataType,l);return Ce.createEnvelope(e,Se.envelopeType,t,c)},t.PageViewEnvelopeCreator=new t,t}(Ce),Oe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},i={};Ce.extractPropsAndMeasurements(t.data,n,i);var r=t.baseData.name,o=t.baseData.uri,a=t.baseData.duration,s=new be(e,r,o,a,n,i),u=new Te(be.dataType,s);return Ce.createEnvelope(e,be.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(Ce),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ie(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,i=t.baseData.severityLevel,r=Ce.extractProperties(t.data),o=new Ee(e,n,r,i),a=new Te(Ee.dataType,o);return Ce.createEnvelope(e,Ee.envelopeType,t,a)},t.TraceEnvelopeCreator=new t,t}(Ce),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Be=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),qe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),ke=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),Fe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),Ge=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),Ve=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),Xe=function(){function e(e){this._logger=e}return e.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},e.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",i={};if(!e)return this._logger.throwInternal(g.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),i;if(e[n])return this._logger.throwInternal(g.WARNING,O,"Circular reference detected while serializing object",{name:t},!0),i;if(!e.aiDataContract){if("measurements"===t)i=this._serializeStringMap(e,"number",t);else if("properties"===t)i=this._serializeStringMap(e,"string",t);else if("tags"===t)i=this._serializeStringMap(e,"string",t);else if($.isArray(e))i=this._serializeArray(e,t);else{this._logger.throwInternal(g.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),i=e}catch(e){this._logger.throwInternal(g.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return i}for(var r in e[n]=!0,e.aiDataContract){var o,a=e.aiDataContract[r],s="function"==typeof a?a()&m.Required:a&m.Required,u="function"==typeof a?a()&m.Hidden:a&m.Hidden,l=a&m.Array,c=void 0!==e[r],f="object"==typeof e[r]&&null!==e[r];if(!s||c||l){if(!u)void 0!==(o=f?l?this._serializeArray(e[r],r):this._serializeObject(e[r],r):e[r])&&(i[r]=o)}else this._logger.throwInternal(g.CRITICAL,E,"Missing required field specification. The field is required but not present on source",{field:r,name:t})}return delete e[n],i},e.prototype._serializeArray=function(e,t){var n=void 0;if(e)if($.isArray(e)){n=[];for(var i=0;i<e.length;i++){var r=e[i],o=this._serializeObject(r,t+"["+i+"]");n.push(o)}}else this._logger.throwInternal(g.CRITICAL,z,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},e.prototype._serializeStringMap=function(e,t,n){var i=void 0;if(e)for(var r in i={},e){var o=e[r];if("string"===t)void 0===o?i[r]="undefined":null===o?i[r]="null":o.toString?i[r]=o.toString():i[r]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===o)i[r]="undefined";else if(null===o)i[r]="null";else{var a=parseFloat(o);isNaN(a)?i[r]="NaN":i[r]=a}else i[r]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(g.CRITICAL,i[r],null,!0)}return i},e}(),He=function(){function e(){this._onlineStatus=!0,"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,je=function(){function o(){this.priority=201,this._XMLHttpRequestSupported=!1}return o.prototype.pause=function(){throw new Error("Method not implemented.")},o.prototype.resume=function(){throw new Error("Method not implemented.")},o.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(g.CRITICAL,S,"flush failed, telemetry will not be collected: "+$.getExceptionName(e),{exception:$.dump(e)})}},o.prototype.teardown=function(){throw new Error("Method not implemented.")},o.prototype.initialize=function(e,t,n){(this.identifier="AppInsightsChannelPlugin",this._logger=t.logger,this._serializer=new Xe(t.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._config=o._getDefaultAppInsightsChannelConfig(e,this.identifier),this._sender=null,this._buffer=$.canUseSessionStorage()&&this._config.enableSessionStorageBuffer?new xe(this._logger,this._config):new Ne(this._config),!this._config.isBeaconApiDisabled()&&$.IsBeaconApiSupported())?this._sender=this._beaconSender:"undefined"!=typeof XMLHttpRequest&&("withCredentials"in new XMLHttpRequest?(this._sender=this._xhrSender,this._XMLHttpRequestSupported=!0):"undefined"!=typeof XDomainRequest&&(this._sender=this._xdrSender))},o.prototype.processTelemetry=function(e){try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(g.CRITICAL,s,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(g.CRITICAL,T,"Sender was not initialized");if(!o._validate(e))return void this._logger.throwInternal(g.CRITICAL,R,"Invalid telemetry envelope");var t=this._constructEnvelope(e);if(!t)return void this._logger.throwInternal(g.CRITICAL,L,"Unable to create an AppInsights envelope");var n=this._serializer.serialize(t),i=this._buffer.getItems(),r=this._buffer.batchPayloads(i);r&&r.length+n.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(n),this._setupTimer()}catch(e){this._logger.throwInternal(g.WARNING,I,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+$.getExceptionName(e),{exception:$.dump(e)})}h.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},o.prototype.setNextPlugin=function(e){this._nextPlugin=e},o.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var i=null;if(this._appId||(i=this._parseResponse(e.responseText||e.response))&&i.appId&&(this._appId=i.appId),(e.status<200||300<=e.status)&&0!==e.status)!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(g.WARNING,N,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(0===e.status||He.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(g.WARNING,N,". Offline - Response Code: "+e.status+". Offline status: "+He.isOffline()+". Will retry to send "+t.length+" items.")}}else 206===e.status?(i||(i=this._parseResponse(e.responseText||e.response)),i&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,i):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},o.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!$.getIEVersion()||9<$.getIEVersion())&&this._logger.throwInternal(g.CRITICAL,N,"Telemetry transmission failed, some telemetry will be lost: "+$.getExceptionName(e),{exception:$.dump(e)})}},o.prototype._onError=function(e,t,n){this._logger.throwInternal(g.WARNING,b,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},o.prototype._onPartialSuccess=function(e,t){for(var n=[],i=[],r=0,o=t.errors.reverse();r<o.length;r++){var a=o[r],s=e.splice(a.index,1)[0];this._isRetriable(a.statusCode)?i.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<i.length&&(this._resendPayload(i),this._logger.throwInternal(g.WARNING,N,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+i.length+" our of "+t.itemsReceived+" items"))},o.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},o.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},o.prototype._constructEnvelope=function(e){switch(e.baseType){case ce.dataType:return Re.EventEnvelopeCreator.Create(this._logger,e);case Ee.dataType:return Pe.TraceEnvelopeCreator.Create(this._logger,e);case Se.dataType:return Ue.PageViewEnvelopeCreator.Create(this._logger,e);case be.dataType:return Oe.PageViewPerformanceEnvelopeCreator.Create(this._logger,e);case de.dataType:return Le.ExceptionEnvelopeCreator.Create(this._logger,e);case _e.dataType:return Me.MetricEnvelopeCreator.Create(this._logger,e);case we.dataType:return Ae.DependencyEnvelopeCreator.Create(this._logger,e);default:return Re.EventEnvelopeCreator.Create(this._logger,e)}},o._getDefaultAppInsightsChannelConfig=function(e,t){var n={},i=e.extensionConfig&&e.extensionConfig[t]?e.extensionConfig[t]:{};return n.endpointUrl=function(){return e.endpointUrl||"https://dc.services.visualstudio.com/v2/track"},n.emitLineDelimitedJson=function(){return $.stringToBoolOrDefault(i.emitLineDelimitedJson)},n.maxBatchInterval=function(){return isNaN(i.maxBatchInterval)?15e3:i.maxBatchInterval},n.maxBatchSizeInBytes=function(){return 0<i.maxBatchSizeInBytes?i.maxBatchSizeInBytes:102400},n.disableTelemetry=function(){return $.stringToBoolOrDefault(i.disableTelemetry)},n.enableSessionStorageBuffer=function(){return $.stringToBoolOrDefault(i.enableSessionStorageBuffer,!0)},n.isRetryDisabled=function(){return $.stringToBoolOrDefault(i.isRetryDisabled)},n.isBeaconApiDisabled=function(){return $.stringToBoolOrDefault(i.isBeaconApiDisabled,!0)},n},o._validate=function(e){switch(e.baseType){case ce.dataType:return ze.EventValidator.Validate(e);case Ee.dataType:return Be.TraceValidator.Validate(e);case de.dataType:return qe.ExceptionValidator.Validate(e);case _e.dataType:return ke.MetricValidator.Validate(e);case Se.dataType:return Ge.PageViewValidator.Validate(e);case be.dataType:return Fe.PageViewPerformanceValidator.Validate(e);case we.dataType:return Ve.RemoteDepdencyValidator.Validate(e);default:return ze.EventValidator.Validate(e)}},o.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),i=this._buffer.batchPayloads(e),r=new Blob([i],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,r)?this._buffer.markAsSent(e):this._logger.throwInternal(g.CRITICAL,N,". Failed to send telemetry with Beacon API.")},o.prototype._xhrSender=function(t,e){var n=this,i=new XMLHttpRequest;i.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,i.open("POST",this._config.endpointUrl(),e),i.setRequestHeader("Content-type","application/json"),$.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&i.setRequestHeader(Z.sdkContextHeader,Z.sdkContextHeaderAppIdRequest),i.onreadystatechange=function(){return n._xhrReadyStateChange(i,t,t.length)},i.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(i),e)};var r=this._buffer.batchPayloads(t);i.send(r),this._buffer.markAsSent(t)},o.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(g.CRITICAL,C,"Cannot parse the response. "+$.getExceptionName(e),{response:t})}return null},o.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,i=e;n<i.length;n++){var r=i[n];this._buffer.enqueue(r)}this._setRetryTime(t),this._setupTimer()}},o.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,i=Math.floor(Math.random()*n*10)+1;i*=e,t=Math.max(Math.min(i,3600),10)}var r=Date.now()+1e3*t;this._retryAt=r},o.prototype._setupTimer=function(){var e=this;if(!this._timeoutHandle){var t=this._retryAt?Math.max(0,this._retryAt-Date.now()):0,n=Math.max(this._config.maxBatchInterval(),t);this._timeoutHandle=setTimeout(function(){e.triggerSend()},n)}},o.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},o.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},o.prototype._xdrSender=function(t,e){var n=this,i=new XDomainRequest;i.onload=function(){return n._xdrOnLoad(i,t)},i.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(i),e)};var r=window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(r,0))return this._logger.throwInternal(g.WARNING,N,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var o=this._config.endpointUrl().replace(/^(https?:)/,"");i.open("POST",o);var a=this._buffer.batchPayloads(t);i.send(a),this._buffer.markAsSent(t)},o.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},o}(),We=function(){function e(e){if(h.isNullOrUndefined(e)||h.isNullOrUndefined(e.instrumentationKey))throw new Error("Invalid input configuration");this.config=e,this.initialize()}return e.prototype.initialize=function(){this.core=new W;var e=[],t=new je;e.push(t),this.core.initialize(this.config,e),t.initialize(this.config,this.core,e)},e.prototype.track=function(e){this.core.track(e)},e.prototype.flush=function(t){void 0===t&&(t=!0),this.core.getTransmissionControls().forEach(function(e){e.forEach(function(e){t?e.flush():e.triggerSend(t)})})},e}();e.ApplicationInsights=We,e.AppInsightsCore=W,e.CoreUtils=h,e.Event=ce,e.Exception=de,e.Metric=_e,e.PageView=Se,e.PageViewPerformance=be,e.RemoteDependencyData=we,e.Trace=Ee,e.Sender=je,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=applicationinsights-web-basic.min.js.map
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { IConfiguration, AppInsightsCore, IAppInsightsCore, LoggingSeverity, _InternalMessageId, CoreUtils, ITelemetryItem } from "@microsoft/applicationinsights-core-js";
import {
IConfiguration,
AppInsightsCore,
IAppInsightsCore,
_InternalMessageId,
CoreUtils,
ITelemetryItem
} from "@microsoft/applicationinsights-core-js";
import { Sender } from "@microsoft/applicationinsights-channel-js";

@@ -23,5 +30,7 @@

constructor(config: IConfiguration) {
// initialize the queue and config in case they are undefined
if (CoreUtils.isNullOrUndefined(config) || CoreUtils.isNullOrUndefined(config.instrumentationKey)) {
if (
CoreUtils.isNullOrUndefined(config) ||
CoreUtils.isNullOrUndefined(config.instrumentationKey)
) {
throw new Error("Invalid input configuration");

@@ -35,3 +44,3 @@ }

/**
* Initialize this instance of ApplicationInsights
* Initialize this instance of ApplicationInsights
*

@@ -41,3 +50,2 @@ * @memberof ApplicationInsights

public initialize(): void {
this.core = new AppInsightsCore();

@@ -74,3 +82,5 @@ let extensions = [];

controls.forEach(plugin => {
async ? (<Sender>plugin).flush() : (<Sender>plugin).triggerSend(async);
async
? (<Sender>plugin).flush()
: (<Sender>plugin).triggerSend(async);
});

@@ -81,2 +91,19 @@ });

export { IConfiguration, AppInsightsCore, IAppInsightsCore, LoggingSeverity, _InternalMessageId, CoreUtils, ITelemetryItem };
export {
IConfiguration,
AppInsightsCore,
IAppInsightsCore,
CoreUtils,
ITelemetryItem
} from "@microsoft/applicationinsights-core-js";
export {
SeverityLevel,
Event,
Exception,
Metric,
PageView,
PageViewPerformance,
RemoteDependencyData,
Trace
} from "@microsoft/applicationinsights-common";
export { Sender } from "@microsoft/applicationinsights-channel-js";
{
"name": "@microsoft/applicationinsights-web-basic",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"description": "Microsoft Application Insights Javascript SDK core and channel",

@@ -25,2 +25,3 @@ "main": "dist/applicationinsights-web-basic.js",

"dependencies": {
"@microsoft/applicationinsights-common": "^1.0.0-beta.5",
"@microsoft/applicationinsights-channel-js": "^1.0.0-beta.4",

@@ -27,0 +28,0 @@ "@microsoft/applicationinsights-core-js": "^1.0.0-beta.2"

@@ -1,2 +0,2 @@

import { IConfiguration, AppInsightsCore, IAppInsightsCore, LoggingSeverity, _InternalMessageId, CoreUtils, ITelemetryItem } from "@microsoft/applicationinsights-core-js";
import { IConfiguration, ITelemetryItem } from "@microsoft/applicationinsights-core-js";
/**

@@ -35,2 +35,4 @@ * @export

}
export { IConfiguration, AppInsightsCore, IAppInsightsCore, LoggingSeverity, _InternalMessageId, CoreUtils, ITelemetryItem };
export { IConfiguration, AppInsightsCore, IAppInsightsCore, CoreUtils, ITelemetryItem } from "@microsoft/applicationinsights-core-js";
export { SeverityLevel, Event, Exception, Metric, PageView, PageViewPerformance, RemoteDependencyData, Trace } from "@microsoft/applicationinsights-common";
export { Sender } from "@microsoft/applicationinsights-channel-js";

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc