Socket
Socket
Sign inDemoInstall

@microsoft/applicationinsights-channel-js

Package Overview
Dependencies
Maintainers
5
Versions
574
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/applicationinsights-channel-js - npm Package Compare versions

Comparing version 2.0.0-rc1 to 2.0.0-rc2

4

browser/applicationinsights-channel-js.min.js
/*!
* Application Insights JavaScript SDK - Channel, 2.0.0-rc1
* Application Insights JavaScript SDK - Channel, 2.0.0-rc2
* Copyright (c) Microsoft and contributors. All rights reserved.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function n(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,t,h,a,f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(a=h||(h={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g,o,m=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(s,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),s=/[xy]/g;(o=g||(g={}))[o.CRITICAL=1]="CRITICAL",o[o.WARNING=2]="WARNING";var u,c,l=1,p=2,d=3,v=4,y=5,_=6,I=7,S=12,b=22,w=24,E=26,N=28,x=40,A=41,C=42,D=43,T=46,R=47,M=48,U=49,L=50,O=52,P=54,z=56,B=57,k=61,V=64,q=66,F=67,G=68,X=69,j=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=j}e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,r,i){var a=this;if(this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<j&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error(H+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];s.priority>j&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}}(),500),H="Channel has invalid priority",K=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}(),W=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=s.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(a);i=o}return i},s.sanitizeKey=function(e,t){return t&&(t=s.trim(t.toString())).length>s.MAX_NAME_LENGTH&&(t=t.substring(0,s.MAX_NAME_LENGTH),e.throwInternal(g.WARNING,B,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),t},s.sanitizeString=function(e,t,n){return void 0===n&&(n=s.MAX_STRING_LENGTH),t&&(n=n||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>n&&(t=t.toString().substring(0,n),e.throwInternal(g.WARNING,k,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,q)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(g.WARNING,z,"message is too long, it has been truncated to "+s.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),t},s.sanitizeException=function(e,t){return t&&t.length>s.MAX_EXCEPTION_LENGTH&&(t=t.substring(0,s.MAX_EXCEPTION_LENGTH),e.throwInternal(g.WARNING,O,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(g.WARNING,U,"custom property is not valid",{exception:e},!0)}i=s.sanitizeString(t,i,s.MAX_PROPERTY_LENGTH),n[r=s.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=s.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,X).toString():t},s.sanitizeInput=function(e,t,n,r){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(g.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),t},s.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.MAX_NAME_LENGTH=150,s.MAX_ID_LENGTH=128,s.MAX_PROPERTY_LENGTH=8192,s.MAX_STRING_LENGTH=1024,s.MAX_URL_LENGTH=2048,s.MAX_MESSAGE_LENGTH=32768,s.MAX_EXCEPTION_LENGTH=32768,s}(),Y=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(i.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(i.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,l,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var r=s._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,d,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,y,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(i.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(i.SessionStorage)),s._canUseSessionStorage},s.getSessionStorageKeys=function(){var e=[];if(s.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},s.getSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,p,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var r=s._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,v,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,_,"Browser failed removal of session storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.disableCookies=function(){s._canUseCookies=!1},s.canUseCookies=function(t){if(void 0===s._canUseCookies){s._canUseCookies=!1;try{s._canUseCookies=void 0!==s.document.cookie}catch(e){t.throwInternal(g.WARNING,G,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),s.document.location&&"https:"===s.document.location.protocol&&(a=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+i+";path=/"+a)},s.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},s.getCookie=function(e,t){if(s.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=s.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=s.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},s.deleteCookie=function(e,t){s.canUseCookies(e)&&(s.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.newId=function(){for(var e="",t=1073741824*Math.random();0<t;){e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64)}return e},s.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},s.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},s.toISOStringForIE8=function(e){if(s.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},s.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},s.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+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,r=r.length<2?"0"+r:r,(0<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},s.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},s.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},s.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},s.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},s.document="undefined"!=typeof document?document:{},s._canUseCookies=void 0,s._canUseLocalStorage=void 0,s._canUseSessionStorage=void 0,s._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],s.NotSpecified="not_specified",s}(),J=function(){function r(){}return r.parseUrl=function(e){return r.htmlAnchorElement||(r.htmlAnchorElement=r.document.createElement?r.document.createElement("a"):{}),r.htmlAnchorElement.href=e,r.htmlAnchorElement},r.getAbsoluteUrl=function(e){var t,n=r.parseUrl(e);return n&&(t=n.href),t},r.getPathName=function(e){var t,n=r.parseUrl(e);return n&&(t=n.pathname),t},r.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},r.document="undefined"!=typeof document?document:{},r}(),Z=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=J.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var u=0===s.pathname.length?"/":s.pathname;"/"!==u.charAt(0)&&(u="/"+u),o=s.pathname,a=W.sanitizeString(e,n?n+" "+u:u)}else a=W.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},e}(),Q=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||m.isNullOrUndefined(e)||m.isNullOrUndefined(t)||(n=t-e),n}}(),"ProcessLegacy"),$="http.method",ee=function(e){function t(){return e.call(this)||this}return n(t,e),t}(function(){}),te=function(i){function e(e,t,n){var r=i.call(this)||this;return r.name=W.sanitizeString(e,n)||Y.NotSpecified,r.data=t,r.time=Y.toISOStringForIE8(new Date),r.aiDataContract={time:h.Required,iKey:h.Required,name:h.Required,sampleRate:function(){return 100==r.sampleRate?h.Hidden:h.Required},tags:h.Required,data:h.Required},r}return n(e,i),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ne=function(){},re=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(ne),ie=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:h.Required,name:h.Required,properties:h.Default,measurements:h.Default},i.name=W.sanitizeString(e,t)||Y.NotSpecified,i.properties=W.sanitizeProperties(e,n),i.measurements=W.sanitizeMeasurements(e,r),i}return n(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(re),ae=function(){},oe=function(){this.hasFullStack=!0,this.parsedStack=[]},se=function(o){function e(e,t,n,r,i){var a=o.call(this)||this;return a.aiDataContract={ver:h.Required,exceptions:h.Required,severityLevel:h.Default,properties:h.Default,measurements:h.Default},a.properties=W.sanitizeProperties(e,n),a.measurements=W.sanitizeMeasurements(e,r),a.exceptions=[new ue(e,t)],i&&(a.severityLevel=i),a}return n(e,o),e.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return n(e,t),e}(ne)),ue=function(i){function e(e,t){var n=i.call(this)||this;n.aiDataContract={id:h.Default,outerId:h.Default,typeName:h.Required,message:h.Required,hasFullStack:h.Default,stack:h.Default,parsedStack:h.Array},n.typeName=W.sanitizeString(e,t.name)||Y.NotSpecified,n.message=W.sanitizeMessage(e,t.message)||Y.NotSpecified;var r=t.stack;return n.parsedStack=n.parseStack(r),n.stack=W.sanitizeException(e,r),n.hasFullStack=Y.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return n(e,i),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(ce.regex.test(o)){var s=new ce(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var u=0,c=t.length-1,l=0,f=u,p=c;u<c;){if(32768<(l+=t[u].sizeInBytes+t[c].sizeInBytes)){var d=p-f+1;t.splice(f,d);break}f=u,p=c,u++,c--}}return t},e}(oe),ce=function(i){function a(e,t){var n=i.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:h.Required,method:h.Required,assembly:h.Default,fileName:h.Default,line:h.Default},n.level=t,n.method="<no_method>",n.assembly=Y.trim(e);var r=e.match(a.regex);return r&&5<=r.length&&(n.method=Y.trim(r[2])||n.method,n.fileName=Y.trim(r[4]),n.line=parseInt(r[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 n(a,i),a.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,a.baseSize=58,a}(ae),le=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return n(e,t),e}(ne);(c=u||(u={}))[c.Measurement=0]="Measurement",c[c.Aggregation=1]="Aggregation";var fe,pe,de=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:h.Required,kind:h.Default,value:h.Required,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default},e}return n(e,t),e}(function(){this.kind=u.Measurement}),he=function(c){function e(e,t,n,r,i,a,o){var s=c.call(this)||this;s.aiDataContract={ver:h.Required,metrics:h.Required,properties:h.Default};var u=new de;return u.count=0<r?r:void 0,u.max=isNaN(a)||null===a?void 0:a,u.min=isNaN(i)||null===i?void 0:i,u.name=W.sanitizeString(e,t)||Y.NotSpecified,u.value=n,s.metrics=[u],s.properties=W.sanitizeProperties(e,o),s}return n(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(le),ge=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(re),me=function(u){function e(e,t,n,r,i,a,o){var s=u.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,properties:h.Default,measurements:h.Default,id:h.Default},s.id=W.sanitizeId(e,o),s.url=W.sanitizeUrl(e,n),s.name=W.sanitizeString(e,t)||Y.NotSpecified,isNaN(r)||(s.duration=Y.msToTimeSpan(r)),s.properties=W.sanitizeProperties(e,i),s.measurements=W.sanitizeMeasurements(e,a),s}return n(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(ge),ve=function(d){function e(e,t,n,r,i,a,o,s,u,c,l){void 0===u&&(u="Ajax");var f=d.call(this)||this;f.aiDataContract={id:h.Required,ver:h.Required,name:h.Default,resultCode:h.Default,duration:h.Default,success:h.Default,data:h.Default,target:h.Default,type:h.Default,properties:h.Default,measurements:h.Default,kind:h.Default,value:h.Default,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default,dependencyKind:h.Default,dependencySource:h.Default,commandName:h.Default,dependencyTypeName:h.Default},f.id=t,f.duration=Y.msToTimeSpan(i),f.success=a,f.resultCode=o+"",f.type=W.sanitizeString(e,u);var p=Z.ParseDependencyPath(e,n,s,r);return f.data=W.sanitizeUrl(e,r)||p.data,f.target=p.target,f.name=p.name,f.properties=W.sanitizeProperties(e,c),f.measurements=W.sanitizeMeasurements(e,l),f}return n(e,d),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return n(e,t),e}(ne)),ye=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:h.Required,message:h.Required,severityLevel:h.Default,properties:h.Default},t=t||Y.NotSpecified,i.message=W.sanitizeMessage(e,t),i.properties=W.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}return n(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return n(e,t),e}(ne)),_e=function(s){function e(e,t,n,r,i,a){var o=s.call(this)||this;return o.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,perfTotal:h.Default,networkConnect:h.Default,sentRequest:h.Default,receivedResponse:h.Default,domProcessing:h.Default,properties:h.Default,measurements:h.Default},o.url=W.sanitizeUrl(e,n),o.name=W.sanitizeString(e,t)||Y.NotSpecified,o.properties=W.sanitizeProperties(e,i),o.measurements=W.sanitizeMeasurements(e,a),o}return n(e,s),e.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",e.dataType="PageviewPerformanceData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(ge)),Ie=function(r){function e(e,t){var n=r.call(this)||this;return n.aiDataContract={baseType:h.Required,baseData:h.Required},n.baseType=e,n.baseData=t,n}return n(e,r),e}(ee);(pe=fe||(fe={}))[pe.Verbose=0]="Verbose",pe[pe.Information=1]="Information",pe[pe.Warning=2]="Warning",pe[pe.Error=3]="Error",pe[pe.Critical=4]="Critical";var Se=function(){function e(){}return e.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!m.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],m.isNullOrUndefined(i)?r:i},e}(),be=new 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.internalNodeName="ai.internal.nodeName",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion"},we=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}(),Ee=function(){function i(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(i.BUFFER_KEY),r=this.getBuffer(i.SENT_BUFFER_KEY);this._buffer=n.concat(r),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||(this._logger.throwInternal(g.WARNING,F,"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&&(this._logger.throwInternal(g.CRITICAL,F,"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 r in t){var i=!1;for(var a in e)if(e[a]===t[r]){i=!0;break}i||n.push(t[r])}return n},i.prototype.getBuffer=function(t){try{var e=Y.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(g.CRITICAL,C," storage key: "+t+", "+Y.getExceptionName(e),{exception:Y.dump(e)})}return[]},i.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);Y.setSessionStorage(this._logger,t,n)}catch(e){Y.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(g.WARNING,A," storage key: "+t+", "+Y.getExceptionName(e)+". Buffer cleared",{exception:Y.dump(e)})}},i.BUFFER_KEY="AI_buffer",i.SENT_BUFFER_KEY="AI_sentBuffer",i.MAX_BUFFER_SIZE=2e3,i}(),Ne=function(){function o(){}return o.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];"number"!=typeof r&&(t||(t={}),t[n]=r)}return t},o.extractPropsAndMeasurements=function(e,t,n){if(!m.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]="string"==typeof i?i:JSON.stringify(i)}},o.createEnvelope=function(e,t,n,r){var i=new te(e,r,t);i.iKey=n.iKey;var a=n.iKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),o.extractPartAExtensions(n,i),n.tags||(n.tags=[]),i},o.extractPartAExtensions=function(e,t){if(t.tags||(t.tags={}),e.ext||(e.ext={}),e.tags||(e.tags=[]),e.ext.user){e.ext.user.authId&&(t.tags[be.userAuthUserId]=e.ext.user.authId);var n=e.ext.user.id||e.ext.user.localId;n&&(t.tags[be.userId]=n)}if(e.ext.app&&e.ext.app.sesId&&(t.tags[be.sessionId]=e.ext.app.sesId),e.ext.device&&((e.ext.device.id||e.ext.device.localId)&&(t.tags[be.deviceId]=e.ext.device.id||e.ext.device.localId),e.ext.device.ip&&(t.tags[be.deviceIp]=e.ext.device.ip)),e.ext.web){var r=e.ext.web;r.browserLang&&(t.tags[be.deviceLanguage]=r.browserLang),r.browserVer&&(t.tags[be.deviceBrowserVersion]=r.browserVer),r.browser&&(t.tags[be.deviceBrowser]=r.browser),t.data=t.data||{},t.data.baseData=t.data.baseData||{},t.data.baseData.properties=t.data.baseData.properties||{},r.domain&&(t.data.baseData.properties.domain=r.domain),r.isManual&&(t.data.baseData.properties.isManual=r.isManual.toString()),r.screenRes&&(t.data.baseData.properties.screenRes=r.screenRes),r.userConsent&&(t.data.baseData.properties.userConsent=r.userConsent.toString())}e.ext.device&&e.ext.device.model&&(t.tags[be.deviceModel]=e.ext.device.model),e.ext.os&&e.ext.os.name&&(t.tags[be.deviceOS]=e.ext.os.name),e.ext.device&&e.ext.device.deviceType&&(t.tags[be.deviceType]=e.ext.device.deviceType),e.ext.trace&&(e.ext.trace.parentID&&(t.tags[be.operationParentId]=e.ext.trace.parentID),e.ext.trace.name&&(t.tags[be.operationName]=e.ext.trace.name),e.ext.trace.traceID&&(t.tags[be.operationId]=e.ext.trace.traceID));var i={};e.tags.forEach(function(e){i=f({},i,e)}),t.tags=f({},t.tags,i),t.tags[be.internalSdkVersion]||(t.tags[be.internalSdkVersion]="javascript:"+o.Version)},o.Version="2.0.0-rc1",o}(),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.measurements||{},r=t.baseData.properties||{};Ne.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(m.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.target,s=i.name,u=i.duration,c=i.success,l=i.responseCode,f=i.type,p=i.properties&&i.properties[$]?i.properties[$]:"GET",d=new ve(e,a,o,s,u,c,l,p,f,r,n),h=new Ie(ve.dataType,d);return Ne.createEnvelope(e,ve.envelopeType,t,h)},t.DependencyEnvelopeCreator=new t,t}(Ne),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==ie.dataType&&(n.baseTypeSource=t.baseType),t.baseType===ie.dataType?(n=t.baseData.properties||{},r=t.baseData.measurements||{}):t.baseData&&Ne.extractPropsAndMeasurements(t.baseData,n,r),Ne.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new ie(e,i,n,r),o=new Ie(ie.dataType,a);return Ne.createEnvelope(e,ie.envelopeType,t,o)},t.EventEnvelopeCreator=new t,t}(Ne),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=new Ie(se.dataType,n);return Ne.createEnvelope(e,se.envelopeType,t,r)},t.ExceptionEnvelopeCreator=new t,t}(Ne),De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.properties||{},r=Ne.extractProperties(t.data);r=f({},n,r);var i=t.baseData.name,a=t.baseData.average,o=t.baseData.sampleCount,s=t.baseData.min,u=t.baseData.max,c=new he(e,i,a,o,s,u,r),l=new Ie(he.dataType,c);return Ne.createEnvelope(e,he.envelopeType,t,l)},t.MetricEnvelopeCreator=new t,t}(Ne),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=void 0;m.isNullOrUndefined(t.baseData)||m.isNullOrUndefined(t.baseData.properties)||(n=t.baseData.properties.duration,delete t.baseData.properties.duration);var r=t.baseData,i=r.name,a=r.uri,o=r.id,s=r.properties||{},u=r.measurements||{};if(m.isNullOrUndefined(r.refUri)||(s.refUri=r.refUri),m.isNullOrUndefined(r.pageType)||(s.pageType=r.pageType),m.isNullOrUndefined(r.isLoggedIn)||(s.isLoggedIn=r.isLoggedIn.toString()),!m.isNullOrUndefined(r.properties)){var c=r.properties;for(var l in c)c.hasOwnProperty(l)&&(s[l]=c[l])}var f=new me(e,i,a,n,s,u,o),p=new Ie(me.dataType,f);return Ne.createEnvelope(e,me.envelopeType,t,p)},t.PageViewEnvelopeCreator=new t,t}(Ne),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.name,i=n.uri,a=n.properties,o=n.measurements,s=new _e(e,r,i,void 0,a,o),u=new Ie(_e.dataType,s);return Ne.createEnvelope(e,_e.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(Ne),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=Ne.extractProperties(t.data),a=f({},i,t.baseData.properties),o=new ye(e,n,r,a),s=new Ie(ye.dataType,o);return Ne.createEnvelope(e,ye.envelopeType,t,s)},t.TraceEnvelopeCreator=new t,t}(Ne),Ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),Oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),Pe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),Be=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),ke=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),Ve=function(){function e(e){this._logger=e}return e.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},e.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",r={};if(!e)return this._logger.throwInternal(g.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(g.WARNING,L,"Circular reference detected while serializing object",{name:t},!0),r;if(!e.aiDataContract){if("measurements"===t)r=this._serializeStringMap(e,"number",t);else if("properties"===t)r=this._serializeStringMap(e,"string",t);else if("tags"===t)r=this._serializeStringMap(e,"string",t);else if(Y.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(g.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(g.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return r}for(var i in e[n]=!0,e.aiDataContract){var a,o=e.aiDataContract[i],s="function"==typeof o?o()&h.Required:o&h.Required,u="function"==typeof o?o()&h.Hidden:o&h.Hidden,c=o&h.Array,l=void 0!==e[i],f="object"==typeof e[i]&&null!==e[i];if(!s||l||c){if(!u)void 0!==(a=f?c?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a)}else this._logger.throwInternal(g.CRITICAL,w,"Missing required field specification. The field is required but not present on source",{field:i,name:t})}return delete e[n],r},e.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(Y.isArray(e)){n=[];for(var r=0;r<e.length;r++){var i=e[r],a=this._serializeObject(i,t+"["+r+"]");n.push(a)}}else this._logger.throwInternal(g.CRITICAL,P,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},e.prototype._serializeStringMap=function(e,t,n){var r=void 0;if(e)for(var i in r={},e){var a=e[i];if("string"===t)void 0===a?r[i]="undefined":null===a?r[i]="null":a.toString?r[i]=a.toString():r[i]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===a)r[i]="undefined";else if(null===a)r[i]="null";else{var o=parseFloat(a);isNaN(o)?r[i]="NaN":r[i]=o}else r[i]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(g.CRITICAL,r[i],null,!0)}return r},e}(),qe=function(){function e(){this._onlineStatus=!0;try{"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}catch(e){this.isListening=!1}}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,Fe=function(){function u(){this.priority=1001,this._XMLHttpRequestSupported=!1,this.identifier="AppInsightsChannelPlugin"}return u.prototype.pause=function(){throw new Error("Method not implemented.")},u.prototype.resume=function(){throw new Error("Method not implemented.")},u.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(g.CRITICAL,b,"flush failed, telemetry will not be collected: "+Y.getExceptionName(e),{exception:Y.dump(e)})}},u.prototype.teardown=function(){throw new Error("Method not implemented.")},u.prototype.initialize=function(t,e,n){var r=this;this._logger=e.logger,this._serializer=new Ve(e.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._sender=null;var i=u._getDefaultAppInsightsChannelConfig();this._config=u._getEmptyAppInsightsChannelConfig();var a=function(e){o._config[e]=function(){return Se.getConfig(t,e,r.identifier,i[e]())}},o=this;for(var s in i)a(s);(this._buffer=this._config.enableSessionStorageBuffer&&Y.canUseSessionStorage()?new Ee(this._logger,this._config):new we(this._config),!this._config.isBeaconApiDisabled()&&Y.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))},u.prototype.processTelemetry=function(e){var t=this;try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(g.CRITICAL,I,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(g.CRITICAL,N,"Sender was not initialized");if(!u._validate(e))return void this._logger.throwInternal(g.CRITICAL,T,"Invalid telemetry envelope");var n=u.constructEnvelope(e,this._config.instrumentationKey(),this._logger);if(!n)return void this._logger.throwInternal(g.CRITICAL,R,"Unable to create an AppInsights envelope");var r=!1;if(e.tags&&e.tags[Q]&&(e.tags[Q].forEach(function(e){try{e&&!1===e(n)&&(r=!0,t._logger.warnToConsole("Telemetry processor check returns false"))}catch(e){t._logger.throwInternal(g.CRITICAL,V,"One of telemetry initializers failed, telemetry item will not be sent: "+Y.getExceptionName(e),{exception:Y.dump(e)},!0)}}),delete e.tags[Q]),r)return;var i=this._serializer.serialize(n),a=this._buffer.getItems(),o=this._buffer.batchPayloads(a);o&&o.length+i.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(i),this._setupTimer()}catch(e){this._logger.throwInternal(g.WARNING,S,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+Y.getExceptionName(e),{exception:Y.dump(e)})}m.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},u.prototype.setNextPlugin=function(e){this._nextPlugin=e},u.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var r=null;if(this._appId||(r=this._parseResponse(e.responseText||e.response))&&r.appId&&(this._appId=r.appId),(e.status<200||300<=e.status)&&0!==e.status)!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(g.WARNING,x,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(qe.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(g.WARNING,x,". Offline - Response Code: "+e.status+". Offline status: "+qe.isOffline()+". Will retry to send "+t.length+" items.")}}else 206===e.status?(r||(r=this._parseResponse(e.responseText||e.response)),r&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,r):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},u.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!Y.getIEVersion()||9<Y.getIEVersion())&&this._logger.throwInternal(g.CRITICAL,x,"Telemetry transmission failed, some telemetry will be lost: "+Y.getExceptionName(e),{exception:Y.dump(e)})}},u.prototype._onError=function(e,t,n){this._logger.throwInternal(g.WARNING,E,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},u.prototype._onPartialSuccess=function(e,t){for(var n=[],r=[],i=0,a=t.errors.reverse();i<a.length;i++){var o=a[i],s=e.splice(o.index,1)[0];this._isRetriable(o.statusCode)?r.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<r.length&&(this._resendPayload(r),this._logger.throwInternal(g.WARNING,x,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+r.length+" our of "+t.itemsReceived+" items"))},u.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},u.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},u.constructEnvelope=function(e,t,n){var r;switch((r=t===e.iKey||m.isNullOrUndefined(t)?e:f({},e,{iKey:t})).baseType){case ie.dataType:return Ae.EventEnvelopeCreator.Create(n,r);case ye.dataType:return Me.TraceEnvelopeCreator.Create(n,r);case me.dataType:return Te.PageViewEnvelopeCreator.Create(n,r);case _e.dataType:return Re.PageViewPerformanceEnvelopeCreator.Create(n,r);case se.dataType:return Ce.ExceptionEnvelopeCreator.Create(n,r);case he.dataType:return De.MetricEnvelopeCreator.Create(n,r);case ve.dataType:return xe.DependencyEnvelopeCreator.Create(n,r);default:return Ae.EventEnvelopeCreator.Create(n,r)}},u._getDefaultAppInsightsChannelConfig=function(){var e={endpointUrl:function(){return"https://dc.services.visualstudio.com/v2/track"},emitLineDelimitedJson:function(){return!1},maxBatchInterval:function(){return 15e3},maxBatchSizeInBytes:function(){return 102400},disableTelemetry:function(){return!1},enableSessionStorageBuffer:function(){return!0},isRetryDisabled:function(){return!1},isBeaconApiDisabled:function(){return!0},instrumentationKey:function(){}};return e},u._getEmptyAppInsightsChannelConfig=function(){return{endpointUrl:void 0,emitLineDelimitedJson:void 0,maxBatchInterval:void 0,maxBatchSizeInBytes:void 0,disableTelemetry:void 0,enableSessionStorageBuffer:void 0,isRetryDisabled:void 0,isBeaconApiDisabled:void 0,instrumentationKey:void 0}},u._validate=function(e){switch(e.baseType){case ie.dataType:return Ue.EventValidator.Validate(e);case ye.dataType:return Le.TraceValidator.Validate(e);case se.dataType:return Oe.ExceptionValidator.Validate(e);case he.dataType:return Pe.MetricValidator.Validate(e);case me.dataType:return Be.PageViewValidator.Validate(e);case _e.dataType:return ze.PageViewPerformanceValidator.Validate(e);case ve.dataType:return ke.RemoteDepdencyValidator.Validate(e);default:return Ue.EventValidator.Validate(e)}},u.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),r=this._buffer.batchPayloads(e),i=new Blob([r],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,i)?this._buffer.markAsSent(e):this._logger.throwInternal(g.CRITICAL,x,". Failed to send telemetry with Beacon API.")},u.prototype._xhrSender=function(t,e){var n=this,r=new XMLHttpRequest;r.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,r.open("POST",this._config.endpointUrl(),e),r.setRequestHeader("Content-type","application/json"),Y.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader(K.sdkContextHeader,K.sdkContextHeaderAppIdRequest),r.onreadystatechange=function(){return n._xhrReadyStateChange(r,t,t.length)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(r),e)};var i=this._buffer.batchPayloads(t);r.send(i),this._buffer.markAsSent(t)},u.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(g.CRITICAL,D,"Cannot parse the response. "+Y.getExceptionName(e),{response:t})}return null},u.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,r=e;n<r.length;n++){var i=r[n];this._buffer.enqueue(i)}this._setRetryTime(t),this._setupTimer()}},u.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,r=Math.floor(Math.random()*n*10)+1;r*=e,t=Math.max(Math.min(r,3600),10)}var i=Date.now()+1e3*t;this._retryAt=i},u.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)}},u.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},u.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},u.prototype._xdrSender=function(t,e){var n=this,r=new XDomainRequest;r.onload=function(){return n._xdrOnLoad(r,t)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(r),e)};var i=window.location&&window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(g.WARNING,x,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var a=this._config.endpointUrl().replace(/^(https?:)/,"");r.open("POST",a);var o=this._buffer.batchPayloads(t);r.send(o),this._buffer.markAsSent(t)},u.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},u}();e.Sender=Fe,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function n(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,t,h,a,f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(a=h||(h={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g,o,m=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(s,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),s=/[xy]/g;(o=g||(g={}))[o.CRITICAL=1]="CRITICAL",o[o.WARNING=2]="WARNING";var u,c,l=1,p=2,d=3,v=4,y=5,_=6,I=7,S=12,b=22,w=24,E=26,N=28,x=40,A=41,C=42,D=43,T=46,R=47,M=48,U=49,L=50,O=52,P=54,z=56,B=57,k=61,V=64,q=66,F=67,G=68,X=69,j=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=j}e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,r,i){var a=this;if(this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<j&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error(H+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];s.priority>j&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}}(),500),H="Channel has invalid priority",K=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}(),W=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=s.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(a);i=o}return i},s.sanitizeKey=function(e,t){var n;return t&&(t=s.trim(t.toString())).length>s.MAX_NAME_LENGTH&&(n=t.substring(0,s.MAX_NAME_LENGTH),e.throwInternal(g.WARNING,B,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},s.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=s.MAX_STRING_LENGTH),t&&(n=n||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(g.WARNING,k,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,q)},s.sanitizeMessage=function(e,t){var n;return t&&t.length>s.MAX_MESSAGE_LENGTH&&(n=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(g.WARNING,z,"message is too long, it has been truncated to "+s.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},s.sanitizeException=function(e,t){var n;return t&&t.length>s.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,s.MAX_EXCEPTION_LENGTH),e.throwInternal(g.WARNING,O,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},s.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(g.WARNING,U,"custom property is not valid",{exception:e},!0)}i=s.sanitizeString(t,i,s.MAX_PROPERTY_LENGTH),n[r=s.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=s.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,X).toString():t},s.sanitizeInput=function(e,t,n,r){var i;return t&&(t=s.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(g.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},s.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.MAX_NAME_LENGTH=150,s.MAX_ID_LENGTH=128,s.MAX_PROPERTY_LENGTH=8192,s.MAX_STRING_LENGTH=1024,s.MAX_URL_LENGTH=2048,s.MAX_MESSAGE_LENGTH=32768,s.MAX_EXCEPTION_LENGTH=32768,s}(),Y=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(i.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(i.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,l,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var r=s._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,d,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,y,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(i.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(i.SessionStorage)),s._canUseSessionStorage},s.getSessionStorageKeys=function(){var e=[];if(s.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},s.getSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,p,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var r=s._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,v,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,_,"Browser failed removal of session storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.disableCookies=function(){s._canUseCookies=!1},s.canUseCookies=function(t){if(void 0===s._canUseCookies){s._canUseCookies=!1;try{s._canUseCookies=void 0!==s.document.cookie}catch(e){t.throwInternal(g.WARNING,G,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),s.document.location&&"https:"===s.document.location.protocol&&(a=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+i+";path=/"+a)},s.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},s.getCookie=function(e,t){if(s.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=s.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=s.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},s.deleteCookie=function(e,t){s.canUseCookies(e)&&(s.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.newId=function(){for(var e="",t=1073741824*Math.random();0<t;){e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64)}return e},s.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},s.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},s.toISOStringForIE8=function(e){if(s.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},s.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},s.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+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,r=r.length<2?"0"+r:r,(0<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},s.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},s.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},s.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},s.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},s.document="undefined"!=typeof document?document:{},s._canUseCookies=void 0,s._canUseLocalStorage=void 0,s._canUseSessionStorage=void 0,s._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],s.NotSpecified="not_specified",s}(),J=function(){function r(){}return r.parseUrl=function(e){return r.htmlAnchorElement||(r.htmlAnchorElement=r.document.createElement?r.document.createElement("a"):{}),r.htmlAnchorElement.href=e,r.htmlAnchorElement},r.getAbsoluteUrl=function(e){var t,n=r.parseUrl(e);return n&&(t=n.href),t},r.getPathName=function(e){var t,n=r.parseUrl(e);return n&&(t=n.pathname),t},r.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},r.document="undefined"!=typeof document?document:{},r}(),Z=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=J.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var u=0===s.pathname.length?"/":s.pathname;"/"!==u.charAt(0)&&(u="/"+u),o=s.pathname,a=W.sanitizeString(e,n?n+" "+u:u)}else a=W.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},e}(),Q=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||m.isNullOrUndefined(e)||m.isNullOrUndefined(t)||(n=t-e),n}}(),"ProcessLegacy"),$="http.method",ee=function(e){function t(){return e.call(this)||this}return n(t,e),t}(function(){}),te=function(i){function e(e,t,n){var r=i.call(this)||this;return r.name=W.sanitizeString(e,n)||Y.NotSpecified,r.data=t,r.time=Y.toISOStringForIE8(new Date),r.aiDataContract={time:h.Required,iKey:h.Required,name:h.Required,sampleRate:function(){return 100==r.sampleRate?h.Hidden:h.Required},tags:h.Required,data:h.Required},r}return n(e,i),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ne=function(){},re=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(ne),ie=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:h.Required,name:h.Required,properties:h.Default,measurements:h.Default},i.name=W.sanitizeString(e,t)||Y.NotSpecified,i.properties=W.sanitizeProperties(e,n),i.measurements=W.sanitizeMeasurements(e,r),i}return n(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(re),ae=function(){},oe=function(){this.hasFullStack=!0,this.parsedStack=[]},se=function(o){function e(e,t,n,r,i){var a=o.call(this)||this;return a.aiDataContract={ver:h.Required,exceptions:h.Required,severityLevel:h.Default,properties:h.Default,measurements:h.Default},a.properties=W.sanitizeProperties(e,n),a.measurements=W.sanitizeMeasurements(e,r),a.exceptions=[new ue(e,t)],i&&(a.severityLevel=i),a}return n(e,o),e.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return n(e,t),e}(ne)),ue=function(i){function e(e,t){var n=i.call(this)||this;n.aiDataContract={id:h.Default,outerId:h.Default,typeName:h.Required,message:h.Required,hasFullStack:h.Default,stack:h.Default,parsedStack:h.Array},n.typeName=W.sanitizeString(e,t.name)||Y.NotSpecified,n.message=W.sanitizeMessage(e,t.message)||Y.NotSpecified;var r=t.stack;return n.parsedStack=n.parseStack(r),n.stack=W.sanitizeException(e,r),n.hasFullStack=Y.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return n(e,i),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(ce.regex.test(o)){var s=new ce(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var u=0,c=t.length-1,l=0,f=u,p=c;u<c;){if(32768<(l+=t[u].sizeInBytes+t[c].sizeInBytes)){var d=p-f+1;t.splice(f,d);break}f=u,p=c,u++,c--}}return t},e}(oe),ce=function(i){function a(e,t){var n=i.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:h.Required,method:h.Required,assembly:h.Default,fileName:h.Default,line:h.Default},n.level=t,n.method="<no_method>",n.assembly=Y.trim(e);var r=e.match(a.regex);return r&&5<=r.length&&(n.method=Y.trim(r[2])||n.method,n.fileName=Y.trim(r[4]),n.line=parseInt(r[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 n(a,i),a.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,a.baseSize=58,a}(ae),le=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return n(e,t),e}(ne);(c=u||(u={}))[c.Measurement=0]="Measurement",c[c.Aggregation=1]="Aggregation";var fe,pe,de=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:h.Required,kind:h.Default,value:h.Required,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default},e}return n(e,t),e}(function(){this.kind=u.Measurement}),he=function(c){function e(e,t,n,r,i,a,o){var s=c.call(this)||this;s.aiDataContract={ver:h.Required,metrics:h.Required,properties:h.Default};var u=new de;return u.count=0<r?r:void 0,u.max=isNaN(a)||null===a?void 0:a,u.min=isNaN(i)||null===i?void 0:i,u.name=W.sanitizeString(e,t)||Y.NotSpecified,u.value=n,s.metrics=[u],s.properties=W.sanitizeProperties(e,o),s}return n(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(le),ge=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(re),me=function(u){function e(e,t,n,r,i,a,o){var s=u.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,properties:h.Default,measurements:h.Default,id:h.Default},s.id=W.sanitizeId(e,o),s.url=W.sanitizeUrl(e,n),s.name=W.sanitizeString(e,t)||Y.NotSpecified,isNaN(r)||(s.duration=Y.msToTimeSpan(r)),s.properties=W.sanitizeProperties(e,i),s.measurements=W.sanitizeMeasurements(e,a),s}return n(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(ge),ve=function(d){function e(e,t,n,r,i,a,o,s,u,c,l){void 0===u&&(u="Ajax");var f=d.call(this)||this;f.aiDataContract={id:h.Required,ver:h.Required,name:h.Default,resultCode:h.Default,duration:h.Default,success:h.Default,data:h.Default,target:h.Default,type:h.Default,properties:h.Default,measurements:h.Default,kind:h.Default,value:h.Default,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default,dependencyKind:h.Default,dependencySource:h.Default,commandName:h.Default,dependencyTypeName:h.Default},f.id=t,f.duration=Y.msToTimeSpan(i),f.success=a,f.resultCode=o+"",f.type=W.sanitizeString(e,u);var p=Z.ParseDependencyPath(e,n,s,r);return f.data=W.sanitizeUrl(e,r)||p.data,f.target=p.target,f.name=p.name,f.properties=W.sanitizeProperties(e,c),f.measurements=W.sanitizeMeasurements(e,l),f}return n(e,d),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return n(e,t),e}(ne)),ye=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:h.Required,message:h.Required,severityLevel:h.Default,properties:h.Default},t=t||Y.NotSpecified,i.message=W.sanitizeMessage(e,t),i.properties=W.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}return n(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return n(e,t),e}(ne)),_e=function(s){function e(e,t,n,r,i,a){var o=s.call(this)||this;return o.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,perfTotal:h.Default,networkConnect:h.Default,sentRequest:h.Default,receivedResponse:h.Default,domProcessing:h.Default,properties:h.Default,measurements:h.Default},o.url=W.sanitizeUrl(e,n),o.name=W.sanitizeString(e,t)||Y.NotSpecified,o.properties=W.sanitizeProperties(e,i),o.measurements=W.sanitizeMeasurements(e,a),o}return n(e,s),e.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",e.dataType="PageviewPerformanceData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(ge)),Ie=function(r){function e(e,t){var n=r.call(this)||this;return n.aiDataContract={baseType:h.Required,baseData:h.Required},n.baseType=e,n.baseData=t,n}return n(e,r),e}(ee);(pe=fe||(fe={}))[pe.Verbose=0]="Verbose",pe[pe.Information=1]="Information",pe[pe.Warning=2]="Warning",pe[pe.Error=3]="Error",pe[pe.Critical=4]="Critical";var Se=function(){function e(){}return e.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!m.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],m.isNullOrUndefined(i)?r:i},e}(),be=new 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.internalNodeName="ai.internal.nodeName",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion"},we=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}(),Ee=function(){function i(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(i.BUFFER_KEY),r=this.getBuffer(i.SENT_BUFFER_KEY);this._buffer=n.concat(r),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||(this._logger.throwInternal(g.WARNING,F,"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&&(this._logger.throwInternal(g.CRITICAL,F,"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 r in t){var i=!1;for(var a in e)if(e[a]===t[r]){i=!0;break}i||n.push(t[r])}return n},i.prototype.getBuffer=function(e){var t=e;try{t=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+t:t;var n=Y.getSessionStorage(this._logger,t);if(n){var r=JSON.parse(n);if(r)return r}}catch(e){this._logger.throwInternal(g.CRITICAL,C," storage key: "+t+", "+Y.getExceptionName(e),{exception:Y.dump(e)})}return[]},i.prototype.setBuffer=function(e,t){var n=e;try{n=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+n:n;var r=JSON.stringify(t);Y.setSessionStorage(this._logger,n,r)}catch(e){Y.setSessionStorage(this._logger,n,JSON.stringify([])),this._logger.throwInternal(g.WARNING,A," storage key: "+n+", "+Y.getExceptionName(e)+". Buffer cleared",{exception:Y.dump(e)})}},i.BUFFER_KEY="AI_buffer",i.SENT_BUFFER_KEY="AI_sentBuffer",i.MAX_BUFFER_SIZE=2e3,i}(),Ne=function(){function o(){}return o.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];"number"!=typeof r&&(t||(t={}),t[n]=r)}return t},o.extractPropsAndMeasurements=function(e,t,n){if(!m.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]="string"==typeof i?i:JSON.stringify(i)}},o.createEnvelope=function(e,t,n,r){var i=new te(e,r,t);i.iKey=n.iKey;var a=n.iKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),o.extractPartAExtensions(n,i),n.tags||(n.tags=[]),i},o.extractPartAExtensions=function(e,t){if(t.tags||(t.tags={}),e.ext||(e.ext={}),e.tags||(e.tags=[]),e.ext.user){e.ext.user.authId&&(t.tags[be.userAuthUserId]=e.ext.user.authId);var n=e.ext.user.id||e.ext.user.localId;n&&(t.tags[be.userId]=n)}if(e.ext.app&&e.ext.app.sesId&&(t.tags[be.sessionId]=e.ext.app.sesId),e.ext.device&&((e.ext.device.id||e.ext.device.localId)&&(t.tags[be.deviceId]=e.ext.device.id||e.ext.device.localId),e.ext.device.ip&&(t.tags[be.deviceIp]=e.ext.device.ip)),e.ext.web){var r=e.ext.web;r.browserLang&&(t.tags[be.deviceLanguage]=r.browserLang),r.browserVer&&(t.tags[be.deviceBrowserVersion]=r.browserVer),r.browser&&(t.tags[be.deviceBrowser]=r.browser),t.data=t.data||{},t.data.baseData=t.data.baseData||{},t.data.baseData.properties=t.data.baseData.properties||{},r.domain&&(t.data.baseData.properties.domain=r.domain),r.isManual&&(t.data.baseData.properties.isManual=r.isManual.toString()),r.screenRes&&(t.data.baseData.properties.screenRes=r.screenRes),r.userConsent&&(t.data.baseData.properties.userConsent=r.userConsent.toString())}e.ext.device&&e.ext.device.model&&(t.tags[be.deviceModel]=e.ext.device.model),e.ext.os&&e.ext.os.name&&(t.tags[be.deviceOS]=e.ext.os.name),e.ext.device&&e.ext.device.deviceType&&(t.tags[be.deviceType]=e.ext.device.deviceType),e.ext.trace&&(e.ext.trace.parentID&&(t.tags[be.operationParentId]=e.ext.trace.parentID),e.ext.trace.name&&(t.tags[be.operationName]=e.ext.trace.name),e.ext.trace.traceID&&(t.tags[be.operationId]=e.ext.trace.traceID));var i={};e.tags.forEach(function(e){i=f({},i,e)}),t.tags=f({},t.tags,i),t.tags[be.internalSdkVersion]||(t.tags[be.internalSdkVersion]="javascript:"+o.Version)},o.Version="2.0.0-rc2",o}(),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.measurements||{},r=t.baseData.properties||{};Ne.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(m.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.target,s=i.name,u=i.duration,c=i.success,l=i.responseCode,f=i.type,p=i.properties&&i.properties[$]?i.properties[$]:"GET",d=new ve(e,a,o,s,u,c,l,p,f,r,n),h=new Ie(ve.dataType,d);return Ne.createEnvelope(e,ve.envelopeType,t,h)},t.DependencyEnvelopeCreator=new t,t}(Ne),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==ie.dataType&&(n.baseTypeSource=t.baseType),t.baseType===ie.dataType?(n=t.baseData.properties||{},r=t.baseData.measurements||{}):t.baseData&&Ne.extractPropsAndMeasurements(t.baseData,n,r),Ne.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new ie(e,i,n,r),o=new Ie(ie.dataType,a);return Ne.createEnvelope(e,ie.envelopeType,t,o)},t.EventEnvelopeCreator=new t,t}(Ne),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.properties,i=n.measurements,a=n.error,o=n.severityLevel,s=new se(e,a,r,i,o),u=new Ie(se.dataType,s);return Ne.createEnvelope(e,se.envelopeType,t,u)},t.ExceptionEnvelopeCreator=new t,t}(Ne),De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.properties||{},r=Ne.extractProperties(t.data);r=f({},n,r);var i=t.baseData.name,a=t.baseData.average,o=t.baseData.sampleCount,s=t.baseData.min,u=t.baseData.max,c=new he(e,i,a,o,s,u,r),l=new Ie(he.dataType,c);return Ne.createEnvelope(e,he.envelopeType,t,l)},t.MetricEnvelopeCreator=new t,t}(Ne),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=void 0;m.isNullOrUndefined(t.baseData)||m.isNullOrUndefined(t.baseData.properties)||(n=t.baseData.properties.duration,delete t.baseData.properties.duration);var r=t.baseData,i=r.name,a=r.uri,o=r.id,s=r.properties||{},u=r.measurements||{};if(m.isNullOrUndefined(r.refUri)||(s.refUri=r.refUri),m.isNullOrUndefined(r.pageType)||(s.pageType=r.pageType),m.isNullOrUndefined(r.isLoggedIn)||(s.isLoggedIn=r.isLoggedIn.toString()),!m.isNullOrUndefined(r.properties)){var c=r.properties;for(var l in c)c.hasOwnProperty(l)&&(s[l]=c[l])}var f=new me(e,i,a,n,s,u,o),p=new Ie(me.dataType,f);return Ne.createEnvelope(e,me.envelopeType,t,p)},t.PageViewEnvelopeCreator=new t,t}(Ne),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.name,i=n.uri,a=n.properties,o=n.measurements,s=new _e(e,r,i,void 0,a,o),u=new Ie(_e.dataType,s);return Ne.createEnvelope(e,_e.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(Ne),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=Ne.extractProperties(t.data),a=f({},i,t.baseData.properties),o=new ye(e,n,r,a),s=new Ie(ye.dataType,o);return Ne.createEnvelope(e,ye.envelopeType,t,s)},t.TraceEnvelopeCreator=new t,t}(Ne),Ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),Oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),Pe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),Be=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),ke=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),Ve=function(){function e(e){this._logger=e}return e.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},e.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",r={};if(!e)return this._logger.throwInternal(g.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(g.WARNING,L,"Circular reference detected while serializing object",{name:t},!0),r;if(!e.aiDataContract){if("measurements"===t)r=this._serializeStringMap(e,"number",t);else if("properties"===t)r=this._serializeStringMap(e,"string",t);else if("tags"===t)r=this._serializeStringMap(e,"string",t);else if(Y.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(g.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(g.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return r}for(var i in e[n]=!0,e.aiDataContract){var a,o=e.aiDataContract[i],s="function"==typeof o?o()&h.Required:o&h.Required,u="function"==typeof o?o()&h.Hidden:o&h.Hidden,c=o&h.Array,l=void 0!==e[i],f="object"==typeof e[i]&&null!==e[i];if(!s||l||c){if(!u)void 0!==(a=f?c?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a)}else this._logger.throwInternal(g.CRITICAL,w,"Missing required field specification. The field is required but not present on source",{field:i,name:t})}return delete e[n],r},e.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(Y.isArray(e)){n=[];for(var r=0;r<e.length;r++){var i=e[r],a=this._serializeObject(i,t+"["+r+"]");n.push(a)}}else this._logger.throwInternal(g.CRITICAL,P,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},e.prototype._serializeStringMap=function(e,t,n){var r=void 0;if(e)for(var i in r={},e){var a=e[i];if("string"===t)void 0===a?r[i]="undefined":null===a?r[i]="null":a.toString?r[i]=a.toString():r[i]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===a)r[i]="undefined";else if(null===a)r[i]="null";else{var o=parseFloat(a);isNaN(o)?r[i]="NaN":r[i]=o}else r[i]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(g.CRITICAL,r[i],null,!0)}return r},e}(),qe=function(){function e(){this._onlineStatus=!0;try{"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}catch(e){this.isListening=!1}}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!(navigator&&!m.isNullOrUndefined(navigator.onLine))||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,Fe=function(){function u(){this.priority=1001,this._XMLHttpRequestSupported=!1,this.identifier="AppInsightsChannelPlugin"}return u.prototype.pause=function(){throw new Error("Method not implemented.")},u.prototype.resume=function(){throw new Error("Method not implemented.")},u.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(g.CRITICAL,b,"flush failed, telemetry will not be collected: "+Y.getExceptionName(e),{exception:Y.dump(e)})}},u.prototype.teardown=function(){throw new Error("Method not implemented.")},u.prototype.initialize=function(t,e,n){var r=this;this._logger=e.logger,this._serializer=new Ve(e.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._sender=null;var i=u._getDefaultAppInsightsChannelConfig();this._config=u._getEmptyAppInsightsChannelConfig();var a=function(e){o._config[e]=function(){return Se.getConfig(t,e,r.identifier,i[e]())}},o=this;for(var s in i)a(s);(this._buffer=this._config.enableSessionStorageBuffer&&Y.canUseSessionStorage()?new Ee(this._logger,this._config):new we(this._config),!this._config.isBeaconApiDisabled()&&Y.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))},u.prototype.processTelemetry=function(e){var t=this;try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(g.CRITICAL,I,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(g.CRITICAL,N,"Sender was not initialized");if(!u._validate(e))return void this._logger.throwInternal(g.CRITICAL,T,"Invalid telemetry envelope");var n=u.constructEnvelope(e,this._config.instrumentationKey(),this._logger);if(!n)return void this._logger.throwInternal(g.CRITICAL,R,"Unable to create an AppInsights envelope");var r=!1;if(e.tags&&e.tags[Q]&&(e.tags[Q].forEach(function(e){try{e&&!1===e(n)&&(r=!0,t._logger.warnToConsole("Telemetry processor check returns false"))}catch(e){t._logger.throwInternal(g.CRITICAL,V,"One of telemetry initializers failed, telemetry item will not be sent: "+Y.getExceptionName(e),{exception:Y.dump(e)},!0)}}),delete e.tags[Q]),r)return;var i=this._serializer.serialize(n),a=this._buffer.getItems(),o=this._buffer.batchPayloads(a);o&&o.length+i.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(i),this._setupTimer()}catch(e){this._logger.throwInternal(g.WARNING,S,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+Y.getExceptionName(e),{exception:Y.dump(e)})}m.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},u.prototype.setNextPlugin=function(e){this._nextPlugin=e},u.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var r=null;if(this._appId||(r=this._parseResponse(e.responseText||e.response))&&r.appId&&(this._appId=r.appId),(e.status<200||300<=e.status)&&0!==e.status)!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(g.WARNING,x,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(qe.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(g.WARNING,x,". Offline - Response Code: "+e.status+". Offline status: "+qe.isOffline()+". Will retry to send "+t.length+" items.")}}else 206===e.status?(r||(r=this._parseResponse(e.responseText||e.response)),r&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,r):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},u.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!Y.getIEVersion()||9<Y.getIEVersion())&&this._logger.throwInternal(g.CRITICAL,x,"Telemetry transmission failed, some telemetry will be lost: "+Y.getExceptionName(e),{exception:Y.dump(e)})}},u.prototype._onError=function(e,t,n){this._logger.throwInternal(g.WARNING,E,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},u.prototype._onPartialSuccess=function(e,t){for(var n=[],r=[],i=0,a=t.errors.reverse();i<a.length;i++){var o=a[i],s=e.splice(o.index,1)[0];this._isRetriable(o.statusCode)?r.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<r.length&&(this._resendPayload(r),this._logger.throwInternal(g.WARNING,x,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+r.length+" our of "+t.itemsReceived+" items"))},u.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},u.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},u.constructEnvelope=function(e,t,n){var r;switch((r=t===e.iKey||m.isNullOrUndefined(t)?e:f({},e,{iKey:t})).baseType){case ie.dataType:return Ae.EventEnvelopeCreator.Create(n,r);case ye.dataType:return Me.TraceEnvelopeCreator.Create(n,r);case me.dataType:return Te.PageViewEnvelopeCreator.Create(n,r);case _e.dataType:return Re.PageViewPerformanceEnvelopeCreator.Create(n,r);case se.dataType:return Ce.ExceptionEnvelopeCreator.Create(n,r);case he.dataType:return De.MetricEnvelopeCreator.Create(n,r);case ve.dataType:return xe.DependencyEnvelopeCreator.Create(n,r);default:return Ae.EventEnvelopeCreator.Create(n,r)}},u._getDefaultAppInsightsChannelConfig=function(){var e={endpointUrl:function(){return"https://dc.services.visualstudio.com/v2/track"},emitLineDelimitedJson:function(){return!1},maxBatchInterval:function(){return 15e3},maxBatchSizeInBytes:function(){return 102400},disableTelemetry:function(){return!1},enableSessionStorageBuffer:function(){return!0},isRetryDisabled:function(){return!1},isBeaconApiDisabled:function(){return!0},instrumentationKey:function(){}};return e},u._getEmptyAppInsightsChannelConfig=function(){return{endpointUrl:void 0,emitLineDelimitedJson:void 0,maxBatchInterval:void 0,maxBatchSizeInBytes:void 0,disableTelemetry:void 0,enableSessionStorageBuffer:void 0,isRetryDisabled:void 0,isBeaconApiDisabled:void 0,instrumentationKey:void 0,namePrefix:void 0}},u._validate=function(e){switch(e.baseType){case ie.dataType:return Ue.EventValidator.Validate(e);case ye.dataType:return Le.TraceValidator.Validate(e);case se.dataType:return Oe.ExceptionValidator.Validate(e);case he.dataType:return Pe.MetricValidator.Validate(e);case me.dataType:return Be.PageViewValidator.Validate(e);case _e.dataType:return ze.PageViewPerformanceValidator.Validate(e);case ve.dataType:return ke.RemoteDepdencyValidator.Validate(e);default:return Ue.EventValidator.Validate(e)}},u.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),r=this._buffer.batchPayloads(e),i=new Blob([r],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,i)?this._buffer.markAsSent(e):this._logger.throwInternal(g.CRITICAL,x,". Failed to send telemetry with Beacon API.")},u.prototype._xhrSender=function(t,e){var n=this,r=new XMLHttpRequest;r.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,r.open("POST",this._config.endpointUrl(),e),r.setRequestHeader("Content-type","application/json"),Y.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader(K.sdkContextHeader,K.sdkContextHeaderAppIdRequest),r.onreadystatechange=function(){return n._xhrReadyStateChange(r,t,t.length)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(r),e)};var i=this._buffer.batchPayloads(t);r.send(i),this._buffer.markAsSent(t)},u.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(g.CRITICAL,D,"Cannot parse the response. "+Y.getExceptionName(e),{response:t})}return null},u.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,r=e;n<r.length;n++){var i=r[n];this._buffer.enqueue(i)}this._setRetryTime(t),this._setupTimer()}},u.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,r=Math.floor(Math.random()*n*10)+1;r*=e,t=Math.max(Math.min(r,3600),10)}var i=Date.now()+1e3*t;this._retryAt=i},u.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)}},u.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},u.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},u.prototype._xdrSender=function(t,e){var n=this,r=new XDomainRequest;r.onload=function(){return n._xdrOnLoad(r,t)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(r),e)};var i=window.location&&window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(g.WARNING,x,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var a=this._config.endpointUrl().replace(/^(https?:)/,"");r.open("POST",a);var o=this._buffer.batchPayloads(t);r.send(o),this._buffer.markAsSent(t)},u.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},u}();e.Sender=Fe,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=applicationinsights-channel-js.min.js.map

@@ -170,3 +170,3 @@ import * as tslib_1 from "tslib";

};
EnvelopeCreator.Version = "2.0.0-rc1";
EnvelopeCreator.Version = "2.0.0-rc2";
return EnvelopeCreator;

@@ -254,3 +254,8 @@ }());

}
var baseData = telemetryItem.baseData;
var bd = telemetryItem.baseData;
var customProperties = bd.properties;
var customMeasurements = bd.measurements;
var error = bd.error;
var severityLevel = bd.severityLevel;
var baseData = new Exception(logger, error, customProperties, customMeasurements, severityLevel);
var data = new Data(Exception.dataType, baseData);

@@ -257,0 +262,0 @@ return EnvelopeCreator.createEnvelope(logger, Exception.envelopeType, telemetryItem, data);

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

import { CoreUtils } from '@microsoft/applicationinsights-core-js';
/**

@@ -48,3 +49,3 @@ * @description Monitors browser for offline events

}
else if (navigator) {
else if (navigator && !CoreUtils.isNullOrUndefined(navigator.onLine)) {
return navigator.onLine;

@@ -51,0 +52,0 @@ }

@@ -133,4 +133,6 @@ import { Util } from '@microsoft/applicationinsights-common';

SessionStorageSendBuffer.prototype.getBuffer = function (key) {
var prefixedKey = key;
try {
var bufferJson = Util.getSessionStorage(this._logger, key);
prefixedKey = this._config.namePrefix && this._config.namePrefix() ? this._config.namePrefix() + "_" + prefixedKey : prefixedKey;
var bufferJson = Util.getSessionStorage(this._logger, prefixedKey);
if (bufferJson) {

@@ -144,3 +146,3 @@ var buffer = JSON.parse(bufferJson);

catch (e) {
this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToRestoreStorageBuffer, " storage key: " + key + ", " + Util.getExceptionName(e), { exception: Util.dump(e) });
this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToRestoreStorageBuffer, " storage key: " + prefixedKey + ", " + Util.getExceptionName(e), { exception: Util.dump(e) });
}

@@ -150,5 +152,7 @@ return [];

SessionStorageSendBuffer.prototype.setBuffer = function (key, buffer) {
var prefixedKey = key;
try {
prefixedKey = this._config.namePrefix && this._config.namePrefix() ? this._config.namePrefix() + "_" + prefixedKey : prefixedKey;
var bufferJson = JSON.stringify(buffer);
Util.setSessionStorage(this._logger, key, bufferJson);
Util.setSessionStorage(this._logger, prefixedKey, bufferJson);
}

@@ -158,4 +162,4 @@ catch (e) {

// telemetry is stored in the _buffer array so we won't loose any items
Util.setSessionStorage(this._logger, key, JSON.stringify([]));
this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedToSetStorageBuffer, " storage key: " + key + ", " + Util.getExceptionName(e) + ". Buffer cleared", { exception: Util.dump(e) });
Util.setSessionStorage(this._logger, prefixedKey, JSON.stringify([]));
this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedToSetStorageBuffer, " storage key: " + prefixedKey + ", " + Util.getExceptionName(e) + ". Buffer cleared", { exception: Util.dump(e) });
}

@@ -165,3 +169,3 @@ };

SessionStorageSendBuffer.SENT_BUFFER_KEY = "AI_sentBuffer";
// Maximum number of payloads stored in the buffer. If the buffer is full, new elements will be dropped.
// Maximum number of payloads stored in the buffer. If the buffer is full, new elements will be dropped.
SessionStorageSendBuffer.MAX_BUFFER_SIZE = 2000;

@@ -168,0 +172,0 @@ return SessionStorageSendBuffer;

@@ -347,3 +347,4 @@ import * as tslib_1 from "tslib";

isBeaconApiDisabled: undefined,
instrumentationKey: undefined
instrumentationKey: undefined,
namePrefix: undefined
};

@@ -350,0 +351,0 @@ };

/*!
* Application Insights JavaScript SDK - Channel, 2.0.0-rc1
* Application Insights JavaScript SDK - Channel, 2.0.0-rc2
* Copyright (c) Microsoft and contributors. All rights reserved.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function n(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,t,h,a,f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(a=h||(h={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g,o,m=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(s,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),s=/[xy]/g;(o=g||(g={}))[o.CRITICAL=1]="CRITICAL",o[o.WARNING=2]="WARNING";var u,c,l=1,p=2,d=3,v=4,y=5,_=6,I=7,S=12,b=22,w=24,E=26,N=28,x=40,A=41,C=42,D=43,T=46,R=47,M=48,U=49,L=50,O=52,P=54,z=56,B=57,k=61,V=64,q=66,F=67,G=68,X=69,j=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=j}e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,r,i){var a=this;if(this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<j&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error(H+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];s.priority>j&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}}(),500),H="Channel has invalid priority",K=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}(),W=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=s.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(a);i=o}return i},s.sanitizeKey=function(e,t){return t&&(t=s.trim(t.toString())).length>s.MAX_NAME_LENGTH&&(t=t.substring(0,s.MAX_NAME_LENGTH),e.throwInternal(g.WARNING,B,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),t},s.sanitizeString=function(e,t,n){return void 0===n&&(n=s.MAX_STRING_LENGTH),t&&(n=n||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>n&&(t=t.toString().substring(0,n),e.throwInternal(g.WARNING,k,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,q)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(g.WARNING,z,"message is too long, it has been truncated to "+s.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),t},s.sanitizeException=function(e,t){return t&&t.length>s.MAX_EXCEPTION_LENGTH&&(t=t.substring(0,s.MAX_EXCEPTION_LENGTH),e.throwInternal(g.WARNING,O,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(g.WARNING,U,"custom property is not valid",{exception:e},!0)}i=s.sanitizeString(t,i,s.MAX_PROPERTY_LENGTH),n[r=s.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=s.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,X).toString():t},s.sanitizeInput=function(e,t,n,r){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(g.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),t},s.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.MAX_NAME_LENGTH=150,s.MAX_ID_LENGTH=128,s.MAX_PROPERTY_LENGTH=8192,s.MAX_STRING_LENGTH=1024,s.MAX_URL_LENGTH=2048,s.MAX_MESSAGE_LENGTH=32768,s.MAX_EXCEPTION_LENGTH=32768,s}(),Y=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(i.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(i.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,l,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var r=s._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,d,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,y,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(i.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(i.SessionStorage)),s._canUseSessionStorage},s.getSessionStorageKeys=function(){var e=[];if(s.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},s.getSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,p,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var r=s._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,v,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,_,"Browser failed removal of session storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.disableCookies=function(){s._canUseCookies=!1},s.canUseCookies=function(t){if(void 0===s._canUseCookies){s._canUseCookies=!1;try{s._canUseCookies=void 0!==s.document.cookie}catch(e){t.throwInternal(g.WARNING,G,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),s.document.location&&"https:"===s.document.location.protocol&&(a=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+i+";path=/"+a)},s.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},s.getCookie=function(e,t){if(s.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=s.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=s.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},s.deleteCookie=function(e,t){s.canUseCookies(e)&&(s.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.newId=function(){for(var e="",t=1073741824*Math.random();0<t;){e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64)}return e},s.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},s.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},s.toISOStringForIE8=function(e){if(s.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},s.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},s.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+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,r=r.length<2?"0"+r:r,(0<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},s.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},s.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},s.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},s.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},s.document="undefined"!=typeof document?document:{},s._canUseCookies=void 0,s._canUseLocalStorage=void 0,s._canUseSessionStorage=void 0,s._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],s.NotSpecified="not_specified",s}(),J=function(){function r(){}return r.parseUrl=function(e){return r.htmlAnchorElement||(r.htmlAnchorElement=r.document.createElement?r.document.createElement("a"):{}),r.htmlAnchorElement.href=e,r.htmlAnchorElement},r.getAbsoluteUrl=function(e){var t,n=r.parseUrl(e);return n&&(t=n.href),t},r.getPathName=function(e){var t,n=r.parseUrl(e);return n&&(t=n.pathname),t},r.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},r.document="undefined"!=typeof document?document:{},r}(),Z=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=J.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var u=0===s.pathname.length?"/":s.pathname;"/"!==u.charAt(0)&&(u="/"+u),o=s.pathname,a=W.sanitizeString(e,n?n+" "+u:u)}else a=W.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},e}(),Q=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||m.isNullOrUndefined(e)||m.isNullOrUndefined(t)||(n=t-e),n}}(),"ProcessLegacy"),$="http.method",ee=function(e){function t(){return e.call(this)||this}return n(t,e),t}(function(){}),te=function(i){function e(e,t,n){var r=i.call(this)||this;return r.name=W.sanitizeString(e,n)||Y.NotSpecified,r.data=t,r.time=Y.toISOStringForIE8(new Date),r.aiDataContract={time:h.Required,iKey:h.Required,name:h.Required,sampleRate:function(){return 100==r.sampleRate?h.Hidden:h.Required},tags:h.Required,data:h.Required},r}return n(e,i),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ne=function(){},re=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(ne),ie=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:h.Required,name:h.Required,properties:h.Default,measurements:h.Default},i.name=W.sanitizeString(e,t)||Y.NotSpecified,i.properties=W.sanitizeProperties(e,n),i.measurements=W.sanitizeMeasurements(e,r),i}return n(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(re),ae=function(){},oe=function(){this.hasFullStack=!0,this.parsedStack=[]},se=function(o){function e(e,t,n,r,i){var a=o.call(this)||this;return a.aiDataContract={ver:h.Required,exceptions:h.Required,severityLevel:h.Default,properties:h.Default,measurements:h.Default},a.properties=W.sanitizeProperties(e,n),a.measurements=W.sanitizeMeasurements(e,r),a.exceptions=[new ue(e,t)],i&&(a.severityLevel=i),a}return n(e,o),e.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return n(e,t),e}(ne)),ue=function(i){function e(e,t){var n=i.call(this)||this;n.aiDataContract={id:h.Default,outerId:h.Default,typeName:h.Required,message:h.Required,hasFullStack:h.Default,stack:h.Default,parsedStack:h.Array},n.typeName=W.sanitizeString(e,t.name)||Y.NotSpecified,n.message=W.sanitizeMessage(e,t.message)||Y.NotSpecified;var r=t.stack;return n.parsedStack=n.parseStack(r),n.stack=W.sanitizeException(e,r),n.hasFullStack=Y.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return n(e,i),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(ce.regex.test(o)){var s=new ce(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var u=0,c=t.length-1,l=0,f=u,p=c;u<c;){if(32768<(l+=t[u].sizeInBytes+t[c].sizeInBytes)){var d=p-f+1;t.splice(f,d);break}f=u,p=c,u++,c--}}return t},e}(oe),ce=function(i){function a(e,t){var n=i.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:h.Required,method:h.Required,assembly:h.Default,fileName:h.Default,line:h.Default},n.level=t,n.method="<no_method>",n.assembly=Y.trim(e);var r=e.match(a.regex);return r&&5<=r.length&&(n.method=Y.trim(r[2])||n.method,n.fileName=Y.trim(r[4]),n.line=parseInt(r[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 n(a,i),a.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,a.baseSize=58,a}(ae),le=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return n(e,t),e}(ne);(c=u||(u={}))[c.Measurement=0]="Measurement",c[c.Aggregation=1]="Aggregation";var fe,pe,de=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:h.Required,kind:h.Default,value:h.Required,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default},e}return n(e,t),e}(function(){this.kind=u.Measurement}),he=function(c){function e(e,t,n,r,i,a,o){var s=c.call(this)||this;s.aiDataContract={ver:h.Required,metrics:h.Required,properties:h.Default};var u=new de;return u.count=0<r?r:void 0,u.max=isNaN(a)||null===a?void 0:a,u.min=isNaN(i)||null===i?void 0:i,u.name=W.sanitizeString(e,t)||Y.NotSpecified,u.value=n,s.metrics=[u],s.properties=W.sanitizeProperties(e,o),s}return n(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(le),ge=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(re),me=function(u){function e(e,t,n,r,i,a,o){var s=u.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,properties:h.Default,measurements:h.Default,id:h.Default},s.id=W.sanitizeId(e,o),s.url=W.sanitizeUrl(e,n),s.name=W.sanitizeString(e,t)||Y.NotSpecified,isNaN(r)||(s.duration=Y.msToTimeSpan(r)),s.properties=W.sanitizeProperties(e,i),s.measurements=W.sanitizeMeasurements(e,a),s}return n(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(ge),ve=function(d){function e(e,t,n,r,i,a,o,s,u,c,l){void 0===u&&(u="Ajax");var f=d.call(this)||this;f.aiDataContract={id:h.Required,ver:h.Required,name:h.Default,resultCode:h.Default,duration:h.Default,success:h.Default,data:h.Default,target:h.Default,type:h.Default,properties:h.Default,measurements:h.Default,kind:h.Default,value:h.Default,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default,dependencyKind:h.Default,dependencySource:h.Default,commandName:h.Default,dependencyTypeName:h.Default},f.id=t,f.duration=Y.msToTimeSpan(i),f.success=a,f.resultCode=o+"",f.type=W.sanitizeString(e,u);var p=Z.ParseDependencyPath(e,n,s,r);return f.data=W.sanitizeUrl(e,r)||p.data,f.target=p.target,f.name=p.name,f.properties=W.sanitizeProperties(e,c),f.measurements=W.sanitizeMeasurements(e,l),f}return n(e,d),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return n(e,t),e}(ne)),ye=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:h.Required,message:h.Required,severityLevel:h.Default,properties:h.Default},t=t||Y.NotSpecified,i.message=W.sanitizeMessage(e,t),i.properties=W.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}return n(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return n(e,t),e}(ne)),_e=function(s){function e(e,t,n,r,i,a){var o=s.call(this)||this;return o.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,perfTotal:h.Default,networkConnect:h.Default,sentRequest:h.Default,receivedResponse:h.Default,domProcessing:h.Default,properties:h.Default,measurements:h.Default},o.url=W.sanitizeUrl(e,n),o.name=W.sanitizeString(e,t)||Y.NotSpecified,o.properties=W.sanitizeProperties(e,i),o.measurements=W.sanitizeMeasurements(e,a),o}return n(e,s),e.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",e.dataType="PageviewPerformanceData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(ge)),Ie=function(r){function e(e,t){var n=r.call(this)||this;return n.aiDataContract={baseType:h.Required,baseData:h.Required},n.baseType=e,n.baseData=t,n}return n(e,r),e}(ee);(pe=fe||(fe={}))[pe.Verbose=0]="Verbose",pe[pe.Information=1]="Information",pe[pe.Warning=2]="Warning",pe[pe.Error=3]="Error",pe[pe.Critical=4]="Critical";var Se=function(){function e(){}return e.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!m.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],m.isNullOrUndefined(i)?r:i},e}(),be=new 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.internalNodeName="ai.internal.nodeName",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion"},we=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}(),Ee=function(){function i(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(i.BUFFER_KEY),r=this.getBuffer(i.SENT_BUFFER_KEY);this._buffer=n.concat(r),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||(this._logger.throwInternal(g.WARNING,F,"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&&(this._logger.throwInternal(g.CRITICAL,F,"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 r in t){var i=!1;for(var a in e)if(e[a]===t[r]){i=!0;break}i||n.push(t[r])}return n},i.prototype.getBuffer=function(t){try{var e=Y.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(g.CRITICAL,C," storage key: "+t+", "+Y.getExceptionName(e),{exception:Y.dump(e)})}return[]},i.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);Y.setSessionStorage(this._logger,t,n)}catch(e){Y.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(g.WARNING,A," storage key: "+t+", "+Y.getExceptionName(e)+". Buffer cleared",{exception:Y.dump(e)})}},i.BUFFER_KEY="AI_buffer",i.SENT_BUFFER_KEY="AI_sentBuffer",i.MAX_BUFFER_SIZE=2e3,i}(),Ne=function(){function o(){}return o.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];"number"!=typeof r&&(t||(t={}),t[n]=r)}return t},o.extractPropsAndMeasurements=function(e,t,n){if(!m.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]="string"==typeof i?i:JSON.stringify(i)}},o.createEnvelope=function(e,t,n,r){var i=new te(e,r,t);i.iKey=n.iKey;var a=n.iKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),o.extractPartAExtensions(n,i),n.tags||(n.tags=[]),i},o.extractPartAExtensions=function(e,t){if(t.tags||(t.tags={}),e.ext||(e.ext={}),e.tags||(e.tags=[]),e.ext.user){e.ext.user.authId&&(t.tags[be.userAuthUserId]=e.ext.user.authId);var n=e.ext.user.id||e.ext.user.localId;n&&(t.tags[be.userId]=n)}if(e.ext.app&&e.ext.app.sesId&&(t.tags[be.sessionId]=e.ext.app.sesId),e.ext.device&&((e.ext.device.id||e.ext.device.localId)&&(t.tags[be.deviceId]=e.ext.device.id||e.ext.device.localId),e.ext.device.ip&&(t.tags[be.deviceIp]=e.ext.device.ip)),e.ext.web){var r=e.ext.web;r.browserLang&&(t.tags[be.deviceLanguage]=r.browserLang),r.browserVer&&(t.tags[be.deviceBrowserVersion]=r.browserVer),r.browser&&(t.tags[be.deviceBrowser]=r.browser),t.data=t.data||{},t.data.baseData=t.data.baseData||{},t.data.baseData.properties=t.data.baseData.properties||{},r.domain&&(t.data.baseData.properties.domain=r.domain),r.isManual&&(t.data.baseData.properties.isManual=r.isManual.toString()),r.screenRes&&(t.data.baseData.properties.screenRes=r.screenRes),r.userConsent&&(t.data.baseData.properties.userConsent=r.userConsent.toString())}e.ext.device&&e.ext.device.model&&(t.tags[be.deviceModel]=e.ext.device.model),e.ext.os&&e.ext.os.name&&(t.tags[be.deviceOS]=e.ext.os.name),e.ext.device&&e.ext.device.deviceType&&(t.tags[be.deviceType]=e.ext.device.deviceType),e.ext.trace&&(e.ext.trace.parentID&&(t.tags[be.operationParentId]=e.ext.trace.parentID),e.ext.trace.name&&(t.tags[be.operationName]=e.ext.trace.name),e.ext.trace.traceID&&(t.tags[be.operationId]=e.ext.trace.traceID));var i={};e.tags.forEach(function(e){i=f({},i,e)}),t.tags=f({},t.tags,i),t.tags[be.internalSdkVersion]||(t.tags[be.internalSdkVersion]="javascript:"+o.Version)},o.Version="2.0.0-rc1",o}(),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.measurements||{},r=t.baseData.properties||{};Ne.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(m.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.target,s=i.name,u=i.duration,c=i.success,l=i.responseCode,f=i.type,p=i.properties&&i.properties[$]?i.properties[$]:"GET",d=new ve(e,a,o,s,u,c,l,p,f,r,n),h=new Ie(ve.dataType,d);return Ne.createEnvelope(e,ve.envelopeType,t,h)},t.DependencyEnvelopeCreator=new t,t}(Ne),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==ie.dataType&&(n.baseTypeSource=t.baseType),t.baseType===ie.dataType?(n=t.baseData.properties||{},r=t.baseData.measurements||{}):t.baseData&&Ne.extractPropsAndMeasurements(t.baseData,n,r),Ne.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new ie(e,i,n,r),o=new Ie(ie.dataType,a);return Ne.createEnvelope(e,ie.envelopeType,t,o)},t.EventEnvelopeCreator=new t,t}(Ne),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=new Ie(se.dataType,n);return Ne.createEnvelope(e,se.envelopeType,t,r)},t.ExceptionEnvelopeCreator=new t,t}(Ne),De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.properties||{},r=Ne.extractProperties(t.data);r=f({},n,r);var i=t.baseData.name,a=t.baseData.average,o=t.baseData.sampleCount,s=t.baseData.min,u=t.baseData.max,c=new he(e,i,a,o,s,u,r),l=new Ie(he.dataType,c);return Ne.createEnvelope(e,he.envelopeType,t,l)},t.MetricEnvelopeCreator=new t,t}(Ne),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=void 0;m.isNullOrUndefined(t.baseData)||m.isNullOrUndefined(t.baseData.properties)||(n=t.baseData.properties.duration,delete t.baseData.properties.duration);var r=t.baseData,i=r.name,a=r.uri,o=r.id,s=r.properties||{},u=r.measurements||{};if(m.isNullOrUndefined(r.refUri)||(s.refUri=r.refUri),m.isNullOrUndefined(r.pageType)||(s.pageType=r.pageType),m.isNullOrUndefined(r.isLoggedIn)||(s.isLoggedIn=r.isLoggedIn.toString()),!m.isNullOrUndefined(r.properties)){var c=r.properties;for(var l in c)c.hasOwnProperty(l)&&(s[l]=c[l])}var f=new me(e,i,a,n,s,u,o),p=new Ie(me.dataType,f);return Ne.createEnvelope(e,me.envelopeType,t,p)},t.PageViewEnvelopeCreator=new t,t}(Ne),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.name,i=n.uri,a=n.properties,o=n.measurements,s=new _e(e,r,i,void 0,a,o),u=new Ie(_e.dataType,s);return Ne.createEnvelope(e,_e.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(Ne),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=Ne.extractProperties(t.data),a=f({},i,t.baseData.properties),o=new ye(e,n,r,a),s=new Ie(ye.dataType,o);return Ne.createEnvelope(e,ye.envelopeType,t,s)},t.TraceEnvelopeCreator=new t,t}(Ne),Ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),Oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),Pe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),Be=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),ke=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),Ve=function(){function e(e){this._logger=e}return e.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},e.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",r={};if(!e)return this._logger.throwInternal(g.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(g.WARNING,L,"Circular reference detected while serializing object",{name:t},!0),r;if(!e.aiDataContract){if("measurements"===t)r=this._serializeStringMap(e,"number",t);else if("properties"===t)r=this._serializeStringMap(e,"string",t);else if("tags"===t)r=this._serializeStringMap(e,"string",t);else if(Y.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(g.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(g.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return r}for(var i in e[n]=!0,e.aiDataContract){var a,o=e.aiDataContract[i],s="function"==typeof o?o()&h.Required:o&h.Required,u="function"==typeof o?o()&h.Hidden:o&h.Hidden,c=o&h.Array,l=void 0!==e[i],f="object"==typeof e[i]&&null!==e[i];if(!s||l||c){if(!u)void 0!==(a=f?c?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a)}else this._logger.throwInternal(g.CRITICAL,w,"Missing required field specification. The field is required but not present on source",{field:i,name:t})}return delete e[n],r},e.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(Y.isArray(e)){n=[];for(var r=0;r<e.length;r++){var i=e[r],a=this._serializeObject(i,t+"["+r+"]");n.push(a)}}else this._logger.throwInternal(g.CRITICAL,P,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},e.prototype._serializeStringMap=function(e,t,n){var r=void 0;if(e)for(var i in r={},e){var a=e[i];if("string"===t)void 0===a?r[i]="undefined":null===a?r[i]="null":a.toString?r[i]=a.toString():r[i]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===a)r[i]="undefined";else if(null===a)r[i]="null";else{var o=parseFloat(a);isNaN(o)?r[i]="NaN":r[i]=o}else r[i]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(g.CRITICAL,r[i],null,!0)}return r},e}(),qe=function(){function e(){this._onlineStatus=!0;try{"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}catch(e){this.isListening=!1}}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,Fe=function(){function u(){this.priority=1001,this._XMLHttpRequestSupported=!1,this.identifier="AppInsightsChannelPlugin"}return u.prototype.pause=function(){throw new Error("Method not implemented.")},u.prototype.resume=function(){throw new Error("Method not implemented.")},u.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(g.CRITICAL,b,"flush failed, telemetry will not be collected: "+Y.getExceptionName(e),{exception:Y.dump(e)})}},u.prototype.teardown=function(){throw new Error("Method not implemented.")},u.prototype.initialize=function(t,e,n){var r=this;this._logger=e.logger,this._serializer=new Ve(e.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._sender=null;var i=u._getDefaultAppInsightsChannelConfig();this._config=u._getEmptyAppInsightsChannelConfig();var a=function(e){o._config[e]=function(){return Se.getConfig(t,e,r.identifier,i[e]())}},o=this;for(var s in i)a(s);(this._buffer=this._config.enableSessionStorageBuffer&&Y.canUseSessionStorage()?new Ee(this._logger,this._config):new we(this._config),!this._config.isBeaconApiDisabled()&&Y.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))},u.prototype.processTelemetry=function(e){var t=this;try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(g.CRITICAL,I,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(g.CRITICAL,N,"Sender was not initialized");if(!u._validate(e))return void this._logger.throwInternal(g.CRITICAL,T,"Invalid telemetry envelope");var n=u.constructEnvelope(e,this._config.instrumentationKey(),this._logger);if(!n)return void this._logger.throwInternal(g.CRITICAL,R,"Unable to create an AppInsights envelope");var r=!1;if(e.tags&&e.tags[Q]&&(e.tags[Q].forEach(function(e){try{e&&!1===e(n)&&(r=!0,t._logger.warnToConsole("Telemetry processor check returns false"))}catch(e){t._logger.throwInternal(g.CRITICAL,V,"One of telemetry initializers failed, telemetry item will not be sent: "+Y.getExceptionName(e),{exception:Y.dump(e)},!0)}}),delete e.tags[Q]),r)return;var i=this._serializer.serialize(n),a=this._buffer.getItems(),o=this._buffer.batchPayloads(a);o&&o.length+i.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(i),this._setupTimer()}catch(e){this._logger.throwInternal(g.WARNING,S,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+Y.getExceptionName(e),{exception:Y.dump(e)})}m.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},u.prototype.setNextPlugin=function(e){this._nextPlugin=e},u.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var r=null;if(this._appId||(r=this._parseResponse(e.responseText||e.response))&&r.appId&&(this._appId=r.appId),(e.status<200||300<=e.status)&&0!==e.status)!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(g.WARNING,x,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(qe.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(g.WARNING,x,". Offline - Response Code: "+e.status+". Offline status: "+qe.isOffline()+". Will retry to send "+t.length+" items.")}}else 206===e.status?(r||(r=this._parseResponse(e.responseText||e.response)),r&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,r):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},u.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!Y.getIEVersion()||9<Y.getIEVersion())&&this._logger.throwInternal(g.CRITICAL,x,"Telemetry transmission failed, some telemetry will be lost: "+Y.getExceptionName(e),{exception:Y.dump(e)})}},u.prototype._onError=function(e,t,n){this._logger.throwInternal(g.WARNING,E,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},u.prototype._onPartialSuccess=function(e,t){for(var n=[],r=[],i=0,a=t.errors.reverse();i<a.length;i++){var o=a[i],s=e.splice(o.index,1)[0];this._isRetriable(o.statusCode)?r.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<r.length&&(this._resendPayload(r),this._logger.throwInternal(g.WARNING,x,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+r.length+" our of "+t.itemsReceived+" items"))},u.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},u.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},u.constructEnvelope=function(e,t,n){var r;switch((r=t===e.iKey||m.isNullOrUndefined(t)?e:f({},e,{iKey:t})).baseType){case ie.dataType:return Ae.EventEnvelopeCreator.Create(n,r);case ye.dataType:return Me.TraceEnvelopeCreator.Create(n,r);case me.dataType:return Te.PageViewEnvelopeCreator.Create(n,r);case _e.dataType:return Re.PageViewPerformanceEnvelopeCreator.Create(n,r);case se.dataType:return Ce.ExceptionEnvelopeCreator.Create(n,r);case he.dataType:return De.MetricEnvelopeCreator.Create(n,r);case ve.dataType:return xe.DependencyEnvelopeCreator.Create(n,r);default:return Ae.EventEnvelopeCreator.Create(n,r)}},u._getDefaultAppInsightsChannelConfig=function(){var e={endpointUrl:function(){return"https://dc.services.visualstudio.com/v2/track"},emitLineDelimitedJson:function(){return!1},maxBatchInterval:function(){return 15e3},maxBatchSizeInBytes:function(){return 102400},disableTelemetry:function(){return!1},enableSessionStorageBuffer:function(){return!0},isRetryDisabled:function(){return!1},isBeaconApiDisabled:function(){return!0},instrumentationKey:function(){}};return e},u._getEmptyAppInsightsChannelConfig=function(){return{endpointUrl:void 0,emitLineDelimitedJson:void 0,maxBatchInterval:void 0,maxBatchSizeInBytes:void 0,disableTelemetry:void 0,enableSessionStorageBuffer:void 0,isRetryDisabled:void 0,isBeaconApiDisabled:void 0,instrumentationKey:void 0}},u._validate=function(e){switch(e.baseType){case ie.dataType:return Ue.EventValidator.Validate(e);case ye.dataType:return Le.TraceValidator.Validate(e);case se.dataType:return Oe.ExceptionValidator.Validate(e);case he.dataType:return Pe.MetricValidator.Validate(e);case me.dataType:return Be.PageViewValidator.Validate(e);case _e.dataType:return ze.PageViewPerformanceValidator.Validate(e);case ve.dataType:return ke.RemoteDepdencyValidator.Validate(e);default:return Ue.EventValidator.Validate(e)}},u.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),r=this._buffer.batchPayloads(e),i=new Blob([r],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,i)?this._buffer.markAsSent(e):this._logger.throwInternal(g.CRITICAL,x,". Failed to send telemetry with Beacon API.")},u.prototype._xhrSender=function(t,e){var n=this,r=new XMLHttpRequest;r.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,r.open("POST",this._config.endpointUrl(),e),r.setRequestHeader("Content-type","application/json"),Y.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader(K.sdkContextHeader,K.sdkContextHeaderAppIdRequest),r.onreadystatechange=function(){return n._xhrReadyStateChange(r,t,t.length)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(r),e)};var i=this._buffer.batchPayloads(t);r.send(i),this._buffer.markAsSent(t)},u.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(g.CRITICAL,D,"Cannot parse the response. "+Y.getExceptionName(e),{response:t})}return null},u.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,r=e;n<r.length;n++){var i=r[n];this._buffer.enqueue(i)}this._setRetryTime(t),this._setupTimer()}},u.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,r=Math.floor(Math.random()*n*10)+1;r*=e,t=Math.max(Math.min(r,3600),10)}var i=Date.now()+1e3*t;this._retryAt=i},u.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)}},u.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},u.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},u.prototype._xdrSender=function(t,e){var n=this,r=new XDomainRequest;r.onload=function(){return n._xdrOnLoad(r,t)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(r),e)};var i=window.location&&window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(g.WARNING,x,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var a=this._config.endpointUrl().replace(/^(https?:)/,"");r.open("POST",a);var o=this._buffer.batchPayloads(t);r.send(o),this._buffer.markAsSent(t)},u.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},u}();e.Sender=Fe,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function n(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,t,h,a,f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(a=h||(h={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g,o,m=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(s,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),s=/[xy]/g;(o=g||(g={}))[o.CRITICAL=1]="CRITICAL",o[o.WARNING=2]="WARNING";var u,c,l=1,p=2,d=3,v=4,y=5,_=6,I=7,S=12,b=22,w=24,E=26,N=28,x=40,A=41,C=42,D=43,T=46,R=47,M=48,U=49,L=50,O=52,P=54,z=56,B=57,k=61,V=64,q=66,F=67,G=68,X=69,j=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=j}e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,r,i){var a=this;if(this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<j&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error(H+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];s.priority>j&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}}(),500),H="Channel has invalid priority",K=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}(),W=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=s.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(a);i=o}return i},s.sanitizeKey=function(e,t){var n;return t&&(t=s.trim(t.toString())).length>s.MAX_NAME_LENGTH&&(n=t.substring(0,s.MAX_NAME_LENGTH),e.throwInternal(g.WARNING,B,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},s.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=s.MAX_STRING_LENGTH),t&&(n=n||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(g.WARNING,k,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,q)},s.sanitizeMessage=function(e,t){var n;return t&&t.length>s.MAX_MESSAGE_LENGTH&&(n=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(g.WARNING,z,"message is too long, it has been truncated to "+s.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},s.sanitizeException=function(e,t){var n;return t&&t.length>s.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,s.MAX_EXCEPTION_LENGTH),e.throwInternal(g.WARNING,O,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},s.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(g.WARNING,U,"custom property is not valid",{exception:e},!0)}i=s.sanitizeString(t,i,s.MAX_PROPERTY_LENGTH),n[r=s.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=s.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,X).toString():t},s.sanitizeInput=function(e,t,n,r){var i;return t&&(t=s.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(g.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},s.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.MAX_NAME_LENGTH=150,s.MAX_ID_LENGTH=128,s.MAX_PROPERTY_LENGTH=8192,s.MAX_STRING_LENGTH=1024,s.MAX_URL_LENGTH=2048,s.MAX_MESSAGE_LENGTH=32768,s.MAX_EXCEPTION_LENGTH=32768,s}(),Y=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(i.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(i.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,l,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var r=s._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,d,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var n=s._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(g.WARNING,y,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(i.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(i.SessionStorage)),s._canUseSessionStorage},s.getSessionStorageKeys=function(){var e=[];if(s.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},s.getSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,p,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var r=s._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,v,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var n=s._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(g.WARNING,_,"Browser failed removal of session storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.disableCookies=function(){s._canUseCookies=!1},s.canUseCookies=function(t){if(void 0===s._canUseCookies){s._canUseCookies=!1;try{s._canUseCookies=void 0!==s.document.cookie}catch(e){t.throwInternal(g.WARNING,G,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),s.document.location&&"https:"===s.document.location.protocol&&(a=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+i+";path=/"+a)},s.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},s.getCookie=function(e,t){if(s.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=s.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=s.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},s.deleteCookie=function(e,t){s.canUseCookies(e)&&(s.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},s.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},s.newId=function(){for(var e="",t=1073741824*Math.random();0<t;){e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64)}return e},s.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},s.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},s.toISOStringForIE8=function(e){if(s.isDate(e)){if(Date.prototype.toISOString)return e.toISOString();var t=function(e){var t=String(e);return 1===t.length&&(t="0"+t),t};return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+String((e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},s.getIEVersion=function(e){void 0===e&&(e=null);var t=e?e.toLowerCase():navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):null},s.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+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,r=r.length<2?"0"+r:r,(0<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},s.dump=function(e){var t=Object.prototype.toString.call(e),n=JSON.stringify(e);return"[object Error]"===t&&(n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+n},s.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},s.addEventHandler=function(e,t){if("undefined"==typeof window||!window||"string"!=typeof e||"function"!=typeof t)return!1;var n="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(n,t)}return!0},s.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},s.document="undefined"!=typeof document?document:{},s._canUseCookies=void 0,s._canUseLocalStorage=void 0,s._canUseSessionStorage=void 0,s._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],s.NotSpecified="not_specified",s}(),J=function(){function r(){}return r.parseUrl=function(e){return r.htmlAnchorElement||(r.htmlAnchorElement=r.document.createElement?r.document.createElement("a"):{}),r.htmlAnchorElement.href=e,r.htmlAnchorElement},r.getAbsoluteUrl=function(e){var t,n=r.parseUrl(e);return n&&(t=n.href),t},r.getPathName=function(e){var t,n=r.parseUrl(e);return n&&(t=n.pathname),t},r.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},r.document="undefined"!=typeof document?document:{},r}(),Z=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=J.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var u=0===s.pathname.length?"/":s.pathname;"/"!==u.charAt(0)&&(u="/"+u),o=s.pathname,a=W.sanitizeString(e,n?n+" "+u:u)}else a=W.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},e}(),Q=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||m.isNullOrUndefined(e)||m.isNullOrUndefined(t)||(n=t-e),n}}(),"ProcessLegacy"),$="http.method",ee=function(e){function t(){return e.call(this)||this}return n(t,e),t}(function(){}),te=function(i){function e(e,t,n){var r=i.call(this)||this;return r.name=W.sanitizeString(e,n)||Y.NotSpecified,r.data=t,r.time=Y.toISOStringForIE8(new Date),r.aiDataContract={time:h.Required,iKey:h.Required,name:h.Required,sampleRate:function(){return 100==r.sampleRate?h.Hidden:h.Required},tags:h.Required,data:h.Required},r}return n(e,i),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ne=function(){},re=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(ne),ie=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:h.Required,name:h.Required,properties:h.Default,measurements:h.Default},i.name=W.sanitizeString(e,t)||Y.NotSpecified,i.properties=W.sanitizeProperties(e,n),i.measurements=W.sanitizeMeasurements(e,r),i}return n(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(re),ae=function(){},oe=function(){this.hasFullStack=!0,this.parsedStack=[]},se=function(o){function e(e,t,n,r,i){var a=o.call(this)||this;return a.aiDataContract={ver:h.Required,exceptions:h.Required,severityLevel:h.Default,properties:h.Default,measurements:h.Default},a.properties=W.sanitizeProperties(e,n),a.measurements=W.sanitizeMeasurements(e,r),a.exceptions=[new ue(e,t)],i&&(a.severityLevel=i),a}return n(e,o),e.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return n(e,t),e}(ne)),ue=function(i){function e(e,t){var n=i.call(this)||this;n.aiDataContract={id:h.Default,outerId:h.Default,typeName:h.Required,message:h.Required,hasFullStack:h.Default,stack:h.Default,parsedStack:h.Array},n.typeName=W.sanitizeString(e,t.name)||Y.NotSpecified,n.message=W.sanitizeMessage(e,t.message)||Y.NotSpecified;var r=t.stack;return n.parsedStack=n.parseStack(r),n.stack=W.sanitizeException(e,r),n.hasFullStack=Y.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return n(e,i),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(ce.regex.test(o)){var s=new ce(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var u=0,c=t.length-1,l=0,f=u,p=c;u<c;){if(32768<(l+=t[u].sizeInBytes+t[c].sizeInBytes)){var d=p-f+1;t.splice(f,d);break}f=u,p=c,u++,c--}}return t},e}(oe),ce=function(i){function a(e,t){var n=i.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:h.Required,method:h.Required,assembly:h.Default,fileName:h.Default,line:h.Default},n.level=t,n.method="<no_method>",n.assembly=Y.trim(e);var r=e.match(a.regex);return r&&5<=r.length&&(n.method=Y.trim(r[2])||n.method,n.fileName=Y.trim(r[4]),n.line=parseInt(r[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 n(a,i),a.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,a.baseSize=58,a}(ae),le=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return n(e,t),e}(ne);(c=u||(u={}))[c.Measurement=0]="Measurement",c[c.Aggregation=1]="Aggregation";var fe,pe,de=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:h.Required,kind:h.Default,value:h.Required,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default},e}return n(e,t),e}(function(){this.kind=u.Measurement}),he=function(c){function e(e,t,n,r,i,a,o){var s=c.call(this)||this;s.aiDataContract={ver:h.Required,metrics:h.Required,properties:h.Default};var u=new de;return u.count=0<r?r:void 0,u.max=isNaN(a)||null===a?void 0:a,u.min=isNaN(i)||null===i?void 0:i,u.name=W.sanitizeString(e,t)||Y.NotSpecified,u.value=n,s.metrics=[u],s.properties=W.sanitizeProperties(e,o),s}return n(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(le),ge=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(re),me=function(u){function e(e,t,n,r,i,a,o){var s=u.call(this)||this;return s.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,properties:h.Default,measurements:h.Default,id:h.Default},s.id=W.sanitizeId(e,o),s.url=W.sanitizeUrl(e,n),s.name=W.sanitizeString(e,t)||Y.NotSpecified,isNaN(r)||(s.duration=Y.msToTimeSpan(r)),s.properties=W.sanitizeProperties(e,i),s.measurements=W.sanitizeMeasurements(e,a),s}return n(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(ge),ve=function(d){function e(e,t,n,r,i,a,o,s,u,c,l){void 0===u&&(u="Ajax");var f=d.call(this)||this;f.aiDataContract={id:h.Required,ver:h.Required,name:h.Default,resultCode:h.Default,duration:h.Default,success:h.Default,data:h.Default,target:h.Default,type:h.Default,properties:h.Default,measurements:h.Default,kind:h.Default,value:h.Default,count:h.Default,min:h.Default,max:h.Default,stdDev:h.Default,dependencyKind:h.Default,dependencySource:h.Default,commandName:h.Default,dependencyTypeName:h.Default},f.id=t,f.duration=Y.msToTimeSpan(i),f.success=a,f.resultCode=o+"",f.type=W.sanitizeString(e,u);var p=Z.ParseDependencyPath(e,n,s,r);return f.data=W.sanitizeUrl(e,r)||p.data,f.target=p.target,f.name=p.name,f.properties=W.sanitizeProperties(e,c),f.measurements=W.sanitizeMeasurements(e,l),f}return n(e,d),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return n(e,t),e}(ne)),ye=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:h.Required,message:h.Required,severityLevel:h.Default,properties:h.Default},t=t||Y.NotSpecified,i.message=W.sanitizeMessage(e,t),i.properties=W.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}return n(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return n(e,t),e}(ne)),_e=function(s){function e(e,t,n,r,i,a){var o=s.call(this)||this;return o.aiDataContract={ver:h.Required,name:h.Default,url:h.Default,duration:h.Default,perfTotal:h.Default,networkConnect:h.Default,sentRequest:h.Default,receivedResponse:h.Default,domProcessing:h.Default,properties:h.Default,measurements:h.Default},o.url=W.sanitizeUrl(e,n),o.name=W.sanitizeString(e,t)||Y.NotSpecified,o.properties=W.sanitizeProperties(e,i),o.measurements=W.sanitizeMeasurements(e,a),o}return n(e,s),e.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",e.dataType="PageviewPerformanceData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return n(e,t),e}(ge)),Ie=function(r){function e(e,t){var n=r.call(this)||this;return n.aiDataContract={baseType:h.Required,baseData:h.Required},n.baseType=e,n.baseData=t,n}return n(e,r),e}(ee);(pe=fe||(fe={}))[pe.Verbose=0]="Verbose",pe[pe.Information=1]="Information",pe[pe.Warning=2]="Warning",pe[pe.Error=3]="Error",pe[pe.Critical=4]="Critical";var Se=function(){function e(){}return e.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!m.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],m.isNullOrUndefined(i)?r:i},e}(),be=new 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.internalNodeName="ai.internal.nodeName",this.internalSdkVersion="ai.internal.sdkVersion",this.internalAgentVersion="ai.internal.agentVersion"},we=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}(),Ee=function(){function i(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(i.BUFFER_KEY),r=this.getBuffer(i.SENT_BUFFER_KEY);this._buffer=n.concat(r),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||(this._logger.throwInternal(g.WARNING,F,"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&&(this._logger.throwInternal(g.CRITICAL,F,"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 r in t){var i=!1;for(var a in e)if(e[a]===t[r]){i=!0;break}i||n.push(t[r])}return n},i.prototype.getBuffer=function(e){var t=e;try{t=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+t:t;var n=Y.getSessionStorage(this._logger,t);if(n){var r=JSON.parse(n);if(r)return r}}catch(e){this._logger.throwInternal(g.CRITICAL,C," storage key: "+t+", "+Y.getExceptionName(e),{exception:Y.dump(e)})}return[]},i.prototype.setBuffer=function(e,t){var n=e;try{n=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+n:n;var r=JSON.stringify(t);Y.setSessionStorage(this._logger,n,r)}catch(e){Y.setSessionStorage(this._logger,n,JSON.stringify([])),this._logger.throwInternal(g.WARNING,A," storage key: "+n+", "+Y.getExceptionName(e)+". Buffer cleared",{exception:Y.dump(e)})}},i.BUFFER_KEY="AI_buffer",i.SENT_BUFFER_KEY="AI_sentBuffer",i.MAX_BUFFER_SIZE=2e3,i}(),Ne=function(){function o(){}return o.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];"number"!=typeof r&&(t||(t={}),t[n]=r)}return t},o.extractPropsAndMeasurements=function(e,t,n){if(!m.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]="string"==typeof i?i:JSON.stringify(i)}},o.createEnvelope=function(e,t,n,r){var i=new te(e,r,t);i.iKey=n.iKey;var a=n.iKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),o.extractPartAExtensions(n,i),n.tags||(n.tags=[]),i},o.extractPartAExtensions=function(e,t){if(t.tags||(t.tags={}),e.ext||(e.ext={}),e.tags||(e.tags=[]),e.ext.user){e.ext.user.authId&&(t.tags[be.userAuthUserId]=e.ext.user.authId);var n=e.ext.user.id||e.ext.user.localId;n&&(t.tags[be.userId]=n)}if(e.ext.app&&e.ext.app.sesId&&(t.tags[be.sessionId]=e.ext.app.sesId),e.ext.device&&((e.ext.device.id||e.ext.device.localId)&&(t.tags[be.deviceId]=e.ext.device.id||e.ext.device.localId),e.ext.device.ip&&(t.tags[be.deviceIp]=e.ext.device.ip)),e.ext.web){var r=e.ext.web;r.browserLang&&(t.tags[be.deviceLanguage]=r.browserLang),r.browserVer&&(t.tags[be.deviceBrowserVersion]=r.browserVer),r.browser&&(t.tags[be.deviceBrowser]=r.browser),t.data=t.data||{},t.data.baseData=t.data.baseData||{},t.data.baseData.properties=t.data.baseData.properties||{},r.domain&&(t.data.baseData.properties.domain=r.domain),r.isManual&&(t.data.baseData.properties.isManual=r.isManual.toString()),r.screenRes&&(t.data.baseData.properties.screenRes=r.screenRes),r.userConsent&&(t.data.baseData.properties.userConsent=r.userConsent.toString())}e.ext.device&&e.ext.device.model&&(t.tags[be.deviceModel]=e.ext.device.model),e.ext.os&&e.ext.os.name&&(t.tags[be.deviceOS]=e.ext.os.name),e.ext.device&&e.ext.device.deviceType&&(t.tags[be.deviceType]=e.ext.device.deviceType),e.ext.trace&&(e.ext.trace.parentID&&(t.tags[be.operationParentId]=e.ext.trace.parentID),e.ext.trace.name&&(t.tags[be.operationName]=e.ext.trace.name),e.ext.trace.traceID&&(t.tags[be.operationId]=e.ext.trace.traceID));var i={};e.tags.forEach(function(e){i=f({},i,e)}),t.tags=f({},t.tags,i),t.tags[be.internalSdkVersion]||(t.tags[be.internalSdkVersion]="javascript:"+o.Version)},o.Version="2.0.0-rc2",o}(),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.measurements||{},r=t.baseData.properties||{};Ne.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(m.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.target,s=i.name,u=i.duration,c=i.success,l=i.responseCode,f=i.type,p=i.properties&&i.properties[$]?i.properties[$]:"GET",d=new ve(e,a,o,s,u,c,l,p,f,r,n),h=new Ie(ve.dataType,d);return Ne.createEnvelope(e,ve.envelopeType,t,h)},t.DependencyEnvelopeCreator=new t,t}(Ne),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==ie.dataType&&(n.baseTypeSource=t.baseType),t.baseType===ie.dataType?(n=t.baseData.properties||{},r=t.baseData.measurements||{}):t.baseData&&Ne.extractPropsAndMeasurements(t.baseData,n,r),Ne.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new ie(e,i,n,r),o=new Ie(ie.dataType,a);return Ne.createEnvelope(e,ie.envelopeType,t,o)},t.EventEnvelopeCreator=new t,t}(Ne),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.properties,i=n.measurements,a=n.error,o=n.severityLevel,s=new se(e,a,r,i,o),u=new Ie(se.dataType,s);return Ne.createEnvelope(e,se.envelopeType,t,u)},t.ExceptionEnvelopeCreator=new t,t}(Ne),De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.properties||{},r=Ne.extractProperties(t.data);r=f({},n,r);var i=t.baseData.name,a=t.baseData.average,o=t.baseData.sampleCount,s=t.baseData.min,u=t.baseData.max,c=new he(e,i,a,o,s,u,r),l=new Ie(he.dataType,c);return Ne.createEnvelope(e,he.envelopeType,t,l)},t.MetricEnvelopeCreator=new t,t}(Ne),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=void 0;m.isNullOrUndefined(t.baseData)||m.isNullOrUndefined(t.baseData.properties)||(n=t.baseData.properties.duration,delete t.baseData.properties.duration);var r=t.baseData,i=r.name,a=r.uri,o=r.id,s=r.properties||{},u=r.measurements||{};if(m.isNullOrUndefined(r.refUri)||(s.refUri=r.refUri),m.isNullOrUndefined(r.pageType)||(s.pageType=r.pageType),m.isNullOrUndefined(r.isLoggedIn)||(s.isLoggedIn=r.isLoggedIn.toString()),!m.isNullOrUndefined(r.properties)){var c=r.properties;for(var l in c)c.hasOwnProperty(l)&&(s[l]=c[l])}var f=new me(e,i,a,n,s,u,o),p=new Ie(me.dataType,f);return Ne.createEnvelope(e,me.envelopeType,t,p)},t.PageViewEnvelopeCreator=new t,t}(Ne),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.name,i=n.uri,a=n.properties,o=n.measurements,s=new _e(e,r,i,void 0,a,o),u=new Ie(_e.dataType,s);return Ne.createEnvelope(e,_e.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(Ne),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.Create=function(e,t){this._logger=e,m.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(g.CRITICAL,T,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=Ne.extractProperties(t.data),a=f({},i,t.baseData.properties),o=new ye(e,n,r,a),s=new Ie(ye.dataType,o);return Ne.createEnvelope(e,ye.envelopeType,t,s)},t.TraceEnvelopeCreator=new t,t}(Ne),Ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),Oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),Pe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),Be=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),ke=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),Ve=function(){function e(e){this._logger=e}return e.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},e.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",r={};if(!e)return this._logger.throwInternal(g.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(g.WARNING,L,"Circular reference detected while serializing object",{name:t},!0),r;if(!e.aiDataContract){if("measurements"===t)r=this._serializeStringMap(e,"number",t);else if("properties"===t)r=this._serializeStringMap(e,"string",t);else if("tags"===t)r=this._serializeStringMap(e,"string",t);else if(Y.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(g.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(g.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return r}for(var i in e[n]=!0,e.aiDataContract){var a,o=e.aiDataContract[i],s="function"==typeof o?o()&h.Required:o&h.Required,u="function"==typeof o?o()&h.Hidden:o&h.Hidden,c=o&h.Array,l=void 0!==e[i],f="object"==typeof e[i]&&null!==e[i];if(!s||l||c){if(!u)void 0!==(a=f?c?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a)}else this._logger.throwInternal(g.CRITICAL,w,"Missing required field specification. The field is required but not present on source",{field:i,name:t})}return delete e[n],r},e.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(Y.isArray(e)){n=[];for(var r=0;r<e.length;r++){var i=e[r],a=this._serializeObject(i,t+"["+r+"]");n.push(a)}}else this._logger.throwInternal(g.CRITICAL,P,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},e.prototype._serializeStringMap=function(e,t,n){var r=void 0;if(e)for(var i in r={},e){var a=e[i];if("string"===t)void 0===a?r[i]="undefined":null===a?r[i]="null":a.toString?r[i]=a.toString():r[i]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===a)r[i]="undefined";else if(null===a)r[i]="null";else{var o=parseFloat(a);isNaN(o)?r[i]="NaN":r[i]=o}else r[i]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(g.CRITICAL,r[i],null,!0)}return r},e}(),qe=function(){function e(){this._onlineStatus=!0;try{"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}catch(e){this.isListening=!1}}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!(navigator&&!m.isNullOrUndefined(navigator.onLine))||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,Fe=function(){function u(){this.priority=1001,this._XMLHttpRequestSupported=!1,this.identifier="AppInsightsChannelPlugin"}return u.prototype.pause=function(){throw new Error("Method not implemented.")},u.prototype.resume=function(){throw new Error("Method not implemented.")},u.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(g.CRITICAL,b,"flush failed, telemetry will not be collected: "+Y.getExceptionName(e),{exception:Y.dump(e)})}},u.prototype.teardown=function(){throw new Error("Method not implemented.")},u.prototype.initialize=function(t,e,n){var r=this;this._logger=e.logger,this._serializer=new Ve(e.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._sender=null;var i=u._getDefaultAppInsightsChannelConfig();this._config=u._getEmptyAppInsightsChannelConfig();var a=function(e){o._config[e]=function(){return Se.getConfig(t,e,r.identifier,i[e]())}},o=this;for(var s in i)a(s);(this._buffer=this._config.enableSessionStorageBuffer&&Y.canUseSessionStorage()?new Ee(this._logger,this._config):new we(this._config),!this._config.isBeaconApiDisabled()&&Y.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))},u.prototype.processTelemetry=function(e){var t=this;try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(g.CRITICAL,I,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(g.CRITICAL,N,"Sender was not initialized");if(!u._validate(e))return void this._logger.throwInternal(g.CRITICAL,T,"Invalid telemetry envelope");var n=u.constructEnvelope(e,this._config.instrumentationKey(),this._logger);if(!n)return void this._logger.throwInternal(g.CRITICAL,R,"Unable to create an AppInsights envelope");var r=!1;if(e.tags&&e.tags[Q]&&(e.tags[Q].forEach(function(e){try{e&&!1===e(n)&&(r=!0,t._logger.warnToConsole("Telemetry processor check returns false"))}catch(e){t._logger.throwInternal(g.CRITICAL,V,"One of telemetry initializers failed, telemetry item will not be sent: "+Y.getExceptionName(e),{exception:Y.dump(e)},!0)}}),delete e.tags[Q]),r)return;var i=this._serializer.serialize(n),a=this._buffer.getItems(),o=this._buffer.batchPayloads(a);o&&o.length+i.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(i),this._setupTimer()}catch(e){this._logger.throwInternal(g.WARNING,S,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+Y.getExceptionName(e),{exception:Y.dump(e)})}m.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},u.prototype.setNextPlugin=function(e){this._nextPlugin=e},u.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var r=null;if(this._appId||(r=this._parseResponse(e.responseText||e.response))&&r.appId&&(this._appId=r.appId),(e.status<200||300<=e.status)&&0!==e.status)!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(g.WARNING,x,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(qe.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(g.WARNING,x,". Offline - Response Code: "+e.status+". Offline status: "+qe.isOffline()+". Will retry to send "+t.length+" items.")}}else 206===e.status?(r||(r=this._parseResponse(e.responseText||e.response)),r&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,r):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},u.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!Y.getIEVersion()||9<Y.getIEVersion())&&this._logger.throwInternal(g.CRITICAL,x,"Telemetry transmission failed, some telemetry will be lost: "+Y.getExceptionName(e),{exception:Y.dump(e)})}},u.prototype._onError=function(e,t,n){this._logger.throwInternal(g.WARNING,E,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},u.prototype._onPartialSuccess=function(e,t){for(var n=[],r=[],i=0,a=t.errors.reverse();i<a.length;i++){var o=a[i],s=e.splice(o.index,1)[0];this._isRetriable(o.statusCode)?r.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<r.length&&(this._resendPayload(r),this._logger.throwInternal(g.WARNING,x,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+r.length+" our of "+t.itemsReceived+" items"))},u.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},u.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},u.constructEnvelope=function(e,t,n){var r;switch((r=t===e.iKey||m.isNullOrUndefined(t)?e:f({},e,{iKey:t})).baseType){case ie.dataType:return Ae.EventEnvelopeCreator.Create(n,r);case ye.dataType:return Me.TraceEnvelopeCreator.Create(n,r);case me.dataType:return Te.PageViewEnvelopeCreator.Create(n,r);case _e.dataType:return Re.PageViewPerformanceEnvelopeCreator.Create(n,r);case se.dataType:return Ce.ExceptionEnvelopeCreator.Create(n,r);case he.dataType:return De.MetricEnvelopeCreator.Create(n,r);case ve.dataType:return xe.DependencyEnvelopeCreator.Create(n,r);default:return Ae.EventEnvelopeCreator.Create(n,r)}},u._getDefaultAppInsightsChannelConfig=function(){var e={endpointUrl:function(){return"https://dc.services.visualstudio.com/v2/track"},emitLineDelimitedJson:function(){return!1},maxBatchInterval:function(){return 15e3},maxBatchSizeInBytes:function(){return 102400},disableTelemetry:function(){return!1},enableSessionStorageBuffer:function(){return!0},isRetryDisabled:function(){return!1},isBeaconApiDisabled:function(){return!0},instrumentationKey:function(){}};return e},u._getEmptyAppInsightsChannelConfig=function(){return{endpointUrl:void 0,emitLineDelimitedJson:void 0,maxBatchInterval:void 0,maxBatchSizeInBytes:void 0,disableTelemetry:void 0,enableSessionStorageBuffer:void 0,isRetryDisabled:void 0,isBeaconApiDisabled:void 0,instrumentationKey:void 0,namePrefix:void 0}},u._validate=function(e){switch(e.baseType){case ie.dataType:return Ue.EventValidator.Validate(e);case ye.dataType:return Le.TraceValidator.Validate(e);case se.dataType:return Oe.ExceptionValidator.Validate(e);case he.dataType:return Pe.MetricValidator.Validate(e);case me.dataType:return Be.PageViewValidator.Validate(e);case _e.dataType:return ze.PageViewPerformanceValidator.Validate(e);case ve.dataType:return ke.RemoteDepdencyValidator.Validate(e);default:return Ue.EventValidator.Validate(e)}},u.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),r=this._buffer.batchPayloads(e),i=new Blob([r],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,i)?this._buffer.markAsSent(e):this._logger.throwInternal(g.CRITICAL,x,". Failed to send telemetry with Beacon API.")},u.prototype._xhrSender=function(t,e){var n=this,r=new XMLHttpRequest;r.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,r.open("POST",this._config.endpointUrl(),e),r.setRequestHeader("Content-type","application/json"),Y.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader(K.sdkContextHeader,K.sdkContextHeaderAppIdRequest),r.onreadystatechange=function(){return n._xhrReadyStateChange(r,t,t.length)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(r),e)};var i=this._buffer.batchPayloads(t);r.send(i),this._buffer.markAsSent(t)},u.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(g.CRITICAL,D,"Cannot parse the response. "+Y.getExceptionName(e),{response:t})}return null},u.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,r=e;n<r.length;n++){var i=r[n];this._buffer.enqueue(i)}this._setRetryTime(t),this._setupTimer()}},u.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,r=Math.floor(Math.random()*n*10)+1;r*=e,t=Math.max(Math.min(r,3600),10)}var i=Date.now()+1e3*t;this._retryAt=i},u.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)}},u.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},u.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},u.prototype._xdrSender=function(t,e){var n=this,r=new XDomainRequest;r.onload=function(){return n._xdrOnLoad(r,t)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(r),e)};var i=window.location&&window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(g.WARNING,x,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var a=this._config.endpointUrl().replace(/^(https?:)/,"");r.open("POST",a);var o=this._buffer.batchPayloads(t);r.send(o),this._buffer.markAsSent(t)},u.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},u}();e.Sender=Fe,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=applicationinsights-channel-js.min.js.map
{
"name": "@microsoft/applicationinsights-channel-js",
"version": "2.0.0-rc1",
"version": "2.0.0-rc2",
"description": "Microsoft Application Insights JavaScript SDK Channel",

@@ -31,4 +31,4 @@ "main": "dist/applicationinsights-channel-js.js",

"dependencies": {
"@microsoft/applicationinsights-core-js": "^2.0.0-rc1",
"@microsoft/applicationinsights-common": "^2.0.0-rc1",
"@microsoft/applicationinsights-core-js": "^2.0.0-rc2",
"@microsoft/applicationinsights-common": "^2.0.0-rc2",
"tslib": "^1.9.3"

@@ -35,0 +35,0 @@ },

@@ -6,3 +6,5 @@ import {

IPageViewPerformanceTelemetry, CtxTagKeys,
HttpMethod, IPageViewTelemetryInternal, IWeb
HttpMethod, IPageViewTelemetryInternal, IWeb,
Util,
IExceptionTelemetry
} from '@microsoft/applicationinsights-common';

@@ -19,3 +21,3 @@ import {

export abstract class EnvelopeCreator {
public static Version = "2.0.0-rc1";
public static Version = "2.0.0-rc2";
protected _logger: IDiagnosticLogger;

@@ -295,4 +297,8 @@

}
let baseData = telemetryItem.baseData as Exception;
let bd = telemetryItem.baseData as IExceptionTelemetry;
let customProperties = bd.properties;
let customMeasurements = bd.measurements;
let error = bd.error;
let severityLevel = bd.severityLevel
let baseData = new Exception(logger, error, customProperties, customMeasurements, severityLevel);
let data = new Data<Exception>(Exception.dataType, baseData);

@@ -299,0 +305,0 @@ return EnvelopeCreator.createEnvelope<Exception>(logger, Exception.envelopeType, telemetryItem, data);

@@ -44,2 +44,4 @@ export interface ISenderConfig {

instrumentationKey: () => string;
namePrefix: () => string;
}

@@ -46,0 +48,0 @@

@@ -0,1 +1,3 @@

import { CoreUtils } from '@microsoft/applicationinsights-core-js';
/**

@@ -30,3 +32,3 @@ * @description Monitors browser for offline events

this.isListening = true;
} else if (document){
} else if (document) {
(<any>document).ononline = this._setOnline.bind(this);

@@ -49,3 +51,3 @@ (<any>document).onoffline = this._setOffline.bind(this)

return this._onlineStatus
} else if (navigator) {
} else if (navigator && !CoreUtils.isNullOrUndefined(navigator.onLine)) { // navigator.onLine is undefined in react-native
return navigator.onLine;

@@ -52,0 +54,0 @@ } else {

@@ -33,3 +33,3 @@ import { Util } from '@microsoft/applicationinsights-common';

* Moves items to the SENT_BUFFER.
* The buffer holds items which were sent, but we haven't received any response from the backend yet.
* The buffer holds items which were sent, but we haven't received any response from the backend yet.
*/

@@ -39,3 +39,3 @@ markAsSent: (payload: string[]) => void;

/**
* Removes items from the SENT_BUFFER. Should be called on successful response from the backend.
* Removes items from the SENT_BUFFER. Should be called on successful response from the backend.
*/

@@ -46,3 +46,3 @@ clearSent: (payload: string[]) => void;

/*
* An array based send buffer.
* An array based send buffer.
*/

@@ -103,7 +103,7 @@ export class ArraySendBuffer implements ISendBuffer {

// Maximum number of payloads stored in the buffer. If the buffer is full, new elements will be dropped.
// Maximum number of payloads stored in the buffer. If the buffer is full, new elements will be dropped.
static MAX_BUFFER_SIZE = 2000;
private _bufferFullMessageSent = false;
// An in-memory copy of the buffer. A copy is saved to the session storage on enqueue() and clear().
// An in-memory copy of the buffer. A copy is saved to the session storage on enqueue() and clear().
// The buffer is restored in a constructor and contains unsent events from a previous page.

@@ -235,4 +235,6 @@ private _buffer: string[];

private getBuffer(key: string): string[] {
let prefixedKey = key;
try {
var bufferJson = Util.getSessionStorage(this._logger, key);
prefixedKey = this._config.namePrefix && this._config.namePrefix() ? this._config.namePrefix() + "_" + prefixedKey : prefixedKey;
var bufferJson = Util.getSessionStorage(this._logger, prefixedKey);
if (bufferJson) {

@@ -247,3 +249,3 @@ var buffer: string[] = JSON.parse(bufferJson);

_InternalMessageId.FailedToRestoreStorageBuffer,
" storage key: " + key + ", " + Util.getExceptionName(e),
" storage key: " + prefixedKey + ", " + Util.getExceptionName(e),
{ exception: Util.dump(e) });

@@ -256,13 +258,15 @@ }

private setBuffer(key: string, buffer: string[]) {
let prefixedKey = key;
try {
prefixedKey = this._config.namePrefix && this._config.namePrefix() ? this._config.namePrefix() + "_" + prefixedKey : prefixedKey;
var bufferJson = JSON.stringify(buffer);
Util.setSessionStorage(this._logger, key, bufferJson);
Util.setSessionStorage(this._logger, prefixedKey, bufferJson);
} catch (e) {
// if there was an error, clear the buffer
// telemetry is stored in the _buffer array so we won't loose any items
Util.setSessionStorage(this._logger, key, JSON.stringify([]));
Util.setSessionStorage(this._logger, prefixedKey, JSON.stringify([]));
this._logger.throwInternal(LoggingSeverity.WARNING,
_InternalMessageId.FailedToSetStorageBuffer,
" storage key: " + key + ", " + Util.getExceptionName(e) + ". Buffer cleared",
" storage key: " + prefixedKey + ", " + Util.getExceptionName(e) + ". Buffer cleared",
{ exception: Util.dump(e) });

@@ -269,0 +273,0 @@ }

@@ -470,3 +470,4 @@ import { ISenderConfig, XDomainRequest as IXDomainRequest, IBackendResponse } from './Interfaces';

isBeaconApiDisabled: undefined,
instrumentationKey: undefined
instrumentationKey: undefined,
namePrefix: undefined
};

@@ -473,0 +474,0 @@ }

@@ -36,2 +36,3 @@ export interface ISenderConfig {

instrumentationKey: () => string;
namePrefix: () => string;
}

@@ -38,0 +39,0 @@ export interface IBackendResponse {

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc