pxt-core
Version:
Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors
1 lines • 96.4 kB
JavaScript
"use strict";var AI,Microsoft,__extends=this&&this.__extends||function(){var 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])};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();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(){},(e.Telemetry||(e.Telemetry={})).Base=t}(Microsoft||(Microsoft={})),function(e){var t;t=function(){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(e){var t,n,i,o;(n=t=e.LoggingSeverity||(e.LoggingSeverity={}))[n.CRITICAL=0]="CRITICAL",n[n.WARNING=1]="WARNING",(o=i=e._InternalMessageId||(e._InternalMessageId={}))[o.BrowserDoesNotSupportLocalStorage=0]="BrowserDoesNotSupportLocalStorage",o[o.BrowserCannotReadLocalStorage=1]="BrowserCannotReadLocalStorage",o[o.BrowserCannotReadSessionStorage=2]="BrowserCannotReadSessionStorage",o[o.BrowserCannotWriteLocalStorage=3]="BrowserCannotWriteLocalStorage",o[o.BrowserCannotWriteSessionStorage=4]="BrowserCannotWriteSessionStorage",o[o.BrowserFailedRemovalFromLocalStorage=5]="BrowserFailedRemovalFromLocalStorage",o[o.BrowserFailedRemovalFromSessionStorage=6]="BrowserFailedRemovalFromSessionStorage",o[o.CannotSendEmptyTelemetry=7]="CannotSendEmptyTelemetry",o[o.ClientPerformanceMathError=8]="ClientPerformanceMathError",o[o.ErrorParsingAISessionCookie=9]="ErrorParsingAISessionCookie",o[o.ErrorPVCalc=10]="ErrorPVCalc",o[o.ExceptionWhileLoggingError=11]="ExceptionWhileLoggingError",o[o.FailedAddingTelemetryToBuffer=12]="FailedAddingTelemetryToBuffer",o[o.FailedMonitorAjaxAbort=13]="FailedMonitorAjaxAbort",o[o.FailedMonitorAjaxDur=14]="FailedMonitorAjaxDur",o[o.FailedMonitorAjaxOpen=15]="FailedMonitorAjaxOpen",o[o.FailedMonitorAjaxRSC=16]="FailedMonitorAjaxRSC",o[o.FailedMonitorAjaxSend=17]="FailedMonitorAjaxSend",o[o.FailedMonitorAjaxGetCorrelationHeader=18]="FailedMonitorAjaxGetCorrelationHeader",o[o.FailedToAddHandlerForOnBeforeUnload=19]="FailedToAddHandlerForOnBeforeUnload",o[o.FailedToSendQueuedTelemetry=20]="FailedToSendQueuedTelemetry",o[o.FailedToReportDataLoss=21]="FailedToReportDataLoss",o[o.FlushFailed=22]="FlushFailed",o[o.MessageLimitPerPVExceeded=23]="MessageLimitPerPVExceeded",o[o.MissingRequiredFieldSpecification=24]="MissingRequiredFieldSpecification",o[o.NavigationTimingNotSupported=25]="NavigationTimingNotSupported",o[o.OnError=26]="OnError",o[o.SessionRenewalDateIsZero=27]="SessionRenewalDateIsZero",o[o.SenderNotInitialized=28]="SenderNotInitialized",o[o.StartTrackEventFailed=29]="StartTrackEventFailed",o[o.StopTrackEventFailed=30]="StopTrackEventFailed",o[o.StartTrackFailed=31]="StartTrackFailed",o[o.StopTrackFailed=32]="StopTrackFailed",o[o.TelemetrySampledAndNotSent=33]="TelemetrySampledAndNotSent",o[o.TrackEventFailed=34]="TrackEventFailed",o[o.TrackExceptionFailed=35]="TrackExceptionFailed",o[o.TrackMetricFailed=36]="TrackMetricFailed",o[o.TrackPVFailed=37]="TrackPVFailed",o[o.TrackPVFailedCalc=38]="TrackPVFailedCalc",o[o.TrackTraceFailed=39]="TrackTraceFailed",o[o.TransmissionFailed=40]="TransmissionFailed",o[o.FailedToSetStorageBuffer=41]="FailedToSetStorageBuffer",o[o.FailedToRestoreStorageBuffer=42]="FailedToRestoreStorageBuffer",o[o.InvalidBackendResponse=43]="InvalidBackendResponse",o[o.FailedToFixDepricatedValues=44]="FailedToFixDepricatedValues",o[o.InvalidDurationValue=45]="InvalidDurationValue",o[o.CannotSerializeObject=46]="CannotSerializeObject",o[o.CannotSerializeObjectNonSerializable=47]="CannotSerializeObjectNonSerializable",o[o.CircularReferenceDetected=48]="CircularReferenceDetected",o[o.ClearAuthContextFailed=49]="ClearAuthContextFailed",o[o.ExceptionTruncated=50]="ExceptionTruncated",o[o.IllegalCharsInName=51]="IllegalCharsInName",o[o.ItemNotInArray=52]="ItemNotInArray",o[o.MaxAjaxPerPVExceeded=53]="MaxAjaxPerPVExceeded",o[o.MessageTruncated=54]="MessageTruncated",o[o.NameTooLong=55]="NameTooLong",o[o.SampleRateOutOfRange=56]="SampleRateOutOfRange",o[o.SetAuthContextFailed=57]="SetAuthContextFailed",o[o.SetAuthContextFailedAccountName=58]="SetAuthContextFailedAccountName",o[o.StringValueTooLong=59]="StringValueTooLong",o[o.StartCalledMoreThanOnce=60]="StartCalledMoreThanOnce",o[o.StopCalledWithoutStart=61]="StopCalledWithoutStart",o[o.TelemetryInitializerFailed=62]="TelemetryInitializerFailed",o[o.TrackArgumentsNotSpecified=63]="TrackArgumentsNotSpecified",o[o.UrlTooLong=64]="UrlTooLong",o[o.SessionStorageBufferFull=65]="SessionStorageBufferFull",o[o.CannotAccessCookie=66]="CannotAccessCookie",o[o.IdTooLong=67]="IdTooLong";var a=function(){function e(t,n,o,a){void 0===o&&(o=!1),this.messageId=t,this.message=(o?e.AiUserActionablePrefix:e.AiNonUserActionablePrefix)+i[t].toString();var r=(n?" message:"+e.sanitizeDiagnosticText(n):"")+(a?" props:"+e.sanitizeDiagnosticText(JSON.stringify(a)):"");this.message+=r}return e.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},e.AiNonUserActionablePrefix="AI (Internal): ",e.AiUserActionablePrefix="AI: ",e}();e._InternalLogMessage=a;var r=function(){function n(){}return n.throwInternal=function(e,t,n,o,r){void 0===r&&(r=!1);var s=new a(t,n,r,o);if(this.enableDebugExceptions())throw s;if(void 0!==s&&s&&void 0!==s.message){if(r){var l=i[s.messageId];this._messageLogged[l]&&!this.verboseLogging()||(this.warnToConsole(s.message),this._messageLogged[l]=!0)}else this.verboseLogging()&&this.warnToConsole(s.message);this.logInternalMessage(e,s)}},n.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},n.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},n.clearInternalMessageLoggedTypes=function(){if(e.Util.canUseSessionStorage())for(var t=e.Util.getSessionStorageKeys(),i=0;i<t.length;i++)0===t[i].indexOf(n.AIInternalMessagePrefix)&&e.Util.removeSessionStorage(t[i])},n.setMaxInternalMessageLimit=function(e){if(!e)throw new Error("limit cannot be undefined.");this.MAX_INTERNAL_MESSAGE_LIMIT=e},n.logInternalMessage=function(o,r){if(!this._areInternalMessagesThrottled()){var s=!0,l=n.AIInternalMessagePrefix+i[r.messageId];if(e.Util.canUseSessionStorage()?e.Util.getSessionStorage(l)?s=!1:e.Util.setSessionStorage(l,"1"):this._messageLogged[l]?s=!1:this._messageLogged[l]=!0,s&&((this.verboseLogging()||o===t.CRITICAL)&&(this.queue.push(r),this._messageCount++),this._messageCount==this.MAX_INTERNAL_MESSAGE_LIMIT)){var c="Internal events throttle limit per PageView reached for this app.",g=new a(i.MessageLimitPerPVExceeded,c,!1);this.queue.push(g),this.warnToConsole(c)}}},n._areInternalMessagesThrottled=function(){return this._messageCount>=this.MAX_INTERNAL_MESSAGE_LIMIT},n.AIInternalMessagePrefix="AITR_",n.enableDebugExceptions=function(){return!1},n.verboseLogging=function(){return!1},n.queue=[],n.MAX_INTERNAL_MESSAGE_LIMIT=25,n._messageCount=0,n._messageLogged={},n}();e._InternalLogging=r}(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(e){var t,n;(n=t||(t={}))[n.LocalStorage=0]="LocalStorage",n[n.SessionStorage=1]="SessionStorage";var i=function(){function n(){}return n.disableStorage=function(){n._canUseLocalStorage=!1,n._canUseSessionStorage=!1},n._getLocalStorageObject=function(){return n.canUseLocalStorage()?n._getVerifiedStorageObject(t.LocalStorage):null},n._getVerifiedStorageObject=function(e){var n,i,o=null;try{i=new Date,(o=e===t.LocalStorage?window.localStorage:window.sessionStorage).setItem(i,i),n=o.getItem(i)!=i,o.removeItem(i),n&&(o=null)}catch(e){o=null}return o},n.isInternalApplicationInsightsEndpoint=function(e){return-1!==n._internalEndpoints.indexOf(e.toLowerCase())},n.canUseLocalStorage=function(){return void 0===n._canUseLocalStorage&&(n._canUseLocalStorage=!!n._getVerifiedStorageObject(t.LocalStorage)),n._canUseLocalStorage},n.getStorage=function(t){var i=n._getLocalStorageObject();if(null!==i)try{return i.getItem(t)}catch(t){n._canUseLocalStorage=!1,e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.BrowserCannotReadLocalStorage,"Browser failed read of local storage. "+n.getExceptionName(t),{exception:n.dump(t)})}return null},n.setStorage=function(t,i){var o=n._getLocalStorageObject();if(null!==o)try{return o.setItem(t,i),!0}catch(t){n._canUseLocalStorage=!1,e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.BrowserCannotWriteLocalStorage,"Browser failed write to local storage. "+n.getExceptionName(t),{exception:n.dump(t)})}return!1},n.removeStorage=function(t){var i=n._getLocalStorageObject();if(null!==i)try{return i.removeItem(t),!0}catch(t){n._canUseLocalStorage=!1,e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.BrowserFailedRemovalFromLocalStorage,"Browser failed removal of local storage item. "+n.getExceptionName(t),{exception:n.dump(t)})}return!1},n._getSessionStorageObject=function(){return n.canUseSessionStorage()?n._getVerifiedStorageObject(t.SessionStorage):null},n.canUseSessionStorage=function(){return void 0===n._canUseSessionStorage&&(n._canUseSessionStorage=!!n._getVerifiedStorageObject(t.SessionStorage)),n._canUseSessionStorage},n.getSessionStorageKeys=function(){var e=[];if(n.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},n.getSessionStorage=function(t){var i=n._getSessionStorageObject();if(null!==i)try{return i.getItem(t)}catch(t){n._canUseSessionStorage=!1,e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.BrowserCannotReadSessionStorage,"Browser failed read of session storage. "+n.getExceptionName(t),{exception:n.dump(t)})}return null},n.setSessionStorage=function(t,i){var o=n._getSessionStorageObject();if(null!==o)try{return o.setItem(t,i),!0}catch(t){n._canUseSessionStorage=!1,e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.BrowserCannotWriteSessionStorage,"Browser failed write to session storage. "+n.getExceptionName(t),{exception:n.dump(t)})}return!1},n.removeSessionStorage=function(t){var i=n._getSessionStorageObject();if(null!==i)try{return i.removeItem(t),!0}catch(t){n._canUseSessionStorage=!1,e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.BrowserFailedRemovalFromSessionStorage,"Browser failed removal of session storage item. "+n.getExceptionName(t),{exception:n.dump(t)})}return!1},n.disableCookies=function(){n._canUseCookies=!1},n.canUseCookies=function(){if(void 0===n._canUseCookies){n._canUseCookies=!1;try{n._canUseCookies=void 0!==n.document.cookie}catch(t){e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.CannotAccessCookie,"Cannot access document.cookie - "+n.getExceptionName(t),{exception:n.dump(t)})}}return n._canUseCookies},n.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"))},n.setCookie=function(e,t,i){var o="",a="";i&&(o=";domain="+i),n.document.location&&"https:"===n.document.location.protocol&&(a=";secure",null===n._uaDisallowsSameSiteNone&&"undefined"!=typeof navigator&&(n._uaDisallowsSameSiteNone=n.disallowsSameSiteNone(navigator.userAgent)),n._uaDisallowsSameSiteNone||(t+=";SameSite=None")),n.canUseCookies()&&(n.document.cookie=e+"="+t+o+";path=/"+a)},n.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},n.getCookie=function(e){if(n.canUseCookies()){var t="";if(e&&e.length)for(var i=e+"=",o=n.document.cookie.split(";"),a=0;a<o.length;a++){var r=o[a];if((r=n.trim(r))&&0===r.indexOf(i)){t=r.substring(i.length,o[a].length);break}}return t}},n.deleteCookie=function(e){n.canUseCookies()&&(n.document.cookie=e+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},n.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},n.newId=function(){return e.UtilHelpers.newId()},n.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},n.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},n.toISOStringForIE8=function(e){if(n.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"}},n.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},n.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},n.isCrossOriginError=function(e,t,n,i,o){return("Script error."===e||"Script error"===e)&&!o},n.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},n.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},n.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},n.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},n.document="undefined"!=typeof document?document:{},n._canUseCookies=void 0,n._canUseLocalStorage=void 0,n._canUseSessionStorage=void 0,n._uaDisallowsSameSiteNone=null,n._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],n.NotSpecified="not_specified",n}();e.Util=i;var o=function(){function e(){}return e.parseUrl=function(t){return e.htmlAnchorElement||(e.htmlAnchorElement=e.document.createElement?e.document.createElement("a"):{host:e.parseHost(t)}),e.htmlAnchorElement.href=t,e.htmlAnchorElement},e.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},e.getAbsoluteUrl=function(t){var n,i=e.parseUrl(t);return i&&(n=i.href),n},e.getPathName=function(t){var n,i=e.parseUrl(t);return i&&(n=i.pathname),n},e.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},e.document="undefined"!=typeof document?document:{},e}();e.UrlHelper=o;var a=function(){function t(){}return t.canIncludeCorrelationHeader=function(e,t,n){if(e&&e.disableCorrelationHeaders)return!1;if(!t)return!1;var i=o.parseUrl(t).host.toLowerCase();if(!(e&&e.enableCorsCorrelation||i===n))return!1;var a=e&&e.correlationHeaderExcludedDomains;if(!a||0==a.length)return!0;for(var r=0;r<a.length;r++)if(new RegExp(a[r].toLowerCase().replace(/\./g,".").replace(/\*/g,".*")).test(i))return!1;return!0},t.getCorrelationContext=function(n){if(n){var i=t.getCorrelationContextValue(n,e.RequestHeaders.requestContextTargetKey);if(i&&i!==t.correlationIdPrefix)return i}},t.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]}},t.correlationIdPrefix="cid-v1:",t}();e.CorrelationIdHelper=a}(e.ApplicationInsights||(e.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(e){!function(e){var t,n;(n=t=e.FieldType||(e.FieldType={}))[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden";var i=function(){function n(){}return n.serialize=function(e){var t=n._serializeObject(e,"root");return JSON.stringify(t)},n._serializeObject=function(i,o){var a="__aiCircularRefCheck",r={};if(!i)return e._InternalLogging.throwInternal(e.LoggingSeverity.CRITICAL,e._InternalMessageId.CannotSerializeObject,"cannot serialize object because it is null or undefined",{name:o},!0),r;if(i[a])return e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.CircularReferenceDetected,"Circular reference detected while serializing object",{name:o},!0),r;if(!i.aiDataContract){if("measurements"===o)r=n._serializeStringMap(i,"number",o);else if("properties"===o)r=n._serializeStringMap(i,"string",o);else if("tags"===o)r=n._serializeStringMap(i,"string",o);else if(e.Util.isArray(i))r=n._serializeArray(i,o);else{e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.CannotSerializeObjectNonSerializable,"Attempting to serialize an object which does not implement ISerializable",{name:o},!0);try{JSON.stringify(i),r=i}catch(t){e._InternalLogging.throwInternal(e.LoggingSeverity.CRITICAL,e._InternalMessageId.CannotSerializeObject,t&&"function"==typeof t.toString?t.toString():"Error serializing object",null,!0)}}return r}for(var s in i[a]=!0,i.aiDataContract){var l,c=i.aiDataContract[s],g="function"==typeof c?c()&t.Required:c&t.Required,u="function"==typeof c?c()&t.Hidden:c&t.Hidden,p=c&t.Array,d=void 0!==i[s],f="object"==typeof i[s]&&null!==i[s];!g||d||p?u||void 0!==(l=f?p?n._serializeArray(i[s],s):n._serializeObject(i[s],s):i[s])&&(r[s]=l):e._InternalLogging.throwInternal(e.LoggingSeverity.CRITICAL,e._InternalMessageId.MissingRequiredFieldSpecification,"Missing required field specification. The field is required but not present on source",{field:s,name:o})}return delete i[a],r},n._serializeArray=function(t,i){var o=void 0;if(t)if(e.Util.isArray(t)){o=[];for(var a=0;a<t.length;a++){var r=t[a],s=n._serializeObject(r,i+"["+a+"]");o.push(s)}}else e._InternalLogging.throwInternal(e.LoggingSeverity.CRITICAL,e._InternalMessageId.ItemNotInArray,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:i},!0);return o},n._serializeStringMap=function(t,n,i){var o=void 0;if(t)for(var a in o={},t){var r=t[a];if("string"===n)void 0===r?o[a]="undefined":null===r?o[a]="null":r.toString?o[a]=r.toString():o[a]="invalid field: toString() is not defined.";else if("number"===n)if(void 0===r)o[a]="undefined";else if(null===r)o[a]="null";else{var s=parseFloat(r);isNaN(s)?o[a]="NaN":o[a]=s}else o[a]="invalid field: "+i+" is of unknown type.",e._InternalLogging.throwInternal(e.LoggingSeverity.CRITICAL,o[a],null,!0)}return o},n}();e.Serializer=i}(e.ApplicationInsights||(e.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(e){var t,n,i,o;n=(t=e.ApplicationInsights||(e.ApplicationInsights={})).Telemetry||(t.Telemetry={}),i=n.Common||(n.Common={}),o=function(e){function n(n,o){var a=e.call(this)||this;return a.name=i.DataSanitizer.sanitizeString(o)||t.Util.NotSpecified,a.data=n,a.time=t.Util.toISOStringForIE8(new Date),a.aiDataContract={time:t.FieldType.Required,iKey:t.FieldType.Required,name:t.FieldType.Required,sampleRate:function(){return 100==a.sampleRate?t.FieldType.Hidden:t.FieldType.Required},tags:t.FieldType.Required,data:t.FieldType.Required},a}return __extends(n,e),n}(e.Telemetry.Envelope),i.Envelope=o}(Microsoft||(Microsoft={})),function(e){var t,n,i,o;i=(n=(t=e.ApplicationInsights||(e.ApplicationInsights={})).Telemetry||(t.Telemetry={})).Common||(n.Common={}),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.aiDataContract={},t}return __extends(t,e),t}(e.Telemetry.Base),i.Base=o}(Microsoft||(Microsoft={})),(AI||(AI={})).ContextTagKeys=function(){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"},function(e){var t,n;n=function(){},((t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})).Application=n}(Microsoft||(Microsoft={})),function(e){var t,n;n=function(){this.id="browser",this.type="Browser"},((t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})).Device=n}(Microsoft||(Microsoft={})),function(e){var t,n;n=function(e){this.sdkVersion=(e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:"+t.Version},((t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})).Internal=n}(Microsoft||(Microsoft={})),function(e){var t,n;n=function(){},((t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})).Location=n}(Microsoft||(Microsoft={})),function(e){var t,n;n=function(){this.id=t.Util.newId(),window&&window.location&&window.location.pathname&&(this.name=window.location.pathname)},((t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={})).Operation=n}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function(){function e(){}return e.prototype.getHashCodeScore=function(t){return this.getHashCode(t)/e.INT_MAX_VALUE*100},e.prototype.getHashCode=function(t){if(""==t)return 0;for(;t.length<e.MIN_INPUT_LENGTH;)t=t.concat(t);for(var n=5381,i=0;i<t.length;++i)n=(n<<5)+n+t.charCodeAt(i),n&=n;return Math.abs(n)},e.INT_MAX_VALUE=2147483647,e.MIN_INPUT_LENGTH=8,e}(),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;n=(t=e.ApplicationInsights||(e.ApplicationInsights={})).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 t;!function(e){var n=function(){};e.Session=n;var i=function(){function e(t){t||(t={}),"function"!=typeof t.sessionExpirationMs&&(t.sessionExpirationMs=function(){return e.acquisitionSpan}),"function"!=typeof t.sessionRenewalMs&&(t.sessionRenewalMs=function(){return e.renewalSpan}),this.config=t,this.automaticSession=new n}return e.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var n=t.dateTime.Now(),i=n-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),o=n-this.automaticSession.renewalDate>this.config.sessionRenewalMs();i||o?(this.automaticSession.isFirst=void 0,this.renew()):(!this.cookieUpdatedTimestamp||n-this.cookieUpdatedTimestamp>e.cookieUpdateInterval)&&(this.automaticSession.renewalDate=n,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},e.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},e.prototype.initializeAutomaticSession=function(){var e=t.Util.getCookie("ai_session");if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var n=t.Util.getStorage("ai_session");n&&this.initializeAutomaticSessionWithData(n)}this.automaticSession.id||(this.automaticSession.isFirst=!0,this.renew())},e.prototype.initializeAutomaticSessionWithData=function(e){var n=e.split("|");0<n.length&&(this.automaticSession.id=n[0]);try{if(1<n.length){var i=+n[1];this.automaticSession.acquisitionDate=+new Date(i),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<n.length){var o=+n[2];this.automaticSession.renewalDate=+new Date(o),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(e){t._InternalLogging.throwInternal(t.LoggingSeverity.CRITICAL,t._InternalMessageId.ErrorParsingAISessionCookie,"Error parsing ai_session cookie, session will be reset: "+t.Util.getExceptionName(e),{exception:t.Util.dump(e)})}0==this.automaticSession.renewalDate&&t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._InternalMessageId.SessionRenewalDateIsZero,"AI session renewal date is 0, session will be reset.")},e.prototype.renew=function(){var e=t.dateTime.Now();this.automaticSession.id=t.Util.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),t.Util.canUseLocalStorage()||t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._InternalMessageId.BrowserDoesNotSupportLocalStorage,"Browser does not support local storage. Session durations will be inaccurate.")},e.prototype.setCookie=function(e,n,i){var o=n+this.config.sessionExpirationMs(),a=i+this.config.sessionRenewalMs(),r=new Date,s=[e,n,i];o<a?r.setTime(o):r.setTime(a);var l=this.config.cookieDomain?this.config.cookieDomain():null;t.Util.setCookie("ai_session",s.join("|")+";expires="+r.toUTCString(),l),this.cookieUpdatedTimestamp=t.dateTime.Now()},e.prototype.setStorage=function(e,n,i){t.Util.setStorage("ai_session",[e,n,i].join("|"))},e.acquisitionSpan=864e5,e.renewalSpan=18e5,e.cookieUpdateInterval=6e4,e}();e._SessionManager=i}((t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={}))}(Microsoft||(Microsoft={})),function(e){var t,n,i;n=(t=e.ApplicationInsights||(e.ApplicationInsights={})).Context||(t.Context={}),i=function(){function e(n){var i=t.Util.getCookie(e.userCookieName);if(i){var o=i.split(e.cookieSeparator);0<o.length&&(this.id=o[0])}if(this.config=n,!this.id){this.id=t.Util.newId();var a=new Date,r=t.Util.toISOStringForIE8(a);this.accountAcquisitionDate=r,a.setTime(a.getTime()+31536e6);var s=[this.id,r],l=this.config.cookieDomain?this.config.cookieDomain():void 0;t.Util.setCookie(e.userCookieName,s.join(e.cookieSeparator)+";expires="+a.toUTCString(),l),t.Util.removeStorage("ai_session")}this.accountId=n.accountId?n.accountId():void 0;var c=t.Util.getCookie(e.authUserCookieName);if(c){var g=(c=decodeURI(c)).split(e.cookieSeparator);g[0]&&(this.authenticatedId=g[0]),1<g.length&&g[1]&&(this.accountId=g[1])}}return e.prototype.setAuthenticatedUserContext=function(n,i,o){if(void 0===o&&(o=!1),!this.validateUserInput(n)||i&&!this.validateUserInput(i))t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._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=n;var a=this.authenticatedId;i&&(this.accountId=i,a=[this.authenticatedId,this.accountId].join(e.cookieSeparator)),o&&t.Util.setCookie(e.authUserCookieName,encodeURI(a),this.config.cookieDomain())}},e.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,t.Util.deleteCookie(e.authUserCookieName)},e.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},e.cookieSeparator="|",e.userCookieName="ai_user",e.authUserCookieName="ai_authUser",e}(),n.User=i}(Microsoft||(Microsoft={})),function(e){!function(e){var t=function(){function e(){}return e.IsNullOrUndefined=function(e){return null==e},e}();e.extensions=t;var n=function(){function e(){}return e.GetLength=function(e){var n=0;if(!t.IsNullOrUndefined(e)){var i="";try{i=e.toString()}catch(e){}n=i.length,n=isNaN(n)?0:n}return n},e}();e.stringUtils=n;var i=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,n){var i=null;return 0===e||0===n||t.IsNullOrUndefined(e)||t.IsNullOrUndefined(n)||(i=n-e),i},e}();e.dateTime=i;var o=function(){function e(){}return e.AttachEvent=function(e,n,i){var o=!1;return t.IsNullOrUndefined(e)||(t.IsNullOrUndefined(e.attachEvent)?t.IsNullOrUndefined(e.addEventListener)||(e.addEventListener(n,i,!1),o=!0):(e.attachEvent("on"+n,i),o=!0)),o},e.DetachEvent=function(e,n,i){t.IsNullOrUndefined(e)||(t.IsNullOrUndefined(e.detachEvent)?t.IsNullOrUndefined(e.removeEventListener)||e.removeEventListener(n,i,!1):e.detachEvent("on"+n,i))},e}();e.EventHelper=o;var a=function(){function t(){}return t.ParseDependencyPath=function(t,n,i){var o,a;if(t&&0<t.length){var r=e.UrlHelper.parseUrl(t);o=r.host,null!=r.pathname?("/"!==(i=0===r.pathname.length?"/":r.pathname).charAt(0)&&(i="/"+i),a=e.Telemetry.Common.DataSanitizer.sanitizeString(n?n+" "+i:i)):a=e.Telemetry.Common.DataSanitizer.sanitizeString(t)}else a=o=i;return{target:o,name:a}},t}();e.AjaxHelper=a}(e.ApplicationInsights||(e.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(e){!function(e){var t=function(){this.openDone=!1,this.setRequestHeaderDone=!1,this.sendDone=!1,this.abortDone=!1,this.onreadystatechangeCallbackAttached=!1};e.XHRMonitoringState=t;var n=function(){function n(n){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 t,this.clientFailure=0,this.CalculateMetrics=function(){this.ajaxTotalDuration=Math.round(1e3*e.dateTime.GetDuration(this.requestSentTime,this.responseFinishedTime))/1e3},this.id=n}return n.prototype.getAbsoluteUrl=function(){return this.requestUrl?e.UrlHelper.getAbsoluteUrl(this.requestUrl):null},n.prototype.getPathName=function(){return this.requestUrl?e.Telemetry.Common.DataSanitizer.sanitizeUrl(e.UrlHelper.getCompleteUrl(this.method,this.requestUrl)):null},n}();e.ajaxRecord=n}(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(){},(e.Telemetry||(e.Telemetry={})).Domain=t}(Microsoft||(Microsoft={})),function(e){var t=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return __extends(t,e),t}(Microsoft.Telemetry.Domain);e.EventData=t}(AI||(AI={})),function(e){var t=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.properties={},t.measurements={},t}return __extends(t,e),t}(e.EventData);e.PageViewData=t}(AI||(AI={})),function(e){var t=function(e){function t(){var t=e.call(this)||this;return t.ver=2,t.success=!0,t.properties={},t.measurements={},t}return __extends(t,e),t}(Microsoft.Telemetry.Domain);e.RemoteDependencyData=t}(AI||(AI={})),function(e){var t,n,i,o;i=(n=(t=e.ApplicationInsights||(e.ApplicationInsights={})).Telemetry||(t.Telemetry={})).Common||(n.Common={}),o=function(){function e(){}return e.sanitizeKeyAndAddUniqueness=function(t,n){var i=t.length,o=e.sanitizeKey(t);if(o.length!==i){for(var a=0,r=o;void 0!==n[r];)a++,r=o.substring(0,e.MAX_NAME_LENGTH-3)+e.padNumber(a);o=r}return o},e.sanitizeKey=function(n){return n&&(n=t.Util.trim(n.toString())).length>e.MAX_NAME_LENGTH&&(n=n.substring(0,e.MAX_NAME_LENGTH),t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._InternalMessageId.NameTooLong,"name is too long. It has been truncated to "+e.MAX_NAME_LENGTH+" characters.",{name:n},!0)),n},e.sanitizeString=function(n,i){return void 0===i&&(i=e.MAX_STRING_LENGTH),n&&(i=i||e.MAX_STRING_LENGTH,(n=t.Util.trim(n)).toString().length>i&&(n=n.toString().substring(0,i),t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._InternalMessageId.StringValueTooLong,"string value is too long. It has been truncated to "+i+" characters.",{value:n},!0))),n},e.sanitizeUrl=function(n){return e.sanitizeInput(n,e.MAX_URL_LENGTH,t._InternalMessageId.UrlTooLong)},e.sanitizeMessage=function(n){return n&&n.length>e.MAX_MESSAGE_LENGTH&&(n=n.substring(0,e.MAX_MESSAGE_LENGTH),t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._InternalMessageId.MessageTruncated,"message is too long, it has been truncated to "+e.MAX_MESSAGE_LENGTH+" characters.",{message:n},!0)),n},e.sanitizeException=function(n){return n&&n.length>e.MAX_EXCEPTION_LENGTH&&(n=n.substring(0,e.MAX_EXCEPTION_LENGTH),t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._InternalMessageId.ExceptionTruncated,"exception is too long, it has been truncated to "+e.MAX_EXCEPTION_LENGTH+" characters.",{exception:n},!0)),n},e.sanitizeProperties=function(t){if(t){var n={};for(var i in t){var o=e.sanitizeString(t[i],e.MAX_PROPERTY_LENGTH);n[i=e.sanitizeKeyAndAddUniqueness(i,n)]=o}t=n}return t},e.sanitizeMeasurements=function(t){if(t){var n={};for(var i in t){var o=t[i];n[i=e.sanitizeKeyAndAddUniqueness(i,n)]=o}t=n}return t},e.sanitizeId=function(n){return n?e.sanitizeInput(n,e.MAX_ID_LENGTH,t._InternalMessageId.IdTooLong).toString():n},e.sanitizeInput=function(e,n,i){return e&&(e=t.Util.trim(e)).length>n&&(e=e.substring(0,n),t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,i,"input is too long, it has been truncated to "+n+" characters.",{data:e},!0)),e},e.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},e.MAX_NAME_LENGTH=150,e.MAX_ID_LENGTH=128,e.MAX_PROPERTY_LENGTH=8192,e.MAX_STRING_LENGTH=1024,e.MAX_URL_LENGTH=2048,e.MAX_MESSAGE_LENGTH=32768,e.MAX_EXCEPTION_LENGTH=32768,e}(),i.DataSanitizer=o}(Microsoft||(Microsoft={})),function(e){var t,n,i;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=t.Telemetry||(t.Telemetry={}),i=function(e){function i(i,o,a,r,s,l,c,g,u){var p=e.call(this)||this;p.aiDataContract={id:t.FieldType.Required,ver:t.FieldType.Required,name:t.FieldType.Default,resultCode:t.FieldType.Default,duration:t.FieldType.Default,success:t.FieldType.Default,data:t.FieldType.Default,target:t.FieldType.Default,type:t.FieldType.Default,properties:t.FieldType.Default,measurements:t.FieldType.Default,kind:t.FieldType.Default,value:t.FieldType.Default,count:t.FieldType.Default,min:t.FieldType.Default,max:t.FieldType.Default,stdDev:t.FieldType.Default,dependencyKind:t.FieldType.Default,dependencySource:t.FieldType.Default,commandName:t.FieldType.Default,dependencyTypeName:t.FieldType.Default},p.id=i,p.duration=t.Util.msToTimeSpan(r),p.success=s,p.resultCode=l+"",p.type="Ajax",p.data=n.Common.DataSanitizer.sanitizeUrl(a);var d=t.AjaxHelper.ParseDependencyPath(o,c,a);return p.target=d.target,p.name=d.name,p.properties=t.Telemetry.Common.DataSanitizer.sanitizeProperties(g),p.measurements=t.Telemetry.Common.DataSanitizer.sanitizeMeasurements(u),p}return __extends(i,e),i.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",i.dataType="RemoteDependencyData",i}(AI.RemoteDependencyData),n.RemoteDependencyData=i}(Microsoft||(Microsoft={})),function(e){var t,n;t=e.ApplicationInsights||(e.ApplicationInsights={}),n=function(){function n(e){this.currentWindowHost="object"==typeof window?window.location.host&&window.location.host.toLowerCase():void 0,this.appInsights=e,this.initialized=!1,this.Init()}return n.prototype.Init=function(){this.supportsMonitoring()&&(this.instrumentOpen(),this.instrumentSend(),this.instrumentAbort(),this.initialized=!0)},n.prototype.isMonitoredInstance=function(e,i){return this.initialized&&(!0===i||!t.extensions.IsNullOrUndefined(e.ajaxData))&&!0!==e[n.DisabledPropertyName]},n.prototype.supportsMonitoring=function(){var e=!0;("function"!=typeof XMLHttpRequest||t.extensions.IsNullOrUndefined(XMLHttpRequest)||t.extensions.IsNullOrUndefined(XMLHttpRequest.prototype)||t.extensions.IsNullOrUndefined(XMLHttpRequest.prototype.open)||t.extensions.IsNullOrUndefined(XMLHttpRequest.prototype.send)||t.extensions.IsNullOrUndefined(XMLHttpRequest.prototype.abort))&&(e=!1);try{" a ".trim()}catch(t){e=!1}return e},n.prototype.instrumentOpen=function(){var i=XMLHttpRequest.prototype.open,o=this;XMLHttpRequest.prototype.open=function(a,r,s){try{!o.isMonitoredInstance(this,!0)||this.ajaxData&&this.ajaxData.xhrMonitoringState.openDone||o.openHandler(this,a,r,s)}catch(i){t._InternalLogging.throwInternal(t.LoggingSeverity.CRITICAL,t._InternalMessageId.FailedMonitorAjaxOpen,"Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:n.getFailedAjaxDiagnosticsMessage(this),exception:e.ApplicationInsights.Util.dump(i)})}return i.apply(this,arguments)}},n.prototype.openHandler=function(e,n,i,o){var a="|"+this.appInsights.context.operation.id+"."+t.Util.newId(),r=new t.ajaxRecord(a);r.method=n,r.requestUrl=i,r.xhrMonitoringState.openDone=!0,e.ajaxData=r,this.attachToOnReadyStateChange(e)},n.getFailedAjaxDiagnosticsMessage=function(e){var n="";try{t.extensions.IsNullOrUndefined(e)||t.extensions.IsNullOrUndefined(e.ajaxData)||t.extensions.IsNullOrUndefined(e.ajaxData.requestUrl)||(n+="(url: '"+e.ajaxData.requestUrl+"')")}catch(e){}return n},n.prototype.instrumentSend=function(){var i=XMLHttpRequest.prototype.send,o=this;XMLHttpRequest.prototype.send=function(a){try{o.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.sendDone&&o.sendHandler(this,a)}catch(i){t._InternalLogging.throwInternal(t.LoggingSeverity.CRITICAL,t._InternalMessageId.FailedMonitorAjaxSend,"Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:n.getFailedAjaxDiagnosticsMessage(this),exception:e.ApplicationInsights.Util.dump(i)})}return i.apply(this,arguments)}},n.prototype.sendHandler=function(e,n){if(e.ajaxData.requestSentTime=t.dateTime.Now(),t.CorrelationIdHelper.canIncludeCorrelationHeader(this.appInsights.config,e.ajaxData.getAbsoluteUrl(),this.currentWindowHost)&&(e.setRequestHeader(t.RequestHeaders.requestIdHeader,e.ajaxData.id),this.appInsights.context)){var i=this.appInsights.context.appId();i&&e.setRequestHeader(t.RequestHeaders.requestContextHeader,t.RequestHeaders.requestContextAppIdFormat+i)}e.ajaxData.xhrMonitoringState.sendDone=!0},n.prototype.instrumentAbort=function(){var i=XMLHttpRequest.prototype.abort,o=this;XMLHttpRequest.prototype.abort=function(){try{o.isMonitoredInstance(this)&&!this.ajaxData.xhrMonitoringState.abortDone&&(this.ajaxData.aborted=1,this.ajaxData.xhrMonitoringState.abortDone=!0)}catch(i){t._InternalLogging.throwInternal(t.LoggingSeverity.CRITICAL,t._InternalMessageId.FailedMonitorAjaxAbort,"Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:n.getFailedAjaxDiagnosticsMessage(this),exception:e.ApplicationInsights.Util.dump(i)})}return i.apply(this,arguments)}},n.prototype.attachToOnReadyStateChange=function(i){var o=this;i.ajaxData.xhrMonitoringState.onreadystatechangeCallbackAttached=t.EventHelper.AttachEvent(i,"readystatechange",(function(){try{o.isMonitoredInstance(i)&&4===i.readyState&&o.onAjaxComplete(i)}catch(o){var a=e.ApplicationInsights.Util.dump(o);a&&-1!=a.toLowerCase().indexOf("c00c023f")||t._InternalLogging.throwInternal(t.LoggingSeverity.CRITICAL,t._InternalMessageId.FailedMonitorAjaxRSC,"Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.",{ajaxDiagnosticsMessage:n.getFailedAjaxDiagnosticsMessage(i),exception:e.ApplicationInsights.Util.dump(o)})}}))},n.prototype.onAjaxComplete=function(e){if(e.ajaxData.responseFinishedTime=t.dateTime.Now(),e.ajaxData.status=e.status,e.ajaxData.CalculateMetrics(),e.ajaxData.ajaxTotalDuration<0)t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._InternalMessageId.FailedMonitorAjaxDur,"Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.",{ajaxDiagnosticsMessage:n.getFailedAjaxDiagnosticsMessage(e),requestSentTime:e.ajaxData.requestSentTime,responseFinishedTime:e.ajaxData.responseFinishedTime});else{var i=new t.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),o=this.getCorrelationContext(e);o&&(i.target=i.target+" | "+o),this.appInsights.trackDependencyData(i),e.ajaxData=null}},n.prototype.getCorrelationContext=function(i){try{var o=i.getAllResponseHeaders();if(null!==o&&-1!==o.toLowerCase().indexOf(t.RequestHeaders.requestContextHeaderLowerCase)){var a=i.getResponseHeader(t.RequestHeaders.requestContextHeader);return t.CorrelationIdHelper.getCorrelationContext(a)}}catch(o){t._InternalLogging.throwInternal(t.LoggingSeverity.WARNING,t._InternalMessageId.FailedMonitorAjaxGetCorrelationHeader,"Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",{ajaxDiagnosticsMessage:n.getFailedAjaxDiagnosticsMessage(i),exception:e.ApplicationInsights.Util.dump(o)})}},n.instrumentedByAppInsightsName="InstrumentedByAppInsights",n.DisabledPropertyName="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",n}(),t.AjaxMonitor=n}(Microsoft||(Microsoft={})),function(e){!function(e){var t=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}();e.ArraySendBuffer=t;var n=function(){function t(e){this._bufferFullMessageSent=!1,this._config=e;var n=this.getBuffer(t.BUFFER_KEY),i=this.getBuffer(t.SENT_BUFFER_KEY);this._buffer=n.concat(i),this._buffer.length>t.MAX_BUFFER_SIZE&&(this._buffer.length=t.MAX_BUFFER_SIZE),this.setBuffer(t.SENT_BUFFER_KEY,[]),this.setBuffer(t.BUFFER_KEY,this._buffer)}return t.prototype.enqueue=function(n){this._buffer.length>=t.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.SessionStorageBufferFull,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(n),this.setBuffer(t.BUFFER_KEY,this._buffer))},t.prototype.count=function(){return this._buffer.length},t.prototype.clear=function(){this._buffer.length=0,this.setBuffer(t.BUFFER_KEY,[]),this.setBuffer(t.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},t.prototype.getItems=function(){return this._buffer.slice(0)},t.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},t.prototype.markAsSent=function(n){this._buffer=this.removePayloadsFromBuffer(n,this._buffer),this.setBuffer(t.BUFFER_KEY,this._buffer);var i=this.getBuffer(t.SENT_BUFFER_KEY);i instanceof Array&&n instanceof Array&&((i=i.concat(n)).length>t.MAX_BUFFER_SIZE&&(e._InternalLogging.throwInternal(e.LoggingSeverity.CRITICAL,e._InternalMessageId.SessionStorageBufferFull,"Sent buffer reached its maximum size: "+i.length,!0),i.length=t.MAX_BUFFER_SIZE),this.setBuffer(t.SENT_BUFFER_KEY,i))},t.prototype.clearSent=function(e){var n=this.getBuffer(t.SENT_BUFFER_KEY);n=this.removePayloadsFromBuffer(e,n),this.setBuffer(t.SENT_BUFFER_KEY,n)},t.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},t.prototype.getBuffer=function(t){try{var n=e.Util.getSessionStorage(t);if(n){var i=JSON.parse(n);if(i)return i}}catch(n){e._InternalLogging.throwInternal(e.LoggingSeverity.CRITICAL,e._InternalMessageId.FailedToRestoreStorageBuffer," storage key: "+t+", "+e.Util.getExceptionName(n),{exception:e.Util.dump(n)})}return[]},t.prototype.setBuffer=function(t,n){try{var i=JSON.stringify(n);e.Util.setSessionStorage(t,i)}catch(n){e.Util.setSessionStorage(t,JSON.stringify([])),e._InternalLogging.throwInternal(e.LoggingSeverity.WARNING,e._InternalMessageId.FailedToSetStorageBuffer," storage key: "+t+", "+e.Util.getExceptionName(n)+". Buffer cleared",{exception: