UNPKG

applicationinsights-js

Version:
1 lines 96.7 kB
"use strict";var AI,Microsoft,__extends=this&&this.__extends||function(){var i=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])};return function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();function _endsWith(e,t){var n=e.length,i=n-t.length;return e.substring(0<=i?i:0,n)===t}!function(e){e.ApplicationInsights||(e.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(e){var t;t=function n(){},(e.Telemetry||(e.Telemetry={})).Base=t}(Microsoft||(Microsoft={})),function(e){var t;t=function n(){this.ver=1,this.sampleRate=100,this.tags={}},(e.Telemetry||(e.Telemetry={})).Envelope=t}(Microsoft||(Microsoft={})),function(e){var t;(t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})}(Microsoft||(Microsoft={})),function(e){var t;(t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})}(Microsoft||(Microsoft={})),function(e){var t;(t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})}(Microsoft||(Microsoft={})),function(e){var t;(t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})}(Microsoft||(Microsoft={})),function(e){var t;(t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})}(Microsoft||(Microsoft={})),function(e){var t;(t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})}(Microsoft||(Microsoft={})),function(e){var t;(t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})}(Microsoft||(Microsoft={})),function(e){var t;(t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})}(Microsoft||(Microsoft={})),function(e){e.ApplicationInsights||(e.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(e){e.ApplicationInsights||(e.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(e){e.ApplicationInsights||(e.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(e){var t;(t=e.SeverityLevel||(e.SeverityLevel={}))[t.Verbose=0]="Verbose",t[t.Information=1]="Information",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.Critical=4]="Critical"}(AI||(AI={})),function(e){e.ApplicationInsights||(e.ApplicationInsights={})}(Microsoft||(Microsoft={})),function(e){!function(s){var l,e,c,t;(e=l=s.LoggingSeverity||(s.LoggingSeverity={}))[e.CRITICAL=0]="CRITICAL",e[e.WARNING=1]="WARNING",(t=c=s._InternalMessageId||(s._InternalMessageId={}))[t.BrowserDoesNotSupportLocalStorage=0]="BrowserDoesNotSupportLocalStorage",t[t.BrowserCannotReadLocalStorage=1]="BrowserCannotReadLocalStorage",t[t.BrowserCannotReadSessionStorage=2]="BrowserCannotReadSessionStorage",t[t.BrowserCannotWriteLocalStorage=3]="BrowserCannotWriteLocalStorage",t[t.BrowserCannotWriteSessionStorage=4]="BrowserCannotWriteSessionStorage",t[t.BrowserFailedRemovalFromLocalStorage=5]="BrowserFailedRemovalFromLocalStorage",t[t.BrowserFailedRemovalFromSessionStorage=6]="BrowserFailedRemovalFromSessionStorage",t[t.CannotSendEmptyTelemetry=7]="CannotSendEmptyTelemetry",t[t.ClientPerformanceMathError=8]="ClientPerformanceMathError",t[t.ErrorParsingAISessionCookie=9]="ErrorParsingAISessionCookie",t[t.ErrorPVCalc=10]="ErrorPVCalc",t[t.ExceptionWhileLoggingError=11]="ExceptionWhileLoggingError",t[t.FailedAddingTelemetryToBuffer=12]="FailedAddingTelemetryToBuffer",t[t.FailedMonitorAjaxAbort=13]="FailedMonitorAjaxAbort",t[t.FailedMonitorAjaxDur=14]="FailedMonitorAjaxDur",t[t.FailedMonitorAjaxOpen=15]="FailedMonitorAjaxOpen",t[t.FailedMonitorAjaxRSC=16]="FailedMonitorAjaxRSC",t[t.FailedMonitorAjaxSend=17]="FailedMonitorAjaxSend",t[t.FailedMonitorAjaxGetCorrelationHeader=18]="FailedMonitorAjaxGetCorrelationHeader",t[t.FailedToAddHandlerForOnBeforeUnload=19]="FailedToAddHandlerForOnBeforeUnload",t[t.FailedToSendQueuedTelemetry=20]="FailedToSendQueuedTelemetry",t[t.FailedToReportDataLoss=21]="FailedToReportDataLoss",t[t.FlushFailed=22]="FlushFailed",t[t.MessageLimitPerPVExceeded=23]="MessageLimitPerPVExceeded",t[t.MissingRequiredFieldSpecification=24]="MissingRequiredFieldSpecification",t[t.NavigationTimingNotSupported=25]="NavigationTimingNotSupported",t[t.OnError=26]="OnError",t[t.SessionRenewalDateIsZero=27]="SessionRenewalDateIsZero",t[t.SenderNotInitialized=28]="SenderNotInitialized",t[t.StartTrackEventFailed=29]="StartTrackEventFailed",t[t.StopTrackEventFailed=30]="StopTrackEventFailed",t[t.StartTrackFailed=31]="StartTrackFailed",t[t.StopTrackFailed=32]="StopTrackFailed",t[t.TelemetrySampledAndNotSent=33]="TelemetrySampledAndNotSent",t[t.TrackEventFailed=34]="TrackEventFailed",t[t.TrackExceptionFailed=35]="TrackExceptionFailed",t[t.TrackMetricFailed=36]="TrackMetricFailed",t[t.TrackPVFailed=37]="TrackPVFailed",t[t.TrackPVFailedCalc=38]="TrackPVFailedCalc",t[t.TrackTraceFailed=39]="TrackTraceFailed",t[t.TransmissionFailed=40]="TransmissionFailed",t[t.FailedToSetStorageBuffer=41]="FailedToSetStorageBuffer",t[t.FailedToRestoreStorageBuffer=42]="FailedToRestoreStorageBuffer",t[t.InvalidBackendResponse=43]="InvalidBackendResponse",t[t.FailedToFixDepricatedValues=44]="FailedToFixDepricatedValues",t[t.InvalidDurationValue=45]="InvalidDurationValue",t[t.CannotSerializeObject=46]="CannotSerializeObject",t[t.CannotSerializeObjectNonSerializable=47]="CannotSerializeObjectNonSerializable",t[t.CircularReferenceDetected=48]="CircularReferenceDetected",t[t.ClearAuthContextFailed=49]="ClearAuthContextFailed",t[t.ExceptionTruncated=50]="ExceptionTruncated",t[t.IllegalCharsInName=51]="IllegalCharsInName",t[t.ItemNotInArray=52]="ItemNotInArray",t[t.MaxAjaxPerPVExceeded=53]="MaxAjaxPerPVExceeded",t[t.MessageTruncated=54]="MessageTruncated",t[t.NameTooLong=55]="NameTooLong",t[t.SampleRateOutOfRange=56]="SampleRateOutOfRange",t[t.SetAuthContextFailed=57]="SetAuthContextFailed",t[t.SetAuthContextFailedAccountName=58]="SetAuthContextFailedAccountName",t[t.StringValueTooLong=59]="StringValueTooLong",t[t.StartCalledMoreThanOnce=60]="StartCalledMoreThanOnce",t[t.StopCalledWithoutStart=61]="StopCalledWithoutStart",t[t.TelemetryInitializerFailed=62]="TelemetryInitializerFailed",t[t.TrackArgumentsNotSpecified=63]="TrackArgumentsNotSpecified",t[t.UrlTooLong=64]="UrlTooLong",t[t.SessionStorageBufferFull=65]="SessionStorageBufferFull",t[t.CannotAccessCookie=66]="CannotAccessCookie",t[t.IdTooLong=67]="IdTooLong";var g=function(){function a(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?a.AiUserActionablePrefix:a.AiNonUserActionablePrefix)+c[e].toString();var o=(t?" message:"+a.sanitizeDiagnosticText(t):"")+(i?" props:"+a.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=o}return a.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},a.AiNonUserActionablePrefix="AI (Internal): ",a.AiUserActionablePrefix="AI: ",a}();s._InternalLogMessage=g;var n=function(){function r(){}return r.throwInternal=function(e,t,n,i,o){void 0===o&&(o=!1);var a=new g(t,n,o,i);if(this.enableDebugExceptions())throw a;if(void 0!==a&&a&&"undefined"!=typeof a.message){if(o){var r=c[a.messageId];this._messageLogged[r]&&!this.verboseLogging()||(this.warnToConsole(a.message),this._messageLogged[r]=!0)}else this.verboseLogging()&&this.warnToConsole(a.message);this.logInternalMessage(e,a)}},r.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},r.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},r.clearInternalMessageLoggedTypes=function(){if(s.Util.canUseSessionStorage())for(var e=s.Util.getSessionStorageKeys(),t=0;t<e.length;t++)0===e[t].indexOf(r.AIInternalMessagePrefix)&&s.Util.removeSessionStorage(e[t])},r.setMaxInternalMessageLimit=function(e){if(!e)throw new Error("limit cannot be undefined.");this.MAX_INTERNAL_MESSAGE_LIMIT=e},r.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=r.AIInternalMessagePrefix+c[t.messageId];if(s.Util.canUseSessionStorage())s.Util.getSessionStorage(i)?n=!1:s.Util.setSessionStorage(i,"1");else this._messageLogged[i]?n=!1:this._messageLogged[i]=!0;if(n&&((this.verboseLogging()||e===l.CRITICAL)&&(this.queue.push(t),this._messageCount++),this._messageCount==this.MAX_INTERNAL_MESSAGE_LIMIT)){var o="Internal events throttle limit per PageView reached for this app.",a=new g(c.MessageLimitPerPVExceeded,o,!1);this.queue.push(a),this.warnToConsole(o)}}},r._areInternalMessagesThrottled=function(){return this._messageCount>=this.MAX_INTERNAL_MESSAGE_LIMIT},r.AIInternalMessagePrefix="AITR_",r.enableDebugExceptions=function(){return!1},r.verboseLogging=function(){return!1},r.queue=[],r.MAX_INTERNAL_MESSAGE_LIMIT=25,r._messageCount=0,r._messageLogged={},r}();s._InternalLogging=n}(e.ApplicationInsights||(e.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function(){function e(){}return e.newId=function(){for(var e="",t=1073741824*Math.random();0<t;){e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64)}return e},e}(),t.UtilHelpers=n}(Microsoft||(Microsoft={})),function(e){!function(o){var a,e;(e=a||(a={}))[e.LocalStorage=0]="LocalStorage",e[e.SessionStorage=1]="SessionStorage";var t=function(){function r(){}return r.disableStorage=function(){r._canUseLocalStorage=!1,r._canUseSessionStorage=!1},r._getLocalStorageObject=function(){return r.canUseLocalStorage()?r._getVerifiedStorageObject(a.LocalStorage):null},r._getVerifiedStorageObject=function(e){var t,n,i=null;try{n=new Date,(i=e===a.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=i.getItem(n)!=n,i.removeItem(n),t&&(i=null)}catch(o){i=null}return i},r.isInternalApplicationInsightsEndpoint=function(e){return-1!==r._internalEndpoints.indexOf(e.toLowerCase())},r.canUseLocalStorage=function(){return r._canUseLocalStorage===undefined&&(r._canUseLocalStorage=!!r._getVerifiedStorageObject(a.LocalStorage)),r._canUseLocalStorage},r.getStorage=function(e){var t=r._getLocalStorageObject();if(null!==t)try{return t.getItem(e)}catch(n){r._canUseLocalStorage=!1,o._InternalLogging.throwInternal(o.LoggingSeverity.WARNING,o._InternalMessageId.BrowserCannotReadLocalStorage,"Browser failed read of local storage. "+r.getExceptionName(n),{exception:r.dump(n)})}return null},r.setStorage=function(e,t){var n=r._getLocalStorageObject();if(null!==n)try{return n.setItem(e,t),!0}catch(i){r._canUseLocalStorage=!1,o._InternalLogging.throwInternal(o.LoggingSeverity.WARNING,o._InternalMessageId.BrowserCannotWriteLocalStorage,"Browser failed write to local storage. "+r.getExceptionName(i),{exception:r.dump(i)})}return!1},r.removeStorage=function(e){var t=r._getLocalStorageObject();if(null!==t)try{return t.removeItem(e),!0}catch(n){r._canUseLocalStorage=!1,o._InternalLogging.throwInternal(o.LoggingSeverity.WARNING,o._InternalMessageId.BrowserFailedRemovalFromLocalStorage,"Browser failed removal of local storage item. "+r.getExceptionName(n),{exception:r.dump(n)})}return!1},r._getSessionStorageObject=function(){return r.canUseSessionStorage()?r._getVerifiedStorageObject(a.SessionStorage):null},r.canUseSessionStorage=function(){return r._canUseSessionStorage===undefined&&(r._canUseSessionStorage=!!r._getVerifiedStorageObject(a.SessionStorage)),r._canUseSessionStorage},r.getSessionStorageKeys=function(){var e=[];if(r.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},r.getSessionStorage=function(e){var t=r._getSessionStorageObject();if(null!==t)try{return t.getItem(e)}catch(n){r._canUseSessionStorage=!1,o._InternalLogging.throwInternal(o.LoggingSeverity.WARNING,o._InternalMessageId.BrowserCannotReadSessionStorage,"Browser failed read of session storage. "+r.getExceptionName(n),{exception:r.dump(n)})}return null},r.setSessionStorage=function(e,t){var n=r._getSessionStorageObject();if(null!==n)try{return n.setItem(e,t),!0}catch(i){r._canUseSessionStorage=!1,o._InternalLogging.throwInternal(o.LoggingSeverity.WARNING,o._InternalMessageId.BrowserCannotWriteSessionStorage,"Browser failed write to session storage. "+r.getExceptionName(i),{exception:r.dump(i)})}return!1},r.removeSessionStorage=function(e){var t=r._getSessionStorageObject();if(null!==t)try{return t.removeItem(e),!0}catch(n){r._canUseSessionStorage=!1,o._InternalLogging.throwInternal(o.LoggingSeverity.WARNING,o._InternalMessageId.BrowserFailedRemovalFromSessionStorage,"Browser failed removal of session storage item. "+r.getExceptionName(n),{exception:r.dump(n)})}return!1},r.disableCookies=function(){r._canUseCookies=!1},r.canUseCookies=function(){if(r._canUseCookies===undefined){r._canUseCookies=!1;try{r._canUseCookies=r.document.cookie!==undefined}catch(e){o._InternalLogging.throwInternal(o.LoggingSeverity.WARNING,o._InternalMessageId.CannotAccessCookie,"Cannot access document.cookie - "+r.getExceptionName(e),{exception:r.dump(e)})}}return r._canUseCookies},r.disallowsSameSiteNone=function(e){return"string"==typeof e&&(-1!==e.indexOf("CPU iPhone OS 12")||-1!==e.indexOf("iPad; CPU OS 12")||(-1!==e.indexOf("Macintosh; Intel Mac OS X 10_14")&&-1!==e.indexOf("Version/")&&-1!==e.indexOf("Safari")||(!(-1===e.indexOf("Macintosh; Intel Mac OS X 10_14")||!_endsWith(e,"AppleWebKit/605.1.15 (KHTML, like Gecko)"))||(-1!==e.indexOf("Chrome/5")||-1!==e.indexOf("Chrome/6")||(-1!==e.indexOf("UnrealEngine")&&-1===e.indexOf("Chrome")||(-1!==e.indexOf("UCBrowser/12")||-1!==e.indexOf("UCBrowser/11")))))))},r.setCookie=function(e,t,n){var i="",o="";n&&(i=";domain="+n),r.document.location&&"https:"===r.document.location.protocol&&(o=";secure",null===r._uaDisallowsSameSiteNone&&"undefined"!=typeof navigator&&(r._uaDisallowsSameSiteNone=r.disallowsSameSiteNone(navigator.userAgent)),r._uaDisallowsSameSiteNone||(t+=";SameSite=None")),r.canUseCookies()&&(r.document.cookie=e+"="+t+i+";path=/"+o)},r.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),e===undefined||null===e?t:"true"===e.toString().toLowerCase()},r.getCookie=function(e){if(r.canUseCookies()){var t="";if(e&&e.length)for(var n=e+"=",i=r.document.cookie.split(";"),o=0;o<i.length;o++){var a=i[o];if((a=r.trim(a))&&0===a.indexOf(n)){t=a.substring(n.length,i[o].length);break}}return t}},r.deleteCookie=function(e){r.canUseCookies()&&(r.document.cookie=e+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},r.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},r.newId=function(){return o.UtilHelpers.newId()},r.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},r.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},r.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},r.toISOStringForIE8=function(e){if(r.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"}},r.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},r.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,o=""+Math.floor(e/36e5)%24,a=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<a?a+".":"")+(o=o.length<2?"0"+o:o)+":"+i+":"+n+"."+t},r.isCrossOriginError=function(e,t,n,i,o){return("Script error."===e||"Script error"===e)&&!o},r.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},r.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},r.addEventHandler=function(e,t){if(!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},r.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},r.document="undefined"!=typeof document?document:{},r._canUseCookies=undefined,r._canUseLocalStorage=undefined,r._canUseSessionStorage=undefined,r._uaDisallowsSameSiteNone=null,r._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],r.NotSpecified="not_specified",r}();o.Util=t;var r=function(){function i(){}return i.parseUrl=function(e){return i.htmlAnchorElement||(i.htmlAnchorElement=i.document.createElement?i.document.createElement("a"):{host:i.parseHost(e)}),i.htmlAnchorElement.href=e,i.htmlAnchorElement},i.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},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}();o.UrlHelper=r;var n=function(){function n(){}return n.canIncludeCorrelationHeader=function(e,t,n){if(e&&e.disableCorrelationHeaders)return!1;if(!t)return!1;var i=r.parseUrl(t).host.toLowerCase();if(!(e&&e.enableCorsCorrelation||i===n))return!1;var o=e&&e.correlationHeaderExcludedDomains;if(!o||0==o.length)return!0;for(var a=0;a<o.length;a++){if(new RegExp(o[a].toLowerCase().replace(/\./g,".").replace(/\*/g,".*")).test(i))return!1}return!0},n.getCorrelationContext=function(e){if(e){var t=n.getCorrelationContextValue(e,o.RequestHeaders.requestContextTargetKey);if(t&&t!==n.correlationIdPrefix)return t}},n.getCorrelationContextValue=function(e,t){if(e)for(var n=e.split(","),i=0;i<n.length;++i){var o=n[i].split("=");if(2==o.length&&o[0]==t)return o[1]}},n.correlationIdPrefix="cid-v1:",n}();o.CorrelationIdHelper=n}(e.ApplicationInsights||(e.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(e){!function(f){var h,e;(e=h=f.FieldType||(f.FieldType={}))[e.Default=0]="Default",e[e.Required=1]="Required",e[e.Array=2]="Array",e[e.Hidden=4]="Hidden";var t=function(){function d(){}return d.serialize=function(e){var t=d._serializeObject(e,"root");return JSON.stringify(t)},d._serializeObject=function(e,t){var n="__aiCircularRefCheck",i={};if(!e)return f._InternalLogging.throwInternal(f.LoggingSeverity.CRITICAL,f._InternalMessageId.CannotSerializeObject,"cannot serialize object because it is null or undefined",{name:t},!0),i;if(e[n])return f._InternalLogging.throwInternal(f.LoggingSeverity.WARNING,f._InternalMessageId.CircularReferenceDetected,"Circular reference detected while serializing object",{name:t},!0),i;if(!e.aiDataContract){if("measurements"===t)i=d._serializeStringMap(e,"number",t);else if("properties"===t)i=d._serializeStringMap(e,"string",t);else if("tags"===t)i=d._serializeStringMap(e,"string",t);else if(f.Util.isArray(e))i=d._serializeArray(e,t);else{f._InternalLogging.throwInternal(f.LoggingSeverity.WARNING,f._InternalMessageId.CannotSerializeObjectNonSerializable,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),i=e}catch(p){f._InternalLogging.throwInternal(f.LoggingSeverity.CRITICAL,f._InternalMessageId.CannotSerializeObject,p&&"function"==typeof p.toString?p.toString():"Error serializing object",null,!0)}}return i}for(var o in e[n]=!0,e.aiDataContract){var a,r=e.aiDataContract[o],s="function"==typeof r?r()&h.Required:r&h.Required,l="function"==typeof r?r()&h.Hidden:r&h.Hidden,c=r&h.Array,g=e[o]!==undefined,u="object"==typeof e[o]&&null!==e[o];if(!s||g||c){if(!l)(a=u?c?d._serializeArray(e[o],o):d._serializeObject(e[o],o):e[o])!==undefined&&(i[o]=a)}else f._InternalLogging.throwInternal(f.LoggingSeverity.CRITICAL,f._InternalMessageId.MissingRequiredFieldSpecification,"Missing required field specification. The field is required but not present on source",{field:o,name:t})}return delete e[n],i},d._serializeArray=function(e,t){var n=undefined;if(e)if(f.Util.isArray(e)){n=[];for(var i=0;i<e.length;i++){var o=e[i],a=d._serializeObject(o,t+"["+i+"]");n.push(a)}}else f._InternalLogging.throwInternal(f.LoggingSeverity.CRITICAL,f._InternalMessageId.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},d._serializeStringMap=function(e,t,n){var i=undefined;if(e)for(var o in i={},e){var a=e[o];if("string"===t)a===undefined?i[o]="undefined":null===a?i[o]="null":a.toString?i[o]=a.toString():i[o]="invalid field: toString() is not defined.";else if("number"===t)if(a===undefined)i[o]="undefined";else if(null===a)i[o]="null";else{var r=parseFloat(a);isNaN(r)?i[o]="NaN":i[o]=r}else i[o]="invalid field: "+n+" is of unknown type.",f._InternalLogging.throwInternal(f.LoggingSeverity.CRITICAL,i[o],null,!0)}return i},d}();f.Serializer=t}(e.ApplicationInsights||(e.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(e){var o,t,a,n;o=e.ApplicationInsights||(e.ApplicationInsights={}),t=o.Telemetry||(o.Telemetry={}),a=t.Common||(t.Common={}),n=function(i){function e(e,t){var n=i.call(this)||this;return n.name=a.DataSanitizer.sanitizeString(t)||o.Util.NotSpecified,n.data=e,n.time=o.Util.toISOStringForIE8(new Date),n.aiDataContract={time:o.FieldType.Required,iKey:o.FieldType.Required,name:o.FieldType.Required,sampleRate:function(){return 100==n.sampleRate?o.FieldType.Hidden:o.FieldType.Required},tags:o.FieldType.Required,data:o.FieldType.Required},n}return __extends(e,i),e}(e.Telemetry.Envelope),a.Envelope=n}(Microsoft||(Microsoft={})),function(e){var t,n,i,o;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=t.Telemetry||(t.Telemetry={}),i=n.Common||(n.Common={}),o=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={},e}return __extends(e,t),e}(e.Telemetry.Base),i.Base=o}(Microsoft||(Microsoft={})),function(e){var t=function n(){this.applicationVersion="ai.application.ver",this.applicationBuild="ai.application.build",this.applicationTypeId="ai.application.typeId",this.applicationId="ai.application.applicationId",this.applicationLayer="ai.application.layer",this.deviceId="ai.device.id",this.deviceIp="ai.device.ip",this.deviceLanguage="ai.device.language",this.deviceLocale="ai.device.locale",this.deviceModel="ai.device.model",this.deviceFriendlyName="ai.device.friendlyName",this.deviceNetwork="ai.device.network",this.deviceNetworkName="ai.device.networkName",this.deviceOEMName="ai.device.oemName",this.deviceOS="ai.device.os",this.deviceOSVersion="ai.device.osVersion",this.deviceRoleInstance="ai.device.roleInstance",this.deviceRoleName="ai.device.roleName",this.deviceScreenResolution="ai.device.screenResolution",this.deviceType="ai.device.type",this.deviceMachineName="ai.device.machineName",this.deviceVMName="ai.device.vmName",this.deviceBrowser="ai.device.browser",this.deviceBrowserVersion="ai.device.browserVersion",this.locationIp="ai.location.ip",this.locationCountry="ai.location.country",this.locationProvince="ai.location.province",this.locationCity="ai.location.city",this.operationId="ai.operation.id",this.operationName="ai.operation.name",this.operationParentId="ai.operation.parentId",this.operationRootId="ai.operation.rootId",this.operationSyntheticSource="ai.operation.syntheticSource",this.operationCorrelationVector="ai.operation.correlationVector",this.sessionId="ai.session.id",this.sessionIsFirst="ai.session.isFirst",this.sessionIsNew="ai.session.isNew",this.userAccountAcquisitionDate="ai.user.accountAcquisitionDate",this.userAccountId="ai.user.accountId",this.userAgent="ai.user.userAgent",this.userId="ai.user.id",this.userStoreRegion="ai.user.storeRegion",this.userAuthUserId="ai.user.authUserId",this.userAnonymousUserAcquisitionDate="ai.user.anonUserAcquisitionDate",this.userAuthenticatedUserAcquisitionDate="ai.user.authUserAcquisitionDate",this.cloudName="ai.cloud.name",this.cloudRole="ai.cloud.role",this.cloudRoleVer="ai.cloud.roleVer",this.cloudRoleInstance="ai.cloud.roleInstance",this.cloudEnvironment="ai.cloud.environment",this.cloudLocation="ai.cloud.location",this.cloudDeploymentUnit="ai.cloud.deploymentUnit",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion",this.internalNodeName="ai.internal.nodeName"};(AI||(AI={})).ContextTagKeys=t}(),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function i(){},(t.Context||(t.Context={})).Application=n}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function i(){this.id="browser",this.type="Browser"},(t.Context||(t.Context={})).Device=n}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function i(e){this.sdkVersion=(e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:"+t.Version},(t.Context||(t.Context={})).Internal=n}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function i(){},(t.Context||(t.Context={})).Location=n}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function i(){this.id=t.Util.newId(),window&&window.location&&window.location.pathname&&(this.name=window.location.pathname)},(t.Context||(t.Context={})).Operation=n}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function(){function i(){}return i.prototype.getHashCodeScore=function(e){return 100*(this.getHashCode(e)/i.INT_MAX_VALUE)},i.prototype.getHashCode=function(e){if(""==e)return 0;for(;e.length<i.MIN_INPUT_LENGTH;)e=e.concat(e);for(var t=5381,n=0;n<e.length;++n)t=(t<<5)+t+e.charCodeAt(n),t&=t;return Math.abs(t)},i.INT_MAX_VALUE=2147483647,i.MIN_INPUT_LENGTH=8,i}(),t.HashCodeScoreGenerator=n}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function(){function e(){this.hashCodeGeneragor=new t.HashCodeScoreGenerator}return e.prototype.getSamplingScore=function(e){var t=new AI.ContextTagKeys;return e.tags[t.userId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.userId]):e.tags[t.operationId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.operationId]):Math.random()},e}(),t.SamplingScoreGenerator=n}(Microsoft||(Microsoft={})),function(e){var t,n,i;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=t.Context||(t.Context={}),i=function(){function e(e){this.INT_MAX_VALUE=2147483647,(100<e||e<0)&&(t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._InternalMessageId.SampleRateOutOfRange,"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.",{samplingRate:e},!0),this.sampleRate=100),this.sampleRate=e,this.samplingScoreGenerator=new t.SamplingScoreGenerator}return e.prototype.isSampledIn=function(e){return 100==this.sampleRate||this.samplingScoreGenerator.getSamplingScore(e)<this.sampleRate},e}(),n.Sample=i}(Microsoft||(Microsoft={})),function(e){var l;(function(e){var t=function i(){};e.Session=t;var n=function(){function i(e){e||(e={}),"function"!=typeof e.sessionExpirationMs&&(e.sessionExpirationMs=function(){return i.acquisitionSpan}),"function"!=typeof e.sessionRenewalMs&&(e.sessionRenewalMs=function(){return i.renewalSpan}),this.config=e,this.automaticSession=new t}return i.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var e=l.dateTime.Now(),t=e-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),n=e-this.automaticSession.renewalDate>this.config.sessionRenewalMs();t||n?(this.automaticSession.isFirst=undefined,this.renew()):(!this.cookieUpdatedTimestamp||e-this.cookieUpdatedTimestamp>i.cookieUpdateInterval)&&(this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},i.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},i.prototype.initializeAutomaticSession=function(){var e=l.Util.getCookie("ai_session");if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var t=l.Util.getStorage("ai_session");t&&this.initializeAutomaticSessionWithData(t)}this.automaticSession.id||(this.automaticSession.isFirst=!0,this.renew())},i.prototype.initializeAutomaticSessionWithData=function(e){var t=e.split("|");0<t.length&&(this.automaticSession.id=t[0]);try{if(1<t.length){var n=+t[1];this.automaticSession.acquisitionDate=+new Date(n),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<t.length){var i=+t[2];this.automaticSession.renewalDate=+new Date(i),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(o){l._InternalLogging.throwInternal(l.LoggingSeverity.CRITICAL,l._InternalMessageId.ErrorParsingAISessionCookie,"Error parsing ai_session cookie, session will be reset: "+l.Util.getExceptionName(o),{exception:l.Util.dump(o)})}0==this.automaticSession.renewalDate&&l._InternalLogging.throwInternal(l.LoggingSeverity.WARNING,l._InternalMessageId.SessionRenewalDateIsZero,"AI session renewal date is 0, session will be reset.")},i.prototype.renew=function(){var e=l.dateTime.Now();this.automaticSession.id=l.Util.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),l.Util.canUseLocalStorage()||l._InternalLogging.throwInternal(l.LoggingSeverity.WARNING,l._InternalMessageId.BrowserDoesNotSupportLocalStorage,"Browser does not support local storage. Session durations will be inaccurate.")},i.prototype.setCookie=function(e,t,n){var i=t+this.config.sessionExpirationMs(),o=n+this.config.sessionRenewalMs(),a=new Date,r=[e,t,n];i<o?a.setTime(i):a.setTime(o);var s=this.config.cookieDomain?this.config.cookieDomain():null;l.Util.setCookie("ai_session",r.join("|")+";expires="+a.toUTCString(),s),this.cookieUpdatedTimestamp=l.dateTime.Now()},i.prototype.setStorage=function(e,t,n){l.Util.setStorage("ai_session",[e,t,n].join("|"))},i.acquisitionSpan=864e5,i.renewalSpan=18e5,i.cookieUpdateInterval=6e4,i}();e._SessionManager=n})((l=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(l.Context={}))}(Microsoft||(Microsoft={})),function(e){var g,t,n;g=e.ApplicationInsights||(e.ApplicationInsights={}),t=g.Context||(g.Context={}),n=function(){function c(e){var t=g.Util.getCookie(c.userCookieName);if(t){var n=t.split(c.cookieSeparator);0<n.length&&(this.id=n[0])}if(this.config=e,!this.id){this.id=g.Util.newId();var i=new Date,o=g.Util.toISOStringForIE8(i);this.accountAcquisitionDate=o,i.setTime(i.getTime()+31536e6);var a=[this.id,o],r=this.config.cookieDomain?this.config.cookieDomain():undefined;g.Util.setCookie(c.userCookieName,a.join(c.cookieSeparator)+";expires="+i.toUTCString(),r),g.Util.removeStorage("ai_session")}this.accountId=e.accountId?e.accountId():undefined;var s=g.Util.getCookie(c.authUserCookieName);if(s){var l=(s=decodeURI(s)).split(c.cookieSeparator);l[0]&&(this.authenticatedId=l[0]),1<l.length&&l[1]&&(this.accountId=l[1])}}return c.prototype.setAuthenticatedUserContext=function(e,t,n){if(void 0===n&&(n=!1),!this.validateUserInput(e)||t&&!this.validateUserInput(t))g._InternalLogging.throwInternal(g.LoggingSeverity.WARNING,g._InternalMessageId.SetAuthContextFailedAccountName,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{this.authenticatedId=e;var i=this.authenticatedId;t&&(this.accountId=t,i=[this.authenticatedId,this.accountId].join(c.cookieSeparator)),n&&g.Util.setCookie(c.authUserCookieName,encodeURI(i),this.config.cookieDomain())}},c.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,g.Util.deleteCookie(c.authUserCookieName)},c.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},c.cookieSeparator="|",c.userCookieName="ai_user",c.authUserCookieName="ai_authUser",c}(),t.User=n}(Microsoft||(Microsoft={})),function(e){!function(r){var o=function(){function e(){}return e.IsNullOrUndefined=function(e){return null==e},e}();r.extensions=o;var e=function(){function e(){}return e.GetLength=function(e){var t=0;if(!o.IsNullOrUndefined(e)){var n="";try{n=e.toString()}catch(i){}t=n.length,t=isNaN(t)?0:t}return t},e}();r.stringUtils=e;var t=function(){function e(){}return e.Now=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||o.IsNullOrUndefined(e)||o.IsNullOrUndefined(t)||(n=t-e),n},e}();r.dateTime=t;var n=function(){function e(){}return e.AttachEvent=function(e,t,n){var i=!1;return o.IsNullOrUndefined(e)||(o.IsNullOrUndefined(e.attachEvent)?o.IsNullOrUndefined(e.addEventListener)||(e.addEventListener(t,n,!1),i=!0):(e.attachEvent("on"+t,n),i=!0)),i},e.DetachEvent=function(e,t,n){o.IsNullOrUndefined(e)||(o.IsNullOrUndefined(e.detachEvent)?o.IsNullOrUndefined(e.removeEventListener)||e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n))},e}();r.EventHelper=n;var i=function(){function e(){}return e.ParseDependencyPath=function(e,t,n){var i,o;if(e&&0<e.length){var a=r.UrlHelper.parseUrl(e);if(i=a.host,null!=a.pathname)"/"!==(n=0===a.pathname.length?"/":a.pathname).charAt(0)&&(n="/"+n),o=r.Telemetry.Common.DataSanitizer.sanitizeString(t?t+" "+n:n);else o=r.Telemetry.Common.DataSanitizer.sanitizeString(e)}else o=i=n;return{target:i,name:o}},e}();r.AjaxHelper=i}(e.ApplicationInsights||(e.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(e){!function(t){var n=function i(){this.openDone=!1,this.setRequestHeaderDone=!1,this.sendDone=!1,this.abortDone=!1,this.onreadystatechangeCallbackAttached=!1};t.XHRMonitoringState=n;var e=function(){function e(e){this.completed=!1,this.requestHeadersSize=null,this.ttfb=null,this.responseReceivingDuration=null,this.callbackDuration=null,this.ajaxTotalDuration=null,this.aborted=null,this.pageUrl=null,this.requestUrl=null,this.requestSize=0,this.method=null,this.status=null,this.requestSentTime=null,this.responseStartedTime=null,this.responseFinishedTime=null,this.callbackFinishedTime=null,this.endTime=null,this.originalOnreadystatechage=null,this.xhrMonitoringState=new n,this.clientFailure=0,this.CalculateMetrics=function(){this.ajaxTotalDuration=Math.round(1e3*t.dateTime.GetDuration(this.requestSentTime,this.responseFinishedTime))/1e3},this.id=e}return e.prototype.getAbsoluteUrl=function(){return this.requestUrl?t.UrlHelper.getAbsoluteUrl(this.requestUrl):null},e.prototype.getPathName=function(){return this.requestUrl?t.Telemetry.Common.DataSanitizer.sanitizeUrl(t.UrlHelper.getCompleteUrl(this.method,this.requestUrl)):null},e}();t.ajaxRecord=e}(e.ApplicationInsights||(e.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=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}(),t.RequestHeaders=n}(Microsoft||(Microsoft={})),function(e){var t;t=function n(){},(e.Telemetry||(e.Telemetry={})).Domain=t}(Microsoft||(Microsoft={})),function(e){var t=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return __extends(e,t),e}(Microsoft.Telemetry.Domain);e.EventData=t}(AI||(AI={})),function(e){var t=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return __extends(e,t),e}(e.EventData);e.PageViewData=t}(AI||(AI={})),function(e){var t=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return __extends(e,t),e}(Microsoft.Telemetry.Domain);e.RemoteDependencyData=t}(AI||(AI={})),function(e){var i,t,n,o;i=e.ApplicationInsights||(e.ApplicationInsights={}),t=i.Telemetry||(i.Telemetry={}),n=t.Common||(t.Common={}),o=function(){function r(){}return r.sanitizeKeyAndAddUniqueness=function(e,t){var n=e.length,i=r.sanitizeKey(e);if(i.length!==n){for(var o=0,a=i;t[a]!==undefined;)o++,a=i.substring(0,r.MAX_NAME_LENGTH-3)+r.padNumber(o);i=a}return i},r.sanitizeKey=function(e){return e&&(e=i.Util.trim(e.toString())).length>r.MAX_NAME_LENGTH&&(e=e.substring(0,r.MAX_NAME_LENGTH),i._InternalLogging.throwInternal(i.LoggingSeverity.WARNING,i._InternalMessageId.NameTooLong,"name is too long. It has been truncated to "+r.MAX_NAME_LENGTH+" characters.",{name:e},!0)),e},r.sanitizeString=function(e,t){return void 0===t&&(t=r.MAX_STRING_LENGTH),e&&(t=t||r.MAX_STRING_LENGTH,(e=i.Util.trim(e)).toString().length>t&&(e=e.toString().substring(0,t),i._InternalLogging.throwInternal(i.LoggingSeverity.WARNING,i._InternalMessageId.StringValueTooLong,"string value is too long. It has been truncated to "+t+" characters.",{value:e},!0))),e},r.sanitizeUrl=function(e){return r.sanitizeInput(e,r.MAX_URL_LENGTH,i._InternalMessageId.UrlTooLong)},r.sanitizeMessage=function(e){return e&&e.length>r.MAX_MESSAGE_LENGTH&&(e=e.substring(0,r.MAX_MESSAGE_LENGTH),i._InternalLogging.throwInternal(i.LoggingSeverity.WARNING,i._InternalMessageId.MessageTruncated,"message is too long, it has been truncated to "+r.MAX_MESSAGE_LENGTH+" characters.",{message:e},!0)),e},r.sanitizeException=function(e){return e&&e.length>r.MAX_EXCEPTION_LENGTH&&(e=e.substring(0,r.MAX_EXCEPTION_LENGTH),i._InternalLogging.throwInternal(i.LoggingSeverity.WARNING,i._InternalMessageId.ExceptionTruncated,"exception is too long, it has been truncated to "+r.MAX_EXCEPTION_LENGTH+" characters.",{exception:e},!0)),e},r.sanitizeProperties=function(e){if(e){var t={};for(var n in e){var i=r.sanitizeString(e[n],r.MAX_PROPERTY_LENGTH);t[n=r.sanitizeKeyAndAddUniqueness(n,t)]=i}e=t}return e},r.sanitizeMeasurements=function(e){if(e){var t={};for(var n in e){var i=e[n];t[n=r.sanitizeKeyAndAddUniqueness(n,t)]=i}e=t}return e},r.sanitizeId=function(e){return e?r.sanitizeInput(e,r.MAX_ID_LENGTH,i._InternalMessageId.IdTooLong).toString():e},r.sanitizeInput=function(e,t,n){return e&&(e=i.Util.trim(e)).length>t&&(e=e.substring(0,t),i._InternalLogging.throwInternal(i.LoggingSeverity.WARNING,n,"input is too long, it has been truncated to "+t+" characters.",{data:e},!0)),e},r.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},r.MAX_NAME_LENGTH=150,r.MAX_ID_LENGTH=128,r.MAX_PROPERTY_LENGTH=8192,r.MAX_STRING_LENGTH=1024,r.MAX_URL_LENGTH=2048,r.MAX_MESSAGE_LENGTH=32768,r.MAX_EXCEPTION_LENGTH=32768,r}(),n.DataSanitizer=o}(Microsoft||(Microsoft={})),function(e){var p,d,t;p=e.ApplicationInsights||(e.ApplicationInsights={}),d=p.Telemetry||(p.Telemetry={}),t=function(u){function e(e,t,n,i,o,a,r,s,l){var c=u.call(this)||this;c.aiDataContract={id:p.FieldType.Required,ver:p.FieldType.Required,name:p.FieldType.Default,resultCode:p.FieldType.Default,duration:p.FieldType.Default,success:p.FieldType.Default,data:p.FieldType.Default,target:p.FieldType.Default,type:p.FieldType.Default,properties:p.FieldType.Default,measurements:p.FieldType.Default,kind:p.FieldType.Default,value:p.FieldType.Default,count:p.FieldType.Default,min:p.FieldType.Default,max:p.FieldType.Default,stdDev:p.FieldType.Default,dependencyKind:p.FieldType.Default,dependencySource:p.FieldType.Default,commandName:p.FieldType.Default,dependencyTypeName:p.FieldType.Default},c.id=e,c.duration=p.Util.msToTimeSpan(i),c.success=o,c.resultCode=a+"",c.type="Ajax",c.data=d.Common.DataSanitizer.sanitizeUrl(n);var g=p.AjaxHelper.ParseDependencyPath(t,r,n);return c.target=g.target,c.name=g.name,c.properties=p.Telemetry.Common.DataSanitizer.sanitizeProperties(s),c.measurements=p.Telemetry.Common.DataSanitizer.sanitizeMeasurements(l),c}return __extends(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(AI.RemoteDependencyData),d.RemoteDependencyData=t}(Microsoft||(Microsoft={})),function(s){var l,e;l=s.ApplicationInsights||(s.ApplicationInsights={}),e=function(){function r(e){this.currentWindowHost="object"==typeof window?window.location.host&&window.location.host.toLowerCase():undefined,this.appInsights=e,this.initialized=!1,this.Init()}return r.prototype.Init=function(){this.supportsMonitoring()&&(this.instrumentOpen(),this.instrumentSend(),this.instrumentAbort(),this.initialized=!0)},r.prototype.isMonitoredInstance=function(e,t){return this.initialized&&(!0===t||!l.extensions.IsNullOrUndefined(e.ajaxData))&&!0!==e[r.DisabledPropertyName]},r.prototype.supportsMonitoring=function(){var e=!0;("function"!=typeof XMLHttpRequest||l.extensions.IsNullOrUndefined(XMLHttpRequest)||l.extensions.IsNullOrUndefined(XMLHttpRequest.prototype)||l.extensions.IsNullOrUndefined(XMLHttpRequest.prototype.open)||l.extensions.IsNullOrUndefined(XMLHttpRequest.prototype.send)||l.extensions.IsNullOrUndefined(XMLHttpRequest.prototype.abort))&&(e=!1);try{" a ".trim()}catch(t){e=!1}return e},r.prototype.instrumentOpen=function(){var o=XMLHttpRequest.prototype.open,a=this;XMLHttpRequest.prototype.open=function(e,t,n){try{!a.isMonitoredInstance(this,!0)||this.ajaxData&&this.ajaxData.xhrMonitoringState.openDone||a.openHandler(this,e,t,n)}catch(i){l._InternalLogging.throwInternal(l.LoggingSeverity.CRITICAL,l._InternalMessageId.FailedMonitorAjaxOpen,"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:r.getFailedAjaxDiagnosticsMessage(this),exception:s.ApplicationInsights.Util.dump(i)})}return o.apply(this,arguments)}},r.prototype.openHandler=function(e,t,n,i){var o="|"+this.appInsights.context.operation.id+"."+l.Util.newId(),a=new l.ajaxRecord(o);a.method=t,a.requestUrl=n,a.xhrMonitoringState.openDone=!0,e.ajaxData=a,this.attachToOnReadyStateChange(e)},r.getFailedAjaxDiagnosticsMessage=function(e){var t="";try{l.extensions.IsNullOrUndefined(e)||l.extensions.IsNullOrUndefined(e.ajaxData)||l.extensions.IsNullOrUndefined(e.ajaxData.requestUrl)||(t+="(url: '"+e.ajaxData.requestUrl+"')")}catch(n){}return t},r.prototype.instrumentSend=function(){var n=XMLHttpRequest.prototype.send,i=this;XMLHttpRequest.prototype.send=function(e){try{i.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.sendDone&&i.sendHandler(this,e)}catch(t){l._InternalLogging.throwInternal(l.LoggingSeverity.CRITICAL,l._InternalMessageId.FailedMonitorAjaxSend,"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:r.getFailedAjaxDiagnosticsMessage(this),exception:s.ApplicationInsights.Util.dump(t)})}return n.apply(this,arguments)}},r.prototype.sendHandler=function(e,t){if(e.ajaxData.requestSentTime=l.dateTime.Now(),l.CorrelationIdHelper.canIncludeCorrelationHeader(this.appInsights.config,e.ajaxData.getAbsoluteUrl(),this.currentWindowHost)&&(e.setRequestHeader(l.RequestHeaders.requestIdHeader,e.ajaxData.id),this.appInsights.context)){var n=this.appInsights.context.appId();n&&e.setRequestHeader(l.RequestHeaders.requestContextHeader,l.RequestHeaders.requestContextAppIdFormat+n)}e.ajaxData.xhrMonitoringState.sendDone=!0},r.prototype.instrumentAbort=function(){var t=XMLHttpRequest.prototype.abort,n=this;XMLHttpRequest.prototype.abort=function(){try{n.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.abortDone&&(this.ajaxData.aborted=1,this.ajaxData.xhrMonitoringState.abortDone=!0)}catch(e){l._InternalLogging.throwInternal(l.LoggingSeverity.CRITICAL,l._InternalMessageId.FailedMonitorAjaxAbort,"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:r.getFailedAjaxDiagnosticsMessage(this),exception:s.ApplicationInsights.Util.dump(e)})}return t.apply(this,arguments)}},r.prototype.attachToOnReadyStateChange=function(n){var i=this;n.ajaxData.xhrMonitoringState.onreadystatechangeCallbackAttached=l.EventHelper.AttachEvent(n,"readystatechange",function(){try{i.isMonitoredInstance(n)&&4===n.readyState&&i.onAjaxComplete(n)}catch(t){var e=s.ApplicationInsights.Util.dump(t);e&&-1!=e.toLowerCase().indexOf("c00c023f")||l._InternalLogging.throwInternal(l.LoggingSeverity.CRITICAL,l._InternalMessageId.FailedMonitorAjaxRSC,"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:r.getFailedAjaxDiagnosticsMessage(n),exception:s.ApplicationInsights.Util.dump(t)})}})},r.prototype.onAjaxComplete=function(e){if(e.ajaxData.responseFinishedTime=l.dateTime.Now(),e.ajaxData.status=e.status,e.ajaxData.CalculateMetrics(),e.ajaxData.ajaxTotalDuration<0)l._InternalLogging.throwInternal(l.LoggingSeverity.WARNING,l._InternalMessageId.FailedMonitorAjaxDur,"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.",{ajaxDiagnosticsMessage:r.getFailedAjaxDiagnosticsMessage(e),requestSentTime:e.ajaxData.requestSentTime,responseFinishedTime:e.ajaxData.responseFinishedTime});else{var t=new l.Telemetry.RemoteDependencyData(e.ajaxData.id,e.ajaxData.getAbsoluteUrl(),e.ajaxData.getPathName(),e.ajaxData.ajaxTotalDuration,200<=+e.ajaxData.status&&+e.ajaxData.status<400,+e.ajaxData.status,e.ajaxData.method),n=this.getCorrelationContext(e);n&&(t.target=t.target+" | "+n),this.appInsights.trackDependencyData(t),e.ajaxData=null}},r.prototype.getCorrelationContext=function(e){try{var t=e.getAllResponseHeaders();if(null!==t)if(-1!==t.toLowerCase().indexOf(l.RequestHeaders.requestContextHeaderLowerCase)){var n=e.getResponseHeader(l.RequestHeaders.requestContextHeader);return l.CorrelationIdHelper.getCorrelationContext(n)}}catch(i){l._InternalLogging.throwInternal(l.LoggingSeverity.WARNING,l._InternalMessageId.FailedMonitorAjaxGetCorrelationHeader,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{ajaxDiagnosticsMessage:r.getFailedAjaxDiagnosticsMessage(e),exception:s.ApplicationInsights.Util.dump(i)})}},r.instrumentedByAppInsightsName="InstrumentedByAppInsights",r.DisabledPropertyName="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",r}(),l.AjaxMonitor=e}(Microsoft||(Microsoft={})),function(e){!function(o){var e=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}();o.ArraySendBuffer=e;var t=function(){function i(e){this._bufferFullMessageSent=!1,this._config=e;var t=this.getBuffer(i.BUFFER_KEY),n=this.getBuffer(i.SENT_BUFFER_KEY);this._buffer=t.concat(n),this._buffer.length>i.MAX_BUFFER_SIZE&&(this._buffer.length=i.MAX_BUFFER_SIZE),this.setBuffer(i.SENT_BUFFER_KEY,[]),this.setBuffer(i.BUFFER_KEY,this._buffer)}return i.prototype.enqueue=function(e){this._buffer.length>=i.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(o._InternalLogging.throwInternal(o.LoggingSeverity.WARNING,o._InternalMessageId.SessionStorageBufferFull,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(e),this.setBuffer(i.BUFFER_KEY,this._buffer))},i.prototype.count=function(){return this._buffer.length},i.prototype.clear=function(){this._buffer.length=0,this.setBuffer(i.BUFFER_KEY,[]),this.setBuffer(i.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},i.prototype.getItems=function(){return this._buffer.slice(0)},i.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},i.prototype.markAsSent=function(e){this._buffer=this.removePayloadsFromBuffer(e,this._buffer),this.setBuffer(i.BUFFER_KEY,this._buffer);var t=this.getBuffer(i.SENT_BUFFER_KEY);t instanceof Array&&e instanceof Array&&((t=t.concat(e)).length>i.MAX_BUFFER_SIZE&&(o._InternalLogging.throwInternal(o.LoggingSeverity.CRITICAL,o._InternalMessageId.SessionStorageBufferFull,"Sent buffer reached its maximum size: "+t.length,!0),t.length=i.MAX_BUFFER_SIZE),this.setBuffer(i.SENT_BUFFER_KEY,t))},i.prototype.clearSent=function(e){var t=this.getBuffer(i.SENT_BUFFER_KEY);t=this.removePayloadsFromBuffer(e,t),this.setBuffer(i.SENT_BUFFER_KEY,t)},i.prototype.removePayloadsFromBuffer=function(e,t){var n=[];for(var i in t){var o=!1;for(var a in e)if(e[a]===t[i]){o=!0;break}o||n.push(t[i])}return n},i.prototype.getBuffer=function(e){try{var t=o.Util.getSessionStorage(e);if(t){var n=JSON.parse(t);if(n)return n}}catch(i){o._InternalLogging.throwInternal(o.LoggingSeverity.CRITICAL,o._InternalMessageId.FailedToRestoreStorageBuffer," storage key: "+e+", "+o.Util.getExceptionName(i),{exception:o.Util.dump(i)})}return[]},i.prototype.setBuffer=function(e,t){try{var n=JSON.stringify(t);o.Util.setSessionStorage(e,n)}catch(i){o.Util.setSessionStorage(e,JSON.stringify([])),o._InternalLogging.