@amplitude/plugin-session-replay-browser 0.6.13 → 0.6.15
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"}(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=f(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}(),g=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},f=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:g(r,n)}},m=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},v=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:m(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}},I=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,g,f,m,v,I,y,C,S,b,A;if("object"!=typeof e)return null;var w=e.code||0,k=this.buildStatus(w);switch(k){case s.Success:return{status:k,statusCode:w,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:w,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!==(g=e.throttled_devices)&&void 0!==g?g:{},throttledEvents:null!==(f=e.throttled_events)&&void 0!==f?f:[]}};case s.PayloadTooLarge:return{status:k,statusCode:w,body:{error:null!==(m=e.error)&&void 0!==m?m:""}};case s.RateLimit:return{status:k,statusCode:w,body:{error:null!==(v=e.error)&&void 0!==v?v:"",epsThreshold:null!==(I=e.eps_threshold)&&void 0!==I?I:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(C=e.throttled_users)&&void 0!==C?C:{},exceededDailyQuotaDevices:null!==(S=e.exceeded_daily_quota_devices)&&void 0!==S?S:{},exceededDailyQuotaUsers:null!==(b=e.exceeded_daily_quota_users)&&void 0!==b?b:{},throttledEvents:null!==(A=e.throttled_events)&&void 0!==A?A:[]}};case s.Timeout:default:return{status:k,statusCode:w}}},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}(),y=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:C(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),C=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},S=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}(),b=function(){return b=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},b.apply(this,arguments)},A=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(!A(a,c))return!1;var l=!0;return Object.keys(e).forEach((function(n){A(e[n],t[n])||(l=!1)})),l}for(var u=0;u<e.length;u++)if(!A(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 w=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=b({},this.identity.userProperties),n=b(b({},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,g=Object.keys(a);p<g.length;p++){delete t[d=g[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return b({},this.identity)},e.prototype.setIdentity=function(e){var t=b({},this.identity);this.identity=b({},e),A(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}(),k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,M=function(){function e(){this.identityStore=new w,this.eventBridge=new S,this.applicationContextProvider=new y}return e.getInstance=function(t){return k.analyticsConnectorInstances||(k.analyticsConnectorInstances={}),k.analyticsConnectorInstances[t]||(k.analyticsConnectorInstances[t]=new e),k.analyticsConnectorInstances[t]},e}(),T=function(e){return void 0===e&&(e="$default_instance"),M.getInstance(e)},E=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},R=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}(I),N=function(){return{flushMaxRetries:2,logLevel:r.Warn,loggerProvider:new d,transportProvider:new R}},O=function(e){function t(t,n){var r=this,o=N();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||1,r.deviceId=n.deviceId,r.sessionId=n.sessionId,r}return n(t,e),t}(p);function D(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}let x;function L(){return x||(x=function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=D(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}("keyval-store","keyval")),x}function F(e,t=L()){return t("readonly",(t=>D(t.get(e))))}function U(e,t,n=L()){return n("readwrite",(n=>new Promise(((r,o)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),r(D(n.transaction))}catch(e){o(e)}}}))))}var W;function B(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function _(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function Z(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(P).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 P(e){var t;if(function(e){return"styleSheet"in e}(e))try{t=Z(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){}return function(e){if(e.includes(":")){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}return e}(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"}(W||(W={}));var G=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 V(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,o=e.type,s=e.value,i=e.maskInputFn,a=s||"",c=o&&K(o);return(n[r.toLowerCase()]||c&&n[c])&&(a=i?i(a,t):"*".repeat(a.length)),a}function K(e){return e.toLowerCase()}var q="__rrweb_original__";function Y(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?K(t):null}var z,j,J=1,Q=new RegExp("[^a-z0-9-_:]");function H(){return J++}var X=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,$=/^(?:[a-z+]+:)?\/\//i,ee=/^www\..*/i,te=/^(data:)([^,]*),(.*)/i;function ne(e,t){return(e||"").replace(X,(function(e,n,r,o,s,i){var a,c=r||s||i,l=n||o||"";if(!c)return e;if($.test(c)||ee.test(c))return"url(".concat(l).concat(c).concat(l,")");if(te.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 g=p[h];"."!==g&&(".."===g?u.pop():u.push(g))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var re=/^[^ \t\n\r\u000c]+/,oe=/^[, \t\n\r\u000c]+/;function se(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function ie(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ae(){var e=document.createElement("a");return e.href="",e.href}function ce(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?se(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(oe),!(n>=t.length);){var s=r(re);if(","===s.slice(-1))s=se(e,s.substring(0,s.length-1)),o.push(s);else{var i="";s=se(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?ne(r,ae()):"object"===t&&"data"===n?se(e,r):r:se(e,r):r}function le(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function ue(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&ue(e.parentNode,t,n);for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return!!n&&ue(e.parentNode,t,n)}function de(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(ue(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}}catch(e){}return!1}function he(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,g=void 0===p?{}:p,f=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,I=t.newlyAddedElement,y=void 0!==I&&I,C=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:W.Document,childNodes:[],compatMode:e.compatMode}:{type:W.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:W.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};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,g=t.newlyAddedElement,f=void 0!==g&&g,m=t.rootId,v=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),I=function(e){if(e instanceof HTMLFormElement)return"form";var t=K(e.tagName);return Q.test(t)?"div":t}(e),y={},C=e.attributes.length,S=0;S<C;S++){var b=e.attributes[S];le(I,b.name,b.value)||(y[b.name]=ce(n,I,K(b.name),b.value))}if("link"===I&&s){var A=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),w=null;A&&(w=Z(A)),w&&(delete y.rel,delete y.href,y._cssText=ne(w,A.href))}if("style"===I&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(w=Z(e.sheet))&&(y._cssText=ne(w,ae()))}if("input"===I||"textarea"===I||"select"===I){var k=e.value,M=e.checked;if("radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&k){var T=Y(e);y.value=V({element:e,type:T,tagName:I,value:k,maskInputOptions:a,maskInputFn:c})}else M&&(y.checked=M)}"option"===I&&(e.selected&&!a.select?y.selected=!0:delete y.selected);if("canvas"===I&&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=q in o?o[q]: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)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var E=e.toDataURL(u.type,u.quality),R=document.createElement("canvas");R.width=e.width,R.height=e.height,E!==R.toDataURL(u.type,u.quality)&&(y.rr_dataURL=E)}if("img"===I&&d){z||(z=n.createElement("canvas"),j=z.getContext("2d"));var N=e,O=N.crossOrigin;N.crossOrigin="anonymous";var D=function(){N.removeEventListener("load",D);try{z.width=N.naturalWidth,z.height=N.naturalHeight,j.drawImage(N,0,0),y.rr_dataURL=z.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(N.currentSrc,"! Error: ").concat(e))}O?y.crossOrigin=O:N.removeAttribute("crossorigin")};N.complete&&0!==N.naturalWidth?D():N.addEventListener("load",D)}"audio"!==I&&"video"!==I||(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime);f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(v){var x=e.getBoundingClientRect(),L=x.width,F=x.height;y={class:y.class,rr_width:"".concat(L,"px"),rr_height:"".concat(F,"px")}}"iframe"!==I||p(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);return{type:W.Element,tagName:I,attributes:y,childNodes:[],isSVG:ie(e)||void 0,needBlock:v,rootId:m}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:g,inlineImages:f,recordCanvas:m,keepIframeSrcFn:v,newlyAddedElement:y,rootId:C});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=Z(e.parentNode.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=ne(c,ae())}u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&de(e,r,o)&&(c=s?s(c):c.replace(/[\S]/g,"*"));return{type:W.Text,textContent:c||"",isStyle:l,rootId:i}}(e,{maskTextClass:i,maskTextSelector:a,maskTextFn:d,rootId:C});case e.CDATA_SECTION_NODE:return{type:W.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return{type:W.Comment,textContent:e.textContent||"",rootId:C};default:return!1}}function pe(e){return null==e?"":e.toLowerCase()}function ge(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,g=void 0===p?{}:p,f=t.maskTextFn,m=t.maskInputFn,v=t.slimDOMOptions,I=t.dataURLOptions,y=void 0===I?{}:I,C=t.inlineImages,S=void 0!==C&&C,b=t.recordCanvas,A=void 0!==b&&b,w=t.onSerialize,k=t.onIframeLoad,M=t.iframeLoadTimeout,T=void 0===M?5e3:M,E=t.onStylesheetLoad,R=t.stylesheetLoadTimeout,N=void 0===R?5e3:R,O=t.keepIframeSrcFn,D=void 0===O?function(){return!1}:O,x=t.newlyAddedElement,L=void 0!==x&&x,F=t.preserveWhiteSpace,U=void 0===F||F,Z=he(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,dataURLOptions:y,inlineImages:S,recordCanvas:A,keepIframeSrcFn:D,newlyAddedElement:L});if(!Z)return console.warn(e,"not serialized"),null;n=o.hasNode(e)?o.getId(e):!function(e,t){if(t.comment&&e.type===W.Comment)return!0;if(e.type===W.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&&(pe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===pe(e.attributes.name)||"icon"===pe(e.attributes.rel)||"apple-touch-icon"===pe(e.attributes.rel)||"shortcut icon"===pe(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&pe(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(pe(e.attributes.property).match(/^(og|twitter|fb):/)||pe(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===pe(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===pe(e.attributes.name)||"googlebot"===pe(e.attributes.name)||"bingbot"===pe(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===pe(e.attributes.name)||"generator"===pe(e.attributes.name)||"framework"===pe(e.attributes.name)||"publisher"===pe(e.attributes.name)||"progid"===pe(e.attributes.name)||pe(e.attributes.property).match(/^article:/)||pe(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===pe(e.attributes.name)||"yandex-verification"===pe(e.attributes.name)||"csrf-token"===pe(e.attributes.name)||"p:domain_verify"===pe(e.attributes.name)||"verify-v1"===pe(e.attributes.name)||"verification"===pe(e.attributes.name)||"shopify-checkout-api-token"===pe(e.attributes.name)))return!0}}return!1}(Z,v)&&(U||Z.type!==W.Text||Z.isStyle||Z.textContent.replace(/^\s+|\s+$/gm,"").length)?H():-2;var P=Object.assign(Z,{id:n});if(o.add(e,P),-2===n)return null;w&&w(e);var G=!u;if(P.type===W.Element){G=G&&!P.needBlock,delete P.needBlock;var V=e.shadowRoot;V&&_(V)&&(P.isShadowHost=!0)}if((P.type===W.Document||P.type===W.Element)&&G){v.headWhitespace&&P.type===W.Element&&"head"===P.tagName&&(U=!1);for(var K={doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D},q=0,Y=Array.from(e.childNodes);q<Y.length;q++){(J=ge(Y[q],K))&&P.childNodes.push(J)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var z=0,j=Array.from(e.shadowRoot.childNodes);z<j.length;z++){var J;(J=ge(j[z],K))&&(_(e.shadowRoot)&&(J.isShadow=!0),P.childNodes.push(J))}}return e.parentNode&&B(e.parentNode)&&_(e.parentNode)&&(P.isShadow=!0),P.type===W.Element&&"iframe"===P.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&&k){var n=ge(t,{doc:t,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D});n&&k(e,n)}}),T),P.type===W.Element&&"link"===P.tagName&&"stylesheet"===P.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(E){var t=ge(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D});t&&E(e,t)}}),N),P}function fe(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const me="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 ve={map:{},getId:()=>(console.error(me),-1),getNode:()=>(console.error(me),null),removeNodeFromMap(){console.error(me)},has:()=>(console.error(me),!1),reset(){console.error(me)}};function Ie(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 ye(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)}}),()=>ye(e,t,s||{},!0)}function Ce(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&&(ve=new Proxy(ve,{get:(e,t,n)=>("map"===t&&console.error(me),Reflect.get(e,t,n))}));let Se=Date.now;function be(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 Ae(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function we(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ke(e,t,n,r){if(!e)return!1;const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;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(ue(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 Me(e,t){return-2===t.getId(e)}function Te(e,t){if(B(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Te(e.parentNode,t))}function Ee(e){return Boolean(e.changedTouches)}function Re(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ne(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Oe(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Se=()=>(new Date).getTime());class De{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 xe(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 Le(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=xe(n);)n=t;return n}(e);return t.contains(n)}function Fe(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||Le(e))}var Ue=(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))(Ue||{}),We=(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))(We||{}),Be=(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))(Be||{}),_e=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(_e||{}),Ze=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ze||{});function Pe(e){return"__ln"in e}class Ge{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&&Pe(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&&Pe(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 Ve=(e,t)=>`${e}@${t}`;class Ke{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 Ge,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||!Fe(o))return;const s=B(o.parentNode)?this.mirror.getId(xe(o)):this.mirror.getId(o.parentNode),i=r(o);if(-1===s||-1===i)return n.addNode(o);const a=ge(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=>{Re(e,this.mirror)&&this.iframeManager.addIframe(e),Ne(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Oe(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)Ye(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)je(this.droppedSet,e)||Ye(this.removes,e,this.mirror)?je(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(Me(e.target,this.mirror))return;let t;try{t=document.implementation.createHTMLDocument()}catch(e){t=this.doc}switch(e.type){case"characterData":{const t=e.target.textContent;ke(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:de(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,o=e.target.getAttribute(r);if("value"===r){const e=Y(n);o=V({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:o,maskInputFn:this.maskInputFn})}if(ke(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributes.find((t=>t.node===e.target));if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(o)){if(n.contentDocument)return;r="rr_src"}if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!le(n.tagName,r)&&(s.attributes[r]=ce(this.doc,K(n.tagName),K(r),o),"style"===r)){const r=t.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),o=n.style.getPropertyPriority(e);t!==r.style.getPropertyValue(e)||o!==r.style.getPropertyPriority(e)?s.styleDiff[e]=""===o?t:[t,o]:s._unchangedStyles[e]=[t,o]}for(const e of Array.from(r.style))""===n.style.getPropertyValue(e)&&(s.styleDiff[e]=!1)}break}case"childList":if(ke(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=B(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);ke(e.target,this.blockClass,this.blockSelector,!1)||Me(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||Te(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ve(n,r)]?qe(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!B(e.target)||!_(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(Me(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[Ve(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ke(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),Oe(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 Ye(e,t,n){return 0!==e.length&&ze(e,t,n)}function ze(e,t,n){const{parentNode:r}=t;if(!r)return!1;const o=n.getId(r);return!!e.some((e=>e.id===o))||ze(e,r,n)}function je(e,t){return 0!==e.size&&Je(e,t)}function Je(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Je(e,n))}let Qe;function He(e){Qe=e}function Xe(){Qe=void 0}const $e=e=>{if(!Qe)return e;return(...t)=>{try{return e(...t)}catch(e){if(Qe&&!0===Qe(e))return;throw e}}},et=[];function tt(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 nt(e,t){var n,r;const o=new Ke;et.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($e(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function rt({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(Be).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{let i=K(s);const l=(t=>s=>{const i=tt(s);if(ke(i,r,o,!0))return;let a=null,l=t;if("pointerType"in s){switch(s.pointerType){case"mouse":a=_e.Mouse;break;case"touch":a=_e.Touch;break;case"pen":a=_e.Pen}a===_e.Touch?Be[t]===Be.MouseDown?l="TouchStart":Be[t]===Be.MouseUp&&(l="TouchEnd"):_e.Pen}else Ee(s)&&(a=_e.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===_e.Touch||l.startsWith("Mouse")&&a===_e.Mouse)&&(a=null)):Be[t]===Be.Click&&(a=c,c=null);const u=Ee(s)?s.changedTouches[0]:s;if(!u)return;const d=n.getId(i),{clientX:h,clientY:p}=u;$e(e)(Object.assign({type:Be[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(s);if(window.PointerEvent)switch(Be[s]){case Be.MouseDown:case Be.MouseUp:i=i.replace("mouse","pointer");break;case Be.TouchStart:case Be.TouchEnd:return}a.push(fe(i,l,t))})),$e((()=>{a.forEach((e=>e()))}))}function ot({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){return fe("scroll",$e(Ie($e((s=>{const i=tt(s);if(!i||ke(i,r,o,!0))return;const a=n.getId(i);if(i===t&&t.defaultView){const n=be(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 st(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const it=["INPUT","TEXTAREA","SELECT"],at=new WeakMap;function ct(e){return function(e,t){if(ht("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ht("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ht("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ht("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 lt(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function ut({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=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");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}}),$e((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function dt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!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);const r=nt(e,e.doc),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=Ie($e((t=>{const n=Date.now()-i;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],i=null})),s),l=$e(Ie($e((e=>{const t=tt(e),{clientX:n,clientY:o}=Ee(e)?e.changedTouches[0]:e;i||(i=Se()),a.push({x:n,y:o,id:r.getId(t),timeOffset:Se()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?We.Drag:e instanceof MouseEvent?We.MouseMove:We.TouchMove)})),o,{trailing:!1})),u=[fe("mousemove",l,n),fe("touchmove",l,n),fe("drag",l,n)];return $e((()=>{u.forEach((e=>e()))}))}(e),s=rt(e),i=ot(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return fe("resize",$e(Ie($e((()=>{const t=Ae(),o=we();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=tt(e);const l=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||it.indexOf(d)<0||ke(n,r,o,!0))return;if(n.classList.contains(s)||i&&n.matches(i))return;let p=n.value,g=!1;const f=Y(n)||"";"radio"===f||"checkbox"===f?g=n.checked:(a[d.toLowerCase()]||a[f])&&(p=V({element:n,maskInputOptions:a,tagName:d,type:f,value:p,maskInputFn:c})),h(n,$e(st)({text:p,isChecked:g,userTriggered:l},u));const m=n.name;"radio"===f&&m&&g&&t.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach((e=>{e!==n&&h(e,$e(st)({text:e.value,isChecked:!g,userTriggered:!1},u))}))}function h(t,r){const o=at.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){at.set(t,r);const o=n.getId(t);$e(e)(Object.assign(Object.assign({},r),{id:o}))}}const p=("last"===l.input?["change"]:["input","change"]).map((e=>fe(e,$e(d),t))),g=t.defaultView;if(!g)return()=>{p.forEach((e=>e()))};const f=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),m=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...m.map((e=>ye(e[0],e[1],{set(){$e(d)({target:this,isTrusted:!1})}},!1,g)))),$e((()=>{p.forEach((e=>e()))}))}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){const i=$e((s=>Ie($e((o=>{const i=tt(o);if(!i||ke(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=[fe("play",i(0),s),fe("pause",i(1),s),fe("seeked",i(2),s),fe("volumechange",i(3),s),fe("ratechange",i(4),s)];return $e((()=>{a.forEach((e=>e()))}))}(e),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:$e(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=lt(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:$e(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=lt(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:$e(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=lt(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:$e(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=lt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:i}),r.apply(o,s)}))}));const c={};pt("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(pt("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),pt("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),pt("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:$e(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=lt(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:[...ct(o),a||0]}]}),r.apply(o,s)}))}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:$e(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=lt(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...ct(o),i]}]}),r.apply(o,s)}))})})),$e((()=>{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=ut(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:$e(((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}=lt(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:ct(i.parentRule)}),o.apply(i,a)}))});const i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:$e(((o,s,a)=>{var c;const[l]=a;if(n.has(l))return i.apply(s,[l]);const{id:u,styleId:d}=lt(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:ct(s.parentRule)}),o.apply(s,a)}))}),$e((()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i}))}(e,{win:n}),p=e.collectFonts?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=Ce(t.fonts,"add",(function(t){return function(n){return setTimeout($e((()=>{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),$e((()=>{r.forEach((e=>e()))}))}(e):()=>{},g=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let i=!0;const a=$e((()=>{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;ke(i,r,o,!0)||ke(l,r,o,!0)||a.push({start:n.getId(i),startOffset:c,end:n.getId(l),endOffset:u})}s({ranges:a})}));return a(),fe("selectionchange",a)}(e),f=[];for(const t of e.plugins)f.push(t.observer(t.callback,n,t.options));return $e((()=>{et.forEach((e=>e.reset())),r.disconnect(),o(),s(),i(),a(),c(),l(),u(),d(),h(),p(),g(),f.forEach((e=>e()))}))}function ht(e){return void 0!==window[e]}function pt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class gt{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 ft{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new gt(H),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new gt(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 Ue.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:Ue.IncrementalSnapshot,data:{source:We.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ue.Meta:case Ue.Load:case Ue.DomContentLoaded:return!1;case Ue.Plugin:return t;case Ue.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Ue.IncrementalSnapshot:switch(t.data.source){case We.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 We.Drag:case We.TouchMove:case We.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case We.ViewportResize:return!1;case We.MediaInteraction:case We.MouseInteraction:case We.Scroll:case We.CanvasMutation:case We.Input:return this.replaceIds(t.data,e,["id"]),t;case We.StyleSheetRule:case We.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case We.Font:return t;case We.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case We.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===W.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class mt{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(!_(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=nt(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(ot(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(ut({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(Ce(e.prototype,"attachShadow",(function(e){return function(r){const o=e.call(this,r);return this.shadowRoot&&Fe(this)&&n.addShadowRoot(this.shadowRoot,t),o}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}function vt(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 It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ct=0;Ct<It.length;Ct++)yt[It.charCodeAt(Ct)]=Ct;const St=new Map;const bt=(e,t,n)=>{if(!e||!kt(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=St.get(e);return n||(n=new Map,St.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 At(e,t,n){if(e instanceof Array)return e.map((e=>At(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+=It[n[t]>>2],o+=It[(3&n[t])<<4|n[t+1]>>4],o+=It[(15&n[t+1])<<2|n[t+2]>>6],o+=It[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:[At(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:[At(e.data,t,n),e.width,e.height]}}if(kt(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:bt(e,t,n)}}return e}const wt=(e,t,n)=>[...e].map((e=>At(e,t,n))),kt=(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 Mt(e,t,n,r){const o=[];try{const s=Ce(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...s){if(!ke(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 Tt(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=Ce(e,s,(function(e){return function(...a){const c=e.apply(this,a);if(bt(c,i,this),"tagName"in this.canvas&&!ke(this.canvas,r,o,!0)){const e=wt([...a],i,this),r={type:t,property:s,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const o=ye(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(o)}return a}function Et(e,t,n){var r=void 0===t?null:t,o=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,s=n.length;o<s;++o)r[o]=n.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(e,void 0!==n&&n),s=o.indexOf("\n",10)+1,i=o.substring(s)+(r?"//# sourceMappingURL="+r:""),a=new Blob([i],{type:"application/javascript"});return URL.createObjectURL(a)}var Rt,Nt,Ot,Dt,xt=(Rt="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",Nt=null,Ot=!1,function(e){return Dt=Dt||Et(Rt,Nt,Ot),new Worker(Dt,e)});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=Mt(t,n,r,!0),i=new Map,a=new xt;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:Ze["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=>{ke(t,n,r,!0)||e.push(t)})),e})().forEach((e=>vt(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=Mt(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=Ce(t.CanvasRenderingContext2D.prototype,i,(function(o){return function(...s){return ke(this.canvas,n,r,!0)||setTimeout((()=>{const n=wt([...s],t,this);e(this.canvas,{type:Ze["2D"],property:i,args:n})}),0),o.apply(this,s)}}));o.push(s)}catch(n){const r=ye(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:Ze["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(...Tt(t.WebGLRenderingContext.prototype,Ze.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&s.push(...Tt(t.WebGL2RenderingContext.prototype,Ze.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 Ft{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new De,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;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);r.push({styleId:e,rules:n.map(((e,t)=>({rule:P(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){}}class Ut{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}}function Wt(e){return Object.assign(Object.assign({},e),{timestamp:Se()})}let Bt,_t,Zt,Pt=!1;const Gt=new G;function Vt(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:g,maskTextFn:f,hooks:m,packFn:v,sampling:I={},dataURLOptions:y={},mousemoveWait:C,recordCanvas:S=!1,recordCrossOriginIframes:b=!1,recordAfter:A=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:w=!1,collectFonts:k=!1,inlineImages:M=!1,plugins:T,keepIframeSrcFn:E=(()=>!1),ignoreCSSAttributes:R=new Set([]),errorHandler:N}=e;He(N);const O=!b||window.parent===window;let D=!1;if(!O)try{window.parent.document&&(D=!1)}catch(e){D=!0}if(O&&!t)throw new Error("emit function is required");void 0!==C&&void 0===I.mousemove&&(I.mousemove=C),Gt.reset();const x=!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},L=!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 F;!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 U=0;const W=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!D&&(e=v(e)),e};Bt=(e,o)=>{var s;if(!(null===(s=et[0])||void 0===s?void 0:s.isFrozen())||e.type===Ue.FullSnapshot||e.type===Ue.IncrementalSnapshot&&e.data.source===We.Mutation||et.forEach((e=>e.unfreeze())),O)null==t||t(W(e),o);else if(D){const t={type:"rrweb",event:W(e),origin:window.location.origin,isCheckout:o};window.parent.postMessage(t,"*")}if(e.type===Ue.FullSnapshot)F=e,U=0;else if(e.type===Ue.IncrementalSnapshot){if(e.data.source===We.Mutation&&e.data.isAttachIframe)return;U++;const t=r&&U>=r,o=n&&e.timestamp-F.timestamp>n;(t||o)&&_t(!0)}};const B=e=>{Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Mutation},e)}))},_=e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Scroll},e)})),Z=e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.CanvasMutation},e)})),P=new Ft({mutationCb:B,adoptedStyleSheetCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.AdoptedStyleSheet},e)}))}),V=new ft({mirror:Gt,mutationCb:B,stylesheetManager:P,recordCrossOriginIframes:b,wrappedEmit:Bt});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:Gt,crossOriginIframeMirror:V.crossOriginIframeMirror,crossOriginIframeStyleMirror:V.crossOriginIframeStyleMirror});const K=new Ut;Zt=new Lt({recordCanvas:S,mutationCb:Z,win:window,blockClass:o,blockSelector:s,mirror:Gt,sampling:I.canvas,dataURLOptions:y});const q=new mt({mutationCb:B,scrollCb:_,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:x,dataURLOptions:y,maskTextFn:f,maskInputFn:g,recordCanvas:S,inlineImages:M,sampling:I,slimDOMOptions:L,iframeManager:V,stylesheetManager:P,canvasManager:Zt,keepIframeSrcFn:E,processedNodeManager:K},mirror:Gt});_t=(e=!1)=>{Bt(Wt({type:Ue.Meta,data:{href:window.location.href,width:we(),height:Ae()}}),e),P.reset(),q.init(),et.forEach((e=>e.lock()));const t=function(e,t){var n=t||{},r=n.mirror,o=void 0===r?new G: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,g=void 0===p||p,f=n.inlineImages,m=void 0!==f&&f,v=n.recordCanvas,I=void 0!==v&&v,y=n.maskAllInputs,C=void 0!==y&&y,S=n.maskTextFn,b=n.maskInputFn,A=n.slimDOM,w=void 0!==A&&A,k=n.dataURLOptions,M=n.preserveWhiteSpace,T=n.onSerialize,E=n.onIframeLoad,R=n.iframeLoadTimeout,N=n.onStylesheetLoad,O=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return ge(e,{doc:e,mirror:o,blockClass:i,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:!0===C?{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===C?{password:!0}:C,maskTextFn:S,maskInputFn:b,slimDOMOptions:!0===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===w,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===w?{}:w,dataURLOptions:k,inlineImages:m,recordCanvas:I,preserveWhiteSpace:M,onSerialize:T,onIframeLoad:E,iframeLoadTimeout:R,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:Gt,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:x,maskTextFn:f,slimDOM:L,dataURLOptions:y,recordCanvas:S,inlineImages:M,onSerialize:e=>{Re(e,Gt)&&V.addIframe(e),Ne(e,Gt)&&P.trackLinkElement(e),Oe(e)&&q.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{V.attachIframe(e,t),q.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{P.attachLinkElement(e,t)},keepIframeSrcFn:E});if(!t)return console.warn("Failed to snapshot the document");Bt(Wt({type:Ue.FullSnapshot,data:{node:t,initialOffset:be(window)}}),e),et.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&P.adoptStyleSheets(document.adoptedStyleSheets,Gt.getId(document))};try{const e=[],t=e=>{var t;return $e(dt)({mutationCb:B,mousemoveCb:(e,t)=>Bt(Wt({type:Ue.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.MouseInteraction},e)})),scrollCb:_,viewportResizeCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.ViewportResize},e)})),inputCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Input},e)})),mediaInteractionCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.MediaInteraction},e)})),styleSheetRuleCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.StyleSheetRule},e)})),styleDeclarationCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.StyleDeclaration},e)})),canvasMutationCb:Z,fontCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Font},e)})),selectionCb:e=>{Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Selection},e)}))},blockClass:o,ignoreClass:i,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:x,inlineStylesheet:u,sampling:I,recordCanvas:S,inlineImages:M,userTriggeredOnInput:w,collectFonts:k,doc:e,maskInputFn:g,maskTextFn:f,keepIframeSrcFn:E,blockSelector:s,slimDOMOptions:L,dataURLOptions:y,mirror:Gt,iframeManager:V,stylesheetManager:P,shadowDomManager:q,processedNodeManager:K,canvasManager:Zt,ignoreCSSAttributes:R,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=>Bt(Wt({type:Ue.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},m)};V.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{_t(),e.push(t(document)),Pt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(fe("DOMContentLoaded",(()=>{Bt(Wt({type:Ue.DomContentLoaded,data:{}})),"DOMContentLoaded"===A&&n()}))),e.push(fe("load",(()=>{Bt(Wt({type:Ue.Load,data:{}})),"load"===A&&n()}),window))),()=>{e.forEach((e=>e())),K.destroy(),Pt=!1,Xe()}}catch(e){console.warn(e)}}var Kt,qt;Vt.addCustomEvent=(e,t)=>{if(!Pt)throw new Error("please add custom event after start recording");Bt(Wt({type:Ue.Custom,data:{tag:e,payload:t}}))},Vt.freezePage=()=>{et.forEach((e=>e.freeze()))},Vt.takeFullSnapshot=e=>{if(!Pt)throw new Error("please take full snapshot after start recording");_t(e)},Vt.mirror=Gt,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"}(Kt||(Kt={})),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"}(qt||(qt={}));var Yt=Uint8Array,zt=Uint16Array,jt=Uint32Array,Jt=new Yt([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]),Qt=new Yt([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]),Ht=new Yt([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 zt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new jt(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]},$t=Xt(Jt,2),en=$t[0],tn=$t[1];en[28]=258,tn[258]=28;for(var nn=Xt(Qt,0)[1],rn=new zt(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 zt(t);o<r;++o)++s[e[o]-1];var i,a=new zt(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;if(n){i=new zt(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 zt(r),o=0;o<r;++o)i[o]=rn[a[e[o]-1]++]>>>15-e[o];return i},cn=new Yt(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 Yt(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 zt?zt:e instanceof jt?jt:Yt)(n-t);return r.set(e.subarray(t,n)),r},gn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},fn=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},mn=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 Yt(0),0];if(1==o){var i=new Yt(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 zt(h+1),g=vn(n[u-1],p,0);if(g>t){r=0;var f=0,m=g-t,v=1<<m;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<o;++r){var I=s[r].s;if(!(p[I]>t))break;f+=v-(1<<g-p[I]),p[I]=t}for(f>>>=m;f>0;){var y=s[r].s;p[y]<t?f-=1<<t-p[y]++-1:++r}for(;r>=0&&f;--r){var C=s[r].s;p[C]==t&&(--p[C],++f)}g=t}return[new Yt(p),g]},vn=function(e,t,n){return-1==e.s?Math.max(vn(e.l,t,n+1),vn(e.r,t,n+1)):t[e.s]=n},In=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new zt(++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]},yn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Cn=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)},Sn=function(e,t,n,r,o,s,i,a,c,l,u){gn(t,u++,n),++o[256];for(var d=mn(o,15),h=d[0],p=d[1],g=mn(s,15),f=g[0],m=g[1],v=In(h),I=v[0],y=v[1],C=In(f),S=C[0],b=C[1],A=new zt(19),w=0;w<I.length;++w)A[31&I[w]]++;for(w=0;w<S.length;++w)A[31&S[w]]++;for(var k=mn(A,7),M=k[0],T=k[1],E=19;E>4&&!M[Ht[E-1]];--E);var R,N,O,D,x=l+5<<3,L=yn(o,cn)+yn(s,ln)+i,F=yn(o,h)+yn(s,f)+i+14+3*E+yn(A,M)+(2*A[16]+3*A[17]+7*A[18]);if(x<=L&&x<=F)return Cn(t,u,e.subarray(c,c+l));if(gn(t,u,1+(F<L)),u+=2,F<L){R=an(h,p,0),N=h,O=an(f,m,0),D=f;var U=an(M,T,0);gn(t,u,y-257),gn(t,u+5,b-1),gn(t,u+10,E-4),u+=14;for(w=0;w<E;++w)gn(t,u+3*w,M[Ht[w]]);u+=3*E;for(var W=[I,S],B=0;B<2;++B){var _=W[B];for(w=0;w<_.length;++w){var Z=31&_[w];gn(t,u,U[Z]),u+=M[Z],Z>15&&(gn(t,u,_[w]>>>5&127),u+=_[w]>>>12)}}}else R=un,N=cn,O=dn,D=ln;for(w=0;w<a;++w)if(r[w]>255){Z=r[w]>>>18&31;fn(t,u,R[Z+257]),u+=N[Z+257],Z>7&&(gn(t,u,r[w]>>>23&31),u+=Jt[Z]);var P=31&r[w];fn(t,u,O[P]),u+=D[P],P>3&&(fn(t,u,r[w]>>>5&8191),u+=Qt[P])}else fn(t,u,R[r[w]]),u+=N[r[w]];return fn(t,u,R[256]),u+N[256]},bn=new jt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),An=new Yt(0),wn=function(e,t,n,r,o){return function(e,t,n,r,o,s){var i=e.length,a=new Yt(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=Cn(c,l,e.subarray(u,d)):(c[u]=s,l=Cn(c,l,e.subarray(u,i)))}else{for(var h=bn[t-1],p=h>>>13,g=8191&h,f=(1<<n)-1,m=new zt(32768),v=new zt(f+1),I=Math.ceil(n/3),y=2*I,C=function(t){return(e[t]^e[t+1]<<I^e[t+2]<<y)&f},S=new jt(25e3),b=new zt(288),A=new zt(32),w=0,k=0,M=(u=0,0),T=0,E=0;u<i;++u){var R=C(u),N=32767&u,O=v[R];if(m[N]=O,v[R]=N,T<=u){var D=i-u;if((w>7e3||M>24576)&&D>423){l=Sn(e,c,0,S,b,A,k,M,E,u-E,l),M=w=k=0,E=u;for(var x=0;x<286;++x)b[x]=0;for(x=0;x<30;++x)A[x]=0}var L=2,F=0,U=g,W=N-O&32767;if(D>2&&R==C(u-W))for(var B=Math.min(p,D)-1,_=Math.min(32767,u),Z=Math.min(258,D);W<=_&&--U&&N!=O;){if(e[u+L]==e[u+L-W]){for(var P=0;P<Z&&e[u+P]==e[u+P-W];++P);if(P>L){if(L=P,F=W,P>B)break;var G=Math.min(W,P-2),V=0;for(x=0;x<G;++x){var K=u-W+x+32768&32767,q=K-m[K]+32768&32767;q>V&&(V=q,O=K)}}}W+=(N=O)-(O=m[N])+32768&32767}if(F){S[M++]=268435456|tn[L]<<18|nn[F];var Y=31&tn[L],z=31&nn[F];k+=Jt[Y]+Qt[z],++b[257+Y],++A[z],T=u+L,++w}else S[M++]=e[u],++b[e[u]]}}l=Sn(e,c,s,S,b,A,k,M,E,u-E,l),s||(l=Cn(c,l,An))}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=wn(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 Mn=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 Yt(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 Yt(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 Tn,En;(En=Tn||(Tn={}))[En.NotStarted=0]="NotStarted",En[En.Running=1]="Running",En[En.Stopped=2]="Stopped";var Rn,Nn="".concat("[Amplitude]"," Session Recorded"),On="".concat("AMP","_replay_unsent"),Dn={currentSequenceId:0,sessionSequences:{}},xn=function(e,t){var n;return(null===(n=t.classList)||void 0===n?void 0:n.contains("amp-unmask"))?e:"*".repeat(e.length)},Ln="Session replay event batch rejected due to exceeded retry count",Fn="Failed to store session replay events in IndexedDB";!function(e){e.RECORDING="recording",e.SENT="sent"}(Rn||(Rn={}));var Un=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.storageKey="",this.retryTimeout=1e3,this.events=[],this.currentSequenceId=0,this.scheduled=null,this.queue=[],this.stopRecordingEvents=null,this.maxPersistedEventsSize=1e6,this.interval=500,this.timeAtLastSend=null,this.getSessionRecordingProperties=function(){return e.loggerProvider.warn("Please use getSessionReplayProperties instead of getSessionRecordingProperties."),e.getSessionReplayProperties()},this.blurListener=function(){e.stopRecordingAndSendEvents()},this.focusListener=function(){e.initialize()},this.shouldSplitEventsList=function(t){var n=new Blob([t]).size;return new Blob(e.events).size+n>=e.maxPersistedEventsSize||!!(null!==e.timeAtLastSend&&Date.now()-e.timeAtLastSend>e.interval&&e.events.length)&&(e.interval=Math.min(1e4,e.interval+500),e.timeAtLastSend=Date.now(),!0)},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 O(e,t),this.loggerProvider=this.config.loggerProvider,this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.storageKey="".concat(On,"_").concat(this.config.apiKey.substring(0,10)),(n=E())&&(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){this.config?(this.stopRecordingAndSendEvents(this.config.sessionId),this.config.sessionId=e,this.events=[],this.currentSequenceId=0,this.recordEvents()):this.loggerProvider.error("Session replay init has not been called, cannot set session id.")},e.prototype.getSessionReplayProperties=function(){var e;return this.config?this.getShouldRecord()?((e={})[Nn]=!0,e):{}:(this.loggerProvider.error("Session replay init has not been called, cannot get session recording properties."),{})},e.prototype.stopRecordingAndSendEvents=function(e){var t;try{this.stopRecordingEvents&&this.stopRecordingEvents(),this.stopRecordingEvents=null}catch(e){var n=e;this.loggerProvider.error("Error occurred while stopping recording: ".concat(n.toString()))}var r=e||(null===(t=this.config)||void 0===t?void 0:t.sessionId);this.events.length&&r&&this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var n,r,o,s;return c(this,(function(i){switch(i.label){case 0:return this.timeAtLastSend=Date.now(),(null===(t=this.config)||void 0===t?void 0:t.sessionId)?[4,this.getAllSessionEventsFromStore()]:(this.loggerProvider.warn("Session is not being recorded due to lack of session id."),[2]);case 1:return n=i.sent(),this.stopRecordingEvents?[2]:(r=n&&n[this.config.sessionId],n&&r&&r.sessionSequences&&(o=r.currentSequenceId,(s=r.sessionSequences[o])&&s.status!==Rn.RECORDING?(this.currentSequenceId=o+1,this.events=[]):(this.currentSequenceId=o,this.events=(null==s?void 0:s.events)||[])),e&&n&&this.sendStoredEvents(n),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 n||(null===(t=this.config)||void 0===t?void 0:t.optOut)},e.prototype.getShouldRecord=function(){if(!this.config)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;var e,t,n,r=E();if(r&&r.document&&!r.document.hasFocus())return this.config.sessionId&&this.loggerProvider.log("Session ".concat(this.config.sessionId," temporarily not recording due to lack of browser focus.")),!1;if(this.shouldOptOut())return this.config.sessionId&&this.loggerProvider.log("Opting session ".concat(this.config.sessionId," out of recording due to optOut config.")),!1;if(!this.config.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of session id."),!1;if(this.config.sampleRate){var o=(e=this.config.sessionId,t=this.config.sampleRate,n=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}(e.toString()),31*Math.abs(n)%100/100<t);return o||this.loggerProvider.log("Opting session ".concat(this.config.sessionId," out of recording due to sample rate.")),o}return!0},e.prototype.sendStoredEvents=function(e){var t;for(var n in e){var r=e[n].sessionSequences;for(var o in r){var s=r[o],i=parseInt(o,10),a=parseInt(n,10);a===(null===(t=this.config)||void 0===t?void 0:t.sessionId)&&i===this.currentSequenceId||s.events.length&&s.status===Rn.RECORDING&&this.sendEventsList({events:s.events,sequenceId:i,sessionId:a})}}},e.prototype.recordEvents=function(){var e,t=this,n=this.getShouldRecord(),r=null===(e=this.config)||void 0===e?void 0:e.sessionId;n&&r&&(this.stopRecordingEvents=Vt({emit:function(e){var n=E();if(n&&n.document&&!n.document.hasFocus())t.stopRecordingAndSendEvents();else{var o=JSON.stringify(e);t.shouldSplitEventsList(o)&&(t.sendEventsList({events:t.events,sequenceId:t.currentSequenceId,sessionId:r}),t.events=[],t.currentSequenceId++),t.events.push(o),t.storeEventsForSession(t.events,t.currentSequenceId,r)}},packFn:Mn,maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",maskInputFn:xn,recordCanvas:!1,errorHandler:function(e){var n=e;return t.loggerProvider.error("Error while recording: ",n.toString()),!0}}))},e.prototype.sendEventsList=function(e){var t=e.events,n=e.sequenceId,r=e.sessionId;this.addToQueue({events:t,sequenceId:n,attempts:0,timeout:0,sessionId:r})},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){var n;return t.attempts<((null===(n=e.config)||void 0===n?void 0:n.flushMaxRetries)||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"".concat(Ln,", 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.getServerUrl=function(){var e;return(null===(e=this.config)||void 0===e?void 0:e.serverZone)===o.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track"},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.config)||void 0===t?void 0:t.deviceId)},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),a(this,void 0,void 0,(function(){var r,o,s,i,a,l,u,d,h;return c(this,(function(c){switch(c.label){case 0:if(!(r=null===(n=this.config)||void 0===n?void 0:n.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(o=this.getDeviceId()))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];s=new URLSearchParams({device_id:o,session_id:"".concat(e.sessionId),seq_number:"".concat(e.sequenceId)}),i={version:1,events:e.events},c.label=1;case 1:return c.trys.push([1,3,,4]),a={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(r)},body:JSON.stringify(i),method:"POST"},l="".concat(this.getServerUrl(),"?").concat(s.toString()),[4,fetch(l,a)];case 2:if(null===(u=c.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(u.status,e);else{d="";try{d=JSON.stringify(u.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(u.status,": ").concat(d)})}return[3,4];case 3:return h=c.sent(),this.completeRequest({context:e,err:h}),[3,4];case 4:return[2]}}))}))},e.prototype.handleReponse=function(e,t){switch((new I).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.getAllSessionEventsFromStore=function(){return a(this,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,F(this.storageKey)];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.loggerProvider.error("".concat(Fn,": ").concat(e)),[3,3];case 3:return[2,void 0]}}))}))},e.prototype.storeEventsForSession=function(e,t,n){return a(this,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,U(this.storageKey,(function(r){var o,s;void 0===r&&(r={});var a=r[n]||i({},Dn);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.error("".concat(Fn,": ").concat(r)),[3,3];case 3:return[2]}}))}))},e.prototype.cleanUpSessionEventsStore=function(e,t){return a(this,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,U(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.error("".concat(Fn,": ").concat(n)),[3,3];case 3:return[2]}}))}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.sessionId&&this.cleanUpSessionEventsStore(t.sessionId,t.sequenceId),n?this.loggerProvider.error(n):r&&this.loggerProvider.log(r)},e.prototype.shutdown=function(){var e=E();e&&(e.removeEventListener("blur",this.blurListener),e.removeEventListener("focus",this.focusListener)),this.stopRecordingAndSendEvents()},e}(),Wn=function(e){return function(){var t=e.config||N();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Bn=function(){var e=new Un;return{init:v(e.init.bind(e),"init",Wn(e)),setSessionId:v(e.setSessionId.bind(e),"setSessionId",Wn(e)),getSessionRecordingProperties:v(e.getSessionRecordingProperties.bind(e),"getSessionRecordingProperties",Wn(e)),getSessionReplayProperties:v(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Wn(e)),shutdown:v(e.shutdown.bind(e),"teardown",Wn(e))}}(),_n=Bn.init,Zn=Bn.setSessionId;Bn.getSessionRecordingProperties;var Pn=Bn.getSessionReplayProperties,Gn=Bn.shutdown,Vn=function(){function e(e){this.name="@amplitude/plugin-session-replay-browser",this.type="enrichment",this.options=i({},e)}return e.prototype.setup=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return e.loggerProvider.log("Installing @amplitude/plugin-session-replay."),this.config=e,"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,_n(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}).promise];case 1:return t.sent(),[2]}}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){return"session_start"===e.event_type&&e.session_id&&Zn(e.session_id),t=Pn(),e.event_properties=i(i({},e.event_properties),t),[2,Promise.resolve(e)]}))}))},e.prototype.teardown=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){return Gn(),[2]}))}))},e}(),Kn=function(e){return new Vn(e)};return e.plugin=Kn,e.sessionReplayPlugin=Kn,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"}(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=f(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}(),g=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},f=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:g(r,n)}},m=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},v=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:m(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}},I=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,g,f,m,v,I,y,C,S,b,A;if("object"!=typeof e)return null;var w=e.code||0,k=this.buildStatus(w);switch(k){case s.Success:return{status:k,statusCode:w,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:w,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!==(g=e.throttled_devices)&&void 0!==g?g:{},throttledEvents:null!==(f=e.throttled_events)&&void 0!==f?f:[]}};case s.PayloadTooLarge:return{status:k,statusCode:w,body:{error:null!==(m=e.error)&&void 0!==m?m:""}};case s.RateLimit:return{status:k,statusCode:w,body:{error:null!==(v=e.error)&&void 0!==v?v:"",epsThreshold:null!==(I=e.eps_threshold)&&void 0!==I?I:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(C=e.throttled_users)&&void 0!==C?C:{},exceededDailyQuotaDevices:null!==(S=e.exceeded_daily_quota_devices)&&void 0!==S?S:{},exceededDailyQuotaUsers:null!==(b=e.exceeded_daily_quota_users)&&void 0!==b?b:{},throttledEvents:null!==(A=e.throttled_events)&&void 0!==A?A:[]}};case s.Timeout:default:return{status:k,statusCode:w}}},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}(),y=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:C(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),C=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},S=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}(),b=function(){return b=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},b.apply(this,arguments)},A=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(!A(a,c))return!1;var l=!0;return Object.keys(e).forEach((function(n){A(e[n],t[n])||(l=!1)})),l}for(var u=0;u<e.length;u++)if(!A(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 w=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=b({},this.identity.userProperties),n=b(b({},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,g=Object.keys(a);p<g.length;p++){delete t[d=g[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return b({},this.identity)},e.prototype.setIdentity=function(e){var t=b({},this.identity);this.identity=b({},e),A(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}(),k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,M=function(){function e(){this.identityStore=new w,this.eventBridge=new S,this.applicationContextProvider=new y}return e.getInstance=function(t){return k.analyticsConnectorInstances||(k.analyticsConnectorInstances={}),k.analyticsConnectorInstances[t]||(k.analyticsConnectorInstances[t]=new e),k.analyticsConnectorInstances[t]},e}(),T=function(e){return void 0===e&&(e="$default_instance"),M.getInstance(e)},E=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},R=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}(I),N="".concat("[Amplitude]"," Session Recorded"),O="".concat("AMP","_replay_unsent"),D={currentSequenceId:0,sessionSequences:{}},x=function(){return{flushMaxRetries:2,logLevel:r.Warn,loggerProvider:new d,transportProvider:new R}},L=function(e){function t(t,n){var r=this,o=x();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.deviceId=n.deviceId,r.sessionId=n.sessionId,r}return n(t,e),t}(p);function F(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}let U;function W(){return U||(U=function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=F(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}("keyval-store","keyval")),U}function B(e,t=W()){return t("readonly",(t=>F(t.get(e))))}function _(e,t,n=W()){return n("readwrite",(n=>new Promise(((r,o)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),r(F(n.transaction))}catch(e){o(e)}}}))))}var Z;function P(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function G(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function V(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(K).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 K(e){var t;if(function(e){return"styleSheet"in e}(e))try{t=V(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){}return function(e){if(e.includes(":")){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}return e}(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"}(Z||(Z={}));var q=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 Y(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,o=e.type,s=e.value,i=e.maskInputFn,a=s||"",c=o&&z(o);return(n[r.toLowerCase()]||c&&n[c])&&(a=i?i(a,t):"*".repeat(a.length)),a}function z(e){return e.toLowerCase()}var j="__rrweb_original__";function J(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?z(t):null}var Q,H,X=1,$=new RegExp("[^a-z0-9-_:]");function ee(){return X++}var te=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ne=/^(?:[a-z+]+:)?\/\//i,re=/^www\..*/i,oe=/^(data:)([^,]*),(.*)/i;function se(e,t){return(e||"").replace(te,(function(e,n,r,o,s,i){var a,c=r||s||i,l=n||o||"";if(!c)return e;if(ne.test(c)||re.test(c))return"url(".concat(l).concat(c).concat(l,")");if(oe.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 g=p[h];"."!==g&&(".."===g?u.pop():u.push(g))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var ie=/^[^ \t\n\r\u000c]+/,ae=/^[, \t\n\r\u000c]+/;function ce(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function le(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ue(){var e=document.createElement("a");return e.href="",e.href}function de(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?ce(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(ae),!(n>=t.length);){var s=r(ie);if(","===s.slice(-1))s=ce(e,s.substring(0,s.length-1)),o.push(s);else{var i="";s=ce(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?se(r,ue()):"object"===t&&"data"===n?ce(e,r):r:ce(e,r):r}function he(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function pe(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&pe(e.parentNode,t,n);for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return!!n&&pe(e.parentNode,t,n)}function ge(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(pe(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}}catch(e){}return!1}function fe(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,g=void 0===p?{}:p,f=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,I=t.newlyAddedElement,y=void 0!==I&&I,C=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:Z.Document,childNodes:[],compatMode:e.compatMode}:{type:Z.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Z.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};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,g=t.newlyAddedElement,f=void 0!==g&&g,m=t.rootId,v=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),I=function(e){if(e instanceof HTMLFormElement)return"form";var t=z(e.tagName);return $.test(t)?"div":t}(e),y={},C=e.attributes.length,S=0;S<C;S++){var b=e.attributes[S];he(I,b.name,b.value)||(y[b.name]=de(n,I,z(b.name),b.value))}if("link"===I&&s){var A=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),w=null;A&&(w=V(A)),w&&(delete y.rel,delete y.href,y._cssText=se(w,A.href))}if("style"===I&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(w=V(e.sheet))&&(y._cssText=se(w,ue()))}if("input"===I||"textarea"===I||"select"===I){var k=e.value,M=e.checked;if("radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&k){var T=J(e);y.value=Y({element:e,type:T,tagName:I,value:k,maskInputOptions:a,maskInputFn:c})}else M&&(y.checked=M)}"option"===I&&(e.selected&&!a.select?y.selected=!0:delete y.selected);if("canvas"===I&&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=j in o?o[j]: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)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var E=e.toDataURL(u.type,u.quality),R=document.createElement("canvas");R.width=e.width,R.height=e.height,E!==R.toDataURL(u.type,u.quality)&&(y.rr_dataURL=E)}if("img"===I&&d){Q||(Q=n.createElement("canvas"),H=Q.getContext("2d"));var N=e,O=N.crossOrigin;N.crossOrigin="anonymous";var D=function(){N.removeEventListener("load",D);try{Q.width=N.naturalWidth,Q.height=N.naturalHeight,H.drawImage(N,0,0),y.rr_dataURL=Q.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(N.currentSrc,"! Error: ").concat(e))}O?y.crossOrigin=O:N.removeAttribute("crossorigin")};N.complete&&0!==N.naturalWidth?D():N.addEventListener("load",D)}"audio"!==I&&"video"!==I||(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime);f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(v){var x=e.getBoundingClientRect(),L=x.width,F=x.height;y={class:y.class,rr_width:"".concat(L,"px"),rr_height:"".concat(F,"px")}}"iframe"!==I||p(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);return{type:Z.Element,tagName:I,attributes:y,childNodes:[],isSVG:le(e)||void 0,needBlock:v,rootId:m}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:g,inlineImages:f,recordCanvas:m,keepIframeSrcFn:v,newlyAddedElement:y,rootId:C});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=V(e.parentNode.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=se(c,ue())}u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&ge(e,r,o)&&(c=s?s(c):c.replace(/[\S]/g,"*"));return{type:Z.Text,textContent:c||"",isStyle:l,rootId:i}}(e,{maskTextClass:i,maskTextSelector:a,maskTextFn:d,rootId:C});case e.CDATA_SECTION_NODE:return{type:Z.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return{type:Z.Comment,textContent:e.textContent||"",rootId:C};default:return!1}}function me(e){return null==e?"":e.toLowerCase()}function ve(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,g=void 0===p?{}:p,f=t.maskTextFn,m=t.maskInputFn,v=t.slimDOMOptions,I=t.dataURLOptions,y=void 0===I?{}:I,C=t.inlineImages,S=void 0!==C&&C,b=t.recordCanvas,A=void 0!==b&&b,w=t.onSerialize,k=t.onIframeLoad,M=t.iframeLoadTimeout,T=void 0===M?5e3:M,E=t.onStylesheetLoad,R=t.stylesheetLoadTimeout,N=void 0===R?5e3:R,O=t.keepIframeSrcFn,D=void 0===O?function(){return!1}:O,x=t.newlyAddedElement,L=void 0!==x&&x,F=t.preserveWhiteSpace,U=void 0===F||F,W=fe(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,dataURLOptions:y,inlineImages:S,recordCanvas:A,keepIframeSrcFn:D,newlyAddedElement:L});if(!W)return console.warn(e,"not serialized"),null;n=o.hasNode(e)?o.getId(e):!function(e,t){if(t.comment&&e.type===Z.Comment)return!0;if(e.type===Z.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&&(me(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===me(e.attributes.name)||"icon"===me(e.attributes.rel)||"apple-touch-icon"===me(e.attributes.rel)||"shortcut icon"===me(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&me(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(me(e.attributes.property).match(/^(og|twitter|fb):/)||me(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===me(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===me(e.attributes.name)||"googlebot"===me(e.attributes.name)||"bingbot"===me(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===me(e.attributes.name)||"generator"===me(e.attributes.name)||"framework"===me(e.attributes.name)||"publisher"===me(e.attributes.name)||"progid"===me(e.attributes.name)||me(e.attributes.property).match(/^article:/)||me(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===me(e.attributes.name)||"yandex-verification"===me(e.attributes.name)||"csrf-token"===me(e.attributes.name)||"p:domain_verify"===me(e.attributes.name)||"verify-v1"===me(e.attributes.name)||"verification"===me(e.attributes.name)||"shopify-checkout-api-token"===me(e.attributes.name)))return!0}}return!1}(W,v)&&(U||W.type!==Z.Text||W.isStyle||W.textContent.replace(/^\s+|\s+$/gm,"").length)?ee():-2;var B=Object.assign(W,{id:n});if(o.add(e,B),-2===n)return null;w&&w(e);var _=!u;if(B.type===Z.Element){_=_&&!B.needBlock,delete B.needBlock;var V=e.shadowRoot;V&&G(V)&&(B.isShadowHost=!0)}if((B.type===Z.Document||B.type===Z.Element)&&_){v.headWhitespace&&B.type===Z.Element&&"head"===B.tagName&&(U=!1);for(var K={doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D},q=0,Y=Array.from(e.childNodes);q<Y.length;q++){(J=ve(Y[q],K))&&B.childNodes.push(J)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var z=0,j=Array.from(e.shadowRoot.childNodes);z<j.length;z++){var J;(J=ve(j[z],K))&&(G(e.shadowRoot)&&(J.isShadow=!0),B.childNodes.push(J))}}return e.parentNode&&P(e.parentNode)&&G(e.parentNode)&&(B.isShadow=!0),B.type===Z.Element&&"iframe"===B.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&&k){var n=ve(t,{doc:t,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D});n&&k(e,n)}}),T),B.type===Z.Element&&"link"===B.tagName&&"stylesheet"===B.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(E){var t=ve(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D});t&&E(e,t)}}),N),B}function Ie(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const ye="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 Ce={map:{},getId:()=>(console.error(ye),-1),getNode:()=>(console.error(ye),null),removeNodeFromMap(){console.error(ye)},has:()=>(console.error(ye),!1),reset(){console.error(ye)}};function Se(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 be(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)}}),()=>be(e,t,s||{},!0)}function Ae(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&&(Ce=new Proxy(Ce,{get:(e,t,n)=>("map"===t&&console.error(ye),Reflect.get(e,t,n))}));let we=Date.now;function ke(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 Me(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Te(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ee(e,t,n,r){if(!e)return!1;const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;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(pe(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 Re(e,t){return-2===t.getId(e)}function Ne(e,t){if(P(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Ne(e.parentNode,t))}function Oe(e){return Boolean(e.changedTouches)}function De(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function xe(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Le(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(we=()=>(new Date).getTime());class Fe{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 Ue(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 We(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=Ue(n);)n=t;return n}(e);return t.contains(n)}function Be(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||We(e))}var _e=(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))(_e||{}),Ze=(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))(Ze||{}),Pe=(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))(Pe||{}),Ge=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ge||{}),Ve=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ve||{});function Ke(e){return"__ln"in e}class qe{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&&Ke(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&&Ke(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 ze{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 qe,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=P(o.parentNode)?this.mirror.getId(Ue(o)):this.mirror.getId(o.parentNode),i=r(o);if(-1===s||-1===i)return n.addNode(o);const a=ve(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=>{De(e,this.mirror)&&this.iframeManager.addIframe(e),xe(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Le(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)Je(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)He(this.droppedSet,e)||Je(this.removes,e,this.mirror)?He(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(Re(e.target,this.mirror))return;let t;try{t=document.implementation.createHTMLDocument()}catch(e){t=this.doc}switch(e.type){case"characterData":{const t=e.target.textContent;Ee(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:ge(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,o=e.target.getAttribute(r);if("value"===r){const e=J(n);o=Y({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:o,maskInputFn:this.maskInputFn})}if(Ee(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributes.find((t=>t.node===e.target));if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(o)){if(n.contentDocument)return;r="rr_src"}if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!he(n.tagName,r)&&(s.attributes[r]=de(this.doc,z(n.tagName),z(r),o),"style"===r)){const r=t.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),o=n.style.getPropertyPriority(e);t!==r.style.getPropertyValue(e)||o!==r.style.getPropertyPriority(e)?s.styleDiff[e]=""===o?t:[t,o]:s._unchangedStyles[e]=[t,o]}for(const e of Array.from(r.style))""===n.style.getPropertyValue(e)&&(s.styleDiff[e]=!1)}break}case"childList":if(Ee(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=P(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Ee(e.target,this.blockClass,this.blockSelector,!1)||Re(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(je(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Ne(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ye(n,r)]?je(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!P(e.target)||!G(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(Re(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);Ee(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),Le(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 je(e,t){e.delete(t),t.childNodes.forEach((t=>je(e,t)))}function Je(e,t,n){return 0!==e.length&&Qe(e,t,n)}function Qe(e,t,n){const{parentNode:r}=t;if(!r)return!1;const o=n.getId(r);return!!e.some((e=>e.id===o))||Qe(e,r,n)}function He(e,t){return 0!==e.size&&Xe(e,t)}function Xe(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Xe(e,n))}let $e;function et(e){$e=e}function tt(){$e=void 0}const nt=e=>{if(!$e)return e;return(...t)=>{try{return e(...t)}catch(e){if($e&&!0===$e(e))return;throw e}}},rt=[];function ot(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 st(e,t){var n,r;const o=new ze;rt.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(nt(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function it({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(Pe).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{let i=z(s);const l=(t=>s=>{const i=ot(s);if(Ee(i,r,o,!0))return;let a=null,l=t;if("pointerType"in s){switch(s.pointerType){case"mouse":a=Ge.Mouse;break;case"touch":a=Ge.Touch;break;case"pen":a=Ge.Pen}a===Ge.Touch?Pe[t]===Pe.MouseDown?l="TouchStart":Pe[t]===Pe.MouseUp&&(l="TouchEnd"):Ge.Pen}else Oe(s)&&(a=Ge.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===Ge.Touch||l.startsWith("Mouse")&&a===Ge.Mouse)&&(a=null)):Pe[t]===Pe.Click&&(a=c,c=null);const u=Oe(s)?s.changedTouches[0]:s;if(!u)return;const d=n.getId(i),{clientX:h,clientY:p}=u;nt(e)(Object.assign({type:Pe[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(s);if(window.PointerEvent)switch(Pe[s]){case Pe.MouseDown:case Pe.MouseUp:i=i.replace("mouse","pointer");break;case Pe.TouchStart:case Pe.TouchEnd:return}a.push(Ie(i,l,t))})),nt((()=>{a.forEach((e=>e()))}))}function at({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){return Ie("scroll",nt(Se(nt((s=>{const i=ot(s);if(!i||Ee(i,r,o,!0))return;const a=n.getId(i);if(i===t&&t.defaultView){const n=ke(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 ct(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const lt=["INPUT","TEXTAREA","SELECT"],ut=new WeakMap;function dt(e){return function(e,t){if(ft("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ft("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ft("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ft("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 ht(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function pt({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=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");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}}),nt((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function gt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!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);const r=st(e,e.doc),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=Se(nt((t=>{const n=Date.now()-i;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],i=null})),s),l=nt(Se(nt((e=>{const t=ot(e),{clientX:n,clientY:o}=Oe(e)?e.changedTouches[0]:e;i||(i=we()),a.push({x:n,y:o,id:r.getId(t),timeOffset:we()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?Ze.Drag:e instanceof MouseEvent?Ze.MouseMove:Ze.TouchMove)})),o,{trailing:!1})),u=[Ie("mousemove",l,n),Ie("touchmove",l,n),Ie("drag",l,n)];return nt((()=>{u.forEach((e=>e()))}))}(e),s=it(e),i=at(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return Ie("resize",nt(Se(nt((()=>{const t=Me(),o=Te();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=ot(e);const l=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||lt.indexOf(d)<0||Ee(n,r,o,!0))return;if(n.classList.contains(s)||i&&n.matches(i))return;let p=n.value,g=!1;const f=J(n)||"";"radio"===f||"checkbox"===f?g=n.checked:(a[d.toLowerCase()]||a[f])&&(p=Y({element:n,maskInputOptions:a,tagName:d,type:f,value:p,maskInputFn:c})),h(n,nt(ct)({text:p,isChecked:g,userTriggered:l},u));const m=n.name;"radio"===f&&m&&g&&t.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach((e=>{e!==n&&h(e,nt(ct)({text:e.value,isChecked:!g,userTriggered:!1},u))}))}function h(t,r){const o=ut.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){ut.set(t,r);const o=n.getId(t);nt(e)(Object.assign(Object.assign({},r),{id:o}))}}const p=("last"===l.input?["change"]:["input","change"]).map((e=>Ie(e,nt(d),t))),g=t.defaultView;if(!g)return()=>{p.forEach((e=>e()))};const f=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),m=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...m.map((e=>be(e[0],e[1],{set(){nt(d)({target:this,isTrusted:!1})}},!1,g)))),nt((()=>{p.forEach((e=>e()))}))}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){const i=nt((s=>Se(nt((o=>{const i=ot(o);if(!i||Ee(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 nt((()=>{a.forEach((e=>e()))}))}(e),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:nt(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=ht(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:nt(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=ht(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:nt(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=ht(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:nt(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=ht(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:i}),r.apply(o,s)}))}));const c={};mt("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(mt("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),mt("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),mt("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:nt(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=ht(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:[...dt(o),a||0]}]}),r.apply(o,s)}))}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:nt(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=ht(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...dt(o),i]}]}),r.apply(o,s)}))})})),nt((()=>{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=pt(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:nt(((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}=ht(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:dt(i.parentRule)}),o.apply(i,a)}))});const i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:nt(((o,s,a)=>{var c;const[l]=a;if(n.has(l))return i.apply(s,[l]);const{id:u,styleId:d}=ht(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:dt(s.parentRule)}),o.apply(s,a)}))}),nt((()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i}))}(e,{win:n}),p=e.collectFonts?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=Ae(t.fonts,"add",(function(t){return function(n){return setTimeout(nt((()=>{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),nt((()=>{r.forEach((e=>e()))}))}(e):()=>{},g=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let i=!0;const a=nt((()=>{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;Ee(i,r,o,!0)||Ee(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),f=[];for(const t of e.plugins)f.push(t.observer(t.callback,n,t.options));return nt((()=>{rt.forEach((e=>e.reset())),r.disconnect(),o(),s(),i(),a(),c(),l(),u(),d(),h(),p(),g(),f.forEach((e=>e()))}))}function ft(e){return void 0!==window[e]}function mt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class vt{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 It{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new vt(ee),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new vt(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 _e.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:_e.IncrementalSnapshot,data:{source:Ze.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case _e.Meta:case _e.Load:case _e.DomContentLoaded:return!1;case _e.Plugin:return t;case _e.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case _e.IncrementalSnapshot:switch(t.data.source){case Ze.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 Ze.Drag:case Ze.TouchMove:case Ze.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Ze.ViewportResize:return!1;case Ze.MediaInteraction:case Ze.MouseInteraction:case Ze.Scroll:case Ze.CanvasMutation:case Ze.Input:return this.replaceIds(t.data,e,["id"]),t;case Ze.StyleSheetRule:case Ze.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Ze.Font:return t;case Ze.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Ze.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===Z.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class yt{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(!G(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=st(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(at(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(pt({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(Ae(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}}function Ct(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="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),At=0;At<St.length;At++)bt[St.charCodeAt(At)]=At;const wt=new Map;const kt=(e,t,n)=>{if(!e||!Et(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=wt.get(e);return n||(n=new Map,wt.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 Mt(e,t,n){if(e instanceof Array)return e.map((e=>Mt(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+=St[n[t]>>2],o+=St[(3&n[t])<<4|n[t+1]>>4],o+=St[(15&n[t+1])<<2|n[t+2]>>6],o+=St[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:[Mt(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:[Mt(e.data,t,n),e.width,e.height]}}if(Et(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:kt(e,t,n)}}return e}const Tt=(e,t,n)=>[...e].map((e=>Mt(e,t,n))),Et=(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 Rt(e,t,n,r){const o=[];try{const s=Ae(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...s){if(!Ee(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 Nt(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=Ae(e,s,(function(e){return function(...a){const c=e.apply(this,a);if(kt(c,i,this),"tagName"in this.canvas&&!Ee(this.canvas,r,o,!0)){const e=Tt([...a],i,this),r={type:t,property:s,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const o=be(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(o)}return a}function Ot(e,t,n){var r=void 0===t?null:t,o=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,s=n.length;o<s;++o)r[o]=n.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(e,void 0!==n&&n),s=o.indexOf("\n",10)+1,i=o.substring(s)+(r?"//# sourceMappingURL="+r:""),a=new Blob([i],{type:"application/javascript"});return URL.createObjectURL(a)}var Dt,xt,Lt,Ft,Ut=(Dt="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",xt=null,Lt=!1,function(e){return Ft=Ft||Ot(Dt,xt,Lt),new Worker(Ft,e)});class Wt{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=Rt(t,n,r,!0),i=new Map,a=new Ut;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:Ve["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=>{Ee(t,n,r,!0)||e.push(t)})),e})().forEach((e=>Ct(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=Rt(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=Ae(t.CanvasRenderingContext2D.prototype,i,(function(o){return function(...s){return Ee(this.canvas,n,r,!0)||setTimeout((()=>{const n=Tt([...s],t,this);e(this.canvas,{type:Ve["2D"],property:i,args:n})}),0),o.apply(this,s)}}));o.push(s)}catch(n){const r=be(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:Ve["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(...Nt(t.WebGLRenderingContext.prototype,Ve.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&s.push(...Nt(t.WebGL2RenderingContext.prototype,Ve.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 Bt{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Fe,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;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);r.push({styleId:e,rules:n.map(((e,t)=>({rule:K(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){}}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}}function Zt(e){return Object.assign(Object.assign({},e),{timestamp:we()})}let Pt,Gt,Vt,Kt=!1;const qt=new q;function Yt(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:g,maskTextFn:f,hooks:m,packFn:v,sampling:I={},dataURLOptions:y={},mousemoveWait:C,recordCanvas:S=!1,recordCrossOriginIframes:b=!1,recordAfter:A=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:w=!1,collectFonts:k=!1,inlineImages:M=!1,plugins:T,keepIframeSrcFn:E=(()=>!1),ignoreCSSAttributes:R=new Set([]),errorHandler:N}=e;et(N);const O=!b||window.parent===window;let D=!1;if(!O)try{window.parent.document&&(D=!1)}catch(e){D=!0}if(O&&!t)throw new Error("emit function is required");void 0!==C&&void 0===I.mousemove&&(I.mousemove=C),qt.reset();const x=!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},L=!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 F;!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 U=0;const W=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!D&&(e=v(e)),e};Pt=(e,o)=>{var s;if(!(null===(s=rt[0])||void 0===s?void 0:s.isFrozen())||e.type===_e.FullSnapshot||e.type===_e.IncrementalSnapshot&&e.data.source===Ze.Mutation||rt.forEach((e=>e.unfreeze())),O)null==t||t(W(e),o);else if(D){const t={type:"rrweb",event:W(e),origin:window.location.origin,isCheckout:o};window.parent.postMessage(t,"*")}if(e.type===_e.FullSnapshot)F=e,U=0;else if(e.type===_e.IncrementalSnapshot){if(e.data.source===Ze.Mutation&&e.data.isAttachIframe)return;U++;const t=r&&U>=r,o=n&&e.timestamp-F.timestamp>n;(t||o)&&Gt(!0)}};const B=e=>{Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Mutation},e)}))},_=e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Scroll},e)})),Z=e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.CanvasMutation},e)})),P=new Bt({mutationCb:B,adoptedStyleSheetCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.AdoptedStyleSheet},e)}))}),G=new It({mirror:qt,mutationCb:B,stylesheetManager:P,recordCrossOriginIframes:b,wrappedEmit:Pt});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:qt,crossOriginIframeMirror:G.crossOriginIframeMirror,crossOriginIframeStyleMirror:G.crossOriginIframeStyleMirror});const V=new _t;Vt=new Wt({recordCanvas:S,mutationCb:Z,win:window,blockClass:o,blockSelector:s,mirror:qt,sampling:I.canvas,dataURLOptions:y});const K=new yt({mutationCb:B,scrollCb:_,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:x,dataURLOptions:y,maskTextFn:f,maskInputFn:g,recordCanvas:S,inlineImages:M,sampling:I,slimDOMOptions:L,iframeManager:G,stylesheetManager:P,canvasManager:Vt,keepIframeSrcFn:E,processedNodeManager:V},mirror:qt});Gt=(e=!1)=>{Pt(Zt({type:_e.Meta,data:{href:window.location.href,width:Te(),height:Me()}}),e),P.reset(),K.init(),rt.forEach((e=>e.lock()));const t=function(e,t){var n=t||{},r=n.mirror,o=void 0===r?new q: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,g=void 0===p||p,f=n.inlineImages,m=void 0!==f&&f,v=n.recordCanvas,I=void 0!==v&&v,y=n.maskAllInputs,C=void 0!==y&&y,S=n.maskTextFn,b=n.maskInputFn,A=n.slimDOM,w=void 0!==A&&A,k=n.dataURLOptions,M=n.preserveWhiteSpace,T=n.onSerialize,E=n.onIframeLoad,R=n.iframeLoadTimeout,N=n.onStylesheetLoad,O=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return ve(e,{doc:e,mirror:o,blockClass:i,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:!0===C?{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===C?{password:!0}:C,maskTextFn:S,maskInputFn:b,slimDOMOptions:!0===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===w,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===w?{}:w,dataURLOptions:k,inlineImages:m,recordCanvas:I,preserveWhiteSpace:M,onSerialize:T,onIframeLoad:E,iframeLoadTimeout:R,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:qt,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:x,maskTextFn:f,slimDOM:L,dataURLOptions:y,recordCanvas:S,inlineImages:M,onSerialize:e=>{De(e,qt)&&G.addIframe(e),xe(e,qt)&&P.trackLinkElement(e),Le(e)&&K.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{G.attachIframe(e,t),K.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{P.attachLinkElement(e,t)},keepIframeSrcFn:E});if(!t)return console.warn("Failed to snapshot the document");Pt(Zt({type:_e.FullSnapshot,data:{node:t,initialOffset:ke(window)}}),e),rt.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&P.adoptStyleSheets(document.adoptedStyleSheets,qt.getId(document))};try{const e=[],t=e=>{var t;return nt(gt)({mutationCb:B,mousemoveCb:(e,t)=>Pt(Zt({type:_e.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.MouseInteraction},e)})),scrollCb:_,viewportResizeCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.ViewportResize},e)})),inputCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Input},e)})),mediaInteractionCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.MediaInteraction},e)})),styleSheetRuleCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.StyleSheetRule},e)})),styleDeclarationCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.StyleDeclaration},e)})),canvasMutationCb:Z,fontCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Font},e)})),selectionCb:e=>{Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Selection},e)}))},blockClass:o,ignoreClass:i,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:x,inlineStylesheet:u,sampling:I,recordCanvas:S,inlineImages:M,userTriggeredOnInput:w,collectFonts:k,doc:e,maskInputFn:g,maskTextFn:f,keepIframeSrcFn:E,blockSelector:s,slimDOMOptions:L,dataURLOptions:y,mirror:qt,iframeManager:G,stylesheetManager:P,shadowDomManager:K,processedNodeManager:V,canvasManager:Vt,ignoreCSSAttributes:R,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=>Pt(Zt({type:_e.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},m)};G.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{Gt(),e.push(t(document)),Kt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Ie("DOMContentLoaded",(()=>{Pt(Zt({type:_e.DomContentLoaded,data:{}})),"DOMContentLoaded"===A&&n()}))),e.push(Ie("load",(()=>{Pt(Zt({type:_e.Load,data:{}})),"load"===A&&n()}),window))),()=>{e.forEach((e=>e())),V.destroy(),Kt=!1,tt()}}catch(e){console.warn(e)}}var zt,jt;Yt.addCustomEvent=(e,t)=>{if(!Kt)throw new Error("please add custom event after start recording");Pt(Zt({type:_e.Custom,data:{tag:e,payload:t}}))},Yt.freezePage=()=>{rt.forEach((e=>e.freeze()))},Yt.takeFullSnapshot=e=>{if(!Kt)throw new Error("please take full snapshot after start recording");Gt(e)},Yt.mirror=qt,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"}(zt||(zt={})),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"}(jt||(jt={}));var Jt=Uint8Array,Qt=Uint16Array,Ht=Uint32Array,Xt=new Jt([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]),$t=new Jt([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]),en=new Jt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tn=function(e,t){for(var n=new Qt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new Ht(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]},nn=tn(Xt,2),rn=nn[0],on=nn[1];rn[28]=258,on[258]=28;for(var sn=tn($t,0)[1],an=new Qt(32768),cn=0;cn<32768;++cn){var ln=(43690&cn)>>>1|(21845&cn)<<1;ln=(61680&(ln=(52428&ln)>>>2|(13107&ln)<<2))>>>4|(3855&ln)<<4,an[cn]=((65280&ln)>>>8|(255&ln)<<8)>>>1}var un=function(e,t,n){for(var r=e.length,o=0,s=new Qt(t);o<r;++o)++s[e[o]-1];var i,a=new Qt(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;if(n){i=new Qt(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[an[d]>>>c]=l}else for(i=new Qt(r),o=0;o<r;++o)i[o]=an[a[e[o]-1]++]>>>15-e[o];return i},dn=new Jt(288);for(cn=0;cn<144;++cn)dn[cn]=8;for(cn=144;cn<256;++cn)dn[cn]=9;for(cn=256;cn<280;++cn)dn[cn]=7;for(cn=280;cn<288;++cn)dn[cn]=8;var hn=new Jt(32);for(cn=0;cn<32;++cn)hn[cn]=5;var pn=un(dn,9,0),gn=un(hn,5,0),fn=function(e){return(e/8>>0)+(7&e&&1)},mn=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Qt?Qt:e instanceof Ht?Ht:Jt)(n-t);return r.set(e.subarray(t,n)),r},vn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},In=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},yn=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 Jt(0),0];if(1==o){var i=new Jt(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 Qt(h+1),g=Cn(n[u-1],p,0);if(g>t){r=0;var f=0,m=g-t,v=1<<m;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<o;++r){var I=s[r].s;if(!(p[I]>t))break;f+=v-(1<<g-p[I]),p[I]=t}for(f>>>=m;f>0;){var y=s[r].s;p[y]<t?f-=1<<t-p[y]++-1:++r}for(;r>=0&&f;--r){var C=s[r].s;p[C]==t&&(--p[C],++f)}g=t}return[new Jt(p),g]},Cn=function(e,t,n){return-1==e.s?Math.max(Cn(e.l,t,n+1),Cn(e.r,t,n+1)):t[e.s]=n},Sn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Qt(++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]},bn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},An=function(e,t,n){var r=n.length,o=fn(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)},wn=function(e,t,n,r,o,s,i,a,c,l,u){vn(t,u++,n),++o[256];for(var d=yn(o,15),h=d[0],p=d[1],g=yn(s,15),f=g[0],m=g[1],v=Sn(h),I=v[0],y=v[1],C=Sn(f),S=C[0],b=C[1],A=new Qt(19),w=0;w<I.length;++w)A[31&I[w]]++;for(w=0;w<S.length;++w)A[31&S[w]]++;for(var k=yn(A,7),M=k[0],T=k[1],E=19;E>4&&!M[en[E-1]];--E);var R,N,O,D,x=l+5<<3,L=bn(o,dn)+bn(s,hn)+i,F=bn(o,h)+bn(s,f)+i+14+3*E+bn(A,M)+(2*A[16]+3*A[17]+7*A[18]);if(x<=L&&x<=F)return An(t,u,e.subarray(c,c+l));if(vn(t,u,1+(F<L)),u+=2,F<L){R=un(h,p,0),N=h,O=un(f,m,0),D=f;var U=un(M,T,0);vn(t,u,y-257),vn(t,u+5,b-1),vn(t,u+10,E-4),u+=14;for(w=0;w<E;++w)vn(t,u+3*w,M[en[w]]);u+=3*E;for(var W=[I,S],B=0;B<2;++B){var _=W[B];for(w=0;w<_.length;++w){var Z=31&_[w];vn(t,u,U[Z]),u+=M[Z],Z>15&&(vn(t,u,_[w]>>>5&127),u+=_[w]>>>12)}}}else R=pn,N=dn,O=gn,D=hn;for(w=0;w<a;++w)if(r[w]>255){Z=r[w]>>>18&31;In(t,u,R[Z+257]),u+=N[Z+257],Z>7&&(vn(t,u,r[w]>>>23&31),u+=Xt[Z]);var P=31&r[w];In(t,u,O[P]),u+=D[P],P>3&&(In(t,u,r[w]>>>5&8191),u+=$t[P])}else In(t,u,R[r[w]]),u+=N[r[w]];return In(t,u,R[256]),u+N[256]},kn=new Ht([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mn=new Jt(0),Tn=function(e,t,n,r,o){return function(e,t,n,r,o,s){var i=e.length,a=new Jt(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=An(c,l,e.subarray(u,d)):(c[u]=s,l=An(c,l,e.subarray(u,i)))}else{for(var h=kn[t-1],p=h>>>13,g=8191&h,f=(1<<n)-1,m=new Qt(32768),v=new Qt(f+1),I=Math.ceil(n/3),y=2*I,C=function(t){return(e[t]^e[t+1]<<I^e[t+2]<<y)&f},S=new Ht(25e3),b=new Qt(288),A=new Qt(32),w=0,k=0,M=(u=0,0),T=0,E=0;u<i;++u){var R=C(u),N=32767&u,O=v[R];if(m[N]=O,v[R]=N,T<=u){var D=i-u;if((w>7e3||M>24576)&&D>423){l=wn(e,c,0,S,b,A,k,M,E,u-E,l),M=w=k=0,E=u;for(var x=0;x<286;++x)b[x]=0;for(x=0;x<30;++x)A[x]=0}var L=2,F=0,U=g,W=N-O&32767;if(D>2&&R==C(u-W))for(var B=Math.min(p,D)-1,_=Math.min(32767,u),Z=Math.min(258,D);W<=_&&--U&&N!=O;){if(e[u+L]==e[u+L-W]){for(var P=0;P<Z&&e[u+P]==e[u+P-W];++P);if(P>L){if(L=P,F=W,P>B)break;var G=Math.min(W,P-2),V=0;for(x=0;x<G;++x){var K=u-W+x+32768&32767,q=K-m[K]+32768&32767;q>V&&(V=q,O=K)}}}W+=(N=O)-(O=m[N])+32768&32767}if(F){S[M++]=268435456|on[L]<<18|sn[F];var Y=31&on[L],z=31&sn[F];k+=Xt[Y]+$t[z],++b[257+Y],++A[z],T=u+L,++w}else S[M++]=e[u],++b[e[u]]}}l=wn(e,c,s,S,b,A,k,M,E,u-E,l),s||(l=An(c,l,Mn))}return mn(a,0,r+fn(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 En(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=Tn(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 Rn=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}(En(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Jt(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 Jt(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 mn(r,0,o)}(JSON.stringify(t))),!0)};var Nn,On;(On=Nn||(Nn={}))[On.NotStarted=0]="NotStarted",On[On.Running=1]="Running",On[On.Stopped=2]="Stopped";var Dn,xn=function(e,t){var n;return(null===(n=t.classList)||void 0===n?void 0:n.contains("amp-unmask"))?e:"*".repeat(e.length)},Ln="Session replay event batch rejected due to exceeded retry count",Fn="Failed to store session replay events in IndexedDB";!function(e){e.RECORDING="recording",e.SENT="sent"}(Dn||(Dn={}));var Un=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.storageKey="",this.retryTimeout=1e3,this.events=[],this.currentSequenceId=0,this.scheduled=null,this.queue=[],this.stopRecordingEvents=null,this.maxPersistedEventsSize=1e6,this.interval=500,this.timeAtLastSend=null,this.getSessionRecordingProperties=function(){return e.loggerProvider.warn("Please use getSessionReplayProperties instead of getSessionRecordingProperties."),e.getSessionReplayProperties()},this.blurListener=function(){e.stopRecordingAndSendEvents()},this.focusListener=function(){e.initialize()},this.shouldSplitEventsList=function(t){var n=new Blob([t]).size;return new Blob(e.events).size+n>=e.maxPersistedEventsSize||!!(null!==e.timeAtLastSend&&Date.now()-e.timeAtLastSend>e.interval&&e.events.length)&&(e.interval=Math.min(1e4,e.interval+500),e.timeAtLastSend=Date.now(),!0)},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 L(e,t),this.loggerProvider=this.config.loggerProvider,this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.storageKey="".concat(O,"_").concat(this.config.apiKey.substring(0,10)),(n=E())&&(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){this.config?(this.stopRecordingAndSendEvents(this.config.sessionId),this.config.sessionId=e,this.events=[],this.currentSequenceId=0,this.recordEvents()):this.loggerProvider.error("Session replay init has not been called, cannot set session id.")},e.prototype.getSessionReplayProperties=function(){var e;return this.config?this.getShouldRecord()?((e={})[N]=!0,e):{}:(this.loggerProvider.error("Session replay init has not been called, cannot get session recording properties."),{})},e.prototype.stopRecordingAndSendEvents=function(e){var t;try{this.stopRecordingEvents&&this.stopRecordingEvents(),this.stopRecordingEvents=null}catch(e){var n=e;this.loggerProvider.warn("Error occurred while stopping recording: ".concat(n.toString()))}var r=e||(null===(t=this.config)||void 0===t?void 0:t.sessionId);this.events.length&&r&&this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var n,r,o,s;return c(this,(function(i){switch(i.label){case 0:return this.timeAtLastSend=Date.now(),(null===(t=this.config)||void 0===t?void 0:t.sessionId)?[4,this.getAllSessionEventsFromStore()]:(this.loggerProvider.warn("Session is not being recorded due to lack of session id."),[2]);case 1:return n=i.sent(),this.stopRecordingEvents?[2]:(r=n&&n[this.config.sessionId],n&&r&&r.sessionSequences&&(o=r.currentSequenceId,(s=r.sessionSequences[o])&&s.status!==Dn.RECORDING?(this.currentSequenceId=o+1,this.events=[]):(this.currentSequenceId=o,this.events=(null==s?void 0:s.events)||[])),e&&n&&this.sendStoredEvents(n),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(){if(!this.config)return this.loggerProvider.error("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;var e,t,n,r=E();if(r&&r.document&&!r.document.hasFocus())return this.config.sessionId&&this.loggerProvider.log("Session ".concat(this.config.sessionId," temporarily not recording due to lack of browser focus.")),!1;if(this.shouldOptOut())return this.config.sessionId&&this.loggerProvider.log("Opting session ".concat(this.config.sessionId," out of recording due to optOut config.")),!1;if(!this.config.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of session id."),!1;if(this.config.sampleRate){var o=(e=this.config.sessionId,t=this.config.sampleRate,n=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}(e.toString()),31*Math.abs(n)%100/100<t);return o||this.loggerProvider.log("Opting session ".concat(this.config.sessionId," out of recording due to sample rate.")),o}return!0},e.prototype.sendStoredEvents=function(e){var t;for(var n in e){var r=e[n].sessionSequences;for(var o in r){var s=r[o],i=parseInt(o,10),a=parseInt(n,10);a===(null===(t=this.config)||void 0===t?void 0:t.sessionId)&&i===this.currentSequenceId||s.events.length&&s.status===Dn.RECORDING&&this.sendEventsList({events:s.events,sequenceId:i,sessionId:a})}}},e.prototype.recordEvents=function(){var e,t=this,n=this.getShouldRecord(),r=null===(e=this.config)||void 0===e?void 0:e.sessionId;n&&r&&(this.stopRecordingEvents=Yt({emit:function(e){var n=E();if(n&&n.document&&!n.document.hasFocus()||!t.getShouldRecord())t.stopRecordingAndSendEvents();else{var o=JSON.stringify(e);t.shouldSplitEventsList(o)&&(t.sendEventsList({events:t.events,sequenceId:t.currentSequenceId,sessionId:r}),t.events=[],t.currentSequenceId++),t.events.push(o),t.storeEventsForSession(t.events,t.currentSequenceId,r)}},packFn:Rn,maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",maskInputFn:xn,recordCanvas:!1,errorHandler:function(e){var n=e;return t.loggerProvider.warn("Error while recording: ",n.toString()),!0}}))},e.prototype.sendEventsList=function(e){var t=e.events,n=e.sequenceId,r=e.sessionId;this.addToQueue({events:t,sequenceId:n,attempts:0,timeout:0,sessionId:r})},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){var n;return t.attempts<((null===(n=e.config)||void 0===n?void 0:n.flushMaxRetries)||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"".concat(Ln,", 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.getSampleRate=function(){var e;return(null===(e=this.config)||void 0===e?void 0:e.sampleRate)||0},e.prototype.getServerUrl=function(){var e;return(null===(e=this.config)||void 0===e?void 0:e.serverZone)===o.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track"},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.config)||void 0===t?void 0:t.deviceId)},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),a(this,void 0,void 0,(function(){var r,o,s,i,a,l,u,d,h,p,g,f;return c(this,(function(c){switch(c.label){case 0:if(!(r=null===(n=this.config)||void 0===n?void 0:n.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(o=this.getDeviceId()))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];m=E(),s=(null==m?void 0:m.location)?m.location.href:"",i="0.2.5",a=this.getSampleRate(),l=new URLSearchParams({device_id:o,session_id:"".concat(e.sessionId),seq_number:"".concat(e.sequenceId)}),u={version:1,events:e.events},c.label=1;case 1:return c.trys.push([1,3,,4]),d={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(r),"X-Client-Version":i,"X-Client-Url":s,"X-Client-Sample-Rate":"".concat(a)},body:JSON.stringify(u),method:"POST"},h="".concat(this.getServerUrl(),"?").concat(l.toString()),[4,fetch(h,d)];case 2:if(null===(p=c.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(p.status,e);else{g="";try{g=JSON.stringify(p.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(p.status,": ").concat(g)})}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 I).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.getAllSessionEventsFromStore=function(){return a(this,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,B(this.storageKey)];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.loggerProvider.warn("".concat(Fn,": ").concat(e)),[3,3];case 3:return[2,void 0]}}))}))},e.prototype.storeEventsForSession=function(e,t,n){return a(this,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,_(this.storageKey,(function(r){var o,s;void 0===r&&(r={});var a=r[n]||i({},D);a.currentSequenceId=t;var c=a.sessionSequences&&a.sessionSequences[t]||{};return c.events=e,c.status=Dn.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(Fn,": ").concat(r)),[3,3];case 3:return[2]}}))}))},e.prototype.cleanUpSessionEventsStore=function(e,t){return a(this,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,_(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=Dn.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===Dn.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(Fn,": ").concat(n)),[3,3];case 3:return[2]}}))}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.sessionId&&this.cleanUpSessionEventsStore(t.sessionId,t.sequenceId),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e.prototype.shutdown=function(){var e=E();e&&(e.removeEventListener("blur",this.blurListener),e.removeEventListener("focus",this.focusListener)),this.stopRecordingAndSendEvents()},e}(),Wn=function(e){return function(){var t=e.config||x();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Bn=function(){var e=new Un;return{init:v(e.init.bind(e),"init",Wn(e)),setSessionId:v(e.setSessionId.bind(e),"setSessionId",Wn(e)),getSessionRecordingProperties:v(e.getSessionRecordingProperties.bind(e),"getSessionRecordingProperties",Wn(e)),getSessionReplayProperties:v(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Wn(e)),shutdown:v(e.shutdown.bind(e),"teardown",Wn(e))}}(),_n=Bn.init,Zn=Bn.setSessionId;Bn.getSessionRecordingProperties;var Pn=Bn.getSessionReplayProperties,Gn=Bn.shutdown,Vn=function(){function e(e){this.name="@amplitude/plugin-session-replay-browser",this.type="enrichment",this.options=i({},e)}return e.prototype.setup=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return e.loggerProvider.log("Installing @amplitude/plugin-session-replay."),this.config=e,"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,_n(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}).promise];case 1:return t.sent(),[2]}}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){return"session_start"===e.event_type&&e.session_id&&Zn(e.session_id),t=Pn(),e.event_properties=i(i({},e.event_properties),t),[2,Promise.resolve(e)]}))}))},e.prototype.teardown=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){return Gn(),[2]}))}))},e}(),Kn=function(e){return new Vn(e)};return e.plugin=Kn,e.sessionReplayPlugin=Kn,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"}(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=f(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}(),g=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},f=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:g(r,n)}},m=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},v=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:m(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}},I=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,g,f,m,v,I,y,C,S,b,A;if("object"!=typeof e)return null;var w=e.code||0,k=this.buildStatus(w);switch(k){case s.Success:return{status:k,statusCode:w,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:w,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!==(g=e.throttled_devices)&&void 0!==g?g:{},throttledEvents:null!==(f=e.throttled_events)&&void 0!==f?f:[]}};case s.PayloadTooLarge:return{status:k,statusCode:w,body:{error:null!==(m=e.error)&&void 0!==m?m:""}};case s.RateLimit:return{status:k,statusCode:w,body:{error:null!==(v=e.error)&&void 0!==v?v:"",epsThreshold:null!==(I=e.eps_threshold)&&void 0!==I?I:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(C=e.throttled_users)&&void 0!==C?C:{},exceededDailyQuotaDevices:null!==(S=e.exceeded_daily_quota_devices)&&void 0!==S?S:{},exceededDailyQuotaUsers:null!==(b=e.exceeded_daily_quota_users)&&void 0!==b?b:{},throttledEvents:null!==(A=e.throttled_events)&&void 0!==A?A:[]}};case s.Timeout:default:return{status:k,statusCode:w}}},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}(),y=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:C(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),C=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},S=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}(),b=function(){return b=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},b.apply(this,arguments)},A=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(!A(a,c))return!1;var l=!0;return Object.keys(e).forEach((function(n){A(e[n],t[n])||(l=!1)})),l}for(var u=0;u<e.length;u++)if(!A(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 w=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=b({},this.identity.userProperties),n=b(b({},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,g=Object.keys(a);p<g.length;p++){delete t[d=g[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return b({},this.identity)},e.prototype.setIdentity=function(e){var t=b({},this.identity);this.identity=b({},e),A(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}(),k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,M=function(){function e(){this.identityStore=new w,this.eventBridge=new S,this.applicationContextProvider=new y}return e.getInstance=function(t){return k.analyticsConnectorInstances||(k.analyticsConnectorInstances={}),k.analyticsConnectorInstances[t]||(k.analyticsConnectorInstances[t]=new e),k.analyticsConnectorInstances[t]},e}(),T=function(e){return void 0===e&&(e="$default_instance"),M.getInstance(e)},E=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},R=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}(I),N=function(){return{flushMaxRetries:2,logLevel:r.Warn,loggerProvider:new d,transportProvider:new R}},O=function(e){function t(t,n){var r=this,o=N();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||1,r.deviceId=n.deviceId,r.sessionId=n.sessionId,r}return n(t,e),t}(p);function D(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}let x;function L(){return x||(x=function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=D(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}("keyval-store","keyval")),x}function F(e,t=L()){return t("readonly",(t=>D(t.get(e))))}function U(e,t,n=L()){return n("readwrite",(n=>new Promise(((r,o)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),r(D(n.transaction))}catch(e){o(e)}}}))))}var W;function B(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function _(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function Z(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(P).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 P(e){var t;if(function(e){return"styleSheet"in e}(e))try{t=Z(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){}return function(e){if(e.includes(":")){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}return e}(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"}(W||(W={}));var G=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 V(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,o=e.type,s=e.value,i=e.maskInputFn,a=s||"",c=o&&K(o);return(n[r.toLowerCase()]||c&&n[c])&&(a=i?i(a,t):"*".repeat(a.length)),a}function K(e){return e.toLowerCase()}var q="__rrweb_original__";function Y(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?K(t):null}var j,z,J=1,Q=new RegExp("[^a-z0-9-_:]");function H(){return J++}var X=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,$=/^(?:[a-z+]+:)?\/\//i,ee=/^www\..*/i,te=/^(data:)([^,]*),(.*)/i;function ne(e,t){return(e||"").replace(X,(function(e,n,r,o,s,i){var a,c=r||s||i,l=n||o||"";if(!c)return e;if($.test(c)||ee.test(c))return"url(".concat(l).concat(c).concat(l,")");if(te.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 g=p[h];"."!==g&&(".."===g?u.pop():u.push(g))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var re=/^[^ \t\n\r\u000c]+/,oe=/^[, \t\n\r\u000c]+/;function se(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function ie(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ae(){var e=document.createElement("a");return e.href="",e.href}function ce(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?se(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(oe),!(n>=t.length);){var s=r(re);if(","===s.slice(-1))s=se(e,s.substring(0,s.length-1)),o.push(s);else{var i="";s=se(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?ne(r,ae()):"object"===t&&"data"===n?se(e,r):r:se(e,r):r}function le(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function ue(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&ue(e.parentNode,t,n);for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return!!n&&ue(e.parentNode,t,n)}function de(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(ue(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}}catch(e){}return!1}function he(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,g=void 0===p?{}:p,f=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,I=t.newlyAddedElement,y=void 0!==I&&I,C=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:W.Document,childNodes:[],compatMode:e.compatMode}:{type:W.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:W.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};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,g=t.newlyAddedElement,f=void 0!==g&&g,m=t.rootId,v=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),I=function(e){if(e instanceof HTMLFormElement)return"form";var t=K(e.tagName);return Q.test(t)?"div":t}(e),y={},C=e.attributes.length,S=0;S<C;S++){var b=e.attributes[S];le(I,b.name,b.value)||(y[b.name]=ce(n,I,K(b.name),b.value))}if("link"===I&&s){var A=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),w=null;A&&(w=Z(A)),w&&(delete y.rel,delete y.href,y._cssText=ne(w,A.href))}if("style"===I&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(w=Z(e.sheet))&&(y._cssText=ne(w,ae()))}if("input"===I||"textarea"===I||"select"===I){var k=e.value,M=e.checked;if("radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&k){var T=Y(e);y.value=V({element:e,type:T,tagName:I,value:k,maskInputOptions:a,maskInputFn:c})}else M&&(y.checked=M)}"option"===I&&(e.selected&&!a.select?y.selected=!0:delete y.selected);if("canvas"===I&&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=q in o?o[q]: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)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var E=e.toDataURL(u.type,u.quality),R=document.createElement("canvas");R.width=e.width,R.height=e.height,E!==R.toDataURL(u.type,u.quality)&&(y.rr_dataURL=E)}if("img"===I&&d){j||(j=n.createElement("canvas"),z=j.getContext("2d"));var N=e,O=N.crossOrigin;N.crossOrigin="anonymous";var D=function(){N.removeEventListener("load",D);try{j.width=N.naturalWidth,j.height=N.naturalHeight,z.drawImage(N,0,0),y.rr_dataURL=j.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(N.currentSrc,"! Error: ").concat(e))}O?y.crossOrigin=O:N.removeAttribute("crossorigin")};N.complete&&0!==N.naturalWidth?D():N.addEventListener("load",D)}"audio"!==I&&"video"!==I||(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime);f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(v){var x=e.getBoundingClientRect(),L=x.width,F=x.height;y={class:y.class,rr_width:"".concat(L,"px"),rr_height:"".concat(F,"px")}}"iframe"!==I||p(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);return{type:W.Element,tagName:I,attributes:y,childNodes:[],isSVG:ie(e)||void 0,needBlock:v,rootId:m}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:g,inlineImages:f,recordCanvas:m,keepIframeSrcFn:v,newlyAddedElement:y,rootId:C});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=Z(e.parentNode.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=ne(c,ae())}u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&de(e,r,o)&&(c=s?s(c):c.replace(/[\S]/g,"*"));return{type:W.Text,textContent:c||"",isStyle:l,rootId:i}}(e,{maskTextClass:i,maskTextSelector:a,maskTextFn:d,rootId:C});case e.CDATA_SECTION_NODE:return{type:W.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return{type:W.Comment,textContent:e.textContent||"",rootId:C};default:return!1}}function pe(e){return null==e?"":e.toLowerCase()}function ge(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,g=void 0===p?{}:p,f=t.maskTextFn,m=t.maskInputFn,v=t.slimDOMOptions,I=t.dataURLOptions,y=void 0===I?{}:I,C=t.inlineImages,S=void 0!==C&&C,b=t.recordCanvas,A=void 0!==b&&b,w=t.onSerialize,k=t.onIframeLoad,M=t.iframeLoadTimeout,T=void 0===M?5e3:M,E=t.onStylesheetLoad,R=t.stylesheetLoadTimeout,N=void 0===R?5e3:R,O=t.keepIframeSrcFn,D=void 0===O?function(){return!1}:O,x=t.newlyAddedElement,L=void 0!==x&&x,F=t.preserveWhiteSpace,U=void 0===F||F,Z=he(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,dataURLOptions:y,inlineImages:S,recordCanvas:A,keepIframeSrcFn:D,newlyAddedElement:L});if(!Z)return console.warn(e,"not serialized"),null;n=o.hasNode(e)?o.getId(e):!function(e,t){if(t.comment&&e.type===W.Comment)return!0;if(e.type===W.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&&(pe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===pe(e.attributes.name)||"icon"===pe(e.attributes.rel)||"apple-touch-icon"===pe(e.attributes.rel)||"shortcut icon"===pe(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&pe(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(pe(e.attributes.property).match(/^(og|twitter|fb):/)||pe(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===pe(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===pe(e.attributes.name)||"googlebot"===pe(e.attributes.name)||"bingbot"===pe(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===pe(e.attributes.name)||"generator"===pe(e.attributes.name)||"framework"===pe(e.attributes.name)||"publisher"===pe(e.attributes.name)||"progid"===pe(e.attributes.name)||pe(e.attributes.property).match(/^article:/)||pe(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===pe(e.attributes.name)||"yandex-verification"===pe(e.attributes.name)||"csrf-token"===pe(e.attributes.name)||"p:domain_verify"===pe(e.attributes.name)||"verify-v1"===pe(e.attributes.name)||"verification"===pe(e.attributes.name)||"shopify-checkout-api-token"===pe(e.attributes.name)))return!0}}return!1}(Z,v)&&(U||Z.type!==W.Text||Z.isStyle||Z.textContent.replace(/^\s+|\s+$/gm,"").length)?H():-2;var P=Object.assign(Z,{id:n});if(o.add(e,P),-2===n)return null;w&&w(e);var G=!u;if(P.type===W.Element){G=G&&!P.needBlock,delete P.needBlock;var V=e.shadowRoot;V&&_(V)&&(P.isShadowHost=!0)}if((P.type===W.Document||P.type===W.Element)&&G){v.headWhitespace&&P.type===W.Element&&"head"===P.tagName&&(U=!1);for(var K={doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D},q=0,Y=Array.from(e.childNodes);q<Y.length;q++){(J=ge(Y[q],K))&&P.childNodes.push(J)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var j=0,z=Array.from(e.shadowRoot.childNodes);j<z.length;j++){var J;(J=ge(z[j],K))&&(_(e.shadowRoot)&&(J.isShadow=!0),P.childNodes.push(J))}}return e.parentNode&&B(e.parentNode)&&_(e.parentNode)&&(P.isShadow=!0),P.type===W.Element&&"iframe"===P.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&&k){var n=ge(t,{doc:t,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D});n&&k(e,n)}}),T),P.type===W.Element&&"link"===P.tagName&&"stylesheet"===P.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(E){var t=ge(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D});t&&E(e,t)}}),N),P}function fe(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const me="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 ve={map:{},getId:()=>(console.error(me),-1),getNode:()=>(console.error(me),null),removeNodeFromMap(){console.error(me)},has:()=>(console.error(me),!1),reset(){console.error(me)}};function Ie(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 ye(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)}}),()=>ye(e,t,s||{},!0)}function Ce(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&&(ve=new Proxy(ve,{get:(e,t,n)=>("map"===t&&console.error(me),Reflect.get(e,t,n))}));let Se=Date.now;function be(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 Ae(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function we(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ke(e,t,n,r){if(!e)return!1;const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;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(ue(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 Me(e,t){return-2===t.getId(e)}function Te(e,t){if(B(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Te(e.parentNode,t))}function Ee(e){return Boolean(e.changedTouches)}function Re(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ne(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Oe(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Se=()=>(new Date).getTime());class De{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 xe(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 Le(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=xe(n);)n=t;return n}(e);return t.contains(n)}function Fe(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||Le(e))}var Ue=(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))(Ue||{}),We=(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))(We||{}),Be=(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))(Be||{}),_e=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(_e||{}),Ze=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ze||{});function Pe(e){return"__ln"in e}class Ge{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&&Pe(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&&Pe(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 Ve=(e,t)=>`${e}@${t}`;class Ke{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 Ge,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||!Fe(o))return;const s=B(o.parentNode)?this.mirror.getId(xe(o)):this.mirror.getId(o.parentNode),i=r(o);if(-1===s||-1===i)return n.addNode(o);const a=ge(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=>{Re(e,this.mirror)&&this.iframeManager.addIframe(e),Ne(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Oe(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)Ye(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)ze(this.droppedSet,e)||Ye(this.removes,e,this.mirror)?ze(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(Me(e.target,this.mirror))return;let t;try{t=document.implementation.createHTMLDocument()}catch(e){t=this.doc}switch(e.type){case"characterData":{const t=e.target.textContent;ke(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:de(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,o=e.target.getAttribute(r);if("value"===r){const e=Y(n);o=V({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:o,maskInputFn:this.maskInputFn})}if(ke(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributes.find((t=>t.node===e.target));if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(o)){if(n.contentDocument)return;r="rr_src"}if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!le(n.tagName,r)&&(s.attributes[r]=ce(this.doc,K(n.tagName),K(r),o),"style"===r)){const r=t.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),o=n.style.getPropertyPriority(e);t!==r.style.getPropertyValue(e)||o!==r.style.getPropertyPriority(e)?s.styleDiff[e]=""===o?t:[t,o]:s._unchangedStyles[e]=[t,o]}for(const e of Array.from(r.style))""===n.style.getPropertyValue(e)&&(s.styleDiff[e]=!1)}break}case"childList":if(ke(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=B(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);ke(e.target,this.blockClass,this.blockSelector,!1)||Me(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||Te(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ve(n,r)]?qe(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!B(e.target)||!_(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(Me(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[Ve(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ke(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),Oe(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 Ye(e,t,n){return 0!==e.length&&je(e,t,n)}function je(e,t,n){const{parentNode:r}=t;if(!r)return!1;const o=n.getId(r);return!!e.some((e=>e.id===o))||je(e,r,n)}function ze(e,t){return 0!==e.size&&Je(e,t)}function Je(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Je(e,n))}let Qe;function He(e){Qe=e}function Xe(){Qe=void 0}const $e=e=>{if(!Qe)return e;return(...t)=>{try{return e(...t)}catch(e){if(Qe&&!0===Qe(e))return;throw e}}},et=[];function tt(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 nt(e,t){var n,r;const o=new Ke;et.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($e(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function rt({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(Be).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{let i=K(s);const l=(t=>s=>{const i=tt(s);if(ke(i,r,o,!0))return;let a=null,l=t;if("pointerType"in s){switch(s.pointerType){case"mouse":a=_e.Mouse;break;case"touch":a=_e.Touch;break;case"pen":a=_e.Pen}a===_e.Touch?Be[t]===Be.MouseDown?l="TouchStart":Be[t]===Be.MouseUp&&(l="TouchEnd"):_e.Pen}else Ee(s)&&(a=_e.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===_e.Touch||l.startsWith("Mouse")&&a===_e.Mouse)&&(a=null)):Be[t]===Be.Click&&(a=c,c=null);const u=Ee(s)?s.changedTouches[0]:s;if(!u)return;const d=n.getId(i),{clientX:h,clientY:p}=u;$e(e)(Object.assign({type:Be[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(s);if(window.PointerEvent)switch(Be[s]){case Be.MouseDown:case Be.MouseUp:i=i.replace("mouse","pointer");break;case Be.TouchStart:case Be.TouchEnd:return}a.push(fe(i,l,t))})),$e((()=>{a.forEach((e=>e()))}))}function ot({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){return fe("scroll",$e(Ie($e((s=>{const i=tt(s);if(!i||ke(i,r,o,!0))return;const a=n.getId(i);if(i===t&&t.defaultView){const n=be(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 st(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const it=["INPUT","TEXTAREA","SELECT"],at=new WeakMap;function ct(e){return function(e,t){if(ht("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ht("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ht("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ht("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 lt(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function ut({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=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");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}}),$e((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function dt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!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);const r=nt(e,e.doc),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=Ie($e((t=>{const n=Date.now()-i;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],i=null})),s),l=$e(Ie($e((e=>{const t=tt(e),{clientX:n,clientY:o}=Ee(e)?e.changedTouches[0]:e;i||(i=Se()),a.push({x:n,y:o,id:r.getId(t),timeOffset:Se()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?We.Drag:e instanceof MouseEvent?We.MouseMove:We.TouchMove)})),o,{trailing:!1})),u=[fe("mousemove",l,n),fe("touchmove",l,n),fe("drag",l,n)];return $e((()=>{u.forEach((e=>e()))}))}(e),s=rt(e),i=ot(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return fe("resize",$e(Ie($e((()=>{const t=Ae(),o=we();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=tt(e);const l=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||it.indexOf(d)<0||ke(n,r,o,!0))return;if(n.classList.contains(s)||i&&n.matches(i))return;let p=n.value,g=!1;const f=Y(n)||"";"radio"===f||"checkbox"===f?g=n.checked:(a[d.toLowerCase()]||a[f])&&(p=V({element:n,maskInputOptions:a,tagName:d,type:f,value:p,maskInputFn:c})),h(n,$e(st)({text:p,isChecked:g,userTriggered:l},u));const m=n.name;"radio"===f&&m&&g&&t.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach((e=>{e!==n&&h(e,$e(st)({text:e.value,isChecked:!g,userTriggered:!1},u))}))}function h(t,r){const o=at.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){at.set(t,r);const o=n.getId(t);$e(e)(Object.assign(Object.assign({},r),{id:o}))}}const p=("last"===l.input?["change"]:["input","change"]).map((e=>fe(e,$e(d),t))),g=t.defaultView;if(!g)return()=>{p.forEach((e=>e()))};const f=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),m=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...m.map((e=>ye(e[0],e[1],{set(){$e(d)({target:this,isTrusted:!1})}},!1,g)))),$e((()=>{p.forEach((e=>e()))}))}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){const i=$e((s=>Ie($e((o=>{const i=tt(o);if(!i||ke(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=[fe("play",i(0),s),fe("pause",i(1),s),fe("seeked",i(2),s),fe("volumechange",i(3),s),fe("ratechange",i(4),s)];return $e((()=>{a.forEach((e=>e()))}))}(e),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:$e(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=lt(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:$e(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=lt(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:$e(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=lt(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:$e(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=lt(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:i}),r.apply(o,s)}))}));const c={};pt("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(pt("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),pt("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),pt("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:$e(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=lt(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:[...ct(o),a||0]}]}),r.apply(o,s)}))}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:$e(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=lt(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...ct(o),i]}]}),r.apply(o,s)}))})})),$e((()=>{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=ut(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:$e(((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}=lt(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:ct(i.parentRule)}),o.apply(i,a)}))});const i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:$e(((o,s,a)=>{var c;const[l]=a;if(n.has(l))return i.apply(s,[l]);const{id:u,styleId:d}=lt(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:ct(s.parentRule)}),o.apply(s,a)}))}),$e((()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i}))}(e,{win:n}),p=e.collectFonts?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=Ce(t.fonts,"add",(function(t){return function(n){return setTimeout($e((()=>{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),$e((()=>{r.forEach((e=>e()))}))}(e):()=>{},g=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let i=!0;const a=$e((()=>{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;ke(i,r,o,!0)||ke(l,r,o,!0)||a.push({start:n.getId(i),startOffset:c,end:n.getId(l),endOffset:u})}s({ranges:a})}));return a(),fe("selectionchange",a)}(e),f=[];for(const t of e.plugins)f.push(t.observer(t.callback,n,t.options));return $e((()=>{et.forEach((e=>e.reset())),r.disconnect(),o(),s(),i(),a(),c(),l(),u(),d(),h(),p(),g(),f.forEach((e=>e()))}))}function ht(e){return void 0!==window[e]}function pt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class gt{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 ft{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new gt(H),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new gt(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 Ue.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:Ue.IncrementalSnapshot,data:{source:We.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ue.Meta:case Ue.Load:case Ue.DomContentLoaded:return!1;case Ue.Plugin:return t;case Ue.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Ue.IncrementalSnapshot:switch(t.data.source){case We.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 We.Drag:case We.TouchMove:case We.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case We.ViewportResize:return!1;case We.MediaInteraction:case We.MouseInteraction:case We.Scroll:case We.CanvasMutation:case We.Input:return this.replaceIds(t.data,e,["id"]),t;case We.StyleSheetRule:case We.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case We.Font:return t;case We.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case We.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===W.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class mt{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(!_(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=nt(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(ot(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(ut({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(Ce(e.prototype,"attachShadow",(function(e){return function(r){const o=e.call(this,r);return this.shadowRoot&&Fe(this)&&n.addShadowRoot(this.shadowRoot,t),o}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}function vt(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 It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ct=0;Ct<It.length;Ct++)yt[It.charCodeAt(Ct)]=Ct;const St=new Map;const bt=(e,t,n)=>{if(!e||!kt(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=St.get(e);return n||(n=new Map,St.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 At(e,t,n){if(e instanceof Array)return e.map((e=>At(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+=It[n[t]>>2],o+=It[(3&n[t])<<4|n[t+1]>>4],o+=It[(15&n[t+1])<<2|n[t+2]>>6],o+=It[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:[At(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:[At(e.data,t,n),e.width,e.height]}}if(kt(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:bt(e,t,n)}}return e}const wt=(e,t,n)=>[...e].map((e=>At(e,t,n))),kt=(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 Mt(e,t,n,r){const o=[];try{const s=Ce(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...s){if(!ke(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 Tt(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=Ce(e,s,(function(e){return function(...a){const c=e.apply(this,a);if(bt(c,i,this),"tagName"in this.canvas&&!ke(this.canvas,r,o,!0)){const e=wt([...a],i,this),r={type:t,property:s,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const o=ye(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(o)}return a}function Et(e,t,n){var r=void 0===t?null:t,o=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,s=n.length;o<s;++o)r[o]=n.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(e,void 0!==n&&n),s=o.indexOf("\n",10)+1,i=o.substring(s)+(r?"//# sourceMappingURL="+r:""),a=new Blob([i],{type:"application/javascript"});return URL.createObjectURL(a)}var Rt,Nt,Ot,Dt,xt=(Rt="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",Nt=null,Ot=!1,function(e){return Dt=Dt||Et(Rt,Nt,Ot),new Worker(Dt,e)});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=Mt(t,n,r,!0),i=new Map,a=new xt;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:Ze["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=>{ke(t,n,r,!0)||e.push(t)})),e})().forEach((e=>vt(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=Mt(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=Ce(t.CanvasRenderingContext2D.prototype,i,(function(o){return function(...s){return ke(this.canvas,n,r,!0)||setTimeout((()=>{const n=wt([...s],t,this);e(this.canvas,{type:Ze["2D"],property:i,args:n})}),0),o.apply(this,s)}}));o.push(s)}catch(n){const r=ye(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:Ze["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(...Tt(t.WebGLRenderingContext.prototype,Ze.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&s.push(...Tt(t.WebGL2RenderingContext.prototype,Ze.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 Ft{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new De,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;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);r.push({styleId:e,rules:n.map(((e,t)=>({rule:P(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){}}class Ut{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}}function Wt(e){return Object.assign(Object.assign({},e),{timestamp:Se()})}let Bt,_t,Zt,Pt=!1;const Gt=new G;function Vt(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:g,maskTextFn:f,hooks:m,packFn:v,sampling:I={},dataURLOptions:y={},mousemoveWait:C,recordCanvas:S=!1,recordCrossOriginIframes:b=!1,recordAfter:A=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:w=!1,collectFonts:k=!1,inlineImages:M=!1,plugins:T,keepIframeSrcFn:E=(()=>!1),ignoreCSSAttributes:R=new Set([]),errorHandler:N}=e;He(N);const O=!b||window.parent===window;let D=!1;if(!O)try{window.parent.document&&(D=!1)}catch(e){D=!0}if(O&&!t)throw new Error("emit function is required");void 0!==C&&void 0===I.mousemove&&(I.mousemove=C),Gt.reset();const x=!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},L=!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 F;!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 U=0;const W=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!D&&(e=v(e)),e};Bt=(e,o)=>{var s;if(!(null===(s=et[0])||void 0===s?void 0:s.isFrozen())||e.type===Ue.FullSnapshot||e.type===Ue.IncrementalSnapshot&&e.data.source===We.Mutation||et.forEach((e=>e.unfreeze())),O)null==t||t(W(e),o);else if(D){const t={type:"rrweb",event:W(e),origin:window.location.origin,isCheckout:o};window.parent.postMessage(t,"*")}if(e.type===Ue.FullSnapshot)F=e,U=0;else if(e.type===Ue.IncrementalSnapshot){if(e.data.source===We.Mutation&&e.data.isAttachIframe)return;U++;const t=r&&U>=r,o=n&&e.timestamp-F.timestamp>n;(t||o)&&_t(!0)}};const B=e=>{Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Mutation},e)}))},_=e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Scroll},e)})),Z=e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.CanvasMutation},e)})),P=new Ft({mutationCb:B,adoptedStyleSheetCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.AdoptedStyleSheet},e)}))}),V=new ft({mirror:Gt,mutationCb:B,stylesheetManager:P,recordCrossOriginIframes:b,wrappedEmit:Bt});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:Gt,crossOriginIframeMirror:V.crossOriginIframeMirror,crossOriginIframeStyleMirror:V.crossOriginIframeStyleMirror});const K=new Ut;Zt=new Lt({recordCanvas:S,mutationCb:Z,win:window,blockClass:o,blockSelector:s,mirror:Gt,sampling:I.canvas,dataURLOptions:y});const q=new mt({mutationCb:B,scrollCb:_,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:x,dataURLOptions:y,maskTextFn:f,maskInputFn:g,recordCanvas:S,inlineImages:M,sampling:I,slimDOMOptions:L,iframeManager:V,stylesheetManager:P,canvasManager:Zt,keepIframeSrcFn:E,processedNodeManager:K},mirror:Gt});_t=(e=!1)=>{Bt(Wt({type:Ue.Meta,data:{href:window.location.href,width:we(),height:Ae()}}),e),P.reset(),q.init(),et.forEach((e=>e.lock()));const t=function(e,t){var n=t||{},r=n.mirror,o=void 0===r?new G: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,g=void 0===p||p,f=n.inlineImages,m=void 0!==f&&f,v=n.recordCanvas,I=void 0!==v&&v,y=n.maskAllInputs,C=void 0!==y&&y,S=n.maskTextFn,b=n.maskInputFn,A=n.slimDOM,w=void 0!==A&&A,k=n.dataURLOptions,M=n.preserveWhiteSpace,T=n.onSerialize,E=n.onIframeLoad,R=n.iframeLoadTimeout,N=n.onStylesheetLoad,O=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return ge(e,{doc:e,mirror:o,blockClass:i,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:!0===C?{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===C?{password:!0}:C,maskTextFn:S,maskInputFn:b,slimDOMOptions:!0===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===w,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===w?{}:w,dataURLOptions:k,inlineImages:m,recordCanvas:I,preserveWhiteSpace:M,onSerialize:T,onIframeLoad:E,iframeLoadTimeout:R,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:Gt,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:x,maskTextFn:f,slimDOM:L,dataURLOptions:y,recordCanvas:S,inlineImages:M,onSerialize:e=>{Re(e,Gt)&&V.addIframe(e),Ne(e,Gt)&&P.trackLinkElement(e),Oe(e)&&q.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{V.attachIframe(e,t),q.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{P.attachLinkElement(e,t)},keepIframeSrcFn:E});if(!t)return console.warn("Failed to snapshot the document");Bt(Wt({type:Ue.FullSnapshot,data:{node:t,initialOffset:be(window)}}),e),et.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&P.adoptStyleSheets(document.adoptedStyleSheets,Gt.getId(document))};try{const e=[],t=e=>{var t;return $e(dt)({mutationCb:B,mousemoveCb:(e,t)=>Bt(Wt({type:Ue.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.MouseInteraction},e)})),scrollCb:_,viewportResizeCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.ViewportResize},e)})),inputCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Input},e)})),mediaInteractionCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.MediaInteraction},e)})),styleSheetRuleCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.StyleSheetRule},e)})),styleDeclarationCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.StyleDeclaration},e)})),canvasMutationCb:Z,fontCb:e=>Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Font},e)})),selectionCb:e=>{Bt(Wt({type:Ue.IncrementalSnapshot,data:Object.assign({source:We.Selection},e)}))},blockClass:o,ignoreClass:i,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:x,inlineStylesheet:u,sampling:I,recordCanvas:S,inlineImages:M,userTriggeredOnInput:w,collectFonts:k,doc:e,maskInputFn:g,maskTextFn:f,keepIframeSrcFn:E,blockSelector:s,slimDOMOptions:L,dataURLOptions:y,mirror:Gt,iframeManager:V,stylesheetManager:P,shadowDomManager:q,processedNodeManager:K,canvasManager:Zt,ignoreCSSAttributes:R,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=>Bt(Wt({type:Ue.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},m)};V.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{_t(),e.push(t(document)),Pt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(fe("DOMContentLoaded",(()=>{Bt(Wt({type:Ue.DomContentLoaded,data:{}})),"DOMContentLoaded"===A&&n()}))),e.push(fe("load",(()=>{Bt(Wt({type:Ue.Load,data:{}})),"load"===A&&n()}),window))),()=>{e.forEach((e=>e())),K.destroy(),Pt=!1,Xe()}}catch(e){console.warn(e)}}var Kt,qt;Vt.addCustomEvent=(e,t)=>{if(!Pt)throw new Error("please add custom event after start recording");Bt(Wt({type:Ue.Custom,data:{tag:e,payload:t}}))},Vt.freezePage=()=>{et.forEach((e=>e.freeze()))},Vt.takeFullSnapshot=e=>{if(!Pt)throw new Error("please take full snapshot after start recording");_t(e)},Vt.mirror=Gt,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"}(Kt||(Kt={})),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"}(qt||(qt={}));var Yt=Uint8Array,jt=Uint16Array,zt=Uint32Array,Jt=new Yt([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]),Qt=new Yt([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]),Ht=new Yt([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 jt(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]},$t=Xt(Jt,2),en=$t[0],tn=$t[1];en[28]=258,tn[258]=28;for(var nn=Xt(Qt,0)[1],rn=new jt(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 jt(t);o<r;++o)++s[e[o]-1];var i,a=new jt(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;if(n){i=new jt(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 jt(r),o=0;o<r;++o)i[o]=rn[a[e[o]-1]++]>>>15-e[o];return i},cn=new Yt(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 Yt(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 jt?jt:e instanceof zt?zt:Yt)(n-t);return r.set(e.subarray(t,n)),r},gn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},fn=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},mn=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 Yt(0),0];if(1==o){var i=new Yt(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 jt(h+1),g=vn(n[u-1],p,0);if(g>t){r=0;var f=0,m=g-t,v=1<<m;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<o;++r){var I=s[r].s;if(!(p[I]>t))break;f+=v-(1<<g-p[I]),p[I]=t}for(f>>>=m;f>0;){var y=s[r].s;p[y]<t?f-=1<<t-p[y]++-1:++r}for(;r>=0&&f;--r){var C=s[r].s;p[C]==t&&(--p[C],++f)}g=t}return[new Yt(p),g]},vn=function(e,t,n){return-1==e.s?Math.max(vn(e.l,t,n+1),vn(e.r,t,n+1)):t[e.s]=n},In=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new jt(++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]},yn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Cn=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)},Sn=function(e,t,n,r,o,s,i,a,c,l,u){gn(t,u++,n),++o[256];for(var d=mn(o,15),h=d[0],p=d[1],g=mn(s,15),f=g[0],m=g[1],v=In(h),I=v[0],y=v[1],C=In(f),S=C[0],b=C[1],A=new jt(19),w=0;w<I.length;++w)A[31&I[w]]++;for(w=0;w<S.length;++w)A[31&S[w]]++;for(var k=mn(A,7),M=k[0],T=k[1],E=19;E>4&&!M[Ht[E-1]];--E);var R,N,O,D,x=l+5<<3,L=yn(o,cn)+yn(s,ln)+i,F=yn(o,h)+yn(s,f)+i+14+3*E+yn(A,M)+(2*A[16]+3*A[17]+7*A[18]);if(x<=L&&x<=F)return Cn(t,u,e.subarray(c,c+l));if(gn(t,u,1+(F<L)),u+=2,F<L){R=an(h,p,0),N=h,O=an(f,m,0),D=f;var U=an(M,T,0);gn(t,u,y-257),gn(t,u+5,b-1),gn(t,u+10,E-4),u+=14;for(w=0;w<E;++w)gn(t,u+3*w,M[Ht[w]]);u+=3*E;for(var W=[I,S],B=0;B<2;++B){var _=W[B];for(w=0;w<_.length;++w){var Z=31&_[w];gn(t,u,U[Z]),u+=M[Z],Z>15&&(gn(t,u,_[w]>>>5&127),u+=_[w]>>>12)}}}else R=un,N=cn,O=dn,D=ln;for(w=0;w<a;++w)if(r[w]>255){Z=r[w]>>>18&31;fn(t,u,R[Z+257]),u+=N[Z+257],Z>7&&(gn(t,u,r[w]>>>23&31),u+=Jt[Z]);var P=31&r[w];fn(t,u,O[P]),u+=D[P],P>3&&(fn(t,u,r[w]>>>5&8191),u+=Qt[P])}else fn(t,u,R[r[w]]),u+=N[r[w]];return fn(t,u,R[256]),u+N[256]},bn=new zt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),An=new Yt(0),wn=function(e,t,n,r,o){return function(e,t,n,r,o,s){var i=e.length,a=new Yt(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=Cn(c,l,e.subarray(u,d)):(c[u]=s,l=Cn(c,l,e.subarray(u,i)))}else{for(var h=bn[t-1],p=h>>>13,g=8191&h,f=(1<<n)-1,m=new jt(32768),v=new jt(f+1),I=Math.ceil(n/3),y=2*I,C=function(t){return(e[t]^e[t+1]<<I^e[t+2]<<y)&f},S=new zt(25e3),b=new jt(288),A=new jt(32),w=0,k=0,M=(u=0,0),T=0,E=0;u<i;++u){var R=C(u),N=32767&u,O=v[R];if(m[N]=O,v[R]=N,T<=u){var D=i-u;if((w>7e3||M>24576)&&D>423){l=Sn(e,c,0,S,b,A,k,M,E,u-E,l),M=w=k=0,E=u;for(var x=0;x<286;++x)b[x]=0;for(x=0;x<30;++x)A[x]=0}var L=2,F=0,U=g,W=N-O&32767;if(D>2&&R==C(u-W))for(var B=Math.min(p,D)-1,_=Math.min(32767,u),Z=Math.min(258,D);W<=_&&--U&&N!=O;){if(e[u+L]==e[u+L-W]){for(var P=0;P<Z&&e[u+P]==e[u+P-W];++P);if(P>L){if(L=P,F=W,P>B)break;var G=Math.min(W,P-2),V=0;for(x=0;x<G;++x){var K=u-W+x+32768&32767,q=K-m[K]+32768&32767;q>V&&(V=q,O=K)}}}W+=(N=O)-(O=m[N])+32768&32767}if(F){S[M++]=268435456|tn[L]<<18|nn[F];var Y=31&tn[L],j=31&nn[F];k+=Jt[Y]+Qt[j],++b[257+Y],++A[j],T=u+L,++w}else S[M++]=e[u],++b[e[u]]}}l=Sn(e,c,s,S,b,A,k,M,E,u-E,l),s||(l=Cn(c,l,An))}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=wn(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 Mn=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 Yt(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 Yt(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 Tn,En;(En=Tn||(Tn={}))[En.NotStarted=0]="NotStarted",En[En.Running=1]="Running",En[En.Stopped=2]="Stopped";var Rn,Nn="".concat("[Amplitude]"," Session Recorded"),On="".concat("AMP","_replay_unsent"),Dn={currentSequenceId:0,sessionSequences:{}},xn=function(e,t){var n;return(null===(n=t.classList)||void 0===n?void 0:n.contains("amp-unmask"))?e:"*".repeat(e.length)},Ln="Session replay event batch rejected due to exceeded retry count",Fn="Failed to store session replay events in IndexedDB";!function(e){e.RECORDING="recording",e.SENT="sent"}(Rn||(Rn={}));var Un=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.storageKey="",this.retryTimeout=1e3,this.events=[],this.currentSequenceId=0,this.scheduled=null,this.queue=[],this.stopRecordingEvents=null,this.maxPersistedEventsSize=1e6,this.interval=500,this.timeAtLastSend=null,this.getSessionRecordingProperties=function(){return e.loggerProvider.warn("Please use getSessionReplayProperties instead of getSessionRecordingProperties."),e.getSessionReplayProperties()},this.blurListener=function(){e.stopRecordingAndSendEvents()},this.focusListener=function(){e.initialize()},this.shouldSplitEventsList=function(t){var n=new Blob([t]).size;return new Blob(e.events).size+n>=e.maxPersistedEventsSize||!!(null!==e.timeAtLastSend&&Date.now()-e.timeAtLastSend>e.interval&&e.events.length)&&(e.interval=Math.min(1e4,e.interval+500),e.timeAtLastSend=Date.now(),!0)},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 O(e,t),this.loggerProvider=this.config.loggerProvider,this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.storageKey="".concat(On,"_").concat(this.config.apiKey.substring(0,10)),(n=E())&&(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){this.config?(this.stopRecordingAndSendEvents(this.config.sessionId),this.config.sessionId=e,this.events=[],this.currentSequenceId=0,this.recordEvents()):this.loggerProvider.error("Session replay init has not been called, cannot set session id.")},e.prototype.getSessionReplayProperties=function(){var e;return this.config?this.getShouldRecord()?((e={})[Nn]=!0,e):{}:(this.loggerProvider.error("Session replay init has not been called, cannot get session recording properties."),{})},e.prototype.stopRecordingAndSendEvents=function(e){var t;try{this.stopRecordingEvents&&this.stopRecordingEvents(),this.stopRecordingEvents=null}catch(e){var n=e;this.loggerProvider.error("Error occurred while stopping recording: ".concat(n.toString()))}var r=e||(null===(t=this.config)||void 0===t?void 0:t.sessionId);this.events.length&&r&&this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var n,r,o,s;return c(this,(function(i){switch(i.label){case 0:return this.timeAtLastSend=Date.now(),(null===(t=this.config)||void 0===t?void 0:t.sessionId)?[4,this.getAllSessionEventsFromStore()]:(this.loggerProvider.warn("Session is not being recorded due to lack of session id."),[2]);case 1:return n=i.sent(),this.stopRecordingEvents?[2]:(r=n&&n[this.config.sessionId],n&&r&&r.sessionSequences&&(o=r.currentSequenceId,(s=r.sessionSequences[o])&&s.status!==Rn.RECORDING?(this.currentSequenceId=o+1,this.events=[]):(this.currentSequenceId=o,this.events=(null==s?void 0:s.events)||[])),e&&n&&this.sendStoredEvents(n),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 n||(null===(t=this.config)||void 0===t?void 0:t.optOut)},e.prototype.getShouldRecord=function(){if(!this.config)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;var e,t,n,r=E();if(r&&r.document&&!r.document.hasFocus())return this.config.sessionId&&this.loggerProvider.log("Session ".concat(this.config.sessionId," temporarily not recording due to lack of browser focus.")),!1;if(this.shouldOptOut())return this.config.sessionId&&this.loggerProvider.log("Opting session ".concat(this.config.sessionId," out of recording due to optOut config.")),!1;if(!this.config.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of session id."),!1;if(this.config.sampleRate){var o=(e=this.config.sessionId,t=this.config.sampleRate,n=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}(e.toString()),31*Math.abs(n)%100/100<t);return o||this.loggerProvider.log("Opting session ".concat(this.config.sessionId," out of recording due to sample rate.")),o}return!0},e.prototype.sendStoredEvents=function(e){var t;for(var n in e){var r=e[n].sessionSequences;for(var o in r){var s=r[o],i=parseInt(o,10),a=parseInt(n,10);a===(null===(t=this.config)||void 0===t?void 0:t.sessionId)&&i===this.currentSequenceId||s.events.length&&s.status===Rn.RECORDING&&this.sendEventsList({events:s.events,sequenceId:i,sessionId:a})}}},e.prototype.recordEvents=function(){var e,t=this,n=this.getShouldRecord(),r=null===(e=this.config)||void 0===e?void 0:e.sessionId;n&&r&&(this.stopRecordingEvents=Vt({emit:function(e){var n=E();if(n&&n.document&&!n.document.hasFocus())t.stopRecordingAndSendEvents();else{var o=JSON.stringify(e);t.shouldSplitEventsList(o)&&(t.sendEventsList({events:t.events,sequenceId:t.currentSequenceId,sessionId:r}),t.events=[],t.currentSequenceId++),t.events.push(o),t.storeEventsForSession(t.events,t.currentSequenceId,r)}},packFn:Mn,maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",maskInputFn:xn,recordCanvas:!1,errorHandler:function(e){var n=e;return t.loggerProvider.error("Error while recording: ",n.toString()),!0}}))},e.prototype.sendEventsList=function(e){var t=e.events,n=e.sequenceId,r=e.sessionId;this.addToQueue({events:t,sequenceId:n,attempts:0,timeout:0,sessionId:r})},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){var n;return t.attempts<((null===(n=e.config)||void 0===n?void 0:n.flushMaxRetries)||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"".concat(Ln,", 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.getServerUrl=function(){var e;return(null===(e=this.config)||void 0===e?void 0:e.serverZone)===o.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track"},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.config)||void 0===t?void 0:t.deviceId)},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),a(this,void 0,void 0,(function(){var r,o,s,i,a,l,u,d,h;return c(this,(function(c){switch(c.label){case 0:if(!(r=null===(n=this.config)||void 0===n?void 0:n.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(o=this.getDeviceId()))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];s=new URLSearchParams({device_id:o,session_id:"".concat(e.sessionId),seq_number:"".concat(e.sequenceId)}),i={version:1,events:e.events},c.label=1;case 1:return c.trys.push([1,3,,4]),a={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(r)},body:JSON.stringify(i),method:"POST"},l="".concat(this.getServerUrl(),"?").concat(s.toString()),[4,fetch(l,a)];case 2:if(null===(u=c.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(u.status,e);else{d="";try{d=JSON.stringify(u.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(u.status,": ").concat(d)})}return[3,4];case 3:return h=c.sent(),this.completeRequest({context:e,err:h}),[3,4];case 4:return[2]}}))}))},e.prototype.handleReponse=function(e,t){switch((new I).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.getAllSessionEventsFromStore=function(){return a(this,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,F(this.storageKey)];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.loggerProvider.error("".concat(Fn,": ").concat(e)),[3,3];case 3:return[2,void 0]}}))}))},e.prototype.storeEventsForSession=function(e,t,n){return a(this,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,U(this.storageKey,(function(r){var o,s;void 0===r&&(r={});var a=r[n]||i({},Dn);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.error("".concat(Fn,": ").concat(r)),[3,3];case 3:return[2]}}))}))},e.prototype.cleanUpSessionEventsStore=function(e,t){return a(this,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,U(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.error("".concat(Fn,": ").concat(n)),[3,3];case 3:return[2]}}))}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.sessionId&&this.cleanUpSessionEventsStore(t.sessionId,t.sequenceId),n?this.loggerProvider.error(n):r&&this.loggerProvider.log(r)},e.prototype.shutdown=function(){var e=E();e&&(e.removeEventListener("blur",this.blurListener),e.removeEventListener("focus",this.focusListener)),this.stopRecordingAndSendEvents()},e}(),Wn=function(e){return function(){var t=e.config||N();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Bn=function(){var e=new Un;return{init:v(e.init.bind(e),"init",Wn(e)),setSessionId:v(e.setSessionId.bind(e),"setSessionId",Wn(e)),getSessionRecordingProperties:v(e.getSessionRecordingProperties.bind(e),"getSessionRecordingProperties",Wn(e)),getSessionReplayProperties:v(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Wn(e)),shutdown:v(e.shutdown.bind(e),"teardown",Wn(e))}}(),_n=Bn.init,Zn=Bn.setSessionId;Bn.getSessionRecordingProperties;var Pn=Bn.getSessionReplayProperties,Gn=Bn.shutdown,Vn=function(){function e(e){this.name="@amplitude/plugin-session-replay-browser",this.type="enrichment",this.options=i({},e)}return e.prototype.setup=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return e.loggerProvider.log("Installing @amplitude/plugin-session-replay."),this.config=e,"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,_n(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}).promise];case 1:return t.sent(),[2]}}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){return"session_start"===e.event_type&&e.session_id&&Zn(e.session_id),t=Pn(),e.event_properties=i(i({},e.event_properties),t),[2,Promise.resolve(e)]}))}))},e.prototype.teardown=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){return Gn(),[2]}))}))},e}(),Kn=function(e){return new Vn(e)};e.plugin=Kn,e.sessionReplayPlugin=Kn,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"}(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=f(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}(),g=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},f=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:g(r,n)}},m=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},v=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:m(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}},I=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,g,f,m,v,I,y,C,S,b,A;if("object"!=typeof e)return null;var w=e.code||0,k=this.buildStatus(w);switch(k){case s.Success:return{status:k,statusCode:w,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:w,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!==(g=e.throttled_devices)&&void 0!==g?g:{},throttledEvents:null!==(f=e.throttled_events)&&void 0!==f?f:[]}};case s.PayloadTooLarge:return{status:k,statusCode:w,body:{error:null!==(m=e.error)&&void 0!==m?m:""}};case s.RateLimit:return{status:k,statusCode:w,body:{error:null!==(v=e.error)&&void 0!==v?v:"",epsThreshold:null!==(I=e.eps_threshold)&&void 0!==I?I:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(C=e.throttled_users)&&void 0!==C?C:{},exceededDailyQuotaDevices:null!==(S=e.exceeded_daily_quota_devices)&&void 0!==S?S:{},exceededDailyQuotaUsers:null!==(b=e.exceeded_daily_quota_users)&&void 0!==b?b:{},throttledEvents:null!==(A=e.throttled_events)&&void 0!==A?A:[]}};case s.Timeout:default:return{status:k,statusCode:w}}},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}(),y=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:C(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),C=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},S=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}(),b=function(){return b=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},b.apply(this,arguments)},A=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(!A(a,c))return!1;var l=!0;return Object.keys(e).forEach((function(n){A(e[n],t[n])||(l=!1)})),l}for(var u=0;u<e.length;u++)if(!A(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 w=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=b({},this.identity.userProperties),n=b(b({},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,g=Object.keys(a);p<g.length;p++){delete t[d=g[p]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return b({},this.identity)},e.prototype.setIdentity=function(e){var t=b({},this.identity);this.identity=b({},e),A(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}(),k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,M=function(){function e(){this.identityStore=new w,this.eventBridge=new S,this.applicationContextProvider=new y}return e.getInstance=function(t){return k.analyticsConnectorInstances||(k.analyticsConnectorInstances={}),k.analyticsConnectorInstances[t]||(k.analyticsConnectorInstances[t]=new e),k.analyticsConnectorInstances[t]},e}(),T=function(e){return void 0===e&&(e="$default_instance"),M.getInstance(e)},E=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},R=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}(I),N="".concat("[Amplitude]"," Session Recorded"),O="".concat("AMP","_replay_unsent"),D={currentSequenceId:0,sessionSequences:{}},x=function(){return{flushMaxRetries:2,logLevel:r.Warn,loggerProvider:new d,transportProvider:new R}},L=function(e){function t(t,n){var r=this,o=x();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.deviceId=n.deviceId,r.sessionId=n.sessionId,r}return n(t,e),t}(p);function F(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}let U;function W(){return U||(U=function(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=F(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}("keyval-store","keyval")),U}function B(e,t=W()){return t("readonly",(t=>F(t.get(e))))}function _(e,t,n=W()){return n("readwrite",(n=>new Promise(((r,o)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),r(F(n.transaction))}catch(e){o(e)}}}))))}var Z;function P(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function G(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function V(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(K).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 K(e){var t;if(function(e){return"styleSheet"in e}(e))try{t=V(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){}return function(e){if(e.includes(":")){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}return e}(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"}(Z||(Z={}));var q=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 Y(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,o=e.type,s=e.value,i=e.maskInputFn,a=s||"",c=o&&j(o);return(n[r.toLowerCase()]||c&&n[c])&&(a=i?i(a,t):"*".repeat(a.length)),a}function j(e){return e.toLowerCase()}var z="__rrweb_original__";function J(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?j(t):null}var Q,H,X=1,$=new RegExp("[^a-z0-9-_:]");function ee(){return X++}var te=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ne=/^(?:[a-z+]+:)?\/\//i,re=/^www\..*/i,oe=/^(data:)([^,]*),(.*)/i;function se(e,t){return(e||"").replace(te,(function(e,n,r,o,s,i){var a,c=r||s||i,l=n||o||"";if(!c)return e;if(ne.test(c)||re.test(c))return"url(".concat(l).concat(c).concat(l,")");if(oe.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 g=p[h];"."!==g&&(".."===g?u.pop():u.push(g))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var ie=/^[^ \t\n\r\u000c]+/,ae=/^[, \t\n\r\u000c]+/;function ce(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function le(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ue(){var e=document.createElement("a");return e.href="",e.href}function de(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?ce(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(ae),!(n>=t.length);){var s=r(ie);if(","===s.slice(-1))s=ce(e,s.substring(0,s.length-1)),o.push(s);else{var i="";s=ce(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?se(r,ue()):"object"===t&&"data"===n?ce(e,r):r:ce(e,r):r}function he(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function pe(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&pe(e.parentNode,t,n);for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return!!n&&pe(e.parentNode,t,n)}function ge(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(pe(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}}catch(e){}return!1}function fe(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,g=void 0===p?{}:p,f=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,I=t.newlyAddedElement,y=void 0!==I&&I,C=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:Z.Document,childNodes:[],compatMode:e.compatMode}:{type:Z.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Z.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};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,g=t.newlyAddedElement,f=void 0!==g&&g,m=t.rootId,v=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),I=function(e){if(e instanceof HTMLFormElement)return"form";var t=j(e.tagName);return $.test(t)?"div":t}(e),y={},C=e.attributes.length,S=0;S<C;S++){var b=e.attributes[S];he(I,b.name,b.value)||(y[b.name]=de(n,I,j(b.name),b.value))}if("link"===I&&s){var A=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),w=null;A&&(w=V(A)),w&&(delete y.rel,delete y.href,y._cssText=se(w,A.href))}if("style"===I&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(w=V(e.sheet))&&(y._cssText=se(w,ue()))}if("input"===I||"textarea"===I||"select"===I){var k=e.value,M=e.checked;if("radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&k){var T=J(e);y.value=Y({element:e,type:T,tagName:I,value:k,maskInputOptions:a,maskInputFn:c})}else M&&(y.checked=M)}"option"===I&&(e.selected&&!a.select?y.selected=!0:delete y.selected);if("canvas"===I&&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=z in o?o[z]: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)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var E=e.toDataURL(u.type,u.quality),R=document.createElement("canvas");R.width=e.width,R.height=e.height,E!==R.toDataURL(u.type,u.quality)&&(y.rr_dataURL=E)}if("img"===I&&d){Q||(Q=n.createElement("canvas"),H=Q.getContext("2d"));var N=e,O=N.crossOrigin;N.crossOrigin="anonymous";var D=function(){N.removeEventListener("load",D);try{Q.width=N.naturalWidth,Q.height=N.naturalHeight,H.drawImage(N,0,0),y.rr_dataURL=Q.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(N.currentSrc,"! Error: ").concat(e))}O?y.crossOrigin=O:N.removeAttribute("crossorigin")};N.complete&&0!==N.naturalWidth?D():N.addEventListener("load",D)}"audio"!==I&&"video"!==I||(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime);f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(v){var x=e.getBoundingClientRect(),L=x.width,F=x.height;y={class:y.class,rr_width:"".concat(L,"px"),rr_height:"".concat(F,"px")}}"iframe"!==I||p(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);return{type:Z.Element,tagName:I,attributes:y,childNodes:[],isSVG:le(e)||void 0,needBlock:v,rootId:m}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:g,inlineImages:f,recordCanvas:m,keepIframeSrcFn:v,newlyAddedElement:y,rootId:C});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=V(e.parentNode.sheet))}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=se(c,ue())}u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&ge(e,r,o)&&(c=s?s(c):c.replace(/[\S]/g,"*"));return{type:Z.Text,textContent:c||"",isStyle:l,rootId:i}}(e,{maskTextClass:i,maskTextSelector:a,maskTextFn:d,rootId:C});case e.CDATA_SECTION_NODE:return{type:Z.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return{type:Z.Comment,textContent:e.textContent||"",rootId:C};default:return!1}}function me(e){return null==e?"":e.toLowerCase()}function ve(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,g=void 0===p?{}:p,f=t.maskTextFn,m=t.maskInputFn,v=t.slimDOMOptions,I=t.dataURLOptions,y=void 0===I?{}:I,C=t.inlineImages,S=void 0!==C&&C,b=t.recordCanvas,A=void 0!==b&&b,w=t.onSerialize,k=t.onIframeLoad,M=t.iframeLoadTimeout,T=void 0===M?5e3:M,E=t.onStylesheetLoad,R=t.stylesheetLoadTimeout,N=void 0===R?5e3:R,O=t.keepIframeSrcFn,D=void 0===O?function(){return!1}:O,x=t.newlyAddedElement,L=void 0!==x&&x,F=t.preserveWhiteSpace,U=void 0===F||F,W=fe(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,dataURLOptions:y,inlineImages:S,recordCanvas:A,keepIframeSrcFn:D,newlyAddedElement:L});if(!W)return console.warn(e,"not serialized"),null;n=o.hasNode(e)?o.getId(e):!function(e,t){if(t.comment&&e.type===Z.Comment)return!0;if(e.type===Z.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&&(me(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===me(e.attributes.name)||"icon"===me(e.attributes.rel)||"apple-touch-icon"===me(e.attributes.rel)||"shortcut icon"===me(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&me(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(me(e.attributes.property).match(/^(og|twitter|fb):/)||me(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===me(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===me(e.attributes.name)||"googlebot"===me(e.attributes.name)||"bingbot"===me(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===me(e.attributes.name)||"generator"===me(e.attributes.name)||"framework"===me(e.attributes.name)||"publisher"===me(e.attributes.name)||"progid"===me(e.attributes.name)||me(e.attributes.property).match(/^article:/)||me(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===me(e.attributes.name)||"yandex-verification"===me(e.attributes.name)||"csrf-token"===me(e.attributes.name)||"p:domain_verify"===me(e.attributes.name)||"verify-v1"===me(e.attributes.name)||"verification"===me(e.attributes.name)||"shopify-checkout-api-token"===me(e.attributes.name)))return!0}}return!1}(W,v)&&(U||W.type!==Z.Text||W.isStyle||W.textContent.replace(/^\s+|\s+$/gm,"").length)?ee():-2;var B=Object.assign(W,{id:n});if(o.add(e,B),-2===n)return null;w&&w(e);var _=!u;if(B.type===Z.Element){_=_&&!B.needBlock,delete B.needBlock;var V=e.shadowRoot;V&&G(V)&&(B.isShadowHost=!0)}if((B.type===Z.Document||B.type===Z.Element)&&_){v.headWhitespace&&B.type===Z.Element&&"head"===B.tagName&&(U=!1);for(var K={doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D},q=0,Y=Array.from(e.childNodes);q<Y.length;q++){(J=ve(Y[q],K))&&B.childNodes.push(J)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var j=0,z=Array.from(e.shadowRoot.childNodes);j<z.length;j++){var J;(J=ve(z[j],K))&&(G(e.shadowRoot)&&(J.isShadow=!0),B.childNodes.push(J))}}return e.parentNode&&P(e.parentNode)&&G(e.parentNode)&&(B.isShadow=!0),B.type===Z.Element&&"iframe"===B.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&&k){var n=ve(t,{doc:t,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D});n&&k(e,n)}}),T),B.type===Z.Element&&"link"===B.tagName&&"stylesheet"===B.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(E){var t=ve(e,{doc:r,mirror:o,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:f,maskInputFn:m,slimDOMOptions:v,dataURLOptions:y,inlineImages:S,recordCanvas:A,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:k,iframeLoadTimeout:T,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:D});t&&E(e,t)}}),N),B}function Ie(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const ye="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 Ce={map:{},getId:()=>(console.error(ye),-1),getNode:()=>(console.error(ye),null),removeNodeFromMap(){console.error(ye)},has:()=>(console.error(ye),!1),reset(){console.error(ye)}};function Se(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 be(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)}}),()=>be(e,t,s||{},!0)}function Ae(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&&(Ce=new Proxy(Ce,{get:(e,t,n)=>("map"===t&&console.error(ye),Reflect.get(e,t,n))}));let we=Date.now;function ke(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 Me(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Te(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ee(e,t,n,r){if(!e)return!1;const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;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(pe(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 Re(e,t){return-2===t.getId(e)}function Ne(e,t){if(P(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Ne(e.parentNode,t))}function Oe(e){return Boolean(e.changedTouches)}function De(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function xe(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Le(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(we=()=>(new Date).getTime());class Fe{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 Ue(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 We(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=Ue(n);)n=t;return n}(e);return t.contains(n)}function Be(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||We(e))}var _e=(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))(_e||{}),Ze=(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))(Ze||{}),Pe=(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))(Pe||{}),Ge=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ge||{}),Ve=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ve||{});function Ke(e){return"__ln"in e}class qe{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&&Ke(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&&Ke(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 je{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 qe,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=P(o.parentNode)?this.mirror.getId(Ue(o)):this.mirror.getId(o.parentNode),i=r(o);if(-1===s||-1===i)return n.addNode(o);const a=ve(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=>{De(e,this.mirror)&&this.iframeManager.addIframe(e),xe(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Le(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)Je(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)He(this.droppedSet,e)||Je(this.removes,e,this.mirror)?He(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(Re(e.target,this.mirror))return;let t;try{t=document.implementation.createHTMLDocument()}catch(e){t=this.doc}switch(e.type){case"characterData":{const t=e.target.textContent;Ee(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:ge(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,o=e.target.getAttribute(r);if("value"===r){const e=J(n);o=Y({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:o,maskInputFn:this.maskInputFn})}if(Ee(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributes.find((t=>t.node===e.target));if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(o)){if(n.contentDocument)return;r="rr_src"}if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!he(n.tagName,r)&&(s.attributes[r]=de(this.doc,j(n.tagName),j(r),o),"style"===r)){const r=t.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),o=n.style.getPropertyPriority(e);t!==r.style.getPropertyValue(e)||o!==r.style.getPropertyPriority(e)?s.styleDiff[e]=""===o?t:[t,o]:s._unchangedStyles[e]=[t,o]}for(const e of Array.from(r.style))""===n.style.getPropertyValue(e)&&(s.styleDiff[e]=!1)}break}case"childList":if(Ee(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=P(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Ee(e.target,this.blockClass,this.blockSelector,!1)||Re(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(ze(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Ne(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ye(n,r)]?ze(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!P(e.target)||!G(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(Re(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);Ee(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),Le(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 ze(e,t){e.delete(t),t.childNodes.forEach((t=>ze(e,t)))}function Je(e,t,n){return 0!==e.length&&Qe(e,t,n)}function Qe(e,t,n){const{parentNode:r}=t;if(!r)return!1;const o=n.getId(r);return!!e.some((e=>e.id===o))||Qe(e,r,n)}function He(e,t){return 0!==e.size&&Xe(e,t)}function Xe(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Xe(e,n))}let $e;function et(e){$e=e}function tt(){$e=void 0}const nt=e=>{if(!$e)return e;return(...t)=>{try{return e(...t)}catch(e){if($e&&!0===$e(e))return;throw e}}},rt=[];function ot(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 st(e,t){var n,r;const o=new je;rt.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(nt(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function it({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(Pe).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{let i=j(s);const l=(t=>s=>{const i=ot(s);if(Ee(i,r,o,!0))return;let a=null,l=t;if("pointerType"in s){switch(s.pointerType){case"mouse":a=Ge.Mouse;break;case"touch":a=Ge.Touch;break;case"pen":a=Ge.Pen}a===Ge.Touch?Pe[t]===Pe.MouseDown?l="TouchStart":Pe[t]===Pe.MouseUp&&(l="TouchEnd"):Ge.Pen}else Oe(s)&&(a=Ge.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===Ge.Touch||l.startsWith("Mouse")&&a===Ge.Mouse)&&(a=null)):Pe[t]===Pe.Click&&(a=c,c=null);const u=Oe(s)?s.changedTouches[0]:s;if(!u)return;const d=n.getId(i),{clientX:h,clientY:p}=u;nt(e)(Object.assign({type:Pe[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(s);if(window.PointerEvent)switch(Pe[s]){case Pe.MouseDown:case Pe.MouseUp:i=i.replace("mouse","pointer");break;case Pe.TouchStart:case Pe.TouchEnd:return}a.push(Ie(i,l,t))})),nt((()=>{a.forEach((e=>e()))}))}function at({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){return Ie("scroll",nt(Se(nt((s=>{const i=ot(s);if(!i||Ee(i,r,o,!0))return;const a=n.getId(i);if(i===t&&t.defaultView){const n=ke(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 ct(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const lt=["INPUT","TEXTAREA","SELECT"],ut=new WeakMap;function dt(e){return function(e,t){if(ft("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ft("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ft("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ft("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 ht(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function pt({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=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");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}}),nt((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function gt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!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);const r=st(e,e.doc),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=Se(nt((t=>{const n=Date.now()-i;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],i=null})),s),l=nt(Se(nt((e=>{const t=ot(e),{clientX:n,clientY:o}=Oe(e)?e.changedTouches[0]:e;i||(i=we()),a.push({x:n,y:o,id:r.getId(t),timeOffset:we()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?Ze.Drag:e instanceof MouseEvent?Ze.MouseMove:Ze.TouchMove)})),o,{trailing:!1})),u=[Ie("mousemove",l,n),Ie("touchmove",l,n),Ie("drag",l,n)];return nt((()=>{u.forEach((e=>e()))}))}(e),s=it(e),i=at(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return Ie("resize",nt(Se(nt((()=>{const t=Me(),o=Te();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=ot(e);const l=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||lt.indexOf(d)<0||Ee(n,r,o,!0))return;if(n.classList.contains(s)||i&&n.matches(i))return;let p=n.value,g=!1;const f=J(n)||"";"radio"===f||"checkbox"===f?g=n.checked:(a[d.toLowerCase()]||a[f])&&(p=Y({element:n,maskInputOptions:a,tagName:d,type:f,value:p,maskInputFn:c})),h(n,nt(ct)({text:p,isChecked:g,userTriggered:l},u));const m=n.name;"radio"===f&&m&&g&&t.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach((e=>{e!==n&&h(e,nt(ct)({text:e.value,isChecked:!g,userTriggered:!1},u))}))}function h(t,r){const o=ut.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){ut.set(t,r);const o=n.getId(t);nt(e)(Object.assign(Object.assign({},r),{id:o}))}}const p=("last"===l.input?["change"]:["input","change"]).map((e=>Ie(e,nt(d),t))),g=t.defaultView;if(!g)return()=>{p.forEach((e=>e()))};const f=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),m=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...m.map((e=>be(e[0],e[1],{set(){nt(d)({target:this,isTrusted:!1})}},!1,g)))),nt((()=>{p.forEach((e=>e()))}))}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){const i=nt((s=>Se(nt((o=>{const i=ot(o);if(!i||Ee(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 nt((()=>{a.forEach((e=>e()))}))}(e),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:nt(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=ht(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:nt(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=ht(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:nt(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=ht(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:nt(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=ht(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:i}),r.apply(o,s)}))}));const c={};mt("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(mt("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),mt("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),mt("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:nt(((r,o,s)=>{const[i,a]=s,{id:c,styleId:l}=ht(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:i,index:[...dt(o),a||0]}]}),r.apply(o,s)}))}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:nt(((r,o,s)=>{const[i]=s,{id:a,styleId:c}=ht(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...dt(o),i]}]}),r.apply(o,s)}))})})),nt((()=>{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=pt(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:nt(((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}=ht(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:dt(i.parentRule)}),o.apply(i,a)}))});const i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:nt(((o,s,a)=>{var c;const[l]=a;if(n.has(l))return i.apply(s,[l]);const{id:u,styleId:d}=ht(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:dt(s.parentRule)}),o.apply(s,a)}))}),nt((()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i}))}(e,{win:n}),p=e.collectFonts?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=Ae(t.fonts,"add",(function(t){return function(n){return setTimeout(nt((()=>{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),nt((()=>{r.forEach((e=>e()))}))}(e):()=>{},g=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let i=!0;const a=nt((()=>{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;Ee(i,r,o,!0)||Ee(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),f=[];for(const t of e.plugins)f.push(t.observer(t.callback,n,t.options));return nt((()=>{rt.forEach((e=>e.reset())),r.disconnect(),o(),s(),i(),a(),c(),l(),u(),d(),h(),p(),g(),f.forEach((e=>e()))}))}function ft(e){return void 0!==window[e]}function mt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class vt{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 It{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new vt(ee),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new vt(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 _e.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:_e.IncrementalSnapshot,data:{source:Ze.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case _e.Meta:case _e.Load:case _e.DomContentLoaded:return!1;case _e.Plugin:return t;case _e.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case _e.IncrementalSnapshot:switch(t.data.source){case Ze.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 Ze.Drag:case Ze.TouchMove:case Ze.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Ze.ViewportResize:return!1;case Ze.MediaInteraction:case Ze.MouseInteraction:case Ze.Scroll:case Ze.CanvasMutation:case Ze.Input:return this.replaceIds(t.data,e,["id"]),t;case Ze.StyleSheetRule:case Ze.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Ze.Font:return t;case Ze.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Ze.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===Z.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class yt{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(!G(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=st(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(at(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(pt({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(Ae(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}}function Ct(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="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),At=0;At<St.length;At++)bt[St.charCodeAt(At)]=At;const wt=new Map;const kt=(e,t,n)=>{if(!e||!Et(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=wt.get(e);return n||(n=new Map,wt.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 Mt(e,t,n){if(e instanceof Array)return e.map((e=>Mt(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+=St[n[t]>>2],o+=St[(3&n[t])<<4|n[t+1]>>4],o+=St[(15&n[t+1])<<2|n[t+2]>>6],o+=St[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:[Mt(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:[Mt(e.data,t,n),e.width,e.height]}}if(Et(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:kt(e,t,n)}}return e}const Tt=(e,t,n)=>[...e].map((e=>Mt(e,t,n))),Et=(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 Rt(e,t,n,r){const o=[];try{const s=Ae(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...s){if(!Ee(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 Nt(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=Ae(e,s,(function(e){return function(...a){const c=e.apply(this,a);if(kt(c,i,this),"tagName"in this.canvas&&!Ee(this.canvas,r,o,!0)){const e=Tt([...a],i,this),r={type:t,property:s,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const o=be(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(o)}return a}function Ot(e,t,n){var r=void 0===t?null:t,o=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,s=n.length;o<s;++o)r[o]=n.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(e,void 0!==n&&n),s=o.indexOf("\n",10)+1,i=o.substring(s)+(r?"//# sourceMappingURL="+r:""),a=new Blob([i],{type:"application/javascript"});return URL.createObjectURL(a)}var Dt,xt,Lt,Ft,Ut=(Dt="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",xt=null,Lt=!1,function(e){return Ft=Ft||Ot(Dt,xt,Lt),new Worker(Ft,e)});class Wt{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=Rt(t,n,r,!0),i=new Map,a=new Ut;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:Ve["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=>{Ee(t,n,r,!0)||e.push(t)})),e})().forEach((e=>Ct(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=Rt(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=Ae(t.CanvasRenderingContext2D.prototype,i,(function(o){return function(...s){return Ee(this.canvas,n,r,!0)||setTimeout((()=>{const n=Tt([...s],t,this);e(this.canvas,{type:Ve["2D"],property:i,args:n})}),0),o.apply(this,s)}}));o.push(s)}catch(n){const r=be(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:Ve["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(...Nt(t.WebGLRenderingContext.prototype,Ve.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&s.push(...Nt(t.WebGL2RenderingContext.prototype,Ve.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 Bt{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Fe,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;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);r.push({styleId:e,rules:n.map(((e,t)=>({rule:K(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){}}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}}function Zt(e){return Object.assign(Object.assign({},e),{timestamp:we()})}let Pt,Gt,Vt,Kt=!1;const qt=new q;function Yt(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:g,maskTextFn:f,hooks:m,packFn:v,sampling:I={},dataURLOptions:y={},mousemoveWait:C,recordCanvas:S=!1,recordCrossOriginIframes:b=!1,recordAfter:A=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:w=!1,collectFonts:k=!1,inlineImages:M=!1,plugins:T,keepIframeSrcFn:E=(()=>!1),ignoreCSSAttributes:R=new Set([]),errorHandler:N}=e;et(N);const O=!b||window.parent===window;let D=!1;if(!O)try{window.parent.document&&(D=!1)}catch(e){D=!0}if(O&&!t)throw new Error("emit function is required");void 0!==C&&void 0===I.mousemove&&(I.mousemove=C),qt.reset();const x=!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},L=!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 F;!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 U=0;const W=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!D&&(e=v(e)),e};Pt=(e,o)=>{var s;if(!(null===(s=rt[0])||void 0===s?void 0:s.isFrozen())||e.type===_e.FullSnapshot||e.type===_e.IncrementalSnapshot&&e.data.source===Ze.Mutation||rt.forEach((e=>e.unfreeze())),O)null==t||t(W(e),o);else if(D){const t={type:"rrweb",event:W(e),origin:window.location.origin,isCheckout:o};window.parent.postMessage(t,"*")}if(e.type===_e.FullSnapshot)F=e,U=0;else if(e.type===_e.IncrementalSnapshot){if(e.data.source===Ze.Mutation&&e.data.isAttachIframe)return;U++;const t=r&&U>=r,o=n&&e.timestamp-F.timestamp>n;(t||o)&&Gt(!0)}};const B=e=>{Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Mutation},e)}))},_=e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Scroll},e)})),Z=e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.CanvasMutation},e)})),P=new Bt({mutationCb:B,adoptedStyleSheetCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.AdoptedStyleSheet},e)}))}),G=new It({mirror:qt,mutationCb:B,stylesheetManager:P,recordCrossOriginIframes:b,wrappedEmit:Pt});for(const e of T||[])e.getMirror&&e.getMirror({nodeMirror:qt,crossOriginIframeMirror:G.crossOriginIframeMirror,crossOriginIframeStyleMirror:G.crossOriginIframeStyleMirror});const V=new _t;Vt=new Wt({recordCanvas:S,mutationCb:Z,win:window,blockClass:o,blockSelector:s,mirror:qt,sampling:I.canvas,dataURLOptions:y});const K=new yt({mutationCb:B,scrollCb:_,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:x,dataURLOptions:y,maskTextFn:f,maskInputFn:g,recordCanvas:S,inlineImages:M,sampling:I,slimDOMOptions:L,iframeManager:G,stylesheetManager:P,canvasManager:Vt,keepIframeSrcFn:E,processedNodeManager:V},mirror:qt});Gt=(e=!1)=>{Pt(Zt({type:_e.Meta,data:{href:window.location.href,width:Te(),height:Me()}}),e),P.reset(),K.init(),rt.forEach((e=>e.lock()));const t=function(e,t){var n=t||{},r=n.mirror,o=void 0===r?new q: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,g=void 0===p||p,f=n.inlineImages,m=void 0!==f&&f,v=n.recordCanvas,I=void 0!==v&&v,y=n.maskAllInputs,C=void 0!==y&&y,S=n.maskTextFn,b=n.maskInputFn,A=n.slimDOM,w=void 0!==A&&A,k=n.dataURLOptions,M=n.preserveWhiteSpace,T=n.onSerialize,E=n.onIframeLoad,R=n.iframeLoadTimeout,N=n.onStylesheetLoad,O=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return ve(e,{doc:e,mirror:o,blockClass:i,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:!0===C?{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===C?{password:!0}:C,maskTextFn:S,maskInputFn:b,slimDOMOptions:!0===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===w,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===w?{}:w,dataURLOptions:k,inlineImages:m,recordCanvas:I,preserveWhiteSpace:M,onSerialize:T,onIframeLoad:E,iframeLoadTimeout:R,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:qt,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:x,maskTextFn:f,slimDOM:L,dataURLOptions:y,recordCanvas:S,inlineImages:M,onSerialize:e=>{De(e,qt)&&G.addIframe(e),xe(e,qt)&&P.trackLinkElement(e),Le(e)&&K.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{G.attachIframe(e,t),K.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{P.attachLinkElement(e,t)},keepIframeSrcFn:E});if(!t)return console.warn("Failed to snapshot the document");Pt(Zt({type:_e.FullSnapshot,data:{node:t,initialOffset:ke(window)}}),e),rt.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&P.adoptStyleSheets(document.adoptedStyleSheets,qt.getId(document))};try{const e=[],t=e=>{var t;return nt(gt)({mutationCb:B,mousemoveCb:(e,t)=>Pt(Zt({type:_e.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.MouseInteraction},e)})),scrollCb:_,viewportResizeCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.ViewportResize},e)})),inputCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Input},e)})),mediaInteractionCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.MediaInteraction},e)})),styleSheetRuleCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.StyleSheetRule},e)})),styleDeclarationCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.StyleDeclaration},e)})),canvasMutationCb:Z,fontCb:e=>Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Font},e)})),selectionCb:e=>{Pt(Zt({type:_e.IncrementalSnapshot,data:Object.assign({source:Ze.Selection},e)}))},blockClass:o,ignoreClass:i,ignoreSelector:a,maskTextClass:c,maskTextSelector:l,maskInputOptions:x,inlineStylesheet:u,sampling:I,recordCanvas:S,inlineImages:M,userTriggeredOnInput:w,collectFonts:k,doc:e,maskInputFn:g,maskTextFn:f,keepIframeSrcFn:E,blockSelector:s,slimDOMOptions:L,dataURLOptions:y,mirror:qt,iframeManager:G,stylesheetManager:P,shadowDomManager:K,processedNodeManager:V,canvasManager:Vt,ignoreCSSAttributes:R,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=>Pt(Zt({type:_e.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},m)};G.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{Gt(),e.push(t(document)),Kt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Ie("DOMContentLoaded",(()=>{Pt(Zt({type:_e.DomContentLoaded,data:{}})),"DOMContentLoaded"===A&&n()}))),e.push(Ie("load",(()=>{Pt(Zt({type:_e.Load,data:{}})),"load"===A&&n()}),window))),()=>{e.forEach((e=>e())),V.destroy(),Kt=!1,tt()}}catch(e){console.warn(e)}}var jt,zt;Yt.addCustomEvent=(e,t)=>{if(!Kt)throw new Error("please add custom event after start recording");Pt(Zt({type:_e.Custom,data:{tag:e,payload:t}}))},Yt.freezePage=()=>{rt.forEach((e=>e.freeze()))},Yt.takeFullSnapshot=e=>{if(!Kt)throw new Error("please take full snapshot after start recording");Gt(e)},Yt.mirror=qt,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"}(jt||(jt={})),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"}(zt||(zt={}));var Jt=Uint8Array,Qt=Uint16Array,Ht=Uint32Array,Xt=new Jt([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]),$t=new Jt([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]),en=new Jt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tn=function(e,t){for(var n=new Qt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new Ht(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]},nn=tn(Xt,2),rn=nn[0],on=nn[1];rn[28]=258,on[258]=28;for(var sn=tn($t,0)[1],an=new Qt(32768),cn=0;cn<32768;++cn){var ln=(43690&cn)>>>1|(21845&cn)<<1;ln=(61680&(ln=(52428&ln)>>>2|(13107&ln)<<2))>>>4|(3855&ln)<<4,an[cn]=((65280&ln)>>>8|(255&ln)<<8)>>>1}var un=function(e,t,n){for(var r=e.length,o=0,s=new Qt(t);o<r;++o)++s[e[o]-1];var i,a=new Qt(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;if(n){i=new Qt(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[an[d]>>>c]=l}else for(i=new Qt(r),o=0;o<r;++o)i[o]=an[a[e[o]-1]++]>>>15-e[o];return i},dn=new Jt(288);for(cn=0;cn<144;++cn)dn[cn]=8;for(cn=144;cn<256;++cn)dn[cn]=9;for(cn=256;cn<280;++cn)dn[cn]=7;for(cn=280;cn<288;++cn)dn[cn]=8;var hn=new Jt(32);for(cn=0;cn<32;++cn)hn[cn]=5;var pn=un(dn,9,0),gn=un(hn,5,0),fn=function(e){return(e/8>>0)+(7&e&&1)},mn=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Qt?Qt:e instanceof Ht?Ht:Jt)(n-t);return r.set(e.subarray(t,n)),r},vn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},In=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},yn=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 Jt(0),0];if(1==o){var i=new Jt(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 Qt(h+1),g=Cn(n[u-1],p,0);if(g>t){r=0;var f=0,m=g-t,v=1<<m;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<o;++r){var I=s[r].s;if(!(p[I]>t))break;f+=v-(1<<g-p[I]),p[I]=t}for(f>>>=m;f>0;){var y=s[r].s;p[y]<t?f-=1<<t-p[y]++-1:++r}for(;r>=0&&f;--r){var C=s[r].s;p[C]==t&&(--p[C],++f)}g=t}return[new Jt(p),g]},Cn=function(e,t,n){return-1==e.s?Math.max(Cn(e.l,t,n+1),Cn(e.r,t,n+1)):t[e.s]=n},Sn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Qt(++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]},bn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},An=function(e,t,n){var r=n.length,o=fn(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)},wn=function(e,t,n,r,o,s,i,a,c,l,u){vn(t,u++,n),++o[256];for(var d=yn(o,15),h=d[0],p=d[1],g=yn(s,15),f=g[0],m=g[1],v=Sn(h),I=v[0],y=v[1],C=Sn(f),S=C[0],b=C[1],A=new Qt(19),w=0;w<I.length;++w)A[31&I[w]]++;for(w=0;w<S.length;++w)A[31&S[w]]++;for(var k=yn(A,7),M=k[0],T=k[1],E=19;E>4&&!M[en[E-1]];--E);var R,N,O,D,x=l+5<<3,L=bn(o,dn)+bn(s,hn)+i,F=bn(o,h)+bn(s,f)+i+14+3*E+bn(A,M)+(2*A[16]+3*A[17]+7*A[18]);if(x<=L&&x<=F)return An(t,u,e.subarray(c,c+l));if(vn(t,u,1+(F<L)),u+=2,F<L){R=un(h,p,0),N=h,O=un(f,m,0),D=f;var U=un(M,T,0);vn(t,u,y-257),vn(t,u+5,b-1),vn(t,u+10,E-4),u+=14;for(w=0;w<E;++w)vn(t,u+3*w,M[en[w]]);u+=3*E;for(var W=[I,S],B=0;B<2;++B){var _=W[B];for(w=0;w<_.length;++w){var Z=31&_[w];vn(t,u,U[Z]),u+=M[Z],Z>15&&(vn(t,u,_[w]>>>5&127),u+=_[w]>>>12)}}}else R=pn,N=dn,O=gn,D=hn;for(w=0;w<a;++w)if(r[w]>255){Z=r[w]>>>18&31;In(t,u,R[Z+257]),u+=N[Z+257],Z>7&&(vn(t,u,r[w]>>>23&31),u+=Xt[Z]);var P=31&r[w];In(t,u,O[P]),u+=D[P],P>3&&(In(t,u,r[w]>>>5&8191),u+=$t[P])}else In(t,u,R[r[w]]),u+=N[r[w]];return In(t,u,R[256]),u+N[256]},kn=new Ht([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mn=new Jt(0),Tn=function(e,t,n,r,o){return function(e,t,n,r,o,s){var i=e.length,a=new Jt(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=An(c,l,e.subarray(u,d)):(c[u]=s,l=An(c,l,e.subarray(u,i)))}else{for(var h=kn[t-1],p=h>>>13,g=8191&h,f=(1<<n)-1,m=new Qt(32768),v=new Qt(f+1),I=Math.ceil(n/3),y=2*I,C=function(t){return(e[t]^e[t+1]<<I^e[t+2]<<y)&f},S=new Ht(25e3),b=new Qt(288),A=new Qt(32),w=0,k=0,M=(u=0,0),T=0,E=0;u<i;++u){var R=C(u),N=32767&u,O=v[R];if(m[N]=O,v[R]=N,T<=u){var D=i-u;if((w>7e3||M>24576)&&D>423){l=wn(e,c,0,S,b,A,k,M,E,u-E,l),M=w=k=0,E=u;for(var x=0;x<286;++x)b[x]=0;for(x=0;x<30;++x)A[x]=0}var L=2,F=0,U=g,W=N-O&32767;if(D>2&&R==C(u-W))for(var B=Math.min(p,D)-1,_=Math.min(32767,u),Z=Math.min(258,D);W<=_&&--U&&N!=O;){if(e[u+L]==e[u+L-W]){for(var P=0;P<Z&&e[u+P]==e[u+P-W];++P);if(P>L){if(L=P,F=W,P>B)break;var G=Math.min(W,P-2),V=0;for(x=0;x<G;++x){var K=u-W+x+32768&32767,q=K-m[K]+32768&32767;q>V&&(V=q,O=K)}}}W+=(N=O)-(O=m[N])+32768&32767}if(F){S[M++]=268435456|on[L]<<18|sn[F];var Y=31&on[L],j=31&sn[F];k+=Xt[Y]+$t[j],++b[257+Y],++A[j],T=u+L,++w}else S[M++]=e[u],++b[e[u]]}}l=wn(e,c,s,S,b,A,k,M,E,u-E,l),s||(l=An(c,l,Mn))}return mn(a,0,r+fn(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 En(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=Tn(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 Rn=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}(En(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new Jt(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 Jt(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 mn(r,0,o)}(JSON.stringify(t))),!0)};var Nn,On;(On=Nn||(Nn={}))[On.NotStarted=0]="NotStarted",On[On.Running=1]="Running",On[On.Stopped=2]="Stopped";var Dn,xn=function(e,t){var n;return(null===(n=t.classList)||void 0===n?void 0:n.contains("amp-unmask"))?e:"*".repeat(e.length)},Ln="Session replay event batch rejected due to exceeded retry count",Fn="Failed to store session replay events in IndexedDB";!function(e){e.RECORDING="recording",e.SENT="sent"}(Dn||(Dn={}));var Un=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.storageKey="",this.retryTimeout=1e3,this.events=[],this.currentSequenceId=0,this.scheduled=null,this.queue=[],this.stopRecordingEvents=null,this.maxPersistedEventsSize=1e6,this.interval=500,this.timeAtLastSend=null,this.getSessionRecordingProperties=function(){return e.loggerProvider.warn("Please use getSessionReplayProperties instead of getSessionRecordingProperties."),e.getSessionReplayProperties()},this.blurListener=function(){e.stopRecordingAndSendEvents()},this.focusListener=function(){e.initialize()},this.shouldSplitEventsList=function(t){var n=new Blob([t]).size;return new Blob(e.events).size+n>=e.maxPersistedEventsSize||!!(null!==e.timeAtLastSend&&Date.now()-e.timeAtLastSend>e.interval&&e.events.length)&&(e.interval=Math.min(1e4,e.interval+500),e.timeAtLastSend=Date.now(),!0)},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 L(e,t),this.loggerProvider=this.config.loggerProvider,this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.storageKey="".concat(O,"_").concat(this.config.apiKey.substring(0,10)),(n=E())&&(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){this.config?(this.stopRecordingAndSendEvents(this.config.sessionId),this.config.sessionId=e,this.events=[],this.currentSequenceId=0,this.recordEvents()):this.loggerProvider.error("Session replay init has not been called, cannot set session id.")},e.prototype.getSessionReplayProperties=function(){var e;return this.config?this.getShouldRecord()?((e={})[N]=!0,e):{}:(this.loggerProvider.error("Session replay init has not been called, cannot get session recording properties."),{})},e.prototype.stopRecordingAndSendEvents=function(e){var t;try{this.stopRecordingEvents&&this.stopRecordingEvents(),this.stopRecordingEvents=null}catch(e){var n=e;this.loggerProvider.warn("Error occurred while stopping recording: ".concat(n.toString()))}var r=e||(null===(t=this.config)||void 0===t?void 0:t.sessionId);this.events.length&&r&&this.sendEventsList({events:this.events,sequenceId:this.currentSequenceId,sessionId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var n,r,o,s;return c(this,(function(i){switch(i.label){case 0:return this.timeAtLastSend=Date.now(),(null===(t=this.config)||void 0===t?void 0:t.sessionId)?[4,this.getAllSessionEventsFromStore()]:(this.loggerProvider.warn("Session is not being recorded due to lack of session id."),[2]);case 1:return n=i.sent(),this.stopRecordingEvents?[2]:(r=n&&n[this.config.sessionId],n&&r&&r.sessionSequences&&(o=r.currentSequenceId,(s=r.sessionSequences[o])&&s.status!==Dn.RECORDING?(this.currentSequenceId=o+1,this.events=[]):(this.currentSequenceId=o,this.events=(null==s?void 0:s.events)||[])),e&&n&&this.sendStoredEvents(n),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(){if(!this.config)return this.loggerProvider.error("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;var e,t,n,r=E();if(r&&r.document&&!r.document.hasFocus())return this.config.sessionId&&this.loggerProvider.log("Session ".concat(this.config.sessionId," temporarily not recording due to lack of browser focus.")),!1;if(this.shouldOptOut())return this.config.sessionId&&this.loggerProvider.log("Opting session ".concat(this.config.sessionId," out of recording due to optOut config.")),!1;if(!this.config.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of session id."),!1;if(this.config.sampleRate){var o=(e=this.config.sessionId,t=this.config.sampleRate,n=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}(e.toString()),31*Math.abs(n)%100/100<t);return o||this.loggerProvider.log("Opting session ".concat(this.config.sessionId," out of recording due to sample rate.")),o}return!0},e.prototype.sendStoredEvents=function(e){var t;for(var n in e){var r=e[n].sessionSequences;for(var o in r){var s=r[o],i=parseInt(o,10),a=parseInt(n,10);a===(null===(t=this.config)||void 0===t?void 0:t.sessionId)&&i===this.currentSequenceId||s.events.length&&s.status===Dn.RECORDING&&this.sendEventsList({events:s.events,sequenceId:i,sessionId:a})}}},e.prototype.recordEvents=function(){var e,t=this,n=this.getShouldRecord(),r=null===(e=this.config)||void 0===e?void 0:e.sessionId;n&&r&&(this.stopRecordingEvents=Yt({emit:function(e){var n=E();if(n&&n.document&&!n.document.hasFocus()||!t.getShouldRecord())t.stopRecordingAndSendEvents();else{var o=JSON.stringify(e);t.shouldSplitEventsList(o)&&(t.sendEventsList({events:t.events,sequenceId:t.currentSequenceId,sessionId:r}),t.events=[],t.currentSequenceId++),t.events.push(o),t.storeEventsForSession(t.events,t.currentSequenceId,r)}},packFn:Rn,maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",maskInputFn:xn,recordCanvas:!1,errorHandler:function(e){var n=e;return t.loggerProvider.warn("Error while recording: ",n.toString()),!0}}))},e.prototype.sendEventsList=function(e){var t=e.events,n=e.sequenceId,r=e.sessionId;this.addToQueue({events:t,sequenceId:n,attempts:0,timeout:0,sessionId:r})},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){var n;return t.attempts<((null===(n=e.config)||void 0===n?void 0:n.flushMaxRetries)||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"".concat(Ln,", 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.getSampleRate=function(){var e;return(null===(e=this.config)||void 0===e?void 0:e.sampleRate)||0},e.prototype.getServerUrl=function(){var e;return(null===(e=this.config)||void 0===e?void 0:e.serverZone)===o.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track"},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.config)||void 0===t?void 0:t.deviceId)},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),a(this,void 0,void 0,(function(){var r,o,s,i,a,l,u,d,h,p,g,f;return c(this,(function(c){switch(c.label){case 0:if(!(r=null===(n=this.config)||void 0===n?void 0:n.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(o=this.getDeviceId()))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];m=E(),s=(null==m?void 0:m.location)?m.location.href:"",i="0.2.5",a=this.getSampleRate(),l=new URLSearchParams({device_id:o,session_id:"".concat(e.sessionId),seq_number:"".concat(e.sequenceId)}),u={version:1,events:e.events},c.label=1;case 1:return c.trys.push([1,3,,4]),d={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(r),"X-Client-Version":i,"X-Client-Url":s,"X-Client-Sample-Rate":"".concat(a)},body:JSON.stringify(u),method:"POST"},h="".concat(this.getServerUrl(),"?").concat(l.toString()),[4,fetch(h,d)];case 2:if(null===(p=c.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(p.status,e);else{g="";try{g=JSON.stringify(p.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(p.status,": ").concat(g)})}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 I).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.getAllSessionEventsFromStore=function(){return a(this,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,B(this.storageKey)];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.loggerProvider.warn("".concat(Fn,": ").concat(e)),[3,3];case 3:return[2,void 0]}}))}))},e.prototype.storeEventsForSession=function(e,t,n){return a(this,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,_(this.storageKey,(function(r){var o,s;void 0===r&&(r={});var a=r[n]||i({},D);a.currentSequenceId=t;var c=a.sessionSequences&&a.sessionSequences[t]||{};return c.events=e,c.status=Dn.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(Fn,": ").concat(r)),[3,3];case 3:return[2]}}))}))},e.prototype.cleanUpSessionEventsStore=function(e,t){return a(this,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,_(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=Dn.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===Dn.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(Fn,": ").concat(n)),[3,3];case 3:return[2]}}))}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.sessionId&&this.cleanUpSessionEventsStore(t.sessionId,t.sequenceId),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e.prototype.shutdown=function(){var e=E();e&&(e.removeEventListener("blur",this.blurListener),e.removeEventListener("focus",this.focusListener)),this.stopRecordingAndSendEvents()},e}(),Wn=function(e){return function(){var t=e.config||x();return{logger:t.loggerProvider,logLevel:t.logLevel}}},Bn=function(){var e=new Un;return{init:v(e.init.bind(e),"init",Wn(e)),setSessionId:v(e.setSessionId.bind(e),"setSessionId",Wn(e)),getSessionRecordingProperties:v(e.getSessionRecordingProperties.bind(e),"getSessionRecordingProperties",Wn(e)),getSessionReplayProperties:v(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Wn(e)),shutdown:v(e.shutdown.bind(e),"teardown",Wn(e))}}(),_n=Bn.init,Zn=Bn.setSessionId;Bn.getSessionRecordingProperties;var Pn=Bn.getSessionReplayProperties,Gn=Bn.shutdown,Vn=function(){function e(e){this.name="@amplitude/plugin-session-replay-browser",this.type="enrichment",this.options=i({},e)}return e.prototype.setup=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return e.loggerProvider.log("Installing @amplitude/plugin-session-replay."),this.config=e,"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,_n(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}).promise];case 1:return t.sent(),[2]}}))}))},e.prototype.execute=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){return"session_start"===e.event_type&&e.session_id&&Zn(e.session_id),t=Pn(),e.event_properties=i(i({},e.event_properties),t),[2,Promise.resolve(e)]}))}))},e.prototype.teardown=function(){return a(this,void 0,void 0,(function(){return c(this,(function(e){return Gn(),[2]}))}))},e}(),Kn=function(e){return new Vn(e)};e.plugin=Kn,e.sessionReplayPlugin=Kn,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": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
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": "^0.
|
|
43
|
+
"@amplitude/session-replay-browser": "^0.3.0",
|
|
44
44
|
"idb-keyval": "^6.2.1",
|
|
45
45
|
"rrweb": "^2.0.0-alpha.11",
|
|
46
46
|
"tslib": "^2.4.1"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"files": [
|
|
58
58
|
"lib"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "1a2d6a46bc6600036684fabf262292c04ba7f64b"
|
|
61
61
|
}
|