@amplitude/plugin-autocapture-browser 1.23.4 → 1.23.5

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.
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.23.4";
1
+ export declare const VERSION = "1.23.5";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.23.4';
4
+ exports.VERSION = '1.23.5';
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["export const VERSION = '1.23.4';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["export const VERSION = '1.23.5';\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.23.4";
1
+ export declare const VERSION = "1.23.5";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export var VERSION = '1.23.4';
1
+ export var VERSION = '1.23.5';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["export const VERSION = '1.23.4';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["export const VERSION = '1.23.5';\n"]}
@@ -1,2 +1,2 @@
1
- var amplitudeAutocapturePlugin=function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))(function(i,o){function l(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,a)}u((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function i(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)l.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return l}function l(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var a=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},u=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},c=a(),s=null==c?void 0:c.console,d={},v={},f=!1;var p={addListener:function(e,t){var n,r=(n=e,!!s&&"function"==typeof s[n]&&(v[n]||(v[n]=s[n],s[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(d[n]&&!f){f=!0;var r=d[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return f=!1,v[n].apply(s,e)}),!0));if(!r)return new Error("Console override failed");d[e]?d[e].push(t):d[e]=[t]},removeListener:function(e){var t,n;try{for(var r=i(Object.values(d)),o=r.next();!o.done;o=r.next())for(var l=o.value,a=l.length-1;a>=0;a--)if(l[a]===e){l.splice(a,1);break}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=i(Object.entries(v)),r=n.next();!r.done;r=n.next()){var l=o(r.value,2),a=l[0],u=l[1];u&&(s[a]=u)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}v={},d={}}},h=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],g="data-amp-track-",m=["div","span","h1","h2","h3","h4","h5","h6"],b=l(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],o(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),y=b,w=b,E=["*"],T="data-amp-mask",k="*****",x=/\b(?:\d[ -]*?){13,16}\b/,A=/(\d{3}-?\d{2}-?\d{4})/g,C=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,O={};Object.defineProperty(O,"__esModule",{value:!0}),O.Observable=void 0;const S=e=>Boolean(Symbol[e]),_=e=>S(e)?Symbol[e]:"@@"+e,M=_("iterator"),P=_("observable"),L=_("species");function N(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function D(e){let t=e.constructor;return void 0!==t&&(t=t[L],null===t&&(t=void 0)),void 0!==t?t:B}function R(e){R.log?R.log(e):setTimeout(()=>{throw e})}function I(e){Promise.resolve().then(()=>{try{e()}catch(e){R(e)}})}function H(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=N(t,"unsubscribe");e&&e.call(t)}}catch(e){R(e)}}function j(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function q(e,t,n){e._state="running";let r=e._observer;try{let i=N(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(j(e),!i)throw n;i.call(r,n);break;case"complete":j(e),i&&i.call(r)}}catch(e){R(e)}"closed"===e._state?H(e):"running"===e._state&&(e._state="ready")}function U(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void I(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(q(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void q(e,t,n);e._queue.push({type:t,value:n})}}class G{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){U(n,"next",e)},error(e){U(n,"error",e)},complete(){U(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(j(this),H(this))}}class B{constructor(e){if(!(this instanceof B))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new G(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(D(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(D(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=D(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let l=!r;if(r=!0,!l||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=D(this);return new t(n=>{let r,i=0;return function o(l){r=l.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=D(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let l=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(l);e>=0&&r.splice(e,1),o()}});r.push(l)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[P](){return this}static from(e){let t="function"==typeof this?this:B;if(null==e)throw new TypeError(e+" is not an object");let n=N(e,P);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof B}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(S("iterator")&&(n=N(e,M),n))return new t(t=>{I(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{I(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:B)(t=>{I(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[L](){return this}}O.Observable=B,Object.defineProperty(B,Symbol("extensions"),{value:{symbol:P,hostReportError:R},configurable:!0});var X=O.Observable;function z(e,t){return new X(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function F(e,t){return new X(function(n){var r=!1,o=new Set,l=function(){var e,t;r=!0;try{for(var n=i(o),l=n.next();!l.done;l=n.next()){var a=l.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}o.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),l())},complete:function(){o.delete(t),r||0!==o.size||(n.complete(),l(),r=!0)}});o.add(t)};return a(e),a(t),l})}function Y(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new X(function(o){return t.add(o),null===n&&(n=e.subscribe({next:function(e){var n,r,o;try{for(var l=i(t),a=l.next();!a.done;a=l.next()){var u=a.value;null===(o=u.next)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}},error:function(e){var n,o,l;try{for(var a=i(t),u=a.next();!u.done;u=a.next()){var c=u.value;null===(l=c.error)||void 0===l||l.call(c,e)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,o;try{for(var l=i(t),a=l.next();!a.done;a=l.next()){var u=a.value;null===(o=u.complete)||void 0===o||o.call(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}r()}})),function(){t.delete(o),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var V,W="https://app.amplitude.com",K={US:W,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var J="__AMPLITUDE_MESSENGER_INSTANCE__",Z="__AMPLITUDE_MESSENGER__",Q=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?W:t;this[V]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,l){r.requestCallbacks[i]={resolve:t,reject:l},r.notify(o),n.timeout>0&&setTimeout(function(){l(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.registerActionHandler=function(e,t){var n,r,o,l;this.actionHandlers.has(e)&&(null===(l=null===(o=this.logger)||void 0===o?void 0:o.warn)||void 0===l||l.call(o,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var u=i(a),c=u.next();!c.done;c=u.next()){t(c.value)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return n(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.scriptLoadPromises.delete(e),i;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,l=i.endpoint;o&&(this.logger=o),l&&this.endpoint===W&&(this.endpoint=l),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,l;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var a=e.data,u=null==a?void 0:a.action;if(u)if("id"in a&&a.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(a.data);else{var s=null!==(l=r.pendingMessages.get(u))&&void 0!==l?l:[];s.push(a.data),r.pendingMessages.set(u,s)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=a();(null==e?void 0:e[Z])===this&&delete e[Z]},e}();function $(e){var t,n=a(),r=null==n?void 0:n[Z];if("object"==typeof(t=r)&&null!==t&&J in t&&!0===t[J])return r;var i=new Q(e);return n&&(n[Z]=i),i}V=J;var ee="__AMPLITUDE_BACKGROUND_CAPTURE__";var te,ne="1.23.4",re="[Amplitude] Element Clicked",ie="[Amplitude] Element Tag",oe="[Amplitude] Element Text",le="[Amplitude] Page URL",ae="data-amp-mask-attributes",ue=["input","select","textarea"],ce=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t},se=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&u(window.location.href,n))&&!!u(window.location.href,t)},de=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,l,a=e.shouldTrackEventResolver,u=null===(l=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===l?void 0:l.call(o);if(!u)return!1;if(a)return a(r,i);if(!se(e))return!1;var c=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}var s=ce(i,r);if(n&&s)return!0;if(t){var d=t.some(function(e){var t;return!!(null===(t=null==i?void 0:i.matches)||void 0===t?void 0:t.call(i,e))});if(!d)return!1}switch(u){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!s||"click"===r}}},ve=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},fe=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t},{})},pe=function(e,t){return e?t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)})?e:pe(null==e?void 0:e.parentElement,t):null},he=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(te||(te={}));var ge="__AMPLITUDE_VISUAL_TAGGING__";function me(e,t){var n=e;if(!0!==n[ge]){n[ge]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,l=t.actionClickAllowlist,a=null,u=function(t){e.notify({action:"element-selected",data:t})},c=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;a=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:c,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:l,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:ne}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==a?void 0:a.close)||void 0===e||e.call(a)})}}var be=a(),ye=function(){return new X(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},we=function(e){return void 0===e&&(e="click"),new X(function(t){var n=function(e){t.next(e)};return be.document.addEventListener(e,n,{capture:!0}),function(){be.document.removeEventListener(e,n,{capture:!0})}})},Ee=function(){var e=F(new X(function(e){var n=function(n){if(n instanceof ErrorEvent){var r={kind:"error"};n.error instanceof Error||n.error instanceof DOMException?r=t(t({},r),{message:n.error.message,stack:n.error.stack,filename:n.filename,lineNumber:n.lineno,columnNumber:n.colno}):"string"==typeof n.error&&(r.message=n.error),e.next(r)}};return be.addEventListener("error",n),function(){be.removeEventListener("error",n)}}),new X(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return be.addEventListener("unhandledrejection",t),function(){be.removeEventListener("unhandledrejection",t)}}));return F(e,new X(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return p.addListener("error",t),function(){p.removeListener(t)}}))},Te=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},ke={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},xe=function(e){var t,n,r,o,l=Object.values(ke).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return l;try{for(var a=i(e),u=a.next();!u.done;u=a.next()){var c=u.value;try{try{for(var s=(r=void 0,i(c.definition)),d=s.next();!d.done;d=s.next()){var v=d.value,f=ke[v.event_type];f&&l[f].add(c.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==c?void 0:c.id,e)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return l},Ae=function(e){var t,n,r,o,l=new Map;try{for(var a=i(e),u=a.next();!u.done;u=a.next()){var c=u.value;try{for(var s=(r=void 0,i(c.conditions)),d=s.next();!d.done;d=s.next()){var v=d.value;if("LABELED_EVENT"===v.type){var f=v.match.eventId,p=l.get(f);p||(p=[],l.set(f,p)),p.push(c)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return l},Ce=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return ke[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},Oe=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var o=function(e,t){var n,r,o,l,a=new Set;try{for(var u=i(e),c=u.next();!c.done;c=u.next()){var s=c.value,d=t.get(s.id);if(d)try{for(var v=(o=void 0,i(d)),f=v.next();!f.done;f=v.next()){var p=f.value;a.add(p)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(l=v.return)&&l.call(v)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return Array.from(a)}(Ce(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var l=i(o),a=l.next();!a.done;a=l.next()){var u=a.value;Te(u.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),Se=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",ae,T]),_e=["type"],Me=["svg","path","g"],Pe=["password","hidden"];function Le(e,t){var n,r,o,l,a,u;if(null===e)return null;var c=String(e.tagName).toLowerCase(),s={tag:c},d=Array.from(null!==(l=null===(o=e.parentElement)||void 0===o?void 0:o.children)&&void 0!==l?l:[]);d.length&&(s.index=d.indexOf(e),s.indexOfType=d.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(a=e.previousElementSibling)||void 0===a?void 0:a.tagName)||void 0===u?void 0:u.toLowerCase();v&&(s.prevSib=String(v));var f=e.getAttribute("id");f&&(s.id=String(f));var p=Array.from(e.classList);p.length&&(s.classes=p);var h={},g=Array.from(e.attributes).filter(function(e){return!Se.has(e.name)}),m=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!ue.includes(i)&&!o}(e);if(!Pe.includes(String(e.getAttribute("type")))&&!Me.includes(c))try{for(var b=i(g),y=b.next();!y.done;y=b.next()){var w=y.value;m&&!_e.includes(w.name)||(t.has(w.name)?h[w.name]=k:h[w.name]=String(w.value).substring(0,128))}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=b.return)&&r.call(b)}finally{if(n)throw n.error}}return Object.keys(h).length&&(s.attrs=h),s}var Ne,De=function(e,t){var n,r,a,u=this;this.replaceSensitiveString=function(e){return function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var o=e;o=(o=(o=o.replace(x,k)).replace(A,k)).replace(C,k);try{for(var l=i(t),a=l.next();!a.done;a=l.next()){var u=a.value;try{o=o.replace(u,k)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return o}(e,u.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,a,c,s=performance.now();if(!e)return[];for(var d=function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e),v=new Map,f=d.length-1;f>=0;f--){var p=d[f];if(p){var h=ve(p.getAttribute(ae)),g=f===d.length-1?[]:null!==(r=v.get(d[f+1]))&&void 0!==r?r:new Set,m=new Set(l(l([],o(g),!1),o(h),!1));v.set(p,m)}}c=d.map(function(e){var t;return Le(e,null!==(t=v.get(e))&&void 0!==t?t:new Set)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=o(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=u.replaceSensitiveString(i))})};try{for(var y=i(c),w=y.next();!w.done;w=y.next())b(w.value)}catch(e){t={error:e}}finally{try{w&&!w.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}var E=performance.now();return null===(a=u.diagnosticsClient)||void 0===a||a.recordHistogram("autocapturePlugin.getHierarchy",E-s),c},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?u.getText(t):u.getNearestLabel(n)},this.getEventProperties=function(e,t,n){var r,i,l,a,c,s,d=null===(l=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===l?void 0:l.call(i),v="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},f=u.getHierarchy(t),p=null===(a=f[0])||void 0===a?void 0:a.attrs,h=u.getNearestLabel(t),g=(c=null!=p?p:{},s=n,Object.entries(c).reduce(function(e,t){var n=o(t,2),r=n[0],i=n[1];if(r.startsWith(s)){var l=r.replace(s,"");l&&(e[l]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=f,r[ie]=d,r[oe]=u.getText(t),r["[Amplitude] Element Position Left"]=null==v.left?null:Math.round(v.left),r["[Amplitude] Element Position Top"]=null==v.top?null:Math.round(v.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Parent Label"]=h,r[le]=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n}(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(T)?k:e?e(document.title):document.title}(u.replaceSensitiveString),r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);if(m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=u.replaceSensitiveString(b)}return fe(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=u.addTypeAndTimestamp(e,t);if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){if(i&&ce(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=u.getEventProperties(o.type,o.closestTrackedAncestor,r),o;var l=pe(o.event.target,n);return l&&(o.closestTrackedAncestor=l,o.targetElementProperties=u.getEventProperties(o.type,l,r)),o}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?u.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(T,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var o="",l=Array.from(e.childNodes);try{for(var a=i(l),c=a.next();!c.done;c=a.next()){var s=c.value;s.nodeType!==Node.TEXT_NODE?s instanceof Element&&(s.hasAttribute(T)||s.hasAttribute("contenteditable")?o+=k:o+=u.getTextWithMaskedDescendants(s)):o+=s.textContent||""}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},this.getText=function(e){if(null!==e.closest("[".concat(T,"]")))return k;var t="";return t=e.querySelector("[".concat(T,"], [contenteditable]"))?u.getTextWithMaskedDescendants(e):e.innerText||"",u.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),o=((t={})[ie]=i,t[oe]=u.getText(e),t[le]=window.location.href.split("?")[0],t);return fe(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var c=null!==(a=e.maskTextRegex)&&void 0!==a?a:[],s=[];try{for(var d=i(c),v=d.next();!v.done;v=d.next()){var f=v.value;if(s.length>=25)break;if(f instanceof RegExp)s.push(f);else if("pattern"in f&&"string"==typeof f.pattern)try{s.push(new RegExp(f.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=s};!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(Ne||(Ne={}));var Re=function(e,u){var c,s,d,v,f,p,b,y;void 0===e&&(e={}),null==u||u.diagnosticsClient.setTag("plugin.autocapture.version",ne);var w=e.dataAttributePrefix,E=void 0===w?g:w,T=e.visualTaggingOptions,k=void 0===T?{enabled:!0}:T;e.cssSelectorAllowlist=null!==(c=e.cssSelectorAllowlist)&&void 0!==c?c:h,e.actionClickAllowlist=null!==(s=e.actionClickAllowlist)&&void 0!==s?s:m,e.debounceTime=null!==(d=e.debounceTime)&&void 0!==d?d:0,e.pageUrlExcludelist=null===(v=e.pageUrlExcludelist)||void 0===v?void 0:v.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var x="@amplitude/plugin-autocapture-browser",A=[],C=new De(e,u),O=xe(Object.values(null!==(p=null===(f=e.pageActions)||void 0===f?void 0:f.labeledEvents)&&void 0!==p?p:{})),S=Ae(null!==(y=null===(b=e.pageActions)||void 0===b?void 0:b.triggers)&&void 0!==y?y:[]),_=function(e,t,n,r){return new Oe(e,t,n,r)}(O,S,C,e);return{name:x,type:"enrichment",setup:function(i,u){return n(void 0,void 0,void 0,function(){var n,c,s,d,v,f,p,h,g,m;return r(this,function(r){return"undefined"==typeof document||(i.fetchRemoteConfig&&(i.remoteConfigClient?i.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(n){!function(n){var r,i;n&&(e.pageActions=t(t({},e.pageActions),n),O=xe(Object.values(null!==(r=e.pageActions.labeledEvents)&&void 0!==r?r:{})),S=Ae(null!==(i=e.pageActions.triggers)&&void 0!==i?i:[]),_.update(O,S,e))}(n)}):i.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),n=de(e,e.cssSelectorAllowlist),c=de(e,e.actionClickAllowlist),s=function(){var t,n,r=Y(we().map(function(t){return C.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=Y(new X(function(t){var n,r=function(n){var r=C.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,E);t.next(r)};return null===(n=a())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=a())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=Y(new X(function(t){var n=function(n){var r=C.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,E);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=Y(ye().map(function(t){return C.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)}));return(t={})[Ne.ChangeObservable]=i,t[Ne.ClickObservable]=r,t[Ne.MutationObservable]=o,t[Ne.NavigateObservable]=n,t}(),d=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(he).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(re,e.targetElementProperties)})}({allObservables:s,amplitude:u,shouldTrackEvent:n,evaluateTriggers:_.evaluate.bind(_)}),A.push(d),v=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(he).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:s,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,l(l([],o(e),!1),[E],!1))},amplitude:u,shouldTrackEvent:n,evaluateTriggers:_.evaluate.bind(_)}),A.push(v),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,l=e.shouldTrackActionClick,a=n.clickObservable,u=n.mutationObservable,c=n.navigateObservable,s=a.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=pe(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(he).filter(function(e){return l("click",e.closestTrackedAncestor)}),d=c?F(u,c):u,v=F(s,d),f=null,p=null;return z(v,function(e){if(f&&(clearTimeout(f),f=null),"click"===e.type)return p=e,f=setTimeout(function(){f=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(re,i("click",e.closestTrackedAncestor)))})}({allObservables:s,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,l(l([],o(e),!1),[E],!1))},amplitude:u,shouldTrackEvent:n,shouldTrackActionClick:c}),f&&A.push(f),null===(m=null==i?void 0:i.loggerProvider)||void 0===m||m.log("".concat(x," has been successfully added.")),window.opener&&k.enabled&&(p=e.cssSelectorAllowlist,h=e.actionClickAllowlist,me(g=$(),{dataExtractor:C,isElementSelectable:de(e,l(l([],o(p),!1),o(h),!1)),cssSelectorAllowlist:p,actionClickAllowlist:h}),function(e,t){var n,r=e;if(!0!==r[ee]){r[ee]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.2.js.gz",o=null,l=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(){var t,n;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Initializing background capture (external script)");var r=new URL(i,e.endpoint).toString();e.loadScriptOnce(r).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),o=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,{messenger:e,onBackgroundCapture:l}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==o?void 0:o.close)||void 0===e||e.call(o),o=null})}}(g),g.setup(t({logger:null==i?void 0:i.loggerProvider},(null==i?void 0:i.serverZone)&&{endpoint:K[i.serverZone]})))),[2]})})},execute:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){return[2,e]})})},teardown:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){try{for(e=i(A),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(n)throw n.error}}return[2]})})}}},Ie=["mutation","navigate"];function He(e,t){var n,r,i,o,l=t.event,a=l.pageX,u=l.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:a,a),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function je(e){if(0===e.length)return null;var n=e[0],r=e[e.length-1];return{rageClickEvent:t({"[Amplitude] Begin Time":new Date(n.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-n.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},n.targetElementProperties),time:n.timestamp}}function qe(e){var t=this,i=e.amplitude,o=e.allObservables,l=e.shouldTrackRageClick,a=o.clickObservable,u=o.selectionObservable,c=[],s={},d=null;function v(e){c=[],s={},e&&(He(s,e),c.push(e))}var f=z(a.filter(function(e){return l("click",e.closestTrackedAncestor)}),function(e){return n(t,void 0,void 0,function(){var t;return r(this,function(n){return He(s,e),t=null,0===c.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(c,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(c,e)||s.isOutOfBounds?(d&&(t=je(c)),v(e)):c.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),c.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(je(c))},1e3)}})]:[2,null]})})}),p=null==u?void 0:u.subscribe(function(){v()}),h=f.subscribe(function(e){null!==e&&i.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var Ue,Ge;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(Ue||(Ue={})),function(e){e.X="x",e.Y="y"}(Ge||(Ge={}));function Be(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function Xe(e){e.changes=[],e.startTime=void 0}function ze(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var Fe=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?10:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new X(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},l=void 0,a=null;function u(){void 0!==l&&(e.next(l),l=void 0,null!==a&&clearTimeout(a),Xe(n),Xe(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===Ge.X?n:i);var t=function(e,t){var n=void 0;if(Be(e)&&(n=e.startTime),Be(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(l=l||t,a=setTimeout(function(){u(),a=null},o)):u(),ze(n),ze(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},Ye=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?10:i,l=e.thresholdMs,a=void 0===l?2e3:l,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new X(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===Ue.DECREASING&&e.next(Ge.X),r=Ue.INCREASING):o.x<n.x&&(r===Ue.INCREASING&&e.next(Ge.X),r=Ue.DECREASING),o.y>n.y?(i===Ue.DECREASING&&e.next(Ge.Y),i=Ue.INCREASING):o.y<n.y&&(i===Ue.INCREASING&&e.next(Ge.Y),i=Ue.DECREASING),n=o):n=o})})}({allWindowObservables:r});return Fe({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:a}).subscribe(function(e){se(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function Ve(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var We=4e3;return e.DataExtractor=De,e.autocapturePlugin=Re,e.enableVisualTagging=me,e.frustrationPlugin=function(e){var a;void 0===e&&(e={});var u="@amplitude/plugin-frustration-browser",c=[],s=!1!==e.errorClicks;e.errorClicks||(s=!1);var d=!1!==e.deadClicks&&null!==e.deadClicks,v=!1!==e.rageClicks&&null!==e.rageClicks,f=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(f=!1);var p=Ve(e,"rageClicks",E,v),h=Ve(e,"deadClicks",y,d),m=Ve(e,"errorClicks",w,s),b=null!==(a=e.dataAttributePrefix)&&void 0!==a?a:g,T=new De(e),k=l([],o(new Set(l(l(l([],o(p),!1),o(h),!1),o(m),!1))),!1),x=function(){var e,n,r=Y(we("pointerdown").map(function(e){return T.addAdditionalEventProperties(e,"click",k,b,!0)})),i=Y(Ee().map(function(e){return T.addTypeAndTimestamp(e,"error")})),o=Y(ye().map(function(e){return T.addAdditionalEventProperties(e,"mutation",k,b)}));window.navigation&&(n=Y(new X(function(e){var n=function(n){e.next(t(t({},n),{type:"navigate"}))};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}}).map(function(e){return T.addAdditionalEventProperties(e,"navigate",k,b)})));var l=Y(new X(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),a=Y(new X(function(e){var t=function(t){e.next(t)},n={capture:!0};return be.document.addEventListener("mousemove",t,n),function(){be.document.removeEventListener("mousemove",t,n)}}));return(e={})[Ne.ClickObservable]=r,e[Ne.MutationObservable]=o,e[Ne.NavigateObservable]=n,e[Ne.BrowserErrorObservable]=i,e[Ne.SelectionObservable]=l,e[Ne.MouseMoveObservable]=a,e};return{name:u,type:"enrichment",setup:function(i,o){return n(void 0,void 0,void 0,function(){var n,l,a,g,y,w,E,k,A,C,O;return r(this,function(r){return"undefined"==typeof document||(n=x(),v&&(l=de(e,p),a=qe({allObservables:n,amplitude:o,shouldTrackRageClick:l}),c.push(a)),d&&(g=de(e,h),y=function(e){var n=e.amplitude,r=e.allObservables,i=e.getEventProperties,o=e.shouldTrackDeadClick,l=r.clickObservable,a=r.mutationObservable,u=r.navigateObservable,c=l.filter(function(e){return he(e)&&o("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===te.LEFT_OR_TOUCH_CONTACT}),s=u?F(a,u):a,d=F(c,s),v=null;return z(d,function(e){return v&&Ie.includes(e.type)?(clearTimeout(v),v=null,Promise.resolve(null)):"click"===e.type?v?Promise.resolve(null):new Promise(function(t){v=setTimeout(function(){t(e),v=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var r={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};n.track("[Amplitude] Dead Click",t(t({},i("click",e.closestTrackedAncestor)),r),{time:e.timestamp})}})}({amplitude:o,allObservables:n,getEventProperties:function(e,t){return T.getEventProperties(e,t,b)},shouldTrackDeadClick:g}),c.push(y)),s&&(w=de(e,m),E=function(e){var n=e.amplitude,r=e.allObservables,i=e.shouldTrackErrorClick,o=r.clickObservable,l=r.browserErrorObservable,a=o.filter(function(e){return he(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===te.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,s=function(){null!==u&&(clearTimeout(u),u=null),c=null};return F(a,l).subscribe(function(e){var r;if("click"===e.type)return s(),c=e,void(u=setTimeout(s,2e3));"error"===e.type&&c&&(n.track("[Amplitude] Error Click",t(((r={})["[Amplitude] Kind"]=e.event.kind,r["[Amplitude] Message"]=e.event.message,r["[Amplitude] Stack"]=e.event.stack,r["[Amplitude] Filename"]=e.event.filename,r["[Amplitude] Line Number"]=e.event.lineNumber,r["[Amplitude] Column Number"]=e.event.columnNumber,r),c.targetElementProperties)),s())})}({amplitude:o,allObservables:n,shouldTrackErrorClick:w}),c.push(E)),f&&(k=void 0,A=void 0,"object"==typeof e.thrashedCursor&&(k=e.thrashedCursor.directionChanges,A=e.thrashedCursor.threshold,k&&k<5&&(i.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(k," is below the minimum of ").concat(5,", setting to ").concat(5)),k=5),A&&A>We&&(i.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(A," is above the maximum of ").concat(We,", setting to ").concat(We)),A=We)),C=Ye({amplitude:o,options:e,allObservables:n,directionChanges:k,thresholdMs:A}),c.push(C)),null===(O=null==i?void 0:i.loggerProvider)||void 0===O||O.log("".concat(u," has been successfully added."))),[2]})})},execute:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){return[2,e]})})},teardown:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){try{for(e=i(c),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(n)throw n.error}}return[2]})})}}},e.plugin=Re,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
1
+ var amplitudeAutocapturePlugin=function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))(function(i,o){function l(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,a)}u((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function i(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)l.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return l}function l(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var a=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},u=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},c=a(),s=null==c?void 0:c.console,d={},v={},f=!1;var p={addListener:function(e,t){var n,r=(n=e,!!s&&"function"==typeof s[n]&&(v[n]||(v[n]=s[n],s[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(d[n]&&!f){f=!0;var r=d[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return f=!1,v[n].apply(s,e)}),!0));if(!r)return new Error("Console override failed");d[e]?d[e].push(t):d[e]=[t]},removeListener:function(e){var t,n;try{for(var r=i(Object.values(d)),o=r.next();!o.done;o=r.next())for(var l=o.value,a=l.length-1;a>=0;a--)if(l[a]===e){l.splice(a,1);break}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=i(Object.entries(v)),r=n.next();!r.done;r=n.next()){var l=o(r.value,2),a=l[0],u=l[1];u&&(s[a]=u)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}v={},d={}}},h=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],g="data-amp-track-",m=["div","span","h1","h2","h3","h4","h5","h6"],b=l(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],o(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),y=b,w=b,E=["*"],T="data-amp-mask",k="*****",x=/\b(?:\d[ -]*?){13,16}\b/,A=/(\d{3}-?\d{2}-?\d{4})/g,C=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,O={};Object.defineProperty(O,"__esModule",{value:!0}),O.Observable=void 0;const S=e=>Boolean(Symbol[e]),_=e=>S(e)?Symbol[e]:"@@"+e,M=_("iterator"),P=_("observable"),L=_("species");function N(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function D(e){let t=e.constructor;return void 0!==t&&(t=t[L],null===t&&(t=void 0)),void 0!==t?t:B}function R(e){R.log?R.log(e):setTimeout(()=>{throw e})}function I(e){Promise.resolve().then(()=>{try{e()}catch(e){R(e)}})}function H(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=N(t,"unsubscribe");e&&e.call(t)}}catch(e){R(e)}}function j(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function q(e,t,n){e._state="running";let r=e._observer;try{let i=N(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(j(e),!i)throw n;i.call(r,n);break;case"complete":j(e),i&&i.call(r)}}catch(e){R(e)}"closed"===e._state?H(e):"running"===e._state&&(e._state="ready")}function U(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void I(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(q(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void q(e,t,n);e._queue.push({type:t,value:n})}}class G{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){U(n,"next",e)},error(e){U(n,"error",e)},complete(){U(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(j(this),H(this))}}class B{constructor(e){if(!(this instanceof B))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new G(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(D(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(D(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=D(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let l=!r;if(r=!0,!l||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=D(this);return new t(n=>{let r,i=0;return function o(l){r=l.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=D(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let l=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(l);e>=0&&r.splice(e,1),o()}});r.push(l)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[P](){return this}static from(e){let t="function"==typeof this?this:B;if(null==e)throw new TypeError(e+" is not an object");let n=N(e,P);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof B}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(S("iterator")&&(n=N(e,M),n))return new t(t=>{I(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{I(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:B)(t=>{I(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[L](){return this}}O.Observable=B,Object.defineProperty(B,Symbol("extensions"),{value:{symbol:P,hostReportError:R},configurable:!0});var X=O.Observable;function z(e,t){return new X(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function F(e,t){return new X(function(n){var r=!1,o=new Set,l=function(){var e,t;r=!0;try{for(var n=i(o),l=n.next();!l.done;l=n.next()){var a=l.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}o.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),l())},complete:function(){o.delete(t),r||0!==o.size||(n.complete(),l(),r=!0)}});o.add(t)};return a(e),a(t),l})}function Y(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new X(function(o){return t.add(o),null===n&&(n=e.subscribe({next:function(e){var n,r,o;try{for(var l=i(t),a=l.next();!a.done;a=l.next()){var u=a.value;null===(o=u.next)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}},error:function(e){var n,o,l;try{for(var a=i(t),u=a.next();!u.done;u=a.next()){var c=u.value;null===(l=c.error)||void 0===l||l.call(c,e)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,o;try{for(var l=i(t),a=l.next();!a.done;a=l.next()){var u=a.value;null===(o=u.complete)||void 0===o||o.call(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}r()}})),function(){t.delete(o),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var V,W="https://app.amplitude.com",K={US:W,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var J="__AMPLITUDE_MESSENGER_INSTANCE__",Z="__AMPLITUDE_MESSENGER__",Q=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?W:t;this[V]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,l){r.requestCallbacks[i]={resolve:t,reject:l},r.notify(o),n.timeout>0&&setTimeout(function(){l(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.registerActionHandler=function(e,t){var n,r,o,l;this.actionHandlers.has(e)&&(null===(l=null===(o=this.logger)||void 0===o?void 0:o.warn)||void 0===l||l.call(o,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var u=i(a),c=u.next();!c.done;c=u.next()){t(c.value)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return n(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.scriptLoadPromises.delete(e),i;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,l=i.endpoint;o&&(this.logger=o),l&&this.endpoint===W&&(this.endpoint=l),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,l;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var a=e.data,u=null==a?void 0:a.action;if(u)if("id"in a&&a.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(a.data);else{var s=null!==(l=r.pendingMessages.get(u))&&void 0!==l?l:[];s.push(a.data),r.pendingMessages.set(u,s)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=a();(null==e?void 0:e[Z])===this&&delete e[Z]},e}();function $(e){var t,n=a(),r=null==n?void 0:n[Z];if("object"==typeof(t=r)&&null!==t&&J in t&&!0===t[J])return r;var i=new Q(e);return n&&(n[Z]=i),i}V=J;var ee="__AMPLITUDE_BACKGROUND_CAPTURE__";var te,ne="1.23.5",re="[Amplitude] Element Clicked",ie="[Amplitude] Element Tag",oe="[Amplitude] Element Text",le="[Amplitude] Page URL",ae="data-amp-mask-attributes",ue=["input","select","textarea"],ce=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t},se=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&u(window.location.href,n))&&!!u(window.location.href,t)},de=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,l,a=e.shouldTrackEventResolver,u=null===(l=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===l?void 0:l.call(o);if(!u)return!1;if(a)return a(r,i);if(!se(e))return!1;var c=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}var s=ce(i,r);if(n&&s)return!0;if(t){var d=t.some(function(e){var t;return!!(null===(t=null==i?void 0:i.matches)||void 0===t?void 0:t.call(i,e))});if(!d)return!1}switch(u){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!s||"click"===r}}},ve=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},fe=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t},{})},pe=function(e,t){return e?t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)})?e:pe(null==e?void 0:e.parentElement,t):null},he=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(te||(te={}));var ge="__AMPLITUDE_VISUAL_TAGGING__";function me(e,t){var n=e;if(!0!==n[ge]){n[ge]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,l=t.actionClickAllowlist,a=null,u=function(t){e.notify({action:"element-selected",data:t})},c=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;a=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:c,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:l,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:ne}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==a?void 0:a.close)||void 0===e||e.call(a)})}}var be=a(),ye=function(){return new X(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},we=function(e){return void 0===e&&(e="click"),new X(function(t){var n=function(e){t.next(e)};return be.document.addEventListener(e,n,{capture:!0}),function(){be.document.removeEventListener(e,n,{capture:!0})}})},Ee=function(){var e=F(new X(function(e){var n=function(n){if(n instanceof ErrorEvent){var r={kind:"error"};n.error instanceof Error||n.error instanceof DOMException?r=t(t({},r),{message:n.error.message,stack:n.error.stack,filename:n.filename,lineNumber:n.lineno,columnNumber:n.colno}):"string"==typeof n.error&&(r.message=n.error),e.next(r)}};return be.addEventListener("error",n),function(){be.removeEventListener("error",n)}}),new X(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return be.addEventListener("unhandledrejection",t),function(){be.removeEventListener("unhandledrejection",t)}}));return F(e,new X(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return p.addListener("error",t),function(){p.removeListener(t)}}))},Te=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},ke={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},xe=function(e){var t,n,r,o,l=Object.values(ke).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return l;try{for(var a=i(e),u=a.next();!u.done;u=a.next()){var c=u.value;try{try{for(var s=(r=void 0,i(c.definition)),d=s.next();!d.done;d=s.next()){var v=d.value,f=ke[v.event_type];f&&l[f].add(c.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==c?void 0:c.id,e)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return l},Ae=function(e){var t,n,r,o,l=new Map;try{for(var a=i(e),u=a.next();!u.done;u=a.next()){var c=u.value;try{for(var s=(r=void 0,i(c.conditions)),d=s.next();!d.done;d=s.next()){var v=d.value;if("LABELED_EVENT"===v.type){var f=v.match.eventId,p=l.get(f);p||(p=[],l.set(f,p)),p.push(c)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return l},Ce=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return ke[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},Oe=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var o=function(e,t){var n,r,o,l,a=new Set;try{for(var u=i(e),c=u.next();!c.done;c=u.next()){var s=c.value,d=t.get(s.id);if(d)try{for(var v=(o=void 0,i(d)),f=v.next();!f.done;f=v.next()){var p=f.value;a.add(p)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(l=v.return)&&l.call(v)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return Array.from(a)}(Ce(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var l=i(o),a=l.next();!a.done;a=l.next()){var u=a.value;Te(u.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),Se=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",ae,T]),_e=["type"],Me=["svg","path","g"],Pe=["password","hidden"];function Le(e,t){var n,r,o,l,a,u;if(null===e)return null;var c=String(e.tagName).toLowerCase(),s={tag:c},d=Array.from(null!==(l=null===(o=e.parentElement)||void 0===o?void 0:o.children)&&void 0!==l?l:[]);d.length&&(s.index=d.indexOf(e),s.indexOfType=d.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(a=e.previousElementSibling)||void 0===a?void 0:a.tagName)||void 0===u?void 0:u.toLowerCase();v&&(s.prevSib=String(v));var f=e.getAttribute("id");f&&(s.id=String(f));var p=Array.from(e.classList);p.length&&(s.classes=p);var h={},g=Array.from(e.attributes).filter(function(e){return!Se.has(e.name)}),m=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!ue.includes(i)&&!o}(e);if(!Pe.includes(String(e.getAttribute("type")))&&!Me.includes(c))try{for(var b=i(g),y=b.next();!y.done;y=b.next()){var w=y.value;m&&!_e.includes(w.name)||(t.has(w.name)?h[w.name]=k:h[w.name]=String(w.value).substring(0,128))}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=b.return)&&r.call(b)}finally{if(n)throw n.error}}return Object.keys(h).length&&(s.attrs=h),s}var Ne,De=function(e,t){var n,r,a,u=this;this.replaceSensitiveString=function(e){return function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var o=e;o=(o=(o=o.replace(x,k)).replace(A,k)).replace(C,k);try{for(var l=i(t),a=l.next();!a.done;a=l.next()){var u=a.value;try{o=o.replace(u,k)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return o}(e,u.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,a,c,s=performance.now();if(!e)return[];for(var d=function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e),v=new Map,f=d.length-1;f>=0;f--){var p=d[f];if(p){var h=ve(p.getAttribute(ae)),g=f===d.length-1?[]:null!==(r=v.get(d[f+1]))&&void 0!==r?r:new Set,m=new Set(l(l([],o(g),!1),o(h),!1));v.set(p,m)}}c=d.map(function(e){var t;return Le(e,null!==(t=v.get(e))&&void 0!==t?t:new Set)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=o(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=u.replaceSensitiveString(i))})};try{for(var y=i(c),w=y.next();!w.done;w=y.next())b(w.value)}catch(e){t={error:e}}finally{try{w&&!w.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}var E=performance.now();return null===(a=u.diagnosticsClient)||void 0===a||a.recordHistogram("autocapturePlugin.getHierarchy",E-s),c},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?u.getText(t):u.getNearestLabel(n)},this.getEventProperties=function(e,t,n){var r,i,l,a,c,s,d=null===(l=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===l?void 0:l.call(i),v="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},f=u.getHierarchy(t),p=null===(a=f[0])||void 0===a?void 0:a.attrs,h=u.getNearestLabel(t),g=(c=null!=p?p:{},s=n,Object.entries(c).reduce(function(e,t){var n=o(t,2),r=n[0],i=n[1];if(r.startsWith(s)){var l=r.replace(s,"");l&&(e[l]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=f,r[ie]=d,r[oe]=u.getText(t),r["[Amplitude] Element Position Left"]=null==v.left?null:Math.round(v.left),r["[Amplitude] Element Position Top"]=null==v.top?null:Math.round(v.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Parent Label"]=h,r[le]=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n}(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(T)?k:e?e(document.title):document.title}(u.replaceSensitiveString),r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);if(m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=u.replaceSensitiveString(b)}return fe(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=u.addTypeAndTimestamp(e,t);if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){if(i&&ce(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=u.getEventProperties(o.type,o.closestTrackedAncestor,r),o;var l=pe(o.event.target,n);return l&&(o.closestTrackedAncestor=l,o.targetElementProperties=u.getEventProperties(o.type,l,r)),o}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?u.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(T,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var o="",l=Array.from(e.childNodes);try{for(var a=i(l),c=a.next();!c.done;c=a.next()){var s=c.value;s.nodeType!==Node.TEXT_NODE?s instanceof Element&&(s.hasAttribute(T)||s.hasAttribute("contenteditable")?o+=k:o+=u.getTextWithMaskedDescendants(s)):o+=s.textContent||""}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},this.getText=function(e){if(null!==e.closest("[".concat(T,"]")))return k;var t="";return t=e.querySelector("[".concat(T,"], [contenteditable]"))?u.getTextWithMaskedDescendants(e):e.innerText||"",u.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var i=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),o=((t={})[ie]=i,t[oe]=u.getText(e),t[le]=window.location.href.split("?")[0],t);return fe(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var c=null!==(a=e.maskTextRegex)&&void 0!==a?a:[],s=[];try{for(var d=i(c),v=d.next();!v.done;v=d.next()){var f=v.value;if(s.length>=25)break;if(f instanceof RegExp)s.push(f);else if("pattern"in f&&"string"==typeof f.pattern)try{s.push(new RegExp(f.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=s};!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(Ne||(Ne={}));var Re=function(e,u){var c,s,d,v,f,p,b,y;void 0===e&&(e={}),null==u||u.diagnosticsClient.setTag("plugin.autocapture.version",ne);var w=e.dataAttributePrefix,E=void 0===w?g:w,T=e.visualTaggingOptions,k=void 0===T?{enabled:!0}:T;e.cssSelectorAllowlist=null!==(c=e.cssSelectorAllowlist)&&void 0!==c?c:h,e.actionClickAllowlist=null!==(s=e.actionClickAllowlist)&&void 0!==s?s:m,e.debounceTime=null!==(d=e.debounceTime)&&void 0!==d?d:0,e.pageUrlExcludelist=null===(v=e.pageUrlExcludelist)||void 0===v?void 0:v.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var x="@amplitude/plugin-autocapture-browser",A=[],C=new De(e,u),O=xe(Object.values(null!==(p=null===(f=e.pageActions)||void 0===f?void 0:f.labeledEvents)&&void 0!==p?p:{})),S=Ae(null!==(y=null===(b=e.pageActions)||void 0===b?void 0:b.triggers)&&void 0!==y?y:[]),_=function(e,t,n,r){return new Oe(e,t,n,r)}(O,S,C,e);return{name:x,type:"enrichment",setup:function(i,u){return n(void 0,void 0,void 0,function(){var n,c,s,d,v,f,p,h,g,m;return r(this,function(r){return"undefined"==typeof document||(i.fetchRemoteConfig&&(i.remoteConfigClient?i.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(n){!function(n){var r,i;n&&(e.pageActions=t(t({},e.pageActions),n),O=xe(Object.values(null!==(r=e.pageActions.labeledEvents)&&void 0!==r?r:{})),S=Ae(null!==(i=e.pageActions.triggers)&&void 0!==i?i:[]),_.update(O,S,e))}(n)}):i.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),n=de(e,e.cssSelectorAllowlist),c=de(e,e.actionClickAllowlist),s=function(){var t,n,r=Y(we().map(function(t){return C.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=Y(new X(function(t){var n,r=function(n){var r=C.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,E);t.next(r)};return null===(n=a())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=a())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=Y(new X(function(t){var n=function(n){var r=C.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,E);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=Y(ye().map(function(t){return C.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)}));return(t={})[Ne.ChangeObservable]=i,t[Ne.ClickObservable]=r,t[Ne.MutationObservable]=o,t[Ne.NavigateObservable]=n,t}(),d=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(he).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(re,e.targetElementProperties)})}({allObservables:s,amplitude:u,shouldTrackEvent:n,evaluateTriggers:_.evaluate.bind(_)}),A.push(d),v=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(he).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:s,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,l(l([],o(e),!1),[E],!1))},amplitude:u,shouldTrackEvent:n,evaluateTriggers:_.evaluate.bind(_)}),A.push(v),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,l=e.shouldTrackActionClick,a=n.clickObservable,u=n.mutationObservable,c=n.navigateObservable,s=a.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=pe(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(he).filter(function(e){return l("click",e.closestTrackedAncestor)}),d=c?F(u,c):u,v=F(s,d),f=null,p=null;return z(v,function(e){if(f&&(clearTimeout(f),f=null),"click"===e.type)return p=e,f=setTimeout(function(){f=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(re,i("click",e.closestTrackedAncestor)))})}({allObservables:s,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,l(l([],o(e),!1),[E],!1))},amplitude:u,shouldTrackEvent:n,shouldTrackActionClick:c}),f&&A.push(f),null===(m=null==i?void 0:i.loggerProvider)||void 0===m||m.log("".concat(x," has been successfully added.")),window.opener&&k.enabled&&(p=e.cssSelectorAllowlist,h=e.actionClickAllowlist,me(g=$(),{dataExtractor:C,isElementSelectable:de(e,l(l([],o(p),!1),o(h),!1)),cssSelectorAllowlist:p,actionClickAllowlist:h}),function(e,t){var n,r=e;if(!0!==r[ee]){r[ee]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.2.js.gz",o=null,l=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(){var t,n;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Initializing background capture (external script)");var r=new URL(i,e.endpoint).toString();e.loadScriptOnce(r).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),o=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,{messenger:e,onBackgroundCapture:l}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==o?void 0:o.close)||void 0===e||e.call(o),o=null})}}(g),g.setup(t({logger:null==i?void 0:i.loggerProvider},(null==i?void 0:i.serverZone)&&{endpoint:K[i.serverZone]})))),[2]})})},execute:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){return[2,e]})})},teardown:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){try{for(e=i(A),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(n)throw n.error}}return[2]})})}}},Ie=["mutation","navigate"];function He(e,t){var n,r,i,o,l=t.event,a=l.pageX,u=l.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:a,a),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function je(e){if(0===e.length)return null;var n=e[0],r=e[e.length-1];return{rageClickEvent:t({"[Amplitude] Begin Time":new Date(n.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-n.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},n.targetElementProperties),time:n.timestamp}}function qe(e){var t=this,i=e.amplitude,o=e.allObservables,l=e.shouldTrackRageClick,a=o.clickObservable,u=o.selectionObservable,c=[],s={},d=null;function v(e){c=[],s={},e&&(He(s,e),c.push(e))}var f=z(a.filter(function(e){return l("click",e.closestTrackedAncestor)}),function(e){return n(t,void 0,void 0,function(){var t;return r(this,function(n){return He(s,e),t=null,0===c.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(c,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(c,e)||s.isOutOfBounds?(d&&(t=je(c)),v(e)):c.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),c.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(je(c))},1e3)}})]:[2,null]})})}),p=null==u?void 0:u.subscribe(function(){v()}),h=f.subscribe(function(e){null!==e&&i.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var Ue,Ge;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(Ue||(Ue={})),function(e){e.X="x",e.Y="y"}(Ge||(Ge={}));function Be(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function Xe(e){e.changes=[],e.startTime=void 0}function ze(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var Fe=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?10:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new X(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},l=void 0,a=null;function u(){void 0!==l&&(e.next(l),l=void 0,null!==a&&clearTimeout(a),Xe(n),Xe(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===Ge.X?n:i);var t=function(e,t){var n=void 0;if(Be(e)&&(n=e.startTime),Be(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(l=l||t,a=setTimeout(function(){u(),a=null},o)):u(),ze(n),ze(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},Ye=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?10:i,l=e.thresholdMs,a=void 0===l?2e3:l,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new X(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===Ue.DECREASING&&e.next(Ge.X),r=Ue.INCREASING):o.x<n.x&&(r===Ue.INCREASING&&e.next(Ge.X),r=Ue.DECREASING),o.y>n.y?(i===Ue.DECREASING&&e.next(Ge.Y),i=Ue.INCREASING):o.y<n.y&&(i===Ue.INCREASING&&e.next(Ge.Y),i=Ue.DECREASING),n=o):n=o})})}({allWindowObservables:r});return Fe({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:a}).subscribe(function(e){se(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function Ve(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var We=4e3;return e.DataExtractor=De,e.autocapturePlugin=Re,e.enableVisualTagging=me,e.frustrationPlugin=function(e){var a;void 0===e&&(e={});var u="@amplitude/plugin-frustration-browser",c=[],s=!1!==e.errorClicks;e.errorClicks||(s=!1);var d=!1!==e.deadClicks&&null!==e.deadClicks,v=!1!==e.rageClicks&&null!==e.rageClicks,f=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(f=!1);var p=Ve(e,"rageClicks",E,v),h=Ve(e,"deadClicks",y,d),m=Ve(e,"errorClicks",w,s),b=null!==(a=e.dataAttributePrefix)&&void 0!==a?a:g,T=new De(e),k=l([],o(new Set(l(l(l([],o(p),!1),o(h),!1),o(m),!1))),!1),x=function(){var e,n,r=Y(we("pointerdown").map(function(e){return T.addAdditionalEventProperties(e,"click",k,b,!0)})),i=Y(Ee().map(function(e){return T.addTypeAndTimestamp(e,"error")})),o=Y(ye().map(function(e){return T.addAdditionalEventProperties(e,"mutation",k,b)}));window.navigation&&(n=Y(new X(function(e){var n=function(n){e.next(t(t({},n),{type:"navigate"}))};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}}).map(function(e){return T.addAdditionalEventProperties(e,"navigate",k,b)})));var l=Y(new X(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),a=Y(new X(function(e){var t=function(t){e.next(t)},n={capture:!0};return be.document.addEventListener("mousemove",t,n),function(){be.document.removeEventListener("mousemove",t,n)}}));return(e={})[Ne.ClickObservable]=r,e[Ne.MutationObservable]=o,e[Ne.NavigateObservable]=n,e[Ne.BrowserErrorObservable]=i,e[Ne.SelectionObservable]=l,e[Ne.MouseMoveObservable]=a,e};return{name:u,type:"enrichment",setup:function(i,o){return n(void 0,void 0,void 0,function(){var n,l,a,g,y,w,E,k,A,C,O;return r(this,function(r){return"undefined"==typeof document||(n=x(),v&&(l=de(e,p),a=qe({allObservables:n,amplitude:o,shouldTrackRageClick:l}),c.push(a)),d&&(g=de(e,h),y=function(e){var n=e.amplitude,r=e.allObservables,i=e.getEventProperties,o=e.shouldTrackDeadClick,l=r.clickObservable,a=r.mutationObservable,u=r.navigateObservable,c=l.filter(function(e){return he(e)&&o("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===te.LEFT_OR_TOUCH_CONTACT}),s=u?F(a,u):a,d=F(c,s),v=null;return z(d,function(e){return v&&Ie.includes(e.type)?(clearTimeout(v),v=null,Promise.resolve(null)):"click"===e.type?v?Promise.resolve(null):new Promise(function(t){v=setTimeout(function(){t(e),v=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var r={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};n.track("[Amplitude] Dead Click",t(t({},i("click",e.closestTrackedAncestor)),r),{time:e.timestamp})}})}({amplitude:o,allObservables:n,getEventProperties:function(e,t){return T.getEventProperties(e,t,b)},shouldTrackDeadClick:g}),c.push(y)),s&&(w=de(e,m),E=function(e){var n=e.amplitude,r=e.allObservables,i=e.shouldTrackErrorClick,o=r.clickObservable,l=r.browserErrorObservable,a=o.filter(function(e){return he(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===te.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,s=function(){null!==u&&(clearTimeout(u),u=null),c=null};return F(a,l).subscribe(function(e){var r;if("click"===e.type)return s(),c=e,void(u=setTimeout(s,2e3));"error"===e.type&&c&&(n.track("[Amplitude] Error Click",t(((r={})["[Amplitude] Kind"]=e.event.kind,r["[Amplitude] Message"]=e.event.message,r["[Amplitude] Stack"]=e.event.stack,r["[Amplitude] Filename"]=e.event.filename,r["[Amplitude] Line Number"]=e.event.lineNumber,r["[Amplitude] Column Number"]=e.event.columnNumber,r),c.targetElementProperties)),s())})}({amplitude:o,allObservables:n,shouldTrackErrorClick:w}),c.push(E)),f&&(k=void 0,A=void 0,"object"==typeof e.thrashedCursor&&(k=e.thrashedCursor.directionChanges,A=e.thrashedCursor.threshold,k&&k<5&&(i.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(k," is below the minimum of ").concat(5,", setting to ").concat(5)),k=5),A&&A>We&&(i.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(A," is above the maximum of ").concat(We,", setting to ").concat(We)),A=We)),C=Ye({amplitude:o,options:e,allObservables:n,directionChanges:k,thresholdMs:A}),c.push(C)),null===(O=null==i?void 0:i.loggerProvider)||void 0===O||O.log("".concat(u," has been successfully added."))),[2]})})},execute:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){return[2,e]})})},teardown:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){try{for(e=i(c),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(n)throw n.error}}return[2]})})}}},e.plugin=Re,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
2
2
  //# sourceMappingURL=amplitude-min.js.map
Binary file