"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=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();0this.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("|");0r.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&&0i.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&&0i.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.throwInternal(o.LoggingSeverity.WARNING,o._InternalMessageId.FailedToSetStorageBuffer," storage key: "+e+", "+o.Util.getExceptionName(i)+". Buffer cleared",{exception:o.Util.dump(i)})}},i.BUFFER_KEY="AI_buffer",i.SENT_BUFFER_KEY="AI_sentBuffer",i.MAX_BUFFER_SIZE=2e3,i}();o.SessionStorageSendBuffer=t}(e.ApplicationInsights||(e.ApplicationInsights={}))}(Microsoft||(Microsoft={})),function(e){var l,t;l=e.ApplicationInsights||(e.ApplicationInsights={}),t=function(){function e(e){(this._XMLHttpRequestSupported=!1,this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._config=e,this._sender=null,this._buffer=l.Util.canUseSessionStorage()&&this._config.enableSessionStorageBuffer()?new l.SessionStorageSendBuffer(e):new l.ArraySendBuffer(e),!this._config.isBeaconApiDisabled()&&l.Util.IsBeaconApiSupported())?this._sender=this._beaconSender:"undefined"!=typeof XMLHttpRequest&&("withCredentials"in new XMLHttpRequest?(this._sender=this._xhrSender,this._XMLHttpRequestSupported=!0):"undefined"!=typeof XDomainRequest&&(this._sender=this._xdrSender))}return e.prototype.send=function(e){try{if(this._config.disableTelemetry())return;if(!e)return void l._InternalLogging.throwInternal(l.LoggingSeverity.CRITICAL,l._InternalMessageId.CannotSendEmptyTelemetry,"Cannot send empty telemetry");if(!this._sender)return void l._InternalLogging.throwInternal(l.LoggingSeverity.CRITICAL,l._InternalMessageId.SenderNotInitialized,"Sender was not initialized");var t=l.Serializer.serialize(e),n=this._buffer.getItems(),i=this._buffer.batchPayloads(n);i&&i.length+t.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(t),this._setupTimer()}catch(o){l._InternalLogging.throwInternal(l.LoggingSeverity.WARNING,l._InternalMessageId.FailedAddingTelemetryToBuffer,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+l.Util.getExceptionName(o),{exception:l.Util.dump(o)})}},e.prototype._setupTimer=function(){var e=this;if(!this._timeoutHandle){var t=this._retryAt?Math.max(0,this._retryAt-Date.now()):0,n=Math.max(this._config.maxBatchInterval(),t);this._timeoutHandle=setTimeout(function(){e.triggerSend()},n)}},e.prototype._getSizeInBytes=function(e){var t=0;if(e&&e.length)for(var n=0;n=t.itemsAccepted&&t.itemsReceived-t.itemsAccepted==t.errors.length)return t}}catch(n){l._InternalLogging.throwInternal(l.LoggingSeverity.CRITICAL,l._InternalMessageId.InvalidBackendResponse,"Cannot parse the response. "+l.Util.getExceptionName(n),{response:e})}return null},e.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},e.prototype._resendPayload=function(e){if(e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var t=0,n=e;tn.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},e.prototype._onPartialSuccess=function(e,t){for(var n=[],i=[],o=0,a=t.errors.reverse();o",n.assembly=s.Util.trim(e);var i=e.match(a.regex);return i&&5<=i.length&&(n.method=s.Util.trim(i[2])||n.method,n.fileName=s.Util.trim(i[4]),n.line=parseInt(i[5])||0),n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=a.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}return __extends(a,o),a.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,a.baseSize=58,a}(AI.StackFrame);o._StackFrame=f})((s=e.ApplicationInsights||(e.ApplicationInsights={})).Telemetry||(s.Telemetry={}))}(Microsoft||(Microsoft={})),function(e){var t;(t=e.DataPointType||(e.DataPointType={}))[t.Measurement=0]="Measurement",t[t.Aggregation=1]="Aggregation"}(AI||(AI={})),function(e){var t=function n(){this.kind=e.DataPointType.Measurement};e.DataPoint=t}(AI||(AI={})),function(e){var t=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return __extends(e,t),e}(Microsoft.Telemetry.Domain);e.MetricData=t}(AI||(AI={})),function(e){var n,t,i,o;n=e.ApplicationInsights||(e.ApplicationInsights={}),t=n.Telemetry||(n.Telemetry={}),i=t.Common||(t.Common={}),o=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:n.FieldType.Required,kind:n.FieldType.Default,value:n.FieldType.Required,count:n.FieldType.Default,min:n.FieldType.Default,max:n.FieldType.Default,stdDev:n.FieldType.Default},e}return __extends(e,t),e}(AI.DataPoint),i.DataPoint=o}(Microsoft||(Microsoft={})),function(c){var g,u,e;g=c.ApplicationInsights||(c.ApplicationInsights={}),u=g.Telemetry||(g.Telemetry={}),e=function(l){function e(e,t,n,i,o,a){var r=l.call(this)||this;r.aiDataContract={ver:g.FieldType.Required,metrics:g.FieldType.Required,properties:g.FieldType.Default};var s=new c.ApplicationInsights.Telemetry.Common.DataPoint;return s.count=0=d.MAX_DURATION_ALLOWED)return!1;return!0},d.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",d.dataType="PageviewPerformanceData",d.MAX_DURATION_ALLOWED=36e5,d}(AI.PageViewPerfData),h.PageViewPerformance=t}(Microsoft||(Microsoft={})),function(o){var s,e;s=o.ApplicationInsights||(o.ApplicationInsights={}),e=function(){function e(e){var t=this;this._config=e,this._sender=new s.Sender(e),this.appId=function(){return t._sender._appId},e.appId()&&(this._sender._appId=e.appId()),this.telemetryInitializers=[],"undefined"!=typeof window&&(this._sessionManager=new s.Context._SessionManager(e),this.application=new s.Context.Application,this.device=new s.Context.Device,this.internal=new s.Context.Internal(e),this.location=new s.Context.Location,this.user=new s.Context.User(e),this.operation=new s.Context.Operation,this.session=new s.Context.Session,this.sample=new s.Context.Sample(e.sampleRate())),this._addDefaultTelemetryInitializers()}return e.prototype.addTelemetryInitializer=function(e){this.telemetryInitializers.push(e)},e.prototype.track=function(e){return e?(e.name===s.Telemetry.PageView.envelopeType&&s._InternalLogging.resetInternalMessageCount(),this.session&&"string"!=typeof this.session.id&&this._sessionManager.update(),this._track(e)):s._InternalLogging.throwInternal(s.LoggingSeverity.CRITICAL,s._InternalMessageId.TrackArgumentsNotSpecified,"cannot call .track() with a null or undefined argument",null,!0),e},e.prototype._addDefaultTelemetryInitializers=function(){if(!this._config.isBrowserLinkTrackingEnabled()){var i=["/browserLinkSignalR/","/__browserLink/"];this.addTelemetryInitializer(function(e){if(e.name===o.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType){var t=e.data;if(t&&t.baseData)for(var n=0;n