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 1.0.0-beta.6 to 1.0.0-beta.7

4

browser/applicationinsights-channel-js.min.js
/*!
* Application Insights JavaScript SDK - Channel, 1.0.0-beta.6
* Application Insights JavaScript SDK - Channel, 1.0.0-beta.7
* 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.aichannel={})}(this,function(e){"use strict";var i,t,g,n;(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=g||(g={}))[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden";var m,r,h=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),a=/[xy]/g;(r=m||(m={}))[r.CRITICAL=1]="CRITICAL",r[r.WARNING=2]="WARNING";var o=1,u=2,l=3,c=4,f=5,p=6,s=7,v=8,_=10,d=12,y=22,S=24,I=26,E=28,b=40,w=41,T=42,N=43,A=45,D=46,C=47,R=48,x=49,M=50,U=52,L=54,O=56,P=57,z=61,B=66,q=67,k=68,F=69,G=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=G}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)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<i.length;t++){var o=i[t];o.priority>G&&e.push(o)}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)}}}}(),200),V=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}(),X=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(m.WARNING,P,"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(m.WARNING,z,"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,B)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(m.WARNING,O,"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(m.WARNING,U,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(e,t){if(t){var n={};for(var r in t){var i=s.sanitizeString(e,t[r],s.MAX_PROPERTY_LENGTH);n[r=s.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},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,F).toString():t},s.sanitizeInput=function(e,t,n,r){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(m.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}(),H=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(m.WARNING,o,"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(m.WARNING,l,"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(m.WARNING,f,"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(m.WARNING,u,"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(m.WARNING,c,"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(m.WARNING,p,"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(m.WARNING,k,"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}(),W=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,r){var i,a;if(t&&0<t.length){var o=j.parseUrl(t);if(i=o.host,null!=o.pathname)"/"!==(r=0===o.pathname.length?"/":o.pathname).charAt(0)&&(r="/"+r),a=X.sanitizeString(e,n?n+" "+r:r);else a=X.sanitizeString(e,t)}else a=i=r;return{target:i,name:a}},e}(),K=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||h.isNullOrUndefined(e)||h.isNullOrUndefined(t)||(n=t-e),n}}(),function(e,t){return(K=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 Y(e,t){function n(){this.constructor=e}K(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var J,Z,Q=function(e){function t(){return e.call(this)||this}return Y(t,e),t}(function(){}),$=function(i){function e(e,t,n){var r=i.call(this)||this;return r.name=X.sanitizeString(e,n)||H.NotSpecified,r.data=t,r.time=H.toISOStringForIE8(new Date),r.aiDataContract={time:g.Required,iKey:g.Required,name:g.Required,sampleRate:function(){return 100==r.sampleRate?g.Hidden:g.Required},tags:g.Required,data:g.Required},r}return Y(e,i),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ee=function(){},te=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(ee),ne=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:g.Required,name:g.Required,properties:g.Default,measurements:g.Default},i.name=X.sanitizeString(e,t)||H.NotSpecified,i.properties=X.sanitizeProperties(e,n),i.measurements=X.sanitizeMeasurements(e,r),i}return Y(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(te),re=function(){},ie=function(){this.hasFullStack=!0,this.parsedStack=[]},ae=function(o){function e(e,t,n,r,i){var a=o.call(this)||this;return a.aiDataContract={ver:g.Required,exceptions:g.Required,severityLevel:g.Default,properties:g.Default,measurements:g.Default},a.properties=X.sanitizeProperties(e,n),a.measurements=X.sanitizeMeasurements(e,r),a.exceptions=[new oe(e,t)],i&&(a.severityLevel=i),a}return Y(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 Y(e,t),e}(ee)),oe=function(i){function e(e,t){var n=i.call(this)||this;n.aiDataContract={id:g.Default,outerId:g.Default,typeName:g.Required,message:g.Required,hasFullStack:g.Default,stack:g.Default,parsedStack:g.Array},n.typeName=X.sanitizeString(e,t.name)||H.NotSpecified,n.message=X.sanitizeMessage(e,t.message)||H.NotSpecified;var r=t.stack;return n.parsedStack=n.parseStack(r),n.stack=X.sanitizeException(e,r),n.hasFullStack=H.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return Y(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(se.regex.test(o)){var s=new se(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var u=0,l=t.length-1,c=0,f=u,p=l;u<l;){if(32768<(c+=t[u].sizeInBytes+t[l].sizeInBytes)){var d=p-f+1;t.splice(f,d);break}f=u,p=l,u++,l--}}return t},e}(ie),se=function(i){function a(e,t){var n=i.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:g.Required,method:g.Required,assembly:g.Default,fileName:g.Default,line:g.Default},n.level=t,n.method="<no_method>",n.assembly=H.trim(e);var r=e.match(a.regex);return r&&5<=r.length&&(n.method=H.trim(r[2])||n.method,n.fileName=H.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 Y(a,i),a.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,a.baseSize=58,a}(re),ue=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return Y(e,t),e}(ee);(Z=J||(J={}))[Z.Measurement=0]="Measurement",Z[Z.Aggregation=1]="Aggregation";var le,ce,fe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:g.Required,kind:g.Default,value:g.Required,count:g.Default,min:g.Default,max:g.Default,stdDev:g.Default},e}return Y(e,t),e}(function(){this.kind=J.Measurement}),pe=function(l){function e(e,t,n,r,i,a,o){var s=l.call(this)||this;s.aiDataContract={ver:g.Required,metrics:g.Required,properties:g.Default};var u=new fe;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=X.sanitizeString(e,t)||H.NotSpecified,u.value=n,s.metrics=[u],s.properties=X.sanitizeProperties(e,o),s}return Y(e,l),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(ue),de=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(te),he=function(u){function e(e,t,n,r,i,a,o){var s=u.call(this)||this;return s.aiDataContract={ver:g.Required,name:g.Default,url:g.Default,duration:g.Default,properties:g.Default,measurements:g.Default,id:g.Default},s.id=X.sanitizeId(e,o),s.url=X.sanitizeUrl(e,n),s.name=X.sanitizeString(e,t)||H.NotSpecified,isNaN(r)||(s.duration=H.msToTimeSpan(r)),s.properties=X.sanitizeProperties(e,i),s.measurements=X.sanitizeMeasurements(e,a),s}return Y(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(de),ge=function(p){function e(e,t,n,r,i,a,o,s,u,l){var c=p.call(this)||this;c.aiDataContract={id:g.Required,ver:g.Required,name:g.Default,resultCode:g.Default,duration:g.Default,success:g.Default,data:g.Default,target:g.Default,type:g.Default,properties:g.Default,measurements:g.Default,kind:g.Default,value:g.Default,count:g.Default,min:g.Default,max:g.Default,stdDev:g.Default,dependencyKind:g.Default,dependencySource:g.Default,commandName:g.Default,dependencyTypeName:g.Default},c.id=t,c.duration=H.msToTimeSpan(i),c.success=a,c.resultCode=o+"",c.type="Ajax",c.data=X.sanitizeUrl(e,r);var f=W.ParseDependencyPath(e,n,s,r);return c.target=f.target,c.name=f.name,c.properties=X.sanitizeProperties(e,u),c.measurements=X.sanitizeMeasurements(e,l),c}return Y(e,p),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return Y(e,t),e}(ee)),me=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:g.Required,message:g.Required,severityLevel:g.Default,properties:g.Default},t=t||H.NotSpecified,i.message=X.sanitizeMessage(e,t),i.properties=X.sanitizeProperties(e,n),r&&(i.severityLevel=r),i}return Y(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 Y(e,t),e}(ee)),ve=function(d){function h(e,t,n,r,i,a){var o=d.call(this)||this;o.aiDataContract={ver:g.Required,name:g.Default,url:g.Default,duration:g.Default,perfTotal:g.Default,networkConnect:g.Default,sentRequest:g.Default,receivedResponse:g.Default,domProcessing:g.Default,properties:g.Default,measurements:g.Default},o.isValid=!1;var s=h.getPerformanceTiming();if(s){var u=h.getDuration(s.navigationStart,s.loadEventEnd),l=h.getDuration(s.navigationStart,s.connectEnd),c=h.getDuration(s.requestStart,s.responseStart),f=h.getDuration(s.responseStart,s.responseEnd),p=h.getDuration(s.responseEnd,s.loadEventEnd);0==u?e.throwInternal(m.WARNING,_,"error calculating page view performance.",{total:u,network:l,request:c,response:f,dom:p}):h.shouldCollectDuration(u,l,c,f,p)?u<Math.floor(l)+Math.floor(c)+Math.floor(f)+Math.floor(p)?e.throwInternal(m.WARNING,v,"client performance math error.",{total:u,network:l,request:c,response:f,dom:p}):(o.durationMs=u,o.perfTotal=o.duration=H.msToTimeSpan(u),o.networkConnect=H.msToTimeSpan(l),o.sentRequest=H.msToTimeSpan(c),o.receivedResponse=H.msToTimeSpan(f),o.domProcessing=H.msToTimeSpan(p),o.isValid=!0):e.throwInternal(m.WARNING,A,"Invalid page load duration value. Browser perf data won't be sent.",{total:u,network:l,request:c,response:f,dom:p})}return o.url=X.sanitizeUrl(e,n),o.name=X.sanitizeString(e,t)||H.NotSpecified,o.properties=X.sanitizeProperties(e,i),o.measurements=X.sanitizeMeasurements(e,a),o}return Y(h,d),h.prototype.getIsValid=function(){return this.isValid},h.prototype.getDurationMs=function(){return this.durationMs},h.getPerformanceTiming=function(){return h.isPerformanceTimingSupported()?window.performance.timing:null},h.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},h.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},h.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},h.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=navigator.userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||-1!==r.toLowerCase().indexOf(n[a]);if(i)return!1;for(var o=0;o<e.length;o++)if(e[o]>=h.MAX_DURATION_ALLOWED)return!1;return!0},h.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",h.dataType="PageviewPerformanceData",h.MAX_DURATION_ALLOWED=36e5,h}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(de)),_e=function(r){function e(e,t){var n=r.call(this)||this;return n.aiDataContract={baseType:g.Required,baseData:g.Required},n.baseType=e,n.baseData=t,n}return Y(e,r),e}(Q);(ce=le||(le={}))[ce.Verbose=0]="Verbose",ce[ce.Information=1]="Information",ce[ce.Warning=2]="Warning",ce[ce.Error=3]="Error",ce[ce.Critical=4]="Critical";var ye=function(){function e(){}return e.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),void 0!==(i=n&&e.extensionConfig&&e.extensionConfig[n]&&e.extensionConfig[n][t]||e[t])?i:r},e}(),Se=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}(),Ie=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(m.WARNING,q,"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(m.CRITICAL,q,"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=H.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(m.CRITICAL,T," storage key: "+t+", "+H.getExceptionName(e),{exception:H.dump(e)})}return[]},i.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);H.setSessionStorage(this._logger,t,n)}catch(e){H.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(m.WARNING,w," storage key: "+t+", "+H.getExceptionName(e)+". Buffer cleared",{exception:H.dump(e)})}},i.BUFFER_KEY="AI_buffer",i.SENT_BUFFER_KEY="AI_sentBuffer",i.MAX_BUFFER_SIZE=2e3,i}(),Ee=["ai.application.ver","ai.application.build","ai.application.typeId","ai.application.applicationId","ai.application.layer","ai.device.id","ai.device.ip","ai.device.language","ai.device.locale","ai.device.model","ai.device.friendlyName","ai.device.network","ai.device.networkName","ai.device.oemName","ai.device.os","ai.device.osVersion","ai.device.roleInstance","ai.device.roleName","ai.device.screenResolution","ai.device.type","ai.device.machineName","ai.device.vmName","ai.device.browser","ai.device.browserVersion","ai.location.ip","ai.location.country","ai.location.province","ai.location.city","ai.operation.id","ai.operation.name","ai.operation.parentId","ai.operation.rootId","ai.operation.syntheticSource","ai.operation.correlationVector","ai.session.id","ai.session.isFirst","ai.session.isNew","ai.user.accountAcquisitionDate","ai.user.accountId","ai.user.userAgent","ai.user.id","ai.user.storeRegion","ai.user.authUserId","ai.user.anonUserAcquisitionDate","ai.user.authUserAcquisitionDate","ai.cloud.name","ai.cloud.role","ai.cloud.roleVer","ai.cloud.roleInstance","ai.cloud.environment","ai.cloud.location","ai.cloud.deploymentUnit","ai.internal.sdkVersion","ai.internal.agentVersion","ai.internal.nodeName"],be=function(){function e(){}return e.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},e.extractPropsAndMeasurements=function(e,t,n){if(!h.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]=i}},e.createEnvelope=function(e,t,n,r){var i=new $(e,r,t);i.iKey=n.instrumentationKey;var a=n.instrumentationKey.replace(/-/g,"");for(var o in i.name=i.name.replace("{0}",a),n.ctx)n.ctx.hasOwnProperty(o)&&0<=Ee.indexOf(o)&&(i.tags[o]=n.ctx[o]);return n.tags||(n.tags=[]),n.tags.forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&0<=Ee.indexOf(t)&&(i.tags[t]=e[t])}),i},e}(),we=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(h.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.absoluteUrl,s=i.commandName,u=i.duration,l=i.success,c=i.resultCode,f=i.method,p=new ge(e,a,o,s,u,l,c,f,r,n),d=new _e(ge.dataType,p);return be.createEnvelope(e,ge.envelopeType,t,d)},t.DependencyEnvelopeCreator=new t,t}(be),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==ne.dataType&&be.extractPropsAndMeasurements(t.baseData,n,r),be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new ne(e,i,n,r),o=new _e(ne.dataType,a);return be.createEnvelope(e,ne.envelopeType,t,o)},t.EventEnvelopeCreator=new t,t}(be),Ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.error,a=t.baseData.severityLevel,o=new ae(e,i,n,r,a),s=new _e(ae.dataType,o);return be.createEnvelope(e,ae.envelopeType,t,s)},t.ExceptionEnvelopeCreator=new t,t}(be),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=be.extractProperties(t.data),r=t.baseData.name,i=t.baseData.average,a=t.baseData.sampleCount,o=t.baseData.min,s=t.baseData.max,u=new pe(e,r,i,a,o,s,n),l=new _e(pe.dataType,u);return be.createEnvelope(e,pe.envelopeType,t,l)},t.MetricEnvelopeCreator=new t,t}(be),De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=void 0;h.isNullOrUndefined(t.data)||h.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration);var r={},i={};be.extractPropsAndMeasurements(t.data,r,i);var a=t.baseData.name,o=t.baseData.uri;if(h.isNullOrUndefined(t.baseData.refUri)||(r.refUri=t.baseData.refUri),h.isNullOrUndefined(t.baseData.pageType)||(r.pageType=t.baseData.pageType),h.isNullOrUndefined(t.baseData.isLoggedIn)||(r.isLoggedIn=t.baseData.isLoggedIn),!h.isNullOrUndefined(t.baseData.pageTags)){var s=t.baseData.pageTags;for(var u in s)s.hasOwnProperty(u)&&(r[u]=s[u])}var l=new he(e,a,o,n,r,i),c=new _e(he.dataType,l);return be.createEnvelope(e,he.envelopeType,t,c)},t.PageViewEnvelopeCreator=new t,t}(be),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=t.baseData.uri,o=t.baseData.duration,s=new ve(e,i,a,o,n,r),u=new _e(ve.dataType,s);return be.createEnvelope(e,ve.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(be),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=be.extractProperties(t.data),a=new me(e,n,i,r),o=new _e(me.dataType,a);return be.createEnvelope(e,me.envelopeType,t,o)},t.TraceEnvelopeCreator=new t,t}(be),xe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Me=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),Ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),Le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),Oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),Pe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),Be=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(m.CRITICAL,R,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(m.WARNING,M,"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(H.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(m.WARNING,x,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(m.CRITICAL,R,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()&g.Required:o&g.Required,u="function"==typeof o?o()&g.Hidden:o&g.Hidden,l=o&g.Array,c=void 0!==e[i],f="object"==typeof e[i]&&null!==e[i];if(!s||c||l){if(!u)void 0!==(a=f?l?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a)}else this._logger.throwInternal(m.CRITICAL,S,"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(H.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(m.CRITICAL,L,"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(m.CRITICAL,r[i],null,!0)}return r},e}(),qe=function(){function e(){this._onlineStatus=!0,"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,ke=function(){function u(){this.priority=201,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(m.CRITICAL,y,"flush failed, telemetry will not be collected: "+H.getExceptionName(e),{exception:H.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 Be(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 ye.getConfig(t,e,r.identifier,i[e]())}},o=this;for(var s in i)a(s);(this._buffer=H.canUseSessionStorage()&&this._config.enableSessionStorageBuffer?new Ie(this._logger,this._config):new Se(this._config),!this._config.isBeaconApiDisabled()&&H.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){try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(m.CRITICAL,s,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(m.CRITICAL,E,"Sender was not initialized");if(!u._validate(e))return void this._logger.throwInternal(m.CRITICAL,D,"Invalid telemetry envelope");var t=this._constructEnvelope(e);if(!t)return void this._logger.throwInternal(m.CRITICAL,C,"Unable to create an AppInsights envelope");var n=this._serializer.serialize(t),r=this._buffer.getItems(),i=this._buffer.batchPayloads(r);i&&i.length+n.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(n),this._setupTimer()}catch(e){this._logger.throwInternal(m.WARNING,d,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+H.getExceptionName(e),{exception:H.dump(e)})}h.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(m.WARNING,b,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(0===e.status||qe.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(m.WARNING,b,". 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){(!H.getIEVersion()||9<H.getIEVersion())&&this._logger.throwInternal(m.CRITICAL,b,"Telemetry transmission failed, some telemetry will be lost: "+H.getExceptionName(e),{exception:H.dump(e)})}},u.prototype._onError=function(e,t,n){this._logger.throwInternal(m.WARNING,I,"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(m.WARNING,b,"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.prototype._constructEnvelope=function(e){switch(e.baseType){case ne.dataType:return Te.EventEnvelopeCreator.Create(this._logger,e);case me.dataType:return Re.TraceEnvelopeCreator.Create(this._logger,e);case he.dataType:return De.PageViewEnvelopeCreator.Create(this._logger,e);case ve.dataType:return Ce.PageViewPerformanceEnvelopeCreator.Create(this._logger,e);case ae.dataType:return Ne.ExceptionEnvelopeCreator.Create(this._logger,e);case pe.dataType:return Ae.MetricEnvelopeCreator.Create(this._logger,e);case ge.dataType:return we.DependencyEnvelopeCreator.Create(this._logger,e);default:return Te.EventEnvelopeCreator.Create(this._logger,e)}},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}};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}},u._validate=function(e){switch(e.baseType){case ne.dataType:return xe.EventValidator.Validate(e);case me.dataType:return Me.TraceValidator.Validate(e);case ae.dataType:return Ue.ExceptionValidator.Validate(e);case pe.dataType:return Le.MetricValidator.Validate(e);case he.dataType:return Pe.PageViewValidator.Validate(e);case ve.dataType:return Oe.PageViewPerformanceValidator.Validate(e);case ge.dataType:return ze.RemoteDepdencyValidator.Validate(e);default:return xe.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(m.CRITICAL,b,". 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"),H.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader(V.sdkContextHeader,V.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(m.CRITICAL,N,"Cannot parse the response. "+H.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.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(m.WARNING,b,". 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=ke,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.aichannel={})}(this,function(e){"use strict";var i,t,g,n;(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=g||(g={}))[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden";var m,r,h=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),a=/[xy]/g;(r=m||(m={}))[r.CRITICAL=1]="CRITICAL",r[r.WARNING=2]="WARNING";var o=1,u=2,c=3,l=4,f=5,d=6,s=7,v=8,y=10,p=12,_=22,I=24,S=26,E=28,w=40,b=41,N=42,A=43,T=45,D=46,C=47,R=48,x=49,M=50,U=52,L=54,O=56,P=57,z=61,B=66,q=67,k=68,V=69,F=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=F}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)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<i.length;t++){var o=i[t];o.priority>F&&e.push(o)}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)}}}}(),200),G=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}(),X=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(m.WARNING,P,"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(m.WARNING,z,"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,B)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(m.WARNING,O,"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(m.WARNING,U,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(e,t){if(t){var n={};for(var r in t){var i=s.sanitizeString(e,t[r],s.MAX_PROPERTY_LENGTH);n[r=s.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},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,V).toString():t},s.sanitizeInput=function(e,t,n,r){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(m.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}(),H=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(m.WARNING,o,"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(m.WARNING,c,"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(m.WARNING,f,"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(m.WARNING,u,"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(m.WARNING,l,"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(m.WARNING,d,"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(m.WARNING,k,"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}(),K=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,r){var i,a;if(t&&0<t.length){var o=j.parseUrl(t);if(i=o.host,null!=o.pathname)"/"!==(r=0===o.pathname.length?"/":o.pathname).charAt(0)&&(r="/"+r),a=X.sanitizeString(e,n?n+" "+r:r);else a=X.sanitizeString(e,t)}else a=i=r;return{target:i,name:a}},e}(),W=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||h.isNullOrUndefined(e)||h.isNullOrUndefined(t)||(n=t-e),n}}(),function(e,t){return(W=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 Y(e,t){function n(){this.constructor=e}W(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var J,Z,Q=function(e){function t(){return e.call(this)||this}return Y(t,e),t}(function(){}),$=function(i){function e(e,t,n){var r=i.call(this)||this;return r.name=X.sanitizeString(e,n)||H.NotSpecified,r.data=t,r.time=H.toISOStringForIE8(new Date),r.aiDataContract={time:g.Required,iKey:g.Required,name:g.Required,sampleRate:function(){return 100==r.sampleRate?g.Hidden:g.Required},tags:g.Required,data:g.Required},r}return Y(e,i),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ee=function(){},te=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(ee),ne=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:g.Required,name:g.Required,properties:g.Default,measurements:g.Default},i.name=X.sanitizeString(e,t)||H.NotSpecified,i.properties=X.sanitizeProperties(e,n),i.measurements=X.sanitizeMeasurements(e,r),i}return Y(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(te),re=function(){},ie=function(){this.hasFullStack=!0,this.parsedStack=[]},ae=function(o){function e(e,t,n,r,i){var a=o.call(this)||this;return a.aiDataContract={ver:g.Required,exceptions:g.Required,severityLevel:g.Default,properties:g.Default,measurements:g.Default},a.properties=X.sanitizeProperties(e,n),a.measurements=X.sanitizeMeasurements(e,r),a.exceptions=[new oe(e,t)],i&&(a.severityLevel=i),a}return Y(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 Y(e,t),e}(ee)),oe=function(i){function e(e,t){var n=i.call(this)||this;n.aiDataContract={id:g.Default,outerId:g.Default,typeName:g.Required,message:g.Required,hasFullStack:g.Default,stack:g.Default,parsedStack:g.Array},n.typeName=X.sanitizeString(e,t.name)||H.NotSpecified,n.message=X.sanitizeMessage(e,t.message)||H.NotSpecified;var r=t.stack;return n.parsedStack=n.parseStack(r),n.stack=X.sanitizeException(e,r),n.hasFullStack=H.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return Y(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(se.regex.test(o)){var s=new se(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var u=0,c=t.length-1,l=0,f=u,d=c;u<c;){if(32768<(l+=t[u].sizeInBytes+t[c].sizeInBytes)){var p=d-f+1;t.splice(f,p);break}f=u,d=c,u++,c--}}return t},e}(ie),se=function(i){function a(e,t){var n=i.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:g.Required,method:g.Required,assembly:g.Default,fileName:g.Default,line:g.Default},n.level=t,n.method="<no_method>",n.assembly=H.trim(e);var r=e.match(a.regex);return r&&5<=r.length&&(n.method=H.trim(r[2])||n.method,n.fileName=H.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 Y(a,i),a.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,a.baseSize=58,a}(re),ue=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return Y(e,t),e}(ee);(Z=J||(J={}))[Z.Measurement=0]="Measurement",Z[Z.Aggregation=1]="Aggregation";var ce,le,fe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:g.Required,kind:g.Default,value:g.Required,count:g.Default,min:g.Default,max:g.Default,stdDev:g.Default},e}return Y(e,t),e}(function(){this.kind=J.Measurement}),de=function(c){function e(e,t,n,r,i,a,o){var s=c.call(this)||this;s.aiDataContract={ver:g.Required,metrics:g.Required,properties:g.Default};var u=new fe;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=X.sanitizeString(e,t)||H.NotSpecified,u.value=n,s.metrics=[u],s.properties=X.sanitizeProperties(e,o),s}return Y(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(ue),pe=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(te),he=function(u){function e(e,t,n,r,i,a,o){var s=u.call(this)||this;return s.aiDataContract={ver:g.Required,name:g.Default,url:g.Default,duration:g.Default,properties:g.Default,measurements:g.Default,id:g.Default},s.id=X.sanitizeId(e,o),s.url=X.sanitizeUrl(e,n),s.name=X.sanitizeString(e,t)||H.NotSpecified,isNaN(r)||(s.duration=H.msToTimeSpan(r)),s.properties=X.sanitizeProperties(e,i),s.measurements=X.sanitizeMeasurements(e,a),s}return Y(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(pe),ge=function(d){function e(e,t,n,r,i,a,o,s,u,c){var l=d.call(this)||this;l.aiDataContract={id:g.Required,ver:g.Required,name:g.Default,resultCode:g.Default,duration:g.Default,success:g.Default,data:g.Default,target:g.Default,type:g.Default,properties:g.Default,measurements:g.Default,kind:g.Default,value:g.Default,count:g.Default,min:g.Default,max:g.Default,stdDev:g.Default,dependencyKind:g.Default,dependencySource:g.Default,commandName:g.Default,dependencyTypeName:g.Default},l.id=t,l.duration=H.msToTimeSpan(i),l.success=a,l.resultCode=o+"",l.type="Ajax",l.data=X.sanitizeUrl(e,r);var f=K.ParseDependencyPath(e,n,s,r);return l.target=f.target,l.name=f.name,l.properties=X.sanitizeProperties(e,u),l.measurements=X.sanitizeMeasurements(e,c),l}return Y(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 Y(e,t),e}(ee)),me=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:g.Required,message:g.Required,severityLevel:g.Default,properties:g.Default},t=t||H.NotSpecified,i.message=X.sanitizeMessage(e,t),i.properties=X.sanitizeProperties(e,n),r&&(i.severityLevel=r),i}return Y(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 Y(e,t),e}(ee)),ve=function(p){function h(e,t,n,r,i,a){var o=p.call(this)||this;o.aiDataContract={ver:g.Required,name:g.Default,url:g.Default,duration:g.Default,perfTotal:g.Default,networkConnect:g.Default,sentRequest:g.Default,receivedResponse:g.Default,domProcessing:g.Default,properties:g.Default,measurements:g.Default},o.isValid=!1;var s=h.getPerformanceTiming();if(s){var u=h.getDuration(s.navigationStart,s.loadEventEnd),c=h.getDuration(s.navigationStart,s.connectEnd),l=h.getDuration(s.requestStart,s.responseStart),f=h.getDuration(s.responseStart,s.responseEnd),d=h.getDuration(s.responseEnd,s.loadEventEnd);0==u?e.throwInternal(m.WARNING,y,"error calculating page view performance.",{total:u,network:c,request:l,response:f,dom:d}):h.shouldCollectDuration(u,c,l,f,d)?u<Math.floor(c)+Math.floor(l)+Math.floor(f)+Math.floor(d)?e.throwInternal(m.WARNING,v,"client performance math error.",{total:u,network:c,request:l,response:f,dom:d}):(o.durationMs=u,o.perfTotal=o.duration=H.msToTimeSpan(u),o.networkConnect=H.msToTimeSpan(c),o.sentRequest=H.msToTimeSpan(l),o.receivedResponse=H.msToTimeSpan(f),o.domProcessing=H.msToTimeSpan(d),o.isValid=!0):e.throwInternal(m.WARNING,T,"Invalid page load duration value. Browser perf data won't be sent.",{total:u,network:c,request:l,response:f,dom:d})}return o.url=X.sanitizeUrl(e,n),o.name=X.sanitizeString(e,t)||H.NotSpecified,o.properties=X.sanitizeProperties(e,i),o.measurements=X.sanitizeMeasurements(e,a),o}return Y(h,p),h.prototype.getIsValid=function(){return this.isValid},h.prototype.getDurationMs=function(){return this.durationMs},h.getPerformanceTiming=function(){return h.isPerformanceTimingSupported()?window.performance.timing:null},h.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},h.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},h.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},h.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=navigator.userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||-1!==r.toLowerCase().indexOf(n[a]);if(i)return!1;for(var o=0;o<e.length;o++)if(e[o]>=h.MAX_DURATION_ALLOWED)return!1;return!0},h.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",h.dataType="PageviewPerformanceData",h.MAX_DURATION_ALLOWED=36e5,h}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(pe)),ye=function(r){function e(e,t){var n=r.call(this)||this;return n.aiDataContract={baseType:g.Required,baseData:g.Required},n.baseType=e,n.baseData=t,n}return Y(e,r),e}(Q);(le=ce||(ce={}))[le.Verbose=0]="Verbose",le[le.Information=1]="Information",le[le.Warning=2]="Warning",le[le.Error=3]="Error",le[le.Critical=4]="Critical";var _e=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]&&e.extensionConfig[n][t]||e[t],h.isNullOrUndefined(i)?r:i},e}(),Ie=new function(e){this.UserExtensionName="User",this.WebExtensionName="Web",this.AppExtensionName="App",this.accountIdTag="User.AccountId",this.userTagsKeysMap={},this.userTagsKeysMap[this.accountIdTag]=e.userAccountId,this.ctxKeys={id:"id",authId:"authId",localId:"localId"},this.userExtKeysMap={},this.userExtKeysMap[this.ctxKeys.localId]=e.userId,this.userExtKeysMap[this.ctxKeys.authId]=e.userAuthUserId}(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"}),Se=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(m.WARNING,q,"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(m.CRITICAL,q,"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=H.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(m.CRITICAL,N," storage key: "+t+", "+H.getExceptionName(e),{exception:H.dump(e)})}return[]},i.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);H.setSessionStorage(this._logger,t,n)}catch(e){H.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(m.WARNING,b," storage key: "+t+", "+H.getExceptionName(e)+". Buffer cleared",{exception:H.dump(e)})}},i.BUFFER_KEY="AI_buffer",i.SENT_BUFFER_KEY="AI_sentBuffer",i.MAX_BUFFER_SIZE=2e3,i}(),we=["ai.application.ver","ai.application.build","ai.application.typeId","ai.application.applicationId","ai.application.layer","ai.device.id","ai.device.ip","ai.device.language","ai.device.locale","ai.device.model","ai.device.friendlyName","ai.device.network","ai.device.networkName","ai.device.oemName","ai.device.os","ai.device.osVersion","ai.device.roleInstance","ai.device.roleName","ai.device.screenResolution","ai.device.type","ai.device.machineName","ai.device.vmName","ai.device.browser","ai.device.browserVersion","ai.location.ip","ai.location.country","ai.location.province","ai.location.city","ai.operation.id","ai.operation.name","ai.operation.parentId","ai.operation.rootId","ai.operation.syntheticSource","ai.operation.correlationVector","ai.session.id","ai.session.isFirst","ai.session.isNew","ai.user.accountAcquisitionDate","ai.user.accountId","ai.user.userAgent","ai.user.id","ai.user.storeRegion","ai.user.authUserId","ai.user.anonUserAcquisitionDate","ai.user.authUserAcquisitionDate","ai.cloud.name","ai.cloud.role","ai.cloud.roleVer","ai.cloud.roleInstance","ai.cloud.environment","ai.cloud.location","ai.cloud.deploymentUnit","ai.internal.sdkVersion","ai.internal.agentVersion","ai.internal.nodeName"],be=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(!h.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]=i}},o.createEnvelope=function(e,t,n,r){var i=new $(e,r,t);i.iKey=n.instrumentationKey;var a=n.instrumentationKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),o.extractPartAExtensions(n,i),n.tags||(n.tags=[]),n.tags.forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&0<=we.indexOf(t)&&(i.tags[t]=e[t])}),i},o.extractPartAExtensions=function(r,i){var e=[];e.push(Ie.UserExtensionName),e.forEach(function(e){var t=r.tags[e]||{};o.parseProperties(i,t,Ie.userTagsKeysMap);var n=r.ctx[e]||{};o.parseProperties(i,n,Ie.userExtKeysMap)})},o.parseProperties=function(r,i,a){Object.keys(i).forEach(function(e){var t=i[e],n=a[e];n&&t&&(r.tags[n]=t)})},o}(),Ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(h.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.absoluteUrl,s=i.commandName,u=i.duration,c=i.success,l=i.resultCode,f=i.method,d=new ge(e,a,o,s,u,c,l,f,r,n),p=new ye(ge.dataType,d);return be.createEnvelope(e,ge.envelopeType,t,p)},t.DependencyEnvelopeCreator=new t,t}(be),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==ne.dataType&&be.extractPropsAndMeasurements(t.baseData,n,r),be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new ne(e,i,n,r),o=new ye(ne.dataType,a);return be.createEnvelope(e,ne.envelopeType,t,o)},t.EventEnvelopeCreator=new t,t}(be),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.error,a=t.baseData.severityLevel,o=new ae(e,i,n,r,a),s=new ye(ae.dataType,o);return be.createEnvelope(e,ae.envelopeType,t,s)},t.ExceptionEnvelopeCreator=new t,t}(be),De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=be.extractProperties(t.data),r=t.baseData.name,i=t.baseData.average,a=t.baseData.sampleCount,o=t.baseData.min,s=t.baseData.max,u=new de(e,r,i,a,o,s,n),c=new ye(de.dataType,u);return be.createEnvelope(e,de.envelopeType,t,c)},t.MetricEnvelopeCreator=new t,t}(be),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=void 0;h.isNullOrUndefined(t.data)||h.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration);var r={},i={};be.extractPropsAndMeasurements(t.data,r,i);var a=t.baseData.name,o=t.baseData.uri;if(h.isNullOrUndefined(t.baseData.refUri)||(r.refUri=t.baseData.refUri),h.isNullOrUndefined(t.baseData.pageType)||(r.pageType=t.baseData.pageType),h.isNullOrUndefined(t.baseData.isLoggedIn)||(r.isLoggedIn=t.baseData.isLoggedIn),!h.isNullOrUndefined(t.baseData.pageTags)){var s=t.baseData.pageTags;for(var u in s)s.hasOwnProperty(u)&&(r[u]=s[u])}var c=new he(e,a,o,n,r,i),l=new ye(he.dataType,c);return be.createEnvelope(e,he.envelopeType,t,l)},t.PageViewEnvelopeCreator=new t,t}(be),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=t.baseData.uri,o=t.baseData.duration,s=new ve(e,i,a,o,n,r),u=new ye(ve.dataType,s);return be.createEnvelope(e,ve.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(be),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=be.extractProperties(t.data),a=new me(e,n,i,r),o=new ye(me.dataType,a);return be.createEnvelope(e,me.envelopeType,t,o)},t.TraceEnvelopeCreator=new t,t}(be),Me=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),Le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),Oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),Pe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),Be=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),qe=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(m.CRITICAL,R,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(m.WARNING,M,"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(H.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(m.WARNING,x,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(m.CRITICAL,R,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()&g.Required:o&g.Required,u="function"==typeof o?o()&g.Hidden:o&g.Hidden,c=o&g.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(m.CRITICAL,I,"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(H.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(m.CRITICAL,L,"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(m.CRITICAL,r[i],null,!0)}return r},e}(),ke=function(){function e(){this._onlineStatus=!0,"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,Ve=function(){function u(){this.priority=201,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(m.CRITICAL,_,"flush failed, telemetry will not be collected: "+H.getExceptionName(e),{exception:H.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 qe(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 _e.getConfig(t,e,r.identifier,i[e]())}},o=this;for(var s in i)a(s);(this._buffer=H.canUseSessionStorage()&&this._config.enableSessionStorageBuffer?new Ee(this._logger,this._config):new Se(this._config),!this._config.isBeaconApiDisabled()&&H.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){try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(m.CRITICAL,s,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(m.CRITICAL,E,"Sender was not initialized");if(!u._validate(e))return void this._logger.throwInternal(m.CRITICAL,D,"Invalid telemetry envelope");var t=this._constructEnvelope(e);if(!t)return void this._logger.throwInternal(m.CRITICAL,C,"Unable to create an AppInsights envelope");var n=this._serializer.serialize(t),r=this._buffer.getItems(),i=this._buffer.batchPayloads(r);i&&i.length+n.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(n),this._setupTimer()}catch(e){this._logger.throwInternal(m.WARNING,p,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+H.getExceptionName(e),{exception:H.dump(e)})}h.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(m.WARNING,w,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(0===e.status||ke.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(m.WARNING,w,". Offline - Response Code: "+e.status+". Offline status: "+ke.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){(!H.getIEVersion()||9<H.getIEVersion())&&this._logger.throwInternal(m.CRITICAL,w,"Telemetry transmission failed, some telemetry will be lost: "+H.getExceptionName(e),{exception:H.dump(e)})}},u.prototype._onError=function(e,t,n){this._logger.throwInternal(m.WARNING,S,"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(m.WARNING,w,"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.prototype._constructEnvelope=function(e){switch(e.baseType){case ne.dataType:return Ae.EventEnvelopeCreator.Create(this._logger,e);case me.dataType:return xe.TraceEnvelopeCreator.Create(this._logger,e);case he.dataType:return Ce.PageViewEnvelopeCreator.Create(this._logger,e);case ve.dataType:return Re.PageViewPerformanceEnvelopeCreator.Create(this._logger,e);case ae.dataType:return Te.ExceptionEnvelopeCreator.Create(this._logger,e);case de.dataType:return De.MetricEnvelopeCreator.Create(this._logger,e);case ge.dataType:return Ne.DependencyEnvelopeCreator.Create(this._logger,e);default:return Ae.EventEnvelopeCreator.Create(this._logger,e)}},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}};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}},u._validate=function(e){switch(e.baseType){case ne.dataType:return Me.EventValidator.Validate(e);case me.dataType:return Ue.TraceValidator.Validate(e);case ae.dataType:return Le.ExceptionValidator.Validate(e);case de.dataType:return Oe.MetricValidator.Validate(e);case he.dataType:return ze.PageViewValidator.Validate(e);case ve.dataType:return Pe.PageViewPerformanceValidator.Validate(e);case ge.dataType:return Be.RemoteDepdencyValidator.Validate(e);default:return Me.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(m.CRITICAL,w,". 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"),H.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader(G.sdkContextHeader,G.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(m.CRITICAL,A,"Cannot parse the response. "+H.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.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(m.WARNING,w,". 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=Ve,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=applicationinsights-channel-js.min.js.map
import * as tslib_1 from "tslib";
///<reference types="@microsoft/applicationinsights-core-js" />
import { Data, Envelope, RemoteDependencyData, Event, Exception, Metric, PageView, Trace, PageViewPerformance } from '@microsoft/applicationinsights-common';
import { Data, Envelope, RemoteDependencyData, Event, Exception, Metric, PageView, Trace, PageViewPerformance, partAExtensions } from '@microsoft/applicationinsights-common';
import { CoreUtils, LoggingSeverity, _InternalMessageId } from '@microsoft/applicationinsights-core-js';

@@ -104,10 +103,4 @@ export var ContextTagKeys = [

envelope.name = envelope.name.replace("{0}", iKeyNoDashes);
// loop through the envelope ctx (Part A) and pick out the ones that should go in outgoing envelope tags
for (var key in telemetryItem.ctx) {
if (telemetryItem.ctx.hasOwnProperty(key)) {
if (ContextTagKeys.indexOf(key) >= 0) {
envelope.tags[key] = telemetryItem.ctx[key];
}
}
}
// extract all extensions from ctx
EnvelopeCreator.extractPartAExtensions(telemetryItem, envelope);
// loop through the envelope tags (extension of Part A) and pick out the ones that should go in outgoing envelope tags

@@ -128,2 +121,21 @@ if (!telemetryItem.tags) {

};
EnvelopeCreator.extractPartAExtensions = function (telemetryItem, envelope) {
var extensions = [];
extensions.push(partAExtensions.UserExtensionName);
extensions.forEach(function (extName) {
var e = telemetryItem.tags[extName] || {};
EnvelopeCreator.parseProperties(envelope, e, partAExtensions.userTagsKeysMap);
var t = telemetryItem.ctx[extName] || {};
EnvelopeCreator.parseProperties(envelope, t, partAExtensions.userExtKeysMap);
});
};
EnvelopeCreator.parseProperties = function (env, source, map) {
Object.keys(source).forEach(function (ky) {
var val = source[ky];
var envKey = map[ky]; // look up mapped field for existing schema
if (envKey && val) {
env.tags[envKey] = val;
}
});
};
return EnvelopeCreator;

@@ -130,0 +142,0 @@ }());

/*!
* Application Insights JavaScript SDK - Channel, 1.0.0-beta.6
* Application Insights JavaScript SDK - Channel, 1.0.0-beta.7
* 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.aiproperties={})}(this,function(e){"use strict";var i,t,g,n;(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=g||(g={}))[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden";var m,r,h=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),a=/[xy]/g;(r=m||(m={}))[r.CRITICAL=1]="CRITICAL",r[r.WARNING=2]="WARNING";var o=1,u=2,l=3,c=4,f=5,p=6,s=7,v=8,_=10,d=12,y=22,S=24,I=26,E=28,b=40,w=41,T=42,N=43,A=45,D=46,C=47,R=48,x=49,M=50,U=52,L=54,O=56,P=57,z=61,B=66,q=67,k=68,F=69,G=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=G}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)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<i.length;t++){var o=i[t];o.priority>G&&e.push(o)}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)}}}}(),200),V=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}(),X=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(m.WARNING,P,"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(m.WARNING,z,"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,B)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(m.WARNING,O,"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(m.WARNING,U,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(e,t){if(t){var n={};for(var r in t){var i=s.sanitizeString(e,t[r],s.MAX_PROPERTY_LENGTH);n[r=s.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},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,F).toString():t},s.sanitizeInput=function(e,t,n,r){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(m.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}(),H=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(m.WARNING,o,"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(m.WARNING,l,"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(m.WARNING,f,"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(m.WARNING,u,"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(m.WARNING,c,"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(m.WARNING,p,"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(m.WARNING,k,"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}(),W=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,r){var i,a;if(t&&0<t.length){var o=j.parseUrl(t);if(i=o.host,null!=o.pathname)"/"!==(r=0===o.pathname.length?"/":o.pathname).charAt(0)&&(r="/"+r),a=X.sanitizeString(e,n?n+" "+r:r);else a=X.sanitizeString(e,t)}else a=i=r;return{target:i,name:a}},e}(),K=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||h.isNullOrUndefined(e)||h.isNullOrUndefined(t)||(n=t-e),n}}(),function(e,t){return(K=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 Y(e,t){function n(){this.constructor=e}K(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var J,Z,Q=function(e){function t(){return e.call(this)||this}return Y(t,e),t}(function(){}),$=function(i){function e(e,t,n){var r=i.call(this)||this;return r.name=X.sanitizeString(e,n)||H.NotSpecified,r.data=t,r.time=H.toISOStringForIE8(new Date),r.aiDataContract={time:g.Required,iKey:g.Required,name:g.Required,sampleRate:function(){return 100==r.sampleRate?g.Hidden:g.Required},tags:g.Required,data:g.Required},r}return Y(e,i),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ee=function(){},te=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(ee),ne=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:g.Required,name:g.Required,properties:g.Default,measurements:g.Default},i.name=X.sanitizeString(e,t)||H.NotSpecified,i.properties=X.sanitizeProperties(e,n),i.measurements=X.sanitizeMeasurements(e,r),i}return Y(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(te),re=function(){},ie=function(){this.hasFullStack=!0,this.parsedStack=[]},ae=function(o){function e(e,t,n,r,i){var a=o.call(this)||this;return a.aiDataContract={ver:g.Required,exceptions:g.Required,severityLevel:g.Default,properties:g.Default,measurements:g.Default},a.properties=X.sanitizeProperties(e,n),a.measurements=X.sanitizeMeasurements(e,r),a.exceptions=[new oe(e,t)],i&&(a.severityLevel=i),a}return Y(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 Y(e,t),e}(ee)),oe=function(i){function e(e,t){var n=i.call(this)||this;n.aiDataContract={id:g.Default,outerId:g.Default,typeName:g.Required,message:g.Required,hasFullStack:g.Default,stack:g.Default,parsedStack:g.Array},n.typeName=X.sanitizeString(e,t.name)||H.NotSpecified,n.message=X.sanitizeMessage(e,t.message)||H.NotSpecified;var r=t.stack;return n.parsedStack=n.parseStack(r),n.stack=X.sanitizeException(e,r),n.hasFullStack=H.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return Y(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(se.regex.test(o)){var s=new se(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var u=0,l=t.length-1,c=0,f=u,p=l;u<l;){if(32768<(c+=t[u].sizeInBytes+t[l].sizeInBytes)){var d=p-f+1;t.splice(f,d);break}f=u,p=l,u++,l--}}return t},e}(ie),se=function(i){function a(e,t){var n=i.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:g.Required,method:g.Required,assembly:g.Default,fileName:g.Default,line:g.Default},n.level=t,n.method="<no_method>",n.assembly=H.trim(e);var r=e.match(a.regex);return r&&5<=r.length&&(n.method=H.trim(r[2])||n.method,n.fileName=H.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 Y(a,i),a.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,a.baseSize=58,a}(re),ue=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return Y(e,t),e}(ee);(Z=J||(J={}))[Z.Measurement=0]="Measurement",Z[Z.Aggregation=1]="Aggregation";var le,ce,fe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:g.Required,kind:g.Default,value:g.Required,count:g.Default,min:g.Default,max:g.Default,stdDev:g.Default},e}return Y(e,t),e}(function(){this.kind=J.Measurement}),pe=function(l){function e(e,t,n,r,i,a,o){var s=l.call(this)||this;s.aiDataContract={ver:g.Required,metrics:g.Required,properties:g.Default};var u=new fe;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=X.sanitizeString(e,t)||H.NotSpecified,u.value=n,s.metrics=[u],s.properties=X.sanitizeProperties(e,o),s}return Y(e,l),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(ue),de=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(te),he=function(u){function e(e,t,n,r,i,a,o){var s=u.call(this)||this;return s.aiDataContract={ver:g.Required,name:g.Default,url:g.Default,duration:g.Default,properties:g.Default,measurements:g.Default,id:g.Default},s.id=X.sanitizeId(e,o),s.url=X.sanitizeUrl(e,n),s.name=X.sanitizeString(e,t)||H.NotSpecified,isNaN(r)||(s.duration=H.msToTimeSpan(r)),s.properties=X.sanitizeProperties(e,i),s.measurements=X.sanitizeMeasurements(e,a),s}return Y(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(de),ge=function(p){function e(e,t,n,r,i,a,o,s,u,l){var c=p.call(this)||this;c.aiDataContract={id:g.Required,ver:g.Required,name:g.Default,resultCode:g.Default,duration:g.Default,success:g.Default,data:g.Default,target:g.Default,type:g.Default,properties:g.Default,measurements:g.Default,kind:g.Default,value:g.Default,count:g.Default,min:g.Default,max:g.Default,stdDev:g.Default,dependencyKind:g.Default,dependencySource:g.Default,commandName:g.Default,dependencyTypeName:g.Default},c.id=t,c.duration=H.msToTimeSpan(i),c.success=a,c.resultCode=o+"",c.type="Ajax",c.data=X.sanitizeUrl(e,r);var f=W.ParseDependencyPath(e,n,s,r);return c.target=f.target,c.name=f.name,c.properties=X.sanitizeProperties(e,u),c.measurements=X.sanitizeMeasurements(e,l),c}return Y(e,p),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData",e}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return Y(e,t),e}(ee)),me=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:g.Required,message:g.Required,severityLevel:g.Default,properties:g.Default},t=t||H.NotSpecified,i.message=X.sanitizeMessage(e,t),i.properties=X.sanitizeProperties(e,n),r&&(i.severityLevel=r),i}return Y(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 Y(e,t),e}(ee)),ve=function(d){function h(e,t,n,r,i,a){var o=d.call(this)||this;o.aiDataContract={ver:g.Required,name:g.Default,url:g.Default,duration:g.Default,perfTotal:g.Default,networkConnect:g.Default,sentRequest:g.Default,receivedResponse:g.Default,domProcessing:g.Default,properties:g.Default,measurements:g.Default},o.isValid=!1;var s=h.getPerformanceTiming();if(s){var u=h.getDuration(s.navigationStart,s.loadEventEnd),l=h.getDuration(s.navigationStart,s.connectEnd),c=h.getDuration(s.requestStart,s.responseStart),f=h.getDuration(s.responseStart,s.responseEnd),p=h.getDuration(s.responseEnd,s.loadEventEnd);0==u?e.throwInternal(m.WARNING,_,"error calculating page view performance.",{total:u,network:l,request:c,response:f,dom:p}):h.shouldCollectDuration(u,l,c,f,p)?u<Math.floor(l)+Math.floor(c)+Math.floor(f)+Math.floor(p)?e.throwInternal(m.WARNING,v,"client performance math error.",{total:u,network:l,request:c,response:f,dom:p}):(o.durationMs=u,o.perfTotal=o.duration=H.msToTimeSpan(u),o.networkConnect=H.msToTimeSpan(l),o.sentRequest=H.msToTimeSpan(c),o.receivedResponse=H.msToTimeSpan(f),o.domProcessing=H.msToTimeSpan(p),o.isValid=!0):e.throwInternal(m.WARNING,A,"Invalid page load duration value. Browser perf data won't be sent.",{total:u,network:l,request:c,response:f,dom:p})}return o.url=X.sanitizeUrl(e,n),o.name=X.sanitizeString(e,t)||H.NotSpecified,o.properties=X.sanitizeProperties(e,i),o.measurements=X.sanitizeMeasurements(e,a),o}return Y(h,d),h.prototype.getIsValid=function(){return this.isValid},h.prototype.getDurationMs=function(){return this.durationMs},h.getPerformanceTiming=function(){return h.isPerformanceTimingSupported()?window.performance.timing:null},h.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},h.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},h.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},h.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=navigator.userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||-1!==r.toLowerCase().indexOf(n[a]);if(i)return!1;for(var o=0;o<e.length;o++)if(e[o]>=h.MAX_DURATION_ALLOWED)return!1;return!0},h.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",h.dataType="PageviewPerformanceData",h.MAX_DURATION_ALLOWED=36e5,h}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(de)),_e=function(r){function e(e,t){var n=r.call(this)||this;return n.aiDataContract={baseType:g.Required,baseData:g.Required},n.baseType=e,n.baseData=t,n}return Y(e,r),e}(Q);(ce=le||(le={}))[ce.Verbose=0]="Verbose",ce[ce.Information=1]="Information",ce[ce.Warning=2]="Warning",ce[ce.Error=3]="Error",ce[ce.Critical=4]="Critical";var ye=function(){function e(){}return e.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),void 0!==(i=n&&e.extensionConfig&&e.extensionConfig[n]&&e.extensionConfig[n][t]||e[t])?i:r},e}(),Se=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}(),Ie=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(m.WARNING,q,"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(m.CRITICAL,q,"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=H.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(m.CRITICAL,T," storage key: "+t+", "+H.getExceptionName(e),{exception:H.dump(e)})}return[]},i.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);H.setSessionStorage(this._logger,t,n)}catch(e){H.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(m.WARNING,w," storage key: "+t+", "+H.getExceptionName(e)+". Buffer cleared",{exception:H.dump(e)})}},i.BUFFER_KEY="AI_buffer",i.SENT_BUFFER_KEY="AI_sentBuffer",i.MAX_BUFFER_SIZE=2e3,i}(),Ee=["ai.application.ver","ai.application.build","ai.application.typeId","ai.application.applicationId","ai.application.layer","ai.device.id","ai.device.ip","ai.device.language","ai.device.locale","ai.device.model","ai.device.friendlyName","ai.device.network","ai.device.networkName","ai.device.oemName","ai.device.os","ai.device.osVersion","ai.device.roleInstance","ai.device.roleName","ai.device.screenResolution","ai.device.type","ai.device.machineName","ai.device.vmName","ai.device.browser","ai.device.browserVersion","ai.location.ip","ai.location.country","ai.location.province","ai.location.city","ai.operation.id","ai.operation.name","ai.operation.parentId","ai.operation.rootId","ai.operation.syntheticSource","ai.operation.correlationVector","ai.session.id","ai.session.isFirst","ai.session.isNew","ai.user.accountAcquisitionDate","ai.user.accountId","ai.user.userAgent","ai.user.id","ai.user.storeRegion","ai.user.authUserId","ai.user.anonUserAcquisitionDate","ai.user.authUserAcquisitionDate","ai.cloud.name","ai.cloud.role","ai.cloud.roleVer","ai.cloud.roleInstance","ai.cloud.environment","ai.cloud.location","ai.cloud.deploymentUnit","ai.internal.sdkVersion","ai.internal.agentVersion","ai.internal.nodeName"],be=function(){function e(){}return e.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},e.extractPropsAndMeasurements=function(e,t,n){if(!h.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]=i}},e.createEnvelope=function(e,t,n,r){var i=new $(e,r,t);i.iKey=n.instrumentationKey;var a=n.instrumentationKey.replace(/-/g,"");for(var o in i.name=i.name.replace("{0}",a),n.ctx)n.ctx.hasOwnProperty(o)&&0<=Ee.indexOf(o)&&(i.tags[o]=n.ctx[o]);return n.tags||(n.tags=[]),n.tags.forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&0<=Ee.indexOf(t)&&(i.tags[t]=e[t])}),i},e}(),we=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(h.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.absoluteUrl,s=i.commandName,u=i.duration,l=i.success,c=i.resultCode,f=i.method,p=new ge(e,a,o,s,u,l,c,f,r,n),d=new _e(ge.dataType,p);return be.createEnvelope(e,ge.envelopeType,t,d)},t.DependencyEnvelopeCreator=new t,t}(be),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==ne.dataType&&be.extractPropsAndMeasurements(t.baseData,n,r),be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new ne(e,i,n,r),o=new _e(ne.dataType,a);return be.createEnvelope(e,ne.envelopeType,t,o)},t.EventEnvelopeCreator=new t,t}(be),Ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.error,a=t.baseData.severityLevel,o=new ae(e,i,n,r,a),s=new _e(ae.dataType,o);return be.createEnvelope(e,ae.envelopeType,t,s)},t.ExceptionEnvelopeCreator=new t,t}(be),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=be.extractProperties(t.data),r=t.baseData.name,i=t.baseData.average,a=t.baseData.sampleCount,o=t.baseData.min,s=t.baseData.max,u=new pe(e,r,i,a,o,s,n),l=new _e(pe.dataType,u);return be.createEnvelope(e,pe.envelopeType,t,l)},t.MetricEnvelopeCreator=new t,t}(be),De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=void 0;h.isNullOrUndefined(t.data)||h.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration);var r={},i={};be.extractPropsAndMeasurements(t.data,r,i);var a=t.baseData.name,o=t.baseData.uri;if(h.isNullOrUndefined(t.baseData.refUri)||(r.refUri=t.baseData.refUri),h.isNullOrUndefined(t.baseData.pageType)||(r.pageType=t.baseData.pageType),h.isNullOrUndefined(t.baseData.isLoggedIn)||(r.isLoggedIn=t.baseData.isLoggedIn),!h.isNullOrUndefined(t.baseData.pageTags)){var s=t.baseData.pageTags;for(var u in s)s.hasOwnProperty(u)&&(r[u]=s[u])}var l=new he(e,a,o,n,r,i),c=new _e(he.dataType,l);return be.createEnvelope(e,he.envelopeType,t,c)},t.PageViewEnvelopeCreator=new t,t}(be),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=t.baseData.uri,o=t.baseData.duration,s=new ve(e,i,a,o,n,r),u=new _e(ve.dataType,s);return be.createEnvelope(e,ve.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(be),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=be.extractProperties(t.data),a=new me(e,n,i,r),o=new _e(me.dataType,a);return be.createEnvelope(e,me.envelopeType,t,o)},t.TraceEnvelopeCreator=new t,t}(be),xe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Me=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),Ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),Le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),Oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),Pe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),Be=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(m.CRITICAL,R,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(m.WARNING,M,"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(H.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(m.WARNING,x,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(m.CRITICAL,R,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()&g.Required:o&g.Required,u="function"==typeof o?o()&g.Hidden:o&g.Hidden,l=o&g.Array,c=void 0!==e[i],f="object"==typeof e[i]&&null!==e[i];if(!s||c||l){if(!u)void 0!==(a=f?l?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a)}else this._logger.throwInternal(m.CRITICAL,S,"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(H.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(m.CRITICAL,L,"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(m.CRITICAL,r[i],null,!0)}return r},e}(),qe=function(){function e(){this._onlineStatus=!0,"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,ke=function(){function u(){this.priority=201,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(m.CRITICAL,y,"flush failed, telemetry will not be collected: "+H.getExceptionName(e),{exception:H.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 Be(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 ye.getConfig(t,e,r.identifier,i[e]())}},o=this;for(var s in i)a(s);(this._buffer=H.canUseSessionStorage()&&this._config.enableSessionStorageBuffer?new Ie(this._logger,this._config):new Se(this._config),!this._config.isBeaconApiDisabled()&&H.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){try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(m.CRITICAL,s,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(m.CRITICAL,E,"Sender was not initialized");if(!u._validate(e))return void this._logger.throwInternal(m.CRITICAL,D,"Invalid telemetry envelope");var t=this._constructEnvelope(e);if(!t)return void this._logger.throwInternal(m.CRITICAL,C,"Unable to create an AppInsights envelope");var n=this._serializer.serialize(t),r=this._buffer.getItems(),i=this._buffer.batchPayloads(r);i&&i.length+n.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(n),this._setupTimer()}catch(e){this._logger.throwInternal(m.WARNING,d,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+H.getExceptionName(e),{exception:H.dump(e)})}h.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(m.WARNING,b,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(0===e.status||qe.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(m.WARNING,b,". 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){(!H.getIEVersion()||9<H.getIEVersion())&&this._logger.throwInternal(m.CRITICAL,b,"Telemetry transmission failed, some telemetry will be lost: "+H.getExceptionName(e),{exception:H.dump(e)})}},u.prototype._onError=function(e,t,n){this._logger.throwInternal(m.WARNING,I,"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(m.WARNING,b,"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.prototype._constructEnvelope=function(e){switch(e.baseType){case ne.dataType:return Te.EventEnvelopeCreator.Create(this._logger,e);case me.dataType:return Re.TraceEnvelopeCreator.Create(this._logger,e);case he.dataType:return De.PageViewEnvelopeCreator.Create(this._logger,e);case ve.dataType:return Ce.PageViewPerformanceEnvelopeCreator.Create(this._logger,e);case ae.dataType:return Ne.ExceptionEnvelopeCreator.Create(this._logger,e);case pe.dataType:return Ae.MetricEnvelopeCreator.Create(this._logger,e);case ge.dataType:return we.DependencyEnvelopeCreator.Create(this._logger,e);default:return Te.EventEnvelopeCreator.Create(this._logger,e)}},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}};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}},u._validate=function(e){switch(e.baseType){case ne.dataType:return xe.EventValidator.Validate(e);case me.dataType:return Me.TraceValidator.Validate(e);case ae.dataType:return Ue.ExceptionValidator.Validate(e);case pe.dataType:return Le.MetricValidator.Validate(e);case he.dataType:return Pe.PageViewValidator.Validate(e);case ve.dataType:return Oe.PageViewPerformanceValidator.Validate(e);case ge.dataType:return ze.RemoteDepdencyValidator.Validate(e);default:return xe.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(m.CRITICAL,b,". 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"),H.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader(V.sdkContextHeader,V.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(m.CRITICAL,N,"Cannot parse the response. "+H.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.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(m.WARNING,b,". 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=ke,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.aiproperties={})}(this,function(e){"use strict";var i,t,g,n;(t=i||(i={}))[t.LocalStorage=0]="LocalStorage",t[t.SessionStorage=1]="SessionStorage",(n=g||(g={}))[n.Default=0]="Default",n[n.Required=1]="Required",n[n.Array=2]="Array",n[n.Hidden=4]="Hidden";var m,r,h=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),a=/[xy]/g;(r=m||(m={}))[r.CRITICAL=1]="CRITICAL",r[r.WARNING=2]="WARNING";var o=1,u=2,c=3,l=4,f=5,d=6,s=7,v=8,y=10,p=12,_=22,I=24,S=26,E=28,w=40,b=41,N=42,A=43,T=45,D=46,C=47,R=48,x=49,M=50,U=52,L=54,O=56,P=57,z=61,B=66,q=67,k=68,V=69,F=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=F}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)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<i.length;t++){var o=i[t];o.priority>F&&e.push(o)}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)}}}}(),200),G=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}(),X=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(m.WARNING,P,"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(m.WARNING,z,"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,B)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(m.WARNING,O,"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(m.WARNING,U,"exception is too long, it has been truncated to "+s.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),t},s.sanitizeProperties=function(e,t){if(t){var n={};for(var r in t){var i=s.sanitizeString(e,t[r],s.MAX_PROPERTY_LENGTH);n[r=s.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},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,V).toString():t},s.sanitizeInput=function(e,t,n,r){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(m.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}(),H=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(m.WARNING,o,"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(m.WARNING,c,"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(m.WARNING,f,"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(m.WARNING,u,"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(m.WARNING,l,"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(m.WARNING,d,"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(m.WARNING,k,"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}(),K=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,r){var i,a;if(t&&0<t.length){var o=j.parseUrl(t);if(i=o.host,null!=o.pathname)"/"!==(r=0===o.pathname.length?"/":o.pathname).charAt(0)&&(r="/"+r),a=X.sanitizeString(e,n?n+" "+r:r);else a=X.sanitizeString(e,t)}else a=i=r;return{target:i,name:a}},e}(),W=(function(){function e(){}e.Now="undefined"==typeof window?function(){return(new Date).getTime()}:window.performance&&window.performance.now&&window.performance.timing?function(){return window.performance.now()+window.performance.timing.navigationStart}:function(){return(new Date).getTime()},e.GetDuration=function(e,t){var n=null;return 0===e||0===t||h.isNullOrUndefined(e)||h.isNullOrUndefined(t)||(n=t-e),n}}(),function(e,t){return(W=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 Y(e,t){function n(){this.constructor=e}W(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var J,Z,Q=function(e){function t(){return e.call(this)||this}return Y(t,e),t}(function(){}),$=function(i){function e(e,t,n){var r=i.call(this)||this;return r.name=X.sanitizeString(e,n)||H.NotSpecified,r.data=t,r.time=H.toISOStringForIE8(new Date),r.aiDataContract={time:g.Required,iKey:g.Required,name:g.Required,sampleRate:function(){return 100==r.sampleRate?g.Hidden:g.Required},tags:g.Required,data:g.Required},r}return Y(e,i),e}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),ee=function(){},te=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(ee),ne=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:g.Required,name:g.Required,properties:g.Default,measurements:g.Default},i.name=X.sanitizeString(e,t)||H.NotSpecified,i.properties=X.sanitizeProperties(e,n),i.measurements=X.sanitizeMeasurements(e,r),i}return Y(e,a),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData",e}(te),re=function(){},ie=function(){this.hasFullStack=!0,this.parsedStack=[]},ae=function(o){function e(e,t,n,r,i){var a=o.call(this)||this;return a.aiDataContract={ver:g.Required,exceptions:g.Required,severityLevel:g.Default,properties:g.Default,measurements:g.Default},a.properties=X.sanitizeProperties(e,n),a.measurements=X.sanitizeMeasurements(e,r),a.exceptions=[new oe(e,t)],i&&(a.severityLevel=i),a}return Y(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 Y(e,t),e}(ee)),oe=function(i){function e(e,t){var n=i.call(this)||this;n.aiDataContract={id:g.Default,outerId:g.Default,typeName:g.Required,message:g.Required,hasFullStack:g.Default,stack:g.Default,parsedStack:g.Array},n.typeName=X.sanitizeString(e,t.name)||H.NotSpecified,n.message=X.sanitizeMessage(e,t.message)||H.NotSpecified;var r=t.stack;return n.parsedStack=n.parseStack(r),n.stack=X.sanitizeException(e,r),n.hasFullStack=H.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return Y(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(se.regex.test(o)){var s=new se(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var u=0,c=t.length-1,l=0,f=u,d=c;u<c;){if(32768<(l+=t[u].sizeInBytes+t[c].sizeInBytes)){var p=d-f+1;t.splice(f,p);break}f=u,d=c,u++,c--}}return t},e}(ie),se=function(i){function a(e,t){var n=i.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:g.Required,method:g.Required,assembly:g.Default,fileName:g.Default,line:g.Default},n.level=t,n.method="<no_method>",n.assembly=H.trim(e);var r=e.match(a.regex);return r&&5<=r.length&&(n.method=H.trim(r[2])||n.method,n.fileName=H.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 Y(a,i),a.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,a.baseSize=58,a}(re),ue=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return Y(e,t),e}(ee);(Z=J||(J={}))[Z.Measurement=0]="Measurement",Z[Z.Aggregation=1]="Aggregation";var ce,le,fe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:g.Required,kind:g.Default,value:g.Required,count:g.Default,min:g.Default,max:g.Default,stdDev:g.Default},e}return Y(e,t),e}(function(){this.kind=J.Measurement}),de=function(c){function e(e,t,n,r,i,a,o){var s=c.call(this)||this;s.aiDataContract={ver:g.Required,metrics:g.Required,properties:g.Default};var u=new fe;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=X.sanitizeString(e,t)||H.NotSpecified,u.value=n,s.metrics=[u],s.properties=X.sanitizeProperties(e,o),s}return Y(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData",e}(ue),pe=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(te),he=function(u){function e(e,t,n,r,i,a,o){var s=u.call(this)||this;return s.aiDataContract={ver:g.Required,name:g.Default,url:g.Default,duration:g.Default,properties:g.Default,measurements:g.Default,id:g.Default},s.id=X.sanitizeId(e,o),s.url=X.sanitizeUrl(e,n),s.name=X.sanitizeString(e,t)||H.NotSpecified,isNaN(r)||(s.duration=H.msToTimeSpan(r)),s.properties=X.sanitizeProperties(e,i),s.measurements=X.sanitizeMeasurements(e,a),s}return Y(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(pe),ge=function(d){function e(e,t,n,r,i,a,o,s,u,c){var l=d.call(this)||this;l.aiDataContract={id:g.Required,ver:g.Required,name:g.Default,resultCode:g.Default,duration:g.Default,success:g.Default,data:g.Default,target:g.Default,type:g.Default,properties:g.Default,measurements:g.Default,kind:g.Default,value:g.Default,count:g.Default,min:g.Default,max:g.Default,stdDev:g.Default,dependencyKind:g.Default,dependencySource:g.Default,commandName:g.Default,dependencyTypeName:g.Default},l.id=t,l.duration=H.msToTimeSpan(i),l.success=a,l.resultCode=o+"",l.type="Ajax",l.data=X.sanitizeUrl(e,r);var f=K.ParseDependencyPath(e,n,s,r);return l.target=f.target,l.name=f.name,l.properties=X.sanitizeProperties(e,u),l.measurements=X.sanitizeMeasurements(e,c),l}return Y(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 Y(e,t),e}(ee)),me=function(a){function e(e,t,n,r){var i=a.call(this)||this;return i.aiDataContract={ver:g.Required,message:g.Required,severityLevel:g.Default,properties:g.Default},t=t||H.NotSpecified,i.message=X.sanitizeMessage(e,t),i.properties=X.sanitizeProperties(e,n),r&&(i.severityLevel=r),i}return Y(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 Y(e,t),e}(ee)),ve=function(p){function h(e,t,n,r,i,a){var o=p.call(this)||this;o.aiDataContract={ver:g.Required,name:g.Default,url:g.Default,duration:g.Default,perfTotal:g.Default,networkConnect:g.Default,sentRequest:g.Default,receivedResponse:g.Default,domProcessing:g.Default,properties:g.Default,measurements:g.Default},o.isValid=!1;var s=h.getPerformanceTiming();if(s){var u=h.getDuration(s.navigationStart,s.loadEventEnd),c=h.getDuration(s.navigationStart,s.connectEnd),l=h.getDuration(s.requestStart,s.responseStart),f=h.getDuration(s.responseStart,s.responseEnd),d=h.getDuration(s.responseEnd,s.loadEventEnd);0==u?e.throwInternal(m.WARNING,y,"error calculating page view performance.",{total:u,network:c,request:l,response:f,dom:d}):h.shouldCollectDuration(u,c,l,f,d)?u<Math.floor(c)+Math.floor(l)+Math.floor(f)+Math.floor(d)?e.throwInternal(m.WARNING,v,"client performance math error.",{total:u,network:c,request:l,response:f,dom:d}):(o.durationMs=u,o.perfTotal=o.duration=H.msToTimeSpan(u),o.networkConnect=H.msToTimeSpan(c),o.sentRequest=H.msToTimeSpan(l),o.receivedResponse=H.msToTimeSpan(f),o.domProcessing=H.msToTimeSpan(d),o.isValid=!0):e.throwInternal(m.WARNING,T,"Invalid page load duration value. Browser perf data won't be sent.",{total:u,network:c,request:l,response:f,dom:d})}return o.url=X.sanitizeUrl(e,n),o.name=X.sanitizeString(e,t)||H.NotSpecified,o.properties=X.sanitizeProperties(e,i),o.measurements=X.sanitizeMeasurements(e,a),o}return Y(h,p),h.prototype.getIsValid=function(){return this.isValid},h.prototype.getDurationMs=function(){return this.durationMs},h.getPerformanceTiming=function(){return h.isPerformanceTimingSupported()?window.performance.timing:null},h.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},h.isPerformanceTimingDataReady=function(){var e=window.performance.timing;return 0<e.domainLookupStart&&0<e.navigationStart&&0<e.responseStart&&0<e.requestStart&&0<e.loadEventEnd&&0<e.responseEnd&&0<e.connectEnd&&0<e.domLoading},h.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},h.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],r=navigator.userAgent,i=!1;if(r)for(var a=0;a<n.length;a++)i=i||-1!==r.toLowerCase().indexOf(n[a]);if(i)return!1;for(var o=0;o<e.length;o++)if(e[o]>=h.MAX_DURATION_ALLOWED)return!1;return!0},h.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",h.dataType="PageviewPerformanceData",h.MAX_DURATION_ALLOWED=36e5,h}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return Y(e,t),e}(pe)),ye=function(r){function e(e,t){var n=r.call(this)||this;return n.aiDataContract={baseType:g.Required,baseData:g.Required},n.baseType=e,n.baseData=t,n}return Y(e,r),e}(Q);(le=ce||(ce={}))[le.Verbose=0]="Verbose",le[le.Information=1]="Information",le[le.Warning=2]="Warning",le[le.Error=3]="Error",le[le.Critical=4]="Critical";var _e=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]&&e.extensionConfig[n][t]||e[t],h.isNullOrUndefined(i)?r:i},e}(),Ie=new function(e){this.UserExtensionName="User",this.WebExtensionName="Web",this.AppExtensionName="App",this.accountIdTag="User.AccountId",this.userTagsKeysMap={},this.userTagsKeysMap[this.accountIdTag]=e.userAccountId,this.ctxKeys={id:"id",authId:"authId",localId:"localId"},this.userExtKeysMap={},this.userExtKeysMap[this.ctxKeys.localId]=e.userId,this.userExtKeysMap[this.ctxKeys.authId]=e.userAuthUserId}(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"}),Se=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(m.WARNING,q,"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(m.CRITICAL,q,"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=H.getSessionStorage(this._logger,t);if(e){var n=JSON.parse(e);if(n)return n}}catch(e){this._logger.throwInternal(m.CRITICAL,N," storage key: "+t+", "+H.getExceptionName(e),{exception:H.dump(e)})}return[]},i.prototype.setBuffer=function(t,e){try{var n=JSON.stringify(e);H.setSessionStorage(this._logger,t,n)}catch(e){H.setSessionStorage(this._logger,t,JSON.stringify([])),this._logger.throwInternal(m.WARNING,b," storage key: "+t+", "+H.getExceptionName(e)+". Buffer cleared",{exception:H.dump(e)})}},i.BUFFER_KEY="AI_buffer",i.SENT_BUFFER_KEY="AI_sentBuffer",i.MAX_BUFFER_SIZE=2e3,i}(),we=["ai.application.ver","ai.application.build","ai.application.typeId","ai.application.applicationId","ai.application.layer","ai.device.id","ai.device.ip","ai.device.language","ai.device.locale","ai.device.model","ai.device.friendlyName","ai.device.network","ai.device.networkName","ai.device.oemName","ai.device.os","ai.device.osVersion","ai.device.roleInstance","ai.device.roleName","ai.device.screenResolution","ai.device.type","ai.device.machineName","ai.device.vmName","ai.device.browser","ai.device.browserVersion","ai.location.ip","ai.location.country","ai.location.province","ai.location.city","ai.operation.id","ai.operation.name","ai.operation.parentId","ai.operation.rootId","ai.operation.syntheticSource","ai.operation.correlationVector","ai.session.id","ai.session.isFirst","ai.session.isNew","ai.user.accountAcquisitionDate","ai.user.accountId","ai.user.userAgent","ai.user.id","ai.user.storeRegion","ai.user.authUserId","ai.user.anonUserAcquisitionDate","ai.user.authUserAcquisitionDate","ai.cloud.name","ai.cloud.role","ai.cloud.roleVer","ai.cloud.roleInstance","ai.cloud.environment","ai.cloud.location","ai.cloud.deploymentUnit","ai.internal.sdkVersion","ai.internal.agentVersion","ai.internal.nodeName"],be=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(!h.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]=i}},o.createEnvelope=function(e,t,n,r){var i=new $(e,r,t);i.iKey=n.instrumentationKey;var a=n.instrumentationKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),o.extractPartAExtensions(n,i),n.tags||(n.tags=[]),n.tags.forEach(function(e){for(var t in e)e.hasOwnProperty(t)&&0<=we.indexOf(t)&&(i.tags[t]=e[t])}),i},o.extractPartAExtensions=function(r,i){var e=[];e.push(Ie.UserExtensionName),e.forEach(function(e){var t=r.tags[e]||{};o.parseProperties(i,t,Ie.userTagsKeysMap);var n=r.ctx[e]||{};o.parseProperties(i,n,Ie.userExtKeysMap)})},o.parseProperties=function(r,i,a){Object.keys(i).forEach(function(e){var t=i[e],n=a[e];n&&t&&(r.tags[n]=t)})},o}(),Ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(h.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.absoluteUrl,s=i.commandName,u=i.duration,c=i.success,l=i.resultCode,f=i.method,d=new ge(e,a,o,s,u,c,l,f,r,n),p=new ye(ge.dataType,d);return be.createEnvelope(e,ge.envelopeType,t,p)},t.DependencyEnvelopeCreator=new t,t}(be),Ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==ne.dataType&&be.extractPropsAndMeasurements(t.baseData,n,r),be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new ne(e,i,n,r),o=new ye(ne.dataType,a);return be.createEnvelope(e,ne.envelopeType,t,o)},t.EventEnvelopeCreator=new t,t}(be),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.error,a=t.baseData.severityLevel,o=new ae(e,i,n,r,a),s=new ye(ae.dataType,o);return be.createEnvelope(e,ae.envelopeType,t,s)},t.ExceptionEnvelopeCreator=new t,t}(be),De=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=be.extractProperties(t.data),r=t.baseData.name,i=t.baseData.average,a=t.baseData.sampleCount,o=t.baseData.min,s=t.baseData.max,u=new de(e,r,i,a,o,s,n),c=new ye(de.dataType,u);return be.createEnvelope(e,de.envelopeType,t,c)},t.MetricEnvelopeCreator=new t,t}(be),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=void 0;h.isNullOrUndefined(t.data)||h.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration);var r={},i={};be.extractPropsAndMeasurements(t.data,r,i);var a=t.baseData.name,o=t.baseData.uri;if(h.isNullOrUndefined(t.baseData.refUri)||(r.refUri=t.baseData.refUri),h.isNullOrUndefined(t.baseData.pageType)||(r.pageType=t.baseData.pageType),h.isNullOrUndefined(t.baseData.isLoggedIn)||(r.isLoggedIn=t.baseData.isLoggedIn),!h.isNullOrUndefined(t.baseData.pageTags)){var s=t.baseData.pageTags;for(var u in s)s.hasOwnProperty(u)&&(r[u]=s[u])}var c=new he(e,a,o,n,r,i),l=new ye(he.dataType,c);return be.createEnvelope(e,he.envelopeType,t,l)},t.PageViewEnvelopeCreator=new t,t}(be),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n={},r={};be.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=t.baseData.uri,o=t.baseData.duration,s=new ve(e,i,a,o,n,r),u=new ye(ve.dataType,s);return be.createEnvelope(e,ve.envelopeType,t,u)},t.PageViewPerformanceEnvelopeCreator=new t,t}(be),xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Y(t,e),t.prototype.Create=function(e,t){this._logger=e,h.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,D,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=be.extractProperties(t.data),a=new me(e,n,i,r),o=new ye(me.dataType,a);return be.createEnvelope(e,me.envelopeType,t,o)},t.TraceEnvelopeCreator=new t,t}(be),Me=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.EventValidator=new e,e}(),Ue=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.TraceValidator=new e,e}(),Le=function(){function e(){}return e.prototype.Validate=function(e){return!0},e._validateExceptions=function(e){return!0},e.ExceptionValidator=new e,e}(),Oe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.MetricValidator=new e,e}(),Pe=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewPerformanceValidator=new e,e}(),ze=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.PageViewValidator=new e,e}(),Be=function(){function e(){}return e.prototype.Validate=function(e){return!0},e.RemoteDepdencyValidator=new e,e}(),qe=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(m.CRITICAL,R,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(m.WARNING,M,"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(H.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(m.WARNING,x,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(m.CRITICAL,R,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()&g.Required:o&g.Required,u="function"==typeof o?o()&g.Hidden:o&g.Hidden,c=o&g.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(m.CRITICAL,I,"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(H.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(m.CRITICAL,L,"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(m.CRITICAL,r[i],null,!0)}return r},e}(),ke=function(){function e(){this._onlineStatus=!0,"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}return e.prototype._setOnline=function(){this._onlineStatus=!0},e.prototype._setOffline=function(){this._onlineStatus=!1},e.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!navigator||navigator.onLine},e.prototype.isOffline=function(){return!this.isOnline()},e.Offline=new e,e}().Offline,Ve=function(){function u(){this.priority=201,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(m.CRITICAL,_,"flush failed, telemetry will not be collected: "+H.getExceptionName(e),{exception:H.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 qe(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 _e.getConfig(t,e,r.identifier,i[e]())}},o=this;for(var s in i)a(s);(this._buffer=H.canUseSessionStorage()&&this._config.enableSessionStorageBuffer?new Ee(this._logger,this._config):new Se(this._config),!this._config.isBeaconApiDisabled()&&H.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){try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(m.CRITICAL,s,"Cannot send empty telemetry");if(!this._sender)return void this._logger.throwInternal(m.CRITICAL,E,"Sender was not initialized");if(!u._validate(e))return void this._logger.throwInternal(m.CRITICAL,D,"Invalid telemetry envelope");var t=this._constructEnvelope(e);if(!t)return void this._logger.throwInternal(m.CRITICAL,C,"Unable to create an AppInsights envelope");var n=this._serializer.serialize(t),r=this._buffer.getItems(),i=this._buffer.batchPayloads(r);i&&i.length+n.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(n),this._setupTimer()}catch(e){this._logger.throwInternal(m.WARNING,p,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+H.getExceptionName(e),{exception:H.dump(e)})}h.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(m.WARNING,w,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e));else if(0===e.status||ke.isOffline()){if(!this._config.isRetryDisabled()){this._resendPayload(t,10),this._logger.throwInternal(m.WARNING,w,". Offline - Response Code: "+e.status+". Offline status: "+ke.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){(!H.getIEVersion()||9<H.getIEVersion())&&this._logger.throwInternal(m.CRITICAL,w,"Telemetry transmission failed, some telemetry will be lost: "+H.getExceptionName(e),{exception:H.dump(e)})}},u.prototype._onError=function(e,t,n){this._logger.throwInternal(m.WARNING,S,"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(m.WARNING,w,"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.prototype._constructEnvelope=function(e){switch(e.baseType){case ne.dataType:return Ae.EventEnvelopeCreator.Create(this._logger,e);case me.dataType:return xe.TraceEnvelopeCreator.Create(this._logger,e);case he.dataType:return Ce.PageViewEnvelopeCreator.Create(this._logger,e);case ve.dataType:return Re.PageViewPerformanceEnvelopeCreator.Create(this._logger,e);case ae.dataType:return Te.ExceptionEnvelopeCreator.Create(this._logger,e);case de.dataType:return De.MetricEnvelopeCreator.Create(this._logger,e);case ge.dataType:return Ne.DependencyEnvelopeCreator.Create(this._logger,e);default:return Ae.EventEnvelopeCreator.Create(this._logger,e)}},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}};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}},u._validate=function(e){switch(e.baseType){case ne.dataType:return Me.EventValidator.Validate(e);case me.dataType:return Ue.TraceValidator.Validate(e);case ae.dataType:return Le.ExceptionValidator.Validate(e);case de.dataType:return Oe.MetricValidator.Validate(e);case he.dataType:return ze.PageViewValidator.Validate(e);case ve.dataType:return Pe.PageViewPerformanceValidator.Validate(e);case ge.dataType:return Be.RemoteDepdencyValidator.Validate(e);default:return Me.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(m.CRITICAL,w,". 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"),H.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader(G.sdkContextHeader,G.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(m.CRITICAL,A,"Cannot parse the response. "+H.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.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(m.WARNING,w,". 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=Ve,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=applicationinsights-channel-js.min.js.map
{
"name": "@microsoft/applicationinsights-channel-js",
"version": "1.0.0-beta.6",
"version": "1.0.0-beta.7",
"description": "Microsoft Application Insights JavaScript SDK Channel",

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

"@microsoft/applicationinsights-core-js": "^1.0.0-beta.2",
"@microsoft/applicationinsights-common": "^1.0.0-beta.7"
"@microsoft/applicationinsights-common": "^1.0.0-beta.8"
},
"license": "MIT"
}

@@ -14,3 +14,3 @@ # Microsoft Application Insights JavaScript SDK - Channel

npm install
npm run build
npm run build --silent
```

@@ -17,0 +17,0 @@ ## Test

@@ -1,6 +0,5 @@

///<reference types="@microsoft/applicationinsights-core-js" />
import {
IEnvelope, Data, Envelope,
RemoteDependencyData, Event, Exception,
Metric, PageView, Trace, PageViewPerformance, IDependencyTelemetry, IEventTelemetry
Metric, PageView, Trace, PageViewPerformance, IDependencyTelemetry, partAExtensions
} from '@microsoft/applicationinsights-common';

@@ -118,10 +117,4 @@ import {

// loop through the envelope ctx (Part A) and pick out the ones that should go in outgoing envelope tags
for (let key in telemetryItem.ctx) {
if (telemetryItem.ctx.hasOwnProperty(key)) {
if (ContextTagKeys.indexOf(key) >= 0) {
envelope.tags[key] = telemetryItem.ctx[key];
}
}
}
// extract all extensions from ctx
EnvelopeCreator.extractPartAExtensions(telemetryItem, envelope);

@@ -132,2 +125,3 @@ // loop through the envelope tags (extension of Part A) and pick out the ones that should go in outgoing envelope tags

}
telemetryItem.tags.forEach((tag) => {

@@ -145,2 +139,25 @@ for (let key in tag) {

}
private static extractPartAExtensions(telemetryItem: ITelemetryItem, envelope: IEnvelope) {
let extensions = [];
extensions.push(partAExtensions.UserExtensionName);
extensions.forEach(extName => {
let e = telemetryItem.tags[extName] || {};
EnvelopeCreator.parseProperties(envelope, e, partAExtensions.userTagsKeysMap);
let t = telemetryItem.ctx[extName] || {};
EnvelopeCreator.parseProperties(envelope, t, partAExtensions.userExtKeysMap);
});
}
private static parseProperties(env: IEnvelope, source: any, map: any) {
Object.keys(source).forEach(ky => {
let val = source[ky];
let envKey = map[ky]; // look up mapped field for existing schema
if (envKey && val) {
env.tags[envKey] = val;
}
});
}
}

@@ -147,0 +164,0 @@

@@ -20,2 +20,4 @@ import { IEnvelope, Data } from '@microsoft/applicationinsights-common';

protected static createEnvelope<T>(logger: IDiagnosticLogger, envelopeType: string, telemetryItem: ITelemetryItem, data: Data<T>): IEnvelope;
private static extractPartAExtensions(telemetryItem, envelope);
private static parseProperties(env, source, map);
}

@@ -22,0 +24,0 @@ export declare class DependencyEnvelopeCreator extends EnvelopeCreator {

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc