ai.js 36 KB

1
  1. var appInsights,Debug,AppInsights;(function(n){(function(t){"use strict";var f=function(){function t(n){var t=n.lastIndexOf("/");this.name=n.substr(t+1);this.path=n.substring(0,t)}return t.prototype.toString=function(){var t="",i;return n.Internal.assertValue(this.path)&&(t=this.path),i={eN:this.name,eP:t,eV:""},JSON.stringify(i)},t}(),i,r,u;t.SimpleEvent=f;i=function(){function n(n,t){this.name=n;this.value=t}return n.prototype.toString=function(){var n={pN:this.name,pV:this.value};return JSON.stringify(n)},n}();t.SimpleProperty=i;r=function(){function n(n,t){this.id=n;this.structure=t}return n.prototype.toString=function(){var n={vN:this.id,vP:this.structure};return JSON.stringify(n)},n}();t.ViewHierarchy=r;u=function(){function n(n,t,i){this.message=n;this.url=t;this.lineNumber=i}return n.prototype.toString=function(){return JSON.stringify({message:this.message,url:this.url,lineNumber:this.lineNumber})},n}();t.ErrorData=u})(n.Internal||(n.Internal={}));var t=n.Internal})(AppInsights||(AppInsights={})),function(n){(function(n){"use strict";var i,r,u,f,e,o,t;n.ajaxDisabledPropertyName="appInsightsAjaxDisabled",function(n){n[n.Error=0]="Error";n[n.Warning=1]="Warning";n[n.Information=2]="Information"}(n.debugMessageTypes||(n.debugMessageTypes={}));i=n.debugMessageTypes,function(n){n[n.Off=0]="Off";n[n.Error=1]="Error";n[n.Warning=2]="Warning";n[n.Information=3]="Information";n[n.Alert=4]="Alert"}(n.traceModeTypes||(n.traceModeTypes={}));r=n.traceModeTypes,function(n){n[n.Attribute=1]="Attribute";n[n.Variable=2]="Variable"}(n.listNodeTypes||(n.listNodeTypes={}));u=n.listNodeTypes,function(n){n[n.string=0]="string";n[n.number=1]="number";n[n.object=2]="object"}(n.dataTypes||(n.dataTypes={}));f=n.dataTypes,function(n){n[n.page=0]="page";n[n.link=1]="link";n[n.event=2]="event";n[n.timed=3]="timed";n[n.action=4]="action";n[n.perf=5]="perf";n[n.ajax=6]="ajax";n[n.error=7]="error";n[n.ierror=8]="ierror"}(n.payLoadTypes||(n.payLoadTypes={}));e=n.payLoadTypes,function(n){n[n.PageAlias=0]="PageAlias";n[n.ProfileId=1]="ProfileId";n[n.UserIdentity=2]="UserIdentity";n[n.Referrer=3]="Referrer";n[n.Language=4]="Language";n[n.TimeZone=5]="TimeZone";n[n.Screen=6]="Screen";n[n.TargetPage=7]="TargetPage";n[n.Links=8]="Links";n[n.LinkAlias=9]="LinkAlias";n[n.Events=10]="Events";n[n.CustomUserId=11]="CustomUserId";n[n.AccountId=12]="AccountId";n[n.Views=13]="Views";n[n.CustomDimensions=14]="CustomDimensions";n[n.CustomMetrics=15]="CustomMetrics";n[n.CookieCreationDate=16]="CookieCreationDate";n[n.PagePerformance=17]="PagePerformance";n[n.Ajax=18]="Ajax";n[n.Error=19]="Error";n[n.IError=20]="IError";n[n.IsDeveloperData=21]="IsDeveloperData"}(n.taxonomyNameTypes||(n.taxonomyNameTypes={}));o=n.taxonomyNameTypes,function(n){n[n.AccountId=0]="AccountId";n[n.Ajax=1]="Ajax";n[n.CookieCreationDate=2]="CookieCreationDate";n[n.CustomDimensions=3]="CustomDimensions";n[n.CustomMetrics=4]="CustomMetrics";n[n.CustomUserId=5]="CustomUserId";n[n.Error=6]="Error";n[n.Events=7]="Events";n[n.IError=8]="IError";n[n.Language=9]="Language";n[n.LinkAlias=10]="LinkAlias";n[n.Links=11]="Links";n[n.PageAlias=12]="PageAlias";n[n.PagePerformance=13]="PagePerformance";n[n.ProfileId=14]="ProfileId";n[n.Referrer=15]="Referrer";n[n.Screen=16]="Screen";n[n.ScriptAction=17]="ScriptAction";n[n.ScriptVersion=18]="ScriptVersion";n[n.SourceType=19]="SourceType";n[n.TargetPage=20]="TargetPage";n[n.TimeZone=21]="TimeZone";n[n.UserIdentity=22]="UserIdentity";n[n.Views=23]="Views";n[n.IsDeveloperData=24]="IsDeveloperData"}(n.taxonomyParamTypes||(n.taxonomyParamTypes={}));t=n.taxonomyParamTypes;t[0]="aid";t[1]="ajax";t[2]="ica";t[3]="prp";t[4]="met";t[5]="cuid";t[6]="error";t[7]="evt";t[8]="interror";t[9]="lng";t[10]="als";t[11]="lnk";t[12]="als";t[13]="perf";t[14]="pid";t[15]="rf";t[16]="scr";t[17]="jsa";t[18]="jsv";t[19]="st";t[20]="tp";t[21]="tz";t[22]="uid";t[23]="vh";t[24]="idd"})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(n){"use strict";var i="dc.services.visualstudio.com",r="f5.services.visualstudio.com",u="_da.gif",f="stats",e=17,o="js",s=2e3,t=function(){function n(){this.pagePath=null;this.cookieName="aiInfo";this.debugEnabled=!1;this.traceMode=0;this.maxVisitorCookieLifeMS=63072e6;this.maxSessionLiftMS=18e5}return n.prototype.getImageHost=function(){return i},n.prototype.getImageFile=function(){return u},n.prototype.getDeveloperImageHost=function(){return r},n.prototype.getPostHandler=function(){return f},n.prototype.getVersion=function(){return e},n.prototype.getSourceType=function(){return o},n.prototype.getMaxUrlLength=function(){return s},n}();n.Settings=t;n.settings=new t})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";function f(n){return!i.isNullOrUndefined(n)}function u(t,i){return f(t)&&typeof t===n.Internal.dataTypes[i]}function o(n){return u(n,1)||(n=parseFloat(n)),!isNaN(n)&&isFinite(n)}function h(n,t){if(!i.isNullOrUndefined(n))for(var r=0;r<n.length;r++)if(t(n[r]))return r;return-1}function c(n){return n===7||n===23||n===3||n===4}function a(n){try{n()}catch(t){}}function v(t,i){if(u(i,1)&&n.Internal.settings.debugEnabled)switch(i){case 0:console.error(t);break;case 1:console.warn(t);break;case 2:console.info(t)}}function p(n){return n=n/1e3,parseFloat(((n-315532800)/86400).toFixed(0))}function w(n){return typeof n=="undefined"&&(n=null),n=n||new Date,-Math.round(n.getTimezoneOffset()/60)}var s,i,r,l,e,y;t.assertValue=f;t.assertType=u;t.isNumeric=o,function(n){function r(n,t,r,u){var o="",f,e;return!i.isNullOrUndefined(n)&&n.length>0&&(f=n.indexOf(t),f!==-1&&(u||(f=f+t.length),e=n.indexOf(r,f),e===-1&&(e=n.length),o=n.substring(f,e))),o}function u(n,i,r){if(t.assertType(n,0)&&n.length>0&&t.assertType(r,1)&&t.assertType(i,1)){var u=n.substring(0,i);return r>-1&&(u+=n.substring(r)),u}return""}n.substring=r;n.remove=u}(t.Strings||(t.Strings={}));s=t.Strings,function(n){function t(n){return typeof n=="undefined"||n===null}function i(){var n=null;try{n=window.localStorage}catch(t){}return n}function r(){var n=null;try{n=window.sessionStorage}catch(t){}return n}n.isNullOrUndefined=t;n.getWindowLocalStorage=i;n.getWindowSessionStorage=r}(t.Extensions||(t.Extensions={}));i=t.Extensions;t.arrayIndexOf=h,function(n){function i(){var n=new Date,t=n.getTime(),i=n.getTimezoneOffset()*6e4;return t+i}function r(){return(new Date).getTime()}function u(n,i){if(!t.assertType(n,1)||!t.assertType(i,1)||n===0||i===0)return 0;var r=i-n;return Math.max(r,0)}n.utcNow=i;n.now=r;n.getDuration=u}(t.DateTime||(t.DateTime={}));r=t.DateTime;t.isArrayBeacon=c,function(n){function t(){return!i.isNullOrUndefined(window.performance)&&!i.isNullOrUndefined(window.performance.timing)&&!i.isNullOrUndefined(window.performance.timing.responseStart)}n.supportsPerformanceTimingApi=t}(t.Browser||(t.Browser={}));l=t.Browser;e=function(){function n(){this.netCon=r.getDuration(window.performance.timing.navigationStart,window.performance.timing.connectEnd);this.sendReq=r.getDuration(window.performance.timing.requestStart,window.performance.timing.responseStart);this.recResp=r.getDuration(window.performance.timing.responseStart,window.performance.timing.responseEnd);this.clientProc=r.getDuration(window.performance.timing.domLoading,window.performance.timing.loadEventEnd);this.ptotal=r.getDuration(window.performance.timing.domainLookupStart,window.performance.timing.loadEventEnd)}return n}();t.PageMetrics=e;t.tryCatchSwallowWrapper=a;t.debugMessage=v,function(n){function t(){var i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n=[],r,t;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",t=0;t<36;t++)n[t]||(r=Math.floor(Math.random()*i.length),n[t]=i[r]);return n.join("")}n.create=t}(t.UniqueId||(t.UniqueId={}));y=t.UniqueId;t.getDaysSince1980=p;t.calculateTimezone=w})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";var i=function(){function t(){this.taxonomy=[];this.payload={};this.addToTaxonomy(1,14,1);this.addToTaxonomy(21,24,1);this.addToTaxonomy(2,22,1);this.addToTaxonomy(7,20,1);this.addToTaxonomy(3,15,1);this.addToTaxonomy(4,9,1);this.addToTaxonomy(5,21,1);this.addToTaxonomy(6,16,1);this.addToTaxonomy(16,2,2)}return t.prototype.addToPayload=function(t,i){this.payload[n.Internal.taxonomyNameTypes[t]]=i},t.prototype.getFromPayload=function(t){return this.payload[n.Internal.taxonomyNameTypes[t]]},t.prototype.addToTaxonomy=function(t,i,r){return n.Internal.arrayIndexOf(this.taxonomy,function(n){return n.key===t})>=0?!1:(this.taxonomy.push({key:t,data:i,type:r}),!0)},t.prototype.addToPayloadCollection=function(t,i){var r=this.getFromPayload(t);n.Internal.assertValue(r)||(r=[],r.isPayloadCollection=!0,this.addToPayload(t,r));r.push(i)},t.prototype.processTaxonomy=function(t){var i,r,s,f,e,o;if(!n.Internal.assertType(t,0))return"";var u={},h="&rnd="+n.Internal.DateTime.now();for(i=0;i<this.taxonomy.length;i++)if(r=this.taxonomy[i],r.type===1)s=this.addAttribute(r),t+=s;else{f=this.addVariable(r);e=n.Internal.taxonomyParamTypes[r.data];try{u[e]=JSON.parse(f)}catch(c){u[e]=f}delete this.payload[n.Internal.taxonomyNameTypes[r.key]];this.taxonomy.splice(i,1);i--}return o=encodeURIComponent(JSON.stringify(u)),o.length>0?t+="data="+o:t=t.substr(0,t.length-1),t+h},t.prototype.addUserIdToTaxonomy=function(t){n.Internal.Extensions.isNullOrUndefined(this.getFromPayload(11))&&this.addToTaxonomy(11,5,2);this.addToPayload(11,t)},t.prototype.addAccountIdToTaxonomy=function(t){n.Internal.Extensions.isNullOrUndefined(this.getFromPayload(12))&&this.addToTaxonomy(12,0,2);this.addToPayload(12,t)},t.prototype.setMetric=function(t,i){if(!n.Internal.assertValue(t)||!n.Internal.assertValue(i)){n.Internal.debugMessage("Dimension details must be defined",0);return}if(!n.Internal.isNumeric(i)){n.Internal.debugMessage("Metric value must be numeric",0);return}this.addToPayloadCollection(15,new n.Internal.SimpleProperty(t,Number(i)));this.addToTaxonomy(15,4,2)},t.prototype.setDimension=function(t,i){if(!n.Internal.assertValue(t)||!n.Internal.assertValue(i)){n.Internal.debugMessage("Dimension details must be defined",0);return}this.addToPayloadCollection(14,new n.Internal.SimpleProperty(t,i));this.addToTaxonomy(14,3,2)},t.prototype.addAttribute=function(t){return this.internalValidateNode(t)?n.Internal.taxonomyParamTypes[t.data]+"="+encodeURIComponent(this.getFromPayload(t.key))+"&":""},t.prototype.addVariable=function(n){if(this.internalValidateNode(n)){var t=this.getFromPayload(n.key);return typeof t.isPayloadCollection!="undefined"?this.toArraysOfJsonString(t,n):t.toString()}return""},t.prototype.internalValidateNode=function(t){var i=this.getFromPayload(t.key),f=typeof i,r,u;switch(f){case"undefined":r=!1;break;case"object":r=i instanceof Array?n.Internal.assertValue(i)&&i.length>0&&t.type===2:n.Internal.assertValue(i)&&t.type===2;break;case"string":u=this.getFromPayload(t.key);r=u!==null&&u.length>0;break;default:r=n.Internal.assertValue(i)}return r},t.prototype.toArraysOfJsonString=function(t,i){for(var f,r="",u=0;u<t.length;u++)u>0&&(r+=","),f=t[u],typeof f.toString=="undefined"&&(f=t[u]=JSON.stringify(f)),r+=f.toString();return(t.length>1||n.Internal.isArrayBeacon(i.data))&&(r="["+r+"]"),r},t}();t.AnalyticsDataImpl=i;t.analyticsData=new i})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={}));appInsights=appInsights||{},function(n){(function(n){"use strict";var t=function(){function n(n,t,i){this.visitor=n;this.visit=t;this.createdDate=i}return n}();n.User=t;n.valueDelimiter="|";n.applicationsDelimiter="||"})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";function s(t){var f=null,r=t.split(n.Internal.valueDelimiter),e,u;return n.Internal.Extensions.isNullOrUndefined(r)||r.length!==5||(e=parseInt(r[3],10),u=parseInt(r[4],10),isNaN(u)||(f=new i(r[0],r[1],r[2],e,u))),f}var e=4e3,o=10,i=function(){function t(n,t,i,r,u){this.instrumentKey=n;this.visitorId=t;this.visitId=i;this.creationtime=r;this.lastUpdateTime=u}return t.prototype.serialize=function(){return this.instrumentKey+n.Internal.valueDelimiter+this.visitorId+n.Internal.valueDelimiter+this.visitId+n.Internal.valueDelimiter+this.creationtime+n.Internal.valueDelimiter+this.lastUpdateTime},t}(),r,u,f;t.StorageApplication=i;r=function(){function t(t,i){this.settings=i||n.Internal.settings;this.cookieStorage=t||document}return t.prototype.enabled=function(t){var u=this,i=!1,r;return n.Internal.Extensions.isNullOrUndefined(this.cookieStorage.cookie)||(r=function(){return u.cookieStorage.cookie.indexOf(t)!==-1},r()?i=!0:(this.cookieStorage.cookie=t,i=r())),i},t.prototype.setValue=function(n,t){var i=!1,r,u;try{r=new Date((new Date).getTime()+this.settings.maxVisitorCookieLifeMS);this.cookieStorage.cookie=n+"="+encodeURIComponent(t)+";expires="+r.toUTCString()+";path=/";u=this.getValue(n);i=u===t}catch(f){}return i},t.prototype.getValue=function(t){return decodeURIComponent(n.Internal.Strings.substring(this.cookieStorage.cookie,t+"=",";",!1))},t}();t.Cookies=r;u=function(){function t(t,i){this.cookies=t;this.settings=n.Internal.Extensions.isNullOrUndefined(i)?n.Internal.settings:i}return t.prototype.enabled=function(){return this.cookies.enabled(this.settings.cookieName)},t.prototype.updateApplication=function(n){var t=this.cookies.getValue(this.settings.cookieName);return t.length>e&&(t=this.getShrinkCookie(t)),t=this.getRemoveApplicationCookie(n,t),t=this.getAddApplicationCookie(n,t),this.cookies.setValue(this.settings.cookieName,t)},t.prototype.getApplication=function(t){var r=null,u=this.cookies.getValue(this.settings.cookieName),i;return u!==""&&(i=n.Internal.Strings.substring(u,t,n.Internal.applicationsDelimiter,!0),i!==""&&(r=s(i))),r},t.prototype.getRemoveApplicationCookie=function(t,i){var f=i,r,u;return i!==""&&(r=i.indexOf(t.instrumentKey),r!==-1&&(u=i.indexOf(n.Internal.applicationsDelimiter,r),u>=0&&(u+=n.Internal.applicationsDelimiter.length-1),f=n.Internal.Strings.remove(i,r,u))),f},t.prototype.getAddApplicationCookie=function(t,i){var r=t.serialize();return i!==""&&(r+=n.Internal.applicationsDelimiter),r+i},t.prototype.getShrinkCookie=function(t){for(var r="",i=t.length-1,u=0;u<o;u++)if(i=t.lastIndexOf(n.Internal.applicationsDelimiter,i)-1,i<0)break;return i>0&&(r=t.substring(0,i)),r},t}();t.StorageApplicationManager=u;f=function(){function t(t,i,f){this.settings=t||n.Internal.settings;this.cookies=i||new r(document,this.settings);this.appInsights=f||appInsights;this.visitor=null;this.visit=null;this.createdOn=null;this.applicationManager=new u(this.cookies,this.settings)}return t.prototype.getUser=function(t){var i=null;return this.initialize(t)&&(i=new n.Internal.User(this.visitor,this.visit,this.createdOn)),i},t.prototype.initialize=function(t){var f=!1,u;if(this.applicationManager.enabled()){var r=this.applicationManager.getApplication(this.appInsights.applicationInsightsId),e=n.Internal.DateTime.utcNow(),o=e-t;n.Internal.Extensions.isNullOrUndefined(r)?r=new i(this.appInsights.applicationInsightsId,n.Internal.UniqueId.create(),n.Internal.UniqueId.create(),n.Internal.DateTime.now(),o):r.lastUpdateTime=e;this.applicationManager.updateApplication(r)?(this.visitor=r.visitorId,this.visit=r.visitId,this.createdOn=n.Internal.getDaysSince1980(r.creationtime).toString()):(u=this.applicationManager.getApplication(this.appInsights.applicationInsightsId),n.Internal.Extensions.isNullOrUndefined(u)&&(u.visitorId===r.visitorId&&(this.visitor=r.visitorId),u.visitId===r.visitId&&(this.visit=r.visitId),u.creationtime===r.creationtime&&(this.createdOn=r.creationtime.toString())));f=!0}return f},t}();t.CookieStorage=f})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";var i=function(){function t(t,i,r){this.settings=n.Internal.Extensions.isNullOrUndefined(i)?n.Internal.settings:i;this.cookieStorage=t;this.appInsights=r||appInsights}return t.prototype.getUser=function(t){function e(n){i===null&&(i=s.getUser(n))}var i=null,s=this.cookieStorage,f=this.getStorageInfo(n.Internal.Extensions.getWindowLocalStorage(),"uid",this.settings.maxVisitorCookieLifeMS,t,function(){return n.Internal.UniqueId.create()}),r,u,o;return f===null&&(e(t),n.Internal.Extensions.isNullOrUndefined(i)||(f=i.Visitor)),r=this.getStorageInfo(n.Internal.Extensions.getWindowLocalStorage(),"ica",this.settings.maxVisitorCookieLifeMS,t,function(){return""+n.Internal.getDaysSince1980(n.Internal.DateTime.now())}),r===null&&(e(t),n.Internal.Extensions.isNullOrUndefined(i)||(r=i.CreatedDate)),u=this.getStorageInfo(n.Internal.Extensions.getWindowSessionStorage(),"sid",this.settings.maxSessionLiftMS,t,function(){return n.Internal.UniqueId.create()}),u===null&&(e(t),n.Internal.Extensions.isNullOrUndefined(i)||(u=i.Visit)),o=null,(f!==null||u!==null||r!==null)&&(o=new n.Internal.User(f,u,r)),o},t.prototype.getStorageInfo=function(t,i,r,u,f){var c=this.appInsights.applicationInsightsId+i,l=null,a,o,e,s,v,h,y;if(!n.Internal.Extensions.isNullOrUndefined(t)){a=n.Internal.DateTime.utcNow();o=null;try{o=t.getItem(c)}catch(p){}if(e=null,n.Internal.assertType(o,0)&&(s=o.split(n.Internal.valueDelimiter),s.length===2&&(v=parseInt(s[0],10),isNaN(v)||(h=n.Internal.DateTime.getDuration(v,a),h=h-u,h<r&&(e=s[1])))),n.Internal.Extensions.isNullOrUndefined(e))try{e=f();y=a-u+n.Internal.valueDelimiter+e;t.setItem(c,y);t.getItem(c)===y&&(l=e)}catch(w){}else l=e}return l},t}();t.DomStorage=i})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";var i=function(){function t(t){this.cookieStorage=null;this.domStorage=null;this.settings=n.Internal.Extensions.isNullOrUndefined(t)?n.Internal.settings:t}return t.prototype.getUserIdentity=function(){return this.getBrowserStorage().getUser(0)},t.prototype.getCookieStorage=function(){return this.cookieStorage===null&&(this.cookieStorage=new n.Internal.CookieStorage(this.settings)),this.cookieStorage},t.prototype.getBrowserStorage=function(){if(this.domStorage===null){var t=n.Internal.Extensions.getWindowSessionStorage(),i=n.Internal.Extensions.getWindowLocalStorage();this.domStorage=n.Internal.Extensions.isNullOrUndefined(t)||n.Internal.Extensions.isNullOrUndefined(i)?this.getCookieStorage():new n.Internal.DomStorage(this.getCookieStorage(),this.settings)}return this.domStorage},t}();t.UserIdentityProviderImpl=i;t.userIdentityProvider=new i})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={}));Debug=Debug?Debug:{debuggerEnabled:!1},function(n){(function(t){"use strict";var i=function(){function t(t,i,r,u,f){this.data=t||n.Internal.analyticsData;this.settings=i||n.Internal.settings;this.userIdentityProvider=r||n.Internal.userIdentityProvider;this.appInsights=u||appInsights;this.location=f||location}return t.prototype.createPayload=function(t){var o=this.appInsights.developerMode===0?Debug.debuggerEnabled:this.appInsights.developerMode===1,e,i,r;if(!n.Internal.assertType(this.appInsights.applicationInsightsId,0)||this.appInsights.applicationInsightsId.length===0)return n.Internal.debugMessage("Application ID must be defined",0),null;e=n.Internal.taxonomyParamTypes[17]+"="+n.Internal.payLoadTypes[t];i=n.Internal.taxonomyParamTypes[18]+"="+this.settings.getVersion();i+="&"+n.Internal.taxonomyParamTypes[19]+"="+this.settings.getSourceType();i+="&"+e+"&";this.data.addToPayload(1,this.appInsights.applicationInsightsId);this.data.addToPayload(21,o);r=this.userIdentityProvider.getUserIdentity();n.Internal.assertValue(r)&&(this.data.addToPayload(2,r.visitor),this.data.addToPayload(16,r.createdDate));this.data.addToPayload(6,screen.width+"x"+screen.height+"x"+screen.colorDepth);this.data.addToPayload(4,!document.all||navigator.userAgent.match("Opera")?navigator.language:navigator.userLanguage);n.Internal.assertType(this.settings.pagePath,0)?this.data.addToPayload(7,this.settings.pagePath):this.data.addToPayload(7,this.location.href);n.Internal.assertType(this.appInsights.appUserId,0)&&this.data.addUserIdToTaxonomy(this.appInsights.appUserId);n.Internal.assertType(this.appInsights.accountId,0)&&this.data.addAccountIdToTaxonomy(this.appInsights.accountId);var u=null,f=document.referrer.match(/^(?:f|ht)tp(?:s)?\:\/\/([^/|:]+)/im);return f!==null&&f.length>=2&&(u=f[1]),u!==null&&u!==window.location.hostname&&this.data.addToPayload(3,document.referrer),this.data.addToPayload(5,n.Internal.calculateTimezone()),this.data.processTaxonomy(i)},t.prototype.sendData=function(t){var u=this.location.protocol,e,r;u.indexOf("http")!==0&&(u="http:");var o=this.appInsights.developerMode===0?Debug.debuggerEnabled:this.appInsights.developerMode===1,f=u+"//"+(o?this.settings.getDeveloperImageHost():this.settings.getImageHost())+"/",i=n.Internal.commands.CreateXmlHttpRequest();"withCredentials"in i?(i.onload=function(){return},i.onerror=function(){return},t.length>=this.settings.getMaxUrlLength()?(i.open("POST",f+this.settings.getPostHandler(),!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded")):(i.open("GET",f+this.settings.getImageFile()+"?"+t,!0),t=null),i.send(t)):(e=f+this.settings.getImageFile()+"?"+t,r=document.createElement("script"),r.async=!0,r.src=e,document.getElementsByTagName("head")[0].appendChild(r))},t.prototype.createAndSendData=function(t){var i=this.createPayload(t);return n.Internal.assertValue(i)?(this.sendData(i),!0):!1},t}();t.DataSender=i;t.dataSender=new i})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";var i=function(){function t(t,i,r){this.settings=t||n.Internal.settings;this.analyticsData=i||n.Internal.analyticsData;this.dataSender=r||n.Internal.dataSender}return t.prototype.tryCatchTraceWrapper=function(n,t,i){try{return t()}catch(r){return this.traceException(n,r,i),null}},t.prototype.traceEvent=function(t){if(this.settings.traceMode!==0){t=t.toString();try{n.Internal.Extensions.isNullOrUndefined(console)||(n.Internal.Extensions.isNullOrUndefined(console.debug)?n.Internal.Extensions.isNullOrUndefined(console.log)||console.log("Application Insights Trace "+(new Date).toString()+": "+t):console.debug("Application Insights Trace (%s) : %s.",(new Date).toString(),t))}catch(i){}this.settings.traceMode===4&&alert("Application Insights Trace:\n"+t+".")}},t.prototype.traceException=function(t,i,r){var u=this;n.Internal.tryCatchSwallowWrapper(function(){var f={},e;f.Id=t;n.Internal.Extensions.isNullOrUndefined(i)||(!n.Internal.Extensions.isNullOrUndefined(i.stack)&&i.stack.length>0&&(f.Stack=i.stack),f.Type=i.name,f.Message=i.message);n.Internal.Extensions.isNullOrUndefined(r)||(f.Params=r);e=JSON.stringify(f);u.trackInternalError(e);u.traceEvent(e)})},t.prototype.trackInternalError=function(n){this.analyticsData.addToPayload(20,n);this.analyticsData.addToTaxonomy(20,8,2);this.dataSender.createAndSendData(8)},t}();t.DiagnosticsImpl=i;t.diagnostics=new i})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";var i=function(){function t(t){this.diagnostics=t||n.Internal.diagnostics}return t.prototype.AttachEvent=function(t,i,r){var u=!1;return n.Internal.Extensions.isNullOrUndefined(t)||(n.Internal.Extensions.isNullOrUndefined(t.attachEvent)?n.Internal.Extensions.isNullOrUndefined(t.addEventListener)||this.diagnostics.tryCatchTraceWrapper("addEventListener",function(){t.addEventListener(i,r,!1);u=!0},[t,i]):this.diagnostics.tryCatchTraceWrapper("attachEvent",function(){t.attachEvent("on"+i,r);u=!0},[t,i])),u},t.prototype.DetachEvent=function(t,i,r){n.Internal.Extensions.isNullOrUndefined(t)||(n.Internal.Extensions.isNullOrUndefined(t.detachEvent)?n.Internal.Extensions.isNullOrUndefined(t.removeEventListener)||this.diagnostics.tryCatchTraceWrapper("removeEventListener",function(){t.removeEventListener(i,r,!1)},[t.toString(),i]):this.diagnostics.tryCatchTraceWrapper("detachEvent",function(){t.detachEvent("on"+i,r)},[t.toString(),i]))},t.prototype.CreateXmlHttpRequest=function(){var t=new XMLHttpRequest;return this.diagnostics.tryCatchTraceWrapper("Disabling_XmlHttpRequest_monitoring",function(){t[n.Internal.ajaxDisabledPropertyName]=!0}),t},t}();t.Commands=i;t.commands=new i})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";var i=function(){function t(t,i,r,u){this.analyticsData=t||n.Internal.analyticsData;this.settings=i||n.Internal.settings;this.dataSender=r||n.Internal.dataSender;this.commands=u||n.Internal.commands}return t.prototype.logEvent=function(t,i,r){var u=this;return n.Internal.diagnostics.tryCatchTraceWrapper("logEvent",function(){return n.Internal.assertValue(t)?(u.analyticsData.addToPayloadCollection(10,new n.Internal.SimpleEvent(t)),u.analyticsData.addToTaxonomy(10,7,2),u.addCustomPropertiesAndMetrics(i,r),u.dataSender.createAndSendData(2)):(n.Internal.debugMessage("eventPath must be defined",0),!1)},[t,i,r])},t.prototype.logPageView=function(t,i,r){var u=this;return n.Internal.diagnostics.tryCatchTraceWrapper("logPageView",function(){var f=u.settings.pagePath;n.Internal.assertType(t,0)&&(u.settings.pagePath=t);u.addCustomPropertiesAndMetrics(i,r);try{return u.dataSender.createAndSendData(0)}finally{n.Internal.assertType(f,0)&&(u.settings.pagePath=f)}},[t,i,r])},t.prototype.enablePagePerformanceTracking=function(){var n=this;this.windowLoadEventHandler=function(){return n.trackPagePerformanceImpl()};this.commands.AttachEvent(window,"load",this.windowLoadEventHandler)},t.prototype.disablePagePerformanceTracking=function(){this.commands.DetachEvent(window,"load",this.windowLoadEventHandler)},t.prototype.trackPagePerformance=function(){var t=new n.Internal.PageMetrics;return this.analyticsData.addToPayload(17,JSON.stringify(t)),this.analyticsData.addToTaxonomy(17,13,2),this.dataSender.createAndSendData(5)},t.prototype.trackError=function(t,i,r){var u=new n.Internal.ErrorData(t,i,r);return this.analyticsData.addToPayload(19,u.toString()),this.analyticsData.addToTaxonomy(19,6,2),this.dataSender.createAndSendData(7)},t.prototype.trackAjaxRequest=function(n){return this.analyticsData.addToPayload(18,JSON.stringify(n)),this.analyticsData.addToTaxonomy(18,1,2),this.dataSender.createAndSendData(6)},t.prototype.trackPagePerformanceImpl=function(){var t=this;return n.Internal.diagnostics.tryCatchTraceWrapper("trackPagePerformance",function(){if(!n.Internal.Browser.supportsPerformanceTimingApi())return!1;var i=setInterval(function(){window.performance.timing.loadEventEnd!==0&&(clearInterval(i),t.trackPagePerformance())},500);return!0})},t.prototype.addCustomPropertiesAndMetrics=function(t,i){var r,u;if(n.Internal.assertType(t,2))for(r in t)n.Internal.Extensions.isNullOrUndefined(t[r])||this.analyticsData.setDimension(r,t[r].toString());if(n.Internal.assertType(i,2))for(u in i)n.Internal.Extensions.isNullOrUndefined(i[u])||this.analyticsData.setMetric(u,i[u])},t}();t.AIClient=i;t.aiClient=new i})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";function o(){var t=!n.Internal.Extensions.isNullOrUndefined(window.$$CsmSt)||!n.Internal.Extensions.isNullOrUndefined(window.__csm_st);return!t&&r.isAjaxSupported(window.XMLHttpRequest)&&n.Internal.Extensions.isNullOrUndefined(i)?(i=new r,!0):!1}function s(){n.Internal.Extensions.isNullOrUndefined(i)||(i.dispose(),i=null)}var f=4096,e,r,u,i;(function(n){n[n.Uninitialized=0]="Uninitialized";n[n.Loading=1]="Loading";n[n.Loaded=2]="Loaded";n[n.Interactive=3]="Interactive";n[n.Complete=4]="Complete"})(t.ReadyStates||(t.ReadyStates={}));e=t.ReadyStates;r=function(){function t(t,i,r,u){this.xmlHttpRequest=t||XMLHttpRequest.prototype;this.commands=i||n.Internal.commands;this.diagnostics=r||n.Internal.diagnostics;this.aiClient=u||n.Internal.aiClient;this.configureOpenInterception(this.xmlHttpRequest);this.configureSetRequestHeaderInterception(this.xmlHttpRequest);this.configureSendInterception(this.xmlHttpRequest);this.configureAbortInterception(this.xmlHttpRequest)}return t.prototype.dispose=function(){this.xmlHttpRequest.open=this.originalOpen;this.xmlHttpRequest.send=this.originalSend;this.xmlHttpRequest.abort=this.originalAbort;this.xmlHttpRequest.setRequestHeader=this.originalSetRequestHeader},t.isAjaxSupported=function(t){return!n.Internal.Extensions.isNullOrUndefined(t)},t.prototype.configureOpenInterception=function(n){var t=this;this.originalOpen=n.open;n.open=function(n,i,r){var u=this;t.onBeforeOpen(u,n,i,r);t.originalOpen.apply(u,arguments)}},t.prototype.configureSetRequestHeaderInterception=function(n){var t=this;this.originalSetRequestHeader=n.setRequestHeader;n.setRequestHeader=function(n,i){var r=this;t.onBeforeSetRequestHeader(r,n,i);t.originalSetRequestHeader.apply(r,arguments)}},t.prototype.configureSendInterception=function(n){var t=this;this.originalSend=n.send;n.send=function(n){var i=this;t.onBeforeSend(i,n);t.originalSend.apply(i,arguments)}},t.prototype.configureAbortInterception=function(n){var t=this;this.originalAbort=n.abort;n.abort=function(){var n=this;t.onBeforeAbort(n);t.originalAbort.apply(this,arguments)}},t.prototype.onBeforeOpen=function(t,i,r,f){this.isMonitoredInstance(t,!0)&&(t.ajaxRecord=new u,this.attachToOnReadyStateChange(t),this.diagnostics.tryCatchTraceWrapper("openPrefix",function(){t.ajaxRecord.method=i;t.ajaxRecord.requestUrl=r;t.ajaxRecord.requestSize+=r.length;n.Internal.Extensions.isNullOrUndefined(f)||(t.ajaxRecord.async=f)}))},t.prototype.onBeforeSetRequestHeader=function(n,t,i){this.isMonitoredInstance(n)&&this.diagnostics.tryCatchTraceWrapper("Adding size of header to total request size",function(){n.ajaxRecord.requestSize+=t.length+i.length+2})},t.prototype.onBeforeSend=function(t,i){var r=this;this.isMonitoredInstance(t)&&this.diagnostics.tryCatchTraceWrapper("sendPrefix",function(){n.Internal.Extensions.isNullOrUndefined(i)||n.Internal.Extensions.isNullOrUndefined(i.length)||t.ajaxRecord.method!=="GET"&&t.ajaxRecord.method!=="HEAD"&&(t.ajaxRecord.requestSize+=i.length);t.ajaxRecord.requestSentTime=n.Internal.DateTime.now();n.Internal.Extensions.isNullOrUndefined(t.ajaxRecord.onReadyStateChangeEventHandler)&&setTimeout(function(){if(t.readyState===4){r.diagnostics.tryCatchTraceWrapper("readyState(4)",function(){r.collectResponseData(t)});r.onAjaxComplete(t)}else r.configureOnReadyStateChangeInterception(t)},5)})},t.prototype.onBeforeAbort=function(n){this.isMonitoredInstance(n)&&(n.ajaxRecord.aborted=!0)},t.prototype.attachToOnReadyStateChange=function(n){var i=this,t=function(){i.onReadyStateChangeEventHandler(n)};this.commands.AttachEvent(n,"readystatechange",t)&&(n.ajaxRecord.onReadyStateChangeEventHandler=t)},t.prototype.onReadyStateChangeEventHandler=function(n){if(this.isMonitoredInstance(n)&&!n.ajaxRecord.hasRegisteredOnReadyStateChangeFunctionWrapper)if(n.readyState<3)this.configureOnReadyStateChangeInterception(n);else{this.onReadyStateChangePrefix(n);this.onReadyStateChangePostfix(n)}},t.prototype.configureOnReadyStateChangeInterception=function(t){var r=this,i;(n.Internal.Extensions.isNullOrUndefined(t.onreadystatechange)||typeof t.onreadystatechange=="function")&&(i=t.onreadystatechange,t.onreadystatechange=function(n){r.onReadyStateChangedFunction(t,n,i)},t.ajaxRecord.hasRegisteredOnReadyStateChangeFunctionWrapper=!0)},t.prototype.onReadyStateChangedFunction=function(t,i,r){if(this.isMonitoredInstance(t)){this.onReadyStateChangePrefix(t);try{n.Internal.Extensions.isNullOrUndefined(r)||t.ajaxRecord.isExecutingOnReadyStateChangeFunctionWrapper||(t.ajaxRecord.isExecutingOnReadyStateChangeFunctionWrapper=!0,r.call(t,i))}catch(u){t.ajaxRecord.clientFailure=1;throw u;}finally{t.ajaxRecord.isExecutingOnReadyStateChangeFunctionWrapper=!1;n.Internal.Extensions.isNullOrUndefined(r)||(this.diagnostics.traceEvent("Original 'onreadystatechange' handler of Ajax object was called by XhrInterceptor"),this.diagnostics.tryCatchTraceWrapper("callbackFinishedTime",function(){t.readyState===4&&(t.ajaxRecord.callbackFinishedTime=n.Internal.DateTime.now())}));this.onReadyStateChangePostfix(t)}}},t.prototype.onReadyStateChangePrefix=function(t){var i=this;switch(t.readyState){case 3:this.diagnostics.tryCatchTraceWrapper("readyState(3)",function(){t.ajaxRecord.responseStartedTime=n.Internal.DateTime.now()});break;case 4:this.diagnostics.tryCatchTraceWrapper("readyState(4)",function(){i.collectResponseData(t)})}},t.prototype.collectResponseData=function(t){var i=n.Internal.DateTime.now();t.ajaxRecord.responseFinishedTime=i;t.ajaxRecord.responseStartedTime===null&&(t.ajaxRecord.responseStartedTime=i);n.Internal.tryCatchSwallowWrapper(function(){t.ajaxRecord.status=t.status});n.Internal.tryCatchSwallowWrapper(function(){t.ajaxRecord.contentType=t.getResponseHeader("Content-Type")});n.Internal.tryCatchSwallowWrapper(function(){t.ajaxRecord.contentEncoding=t.getResponseHeader("Content-Encoding")});n.Internal.tryCatchSwallowWrapper(function(){t.ajaxRecord.responseSize=t.responseText.length;t.ajaxRecord.responseSize+=t.getAllResponseHeaders().length;t.ajaxRecord.responseSize+=17})},t.prototype.onReadyStateChangePostfix=function(n){if(n.readyState===4)this.onAjaxComplete(n)},t.prototype.onAjaxComplete=function(n){var t=this;this.diagnostics.tryCatchTraceWrapper("publishData",function(){t.aiClient.trackAjaxRequest(n.ajaxRecord.toAjaxData())});this.diagnostics.tryCatchTraceWrapper("deleteAjaxData",function(){t.commands.DetachEvent(n,"readystatechange",n.ajaxRecord.onReadyStateChangeEventHandler);delete n.ajaxRecord})},t.prototype.isMonitoredInstance=function(t,i){var r=i===!0||!n.Internal.Extensions.isNullOrUndefined(t.ajaxRecord),u=t.appInsightsAjaxDisabled===!0;return r&&!u},t}();t.AjaxMonitor=r;u=function(){function t(){this.ttfb=null;this.responseReceivingDuration=0;this.callbackDuration=0;this.ajaxTotalDuration=0;this.async=!1;this.aborted=!1;this.requestUrl=null;this.requestSize=0;this.method=null;this.status=0;this.contentType=null;this.contentEncoding=null;this.responseSize=0;this.requestSentTime=0;this.responseStartedTime=0;this.responseFinishedTime=0;this.callbackFinishedTime=0;this.endTime=0;this.onReadyStateChangeEventHandler=null;this.hasRegisteredOnReadyStateChangeFunctionWrapper=!1;this.isExecutingOnReadyStateChangeFunctionWrapper=!1;this.clientFailure=0}return t.prototype.toAjaxData=function(){var t,n;return this.calculateMetrics(),t=!1,n=this.requestUrl||"",n.length>f&&(t=!0,n=n.substring(0,f)),{method:encodeURIComponent(this.method),async:this.async?1:0,requestSize:this.requestSize,responseSize:this.responseSize,requestUrl:encodeURIComponent(n),status:this.status,contentType:this.contentType,firstByte:this.ttfb,receiveDuration:this.responseReceivingDuration,callbackDuration:this.callbackDuration,totalDuration:this.ajaxTotalDuration,aborted:this.aborted,clientFailure:this.clientFailure,truncated:t}},t.prototype.calculateMetrics=function(){var i,t;for(this.ttfb=n.Internal.DateTime.getDuration(this.requestSentTime,this.responseStartedTime),this.responseReceivingDuration=n.Internal.DateTime.getDuration(this.responseStartedTime,this.responseFinishedTime),this.callbackDuration=n.Internal.DateTime.getDuration(this.responseFinishedTime,this.callbackFinishedTime),i=[this.responseStartedTime,this.responseFinishedTime,this.callbackFinishedTime],t=i.length-1;t>=0;t--)if(i[t]!==null){this.endTime=i[t];this.ajaxTotalDuration=n.Internal.DateTime.getDuration(this.requestSentTime,this.endTime);break}},t}();t.AjaxRecord=u;t.enableAjaxRequestTracking=o;t.disableAjaxRequestTracking=s})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={})),function(n){(function(n){n[n.auto=0]="auto";n[n.on=1]="on";n[n.off=2]="off"})(n.DeveloperModeEnable||(n.DeveloperModeEnable={}));var t=n.DeveloperModeEnable}(AppInsights||(AppInsights={})),function(n){(function(t){"use strict";function i(n){while(n.length>0){var t=n.shift();t()}}appInsights.applicationInsightsId=appInsights.applicationInsightsId||"";appInsights.accountId=appInsights.accountId||null;appInsights.appUserId=appInsights.appUserId||null;appInsights.developerMode=appInsights.developerMode||0;appInsights.logEvent=function(t,i,r){return n.Internal.aiClient.logEvent(t,i,r)};appInsights.logPageView=function(t,i,r){return n.Internal.aiClient.logPageView(t,i,r)};t.callFunctions=i;try{n.Internal.aiClient.enablePagePerformanceTracking();appInsights.queue instanceof Array&&i(appInsights.queue)}catch(r){}})(n.Internal||(n.Internal={}));var t=n.Internal}(AppInsights||(AppInsights={}))