@microsoft/applicationinsights-properties-js
Advanced tools
Comparing version 1.0.0-beta.12 to 2.0.0-beta.1
/*! | ||
* Application Insights JavaScript SDK - Properties Plugin, 1.0.0-beta.12 | ||
* Application Insights JavaScript SDK - Properties Plugin, 2.0.0-beta.1 | ||
* 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 h,t,r=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),n=/[xy]/g;(t=h||(h={}))[t.CRITICAL=1]="CRITICAL",t[t.WARNING=2]="WARNING";var o,i,m,a,s=0,c=1,u=2,l=3,p=4,g=5,d=6,v=8,f=9,S=10,y=23,I=27,w=45,N=52,_=56,D=57,x=58,A=60,C=61,T=66,E=68,M=69,b=function(){function r(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?r.AiUserActionablePrefix:r.AiNonUserActionablePrefix)+e;var o=(t?" message:"+r.sanitizeDiagnosticText(t):"")+(i?" props:"+r.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=o}return r.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},r.dataType="MessageData",r.AiNonUserActionablePrefix="AI (Internal): ",r.AiUserActionablePrefix="AI: ",r}(),L=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},r.isNullOrUndefined(e)||(r.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),r.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),r.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),r.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,o){void 0===o&&(o=!1);var r=new b(t,n,o,i);if(this.enableDebugExceptions())throw r;if(void 0!==r&&r&&void 0!==r.message){if(o){var a=+r.messageId;(!this._messageLogged[a]||this.consoleLoggingLevel()>=h.WARNING)&&(this.warnToConsole(r.message),this._messageLogged[a]=!0)}else this.consoleLoggingLevel()>=h.WARNING&&this.warnToConsole(r.message);this.logInternalMessage(e,r)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",r=new b(y,o,!1);this.queue.push(r),this.warnToConsole(o)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),U=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=U}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,i,o){var r=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,i,o)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);r.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<o.length;t++){var a=o[t];a.priority>U&&e.push(a)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}}}(),200);(i=o||(o={}))[i.LocalStorage=0]="LocalStorage",i[i.SessionStorage=1]="SessionStorage",(a=m||(m={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var k=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var i=t.length,o=s.sanitizeKey(e,t);if(o.length!==i){for(var r=0,a=o;void 0!==n[a];)r++,a=o.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(r);o=a}return o},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(h.WARNING,D,"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(h.WARNING,C,"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,T)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(h.WARNING,_,"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(h.WARNING,N,"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 i in t){var o=s.sanitizeString(e,t[i],s.MAX_PROPERTY_LENGTH);n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=o}t=n}return t},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var i in t){var o=t[i];n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=o}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,M).toString():t},s.sanitizeInput=function(e,t,n,i){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(h.WARNING,i,"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}(),R=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(o.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,i=null;try{if("undefined"==typeof window)return null;n=new Date,(i=e===o.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=i.getItem(n)!=n,i.removeItem(n),t&&(i=null)}catch(e){i=null}return i},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(o.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(h.WARNING,c,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var i=s._getLocalStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(h.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(h.WARNING,g,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(o.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(o.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(h.WARNING,u,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var i=s._getSessionStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(h.WARNING,p,"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(h.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(h.WARNING,E,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,i){var o="",r="";i&&(o=";domain="+i),s.document.location&&"https:"===s.document.location.protocol&&(r=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+o+";path=/"+r)},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 i=t+"=",o=s.document.cookie.split(";"),r=0;r<o.length;r++){var a=o[r];if((a=s.trim(a))&&0===a.indexOf(i)){n=a.substring(i.length,o[r].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,i=""+Math.floor(e/6e4)%60,o=""+Math.floor(e/36e5)%24,r=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,i=i.length<2?"0"+i:i,(0<r?r+".":"")+(o=o.length<2?"0"+o:o)+":"+i+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,i,o){return("Script error."===e||"Script error"===e)&&!o},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}(),O=function(){function i(){}return i.parseUrl=function(e){return i.htmlAnchorElement||(i.htmlAnchorElement=i.document.createElement?i.document.createElement("a"):{}),i.htmlAnchorElement.href=e,i.htmlAnchorElement},i.getAbsoluteUrl=function(e){var t,n=i.parseUrl(e);return n&&(t=n.href),t},i.getPathName=function(e){var t,n=i.parseUrl(e);return n&&(t=n.pathname),t},i.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},i.document="undefined"!=typeof document?document:{},i}(),z=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,i){var o,r;if(t&&0<t.length){var a=O.parseUrl(t);if(o=a.host,null!=a.pathname)"/"!==(i=0===a.pathname.length?"/":a.pathname).charAt(0)&&(i="/"+i),r=k.sanitizeString(e,n?n+" "+i:i);else r=k.sanitizeString(e,t)}else r=o=i;return{target:o,name:r}},e}(),P=function(){function e(){}return 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||r.isNullOrUndefined(e)||r.isNullOrUndefined(t)||(n=t-e),n},e}(),G=function(e,t){return(G=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 q(e,t){function n(){this.constructor=e}G(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var V,j,H=function(e){function t(){return e.call(this)||this}return q(t,e),t}(function(){}),X=(function(o){function e(e,t,n){var i=o.call(this)||this;return i.name=k.sanitizeString(e,n)||R.NotSpecified,i.data=t,i.time=R.toISOStringForIE8(new Date),i.aiDataContract={time:m.Required,iKey:m.Required,name:m.Required,sampleRate:function(){return 100==i.sampleRate?m.Hidden:m.Required},tags:m.Required,data:m.Required},i}q(e,o)}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),function(){}),W=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return q(e,t),e}(X),B=(function(r){function e(e,t,n,i){var o=r.call(this)||this;return o.aiDataContract={ver:m.Required,name:m.Required,properties:m.Default,measurements:m.Default},o.name=k.sanitizeString(e,t)||R.NotSpecified,o.properties=k.sanitizeProperties(e,n),o.measurements=k.sanitizeMeasurements(e,i),o}q(e,r),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData"}(W),function(){}),F=function(){this.hasFullStack=!0,this.parsedStack=[]},K=(function(a){function e(e,t,n,i,o){var r=a.call(this)||this;return r.aiDataContract={ver:m.Required,exceptions:m.Required,severityLevel:m.Default,properties:m.Default,measurements:m.Default},r.properties=k.sanitizeProperties(e,n),r.measurements=k.sanitizeMeasurements(e,i),r.exceptions=[new K(e,t)],o&&(r.severityLevel=o),r}q(e,a),e.CreateSimpleException=function(e,t,n,i,o,r){return{exceptions:[{hasFullStack:!0,message:e,stack:o,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData"}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return q(e,t),e}(X)),function(o){function e(e,t){var n=o.call(this)||this;n.aiDataContract={id:m.Default,outerId:m.Default,typeName:m.Required,message:m.Required,hasFullStack:m.Default,stack:m.Default,parsedStack:m.Array},n.typeName=k.sanitizeString(e,t.name)||R.NotSpecified,n.message=k.sanitizeMessage(e,t.message)||R.NotSpecified;var i=t.stack;return n.parsedStack=n.parseStack(i),n.stack=k.sanitizeException(e,i),n.hasFullStack=R.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return q(e,o),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var i=0,o=0,r=0;r<=n.length;r++){var a=n[r];if(Q.regex.test(a)){var s=new Q(n[r],i++);o+=s.sizeInBytes,t.push(s)}}if(32768<o)for(var c=0,u=t.length-1,l=0,p=c,g=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var d=g-p+1;t.splice(p,d);break}p=c,g=u,c++,u--}}return t},e}(F)),Q=function(o){function r(e,t){var n=o.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:m.Required,method:m.Required,assembly:m.Default,fileName:m.Default,line:m.Default},n.level=t,n.method="<no_method>",n.assembly=R.trim(e);var i=e.match(r.regex);return i&&5<=i.length&&(n.method=R.trim(i[2])||n.method,n.fileName=R.trim(i[4]),n.line=parseInt(i[5])||0),n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=r.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}return q(r,o),r.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,r.baseSize=58,r}(B),J=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return q(e,t),e}(X);(j=V||(V={}))[j.Measurement=0]="Measurement",j[j.Aggregation=1]="Aggregation";var Y,$,Z=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:m.Required,kind:m.Default,value:m.Required,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default},e}return q(e,t),e}(function(){this.kind=V.Measurement}),ee=(function(u){function e(e,t,n,i,o,r,a){var s=u.call(this)||this;s.aiDataContract={ver:m.Required,metrics:m.Required,properties:m.Default};var c=new Z;return c.count=0<i?i:void 0,c.max=isNaN(r)||null===r?void 0:r,c.min=isNaN(o)||null===o?void 0:o,c.name=k.sanitizeString(e,t)||R.NotSpecified,c.value=n,s.metrics=[c],s.properties=k.sanitizeProperties(e,a),s}q(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData"}(J),function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return q(e,t),e}(W)),te=function(c){function e(e,t,n,i,o,r,a){var s=c.call(this)||this;return s.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,properties:m.Default,measurements:m.Default,id:m.Default},s.id=k.sanitizeId(e,a),s.url=k.sanitizeUrl(e,n),s.name=k.sanitizeString(e,t)||R.NotSpecified,isNaN(i)||(s.duration=R.msToTimeSpan(i)),s.properties=k.sanitizeProperties(e,o),s.measurements=k.sanitizeMeasurements(e,r),s}return q(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(ee);(function(d){function e(e,t,n,i,o,r,a,s,c,u,l){void 0===c&&(c="Ajax");var p=d.call(this)||this;p.aiDataContract={id:m.Required,ver:m.Required,name:m.Default,resultCode:m.Default,duration:m.Default,success:m.Default,data:m.Default,target:m.Default,type:m.Default,properties:m.Default,measurements:m.Default,kind:m.Default,value:m.Default,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default,dependencyKind:m.Default,dependencySource:m.Default,commandName:m.Default,dependencyTypeName:m.Default},p.id=t,p.duration=R.msToTimeSpan(o),p.success=r,p.resultCode=a+"",p.type=k.sanitizeString(e,c),p.data=k.sanitizeUrl(e,i);var g=z.ParseDependencyPath(e,n,s,i);return p.target=g.target,p.name=g.name,p.properties=k.sanitizeProperties(e,u),p.measurements=k.sanitizeMeasurements(e,l),p}q(e,d),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData"})(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return q(e,t),e}(X)),function(r){function e(e,t,n,i){var o=r.call(this)||this;return o.aiDataContract={ver:m.Required,message:m.Required,severityLevel:m.Default,properties:m.Default},t=t||R.NotSpecified,o.message=k.sanitizeMessage(e,t),o.properties=k.sanitizeProperties(e,i),n&&(o.severityLevel=n),o}q(e,r),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData"}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return q(e,t),e}(X)),function(d){function f(e,t,n,i,o,r){var a=d.call(this)||this;a.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,perfTotal:m.Default,networkConnect:m.Default,sentRequest:m.Default,receivedResponse:m.Default,domProcessing:m.Default,properties:m.Default,measurements:m.Default},a.isValid=!1;var s=f.getPerformanceTiming();if(s){var c=f.getDuration(s.navigationStart,s.loadEventEnd),u=f.getDuration(s.navigationStart,s.connectEnd),l=f.getDuration(s.requestStart,s.responseStart),p=f.getDuration(s.responseStart,s.responseEnd),g=f.getDuration(s.responseEnd,s.loadEventEnd);0==c?e.throwInternal(h.WARNING,S,"error calculating page view performance.",{total:c,network:u,request:l,response:p,dom:g}):f.shouldCollectDuration(c,u,l,p,g)?c<Math.floor(u)+Math.floor(l)+Math.floor(p)+Math.floor(g)?e.throwInternal(h.WARNING,v,"client performance math error.",{total:c,network:u,request:l,response:p,dom:g}):(a.durationMs=c,a.perfTotal=a.duration=R.msToTimeSpan(c),a.networkConnect=R.msToTimeSpan(u),a.sentRequest=R.msToTimeSpan(l),a.receivedResponse=R.msToTimeSpan(p),a.domProcessing=R.msToTimeSpan(g),a.isValid=!0):e.throwInternal(h.WARNING,w,"Invalid page load duration value. Browser perf data won't be sent.",{total:c,network:u,request:l,response:p,dom:g})}return a.url=k.sanitizeUrl(e,n),a.name=k.sanitizeString(e,t)||R.NotSpecified,a.properties=k.sanitizeProperties(e,o),a.measurements=k.sanitizeMeasurements(e,r),a}q(f,d),f.prototype.getIsValid=function(){return this.isValid},f.prototype.getDurationMs=function(){return this.durationMs},f.getPerformanceTiming=function(){return f.isPerformanceTimingSupported()?window.performance.timing:null},f.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},f.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},f.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},f.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],i=navigator.userAgent,o=!1;if(i)for(var r=0;r<n.length;r++)o=o||-1!==i.toLowerCase().indexOf(n[r]);if(o)return!1;for(var a=0;a<e.length;a++)if(e[a]>=f.MAX_DURATION_ALLOWED)return!1;return!0},f.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",f.dataType="PageviewPerformanceData",f.MAX_DURATION_ALLOWED=36e5}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return q(e,t),e}(ee)),function(i){function e(e,t){var n=i.call(this)||this;return n.aiDataContract={baseType:m.Required,baseData:m.Required},n.baseType=e,n.baseData=t,n}q(e,i)}(H);($=Y||(Y={}))[$.Verbose=0]="Verbose",$[$.Information=1]="Information",$[$.Warning=2]="Warning",$[$.Error=3]="Error",$[$.Critical=4]="Critical";var ne=function(){function e(){}return e.getConfig=function(e,t,n,i){var o;return void 0===i&&(i=!1),o=n&&e.extensionConfig&&e.extensionConfig[n]&&!r.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],r.isNullOrUndefined(o)?i:o},e}(),ie=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"},oe=function(){function e(){}return e.domain="domain",e.browser="web.browser",e.browserVer="web.browserVer",e.browserLang="web.browserLang",e.userConsent="web.userConsent",e.isManual="web.isManual",e.screenRes="web.screenRes",e}(),re=function(){function e(){}return e.localId="device.localId",e.model="device.model",e.deviceType="device.class",e}(),ae=function(){function e(){}return e.sessionId="app.sesId",e}(),se=function(){function e(){}return e.id="user.id",e.authId="authId",e.localId="localId",e}(),ce=function(){function e(){}return e.accountId="user.accountId",e}(),ue=function(){function e(){}return e.clientIp="ingest.clientIp",e}(),le=function(){function e(){}return e.deviceOS="os.name",e}(),pe=new ie,ge=function(){},de=function(){function i(e,t){r.isNullOrUndefined(t)?this._logger=new L:this._logger=t,e||(e={}),"function"!=typeof e.sessionExpirationMs&&(e.sessionExpirationMs=function(){return i.acquisitionSpan}),"function"!=typeof e.sessionRenewalMs&&(e.sessionRenewalMs=function(){return i.renewalSpan}),this.config=e,this.automaticSession=new ge}return i.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var e=P.Now(),t=e-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),n=e-this.automaticSession.renewalDate>this.config.sessionRenewalMs();t||n?(this.automaticSession.isFirst=void 0,this.renew()):(!this.cookieUpdatedTimestamp||e-this.cookieUpdatedTimestamp>i.cookieUpdateInterval)&&(this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},i.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},i.prototype.initializeAutomaticSession=function(){var e=R.getCookie(this._logger,"ai_session");if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var t=R.getStorage(this._logger,"ai_session");t&&this.initializeAutomaticSessionWithData(t)}this.automaticSession.id||(this.automaticSession.isFirst=!0,this.renew())},i.prototype.initializeAutomaticSessionWithData=function(e){var t=e.split("|");0<t.length&&(this.automaticSession.id=t[0]);try{if(1<t.length){var n=+t[1];this.automaticSession.acquisitionDate=+new Date(n),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<t.length){var i=+t[2];this.automaticSession.renewalDate=+new Date(i),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(e){this._logger.throwInternal(h.CRITICAL,f,"Error parsing ai_session cookie, session will be reset: "+R.getExceptionName(e),{exception:R.dump(e)})}0==this.automaticSession.renewalDate&&this._logger.throwInternal(h.WARNING,I,"AI session renewal date is 0, session will be reset.")},i.prototype.renew=function(){var e=P.Now();this.automaticSession.id=R.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),R.canUseLocalStorage()||this._logger.throwInternal(h.WARNING,s,"Browser does not support local storage. Session durations will be inaccurate.")},i.prototype.setCookie=function(e,t,n){var i=t+this.config.sessionExpirationMs(),o=n+this.config.sessionRenewalMs(),r=new Date,a=[e,t,n];i<o?r.setTime(i):r.setTime(o);var s=this.config.cookieDomain?this.config.cookieDomain():null;R.setCookie(this._logger,"ai_session",a.join("|")+";expires="+r.toUTCString(),s),this.cookieUpdatedTimestamp=P.Now()},i.prototype.setStorage=function(e,t,n){R.setStorage(this._logger,"ai_session",[e,t,n].join("|"))},i.acquisitionSpan=864e5,i.renewalSpan=18e5,i.cookieUpdateInterval=6e4,i}(),fe=function(){},he=function(){this.id="browser",this.type="Browser"},me=function(e){this.sdkVersion=(e.sdkExtension&&e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:2.0.2-beta"},ve=function(){},Se=function(){this.id=R.newId(),window&&window.location&&window.location.pathname&&(this.name=window.location.pathname)},ye=function(){function l(e,t){this._logger=t;var n=R.getCookie(this._logger,l.userCookieName);if(n){var i=n.split(l.cookieSeparator);0<i.length&&(this.id=i[0])}if(this.config=e,!this.id){this.id=R.newId();var o=new Date,r=R.toISOStringForIE8(o);this.accountAcquisitionDate=r,o.setTime(o.getTime()+31536e6);var a=[this.id,r],s=this.config.cookieDomain?this.config.cookieDomain():void 0;R.setCookie(this._logger,l.userCookieName,a.join(l.cookieSeparator)+";expires="+o.toUTCString(),s),R.removeStorage(this._logger,"ai_session")}this.accountId=e.accountId?e.accountId():void 0;var c=R.getCookie(this._logger,l.authUserCookieName);if(c){var u=(c=decodeURI(c)).split(l.cookieSeparator);u[0]&&(this.authenticatedId=u[0]),1<u.length&&u[1]&&(this.accountId=u[1])}}return l.prototype.setAuthenticatedUserContext=function(e,t,n){if(void 0===n&&(n=!1),!this.validateUserInput(e)||t&&!this.validateUserInput(t))this._logger.throwInternal(h.WARNING,A,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{this.authenticatedId=e;var i=this.authenticatedId;t&&(this.accountId=t,i=[this.authenticatedId,this.accountId].join(l.cookieSeparator)),n&&R.setCookie(this._logger,l.authUserCookieName,encodeURI(i),this.config.cookieDomain())}},l.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,R.deleteCookie(this._logger,l.authUserCookieName)},l.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},l.cookieSeparator="|",l.userCookieName="ai_user",l.authUserCookieName="ai_authUser",l}(),Ie=function(){function i(){}return i.prototype.getHashCodeScore=function(e){return 100*(this.getHashCode(e)/i.INT_MAX_VALUE)},i.prototype.getHashCode=function(e){if(""==e)return 0;for(;e.length<i.MIN_INPUT_LENGTH;)e=e.concat(e);for(var t=5381,n=0;n<e.length;++n)t=(t<<5)+t+e.charCodeAt(n),t&=t;return Math.abs(t)},i.INT_MAX_VALUE=2147483647,i.MIN_INPUT_LENGTH=8,i}(),we=function(){function e(){this.hashCodeGeneragor=new Ie}return e.prototype.getSamplingScore=function(e){var t=new ie;return e.tags[t.userId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.userId]):e.tags[t.operationId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.operationId]):Math.random()},e}(),Ne=function(){function e(e,t){this.INT_MAX_VALUE=2147483647,r.isNullOrUndefined(t)?this._logger=new L:this._logger=t,(100<e||e<0)&&(this._logger.throwInternal(h.WARNING,x,"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.",{samplingRate:e},!0),this.sampleRate=100),this.sampleRate=e,this.samplingScoreGenerator=new we}return e.prototype.isSampledIn=function(e){return!0},e}(),_e=function(){function c(){this.priority=170,this.identifier="AppInsightsPropertiesPlugin"}return c.getDefaultConfig=function(){return{instrumentationKey:function(){},accountId:function(){return null},sessionRenewalMs:function(){return 18e5},samplingPercentage:function(){return 100},sessionExpirationMs:function(){return 864e5},cookieDomain:function(){return null},sdkExtension:function(){return null},isBrowserLinkTrackingEnabled:function(){return!1},appId:function(){return null}}},c.prototype.initialize=function(t,e,n){var i=this,o=c.getDefaultConfig();this._extensionConfig=this._extensionConfig||c.getDefaultConfig();var r=function(e){a._extensionConfig[e]=function(){return ne.getConfig(t,e,i.identifier,o[e]())}},a=this;for(var s in o)r(s);"undefined"!=typeof window&&(this._sessionManager=new de(this._extensionConfig,e.logger),this.application=new fe,this.device=new he,this.internal=new me(this._extensionConfig),this.location=new ve,this.user=new ye(this._extensionConfig,e.logger),this.operation=new Se,this.session=new ge,this.sample=new Ne(this._extensionConfig.samplingPercentage(),e.logger))},c.prototype.processTelemetry=function(e){r.isNullOrUndefined(e)||(this.sample.isSampledIn(e)&&(e.name,te.envelopeType,this.session&&"string"!=typeof this.session.id&&this._sessionManager.update(),this._processTelemetryInternal(e)),r.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e))},c.prototype.setNextPlugin=function(e){this._nextPlugin=e},c.prototype._processTelemetryInternal=function(e){this.session&&("string"==typeof this.session.id?this._applySessionContext(e,this.session):this._applySessionContext(e,this._sessionManager.automaticSession)),e.tags||(e.tags=[]),e.ctx||(e.ctx={}),this._applyApplicationContext(e,this.application),this._applyDeviceContext(e,this.device),this._applyInternalContext(e,this.internal),this._applyLocationContext(e,this.location),this._applySampleContext(e,this.sample),this._applyOperationContext(e,this.operation),this._applyUserContext(e,this.user)},c.prototype._applySessionContext=function(e,t){t&&("string"==typeof t.id&&(e.ctx[ae.sessionId]=t.id),void 0!==t.isFirst&&(e.tags[pe.sessionIsFirst]=t.isFirst))},c.prototype._applyApplicationContext=function(e,t){t&&("string"==typeof t.ver&&(e.tags[pe.applicationVersion]=t.ver),"string"==typeof t.build&&(e.tags[pe.applicationBuild]=t.build))},c.prototype._applyDeviceContext=function(e,t){t&&("string"==typeof t.id&&(e.ctx[re.localId]=t.id),"string"==typeof t.ip&&(e.ctx[ue.clientIp]=t.ip),"string"==typeof t.language&&(e.ctx[oe.browserLang]=t.language),"string"==typeof t.locale&&(e.tags[pe.deviceLocale]=t.locale),"string"==typeof t.model&&(e.ctx[re.model]=t.model),void 0!==t.network&&(e.tags[pe.deviceNetwork]=t.network),"string"==typeof t.oemName&&(e.tags[pe.deviceOEMName]=t.oemName),"string"==typeof t.os&&(e.ctx[le.deviceOS]=t.os),"string"==typeof t.osversion&&(e.tags[pe.deviceOSVersion]=t.osversion),"string"==typeof t.resolution&&(e.ctx[oe.screenRes]=t.resolution),"string"==typeof t.type&&(e.ctx[re.deviceType]=t.type))},c.prototype._applyInternalContext=function(e,t){t&&("string"==typeof t.agentVersion&&(e.tags[pe.internalAgentVersion]=t.agentVersion),"string"==typeof t.sdkVersion&&(e.tags[pe.internalSdkVersion]=t.sdkVersion))},c.prototype._applyLocationContext=function(e,t){t&&"string"==typeof t.ip&&(e.tags[pe.locationIp]=t.ip)},c.prototype._applySampleContext=function(e,t){t&&(e.tags.sampleRate=t.sampleRate)},c.prototype._applyOperationContext=function(e,t){t&&("string"==typeof t.id&&(e.tags[pe.operationId]=t.id),"string"==typeof t.name&&(e.tags[pe.operationName]=t.name),"string"==typeof t.parentId&&(e.tags[pe.operationParentId]=t.parentId),"string"==typeof t.rootId&&(e.tags[pe.operationRootId]=t.rootId),"string"==typeof t.syntheticSource&&(e.tags[pe.operationSyntheticSource]=t.syntheticSource))},c.prototype._applyUserContext=function(e,t){if(t){if(e.tags||(e.tags=[]),"string"==typeof t.agent){var n=t.agent;e.tags.push({ky:n})}if("string"==typeof t.storeRegion){n=t.storeRegion;e.tags.push({ky:n})}if("string"==typeof t.accountId){var i={};i[ce.accountId]=t.accountId,e.tags.push(i)}"string"==typeof t.id&&(e.ctx[se.id]=t.id),"string"==typeof t.authenticatedId&&(e.ctx[se.authId]=t.authenticatedId)}},c}();e.PropertiesPlugin=_e,e.Operation=Se,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var d,t,r=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(i,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),i=/[xy]/g;(t=d||(d={}))[t.CRITICAL=1]="CRITICAL",t[t.WARNING=2]="WARNING";var o,n,m,a,s=0,c=1,u=2,l=3,p=4,h=5,g=6,v=8,f=9,S=10,x=23,y=27,I=45,N=52,w=56,D=57,E=58,_=60,A=61,C=66,T=68,b=69,M=function(){function r(e,t,i,n){void 0===i&&(i=!1),this.messageId=e,this.message=(i?r.AiUserActionablePrefix:r.AiNonUserActionablePrefix)+e;var o=(t?" message:"+r.sanitizeDiagnosticText(t):"")+(n?" props:"+r.sanitizeDiagnosticText(JSON.stringify(n)):"");this.message+=o}return r.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},r.dataType="MessageData",r.AiNonUserActionablePrefix="AI (Internal): ",r.AiUserActionablePrefix="AI: ",r}(),U=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},r.isNullOrUndefined(e)||(r.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),r.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),r.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),r.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,i,n,o){void 0===o&&(o=!1);var r=new M(t,i,o,n);if(this.enableDebugExceptions())throw r;if(void 0!==r&&r&&void 0!==r.message){if(o){var a=+r.messageId;(!this._messageLogged[a]||this.consoleLoggingLevel()>=d.WARNING)&&(this.warnToConsole(r.message),this._messageLogged[a]=!0)}else this.consoleLoggingLevel()>=d.WARNING&&this.warnToConsole(r.message);this.logInternalMessage(e,r)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var i=!0,n=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[n]?i=!1:this._messageLogged[n]=!0,i&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",r=new M(x,o,!1);this.queue.push(r),this.warnToConsole(o)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),k=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=k}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(i,n,o){var r=this;if(this.channelQueue=new Array,i.channels){var a=void 0;i.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<k&&(a=e.identifier),e.initialize(i,n,o)}),a)throw Error(L+a);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);r.channelQueue.push(e)}})}for(var e=new Array,t=0;t<o.length;t++){var s=o[t];s.priority>k&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(i,n,o)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}}(),500),L="Channel has invalid priority";(n=o||(o={}))[n.LocalStorage=0]="LocalStorage",n[n.SessionStorage=1]="SessionStorage",(a=m||(m={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var R=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,i){var n=t.length,o=s.sanitizeKey(e,t);if(o.length!==n){for(var r=0,a=o;void 0!==i[a];)r++,a=o.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(r);o=a}return o},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(d.WARNING,D,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),t},s.sanitizeString=function(e,t,i){return void 0===i&&(i=s.MAX_STRING_LENGTH),t&&(i=i||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>i&&(t=t.toString().substring(0,i),e.throwInternal(d.WARNING,A,"string value is too long. It has been truncated to "+i+" characters.",{value:t},!0))),t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,C)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(d.WARNING,w,"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(d.WARNING,N,"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 i={};for(var n in t){var o=s.sanitizeString(e,t[n],s.MAX_PROPERTY_LENGTH);i[n=s.sanitizeKeyAndAddUniqueness(e,n,i)]=o}t=i}return t},s.sanitizeMeasurements=function(e,t){if(t){var i={};for(var n in t){var o=t[n];i[n=s.sanitizeKeyAndAddUniqueness(e,n,i)]=o}t=i}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,b).toString():t},s.sanitizeInput=function(e,t,i,n){return t&&(t=s.trim(t)).length>i&&(t=t.substring(0,i),e.throwInternal(d.WARNING,n,"input is too long, it has been truncated to "+i+" 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}(),O=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(o.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,i,n=null;try{if("undefined"==typeof window)return null;i=new Date,(n=e===o.LocalStorage?window.localStorage:window.sessionStorage).setItem(i,i),t=n.getItem(i)!=i,n.removeItem(i),t&&(n=null)}catch(e){n=null}return n},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(o.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var i=s._getLocalStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(d.WARNING,c,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,i){var n=s._getLocalStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(d.WARNING,l,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var i=s._getLocalStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(d.WARNING,h,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(o.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(o.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 i=s._getSessionStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(d.WARNING,u,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,i){var n=s._getSessionStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(d.WARNING,p,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var i=s._getSessionStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(d.WARNING,g,"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(d.WARNING,T,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,i,n){var o="",r="";n&&(o=";domain="+n),s.document.location&&"https:"===s.document.location.protocol&&(r=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+i+o+";path=/"+r)},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 i="";if(t&&t.length)for(var n=t+"=",o=s.document.cookie.split(";"),r=0;r<o.length;r++){var a=o[r];if((a=s.trim(a))&&0===a.indexOf(n)){i=a.substring(n.length,o[r].length);break}}return i}},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,i=""+Math.floor(e/1e3)%60,n=""+Math.floor(e/6e4)%60,o=""+Math.floor(e/36e5)%24,r=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,i=i.length<2?"0"+i:i,n=n.length<2?"0"+n:n,(0<r?r+".":"")+(o=o.length<2?"0"+o:o)+":"+n+":"+i+"."+t},s.isCrossOriginError=function(e,t,i,n,o){return("Script error."===e||"Script error"===e)&&!o},s.dump=function(e){var t=Object.prototype.toString.call(e),i=JSON.stringify(e);return"[object Error]"===t&&(i="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+i},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 i="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(i,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}(),P=function(){function n(){}return n.parseUrl=function(e){return n.htmlAnchorElement||(n.htmlAnchorElement=n.document.createElement?n.document.createElement("a"):{}),n.htmlAnchorElement.href=e,n.htmlAnchorElement},n.getAbsoluteUrl=function(e){var t,i=n.parseUrl(e);return i&&(t=i.href),t},n.getPathName=function(e){var t,i=n.parseUrl(e);return i&&(t=i.pathname),t},n.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},n.document="undefined"!=typeof document?document:{},n}(),z=function(){function e(){}return e.ParseDependencyPath=function(e,t,i,n){var o,r;if(t&&0<t.length){var a=P.parseUrl(t);if(o=a.host,null!=a.pathname)"/"!==(n=0===a.pathname.length?"/":a.pathname).charAt(0)&&(n="/"+n),r=R.sanitizeString(e,i?i+" "+n:n);else r=R.sanitizeString(e,t)}else r=o=n;return{target:o,name:r}},e}(),G=function(){function e(){}return 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 i=null;return 0===e||0===t||r.isNullOrUndefined(e)||r.isNullOrUndefined(t)||(i=t-e),i},e}(),q=function(e,t){return(q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function V(e,t){function i(){this.constructor=e}q(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var j,W,H=function(e){function t(){return e.call(this)||this}return V(t,e),t}(function(){}),X=(function(o){function e(e,t,i){var n=o.call(this)||this;return n.name=R.sanitizeString(e,i)||O.NotSpecified,n.data=t,n.time=O.toISOStringForIE8(new Date),n.aiDataContract={time:m.Required,iKey:m.Required,name:m.Required,sampleRate:function(){return 100==n.sampleRate?m.Hidden:m.Required},tags:m.Required,data:m.Required},n}V(e,o)}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),function(){}),B=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return V(e,t),e}(X),K=(function(r){function e(e,t,i,n){var o=r.call(this)||this;return o.aiDataContract={ver:m.Required,name:m.Required,properties:m.Default,measurements:m.Default},o.name=R.sanitizeString(e,t)||O.NotSpecified,o.properties=R.sanitizeProperties(e,i),o.measurements=R.sanitizeMeasurements(e,n),o}V(e,r),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData"}(B),function(){}),F=function(){this.hasFullStack=!0,this.parsedStack=[]},Q=(function(a){function e(e,t,i,n,o){var r=a.call(this)||this;return r.aiDataContract={ver:m.Required,exceptions:m.Required,severityLevel:m.Default,properties:m.Default,measurements:m.Default},r.properties=R.sanitizeProperties(e,i),r.measurements=R.sanitizeMeasurements(e,n),r.exceptions=[new Q(e,t)],o&&(r.severityLevel=o),r}V(e,a),e.CreateSimpleException=function(e,t,i,n,o,r){return{exceptions:[{hasFullStack:!0,message:e,stack:o,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData"}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return V(e,t),e}(X)),function(o){function e(e,t){var i=o.call(this)||this;i.aiDataContract={id:m.Default,outerId:m.Default,typeName:m.Required,message:m.Required,hasFullStack:m.Default,stack:m.Default,parsedStack:m.Array},i.typeName=R.sanitizeString(e,t.name)||O.NotSpecified,i.message=R.sanitizeMessage(e,t.message)||O.NotSpecified;var n=t.stack;return i.parsedStack=i.parseStack(n),i.stack=R.sanitizeException(e,n),i.hasFullStack=O.isArray(i.parsedStack)&&0<i.parsedStack.length,i}return V(e,o),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var i=e.split("\n");t=[];for(var n=0,o=0,r=0;r<=i.length;r++){var a=i[r];if(J.regex.test(a)){var s=new J(i[r],n++);o+=s.sizeInBytes,t.push(s)}}if(32768<o)for(var c=0,u=t.length-1,l=0,p=c,h=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var g=h-p+1;t.splice(p,g);break}p=c,h=u,c++,u--}}return t},e}(F)),J=function(o){function r(e,t){var i=o.call(this)||this;i.sizeInBytes=0,i.aiDataContract={level:m.Required,method:m.Required,assembly:m.Default,fileName:m.Default,line:m.Default},i.level=t,i.method="<no_method>",i.assembly=O.trim(e);var n=e.match(r.regex);return n&&5<=n.length&&(i.method=O.trim(n[2])||i.method,i.fileName=O.trim(n[4]),i.line=parseInt(n[5])||0),i.sizeInBytes+=i.method.length,i.sizeInBytes+=i.fileName.length,i.sizeInBytes+=i.assembly.length,i.sizeInBytes+=r.baseSize,i.sizeInBytes+=i.level.toString().length,i.sizeInBytes+=i.line.toString().length,i}return V(r,o),r.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,r.baseSize=58,r}(K),Y=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return V(e,t),e}(X);(W=j||(j={}))[W.Measurement=0]="Measurement",W[W.Aggregation=1]="Aggregation";var $,Z,ee=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:m.Required,kind:m.Default,value:m.Required,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default},e}return V(e,t),e}(function(){this.kind=j.Measurement}),te=(function(u){function e(e,t,i,n,o,r,a){var s=u.call(this)||this;s.aiDataContract={ver:m.Required,metrics:m.Required,properties:m.Default};var c=new ee;return c.count=0<n?n:void 0,c.max=isNaN(r)||null===r?void 0:r,c.min=isNaN(o)||null===o?void 0:o,c.name=R.sanitizeString(e,t)||O.NotSpecified,c.value=i,s.metrics=[c],s.properties=R.sanitizeProperties(e,a),s}V(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData"}(Y),function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return V(e,t),e}(B)),ie=function(c){function e(e,t,i,n,o,r,a){var s=c.call(this)||this;return s.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,properties:m.Default,measurements:m.Default,id:m.Default},s.id=R.sanitizeId(e,a),s.url=R.sanitizeUrl(e,i),s.name=R.sanitizeString(e,t)||O.NotSpecified,isNaN(n)||(s.duration=O.msToTimeSpan(n)),s.properties=R.sanitizeProperties(e,o),s.measurements=R.sanitizeMeasurements(e,r),s}return V(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(te);(function(g){function e(e,t,i,n,o,r,a,s,c,u,l){void 0===c&&(c="Ajax");var p=g.call(this)||this;p.aiDataContract={id:m.Required,ver:m.Required,name:m.Default,resultCode:m.Default,duration:m.Default,success:m.Default,data:m.Default,target:m.Default,type:m.Default,properties:m.Default,measurements:m.Default,kind:m.Default,value:m.Default,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default,dependencyKind:m.Default,dependencySource:m.Default,commandName:m.Default,dependencyTypeName:m.Default},p.id=t,p.duration=O.msToTimeSpan(o),p.success=r,p.resultCode=a+"",p.type=R.sanitizeString(e,c),p.data=R.sanitizeUrl(e,n);var h=z.ParseDependencyPath(e,i,s,n);return p.target=h.target,p.name=h.name,p.properties=R.sanitizeProperties(e,u),p.measurements=R.sanitizeMeasurements(e,l),p}V(e,g),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData"})(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return V(e,t),e}(X)),function(r){function e(e,t,i,n){var o=r.call(this)||this;return o.aiDataContract={ver:m.Required,message:m.Required,severityLevel:m.Default,properties:m.Default},t=t||O.NotSpecified,o.message=R.sanitizeMessage(e,t),o.properties=R.sanitizeProperties(e,n),i&&(o.severityLevel=i),o}V(e,r),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData"}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return V(e,t),e}(X)),function(g){function f(e,t,i,n,o,r){var a=g.call(this)||this;a.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,perfTotal:m.Default,networkConnect:m.Default,sentRequest:m.Default,receivedResponse:m.Default,domProcessing:m.Default,properties:m.Default,measurements:m.Default},a.isValid=!1;var s=f.getPerformanceTiming();if(s){var c=f.getDuration(s.navigationStart,s.loadEventEnd),u=f.getDuration(s.navigationStart,s.connectEnd),l=f.getDuration(s.requestStart,s.responseStart),p=f.getDuration(s.responseStart,s.responseEnd),h=f.getDuration(s.responseEnd,s.loadEventEnd);0==c?e.throwInternal(d.WARNING,S,"error calculating page view performance.",{total:c,network:u,request:l,response:p,dom:h}):f.shouldCollectDuration(c,u,l,p,h)?c<Math.floor(u)+Math.floor(l)+Math.floor(p)+Math.floor(h)?e.throwInternal(d.WARNING,v,"client performance math error.",{total:c,network:u,request:l,response:p,dom:h}):(a.durationMs=c,a.perfTotal=a.duration=O.msToTimeSpan(c),a.networkConnect=O.msToTimeSpan(u),a.sentRequest=O.msToTimeSpan(l),a.receivedResponse=O.msToTimeSpan(p),a.domProcessing=O.msToTimeSpan(h),a.isValid=!0):e.throwInternal(d.WARNING,I,"Invalid page load duration value. Browser perf data won't be sent.",{total:c,network:u,request:l,response:p,dom:h})}return a.url=R.sanitizeUrl(e,i),a.name=R.sanitizeString(e,t)||O.NotSpecified,a.properties=R.sanitizeProperties(e,o),a.measurements=R.sanitizeMeasurements(e,r),a}V(f,g),f.prototype.getIsValid=function(){return this.isValid},f.prototype.getDurationMs=function(){return this.durationMs},f.getPerformanceTiming=function(){return f.isPerformanceTimingSupported()?window.performance.timing:null},f.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},f.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},f.getDuration=function(e,t){var i=void 0;return isNaN(e)||isNaN(t)||(i=Math.max(t-e,0)),i},f.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=["googlebot","adsbot-google","apis-google","mediapartners-google"],n=navigator.userAgent,o=!1;if(n)for(var r=0;r<i.length;r++)o=o||-1!==n.toLowerCase().indexOf(i[r]);if(o)return!1;for(var a=0;a<e.length;a++)if(e[a]>=f.MAX_DURATION_ALLOWED)return!1;return!0},f.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",f.dataType="PageviewPerformanceData",f.MAX_DURATION_ALLOWED=36e5}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return V(e,t),e}(te)),function(n){function e(e,t){var i=n.call(this)||this;return i.aiDataContract={baseType:m.Required,baseData:m.Required},i.baseType=e,i.baseData=t,i}V(e,n)}(H);(Z=$||($={}))[Z.Verbose=0]="Verbose",Z[Z.Information=1]="Information",Z[Z.Warning=2]="Warning",Z[Z.Error=3]="Error",Z[Z.Critical=4]="Critical";var ne=function(){function e(){}return e.getConfig=function(e,t,i,n){var o;return void 0===n&&(n=!1),o=i&&e.extensionConfig&&e.extensionConfig[i]&&!r.isNullOrUndefined(e.extensionConfig[i][t])?e.extensionConfig[i][t]:e[t],r.isNullOrUndefined(o)?n:o},e}(),oe=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"},re=function(){function e(){}return e.UserExt="user",e.DeviceExt="device",e.TraceExt="trace",e.WebExt="web",e.AppExt="app",e.OSExt="os",e.SessionExt="ses",e.SDKExt="sdk",e}(),ae=function(){function e(){}return e.libVer="libVer",e}(),se=new oe,ce=function(){},ue=function(){function n(e,t){var i=this;r.isNullOrUndefined(t)?this._logger=new U:this._logger=t,e||(e={}),"function"!=typeof e.sessionExpirationMs&&(e.sessionExpirationMs=function(){return n.acquisitionSpan}),"function"!=typeof e.sessionRenewalMs&&(e.sessionRenewalMs=function(){return n.renewalSpan}),this.config=e,this._storageNamePrefix=function(){return i.config.namePrefix&&i.config.namePrefix()?n.cookieNameConst+i.config.namePrefix():n.cookieNameConst},this.automaticSession=new ce}return n.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var e=G.Now(),t=e-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),i=e-this.automaticSession.renewalDate>this.config.sessionRenewalMs();t||i?this.renew():(!this.cookieUpdatedTimestamp||e-this.cookieUpdatedTimestamp>n.cookieUpdateInterval)&&(this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},n.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},n.prototype.initializeAutomaticSession=function(){var e=O.getCookie(this._logger,this._storageNamePrefix());if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var t=O.getStorage(this._logger,this._storageNamePrefix());t&&this.initializeAutomaticSessionWithData(t)}this.automaticSession.id||this.renew()},n.prototype.initializeAutomaticSessionWithData=function(e){var t=e.split("|");0<t.length&&(this.automaticSession.id=t[0]);try{if(1<t.length){var i=+t[1];this.automaticSession.acquisitionDate=+new Date(i),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<t.length){var n=+t[2];this.automaticSession.renewalDate=+new Date(n),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(e){this._logger.throwInternal(d.CRITICAL,f,"Error parsing ai_session cookie, session will be reset: "+O.getExceptionName(e),{exception:O.dump(e)})}0==this.automaticSession.renewalDate&&this._logger.throwInternal(d.WARNING,y,"AI session renewal date is 0, session will be reset.")},n.prototype.renew=function(){var e=G.Now();this.automaticSession.id=O.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),O.canUseLocalStorage()||this._logger.throwInternal(d.WARNING,s,"Browser does not support local storage. Session durations will be inaccurate.")},n.prototype.setCookie=function(e,t,i){var n=t+this.config.sessionExpirationMs(),o=i+this.config.sessionRenewalMs(),r=new Date,a=[e,t,i];n<o?r.setTime(n):r.setTime(o);var s=this.config.cookieDomain?this.config.cookieDomain():null;O.setCookie(this._logger,this._storageNamePrefix(),a.join("|")+";expires="+r.toUTCString(),s),this.cookieUpdatedTimestamp=G.Now()},n.prototype.setStorage=function(e,t,i){O.setStorage(this._logger,this._storageNamePrefix(),[e,t,i].join("|"))},n.acquisitionSpan=864e5,n.renewalSpan=18e5,n.cookieUpdateInterval=6e4,n.cookieNameConst="ai_session",n}(),le=function(){},pe=function(){this.id="browser",this.deviceClass="Browser"},he=function(e){this.sdkVersion=(e.sdkExtension&&e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:2.0.2-beta"},ge=function(){function n(){}return n.prototype.getHashCodeScore=function(e){return 100*(this.getHashCode(e)/n.INT_MAX_VALUE)},n.prototype.getHashCode=function(e){if(""==e)return 0;for(;e.length<n.MIN_INPUT_LENGTH;)e=e.concat(e);for(var t=5381,i=0;i<e.length;++i)t=(t<<5)+t+e.charCodeAt(i),t&=t;return Math.abs(t)},n.INT_MAX_VALUE=2147483647,n.MIN_INPUT_LENGTH=8,n}(),fe=function(){function e(){this.hashCodeGeneragor=new ge}return e.prototype.getSamplingScore=function(e){var t=new oe;return e.tags[t.userId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.userId]):e.tags[t.operationId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.operationId]):Math.random()},e}(),de=function(){function e(e,t){this.INT_MAX_VALUE=2147483647,r.isNullOrUndefined(t)?this._logger=new U:this._logger=t,(100<e||e<0)&&(this._logger.throwInternal(d.WARNING,E,"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.",{samplingRate:e},!0),this.sampleRate=100),this.sampleRate=e,this.samplingScoreGenerator=new fe}return e.prototype.isSampledIn=function(e){return!0},e}(),me=function(){function p(e,t){this._logger=t;var i=O.getCookie(this._logger,p.userCookieName);if(i){var n=i.split(p.cookieSeparator);0<n.length&&(this.id=n[0])}if(this.config=e,!this.id){this.id=O.newId();var o=new Date,r=O.toISOStringForIE8(o);this.accountAcquisitionDate=r,o.setTime(o.getTime()+31536e6);var a=[this.id,r],s=this.config.cookieDomain?this.config.cookieDomain():void 0;O.setCookie(this._logger,p.userCookieName,a.join(p.cookieSeparator)+";expires="+o.toUTCString(),s);var c=e.namePrefix&&e.namePrefix()?e.namePrefix()+"ai_session":"ai_session";O.removeStorage(this._logger,c)}this.accountId=e.accountId?e.accountId():void 0;var u=O.getCookie(this._logger,p.authUserCookieName);if(u){var l=(u=decodeURI(u)).split(p.cookieSeparator);l[0]&&(this.authenticatedId=l[0]),1<l.length&&l[1]&&(this.accountId=l[1])}}return p.prototype.setAuthenticatedUserContext=function(e,t,i){if(void 0===i&&(i=!1),!this.validateUserInput(e)||t&&!this.validateUserInput(t))this._logger.throwInternal(d.WARNING,_,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{this.authenticatedId=e;var n=this.authenticatedId;t&&(this.accountId=t,n=[this.authenticatedId,this.accountId].join(p.cookieSeparator)),i&&O.setCookie(this._logger,p.authUserCookieName,encodeURI(n),this.config.cookieDomain())}},p.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,O.deleteCookie(this._logger,p.authUserCookieName)},p.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},p.cookieSeparator="|",p.userCookieName="ai_user",p.authUserCookieName="ai_authUser",p}(),ve=function(){},Se=function(e,t,i){this.traceID=e||O.newId(),this.parentID=t,this.name=i},xe=function(){function e(e,t){"undefined"!=typeof window&&(this.sessionManager=new ue(t,e),this.application=new le,this.device=new pe,this.internal=new he(t),this.location=new ve,this.user=new me(t,e),this.telemetryTrace=new Se,this.session=new ce,this.sample=new de(t.samplingPercentage(),e))}return e.prototype.applySessionContext=function(e){var t=this.session||this.sessionManager.automaticSession;t&&"string"==typeof t.id&&(e.ext.app.sesId=t.id),this.session&&("string"==typeof this.session.id?e.ext.app.sesId=this.session.id:e.ext.app.sesId=this.sessionManager.automaticSession.id)},e.prototype.applyOperatingSystemContxt=function(e){this.os&&this.os.name&&(e.ext.os=this.os)},e.prototype.applyApplicationContext=function(e){var t,i;this.application&&("string"==typeof this.application.ver&&e.tags.push(((t={})[se.applicationVersion]=this.application.ver,t)),"string"==typeof this.application.build&&e.tags.push(((i={})[se.applicationBuild]=this.application.build,i)))},e.prototype.applyDeviceContext=function(e){this.device&&("string"==typeof this.device.id&&(e.ext.device.localId=this.device.id),"string"==typeof this.device.ip&&(e.ext.device.ip=this.device.ip),"string"==typeof this.device.model&&(e.ext.device.model=this.device.model),"string"==typeof this.device.deviceClass&&(e.ext.device.deviceClass=this.device.deviceClass))},e.prototype.applyInternalContext=function(e){var t,i,n;this.internal&&("string"==typeof this.internal.agentVersion&&e.tags.push(((t={})[se.internalAgentVersion]=this.internal.agentVersion,t)),"string"==typeof this.internal.sdkVersion?e.tags.push(((i={})[se.internalSdkVersion]=this.internal.sdkVersion,i)):e[re.SDKExt]&&e[re.SDKExt][ae.libVer]&&e.tags.push(((n={})[se.internalSdkVersion]=e[re.SDKExt][ae.libVer],n)))},e.prototype.applyLocationContext=function(e){var t;this.location&&"string"==typeof this.location.ip&&e.tags.push(((t={})[se.locationIp]=this.location.ip,t))},e.prototype.applySampleContext=function(e){this.sample&&e.tags.push({SampleRate:this.sample.sampleRate})},e.prototype.applyOperationContext=function(e){if(this.telemetryTrace){var t=e.ext.trace||{traceID:void 0,parentID:void 0};"string"==typeof this.telemetryTrace.traceID&&(t.traceID=this.telemetryTrace.traceID),"string"==typeof this.telemetryTrace.name&&(t.name=this.telemetryTrace.name),"string"==typeof this.telemetryTrace.parentID&&(t.parentID=this.telemetryTrace.parentID),e.ext.trace=t}},e.prototype.applyWebContext=function(e){this.web&&(e.ext.web=e.ext.web||{},e.ext.web=this.web)},e.prototype.applyUserContext=function(e){var t;this.user&&(e.tags||(e.tags=[]),"string"==typeof this.user.accountId&&e.tags.push(((t={})[se.userAccountId]=this.user.accountId,t)),"string"==typeof this.user.id&&(e.ext.user.id=this.user.id),"string"==typeof this.user.authenticatedId&&(e.ext.user.authId=this.user.authenticatedId))},e.prototype.cleanUp=function(e){e.ext[re.DeviceExt]&&0===Object.keys(e.ext[re.DeviceExt]).length&&delete e.ext[re.DeviceExt],e.ext[re.UserExt]&&0===Object.keys(e.ext[re.UserExt]).length&&delete e.ext[re.UserExt],e.ext[re.WebExt]&&0===Object.keys(e.ext[re.WebExt]).length&&delete e.ext[re.WebExt],e.ext[re.OSExt]&&0===Object.keys(e.ext[re.OSExt]).length&&delete e.ext[re.OSExt],e.ext[re.AppExt]&&0===Object.keys(e.ext[re.AppExt]).length&&delete e.ext[re.AppExt],e.ext[re.TraceExt]&&0===Object.keys(e.ext[re.TraceExt]).length&&delete e.ext[re.TraceExt]},e}(),ye=function(){function c(){this.priority=170,this.identifier="AppInsightsPropertiesPlugin"}return c.getDefaultConfig=function(){return{instrumentationKey:function(){},accountId:function(){return null},sessionRenewalMs:function(){return 18e5},samplingPercentage:function(){return 100},sessionExpirationMs:function(){return 864e5},cookieDomain:function(){return null},sdkExtension:function(){return null},isBrowserLinkTrackingEnabled:function(){return!1},appId:function(){return null},namePrefix:function(){}}},c.prototype.initialize=function(t,e,i){var n=this,o=c.getDefaultConfig();this._extensionConfig=this._extensionConfig||c.getDefaultConfig();var r=function(e){a._extensionConfig[e]=function(){return ne.getConfig(t,e,n.identifier,o[e]())}},a=this;for(var s in o)r(s);this._logger=e.logger,this.context=new xe(e.logger,this._extensionConfig)},c.prototype.processTelemetry=function(e){r.isNullOrUndefined(e)||(this.context.sample.isSampledIn(e)&&(e.name===ie.envelopeType&&this._logger.resetInternalMessageCount(),this.context.session&&"string"!=typeof this.context.session.id&&this.context.sessionManager.update(),this._processTelemetryInternal(e)),r.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e))},c.prototype.setNextPlugin=function(e){this._nextPlugin=e},c.prototype._processTelemetryInternal=function(e){e.tags||(e.tags=[]),e.ext||(e.ext={}),e.ext[re.DeviceExt]=e.ext[re.DeviceExt]||{},e.ext[re.WebExt]=e.ext[re.WebExt]||{},e.ext[re.UserExt]=e.ext[re.UserExt]||{},e.ext[re.OSExt]=e.ext[re.OSExt]||{},e.ext[re.AppExt]=e.ext[re.AppExt]||{},e.ext[re.TraceExt]=e.ext[re.TraceExt]||{},this.context.applySessionContext(e),this.context.applyApplicationContext(e),this.context.applyDeviceContext(e),this.context.applyOperationContext(e),this.context.applyUserContext(e),this.context.applyOperatingSystemContxt(e),this.context.applyWebContext(e),this.context.applyLocationContext(e),this.context.applySampleContext(e),this.context.applyInternalContext(e),this.context.cleanUp(e)},c}();e.PropertiesPlugin=ye,e.TelemetryTrace=Se,e.TelemetryContext=xe,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-properties-js.min.js.map |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import PropertiesPlugin from "./PropertiesPlugin"; | ||
import { Operation } from "./Context/Operation"; | ||
export { PropertiesPlugin, Operation }; | ||
import { TelemetryTrace } from "./Context/TelemetryTrace"; | ||
import { TelemetryContext } from './TelemetryContext'; | ||
export { PropertiesPlugin, TelemetryTrace, TelemetryContext }; | ||
//# sourceMappingURL=applicationinsights-properties-js.js.map |
@@ -12,3 +12,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Setting it to 'Browser' allows to separate client and server dependencies/exceptions | ||
this.type = "Browser"; | ||
this.deviceClass = "Browser"; | ||
} | ||
@@ -15,0 +15,0 @@ return Device; |
@@ -13,2 +13,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
function _SessionManager(config, logger) { | ||
var _this = this; | ||
if (CoreUtils.isNullOrUndefined(logger)) { | ||
@@ -30,2 +31,3 @@ this._logger = new DiagnosticLogger(); | ||
this.config = config; | ||
this._storageNamePrefix = function () { return _this.config.namePrefix && _this.config.namePrefix() ? _SessionManager.cookieNameConst + _this.config.namePrefix() : _SessionManager.cookieNameConst; }; | ||
this.automaticSession = new Session(); | ||
@@ -43,3 +45,2 @@ } | ||
// update automaticSession so session state has correct id | ||
this.automaticSession.isFirst = undefined; | ||
this.renew(); | ||
@@ -64,7 +65,7 @@ } | ||
/** | ||
* Use ai_session cookie data or local storage data (when the cookie is unavailable) to | ||
* Use config.namePrefix + ai_session cookie data or local storage data (when the cookie is unavailable) to | ||
* initialize the automatic session. | ||
*/ | ||
_SessionManager.prototype.initializeAutomaticSession = function () { | ||
var cookie = Util.getCookie(this._logger, 'ai_session'); | ||
var cookie = Util.getCookie(this._logger, this._storageNamePrefix()); | ||
if (cookie && typeof cookie.split === "function") { | ||
@@ -78,3 +79,3 @@ this.initializeAutomaticSessionWithData(cookie); | ||
// The User class handles this for us and deletes our local storage object if the persistent user cookie was removed. | ||
var storage = Util.getStorage(this._logger, 'ai_session'); | ||
var storage = Util.getStorage(this._logger, this._storageNamePrefix()); | ||
if (storage) { | ||
@@ -85,3 +86,2 @@ this.initializeAutomaticSessionWithData(storage); | ||
if (!this.automaticSession.id) { | ||
this.automaticSession.isFirst = true; | ||
this.renew(); | ||
@@ -145,3 +145,3 @@ } | ||
var cookieDomnain = this.config.cookieDomain ? this.config.cookieDomain() : null; | ||
Util.setCookie(this._logger, 'ai_session', cookie.join('|') + ';expires=' + cookieExpiry.toUTCString(), cookieDomnain); | ||
Util.setCookie(this._logger, this._storageNamePrefix(), cookie.join('|') + ';expires=' + cookieExpiry.toUTCString(), cookieDomnain); | ||
this.cookieUpdatedTimestamp = DateTimeUtils.Now(); | ||
@@ -153,3 +153,3 @@ }; | ||
// The server will notice this and end the sessions itself, with loss of accurate session duration | ||
Util.setStorage(this._logger, 'ai_session', [guid, acq, renewal].join('|')); | ||
Util.setStorage(this._logger, this._storageNamePrefix(), [guid, acq, renewal].join('|')); | ||
}; | ||
@@ -159,2 +159,3 @@ _SessionManager.acquisitionSpan = 86400000; // 24 hours in ms | ||
_SessionManager.cookieUpdateInterval = 60000; // 1 minute in ms | ||
_SessionManager.cookieNameConst = 'ai_session'; | ||
return _SessionManager; | ||
@@ -161,0 +162,0 @@ }()); |
@@ -29,5 +29,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
Util.setCookie(this._logger, User.userCookieName, newCookie.join(User.cookieSeparator) + ';expires=' + date.toUTCString(), cookieDomain); | ||
// If we have an ai_session in local storage this means the user actively removed our cookies. | ||
// If we have an config.namePrefix() + ai_session in local storage this means the user actively removed our cookies. | ||
// We should respect their wishes and clear ourselves from local storage | ||
Util.removeStorage(this._logger, 'ai_session'); | ||
var name_1 = config.namePrefix && config.namePrefix() ? config.namePrefix() + 'ai_session' : 'ai_session'; | ||
Util.removeStorage(this._logger, name_1); | ||
} | ||
@@ -34,0 +35,0 @@ // We still take the account id from the ctor param for backward compatibility. |
@@ -6,15 +6,8 @@ /** | ||
import { CoreUtils } from '@microsoft/applicationinsights-core-js'; | ||
import { PageView, ConfigurationManager, WebExtensionKeys, DeviceExtensionKeys, UserExtensionKeys, UserTagKeys, AppExtensionKeys, IngestExtKeys, OSExtKeys, CtxTagKeys } from '@microsoft/applicationinsights-common'; | ||
import { Session, _SessionManager } from './Context/Session'; | ||
import { Application } from './Context/Application'; | ||
import { Device } from './Context/Device'; | ||
import { Internal } from './Context/Internal'; | ||
import { Location } from './Context/Location'; | ||
import { Operation } from './Context/Operation'; | ||
import { User } from './Context/User'; | ||
import { Sample } from './Context/Sample'; | ||
import { TelemetryContext } from './TelemetryContext'; | ||
import { PageView, ConfigurationManager, PropertiesPluginIdentifier, Extensions } from '@microsoft/applicationinsights-common'; | ||
var PropertiesPlugin = /** @class */ (function () { | ||
function PropertiesPlugin() { | ||
this.priority = 170; | ||
this.identifier = "AppInsightsPropertiesPlugin"; | ||
this.identifier = PropertiesPluginIdentifier; | ||
} | ||
@@ -31,3 +24,4 @@ PropertiesPlugin.getDefaultConfig = function () { | ||
isBrowserLinkTrackingEnabled: function () { return false; }, | ||
appId: function () { return null; } | ||
appId: function () { return null; }, | ||
namePrefix: function () { return undefined; } | ||
}; | ||
@@ -47,13 +41,4 @@ return defaultConfig; | ||
} | ||
if (typeof window !== 'undefined') { | ||
this._sessionManager = new _SessionManager(this._extensionConfig, core.logger); | ||
this.application = new Application(); | ||
this.device = new Device(); | ||
this.internal = new Internal(this._extensionConfig); | ||
this.location = new Location(); | ||
this.user = new User(this._extensionConfig, core.logger); | ||
this.operation = new Operation(); | ||
this.session = new Session(); | ||
this.sample = new Sample(this._extensionConfig.samplingPercentage(), core.logger); | ||
} | ||
this._logger = core.logger; | ||
this.context = new TelemetryContext(core.logger, this._extensionConfig); | ||
}; | ||
@@ -70,12 +55,11 @@ /** | ||
// if the event is not sampled in, do not bother going through the pipeline | ||
if (this.sample.isSampledIn(event)) { | ||
if (this.context.sample.isSampledIn(event)) { | ||
// If the envelope is PageView, reset the internal message count so that we can send internal telemetry for the new page. | ||
if (event.name === PageView.envelopeType) { | ||
// TODO(barustum): resetInternalMessageCount once we have support for internal logging | ||
//_InternalLogging.resetInternalMessageCount(); | ||
this._logger.resetInternalMessageCount(); | ||
} | ||
if (this.session) { | ||
if (this.context.session) { | ||
// If customer did not provide custom session id update the session manager | ||
if (typeof this.session.id !== "string") { | ||
this._sessionManager.update(); | ||
if (typeof this.context.session.id !== "string") { | ||
this.context.sessionManager.update(); | ||
} | ||
@@ -98,11 +82,2 @@ } | ||
PropertiesPlugin.prototype._processTelemetryInternal = function (event) { | ||
if (this.session) { | ||
// If customer set id, apply his context; otherwise apply context generated from cookies | ||
if (typeof this.session.id === "string") { | ||
this._applySessionContext(event, this.session); | ||
} | ||
else { | ||
this._applySessionContext(event, this._sessionManager.automaticSession); | ||
} | ||
} | ||
// set part A fields | ||
@@ -112,141 +87,23 @@ if (!event.tags) { | ||
} | ||
if (!event.ctx) { | ||
event.ctx = {}; | ||
if (!event.ext) { | ||
event.ext = {}; | ||
} | ||
this._applyApplicationContext(event, this.application); | ||
this._applyDeviceContext(event, this.device); | ||
this._applyInternalContext(event, this.internal); | ||
this._applyLocationContext(event, this.location); | ||
this._applySampleContext(event, this.sample); | ||
this._applyOperationContext(event, this.operation); | ||
this._applyUserContext(event, this.user); | ||
event.ext[Extensions.DeviceExt] = event.ext[Extensions.DeviceExt] || {}; | ||
event.ext[Extensions.WebExt] = event.ext[Extensions.WebExt] || {}; | ||
event.ext[Extensions.UserExt] = event.ext[Extensions.UserExt] || {}; | ||
event.ext[Extensions.OSExt] = event.ext[Extensions.OSExt] || {}; | ||
event.ext[Extensions.AppExt] = event.ext[Extensions.AppExt] || {}; | ||
event.ext[Extensions.TraceExt] = event.ext[Extensions.TraceExt] || {}; | ||
this.context.applySessionContext(event); | ||
this.context.applyApplicationContext(event); | ||
this.context.applyDeviceContext(event); | ||
this.context.applyOperationContext(event); | ||
this.context.applyUserContext(event); | ||
this.context.applyOperatingSystemContxt(event); | ||
this.context.applyWebContext(event); | ||
this.context.applyLocationContext(event); // legacy tags | ||
this.context.applySampleContext(event); // legacy tags | ||
this.context.applyInternalContext(event); // legacy tags | ||
this.context.cleanUp(event); | ||
}; | ||
PropertiesPlugin.prototype._applySessionContext = function (event, sessionContext) { | ||
if (sessionContext) { | ||
if (typeof sessionContext.id === "string") { | ||
event.ctx[AppExtensionKeys.sessionId] = sessionContext.id; | ||
} | ||
if (typeof sessionContext.isFirst !== "undefined") { | ||
event.tags[CtxTagKeys.sessionIsFirst] = sessionContext.isFirst; | ||
} | ||
} | ||
}; | ||
PropertiesPlugin.prototype._applyApplicationContext = function (event, appContext) { | ||
if (appContext) { | ||
if (typeof appContext.ver === "string") { | ||
event.tags[CtxTagKeys.applicationVersion] = appContext.ver; | ||
} | ||
if (typeof appContext.build === "string") { | ||
event.tags[CtxTagKeys.applicationBuild] = appContext.build; | ||
} | ||
} | ||
}; | ||
PropertiesPlugin.prototype._applyDeviceContext = function (event, deviceContext) { | ||
if (deviceContext) { | ||
if (typeof deviceContext.id === "string") { | ||
event.ctx[DeviceExtensionKeys.localId] = deviceContext.id; | ||
} | ||
if (typeof deviceContext.ip === "string") { | ||
event.ctx[IngestExtKeys.clientIp] = deviceContext.ip; | ||
} | ||
if (typeof deviceContext.language === "string") { | ||
event.ctx[WebExtensionKeys.browserLang] = deviceContext.language; | ||
} | ||
if (typeof deviceContext.locale === "string") { | ||
event.tags[CtxTagKeys.deviceLocale] = deviceContext.locale; | ||
} | ||
if (typeof deviceContext.model === "string") { | ||
event.ctx[DeviceExtensionKeys.model] = deviceContext.model; | ||
} | ||
if (typeof deviceContext.network !== "undefined") { | ||
event.tags[CtxTagKeys.deviceNetwork] = deviceContext.network; // not mapped in CS 4.0 | ||
} | ||
if (typeof deviceContext.oemName === "string") { | ||
event.tags[CtxTagKeys.deviceOEMName] = deviceContext.oemName; // not mapped in CS 4.0 | ||
} | ||
if (typeof deviceContext.os === "string") { | ||
event.ctx[OSExtKeys.deviceOS] = deviceContext.os; | ||
} | ||
if (typeof deviceContext.osversion === "string") { | ||
event.tags[CtxTagKeys.deviceOSVersion] = deviceContext.osversion; // not mapped in CS 4.0 | ||
} | ||
if (typeof deviceContext.resolution === "string") { | ||
event.ctx[WebExtensionKeys.screenRes] = deviceContext.resolution; | ||
} | ||
if (typeof deviceContext.type === "string") { | ||
event.ctx[DeviceExtensionKeys.deviceType] = deviceContext.type; | ||
} | ||
} | ||
}; | ||
PropertiesPlugin.prototype._applyInternalContext = function (event, internalContext) { | ||
if (internalContext) { | ||
if (typeof internalContext.agentVersion === "string") { | ||
event.tags[CtxTagKeys.internalAgentVersion] = internalContext.agentVersion; // not mapped in CS 4.0 | ||
} | ||
if (typeof internalContext.sdkVersion === "string") { | ||
event.tags[CtxTagKeys.internalSdkVersion] = internalContext.sdkVersion; // not mapped in CS 4.0 | ||
} | ||
} | ||
}; | ||
PropertiesPlugin.prototype._applyLocationContext = function (event, locationContext) { | ||
if (locationContext) { | ||
if (typeof locationContext.ip === "string") { | ||
event.tags[CtxTagKeys.locationIp] = locationContext.ip; // not mapped in CS 4.0 | ||
} | ||
} | ||
}; | ||
PropertiesPlugin.prototype._applySampleContext = function (event, sampleContext) { | ||
if (sampleContext) { | ||
event.tags["sampleRate"] = sampleContext.sampleRate; // tags.sampleRate -> mapped in CS 4.0 | ||
} | ||
}; | ||
PropertiesPlugin.prototype._applyOperationContext = function (event, operationContext) { | ||
if (operationContext) { | ||
if (typeof operationContext.id === "string") { | ||
event.tags[CtxTagKeys.operationId] = operationContext.id; // not mapped in CS 4.0 | ||
} | ||
if (typeof operationContext.name === "string") { | ||
event.tags[CtxTagKeys.operationName] = operationContext.name; // not mapped in CS 4.0 | ||
} | ||
if (typeof operationContext.parentId === "string") { | ||
event.tags[CtxTagKeys.operationParentId] = operationContext.parentId; // not mapped in CS 4.0 | ||
} | ||
if (typeof operationContext.rootId === "string") { | ||
event.tags[CtxTagKeys.operationRootId] = operationContext.rootId; // not mapped in CS 4.0 | ||
} | ||
if (typeof operationContext.syntheticSource === "string") { | ||
event.tags[CtxTagKeys.operationSyntheticSource] = operationContext.syntheticSource; // not mapped in CS 4.0 | ||
} | ||
} | ||
}; | ||
PropertiesPlugin.prototype._applyUserContext = function (event, userContext) { | ||
if (userContext) { | ||
if (!event.tags) { | ||
event.tags = []; | ||
} | ||
if (typeof userContext.agent === "string") { | ||
var val = userContext.agent; | ||
var ky = CtxTagKeys.userAgent; | ||
event.tags.push({ ky: val }); // ai.user.agent stays under tags | ||
} | ||
if (typeof userContext.storeRegion === "string") { | ||
var ky = CtxTagKeys.userStoreRegion; // "ai.user.storeRegion" stays under tags | ||
var val = userContext.storeRegion; | ||
event.tags.push({ ky: val }); | ||
} | ||
// stays in tags under User extension | ||
if (typeof userContext.accountId === "string") { | ||
var item = {}; | ||
item[UserTagKeys.accountId] = userContext.accountId; | ||
event.tags.push(item); | ||
} | ||
// CS 4.0 | ||
if (typeof userContext.id === "string") { | ||
event.ctx[UserExtensionKeys.id] = userContext.id; | ||
} | ||
if (typeof userContext.authenticatedId === "string") { | ||
event.ctx[UserExtensionKeys.authId] = userContext.authenticatedId; | ||
} | ||
} | ||
}; | ||
return PropertiesPlugin; | ||
@@ -253,0 +110,0 @@ }()); |
/*! | ||
* Application Insights JavaScript SDK - Properties Plugin, 1.0.0-beta.12 | ||
* Application Insights JavaScript SDK - Properties Plugin, 2.0.0-beta.1 | ||
* 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 h,t,r=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),n=/[xy]/g;(t=h||(h={}))[t.CRITICAL=1]="CRITICAL",t[t.WARNING=2]="WARNING";var o,i,m,a,s=0,c=1,u=2,l=3,p=4,g=5,d=6,v=8,f=9,S=10,y=23,I=27,w=45,N=52,_=56,D=57,x=58,A=60,C=61,T=66,E=68,M=69,b=function(){function r(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?r.AiUserActionablePrefix:r.AiNonUserActionablePrefix)+e;var o=(t?" message:"+r.sanitizeDiagnosticText(t):"")+(i?" props:"+r.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=o}return r.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},r.dataType="MessageData",r.AiNonUserActionablePrefix="AI (Internal): ",r.AiUserActionablePrefix="AI: ",r}(),L=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},r.isNullOrUndefined(e)||(r.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),r.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),r.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),r.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,o){void 0===o&&(o=!1);var r=new b(t,n,o,i);if(this.enableDebugExceptions())throw r;if(void 0!==r&&r&&void 0!==r.message){if(o){var a=+r.messageId;(!this._messageLogged[a]||this.consoleLoggingLevel()>=h.WARNING)&&(this.warnToConsole(r.message),this._messageLogged[a]=!0)}else this.consoleLoggingLevel()>=h.WARNING&&this.warnToConsole(r.message);this.logInternalMessage(e,r)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",r=new b(y,o,!1);this.queue.push(r),this.warnToConsole(o)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),U=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=U}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,i,o){var r=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,i,o)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);r.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<o.length;t++){var a=o[t];a.priority>U&&e.push(a)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}}}(),200);(i=o||(o={}))[i.LocalStorage=0]="LocalStorage",i[i.SessionStorage=1]="SessionStorage",(a=m||(m={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var k=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,n){var i=t.length,o=s.sanitizeKey(e,t);if(o.length!==i){for(var r=0,a=o;void 0!==n[a];)r++,a=o.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(r);o=a}return o},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(h.WARNING,D,"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(h.WARNING,C,"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,T)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(h.WARNING,_,"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(h.WARNING,N,"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 i in t){var o=s.sanitizeString(e,t[i],s.MAX_PROPERTY_LENGTH);n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=o}t=n}return t},s.sanitizeMeasurements=function(e,t){if(t){var n={};for(var i in t){var o=t[i];n[i=s.sanitizeKeyAndAddUniqueness(e,i,n)]=o}t=n}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,M).toString():t},s.sanitizeInput=function(e,t,n,i){return t&&(t=s.trim(t)).length>n&&(t=t.substring(0,n),e.throwInternal(h.WARNING,i,"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}(),R=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(o.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,n,i=null;try{if("undefined"==typeof window)return null;n=new Date,(i=e===o.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=i.getItem(n)!=n,i.removeItem(n),t&&(i=null)}catch(e){i=null}return i},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(o.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(h.WARNING,c,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,n){var i=s._getLocalStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(h.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(h.WARNING,g,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(o.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(o.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(h.WARNING,u,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,n){var i=s._getSessionStorageObject();if(null!==i)try{return i.setItem(e,n),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(h.WARNING,p,"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(h.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(h.WARNING,E,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,n,i){var o="",r="";i&&(o=";domain="+i),s.document.location&&"https:"===s.document.location.protocol&&(r=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+n+o+";path=/"+r)},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 i=t+"=",o=s.document.cookie.split(";"),r=0;r<o.length;r++){var a=o[r];if((a=s.trim(a))&&0===a.indexOf(i)){n=a.substring(i.length,o[r].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,i=""+Math.floor(e/6e4)%60,o=""+Math.floor(e/36e5)%24,r=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,i=i.length<2?"0"+i:i,(0<r?r+".":"")+(o=o.length<2?"0"+o:o)+":"+i+":"+n+"."+t},s.isCrossOriginError=function(e,t,n,i,o){return("Script error."===e||"Script error"===e)&&!o},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}(),O=function(){function i(){}return i.parseUrl=function(e){return i.htmlAnchorElement||(i.htmlAnchorElement=i.document.createElement?i.document.createElement("a"):{}),i.htmlAnchorElement.href=e,i.htmlAnchorElement},i.getAbsoluteUrl=function(e){var t,n=i.parseUrl(e);return n&&(t=n.href),t},i.getPathName=function(e){var t,n=i.parseUrl(e);return n&&(t=n.pathname),t},i.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},i.document="undefined"!=typeof document?document:{},i}(),z=function(){function e(){}return e.ParseDependencyPath=function(e,t,n,i){var o,r;if(t&&0<t.length){var a=O.parseUrl(t);if(o=a.host,null!=a.pathname)"/"!==(i=0===a.pathname.length?"/":a.pathname).charAt(0)&&(i="/"+i),r=k.sanitizeString(e,n?n+" "+i:i);else r=k.sanitizeString(e,t)}else r=o=i;return{target:o,name:r}},e}(),P=function(){function e(){}return 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||r.isNullOrUndefined(e)||r.isNullOrUndefined(t)||(n=t-e),n},e}(),G=function(e,t){return(G=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 q(e,t){function n(){this.constructor=e}G(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var V,j,H=function(e){function t(){return e.call(this)||this}return q(t,e),t}(function(){}),X=(function(o){function e(e,t,n){var i=o.call(this)||this;return i.name=k.sanitizeString(e,n)||R.NotSpecified,i.data=t,i.time=R.toISOStringForIE8(new Date),i.aiDataContract={time:m.Required,iKey:m.Required,name:m.Required,sampleRate:function(){return 100==i.sampleRate?m.Hidden:m.Required},tags:m.Required,data:m.Required},i}q(e,o)}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),function(){}),W=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return q(e,t),e}(X),B=(function(r){function e(e,t,n,i){var o=r.call(this)||this;return o.aiDataContract={ver:m.Required,name:m.Required,properties:m.Default,measurements:m.Default},o.name=k.sanitizeString(e,t)||R.NotSpecified,o.properties=k.sanitizeProperties(e,n),o.measurements=k.sanitizeMeasurements(e,i),o}q(e,r),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData"}(W),function(){}),F=function(){this.hasFullStack=!0,this.parsedStack=[]},K=(function(a){function e(e,t,n,i,o){var r=a.call(this)||this;return r.aiDataContract={ver:m.Required,exceptions:m.Required,severityLevel:m.Default,properties:m.Default,measurements:m.Default},r.properties=k.sanitizeProperties(e,n),r.measurements=k.sanitizeMeasurements(e,i),r.exceptions=[new K(e,t)],o&&(r.severityLevel=o),r}q(e,a),e.CreateSimpleException=function(e,t,n,i,o,r){return{exceptions:[{hasFullStack:!0,message:e,stack:o,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData"}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return q(e,t),e}(X)),function(o){function e(e,t){var n=o.call(this)||this;n.aiDataContract={id:m.Default,outerId:m.Default,typeName:m.Required,message:m.Required,hasFullStack:m.Default,stack:m.Default,parsedStack:m.Array},n.typeName=k.sanitizeString(e,t.name)||R.NotSpecified,n.message=k.sanitizeMessage(e,t.message)||R.NotSpecified;var i=t.stack;return n.parsedStack=n.parseStack(i),n.stack=k.sanitizeException(e,i),n.hasFullStack=R.isArray(n.parsedStack)&&0<n.parsedStack.length,n}return q(e,o),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var i=0,o=0,r=0;r<=n.length;r++){var a=n[r];if(Q.regex.test(a)){var s=new Q(n[r],i++);o+=s.sizeInBytes,t.push(s)}}if(32768<o)for(var c=0,u=t.length-1,l=0,p=c,g=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var d=g-p+1;t.splice(p,d);break}p=c,g=u,c++,u--}}return t},e}(F)),Q=function(o){function r(e,t){var n=o.call(this)||this;n.sizeInBytes=0,n.aiDataContract={level:m.Required,method:m.Required,assembly:m.Default,fileName:m.Default,line:m.Default},n.level=t,n.method="<no_method>",n.assembly=R.trim(e);var i=e.match(r.regex);return i&&5<=i.length&&(n.method=R.trim(i[2])||n.method,n.fileName=R.trim(i[4]),n.line=parseInt(i[5])||0),n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=r.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}return q(r,o),r.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,r.baseSize=58,r}(B),J=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return q(e,t),e}(X);(j=V||(V={}))[j.Measurement=0]="Measurement",j[j.Aggregation=1]="Aggregation";var Y,$,Z=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:m.Required,kind:m.Default,value:m.Required,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default},e}return q(e,t),e}(function(){this.kind=V.Measurement}),ee=(function(u){function e(e,t,n,i,o,r,a){var s=u.call(this)||this;s.aiDataContract={ver:m.Required,metrics:m.Required,properties:m.Default};var c=new Z;return c.count=0<i?i:void 0,c.max=isNaN(r)||null===r?void 0:r,c.min=isNaN(o)||null===o?void 0:o,c.name=k.sanitizeString(e,t)||R.NotSpecified,c.value=n,s.metrics=[c],s.properties=k.sanitizeProperties(e,a),s}q(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData"}(J),function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return q(e,t),e}(W)),te=function(c){function e(e,t,n,i,o,r,a){var s=c.call(this)||this;return s.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,properties:m.Default,measurements:m.Default,id:m.Default},s.id=k.sanitizeId(e,a),s.url=k.sanitizeUrl(e,n),s.name=k.sanitizeString(e,t)||R.NotSpecified,isNaN(i)||(s.duration=R.msToTimeSpan(i)),s.properties=k.sanitizeProperties(e,o),s.measurements=k.sanitizeMeasurements(e,r),s}return q(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(ee);(function(d){function e(e,t,n,i,o,r,a,s,c,u,l){void 0===c&&(c="Ajax");var p=d.call(this)||this;p.aiDataContract={id:m.Required,ver:m.Required,name:m.Default,resultCode:m.Default,duration:m.Default,success:m.Default,data:m.Default,target:m.Default,type:m.Default,properties:m.Default,measurements:m.Default,kind:m.Default,value:m.Default,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default,dependencyKind:m.Default,dependencySource:m.Default,commandName:m.Default,dependencyTypeName:m.Default},p.id=t,p.duration=R.msToTimeSpan(o),p.success=r,p.resultCode=a+"",p.type=k.sanitizeString(e,c),p.data=k.sanitizeUrl(e,i);var g=z.ParseDependencyPath(e,n,s,i);return p.target=g.target,p.name=g.name,p.properties=k.sanitizeProperties(e,u),p.measurements=k.sanitizeMeasurements(e,l),p}q(e,d),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData"})(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return q(e,t),e}(X)),function(r){function e(e,t,n,i){var o=r.call(this)||this;return o.aiDataContract={ver:m.Required,message:m.Required,severityLevel:m.Default,properties:m.Default},t=t||R.NotSpecified,o.message=k.sanitizeMessage(e,t),o.properties=k.sanitizeProperties(e,i),n&&(o.severityLevel=n),o}q(e,r),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData"}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return q(e,t),e}(X)),function(d){function f(e,t,n,i,o,r){var a=d.call(this)||this;a.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,perfTotal:m.Default,networkConnect:m.Default,sentRequest:m.Default,receivedResponse:m.Default,domProcessing:m.Default,properties:m.Default,measurements:m.Default},a.isValid=!1;var s=f.getPerformanceTiming();if(s){var c=f.getDuration(s.navigationStart,s.loadEventEnd),u=f.getDuration(s.navigationStart,s.connectEnd),l=f.getDuration(s.requestStart,s.responseStart),p=f.getDuration(s.responseStart,s.responseEnd),g=f.getDuration(s.responseEnd,s.loadEventEnd);0==c?e.throwInternal(h.WARNING,S,"error calculating page view performance.",{total:c,network:u,request:l,response:p,dom:g}):f.shouldCollectDuration(c,u,l,p,g)?c<Math.floor(u)+Math.floor(l)+Math.floor(p)+Math.floor(g)?e.throwInternal(h.WARNING,v,"client performance math error.",{total:c,network:u,request:l,response:p,dom:g}):(a.durationMs=c,a.perfTotal=a.duration=R.msToTimeSpan(c),a.networkConnect=R.msToTimeSpan(u),a.sentRequest=R.msToTimeSpan(l),a.receivedResponse=R.msToTimeSpan(p),a.domProcessing=R.msToTimeSpan(g),a.isValid=!0):e.throwInternal(h.WARNING,w,"Invalid page load duration value. Browser perf data won't be sent.",{total:c,network:u,request:l,response:p,dom:g})}return a.url=k.sanitizeUrl(e,n),a.name=k.sanitizeString(e,t)||R.NotSpecified,a.properties=k.sanitizeProperties(e,o),a.measurements=k.sanitizeMeasurements(e,r),a}q(f,d),f.prototype.getIsValid=function(){return this.isValid},f.prototype.getDurationMs=function(){return this.durationMs},f.getPerformanceTiming=function(){return f.isPerformanceTimingSupported()?window.performance.timing:null},f.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},f.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},f.getDuration=function(e,t){var n=void 0;return isNaN(e)||isNaN(t)||(n=Math.max(t-e,0)),n},f.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=["googlebot","adsbot-google","apis-google","mediapartners-google"],i=navigator.userAgent,o=!1;if(i)for(var r=0;r<n.length;r++)o=o||-1!==i.toLowerCase().indexOf(n[r]);if(o)return!1;for(var a=0;a<e.length;a++)if(e[a]>=f.MAX_DURATION_ALLOWED)return!1;return!0},f.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",f.dataType="PageviewPerformanceData",f.MAX_DURATION_ALLOWED=36e5}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return q(e,t),e}(ee)),function(i){function e(e,t){var n=i.call(this)||this;return n.aiDataContract={baseType:m.Required,baseData:m.Required},n.baseType=e,n.baseData=t,n}q(e,i)}(H);($=Y||(Y={}))[$.Verbose=0]="Verbose",$[$.Information=1]="Information",$[$.Warning=2]="Warning",$[$.Error=3]="Error",$[$.Critical=4]="Critical";var ne=function(){function e(){}return e.getConfig=function(e,t,n,i){var o;return void 0===i&&(i=!1),o=n&&e.extensionConfig&&e.extensionConfig[n]&&!r.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],r.isNullOrUndefined(o)?i:o},e}(),ie=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"},oe=function(){function e(){}return e.domain="domain",e.browser="web.browser",e.browserVer="web.browserVer",e.browserLang="web.browserLang",e.userConsent="web.userConsent",e.isManual="web.isManual",e.screenRes="web.screenRes",e}(),re=function(){function e(){}return e.localId="device.localId",e.model="device.model",e.deviceType="device.class",e}(),ae=function(){function e(){}return e.sessionId="app.sesId",e}(),se=function(){function e(){}return e.id="user.id",e.authId="authId",e.localId="localId",e}(),ce=function(){function e(){}return e.accountId="user.accountId",e}(),ue=function(){function e(){}return e.clientIp="ingest.clientIp",e}(),le=function(){function e(){}return e.deviceOS="os.name",e}(),pe=new ie,ge=function(){},de=function(){function i(e,t){r.isNullOrUndefined(t)?this._logger=new L:this._logger=t,e||(e={}),"function"!=typeof e.sessionExpirationMs&&(e.sessionExpirationMs=function(){return i.acquisitionSpan}),"function"!=typeof e.sessionRenewalMs&&(e.sessionRenewalMs=function(){return i.renewalSpan}),this.config=e,this.automaticSession=new ge}return i.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var e=P.Now(),t=e-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),n=e-this.automaticSession.renewalDate>this.config.sessionRenewalMs();t||n?(this.automaticSession.isFirst=void 0,this.renew()):(!this.cookieUpdatedTimestamp||e-this.cookieUpdatedTimestamp>i.cookieUpdateInterval)&&(this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},i.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},i.prototype.initializeAutomaticSession=function(){var e=R.getCookie(this._logger,"ai_session");if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var t=R.getStorage(this._logger,"ai_session");t&&this.initializeAutomaticSessionWithData(t)}this.automaticSession.id||(this.automaticSession.isFirst=!0,this.renew())},i.prototype.initializeAutomaticSessionWithData=function(e){var t=e.split("|");0<t.length&&(this.automaticSession.id=t[0]);try{if(1<t.length){var n=+t[1];this.automaticSession.acquisitionDate=+new Date(n),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<t.length){var i=+t[2];this.automaticSession.renewalDate=+new Date(i),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(e){this._logger.throwInternal(h.CRITICAL,f,"Error parsing ai_session cookie, session will be reset: "+R.getExceptionName(e),{exception:R.dump(e)})}0==this.automaticSession.renewalDate&&this._logger.throwInternal(h.WARNING,I,"AI session renewal date is 0, session will be reset.")},i.prototype.renew=function(){var e=P.Now();this.automaticSession.id=R.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),R.canUseLocalStorage()||this._logger.throwInternal(h.WARNING,s,"Browser does not support local storage. Session durations will be inaccurate.")},i.prototype.setCookie=function(e,t,n){var i=t+this.config.sessionExpirationMs(),o=n+this.config.sessionRenewalMs(),r=new Date,a=[e,t,n];i<o?r.setTime(i):r.setTime(o);var s=this.config.cookieDomain?this.config.cookieDomain():null;R.setCookie(this._logger,"ai_session",a.join("|")+";expires="+r.toUTCString(),s),this.cookieUpdatedTimestamp=P.Now()},i.prototype.setStorage=function(e,t,n){R.setStorage(this._logger,"ai_session",[e,t,n].join("|"))},i.acquisitionSpan=864e5,i.renewalSpan=18e5,i.cookieUpdateInterval=6e4,i}(),fe=function(){},he=function(){this.id="browser",this.type="Browser"},me=function(e){this.sdkVersion=(e.sdkExtension&&e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:2.0.2-beta"},ve=function(){},Se=function(){this.id=R.newId(),window&&window.location&&window.location.pathname&&(this.name=window.location.pathname)},ye=function(){function l(e,t){this._logger=t;var n=R.getCookie(this._logger,l.userCookieName);if(n){var i=n.split(l.cookieSeparator);0<i.length&&(this.id=i[0])}if(this.config=e,!this.id){this.id=R.newId();var o=new Date,r=R.toISOStringForIE8(o);this.accountAcquisitionDate=r,o.setTime(o.getTime()+31536e6);var a=[this.id,r],s=this.config.cookieDomain?this.config.cookieDomain():void 0;R.setCookie(this._logger,l.userCookieName,a.join(l.cookieSeparator)+";expires="+o.toUTCString(),s),R.removeStorage(this._logger,"ai_session")}this.accountId=e.accountId?e.accountId():void 0;var c=R.getCookie(this._logger,l.authUserCookieName);if(c){var u=(c=decodeURI(c)).split(l.cookieSeparator);u[0]&&(this.authenticatedId=u[0]),1<u.length&&u[1]&&(this.accountId=u[1])}}return l.prototype.setAuthenticatedUserContext=function(e,t,n){if(void 0===n&&(n=!1),!this.validateUserInput(e)||t&&!this.validateUserInput(t))this._logger.throwInternal(h.WARNING,A,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{this.authenticatedId=e;var i=this.authenticatedId;t&&(this.accountId=t,i=[this.authenticatedId,this.accountId].join(l.cookieSeparator)),n&&R.setCookie(this._logger,l.authUserCookieName,encodeURI(i),this.config.cookieDomain())}},l.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,R.deleteCookie(this._logger,l.authUserCookieName)},l.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},l.cookieSeparator="|",l.userCookieName="ai_user",l.authUserCookieName="ai_authUser",l}(),Ie=function(){function i(){}return i.prototype.getHashCodeScore=function(e){return 100*(this.getHashCode(e)/i.INT_MAX_VALUE)},i.prototype.getHashCode=function(e){if(""==e)return 0;for(;e.length<i.MIN_INPUT_LENGTH;)e=e.concat(e);for(var t=5381,n=0;n<e.length;++n)t=(t<<5)+t+e.charCodeAt(n),t&=t;return Math.abs(t)},i.INT_MAX_VALUE=2147483647,i.MIN_INPUT_LENGTH=8,i}(),we=function(){function e(){this.hashCodeGeneragor=new Ie}return e.prototype.getSamplingScore=function(e){var t=new ie;return e.tags[t.userId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.userId]):e.tags[t.operationId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.operationId]):Math.random()},e}(),Ne=function(){function e(e,t){this.INT_MAX_VALUE=2147483647,r.isNullOrUndefined(t)?this._logger=new L:this._logger=t,(100<e||e<0)&&(this._logger.throwInternal(h.WARNING,x,"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.",{samplingRate:e},!0),this.sampleRate=100),this.sampleRate=e,this.samplingScoreGenerator=new we}return e.prototype.isSampledIn=function(e){return!0},e}(),_e=function(){function c(){this.priority=170,this.identifier="AppInsightsPropertiesPlugin"}return c.getDefaultConfig=function(){return{instrumentationKey:function(){},accountId:function(){return null},sessionRenewalMs:function(){return 18e5},samplingPercentage:function(){return 100},sessionExpirationMs:function(){return 864e5},cookieDomain:function(){return null},sdkExtension:function(){return null},isBrowserLinkTrackingEnabled:function(){return!1},appId:function(){return null}}},c.prototype.initialize=function(t,e,n){var i=this,o=c.getDefaultConfig();this._extensionConfig=this._extensionConfig||c.getDefaultConfig();var r=function(e){a._extensionConfig[e]=function(){return ne.getConfig(t,e,i.identifier,o[e]())}},a=this;for(var s in o)r(s);"undefined"!=typeof window&&(this._sessionManager=new de(this._extensionConfig,e.logger),this.application=new fe,this.device=new he,this.internal=new me(this._extensionConfig),this.location=new ve,this.user=new ye(this._extensionConfig,e.logger),this.operation=new Se,this.session=new ge,this.sample=new Ne(this._extensionConfig.samplingPercentage(),e.logger))},c.prototype.processTelemetry=function(e){r.isNullOrUndefined(e)||(this.sample.isSampledIn(e)&&(e.name,te.envelopeType,this.session&&"string"!=typeof this.session.id&&this._sessionManager.update(),this._processTelemetryInternal(e)),r.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e))},c.prototype.setNextPlugin=function(e){this._nextPlugin=e},c.prototype._processTelemetryInternal=function(e){this.session&&("string"==typeof this.session.id?this._applySessionContext(e,this.session):this._applySessionContext(e,this._sessionManager.automaticSession)),e.tags||(e.tags=[]),e.ctx||(e.ctx={}),this._applyApplicationContext(e,this.application),this._applyDeviceContext(e,this.device),this._applyInternalContext(e,this.internal),this._applyLocationContext(e,this.location),this._applySampleContext(e,this.sample),this._applyOperationContext(e,this.operation),this._applyUserContext(e,this.user)},c.prototype._applySessionContext=function(e,t){t&&("string"==typeof t.id&&(e.ctx[ae.sessionId]=t.id),void 0!==t.isFirst&&(e.tags[pe.sessionIsFirst]=t.isFirst))},c.prototype._applyApplicationContext=function(e,t){t&&("string"==typeof t.ver&&(e.tags[pe.applicationVersion]=t.ver),"string"==typeof t.build&&(e.tags[pe.applicationBuild]=t.build))},c.prototype._applyDeviceContext=function(e,t){t&&("string"==typeof t.id&&(e.ctx[re.localId]=t.id),"string"==typeof t.ip&&(e.ctx[ue.clientIp]=t.ip),"string"==typeof t.language&&(e.ctx[oe.browserLang]=t.language),"string"==typeof t.locale&&(e.tags[pe.deviceLocale]=t.locale),"string"==typeof t.model&&(e.ctx[re.model]=t.model),void 0!==t.network&&(e.tags[pe.deviceNetwork]=t.network),"string"==typeof t.oemName&&(e.tags[pe.deviceOEMName]=t.oemName),"string"==typeof t.os&&(e.ctx[le.deviceOS]=t.os),"string"==typeof t.osversion&&(e.tags[pe.deviceOSVersion]=t.osversion),"string"==typeof t.resolution&&(e.ctx[oe.screenRes]=t.resolution),"string"==typeof t.type&&(e.ctx[re.deviceType]=t.type))},c.prototype._applyInternalContext=function(e,t){t&&("string"==typeof t.agentVersion&&(e.tags[pe.internalAgentVersion]=t.agentVersion),"string"==typeof t.sdkVersion&&(e.tags[pe.internalSdkVersion]=t.sdkVersion))},c.prototype._applyLocationContext=function(e,t){t&&"string"==typeof t.ip&&(e.tags[pe.locationIp]=t.ip)},c.prototype._applySampleContext=function(e,t){t&&(e.tags.sampleRate=t.sampleRate)},c.prototype._applyOperationContext=function(e,t){t&&("string"==typeof t.id&&(e.tags[pe.operationId]=t.id),"string"==typeof t.name&&(e.tags[pe.operationName]=t.name),"string"==typeof t.parentId&&(e.tags[pe.operationParentId]=t.parentId),"string"==typeof t.rootId&&(e.tags[pe.operationRootId]=t.rootId),"string"==typeof t.syntheticSource&&(e.tags[pe.operationSyntheticSource]=t.syntheticSource))},c.prototype._applyUserContext=function(e,t){if(t){if(e.tags||(e.tags=[]),"string"==typeof t.agent){var n=t.agent;e.tags.push({ky:n})}if("string"==typeof t.storeRegion){n=t.storeRegion;e.tags.push({ky:n})}if("string"==typeof t.accountId){var i={};i[ce.accountId]=t.accountId,e.tags.push(i)}"string"==typeof t.id&&(e.ctx[se.id]=t.id),"string"==typeof t.authenticatedId&&(e.ctx[se.authId]=t.authenticatedId)}},c}();e.PropertiesPlugin=_e,e.Operation=Se,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var d,t,r=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(i,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),i=/[xy]/g;(t=d||(d={}))[t.CRITICAL=1]="CRITICAL",t[t.WARNING=2]="WARNING";var o,n,m,a,s=0,c=1,u=2,l=3,p=4,h=5,g=6,v=8,f=9,S=10,x=23,y=27,I=45,N=52,w=56,D=57,E=58,_=60,A=61,C=66,T=68,b=69,M=function(){function r(e,t,i,n){void 0===i&&(i=!1),this.messageId=e,this.message=(i?r.AiUserActionablePrefix:r.AiNonUserActionablePrefix)+e;var o=(t?" message:"+r.sanitizeDiagnosticText(t):"")+(n?" props:"+r.sanitizeDiagnosticText(JSON.stringify(n)):"");this.message+=o}return r.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},r.dataType="MessageData",r.AiNonUserActionablePrefix="AI (Internal): ",r.AiUserActionablePrefix="AI: ",r}(),U=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},r.isNullOrUndefined(e)||(r.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),r.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),r.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),r.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,i,n,o){void 0===o&&(o=!1);var r=new M(t,i,o,n);if(this.enableDebugExceptions())throw r;if(void 0!==r&&r&&void 0!==r.message){if(o){var a=+r.messageId;(!this._messageLogged[a]||this.consoleLoggingLevel()>=d.WARNING)&&(this.warnToConsole(r.message),this._messageLogged[a]=!0)}else this.consoleLoggingLevel()>=d.WARNING&&this.warnToConsole(r.message);this.logInternalMessage(e,r)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var i=!0,n=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[n]?i=!1:this._messageLogged[n]=!0,i&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",r=new M(x,o,!1);this.queue.push(r),this.warnToConsole(o)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),k=(function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=k}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(i,n,o){var r=this;if(this.channelQueue=new Array,i.channels){var a=void 0;i.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<k&&(a=e.identifier),e.initialize(i,n,o)}),a)throw Error(L+a);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);r.channelQueue.push(e)}})}for(var e=new Array,t=0;t<o.length;t++){var s=o[t];s.priority>k&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(i,n,o)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}}(),500),L="Channel has invalid priority";(n=o||(o={}))[n.LocalStorage=0]="LocalStorage",n[n.SessionStorage=1]="SessionStorage",(a=m||(m={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var R=function(){function s(){}return s.sanitizeKeyAndAddUniqueness=function(e,t,i){var n=t.length,o=s.sanitizeKey(e,t);if(o.length!==n){for(var r=0,a=o;void 0!==i[a];)r++,a=o.substring(0,s.MAX_NAME_LENGTH-3)+s.padNumber(r);o=a}return o},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(d.WARNING,D,"name is too long. It has been truncated to "+s.MAX_NAME_LENGTH+" characters.",{name:t},!0)),t},s.sanitizeString=function(e,t,i){return void 0===i&&(i=s.MAX_STRING_LENGTH),t&&(i=i||s.MAX_STRING_LENGTH,(t=s.trim(t)).toString().length>i&&(t=t.toString().substring(0,i),e.throwInternal(d.WARNING,A,"string value is too long. It has been truncated to "+i+" characters.",{value:t},!0))),t},s.sanitizeUrl=function(e,t){return s.sanitizeInput(e,t,s.MAX_URL_LENGTH,C)},s.sanitizeMessage=function(e,t){return t&&t.length>s.MAX_MESSAGE_LENGTH&&(t=t.substring(0,s.MAX_MESSAGE_LENGTH),e.throwInternal(d.WARNING,w,"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(d.WARNING,N,"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 i={};for(var n in t){var o=s.sanitizeString(e,t[n],s.MAX_PROPERTY_LENGTH);i[n=s.sanitizeKeyAndAddUniqueness(e,n,i)]=o}t=i}return t},s.sanitizeMeasurements=function(e,t){if(t){var i={};for(var n in t){var o=t[n];i[n=s.sanitizeKeyAndAddUniqueness(e,n,i)]=o}t=i}return t},s.sanitizeId=function(e,t){return t?s.sanitizeInput(e,t,s.MAX_ID_LENGTH,b).toString():t},s.sanitizeInput=function(e,t,i,n){return t&&(t=s.trim(t)).length>i&&(t=t.substring(0,i),e.throwInternal(d.WARNING,n,"input is too long, it has been truncated to "+i+" 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}(),O=function(){function s(){}return s.disableStorage=function(){s._canUseLocalStorage=!1,s._canUseSessionStorage=!1},s._getLocalStorageObject=function(){return s.canUseLocalStorage()?s._getVerifiedStorageObject(o.LocalStorage):null},s._getVerifiedStorageObject=function(e){var t,i,n=null;try{if("undefined"==typeof window)return null;i=new Date,(n=e===o.LocalStorage?window.localStorage:window.sessionStorage).setItem(i,i),t=n.getItem(i)!=i,n.removeItem(i),t&&(n=null)}catch(e){n=null}return n},s.isInternalApplicationInsightsEndpoint=function(e){return-1!==s._internalEndpoints.indexOf(e.toLowerCase())},s.canUseLocalStorage=function(){return void 0===s._canUseLocalStorage&&(s._canUseLocalStorage=!!s._getVerifiedStorageObject(o.LocalStorage)),s._canUseLocalStorage},s.getStorage=function(t,e){var i=s._getLocalStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){s._canUseLocalStorage=!1,t.throwInternal(d.WARNING,c,"Browser failed read of local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setStorage=function(t,e,i){var n=s._getLocalStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(d.WARNING,l,"Browser failed write to local storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeStorage=function(t,e){var i=s._getLocalStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){s._canUseLocalStorage=!1,t.throwInternal(d.WARNING,h,"Browser failed removal of local storage item. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s._getSessionStorageObject=function(){return s.canUseSessionStorage()?s._getVerifiedStorageObject(o.SessionStorage):null},s.canUseSessionStorage=function(){return void 0===s._canUseSessionStorage&&(s._canUseSessionStorage=!!s._getVerifiedStorageObject(o.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 i=s._getSessionStorageObject();if(null!==i)try{return i.getItem(e)}catch(e){s._canUseSessionStorage=!1,t.throwInternal(d.WARNING,u,"Browser failed read of session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return null},s.setSessionStorage=function(t,e,i){var n=s._getSessionStorageObject();if(null!==n)try{return n.setItem(e,i),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(d.WARNING,p,"Browser failed write to session storage. "+s.getExceptionName(e),{exception:s.dump(e)})}return!1},s.removeSessionStorage=function(t,e){var i=s._getSessionStorageObject();if(null!==i)try{return i.removeItem(e),!0}catch(e){s._canUseSessionStorage=!1,t.throwInternal(d.WARNING,g,"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(d.WARNING,T,"Cannot access document.cookie - "+s.getExceptionName(e),{exception:s.dump(e)})}}return s._canUseCookies},s.setCookie=function(e,t,i,n){var o="",r="";n&&(o=";domain="+n),s.document.location&&"https:"===s.document.location.protocol&&(r=";secure"),s.canUseCookies(e)&&(s.document.cookie=t+"="+i+o+";path=/"+r)},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 i="";if(t&&t.length)for(var n=t+"=",o=s.document.cookie.split(";"),r=0;r<o.length;r++){var a=o[r];if((a=s.trim(a))&&0===a.indexOf(n)){i=a.substring(n.length,o[r].length);break}}return i}},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,i=""+Math.floor(e/1e3)%60,n=""+Math.floor(e/6e4)%60,o=""+Math.floor(e/36e5)%24,r=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,i=i.length<2?"0"+i:i,n=n.length<2?"0"+n:n,(0<r?r+".":"")+(o=o.length<2?"0"+o:o)+":"+n+":"+i+"."+t},s.isCrossOriginError=function(e,t,i,n,o){return("Script error."===e||"Script error"===e)&&!o},s.dump=function(e){var t=Object.prototype.toString.call(e),i=JSON.stringify(e);return"[object Error]"===t&&(i="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'"),t+i},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 i="on"+e;if(window.addEventListener)window.addEventListener(e,t,!1);else{if(!window.attachEvent)return!1;window.attachEvent(i,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}(),P=function(){function n(){}return n.parseUrl=function(e){return n.htmlAnchorElement||(n.htmlAnchorElement=n.document.createElement?n.document.createElement("a"):{}),n.htmlAnchorElement.href=e,n.htmlAnchorElement},n.getAbsoluteUrl=function(e){var t,i=n.parseUrl(e);return i&&(t=i.href),t},n.getPathName=function(e){var t,i=n.parseUrl(e);return i&&(t=i.pathname),t},n.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},n.document="undefined"!=typeof document?document:{},n}(),z=function(){function e(){}return e.ParseDependencyPath=function(e,t,i,n){var o,r;if(t&&0<t.length){var a=P.parseUrl(t);if(o=a.host,null!=a.pathname)"/"!==(n=0===a.pathname.length?"/":a.pathname).charAt(0)&&(n="/"+n),r=R.sanitizeString(e,i?i+" "+n:n);else r=R.sanitizeString(e,t)}else r=o=n;return{target:o,name:r}},e}(),G=function(){function e(){}return 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 i=null;return 0===e||0===t||r.isNullOrUndefined(e)||r.isNullOrUndefined(t)||(i=t-e),i},e}(),q=function(e,t){return(q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function V(e,t){function i(){this.constructor=e}q(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var j,W,H=function(e){function t(){return e.call(this)||this}return V(t,e),t}(function(){}),X=(function(o){function e(e,t,i){var n=o.call(this)||this;return n.name=R.sanitizeString(e,i)||O.NotSpecified,n.data=t,n.time=O.toISOStringForIE8(new Date),n.aiDataContract={time:m.Required,iKey:m.Required,name:m.Required,sampleRate:function(){return 100==n.sampleRate?m.Hidden:m.Required},tags:m.Required,data:m.Required},n}V(e,o)}(function(){this.ver=1,this.sampleRate=100,this.tags={}}),function(){}),B=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return V(e,t),e}(X),K=(function(r){function e(e,t,i,n){var o=r.call(this)||this;return o.aiDataContract={ver:m.Required,name:m.Required,properties:m.Default,measurements:m.Default},o.name=R.sanitizeString(e,t)||O.NotSpecified,o.properties=R.sanitizeProperties(e,i),o.measurements=R.sanitizeMeasurements(e,n),o}V(e,r),e.envelopeType="Microsoft.ApplicationInsights.{0}.Event",e.dataType="EventData"}(B),function(){}),F=function(){this.hasFullStack=!0,this.parsedStack=[]},Q=(function(a){function e(e,t,i,n,o){var r=a.call(this)||this;return r.aiDataContract={ver:m.Required,exceptions:m.Required,severityLevel:m.Default,properties:m.Default,measurements:m.Default},r.properties=R.sanitizeProperties(e,i),r.measurements=R.sanitizeMeasurements(e,n),r.exceptions=[new Q(e,t)],o&&(r.severityLevel=o),r}V(e,a),e.CreateSimpleException=function(e,t,i,n,o,r){return{exceptions:[{hasFullStack:!0,message:e,stack:o,typeName:t}]}},e.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",e.dataType="ExceptionData"}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}return V(e,t),e}(X)),function(o){function e(e,t){var i=o.call(this)||this;i.aiDataContract={id:m.Default,outerId:m.Default,typeName:m.Required,message:m.Required,hasFullStack:m.Default,stack:m.Default,parsedStack:m.Array},i.typeName=R.sanitizeString(e,t.name)||O.NotSpecified,i.message=R.sanitizeMessage(e,t.message)||O.NotSpecified;var n=t.stack;return i.parsedStack=i.parseStack(n),i.stack=R.sanitizeException(e,n),i.hasFullStack=O.isArray(i.parsedStack)&&0<i.parsedStack.length,i}return V(e,o),e.prototype.parseStack=function(e){var t=void 0;if("string"==typeof e){var i=e.split("\n");t=[];for(var n=0,o=0,r=0;r<=i.length;r++){var a=i[r];if(J.regex.test(a)){var s=new J(i[r],n++);o+=s.sizeInBytes,t.push(s)}}if(32768<o)for(var c=0,u=t.length-1,l=0,p=c,h=u;c<u;){if(32768<(l+=t[c].sizeInBytes+t[u].sizeInBytes)){var g=h-p+1;t.splice(p,g);break}p=c,h=u,c++,u--}}return t},e}(F)),J=function(o){function r(e,t){var i=o.call(this)||this;i.sizeInBytes=0,i.aiDataContract={level:m.Required,method:m.Required,assembly:m.Default,fileName:m.Default,line:m.Default},i.level=t,i.method="<no_method>",i.assembly=O.trim(e);var n=e.match(r.regex);return n&&5<=n.length&&(i.method=O.trim(n[2])||i.method,i.fileName=O.trim(n[4]),i.line=parseInt(n[5])||0),i.sizeInBytes+=i.method.length,i.sizeInBytes+=i.fileName.length,i.sizeInBytes+=i.assembly.length,i.sizeInBytes+=r.baseSize,i.sizeInBytes+=i.level.toString().length,i.sizeInBytes+=i.line.toString().length,i}return V(r,o),r.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,r.baseSize=58,r}(K),Y=function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}return V(e,t),e}(X);(W=j||(j={}))[W.Measurement=0]="Measurement",W[W.Aggregation=1]="Aggregation";var $,Z,ee=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.aiDataContract={name:m.Required,kind:m.Default,value:m.Required,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default},e}return V(e,t),e}(function(){this.kind=j.Measurement}),te=(function(u){function e(e,t,i,n,o,r,a){var s=u.call(this)||this;s.aiDataContract={ver:m.Required,metrics:m.Required,properties:m.Default};var c=new ee;return c.count=0<n?n:void 0,c.max=isNaN(r)||null===r?void 0:r,c.min=isNaN(o)||null===o?void 0:o,c.name=R.sanitizeString(e,t)||O.NotSpecified,c.value=i,s.metrics=[c],s.properties=R.sanitizeProperties(e,a),s}V(e,u),e.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",e.dataType="MetricData"}(Y),function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return V(e,t),e}(B)),ie=function(c){function e(e,t,i,n,o,r,a){var s=c.call(this)||this;return s.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,properties:m.Default,measurements:m.Default,id:m.Default},s.id=R.sanitizeId(e,a),s.url=R.sanitizeUrl(e,i),s.name=R.sanitizeString(e,t)||O.NotSpecified,isNaN(n)||(s.duration=O.msToTimeSpan(n)),s.properties=R.sanitizeProperties(e,o),s.measurements=R.sanitizeMeasurements(e,r),s}return V(e,c),e.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",e.dataType="PageviewData",e}(te);(function(g){function e(e,t,i,n,o,r,a,s,c,u,l){void 0===c&&(c="Ajax");var p=g.call(this)||this;p.aiDataContract={id:m.Required,ver:m.Required,name:m.Default,resultCode:m.Default,duration:m.Default,success:m.Default,data:m.Default,target:m.Default,type:m.Default,properties:m.Default,measurements:m.Default,kind:m.Default,value:m.Default,count:m.Default,min:m.Default,max:m.Default,stdDev:m.Default,dependencyKind:m.Default,dependencySource:m.Default,commandName:m.Default,dependencyTypeName:m.Default},p.id=t,p.duration=O.msToTimeSpan(o),p.success=r,p.resultCode=a+"",p.type=R.sanitizeString(e,c),p.data=R.sanitizeUrl(e,n);var h=z.ParseDependencyPath(e,i,s,n);return p.target=h.target,p.name=h.name,p.properties=R.sanitizeProperties(e,u),p.measurements=R.sanitizeMeasurements(e,l),p}V(e,g),e.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",e.dataType="RemoteDependencyData"})(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}return V(e,t),e}(X)),function(r){function e(e,t,i,n){var o=r.call(this)||this;return o.aiDataContract={ver:m.Required,message:m.Required,severityLevel:m.Default,properties:m.Default},t=t||O.NotSpecified,o.message=R.sanitizeMessage(e,t),o.properties=R.sanitizeProperties(e,n),i&&(o.severityLevel=i),o}V(e,r),e.envelopeType="Microsoft.ApplicationInsights.{0}.Message",e.dataType="MessageData"}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e}return V(e,t),e}(X)),function(g){function f(e,t,i,n,o,r){var a=g.call(this)||this;a.aiDataContract={ver:m.Required,name:m.Default,url:m.Default,duration:m.Default,perfTotal:m.Default,networkConnect:m.Default,sentRequest:m.Default,receivedResponse:m.Default,domProcessing:m.Default,properties:m.Default,measurements:m.Default},a.isValid=!1;var s=f.getPerformanceTiming();if(s){var c=f.getDuration(s.navigationStart,s.loadEventEnd),u=f.getDuration(s.navigationStart,s.connectEnd),l=f.getDuration(s.requestStart,s.responseStart),p=f.getDuration(s.responseStart,s.responseEnd),h=f.getDuration(s.responseEnd,s.loadEventEnd);0==c?e.throwInternal(d.WARNING,S,"error calculating page view performance.",{total:c,network:u,request:l,response:p,dom:h}):f.shouldCollectDuration(c,u,l,p,h)?c<Math.floor(u)+Math.floor(l)+Math.floor(p)+Math.floor(h)?e.throwInternal(d.WARNING,v,"client performance math error.",{total:c,network:u,request:l,response:p,dom:h}):(a.durationMs=c,a.perfTotal=a.duration=O.msToTimeSpan(c),a.networkConnect=O.msToTimeSpan(u),a.sentRequest=O.msToTimeSpan(l),a.receivedResponse=O.msToTimeSpan(p),a.domProcessing=O.msToTimeSpan(h),a.isValid=!0):e.throwInternal(d.WARNING,I,"Invalid page load duration value. Browser perf data won't be sent.",{total:c,network:u,request:l,response:p,dom:h})}return a.url=R.sanitizeUrl(e,i),a.name=R.sanitizeString(e,t)||O.NotSpecified,a.properties=R.sanitizeProperties(e,o),a.measurements=R.sanitizeMeasurements(e,r),a}V(f,g),f.prototype.getIsValid=function(){return this.isValid},f.prototype.getDurationMs=function(){return this.durationMs},f.getPerformanceTiming=function(){return f.isPerformanceTimingSupported()?window.performance.timing:null},f.isPerformanceTimingSupported=function(){return"undefined"!=typeof window&&window.performance&&window.performance.timing},f.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},f.getDuration=function(e,t){var i=void 0;return isNaN(e)||isNaN(t)||(i=Math.max(t-e,0)),i},f.shouldCollectDuration=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=["googlebot","adsbot-google","apis-google","mediapartners-google"],n=navigator.userAgent,o=!1;if(n)for(var r=0;r<i.length;r++)o=o||-1!==n.toLowerCase().indexOf(i[r]);if(o)return!1;for(var a=0;a<e.length;a++)if(e[a]>=f.MAX_DURATION_ALLOWED)return!1;return!0},f.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",f.dataType="PageviewPerformanceData",f.MAX_DURATION_ALLOWED=36e5}(function(t){function e(){var e=t.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}return V(e,t),e}(te)),function(n){function e(e,t){var i=n.call(this)||this;return i.aiDataContract={baseType:m.Required,baseData:m.Required},i.baseType=e,i.baseData=t,i}V(e,n)}(H);(Z=$||($={}))[Z.Verbose=0]="Verbose",Z[Z.Information=1]="Information",Z[Z.Warning=2]="Warning",Z[Z.Error=3]="Error",Z[Z.Critical=4]="Critical";var ne=function(){function e(){}return e.getConfig=function(e,t,i,n){var o;return void 0===n&&(n=!1),o=i&&e.extensionConfig&&e.extensionConfig[i]&&!r.isNullOrUndefined(e.extensionConfig[i][t])?e.extensionConfig[i][t]:e[t],r.isNullOrUndefined(o)?n:o},e}(),oe=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"},re=function(){function e(){}return e.UserExt="user",e.DeviceExt="device",e.TraceExt="trace",e.WebExt="web",e.AppExt="app",e.OSExt="os",e.SessionExt="ses",e.SDKExt="sdk",e}(),ae=function(){function e(){}return e.libVer="libVer",e}(),se=new oe,ce=function(){},ue=function(){function n(e,t){var i=this;r.isNullOrUndefined(t)?this._logger=new U:this._logger=t,e||(e={}),"function"!=typeof e.sessionExpirationMs&&(e.sessionExpirationMs=function(){return n.acquisitionSpan}),"function"!=typeof e.sessionRenewalMs&&(e.sessionRenewalMs=function(){return n.renewalSpan}),this.config=e,this._storageNamePrefix=function(){return i.config.namePrefix&&i.config.namePrefix()?n.cookieNameConst+i.config.namePrefix():n.cookieNameConst},this.automaticSession=new ce}return n.prototype.update=function(){this.automaticSession.id||this.initializeAutomaticSession();var e=G.Now(),t=e-this.automaticSession.acquisitionDate>this.config.sessionExpirationMs(),i=e-this.automaticSession.renewalDate>this.config.sessionRenewalMs();t||i?this.renew():(!this.cookieUpdatedTimestamp||e-this.cookieUpdatedTimestamp>n.cookieUpdateInterval)&&(this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate))},n.prototype.backup=function(){this.setStorage(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate)},n.prototype.initializeAutomaticSession=function(){var e=O.getCookie(this._logger,this._storageNamePrefix());if(e&&"function"==typeof e.split)this.initializeAutomaticSessionWithData(e);else{var t=O.getStorage(this._logger,this._storageNamePrefix());t&&this.initializeAutomaticSessionWithData(t)}this.automaticSession.id||this.renew()},n.prototype.initializeAutomaticSessionWithData=function(e){var t=e.split("|");0<t.length&&(this.automaticSession.id=t[0]);try{if(1<t.length){var i=+t[1];this.automaticSession.acquisitionDate=+new Date(i),this.automaticSession.acquisitionDate=0<this.automaticSession.acquisitionDate?this.automaticSession.acquisitionDate:0}if(2<t.length){var n=+t[2];this.automaticSession.renewalDate=+new Date(n),this.automaticSession.renewalDate=0<this.automaticSession.renewalDate?this.automaticSession.renewalDate:0}}catch(e){this._logger.throwInternal(d.CRITICAL,f,"Error parsing ai_session cookie, session will be reset: "+O.getExceptionName(e),{exception:O.dump(e)})}0==this.automaticSession.renewalDate&&this._logger.throwInternal(d.WARNING,y,"AI session renewal date is 0, session will be reset.")},n.prototype.renew=function(){var e=G.Now();this.automaticSession.id=O.newId(),this.automaticSession.acquisitionDate=e,this.automaticSession.renewalDate=e,this.setCookie(this.automaticSession.id,this.automaticSession.acquisitionDate,this.automaticSession.renewalDate),O.canUseLocalStorage()||this._logger.throwInternal(d.WARNING,s,"Browser does not support local storage. Session durations will be inaccurate.")},n.prototype.setCookie=function(e,t,i){var n=t+this.config.sessionExpirationMs(),o=i+this.config.sessionRenewalMs(),r=new Date,a=[e,t,i];n<o?r.setTime(n):r.setTime(o);var s=this.config.cookieDomain?this.config.cookieDomain():null;O.setCookie(this._logger,this._storageNamePrefix(),a.join("|")+";expires="+r.toUTCString(),s),this.cookieUpdatedTimestamp=G.Now()},n.prototype.setStorage=function(e,t,i){O.setStorage(this._logger,this._storageNamePrefix(),[e,t,i].join("|"))},n.acquisitionSpan=864e5,n.renewalSpan=18e5,n.cookieUpdateInterval=6e4,n.cookieNameConst="ai_session",n}(),le=function(){},pe=function(){this.id="browser",this.deviceClass="Browser"},he=function(e){this.sdkVersion=(e.sdkExtension&&e.sdkExtension()?e.sdkExtension()+"_":"")+"javascript:2.0.2-beta"},ge=function(){function n(){}return n.prototype.getHashCodeScore=function(e){return 100*(this.getHashCode(e)/n.INT_MAX_VALUE)},n.prototype.getHashCode=function(e){if(""==e)return 0;for(;e.length<n.MIN_INPUT_LENGTH;)e=e.concat(e);for(var t=5381,i=0;i<e.length;++i)t=(t<<5)+t+e.charCodeAt(i),t&=t;return Math.abs(t)},n.INT_MAX_VALUE=2147483647,n.MIN_INPUT_LENGTH=8,n}(),fe=function(){function e(){this.hashCodeGeneragor=new ge}return e.prototype.getSamplingScore=function(e){var t=new oe;return e.tags[t.userId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.userId]):e.tags[t.operationId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[t.operationId]):Math.random()},e}(),de=function(){function e(e,t){this.INT_MAX_VALUE=2147483647,r.isNullOrUndefined(t)?this._logger=new U:this._logger=t,(100<e||e<0)&&(this._logger.throwInternal(d.WARNING,E,"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.",{samplingRate:e},!0),this.sampleRate=100),this.sampleRate=e,this.samplingScoreGenerator=new fe}return e.prototype.isSampledIn=function(e){return!0},e}(),me=function(){function p(e,t){this._logger=t;var i=O.getCookie(this._logger,p.userCookieName);if(i){var n=i.split(p.cookieSeparator);0<n.length&&(this.id=n[0])}if(this.config=e,!this.id){this.id=O.newId();var o=new Date,r=O.toISOStringForIE8(o);this.accountAcquisitionDate=r,o.setTime(o.getTime()+31536e6);var a=[this.id,r],s=this.config.cookieDomain?this.config.cookieDomain():void 0;O.setCookie(this._logger,p.userCookieName,a.join(p.cookieSeparator)+";expires="+o.toUTCString(),s);var c=e.namePrefix&&e.namePrefix()?e.namePrefix()+"ai_session":"ai_session";O.removeStorage(this._logger,c)}this.accountId=e.accountId?e.accountId():void 0;var u=O.getCookie(this._logger,p.authUserCookieName);if(u){var l=(u=decodeURI(u)).split(p.cookieSeparator);l[0]&&(this.authenticatedId=l[0]),1<l.length&&l[1]&&(this.accountId=l[1])}}return p.prototype.setAuthenticatedUserContext=function(e,t,i){if(void 0===i&&(i=!1),!this.validateUserInput(e)||t&&!this.validateUserInput(t))this._logger.throwInternal(d.WARNING,_,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);else{this.authenticatedId=e;var n=this.authenticatedId;t&&(this.accountId=t,n=[this.authenticatedId,this.accountId].join(p.cookieSeparator)),i&&O.setCookie(this._logger,p.authUserCookieName,encodeURI(n),this.config.cookieDomain())}},p.prototype.clearAuthenticatedUserContext=function(){this.authenticatedId=null,this.accountId=null,O.deleteCookie(this._logger,p.authUserCookieName)},p.prototype.validateUserInput=function(e){return!("string"!=typeof e||!e||e.match(/,|;|=| |\|/))},p.cookieSeparator="|",p.userCookieName="ai_user",p.authUserCookieName="ai_authUser",p}(),ve=function(){},Se=function(e,t,i){this.traceID=e||O.newId(),this.parentID=t,this.name=i},xe=function(){function e(e,t){"undefined"!=typeof window&&(this.sessionManager=new ue(t,e),this.application=new le,this.device=new pe,this.internal=new he(t),this.location=new ve,this.user=new me(t,e),this.telemetryTrace=new Se,this.session=new ce,this.sample=new de(t.samplingPercentage(),e))}return e.prototype.applySessionContext=function(e){var t=this.session||this.sessionManager.automaticSession;t&&"string"==typeof t.id&&(e.ext.app.sesId=t.id),this.session&&("string"==typeof this.session.id?e.ext.app.sesId=this.session.id:e.ext.app.sesId=this.sessionManager.automaticSession.id)},e.prototype.applyOperatingSystemContxt=function(e){this.os&&this.os.name&&(e.ext.os=this.os)},e.prototype.applyApplicationContext=function(e){var t,i;this.application&&("string"==typeof this.application.ver&&e.tags.push(((t={})[se.applicationVersion]=this.application.ver,t)),"string"==typeof this.application.build&&e.tags.push(((i={})[se.applicationBuild]=this.application.build,i)))},e.prototype.applyDeviceContext=function(e){this.device&&("string"==typeof this.device.id&&(e.ext.device.localId=this.device.id),"string"==typeof this.device.ip&&(e.ext.device.ip=this.device.ip),"string"==typeof this.device.model&&(e.ext.device.model=this.device.model),"string"==typeof this.device.deviceClass&&(e.ext.device.deviceClass=this.device.deviceClass))},e.prototype.applyInternalContext=function(e){var t,i,n;this.internal&&("string"==typeof this.internal.agentVersion&&e.tags.push(((t={})[se.internalAgentVersion]=this.internal.agentVersion,t)),"string"==typeof this.internal.sdkVersion?e.tags.push(((i={})[se.internalSdkVersion]=this.internal.sdkVersion,i)):e[re.SDKExt]&&e[re.SDKExt][ae.libVer]&&e.tags.push(((n={})[se.internalSdkVersion]=e[re.SDKExt][ae.libVer],n)))},e.prototype.applyLocationContext=function(e){var t;this.location&&"string"==typeof this.location.ip&&e.tags.push(((t={})[se.locationIp]=this.location.ip,t))},e.prototype.applySampleContext=function(e){this.sample&&e.tags.push({SampleRate:this.sample.sampleRate})},e.prototype.applyOperationContext=function(e){if(this.telemetryTrace){var t=e.ext.trace||{traceID:void 0,parentID:void 0};"string"==typeof this.telemetryTrace.traceID&&(t.traceID=this.telemetryTrace.traceID),"string"==typeof this.telemetryTrace.name&&(t.name=this.telemetryTrace.name),"string"==typeof this.telemetryTrace.parentID&&(t.parentID=this.telemetryTrace.parentID),e.ext.trace=t}},e.prototype.applyWebContext=function(e){this.web&&(e.ext.web=e.ext.web||{},e.ext.web=this.web)},e.prototype.applyUserContext=function(e){var t;this.user&&(e.tags||(e.tags=[]),"string"==typeof this.user.accountId&&e.tags.push(((t={})[se.userAccountId]=this.user.accountId,t)),"string"==typeof this.user.id&&(e.ext.user.id=this.user.id),"string"==typeof this.user.authenticatedId&&(e.ext.user.authId=this.user.authenticatedId))},e.prototype.cleanUp=function(e){e.ext[re.DeviceExt]&&0===Object.keys(e.ext[re.DeviceExt]).length&&delete e.ext[re.DeviceExt],e.ext[re.UserExt]&&0===Object.keys(e.ext[re.UserExt]).length&&delete e.ext[re.UserExt],e.ext[re.WebExt]&&0===Object.keys(e.ext[re.WebExt]).length&&delete e.ext[re.WebExt],e.ext[re.OSExt]&&0===Object.keys(e.ext[re.OSExt]).length&&delete e.ext[re.OSExt],e.ext[re.AppExt]&&0===Object.keys(e.ext[re.AppExt]).length&&delete e.ext[re.AppExt],e.ext[re.TraceExt]&&0===Object.keys(e.ext[re.TraceExt]).length&&delete e.ext[re.TraceExt]},e}(),ye=function(){function c(){this.priority=170,this.identifier="AppInsightsPropertiesPlugin"}return c.getDefaultConfig=function(){return{instrumentationKey:function(){},accountId:function(){return null},sessionRenewalMs:function(){return 18e5},samplingPercentage:function(){return 100},sessionExpirationMs:function(){return 864e5},cookieDomain:function(){return null},sdkExtension:function(){return null},isBrowserLinkTrackingEnabled:function(){return!1},appId:function(){return null},namePrefix:function(){}}},c.prototype.initialize=function(t,e,i){var n=this,o=c.getDefaultConfig();this._extensionConfig=this._extensionConfig||c.getDefaultConfig();var r=function(e){a._extensionConfig[e]=function(){return ne.getConfig(t,e,n.identifier,o[e]())}},a=this;for(var s in o)r(s);this._logger=e.logger,this.context=new xe(e.logger,this._extensionConfig)},c.prototype.processTelemetry=function(e){r.isNullOrUndefined(e)||(this.context.sample.isSampledIn(e)&&(e.name===ie.envelopeType&&this._logger.resetInternalMessageCount(),this.context.session&&"string"!=typeof this.context.session.id&&this.context.sessionManager.update(),this._processTelemetryInternal(e)),r.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e))},c.prototype.setNextPlugin=function(e){this._nextPlugin=e},c.prototype._processTelemetryInternal=function(e){e.tags||(e.tags=[]),e.ext||(e.ext={}),e.ext[re.DeviceExt]=e.ext[re.DeviceExt]||{},e.ext[re.WebExt]=e.ext[re.WebExt]||{},e.ext[re.UserExt]=e.ext[re.UserExt]||{},e.ext[re.OSExt]=e.ext[re.OSExt]||{},e.ext[re.AppExt]=e.ext[re.AppExt]||{},e.ext[re.TraceExt]=e.ext[re.TraceExt]||{},this.context.applySessionContext(e),this.context.applyApplicationContext(e),this.context.applyDeviceContext(e),this.context.applyOperationContext(e),this.context.applyUserContext(e),this.context.applyOperatingSystemContxt(e),this.context.applyWebContext(e),this.context.applyLocationContext(e),this.context.applySampleContext(e),this.context.applyInternalContext(e),this.context.cleanUp(e)},c}();e.PropertiesPlugin=ye,e.TelemetryTrace=Se,e.TelemetryContext=xe,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-properties-js.min.js.map |
{ | ||
"name": "@microsoft/applicationinsights-properties-js", | ||
"version": "1.0.0-beta.12", | ||
"version": "2.0.0-beta.1", | ||
"description": "Microsoft Application Insights properties (Part A) plugin", | ||
@@ -31,4 +31,4 @@ "main": "dist/applicationinsights-properties-js.js", | ||
"dependencies": { | ||
"@microsoft/applicationinsights-core-js": "1.0.0-beta.5", | ||
"@microsoft/applicationinsights-common": "1.0.0-beta.17", | ||
"@microsoft/applicationinsights-core-js": "^2.0.0-beta.1", | ||
"@microsoft/applicationinsights-common": "^2.0.0-beta.1", | ||
"tslib": "^1.9.3" | ||
@@ -35,0 +35,0 @@ }, |
@@ -5,6 +5,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
import PropertiesPlugin from "./PropertiesPlugin"; | ||
import { IPropertiesPlugin } from "./Interfaces/IPropertiesPlugin"; | ||
import { ITelemetryContext } from "./Interfaces/ITelemetryContext"; | ||
import { Operation } from "./Context/Operation"; | ||
import { TelemetryTrace } from "./Context/TelemetryTrace"; | ||
import { TelemetryContext } from './TelemetryContext' | ||
export { PropertiesPlugin, IPropertiesPlugin, ITelemetryContext, Operation }; | ||
export { PropertiesPlugin, TelemetryTrace, TelemetryContext }; |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { IApplication } from '../Interfaces/Context/IApplication'; | ||
import { IApplication } from '@microsoft/applicationinsights-common'; | ||
@@ -6,0 +6,0 @@ export class Application implements IApplication { |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { IDevice } from '../Interfaces/Context/IDevice'; | ||
import { IDevice } from '@microsoft/applicationinsights-common'; | ||
@@ -11,3 +11,3 @@ export class Device implements IDevice { | ||
*/ | ||
public type: string; | ||
public deviceClass: string; | ||
@@ -20,5 +20,5 @@ /** | ||
/** | ||
* The device OEM for the current device. | ||
* The application screen resolution. | ||
*/ | ||
public oemName: string; | ||
resolution: string; | ||
@@ -31,37 +31,12 @@ /** | ||
/** | ||
* The IANA interface type for the internet connected network adapter. | ||
* Device identifier known at instrumentation time | ||
*/ | ||
public network: number; | ||
public localId: string; | ||
/** | ||
* The application screen resolution. | ||
* Device identifier known at instrumentation time | ||
*/ | ||
public resolution: string; | ||
/** | ||
* The current display language of the operating system. | ||
*/ | ||
public locale: string; | ||
/** | ||
* The IP address. | ||
*/ | ||
public ip: string; | ||
/** | ||
* The device language. | ||
*/ | ||
public language: string; | ||
/** | ||
* The OS name. | ||
*/ | ||
public os: string; | ||
/** | ||
* The OS version. | ||
*/ | ||
public osversion: string; | ||
/** | ||
* Constructs a new instance of the Device class | ||
@@ -75,4 +50,4 @@ */ | ||
// Setting it to 'Browser' allows to separate client and server dependencies/exceptions | ||
this.type = "Browser"; | ||
this.deviceClass = "Browser"; | ||
} | ||
} |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { IInternal } from '../Interfaces/Context/IInternal'; | ||
import { IInternal } from '@microsoft/applicationinsights-common'; | ||
import { ITelemetryConfig } from '../Interfaces/ITelemetryConfig'; | ||
@@ -6,0 +6,0 @@ |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { ILocation } from '../Interfaces/Context/ILocation'; | ||
import { ILocation } from '@microsoft/applicationinsights-common'; | ||
@@ -6,0 +6,0 @@ export class Location implements ILocation { |
@@ -5,3 +5,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
import { SamplingScoreGenerator } from '../SamplingScoreGenerator'; | ||
import { ISample } from '../Interfaces/Context/ISample'; | ||
import { ISample } from '@microsoft/applicationinsights-common'; | ||
import { IEnvelope } from '@microsoft/applicationinsights-common'; | ||
@@ -8,0 +8,0 @@ import { ITelemetryItem, IDiagnosticLogger, _InternalMessageId, LoggingSeverity, DiagnosticLogger, CoreUtils } from '@microsoft/applicationinsights-core-js'; |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { ISession } from '../Interfaces/Context/ISession'; | ||
import { ISession } from '@microsoft/applicationinsights-common'; | ||
import { | ||
@@ -14,2 +14,3 @@ Util, DateTimeUtils | ||
cookieDomain: () => string; | ||
namePrefix?: () => string; | ||
} | ||
@@ -23,7 +24,2 @@ | ||
/** | ||
* The true if this is the first session | ||
*/ | ||
public isFirst: boolean; | ||
/** | ||
@@ -50,5 +46,7 @@ * The date at which this guid was genereated. | ||
public config: ISessionConfig; | ||
private static cookieNameConst = 'ai_session'; | ||
private cookieUpdatedTimestamp: number; | ||
private _logger: IDiagnosticLogger; | ||
private _storageNamePrefix: () => string; | ||
@@ -75,2 +73,3 @@ constructor(config: ISessionConfig, logger?: IDiagnosticLogger) { | ||
this.config = config; | ||
this._storageNamePrefix = () => this.config.namePrefix && this.config.namePrefix() ? _SessionManager.cookieNameConst + this.config.namePrefix() : _SessionManager.cookieNameConst; | ||
@@ -93,3 +92,2 @@ this.automaticSession = new Session(); | ||
// update automaticSession so session state has correct id | ||
this.automaticSession.isFirst = undefined; | ||
this.renew(); | ||
@@ -115,7 +113,7 @@ } else { | ||
/** | ||
* Use ai_session cookie data or local storage data (when the cookie is unavailable) to | ||
* Use config.namePrefix + ai_session cookie data or local storage data (when the cookie is unavailable) to | ||
* initialize the automatic session. | ||
*/ | ||
private initializeAutomaticSession() { | ||
var cookie = Util.getCookie(this._logger, 'ai_session'); | ||
var cookie = Util.getCookie(this._logger, this._storageNamePrefix()); | ||
if (cookie && typeof cookie.split === "function") { | ||
@@ -128,3 +126,3 @@ this.initializeAutomaticSessionWithData(cookie); | ||
// The User class handles this for us and deletes our local storage object if the persistent user cookie was removed. | ||
var storage = Util.getStorage(this._logger, 'ai_session'); | ||
var storage = Util.getStorage(this._logger, this._storageNamePrefix()); | ||
if (storage) { | ||
@@ -136,3 +134,2 @@ this.initializeAutomaticSessionWithData(storage); | ||
if (!this.automaticSession.id) { | ||
this.automaticSession.isFirst = true; | ||
this.renew(); | ||
@@ -215,3 +212,3 @@ } | ||
Util.setCookie(this._logger, 'ai_session', cookie.join('|') + ';expires=' + cookieExpiry.toUTCString(), cookieDomnain); | ||
Util.setCookie(this._logger, this._storageNamePrefix(), cookie.join('|') + ';expires=' + cookieExpiry.toUTCString(), cookieDomnain); | ||
@@ -225,4 +222,4 @@ this.cookieUpdatedTimestamp = DateTimeUtils.Now(); | ||
// The server will notice this and end the sessions itself, with loss of accurate session duration | ||
Util.setStorage(this._logger, 'ai_session', [guid, acq, renewal].join('|')); | ||
Util.setStorage(this._logger, this._storageNamePrefix(), [guid, acq, renewal].join('|')); | ||
} | ||
} |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { IUser, IUserContextPlugin } from '../Interfaces/Context/IUser'; | ||
import { ITelemetryConfig } from '../Interfaces/ITelemetryConfig'; | ||
import { Util } from '@microsoft/applicationinsights-common'; | ||
import { Util, IUser } from '@microsoft/applicationinsights-common'; | ||
import { IDiagnosticLogger, _InternalMessageId, LoggingSeverity } from '@microsoft/applicationinsights-core-js'; | ||
export class User implements IUser, IUserContextPlugin { | ||
export class User implements IUser { | ||
@@ -31,2 +30,7 @@ static cookieSeparator: string = '|'; | ||
/** | ||
* The localId | ||
*/ | ||
public localId: string; | ||
/** | ||
* The account ID. | ||
@@ -41,12 +45,2 @@ */ | ||
/** | ||
* The user agent string. | ||
*/ | ||
public agent: string; | ||
/** | ||
* The store region. | ||
*/ | ||
public storeRegion: string; | ||
private _logger: IDiagnosticLogger; | ||
@@ -127,5 +121,6 @@ | ||
// If we have an ai_session in local storage this means the user actively removed our cookies. | ||
// If we have an config.namePrefix() + ai_session in local storage this means the user actively removed our cookies. | ||
// We should respect their wishes and clear ourselves from local storage | ||
Util.removeStorage(this._logger, 'ai_session'); | ||
const name = config.namePrefix && config.namePrefix() ? config.namePrefix() + 'ai_session' : 'ai_session'; | ||
Util.removeStorage(this._logger, name); | ||
} | ||
@@ -132,0 +127,0 @@ |
@@ -14,2 +14,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
appId: () => string; | ||
namePrefix: () => string; | ||
} |
@@ -8,31 +8,15 @@ /** | ||
ITelemetryPlugin, IConfiguration, CoreUtils, | ||
IAppInsightsCore, IPlugin, ITelemetryItem | ||
IAppInsightsCore, IPlugin, ITelemetryItem, IDiagnosticLogger | ||
} from '@microsoft/applicationinsights-core-js'; | ||
import { TelemetryContext } from './TelemetryContext'; | ||
import { PageView, ConfigurationManager, | ||
WebExtensionKeys, DeviceExtensionKeys, | ||
IConfig, UserExtensionKeys, UserTagKeys, AppExtensionKeys, | ||
IngestExtKeys, OSExtKeys, CtxTagKeys } from '@microsoft/applicationinsights-common'; | ||
import { Session, _SessionManager } from './Context/Session'; | ||
import { Application } from './Context/Application'; | ||
import { Device } from './Context/Device'; | ||
import { Internal } from './Context/Internal'; | ||
import { Location } from './Context/Location'; | ||
import { Operation } from './Context/Operation'; | ||
import { User } from './Context/User'; | ||
import { Sample } from './Context/Sample'; | ||
IConfig, PropertiesPluginIdentifier, IPropertiesPlugin, Extensions, IDevice } from '@microsoft/applicationinsights-common'; | ||
import { ITelemetryConfig } from './Interfaces/ITelemetryConfig'; | ||
import { ITelemetryContext } from './Interfaces/ITelemetryContext'; | ||
export default class PropertiesPlugin implements ITelemetryPlugin, ITelemetryContext { | ||
export default class PropertiesPlugin implements ITelemetryPlugin, IPropertiesPlugin { | ||
public context: TelemetryContext; | ||
private _logger: IDiagnosticLogger; | ||
public priority = 170; | ||
public identifier = "AppInsightsPropertiesPlugin"; | ||
public application: Application; // The object describing a component tracked by this object. | ||
public device: Device; // The object describing a device tracked by this object. | ||
public location: Location; // The object describing a location tracked by this object. | ||
public operation: Operation; // The object describing a operation tracked by this object. | ||
public user: User; // The object describing a user tracked by this object. | ||
public internal: Internal; | ||
public session: Session; // The object describing a session tracked by this object. | ||
public sample: Sample; | ||
public _sessionManager: _SessionManager; // The session manager that manages session on the base of cookies. | ||
public identifier = PropertiesPluginIdentifier; | ||
@@ -52,3 +36,4 @@ private _nextPlugin: ITelemetryPlugin; | ||
isBrowserLinkTrackingEnabled: () => false, | ||
appId: () => null | ||
appId: () => null, | ||
namePrefix: () => undefined | ||
} | ||
@@ -64,14 +49,5 @@ return defaultConfig; | ||
} | ||
if (typeof window !== 'undefined') { | ||
this._sessionManager = new _SessionManager(this._extensionConfig, core.logger); | ||
this.application = new Application(); | ||
this.device = new Device(); | ||
this.internal = new Internal(this._extensionConfig); | ||
this.location = new Location(); | ||
this.user = new User(this._extensionConfig, core.logger); | ||
this.operation = new Operation(); | ||
this.session = new Session(); | ||
this.sample = new Sample(this._extensionConfig.samplingPercentage(), core.logger); | ||
} | ||
this._logger = core.logger; | ||
this.context = new TelemetryContext(core.logger, this._extensionConfig); | ||
} | ||
@@ -88,13 +64,12 @@ | ||
// if the event is not sampled in, do not bother going through the pipeline | ||
if (this.sample.isSampledIn(event)) { | ||
if (this.context.sample.isSampledIn(event)) { | ||
// If the envelope is PageView, reset the internal message count so that we can send internal telemetry for the new page. | ||
if (event.name === PageView.envelopeType) { | ||
// TODO(barustum): resetInternalMessageCount once we have support for internal logging | ||
//_InternalLogging.resetInternalMessageCount(); | ||
this._logger.resetInternalMessageCount(); | ||
} | ||
if (this.session) { | ||
if (this.context.session) { | ||
// If customer did not provide custom session id update the session manager | ||
if (typeof this.session.id !== "string") { | ||
this._sessionManager.update(); | ||
if (typeof this.context.session.id !== "string") { | ||
this.context.sessionManager.update(); | ||
} | ||
@@ -122,11 +97,3 @@ } | ||
if (this.session) { | ||
// If customer set id, apply his context; otherwise apply context generated from cookies | ||
if (typeof this.session.id === "string") { | ||
this._applySessionContext(event, this.session); | ||
} else { | ||
this._applySessionContext(event, this._sessionManager.automaticSession); | ||
} | ||
} | ||
// set part A fields | ||
@@ -136,160 +103,26 @@ if (!event.tags) { | ||
} | ||
if (!event.ctx) { | ||
event.ctx = {}; | ||
if (!event.ext) { | ||
event.ext = {}; | ||
} | ||
event.ext[Extensions.DeviceExt] = event.ext[Extensions.DeviceExt] || {}; | ||
event.ext[Extensions.WebExt] = event.ext[Extensions.WebExt] || {}; | ||
event.ext[Extensions.UserExt] = event.ext[Extensions.UserExt] || {}; | ||
event.ext[Extensions.OSExt] = event.ext[Extensions.OSExt] || {}; | ||
event.ext[Extensions.AppExt] = event.ext[Extensions.AppExt] || {}; | ||
event.ext[Extensions.TraceExt] = event.ext[Extensions.TraceExt] || {}; | ||
this.context.applySessionContext(event); | ||
this.context.applyApplicationContext(event); | ||
this.context.applyDeviceContext(event); | ||
this.context.applyOperationContext(event); | ||
this.context.applyUserContext(event); | ||
this.context.applyOperatingSystemContxt(event); | ||
this.context.applyWebContext(event); | ||
this._applyApplicationContext(event, this.application); | ||
this._applyDeviceContext(event, this.device); | ||
this._applyInternalContext(event, this.internal); | ||
this._applyLocationContext(event, this.location); | ||
this._applySampleContext(event, this.sample); | ||
this._applyOperationContext(event, this.operation); | ||
this._applyUserContext(event, this.user); | ||
this.context.applyLocationContext(event); // legacy tags | ||
this.context.applySampleContext(event); // legacy tags | ||
this.context.applyInternalContext(event); // legacy tags | ||
this.context.cleanUp(event); | ||
} | ||
private _applySessionContext(event: ITelemetryItem, sessionContext: Session) { | ||
if (sessionContext) { | ||
if (typeof sessionContext.id === "string") { | ||
event.ctx[AppExtensionKeys.sessionId] = sessionContext.id; | ||
} | ||
if (typeof sessionContext.isFirst !== "undefined") { | ||
event.tags[CtxTagKeys.sessionIsFirst] = sessionContext.isFirst; | ||
} | ||
} | ||
} | ||
private _applyApplicationContext(event: ITelemetryItem, appContext: Application) { | ||
if (appContext) { | ||
if (typeof appContext.ver === "string") { | ||
event.tags[CtxTagKeys.applicationVersion] = appContext.ver; | ||
} | ||
if (typeof appContext.build === "string") { | ||
event.tags[CtxTagKeys.applicationBuild] = appContext.build; | ||
} | ||
} | ||
} | ||
private _applyDeviceContext(event: ITelemetryItem, deviceContext: Device) { | ||
if (deviceContext) { | ||
if (typeof deviceContext.id === "string") { | ||
event.ctx[DeviceExtensionKeys.localId] = deviceContext.id; | ||
} | ||
if (typeof deviceContext.ip === "string") { | ||
event.ctx[IngestExtKeys.clientIp] = deviceContext.ip; | ||
} | ||
if (typeof deviceContext.language === "string") { | ||
event.ctx[WebExtensionKeys.browserLang] = deviceContext.language; | ||
} | ||
if (typeof deviceContext.locale === "string") { | ||
event.tags[CtxTagKeys.deviceLocale] = deviceContext.locale; | ||
} | ||
if (typeof deviceContext.model === "string") { | ||
event.ctx[DeviceExtensionKeys.model] = deviceContext.model; | ||
} | ||
if (typeof deviceContext.network !== "undefined") { | ||
event.tags[CtxTagKeys.deviceNetwork] = deviceContext.network; // not mapped in CS 4.0 | ||
} | ||
if (typeof deviceContext.oemName === "string") { | ||
event.tags[CtxTagKeys.deviceOEMName] = deviceContext.oemName; // not mapped in CS 4.0 | ||
} | ||
if (typeof deviceContext.os === "string") { | ||
event.ctx[OSExtKeys.deviceOS] = deviceContext.os; | ||
} | ||
if (typeof deviceContext.osversion === "string") { | ||
event.tags[CtxTagKeys.deviceOSVersion] = deviceContext.osversion; // not mapped in CS 4.0 | ||
} | ||
if (typeof deviceContext.resolution === "string") { | ||
event.ctx[WebExtensionKeys.screenRes] = deviceContext.resolution; | ||
} | ||
if (typeof deviceContext.type === "string") { | ||
event.ctx[DeviceExtensionKeys.deviceType] = deviceContext.type; | ||
} | ||
} | ||
} | ||
private _applyInternalContext(event: ITelemetryItem, internalContext: Internal) { | ||
if (internalContext) { | ||
if (typeof internalContext.agentVersion === "string") { | ||
event.tags[CtxTagKeys.internalAgentVersion] = internalContext.agentVersion; // not mapped in CS 4.0 | ||
} | ||
if (typeof internalContext.sdkVersion === "string") { | ||
event.tags[CtxTagKeys.internalSdkVersion] = internalContext.sdkVersion; // not mapped in CS 4.0 | ||
} | ||
} | ||
} | ||
private _applyLocationContext(event: ITelemetryItem, locationContext: Location) { | ||
if (locationContext) { | ||
if (typeof locationContext.ip === "string") { | ||
event.tags[CtxTagKeys.locationIp] = locationContext.ip; // not mapped in CS 4.0 | ||
} | ||
} | ||
} | ||
private _applySampleContext(event: ITelemetryItem, sampleContext: Sample) { | ||
if (sampleContext) { | ||
event.tags["sampleRate"] = sampleContext.sampleRate; // tags.sampleRate -> mapped in CS 4.0 | ||
} | ||
} | ||
private _applyOperationContext(event: ITelemetryItem, operationContext: Operation) { | ||
if (operationContext) { | ||
if (typeof operationContext.id === "string") { | ||
event.tags[CtxTagKeys.operationId] = operationContext.id; // not mapped in CS 4.0 | ||
} | ||
if (typeof operationContext.name === "string") { | ||
event.tags[CtxTagKeys.operationName] = operationContext.name; // not mapped in CS 4.0 | ||
} | ||
if (typeof operationContext.parentId === "string") { | ||
event.tags[CtxTagKeys.operationParentId] = operationContext.parentId; // not mapped in CS 4.0 | ||
} | ||
if (typeof operationContext.rootId === "string") { | ||
event.tags[CtxTagKeys.operationRootId] = operationContext.rootId; // not mapped in CS 4.0 | ||
} | ||
if (typeof operationContext.syntheticSource === "string") { | ||
event.tags[CtxTagKeys.operationSyntheticSource] = operationContext.syntheticSource; // not mapped in CS 4.0 | ||
} | ||
} | ||
} | ||
private _applyUserContext(event: ITelemetryItem, userContext: User) { | ||
if (userContext) { | ||
if (!event.tags) { | ||
event.tags = []; | ||
} | ||
if (typeof userContext.agent === "string") { | ||
let val = userContext.agent; | ||
let ky = CtxTagKeys.userAgent; | ||
event.tags.push({ ky: val }); // ai.user.agent stays under tags | ||
} | ||
if (typeof userContext.storeRegion === "string") { | ||
let ky = CtxTagKeys.userStoreRegion; // "ai.user.storeRegion" stays under tags | ||
let val = userContext.storeRegion; | ||
event.tags.push({ky: val}); | ||
} | ||
// stays in tags under User extension | ||
if (typeof userContext.accountId === "string") { | ||
let item = {}; | ||
item[UserTagKeys.accountId] = userContext.accountId; | ||
event.tags.push(item); | ||
} | ||
// CS 4.0 | ||
if (typeof userContext.id === "string") { | ||
event.ctx[UserExtensionKeys.id] = userContext.id; | ||
} | ||
if (typeof userContext.authenticatedId === "string") { | ||
event.ctx[UserExtensionKeys.authId] = userContext.authenticatedId; | ||
} | ||
} | ||
} | ||
} |
import PropertiesPlugin from "./PropertiesPlugin"; | ||
import { IPropertiesPlugin } from "./Interfaces/IPropertiesPlugin"; | ||
import { ITelemetryContext } from "./Interfaces/ITelemetryContext"; | ||
import { Operation } from "./Context/Operation"; | ||
export { PropertiesPlugin, IPropertiesPlugin, ITelemetryContext, Operation }; | ||
import { TelemetryTrace } from "./Context/TelemetryTrace"; | ||
import { TelemetryContext } from './TelemetryContext'; | ||
export { PropertiesPlugin, TelemetryTrace, TelemetryContext }; |
@@ -1,2 +0,2 @@ | ||
import { IApplication } from '../Interfaces/Context/IApplication'; | ||
import { IApplication } from '@microsoft/applicationinsights-common'; | ||
export declare class Application implements IApplication { | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { IDevice } from '../Interfaces/Context/IDevice'; | ||
import { IDevice } from '@microsoft/applicationinsights-common'; | ||
export declare class Device implements IDevice { | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
type: string; | ||
deviceClass: string; | ||
/** | ||
@@ -13,5 +13,5 @@ * A device unique ID. | ||
/** | ||
* The device OEM for the current device. | ||
* The application screen resolution. | ||
*/ | ||
oemName: string; | ||
resolution: string; | ||
/** | ||
@@ -22,30 +22,10 @@ * The device model for the current device. | ||
/** | ||
* The IANA interface type for the internet connected network adapter. | ||
* Device identifier known at instrumentation time | ||
*/ | ||
network: number; | ||
localId: string; | ||
/** | ||
* The application screen resolution. | ||
* Device identifier known at instrumentation time | ||
*/ | ||
resolution: string; | ||
/** | ||
* The current display language of the operating system. | ||
*/ | ||
locale: string; | ||
/** | ||
* The IP address. | ||
*/ | ||
ip: string; | ||
/** | ||
* The device language. | ||
*/ | ||
language: string; | ||
/** | ||
* The OS name. | ||
*/ | ||
os: string; | ||
/** | ||
* The OS version. | ||
*/ | ||
osversion: string; | ||
/** | ||
* Constructs a new instance of the Device class | ||
@@ -52,0 +32,0 @@ */ |
@@ -1,2 +0,2 @@ | ||
import { IInternal } from '../Interfaces/Context/IInternal'; | ||
import { IInternal } from '@microsoft/applicationinsights-common'; | ||
import { ITelemetryConfig } from '../Interfaces/ITelemetryConfig'; | ||
@@ -3,0 +3,0 @@ export declare class Internal implements IInternal { |
@@ -1,2 +0,2 @@ | ||
import { ILocation } from '../Interfaces/Context/ILocation'; | ||
import { ILocation } from '@microsoft/applicationinsights-common'; | ||
export declare class Location implements ILocation { | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { ISample } from '../Interfaces/Context/ISample'; | ||
import { ISample } from '@microsoft/applicationinsights-common'; | ||
import { ITelemetryItem, IDiagnosticLogger } from '@microsoft/applicationinsights-core-js'; | ||
@@ -3,0 +3,0 @@ export declare class Sample implements ISample { |
@@ -1,2 +0,2 @@ | ||
import { ISession } from '../Interfaces/Context/ISession'; | ||
import { ISession } from '@microsoft/applicationinsights-common'; | ||
import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js'; | ||
@@ -7,2 +7,3 @@ export interface ISessionConfig { | ||
cookieDomain: () => string; | ||
namePrefix?: () => string; | ||
} | ||
@@ -15,6 +16,2 @@ export declare class Session implements ISession { | ||
/** | ||
* The true if this is the first session | ||
*/ | ||
isFirst: boolean; | ||
/** | ||
* The date at which this guid was genereated. | ||
@@ -37,4 +34,6 @@ * Per the spec the ID will be regenerated if more than acquisitionSpan milliseconds ellapse from this time. | ||
config: ISessionConfig; | ||
private static cookieNameConst; | ||
private cookieUpdatedTimestamp; | ||
private _logger; | ||
private _storageNamePrefix; | ||
constructor(config: ISessionConfig, logger?: IDiagnosticLogger); | ||
@@ -49,3 +48,3 @@ update(): void; | ||
/** | ||
* Use ai_session cookie data or local storage data (when the cookie is unavailable) to | ||
* Use config.namePrefix + ai_session cookie data or local storage data (when the cookie is unavailable) to | ||
* initialize the automatic session. | ||
@@ -52,0 +51,0 @@ */ |
@@ -1,5 +0,5 @@ | ||
import { IUser, IUserContextPlugin } from '../Interfaces/Context/IUser'; | ||
import { ITelemetryConfig } from '../Interfaces/ITelemetryConfig'; | ||
import { IUser } from '@microsoft/applicationinsights-common'; | ||
import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js'; | ||
export declare class User implements IUser, IUserContextPlugin { | ||
export declare class User implements IUser { | ||
static cookieSeparator: string; | ||
@@ -21,2 +21,6 @@ static userCookieName: string; | ||
/** | ||
* The localId | ||
*/ | ||
localId: string; | ||
/** | ||
* The account ID. | ||
@@ -29,10 +33,2 @@ */ | ||
accountAcquisitionDate: string; | ||
/** | ||
* The user agent string. | ||
*/ | ||
agent: string; | ||
/** | ||
* The store region. | ||
*/ | ||
storeRegion: string; | ||
private _logger; | ||
@@ -39,0 +35,0 @@ /** |
@@ -11,2 +11,3 @@ export interface ITelemetryConfig { | ||
appId: () => string; | ||
namePrefix: () => string; | ||
} |
@@ -6,25 +6,10 @@ /** | ||
import { ITelemetryPlugin, IConfiguration, IAppInsightsCore, IPlugin, ITelemetryItem } from '@microsoft/applicationinsights-core-js'; | ||
import { IConfig } from '@microsoft/applicationinsights-common'; | ||
import { Session, _SessionManager } from './Context/Session'; | ||
import { Application } from './Context/Application'; | ||
import { Device } from './Context/Device'; | ||
import { Internal } from './Context/Internal'; | ||
import { Location } from './Context/Location'; | ||
import { Operation } from './Context/Operation'; | ||
import { User } from './Context/User'; | ||
import { Sample } from './Context/Sample'; | ||
import { TelemetryContext } from './TelemetryContext'; | ||
import { IConfig, IPropertiesPlugin } from '@microsoft/applicationinsights-common'; | ||
import { ITelemetryConfig } from './Interfaces/ITelemetryConfig'; | ||
import { ITelemetryContext } from './Interfaces/ITelemetryContext'; | ||
export default class PropertiesPlugin implements ITelemetryPlugin, ITelemetryContext { | ||
export default class PropertiesPlugin implements ITelemetryPlugin, IPropertiesPlugin { | ||
context: TelemetryContext; | ||
private _logger; | ||
priority: number; | ||
identifier: string; | ||
application: Application; | ||
device: Device; | ||
location: Location; | ||
operation: Operation; | ||
user: User; | ||
internal: Internal; | ||
session: Session; | ||
sample: Sample; | ||
_sessionManager: _SessionManager; | ||
private _nextPlugin; | ||
@@ -45,10 +30,2 @@ private _extensionConfig; | ||
private _processTelemetryInternal(event); | ||
private _applySessionContext(event, sessionContext); | ||
private _applyApplicationContext(event, appContext); | ||
private _applyDeviceContext(event, deviceContext); | ||
private _applyInternalContext(event, internalContext); | ||
private _applyLocationContext(event, locationContext); | ||
private _applySampleContext(event, sampleContext); | ||
private _applyOperationContext(event, operationContext); | ||
private _applyUserContext(event, userContext); | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1362007
68
7171
+ Added@microsoft/applicationinsights-common@2.8.18(transitive)
+ Added@microsoft/applicationinsights-core-js@2.8.18(transitive)
+ Added@microsoft/applicationinsights-shims@2.0.2(transitive)
+ Added@microsoft/dynamicproto-js@1.1.11(transitive)
- Removed@microsoft/applicationinsights-common@1.0.0-beta.17(transitive)
- Removed@microsoft/applicationinsights-core-js@1.0.0-beta.5(transitive)