@microsoft/applicationinsights-channel-js
Advanced tools
Comparing version 2.1.0 to 2.1.1
/*! | ||
* Application Insights JavaScript SDK - Channel, 2.1.0 | ||
* Application Insights JavaScript SDK - Channel, 2.1.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.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function t(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,n,d,a,p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(n=i||(i={}))[n.LocalStorage=0]="LocalStorage",n[n.SessionStorage=1]="SessionStorage",(a=d||(d={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g=(o.isNullOrUndefined=function(e){return null==e},o.disableCookies=function(){o._canUseCookies=!1},o.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(l,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},o);function o(){}var m,s,l=/[xy]/g;(s=m||(m={}))[s.CRITICAL=1]="CRITICAL",s[s.WARNING=2]="WARNING";var u=1,c=2,f=3,h=4,v=5,y=6,_=7,I=12,S=22,b=23,w=24,N=26,x=28,E=33,C=40,A=41,T=42,D=43,R=46,L=47,M=48,U=49,O=50,P=52,k=54,z=56,B=57,G=58,F=61,q=64,H=66,X=67,j=68,V=69,W=70,K=(Y.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},Y.dataType="MessageData",Y.AiNonUserActionablePrefix="AI (Internal): ",Y.AiUserActionablePrefix="AI: ",Y);function Y(e,t,n,r){void 0===n&&(n=!1),this.messageId=e,this.message=(n?Y.AiUserActionablePrefix:Y.AiNonUserActionablePrefix)+e;var i=(t?" message:"+Y.sanitizeDiagnosticText(t):"")+(r?" props:"+Y.sanitizeDiagnosticText(JSON.stringify(r)):"");this.message+=i}var J=(Z.prototype.throwInternal=function(e,t,n,r,i){void 0===i&&(i=!1);var a=new K(t,n,i,r);if(this.enableDebugExceptions())throw a;if(void 0!==a&&a&&void 0!==a.message){if(i){var o=+a.messageId;(!this._messageLogged[o]||this.consoleLoggingLevel()>=m.WARNING)&&(this.warnToConsole(a.message),this._messageLogged[o]=!0)}else this.consoleLoggingLevel()>=m.WARNING&&this.warnToConsole(a.message);this.logInternalMessage(e,a)}},Z.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},Z.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},Z.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,r=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[r]?n=!1:this._messageLogged[r]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var i="Internal events throttle limit per PageView reached for this app.",a=new K(b,i,!1);this.queue.push(a),this.warnToConsole(i)}}},Z.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},Z);function Z(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={},g.isNullOrUndefined(e)||(g.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),g.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),g.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),g.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}Q.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(Q.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),Q.prototype.initialize=function(n,r,i){var a=this;if(n.isCookieUseDisabled&&g.disableCookies(),this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<500&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error("Channel has invalid priority"+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];500<s.priority&&e.push(s)}if(0<e.length){for((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function Q(){this.identifier="ChannelControllerPlugin",this.priority=500}var $=(ee.requestContextHeader="Request-Context",ee.requestContextTargetKey="appId",ee.requestContextAppIdFormat="appId=cid-v1:",ee.requestIdHeader="Request-Id",ee.sdkContextHeader="Sdk-Context",ee.sdkContextHeaderAppIdRequest="appId",ee.requestContextHeaderLowerCase="request-context",ee);function ee(){}var te=(ne.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=ne.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,ne.MAX_NAME_LENGTH-3)+ne.padNumber(a);i=o}return i},ne.sanitizeKey=function(e,t){var n;return t&&(t=ne.trim(t.toString())).length>ne.MAX_NAME_LENGTH&&(n=t.substring(0,ne.MAX_NAME_LENGTH),e.throwInternal(m.WARNING,B,"name is too long. It has been truncated to "+ne.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},ne.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=ne.MAX_STRING_LENGTH),t&&(n=n||ne.MAX_STRING_LENGTH,(t=ne.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(m.WARNING,F,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},ne.sanitizeUrl=function(e,t){return ne.sanitizeInput(e,t,ne.MAX_URL_LENGTH,H)},ne.sanitizeMessage=function(e,t){var n;return t&&t.length>ne.MAX_MESSAGE_LENGTH&&(n=t.substring(0,ne.MAX_MESSAGE_LENGTH),e.throwInternal(m.WARNING,z,"message is too long, it has been truncated to "+ne.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},ne.sanitizeException=function(e,t){var n;return t&&t.length>ne.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,ne.MAX_EXCEPTION_LENGTH),e.throwInternal(m.WARNING,P,"exception is too long, it has been truncated to "+ne.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},ne.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(m.WARNING,U,"custom property is not valid",{exception:e},!0)}i=ne.sanitizeString(t,i,ne.MAX_PROPERTY_LENGTH),n[r=ne.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},ne.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=ne.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},ne.sanitizeId=function(e,t){return t?ne.sanitizeInput(e,t,ne.MAX_ID_LENGTH,V).toString():t},ne.sanitizeInput=function(e,t,n,r){var i;return t&&(t=ne.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(m.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},ne.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},ne.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},ne.MAX_NAME_LENGTH=150,ne.MAX_ID_LENGTH=128,ne.MAX_PROPERTY_LENGTH=8192,ne.MAX_STRING_LENGTH=1024,ne.MAX_URL_LENGTH=2048,ne.MAX_MESSAGE_LENGTH=32768,ne.MAX_EXCEPTION_LENGTH=32768,ne);function ne(){}var re=(ie.disableStorage=function(){ie._canUseLocalStorage=!1,ie._canUseSessionStorage=!1},ie._getLocalStorageObject=function(){return ie.canUseLocalStorage()?ie._getVerifiedStorageObject(i.LocalStorage):null},ie._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},ie.isInternalApplicationInsightsEndpoint=function(e){return-1!==ie._internalEndpoints.indexOf(e.toLowerCase())},ie.canUseLocalStorage=function(){return void 0===ie._canUseLocalStorage&&(ie._canUseLocalStorage=!!ie._getVerifiedStorageObject(i.LocalStorage)),ie._canUseLocalStorage},ie.getStorage=function(t,e){var n=ie._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,u,"Browser failed read of local storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return null},ie.setStorage=function(t,e,n){var r=ie._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,f,"Browser failed write to local storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.removeStorage=function(t,e){var n=ie._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,v,"Browser failed removal of local storage item. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie._getSessionStorageObject=function(){return ie.canUseSessionStorage()?ie._getVerifiedStorageObject(i.SessionStorage):null},ie.canUseSessionStorage=function(){return void 0===ie._canUseSessionStorage&&(ie._canUseSessionStorage=!!ie._getVerifiedStorageObject(i.SessionStorage)),ie._canUseSessionStorage},ie.getSessionStorageKeys=function(){var e=[];if(ie.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},ie.getSessionStorage=function(t,e){var n=ie._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,c,"Browser failed read of session storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return null},ie.setSessionStorage=function(t,e,n){var r=ie._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,h,"Browser failed write to session storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.removeSessionStorage=function(t,e){var n=ie._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,y,"Browser failed removal of session storage item. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.disableCookies=function(){g.disableCookies()},ie.canUseCookies=function(t){if(void 0===g._canUseCookies){g._canUseCookies=!1;try{g._canUseCookies=void 0!==ie.document.cookie}catch(e){t.throwInternal(m.WARNING,j,"Cannot access document.cookie - "+ie.getExceptionName(e),{exception:ie.dump(e)})}}return g._canUseCookies},ie.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),ie.document.location&&"https:"===ie.document.location.protocol&&(a=";secure"),ie.canUseCookies(e)&&(ie.document.cookie=t+"="+n+i+";path=/"+a)},ie.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},ie.getCookie=function(e,t){if(ie.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=ie.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=ie.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},ie.deleteCookie=function(e,t){ie.canUseCookies(e)&&(ie.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},ie.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},ie.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},ie.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},ie.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},ie.toISOStringForIE8=function(e){if(ie.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"}},ie.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},ie.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,a=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r,(0<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},ie.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},ie.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},ie.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},ie.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},ie.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},ie.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},ie.document="undefined"!=typeof document?document:{},ie._canUseLocalStorage=void 0,ie._canUseSessionStorage=void 0,ie._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],ie.NotSpecified="not_specified",ie);function ie(){}var ae=(oe.parseUrl=function(e){return oe.htmlAnchorElement||(oe.htmlAnchorElement=oe.document.createElement?oe.document.createElement("a"):{host:oe.parseHost(e)}),oe.htmlAnchorElement.href=e,oe.htmlAnchorElement},oe.getAbsoluteUrl=function(e){var t,n=oe.parseUrl(e);return n&&(t=n.href),t},oe.getPathName=function(e){var t,n=oe.parseUrl(e);return n&&(t=n.pathname),t},oe.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},oe.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},oe.document="undefined"!=typeof document?document:{},oe);function oe(){}var se=(le.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=ae.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var l=0===s.pathname.length?"/":s.pathname;"/"!==l.charAt(0)&&(l="/"+l),o=s.pathname,a=te.sanitizeString(e,n?n+" "+l:l)}else a=te.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},le);function le(){}ue.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()},ue.GetDuration=function(e,t){var n=null;return 0===e||0===t||g.isNullOrUndefined(e)||g.isNullOrUndefined(t)||(n=t-e),n};function ue(){}var ce,pe="ProcessLegacy",fe="http.method",de=(t(he,ce=function(){}),he);function he(){return ce.call(this)||this}var ge,me=(t(ve,ge=function(){this.ver=1,this.sampleRate=100,this.tags={}}),ve);function ve(e,t,n){var r=ge.call(this)||this;return r.name=te.sanitizeString(e,n)||re.NotSpecified,r.data=t,r.time=re.toISOStringForIE8(new Date),r.aiDataContract={time:d.Required,iKey:d.Required,name:d.Required,sampleRate:function(){return 100==r.sampleRate?d.Hidden:d.Required},tags:d.Required,data:d.Required},r}function ye(){}var _e,Ie=(t(Se,_e=ye),Se);function Se(){var e=_e.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var be,we=(t(Ne,be=Ie),Ne.envelopeType="Microsoft.ApplicationInsights.{0}.Event",Ne.dataType="EventData",Ne);function Ne(e,t,n,r){var i=be.call(this)||this;return i.aiDataContract={ver:d.Required,name:d.Required,properties:d.Default,measurements:d.Default},i.name=te.sanitizeString(e,t)||re.NotSpecified,i.properties=te.sanitizeProperties(e,n),i.measurements=te.sanitizeMeasurements(e,r),i}function xe(){}var Ee,Ce=(t(Ae,Ee=ye),Ae);function Ae(){var e=Ee.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function Te(){this.hasFullStack=!0,this.parsedStack=[]}var De,Re=(t(Le,De=Ce),Le.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return Ue.CreateFromInterface(t,e)});return new Le(t,p({},e,{exceptions:n}))},Le.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,i=e.severityLevel,a=e.ver,o=e.problemGroup,s=e.id,l=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:i,properties:n,measurements:r,problemGroup:o,id:s,isManual:l}},Le.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Le.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Le.dataType="ExceptionData",Le);function Le(e,t,n,r,i,a){var o=De.call(this)||this;return o.aiDataContract={ver:d.Required,exceptions:d.Required,severityLevel:d.Default,properties:d.Default,measurements:d.Default},t instanceof Error?(o.exceptions=[new Ue(e,t)],o.properties=te.sanitizeProperties(e,n),o.measurements=te.sanitizeMeasurements(e,r),i&&(o.severityLevel=i),a&&(o.id=a)):(o.exceptions=t.exceptions,o.properties=t.properties,o.measurements=t.measurements,t.severityLevel&&(o.severityLevel=t.severityLevel),t.id&&(o.id=t.id),t.problemGroup&&(o.problemGroup=t.problemGroup),g.isNullOrUndefined(t.ver)||(o.ver=t.ver),g.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var Me,Ue=(t(Oe,Me=Te),Oe.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&this.parsedStack.map(function(e){return e.toInterface()});return{id:this.id,outerId:this.outerId,typeName:this.typeName,message:this.message,hasFullStack:this.hasFullStack,stack:this.stack,parsedStack:e||void 0}},Oe.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return ke.CreateFromInterface(e)})||t.parsedStack;return new Oe(e,p({},t,{parsedStack:n}))},Oe.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(ke.regex.test(o)){var s=new ke(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var l=0,u=t.length-1,c=0,p=l,f=u;l<u;){if(32768<(c+=t[l].sizeInBytes+t[u].sizeInBytes)){var d=f-p+1;t.splice(p,d);break}p=l,f=u,l++,u--}}return t},Oe);function Oe(e,t){var n=Me.call(this)||this;if(n.aiDataContract={id:d.Default,outerId:d.Default,typeName:d.Required,message:d.Required,hasFullStack:d.Default,stack:d.Default,parsedStack:d.Array},t instanceof Error){n.typeName=te.sanitizeString(e,t.name)||re.NotSpecified,n.message=te.sanitizeMessage(e,t.message)||re.NotSpecified;var r=t.stack;n.parsedStack=Oe.parseStack(r),n.stack=te.sanitizeException(e,r),n.hasFullStack=re.isArray(n.parsedStack)&&0<n.parsedStack.length}else n.typeName=t.typeName,n.message=t.message,n.stack=t.stack,n.parsedStack=t.parsedStack,n.hasFullStack=t.hasFullStack;return n}var Pe,ke=(t(ze,Pe=xe),ze.CreateFromInterface=function(e){return new ze(e,null)},ze.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ze.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ze.baseSize=58,ze);function ze(e,t){var n=Pe.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:d.Required,method:d.Required,assembly:d.Default,fileName:d.Default,line:d.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=re.trim(r),n.fileName="",n.line=0;var i=r.match(ze.regex);i&&5<=i.length&&(n.method=re.trim(i[2])||n.method,n.fileName=re.trim(i[4]),n.line=parseInt(i[5])||0)}else n.level=e.level,n.method=e.method,n.assembly=e.assembly,n.fileName=e.fileName,n.line=e.line,n.sizeInBytes=0;return n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=ze.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var Be,Ge,Fe,qe=(t(He,Be=ye),He);function He(){var e=Be.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Fe=Ge||(Ge={}))[Fe.Measurement=0]="Measurement",Fe[Fe.Aggregation=1]="Aggregation";var Xe,je=(t(Ve,Xe=function(){this.kind=Ge.Measurement}),Ve);function Ve(){var e=null!==Xe&&Xe.apply(this,arguments)||this;return e.aiDataContract={name:d.Required,kind:d.Default,value:d.Required,count:d.Default,min:d.Default,max:d.Default,stdDev:d.Default},e}var We,Ke=(t(Ye,We=qe),Ye.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Ye.dataType="MetricData",Ye);function Ye(e,t,n,r,i,a,o){var s=We.call(this)||this;s.aiDataContract={ver:d.Required,metrics:d.Required,properties:d.Default};var l=new je;return l.count=0<r?r:void 0,l.max=isNaN(a)||null===a?void 0:a,l.min=isNaN(i)||null===i?void 0:i,l.name=te.sanitizeString(e,t)||re.NotSpecified,l.value=n,s.metrics=[l],s.properties=te.sanitizeProperties(e,o),s}var Je,Ze=(t(Qe,Je=Ie),Qe);function Qe(){var e=Je.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var $e,et=(t(tt,$e=Ze),tt.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",tt.dataType="PageviewData",tt);function tt(e,t,n,r,i,a,o){var s=$e.call(this)||this;return s.aiDataContract={ver:d.Required,name:d.Default,url:d.Default,duration:d.Default,properties:d.Default,measurements:d.Default,id:d.Default},s.id=te.sanitizeId(e,o),s.url=te.sanitizeUrl(e,n),s.name=te.sanitizeString(e,t)||re.NotSpecified,isNaN(r)||(s.duration=re.msToTimeSpan(r)),s.properties=te.sanitizeProperties(e,i),s.measurements=te.sanitizeMeasurements(e,a),s}var nt,rt=(t(it,nt=ye),it);function it(){var e=nt.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var at,ot=(t(st,at=rt),st.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",st.dataType="RemoteDependencyData",st);function st(e,t,n,r,i,a,o,s,l,u,c){void 0===l&&(l="Ajax");var p=at.call(this)||this;p.aiDataContract={id:d.Required,ver:d.Required,name:d.Default,resultCode:d.Default,duration:d.Default,success:d.Default,data:d.Default,target:d.Default,type:d.Default,properties:d.Default,measurements:d.Default,kind:d.Default,value:d.Default,count:d.Default,min:d.Default,max:d.Default,stdDev:d.Default,dependencyKind:d.Default,dependencySource:d.Default,commandName:d.Default,dependencyTypeName:d.Default},p.id=t,p.duration=re.msToTimeSpan(i),p.success=a,p.resultCode=o+"",p.type=te.sanitizeString(e,l);var f=se.ParseDependencyPath(e,n,s,r);return p.data=te.sanitizeUrl(e,r)||f.data,p.target=te.sanitizeString(e,f.target),p.name=te.sanitizeString(e,f.name),p.properties=te.sanitizeProperties(e,u),p.measurements=te.sanitizeMeasurements(e,c),p}var lt,ut=(t(ct,lt=ye),ct);function ct(){var e=lt.call(this)||this;return e.ver=2,e.properties={},e}var pt,ft=(t(dt,pt=ut),dt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",dt.dataType="MessageData",dt);function dt(e,t,n,r){var i=pt.call(this)||this;return i.aiDataContract={ver:d.Required,message:d.Required,severityLevel:d.Default,properties:d.Default},t=t||re.NotSpecified,i.message=te.sanitizeMessage(e,t),i.properties=te.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}var ht,gt=(t(mt,ht=Ze),mt);function mt(){var e=ht.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var vt,yt=(t(_t,vt=gt),_t.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",_t.dataType="PageviewPerformanceData",_t);function _t(e,t,n,r,i,a,o){var s=vt.call(this)||this;return s.aiDataContract={ver:d.Required,name:d.Default,url:d.Default,duration:d.Default,perfTotal:d.Default,networkConnect:d.Default,sentRequest:d.Default,receivedResponse:d.Default,domProcessing:d.Default,properties:d.Default,measurements:d.Default},s.url=te.sanitizeUrl(e,n),s.name=te.sanitizeString(e,t)||re.NotSpecified,s.properties=te.sanitizeProperties(e,i),s.measurements=te.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var It,St,bt,wt=(t(Nt,It=de),Nt);function Nt(e,t){var n=It.call(this)||this;return n.aiDataContract={baseType:d.Required,baseData:d.Required},n.baseType=e,n.baseData=t,n}(bt=St||(St={}))[bt.Verbose=0]="Verbose",bt[bt.Information=1]="Information",bt[bt.Warning=2]="Warning",bt[bt.Error=3]="Error",bt[bt.Critical=4]="Critical";var xt=(Et.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!g.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],g.isNullOrUndefined(i)?r:i},Et);function Et(){}var Ct=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"},At=new Ct,Tt=(Dt.prototype.enqueue=function(e){this._buffer.push(e)},Dt.prototype.count=function(){return this._buffer.length},Dt.prototype.clear=function(){this._buffer.length=0},Dt.prototype.getItems=function(){return this._buffer.slice(0)},Dt.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},Dt.prototype.markAsSent=function(e){this.clear()},Dt.prototype.clearSent=function(e){},Dt);function Dt(e){this._config=e,this._buffer=[]}var Rt=(Lt.prototype.enqueue=function(e){this._buffer.length>=Lt.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(this._logger.throwInternal(m.WARNING,X,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(e),this.setBuffer(Lt.BUFFER_KEY,this._buffer))},Lt.prototype.count=function(){return this._buffer.length},Lt.prototype.clear=function(){this._buffer.length=0,this.setBuffer(Lt.BUFFER_KEY,[]),this.setBuffer(Lt.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},Lt.prototype.getItems=function(){return this._buffer.slice(0)},Lt.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},Lt.prototype.markAsSent=function(e){this._buffer=this.removePayloadsFromBuffer(e,this._buffer),this.setBuffer(Lt.BUFFER_KEY,this._buffer);var t=this.getBuffer(Lt.SENT_BUFFER_KEY);t instanceof Array&&e instanceof Array&&((t=t.concat(e)).length>Lt.MAX_BUFFER_SIZE&&(this._logger.throwInternal(m.CRITICAL,X,"Sent buffer reached its maximum size: "+t.length,!0),t.length=Lt.MAX_BUFFER_SIZE),this.setBuffer(Lt.SENT_BUFFER_KEY,t))},Lt.prototype.clearSent=function(e){var t=this.getBuffer(Lt.SENT_BUFFER_KEY);t=this.removePayloadsFromBuffer(e,t),this.setBuffer(Lt.SENT_BUFFER_KEY,t)},Lt.prototype.removePayloadsFromBuffer=function(e,t){var n=[];for(var r in t){var i=!1;for(var a in e)if(e[a]===t[r]){i=!0;break}i||n.push(t[r])}return n},Lt.prototype.getBuffer=function(e){var t=e;try{t=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+t:t;var n=re.getSessionStorage(this._logger,t);if(n){var r=JSON.parse(n);if(r)return r}}catch(e){this._logger.throwInternal(m.CRITICAL,T," storage key: "+t+", "+re.getExceptionName(e),{exception:re.dump(e)})}return[]},Lt.prototype.setBuffer=function(e,t){var n=e;try{n=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+n:n;var r=JSON.stringify(t);re.setSessionStorage(this._logger,n,r)}catch(e){re.setSessionStorage(this._logger,n,JSON.stringify([])),this._logger.throwInternal(m.WARNING,A," storage key: "+n+", "+re.getExceptionName(e)+". Buffer cleared",{exception:re.dump(e)})}},Lt.BUFFER_KEY="AI_buffer",Lt.SENT_BUFFER_KEY="AI_sentBuffer",Lt.MAX_BUFFER_SIZE=2e3,Lt);function Lt(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(Lt.BUFFER_KEY),r=this.getBuffer(Lt.SENT_BUFFER_KEY);this._buffer=n.concat(r),this._buffer.length>Lt.MAX_BUFFER_SIZE&&(this._buffer.length=Lt.MAX_BUFFER_SIZE),this.setBuffer(Lt.SENT_BUFFER_KEY,[]),this.setBuffer(Lt.BUFFER_KEY,this._buffer)}var Mt=(Ut.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];"number"!=typeof r&&(t||(t={}),t[n]=r)}return t},Ut.extractPropsAndMeasurements=function(e,t,n){if(!g.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]="string"==typeof i?i:JSON.stringify(i)}},Ut.createEnvelope=function(e,t,n,r){var i=new me(e,r,t);i.iKey=n.iKey;var a=n.iKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),Ut.extractPartAExtensions(n,i),n.tags||(n.tags=[]),i},Ut.extractPartAExtensions=function(n,e){if(e.tags||(e.tags={}),n.ext||(n.ext={}),n.tags||(n.tags=[]),n.ext.user){n.ext.user.authId&&(e.tags[At.userAuthUserId]=n.ext.user.authId);var t=n.ext.user.id||n.ext.user.localId;t&&(e.tags[At.userId]=t)}if(n.ext.app&&n.ext.app.sesId&&(e.tags[At.sessionId]=n.ext.app.sesId),n.ext.device&&((n.ext.device.id||n.ext.device.localId)&&(e.tags[At.deviceId]=n.ext.device.id||n.ext.device.localId),n.ext.device.deviceClass&&(e.tags[At.deviceType]=n.ext.device.deviceClass),n.ext.device.ip&&(e.tags[At.deviceIp]=n.ext.device.ip)),n.ext.web){var r=n.ext.web;r.browserLang&&(e.tags[At.deviceLanguage]=r.browserLang),r.browserVer&&(e.tags[At.deviceBrowserVersion]=r.browserVer),r.browser&&(e.tags[At.deviceBrowser]=r.browser),e.data=e.data||{},e.data.baseData=e.data.baseData||{},e.data.baseData.properties=e.data.baseData.properties||{},r.domain&&(e.data.baseData.properties.domain=r.domain),r.isManual&&(e.data.baseData.properties.isManual=r.isManual.toString()),r.screenRes&&(e.data.baseData.properties.screenRes=r.screenRes),r.userConsent&&(e.data.baseData.properties.userConsent=r.userConsent.toString())}n.ext.device&&n.ext.device.model&&(e.tags[At.deviceModel]=n.ext.device.model),n.ext.os&&n.ext.os.name&&(e.tags[At.deviceOS]=n.ext.os.name),n.ext.device&&n.ext.device.deviceType&&(e.tags[At.deviceType]=n.ext.device.deviceType),n.ext.trace&&(n.ext.trace.parentID&&(e.tags[At.operationParentId]=n.ext.trace.parentID),n.ext.trace.name&&(e.tags[At.operationName]=n.ext.trace.name),n.ext.trace.traceID&&(e.tags[At.operationId]=n.ext.trace.traceID));for(var i={},a=function(e){var t=n.tags[e];Object.keys(t).forEach(function(e){i[e]=t[e]}),n.tags.splice(e,1)},o=n.tags.length-1;0<=o;o--)a(o);for(var s in n.tags)i[s]=n.tags[s];e.tags=p({},e.tags,i),e.tags[At.internalSdkVersion]||(e.tags[At.internalSdkVersion]="javascript:"+Ut.Version)},Ut.Version="2.1.0",Ut);function Ut(){}var Ot,Pt=(t(kt,Ot=Mt),kt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.measurements||{},r=t.baseData.properties||{};Mt.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(g.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.target,s=i.name,l=i.duration,u=i.success,c=i.responseCode,p=i.type,f=i.properties&&i.properties[fe]?i.properties[fe]:"GET",d=new ot(e,a,o,s,l,u,c,f,p,r,n),h=new wt(ot.dataType,d);return Mt.createEnvelope(e,ot.envelopeType,t,h)},kt.DependencyEnvelopeCreator=new kt,kt);function kt(){return null!==Ot&&Ot.apply(this,arguments)||this}var zt,Bt=(t(Gt,zt=Mt),Gt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==we.dataType&&(n.baseTypeSource=t.baseType),t.baseType===we.dataType?(n=t.baseData.properties||{},r=t.baseData.measurements||{}):t.baseData&&Mt.extractPropsAndMeasurements(t.baseData,n,r),Mt.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new we(e,i,n,r),o=new wt(we.dataType,a);return Mt.createEnvelope(e,we.envelopeType,t,o)},Gt.EventEnvelopeCreator=new Gt,Gt);function Gt(){return null!==zt&&zt.apply(this,arguments)||this}var Ft,qt=(t(Ht,Ft=Mt),Ht.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=Re.CreateFromInterface(e,n),i=new wt(Re.dataType,r);return Mt.createEnvelope(e,Re.envelopeType,t,i)},Ht.ExceptionEnvelopeCreator=new Ht,Ht);function Ht(){return null!==Ft&&Ft.apply(this,arguments)||this}var Xt,jt=(t(Vt,Xt=Mt),Vt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.properties||{},r=Mt.extractProperties(t.data);r=p({},n,r);var i=t.baseData.name,a=t.baseData.average,o=t.baseData.sampleCount,s=t.baseData.min,l=t.baseData.max,u=new Ke(e,i,a,o,s,l,r),c=new wt(Ke.dataType,u);return Mt.createEnvelope(e,Ke.envelopeType,t,c)},Vt.MetricEnvelopeCreator=new Vt,Vt);function Vt(){return null!==Xt&&Xt.apply(this,arguments)||this}var Wt,Kt=(t(Yt,Wt=Mt),Yt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=void 0;g.isNullOrUndefined(t.baseData)||g.isNullOrUndefined(t.baseData.properties)||g.isNullOrUndefined(t.baseData.properties.duration)?g.isNullOrUndefined(t.data)||g.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration):(n=t.baseData.properties.duration,delete t.baseData.properties.duration);var r,i=t.baseData;t.ext&&t.ext.trace&&t.ext.trace.traceID&&(r=t.ext.trace.traceID);var a=i.id||r,o=i.name,s=i.uri,l=i.properties||{},u=i.measurements||{};if(g.isNullOrUndefined(i.refUri)||(l.refUri=i.refUri),g.isNullOrUndefined(i.pageType)||(l.pageType=i.pageType),g.isNullOrUndefined(i.isLoggedIn)||(l.isLoggedIn=i.isLoggedIn.toString()),!g.isNullOrUndefined(i.properties)){var c=i.properties;for(var p in c)c.hasOwnProperty(p)&&(l[p]=c[p])}var f=new et(e,o,s,n,l,u,a),d=new wt(et.dataType,f);return Mt.createEnvelope(e,et.envelopeType,t,d)},Yt.PageViewEnvelopeCreator=new Yt,Yt);function Yt(){return null!==Wt&&Wt.apply(this,arguments)||this}var Jt,Zt=(t(Qt,Jt=Mt),Qt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.name,i=n.uri||n.url,a=n.properties,o=n.measurements,s=new yt(e,r,i,void 0,a,o,n),l=new wt(yt.dataType,s);return Mt.createEnvelope(e,yt.envelopeType,t,l)},Qt.PageViewPerformanceEnvelopeCreator=new Qt,Qt);function Qt(){return null!==Jt&&Jt.apply(this,arguments)||this}var $t,en=(t(tn,$t=Mt),tn.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=Mt.extractProperties(t.data),a=p({},i,t.baseData.properties),o=new ft(e,n,r,a),s=new wt(ft.dataType,o);return Mt.createEnvelope(e,ft.envelopeType,t,s)},tn.TraceEnvelopeCreator=new tn,tn);function tn(){return null!==$t&&$t.apply(this,arguments)||this}var nn=(rn.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},rn.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",r={};if(!e)return this._logger.throwInternal(m.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(m.WARNING,O,"Circular reference detected while serializing object",{name:t},!0),r;if(!e.aiDataContract){if("measurements"===t)r=this._serializeStringMap(e,"number",t);else if("properties"===t)r=this._serializeStringMap(e,"string",t);else if("tags"===t)r=this._serializeStringMap(e,"string",t);else if(re.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(m.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(m.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return r}for(var i in e[n]=!0,e.aiDataContract){var a,o=e.aiDataContract[i],s="function"==typeof o?o()&d.Required:o&d.Required,l="function"==typeof o?o()&d.Hidden:o&d.Hidden,u=o&d.Array,c=void 0!==e[i],p="object"==typeof e[i]&&null!==e[i];!s||c||u?l||void 0!==(a=p?u?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a):this._logger.throwInternal(m.CRITICAL,w,"Missing required field specification. The field is required but not present on source",{field:i,name:t})}return delete e[n],r},rn.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(re.isArray(e)){n=[];for(var r=0;r<e.length;r++){var i=e[r],a=this._serializeObject(i,t+"["+r+"]");n.push(a)}}else this._logger.throwInternal(m.CRITICAL,k,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},rn.prototype._serializeStringMap=function(e,t,n){var r=void 0;if(e)for(var i in r={},e){var a=e[i];if("string"===t)void 0===a?r[i]="undefined":null===a?r[i]="null":a.toString?r[i]=a.toString():r[i]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===a)r[i]="undefined";else if(null===a)r[i]="null";else{var o=parseFloat(a);isNaN(o)?r[i]="NaN":r[i]=o}else r[i]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(m.CRITICAL,r[i],null,!0)}return r},rn);function rn(e){this._logger=e}function an(){this._onlineStatus=!0;try{"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}catch(e){this.isListening=!1}}var on=(an.prototype._setOnline=function(){this._onlineStatus=!0},an.prototype._setOffline=function(){this._onlineStatus=!1},an.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!(navigator&&!g.isNullOrUndefined(navigator.onLine))||navigator.onLine},an.prototype.isOffline=function(){return!this.isOnline()},an.Offline=new an,an).Offline,sn=(ln.prototype.getHashCodeScore=function(e){return this.getHashCode(e)/ln.INT_MAX_VALUE*100},ln.prototype.getHashCode=function(e){if(""==e)return 0;for(;e.length<ln.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)},ln.INT_MAX_VALUE=2147483647,ln.MIN_INPUT_LENGTH=8,ln);function ln(){}var un=(cn.prototype.getSamplingScore=function(e){return e.tags&&e.tags[this.keys.userId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[this.keys.userId]):e.ext&&e.ext.user&&e.ext.user.id?this.hashCodeGeneragor.getHashCodeScore(e.ext.user.id):e.tags&&e.tags[this.keys.operationId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[this.keys.operationId]):e.ext&&e.ext.telemetryTrace&&e.ext.telemetryTrace.traceID?this.hashCodeGeneragor.getHashCodeScore(e.ext.telemetryTrace.traceID):100*Math.random()},cn);function cn(){this.hashCodeGeneragor=new sn,this.keys=new Ct}var pn=(fn.prototype.isSampledIn=function(e){var t=this.sampleRate;return null==t||100<=t||e.baseType===Ke.dataType||this.samplingScoreGenerator.getSamplingScore(e)<t},fn);function fn(e,t){this.INT_MAX_VALUE=2147483647,g.isNullOrUndefined(t)?this._logger=new J:this._logger=t,(100<e||e<0)&&(this._logger.throwInternal(m.WARNING,G,"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 un}var dn=(hn.prototype.pause=function(){throw new Error("Method not implemented.")},hn.prototype.resume=function(){throw new Error("Method not implemented.")},hn.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(m.CRITICAL,S,"flush failed, telemetry will not be collected: "+re.getExceptionName(e),{exception:re.dump(e)})}},hn.prototype.teardown=function(){throw new Error("Method not implemented.")},hn.prototype.initialize=function(t,e,n){var r=this;this._logger=e.logger,this._serializer=new nn(e.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._sender=null;var i=hn._getDefaultAppInsightsChannelConfig();function a(e){o._config[e]=function(){return xt.getConfig(t,e,r.identifier,i[e]())}}this._config=hn._getEmptyAppInsightsChannelConfig();var o=this;for(var s in i)a(s);this._buffer=this._config.enableSessionStorageBuffer&&re.canUseSessionStorage()?new Rt(this._logger,this._config):new Tt(this._config),this._sample=new pn(this._config.samplingPercentage(),this._logger),!this._config.isBeaconApiDisabled()&&re.IsBeaconApiSupported()?this._sender=this._beaconSender:"undefined"!=typeof XMLHttpRequest&&("withCredentials"in new XMLHttpRequest?(this._sender=this._xhrSender,this._XMLHttpRequestSupported=!0):"undefined"!=typeof XDomainRequest&&(this._sender=this._xdrSender))},hn.prototype.processTelemetry=function(e){var t=this;try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(m.CRITICAL,_,"Cannot send empty telemetry");if(e.baseData&&!e.baseType)return void this._logger.throwInternal(m.CRITICAL,W,"Cannot send telemetry without baseData and baseType");if(e.baseType||(e.baseType="EventData"),!this._sender)return void this._logger.throwInternal(m.CRITICAL,x,"Sender was not initialized");if(!this._isSampledIn(e))return void this._logger.throwInternal(m.WARNING,E,"Telemetry item was sampled out and not sent",{SampleRate:this._sample.sampleRate});e.tags=e.tags||{},e.tags.sampleRate=this._sample.sampleRate;var n=hn.constructEnvelope(e,this._config.instrumentationKey(),this._logger);if(!n)return void this._logger.throwInternal(m.CRITICAL,L,"Unable to create an AppInsights envelope");var r=!1;if(e.tags&&e.tags[pe]&&(e.tags[pe].forEach(function(e){try{e&&!1===e(n)&&(r=!0,t._logger.warnToConsole("Telemetry processor check returns false"))}catch(e){t._logger.throwInternal(m.CRITICAL,q,"One of telemetry initializers failed, telemetry item will not be sent: "+re.getExceptionName(e),{exception:re.dump(e)},!0)}}),delete e.tags[pe]),r)return;var i=this._serializer.serialize(n),a=this._buffer.getItems(),o=this._buffer.batchPayloads(a);o&&o.length+i.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(i),this._setupTimer()}catch(e){this._logger.throwInternal(m.WARNING,I,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+re.getExceptionName(e),{exception:re.dump(e)})}g.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},hn.prototype.setNextPlugin=function(e){this._nextPlugin=e},hn.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var r=null;this._appId||(r=this._parseResponse(e.responseText||e.response))&&r.appId&&(this._appId=r.appId),(e.status<200||300<=e.status)&&0!==e.status?!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(m.WARNING,C,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e)):on.isOffline()?this._config.isRetryDisabled()||(this._resendPayload(t,10),this._logger.throwInternal(m.WARNING,C,". Offline - Response Code: "+e.status+". Offline status: "+on.isOffline()+". Will retry to send "+t.length+" items.")):206===e.status?(r||(r=this._parseResponse(e.responseText||e.response)),r&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,r):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},hn.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!re.getIEVersion()||9<re.getIEVersion())&&this._logger.throwInternal(m.CRITICAL,C,"Telemetry transmission failed, some telemetry will be lost: "+re.getExceptionName(e),{exception:re.dump(e)})}},hn.prototype._onError=function(e,t,n){this._logger.throwInternal(m.WARNING,N,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},hn.prototype._onPartialSuccess=function(e,t){for(var n=[],r=[],i=0,a=t.errors.reverse();i<a.length;i++){var o=a[i],s=e.splice(o.index,1)[0];this._isRetriable(o.statusCode)?r.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<r.length&&(this._resendPayload(r),this._logger.throwInternal(m.WARNING,C,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+r.length+" our of "+t.itemsReceived+" items"))},hn.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},hn.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},hn.constructEnvelope=function(e,t,n){var r;switch((r=t===e.iKey||g.isNullOrUndefined(t)?e:p({},e,{iKey:t})).baseType){case we.dataType:return Bt.EventEnvelopeCreator.Create(n,r);case ft.dataType:return en.TraceEnvelopeCreator.Create(n,r);case et.dataType:return Kt.PageViewEnvelopeCreator.Create(n,r);case yt.dataType:return Zt.PageViewPerformanceEnvelopeCreator.Create(n,r);case Re.dataType:return qt.ExceptionEnvelopeCreator.Create(n,r);case Ke.dataType:return jt.MetricEnvelopeCreator.Create(n,r);case ot.dataType:return Pt.DependencyEnvelopeCreator.Create(n,r);default:return Bt.EventEnvelopeCreator.Create(n,r)}},hn._getDefaultAppInsightsChannelConfig=function(){return{endpointUrl:function(){return"https://dc.services.visualstudio.com/v2/track"},emitLineDelimitedJson:function(){return!1},maxBatchInterval:function(){return 15e3},maxBatchSizeInBytes:function(){return 102400},disableTelemetry:function(){return!1},enableSessionStorageBuffer:function(){return!0},isRetryDisabled:function(){return!1},isBeaconApiDisabled:function(){return!0},instrumentationKey:function(){},namePrefix:function(){},samplingPercentage:function(){return 100}}},hn._getEmptyAppInsightsChannelConfig=function(){return{endpointUrl:void 0,emitLineDelimitedJson:void 0,maxBatchInterval:void 0,maxBatchSizeInBytes:void 0,disableTelemetry:void 0,enableSessionStorageBuffer:void 0,isRetryDisabled:void 0,isBeaconApiDisabled:void 0,instrumentationKey:void 0,namePrefix:void 0,samplingPercentage:void 0}},hn.prototype._isSampledIn=function(e){return this._sample.isSampledIn(e)},hn.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),r=this._buffer.batchPayloads(e),i=new Blob([r],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,i)?(this._buffer.markAsSent(e),this._onSuccess(e,e.length)):(this._xhrSender(e,!0),this._logger.throwInternal(m.WARNING,C,". Failed to send telemetry with Beacon API, retried with xhrSender."))},hn.prototype._xhrSender=function(t,e){var n=this,r=new XMLHttpRequest;r.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,r.open("POST",this._config.endpointUrl(),e),r.setRequestHeader("Content-type","application/json"),re.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader($.sdkContextHeader,$.sdkContextHeaderAppIdRequest),r.onreadystatechange=function(){return n._xhrReadyStateChange(r,t,t.length)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(r),e)};var i=this._buffer.batchPayloads(t);r.send(i),this._buffer.markAsSent(t)},hn.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(m.CRITICAL,D,"Cannot parse the response. "+re.getExceptionName(e),{response:t})}return null},hn.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,r=e;n<r.length;n++){var i=r[n];this._buffer.enqueue(i)}this._setRetryTime(t),this._setupTimer()}},hn.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,r=Math.floor(Math.random()*n*10)+1;r*=e,t=Math.max(Math.min(r,3600),10)}var i=Date.now()+1e3*t;this._retryAt=i},hn.prototype._setupTimer=function(){var e=this;if(!this._timeoutHandle){var t=this._retryAt?Math.max(0,this._retryAt-Date.now()):0,n=Math.max(this._config.maxBatchInterval(),t);this._timeoutHandle=setTimeout(function(){e.triggerSend()},n)}},hn.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},hn.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},hn.prototype._xdrSender=function(t,e){var n=this,r=new XDomainRequest;r.onload=function(){return n._xdrOnLoad(r,t)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(r),e)};var i=window.location&&window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(m.WARNING,C,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var a=this._config.endpointUrl().replace(/^(https?:)/,"");r.open("POST",a);var o=this._buffer.batchPayloads(t);r.send(o),this._buffer.markAsSent(t)},hn.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},hn);function hn(){this.priority=1001,this.identifier="AppInsightsChannelPlugin",this._XMLHttpRequestSupported=!1}e.Sender=dn,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function t(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,n,d,a,p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(n=i||(i={}))[n.LocalStorage=0]="LocalStorage",n[n.SessionStorage=1]="SessionStorage",(a=d||(d={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g=(o.isNullOrUndefined=function(e){return null==e},o.disableCookies=function(){o._canUseCookies=!1},o.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(l,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},o);function o(){}var m,s,l=/[xy]/g;(s=m||(m={}))[s.CRITICAL=1]="CRITICAL",s[s.WARNING=2]="WARNING";var u=1,c=2,f=3,h=4,v=5,y=6,_=7,I=12,S=22,b=23,w=24,N=26,x=28,E=33,C=40,A=41,T=42,D=43,R=46,L=47,M=48,U=49,O=50,P=52,k=54,z=56,B=57,G=58,F=61,q=64,H=66,X=67,j=68,V=69,W=70,K=(Y.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},Y.dataType="MessageData",Y.AiNonUserActionablePrefix="AI (Internal): ",Y.AiUserActionablePrefix="AI: ",Y);function Y(e,t,n,r){void 0===n&&(n=!1),this.messageId=e,this.message=(n?Y.AiUserActionablePrefix:Y.AiNonUserActionablePrefix)+e;var i=(t?" message:"+Y.sanitizeDiagnosticText(t):"")+(r?" props:"+Y.sanitizeDiagnosticText(JSON.stringify(r)):"");this.message+=i}var J=(Z.prototype.throwInternal=function(e,t,n,r,i){void 0===i&&(i=!1);var a=new K(t,n,i,r);if(this.enableDebugExceptions())throw a;if(void 0!==a&&a&&void 0!==a.message){if(i){var o=+a.messageId;(!this._messageLogged[o]||this.consoleLoggingLevel()>=m.WARNING)&&(this.warnToConsole(a.message),this._messageLogged[o]=!0)}else this.consoleLoggingLevel()>=m.WARNING&&this.warnToConsole(a.message);this.logInternalMessage(e,a)}},Z.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},Z.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},Z.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,r=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[r]?n=!1:this._messageLogged[r]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var i="Internal events throttle limit per PageView reached for this app.",a=new K(b,i,!1);this.queue.push(a),this.warnToConsole(i)}}},Z.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},Z);function Z(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={},g.isNullOrUndefined(e)||(g.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),g.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),g.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),g.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}Q.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(Q.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),Q.prototype.initialize=function(n,r,i){var a=this;if(n.isCookieUseDisabled&&g.disableCookies(),this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<500&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error("Channel has invalid priority"+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];500<s.priority&&e.push(s)}if(0<e.length){for((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function Q(){this.identifier="ChannelControllerPlugin",this.priority=500}var $=(ee.requestContextHeader="Request-Context",ee.requestContextTargetKey="appId",ee.requestContextAppIdFormat="appId=cid-v1:",ee.requestIdHeader="Request-Id",ee.sdkContextHeader="Sdk-Context",ee.sdkContextHeaderAppIdRequest="appId",ee.requestContextHeaderLowerCase="request-context",ee);function ee(){}var te=(ne.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=ne.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,ne.MAX_NAME_LENGTH-3)+ne.padNumber(a);i=o}return i},ne.sanitizeKey=function(e,t){var n;return t&&(t=ne.trim(t.toString())).length>ne.MAX_NAME_LENGTH&&(n=t.substring(0,ne.MAX_NAME_LENGTH),e.throwInternal(m.WARNING,B,"name is too long. It has been truncated to "+ne.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},ne.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=ne.MAX_STRING_LENGTH),t&&(n=n||ne.MAX_STRING_LENGTH,(t=ne.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(m.WARNING,F,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},ne.sanitizeUrl=function(e,t){return ne.sanitizeInput(e,t,ne.MAX_URL_LENGTH,H)},ne.sanitizeMessage=function(e,t){var n;return t&&t.length>ne.MAX_MESSAGE_LENGTH&&(n=t.substring(0,ne.MAX_MESSAGE_LENGTH),e.throwInternal(m.WARNING,z,"message is too long, it has been truncated to "+ne.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},ne.sanitizeException=function(e,t){var n;return t&&t.length>ne.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,ne.MAX_EXCEPTION_LENGTH),e.throwInternal(m.WARNING,P,"exception is too long, it has been truncated to "+ne.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},ne.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(m.WARNING,U,"custom property is not valid",{exception:e},!0)}i=ne.sanitizeString(t,i,ne.MAX_PROPERTY_LENGTH),n[r=ne.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},ne.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=ne.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},ne.sanitizeId=function(e,t){return t?ne.sanitizeInput(e,t,ne.MAX_ID_LENGTH,V).toString():t},ne.sanitizeInput=function(e,t,n,r){var i;return t&&(t=ne.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(m.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},ne.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},ne.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},ne.MAX_NAME_LENGTH=150,ne.MAX_ID_LENGTH=128,ne.MAX_PROPERTY_LENGTH=8192,ne.MAX_STRING_LENGTH=1024,ne.MAX_URL_LENGTH=2048,ne.MAX_MESSAGE_LENGTH=32768,ne.MAX_EXCEPTION_LENGTH=32768,ne);function ne(){}var re=(ie.disableStorage=function(){ie._canUseLocalStorage=!1,ie._canUseSessionStorage=!1},ie._getLocalStorageObject=function(){return ie.canUseLocalStorage()?ie._getVerifiedStorageObject(i.LocalStorage):null},ie._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},ie.isInternalApplicationInsightsEndpoint=function(e){return-1!==ie._internalEndpoints.indexOf(e.toLowerCase())},ie.canUseLocalStorage=function(){return void 0===ie._canUseLocalStorage&&(ie._canUseLocalStorage=!!ie._getVerifiedStorageObject(i.LocalStorage)),ie._canUseLocalStorage},ie.getStorage=function(t,e){var n=ie._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,u,"Browser failed read of local storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return null},ie.setStorage=function(t,e,n){var r=ie._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,f,"Browser failed write to local storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.removeStorage=function(t,e){var n=ie._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,v,"Browser failed removal of local storage item. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie._getSessionStorageObject=function(){return ie.canUseSessionStorage()?ie._getVerifiedStorageObject(i.SessionStorage):null},ie.canUseSessionStorage=function(){return void 0===ie._canUseSessionStorage&&(ie._canUseSessionStorage=!!ie._getVerifiedStorageObject(i.SessionStorage)),ie._canUseSessionStorage},ie.getSessionStorageKeys=function(){var e=[];if(ie.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},ie.getSessionStorage=function(t,e){var n=ie._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,c,"Browser failed read of session storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return null},ie.setSessionStorage=function(t,e,n){var r=ie._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,h,"Browser failed write to session storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.removeSessionStorage=function(t,e){var n=ie._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,y,"Browser failed removal of session storage item. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.disableCookies=function(){g.disableCookies()},ie.canUseCookies=function(t){if(void 0===g._canUseCookies){g._canUseCookies=!1;try{g._canUseCookies=void 0!==ie.document.cookie}catch(e){t.throwInternal(m.WARNING,j,"Cannot access document.cookie - "+ie.getExceptionName(e),{exception:ie.dump(e)})}}return g._canUseCookies},ie.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),ie.document.location&&"https:"===ie.document.location.protocol&&(a=";secure"),ie.canUseCookies(e)&&(ie.document.cookie=t+"="+n+i+";path=/"+a)},ie.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},ie.getCookie=function(e,t){if(ie.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=ie.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=ie.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},ie.deleteCookie=function(e,t){ie.canUseCookies(e)&&(ie.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},ie.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},ie.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},ie.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},ie.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},ie.toISOStringForIE8=function(e){if(ie.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"}},ie.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},ie.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,a=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r,(0<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},ie.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},ie.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},ie.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},ie.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},ie.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},ie.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},ie.document="undefined"!=typeof document?document:{},ie._canUseLocalStorage=void 0,ie._canUseSessionStorage=void 0,ie._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],ie.NotSpecified="not_specified",ie);function ie(){}var ae=(oe.parseUrl=function(e){return oe.htmlAnchorElement||(oe.htmlAnchorElement=oe.document.createElement?oe.document.createElement("a"):{host:oe.parseHost(e)}),oe.htmlAnchorElement.href=e,oe.htmlAnchorElement},oe.getAbsoluteUrl=function(e){var t,n=oe.parseUrl(e);return n&&(t=n.href),t},oe.getPathName=function(e){var t,n=oe.parseUrl(e);return n&&(t=n.pathname),t},oe.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},oe.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},oe.document="undefined"!=typeof document?document:{},oe);function oe(){}var se=(le.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=ae.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var l=0===s.pathname.length?"/":s.pathname;"/"!==l.charAt(0)&&(l="/"+l),o=s.pathname,a=te.sanitizeString(e,n?n+" "+l:l)}else a=te.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},le);function le(){}ue.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()},ue.GetDuration=function(e,t){var n=null;return 0===e||0===t||g.isNullOrUndefined(e)||g.isNullOrUndefined(t)||(n=t-e),n};function ue(){}var ce,pe="ProcessLegacy",fe="http.method",de=(t(he,ce=function(){}),he);function he(){return ce.call(this)||this}var ge,me=(t(ve,ge=function(){this.ver=1,this.sampleRate=100,this.tags={}}),ve);function ve(e,t,n){var r=ge.call(this)||this;return r.name=te.sanitizeString(e,n)||re.NotSpecified,r.data=t,r.time=re.toISOStringForIE8(new Date),r.aiDataContract={time:d.Required,iKey:d.Required,name:d.Required,sampleRate:function(){return 100==r.sampleRate?d.Hidden:d.Required},tags:d.Required,data:d.Required},r}function ye(){}var _e,Ie=(t(Se,_e=ye),Se);function Se(){var e=_e.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var be,we=(t(Ne,be=Ie),Ne.envelopeType="Microsoft.ApplicationInsights.{0}.Event",Ne.dataType="EventData",Ne);function Ne(e,t,n,r){var i=be.call(this)||this;return i.aiDataContract={ver:d.Required,name:d.Required,properties:d.Default,measurements:d.Default},i.name=te.sanitizeString(e,t)||re.NotSpecified,i.properties=te.sanitizeProperties(e,n),i.measurements=te.sanitizeMeasurements(e,r),i}function xe(){}var Ee,Ce=(t(Ae,Ee=ye),Ae);function Ae(){var e=Ee.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function Te(){this.hasFullStack=!0,this.parsedStack=[]}var De,Re=(t(Le,De=Ce),Le.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return Ue.CreateFromInterface(t,e)});return new Le(t,p({},e,{exceptions:n}))},Le.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,i=e.severityLevel,a=e.ver,o=e.problemGroup,s=e.id,l=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:i,properties:n,measurements:r,problemGroup:o,id:s,isManual:l}},Le.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Le.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Le.dataType="ExceptionData",Le);function Le(e,t,n,r,i,a){var o=De.call(this)||this;return o.aiDataContract={ver:d.Required,exceptions:d.Required,severityLevel:d.Default,properties:d.Default,measurements:d.Default},t instanceof Error?(o.exceptions=[new Ue(e,t)],o.properties=te.sanitizeProperties(e,n),o.measurements=te.sanitizeMeasurements(e,r),i&&(o.severityLevel=i),a&&(o.id=a)):(o.exceptions=t.exceptions,o.properties=t.properties,o.measurements=t.measurements,t.severityLevel&&(o.severityLevel=t.severityLevel),t.id&&(o.id=t.id),t.problemGroup&&(o.problemGroup=t.problemGroup),g.isNullOrUndefined(t.ver)||(o.ver=t.ver),g.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var Me,Ue=(t(Oe,Me=Te),Oe.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&this.parsedStack.map(function(e){return e.toInterface()});return{id:this.id,outerId:this.outerId,typeName:this.typeName,message:this.message,hasFullStack:this.hasFullStack,stack:this.stack,parsedStack:e||void 0}},Oe.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return ke.CreateFromInterface(e)})||t.parsedStack;return new Oe(e,p({},t,{parsedStack:n}))},Oe.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(ke.regex.test(o)){var s=new ke(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var l=0,u=t.length-1,c=0,p=l,f=u;l<u;){if(32768<(c+=t[l].sizeInBytes+t[u].sizeInBytes)){var d=f-p+1;t.splice(p,d);break}p=l,f=u,l++,u--}}return t},Oe);function Oe(e,t){var n=Me.call(this)||this;if(n.aiDataContract={id:d.Default,outerId:d.Default,typeName:d.Required,message:d.Required,hasFullStack:d.Default,stack:d.Default,parsedStack:d.Array},t instanceof Error){n.typeName=te.sanitizeString(e,t.name)||re.NotSpecified,n.message=te.sanitizeMessage(e,t.message)||re.NotSpecified;var r=t.stack;n.parsedStack=Oe.parseStack(r),n.stack=te.sanitizeException(e,r),n.hasFullStack=re.isArray(n.parsedStack)&&0<n.parsedStack.length}else n.typeName=t.typeName,n.message=t.message,n.stack=t.stack,n.parsedStack=t.parsedStack,n.hasFullStack=t.hasFullStack;return n}var Pe,ke=(t(ze,Pe=xe),ze.CreateFromInterface=function(e){return new ze(e,null)},ze.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ze.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ze.baseSize=58,ze);function ze(e,t){var n=Pe.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:d.Required,method:d.Required,assembly:d.Default,fileName:d.Default,line:d.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=re.trim(r),n.fileName="",n.line=0;var i=r.match(ze.regex);i&&5<=i.length&&(n.method=re.trim(i[2])||n.method,n.fileName=re.trim(i[4]),n.line=parseInt(i[5])||0)}else n.level=e.level,n.method=e.method,n.assembly=e.assembly,n.fileName=e.fileName,n.line=e.line,n.sizeInBytes=0;return n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=ze.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var Be,Ge,Fe,qe=(t(He,Be=ye),He);function He(){var e=Be.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Fe=Ge||(Ge={}))[Fe.Measurement=0]="Measurement",Fe[Fe.Aggregation=1]="Aggregation";var Xe,je=(t(Ve,Xe=function(){this.kind=Ge.Measurement}),Ve);function Ve(){var e=null!==Xe&&Xe.apply(this,arguments)||this;return e.aiDataContract={name:d.Required,kind:d.Default,value:d.Required,count:d.Default,min:d.Default,max:d.Default,stdDev:d.Default},e}var We,Ke=(t(Ye,We=qe),Ye.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Ye.dataType="MetricData",Ye);function Ye(e,t,n,r,i,a,o){var s=We.call(this)||this;s.aiDataContract={ver:d.Required,metrics:d.Required,properties:d.Default};var l=new je;return l.count=0<r?r:void 0,l.max=isNaN(a)||null===a?void 0:a,l.min=isNaN(i)||null===i?void 0:i,l.name=te.sanitizeString(e,t)||re.NotSpecified,l.value=n,s.metrics=[l],s.properties=te.sanitizeProperties(e,o),s}var Je,Ze=(t(Qe,Je=Ie),Qe);function Qe(){var e=Je.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var $e,et=(t(tt,$e=Ze),tt.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",tt.dataType="PageviewData",tt);function tt(e,t,n,r,i,a,o){var s=$e.call(this)||this;return s.aiDataContract={ver:d.Required,name:d.Default,url:d.Default,duration:d.Default,properties:d.Default,measurements:d.Default,id:d.Default},s.id=te.sanitizeId(e,o),s.url=te.sanitizeUrl(e,n),s.name=te.sanitizeString(e,t)||re.NotSpecified,isNaN(r)||(s.duration=re.msToTimeSpan(r)),s.properties=te.sanitizeProperties(e,i),s.measurements=te.sanitizeMeasurements(e,a),s}var nt,rt=(t(it,nt=ye),it);function it(){var e=nt.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var at,ot=(t(st,at=rt),st.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",st.dataType="RemoteDependencyData",st);function st(e,t,n,r,i,a,o,s,l,u,c){void 0===l&&(l="Ajax");var p=at.call(this)||this;p.aiDataContract={id:d.Required,ver:d.Required,name:d.Default,resultCode:d.Default,duration:d.Default,success:d.Default,data:d.Default,target:d.Default,type:d.Default,properties:d.Default,measurements:d.Default,kind:d.Default,value:d.Default,count:d.Default,min:d.Default,max:d.Default,stdDev:d.Default,dependencyKind:d.Default,dependencySource:d.Default,commandName:d.Default,dependencyTypeName:d.Default},p.id=t,p.duration=re.msToTimeSpan(i),p.success=a,p.resultCode=o+"",p.type=te.sanitizeString(e,l);var f=se.ParseDependencyPath(e,n,s,r);return p.data=te.sanitizeUrl(e,r)||f.data,p.target=te.sanitizeString(e,f.target),p.name=te.sanitizeString(e,f.name),p.properties=te.sanitizeProperties(e,u),p.measurements=te.sanitizeMeasurements(e,c),p}var lt,ut=(t(ct,lt=ye),ct);function ct(){var e=lt.call(this)||this;return e.ver=2,e.properties={},e}var pt,ft=(t(dt,pt=ut),dt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",dt.dataType="MessageData",dt);function dt(e,t,n,r){var i=pt.call(this)||this;return i.aiDataContract={ver:d.Required,message:d.Required,severityLevel:d.Default,properties:d.Default},t=t||re.NotSpecified,i.message=te.sanitizeMessage(e,t),i.properties=te.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}var ht,gt=(t(mt,ht=Ze),mt);function mt(){var e=ht.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var vt,yt=(t(_t,vt=gt),_t.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",_t.dataType="PageviewPerformanceData",_t);function _t(e,t,n,r,i,a,o){var s=vt.call(this)||this;return s.aiDataContract={ver:d.Required,name:d.Default,url:d.Default,duration:d.Default,perfTotal:d.Default,networkConnect:d.Default,sentRequest:d.Default,receivedResponse:d.Default,domProcessing:d.Default,properties:d.Default,measurements:d.Default},s.url=te.sanitizeUrl(e,n),s.name=te.sanitizeString(e,t)||re.NotSpecified,s.properties=te.sanitizeProperties(e,i),s.measurements=te.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var It,St,bt,wt=(t(Nt,It=de),Nt);function Nt(e,t){var n=It.call(this)||this;return n.aiDataContract={baseType:d.Required,baseData:d.Required},n.baseType=e,n.baseData=t,n}(bt=St||(St={}))[bt.Verbose=0]="Verbose",bt[bt.Information=1]="Information",bt[bt.Warning=2]="Warning",bt[bt.Error=3]="Error",bt[bt.Critical=4]="Critical";var xt=(Et.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!g.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],g.isNullOrUndefined(i)?r:i},Et);function Et(){}var Ct=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"},At=new Ct,Tt=(Dt.prototype.enqueue=function(e){this._buffer.push(e)},Dt.prototype.count=function(){return this._buffer.length},Dt.prototype.clear=function(){this._buffer.length=0},Dt.prototype.getItems=function(){return this._buffer.slice(0)},Dt.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},Dt.prototype.markAsSent=function(e){this.clear()},Dt.prototype.clearSent=function(e){},Dt);function Dt(e){this._config=e,this._buffer=[]}var Rt=(Lt.prototype.enqueue=function(e){this._buffer.length>=Lt.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(this._logger.throwInternal(m.WARNING,X,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(e),this.setBuffer(Lt.BUFFER_KEY,this._buffer))},Lt.prototype.count=function(){return this._buffer.length},Lt.prototype.clear=function(){this._buffer.length=0,this.setBuffer(Lt.BUFFER_KEY,[]),this.setBuffer(Lt.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},Lt.prototype.getItems=function(){return this._buffer.slice(0)},Lt.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},Lt.prototype.markAsSent=function(e){this._buffer=this.removePayloadsFromBuffer(e,this._buffer),this.setBuffer(Lt.BUFFER_KEY,this._buffer);var t=this.getBuffer(Lt.SENT_BUFFER_KEY);t instanceof Array&&e instanceof Array&&((t=t.concat(e)).length>Lt.MAX_BUFFER_SIZE&&(this._logger.throwInternal(m.CRITICAL,X,"Sent buffer reached its maximum size: "+t.length,!0),t.length=Lt.MAX_BUFFER_SIZE),this.setBuffer(Lt.SENT_BUFFER_KEY,t))},Lt.prototype.clearSent=function(e){var t=this.getBuffer(Lt.SENT_BUFFER_KEY);t=this.removePayloadsFromBuffer(e,t),this.setBuffer(Lt.SENT_BUFFER_KEY,t)},Lt.prototype.removePayloadsFromBuffer=function(e,t){var n=[];for(var r in t){var i=!1;for(var a in e)if(e[a]===t[r]){i=!0;break}i||n.push(t[r])}return n},Lt.prototype.getBuffer=function(e){var t=e;try{t=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+t:t;var n=re.getSessionStorage(this._logger,t);if(n){var r=JSON.parse(n);if(r)return r}}catch(e){this._logger.throwInternal(m.CRITICAL,T," storage key: "+t+", "+re.getExceptionName(e),{exception:re.dump(e)})}return[]},Lt.prototype.setBuffer=function(e,t){var n=e;try{n=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+n:n;var r=JSON.stringify(t);re.setSessionStorage(this._logger,n,r)}catch(e){re.setSessionStorage(this._logger,n,JSON.stringify([])),this._logger.throwInternal(m.WARNING,A," storage key: "+n+", "+re.getExceptionName(e)+". Buffer cleared",{exception:re.dump(e)})}},Lt.BUFFER_KEY="AI_buffer",Lt.SENT_BUFFER_KEY="AI_sentBuffer",Lt.MAX_BUFFER_SIZE=2e3,Lt);function Lt(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(Lt.BUFFER_KEY),r=this.getBuffer(Lt.SENT_BUFFER_KEY);this._buffer=n.concat(r),this._buffer.length>Lt.MAX_BUFFER_SIZE&&(this._buffer.length=Lt.MAX_BUFFER_SIZE),this.setBuffer(Lt.SENT_BUFFER_KEY,[]),this.setBuffer(Lt.BUFFER_KEY,this._buffer)}var Mt=(Ut.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];"number"!=typeof r&&(t||(t={}),t[n]=r)}return t},Ut.extractPropsAndMeasurements=function(e,t,n){if(!g.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]="string"==typeof i?i:JSON.stringify(i)}},Ut.createEnvelope=function(e,t,n,r){var i=new me(e,r,t);i.iKey=n.iKey;var a=n.iKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),Ut.extractPartAExtensions(n,i),n.tags||(n.tags=[]),i},Ut.extractPartAExtensions=function(n,e){if(e.tags||(e.tags={}),n.ext||(n.ext={}),n.tags||(n.tags=[]),n.ext.user){n.ext.user.authId&&(e.tags[At.userAuthUserId]=n.ext.user.authId);var t=n.ext.user.id||n.ext.user.localId;t&&(e.tags[At.userId]=t)}if(n.ext.app&&n.ext.app.sesId&&(e.tags[At.sessionId]=n.ext.app.sesId),n.ext.device&&((n.ext.device.id||n.ext.device.localId)&&(e.tags[At.deviceId]=n.ext.device.id||n.ext.device.localId),n.ext.device.deviceClass&&(e.tags[At.deviceType]=n.ext.device.deviceClass),n.ext.device.ip&&(e.tags[At.deviceIp]=n.ext.device.ip)),n.ext.web){var r=n.ext.web;r.browserLang&&(e.tags[At.deviceLanguage]=r.browserLang),r.browserVer&&(e.tags[At.deviceBrowserVersion]=r.browserVer),r.browser&&(e.tags[At.deviceBrowser]=r.browser),e.data=e.data||{},e.data.baseData=e.data.baseData||{},e.data.baseData.properties=e.data.baseData.properties||{},r.domain&&(e.data.baseData.properties.domain=r.domain),r.isManual&&(e.data.baseData.properties.isManual=r.isManual.toString()),r.screenRes&&(e.data.baseData.properties.screenRes=r.screenRes),r.userConsent&&(e.data.baseData.properties.userConsent=r.userConsent.toString())}n.ext.device&&n.ext.device.model&&(e.tags[At.deviceModel]=n.ext.device.model),n.ext.os&&n.ext.os.name&&(e.tags[At.deviceOS]=n.ext.os.name),n.ext.device&&n.ext.device.deviceType&&(e.tags[At.deviceType]=n.ext.device.deviceType),n.ext.trace&&(n.ext.trace.parentID&&(e.tags[At.operationParentId]=n.ext.trace.parentID),n.ext.trace.name&&(e.tags[At.operationName]=n.ext.trace.name),n.ext.trace.traceID&&(e.tags[At.operationId]=n.ext.trace.traceID));for(var i={},a=function(e){var t=n.tags[e];Object.keys(t).forEach(function(e){i[e]=t[e]}),n.tags.splice(e,1)},o=n.tags.length-1;0<=o;o--)a(o);for(var s in n.tags)i[s]=n.tags[s];e.tags=p({},e.tags,i),e.tags[At.internalSdkVersion]||(e.tags[At.internalSdkVersion]="javascript:"+Ut.Version)},Ut.Version="2.1.1",Ut);function Ut(){}var Ot,Pt=(t(kt,Ot=Mt),kt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.measurements||{},r=t.baseData.properties||{};Mt.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(g.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.target,s=i.name,l=i.duration,u=i.success,c=i.responseCode,p=i.type,f=i.properties&&i.properties[fe]?i.properties[fe]:"GET",d=new ot(e,a,o,s,l,u,c,f,p,r,n),h=new wt(ot.dataType,d);return Mt.createEnvelope(e,ot.envelopeType,t,h)},kt.DependencyEnvelopeCreator=new kt,kt);function kt(){return null!==Ot&&Ot.apply(this,arguments)||this}var zt,Bt=(t(Gt,zt=Mt),Gt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==we.dataType&&(n.baseTypeSource=t.baseType),t.baseType===we.dataType?(n=t.baseData.properties||{},r=t.baseData.measurements||{}):t.baseData&&Mt.extractPropsAndMeasurements(t.baseData,n,r),Mt.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new we(e,i,n,r),o=new wt(we.dataType,a);return Mt.createEnvelope(e,we.envelopeType,t,o)},Gt.EventEnvelopeCreator=new Gt,Gt);function Gt(){return null!==zt&&zt.apply(this,arguments)||this}var Ft,qt=(t(Ht,Ft=Mt),Ht.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=Re.CreateFromInterface(e,n),i=new wt(Re.dataType,r);return Mt.createEnvelope(e,Re.envelopeType,t,i)},Ht.ExceptionEnvelopeCreator=new Ht,Ht);function Ht(){return null!==Ft&&Ft.apply(this,arguments)||this}var Xt,jt=(t(Vt,Xt=Mt),Vt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.properties||{},r=Mt.extractProperties(t.data);r=p({},n,r);var i=t.baseData.name,a=t.baseData.average,o=t.baseData.sampleCount,s=t.baseData.min,l=t.baseData.max,u=new Ke(e,i,a,o,s,l,r),c=new wt(Ke.dataType,u);return Mt.createEnvelope(e,Ke.envelopeType,t,c)},Vt.MetricEnvelopeCreator=new Vt,Vt);function Vt(){return null!==Xt&&Xt.apply(this,arguments)||this}var Wt,Kt=(t(Yt,Wt=Mt),Yt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=void 0;g.isNullOrUndefined(t.baseData)||g.isNullOrUndefined(t.baseData.properties)||g.isNullOrUndefined(t.baseData.properties.duration)?g.isNullOrUndefined(t.data)||g.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration):(n=t.baseData.properties.duration,delete t.baseData.properties.duration);var r,i=t.baseData;t.ext&&t.ext.trace&&t.ext.trace.traceID&&(r=t.ext.trace.traceID);var a=i.id||r,o=i.name,s=i.uri,l=i.properties||{},u=i.measurements||{};if(g.isNullOrUndefined(i.refUri)||(l.refUri=i.refUri),g.isNullOrUndefined(i.pageType)||(l.pageType=i.pageType),g.isNullOrUndefined(i.isLoggedIn)||(l.isLoggedIn=i.isLoggedIn.toString()),!g.isNullOrUndefined(i.properties)){var c=i.properties;for(var p in c)c.hasOwnProperty(p)&&(l[p]=c[p])}var f=new et(e,o,s,n,l,u,a),d=new wt(et.dataType,f);return Mt.createEnvelope(e,et.envelopeType,t,d)},Yt.PageViewEnvelopeCreator=new Yt,Yt);function Yt(){return null!==Wt&&Wt.apply(this,arguments)||this}var Jt,Zt=(t(Qt,Jt=Mt),Qt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.name,i=n.uri||n.url,a=n.properties,o=n.measurements,s=new yt(e,r,i,void 0,a,o,n),l=new wt(yt.dataType,s);return Mt.createEnvelope(e,yt.envelopeType,t,l)},Qt.PageViewPerformanceEnvelopeCreator=new Qt,Qt);function Qt(){return null!==Jt&&Jt.apply(this,arguments)||this}var $t,en=(t(tn,$t=Mt),tn.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=Mt.extractProperties(t.data),a=p({},i,t.baseData.properties),o=new ft(e,n,r,a),s=new wt(ft.dataType,o);return Mt.createEnvelope(e,ft.envelopeType,t,s)},tn.TraceEnvelopeCreator=new tn,tn);function tn(){return null!==$t&&$t.apply(this,arguments)||this}var nn=(rn.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},rn.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",r={};if(!e)return this._logger.throwInternal(m.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(m.WARNING,O,"Circular reference detected while serializing object",{name:t},!0),r;if(!e.aiDataContract){if("measurements"===t)r=this._serializeStringMap(e,"number",t);else if("properties"===t)r=this._serializeStringMap(e,"string",t);else if("tags"===t)r=this._serializeStringMap(e,"string",t);else if(re.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(m.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(m.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return r}for(var i in e[n]=!0,e.aiDataContract){var a,o=e.aiDataContract[i],s="function"==typeof o?o()&d.Required:o&d.Required,l="function"==typeof o?o()&d.Hidden:o&d.Hidden,u=o&d.Array,c=void 0!==e[i],p="object"==typeof e[i]&&null!==e[i];!s||c||u?l||void 0!==(a=p?u?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a):this._logger.throwInternal(m.CRITICAL,w,"Missing required field specification. The field is required but not present on source",{field:i,name:t})}return delete e[n],r},rn.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(re.isArray(e)){n=[];for(var r=0;r<e.length;r++){var i=e[r],a=this._serializeObject(i,t+"["+r+"]");n.push(a)}}else this._logger.throwInternal(m.CRITICAL,k,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},rn.prototype._serializeStringMap=function(e,t,n){var r=void 0;if(e)for(var i in r={},e){var a=e[i];if("string"===t)void 0===a?r[i]="undefined":null===a?r[i]="null":a.toString?r[i]=a.toString():r[i]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===a)r[i]="undefined";else if(null===a)r[i]="null";else{var o=parseFloat(a);isNaN(o)?r[i]="NaN":r[i]=o}else r[i]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(m.CRITICAL,r[i],null,!0)}return r},rn);function rn(e){this._logger=e}function an(){this._onlineStatus=!0;try{"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}catch(e){this.isListening=!1}}var on=(an.prototype._setOnline=function(){this._onlineStatus=!0},an.prototype._setOffline=function(){this._onlineStatus=!1},an.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!(navigator&&!g.isNullOrUndefined(navigator.onLine))||navigator.onLine},an.prototype.isOffline=function(){return!this.isOnline()},an.Offline=new an,an).Offline,sn=(ln.prototype.getHashCodeScore=function(e){return this.getHashCode(e)/ln.INT_MAX_VALUE*100},ln.prototype.getHashCode=function(e){if(""==e)return 0;for(;e.length<ln.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)},ln.INT_MAX_VALUE=2147483647,ln.MIN_INPUT_LENGTH=8,ln);function ln(){}var un=(cn.prototype.getSamplingScore=function(e){return e.tags&&e.tags[this.keys.userId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[this.keys.userId]):e.ext&&e.ext.user&&e.ext.user.id?this.hashCodeGeneragor.getHashCodeScore(e.ext.user.id):e.tags&&e.tags[this.keys.operationId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[this.keys.operationId]):e.ext&&e.ext.telemetryTrace&&e.ext.telemetryTrace.traceID?this.hashCodeGeneragor.getHashCodeScore(e.ext.telemetryTrace.traceID):100*Math.random()},cn);function cn(){this.hashCodeGeneragor=new sn,this.keys=new Ct}var pn=(fn.prototype.isSampledIn=function(e){var t=this.sampleRate;return null==t||100<=t||e.baseType===Ke.dataType||this.samplingScoreGenerator.getSamplingScore(e)<t},fn);function fn(e,t){this.INT_MAX_VALUE=2147483647,g.isNullOrUndefined(t)?this._logger=new J:this._logger=t,(100<e||e<0)&&(this._logger.throwInternal(m.WARNING,G,"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 un}var dn=(hn.prototype.pause=function(){throw new Error("Method not implemented.")},hn.prototype.resume=function(){throw new Error("Method not implemented.")},hn.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(m.CRITICAL,S,"flush failed, telemetry will not be collected: "+re.getExceptionName(e),{exception:re.dump(e)})}},hn.prototype.teardown=function(){throw new Error("Method not implemented.")},hn.prototype.initialize=function(t,e,n){var r=this;this._logger=e.logger,this._serializer=new nn(e.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._sender=null;var i=hn._getDefaultAppInsightsChannelConfig();function a(e){o._config[e]=function(){return xt.getConfig(t,e,r.identifier,i[e]())}}this._config=hn._getEmptyAppInsightsChannelConfig();var o=this;for(var s in i)a(s);this._buffer=this._config.enableSessionStorageBuffer&&re.canUseSessionStorage()?new Rt(this._logger,this._config):new Tt(this._config),this._sample=new pn(this._config.samplingPercentage(),this._logger),!this._config.isBeaconApiDisabled()&&re.IsBeaconApiSupported()?this._sender=this._beaconSender:"undefined"!=typeof XMLHttpRequest&&("withCredentials"in new XMLHttpRequest?(this._sender=this._xhrSender,this._XMLHttpRequestSupported=!0):"undefined"!=typeof XDomainRequest&&(this._sender=this._xdrSender))},hn.prototype.processTelemetry=function(e){var t=this;try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(m.CRITICAL,_,"Cannot send empty telemetry");if(e.baseData&&!e.baseType)return void this._logger.throwInternal(m.CRITICAL,W,"Cannot send telemetry without baseData and baseType");if(e.baseType||(e.baseType="EventData"),!this._sender)return void this._logger.throwInternal(m.CRITICAL,x,"Sender was not initialized");if(!this._isSampledIn(e))return void this._logger.throwInternal(m.WARNING,E,"Telemetry item was sampled out and not sent",{SampleRate:this._sample.sampleRate});e.tags=e.tags||{},e.tags.sampleRate=this._sample.sampleRate;var n=hn.constructEnvelope(e,this._config.instrumentationKey(),this._logger);if(!n)return void this._logger.throwInternal(m.CRITICAL,L,"Unable to create an AppInsights envelope");var r=!1;if(e.tags&&e.tags[pe]&&(e.tags[pe].forEach(function(e){try{e&&!1===e(n)&&(r=!0,t._logger.warnToConsole("Telemetry processor check returns false"))}catch(e){t._logger.throwInternal(m.CRITICAL,q,"One of telemetry initializers failed, telemetry item will not be sent: "+re.getExceptionName(e),{exception:re.dump(e)},!0)}}),delete e.tags[pe]),r)return;var i=this._serializer.serialize(n),a=this._buffer.getItems(),o=this._buffer.batchPayloads(a);o&&o.length+i.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(i),this._setupTimer()}catch(e){this._logger.throwInternal(m.WARNING,I,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+re.getExceptionName(e),{exception:re.dump(e)})}g.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},hn.prototype.setNextPlugin=function(e){this._nextPlugin=e},hn.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var r=null;this._appId||(r=this._parseResponse(e.responseText||e.response))&&r.appId&&(this._appId=r.appId),(e.status<200||300<=e.status)&&0!==e.status?!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(m.WARNING,C,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e)):on.isOffline()?this._config.isRetryDisabled()||(this._resendPayload(t,10),this._logger.throwInternal(m.WARNING,C,". Offline - Response Code: "+e.status+". Offline status: "+on.isOffline()+". Will retry to send "+t.length+" items.")):206===e.status?(r||(r=this._parseResponse(e.responseText||e.response)),r&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,r):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},hn.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!re.getIEVersion()||9<re.getIEVersion())&&this._logger.throwInternal(m.CRITICAL,C,"Telemetry transmission failed, some telemetry will be lost: "+re.getExceptionName(e),{exception:re.dump(e)})}},hn.prototype._onError=function(e,t,n){this._logger.throwInternal(m.WARNING,N,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},hn.prototype._onPartialSuccess=function(e,t){for(var n=[],r=[],i=0,a=t.errors.reverse();i<a.length;i++){var o=a[i],s=e.splice(o.index,1)[0];this._isRetriable(o.statusCode)?r.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<r.length&&(this._resendPayload(r),this._logger.throwInternal(m.WARNING,C,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+r.length+" our of "+t.itemsReceived+" items"))},hn.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},hn.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},hn.constructEnvelope=function(e,t,n){var r;switch((r=t===e.iKey||g.isNullOrUndefined(t)?e:p({},e,{iKey:t})).baseType){case we.dataType:return Bt.EventEnvelopeCreator.Create(n,r);case ft.dataType:return en.TraceEnvelopeCreator.Create(n,r);case et.dataType:return Kt.PageViewEnvelopeCreator.Create(n,r);case yt.dataType:return Zt.PageViewPerformanceEnvelopeCreator.Create(n,r);case Re.dataType:return qt.ExceptionEnvelopeCreator.Create(n,r);case Ke.dataType:return jt.MetricEnvelopeCreator.Create(n,r);case ot.dataType:return Pt.DependencyEnvelopeCreator.Create(n,r);default:return Bt.EventEnvelopeCreator.Create(n,r)}},hn._getDefaultAppInsightsChannelConfig=function(){return{endpointUrl:function(){return"https://dc.services.visualstudio.com/v2/track"},emitLineDelimitedJson:function(){return!1},maxBatchInterval:function(){return 15e3},maxBatchSizeInBytes:function(){return 102400},disableTelemetry:function(){return!1},enableSessionStorageBuffer:function(){return!0},isRetryDisabled:function(){return!1},isBeaconApiDisabled:function(){return!0},instrumentationKey:function(){},namePrefix:function(){},samplingPercentage:function(){return 100}}},hn._getEmptyAppInsightsChannelConfig=function(){return{endpointUrl:void 0,emitLineDelimitedJson:void 0,maxBatchInterval:void 0,maxBatchSizeInBytes:void 0,disableTelemetry:void 0,enableSessionStorageBuffer:void 0,isRetryDisabled:void 0,isBeaconApiDisabled:void 0,instrumentationKey:void 0,namePrefix:void 0,samplingPercentage:void 0}},hn.prototype._isSampledIn=function(e){return this._sample.isSampledIn(e)},hn.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),r=this._buffer.batchPayloads(e),i=new Blob([r],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,i)?(this._buffer.markAsSent(e),this._onSuccess(e,e.length)):(this._xhrSender(e,!0),this._logger.throwInternal(m.WARNING,C,". Failed to send telemetry with Beacon API, retried with xhrSender."))},hn.prototype._xhrSender=function(t,e){var n=this,r=new XMLHttpRequest;r.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,r.open("POST",this._config.endpointUrl(),e),r.setRequestHeader("Content-type","application/json"),re.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader($.sdkContextHeader,$.sdkContextHeaderAppIdRequest),r.onreadystatechange=function(){return n._xhrReadyStateChange(r,t,t.length)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(r),e)};var i=this._buffer.batchPayloads(t);r.send(i),this._buffer.markAsSent(t)},hn.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(m.CRITICAL,D,"Cannot parse the response. "+re.getExceptionName(e),{response:t})}return null},hn.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,r=e;n<r.length;n++){var i=r[n];this._buffer.enqueue(i)}this._setRetryTime(t),this._setupTimer()}},hn.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,r=Math.floor(Math.random()*n*10)+1;r*=e,t=Math.max(Math.min(r,3600),10)}var i=Date.now()+1e3*t;this._retryAt=i},hn.prototype._setupTimer=function(){var e=this;if(!this._timeoutHandle){var t=this._retryAt?Math.max(0,this._retryAt-Date.now()):0,n=Math.max(this._config.maxBatchInterval(),t);this._timeoutHandle=setTimeout(function(){e.triggerSend()},n)}},hn.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},hn.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},hn.prototype._xdrSender=function(t,e){var n=this,r=new XDomainRequest;r.onload=function(){return n._xdrOnLoad(r,t)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(r),e)};var i=window.location&&window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(m.WARNING,C,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var a=this._config.endpointUrl().replace(/^(https?:)/,"");r.open("POST",a);var o=this._buffer.batchPayloads(t);r.send(o),this._buffer.markAsSent(t)},hn.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},hn);function hn(){this.priority=1001,this.identifier="AppInsightsChannelPlugin",this._XMLHttpRequestSupported=!1}e.Sender=dn,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-channel-js.min.js.map |
@@ -186,3 +186,3 @@ import * as tslib_1 from "tslib"; | ||
}; | ||
EnvelopeCreator.Version = "2.1.0"; | ||
EnvelopeCreator.Version = "2.1.1"; | ||
return EnvelopeCreator; | ||
@@ -189,0 +189,0 @@ }()); |
/*! | ||
* Application Insights JavaScript SDK - Channel, 2.1.0 | ||
* Application Insights JavaScript SDK - Channel, 2.1.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.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function t(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,n,d,a,p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(n=i||(i={}))[n.LocalStorage=0]="LocalStorage",n[n.SessionStorage=1]="SessionStorage",(a=d||(d={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g=(o.isNullOrUndefined=function(e){return null==e},o.disableCookies=function(){o._canUseCookies=!1},o.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(l,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},o);function o(){}var m,s,l=/[xy]/g;(s=m||(m={}))[s.CRITICAL=1]="CRITICAL",s[s.WARNING=2]="WARNING";var u=1,c=2,f=3,h=4,v=5,y=6,_=7,I=12,S=22,b=23,w=24,N=26,x=28,E=33,C=40,A=41,T=42,D=43,R=46,L=47,M=48,U=49,O=50,P=52,k=54,z=56,B=57,G=58,F=61,q=64,H=66,X=67,j=68,V=69,W=70,K=(Y.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},Y.dataType="MessageData",Y.AiNonUserActionablePrefix="AI (Internal): ",Y.AiUserActionablePrefix="AI: ",Y);function Y(e,t,n,r){void 0===n&&(n=!1),this.messageId=e,this.message=(n?Y.AiUserActionablePrefix:Y.AiNonUserActionablePrefix)+e;var i=(t?" message:"+Y.sanitizeDiagnosticText(t):"")+(r?" props:"+Y.sanitizeDiagnosticText(JSON.stringify(r)):"");this.message+=i}var J=(Z.prototype.throwInternal=function(e,t,n,r,i){void 0===i&&(i=!1);var a=new K(t,n,i,r);if(this.enableDebugExceptions())throw a;if(void 0!==a&&a&&void 0!==a.message){if(i){var o=+a.messageId;(!this._messageLogged[o]||this.consoleLoggingLevel()>=m.WARNING)&&(this.warnToConsole(a.message),this._messageLogged[o]=!0)}else this.consoleLoggingLevel()>=m.WARNING&&this.warnToConsole(a.message);this.logInternalMessage(e,a)}},Z.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},Z.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},Z.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,r=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[r]?n=!1:this._messageLogged[r]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var i="Internal events throttle limit per PageView reached for this app.",a=new K(b,i,!1);this.queue.push(a),this.warnToConsole(i)}}},Z.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},Z);function Z(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={},g.isNullOrUndefined(e)||(g.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),g.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),g.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),g.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}Q.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(Q.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),Q.prototype.initialize=function(n,r,i){var a=this;if(n.isCookieUseDisabled&&g.disableCookies(),this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<500&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error("Channel has invalid priority"+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];500<s.priority&&e.push(s)}if(0<e.length){for((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function Q(){this.identifier="ChannelControllerPlugin",this.priority=500}var $=(ee.requestContextHeader="Request-Context",ee.requestContextTargetKey="appId",ee.requestContextAppIdFormat="appId=cid-v1:",ee.requestIdHeader="Request-Id",ee.sdkContextHeader="Sdk-Context",ee.sdkContextHeaderAppIdRequest="appId",ee.requestContextHeaderLowerCase="request-context",ee);function ee(){}var te=(ne.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=ne.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,ne.MAX_NAME_LENGTH-3)+ne.padNumber(a);i=o}return i},ne.sanitizeKey=function(e,t){var n;return t&&(t=ne.trim(t.toString())).length>ne.MAX_NAME_LENGTH&&(n=t.substring(0,ne.MAX_NAME_LENGTH),e.throwInternal(m.WARNING,B,"name is too long. It has been truncated to "+ne.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},ne.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=ne.MAX_STRING_LENGTH),t&&(n=n||ne.MAX_STRING_LENGTH,(t=ne.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(m.WARNING,F,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},ne.sanitizeUrl=function(e,t){return ne.sanitizeInput(e,t,ne.MAX_URL_LENGTH,H)},ne.sanitizeMessage=function(e,t){var n;return t&&t.length>ne.MAX_MESSAGE_LENGTH&&(n=t.substring(0,ne.MAX_MESSAGE_LENGTH),e.throwInternal(m.WARNING,z,"message is too long, it has been truncated to "+ne.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},ne.sanitizeException=function(e,t){var n;return t&&t.length>ne.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,ne.MAX_EXCEPTION_LENGTH),e.throwInternal(m.WARNING,P,"exception is too long, it has been truncated to "+ne.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},ne.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(m.WARNING,U,"custom property is not valid",{exception:e},!0)}i=ne.sanitizeString(t,i,ne.MAX_PROPERTY_LENGTH),n[r=ne.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},ne.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=ne.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},ne.sanitizeId=function(e,t){return t?ne.sanitizeInput(e,t,ne.MAX_ID_LENGTH,V).toString():t},ne.sanitizeInput=function(e,t,n,r){var i;return t&&(t=ne.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(m.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},ne.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},ne.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},ne.MAX_NAME_LENGTH=150,ne.MAX_ID_LENGTH=128,ne.MAX_PROPERTY_LENGTH=8192,ne.MAX_STRING_LENGTH=1024,ne.MAX_URL_LENGTH=2048,ne.MAX_MESSAGE_LENGTH=32768,ne.MAX_EXCEPTION_LENGTH=32768,ne);function ne(){}var re=(ie.disableStorage=function(){ie._canUseLocalStorage=!1,ie._canUseSessionStorage=!1},ie._getLocalStorageObject=function(){return ie.canUseLocalStorage()?ie._getVerifiedStorageObject(i.LocalStorage):null},ie._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},ie.isInternalApplicationInsightsEndpoint=function(e){return-1!==ie._internalEndpoints.indexOf(e.toLowerCase())},ie.canUseLocalStorage=function(){return void 0===ie._canUseLocalStorage&&(ie._canUseLocalStorage=!!ie._getVerifiedStorageObject(i.LocalStorage)),ie._canUseLocalStorage},ie.getStorage=function(t,e){var n=ie._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,u,"Browser failed read of local storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return null},ie.setStorage=function(t,e,n){var r=ie._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,f,"Browser failed write to local storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.removeStorage=function(t,e){var n=ie._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,v,"Browser failed removal of local storage item. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie._getSessionStorageObject=function(){return ie.canUseSessionStorage()?ie._getVerifiedStorageObject(i.SessionStorage):null},ie.canUseSessionStorage=function(){return void 0===ie._canUseSessionStorage&&(ie._canUseSessionStorage=!!ie._getVerifiedStorageObject(i.SessionStorage)),ie._canUseSessionStorage},ie.getSessionStorageKeys=function(){var e=[];if(ie.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},ie.getSessionStorage=function(t,e){var n=ie._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,c,"Browser failed read of session storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return null},ie.setSessionStorage=function(t,e,n){var r=ie._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,h,"Browser failed write to session storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.removeSessionStorage=function(t,e){var n=ie._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,y,"Browser failed removal of session storage item. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.disableCookies=function(){g.disableCookies()},ie.canUseCookies=function(t){if(void 0===g._canUseCookies){g._canUseCookies=!1;try{g._canUseCookies=void 0!==ie.document.cookie}catch(e){t.throwInternal(m.WARNING,j,"Cannot access document.cookie - "+ie.getExceptionName(e),{exception:ie.dump(e)})}}return g._canUseCookies},ie.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),ie.document.location&&"https:"===ie.document.location.protocol&&(a=";secure"),ie.canUseCookies(e)&&(ie.document.cookie=t+"="+n+i+";path=/"+a)},ie.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},ie.getCookie=function(e,t){if(ie.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=ie.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=ie.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},ie.deleteCookie=function(e,t){ie.canUseCookies(e)&&(ie.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},ie.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},ie.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},ie.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},ie.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},ie.toISOStringForIE8=function(e){if(ie.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"}},ie.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},ie.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,a=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r,(0<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},ie.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},ie.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},ie.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},ie.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},ie.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},ie.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},ie.document="undefined"!=typeof document?document:{},ie._canUseLocalStorage=void 0,ie._canUseSessionStorage=void 0,ie._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],ie.NotSpecified="not_specified",ie);function ie(){}var ae=(oe.parseUrl=function(e){return oe.htmlAnchorElement||(oe.htmlAnchorElement=oe.document.createElement?oe.document.createElement("a"):{host:oe.parseHost(e)}),oe.htmlAnchorElement.href=e,oe.htmlAnchorElement},oe.getAbsoluteUrl=function(e){var t,n=oe.parseUrl(e);return n&&(t=n.href),t},oe.getPathName=function(e){var t,n=oe.parseUrl(e);return n&&(t=n.pathname),t},oe.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},oe.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},oe.document="undefined"!=typeof document?document:{},oe);function oe(){}var se=(le.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=ae.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var l=0===s.pathname.length?"/":s.pathname;"/"!==l.charAt(0)&&(l="/"+l),o=s.pathname,a=te.sanitizeString(e,n?n+" "+l:l)}else a=te.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},le);function le(){}ue.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()},ue.GetDuration=function(e,t){var n=null;return 0===e||0===t||g.isNullOrUndefined(e)||g.isNullOrUndefined(t)||(n=t-e),n};function ue(){}var ce,pe="ProcessLegacy",fe="http.method",de=(t(he,ce=function(){}),he);function he(){return ce.call(this)||this}var ge,me=(t(ve,ge=function(){this.ver=1,this.sampleRate=100,this.tags={}}),ve);function ve(e,t,n){var r=ge.call(this)||this;return r.name=te.sanitizeString(e,n)||re.NotSpecified,r.data=t,r.time=re.toISOStringForIE8(new Date),r.aiDataContract={time:d.Required,iKey:d.Required,name:d.Required,sampleRate:function(){return 100==r.sampleRate?d.Hidden:d.Required},tags:d.Required,data:d.Required},r}function ye(){}var _e,Ie=(t(Se,_e=ye),Se);function Se(){var e=_e.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var be,we=(t(Ne,be=Ie),Ne.envelopeType="Microsoft.ApplicationInsights.{0}.Event",Ne.dataType="EventData",Ne);function Ne(e,t,n,r){var i=be.call(this)||this;return i.aiDataContract={ver:d.Required,name:d.Required,properties:d.Default,measurements:d.Default},i.name=te.sanitizeString(e,t)||re.NotSpecified,i.properties=te.sanitizeProperties(e,n),i.measurements=te.sanitizeMeasurements(e,r),i}function xe(){}var Ee,Ce=(t(Ae,Ee=ye),Ae);function Ae(){var e=Ee.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function Te(){this.hasFullStack=!0,this.parsedStack=[]}var De,Re=(t(Le,De=Ce),Le.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return Ue.CreateFromInterface(t,e)});return new Le(t,p({},e,{exceptions:n}))},Le.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,i=e.severityLevel,a=e.ver,o=e.problemGroup,s=e.id,l=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:i,properties:n,measurements:r,problemGroup:o,id:s,isManual:l}},Le.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Le.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Le.dataType="ExceptionData",Le);function Le(e,t,n,r,i,a){var o=De.call(this)||this;return o.aiDataContract={ver:d.Required,exceptions:d.Required,severityLevel:d.Default,properties:d.Default,measurements:d.Default},t instanceof Error?(o.exceptions=[new Ue(e,t)],o.properties=te.sanitizeProperties(e,n),o.measurements=te.sanitizeMeasurements(e,r),i&&(o.severityLevel=i),a&&(o.id=a)):(o.exceptions=t.exceptions,o.properties=t.properties,o.measurements=t.measurements,t.severityLevel&&(o.severityLevel=t.severityLevel),t.id&&(o.id=t.id),t.problemGroup&&(o.problemGroup=t.problemGroup),g.isNullOrUndefined(t.ver)||(o.ver=t.ver),g.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var Me,Ue=(t(Oe,Me=Te),Oe.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&this.parsedStack.map(function(e){return e.toInterface()});return{id:this.id,outerId:this.outerId,typeName:this.typeName,message:this.message,hasFullStack:this.hasFullStack,stack:this.stack,parsedStack:e||void 0}},Oe.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return ke.CreateFromInterface(e)})||t.parsedStack;return new Oe(e,p({},t,{parsedStack:n}))},Oe.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(ke.regex.test(o)){var s=new ke(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var l=0,u=t.length-1,c=0,p=l,f=u;l<u;){if(32768<(c+=t[l].sizeInBytes+t[u].sizeInBytes)){var d=f-p+1;t.splice(p,d);break}p=l,f=u,l++,u--}}return t},Oe);function Oe(e,t){var n=Me.call(this)||this;if(n.aiDataContract={id:d.Default,outerId:d.Default,typeName:d.Required,message:d.Required,hasFullStack:d.Default,stack:d.Default,parsedStack:d.Array},t instanceof Error){n.typeName=te.sanitizeString(e,t.name)||re.NotSpecified,n.message=te.sanitizeMessage(e,t.message)||re.NotSpecified;var r=t.stack;n.parsedStack=Oe.parseStack(r),n.stack=te.sanitizeException(e,r),n.hasFullStack=re.isArray(n.parsedStack)&&0<n.parsedStack.length}else n.typeName=t.typeName,n.message=t.message,n.stack=t.stack,n.parsedStack=t.parsedStack,n.hasFullStack=t.hasFullStack;return n}var Pe,ke=(t(ze,Pe=xe),ze.CreateFromInterface=function(e){return new ze(e,null)},ze.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ze.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ze.baseSize=58,ze);function ze(e,t){var n=Pe.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:d.Required,method:d.Required,assembly:d.Default,fileName:d.Default,line:d.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=re.trim(r),n.fileName="",n.line=0;var i=r.match(ze.regex);i&&5<=i.length&&(n.method=re.trim(i[2])||n.method,n.fileName=re.trim(i[4]),n.line=parseInt(i[5])||0)}else n.level=e.level,n.method=e.method,n.assembly=e.assembly,n.fileName=e.fileName,n.line=e.line,n.sizeInBytes=0;return n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=ze.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var Be,Ge,Fe,qe=(t(He,Be=ye),He);function He(){var e=Be.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Fe=Ge||(Ge={}))[Fe.Measurement=0]="Measurement",Fe[Fe.Aggregation=1]="Aggregation";var Xe,je=(t(Ve,Xe=function(){this.kind=Ge.Measurement}),Ve);function Ve(){var e=null!==Xe&&Xe.apply(this,arguments)||this;return e.aiDataContract={name:d.Required,kind:d.Default,value:d.Required,count:d.Default,min:d.Default,max:d.Default,stdDev:d.Default},e}var We,Ke=(t(Ye,We=qe),Ye.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Ye.dataType="MetricData",Ye);function Ye(e,t,n,r,i,a,o){var s=We.call(this)||this;s.aiDataContract={ver:d.Required,metrics:d.Required,properties:d.Default};var l=new je;return l.count=0<r?r:void 0,l.max=isNaN(a)||null===a?void 0:a,l.min=isNaN(i)||null===i?void 0:i,l.name=te.sanitizeString(e,t)||re.NotSpecified,l.value=n,s.metrics=[l],s.properties=te.sanitizeProperties(e,o),s}var Je,Ze=(t(Qe,Je=Ie),Qe);function Qe(){var e=Je.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var $e,et=(t(tt,$e=Ze),tt.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",tt.dataType="PageviewData",tt);function tt(e,t,n,r,i,a,o){var s=$e.call(this)||this;return s.aiDataContract={ver:d.Required,name:d.Default,url:d.Default,duration:d.Default,properties:d.Default,measurements:d.Default,id:d.Default},s.id=te.sanitizeId(e,o),s.url=te.sanitizeUrl(e,n),s.name=te.sanitizeString(e,t)||re.NotSpecified,isNaN(r)||(s.duration=re.msToTimeSpan(r)),s.properties=te.sanitizeProperties(e,i),s.measurements=te.sanitizeMeasurements(e,a),s}var nt,rt=(t(it,nt=ye),it);function it(){var e=nt.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var at,ot=(t(st,at=rt),st.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",st.dataType="RemoteDependencyData",st);function st(e,t,n,r,i,a,o,s,l,u,c){void 0===l&&(l="Ajax");var p=at.call(this)||this;p.aiDataContract={id:d.Required,ver:d.Required,name:d.Default,resultCode:d.Default,duration:d.Default,success:d.Default,data:d.Default,target:d.Default,type:d.Default,properties:d.Default,measurements:d.Default,kind:d.Default,value:d.Default,count:d.Default,min:d.Default,max:d.Default,stdDev:d.Default,dependencyKind:d.Default,dependencySource:d.Default,commandName:d.Default,dependencyTypeName:d.Default},p.id=t,p.duration=re.msToTimeSpan(i),p.success=a,p.resultCode=o+"",p.type=te.sanitizeString(e,l);var f=se.ParseDependencyPath(e,n,s,r);return p.data=te.sanitizeUrl(e,r)||f.data,p.target=te.sanitizeString(e,f.target),p.name=te.sanitizeString(e,f.name),p.properties=te.sanitizeProperties(e,u),p.measurements=te.sanitizeMeasurements(e,c),p}var lt,ut=(t(ct,lt=ye),ct);function ct(){var e=lt.call(this)||this;return e.ver=2,e.properties={},e}var pt,ft=(t(dt,pt=ut),dt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",dt.dataType="MessageData",dt);function dt(e,t,n,r){var i=pt.call(this)||this;return i.aiDataContract={ver:d.Required,message:d.Required,severityLevel:d.Default,properties:d.Default},t=t||re.NotSpecified,i.message=te.sanitizeMessage(e,t),i.properties=te.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}var ht,gt=(t(mt,ht=Ze),mt);function mt(){var e=ht.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var vt,yt=(t(_t,vt=gt),_t.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",_t.dataType="PageviewPerformanceData",_t);function _t(e,t,n,r,i,a,o){var s=vt.call(this)||this;return s.aiDataContract={ver:d.Required,name:d.Default,url:d.Default,duration:d.Default,perfTotal:d.Default,networkConnect:d.Default,sentRequest:d.Default,receivedResponse:d.Default,domProcessing:d.Default,properties:d.Default,measurements:d.Default},s.url=te.sanitizeUrl(e,n),s.name=te.sanitizeString(e,t)||re.NotSpecified,s.properties=te.sanitizeProperties(e,i),s.measurements=te.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var It,St,bt,wt=(t(Nt,It=de),Nt);function Nt(e,t){var n=It.call(this)||this;return n.aiDataContract={baseType:d.Required,baseData:d.Required},n.baseType=e,n.baseData=t,n}(bt=St||(St={}))[bt.Verbose=0]="Verbose",bt[bt.Information=1]="Information",bt[bt.Warning=2]="Warning",bt[bt.Error=3]="Error",bt[bt.Critical=4]="Critical";var xt=(Et.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!g.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],g.isNullOrUndefined(i)?r:i},Et);function Et(){}var Ct=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"},At=new Ct,Tt=(Dt.prototype.enqueue=function(e){this._buffer.push(e)},Dt.prototype.count=function(){return this._buffer.length},Dt.prototype.clear=function(){this._buffer.length=0},Dt.prototype.getItems=function(){return this._buffer.slice(0)},Dt.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},Dt.prototype.markAsSent=function(e){this.clear()},Dt.prototype.clearSent=function(e){},Dt);function Dt(e){this._config=e,this._buffer=[]}var Rt=(Lt.prototype.enqueue=function(e){this._buffer.length>=Lt.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(this._logger.throwInternal(m.WARNING,X,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(e),this.setBuffer(Lt.BUFFER_KEY,this._buffer))},Lt.prototype.count=function(){return this._buffer.length},Lt.prototype.clear=function(){this._buffer.length=0,this.setBuffer(Lt.BUFFER_KEY,[]),this.setBuffer(Lt.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},Lt.prototype.getItems=function(){return this._buffer.slice(0)},Lt.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},Lt.prototype.markAsSent=function(e){this._buffer=this.removePayloadsFromBuffer(e,this._buffer),this.setBuffer(Lt.BUFFER_KEY,this._buffer);var t=this.getBuffer(Lt.SENT_BUFFER_KEY);t instanceof Array&&e instanceof Array&&((t=t.concat(e)).length>Lt.MAX_BUFFER_SIZE&&(this._logger.throwInternal(m.CRITICAL,X,"Sent buffer reached its maximum size: "+t.length,!0),t.length=Lt.MAX_BUFFER_SIZE),this.setBuffer(Lt.SENT_BUFFER_KEY,t))},Lt.prototype.clearSent=function(e){var t=this.getBuffer(Lt.SENT_BUFFER_KEY);t=this.removePayloadsFromBuffer(e,t),this.setBuffer(Lt.SENT_BUFFER_KEY,t)},Lt.prototype.removePayloadsFromBuffer=function(e,t){var n=[];for(var r in t){var i=!1;for(var a in e)if(e[a]===t[r]){i=!0;break}i||n.push(t[r])}return n},Lt.prototype.getBuffer=function(e){var t=e;try{t=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+t:t;var n=re.getSessionStorage(this._logger,t);if(n){var r=JSON.parse(n);if(r)return r}}catch(e){this._logger.throwInternal(m.CRITICAL,T," storage key: "+t+", "+re.getExceptionName(e),{exception:re.dump(e)})}return[]},Lt.prototype.setBuffer=function(e,t){var n=e;try{n=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+n:n;var r=JSON.stringify(t);re.setSessionStorage(this._logger,n,r)}catch(e){re.setSessionStorage(this._logger,n,JSON.stringify([])),this._logger.throwInternal(m.WARNING,A," storage key: "+n+", "+re.getExceptionName(e)+". Buffer cleared",{exception:re.dump(e)})}},Lt.BUFFER_KEY="AI_buffer",Lt.SENT_BUFFER_KEY="AI_sentBuffer",Lt.MAX_BUFFER_SIZE=2e3,Lt);function Lt(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(Lt.BUFFER_KEY),r=this.getBuffer(Lt.SENT_BUFFER_KEY);this._buffer=n.concat(r),this._buffer.length>Lt.MAX_BUFFER_SIZE&&(this._buffer.length=Lt.MAX_BUFFER_SIZE),this.setBuffer(Lt.SENT_BUFFER_KEY,[]),this.setBuffer(Lt.BUFFER_KEY,this._buffer)}var Mt=(Ut.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];"number"!=typeof r&&(t||(t={}),t[n]=r)}return t},Ut.extractPropsAndMeasurements=function(e,t,n){if(!g.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]="string"==typeof i?i:JSON.stringify(i)}},Ut.createEnvelope=function(e,t,n,r){var i=new me(e,r,t);i.iKey=n.iKey;var a=n.iKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),Ut.extractPartAExtensions(n,i),n.tags||(n.tags=[]),i},Ut.extractPartAExtensions=function(n,e){if(e.tags||(e.tags={}),n.ext||(n.ext={}),n.tags||(n.tags=[]),n.ext.user){n.ext.user.authId&&(e.tags[At.userAuthUserId]=n.ext.user.authId);var t=n.ext.user.id||n.ext.user.localId;t&&(e.tags[At.userId]=t)}if(n.ext.app&&n.ext.app.sesId&&(e.tags[At.sessionId]=n.ext.app.sesId),n.ext.device&&((n.ext.device.id||n.ext.device.localId)&&(e.tags[At.deviceId]=n.ext.device.id||n.ext.device.localId),n.ext.device.deviceClass&&(e.tags[At.deviceType]=n.ext.device.deviceClass),n.ext.device.ip&&(e.tags[At.deviceIp]=n.ext.device.ip)),n.ext.web){var r=n.ext.web;r.browserLang&&(e.tags[At.deviceLanguage]=r.browserLang),r.browserVer&&(e.tags[At.deviceBrowserVersion]=r.browserVer),r.browser&&(e.tags[At.deviceBrowser]=r.browser),e.data=e.data||{},e.data.baseData=e.data.baseData||{},e.data.baseData.properties=e.data.baseData.properties||{},r.domain&&(e.data.baseData.properties.domain=r.domain),r.isManual&&(e.data.baseData.properties.isManual=r.isManual.toString()),r.screenRes&&(e.data.baseData.properties.screenRes=r.screenRes),r.userConsent&&(e.data.baseData.properties.userConsent=r.userConsent.toString())}n.ext.device&&n.ext.device.model&&(e.tags[At.deviceModel]=n.ext.device.model),n.ext.os&&n.ext.os.name&&(e.tags[At.deviceOS]=n.ext.os.name),n.ext.device&&n.ext.device.deviceType&&(e.tags[At.deviceType]=n.ext.device.deviceType),n.ext.trace&&(n.ext.trace.parentID&&(e.tags[At.operationParentId]=n.ext.trace.parentID),n.ext.trace.name&&(e.tags[At.operationName]=n.ext.trace.name),n.ext.trace.traceID&&(e.tags[At.operationId]=n.ext.trace.traceID));for(var i={},a=function(e){var t=n.tags[e];Object.keys(t).forEach(function(e){i[e]=t[e]}),n.tags.splice(e,1)},o=n.tags.length-1;0<=o;o--)a(o);for(var s in n.tags)i[s]=n.tags[s];e.tags=p({},e.tags,i),e.tags[At.internalSdkVersion]||(e.tags[At.internalSdkVersion]="javascript:"+Ut.Version)},Ut.Version="2.1.0",Ut);function Ut(){}var Ot,Pt=(t(kt,Ot=Mt),kt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.measurements||{},r=t.baseData.properties||{};Mt.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(g.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.target,s=i.name,l=i.duration,u=i.success,c=i.responseCode,p=i.type,f=i.properties&&i.properties[fe]?i.properties[fe]:"GET",d=new ot(e,a,o,s,l,u,c,f,p,r,n),h=new wt(ot.dataType,d);return Mt.createEnvelope(e,ot.envelopeType,t,h)},kt.DependencyEnvelopeCreator=new kt,kt);function kt(){return null!==Ot&&Ot.apply(this,arguments)||this}var zt,Bt=(t(Gt,zt=Mt),Gt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==we.dataType&&(n.baseTypeSource=t.baseType),t.baseType===we.dataType?(n=t.baseData.properties||{},r=t.baseData.measurements||{}):t.baseData&&Mt.extractPropsAndMeasurements(t.baseData,n,r),Mt.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new we(e,i,n,r),o=new wt(we.dataType,a);return Mt.createEnvelope(e,we.envelopeType,t,o)},Gt.EventEnvelopeCreator=new Gt,Gt);function Gt(){return null!==zt&&zt.apply(this,arguments)||this}var Ft,qt=(t(Ht,Ft=Mt),Ht.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=Re.CreateFromInterface(e,n),i=new wt(Re.dataType,r);return Mt.createEnvelope(e,Re.envelopeType,t,i)},Ht.ExceptionEnvelopeCreator=new Ht,Ht);function Ht(){return null!==Ft&&Ft.apply(this,arguments)||this}var Xt,jt=(t(Vt,Xt=Mt),Vt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.properties||{},r=Mt.extractProperties(t.data);r=p({},n,r);var i=t.baseData.name,a=t.baseData.average,o=t.baseData.sampleCount,s=t.baseData.min,l=t.baseData.max,u=new Ke(e,i,a,o,s,l,r),c=new wt(Ke.dataType,u);return Mt.createEnvelope(e,Ke.envelopeType,t,c)},Vt.MetricEnvelopeCreator=new Vt,Vt);function Vt(){return null!==Xt&&Xt.apply(this,arguments)||this}var Wt,Kt=(t(Yt,Wt=Mt),Yt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=void 0;g.isNullOrUndefined(t.baseData)||g.isNullOrUndefined(t.baseData.properties)||g.isNullOrUndefined(t.baseData.properties.duration)?g.isNullOrUndefined(t.data)||g.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration):(n=t.baseData.properties.duration,delete t.baseData.properties.duration);var r,i=t.baseData;t.ext&&t.ext.trace&&t.ext.trace.traceID&&(r=t.ext.trace.traceID);var a=i.id||r,o=i.name,s=i.uri,l=i.properties||{},u=i.measurements||{};if(g.isNullOrUndefined(i.refUri)||(l.refUri=i.refUri),g.isNullOrUndefined(i.pageType)||(l.pageType=i.pageType),g.isNullOrUndefined(i.isLoggedIn)||(l.isLoggedIn=i.isLoggedIn.toString()),!g.isNullOrUndefined(i.properties)){var c=i.properties;for(var p in c)c.hasOwnProperty(p)&&(l[p]=c[p])}var f=new et(e,o,s,n,l,u,a),d=new wt(et.dataType,f);return Mt.createEnvelope(e,et.envelopeType,t,d)},Yt.PageViewEnvelopeCreator=new Yt,Yt);function Yt(){return null!==Wt&&Wt.apply(this,arguments)||this}var Jt,Zt=(t(Qt,Jt=Mt),Qt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.name,i=n.uri||n.url,a=n.properties,o=n.measurements,s=new yt(e,r,i,void 0,a,o,n),l=new wt(yt.dataType,s);return Mt.createEnvelope(e,yt.envelopeType,t,l)},Qt.PageViewPerformanceEnvelopeCreator=new Qt,Qt);function Qt(){return null!==Jt&&Jt.apply(this,arguments)||this}var $t,en=(t(tn,$t=Mt),tn.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=Mt.extractProperties(t.data),a=p({},i,t.baseData.properties),o=new ft(e,n,r,a),s=new wt(ft.dataType,o);return Mt.createEnvelope(e,ft.envelopeType,t,s)},tn.TraceEnvelopeCreator=new tn,tn);function tn(){return null!==$t&&$t.apply(this,arguments)||this}var nn=(rn.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},rn.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",r={};if(!e)return this._logger.throwInternal(m.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(m.WARNING,O,"Circular reference detected while serializing object",{name:t},!0),r;if(!e.aiDataContract){if("measurements"===t)r=this._serializeStringMap(e,"number",t);else if("properties"===t)r=this._serializeStringMap(e,"string",t);else if("tags"===t)r=this._serializeStringMap(e,"string",t);else if(re.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(m.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(m.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return r}for(var i in e[n]=!0,e.aiDataContract){var a,o=e.aiDataContract[i],s="function"==typeof o?o()&d.Required:o&d.Required,l="function"==typeof o?o()&d.Hidden:o&d.Hidden,u=o&d.Array,c=void 0!==e[i],p="object"==typeof e[i]&&null!==e[i];!s||c||u?l||void 0!==(a=p?u?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a):this._logger.throwInternal(m.CRITICAL,w,"Missing required field specification. The field is required but not present on source",{field:i,name:t})}return delete e[n],r},rn.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(re.isArray(e)){n=[];for(var r=0;r<e.length;r++){var i=e[r],a=this._serializeObject(i,t+"["+r+"]");n.push(a)}}else this._logger.throwInternal(m.CRITICAL,k,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},rn.prototype._serializeStringMap=function(e,t,n){var r=void 0;if(e)for(var i in r={},e){var a=e[i];if("string"===t)void 0===a?r[i]="undefined":null===a?r[i]="null":a.toString?r[i]=a.toString():r[i]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===a)r[i]="undefined";else if(null===a)r[i]="null";else{var o=parseFloat(a);isNaN(o)?r[i]="NaN":r[i]=o}else r[i]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(m.CRITICAL,r[i],null,!0)}return r},rn);function rn(e){this._logger=e}function an(){this._onlineStatus=!0;try{"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}catch(e){this.isListening=!1}}var on=(an.prototype._setOnline=function(){this._onlineStatus=!0},an.prototype._setOffline=function(){this._onlineStatus=!1},an.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!(navigator&&!g.isNullOrUndefined(navigator.onLine))||navigator.onLine},an.prototype.isOffline=function(){return!this.isOnline()},an.Offline=new an,an).Offline,sn=(ln.prototype.getHashCodeScore=function(e){return this.getHashCode(e)/ln.INT_MAX_VALUE*100},ln.prototype.getHashCode=function(e){if(""==e)return 0;for(;e.length<ln.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)},ln.INT_MAX_VALUE=2147483647,ln.MIN_INPUT_LENGTH=8,ln);function ln(){}var un=(cn.prototype.getSamplingScore=function(e){return e.tags&&e.tags[this.keys.userId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[this.keys.userId]):e.ext&&e.ext.user&&e.ext.user.id?this.hashCodeGeneragor.getHashCodeScore(e.ext.user.id):e.tags&&e.tags[this.keys.operationId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[this.keys.operationId]):e.ext&&e.ext.telemetryTrace&&e.ext.telemetryTrace.traceID?this.hashCodeGeneragor.getHashCodeScore(e.ext.telemetryTrace.traceID):100*Math.random()},cn);function cn(){this.hashCodeGeneragor=new sn,this.keys=new Ct}var pn=(fn.prototype.isSampledIn=function(e){var t=this.sampleRate;return null==t||100<=t||e.baseType===Ke.dataType||this.samplingScoreGenerator.getSamplingScore(e)<t},fn);function fn(e,t){this.INT_MAX_VALUE=2147483647,g.isNullOrUndefined(t)?this._logger=new J:this._logger=t,(100<e||e<0)&&(this._logger.throwInternal(m.WARNING,G,"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 un}var dn=(hn.prototype.pause=function(){throw new Error("Method not implemented.")},hn.prototype.resume=function(){throw new Error("Method not implemented.")},hn.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(m.CRITICAL,S,"flush failed, telemetry will not be collected: "+re.getExceptionName(e),{exception:re.dump(e)})}},hn.prototype.teardown=function(){throw new Error("Method not implemented.")},hn.prototype.initialize=function(t,e,n){var r=this;this._logger=e.logger,this._serializer=new nn(e.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._sender=null;var i=hn._getDefaultAppInsightsChannelConfig();function a(e){o._config[e]=function(){return xt.getConfig(t,e,r.identifier,i[e]())}}this._config=hn._getEmptyAppInsightsChannelConfig();var o=this;for(var s in i)a(s);this._buffer=this._config.enableSessionStorageBuffer&&re.canUseSessionStorage()?new Rt(this._logger,this._config):new Tt(this._config),this._sample=new pn(this._config.samplingPercentage(),this._logger),!this._config.isBeaconApiDisabled()&&re.IsBeaconApiSupported()?this._sender=this._beaconSender:"undefined"!=typeof XMLHttpRequest&&("withCredentials"in new XMLHttpRequest?(this._sender=this._xhrSender,this._XMLHttpRequestSupported=!0):"undefined"!=typeof XDomainRequest&&(this._sender=this._xdrSender))},hn.prototype.processTelemetry=function(e){var t=this;try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(m.CRITICAL,_,"Cannot send empty telemetry");if(e.baseData&&!e.baseType)return void this._logger.throwInternal(m.CRITICAL,W,"Cannot send telemetry without baseData and baseType");if(e.baseType||(e.baseType="EventData"),!this._sender)return void this._logger.throwInternal(m.CRITICAL,x,"Sender was not initialized");if(!this._isSampledIn(e))return void this._logger.throwInternal(m.WARNING,E,"Telemetry item was sampled out and not sent",{SampleRate:this._sample.sampleRate});e.tags=e.tags||{},e.tags.sampleRate=this._sample.sampleRate;var n=hn.constructEnvelope(e,this._config.instrumentationKey(),this._logger);if(!n)return void this._logger.throwInternal(m.CRITICAL,L,"Unable to create an AppInsights envelope");var r=!1;if(e.tags&&e.tags[pe]&&(e.tags[pe].forEach(function(e){try{e&&!1===e(n)&&(r=!0,t._logger.warnToConsole("Telemetry processor check returns false"))}catch(e){t._logger.throwInternal(m.CRITICAL,q,"One of telemetry initializers failed, telemetry item will not be sent: "+re.getExceptionName(e),{exception:re.dump(e)},!0)}}),delete e.tags[pe]),r)return;var i=this._serializer.serialize(n),a=this._buffer.getItems(),o=this._buffer.batchPayloads(a);o&&o.length+i.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(i),this._setupTimer()}catch(e){this._logger.throwInternal(m.WARNING,I,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+re.getExceptionName(e),{exception:re.dump(e)})}g.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},hn.prototype.setNextPlugin=function(e){this._nextPlugin=e},hn.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var r=null;this._appId||(r=this._parseResponse(e.responseText||e.response))&&r.appId&&(this._appId=r.appId),(e.status<200||300<=e.status)&&0!==e.status?!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(m.WARNING,C,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e)):on.isOffline()?this._config.isRetryDisabled()||(this._resendPayload(t,10),this._logger.throwInternal(m.WARNING,C,". Offline - Response Code: "+e.status+". Offline status: "+on.isOffline()+". Will retry to send "+t.length+" items.")):206===e.status?(r||(r=this._parseResponse(e.responseText||e.response)),r&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,r):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},hn.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!re.getIEVersion()||9<re.getIEVersion())&&this._logger.throwInternal(m.CRITICAL,C,"Telemetry transmission failed, some telemetry will be lost: "+re.getExceptionName(e),{exception:re.dump(e)})}},hn.prototype._onError=function(e,t,n){this._logger.throwInternal(m.WARNING,N,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},hn.prototype._onPartialSuccess=function(e,t){for(var n=[],r=[],i=0,a=t.errors.reverse();i<a.length;i++){var o=a[i],s=e.splice(o.index,1)[0];this._isRetriable(o.statusCode)?r.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<r.length&&(this._resendPayload(r),this._logger.throwInternal(m.WARNING,C,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+r.length+" our of "+t.itemsReceived+" items"))},hn.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},hn.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},hn.constructEnvelope=function(e,t,n){var r;switch((r=t===e.iKey||g.isNullOrUndefined(t)?e:p({},e,{iKey:t})).baseType){case we.dataType:return Bt.EventEnvelopeCreator.Create(n,r);case ft.dataType:return en.TraceEnvelopeCreator.Create(n,r);case et.dataType:return Kt.PageViewEnvelopeCreator.Create(n,r);case yt.dataType:return Zt.PageViewPerformanceEnvelopeCreator.Create(n,r);case Re.dataType:return qt.ExceptionEnvelopeCreator.Create(n,r);case Ke.dataType:return jt.MetricEnvelopeCreator.Create(n,r);case ot.dataType:return Pt.DependencyEnvelopeCreator.Create(n,r);default:return Bt.EventEnvelopeCreator.Create(n,r)}},hn._getDefaultAppInsightsChannelConfig=function(){return{endpointUrl:function(){return"https://dc.services.visualstudio.com/v2/track"},emitLineDelimitedJson:function(){return!1},maxBatchInterval:function(){return 15e3},maxBatchSizeInBytes:function(){return 102400},disableTelemetry:function(){return!1},enableSessionStorageBuffer:function(){return!0},isRetryDisabled:function(){return!1},isBeaconApiDisabled:function(){return!0},instrumentationKey:function(){},namePrefix:function(){},samplingPercentage:function(){return 100}}},hn._getEmptyAppInsightsChannelConfig=function(){return{endpointUrl:void 0,emitLineDelimitedJson:void 0,maxBatchInterval:void 0,maxBatchSizeInBytes:void 0,disableTelemetry:void 0,enableSessionStorageBuffer:void 0,isRetryDisabled:void 0,isBeaconApiDisabled:void 0,instrumentationKey:void 0,namePrefix:void 0,samplingPercentage:void 0}},hn.prototype._isSampledIn=function(e){return this._sample.isSampledIn(e)},hn.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),r=this._buffer.batchPayloads(e),i=new Blob([r],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,i)?(this._buffer.markAsSent(e),this._onSuccess(e,e.length)):(this._xhrSender(e,!0),this._logger.throwInternal(m.WARNING,C,". Failed to send telemetry with Beacon API, retried with xhrSender."))},hn.prototype._xhrSender=function(t,e){var n=this,r=new XMLHttpRequest;r.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,r.open("POST",this._config.endpointUrl(),e),r.setRequestHeader("Content-type","application/json"),re.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader($.sdkContextHeader,$.sdkContextHeaderAppIdRequest),r.onreadystatechange=function(){return n._xhrReadyStateChange(r,t,t.length)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(r),e)};var i=this._buffer.batchPayloads(t);r.send(i),this._buffer.markAsSent(t)},hn.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(m.CRITICAL,D,"Cannot parse the response. "+re.getExceptionName(e),{response:t})}return null},hn.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,r=e;n<r.length;n++){var i=r[n];this._buffer.enqueue(i)}this._setRetryTime(t),this._setupTimer()}},hn.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,r=Math.floor(Math.random()*n*10)+1;r*=e,t=Math.max(Math.min(r,3600),10)}var i=Date.now()+1e3*t;this._retryAt=i},hn.prototype._setupTimer=function(){var e=this;if(!this._timeoutHandle){var t=this._retryAt?Math.max(0,this._retryAt-Date.now()):0,n=Math.max(this._config.maxBatchInterval(),t);this._timeoutHandle=setTimeout(function(){e.triggerSend()},n)}},hn.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},hn.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},hn.prototype._xdrSender=function(t,e){var n=this,r=new XDomainRequest;r.onload=function(){return n._xdrOnLoad(r,t)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(r),e)};var i=window.location&&window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(m.WARNING,C,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var a=this._config.endpointUrl().replace(/^(https?:)/,"");r.open("POST",a);var o=this._buffer.batchPayloads(t);r.send(o),this._buffer.markAsSent(t)},hn.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},hn);function hn(){this.priority=1001,this.identifier="AppInsightsChannelPlugin",this._XMLHttpRequestSupported=!1}e.Sender=dn,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function t(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i,n,d,a,p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};(n=i||(i={}))[n.LocalStorage=0]="LocalStorage",n[n.SessionStorage=1]="SessionStorage",(a=d||(d={}))[a.Default=0]="Default",a[a.Required=1]="Required",a[a.Array=2]="Array",a[a.Hidden=4]="Hidden";var g=(o.isNullOrUndefined=function(e){return null==e},o.disableCookies=function(){o._canUseCookies=!1},o.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(l,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},o);function o(){}var m,s,l=/[xy]/g;(s=m||(m={}))[s.CRITICAL=1]="CRITICAL",s[s.WARNING=2]="WARNING";var u=1,c=2,f=3,h=4,v=5,y=6,_=7,I=12,S=22,b=23,w=24,N=26,x=28,E=33,C=40,A=41,T=42,D=43,R=46,L=47,M=48,U=49,O=50,P=52,k=54,z=56,B=57,G=58,F=61,q=64,H=66,X=67,j=68,V=69,W=70,K=(Y.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},Y.dataType="MessageData",Y.AiNonUserActionablePrefix="AI (Internal): ",Y.AiUserActionablePrefix="AI: ",Y);function Y(e,t,n,r){void 0===n&&(n=!1),this.messageId=e,this.message=(n?Y.AiUserActionablePrefix:Y.AiNonUserActionablePrefix)+e;var i=(t?" message:"+Y.sanitizeDiagnosticText(t):"")+(r?" props:"+Y.sanitizeDiagnosticText(JSON.stringify(r)):"");this.message+=i}var J=(Z.prototype.throwInternal=function(e,t,n,r,i){void 0===i&&(i=!1);var a=new K(t,n,i,r);if(this.enableDebugExceptions())throw a;if(void 0!==a&&a&&void 0!==a.message){if(i){var o=+a.messageId;(!this._messageLogged[o]||this.consoleLoggingLevel()>=m.WARNING)&&(this.warnToConsole(a.message),this._messageLogged[o]=!0)}else this.consoleLoggingLevel()>=m.WARNING&&this.warnToConsole(a.message);this.logInternalMessage(e,a)}},Z.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},Z.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},Z.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,r=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[r]?n=!1:this._messageLogged[r]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var i="Internal events throttle limit per PageView reached for this app.",a=new K(b,i,!1);this.queue.push(a),this.warnToConsole(i)}}},Z.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},Z);function Z(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={},g.isNullOrUndefined(e)||(g.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),g.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),g.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),g.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}Q.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(Q.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),Q.prototype.initialize=function(n,r,i){var a=this;if(n.isCookieUseDisabled&&g.disableCookies(),this.channelQueue=new Array,n.channels){var o=void 0;n.channels.forEach(function(e){if(e&&0<e.length){if((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){e.priority<500&&(o=e.identifier),e.initialize(n,r,i)}),o)throw Error("Channel has invalid priority"+o);for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);a.channelQueue.push(e)}})}for(var e=new Array,t=0;t<i.length;t++){var s=i[t];500<s.priority&&e.push(s)}if(0<e.length){for((e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,r,i)}),t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}};function Q(){this.identifier="ChannelControllerPlugin",this.priority=500}var $=(ee.requestContextHeader="Request-Context",ee.requestContextTargetKey="appId",ee.requestContextAppIdFormat="appId=cid-v1:",ee.requestIdHeader="Request-Id",ee.sdkContextHeader="Sdk-Context",ee.sdkContextHeaderAppIdRequest="appId",ee.requestContextHeaderLowerCase="request-context",ee);function ee(){}var te=(ne.sanitizeKeyAndAddUniqueness=function(e,t,n){var r=t.length,i=ne.sanitizeKey(e,t);if(i.length!==r){for(var a=0,o=i;void 0!==n[o];)a++,o=i.substring(0,ne.MAX_NAME_LENGTH-3)+ne.padNumber(a);i=o}return i},ne.sanitizeKey=function(e,t){var n;return t&&(t=ne.trim(t.toString())).length>ne.MAX_NAME_LENGTH&&(n=t.substring(0,ne.MAX_NAME_LENGTH),e.throwInternal(m.WARNING,B,"name is too long. It has been truncated to "+ne.MAX_NAME_LENGTH+" characters.",{name:t},!0)),n||t},ne.sanitizeString=function(e,t,n){var r;return void 0===n&&(n=ne.MAX_STRING_LENGTH),t&&(n=n||ne.MAX_STRING_LENGTH,(t=ne.trim(t)).toString().length>n&&(r=t.toString().substring(0,n),e.throwInternal(m.WARNING,F,"string value is too long. It has been truncated to "+n+" characters.",{value:t},!0))),r||t},ne.sanitizeUrl=function(e,t){return ne.sanitizeInput(e,t,ne.MAX_URL_LENGTH,H)},ne.sanitizeMessage=function(e,t){var n;return t&&t.length>ne.MAX_MESSAGE_LENGTH&&(n=t.substring(0,ne.MAX_MESSAGE_LENGTH),e.throwInternal(m.WARNING,z,"message is too long, it has been truncated to "+ne.MAX_MESSAGE_LENGTH+" characters.",{message:t},!0)),n||t},ne.sanitizeException=function(e,t){var n;return t&&t.length>ne.MAX_EXCEPTION_LENGTH&&(n=t.substring(0,ne.MAX_EXCEPTION_LENGTH),e.throwInternal(m.WARNING,P,"exception is too long, it has been truncated to "+ne.MAX_EXCEPTION_LENGTH+" characters.",{exception:t},!0)),n||t},ne.sanitizeProperties=function(t,e){if(e){var n={};for(var r in e){var i=e[r];if("object"==typeof i&&"undefined"!=typeof JSON)try{i=JSON.stringify(i)}catch(e){t.throwInternal(m.WARNING,U,"custom property is not valid",{exception:e},!0)}i=ne.sanitizeString(t,i,ne.MAX_PROPERTY_LENGTH),n[r=ne.sanitizeKeyAndAddUniqueness(t,r,n)]=i}e=n}return e},ne.sanitizeMeasurements=function(e,t){if(t){var n={};for(var r in t){var i=t[r];n[r=ne.sanitizeKeyAndAddUniqueness(e,r,n)]=i}t=n}return t},ne.sanitizeId=function(e,t){return t?ne.sanitizeInput(e,t,ne.MAX_ID_LENGTH,V).toString():t},ne.sanitizeInput=function(e,t,n,r){var i;return t&&(t=ne.trim(t)).length>n&&(i=t.substring(0,n),e.throwInternal(m.WARNING,r,"input is too long, it has been truncated to "+n+" characters.",{data:t},!0)),i||t},ne.padNumber=function(e){var t="00"+e;return t.substr(t.length-3)},ne.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},ne.MAX_NAME_LENGTH=150,ne.MAX_ID_LENGTH=128,ne.MAX_PROPERTY_LENGTH=8192,ne.MAX_STRING_LENGTH=1024,ne.MAX_URL_LENGTH=2048,ne.MAX_MESSAGE_LENGTH=32768,ne.MAX_EXCEPTION_LENGTH=32768,ne);function ne(){}var re=(ie.disableStorage=function(){ie._canUseLocalStorage=!1,ie._canUseSessionStorage=!1},ie._getLocalStorageObject=function(){return ie.canUseLocalStorage()?ie._getVerifiedStorageObject(i.LocalStorage):null},ie._getVerifiedStorageObject=function(e){var t,n,r=null;try{if("undefined"==typeof window)return null;n=new Date,(r=e===i.LocalStorage?window.localStorage:window.sessionStorage).setItem(n,n),t=r.getItem(n)!=n,r.removeItem(n),t&&(r=null)}catch(e){r=null}return r},ie.isInternalApplicationInsightsEndpoint=function(e){return-1!==ie._internalEndpoints.indexOf(e.toLowerCase())},ie.canUseLocalStorage=function(){return void 0===ie._canUseLocalStorage&&(ie._canUseLocalStorage=!!ie._getVerifiedStorageObject(i.LocalStorage)),ie._canUseLocalStorage},ie.getStorage=function(t,e){var n=ie._getLocalStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,u,"Browser failed read of local storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return null},ie.setStorage=function(t,e,n){var r=ie._getLocalStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,f,"Browser failed write to local storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.removeStorage=function(t,e){var n=ie._getLocalStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){ie._canUseLocalStorage=!1,t.throwInternal(m.WARNING,v,"Browser failed removal of local storage item. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie._getSessionStorageObject=function(){return ie.canUseSessionStorage()?ie._getVerifiedStorageObject(i.SessionStorage):null},ie.canUseSessionStorage=function(){return void 0===ie._canUseSessionStorage&&(ie._canUseSessionStorage=!!ie._getVerifiedStorageObject(i.SessionStorage)),ie._canUseSessionStorage},ie.getSessionStorageKeys=function(){var e=[];if(ie.canUseSessionStorage())for(var t in window.sessionStorage)e.push(t);return e},ie.getSessionStorage=function(t,e){var n=ie._getSessionStorageObject();if(null!==n)try{return n.getItem(e)}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,c,"Browser failed read of session storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return null},ie.setSessionStorage=function(t,e,n){var r=ie._getSessionStorageObject();if(null!==r)try{return r.setItem(e,n),!0}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,h,"Browser failed write to session storage. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.removeSessionStorage=function(t,e){var n=ie._getSessionStorageObject();if(null!==n)try{return n.removeItem(e),!0}catch(e){ie._canUseSessionStorage=!1,t.throwInternal(m.WARNING,y,"Browser failed removal of session storage item. "+ie.getExceptionName(e),{exception:ie.dump(e)})}return!1},ie.disableCookies=function(){g.disableCookies()},ie.canUseCookies=function(t){if(void 0===g._canUseCookies){g._canUseCookies=!1;try{g._canUseCookies=void 0!==ie.document.cookie}catch(e){t.throwInternal(m.WARNING,j,"Cannot access document.cookie - "+ie.getExceptionName(e),{exception:ie.dump(e)})}}return g._canUseCookies},ie.setCookie=function(e,t,n,r){var i="",a="";r&&(i=";domain="+r),ie.document.location&&"https:"===ie.document.location.protocol&&(a=";secure"),ie.canUseCookies(e)&&(ie.document.cookie=t+"="+n+i+";path=/"+a)},ie.stringToBoolOrDefault=function(e,t){return void 0===t&&(t=!1),null==e?t:"true"===e.toString().toLowerCase()},ie.getCookie=function(e,t){if(ie.canUseCookies(e)){var n="";if(t&&t.length)for(var r=t+"=",i=ie.document.cookie.split(";"),a=0;a<i.length;a++){var o=i[a];if((o=ie.trim(o))&&0===o.indexOf(r)){n=o.substring(r.length,i[a].length);break}}return n}},ie.deleteCookie=function(e,t){ie.canUseCookies(e)&&(ie.document.cookie=t+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;")},ie.trim=function(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")},ie.newId=function(){for(var e="",t=1073741824*Math.random();0<t;)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t%64),t=Math.floor(t/64);return e},ie.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie.isError=function(e){return"[object Error]"===Object.prototype.toString.call(e)},ie.isDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)},ie.toISOStringForIE8=function(e){if(ie.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"}},ie.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},ie.msToTimeSpan=function(e){(isNaN(e)||e<0)&&(e=0);var t=""+(e=Math.round(e))%1e3,n=""+Math.floor(e/1e3)%60,r=""+Math.floor(e/6e4)%60,i=""+Math.floor(e/36e5)%24,a=Math.floor(e/864e5);return t=1===t.length?"00"+t:2===t.length?"0"+t:t,n=n.length<2?"0"+n:n,r=r.length<2?"0"+r:r,(0<a?a+".":"")+(i=i.length<2?"0"+i:i)+":"+r+":"+n+"."+t},ie.isCrossOriginError=function(e,t,n,r,i){return("Script error."===e||"Script error"===e)&&!i},ie.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},ie.getExceptionName=function(e){return"[object Error]"===Object.prototype.toString.call(e)?e.name:""},ie.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},ie.IsBeaconApiSupported=function(){return"sendBeacon"in navigator&&navigator.sendBeacon},ie.getExtension=function(e,t){for(var n=null,r=0;!n&&r<e.length;)e[r]&&e[r].identifier===t&&(n=e[r]),r++;return n},ie.document="undefined"!=typeof document?document:{},ie._canUseLocalStorage=void 0,ie._canUseSessionStorage=void 0,ie._internalEndpoints=["https://dc.services.visualstudio.com/v2/track","https://breeze.aimon.applicationinsights.io/v2/track","https://dc-int.services.visualstudio.com/v2/track"],ie.NotSpecified="not_specified",ie);function ie(){}var ae=(oe.parseUrl=function(e){return oe.htmlAnchorElement||(oe.htmlAnchorElement=oe.document.createElement?oe.document.createElement("a"):{host:oe.parseHost(e)}),oe.htmlAnchorElement.href=e,oe.htmlAnchorElement},oe.getAbsoluteUrl=function(e){var t,n=oe.parseUrl(e);return n&&(t=n.href),t},oe.getPathName=function(e){var t,n=oe.parseUrl(e);return n&&(t=n.pathname),t},oe.getCompleteUrl=function(e,t){return e?e.toUpperCase()+" "+t:t},oe.parseHost=function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return null!=t&&2<t.length&&"string"==typeof t[2]&&0<t[2].length?t[2]:null},oe.document="undefined"!=typeof document?document:{},oe);function oe(){}var se=(le.ParseDependencyPath=function(e,t,n,r){var i,a=r,o=r;if(t&&0<t.length){var s=ae.parseUrl(t);if(i=s.host,!a)if(null!=s.pathname){var l=0===s.pathname.length?"/":s.pathname;"/"!==l.charAt(0)&&(l="/"+l),o=s.pathname,a=te.sanitizeString(e,n?n+" "+l:l)}else a=te.sanitizeString(e,t)}else a=i=r;return{target:i,name:a,data:o}},le);function le(){}ue.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()},ue.GetDuration=function(e,t){var n=null;return 0===e||0===t||g.isNullOrUndefined(e)||g.isNullOrUndefined(t)||(n=t-e),n};function ue(){}var ce,pe="ProcessLegacy",fe="http.method",de=(t(he,ce=function(){}),he);function he(){return ce.call(this)||this}var ge,me=(t(ve,ge=function(){this.ver=1,this.sampleRate=100,this.tags={}}),ve);function ve(e,t,n){var r=ge.call(this)||this;return r.name=te.sanitizeString(e,n)||re.NotSpecified,r.data=t,r.time=re.toISOStringForIE8(new Date),r.aiDataContract={time:d.Required,iKey:d.Required,name:d.Required,sampleRate:function(){return 100==r.sampleRate?d.Hidden:d.Required},tags:d.Required,data:d.Required},r}function ye(){}var _e,Ie=(t(Se,_e=ye),Se);function Se(){var e=_e.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var be,we=(t(Ne,be=Ie),Ne.envelopeType="Microsoft.ApplicationInsights.{0}.Event",Ne.dataType="EventData",Ne);function Ne(e,t,n,r){var i=be.call(this)||this;return i.aiDataContract={ver:d.Required,name:d.Required,properties:d.Default,measurements:d.Default},i.name=te.sanitizeString(e,t)||re.NotSpecified,i.properties=te.sanitizeProperties(e,n),i.measurements=te.sanitizeMeasurements(e,r),i}function xe(){}var Ee,Ce=(t(Ae,Ee=ye),Ae);function Ae(){var e=Ee.call(this)||this;return e.ver=2,e.exceptions=[],e.properties={},e.measurements={},e}function Te(){this.hasFullStack=!0,this.parsedStack=[]}var De,Re=(t(Le,De=Ce),Le.CreateFromInterface=function(t,e){var n=e.exceptions&&e.exceptions.map(function(e){return Ue.CreateFromInterface(t,e)});return new Le(t,p({},e,{exceptions:n}))},Le.prototype.toInterface=function(){var e=this,t=e.exceptions,n=e.properties,r=e.measurements,i=e.severityLevel,a=e.ver,o=e.problemGroup,s=e.id,l=e.isManual;return{ver:a,exceptions:t instanceof Array&&t.map(function(e){return e.toInterface()})||void 0,severityLevel:i,properties:n,measurements:r,problemGroup:o,id:s,isManual:l}},Le.CreateSimpleException=function(e,t,n,r,i,a){return{exceptions:[{hasFullStack:!0,message:e,stack:i,typeName:t}]}},Le.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",Le.dataType="ExceptionData",Le);function Le(e,t,n,r,i,a){var o=De.call(this)||this;return o.aiDataContract={ver:d.Required,exceptions:d.Required,severityLevel:d.Default,properties:d.Default,measurements:d.Default},t instanceof Error?(o.exceptions=[new Ue(e,t)],o.properties=te.sanitizeProperties(e,n),o.measurements=te.sanitizeMeasurements(e,r),i&&(o.severityLevel=i),a&&(o.id=a)):(o.exceptions=t.exceptions,o.properties=t.properties,o.measurements=t.measurements,t.severityLevel&&(o.severityLevel=t.severityLevel),t.id&&(o.id=t.id),t.problemGroup&&(o.problemGroup=t.problemGroup),g.isNullOrUndefined(t.ver)||(o.ver=t.ver),g.isNullOrUndefined(t.isManual)||(o.isManual=t.isManual)),o}var Me,Ue=(t(Oe,Me=Te),Oe.prototype.toInterface=function(){var e=this.parsedStack instanceof Array&&this.parsedStack.map(function(e){return e.toInterface()});return{id:this.id,outerId:this.outerId,typeName:this.typeName,message:this.message,hasFullStack:this.hasFullStack,stack:this.stack,parsedStack:e||void 0}},Oe.CreateFromInterface=function(e,t){var n=t.parsedStack instanceof Array&&t.parsedStack.map(function(e){return ke.CreateFromInterface(e)})||t.parsedStack;return new Oe(e,p({},t,{parsedStack:n}))},Oe.parseStack=function(e){var t=void 0;if("string"==typeof e){var n=e.split("\n");t=[];for(var r=0,i=0,a=0;a<=n.length;a++){var o=n[a];if(ke.regex.test(o)){var s=new ke(n[a],r++);i+=s.sizeInBytes,t.push(s)}}if(32768<i)for(var l=0,u=t.length-1,c=0,p=l,f=u;l<u;){if(32768<(c+=t[l].sizeInBytes+t[u].sizeInBytes)){var d=f-p+1;t.splice(p,d);break}p=l,f=u,l++,u--}}return t},Oe);function Oe(e,t){var n=Me.call(this)||this;if(n.aiDataContract={id:d.Default,outerId:d.Default,typeName:d.Required,message:d.Required,hasFullStack:d.Default,stack:d.Default,parsedStack:d.Array},t instanceof Error){n.typeName=te.sanitizeString(e,t.name)||re.NotSpecified,n.message=te.sanitizeMessage(e,t.message)||re.NotSpecified;var r=t.stack;n.parsedStack=Oe.parseStack(r),n.stack=te.sanitizeException(e,r),n.hasFullStack=re.isArray(n.parsedStack)&&0<n.parsedStack.length}else n.typeName=t.typeName,n.message=t.message,n.stack=t.stack,n.parsedStack=t.parsedStack,n.hasFullStack=t.hasFullStack;return n}var Pe,ke=(t(ze,Pe=xe),ze.CreateFromInterface=function(e){return new ze(e,null)},ze.prototype.toInterface=function(){return{level:this.level,method:this.method,assembly:this.assembly,fileName:this.fileName,line:this.line}},ze.regex=/^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/,ze.baseSize=58,ze);function ze(e,t){var n=Pe.call(this)||this;if(n.sizeInBytes=0,n.aiDataContract={level:d.Required,method:d.Required,assembly:d.Default,fileName:d.Default,line:d.Default},"string"==typeof e){var r=e;n.level=t,n.method="<no_method>",n.assembly=re.trim(r),n.fileName="",n.line=0;var i=r.match(ze.regex);i&&5<=i.length&&(n.method=re.trim(i[2])||n.method,n.fileName=re.trim(i[4]),n.line=parseInt(i[5])||0)}else n.level=e.level,n.method=e.method,n.assembly=e.assembly,n.fileName=e.fileName,n.line=e.line,n.sizeInBytes=0;return n.sizeInBytes+=n.method.length,n.sizeInBytes+=n.fileName.length,n.sizeInBytes+=n.assembly.length,n.sizeInBytes+=ze.baseSize,n.sizeInBytes+=n.level.toString().length,n.sizeInBytes+=n.line.toString().length,n}var Be,Ge,Fe,qe=(t(He,Be=ye),He);function He(){var e=Be.call(this)||this;return e.ver=2,e.metrics=[],e.properties={},e}(Fe=Ge||(Ge={}))[Fe.Measurement=0]="Measurement",Fe[Fe.Aggregation=1]="Aggregation";var Xe,je=(t(Ve,Xe=function(){this.kind=Ge.Measurement}),Ve);function Ve(){var e=null!==Xe&&Xe.apply(this,arguments)||this;return e.aiDataContract={name:d.Required,kind:d.Default,value:d.Required,count:d.Default,min:d.Default,max:d.Default,stdDev:d.Default},e}var We,Ke=(t(Ye,We=qe),Ye.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",Ye.dataType="MetricData",Ye);function Ye(e,t,n,r,i,a,o){var s=We.call(this)||this;s.aiDataContract={ver:d.Required,metrics:d.Required,properties:d.Default};var l=new je;return l.count=0<r?r:void 0,l.max=isNaN(a)||null===a?void 0:a,l.min=isNaN(i)||null===i?void 0:i,l.name=te.sanitizeString(e,t)||re.NotSpecified,l.value=n,s.metrics=[l],s.properties=te.sanitizeProperties(e,o),s}var Je,Ze=(t(Qe,Je=Ie),Qe);function Qe(){var e=Je.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var $e,et=(t(tt,$e=Ze),tt.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",tt.dataType="PageviewData",tt);function tt(e,t,n,r,i,a,o){var s=$e.call(this)||this;return s.aiDataContract={ver:d.Required,name:d.Default,url:d.Default,duration:d.Default,properties:d.Default,measurements:d.Default,id:d.Default},s.id=te.sanitizeId(e,o),s.url=te.sanitizeUrl(e,n),s.name=te.sanitizeString(e,t)||re.NotSpecified,isNaN(r)||(s.duration=re.msToTimeSpan(r)),s.properties=te.sanitizeProperties(e,i),s.measurements=te.sanitizeMeasurements(e,a),s}var nt,rt=(t(it,nt=ye),it);function it(){var e=nt.call(this)||this;return e.ver=2,e.success=!0,e.properties={},e.measurements={},e}var at,ot=(t(st,at=rt),st.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",st.dataType="RemoteDependencyData",st);function st(e,t,n,r,i,a,o,s,l,u,c){void 0===l&&(l="Ajax");var p=at.call(this)||this;p.aiDataContract={id:d.Required,ver:d.Required,name:d.Default,resultCode:d.Default,duration:d.Default,success:d.Default,data:d.Default,target:d.Default,type:d.Default,properties:d.Default,measurements:d.Default,kind:d.Default,value:d.Default,count:d.Default,min:d.Default,max:d.Default,stdDev:d.Default,dependencyKind:d.Default,dependencySource:d.Default,commandName:d.Default,dependencyTypeName:d.Default},p.id=t,p.duration=re.msToTimeSpan(i),p.success=a,p.resultCode=o+"",p.type=te.sanitizeString(e,l);var f=se.ParseDependencyPath(e,n,s,r);return p.data=te.sanitizeUrl(e,r)||f.data,p.target=te.sanitizeString(e,f.target),p.name=te.sanitizeString(e,f.name),p.properties=te.sanitizeProperties(e,u),p.measurements=te.sanitizeMeasurements(e,c),p}var lt,ut=(t(ct,lt=ye),ct);function ct(){var e=lt.call(this)||this;return e.ver=2,e.properties={},e}var pt,ft=(t(dt,pt=ut),dt.envelopeType="Microsoft.ApplicationInsights.{0}.Message",dt.dataType="MessageData",dt);function dt(e,t,n,r){var i=pt.call(this)||this;return i.aiDataContract={ver:d.Required,message:d.Required,severityLevel:d.Default,properties:d.Default},t=t||re.NotSpecified,i.message=te.sanitizeMessage(e,t),i.properties=te.sanitizeProperties(e,r),n&&(i.severityLevel=n),i}var ht,gt=(t(mt,ht=Ze),mt);function mt(){var e=ht.call(this)||this;return e.ver=2,e.properties={},e.measurements={},e}var vt,yt=(t(_t,vt=gt),_t.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",_t.dataType="PageviewPerformanceData",_t);function _t(e,t,n,r,i,a,o){var s=vt.call(this)||this;return s.aiDataContract={ver:d.Required,name:d.Default,url:d.Default,duration:d.Default,perfTotal:d.Default,networkConnect:d.Default,sentRequest:d.Default,receivedResponse:d.Default,domProcessing:d.Default,properties:d.Default,measurements:d.Default},s.url=te.sanitizeUrl(e,n),s.name=te.sanitizeString(e,t)||re.NotSpecified,s.properties=te.sanitizeProperties(e,i),s.measurements=te.sanitizeMeasurements(e,a),o&&(s.domProcessing=o.domProcessing,s.duration=o.duration,s.networkConnect=o.networkConnect,s.perfTotal=o.perfTotal,s.receivedResponse=o.receivedResponse,s.sentRequest=o.sentRequest),s}var It,St,bt,wt=(t(Nt,It=de),Nt);function Nt(e,t){var n=It.call(this)||this;return n.aiDataContract={baseType:d.Required,baseData:d.Required},n.baseType=e,n.baseData=t,n}(bt=St||(St={}))[bt.Verbose=0]="Verbose",bt[bt.Information=1]="Information",bt[bt.Warning=2]="Warning",bt[bt.Error=3]="Error",bt[bt.Critical=4]="Critical";var xt=(Et.getConfig=function(e,t,n,r){var i;return void 0===r&&(r=!1),i=n&&e.extensionConfig&&e.extensionConfig[n]&&!g.isNullOrUndefined(e.extensionConfig[n][t])?e.extensionConfig[n][t]:e[t],g.isNullOrUndefined(i)?r:i},Et);function Et(){}var Ct=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"},At=new Ct,Tt=(Dt.prototype.enqueue=function(e){this._buffer.push(e)},Dt.prototype.count=function(){return this._buffer.length},Dt.prototype.clear=function(){this._buffer.length=0},Dt.prototype.getItems=function(){return this._buffer.slice(0)},Dt.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},Dt.prototype.markAsSent=function(e){this.clear()},Dt.prototype.clearSent=function(e){},Dt);function Dt(e){this._config=e,this._buffer=[]}var Rt=(Lt.prototype.enqueue=function(e){this._buffer.length>=Lt.MAX_BUFFER_SIZE?this._bufferFullMessageSent||(this._logger.throwInternal(m.WARNING,X,"Maximum buffer size reached: "+this._buffer.length,!0),this._bufferFullMessageSent=!0):(this._buffer.push(e),this.setBuffer(Lt.BUFFER_KEY,this._buffer))},Lt.prototype.count=function(){return this._buffer.length},Lt.prototype.clear=function(){this._buffer.length=0,this.setBuffer(Lt.BUFFER_KEY,[]),this.setBuffer(Lt.SENT_BUFFER_KEY,[]),this._bufferFullMessageSent=!1},Lt.prototype.getItems=function(){return this._buffer.slice(0)},Lt.prototype.batchPayloads=function(e){return e&&0<e.length?this._config.emitLineDelimitedJson()?e.join("\n"):"["+e.join(",")+"]":null},Lt.prototype.markAsSent=function(e){this._buffer=this.removePayloadsFromBuffer(e,this._buffer),this.setBuffer(Lt.BUFFER_KEY,this._buffer);var t=this.getBuffer(Lt.SENT_BUFFER_KEY);t instanceof Array&&e instanceof Array&&((t=t.concat(e)).length>Lt.MAX_BUFFER_SIZE&&(this._logger.throwInternal(m.CRITICAL,X,"Sent buffer reached its maximum size: "+t.length,!0),t.length=Lt.MAX_BUFFER_SIZE),this.setBuffer(Lt.SENT_BUFFER_KEY,t))},Lt.prototype.clearSent=function(e){var t=this.getBuffer(Lt.SENT_BUFFER_KEY);t=this.removePayloadsFromBuffer(e,t),this.setBuffer(Lt.SENT_BUFFER_KEY,t)},Lt.prototype.removePayloadsFromBuffer=function(e,t){var n=[];for(var r in t){var i=!1;for(var a in e)if(e[a]===t[r]){i=!0;break}i||n.push(t[r])}return n},Lt.prototype.getBuffer=function(e){var t=e;try{t=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+t:t;var n=re.getSessionStorage(this._logger,t);if(n){var r=JSON.parse(n);if(r)return r}}catch(e){this._logger.throwInternal(m.CRITICAL,T," storage key: "+t+", "+re.getExceptionName(e),{exception:re.dump(e)})}return[]},Lt.prototype.setBuffer=function(e,t){var n=e;try{n=this._config.namePrefix&&this._config.namePrefix()?this._config.namePrefix()+"_"+n:n;var r=JSON.stringify(t);re.setSessionStorage(this._logger,n,r)}catch(e){re.setSessionStorage(this._logger,n,JSON.stringify([])),this._logger.throwInternal(m.WARNING,A," storage key: "+n+", "+re.getExceptionName(e)+". Buffer cleared",{exception:re.dump(e)})}},Lt.BUFFER_KEY="AI_buffer",Lt.SENT_BUFFER_KEY="AI_sentBuffer",Lt.MAX_BUFFER_SIZE=2e3,Lt);function Lt(e,t){this._bufferFullMessageSent=!1,this._logger=e,this._config=t;var n=this.getBuffer(Lt.BUFFER_KEY),r=this.getBuffer(Lt.SENT_BUFFER_KEY);this._buffer=n.concat(r),this._buffer.length>Lt.MAX_BUFFER_SIZE&&(this._buffer.length=Lt.MAX_BUFFER_SIZE),this.setBuffer(Lt.SENT_BUFFER_KEY,[]),this.setBuffer(Lt.BUFFER_KEY,this._buffer)}var Mt=(Ut.extractProperties=function(e){var t=null;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];"number"!=typeof r&&(t||(t={}),t[n]=r)}return t},Ut.extractPropsAndMeasurements=function(e,t,n){if(!g.isNullOrUndefined(e))for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];"number"==typeof i?n[r]=i:t[r]="string"==typeof i?i:JSON.stringify(i)}},Ut.createEnvelope=function(e,t,n,r){var i=new me(e,r,t);i.iKey=n.iKey;var a=n.iKey.replace(/-/g,"");return i.name=i.name.replace("{0}",a),Ut.extractPartAExtensions(n,i),n.tags||(n.tags=[]),i},Ut.extractPartAExtensions=function(n,e){if(e.tags||(e.tags={}),n.ext||(n.ext={}),n.tags||(n.tags=[]),n.ext.user){n.ext.user.authId&&(e.tags[At.userAuthUserId]=n.ext.user.authId);var t=n.ext.user.id||n.ext.user.localId;t&&(e.tags[At.userId]=t)}if(n.ext.app&&n.ext.app.sesId&&(e.tags[At.sessionId]=n.ext.app.sesId),n.ext.device&&((n.ext.device.id||n.ext.device.localId)&&(e.tags[At.deviceId]=n.ext.device.id||n.ext.device.localId),n.ext.device.deviceClass&&(e.tags[At.deviceType]=n.ext.device.deviceClass),n.ext.device.ip&&(e.tags[At.deviceIp]=n.ext.device.ip)),n.ext.web){var r=n.ext.web;r.browserLang&&(e.tags[At.deviceLanguage]=r.browserLang),r.browserVer&&(e.tags[At.deviceBrowserVersion]=r.browserVer),r.browser&&(e.tags[At.deviceBrowser]=r.browser),e.data=e.data||{},e.data.baseData=e.data.baseData||{},e.data.baseData.properties=e.data.baseData.properties||{},r.domain&&(e.data.baseData.properties.domain=r.domain),r.isManual&&(e.data.baseData.properties.isManual=r.isManual.toString()),r.screenRes&&(e.data.baseData.properties.screenRes=r.screenRes),r.userConsent&&(e.data.baseData.properties.userConsent=r.userConsent.toString())}n.ext.device&&n.ext.device.model&&(e.tags[At.deviceModel]=n.ext.device.model),n.ext.os&&n.ext.os.name&&(e.tags[At.deviceOS]=n.ext.os.name),n.ext.device&&n.ext.device.deviceType&&(e.tags[At.deviceType]=n.ext.device.deviceType),n.ext.trace&&(n.ext.trace.parentID&&(e.tags[At.operationParentId]=n.ext.trace.parentID),n.ext.trace.name&&(e.tags[At.operationName]=n.ext.trace.name),n.ext.trace.traceID&&(e.tags[At.operationId]=n.ext.trace.traceID));for(var i={},a=function(e){var t=n.tags[e];Object.keys(t).forEach(function(e){i[e]=t[e]}),n.tags.splice(e,1)},o=n.tags.length-1;0<=o;o--)a(o);for(var s in n.tags)i[s]=n.tags[s];e.tags=p({},e.tags,i),e.tags[At.internalSdkVersion]||(e.tags[At.internalSdkVersion]="javascript:"+Ut.Version)},Ut.Version="2.1.1",Ut);function Ut(){}var Ot,Pt=(t(kt,Ot=Mt),kt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.measurements||{},r=t.baseData.properties||{};Mt.extractPropsAndMeasurements(t.data,r,n);var i=t.baseData;if(g.isNullOrUndefined(i))return e.warnToConsole("Invalid input for dependency data"),null;var a=i.id,o=i.target,s=i.name,l=i.duration,u=i.success,c=i.responseCode,p=i.type,f=i.properties&&i.properties[fe]?i.properties[fe]:"GET",d=new ot(e,a,o,s,l,u,c,f,p,r,n),h=new wt(ot.dataType,d);return Mt.createEnvelope(e,ot.envelopeType,t,h)},kt.DependencyEnvelopeCreator=new kt,kt);function kt(){return null!==Ot&&Ot.apply(this,arguments)||this}var zt,Bt=(t(Gt,zt=Mt),Gt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n={},r={};t.baseType!==we.dataType&&(n.baseTypeSource=t.baseType),t.baseType===we.dataType?(n=t.baseData.properties||{},r=t.baseData.measurements||{}):t.baseData&&Mt.extractPropsAndMeasurements(t.baseData,n,r),Mt.extractPropsAndMeasurements(t.data,n,r);var i=t.baseData.name,a=new we(e,i,n,r),o=new wt(we.dataType,a);return Mt.createEnvelope(e,we.envelopeType,t,o)},Gt.EventEnvelopeCreator=new Gt,Gt);function Gt(){return null!==zt&&zt.apply(this,arguments)||this}var Ft,qt=(t(Ht,Ft=Mt),Ht.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=Re.CreateFromInterface(e,n),i=new wt(Re.dataType,r);return Mt.createEnvelope(e,Re.envelopeType,t,i)},Ht.ExceptionEnvelopeCreator=new Ht,Ht);function Ht(){return null!==Ft&&Ft.apply(this,arguments)||this}var Xt,jt=(t(Vt,Xt=Mt),Vt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.properties||{},r=Mt.extractProperties(t.data);r=p({},n,r);var i=t.baseData.name,a=t.baseData.average,o=t.baseData.sampleCount,s=t.baseData.min,l=t.baseData.max,u=new Ke(e,i,a,o,s,l,r),c=new wt(Ke.dataType,u);return Mt.createEnvelope(e,Ke.envelopeType,t,c)},Vt.MetricEnvelopeCreator=new Vt,Vt);function Vt(){return null!==Xt&&Xt.apply(this,arguments)||this}var Wt,Kt=(t(Yt,Wt=Mt),Yt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=void 0;g.isNullOrUndefined(t.baseData)||g.isNullOrUndefined(t.baseData.properties)||g.isNullOrUndefined(t.baseData.properties.duration)?g.isNullOrUndefined(t.data)||g.isNullOrUndefined(t.data.duration)||(n=t.data.duration,delete t.data.duration):(n=t.baseData.properties.duration,delete t.baseData.properties.duration);var r,i=t.baseData;t.ext&&t.ext.trace&&t.ext.trace.traceID&&(r=t.ext.trace.traceID);var a=i.id||r,o=i.name,s=i.uri,l=i.properties||{},u=i.measurements||{};if(g.isNullOrUndefined(i.refUri)||(l.refUri=i.refUri),g.isNullOrUndefined(i.pageType)||(l.pageType=i.pageType),g.isNullOrUndefined(i.isLoggedIn)||(l.isLoggedIn=i.isLoggedIn.toString()),!g.isNullOrUndefined(i.properties)){var c=i.properties;for(var p in c)c.hasOwnProperty(p)&&(l[p]=c[p])}var f=new et(e,o,s,n,l,u,a),d=new wt(et.dataType,f);return Mt.createEnvelope(e,et.envelopeType,t,d)},Yt.PageViewEnvelopeCreator=new Yt,Yt);function Yt(){return null!==Wt&&Wt.apply(this,arguments)||this}var Jt,Zt=(t(Qt,Jt=Mt),Qt.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData,r=n.name,i=n.uri||n.url,a=n.properties,o=n.measurements,s=new yt(e,r,i,void 0,a,o,n),l=new wt(yt.dataType,s);return Mt.createEnvelope(e,yt.envelopeType,t,l)},Qt.PageViewPerformanceEnvelopeCreator=new Qt,Qt);function Qt(){return null!==Jt&&Jt.apply(this,arguments)||this}var $t,en=(t(tn,$t=Mt),tn.prototype.Create=function(e,t){this._logger=e,g.isNullOrUndefined(t.baseData)&&this._logger.throwInternal(m.CRITICAL,R,"telemetryItem.baseData cannot be null.");var n=t.baseData.message,r=t.baseData.severityLevel,i=Mt.extractProperties(t.data),a=p({},i,t.baseData.properties),o=new ft(e,n,r,a),s=new wt(ft.dataType,o);return Mt.createEnvelope(e,ft.envelopeType,t,s)},tn.TraceEnvelopeCreator=new tn,tn);function tn(){return null!==$t&&$t.apply(this,arguments)||this}var nn=(rn.prototype.serialize=function(e){var t=this._serializeObject(e,"root");return JSON.stringify(t)},rn.prototype._serializeObject=function(e,t){var n="__aiCircularRefCheck",r={};if(!e)return this._logger.throwInternal(m.CRITICAL,M,"cannot serialize object because it is null or undefined",{name:t},!0),r;if(e[n])return this._logger.throwInternal(m.WARNING,O,"Circular reference detected while serializing object",{name:t},!0),r;if(!e.aiDataContract){if("measurements"===t)r=this._serializeStringMap(e,"number",t);else if("properties"===t)r=this._serializeStringMap(e,"string",t);else if("tags"===t)r=this._serializeStringMap(e,"string",t);else if(re.isArray(e))r=this._serializeArray(e,t);else{this._logger.throwInternal(m.WARNING,U,"Attempting to serialize an object which does not implement ISerializable",{name:t},!0);try{JSON.stringify(e),r=e}catch(e){this._logger.throwInternal(m.CRITICAL,M,e&&"function"==typeof e.toString?e.toString():"Error serializing object",null,!0)}}return r}for(var i in e[n]=!0,e.aiDataContract){var a,o=e.aiDataContract[i],s="function"==typeof o?o()&d.Required:o&d.Required,l="function"==typeof o?o()&d.Hidden:o&d.Hidden,u=o&d.Array,c=void 0!==e[i],p="object"==typeof e[i]&&null!==e[i];!s||c||u?l||void 0!==(a=p?u?this._serializeArray(e[i],i):this._serializeObject(e[i],i):e[i])&&(r[i]=a):this._logger.throwInternal(m.CRITICAL,w,"Missing required field specification. The field is required but not present on source",{field:i,name:t})}return delete e[n],r},rn.prototype._serializeArray=function(e,t){var n=void 0;if(e)if(re.isArray(e)){n=[];for(var r=0;r<e.length;r++){var i=e[r],a=this._serializeObject(i,t+"["+r+"]");n.push(a)}}else this._logger.throwInternal(m.CRITICAL,k,"This field was specified as an array in the contract but the item is not an array.\r\n",{name:t},!0);return n},rn.prototype._serializeStringMap=function(e,t,n){var r=void 0;if(e)for(var i in r={},e){var a=e[i];if("string"===t)void 0===a?r[i]="undefined":null===a?r[i]="null":a.toString?r[i]=a.toString():r[i]="invalid field: toString() is not defined.";else if("number"===t)if(void 0===a)r[i]="undefined";else if(null===a)r[i]="null";else{var o=parseFloat(a);isNaN(o)?r[i]="NaN":r[i]=o}else r[i]="invalid field: "+n+" is of unknown type.",this._logger.throwInternal(m.CRITICAL,r[i],null,!0)}return r},rn);function rn(e){this._logger=e}function an(){this._onlineStatus=!0;try{"undefined"==typeof window?this.isListening=!1:window&&window.addEventListener?(window.addEventListener("online",this._setOnline.bind(this),!1),window.addEventListener("offline",this._setOffline.bind(this),!1),this.isListening=!0):document&&document.body?(document.body.ononline=this._setOnline.bind(this),document.body.onoffline=this._setOffline.bind(this),this.isListening=!0):document?(document.ononline=this._setOnline.bind(this),document.onoffline=this._setOffline.bind(this),this.isListening=!0):this.isListening=!1}catch(e){this.isListening=!1}}var on=(an.prototype._setOnline=function(){this._onlineStatus=!0},an.prototype._setOffline=function(){this._onlineStatus=!1},an.prototype.isOnline=function(){return this.isListening?this._onlineStatus:!(navigator&&!g.isNullOrUndefined(navigator.onLine))||navigator.onLine},an.prototype.isOffline=function(){return!this.isOnline()},an.Offline=new an,an).Offline,sn=(ln.prototype.getHashCodeScore=function(e){return this.getHashCode(e)/ln.INT_MAX_VALUE*100},ln.prototype.getHashCode=function(e){if(""==e)return 0;for(;e.length<ln.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)},ln.INT_MAX_VALUE=2147483647,ln.MIN_INPUT_LENGTH=8,ln);function ln(){}var un=(cn.prototype.getSamplingScore=function(e){return e.tags&&e.tags[this.keys.userId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[this.keys.userId]):e.ext&&e.ext.user&&e.ext.user.id?this.hashCodeGeneragor.getHashCodeScore(e.ext.user.id):e.tags&&e.tags[this.keys.operationId]?this.hashCodeGeneragor.getHashCodeScore(e.tags[this.keys.operationId]):e.ext&&e.ext.telemetryTrace&&e.ext.telemetryTrace.traceID?this.hashCodeGeneragor.getHashCodeScore(e.ext.telemetryTrace.traceID):100*Math.random()},cn);function cn(){this.hashCodeGeneragor=new sn,this.keys=new Ct}var pn=(fn.prototype.isSampledIn=function(e){var t=this.sampleRate;return null==t||100<=t||e.baseType===Ke.dataType||this.samplingScoreGenerator.getSamplingScore(e)<t},fn);function fn(e,t){this.INT_MAX_VALUE=2147483647,g.isNullOrUndefined(t)?this._logger=new J:this._logger=t,(100<e||e<0)&&(this._logger.throwInternal(m.WARNING,G,"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 un}var dn=(hn.prototype.pause=function(){throw new Error("Method not implemented.")},hn.prototype.resume=function(){throw new Error("Method not implemented.")},hn.prototype.flush=function(){try{this.triggerSend()}catch(e){this._logger.throwInternal(m.CRITICAL,S,"flush failed, telemetry will not be collected: "+re.getExceptionName(e),{exception:re.dump(e)})}},hn.prototype.teardown=function(){throw new Error("Method not implemented.")},hn.prototype.initialize=function(t,e,n){var r=this;this._logger=e.logger,this._serializer=new nn(e.logger),this._consecutiveErrors=0,this._retryAt=null,this._lastSend=0,this._sender=null;var i=hn._getDefaultAppInsightsChannelConfig();function a(e){o._config[e]=function(){return xt.getConfig(t,e,r.identifier,i[e]())}}this._config=hn._getEmptyAppInsightsChannelConfig();var o=this;for(var s in i)a(s);this._buffer=this._config.enableSessionStorageBuffer&&re.canUseSessionStorage()?new Rt(this._logger,this._config):new Tt(this._config),this._sample=new pn(this._config.samplingPercentage(),this._logger),!this._config.isBeaconApiDisabled()&&re.IsBeaconApiSupported()?this._sender=this._beaconSender:"undefined"!=typeof XMLHttpRequest&&("withCredentials"in new XMLHttpRequest?(this._sender=this._xhrSender,this._XMLHttpRequestSupported=!0):"undefined"!=typeof XDomainRequest&&(this._sender=this._xdrSender))},hn.prototype.processTelemetry=function(e){var t=this;try{if(this._config.disableTelemetry())return;if(!e)return void this._logger.throwInternal(m.CRITICAL,_,"Cannot send empty telemetry");if(e.baseData&&!e.baseType)return void this._logger.throwInternal(m.CRITICAL,W,"Cannot send telemetry without baseData and baseType");if(e.baseType||(e.baseType="EventData"),!this._sender)return void this._logger.throwInternal(m.CRITICAL,x,"Sender was not initialized");if(!this._isSampledIn(e))return void this._logger.throwInternal(m.WARNING,E,"Telemetry item was sampled out and not sent",{SampleRate:this._sample.sampleRate});e.tags=e.tags||{},e.tags.sampleRate=this._sample.sampleRate;var n=hn.constructEnvelope(e,this._config.instrumentationKey(),this._logger);if(!n)return void this._logger.throwInternal(m.CRITICAL,L,"Unable to create an AppInsights envelope");var r=!1;if(e.tags&&e.tags[pe]&&(e.tags[pe].forEach(function(e){try{e&&!1===e(n)&&(r=!0,t._logger.warnToConsole("Telemetry processor check returns false"))}catch(e){t._logger.throwInternal(m.CRITICAL,q,"One of telemetry initializers failed, telemetry item will not be sent: "+re.getExceptionName(e),{exception:re.dump(e)},!0)}}),delete e.tags[pe]),r)return;var i=this._serializer.serialize(n),a=this._buffer.getItems(),o=this._buffer.batchPayloads(a);o&&o.length+i.length>this._config.maxBatchSizeInBytes()&&this.triggerSend(),this._buffer.enqueue(i),this._setupTimer()}catch(e){this._logger.throwInternal(m.WARNING,I,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+re.getExceptionName(e),{exception:re.dump(e)})}g.isNullOrUndefined(this._nextPlugin)||this._nextPlugin.processTelemetry(e)},hn.prototype.setNextPlugin=function(e){this._nextPlugin=e},hn.prototype._xhrReadyStateChange=function(e,t,n){if(4===e.readyState){var r=null;this._appId||(r=this._parseResponse(e.responseText||e.response))&&r.appId&&(this._appId=r.appId),(e.status<200||300<=e.status)&&0!==e.status?!this._config.isRetryDisabled()&&this._isRetriable(e.status)?(this._resendPayload(t),this._logger.throwInternal(m.WARNING,C,". Response code "+e.status+". Will retry to send "+t.length+" items.")):this._onError(t,this._formatErrorMessageXhr(e)):on.isOffline()?this._config.isRetryDisabled()||(this._resendPayload(t,10),this._logger.throwInternal(m.WARNING,C,". Offline - Response Code: "+e.status+". Offline status: "+on.isOffline()+". Will retry to send "+t.length+" items.")):206===e.status?(r||(r=this._parseResponse(e.responseText||e.response)),r&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,r):this._onError(t,this._formatErrorMessageXhr(e))):(this._consecutiveErrors=0,this._onSuccess(t,n))}},hn.prototype.triggerSend=function(e){void 0===e&&(e=!0);try{if(this._config.disableTelemetry())this._buffer.clear();else{if(0<this._buffer.count()){var t=this._buffer.getItems();this._sender(t,e)}this._lastSend=+new Date}clearTimeout(this._timeoutHandle),this._timeoutHandle=null,this._retryAt=null}catch(e){(!re.getIEVersion()||9<re.getIEVersion())&&this._logger.throwInternal(m.CRITICAL,C,"Telemetry transmission failed, some telemetry will be lost: "+re.getExceptionName(e),{exception:re.dump(e)})}},hn.prototype._onError=function(e,t,n){this._logger.throwInternal(m.WARNING,N,"Failed to send telemetry.",{message:t}),this._buffer.clearSent(e)},hn.prototype._onPartialSuccess=function(e,t){for(var n=[],r=[],i=0,a=t.errors.reverse();i<a.length;i++){var o=a[i],s=e.splice(o.index,1)[0];this._isRetriable(o.statusCode)?r.push(s):n.push(s)}0<e.length&&this._onSuccess(e,t.itemsAccepted),0<n.length&&this._onError(n,this._formatErrorMessageXhr(null,["partial success",t.itemsAccepted,"of",t.itemsReceived].join(" "))),0<r.length&&(this._resendPayload(r),this._logger.throwInternal(m.WARNING,C,"Partial success. Delivered: "+e.length+", Failed: "+n.length+". Will retry to send "+r.length+" our of "+t.itemsReceived+" items"))},hn.prototype._onSuccess=function(e,t){this._buffer.clearSent(e)},hn.prototype._xdrOnLoad=function(e,t){if(!e||e.responseText+""!="200"&&""!==e.responseText){var n=this._parseResponse(e.responseText);n&&n.itemsReceived&&n.itemsReceived>n.itemsAccepted&&!this._config.isRetryDisabled()?this._onPartialSuccess(t,n):this._onError(t,this._formatErrorMessageXdr(e))}else this._consecutiveErrors=0,this._onSuccess(t,0)},hn.constructEnvelope=function(e,t,n){var r;switch((r=t===e.iKey||g.isNullOrUndefined(t)?e:p({},e,{iKey:t})).baseType){case we.dataType:return Bt.EventEnvelopeCreator.Create(n,r);case ft.dataType:return en.TraceEnvelopeCreator.Create(n,r);case et.dataType:return Kt.PageViewEnvelopeCreator.Create(n,r);case yt.dataType:return Zt.PageViewPerformanceEnvelopeCreator.Create(n,r);case Re.dataType:return qt.ExceptionEnvelopeCreator.Create(n,r);case Ke.dataType:return jt.MetricEnvelopeCreator.Create(n,r);case ot.dataType:return Pt.DependencyEnvelopeCreator.Create(n,r);default:return Bt.EventEnvelopeCreator.Create(n,r)}},hn._getDefaultAppInsightsChannelConfig=function(){return{endpointUrl:function(){return"https://dc.services.visualstudio.com/v2/track"},emitLineDelimitedJson:function(){return!1},maxBatchInterval:function(){return 15e3},maxBatchSizeInBytes:function(){return 102400},disableTelemetry:function(){return!1},enableSessionStorageBuffer:function(){return!0},isRetryDisabled:function(){return!1},isBeaconApiDisabled:function(){return!0},instrumentationKey:function(){},namePrefix:function(){},samplingPercentage:function(){return 100}}},hn._getEmptyAppInsightsChannelConfig=function(){return{endpointUrl:void 0,emitLineDelimitedJson:void 0,maxBatchInterval:void 0,maxBatchSizeInBytes:void 0,disableTelemetry:void 0,enableSessionStorageBuffer:void 0,isRetryDisabled:void 0,isBeaconApiDisabled:void 0,instrumentationKey:void 0,namePrefix:void 0,samplingPercentage:void 0}},hn.prototype._isSampledIn=function(e){return this._sample.isSampledIn(e)},hn.prototype._beaconSender=function(e,t){var n=this._config.endpointUrl(),r=this._buffer.batchPayloads(e),i=new Blob([r],{type:"text/plain;charset=UTF-8"});navigator.sendBeacon(n,i)?(this._buffer.markAsSent(e),this._onSuccess(e,e.length)):(this._xhrSender(e,!0),this._logger.throwInternal(m.WARNING,C,". Failed to send telemetry with Beacon API, retried with xhrSender."))},hn.prototype._xhrSender=function(t,e){var n=this,r=new XMLHttpRequest;r.Microsoft_ApplicationInsights_BypassAjaxInstrumentation=!0,r.open("POST",this._config.endpointUrl(),e),r.setRequestHeader("Content-type","application/json"),re.isInternalApplicationInsightsEndpoint(this._config.endpointUrl())&&r.setRequestHeader($.sdkContextHeader,$.sdkContextHeaderAppIdRequest),r.onreadystatechange=function(){return n._xhrReadyStateChange(r,t,t.length)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXhr(r),e)};var i=this._buffer.batchPayloads(t);r.send(i),this._buffer.markAsSent(t)},hn.prototype._parseResponse=function(t){try{if(t&&""!==t){var e=JSON.parse(t);if(e&&e.itemsReceived&&e.itemsReceived>=e.itemsAccepted&&e.itemsReceived-e.itemsAccepted==e.errors.length)return e}}catch(e){this._logger.throwInternal(m.CRITICAL,D,"Cannot parse the response. "+re.getExceptionName(e),{response:t})}return null},hn.prototype._resendPayload=function(e,t){if(void 0===t&&(t=1),e&&0!==e.length){this._buffer.clearSent(e),this._consecutiveErrors++;for(var n=0,r=e;n<r.length;n++){var i=r[n];this._buffer.enqueue(i)}this._setRetryTime(t),this._setupTimer()}},hn.prototype._setRetryTime=function(e){var t;if(this._consecutiveErrors<=1)t=10;else{var n=(Math.pow(2,this._consecutiveErrors)-1)/2,r=Math.floor(Math.random()*n*10)+1;r*=e,t=Math.max(Math.min(r,3600),10)}var i=Date.now()+1e3*t;this._retryAt=i},hn.prototype._setupTimer=function(){var e=this;if(!this._timeoutHandle){var t=this._retryAt?Math.max(0,this._retryAt-Date.now()):0,n=Math.max(this._config.maxBatchInterval(),t);this._timeoutHandle=setTimeout(function(){e.triggerSend()},n)}},hn.prototype._isRetriable=function(e){return 408==e||429==e||500==e||503==e},hn.prototype._formatErrorMessageXhr=function(e,t){return e?"XMLHttpRequest,Status:"+e.status+",Response:"+e.responseText||e.response||"":t},hn.prototype._xdrSender=function(t,e){var n=this,r=new XDomainRequest;r.onload=function(){return n._xdrOnLoad(r,t)},r.onerror=function(e){return n._onError(t,n._formatErrorMessageXdr(r),e)};var i=window.location&&window.location.protocol;if(0!==this._config.endpointUrl().lastIndexOf(i,0))return this._logger.throwInternal(m.WARNING,C,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),void this._buffer.clear();var a=this._config.endpointUrl().replace(/^(https?:)/,"");r.open("POST",a);var o=this._buffer.batchPayloads(t);r.send(o),this._buffer.markAsSent(t)},hn.prototype._formatErrorMessageXdr=function(e,t){return e?"XDomainRequest,Response:"+e.responseText||"":t},hn);function hn(){this.priority=1001,this.identifier="AppInsightsChannelPlugin",this._XMLHttpRequestSupported=!1}e.Sender=dn,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-channel-js.min.js.map |
{ | ||
"name": "@microsoft/applicationinsights-channel-js", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Microsoft Application Insights JavaScript SDK Channel", | ||
@@ -31,4 +31,4 @@ "main": "dist/applicationinsights-channel-js.js", | ||
"dependencies": { | ||
"@microsoft/applicationinsights-core-js": "2.1.0", | ||
"@microsoft/applicationinsights-common": "2.1.0", | ||
"@microsoft/applicationinsights-core-js": "2.1.1", | ||
"@microsoft/applicationinsights-common": "2.1.1", | ||
"tslib": "^1.9.3" | ||
@@ -35,0 +35,0 @@ }, |
@@ -21,3 +21,3 @@ import { | ||
export abstract class EnvelopeCreator { | ||
public static Version = "2.1.0"; | ||
public static Version = "2.1.1"; | ||
protected _logger: IDiagnosticLogger; | ||
@@ -24,0 +24,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
+ Added@microsoft/applicationinsights-common@2.1.1(transitive)
+ Added@microsoft/applicationinsights-core-js@2.1.1(transitive)
- Removed@microsoft/applicationinsights-common@2.1.0(transitive)
- Removed@microsoft/applicationinsights-core-js@2.1.0(transitive)