@amplitude/plugin-network-capture-browser 1.4.5 → 1.5.0
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/lib/cjs/constants.d.ts +1 -0
- package/lib/cjs/constants.d.ts.map +1 -1
- package/lib/cjs/constants.js +4 -1
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/track-network-event.d.ts +14 -1
- package/lib/cjs/track-network-event.d.ts.map +1 -1
- package/lib/cjs/track-network-event.js +100 -5
- package/lib/cjs/track-network-event.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/constants.d.ts +1 -0
- package/lib/esm/constants.d.ts.map +1 -1
- package/lib/esm/constants.js +3 -0
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/track-network-event.d.ts +14 -1
- package/lib/esm/track-network-event.d.ts.map +1 -1
- package/lib/esm/track-network-event.js +100 -7
- package/lib/esm/track-network-event.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/scripts/amplitude-min.js +1 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.js.map +1 -1
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/constants.d.ts +1 -0
- package/lib/scripts/constants.d.ts.map +1 -1
- package/lib/scripts/track-network-event.d.ts +14 -1
- package/lib/scripts/track-network-event.d.ts.map +1 -1
- package/lib/scripts/version.d.ts +1 -1
- package/package.json +3 -3
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var VERSION = '1.
|
|
1
|
+
export var VERSION = '1.5.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/lib/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.5.0';\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var amplitudeNetworkCapturePlugin=function(t){"use strict";var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},e(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)};function i(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function u(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,u)}c((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=e.call(t,o)}catch(t){u=[6,t],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function s(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function c(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var a=function(){var t="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[t]?globalThis[t]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},l=c([],u(Array(256).keys()),!1).map((function(t){return t.toString(16).padStart(2,"0")})),h=function(t){var e,r=a();if(!(null===(e=null==r?void 0:r.crypto)||void 0===e?void 0:e.getRandomValues))return function(t){return t?(t^16*Math.random()>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,h)}(t);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,c([],u(n.entries()),!1).map((function(t){var e=u(t,2),r=e[0],n=e[1];return[4,6,8,10].includes(r)?"-".concat(l[n]):l[n]})).join("")},f=function(){function t(t){this.request=t}return Object.defineProperty(t.prototype,"headers",{get:function(){if(this._headers)return this._headers;var t=this.request.headers;if(Array.isArray(t)){var e=t;this._headers=e.reduce((function(t,e){var r=u(e,2),n=r[0],i=r[1];return t[n]=i,t}),{})}else if(t instanceof Headers){var r={};t.forEach((function(t,e){r[e]=t})),this._headers=r}else"object"==typeof t&&(this._headers=t);return this._headers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var t=a();if(null==t?void 0:t.TextEncoder){var e=this.request.body;return this._bodySize=p(e,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),t}(),d=function(){function t(t,e){this.bodyRaw=t,this.requestHeaders=e}return Object.defineProperty(t.prototype,"headers",{get:function(){return this.requestHeaders},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bodySize",{get:function(){return p(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),t}();function p(t,e){var r,n,i,o=a(),c=null==o?void 0:o.TextEncoder;if(c){var l;if("string"==typeof t)l=t,i=(new c).encode(l).length;else if(t instanceof Blob)i=(l=t).size;else if(t instanceof URLSearchParams)l=t,i=(new c).encode(l.toString()).length;else if(ArrayBuffer.isView(t))i=(l=t).byteLength;else if(t instanceof ArrayBuffer)i=(l=t).byteLength;else if(t instanceof FormData){var h=t,f=0,d=0;try{for(var p=s(h.entries()),v=p.next();!v.done;v=p.next()){var y=u(v.value,2),b=y[0],m=y[1];if(f+=b.length,"string"==typeof m)f+=(new c).encode(m).length;else{if(!(m instanceof Blob))return;f+=m.size}if(++d>=e)return}}catch(t){r={error:t}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}i=f}else if(t instanceof ReadableStream)return void(l=t);return i}}var v=function(){function t(t){this.response=t}return Object.defineProperty(t.prototype,"headers",{get:function(){var t;if(this._headers)return this._headers;if(this.response.headers instanceof Headers){var e=this.response.headers,r={};return null===(t=null==e?void 0:e.forEach)||void 0===t||t.call(e,(function(t,e){r[e]=t})),this._headers=r,r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bodySize",{get:function(){var t,e;if(void 0!==this._bodySize)return this._bodySize;var r=null===(e=null===(t=this.response.headers)||void 0===t?void 0:t.get)||void 0===e?void 0:e.call(t,"content-length"),n=r?parseInt(r,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),t.prototype.text=function(){return i(this,void 0,void 0,(function(){var t,e,r;return o(this,(function(n){switch(n.label){case 0:t=this.response.clone(),n.label=1;case 1:return n.trys.push([1,3,,4]),e=t.text(),r=new Promise((function(t){return setTimeout((function(){return t(null)}),500)})),[4,Promise.race([e,r])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}}))}))},t}(),y=function(){function t(t,e,r,n){this.statusCode=t,this.headersString=e,this.size=r,this.responseText=n}return Object.defineProperty(t.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),t.prototype.text=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.responseText]}))}))},Object.defineProperty(t.prototype,"headers",{get:function(){var t,e;if(this.headersString){var r={},n=this.headersString.split("\r\n");try{for(var i=s(n),o=i.next();!o.done;o=i.next()){var c=u(o.value.split(": "),2),a=c[0],l=c[1];a&&l&&(r[a]=l)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return r}},enumerable:!1,configurable:!0}),t}(),b=function(){function t(t,e,r,n,i,o,s,u,c,a,l){void 0===s&&(s=0),this.type=t,this.method=e,this.timestamp=r,this.startTime=n,this.url=i,this.requestWrapper=o,this.status=s,this.duration=u,this.responseWrapper=c,this.error=a,this.endTime=l}return t.prototype.toSerializable=function(){var t,e,r,n,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(t=this.requestWrapper)||void 0===t?void 0:t.headers,requestBodySize:null===(e=this.requestWrapper)||void 0===e?void 0:e.bodySize,responseHeaders:null===(r=this.responseWrapper)||void 0===r?void 0:r.headers,responseBodySize:null===(n=this.responseWrapper)||void 0===n?void 0:n.bodySize};return Object.fromEntries(Object.entries(i).filter((function(t){var e=u(t,2);return e[0],void 0!==e[1]})))},t}();var m=function(t,e){void 0===e&&(e=h()),this.callback=t,this.id=e},g=function(){function t(e){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=e;var r=a();t.isSupported()&&(this.globalScope=r)}return t.isSupported=function(){var t=a();return!!t&&!!t.fetch},t.prototype.subscribe=function(t,e){var r,n,i,o,s,u,c,a,l,h;if(this.logger||(this.logger=e),this.eventCallbacks.set(t.id,t),!this.isObserving){var f=null===(i=null===(n=null===(r=this.globalScope)||void 0===r?void 0:r.XMLHttpRequest)||void 0===n?void 0:n.prototype)||void 0===i?void 0:i.open,d=null===(u=null===(s=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===u?void 0:u.send,p=null===(l=null===(a=null===(c=this.globalScope)||void 0===c?void 0:c.XMLHttpRequest)||void 0===a?void 0:a.prototype)||void 0===l?void 0:l.setRequestHeader;f&&d&&p&&this.observeXhr(f,d,p);var v=null===(h=this.globalScope)||void 0===h?void 0:h.fetch;v&&this.observeFetch(v),this.isObserving=!0}},t.prototype.unsubscribe=function(t){this.eventCallbacks.delete(t.id)},t.prototype.triggerEventCallbacks=function(t){var e=this;this.eventCallbacks.forEach((function(r){var n;try{r.callback(t)}catch(t){null===(n=e.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",t)}}))},t.prototype.handleNetworkRequestEvent=function(t,e,r,n,i,o,s){var u;if(void 0!==o&&void 0!==s){var c,a,l,h="GET";!function(t){return"object"==typeof t&&null!==t&&"url"in t&&"method"in t}(e)?c=null===(u=null==e?void 0:e.toString)||void 0===u?void 0:u.call(e):(c=e.url,h=e.method),h=(null==r?void 0:r.method)||h,n&&(a=n.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},a=0);var f=Math.floor(performance.now()-s),d=Math.floor(o+f),p=new b(t,h,o,o,c,r,a,f,n,l,d);this.triggerEventCallbacks(p)}},t.prototype.getTimestamps=function(){var t,e;return{startTime:null===(t=Date.now)||void 0===t?void 0:t.call(Date),durationStart:null===(e=null===performance||void 0===performance?void 0:performance.now)||void 0===e?void 0:e.call(performance)}},t.prototype.observeFetch=function(t){var e=this;this.globalScope&&t&&(this.globalScope.fetch=function(r,n){return i(e,void 0,void 0,(function(){var e,i,s,u,c,a;return o(this,(function(o){switch(o.label){case 0:try{e=this.getTimestamps()}catch(t){null===(c=this.logger)||void 0===c||c.debug("an unexpected error occurred while retrieving timestamps",t)}o.label=1;case 1:return o.trys.push([1,3,,4]),[4,t(r,n)];case 2:return i=o.sent(),[3,4];case 3:return u=o.sent(),s=u,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new f(n):void 0,i?new v(i):void 0,s,null==e?void 0:e.startTime,null==e?void 0:e.durationStart)}catch(t){null===(a=this.logger)||void 0===a||a.debug("an unexpected error occurred while handling fetch",t)}if(i)return[2,i];throw s}}))}))})},t.prototype.observeXhr=function(t,e,r){if(this.globalScope&&t&&e){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,r,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var c=u(i,2),a=c[0],l=c[1];try{this.$$AmplitudeAnalyticsEvent=n({method:a,url:null===(e=null==l?void 0:l.toString)||void 0===e?void 0:e.call(l),headers:{}},o.getTimestamps())}catch(t){null===(r=o.logger)||void 0===r||r.debug("an unexpected error occurred while calling xhr open",t)}return t.apply(this,i)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this,i=t[0],s=n.$$AmplitudeAnalyticsEvent;return n.addEventListener("loadend",(function(){var t;try{var e=n.getAllResponseHeaders(),r=n.getResponseHeader("content-length"),u=new y(n.status,e,r?parseInt(r,10):void 0,n.responseText),c=n.$$AmplitudeAnalyticsEvent.headers,a=new d(i,c);s.status=n.status,o.handleNetworkRequestEvent("xhr",{url:s.url,method:s.method},a,u,void 0,s.startTime,s.durationStart)}catch(e){null===(t=o.logger)||void 0===t||t.debug("an unexpected error occurred while handling xhr send",e)}})),e.apply(n,t)},i.setRequestHeader=function(t,e){var n;try{this.$$AmplitudeAnalyticsEvent.headers[t]=e}catch(t){null===(n=o.logger)||void 0===n||n.debug("an unexpected error occurred while calling xhr setRequestHeader",t)}r.apply(this,[t,e])}}},t}(),w=new g,_="[Amplitude] Network Request";function S(t){return"function"==typeof t}function x(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var A=x((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function O(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var E=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,r,n,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=s(o),l=a.next();!l.done;l=a.next()){l.value.remove(this)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var h=this.initialTeardown;if(S(h))try{h()}catch(t){i=t instanceof A?t.errors:[t]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=s(f),p=d.next();!p.done;p=d.next()){var v=p.value;try{q(v)}catch(t){i=null!=i?i:[],t instanceof A?i=c(c([],u(i)),u(t.errors)):i.push(t)}}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}}if(i)throw new A(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)q(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&O(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&O(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),T=E.EMPTY;function k(t){return t instanceof E||t&&"closed"in t&&S(t.remove)&&S(t.add)&&S(t.unsubscribe)}function q(t){S(t)?t():t.unsubscribe()}var P={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},j=function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,c([t,e],u(r)))};function z(){}function C(t){t()}var R=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,k(e)&&e.add(r)):r.destination=N,r}return r(e,t),e.create=function(t,e,r){return new M(t,e,r)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(E),I=Function.prototype.bind;function F(t,e){return I.call(t,e)}var H=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){W(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){W(t)}else W(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){W(t)}},t}(),M=function(t){function e(e,r,n){var i,o,s=t.call(this)||this;S(e)||!e?i={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&P.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},i={next:e.next&&F(e.next,o),error:e.error&&F(e.error,o),complete:e.complete&&F(e.complete,o)}):i=e;return s.destination=new H(i),s}return r(e,t),e}(R);function W(t){var e;e=t,j((function(){throw e}))}var N={closed:!0,next:z,error:function(t){throw t},complete:z},U="function"==typeof Symbol&&Symbol.observable||"@@observable";function L(t){return t}var B=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n,i=this,o=(n=t)&&n instanceof R||function(t){return t&&S(t.next)&&S(t.error)&&S(t.complete)}(n)&&k(n)?t:new M(t,e,r);return C((function(){var t=i,e=t.operator,r=t.source;o.add(e?e.call(o,r):r?i._subscribe(o):i._trySubscribe(o))})),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=$(e))((function(e,n){var i=new M({next:function(e){try{t(e)}catch(t){n(t),i.unsubscribe()}},error:n,complete:e});r.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[U]=function(){return this},t.prototype.pipe=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return(0===(t=e).length?L:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)})(this)},t.prototype.toPromise=function(t){var e=this;return new(t=$(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function $(t){var e;return null!==(e=null!=t?t:P.Promise)&&void 0!==e?e:Promise}function D(t){return S(null==t?void 0:t.lift)}function V(t){return function(e){if(D(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function X(t,e,r,n,i){return new Y(t,e,r,n,i)}var Y=function(t){function e(e,r,n,i,o,s){var u=t.call(this,e)||this;return u.onFinalize=o,u.shouldUnsubscribe=s,u._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,u._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,u._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,u}return r(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(R);!function(t){function e(e,r){var n=t.call(this)||this;return n.source=e,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,D(e)&&(n.lift=e.lift),n}r(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,null==t||t.unsubscribe()},e.prototype.connect=function(){var t=this,e=this._connection;if(!e){e=this._connection=new E;var r=this.getSubject();e.add(this.source.subscribe(X(r,void 0,(function(){t._teardown(),r.complete()}),(function(e){t._teardown(),r.error(e)}),(function(){return t._teardown()})))),e.closed&&(this._connection=null,e=E.EMPTY)}return e},e.prototype.refCount=function(){return V((function(t,e){var r=null;t._refCount++;var n=X(e,void 0,void 0,void 0,(function(){if(!t||t._refCount<=0||0<--t._refCount)r=null;else{var n=t._connection,i=r;r=null,!n||i&&n!==i||n.unsubscribe(),e.unsubscribe()}}));t.subscribe(n),n.closed||(r=t.connect())}))(this)}}(B);var Q,G={now:function(){return(G.delegate||performance).now()},delegate:void 0},J={schedule:function(t){var e=requestAnimationFrame,r=cancelAnimationFrame,n=e((function(e){r=void 0,t(e)}));return new E((function(){return null==r?void 0:r(n)}))},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=J.delegate;return((null==r?void 0:r.requestAnimationFrame)||requestAnimationFrame).apply(void 0,c([],u(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,c([],u(t)))},delegate:void 0};new B((function(t){var e=Q||G,r=e.now(),n=0,i=function(){t.closed||(n=J.requestAnimationFrame((function(o){n=0;var s=e.now();t.next({timestamp:Q?s:o,elapsed:s-r}),i()})))};return i(),function(){n&&J.cancelAnimationFrame(n)}}));var K=x((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Z=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r(e,t),e.prototype.lift=function(t){var e=new tt(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new K},e.prototype.next=function(t){var e=this;C((function(){var r,n;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=s(e.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(t)}}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},e.prototype.error=function(t){var e=this;C((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var r=e.observers;r.length;)r.shift().error(t)}}))},e.prototype.complete=function(){var t=this;C((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?T:(this.currentObservers=null,o.push(t),new E((function(){e.currentObservers=null,O(o,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e.thrownError,i=e.isStopped;r?t.error(n):i&&t.complete()},e.prototype.asObservable=function(){var t=new B;return t.source=this,t},e.create=function(t,e){return new tt(t,e)},e}(B),tt=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return r(e,t),e.prototype.next=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===r||r.call(e,t)},e.prototype.error=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===r||r.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,r;return null!==(r=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==r?r:T},e}(Z);!function(t){function e(e){var r=t.call(this)||this;return r._value=e,r}r(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){var t=this,e=t.hasError,r=t.thrownError,n=t._value;if(e)throw r;return this._throwIfClosed(),n},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)}}(Z);var et={now:function(){return(et.delegate||Date).now()},delegate:void 0};!function(t){function e(e,r,n){void 0===e&&(e=1/0),void 0===r&&(r=1/0),void 0===n&&(n=et);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,r),i}r(e,t),e.prototype.next=function(e){var r=this,n=r.isStopped,i=r._buffer,o=r._infiniteTimeWindow,s=r._timestampProvider,u=r._windowTime;n||(i.push(e),!o&&i.push(s.now()+u)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!t.closed;i+=r?1:2)t.next(n[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,r=t._timestampProvider,n=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){for(var s=r.now(),u=0,c=1;c<n.length&&n[c]<=s;c+=2)u=c;u&&n.splice(0,u+1)}}}(Z),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}r(e,t),e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e._hasValue,i=e._value,o=e.thrownError,s=e.isStopped,u=e._isComplete;r?t.error(o):(s||u)&&(n&&t.next(i),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var e=this,r=e._hasValue,n=e._value;e._isComplete||(this._isComplete=!0,r&&t.prototype.next.call(this,n),t.prototype.complete.call(this))}}(Z);var rt,nt=function(t){function e(e,r){return t.call(this)||this}return r(e,t),e.prototype.schedule=function(t,e){return this},e}(E),it=function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,c([t,e],u(r)))},ot=function(t){return clearInterval(t)},st=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n.pending=!1,n}return r(e,t),e.prototype.schedule=function(t,e){var r;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),it(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return e;null!=e&&ot(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var r,n=!1;try{this.work(t)}catch(t){n=!0,r=t||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,O(n,this),null!=e&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(nt),ut=1,ct={};function at(t){return t in ct&&(delete ct[t],!0)}var lt=function(t){var e=ut++;return ct[e]=!0,rt||(rt=Promise.resolve()),rt.then((function(){return at(e)&&t()})),e},ht=function(t){at(t)},ft={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=ft.delegate;return((null==r?void 0:r.setImmediate)||lt).apply(void 0,c([],u(t)))},clearImmediate:function(t){return ht(t)},delegate:void 0},dt=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return r(e,t),e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.actions.push(this),e._scheduled||(e._scheduled=ft.setImmediate(e.flush.bind(e,void 0))))},e.prototype.recycleAsyncId=function(e,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,r,n);var o=e.actions;null!=r&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(ft.clearImmediate(r),e._scheduled===r&&(e._scheduled=void 0))},e}(st),pt=function(){function t(e,r){void 0===r&&(r=t.now),this.schedulerActionCtor=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(r,e)},t.now=et.now,t}(),vt=function(t){function e(e,r){void 0===r&&(r=pt.now);var n=t.call(this,e,r)||this;return n.actions=[],n._active=!1,n}return r(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var r;this._active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},e}(pt),yt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var r,n=this.actions;t=t||n.shift();do{if(r=t.execute(t.state,t.delay))break}while((t=n[0])&&t.id===e&&n.shift());if(this._active=!1,r){for(;(t=n[0])&&t.id===e&&n.shift();)t.unsubscribe();throw r}},e}(vt);new yt(dt),new vt(st);var bt=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return r(e,t),e.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.flush(this),0)},e}(st),mt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(vt);new mt(bt);var gt=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return r(e,t),e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.actions.push(this),e._scheduled||(e._scheduled=J.requestAnimationFrame((function(){return e.flush(void 0)}))))},e.prototype.recycleAsyncId=function(e,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,r,n);var o=e.actions;null!=r&&r===e._scheduled&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(J.cancelAnimationFrame(r),e._scheduled=void 0)},e}(st),wt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.flush=function(t){var e;this._active=!0,t?e=t.id:(e=this._scheduled,this._scheduled=void 0);var r,n=this.actions;t=t||n.shift();do{if(r=t.execute(t.state,t.delay))break}while((t=n[0])&&t.id===e&&n.shift());if(this._active=!1,r){for(;(t=n[0])&&t.id===e&&n.shift();)t.unsubscribe();throw r}},e}(vt);new wt(gt),function(t){function e(e,r){void 0===e&&(e=St),void 0===r&&(r=1/0);var n=t.call(this,e,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}r(e,t),e.prototype.flush=function(){for(var t,e,r=this.actions,n=this.maxFrames;(e=r[0])&&e.delay<=n&&(r.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=r.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10}(vt);var _t,St=function(t){function e(e,r,n){void 0===n&&(n=e.index+=1);var i=t.call(this,e,r)||this;return i.scheduler=e,i.work=r,i.index=n,i.active=!0,i.index=e.index=n,i}return r(e,t),e.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return t.prototype.schedule.call(this,r,n);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(r,n)}return E.EMPTY},e.prototype.requestAsyncId=function(t,r,n){void 0===n&&(n=0),this.delay=t.frame+n;var i=t.actions;return i.push(this),i.sort(e.sortActions),1},e.prototype.recycleAsyncId=function(t,e,r){},e.prototype._execute=function(e,r){if(!0===this.active)return t.prototype._execute.call(this,e,r)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(st);new B((function(t){return t.complete()})),function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(_t||(_t={})),x((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),x((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),x((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),x((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}})),x((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}})),new B(z);var xt,At="500-599";function Ot(t,e){var r="^"+e.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(r).test(t)}function Et(t,e){var r,n,i=e.split(",");try{for(var o=s(i),c=o.next();!c.done;c=o.next()){var a=u(c.value.split("-").map(Number),2),l=a[0],h=a[1];if(t===l&&void 0===h)return!0;if(t>=l&&t<=h)return!0}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function Tt(t){var e;if(t)try{var r=null===(e=a())||void 0===e?void 0:e.location.href,n=new URL(t,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),s=n.href,u=n.host;return n.hash="",n.search="",{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:n.href,host:u}}catch(t){return}}function kt(t,e){var r;void 0===e&&(e={});var n=Tt(t.url);if(!n)return!1;var i,o=n.host;if(!1!==e.ignoreAmplitudeRequests&&(Ot(o,"*.amplitude.com")||Ot(o,"amplitude.com")))return!1;if(null===(r=e.ignoreHosts)||void 0===r?void 0:r.find((function(t){return Ot(o,t)})))return!1;if(!e.captureRules&&void 0!==t.status&&!Et(t.status,At))return!1;if(e.captureRules&&(c([],u(e.captureRules),!1).reverse().find((function(e){return i=function(t,e,r){if(!t.hosts||t.hosts.find((function(t){return Ot(e,t)})))return!((r||0===r)&&!Et(r,t.statusCodeRange||At))}(e,o,t.status),void 0!==i})),!i))return!1;return!t.requestWrapper||!function(t,e){if(t.includes("amplitude.com"))try{var r=e.body;if("string"!=typeof r)return!1;if(JSON.parse(r).events.find((function(t){return t.event_type===_})))return!0}catch(t){}return!1}(o,t.requestWrapper)}function qt(t){var e,r,n=t.allObservables,i=t.networkTrackingOptions,o=t.amplitude;return n.networkObservable.pipe((e=function(t){return kt(t.event,i)},V((function(t,n){var i=0;t.subscribe(X(n,(function(t){return e.call(r,t,i++)&&n.next(t)})))})))).subscribe((function(t){var e,r,n,i=t.event,s=Tt(i.url);if(s){var u=null===(r=i.responseWrapper)||void 0===r?void 0:r.bodySize,c=null===(n=i.requestWrapper)||void 0===n?void 0:n.bodySize,a=((e={})["[Amplitude] URL"]=s.hrefWithoutQueryOrHash,e["[Amplitude] URL Query"]=s.query,e["[Amplitude] URL Fragment"]=s.fragment,e["[Amplitude] Request Method"]=i.method,e["[Amplitude] Status Code"]=i.status,e["[Amplitude] Start Time"]=i.startTime,e["[Amplitude] Completion Time"]=i.endTime,e["[Amplitude] Duration"]=i.duration,e["[Amplitude] Request Body Size"]=c,e["[Amplitude] Response Body Size"]=u,e["[Amplitude] Request Type"]=i.type,e);null==o||o.track(_,a)}}))}!function(t){t.NetworkObservable="networkObservable"}(xt||(xt={}));var Pt=function(t){void 0===t&&(t={});var e,r="@amplitude/plugin-network-capture-browser",n=[],u=function(){var t,r=new B((function(t){var r=new m((function(e){var r=function(t,e){return{event:t,timestamp:Date.now(),type:e}}(e,"network");t.next(r)}));return w.subscribe(r,e),function(){w.unsubscribe(r)}}));return(t={})[xt.NetworkObservable]=r,t};return{name:r,type:"enrichment",setup:function(s,c){return i(void 0,void 0,void 0,(function(){var i,a;return o(this,(function(o){return"undefined"==typeof document||(i=u(),a=qt({allObservables:i,networkTrackingOptions:t,amplitude:c}),n.push(a),null==(e=null==s?void 0:s.loggerProvider)||e.log("".concat(r," has been successfully added."))),[2]}))}))},execute:function(t){return i(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,t]}))}))},teardown:function(){return i(void 0,void 0,void 0,(function(){var t,e,r,i;return o(this,(function(o){try{for(t=s(n),e=t.next();!e.done;e=t.next())e.value.unsubscribe()}catch(t){r={error:t}}finally{try{e&&!e.done&&(i=t.return)&&i.call(t)}finally{if(r)throw r.error}}return[2]}))}))}}};return t.networkCapturePlugin=Pt,t.plugin=Pt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
|
1
|
+
var amplitudeNetworkCapturePlugin=function(e){"use strict";var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function o(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function u(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}c((n=n.apply(e,t||[])).next())}))}function i(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,n=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function c(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var a=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],l=["authorization","cookie","set-cookie"],h=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},d=c([],u(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),f=function(e){var t,r=h();if(!(null===(t=null==r?void 0:r.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,f)}(e);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,c([],u(n.entries()),!1).map((function(e){var t=u(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(d[n]):d[n]})).join("")};function p(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function v(e,t,r){e&&y({json:e,allowlist:t.map(b),excludelist:r.map(b),ancestors:[]})}function y(e){var t,r,n=e.json,o=e.targetObject,i=e.allowlist,a=e.excludelist,l=e.ancestors,h=e.parentObject,d=e.targetKey;o||(o=n);var f=Object.keys(o);try{for(var v=s(f),b=v.next();!b.done;b=v.next()){var m=b.value,w=c(c([],u(l),!1),[m],!1);p(o[m])?g(w,i)&&!g(w,a)||delete o[m]:y({json:n,targetObject:o[m],allowlist:i,excludelist:a,ancestors:w,parentObject:o,targetKey:m})}}catch(e){t={error:e}}finally{try{b&&!b.done&&(r=v.return)&&r.call(v)}finally{if(t)throw t.error}}0===Object.keys(o).length&&h&&d&&delete h[d]}function b(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map((function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")}))}function m(e,t,r,n){if(void 0===r&&(r=0),void 0===n&&(n=0),n===t.length)return r===e.length;if(r===e.length){for(;n<t.length&&"**"===t[n];)n++;return n===t.length}var o=t[n];if("**"===o){if(n+1===t.length)return!0;for(var i=r;i<=e.length;i++)if(m(e,t,i,n+1))return!0;return!1}return("*"===o||o===e[r])&&m(e,t,r+1,n+1)}function g(e,t){return t.some((function(t){return m(e,t)}))}var w=function(){function e(){this.headers=!1,this.body=!1}return e.prototype.consume=function(e){if(this[e])throw new TypeError("".concat(e," has already been consumed"));this[e]=!0},e}(),_=function(){function e(e){this.request=e,this.consumptionCheck=new w}return e.prototype.headers=function(e){var t,r;void 0===e&&(e=[]),this.consumptionCheck.consume("headers");var n=this.request.headers,o={};if(Array.isArray(n))n.forEach((function(e){var t=u(e,2),r=t[0],n=t[1];o[r]=n}));else if(n instanceof Headers)n.forEach((function(e,t){o[t]=e}));else if("object"==typeof n&&null!==n)try{for(var i=s(Object.entries(n)),c=i.next();!c.done;c=i.next()){var a=u(c.value,2),l=a[0],h=a[1];o[l]=h}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return C(o,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=h();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=S(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return this.consumptionCheck.consume("body"),"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){return 0===e.length?[2,null]:[2,O(this.body,e,t)]}))}))},e}(),x=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t,this.consumptionCheck=new w}return e.prototype.headers=function(e){return void 0===e&&(e=[]),this.consumptionCheck.consume("headers"),C(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return S(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return this.consumptionCheck.consume("body"),"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){return 0===e.length?[2,null]:[2,O(this.body,e,t)]}))}))},e}();function S(e,t){var r,n,o,i=h(),c=null==i?void 0:i.TextEncoder;if(c){var a;if("string"==typeof e)a=e,o=(new c).encode(a).length;else if(e instanceof Blob)o=(a=e).size;else if(e instanceof URLSearchParams)a=e,o=(new c).encode(a.toString()).length;else if(ArrayBuffer.isView(e))o=(a=e).byteLength;else if(e instanceof ArrayBuffer)o=(a=e).byteLength;else if(e instanceof FormData){var l=e,d=0,f=0;try{for(var p=s(l.entries()),v=p.next();!v.done;v=p.next()){var y=u(v.value,2),b=y[0],m=y[1];if(d+=b.length,"string"==typeof m)d+=(new c).encode(m).length;else{if(!(m instanceof Blob))return;d+=m.size}if(++f>=t)return}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}o=d}else if(e instanceof ReadableStream)return void(a=e);return o}}var A,k=function(){function e(e){this.response=e,this.consumptionCheck=new w}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.consumptionCheck.consume("headers"),this.response.headers instanceof Headers){var r=this.response.headers,n={};return null===(t=null==r?void 0:r.forEach)||void 0===t||t.call(r,(function(e,t){n[t]=e})),C(n,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var r=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),n=r?parseInt(r,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return o(this,void 0,void 0,(function(){var e,t,r;return i(this,(function(n){switch(n.label){case 0:this.consumptionCheck.consume("body"),e=this.response.clone(),n.label=1;case 1:return n.trys.push([1,3,,4]),t=e.text(),r=new Promise((function(e){return setTimeout((function(){return e(null)}),500)})),[4,Promise.race([t,r])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}}))}))},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,O(r.sent(),e,t)]}}))}))},e}(),E=function(){function e(e,t,r,n){this.statusCode=e,this.headersString=t,this.size=r,this.responseText=n,this.consumptionCheck=new w}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.text=function(){return o(this,void 0,void 0,(function(){return i(this,(function(e){return this.consumptionCheck.consume("body"),[2,this.responseText]}))}))},e.prototype.headers=function(e){var t,r;if(void 0===e&&(e=[]),this.consumptionCheck.consume("headers"),!this.headersString)return{};var n={},o=this.headersString.split("\r\n");try{for(var i=s(o),c=i.next();!c.done;c=i.next()){var a=u(c.value.split(": "),2),l=a[0],h=a[1];l&&h&&(n[l]=h)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return C(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,O(r.sent(),e,t)]}}))}))},e}();function O(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return v(n,t,r),n}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(A||(A={}));var q="[REDACTED]",C=function(e,t){var r,n,o=t.allow,i=void 0===o?[]:o,a=t.strategy,h=void 0===a?A.REMOVE:a,d=c([],u(l),!1),f={},p=function(t){var r=t.toLowerCase();d.find((function(e){return e.toLowerCase()===r}))?h===A.REDACT&&(f[t]=q):i.find((function(e){return e.toLowerCase()===r}))?f[t]=e[t]:h===A.REDACT&&(f[t]=q)};try{for(var v=s(Object.keys(e)),y=v.next();!y.done;y=v.next()){p(y.value)}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}return f},T=function(){function e(e,t,r,n,o,i,s,u,c,a,l){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=r,this.startTime=n,this.url=o,this.requestWrapper=i,this.status=s,this.duration=u,this.responseWrapper=c,this.error=a,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,r,n,o={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(c([],u(a),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(r=this.responseWrapper)||void 0===r?void 0:r.headers(c([],u(a),!1)),responseBodySize:null===(n=this.responseWrapper)||void 0===n?void 0:n.bodySize};return Object.fromEntries(Object.entries(o).filter((function(e){var t=u(e,2);return t[0],void 0!==t[1]})))},e}();var j=function(e,t){void 0===t&&(t=f()),this.callback=e,this.id=t},R=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=h();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=h();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,n,o,i,s,u,c,a,l,h;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var d=null===(o=null===(n=null===(r=this.globalScope)||void 0===r?void 0:r.XMLHttpRequest)||void 0===n?void 0:n.prototype)||void 0===o?void 0:o.open,f=null===(u=null===(s=null===(i=this.globalScope)||void 0===i?void 0:i.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===u?void 0:u.send,p=null===(l=null===(a=null===(c=this.globalScope)||void 0===c?void 0:c.XMLHttpRequest)||void 0===a?void 0:a.prototype)||void 0===l?void 0:l.setRequestHeader;d&&f&&p&&this.observeXhr(d,f,p);var v=null===(h=this.globalScope)||void 0===h?void 0:h.fetch;v&&this.observeFetch(v),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach((function(r){var n;try{r.callback(e)}catch(e){null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)}}))},e.prototype.handleNetworkRequestEvent=function(e,t,r,n,o,i,s){var u;if(void 0!==i&&void 0!==s){var c,a,l,h="GET";!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?c=null===(u=null==t?void 0:t.toString)||void 0===u?void 0:u.call(t):(c=t.url,h=t.method),h=(null==r?void 0:r.method)||h,n&&(a=n.status),o&&(l={name:o.name||"UnknownError",message:o.message||"An unknown error occurred"},a=0);var d=Math.floor(performance.now()-s),f=Math.floor(i+d),p=new T(e,h,i,i,c,r,a,d,n,l,f);this.triggerEventCallbacks(p)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(r,n){return o(t,void 0,void 0,(function(){var t,o,s,u,c,a;return i(this,(function(i){switch(i.label){case 0:try{t=this.getTimestamps()}catch(e){null===(c=this.logger)||void 0===c||c.debug("an unexpected error occurred while retrieving timestamps",e)}i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e(r,n)];case 2:return o=i.sent(),[3,4];case 3:return u=i.sent(),s=u,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new _(n):void 0,o?new k(o):void 0,s,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null===(a=this.logger)||void 0===a||a.debug("an unexpected error occurred while handling fetch",e)}if(o)return[2,o];throw s}}))}))})},e.prototype.observeXhr=function(e,t,r){if(this.globalScope&&e&&t){var o=this.globalScope.XMLHttpRequest.prototype,i=this;o.open=function(){for(var t,r,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var c=u(o,2),a=c[0],l=c[1];try{this.$$AmplitudeAnalyticsEvent=n({method:a,url:null===(t=null==l?void 0:l.toString)||void 0===t?void 0:t.call(l),headers:{}},i.getTimestamps())}catch(e){null===(r=i.logger)||void 0===r||r.debug("an unexpected error occurred while calling xhr open",e)}return e.apply(this,o)},o.send=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=this,o=e[0],s=n.$$AmplitudeAnalyticsEvent;return n.addEventListener("loadend",(function(){var e;try{var t=n.getAllResponseHeaders(),r=n.getResponseHeader("content-length"),u=new E(n.status,t,r?parseInt(r,10):void 0,n.responseText),c=n.$$AmplitudeAnalyticsEvent.headers,a=new x(o,c);s.status=n.status,i.handleNetworkRequestEvent("xhr",{url:s.url,method:s.method},a,u,void 0,s.startTime,s.durationStart)}catch(t){null===(e=i.logger)||void 0===e||e.debug("an unexpected error occurred while handling xhr send",t)}})),t.apply(n,e)},o.setRequestHeader=function(e,t){var n;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(e){null===(n=i.logger)||void 0===n||n.debug("an unexpected error occurred while calling xhr setRequestHeader",e)}r.apply(this,[e,t])}}},e}(),P=new R,z="[Amplitude] Network Request";function I(e){return"function"==typeof e}function F(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var B=F((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function H(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var W=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var a=s(i),l=a.next();!l.done;l=a.next()){l.value.remove(this)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else i.remove(this);var h=this.initialTeardown;if(I(h))try{h()}catch(e){o=e instanceof B?e.errors:[e]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=s(d),p=f.next();!p.done;p=f.next()){var v=p.value;try{N(v)}catch(e){o=null!=o?o:[],e instanceof B?o=c(c([],u(o)),u(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}}if(o)throw new B(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)N(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&H(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&H(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),M=W.EMPTY;function L(e){return e instanceof W||e&&"closed"in e&&I(e.remove)&&I(e.add)&&I(e.unsubscribe)}function N(e){I(e)?e():e.unsubscribe()}var D={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},U=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,c([e,t],u(r)))};function V(){}function $(e){e()}var J=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,L(t)&&t.add(r)):r.destination=Z,r}return r(t,e),t.create=function(e,t,r){return new G(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(W),X=Function.prototype.bind;function Y(e,t){return X.call(e,t)}var Q=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){K(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){K(e)}else K(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){K(e)}},e}(),G=function(e){function t(t,r,n){var o,i,s=e.call(this)||this;I(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&D.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&Y(t.next,i),error:t.error&&Y(t.error,i),complete:t.complete&&Y(t.complete,i)}):o=t;return s.destination=new Q(o),s}return r(t,e),t}(J);function K(e){var t;t=e,U((function(){throw t}))}var Z={closed:!0,next:V,error:function(e){throw e},complete:V},ee="function"==typeof Symbol&&Symbol.observable||"@@observable";function te(e){return e}var re=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof J||function(e){return e&&I(e.next)&&I(e.error)&&I(e.complete)}(n)&&L(n)?e:new G(e,t,r);return $((function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))})),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=ne(t))((function(t,n){var o=new G({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[ee]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?te:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ne(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function ne(e){var t;return null!==(t=null!=e?e:D.Promise)&&void 0!==t?t:Promise}function oe(e){return I(null==e?void 0:e.lift)}function ie(e){return function(t){if(oe(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function se(e,t,r,n,o){return new ue(e,t,r,n,o)}var ue=function(e){function t(t,r,n,o,i,s){var u=e.call(this,t)||this;return u.onFinalize=i,u.shouldUnsubscribe=s,u._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,u._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,u}return r(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(J);!function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,oe(t)&&(n.lift=t.lift),n}r(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new W;var r=this.getSubject();t.add(this.source.subscribe(se(r,void 0,(function(){e._teardown(),r.complete()}),(function(t){e._teardown(),r.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=W.EMPTY)}return t},t.prototype.refCount=function(){return ie((function(e,t){var r=null;e._refCount++;var n=se(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)r=null;else{var n=e._connection,o=r;r=null,!n||o&&n!==o||n.unsubscribe(),t.unsubscribe()}}));e.subscribe(n),n.closed||(r=e.connect())}))(this)}}(re);var ce,ae={now:function(){return(ae.delegate||performance).now()},delegate:void 0},le={schedule:function(e){var t=requestAnimationFrame,r=cancelAnimationFrame,n=t((function(t){r=void 0,e(t)}));return new W((function(){return null==r?void 0:r(n)}))},requestAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=le.delegate;return((null==r?void 0:r.requestAnimationFrame)||requestAnimationFrame).apply(void 0,c([],u(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,c([],u(e)))},delegate:void 0};new re((function(e){var t=ce||ae,r=t.now(),n=0,o=function(){e.closed||(n=le.requestAnimationFrame((function(i){n=0;var s=t.now();e.next({timestamp:ce?s:i,elapsed:s-r}),o()})))};return o(),function(){n&&le.cancelAnimationFrame(n)}}));var he=F((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),de=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return r(t,e),t.prototype.lift=function(e){var t=new fe(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new he},t.prototype.next=function(e){var t=this;$((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=s(t.currentObservers),i=o.next();!i.done;i=o.next()){i.value.next(e)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;$((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;$((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?M:(this.currentObservers=null,i.push(e),new W((function(){t.currentObservers=null,H(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new re;return e.source=this,e},t.create=function(e,t){return new fe(e,t)},t}(re),fe=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return r(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:M},t}(de);!function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}r(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)}}(de);var pe={now:function(){return(pe.delegate||Date).now()},delegate:void 0};!function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=pe);var o=e.call(this)||this;return o._bufferSize=t,o._windowTime=r,o._timestampProvider=n,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,r),o}r(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,s=r._timestampProvider,u=r._windowTime;n||(o.push(t),!i&&o.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),o=0;o<n.length&&!e.closed;o+=r?1:2)e.next(n[o]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,o=e._infiniteTimeWindow,i=(o?1:2)*t;if(t<1/0&&i<n.length&&n.splice(0,n.length-i),!o){for(var s=r.now(),u=0,c=1;c<n.length&&n[c]<=s;c+=2)u=c;u&&n.splice(0,u+1)}}}(de),function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}r(t,e),t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t._hasValue,o=t._value,i=t.thrownError,s=t.isStopped,u=t._isComplete;r?e.error(i):(s||u)&&(n&&e.next(o),e.complete())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.prototype.complete=function(){var t=this,r=t._hasValue,n=t._value;t._isComplete||(this._isComplete=!0,r&&e.prototype.next.call(this,n),e.prototype.complete.call(this))}}(de);var ve,ye=function(e){function t(t,r){return e.call(this)||this}return r(t,e),t.prototype.schedule=function(e,t){return this},t}(W),be=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,c([e,t],u(r)))},me=function(e){return clearInterval(e)},ge=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return r(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),be(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&me(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,H(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(ye),we=1,_e={};function xe(e){return e in _e&&(delete _e[e],!0)}var Se=function(e){var t=we++;return _e[t]=!0,ve||(ve=Promise.resolve()),ve.then((function(){return xe(t)&&e()})),t},Ae=function(e){xe(e)},ke={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ke.delegate;return((null==r?void 0:r.setImmediate)||Se).apply(void 0,c([],u(e)))},clearImmediate:function(e){return Ae(e)},delegate:void 0},Ee=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return r(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=ke.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,r,n){var o;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var i=t.actions;null!=r&&(null===(o=i[i.length-1])||void 0===o?void 0:o.id)!==r&&(ke.clearImmediate(r),t._scheduled===r&&(t._scheduled=void 0))},t}(ge),Oe=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=pe.now,e}(),qe=function(e){function t(t,r){void 0===r&&(r=Oe.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return r(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(Oe),Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(qe);new Ce(Ee),new qe(ge);var Te=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return r(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.flush(this),0)},t}(ge),je=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(qe);new je(Te);var Re=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return r(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=le.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.prototype.recycleAsyncId=function(t,r,n){var o;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var i=t.actions;null!=r&&r===t._scheduled&&(null===(o=i[i.length-1])||void 0===o?void 0:o.id)!==r&&(le.cancelAnimationFrame(r),t._scheduled=void 0)},t}(ge),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.flush=function(e){var t;this._active=!0,e?t=e.id:(t=this._scheduled,this._scheduled=void 0);var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(qe);new Pe(Re),function(e){function t(t,r){void 0===t&&(t=Ie),void 0===r&&(r=1/0);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}r(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10}(qe);var ze,Ie=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var o=e.call(this,t,r)||this;return o.scheduler=t,o.work=r,o.index=n,o.active=!0,o.index=t.index=n,o}return r(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var o=new t(this.scheduler,this.work);return this.add(o),o.schedule(r,n)}return W.EMPTY},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var o=e.actions;return o.push(this),o.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(e,t,r){},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(ge);new re((function(e){return e.complete()})),function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(ze||(ze={})),F((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),F((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),F((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),F((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}})),F((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}})),new re(V);var Fe,Be="500-599";function He(e,t){var r="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(r).test(e)}function We(e,t){var r,n,o=t.split(",");try{for(var i=s(o),c=i.next();!c.done;c=i.next()){var a=u(c.value.split("-").map(Number),2),l=a[0],h=a[1];if(e===l&&void 0===h)return!0;if(e>=l&&e<=h)return!0}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1}function Me(e){var t;if(e)try{var r=null===(t=h())||void 0===t?void 0:t.location.href,n=new URL(e,r),o=n.searchParams.toString(),i=n.hash.replace("#",""),s=n.href,u=n.host;return n.hash="",n.search="",{query:o,fragment:i,href:s,hrefWithoutQueryOrHash:n.href,host:u}}catch(e){return}}function Le(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return c([],u(a),!1);if(void 0===e){return}}}function Ne(e){var t,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(r=null==e?void 0:e.blocklist)||void 0===r?void 0:r.length)}function De(e,t){var r;void 0===t&&(t={});var n=Me(e.url);if(!n)return!1;var o,i=n.host;if(!1!==t.ignoreAmplitudeRequests&&(He(i,"*.amplitude.com")||He(i,"amplitude.com")))return!1;if(null===(r=t.ignoreHosts)||void 0===r?void 0:r.find((function(e){return He(i,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!We(e.status,Be))return!1;if(t.captureRules&&(c([],u(t.captureRules),!1).reverse().find((function(t){if(o=function(e,t,r,n,o){if((!e.hosts||e.hosts.find((function(e){return He(t,e)})))&&(!n||!e.urls||function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(n,e.urls))&&(!o||!e.methods||e.methods.find((function(e){return o.toLowerCase()===e.toLowerCase()||"*"===e}))))return!((r||0===r)&&!We(r,e.statusCodeRange||Be))}(t,i,e.status,e.url,e.method),o){var r=Le(t.responseHeaders);if(e.responseWrapper&&r){var n=e.responseWrapper.headers(r);n&&(e.responseHeaders=n)}var s=Le(t.requestHeaders);if(e.requestWrapper&&s){var u=e.requestWrapper.headers(s);u&&(e.requestHeaders=u)}e.responseWrapper&&t.responseBody&&!Ne(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!Ne(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==o})),!o))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if("string"!=typeof r)return!1;if(JSON.parse(r).events.find((function(e){return e.event_type===z})))return!0}catch(e){}return!1}(i,e.requestWrapper)}function Ue(e){var t,r,n=e.allObservables,s=e.networkTrackingOptions,c=e.amplitude;return n.networkObservable.pipe((t=function(e){return De(e.event,s)},ie((function(e,n){var o=0;e.subscribe(se(n,(function(e){return t.call(r,e,o++)&&n.next(e)})))})))).subscribe((function(e){var t,r,n,s=e.event,a=Me(s.url);if(a){var l=null===(r=s.responseWrapper)||void 0===r?void 0:r.bodySize,h=null===(n=s.requestWrapper)||void 0===n?void 0:n.bodySize;!function(e,t,r){o(this,void 0,void 0,(function(){var n,o,s;return i(this,(function(i){switch(i.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:n=u.apply(void 0,[i.sent(),2]),o=n[0],s=n[1],o&&(e["[Amplitude] Request Body"]=o),s&&(e["[Amplitude] Response Body"]=s),i.label=2;case 2:return null==r||r.track(z,e),[2]}}))}))}(((t={})["[Amplitude] URL"]=a.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=a.query,t["[Amplitude] URL Fragment"]=a.fragment,t["[Amplitude] Request Method"]=s.method,t["[Amplitude] Status Code"]=s.status,t["[Amplitude] Start Time"]=s.startTime,t["[Amplitude] Completion Time"]=s.endTime,t["[Amplitude] Duration"]=s.duration,t["[Amplitude] Request Body Size"]=h,t["[Amplitude] Response Body Size"]=l,t["[Amplitude] Request Type"]=s.type,t["[Amplitude] Request Headers"]=s.requestHeaders,t["[Amplitude] Response Headers"]=s.responseHeaders,t),s,c)}}))}!function(e){e.NetworkObservable="networkObservable"}(Fe||(Fe={}));var Ve=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=[],u=function(){var e,r=new re((function(e){var r=new j((function(t){var r=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(r)}));return P.subscribe(r,t),function(){P.unsubscribe(r)}}));return(e={})[Fe.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(s,c){return o(void 0,void 0,void 0,(function(){var o,a;return i(this,(function(i){return"undefined"==typeof document||(o=u(),a=Ue({allObservables:o,networkTrackingOptions:e,amplitude:c}),n.push(a),null==(t=null==s?void 0:s.loggerProvider)||t.log("".concat(r," has been successfully added."))),[2]}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return i(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){var e,t,r,o;return i(this,(function(i){try{for(e=s(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(r)throw r.error}}return[2]}))}))}}};return e.networkCapturePlugin=Ve,e.plugin=Ve,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
2
2
|
//# sourceMappingURL=amplitude-min.js.map
|
|
Binary file
|