1"use strict"; 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c91ca174-f6fe-515f-8287-499571d6317a")}catch(e){}}(); 3(globalThis.rspackChunkowl_frontend||=[]).push([["node_modules_amplitude_plugin-session-replay-browser_lib_esm_index_js"],{16811(e,t,n){n.d(t,{sessionReplayPlugin:()=>tB});var r,i,s,o,a,c,u,l,d,h,f,v,g,p,m,y,S,b,C,I,w=n(31635),E=n(97184),P=n(43964),_=n(48003),R=n(40225),T=n(67395),k=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return(0,w.C6)(t,e),t.prototype.send=function(e,t){return(0,w.sH)(this,void 0,void 0,function(){var n,r;return(0,w.YH)(this,function(i){switch(i.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,w.Cl)({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"})];case 1:return[4,(n=i.sent()).text()];case 2:r=i.sent();try{return[2,this.buildResponse(JSON.parse(r))]}catch(e){return[2,this.buildResponse({code:n.status})]}}})})},t}(T.j),x=n(1555),H=n(39207),M="[Amplitude]",D="".concat(M," Session Replay ID"),O=H.e.US,L={enabled:!0},q="".concat(M," Session Replay Debug"),N="amp-mask";(r=f||(f={})).GET_SR_PROPS="get-sr-props",r.DEBUG_INFO="debug-info",r.FETCH_REQUEST="fetch-request",r.METADATA="metadata",r.TARGETING_DECISION="targeting-decision";var F=function(){function e(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(e){if(!this.logger)return function(){};var t,n=this.logger[e];return"function"==typeof n?(null!=(t=n.__rrweb_original__)?t:n).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),A=n(65107),U="medium",Y=function(e,t,n){switch(t){case"light":if("input"!==e)return!0;var r,i,s=n?(i=(r=n).type,r.hasAttribute("data-rr-is-password")?"password":i?i.toLowerCase():null):"";if(!s)return!1;if(["password","hidden","email","tel"].includes(s)||n.autocomplete.startsWith("cc-"))return!0;return!1;case"medium":case"conservative":return!0;default:return Y(e,U,n)}},B=function(e,t,n){var r,i,s;if(void 0===t&&(t={defaultMaskLevel:U}),n){if(n.closest("."+N)||(null!=(r=t.maskSelector)?r:[]).some(function(e){return n.closest(e)}))return!0;if(n.closest(".amp-unmask")||(null!=(i=t.unmaskSelector)?i:[]).some(function(e){return n.closest(e)}))return!1}return Y(e,null!=(s=t.defaultMaskLevel)?s:U,n)},j=function(e,t){return function(n,r){return B(e,t,r)?n.replace(/[^\s]/g,"*"):n}},K=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t},z=function(){var e=(0,A.m)();return(null==e?void 0:e.location)?e.location.href:""},W=function(e,t){return t||(e===H.e.STAGING?"https://api-sr.stag2.amplitude.com/sessions/v2/track":e===H.e.EU?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track")},J=function(e){var t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^".concat(t,"$"))},$=function(e){if(!e.every(function(e){return"string"==typeof e.selector&&"string"==typeof e.replacement}))throw Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every(function(e){var t;return"string"==typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t)}))throw Error("ugcFilterRules must be an array of objects with valid globs")},G=function(e,t){var n,r;try{for(var i=(0,w.Ju)(t),s=i.next();!s.done;s=i.next()){var o=s.value,a=J(o.selector);if(a.test(e))return e.replace(a,o.replacement)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},V=function(){return(0,w.sH)(void 0,void 0,void 0,function(){var e,t,n,r;return(0,w.YH)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,3,,4]),!(e=(0,A.m)()))return[3,2];return[4,e.navigator.storage.estimate()];case 1:return n=(t=i.sent()).usage,r=t.quota,[2,{totalStorageSize:n?Math.round(n/1024):0,percentOfQuota:n&&r?Math.round((n/r+Number.EPSILON)*1e3)/1e3:0,usageDetails:JSON.stringify(t.usageDetails)}];case 2:return[3,4];case 3:return i.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},X=function(e){var t=(0,w.Cl)({},e),n=t.apiKey;return t.apiKey="****".concat(n.substring(n.length-4)),t},Q=function(){return{flushMaxRetries:2,logLevel:_.$.Warn,loggerProvider:new R.V,transportProvider:new k}},Z=function(e){function t(t,n){var r,i,s,o,a,c=this,u=Q();return(c=e.call(this,(0,w.Cl)((0,w.Cl)({transportProvider:u.transportProvider,loggerProvider:new F(n.loggerProvider||u.loggerProvider)},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=u.flushMaxRetries?n.flushMaxRetries:u.flushMaxRetries,c.apiKey=t,c.sampleRate=n.sampleRate||0,c.serverZone=n.serverZone||O,c.configServerUrl=n.configServerUrl,c.trackServerUrl=n.trackServerUrl,c.shouldInlineStylesheet=n.shouldInlineStylesheet,c.version=n.version,c.performanceConfig=n.performanceConfig||L,c.storeType=null!=(r=n.storeType)?r:"idb",c.applyBackgroun
3dColorToBlockedElements=null!=(i=n.applyBackgroundColorToBlockedElements)&&i,c.enableUrlChangePolling=null!=(s=n.enableUrlChangePolling)&&s,c.urlChangePollingInterval=null!=(o=n.urlChangePollingInterval)?o:1e3,c.captureDocumentTitle=null!=(a=n.captureDocumentTitle)&&a,n.privacyConfig&&(c.privacyConfig=n.privacyConfig),n.interactionConfig&&(c.interactionConfig=n.interactionConfig,c.interactionConfig.ugcFilterRules&&$(c.interactionConfig.ugcFilterRules)),n.debugMode&&(c.debugMode=n.debugMode),n.experimental&&(c.experimental=n.experimental),n.omitElementTags&&(c.omitElementTags=n.omitElementTags),c}return(0,w.C6)(t,e),t}(x.TS),ee=n(2511),et=n(66295),en=((i=en||{})[i.DomContentLoaded=0]="DomContentLoaded",i[i.Load=1]="Load",i[i.FullSnapshot=2]="FullSnapshot",i[i.IncrementalSnapshot=3]="IncrementalSnapshot",i[i.Meta=4]="Meta",i[i.Custom=5]="Custom",i[i.Plugin=6]="Plugin",i),er=((s=er||{})[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s);(o=v||(v={})).Unknown="unknown",o.Skipped="skipped",o.Success="success",o.RateLimit="rate_limit",o.PayloadTooLarge="payload_too_large",o.Invalid="invalid",o.Failed="failed",o.Timeout="Timeout",o.SystemError="SystemError";var ei=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if("object"!=typeof e)return null;var t,n,r,i,s,o,a,c,u,l,d,h,f,g,p,m,y,S,b,C,I,w,E=e.code||0,P=this.buildStatus(E);switch(P){case v.Success:return{status:P,statusCode:E,body:{eventsIngested:null!=(t=e.events_ingested)?t:0,payloadSizeBytes:null!=(n=e.payload_size_bytes)?n:0,serverUploadTime:null!=(r=e.server_upload_time)?r:0}};case v.Invalid:return{status:P,statusCode:E,body:{error:null!=(i=e.error)?i:"",missingField:null!=(s=e.missing_field)?s:"",eventsWithInvalidFields:null!=(o=e.events_with_invalid_fields)?o:{},eventsWithMissingFields:null!=(a=e.events_with_missing_fields)?a:{},eventsWithInvalidIdLengths:null!=(c=e.events_with_invalid_id_lengths)?c:{},epsThreshold:null!=(u=e.eps_threshold)?u:0,exceededDailyQuotaDevices:null!=(l=e.exceeded_daily_quota_devices)?l:{},silencedDevices:null!=(d=e.silenced_devices)?d:[],silencedEvents:null!=(h=e.silenced_events)?h:[],throttledDevices:null!=(f=e.throttled_devices)?f:{},throttledEvents:null!=(g=e.throttled_events)?g:[]}};case v.PayloadTooLarge:return{status:P,statusCode:E,body:{error:null!=(p=e.error)?p:""}};case v.RateLimit:return{status:P,statusCode:E,body:{error:null!=(m=e.error)?m:"",epsThreshold:null!=(y=e.eps_threshold)?y:0,throttledDevices:null!=(S=e.throttled_devices)?S:{},throttledUsers:null!=(b=e.throttled_users)?b:{},exceededDailyQuotaDevices:null!=(C=e.exceeded_daily_quota_devices)?C:{},exceededDailyQuotaUsers:null!=(I=e.exceeded_daily_quota_users)?I:{},throttledEvents:null!=(w=e.throttled_events)?w:[]}};case v.Timeout:default:return{status:P,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?v.Success:429===e?v.RateLimit:413===e?v.PayloadTooLarge:408===e?v.Timeout:e>=400&&e<500?v.Invalid:e>=500?v.Failed:v.Unknown},e}();(a=g||(g={})).US="US",a.EU="EU",a.STAGING="STAGING";var es="Remote config fetch rejected due to timeout after 5 seconds",eo="Unexpected error occurred",ea=function(){function e(e){var t=e.localConfig,n=e.configKeys,r=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteNamespaceConfig=function(e,t){return(0,w.sH)(r,void 0,void 0,function(){var n,r,i;return(0,w.YH)(this,function(s){switch(s.label){case 0:return n=Date.now(),[4,this.fetchWithTimeout(t)];case 1:if((r=s.sent())&&(i=r.configs&&r.configs[e]))return this.metrics.fetchTimeAPISuccess=Date.now()-n,[2,i];return this.metrics.fetchTimeAPIFail=Date.now()-n,[2,void 0]}})})},this.getRemoteConfig=function(e,t,n){return(0,w.sH)(r,void 0,void 0,function(){var r;return(0,w.YH)(this,function(i){switch(i.label){case 0:return[4,this.getRemoteNamespaceConfig(e,n)];case 1:return[2,null==(r=i.sent())?void 0:r[t]]}})})},this.fetchWithTimeout=function(e){return(0,w.sH)(r,void 0,void 0,function(){var t,n,r;return(0,w.YH)(this,function(i){switch(i.label){case 0:return t=new AbortController,n=setTimeout(function(){return t.abort()},5e3),[4,this.fetchRemoteConfig(t.signal,e)];case 1:return r=i.sent(),clearTimeout(n),[2,r]}})})},this.fetchRemoteConfig=function(e,t){return(0,w.sH)(r,void 0,void 0,function(){var n,r,i,s,o,a,c,u,l,d,h;return(0,w.YH)(this,function(f){switch(f.label){case 0:if(t===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:es})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0);f.label=1;case 1:f.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(i=(r=(0,w.Ju)(this.configKeys)).next();!i.done;
3i=r.next())s=i.value,n.append("config_keys",s)}catch(e){l={error:e}}finally{try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}}return t&&n.set("session_id",String(t)),o={headers:{Accept:"*/*"},method:"GET"},a="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(a,(0,w.Cl)((0,w.Cl)({},o),{signal:e}))];case 2:if(null===(c=f.sent()))return[2,this.completeRequest({err:eo})];switch(new ei().buildStatus(c.status)){case v.Success:return this.attempts=0,[2,this.parseAndStoreConfig(c)];case v.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:if(u=f.sent(),e.aborted)return[2,this.completeRequest({err:es})];return[2,this.completeRequest({err:null!=(h=u.message)?h:eo})];case 4:return[2]}})})},this.retryFetch=function(e,t){return(0,w.sH)(r,void 0,void 0,function(){var n=this;return(0,w.YH)(this,function(r){switch(r.label){case 0:return[4,new Promise(function(e){return setTimeout(e,n.attempts*n.retryTimeout)})];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}})})},this.parseAndStoreConfig=function(e){return(0,w.sH)(r,void 0,void 0,function(){var t;return(0,w.YH)(this,function(n){switch(n.label){case 0:return[4,e.json()];case 1:return t=n.sent(),this.completeRequest({success:"Remote config successfully fetched"}),[2,t]}})})},this.localConfig=t,this.configKeys=n}return e.prototype.getServerUrl=function(){return this.localConfig.configServerUrl?this.localConfig.configServerUrl:this.localConfig.serverZone===g.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===g.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),ec=function(e){var t=e.localConfig,n=e.configKeys;return(0,w.sH)(void 0,void 0,void 0,function(){return(0,w.YH)(this,function(e){return[2,new ea({localConfig:t,configKeys:n})]})})},eu=function(e,t){var n=document.createDocumentFragment(),r=function(e){if(void 0===e&&(e=[]),"string"==typeof e&&(e=[e]),0!==(e=e.filter(function(e){try{n.querySelector(e)}catch(n){return t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid')),!1}return!0})).length)return e};return e.blockSelector=r(e.blockSelector),e.maskSelector=r(e.maskSelector),e.unmaskSelector=r(e.unmaskSelector),e},el=function(){function e(e,t){this.localConfig=t,this.remoteConfigFetch=e}return e.prototype.generateJoinedConfig=function(e){var t,n,r,i;return(0,w.sH)(this,void 0,void 0,function(){var s,o,a,c,u,l,d,h,f,v,g,p,m,y,S,b,C,I,E,P,_,R;return(0,w.YH)(this,function(T){switch(T.label){case 0:(s=(0,w.Cl)({},this.localConfig)).optOut=this.localConfig.optOut,s.captureEnabled=!0,T.label=1;case 1:return T.trys.push([1,3,,4]),[4,this.remoteConfigFetch.getRemoteNamespaceConfig("sessionReplay",e)];case 2:return(a=T.sent())&&(c=a.sr_sampling_config,u=a.sr_privacy_config,l=a.sr_targeting_config,d=null==(t=s.interactionConfig)?void 0:t.ugcFilterRules,s.interactionConfig=a.sr_interaction_config,s.interactionConfig&&d&&(s.interactionConfig.ugcFilterRules=d),s.loggingConfig=a.sr_logging_config,(c||u||l)&&(o={},c&&(o.sr_sampling_config=c),u&&(o.sr_privacy_config=u),l&&(o.sr_targeting_config=l))),[3,4];case 3:return h=T.sent(),this.localConfig.loggerProvider.warn(h.message),s.captureEnabled=!1,[3,4];case 4:if(!o)return[2,{localConfig:this.localConfig,joinedConfig:s,remoteConfig:o}];if(f=o.sr_sampling_config,v=o.sr_privacy_config,g=o.sr_targeting_config,f&&Object.keys(f).length>0?(Object.prototype.hasOwnProperty.call(f,"capture_enabled")?s.captureEnabled=f.capture_enabled:s.captureEnabled=!1,Object.prototype.hasOwnProperty.call(f,"sample_rate")&&(s.sampleRate=f.sample_rate)):(s.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),v){p=null!=(n=s.privacyConfig)?n:{},m={defaultMaskLevel:null!=(i=null!=(r=v.defaultMaskLevel)?r:p.defaultMaskLevel)?i:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[]},y=function(e){var t,n,r,i,s,o,a,c,u,l={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var d=(0,w.Ju)(null!=(a=e.blockSelector)?a:[]),h=d.next();!h.done;h=d.next()){var f=h.value;l[f]="block"}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}try{for(var v=(0,w.Ju)(null!=(c=e.maskSelector)?c:[]),g=v.next();!g.done;g=v.next()){var f=g.value;l[f]="mask"}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}try{for(var p=(0,w.Ju)(null!=(u=e.unmaskSelector)?u:[]),m=p.next();!m.done;m=p.next()){var f=m.value;l[f]="unmask"}}catch(e){s={error:e}}finally{try{m&&!m.done&&(o=p.return)&&o.call(p)}finally{if(s)throw s.error}}return l},S=(0,w.Cl)((0,w.Cl)({},y(p)),y(v));try{for(C=(b=(0,w.Ju)(Object.entries(S))).next();!C.done;C=b.next())E=(I=(0,w.zs)(C.value,2))[0],P=I[1],"mask"===P?m.maskSelector.push(E):"block"===P?m.blockSelector.push(E):"unmask"===P&&m.unmaskSelector.push(E)}catch(e){_={error:e}}finally{try{C&&!C.done&&(R=b.return)&&R.call(b)}finally{if(_)throw _.error}}s.privacyConfig=eu(m,this.localConfig.loggerProvider)}return g&&Object.keys(g).length>0&&(s.targetingConfig=g),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:X(s)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:s,remoteConfig:o}]}})})},e}(),ed=Uint8Array,eh=Uint16Array,ef=Uint32Array,ev=new ed([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]),eg=new ed([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]),ep=new ed([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),em=function(e,t){for(var n=new eh(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ef(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return[n,i]},ey=em(ev,2),eS=ey[0],eb=ey[1];eS[28]=258,eb[258]=28;for(var eC=em(eg,0),eI=(eC[0],eC[1]),ew=new eh(32768),eE=0;eE<32768;++eE){var eP=(43690&eE)>>>1|(21845&eE)<<1;eP=(61680&(eP=(52428&eP)>>>2|(13107&eP)<<2))>>>4|(3855&eP)<<4,ew[eE]=((65280&eP)>>>8|(255&eP)<<8)>>>1}for(var e_=function(e,t,n){for(var r,i=e.length,s=0,o=new eh(t);s<i;++s)++o[e[s]-1];var a=new eh(t);for(s=0;s<t;++s)a[s]=a[s-1]+o[s-1]<<1;if(n){r=new eh(1<<t);var c=15-t;for(s=0;s<i;++s)if(e[s])for(var u=s<<4|e[s],l=t-e[s],d=a[e[s]-1]++<<l,h=d|(1<<l)-1;d<=h;++d)r[ew[d]>>>c]=u}else for(r=new eh(i),s=0;s<i;++s)r[s]=ew[a[e[s]-1]++]>>>15-e[s];return r},eR=new ed(288),eE=0;eE<144;++eE)eR[eE]=8;for(var eE=144;eE<256;++eE)eR[eE]=9;for(var eE=256;eE<280;++eE)eR[eE]=7;for(var eE=280;eE<288;++eE)eR[eE]=8;for(var eT=new ed(32),eE=0;eE<32;++eE)eT[eE]=5;var ek=e_(eR,9,0),ex=e_(eT,5,0),eH=function(e){return(e/8|0)+(7&e&&1)},eM=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof eh?eh:e instanceof ef?ef:ed)(n-t);return r.set(e.subarray(t,n)),r},eD=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>>8},eO=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},eL=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return[new ed(0),0];if(1==i){var o=new ed(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var a=n[0],c=n[1],u=0,l=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=i-1;)a=n[n[u].f<n[d].f?u++:d++],c=n[u!=l&&n[u].f<n[d].f?u++:d++],n[l++]={s:-1,f:a.f+c.f,l:a,r:c};for(var h=s[0].s,r=1;r<i;++r)s[r].s>h&&(h=s[r].s);var f=new eh(h+1),v=eq(n[l-1],f,0);if(v>t){var r=0,g=0,p=v-t,m=1<<p;for(s.sort(function(e,t){return f[t.s]-f[e.s]||e.f-t.f});r<i;++r){var y=s[r].s;if(f[y]>t)g+=m-(1<<v-f[y]),f[y]=t;else break}for(g>>>=p;g>0;){var S=s[r].s;f[S]<t?g-=1<<t-f[S]++-1:++r}for(;r>=0&&g;--r){var b=s[r].s;f[b]==t&&(--f[b],++g)}v=t}return[new ed(f),v]},eq=function(e,t,n){return -1==e.s?Math.max(eq(e.l,t,n+1),eq(e.r,t,n+1)):t[e.s]=n},eN=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new eh(++t),r=0,i=e[0],s=1,o=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=e[a]}return[n.subarray(0,r),t]},eF=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},eA=function(e,t,n){var r=n.length,i=eH(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var s=0;s<r;++s)e[i+s+4]=n[s];return(i+4+r)*8},eU=function(e,t,n,r,i,s,o,a,c,u,l){eD(t,l++,n),++i[256];for(var d,h,f,v,g=eL(i,15),p=g[0],m=g[1],y=eL(s,15),S=y[0],b=y[1],C=eN(p),I=C[0],w=C[1],E=eN(S),P=E[0],_=E[1],R=new eh(19),T=0;T<I.length;++T)R[31&I[T]]++;for(var T=0;T<P.length;++T)R[31&P[T]]++;for(var k=eL(R,7),x=k[0],H=k[1],M=19;M>4&&!x[ep[M-1]];--M);var D=u+5<<3,O=eF(i,eR)+eF(s,eT)+o,L=eF(i,p)+eF(s,S)+o+14+3*M+eF(R,x)+(2*R[16]+3*R[17]+7*R[18]);
3if(D<=O&&D<=L)return eA(t,l,e.subarray(c,c+u));if(eD(t,l,1+(L<O)),l+=2,L<O){d=e_(p,m,0),h=p,f=e_(S,b,0),v=S;var q=e_(x,H,0);eD(t,l,w-257),eD(t,l+5,_-1),eD(t,l+10,M-4),l+=14;for(var T=0;T<M;++T)eD(t,l+3*T,x[ep[T]]);l+=3*M;for(var N=[I,P],F=0;F<2;++F)for(var A=N[F],T=0;T<A.length;++T){var U=31&A[T];eD(t,l,q[U]),l+=x[U],U>15&&(eD(t,l,A[T]>>>5&127),l+=A[T]>>>12)}}else d=ek,h=eR,f=ex,v=eT;for(var T=0;T<a;++T)if(r[T]>255){var U=r[T]>>>18&31;eO(t,l,d[U+257]),l+=h[U+257],U>7&&(eD(t,l,r[T]>>>23&31),l+=ev[U]);var Y=31&r[T];eO(t,l,f[Y]),l+=v[Y],Y>3&&(eO(t,l,r[T]>>>5&8191),l+=eg[Y])}else eO(t,l,d[r[T]]),l+=h[r[T]];return eO(t,l,d[256]),l+h[256]},eY=new ef([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),eB=function(e,t,n,r,i,s){var o=e.length,a=new ed(r+o+5*(1+Math.floor(o/7e3))+i),c=a.subarray(r,a.length-i),u=0;if(!t||o<8)for(var l=0;l<=o;l+=65535){var d=l+65535;d<o?u=eA(c,u,e.subarray(l,d)):(c[l]=s,u=eA(c,u,e.subarray(l,o)))}else{for(var h=eY[t-1],f=h>>>13,v=8191&h,g=(1<<n)-1,p=new eh(32768),m=new eh(g+1),y=Math.ceil(n/3),S=2*y,b=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<S)&g},C=new ef(25e3),I=new eh(288),w=new eh(32),E=0,P=0,l=0,_=0,R=0,T=0;l<o;++l){var k=b(l),x=32767&l,H=m[k];if(p[x]=H,m[k]=x,R<=l){var M=o-l;if((E>7e3||_>24576)&&M>423){u=eU(e,c,0,C,I,w,P,_,T,l-T,u),_=E=P=0,T=l;for(var D=0;D<286;++D)I[D]=0;for(var D=0;D<30;++D)w[D]=0}var O=2,L=0,q=v,N=x-H&32767;if(M>2&&k==b(l-N))for(var F=Math.min(f,M)-1,A=Math.min(32767,l),U=Math.min(258,M);N<=A&&--q&&x!=H;){if(e[l+O]==e[l+O-N]){for(var Y=0;Y<U&&e[l+Y]==e[l+Y-N];++Y);if(Y>O){if(O=Y,L=N,Y>F)break;for(var B=Math.min(N,Y-2),j=0,D=0;D<B;++D){var K=l-N+D+32768&32767,z=p[K],W=K-z+32768&32767;W>j&&(j=W,H=K)}}}H=p[x=H],N+=x-H+32768&32767}if(L){C[_++]=0x10000000|eb[O]<<18|eI[L];var J=31&eb[O],$=31&eI[L];P+=ev[J]+eg[$],++I[257+J],++w[$],R=l+O,++E}else C[_++]=e[l],++I[e[l]]}}u=eU(e,c,s,C,I,w,P,_,T,l-T,u)}return eM(a,0,r+eH(u)+i)},ej=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,s=n.length,o=0;o!=s;){for(var a=Math.min(o+5552,s);o<a;++o)r+=n[o],i+=r;r%=65521,i%=65521}e=r,t=i},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+((255&e)<<23)*2}}},eK=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},ez=function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)},eW=function(){function e(e,t,n,r){var i,s,o=this;this.taskQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t,n,r,i,s;return JSON.stringify(function(e,t){var n="";if(!t&&"u">typeof TextDecoder)return new TextDecoder().decode(e);for(var r=0;r<e.length;){var i=e[r++];i<128||t?n+=String.fromCharCode(i):i<224?n+=String.fromCharCode((31&i)<<6|63&e[r++]):i<240?n+=String.fromCharCode((15&i)<<12|(63&e[r++])<<6|63&e[r++]):n+=String.fromCharCode(55296|(i=((15&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536)>>10,56320|1023&i)}return n}((t=function(e){var t=e.length;if("u">typeof TextEncoder)return new TextEncoder().encode(e);for(var n=new ed(e.length+(e.length>>>1)),r=0,i=function(e){n[r++]=e},s=0;s<t;++s){if(r+5>n.length){var o=new ed(r+8+(t-s<<1));o.set(n),n=o}var a=e.charCodeAt(s);a<128?i(a):(a<2048?i(192|a>>>6):(a>55295&&a<57344?(i(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++s))>>>18),i(128|a>>>12&63)):i(224|a>>>12),i(128|a>>>6&63)),i(128|63&a))}return eM(n,0,r)}(JSON.stringify({...e,v:"v1"})),void 0===n&&(n={}),(r=ej()).p(t),ez(s=eB(t,null==(i=n).level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,2,4,!0),n),eK(s,s.length-4,r.d()),s),!0))},this.addCompressedEventToManager=function(e,t){o.eventsManager&&o.deviceId&&o.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:o.deviceId})},this.addCompressedEvent=function(e,t){if(o.worker)o.worker.postMessage({event:e,sessionId:t});else{var n=o.compressEvent(e);o.addCompressedEventToManager(n,t)}},this.terminate=function(){var e;null==(e=o.worker)||e.terminate()};var a=(0,A.m)();this.canUseIdleCallback=a&&"requestIdleCallback"in a,this.eventsManager=e,this.config=t,this.deviceId=n,this.timeout=(null==(i=t.performanceConfig)?void 0:i.timeout)||2e3;var c=r;if((null==(s=this.config.experimental)?void 0:s.useWebWorker)&&a&&a.Worker&&c){t.loggerProvider.log("[Experimental] Enabling web worker for compression");
3var u=new Worker(URL.createObjectURL(new Blob([c],{type:"application/javascript"})));u.onerror=function(e){t.loggerProvider.error(e)},u.onmessage=function(e){var t=e.data,n=t.compressedEvent,r=t.sessionId;o.addCompressedEventToManager(n,r)},this.worker=u}}return e.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(t){e.processQueue(t)},{timeout:this.timeout}))},e.prototype.enqueueEvent=function(e,t){var n;this.canUseIdleCallback&&(null==(n=this.config.performanceConfig)?void 0:n.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.taskQueue.push({event:e,sessionId:t}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,t))},e.prototype.processQueue=function(e){for(var t=this;this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var n=this.taskQueue.shift();if(n){var r=n.event,i=n.sessionId;this.addCompressedEvent(r,i)}}this.taskQueue.length>0?requestIdleCallback(function(e){t.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e}(),eJ=n(68553),e$="Failed to store session replay events in IndexedDB",eG="1.28.3",eV=function(){function e(e){var t=e.trackServerUrl,n=e.loggerProvider,r=e.payloadBatcher;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=n,this.payloadBatcher=r||function(e){return e},this.trackServerUrl=t}return e.prototype.sendEventsList=function(e){this.addToQueue((0,w.Cl)((0,w.Cl)({},e),{attempts:0,timeout:0}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.filter(function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:"Session replay event batch rejected due to exceeded retry count"}),!1)}).forEach(function(t){(e.queue=e.queue.concat(t),0===t.timeout)?e.schedule(0):setTimeout(function(){t.timeout=0,e.schedule(0)},t.timeout)})},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,w.sH)(this,void 0,void 0,function(){var t,n,r=this;return(0,w.YH)(this,function(i){switch(i.label){case 0:return t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),[4,Promise.all(t.map(function(t){return r.send(t,e)}))];case 1:return i.sent(),[2]}})})},e.prototype.send=function(e,t){var n,r;return void 0===t&&(t=!0),(0,w.sH)(this,void 0,void 0,function(){var i,s,o,a,c,u,l,d,h,f,v,g;return(0,w.YH)(this,function(p){switch(p.label){case 0:if(!(i=e.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(s=e.deviceId))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];if(o=z(),a=eG,c=e.sampleRate,u=new URLSearchParams({device_id:s,session_id:"".concat(e.sessionId),type:"".concat(e.type)}),l="".concat((null==(n=e.version)?void 0:n.type)||"standalone","/").concat((null==(r=e.version)?void 0:r.version)||a),0===(d=this.payloadBatcher({version:1,events:e.events})).events.length)return this.completeRequest({context:e}),[2];p.label=1;case 1:return p.trys.push([1,3,,4]),h={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(i),"X-Client-Version":a,"X-Client-Library":l,"X-Client-Url":o.substring(0,1e3),"X-Client-Sample-Rate":"".concat(c)},body:JSON.stringify(d),method:"POST"},[4,fetch("".concat(W(e.serverZone,this.trackServerUrl),"?").concat(u.toString()),h)];case 2:if(null===(f=p.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)this.handleReponse(f.status,e);else{v="";try{v=JSON.stringify(f.body,null,2)}catch(e){}this.completeRequest({context:e,success:"".concat(f.status,": ").concat(v)})}return[3,4];case 3:return g=p.sent(),this.completeRequest({context:e,err:g}),[3,4];case 4:return[2]}})})},e.prototype.handleReponse=function(e,t){switch(new T.j().buildStatus(e)){case eJ.n.Success:this.handleSuccessResponse(t);break;case eJ.n.Failed:this.handleOtherResponse(t);break;default:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"})}},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/1024);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){this.addToQueue((0,w.Cl)((0,w.Cl)({},e),{timeout:e.attempts*this.retryTimeout}))},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e}(),eX=n(41962),eQ=n(60602),eZ=function(){function e(e){var t,n,r,i=this;
3this.minInterval=500,this.maxInterval=1e4,this.maxPersistedEventsSize=1e6,this.interval=this.minInterval,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,t){var n=i.getStringSize(t);return i.getEventsArraySize(e)+n>=i.maxPersistedEventsSize||Date.now()-i.timeAtLastSplit>i.interval&&!!e.length&&(i.interval=Math.min(i.maxInterval,i.interval+i.minInterval),i._timeAtLastSplit=Date.now(),!0)},this.loggerProvider=e.loggerProvider,this.minInterval=null!=(t=e.minInterval)?t:this.minInterval,this.maxInterval=null!=(n=e.maxInterval)?n:this.maxInterval,this.maxPersistedEventsSize=null!=(r=e.maxPersistedEventsSize)?r:this.maxPersistedEventsSize}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(e){return e.length},e.prototype.getEventsArraySize=function(e){var t,n,r=0;try{for(var i=(0,w.Ju)(e),s=i.next();!s.done;s=i.next()){var o=s.value;r+=this.getStringSize(o)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r+(2+Math.max(0,e.length-1)+2*e.length)},e}();(c=p||(p={})).RECORDING="recording",c.SENT="sent";var e0="sessionCurrentSequence",e1="sequencesToSend",e2=function(){var e=(0,A.m)();return new Promise(function(t,n){if(!e)return n(Error("Global scope not found"));if(!e.indexedDB)return n(Error("Session Replay: cannot find indexedDB"));try{var r=e.indexedDB.open("keyval-store");r.onupgradeneeded=function(){1===r.result.version&&(r.result.close(),r.transaction&&r.transaction.abort(),e.indexedDB.deleteDatabase("keyval-store"),t())},r.onsuccess=function(){t(r.result)},r.onerror=function(){n(r.error)}}catch(e){n(e)}})},e3=function(e){return(0,w.sH)(void 0,void 0,void 0,function(){return(0,w.YH)(this,function(t){switch(t.label){case 0:if(!(e.length>0))return[3,2];return[4,Promise.all(e.splice(0,10))];case 1:return t.sent(),[3,0];case 2:return[2]}})})},e4=function(e){var t,n;return e.objectStoreNames.contains(e0)||(n=e.createObjectStore(e0,{keyPath:"sessionId"})),e.objectStoreNames.contains(e1)||(t=e.createObjectStore(e1,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:n}},e5=function(e){function t(t){var n=e.call(this,t)||this;return n.getSequencesToSend=function(){return(0,w.sH)(n,void 0,void 0,function(){var e,t,n,r,i,s;return(0,w.YH)(this,function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),e=[],[4,this.db.transaction("sequencesToSend").store.openCursor()];case 1:t=o.sent(),o.label=2;case 2:if(!t)return[3,4];return r=(n=t.value).sessionId,i=n.events,e.push({events:i,sequenceId:t.key,sessionId:r}),[4,t.continue()];case 3:return t=o.sent(),[3,2];case 4:return[2,e];case 5:return s=o.sent(),this.loggerProvider.warn("".concat(e$,": ").concat(s)),[3,6];case 6:return[2,void 0]}})})},n.storeCurrentSequence=function(e){return(0,w.sH)(n,void 0,void 0,function(){var t,n,r;return(0,w.YH)(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),[4,this.db.get(e0,e)];case 1:if(!(t=i.sent()))return[2,void 0];return[4,this.db.put(e1,{sessionId:e,events:t.events})];case 2:return n=i.sent(),[4,this.db.put(e0,{sessionId:e,events:[]})];case 3:return i.sent(),[2,(0,w.Cl)((0,w.Cl)({},t),{sessionId:e,sequenceId:n})];case 4:return r=i.sent(),this.loggerProvider.warn("".concat(e$,": ").concat(r)),[3,5];case 5:return[2,void 0]}})})},n.addEventToCurrentSequence=function(e,t){return(0,w.sH)(n,void 0,void 0,function(){var n,r,i,s,o,a;return(0,w.YH)(this,function(c){switch(c.label){case 0:return c.trys.push([0,10,,11]),[4,(n=this.db.transaction(e0,"readwrite")).store.get(e)];case 1:if(r=c.sent())return[3,3];return[4,n.store.put({sessionId:e,events:[t]})];case 2:return c.sent(),[2];case 3:if(i=void 0,!this.shouldSplitEventsList(r.events,t))return[3,5];return i=r.events,[4,n.store.put({sessionId:e,events:[t]})];case 4:return c.sent(),[3,7];case 5:return s=r.events.concat(t),[4,n.store.put({sessionId:e,events:s})];case 6:c.sent(),c.label=7;case 7:return[4,n.done];case 8:if(c.sent(),!i)return[2,void 0];return[4,this.storeSendingEvents(e,i)];case 9:if(!(o=c.sent()))return[2,void 0];return[2,{events:i,sessionId:e,sequenceId:o}];case 10:return a=c.sent(),this.loggerProvider.warn("".concat(e$,": ").concat(a)),[3,11];case 11:return[2,void 0]}})})},n.storeSendingEvents=function(e,t){return(0,w.sH)(n,void 0,void 0,function(){var n;return(0,w.YH)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.db.put(e1,{sessionId:e,events:t})];case 1:return[2,r.sent()];case 2:return n=r.sent(),this.loggerProvider.warn("".concat(e$,": ").concat(n)),[3,3];case 3:return[2,void 0]}})})},n.cleanUpSessionEventsStore=function(e,t){return(0,w.sH)(n,void 0,void 0,function(){var e;return(0,w.YH)(this,function(n){switch(n.label){case 0:if(!t)return[2];n.label=1;
3case 1:return n.trys.push([1,3,,4]),[4,this.db.delete(e1,t)];case 2:return n.sent(),[3,4];case 3:return e=n.sent(),this.loggerProvider.warn("".concat(e$,": ").concat(e)),[3,4];case 4:return[2]}})})},n.transitionFromKeyValStore=function(e){return(0,w.sH)(n,void 0,void 0,function(){var t,n,r,i,s,o,a,c=this;return(0,w.YH)(this,function(u){switch(u.label){case 0:return u.trys.push([0,6,,7]),[4,e2()];case 1:if(!(t=u.sent()))return[2];n=function(e,t){return(0,w.sH)(c,void 0,void 0,function(){var n,r,i=this;return(0,w.YH)(this,function(s){switch(s.label){case 0:return n=t.sessionSequences,r=[],Object.keys(n).forEach(function(s){var o=parseInt(s,10),a=n[o];if(o===t.currentSequenceId){var c=a.events.map(function(t){return(0,w.sH)(i,void 0,void 0,function(){return(0,w.YH)(this,function(n){return[2,this.addEventToCurrentSequence(e,t)]})})});r.push.apply(r,(0,w.fX)([],(0,w.zs)(c),!1))}else a.status!==p.SENT&&r.push(i.storeSendingEvents(e,a.events))}),[4,e3(r)];case 1:return s.sent(),[2]}})})},r="".concat(eX.fS,"_").concat(this.apiKey.substring(0,10)),u.label=2;case 2:return u.trys.push([2,4,,5]),i=t.transaction("keyval").objectStore("keyval").getAll(r),[4,new Promise(function(t){i.onsuccess=function(r){return(0,w.sH)(c,void 0,void 0,function(){var i,s,o,a=this;return(0,w.YH)(this,function(c){switch(c.label){case 0:if(!(s=(i=r&&r.target.result)&&i[0]))return[3,2];return o=[],Object.keys(s).forEach(function(t){var r=parseInt(t,10),i=s[r];if(e===r)o.push(n(r,i));else{var c=i.sessionSequences;Object.keys(c).forEach(function(e){var t=parseInt(e,10);c[t].status!==p.SENT&&o.push(a.storeSendingEvents(r,c[t].events))})}}),[4,e3(o)];case 1:c.sent(),c.label=2;case 2:return t(),[2]}})})}})];case 3:return u.sent(),(s=(0,A.m)())&&s.indexedDB.deleteDatabase("keyval-store"),[3,5];case 4:return o=u.sent(),this.loggerProvider.warn("Failed to transition session replay events from keyval to new store: ".concat(o)),[3,5];case 5:return[3,7];case 6:return a=u.sent(),this.loggerProvider.warn("Failed to access keyval store: ".concat(a,". For more information, visit: https://www.docs.developers.amplitude.com/session-replay/sdks/standalone/#indexeddb-best-practices")),[3,7];case 7:return[2]}})})},n.apiKey=t.apiKey,n.db=t.db,n}return(0,w.C6)(t,e),t.new=function(e,n,r){return(0,w.sH)(this,void 0,void 0,function(){var i,s,o,a;return(0,w.YH)(this,function(c){switch(c.label){case 0:var u;return c.trys.push([0,3,,4]),i="replay"===e?"":"_".concat(e),[4,(u="".concat(n.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),(0,w.sH)(void 0,void 0,void 0,function(){return(0,w.YH)(this,function(e){switch(e.label){case 0:return[4,(0,eQ.P2)(u,1,{upgrade:e4})];case 1:return[2,e.sent()]}})}))];case 1:return s=c.sent(),[4,(o=new t((0,w.Cl)((0,w.Cl)({},n),{db:s}))).transitionFromKeyValStore(r)];case 2:return c.sent(),[2,o];case 3:return a=c.sent(),n.loggerProvider.warn("".concat(e$,": ").concat(a)),[3,4];case 4:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return(0,w.sH)(this,void 0,void 0,function(){var t,n,r,i,s,o;return(0,w.YH)(this,function(a){switch(a.label){case 0:if(!e)return[3,2];return[4,this.db.get("sessionCurrentSequence",e)];case 1:if(!(t=a.sent()))return[2,void 0];return[2,[t]];case 2:n=[],a.label=3;case 3:return a.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:i=(r=w.Ju.apply(void 0,[a.sent()])).next(),a.label=5;case 5:if(i.done)return[3,7];
3t=i.value,n.push(t),a.label=6;case 6:return i=r.next(),[3,5];case 7:return[3,10];case 8:return s={error:a.sent()},[3,10];case 9:try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(s)throw s.error}return[7];case 10:return[2,n]}})})},t}(eZ),e6=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t}return(0,w.C6)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,n=(0,w.fX)([],(0,w.zs)(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:n},this.resetCurrentSequence(e),{sequenceId:t,events:n,sessionId:e}},t.prototype.getSequencesToSend=function(){return(0,w.sH)(this,void 0,void 0,function(){return(0,w.YH)(this,function(e){return[2,Object.entries(this.finalizedSequences).map(function(e){var t=(0,w.zs)(e,2),n=t[0],r=t[1],i=r.sessionId,s=r.events;return{sequenceId:Number(n),sessionId:i,events:s}})]})})},t.prototype.storeCurrentSequence=function(e){return(0,w.sH)(this,void 0,void 0,function(){return(0,w.YH)(this,function(t){return this.sequences[e]?[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return(0,w.sH)(this,void 0,void 0,function(){var n;return(0,w.YH)(this,function(r){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(n=this.addSequence(e)),this.sequences[e].push(t),[2,n]})})},t.prototype.storeSendingEvents=function(e,t){return(0,w.sH)(this,void 0,void 0,function(){return(0,w.YH)(this,function(n){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,w.sH)(this,void 0,void 0,function(){return(0,w.YH)(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(eZ),e8=function(e){var t=e.config,n=e.sessionId,r=e.minInterval,i=e.maxInterval,s=e.type,o=e.payloadBatcher,a=e.storeType;return(0,w.sH)(void 0,void 0,void 0,function(){var e,c,u,l,d;function h(t){return void 0===t&&(t=!1),(0,w.sH)(this,void 0,void 0,function(){return(0,w.YH)(this,function(n){return[2,e.flush(t)]})})}return(0,w.YH)(this,function(f){switch(f.label){case 0:if(e=new eV((0,w.Cl)((0,w.Cl)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:o})),c=function(){return new e6({loggerProvider:t.loggerProvider,maxInterval:i,minInterval:r})},"idb"!==a)return[3,2];return[4,(0,w.sH)(void 0,void 0,void 0,function(){var e;return(0,w.YH)(this,function(o){switch(o.label){case 0:return[4,e5.new(s,{loggerProvider:t.loggerProvider,minInterval:r,maxInterval:i,apiKey:t.apiKey},n)];case 1:return e=o.sent(),t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,null!=e?e:c()]}})})];case 1:return l=f.sent(),[3,3];case 2:l=c(),f.label=3;case 3:return u=l,d=function(n){var r=n.events,i=n.sessionId,o=n.deviceId,a=n.sequenceId;t.debugMode&&V().then(function(e){var n=e.totalStorageSize,r=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(n," KB, percentage of quota: ").concat(r,"%, usage details: ").concat(i))}).catch(function(){}),e.sendEventsList({events:r,sessionId:i,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:o,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:s,onComplete:function(){return(0,w.sH)(void 0,void 0,void 0,function(){return(0,w.YH)(this,function(e){switch(e.label){case 0:return[4,u.cleanUpSessionEventsStore(i,a)];case 1:return e.sent(),[2]}})})}})},[2,{sendCurrentSequenceEvents:function(e){var n=e.sessionId,r=e.deviceId;u.storeCurrentSequence(n).then(function(e){e&&d({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})},addEvent:function(e){var n=e.event,r=e.sessionId,i=e.deviceId;u.addEventToCurrentSequence(r,n.data).then(function(e){return e&&d({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:i})}).catch(function(e){t.loggerProvider.warn("Failed to add event to session replay capture:",e)})},sendStoredEvents:function(e){var t=e.deviceId;return(0,w.sH)(void 0,void 0,void 0,function(){var e;return(0,w.YH)(this,function(n){switch(n.label){case 0:return[4,u.getSequencesToSend()];case 1:return(e=n.sent())&&e.forEach(function(e){d({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:t})}),[2]}})})},flush:h}]}})})},e7=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Map;e.forEach(function(e){n.set(e.name,e.manager)}),this.managers=n}return e.prototype.sendStoredEvents=function(e){return(0,w.sH)(this,void 0,void 0,function(){var t;return(0,w.YH)(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEac
3h(function(n){t.push(n.sendStoredEvents(e))}),[4,Promise.all(t)];case 1:return n.sent(),[2]}})})},e.prototype.addEvent=function(e){var t,n=e.sessionId,r=e.event,i=e.deviceId;null==(t=this.managers.get(r.type))||t.addEvent({sessionId:n,event:r,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,n=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:n})})},e.prototype.flush=function(e){return(0,w.sH)(this,void 0,void 0,function(){var t;return(0,w.YH)(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEach(function(n){t.push(n.flush(e))}),[4,Promise.all(t)];case 1:return n.sent(),[2]}})})},e}();let e9={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},te={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},tt={};function tn(e){var t,n;let r;if(tt[e])return tt[e];let i=((r=null==(n=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:n.call(t,e))&&globalThis[r]?globalThis[r]:void 0)||globalThis[e],s=i.prototype,o=e in e9?e9[e]:void 0,a=!!(o&&o.every(e=>{var t,n;return!!(null==(n=null==(t=Object.getOwnPropertyDescriptor(s,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),c=e in te?te[e]:void 0,u=!!(c&&c.every(e=>{var t;return"function"==typeof s[e]&&(null==(t=s[e])?void 0:t.toString().includes("[native code]"))}));if(a&&u)return tt[e]=i.prototype,i.prototype;try{let t=document.createElement("iframe");document.body.appendChild(t);let n=t.contentWindow;if(!n)return i.prototype;let r=n[e].prototype;if(document.body.removeChild(t),!r)return s;return tt[e]=r}catch{return s}}let tr={},ti=function(e){var t,n="Node",r=e,i="parentElement";let s=`${n}.${String(i)}`;if(tr[s])return tr[s].call(r);let o=null==(t=Object.getOwnPropertyDescriptor(tn(n),i))?void 0:t.get;return o?(tr[s]=o,o.call(r)):r[i]};function ts(){var e=(0,A.m)();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}function to(){var e=(0,A.m)();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}function ta(e,t,n){for(var r=null,i=[],s=e,o=0;s&&"break"!==function(){var e,a,c,u,l=new Date().getTime()-S.getTime();if(void 0!==m.timeoutMs&&l>m.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(l,"ms"));var d=tg((e=s.getAttribute("id"))&&m.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||tg.apply(void 0,(0,w.fX)([],(0,w.zs)(Array.from(s.attributes).filter(function(e){return m.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||tg.apply(void 0,(0,w.fX)([],(0,w.zs)(Array.from(s.classList).filter(m.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||tg((a=s.tagName.toLowerCase(),m.tagName(a)?{name:a,penalty:2}:null))||[th()],h=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;for(var r=0;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(s);if("all"==t)h&&(d=d.concat(d.filter(tv).map(function(e){return tf(e,h)})));else if("two"==t)d=d.slice(0,1),h&&(d=d.concat(d.filter(tv).map(function(e){return tf(e,h)})));else if("one"==t){var f=(0,w.zs)(d=d.slice(0,1),1)[0];h&&tv(f)&&(d=[tf(f,h)])}else"none"==t&&(d=[th()],h&&(d=[tf(d[0],h)]));try{for(var v=(c=void 0,(0,w.Ju)(d)),g=v.next();!g.done;g=v.next()){var f=g.value;f.level=o}}catch(e){c={error:e}}finally{try{g&&!g.done&&(u=v.return)&&u.call(v)}finally{if(c)throw c.error}}if(i.push(d),i.length>=m.seedMinLength&&(r=tc(i,n)))return"break";s=s.parentElement,o++}(););return(r||(r=tc(i,n)),!r&&n)?n():r}function tc(e,t){var n,r,i=tm(function e(t,n){var r,i,s,o,a;return void 0===n&&(n=[]),(0,w.YH)(this,function(c){switch(c.label){case 0:if(!(t.length>0))return[3,9];c.label=1;case 1:c.trys.push([1,6,7,8]),i=(r=(0,w.Ju)(t[0])).next(),c.label=2;case 2:if(i.done)return[3,5];return s=i.value,[5,(0,w.Ju)(e(t.slice(1,t.length),n.concat(s)))];case 3:c.sent(),c.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o={error:c.sent()},[3,8];case 7:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}
3return[7];case 8:return[3,11];case 9:return[4,n];case 10:c.sent(),c.label=11;case 11:return[2]}})}(e));if(i.length>m.threshold)return t?t():null;try{for(var s=(0,w.Ju)(i),o=s.next();!o.done;o=s.next()){var a=o.value;if(td(a))return a}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return null}function tu(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var i=e[r].level||0;n=t.level===i-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function tl(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function td(e){var t=tu(e);switch(y.querySelectorAll(t).length){case 0:throw Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function th(){return{name:"*",penalty:3}}function tf(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function tv(e){return"html"!==e.name&&!e.name.startsWith("#")}function tg(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(tp);return n.length>0?n:null}function tp(e){return null!=e}function tm(e){return(0,w.fX)([],(0,w.zs)(e),!1).sort(function(e,t){return tl(e)-tl(t)})}var ty=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&r.push(t)}),{version:t,events:r}},tS=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&r.push(t)}),{version:t,events:Object.values(r.reduce(function(e,t){var n=t.x,r=t.y,i=t.selector,s=t.timestamp,o=s-s%36e5,a="".concat(n,":").concat(r,":").concat(null!=i?i:"",":").concat(o);return e[a]?e[a].count+=1:e[a]=(0,w.Cl)((0,w.Cl)({},t),{timestamp:o,count:1}),e},{}))}},tb=function(e,t){var n=t.eventsManager,r=t.sessionId,i=t.deviceIdFn,s=t.mirror,o=t.ugcFilterRules;return function(t){if(t.type!==er.Click)return;var a,c=(0,A.m)();if(c){var u=c.location,l=c.innerHeight,d=c.innerWidth;if(u){var h=t.x,f=t.y;if(void 0!==h&&void 0!==f){var v,g,p,b,C,I=s.getNode(t.id);if(I)try{a=function(e){if(S=new Date,e.nodeType!==Node.ELEMENT_NODE)throw Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var t,n,r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};t=(m=(0,w.Cl)((0,w.Cl)({},r),void 0)).root,n=r,y=t.nodeType===Node.DOCUMENT_NODE?t:t===n.root?t.ownerDocument:t;var i=ta(e,"all",function(){return ta(e,"two",function(){return ta(e,"one",function(){return ta(e,"none")})})});if(i){var s=tm(function e(t,n,r){var i,s,o;return void 0===r&&(r={counter:0,visited:new Map}),(0,w.YH)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>m.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var c,u;if(!(i<t.length-1))return[3,5];if(r.counter>m.maxNumberOfTries||(r.counter+=1,(s=(0,w.fX)([],(0,w.zs)(t),!1)).splice(i,1),o=tu(s),r.visited.has(o)))return[2];if(!(td(s)&&(c=s,u=n,y.querySelector(tu(c))===u)))return[3,4];return[4,s];case 2:return a.sent(),r.visited.set(o,!0),[5,(0,w.Ju)(e(s,n,r))];case 3:a.sent(),a.label=4;case 4:return i++,[3,1];case 5:return[2]}})}(i,e));return s.length>0&&(i=s[0]),tu(i)}throw Error("Selector was not found.")}(I)}catch(t){e.debug("error resolving selector from finder")}var E={left:(C=c.document).scrollingElement?C.scrollingElement.scrollLeft:void 0!==c.pageXOffset?c.pageXOffset:C.documentElement.scrollLeft||(null==C?void 0:C.body)&&(null==(v=ti(C.body))?void 0:v.scrollLeft)||(null==(g=null==C?void 0:C.body)?void 0:g.scrollLeft)||0,top:C.scrollingElement?C.scrollingElement.scrollTop:void 0!==c.pageYOffset?c.pageYOffset:(null==C?void 0:C.documentElement.scrollTop)||(null==C?void 0:C.body)&&(null==(p=ti(C.body))?void 0:p.scrollTop)||(null==(b=null==C?void 0:C.body)?void 0:b.scrollTop)||0},P={x:h+E.left,y:f+E.top,selector:a,viewportHeight:l,viewportWidth:d,pageUrl:G(u.href,o),timestamp:Date.now(),type:"click"},_=i();_&&n.addEvent({sessionId:r,event:{type:"interaction",data:JSON.stringify(P)},deviceId:_})}}}}},tC=function(){function e(e,t){var n=(0,A.m)();n&&n.navigator&&"function"==typeof n.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(n.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var n=new XMLHttpRequest;return n.open("POST",e,!0),n.setRequestHeader("Accept","*/*"),n.send(JSON.stringify(t)),!0},this.basePageUrl=W(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e}return e.prototype.send=function(e,t){var n=this.context,r=n.sessionId,i=n.type,s=new URLSearchParams({device_id:e,session_id:String(r),type:String(i),api_key:this.apiKey}),o="".concat(this.basePageUrl,"?").concat(s.toString());this.sendBeacon(o,t)||this.sendXhr(o,t)},e}(),tI=function(){function e(e,t){var n=this;this.timestamp=Date.now(),this.hook=function(e){n.update(e)},this.send=function(e){return function(t){var r,i,s=e(),o=(0,A.m)();o&&s&&n.transport.send(s,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHe
3ight:ts(),viewportWidth:to(),pageUrl:G(o.location.href,null!=(i=null==(r=n.config.interactionConfig)?void 0:r.ugcFilterRules)?i:[]),timestamp:n.timestamp,type:"scroll"}]})}},this._maxScrollX=0,this._maxScrollY=0,this._maxScrollWidth=to(),this._maxScrollHeight=ts(),this.config=t,this.transport=e}return e.default=function(t,n){return new e(new tC(t,n),n)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(e.x>this._maxScrollX){var n=to();this._maxScrollX=e.x;var r=e.x+n;r>this._maxScrollWidth&&(this._maxScrollWidth=r),this.timestamp=t}if(e.y>this._maxScrollY){var i=ts();this._maxScrollY=e.y;var s=e.y+i;s>this._maxScrollHeight&&(this._maxScrollHeight=s),this.timestamp=t}},e}(),tw=function(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId="".concat(n,"/").concat(t))},tE=new function(){var e=this;this.dbs={},this.createStore=function(t){return(0,w.sH)(e,void 0,void 0,function(){return(0,w.YH)(this,function(e){switch(e.label){case 0:return[4,(0,eQ.P2)(t,1,{upgrade:function(e){e.objectStoreNames.contains("sessionTargetingMatch")||e.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return(0,w.sH)(e,void 0,void 0,function(){var e,n;return(0,w.YH)(this,function(r){switch(r.label){case 0:if(this.dbs&&this.dbs[t])return[2,this.dbs[t]];return e="".concat(t.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(e)];case 1:return n=r.sent(),this.dbs[t]=n,[2,n]}})})},this.getTargetingMatchForSession=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.sessionId;return(0,w.sH)(e,void 0,void 0,function(){var e,t,s,o;return(0,w.YH)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(r)];case 1:return e=a.sent(),t=String(i),[4,e.get("sessionTargetingMatch",t)];case 2:return[2,null==(s=a.sent())?void 0:s.targetingMatch];case 3:return o=a.sent(),n.warn("Failed to get targeting match for session id ".concat(i,": ").concat(o)),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.sessionId,s=t.targetingMatch;return(0,w.sH)(e,void 0,void 0,function(){var e,t,o;return(0,w.YH)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(r)];case 1:return e=a.sent(),t=String(i),[4,e.put("sessionTargetingMatch",{targetingMatch:s,sessionId:t,lastUpdated:Date.now()})];case 2:return[2,a.sent()];case 3:return o=a.sent(),n.warn("Failed to store targeting match for session id ".concat(i,": ").concat(o)),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.currentSessionId;return(0,w.sH)(e,void 0,void 0,function(){var e,t,s,o,a,c,u,l;return(0,w.YH)(this,function(d){switch(d.label){case 0:return d.trys.push([0,8,,9]),[4,this.openOrCreateDB(r)];case 1:return e=d.sent(),t=String(i),[4,(s=e.transaction("sessionTargetingMatch","readwrite")).store.getAll()];case 2:o=d.sent(),a=0,d.label=3;case 3:if(!(a<o.length))return[3,6];if(c=o[a],u=Date.now()-c.lastUpdated,!(c.sessionId!==t&&u>1728e5))return[3,5];return[4,s.store.delete(c.sessionId)];case 4:d.sent(),d.label=5;case 5:return a++,[3,3];case 6:return[4,s.done];case 7:return d.sent(),[3,9];case 8:return l=d.sent(),n.warn("Failed to clear old targeting matches for sessions: ".concat(l)),[3,9];case 9:return[2]}})})}},tP=function(e){var t=e.sessionId,r=e.targetingConfig,i=e.loggerProvider,s=e.apiKey,o=e.targetingParams;return(0,w.sH)(void 0,void 0,void 0,function(){var e,a,c;return(0,w.YH)(this,function(u){switch(u.label){case 0:return[4,tE.clearStoreOfOldSessions({loggerProvider:i,apiKey:s,currentSessionId:t})];case 1:return u.sent(),[4,tE.getTargetingMatchForSession({loggerProvider:i,apiKey:s,sessionId:t})];case 2:if(!0===u.sent())return[2,!0];e=!0,u.label=3;case 3:return u.trys.push([3,6,,7]),[4,n.e("node_modules_amplitude_targeting_lib_esm_index_js").then(n.bind(n,17848))];case 4:return[4,(0,u.sent().evaluateTargeting)((0,w.Cl)((0,w.Cl)({},o),{flag:r,sessionId:t,apiKey:s,loggerProvider:i}))];case 5:return(a=u.sent())&&a.sr_targeting_config&&(e="on"===a.sr_targeting_config.key),tE.storeTargetingMatchForSession({loggerProvider:i,apiKey:s,sessionId:t,targetingMatch:e}),[3,7];case 6:return c=u.sent(),i.warn(c.message),[3,7];case 7:return[2,e]}})})};function t_(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,n,r){var i,s,o,a=(0,w.Cl)((0,w.Cl)({},e),r),c=a.ugcFilterRules||[],u=null!=(i=a.enablePolling)&&i,l=null!=(s=a.pollingInterval)?s:1e3,d=null!=(o=a.captureDocumentTitle)&&o;if(!n)return function(){};var h=void 0,f=function(){return n.location&&n.location.href||""},v=function(){var e=n.innerHeight,t=n.innerWidth,r=n.document,i=f(),s="";return d&&(s=(null==r?void 0:r.title)||""),{href:c.length>
30?G(i,c):i,title:s,viewportHeight:e,viewportWidth:t,type:"url-change-event"}},g=function(){var e=f();(void 0===h||e!==h)&&(h=e,t(v()))},p=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.apply(this,t);return g(),r}},m=function(){g()};if(u){var y=n.setInterval(function(){g()},l);return g(),function(){y&&n.clearInterval(y)}}if(n.history){var S=n.history.pushState.bind(n.history),b=n.history.replaceState.bind(n.history);return n.history.pushState=p(S),n.history.replaceState=p(b),n.addEventListener("popstate",g),n.addEventListener("hashchange",m),g(),function(){n.history.pushState=S,n.history.replaceState=b,n.removeEventListener("popstate",g),n.removeEventListener("hashchange",m)}}return n.addEventListener("hashchange",m),g(),function(){n.removeEventListener("hashchange",m)}},options:e}}t_();var tR=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.recordFunction=null,this.teardownEventListeners=function(t){var n=(0,A.m)();n&&(n.removeEventListener("blur",e.blurListener),n.removeEventListener("focus",e.focusListener),t||n.addEventListener("blur",e.blurListener),t||n.addEventListener("focus",e.focusListener),n.self&&"onpagehide"in n.self?(n.removeEventListener("pagehide",e.pageLeaveListener),t||n.addEventListener("pagehide",e.pageLeaveListener)):(n.removeEventListener("beforeunload",e.pageLeaveListener),t||n.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){e.recordEvents(!1)},this.pageLeaveListener=function(t){e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,n){return void 0===n&&(n=!1),(0,w.sH)(e,void 0,void 0,function(){var e,r;return(0,w.YH)(this,function(i){switch(i.label){case 0:if(!this.identifiers||!this.identifiers.sessionId||!this.config)return this.identifiers&&!this.identifiers.sessionId?this.loggerProvider.log("Session ID has not been set yet, cannot evaluate targeting for Session Replay."):this.loggerProvider.warn("Session replay init has not been called, cannot evaluate targeting."),[2];if(this.lastTargetingParams=t,!(this.config.targetingConfig&&!this.sessionTargetingMatch))return[3,2];return(e=t.event)&&Object.values(E.S).includes(e.event_type)&&(e=void 0),r=this,[4,tP({sessionId:this.identifiers.sessionId,targetingConfig:this.config.targetingConfig,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:e}})];case 1:r.sessionTargetingMatch=i.sent(),this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:e,targetingParams:t},null,2)),i.label=2;case 2:if(!n)return[3,3];return this.initialize(!0),[3,5];case 3:return[4,this.recordEvents()];case 4:i.sent(),i.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r=!0),(0,w.sH)(e,void 0,void 0,function(){var e,i,s,o;return(0,w.YH)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),e=void 0,!((i=this.config)&&t!==f.METADATA)||(e={config:X(i),version:eG},!r))return[3,2];return[4,V()];case 1:s=a.sent(),e=(0,w.Cl)((0,w.Cl)({},s),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,w.Cl)((0,w.Cl)({},n),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return o=a.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",o),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var t;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null==(t=e.networkObservers)||t.stop()}catch(t){e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(t.toString()))}},this.loggerProvider=new F(new R.V)}return e.prototype.init=function(e,t){return(0,ee.m)(this._init(e,t))},e.prototype._init=function(e,t){var n,r,i,s,o,a;return(0,w.sH)(this,void 0,void 0,function(){var c,u,l,d,h,f,v,g,p,m,y,S;return(0,w.YH)(this,function(b){switch(b.label){case 0:return this.loggerProvider=new F(t.loggerProvider||new R.V),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.identifiers=new tw({sessionId:t.sessionId,deviceId:t.deviceId}),c=this,[4,(0,w.sH)(void 0,void 0,void 0,function(){var n;return(0,w.YH)(this,function(r){switch(r.label){case 0:return[4,ec({localConfig:n=new Z(e,t),configKeys:["sessionReplay"]})];case 1:return[2,new el(r.sent(),n)]}})})];case 1:return c.joinedConfigGenerator=b.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig(this.identifiers.sessionId)];case 2:l=(u=b.sent()).joinedConfig,d=u.localConfig,h=u.remoteConfig,this.config=l,this.setMetadata(t.sessionId,l,d,h,null==(n=t.version)?void 0:n.version,eG,null==(r=t.version)?void 0:r.type),t.sessionId&&(null==(i=this.config.interactionConfig)?void 0:i.enabled)&&(f=tI.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[f.send(this.getDeviceId.bind(this)).bind(f)],this.scrollHook=f.hook.bind(f)),v=[],"idb"!==(g=this.config.storeType)||(null==(s=(0,A.m)())?void 0:s.indexedDB)||(g="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(g," for event storage.")),b.label=3;case 3:return b.trys.push([3,5,,6]),[4,e8({config:this.config,sessionId:this.identifiers.sessionId,type:"replay",storeType:g})];case 4:return p=b.sent(),v.push({name:"replay",manager:p}),[3,6];case 5:return m=b.sent(),this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(m.toString())),[3,6];case 6:if(!(null==(o=this.config.interactionConfig)?void 0:o.enabled))return[3,10];y=this.config.interactionConfig.batch?tS:ty,b.label=7;case 7:return b.trys.push([7,9,,10]),[4,e8({config:this.config,sessionId:this.identifiers.sessionId,type:"interaction",minInterval:null!=(a=this.config.interactionConfig.trackEveryNms)?a:3e4,maxInterval:6e4,payloadBatcher:y,storeType:g})];case 8:return S=b.sent(),v.push({name:"interaction",manager:S}),[3,10];case 9:return m=b.sent(),this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(m.toString())),[3,10];case 10:return this.eventsManager=new(e7.bind.apply(e7,(0,w.fX)([void 0],(0,w.zs)(v),
3!1))),this.eventCompressor&&this.eventCompressor.terminate(),this.eventCompressor=new eW(this.eventsManager,this.config,this.getDeviceId()),[4,this.initializeNetworkObservers()];case 11:return b.sent(),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:t.userProperties},!0)];case 12:return b.sent(),[2]}})})},e.prototype.setSessionId=function(e,t){return(0,ee.m)(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,n){return(0,w.sH)(this,void 0,void 0,function(){var r,i,s;return(0,w.YH)(this,function(o){switch(o.label){case 0:if(this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,(r=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(r),i=t||this.getDeviceId(),this.identifiers=new tw({sessionId:e,deviceId:i}),!(this.joinedConfigGenerator&&r))return[3,2];return[4,this.joinedConfigGenerator.generateJoinedConfig(this.identifiers.sessionId)];case 1:s=o.sent().joinedConfig,this.config=s,o.label=2;case 2:return[4,this.evaluateTargetingAndCapture({userProperties:null==n?void 0:n.userProperties})];case 3:return o.sent(),[2]}})})},e.prototype.getSessionReplayProperties=function(){var e,t=this.config,n=this.identifiers;if(!t||!n)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var r=this.getShouldRecord(),i={};return r&&((e={})[D]=n.sessionReplayId?n.sessionReplayId:null,i=e,t.debugMode&&(i[q]=JSON.stringify({appHash:K(t.apiKey).toString()}))),this.addCustomRRWebEvent(f.GET_SR_PROPS,{shouldRecord:r,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},e.prototype.sendEvents=function(e){var t,n=e||(null==(t=this.identifiers)?void 0:t.sessionId),r=this.getDeviceId();this.eventsManager&&n&&r&&this.eventsManager.sendCurrentSequenceEvents({sessionId:n,deviceId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),(0,w.sH)(this,void 0,void 0,function(){var n;return(0,w.YH)(this,function(r){return(null==(t=this.identifiers)?void 0:t.sessionId)?(n=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:n}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()]):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])})})},e.prototype.shouldOptOut=function(){if(null==(e=this.config)?void 0:e.instanceName){var e,t,n;n=(0,et.w$)(this.config.instanceName).identityStore.getIdentity().optOut}return void 0!==n?n:null==(t=this.config)?void 0:t.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e,t,n=!1,r="",i=!1;return this.config.targetingConfig?this.sessionTargetingMatch?(r="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(r),n=!0,i=!0):(r="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(r),n=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,31*Math.abs(K(e.toString()))%1e6/1e6<t)?(n=!0,i=!0):(r="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(r),n=!1,i=!1),this.lastShouldRecordDecision!==n&&this.config.targetingConfig&&(this.addCustomRRWebEvent(f.TARGETING_DECISION,{message:r,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=n),n},e.prototype.getBlockSelectors=function(){var e,t,n,r=null!=(n=null==(t=null==(e=this.config)?void 0:e.privacyConfig)?void 0:t.blockSelector)?n:[];if(0!==r.length)return r},e.prototype.getMaskTextSelectors=function(){if((null==(t=null==(e=this.config)?void 0:e.privacyConfig)?void 0:t.defaultMaskLevel)==="conservative")return"*";var e,t,n,r,i=null==(r=null==(n=this.config)?void 0:n.privacyConfig)?void 0:r.maskSelector;if(i)return i},e.prototype.getRecordingPlugins=function(e){var t,r,i,s,o,a;return(0,w.sH)(this,void 0,void 0,function(){var c,u,l,d;return(0,w.YH)(this,function(h){switch(h.label){case 0:c=[];try{u=t_({ugcFilterRules:(null==(r=null==(t=this.config)?void 0:t.interactionConfig)?void 0:r.ugcFilterRules)||[],enablePolling:(null==(i=this.config)?void 0:i.enableUrlChangePolling)||!1,pollingInterval:null==(s=this.config)?void 0:s.urlChangePollingInterval,captureDocumentTitle:null==(o=this.config)?void 0:o.captureDocumentTitle}),c.push(u)}catch(e){this.loggerProvider.warn("Failed to create URL tracking plugin:",e)}if(!(null==(a=null==e?void 0:e.console)?void 0:a.enabled))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,n.e("node_modules_amplitude_rrweb-plugin-console-record_dist_rrweb-plugin-console-record_js").then(n.bind(n,82923))];case 2:return l=h.sent().getRecordConsolePlugin,c.push(l({level:e.console.levels})),[3,4];case 3:return d=h.sent(),this.loggerProvider.warn("Failed to load console plugin:",d),[3,4];case 4:return[2,c.length>0?c:void 0]}})})},e.prototype.getRecordFunction=function(){return(0,w.sH)(this,void 0,void 0,function(){var e,t;return(0,w.YH)(this,function(r){switch(r.label){case 0:if(this.recordFunction)return[2,this.recordFunction];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n.e("node_modules_amplitude_rrweb-record_dist_rrweb-record_js").then(n.bind(n,53123))];case 2:return e=r.sent().record,this.recordFunction=e,[2,e];case 3:return t=r.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",t),[2,null];case 4:return[2]}})})},e.prototype.recordEvents=function(e){var t,n,r,i,s;return void 0===e&&(e=!0),(0,w.sH)(this,void 0,void 0,function(){var o,a,c,u,l,d,h,v,g,p,m,y,S,b=this;return(0,w.YH)(this,function(C){switch(C.label){case 0:if(o=this.config,a=this.getShouldRecord(),c=null==(t=this.identifiers)?void 0:t.sessionId,!a||!c||!o)return[2];return this.stopRecordingEvents(),[4,this.getRecordFunction()];case 1:if(!(u=C.sent()))return[2];return[4,this.initializeNetworkObservers()];case 2:C.sent(),null==(n=this.networkObservers)||n.start(function(e){b.addCustomRRWebEvent(f.FETCH_REQUEST,e)}),l=o.privacyConfig,d=o.interactionConfig,h=o.loggingConfig,v=(null==d?void 0:d.enabled)?{mouseInteraction:this.eventsManager&&tb(this.loggerProvider,{eventsManager:this.eventsManager,sessionId:c,deviceIdFn:this.getDeviceId.bind(this),mirror:u.mirror,ugcFilterRules:null!=(r=d.ugcFilterRules)?r:[]}),scroll:this.scrollHook}:{},g=(null==d?void 0:d.enabled)&&d.ugcFilterRules?d.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(c,".")),C.label=3;case 3:return C.trys.push([3,5,,6]),p=this,m=u,S={emit:function(e){if(b.shouldOptOut()){b.loggerProvider.log("Opting session ".concat(c," out of recording due to optOut config.")),b.stopRecordingEvents(),b.sendEvents();return}e.type===en.Meta&&(e.data.href=G(e.data.href,g)),b.eventCompressor&&b.eventCompressor.enqueueEvent(e,c)},inlineStylesheet:o.shouldInlineStylesheet,hooks:v,maskAllInputs:!0,maskTextClass:N,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroun
3dColorToBlockedElements:o.applyBackgroundColorToBlockedElements,maskInputFn:j("input",l),maskTextFn:j("text",l),maskTextSelector:this.getMaskTextSelectors(),recordCanvas:!1,slimDOMOptions:{script:null==(i=o.omitElementTags)?void 0:i.script,comment:null==(s=o.omitElementTags)?void 0:s.comment},errorHandler:function(e){if(e.message.includes("insertRule")&&e.message.includes("CSSStyleSheet")||e._external_)throw e;return b.loggerProvider.warn("Error while capturing replay: ",e.toString()),!0}},[4,this.getRecordingPlugins(h)];case 4:return p.recordCancelCallback=m.apply(void 0,[(S.plugins=C.sent(),S)]),this.addCustomRRWebEvent(f.DEBUG_INFO),e&&this.addCustomRRWebEvent(f.METADATA,this.metadata),[3,6];case 5:return y=C.sent(),this.loggerProvider.warn("Failed to initialize session replay:",y),[3,6];case 6:return[2]}})})},e.prototype.getDeviceId=function(){var e;return null==(e=this.identifiers)?void 0:e.deviceId},e.prototype.getSessionId=function(){var e;return null==(e=this.identifiers)?void 0:e.sessionId},e.prototype.flush=function(e){var t;return void 0===e&&(e=!1),(0,w.sH)(this,void 0,void 0,function(){return(0,w.YH)(this,function(n){return[2,null==(t=this.eventsManager)?void 0:t.flush(e)]})})},e.prototype.shutdown=function(){this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},e.prototype.mapSDKType=function(e){return"plugin"===e?"@amplitude/plugin-session-replay-browser":"segment"===e?"@amplitude/segment-session-replay-plugin":null},e.prototype.setMetadata=function(e,t,n,r,i,s,o){var a=(null==e?void 0:e.toString())?K(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:n,remoteConfig:r,sessionId:e,hashValue:a,sampleRate:t.sampleRate,replaySDKType:this.mapSDKType(o),replaySDKVersion:i,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:s}},e.prototype.initializeNetworkObservers=function(){var e,t,r;return(0,w.sH)(this,void 0,void 0,function(){var i,s;return(0,w.YH)(this,function(o){switch(o.label){case 0:if(!((null==(r=null==(t=null==(e=this.config)?void 0:e.loggingConfig)?void 0:t.network)?void 0:r.enabled)&&!this.networkObservers))return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.e("node_modules_amplitude_session-replay-browser_lib_esm_observers_js").then(n.bind(n,23087))];case 2:return i=o.sent().NetworkObservers,this.networkObservers=new i,[3,4];case 3:return s=o.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",s),[3,4];case 4:return[2]}})})},e}(),tT=function(e){return function(){var t=e.config||Q();return{logger:t.loggerProvider,logLevel:t.logLevel}}};let tk=(u=new tR,{init:(0,P.nA)(u.init.bind(u),"init",tT(u)),evaluateTargetingAndCapture:(0,P.nA)(u.evaluateTargetingAndCapture.bind(u),"evaluateTargetingAndRecord",tT(u)),setSessionId:(0,P.nA)(u.setSessionId.bind(u),"setSessionId",tT(u)),getSessionId:(0,P.nA)(u.getSessionId.bind(u),"getSessionId",tT(u)),getSessionReplayProperties:(0,P.nA)(u.getSessionReplayProperties.bind(u),"getSessionReplayProperties",tT(u)),flush:(0,P.nA)(u.flush.bind(u),"flush",tT(u)),shutdown:(0,P.nA)(u.shutdown.bind(u),"shutdown",tT(u))});var tx=tk.init,tH=tk.setSessionId,tM=tk.getSessionId,tD=tk.getSessionReplayProperties,tO=tk.flush,tL=tk.shutdown,tq=tk.evaluateTargetingAndCapture,tN=n(68697);(l=b||(b={})).SET="$set",l.SET_ONCE="$setOnce",l.ADD="$add",l.APPEND="$append",l.PREPEND="$prepend",l.REMOVE="$remove",l.PREINSERT="$preInsert",l.POSTINSERT="$postInsert",l.UNSET="$unset",l.CLEAR_ALL="$clearAll",(d=C||(C={})).REVENUE_PRODUCT_ID="$productId",d.REVENUE_QUANTITY="$quantity",d.REVENUE_PRICE="$price",d.REVENUE_TYPE="$revenueType",d.REVENUE_CURRENCY="$currency",d.REVENUE="$revenue",(h=I||(I={})).IDENTIFY="$identify",h.GROUP_IDENTIFY="$groupidentify",h.REVENUE="revenue_amount";var tF=[b.SET,b.SET_ONCE,b.ADD,b.APPEND,b.PREPEND,b.POSTINSERT],tA=function(e){if(e.user_properties){var t={};return Object.keys(e.user_properties).forEach(function(n){if(tF.includes(n)){var r=e.user_properties&&e.user_properties[n];t=(0,w.Cl)((0,w.Cl)({},t),r)}}),t}},tU="1.22.4",tY=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.sessionReplay={flush:tO,getSessionId:tM,get
3SessionReplayProperties:tD,init:tx,setSessionId:tH,shutdown:tL,evaluateTargetingAndCapture:tq},this.options=(0,w.Cl)({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var n,r,i,s,o;return(0,w.sH)(this,void 0,void 0,function(){var t,a;return(0,w.YH)(this,function(c){switch(c.label){case 0:var u;return c.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(tU,".")),this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=(0,w.Cl)((0,w.Cl)({},e.defaultTracking),{sessions:!0})),t=(void 0===(u=this.config.instanceName)&&(u="$default_instance"),tN.i.getInstance(u)).identityStore.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!=(n=this.options.deviceId)?n:this.config.deviceId,optOut:this.config.optOut,sessionId:this.options.customSessionId?void 0:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,configServerUrl:this.options.configServerUrl,trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null==(r=this.options.privacyConfig)?void 0:r.blockSelector,maskSelector:null==(i=this.options.privacyConfig)?void 0:i.maskSelector,unmaskSelector:null==(s=this.options.privacyConfig)?void 0:s.unmaskSelector,defaultMaskLevel:null==(o=this.options.privacyConfig)?void 0:o.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,version:{type:"plugin",version:tU},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,experimental:this.options.experimental,userProperties:t,omitElementTags:this.options.omitElementTags,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return c.sent(),[3,3];case 2:return a=c.sent(),null==e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(a.message)),[3,3];case 3:return[2]}})})},e.prototype.onSessionIdChanged=function(e){return(0,w.sH)(this,void 0,void 0,function(){return(0,w.YH)(this,function(t){switch(t.label){case 0:return this.config.loggerProvider.debug("Analytics session id is changed to ".concat(e,", SR session id is ").concat(String(this.sessionReplay.getSessionId()),".")),[4,this.sessionReplay.setSessionId(e).promise];case 1:return t.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){return(0,w.sH)(this,void 0,void 0,function(){return(0,w.YH)(this,function(t){switch(t.label){case 0:if(this.config.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),!e)return[3,1];return this.sessionReplay.shutdown(),[3,3];case 1:return[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise];case 2:t.sent(),t.label=3;case 3:return[2]}})})},e.prototype.execute=function(e){var t;return(0,w.sH)(this,void 0,void 0,function(){var n,r,i,s;return(0,w.YH)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,9,,10]),!this.options.customSessionId)return[3,4];if(!(n=this.options.customSessionId(e)))return[3,3];if(n===this.sessionReplay.getSessionId())return[3,2];return[4,this.sessionReplay.setSessionId(n).promise];case 1:o.sent(),o.label=2;case 2:r=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,w.Cl)((0,w.Cl)({},e.event_properties),r),o.label=3;case 3:return[3,8];case 4:if(!((n=this.config.sessionId)&&n!==this.sessionReplay.getSessionId()))return[3,6];return[4,this.sessionReplay.setSessionId(n).promise];case 5:o.sent(),o.label=6;case 6:if(!(n&&n===e.session_id))return[3,8];return i=void 0,e.event_type===E.S.IDENTIFY&&(i=tA(e)),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:i})];case 7:o.sent(),r=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,w.Cl)((0,w.Cl)({},e.event_properties),r),o.label=8;case 8:return[2,Promise.resolve(e)];case 9:return s=o.sent(),null==(t=this.config)||t.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(s.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return(0,w.sH)(this,void 0,void 0,function(){return(0,w.YH)(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){null==(e=this.config)||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(t.message))}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.pluginName="@amplitude/plugin-session-replay-browser",e}(),tB=function(e){return new tY(e)}},60602(e,t,n){let r,i,s,o,a=(e,t)=>t.some(t=>e instanceof t),c=new WeakMap,u=new WeakMap,l=new WeakMap,d={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return c.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return h(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function h(e){if(e instanceof IDBRequest){let t;return t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(h(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)}),l.set(t,e),t}if(u.has(e))return u.get(e);let t=function(e){if("function"==typeof e)return(o||(o=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(f(this),t),h(this.request)}:function(...t){return h(e.apply(f(this),t))};return(e instanceof IDBTransaction&&function(e){if(c.has(e))return;let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});c.set(e,t)}(e),a(e,s||(s=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(e,d):e}(e);return t!==e&&(u.set(e,t),l.set(t,e)),t}let f=e=>l.get(e);function v(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let o=indexedDB.open(e,t),a=h(o);return r&&o.addEventListener("upgradeneeded",e=>{r(h(o.result),e.oldVersion,e.newVersion,h(o.transaction),e)}),n&&o.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}let g=["get","getKey","getAll","getAllKeys","count"],p=["put","add","delete","clear"],m=new Map;function y(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(m.get(t))return m.get(t);let n=t.replace(/FromIndex$/,""),r=t!==n,i=p.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||g.includes(n)))return;let s=async function(e,...t){let s=this.transaction(e,i?"readwrite":"readonly"),o=s.store;
3return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&s.done]))[0]};return m.set(t,s),s}d={...r=d,get:(e,t,n)=>y(e,t)||r.get(e,t,n),has:(e,t)=>!!y(e,t)||r.has(e,t)};let S=["continue","continuePrimaryKey","advance"],b={},C=new WeakMap,I=new WeakMap,w={get(e,t){if(!S.includes(t))return e[t];let n=b[t];return n||(n=b[t]=function(...e){C.set(this,I.get(this)[t](...e))}),n}};async function*E(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;let n=new Proxy(t,w);for(I.set(n,t),l.set(n,f(t));t;)yield n,t=await (C.get(n)||t.continue()),C.delete(n)}function P(e,t){return t===Symbol.asyncIterator&&a(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&a(e,[IDBIndex,IDBObjectStore])}d={...i=d,get:(e,t,n)=>P(e,t)?E:i.get(e,t,n),has:(e,t)=>P(e,t)||i.has(e,t)},n.d(t,{P2:()=>v})}}]); 4//# sourceMappingURL=node_modules_amplitude_plugin-session-replay-browser_lib_esm_index_js.f55fbd83c3443463.js.map 5//# debugId=c91ca174-f6fe-515f-8287-499571d6317a
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.