@amplitude/plugin-session-replay-browser 1.1.6 → 1.1.7

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 +1 @@
1
- var sessionReplay=function(e){"use strict";var t=function(e,n){return t=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])},t(e,n)};function n(e,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=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,o,s,i=function(){return i=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},i.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}function c(e,t){var n,r,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),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(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"}(r||(r={})),function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(o||(o={})),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"}(s||(s={}));var l="https://api2.amplitude.com/2/httpapi",u="Amplitude Logger ",d=function(){function e(){this.logLevel=r.None}return e.prototype.disable=function(){this.logLevel=r.None},e.prototype.enable=function(e){void 0===e&&(e=r.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Verbose||console.log("".concat(u,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Warn||console.warn("".concat(u,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Error||console.error("".concat(u,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Debug||console.log("".concat(u,"[Debug]: ").concat(e.join(" ")))},e}(),h=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:r.Warn,loggerProvider:new d,optOut:!1,serverUrl:l,serverZone:o.US,useBatch:!1}},p=function(){function e(e){var t,n,r,o;this._optOut=!1;var s=h();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(o=e.useBatch)&&void 0!==o?o:s.useBatch,this.loggerProvider.enable(this.logLevel);var i=m(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=i.serverZone,this.serverUrl=i.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),f=function(e,t){return e===o.EU?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":l},m=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=h().serverZone),void 0===n&&(n=h().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:h().serverZone;return{serverZone:r,serverUrl:f(r,n)}},v=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},g=function(e,t,n,o,s){return void 0===s&&(s=null),function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var c=n(),l=c.logger,u=c.logLevel;if(u&&u<r.Debug||!u||!l)return e.apply(s,i);var d={type:"invoke public method",name:t,args:i,stacktrace:v(1),time:{start:(new Date).toISOString()},states:{}};o&&d.states&&(d.states.before=o());var h=e.apply(s,i);return h&&h.promise?h.promise.then((function(){o&&d.states&&(d.states.after=o()),d.time&&(d.time.end=(new Date).toISOString()),l.debug(JSON.stringify(d,null,2))})):(o&&d.states&&(d.states.after=o()),d.time&&(d.time.end=(new Date).toISOString()),l.debug(JSON.stringify(d,null,2))),h}},y=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,a,c,l,u,d,h,p,f,m,v,g,y,S,b,I,w,M;if("object"!=typeof e)return null;var C=e.code||0,k=this.buildStatus(C);switch(k){case s.Success:return{status:k,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 s.Invalid:return{status:k,statusCode:C,body:{error:null!==(o=e.error)&&void 0!==o?o:"",missingField:null!==(i=e.missing_field)&&void 0!==i?i:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(c=e.events_with_missing_fields)&&void 0!==c?c:{},eventsWithInvalidIdLengths:null!==(l=e.events_with_invalid_id_lengths)&&void 0!==l?l:{},epsThreshold:null!==(u=e.eps_threshold)&&void 0!==u?u:0,exceededDailyQuotaDevices:null!==(d=e.exceeded_daily_quota_devices)&&void 0!==d?d:{},silencedDevices:null!==(h=e.silenced_devices)&&void 0!==h?h:[],silencedEvents:null!==(p=e.silenced_events)&&void 0!==p?p:[],throttledDevices:null!==(f=e.throttled_devices)&&void 0!==f?f:{},throttledEvents:null!==(m=e.throttled_events)&&void 0!==m?m:[]}};case s.PayloadTooLarge:return{status:k,statusCode:C,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case s.RateLimit:return{status:k,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!==(S=e.throttled_devices)&&void 0!==S?S:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(M=e.throttled_events)&&void 0!==M?M:[]}};case s.Timeout:default:return{status:k,statusCode:C}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?s.Success:429===e?s.RateLimit:413===e?s.PayloadTooLarge:408===e?s.Timeout:e>=400&&e<500?s.Invalid:e>=500?s.Failed:s.Unknown},e}(),S=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:b(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),b=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}(),w=function(){return w=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},w.apply(this,arguments)},M=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var r=0,o=["string","number","boolean","undefined"];r<o.length;r++){if(o[r]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),i=Array.isArray(t);if(s!==i)return!1;if(!s||!i){var a=Object.keys(e).sort(),c=Object.keys(t).sort();if(!M(a,c))return!1;var l=!0;return Object.keys(e).forEach((function(n){M(e[n],t[n])||(l=!1)})),l}for(var u=0;u<e.length;u++)if(!M(e[u],t[u]))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 C,k=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=w({},this.identity.userProperties),n=w(w({},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){for(var t=n.userProperties||{},r=0,o=Object.entries(e);r<o.length;r++){var s=o[r],i=s[0],a=s[1];switch(i){case"$set":for(var c=0,l=Object.entries(a);c<l.length;c++){var u=l[c],d=u[0],h=u[1];t[d]=h}break;case"$unset":for(var p=0,f=Object.keys(a);p<f.length;p++){delete t[d=f[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return w({},this.identity)},e.prototype.setIdentity=function(e){var t=w({},this.identity);this.identity=w({},e),M(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}(),O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,E=function(){function e(){this.identityStore=new k,this.eventBridge=new I,this.applicationContextProvider=new S}return e.getInstance=function(t){return O.analyticsConnectorInstances||(O.analyticsConnectorInstances={}),O.analyticsConnectorInstances[t]||(O.analyticsConnectorInstances[t]=new e),O.analyticsConnectorInstances[t]},e}(),T=function(e){return void 0===e&&(e="$default_instance"),E.getInstance(e)},R=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},x=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,(function(){var n,r;return c(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,o.sent().json()];case 2:return r=o.sent(),[2,this.buildResponse(r)]}}))}))},t}(y),N="[Amplitude]",D="".concat(N," Session Replay ID"),L=o.US,_="".concat(N," Session Replay Debug"),A="".concat("AMP","_replay_unsent"),P={currentSequenceId:0,sessionSequences:{}},F=function(){return{flushMaxRetries:2,logLevel:r.Warn,loggerProvider:new d,transportProvider:new x}},U=function(e){function t(t,n){var r=this,o=F();return(r=e.call(this,i(i({transportProvider:o.transportProvider},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=o.flushMaxRetries?n.flushMaxRetries:o.flushMaxRetries,r.apiKey=t,r.sampleRate=n.sampleRate||0,r.serverZone=n.serverZone||L,n.privacyConfig&&(r.privacyConfig=n.privacyConfig),n.debugMode&&(r.debugMode=n.debugMode),r}return n(t,e),t}(p);function j(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function q(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function W(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t,z).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function z(e){var t,n,r;if(function(e){return"styleSheet"in e}(e))try{t=W(e.styleSheet)||function(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url(".concat(JSON.stringify(e.href),")")];return""===e.layerName?n.push("layer"):e.layerName&&n.push("layer(".concat(e.layerName,")")),e.supportsText&&n.push("supports(".concat(e.supportsText,")")),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return n=e.cssText,r=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,n.replace(r,"$1\\$2");return t||e.cssText}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(C||(C={}));var B=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function G(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,o=e.type,s=e.value,i=e.maskInputFn,a=s||"",c=o&&H(o);return(n[r.toLowerCase()]||c&&n[c])&&(a=i?i(a,t):"*".repeat(a.length)),a}function H(e){return e.toLowerCase()}var V="__rrweb_original__";function K(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?H(t):null}var Z,$,J=1,Y=new RegExp("[^a-z0-9-_:]");function X(){return J++}var Q=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ee=/^(?:[a-z+]+:)?\/\//i,te=/^www\..*/i,ne=/^(data:)([^,]*),(.*)/i;function re(e,t){return(e||"").replace(Q,(function(e,n,r,o,s,i){var a,c=r||s||i,l=n||o||"";if(!c)return e;if(ee.test(c)||te.test(c))return"url(".concat(l).concat(c).concat(l,")");if(ne.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var h=0,p=d;h<p.length;h++){var f=p[h];"."!==f&&(".."===f?u.pop():u.push(f))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var oe=/^[^ \t\n\r\u000c]+/,se=/^[, \t\n\r\u000c]+/;function ie(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function ae(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ce(){var e=document.createElement("a");return e.href="",e.href}function le(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?ie(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}for(var o=[];r(se),!(n>=t.length);){var s=r(oe);if(","===s.slice(-1))s=ie(e,s.substring(0,s.length-1)),o.push(s);else{var i="";s=ie(e,s);for(var a=!1;;){var c=t.charAt(n);if(""===c){o.push((s+i).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,o.push((s+i).trim());break}"("===c&&(a=!0)}i+=c,n+=1}}}return o.join(", ")}(e,r):"style"===n?re(r,ce()):"object"===t&&"data"===n?ie(e,r):r:ie(e,r):r}function ue(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function de(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&de(e.parentNode,t,n);for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return!!n&&de(e.parentNode,t,n)}function he(e,t,n){try{var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(r.closest(".".concat(t)))return!0}else if(de(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}}catch(e){}return!1}function pe(e,t){var n=t.doc,r=t.mirror,o=t.blockClass,s=t.blockSelector,i=t.maskTextClass,a=t.maskTextSelector,c=t.inlineStylesheet,l=t.maskInputOptions,u=void 0===l?{}:l,d=t.maskTextFn,h=t.maskInputFn,p=t.dataURLOptions,f=void 0===p?{}:p,m=t.inlineImages,v=t.recordCanvas,g=t.keepIframeSrcFn,y=t.newlyAddedElement,S=void 0!==y&&y,b=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:C.Document,childNodes:[],compatMode:e.compatMode}:{type:C.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:C.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.blockClass,o=t.blockSelector,s=t.inlineStylesheet,i=t.maskInputOptions,a=void 0===i?{}:i,c=t.maskInputFn,l=t.dataURLOptions,u=void 0===l?{}:l,d=t.inlineImages,h=t.recordCanvas,p=t.keepIframeSrcFn,f=t.newlyAddedElement,m=void 0!==f&&f,v=t.rootId,g=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,o),y=function(e){if(e instanceof HTMLFormElement)return"form";var t=H(e.tagName);return Y.test(t)?"div":t}(e),S={},b=e.attributes.length,I=0;I<b;I++){var w=e.attributes[I];ue(y,w.name,w.value)||(S[w.name]=le(n,y,H(w.name),w.value))}if("link"===y&&s){var M=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),k=null;M&&(k=W(M)),k&&(delete S.rel,delete S.href,S._cssText=re(k,M.href))}if("style"===y&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(k=W(e.sheet))&&(S._cssText=re(k,ce()))}if("input"===y||"textarea"===y||"select"===y){var O=e.value,E=e.checked;if("radio"!==S.type&&"checkbox"!==S.type&&"submit"!==S.type&&"button"!==S.type&&O){var T=K(e);S.value=G({element:e,type:T,tagName:y,value:O,maskInputOptions:a,maskInputFn:c})}else E&&(S.checked=E)}"option"===y&&(e.selected&&!a.select?S.selected=!0:delete S.selected);if("canvas"===y&&h)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var o=t.getImageData,s=V in o?o[V]:o;if(new Uint32Array(s.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(e)||(S.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var R=e.toDataURL(u.type,u.quality),x=document.createElement("canvas");x.width=e.width,x.height=e.height,R!==x.toDataURL(u.type,u.quality)&&(S.rr_dataURL=R)}if("img"===y&&d){Z||(Z=n.createElement("canvas"),$=Z.getContext("2d"));var N=e,D=N.crossOrigin;N.crossOrigin="anonymous";var L=function(){N.removeEventListener("load",L);try{Z.width=N.naturalWidth,Z.height=N.naturalHeight,$.drawImage(N,0,0),S.rr_dataURL=Z.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(N.currentSrc,"! Error: ").concat(e))}D?S.crossOrigin=D:N.removeAttribute("crossorigin")};N.complete&&0!==N.naturalWidth?L():N.addEventListener("load",L)}"audio"!==y&&"video"!==y||(S.rr_mediaState=e.paused?"paused":"played",S.rr_mediaCurrentTime=e.currentTime);m||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop));if(g){var _=e.getBoundingClientRect(),A=_.width,P=_.height;S={class:S.class,rr_width:"".concat(A,"px"),rr_height:"".concat(P,"px")}}"iframe"!==y||p(S.src)||(e.contentDocument||(S.rr_src=S.src),delete S.src);return{type:C.Element,tagName:y,attributes:S,childNodes:[],isSVG:ae(e)||void 0,needBlock:g,rootId:v}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:f,inlineImages:m,recordCanvas:v,keepIframeSrcFn:g,newlyAddedElement:S,rootId:b});case e.TEXT_NODE:return function(e,t){var n,r=t.maskTextClass,o=t.maskTextSelector,s=t.maskTextFn,i=t.rootId,a=e.parentNode&&e.parentNode.tagName,c=e.textContent,l="STYLE"===a||void 0,u="SCRIPT"===a||void 0;if(l&&c){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(c=W(e.parentNode.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=re(c,ce())}u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&he(e,r,o)&&(c=s?s(c,e.parentElement):c.replace(/[\S]/g,"*"));return{type:C.Text,textContent:c||"",isStyle:l,rootId:i}}(e,{maskTextClass:i,maskTextSelector:a,maskTextFn:d,rootId:b});case e.CDATA_SECTION_NODE:return{type:C.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:C.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function fe(e){return null==e?"":e.toLowerCase()}function me(e,t){var n,r=t.doc,o=t.mirror,s=t.blockClass,i=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,d=t.inlineStylesheet,h=void 0===d||d,p=t.maskInputOptions,f=void 0===p?{}:p,m=t.maskTextFn,v=t.maskInputFn,g=t.slimDOMOptions,y=t.dataURLOptions,S=void 0===y?{}:y,b=t.inlineImages,I=void 0!==b&&b,w=t.recordCanvas,M=void 0!==w&&w,k=t.onSerialize,O=t.onIframeLoad,E=t.iframeLoadTimeout,T=void 0===E?5e3:E,R=t.onStylesheetLoad,x=t.stylesheetLoadTimeout,N=void 0===x?5e3:x,D=t.keepIframeSrcFn,L=void 0===D?function(){return!1}:D,_=t.newlyAddedElement,A=void 0!==_&&_,P=t.preserveWhiteSpace,F=void 0===P||P,U=pe(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,dataURLOptions:S,inlineImages:I,recordCanvas:M,keepIframeSrcFn:L,newlyAddedElement:A});if(!U)return console.warn(e,"not serialized"),null;n=o.hasNode(e)?o.getId(e):!function(e,t){if(t.comment&&e.type===C.Comment)return!0;if(e.type===C.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(fe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===fe(e.attributes.name)||"icon"===fe(e.attributes.rel)||"apple-touch-icon"===fe(e.attributes.rel)||"shortcut icon"===fe(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&fe(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(fe(e.attributes.property).match(/^(og|twitter|fb):/)||fe(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===fe(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===fe(e.attributes.name)||"googlebot"===fe(e.attributes.name)||"bingbot"===fe(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===fe(e.attributes.name)||"generator"===fe(e.attributes.name)||"framework"===fe(e.attributes.name)||"publisher"===fe(e.attributes.name)||"progid"===fe(e.attributes.name)||fe(e.attributes.property).match(/^article:/)||fe(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===fe(e.attributes.name)||"yandex-verification"===fe(e.attributes.name)||"csrf-token"===fe(e.attributes.name)||"p:domain_verify"===fe(e.attributes.name)||"verify-v1"===fe(e.attributes.name)||"verification"===fe(e.attributes.name)||"shopify-checkout-api-token"===fe(e.attributes.name)))return!0}}return!1}(U,g)&&(F||U.type!==C.Text||U.isStyle||U.textContent.replace(/^\s+|\s+$/gm,"").length)?X():-2;var W=Object.assign(U,{id:n});if(o.add(e,W),-2===n)return null;k&&k(e);var z=!u;if(W.type===C.Element){z=z&&!W.needBlock,delete W.needBlock;var B=e.shadowRoot;B&&q(B)&&(W.isShadowHost=!0)}if((W.type===C.Document||W.type===C.Element)&&z){g.headWhitespace&&W.type===C.Element&&"head"===W.tagName&&(F=!1);for(var G={doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L},H=0,V=Array.from(e.childNodes);H<V.length;H++){($=me(V[H],G))&&W.childNodes.push($)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var K=0,Z=Array.from(e.shadowRoot.childNodes);K<Z.length;K++){var $;($=me(Z[K],G))&&(q(e.shadowRoot)&&($.isShadow=!0),W.childNodes.push($))}}return e.parentNode&&j(e.parentNode)&&q(e.parentNode)&&(W.isShadow=!0),W.type===C.Element&&"iframe"===W.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"===o){var i="about:blank";if(r.location.href!==i||e.src===i||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout((function(){s||(t(),s=!0)}),n);e.addEventListener("load",(function(){clearTimeout(a),s=!0,t()}))}}}(e,(function(){var t=e.contentDocument;if(t&&O){var n=me(t,{doc:t,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L});n&&O(e,n)}}),T),W.type===C.Element&&"link"===W.tagName&&"stylesheet"===W.attributes.rel&&function(e,t,n){var r,o=!1;try{r=e.sheet}catch(e){return}if(!r){var s=setTimeout((function(){o||(t(),o=!0)}),n);e.addEventListener("load",(function(){clearTimeout(s),o=!0,t()}))}}(e,(function(){if(R){var t=me(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L});t&&R(e,t)}}),N),W}var ve=(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))(ve||{}),ge=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(ge||{}),ye=(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))(ye||{}),Se=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Se||{}),be=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(be||{});function Ie(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const we="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Me={map:{},getId:()=>(console.error(we),-1),getNode:()=>(console.error(we),null),removeNodeFromMap(){console.error(we)},has:()=>(console.error(we),!1),reset(){console.error(we)}};function Ce(e,t,n={}){let r=null,o=0;return function(...s){const i=Date.now();o||!1!==n.leading||(o=i);const a=t-(i-o),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),o=i,e.apply(c,s)):r||!1===n.trailing||(r=setTimeout((()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(c,s)}),a))}}function ke(e,t,n,r,o=window){const s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>ke(e,t,s||{},!0)}function Oe(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch(e){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Me=new Proxy(Me,{get:(e,t,n)=>("map"===t&&console.error(we),Reflect.get(e,t,n))}));let Ee,Te=Date.now;function Re(e){var t,n,r,o,s,i;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null===(n=null===(t=null==a?void 0:a.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==a?void 0:a.body)||void 0===r?void 0:r.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null===(s=null===(o=null==a?void 0:a.body)||void 0===o?void 0:o.parentElement)||void 0===s?void 0:s.scrollTop)||(null===(i=null==a?void 0:a.body)||void 0===i?void 0:i.scrollTop)||0}}function xe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ne(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function De(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function Le(e,t,n,r){if(!e)return!1;const o=De(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(de(o,t,r))return!0}catch(e){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1}function _e(e,t){return-2===t.getId(e)}function Ae(e,t){if(j(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Ae(e.parentNode,t))}function Pe(e){return Boolean(e.changedTouches)}function Fe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ue(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function je(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Te=()=>(new Date).getTime());class qe{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function We(e){var t,n;let r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function ze(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=We(n);)n=t;return n}(e);return t.contains(n)}function Be(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||ze(e))}function Ge(e){Ee=e}function He(){Ee=void 0}const Ve=e=>{if(!Ee)return e;return(...t)=>{try{return e(...t)}catch(e){if(Ee&&!0===Ee(e))return;throw e}}};class Ke{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),s=r||this.getRemoteIdToIdMap(e);let i=o.get(t);return i||(i=this.generateIdFn(),o.set(t,i),s.set(i,t)),i}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,r)))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const o=r.get(t);return o||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Ze{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ke(X),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ke(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case ve.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:ve.IncrementalSnapshot,data:{source:ge.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ve.Meta:case ve.Load:case ve.DomContentLoaded:return!1;case ve.Plugin:return t;case ve.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case ve.IncrementalSnapshot:switch(t.data.source){case ge.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case ge.Drag:case ge.TouchMove:case ge.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case ge.ViewportResize:return!1;case ge.MediaInteraction:case ge.MouseInteraction:case ge.Scroll:case ge.CanvasMutation:case ge.Input:return this.replaceIds(t.data,e,["id"]),t;case ge.StyleSheetRule:case ge.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ge.Font:return t;case ge.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case ge.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(n,t[o]):t[o]=e.getId(n,t[o]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===C.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}function $e(e){return"__ln"in e}class Je{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$e(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&$e(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Ye=(e,t)=>`${e}@${t}`;class Xe{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new Je,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{if(!o.parentNode||!Be(o))return;const s=j(o.parentNode)?this.mirror.getId(We(o)):this.mirror.getId(o.parentNode),i=r(o);if(-1===s||-1===i)return n.addNode(o);const a=me(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Fe(e,this.mirror)&&this.iframeManager.addIframe(e),Ue(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),je(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});a&&(e.push({parentId:s,nextId:i,node:a}),t.add(a.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)et(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)nt(this.droppedSet,e)||et(this.removes,e,this.mirror)?nt(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;n.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),n=r(s.value);-1!==t&&-1!==n&&(e=s)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}s=e.previous,n.removeNode(e.value),o(e.value)}const i={texts:this.texts.map((e=>({id:this.mirror.getId(e.node),value:e.value}))).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(i.texts.length||i.attributes.length||i.removes.length||i.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(i))},this.processMutation=e=>{if(!_e(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;Le(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:he(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t,De(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=K(t);r=G({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(Le(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let o=this.attributes.find((t=>t.node===e.target));if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;n="rr_src"}if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!ue(t.tagName,n)&&(o.attributes[n]=le(this.doc,H(t.tagName),H(n),r),"style"===n)){let n;try{n=document.implementation.createHTMLDocument()}catch(e){n=this.doc}const r=n.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const n=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);n!==r.style.getPropertyValue(e)||s!==r.style.getPropertyPriority(e)?o.styleDiff[e]=""===s?n:[n,s]:o._unchangedStyles[e]=[n,s]}for(const e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(o.styleDiff[e]=!1)}break}case"childList":if(Le(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),r=j(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Le(e.target,this.blockClass,this.blockSelector,!1)||_e(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Qe(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Ae(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ye(n,r)]?Qe(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!j(e.target)||!q(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(_e(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Ye(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Le(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),je(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Qe(e,t){e.delete(t),t.childNodes.forEach((t=>Qe(e,t)))}function et(e,t,n){return 0!==e.length&&tt(e,t,n)}function tt(e,t,n){const{parentNode:r}=t;if(!r)return!1;const o=n.getId(r);return!!e.some((e=>e.id===o))||tt(e,r,n)}function nt(e,t){return 0!==e.size&&rt(e,t)}function rt(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||rt(e,n))}const ot=[];function st(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function it(e,t){var n,r;const o=new Xe;ot.push(o),o.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const i=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");i&&window[i]&&(s=window[i]);const a=new s(Ve(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function at({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const i=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,a=[];let c=null;return Object.keys(ye).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{let i=H(s);const l=(t=>s=>{const i=st(s);if(Le(i,r,o,!0))return;let a=null,l=t;if("pointerType"in s){switch(s.pointerType){case"mouse":a=Se.Mouse;break;case"touch":a=Se.Touch;break;case"pen":a=Se.Pen}a===Se.Touch?ye[t]===ye.MouseDown?l="TouchStart":ye[t]===ye.MouseUp&&(l="TouchEnd"):Se.Pen}else Pe(s)&&(a=Se.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===Se.Touch||l.startsWith("Mouse")&&a===Se.Mouse)&&(a=null)):ye[t]===ye.Click&&(a=c,c=null);const u=Pe(s)?s.changedTouches[0]:s;if(!u)return;const d=n.getId(i),{clientX:h,clientY:p}=u;Ve(e)(Object.assign({type:ye[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(s);if(window.PointerEvent)switch(ye[s]){case ye.MouseDown:case ye.MouseUp:i=i.replace("mouse","pointer");break;case ye.TouchStart:case ye.TouchEnd:return}a.push(Ie(i,l,t))})),Ve((()=>{a.forEach((e=>e()))}))}function ct({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){return Ie("scroll",Ve(Ce(Ve((s=>{const i=st(s);if(!i||Le(i,r,o,!0))return;const a=n.getId(i);if(i===t&&t.defaultView){const n=Re(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:i.scrollLeft,y:i.scrollTop})})),s.scroll||100)),t)}function lt(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const ut=["INPUT","TEXTAREA","SELECT"],dt=new WeakMap;function ht(e){return function(e,t){if(vt("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||vt("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||vt("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||vt("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function pt(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function ft({mirror:e,stylesheetManager:t},n){var r,o,s;let i=null;i="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(s=null===(o=n.ownerDocument)||void 0===o?void 0:o.defaultView)||void 0===s?void 0:s.ShadowRoot,c=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==i&&-1!==i&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const r=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==i&&-1!==i)try{t.adoptStyleSheets(e,i)}catch(e){}return r}}),Ve((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function mt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:i,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),o(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),i(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)}}(e,t),e.recordDOM&&(r=it(e,e.doc));const o=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const o="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let i,a=[];const c=Ce(Ve((t=>{const n=Date.now()-i;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],i=null})),s),l=Ve(Ce(Ve((e=>{const t=st(e),{clientX:n,clientY:o}=Pe(e)?e.changedTouches[0]:e;i||(i=Te()),a.push({x:n,y:o,id:r.getId(t),timeOffset:Te()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?ge.Drag:e instanceof MouseEvent?ge.MouseMove:ge.TouchMove)})),o,{trailing:!1})),u=[Ie("mousemove",l,n),Ie("touchmove",l,n),Ie("drag",l,n)];return Ve((()=>{u.forEach((e=>e()))}))}(e),s=at(e),i=ct(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return Ie("resize",Ve(Ce(Ve((()=>{const t=xe(),o=Ne();n===t&&r===o||(e({width:Number(o),height:Number(t)}),n=t,r=o)})),200)),t)}(e,{win:n}),c=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:s,ignoreSelector:i,maskInputOptions:a,maskInputFn:c,sampling:l,userTriggeredOnInput:u}){function d(e){let n=st(e);const l=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||ut.indexOf(d)<0||Le(n,r,o,!0))return;if(n.classList.contains(s)||i&&n.matches(i))return;let p=n.value,f=!1;const m=K(n)||"";"radio"===m||"checkbox"===m?f=n.checked:(a[d.toLowerCase()]||a[m])&&(p=G({element:n,maskInputOptions:a,tagName:d,type:m,value:p,maskInputFn:c})),h(n,Ve(lt)({text:p,isChecked:f,userTriggered:l},u));const v=n.name;"radio"===m&&v&&f&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach((e=>{e!==n&&h(e,Ve(lt)({text:e.value,isChecked:!f,userTriggered:!1},u))}))}function h(t,r){const o=dt.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){dt.set(t,r);const o=n.getId(t);Ve(e)(Object.assign(Object.assign({},r),{id:o}))}}const p=("last"===l.input?["change"]:["input","change"]).map((e=>Ie(e,Ve(d),t))),f=t.defaultView;if(!f)return()=>{p.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),v=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&p.push(...v.map((e=>ke(e[0],e[1],{set(){Ve(d)({target:this,isTrusted:!1})}},!1,f)))),Ve((()=>{p.forEach((e=>e()))}))}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){const i=Ve((s=>Ce(Ve((o=>{const i=st(o);if(!i||Le(i,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:u}=i;e({type:s,id:r.getId(i),currentTime:a,volume:c,muted:l,playbackRate:u})})),o.media||500))),a=[Ie("play",i(0),s),Ie("pause",i(1),s),Ie("seeked",i(2),s),Ie("volumechange",i(3),s),Ie("ratechange",i(4),s)];return Ve((()=>{a.forEach((e=>e()))}))}(e);let u=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Ve(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=pt(o,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:a}]}),r.apply(o,s)}))});const s=r.CSSStyleSheet.prototype.deleteRule;let i,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:i}]}),r.apply(o,s)}))}),r.CSSStyleSheet.prototype.replace&&(i=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:i}),r.apply(o,s)}))})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:i}),r.apply(o,s)}))}));const c={};gt("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(gt("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),gt("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),gt("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach((([r,o])=>{l[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(l[r].insertRule,{apply:Ve(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=pt(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:[...ht(o),a||0]}]}),r.apply(o,s)}))}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...ht(o),i]}]}),r.apply(o,s)}))})})),Ve((()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=s,i&&(r.CSSStyleSheet.prototype.replace=i),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),d=ft(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:Ve(((o,i,a)=>{var c;const[l,u,d]=a;if(n.has(l))return s.apply(i,[l,u,d]);const{id:h,styleId:p}=pt(null===(c=i.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:l,value:u,priority:d},index:ht(i.parentRule)}),o.apply(i,a)}))});const i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:Ve(((o,s,a)=>{var c;const[l]=a;if(n.has(l))return i.apply(s,[l]);const{id:u,styleId:d}=pt(null===(c=s.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,remove:{property:l},index:ht(s.parentRule)}),o.apply(s,a)}))}),Ve((()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i}))}(e,{win:n}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],o=new WeakMap,s=n.FontFace;n.FontFace=function(e,t,n){const r=new s(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const i=Oe(t.fonts,"add",(function(t){return function(n){return setTimeout(Ve((()=>{const t=o.get(n);t&&(e(t),o.delete(n))})),0),t.apply(this,[n])}}));return r.push((()=>{n.FontFace=s})),r.push(i),Ve((()=>{r.forEach((e=>e()))}))}(e)));const f=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let i=!0;const a=Ve((()=>{const e=t.getSelection();if(!e||i&&(null==e?void 0:e.isCollapsed))return;i=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const s=e.getRangeAt(t),{startContainer:i,startOffset:c,endContainer:l,endOffset:u}=s;Le(i,r,o,!0)||Le(l,r,o,!0)||a.push({start:n.getId(i),startOffset:c,end:n.getId(l),endOffset:u})}s({ranges:a})}));return a(),Ie("selectionchange",a)}(e),m=[];for(const t of e.plugins)m.push(t.observer(t.callback,n,t.options));return Ve((()=>{ot.forEach((e=>e.reset())),null==r||r.disconnect(),o(),s(),i(),a(),c(),l(),u(),d(),h(),p(),f(),m.forEach((e=>e()))}))}function vt(e){return void 0!==window[e]}function gt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}function yt(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}for(var St,bt,It,wt=(St=function(){!function(){function e(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),r=0;r<t.length;r++)n[t.charCodeAt(r)]=r;var o=function(e){var n,r=new Uint8Array(e),o=r.length,s="";for(n=0;n<o;n+=3)s+=t[r[n]>>2],s+=t[(3&r[n])<<4|r[n+1]>>4],s+=t[(15&r[n+1])<<2|r[n+2]>>6],s+=t[63&r[n+2]];return o%3==2?s=s.substring(0,s.length-1)+"=":o%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const s=new Map,i=new Map,a=self;a.onmessage=function(t){return e(this,void 0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:t.data.id});{const{id:n,bitmap:r,width:c,height:l,dataURLOptions:u}=t.data,d=function(t,n,r){return e(this,void 0,void 0,(function*(){const e=`${t}-${n}`;if("OffscreenCanvas"in globalThis){if(i.has(e))return i.get(e);const s=new OffscreenCanvas(t,n);s.getContext("2d");const a=yield s.convertToBlob(r),c=yield a.arrayBuffer(),l=o(c);return i.set(e,l),l}return""}))}(c,l,u),h=new OffscreenCanvas(c,l);h.getContext("2d").drawImage(r,0,0),r.close();const p=yield h.convertToBlob(u),f=p.type,m=yield p.arrayBuffer(),v=o(m);if(!s.has(n)&&(yield d)===v)return s.set(n,v),a.postMessage({id:n});if(s.get(n)===v)return a.postMessage({id:n});a.postMessage({id:n,type:f,base64:v,width:c,height:l}),s.set(n,v)}}))}}()},bt=null,function(e){return It=It||function(e,t){var n=function(e,t){var n=void 0===t?null:t,r=e.toString().split("\n");r.pop(),r.shift();for(var o=r[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,i=0,a=r.length;i<a;++i)r[i]=r[i].substring(o).replace(s,"$1use strict$2")+"\n";return n&&r.push("//# sourceMappingURL="+n+"\n"),r}(e,t),r=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(r)}(St,bt),new Worker(It,e)}),Mt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ct="undefined"==typeof Uint8Array?[]:new Uint8Array(256),kt=0;kt<Mt.length;kt++)Ct[Mt.charCodeAt(kt)]=kt;const Ot=new Map;const Et=(e,t,n)=>{if(!e||!xt(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=Ot.get(e);return n||(n=new Map,Ot.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let o=r.indexOf(e);return-1===o&&(o=r.length,r.push(e)),o};function Tt(e,t,n){if(e instanceof Array)return e.map((e=>Tt(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),r=n.length,o="";for(t=0;t<r;t+=3)o+=Mt[n[t]>>2],o+=Mt[(3&n[t])<<4|n[t+1]>>4],o+=Mt[(15&n[t+1])<<2|n[t+2]>>6],o+=Mt[63&n[t+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Tt(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Tt(e.data,t,n),e.width,e.height]}}if(xt(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Et(e,t,n)}}return e}const Rt=(e,t,n)=>[...e].map((e=>Tt(e,t,n))),xt=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function Nt(e,t,n,r){const o=[];try{const s=Oe(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...s){if(!Le(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(o);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(s[0]&&"object"==typeof s[0]){const e=s[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[o,...s])}}));o.push(s)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach((e=>e()))}}function Dt(e,t,n,r,o,s,i){const a=[],c=Object.getOwnPropertyNames(e);for(const s of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const c=Oe(e,s,(function(e){return function(...a){const c=e.apply(this,a);if(Et(c,i,this),"tagName"in this.canvas&&!Le(this.canvas,r,o,!0)){const e=Rt([...a],i,this),r={type:t,property:s,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const o=ke(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(o)}return a}class Lt{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:r,blockSelector:o,recordCanvas:s,dataURLOptions:i}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(n,r,o),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,o,{dataURLOptions:i})}initCanvasFPSObserver(e,t,n,r,o){const s=Nt(t,n,r,!0),i=new Map,a=new wt;a.onmessage=e=>{const{id:t}=e.data;if(i.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:o,height:s}=e.data;this.mutationCb({id:t,type:be["2D"],commands:[{property:"clearRect",args:[0,0,o,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let l,u=0;const d=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{Le(t,n,r,!0)||e.push(t)})),e})().forEach((e=>yt(this,void 0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(i.get(n))return;if(i.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=yield createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:o.dataURLOptions},[r])}))))),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{s(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=Nt(e,t,n,!1),o=function(e,t,n,r){const o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const i of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[i])continue;const s=Oe(t.CanvasRenderingContext2D.prototype,i,(function(o){return function(...s){return Le(this.canvas,n,r,!0)||setTimeout((()=>{const n=Rt([...s],t,this);e(this.canvas,{type:be["2D"],property:i,args:n})}),0),o.apply(this,s)}}));o.push(s)}catch(n){const r=ke(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:be["2D"],property:i,args:[t],setter:!0})}});o.push(r)}return()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),s=function(e,t,n,r,o){const s=[];return s.push(...Dt(t.WebGLRenderingContext.prototype,be.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&s.push(...Dt(t.WebGL2RenderingContext.prototype,be.WebGL2,e,n,r,0,t)),()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map((e=>{const t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["type"]);return t})),{type:o}=n[0];this.mutationCb({id:t,type:o,commands:r}),this.pendingCanvasMutations.delete(e)}}class _t{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}class At{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!q(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=it(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(ct(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(ft({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(Oe(e.prototype,"attachShadow",(function(e){return function(r){const o=e.call(this,r);return this.shadowRoot&&Be(this)&&n.addShadowRoot(this.shadowRoot,t),o}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}class Pt{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new qe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:z(e),index:t})))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function Ft(e){return Object.assign(Object.assign({},e),{timestamp:Te()})}let Ut,jt,qt,Wt=!1;const zt=new B;function Bt(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:i="rr-ignore",ignoreSelector:a=null,maskTextClass:c="rr-mask",maskTextSelector:l=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:p,maskInputFn:f,maskTextFn:m,hooks:v,packFn:g,sampling:y={},dataURLOptions:S={},mousemoveWait:b,recordDOM:I=!0,recordCanvas:w=!1,recordCrossOriginIframes:M=!1,recordAfter:C=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:k=!1,collectFonts:O=!1,inlineImages:E=!1,plugins:T,keepIframeSrcFn:R=(()=>!1),ignoreCSSAttributes:x=new Set([]),errorHandler:N}=e;Ge(N);const D=!M||window.parent===window;let L=!1;if(!D)try{window.parent.document&&(L=!1)}catch(e){L=!0}if(D&&!t)throw new Error("emit function is required");void 0!==b&&void 0===y.mousemove&&(y.mousemove=b),zt.reset();const _=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==h?h:{password:!0},A=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p}:p||{};let P;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let F=0;const U=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return g&&!L&&(e=g(e)),e};Ut=(e,o)=>{var s;if(!(null===(s=ot[0])||void 0===s?void 0:s.isFrozen())||e.type===ve.FullSnapshot||e.type===ve.IncrementalSnapshot&&e.data.source===ge.Mutation||ot.forEach((e=>e.unfreeze())),D)null==t||t(U(e),o);else if(L){const t={type:"rrweb",event:U(e),origin:window.location.origin,isCheckout:o};window.parent.postMessage(t,"*")}if(e.type===ve.FullSnapshot)P=e,F=0;else if(e.type===ve.IncrementalSnapshot){if(e.data.source===ge.Mutation&&e.data.isAttachIframe)return;F++;const t=r&&F>=r,o=n&&e.timestamp-P.timestamp>n;(t||o)&&jt(!0)}};const j=e=>{Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Mutation},e)}))},q=e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Scroll},e)})),W=e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.CanvasMutation},e)})),z=new Pt({mutationCb:j,adoptedStyleSheetCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.AdoptedStyleSheet},e)}))}),G=new Ze({mirror:zt,mutationCb:j,stylesheetManager:z,recordCrossOriginIframes:M,wrappedEmit:Ut});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:zt,crossOriginIframeMirror:G.crossOriginIframeMirror,crossOriginIframeStyleMirror:G.crossOriginIframeStyleMirror});const H=new _t;qt=new Lt({recordCanvas:w,mutationCb:W,win:window,blockClass:o,blockSelector:s,mirror:zt,sampling:y.canvas,dataURLOptions:S});const V=new At({mutationCb:j,scrollCb:q,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:_,dataURLOptions:S,maskTextFn:m,maskInputFn:f,recordCanvas:w,inlineImages:E,sampling:y,slimDOMOptions:A,iframeManager:G,stylesheetManager:z,canvasManager:qt,keepIframeSrcFn:R,processedNodeManager:H},mirror:zt});jt=(e=!1)=>{if(!I)return;Ut(Ft({type:ve.Meta,data:{href:window.location.href,width:Ne(),height:xe()}}),e),z.reset(),V.init(),ot.forEach((e=>e.lock()));const t=function(e,t){var n=t||{},r=n.mirror,o=void 0===r?new B:r,s=n.blockClass,i=void 0===s?"rr-block":s,a=n.blockSelector,c=void 0===a?null:a,l=n.maskTextClass,u=void 0===l?"rr-mask":l,d=n.maskTextSelector,h=void 0===d?null:d,p=n.inlineStylesheet,f=void 0===p||p,m=n.inlineImages,v=void 0!==m&&m,g=n.recordCanvas,y=void 0!==g&&g,S=n.maskAllInputs,b=void 0!==S&&S,I=n.maskTextFn,w=n.maskInputFn,M=n.slimDOM,C=void 0!==M&&M,k=n.dataURLOptions,O=n.preserveWhiteSpace,E=n.onSerialize,T=n.onIframeLoad,R=n.iframeLoadTimeout,x=n.onStylesheetLoad,N=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return me(e,{doc:e,mirror:o,blockClass:i,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:f,maskInputOptions:!0===b?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===b?{password:!0}:b,maskTextFn:I,maskInputFn:w,slimDOMOptions:!0===C||"all"===C?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===C,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===C?{}:C,dataURLOptions:k,inlineImages:v,recordCanvas:y,preserveWhiteSpace:O,onSerialize:E,onIframeLoad:T,iframeLoadTimeout:R,onStylesheetLoad:x,stylesheetLoadTimeout:N,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:zt,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:_,maskTextFn:m,slimDOM:A,dataURLOptions:S,recordCanvas:w,inlineImages:E,onSerialize:e=>{Fe(e,zt)&&G.addIframe(e),Ue(e,zt)&&z.trackLinkElement(e),je(e)&&V.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{G.attachIframe(e,t),V.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:R});if(!t)return console.warn("Failed to snapshot the document");Ut(Ft({type:ve.FullSnapshot,data:{node:t,initialOffset:Re(window)}}),e),ot.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,zt.getId(document))};try{const e=[],t=e=>{var t;return Ve(mt)({mutationCb:j,mousemoveCb:(e,t)=>Ut(Ft({type:ve.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.MouseInteraction},e)})),scrollCb:q,viewportResizeCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.ViewportResize},e)})),inputCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Input},e)})),mediaInteractionCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.MediaInteraction},e)})),styleSheetRuleCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.StyleSheetRule},e)})),styleDeclarationCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.StyleDeclaration},e)})),canvasMutationCb:W,fontCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Font},e)})),selectionCb:e=>{Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Selection},e)}))},blockClass:o,ignoreClass:i,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:_,inlineStylesheet:u,sampling:y,recordDOM:I,recordCanvas:w,inlineImages:E,userTriggeredOnInput:k,collectFonts:O,doc:e,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:R,blockSelector:s,slimDOMOptions:A,dataURLOptions:S,mirror:zt,iframeManager:G,stylesheetManager:z,shadowDomManager:V,processedNodeManager:H,canvasManager:qt,ignoreCSSAttributes:x,plugins:(null===(t=null==T?void 0:T.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Ut(Ft({type:ve.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},v)};G.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{jt(),e.push(t(document)),Wt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Ie("DOMContentLoaded",(()=>{Ut(Ft({type:ve.DomContentLoaded,data:{}})),"DOMContentLoaded"===C&&n()}))),e.push(Ie("load",(()=>{Ut(Ft({type:ve.Load,data:{}})),"load"===C&&n()}),window))),()=>{e.forEach((e=>e())),H.destroy(),Wt=!1,He()}}catch(e){console.warn(e)}}var Gt,Ht;Bt.addCustomEvent=(e,t)=>{if(!Wt)throw new Error("please add custom event after start recording");Ut(Ft({type:ve.Custom,data:{tag:e,payload:t}}))},Bt.freezePage=()=>{ot.forEach((e=>e.freeze()))},Bt.takeFullSnapshot=e=>{if(!Wt)throw new Error("please take full snapshot after start recording");jt(e)},Bt.mirror=zt,function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(Gt||(Gt={})),function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Ht||(Ht={}));var Vt=Uint8Array,Kt=Uint16Array,Zt=Uint32Array,$t=new Vt([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]),Jt=new Vt([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]),Yt=new Vt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xt=function(e,t){for(var n=new Kt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new Zt(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return[n,o]},Qt=Xt($t,2),en=Qt[0],tn=Qt[1];en[28]=258,tn[258]=28;for(var nn=Xt(Jt,0)[1],rn=new Kt(32768),on=0;on<32768;++on){var sn=(43690&on)>>>1|(21845&on)<<1;sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4,rn[on]=((65280&sn)>>>8|(255&sn)<<8)>>>1}var an=function(e,t,n){for(var r=e.length,o=0,s=new Kt(t);o<r;++o)++s[e[o]-1];var i,a=new Kt(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;if(n){i=new Kt(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var l=o<<4|e[o],u=t-e[o],d=a[e[o]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)i[rn[d]>>>c]=l}else for(i=new Kt(r),o=0;o<r;++o)i[o]=rn[a[e[o]-1]++]>>>15-e[o];return i},cn=new Vt(288);for(on=0;on<144;++on)cn[on]=8;for(on=144;on<256;++on)cn[on]=9;for(on=256;on<280;++on)cn[on]=7;for(on=280;on<288;++on)cn[on]=8;var ln=new Vt(32);for(on=0;on<32;++on)ln[on]=5;var un=an(cn,9,0),dn=an(ln,5,0),hn=function(e){return(e/8>>0)+(7&e&&1)},pn=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Kt?Kt:e instanceof Zt?Zt:Vt)(n-t);return r.set(e.subarray(t,n)),r},fn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},mn=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},vn=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,s=n.slice();if(!o)return[new Vt(0),0];if(1==o){var i=new Vt(n[0].s+1);return i[n[0].s]=1,[i,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=o-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=s[0].s;for(r=1;r<o;++r)s[r].s>h&&(h=s[r].s);var p=new Kt(h+1),f=gn(n[u-1],p,0);if(f>t){r=0;var m=0,v=f-t,g=1<<v;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<o;++r){var y=s[r].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var S=s[r].s;p[S]<t?m-=1<<t-p[S]++-1:++r}for(;r>=0&&m;--r){var b=s[r].s;p[b]==t&&(--p[b],++m)}f=t}return[new Vt(p),f]},gn=function(e,t,n){return-1==e.s?Math.max(gn(e.l,t,n+1),gn(e.r,t,n+1)):t[e.s]=n},yn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Kt(++t),r=0,o=e[0],s=1,i=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==o&&a!=t)++s;else{if(!o&&s>2){for(;s>138;s-=138)i(32754);s>2&&(i(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(i(o),--s;s>6;s-=6)i(8304);s>2&&(i(s-3<<5|8208),s=0)}for(;s--;)i(o);s=1,o=e[a]}return[n.subarray(0,r),t]},Sn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},bn=function(e,t,n){var r=n.length,o=hn(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 s=0;s<r;++s)e[o+s+4]=n[s];return 8*(o+4+r)},In=function(e,t,n,r,o,s,i,a,c,l,u){fn(t,u++,n),++o[256];for(var d=vn(o,15),h=d[0],p=d[1],f=vn(s,15),m=f[0],v=f[1],g=yn(h),y=g[0],S=g[1],b=yn(m),I=b[0],w=b[1],M=new Kt(19),C=0;C<y.length;++C)M[31&y[C]]++;for(C=0;C<I.length;++C)M[31&I[C]]++;for(var k=vn(M,7),O=k[0],E=k[1],T=19;T>4&&!O[Yt[T-1]];--T);var R,x,N,D,L=l+5<<3,_=Sn(o,cn)+Sn(s,ln)+i,A=Sn(o,h)+Sn(s,m)+i+14+3*T+Sn(M,O)+(2*M[16]+3*M[17]+7*M[18]);if(L<=_&&L<=A)return bn(t,u,e.subarray(c,c+l));if(fn(t,u,1+(A<_)),u+=2,A<_){R=an(h,p,0),x=h,N=an(m,v,0),D=m;var P=an(O,E,0);fn(t,u,S-257),fn(t,u+5,w-1),fn(t,u+10,T-4),u+=14;for(C=0;C<T;++C)fn(t,u+3*C,O[Yt[C]]);u+=3*T;for(var F=[y,I],U=0;U<2;++U){var j=F[U];for(C=0;C<j.length;++C){var q=31&j[C];fn(t,u,P[q]),u+=O[q],q>15&&(fn(t,u,j[C]>>>5&127),u+=j[C]>>>12)}}}else R=un,x=cn,N=dn,D=ln;for(C=0;C<a;++C)if(r[C]>255){q=r[C]>>>18&31;mn(t,u,R[q+257]),u+=x[q+257],q>7&&(fn(t,u,r[C]>>>23&31),u+=$t[q]);var W=31&r[C];mn(t,u,N[W]),u+=D[W],W>3&&(mn(t,u,r[C]>>>5&8191),u+=Jt[W])}else mn(t,u,R[r[C]]),u+=x[r[C]];return mn(t,u,R[256]),u+x[256]},wn=new Zt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mn=new Vt(0),Cn=function(e,t,n,r,o){return function(e,t,n,r,o,s){var i=e.length,a=new Vt(r+i+5*(1+Math.floor(i/7e3))+o),c=a.subarray(r,a.length-o),l=0;if(!t||i<8)for(var u=0;u<=i;u+=65535){var d=u+65535;d<i?l=bn(c,l,e.subarray(u,d)):(c[u]=s,l=bn(c,l,e.subarray(u,i)))}else{for(var h=wn[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new Kt(32768),g=new Kt(m+1),y=Math.ceil(n/3),S=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<S)&m},I=new Zt(25e3),w=new Kt(288),M=new Kt(32),C=0,k=0,O=(u=0,0),E=0,T=0;u<i;++u){var R=b(u),x=32767&u,N=g[R];if(v[x]=N,g[R]=x,E<=u){var D=i-u;if((C>7e3||O>24576)&&D>423){l=In(e,c,0,I,w,M,k,O,T,u-T,l),O=C=k=0,T=u;for(var L=0;L<286;++L)w[L]=0;for(L=0;L<30;++L)M[L]=0}var _=2,A=0,P=f,F=x-N&32767;if(D>2&&R==b(u-F))for(var U=Math.min(p,D)-1,j=Math.min(32767,u),q=Math.min(258,D);F<=j&&--P&&x!=N;){if(e[u+_]==e[u+_-F]){for(var W=0;W<q&&e[u+W]==e[u+W-F];++W);if(W>_){if(_=W,A=F,W>U)break;var z=Math.min(F,W-2),B=0;for(L=0;L<z;++L){var G=u-F+L+32768&32767,H=G-v[G]+32768&32767;H>B&&(B=H,N=G)}}}F+=(x=N)-(N=v[x])+32768&32767}if(A){I[O++]=268435456|tn[_]<<18|nn[A];var V=31&tn[_],K=31&nn[A];k+=$t[V]+Jt[K],++w[257+V],++M[K],E=u+_,++C}else I[O++]=e[u],++w[e[u]]}}l=In(e,c,s,I,w,M,k,O,T,u-T,l),s||(l=bn(c,l,Mn))}return pn(a,0,r+hn(l)+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 kn(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var r=e,o=t,s=n.length,i=0;i!=s;){for(var a=Math.min(i+5552,s);i<a;++i)o+=r+=n[i];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=Cn(e,t,2,4);return function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)}(r,t),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(r,r.length-4,n.d()),r}const On=e=>{const t=Object.assign(Object.assign({},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}(kn(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Vt(e.length+(e.length>>>1)),o=0,s=function(e){r[o++]=e},i=0;i<n;++i){if(o+5>r.length){var a=new Vt(o+8+(n-i<<1));a.set(r),r=a}var c=e.charCodeAt(i);c<128||t?s(c):c<2048?(s(192|c>>>6),s(128|63&c)):c>55295&&c<57344?(s(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++i))>>>18),s(128|c>>>12&63),s(128|c>>>6&63),s(128|63&c)):(s(224|c>>>12),s(128|c>>>6&63),s(128|63&c))}return pn(r,0,o)}(JSON.stringify(t))),!0)};var En,Tn,Rn;function xn(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}let Nn;function Dn(){return Nn||(Nn=function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=xn(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}("keyval-store","keyval")),Nn}function Ln(e,t=Dn()){return t("readonly",(t=>xn(t.get(e))))}function _n(e,t,n=Dn()){return n("readwrite",(n=>new Promise(((r,o)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),r(xn(n.transaction))}catch(e){o(e)}}}))))}(Tn=En||(En={}))[Tn.NotStarted=0]="NotStarted",Tn[Tn.Running=1]="Running",Tn[Tn.Stopped=2]="Stopped",function(e){e.RECORDING="recording",e.SENT="sent"}(Rn||(Rn={}));var An="Session replay event batch rejected due to exceeded retry count",Pn="Failed to store session replay events in IndexedDB",Fn=function(e){var t=e.apiKey,n=e.loggerProvider,r=this;this.storageKey="",this.getAllSessionDataFromStore=function(){return a(r,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Ln(this.storageKey)];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(e)),[3,3];case 3:return[2,void 0]}}))}))},this.storeEventsForSession=function(e,t,n){return a(r,void 0,void 0,(function(){var r;return c(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,_n(this.storageKey,(function(r){var o,s;void 0===r&&(r={});var a=r[n]||i({},P);a.currentSequenceId=t;var c=a.sessionSequences&&a.sessionSequences[t]||{};return c.events=e,c.status=Rn.RECORDING,i(i({},r),((o={})[n]=i(i({},a),{sessionSequences:i(i({},a.sessionSequences),(s={},s[t]=c,s))}),o))}))];case 1:return o.sent(),[3,3];case 2:return r=o.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(r)),[3,3];case 3:return[2]}}))}))},this.cleanUpSessionEventsStore=function(e,t){return a(r,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,_n(this.storageKey,(function(n){void 0===n&&(n={});var r=n[e],o=(null==r?void 0:r.sessionSequences)&&r.sessionSequences[t];return o?(o.events=[],o.status=Rn.SENT,Object.entries(r.sessionSequences).forEach((function(e){var n=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}(e,2),o=n[0],s=n[1],i=parseInt(o,10);s.status===Rn.SENT&&t!==i&&delete r.sessionSequences[i]})),Object.keys(n).forEach((function(e){var t=parseInt(e,10);Date.now()-t>=2592e5&&delete n[t]})),n):n}))];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(n)),[3,3];case 3:return[2]}}))}))},this.loggerProvider=n,this.storageKey="".concat(A,"_").concat(t.substring(0,10))},Un=function(e,t){var n;return(null===(n=t.classList)||void 0===n?void 0:n.contains("amp-unmask"))?e:"*".repeat(e.length)},jn=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},qn=function(e,t){return"".concat(t,"/").concat(e)},Wn=function(){function e(e){var t=e.loggerProvider;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=t}return e.prototype.sendEventsList=function(e){this.addToQueue(i(i({},e),{attempts:0,timeout:0}))},e.prototype.getServerUrl=function(e){return e===o.STAGING?"https://api-sr.stag2.amplitude.com//sessions/v2/track":e===o.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track"},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.filter((function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"".concat(An,", batch sequence id, ").concat(t.sequenceId)}),!1)}));r.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),a(this,void 0,void 0,(function(){var t,n,r=this;return c(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){return void 0===t&&(t=!0),a(this,void 0,void 0,(function(){var n,r,o,s,i,a,l,u,d,h,p,f;return c(this,(function(c){switch(c.label){case 0:if(!(n=e.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(r=e.deviceId))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];m=R(),o=(null==m?void 0:m.location)?m.location.href:"",s="0.2.5",i=e.sampleRate,a=new URLSearchParams({device_id:r,session_id:"".concat(e.sessionId),seq_number:"".concat(e.sequenceId)}),l={version:1,events:e.events},c.label=1;case 1:return c.trys.push([1,3,,4]),u={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(n),"X-Client-Version":s,"X-Client-Url":o,"X-Client-Sample-Rate":"".concat(i)},body:JSON.stringify(l),method:"POST"},d="".concat(this.getServerUrl(e.serverZone),"?").concat(a.toString()),[4,fetch(d,u)];case 2:if(null===(h=c.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(h.status,e);else{p="";try{p=JSON.stringify(h.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(h.status,": ").concat(p)})}return[3,4];case 3:return f=c.sent(),this.completeRequest({context:e,err:f}),[3,4];case 4:return[2]}var m}))}))},e.prototype.handleReponse=function(e,t){switch((new y).buildStatus(e)){case s.Success:this.handleSuccessResponse(t);break;case s.Failed:this.handleOtherResponse(t);break;default:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"})}},e.prototype.handleSuccessResponse=function(e){var t;this.completeRequest({context:e,success:(t=e.sessionId,"Session replay event batch tracked successfully for session id ".concat(t))})},e.prototype.handleOtherResponse=function(e){this.addToQueue(i(i({},e),{timeout:e.attempts*this.retryTimeout}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(t.sessionId,t.sequenceId),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e}(),zn=function(){function e(e){var t=e.config,n=this;this.events=[],this.currentSequenceId=0,this.maxPersistedEventsSize=1e6,this.interval=500,this.timeAtLastSend=null,this.shouldSplitEventsList=function(e){var t=new Blob([e]).size;return new Blob(n.events).size+t>=n.maxPersistedEventsSize||!!(null!==n.timeAtLastSend&&Date.now()-n.timeAtLastSend>n.interval&&n.events.length)&&(n.interval=Math.min(1e4,n.interval+500),n.timeAtLastSend=Date.now(),!0)},this.config=t,this.trackDestination=new Wn({loggerProvider:this.config.loggerProvider}),this.sessionIDBStore=new Fn({loggerProvider:this.config.loggerProvider,apiKey:this.config.apiKey})}return e.prototype.initialize=function(e){var t=e.sessionId,n=e.deviceId,r=e.shouldSendStoredEvents,o=void 0!==r&&r;return a(this,void 0,void 0,(function(){var e,r,s,i;return c(this,(function(a){switch(a.label){case 0:return this.timeAtLastSend=Date.now(),[4,this.sessionIDBStore.getAllSessionDataFromStore()];case 1:return e=a.sent(),r=e&&e[t],e&&r&&r.sessionSequences&&(s=r.currentSequenceId,(i=r.sessionSequences[s])&&i.status!==Rn.RECORDING?(this.currentSequenceId=s+1,this.events=[]):(this.currentSequenceId=s,this.events=(null==i?void 0:i.events)||[])),o&&e&&this.sendStoredEvents({storedReplaySessions:e,deviceId:n,sessionId:t}),[2]}}))}))},e.prototype.sendStoredEvents=function(e){var t=e.storedReplaySessions,n=e.sessionId,r=e.deviceId;for(var o in t){var s=t[o].sessionSequences;for(var i in s){var a=s[i],c=parseInt(i,10),l=parseInt(o,10);l===n&&c===this.currentSequenceId||a.events&&a.events.length&&a.status===Rn.RECORDING&&this.sendEventsList({events:a.events,sequenceId:c,sessionId:l,deviceId:r})}}},e.prototype.resetSequence=function(){this.events=[],this.currentSequenceId=0},e.prototype.addEvent=function(e){var t=e.event,n=e.sessionId,r=e.deviceId;this.shouldSplitEventsList(t)&&(this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:n,deviceId:r}),this.events=[],this.currentSequenceId++),this.events.push(t),this.sessionIDBStore.storeEventsForSession(this.events,this.currentSequenceId,n)},e.prototype.sendEvents=function(e){var t=e.sessionId,n=e.deviceId;this.events.length&&t&&this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:t,deviceId:n})},e.prototype.sendEventsList=function(e){var t=e.events,n=e.sequenceId,r=e.sessionId,o=e.deviceId;this.trackDestination.sendEventsList({events:t,sequenceId:n,sessionId:r,flushMaxRetries:this.config.flushMaxRetries,apiKey:this.config.apiKey,deviceId:o,sampleRate:this.config.sampleRate,serverZone:this.config.serverZone,onComplete:this.sessionIDBStore.cleanUpSessionEventsStore.bind(this.sessionIDBStore)})},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){return c(this,(function(t){return this.trackDestination?[2,this.trackDestination.flush(e)]:[2]}))}))},e}(),Bn=function(e,t){this.deviceId=e.deviceId,this.sessionId=e.sessionId,e.sessionId&&e.deviceId?this.sessionReplayId=qn(e.sessionId,e.deviceId):t.error("Please provide both sessionId and deviceId.")},Gn=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.blurListener=function(){e.stopRecordingAndSendEvents()},this.focusListener=function(){e.initialize()},this.stopRecordingEvents=function(){try{e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null}catch(n){var t=n;e.loggerProvider.warn("Error occurred while stopping recording: ".concat(t.toString()))}},this.loggerProvider=new d}return e.prototype.init=function(e,t){return{promise:this._init(e,t)||Promise.resolve()}},e.prototype._init=function(e,t){return a(this,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return this.config=new U(e,t),this.loggerProvider=this.config.loggerProvider,this.identifiers=new Bn(t,this.loggerProvider),this.eventsManager=new zn({config:this.config}),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),(n=R())&&(n.removeEventListener("blur",this.blurListener),n.removeEventListener("focus",this.focusListener),n.addEventListener("blur",this.blurListener),n.addEventListener("focus",this.focusListener)),n&&n.document&&n.document.hasFocus()?[4,this.initialize(!0)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.prototype.setSessionId=function(e,t){if(this.identifiers){t&&(this.identifiers.deviceId=t);var n=this.getDeviceId();e&&n?(this.identifiers.sessionReplayId=qn(e,n),this.stopRecordingAndSendEvents(this.identifiers.sessionId),this.identifiers.sessionId=e,this.eventsManager&&this.eventsManager.resetSequence(),this.recordEvents()):this.loggerProvider.error("Must provide either session replay id or session id when starting a new session.")}else this.loggerProvider.error("Session replay init has not been called, cannot set session id.")},e.prototype.getSessionReplayDebugPropertyValue=function(){var e="";return this.config&&(e=jn(this.config.apiKey).toString()),JSON.stringify({appHash:e})},e.prototype.getSessionReplayProperties=function(){var e;if(!this.config||!this.identifiers)return this.loggerProvider.error("Session replay init has not been called, cannot get session recording properties."),{};var t=!!this.config.debugMode;if(this.getShouldRecord(t)){var n=((e={})[D]=this.identifiers.sessionReplayId?this.identifiers.sessionReplayId:null,e);return this.config.debugMode&&(n[_]=this.getSessionReplayDebugPropertyValue()),n}return{}},e.prototype.stopRecordingAndSendEvents=function(e){var t;this.stopRecordingEvents();var n=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),r=this.getDeviceId();this.eventsManager&&n&&r&&this.eventsManager.sendEvents({sessionId:n,deviceId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(n=this.getDeviceId(),this.eventsManager&&n?[4,this.eventsManager.initialize({sessionId:this.identifiers.sessionId,shouldSendStoredEvents:e,deviceId:n})]:[3,2]):(this.loggerProvider.warn("Session is not being recorded due to lack of session id."),[2]);case 1:r.sent(),r.label=2;case 2:return this.recordEvents(),[2]}}))}))},e.prototype.shouldOptOut=function(){var e,t,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=T(this.config.instanceName).identityStore.getIdentity().optOut);return void 0!==n?n:null===(t=this.config)||void 0===t?void 0:t.optOut},e.prototype.getShouldRecord=function(e){if(void 0===e&&(e=!1),!this.identifiers||!this.config)return this.loggerProvider.error("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;var t=R();if(!e&&t&&t.document&&!t.document.hasFocus())return this.identifiers.sessionId&&this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," temporarily not recording due to lack of browser focus.")),!1;if(this.shouldOptOut())return this.identifiers.sessionId&&this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;if(!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of session id."),!1;var n,r,o,s=(n=this.identifiers.sessionId,r=this.config.sampleRate,o=jn(n.toString()),31*Math.abs(o)%100/100<r);return s||this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate.")),s},e.prototype.getBlockSelectors=function(){var e,t;return null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.blockSelector},e.prototype.recordEvents=function(){var e,t=this,n=this.getShouldRecord(),r=null===(e=this.identifiers)||void 0===e?void 0:e.sessionId;n&&r&&(this.stopRecordingEvents(),this.recordCancelCallback=Bt({emit:function(e){var n=R();if(n&&n.document&&!n.document.hasFocus()||!t.getShouldRecord())t.stopRecordingAndSendEvents();else{var o=JSON.stringify(e),s=t.getDeviceId();s&&t.eventsManager&&t.eventsManager.addEvent({event:o,sessionId:r,deviceId:s})}},packFn:On,maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",blockSelector:this.getBlockSelectors(),maskInputFn:Un,recordCanvas:!1,errorHandler:function(e){var n=e;return t.loggerProvider.warn("Error while recording: ",n.toString()),!0}}))},e.prototype.getDeviceId=function(){var e,t,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=T(this.config.instanceName).identityStore.getIdentity().deviceId);return n||(null===(t=this.identifiers)||void 0===t?void 0:t.deviceId)},e.prototype.getSessionId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.sessionId},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){return c(this,(function(t){return this.eventsManager?[2,this.eventsManager.flush(e)]:[2]}))}))},e.prototype.shutdown=function(){var e=R();e&&(e.removeEventListener("blur",this.blurListener),e.removeEventListener("focus",this.focusListener)),this.stopRecordingAndSendEvents()},e}(),Hn=function(e){return function(){var t=e.config||F();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Vn=function(){var e=new Gn;return{init:g(e.init.bind(e),"init",Hn(e)),setSessionId:g(e.setSessionId.bind(e),"setSessionId",Hn(e)),getSessionId:g(e.getSessionId.bind(e),"getSessionId",Hn(e)),getSessionReplayProperties:g(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Hn(e)),flush:g(e.flush.bind(e),"flush",Hn(e)),shutdown:g(e.shutdown.bind(e),"shutdown",Hn(e))}}(),Kn=Vn.init,Zn=Vn.setSessionId,$n=Vn.getSessionId,Jn=Vn.getSessionReplayProperties,Yn=Vn.flush,Xn=Vn.shutdown,Qn="@amplitude/plugin-session-replay-enrichment-browser",er=function(){function e(){this.name=Qn,this.type="enrichment"}return e.prototype.setup=function(e,t){return a(this,void 0,void 0,(function(){return c(this,(function(t){return this.config=e,[2]}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){return this.config.sessionId&&this.config.sessionId!==$n()&&Zn(this.config.sessionId),this.config.sessionId&&this.config.sessionId===e.session_id&&(t=Jn(),e.event_properties=i(i({},e.event_properties),t)),[2,Promise.resolve(e)]}))}))},e}(),tr=function(){function e(e){this.name="@amplitude/plugin-session-replay-browser",this.type="destination",this.options=i({},e),!1!==this.options.forceSessionTracking&&(this.options.forceSessionTracking=!0)}return e.prototype.setup=function(e,t){var n;return a(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return t?(e.loggerProvider.log("Installing @amplitude/plugin-session-replay."),this.client=t,this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=i(i({},e.defaultTracking),{sessions:!0})),[4,Kn(e.apiKey,{instanceName:this.config.instanceName,deviceId:this.config.deviceId,optOut:this.config.optOut,sessionId:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null===(n=this.options.privacyConfig)||void 0===n?void 0:n.blockSelector},debugMode:this.options.debugMode}).promise]):(e.loggerProvider.error("SessionReplayPlugin requires v1.9.1+ of the Amplitude SDK."),[2]);case 1:return r.sent(),[4,t.add(new er).promise];case 2:return r.sent(),[2]}}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){return[2,Promise.resolve({event:e,code:200,message:"success"})]}))}))},e.prototype.flush=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,Yn(!1)];case 1:return e.sent(),[2]}}))}))},e.prototype.teardown=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this.client.remove(Qn).promise];case 1:return e.sent(),Xn(),this.config=null,this.client=null,[2]}}))}))},e.prototype.getSessionReplayProperties=function(){return Jn()},e}(),nr=function(e){return new tr(e)};return e.plugin=nr,e.sessionReplayPlugin=nr,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
1
+ var sessionReplay=function(e){"use strict";var t=function(e,n){return t=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])},t(e,n)};function n(e,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=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,o,s,i=function(){return i=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},i.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}function c(e,t){var n,r,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),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(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"}(r||(r={})),function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(o||(o={})),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"}(s||(s={}));var l="https://api2.amplitude.com/2/httpapi",u="Amplitude Logger ",d=function(){function e(){this.logLevel=r.None}return e.prototype.disable=function(){this.logLevel=r.None},e.prototype.enable=function(e){void 0===e&&(e=r.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Verbose||console.log("".concat(u,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Warn||console.warn("".concat(u,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Error||console.error("".concat(u,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Debug||console.log("".concat(u,"[Debug]: ").concat(e.join(" ")))},e}(),h=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:r.Warn,loggerProvider:new d,optOut:!1,serverUrl:l,serverZone:o.US,useBatch:!1}},p=function(){function e(e){var t,n,r,o;this._optOut=!1;var s=h();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(o=e.useBatch)&&void 0!==o?o:s.useBatch,this.loggerProvider.enable(this.logLevel);var i=m(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=i.serverZone,this.serverUrl=i.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),f=function(e,t){return e===o.EU?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":l},m=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=h().serverZone),void 0===n&&(n=h().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:h().serverZone;return{serverZone:r,serverUrl:f(r,n)}},v=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},g=function(e,t,n,o,s){return void 0===s&&(s=null),function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var c=n(),l=c.logger,u=c.logLevel;if(u&&u<r.Debug||!u||!l)return e.apply(s,i);var d={type:"invoke public method",name:t,args:i,stacktrace:v(1),time:{start:(new Date).toISOString()},states:{}};o&&d.states&&(d.states.before=o());var h=e.apply(s,i);return h&&h.promise?h.promise.then((function(){o&&d.states&&(d.states.after=o()),d.time&&(d.time.end=(new Date).toISOString()),l.debug(JSON.stringify(d,null,2))})):(o&&d.states&&(d.states.after=o()),d.time&&(d.time.end=(new Date).toISOString()),l.debug(JSON.stringify(d,null,2))),h}},y=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,a,c,l,u,d,h,p,f,m,v,g,y,S,b,I,w,M;if("object"!=typeof e)return null;var C=e.code||0,k=this.buildStatus(C);switch(k){case s.Success:return{status:k,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 s.Invalid:return{status:k,statusCode:C,body:{error:null!==(o=e.error)&&void 0!==o?o:"",missingField:null!==(i=e.missing_field)&&void 0!==i?i:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(c=e.events_with_missing_fields)&&void 0!==c?c:{},eventsWithInvalidIdLengths:null!==(l=e.events_with_invalid_id_lengths)&&void 0!==l?l:{},epsThreshold:null!==(u=e.eps_threshold)&&void 0!==u?u:0,exceededDailyQuotaDevices:null!==(d=e.exceeded_daily_quota_devices)&&void 0!==d?d:{},silencedDevices:null!==(h=e.silenced_devices)&&void 0!==h?h:[],silencedEvents:null!==(p=e.silenced_events)&&void 0!==p?p:[],throttledDevices:null!==(f=e.throttled_devices)&&void 0!==f?f:{},throttledEvents:null!==(m=e.throttled_events)&&void 0!==m?m:[]}};case s.PayloadTooLarge:return{status:k,statusCode:C,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case s.RateLimit:return{status:k,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!==(S=e.throttled_devices)&&void 0!==S?S:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(M=e.throttled_events)&&void 0!==M?M:[]}};case s.Timeout:default:return{status:k,statusCode:C}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?s.Success:429===e?s.RateLimit:413===e?s.PayloadTooLarge:408===e?s.Timeout:e>=400&&e<500?s.Invalid:e>=500?s.Failed:s.Unknown},e}(),S=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:b(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),b=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}(),w=function(){return w=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},w.apply(this,arguments)},M=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var r=0,o=["string","number","boolean","undefined"];r<o.length;r++){if(o[r]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),i=Array.isArray(t);if(s!==i)return!1;if(!s||!i){var a=Object.keys(e).sort(),c=Object.keys(t).sort();if(!M(a,c))return!1;var l=!0;return Object.keys(e).forEach((function(n){M(e[n],t[n])||(l=!1)})),l}for(var u=0;u<e.length;u++)if(!M(e[u],t[u]))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 C,k=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=w({},this.identity.userProperties),n=w(w({},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){for(var t=n.userProperties||{},r=0,o=Object.entries(e);r<o.length;r++){var s=o[r],i=s[0],a=s[1];switch(i){case"$set":for(var c=0,l=Object.entries(a);c<l.length;c++){var u=l[c],d=u[0],h=u[1];t[d]=h}break;case"$unset":for(var p=0,f=Object.keys(a);p<f.length;p++){delete t[d=f[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return w({},this.identity)},e.prototype.setIdentity=function(e){var t=w({},this.identity);this.identity=w({},e),M(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}(),O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,E=function(){function e(){this.identityStore=new k,this.eventBridge=new I,this.applicationContextProvider=new S}return e.getInstance=function(t){return O.analyticsConnectorInstances||(O.analyticsConnectorInstances={}),O.analyticsConnectorInstances[t]||(O.analyticsConnectorInstances[t]=new e),O.analyticsConnectorInstances[t]},e}(),T=function(e){return void 0===e&&(e="$default_instance"),E.getInstance(e)},R=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},x=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,(function(){var n,r;return c(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,o.sent().json()];case 2:return r=o.sent(),[2,this.buildResponse(r)]}}))}))},t}(y),N="[Amplitude]",D="".concat(N," Session Replay ID"),L=o.US,_="".concat(N," Session Replay Debug"),A="".concat("AMP","_replay_unsent"),P={currentSequenceId:0,sessionSequences:{}},F=function(){return{flushMaxRetries:2,logLevel:r.Warn,loggerProvider:new d,transportProvider:new x}},U=function(e){function t(t,n){var r=this,o=F();return(r=e.call(this,i(i({transportProvider:o.transportProvider},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=o.flushMaxRetries?n.flushMaxRetries:o.flushMaxRetries,r.apiKey=t,r.sampleRate=n.sampleRate||0,r.serverZone=n.serverZone||L,n.privacyConfig&&(r.privacyConfig=n.privacyConfig),n.debugMode&&(r.debugMode=n.debugMode),r}return n(t,e),t}(p);function j(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function q(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function W(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t,z).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function z(e){var t,n,r;if(function(e){return"styleSheet"in e}(e))try{t=W(e.styleSheet)||function(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url(".concat(JSON.stringify(e.href),")")];return""===e.layerName?n.push("layer"):e.layerName&&n.push("layer(".concat(e.layerName,")")),e.supportsText&&n.push("supports(".concat(e.supportsText,")")),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return n=e.cssText,r=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,n.replace(r,"$1\\$2");return t||e.cssText}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(C||(C={}));var B=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function G(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,o=e.type,s=e.value,i=e.maskInputFn,a=s||"",c=o&&H(o);return(n[r.toLowerCase()]||c&&n[c])&&(a=i?i(a,t):"*".repeat(a.length)),a}function H(e){return e.toLowerCase()}var V="__rrweb_original__";function K(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?H(t):null}var Z,$,J=1,Y=new RegExp("[^a-z0-9-_:]");function X(){return J++}var Q=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ee=/^(?:[a-z+]+:)?\/\//i,te=/^www\..*/i,ne=/^(data:)([^,]*),(.*)/i;function re(e,t){return(e||"").replace(Q,(function(e,n,r,o,s,i){var a,c=r||s||i,l=n||o||"";if(!c)return e;if(ee.test(c)||te.test(c))return"url(".concat(l).concat(c).concat(l,")");if(ne.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var h=0,p=d;h<p.length;h++){var f=p[h];"."!==f&&(".."===f?u.pop():u.push(f))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var oe=/^[^ \t\n\r\u000c]+/,se=/^[, \t\n\r\u000c]+/;function ie(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function ae(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ce(){var e=document.createElement("a");return e.href="",e.href}function le(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?ie(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}for(var o=[];r(se),!(n>=t.length);){var s=r(oe);if(","===s.slice(-1))s=ie(e,s.substring(0,s.length-1)),o.push(s);else{var i="";s=ie(e,s);for(var a=!1;;){var c=t.charAt(n);if(""===c){o.push((s+i).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,o.push((s+i).trim());break}"("===c&&(a=!0)}i+=c,n+=1}}}return o.join(", ")}(e,r):"style"===n?re(r,ce()):"object"===t&&"data"===n?ie(e,r):r:ie(e,r):r}function ue(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function de(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&de(e.parentNode,t,n);for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return!!n&&de(e.parentNode,t,n)}function he(e,t,n){try{var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(r.closest(".".concat(t)))return!0}else if(de(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}}catch(e){}return!1}function pe(e,t){var n=t.doc,r=t.mirror,o=t.blockClass,s=t.blockSelector,i=t.maskTextClass,a=t.maskTextSelector,c=t.inlineStylesheet,l=t.maskInputOptions,u=void 0===l?{}:l,d=t.maskTextFn,h=t.maskInputFn,p=t.dataURLOptions,f=void 0===p?{}:p,m=t.inlineImages,v=t.recordCanvas,g=t.keepIframeSrcFn,y=t.newlyAddedElement,S=void 0!==y&&y,b=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:C.Document,childNodes:[],compatMode:e.compatMode}:{type:C.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:C.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.blockClass,o=t.blockSelector,s=t.inlineStylesheet,i=t.maskInputOptions,a=void 0===i?{}:i,c=t.maskInputFn,l=t.dataURLOptions,u=void 0===l?{}:l,d=t.inlineImages,h=t.recordCanvas,p=t.keepIframeSrcFn,f=t.newlyAddedElement,m=void 0!==f&&f,v=t.rootId,g=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,o),y=function(e){if(e instanceof HTMLFormElement)return"form";var t=H(e.tagName);return Y.test(t)?"div":t}(e),S={},b=e.attributes.length,I=0;I<b;I++){var w=e.attributes[I];ue(y,w.name,w.value)||(S[w.name]=le(n,y,H(w.name),w.value))}if("link"===y&&s){var M=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),k=null;M&&(k=W(M)),k&&(delete S.rel,delete S.href,S._cssText=re(k,M.href))}if("style"===y&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(k=W(e.sheet))&&(S._cssText=re(k,ce()))}if("input"===y||"textarea"===y||"select"===y){var O=e.value,E=e.checked;if("radio"!==S.type&&"checkbox"!==S.type&&"submit"!==S.type&&"button"!==S.type&&O){var T=K(e);S.value=G({element:e,type:T,tagName:y,value:O,maskInputOptions:a,maskInputFn:c})}else E&&(S.checked=E)}"option"===y&&(e.selected&&!a.select?S.selected=!0:delete S.selected);if("canvas"===y&&h)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var o=t.getImageData,s=V in o?o[V]:o;if(new Uint32Array(s.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(e)||(S.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var R=e.toDataURL(u.type,u.quality),x=document.createElement("canvas");x.width=e.width,x.height=e.height,R!==x.toDataURL(u.type,u.quality)&&(S.rr_dataURL=R)}if("img"===y&&d){Z||(Z=n.createElement("canvas"),$=Z.getContext("2d"));var N=e,D=N.crossOrigin;N.crossOrigin="anonymous";var L=function(){N.removeEventListener("load",L);try{Z.width=N.naturalWidth,Z.height=N.naturalHeight,$.drawImage(N,0,0),S.rr_dataURL=Z.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(N.currentSrc,"! Error: ").concat(e))}D?S.crossOrigin=D:N.removeAttribute("crossorigin")};N.complete&&0!==N.naturalWidth?L():N.addEventListener("load",L)}"audio"!==y&&"video"!==y||(S.rr_mediaState=e.paused?"paused":"played",S.rr_mediaCurrentTime=e.currentTime);m||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop));if(g){var _=e.getBoundingClientRect(),A=_.width,P=_.height;S={class:S.class,rr_width:"".concat(A,"px"),rr_height:"".concat(P,"px")}}"iframe"!==y||p(S.src)||(e.contentDocument||(S.rr_src=S.src),delete S.src);return{type:C.Element,tagName:y,attributes:S,childNodes:[],isSVG:ae(e)||void 0,needBlock:g,rootId:v}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:f,inlineImages:m,recordCanvas:v,keepIframeSrcFn:g,newlyAddedElement:S,rootId:b});case e.TEXT_NODE:return function(e,t){var n,r=t.maskTextClass,o=t.maskTextSelector,s=t.maskTextFn,i=t.rootId,a=e.parentNode&&e.parentNode.tagName,c=e.textContent,l="STYLE"===a||void 0,u="SCRIPT"===a||void 0;if(l&&c){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(c=W(e.parentNode.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=re(c,ce())}u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&he(e,r,o)&&(c=s?s(c,e.parentElement):c.replace(/[\S]/g,"*"));return{type:C.Text,textContent:c||"",isStyle:l,rootId:i}}(e,{maskTextClass:i,maskTextSelector:a,maskTextFn:d,rootId:b});case e.CDATA_SECTION_NODE:return{type:C.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:C.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function fe(e){return null==e?"":e.toLowerCase()}function me(e,t){var n,r=t.doc,o=t.mirror,s=t.blockClass,i=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,d=t.inlineStylesheet,h=void 0===d||d,p=t.maskInputOptions,f=void 0===p?{}:p,m=t.maskTextFn,v=t.maskInputFn,g=t.slimDOMOptions,y=t.dataURLOptions,S=void 0===y?{}:y,b=t.inlineImages,I=void 0!==b&&b,w=t.recordCanvas,M=void 0!==w&&w,k=t.onSerialize,O=t.onIframeLoad,E=t.iframeLoadTimeout,T=void 0===E?5e3:E,R=t.onStylesheetLoad,x=t.stylesheetLoadTimeout,N=void 0===x?5e3:x,D=t.keepIframeSrcFn,L=void 0===D?function(){return!1}:D,_=t.newlyAddedElement,A=void 0!==_&&_,P=t.preserveWhiteSpace,F=void 0===P||P,U=pe(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,dataURLOptions:S,inlineImages:I,recordCanvas:M,keepIframeSrcFn:L,newlyAddedElement:A});if(!U)return console.warn(e,"not serialized"),null;n=o.hasNode(e)?o.getId(e):!function(e,t){if(t.comment&&e.type===C.Comment)return!0;if(e.type===C.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(fe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===fe(e.attributes.name)||"icon"===fe(e.attributes.rel)||"apple-touch-icon"===fe(e.attributes.rel)||"shortcut icon"===fe(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&fe(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(fe(e.attributes.property).match(/^(og|twitter|fb):/)||fe(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===fe(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===fe(e.attributes.name)||"googlebot"===fe(e.attributes.name)||"bingbot"===fe(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===fe(e.attributes.name)||"generator"===fe(e.attributes.name)||"framework"===fe(e.attributes.name)||"publisher"===fe(e.attributes.name)||"progid"===fe(e.attributes.name)||fe(e.attributes.property).match(/^article:/)||fe(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===fe(e.attributes.name)||"yandex-verification"===fe(e.attributes.name)||"csrf-token"===fe(e.attributes.name)||"p:domain_verify"===fe(e.attributes.name)||"verify-v1"===fe(e.attributes.name)||"verification"===fe(e.attributes.name)||"shopify-checkout-api-token"===fe(e.attributes.name)))return!0}}return!1}(U,g)&&(F||U.type!==C.Text||U.isStyle||U.textContent.replace(/^\s+|\s+$/gm,"").length)?X():-2;var W=Object.assign(U,{id:n});if(o.add(e,W),-2===n)return null;k&&k(e);var z=!u;if(W.type===C.Element){z=z&&!W.needBlock,delete W.needBlock;var B=e.shadowRoot;B&&q(B)&&(W.isShadowHost=!0)}if((W.type===C.Document||W.type===C.Element)&&z){g.headWhitespace&&W.type===C.Element&&"head"===W.tagName&&(F=!1);for(var G={doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L},H=0,V=Array.from(e.childNodes);H<V.length;H++){($=me(V[H],G))&&W.childNodes.push($)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var K=0,Z=Array.from(e.shadowRoot.childNodes);K<Z.length;K++){var $;($=me(Z[K],G))&&(q(e.shadowRoot)&&($.isShadow=!0),W.childNodes.push($))}}return e.parentNode&&j(e.parentNode)&&q(e.parentNode)&&(W.isShadow=!0),W.type===C.Element&&"iframe"===W.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"===o){var i="about:blank";if(r.location.href!==i||e.src===i||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout((function(){s||(t(),s=!0)}),n);e.addEventListener("load",(function(){clearTimeout(a),s=!0,t()}))}}}(e,(function(){var t=e.contentDocument;if(t&&O){var n=me(t,{doc:t,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L});n&&O(e,n)}}),T),W.type===C.Element&&"link"===W.tagName&&"stylesheet"===W.attributes.rel&&function(e,t,n){var r,o=!1;try{r=e.sheet}catch(e){return}if(!r){var s=setTimeout((function(){o||(t(),o=!0)}),n);e.addEventListener("load",(function(){clearTimeout(s),o=!0,t()}))}}(e,(function(){if(R){var t=me(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L});t&&R(e,t)}}),N),W}var ve=(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))(ve||{}),ge=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(ge||{}),ye=(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))(ye||{}),Se=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Se||{}),be=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(be||{});function Ie(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const we="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Me={map:{},getId:()=>(console.error(we),-1),getNode:()=>(console.error(we),null),removeNodeFromMap(){console.error(we)},has:()=>(console.error(we),!1),reset(){console.error(we)}};function Ce(e,t,n={}){let r=null,o=0;return function(...s){const i=Date.now();o||!1!==n.leading||(o=i);const a=t-(i-o),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),o=i,e.apply(c,s)):r||!1===n.trailing||(r=setTimeout((()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(c,s)}),a))}}function ke(e,t,n,r,o=window){const s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>ke(e,t,s||{},!0)}function Oe(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch(e){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Me=new Proxy(Me,{get:(e,t,n)=>("map"===t&&console.error(we),Reflect.get(e,t,n))}));let Ee,Te=Date.now;function Re(e){var t,n,r,o,s,i;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null===(n=null===(t=null==a?void 0:a.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==a?void 0:a.body)||void 0===r?void 0:r.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null===(s=null===(o=null==a?void 0:a.body)||void 0===o?void 0:o.parentElement)||void 0===s?void 0:s.scrollTop)||(null===(i=null==a?void 0:a.body)||void 0===i?void 0:i.scrollTop)||0}}function xe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ne(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function De(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function Le(e,t,n,r){if(!e)return!1;const o=De(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(de(o,t,r))return!0}catch(e){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1}function _e(e,t){return-2===t.getId(e)}function Ae(e,t){if(j(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Ae(e.parentNode,t))}function Pe(e){return Boolean(e.changedTouches)}function Fe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ue(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function je(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Te=()=>(new Date).getTime());class qe{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function We(e){var t,n;let r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function ze(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=We(n);)n=t;return n}(e);return t.contains(n)}function Be(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||ze(e))}function Ge(e){Ee=e}function He(){Ee=void 0}const Ve=e=>{if(!Ee)return e;return(...t)=>{try{return e(...t)}catch(e){if(Ee&&!0===Ee(e))return;throw e}}};class Ke{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),s=r||this.getRemoteIdToIdMap(e);let i=o.get(t);return i||(i=this.generateIdFn(),o.set(t,i),s.set(i,t)),i}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,r)))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const o=r.get(t);return o||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Ze{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ke(X),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ke(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case ve.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:ve.IncrementalSnapshot,data:{source:ge.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ve.Meta:case ve.Load:case ve.DomContentLoaded:return!1;case ve.Plugin:return t;case ve.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case ve.IncrementalSnapshot:switch(t.data.source){case ge.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case ge.Drag:case ge.TouchMove:case ge.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case ge.ViewportResize:return!1;case ge.MediaInteraction:case ge.MouseInteraction:case ge.Scroll:case ge.CanvasMutation:case ge.Input:return this.replaceIds(t.data,e,["id"]),t;case ge.StyleSheetRule:case ge.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ge.Font:return t;case ge.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case ge.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(n,t[o]):t[o]=e.getId(n,t[o]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===C.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}function $e(e){return"__ln"in e}class Je{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$e(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&$e(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Ye=(e,t)=>`${e}@${t}`;class Xe{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new Je,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{if(!o.parentNode||!Be(o))return;const s=j(o.parentNode)?this.mirror.getId(We(o)):this.mirror.getId(o.parentNode),i=r(o);if(-1===s||-1===i)return n.addNode(o);const a=me(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Fe(e,this.mirror)&&this.iframeManager.addIframe(e),Ue(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),je(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});a&&(e.push({parentId:s,nextId:i,node:a}),t.add(a.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)et(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)nt(this.droppedSet,e)||et(this.removes,e,this.mirror)?nt(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;n.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),n=r(s.value);-1!==t&&-1!==n&&(e=s)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}s=e.previous,n.removeNode(e.value),o(e.value)}const i={texts:this.texts.map((e=>({id:this.mirror.getId(e.node),value:e.value}))).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(i.texts.length||i.attributes.length||i.removes.length||i.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(i))},this.processMutation=e=>{if(!_e(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;Le(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:he(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t,De(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=K(t);r=G({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(Le(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let o=this.attributes.find((t=>t.node===e.target));if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;n="rr_src"}if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!ue(t.tagName,n)&&(o.attributes[n]=le(this.doc,H(t.tagName),H(n),r),"style"===n)){let n;try{n=document.implementation.createHTMLDocument()}catch(e){n=this.doc}const r=n.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const n=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);n!==r.style.getPropertyValue(e)||s!==r.style.getPropertyPriority(e)?o.styleDiff[e]=""===s?n:[n,s]:o._unchangedStyles[e]=[n,s]}for(const e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(o.styleDiff[e]=!1)}break}case"childList":if(Le(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),r=j(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Le(e.target,this.blockClass,this.blockSelector,!1)||_e(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Qe(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Ae(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ye(n,r)]?Qe(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!j(e.target)||!q(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(_e(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Ye(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Le(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),je(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Qe(e,t){e.delete(t),t.childNodes.forEach((t=>Qe(e,t)))}function et(e,t,n){return 0!==e.length&&tt(e,t,n)}function tt(e,t,n){const{parentNode:r}=t;if(!r)return!1;const o=n.getId(r);return!!e.some((e=>e.id===o))||tt(e,r,n)}function nt(e,t){return 0!==e.size&&rt(e,t)}function rt(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||rt(e,n))}const ot=[];function st(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function it(e,t){var n,r;const o=new Xe;ot.push(o),o.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const i=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");i&&window[i]&&(s=window[i]);const a=new s(Ve(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function at({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const i=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,a=[];let c=null;return Object.keys(ye).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{let i=H(s);const l=(t=>s=>{const i=st(s);if(Le(i,r,o,!0))return;let a=null,l=t;if("pointerType"in s){switch(s.pointerType){case"mouse":a=Se.Mouse;break;case"touch":a=Se.Touch;break;case"pen":a=Se.Pen}a===Se.Touch?ye[t]===ye.MouseDown?l="TouchStart":ye[t]===ye.MouseUp&&(l="TouchEnd"):Se.Pen}else Pe(s)&&(a=Se.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===Se.Touch||l.startsWith("Mouse")&&a===Se.Mouse)&&(a=null)):ye[t]===ye.Click&&(a=c,c=null);const u=Pe(s)?s.changedTouches[0]:s;if(!u)return;const d=n.getId(i),{clientX:h,clientY:p}=u;Ve(e)(Object.assign({type:ye[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(s);if(window.PointerEvent)switch(ye[s]){case ye.MouseDown:case ye.MouseUp:i=i.replace("mouse","pointer");break;case ye.TouchStart:case ye.TouchEnd:return}a.push(Ie(i,l,t))})),Ve((()=>{a.forEach((e=>e()))}))}function ct({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){return Ie("scroll",Ve(Ce(Ve((s=>{const i=st(s);if(!i||Le(i,r,o,!0))return;const a=n.getId(i);if(i===t&&t.defaultView){const n=Re(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:i.scrollLeft,y:i.scrollTop})})),s.scroll||100)),t)}function lt(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const ut=["INPUT","TEXTAREA","SELECT"],dt=new WeakMap;function ht(e){return function(e,t){if(vt("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||vt("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||vt("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||vt("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function pt(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function ft({mirror:e,stylesheetManager:t},n){var r,o,s;let i=null;i="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(s=null===(o=n.ownerDocument)||void 0===o?void 0:o.defaultView)||void 0===s?void 0:s.ShadowRoot,c=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==i&&-1!==i&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const r=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==i&&-1!==i)try{t.adoptStyleSheets(e,i)}catch(e){}return r}}),Ve((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function mt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:i,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),o(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),i(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)}}(e,t),e.recordDOM&&(r=it(e,e.doc));const o=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const o="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let i,a=[];const c=Ce(Ve((t=>{const n=Date.now()-i;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],i=null})),s),l=Ve(Ce(Ve((e=>{const t=st(e),{clientX:n,clientY:o}=Pe(e)?e.changedTouches[0]:e;i||(i=Te()),a.push({x:n,y:o,id:r.getId(t),timeOffset:Te()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?ge.Drag:e instanceof MouseEvent?ge.MouseMove:ge.TouchMove)})),o,{trailing:!1})),u=[Ie("mousemove",l,n),Ie("touchmove",l,n),Ie("drag",l,n)];return Ve((()=>{u.forEach((e=>e()))}))}(e),s=at(e),i=ct(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return Ie("resize",Ve(Ce(Ve((()=>{const t=xe(),o=Ne();n===t&&r===o||(e({width:Number(o),height:Number(t)}),n=t,r=o)})),200)),t)}(e,{win:n}),c=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:s,ignoreSelector:i,maskInputOptions:a,maskInputFn:c,sampling:l,userTriggeredOnInput:u}){function d(e){let n=st(e);const l=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||ut.indexOf(d)<0||Le(n,r,o,!0))return;if(n.classList.contains(s)||i&&n.matches(i))return;let p=n.value,f=!1;const m=K(n)||"";"radio"===m||"checkbox"===m?f=n.checked:(a[d.toLowerCase()]||a[m])&&(p=G({element:n,maskInputOptions:a,tagName:d,type:m,value:p,maskInputFn:c})),h(n,Ve(lt)({text:p,isChecked:f,userTriggered:l},u));const v=n.name;"radio"===m&&v&&f&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach((e=>{e!==n&&h(e,Ve(lt)({text:e.value,isChecked:!f,userTriggered:!1},u))}))}function h(t,r){const o=dt.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){dt.set(t,r);const o=n.getId(t);Ve(e)(Object.assign(Object.assign({},r),{id:o}))}}const p=("last"===l.input?["change"]:["input","change"]).map((e=>Ie(e,Ve(d),t))),f=t.defaultView;if(!f)return()=>{p.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),v=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&p.push(...v.map((e=>ke(e[0],e[1],{set(){Ve(d)({target:this,isTrusted:!1})}},!1,f)))),Ve((()=>{p.forEach((e=>e()))}))}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){const i=Ve((s=>Ce(Ve((o=>{const i=st(o);if(!i||Le(i,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:u}=i;e({type:s,id:r.getId(i),currentTime:a,volume:c,muted:l,playbackRate:u})})),o.media||500))),a=[Ie("play",i(0),s),Ie("pause",i(1),s),Ie("seeked",i(2),s),Ie("volumechange",i(3),s),Ie("ratechange",i(4),s)];return Ve((()=>{a.forEach((e=>e()))}))}(e);let u=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Ve(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=pt(o,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:a}]}),r.apply(o,s)}))});const s=r.CSSStyleSheet.prototype.deleteRule;let i,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:i}]}),r.apply(o,s)}))}),r.CSSStyleSheet.prototype.replace&&(i=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:i}),r.apply(o,s)}))})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:i}),r.apply(o,s)}))}));const c={};gt("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(gt("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),gt("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),gt("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach((([r,o])=>{l[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(l[r].insertRule,{apply:Ve(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=pt(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:[...ht(o),a||0]}]}),r.apply(o,s)}))}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...ht(o),i]}]}),r.apply(o,s)}))})})),Ve((()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=s,i&&(r.CSSStyleSheet.prototype.replace=i),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),d=ft(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:Ve(((o,i,a)=>{var c;const[l,u,d]=a;if(n.has(l))return s.apply(i,[l,u,d]);const{id:h,styleId:p}=pt(null===(c=i.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:l,value:u,priority:d},index:ht(i.parentRule)}),o.apply(i,a)}))});const i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:Ve(((o,s,a)=>{var c;const[l]=a;if(n.has(l))return i.apply(s,[l]);const{id:u,styleId:d}=pt(null===(c=s.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,remove:{property:l},index:ht(s.parentRule)}),o.apply(s,a)}))}),Ve((()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i}))}(e,{win:n}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],o=new WeakMap,s=n.FontFace;n.FontFace=function(e,t,n){const r=new s(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const i=Oe(t.fonts,"add",(function(t){return function(n){return setTimeout(Ve((()=>{const t=o.get(n);t&&(e(t),o.delete(n))})),0),t.apply(this,[n])}}));return r.push((()=>{n.FontFace=s})),r.push(i),Ve((()=>{r.forEach((e=>e()))}))}(e)));const f=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let i=!0;const a=Ve((()=>{const e=t.getSelection();if(!e||i&&(null==e?void 0:e.isCollapsed))return;i=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const s=e.getRangeAt(t),{startContainer:i,startOffset:c,endContainer:l,endOffset:u}=s;Le(i,r,o,!0)||Le(l,r,o,!0)||a.push({start:n.getId(i),startOffset:c,end:n.getId(l),endOffset:u})}s({ranges:a})}));return a(),Ie("selectionchange",a)}(e),m=[];for(const t of e.plugins)m.push(t.observer(t.callback,n,t.options));return Ve((()=>{ot.forEach((e=>e.reset())),null==r||r.disconnect(),o(),s(),i(),a(),c(),l(),u(),d(),h(),p(),f(),m.forEach((e=>e()))}))}function vt(e){return void 0!==window[e]}function gt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}function yt(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}for(var St,bt,It,wt=(St=function(){!function(){function e(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),r=0;r<t.length;r++)n[t.charCodeAt(r)]=r;var o=function(e){var n,r=new Uint8Array(e),o=r.length,s="";for(n=0;n<o;n+=3)s+=t[r[n]>>2],s+=t[(3&r[n])<<4|r[n+1]>>4],s+=t[(15&r[n+1])<<2|r[n+2]>>6],s+=t[63&r[n+2]];return o%3==2?s=s.substring(0,s.length-1)+"=":o%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const s=new Map,i=new Map,a=self;a.onmessage=function(t){return e(this,void 0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:t.data.id});{const{id:n,bitmap:r,width:c,height:l,dataURLOptions:u}=t.data,d=function(t,n,r){return e(this,void 0,void 0,(function*(){const e=`${t}-${n}`;if("OffscreenCanvas"in globalThis){if(i.has(e))return i.get(e);const s=new OffscreenCanvas(t,n);s.getContext("2d");const a=yield s.convertToBlob(r),c=yield a.arrayBuffer(),l=o(c);return i.set(e,l),l}return""}))}(c,l,u),h=new OffscreenCanvas(c,l);h.getContext("2d").drawImage(r,0,0),r.close();const p=yield h.convertToBlob(u),f=p.type,m=yield p.arrayBuffer(),v=o(m);if(!s.has(n)&&(yield d)===v)return s.set(n,v),a.postMessage({id:n});if(s.get(n)===v)return a.postMessage({id:n});a.postMessage({id:n,type:f,base64:v,width:c,height:l}),s.set(n,v)}}))}}()},bt=null,function(e){return It=It||function(e,t){var n=function(e,t){var n=void 0===t?null:t,r=e.toString().split("\n");r.pop(),r.shift();for(var o=r[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,i=0,a=r.length;i<a;++i)r[i]=r[i].substring(o).replace(s,"$1use strict$2")+"\n";return n&&r.push("//# sourceMappingURL="+n+"\n"),r}(e,t),r=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(r)}(St,bt),new Worker(It,e)}),Mt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ct="undefined"==typeof Uint8Array?[]:new Uint8Array(256),kt=0;kt<Mt.length;kt++)Ct[Mt.charCodeAt(kt)]=kt;const Ot=new Map;const Et=(e,t,n)=>{if(!e||!xt(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=Ot.get(e);return n||(n=new Map,Ot.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let o=r.indexOf(e);return-1===o&&(o=r.length,r.push(e)),o};function Tt(e,t,n){if(e instanceof Array)return e.map((e=>Tt(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),r=n.length,o="";for(t=0;t<r;t+=3)o+=Mt[n[t]>>2],o+=Mt[(3&n[t])<<4|n[t+1]>>4],o+=Mt[(15&n[t+1])<<2|n[t+2]>>6],o+=Mt[63&n[t+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Tt(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Tt(e.data,t,n),e.width,e.height]}}if(xt(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Et(e,t,n)}}return e}const Rt=(e,t,n)=>[...e].map((e=>Tt(e,t,n))),xt=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function Nt(e,t,n,r){const o=[];try{const s=Oe(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...s){if(!Le(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(o);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(s[0]&&"object"==typeof s[0]){const e=s[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[o,...s])}}));o.push(s)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach((e=>e()))}}function Dt(e,t,n,r,o,s,i){const a=[],c=Object.getOwnPropertyNames(e);for(const s of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const c=Oe(e,s,(function(e){return function(...a){const c=e.apply(this,a);if(Et(c,i,this),"tagName"in this.canvas&&!Le(this.canvas,r,o,!0)){const e=Rt([...a],i,this),r={type:t,property:s,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const o=ke(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(o)}return a}class Lt{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:r,blockSelector:o,recordCanvas:s,dataURLOptions:i}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(n,r,o),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,o,{dataURLOptions:i})}initCanvasFPSObserver(e,t,n,r,o){const s=Nt(t,n,r,!0),i=new Map,a=new wt;a.onmessage=e=>{const{id:t}=e.data;if(i.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:o,height:s}=e.data;this.mutationCb({id:t,type:be["2D"],commands:[{property:"clearRect",args:[0,0,o,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let l,u=0;const d=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{Le(t,n,r,!0)||e.push(t)})),e})().forEach((e=>yt(this,void 0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(i.get(n))return;if(i.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=yield createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:o.dataURLOptions},[r])}))))),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{s(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=Nt(e,t,n,!1),o=function(e,t,n,r){const o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const i of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[i])continue;const s=Oe(t.CanvasRenderingContext2D.prototype,i,(function(o){return function(...s){return Le(this.canvas,n,r,!0)||setTimeout((()=>{const n=Rt([...s],t,this);e(this.canvas,{type:be["2D"],property:i,args:n})}),0),o.apply(this,s)}}));o.push(s)}catch(n){const r=ke(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:be["2D"],property:i,args:[t],setter:!0})}});o.push(r)}return()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),s=function(e,t,n,r,o){const s=[];return s.push(...Dt(t.WebGLRenderingContext.prototype,be.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&s.push(...Dt(t.WebGL2RenderingContext.prototype,be.WebGL2,e,n,r,0,t)),()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map((e=>{const t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["type"]);return t})),{type:o}=n[0];this.mutationCb({id:t,type:o,commands:r}),this.pendingCanvasMutations.delete(e)}}class _t{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}class At{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!q(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=it(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(ct(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(ft({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(Oe(e.prototype,"attachShadow",(function(e){return function(r){const o=e.call(this,r);return this.shadowRoot&&Be(this)&&n.addShadowRoot(this.shadowRoot,t),o}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}class Pt{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new qe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:z(e),index:t})))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function Ft(e){return Object.assign(Object.assign({},e),{timestamp:Te()})}let Ut,jt,qt,Wt=!1;const zt=new B;function Bt(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:i="rr-ignore",ignoreSelector:a=null,maskTextClass:c="rr-mask",maskTextSelector:l=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:p,maskInputFn:f,maskTextFn:m,hooks:v,packFn:g,sampling:y={},dataURLOptions:S={},mousemoveWait:b,recordDOM:I=!0,recordCanvas:w=!1,recordCrossOriginIframes:M=!1,recordAfter:C=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:k=!1,collectFonts:O=!1,inlineImages:E=!1,plugins:T,keepIframeSrcFn:R=(()=>!1),ignoreCSSAttributes:x=new Set([]),errorHandler:N}=e;Ge(N);const D=!M||window.parent===window;let L=!1;if(!D)try{window.parent.document&&(L=!1)}catch(e){L=!0}if(D&&!t)throw new Error("emit function is required");void 0!==b&&void 0===y.mousemove&&(y.mousemove=b),zt.reset();const _=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==h?h:{password:!0},A=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p}:p||{};let P;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let F=0;const U=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return g&&!L&&(e=g(e)),e};Ut=(e,o)=>{var s;if(!(null===(s=ot[0])||void 0===s?void 0:s.isFrozen())||e.type===ve.FullSnapshot||e.type===ve.IncrementalSnapshot&&e.data.source===ge.Mutation||ot.forEach((e=>e.unfreeze())),D)null==t||t(U(e),o);else if(L){const t={type:"rrweb",event:U(e),origin:window.location.origin,isCheckout:o};window.parent.postMessage(t,"*")}if(e.type===ve.FullSnapshot)P=e,F=0;else if(e.type===ve.IncrementalSnapshot){if(e.data.source===ge.Mutation&&e.data.isAttachIframe)return;F++;const t=r&&F>=r,o=n&&e.timestamp-P.timestamp>n;(t||o)&&jt(!0)}};const j=e=>{Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Mutation},e)}))},q=e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Scroll},e)})),W=e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.CanvasMutation},e)})),z=new Pt({mutationCb:j,adoptedStyleSheetCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.AdoptedStyleSheet},e)}))}),G=new Ze({mirror:zt,mutationCb:j,stylesheetManager:z,recordCrossOriginIframes:M,wrappedEmit:Ut});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:zt,crossOriginIframeMirror:G.crossOriginIframeMirror,crossOriginIframeStyleMirror:G.crossOriginIframeStyleMirror});const H=new _t;qt=new Lt({recordCanvas:w,mutationCb:W,win:window,blockClass:o,blockSelector:s,mirror:zt,sampling:y.canvas,dataURLOptions:S});const V=new At({mutationCb:j,scrollCb:q,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:_,dataURLOptions:S,maskTextFn:m,maskInputFn:f,recordCanvas:w,inlineImages:E,sampling:y,slimDOMOptions:A,iframeManager:G,stylesheetManager:z,canvasManager:qt,keepIframeSrcFn:R,processedNodeManager:H},mirror:zt});jt=(e=!1)=>{if(!I)return;Ut(Ft({type:ve.Meta,data:{href:window.location.href,width:Ne(),height:xe()}}),e),z.reset(),V.init(),ot.forEach((e=>e.lock()));const t=function(e,t){var n=t||{},r=n.mirror,o=void 0===r?new B:r,s=n.blockClass,i=void 0===s?"rr-block":s,a=n.blockSelector,c=void 0===a?null:a,l=n.maskTextClass,u=void 0===l?"rr-mask":l,d=n.maskTextSelector,h=void 0===d?null:d,p=n.inlineStylesheet,f=void 0===p||p,m=n.inlineImages,v=void 0!==m&&m,g=n.recordCanvas,y=void 0!==g&&g,S=n.maskAllInputs,b=void 0!==S&&S,I=n.maskTextFn,w=n.maskInputFn,M=n.slimDOM,C=void 0!==M&&M,k=n.dataURLOptions,O=n.preserveWhiteSpace,E=n.onSerialize,T=n.onIframeLoad,R=n.iframeLoadTimeout,x=n.onStylesheetLoad,N=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return me(e,{doc:e,mirror:o,blockClass:i,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:f,maskInputOptions:!0===b?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===b?{password:!0}:b,maskTextFn:I,maskInputFn:w,slimDOMOptions:!0===C||"all"===C?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===C,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===C?{}:C,dataURLOptions:k,inlineImages:v,recordCanvas:y,preserveWhiteSpace:O,onSerialize:E,onIframeLoad:T,iframeLoadTimeout:R,onStylesheetLoad:x,stylesheetLoadTimeout:N,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:zt,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:_,maskTextFn:m,slimDOM:A,dataURLOptions:S,recordCanvas:w,inlineImages:E,onSerialize:e=>{Fe(e,zt)&&G.addIframe(e),Ue(e,zt)&&z.trackLinkElement(e),je(e)&&V.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{G.attachIframe(e,t),V.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:R});if(!t)return console.warn("Failed to snapshot the document");Ut(Ft({type:ve.FullSnapshot,data:{node:t,initialOffset:Re(window)}}),e),ot.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,zt.getId(document))};try{const e=[],t=e=>{var t;return Ve(mt)({mutationCb:j,mousemoveCb:(e,t)=>Ut(Ft({type:ve.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.MouseInteraction},e)})),scrollCb:q,viewportResizeCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.ViewportResize},e)})),inputCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Input},e)})),mediaInteractionCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.MediaInteraction},e)})),styleSheetRuleCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.StyleSheetRule},e)})),styleDeclarationCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.StyleDeclaration},e)})),canvasMutationCb:W,fontCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Font},e)})),selectionCb:e=>{Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Selection},e)}))},blockClass:o,ignoreClass:i,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:_,inlineStylesheet:u,sampling:y,recordDOM:I,recordCanvas:w,inlineImages:E,userTriggeredOnInput:k,collectFonts:O,doc:e,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:R,blockSelector:s,slimDOMOptions:A,dataURLOptions:S,mirror:zt,iframeManager:G,stylesheetManager:z,shadowDomManager:V,processedNodeManager:H,canvasManager:qt,ignoreCSSAttributes:x,plugins:(null===(t=null==T?void 0:T.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Ut(Ft({type:ve.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},v)};G.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{jt(),e.push(t(document)),Wt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Ie("DOMContentLoaded",(()=>{Ut(Ft({type:ve.DomContentLoaded,data:{}})),"DOMContentLoaded"===C&&n()}))),e.push(Ie("load",(()=>{Ut(Ft({type:ve.Load,data:{}})),"load"===C&&n()}),window))),()=>{e.forEach((e=>e())),H.destroy(),Wt=!1,He()}}catch(e){console.warn(e)}}var Gt,Ht;Bt.addCustomEvent=(e,t)=>{if(!Wt)throw new Error("please add custom event after start recording");Ut(Ft({type:ve.Custom,data:{tag:e,payload:t}}))},Bt.freezePage=()=>{ot.forEach((e=>e.freeze()))},Bt.takeFullSnapshot=e=>{if(!Wt)throw new Error("please take full snapshot after start recording");jt(e)},Bt.mirror=zt,function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(Gt||(Gt={})),function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Ht||(Ht={}));var Vt=Uint8Array,Kt=Uint16Array,Zt=Uint32Array,$t=new Vt([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]),Jt=new Vt([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]),Yt=new Vt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xt=function(e,t){for(var n=new Kt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new Zt(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return[n,o]},Qt=Xt($t,2),en=Qt[0],tn=Qt[1];en[28]=258,tn[258]=28;for(var nn=Xt(Jt,0)[1],rn=new Kt(32768),on=0;on<32768;++on){var sn=(43690&on)>>>1|(21845&on)<<1;sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4,rn[on]=((65280&sn)>>>8|(255&sn)<<8)>>>1}var an=function(e,t,n){for(var r=e.length,o=0,s=new Kt(t);o<r;++o)++s[e[o]-1];var i,a=new Kt(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;if(n){i=new Kt(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var l=o<<4|e[o],u=t-e[o],d=a[e[o]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)i[rn[d]>>>c]=l}else for(i=new Kt(r),o=0;o<r;++o)i[o]=rn[a[e[o]-1]++]>>>15-e[o];return i},cn=new Vt(288);for(on=0;on<144;++on)cn[on]=8;for(on=144;on<256;++on)cn[on]=9;for(on=256;on<280;++on)cn[on]=7;for(on=280;on<288;++on)cn[on]=8;var ln=new Vt(32);for(on=0;on<32;++on)ln[on]=5;var un=an(cn,9,0),dn=an(ln,5,0),hn=function(e){return(e/8>>0)+(7&e&&1)},pn=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Kt?Kt:e instanceof Zt?Zt:Vt)(n-t);return r.set(e.subarray(t,n)),r},fn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},mn=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},vn=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,s=n.slice();if(!o)return[new Vt(0),0];if(1==o){var i=new Vt(n[0].s+1);return i[n[0].s]=1,[i,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=o-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=s[0].s;for(r=1;r<o;++r)s[r].s>h&&(h=s[r].s);var p=new Kt(h+1),f=gn(n[u-1],p,0);if(f>t){r=0;var m=0,v=f-t,g=1<<v;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<o;++r){var y=s[r].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var S=s[r].s;p[S]<t?m-=1<<t-p[S]++-1:++r}for(;r>=0&&m;--r){var b=s[r].s;p[b]==t&&(--p[b],++m)}f=t}return[new Vt(p),f]},gn=function(e,t,n){return-1==e.s?Math.max(gn(e.l,t,n+1),gn(e.r,t,n+1)):t[e.s]=n},yn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Kt(++t),r=0,o=e[0],s=1,i=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==o&&a!=t)++s;else{if(!o&&s>2){for(;s>138;s-=138)i(32754);s>2&&(i(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(i(o),--s;s>6;s-=6)i(8304);s>2&&(i(s-3<<5|8208),s=0)}for(;s--;)i(o);s=1,o=e[a]}return[n.subarray(0,r),t]},Sn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},bn=function(e,t,n){var r=n.length,o=hn(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 s=0;s<r;++s)e[o+s+4]=n[s];return 8*(o+4+r)},In=function(e,t,n,r,o,s,i,a,c,l,u){fn(t,u++,n),++o[256];for(var d=vn(o,15),h=d[0],p=d[1],f=vn(s,15),m=f[0],v=f[1],g=yn(h),y=g[0],S=g[1],b=yn(m),I=b[0],w=b[1],M=new Kt(19),C=0;C<y.length;++C)M[31&y[C]]++;for(C=0;C<I.length;++C)M[31&I[C]]++;for(var k=vn(M,7),O=k[0],E=k[1],T=19;T>4&&!O[Yt[T-1]];--T);var R,x,N,D,L=l+5<<3,_=Sn(o,cn)+Sn(s,ln)+i,A=Sn(o,h)+Sn(s,m)+i+14+3*T+Sn(M,O)+(2*M[16]+3*M[17]+7*M[18]);if(L<=_&&L<=A)return bn(t,u,e.subarray(c,c+l));if(fn(t,u,1+(A<_)),u+=2,A<_){R=an(h,p,0),x=h,N=an(m,v,0),D=m;var P=an(O,E,0);fn(t,u,S-257),fn(t,u+5,w-1),fn(t,u+10,T-4),u+=14;for(C=0;C<T;++C)fn(t,u+3*C,O[Yt[C]]);u+=3*T;for(var F=[y,I],U=0;U<2;++U){var j=F[U];for(C=0;C<j.length;++C){var q=31&j[C];fn(t,u,P[q]),u+=O[q],q>15&&(fn(t,u,j[C]>>>5&127),u+=j[C]>>>12)}}}else R=un,x=cn,N=dn,D=ln;for(C=0;C<a;++C)if(r[C]>255){q=r[C]>>>18&31;mn(t,u,R[q+257]),u+=x[q+257],q>7&&(fn(t,u,r[C]>>>23&31),u+=$t[q]);var W=31&r[C];mn(t,u,N[W]),u+=D[W],W>3&&(mn(t,u,r[C]>>>5&8191),u+=Jt[W])}else mn(t,u,R[r[C]]),u+=x[r[C]];return mn(t,u,R[256]),u+x[256]},wn=new Zt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mn=new Vt(0),Cn=function(e,t,n,r,o){return function(e,t,n,r,o,s){var i=e.length,a=new Vt(r+i+5*(1+Math.floor(i/7e3))+o),c=a.subarray(r,a.length-o),l=0;if(!t||i<8)for(var u=0;u<=i;u+=65535){var d=u+65535;d<i?l=bn(c,l,e.subarray(u,d)):(c[u]=s,l=bn(c,l,e.subarray(u,i)))}else{for(var h=wn[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new Kt(32768),g=new Kt(m+1),y=Math.ceil(n/3),S=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<S)&m},I=new Zt(25e3),w=new Kt(288),M=new Kt(32),C=0,k=0,O=(u=0,0),E=0,T=0;u<i;++u){var R=b(u),x=32767&u,N=g[R];if(v[x]=N,g[R]=x,E<=u){var D=i-u;if((C>7e3||O>24576)&&D>423){l=In(e,c,0,I,w,M,k,O,T,u-T,l),O=C=k=0,T=u;for(var L=0;L<286;++L)w[L]=0;for(L=0;L<30;++L)M[L]=0}var _=2,A=0,P=f,F=x-N&32767;if(D>2&&R==b(u-F))for(var U=Math.min(p,D)-1,j=Math.min(32767,u),q=Math.min(258,D);F<=j&&--P&&x!=N;){if(e[u+_]==e[u+_-F]){for(var W=0;W<q&&e[u+W]==e[u+W-F];++W);if(W>_){if(_=W,A=F,W>U)break;var z=Math.min(F,W-2),B=0;for(L=0;L<z;++L){var G=u-F+L+32768&32767,H=G-v[G]+32768&32767;H>B&&(B=H,N=G)}}}F+=(x=N)-(N=v[x])+32768&32767}if(A){I[O++]=268435456|tn[_]<<18|nn[A];var V=31&tn[_],K=31&nn[A];k+=$t[V]+Jt[K],++w[257+V],++M[K],E=u+_,++C}else I[O++]=e[u],++w[e[u]]}}l=In(e,c,s,I,w,M,k,O,T,u-T,l),s||(l=bn(c,l,Mn))}return pn(a,0,r+hn(l)+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 kn(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var r=e,o=t,s=n.length,i=0;i!=s;){for(var a=Math.min(i+5552,s);i<a;++i)o+=r+=n[i];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=Cn(e,t,2,4);return function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)}(r,t),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(r,r.length-4,n.d()),r}const On=e=>{const t=Object.assign(Object.assign({},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}(kn(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Vt(e.length+(e.length>>>1)),o=0,s=function(e){r[o++]=e},i=0;i<n;++i){if(o+5>r.length){var a=new Vt(o+8+(n-i<<1));a.set(r),r=a}var c=e.charCodeAt(i);c<128||t?s(c):c<2048?(s(192|c>>>6),s(128|63&c)):c>55295&&c<57344?(s(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++i))>>>18),s(128|c>>>12&63),s(128|c>>>6&63),s(128|63&c)):(s(224|c>>>12),s(128|c>>>6&63),s(128|63&c))}return pn(r,0,o)}(JSON.stringify(t))),!0)};var En,Tn,Rn;function xn(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}let Nn;function Dn(){return Nn||(Nn=function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=xn(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}("keyval-store","keyval")),Nn}function Ln(e,t=Dn()){return t("readonly",(t=>xn(t.get(e))))}function _n(e,t,n=Dn()){return n("readwrite",(n=>new Promise(((r,o)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),r(xn(n.transaction))}catch(e){o(e)}}}))))}(Tn=En||(En={}))[Tn.NotStarted=0]="NotStarted",Tn[Tn.Running=1]="Running",Tn[Tn.Stopped=2]="Stopped",function(e){e.RECORDING="recording",e.SENT="sent"}(Rn||(Rn={}));var An="Session replay event batch rejected due to exceeded retry count",Pn="Failed to store session replay events in IndexedDB",Fn=function(e){var t=e.apiKey,n=e.loggerProvider,r=this;this.storageKey="",this.getAllSessionDataFromStore=function(){return a(r,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Ln(this.storageKey)];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(e)),[3,3];case 3:return[2,void 0]}}))}))},this.storeEventsForSession=function(e,t,n){return a(r,void 0,void 0,(function(){var r;return c(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,_n(this.storageKey,(function(r){var o,s;void 0===r&&(r={});var a=r[n]||i({},P);a.currentSequenceId=t;var c=a.sessionSequences&&a.sessionSequences[t]||{};return c.events=e,c.status=Rn.RECORDING,i(i({},r),((o={})[n]=i(i({},a),{sessionSequences:i(i({},a.sessionSequences),(s={},s[t]=c,s))}),o))}))];case 1:return o.sent(),[3,3];case 2:return r=o.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(r)),[3,3];case 3:return[2]}}))}))},this.cleanUpSessionEventsStore=function(e,t){return a(r,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,_n(this.storageKey,(function(n){void 0===n&&(n={});var r=n[e],o=(null==r?void 0:r.sessionSequences)&&r.sessionSequences[t];return o?(o.events=[],o.status=Rn.SENT,Object.entries(r.sessionSequences).forEach((function(e){var n=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}(e,2),o=n[0],s=n[1],i=parseInt(o,10);s.status===Rn.SENT&&t!==i&&delete r.sessionSequences[i]})),Object.keys(n).forEach((function(e){var t=parseInt(e,10);Date.now()-t>=2592e5&&delete n[t]})),n):n}))];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(n)),[3,3];case 3:return[2]}}))}))},this.loggerProvider=n,this.storageKey="".concat(A,"_").concat(t.substring(0,10))},Un=function(e,t){var n;return(null===(n=t.classList)||void 0===n?void 0:n.contains("amp-unmask"))?e:"*".repeat(e.length)},jn=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},qn=function(e,t){return"".concat(t,"/").concat(e)},Wn=function(){function e(e){var t=e.loggerProvider;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=t}return e.prototype.sendEventsList=function(e){this.addToQueue(i(i({},e),{attempts:0,timeout:0}))},e.prototype.getServerUrl=function(e){return e===o.STAGING?"https://api-sr.stag2.amplitude.com//sessions/v2/track":e===o.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track"},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.filter((function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"".concat(An,", batch sequence id, ").concat(t.sequenceId)}),!1)}));r.forEach((function(t){-1===e.queue.findIndex((function(e){return e.sequenceId===t.sequenceId}))&&(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),a(this,void 0,void 0,(function(){var t,n,r=this;return c(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){return void 0===t&&(t=!0),a(this,void 0,void 0,(function(){var n,r,o,s,i,a,l,u,d,h,p,f;return c(this,(function(c){switch(c.label){case 0:if(!(n=e.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(r=e.deviceId))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];m=R(),o=(null==m?void 0:m.location)?m.location.href:"",s="0.2.5",i=e.sampleRate,a=new URLSearchParams({device_id:r,session_id:"".concat(e.sessionId),seq_number:"".concat(e.sequenceId)}),l={version:1,events:e.events},c.label=1;case 1:return c.trys.push([1,3,,4]),u={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(n),"X-Client-Version":s,"X-Client-Url":o,"X-Client-Sample-Rate":"".concat(i)},body:JSON.stringify(l),method:"POST"},d="".concat(this.getServerUrl(e.serverZone),"?").concat(a.toString()),[4,fetch(d,u)];case 2:if(null===(h=c.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(h.status,e);else{p="";try{p=JSON.stringify(h.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(h.status,": ").concat(p)})}return[3,4];case 3:return f=c.sent(),this.completeRequest({context:e,err:f}),[3,4];case 4:return[2]}var m}))}))},e.prototype.handleReponse=function(e,t){switch((new y).buildStatus(e)){case s.Success:this.handleSuccessResponse(t);break;case s.Failed:this.handleOtherResponse(t);break;default:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"})}},e.prototype.handleSuccessResponse=function(e){var t;this.completeRequest({context:e,success:(t=e.sessionId,"Session replay event batch tracked successfully for session id ".concat(t))})},e.prototype.handleOtherResponse=function(e){this.addToQueue(i(i({},e),{timeout:e.attempts*this.retryTimeout}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(t.sessionId,t.sequenceId),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e}(),zn=function(){function e(e){var t=e.config,n=this;this.events=[],this.currentSequenceId=0,this.maxPersistedEventsSize=1e6,this.interval=500,this.timeAtLastSend=null,this.shouldSplitEventsList=function(e){var t=new Blob([e]).size;return new Blob(n.events).size+t>=n.maxPersistedEventsSize||!!(null!==n.timeAtLastSend&&Date.now()-n.timeAtLastSend>n.interval&&n.events.length)&&(n.interval=Math.min(1e4,n.interval+500),n.timeAtLastSend=Date.now(),!0)},this.config=t,this.trackDestination=new Wn({loggerProvider:this.config.loggerProvider}),this.sessionIDBStore=new Fn({loggerProvider:this.config.loggerProvider,apiKey:this.config.apiKey})}return e.prototype.initialize=function(e){var t=e.sessionId,n=e.deviceId,r=e.shouldSendStoredEvents,o=void 0!==r&&r;return a(this,void 0,void 0,(function(){var e,r,s,i;return c(this,(function(a){switch(a.label){case 0:return this.timeAtLastSend=Date.now(),[4,this.sessionIDBStore.getAllSessionDataFromStore()];case 1:return e=a.sent(),r=e&&e[t],e&&r&&r.sessionSequences&&(s=r.currentSequenceId,(i=r.sessionSequences[s])&&i.status!==Rn.RECORDING?(this.currentSequenceId=s+1,this.events=[]):(this.currentSequenceId=s,this.events=(null==i?void 0:i.events)||[])),o&&e&&this.sendStoredEvents({storedReplaySessions:e,deviceId:n,sessionId:t}),[2]}}))}))},e.prototype.sendStoredEvents=function(e){var t=e.storedReplaySessions,n=e.sessionId,r=e.deviceId;for(var o in t){var s=t[o].sessionSequences;for(var i in s){var a=s[i],c=parseInt(i,10),l=parseInt(o,10);l===n&&c===this.currentSequenceId||a.events&&a.events.length&&a.status===Rn.RECORDING&&this.sendEventsList({events:a.events,sequenceId:c,sessionId:l,deviceId:r})}}},e.prototype.resetSequence=function(){this.events=[],this.currentSequenceId=0},e.prototype.addEvent=function(e){var t=e.event,n=e.sessionId,r=e.deviceId;this.shouldSplitEventsList(t)&&(this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:n,deviceId:r}),this.events=[],this.currentSequenceId++),this.events.push(t),this.sessionIDBStore.storeEventsForSession(this.events,this.currentSequenceId,n)},e.prototype.sendEvents=function(e){var t=e.sessionId,n=e.deviceId;this.events.length&&t&&this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:t,deviceId:n})},e.prototype.sendEventsList=function(e){var t=e.events,n=e.sequenceId,r=e.sessionId,o=e.deviceId;this.trackDestination.sendEventsList({events:t,sequenceId:n,sessionId:r,flushMaxRetries:this.config.flushMaxRetries,apiKey:this.config.apiKey,deviceId:o,sampleRate:this.config.sampleRate,serverZone:this.config.serverZone,onComplete:this.sessionIDBStore.cleanUpSessionEventsStore.bind(this.sessionIDBStore)})},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){return c(this,(function(t){return this.trackDestination?[2,this.trackDestination.flush(e)]:[2]}))}))},e}(),Bn=function(e,t){this.deviceId=e.deviceId,this.sessionId=e.sessionId,e.sessionId&&e.deviceId?this.sessionReplayId=qn(e.sessionId,e.deviceId):t.error("Please provide both sessionId and deviceId.")},Gn=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.blurListener=function(){e.stopRecordingAndSendEvents()},this.focusListener=function(){e.initialize()},this.stopRecordingEvents=function(){try{e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null}catch(n){var t=n;e.loggerProvider.warn("Error occurred while stopping recording: ".concat(t.toString()))}},this.loggerProvider=new d}return e.prototype.init=function(e,t){return{promise:this._init(e,t)||Promise.resolve()}},e.prototype._init=function(e,t){return a(this,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return this.config=new U(e,t),this.loggerProvider=this.config.loggerProvider,this.identifiers=new Bn(t,this.loggerProvider),this.eventsManager=new zn({config:this.config}),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),(n=R())&&(n.removeEventListener("blur",this.blurListener),n.removeEventListener("focus",this.focusListener),n.addEventListener("blur",this.blurListener),n.addEventListener("focus",this.focusListener)),n&&n.document&&n.document.hasFocus()?[4,this.initialize(!0)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.prototype.setSessionId=function(e,t){if(this.identifiers){t&&(this.identifiers.deviceId=t);var n=this.getDeviceId();e&&n?(this.identifiers.sessionReplayId=qn(e,n),this.stopRecordingAndSendEvents(this.identifiers.sessionId),this.identifiers.sessionId=e,this.eventsManager&&this.eventsManager.resetSequence(),this.recordEvents()):this.loggerProvider.error("Must provide either session replay id or session id when starting a new session.")}else this.loggerProvider.error("Session replay init has not been called, cannot set session id.")},e.prototype.getSessionReplayDebugPropertyValue=function(){var e="";return this.config&&(e=jn(this.config.apiKey).toString()),JSON.stringify({appHash:e})},e.prototype.getSessionReplayProperties=function(){var e;if(!this.config||!this.identifiers)return this.loggerProvider.error("Session replay init has not been called, cannot get session recording properties."),{};var t=!!this.config.debugMode;if(this.getShouldRecord(t)){var n=((e={})[D]=this.identifiers.sessionReplayId?this.identifiers.sessionReplayId:null,e);return this.config.debugMode&&(n[_]=this.getSessionReplayDebugPropertyValue()),n}return{}},e.prototype.stopRecordingAndSendEvents=function(e){var t;this.stopRecordingEvents();var n=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),r=this.getDeviceId();this.eventsManager&&n&&r&&this.eventsManager.sendEvents({sessionId:n,deviceId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(n=this.getDeviceId(),this.eventsManager&&n?[4,this.eventsManager.initialize({sessionId:this.identifiers.sessionId,shouldSendStoredEvents:e,deviceId:n})]:[3,2]):(this.loggerProvider.warn("Session is not being recorded due to lack of session id."),[2]);case 1:r.sent(),r.label=2;case 2:return this.recordEvents(),[2]}}))}))},e.prototype.shouldOptOut=function(){var e,t,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=T(this.config.instanceName).identityStore.getIdentity().optOut);return void 0!==n?n:null===(t=this.config)||void 0===t?void 0:t.optOut},e.prototype.getShouldRecord=function(e){if(void 0===e&&(e=!1),!this.identifiers||!this.config)return this.loggerProvider.error("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;var t=R();if(!e&&t&&t.document&&!t.document.hasFocus())return this.identifiers.sessionId&&this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," temporarily not recording due to lack of browser focus.")),!1;if(this.shouldOptOut())return this.identifiers.sessionId&&this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;if(!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of session id."),!1;var n,r,o,s=(n=this.identifiers.sessionId,r=this.config.sampleRate,o=jn(n.toString()),31*Math.abs(o)%100/100<r);return s||this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate.")),s},e.prototype.getBlockSelectors=function(){var e,t;return null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.blockSelector},e.prototype.recordEvents=function(){var e,t=this,n=this.getShouldRecord(),r=null===(e=this.identifiers)||void 0===e?void 0:e.sessionId;n&&r&&(this.stopRecordingEvents(),this.recordCancelCallback=Bt({emit:function(e){var n=R();if(n&&n.document&&!n.document.hasFocus()||!t.getShouldRecord())t.stopRecordingAndSendEvents();else{var o=JSON.stringify(e),s=t.getDeviceId();s&&t.eventsManager&&t.eventsManager.addEvent({event:o,sessionId:r,deviceId:s})}},packFn:On,maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",blockSelector:this.getBlockSelectors(),maskInputFn:Un,recordCanvas:!1,errorHandler:function(e){var n=e;return t.loggerProvider.warn("Error while recording: ",n.toString()),!0}}))},e.prototype.getDeviceId=function(){var e,t,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=T(this.config.instanceName).identityStore.getIdentity().deviceId);return n||(null===(t=this.identifiers)||void 0===t?void 0:t.deviceId)},e.prototype.getSessionId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.sessionId},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){return c(this,(function(t){return this.eventsManager?[2,this.eventsManager.flush(e)]:[2]}))}))},e.prototype.shutdown=function(){var e=R();e&&(e.removeEventListener("blur",this.blurListener),e.removeEventListener("focus",this.focusListener)),this.stopRecordingAndSendEvents()},e}(),Hn=function(e){return function(){var t=e.config||F();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Vn=function(){var e=new Gn;return{init:g(e.init.bind(e),"init",Hn(e)),setSessionId:g(e.setSessionId.bind(e),"setSessionId",Hn(e)),getSessionId:g(e.getSessionId.bind(e),"getSessionId",Hn(e)),getSessionReplayProperties:g(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Hn(e)),flush:g(e.flush.bind(e),"flush",Hn(e)),shutdown:g(e.shutdown.bind(e),"shutdown",Hn(e))}}(),Kn=Vn.init,Zn=Vn.setSessionId,$n=Vn.getSessionId,Jn=Vn.getSessionReplayProperties,Yn=Vn.flush,Xn=Vn.shutdown,Qn="@amplitude/plugin-session-replay-enrichment-browser",er=function(){function e(){this.name=Qn,this.type="enrichment"}return e.prototype.setup=function(e,t){return a(this,void 0,void 0,(function(){return c(this,(function(t){return this.config=e,[2]}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){return this.config.sessionId&&this.config.sessionId!==$n()&&Zn(this.config.sessionId),this.config.sessionId&&this.config.sessionId===e.session_id&&(t=Jn(),e.event_properties=i(i({},e.event_properties),t)),[2,Promise.resolve(e)]}))}))},e}(),tr=function(){function e(e){this.name="@amplitude/plugin-session-replay-browser",this.type="destination",this.options=i({},e),!1!==this.options.forceSessionTracking&&(this.options.forceSessionTracking=!0)}return e.prototype.setup=function(e,t){var n;return a(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return t?(e.loggerProvider.log("Installing @amplitude/plugin-session-replay."),this.client=t,this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=i(i({},e.defaultTracking),{sessions:!0})),[4,Kn(e.apiKey,{instanceName:this.config.instanceName,deviceId:this.config.deviceId,optOut:this.config.optOut,sessionId:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null===(n=this.options.privacyConfig)||void 0===n?void 0:n.blockSelector},debugMode:this.options.debugMode}).promise]):(e.loggerProvider.error("SessionReplayPlugin requires v1.9.1+ of the Amplitude SDK."),[2]);case 1:return r.sent(),[4,t.add(new er).promise];case 2:return r.sent(),[2]}}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){return[2,Promise.resolve({event:e,code:200,message:"success"})]}))}))},e.prototype.flush=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,Yn(!1)];case 1:return e.sent(),[2]}}))}))},e.prototype.teardown=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this.client.remove(Qn).promise];case 1:return e.sent(),Xn(),this.config=null,this.client=null,[2]}}))}))},e.prototype.getSessionReplayProperties=function(){return Jn()},e}(),nr=function(e){return new tr(e)};return e.plugin=nr,e.sessionReplayPlugin=nr,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
Binary file
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";var t=function(e,n){return t=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])},t(e,n)};function n(e,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=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,o,s,i=function(){return i=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},i.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}function c(e,t){var n,r,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),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(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"}(r||(r={})),function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(o||(o={})),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"}(s||(s={}));var l="https://api2.amplitude.com/2/httpapi",u="Amplitude Logger ",d=function(){function e(){this.logLevel=r.None}return e.prototype.disable=function(){this.logLevel=r.None},e.prototype.enable=function(e){void 0===e&&(e=r.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Verbose||console.log("".concat(u,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Warn||console.warn("".concat(u,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Error||console.error("".concat(u,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Debug||console.log("".concat(u,"[Debug]: ").concat(e.join(" ")))},e}(),h=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:r.Warn,loggerProvider:new d,optOut:!1,serverUrl:l,serverZone:o.US,useBatch:!1}},p=function(){function e(e){var t,n,r,o;this._optOut=!1;var s=h();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(o=e.useBatch)&&void 0!==o?o:s.useBatch,this.loggerProvider.enable(this.logLevel);var i=m(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=i.serverZone,this.serverUrl=i.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),f=function(e,t){return e===o.EU?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":l},m=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=h().serverZone),void 0===n&&(n=h().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:h().serverZone;return{serverZone:r,serverUrl:f(r,n)}},v=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},g=function(e,t,n,o,s){return void 0===s&&(s=null),function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var c=n(),l=c.logger,u=c.logLevel;if(u&&u<r.Debug||!u||!l)return e.apply(s,i);var d={type:"invoke public method",name:t,args:i,stacktrace:v(1),time:{start:(new Date).toISOString()},states:{}};o&&d.states&&(d.states.before=o());var h=e.apply(s,i);return h&&h.promise?h.promise.then((function(){o&&d.states&&(d.states.after=o()),d.time&&(d.time.end=(new Date).toISOString()),l.debug(JSON.stringify(d,null,2))})):(o&&d.states&&(d.states.after=o()),d.time&&(d.time.end=(new Date).toISOString()),l.debug(JSON.stringify(d,null,2))),h}},y=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,a,c,l,u,d,h,p,f,m,v,g,y,S,b,I,w,M;if("object"!=typeof e)return null;var C=e.code||0,k=this.buildStatus(C);switch(k){case s.Success:return{status:k,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 s.Invalid:return{status:k,statusCode:C,body:{error:null!==(o=e.error)&&void 0!==o?o:"",missingField:null!==(i=e.missing_field)&&void 0!==i?i:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(c=e.events_with_missing_fields)&&void 0!==c?c:{},eventsWithInvalidIdLengths:null!==(l=e.events_with_invalid_id_lengths)&&void 0!==l?l:{},epsThreshold:null!==(u=e.eps_threshold)&&void 0!==u?u:0,exceededDailyQuotaDevices:null!==(d=e.exceeded_daily_quota_devices)&&void 0!==d?d:{},silencedDevices:null!==(h=e.silenced_devices)&&void 0!==h?h:[],silencedEvents:null!==(p=e.silenced_events)&&void 0!==p?p:[],throttledDevices:null!==(f=e.throttled_devices)&&void 0!==f?f:{},throttledEvents:null!==(m=e.throttled_events)&&void 0!==m?m:[]}};case s.PayloadTooLarge:return{status:k,statusCode:C,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case s.RateLimit:return{status:k,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!==(S=e.throttled_devices)&&void 0!==S?S:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(M=e.throttled_events)&&void 0!==M?M:[]}};case s.Timeout:default:return{status:k,statusCode:C}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?s.Success:429===e?s.RateLimit:413===e?s.PayloadTooLarge:408===e?s.Timeout:e>=400&&e<500?s.Invalid:e>=500?s.Failed:s.Unknown},e}(),S=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:b(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),b=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}(),w=function(){return w=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},w.apply(this,arguments)},M=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var r=0,o=["string","number","boolean","undefined"];r<o.length;r++){if(o[r]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),i=Array.isArray(t);if(s!==i)return!1;if(!s||!i){var a=Object.keys(e).sort(),c=Object.keys(t).sort();if(!M(a,c))return!1;var l=!0;return Object.keys(e).forEach((function(n){M(e[n],t[n])||(l=!1)})),l}for(var u=0;u<e.length;u++)if(!M(e[u],t[u]))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 C,k=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=w({},this.identity.userProperties),n=w(w({},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){for(var t=n.userProperties||{},r=0,o=Object.entries(e);r<o.length;r++){var s=o[r],i=s[0],a=s[1];switch(i){case"$set":for(var c=0,l=Object.entries(a);c<l.length;c++){var u=l[c],d=u[0],h=u[1];t[d]=h}break;case"$unset":for(var p=0,f=Object.keys(a);p<f.length;p++){delete t[d=f[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return w({},this.identity)},e.prototype.setIdentity=function(e){var t=w({},this.identity);this.identity=w({},e),M(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}(),O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,E=function(){function e(){this.identityStore=new k,this.eventBridge=new I,this.applicationContextProvider=new S}return e.getInstance=function(t){return O.analyticsConnectorInstances||(O.analyticsConnectorInstances={}),O.analyticsConnectorInstances[t]||(O.analyticsConnectorInstances[t]=new e),O.analyticsConnectorInstances[t]},e}(),T=function(e){return void 0===e&&(e="$default_instance"),E.getInstance(e)},R=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},x=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,(function(){var n,r;return c(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,o.sent().json()];case 2:return r=o.sent(),[2,this.buildResponse(r)]}}))}))},t}(y),N="[Amplitude]",D="".concat(N," Session Replay ID"),L=o.US,_="".concat(N," Session Replay Debug"),A="".concat("AMP","_replay_unsent"),P={currentSequenceId:0,sessionSequences:{}},F=function(){return{flushMaxRetries:2,logLevel:r.Warn,loggerProvider:new d,transportProvider:new x}},U=function(e){function t(t,n){var r=this,o=F();return(r=e.call(this,i(i({transportProvider:o.transportProvider},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=o.flushMaxRetries?n.flushMaxRetries:o.flushMaxRetries,r.apiKey=t,r.sampleRate=n.sampleRate||0,r.serverZone=n.serverZone||L,n.privacyConfig&&(r.privacyConfig=n.privacyConfig),n.debugMode&&(r.debugMode=n.debugMode),r}return n(t,e),t}(p);function j(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function q(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function W(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t,z).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function z(e){var t,n,r;if(function(e){return"styleSheet"in e}(e))try{t=W(e.styleSheet)||function(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url(".concat(JSON.stringify(e.href),")")];return""===e.layerName?n.push("layer"):e.layerName&&n.push("layer(".concat(e.layerName,")")),e.supportsText&&n.push("supports(".concat(e.supportsText,")")),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return n=e.cssText,r=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,n.replace(r,"$1\\$2");return t||e.cssText}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(C||(C={}));var B=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function G(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,o=e.type,s=e.value,i=e.maskInputFn,a=s||"",c=o&&H(o);return(n[r.toLowerCase()]||c&&n[c])&&(a=i?i(a,t):"*".repeat(a.length)),a}function H(e){return e.toLowerCase()}var V="__rrweb_original__";function K(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?H(t):null}var Z,$,J=1,Y=new RegExp("[^a-z0-9-_:]");function X(){return J++}var Q=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ee=/^(?:[a-z+]+:)?\/\//i,te=/^www\..*/i,ne=/^(data:)([^,]*),(.*)/i;function re(e,t){return(e||"").replace(Q,(function(e,n,r,o,s,i){var a,c=r||s||i,l=n||o||"";if(!c)return e;if(ee.test(c)||te.test(c))return"url(".concat(l).concat(c).concat(l,")");if(ne.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var h=0,p=d;h<p.length;h++){var f=p[h];"."!==f&&(".."===f?u.pop():u.push(f))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var oe=/^[^ \t\n\r\u000c]+/,se=/^[, \t\n\r\u000c]+/;function ie(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function ae(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ce(){var e=document.createElement("a");return e.href="",e.href}function le(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?ie(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}for(var o=[];r(se),!(n>=t.length);){var s=r(oe);if(","===s.slice(-1))s=ie(e,s.substring(0,s.length-1)),o.push(s);else{var i="";s=ie(e,s);for(var a=!1;;){var c=t.charAt(n);if(""===c){o.push((s+i).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,o.push((s+i).trim());break}"("===c&&(a=!0)}i+=c,n+=1}}}return o.join(", ")}(e,r):"style"===n?re(r,ce()):"object"===t&&"data"===n?ie(e,r):r:ie(e,r):r}function ue(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function de(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&de(e.parentNode,t,n);for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return!!n&&de(e.parentNode,t,n)}function he(e,t,n){try{var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(r.closest(".".concat(t)))return!0}else if(de(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}}catch(e){}return!1}function pe(e,t){var n=t.doc,r=t.mirror,o=t.blockClass,s=t.blockSelector,i=t.maskTextClass,a=t.maskTextSelector,c=t.inlineStylesheet,l=t.maskInputOptions,u=void 0===l?{}:l,d=t.maskTextFn,h=t.maskInputFn,p=t.dataURLOptions,f=void 0===p?{}:p,m=t.inlineImages,v=t.recordCanvas,g=t.keepIframeSrcFn,y=t.newlyAddedElement,S=void 0!==y&&y,b=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:C.Document,childNodes:[],compatMode:e.compatMode}:{type:C.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:C.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.blockClass,o=t.blockSelector,s=t.inlineStylesheet,i=t.maskInputOptions,a=void 0===i?{}:i,c=t.maskInputFn,l=t.dataURLOptions,u=void 0===l?{}:l,d=t.inlineImages,h=t.recordCanvas,p=t.keepIframeSrcFn,f=t.newlyAddedElement,m=void 0!==f&&f,v=t.rootId,g=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,o),y=function(e){if(e instanceof HTMLFormElement)return"form";var t=H(e.tagName);return Y.test(t)?"div":t}(e),S={},b=e.attributes.length,I=0;I<b;I++){var w=e.attributes[I];ue(y,w.name,w.value)||(S[w.name]=le(n,y,H(w.name),w.value))}if("link"===y&&s){var M=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),k=null;M&&(k=W(M)),k&&(delete S.rel,delete S.href,S._cssText=re(k,M.href))}if("style"===y&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(k=W(e.sheet))&&(S._cssText=re(k,ce()))}if("input"===y||"textarea"===y||"select"===y){var O=e.value,E=e.checked;if("radio"!==S.type&&"checkbox"!==S.type&&"submit"!==S.type&&"button"!==S.type&&O){var T=K(e);S.value=G({element:e,type:T,tagName:y,value:O,maskInputOptions:a,maskInputFn:c})}else E&&(S.checked=E)}"option"===y&&(e.selected&&!a.select?S.selected=!0:delete S.selected);if("canvas"===y&&h)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var o=t.getImageData,s=V in o?o[V]:o;if(new Uint32Array(s.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(e)||(S.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var R=e.toDataURL(u.type,u.quality),x=document.createElement("canvas");x.width=e.width,x.height=e.height,R!==x.toDataURL(u.type,u.quality)&&(S.rr_dataURL=R)}if("img"===y&&d){Z||(Z=n.createElement("canvas"),$=Z.getContext("2d"));var N=e,D=N.crossOrigin;N.crossOrigin="anonymous";var L=function(){N.removeEventListener("load",L);try{Z.width=N.naturalWidth,Z.height=N.naturalHeight,$.drawImage(N,0,0),S.rr_dataURL=Z.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(N.currentSrc,"! Error: ").concat(e))}D?S.crossOrigin=D:N.removeAttribute("crossorigin")};N.complete&&0!==N.naturalWidth?L():N.addEventListener("load",L)}"audio"!==y&&"video"!==y||(S.rr_mediaState=e.paused?"paused":"played",S.rr_mediaCurrentTime=e.currentTime);m||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop));if(g){var _=e.getBoundingClientRect(),A=_.width,P=_.height;S={class:S.class,rr_width:"".concat(A,"px"),rr_height:"".concat(P,"px")}}"iframe"!==y||p(S.src)||(e.contentDocument||(S.rr_src=S.src),delete S.src);return{type:C.Element,tagName:y,attributes:S,childNodes:[],isSVG:ae(e)||void 0,needBlock:g,rootId:v}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:f,inlineImages:m,recordCanvas:v,keepIframeSrcFn:g,newlyAddedElement:S,rootId:b});case e.TEXT_NODE:return function(e,t){var n,r=t.maskTextClass,o=t.maskTextSelector,s=t.maskTextFn,i=t.rootId,a=e.parentNode&&e.parentNode.tagName,c=e.textContent,l="STYLE"===a||void 0,u="SCRIPT"===a||void 0;if(l&&c){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(c=W(e.parentNode.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=re(c,ce())}u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&he(e,r,o)&&(c=s?s(c,e.parentElement):c.replace(/[\S]/g,"*"));return{type:C.Text,textContent:c||"",isStyle:l,rootId:i}}(e,{maskTextClass:i,maskTextSelector:a,maskTextFn:d,rootId:b});case e.CDATA_SECTION_NODE:return{type:C.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:C.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function fe(e){return null==e?"":e.toLowerCase()}function me(e,t){var n,r=t.doc,o=t.mirror,s=t.blockClass,i=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,d=t.inlineStylesheet,h=void 0===d||d,p=t.maskInputOptions,f=void 0===p?{}:p,m=t.maskTextFn,v=t.maskInputFn,g=t.slimDOMOptions,y=t.dataURLOptions,S=void 0===y?{}:y,b=t.inlineImages,I=void 0!==b&&b,w=t.recordCanvas,M=void 0!==w&&w,k=t.onSerialize,O=t.onIframeLoad,E=t.iframeLoadTimeout,T=void 0===E?5e3:E,R=t.onStylesheetLoad,x=t.stylesheetLoadTimeout,N=void 0===x?5e3:x,D=t.keepIframeSrcFn,L=void 0===D?function(){return!1}:D,_=t.newlyAddedElement,A=void 0!==_&&_,P=t.preserveWhiteSpace,F=void 0===P||P,U=pe(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,dataURLOptions:S,inlineImages:I,recordCanvas:M,keepIframeSrcFn:L,newlyAddedElement:A});if(!U)return console.warn(e,"not serialized"),null;n=o.hasNode(e)?o.getId(e):!function(e,t){if(t.comment&&e.type===C.Comment)return!0;if(e.type===C.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(fe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===fe(e.attributes.name)||"icon"===fe(e.attributes.rel)||"apple-touch-icon"===fe(e.attributes.rel)||"shortcut icon"===fe(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&fe(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(fe(e.attributes.property).match(/^(og|twitter|fb):/)||fe(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===fe(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===fe(e.attributes.name)||"googlebot"===fe(e.attributes.name)||"bingbot"===fe(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===fe(e.attributes.name)||"generator"===fe(e.attributes.name)||"framework"===fe(e.attributes.name)||"publisher"===fe(e.attributes.name)||"progid"===fe(e.attributes.name)||fe(e.attributes.property).match(/^article:/)||fe(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===fe(e.attributes.name)||"yandex-verification"===fe(e.attributes.name)||"csrf-token"===fe(e.attributes.name)||"p:domain_verify"===fe(e.attributes.name)||"verify-v1"===fe(e.attributes.name)||"verification"===fe(e.attributes.name)||"shopify-checkout-api-token"===fe(e.attributes.name)))return!0}}return!1}(U,g)&&(F||U.type!==C.Text||U.isStyle||U.textContent.replace(/^\s+|\s+$/gm,"").length)?X():-2;var W=Object.assign(U,{id:n});if(o.add(e,W),-2===n)return null;k&&k(e);var z=!u;if(W.type===C.Element){z=z&&!W.needBlock,delete W.needBlock;var B=e.shadowRoot;B&&q(B)&&(W.isShadowHost=!0)}if((W.type===C.Document||W.type===C.Element)&&z){g.headWhitespace&&W.type===C.Element&&"head"===W.tagName&&(F=!1);for(var G={doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L},H=0,V=Array.from(e.childNodes);H<V.length;H++){($=me(V[H],G))&&W.childNodes.push($)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var K=0,Z=Array.from(e.shadowRoot.childNodes);K<Z.length;K++){var $;($=me(Z[K],G))&&(q(e.shadowRoot)&&($.isShadow=!0),W.childNodes.push($))}}return e.parentNode&&j(e.parentNode)&&q(e.parentNode)&&(W.isShadow=!0),W.type===C.Element&&"iframe"===W.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"===o){var i="about:blank";if(r.location.href!==i||e.src===i||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout((function(){s||(t(),s=!0)}),n);e.addEventListener("load",(function(){clearTimeout(a),s=!0,t()}))}}}(e,(function(){var t=e.contentDocument;if(t&&O){var n=me(t,{doc:t,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L});n&&O(e,n)}}),T),W.type===C.Element&&"link"===W.tagName&&"stylesheet"===W.attributes.rel&&function(e,t,n){var r,o=!1;try{r=e.sheet}catch(e){return}if(!r){var s=setTimeout((function(){o||(t(),o=!0)}),n);e.addEventListener("load",(function(){clearTimeout(s),o=!0,t()}))}}(e,(function(){if(R){var t=me(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L});t&&R(e,t)}}),N),W}var ve=(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))(ve||{}),ge=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(ge||{}),ye=(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))(ye||{}),Se=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Se||{}),be=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(be||{});function Ie(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const we="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Me={map:{},getId:()=>(console.error(we),-1),getNode:()=>(console.error(we),null),removeNodeFromMap(){console.error(we)},has:()=>(console.error(we),!1),reset(){console.error(we)}};function Ce(e,t,n={}){let r=null,o=0;return function(...s){const i=Date.now();o||!1!==n.leading||(o=i);const a=t-(i-o),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),o=i,e.apply(c,s)):r||!1===n.trailing||(r=setTimeout((()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(c,s)}),a))}}function ke(e,t,n,r,o=window){const s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>ke(e,t,s||{},!0)}function Oe(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch(e){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Me=new Proxy(Me,{get:(e,t,n)=>("map"===t&&console.error(we),Reflect.get(e,t,n))}));let Ee,Te=Date.now;function Re(e){var t,n,r,o,s,i;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null===(n=null===(t=null==a?void 0:a.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==a?void 0:a.body)||void 0===r?void 0:r.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null===(s=null===(o=null==a?void 0:a.body)||void 0===o?void 0:o.parentElement)||void 0===s?void 0:s.scrollTop)||(null===(i=null==a?void 0:a.body)||void 0===i?void 0:i.scrollTop)||0}}function xe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ne(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function De(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function Le(e,t,n,r){if(!e)return!1;const o=De(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(de(o,t,r))return!0}catch(e){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1}function _e(e,t){return-2===t.getId(e)}function Ae(e,t){if(j(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Ae(e.parentNode,t))}function Pe(e){return Boolean(e.changedTouches)}function Fe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ue(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function je(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Te=()=>(new Date).getTime());class qe{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function We(e){var t,n;let r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function ze(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=We(n);)n=t;return n}(e);return t.contains(n)}function Be(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||ze(e))}function Ge(e){Ee=e}function He(){Ee=void 0}const Ve=e=>{if(!Ee)return e;return(...t)=>{try{return e(...t)}catch(e){if(Ee&&!0===Ee(e))return;throw e}}};class Ke{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),s=r||this.getRemoteIdToIdMap(e);let i=o.get(t);return i||(i=this.generateIdFn(),o.set(t,i),s.set(i,t)),i}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,r)))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const o=r.get(t);return o||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Ze{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ke(X),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ke(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case ve.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:ve.IncrementalSnapshot,data:{source:ge.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ve.Meta:case ve.Load:case ve.DomContentLoaded:return!1;case ve.Plugin:return t;case ve.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case ve.IncrementalSnapshot:switch(t.data.source){case ge.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case ge.Drag:case ge.TouchMove:case ge.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case ge.ViewportResize:return!1;case ge.MediaInteraction:case ge.MouseInteraction:case ge.Scroll:case ge.CanvasMutation:case ge.Input:return this.replaceIds(t.data,e,["id"]),t;case ge.StyleSheetRule:case ge.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ge.Font:return t;case ge.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case ge.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(n,t[o]):t[o]=e.getId(n,t[o]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===C.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}function $e(e){return"__ln"in e}class Je{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$e(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&$e(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Ye=(e,t)=>`${e}@${t}`;class Xe{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new Je,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{if(!o.parentNode||!Be(o))return;const s=j(o.parentNode)?this.mirror.getId(We(o)):this.mirror.getId(o.parentNode),i=r(o);if(-1===s||-1===i)return n.addNode(o);const a=me(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Fe(e,this.mirror)&&this.iframeManager.addIframe(e),Ue(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),je(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});a&&(e.push({parentId:s,nextId:i,node:a}),t.add(a.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)et(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)nt(this.droppedSet,e)||et(this.removes,e,this.mirror)?nt(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;n.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),n=r(s.value);-1!==t&&-1!==n&&(e=s)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}s=e.previous,n.removeNode(e.value),o(e.value)}const i={texts:this.texts.map((e=>({id:this.mirror.getId(e.node),value:e.value}))).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(i.texts.length||i.attributes.length||i.removes.length||i.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(i))},this.processMutation=e=>{if(!_e(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;Le(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:he(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t,De(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=K(t);r=G({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(Le(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let o=this.attributes.find((t=>t.node===e.target));if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;n="rr_src"}if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!ue(t.tagName,n)&&(o.attributes[n]=le(this.doc,H(t.tagName),H(n),r),"style"===n)){let n;try{n=document.implementation.createHTMLDocument()}catch(e){n=this.doc}const r=n.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const n=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);n!==r.style.getPropertyValue(e)||s!==r.style.getPropertyPriority(e)?o.styleDiff[e]=""===s?n:[n,s]:o._unchangedStyles[e]=[n,s]}for(const e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(o.styleDiff[e]=!1)}break}case"childList":if(Le(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),r=j(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Le(e.target,this.blockClass,this.blockSelector,!1)||_e(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Qe(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Ae(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ye(n,r)]?Qe(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!j(e.target)||!q(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(_e(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Ye(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Le(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),je(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Qe(e,t){e.delete(t),t.childNodes.forEach((t=>Qe(e,t)))}function et(e,t,n){return 0!==e.length&&tt(e,t,n)}function tt(e,t,n){const{parentNode:r}=t;if(!r)return!1;const o=n.getId(r);return!!e.some((e=>e.id===o))||tt(e,r,n)}function nt(e,t){return 0!==e.size&&rt(e,t)}function rt(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||rt(e,n))}const ot=[];function st(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function it(e,t){var n,r;const o=new Xe;ot.push(o),o.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const i=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");i&&window[i]&&(s=window[i]);const a=new s(Ve(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function at({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const i=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,a=[];let c=null;return Object.keys(ye).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{let i=H(s);const l=(t=>s=>{const i=st(s);if(Le(i,r,o,!0))return;let a=null,l=t;if("pointerType"in s){switch(s.pointerType){case"mouse":a=Se.Mouse;break;case"touch":a=Se.Touch;break;case"pen":a=Se.Pen}a===Se.Touch?ye[t]===ye.MouseDown?l="TouchStart":ye[t]===ye.MouseUp&&(l="TouchEnd"):Se.Pen}else Pe(s)&&(a=Se.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===Se.Touch||l.startsWith("Mouse")&&a===Se.Mouse)&&(a=null)):ye[t]===ye.Click&&(a=c,c=null);const u=Pe(s)?s.changedTouches[0]:s;if(!u)return;const d=n.getId(i),{clientX:h,clientY:p}=u;Ve(e)(Object.assign({type:ye[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(s);if(window.PointerEvent)switch(ye[s]){case ye.MouseDown:case ye.MouseUp:i=i.replace("mouse","pointer");break;case ye.TouchStart:case ye.TouchEnd:return}a.push(Ie(i,l,t))})),Ve((()=>{a.forEach((e=>e()))}))}function ct({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){return Ie("scroll",Ve(Ce(Ve((s=>{const i=st(s);if(!i||Le(i,r,o,!0))return;const a=n.getId(i);if(i===t&&t.defaultView){const n=Re(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:i.scrollLeft,y:i.scrollTop})})),s.scroll||100)),t)}function lt(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const ut=["INPUT","TEXTAREA","SELECT"],dt=new WeakMap;function ht(e){return function(e,t){if(vt("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||vt("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||vt("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||vt("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function pt(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function ft({mirror:e,stylesheetManager:t},n){var r,o,s;let i=null;i="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(s=null===(o=n.ownerDocument)||void 0===o?void 0:o.defaultView)||void 0===s?void 0:s.ShadowRoot,c=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==i&&-1!==i&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const r=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==i&&-1!==i)try{t.adoptStyleSheets(e,i)}catch(e){}return r}}),Ve((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function mt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:i,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),o(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),i(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)}}(e,t),e.recordDOM&&(r=it(e,e.doc));const o=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const o="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let i,a=[];const c=Ce(Ve((t=>{const n=Date.now()-i;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],i=null})),s),l=Ve(Ce(Ve((e=>{const t=st(e),{clientX:n,clientY:o}=Pe(e)?e.changedTouches[0]:e;i||(i=Te()),a.push({x:n,y:o,id:r.getId(t),timeOffset:Te()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?ge.Drag:e instanceof MouseEvent?ge.MouseMove:ge.TouchMove)})),o,{trailing:!1})),u=[Ie("mousemove",l,n),Ie("touchmove",l,n),Ie("drag",l,n)];return Ve((()=>{u.forEach((e=>e()))}))}(e),s=at(e),i=ct(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return Ie("resize",Ve(Ce(Ve((()=>{const t=xe(),o=Ne();n===t&&r===o||(e({width:Number(o),height:Number(t)}),n=t,r=o)})),200)),t)}(e,{win:n}),c=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:s,ignoreSelector:i,maskInputOptions:a,maskInputFn:c,sampling:l,userTriggeredOnInput:u}){function d(e){let n=st(e);const l=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||ut.indexOf(d)<0||Le(n,r,o,!0))return;if(n.classList.contains(s)||i&&n.matches(i))return;let p=n.value,f=!1;const m=K(n)||"";"radio"===m||"checkbox"===m?f=n.checked:(a[d.toLowerCase()]||a[m])&&(p=G({element:n,maskInputOptions:a,tagName:d,type:m,value:p,maskInputFn:c})),h(n,Ve(lt)({text:p,isChecked:f,userTriggered:l},u));const v=n.name;"radio"===m&&v&&f&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach((e=>{e!==n&&h(e,Ve(lt)({text:e.value,isChecked:!f,userTriggered:!1},u))}))}function h(t,r){const o=dt.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){dt.set(t,r);const o=n.getId(t);Ve(e)(Object.assign(Object.assign({},r),{id:o}))}}const p=("last"===l.input?["change"]:["input","change"]).map((e=>Ie(e,Ve(d),t))),f=t.defaultView;if(!f)return()=>{p.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),v=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&p.push(...v.map((e=>ke(e[0],e[1],{set(){Ve(d)({target:this,isTrusted:!1})}},!1,f)))),Ve((()=>{p.forEach((e=>e()))}))}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){const i=Ve((s=>Ce(Ve((o=>{const i=st(o);if(!i||Le(i,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:u}=i;e({type:s,id:r.getId(i),currentTime:a,volume:c,muted:l,playbackRate:u})})),o.media||500))),a=[Ie("play",i(0),s),Ie("pause",i(1),s),Ie("seeked",i(2),s),Ie("volumechange",i(3),s),Ie("ratechange",i(4),s)];return Ve((()=>{a.forEach((e=>e()))}))}(e);let u=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Ve(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=pt(o,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:a}]}),r.apply(o,s)}))});const s=r.CSSStyleSheet.prototype.deleteRule;let i,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:i}]}),r.apply(o,s)}))}),r.CSSStyleSheet.prototype.replace&&(i=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:i}),r.apply(o,s)}))})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:i}),r.apply(o,s)}))}));const c={};gt("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(gt("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),gt("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),gt("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach((([r,o])=>{l[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(l[r].insertRule,{apply:Ve(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=pt(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:[...ht(o),a||0]}]}),r.apply(o,s)}))}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...ht(o),i]}]}),r.apply(o,s)}))})})),Ve((()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=s,i&&(r.CSSStyleSheet.prototype.replace=i),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),d=ft(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:Ve(((o,i,a)=>{var c;const[l,u,d]=a;if(n.has(l))return s.apply(i,[l,u,d]);const{id:h,styleId:p}=pt(null===(c=i.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:l,value:u,priority:d},index:ht(i.parentRule)}),o.apply(i,a)}))});const i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:Ve(((o,s,a)=>{var c;const[l]=a;if(n.has(l))return i.apply(s,[l]);const{id:u,styleId:d}=pt(null===(c=s.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,remove:{property:l},index:ht(s.parentRule)}),o.apply(s,a)}))}),Ve((()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i}))}(e,{win:n}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],o=new WeakMap,s=n.FontFace;n.FontFace=function(e,t,n){const r=new s(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const i=Oe(t.fonts,"add",(function(t){return function(n){return setTimeout(Ve((()=>{const t=o.get(n);t&&(e(t),o.delete(n))})),0),t.apply(this,[n])}}));return r.push((()=>{n.FontFace=s})),r.push(i),Ve((()=>{r.forEach((e=>e()))}))}(e)));const f=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let i=!0;const a=Ve((()=>{const e=t.getSelection();if(!e||i&&(null==e?void 0:e.isCollapsed))return;i=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const s=e.getRangeAt(t),{startContainer:i,startOffset:c,endContainer:l,endOffset:u}=s;Le(i,r,o,!0)||Le(l,r,o,!0)||a.push({start:n.getId(i),startOffset:c,end:n.getId(l),endOffset:u})}s({ranges:a})}));return a(),Ie("selectionchange",a)}(e),m=[];for(const t of e.plugins)m.push(t.observer(t.callback,n,t.options));return Ve((()=>{ot.forEach((e=>e.reset())),null==r||r.disconnect(),o(),s(),i(),a(),c(),l(),u(),d(),h(),p(),f(),m.forEach((e=>e()))}))}function vt(e){return void 0!==window[e]}function gt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}function yt(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}for(var St,bt,It,wt=(St=function(){!function(){function e(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),r=0;r<t.length;r++)n[t.charCodeAt(r)]=r;var o=function(e){var n,r=new Uint8Array(e),o=r.length,s="";for(n=0;n<o;n+=3)s+=t[r[n]>>2],s+=t[(3&r[n])<<4|r[n+1]>>4],s+=t[(15&r[n+1])<<2|r[n+2]>>6],s+=t[63&r[n+2]];return o%3==2?s=s.substring(0,s.length-1)+"=":o%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const s=new Map,i=new Map,a=self;a.onmessage=function(t){return e(this,void 0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:t.data.id});{const{id:n,bitmap:r,width:c,height:l,dataURLOptions:u}=t.data,d=function(t,n,r){return e(this,void 0,void 0,(function*(){const e=`${t}-${n}`;if("OffscreenCanvas"in globalThis){if(i.has(e))return i.get(e);const s=new OffscreenCanvas(t,n);s.getContext("2d");const a=yield s.convertToBlob(r),c=yield a.arrayBuffer(),l=o(c);return i.set(e,l),l}return""}))}(c,l,u),h=new OffscreenCanvas(c,l);h.getContext("2d").drawImage(r,0,0),r.close();const p=yield h.convertToBlob(u),f=p.type,m=yield p.arrayBuffer(),v=o(m);if(!s.has(n)&&(yield d)===v)return s.set(n,v),a.postMessage({id:n});if(s.get(n)===v)return a.postMessage({id:n});a.postMessage({id:n,type:f,base64:v,width:c,height:l}),s.set(n,v)}}))}}()},bt=null,function(e){return It=It||function(e,t){var n=function(e,t){var n=void 0===t?null:t,r=e.toString().split("\n");r.pop(),r.shift();for(var o=r[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,i=0,a=r.length;i<a;++i)r[i]=r[i].substring(o).replace(s,"$1use strict$2")+"\n";return n&&r.push("//# sourceMappingURL="+n+"\n"),r}(e,t),r=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(r)}(St,bt),new Worker(It,e)}),Mt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ct="undefined"==typeof Uint8Array?[]:new Uint8Array(256),kt=0;kt<Mt.length;kt++)Ct[Mt.charCodeAt(kt)]=kt;const Ot=new Map;const Et=(e,t,n)=>{if(!e||!xt(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=Ot.get(e);return n||(n=new Map,Ot.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let o=r.indexOf(e);return-1===o&&(o=r.length,r.push(e)),o};function Tt(e,t,n){if(e instanceof Array)return e.map((e=>Tt(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),r=n.length,o="";for(t=0;t<r;t+=3)o+=Mt[n[t]>>2],o+=Mt[(3&n[t])<<4|n[t+1]>>4],o+=Mt[(15&n[t+1])<<2|n[t+2]>>6],o+=Mt[63&n[t+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Tt(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Tt(e.data,t,n),e.width,e.height]}}if(xt(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Et(e,t,n)}}return e}const Rt=(e,t,n)=>[...e].map((e=>Tt(e,t,n))),xt=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function Nt(e,t,n,r){const o=[];try{const s=Oe(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...s){if(!Le(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(o);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(s[0]&&"object"==typeof s[0]){const e=s[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[o,...s])}}));o.push(s)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach((e=>e()))}}function Dt(e,t,n,r,o,s,i){const a=[],c=Object.getOwnPropertyNames(e);for(const s of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const c=Oe(e,s,(function(e){return function(...a){const c=e.apply(this,a);if(Et(c,i,this),"tagName"in this.canvas&&!Le(this.canvas,r,o,!0)){const e=Rt([...a],i,this),r={type:t,property:s,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const o=ke(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(o)}return a}class Lt{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:r,blockSelector:o,recordCanvas:s,dataURLOptions:i}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(n,r,o),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,o,{dataURLOptions:i})}initCanvasFPSObserver(e,t,n,r,o){const s=Nt(t,n,r,!0),i=new Map,a=new wt;a.onmessage=e=>{const{id:t}=e.data;if(i.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:o,height:s}=e.data;this.mutationCb({id:t,type:be["2D"],commands:[{property:"clearRect",args:[0,0,o,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let l,u=0;const d=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{Le(t,n,r,!0)||e.push(t)})),e})().forEach((e=>yt(this,void 0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(i.get(n))return;if(i.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=yield createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:o.dataURLOptions},[r])}))))),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{s(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=Nt(e,t,n,!1),o=function(e,t,n,r){const o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const i of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[i])continue;const s=Oe(t.CanvasRenderingContext2D.prototype,i,(function(o){return function(...s){return Le(this.canvas,n,r,!0)||setTimeout((()=>{const n=Rt([...s],t,this);e(this.canvas,{type:be["2D"],property:i,args:n})}),0),o.apply(this,s)}}));o.push(s)}catch(n){const r=ke(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:be["2D"],property:i,args:[t],setter:!0})}});o.push(r)}return()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),s=function(e,t,n,r,o){const s=[];return s.push(...Dt(t.WebGLRenderingContext.prototype,be.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&s.push(...Dt(t.WebGL2RenderingContext.prototype,be.WebGL2,e,n,r,0,t)),()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map((e=>{const t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["type"]);return t})),{type:o}=n[0];this.mutationCb({id:t,type:o,commands:r}),this.pendingCanvasMutations.delete(e)}}class _t{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}class At{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!q(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=it(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(ct(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(ft({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(Oe(e.prototype,"attachShadow",(function(e){return function(r){const o=e.call(this,r);return this.shadowRoot&&Be(this)&&n.addShadowRoot(this.shadowRoot,t),o}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}class Pt{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new qe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:z(e),index:t})))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function Ft(e){return Object.assign(Object.assign({},e),{timestamp:Te()})}let Ut,jt,qt,Wt=!1;const zt=new B;function Bt(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:i="rr-ignore",ignoreSelector:a=null,maskTextClass:c="rr-mask",maskTextSelector:l=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:p,maskInputFn:f,maskTextFn:m,hooks:v,packFn:g,sampling:y={},dataURLOptions:S={},mousemoveWait:b,recordDOM:I=!0,recordCanvas:w=!1,recordCrossOriginIframes:M=!1,recordAfter:C=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:k=!1,collectFonts:O=!1,inlineImages:E=!1,plugins:T,keepIframeSrcFn:R=(()=>!1),ignoreCSSAttributes:x=new Set([]),errorHandler:N}=e;Ge(N);const D=!M||window.parent===window;let L=!1;if(!D)try{window.parent.document&&(L=!1)}catch(e){L=!0}if(D&&!t)throw new Error("emit function is required");void 0!==b&&void 0===y.mousemove&&(y.mousemove=b),zt.reset();const _=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==h?h:{password:!0},A=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p}:p||{};let P;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let F=0;const U=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return g&&!L&&(e=g(e)),e};Ut=(e,o)=>{var s;if(!(null===(s=ot[0])||void 0===s?void 0:s.isFrozen())||e.type===ve.FullSnapshot||e.type===ve.IncrementalSnapshot&&e.data.source===ge.Mutation||ot.forEach((e=>e.unfreeze())),D)null==t||t(U(e),o);else if(L){const t={type:"rrweb",event:U(e),origin:window.location.origin,isCheckout:o};window.parent.postMessage(t,"*")}if(e.type===ve.FullSnapshot)P=e,F=0;else if(e.type===ve.IncrementalSnapshot){if(e.data.source===ge.Mutation&&e.data.isAttachIframe)return;F++;const t=r&&F>=r,o=n&&e.timestamp-P.timestamp>n;(t||o)&&jt(!0)}};const j=e=>{Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Mutation},e)}))},q=e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Scroll},e)})),W=e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.CanvasMutation},e)})),z=new Pt({mutationCb:j,adoptedStyleSheetCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.AdoptedStyleSheet},e)}))}),G=new Ze({mirror:zt,mutationCb:j,stylesheetManager:z,recordCrossOriginIframes:M,wrappedEmit:Ut});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:zt,crossOriginIframeMirror:G.crossOriginIframeMirror,crossOriginIframeStyleMirror:G.crossOriginIframeStyleMirror});const H=new _t;qt=new Lt({recordCanvas:w,mutationCb:W,win:window,blockClass:o,blockSelector:s,mirror:zt,sampling:y.canvas,dataURLOptions:S});const V=new At({mutationCb:j,scrollCb:q,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:_,dataURLOptions:S,maskTextFn:m,maskInputFn:f,recordCanvas:w,inlineImages:E,sampling:y,slimDOMOptions:A,iframeManager:G,stylesheetManager:z,canvasManager:qt,keepIframeSrcFn:R,processedNodeManager:H},mirror:zt});jt=(e=!1)=>{if(!I)return;Ut(Ft({type:ve.Meta,data:{href:window.location.href,width:Ne(),height:xe()}}),e),z.reset(),V.init(),ot.forEach((e=>e.lock()));const t=function(e,t){var n=t||{},r=n.mirror,o=void 0===r?new B:r,s=n.blockClass,i=void 0===s?"rr-block":s,a=n.blockSelector,c=void 0===a?null:a,l=n.maskTextClass,u=void 0===l?"rr-mask":l,d=n.maskTextSelector,h=void 0===d?null:d,p=n.inlineStylesheet,f=void 0===p||p,m=n.inlineImages,v=void 0!==m&&m,g=n.recordCanvas,y=void 0!==g&&g,S=n.maskAllInputs,b=void 0!==S&&S,I=n.maskTextFn,w=n.maskInputFn,M=n.slimDOM,C=void 0!==M&&M,k=n.dataURLOptions,O=n.preserveWhiteSpace,E=n.onSerialize,T=n.onIframeLoad,R=n.iframeLoadTimeout,x=n.onStylesheetLoad,N=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return me(e,{doc:e,mirror:o,blockClass:i,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:f,maskInputOptions:!0===b?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===b?{password:!0}:b,maskTextFn:I,maskInputFn:w,slimDOMOptions:!0===C||"all"===C?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===C,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===C?{}:C,dataURLOptions:k,inlineImages:v,recordCanvas:y,preserveWhiteSpace:O,onSerialize:E,onIframeLoad:T,iframeLoadTimeout:R,onStylesheetLoad:x,stylesheetLoadTimeout:N,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:zt,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:_,maskTextFn:m,slimDOM:A,dataURLOptions:S,recordCanvas:w,inlineImages:E,onSerialize:e=>{Fe(e,zt)&&G.addIframe(e),Ue(e,zt)&&z.trackLinkElement(e),je(e)&&V.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{G.attachIframe(e,t),V.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:R});if(!t)return console.warn("Failed to snapshot the document");Ut(Ft({type:ve.FullSnapshot,data:{node:t,initialOffset:Re(window)}}),e),ot.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,zt.getId(document))};try{const e=[],t=e=>{var t;return Ve(mt)({mutationCb:j,mousemoveCb:(e,t)=>Ut(Ft({type:ve.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.MouseInteraction},e)})),scrollCb:q,viewportResizeCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.ViewportResize},e)})),inputCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Input},e)})),mediaInteractionCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.MediaInteraction},e)})),styleSheetRuleCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.StyleSheetRule},e)})),styleDeclarationCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.StyleDeclaration},e)})),canvasMutationCb:W,fontCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Font},e)})),selectionCb:e=>{Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Selection},e)}))},blockClass:o,ignoreClass:i,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:_,inlineStylesheet:u,sampling:y,recordDOM:I,recordCanvas:w,inlineImages:E,userTriggeredOnInput:k,collectFonts:O,doc:e,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:R,blockSelector:s,slimDOMOptions:A,dataURLOptions:S,mirror:zt,iframeManager:G,stylesheetManager:z,shadowDomManager:V,processedNodeManager:H,canvasManager:qt,ignoreCSSAttributes:x,plugins:(null===(t=null==T?void 0:T.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Ut(Ft({type:ve.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},v)};G.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{jt(),e.push(t(document)),Wt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Ie("DOMContentLoaded",(()=>{Ut(Ft({type:ve.DomContentLoaded,data:{}})),"DOMContentLoaded"===C&&n()}))),e.push(Ie("load",(()=>{Ut(Ft({type:ve.Load,data:{}})),"load"===C&&n()}),window))),()=>{e.forEach((e=>e())),H.destroy(),Wt=!1,He()}}catch(e){console.warn(e)}}var Gt,Ht;Bt.addCustomEvent=(e,t)=>{if(!Wt)throw new Error("please add custom event after start recording");Ut(Ft({type:ve.Custom,data:{tag:e,payload:t}}))},Bt.freezePage=()=>{ot.forEach((e=>e.freeze()))},Bt.takeFullSnapshot=e=>{if(!Wt)throw new Error("please take full snapshot after start recording");jt(e)},Bt.mirror=zt,function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(Gt||(Gt={})),function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Ht||(Ht={}));var Vt=Uint8Array,Kt=Uint16Array,Zt=Uint32Array,$t=new Vt([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]),Jt=new Vt([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]),Yt=new Vt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xt=function(e,t){for(var n=new Kt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new Zt(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return[n,o]},Qt=Xt($t,2),en=Qt[0],tn=Qt[1];en[28]=258,tn[258]=28;for(var nn=Xt(Jt,0)[1],rn=new Kt(32768),on=0;on<32768;++on){var sn=(43690&on)>>>1|(21845&on)<<1;sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4,rn[on]=((65280&sn)>>>8|(255&sn)<<8)>>>1}var an=function(e,t,n){for(var r=e.length,o=0,s=new Kt(t);o<r;++o)++s[e[o]-1];var i,a=new Kt(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;if(n){i=new Kt(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var l=o<<4|e[o],u=t-e[o],d=a[e[o]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)i[rn[d]>>>c]=l}else for(i=new Kt(r),o=0;o<r;++o)i[o]=rn[a[e[o]-1]++]>>>15-e[o];return i},cn=new Vt(288);for(on=0;on<144;++on)cn[on]=8;for(on=144;on<256;++on)cn[on]=9;for(on=256;on<280;++on)cn[on]=7;for(on=280;on<288;++on)cn[on]=8;var ln=new Vt(32);for(on=0;on<32;++on)ln[on]=5;var un=an(cn,9,0),dn=an(ln,5,0),hn=function(e){return(e/8>>0)+(7&e&&1)},pn=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Kt?Kt:e instanceof Zt?Zt:Vt)(n-t);return r.set(e.subarray(t,n)),r},fn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},mn=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},vn=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,s=n.slice();if(!o)return[new Vt(0),0];if(1==o){var i=new Vt(n[0].s+1);return i[n[0].s]=1,[i,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=o-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=s[0].s;for(r=1;r<o;++r)s[r].s>h&&(h=s[r].s);var p=new Kt(h+1),f=gn(n[u-1],p,0);if(f>t){r=0;var m=0,v=f-t,g=1<<v;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<o;++r){var y=s[r].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var S=s[r].s;p[S]<t?m-=1<<t-p[S]++-1:++r}for(;r>=0&&m;--r){var b=s[r].s;p[b]==t&&(--p[b],++m)}f=t}return[new Vt(p),f]},gn=function(e,t,n){return-1==e.s?Math.max(gn(e.l,t,n+1),gn(e.r,t,n+1)):t[e.s]=n},yn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Kt(++t),r=0,o=e[0],s=1,i=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==o&&a!=t)++s;else{if(!o&&s>2){for(;s>138;s-=138)i(32754);s>2&&(i(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(i(o),--s;s>6;s-=6)i(8304);s>2&&(i(s-3<<5|8208),s=0)}for(;s--;)i(o);s=1,o=e[a]}return[n.subarray(0,r),t]},Sn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},bn=function(e,t,n){var r=n.length,o=hn(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 s=0;s<r;++s)e[o+s+4]=n[s];return 8*(o+4+r)},In=function(e,t,n,r,o,s,i,a,c,l,u){fn(t,u++,n),++o[256];for(var d=vn(o,15),h=d[0],p=d[1],f=vn(s,15),m=f[0],v=f[1],g=yn(h),y=g[0],S=g[1],b=yn(m),I=b[0],w=b[1],M=new Kt(19),C=0;C<y.length;++C)M[31&y[C]]++;for(C=0;C<I.length;++C)M[31&I[C]]++;for(var k=vn(M,7),O=k[0],E=k[1],T=19;T>4&&!O[Yt[T-1]];--T);var R,x,N,D,L=l+5<<3,_=Sn(o,cn)+Sn(s,ln)+i,A=Sn(o,h)+Sn(s,m)+i+14+3*T+Sn(M,O)+(2*M[16]+3*M[17]+7*M[18]);if(L<=_&&L<=A)return bn(t,u,e.subarray(c,c+l));if(fn(t,u,1+(A<_)),u+=2,A<_){R=an(h,p,0),x=h,N=an(m,v,0),D=m;var P=an(O,E,0);fn(t,u,S-257),fn(t,u+5,w-1),fn(t,u+10,T-4),u+=14;for(C=0;C<T;++C)fn(t,u+3*C,O[Yt[C]]);u+=3*T;for(var F=[y,I],U=0;U<2;++U){var j=F[U];for(C=0;C<j.length;++C){var q=31&j[C];fn(t,u,P[q]),u+=O[q],q>15&&(fn(t,u,j[C]>>>5&127),u+=j[C]>>>12)}}}else R=un,x=cn,N=dn,D=ln;for(C=0;C<a;++C)if(r[C]>255){q=r[C]>>>18&31;mn(t,u,R[q+257]),u+=x[q+257],q>7&&(fn(t,u,r[C]>>>23&31),u+=$t[q]);var W=31&r[C];mn(t,u,N[W]),u+=D[W],W>3&&(mn(t,u,r[C]>>>5&8191),u+=Jt[W])}else mn(t,u,R[r[C]]),u+=x[r[C]];return mn(t,u,R[256]),u+x[256]},wn=new Zt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mn=new Vt(0),Cn=function(e,t,n,r,o){return function(e,t,n,r,o,s){var i=e.length,a=new Vt(r+i+5*(1+Math.floor(i/7e3))+o),c=a.subarray(r,a.length-o),l=0;if(!t||i<8)for(var u=0;u<=i;u+=65535){var d=u+65535;d<i?l=bn(c,l,e.subarray(u,d)):(c[u]=s,l=bn(c,l,e.subarray(u,i)))}else{for(var h=wn[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new Kt(32768),g=new Kt(m+1),y=Math.ceil(n/3),S=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<S)&m},I=new Zt(25e3),w=new Kt(288),M=new Kt(32),C=0,k=0,O=(u=0,0),E=0,T=0;u<i;++u){var R=b(u),x=32767&u,N=g[R];if(v[x]=N,g[R]=x,E<=u){var D=i-u;if((C>7e3||O>24576)&&D>423){l=In(e,c,0,I,w,M,k,O,T,u-T,l),O=C=k=0,T=u;for(var L=0;L<286;++L)w[L]=0;for(L=0;L<30;++L)M[L]=0}var _=2,A=0,P=f,F=x-N&32767;if(D>2&&R==b(u-F))for(var U=Math.min(p,D)-1,j=Math.min(32767,u),q=Math.min(258,D);F<=j&&--P&&x!=N;){if(e[u+_]==e[u+_-F]){for(var W=0;W<q&&e[u+W]==e[u+W-F];++W);if(W>_){if(_=W,A=F,W>U)break;var z=Math.min(F,W-2),B=0;for(L=0;L<z;++L){var G=u-F+L+32768&32767,H=G-v[G]+32768&32767;H>B&&(B=H,N=G)}}}F+=(x=N)-(N=v[x])+32768&32767}if(A){I[O++]=268435456|tn[_]<<18|nn[A];var V=31&tn[_],K=31&nn[A];k+=$t[V]+Jt[K],++w[257+V],++M[K],E=u+_,++C}else I[O++]=e[u],++w[e[u]]}}l=In(e,c,s,I,w,M,k,O,T,u-T,l),s||(l=bn(c,l,Mn))}return pn(a,0,r+hn(l)+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 kn(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var r=e,o=t,s=n.length,i=0;i!=s;){for(var a=Math.min(i+5552,s);i<a;++i)o+=r+=n[i];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=Cn(e,t,2,4);return function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)}(r,t),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(r,r.length-4,n.d()),r}const On=e=>{const t=Object.assign(Object.assign({},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}(kn(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Vt(e.length+(e.length>>>1)),o=0,s=function(e){r[o++]=e},i=0;i<n;++i){if(o+5>r.length){var a=new Vt(o+8+(n-i<<1));a.set(r),r=a}var c=e.charCodeAt(i);c<128||t?s(c):c<2048?(s(192|c>>>6),s(128|63&c)):c>55295&&c<57344?(s(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++i))>>>18),s(128|c>>>12&63),s(128|c>>>6&63),s(128|63&c)):(s(224|c>>>12),s(128|c>>>6&63),s(128|63&c))}return pn(r,0,o)}(JSON.stringify(t))),!0)};var En,Tn,Rn;function xn(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}let Nn;function Dn(){return Nn||(Nn=function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=xn(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}("keyval-store","keyval")),Nn}function Ln(e,t=Dn()){return t("readonly",(t=>xn(t.get(e))))}function _n(e,t,n=Dn()){return n("readwrite",(n=>new Promise(((r,o)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),r(xn(n.transaction))}catch(e){o(e)}}}))))}(Tn=En||(En={}))[Tn.NotStarted=0]="NotStarted",Tn[Tn.Running=1]="Running",Tn[Tn.Stopped=2]="Stopped",function(e){e.RECORDING="recording",e.SENT="sent"}(Rn||(Rn={}));var An="Session replay event batch rejected due to exceeded retry count",Pn="Failed to store session replay events in IndexedDB",Fn=function(e){var t=e.apiKey,n=e.loggerProvider,r=this;this.storageKey="",this.getAllSessionDataFromStore=function(){return a(r,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Ln(this.storageKey)];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(e)),[3,3];case 3:return[2,void 0]}}))}))},this.storeEventsForSession=function(e,t,n){return a(r,void 0,void 0,(function(){var r;return c(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,_n(this.storageKey,(function(r){var o,s;void 0===r&&(r={});var a=r[n]||i({},P);a.currentSequenceId=t;var c=a.sessionSequences&&a.sessionSequences[t]||{};return c.events=e,c.status=Rn.RECORDING,i(i({},r),((o={})[n]=i(i({},a),{sessionSequences:i(i({},a.sessionSequences),(s={},s[t]=c,s))}),o))}))];case 1:return o.sent(),[3,3];case 2:return r=o.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(r)),[3,3];case 3:return[2]}}))}))},this.cleanUpSessionEventsStore=function(e,t){return a(r,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,_n(this.storageKey,(function(n){void 0===n&&(n={});var r=n[e],o=(null==r?void 0:r.sessionSequences)&&r.sessionSequences[t];return o?(o.events=[],o.status=Rn.SENT,Object.entries(r.sessionSequences).forEach((function(e){var n=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}(e,2),o=n[0],s=n[1],i=parseInt(o,10);s.status===Rn.SENT&&t!==i&&delete r.sessionSequences[i]})),Object.keys(n).forEach((function(e){var t=parseInt(e,10);Date.now()-t>=2592e5&&delete n[t]})),n):n}))];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(n)),[3,3];case 3:return[2]}}))}))},this.loggerProvider=n,this.storageKey="".concat(A,"_").concat(t.substring(0,10))},Un=function(e,t){var n;return(null===(n=t.classList)||void 0===n?void 0:n.contains("amp-unmask"))?e:"*".repeat(e.length)},jn=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},qn=function(e,t){return"".concat(t,"/").concat(e)},Wn=function(){function e(e){var t=e.loggerProvider;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=t}return e.prototype.sendEventsList=function(e){this.addToQueue(i(i({},e),{attempts:0,timeout:0}))},e.prototype.getServerUrl=function(e){return e===o.STAGING?"https://api-sr.stag2.amplitude.com//sessions/v2/track":e===o.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track"},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.filter((function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"".concat(An,", batch sequence id, ").concat(t.sequenceId)}),!1)}));r.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),a(this,void 0,void 0,(function(){var t,n,r=this;return c(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){return void 0===t&&(t=!0),a(this,void 0,void 0,(function(){var n,r,o,s,i,a,l,u,d,h,p,f;return c(this,(function(c){switch(c.label){case 0:if(!(n=e.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(r=e.deviceId))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];m=R(),o=(null==m?void 0:m.location)?m.location.href:"",s="0.2.5",i=e.sampleRate,a=new URLSearchParams({device_id:r,session_id:"".concat(e.sessionId),seq_number:"".concat(e.sequenceId)}),l={version:1,events:e.events},c.label=1;case 1:return c.trys.push([1,3,,4]),u={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(n),"X-Client-Version":s,"X-Client-Url":o,"X-Client-Sample-Rate":"".concat(i)},body:JSON.stringify(l),method:"POST"},d="".concat(this.getServerUrl(e.serverZone),"?").concat(a.toString()),[4,fetch(d,u)];case 2:if(null===(h=c.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(h.status,e);else{p="";try{p=JSON.stringify(h.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(h.status,": ").concat(p)})}return[3,4];case 3:return f=c.sent(),this.completeRequest({context:e,err:f}),[3,4];case 4:return[2]}var m}))}))},e.prototype.handleReponse=function(e,t){switch((new y).buildStatus(e)){case s.Success:this.handleSuccessResponse(t);break;case s.Failed:this.handleOtherResponse(t);break;default:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"})}},e.prototype.handleSuccessResponse=function(e){var t;this.completeRequest({context:e,success:(t=e.sessionId,"Session replay event batch tracked successfully for session id ".concat(t))})},e.prototype.handleOtherResponse=function(e){this.addToQueue(i(i({},e),{timeout:e.attempts*this.retryTimeout}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(t.sessionId,t.sequenceId),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e}(),zn=function(){function e(e){var t=e.config,n=this;this.events=[],this.currentSequenceId=0,this.maxPersistedEventsSize=1e6,this.interval=500,this.timeAtLastSend=null,this.shouldSplitEventsList=function(e){var t=new Blob([e]).size;return new Blob(n.events).size+t>=n.maxPersistedEventsSize||!!(null!==n.timeAtLastSend&&Date.now()-n.timeAtLastSend>n.interval&&n.events.length)&&(n.interval=Math.min(1e4,n.interval+500),n.timeAtLastSend=Date.now(),!0)},this.config=t,this.trackDestination=new Wn({loggerProvider:this.config.loggerProvider}),this.sessionIDBStore=new Fn({loggerProvider:this.config.loggerProvider,apiKey:this.config.apiKey})}return e.prototype.initialize=function(e){var t=e.sessionId,n=e.deviceId,r=e.shouldSendStoredEvents,o=void 0!==r&&r;return a(this,void 0,void 0,(function(){var e,r,s,i;return c(this,(function(a){switch(a.label){case 0:return this.timeAtLastSend=Date.now(),[4,this.sessionIDBStore.getAllSessionDataFromStore()];case 1:return e=a.sent(),r=e&&e[t],e&&r&&r.sessionSequences&&(s=r.currentSequenceId,(i=r.sessionSequences[s])&&i.status!==Rn.RECORDING?(this.currentSequenceId=s+1,this.events=[]):(this.currentSequenceId=s,this.events=(null==i?void 0:i.events)||[])),o&&e&&this.sendStoredEvents({storedReplaySessions:e,deviceId:n,sessionId:t}),[2]}}))}))},e.prototype.sendStoredEvents=function(e){var t=e.storedReplaySessions,n=e.sessionId,r=e.deviceId;for(var o in t){var s=t[o].sessionSequences;for(var i in s){var a=s[i],c=parseInt(i,10),l=parseInt(o,10);l===n&&c===this.currentSequenceId||a.events&&a.events.length&&a.status===Rn.RECORDING&&this.sendEventsList({events:a.events,sequenceId:c,sessionId:l,deviceId:r})}}},e.prototype.resetSequence=function(){this.events=[],this.currentSequenceId=0},e.prototype.addEvent=function(e){var t=e.event,n=e.sessionId,r=e.deviceId;this.shouldSplitEventsList(t)&&(this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:n,deviceId:r}),this.events=[],this.currentSequenceId++),this.events.push(t),this.sessionIDBStore.storeEventsForSession(this.events,this.currentSequenceId,n)},e.prototype.sendEvents=function(e){var t=e.sessionId,n=e.deviceId;this.events.length&&t&&this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:t,deviceId:n})},e.prototype.sendEventsList=function(e){var t=e.events,n=e.sequenceId,r=e.sessionId,o=e.deviceId;this.trackDestination.sendEventsList({events:t,sequenceId:n,sessionId:r,flushMaxRetries:this.config.flushMaxRetries,apiKey:this.config.apiKey,deviceId:o,sampleRate:this.config.sampleRate,serverZone:this.config.serverZone,onComplete:this.sessionIDBStore.cleanUpSessionEventsStore.bind(this.sessionIDBStore)})},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){return c(this,(function(t){return this.trackDestination?[2,this.trackDestination.flush(e)]:[2]}))}))},e}(),Bn=function(e,t){this.deviceId=e.deviceId,this.sessionId=e.sessionId,e.sessionId&&e.deviceId?this.sessionReplayId=qn(e.sessionId,e.deviceId):t.error("Please provide both sessionId and deviceId.")},Gn=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.blurListener=function(){e.stopRecordingAndSendEvents()},this.focusListener=function(){e.initialize()},this.stopRecordingEvents=function(){try{e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null}catch(n){var t=n;e.loggerProvider.warn("Error occurred while stopping recording: ".concat(t.toString()))}},this.loggerProvider=new d}return e.prototype.init=function(e,t){return{promise:this._init(e,t)||Promise.resolve()}},e.prototype._init=function(e,t){return a(this,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return this.config=new U(e,t),this.loggerProvider=this.config.loggerProvider,this.identifiers=new Bn(t,this.loggerProvider),this.eventsManager=new zn({config:this.config}),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),(n=R())&&(n.removeEventListener("blur",this.blurListener),n.removeEventListener("focus",this.focusListener),n.addEventListener("blur",this.blurListener),n.addEventListener("focus",this.focusListener)),n&&n.document&&n.document.hasFocus()?[4,this.initialize(!0)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.prototype.setSessionId=function(e,t){if(this.identifiers){t&&(this.identifiers.deviceId=t);var n=this.getDeviceId();e&&n?(this.identifiers.sessionReplayId=qn(e,n),this.stopRecordingAndSendEvents(this.identifiers.sessionId),this.identifiers.sessionId=e,this.eventsManager&&this.eventsManager.resetSequence(),this.recordEvents()):this.loggerProvider.error("Must provide either session replay id or session id when starting a new session.")}else this.loggerProvider.error("Session replay init has not been called, cannot set session id.")},e.prototype.getSessionReplayDebugPropertyValue=function(){var e="";return this.config&&(e=jn(this.config.apiKey).toString()),JSON.stringify({appHash:e})},e.prototype.getSessionReplayProperties=function(){var e;if(!this.config||!this.identifiers)return this.loggerProvider.error("Session replay init has not been called, cannot get session recording properties."),{};var t=!!this.config.debugMode;if(this.getShouldRecord(t)){var n=((e={})[D]=this.identifiers.sessionReplayId?this.identifiers.sessionReplayId:null,e);return this.config.debugMode&&(n[_]=this.getSessionReplayDebugPropertyValue()),n}return{}},e.prototype.stopRecordingAndSendEvents=function(e){var t;this.stopRecordingEvents();var n=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),r=this.getDeviceId();this.eventsManager&&n&&r&&this.eventsManager.sendEvents({sessionId:n,deviceId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(n=this.getDeviceId(),this.eventsManager&&n?[4,this.eventsManager.initialize({sessionId:this.identifiers.sessionId,shouldSendStoredEvents:e,deviceId:n})]:[3,2]):(this.loggerProvider.warn("Session is not being recorded due to lack of session id."),[2]);case 1:r.sent(),r.label=2;case 2:return this.recordEvents(),[2]}}))}))},e.prototype.shouldOptOut=function(){var e,t,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=T(this.config.instanceName).identityStore.getIdentity().optOut);return void 0!==n?n:null===(t=this.config)||void 0===t?void 0:t.optOut},e.prototype.getShouldRecord=function(e){if(void 0===e&&(e=!1),!this.identifiers||!this.config)return this.loggerProvider.error("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;var t=R();if(!e&&t&&t.document&&!t.document.hasFocus())return this.identifiers.sessionId&&this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," temporarily not recording due to lack of browser focus.")),!1;if(this.shouldOptOut())return this.identifiers.sessionId&&this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;if(!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of session id."),!1;var n,r,o,s=(n=this.identifiers.sessionId,r=this.config.sampleRate,o=jn(n.toString()),31*Math.abs(o)%100/100<r);return s||this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate.")),s},e.prototype.getBlockSelectors=function(){var e,t;return null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.blockSelector},e.prototype.recordEvents=function(){var e,t=this,n=this.getShouldRecord(),r=null===(e=this.identifiers)||void 0===e?void 0:e.sessionId;n&&r&&(this.stopRecordingEvents(),this.recordCancelCallback=Bt({emit:function(e){var n=R();if(n&&n.document&&!n.document.hasFocus()||!t.getShouldRecord())t.stopRecordingAndSendEvents();else{var o=JSON.stringify(e),s=t.getDeviceId();s&&t.eventsManager&&t.eventsManager.addEvent({event:o,sessionId:r,deviceId:s})}},packFn:On,maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",blockSelector:this.getBlockSelectors(),maskInputFn:Un,recordCanvas:!1,errorHandler:function(e){var n=e;return t.loggerProvider.warn("Error while recording: ",n.toString()),!0}}))},e.prototype.getDeviceId=function(){var e,t,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=T(this.config.instanceName).identityStore.getIdentity().deviceId);return n||(null===(t=this.identifiers)||void 0===t?void 0:t.deviceId)},e.prototype.getSessionId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.sessionId},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){return c(this,(function(t){return this.eventsManager?[2,this.eventsManager.flush(e)]:[2]}))}))},e.prototype.shutdown=function(){var e=R();e&&(e.removeEventListener("blur",this.blurListener),e.removeEventListener("focus",this.focusListener)),this.stopRecordingAndSendEvents()},e}(),Hn=function(e){return function(){var t=e.config||F();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Vn=function(){var e=new Gn;return{init:g(e.init.bind(e),"init",Hn(e)),setSessionId:g(e.setSessionId.bind(e),"setSessionId",Hn(e)),getSessionId:g(e.getSessionId.bind(e),"getSessionId",Hn(e)),getSessionReplayProperties:g(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Hn(e)),flush:g(e.flush.bind(e),"flush",Hn(e)),shutdown:g(e.shutdown.bind(e),"shutdown",Hn(e))}}(),Kn=Vn.init,Zn=Vn.setSessionId,$n=Vn.getSessionId,Jn=Vn.getSessionReplayProperties,Yn=Vn.flush,Xn=Vn.shutdown,Qn="@amplitude/plugin-session-replay-enrichment-browser",er=function(){function e(){this.name=Qn,this.type="enrichment"}return e.prototype.setup=function(e,t){return a(this,void 0,void 0,(function(){return c(this,(function(t){return this.config=e,[2]}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){return this.config.sessionId&&this.config.sessionId!==$n()&&Zn(this.config.sessionId),this.config.sessionId&&this.config.sessionId===e.session_id&&(t=Jn(),e.event_properties=i(i({},e.event_properties),t)),[2,Promise.resolve(e)]}))}))},e}(),tr=function(){function e(e){this.name="@amplitude/plugin-session-replay-browser",this.type="destination",this.options=i({},e),!1!==this.options.forceSessionTracking&&(this.options.forceSessionTracking=!0)}return e.prototype.setup=function(e,t){var n;return a(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return t?(e.loggerProvider.log("Installing @amplitude/plugin-session-replay."),this.client=t,this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=i(i({},e.defaultTracking),{sessions:!0})),[4,Kn(e.apiKey,{instanceName:this.config.instanceName,deviceId:this.config.deviceId,optOut:this.config.optOut,sessionId:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null===(n=this.options.privacyConfig)||void 0===n?void 0:n.blockSelector},debugMode:this.options.debugMode}).promise]):(e.loggerProvider.error("SessionReplayPlugin requires v1.9.1+ of the Amplitude SDK."),[2]);case 1:return r.sent(),[4,t.add(new er).promise];case 2:return r.sent(),[2]}}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){return[2,Promise.resolve({event:e,code:200,message:"success"})]}))}))},e.prototype.flush=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,Yn(!1)];case 1:return e.sent(),[2]}}))}))},e.prototype.teardown=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this.client.remove(Qn).promise];case 1:return e.sent(),Xn(),this.config=null,this.client=null,[2]}}))}))},e.prototype.getSessionReplayProperties=function(){return Jn()},e}(),nr=function(e){return new tr(e)};e.plugin=nr,e.sessionReplayPlugin=nr,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";var t=function(e,n){return t=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])},t(e,n)};function n(e,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=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,o,s,i=function(){return i=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},i.apply(this,arguments)};function a(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}function c(e,t){var n,r,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),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(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"}(r||(r={})),function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(o||(o={})),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"}(s||(s={}));var l="https://api2.amplitude.com/2/httpapi",u="Amplitude Logger ",d=function(){function e(){this.logLevel=r.None}return e.prototype.disable=function(){this.logLevel=r.None},e.prototype.enable=function(e){void 0===e&&(e=r.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Verbose||console.log("".concat(u,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Warn||console.warn("".concat(u,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Error||console.error("".concat(u,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<r.Debug||console.log("".concat(u,"[Debug]: ").concat(e.join(" ")))},e}(),h=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:r.Warn,loggerProvider:new d,optOut:!1,serverUrl:l,serverZone:o.US,useBatch:!1}},p=function(){function e(e){var t,n,r,o;this._optOut=!1;var s=h();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(o=e.useBatch)&&void 0!==o?o:s.useBatch,this.loggerProvider.enable(this.logLevel);var i=m(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=i.serverZone,this.serverUrl=i.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),f=function(e,t){return e===o.EU?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":l},m=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=h().serverZone),void 0===n&&(n=h().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:h().serverZone;return{serverZone:r,serverUrl:f(r,n)}},v=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},g=function(e,t,n,o,s){return void 0===s&&(s=null),function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var c=n(),l=c.logger,u=c.logLevel;if(u&&u<r.Debug||!u||!l)return e.apply(s,i);var d={type:"invoke public method",name:t,args:i,stacktrace:v(1),time:{start:(new Date).toISOString()},states:{}};o&&d.states&&(d.states.before=o());var h=e.apply(s,i);return h&&h.promise?h.promise.then((function(){o&&d.states&&(d.states.after=o()),d.time&&(d.time.end=(new Date).toISOString()),l.debug(JSON.stringify(d,null,2))})):(o&&d.states&&(d.states.after=o()),d.time&&(d.time.end=(new Date).toISOString()),l.debug(JSON.stringify(d,null,2))),h}},y=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,a,c,l,u,d,h,p,f,m,v,g,y,S,b,I,w,M;if("object"!=typeof e)return null;var C=e.code||0,k=this.buildStatus(C);switch(k){case s.Success:return{status:k,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 s.Invalid:return{status:k,statusCode:C,body:{error:null!==(o=e.error)&&void 0!==o?o:"",missingField:null!==(i=e.missing_field)&&void 0!==i?i:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(c=e.events_with_missing_fields)&&void 0!==c?c:{},eventsWithInvalidIdLengths:null!==(l=e.events_with_invalid_id_lengths)&&void 0!==l?l:{},epsThreshold:null!==(u=e.eps_threshold)&&void 0!==u?u:0,exceededDailyQuotaDevices:null!==(d=e.exceeded_daily_quota_devices)&&void 0!==d?d:{},silencedDevices:null!==(h=e.silenced_devices)&&void 0!==h?h:[],silencedEvents:null!==(p=e.silenced_events)&&void 0!==p?p:[],throttledDevices:null!==(f=e.throttled_devices)&&void 0!==f?f:{},throttledEvents:null!==(m=e.throttled_events)&&void 0!==m?m:[]}};case s.PayloadTooLarge:return{status:k,statusCode:C,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case s.RateLimit:return{status:k,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!==(S=e.throttled_devices)&&void 0!==S?S:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(I=e.exceeded_daily_quota_devices)&&void 0!==I?I:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(M=e.throttled_events)&&void 0!==M?M:[]}};case s.Timeout:default:return{status:k,statusCode:C}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?s.Success:429===e?s.RateLimit:413===e?s.PayloadTooLarge:408===e?s.Timeout:e>=400&&e<500?s.Invalid:e>=500?s.Failed:s.Unknown},e}(),S=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:b(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),b=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}(),w=function(){return w=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},w.apply(this,arguments)},M=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var r=0,o=["string","number","boolean","undefined"];r<o.length;r++){if(o[r]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),i=Array.isArray(t);if(s!==i)return!1;if(!s||!i){var a=Object.keys(e).sort(),c=Object.keys(t).sort();if(!M(a,c))return!1;var l=!0;return Object.keys(e).forEach((function(n){M(e[n],t[n])||(l=!1)})),l}for(var u=0;u<e.length;u++)if(!M(e[u],t[u]))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 C,k=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=w({},this.identity.userProperties),n=w(w({},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){for(var t=n.userProperties||{},r=0,o=Object.entries(e);r<o.length;r++){var s=o[r],i=s[0],a=s[1];switch(i){case"$set":for(var c=0,l=Object.entries(a);c<l.length;c++){var u=l[c],d=u[0],h=u[1];t[d]=h}break;case"$unset":for(var p=0,f=Object.keys(a);p<f.length;p++){delete t[d=f[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return w({},this.identity)},e.prototype.setIdentity=function(e){var t=w({},this.identity);this.identity=w({},e),M(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}(),O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,E=function(){function e(){this.identityStore=new k,this.eventBridge=new I,this.applicationContextProvider=new S}return e.getInstance=function(t){return O.analyticsConnectorInstances||(O.analyticsConnectorInstances={}),O.analyticsConnectorInstances[t]||(O.analyticsConnectorInstances[t]=new e),O.analyticsConnectorInstances[t]},e}(),T=function(e){return void 0===e&&(e="$default_instance"),E.getInstance(e)},R=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},x=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return a(this,void 0,void 0,(function(){var n,r;return c(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,o.sent().json()];case 2:return r=o.sent(),[2,this.buildResponse(r)]}}))}))},t}(y),N="[Amplitude]",D="".concat(N," Session Replay ID"),L=o.US,_="".concat(N," Session Replay Debug"),A="".concat("AMP","_replay_unsent"),P={currentSequenceId:0,sessionSequences:{}},F=function(){return{flushMaxRetries:2,logLevel:r.Warn,loggerProvider:new d,transportProvider:new x}},U=function(e){function t(t,n){var r=this,o=F();return(r=e.call(this,i(i({transportProvider:o.transportProvider},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=o.flushMaxRetries?n.flushMaxRetries:o.flushMaxRetries,r.apiKey=t,r.sampleRate=n.sampleRate||0,r.serverZone=n.serverZone||L,n.privacyConfig&&(r.privacyConfig=n.privacyConfig),n.debugMode&&(r.debugMode=n.debugMode),r}return n(t,e),t}(p);function j(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function q(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function W(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t,z).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function z(e){var t,n,r;if(function(e){return"styleSheet"in e}(e))try{t=W(e.styleSheet)||function(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url(".concat(JSON.stringify(e.href),")")];return""===e.layerName?n.push("layer"):e.layerName&&n.push("layer(".concat(e.layerName,")")),e.supportsText&&n.push("supports(".concat(e.supportsText,")")),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return n=e.cssText,r=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,n.replace(r,"$1\\$2");return t||e.cssText}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(C||(C={}));var B=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function G(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,o=e.type,s=e.value,i=e.maskInputFn,a=s||"",c=o&&H(o);return(n[r.toLowerCase()]||c&&n[c])&&(a=i?i(a,t):"*".repeat(a.length)),a}function H(e){return e.toLowerCase()}var V="__rrweb_original__";function K(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?H(t):null}var Z,$,J=1,Y=new RegExp("[^a-z0-9-_:]");function X(){return J++}var Q=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ee=/^(?:[a-z+]+:)?\/\//i,te=/^www\..*/i,ne=/^(data:)([^,]*),(.*)/i;function re(e,t){return(e||"").replace(Q,(function(e,n,r,o,s,i){var a,c=r||s||i,l=n||o||"";if(!c)return e;if(ee.test(c)||te.test(c))return"url(".concat(l).concat(c).concat(l,")");if(ne.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var h=0,p=d;h<p.length;h++){var f=p[h];"."!==f&&(".."===f?u.pop():u.push(f))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var oe=/^[^ \t\n\r\u000c]+/,se=/^[, \t\n\r\u000c]+/;function ie(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function ae(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ce(){var e=document.createElement("a");return e.href="",e.href}function le(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?ie(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}for(var o=[];r(se),!(n>=t.length);){var s=r(oe);if(","===s.slice(-1))s=ie(e,s.substring(0,s.length-1)),o.push(s);else{var i="";s=ie(e,s);for(var a=!1;;){var c=t.charAt(n);if(""===c){o.push((s+i).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,o.push((s+i).trim());break}"("===c&&(a=!0)}i+=c,n+=1}}}return o.join(", ")}(e,r):"style"===n?re(r,ce()):"object"===t&&"data"===n?ie(e,r):r:ie(e,r):r}function ue(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function de(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&de(e.parentNode,t,n);for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return!!n&&de(e.parentNode,t,n)}function he(e,t,n){try{var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(r.closest(".".concat(t)))return!0}else if(de(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}}catch(e){}return!1}function pe(e,t){var n=t.doc,r=t.mirror,o=t.blockClass,s=t.blockSelector,i=t.maskTextClass,a=t.maskTextSelector,c=t.inlineStylesheet,l=t.maskInputOptions,u=void 0===l?{}:l,d=t.maskTextFn,h=t.maskInputFn,p=t.dataURLOptions,f=void 0===p?{}:p,m=t.inlineImages,v=t.recordCanvas,g=t.keepIframeSrcFn,y=t.newlyAddedElement,S=void 0!==y&&y,b=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:C.Document,childNodes:[],compatMode:e.compatMode}:{type:C.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:C.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.blockClass,o=t.blockSelector,s=t.inlineStylesheet,i=t.maskInputOptions,a=void 0===i?{}:i,c=t.maskInputFn,l=t.dataURLOptions,u=void 0===l?{}:l,d=t.inlineImages,h=t.recordCanvas,p=t.keepIframeSrcFn,f=t.newlyAddedElement,m=void 0!==f&&f,v=t.rootId,g=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,o),y=function(e){if(e instanceof HTMLFormElement)return"form";var t=H(e.tagName);return Y.test(t)?"div":t}(e),S={},b=e.attributes.length,I=0;I<b;I++){var w=e.attributes[I];ue(y,w.name,w.value)||(S[w.name]=le(n,y,H(w.name),w.value))}if("link"===y&&s){var M=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),k=null;M&&(k=W(M)),k&&(delete S.rel,delete S.href,S._cssText=re(k,M.href))}if("style"===y&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(k=W(e.sheet))&&(S._cssText=re(k,ce()))}if("input"===y||"textarea"===y||"select"===y){var O=e.value,E=e.checked;if("radio"!==S.type&&"checkbox"!==S.type&&"submit"!==S.type&&"button"!==S.type&&O){var T=K(e);S.value=G({element:e,type:T,tagName:y,value:O,maskInputOptions:a,maskInputFn:c})}else E&&(S.checked=E)}"option"===y&&(e.selected&&!a.select?S.selected=!0:delete S.selected);if("canvas"===y&&h)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var o=t.getImageData,s=V in o?o[V]:o;if(new Uint32Array(s.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(e)||(S.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var R=e.toDataURL(u.type,u.quality),x=document.createElement("canvas");x.width=e.width,x.height=e.height,R!==x.toDataURL(u.type,u.quality)&&(S.rr_dataURL=R)}if("img"===y&&d){Z||(Z=n.createElement("canvas"),$=Z.getContext("2d"));var N=e,D=N.crossOrigin;N.crossOrigin="anonymous";var L=function(){N.removeEventListener("load",L);try{Z.width=N.naturalWidth,Z.height=N.naturalHeight,$.drawImage(N,0,0),S.rr_dataURL=Z.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(N.currentSrc,"! Error: ").concat(e))}D?S.crossOrigin=D:N.removeAttribute("crossorigin")};N.complete&&0!==N.naturalWidth?L():N.addEventListener("load",L)}"audio"!==y&&"video"!==y||(S.rr_mediaState=e.paused?"paused":"played",S.rr_mediaCurrentTime=e.currentTime);m||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop));if(g){var _=e.getBoundingClientRect(),A=_.width,P=_.height;S={class:S.class,rr_width:"".concat(A,"px"),rr_height:"".concat(P,"px")}}"iframe"!==y||p(S.src)||(e.contentDocument||(S.rr_src=S.src),delete S.src);return{type:C.Element,tagName:y,attributes:S,childNodes:[],isSVG:ae(e)||void 0,needBlock:g,rootId:v}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:f,inlineImages:m,recordCanvas:v,keepIframeSrcFn:g,newlyAddedElement:S,rootId:b});case e.TEXT_NODE:return function(e,t){var n,r=t.maskTextClass,o=t.maskTextSelector,s=t.maskTextFn,i=t.rootId,a=e.parentNode&&e.parentNode.tagName,c=e.textContent,l="STYLE"===a||void 0,u="SCRIPT"===a||void 0;if(l&&c){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(c=W(e.parentNode.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=re(c,ce())}u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&he(e,r,o)&&(c=s?s(c,e.parentElement):c.replace(/[\S]/g,"*"));return{type:C.Text,textContent:c||"",isStyle:l,rootId:i}}(e,{maskTextClass:i,maskTextSelector:a,maskTextFn:d,rootId:b});case e.CDATA_SECTION_NODE:return{type:C.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:C.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function fe(e){return null==e?"":e.toLowerCase()}function me(e,t){var n,r=t.doc,o=t.mirror,s=t.blockClass,i=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,d=t.inlineStylesheet,h=void 0===d||d,p=t.maskInputOptions,f=void 0===p?{}:p,m=t.maskTextFn,v=t.maskInputFn,g=t.slimDOMOptions,y=t.dataURLOptions,S=void 0===y?{}:y,b=t.inlineImages,I=void 0!==b&&b,w=t.recordCanvas,M=void 0!==w&&w,k=t.onSerialize,O=t.onIframeLoad,E=t.iframeLoadTimeout,T=void 0===E?5e3:E,R=t.onStylesheetLoad,x=t.stylesheetLoadTimeout,N=void 0===x?5e3:x,D=t.keepIframeSrcFn,L=void 0===D?function(){return!1}:D,_=t.newlyAddedElement,A=void 0!==_&&_,P=t.preserveWhiteSpace,F=void 0===P||P,U=pe(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,dataURLOptions:S,inlineImages:I,recordCanvas:M,keepIframeSrcFn:L,newlyAddedElement:A});if(!U)return console.warn(e,"not serialized"),null;n=o.hasNode(e)?o.getId(e):!function(e,t){if(t.comment&&e.type===C.Comment)return!0;if(e.type===C.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(fe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===fe(e.attributes.name)||"icon"===fe(e.attributes.rel)||"apple-touch-icon"===fe(e.attributes.rel)||"shortcut icon"===fe(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&fe(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(fe(e.attributes.property).match(/^(og|twitter|fb):/)||fe(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===fe(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===fe(e.attributes.name)||"googlebot"===fe(e.attributes.name)||"bingbot"===fe(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===fe(e.attributes.name)||"generator"===fe(e.attributes.name)||"framework"===fe(e.attributes.name)||"publisher"===fe(e.attributes.name)||"progid"===fe(e.attributes.name)||fe(e.attributes.property).match(/^article:/)||fe(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===fe(e.attributes.name)||"yandex-verification"===fe(e.attributes.name)||"csrf-token"===fe(e.attributes.name)||"p:domain_verify"===fe(e.attributes.name)||"verify-v1"===fe(e.attributes.name)||"verification"===fe(e.attributes.name)||"shopify-checkout-api-token"===fe(e.attributes.name)))return!0}}return!1}(U,g)&&(F||U.type!==C.Text||U.isStyle||U.textContent.replace(/^\s+|\s+$/gm,"").length)?X():-2;var W=Object.assign(U,{id:n});if(o.add(e,W),-2===n)return null;k&&k(e);var z=!u;if(W.type===C.Element){z=z&&!W.needBlock,delete W.needBlock;var B=e.shadowRoot;B&&q(B)&&(W.isShadowHost=!0)}if((W.type===C.Document||W.type===C.Element)&&z){g.headWhitespace&&W.type===C.Element&&"head"===W.tagName&&(F=!1);for(var G={doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L},H=0,V=Array.from(e.childNodes);H<V.length;H++){($=me(V[H],G))&&W.childNodes.push($)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var K=0,Z=Array.from(e.shadowRoot.childNodes);K<Z.length;K++){var $;($=me(Z[K],G))&&(q(e.shadowRoot)&&($.isShadow=!0),W.childNodes.push($))}}return e.parentNode&&j(e.parentNode)&&q(e.parentNode)&&(W.isShadow=!0),W.type===C.Element&&"iframe"===W.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"===o){var i="about:blank";if(r.location.href!==i||e.src===i||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout((function(){s||(t(),s=!0)}),n);e.addEventListener("load",(function(){clearTimeout(a),s=!0,t()}))}}}(e,(function(){var t=e.contentDocument;if(t&&O){var n=me(t,{doc:t,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L});n&&O(e,n)}}),T),W.type===C.Element&&"link"===W.tagName&&"stylesheet"===W.attributes.rel&&function(e,t,n){var r,o=!1;try{r=e.sheet}catch(e){return}if(!r){var s=setTimeout((function(){o||(t(),o=!0)}),n);e.addEventListener("load",(function(){clearTimeout(s),o=!0,t()}))}}(e,(function(){if(R){var t=me(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:v,slimDOMOptions:g,dataURLOptions:S,inlineImages:I,recordCanvas:M,preserveWhiteSpace:F,onSerialize:k,onIframeLoad:O,iframeLoadTimeout:T,onStylesheetLoad:R,stylesheetLoadTimeout:N,keepIframeSrcFn:L});t&&R(e,t)}}),N),W}var ve=(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))(ve||{}),ge=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(ge||{}),ye=(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))(ye||{}),Se=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Se||{}),be=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(be||{});function Ie(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const we="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Me={map:{},getId:()=>(console.error(we),-1),getNode:()=>(console.error(we),null),removeNodeFromMap(){console.error(we)},has:()=>(console.error(we),!1),reset(){console.error(we)}};function Ce(e,t,n={}){let r=null,o=0;return function(...s){const i=Date.now();o||!1!==n.leading||(o=i);const a=t-(i-o),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),o=i,e.apply(c,s)):r||!1===n.trailing||(r=setTimeout((()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(c,s)}),a))}}function ke(e,t,n,r,o=window){const s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>ke(e,t,s||{},!0)}function Oe(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch(e){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Me=new Proxy(Me,{get:(e,t,n)=>("map"===t&&console.error(we),Reflect.get(e,t,n))}));let Ee,Te=Date.now;function Re(e){var t,n,r,o,s,i;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null===(n=null===(t=null==a?void 0:a.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==a?void 0:a.body)||void 0===r?void 0:r.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null===(s=null===(o=null==a?void 0:a.body)||void 0===o?void 0:o.parentElement)||void 0===s?void 0:s.scrollTop)||(null===(i=null==a?void 0:a.body)||void 0===i?void 0:i.scrollTop)||0}}function xe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ne(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function De(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function Le(e,t,n,r){if(!e)return!1;const o=De(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(de(o,t,r))return!0}catch(e){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1}function _e(e,t){return-2===t.getId(e)}function Ae(e,t){if(j(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Ae(e.parentNode,t))}function Pe(e){return Boolean(e.changedTouches)}function Fe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ue(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function je(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Te=()=>(new Date).getTime());class qe{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function We(e){var t,n;let r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function ze(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=We(n);)n=t;return n}(e);return t.contains(n)}function Be(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||ze(e))}function Ge(e){Ee=e}function He(){Ee=void 0}const Ve=e=>{if(!Ee)return e;return(...t)=>{try{return e(...t)}catch(e){if(Ee&&!0===Ee(e))return;throw e}}};class Ke{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),s=r||this.getRemoteIdToIdMap(e);let i=o.get(t);return i||(i=this.generateIdFn(),o.set(t,i),s.set(i,t)),i}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,r)))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const o=r.get(t);return o||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Ze{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ke(X),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ke(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case ve.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:ve.IncrementalSnapshot,data:{source:ge.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ve.Meta:case ve.Load:case ve.DomContentLoaded:return!1;case ve.Plugin:return t;case ve.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case ve.IncrementalSnapshot:switch(t.data.source){case ge.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case ge.Drag:case ge.TouchMove:case ge.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case ge.ViewportResize:return!1;case ge.MediaInteraction:case ge.MouseInteraction:case ge.Scroll:case ge.CanvasMutation:case ge.Input:return this.replaceIds(t.data,e,["id"]),t;case ge.StyleSheetRule:case ge.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ge.Font:return t;case ge.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case ge.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(n,t[o]):t[o]=e.getId(n,t[o]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===C.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}function $e(e){return"__ln"in e}class Je{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&$e(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&$e(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Ye=(e,t)=>`${e}@${t}`;class Xe{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new Je,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{if(!o.parentNode||!Be(o))return;const s=j(o.parentNode)?this.mirror.getId(We(o)):this.mirror.getId(o.parentNode),i=r(o);if(-1===s||-1===i)return n.addNode(o);const a=me(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Fe(e,this.mirror)&&this.iframeManager.addIframe(e),Ue(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),je(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});a&&(e.push({parentId:s,nextId:i,node:a}),t.add(a.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)et(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)nt(this.droppedSet,e)||et(this.removes,e,this.mirror)?nt(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;n.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),n=r(s.value);-1!==t&&-1!==n&&(e=s)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}s=e.previous,n.removeNode(e.value),o(e.value)}const i={texts:this.texts.map((e=>({id:this.mirror.getId(e.node),value:e.value}))).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(i.texts.length||i.attributes.length||i.removes.length||i.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(i))},this.processMutation=e=>{if(!_e(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;Le(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:he(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t,De(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=K(t);r=G({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(Le(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let o=this.attributes.find((t=>t.node===e.target));if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;n="rr_src"}if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!ue(t.tagName,n)&&(o.attributes[n]=le(this.doc,H(t.tagName),H(n),r),"style"===n)){let n;try{n=document.implementation.createHTMLDocument()}catch(e){n=this.doc}const r=n.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const n=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);n!==r.style.getPropertyValue(e)||s!==r.style.getPropertyPriority(e)?o.styleDiff[e]=""===s?n:[n,s]:o._unchangedStyles[e]=[n,s]}for(const e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(o.styleDiff[e]=!1)}break}case"childList":if(Le(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),r=j(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Le(e.target,this.blockClass,this.blockSelector,!1)||_e(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Qe(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Ae(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ye(n,r)]?Qe(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!j(e.target)||!q(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(_e(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Ye(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Le(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),je(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Qe(e,t){e.delete(t),t.childNodes.forEach((t=>Qe(e,t)))}function et(e,t,n){return 0!==e.length&&tt(e,t,n)}function tt(e,t,n){const{parentNode:r}=t;if(!r)return!1;const o=n.getId(r);return!!e.some((e=>e.id===o))||tt(e,r,n)}function nt(e,t){return 0!==e.size&&rt(e,t)}function rt(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||rt(e,n))}const ot=[];function st(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function it(e,t){var n,r;const o=new Xe;ot.push(o),o.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const i=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");i&&window[i]&&(s=window[i]);const a=new s(Ve(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function at({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const i=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,a=[];let c=null;return Object.keys(ye).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{let i=H(s);const l=(t=>s=>{const i=st(s);if(Le(i,r,o,!0))return;let a=null,l=t;if("pointerType"in s){switch(s.pointerType){case"mouse":a=Se.Mouse;break;case"touch":a=Se.Touch;break;case"pen":a=Se.Pen}a===Se.Touch?ye[t]===ye.MouseDown?l="TouchStart":ye[t]===ye.MouseUp&&(l="TouchEnd"):Se.Pen}else Pe(s)&&(a=Se.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===Se.Touch||l.startsWith("Mouse")&&a===Se.Mouse)&&(a=null)):ye[t]===ye.Click&&(a=c,c=null);const u=Pe(s)?s.changedTouches[0]:s;if(!u)return;const d=n.getId(i),{clientX:h,clientY:p}=u;Ve(e)(Object.assign({type:ye[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(s);if(window.PointerEvent)switch(ye[s]){case ye.MouseDown:case ye.MouseUp:i=i.replace("mouse","pointer");break;case ye.TouchStart:case ye.TouchEnd:return}a.push(Ie(i,l,t))})),Ve((()=>{a.forEach((e=>e()))}))}function ct({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){return Ie("scroll",Ve(Ce(Ve((s=>{const i=st(s);if(!i||Le(i,r,o,!0))return;const a=n.getId(i);if(i===t&&t.defaultView){const n=Re(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:i.scrollLeft,y:i.scrollTop})})),s.scroll||100)),t)}function lt(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const ut=["INPUT","TEXTAREA","SELECT"],dt=new WeakMap;function ht(e){return function(e,t){if(vt("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||vt("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||vt("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||vt("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function pt(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function ft({mirror:e,stylesheetManager:t},n){var r,o,s;let i=null;i="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(s=null===(o=n.ownerDocument)||void 0===o?void 0:o.defaultView)||void 0===s?void 0:s.ShadowRoot,c=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==i&&-1!==i&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const r=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==i&&-1!==i)try{t.adoptStyleSheets(e,i)}catch(e){}return r}}),Ve((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function mt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:i,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),o(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),i(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)}}(e,t),e.recordDOM&&(r=it(e,e.doc));const o=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const o="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let i,a=[];const c=Ce(Ve((t=>{const n=Date.now()-i;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],i=null})),s),l=Ve(Ce(Ve((e=>{const t=st(e),{clientX:n,clientY:o}=Pe(e)?e.changedTouches[0]:e;i||(i=Te()),a.push({x:n,y:o,id:r.getId(t),timeOffset:Te()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?ge.Drag:e instanceof MouseEvent?ge.MouseMove:ge.TouchMove)})),o,{trailing:!1})),u=[Ie("mousemove",l,n),Ie("touchmove",l,n),Ie("drag",l,n)];return Ve((()=>{u.forEach((e=>e()))}))}(e),s=at(e),i=ct(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return Ie("resize",Ve(Ce(Ve((()=>{const t=xe(),o=Ne();n===t&&r===o||(e({width:Number(o),height:Number(t)}),n=t,r=o)})),200)),t)}(e,{win:n}),c=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:s,ignoreSelector:i,maskInputOptions:a,maskInputFn:c,sampling:l,userTriggeredOnInput:u}){function d(e){let n=st(e);const l=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||ut.indexOf(d)<0||Le(n,r,o,!0))return;if(n.classList.contains(s)||i&&n.matches(i))return;let p=n.value,f=!1;const m=K(n)||"";"radio"===m||"checkbox"===m?f=n.checked:(a[d.toLowerCase()]||a[m])&&(p=G({element:n,maskInputOptions:a,tagName:d,type:m,value:p,maskInputFn:c})),h(n,Ve(lt)({text:p,isChecked:f,userTriggered:l},u));const v=n.name;"radio"===m&&v&&f&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach((e=>{e!==n&&h(e,Ve(lt)({text:e.value,isChecked:!f,userTriggered:!1},u))}))}function h(t,r){const o=dt.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){dt.set(t,r);const o=n.getId(t);Ve(e)(Object.assign(Object.assign({},r),{id:o}))}}const p=("last"===l.input?["change"]:["input","change"]).map((e=>Ie(e,Ve(d),t))),f=t.defaultView;if(!f)return()=>{p.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),v=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&p.push(...v.map((e=>ke(e[0],e[1],{set(){Ve(d)({target:this,isTrusted:!1})}},!1,f)))),Ve((()=>{p.forEach((e=>e()))}))}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){const i=Ve((s=>Ce(Ve((o=>{const i=st(o);if(!i||Le(i,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:u}=i;e({type:s,id:r.getId(i),currentTime:a,volume:c,muted:l,playbackRate:u})})),o.media||500))),a=[Ie("play",i(0),s),Ie("pause",i(1),s),Ie("seeked",i(2),s),Ie("volumechange",i(3),s),Ie("ratechange",i(4),s)];return Ve((()=>{a.forEach((e=>e()))}))}(e);let u=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Ve(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=pt(o,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:a}]}),r.apply(o,s)}))});const s=r.CSSStyleSheet.prototype.deleteRule;let i,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:i}]}),r.apply(o,s)}))}),r.CSSStyleSheet.prototype.replace&&(i=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:i}),r.apply(o,s)}))})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:i}),r.apply(o,s)}))}));const c={};gt("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(gt("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),gt("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),gt("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach((([r,o])=>{l[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(l[r].insertRule,{apply:Ve(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=pt(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:[...ht(o),a||0]}]}),r.apply(o,s)}))}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:Ve(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=pt(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...ht(o),i]}]}),r.apply(o,s)}))})})),Ve((()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=s,i&&(r.CSSStyleSheet.prototype.replace=i),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),d=ft(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:Ve(((o,i,a)=>{var c;const[l,u,d]=a;if(n.has(l))return s.apply(i,[l,u,d]);const{id:h,styleId:p}=pt(null===(c=i.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:l,value:u,priority:d},index:ht(i.parentRule)}),o.apply(i,a)}))});const i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:Ve(((o,s,a)=>{var c;const[l]=a;if(n.has(l))return i.apply(s,[l]);const{id:u,styleId:d}=pt(null===(c=s.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,remove:{property:l},index:ht(s.parentRule)}),o.apply(s,a)}))}),Ve((()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i}))}(e,{win:n}),e.collectFonts&&(p=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],o=new WeakMap,s=n.FontFace;n.FontFace=function(e,t,n){const r=new s(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const i=Oe(t.fonts,"add",(function(t){return function(n){return setTimeout(Ve((()=>{const t=o.get(n);t&&(e(t),o.delete(n))})),0),t.apply(this,[n])}}));return r.push((()=>{n.FontFace=s})),r.push(i),Ve((()=>{r.forEach((e=>e()))}))}(e)));const f=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let i=!0;const a=Ve((()=>{const e=t.getSelection();if(!e||i&&(null==e?void 0:e.isCollapsed))return;i=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const s=e.getRangeAt(t),{startContainer:i,startOffset:c,endContainer:l,endOffset:u}=s;Le(i,r,o,!0)||Le(l,r,o,!0)||a.push({start:n.getId(i),startOffset:c,end:n.getId(l),endOffset:u})}s({ranges:a})}));return a(),Ie("selectionchange",a)}(e),m=[];for(const t of e.plugins)m.push(t.observer(t.callback,n,t.options));return Ve((()=>{ot.forEach((e=>e.reset())),null==r||r.disconnect(),o(),s(),i(),a(),c(),l(),u(),d(),h(),p(),f(),m.forEach((e=>e()))}))}function vt(e){return void 0!==window[e]}function gt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}function yt(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}for(var St,bt,It,wt=(St=function(){!function(){function e(e,t,n,r){return new(n||(n=Promise))((function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(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(i,a)}c((r=r.apply(e,t||[])).next())}))}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),r=0;r<t.length;r++)n[t.charCodeAt(r)]=r;var o=function(e){var n,r=new Uint8Array(e),o=r.length,s="";for(n=0;n<o;n+=3)s+=t[r[n]>>2],s+=t[(3&r[n])<<4|r[n+1]>>4],s+=t[(15&r[n+1])<<2|r[n+2]>>6],s+=t[63&r[n+2]];return o%3==2?s=s.substring(0,s.length-1)+"=":o%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const s=new Map,i=new Map,a=self;a.onmessage=function(t){return e(this,void 0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:t.data.id});{const{id:n,bitmap:r,width:c,height:l,dataURLOptions:u}=t.data,d=function(t,n,r){return e(this,void 0,void 0,(function*(){const e=`${t}-${n}`;if("OffscreenCanvas"in globalThis){if(i.has(e))return i.get(e);const s=new OffscreenCanvas(t,n);s.getContext("2d");const a=yield s.convertToBlob(r),c=yield a.arrayBuffer(),l=o(c);return i.set(e,l),l}return""}))}(c,l,u),h=new OffscreenCanvas(c,l);h.getContext("2d").drawImage(r,0,0),r.close();const p=yield h.convertToBlob(u),f=p.type,m=yield p.arrayBuffer(),v=o(m);if(!s.has(n)&&(yield d)===v)return s.set(n,v),a.postMessage({id:n});if(s.get(n)===v)return a.postMessage({id:n});a.postMessage({id:n,type:f,base64:v,width:c,height:l}),s.set(n,v)}}))}}()},bt=null,function(e){return It=It||function(e,t){var n=function(e,t){var n=void 0===t?null:t,r=e.toString().split("\n");r.pop(),r.shift();for(var o=r[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,i=0,a=r.length;i<a;++i)r[i]=r[i].substring(o).replace(s,"$1use strict$2")+"\n";return n&&r.push("//# sourceMappingURL="+n+"\n"),r}(e,t),r=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(r)}(St,bt),new Worker(It,e)}),Mt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ct="undefined"==typeof Uint8Array?[]:new Uint8Array(256),kt=0;kt<Mt.length;kt++)Ct[Mt.charCodeAt(kt)]=kt;const Ot=new Map;const Et=(e,t,n)=>{if(!e||!xt(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=Ot.get(e);return n||(n=new Map,Ot.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let o=r.indexOf(e);return-1===o&&(o=r.length,r.push(e)),o};function Tt(e,t,n){if(e instanceof Array)return e.map((e=>Tt(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),r=n.length,o="";for(t=0;t<r;t+=3)o+=Mt[n[t]>>2],o+=Mt[(3&n[t])<<4|n[t+1]>>4],o+=Mt[(15&n[t+1])<<2|n[t+2]>>6],o+=Mt[63&n[t+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Tt(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Tt(e.data,t,n),e.width,e.height]}}if(xt(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Et(e,t,n)}}return e}const Rt=(e,t,n)=>[...e].map((e=>Tt(e,t,n))),xt=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function Nt(e,t,n,r){const o=[];try{const s=Oe(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...s){if(!Le(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(o);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(s[0]&&"object"==typeof s[0]){const e=s[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[o,...s])}}));o.push(s)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach((e=>e()))}}function Dt(e,t,n,r,o,s,i){const a=[],c=Object.getOwnPropertyNames(e);for(const s of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const c=Oe(e,s,(function(e){return function(...a){const c=e.apply(this,a);if(Et(c,i,this),"tagName"in this.canvas&&!Le(this.canvas,r,o,!0)){const e=Rt([...a],i,this),r={type:t,property:s,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const o=ke(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(o)}return a}class Lt{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:r,blockSelector:o,recordCanvas:s,dataURLOptions:i}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(n,r,o),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,o,{dataURLOptions:i})}initCanvasFPSObserver(e,t,n,r,o){const s=Nt(t,n,r,!0),i=new Map,a=new wt;a.onmessage=e=>{const{id:t}=e.data;if(i.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:o,height:s}=e.data;this.mutationCb({id:t,type:be["2D"],commands:[{property:"clearRect",args:[0,0,o,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let l,u=0;const d=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{Le(t,n,r,!0)||e.push(t)})),e})().forEach((e=>yt(this,void 0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(i.get(n))return;if(i.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=yield createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:o.dataURLOptions},[r])}))))),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{s(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=Nt(e,t,n,!1),o=function(e,t,n,r){const o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const i of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[i])continue;const s=Oe(t.CanvasRenderingContext2D.prototype,i,(function(o){return function(...s){return Le(this.canvas,n,r,!0)||setTimeout((()=>{const n=Rt([...s],t,this);e(this.canvas,{type:be["2D"],property:i,args:n})}),0),o.apply(this,s)}}));o.push(s)}catch(n){const r=ke(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:be["2D"],property:i,args:[t],setter:!0})}});o.push(r)}return()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),s=function(e,t,n,r,o){const s=[];return s.push(...Dt(t.WebGLRenderingContext.prototype,be.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&s.push(...Dt(t.WebGL2RenderingContext.prototype,be.WebGL2,e,n,r,0,t)),()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map((e=>{const t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["type"]);return t})),{type:o}=n[0];this.mutationCb({id:t,type:o,commands:r}),this.pendingCanvasMutations.delete(e)}}class _t{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}class At{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!q(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=it(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(ct(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(ft({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(Oe(e.prototype,"attachShadow",(function(e){return function(r){const o=e.call(this,r);return this.shadowRoot&&Be(this)&&n.addShadowRoot(this.shadowRoot,t),o}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}class Pt{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new qe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:z(e),index:t})))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function Ft(e){return Object.assign(Object.assign({},e),{timestamp:Te()})}let Ut,jt,qt,Wt=!1;const zt=new B;function Bt(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:i="rr-ignore",ignoreSelector:a=null,maskTextClass:c="rr-mask",maskTextSelector:l=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:p,maskInputFn:f,maskTextFn:m,hooks:v,packFn:g,sampling:y={},dataURLOptions:S={},mousemoveWait:b,recordDOM:I=!0,recordCanvas:w=!1,recordCrossOriginIframes:M=!1,recordAfter:C=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:k=!1,collectFonts:O=!1,inlineImages:E=!1,plugins:T,keepIframeSrcFn:R=(()=>!1),ignoreCSSAttributes:x=new Set([]),errorHandler:N}=e;Ge(N);const D=!M||window.parent===window;let L=!1;if(!D)try{window.parent.document&&(L=!1)}catch(e){L=!0}if(D&&!t)throw new Error("emit function is required");void 0!==b&&void 0===y.mousemove&&(y.mousemove=b),zt.reset();const _=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==h?h:{password:!0},A=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p}:p||{};let P;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let F=0;const U=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return g&&!L&&(e=g(e)),e};Ut=(e,o)=>{var s;if(!(null===(s=ot[0])||void 0===s?void 0:s.isFrozen())||e.type===ve.FullSnapshot||e.type===ve.IncrementalSnapshot&&e.data.source===ge.Mutation||ot.forEach((e=>e.unfreeze())),D)null==t||t(U(e),o);else if(L){const t={type:"rrweb",event:U(e),origin:window.location.origin,isCheckout:o};window.parent.postMessage(t,"*")}if(e.type===ve.FullSnapshot)P=e,F=0;else if(e.type===ve.IncrementalSnapshot){if(e.data.source===ge.Mutation&&e.data.isAttachIframe)return;F++;const t=r&&F>=r,o=n&&e.timestamp-P.timestamp>n;(t||o)&&jt(!0)}};const j=e=>{Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Mutation},e)}))},q=e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Scroll},e)})),W=e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.CanvasMutation},e)})),z=new Pt({mutationCb:j,adoptedStyleSheetCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.AdoptedStyleSheet},e)}))}),G=new Ze({mirror:zt,mutationCb:j,stylesheetManager:z,recordCrossOriginIframes:M,wrappedEmit:Ut});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:zt,crossOriginIframeMirror:G.crossOriginIframeMirror,crossOriginIframeStyleMirror:G.crossOriginIframeStyleMirror});const H=new _t;qt=new Lt({recordCanvas:w,mutationCb:W,win:window,blockClass:o,blockSelector:s,mirror:zt,sampling:y.canvas,dataURLOptions:S});const V=new At({mutationCb:j,scrollCb:q,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:_,dataURLOptions:S,maskTextFn:m,maskInputFn:f,recordCanvas:w,inlineImages:E,sampling:y,slimDOMOptions:A,iframeManager:G,stylesheetManager:z,canvasManager:qt,keepIframeSrcFn:R,processedNodeManager:H},mirror:zt});jt=(e=!1)=>{if(!I)return;Ut(Ft({type:ve.Meta,data:{href:window.location.href,width:Ne(),height:xe()}}),e),z.reset(),V.init(),ot.forEach((e=>e.lock()));const t=function(e,t){var n=t||{},r=n.mirror,o=void 0===r?new B:r,s=n.blockClass,i=void 0===s?"rr-block":s,a=n.blockSelector,c=void 0===a?null:a,l=n.maskTextClass,u=void 0===l?"rr-mask":l,d=n.maskTextSelector,h=void 0===d?null:d,p=n.inlineStylesheet,f=void 0===p||p,m=n.inlineImages,v=void 0!==m&&m,g=n.recordCanvas,y=void 0!==g&&g,S=n.maskAllInputs,b=void 0!==S&&S,I=n.maskTextFn,w=n.maskInputFn,M=n.slimDOM,C=void 0!==M&&M,k=n.dataURLOptions,O=n.preserveWhiteSpace,E=n.onSerialize,T=n.onIframeLoad,R=n.iframeLoadTimeout,x=n.onStylesheetLoad,N=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return me(e,{doc:e,mirror:o,blockClass:i,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:f,maskInputOptions:!0===b?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===b?{password:!0}:b,maskTextFn:I,maskInputFn:w,slimDOMOptions:!0===C||"all"===C?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===C,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===C?{}:C,dataURLOptions:k,inlineImages:v,recordCanvas:y,preserveWhiteSpace:O,onSerialize:E,onIframeLoad:T,iframeLoadTimeout:R,onStylesheetLoad:x,stylesheetLoadTimeout:N,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:zt,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:_,maskTextFn:m,slimDOM:A,dataURLOptions:S,recordCanvas:w,inlineImages:E,onSerialize:e=>{Fe(e,zt)&&G.addIframe(e),Ue(e,zt)&&z.trackLinkElement(e),je(e)&&V.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{G.attachIframe(e,t),V.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:R});if(!t)return console.warn("Failed to snapshot the document");Ut(Ft({type:ve.FullSnapshot,data:{node:t,initialOffset:Re(window)}}),e),ot.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,zt.getId(document))};try{const e=[],t=e=>{var t;return Ve(mt)({mutationCb:j,mousemoveCb:(e,t)=>Ut(Ft({type:ve.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.MouseInteraction},e)})),scrollCb:q,viewportResizeCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.ViewportResize},e)})),inputCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Input},e)})),mediaInteractionCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.MediaInteraction},e)})),styleSheetRuleCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.StyleSheetRule},e)})),styleDeclarationCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.StyleDeclaration},e)})),canvasMutationCb:W,fontCb:e=>Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Font},e)})),selectionCb:e=>{Ut(Ft({type:ve.IncrementalSnapshot,data:Object.assign({source:ge.Selection},e)}))},blockClass:o,ignoreClass:i,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:_,inlineStylesheet:u,sampling:y,recordDOM:I,recordCanvas:w,inlineImages:E,userTriggeredOnInput:k,collectFonts:O,doc:e,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:R,blockSelector:s,slimDOMOptions:A,dataURLOptions:S,mirror:zt,iframeManager:G,stylesheetManager:z,shadowDomManager:V,processedNodeManager:H,canvasManager:qt,ignoreCSSAttributes:x,plugins:(null===(t=null==T?void 0:T.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Ut(Ft({type:ve.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},v)};G.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{jt(),e.push(t(document)),Wt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Ie("DOMContentLoaded",(()=>{Ut(Ft({type:ve.DomContentLoaded,data:{}})),"DOMContentLoaded"===C&&n()}))),e.push(Ie("load",(()=>{Ut(Ft({type:ve.Load,data:{}})),"load"===C&&n()}),window))),()=>{e.forEach((e=>e())),H.destroy(),Wt=!1,He()}}catch(e){console.warn(e)}}var Gt,Ht;Bt.addCustomEvent=(e,t)=>{if(!Wt)throw new Error("please add custom event after start recording");Ut(Ft({type:ve.Custom,data:{tag:e,payload:t}}))},Bt.freezePage=()=>{ot.forEach((e=>e.freeze()))},Bt.takeFullSnapshot=e=>{if(!Wt)throw new Error("please take full snapshot after start recording");jt(e)},Bt.mirror=zt,function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(Gt||(Gt={})),function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Ht||(Ht={}));var Vt=Uint8Array,Kt=Uint16Array,Zt=Uint32Array,$t=new Vt([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]),Jt=new Vt([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]),Yt=new Vt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xt=function(e,t){for(var n=new Kt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new Zt(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return[n,o]},Qt=Xt($t,2),en=Qt[0],tn=Qt[1];en[28]=258,tn[258]=28;for(var nn=Xt(Jt,0)[1],rn=new Kt(32768),on=0;on<32768;++on){var sn=(43690&on)>>>1|(21845&on)<<1;sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4,rn[on]=((65280&sn)>>>8|(255&sn)<<8)>>>1}var an=function(e,t,n){for(var r=e.length,o=0,s=new Kt(t);o<r;++o)++s[e[o]-1];var i,a=new Kt(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;if(n){i=new Kt(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var l=o<<4|e[o],u=t-e[o],d=a[e[o]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)i[rn[d]>>>c]=l}else for(i=new Kt(r),o=0;o<r;++o)i[o]=rn[a[e[o]-1]++]>>>15-e[o];return i},cn=new Vt(288);for(on=0;on<144;++on)cn[on]=8;for(on=144;on<256;++on)cn[on]=9;for(on=256;on<280;++on)cn[on]=7;for(on=280;on<288;++on)cn[on]=8;var ln=new Vt(32);for(on=0;on<32;++on)ln[on]=5;var un=an(cn,9,0),dn=an(ln,5,0),hn=function(e){return(e/8>>0)+(7&e&&1)},pn=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Kt?Kt:e instanceof Zt?Zt:Vt)(n-t);return r.set(e.subarray(t,n)),r},fn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},mn=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},vn=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,s=n.slice();if(!o)return[new Vt(0),0];if(1==o){var i=new Vt(n[0].s+1);return i[n[0].s]=1,[i,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=o-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=s[0].s;for(r=1;r<o;++r)s[r].s>h&&(h=s[r].s);var p=new Kt(h+1),f=gn(n[u-1],p,0);if(f>t){r=0;var m=0,v=f-t,g=1<<v;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<o;++r){var y=s[r].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var S=s[r].s;p[S]<t?m-=1<<t-p[S]++-1:++r}for(;r>=0&&m;--r){var b=s[r].s;p[b]==t&&(--p[b],++m)}f=t}return[new Vt(p),f]},gn=function(e,t,n){return-1==e.s?Math.max(gn(e.l,t,n+1),gn(e.r,t,n+1)):t[e.s]=n},yn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Kt(++t),r=0,o=e[0],s=1,i=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==o&&a!=t)++s;else{if(!o&&s>2){for(;s>138;s-=138)i(32754);s>2&&(i(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(i(o),--s;s>6;s-=6)i(8304);s>2&&(i(s-3<<5|8208),s=0)}for(;s--;)i(o);s=1,o=e[a]}return[n.subarray(0,r),t]},Sn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},bn=function(e,t,n){var r=n.length,o=hn(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 s=0;s<r;++s)e[o+s+4]=n[s];return 8*(o+4+r)},In=function(e,t,n,r,o,s,i,a,c,l,u){fn(t,u++,n),++o[256];for(var d=vn(o,15),h=d[0],p=d[1],f=vn(s,15),m=f[0],v=f[1],g=yn(h),y=g[0],S=g[1],b=yn(m),I=b[0],w=b[1],M=new Kt(19),C=0;C<y.length;++C)M[31&y[C]]++;for(C=0;C<I.length;++C)M[31&I[C]]++;for(var k=vn(M,7),O=k[0],E=k[1],T=19;T>4&&!O[Yt[T-1]];--T);var R,x,N,D,L=l+5<<3,_=Sn(o,cn)+Sn(s,ln)+i,A=Sn(o,h)+Sn(s,m)+i+14+3*T+Sn(M,O)+(2*M[16]+3*M[17]+7*M[18]);if(L<=_&&L<=A)return bn(t,u,e.subarray(c,c+l));if(fn(t,u,1+(A<_)),u+=2,A<_){R=an(h,p,0),x=h,N=an(m,v,0),D=m;var P=an(O,E,0);fn(t,u,S-257),fn(t,u+5,w-1),fn(t,u+10,T-4),u+=14;for(C=0;C<T;++C)fn(t,u+3*C,O[Yt[C]]);u+=3*T;for(var F=[y,I],U=0;U<2;++U){var j=F[U];for(C=0;C<j.length;++C){var q=31&j[C];fn(t,u,P[q]),u+=O[q],q>15&&(fn(t,u,j[C]>>>5&127),u+=j[C]>>>12)}}}else R=un,x=cn,N=dn,D=ln;for(C=0;C<a;++C)if(r[C]>255){q=r[C]>>>18&31;mn(t,u,R[q+257]),u+=x[q+257],q>7&&(fn(t,u,r[C]>>>23&31),u+=$t[q]);var W=31&r[C];mn(t,u,N[W]),u+=D[W],W>3&&(mn(t,u,r[C]>>>5&8191),u+=Jt[W])}else mn(t,u,R[r[C]]),u+=x[r[C]];return mn(t,u,R[256]),u+x[256]},wn=new Zt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mn=new Vt(0),Cn=function(e,t,n,r,o){return function(e,t,n,r,o,s){var i=e.length,a=new Vt(r+i+5*(1+Math.floor(i/7e3))+o),c=a.subarray(r,a.length-o),l=0;if(!t||i<8)for(var u=0;u<=i;u+=65535){var d=u+65535;d<i?l=bn(c,l,e.subarray(u,d)):(c[u]=s,l=bn(c,l,e.subarray(u,i)))}else{for(var h=wn[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new Kt(32768),g=new Kt(m+1),y=Math.ceil(n/3),S=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<S)&m},I=new Zt(25e3),w=new Kt(288),M=new Kt(32),C=0,k=0,O=(u=0,0),E=0,T=0;u<i;++u){var R=b(u),x=32767&u,N=g[R];if(v[x]=N,g[R]=x,E<=u){var D=i-u;if((C>7e3||O>24576)&&D>423){l=In(e,c,0,I,w,M,k,O,T,u-T,l),O=C=k=0,T=u;for(var L=0;L<286;++L)w[L]=0;for(L=0;L<30;++L)M[L]=0}var _=2,A=0,P=f,F=x-N&32767;if(D>2&&R==b(u-F))for(var U=Math.min(p,D)-1,j=Math.min(32767,u),q=Math.min(258,D);F<=j&&--P&&x!=N;){if(e[u+_]==e[u+_-F]){for(var W=0;W<q&&e[u+W]==e[u+W-F];++W);if(W>_){if(_=W,A=F,W>U)break;var z=Math.min(F,W-2),B=0;for(L=0;L<z;++L){var G=u-F+L+32768&32767,H=G-v[G]+32768&32767;H>B&&(B=H,N=G)}}}F+=(x=N)-(N=v[x])+32768&32767}if(A){I[O++]=268435456|tn[_]<<18|nn[A];var V=31&tn[_],K=31&nn[A];k+=$t[V]+Jt[K],++w[257+V],++M[K],E=u+_,++C}else I[O++]=e[u],++w[e[u]]}}l=In(e,c,s,I,w,M,k,O,T,u-T,l),s||(l=bn(c,l,Mn))}return pn(a,0,r+hn(l)+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 kn(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var r=e,o=t,s=n.length,i=0;i!=s;){for(var a=Math.min(i+5552,s);i<a;++i)o+=r+=n[i];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=Cn(e,t,2,4);return function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)}(r,t),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(r,r.length-4,n.d()),r}const On=e=>{const t=Object.assign(Object.assign({},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}(kn(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Vt(e.length+(e.length>>>1)),o=0,s=function(e){r[o++]=e},i=0;i<n;++i){if(o+5>r.length){var a=new Vt(o+8+(n-i<<1));a.set(r),r=a}var c=e.charCodeAt(i);c<128||t?s(c):c<2048?(s(192|c>>>6),s(128|63&c)):c>55295&&c<57344?(s(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++i))>>>18),s(128|c>>>12&63),s(128|c>>>6&63),s(128|63&c)):(s(224|c>>>12),s(128|c>>>6&63),s(128|63&c))}return pn(r,0,o)}(JSON.stringify(t))),!0)};var En,Tn,Rn;function xn(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}let Nn;function Dn(){return Nn||(Nn=function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=xn(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}("keyval-store","keyval")),Nn}function Ln(e,t=Dn()){return t("readonly",(t=>xn(t.get(e))))}function _n(e,t,n=Dn()){return n("readwrite",(n=>new Promise(((r,o)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),r(xn(n.transaction))}catch(e){o(e)}}}))))}(Tn=En||(En={}))[Tn.NotStarted=0]="NotStarted",Tn[Tn.Running=1]="Running",Tn[Tn.Stopped=2]="Stopped",function(e){e.RECORDING="recording",e.SENT="sent"}(Rn||(Rn={}));var An="Session replay event batch rejected due to exceeded retry count",Pn="Failed to store session replay events in IndexedDB",Fn=function(e){var t=e.apiKey,n=e.loggerProvider,r=this;this.storageKey="",this.getAllSessionDataFromStore=function(){return a(r,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Ln(this.storageKey)];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(e)),[3,3];case 3:return[2,void 0]}}))}))},this.storeEventsForSession=function(e,t,n){return a(r,void 0,void 0,(function(){var r;return c(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,_n(this.storageKey,(function(r){var o,s;void 0===r&&(r={});var a=r[n]||i({},P);a.currentSequenceId=t;var c=a.sessionSequences&&a.sessionSequences[t]||{};return c.events=e,c.status=Rn.RECORDING,i(i({},r),((o={})[n]=i(i({},a),{sessionSequences:i(i({},a.sessionSequences),(s={},s[t]=c,s))}),o))}))];case 1:return o.sent(),[3,3];case 2:return r=o.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(r)),[3,3];case 3:return[2]}}))}))},this.cleanUpSessionEventsStore=function(e,t){return a(r,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,_n(this.storageKey,(function(n){void 0===n&&(n={});var r=n[e],o=(null==r?void 0:r.sessionSequences)&&r.sessionSequences[t];return o?(o.events=[],o.status=Rn.SENT,Object.entries(r.sessionSequences).forEach((function(e){var n=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}(e,2),o=n[0],s=n[1],i=parseInt(o,10);s.status===Rn.SENT&&t!==i&&delete r.sessionSequences[i]})),Object.keys(n).forEach((function(e){var t=parseInt(e,10);Date.now()-t>=2592e5&&delete n[t]})),n):n}))];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.loggerProvider.warn("".concat(Pn,": ").concat(n)),[3,3];case 3:return[2]}}))}))},this.loggerProvider=n,this.storageKey="".concat(A,"_").concat(t.substring(0,10))},Un=function(e,t){var n;return(null===(n=t.classList)||void 0===n?void 0:n.contains("amp-unmask"))?e:"*".repeat(e.length)},jn=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},qn=function(e,t){return"".concat(t,"/").concat(e)},Wn=function(){function e(e){var t=e.loggerProvider;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=t}return e.prototype.sendEventsList=function(e){this.addToQueue(i(i({},e),{attempts:0,timeout:0}))},e.prototype.getServerUrl=function(e){return e===o.STAGING?"https://api-sr.stag2.amplitude.com//sessions/v2/track":e===o.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track"},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.filter((function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"".concat(An,", batch sequence id, ").concat(t.sequenceId)}),!1)}));r.forEach((function(t){-1===e.queue.findIndex((function(e){return e.sequenceId===t.sequenceId}))&&(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),a(this,void 0,void 0,(function(){var t,n,r=this;return c(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){return void 0===t&&(t=!0),a(this,void 0,void 0,(function(){var n,r,o,s,i,a,l,u,d,h,p,f;return c(this,(function(c){switch(c.label){case 0:if(!(n=e.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(r=e.deviceId))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];m=R(),o=(null==m?void 0:m.location)?m.location.href:"",s="0.2.5",i=e.sampleRate,a=new URLSearchParams({device_id:r,session_id:"".concat(e.sessionId),seq_number:"".concat(e.sequenceId)}),l={version:1,events:e.events},c.label=1;case 1:return c.trys.push([1,3,,4]),u={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(n),"X-Client-Version":s,"X-Client-Url":o,"X-Client-Sample-Rate":"".concat(i)},body:JSON.stringify(l),method:"POST"},d="".concat(this.getServerUrl(e.serverZone),"?").concat(a.toString()),[4,fetch(d,u)];case 2:if(null===(h=c.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(h.status,e);else{p="";try{p=JSON.stringify(h.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(h.status,": ").concat(p)})}return[3,4];case 3:return f=c.sent(),this.completeRequest({context:e,err:f}),[3,4];case 4:return[2]}var m}))}))},e.prototype.handleReponse=function(e,t){switch((new y).buildStatus(e)){case s.Success:this.handleSuccessResponse(t);break;case s.Failed:this.handleOtherResponse(t);break;default:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"})}},e.prototype.handleSuccessResponse=function(e){var t;this.completeRequest({context:e,success:(t=e.sessionId,"Session replay event batch tracked successfully for session id ".concat(t))})},e.prototype.handleOtherResponse=function(e){this.addToQueue(i(i({},e),{timeout:e.attempts*this.retryTimeout}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(t.sessionId,t.sequenceId),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e}(),zn=function(){function e(e){var t=e.config,n=this;this.events=[],this.currentSequenceId=0,this.maxPersistedEventsSize=1e6,this.interval=500,this.timeAtLastSend=null,this.shouldSplitEventsList=function(e){var t=new Blob([e]).size;return new Blob(n.events).size+t>=n.maxPersistedEventsSize||!!(null!==n.timeAtLastSend&&Date.now()-n.timeAtLastSend>n.interval&&n.events.length)&&(n.interval=Math.min(1e4,n.interval+500),n.timeAtLastSend=Date.now(),!0)},this.config=t,this.trackDestination=new Wn({loggerProvider:this.config.loggerProvider}),this.sessionIDBStore=new Fn({loggerProvider:this.config.loggerProvider,apiKey:this.config.apiKey})}return e.prototype.initialize=function(e){var t=e.sessionId,n=e.deviceId,r=e.shouldSendStoredEvents,o=void 0!==r&&r;return a(this,void 0,void 0,(function(){var e,r,s,i;return c(this,(function(a){switch(a.label){case 0:return this.timeAtLastSend=Date.now(),[4,this.sessionIDBStore.getAllSessionDataFromStore()];case 1:return e=a.sent(),r=e&&e[t],e&&r&&r.sessionSequences&&(s=r.currentSequenceId,(i=r.sessionSequences[s])&&i.status!==Rn.RECORDING?(this.currentSequenceId=s+1,this.events=[]):(this.currentSequenceId=s,this.events=(null==i?void 0:i.events)||[])),o&&e&&this.sendStoredEvents({storedReplaySessions:e,deviceId:n,sessionId:t}),[2]}}))}))},e.prototype.sendStoredEvents=function(e){var t=e.storedReplaySessions,n=e.sessionId,r=e.deviceId;for(var o in t){var s=t[o].sessionSequences;for(var i in s){var a=s[i],c=parseInt(i,10),l=parseInt(o,10);l===n&&c===this.currentSequenceId||a.events&&a.events.length&&a.status===Rn.RECORDING&&this.sendEventsList({events:a.events,sequenceId:c,sessionId:l,deviceId:r})}}},e.prototype.resetSequence=function(){this.events=[],this.currentSequenceId=0},e.prototype.addEvent=function(e){var t=e.event,n=e.sessionId,r=e.deviceId;this.shouldSplitEventsList(t)&&(this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:n,deviceId:r}),this.events=[],this.currentSequenceId++),this.events.push(t),this.sessionIDBStore.storeEventsForSession(this.events,this.currentSequenceId,n)},e.prototype.sendEvents=function(e){var t=e.sessionId,n=e.deviceId;this.events.length&&t&&this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:t,deviceId:n})},e.prototype.sendEventsList=function(e){var t=e.events,n=e.sequenceId,r=e.sessionId,o=e.deviceId;this.trackDestination.sendEventsList({events:t,sequenceId:n,sessionId:r,flushMaxRetries:this.config.flushMaxRetries,apiKey:this.config.apiKey,deviceId:o,sampleRate:this.config.sampleRate,serverZone:this.config.serverZone,onComplete:this.sessionIDBStore.cleanUpSessionEventsStore.bind(this.sessionIDBStore)})},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){return c(this,(function(t){return this.trackDestination?[2,this.trackDestination.flush(e)]:[2]}))}))},e}(),Bn=function(e,t){this.deviceId=e.deviceId,this.sessionId=e.sessionId,e.sessionId&&e.deviceId?this.sessionReplayId=qn(e.sessionId,e.deviceId):t.error("Please provide both sessionId and deviceId.")},Gn=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.blurListener=function(){e.stopRecordingAndSendEvents()},this.focusListener=function(){e.initialize()},this.stopRecordingEvents=function(){try{e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null}catch(n){var t=n;e.loggerProvider.warn("Error occurred while stopping recording: ".concat(t.toString()))}},this.loggerProvider=new d}return e.prototype.init=function(e,t){return{promise:this._init(e,t)||Promise.resolve()}},e.prototype._init=function(e,t){return a(this,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return this.config=new U(e,t),this.loggerProvider=this.config.loggerProvider,this.identifiers=new Bn(t,this.loggerProvider),this.eventsManager=new zn({config:this.config}),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),(n=R())&&(n.removeEventListener("blur",this.blurListener),n.removeEventListener("focus",this.focusListener),n.addEventListener("blur",this.blurListener),n.addEventListener("focus",this.focusListener)),n&&n.document&&n.document.hasFocus()?[4,this.initialize(!0)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.prototype.setSessionId=function(e,t){if(this.identifiers){t&&(this.identifiers.deviceId=t);var n=this.getDeviceId();e&&n?(this.identifiers.sessionReplayId=qn(e,n),this.stopRecordingAndSendEvents(this.identifiers.sessionId),this.identifiers.sessionId=e,this.eventsManager&&this.eventsManager.resetSequence(),this.recordEvents()):this.loggerProvider.error("Must provide either session replay id or session id when starting a new session.")}else this.loggerProvider.error("Session replay init has not been called, cannot set session id.")},e.prototype.getSessionReplayDebugPropertyValue=function(){var e="";return this.config&&(e=jn(this.config.apiKey).toString()),JSON.stringify({appHash:e})},e.prototype.getSessionReplayProperties=function(){var e;if(!this.config||!this.identifiers)return this.loggerProvider.error("Session replay init has not been called, cannot get session recording properties."),{};var t=!!this.config.debugMode;if(this.getShouldRecord(t)){var n=((e={})[D]=this.identifiers.sessionReplayId?this.identifiers.sessionReplayId:null,e);return this.config.debugMode&&(n[_]=this.getSessionReplayDebugPropertyValue()),n}return{}},e.prototype.stopRecordingAndSendEvents=function(e){var t;this.stopRecordingEvents();var n=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),r=this.getDeviceId();this.eventsManager&&n&&r&&this.eventsManager.sendEvents({sessionId:n,deviceId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var n;return c(this,(function(r){switch(r.label){case 0:return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(n=this.getDeviceId(),this.eventsManager&&n?[4,this.eventsManager.initialize({sessionId:this.identifiers.sessionId,shouldSendStoredEvents:e,deviceId:n})]:[3,2]):(this.loggerProvider.warn("Session is not being recorded due to lack of session id."),[2]);case 1:r.sent(),r.label=2;case 2:return this.recordEvents(),[2]}}))}))},e.prototype.shouldOptOut=function(){var e,t,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=T(this.config.instanceName).identityStore.getIdentity().optOut);return void 0!==n?n:null===(t=this.config)||void 0===t?void 0:t.optOut},e.prototype.getShouldRecord=function(e){if(void 0===e&&(e=!1),!this.identifiers||!this.config)return this.loggerProvider.error("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;var t=R();if(!e&&t&&t.document&&!t.document.hasFocus())return this.identifiers.sessionId&&this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," temporarily not recording due to lack of browser focus.")),!1;if(this.shouldOptOut())return this.identifiers.sessionId&&this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;if(!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of session id."),!1;var n,r,o,s=(n=this.identifiers.sessionId,r=this.config.sampleRate,o=jn(n.toString()),31*Math.abs(o)%100/100<r);return s||this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate.")),s},e.prototype.getBlockSelectors=function(){var e,t;return null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.blockSelector},e.prototype.recordEvents=function(){var e,t=this,n=this.getShouldRecord(),r=null===(e=this.identifiers)||void 0===e?void 0:e.sessionId;n&&r&&(this.stopRecordingEvents(),this.recordCancelCallback=Bt({emit:function(e){var n=R();if(n&&n.document&&!n.document.hasFocus()||!t.getShouldRecord())t.stopRecordingAndSendEvents();else{var o=JSON.stringify(e),s=t.getDeviceId();s&&t.eventsManager&&t.eventsManager.addEvent({event:o,sessionId:r,deviceId:s})}},packFn:On,maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",blockSelector:this.getBlockSelectors(),maskInputFn:Un,recordCanvas:!1,errorHandler:function(e){var n=e;return t.loggerProvider.warn("Error while recording: ",n.toString()),!0}}))},e.prototype.getDeviceId=function(){var e,t,n;(null===(e=this.config)||void 0===e?void 0:e.instanceName)&&(n=T(this.config.instanceName).identityStore.getIdentity().deviceId);return n||(null===(t=this.identifiers)||void 0===t?void 0:t.deviceId)},e.prototype.getSessionId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.sessionId},e.prototype.flush=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){return c(this,(function(t){return this.eventsManager?[2,this.eventsManager.flush(e)]:[2]}))}))},e.prototype.shutdown=function(){var e=R();e&&(e.removeEventListener("blur",this.blurListener),e.removeEventListener("focus",this.focusListener)),this.stopRecordingAndSendEvents()},e}(),Hn=function(e){return function(){var t=e.config||F();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Vn=function(){var e=new Gn;return{init:g(e.init.bind(e),"init",Hn(e)),setSessionId:g(e.setSessionId.bind(e),"setSessionId",Hn(e)),getSessionId:g(e.getSessionId.bind(e),"getSessionId",Hn(e)),getSessionReplayProperties:g(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Hn(e)),flush:g(e.flush.bind(e),"flush",Hn(e)),shutdown:g(e.shutdown.bind(e),"shutdown",Hn(e))}}(),Kn=Vn.init,Zn=Vn.setSessionId,$n=Vn.getSessionId,Jn=Vn.getSessionReplayProperties,Yn=Vn.flush,Xn=Vn.shutdown,Qn="@amplitude/plugin-session-replay-enrichment-browser",er=function(){function e(){this.name=Qn,this.type="enrichment"}return e.prototype.setup=function(e,t){return a(this,void 0,void 0,(function(){return c(this,(function(t){return this.config=e,[2]}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){return this.config.sessionId&&this.config.sessionId!==$n()&&Zn(this.config.sessionId),this.config.sessionId&&this.config.sessionId===e.session_id&&(t=Jn(),e.event_properties=i(i({},e.event_properties),t)),[2,Promise.resolve(e)]}))}))},e}(),tr=function(){function e(e){this.name="@amplitude/plugin-session-replay-browser",this.type="destination",this.options=i({},e),!1!==this.options.forceSessionTracking&&(this.options.forceSessionTracking=!0)}return e.prototype.setup=function(e,t){var n;return a(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return t?(e.loggerProvider.log("Installing @amplitude/plugin-session-replay."),this.client=t,this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=i(i({},e.defaultTracking),{sessions:!0})),[4,Kn(e.apiKey,{instanceName:this.config.instanceName,deviceId:this.config.deviceId,optOut:this.config.optOut,sessionId:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null===(n=this.options.privacyConfig)||void 0===n?void 0:n.blockSelector},debugMode:this.options.debugMode}).promise]):(e.loggerProvider.error("SessionReplayPlugin requires v1.9.1+ of the Amplitude SDK."),[2]);case 1:return r.sent(),[4,t.add(new er).promise];case 2:return r.sent(),[2]}}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){return[2,Promise.resolve({event:e,code:200,message:"success"})]}))}))},e.prototype.flush=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,Yn(!1)];case 1:return e.sent(),[2]}}))}))},e.prototype.teardown=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this.client.remove(Qn).promise];case 1:return e.sent(),Xn(),this.config=null,this.client=null,[2]}}))}))},e.prototype.getSessionReplayProperties=function(){return Jn()},e}(),nr=function(e){return new tr(e)};e.plugin=nr,e.sessionReplayPlugin=nr,Object.defineProperty(e,"__esModule",{value:!0})}));
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/plugin-session-replay-browser",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "",
5
5
  "author": "Amplitude Inc",
6
6
  "homepage": "https://github.com/amplitude/Amplitude-TypeScript",
@@ -40,7 +40,7 @@
40
40
  "@amplitude/analytics-client-common": ">=1 <3",
41
41
  "@amplitude/analytics-core": ">=1 <3",
42
42
  "@amplitude/analytics-types": ">=1 <3",
43
- "@amplitude/session-replay-browser": "^1.2.5",
43
+ "@amplitude/session-replay-browser": "^1.2.6",
44
44
  "idb-keyval": "^6.2.1",
45
45
  "tslib": "^2.4.1"
46
46
  },
@@ -56,5 +56,5 @@
56
56
  "files": [
57
57
  "lib"
58
58
  ],
59
- "gitHead": "aed98e453a25c8223b47e185ec8ef27074ffb9f2"
59
+ "gitHead": "82c4a8997e5744073cd43e35203769fb8fa83fa5"
60
60
  }