@amplitude/segment-session-replay-plugin 0.0.0-beta.8 → 0.0.0-frustrationanalytics.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.d.ts.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.d.ts.map +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/scripts/index-min.js +2 -0
- package/lib/scripts/index-min.js.gz +0 -0
- package/lib/scripts/index-min.js.map +1 -0
- package/lib/scripts/observers-min.js +2 -0
- package/lib/scripts/observers-min.js.gz +0 -0
- package/lib/scripts/observers-min.js.map +1 -0
- package/lib/scripts/rrweb-record-min.js +2 -0
- package/lib/scripts/rrweb-record-min.js.gz +0 -0
- package/lib/scripts/rrweb-record-min.js.map +1 -0
- package/lib/scripts/segment-session-replay-wrapper-esm.js +1 -1
- package/lib/scripts/segment-session-replay-wrapper-esm.js.gz +0 -0
- package/lib/scripts/segment-session-replay-wrapper-esm.js.map +1 -1
- package/package.json +3 -3
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.0.0-
|
|
1
|
+
export declare const VERSION = "0.0.0-frustrationanalytics.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/cjs/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,iCAAiC,CAAC"}
|
package/lib/cjs/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
// Autogenerated by `yarn version-file`. DO NOT EDIT
|
|
5
|
-
exports.VERSION = '0.0.0-
|
|
5
|
+
exports.VERSION = '0.0.0-frustrationanalytics.0';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/lib/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,8BAA8B,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '0.0.0-frustrationanalytics.0';\n"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.0.0-
|
|
1
|
+
export declare const VERSION = "0.0.0-frustrationanalytics.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,iCAAiC,CAAC"}
|
package/lib/esm/version.js
CHANGED
package/lib/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,8BAA8B,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '0.0.0-frustrationanalytics.0';\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}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 s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function a(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var c,u="".concat("AMP","_unsent"),l="https://api2.amplitude.com/2/httpapi";!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(c||(c={}));var d,f=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},v=function(e){return{promise:e||Promise.resolve()}};!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(d||(d={}));var h="Amplitude Logger ",p=function(){function e(){this.logLevel=d.None}return e.prototype.disable=function(){this.logLevel=d.None},e.prototype.enable=function(e){void 0===e&&(e=d.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<d.Verbose||console.log("".concat(h,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<d.Warn||console.warn("".concat(h,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<d.Error||console.error("".concat(h,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<d.Debug||console.log("".concat(h,"[Debug]: ").concat(e.join(" ")))},e}(),g=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:d.Warn,loggerProvider:new p,offline:!1,optOut:!1,serverUrl:l,serverZone:"US",useBatch:!1}},y=function(){function e(e){var t,n,r,o;this._optOut=!1;var i=g();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:i.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||i.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||i.flushQueueSize,this.instanceName=e.instanceName||i.instanceName,this.loggerProvider=e.loggerProvider||i.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:i.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:i.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:i.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||i.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(o=e.useBatch)&&void 0!==o?o:i.useBatch,this.loggerProvider.enable(this.logLevel);var s=b(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),m=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":l},b=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=g().serverZone),void 0===n&&(n=g().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:g().serverZone;return{serverZone:r,serverUrl:m(r,n)}},S=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:w(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),w=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},I=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),C=function(){return C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},C.apply(this,arguments)};function E(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 x(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var k=function(e,t){var n,r,o=typeof e;if(o!==typeof t)return!1;try{for(var i=E(["string","number","boolean","undefined"]),s=i.next();!s.done;s=i.next()){if(s.value===o)return e===t}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var a=Array.isArray(e),c=Array.isArray(t);if(a!==c)return!1;if(!a||!c){var u=Object.keys(e).sort(),l=Object.keys(t).sort();if(!k(u,l))return!1;var d=!0;return Object.keys(e).forEach((function(n){k(e[n],t[n])||(d=!1)})),d}for(var f=0;f<e.length;f++)if(!k(e[f],t[f]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var _,P=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=C({},this.identity.userProperties),n=C(C({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,o,i,s,a,c=n.userProperties||{};try{for(var u=E(Object.entries(e)),l=u.next();!l.done;l=u.next()){var d=x(l.value,2),f=d[0],v=d[1];switch(f){case"$set":try{for(var h=(o=void 0,E(Object.entries(v))),p=h.next();!p.done;p=h.next()){var g=x(p.value,2),y=g[0],m=g[1];c[y]=m}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(o)throw o.error}}break;case"$unset":try{for(var b=(s=void 0,E(Object.keys(v))),S=b.next();!S.done;S=b.next()){delete c[y=S.value]}}catch(e){s={error:e}}finally{try{S&&!S.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":c={}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return n.userProperties=c,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return C({},this.identity)},e.prototype.setIdentity=function(e){var t=C({},this.identity);this.identity=C({},e),k(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,O=function(){function e(){this.identityStore=new P,this.eventBridge=new I,this.applicationContextProvider=new S}return e.getInstance=function(t){return R.analyticsConnectorInstances||(R.analyticsConnectorInstances={}),R.analyticsConnectorInstances[t]||(R.analyticsConnectorInstances[t]=new e),R.analyticsConnectorInstances[t]},e}(),T=function(e,t,n,r,o){return void 0===o&&(o=null),function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var a=n(),c=a.logger,u=a.logLevel;if(u&&u<d.Debug||!u||!c)return e.apply(o,i);var l,f={type:"invoke public method",name:t,args:i,stacktrace:(l=1,void 0===l&&(l=0),((new Error).stack||"").split("\n").slice(2+l).map((function(e){return e.trim()}))),time:{start:(new Date).toISOString()},states:{}};r&&f.states&&(f.states.before=r());var v=e.apply(o,i);return v&&v.promise?v.promise.then((function(){r&&f.states&&(f.states.after=r()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))})):(r&&f.states&&(f.states.after=r()),f.time&&(f.time.end=(new Date).toISOString()),c.debug(JSON.stringify(f,null,2))),v}},L=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,o,i,s,a,u,l,d,f,v,h,p,g,y,m,b,S,w,I,C;if("object"!=typeof e)return null;var E=e.code||0,x=this.buildStatus(E);switch(x){case c.Success:return{status:x,statusCode:E,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case c.Invalid:return{status:x,statusCode:E,body:{error:null!==(o=e.error)&&void 0!==o?o:"",missingField:null!==(i=e.missing_field)&&void 0!==i?i:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(a=e.events_with_missing_fields)&&void 0!==a?a:{},eventsWithInvalidIdLengths:null!==(u=e.events_with_invalid_id_lengths)&&void 0!==u?u:{},epsThreshold:null!==(l=e.eps_threshold)&&void 0!==l?l:0,exceededDailyQuotaDevices:null!==(d=e.exceeded_daily_quota_devices)&&void 0!==d?d:{},silencedDevices:null!==(f=e.silenced_devices)&&void 0!==f?f:[],silencedEvents:null!==(v=e.silenced_events)&&void 0!==v?v:[],throttledDevices:null!==(h=e.throttled_devices)&&void 0!==h?h:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case c.PayloadTooLarge:return{status:x,statusCode:E,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case c.RateLimit:return{status:x,statusCode:E,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(S=e.throttled_users)&&void 0!==S?S:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(I=e.exceeded_daily_quota_users)&&void 0!==I?I:{},throttledEvents:null!==(C=e.throttled_events)&&void 0!==C?C:[]}};case c.Timeout:default:return{status:x,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?c.Success:429===e?c.RateLimit:413===e?c.PayloadTooLarge:408===e?c.Timeout:e>=400&&e<500?c.Invalid:e>=500?c.Failed:c.Unknown},e}(),D=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n,r,i;return o(this,(function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,(r=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:r.status})]}return[2]}}))}))},n}(L);!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(_||(_={}));var q,M="[Amplitude]",N="".concat(M," Session Replay ID"),j=_.US,U="".concat(M," Session Replay Debug"),B="amp-mask";!function(e){e.GET_SR_PROPS="get-sr-props",e.DEBUG_INFO="debug-info",e.FETCH_REQUEST="fetch-request",e.METADATA="metadata"}(q||(q={}));var F=function(){function e(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(e){var t;if(!this.logger)return function(){};var n=this.logger[e];return"function"==typeof n?(null!==(t=n.__rrweb_original__)&&void 0!==t?t:n).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),A="medium";var W,K,z=function(e,t,n){switch(t){case"light":if("input"!==e)return!0;var r=n?function(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?t.toLowerCase():null}(n):"";return!!r&&(!!["password","hidden","email","tel"].includes(r)||!!n.autocomplete.startsWith("cc-"));case"medium":case"conservative":return!0;default:return z(e,A,n)}},Q=function(e,t){return function(n,r){return function(e,t,n){var r,o,i;if(void 0===t&&(t={defaultMaskLevel:A}),n){if(n.closest("."+B))return!0;var s=(null!==(r=t.maskSelector)&&void 0!==r?r:[]).some((function(e){return n.closest(e)}));if(s)return!0;if(n.closest(".amp-unmask"))return!1;var a=(null!==(o=t.unmaskSelector)&&void 0!==o?o:[]).some((function(e){return n.closest(e)}));if(a)return!1}return z(e,null!==(i=t.defaultMaskLevel)&&void 0!==i?i:A,n)}(e,t,r)?n.replace(/[^\s]/g,"*"):n}},G=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},H=function(e,t){return t||(e===_.STAGING?"https://api-sr.stag2.amplitude.com/sessions/v2/track":e===_.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track")},Z=function(e,t){var n,r,o,s;try{for(var a=i(t),c=a.next();!c.done;c=a.next()){var u=c.value,l=(o=u.selector,s=void 0,s=o.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,"."),new RegExp("^".concat(s,"$")));if(l.test(e))return e.replace(l,u.replacement)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return e},$=function(){return r(void 0,void 0,void 0,(function(){var e,t,n,r,i,s,a;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),(e=f())?[4,e.navigator.storage.estimate()]:[3,2];case 1:return t=o.sent(),n=t.usage,r=t.quota,i=t.usageDetails,s=n?Math.round(n/1024):0,a=n&&r?Math.round(1e3*(n/r+Number.EPSILON))/1e3:0,[2,{totalStorageSize:s,percentOfQuota:a,usageDetails:JSON.stringify(i)}];case 2:return[3,4];case 3:return o.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}}))}))},J=function(e){var t=n({},e),r=t.apiKey;return t.apiKey="****".concat(r.substring(r.length-4)),t},X=function(){return{flushMaxRetries:2,logLevel:d.Warn,loggerProvider:new p,transportProvider:new D}},V=function(e){function r(t,r){var o,i,s=this,a=X();return(s=e.call(this,n(n({transportProvider:a.transportProvider,loggerProvider:new F(r.loggerProvider||a.loggerProvider)},r),{apiKey:t}))||this).flushMaxRetries=void 0!==r.flushMaxRetries&&r.flushMaxRetries<=a.flushMaxRetries?r.flushMaxRetries:a.flushMaxRetries,s.apiKey=t,s.sampleRate=r.sampleRate||0,s.serverZone=r.serverZone||j,s.configServerUrl=r.configServerUrl,s.trackServerUrl=r.trackServerUrl,s.shouldInlineStylesheet=r.shouldInlineStylesheet,s.version=r.version,s.performanceConfig=r.performanceConfig,s.storeType=null!==(o=r.storeType)&&void 0!==o?o:"idb",s.applyBackgroundColorToBlockedElements=null!==(i=r.applyBackgroundColorToBlockedElements)&&void 0!==i&&i,r.privacyConfig&&(s.privacyConfig=r.privacyConfig),r.interactionConfig&&(s.interactionConfig=r.interactionConfig,s.interactionConfig.ugcFilterRules&&function(e){if(!e.every((function(e){return"string"==typeof e.selector&&"string"==typeof e.replacement})))throw new Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every((function(e){return"string"==typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t);var t})))throw new Error("ugcFilterRules must be an array of objects with valid globs")}(s.interactionConfig.ugcFilterRules)),r.debugMode&&(s.debugMode=r.debugMode),r.experimental&&(s.experimental=r.experimental),s}return t(r,e),r}(y),Y=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Y||{}),ee=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ee||{});!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(W||(W={})),function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(K||(K={}));var te=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,o,i,s,a,c,u,l,d,f,v,h,p,g,y,m,b,S,w,I;if("object"!=typeof e)return null;var C=e.code||0,E=this.buildStatus(C);switch(E){case K.Success:return{status:E,statusCode:C,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case K.Invalid:return{status:E,statusCode:C,body:{error:null!==(o=e.error)&&void 0!==o?o:"",missingField:null!==(i=e.missing_field)&&void 0!==i?i:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(a=e.events_with_missing_fields)&&void 0!==a?a:{},eventsWithInvalidIdLengths:null!==(c=e.events_with_invalid_id_lengths)&&void 0!==c?c:{},epsThreshold:null!==(u=e.eps_threshold)&&void 0!==u?u:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case K.PayloadTooLarge:return{status:E,statusCode:C,body:{error:null!==(p=e.error)&&void 0!==p?p:""}};case K.RateLimit:return{status:E,statusCode:C,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(m=e.throttled_devices)&&void 0!==m?m:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(S=e.exceeded_daily_quota_devices)&&void 0!==S?S:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(I=e.throttled_events)&&void 0!==I?I:[]}};case K.Timeout:default:return{status:E,statusCode:C}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?K.Success:429===e?K.RateLimit:413===e?K.PayloadTooLarge:408===e?K.Timeout:e>=400&&e<500?K.Invalid:e>=500?K.Failed:K.Unknown},e}(),ne="Remote config fetch rejected due to timeout after 5 seconds",re="Unexpected error occurred",oe=function(){function e(e){var t=e.localConfig,s=e.configKeys,a=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteConfig=function(e,t,n){return r(a,void 0,void 0,(function(){var r,i,s;return o(this,(function(o){switch(o.label){case 0:return r=Date.now(),[4,this.fetchWithTimeout(n)];case 1:return(i=o.sent())&&(s=i.configs&&i.configs[e])?(this.metrics.fetchTimeAPISuccess=Date.now()-r,[2,s[t]]):(this.metrics.fetchTimeAPIFail=Date.now()-r,[2,void 0])}}))}))},this.fetchWithTimeout=function(e){return r(a,void 0,void 0,(function(){var t,n,r;return o(this,(function(o){switch(o.label){case 0:return t=new AbortController,n=setTimeout((function(){return t.abort()}),5e3),[4,this.fetchRemoteConfig(t.signal,e)];case 1:return r=o.sent(),clearTimeout(n),[2,r]}}))}))},this.fetchRemoteConfig=function(e,t){return r(a,void 0,void 0,(function(){var r,s,a,c,u,l,d,f,v,h,p,g;return o(this,(function(o){switch(o.label){case 0:if(t===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:ne})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),o.label=1;case 1:o.trys.push([1,3,,4]),r=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(s=i(this.configKeys),a=s.next();!a.done;a=s.next())c=a.value,r.append("config_keys",c)}catch(e){h={error:e}}finally{try{a&&!a.done&&(p=s.return)&&p.call(s)}finally{if(h)throw h.error}}return t&&r.set("session_id",String(t)),u={headers:{Accept:"*/*"},method:"GET"},l="".concat(this.getServerUrl(),"?").concat(r.toString()),this.attempts+=1,[4,fetch(l,n(n({},u),{signal:e}))];case 2:if(null===(d=o.sent()))return[2,this.completeRequest({err:re})];switch((new te).buildStatus(d.status)){case K.Success:return this.attempts=0,[2,this.parseAndStoreConfig(d)];case K.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return f=o.sent(),v=f,e.aborted?[2,this.completeRequest({err:ne})]:[2,this.completeRequest({err:null!==(g=v.message)&&void 0!==g?g:re})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return r(a,void 0,void 0,(function(){var n=this;return o(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(e){return setTimeout(e,n.attempts*n.retryTimeout)}))];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}}))}))},this.parseAndStoreConfig=function(e){return r(a,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return[4,e.json()];case 1:return t=n.sent(),this.completeRequest({success:"Remote config successfully fetched"}),[2,t]}}))}))},this.localConfig=t,this.configKeys=s}return e.prototype.getServerUrl=function(){return this.localConfig.configServerUrl?this.localConfig.configServerUrl:this.localConfig.serverZone===W.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===W.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw new Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),ie=function(e){var t=e.localConfig,n=e.configKeys;return r(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,new oe({localConfig:t,configKeys:n})]}))}))},se=function(){function e(e,t){this.localConfig=t,this.remoteConfigFetch=e}return e.prototype.generateJoinedConfig=function(e){var t,a,c,u;return r(this,void 0,void 0,(function(){var r,l,d,f,v,h,p,g,y,m,b,S,w,I,C,E,x,k,_,P,R,O;return o(this,(function(o){switch(o.label){case 0:(r=n({},this.localConfig)).optOut=this.localConfig.optOut,r.captureEnabled=!0,o.label=1;case 1:return o.trys.push([1,6,,7]),[4,this.remoteConfigFetch.getRemoteConfig("sessionReplay","sr_sampling_config",e)];case 2:return d=o.sent(),[4,this.remoteConfigFetch.getRemoteConfig("sessionReplay","sr_privacy_config",e)];case 3:return f=o.sent(),v=null===(t=r.interactionConfig)||void 0===t?void 0:t.ugcFilterRules,h=r,[4,this.remoteConfigFetch.getRemoteConfig("sessionReplay","sr_interaction_config",e)];case 4:return h.interactionConfig=o.sent(),r.interactionConfig&&v&&(r.interactionConfig.ugcFilterRules=v),p=r,[4,this.remoteConfigFetch.getRemoteConfig("sessionReplay","sr_logging_config",e)];case 5:return p.loggingConfig=o.sent(),(d||f)&&(l={},d&&(l.sr_sampling_config=d),f&&(l.sr_privacy_config=f)),[3,7];case 6:return g=o.sent(),y=g,this.localConfig.loggerProvider.warn(y.message),r.captureEnabled=!1,[3,7];case 7:if(!l)return[2,{localConfig:this.localConfig,joinedConfig:r,remoteConfig:l}];if(m=l.sr_sampling_config,b=l.sr_privacy_config,m&&Object.keys(m).length>0?(Object.prototype.hasOwnProperty.call(m,"capture_enabled")?r.captureEnabled=m.capture_enabled:r.captureEnabled=!1,Object.prototype.hasOwnProperty.call(m,"sample_rate")&&(r.sampleRate=m.sample_rate)):(r.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),b){S=null!==(a=r.privacyConfig)&&void 0!==a?a:{},w={defaultMaskLevel:null!==(u=null!==(c=b.defaultMaskLevel)&&void 0!==c?c:S.defaultMaskLevel)&&void 0!==u?u:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[]},I=function(e){var t,n,r,o,s,a,c,u,l,d={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var f=i(null!==(c=e.blockSelector)&&void 0!==c?c:[]),v=f.next();!v.done;v=f.next()){d[v.value]="block"}}catch(e){t={error:e}}finally{try{v&&!v.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}try{for(var h=i(null!==(u=e.maskSelector)&&void 0!==u?u:[]),p=h.next();!p.done;p=h.next()){d[p.value]="mask"}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(r)throw r.error}}try{for(var g=i(null!==(l=e.unmaskSelector)&&void 0!==l?l:[]),y=g.next();!y.done;y=g.next()){d[y.value]="unmask"}}catch(e){s={error:e}}finally{try{y&&!y.done&&(a=g.return)&&a.call(g)}finally{if(s)throw s.error}}return d},C=n(n({},I(S)),I(b));try{for(E=i(Object.entries(C)),x=E.next();!x.done;x=E.next())k=s(x.value,2),_=k[0],"mask"===(P=k[1])?w.maskSelector.push(_):"block"===P?w.blockSelector.push(_):"unmask"===P&&w.unmaskSelector.push(_)}catch(e){R={error:e}}finally{try{x&&!x.done&&(O=E.return)&&O.call(E)}finally{if(R)throw R.error}}r.privacyConfig=function(e,t){var n=document.createDocumentFragment(),r=function(e){if(void 0===e&&(e=[]),"string"==typeof e&&(e=[e]),e=e.filter((function(e){try{n.querySelector(e)}catch(n){return t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid')),!1}return!0})),0!==e.length)return e};return e.blockSelector=r(e.blockSelector),e.maskSelector=r(e.maskSelector),e.unmaskSelector=r(e.unmaskSelector),e}(w,this.localConfig.loggerProvider)}return this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:J(r)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:r,remoteConfig:l}]}}))}))},e}(),ae=function(e,t){return r(void 0,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:return n=new V(e,t),[4,ie({localConfig:n,configKeys:["sessionReplay"]})];case 1:return r=o.sent(),[2,new se(r,n)]}}))}))},ce="Failed to store session replay events in IndexedDB",ue="1.25.2-frustrationanalytics.0",le=function(){function e(e){var t=e.trackServerUrl,n=e.loggerProvider,r=e.payloadBatcher;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=n,this.payloadBatcher=r||function(e){return e},this.trackServerUrl=t}return e.prototype.sendEventsList=function(e){this.addToQueue(n(n({},e),{attempts:0,timeout:0}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.filter((function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"Session replay event batch rejected due to exceeded retry count"}),!1)})).forEach((function(t){e.queue=e.queue.concat(t),0!==t.timeout?setTimeout((function(){t.timeout=0,e.schedule(0)}),t.timeout):e.schedule(0)}))},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout((function(){t.flush(!0).then((function(){t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){var t,n,r=this;return o(this,(function(o){switch(o.label){case 0:return t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),[4,Promise.all(t.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}}))}))},e.prototype.send=function(e,t){var n,i;return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var r,s,a,c,u,l,d,v,h,p,g,y,m;return o(this,(function(o){switch(o.label){case 0:if(!(r=e.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(s=e.deviceId))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];if(b=f(),a=(null==b?void 0:b.location)?b.location.href:"",c=ue,u=e.sampleRate,l=new URLSearchParams({device_id:s,session_id:"".concat(e.sessionId),type:"".concat(e.type)}),d="".concat((null===(n=e.version)||void 0===n?void 0:n.type)||"standalone","/").concat((null===(i=e.version)||void 0===i?void 0:i.version)||c),0===(v=this.payloadBatcher({version:1,events:e.events})).events.length)return this.completeRequest({context:e}),[2];o.label=1;case 1:return o.trys.push([1,3,,4]),h={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(r),"X-Client-Version":c,"X-Client-Library":d,"X-Client-Url":a.substring(0,1e3),"X-Client-Sample-Rate":"".concat(u)},body:JSON.stringify(v),method:"POST"},p="".concat(H(e.serverZone,this.trackServerUrl),"?").concat(l.toString()),[4,fetch(p,h)];case 2:if(null===(g=o.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(g.status,e);else{y="";try{y=JSON.stringify(g.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(g.status,": ").concat(y)})}return[3,4];case 3:return m=o.sent(),this.completeRequest({context:e,err:m}),[3,4];case 4:return[2]}var b}))}))},e.prototype.handleReponse=function(e,t){switch((new L).buildStatus(e)){case c.Success:this.handleSuccessResponse(t);break;case c.Failed:this.handleOtherResponse(t);break;default:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"})}},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/1024);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){this.addToQueue(n(n({},e),{timeout:e.attempts*this.retryTimeout}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e}();const de=(e,t)=>t.some((t=>e instanceof t));let fe,ve;const he=new WeakMap,pe=new WeakMap,ge=new WeakMap;let ye={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return he.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return we(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function me(e){ye=e(ye)}function be(e){return(ve||(ve=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Ie(this),t),we(this.request)}:function(...t){return we(e.apply(Ie(this),t))}}function Se(e){return"function"==typeof e?be(e):(e instanceof IDBTransaction&&function(e){if(he.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",i),e.removeEventListener("abort",i)},o=()=>{t(),r()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",o),e.addEventListener("error",i),e.addEventListener("abort",i)}));he.set(e,t)}(e),de(e,fe||(fe=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,ye):e)}function we(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{t(we(e.result)),r()},i=()=>{n(e.error),r()};e.addEventListener("success",o),e.addEventListener("error",i)}));return ge.set(t,e),t}(e);if(pe.has(e))return pe.get(e);const t=Se(e);return t!==e&&(pe.set(e,t),ge.set(t,e)),t}const Ie=e=>ge.get(e);function Ce(e,t,{blocked:n,upgrade:r,blocking:o,terminated:i}={}){const s=indexedDB.open(e,t),a=we(s);return r&&s.addEventListener("upgradeneeded",(e=>{r(we(s.result),e.oldVersion,e.newVersion,we(s.transaction),e)})),n&&s.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{i&&e.addEventListener("close",(()=>i())),o&&e.addEventListener("versionchange",(e=>o(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}const Ee=["get","getKey","getAll","getAllKeys","count"],xe=["put","add","delete","clear"],ke=new Map;function _e(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ke.get(t))return ke.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=xe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!o&&!Ee.includes(n))return;const i=async function(e,...t){const i=this.transaction(e,o?"readwrite":"readonly");let s=i.store;return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),o&&i.done]))[0]};return ke.set(t,i),i}me((e=>({...e,get:(t,n,r)=>_e(t,n)||e.get(t,n,r),has:(t,n)=>!!_e(t,n)||e.has(t,n)})));const Pe=["continue","continuePrimaryKey","advance"],Re={},Oe=new WeakMap,Te=new WeakMap,Le={get(e,t){if(!Pe.includes(t))return e[t];let n=Re[t];return n||(n=Re[t]=function(...e){Oe.set(this,Te.get(this)[t](...e))}),n}};async function*De(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const n=new Proxy(t,Le);for(Te.set(n,t),ge.set(n,Ie(t));t;)yield n,t=await(Oe.get(n)||t.continue()),Oe.delete(n)}function qe(e,t){return t===Symbol.asyncIterator&&de(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&de(e,[IDBIndex,IDBObjectStore])}me((e=>({...e,get:(t,n,r)=>qe(t,n)?De:e.get(t,n,r),has:(t,n)=>qe(t,n)||e.has(t,n)})));var Me,Ne=function(){function e(e){var t,n,r,o=this;this.minInterval=500,this.maxInterval=1e4,this.maxPersistedEventsSize=1e6,this.interval=this.minInterval,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,t){var n=new Blob([t]).size;return new Blob(e).size+n>=o.maxPersistedEventsSize||!!(Date.now()-o.timeAtLastSplit>o.interval&&e.length)&&(o.interval=Math.min(o.maxInterval,o.interval+o.minInterval),o._timeAtLastSplit=Date.now(),!0)},this.loggerProvider=e.loggerProvider,this.minInterval=null!==(t=e.minInterval)&&void 0!==t?t:this.minInterval,this.maxInterval=null!==(n=e.maxInterval)&&void 0!==n?n:this.maxInterval,this.maxPersistedEventsSize=null!==(r=e.maxPersistedEventsSize)&&void 0!==r?r:this.maxPersistedEventsSize}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e}();!function(e){e.RECORDING="recording",e.SENT="sent"}(Me||(Me={}));var je="sessionCurrentSequence",Ue="sequencesToSend",Be=function(){var e=f();return new Promise((function(t,n){if(!e)return n(new Error("Global scope not found"));if(!e.indexedDB)return n(new Error("Session Replay: cannot find indexedDB"));try{var r=e.indexedDB.open("keyval-store");r.onupgradeneeded=function(){1===r.result.version&&(r.result.close(),r.transaction&&r.transaction.abort(),e.indexedDB.deleteDatabase("keyval-store"),t())},r.onsuccess=function(){t(r.result)},r.onerror=function(){n(r.error)}}catch(e){n(e)}}))},Fe=function(e){return r(void 0,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return e.length>0?(t=e.splice(0,10),[4,Promise.all(t)]):[3,2];case 1:return n.sent(),[3,0];case 2:return[2]}}))}))},Ae=function(e){var t,n;return e.objectStoreNames.contains(je)||(n=e.createObjectStore(je,{keyPath:"sessionId"})),e.objectStoreNames.contains(Ue)||(t=e.createObjectStore(Ue,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:n}},We=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,Ce(e,1,{upgrade:Ae})];case 1:return[2,t.sent()]}}))}))},Ke=function(e){function c(t){var i=e.call(this,t)||this;return i.getSequencesToSend=function(){return r(i,void 0,void 0,(function(){var e,t,n,r,i,s;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),e=[],[4,this.db.transaction("sequencesToSend").store.openCursor()];case 1:t=o.sent(),o.label=2;case 2:return t?(n=t.value,r=n.sessionId,i=n.events,e.push({events:i,sequenceId:t.key,sessionId:r}),[4,t.continue()]):[3,4];case 3:return t=o.sent(),[3,2];case 4:return[2,e];case 5:return s=o.sent(),this.loggerProvider.warn("".concat(ce,": ").concat(s)),[3,6];case 6:return[2,void 0]}}))}))},i.storeCurrentSequence=function(e){return r(i,void 0,void 0,(function(){var t,r,i;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),[4,this.db.get(je,e)];case 1:return(t=o.sent())?[4,this.db.put(Ue,{sessionId:e,events:t.events})]:[2,void 0];case 2:return r=o.sent(),[4,this.db.put(je,{sessionId:e,events:[]})];case 3:return o.sent(),[2,n(n({},t),{sessionId:e,sequenceId:r})];case 4:return i=o.sent(),this.loggerProvider.warn("".concat(ce,": ").concat(i)),[3,5];case 5:return[2,void 0]}}))}))},i.addEventToCurrentSequence=function(e,t){return r(i,void 0,void 0,(function(){var n,r,i,s,a,c;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,10,,11]),[4,(n=this.db.transaction(je,"readwrite")).store.get(e)];case 1:return(r=o.sent())?[3,3]:[4,n.store.put({sessionId:e,events:[t]})];case 2:return o.sent(),[2];case 3:return i=void 0,this.shouldSplitEventsList(r.events,t)?(i=r.events,[4,n.store.put({sessionId:e,events:[t]})]):[3,5];case 4:return o.sent(),[3,7];case 5:return s=r.events.concat(t),[4,n.store.put({sessionId:e,events:s})];case 6:o.sent(),o.label=7;case 7:return[4,n.done];case 8:return o.sent(),i?[4,this.storeSendingEvents(e,i)]:[2,void 0];case 9:return(a=o.sent())?[2,{events:i,sessionId:e,sequenceId:a}]:[2,void 0];case 10:return c=o.sent(),this.loggerProvider.warn("".concat(ce,": ").concat(c)),[3,11];case 11:return[2,void 0]}}))}))},i.storeSendingEvents=function(e,t){return r(i,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.db.put(Ue,{sessionId:e,events:t})];case 1:return[2,r.sent()];case 2:return n=r.sent(),this.loggerProvider.warn("".concat(ce,": ").concat(n)),[3,3];case 3:return[2,void 0]}}))}))},i.cleanUpSessionEventsStore=function(e,t){return r(i,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:if(!t)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.db.delete(Ue,t)];case 2:return n.sent(),[3,4];case 3:return e=n.sent(),this.loggerProvider.warn("".concat(ce,": ").concat(e)),[3,4];case 4:return[2]}}))}))},i.transitionFromKeyValStore=function(e){return r(i,void 0,void 0,(function(){var t,n,i,c,l,d,v,h,p=this;return o(this,(function(g){switch(g.label){case 0:return g.trys.push([0,6,,7]),[4,Be()];case 1:if(!(t=g.sent()))return[2];n=function(e,t){return r(p,void 0,void 0,(function(){var n,i,c=this;return o(this,(function(u){switch(u.label){case 0:return n=t.sessionSequences,i=[],Object.keys(n).forEach((function(u){var l=parseInt(u,10),d=n[l];if(l===t.currentSequenceId){var f=d.events.map((function(t){return r(c,void 0,void 0,(function(){return o(this,(function(n){return[2,this.addEventToCurrentSequence(e,t)]}))}))}));i.push.apply(i,a([],s(f),!1))}else d.status!==Me.SENT&&i.push(c.storeSendingEvents(e,d.events))})),[4,Fe(i)];case 1:return u.sent(),[2]}}))}))},i="".concat(u,"_").concat(this.apiKey.substring(0,10)),g.label=2;case 2:return g.trys.push([2,4,,5]),c=t.transaction("keyval").objectStore("keyval").getAll(i),l=new Promise((function(t){c.onsuccess=function(i){return r(p,void 0,void 0,(function(){var r,s,a,c=this;return o(this,(function(o){switch(o.label){case 0:return r=i&&i.target.result,(s=r&&r[0])?(a=[],Object.keys(s).forEach((function(t){var r=parseInt(t,10),o=s[r];if(e===r)a.push(n(r,o));else{var i=o.sessionSequences;Object.keys(i).forEach((function(e){var t=parseInt(e,10);i[t].status!==Me.SENT&&a.push(c.storeSendingEvents(r,i[t].events))}))}})),[4,Fe(a)]):[3,2];case 1:o.sent(),o.label=2;case 2:return t(),[2]}}))}))}})),[4,l];case 3:return g.sent(),(d=f())&&d.indexedDB.deleteDatabase("keyval-store"),[3,5];case 4:return v=g.sent(),this.loggerProvider.warn("Failed to transition session replay events from keyval to new store: ".concat(v)),[3,5];case 5:return[3,7];case 6:return h=g.sent(),this.loggerProvider.warn("Failed to access keyval store: ".concat(h,". For more information, visit: https://www.docs.developers.amplitude.com/session-replay/sdks/standalone/#indexeddb-best-practices")),[3,7];case 7:return[2]}}))}))},i.apiKey=t.apiKey,i.db=t.db,i}return t(c,e),c.new=function(e,t,i){return r(this,void 0,void 0,(function(){var r,s,a,u,l;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),r="replay"===e?"":"_".concat(e),s="".concat(t.apiKey.substring(0,10),"_amp_session_replay_events").concat(r),[4,We(s)];case 1:return a=o.sent(),[4,(u=new c(n(n({},t),{db:a}))).transitionFromKeyValStore(i)];case 2:return o.sent(),[2,u];case 3:return l=o.sent(),t.loggerProvider.warn("".concat(ce,": ").concat(l)),[3,4];case 4:return[2]}}))}))},c.prototype.getCurrentSequenceEvents=function(e){return r(this,void 0,void 0,(function(){var t,n,r,s,a,c,u;return o(this,(function(o){switch(o.label){case 0:return e?[4,this.db.get("sessionCurrentSequence",e)]:[3,2];case 1:return(s=o.sent())?[2,[s]]:[2,void 0];case 2:t=[],o.label=3;case 3:return o.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:n=i.apply(void 0,[o.sent()]),r=n.next(),o.label=5;case 5:if(r.done)return[3,7];s=r.value,t.push(s),o.label=6;case 6:return r=n.next(),[3,5];case 7:return[3,10];case 8:return a=o.sent(),c={error:a},[3,10];case 9:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(c)throw c.error}return[7];case 10:return[2,t]}}))}))},c}(Ne),ze=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t}return t(n,e),n.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},n.prototype.addSequence=function(e){var t=this.sequenceId++,n=a([],s(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:n},this.resetCurrentSequence(e),{sequenceId:t,events:n,sessionId:e}},n.prototype.getSequencesToSend=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,Object.entries(this.finalizedSequences).map((function(e){var t=s(e,2),n=t[0],r=t[1],o=r.sessionId,i=r.events;return{sequenceId:Number(n),sessionId:o,events:i}}))]}))}))},n.prototype.storeCurrentSequence=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return this.sequences[e]?[2,this.addSequence(e)]:[2,void 0]}))}))},n.prototype.addEventToCurrentSequence=function(e,t){return r(this,void 0,void 0,(function(){var n;return o(this,(function(r){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(n=this.addSequence(e)),this.sequences[e].push(t),[2,n]}))}))},n.prototype.storeSendingEvents=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(n){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]}))}))},n.prototype.cleanUpSessionEventsStore=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]}))}))},n}(Ne),Qe=function(e){var t=e.config,i=e.sessionId,s=e.minInterval,a=e.maxInterval,c=e.type,u=e.payloadBatcher,l=e.storeType;return r(void 0,void 0,void 0,(function(){function e(e){return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,d.flush(e)]}))}))}var d,f,v,h,p,g,y,m,b;return o(this,(function(S){switch(S.label){case 0:return d=new le(n(n({},t),{loggerProvider:t.loggerProvider,payloadBatcher:u})),f=function(){return new ze({loggerProvider:t.loggerProvider,maxInterval:a,minInterval:s})},v=function(){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return[4,Ke.new(c,{loggerProvider:t.loggerProvider,minInterval:s,maxInterval:a,apiKey:t.apiKey},i)];case 1:return e=n.sent(),t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,null!=e?e:f()]}}))}))},"idb"!==l?[3,2]:[4,v()];case 1:return p=S.sent(),[3,3];case 2:p=f(),S.label=3;case 3:return h=p,g=function(e){var n=e.events,i=e.sessionId,s=e.deviceId,a=e.sequenceId;t.debugMode&&$().then((function(e){var n=e.totalStorageSize,r=e.percentOfQuota,o=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(n," KB, percentage of quota: ").concat(r,"%, usage details: ").concat(o))})).catch((function(){})),d.sendEventsList({events:n,sessionId:i,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:c,onComplete:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,h.cleanUpSessionEventsStore(i,a)];case 1:return e.sent(),[2]}}))}))}})},y=function(e){var n=e.sessionId,r=e.deviceId;h.storeCurrentSequence(n).then((function(e){e&&g({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})})).catch((function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)}))},m=function(e){var t=e.deviceId;return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return[4,h.getSequencesToSend()];case 1:return(e=n.sent())&&e.forEach((function(e){g({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:t})})),[2]}}))}))},b=function(e){var n=e.event,r=e.sessionId,o=e.deviceId;h.addEventToCurrentSequence(r,n.data).then((function(e){return e&&g({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:o})})).catch((function(e){t.loggerProvider.warn("Failed to add event to session replay capture:",e)}))},[2,{sendCurrentSequenceEvents:y,addEvent:b,sendStoredEvents:m,flush:e}]}}))}))},Ge=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Map;e.forEach((function(e){n.set(e.name,e.manager)})),this.managers=n}return e.prototype.sendStoredEvents=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t=[],this.managers.forEach((function(n){t.push(n.sendStoredEvents(e))})),[4,Promise.all(t)];case 1:return n.sent(),[2]}}))}))},e.prototype.addEvent=function(e){var t,n=e.sessionId,r=e.event,o=e.deviceId;null===(t=this.managers.get(r.type))||void 0===t||t.addEvent({sessionId:n,event:r,deviceId:o})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,n=e.deviceId;this.managers.forEach((function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:n})}))},e.prototype.flush=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t=[],this.managers.forEach((function(n){t.push(n.flush(e))})),[4,Promise.all(t)];case 1:return n.sent(),[2]}}))}))},e}();const He={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ze={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},$e={};function Je(e){if($e[e])return $e[e];const t=globalThis[e],n=t.prototype,r=e in He?He[e]:void 0,o=Boolean(r&&r.every((e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))}))),i=e in Ze?Ze[e]:void 0,s=Boolean(i&&i.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(o&&s&&!globalThis.Zone)return $e[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const o=r.contentWindow;if(!o)return t.prototype;const i=o[e].prototype;return document.body.removeChild(r),i?$e[e]=i:n}catch{return n}}const Xe={};function Ve(e,t,n){var r;const o=`${e}.${String(n)}`;if(Xe[o])return Xe[o].call(t);const i=Je(e),s=null==(r=Object.getOwnPropertyDescriptor(i,n))?void 0:r.get;return s?(Xe[o]=s,s.call(t)):t[n]}const Ye={};function et(e,t,n){const r=`${e}.${String(n)}`;if(Ye[r])return Ye[r].bind(t);const o=Je(e)[n];return"function"!=typeof o?t[n]:(Ye[r]=o,o.bind(t))}const tt={childNodes:function(e){return Ve("Node",e,"childNodes")},parentNode:function(e){return Ve("Node",e,"parentNode")},parentElement:function(e){return Ve("Node",e,"parentElement")},textContent:function(e){return Ve("Node",e,"textContent")},contains:function(e,t){return et("Node",e,"contains")(t)},getRootNode:function(e){return et("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Ve("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Ve("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Ve("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Ve("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Je("MutationObserver").constructor}};function nt(){var e=f();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}function rt(){var e=f();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}var ot,it,st;function at(e,t){if(st=new Date,e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};ot=n(n({},r),t),it=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(ot.root,r);var o=ct(e,"all",(function(){return ct(e,"two",(function(){return ct(e,"one",(function(){return ct(e,"none")}))}))}));if(o){var i=mt(bt(o,e));return i.length>0&&(o=i[0]),lt(o)}throw new Error("Selector was not found.")}function ct(e,t,n){for(var r=null,o=[],c=e,u=0,l=function(){var e,l,d=(new Date).getTime()-st.getTime();if(void 0!==ot.timeoutMs&&d>ot.timeoutMs)throw new Error("Timeout: Can't find a unique selector after ".concat(d,"ms"));var f=pt(function(e){var t=e.getAttribute("id");if(t&&ot.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(c))||pt.apply(void 0,a([],s(function(e){var t=Array.from(e.attributes).filter((function(e){return ot.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(c)),!1))||pt.apply(void 0,a([],s(function(e){var t=Array.from(e.classList).filter(ot.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(c)),!1))||pt(function(e){var t=e.tagName.toLowerCase();if(ot.tagName(t))return{name:t,penalty:2};return null}(c))||[{name:"*",penalty:3}],v=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(c);if("all"==t)v&&(f=f.concat(f.filter(ht).map((function(e){return vt(e,v)}))));else if("two"==t)f=f.slice(0,1),v&&(f=f.concat(f.filter(ht).map((function(e){return vt(e,v)}))));else if("one"==t){var h=s(f=f.slice(0,1),1)[0];v&&ht(h)&&(f=[vt(h,v)])}else"none"==t&&(f=[{name:"*",penalty:3}],v&&(f=[vt(f[0],v)]));try{for(var p=(e=void 0,i(f)),g=p.next();!g.done;g=p.next()){(h=g.value).level=u}}catch(t){e={error:t}}finally{try{g&&!g.done&&(l=p.return)&&l.call(p)}finally{if(e)throw e.error}}if(o.push(f),o.length>=ot.seedMinLength&&(r=ut(o,n)))return"break";c=c.parentElement,u++};c;){if("break"===l())break}return r||(r=ut(o,n)),!r&&n?n():r}function ut(e,t){var n,r,o=mt(yt(e));if(o.length>ot.threshold)return t?t():null;try{for(var s=i(o),a=s.next();!a.done;a=s.next()){var c=a.value;if(ft(c))return c}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return null}function lt(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var o=e[r].level||0;n=t.level===o-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function dt(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function ft(e){var t=lt(e);switch(it.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function vt(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function ht(e){return"html"!==e.name&&!e.name.startsWith("#")}function pt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(gt);return n.length>0?n:null}function gt(e){return null!=e}function yt(e,t){var n,r,s,a,c,u;return void 0===t&&(t=[]),o(this,(function(o){switch(o.label){case 0:if(!(e.length>0))return[3,9];o.label=1;case 1:o.trys.push([1,6,7,8]),n=i(e[0]),r=n.next(),o.label=2;case 2:return r.done?[3,5]:(s=r.value,[5,i(yt(e.slice(1,e.length),t.concat(s)))]);case 3:o.sent(),o.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return a=o.sent(),c={error:a},[3,8];case 7:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(c)throw c.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:o.sent(),o.label=11;case 11:return[2]}}))}function mt(e){return a([],s(e),!1).sort((function(e,t){return dt(e)-dt(t)}))}function bt(e,t,n){var r,c,u;return void 0===n&&(n={counter:0,visited:new Map}),o(this,(function(o){switch(o.label){case 0:if(!(e.length>2&&e.length>ot.optimizedMinLength))return[3,5];r=1,o.label=1;case 1:return r<e.length-1?n.counter>ot.maxNumberOfTries?[2]:(n.counter+=1,(c=a([],s(e),!1)).splice(r,1),u=lt(c),n.visited.has(u)?[2]:ft(c)&&function(e,t){return it.querySelector(lt(e))===t}(c,t)?[4,c]:[3,4]):[3,5];case 2:return o.sent(),n.visited.set(u,!0),[5,i(bt(c,t,n))];case 3:o.sent(),o.label=4;case 4:return r++,[3,1];case 5:return[2]}}))}var St=function(e){var t=e.version,n=e.events,r=[];return n.forEach((function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&r.push(t)})),{version:t,events:r}},wt=function(e){var t=e.version,r=e.events,o=[];r.forEach((function(e){var t=JSON.parse(e);"click"===t.type&&o.push(t)}));var i=o.reduce((function(e,t){var r=t.x,o=t.y,i=t.selector,s=t.timestamp,a=s-s%36e5,c="".concat(r,":").concat(o,":").concat(null!=i?i:"",":").concat(a);return e[c]?e[c].count+=1:e[c]=n(n({},t),{timestamp:a,count:1}),e}),{});return{version:t,events:Object.values(i)}},It=function(e,t){var n=t.eventsManager,r=t.sessionId,o=t.deviceIdFn,i=t.mirror,s=t.ugcFilterRules;return function(t){if(t.type===ee.Click){var a=f();if(a){var c=a.location,u=a.innerHeight,l=a.innerWidth;if(c){var d=t.x,v=t.y;if(void 0!==d&&void 0!==v){var h,p=i.getNode(t.id);if(p)try{h=at(p)}catch(t){e.debug("error resolving selector from finder")}var g=function(e){var t,n,r,o,i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:i.documentElement.scrollLeft||(null==i?void 0:i.body)&&(null===(t=tt.parentElement(i.body))||void 0===t?void 0:t.scrollLeft)||(null===(n=null==i?void 0:i.body)||void 0===n?void 0:n.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==i?void 0:i.documentElement.scrollTop)||(null==i?void 0:i.body)&&(null===(r=tt.parentElement(i.body))||void 0===r?void 0:r.scrollTop)||(null===(o=null==i?void 0:i.body)||void 0===o?void 0:o.scrollTop)||0}}(a),y={x:d+g.left,y:v+g.top,selector:h,viewportHeight:u,viewportWidth:l,pageUrl:Z(c.href,s),timestamp:Date.now(),type:"click"},m=o();m&&n.addEvent({sessionId:r,event:{type:"interaction",data:JSON.stringify(y)},deviceId:m})}}}}}},Ct=function(){function e(e,t){var n=f();n&&n.navigator&&"function"==typeof n.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(n.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var n=new XMLHttpRequest;return n.open("POST",e,!0),n.setRequestHeader("Accept","*/*"),n.send(JSON.stringify(t)),!0},this.basePageUrl=H(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e}return e.prototype.send=function(e,t){var n=this.context,r=n.sessionId,o=n.type,i=new URLSearchParams({device_id:e,session_id:String(r),type:String(o),api_key:this.apiKey}),s="".concat(this.basePageUrl,"?").concat(i.toString());this.sendBeacon(s,t)||this.sendXhr(s,t)},e}(),Et=function(){function e(e,t){var n=this;this.timestamp=Date.now(),this.hook=function(e){n.update(e)},this.send=function(e){return function(t){var r,o,i=e(),s=f();s&&i&&n.transport.send(i,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHeight:nt(),viewportWidth:rt(),pageUrl:Z(s.location.href,null!==(o=null===(r=n.config.interactionConfig)||void 0===r?void 0:r.ugcFilterRules)&&void 0!==o?o:[]),timestamp:n.timestamp,type:"scroll"}]})}},this._maxScrollX=0,this._maxScrollY=0,this._maxScrollWidth=rt(),this._maxScrollHeight=nt(),this.config=t,this.transport=e}return e.default=function(t,n){return new e(new Ct(t,n),n)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(e.x>this._maxScrollX){var n=rt();this._maxScrollX=e.x;var r=e.x+n;r>this._maxScrollWidth&&(this._maxScrollWidth=r),this.timestamp=t}if(e.y>this._maxScrollY){var o=nt();this._maxScrollY=e.y;var i=e.y+o;i>this._maxScrollHeight&&(this._maxScrollHeight=i),this.timestamp=t}},e}(),xt=function(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId=function(e,t){return"".concat(t,"/").concat(e)}(t,n))},kt=Uint8Array,_t=Uint16Array,Pt=Uint32Array,Rt=new kt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ot=new kt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Tt=new kt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lt=function(e,t){for(var n=new _t(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new Pt(n[30]);for(r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)o[i]=i-n[r]<<5|r;return[n,o]},Dt=Lt(Rt,2),qt=Dt[0],Mt=Dt[1];qt[28]=258,Mt[258]=28;for(var Nt=Lt(Ot,0)[1],jt=new _t(32768),Ut=0;Ut<32768;++Ut){var Bt=(43690&Ut)>>>1|(21845&Ut)<<1;Bt=(61680&(Bt=(52428&Bt)>>>2|(13107&Bt)<<2))>>>4|(3855&Bt)<<4,jt[Ut]=((65280&Bt)>>>8|(255&Bt)<<8)>>>1}var Ft=function(e,t,n){for(var r=e.length,o=0,i=new _t(t);o<r;++o)++i[e[o]-1];var s,a=new _t(t);for(o=0;o<t;++o)a[o]=a[o-1]+i[o-1]<<1;if(n){s=new _t(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var u=o<<4|e[o],l=t-e[o],d=a[e[o]-1]++<<l,f=d|(1<<l)-1;d<=f;++d)s[jt[d]>>>c]=u}else for(s=new _t(r),o=0;o<r;++o)s[o]=jt[a[e[o]-1]++]>>>15-e[o];return s},At=new kt(288);for(Ut=0;Ut<144;++Ut)At[Ut]=8;for(Ut=144;Ut<256;++Ut)At[Ut]=9;for(Ut=256;Ut<280;++Ut)At[Ut]=7;for(Ut=280;Ut<288;++Ut)At[Ut]=8;var Wt=new kt(32);for(Ut=0;Ut<32;++Ut)Wt[Ut]=5;var Kt=Ft(At,9,0),zt=Ft(Wt,5,0),Qt=function(e){return(e/8|0)+(7&e&&1)},Gt=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof _t?_t:e instanceof Pt?Pt:kt)(n-t);return r.set(e.subarray(t,n)),r},Ht=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>>8},Zt=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},$t=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var o=n.length,i=n.slice();if(!o)return[new kt(0),0];if(1==o){var s=new kt(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],u=0,l=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=o-1;)a=n[n[u].f<n[d].f?u++:d++],c=n[u!=l&&n[u].f<n[d].f?u++:d++],n[l++]={s:-1,f:a.f+c.f,l:a,r:c};var f=i[0].s;for(r=1;r<o;++r)i[r].s>f&&(f=i[r].s);var v=new _t(f+1),h=Jt(n[l-1],v,0);if(h>t){r=0;var p=0,g=h-t,y=1<<g;for(i.sort((function(e,t){return v[t.s]-v[e.s]||e.f-t.f}));r<o;++r){var m=i[r].s;if(!(v[m]>t))break;p+=y-(1<<h-v[m]),v[m]=t}for(p>>>=g;p>0;){var b=i[r].s;v[b]<t?p-=1<<t-v[b]++-1:++r}for(;r>=0&&p;--r){var S=i[r].s;v[S]==t&&(--v[S],++p)}h=t}return[new kt(v),h]},Jt=function(e,t,n){return-1==e.s?Math.max(Jt(e.l,t,n+1),Jt(e.r,t,n+1)):t[e.s]=n},Xt=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new _t(++t),r=0,o=e[0],i=1,s=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==o&&a!=t)++i;else{if(!o&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(o),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(o);i=1,o=e[a]}return[n.subarray(0,r),t]},Vt=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Yt=function(e,t,n){var r=n.length,o=Qt(t+2);e[o]=255&r,e[o+1]=r>>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var i=0;i<r;++i)e[o+i+4]=n[i];return 8*(o+4+r)},en=function(e,t,n,r,o,i,s,a,c,u,l){Ht(t,l++,n),++o[256];for(var d=$t(o,15),f=d[0],v=d[1],h=$t(i,15),p=h[0],g=h[1],y=Xt(f),m=y[0],b=y[1],S=Xt(p),w=S[0],I=S[1],C=new _t(19),E=0;E<m.length;++E)C[31&m[E]]++;for(E=0;E<w.length;++E)C[31&w[E]]++;for(var x=$t(C,7),k=x[0],_=x[1],P=19;P>4&&!k[Tt[P-1]];--P);var R,O,T,L,D=u+5<<3,q=Vt(o,At)+Vt(i,Wt)+s,M=Vt(o,f)+Vt(i,p)+s+14+3*P+Vt(C,k)+(2*C[16]+3*C[17]+7*C[18]);if(D<=q&&D<=M)return Yt(t,l,e.subarray(c,c+u));if(Ht(t,l,1+(M<q)),l+=2,M<q){R=Ft(f,v,0),O=f,T=Ft(p,g,0),L=p;var N=Ft(k,_,0);Ht(t,l,b-257),Ht(t,l+5,I-1),Ht(t,l+10,P-4),l+=14;for(E=0;E<P;++E)Ht(t,l+3*E,k[Tt[E]]);l+=3*P;for(var j=[m,w],U=0;U<2;++U){var B=j[U];for(E=0;E<B.length;++E){var F=31&B[E];Ht(t,l,N[F]),l+=k[F],F>15&&(Ht(t,l,B[E]>>>5&127),l+=B[E]>>>12)}}}else R=Kt,O=At,T=zt,L=Wt;for(E=0;E<a;++E)if(r[E]>255){F=r[E]>>>18&31;Zt(t,l,R[F+257]),l+=O[F+257],F>7&&(Ht(t,l,r[E]>>>23&31),l+=Rt[F]);var A=31&r[E];Zt(t,l,T[A]),l+=L[A],A>3&&(Zt(t,l,r[E]>>>5&8191),l+=Ot[A])}else Zt(t,l,R[r[E]]),l+=O[r[E]];return Zt(t,l,R[256]),l+O[256]},tn=new Pt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nn=function(e,t,n,r,o){return function(e,t,n,r,o,i){var s=e.length,a=new kt(r+s+5*(1+Math.floor(s/7e3))+o),c=a.subarray(r,a.length-o),u=0;if(!t||s<8)for(var l=0;l<=s;l+=65535){var d=l+65535;d<s?u=Yt(c,u,e.subarray(l,d)):(c[l]=i,u=Yt(c,u,e.subarray(l,s)))}else{for(var f=tn[t-1],v=f>>>13,h=8191&f,p=(1<<n)-1,g=new _t(32768),y=new _t(p+1),m=Math.ceil(n/3),b=2*m,S=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<b)&p},w=new Pt(25e3),I=new _t(288),C=new _t(32),E=0,x=0,k=(l=0,0),_=0,P=0;l<s;++l){var R=S(l),O=32767&l,T=y[R];if(g[O]=T,y[R]=O,_<=l){var L=s-l;if((E>7e3||k>24576)&&L>423){u=en(e,c,0,w,I,C,x,k,P,l-P,u),k=E=x=0,P=l;for(var D=0;D<286;++D)I[D]=0;for(D=0;D<30;++D)C[D]=0}var q=2,M=0,N=h,j=O-T&32767;if(L>2&&R==S(l-j))for(var U=Math.min(v,L)-1,B=Math.min(32767,l),F=Math.min(258,L);j<=B&&--N&&O!=T;){if(e[l+q]==e[l+q-j]){for(var A=0;A<F&&e[l+A]==e[l+A-j];++A);if(A>q){if(q=A,M=j,A>U)break;var W=Math.min(j,A-2),K=0;for(D=0;D<W;++D){var z=l-j+D+32768&32767,Q=z-g[z]+32768&32767;Q>K&&(K=Q,T=z)}}}j+=(O=T)-(T=g[O])+32768&32767}if(M){w[k++]=268435456|Mt[q]<<18|Nt[M];var G=31&Mt[q],H=31&Nt[M];x+=Rt[G]+Ot[H],++I[257+G],++C[H],_=l+q,++E}else w[k++]=e[l],++I[e[l]]}}u=en(e,c,i,w,I,C,x,k,P,l-P,u)}return Gt(a,0,r+Qt(u)+o)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!o)};function rn(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var r=e,o=t,i=n.length,s=0;s!=i;){for(var a=Math.min(s+5552,i);s<a;++s)o+=r+=n[s];r%=65521,o%=65521}e=r,t=o},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+2*((255&e)<<23)}}}();n.p(e);var r,o,i,s=nn(e,t,2,4);return r=s,o=t.level,i=0==o?0:o<6?1:9==o?3:2,r[0]=120,r[1]=i<<6|(i?32-2*i:1),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(s,s.length-4,n.d()),s}const on=e=>{const t={...e,v:"v1"};return function(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var r=0;r<e.length;){var o=e[r++];o<128||t?n+=String.fromCharCode(o):o<224?n+=String.fromCharCode((31&o)<<6|63&e[r++]):o<240?n+=String.fromCharCode((15&o)<<12|(63&e[r++])<<6|63&e[r++]):(o=((15&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,n+=String.fromCharCode(55296|o>>10,56320|1023&o))}return n}(rn(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new kt(e.length+(e.length>>>1)),o=0,i=function(e){r[o++]=e},s=0;s<n;++s){if(o+5>r.length){var a=new kt(o+8+(n-s<<1));a.set(r),r=a}var c=e.charCodeAt(s);c<128||t?i(c):c<2048?(i(192|c>>>6),i(128|63&c)):c>55295&&c<57344?(i(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++s))>>>18),i(128|c>>>12&63),i(128|c>>>6&63),i(128|63&c)):(i(224|c>>>12),i(128|c>>>6&63),i(128|63&c))}return Gt(r,0,o)}(JSON.stringify(t))),!0)};var sn=function(){function e(e,t,n,r){var o,i,s,a=this;this.taskQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=on(e);return JSON.stringify(t)},this.addCompressedEventToManager=function(e,t){a.eventsManager&&a.deviceId&&a.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:a.deviceId})},this.addCompressedEvent=function(e,t){if(a.worker)a.worker.postMessage({event:e,sessionId:t});else{var n=a.compressEvent(e);a.addCompressedEventToManager(n,t)}},this.terminate=function(){var e;null===(e=a.worker)||void 0===e||e.terminate()};var c=f();this.canUseIdleCallback=c&&"requestIdleCallback"in c,this.eventsManager=e,this.config=t,this.deviceId=n,this.timeout=(null===(o=t.performanceConfig)||void 0===o?void 0:o.timeout)||2e3;var u=null!==(i={}.COMPRESSION_WEBWORKER_BODY)&&void 0!==i?i:r;if((null===(s=this.config.experimental)||void 0===s?void 0:s.useWebWorker)&&c&&c.Worker&&u){t.loggerProvider.log("[Experimental] Enabling web worker for compression");var l=new Worker(URL.createObjectURL(new Blob([u],{type:"application/javascript"})));l.onerror=function(e){t.loggerProvider.error(e)},l.onmessage=function(e){var t=e.data,n=t.compressedEvent,r=t.sessionId;a.addCompressedEventToManager(n,r)},this.worker=l}}return e.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback((function(t){e.processQueue(t)}),{timeout:this.timeout}))},e.prototype.enqueueEvent=function(e,t){var n;this.canUseIdleCallback&&(null===(n=this.config.performanceConfig)||void 0===n?void 0:n.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.taskQueue.push({event:e,sessionId:t}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,t))},e.prototype.processQueue=function(e){for(var t=this;this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var n=this.taskQueue.shift();if(n){var r=n.event,o=n.sessionId;this.addCompressedEvent(r,o)}}this.taskQueue.length>0?requestIdleCallback((function(e){t.processQueue(e)}),{timeout:this.timeout}):this.isProcessing=!1},e}(),an=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.pageLeaveFns=[],this.recordFunction=null,this.teardownEventListeners=function(t){var n=f();n&&(n.removeEventListener("blur",e.blurListener),n.removeEventListener("focus",e.focusListener),!t&&n.addEventListener("blur",e.blurListener),!t&&n.addEventListener("focus",e.focusListener),n.self&&"onpagehide"in n.self?(n.removeEventListener("pagehide",e.pageLeaveListener),!t&&n.addEventListener("pagehide",e.pageLeaveListener)):(n.removeEventListener("beforeunload",e.pageLeaveListener),!t&&n.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){e.recordEvents(!1)},this.pageLeaveListener=function(t){e.pageLeaveFns.forEach((function(e){e(t)}))},this.addCustomRRWebEvent=function(t,i,s){return void 0===i&&(i={}),void 0===s&&(s=!0),r(e,void 0,void 0,(function(){var e,r,a,c;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),e=void 0,(r=this.config)&&t!==q.METADATA?(e={config:J(r),version:ue},s?[4,$()]:[3,2]):[3,2];case 1:a=o.sent(),e=n(n({},a),e),o.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,n(n({},i),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return c=o.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",c),[3,4];case 4:return[2]}}))}))},this.stopRecordingEvents=function(){var t;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null===(t=e.networkObservers)||void 0===t||t.stop()}catch(t){var n=t;e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(n.toString()))}},this.loggerProvider=new F(new p)}return e.prototype.init=function(e,t){return v(this._init(e,t))},e.prototype._init=function(e,t){var n,i,c,u,l,d;return r(this,void 0,void 0,(function(){var r,v,h,g,y,m,b,S,w,I,C,E,x,k;return o(this,(function(o){switch(o.label){case 0:return this.loggerProvider=new F(t.loggerProvider||new p),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.identifiers=new xt({sessionId:t.sessionId,deviceId:t.deviceId}),r=this,[4,ae(e,t)];case 1:return r.joinedConfigGenerator=o.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig(this.identifiers.sessionId)];case 2:v=o.sent(),h=v.joinedConfig,g=v.localConfig,y=v.remoteConfig,this.config=h,this.setMetadata(t.sessionId,h,g,y,null===(n=t.version)||void 0===n?void 0:n.version,ue,null===(i=t.version)||void 0===i?void 0:i.type),t.sessionId&&(null===(c=this.config.interactionConfig)||void 0===c?void 0:c.enabled)&&(m=Et.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[m.send(this.getDeviceId.bind(this)).bind(m)],this.scrollHook=m.hook.bind(m)),b=[],"idb"!==(S=this.config.storeType)||(null===(u=f())||void 0===u?void 0:u.indexedDB)||(S="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(S," for event storage.")),o.label=3;case 3:return o.trys.push([3,5,,6]),[4,Qe({config:this.config,sessionId:this.identifiers.sessionId,type:"replay",storeType:S})];case 4:return w=o.sent(),b.push({name:"replay",manager:w}),[3,6];case 5:return I=o.sent(),k=I,this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(k.toString())),[3,6];case 6:if(!(null===(l=this.config.interactionConfig)||void 0===l?void 0:l.enabled))return[3,10];C=this.config.interactionConfig.batch?wt:St,o.label=7;case 7:return o.trys.push([7,9,,10]),[4,Qe({config:this.config,sessionId:this.identifiers.sessionId,type:"interaction",minInterval:null!==(d=this.config.interactionConfig.trackEveryNms)&&void 0!==d?d:3e4,maxInterval:6e4,payloadBatcher:C,storeType:S})];case 8:return E=o.sent(),b.push({name:"interaction",manager:E}),[3,10];case 9:return x=o.sent(),k=x,this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(k.toString())),[3,10];case 10:return this.eventsManager=new(Ge.bind.apply(Ge,a([void 0],s(b),!1))),this.eventCompressor&&this.eventCompressor.terminate(),this.eventCompressor=new sn(this.eventsManager,this.config,this.getDeviceId()),[4,this.initializeNetworkObservers()];case 11:return o.sent(),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),this.initialize(!0),[2]}}))}))},e.prototype.setSessionId=function(e,t){return v(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t){return r(this,void 0,void 0,(function(){var n,r,i;return o(this,(function(o){switch(o.label){case 0:return(n=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(n),r=t||this.getDeviceId(),this.identifiers=new xt({sessionId:e,deviceId:r}),this.joinedConfigGenerator&&n?[4,this.joinedConfigGenerator.generateJoinedConfig(this.identifiers.sessionId)]:[3,2];case 1:i=o.sent().joinedConfig,this.config=i,o.label=2;case 2:return this.recordEvents(),[2]}}))}))},e.prototype.getSessionReplayProperties=function(){var e,t=this.config,n=this.identifiers;if(!t||!n)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var r=this.getShouldRecord(),o={};return r&&((e={})[N]=n.sessionReplayId?n.sessionReplayId:null,o=e,t.debugMode&&(o[U]=JSON.stringify({appHash:G(t.apiKey).toString()}))),this.addCustomRRWebEvent(q.GET_SR_PROPS,{shouldRecord:r,eventProperties:o},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,o},e.prototype.sendEvents=function(e){var t,n=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),r=this.getDeviceId();this.eventsManager&&n&&r&&this.eventsManager.sendCurrentSequenceEvents({sessionId:n,deviceId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){var n;return o(this,(function(r){return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(n=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:n}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()]):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])}))}))},e.prototype.shouldOptOut=function(){var e,t,n,r;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=(r=this.config.instanceName,void 0===r&&(r="$default_instance"),O.getInstance(r)).identityStore.getIdentity().optOut);return void 0!==n?n:null===(t=this.config)||void 0===t?void 0:t.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e,t,n,r=(e=this.identifiers.sessionId,t=this.config.sampleRate,n=G(e.toString()),31*Math.abs(n)%1e6/1e6<t);return r||this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate.")),r},e.prototype.getBlockSelectors=function(){var e,t,n,r=null!==(n=null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.blockSelector)&&void 0!==n?n:[];if(0!==r.length)return r},e.prototype.getMaskTextSelectors=function(){var e,t,n,r;if("conservative"===(null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.defaultMaskLevel))return"*";var o=null===(r=null===(n=this.config)||void 0===n?void 0:n.privacyConfig)||void 0===r?void 0:r.maskSelector;return o||void 0},e.prototype.getRecordingPlugins=function(e){var t;return r(this,void 0,void 0,(function(){var n,r,i;return o(this,(function(o){switch(o.label){case 0:if(n=[],!(null===(t=null==e?void 0:e.console)||void 0===t?void 0:t.enabled))return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,import("./rrweb-plugin-console-record-min.js")];case 2:return r=o.sent().getRecordConsolePlugin,n.push(r({level:e.console.levels})),[3,4];case 3:return i=o.sent(),this.loggerProvider.warn("Failed to load console plugin:",i),[3,4];case 4:return[2,n.length>0?n:void 0]}}))}))},e.prototype.getRecordFunction=function(){return r(this,void 0,void 0,(function(){var e,t;return o(this,(function(n){switch(n.label){case 0:if(this.recordFunction)return[2,this.recordFunction];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,import("./rrweb-record-min.js")];case 2:return e=n.sent().record,this.recordFunction=e,[2,e];case 3:return t=n.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",t),[2,null];case 4:return[2]}}))}))},e.prototype.recordEvents=function(e){var t,n,i;return void 0===e&&(e=!0),r(this,void 0,void 0,(function(){var r,s,a,c,u,l,d,f,v,h,p,g,y,m=this;return o(this,(function(o){switch(o.label){case 0:return r=this.config,s=this.getShouldRecord(),a=null===(t=this.identifiers)||void 0===t?void 0:t.sessionId,s&&a&&r?(this.stopRecordingEvents(),[4,this.getRecordFunction()]):[2];case 1:return(c=o.sent())?[4,this.initializeNetworkObservers()]:[2];case 2:o.sent(),null===(n=this.networkObservers)||void 0===n||n.start((function(e){m.addCustomRRWebEvent(q.FETCH_REQUEST,e)})),u=r.privacyConfig,l=r.interactionConfig,d=r.loggingConfig,f=(null==l?void 0:l.enabled)?{mouseInteraction:this.eventsManager&&It(this.loggerProvider,{eventsManager:this.eventsManager,sessionId:a,deviceIdFn:this.getDeviceId.bind(this),mirror:c.mirror,ugcFilterRules:null!==(i=l.ugcFilterRules)&&void 0!==i?i:[]}),scroll:this.scrollHook}:{},v=(null==l?void 0:l.enabled)&&l.ugcFilterRules?l.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(a,".")),o.label=3;case 3:return o.trys.push([3,5,,6]),h=this,p=c,y={emit:function(e){if(m.shouldOptOut())return m.loggerProvider.log("Opting session ".concat(a," out of recording due to optOut config.")),m.stopRecordingEvents(),void m.sendEvents();e.type===Y.Meta&&(e.data.href=Z(e.data.href,v)),m.eventCompressor&&m.eventCompressor.enqueueEvent(e,a)},inlineStylesheet:r.shouldInlineStylesheet,hooks:f,maskAllInputs:!0,maskTextClass:B,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:r.applyBackgroundColorToBlockedElements,maskInputFn:Q("input",u),maskTextFn:Q("text",u),maskTextSelector:this.getMaskTextSelectors(),recordCanvas:!1,errorHandler:function(e){var t=e;if(t.message.includes("insertRule")&&t.message.includes("CSSStyleSheet"))throw t;if(t._external_)throw t;return m.loggerProvider.warn("Error while capturing replay: ",t.toString()),!0}},[4,this.getRecordingPlugins(d)];case 4:return h.recordCancelCallback=p.apply(void 0,[(y.plugins=o.sent(),y)]),this.addCustomRRWebEvent(q.DEBUG_INFO),e&&this.addCustomRRWebEvent(q.METADATA,this.metadata),[3,6];case 5:return g=o.sent(),this.loggerProvider.warn("Failed to initialize session replay:",g),[3,6];case 6:return[2]}}))}))},e.prototype.getDeviceId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.deviceId},e.prototype.getSessionId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.sessionId},e.prototype.flush=function(e){var t;return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,null===(t=this.eventsManager)||void 0===t?void 0:t.flush(e)]}))}))},e.prototype.shutdown=function(){this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},e.prototype.mapSDKType=function(e){return"plugin"===e?"@amplitude/plugin-session-replay-browser":"segment"===e?"@amplitude/segment-session-replay-plugin":null},e.prototype.setMetadata=function(e,t,n,r,o,i,s){var a=(null==e?void 0:e.toString())?G(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:n,remoteConfig:r,sessionId:e,hashValue:a,sampleRate:t.sampleRate,replaySDKType:this.mapSDKType(s),replaySDKVersion:o,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:i}},e.prototype.initializeNetworkObservers=function(){var e,t,n;return r(this,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:if(!(null===(n=null===(t=null===(e=this.config)||void 0===e?void 0:e.loggingConfig)||void 0===t?void 0:t.network)||void 0===n?void 0:n.enabled)||this.networkObservers)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,import("./observers-min.js")];case 2:return r=o.sent().NetworkObservers,this.networkObservers=new r,[3,4];case 3:return i=o.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",i),[3,4];case 4:return[2]}}))}))},e}(),cn=function(e){return function(){var t=e.config||X();return{logger:t.loggerProvider,logLevel:t.logLevel}}},un=function(){var e=new an;return{init:T(e.init.bind(e),"init",cn(e)),setSessionId:T(e.setSessionId.bind(e),"setSessionId",cn(e)),getSessionId:T(e.getSessionId.bind(e),"getSessionId",cn(e)),getSessionReplayProperties:T(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",cn(e)),flush:T(e.flush.bind(e),"flush",cn(e)),shutdown:T(e.shutdown.bind(e),"shutdown",cn(e))}}(),ln=un.init,dn=un.setSessionId,fn=un.getSessionId,vn=un.getSessionReplayProperties;un.flush,un.shutdown;const hn="amp_session_id",pn="Amplitude Session Replay Segment Plugin [Debug]:";function gn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var yn=function e(t,n){function r(e,r,o){if("undefined"!=typeof document){"number"==typeof(o=gn({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in o)o[s]&&(i+="; "+s,!0!==o[s]&&(i+="="+o[s].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+i}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},o=0;o<n.length;o++){var i=n[o].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(r[a]=t.read(s,a),e===a)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",gn({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,gn({},this.attributes,t))},withConverter:function(t){return e(gn({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});const mn=()=>{const e=fn()||yn.get(hn);if(e){const t=parseInt(e.toString(),10);if(isNaN(t))return;return t}},bn=(e,t)=>(yn.set(hn,e.toString()),dn(e,t).promise),Sn=(e,t)=>r(void 0,void 0,void 0,(function*(){const n=mn()||0;let r;e.event.integrations&&e.event.integrations["Actions Amplitude"]&&(r=e.event.integrations["Actions Amplitude"].session_id),r&&n<r&&(yield bn(r,t));const o=vn(),i=Object.assign(Object.assign({},o),e.event.properties);return e.updateEvent("properties",i),e})),wn="0.0.0-frustrationanalytics.0",In=({amplitudeApiKey:e,sessionReplayOptions:t,segmentInstance:n,enableWrapperDebug:o=!1})=>r(void 0,void 0,void 0,(function*(){let i,s=!1,a=null==t?void 0:t.deviceId;const c={name:"Session Replay Events",type:"enrichment",version:wn,isLoaded:()=>s,load:(n,c)=>r(void 0,void 0,void 0,(function*(){if(!a){const e=c.user();a=e.anonymousId()||void 0}const n=mn();o&&console.log(`${pn} initializing session replay with sessionId=${null!=n?n:"undefined"} and deviceId=${null!=a?a:"undefined"}`),i=ln(e,Object.assign(Object.assign({},t),{sessionId:n,deviceId:a||void 0,version:{type:"segment",version:wn}})).promise,yield i,s=!0})),track:e=>r(void 0,void 0,void 0,(function*(){return yield i,yield Sn(e,a)})),page:e=>r(void 0,void 0,void 0,(function*(){return yield i,yield Sn(e,a)})),identify:e=>r(void 0,void 0,void 0,(function*(){yield i;const t=mn();return t&&(o&&console.log(`${pn} calling setSessionId() with sessionId=${t} and deviceId=${null!=a?a:"undefined"}`),yield bn(t,a)),e}))};yield n.register(c)}));export{r as _,o as a,In as c,f as g};
|
|
2
|
+
//# sourceMappingURL=index-min.js.map
|
|
Binary file
|