@microsoft/applicationinsights-react-js 3.2.0 → 3.2.1-nightly.202110-02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-react-js.js +7 -9
- package/browser/applicationinsights-react-js.js.map +1 -1
- package/browser/applicationinsights-react-js.min.js +1 -1
- package/browser/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.api.json +1 -1
- package/dist/applicationinsights-react-js.d.ts +1 -1
- package/dist/applicationinsights-react-js.js +7 -9
- package/dist/applicationinsights-react-js.js.map +1 -1
- package/dist/applicationinsights-react-js.min.js +1 -1
- package/dist/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.rollup.d.ts +1 -1
- package/dist-esm/AppInsightsContext.js +1 -1
- package/dist-esm/AppInsightsErrorBoundary.js +1 -1
- package/dist-esm/Interfaces/IReactExtensionConfig.js +1 -1
- package/dist-esm/ReactPlugin.js +1 -1
- package/dist-esm/applicationinsights-react-js.js +1 -1
- package/dist-esm/useTrackEvent.js +1 -1
- package/dist-esm/useTrackMetric.js +1 -1
- package/dist-esm/withAITracking.js +1 -1
- package/package.json +73 -70
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Plugin, 3.2.
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 3.2.1-nightly.202110-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
var e=this,t=function(e,a){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{"default":e}}function n(i){if(i&&i.__esModule)return i;var e,n=(e=Object.create)?e(null):{};return i&&Object.keys(i).forEach(function(e){var t;"default"!==e&&(t=(t=Object.getOwnPropertyDescriptor)?t(i,e):undefined,function(e,t,n){var r=Object.defineProperty;if(r)try{return r(e,t,n)}catch(i){}n&&typeof n.value!==undefined&&(e[t]=n.value)}(n,e,t.get?t:{enumerable:!0,get:function(){return i[e]}}))}),n["default"]=i,n}var s=n(a),r=t(a),u="function",p="object",l="undefined",i="prototype",o="hasOwnProperty",c=Object,f=c[i],d=c.assign,g=c.create,m=c.defineProperty,v=f[o];function h(){return typeof globalThis!==l&&globalThis?globalThis:typeof self!==l&&self?self:typeof window!==l&&window?window:typeof global!==l&&global?global:null}function y(e){throw new TypeError(e)}function T(e){if(g)return g(e);if(null==e)return{};var t=typeof e;function n(){}return t!==p&&t!==u&&y("Object prototype may only be an Object:"+e),n[i]=e,new n}(h()||{}).Symbol,(h()||{}).Reflect;var C=d||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])f[o].call(t,i)&&(e[i]=t[i]);return e},x=function(e,t){return(x=c.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t[o](n)&&(e[n]=t[n])})(e,t)};function I(e,t){function n(){this.constructor=e}typeof t!==u&&null!==t&&y("Class extends value "+t+" is not a constructor or null"),x(e,t),e[i]=null===t?T(t):(n[i]=t[i],new n)}var w,A="constructor",S="prototype",_="function",b="_dynInstFuncs",E="_isDynProxy",k="_dynClass",P="_dynInstChk",M=P,N="_dfOpts",F="_unknown_",R="__proto__",L="useBaseInst",O="setInstFuncs",j=Object,D=j.getPrototypeOf,U=0;function B(e,t){return e&&j[S].hasOwnProperty.call(e,t)}function V(e){return e&&(e===j[S]||e===Array[S])}function z(e){return V(e)||e===Function[S]}function K(e){if(e){if(D)return D(e);if(e=e[R]||e[S]||(e[A]?e[A][S]:null))return e}return null}function W(e,t){var n=[],r=j.getOwnPropertyNames;if(r)n=r(e);else for(var i in e)"string"==typeof i&&B(e,i)&&n.push(i);if(n&&0<n.length)for(var o=0;o<n.length;o++)t(n[o])}function G(e,t,n){return t!==A&&typeof e[t]===_&&(n||B(e,t))}function H(e){throw new TypeError("DynamicProto: "+e)}function q(e,t){for(var n=e.length-1;0<=n;n--)if(e[n]===t)return 1}function J(e,t){return B(e,S)?e.name||t||F:((e||{})[A]||{}).name||t||F}function X(e,r,t,n){B(e,S)||H("theClass is an invalid class definition.");var i=e[S];!function(e){if(D)for(var t=[],n=K(r);n&&!z(n)&&!q(t,n);){if(n===e)return 1;t.push(n),n=K(n)}}(i)&&H("["+J(e)+"] is not in class hierarchy of ["+J(r)+"]");var o=null;B(i,k)?o=i[k]:(o="_dynCls$"+J(e,"_")+"$"+U,U++,i[k]=o);var a=X[N],s=!!a[L];s&&n&&n[L]!==undefined&&(s=!!n[L]);var u,l,c,f,d,p,e=(l={},W(u=r,function(e){!l[e]&&G(u,e,!1)&&(l[e]=u[e])}),l);t(r,function(e,t,n,o){function r(e,t,n){var r,i=t[n];return i[E]&&o&&!1!==(r=e[b]||{})[M]&&(i=(r[t[k]]||{})[n]||i),function(){return i.apply(e,arguments)}}var i={};W(n,function(e){i[e]=r(t,n,e)});for(var a=K(e),s=[];a&&!z(a)&&!q(s,a);)W(a,function(e){!i[e]&&G(a,e,!D)&&(i[e]=r(t,a,e))}),s.push(a),a=K(a);return i}(i,r,e,s)),a=!!D&&!!a[O],c=i,o=o,f=r,d=e,n=!1!==(a=a&&n?!!n[O]:a),V(c)||(a=f[b]=f[b]||{},p=a[o]=a[o]||{},!1!==a[M]&&(a[M]=!!n),W(f,function(e){var n,r,i;G(f,e,!1)&&f[e]!==d[e]&&(p[e]=f[e],delete f[e],B(c,e)&&(!c[e]||c[e][E])||(c[e]=(n=c,r=e,(i=function(){var e,t;return(function(e,t,n,r){var i=null;if(e&&B(n,k)){var o=e[b]||{};if((i=(o[n[k]]||{})[t])||H("Missing ["+t+"] "+_),!i[P]&&!1!==o[M]){for(var a=!B(e,t),s=K(e),u=[];a&&s&&!z(s)&&!q(u,s);){var l=s[t];if(l){a=l===r;break}u.push(s),s=K(s)}try{a&&(e[t]=i),i[P]=1}catch(c){o[M]=!1}}}return i}(this,r,n,i)||(typeof(t=(t=n[e=r])===i?K(n)[e]:t)!==_&&H("["+e+"] is not a "+_),t)).apply(this,arguments)})[E]=1,i)))}))}X[N]={setInstFuncs:!0,useBaseInst:!0},(Ut=w=w||{})[Ut.CRITICAL=1]="CRITICAL",Ut[Ut.WARNING=2]="WARNING";var Z={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69,InvalidEvent:70,FailedMonitorAjaxSetRequestHeader:71,SendBrowserInfoOnUserInit:72,PluginException:73,NotificationException:74,SnippetScriptLoadFailure:99,InvalidInstrumentationKey:100,CannotParseAiBlobValue:101,InvalidContentBlob:102,TrackPageActionEventFailed:103,FailedAddingCustomDefinedRequestContext:104},$="attachEvent",Q="addEventListener",Y=m;function ee(e){return f.toString.call(e)}function te(e){return e===undefined||typeof e===l}function ne(e){return null===e||te(e)}function re(e){return!ne(e)}function ie(e){return typeof e===u}function oe(e,t,n,r){void 0===r&&(r=!1);var i=!1;if(!ne(e))try{ne(e[Q])?ne(e[$])||(e[$]("on"+t,n),i=!0):(e[Q](t,n,r),i=!0)}catch(o){}return i}function ae(e,t){return!(!e||!t||!~e.indexOf(t))}function se(e){return"[object Date]"===ee(e)}function ue(e){return"[object Array]"===ee(e)}function le(e){return"[object Error]"===ee(e)}function ce(e){return"string"==typeof e}function fe(e){return"boolean"==typeof e}function de(e,t,n){var r=e.length;try{for(var i=0;i<r&&!(i in e&&-1===t.call(n||e,e[i],i,e));i++);}catch(o){}}function pe(e,t,n){var r=e.length,n=n||0;try{for(var i=Math.max(0<=n?n:r-Math.abs(n),0);i<r;i++)if(i in e&&e[i]===t)return i}catch(o){}return-1}function ge(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"")}var me=!{toString:null}.propertyIsEnumerable("toString"),ve=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];function he(e,t,n,r){if(Y)try{var i={enumerable:!0,configurable:!0};return n&&(i.get=n),r&&(i.set=r),Y(e,t,i),!0}catch(o){}return!1}function ye(){var e=Date;return e.now?e.now():(new e).getTime()}function Te(e,t,n,r,i){var o=n;return e&&((o=e[t])===n||i&&!i(o)||r&&!r(n)||(e[t]=o=n)),o}function Ce(e){return!!e}var xe="window",Ie="navigator",we="location",Ae="JSON",Se="crypto",_e="msCrypto",be="msie",Ee="trident/",ke=null,Pe=null;function Me(e){var t=h();return t&&t[e]?t[e]:e===xe&&Ne()?window:null}function Ne(){return typeof window===p&&window}function Fe(){return typeof document===p&&document?document:Me("document")}function Re(){return typeof navigator===p&&navigator?navigator:Me(Ie)}function Le(){return typeof JSON===p&&JSON||null!==Me(Ae)}function Oe(){return Le()?JSON||Me(Ae):null}function je(){var e=Re();return!e||e.userAgent===Pe&&null!==ke||(e=((Pe=e.userAgent)||"").toLowerCase(),ke=ae(e,be)||ae(e,Ee)),ke}function De(e){var t=Object[i].toString.call(e),n="";return"[object Error]"===t?n="{ stack: '"+e.stack+"', message: '"+e.message+"', name: '"+e.name+"'":Le()&&(n=Oe().stringify(e)),t+n}function Ue(e){return e?'"'+e.replace(/\"/g,"")+'"':""}var Be=(Ve.dataType="MessageData",Ve);function Ve(e,t,n,r){void 0===n&&(n=!1),this.messageId=e,this.message=(n?"AI: ":"AI (Internal): ")+e,e="",Le()&&(e=Oe().stringify(r)),e=(t?" message:"+Ue(t):"")+(r?" props:"+Ue(e):""),this.message+=e}var ze=function zt(n){this.identifier="DiagnosticLogger",this.queue=[];var i=0,a={};X(zt,this,function(o){function e(e,t){return ne(e=n[e])?t:e}ne(n)&&(n={}),o.consoleLoggingLevel=function(){return e("loggingLevelConsole",0)},o.telemetryLoggingLevel=function(){return e("loggingLevelTelemetry",1)},o.maxInternalMessageLimit=function(){return e("maxMessageLimit",25)},o.enableDebugExceptions=function(){return e("enableDebugExceptions",!1)},o.throwInternal=function(e,t,n,r,i){if(n=new Be(t,n,i=void 0!==i&&i,r),o.enableDebugExceptions())throw n;te(n.message)||(r=o.consoleLoggingLevel(),i?(i=+n.messageId,!a[i]&&r>=w.WARNING&&(o.warnToConsole(n.message),a[i]=!0)):r>=w.WARNING&&o.warnToConsole(n.message),o.logInternalMessage(e,n))},o.warnToConsole=function(e){var t,n=typeof console!==l?console:Me("console");n&&(t="log",ie(n[t=n.warn?"warn":t])&&n[t](e))},o.resetInternalMessageCount=function(){i=0,a={}},o.logInternalMessage=function(e,t){var n,r;i>=o.maxInternalMessageLimit()||(n=!0,r="AITR_"+t.messageId,a[r]?n=!1:a[r]=!0,n&&(e<=o.telemetryLoggingLevel()&&(o.queue.push(t),i++),i===o.maxInternalMessageLimit()&&(t=new Be(Z.MessageLimitPerPVExceeded,e="Internal events throttle limit per PageView reached for this app.",!1),o.queue.push(t),o.warnToConsole(e))))}})},Ke=(We.ParentContextKey="parent",We.ChildrenContextKey="childEvts",We);function We(e,i,t){var n,o=this,a=!1;o.start=ye(),o.name=e,o.isAsync=t,o.isChildEvt=function(){return!1},ie(i)&&(a=he(o,"payload",function(){return!n&&ie(i)&&(n=i(),i=null),n})),o.getCtx=function(e){return e?(e===We.ParentContextKey||e===We.ChildrenContextKey?o:o.ctx||{})[e]:null},o.setCtx=function(e,t){e&&(e===We.ParentContextKey?(o[e]||(o.isChildEvt=function(){return!0}),o[e]=t):e===We.ChildrenContextKey?o[e]=t:(o.ctx=o.ctx||{})[e]=t)},o.complete=function(){var e=0,t=o.getCtx(We.ChildrenContextKey);if(ue(t))for(var n=0;n<t.length;n++){var r=t[n];r&&(e+=r.time)}o.time=ye()-o.start,o.exTime=o.time-e,o.complete=function(){},!a&&ie(i)&&(o.payload=i())}}var Ge="CoreUtils.doPerf";function He(e,t,n,r,i){if(e){var o=e;if(o=ie(o.getPerfMgr)?o.getPerfMgr():o){var a,s=void 0,e=o.getCtx(Ge);try{if(s=o.create(t(),r,i))return e&&s.setCtx&&(s.setCtx(Ke.ParentContextKey,e),e.getCtx&&e.setCtx&&((a=e.getCtx(Ke.ChildrenContextKey))||(a=[],e.setCtx(Ke.ChildrenContextKey,a)),a.push(s))),o.setCtx(Ge,s),n(s)}catch(u){s&&s.setCtx&&s.setCtx("exception",u)}finally{s&&o.fire(s),o.setCtx(Ge,e)}}}return n()}var qe=function(i,t){var o=this,a=null,s=ie(i.processTelemetry),u=ie(i.setNextPlugin);o._hasRun=!1,o.getPlugin=function(){return i},o.getNext=function(){return a},o.setNext=function(e){a=e},o.processTelemetry=function(n,r){r=r||t;var e=i?i.identifier:"TelemetryPluginChain";He(r?r.core():null,function(){return e+":processTelemetry"},function(){if(i&&s){o._hasRun=!0;try{r.setNext(a),u&&i.setNextPlugin(a),a&&(a._hasRun=!1),i.processTelemetry(n,r)}catch(t){var e=a&&a._hasRun;a&&e||r.diagLog().throwInternal(w.CRITICAL,Z.PluginException,"Plugin ["+i.identifier+"] failed during processTelemetry - "+De(t)),a&&!e&&a.processTelemetry(n,r)}}else a&&(o._hasRun=!0,a.processTelemetry(n,r))},function(){return{item:n}},!n.sync)}};function Je(e,t){var n=[];if(e&&0<e.length)for(var r=null,i=0;i<e.length;i++){var o=e[i];o&&ie(o.processTelemetry)&&(o=new qe(o,t),n.push(o),r&&r.setNext(o),r=o)}return 0<n.length?n[0]:null}var Xe=function Kt(e,i,n,t){var r,o,a,s,u=this,l=null;null!==t&&(e&&ie(e.getPlugin)?l=function(e,t,n){var r=[],i=!n;if(e)for(;e;){var o=e.getPlugin();!i&&o!==n||(i=!0,r.push(o)),e=e.getNext()}return i||r.push(n),Je(r,t)}(e,u,t||e.getPlugin()):t?(r=u,a=e,s=!1,(o=t)&&e&&(a=[],de(e,function(e){!s&&e!==o||(s=!0,a.push(e))})),o&&!s&&(a=a||[]).push(o),l=Je(a,r)):te(t)&&(l=Je(e,u))),u.core=function(){return n},u.diagLog=function(){return(n||{}).logger||new ze(i)},u.getCfg=function(){return i},u.getExtCfg=function(e,t){var n,r;return void 0===t&&(t={}),!i||(r=i.extensionConfig)&&e&&(n=r[e]),n||t},u.getConfig=function(e,t,n){var r;return void 0===n&&(n=!1),(e=u.getExtCfg(e,null))&&!ne(e[t])?r=e[t]:i&&!ne(i[t])&&(r=i[t]),ne(r)?n:r},u.hasNext=function(){return null!=l},u.getNext=function(){return l},u.setNext=function(e){l=e},u.processNext=function(e){var t=l;t&&(l=t.getNext(),t.processTelemetry(e,u))},u.createNew=function(e,t){return new Kt((e=void 0===e?null:e)||l,i,n,t)}},Ze="getPlugin",d=($e.prototype.initialize=function(e,t,n,r){this._baseTelInit(e,t,n,r)},$e);function $e(){var o=this,a=!1,s=null,u=null;o.core=null,o.diagLog=function(e){return o._getTelCtx(e).diagLog()},o.isInitialized=function(){return a},o.setInitialized=function(e){a=e},o.setNextPlugin=function(e){u=e},o.processNext=function(e,t){t?t.processNext(e):u&&ie(u.processTelemetry)&&u.processTelemetry(e,null)},o._getTelCtx=function(e){var t=e=void 0===e?null:e;return t||(e=s||new Xe(null,{},o.core),t=u&&u[Ze]?e.createNew(null,u[Ze]):e.createNew(null,u)),t},o._baseTelInit=function(e,t,n,r){e&&Te(e,"extensionConfig",[],null,ne),!r&&t&&(r=t.getProcessTelContext().getNext());var i=u;u&&u[Ze]&&(i=u[Ze]()),o.core=t,s=new Xe(r,e,t,i),a=!0}}var Qe="toGMTString",Ye="toUTCString",et="cookie",tt="expires",nt="enabled",rt="isCookieUseDisabled",it="disableCookiesUsage",ot="_ckMgr",at="",st=null,ut=null,lt=null,ct=Fe(),ft={},dt={};function pt(e,t){var n=mt[ot]||dt[ot];return n||(n=mt[ot]=mt(e,t),dt[ot]=n),n}function gt(e){return!e||e.isEnabled()}function mt(e,i){var t,n,l=(Te(n=(t=e||dt).cookieCfg=t.cookieCfg||{},"domain",t.cookieDomain,re,ne),Te(n,"path",t.cookiePath||"/",null,ne),ne(n[nt])&&(e=void 0,te(t[rt])||(e=!t[rt]),te(t[it])||(e=!t[it]),n[nt]=e),n),c=l.path||"/",f=l.domain,r=!1!==l[nt],d={isEnabled:function(){var e=r&&vt(i),t=dt[ot];return e&&t&&d!==t?gt(t):e},setEnabled:function(e){r=!1!==e},set:function(e,t,n,r,i){var o,a,s,u=!1;return gt(d)&&(o={},-1!=(s=(a=ge(t||at)).indexOf(";"))&&(a=ge(t.substring(0,s)),o=ht(t.substring(1+s))),Te(o,"domain",r||f,Ce,te),ne(n)||(s=je(),!te(o[tt])||0<(t=ye()+1e3*n)&&((r=new Date).setTime(t),Te(o,tt,yt(r,s?Qe:Ye)||yt(r,s?Qe:Ye)||at,Ce)),s||Te(o,"max-age",at+n,null,te)),(n=typeof location===p&&location?location:Me(we))&&"https:"===n.protocol&&(Te(o,"secure",null,null,te),(ut=null===ut?!(ce(n=(Re()||{}).userAgent)&&(ae(n,"CPU iPhone OS 12")||ae(n,"iPad; CPU OS 12")||ae(n,"Macintosh; Intel Mac OS X 10_14")&&ae(n,"Version/")&&ae(n,"Safari")||ae(n,"Macintosh; Intel Mac OS X 10_14")&&function(e,t){if(e){var n=e.length;if(e===t)return 1;if(40<=n){for(var r=n-1,i=39;0<=i;i--){if(e[r]!=t[i])return;r--}return 1}}}(n,"AppleWebKit/605.1.15 (KHTML, like Gecko)")||ae(n,"Chrome/5")||ae(n,"Chrome/6")||ae(n,"UnrealEngine")&&!ae(n,"Chrome")||ae(n,"UCBrowser/12")||ae(n,"UCBrowser/11"))):ut)&&Te(o,"SameSite","None",null,te)),Te(o,"path",i||c,null,te),(l.setCookie||Ct)(e,Tt(a,o)),u=!0),u},get:function(e){var t=at;return gt(d)?(l.getCookie||function(e){var t,n=at;return ct&&(t=ct[et]||at,lt!==t&&(ft=ht(t),lt=t),n=ge(ft[e]||at)),n})(e):t},del:function(e,t){return!!gt(d)&&d.purge(e,t)},purge:function(e,t){var n,r=!1;return vt(i)&&((n={}).path=t||"/",n[tt]="Thu, 01 Jan 1970 00:00:01 GMT",je()||(n["max-age"]="0"),(l.delCookie||Ct)(e,Tt(at,n)),r=!0),r}};return d[ot]=d}function vt(e){if(null===st){st=!1;try{st=(ct||{})[et]!==undefined}catch(n){e&&e.throwInternal(w.WARNING,Z.CannotAccessCookie,"Cannot access document.cookie - "+(le(t=n)?t.name:""),{exception:De(n)})}}var t;return st}function ht(e){var n={};return e&&e.length&&de(ge(e).split(";"),function(e){var t;(e=ge(e||at))&&(-1==(t=e.indexOf("="))?n[e]=null:n[ge(e.substring(0,t))]=ge(e.substring(1+t)))}),n}function yt(e,t){return ie(e[t])?e[t]():null}function Tt(e,t){var r=e||at;return function(e){if(e)for(var t in e)v.call(e,t)&&(n=t,t=e[t],r+="; "+n+(ne(t)?at:"="+t));var n}(t),r}function Ct(e,t){ct&&(ct[et]=e+"="+t)}var xt=4294967296,It=4294967295,wt=!1,At=123456789,St=987654321;function _t(e){e<0&&(e>>>=0),At=123456789+e&It,St=987654321-e&It,wt=!0}function bt(){try{var e=2147483647&ye();_t((Math.random()*xt^e)+e)}catch(t){}}function Et(e){return 0<e?Math.floor(kt()/It*(e+1))>>>0:0}function kt(e){var t=(t=Me(Se)||Me(_e))&&t.getRandomValues?t.getRandomValues(new Uint32Array(1))[0]&It:je()?(wt||bt(),Pt()&It):Math.floor(xt*Math.random()|0);return e||(t>>>=0),t}function Pt(e){var t=((St=36969*(65535&St)+(St>>16)&It)<<16)+(65535&(At=18e3*(65535&At)+(At>>16)&It))>>>0&It|0;return e||(t>>>=0),t}var Mt,Nt,Ft=null,Rt={_canUseCookies:undefined,isTypeof:function(e,t){return typeof e===t},isUndefined:te,isNullOrUndefined:ne,hasOwnProperty:function(e,t){return e&&v.call(e,t)},isFunction:ie,isObject:function(e){return typeof e===p},isDate:se,isArray:ue,isError:le,isString:ce,isNumber:function(e){return"number"==typeof e},isBoolean:fe,toISOString:function(e){if(se(e)){var t=function(e){return 1===(e=""+e).length?"0"+e:e};return e.getUTCFullYear()+"-"+t(1+e.getUTCMonth())+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+(""+(e.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},arrForEach:de,arrIndexOf:pe,arrMap:function(e,t,n){var r=e.length,i=n||e,o=Array(r);try{for(var a=0;a<r;a++)a in e&&(o[a]=t.call(i,e[a],e))}catch(s){}return o},arrReduce:function(e,t,n){var r,i=e.length,o=0;if(3<=arguments.length)r=n;else{for(;o<i&&!(o in e);)o++;r=e[o++]}for(;o<i;)o in e&&(r=t(r,e[o],o,e)),o++;return r},strTrim:ge,objCreate:T,objKeys:function(e){var t=typeof e;t===u||t===p&&null!==e||y("objKeys called on non-object");var n,r=[];for(n in e)e&&v.call(e,n)&&r.push(n);if(me)for(var i=ve.length,o=0;o<i;o++)e&&v.call(e,ve[o])&&r.push(ve[o]);return r},objDefineAccessors:he,addEventHandler:function(e,t){var n=!1,r=Ne()?window:Me(xe);return r&&(n=oe(r,e,t),n=oe(r.body,e,t)||n),(r=Fe())&&oe(r,e,t)||n},dateNow:ye,isIE:je,disableCookies:function(){var e=pt(e,void 0),t=Rt._canUseCookies;null===Ft&&(Ft=[],Mt=t,he(Rt,"_canUseCookies",function(){return Mt},function(t){Mt=t,de(Ft,function(e){e.setEnabled(t)})})),-1===pe(Ft,e)&&Ft.push(e),fe(t)&&e.setEnabled(t),fe(Mt)&&e.setEnabled(Mt),e.setEnabled(!1)},newGuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(Lt,function(e){var t=0|Et(15);return("x"===e?t:3&t|8).toString(16)})},perfNow:function(){var e=Me("performance");return e&&e.now?e.now():ye()},newId:function(e){void 0===e&&(e=22);for(var t=kt()>>>0,n=0,r="";r.length<e;)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[0|63&t]||"",t>>>=6,5==++n&&(t=(kt()<<2&4294967295|3&t)>>>0,n=0);return r},randomValue:Et,random32:kt,mwcRandomSeed:function(e){e?_t(e):bt()},mwcRandom32:Pt,generateW3CId:function(){for(var e,t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n="",r=0;r<4;r++)n+=t[15&(e=kt())]+t[e>>4&15]+t[e>>8&15]+t[e>>12&15]+t[e>>16&15]+t[e>>20&15]+t[e>>24&15]+t[e>>28&15];var i=t[8+(3&kt())|0];return n.substr(0,8)+n.substr(9,4)+"4"+n.substr(13,3)+i+n.substr(16,3)+n.substr(19,12)}},Lt=/[xy]/g;function Ot(){var e=null!==Nt&&Nt.apply(this,arguments)||this;return e.priority=185,e.identifier="ReactPlugin",e}var jt,Dt,Ut=(I(Ot,Nt=d),Ot.prototype.initialize=function(e,t,n,r){var i=this;Nt.prototype.initialize.call(this,e,t,n,r),this._extensionConfig=e.extensionConfig&&e.extensionConfig[this.identifier]?e.extensionConfig[this.identifier]:{history:null},de(n,function(e){"ApplicationInsightsAnalytics"===e.identifier&&(i._analyticsPlugin=e)}),this._extensionConfig.history&&(this.addHistoryListener(this._extensionConfig.history),n={uri:this._extensionConfig.history.location.pathname},this.trackPageView(n))},Ot.prototype.getCookieMgr=function(){return(t=(e=this.core)?e.getCookieMgr():t)||pt(void 0,(e||{}).logger);var e,t},Ot.prototype.processTelemetry=function(e,t){this.processNext(e,t)},Ot.prototype.trackMetric=function(e,t){this._analyticsPlugin?this._analyticsPlugin.trackMetric(e,t):this.diagLog().throwInternal(w.CRITICAL,Z.TelemetryInitializerFailed,"Analytics plugin is not available, React plugin telemetry will not be sent: ")},Ot.prototype.trackPageView=function(e){this._analyticsPlugin?this._analyticsPlugin.trackPageView(e):this.diagLog().throwInternal(w.CRITICAL,Z.TelemetryInitializerFailed,"Analytics plugin is not available, React plugin telemetry will not be sent: ")},Ot.prototype.trackEvent=function(e,t){this._analyticsPlugin?this._analyticsPlugin.trackEvent(e,t):this.diagLog().throwInternal(w.CRITICAL,Z.TelemetryInitializerFailed,"Analytics plugin is not available, React plugin telemetry will not be sent: ")},Ot.prototype.trackException=function(e,t){this._analyticsPlugin?this._analyticsPlugin.trackException(e,t):this.diagLog().throwInternal(w.CRITICAL,Z.TelemetryInitializerFailed,"Analytics plugin is not available, React plugin telemetry will not be sent: ")},Ot.prototype.addHistoryListener=function(e){var n=this;e.listen(function(t,e){setTimeout(function(){var e={uri:t.pathname};n.trackPageView(e)},500)})},Ot);function Bt(){var e=null!==Dt&&Dt.apply(this,arguments)||this;return e.state={hasError:!1},e}(m=jt={})[m.Verbose=0]="Verbose",m[m.Information=1]="Information",m[m.Warning=2]="Warning",m[m.Error=3]="Error",m[m.Critical=4]="Critical";var d=(I(Bt,Dt=r["default"].Component),Bt.prototype.componentDidCatch=function(e,t){this.setState({hasError:!0}),this.props.appInsights.trackException({error:e,exception:e,severityLevel:jt.Error,properties:t})},Bt.prototype.render=function(){if(this.state.hasError){var e=this.props.onError;return r["default"].createElement(e)}return this.props.children},Bt),Vt=a.createContext(undefined),m=function(n,r){var i=a.useRef({hookTimestamp:ye(),firstActiveTimestamp:0,totalIdleTime:0,lastActiveTimestamp:0,idleStartTimestamp:0,idleCount:0,idleTimeout:5e3}),e=a.useRef();return e.current=function(){var e=i.current;0<e.lastActiveTimestamp&&0===e.idleStartTimestamp&&ye()-e.lastActiveTimestamp>=e.idleTimeout&&(e.idleStartTimestamp=ye(),e.idleCount++)},a.useEffect(function(){var t=setInterval(e.current,100);return function(){clearInterval(t);var e=i.current;if(0===e.hookTimestamp)throw Error("useAppInsights:unload hook: hookTimestamp is not initialized.");0!==e.firstActiveTimestamp&&(e=(ye()-e.firstActiveTimestamp-e.totalIdleTime-e.idleCount*e.idleTimeout)/1e3,n.trackMetric({average:e,name:"React Component Engaged Time (seconds)",sampleCount:1},{"Component Name":r}))}},[]),function(){var e,t=i.current;0===t.firstActiveTimestamp?(t.firstActiveTimestamp=ye(),t.lastActiveTimestamp=t.firstActiveTimestamp):t.lastActiveTimestamp=ye(),0<t.idleStartTimestamp&&(e=t.lastActiveTimestamp-t.idleStartTimestamp,t.totalIdleTime+=e,t.idleStartTimestamp=0)}};e.AppInsightsContext=Vt,e.AppInsightsErrorBoundary=d,e.ReactPlugin=Ut,e.useAppInsightsContext=function(){return a.useContext(Vt)},e.useTrackEvent=function(e,t,n,r){void 0===r&&(r=!0);var i=(n=a.useState(n))[0],n=n[1],o=a.useRef(r);return a.useEffect(function(){o.current?o.current=!1:e.trackEvent({name:t},i)},[e,i,t]),n},e.useTrackMetric=m,e.withAITracking=function(n,e,r,t){return r!==undefined&&null!==r&&"string"==typeof r||(r=e.prototype&&e.prototype.constructor&&e.prototype.constructor.name||"Unknown"),t!==undefined&&null!==t&&"string"==typeof t||(t=""),I(i,o=s.Component),i.prototype.componentDidMount=function(){var e=this;this._mountTimestamp=Rt.dateNow(),this._firstActiveTimestamp=0,this._totalIdleTime=0,this._lastActiveTimestamp=0,this._idleStartTimestamp=0,this._idleCount=0,this._intervalId=setInterval(function(){0<e._lastActiveTimestamp&&0===e._idleStartTimestamp&&Rt.dateNow()-e._lastActiveTimestamp>=e._idleTimeout&&(e._idleStartTimestamp=Rt.dateNow(),e._idleCount++)},100)},i.prototype.componentWillUnmount=function(){if(0===this._mountTimestamp)throw Error("withAITracking:componentWillUnmount: mountTimestamp is not initialized.");var e,t;this._intervalId&&clearInterval(this._intervalId),0!==this._firstActiveTimestamp&&(e=this.getEngagementTimeSeconds(),t={"Component Name":r},n.trackMetric({average:e,name:"React Component Engaged Time (seconds)",sampleCount:1},t))},i.prototype.render=function(){return s.createElement("div",{onKeyDown:this.trackActivity,onMouseMove:this.trackActivity,onScroll:this.trackActivity,onMouseDown:this.trackActivity,onTouchStart:this.trackActivity,onTouchMove:this.trackActivity,className:t},s.createElement(e,C({},this.props)))},i.prototype.getEngagementTimeSeconds=function(){return(Rt.dateNow()-this._firstActiveTimestamp-this._totalIdleTime-this._idleCount*this._idleTimeout)/1e3},i;function i(){var n=null!==o&&o.apply(this,arguments)||this;return n._mountTimestamp=0,n._firstActiveTimestamp=0,n._idleStartTimestamp=0,n._lastActiveTimestamp=0,n._totalIdleTime=0,n._idleCount=0,n._idleTimeout=5e3,n.trackActivity=function(e){var t;0===n._firstActiveTimestamp?(n._firstActiveTimestamp=Rt.dateNow(),n._lastActiveTimestamp=n._firstActiveTimestamp):n._lastActiveTimestamp=Rt.dateNow(),0<n._idleStartTimestamp&&(t=n._lastActiveTimestamp-n._idleStartTimestamp,n._totalIdleTime+=t,n._idleStartTimestamp=0)},n}var o},function(e,t,n){var r=Object.defineProperty;if(r)try{return r(e,t,n)}catch(i){}typeof n.value!==undefined&&(e[t]=n.value)}(e,"__esModule",{value:!0})};"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Microsoft=e.Microsoft||{},e.Microsoft.ApplicationInsights=e.Microsoft.ApplicationInsights||{}),e.React);
|