posthog-js 1.407.4 → 1.407.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,r=null==e?void 0:e.document,i=null==e?void 0:e.location;null!=e&&e.XMLHttpRequest&&new e.XMLHttpRequest;var n="undefined"!=typeof globalThis?globalThis:t;n&&"undefined"==typeof self&&(n.self=n),n&&"undefined"==typeof File&&(n.File=function(){});var s=null!=t?t:{};function a(t,e,r,i,n,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(i,n)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(t){a(s,i,n,o,u,"next",t)}function u(t){a(s,i,n,o,u,"throw",t)}o(void 0)}))}}function u(){return u=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},u.apply(null,arguments)}var l,h={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},d={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},c="NativeGzipValidationError",v=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=c,e},f=function(){var t=o((function*(t,e){18>t.size&&v("too-short");var r,i=new Uint8Array(yield t.slice(0,10).arrayBuffer());(2>(r=i).length||31!==r[0]||139!==r[1]||8!==i[2])&&v("invalid-header");var n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(l)return l;l=[];for(var t=0;256>t;t++){for(var e=t,r=0;8>r;r++)e=1&e?3988292384^e>>>1:e>>>1;l[t]=e>>>0}return l})(),r=4294967295,i=0;t.length>i;i++)r=e[255&(r^t[i])]^r>>>8;return(4294967295^r)>>>0})(e)&&v("invalid-crc");var s=e.length>>>0;n.getUint32(4,!0)!==s&&v("invalid-size")}));return function(e,r){return t.apply(this,arguments)}}();function p(){return p=o((function*(t,e,r){void 0===e&&(e=!0);try{var i=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),s=n.writable.getWriter(),a=s.write(i).then((()=>s.close())).catch(function(){var t=o((function*(t){try{yield s.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),u=new Response(n.readable).blob(),l=(yield Promise.all([u,a]))[0];return yield f(l,i),l}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),p.apply(this,arguments)}var m=Object.prototype,g=m.hasOwnProperty,y=m.toString,w=Array.isArray||function(t){return"[object Array]"===y.call(t)},b=t=>"function"==typeof t,k=t=>t===Object(t)&&!w(t),_=t=>void 0===t,S=t=>"[object String]"==y.call(t),I=t=>null===t,M=t=>_(t)||I(t),C=t=>"[object Number]"==y.call(t)&&t==t,x=t=>"[object Boolean]"===y.call(t),R=t=>t instanceof FormData;function T(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),C(t)?t>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),T(n||r,e,r,i))}class O{constructor(t){this.$e={},this.ze=t.ze,this.Ze=T(t.bucketSize,0,100,t.Ge),this.Qe=T(t.refillRate,0,this.Ze,t.Ge),this.Je=T(t.refillInterval,0,864e5,t.Ge)}Ke(t,e){var r=Math.floor((e-t.lastAccess)/this.Je);r>0&&(t.tokens=Math.min(t.tokens+r*this.Qe,this.Ze),t.lastAccess=t.lastAccess+r*this.Je)}consumeRateLimit(t){var e,r=Date.now(),i=String(t),n=this.$e[i];return n?this.Ke(n,r):this.$e[i]=n={tokens:this.Ze,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(e=this.ze)||e.call(this,t)),0===n.tokens)}stop(){this.$e={}}}function A(t){return t?t.split("#")[0]:t}var E={DEBUG:!1,LIB_VERSION:"0.2.3",LIB_NAME:"browser-common"},N=function(e,r){var i=(void 0===r?{}:r).debugEnabled,n={k(r){if(t&&(E.DEBUG||t.POSTHOG_DEBUG||i)&&!_(t.console)&&t.console){for(var n=("__rrweb_original__"in t.console[r]?t.console[r].__rrweb_original__:t.console[r]),s=arguments.length,a=new Array(s>1?s-1:0),o=1;s>o;o++)a[o-1]=arguments[o];n(e,...a)}},debug(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("error",...e)},critical(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(t){n.error("You must initialize PostHog before calling "+t)},createLogger:(t,r)=>N(e+" "+t,r)};return n},L=N("[PostHog.js]"),F=L.createLogger;function D(t,e){if(!M(t))if(w(t))t.forEach(e);else if(R(t))t.forEach(((t,r)=>e(t,r)));else for(var r in t)g.call(t,r)&&e(t[r],r)}function P(t,e,r,i){var n={},s=n.capture,a=n.passive;null==t||t.addEventListener(e,r,{capture:void 0!==s&&s,passive:void 0===a||a})}var W=["localhost","127.0.0.1"],B=t=>{var e=null==r?void 0:r.createElement("a");return _(e)?null:(e.href=t,e)},U=function(t,e){var r,i;void 0===e&&(e="&");var n=[];return D(t,(function(t,e){_(t)||_(e)||"undefined"===e||(r=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),i=encodeURIComponent(e),n[n.length]=i+"="+r)})),n.join(e)};function z(e){var r,i=null==t||null==(r=t.location)?void 0:r.href;return _(i)?void 0:function(t,e){var r,i=null==t||null==(r=t.config)?void 0:r.get_current_url;if(!b(i))return e;try{var n=i(e);return S(n)&&n?n:e}catch(t){return L.error("Error in get_current_url, falling back to window.location.href",t),e}}(e,i)}var j=new RegExp("(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})"),q=new RegExp("(\\d{3}-?\\d{2}-?\\d{4})"),H="[SessionRecording]",G="redacted",V=1e6;function Z(t){var e;return Math.min(V,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:V)}var J={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:V,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},Q=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],X=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Y=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],K=t=>{M(t)||D(Object.keys(t),(e=>{(t=>{var e=t.toLowerCase();return Q.includes(e)||Y.some((t=>e.includes(t)))})(e)&&(t[e]=G)}))},tt=["/s/","/e/","/i/"];function et(t,e,r,i){if(M(t))return t;var n=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return S(n)&&(n=parseInt(n)),n>r?H+" "+i+" body too large to record ("+n+" bytes)":t}function rt(t,e){if(M(t))return t;var r=t;return function(t,e){if(M(t))return!1;if(S(t)){if(t=t.trim(),j.test((t||"").replace(/[- ]/g,"")))return!1;if(q.test(t))return!1}return!0}(r)||(r=H+" "+e+" body "+G),D(X,(t=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(t))&&(r=H+" "+e+" body "+G+" as might contain: "+t)})),r}var it="$session_recording_remote_config",nt="$replay_sample_rate",st="$replay_override_sampling",at="$replay_override_linked_flag",ot="$replay_override_url_trigger",ut="$replay_override_event_trigger",lt="$session_is_sampled",ht="$session_past_minimum_duration",dt="$session_recording_url_trigger_activated_session",ct="$session_recording_event_trigger_activated_session",vt="$posthog_sr_group_event_trigger_",ft="$posthog_sr_group_url_trigger_",pt="$posthog_sr_group_sampling_",mt="$debug_first_full_snapshot_timestamp",gt="$sess_rec_flush_size",yt="$stored_person_properties",wt="$sdk_debug_replay_remote_trigger_matching_config",bt="disabled",kt="sampled",_t="active",St="buffering",It="paused",Mt="rrweb_error",Ct="trigger",xt=Ct+"_activated",Rt=Ct+"_pending",Tt=Ct+"_"+bt;function Ot(t,e,r,i,n,s){return 0===e?Tt:(null==t?void 0:t.get_property(r?i+r:n))===s?xt:Rt}function At(t,e,r){return e.some((e=>{var i;return"regex"===e.matching&&(null!==(i=null==r?void 0:r.get(e.url))&&void 0!==i?i:new RegExp(e.url)).test(t)}))}class Et{constructor(t){this.u=t}triggerStatus(t){var e=this.u.map((e=>e.triggerStatus(t)));return e.includes(xt)?xt:e.includes(Rt)?Rt:Tt}stop(){this.u.forEach((t=>t.stop()))}}class Nt{constructor(t){this.u=t}triggerStatus(t){var e=new Set;for(var r of this.u)e.add(r.triggerStatus(t));switch(e.delete(Tt),e.size){case 0:return Tt;case 1:return Array.from(e)[0];default:return Rt}}stop(){this.u.forEach((t=>t.stop()))}}class Lt{triggerStatus(){return xt}stop(){}}var Ft=t=>"sessionRecording"in t;class Dt{constructor(t,e){this.Gu=[],this.Vu=[],this.Zu=new Map,this.Ju=new Map,this.Qu="",this.urlBlocked=!1,this._instance=t,this.Xu=e}onConfig(t){var e,r;this.Gu=(Ft(t)?k(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.Vu=(Ft(t)?k(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Yu()}Yu(){for(var t of(this.Zu.clear(),this.Ju.clear(),this.Gu))if("regex"===t.matching&&!this.Zu.has(t.url))try{this.Zu.set(t.url,new RegExp(t.url))}catch(e){L.error("Invalid URL trigger regex pattern:",t.url,e)}for(var e of this.Vu)if("regex"===e.matching&&!this.Ju.has(e.url))try{this.Ju.set(e.url,new RegExp(e.url))}catch(t){L.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(t){this.onConfig(t)}Ku(t){return Ot(this._instance,this.Gu.length,this.Xu,ft,dt,t)}triggerStatus(t){var e=this.Ku(t),r=e===xt?xt:e===Rt?Rt:Tt;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(t,e){var r=z(this._instance);if(r&&r!==this.Qu){this.Qu=r;var i=this.urlBlocked,n=At(r,this.Vu,this.Ju);i&&n||(n&&!i?t():!n&&i&&e())}}checkUrlTriggerConditions(t,e,r,i){var n=z(this._instance);if(n&&n!==this.Qu){this.Qu=n;var s=this.urlBlocked,a=At(n,this.Vu,this.Ju);a&&!s?t():!a&&s&&e();var o=this.Ku(i)===xt,u=At(n,this.Gu,this.Zu);!o&&u&&r("url",n)}}stop(){this.Qu=""}}class Pt{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.th=()=>{},this._instance=t}triggerStatus(){var t=Rt;return M(this.linkedFlag)&&(t=Tt),this.linkedFlagSeen&&(t=xt),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,e){var r;if(this.linkedFlag=(Ft(t)?k(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!M(this.linkedFlag)&&!this.linkedFlagSeen){var i=S(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=S(this.linkedFlag)?null:this.linkedFlag.variant;this.th=this._instance.onFeatureFlags(((t,r)=>{var s=!1;if(k(r)&&i in r){var a=r[i];s=x(a)?!0===a:n?a===n:!!a}var o=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,o&&e(i,n)}))}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.th()}}class Wt{constructor(t,e){this.eh=[],this._instance=t,this.Xu=e}onConfig(t){var e;this.eh=(Ft(t)?k(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}rh(t){return Ot(this._instance,this.eh.length,this.Xu,vt,ct,t)}triggerStatus(t){var e=this.rh(t),r=e===xt?xt:e===Rt?Rt:Tt;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(t,e,r){if(0!==this.eh.length){var i=this.rh(r)===xt,n=this.eh.includes(t);!i&&n&&e("event",t)}}stop(){}}class Bt{constructor(t,e,r){if(this._instance=t,this.group=e,this.ih=new Dt(t,e.id),this.nh=new Wt(t,e.id),this.sh=new Pt(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){var i=(e.conditions.events||[]).map((t=>t.name)),n={urlTriggers:e.conditions.urls||[],eventTriggers:i,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.ih.onConfig(n),this.nh.onConfig(n),this.sh.onConfig(n,r);var s=[this.nh,this.ih,this.sh];this.ah="any"===e.conditions.matchType?new Et(s):new Nt(s)}else this.ah=new Lt}triggerStatus(t){return this.ah.triggerStatus(t)}checkEventTriggerConditions(t,e,r){this.nh.checkEventTriggerConditions(t,e,r)}checkUrlTriggerConditions(t,e,r,i){this.ih.checkUrlTriggerConditions(t,e,r,i)}activateTrigger(t,e){var r;null==(r=this._instance.persistence)||r.register({["url"===t?ft+this.group.id:vt+this.group.id]:e})}stop(){this.ih.stop(),this.nh.stop(),this.sh.stop()}}function $t(t){if(t.rrwebError)return Mt;if(!t.receivedFlags)return St;if(!t.isRecordingEnabled)return bt;if(t.urlTriggerMatching.urlBlocked)return It;var e=!0===t.isSampled,r=new Et([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?kt:r===xt?_t:r===Rt?St:!1===t.isSampled?bt:_t}function Ut(t){if(t.rrwebError)return Mt;if(!t.receivedFlags)return St;if(!t.isRecordingEnabled)return bt;if(t.urlTriggerMatching.urlBlocked)return It;var e=new Nt([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),r=e!==Tt,i=x(t.isSampled);return r&&e===Rt?St:r&&e===Tt||i&&!t.isSampled?bt:!0===t.isSampled?kt:_t}function zt(){var t=[];return function(e,r){if(k(r)||w(r)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?"[Circular]":(t.push(r),r)}return r}}function jt(t){var e=JSON.stringify(t,zt());return e?new Blob([e]).size:0}function qt(t){if(I(t))return 4;if(_(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":if(w(t)){for(var e=2,r=0;t.length>r;r++){r>0&&(e+=1);var i=t[r];e+=_(i)||I(i)?4:qt(i)}return e}var n=t,s=2,a=!0;for(var o in n)if({}.hasOwnProperty.call(n,o)){var u=n[o];_(u)||(a||(s+=1),a=!1,s+=o.length+3+qt(u))}return s;default:return 0}}function Ht(t,e){if(void 0===e&&(e=6606028.8),t.size>=e&&t.data.length>1){var r=Math.floor(t.data.length/2),i=t.sizes.slice(0,r),n=t.sizes.slice(r);return[Ht({size:i.reduce(((t,e)=>t+e),0),data:t.data.slice(0,r),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Ht({size:n.reduce(((t,e)=>t+e),0),data:t.data.slice(r),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var Gt=Uint8Array,Vt=Uint16Array,Zt=Uint32Array,Jt=new Gt([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 Gt([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]),Xt=new Gt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yt=function(t,e){for(var r=new Vt(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new Zt(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},Kt=Yt(Jt,2),te=Kt[1];Kt[0][28]=258,te[258]=28;for(var ee=Yt(Qt,0)[1],re=new Vt(32768),ie=0;32768>ie;++ie){var ne=(43690&ie)>>>1|(21845&ie)<<1;re[ie]=((65280&(ne=(61680&(ne=(52428&ne)>>>2|(13107&ne)<<2))>>>4|(3855&ne)<<4))>>>8|(255&ne)<<8)>>>1}var se=function(t,e,r){for(var i=t.length,n=0,s=new Vt(e);i>n;++n)++s[t[n]-1];var a,o=new Vt(e);for(n=0;e>n;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new Vt(1<<e);var u=15-e;for(n=0;i>n;++n)if(t[n])for(var l=n<<4|t[n],h=e-t[n],d=o[t[n]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)a[re[d]>>>u]=l}else for(a=new Vt(i),n=0;i>n;++n)a[n]=re[o[t[n]-1]++]>>>15-t[n];return a},ae=new Gt(288);for(ie=0;144>ie;++ie)ae[ie]=8;for(ie=144;256>ie;++ie)ae[ie]=9;for(ie=256;280>ie;++ie)ae[ie]=7;for(ie=280;288>ie;++ie)ae[ie]=8;var oe=new Gt(32);for(ie=0;32>ie;++ie)oe[ie]=5;var ue=se(ae,9,0),le=se(oe,5,0),he=function(t){return(t/8>>0)+(7&t&&1)},de=function(t,e,r){(null==r||r>t.length)&&(r=t.length);var i=new(t instanceof Vt?Vt:t instanceof Zt?Zt:Gt)(r-e);return i.set(t.subarray(e,r)),i},ce=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},ve=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},fe=function(t,e){for(var r=[],i=0;t.length>i;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new Gt(0),0];if(1==n){var a=new Gt(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort((function(t,e){return t.f-e.f})),r.push({s:-1,f:25001});var o=r[0],u=r[1],l=0,h=1,d=2;for(r[0]={s:-1,f:o.f+u.f,l:o,r:u};h!=n-1;)o=r[r[d].f>r[l].f?l++:d++],u=r[l!=h&&r[d].f>r[l].f?l++:d++],r[h++]={s:-1,f:o.f+u.f,l:o,r:u};var c=s[0].s;for(i=1;n>i;++i)s[i].s>c&&(c=s[i].s);var v=new Vt(c+1),f=pe(r[h-1],v,0);if(f>e){i=0;var p=0,m=f-e,g=1<<m;for(s.sort((function(t,e){return v[e.s]-v[t.s]||t.f-e.f}));n>i;++i){var y=s[i].s;if(e>=v[y])break;p+=g-(1<<f-v[y]),v[y]=e}for(p>>>=m;p>0;){var w=s[i].s;e>v[w]?p-=1<<e-v[w]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;v[b]==e&&(--v[b],++p)}f=e}return[new Gt(v),f]},pe=function(t,e,r){return-1==t.s?Math.max(pe(t.l,e,r+1),pe(t.r,e,r+1)):e[t.s]=r},me=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new Vt(++e),i=0,n=t[0],s=1,a=function(t){r[i++]=t},o=1;e>=o;++o)if(t[o]==n&&o!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(n),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(n);s=1,n=t[o]}return[r.subarray(0,i),e]},ge=function(t,e){for(var r=0,i=0;e.length>i;++i)r+=t[i]*e[i];return r},ye=function(t,e,r){var i=r.length,n=he(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;i>s;++s)t[n+s+4]=r[s];return 8*(n+4+i)},we=function(t,e,r,i,n,s,a,o,u,l,h){ce(e,h++,r),++n[256];for(var d=fe(n,15),c=d[0],v=d[1],f=fe(s,15),p=f[0],m=f[1],g=me(c),y=g[0],w=g[1],b=me(p),k=b[0],_=b[1],S=new Vt(19),I=0;y.length>I;++I)S[31&y[I]]++;for(I=0;k.length>I;++I)S[31&k[I]]++;for(var M=fe(S,7),C=M[0],x=M[1],R=19;R>4&&!C[Xt[R-1]];--R);var T,O,A,E,N=l+5<<3,L=ge(n,ae)+ge(s,oe)+a,F=ge(n,c)+ge(s,p)+a+14+3*R+ge(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(L>=N&&F>=N)return ye(e,h,t.subarray(u,u+l));if(ce(e,h,1+(L>F)),h+=2,L>F){T=se(c,v,0),O=c,A=se(p,m,0),E=p;var D=se(C,x,0);for(ce(e,h,w-257),ce(e,h+5,_-1),ce(e,h+10,R-4),h+=14,I=0;R>I;++I)ce(e,h+3*I,C[Xt[I]]);h+=3*R;for(var P=[y,k],W=0;2>W;++W){var B=P[W];for(I=0;B.length>I;++I)ce(e,h,D[U=31&B[I]]),h+=C[U],U>15&&(ce(e,h,B[I]>>>5&127),h+=B[I]>>>12)}}else T=ue,O=ae,A=le,E=oe;for(I=0;o>I;++I)if(i[I]>255){var U;ve(e,h,T[257+(U=i[I]>>>18&31)]),h+=O[U+257],U>7&&(ce(e,h,i[I]>>>23&31),h+=Jt[U]);var z=31&i[I];ve(e,h,A[z]),h+=E[z],z>3&&(ve(e,h,i[I]>>>5&8191),h+=Qt[z])}else ve(e,h,T[i[I]]),h+=O[i[I]];return ve(e,h,T[256]),h+O[256]},be=new Zt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ke=function(){for(var t=new Zt(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),_e=function(){var t=4294967295;return{p(e){for(var r=t,i=0;e.length>i;++i)r=ke[255&r^e[i]]^r>>>8;t=r},d:()=>4294967295^t}},Se=function(t,e,r,i,n){return function(t,e,r,i,n,s){var a=t.length,o=new Gt(i+a+5*(1+Math.floor(a/7e3))+n),u=o.subarray(i,o.length-n),l=0;if(!e||8>a)for(var h=0;a>=h;h+=65535){var d=h+65535;a>d?l=ye(u,l,t.subarray(h,d)):(u[h]=true,l=ye(u,l,t.subarray(h,a)))}else{for(var c=be[e-1],v=c>>>13,f=8191&c,p=(1<<r)-1,m=new Vt(32768),g=new Vt(p+1),y=Math.ceil(r/3),w=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<w)&p},k=new Zt(25e3),_=new Vt(288),S=new Vt(32),I=0,M=0,C=(h=0,0),x=0,R=0;a>h;++h){var T=b(h),O=32767&h,A=g[T];if(m[O]=A,g[T]=O,h>=x){var E=a-h;if((I>7e3||C>24576)&&E>423){l=we(t,u,0,k,_,S,M,C,R,h-R,l),C=I=M=0,R=h;for(var N=0;286>N;++N)_[N]=0;for(N=0;30>N;++N)S[N]=0}var L=2,F=0,D=f,P=O-A&32767;if(E>2&&T==b(h-P))for(var W=Math.min(v,E)-1,B=Math.min(32767,h),U=Math.min(258,E);B>=P&&--D&&O!=A;){if(t[h+L]==t[h+L-P]){for(var z=0;U>z&&t[h+z]==t[h+z-P];++z);if(z>L){if(L=z,F=P,z>W)break;var j=Math.min(P,z-2),q=0;for(N=0;j>N;++N){var H=h-P+N+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,A=H)}}}P+=(O=A)-(A=m[O])+32768&32767}if(F){k[C++]=268435456|te[L]<<18|ee[F];var V=31&te[L],Z=31&ee[F];M+=Jt[V]+Qt[Z],++_[257+V],++S[Z],x=h+L,++I}else k[C++]=t[h],++_[t[h]]}}l=we(t,u,true,k,_,S,M,C,R,h-R,l)}return de(o,0,i+he(l)+n)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,r,i)},Ie=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Me=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Ie(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var i=0;r.length>=i;++i)t[i+10]=r.charCodeAt(i)}},Ce=function(t){return 10+(t.filename&&t.filename.length+1||0)};function xe(t,e){for(var r="",i=0;t.length>i;){var n=t[i++];r+=String.fromCharCode(n)}return r}class Re{constructor(t,e){var r,i;void 0===e&&(e={}),this.oh={},this.uh=t=>{if(!this.oh[t]){var e,r;this.oh[t]=!0;var i=this.lh(t);null==(e=(r=this.hh).onBlockedNode)||e.call(r,t,i)}},this.dh=t=>{var e=this.lh(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){var r=e.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[t,e]},this.lh=t=>this._rrweb.mirror.getNode(t),this.fh=t=>{var e,r,i,n,s,a,o,u;return(null!==(e=null==(r=t.removes)?void 0:r.length)&&void 0!==e?e:0)+(null!==(i=null==(n=t.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(a=t.texts)?void 0:a.length)&&void 0!==s?s:0)+(null!==(o=null==(u=t.adds)?void 0:u.length)&&void 0!==o?o:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var e=t.data,r=this.fh(e);e.attributes&&(e.attributes=e.attributes.filter((t=>{var e=this.dh(t.id);return!this.Xo.consumeRateLimit(e[0])&&t})));var i=this.fh(e);return 0!==i||r===i?t:void 0},this._rrweb=t,this.hh=e,this.Xo=new O({bucketSize:null!==(r=this.hh.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this.hh.refillRate)&&void 0!==i?i:10,refillInterval:1e3,ze:this.uh,Ge:L})}reset(){this.oh={}}stop(){this.Xo.stop(),this.reset()}}E.DEBUG=!1,E.LIB_VERSION="1.407.4",E.LIB_NAME="web";class Te{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.ph=t.get_property.bind(t),this.mh=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.mh(gt,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){var e,r=this.ph(gt);return k(e=r)&&S(e.sessionId)&&C(e.size)&&r.sessionId===t?r.size:0}}function Oe(t,e){return function(t){for(var e=0,r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)}(t)%100<T(100*e,0,100,L)}var Ae=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},Ee={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Ae(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Ae(e,t))))),icontains:(t,e)=>e.map(Ne).some((e=>t.map(Ne).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Ne).every((e=>t.map(Ne).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r<parseFloat(t)))}))},Ne=t=>t.toLowerCase(),Le=new Set(["is_not","not_icontains","not_regex"]);function Fe(t,e,r){return!t||0===t.length||t.every((t=>{var i="person"===t.type?r:e,n=null==i?void 0:i[t.key],s=t.operator||"exact";if(_(n)||I(n))return Le.has(s);var a=Ee[s];return!!a&&!_(t.value)&&!I(t.value)&&a(w(t.value)?t.value.map(String):[String(t.value)],w(n)?n.map(String):[String(n)])}))}var De=F("[SessionRecording]");function Pe(t,e){return e?t:"!"+t}function We(t,e){return t===e||t!=="!"+e&&null}class Be{constructor(t,e,r,i,n,s,a){this.gh=null,this.yh=Ut,this._instance=t,this.ih=e,this.nh=r,this.sh=i,this.wh=n,this.bh=s,this.kh=a}onRemoteConfig(t){this.gh=C(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this._h=new Et([this.nh,this.ih]),this.yh=$t):(this._h=new Nt([this.nh,this.ih]),this.yh=Ut),this._instance.register_for_session({[wt]:t.triggerMatchType}),this.ih.onConfig(t),this.nh.onConfig(t),this.sh.onConfig(t,((t,e)=>{this.wh("linked_flag_matched",{flag:t,variant:e}),this.kh()}))}getStatus(t){return this.yh({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){var e=this._instance.get_property("$session_recording_remote_config"),r=null==e?void 0:e.minimumDurationMilliseconds;return C(r)?r:null}checkUrlTriggers(t,e,r,i){this.ih.checkUrlTriggerConditions(e,r,i,t)}setupEventTriggerListeners(t,e,r){if(0!==this.nh.eh.length&&M(this.Sh))return this.Sh=t((t=>{try{this.nh.checkEventTriggerConditions(t.event,r,e)}catch(t){De.error("Could not activate event trigger",t)}})),this.Sh}makeSamplingDecisions(t){var e,r,i,n=this.gh;if(!C(n))return null==(r=this._instance.persistence)||r.unregister(lt),void(null==(i=this._instance.persistence)||i.unregister(nt));var s=this._instance.get_property(lt),a=this._instance.get_property(nt),o=We(s,t),u=C(a)&&a!==n,l=_(a)&&s===t,h=u||l||!x(o),d=h?Oe(t,n):o;h&&(d?this.wh("sampled"):De.warn("Sample rate ("+n+") has determined that this sessionId ("+t+") will not be sent to the server.")),null==(e=this._instance.persistence)||e.register({[lt]:Pe(t,d),[nt]:I(a)&&s===t?null:n})}ensureSamplingDecision(t){if(C(this.gh)){var e=this._instance.get_property(lt);x(We(e,t))||this.makeSamplingDecisions(t)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,r,i,n;null==(t=this._instance.persistence)||t.unregister(ct),null==(e=this._instance.persistence)||e.unregister(dt),null==(r=this._instance.persistence)||r.unregister(lt),null==(i=this._instance.persistence)||i.unregister(nt),null==(n=this._instance.persistence)||n.unregister(ht)}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null==(e=this._h)?void 0:e.triggerStatus(t))===Rt}stop(){var t;null==(t=this.Sh)||t.call(this),this.Sh=void 0,this.nh.stop(),this.ih.stop(),this.sh.stop()}}class $e{constructor(t,e,r,i,n){this.Ih=[],this.Mh=new Map,this.Ch=!1,this._instance=t,this.ih=e,this.wh=r,this.xh=i,this.kh=n}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Rh(t.triggerGroups),this._instance.register_for_session({[wt]:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:t.triggerGroups.length}),this.ih.onConfig(t)):De.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return Mt;if(t.urlTriggerMatching.urlBlocked)return It;var e=t.triggerGroupMatchers,r=t.triggerGroupSamplingResults;if(0===e.length)return bt;var i=!1,n=!1;for(var s of e){var a=s.triggerStatus(t.sessionId);if(a===xt){var o=s.group.id,u=r.get(o);_(u)?L.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===u&&(n=!0)}else a===Rt&&(i=!0)}return n?kt:i?St:bt}({isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Ih,triggerGroupSamplingResults:this.Mh,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){var e=null;for(var r of this.Ih)if("trigger_activated"===r.triggerStatus(t)){var i=r.group.minDurationMs;C(i)&&(I(e)||e>i)&&(e=i)}return e}checkUrlTriggers(t,e,r,i){var n=this;this.ih.checkUrlBlocklist(e,r);var s=function(i){i.checkUrlTriggerConditions(e,r,(e=>{n.Th(i,void 0)&&(i.activateTrigger(e,t),n.updateActiveTriggers(t),n.kh())}),t)};for(var a of this.Ih)s(a)}setupEventTriggerListeners(t,e,r){var i=this;return this.Sh=t((t=>{var r;if(this.Ch)return De.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Sh)||r.call(this),void(this.Sh=void 0);try{var n=function(r){r.checkEventTriggerConditions(t.event,(n=>{if(i.Th(r,t.properties)){var s=(r.group.conditions.events||[]).filter((e=>e.name===t.event)),a=i._instance.get_property(yt);s.some((e=>!e.properties||0===e.properties.length||Fe(e.properties,t.properties,a)))&&(r.activateTrigger(n,e),i.updateActiveTriggers(e),i.kh())}}),e)};for(var s of this.Ih)n(s)}catch(t){De.error("Could not activate event trigger for trigger groups",t)}})),this.Sh}makeSamplingDecisions(t){for(var e of this.Ih){var r,i=e.group,n=i.id,s=i.sampleRate,a=pt+n,o=this._instance.get_property(a),u=null,l=!1,h=!1,d=!1;if(k(o)){var c=o.sessionId,v=o.sampleRate,f=o.sampled;l="string"==typeof c&&c!==t,h=C(v)&&v!==s,u=c===t&&C(v)&&v===s&&x(f)?f:null}else u=o===t||null,l="string"==typeof o&&o!==t,d=o===t;var p=l||h||d||!x(u),m=p?Oe(t+n,s):u;p&&this.xh("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:m}),this.Mh.set(n,m),null==(r=this._instance.persistence)||r.register({[a]:{sessionId:t,sampleRate:s,sampled:m}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Ch=!0}clearConditionalRecordingPersistence(){var t,e,r;for(var i of(null==(t=this._instance.persistence)||t.unregister(lt),null==(e=this._instance.persistence)||e.unregister(nt),null==(r=this._instance.persistence)||r.unregister(ht),this.Ih)){var n,s,a,o=i.group.id;null==(n=this._instance.persistence)||n.unregister(vt+o),null==(s=this._instance.persistence)||s.unregister(ft+o),null==(a=this._instance.persistence)||a.unregister(pt+o)}}updateActiveTriggers(t){var e=[];for(var r of this.Ih){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(t),a=!0===this.Mh.get(n);s&&e.push({id:n,name:i.name,matched:!0,sampled:a})}this._instance.register_for_session({$sdk_debug_replay_matched_recording_trigger_groups:e})}hasPendingTriggers(t){for(var e of this.Ih)if(e.triggerStatus(t)===Rt)return!0;return!1}stop(){var t;null==(t=this.Sh)||t.call(this),this.Sh=void 0,this.Ih.forEach((t=>t.stop())),this.Ih=[],this.Mh.clear(),this.ih.stop()}Th(t,e){var r=t.group.conditions.properties;return!r||0===r.length||Fe(r,e,this._instance.get_property(yt))}Rh(t){var e=this;this.Ih.forEach((t=>t.stop())),this.Ih=[],this.Mh.clear();var r=function(t){var r=new Bt(e._instance,t,((r,i)=>{e.wh("linked_flag_matched",{flag:r,variant:i,group_id:t.id,group_name:t.name}),e.kh()}));e.Ih.push(r)};for(var i of t)r(i)}}var Ue=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"];function ze(t){return k(t)?t.network_timing:t}var je,qe,He="[SessionRecording]",Ge=F(He),Ve=[d.MouseMove,d.MouseInteraction,d.Scroll,d.ViewportResize,d.Input,d.TouchMove,d.MediaInteraction,d.Drag],Ze=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Je(){var t;return null==s||null==(t=s.__PosthogExtensions__)?void 0:t.rrweb}function Qe(){var t;return null==(t=Je())?void 0:t.record}function Xe(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,zt())}}function Ye(t){return xe(function(t,e){void 0===e&&(e={});var r=_e(),i=t.length;r.p(t);var n=Se(t,e,Ce(e),8),s=n.length;return Me(n,e),Ie(n,s-8,r.d()),Ie(n,s-4,i),n}(function(t,e){var r=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Gt(t.length+(t.length>>>1)),n=0,s=function(t){i[n++]=t},a=0;r>a;++a){if(n+5>i.length){var o=new Gt(n+8+(r-a<<1));o.set(i),i=o}var u=t.charCodeAt(a);128>u?s(u):2048>u?(s(192|u>>>6),s(128|63&u)):u>55295&&57344>u?(s(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++a))>>>18),s(128|u>>>12&63),s(128|u>>>6&63),s(128|63&u)):(s(224|u>>>12),s(128|u>>>6&63),s(128|63&u))}return de(i,0,n)}(Xe(t))))}function Ke(t){return tr.apply(this,arguments)}function tr(){return tr=o((function*(t){var e=Xe(t),r=yield function(t,e,r){return p.apply(this,arguments)}(e,E.DEBUG,{rethrow:!0});return xe(new Uint8Array(yield r.arrayBuffer()))})),tr.apply(this,arguments)}var er="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,rr=!1;function ir(t){return w(t)&&0===t.length?je=null!=je?je:Ye([]):Ye(t)}function nr(t){return sr.apply(this,arguments)}function sr(){return(sr=o((function*(t){return w(t)&&0===t.length?je||(qe=null!=qe?qe:Ke([]).then((t=>(je=t,t))).catch((t=>{throw je=void 0,qe=void 0,t}))):Ke(t)}))).apply(this,arguments)}function ar(t){return er&&!rr&&function(t){return t.type===h.FullSnapshot||t.type===h.IncrementalSnapshot&&(t.data.source===d.Mutation||t.data.source===d.StyleSheetRule)}(t)}function or(t){return{event:t,size:qt(t)}}function ur(t,e){return u({},t,{data:e,cv:"2024-10"})}function lr(t,e){return u({},t,{cv:"2024-10",data:u({},t.data,e)})}function hr(t){try{if(t.type===h.FullSnapshot)return or(ur(t,Ye(t.data)));if(t.type===h.IncrementalSnapshot&&t.data.source===d.Mutation)return or(lr(t,{texts:ir(t.data.texts),attributes:ir(t.data.attributes),removes:ir(t.data.removes),adds:ir(t.data.adds)}));if(t.type===h.IncrementalSnapshot&&t.data.source===d.StyleSheetRule)return or(lr(t,{adds:t.data.adds?Ye(t.data.adds):void 0,removes:t.data.removes?Ye(t.data.removes):void 0}))}catch(t){Ge.error("could not compress event - will use uncompressed event",t)}return{event:t,size:jt(t)}}function dr(){return(dr=o((function*(t){try{if(t.type===h.FullSnapshot)return or(ur(t,yield Ke(t.data)));if(t.type===h.IncrementalSnapshot&&t.data.source===d.Mutation){var e=yield Promise.all([nr(t.data.texts),nr(t.data.attributes),nr(t.data.removes),nr(t.data.adds)]);return or(lr(t,{texts:e[0],attributes:e[1],removes:e[2],adds:e[3]}))}if(t.type===h.IncrementalSnapshot&&t.data.source===d.StyleSheetRule){var r=yield Promise.all([t.data.adds?Ke(t.data.adds):void 0,t.data.removes?Ke(t.data.removes):void 0]);return or(lr(t,{adds:r[0],removes:r[1]}))}}catch(e){return(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return(t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(t)||e===c})(e)&&(rr=!0),Ge.error("could not compress event asynchronously - trying synchronous compression",e),hr(t)}return{event:t,size:jt(t)}}))).apply(this,arguments)}function cr(t,e){return t.type===h.Custom&&t.data.tag===e}function vr(t){return cr(t,"sessionIdle")}function fr(t){return cr(t,"$session_ending")}function pr(t){return cr(t,"$session_starting")}class mr{get sessionId(){return this.Mi}get Oh(){if(!this._instance.sessionManager)throw new Error(He+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Ah(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Eh(){return We(this._instance.get_property(lt),this.sessionId)}get gh(){var t,e=null==(t=this.Xa)?void 0:t.sampleRate;return C(e)?e:null}get Nh(){var t,e;return null!==(t=null==(e=this.Lh)?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t){this.Fh="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.Dh=void 0,this.Ph=Date.now(),this.Wh=!1,this.Bh=[],this.$h="unknown",this.Uh=!1,this.zh=!1,this.jh=!1,this.qh=!1,this.Hh=[],this.Gh=void 0,this.Vh=void 0,this.Zh=[],this.Jh=0,this.Qh=0,this.Xh=!1,this.Yh=void 0,this.Sh=void 0,this.Kh=void 0,this.td=void 0,this.ed=void 0,this.fi=(t,e,r)=>{var i,n,s;if(r&&(t!==this.Mi||e!==this.Ii)){var a,o=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),u=this.Mi,l=this.Ii;o&&this.xh("$session_ending",{currentSessionId:u,currentWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph,flushed_size:null==(a=this.rd)?void 0:a.currentTrackedSize(u)}),null==(i=this._instance.persistence)||i.unregister(mt),this.jh=!1,null==(n=Je())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this.xh("$session_id_change",{sessionId:t,windowId:e,changeReason:r}),this.nd(),!1===this.$h&&this.isStarted||this.Mi===t&&this.Ii===e||(this.$h="unknown",this.stop(),this.start("session_id_changed")),o&&this.xh("$session_starting",{previousSessionId:u,previousWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph}),null==(s=this.Lh)||s.makeSamplingDecisions(t)}},this.sd=()=>{var t;return(null==(t=this._instance.persistence)?void 0:t.props[ht])===this.Mi},this.ad=()=>{var t,e;if(0===this.R.data.length)return null;var r=null==(t=this.R.data[0])?void 0:t.timestamp,i=null==(e=this.R.data[this.R.data.length-1])?void 0:e.timestamp;return C(r)&&C(i)?i-r:null},this.od=()=>{var t,e,r=this.Nh;if(!C(r))return!1;if(null===(t=null==(e=this._instance.config.session_recording)?void 0:e.strictMinimumDuration)||void 0===t||!t){var i=this.ud;return C(i)&&i>=0&&r>i}if(this.sd())return!1;var n,s=this.ad();return!!I(s)||r>s||(null==(n=this._instance.persistence)||n.register({[ht]:this.Mi}),!1)},this.ld=()=>{this.status!==St?(this.hd(),this.dd()):this.vd()},this.fd=()=>{this.xh("browser offline",{})},this.Bs=()=>{this.xh("browser online",{})},this.ke=()=>{null!=r&&r.visibilityState&&this.xh("window "+r.visibilityState,{})},this._instance=t;var e=this.Oh.checkAndGetSessionAndWindowId(),i=e.windowId;this.Mi=e.sessionId,this.Ii=i,this.sh=new Pt(this._instance),this.ih=new Dt(this._instance),this.nh=new Wt(this._instance),this.R=this.vd(),this.Oh.sessionTimeoutMs>this.Ah||Ge.warn("session_idle_threshold_ms ("+this.Ah+") is greater than the session timeout ("+this.Oh.sessionTimeoutMs+"). Session will never be detected as idle"),this.rd=new Te(this._instance)}get pd(){var t,e,r,i,n,s,a,o=null==(t=this.Xa)?void 0:t.masking,u={maskAllInputs:null==(e=this._instance.config.session_recording)?void 0:e.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector},l=null!==(n=null==u?void 0:u.maskAllInputs)&&void 0!==n?n:null==o?void 0:o.maskAllInputs,h=null!==(s=null==u?void 0:u.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,d=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==o?void 0:o.blockSelector;return _(l)&&_(h)&&_(d)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:d}}md(){var t;if(!this.qh){var e=null==(t=this.Xa)?void 0:t.masking;if(!M(e)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector"].filter((t=>{var i=null==r?void 0:r[t],n=e[t];return!_(i)&&i!==n}));0!==i.length&&(this.qh=!0,Ge.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector},project:e}))}}}get gd(){var t;return T(null==(t=this._instance.config.session_recording.canvasCapture)?void 0:t.resolutionScale,.1,1,F("canvas recording resolution scale"),1)}get yd(){var t,e,r,i,n,s,a,o=this._instance.config.session_recording.captureCanvas,u=null==(t=this.Xa)?void 0:t.canvasRecording,l=null!==(e=null!==(r=null==o?void 0:o.recordCanvas)&&void 0!==r?r:null==u?void 0:u.enabled)&&void 0!==e&&e,h=null!==(i=null!==(n=null==o?void 0:o.canvasFps)&&void 0!==n?n:null==u?void 0:u.fps)&&void 0!==i?i:4,d=null!==(s=null!==(a=null==o?void 0:o.canvasQuality)&&void 0!==a?a:null==u?void 0:u.quality)&&void 0!==s?s:.4;if("string"==typeof d){var c=parseFloat(d);d=isNaN(c)?.4:c}return{enabled:l,fps:T(h,0,12,F("canvas recording fps"),4),quality:T(d,0,1,F("canvas recording quality"),.4)}}get wd(){var t,e=!(null==(t=this.Xa)||!t.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:e}get bd(){var t,e,r,i=null==(t=this.Xa)?void 0:t.networkPayloadCapture,n={recordHeaders:null==(e=this._instance.config.session_recording)?void 0:e.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),a=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),o=ze(this._instance.config.capture_performance),u=ze(null==i?void 0:i.capturePerformance),l=!!(x(o)?o:u);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}kd(){var t,e,r=[],n=null==(t=s.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;n&&this.wd&&r.push(n());var a=null==(e=s.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordNetworkPlugin;return this.bd&&b(a)&&(!W.includes(i.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(a(((t,e)=>{var r,i={payloadSizeLimitBytes:J.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...J.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...J.payloadHostDenyList]},n=!1!==t.session_recording.recordHeaders&&e.recordHeaders,s=!1!==t.session_recording.recordBody&&e.recordBody,a=!1!==t.capture_performance&&e.recordPerformance,o=(r=Z(i),t=>(null!=t&&t.requestBody&&(t.requestBody=et(t.requestBody,t.requestHeaders,r,"Request")),null!=t&&t.responseBody&&(t.responseBody=et(t.responseBody,t.responseHeaders,r,"Response")),t)),l=e=>{return o(((t,e)=>{var r,i=B(t.name),n=0===e.indexOf("http")?null==(r=B(e))?void 0:r.pathname:e;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&tt.some((t=>0===s.indexOf(t)))))return t})((K((r=e).requestHeaders),K(r.responseHeaders),r),t.api_host));var r},h=b(t.session_recording.maskNetworkRequestFn);return h&&b(t.session_recording.maskCapturedNetworkRequestFn)&&L.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{var r=t.session_recording.maskNetworkRequestFn({url:e.name});return u({},e,{name:null==r?void 0:r.url})}),i.maskRequestFn=b(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var r,i=l(e);return i&&null!==(r=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(i))&&void 0!==r?r:void 0}:t=>function(t){if(!_(t))return t.requestBody=rt(t.requestBody,"Request"),t.responseBody=rt(t.responseBody,"Response"),t}(l(t)),u({},J,i,{recordHeaders:n,recordBody:s,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.bd))):Ge.info("NetworkCapture not started because we are on localhost.")),r}_d(t){return this._instance.config.disable_capture_url_hashes?A(t):t}Sd(t,e){void 0===e&&(e=!1);var r=e?A(t):this._d(t),i=this._instance.config.mask_personal_data_properties?[...Ue,...this._instance.config.custom_personal_data_properties||[]]:[];return this.Id(function(t,e,r){if(!t||!e||!e.length)return t;for(var i=t.split("#"),n=i[1],s=(i[0]||"").split("?"),a=s[1],o=s[0],u=(a||"").split("&"),l=[],h=0;u.length>h;h++){var d=u[h].split("=");w(d)&&(e.includes(d[0])?l.push(d[0]+"=<masked>"):l.push(u[h]))}var c=o;return null!=a&&(c+="?"+l.join("&")),null!=n&&(c+="#"+n),c}(r,i))}Id(t){var e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var r,i=e.maskCapturedNetworkRequestFn({name:t});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(e.maskNetworkRequestFn){var n=e.maskNetworkRequestFn({url:t});return null==n?void 0:n.url}return t}Md(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.Bh.length?this.Bh.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Ge.warn("could not emit queued rrweb event.",e,t),!1}}xh(t,e){return this.Md(Ze((()=>Qe().addCustomEvent(t,e))))}Cd(){try{if(this._instance.config.capture_pageview||!t)return;var e=new URL(t.location.href),r=this.Sd(e.origin+e.pathname+e.search);this.xd!==r&&(this.xd=r,this.xh("$url_changed",{href:r}))}catch(t){}}Rd(){if(this.Bh.length){var t=[...this.Bh];this.Bh=[],t.forEach((t=>{Date.now()-t.enqueuedAt>2e3||this.Md(t)}))}}bh(){return this.Md(Ze((()=>Qe().takeFullSnapshot())))}get Td(){var t,e,r;if(null!=(t=this.Lh)&&t.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return C(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(e=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Od(){if(this.Ad&&clearInterval(this.Ad),!0!==this.$h){var t=this.Td;t&&(this.Ad=setInterval((()=>{this.bh()}),t))}}kh(){!this.ih.urlBlocked&&["sampled","active"].includes(this.status)&&this.Od()}Ed(){this.ih.urlBlocked||(this.ih.urlBlocked=!0,clearInterval(this.Ad),Ge.info("recording paused due to URL blocker"),this.xh("recording paused",{reason:"url blocker"}))}Nd(){this.ih.urlBlocked&&(this.ih.urlBlocked=!1,this.bh(),this.Od(),this.xh("recording resumed",{reason:"left blocked url"}),Ge.info("recording resumed"))}Ld(t,e){var r;if(!this.Wh&&null!=(r=this.Lh)&&r.hasPendingTriggers(this.sessionId)){this.Wh=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===t?dt:ct]:this.sessionId}),null==(n=this.Lh)||n.updateActiveTriggers(this.sessionId),this.kh(),this.dd(),this.wh(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.Wh=!1}}}get isStarted(){return!!this.Dh}get Xa(){var t=this._instance.get_property(it);if(t){var e;try{e=k(t)?t:JSON.parse(t)}catch(t){return void Ge.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted){var r,i,n=null!==(r=e.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>36e5)return Ge.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t}),void(null==(i=this._instance.persistence)||i.unregister(it))}return e}}Fd(t,e,r){this._instance.get_property(t)&&(e(),r())}start(e){var r,i,n=this.Xa;if(n){this.Xh&&(this.Dd(),this.vd());var s=this.Oh.checkAndGetSessionAndWindowId(),a=s.windowId;this.Mi=s.sessionId,this.Ii=a,null==(r=this._instance.persistence)||r.unregister(mt),null!=n&&n.endpoint&&(this.Fh=null==n?void 0:n.endpoint),this.Lh=2===(null==n?void 0:n.version)&&(null==n?void 0:n.triggerGroups)&&n.triggerGroups.length>0?new $e(this._instance,this.ih,this.wh.bind(this),this.xh.bind(this),this.kh.bind(this)):new Be(this._instance,this.ih,this.nh,this.sh,this.wh.bind(this),this.bh.bind(this),this.kh.bind(this)),this.Lh.onRemoteConfig(n),null==(i=this.Sh)||i.call(this),this.Sh=this.Lh.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((t,e)=>this.Ld(t,e))),this.Fd(st,(()=>{this.overrideSampling()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(st)})),this.Fd(at,(()=>{this.overrideLinkedFlag()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(at)})),this.Fd(ut,(()=>{this.overrideTrigger("event")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(ut)})),this.Fd(ot,(()=>{this.overrideTrigger("url")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(ot)})),this.Lh.makeSamplingDecisions(this.sessionId),this.Pd(),this.Uh||(P(t,"beforeunload",this.ld),P(t,"offline",this.fd),P(t,"online",this.Bs),P(t,"visibilitychange",this.ke),!this.Kh&&b(this.Oh.onSessionId)&&(this.Kh=this.Oh.onSessionId(this.fi)),!this.td&&b(this.Oh.on)?this.td=this.Oh.on("forcedIdleReset",(()=>{this.nd(),this.$h="unknown",this.stop(),this.ed=this.Oh.onSessionId(((t,e,r)=>{var i;null==(i=this.ed)||i.call(this),this.ed=void 0,this.fi(t,e,r)}))})):b(this.Oh.on)||Ge.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),M(this.Yh)&&(this.Yh=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var e=null!=t&&t.properties.$current_url?this.Sd(t.properties.$current_url):"";if(!e)return;this.xh("$pageview",{href:e})}}catch(t){Ge.error("Could not add $pageview to rrweb session",t)}}))),this.status===_t&&this.wh(e||"recording_initialized"))}else Ge.info("remote config must be stored in persistence before recording can start")}Wd(){var e,r,i,n,s,a;null==t||t.removeEventListener("beforeunload",this.ld),null==t||t.removeEventListener("offline",this.fd),null==t||t.removeEventListener("online",this.Bs),null==t||t.removeEventListener("visibilitychange",this.ke),clearInterval(this.Ad),this.Bd(),null==(e=this.Yh)||e.call(this),this.Yh=void 0,null==(r=this.Sh)||r.call(this),this.Sh=void 0,null==(i=this.Kh)||i.call(this),this.Kh=void 0,null==(n=this.td)||n.call(this),this.td=void 0,null==(s=this.ed)||s.call(this),this.ed=void 0,null==(a=this.Lh)||a.stop(),this.$d(),this.Dd()}Dd(){this.Qh+=1,this.Zh=[],this.Jh=0,this.Ud=void 0,this.Xh=!1}$d(){var t,e;null==(t=this.zd)||t.stop(),this.Bh=[],null==(e=this.Dh)||e.call(this),this.Dh=void 0}jd(){if(!this.Ud||0===this.Jh)return!1;if(this.Xh)return!0;this.Xh=!0;var t=this.Qh;return this.Bd(),this.$d(),this.Ud.catch((()=>{})).then((()=>{t===this.Qh&&(this.Xh=!1,this.dd(),this.vd(),this.Wd(),Ge.info("stopped"))})).catch((()=>{this.Xh=!1,this.Wd(),Ge.info("stopped")})),!0}stop(){this.jd()||(this.dd(),this.vd(),this.Wd(),Ge.info("stopped"))}discard(){this.vd(),this.Wd(),Ge.info("discarded")}qd(t,e,r,i,n){var s,a={$snapshot_bytes:r,$snapshot_data:e,$session_id:i,$window_id:n};t.type===h.FullSnapshot&&null!=(s=Je())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this.jh=!0),this.status!==bt?(this.Hd(t,i),this.Gd(a)):this.vd()}Hd(t,e){t.type!==h.FullSnapshot?t.type===h.IncrementalSnapshot&&(_(this.Gh)||this.Gh===e||this.Vh===e||(this.Vh=e,Ge.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.bh())):this.Gh=e}Vd(t){t.counted&&t.generation===this.Qh&&(this.Jh=Math.max(0,this.Jh-1)),t.counted=!1,this.Zh=this.Zh.filter((e=>e!==t))}Zd(t,e,r){t.processed||t.generation!==this.Qh||(t.processed=!0,this.qd(t.event,e,r,t.targetSessionId,t.targetWindowId))}Jd(t){try{var e=t.compressionEnabled?hr(t.event):{event:t.event,size:jt(t.event)};this.Zd(t,e.event,e.size)}finally{this.Vd(t)}}hd(){[...this.Zh].forEach((t=>{this.Jd(t)}))}Qd(t,e,r,i){var n=this,s={event:t,compressionEnabled:e,targetSessionId:r,targetWindowId:i,generation:this.Qh,processed:!1,counted:!0};this.Zh.push(s),this.Jh+=1;var a=function(){var r=o((function*(){try{if(s.processed)return;var r,i;try{var a=e?ar(t)?yield function(t){return dr.apply(this,arguments)}(t):hr(t):{event:t,size:jt(t)};r=a.event,i=a.size}catch(e){Ge.error("could not process queued compression event - will use uncompressed event",e),r=t,i=jt(t)}n.Zd(s,r,i)}finally{n.Vd(s)}}));return function(){return r.apply(this,arguments)}}();this.Ud=this.Ud?this.Ud.catch((()=>{})).then(a):a()}onRRwebEmit(t){var e,r,i,n,s,a,o;if(this._instance.sessionManager&&(this.Rd(),t&&k(t))){if(t.type===h.Meta){var u=this.Sd(t.data.href);if(this.xd=u,!u)return;t.data.href=u}else this.Cd();if(null==(e=this.Lh)||e.checkUrlTriggers(this.sessionId,(()=>this.Ed()),(()=>this.Nd()),((t,e)=>this.Ld(t,e))),!this.ih.urlBlocked||(l=t).type===h.Custom&&"recording paused"===l.data.tag){var l,d,c;t.type===h.FullSnapshot&&(this.Od(),null==(d=this.zd)||d.reset(),null==(c=this._instance.persistence)||c.register_once({[mt]:t.timestamp},void 0)),t.type===h.FullSnapshot&&null!=(r=this.Lh)&&r.hasPendingTriggers(this.sessionId)&&this.Xd();var v=this.zd?this.zd.throttleMutations(t):t;if(v){var f=function(t){var e=t;if(e&&k(e)&&6===e.type&&k(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var r=[],i=0;e.data.payload.payload.length>i;i++)r.push(e.data.payload.payload[i]&&e.data.payload.payload[i].length>2e3?e.data.payload.payload[i].slice(0,2e3)+"...[truncated]":e.data.payload.payload[i]);return e.data.payload.payload=r,t}return t}(v),p=function(t){return fr(t)?t.data.payload:null}(f),m=function(t){return pr(t)?t.data.payload:null}(f);if(p||m){var g=null!=p?p:m;null!=g&&g.lastActivityTimestamp&&(f.timestamp=g.lastActivityTimestamp)}else this.Yd(f);t.type===h.FullSnapshot&&(this.Hh.push([this.Mi,t.timestamp]),this.Hh.length>6&&(this.Hh=this.Hh.slice(-6)));var y=null!==(i=null!==(n=null==p?void 0:p.currentSessionId)&&void 0!==n?n:null==m?void 0:m.nextSessionId)&&void 0!==i?i:this.Mi,w=null!==(s=null!==(a=null==p?void 0:p.currentWindowId)&&void 0!==a?a:null==m?void 0:m.nextWindowId)&&void 0!==s?s:this.Ii;if(!0!==this.$h||function(t){return vr(t)||fr(t)||pr(t)}(f)){if(vr(f)){var b=f.data.payload;b&&(f.timestamp=b.lastActivityTimestamp+b.threshold)}var _=null===(o=this._instance.config.session_recording.compress_events)||void 0===o||o;if(this.Jh>0||_&&ar(f))this.Qd(f,_,y,w);else{var S=_?hr(f):{event:f,size:jt(f)};this.qd(f,S.event,S.size,y,w)}}}}}}get status(){return this.Lh?this.Lh.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Eh,rrwebError:this.Uh,urlTriggerMatching:this.ih,eventTriggerMatching:this.nh,linkedFlagMatching:this.sh,remoteConfig:this.Xa}):bt}log(t,e){var r;void 0===e&&(e="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.sh.linkedFlagSeen=!0,this.bh(),this.wh("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[lt]:this.sessionId,[nt]:null}),this.bh(),this.wh("sampling_overridden")}overrideTrigger(t){this.Ld(t)}Kd(){try{var e,r=null==t||null==(e=t.location)?void 0:e.href;if(!r)return;var i=this.Sd(r);if(!i)return;return new URL(i).hostname||void 0}catch(t){return}}Bd(){this.tc&&(clearTimeout(this.tc),this.tc=void 0)}dd(){var t;this.Bd(),null==(t=this.Lh)||t.ensureSamplingDecision(this.sessionId);var e=this.od();if(this.status===St||this.status===It||this.status===bt||e)return this.tc=setTimeout((()=>{this.dd()}),2e3),this.R;if(this.R.data.length>0){var r,i=this.Kd();Ht(this.R).forEach((t=>{var e;null==(e=this.rd)||e.trackSize(t.sessionId,t.size),this.ec({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:E.LIB_NAME,$lib_version:E.LIB_VERSION,$snapshot_host:i})})),null==(r=this.Lh)||r.onFlushComplete()}return this.vd()}Gd(t){var e,r=2+((null==(e=this.R)?void 0:e.data.length)||0),i=t.$session_id,n=this.R.sessionId!==i;(n||!0!==this.$h&&this.R.size+t.$snapshot_bytes+r>943718.4)&&(this.R=this.dd(),n&&this.R.data.length>0&&(this.R=this.vd()),this.R.sessionId=i,this.R.windowId=t.$window_id),this.R.size+=t.$snapshot_bytes,this.R.data.push(t.$snapshot_data),this.R.sizes.push(t.$snapshot_bytes),this.tc||!0===this.$h||(this.tc=setTimeout((()=>{this.dd()}),2e3))}ec(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.Fh),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get ud(){var t,e,r=null==(t=this.R)?void 0:t.data[(null==(e=this.R)?void 0:e.data.length)-1],i=this.Oh.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}Xd(){if(!this.R||0===this.R.data.length)return this.vd();for(var t=-1,e=this.R.data.length-1;e>=0;e--)if(this.R.data[e].type===h.Meta){t=e;break}return 0>t?this.vd():(this.R.data=this.R.data.slice(t),this.R.sizes=this.R.sizes.slice(t),this.R.size=this.R.sizes.reduce(((t,e)=>t+e),0),this.R)}vd(){return this.R={size:0,data:[],sizes:[],sessionId:this.Mi,windowId:this.Ii},this.R}wh(t,e){this._instance.register_for_session({$session_recording_start_reason:t}),Ge.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.xh("$recording_started",u({reason:t},e))}rc(t){var e;return 3===t.type&&-1!==Ve.indexOf(null==(e=t.data)?void 0:e.source)}Yd(t){var e=this.rc(t);e||this.$h||t.timestamp-this.Ph>this.Ah&&(this.$h=!0,clearInterval(this.Ad),this.xh("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.Ph,threshold:this.Ah,bufferLength:this.R.data.length,bufferSize:this.R.size}),this.dd());var r=!1;if(e&&(this.Ph=t.timestamp,this.$h)){var i="unknown"===this.$h;this.$h=!1,i||(this.xh("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!0!==this.$h){var n=this.Oh.checkAndGetSessionAndWindowId(!e,t.timestamp),s=n.windowId,a=n.sessionId,o=this.Mi!==a,u=this.Ii!==s;this.Ii=s,this.Mi=a,o||u?(this.stop(),this.start("session_id_changed")):r&&this.Od()}}nd(){var t;null==(t=this.Lh)||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e=this.Oh.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.R.data.length,$sdk_debug_replay_internal_buffer_size:this.R.size,$sdk_debug_current_session_duration:this.ud,$sdk_debug_session_start:e.sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(t=this.rd)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Hh,$snapshot_max_depth_exceeded:this.jh,$sdk_debug_replay_rrweb_error:this.Uh,$sdk_debug_rrweb_attached:!!this.Dh,$sdk_debug_rrweb_start_attempted:this.zh}}Pd(){var t;if(!this.Dh){this.zh=!0;var e,r,i,n={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1,attributeFilter:void 0},s=this._instance.config.session_recording;for(var a of Object.entries(s||{})){var o=a[0],l=a[1];o in n&&("maskInputOptions"===o?n.maskInputOptions=u({password:!0},l):n[o]=l)}this.yd&&this.yd.enabled&&(n.recordCanvas=!0,n.sampling={canvas:this.yd.fps},n.dataURLOptions={type:"image/webp",quality:this.yd.quality},n.canvasResolutionScale=this.gd),this.pd&&(n.maskAllInputs=null===(e=this.pd.maskAllInputs)||void 0===e||e,n.maskTextSelector=null!==(r=this.pd.maskTextSelector)&&void 0!==r?r:void 0,n.blockSelector=null!==(i=this.pd.blockSelector)&&void 0!==i?i:void 0),this.md();var h=Qe();if(h){this.zd=null!==(t=this.zd)&&void 0!==t?t:new Re(h,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{var r="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";Ge.info(r,{node:e}),this.log(He+" "+r,"warn")}});var d=this.kd();if(this.Dh=h(u({emit:t=>{this.onRRwebEmit(t)},plugins:d},n)),!this.Dh)return this.Uh=!0,void Ge.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.Uh=!1,this.Ph=Date.now(),this.$h=x(this.$h)?this.$h:"unknown",this.tryAddCustomEvent("$remote_config_received",this.Xa),this.xh("$session_options",{sessionRecordingOptions:n,activePlugins:d.map((t=>null==t?void 0:t.name))}),this.xh("$posthog_config",{config:this._instance.config})}else Ge.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(t,e){return this.xh(t,e)}}var gr,yr=["type"],wr=Object.defineProperty,br=(t,e,r)=>((t,e,r)=>e in t?wr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),kr=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(kr||{}),_r=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(_r||{}),Sr=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(Sr||{}),Ir=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Ir||{}),Mr=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(Mr||{}),Cr=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(Cr||{}),xr=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(xr||{}),Rr={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Tr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Or={};function Ar(t){if(Or[t])return Or[t];var e=function(t){var e,r,i=null==(r=null==(e=null==globalThis?void 0:globalThis.Zone)?void 0:e.__symbol__)?void 0:r.call(e,t);return i&&globalThis[i]?globalThis[i]:void 0}(t)||globalThis[t],r=e.prototype,i=t in Rr?Rr[t]:void 0,n=Boolean(i&&i.every((t=>{var e,i;return Boolean(null==(i=null==(e=Object.getOwnPropertyDescriptor(r,t))?void 0:e.get)?void 0:i.toString().includes("[native code]"))}))),s=t in Tr?Tr[t]:void 0,a=Boolean(s&&s.every((t=>{var e;return"function"==typeof r[t]&&(null==(e=r[t])?void 0:e.toString().includes("[native code]"))})));if(n&&a)return Or[t]=e.prototype,e.prototype;var o=document.createElement("iframe");o.style.display="none";var u,l=!1;try{document.body.appendChild(o);var h=o.contentWindow;if(!h)return e.prototype;var d=h[t].prototype;return d?((u=navigator.userAgent).includes("Safari")&&!u.includes("Chrome")&&(o.classList.add("rr-block","ph-no-capture"),o.setAttribute("__rrwebUntaintedPrototype",t),l=!0),Or[t]=d):r}catch(t){return r}finally{!l&&o.parentNode&&document.body.removeChild(o)}}var Er={};function Nr(t,e,r){var i,n=t+"."+String(r);if(Er[n])return Er[n].call(e);var s=Ar(t),a=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return a?(Er[n]=a,a.call(e)):e[r]}var Lr={};function Fr(t,e,r){var i=t+"."+String(r);if(Lr[i])return Lr[i].bind(e);var n=Ar(t)[r];return"function"!=typeof n?e[r]:(Lr[i]=n,n.bind(e))}function Dr(){return Ar("MutationObserver").constructor}function Pr(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n={next:i},s=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return n.next.apply(this,e)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]!==s)for(var r=t[e];"function"==typeof r&&r.__rrweb_layer__;){var i=r.__rrweb_layer__;if(i.next===s)return void(i.next=n.next);r=i.next}else t[e]=n.next}}catch(t){return()=>{}}}var Wr={childNodes:t=>Nr("Node",t,"childNodes"),parentNode:t=>Nr("Node",t,"parentNode"),parentElement:t=>Nr("Node",t,"parentElement"),textContent:t=>Nr("Node",t,"textContent"),contains:(t,e)=>Fr("Node",t,"contains")(e),getRootNode:t=>Fr("Node",t,"getRootNode")(),host:t=>t&&"host"in t?Nr("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?Nr("Element",t,"shadowRoot"):null,querySelector:(t,e)=>Fr("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>Fr("Element",t,"querySelectorAll")(e),mutationObserver:Dr,patch:Pr};function Br(t){return t.nodeType===t.ELEMENT_NODE}function $r(t){var e=t&&"host"in t&&"mode"in t&&Wr.host(t)||null;return Boolean(e&&"shadowRoot"in e&&Wr.shadowRoot(e)===t)}function Ur(t){return"[object ShadowRoot]"==={}.toString.call(t)}function zr(t){try{var e=t.rules||t.cssRules;if(!e)return null;var r=t.href;return!r&&t.ownerNode&&(r=t.ownerNode.baseURI),(i=Array.from(e,(t=>jr(t,r))).join("")).includes(" background-clip: text;")&&!i.includes(" -webkit-background-clip: text;")&&(i=i.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),i}catch(t){return null}var i}function jr(t,e){var r;if(function(t){return"styleSheet"in t}(t)){var i;try{i=zr(t.styleSheet)||function(t){var e=t.cssText;if(3>e.split('"').length)return e;var r=["@import","url("+JSON.stringify(t.href)+")"];return""===t.layerName?r.push("layer"):t.layerName&&r.push("layer("+t.layerName+")"),t.supportsText&&r.push("supports("+t.supportsText+")"),t.media.length&&r.push(t.media.mediaText),r.join(" ")+";"}(t)}catch(e){i=t.cssText}try{if(i&&(null==(r=t.styleSheet)?void 0:r.href))return Kr(i,t.styleSheet.href)}catch(t){}return i}var n=t.cssText;return function(t){return"selectorText"in t}(t)&&t.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),e?Kr(n,e):n}class qr{constructor(){br(this,"idNodeMap",new Map),br(this,"nodeMetaMap",new WeakMap)}getId(t){var e;if(!t)return-1;var r=null==(e=this.getMeta(t))?void 0:e.id;return null!=r?r:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){var e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach((t=>this.removeNodeFromMap(t))),Br(t)){var r=Wr.shadowRoot(t);r&&this.removeNodeFromMap(r),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(e,i)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Hr(t){var e=t.element,r=t.maskInputOptions,i=t.tagName,n=t.type,s=t.maskInputFn,a=t.value||"",o=n&&Gr(n);return(r[i.toLowerCase()]||o&&r[o])&&(a=s?s(a,e):"*".repeat(a.length)),a}function Gr(t){return t.toLowerCase()}var Vr="__rrweb_original__";function Zr(t){try{var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Gr(e):null}catch(t){return null}}var Jr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Qr=/^(?:[a-z+]+:)?\/\//i,Xr=/^www\..*/i,Yr=/^(data:)([^,]*),(.*)/i;function Kr(t,e){return(t||"").replace(Jr,((t,r,i,n,s,a)=>{var o,u=i||s||a,l=r||n||"";if(!u)return t;if(Qr.test(u)||Xr.test(u))return"url("+l+u+l+")";if(Yr.test(u))return"url("+l+u+l+")";if("/"===u[0])return"url("+l+(((o=e).indexOf("//")>-1?o.split("/").slice(0,3).join("/"):o.split("/")[0]).split("?")[0]+u)+l+")";var h=e.split("/"),d=u.split("/");for(var c of(h.pop(),d))"."!==c&&(".."===c?h.pop():h.push(c));return"url("+l+h.join("/")+l+")"}))}var ti,ei,ri="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",ii=4096,ni=1,si=new RegExp("[^a-z0-9-_:]"),ai=-2;function oi(){return ni++}var ui=/^[^ \t\n\r\u000c]+/,li=/^[, \t\n\r\u000c]+/,hi=new WeakMap;function di(t,e){return e&&""!==e.trim()?ci(t,e):e}function ci(t,e){var r=hi.get(t);if(r||(r=t.createElement("a"),hi.set(t,r)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return r.setAttribute("href",e),r.href}function vi(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?ri:t}(t,e.maxBase64ImageLength):t}function fi(t,e,r,i,n,s){var a;if(!i)return i;if("src"===r||"href"===r&&("use"!==e||"#"!==i[0])){if("link"===e&&n){var o=null==(a=n.sheet)?void 0:a.href;if(o)return o}var u=di(t,i);if(u.startsWith("data:")){if("img"===e&&n){var l=u;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(l=function(t,e,r,i){if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>ii||t.naturalHeight>ii)return e;try{var n=document.createElement("canvas");n.width=t.naturalWidth,n.height=t.naturalHeight;var s=n.getContext("2d");return s?(s.drawImage(t,0,0),n.toDataURL(r||"image/webp",null!=i?i:.4)):e}catch(t){return e}}(n,u,s.type,s.quality)),vi(l,s)}if("image"===e)return vi(u,s)}return u}if("xlink:href"===r&&"#"!==i[0]){var h=di(t,i);return"image"===e&&h.startsWith("data:")?vi(h,s):h}return"background"!==r||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===r?function(t,e){if(""===e.trim())return e;var r=0;function i(t){var i,n=t.exec(e.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(li),e.length>r;){var s=i(ui);if(","===s.slice(-1))s=di(t,s.substring(0,s.length-1)),n.push(s);else{var a="";s=di(t,s);for(var o=!1;;){var u=e.charAt(r);if(""===u){n.push((s+a).trim());break}if(o)")"===u&&(o=!1);else{if(","===u){r+=1,n.push((s+a).trim());break}"("===u&&(o=!0)}a+=u,r+=1}}}return n.join(", ")}(t,i):"style"===r?Kr(i,ci(t)):"object"===e&&"data"===r?di(t,i):i:di(t,i)}function pi(t,e,r){return("video"===t||"audio"===t)&&"autoplay"===e}function mi(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!r&&mi(Wr.parentNode(t),e,r);for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!r&&mi(Wr.parentNode(t),e,r)}function gi(t,e,r,i){var n;if(Br(t)){if(!Wr.childNodes(n=t).length)return!1}else{if(null===Wr.parentElement(t))return!1;n=Wr.parentElement(t)}try{if("string"==typeof e){if(i){if(n.closest("."+e))return!0}else if(n.classList.contains(e))return!0}else if(mi(n,e,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(t){}return!1}function yi(t,e,r){var i=t.removeEventListener;"function"==typeof i&&i.call(t,e,r)}var wi=new Map;function bi(t,e){return Array.from(t.styleSheets).find((t=>t.href===e))}function ki(t){return null==t?"":t.toLowerCase()}var _i=50,Si=!1,Ii=!1;function Mi(t,e){var r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,a=e.maskTextClass,o=e.maskTextSelector,u=e.skipChild,l=void 0!==u&&u,h=e.inlineStylesheet,d=void 0===h||h,c=e.maskInputOptions,v=void 0===c?{}:c,f=e.maskTextFn,p=e.maskInputFn,m=e.slimDOMOptions,g=e.dataURLOptions,y=void 0===g?{}:g,w=e.inlineImages,b=void 0!==w&&w,k=e.recordCanvas,_=void 0!==k&&k,S=e.onSerialize,I=e.onIframeLoad,M=e.iframeLoadTimeout,C=void 0===M?5e3:M,x=e.onIframeListenerRegistered,R=e.onStylesheetLoad,T=e.stylesheetLoadTimeout,O=void 0===T?5e3:T,A=e.keepIframeSrcFn,E=void 0===A?()=>!1:A,N=e.newlyAddedElement,L=void 0!==N&&N,F=e.depth,D=void 0===F?0:F,P=e.maxDepth,W=void 0===P?_i:P,B=e.needsMask,U=e.preserveWhiteSpace,z=void 0===U||U;if(D>=W)return Ii=!0,Si||(Si=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+W+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;B||(B=gi(t,a,o,void 0===B));var j,q=function(t,e){var r=e.doc,i=e.blockClass,n=e.blockSelector,s=e.needsMask,a=e.inlineStylesheet,o=e.maskInputOptions,u=void 0===o?{}:o,l=e.maskTextFn,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,v=e.inlineImages,f=e.recordCanvas,p=e.keepIframeSrcFn,m=e.newlyAddedElement,g=void 0!==m&&m,y=function(t,e){if(e.hasNode(t)){var r=e.getId(t);return 1===r?void 0:r}}(r,e.mirror);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:xr.Document,childNodes:[],compatMode:t.compatMode}:{type:xr.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:xr.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:y};case t.ELEMENT_NODE:return function(t,e){for(var r,i,n,s,a=e.doc,o=e.inlineStylesheet,u=e.maskInputOptions,l=void 0===u?{}:u,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,v=e.inlineImages,f=e.recordCanvas,p=e.keepIframeSrcFn,m=e.newlyAddedElement,g=void 0!==m&&m,y=e.rootId,w=function(t,e,r){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(r)return t.matches(r)}catch(t){}return!1}(t,e.blockClass,e.blockSelector),b=function(t){if(t instanceof HTMLFormElement)return"form";var e=Gr(t.tagName);return si.test(e)?"div":e}(t),k={},_=t.attributes.length,S=0;_>S;S++){var I=t.attributes[S];pi(b,I.name)||(k[I.name]=fi(a,b,Gr(I.name),I.value,t,c))}if("link"===b&&o){var M=t.sheet;if(!M){var C=function(t){return t.href}(t);C&&!(M=bi(a,C))&&C.includes(".css")&&(M=bi(a,window.location.origin+"/"+C.replace(window.location.href,"")))}var x=null;M&&(x=zr(M)),x&&(delete k.rel,delete k.href,k._cssText=x)}if("style"===b&&t.sheet&&!(t.innerText||Wr.textContent(t)||"").trim().length){var R=zr(t.sheet);R&&(k._cssText=R)}if("input"===b||"textarea"===b||"select"===b){var T=t.value,O=t.checked;"radio"!==k.type&&"checkbox"!==k.type&&"submit"!==k.type&&"button"!==k.type&&T?k.value=Hr({element:t,type:Zr(t),tagName:b,value:T,maskInputOptions:l,maskInputFn:h}):O&&(k.checked=O)}if("option"===b&&(t.selected&&!l.select?k.selected=!0:delete k.selected),"dialog"===b&&t.open)try{k.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){k.rr_open_mode="modal",k.ph_rr_could_not_detect_modal=!0}if("canvas"===b&&f)if("2d"===t.__context)(function(t){var e=t.getContext("2d");if(!e)return!0;for(var r=0;t.width>r;r+=50)for(var i=0;t.height>i;i+=50){var n=e.getImageData;if(new Uint32Array((Vr in n?n[Vr]:n).call(e,r,i,Math.min(50,t.width-r),Math.min(50,t.height-i)).data.buffer).some((t=>0!==t)))return!1}return!0})(t)||(k.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){var A=t.toDataURL(c.type,c.quality),E=a.createElement("canvas");E.width=t.width,E.height=t.height,A!==E.toDataURL(c.type,c.quality)&&(k.rr_dataURL=A)}if("img"===b&&v){ti||(ti=a.createElement("canvas"),ei=ti.getContext("2d"));var N=t,L=N.currentSrc||N.getAttribute("src")||"<unknown-src>",F=N.crossOrigin,D=()=>{yi(N,"load",D);try{ti.width=N.naturalWidth,ti.height=N.naturalHeight,ei.drawImage(N,0,0),k.rr_dataURL=ti.toDataURL(c.type,c.quality)}catch(t){if("anonymous"!==N.crossOrigin)return N.crossOrigin="anonymous",void(N.complete&&0!==N.naturalWidth?D():N.addEventListener("load",D));console.warn("Cannot inline img src="+L+"! Error: "+t)}"anonymous"===N.crossOrigin&&(F?k.crossOrigin=F:N.removeAttribute("crossorigin"))};N.complete&&0!==N.naturalWidth?D():N.addEventListener("load",D)}if("audio"===b||"video"===b){var P=k;P.rr_mediaState=t.paused?"paused":"played",P.rr_mediaCurrentTime=t.currentTime,P.rr_mediaPlaybackRate=t.playbackRate,P.rr_mediaMuted=t.muted,P.rr_mediaLoop=t.loop,P.rr_mediaVolume=t.volume}if(g||(t.scrollLeft&&(k.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(k.rr_scrollTop=t.scrollTop)),w){var W=t.getBoundingClientRect(),B=W.width,U=W.height,z=W.left,j=W.top,q=null==(r=a.defaultView)?void 0:r.getComputedStyle(t);k={class:k.class,rr_width:B+"px",rr_height:U+"px",rr_left:Math.floor(z+((null==(i=a.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(j+((null==(n=a.defaultView)?void 0:n.scrollY)||0))+"px"},q&&(k.rr_position=q.position||"static",q.transform&&"none"!==q.transform&&(k.rr_transform=q.transform),q.display&&q.display.startsWith("inline")&&(k.rr_display=q.display))}"iframe"!==b||p(k.src)||(t.contentDocument||(k.rr_src=k.src),delete k.src);try{customElements.get(b)&&(s=!0)}catch(t){}return{type:xr.Element,tagName:b,attributes:k,childNodes:[],isSVG:(H=t,Boolean("svg"===H.tagName||H.ownerSVGElement)||void 0),needBlock:w,rootId:y,isCustom:s};var H}(t,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,dataURLOptions:c,inlineImages:v,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:g,rootId:y});case t.TEXT_NODE:return function(t,e){var r,i=e.needsMask,n=e.maskTextFn,s=e.rootId,a=Wr.parentNode(t),o=a&&a.tagName,u=Wr.textContent(t),l="STYLE"===o||void 0,h="SCRIPT"===o||void 0;if(l&&u){try{if(t.nextSibling||t.previousSibling);else if(null==(r=a.sheet)?void 0:r.cssRules){var d=zr(a.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(u=d)}}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}u=Kr(u,ci(e.doc))}return h&&(u="SCRIPT_PLACEHOLDER"),!l&&!h&&u&&i&&(u=n?n(u,Wr.parentElement(t)):u.replace(/[\S]/g,"*")),{type:xr.Text,textContent:u||"",isStyle:l,rootId:s}}(t,{doc:r,needsMask:s,maskTextFn:l,rootId:y});case t.CDATA_SECTION_NODE:return{type:xr.CDATA,textContent:"",rootId:y};case t.COMMENT_NODE:return{type:xr.Comment,textContent:Wr.textContent(t)||"",rootId:y};default:return!1}}(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,dataURLOptions:y,inlineImages:b,recordCanvas:_,keepIframeSrcFn:E,newlyAddedElement:L});if(!q)return console.warn(t,"not serialized"),null;j=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===xr.Comment)return!0;if(t.type===xr.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t,e){var r,i;try{i=new URL(t,window.location.href)}catch(t){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(ki(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ki(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(ki(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&ki(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ki(t.attributes.property).match(/^(og|twitter|fb):/)||ki(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===ki(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(ki(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(ki(t.attributes.name))||ki(t.attributes.property).match(/^article:/)||ki(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(ki(t.attributes.name)))return!0}}return!1}(q,m)||!z&&q.type===xr.Text&&!q.isStyle&&!q.textContent.replace(/^\s+|\s+$/gm,"").length?ai:oi();var H=Object.assign(q,{id:j});if(i.add(t,H),j===ai)return null;S&&S(t);var G=!l;if(H.type===xr.Element){G=G&&!H.needBlock,delete H.needBlock;var V=Wr.shadowRoot(t);V&&Ur(V)&&(H.isShadowHost=!0)}if((H.type===xr.Document||H.type===xr.Element)&&G){m.headWhitespace&&H.type===xr.Element&&"head"===H.tagName&&(z=!1);var Z={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,preserveWhiteSpace:z,onSerialize:S,onIframeLoad:I,iframeLoadTimeout:C,onIframeListenerRegistered:x,onStylesheetLoad:R,stylesheetLoadTimeout:O,keepIframeSrcFn:E,depth:D+1,maxDepth:W};if(H.type===xr.Element&&"textarea"===H.tagName&&void 0!==H.attributes.value);else for(var J of Array.from(Wr.childNodes(t))){var Q=Mi(J,Z);Q&&H.childNodes.push(Q)}var X=null;if(Br(t)&&(X=Wr.shadowRoot(t)))for(var Y of Array.from(Wr.childNodes(X))){var K=Mi(Y,Z);K&&(Ur(X)&&(K.isShadow=!0),H.childNodes.push(K))}}var tt=Wr.parentNode(t);if(tt&&$r(tt)&&Ur(tt)&&(H.isShadow=!0),H.type===xr.Element&&"iframe"===H.tagName){var et=function(t,e,r){var i,n=()=>{},s=t.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(t){return n}var a=()=>e();if("complete"!==i){var o=!1,u=null,l=()=>{o||(o=!0,null!==u&&(clearTimeout(u),u=null),yi(t,"load",h),t.addEventListener("load",a),e())},h=()=>l();return u=setTimeout(l,r),t.addEventListener("load",h),()=>{null!==u&&(clearTimeout(u),u=null),o?yi(t,"load",a):(o=!0,yi(t,"load",h))}}var d,c="about:blank";try{d=s.location.href}catch(t){return n}if(d!==c||t.src===c||""===t.src){var v=setTimeout(e,0);return t.addEventListener("load",a),()=>{clearTimeout(v),yi(t,"load",a)}}return t.addEventListener("load",a),()=>{yi(t,"load",a)}}(t,(()=>{var e=t.contentDocument;if(e&&I){var r=Mi(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,preserveWhiteSpace:z,onSerialize:S,onIframeLoad:I,iframeLoadTimeout:C,onIframeListenerRegistered:x,onStylesheetLoad:R,stylesheetLoadTimeout:O,keepIframeSrcFn:E,depth:D+1,maxDepth:W});r&&I(t,r)}}),C);null==x||x(t,et)}return H.type===xr.Element&&"link"===H.tagName&&"stylesheet"===H.attributes.rel&&function(e,u,l){if(!wi.has(e)){var h;try{h=e.sheet}catch(t){return}if(!h){var c=new AbortController,g=!1,w=()=>{if(!g){g=!0;try{(()=>{if(R){var e=Mi(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,preserveWhiteSpace:z,onSerialize:S,onIframeLoad:I,iframeLoadTimeout:C,onStylesheetLoad:R,stylesheetLoadTimeout:O,keepIframeSrcFn:E,depth:D,maxDepth:W});e&&R(t,e)}})()}finally{wi.delete(e),c.abort()}}},k=setTimeout(w,l);c.signal.addEventListener("abort",(()=>clearTimeout(k)),{once:!0}),e.addEventListener("load",w,{signal:c.signal,once:!0}),wi.set(e,c)}}}(t,0,O),H}function Ci(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}class xi{constructor(){br(this,"parentElement",null),br(this,"parentNode",null),br(this,"ownerDocument"),br(this,"firstChild",null),br(this,"lastChild",null),br(this,"previousSibling",null),br(this,"nextSibling",null),br(this,"ELEMENT_NODE",1),br(this,"TEXT_NODE",3),br(this,"nodeType"),br(this,"nodeName"),br(this,"RRNodeType")}get childNodes(){for(var t=[],e=this.firstChild;e;)t.push(e),e=e.nextSibling;return t}contains(t){if(!(t instanceof xi))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Ri(t,e,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>Ti(r,t,e,i)}function Ti(t,e,r,i){Oi((()=>{var n=t.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(t,e,r,i):n.call(t,e,r))}))}function Oi(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var Ai="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.",Ei={map:{},getId(){return console.error(Ai),-1},getNode(){return console.error(Ai),null},removeNodeFromMap(){console.error(Ai)},has(){return console.error(Ai),!1},reset(){console.error(Ai)}};function Ni(t,e,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];var u=Date.now();n||!1!==r.leading||(n=u);var l=e-(u-n),h=this;0>=l||l>e?(i&&(clearTimeout(i),i=null),n=u,t.apply(h,a)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,t.apply(h,a)}),l))}}function Li(t,e,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(t,e);return n.Object.defineProperty(t,e,i?r:{set(t){if(setTimeout((()=>{try{r.set.call(this,t)}catch(t){}}),0),s&&s.set){if(s.get)try{s.get.call(this)}catch(t){return}s.set.call(this,t)}}}),()=>Li(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Ei=new Proxy(Ei,{get(t,e,r){return"map"===e&&console.error(Ai),Reflect.get(t,e,r)}}));var Fi=Date.now;function Di(t){var e,r,i,n,s=t.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(e=Wr.parentElement(s.body))?void 0:e.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(i=Wr.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function Pi(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Wi(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Bi(t){return t?t.nodeType===t.ELEMENT_NODE?t:Wr.parentElement(t):null}function $i(t,e,r,i){if(!t)return!1;var n=Bi(t);if(!n)return!1;try{if("string"==typeof e){if(n.classList.contains(e))return!0;if(i&&null!==n.closest("."+e))return!0}else if(mi(n,e,i))return!0}catch(t){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function Ui(t,e,r){return!("TITLE"!==t.tagName||!r.headTitleMutations)||e.getId(t)===ai}function zi(t,e){if($r(t))return!1;var r=e.getId(t);if(!e.has(r))return!0;var i=Wr.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||zi(i,e))}function ji(t){return Boolean(t.changedTouches)}function qi(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Hi(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Gi(t){return!!t&&(t instanceof xi&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(Wr.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Fi=()=>(new Date).getTime());class Vi{constructor(){br(this,"id",1),br(this,"styleIDMap",new WeakMap),br(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){return this.has(t)?this.getId(t):(r=void 0===e?this.id++:e,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r);var r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Zi(t){var e,r=null;return"getRootNode"in t&&(null==(e=Wr.getRootNode(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Wr.host(Wr.getRootNode(t))&&(r=Wr.host(Wr.getRootNode(t))),r}function Ji(t){var e=t.ownerDocument;return!!e&&(Wr.contains(e,t)||function(t){var e=t.ownerDocument;if(!e)return!1;var r=function(t){for(var e,r=t;e=Zi(r);)r=e;return r}(t);return Wr.contains(e,r)}(t))}function Qi(t){return"__ln"in t}class Xi{constructor(){br(this,"length",0),br(this,"head",null),br(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");for(var e=this.head,r=0;t>r;r++)e=(null==e?void 0:e.next)||null;return e}addNode(t){var e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Qi(t.previousSibling)){var r=t.previousSibling.__ln.next;e.next=r,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,r&&(r.previous=e)}else if(t.nextSibling&&Qi(t.nextSibling)&&t.nextSibling.__ln.previous){var i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){var e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}var Yi,Ki=(t,e)=>t+"@"+e;class tn{constructor(){br(this,"frozen",!1),br(this,"locked",!1),br(this,"texts",[]),br(this,"attributes",[]),br(this,"attributeMap",new WeakMap),br(this,"removes",[]),br(this,"mapRemoves",[]),br(this,"movedMap",{}),br(this,"addedSet",new Set),br(this,"movedSet",new Set),br(this,"droppedSet",new Set),br(this,"removesSubTreeCache",new Set),br(this,"mutationCb"),br(this,"blockClass"),br(this,"blockSelector"),br(this,"maskTextClass"),br(this,"maskTextSelector"),br(this,"inlineStylesheet"),br(this,"maskInputOptions"),br(this,"maskTextFn"),br(this,"maskInputFn"),br(this,"keepIframeSrcFn"),br(this,"recordCanvas"),br(this,"inlineImages"),br(this,"slimDOMOptions"),br(this,"dataURLOptions"),br(this,"doc"),br(this,"mirror"),br(this,"iframeManager"),br(this,"stylesheetManager"),br(this,"shadowDomManager"),br(this,"canvasManager"),br(this,"processedNodeManager"),br(this,"unattachedDoc"),br(this,"canvasManagerReleased",!1),br(this,"processMutations",(t=>{t.forEach(this.processMutation),this.emit()})),br(this,"emit",(()=>{if(!this.frozen&&!this.locked){for(var t=[],e=new Set,r=new Xi,i=t=>{for(var e=t,r=ai;r===ai;)r=(e=e&&e.nextSibling)&&this.mirror.getId(e);return r},n=n=>{var s=Wr.parentNode(n);if(s&&Ji(n)&&"TEXTAREA"!==s.tagName){var a=$r(s)?this.mirror.getId(Zi(n)):this.mirror.getId(s),o=i(n);if(-1===a||-1===o)return r.addNode(n);var u=Mi(n,{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:t=>{qi(t,this.mirror)&&this.iframeManager.addIframe(t),Hi(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Gi(n)&&this.shadowDomManager.addShadowRoot(Wr.shadowRoot(n),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});u&&(t.push({parentId:a,nextId:o,node:u}),e.add(u.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)rn(this.removesSubTreeCache,s)&&!this.movedSet.has(Wr.parentNode(s))||n(s);for(var a of this.addedSet)nn(this.droppedSet,a)||rn(this.removesSubTreeCache,a)?nn(this.movedSet,a)?n(a):this.droppedSet.add(a):n(a);for(var o=null;r.length;){var u=null;if(o){var l=this.mirror.getId(Wr.parentNode(o.value)),h=i(o.value);-1!==l&&-1!==h&&(u=o)}if(!u)for(var d=r.tail;d;){var c=d;if(d=d.previous,c){var v=this.mirror.getId(Wr.parentNode(c.value));if(-1===i(c.value))continue;if(-1!==v){u=c;break}var f=Wr.parentNode(c.value);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var p=Wr.host(f);if(-1!==this.mirror.getId(p)){u=c;break}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}o=u.previous,r.removeNode(u.value),n(u.value)}var m={texts:this.texts.map((t=>{var e=t.node,r=Wr.parentNode(e);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(e),value:t.value}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),attributes:this.attributes.map((t=>{var e=t.attributes;if("string"==typeof e.style){var r=JSON.stringify(t.styleDiff),i=JSON.stringify(t._unchangedStyles);e.style.length>r.length&&(r+i).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}return{id:this.mirror.getId(t.node),attributes:e}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),removes:this.removes,adds:t};(m.texts.length||m.attributes.length||m.removes.length||m.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(m))}})),br(this,"bufferBelongsToIframe",(t=>this.doc===t.contentDocument)),br(this,"genTextAreaValueMutation",(t=>{var e=this.attributeMap.get(t);e||(this.attributes.push(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t,e));var r=Array.from(Wr.childNodes(t),(t=>Wr.textContent(t)||"")).join("");e.attributes.value=Hr({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Zr(t),value:r,maskInputFn:this.maskInputFn})})),br(this,"processMutation",(t=>{if(!Ui(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":var e=Wr.textContent(t.target);$i(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:gi(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Bi(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break;case"attributes":var r=t.target,i=t.attributeName,n=t.target.getAttribute(i);if("value"===i){var s=Zr(r);n=Hr({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if($i(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;var a=this.attributeMap.get(t.target);if("IFRAME"===r.tagName&&"src"===i&&!this.keepIframeSrcFn(n)){if(r.contentDocument)return;i="rr_src"}if(a||(this.attributes.push(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t.target,a)),"type"===i&&"INPUT"===r.tagName&&"password"===(t.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!pi(r.tagName,i))if(a.attributes[i]=fi(this.doc,Gr(r.tagName),Gr(i),n,r,this.dataURLOptions),"style"===i){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}var o=this.unattachedDoc.createElement("span");for(var u of(t.oldValue&&(o.style.cssText=t.oldValue),Array.from(r.style))){var l=r.style.getPropertyValue(u),h=r.style.getPropertyPriority(u);l!==o.style.getPropertyValue(u)||h!==o.style.getPropertyPriority(u)?a.styleDiff[u]=""===h?l:[l,h]:a._unchangedStyles[u]=[l,h]}for(var d of Array.from(o.style))""===r.style.getPropertyValue(d)&&(a.styleDiff[d]=!1)}else"open"===i&&"DIALOG"===r.tagName&&(a.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if($i(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach((e=>this.genAdds(e,t.target))),t.removedNodes.forEach((e=>{var r=this.mirror.getId(e),i=$r(t.target)?this.mirror.getId(Wr.host(t.target)):this.mirror.getId(t.target);$i(t.target,this.blockClass,this.blockSelector,!1)||Ui(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(en(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||zi(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Ki(r,i)]?en(this.movedSet,e):(this.removes.push({parentId:i,id:r,isShadow:!(!$r(t.target)||!Ur(t.target))||void 0}),function(t,e){for(var r=[t];r.length;){var i=r.pop();e.has(i)||(e.add(i),Wr.childNodes(i).forEach((t=>r.push(t))))}}(e,this.removesSubTreeCache))),this.mapRemoves.push(e))}))}})),br(this,"genAdds",((t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Ui(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);var r=null;e&&this.mirror.hasNode(e)&&(r=this.mirror.getId(e)),r&&-1!==r&&(this.movedMap[Ki(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);$i(t,this.blockClass,this.blockSelector,!1)||(Wr.childNodes(t).forEach((t=>this.genAdds(t))),Gi(t)&&Wr.childNodes(Wr.shadowRoot(t)).forEach((e=>{this.processedNodeManager.add(e,this),this.genAdds(e,t)})))}}}))}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((e=>{this[e]=t[e]})),this.canvasManager.acquire()}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.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function en(t,e){t.delete(e),Wr.childNodes(e).forEach((e=>en(t,e)))}function rn(t,e,r){return 0!==t.size&&function(t,e,r){var i=Wr.parentNode(e);return!!i&&t.has(i)}(t,e)}function nn(t,e){return 0!==t.size&&sn(t,e)}function sn(t,e){var r=Wr.parentNode(e);return!!r&&(!!t.has(r)||sn(t,r))}var an=t=>Yi?function(){try{return t(...arguments)}catch(t){if(Yi&&!0===Yi(t))return;throw t}}:t,on=[];function un(t){try{if("composedPath"in t){var e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function ln(t,e){var r=new tn;on.push(r),r.init(t);var i=new(Dr())(an(r.processMutations.bind(r))),n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(n.attributeFilter=t.attributeFilter),i.observe(e,n),{observer:i,buffer:r}}function hn(t){var e=t.scrollCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling,o=new Map,u=t=>{var a=un(t);if(a&&!$i(a,n,s,!0)){var u,l,h=i.getId(a);if(a===r&&r.defaultView){var d=Di(r.defaultView);u=d.left,l=d.top}else u=a.scrollLeft,l=a.scrollTop;var c=u+","+l;o.get(h)!==c&&(o.set(h,c),e({id:h,x:u,y:l}))}},l=[Ri("scroll",an(Ni(an((t=>u(t))),a.scroll||100)),r)];return"onscrollend"in r&&l.push(Ri("scrollend",an(u),r)),()=>l.forEach((t=>t()))}function dn(t,e){for(var r=on.length-1;r>=0;r--){var i=on[r];if(i){var n=i.bufferBelongsToIframe(t);!n&&e&&e.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),on.splice(r,1))}}}var cn=["INPUT","TEXTAREA","SELECT"],vn=new WeakMap;function fn(t){return function t(e,r){if(yn("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||yn("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||yn("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||yn("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){var i=Array.from(e.parentRule.cssRules).indexOf(e);return r.unshift(i),t(e.parentRule,r)}if(e.parentStyleSheet){var n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);r.unshift(n)}return r}(t,[])}function pn(t,e,r){var i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}function mn(t,e){var r,i,n,s,a=t.stylesheetManager;s=t.mirror.getId("#document"===e.nodeName?e:Wr.host(e));var o="#document"===e.nodeName?null==(r=e.defaultView)?void 0:r.Document:null==(n=null==(i=e.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,u=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&u?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var t;return null==(t=u.get)?void 0:t.call(this)},set(t){var e,r;try{r=null==(e=u.set)?void 0:e.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==s&&-1!==s)try{a.adoptStyleSheets(t,s)}catch(t){}return r}}),an((()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function gn(t,e){void 0===e&&(e={});var r,i,n=t.doc.defaultView;if(!n)return()=>{};if(function(t,e){var r=t.mutationCb,i=t.mousemoveCb,n=t.mouseInteractionCb,s=t.scrollCb,a=t.viewportResizeCb,o=t.inputCb,u=t.mediaInteractionCb,l=t.styleSheetRuleCb,h=t.styleDeclarationCb,d=t.canvasMutationCb,c=t.fontCb,v=t.selectionCb,f=t.customElementCb;t.mutationCb=function(){e.mutation&&e.mutation(...arguments),r(...arguments)},t.mousemoveCb=function(){e.mousemove&&e.mousemove(...arguments),i(...arguments)},t.mouseInteractionCb=function(){e.mouseInteraction&&e.mouseInteraction(...arguments),n(...arguments)},t.scrollCb=function(){e.scroll&&e.scroll(...arguments),s(...arguments)},t.viewportResizeCb=function(){e.viewportResize&&e.viewportResize(...arguments),a(...arguments)},t.inputCb=function(){e.input&&e.input(...arguments),o(...arguments)},t.mediaInteractionCb=function(){e.mediaInteaction&&e.mediaInteaction(...arguments),u(...arguments)},t.styleSheetRuleCb=function(){e.styleSheetRule&&e.styleSheetRule(...arguments),l(...arguments)},t.styleDeclarationCb=function(){e.styleDeclaration&&e.styleDeclaration(...arguments),h(...arguments)},t.canvasMutationCb=function(){e.canvasMutation&&e.canvasMutation(...arguments),d(...arguments)},t.fontCb=function(){e.font&&e.font(...arguments),c(...arguments)},t.selectionCb=function(){e.selection&&e.selection(...arguments),v(...arguments)},t.customElementCb=function(){e.customElement&&e.customElement(...arguments),f(...arguments)}}(t,e),t.recordDOM){var s=ln(t,t.doc);r=s.observer,i=s.buffer}var a,o,l,h,d,c,v,f,p,m=function(t){var e=t.mousemoveCb,r=t.sampling,i=t.doc,n=t.mirror;if(!1===r.mousemove)return()=>{};var s,a="number"==typeof r.mousemove?r.mousemove:50,o="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,u=[],l=Ni(an((t=>{var r=Date.now()-s;e(u.map((t=>(t.timeOffset-=r,t))),t),u=[],s=null})),o),h=an(Ni(an((t=>{var e=un(t),r=ji(t)?t.changedTouches[0]:t,i=r.clientX,a=r.clientY;s||(s=Fi()),u.push({x:i,y:a,id:n.getId(e),timeOffset:Fi()-s}),l("undefined"!=typeof DragEvent&&t instanceof DragEvent?_r.Drag:t instanceof MouseEvent?_r.MouseMove:_r.TouchMove)})),a,{trailing:!1})),d=[Ri("mousemove",h,i),Ri("touchmove",h,i),Ri("drag",h,i)];return an((()=>{d.forEach((t=>t()))}))}(t),g=function(t){var e=t.mouseInteractionCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling;if(!1===a.mouseInteraction)return()=>{};var o=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,l=[],h=null;return Object.keys(Sr).filter((t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t])).forEach((t=>{var a=Gr(t),o=(t=>r=>{var a=un(r);if(!$i(a,n,s,!0)){var o=null,l=t;if("pointerType"in r){switch(r.pointerType){case"mouse":o=Ir.Mouse;break;case"touch":o=Ir.Touch;break;case"pen":o=Ir.Pen}o===Ir.Touch&&(Sr[t]===Sr.MouseDown?l="TouchStart":Sr[t]===Sr.MouseUp&&(l="TouchEnd"))}else ji(r)&&(o=Ir.Touch);null!==o?(h=o,(l.startsWith("Touch")&&o===Ir.Touch||l.startsWith("Mouse")&&o===Ir.Mouse)&&(o=null)):Sr[t]===Sr.Click&&(o=h,h=null);var d=ji(r)?r.changedTouches[0]:r;if(d){var c=i.getId(a),v=d.clientX,f=d.clientY;an(e)(u({type:Sr[l],id:c,x:v,y:f},null!==o&&{pointerType:o}))}}})(t);if(window.PointerEvent)switch(Sr[t]){case Sr.MouseDown:case Sr.MouseUp:a=a.replace("mouse","pointer");break;case Sr.TouchStart:case Sr.TouchEnd:return}l.push(Ri(a,o,r))})),an((()=>{l.forEach((t=>t()))}))}(t),y=hn(t),w=function(t,e){var r=t.viewportResizeCb,i=e.win,n=-1,s=-1;return Ri("resize",an(Ni(an((()=>{var t=Pi(),e=Wi();n===t&&s===e||(r({width:Number(e),height:Number(t)}),n=t,s=e)})),200)),i)}(t,{win:n}),b=function(t){var e=t.inputCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.ignoreClass,o=t.ignoreSelector,l=t.maskInputOptions,h=t.maskInputFn,d=t.userTriggeredOnInput;function c(t){var e=un(t),i=t.isTrusted,u=r.defaultView;if(!e||!u||e instanceof u.HTMLElement){var c=e&&e.tagName;if(e&&"OPTION"===c&&(e=Wr.parentElement(e)),e&&c&&cn.indexOf(c)>=0&&!$i(e,n,s,!0)&&!(e.classList.contains(a)||o&&e.matches(o))){var f=e.value,p=!1,m=Zr(e)||"";"radio"===m||"checkbox"===m?p=e.checked:(l[c.toLowerCase()]||l[m])&&(f=Hr({element:e,maskInputOptions:l,tagName:c,type:m,value:f,maskInputFn:h})),v(e,d?{text:f,isChecked:p,userTriggered:i}:{text:f,isChecked:p});var g=e.name;"radio"===m&&g&&p&&r.querySelectorAll('input[type="radio"][name="'+g+'"]').forEach((t=>{if(t!==e){var r=t.value;v(t,d?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}}))}}}function v(t,r){var n=vn.get(t);if(!n||n.text!==r.text||n.isChecked!==r.isChecked){vn.set(t,r);var s=i.getId(t);an(e)(u({},r,{id:s}))}}var f=("last"===t.sampling.input?["change"]:["input","change"]).map((t=>Ri(t,an(c),r))),p=r.defaultView;if(!p)return()=>{f.forEach((t=>t()))};var m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value");return m&&m.set&&f.push(...[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]].map((t=>Li(t[0],t[1],{set(){an(c)({target:this,isTrusted:!1})}},!1,p)))),an((()=>{f.forEach((t=>t()))}))}(t),k=(o=(a=t).mediaInteractionCb,l=a.blockClass,h=a.blockSelector,d=a.mirror,c=a.sampling,v=a.doc,f=an((t=>Ni(an((e=>{var r=un(e);if(r&&!$i(r,l,h,!0)){var i=r.currentTime,n=r.volume,s=r.muted,a=r.playbackRate,u=r.loop;o({type:t,id:d.getId(r),currentTime:i,volume:n,muted:s,playbackRate:a,loop:u})}})),c.media||500))),p=[Ri("play",f(Cr.Play),v),Ri("pause",f(Cr.Pause),v),Ri("seeked",f(Cr.Seeked),v),Ri("volumechange",f(Cr.VolumeChange),v),Ri("ratechange",f(Cr.RateChange),v)],an((()=>{p.forEach((t=>t()))}))),_=()=>{},S=()=>{},I=()=>{},M=()=>{};t.recordDOM&&(_=function(t,e){var r=t.styleSheetRuleCb,i=t.mirror,n=t.stylesheetManager,s=e.win;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:an(((t,e,s)=>{var a=s[0],o=s[1],u=pn(e,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:o}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.addRule=function(t,e,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[t+" { "+e+" }",r])};var o,u,l=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(l,{apply:an(((t,e,s)=>{var a=s[0],o=pn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:a}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.removeRule=function(t){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},s.CSSStyleSheet.prototype.replace&&(o=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:an(((t,e,s)=>{var a=s[0],o=pn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replace:a}),t.apply(e,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:an(((t,e,s)=>{var a=s[0],o=pn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replaceSync:a}),t.apply(e,s)}))}));var h={};wn("CSSGroupingRule")?h.CSSGroupingRule=s.CSSGroupingRule:(wn("CSSMediaRule")&&(h.CSSMediaRule=s.CSSMediaRule),wn("CSSConditionRule")&&(h.CSSConditionRule=s.CSSConditionRule),wn("CSSSupportsRule")&&(h.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(h).forEach((t=>{var e=t[0],s=t[1];d[e]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[e].insertRule,{apply:an(((t,e,s)=>{var a=s[0],o=s[1],u=pn(e.parentStyleSheet,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:[...fn(e),o||0]}]}),t.apply(e,s)}))}),s.prototype.deleteRule=new Proxy(d[e].deleteRule,{apply:an(((t,e,s)=>{var a=s[0],o=pn(e.parentStyleSheet,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:[...fn(e),a]}]}),t.apply(e,s)}))})})),an((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=l,o&&(s.CSSStyleSheet.prototype.replace=o),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(h).forEach((t=>{var e=t[0],r=t[1];r.prototype.insertRule=d[e].insertRule,r.prototype.deleteRule=d[e].deleteRule}))}))}(t,{win:n}),S=mn(t,t.doc),I=function(t,e){var r=t.styleDeclarationCb,i=t.mirror,n=t.ignoreCSSAttributes,s=t.stylesheetManager,a=e.win,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:an(((t,e,a)=>{var u,l=a[0],h=a[1],d=a[2];if(n.has(l))return o.apply(e,[l,h,d]);var c=pn(null==(u=e.parentRule)?void 0:u.parentStyleSheet,i,s.styleMirror),v=c.id,f=c.styleId;return(v&&-1!==v||f&&-1!==f)&&r({id:v,styleId:f,set:{property:l,value:h,priority:d},index:fn(e.parentRule)}),t.apply(e,a)}))});var u=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:an(((t,e,a)=>{var o,l=a[0];if(n.has(l))return u.apply(e,[l]);var h=pn(null==(o=e.parentRule)?void 0:o.parentStyleSheet,i,s.styleMirror),d=h.id,c=h.styleId;return(d&&-1!==d||c&&-1!==c)&&r({id:d,styleId:c,remove:{property:l},index:fn(e.parentRule)}),t.apply(e,a)}))}),an((()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=u}))}(t,{win:n}),t.collectFonts&&(M=function(t){var e=t.fontCb,r=t.doc,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,a=i.FontFace;i.FontFace=function(t,e,r){var i=new a(t,e,r);return s.set(i,{family:t,buffer:"string"!=typeof e,descriptors:r,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};var o=Pr(r.fonts,"add",(function(t){return function(r){return setTimeout(an((()=>{var t=s.get(r);t&&(e(t),s.delete(r))})),0),t.apply(this,[r])}}));return n.push((()=>{i.FontFace=a})),n.push(o),an((()=>{n.forEach((t=>t()))}))}(t)));var C=function(t){var e=t.doc,r=t.mirror,i=t.blockClass,n=t.blockSelector,s=t.selectionCb,a=!0,o=an((()=>{var t=e.getSelection();if(!(!t||a&&(null==t?void 0:t.isCollapsed))){a=t.isCollapsed||!1;for(var o=[],u=t.rangeCount||0,l=0;u>l;l++){var h=t.getRangeAt(l),d=h.startContainer,c=h.startOffset,v=h.endContainer,f=h.endOffset;$i(d,i,n,!0)||$i(v,i,n,!0)||o.push({start:r.getId(d),startOffset:c,end:r.getId(v),endOffset:f})}s({ranges:o})}}));return o(),Ri("selectionchange",o)}(t),x=function(t){var e=t.customElementCb,r=t.doc.defaultView;return r&&r.customElements?Pr(r.customElements,"define",(function(t){return function(r,i,n){try{e({define:{name:r}})}catch(t){console.warn("Custom element callback failed for "+r)}return t.apply(this,[r,i,n])}})):()=>{}}(t),R=[];for(var T of t.plugins)R.push(T.observer(T.callback,n,T.options));return an((()=>{if(i){i.destroy(),i.reset();var e=on.indexOf(i);-1!==e&&on.splice(e,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect(),m(),g(),y(),w(),b(),k(),_(),S(),I(),M(),C(),x(),R.forEach((t=>t()))}))}function yn(t){return void 0!==window[t]}function wn(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class bn{constructor(t){br(this,"iframeIdToRemoteIdMap",new WeakMap),br(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,r,i){var n=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=n.get(e);return a||(a=this.generateIdFn(),n.set(e,a),s.set(a,e)),a}getIds(t,e){var r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return e.map((e=>this.getId(t,e,r,i)))}getRemoteId(t,e,r){var i=r||this.getRemoteIdToIdMap(t);return"number"!=typeof e?e:i.get(e)||-1}getRemoteIds(t,e){var r=this.getRemoteIdToIdMap(t);return e.map((e=>this.getRemoteId(t,e,r)))}reset(t){if(!t)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){var e=this.iframeIdToRemoteIdMap.get(t);return e||this.iframeIdToRemoteIdMap.set(t,e=new Map),e}getRemoteIdToIdMap(t){var e=this.iframeRemoteIdToIdMap.get(t);return e||this.iframeRemoteIdToIdMap.set(t,e=new Map),e}}class kn{constructor(t){br(this,"iframes",new WeakMap),br(this,"crossOriginIframeMap",new WeakMap),br(this,"crossOriginIframeMirror",new bn(oi)),br(this,"crossOriginIframeStyleMirror"),br(this,"crossOriginIframeRootIdMap",new WeakMap),br(this,"mirror"),br(this,"mutationCb"),br(this,"wrappedEmit"),br(this,"loadListener"),br(this,"pageHideListener"),br(this,"stylesheetManager"),br(this,"recordCrossOriginIframes"),br(this,"messageHandler"),br(this,"nestedIframeListeners",new Map),br(this,"attachedWindows",new WeakMap),br(this,"attachedDocuments",new WeakMap),br(this,"attachedIframes",new Map),br(this,"loadListenerDisposers",new WeakMap),br(this,"iframeElementsById",new Map),br(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new bn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){var r=this.loadListenerDisposers.get(t);r||this.loadListenerDisposers.set(t,r=new Set),r.add(e);var i=this.mirror.getId(t);-1!==i&&this.iframeElementsById.set(i,t)}getIframeElementById(t){var e,r,i;return null!==(e=null!==(r=null==(i=this.attachedIframes.get(t))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){var e=this.loadListenerDisposers.get(t);e&&(e.forEach((t=>Oi(t))),this.loadListenerDisposers.delete(t))}removePageHideListener(t){var e=this.pageHideHandlers.get(t);e&&(e.forEach((t=>{Ti(t.win,"pagehide",t.handler)})),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){var r=this.mirror.getId(t);return this.attachedIframes.set(r,{element:t,content:e}),r}attachIframe(t,e){var r,i=this.trackIframeContent(t,e);if(t.contentDocument){var n=this.attachedDocuments.get(t);n||this.attachedDocuments.set(t,n=new Set),n.add(t.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var a=this.handleMessage.bind(this);Oi((()=>{s.addEventListener("message",a),this.nestedIframeListeners.set(s,a);var e=this.attachedWindows.get(t);e||this.attachedWindows.set(t,e=new Set),e.add(s)}))}Oi((()=>{var e=t.contentWindow;if(e){var r=this.pageHideHandlers.get(t);if(r)for(var i of r)if(i.win===e)return;var n=()=>{var e;null==(e=this.pageHideListener)||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument),t.contentWindow&&this.crossOriginIframeMap.delete(t.contentWindow)};e.addEventListener("pagehide",n),r||this.pageHideHandlers.set(t,r=new Set),r.add({win:e,handler:n})}})),null==(r=this.loadListener)||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){var e=t;if("rrweb"===e.data.type&&e.origin===e.data.origin&&t.source){var r=this.crossOriginIframeMap.get(t.source);if(r){var i=this.transformCrossOriginEvent(r,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}}transformCrossOriginEvent(t,e){var r;switch(e.type){case kr.FullSnapshot:this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);var i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:kr.IncrementalSnapshot,data:{source:_r.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case kr.Meta:case kr.Load:case kr.DomContentLoaded:return!1;case kr.Plugin:return e;case kr.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case kr.IncrementalSnapshot:switch(e.data.source){case _r.Mutation:return e.data.adds.forEach((e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);var r=this.crossOriginIframeRootIdMap.get(t);r&&this.patchRootIdOnNode(e.node,r)})),e.data.removes.forEach((e=>{this.replaceIds(e,t,["parentId","id"])})),e.data.attributes.forEach((e=>{this.replaceIds(e,t,["id"])})),e.data.texts.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case _r.Drag:case _r.TouchMove:case _r.MouseMove:return e.data.positions.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case _r.ViewportResize:return!1;case _r.MediaInteraction:case _r.MouseInteraction:case _r.Scroll:case _r.CanvasMutation:case _r.Input:return this.replaceIds(e.data,t,["id"]),e;case _r.StyleSheetRule:case _r.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case _r.Font:return e;case _r.Selection:return e.data.ranges.forEach((e=>{this.replaceIds(e,t,["start","end"])})),e;case _r.AdoptedStyleSheet:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null==(r=e.data.styles)||r.forEach((e=>{this.replaceStyleIds(e,t,["styleId"])})),e}}return!1}replace(t,e,r,i){for(var n of i)(Array.isArray(e[n])||"number"==typeof e[n])&&(e[n]=Array.isArray(e[n])?t.getIds(r,e[n]):t.getId(r,e[n]));return e}replaceIds(t,e,r){return this.replace(this.crossOriginIframeMirror,t,e,r)}replaceStyleIds(t,e,r){return this.replace(this.crossOriginIframeStyleMirror,t,e,r)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach((t=>{this.replaceIdOnNode(t,e)}))}patchRootIdOnNode(t,e){t.type===xr.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach((t=>{this.patchRootIdOnNode(t,e)}))}removeIframeById(t){var e=this.attachedIframes.get(t),r=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),r){var i=r.contentWindow,n=this.attachedWindows.get(r);n&&(n.forEach((t=>{var e=this.nestedIframeListeners.get(t);e&&(Ti(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(Ti(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((t=>{Oi((()=>this.mirror.removeNodeFromMap(t)))})),Oi((()=>dn(r,s))),this.attachedDocuments.delete(r))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var t=[];this.attachedIframes.forEach(((e,r)=>{this.mirror.has(r)||t.push(r)})),t.forEach((t=>this.removeIframeById(t)))}}reattachIframes(){this.attachedIframes.forEach(((t,e)=>{var r=t.content;this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)}))}destroy(){this.recordCrossOriginIframes&&Ti(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((t,e)=>{Ti(e,"message",t)})),this.nestedIframeListeners.clear();var t=new Set;this.iframeElementsById.forEach((e=>t.add(e))),this.attachedIframes.forEach((e=>t.add(e.element))),t.forEach((t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)})),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}}class _n{constructor(t){br(this,"shadowDoms",new WeakSet),br(this,"mutationCb"),br(this,"scrollCb"),br(this,"bypassOptions"),br(this,"mirror"),br(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var r,i;if(Ur(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var n=null!==(r=null==(i=Wr.host(t))?void 0:i.ownerDocument)&&void 0!==r?r:e,s=ln(u({},this.bypassOptions,{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),a=s.observer,o=s.buffer;this.restoreHandlers.push({doc:n,handler(){a.disconnect(),o.destroy(),o.releaseCanvasManager();var t=on.indexOf(o);-1!==t&&on.splice(t,1)}}),this.restoreHandlers.push({doc:n,handler:hn(u({},this.bypassOptions,{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout((()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(Wr.host(t))),this.restoreHandlers.push({doc:n,handler:mn({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})}),0)}}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){var r=this;this.restoreHandlers.push({doc:e,handler:Pr(t.prototype,"attachShadow",(function(t){return function(i){var n=t.call(this,i),s=Wr.shadowRoot(this);return s&&Ji(this)&&r.addShadowRoot(s,e),n}}))})}reset(){this.restoreHandlers.forEach((t=>{var e=t.handler;try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){var e=[];for(var r of this.restoreHandlers)if(r.doc===t)try{r.handler()}catch(t){}else e.push(r);this.restoreHandlers=e}}for(var Sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",In="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Mn=0;64>Mn;Mn++)In[Sn.charCodeAt(Mn)]=Mn;var Cn=new Map,xn=(t,e,r)=>{if(t&&(On(t,e)||"object"==typeof t)){var i=function(t,e){var r=Cn.get(t);return r||Cn.set(t,r=new Map),r.has(e)||r.set(e,[]),r.get(e)}(r,t.constructor.name),n=i.indexOf(t);return-1===n&&(n=i.length,i.push(t)),n}};function Rn(t,e,r,i){if(t instanceof Array)return t.map((t=>Rn(t,e,r,i)));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){var n=t.constructor.name,s=function(t){var e,r=new Uint8Array(t),i=r.length,n="";for(e=0;i>e;e+=3)n+=Sn[r[e]>>2],n+=Sn[(3&r[e])<<4|r[e+1]>>4],n+=Sn[(15&r[e+1])<<2|r[e+2]>>6],n+=Sn[63&r[e+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(t);return{rr_type:n,base64:s}}return t instanceof DataView?{rr_type:t.constructor.name,args:[Rn(t.buffer,e,r,i),t.byteOffset,t.byteLength]}:t instanceof HTMLImageElement?{rr_type:t.constructor.name,src:t.src}:t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[Rn(t.data,e,r,i),t.width,t.height]}:On(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:xn(t,e,r)}:t}var Tn=(t,e,r,i)=>t.map((t=>Rn(t,e,r,i))),On=(t,e)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((t=>"function"==typeof e[t]));return Boolean(r.find((r=>t instanceof e[r])))},An=["webgl","webgl2"];function En(t){return"nodeType"in t}function Nn(t,e,r,i){var n=[];try{if(i){var s=function(t,e,r){var i=t.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return Pr(i.prototype,"configure",(function(i){return function(n){var s=function(t){var e=t.canvas;return e&&"object"==typeof e?e:null}(this);if(!s||En(s)&&$i(s,e,r,!0))return i.call(this,n);En(s)&&!("__context"in s)&&(s.__context="webgpu");var a=function(t){var e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return i.call(this,null!==a&&n?u({},n,{usage:"number"==typeof n.usage?n.usage|a:a}):n)}}))}(t,e,r);s&&n.push(s)}var a=Pr(t.HTMLCanvasElement.prototype,"getContext",(function(t){return function(n){for(var s=function(t){return"experimental-webgl"===t?"webgl":t}(n),a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];if(!$i(this,e,r,!0)&&("__context"in this||(this.__context=s),i&&An.includes(s)))if(o[0]&&"object"==typeof o[0]){var l=o[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[n,...o])}}));n.push(a)}catch(t){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach((t=>t()))}}function Ln(t,e,r,i,n,s,a){var o=[],u=Object.getOwnPropertyNames(t),l=function(u){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))return 0;try{if("function"!=typeof t[u])return 0;var l=Pr(t,u,(function(t){return function(){for(var o=arguments.length,l=new Array(o),h=0;o>h;h++)l[h]=arguments[h];var d=t.apply(this,l);if(xn(d,s,this),"tagName"in this.canvas&&!$i(this.canvas,i,n,!0)){var c=Tn(l,s,this,a);r(this.canvas,{type:e,property:u,args:c})}return d}}));o.push(l)}catch(i){var h=Li(t,u,{set(t){r(this.canvas,{type:e,property:u,args:[t],setter:!0})}});o.push(h)}};for(var h of u)l(h);return o}var Fn,Dn,Pn,Wn='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentFingerprintMap = /* @__PURE__ */ new Map();\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n return worker.postMessage({ id });\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\n lastFingerprintMap.set(id, fingerprint);\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-CZCeNtwG.js.map\n',Bn="undefined"!=typeof self&&self.Blob&&new Blob([Wn],{type:"text/javascript;charset=utf-8"});function $n(t){var e;try{if(!(e=Bn&&(self.URL||self.webkitURL).createObjectURL(Bn)))throw"";var r=new Worker(e,{name:null==t?void 0:t.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),r}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Wn),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class Un{constructor(t){br(this,"pendingCanvasMutations",new Map),br(this,"rafStamps",{latestId:0,invokeId:null}),br(this,"mirror"),br(this,"mutationCb"),br(this,"resetObservers"),br(this,"frozen",!1),br(this,"locked",!1),br(this,"rafIdTimestamp",null),br(this,"rafIdFlush",null),br(this,"refCount",0),br(this,"torndown",!1),br(this,"processMutation",((t,e)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)}));var e=t.sampling,r=void 0===e?"all":e,i=t.win,n=t.blockClass,s=t.blockSelector,a=t.recordCanvas,o=t.dataURLOptions,u=t.resolutionScale;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&"all"===r&&this.initCanvasMutationObserver(i,n,s,o),a&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:o,resolutionScale:u})}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,e,r,i,n){var s=this;if("OffscreenCanvas"in e){var a,u="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,l=Nn(e,r,i,!0),h=new Map;try{a=new $n}catch(t){return}var d=!1;a.onerror=()=>{var t;d=!0,cancelAnimationFrame(c),null==(t=a.terminate)||t.call(a)},a.onmessage=t=>{var e=t.data.id;if(h.set(e,!1),"base64"in t.data){var r=t.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:e,type:Mr["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var c,v=1e3/t,f=0,p=t=>{var l,m;d||(f&&v>t-f||(f=t,(l=[],m=t=>{try{t.querySelectorAll("canvas").forEach((t=>{$i(t,r,i,!0)||l.push(t)})),t.querySelectorAll("*").forEach((t=>{t.shadowRoot&&m(t.shadowRoot)}))}catch(t){}},m(e.document),l).forEach(function(){var t=o((function*(t){var e,r,i=s.mirror.getId(t);if(!h.get(i)&&0!==t.width&&0!==t.height){h.set(i,!0);try{if(["webgl","webgl2"].includes(t.__context)){var o=t.getContext(t.__context);if(null==(e=null==o?void 0:o.isContextLost)?void 0:e.call(o))return void h.set(i,!1);!1===(null==(r=null==o?void 0:o.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&o.clear(o.COLOR_BUFFER_BIT)}var l=t.clientWidth||t.width,d=t.clientHeight||t.height,c=Math.max(1,Math.round(l*u)),v=Math.max(1,Math.round(d*u)),f=yield createImageBitmap(t,1>u?{resizeWidth:c,resizeHeight:v,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:v});a.postMessage({id:i,bitmap:f,width:c,height:v,displayWidth:l,displayHeight:d,dataURLOptions:n.dataURLOptions},[f])}catch(t){h.set(i,!1)}}}));return function(e){return t.apply(this,arguments)}}())),c=requestAnimationFrame(p))};c=requestAnimationFrame(p),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(c),null==(t=a.terminate)||t.call(a)}}}initCanvasMutationObserver(t,e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=Nn(t,e,r,!1),s=function(t,e,r,i,n){var s=[],a=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),o=function(a){try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])return 1;var o=Pr(e.CanvasRenderingContext2D.prototype,a,(function(s){return function(){for(var o=arguments.length,u=new Array(o),l=0;o>l;l++)u[l]=arguments[l];return $i(this.canvas,r,i,!0)||setTimeout((()=>{var r=Tn(u,e,this,n);t(this.canvas,{type:Mr["2D"],property:a,args:r})}),0),s.apply(this,u)}}));s.push(o)}catch(r){var u=Li(e.CanvasRenderingContext2D.prototype,a,{set(e){t(this.canvas,{type:Mr["2D"],property:a,args:[e],setter:!0})}});s.push(u)}};for(var u of a)o(u);return()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i),a=function(t,e,r,i,n){var s=[];return void 0!==e.WebGLRenderingContext&&s.push(...Ln(e.WebGLRenderingContext.prototype,Mr.WebGL,t,r,i,e,n)),void 0!==e.WebGL2RenderingContext&&s.push(...Ln(e.WebGL2RenderingContext.prototype,Mr.WebGL2,t,r,i,e,n)),()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i);this.resetObservers=()=>{n(),s(),a()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((t,e)=>{var r=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(t,e){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(t);if(r&&-1!==e){var i=r.map((t=>function(t,e){if(null==t)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;r[i]=t[i]}return r}(t,yr)));this.mutationCb({id:e,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(t)}}}}class zn{constructor(t){br(this,"trackedLinkElements",new WeakSet),br(this,"mutationCb"),br(this,"adoptedStyleSheetCb"),br(this,"styleMirror",new Vi),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){var r=this;if(0!==t.length){var i={id:e,styleIds:[]},n=[],s=function(t){var e;r.styleMirror.has(t)?e=r.styleMirror.getId(t):(e=r.styleMirror.add(t),n.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,r)=>({rule:jr(e,t.href),index:r})))})),i.styleIds.push(e)};for(var a of t)s(a);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,wi.forEach((t=>t.abort())),wi.clear()}trackStylesheetInLinkElement(t){}}class jn{constructor(){br(this,"nodeMap",new WeakMap),br(this,"active",!1)}inOtherBuffer(t,e){var r=this.nodeMap.get(t);return r&&Array.from(r).some((t=>t!==e))}add(t,e){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}}var qn=!1;try{if(2!==Array.from([1],(t=>2*t))[0]){var Hn=document.createElement("iframe");document.body.appendChild(Hn),Array.from=(null==(gr=Hn.contentWindow)?void 0:gr.Array.from)||Array.from,document.body.removeChild(Hn)}}catch(t){console.debug("Unable to override Array.from",t)}var Gn=new qr,Vn=new Set([_r.Mutation,_r.MediaInteraction,_r.StyleSheetRule,_r.CanvasMutation,_r.Font,_r.Log,_r.StyleDeclaration,_r.AdoptedStyleSheet]);function Zn(t){void 0===t&&(t={});var e=t,r=e.emit,i=e.checkoutEveryNms,n=e.checkoutEveryNth,s=e.blockClass,a=void 0===s?"rr-block":s,o=e.blockSelector,l=void 0===o?null:o,h=e.ignoreClass,d=void 0===h?"rr-ignore":h,c=e.ignoreSelector,v=void 0===c?null:c,f=e.maskTextClass,p=void 0===f?"rr-mask":f,m=e.maskTextSelector,g=void 0===m?null:m,y=e.inlineStylesheet,w=void 0===y||y,b=e.maskAllInputs,k=e.maskInputOptions,_=e.slimDOMOptions,S=e.maskInputFn,I=e.maskTextFn,M=e.hooks,C=e.packFn,x=e.sampling,R=void 0===x?{}:x,T=e.dataURLOptions,O=void 0===T?{}:T,A=e.canvasResolutionScale,E=e.mousemoveWait,N=e.recordDOM,L=void 0===N||N,F=e.recordCanvas,D=void 0!==F&&F,P=e.recordCrossOriginIframes,W=void 0!==P&&P,B=e.recordAfter,U=void 0===B?"DOMContentLoaded"===t.recordAfter?t.recordAfter:"load":B,z=e.userTriggeredOnInput,j=void 0!==z&&z,q=e.collectFonts,H=void 0!==q&&q,G=e.inlineImages,V=void 0!==G&&G,Z=e.plugins,J=e.keepIframeSrcFn,Q=void 0===J?()=>!1:J,X=e.ignoreCSSAttributes,Y=void 0===X?new Set([]):X,K=e.attributeFilter;Yi=e.errorHandler;var tt=u({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},O),et=!W||window.parent===window,rt=!1;if(!et)try{window.parent.document&&(rt=!1)}catch(t){rt=!0}if(et&&!r)throw new Error("emit function is required");if(!et&&!rt)return()=>{};void 0!==E&&void 0===R.mousemove&&(R.mousemove=E),Gn.reset();var it,nt=!0===b?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==k?k:{password:!0},st=Ci(void 0!==_&&_);!function(t){void 0===t&&(t=window),"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();var at,ot,ut=0,lt=new Map,ht=t=>{for(var e of Z||[])e.eventProcessor&&(t=e.eventProcessor(t));return C&&!rt&&(t=C(t)),t};Fn=(t,e)=>{var s,a=t;if(a.timestamp=Fi(),!(null==(s=on[0])?void 0:s.isFrozen())||a.type===kr.FullSnapshot||a.type===kr.IncrementalSnapshot&&Vn.has(a.data.source)||on.forEach((t=>t.unfreeze())),et)null==r||r(ht(a),e);else if(rt){var o={type:"rrweb",event:ht(a),origin:window.location.origin,isCheckout:e};window.parent.postMessage(o,"*")}if(a.type===kr.FullSnapshot)it=a,ut=0;else if(a.type===kr.IncrementalSnapshot){if(a.data.source===_r.Mutation&&a.data.isAttachIframe)return;ut++,(n&&ut>=n||i&&a.timestamp-it.timestamp>i)&&Dn(!0)}};var dt=t=>{if(t.removes&&t.removes.length>0){var e=t.adds.length>0?new Set(t.adds.map((t=>t.node.id))):null,r=new Set;if(t.adds.length>0)for(var i of t.adds){var n=Gn.getNode(i.node.id);n&&"IFRAME"===n.nodeName&&r.add(n)}t.removes.forEach((t=>{var i=t.id;if(!e||!e.has(i)){var n=pt.getIframeElementById(i);n&&r.has(n)?pt.forgetIframeId(i):(null==at||at(i),pt.removeIframeById(i))}})),null==ot||ot(),pt.cleanupDetachedIframes()}Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Mutation},t)})},ct=t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Scroll},t)}),vt=t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.CanvasMutation},t)}),ft=new zn({mutationCb:dt,adoptedStyleSheetCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.AdoptedStyleSheet},t)})}),pt=new kn({mirror:Gn,mutationCb:dt,stylesheetManager:ft,recordCrossOriginIframes:W,wrappedEmit:Fn});for(var mt of Z||[])mt.getMirror&&mt.getMirror({nodeMirror:Gn,crossOriginIframeMirror:pt.crossOriginIframeMirror,crossOriginIframeStyleMirror:pt.crossOriginIframeStyleMirror});var gt=new jn;Pn=new Un({recordCanvas:D,mutationCb:vt,win:window,blockClass:a,blockSelector:l,mirror:Gn,sampling:R.canvas,dataURLOptions:tt,resolutionScale:A});var yt=new _n({mutationCb:dt,scrollCb:ct,bypassOptions:{blockClass:a,blockSelector:l,maskTextClass:p,maskTextSelector:g,inlineStylesheet:w,maskInputOptions:nt,dataURLOptions:tt,maskTextFn:I,maskInputFn:S,recordCanvas:D,inlineImages:V,sampling:R,slimDOMOptions:st,iframeManager:pt,stylesheetManager:ft,canvasManager:Pn,keepIframeSrcFn:Q,processedNodeManager:gt,attributeFilter:K},mirror:Gn});Dn=function(t){if(void 0===t&&(t=!1),L){Fn({type:kr.Meta,data:{href:window.location.href,width:Wi(),height:Pi()}},t),ft.reset(),yt.init(),on.forEach((t=>t.lock()));var e=function(t,e){var r=e||{},i=r.mirror,n=void 0===i?new qr:i,s=r.blockClass,a=r.blockSelector,o=r.maskTextClass,u=r.maskTextSelector,l=r.inlineStylesheet,h=r.inlineImages,d=void 0!==h&&h,c=r.recordCanvas,v=void 0!==c&&c,f=r.maskAllInputs,p=void 0!==f&&f,m=r.slimDOM,g=r.dataURLOptions,y=r.preserveWhiteSpace,w=r.onSerialize,b=r.onIframeLoad,k=r.iframeLoadTimeout,_=r.onIframeListenerRegistered,S=r.onStylesheetLoad,I=r.stylesheetLoadTimeout,M=r.keepIframeSrcFn,C=void 0===M?()=>!1:M,x=r.maxDepth;return Mi(t,{doc:t,mirror:n,blockClass:void 0===s?"rr-block":s,blockSelector:void 0===a?null:a,maskTextClass:void 0===o?"rr-mask":o,maskTextSelector:void 0===u?null:u,skipChild:!1,inlineStylesheet:void 0===l||l,maskInputOptions:!0===p?{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===p?{password:!0}:p,maskTextFn:r.maskTextFn,maskInputFn:r.maskInputFn,slimDOMOptions:Ci(void 0!==m&&m),dataURLOptions:g,inlineImages:d,recordCanvas:v,preserveWhiteSpace:y,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:k,onIframeListenerRegistered:_,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:x})}(document,{mirror:Gn,blockClass:a,blockSelector:l,maskTextClass:p,maskTextSelector:g,inlineStylesheet:w,maskAllInputs:nt,maskTextFn:I,maskInputFn:S,slimDOM:st,dataURLOptions:tt,recordCanvas:D,inlineImages:V,onSerialize(t){qi(t,Gn)&&pt.addIframe(t),Hi(t,Gn)&&ft.trackLinkElement(t),Gi(t)&&yt.addShadowRoot(Wr.shadowRoot(t),document)},onIframeLoad(t,e){pt.attachIframe(t,e),yt.observeAttachShadow(t)},onIframeListenerRegistered(t,e){pt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){ft.attachLinkElement(t,e)},keepIframeSrcFn:Q});if(!e)return console.warn("Failed to snapshot the document");Fn({type:kr.FullSnapshot,data:{node:e,initialOffset:Di(window)}},t),on.forEach((t=>t.unlock())),W&&pt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ft.adoptStyleSheets(document.adoptedStyleSheets,Gn.getId(document))}};try{var wt=[];at=t=>{var e=lt.get(t);e&&(e.forEach((t=>{Oi(t);var e=wt.indexOf(t);-1!==e&&wt.splice(e,1)})),lt.delete(t))},ot=()=>{for(var t of lt){var e=t[0],r=Gn.getNode(e);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==at||at(e)}catch(t){null==at||at(e)}else null==at||at(e)}};var bt=t=>{var e;return an(gn)({mutationCb:dt,mousemoveCb:(t,e)=>Fn({type:kr.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.MouseInteraction},t)}),scrollCb:ct,viewportResizeCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.ViewportResize},t)}),inputCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Input},t)}),mediaInteractionCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.MediaInteraction},t)}),styleSheetRuleCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.StyleSheetRule},t)}),styleDeclarationCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.StyleDeclaration},t)}),canvasMutationCb:vt,fontCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Font},t)}),selectionCb(t){Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Selection},t)})},customElementCb(t){Fn({type:kr.IncrementalSnapshot,data:u({source:_r.CustomElement},t)})},blockClass:a,ignoreClass:d,ignoreSelector:v,maskTextClass:p,maskTextSelector:g,maskInputOptions:nt,inlineStylesheet:w,sampling:R,recordDOM:L,recordCanvas:D,inlineImages:V,userTriggeredOnInput:j,collectFonts:H,doc:t,maskInputFn:S,maskTextFn:I,keepIframeSrcFn:Q,blockSelector:l,slimDOMOptions:st,dataURLOptions:tt,mirror:Gn,iframeManager:pt,stylesheetManager:ft,shadowDomManager:yt,processedNodeManager:gt,canvasManager:Pn,ignoreCSSAttributes:Y,attributeFilter:K,plugins:(null==(e=null==Z?void 0:Z.filter((t=>t.observer)))?void 0:e.map((t=>({observer:t.observer,options:t.options,callback:e=>Fn({type:kr.Plugin,data:{plugin:t.name,payload:e}})}))))||[]},M)};pt.addLoadListener((t=>{try{var e=Gn.getId(t),r=bt(t.contentDocument);if(wt.push(r),-1!==e){var i=lt.get(e);i||lt.set(e,i=new Set),i.add(r)}}catch(t){console.warn(t)}})),pt.addPageHideListener((t=>{var e=Gn.getId(t);null==at||at(e),dn(t)}));var kt=-1,_t=t=>Fn({type:kr.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),St=()=>{var t,e,r,i,n=document,s=null!==(t=null!==(e=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==e?e:n.msFullscreenElement)&&void 0!==t?t:null,a=s?Gn.getId(s):-1;a!==kt&&(-1!==kt&&_t({id:kt,enter:!1}),kt=a,-1!==a&&_t({id:a,enter:!0}))},It=()=>{Dn(),wt.push(bt(document)),wt.push(Ri("fullscreenchange",St)),wt.push(Ri("webkitfullscreenchange",St)),wt.push(Ri("mozfullscreenchange",St)),wt.push(Ri("MSFullscreenChange",St)),qn=!0};return["interactive","complete"].includes(document.readyState)?It():(wt.push(Ri("DOMContentLoaded",(()=>{Fn({type:kr.DomContentLoaded,data:{}}),"DOMContentLoaded"===U&&It()}))),wt.push(Ri("load",(()=>{Fn({type:kr.Load,data:{}}),"load"===U&&It()}),window))),()=>{wt.forEach((t=>Oi(t))),gt.destroy(),pt.removeLoadListener(),pt.destroy(),lt.clear(),yt.reset(),Gn.reset(),qn=!1,Yi=void 0}}catch(t){console.warn(t)}}Zn.addCustomEvent=(t,e)=>{if(!qn)throw new Error("please add custom event after start recording");Fn({type:kr.Custom,data:{tag:t,payload:e}})},Zn.freezePage=()=>{on.forEach((t=>t.freeze()))},Zn.takeFullSnapshot=t=>{if(!qn)throw new Error("please take full snapshot after start recording");Dn(t)},Zn.mirror=Gn;var Jn=Object.defineProperty,Qn=(t,e,r)=>((t,e,r)=>e in t?Jn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class Xn{constructor(t){Qn(this,"fileName"),Qn(this,"functionName"),Qn(this,"lineNumber"),Qn(this,"columnNumber"),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){var t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+t+":"+e+")":this.fileName+":"+t+":"+e}}var Yn=/(^|@)\S+:\d+/,Kn=/^\s*at .*(\S+:\d+|\(native\))/m,ts=/^(eval@)?(\[native code])?$/,es={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Kn)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error("Cannot parse given url: "+t);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter((function(t){return!!t.match(Kn)}),this).map((function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=e.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(e=r?e.replace(r[0],""):e).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new Xn({functionName:s,fileName:a,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(t){return t.stack.split("\n").filter((function(t){return!t.match(ts)}),this).map((function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new Xn({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(e),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(t.replace(e,""));return new Xn({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,r=t.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Xn({fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera10(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=t.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Xn({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera11(t){return t.stack.split("\n").filter((function(t){return!!t.match(Yn)&&!t.match(/^Error created at/)}),this).map((function(t){var e=t.split("@"),r=this.extractLocation(e.pop()),i=(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Xn({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function rs(t){if(!t||!t.outerHTML)return"";for(var e="";t.parentElement;){var r=t.localName;if(!r)break;r=r.toLowerCase();var i=t.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var a=i.children[s];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===r&&n.push(a)}n.length>1&&(r+=":eq("+n.indexOf(t)+")"),e=r+(e?">"+e:""),t=i}return e}function is(t){return Array.isArray(t)}function ns(t){return"object"==typeof t&&null!==t&&!is(t)}function ss(t,e){if(0===e)return!0;var r=Object.keys(t);for(var i of r)if(ns(t[i])&&ss(t[i],e-1))return!0;return!1}function as(t,e){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,e);var i=[],n=[];return JSON.stringify(t,(function(t,e){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,t):n.push(t),~i.indexOf(e)&&(e=i[0]===e?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(e)).join(".")+"]")}else i.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(ns(a=e)&&Object.keys(a).length>r.numOfKeysLimit||"function"==typeof a||ns(a)&&ss(a,r.depthOfLimit))return function(t){var e=t.toString();return r.stringLengthLimit&&e.length>r.stringLengthLimit&&(e=e.slice(0,r.stringLengthLimit)+"..."),e}(e);var a;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){var o={};for(var u in e){var l=e[u];o[u]=is(l)?rs(l.length?l[0]:null):l}return o}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e}))}var os={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function us(t,e,r){var i,n=r?Object.assign({},os,r):os,s=n.logger;if(!s)return()=>{};i="string"==typeof s?e[s]:s;var a=0,o=!1,u=[];if(n.level.includes("error")){var l=e=>{var r=e.message,i=es.parse(e.error).map((t=>t.toString())),s=[as(r,n.stringifyOptions)];t({level:"error",trace:i,payload:s})};e.addEventListener("error",l),u.push((()=>{e.removeEventListener("error",l)}));var h=e=>{var r,i;e.reason instanceof Error?i=[as("Uncaught (in promise) "+(r=e.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[as("Uncaught (in promise)",n.stringifyOptions),as(e.reason,n.stringifyOptions)]);var s=es.parse(r).map((t=>t.toString()));t({level:"error",trace:s,payload:i})};e.addEventListener("unhandledrejection",h),u.push((()=>{e.removeEventListener("unhandledrejection",h)}))}for(var d of n.level)u.push(c(i,d));return()=>{u.forEach((t=>t()))};function c(e,r){var i=this;return e[r]?function(e,s,u){try{if(!(s in e))return()=>{};var l=e[s],h={next:l},d=(e=>function(){for(var s=arguments.length,u=new Array(s),l=0;s>l;l++)u[l]=arguments[l];if(e.apply(i,u),!("assert"===r&&u[0]||o)){o=!0;try{var h=es.parse(new Error).map((t=>t.toString())).splice(1),d=("assert"===r?u.slice(1):u).map((t=>as(t,n.stringifyOptions)));a++,n.lengthThreshold>a?t({level:r,trace:h,payload:d}):a===n.lengthThreshold&&t({level:"warn",trace:[],payload:[as("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...u)}finally{o=!1}}})((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return h.next.apply(this,e)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:l},__rrweb_layer__:{enumerable:!1,value:h}})),e[s]=d,()=>{if(e[s]!==d)for(var t=e[s];"function"==typeof t&&t.__rrweb_layer__;){var r=t.__rrweb_layer__;if(r.next===d)return void(r.next=h.next);t=r.next}else e[s]=h.next}}catch(t){return()=>{}}}(e,r):()=>{}}}var ls=t=>({name:"rrweb/console@1",observer:us,options:t}),hs=t=>"undefined"!=typeof Document&&t instanceof Document,ds=()=>{};function cs(t,e,r){try{if(!(e in t))return ds;var i={next:t[e]},n=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return i.next.apply(this,e)}));return b(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),t[e]=n,()=>{if(t[e]!==n)for(var r=t[e];b(r)&&r.__posthog_layer__;){var s=r.__posthog_layer__;if(s.next===n)return void(s.next=i.next);r=s.next}else t[e]=i.next}}catch(t){return ds}}function vs(t,e){var r,i=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),n={hostname:i,isHostDenied:!1};if(null==(r=e.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of e.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}var fs=F("[Recorder]"),ps=t=>"navigation"===t.entryType,ms=t=>"resource"===t.entryType;function gs(t,e){return!!e&&(x(e)||e[t])}function ys(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}var ws=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function bs(t){var e=t.type,r=t.recordBody,i=t.headers;function n(t){var e=Object.keys(i).find((t=>"content-type"===t.toLowerCase())),r=e&&i[e];return t.some((t=>null==r?void 0:r.toLowerCase().includes(t)))}if(!r)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!ys(e)&&t(e.url)}catch(t){return!1}}(t.url))return!1;if(n(ws))return!1;if(x(r))return!0;if(w(r))return n(r);var s=r[e];return x(s)?s:n(s)}function ks(t,e,r,i,n,s){return _s.apply(this,arguments)}function _s(){return _s=o((function*(t,e,r,i,n,s){if(void 0===s&&(s=0),s>10)return fs.warn("Failed to get performance entry for request",{url:r,initiatorType:e}),null;var a=function(t,r){for(var s=t.length-1;s>=0;s-=1)if(ms(a=t[s])&&a.initiatorType===e&&(_(i)||a.startTime>=i)&&(_(n)||n>=a.startTime))return t[s];var a}(t.performance.getEntriesByName(r));return a||(yield new Promise((t=>setTimeout(t,50*s))),ks(t,e,r,i,n,s+1))})),_s.apply(this,arguments)}function Ss(t){var e=t.body,r=t.options,i=t.url;if(M(e))return null;var n=vs(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(S(e))return e;if(hs(e))return e.textContent;if(R(e))return U(e);if(k(e))try{return JSON.stringify(e)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}var Is=t=>!I(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Ms(t){var e=t.entry,r=t.method,i=t.status,n=t.networkRequest,s=t.isInitial,a=t.start,o=t.end,l=t.url,h=t.initiatorType;a=e?e.startTime:a,o=e?e.responseEnd:o;var d=Math.floor(Date.now()-performance.now()),c=Math.floor(d+(a||0)),v=[u({},e?e.toJSON():{name:l},{startTime:_(a)?void 0:Math.round(a),endTime:_(o)?void 0:Math.round(o),timeOrigin:d,timestamp:c,method:r,initiatorType:h||(e?e.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(Is(e))for(var f of e.serverTiming||[])v.push({timeOrigin:d,timestamp:c,startTime:Math.round(e.startTime),name:f.name,duration:f.duration,entryType:"serverTiming"});return v}var Cs=["video/","audio/"];function xs(t){return k(t)&&b(t.getReader)&&b(t.tee)}var Rs=500,Ts="[SessionReplay] Timeout while trying to read body",Os="[SessionReplay] Failed to read body";function As(t){return Os+": "+t}function Es(t){return"[SessionReplay] Body too large to record (> "+t+" bytes)"}function Ns(t,e){if(!e.streamNetworkBody)return function(t){return new Promise((e=>{var r=setTimeout((()=>e(Ts)),Rs);try{t.clone().text().then((t=>e(t)),(t=>e(As(t)))).finally((()=>clearTimeout(r)))}catch(t){clearTimeout(r),e(Os)}}))}(t);var r=Z(e);return function(t,e){try{var r,i=null==(r=t.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>e}catch(t){return!1}}(t,r)?Promise.resolve(Es(r)):function(t,e){return new Promise((r=>{var i,n=!1;function s(){try{var t;null==(t=i)||t.cancel()}catch(t){}}function a(t){n||(n=!0,clearTimeout(u),s(),r(t))}var o,u=setTimeout((()=>a(Ts)),Rs);try{o=t.clone()}catch(t){return void a(Os)}var l=o.body;if(xs(l)&&"undefined"!=typeof TextDecoder){try{i=l.getReader()}catch(t){return void a(Os)}var h=[],d=0;!function t(){i.read().then((r=>{var i=r.done,o=r.value;if(n)s();else if(i)a((new TextDecoder).decode(function(t,e){var r=new Uint8Array(e),i=0;for(var n of t)r.set(n,i),i+=n.byteLength;return r}(h,d)));else{if(o){if(d+o.byteLength>e)return void a(Es(e));d+=o.byteLength,h.push(o)}t()}}),(t=>a(As(t))))}()}else try{o.text().then((t=>a(t)),(t=>a(As(t))))}catch(t){a(Os)}}))}(t,r)}function Ls(){return(Ls=o((function*(t){var e=t.r,r=t.options,i=vs(t.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):Ns(e,r)}))).apply(this,arguments)}function Fs(){return(Fs=o((function*(t){var e=t.r,r=t.options,i=function(t){var e,r=t.r,i=t.options,n=t.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(e=r.headers.get("Content-Type"))?void 0:e.toLowerCase(),a=Cs.some((t=>null==s?void 0:s.startsWith(t)));if(s&&a)return"Content-Type "+s+" is not supported";var o=vs(n,i);return o.isHostDenied?o.hostname+" is in deny list":null}({r:e,options:r,url:t.url});return I(i)?Ns(e,r):Promise.resolve(i)}))).apply(this,arguments)}var Ds=null;function Ps(t,e,r){if(!("performance"in e))return()=>{};if(Ds)return fs.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},J,r):J,n=e=>{var r=[],n=!1;e.requests.forEach((t=>{var e="serverTiming"===t.entryType;if(!e||!n){var s=i.maskRequestFn(t);e||(n=!s),s&&r.push(s)}})),r.length>0&&t(u({},e,{requests:r}))},s=function(t,e,r){if(r.recordInitialRequests){var i=e.performance.getEntries().filter((t=>ps(t)||ms(t)&&r.initiatorTypes.includes(t.initiatorType)));t({requests:i.flatMap((t=>Ms({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new e.PerformanceObserver((e=>{var i=e.getEntries().filter((t=>ps(t)||ms(t)&&r.initiatorTypes.includes(t.initiatorType)&&(t=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)));t({requests:i.flatMap((t=>Ms({entry:t,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((t=>r.performanceEntryTypeToObserve.includes(t)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(n,e,i),a=()=>{},l=()=>{};return(i.recordHeaders||i.recordBody)&&(a=function(t,e,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=gs("request",r.recordHeaders),n=gs("response",r.recordHeaders),s=cs(e.XMLHttpRequest.prototype,"open",(s=>function(a,o,u,l,h){void 0===u&&(u=!0);var d=this;try{var c,v,f=new Request(o),p={},m={},g=d.setRequestHeader.bind(d);d.setRequestHeader=(t,e)=>(m[t]=e,g(t,e)),i&&(p.requestHeaders=m);var y=d.send.bind(d);d.send=t=>(bs({type:"request",headers:m,url:o,recordBody:r.recordBody})&&(p.requestBody=Ss({body:t,options:r,url:o})),c=e.performance.now(),y(t));var w=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",w),d.removeEventListener("abort",w),d.removeEventListener("timeout",w)},b=()=>{if(d.readyState===d.DONE){w(),v=e.performance.now();var i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{var e=t.split(": "),r=e.shift(),n=e.join(": ");r&&(i[r]=n)})),n&&(p.responseHeaders=i),bs({type:"response",headers:i,url:o,recordBody:r.recordBody})&&(p.responseBody=Ss({body:d.response,options:r,url:o})),ks(e,"xmlhttprequest",f.url,c,v).then((e=>{var r=Ms({entry:e,method:a,status:null==d?void 0:d.status,networkRequest:p,start:c,end:v,url:o.toString(),initiatorType:"xmlhttprequest"});t({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",w),d.addEventListener("abort",w),d.addEventListener("timeout",w)}catch(t){fs.error("Failed to instrument XHR for network capture",t)}s.call(d,a,o.toString(),u,l,h)}));return()=>{s()}}(n,e,i),l=function(t,e,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=gs("request",r.recordHeaders),n=gs("response",r.recordHeaders),s=cs(e,"fetch",(s=>function(){var a=o((function*(a,o){var u,l;try{u=new Request(a,o)}catch(t){return fs.error("Failed to instrument fetch for network capture",t),s(a,o)}var h,d,c={};try{try{var v={};u.headers.forEach(((t,e)=>{v[e]=t})),i&&(c.requestHeaders=v),!xs(null==o?void 0:o.body)&&bs({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(c.requestBody=yield function(t){return Ls.apply(this,arguments)}({r:u,options:r,url:a}))}catch(t){fs.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),l=ys(a)?yield s(u):yield s(a,o),d=e.performance.now();var f={};return l.headers.forEach(((t,e)=>{f[e]=t})),n&&(c.responseHeaders=f),bs({type:"response",headers:f,url:a,recordBody:r.recordBody})&&(c.responseBody=yield function(t){return Fs.apply(this,arguments)}({r:l,options:r,url:a})),l}finally{ks(e,"fetch",u.url,h,d).then((e=>{var r,i=Ms({entry:e,method:u.method,status:null==(r=l)?void 0:r.status,networkRequest:c,start:h,end:d,url:u.url,initiatorType:"fetch"});t({requests:i})})).catch((()=>{}))}}));return function(t,e){return a.apply(this,arguments)}}()));return()=>{s()}}(n,e,i)),Ds=()=>{s(),a(),l(),Ds=null}}var Ws=t=>({name:"rrweb/network@1",observer:Ps,options:t});s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:ls,getRecordNetworkPlugin:Ws},s.__PosthogExtensions__.rrweb={record:Zn,version:"v2",wasMaxDepthReached:()=>Ii,resetMaxDepthState(){Ii=!1,Si=!1}},s.rrweb={record:Zn,version:"v2"},s.rrwebConsoleRecord={getRecordConsolePlugin:ls},s.getRecordNetworkPlugin=Ws,s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.initSessionRecording=t=>new mr(t)}();
1
+ !function(){"use strict";var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,r=null==e?void 0:e.document,i=null==e?void 0:e.location;null!=e&&e.XMLHttpRequest&&new e.XMLHttpRequest;var n="undefined"!=typeof globalThis?globalThis:t;n&&"undefined"==typeof self&&(n.self=n),n&&"undefined"==typeof File&&(n.File=function(){});var s=null!=t?t:{};function a(t,e,r,i,n,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(i,n)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(t){a(s,i,n,o,u,"next",t)}function u(t){a(s,i,n,o,u,"throw",t)}o(void 0)}))}}function u(){return u=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},u.apply(null,arguments)}var l,h={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},d={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},c="NativeGzipValidationError",v=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=c,e},f=function(){var t=o((function*(t,e){18>t.size&&v("too-short");var r,i=new Uint8Array(yield t.slice(0,10).arrayBuffer());(2>(r=i).length||31!==r[0]||139!==r[1]||8!==i[2])&&v("invalid-header");var n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(l)return l;l=[];for(var t=0;256>t;t++){for(var e=t,r=0;8>r;r++)e=1&e?3988292384^e>>>1:e>>>1;l[t]=e>>>0}return l})(),r=4294967295,i=0;t.length>i;i++)r=e[255&(r^t[i])]^r>>>8;return(4294967295^r)>>>0})(e)&&v("invalid-crc");var s=e.length>>>0;n.getUint32(4,!0)!==s&&v("invalid-size")}));return function(e,r){return t.apply(this,arguments)}}();function p(){return p=o((function*(t,e,r){void 0===e&&(e=!0);try{var i=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),s=n.writable.getWriter(),a=s.write(i).then((()=>s.close())).catch(function(){var t=o((function*(t){try{yield s.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),u=new Response(n.readable).blob(),l=(yield Promise.all([u,a]))[0];return yield f(l,i),l}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),p.apply(this,arguments)}var m=Object.prototype,g=m.hasOwnProperty,y=m.toString,w=Array.isArray||function(t){return"[object Array]"===y.call(t)},b=t=>"function"==typeof t,k=t=>t===Object(t)&&!w(t),_=t=>void 0===t,S=t=>"[object String]"==y.call(t),I=t=>null===t,M=t=>_(t)||I(t),C=t=>"[object Number]"==y.call(t)&&t==t,x=t=>"[object Boolean]"===y.call(t),R=t=>t instanceof FormData;function T(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),C(t)?t>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),T(n||r,e,r,i))}class O{constructor(t){this.$e={},this.ze=t.ze,this.Ze=T(t.bucketSize,0,100,t.Ge),this.Qe=T(t.refillRate,0,this.Ze,t.Ge),this.Je=T(t.refillInterval,0,864e5,t.Ge)}Ke(t,e){var r=Math.floor((e-t.lastAccess)/this.Je);r>0&&(t.tokens=Math.min(t.tokens+r*this.Qe,this.Ze),t.lastAccess=t.lastAccess+r*this.Je)}consumeRateLimit(t){var e,r=Date.now(),i=String(t),n=this.$e[i];return n?this.Ke(n,r):this.$e[i]=n={tokens:this.Ze,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(e=this.ze)||e.call(this,t)),0===n.tokens)}stop(){this.$e={}}}function A(t){return t?t.split("#")[0]:t}var E={DEBUG:!1,LIB_VERSION:"0.2.3",LIB_NAME:"browser-common"},N=function(e,r){var i=(void 0===r?{}:r).debugEnabled,n={k(r){if(t&&(E.DEBUG||t.POSTHOG_DEBUG||i)&&!_(t.console)&&t.console){for(var n=("__rrweb_original__"in t.console[r]?t.console[r].__rrweb_original__:t.console[r]),s=arguments.length,a=new Array(s>1?s-1:0),o=1;s>o;o++)a[o-1]=arguments[o];n(e,...a)}},debug(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];n.k("error",...e)},critical(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(t){n.error("You must initialize PostHog before calling "+t)},createLogger:(t,r)=>N(e+" "+t,r)};return n},L=N("[PostHog.js]"),F=L.createLogger;function D(t,e){if(!M(t))if(w(t))t.forEach(e);else if(R(t))t.forEach(((t,r)=>e(t,r)));else for(var r in t)g.call(t,r)&&e(t[r],r)}function P(t,e,r,i){var n={},s=n.capture,a=n.passive;null==t||t.addEventListener(e,r,{capture:void 0!==s&&s,passive:void 0===a||a})}var W=["localhost","127.0.0.1"],B=t=>{var e=null==r?void 0:r.createElement("a");return _(e)?null:(e.href=t,e)},U=function(t,e){var r,i;void 0===e&&(e="&");var n=[];return D(t,(function(t,e){_(t)||_(e)||"undefined"===e||(r=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),i=encodeURIComponent(e),n[n.length]=i+"="+r)})),n.join(e)};function z(e){var r,i=null==t||null==(r=t.location)?void 0:r.href;return _(i)?void 0:function(t,e){var r,i=null==t||null==(r=t.config)?void 0:r.get_current_url;if(!b(i))return e;try{var n=i(e);return S(n)&&n?n:e}catch(t){return L.error("Error in get_current_url, falling back to window.location.href",t),e}}(e,i)}var j=new RegExp("(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})"),q=new RegExp("(\\d{3}-?\\d{2}-?\\d{4})"),H="[SessionRecording]",G="redacted",V=1e6;function Z(t){var e;return Math.min(V,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:V)}var J={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:V,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},Q=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],X=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Y=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],K=t=>{M(t)||D(Object.keys(t),(e=>{(t=>{var e=t.toLowerCase();return Q.includes(e)||Y.some((t=>e.includes(t)))})(e)&&(t[e]=G)}))},tt=["/s/","/e/","/i/"];function et(t,e,r,i){if(M(t))return t;var n=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return S(n)&&(n=parseInt(n)),n>r?H+" "+i+" body too large to record ("+n+" bytes)":t}function rt(t,e){if(M(t))return t;var r=t;return function(t,e){if(M(t))return!1;if(S(t)){if(t=t.trim(),j.test((t||"").replace(/[- ]/g,"")))return!1;if(q.test(t))return!1}return!0}(r)||(r=H+" "+e+" body "+G),D(X,(t=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(t))&&(r=H+" "+e+" body "+G+" as might contain: "+t)})),r}var it="$session_recording_remote_config",nt="$replay_sample_rate",st="$replay_override_sampling",at="$replay_override_linked_flag",ot="$replay_override_url_trigger",ut="$replay_override_event_trigger",lt="$session_is_sampled",ht="$session_past_minimum_duration",dt="$session_recording_url_trigger_activated_session",ct="$session_recording_event_trigger_activated_session",vt="$posthog_sr_group_event_trigger_",ft="$posthog_sr_group_url_trigger_",pt="$posthog_sr_group_sampling_",mt="$debug_first_full_snapshot_timestamp",gt="$sess_rec_flush_size",yt="$stored_person_properties",wt="$sdk_debug_replay_remote_trigger_matching_config",bt="disabled",kt="sampled",_t="active",St="buffering",It="paused",Mt="rrweb_error",Ct="trigger",xt=Ct+"_activated",Rt=Ct+"_pending",Tt=Ct+"_"+bt;function Ot(t,e,r,i,n,s){return 0===e?Tt:(null==t?void 0:t.get_property(r?i+r:n))===s?xt:Rt}function At(t,e,r){return e.some((e=>{var i;return"regex"===e.matching&&(null!==(i=null==r?void 0:r.get(e.url))&&void 0!==i?i:new RegExp(e.url)).test(t)}))}class Et{constructor(t){this.u=t}triggerStatus(t){var e=this.u.map((e=>e.triggerStatus(t)));return e.includes(xt)?xt:e.includes(Rt)?Rt:Tt}stop(){this.u.forEach((t=>t.stop()))}}class Nt{constructor(t){this.u=t}triggerStatus(t){var e=new Set;for(var r of this.u)e.add(r.triggerStatus(t));switch(e.delete(Tt),e.size){case 0:return Tt;case 1:return Array.from(e)[0];default:return Rt}}stop(){this.u.forEach((t=>t.stop()))}}class Lt{triggerStatus(){return xt}stop(){}}var Ft=t=>"sessionRecording"in t;class Dt{constructor(t,e){this.Gu=[],this.Vu=[],this.Zu=new Map,this.Ju=new Map,this.Qu="",this.urlBlocked=!1,this._instance=t,this.Xu=e}onConfig(t){var e,r;this.Gu=(Ft(t)?k(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.Vu=(Ft(t)?k(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Yu()}Yu(){for(var t of(this.Zu.clear(),this.Ju.clear(),this.Gu))if("regex"===t.matching&&!this.Zu.has(t.url))try{this.Zu.set(t.url,new RegExp(t.url))}catch(e){L.error("Invalid URL trigger regex pattern:",t.url,e)}for(var e of this.Vu)if("regex"===e.matching&&!this.Ju.has(e.url))try{this.Ju.set(e.url,new RegExp(e.url))}catch(t){L.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(t){this.onConfig(t)}Ku(t){return Ot(this._instance,this.Gu.length,this.Xu,ft,dt,t)}triggerStatus(t){var e=this.Ku(t),r=e===xt?xt:e===Rt?Rt:Tt;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(t,e){var r=z(this._instance);if(r&&r!==this.Qu){this.Qu=r;var i=this.urlBlocked,n=At(r,this.Vu,this.Ju);i&&n||(n&&!i?t():!n&&i&&e())}}checkUrlTriggerConditions(t,e,r,i){var n=z(this._instance);if(n&&n!==this.Qu){this.Qu=n;var s=this.urlBlocked,a=At(n,this.Vu,this.Ju);a&&!s?t():!a&&s&&e();var o=this.Ku(i)===xt,u=At(n,this.Gu,this.Zu);!o&&u&&r("url",n)}}stop(){this.Qu=""}}class Pt{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.th=()=>{},this._instance=t}triggerStatus(){var t=Rt;return M(this.linkedFlag)&&(t=Tt),this.linkedFlagSeen&&(t=xt),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,e){var r;if(this.linkedFlag=(Ft(t)?k(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!M(this.linkedFlag)&&!this.linkedFlagSeen){var i=S(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=S(this.linkedFlag)?null:this.linkedFlag.variant;this.th=this._instance.onFeatureFlags(((t,r)=>{var s=!1;if(k(r)&&i in r){var a=r[i];s=x(a)?!0===a:n?a===n:!!a}var o=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,o&&e(i,n)}))}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.th()}}class Wt{constructor(t,e){this.eh=[],this._instance=t,this.Xu=e}onConfig(t){var e;this.eh=(Ft(t)?k(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}rh(t){return Ot(this._instance,this.eh.length,this.Xu,vt,ct,t)}triggerStatus(t){var e=this.rh(t),r=e===xt?xt:e===Rt?Rt:Tt;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(t,e,r){if(0!==this.eh.length){var i=this.rh(r)===xt,n=this.eh.includes(t);!i&&n&&e("event",t)}}stop(){}}class Bt{constructor(t,e,r){if(this._instance=t,this.group=e,this.ih=new Dt(t,e.id),this.nh=new Wt(t,e.id),this.sh=new Pt(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){var i=(e.conditions.events||[]).map((t=>t.name)),n={urlTriggers:e.conditions.urls||[],eventTriggers:i,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.ih.onConfig(n),this.nh.onConfig(n),this.sh.onConfig(n,r);var s=[this.nh,this.ih,this.sh];this.ah="any"===e.conditions.matchType?new Et(s):new Nt(s)}else this.ah=new Lt}triggerStatus(t){return this.ah.triggerStatus(t)}checkEventTriggerConditions(t,e,r){this.nh.checkEventTriggerConditions(t,e,r)}checkUrlTriggerConditions(t,e,r,i){this.ih.checkUrlTriggerConditions(t,e,r,i)}activateTrigger(t,e){var r;null==(r=this._instance.persistence)||r.register({["url"===t?ft+this.group.id:vt+this.group.id]:e})}stop(){this.ih.stop(),this.nh.stop(),this.sh.stop()}}function $t(t){if(t.rrwebError)return Mt;if(!t.receivedFlags)return St;if(!t.isRecordingEnabled)return bt;if(t.urlTriggerMatching.urlBlocked)return It;var e=!0===t.isSampled,r=new Et([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?kt:r===xt?_t:r===Rt?St:!1===t.isSampled?bt:_t}function Ut(t){if(t.rrwebError)return Mt;if(!t.receivedFlags)return St;if(!t.isRecordingEnabled)return bt;if(t.urlTriggerMatching.urlBlocked)return It;var e=new Nt([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),r=e!==Tt,i=x(t.isSampled);return r&&e===Rt?St:r&&e===Tt||i&&!t.isSampled?bt:!0===t.isSampled?kt:_t}function zt(){var t=[];return function(e,r){if(k(r)||w(r)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?"[Circular]":(t.push(r),r)}return r}}function jt(t){var e=JSON.stringify(t,zt());return e?new Blob([e]).size:0}function qt(t){if(I(t))return 4;if(_(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":if(w(t)){for(var e=2,r=0;t.length>r;r++){r>0&&(e+=1);var i=t[r];e+=_(i)||I(i)?4:qt(i)}return e}var n=t,s=2,a=!0;for(var o in n)if({}.hasOwnProperty.call(n,o)){var u=n[o];_(u)||(a||(s+=1),a=!1,s+=o.length+3+qt(u))}return s;default:return 0}}function Ht(t,e){if(void 0===e&&(e=6606028.8),t.size>=e&&t.data.length>1){var r=Math.floor(t.data.length/2),i=t.sizes.slice(0,r),n=t.sizes.slice(r);return[Ht({size:i.reduce(((t,e)=>t+e),0),data:t.data.slice(0,r),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Ht({size:n.reduce(((t,e)=>t+e),0),data:t.data.slice(r),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var Gt=Uint8Array,Vt=Uint16Array,Zt=Uint32Array,Jt=new Gt([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 Gt([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]),Xt=new Gt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yt=function(t,e){for(var r=new Vt(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new Zt(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},Kt=Yt(Jt,2),te=Kt[1];Kt[0][28]=258,te[258]=28;for(var ee=Yt(Qt,0)[1],re=new Vt(32768),ie=0;32768>ie;++ie){var ne=(43690&ie)>>>1|(21845&ie)<<1;re[ie]=((65280&(ne=(61680&(ne=(52428&ne)>>>2|(13107&ne)<<2))>>>4|(3855&ne)<<4))>>>8|(255&ne)<<8)>>>1}var se=function(t,e,r){for(var i=t.length,n=0,s=new Vt(e);i>n;++n)++s[t[n]-1];var a,o=new Vt(e);for(n=0;e>n;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new Vt(1<<e);var u=15-e;for(n=0;i>n;++n)if(t[n])for(var l=n<<4|t[n],h=e-t[n],d=o[t[n]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)a[re[d]>>>u]=l}else for(a=new Vt(i),n=0;i>n;++n)a[n]=re[o[t[n]-1]++]>>>15-t[n];return a},ae=new Gt(288);for(ie=0;144>ie;++ie)ae[ie]=8;for(ie=144;256>ie;++ie)ae[ie]=9;for(ie=256;280>ie;++ie)ae[ie]=7;for(ie=280;288>ie;++ie)ae[ie]=8;var oe=new Gt(32);for(ie=0;32>ie;++ie)oe[ie]=5;var ue=se(ae,9,0),le=se(oe,5,0),he=function(t){return(t/8>>0)+(7&t&&1)},de=function(t,e,r){(null==r||r>t.length)&&(r=t.length);var i=new(t instanceof Vt?Vt:t instanceof Zt?Zt:Gt)(r-e);return i.set(t.subarray(e,r)),i},ce=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},ve=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},fe=function(t,e){for(var r=[],i=0;t.length>i;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new Gt(0),0];if(1==n){var a=new Gt(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort((function(t,e){return t.f-e.f})),r.push({s:-1,f:25001});var o=r[0],u=r[1],l=0,h=1,d=2;for(r[0]={s:-1,f:o.f+u.f,l:o,r:u};h!=n-1;)o=r[r[d].f>r[l].f?l++:d++],u=r[l!=h&&r[d].f>r[l].f?l++:d++],r[h++]={s:-1,f:o.f+u.f,l:o,r:u};var c=s[0].s;for(i=1;n>i;++i)s[i].s>c&&(c=s[i].s);var v=new Vt(c+1),f=pe(r[h-1],v,0);if(f>e){i=0;var p=0,m=f-e,g=1<<m;for(s.sort((function(t,e){return v[e.s]-v[t.s]||t.f-e.f}));n>i;++i){var y=s[i].s;if(e>=v[y])break;p+=g-(1<<f-v[y]),v[y]=e}for(p>>>=m;p>0;){var w=s[i].s;e>v[w]?p-=1<<e-v[w]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;v[b]==e&&(--v[b],++p)}f=e}return[new Gt(v),f]},pe=function(t,e,r){return-1==t.s?Math.max(pe(t.l,e,r+1),pe(t.r,e,r+1)):e[t.s]=r},me=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new Vt(++e),i=0,n=t[0],s=1,a=function(t){r[i++]=t},o=1;e>=o;++o)if(t[o]==n&&o!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(n),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(n);s=1,n=t[o]}return[r.subarray(0,i),e]},ge=function(t,e){for(var r=0,i=0;e.length>i;++i)r+=t[i]*e[i];return r},ye=function(t,e,r){var i=r.length,n=he(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;i>s;++s)t[n+s+4]=r[s];return 8*(n+4+i)},we=function(t,e,r,i,n,s,a,o,u,l,h){ce(e,h++,r),++n[256];for(var d=fe(n,15),c=d[0],v=d[1],f=fe(s,15),p=f[0],m=f[1],g=me(c),y=g[0],w=g[1],b=me(p),k=b[0],_=b[1],S=new Vt(19),I=0;y.length>I;++I)S[31&y[I]]++;for(I=0;k.length>I;++I)S[31&k[I]]++;for(var M=fe(S,7),C=M[0],x=M[1],R=19;R>4&&!C[Xt[R-1]];--R);var T,O,A,E,N=l+5<<3,L=ge(n,ae)+ge(s,oe)+a,F=ge(n,c)+ge(s,p)+a+14+3*R+ge(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(L>=N&&F>=N)return ye(e,h,t.subarray(u,u+l));if(ce(e,h,1+(L>F)),h+=2,L>F){T=se(c,v,0),O=c,A=se(p,m,0),E=p;var D=se(C,x,0);for(ce(e,h,w-257),ce(e,h+5,_-1),ce(e,h+10,R-4),h+=14,I=0;R>I;++I)ce(e,h+3*I,C[Xt[I]]);h+=3*R;for(var P=[y,k],W=0;2>W;++W){var B=P[W];for(I=0;B.length>I;++I)ce(e,h,D[U=31&B[I]]),h+=C[U],U>15&&(ce(e,h,B[I]>>>5&127),h+=B[I]>>>12)}}else T=ue,O=ae,A=le,E=oe;for(I=0;o>I;++I)if(i[I]>255){var U;ve(e,h,T[257+(U=i[I]>>>18&31)]),h+=O[U+257],U>7&&(ce(e,h,i[I]>>>23&31),h+=Jt[U]);var z=31&i[I];ve(e,h,A[z]),h+=E[z],z>3&&(ve(e,h,i[I]>>>5&8191),h+=Qt[z])}else ve(e,h,T[i[I]]),h+=O[i[I]];return ve(e,h,T[256]),h+O[256]},be=new Zt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ke=function(){for(var t=new Zt(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),_e=function(){var t=4294967295;return{p(e){for(var r=t,i=0;e.length>i;++i)r=ke[255&r^e[i]]^r>>>8;t=r},d:()=>4294967295^t}},Se=function(t,e,r,i,n){return function(t,e,r,i,n,s){var a=t.length,o=new Gt(i+a+5*(1+Math.floor(a/7e3))+n),u=o.subarray(i,o.length-n),l=0;if(!e||8>a)for(var h=0;a>=h;h+=65535){var d=h+65535;a>d?l=ye(u,l,t.subarray(h,d)):(u[h]=true,l=ye(u,l,t.subarray(h,a)))}else{for(var c=be[e-1],v=c>>>13,f=8191&c,p=(1<<r)-1,m=new Vt(32768),g=new Vt(p+1),y=Math.ceil(r/3),w=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<w)&p},k=new Zt(25e3),_=new Vt(288),S=new Vt(32),I=0,M=0,C=(h=0,0),x=0,R=0;a>h;++h){var T=b(h),O=32767&h,A=g[T];if(m[O]=A,g[T]=O,h>=x){var E=a-h;if((I>7e3||C>24576)&&E>423){l=we(t,u,0,k,_,S,M,C,R,h-R,l),C=I=M=0,R=h;for(var N=0;286>N;++N)_[N]=0;for(N=0;30>N;++N)S[N]=0}var L=2,F=0,D=f,P=O-A&32767;if(E>2&&T==b(h-P))for(var W=Math.min(v,E)-1,B=Math.min(32767,h),U=Math.min(258,E);B>=P&&--D&&O!=A;){if(t[h+L]==t[h+L-P]){for(var z=0;U>z&&t[h+z]==t[h+z-P];++z);if(z>L){if(L=z,F=P,z>W)break;var j=Math.min(P,z-2),q=0;for(N=0;j>N;++N){var H=h-P+N+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,A=H)}}}P+=(O=A)-(A=m[O])+32768&32767}if(F){k[C++]=268435456|te[L]<<18|ee[F];var V=31&te[L],Z=31&ee[F];M+=Jt[V]+Qt[Z],++_[257+V],++S[Z],x=h+L,++I}else k[C++]=t[h],++_[t[h]]}}l=we(t,u,true,k,_,S,M,C,R,h-R,l)}return de(o,0,i+he(l)+n)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,r,i)},Ie=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Me=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Ie(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var i=0;r.length>=i;++i)t[i+10]=r.charCodeAt(i)}},Ce=function(t){return 10+(t.filename&&t.filename.length+1||0)};function xe(t,e){for(var r="",i=0;t.length>i;){var n=t[i++];r+=String.fromCharCode(n)}return r}class Re{constructor(t,e){var r,i;void 0===e&&(e={}),this.oh={},this.uh=t=>{if(!this.oh[t]){var e,r;this.oh[t]=!0;var i=this.lh(t);null==(e=(r=this.hh).onBlockedNode)||e.call(r,t,i)}},this.dh=t=>{var e=this.lh(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){var r=e.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[t,e]},this.lh=t=>this._rrweb.mirror.getNode(t),this.fh=t=>{var e,r,i,n,s,a,o,u;return(null!==(e=null==(r=t.removes)?void 0:r.length)&&void 0!==e?e:0)+(null!==(i=null==(n=t.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(a=t.texts)?void 0:a.length)&&void 0!==s?s:0)+(null!==(o=null==(u=t.adds)?void 0:u.length)&&void 0!==o?o:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var e=t.data,r=this.fh(e);e.attributes&&(e.attributes=e.attributes.filter((t=>{var e=this.dh(t.id);return!this.Xo.consumeRateLimit(e[0])&&t})));var i=this.fh(e);return 0!==i||r===i?t:void 0},this._rrweb=t,this.hh=e,this.Xo=new O({bucketSize:null!==(r=this.hh.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this.hh.refillRate)&&void 0!==i?i:10,refillInterval:1e3,ze:this.uh,Ge:L})}reset(){this.oh={}}stop(){this.Xo.stop(),this.reset()}}E.DEBUG=!1,E.LIB_VERSION="1.407.5",E.LIB_NAME="web";class Te{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.ph=t.get_property.bind(t),this.mh=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.mh(gt,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){var e,r=this.ph(gt);return k(e=r)&&S(e.sessionId)&&C(e.size)&&r.sessionId===t?r.size:0}}function Oe(t,e){return function(t){for(var e=0,r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)}(t)%100<T(100*e,0,100,L)}var Ae=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},Ee={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Ae(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Ae(e,t))))),icontains:(t,e)=>e.map(Ne).some((e=>t.map(Ne).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Ne).every((e=>t.map(Ne).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r<parseFloat(t)))}))},Ne=t=>t.toLowerCase(),Le=new Set(["is_not","not_icontains","not_regex"]);function Fe(t,e,r){return!t||0===t.length||t.every((t=>{var i="person"===t.type?r:e,n=null==i?void 0:i[t.key],s=t.operator||"exact";if(_(n)||I(n))return Le.has(s);var a=Ee[s];return!!a&&!_(t.value)&&!I(t.value)&&a(w(t.value)?t.value.map(String):[String(t.value)],w(n)?n.map(String):[String(n)])}))}var De=F("[SessionRecording]");function Pe(t,e){return e?t:"!"+t}function We(t,e){return t===e||t!=="!"+e&&null}class Be{constructor(t,e,r,i,n,s,a){this.gh=null,this.yh=Ut,this._instance=t,this.ih=e,this.nh=r,this.sh=i,this.wh=n,this.bh=s,this.kh=a}onRemoteConfig(t){this.gh=C(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this._h=new Et([this.nh,this.ih]),this.yh=$t):(this._h=new Nt([this.nh,this.ih]),this.yh=Ut),this._instance.register_for_session({[wt]:t.triggerMatchType}),this.ih.onConfig(t),this.nh.onConfig(t),this.sh.onConfig(t,((t,e)=>{this.wh("linked_flag_matched",{flag:t,variant:e}),this.kh()}))}getStatus(t){return this.yh({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){var e=this._instance.get_property("$session_recording_remote_config"),r=null==e?void 0:e.minimumDurationMilliseconds;return C(r)?r:null}checkUrlTriggers(t,e,r,i){this.ih.checkUrlTriggerConditions(e,r,i,t)}setupEventTriggerListeners(t,e,r){if(0!==this.nh.eh.length&&M(this.Sh))return this.Sh=t((t=>{try{this.nh.checkEventTriggerConditions(t.event,r,e)}catch(t){De.error("Could not activate event trigger",t)}})),this.Sh}makeSamplingDecisions(t){var e,r,i,n=this.gh;if(!C(n))return null==(r=this._instance.persistence)||r.unregister(lt),void(null==(i=this._instance.persistence)||i.unregister(nt));var s=this._instance.get_property(lt),a=this._instance.get_property(nt),o=We(s,t),u=C(a)&&a!==n,l=_(a)&&s===t,h=u||l||!x(o),d=h?Oe(t,n):o;h&&(d?this.wh("sampled"):De.warn("Sample rate ("+n+") has determined that this sessionId ("+t+") will not be sent to the server.")),null==(e=this._instance.persistence)||e.register({[lt]:Pe(t,d),[nt]:I(a)&&s===t?null:n})}ensureSamplingDecision(t){if(C(this.gh)){var e=this._instance.get_property(lt);x(We(e,t))||this.makeSamplingDecisions(t)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,r,i,n;null==(t=this._instance.persistence)||t.unregister(ct),null==(e=this._instance.persistence)||e.unregister(dt),null==(r=this._instance.persistence)||r.unregister(lt),null==(i=this._instance.persistence)||i.unregister(nt),null==(n=this._instance.persistence)||n.unregister(ht)}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null==(e=this._h)?void 0:e.triggerStatus(t))===Rt}stop(){var t;null==(t=this.Sh)||t.call(this),this.Sh=void 0,this.nh.stop(),this.ih.stop(),this.sh.stop()}}class $e{constructor(t,e,r,i,n){this.Ih=[],this.Mh=new Map,this.Ch=!1,this._instance=t,this.ih=e,this.wh=r,this.xh=i,this.kh=n}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Rh(t.triggerGroups),this._instance.register_for_session({[wt]:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:t.triggerGroups.length}),this.ih.onConfig(t)):De.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return Mt;if(t.urlTriggerMatching.urlBlocked)return It;var e=t.triggerGroupMatchers,r=t.triggerGroupSamplingResults;if(0===e.length)return bt;var i=!1,n=!1;for(var s of e){var a=s.triggerStatus(t.sessionId);if(a===xt){var o=s.group.id,u=r.get(o);_(u)?L.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===u&&(n=!0)}else a===Rt&&(i=!0)}return n?kt:i?St:bt}({isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Ih,triggerGroupSamplingResults:this.Mh,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){var e=null;for(var r of this.Ih)if("trigger_activated"===r.triggerStatus(t)){var i=r.group.minDurationMs;C(i)&&(I(e)||e>i)&&(e=i)}return e}checkUrlTriggers(t,e,r,i){var n=this;this.ih.checkUrlBlocklist(e,r);var s=function(i){i.checkUrlTriggerConditions(e,r,(e=>{n.Th(i,void 0)&&(i.activateTrigger(e,t),n.updateActiveTriggers(t),n.kh())}),t)};for(var a of this.Ih)s(a)}setupEventTriggerListeners(t,e,r){var i=this;return this.Sh=t((t=>{var r;if(this.Ch)return De.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Sh)||r.call(this),void(this.Sh=void 0);try{var n=function(r){r.checkEventTriggerConditions(t.event,(n=>{if(i.Th(r,t.properties)){var s=(r.group.conditions.events||[]).filter((e=>e.name===t.event)),a=i._instance.get_property(yt);s.some((e=>!e.properties||0===e.properties.length||Fe(e.properties,t.properties,a)))&&(r.activateTrigger(n,e),i.updateActiveTriggers(e),i.kh())}}),e)};for(var s of this.Ih)n(s)}catch(t){De.error("Could not activate event trigger for trigger groups",t)}})),this.Sh}makeSamplingDecisions(t){for(var e of this.Ih){var r,i=e.group,n=i.id,s=i.sampleRate,a=pt+n,o=this._instance.get_property(a),u=null,l=!1,h=!1,d=!1;if(k(o)){var c=o.sessionId,v=o.sampleRate,f=o.sampled;l="string"==typeof c&&c!==t,h=C(v)&&v!==s,u=c===t&&C(v)&&v===s&&x(f)?f:null}else u=o===t||null,l="string"==typeof o&&o!==t,d=o===t;var p=l||h||d||!x(u),m=p?Oe(t+n,s):u;p&&this.xh("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:m}),this.Mh.set(n,m),null==(r=this._instance.persistence)||r.register({[a]:{sessionId:t,sampleRate:s,sampled:m}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Ch=!0}clearConditionalRecordingPersistence(){var t,e,r;for(var i of(null==(t=this._instance.persistence)||t.unregister(lt),null==(e=this._instance.persistence)||e.unregister(nt),null==(r=this._instance.persistence)||r.unregister(ht),this.Ih)){var n,s,a,o=i.group.id;null==(n=this._instance.persistence)||n.unregister(vt+o),null==(s=this._instance.persistence)||s.unregister(ft+o),null==(a=this._instance.persistence)||a.unregister(pt+o)}}updateActiveTriggers(t){var e=[];for(var r of this.Ih){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(t),a=!0===this.Mh.get(n);s&&e.push({id:n,name:i.name,matched:!0,sampled:a})}this._instance.register_for_session({$sdk_debug_replay_matched_recording_trigger_groups:e})}hasPendingTriggers(t){for(var e of this.Ih)if(e.triggerStatus(t)===Rt)return!0;return!1}stop(){var t;null==(t=this.Sh)||t.call(this),this.Sh=void 0,this.Ih.forEach((t=>t.stop())),this.Ih=[],this.Mh.clear(),this.ih.stop()}Th(t,e){var r=t.group.conditions.properties;return!r||0===r.length||Fe(r,e,this._instance.get_property(yt))}Rh(t){var e=this;this.Ih.forEach((t=>t.stop())),this.Ih=[],this.Mh.clear();var r=function(t){var r=new Bt(e._instance,t,((r,i)=>{e.wh("linked_flag_matched",{flag:r,variant:i,group_id:t.id,group_name:t.name}),e.kh()}));e.Ih.push(r)};for(var i of t)r(i)}}var Ue=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"];function ze(t){return k(t)?t.network_timing:t}var je,qe,He="[SessionRecording]",Ge=F(He),Ve=[d.MouseMove,d.MouseInteraction,d.Scroll,d.ViewportResize,d.Input,d.TouchMove,d.MediaInteraction,d.Drag],Ze=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Je(){var t;return null==s||null==(t=s.__PosthogExtensions__)?void 0:t.rrweb}function Qe(){var t;return null==(t=Je())?void 0:t.record}function Xe(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,zt())}}function Ye(t){return xe(function(t,e){void 0===e&&(e={});var r=_e(),i=t.length;r.p(t);var n=Se(t,e,Ce(e),8),s=n.length;return Me(n,e),Ie(n,s-8,r.d()),Ie(n,s-4,i),n}(function(t,e){var r=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Gt(t.length+(t.length>>>1)),n=0,s=function(t){i[n++]=t},a=0;r>a;++a){if(n+5>i.length){var o=new Gt(n+8+(r-a<<1));o.set(i),i=o}var u=t.charCodeAt(a);128>u?s(u):2048>u?(s(192|u>>>6),s(128|63&u)):u>55295&&57344>u?(s(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++a))>>>18),s(128|u>>>12&63),s(128|u>>>6&63),s(128|63&u)):(s(224|u>>>12),s(128|u>>>6&63),s(128|63&u))}return de(i,0,n)}(Xe(t))))}function Ke(t){return tr.apply(this,arguments)}function tr(){return tr=o((function*(t){var e=Xe(t),r=yield function(t,e,r){return p.apply(this,arguments)}(e,E.DEBUG,{rethrow:!0});return xe(new Uint8Array(yield r.arrayBuffer()))})),tr.apply(this,arguments)}var er="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,rr=!1;function ir(t){return w(t)&&0===t.length?je=null!=je?je:Ye([]):Ye(t)}function nr(t){return sr.apply(this,arguments)}function sr(){return(sr=o((function*(t){return w(t)&&0===t.length?je||(qe=null!=qe?qe:Ke([]).then((t=>(je=t,t))).catch((t=>{throw je=void 0,qe=void 0,t}))):Ke(t)}))).apply(this,arguments)}function ar(t){return er&&!rr&&function(t){return t.type===h.FullSnapshot||t.type===h.IncrementalSnapshot&&(t.data.source===d.Mutation||t.data.source===d.StyleSheetRule)}(t)}function or(t){return{event:t,size:qt(t)}}function ur(t,e){return u({},t,{data:e,cv:"2024-10"})}function lr(t,e){return u({},t,{cv:"2024-10",data:u({},t.data,e)})}function hr(t){try{if(t.type===h.FullSnapshot)return or(ur(t,Ye(t.data)));if(t.type===h.IncrementalSnapshot&&t.data.source===d.Mutation)return or(lr(t,{texts:ir(t.data.texts),attributes:ir(t.data.attributes),removes:ir(t.data.removes),adds:ir(t.data.adds)}));if(t.type===h.IncrementalSnapshot&&t.data.source===d.StyleSheetRule)return or(lr(t,{adds:t.data.adds?Ye(t.data.adds):void 0,removes:t.data.removes?Ye(t.data.removes):void 0}))}catch(t){Ge.error("could not compress event - will use uncompressed event",t)}return{event:t,size:jt(t)}}function dr(){return(dr=o((function*(t){try{if(t.type===h.FullSnapshot)return or(ur(t,yield Ke(t.data)));if(t.type===h.IncrementalSnapshot&&t.data.source===d.Mutation){var e=yield Promise.all([nr(t.data.texts),nr(t.data.attributes),nr(t.data.removes),nr(t.data.adds)]);return or(lr(t,{texts:e[0],attributes:e[1],removes:e[2],adds:e[3]}))}if(t.type===h.IncrementalSnapshot&&t.data.source===d.StyleSheetRule){var r=yield Promise.all([t.data.adds?Ke(t.data.adds):void 0,t.data.removes?Ke(t.data.removes):void 0]);return or(lr(t,{adds:r[0],removes:r[1]}))}}catch(e){return(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return(t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(t)||e===c})(e)&&(rr=!0),Ge.error("could not compress event asynchronously - trying synchronous compression",e),hr(t)}return{event:t,size:jt(t)}}))).apply(this,arguments)}function cr(t,e){return t.type===h.Custom&&t.data.tag===e}function vr(t){return cr(t,"sessionIdle")}function fr(t){return cr(t,"$session_ending")}function pr(t){return cr(t,"$session_starting")}class mr{get sessionId(){return this.Mi}get Oh(){if(!this._instance.sessionManager)throw new Error(He+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Ah(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Eh(){return We(this._instance.get_property(lt),this.sessionId)}get gh(){var t,e=null==(t=this.Xa)?void 0:t.sampleRate;return C(e)?e:null}get Nh(){var t,e;return null!==(t=null==(e=this.Lh)?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t){this.Fh="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.Dh=void 0,this.Ph=Date.now(),this.Wh=!1,this.Bh=[],this.$h="unknown",this.Uh=!1,this.zh=!1,this.jh=!1,this.qh=!1,this.Hh=[],this.Gh=void 0,this.Vh=void 0,this.Zh=[],this.Jh=0,this.Qh=0,this.Xh=!1,this.Yh=void 0,this.Sh=void 0,this.Kh=void 0,this.td=void 0,this.ed=void 0,this.fi=(t,e,r)=>{var i,n,s;if(r&&(t!==this.Mi||e!==this.Ii)){var a,o=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),u=this.Mi,l=this.Ii;o&&this.xh("$session_ending",{currentSessionId:u,currentWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph,flushed_size:null==(a=this.rd)?void 0:a.currentTrackedSize(u)}),null==(i=this._instance.persistence)||i.unregister(mt),this.jh=!1,null==(n=Je())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this.xh("$session_id_change",{sessionId:t,windowId:e,changeReason:r}),this.nd(),!1===this.$h&&this.isStarted||this.Mi===t&&this.Ii===e||(this.$h="unknown",this.stop(),this.start("session_id_changed")),o&&this.xh("$session_starting",{previousSessionId:u,previousWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph}),null==(s=this.Lh)||s.makeSamplingDecisions(t)}},this.sd=()=>{var t;return(null==(t=this._instance.persistence)?void 0:t.props[ht])===this.Mi},this.ad=()=>{var t,e;if(0===this.R.data.length)return null;var r=null==(t=this.R.data[0])?void 0:t.timestamp,i=null==(e=this.R.data[this.R.data.length-1])?void 0:e.timestamp;return C(r)&&C(i)?i-r:null},this.od=()=>{var t,e,r=this.Nh;if(!C(r))return!1;if(null===(t=null==(e=this._instance.config.session_recording)?void 0:e.strictMinimumDuration)||void 0===t||!t){var i=this.ud;return C(i)&&i>=0&&r>i}if(this.sd())return!1;var n,s=this.ad();return!!I(s)||r>s||(null==(n=this._instance.persistence)||n.register({[ht]:this.Mi}),!1)},this.ld=()=>{this.status!==St?(this.hd(),this.dd()):this.vd()},this.fd=()=>{this.xh("browser offline",{})},this.Bs=()=>{this.xh("browser online",{})},this.ke=()=>{null!=r&&r.visibilityState&&this.xh("window "+r.visibilityState,{})},this._instance=t;var e=this.Oh.checkAndGetSessionAndWindowId(),i=e.windowId;this.Mi=e.sessionId,this.Ii=i,this.sh=new Pt(this._instance),this.ih=new Dt(this._instance),this.nh=new Wt(this._instance),this.R=this.vd(),this.Oh.sessionTimeoutMs>this.Ah||Ge.warn("session_idle_threshold_ms ("+this.Ah+") is greater than the session timeout ("+this.Oh.sessionTimeoutMs+"). Session will never be detected as idle"),this.rd=new Te(this._instance)}get pd(){var t,e,r,i,n,s,a,o=null==(t=this.Xa)?void 0:t.masking,u={maskAllInputs:null==(e=this._instance.config.session_recording)?void 0:e.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector},l=null!==(n=null==u?void 0:u.maskAllInputs)&&void 0!==n?n:null==o?void 0:o.maskAllInputs,h=null!==(s=null==u?void 0:u.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,d=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==o?void 0:o.blockSelector;return _(l)&&_(h)&&_(d)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:d}}md(){var t;if(!this.qh){var e=null==(t=this.Xa)?void 0:t.masking;if(!M(e)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector"].filter((t=>{var i=null==r?void 0:r[t],n=e[t];return!_(i)&&i!==n}));0!==i.length&&(this.qh=!0,Ge.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector},project:e}))}}}get gd(){var t;return T(null==(t=this._instance.config.session_recording.canvasCapture)?void 0:t.resolutionScale,.1,1,F("canvas recording resolution scale"),1)}get yd(){var t,e,r,i,n,s,a,o=this._instance.config.session_recording.captureCanvas,u=null==(t=this.Xa)?void 0:t.canvasRecording,l=null!==(e=null!==(r=null==o?void 0:o.recordCanvas)&&void 0!==r?r:null==u?void 0:u.enabled)&&void 0!==e&&e,h=null!==(i=null!==(n=null==o?void 0:o.canvasFps)&&void 0!==n?n:null==u?void 0:u.fps)&&void 0!==i?i:4,d=null!==(s=null!==(a=null==o?void 0:o.canvasQuality)&&void 0!==a?a:null==u?void 0:u.quality)&&void 0!==s?s:.4;if("string"==typeof d){var c=parseFloat(d);d=isNaN(c)?.4:c}return{enabled:l,fps:T(h,0,12,F("canvas recording fps"),4),quality:T(d,0,1,F("canvas recording quality"),.4)}}get wd(){var t,e=!(null==(t=this.Xa)||!t.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:e}get bd(){var t,e,r,i=null==(t=this.Xa)?void 0:t.networkPayloadCapture,n={recordHeaders:null==(e=this._instance.config.session_recording)?void 0:e.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),a=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),o=ze(this._instance.config.capture_performance),u=ze(null==i?void 0:i.capturePerformance),l=!!(x(o)?o:u);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}kd(){var t,e,r=[],n=null==(t=s.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;n&&this.wd&&r.push(n());var a=null==(e=s.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordNetworkPlugin;return this.bd&&b(a)&&(!W.includes(i.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(a(((t,e)=>{var r,i={payloadSizeLimitBytes:J.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...J.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...J.payloadHostDenyList]},n=!1!==t.session_recording.recordHeaders&&e.recordHeaders,s=!1!==t.session_recording.recordBody&&e.recordBody,a=!1!==t.capture_performance&&e.recordPerformance,o=(r=Z(i),t=>(null!=t&&t.requestBody&&(t.requestBody=et(t.requestBody,t.requestHeaders,r,"Request")),null!=t&&t.responseBody&&(t.responseBody=et(t.responseBody,t.responseHeaders,r,"Response")),t)),l=e=>{return o(((t,e)=>{var r,i=B(t.name),n=0===e.indexOf("http")?null==(r=B(e))?void 0:r.pathname:e;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&tt.some((t=>0===s.indexOf(t)))))return t})((K((r=e).requestHeaders),K(r.responseHeaders),r),t.api_host));var r},h=b(t.session_recording.maskNetworkRequestFn);return h&&b(t.session_recording.maskCapturedNetworkRequestFn)&&L.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{var r=t.session_recording.maskNetworkRequestFn({url:e.name});return u({},e,{name:null==r?void 0:r.url})}),i.maskRequestFn=b(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var r,i=l(e);return i&&null!==(r=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(i))&&void 0!==r?r:void 0}:t=>function(t){if(!_(t))return t.requestBody=rt(t.requestBody,"Request"),t.responseBody=rt(t.responseBody,"Response"),t}(l(t)),u({},J,i,{recordHeaders:n,recordBody:s,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.bd))):Ge.info("NetworkCapture not started because we are on localhost.")),r}_d(t){return this._instance.config.disable_capture_url_hashes?A(t):t}Sd(t,e){void 0===e&&(e=!1);var r=e?A(t):this._d(t),i=this._instance.config.mask_personal_data_properties?[...Ue,...this._instance.config.custom_personal_data_properties||[]]:[];return this.Id(function(t,e,r){if(!t||!e||!e.length)return t;for(var i=t.split("#"),n=i[1],s=(i[0]||"").split("?"),a=s[1],o=s[0],u=(a||"").split("&"),l=[],h=0;u.length>h;h++){var d=u[h].split("=");w(d)&&(e.includes(d[0])?l.push(d[0]+"=<masked>"):l.push(u[h]))}var c=o;return null!=a&&(c+="?"+l.join("&")),null!=n&&(c+="#"+n),c}(r,i))}Id(t){var e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var r,i=e.maskCapturedNetworkRequestFn({name:t});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(e.maskNetworkRequestFn){var n=e.maskNetworkRequestFn({url:t});return null==n?void 0:n.url}return t}Md(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.Bh.length?this.Bh.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Ge.warn("could not emit queued rrweb event.",e,t),!1}}xh(t,e){return this.Md(Ze((()=>Qe().addCustomEvent(t,e))))}Cd(){try{if(this._instance.config.capture_pageview||!t)return;var e=new URL(t.location.href),r=this.Sd(e.origin+e.pathname+e.search);this.xd!==r&&(this.xd=r,this.xh("$url_changed",{href:r}))}catch(t){}}Rd(){if(this.Bh.length){var t=[...this.Bh];this.Bh=[],t.forEach((t=>{Date.now()-t.enqueuedAt>2e3||this.Md(t)}))}}bh(){return this.Md(Ze((()=>Qe().takeFullSnapshot())))}get Td(){var t,e,r;if(null!=(t=this.Lh)&&t.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return C(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(e=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Od(){if(this.Ad&&clearInterval(this.Ad),!0!==this.$h){var t=this.Td;t&&(this.Ad=setInterval((()=>{this.bh()}),t))}}kh(){!this.ih.urlBlocked&&["sampled","active"].includes(this.status)&&this.Od()}Ed(){this.ih.urlBlocked||(this.ih.urlBlocked=!0,clearInterval(this.Ad),Ge.info("recording paused due to URL blocker"),this.xh("recording paused",{reason:"url blocker"}))}Nd(){this.ih.urlBlocked&&(this.ih.urlBlocked=!1,this.bh(),this.Od(),this.xh("recording resumed",{reason:"left blocked url"}),Ge.info("recording resumed"))}Ld(t,e){var r;if(!this.Wh&&null!=(r=this.Lh)&&r.hasPendingTriggers(this.sessionId)){this.Wh=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===t?dt:ct]:this.sessionId}),null==(n=this.Lh)||n.updateActiveTriggers(this.sessionId),this.kh(),this.dd(),this.wh(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.Wh=!1}}}get isStarted(){return!!this.Dh}get Xa(){var t=this._instance.get_property(it);if(t){var e;try{e=k(t)?t:JSON.parse(t)}catch(t){return void Ge.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted){var r,i,n=null!==(r=e.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>36e5)return Ge.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t}),void(null==(i=this._instance.persistence)||i.unregister(it))}return e}}Fd(t,e,r){this._instance.get_property(t)&&(e(),r())}start(e){var r,i,n=this.Xa;if(n){this.Xh&&(this.Dd(),this.vd());var s=this.Oh.checkAndGetSessionAndWindowId(),a=s.windowId;this.Mi=s.sessionId,this.Ii=a,null==(r=this._instance.persistence)||r.unregister(mt),null!=n&&n.endpoint&&(this.Fh=null==n?void 0:n.endpoint),this.Lh=2===(null==n?void 0:n.version)&&(null==n?void 0:n.triggerGroups)&&n.triggerGroups.length>0?new $e(this._instance,this.ih,this.wh.bind(this),this.xh.bind(this),this.kh.bind(this)):new Be(this._instance,this.ih,this.nh,this.sh,this.wh.bind(this),this.bh.bind(this),this.kh.bind(this)),this.Lh.onRemoteConfig(n),null==(i=this.Sh)||i.call(this),this.Sh=this.Lh.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((t,e)=>this.Ld(t,e))),this.Fd(st,(()=>{this.overrideSampling()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(st)})),this.Fd(at,(()=>{this.overrideLinkedFlag()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(at)})),this.Fd(ut,(()=>{this.overrideTrigger("event")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(ut)})),this.Fd(ot,(()=>{this.overrideTrigger("url")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(ot)})),this.Lh.makeSamplingDecisions(this.sessionId),this.Pd(),this.Uh||(P(t,"beforeunload",this.ld),P(t,"offline",this.fd),P(t,"online",this.Bs),P(t,"visibilitychange",this.ke),!this.Kh&&b(this.Oh.onSessionId)&&(this.Kh=this.Oh.onSessionId(this.fi)),!this.td&&b(this.Oh.on)?this.td=this.Oh.on("forcedIdleReset",(()=>{this.nd(),this.$h="unknown",this.stop(),this.ed=this.Oh.onSessionId(((t,e,r)=>{var i;null==(i=this.ed)||i.call(this),this.ed=void 0,this.fi(t,e,r)}))})):b(this.Oh.on)||Ge.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),M(this.Yh)&&(this.Yh=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var e=null!=t&&t.properties.$current_url?this.Sd(t.properties.$current_url):"";if(!e)return;this.xh("$pageview",{href:e})}}catch(t){Ge.error("Could not add $pageview to rrweb session",t)}}))),this.status===_t&&this.wh(e||"recording_initialized"))}else Ge.info("remote config must be stored in persistence before recording can start")}Wd(){var e,r,i,n,s,a;null==t||t.removeEventListener("beforeunload",this.ld),null==t||t.removeEventListener("offline",this.fd),null==t||t.removeEventListener("online",this.Bs),null==t||t.removeEventListener("visibilitychange",this.ke),clearInterval(this.Ad),this.Bd(),null==(e=this.Yh)||e.call(this),this.Yh=void 0,null==(r=this.Sh)||r.call(this),this.Sh=void 0,null==(i=this.Kh)||i.call(this),this.Kh=void 0,null==(n=this.td)||n.call(this),this.td=void 0,null==(s=this.ed)||s.call(this),this.ed=void 0,null==(a=this.Lh)||a.stop(),this.$d(),this.Dd()}Dd(){this.Qh+=1,this.Zh=[],this.Jh=0,this.Ud=void 0,this.Xh=!1}$d(){var t,e;null==(t=this.zd)||t.stop(),this.Bh=[],null==(e=this.Dh)||e.call(this),this.Dh=void 0}jd(){if(!this.Ud||0===this.Jh)return!1;if(this.Xh)return!0;this.Xh=!0;var t=this.Qh;return this.Bd(),this.$d(),this.Ud.catch((()=>{})).then((()=>{t===this.Qh&&(this.Xh=!1,this.dd(),this.vd(),this.Wd(),Ge.info("stopped"))})).catch((()=>{this.Xh=!1,this.Wd(),Ge.info("stopped")})),!0}stop(){this.jd()||(this.dd(),this.vd(),this.Wd(),Ge.info("stopped"))}discard(){this.vd(),this.Wd(),Ge.info("discarded")}qd(t,e,r,i,n){var s,a={$snapshot_bytes:r,$snapshot_data:e,$session_id:i,$window_id:n};t.type===h.FullSnapshot&&null!=(s=Je())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this.jh=!0),this.status!==bt?(this.Hd(t,i),this.Gd(a)):this.vd()}Hd(t,e){t.type!==h.FullSnapshot?t.type===h.IncrementalSnapshot&&(_(this.Gh)||this.Gh===e||this.Vh===e||(this.Vh=e,Ge.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.bh())):this.Gh=e}Vd(t){t.counted&&t.generation===this.Qh&&(this.Jh=Math.max(0,this.Jh-1)),t.counted=!1,this.Zh=this.Zh.filter((e=>e!==t))}Zd(t,e,r){t.processed||t.generation!==this.Qh||(t.processed=!0,this.qd(t.event,e,r,t.targetSessionId,t.targetWindowId))}Jd(t){try{var e=t.compressionEnabled?hr(t.event):{event:t.event,size:jt(t.event)};this.Zd(t,e.event,e.size)}finally{this.Vd(t)}}hd(){[...this.Zh].forEach((t=>{this.Jd(t)}))}Qd(t,e,r,i){var n=this,s={event:t,compressionEnabled:e,targetSessionId:r,targetWindowId:i,generation:this.Qh,processed:!1,counted:!0};this.Zh.push(s),this.Jh+=1;var a=function(){var r=o((function*(){try{if(s.processed)return;var r,i;try{var a=e?ar(t)?yield function(t){return dr.apply(this,arguments)}(t):hr(t):{event:t,size:jt(t)};r=a.event,i=a.size}catch(e){Ge.error("could not process queued compression event - will use uncompressed event",e),r=t,i=jt(t)}n.Zd(s,r,i)}finally{n.Vd(s)}}));return function(){return r.apply(this,arguments)}}();this.Ud=this.Ud?this.Ud.catch((()=>{})).then(a):a()}onRRwebEmit(t){var e,r,i,n,s,a,o;if(this._instance.sessionManager&&(this.Rd(),t&&k(t))){if(t.type===h.Meta){var u=this.Sd(t.data.href);if(this.xd=u,!u)return;t.data.href=u}else this.Cd();if(null==(e=this.Lh)||e.checkUrlTriggers(this.sessionId,(()=>this.Ed()),(()=>this.Nd()),((t,e)=>this.Ld(t,e))),!this.ih.urlBlocked||(l=t).type===h.Custom&&"recording paused"===l.data.tag){var l,d,c;t.type===h.FullSnapshot&&(this.Od(),null==(d=this.zd)||d.reset(),null==(c=this._instance.persistence)||c.register_once({[mt]:t.timestamp},void 0)),t.type===h.FullSnapshot&&null!=(r=this.Lh)&&r.hasPendingTriggers(this.sessionId)&&this.Xd();var v=this.zd?this.zd.throttleMutations(t):t;if(v){var f=function(t){var e=t;if(e&&k(e)&&6===e.type&&k(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var r=[],i=0;e.data.payload.payload.length>i;i++)r.push(e.data.payload.payload[i]&&e.data.payload.payload[i].length>2e3?e.data.payload.payload[i].slice(0,2e3)+"...[truncated]":e.data.payload.payload[i]);return e.data.payload.payload=r,t}return t}(v),p=function(t){return fr(t)?t.data.payload:null}(f),m=function(t){return pr(t)?t.data.payload:null}(f);if(p||m){var g=null!=p?p:m;null!=g&&g.lastActivityTimestamp&&(f.timestamp=g.lastActivityTimestamp)}else this.Yd(f);t.type===h.FullSnapshot&&(this.Hh.push([this.Mi,t.timestamp]),this.Hh.length>6&&(this.Hh=this.Hh.slice(-6)));var y=null!==(i=null!==(n=null==p?void 0:p.currentSessionId)&&void 0!==n?n:null==m?void 0:m.nextSessionId)&&void 0!==i?i:this.Mi,w=null!==(s=null!==(a=null==p?void 0:p.currentWindowId)&&void 0!==a?a:null==m?void 0:m.nextWindowId)&&void 0!==s?s:this.Ii;if(!0!==this.$h||function(t){return vr(t)||fr(t)||pr(t)}(f)){if(vr(f)){var b=f.data.payload;b&&(f.timestamp=b.lastActivityTimestamp+b.threshold)}var _=null===(o=this._instance.config.session_recording.compress_events)||void 0===o||o;if(this.Jh>0||_&&ar(f))this.Qd(f,_,y,w);else{var S=_?hr(f):{event:f,size:jt(f)};this.qd(f,S.event,S.size,y,w)}}}}}}get status(){return this.Lh?this.Lh.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Eh,rrwebError:this.Uh,urlTriggerMatching:this.ih,eventTriggerMatching:this.nh,linkedFlagMatching:this.sh,remoteConfig:this.Xa}):bt}log(t,e){var r;void 0===e&&(e="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.sh.linkedFlagSeen=!0,this.bh(),this.wh("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[lt]:this.sessionId,[nt]:null}),this.bh(),this.wh("sampling_overridden")}overrideTrigger(t){this.Ld(t)}Kd(){try{var e,r=null==t||null==(e=t.location)?void 0:e.href;if(!r)return;var i=this.Sd(r);if(!i)return;return new URL(i).hostname||void 0}catch(t){return}}Bd(){this.tc&&(clearTimeout(this.tc),this.tc=void 0)}dd(){var t;this.Bd(),null==(t=this.Lh)||t.ensureSamplingDecision(this.sessionId);var e=this.od();if(this.status===St||this.status===It||this.status===bt||e)return this.tc=setTimeout((()=>{this.dd()}),2e3),this.R;if(this.R.data.length>0){var r,i=this.Kd();Ht(this.R).forEach((t=>{var e;null==(e=this.rd)||e.trackSize(t.sessionId,t.size),this.ec({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:E.LIB_NAME,$lib_version:E.LIB_VERSION,$snapshot_host:i})})),null==(r=this.Lh)||r.onFlushComplete()}return this.vd()}Gd(t){var e,r=2+((null==(e=this.R)?void 0:e.data.length)||0),i=t.$session_id,n=this.R.sessionId!==i;(n||!0!==this.$h&&this.R.size+t.$snapshot_bytes+r>943718.4)&&(this.R=this.dd(),n&&this.R.data.length>0&&(this.R=this.vd()),this.R.sessionId=i,this.R.windowId=t.$window_id),this.R.size+=t.$snapshot_bytes,this.R.data.push(t.$snapshot_data),this.R.sizes.push(t.$snapshot_bytes),this.tc||!0===this.$h||(this.tc=setTimeout((()=>{this.dd()}),2e3))}ec(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.Fh),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get ud(){var t,e,r=null==(t=this.R)?void 0:t.data[(null==(e=this.R)?void 0:e.data.length)-1],i=this.Oh.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}Xd(){if(!this.R||0===this.R.data.length)return this.vd();for(var t=-1,e=this.R.data.length-1;e>=0;e--)if(this.R.data[e].type===h.Meta){t=e;break}return 0>t?this.vd():(this.R.data=this.R.data.slice(t),this.R.sizes=this.R.sizes.slice(t),this.R.size=this.R.sizes.reduce(((t,e)=>t+e),0),this.R)}vd(){return this.R={size:0,data:[],sizes:[],sessionId:this.Mi,windowId:this.Ii},this.R}wh(t,e){this._instance.register_for_session({$session_recording_start_reason:t}),Ge.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.xh("$recording_started",u({reason:t},e))}rc(t){var e;return 3===t.type&&-1!==Ve.indexOf(null==(e=t.data)?void 0:e.source)}Yd(t){var e=this.rc(t);e||this.$h||t.timestamp-this.Ph>this.Ah&&(this.$h=!0,clearInterval(this.Ad),this.xh("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.Ph,threshold:this.Ah,bufferLength:this.R.data.length,bufferSize:this.R.size}),this.dd());var r=!1;if(e&&(this.Ph=t.timestamp,this.$h)){var i="unknown"===this.$h;this.$h=!1,i||(this.xh("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!0!==this.$h){var n=this.Oh.checkAndGetSessionAndWindowId(!e,t.timestamp),s=n.windowId,a=n.sessionId,o=this.Mi!==a,u=this.Ii!==s;this.Ii=s,this.Mi=a,o||u?(this.stop(),this.start("session_id_changed")):r&&this.Od()}}nd(){var t;null==(t=this.Lh)||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e=this.Oh.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.R.data.length,$sdk_debug_replay_internal_buffer_size:this.R.size,$sdk_debug_current_session_duration:this.ud,$sdk_debug_session_start:e.sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(t=this.rd)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Hh,$snapshot_max_depth_exceeded:this.jh,$sdk_debug_replay_rrweb_error:this.Uh,$sdk_debug_rrweb_attached:!!this.Dh,$sdk_debug_rrweb_start_attempted:this.zh}}Pd(){var t;if(!this.Dh){this.zh=!0;var e,r,i,n={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1,attributeFilter:void 0},s=this._instance.config.session_recording;for(var a of Object.entries(s||{})){var o=a[0],l=a[1];o in n&&("maskInputOptions"===o?n.maskInputOptions=u({password:!0},l):n[o]=l)}this.yd&&this.yd.enabled&&(n.recordCanvas=!0,n.sampling={canvas:this.yd.fps},n.dataURLOptions={type:"image/webp",quality:this.yd.quality},n.canvasResolutionScale=this.gd),this.pd&&(n.maskAllInputs=null===(e=this.pd.maskAllInputs)||void 0===e||e,n.maskTextSelector=null!==(r=this.pd.maskTextSelector)&&void 0!==r?r:void 0,n.blockSelector=null!==(i=this.pd.blockSelector)&&void 0!==i?i:void 0),this.md();var h=Qe();if(h){this.zd=null!==(t=this.zd)&&void 0!==t?t:new Re(h,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{var r="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";Ge.info(r,{node:e}),this.log(He+" "+r,"warn")}});var d=this.kd();if(this.Dh=h(u({emit:t=>{this.onRRwebEmit(t)},plugins:d},n)),!this.Dh)return this.Uh=!0,void Ge.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.Uh=!1,this.Ph=Date.now(),this.$h=x(this.$h)?this.$h:"unknown",this.tryAddCustomEvent("$remote_config_received",this.Xa),this.xh("$session_options",{sessionRecordingOptions:n,activePlugins:d.map((t=>null==t?void 0:t.name))}),this.xh("$posthog_config",{config:this._instance.config})}else Ge.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(t,e){return this.xh(t,e)}}var gr,yr=["type"],wr=Object.defineProperty,br=(t,e,r)=>((t,e,r)=>e in t?wr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),kr=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(kr||{}),_r=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(_r||{}),Sr=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(Sr||{}),Ir=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Ir||{}),Mr=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(Mr||{}),Cr=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(Cr||{}),xr=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(xr||{}),Rr={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Tr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Or={};function Ar(t){if(Or[t])return Or[t];var e=function(t){var e,r,i=null==(r=null==(e=null==globalThis?void 0:globalThis.Zone)?void 0:e.__symbol__)?void 0:r.call(e,t);return i&&globalThis[i]?globalThis[i]:void 0}(t)||globalThis[t],r=e.prototype,i=t in Rr?Rr[t]:void 0,n=Boolean(i&&i.every((t=>{var e,i;return Boolean(null==(i=null==(e=Object.getOwnPropertyDescriptor(r,t))?void 0:e.get)?void 0:i.toString().includes("[native code]"))}))),s=t in Tr?Tr[t]:void 0,a=Boolean(s&&s.every((t=>{var e;return"function"==typeof r[t]&&(null==(e=r[t])?void 0:e.toString().includes("[native code]"))})));if(n&&a)return Or[t]=e.prototype,e.prototype;var o=document.createElement("iframe");o.style.display="none";var u,l=!1;try{document.body.appendChild(o);var h=o.contentWindow;if(!h)return e.prototype;var d=h[t].prototype;return d?((u=navigator.userAgent).includes("Safari")&&!u.includes("Chrome")&&(o.classList.add("rr-block","ph-no-capture"),o.setAttribute("__rrwebUntaintedPrototype",t),l=!0),Or[t]=d):r}catch(t){return r}finally{!l&&o.parentNode&&document.body.removeChild(o)}}var Er={};function Nr(t,e,r){var i,n=t+"."+String(r);if(Er[n])return Er[n].call(e);var s=Ar(t),a=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return a?(Er[n]=a,a.call(e)):e[r]}var Lr={};function Fr(t,e,r){var i=t+"."+String(r);if(Lr[i])return Lr[i].bind(e);var n=Ar(t)[r];return"function"!=typeof n?e[r]:(Lr[i]=n,n.bind(e))}function Dr(){return Ar("MutationObserver").constructor}function Pr(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n={next:i},s=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return n.next.apply(this,e)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]!==s)for(var r=t[e];"function"==typeof r&&r.__rrweb_layer__;){var i=r.__rrweb_layer__;if(i.next===s)return void(i.next=n.next);r=i.next}else t[e]=n.next}}catch(t){return()=>{}}}var Wr={childNodes:t=>Nr("Node",t,"childNodes"),parentNode:t=>Nr("Node",t,"parentNode"),parentElement:t=>Nr("Node",t,"parentElement"),textContent:t=>Nr("Node",t,"textContent"),contains:(t,e)=>Fr("Node",t,"contains")(e),getRootNode:t=>Fr("Node",t,"getRootNode")(),host:t=>t&&"host"in t?Nr("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?Nr("Element",t,"shadowRoot"):null,querySelector:(t,e)=>Fr("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>Fr("Element",t,"querySelectorAll")(e),mutationObserver:Dr,patch:Pr};function Br(t){return t.nodeType===t.ELEMENT_NODE}function $r(t){var e=t&&"host"in t&&"mode"in t&&Wr.host(t)||null;return Boolean(e&&"shadowRoot"in e&&Wr.shadowRoot(e)===t)}function Ur(t){return"[object ShadowRoot]"==={}.toString.call(t)}function zr(t){try{var e=t.rules||t.cssRules;if(!e)return null;var r=t.href;return!r&&t.ownerNode&&(r=t.ownerNode.baseURI),(i=Array.from(e,(t=>jr(t,r))).join("")).includes(" background-clip: text;")&&!i.includes(" -webkit-background-clip: text;")&&(i=i.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),i}catch(t){return null}var i}function jr(t,e){var r;if(function(t){return"styleSheet"in t}(t)){var i;try{i=zr(t.styleSheet)||function(t){var e=t.cssText;if(3>e.split('"').length)return e;var r=["@import","url("+JSON.stringify(t.href)+")"];return""===t.layerName?r.push("layer"):t.layerName&&r.push("layer("+t.layerName+")"),t.supportsText&&r.push("supports("+t.supportsText+")"),t.media.length&&r.push(t.media.mediaText),r.join(" ")+";"}(t)}catch(e){i=t.cssText}try{if(i&&(null==(r=t.styleSheet)?void 0:r.href))return Kr(i,t.styleSheet.href)}catch(t){}return i}var n=t.cssText;return function(t){return"selectorText"in t}(t)&&t.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),e?Kr(n,e):n}class qr{constructor(){br(this,"idNodeMap",new Map),br(this,"nodeMetaMap",new WeakMap)}getId(t){var e;if(!t)return-1;var r=null==(e=this.getMeta(t))?void 0:e.id;return null!=r?r:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){var e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach((t=>this.removeNodeFromMap(t))),Br(t)){var r=Wr.shadowRoot(t);r&&this.removeNodeFromMap(r),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(e,i)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Hr(t){var e=t.element,r=t.maskInputOptions,i=t.tagName,n=t.type,s=t.maskInputFn,a=t.value||"",o=n&&Gr(n);return(r[i.toLowerCase()]||o&&r[o])&&(a=s?s(a,e):"*".repeat(a.length)),a}function Gr(t){return t.toLowerCase()}var Vr="__rrweb_original__";function Zr(t){try{var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Gr(e):null}catch(t){return null}}var Jr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Qr=/^(?:[a-z+]+:)?\/\//i,Xr=/^www\..*/i,Yr=/^(data:)([^,]*),(.*)/i;function Kr(t,e){return(t||"").replace(Jr,((t,r,i,n,s,a)=>{var o,u=i||s||a,l=r||n||"";if(!u)return t;if(Qr.test(u)||Xr.test(u))return"url("+l+u+l+")";if(Yr.test(u))return"url("+l+u+l+")";if("/"===u[0])return"url("+l+(((o=e).indexOf("//")>-1?o.split("/").slice(0,3).join("/"):o.split("/")[0]).split("?")[0]+u)+l+")";var h=e.split("/"),d=u.split("/");for(var c of(h.pop(),d))"."!==c&&(".."===c?h.pop():h.push(c));return"url("+l+h.join("/")+l+")"}))}var ti,ei,ri="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",ii=4096,ni=1,si=new RegExp("[^a-z0-9-_:]"),ai=-2;function oi(){return ni++}var ui=/^[^ \t\n\r\u000c]+/,li=/^[, \t\n\r\u000c]+/,hi=new WeakMap;function di(t,e){return e&&""!==e.trim()?ci(t,e):e}function ci(t,e){var r=hi.get(t);if(r||(r=t.createElement("a"),hi.set(t,r)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return r.setAttribute("href",e),r.href}function vi(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?ri:t}(t,e.maxBase64ImageLength):t}function fi(t,e,r,i,n,s){var a;if(!i)return i;if("src"===r||"href"===r&&("use"!==e||"#"!==i[0])){if("link"===e&&n){var o=null==(a=n.sheet)?void 0:a.href;if(o)return o}var u=di(t,i);if(u.startsWith("data:")){if("img"===e&&n){var l=u;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(l=function(t,e,r,i){if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>ii||t.naturalHeight>ii)return e;try{var n=document.createElement("canvas");n.width=t.naturalWidth,n.height=t.naturalHeight;var s=n.getContext("2d");return s?(s.drawImage(t,0,0),n.toDataURL(r||"image/webp",null!=i?i:.4)):e}catch(t){return e}}(n,u,s.type,s.quality)),vi(l,s)}if("image"===e)return vi(u,s)}return u}if("xlink:href"===r&&"#"!==i[0]){var h=di(t,i);return"image"===e&&h.startsWith("data:")?vi(h,s):h}return"background"!==r||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===r?function(t,e){if(""===e.trim())return e;var r=0;function i(t){var i,n=t.exec(e.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(li),e.length>r;){var s=i(ui);if(","===s.slice(-1))s=di(t,s.substring(0,s.length-1)),n.push(s);else{var a="";s=di(t,s);for(var o=!1;;){var u=e.charAt(r);if(""===u){n.push((s+a).trim());break}if(o)")"===u&&(o=!1);else{if(","===u){r+=1,n.push((s+a).trim());break}"("===u&&(o=!0)}a+=u,r+=1}}}return n.join(", ")}(t,i):"style"===r?Kr(i,ci(t)):"object"===e&&"data"===r?di(t,i):i:di(t,i)}function pi(t,e,r){return("video"===t||"audio"===t)&&"autoplay"===e}function mi(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!r&&mi(Wr.parentNode(t),e,r);for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!r&&mi(Wr.parentNode(t),e,r)}function gi(t,e,r,i){var n;if(Br(t)){if(!Wr.childNodes(n=t).length)return!1}else{if(null===Wr.parentElement(t))return!1;n=Wr.parentElement(t)}try{if("string"==typeof e){if(i){if(n.closest("."+e))return!0}else if(n.classList.contains(e))return!0}else if(mi(n,e,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(t){}return!1}function yi(t,e,r){var i=t.removeEventListener;"function"==typeof i&&i.call(t,e,r)}var wi=new Map;function bi(t,e){return Array.from(t.styleSheets).find((t=>t.href===e))}function ki(t){return null==t?"":t.toLowerCase()}var _i=50,Si=!1,Ii=!1;function Mi(t,e){var r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,a=e.maskTextClass,o=e.maskTextSelector,u=e.skipChild,l=void 0!==u&&u,h=e.inlineStylesheet,d=void 0===h||h,c=e.maskInputOptions,v=void 0===c?{}:c,f=e.maskTextFn,p=e.maskInputFn,m=e.slimDOMOptions,g=e.dataURLOptions,y=void 0===g?{}:g,w=e.inlineImages,b=void 0!==w&&w,k=e.recordCanvas,_=void 0!==k&&k,S=e.onSerialize,I=e.onIframeLoad,M=e.iframeLoadTimeout,C=void 0===M?5e3:M,x=e.onIframeListenerRegistered,R=e.onStylesheetLoad,T=e.stylesheetLoadTimeout,O=void 0===T?5e3:T,A=e.keepIframeSrcFn,E=void 0===A?()=>!1:A,N=e.newlyAddedElement,L=void 0!==N&&N,F=e.depth,D=void 0===F?0:F,P=e.maxDepth,W=void 0===P?_i:P,B=e.needsMask,U=e.preserveWhiteSpace,z=void 0===U||U;if(D>=W)return Ii=!0,Si||(Si=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+W+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;B||(B=gi(t,a,o,void 0===B));var j,q=function(t,e){var r=e.doc,i=e.blockClass,n=e.blockSelector,s=e.needsMask,a=e.inlineStylesheet,o=e.maskInputOptions,u=void 0===o?{}:o,l=e.maskTextFn,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,v=e.inlineImages,f=e.recordCanvas,p=e.keepIframeSrcFn,m=e.newlyAddedElement,g=void 0!==m&&m,y=function(t,e){if(e.hasNode(t)){var r=e.getId(t);return 1===r?void 0:r}}(r,e.mirror);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:xr.Document,childNodes:[],compatMode:t.compatMode}:{type:xr.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:xr.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:y};case t.ELEMENT_NODE:return function(t,e){for(var r,i,n,s,a=e.doc,o=e.inlineStylesheet,u=e.maskInputOptions,l=void 0===u?{}:u,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,v=e.inlineImages,f=e.recordCanvas,p=e.keepIframeSrcFn,m=e.newlyAddedElement,g=void 0!==m&&m,y=e.rootId,w=function(t,e,r){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(r)return t.matches(r)}catch(t){}return!1}(t,e.blockClass,e.blockSelector),b=function(t){if(t instanceof HTMLFormElement)return"form";var e=Gr(t.tagName);return si.test(e)?"div":e}(t),k={},_=t.attributes.length,S=0;_>S;S++){var I=t.attributes[S];pi(b,I.name)||(k[I.name]=fi(a,b,Gr(I.name),I.value,t,c))}if("link"===b&&o){var M=t.sheet;if(!M){var C=function(t){return t.href}(t);C&&!(M=bi(a,C))&&C.includes(".css")&&(M=bi(a,window.location.origin+"/"+C.replace(window.location.href,"")))}var x=null;M&&(x=zr(M)),x&&(delete k.rel,delete k.href,k._cssText=x)}if("style"===b&&t.sheet&&!(t.innerText||Wr.textContent(t)||"").trim().length){var R=zr(t.sheet);R&&(k._cssText=R)}if("input"===b||"textarea"===b||"select"===b){var T=t.value,O=t.checked;"radio"!==k.type&&"checkbox"!==k.type&&"submit"!==k.type&&"button"!==k.type&&T?k.value=Hr({element:t,type:Zr(t),tagName:b,value:T,maskInputOptions:l,maskInputFn:h}):O&&(k.checked=O)}if("option"===b&&(t.selected&&!l.select?k.selected=!0:delete k.selected),"dialog"===b&&t.open)try{k.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){k.rr_open_mode="modal",k.ph_rr_could_not_detect_modal=!0}if("canvas"===b&&f)if("2d"===t.__context)(function(t){var e=t.getContext("2d");if(!e)return!0;for(var r=0;t.width>r;r+=50)for(var i=0;t.height>i;i+=50){var n=e.getImageData;if(new Uint32Array((Vr in n?n[Vr]:n).call(e,r,i,Math.min(50,t.width-r),Math.min(50,t.height-i)).data.buffer).some((t=>0!==t)))return!1}return!0})(t)||(k.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){var A=t.toDataURL(c.type,c.quality),E=a.createElement("canvas");E.width=t.width,E.height=t.height,A!==E.toDataURL(c.type,c.quality)&&(k.rr_dataURL=A)}if("img"===b&&v){ti||(ti=a.createElement("canvas"),ei=ti.getContext("2d"));var N=t,L=N.currentSrc||N.getAttribute("src")||"<unknown-src>",F=N.crossOrigin,D=()=>{yi(N,"load",D);try{ti.width=N.naturalWidth,ti.height=N.naturalHeight,ei.drawImage(N,0,0),k.rr_dataURL=ti.toDataURL(c.type,c.quality)}catch(t){if("anonymous"!==N.crossOrigin)return N.crossOrigin="anonymous",void(N.complete&&0!==N.naturalWidth?D():N.addEventListener("load",D));console.warn("Cannot inline img src="+L+"! Error: "+t)}"anonymous"===N.crossOrigin&&(F?k.crossOrigin=F:N.removeAttribute("crossorigin"))};N.complete&&0!==N.naturalWidth?D():N.addEventListener("load",D)}if("audio"===b||"video"===b){var P=k;P.rr_mediaState=t.paused?"paused":"played",P.rr_mediaCurrentTime=t.currentTime,P.rr_mediaPlaybackRate=t.playbackRate,P.rr_mediaMuted=t.muted,P.rr_mediaLoop=t.loop,P.rr_mediaVolume=t.volume}if(g||(t.scrollLeft&&(k.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(k.rr_scrollTop=t.scrollTop)),w){var W=t.getBoundingClientRect(),B=W.width,U=W.height,z=W.left,j=W.top,q=null==(r=a.defaultView)?void 0:r.getComputedStyle(t);k={class:k.class,rr_width:B+"px",rr_height:U+"px",rr_left:Math.floor(z+((null==(i=a.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(j+((null==(n=a.defaultView)?void 0:n.scrollY)||0))+"px"},q&&(k.rr_position=q.position||"static",q.transform&&"none"!==q.transform&&(k.rr_transform=q.transform),q.display&&q.display.startsWith("inline")&&(k.rr_display=q.display))}"iframe"!==b||p(k.src)||(t.contentDocument||(k.rr_src=k.src),delete k.src);try{customElements.get(b)&&(s=!0)}catch(t){}return{type:xr.Element,tagName:b,attributes:k,childNodes:[],isSVG:(H=t,Boolean("svg"===H.tagName||H.ownerSVGElement)||void 0),needBlock:w,rootId:y,isCustom:s};var H}(t,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,dataURLOptions:c,inlineImages:v,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:g,rootId:y});case t.TEXT_NODE:return function(t,e){var r,i=e.needsMask,n=e.maskTextFn,s=e.rootId,a=Wr.parentNode(t),o=a&&a.tagName,u=Wr.textContent(t),l="STYLE"===o||void 0,h="SCRIPT"===o||void 0;if(l&&u){try{if(t.nextSibling||t.previousSibling);else if(null==(r=a.sheet)?void 0:r.cssRules){var d=zr(a.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(u=d)}}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}u=Kr(u,ci(e.doc))}return h&&(u="SCRIPT_PLACEHOLDER"),!l&&!h&&u&&i&&(u=n?n(u,Wr.parentElement(t)):u.replace(/[\S]/g,"*")),{type:xr.Text,textContent:u||"",isStyle:l,rootId:s}}(t,{doc:r,needsMask:s,maskTextFn:l,rootId:y});case t.CDATA_SECTION_NODE:return{type:xr.CDATA,textContent:"",rootId:y};case t.COMMENT_NODE:return{type:xr.Comment,textContent:Wr.textContent(t)||"",rootId:y};default:return!1}}(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,dataURLOptions:y,inlineImages:b,recordCanvas:_,keepIframeSrcFn:E,newlyAddedElement:L});if(!q)return console.warn(t,"not serialized"),null;j=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===xr.Comment)return!0;if(t.type===xr.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t,e){var r,i;try{i=new URL(t,window.location.href)}catch(t){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(ki(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ki(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(ki(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&ki(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ki(t.attributes.property).match(/^(og|twitter|fb):/)||ki(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===ki(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(ki(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(ki(t.attributes.name))||ki(t.attributes.property).match(/^article:/)||ki(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(ki(t.attributes.name)))return!0}}return!1}(q,m)||!z&&q.type===xr.Text&&!q.isStyle&&!q.textContent.replace(/^\s+|\s+$/gm,"").length?ai:oi();var H=Object.assign(q,{id:j});if(i.add(t,H),j===ai)return null;S&&S(t);var G=!l;if(H.type===xr.Element){G=G&&!H.needBlock,delete H.needBlock;var V=Wr.shadowRoot(t);V&&Ur(V)&&(H.isShadowHost=!0)}if((H.type===xr.Document||H.type===xr.Element)&&G){m.headWhitespace&&H.type===xr.Element&&"head"===H.tagName&&(z=!1);var Z={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,preserveWhiteSpace:z,onSerialize:S,onIframeLoad:I,iframeLoadTimeout:C,onIframeListenerRegistered:x,onStylesheetLoad:R,stylesheetLoadTimeout:O,keepIframeSrcFn:E,depth:D+1,maxDepth:W};if(H.type===xr.Element&&"textarea"===H.tagName&&void 0!==H.attributes.value);else for(var J of Array.from(Wr.childNodes(t))){var Q=Mi(J,Z);Q&&H.childNodes.push(Q)}var X=null;if(Br(t)&&(X=Wr.shadowRoot(t)))for(var Y of Array.from(Wr.childNodes(X))){var K=Mi(Y,Z);K&&(Ur(X)&&(K.isShadow=!0),H.childNodes.push(K))}}var tt=Wr.parentNode(t);if(tt&&$r(tt)&&Ur(tt)&&(H.isShadow=!0),H.type===xr.Element&&"iframe"===H.tagName){var et=function(t,e,r){var i,n=()=>{},s=t.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(t){return n}var a=()=>e();if("complete"!==i){var o=!1,u=null,l=()=>{o||(o=!0,null!==u&&(clearTimeout(u),u=null),yi(t,"load",h),t.addEventListener("load",a),e())},h=()=>l();return u=setTimeout(l,r),t.addEventListener("load",h),()=>{null!==u&&(clearTimeout(u),u=null),o?yi(t,"load",a):(o=!0,yi(t,"load",h))}}var d,c="about:blank";try{d=s.location.href}catch(t){return n}if(d!==c||t.src===c||""===t.src){var v=setTimeout(e,0);return t.addEventListener("load",a),()=>{clearTimeout(v),yi(t,"load",a)}}return t.addEventListener("load",a),()=>{yi(t,"load",a)}}(t,(()=>{var e=t.contentDocument;if(e&&I){var r=Mi(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,preserveWhiteSpace:z,onSerialize:S,onIframeLoad:I,iframeLoadTimeout:C,onIframeListenerRegistered:x,onStylesheetLoad:R,stylesheetLoadTimeout:O,keepIframeSrcFn:E,depth:D+1,maxDepth:W});r&&I(t,r)}}),C);null==x||x(t,et)}return H.type===xr.Element&&"link"===H.tagName&&"stylesheet"===H.attributes.rel&&function(e,u,l){if(!wi.has(e)){var h;try{h=e.sheet}catch(t){return}if(!h){var c=new AbortController,g=!1,w=()=>{if(!g){g=!0;try{(()=>{if(R){var e=Mi(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:v,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,preserveWhiteSpace:z,onSerialize:S,onIframeLoad:I,iframeLoadTimeout:C,onStylesheetLoad:R,stylesheetLoadTimeout:O,keepIframeSrcFn:E,depth:D,maxDepth:W});e&&R(t,e)}})()}finally{wi.delete(e),c.abort()}}},k=setTimeout(w,l);c.signal.addEventListener("abort",(()=>clearTimeout(k)),{once:!0}),e.addEventListener("load",w,{signal:c.signal,once:!0}),wi.set(e,c)}}}(t,0,O),H}function Ci(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}class xi{constructor(){br(this,"parentElement",null),br(this,"parentNode",null),br(this,"ownerDocument"),br(this,"firstChild",null),br(this,"lastChild",null),br(this,"previousSibling",null),br(this,"nextSibling",null),br(this,"ELEMENT_NODE",1),br(this,"TEXT_NODE",3),br(this,"nodeType"),br(this,"nodeName"),br(this,"RRNodeType")}get childNodes(){for(var t=[],e=this.firstChild;e;)t.push(e),e=e.nextSibling;return t}contains(t){if(!(t instanceof xi))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Ri(t,e,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>Ti(r,t,e,i)}function Ti(t,e,r,i){Oi((()=>{var n=t.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(t,e,r,i):n.call(t,e,r))}))}function Oi(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var Ai="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.",Ei={map:{},getId(){return console.error(Ai),-1},getNode(){return console.error(Ai),null},removeNodeFromMap(){console.error(Ai)},has(){return console.error(Ai),!1},reset(){console.error(Ai)}};function Ni(t,e,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];var u=Date.now();n||!1!==r.leading||(n=u);var l=e-(u-n),h=this;0>=l||l>e?(i&&(clearTimeout(i),i=null),n=u,t.apply(h,a)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,t.apply(h,a)}),l))}}function Li(t,e,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(t,e);return n.Object.defineProperty(t,e,i?r:{set(t){if(setTimeout((()=>{try{r.set.call(this,t)}catch(t){}}),0),s&&s.set){if(s.get)try{s.get.call(this)}catch(t){return}s.set.call(this,t)}}}),()=>Li(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Ei=new Proxy(Ei,{get(t,e,r){return"map"===e&&console.error(Ai),Reflect.get(t,e,r)}}));var Fi=Date.now;function Di(t){var e,r,i,n,s=t.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(e=Wr.parentElement(s.body))?void 0:e.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(i=Wr.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function Pi(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Wi(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Bi(t){return t?t.nodeType===t.ELEMENT_NODE?t:Wr.parentElement(t):null}function $i(t,e,r,i){if(!t)return!1;var n=Bi(t);if(!n)return!1;try{if("string"==typeof e){if(n.classList.contains(e))return!0;if(i&&null!==n.closest("."+e))return!0}else if(mi(n,e,i))return!0}catch(t){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function Ui(t,e,r){return!("TITLE"!==t.tagName||!r.headTitleMutations)||e.getId(t)===ai}function zi(t,e){if($r(t))return!1;var r=e.getId(t);if(!e.has(r))return!0;var i=Wr.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||zi(i,e))}function ji(t){return Boolean(t.changedTouches)}function qi(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Hi(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Gi(t){return!!t&&(t instanceof xi&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(Wr.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Fi=()=>(new Date).getTime());class Vi{constructor(){br(this,"id",1),br(this,"styleIDMap",new WeakMap),br(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){return this.has(t)?this.getId(t):(r=void 0===e?this.id++:e,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r);var r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Zi(t){var e,r=null;return"getRootNode"in t&&(null==(e=Wr.getRootNode(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Wr.host(Wr.getRootNode(t))&&(r=Wr.host(Wr.getRootNode(t))),r}function Ji(t){var e=t.ownerDocument;return!!e&&(Wr.contains(e,t)||function(t){var e=t.ownerDocument;if(!e)return!1;var r=function(t){for(var e,r=t;e=Zi(r);)r=e;return r}(t);return Wr.contains(e,r)}(t))}function Qi(t){return"__ln"in t}class Xi{constructor(){br(this,"length",0),br(this,"head",null),br(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");for(var e=this.head,r=0;t>r;r++)e=(null==e?void 0:e.next)||null;return e}addNode(t){var e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Qi(t.previousSibling)){var r=t.previousSibling.__ln.next;e.next=r,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,r&&(r.previous=e)}else if(t.nextSibling&&Qi(t.nextSibling)&&t.nextSibling.__ln.previous){var i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){var e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}var Yi,Ki=(t,e)=>t+"@"+e;class tn{constructor(){br(this,"frozen",!1),br(this,"locked",!1),br(this,"texts",[]),br(this,"attributes",[]),br(this,"attributeMap",new WeakMap),br(this,"removes",[]),br(this,"mapRemoves",[]),br(this,"movedMap",{}),br(this,"addedSet",new Set),br(this,"movedSet",new Set),br(this,"droppedSet",new Set),br(this,"removesSubTreeCache",new Set),br(this,"mutationCb"),br(this,"blockClass"),br(this,"blockSelector"),br(this,"maskTextClass"),br(this,"maskTextSelector"),br(this,"inlineStylesheet"),br(this,"maskInputOptions"),br(this,"maskTextFn"),br(this,"maskInputFn"),br(this,"keepIframeSrcFn"),br(this,"recordCanvas"),br(this,"inlineImages"),br(this,"slimDOMOptions"),br(this,"dataURLOptions"),br(this,"doc"),br(this,"mirror"),br(this,"iframeManager"),br(this,"stylesheetManager"),br(this,"shadowDomManager"),br(this,"canvasManager"),br(this,"processedNodeManager"),br(this,"unattachedDoc"),br(this,"canvasManagerReleased",!1),br(this,"processMutations",(t=>{t.forEach(this.processMutation),this.emit()})),br(this,"emit",(()=>{if(!this.frozen&&!this.locked){for(var t=[],e=new Set,r=new Xi,i=t=>{for(var e=t,r=ai;r===ai;)r=(e=e&&e.nextSibling)&&this.mirror.getId(e);return r},n=n=>{var s=Wr.parentNode(n);if(s&&Ji(n)&&"TEXTAREA"!==s.tagName){var a=$r(s)?this.mirror.getId(Zi(n)):this.mirror.getId(s),o=i(n);if(-1===a||-1===o)return r.addNode(n);var u=Mi(n,{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:t=>{qi(t,this.mirror)&&this.iframeManager.addIframe(t),Hi(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Gi(n)&&this.shadowDomManager.addShadowRoot(Wr.shadowRoot(n),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});u&&(t.push({parentId:a,nextId:o,node:u}),e.add(u.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)rn(this.removesSubTreeCache,s)&&!this.movedSet.has(Wr.parentNode(s))||n(s);for(var a of this.addedSet)nn(this.droppedSet,a)||rn(this.removesSubTreeCache,a)?nn(this.movedSet,a)?n(a):this.droppedSet.add(a):n(a);for(var o=null;r.length;){var u=null;if(o){var l=this.mirror.getId(Wr.parentNode(o.value)),h=i(o.value);-1!==l&&-1!==h&&(u=o)}if(!u)for(var d=r.tail;d;){var c=d;if(d=d.previous,c){var v=this.mirror.getId(Wr.parentNode(c.value));if(-1===i(c.value))continue;if(-1!==v){u=c;break}var f=Wr.parentNode(c.value);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var p=Wr.host(f);if(-1!==this.mirror.getId(p)){u=c;break}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}o=u.previous,r.removeNode(u.value),n(u.value)}var m={texts:this.texts.map((t=>{var e=t.node,r=Wr.parentNode(e);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(e),value:t.value}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),attributes:this.attributes.map((t=>{var e=t.attributes;if("string"==typeof e.style){var r=JSON.stringify(t.styleDiff),i=JSON.stringify(t._unchangedStyles);e.style.length>r.length&&(r+i).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}return{id:this.mirror.getId(t.node),attributes:e}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),removes:this.removes,adds:t};(m.texts.length||m.attributes.length||m.removes.length||m.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(m))}})),br(this,"bufferBelongsToIframe",(t=>this.doc===t.contentDocument)),br(this,"genTextAreaValueMutation",(t=>{var e=this.attributeMap.get(t);e||(this.attributes.push(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t,e));var r=Array.from(Wr.childNodes(t),(t=>Wr.textContent(t)||"")).join("");e.attributes.value=Hr({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Zr(t),value:r,maskInputFn:this.maskInputFn})})),br(this,"processMutation",(t=>{if(!Ui(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":var e=Wr.textContent(t.target);$i(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:gi(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Bi(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break;case"attributes":var r=t.target,i=t.attributeName,n=t.target.getAttribute(i);if("value"===i){var s=Zr(r);n=Hr({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if($i(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;var a=this.attributeMap.get(t.target);if("IFRAME"===r.tagName&&"src"===i&&!this.keepIframeSrcFn(n)){if(r.contentDocument)return;i="rr_src"}if(a||(this.attributes.push(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t.target,a)),"type"===i&&"INPUT"===r.tagName&&"password"===(t.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!pi(r.tagName,i))if(a.attributes[i]=fi(this.doc,Gr(r.tagName),Gr(i),n,r,this.dataURLOptions),"style"===i){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}var o=this.unattachedDoc.createElement("span");for(var u of(t.oldValue&&(o.style.cssText=t.oldValue),Array.from(r.style))){var l=r.style.getPropertyValue(u),h=r.style.getPropertyPriority(u);l!==o.style.getPropertyValue(u)||h!==o.style.getPropertyPriority(u)?a.styleDiff[u]=""===h?l:[l,h]:a._unchangedStyles[u]=[l,h]}for(var d of Array.from(o.style))""===r.style.getPropertyValue(d)&&(a.styleDiff[d]=!1)}else"open"===i&&"DIALOG"===r.tagName&&(a.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if($i(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach((e=>this.genAdds(e,t.target))),t.removedNodes.forEach((e=>{var r=this.mirror.getId(e),i=$r(t.target)?this.mirror.getId(Wr.host(t.target)):this.mirror.getId(t.target);$i(t.target,this.blockClass,this.blockSelector,!1)||Ui(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(en(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||zi(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Ki(r,i)]?en(this.movedSet,e):(this.removes.push({parentId:i,id:r,isShadow:!(!$r(t.target)||!Ur(t.target))||void 0}),function(t,e){for(var r=[t];r.length;){var i=r.pop();e.has(i)||(e.add(i),Wr.childNodes(i).forEach((t=>r.push(t))))}}(e,this.removesSubTreeCache))),this.mapRemoves.push(e))}))}})),br(this,"genAdds",((t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Ui(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);var r=null;e&&this.mirror.hasNode(e)&&(r=this.mirror.getId(e)),r&&-1!==r&&(this.movedMap[Ki(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);$i(t,this.blockClass,this.blockSelector,!1)||(Wr.childNodes(t).forEach((t=>this.genAdds(t))),Gi(t)&&Wr.childNodes(Wr.shadowRoot(t)).forEach((e=>{this.processedNodeManager.add(e,this),this.genAdds(e,t)})))}}}))}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((e=>{this[e]=t[e]})),this.canvasManager.acquire()}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.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function en(t,e){t.delete(e),Wr.childNodes(e).forEach((e=>en(t,e)))}function rn(t,e,r){return 0!==t.size&&function(t,e,r){var i=Wr.parentNode(e);return!!i&&t.has(i)}(t,e)}function nn(t,e){return 0!==t.size&&sn(t,e)}function sn(t,e){var r=Wr.parentNode(e);return!!r&&(!!t.has(r)||sn(t,r))}var an=t=>Yi?function(){try{return t(...arguments)}catch(t){if(Yi&&!0===Yi(t))return;throw t}}:t,on=[];function un(t){try{if("composedPath"in t){var e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function ln(t,e){var r=new tn;on.push(r),r.init(t);var i=new(Dr())(an(r.processMutations.bind(r))),n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(n.attributeFilter=t.attributeFilter),i.observe(e,n),{observer:i,buffer:r}}function hn(t){var e=t.scrollCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling,o=new Map,u=t=>{var a=un(t);if(a&&!$i(a,n,s,!0)){var u,l,h=i.getId(a);if(a===r&&r.defaultView){var d=Di(r.defaultView);u=d.left,l=d.top}else u=a.scrollLeft,l=a.scrollTop;var c=u+","+l;o.get(h)!==c&&(o.set(h,c),e({id:h,x:u,y:l}))}},l=[Ri("scroll",an(Ni(an((t=>u(t))),a.scroll||100)),r)];return"onscrollend"in r&&l.push(Ri("scrollend",an(u),r)),()=>l.forEach((t=>t()))}function dn(t,e){for(var r=on.length-1;r>=0;r--){var i=on[r];if(i){var n=i.bufferBelongsToIframe(t);!n&&e&&e.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),on.splice(r,1))}}}var cn=["INPUT","TEXTAREA","SELECT"],vn=new WeakMap;function fn(t){return function t(e,r){if(yn("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||yn("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||yn("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||yn("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){var i=Array.from(e.parentRule.cssRules).indexOf(e);return r.unshift(i),t(e.parentRule,r)}if(e.parentStyleSheet){var n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);r.unshift(n)}return r}(t,[])}function pn(t,e,r){var i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}function mn(t,e){var r,i,n,s,a=t.stylesheetManager;s=t.mirror.getId("#document"===e.nodeName?e:Wr.host(e));var o="#document"===e.nodeName?null==(r=e.defaultView)?void 0:r.Document:null==(n=null==(i=e.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,u=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&u?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var t;return null==(t=u.get)?void 0:t.call(this)},set(t){var e,r;try{r=null==(e=u.set)?void 0:e.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==s&&-1!==s)try{a.adoptStyleSheets(t,s)}catch(t){}return r}}),an((()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function gn(t,e){void 0===e&&(e={});var r,i,n=t.doc.defaultView;if(!n)return()=>{};if(function(t,e){var r=t.mutationCb,i=t.mousemoveCb,n=t.mouseInteractionCb,s=t.scrollCb,a=t.viewportResizeCb,o=t.inputCb,u=t.mediaInteractionCb,l=t.styleSheetRuleCb,h=t.styleDeclarationCb,d=t.canvasMutationCb,c=t.fontCb,v=t.selectionCb,f=t.customElementCb;t.mutationCb=function(){e.mutation&&e.mutation(...arguments),r(...arguments)},t.mousemoveCb=function(){e.mousemove&&e.mousemove(...arguments),i(...arguments)},t.mouseInteractionCb=function(){e.mouseInteraction&&e.mouseInteraction(...arguments),n(...arguments)},t.scrollCb=function(){e.scroll&&e.scroll(...arguments),s(...arguments)},t.viewportResizeCb=function(){e.viewportResize&&e.viewportResize(...arguments),a(...arguments)},t.inputCb=function(){e.input&&e.input(...arguments),o(...arguments)},t.mediaInteractionCb=function(){e.mediaInteaction&&e.mediaInteaction(...arguments),u(...arguments)},t.styleSheetRuleCb=function(){e.styleSheetRule&&e.styleSheetRule(...arguments),l(...arguments)},t.styleDeclarationCb=function(){e.styleDeclaration&&e.styleDeclaration(...arguments),h(...arguments)},t.canvasMutationCb=function(){e.canvasMutation&&e.canvasMutation(...arguments),d(...arguments)},t.fontCb=function(){e.font&&e.font(...arguments),c(...arguments)},t.selectionCb=function(){e.selection&&e.selection(...arguments),v(...arguments)},t.customElementCb=function(){e.customElement&&e.customElement(...arguments),f(...arguments)}}(t,e),t.recordDOM){var s=ln(t,t.doc);r=s.observer,i=s.buffer}var a,o,l,h,d,c,v,f,p,m=function(t){var e=t.mousemoveCb,r=t.sampling,i=t.doc,n=t.mirror;if(!1===r.mousemove)return()=>{};var s,a="number"==typeof r.mousemove?r.mousemove:50,o="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,u=[],l=Ni(an((t=>{var r=Date.now()-s;e(u.map((t=>(t.timeOffset-=r,t))),t),u=[],s=null})),o),h=an(Ni(an((t=>{var e=un(t),r=ji(t)?t.changedTouches[0]:t,i=r.clientX,a=r.clientY;s||(s=Fi()),u.push({x:i,y:a,id:n.getId(e),timeOffset:Fi()-s}),l("undefined"!=typeof DragEvent&&t instanceof DragEvent?_r.Drag:t instanceof MouseEvent?_r.MouseMove:_r.TouchMove)})),a,{trailing:!1})),d=[Ri("mousemove",h,i),Ri("touchmove",h,i),Ri("drag",h,i)];return an((()=>{d.forEach((t=>t()))}))}(t),g=function(t){var e=t.mouseInteractionCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling;if(!1===a.mouseInteraction)return()=>{};var o=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,l=[],h=null;return Object.keys(Sr).filter((t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t])).forEach((t=>{var a=Gr(t),o=(t=>r=>{var a=un(r);if(!$i(a,n,s,!0)){var o=null,l=t;if("pointerType"in r){switch(r.pointerType){case"mouse":o=Ir.Mouse;break;case"touch":o=Ir.Touch;break;case"pen":o=Ir.Pen}o===Ir.Touch&&(Sr[t]===Sr.MouseDown?l="TouchStart":Sr[t]===Sr.MouseUp&&(l="TouchEnd"))}else ji(r)&&(o=Ir.Touch);null!==o?(h=o,(l.startsWith("Touch")&&o===Ir.Touch||l.startsWith("Mouse")&&o===Ir.Mouse)&&(o=null)):Sr[t]===Sr.Click&&(o=h,h=null);var d=ji(r)?r.changedTouches[0]:r;if(d){var c=i.getId(a),v=d.clientX,f=d.clientY;an(e)(u({type:Sr[l],id:c,x:v,y:f},null!==o&&{pointerType:o}))}}})(t);if(window.PointerEvent)switch(Sr[t]){case Sr.MouseDown:case Sr.MouseUp:a=a.replace("mouse","pointer");break;case Sr.TouchStart:case Sr.TouchEnd:return}l.push(Ri(a,o,r))})),an((()=>{l.forEach((t=>t()))}))}(t),y=hn(t),w=function(t,e){var r=t.viewportResizeCb,i=e.win,n=-1,s=-1;return Ri("resize",an(Ni(an((()=>{var t=Pi(),e=Wi();n===t&&s===e||(r({width:Number(e),height:Number(t)}),n=t,s=e)})),200)),i)}(t,{win:n}),b=function(t){var e=t.inputCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.ignoreClass,o=t.ignoreSelector,l=t.maskInputOptions,h=t.maskInputFn,d=t.userTriggeredOnInput;function c(t){var e=un(t),i=t.isTrusted,u=r.defaultView;if(!e||!u||e instanceof u.HTMLElement){var c=e&&e.tagName;if(e&&"OPTION"===c&&(e=Wr.parentElement(e)),e&&c&&cn.indexOf(c)>=0&&!$i(e,n,s,!0)&&!(e.classList.contains(a)||o&&e.matches(o))){var f=e.value,p=!1,m=Zr(e)||"";"radio"===m||"checkbox"===m?p=e.checked:(l[c.toLowerCase()]||l[m])&&(f=Hr({element:e,maskInputOptions:l,tagName:c,type:m,value:f,maskInputFn:h})),v(e,d?{text:f,isChecked:p,userTriggered:i}:{text:f,isChecked:p});var g=e.name;"radio"===m&&g&&p&&r.querySelectorAll('input[type="radio"][name="'+g+'"]').forEach((t=>{if(t!==e){var r=t.value;v(t,d?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}}))}}}function v(t,r){var n=vn.get(t);if(!n||n.text!==r.text||n.isChecked!==r.isChecked){vn.set(t,r);var s=i.getId(t);an(e)(u({},r,{id:s}))}}var f=("last"===t.sampling.input?["change"]:["input","change"]).map((t=>Ri(t,an(c),r))),p=r.defaultView;if(!p)return()=>{f.forEach((t=>t()))};var m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value");return m&&m.set&&f.push(...[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]].map((t=>Li(t[0],t[1],{set(){an(c)({target:this,isTrusted:!1})}},!1,p)))),an((()=>{f.forEach((t=>t()))}))}(t),k=(o=(a=t).mediaInteractionCb,l=a.blockClass,h=a.blockSelector,d=a.mirror,c=a.sampling,v=a.doc,f=an((t=>Ni(an((e=>{var r=un(e);if(r&&!$i(r,l,h,!0)){var i=r.currentTime,n=r.volume,s=r.muted,a=r.playbackRate,u=r.loop;o({type:t,id:d.getId(r),currentTime:i,volume:n,muted:s,playbackRate:a,loop:u})}})),c.media||500))),p=[Ri("play",f(Cr.Play),v),Ri("pause",f(Cr.Pause),v),Ri("seeked",f(Cr.Seeked),v),Ri("volumechange",f(Cr.VolumeChange),v),Ri("ratechange",f(Cr.RateChange),v)],an((()=>{p.forEach((t=>t()))}))),_=()=>{},S=()=>{},I=()=>{},M=()=>{};t.recordDOM&&(_=function(t,e){var r=t.styleSheetRuleCb,i=t.mirror,n=t.stylesheetManager,s=e.win;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:an(((t,e,s)=>{var a=s[0],o=s[1],u=pn(e,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:o}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.addRule=function(t,e,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[t+" { "+e+" }",r])};var o,u,l=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(l,{apply:an(((t,e,s)=>{var a=s[0],o=pn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:a}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.removeRule=function(t){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},s.CSSStyleSheet.prototype.replace&&(o=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:an(((t,e,s)=>{var a=s[0],o=pn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replace:a}),t.apply(e,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:an(((t,e,s)=>{var a=s[0],o=pn(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replaceSync:a}),t.apply(e,s)}))}));var h={};wn("CSSGroupingRule")?h.CSSGroupingRule=s.CSSGroupingRule:(wn("CSSMediaRule")&&(h.CSSMediaRule=s.CSSMediaRule),wn("CSSConditionRule")&&(h.CSSConditionRule=s.CSSConditionRule),wn("CSSSupportsRule")&&(h.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(h).forEach((t=>{var e=t[0],s=t[1];d[e]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[e].insertRule,{apply:an(((t,e,s)=>{var a=s[0],o=s[1],u=pn(e.parentStyleSheet,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:[...fn(e),o||0]}]}),t.apply(e,s)}))}),s.prototype.deleteRule=new Proxy(d[e].deleteRule,{apply:an(((t,e,s)=>{var a=s[0],o=pn(e.parentStyleSheet,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:[...fn(e),a]}]}),t.apply(e,s)}))})})),an((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=l,o&&(s.CSSStyleSheet.prototype.replace=o),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(h).forEach((t=>{var e=t[0],r=t[1];r.prototype.insertRule=d[e].insertRule,r.prototype.deleteRule=d[e].deleteRule}))}))}(t,{win:n}),S=mn(t,t.doc),I=function(t,e){var r=t.styleDeclarationCb,i=t.mirror,n=t.ignoreCSSAttributes,s=t.stylesheetManager,a=e.win,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:an(((t,e,a)=>{var u,l=a[0],h=a[1],d=a[2];if(n.has(l))return o.apply(e,[l,h,d]);var c=pn(null==(u=e.parentRule)?void 0:u.parentStyleSheet,i,s.styleMirror),v=c.id,f=c.styleId;return(v&&-1!==v||f&&-1!==f)&&r({id:v,styleId:f,set:{property:l,value:h,priority:d},index:fn(e.parentRule)}),t.apply(e,a)}))});var u=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:an(((t,e,a)=>{var o,l=a[0];if(n.has(l))return u.apply(e,[l]);var h=pn(null==(o=e.parentRule)?void 0:o.parentStyleSheet,i,s.styleMirror),d=h.id,c=h.styleId;return(d&&-1!==d||c&&-1!==c)&&r({id:d,styleId:c,remove:{property:l},index:fn(e.parentRule)}),t.apply(e,a)}))}),an((()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=u}))}(t,{win:n}),t.collectFonts&&(M=function(t){var e=t.fontCb,r=t.doc,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,a=i.FontFace;i.FontFace=function(t,e,r){var i=new a(t,e,r);return s.set(i,{family:t,buffer:"string"!=typeof e,descriptors:r,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};var o=Pr(r.fonts,"add",(function(t){return function(r){return setTimeout(an((()=>{var t=s.get(r);t&&(e(t),s.delete(r))})),0),t.apply(this,[r])}}));return n.push((()=>{i.FontFace=a})),n.push(o),an((()=>{n.forEach((t=>t()))}))}(t)));var C=function(t){var e=t.doc,r=t.mirror,i=t.blockClass,n=t.blockSelector,s=t.selectionCb,a=!0,o=an((()=>{var t=e.getSelection();if(!(!t||a&&(null==t?void 0:t.isCollapsed))){a=t.isCollapsed||!1;for(var o=[],u=t.rangeCount||0,l=0;u>l;l++){var h=t.getRangeAt(l),d=h.startContainer,c=h.startOffset,v=h.endContainer,f=h.endOffset;$i(d,i,n,!0)||$i(v,i,n,!0)||o.push({start:r.getId(d),startOffset:c,end:r.getId(v),endOffset:f})}s({ranges:o})}}));return o(),Ri("selectionchange",o)}(t),x=function(t){var e=t.customElementCb,r=t.doc.defaultView;return r&&r.customElements?Pr(r.customElements,"define",(function(t){return function(r,i,n){try{e({define:{name:r}})}catch(t){console.warn("Custom element callback failed for "+r)}return t.apply(this,[r,i,n])}})):()=>{}}(t),R=[];for(var T of t.plugins)R.push(T.observer(T.callback,n,T.options));return an((()=>{if(i){i.destroy(),i.reset();var e=on.indexOf(i);-1!==e&&on.splice(e,1)}t.shadowDomManager.resetForDoc(t.doc),null==r||r.disconnect(),m(),g(),y(),w(),b(),k(),_(),S(),I(),M(),C(),x(),R.forEach((t=>t()))}))}function yn(t){return void 0!==window[t]}function wn(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class bn{constructor(t){br(this,"iframeIdToRemoteIdMap",new WeakMap),br(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,r,i){var n=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=n.get(e);return a||(a=this.generateIdFn(),n.set(e,a),s.set(a,e)),a}getIds(t,e){var r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return e.map((e=>this.getId(t,e,r,i)))}getRemoteId(t,e,r){var i=r||this.getRemoteIdToIdMap(t);return"number"!=typeof e?e:i.get(e)||-1}getRemoteIds(t,e){var r=this.getRemoteIdToIdMap(t);return e.map((e=>this.getRemoteId(t,e,r)))}reset(t){if(!t)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){var e=this.iframeIdToRemoteIdMap.get(t);return e||this.iframeIdToRemoteIdMap.set(t,e=new Map),e}getRemoteIdToIdMap(t){var e=this.iframeRemoteIdToIdMap.get(t);return e||this.iframeRemoteIdToIdMap.set(t,e=new Map),e}}class kn{constructor(t){br(this,"iframes",new WeakMap),br(this,"crossOriginIframeMap",new WeakMap),br(this,"crossOriginIframeMirror",new bn(oi)),br(this,"crossOriginIframeStyleMirror"),br(this,"crossOriginIframeRootIdMap",new WeakMap),br(this,"mirror"),br(this,"mutationCb"),br(this,"wrappedEmit"),br(this,"loadListener"),br(this,"pageHideListener"),br(this,"stylesheetManager"),br(this,"recordCrossOriginIframes"),br(this,"messageHandler"),br(this,"nestedIframeListeners",new Map),br(this,"attachedWindows",new WeakMap),br(this,"attachedDocuments",new WeakMap),br(this,"attachedIframes",new Map),br(this,"loadListenerDisposers",new WeakMap),br(this,"iframeElementsById",new Map),br(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new bn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){var r=this.loadListenerDisposers.get(t);r||this.loadListenerDisposers.set(t,r=new Set),r.add(e);var i=this.mirror.getId(t);-1!==i&&this.iframeElementsById.set(i,t)}getIframeElementById(t){var e,r,i;return null!==(e=null!==(r=null==(i=this.attachedIframes.get(t))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){var e=this.loadListenerDisposers.get(t);e&&(e.forEach((t=>Oi(t))),this.loadListenerDisposers.delete(t))}removePageHideListener(t){var e=this.pageHideHandlers.get(t);e&&(e.forEach((t=>{Ti(t.win,"pagehide",t.handler)})),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){var r=this.mirror.getId(t);return this.attachedIframes.set(r,{element:t,content:e}),r}attachIframe(t,e){var r,i=this.trackIframeContent(t,e);if(t.contentDocument){var n=this.attachedDocuments.get(t);n||this.attachedDocuments.set(t,n=new Set),n.add(t.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var a=this.handleMessage.bind(this);Oi((()=>{s.addEventListener("message",a),this.nestedIframeListeners.set(s,a);var e=this.attachedWindows.get(t);e||this.attachedWindows.set(t,e=new Set),e.add(s)}))}Oi((()=>{var e=t.contentWindow;if(e){var r=this.pageHideHandlers.get(t);if(r)for(var i of r)if(i.win===e)return;var n=()=>{var e;null==(e=this.pageHideListener)||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument),t.contentWindow&&this.crossOriginIframeMap.delete(t.contentWindow)};e.addEventListener("pagehide",n),r||this.pageHideHandlers.set(t,r=new Set),r.add({win:e,handler:n})}})),null==(r=this.loadListener)||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){var e=t;if("rrweb"===e.data.type&&e.origin===e.data.origin&&t.source){var r=this.crossOriginIframeMap.get(t.source);if(r){var i=this.transformCrossOriginEvent(r,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}}transformCrossOriginEvent(t,e){var r;switch(e.type){case kr.FullSnapshot:this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);var i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:kr.IncrementalSnapshot,data:{source:_r.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case kr.Meta:case kr.Load:case kr.DomContentLoaded:return!1;case kr.Plugin:return e;case kr.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case kr.IncrementalSnapshot:switch(e.data.source){case _r.Mutation:return e.data.adds.forEach((e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);var r=this.crossOriginIframeRootIdMap.get(t);r&&this.patchRootIdOnNode(e.node,r)})),e.data.removes.forEach((e=>{this.replaceIds(e,t,["parentId","id"])})),e.data.attributes.forEach((e=>{this.replaceIds(e,t,["id"])})),e.data.texts.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case _r.Drag:case _r.TouchMove:case _r.MouseMove:return e.data.positions.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case _r.ViewportResize:return!1;case _r.MediaInteraction:case _r.MouseInteraction:case _r.Scroll:case _r.CanvasMutation:case _r.Input:return this.replaceIds(e.data,t,["id"]),e;case _r.StyleSheetRule:case _r.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case _r.Font:return e;case _r.Selection:return e.data.ranges.forEach((e=>{this.replaceIds(e,t,["start","end"])})),e;case _r.AdoptedStyleSheet:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null==(r=e.data.styles)||r.forEach((e=>{this.replaceStyleIds(e,t,["styleId"])})),e}}return!1}replace(t,e,r,i){for(var n of i)(Array.isArray(e[n])||"number"==typeof e[n])&&(e[n]=Array.isArray(e[n])?t.getIds(r,e[n]):t.getId(r,e[n]));return e}replaceIds(t,e,r){return this.replace(this.crossOriginIframeMirror,t,e,r)}replaceStyleIds(t,e,r){return this.replace(this.crossOriginIframeStyleMirror,t,e,r)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach((t=>{this.replaceIdOnNode(t,e)}))}patchRootIdOnNode(t,e){t.type===xr.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach((t=>{this.patchRootIdOnNode(t,e)}))}removeIframeById(t){var e=this.attachedIframes.get(t),r=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),r){var i=r.contentWindow,n=this.attachedWindows.get(r);n&&(n.forEach((t=>{var e=this.nestedIframeListeners.get(t);e&&(Ti(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(Ti(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((t=>{Oi((()=>this.mirror.removeNodeFromMap(t)))})),Oi((()=>dn(r,s))),this.attachedDocuments.delete(r))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var t=[];this.attachedIframes.forEach(((e,r)=>{this.mirror.has(r)||t.push(r)})),t.forEach((t=>this.removeIframeById(t)))}}reattachIframes(){this.attachedIframes.forEach(((t,e)=>{var r=t.content;this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)}))}destroy(){this.recordCrossOriginIframes&&Ti(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((t,e)=>{Ti(e,"message",t)})),this.nestedIframeListeners.clear();var t=new Set;this.iframeElementsById.forEach((e=>t.add(e))),this.attachedIframes.forEach((e=>t.add(e.element))),t.forEach((t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)})),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}}class _n{constructor(t){br(this,"shadowDoms",new WeakSet),br(this,"mutationCb"),br(this,"scrollCb"),br(this,"bypassOptions"),br(this,"mirror"),br(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var r,i;if(Ur(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var n=null!==(r=null==(i=Wr.host(t))?void 0:i.ownerDocument)&&void 0!==r?r:e,s=ln(u({},this.bypassOptions,{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),a=s.observer,o=s.buffer;this.restoreHandlers.push({doc:n,handler(){a.disconnect(),o.destroy(),o.releaseCanvasManager();var t=on.indexOf(o);-1!==t&&on.splice(t,1)}}),this.restoreHandlers.push({doc:n,handler:hn(u({},this.bypassOptions,{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout((()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(Wr.host(t))),this.restoreHandlers.push({doc:n,handler:mn({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})}),0)}}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){var r=this;this.restoreHandlers.push({doc:e,handler:Pr(t.prototype,"attachShadow",(function(t){return function(i){var n=t.call(this,i),s=Wr.shadowRoot(this);return s&&Ji(this)&&r.addShadowRoot(s,e),n}}))})}reset(){this.restoreHandlers.forEach((t=>{var e=t.handler;try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){var e=[];for(var r of this.restoreHandlers)if(r.doc===t)try{r.handler()}catch(t){}else e.push(r);this.restoreHandlers=e}}for(var Sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",In="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Mn=0;64>Mn;Mn++)In[Sn.charCodeAt(Mn)]=Mn;var Cn=new Map,xn=(t,e,r)=>{if(t&&(On(t,e)||"object"==typeof t)){var i=function(t,e){var r=Cn.get(t);return r||Cn.set(t,r=new Map),r.has(e)||r.set(e,[]),r.get(e)}(r,t.constructor.name),n=i.indexOf(t);return-1===n&&(n=i.length,i.push(t)),n}};function Rn(t,e,r,i){if(t instanceof Array)return t.map((t=>Rn(t,e,r,i)));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){var n=t.constructor.name,s=function(t){var e,r=new Uint8Array(t),i=r.length,n="";for(e=0;i>e;e+=3)n+=Sn[r[e]>>2],n+=Sn[(3&r[e])<<4|r[e+1]>>4],n+=Sn[(15&r[e+1])<<2|r[e+2]>>6],n+=Sn[63&r[e+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(t);return{rr_type:n,base64:s}}return t instanceof DataView?{rr_type:t.constructor.name,args:[Rn(t.buffer,e,r,i),t.byteOffset,t.byteLength]}:t instanceof HTMLImageElement?{rr_type:t.constructor.name,src:t.src}:t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[Rn(t.data,e,r,i),t.width,t.height]}:On(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:xn(t,e,r)}:t}var Tn=(t,e,r,i)=>t.map((t=>Rn(t,e,r,i))),On=(t,e)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((t=>"function"==typeof e[t]));return Boolean(r.find((r=>t instanceof e[r])))},An=["webgl","webgl2"];function En(t){return"nodeType"in t}function Nn(t,e,r,i){var n=[];try{if(i){var s=function(t,e,r){var i=t.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return Pr(i.prototype,"configure",(function(i){return function(n){var s=function(t){var e=t.canvas;return e&&"object"==typeof e?e:null}(this);if(!s||En(s)&&$i(s,e,r,!0))return i.call(this,n);En(s)&&!("__context"in s)&&(s.__context="webgpu");var a=function(t){var e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return i.call(this,null!==a&&n?u({},n,{usage:"number"==typeof n.usage?n.usage|a:a}):n)}}))}(t,e,r);s&&n.push(s)}var a=Pr(t.HTMLCanvasElement.prototype,"getContext",(function(t){return function(n){for(var s=function(t){return"experimental-webgl"===t?"webgl":t}(n),a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];if(!$i(this,e,r,!0)&&("__context"in this||(this.__context=s),i&&An.includes(s)))if(o[0]&&"object"==typeof o[0]){var l=o[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[n,...o])}}));n.push(a)}catch(t){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach((t=>t()))}}function Ln(t,e,r,i,n,s,a){var o=[],u=Object.getOwnPropertyNames(t),l=function(u){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))return 0;try{if("function"!=typeof t[u])return 0;var l=Pr(t,u,(function(t){return function(){for(var o=arguments.length,l=new Array(o),h=0;o>h;h++)l[h]=arguments[h];var d=t.apply(this,l);if(xn(d,s,this),"tagName"in this.canvas&&!$i(this.canvas,i,n,!0)){var c=Tn(l,s,this,a);r(this.canvas,{type:e,property:u,args:c})}return d}}));o.push(l)}catch(i){var h=Li(t,u,{set(t){r(this.canvas,{type:e,property:u,args:[t],setter:!0})}});o.push(h)}};for(var h of u)l(h);return o}var Fn,Dn,Pn,Wn='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentFingerprintMap = /* @__PURE__ */ new Map();\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n return worker.postMessage({ id });\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\n lastFingerprintMap.set(id, fingerprint);\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-CZCeNtwG.js.map\n',Bn="undefined"!=typeof self&&self.Blob&&new Blob([Wn],{type:"text/javascript;charset=utf-8"});function $n(t){var e;try{if(!(e=Bn&&(self.URL||self.webkitURL).createObjectURL(Bn)))throw"";var r=new Worker(e,{name:null==t?void 0:t.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),r}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Wn),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class Un{constructor(t){br(this,"pendingCanvasMutations",new Map),br(this,"rafStamps",{latestId:0,invokeId:null}),br(this,"mirror"),br(this,"mutationCb"),br(this,"resetObservers"),br(this,"frozen",!1),br(this,"locked",!1),br(this,"rafIdTimestamp",null),br(this,"rafIdFlush",null),br(this,"refCount",0),br(this,"torndown",!1),br(this,"processMutation",((t,e)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)}));var e=t.sampling,r=void 0===e?"all":e,i=t.win,n=t.blockClass,s=t.blockSelector,a=t.recordCanvas,o=t.dataURLOptions,u=t.resolutionScale;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&"all"===r&&this.initCanvasMutationObserver(i,n,s,o),a&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:o,resolutionScale:u})}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,e,r,i,n){var s=this;if("OffscreenCanvas"in e){var a,u="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,l=Nn(e,r,i,!0),h=new Map;try{a=new $n}catch(t){return}var d=!1;a.onerror=()=>{var t;d=!0,cancelAnimationFrame(c),null==(t=a.terminate)||t.call(a)},a.onmessage=t=>{var e=t.data.id;if(h.set(e,!1),"base64"in t.data){var r=t.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:e,type:Mr["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var c,v=1e3/t,f=0,p=t=>{var l,m;d||(f&&v>t-f||(f=t,(l=[],m=t=>{try{t.querySelectorAll("canvas").forEach((t=>{$i(t,r,i,!0)||l.push(t)})),t.querySelectorAll("*").forEach((t=>{t.shadowRoot&&m(t.shadowRoot)}))}catch(t){}},m(e.document),l).forEach(function(){var t=o((function*(t){var e,r,i=s.mirror.getId(t);if(!h.get(i)&&0!==t.width&&0!==t.height){h.set(i,!0);try{if(["webgl","webgl2"].includes(t.__context)){var o=t.getContext(t.__context);if(null==(e=null==o?void 0:o.isContextLost)?void 0:e.call(o))return void h.set(i,!1);!1===(null==(r=null==o?void 0:o.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&o.clear(o.COLOR_BUFFER_BIT)}var l=t.clientWidth||t.width,d=t.clientHeight||t.height,c=Math.max(1,Math.round(l*u)),v=Math.max(1,Math.round(d*u)),f=yield createImageBitmap(t,1>u?{resizeWidth:c,resizeHeight:v,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:v});a.postMessage({id:i,bitmap:f,width:c,height:v,displayWidth:l,displayHeight:d,dataURLOptions:n.dataURLOptions},[f])}catch(t){h.set(i,!1)}}}));return function(e){return t.apply(this,arguments)}}())),c=requestAnimationFrame(p))};c=requestAnimationFrame(p),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(c),null==(t=a.terminate)||t.call(a)}}}initCanvasMutationObserver(t,e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=Nn(t,e,r,!1),s=function(t,e,r,i,n){var s=[],a=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),o=function(a){try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])return 1;var o=Pr(e.CanvasRenderingContext2D.prototype,a,(function(s){return function(){for(var o=arguments.length,u=new Array(o),l=0;o>l;l++)u[l]=arguments[l];return $i(this.canvas,r,i,!0)||setTimeout((()=>{var r=Tn(u,e,this,n);t(this.canvas,{type:Mr["2D"],property:a,args:r})}),0),s.apply(this,u)}}));s.push(o)}catch(r){var u=Li(e.CanvasRenderingContext2D.prototype,a,{set(e){t(this.canvas,{type:Mr["2D"],property:a,args:[e],setter:!0})}});s.push(u)}};for(var u of a)o(u);return()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i),a=function(t,e,r,i,n){var s=[];return void 0!==e.WebGLRenderingContext&&s.push(...Ln(e.WebGLRenderingContext.prototype,Mr.WebGL,t,r,i,e,n)),void 0!==e.WebGL2RenderingContext&&s.push(...Ln(e.WebGL2RenderingContext.prototype,Mr.WebGL2,t,r,i,e,n)),()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i);this.resetObservers=()=>{n(),s(),a()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((t,e)=>{var r=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(t,e){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(t);if(r&&-1!==e){var i=r.map((t=>function(t,e){if(null==t)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;r[i]=t[i]}return r}(t,yr)));this.mutationCb({id:e,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(t)}}}}class zn{constructor(t){br(this,"trackedLinkElements",new WeakSet),br(this,"mutationCb"),br(this,"adoptedStyleSheetCb"),br(this,"styleMirror",new Vi),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){var r=this;if(0!==t.length){var i={id:e,styleIds:[]},n=[],s=function(t){var e;r.styleMirror.has(t)?e=r.styleMirror.getId(t):(e=r.styleMirror.add(t),n.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,r)=>({rule:jr(e,t.href),index:r})))})),i.styleIds.push(e)};for(var a of t)s(a);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,wi.forEach((t=>t.abort())),wi.clear()}trackStylesheetInLinkElement(t){}}class jn{constructor(){br(this,"nodeMap",new WeakMap),br(this,"active",!1)}inOtherBuffer(t,e){var r=this.nodeMap.get(t);return r&&Array.from(r).some((t=>t!==e))}add(t,e){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}}var qn=!1;try{if(2!==Array.from([1],(t=>2*t))[0]){var Hn=document.createElement("iframe");document.body.appendChild(Hn),Array.from=(null==(gr=Hn.contentWindow)?void 0:gr.Array.from)||Array.from,document.body.removeChild(Hn)}}catch(t){console.debug("Unable to override Array.from",t)}var Gn=new qr,Vn=new Set([_r.Mutation,_r.MediaInteraction,_r.StyleSheetRule,_r.CanvasMutation,_r.Font,_r.Log,_r.StyleDeclaration,_r.AdoptedStyleSheet]);function Zn(t){void 0===t&&(t={});var e=t,r=e.emit,i=e.checkoutEveryNms,n=e.checkoutEveryNth,s=e.blockClass,a=void 0===s?"rr-block":s,o=e.blockSelector,l=void 0===o?null:o,h=e.ignoreClass,d=void 0===h?"rr-ignore":h,c=e.ignoreSelector,v=void 0===c?null:c,f=e.maskTextClass,p=void 0===f?"rr-mask":f,m=e.maskTextSelector,g=void 0===m?null:m,y=e.inlineStylesheet,w=void 0===y||y,b=e.maskAllInputs,k=e.maskInputOptions,_=e.slimDOMOptions,S=e.maskInputFn,I=e.maskTextFn,M=e.hooks,C=e.packFn,x=e.sampling,R=void 0===x?{}:x,T=e.dataURLOptions,O=void 0===T?{}:T,A=e.canvasResolutionScale,E=e.mousemoveWait,N=e.recordDOM,L=void 0===N||N,F=e.recordCanvas,D=void 0!==F&&F,P=e.recordCrossOriginIframes,W=void 0!==P&&P,B=e.recordAfter,U=void 0===B?"DOMContentLoaded"===t.recordAfter?t.recordAfter:"load":B,z=e.userTriggeredOnInput,j=void 0!==z&&z,q=e.collectFonts,H=void 0!==q&&q,G=e.inlineImages,V=void 0!==G&&G,Z=e.plugins,J=e.keepIframeSrcFn,Q=void 0===J?()=>!1:J,X=e.ignoreCSSAttributes,Y=void 0===X?new Set([]):X,K=e.attributeFilter;Yi=e.errorHandler;var tt=u({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},O),et=!W||window.parent===window,rt=!1;if(!et)try{window.parent.document&&(rt=!1)}catch(t){rt=!0}if(et&&!r)throw new Error("emit function is required");if(!et&&!rt)return()=>{};void 0!==E&&void 0===R.mousemove&&(R.mousemove=E),Gn.reset();var it,nt=!0===b?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==k?k:{password:!0},st=Ci(void 0!==_&&_);!function(t){void 0===t&&(t=window),"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();var at,ot,ut=0,lt=new Map,ht=t=>{for(var e of Z||[])e.eventProcessor&&(t=e.eventProcessor(t));return C&&!rt&&(t=C(t)),t};Fn=(t,e)=>{var s,a=t;if(a.timestamp=Fi(),!(null==(s=on[0])?void 0:s.isFrozen())||a.type===kr.FullSnapshot||a.type===kr.IncrementalSnapshot&&Vn.has(a.data.source)||on.forEach((t=>t.unfreeze())),et)null==r||r(ht(a),e);else if(rt){var o={type:"rrweb",event:ht(a),origin:window.location.origin,isCheckout:e};window.parent.postMessage(o,"*")}if(a.type===kr.FullSnapshot)it=a,ut=0;else if(a.type===kr.IncrementalSnapshot){if(a.data.source===_r.Mutation&&a.data.isAttachIframe)return;ut++,(n&&ut>=n||i&&a.timestamp-it.timestamp>i)&&Dn(!0)}};var dt=t=>{if(t.removes&&t.removes.length>0){var e=t.adds.length>0?new Set(t.adds.map((t=>t.node.id))):null,r=new Set;if(t.adds.length>0)for(var i of t.adds){var n=Gn.getNode(i.node.id);n&&"IFRAME"===n.nodeName&&r.add(n)}t.removes.forEach((t=>{var i=t.id;if(!e||!e.has(i)){var n=pt.getIframeElementById(i);n&&r.has(n)?pt.forgetIframeId(i):(null==at||at(i),pt.removeIframeById(i))}})),null==ot||ot(),pt.cleanupDetachedIframes()}Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Mutation},t)})},ct=t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Scroll},t)}),vt=t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.CanvasMutation},t)}),ft=new zn({mutationCb:dt,adoptedStyleSheetCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.AdoptedStyleSheet},t)})}),pt=new kn({mirror:Gn,mutationCb:dt,stylesheetManager:ft,recordCrossOriginIframes:W,wrappedEmit:Fn});for(var mt of Z||[])mt.getMirror&&mt.getMirror({nodeMirror:Gn,crossOriginIframeMirror:pt.crossOriginIframeMirror,crossOriginIframeStyleMirror:pt.crossOriginIframeStyleMirror});var gt=new jn;Pn=new Un({recordCanvas:D,mutationCb:vt,win:window,blockClass:a,blockSelector:l,mirror:Gn,sampling:R.canvas,dataURLOptions:tt,resolutionScale:A});var yt=new _n({mutationCb:dt,scrollCb:ct,bypassOptions:{blockClass:a,blockSelector:l,maskTextClass:p,maskTextSelector:g,inlineStylesheet:w,maskInputOptions:nt,dataURLOptions:tt,maskTextFn:I,maskInputFn:S,recordCanvas:D,inlineImages:V,sampling:R,slimDOMOptions:st,iframeManager:pt,stylesheetManager:ft,canvasManager:Pn,keepIframeSrcFn:Q,processedNodeManager:gt,attributeFilter:K},mirror:Gn});Dn=function(t){if(void 0===t&&(t=!1),L){Fn({type:kr.Meta,data:{href:window.location.href,width:Wi(),height:Pi()}},t),ft.reset(),yt.init(),on.forEach((t=>t.lock()));var e=function(t,e){var r=e||{},i=r.mirror,n=void 0===i?new qr:i,s=r.blockClass,a=r.blockSelector,o=r.maskTextClass,u=r.maskTextSelector,l=r.inlineStylesheet,h=r.inlineImages,d=void 0!==h&&h,c=r.recordCanvas,v=void 0!==c&&c,f=r.maskAllInputs,p=void 0!==f&&f,m=r.slimDOM,g=r.dataURLOptions,y=r.preserveWhiteSpace,w=r.onSerialize,b=r.onIframeLoad,k=r.iframeLoadTimeout,_=r.onIframeListenerRegistered,S=r.onStylesheetLoad,I=r.stylesheetLoadTimeout,M=r.keepIframeSrcFn,C=void 0===M?()=>!1:M,x=r.maxDepth;return Mi(t,{doc:t,mirror:n,blockClass:void 0===s?"rr-block":s,blockSelector:void 0===a?null:a,maskTextClass:void 0===o?"rr-mask":o,maskTextSelector:void 0===u?null:u,skipChild:!1,inlineStylesheet:void 0===l||l,maskInputOptions:!0===p?{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===p?{password:!0}:p,maskTextFn:r.maskTextFn,maskInputFn:r.maskInputFn,slimDOMOptions:Ci(void 0!==m&&m),dataURLOptions:g,inlineImages:d,recordCanvas:v,preserveWhiteSpace:y,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:k,onIframeListenerRegistered:_,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:x})}(document,{mirror:Gn,blockClass:a,blockSelector:l,maskTextClass:p,maskTextSelector:g,inlineStylesheet:w,maskAllInputs:nt,maskTextFn:I,maskInputFn:S,slimDOM:st,dataURLOptions:tt,recordCanvas:D,inlineImages:V,onSerialize(t){qi(t,Gn)&&pt.addIframe(t),Hi(t,Gn)&&ft.trackLinkElement(t),Gi(t)&&yt.addShadowRoot(Wr.shadowRoot(t),document)},onIframeLoad(t,e){pt.attachIframe(t,e),yt.observeAttachShadow(t)},onIframeListenerRegistered(t,e){pt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){ft.attachLinkElement(t,e)},keepIframeSrcFn:Q});if(!e)return console.warn("Failed to snapshot the document");Fn({type:kr.FullSnapshot,data:{node:e,initialOffset:Di(window)}},t),on.forEach((t=>t.unlock())),W&&pt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ft.adoptStyleSheets(document.adoptedStyleSheets,Gn.getId(document))}};try{var wt=[];at=t=>{var e=lt.get(t);e&&(e.forEach((t=>{Oi(t);var e=wt.indexOf(t);-1!==e&&wt.splice(e,1)})),lt.delete(t))},ot=()=>{for(var t of lt){var e=t[0],r=Gn.getNode(e);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==at||at(e)}catch(t){null==at||at(e)}else null==at||at(e)}};var bt=t=>{var e;return an(gn)({mutationCb:dt,mousemoveCb:(t,e)=>Fn({type:kr.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.MouseInteraction},t)}),scrollCb:ct,viewportResizeCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.ViewportResize},t)}),inputCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Input},t)}),mediaInteractionCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.MediaInteraction},t)}),styleSheetRuleCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.StyleSheetRule},t)}),styleDeclarationCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.StyleDeclaration},t)}),canvasMutationCb:vt,fontCb:t=>Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Font},t)}),selectionCb(t){Fn({type:kr.IncrementalSnapshot,data:u({source:_r.Selection},t)})},customElementCb(t){Fn({type:kr.IncrementalSnapshot,data:u({source:_r.CustomElement},t)})},blockClass:a,ignoreClass:d,ignoreSelector:v,maskTextClass:p,maskTextSelector:g,maskInputOptions:nt,inlineStylesheet:w,sampling:R,recordDOM:L,recordCanvas:D,inlineImages:V,userTriggeredOnInput:j,collectFonts:H,doc:t,maskInputFn:S,maskTextFn:I,keepIframeSrcFn:Q,blockSelector:l,slimDOMOptions:st,dataURLOptions:tt,mirror:Gn,iframeManager:pt,stylesheetManager:ft,shadowDomManager:yt,processedNodeManager:gt,canvasManager:Pn,ignoreCSSAttributes:Y,attributeFilter:K,plugins:(null==(e=null==Z?void 0:Z.filter((t=>t.observer)))?void 0:e.map((t=>({observer:t.observer,options:t.options,callback:e=>Fn({type:kr.Plugin,data:{plugin:t.name,payload:e}})}))))||[]},M)};pt.addLoadListener((t=>{try{var e=Gn.getId(t),r=bt(t.contentDocument);if(wt.push(r),-1!==e){var i=lt.get(e);i||lt.set(e,i=new Set),i.add(r)}}catch(t){console.warn(t)}})),pt.addPageHideListener((t=>{var e=Gn.getId(t);null==at||at(e),dn(t)}));var kt=-1,_t=t=>Fn({type:kr.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),St=()=>{var t,e,r,i,n=document,s=null!==(t=null!==(e=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==e?e:n.msFullscreenElement)&&void 0!==t?t:null,a=s?Gn.getId(s):-1;a!==kt&&(-1!==kt&&_t({id:kt,enter:!1}),kt=a,-1!==a&&_t({id:a,enter:!0}))},It=()=>{Dn(),wt.push(bt(document)),wt.push(Ri("fullscreenchange",St)),wt.push(Ri("webkitfullscreenchange",St)),wt.push(Ri("mozfullscreenchange",St)),wt.push(Ri("MSFullscreenChange",St)),qn=!0};return["interactive","complete"].includes(document.readyState)?It():(wt.push(Ri("DOMContentLoaded",(()=>{Fn({type:kr.DomContentLoaded,data:{}}),"DOMContentLoaded"===U&&It()}))),wt.push(Ri("load",(()=>{Fn({type:kr.Load,data:{}}),"load"===U&&It()}),window))),()=>{wt.forEach((t=>Oi(t))),gt.destroy(),pt.removeLoadListener(),pt.destroy(),lt.clear(),yt.reset(),Gn.reset(),qn=!1,Yi=void 0}}catch(t){console.warn(t)}}Zn.addCustomEvent=(t,e)=>{if(!qn)throw new Error("please add custom event after start recording");Fn({type:kr.Custom,data:{tag:t,payload:e}})},Zn.freezePage=()=>{on.forEach((t=>t.freeze()))},Zn.takeFullSnapshot=t=>{if(!qn)throw new Error("please take full snapshot after start recording");Dn(t)},Zn.mirror=Gn;var Jn=Object.defineProperty,Qn=(t,e,r)=>((t,e,r)=>e in t?Jn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class Xn{constructor(t){Qn(this,"fileName"),Qn(this,"functionName"),Qn(this,"lineNumber"),Qn(this,"columnNumber"),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){var t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+t+":"+e+")":this.fileName+":"+t+":"+e}}var Yn=/(^|@)\S+:\d+/,Kn=/^\s*at .*(\S+:\d+|\(native\))/m,ts=/^(eval@)?(\[native code])?$/,es={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Kn)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error("Cannot parse given url: "+t);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter((function(t){return!!t.match(Kn)}),this).map((function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=e.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(e=r?e.replace(r[0],""):e).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new Xn({functionName:s,fileName:a,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(t){return t.stack.split("\n").filter((function(t){return!t.match(ts)}),this).map((function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new Xn({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(e),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(t.replace(e,""));return new Xn({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,r=t.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Xn({fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera10(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=t.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Xn({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera11(t){return t.stack.split("\n").filter((function(t){return!!t.match(Yn)&&!t.match(/^Error created at/)}),this).map((function(t){var e=t.split("@"),r=this.extractLocation(e.pop()),i=(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Xn({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function rs(t){if(!t||!t.outerHTML)return"";for(var e="";t.parentElement;){var r=t.localName;if(!r)break;r=r.toLowerCase();var i=t.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var a=i.children[s];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===r&&n.push(a)}n.length>1&&(r+=":eq("+n.indexOf(t)+")"),e=r+(e?">"+e:""),t=i}return e}function is(t){return Array.isArray(t)}function ns(t){return"object"==typeof t&&null!==t&&!is(t)}function ss(t,e){if(0===e)return!0;var r=Object.keys(t);for(var i of r)if(ns(t[i])&&ss(t[i],e-1))return!0;return!1}function as(t,e){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,e);var i=[],n=[];return JSON.stringify(t,(function(t,e){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,t):n.push(t),~i.indexOf(e)&&(e=i[0]===e?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(e)).join(".")+"]")}else i.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(ns(a=e)&&Object.keys(a).length>r.numOfKeysLimit||"function"==typeof a||ns(a)&&ss(a,r.depthOfLimit))return function(t){var e=t.toString();return r.stringLengthLimit&&e.length>r.stringLengthLimit&&(e=e.slice(0,r.stringLengthLimit)+"..."),e}(e);var a;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){var o={};for(var u in e){var l=e[u];o[u]=is(l)?rs(l.length?l[0]:null):l}return o}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e}))}var os={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function us(t,e,r){var i,n=r?Object.assign({},os,r):os,s=n.logger;if(!s)return()=>{};i="string"==typeof s?e[s]:s;var a=0,o=!1,u=[];if(n.level.includes("error")){var l=e=>{var r=e.message,i=es.parse(e.error).map((t=>t.toString())),s=[as(r,n.stringifyOptions)];t({level:"error",trace:i,payload:s})};e.addEventListener("error",l),u.push((()=>{e.removeEventListener("error",l)}));var h=e=>{var r,i;e.reason instanceof Error?i=[as("Uncaught (in promise) "+(r=e.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[as("Uncaught (in promise)",n.stringifyOptions),as(e.reason,n.stringifyOptions)]);var s=es.parse(r).map((t=>t.toString()));t({level:"error",trace:s,payload:i})};e.addEventListener("unhandledrejection",h),u.push((()=>{e.removeEventListener("unhandledrejection",h)}))}for(var d of n.level)u.push(c(i,d));return()=>{u.forEach((t=>t()))};function c(e,r){var i=this;return e[r]?function(e,s,u){try{if(!(s in e))return()=>{};var l=e[s],h={next:l},d=(e=>function(){for(var s=arguments.length,u=new Array(s),l=0;s>l;l++)u[l]=arguments[l];if(e.apply(i,u),!("assert"===r&&u[0]||o)){o=!0;try{var h=es.parse(new Error).map((t=>t.toString())).splice(1),d=("assert"===r?u.slice(1):u).map((t=>as(t,n.stringifyOptions)));a++,n.lengthThreshold>a?t({level:r,trace:h,payload:d}):a===n.lengthThreshold&&t({level:"warn",trace:[],payload:[as("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...u)}finally{o=!1}}})((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return h.next.apply(this,e)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:l},__rrweb_layer__:{enumerable:!1,value:h}})),e[s]=d,()=>{if(e[s]!==d)for(var t=e[s];"function"==typeof t&&t.__rrweb_layer__;){var r=t.__rrweb_layer__;if(r.next===d)return void(r.next=h.next);t=r.next}else e[s]=h.next}}catch(t){return()=>{}}}(e,r):()=>{}}}var ls=t=>({name:"rrweb/console@1",observer:us,options:t}),hs=t=>"undefined"!=typeof Document&&t instanceof Document,ds=()=>{};function cs(t,e,r){try{if(!(e in t))return ds;var i={next:t[e]},n=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return i.next.apply(this,e)}));return b(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),t[e]=n,()=>{if(t[e]!==n)for(var r=t[e];b(r)&&r.__posthog_layer__;){var s=r.__posthog_layer__;if(s.next===n)return void(s.next=i.next);r=s.next}else t[e]=i.next}}catch(t){return ds}}function vs(t,e){var r,i=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),n={hostname:i,isHostDenied:!1};if(null==(r=e.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of e.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}var fs=F("[Recorder]"),ps=t=>"navigation"===t.entryType,ms=t=>"resource"===t.entryType;function gs(t,e){return!!e&&(x(e)||e[t])}function ys(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}var ws=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function bs(t){var e=t.type,r=t.recordBody,i=t.headers;function n(t){var e=Object.keys(i).find((t=>"content-type"===t.toLowerCase())),r=e&&i[e];return t.some((t=>null==r?void 0:r.toLowerCase().includes(t)))}if(!r)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!ys(e)&&t(e.url)}catch(t){return!1}}(t.url))return!1;if(n(ws))return!1;if(x(r))return!0;if(w(r))return n(r);var s=r[e];return x(s)?s:n(s)}function ks(t,e,r,i,n,s){return _s.apply(this,arguments)}function _s(){return _s=o((function*(t,e,r,i,n,s){if(void 0===s&&(s=0),s>10)return fs.warn("Failed to get performance entry for request",{url:r,initiatorType:e}),null;var a=function(t,r){for(var s=t.length-1;s>=0;s-=1)if(ms(a=t[s])&&a.initiatorType===e&&(_(i)||a.startTime>=i)&&(_(n)||n>=a.startTime))return t[s];var a}(t.performance.getEntriesByName(r));return a||(yield new Promise((t=>setTimeout(t,50*s))),ks(t,e,r,i,n,s+1))})),_s.apply(this,arguments)}function Ss(t){var e=t.body,r=t.options,i=t.url;if(M(e))return null;var n=vs(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(S(e))return e;if(hs(e))return e.textContent;if(R(e))return U(e);if(k(e))try{return JSON.stringify(e)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}var Is=t=>!I(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Ms(t){var e=t.entry,r=t.method,i=t.status,n=t.networkRequest,s=t.isInitial,a=t.start,o=t.end,l=t.url,h=t.initiatorType;a=e?e.startTime:a,o=e?e.responseEnd:o;var d=Math.floor(Date.now()-performance.now()),c=Math.floor(d+(a||0)),v=[u({},e?e.toJSON():{name:l},{startTime:_(a)?void 0:Math.round(a),endTime:_(o)?void 0:Math.round(o),timeOrigin:d,timestamp:c,method:r,initiatorType:h||(e?e.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(Is(e))for(var f of e.serverTiming||[])v.push({timeOrigin:d,timestamp:c,startTime:Math.round(e.startTime),name:f.name,duration:f.duration,entryType:"serverTiming"});return v}var Cs=["video/","audio/"];function xs(t){return k(t)&&b(t.getReader)&&b(t.tee)}var Rs=500,Ts="[SessionReplay] Timeout while trying to read body",Os="[SessionReplay] Failed to read body";function As(t){return Os+": "+t}function Es(t){return"[SessionReplay] Body too large to record (> "+t+" bytes)"}function Ns(t,e){if(!e.streamNetworkBody)return function(t){return new Promise((e=>{var r=setTimeout((()=>e(Ts)),Rs);try{t.clone().text().then((t=>e(t)),(t=>e(As(t)))).finally((()=>clearTimeout(r)))}catch(t){clearTimeout(r),e(Os)}}))}(t);var r=Z(e);return function(t,e){try{var r,i=null==(r=t.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>e}catch(t){return!1}}(t,r)?Promise.resolve(Es(r)):function(t,e){return new Promise((r=>{var i,n=!1;function s(){try{var t;null==(t=i)||t.cancel()}catch(t){}}function a(t){n||(n=!0,clearTimeout(u),s(),r(t))}var o,u=setTimeout((()=>a(Ts)),Rs);try{o=t.clone()}catch(t){return void a(Os)}var l=o.body;if(xs(l)&&"undefined"!=typeof TextDecoder){try{i=l.getReader()}catch(t){return void a(Os)}var h=[],d=0;!function t(){i.read().then((r=>{var i=r.done,o=r.value;if(n)s();else if(i)a((new TextDecoder).decode(function(t,e){var r=new Uint8Array(e),i=0;for(var n of t)r.set(n,i),i+=n.byteLength;return r}(h,d)));else{if(o){if(d+o.byteLength>e)return void a(Es(e));d+=o.byteLength,h.push(o)}t()}}),(t=>a(As(t))))}()}else try{o.text().then((t=>a(t)),(t=>a(As(t))))}catch(t){a(Os)}}))}(t,r)}function Ls(){return(Ls=o((function*(t){var e=t.r,r=t.options,i=vs(t.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):Ns(e,r)}))).apply(this,arguments)}function Fs(){return(Fs=o((function*(t){var e=t.r,r=t.options,i=function(t){var e,r=t.r,i=t.options,n=t.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(e=r.headers.get("Content-Type"))?void 0:e.toLowerCase(),a=Cs.some((t=>null==s?void 0:s.startsWith(t)));if(s&&a)return"Content-Type "+s+" is not supported";var o=vs(n,i);return o.isHostDenied?o.hostname+" is in deny list":null}({r:e,options:r,url:t.url});return I(i)?Ns(e,r):Promise.resolve(i)}))).apply(this,arguments)}var Ds=null;function Ps(t,e,r){if(!("performance"in e))return()=>{};if(Ds)return fs.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},J,r):J,n=e=>{var r=[],n=!1;e.requests.forEach((t=>{var e="serverTiming"===t.entryType;if(!e||!n){var s=i.maskRequestFn(t);e||(n=!s),s&&r.push(s)}})),r.length>0&&t(u({},e,{requests:r}))},s=function(t,e,r){if(r.recordInitialRequests){var i=e.performance.getEntries().filter((t=>ps(t)||ms(t)&&r.initiatorTypes.includes(t.initiatorType)));t({requests:i.flatMap((t=>Ms({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new e.PerformanceObserver((e=>{var i=e.getEntries().filter((t=>ps(t)||ms(t)&&r.initiatorTypes.includes(t.initiatorType)&&(t=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)));t({requests:i.flatMap((t=>Ms({entry:t,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((t=>r.performanceEntryTypeToObserve.includes(t)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(n,e,i),a=()=>{},l=()=>{};return(i.recordHeaders||i.recordBody)&&(a=function(t,e,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=gs("request",r.recordHeaders),n=gs("response",r.recordHeaders),s=cs(e.XMLHttpRequest.prototype,"open",(s=>function(a,o,u,l,h){void 0===u&&(u=!0);var d=this;try{var c,v,f=new Request(o),p={},m={},g=d.setRequestHeader.bind(d);d.setRequestHeader=(t,e)=>(m[t]=e,g(t,e)),i&&(p.requestHeaders=m);var y=d.send.bind(d);d.send=t=>(bs({type:"request",headers:m,url:o,recordBody:r.recordBody})&&(p.requestBody=Ss({body:t,options:r,url:o})),c=e.performance.now(),y(t));var w=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",w),d.removeEventListener("abort",w),d.removeEventListener("timeout",w)},b=()=>{if(d.readyState===d.DONE){w(),v=e.performance.now();var i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{var e=t.split(": "),r=e.shift(),n=e.join(": ");r&&(i[r]=n)})),n&&(p.responseHeaders=i),bs({type:"response",headers:i,url:o,recordBody:r.recordBody})&&(p.responseBody=Ss({body:d.response,options:r,url:o})),ks(e,"xmlhttprequest",f.url,c,v).then((e=>{var r=Ms({entry:e,method:a,status:null==d?void 0:d.status,networkRequest:p,start:c,end:v,url:o.toString(),initiatorType:"xmlhttprequest"});t({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",w),d.addEventListener("abort",w),d.addEventListener("timeout",w)}catch(t){fs.error("Failed to instrument XHR for network capture",t)}s.call(d,a,o.toString(),u,l,h)}));return()=>{s()}}(n,e,i),l=function(t,e,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=gs("request",r.recordHeaders),n=gs("response",r.recordHeaders),s=cs(e,"fetch",(s=>function(){var a=o((function*(a,o){var u,l;try{u=new Request(a,o)}catch(t){return fs.error("Failed to instrument fetch for network capture",t),s(a,o)}var h,d,c={};try{try{var v={};u.headers.forEach(((t,e)=>{v[e]=t})),i&&(c.requestHeaders=v),!xs(null==o?void 0:o.body)&&bs({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(c.requestBody=yield function(t){return Ls.apply(this,arguments)}({r:u,options:r,url:a}))}catch(t){fs.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),l=ys(a)?yield s(u):yield s(a,o),d=e.performance.now();var f={};return l.headers.forEach(((t,e)=>{f[e]=t})),n&&(c.responseHeaders=f),bs({type:"response",headers:f,url:a,recordBody:r.recordBody})&&(c.responseBody=yield function(t){return Fs.apply(this,arguments)}({r:l,options:r,url:a})),l}finally{ks(e,"fetch",u.url,h,d).then((e=>{var r,i=Ms({entry:e,method:u.method,status:null==(r=l)?void 0:r.status,networkRequest:c,start:h,end:d,url:u.url,initiatorType:"fetch"});t({requests:i})})).catch((()=>{}))}}));return function(t,e){return a.apply(this,arguments)}}()));return()=>{s()}}(n,e,i)),Ds=()=>{s(),a(),l(),Ds=null}}var Ws=t=>({name:"rrweb/network@1",observer:Ps,options:t});s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:ls,getRecordNetworkPlugin:Ws},s.__PosthogExtensions__.rrweb={record:Zn,version:"v2",wasMaxDepthReached:()=>Ii,resetMaxDepthState(){Ii=!1,Si=!1}},s.rrweb={record:Zn,version:"v2"},s.rrwebConsoleRecord={getRecordConsolePlugin:ls},s.getRecordNetworkPlugin=Ws,s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.initSessionRecording=t=>new mr(t)}();
2
2
  //# sourceMappingURL=lazy-recorder.js.map