1/*! License information can be found in LICENSE and LICENSE-THIRD-PARTY */ 2(()=>{"use strict";var e={821(e){function t(e){return"function"==typeof e}var n=console.error.bind(console);function r(e,t,n){var r=!!e[t]&&e.propertyIsEnumerable(t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function i(e){e&&e.logger&&(t(e.logger)?n=e.logger:n("new logger isn't a function, not replacing"))}function s(e,i,s){if(e&&e[i]){if(!s)return n("no wrapper function"),void n((new Error).stack);if(t(e[i])&&t(s)){var o=e[i],a=s(o,i);return r(a,"__original",o),r(a,"__unwrap",function(){e[i]===a&&r(e,i,o)}),r(a,"__wrapped",!0),r(e,i,a),a}n("original object and wrapper must be functions")}else n("no original function "+i+" to wrap")}function o(e,t){return e&&e[t]?e[t].__unwrap?e[t].__unwrap():void n("no original to unwrap to -- has "+t+" already been unwrapped?"):(n("no function to unwrap."),void n((new Error).stack))}i.wrap=s,i.massWrap=function(e,t,r){if(!e)return n("must provide one or more modules to patch"),void n((new Error).stack);Array.isArray(e)||(e=[e]),t&&Array.isArray(t)?e.forEach(function(e){t.forEach(function(t){s(e,t,r)})}):n("must provide one or more functions to wrap on modules")},i.unwrap=o,i.massUnwrap=function(e,t){if(!e)return n("must provide one or more modules to patch"),void n((new Error).stack);Array.isArray(e)||(e=[e]),t&&Array.isArray(t)?e.forEach(function(e){t.forEach(function(t){o(e,t)})}):n("must provide one or more functions to unwrap on modules")},e.exports=i}},t={};const n="cwr_c",r="cwr_i",i="cwr_s",s="cwr_u",o="arw-script",a="[aws-rum-web:unknown.unknown]";class c{static configure(e){c.debugEnabled=e}static getCallerInfo(){var e,t;try{const n=(new Error).stack;if(!n)return a;const r=n.split("\n");if(r.length<4)return a;const i=r[3];if(!i)return a;const s=i.match(/at (?:(.+?)\s+\()?/);if(s&&s.length>=2){const n=s[1].trim(),r=n.split(".");if(r.length>=2){const n=null!==(e=r[r.length-2])&&void 0!==e?e:"unknown";return`[aws-rum-web:${n}.${null!==(t=r[r.length-1])&&void 0!==t?t:"unknown"}]`}return`[aws-rum-web:${n}]`}}catch(e){}return a}static info(e,...t){if(!c.debugEnabled)return;const n=this.getCallerInfo();console.info(n,e,...t)}static debug(e,...t){if(!c.debugEnabled)return;const n=this.getCallerInfo();console.debug(n,e,...t)}static warn(e,...t){if(!c.debugEnabled)return;const n=this.getCallerInfo();console.warn(n,e,...t)}static error(e,...t){if(!c.debugEnabled)return;const n=this.getCallerInfo();console.error(n,e,...t)}}var d;c.debugEnabled=!1,function(e){e.EVENT="event"}(d||(d={}));class l{constructor(){this.subscribers=new Map}subscribe(e,t){var n;const r=null!==(n=this.subscribers.get(e))&&void 0!==n?n:[];r.length||this.subscribers.set(e,r),r.push(t)}unsubscribe(e,t){const n=this.subscribers.get(e);if(n)for(let e=0;e<n.length;e++)if(n[e]===t)return n.splice(e,1),!0;return!1}dispatch(e,t){const n=this.subscribers.get(e);if(n)for(const e of n)e(t)}}const u=(e,t,n,r,i)=>{let s=e+"=";s+=t||"",void 0!==i?s+=`; Expires=${i.toUTCString()}`:void 0!==r&&(s+=`; Expires=${h(r).toUTCString()}`),s+=`; Domain=${n.domain}`,s+=`; Path=${n.path}`,s+=`; SameSite=${n.sameSite}`,s+=n.secure?"; Secure":"",document.cookie=s},h=e=>new Date((new Date).getTime()+1e3*e),g=e=>{const t=document.cookie.split("; ");for(const n of t){const t=n.split("=");if(t[0]===e)return t[1]}return""},p={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let m;const f=new Uint8Array(16);function v(){if(!m&&(m="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!m))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(f)}const y=[];for(let e=0;e<256;++e)y.push((e+256).toString(16).slice(1));function b(e,t=0){return y[e[t+0]]+y[e[t+1]]+y[e[t+2]]+y[e[t+3]]+"-"+y[e[t+4]]+y[e[t+5]]+"-"+y[e[t+6]]+y[e[t+7]]+"-"+y[e[t+8]]+y[e[t+9]]+"-"+y[e[t+10]]+y[e[t+11]]+y[e[t+12]]+y[e[t+13]]+y[e[t+14]]+y[e[t+15]]}const I=function(e,t,n){if(p.randomUUID&&!t&&!e)return p.randomUUID();const r=(e=e||{}).random||(e.rng||v)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return b(r)};var C;
2!function(e){e.Path="PATH",e.Hash="HASH",e.PathAndHash="PATH_AND_HASH"}(C||(C={}));const S="com.amazon.rum",w=`${S}.http_event`,A=`${S}.xray_trace_event`,E=`${S}.largest_contentful_paint_event`,T=`${S}.first_input_delay_event`,k=`${S}.cumulative_layout_shift_event`,R=`${S}.interaction_to_next_paint_event`,M=`${S}.first_contentful_paint_event`,L=`${S}.time_to_first_byte_event`,O=`${S}.performance_navigation_event`,x=`${S}.performance_resource_event`,D=`${S}.dom_event`,N=`${S}.js_error_event`,P=`${S}.page_view_event`,F=`${S}.session_start_event`,U=`${S}.rrweb_event`,B="00000000-0000-0000-0000-000000000000";class W{constructor(e,t,n,r){this.isSessionIdManual=!1,this.isUserIdManual=!1,this.appMonitorDetails=e,this.config=t,this.recordEvent=n,this.pageManager=r,this.sessionCookieName=this.config.cookieAttributes.unique?`${i}_${this.appMonitorDetails.id}`:i,this.session={sessionId:B,record:this.sample(),eventCount:0},this.config.userId||this.initializeUser(),this.collectAttributes(),this.addSessionAttributes(this.config.sessionAttributes),this.getSessionFromCookie(),this.config.userId&&(this.isUserIdManual=!0,this.adoptUser(this.config.userId)),this.config.sessionId&&(this.isSessionIdManual=!0,this.adoptSession(this.config.sessionId))}isSampled(){return this.session.record}getSession(){return this.isSessionIdManual?(new Date>=this.sessionExpiry&&(this.session.eventCount=0,this.session.page=this.pageManager.getPage(),this.sessionExpiry=new Date((new Date).getTime()+1e3*this.config.sessionLengthSeconds),this.storeSessionAsCookie()),this.session):((this.session.sessionId===B||new Date>=this.sessionExpiry)&&this.createSession(),this.session)}getAttributes(){return this.attributes}addSessionAttributes(e){this.attributes=Object.assign(Object.assign({},this.attributes),e)}pinSessionId(e){e?(this.isSessionIdManual=!0,e!==this.session.sessionId&&this.adoptSession(e)):c.warn("pinSessionId called with empty value; ignoring.")}startSession(e){return void 0!==(null==e?void 0:e.userId)&&(e.userId?(this.isUserIdManual=!0,e.userId!==this.userId&&this.adoptUser(e.userId)):c.warn("startSession called with empty userId; ignoring user rotation.")),void 0!==(null==e?void 0:e.sessionId)?e.sessionId?(this.isSessionIdManual=!0,this.adoptSession(e.sessionId),this.config.suppressSessionStartEvent||this.recordEvent(F,{version:"1.0.0"})):(c.warn("startSession called with empty sessionId; minting a fresh session."),this.isSessionIdManual=!1,this.createSession()):(this.isSessionIdManual=!1,this.createSession()),this.session.sessionId}getUserId(){return this.isUserIdManual||this.useCookies()?this.userId:B}pinUserId(e){e?(this.isUserIdManual=!0,e!==this.userId&&this.adoptUser(e)):c.warn("pinUserId called with empty value; ignoring.")}incrementSessionEventCount(){this.session.eventCount++,this.renewSession()}isLimitExceeded(){return this.session.eventCount>=this.config.sessionEventLimit&&this.config.sessionEventLimit>0}canRecord(){return this.session.record&&!this.isLimitExceeded()}initializeUser(){let e="";this.userExpiry=new Date,this.userExpiry.setDate(this.userExpiry.getDate()+this.config.userIdRetentionDays),this.config.userIdRetentionDays<=0?this.userId="00000000-0000-0000-0000-000000000000":this.useCookies()?(e=this.getUserIdCookie(),this.userId=e||I(),this.createOrRenewUserCookie(e,this.userExpiry)):this.userId=I()}createOrRenewSessionCookie(e,t){btoa&&u(this.sessionCookieName,btoa(JSON.stringify(e)),this.config.cookieAttributes,void 0,t)}createOrRenewUserCookie(e,t){u(s,e,this.config.cookieAttributes,void 0,t)}getUserIdCookie(){return g(s)}getSessionFromCookie(){if(this.useCookies()){const e=g(this.sessionCookieName);if(e&&atob)try{this.session=JSON.parse(atob(e)),this.pageManager.resumeSession(this.session.page),c.info(`Restored session: ${this.session.sessionId}`)}catch(e){c.error("Failed to restore session",e)}}}storeSessionAsCookie(){this.useCookies()&&this.config.userIdRetentionDays>0&&this.createOrRenewUserCookie(this.userId,this.userExpiry),this.useCookies()&&this.createOrRenewSessionCookie(this.session,this.sessionExpiry)}createSession(){this.session={sessionId:I(),record:this.session.sessionId===B?this.session.record:this.sample(),eventCount:0},this.session.page=this.pageManager.getPage(),this.sessionExpiry=new Date((new Date).getTime()+1e3*this.config.sessionLengthSeconds),this.storeSessionAsCookie(),c.info(`Session start: ${this.session.sessionId}`),this.session.record||c.warn(`Session is NOT sampled. Consider increasing sessionSampleRate to avoid data loss (currently ${this.config.sessionSampleRate})`),this.config.suppressSessionStartEvent||this.recordEvent(F,{version:"1.0.0"})}adoptSession(e){this.session={sessionId:e,record:this.session.record,eventCount:0},this.session.page=this.pageManager.getPage(),this.sessionExpiry=new Date((new Date).getTime()+1e3*this.config.sessionLengthSeconds),this.storeSessionAsCookie(),c.info(`Adopted session: ${e}`)}adoptUser(e){this.userId=e,this.userExpiry=new Date,this.userExpiry.setDate(this.userExpiry.getDate()+this.config.userIdRetentionDays),this.useCookies()&&this.config.userIdRetentionDays>0&&this.createOrRenewUserCookie(this.userId,this.userExpiry),c.info(`Adopted user: ${e}`)}renewSession(){this.sessionExpiry=new Date((new Date).getTime()+1e3*this.config.sessionLengthSeconds),this.session.page=this.pageManager.getPage(),this.storeSessionAsCookie()}collectAttributes(){var e;const t=(()=>{var e,t;const n=navigator.userAgentData;if(!n)return;const r=null!==(e=n.brands)&&void 0!==e?e:[],i=null!==(t=r.find(e=>"Chromium"!==e.brand&&!e.brand.startsWith("Not")))&&void 0!==t?t:r[0];return{browserName:null==i?void 0:i.brand,browserVersion:null==i?void 0:i.version,osName:n.platform,deviceType:n.mobile?"mobile":"desktop"}})();this.attributes={browserLanguage:navigator.language,browserName:null==t?void 0:t.browserName,browserVersion:null==t?void 0:t.browserVersion,osName:null==t?void 0:t.osName,osVersion:null==t?void 0:t.osVersion,deviceType:null!==(e=null==t?void 0:t.deviceType)&&void 0!==e?e:"desktop",platformType:"web",domain:window.location.hostname,"aws:releaseId":this.config.releaseId},t||(this.attributes["aws:userAgent"]=navigator.userAgent)}useCookies(){return navigator.cookieEnabled&&this.config.allowCookies}sample(){return Math.random()<this.config.sessionSampleRate}}class H{constructor(e,t){this.config=e,this.record=t,this.page=void 0,this.resumed=!1,this.recordInteraction=!1}getPage(){return this.page}getAttributes(){return this.attributes}resumeSession(e){this.recordInteraction=!0,e&&(this.page=e,this.resumed=!0)}recordPageView(e){let t;if(t="string"==typeof e?e:e.pageId,c.debug(`recordPageView called with pageId: ${t}`),this.useCookies()&&(this.recordInteraction=!0),this.page){if(this.page.pageId===t)return this.resumed?(c.info(`Resumed session for page: ${t}`),void this.collectAttributes(this.page,"object"==typeof e?e:void 0)):void c.debug(`No page change detected for: ${t}`);this.createNextPage(this.page,t),c.debug(`Navigation to new page: ${t}`)}else this.createLandingPage(t),c.info(`Landing page created: ${t}`);this.collectAttributes(this.page,"object"==typeof e?e:void 0),this.recordPageViewEvent(this.page)}createNextPage(e,t){const n=Date.now();c.debug(`Creating next page ${t}, interaction: ${e.interaction+1}`),this.timeOnParentPage=n-e.start,this.resumed=!1,this.page={pageId:t,parentPageId:e.pageId,interaction:e.interaction+1,referrer:document.referrer,referrerDomain:this.getDomainFromReferrer(),start:n}}createLandingPage(e){this.page={pageId:e,interaction:0,referrer:document.referrer,referrerDomain:this.getDomainFromReferrer(),start:Date.now()}}collectAttributes(e,t){var n;this.attributes={title:(null===(n=null==t?void 0:t.pageAttributes)||void 0===n?void 0:n.title)?t.pageAttributes.title:document.title,pageId:e.pageId},this.recordInteraction&&(this.attributes.interaction=e.interaction,void 0!==e.parentPageId&&(this.attributes.parentPageId=e.parentPageId)),(null==t?void 0:t.pageTags)&&(this.attributes.pageTags=t.pageTags),(null==t?void 0:t.pageAttributes)&&(this.attributes=Object.assign(Object.assign({},t.pageAttributes),this.attributes))}createPageViewEvent(e){const t={version:"1.0.0",pageId:e.pageId};return this.recordInteraction&&(t.interaction=e.interaction,t.pageInteractionId=e.pageId+"-"+e.interaction,void 0!==e.parentPageId&&(t.parentPageInteractionId=e.parentPageId+"-"+(e.interaction-1),t.timeOnParentPage=this.timeOnParentPage),t.referrer=document.referrer,t.referrerDomain=this.getDomainFromReferrer()),t}recordPageViewEvent(e){this.record(P,this.createPageViewEvent(e))}useCookies(){return navigator.cookieEnabled&&this.config.allowCookies}getDomainFromReferrer(){try{return new URL(document.referrer).hostname}catch(e){return"localhost"===document.referrer?document.referrer:""}}}const j=new Set(["pageId","parentPageId","interaction","pageTags","title"]),V=(e,t)=>{if(!e)return{};const n={};for(const[r,i]of Object.entries(e)){if(r.startsWith("aws:")){c.warn(`Dropping ${t} metadata key "${r}": "aws:" namespace is reserved.`);continue}if(("event"===t||"hook"===t)&&j.has(r)){c.warn(`Dropping ${t} metadata key "${r}": owned by page state.`);continue}const e=typeof i;"string"===e||"number"===e||"boolean"===e?n[r]=i:c.warn(`Dropping ${t} metadata key "${r}": value must be string|number|boolean.`)}return n};class _{constructor(e,t,n=new l){this.eventBus=n,this.events=[],this.candidates=new Map,this.droppedEvent=0,this.sessionLimitExceeded=0,this.recordPageView=e=>{this.isCurrentUrlAllowed()&&this.pageManager.recordPageView(e)}
2,this.recordEvent=(e,t,n)=>{this.enabled&&this.isCurrentUrlAllowed()&&(e!==F&&this.sessionManager.getSession(),this.sessionManager.canRecord()?(this.sessionManager.incrementSessionEventCount(),this.addRecordToCache(e,t,n)):this.sessionLimitExceeded++)},this.recordCandidate=(e,t,n)=>{const r=this.sessionManager.getSession();if(!this.enabled||!this.isCurrentUrlAllowed()||!r.record)return;const[i]=this.createEvent(e,t,n);this.candidates.has(e)?this.candidates.set(e,i):this.candidates.size<this.config.candidatesCacheSize&&!this.sessionManager.isLimitExceeded()&&(this.candidates.set(e,i),this.sessionManager.incrementSessionEventCount())},this.getSession=()=>{if(this.isCurrentUrlAllowed())return this.sessionManager.getSession()},this.getSessionId=()=>this.sessionManager.getSession().sessionId,this.pinSessionId=e=>{this.sessionManager.pinSessionId(e)},this.startSession=e=>this.sessionManager.startSession(e),this.getUserId=()=>this.sessionManager.getUserId(),this.pinUserId=e=>{this.sessionManager.pinUserId(e)},this.addRecordToCache=(e,t,n)=>{if(!this.enabled)return;if(this.events.length>=this.config.eventCacheSize)return void(this.droppedEvent+=1);const[r,i]=this.createEvent(e,t,n);this.eventBus.dispatch(d.EVENT,i),this.events.push(r)},this.createEvent=(e,t,n)=>{var r;const i=null!==(r=this.pageManager.getAttributes())&&void 0!==r?r:{},s=V(n,"event");let o={};if(this.eventMetadataHook)try{const n=Object.freeze(Object.assign({},i)),r=this.eventMetadataHook(e,t,n);r&&(o=V(r,"hook"))}catch(t){c.warn(`eventMetadataHook threw for type "${e}"; dropping hook output for this event.`,t)}const a=Object.assign(Object.assign(Object.assign({},i),o),s),d={id:I(),timestamp:new Date,type:e};return[Object.assign(Object.assign({},d),{details:JSON.stringify(t),metadata:JSON.stringify(a)}),Object.assign(Object.assign({},d),{details:t,metadata:a})]},this.appMonitorDetails=e,this.config=t,this.enabled=!0,this.pageManager=new H(t,this.recordEvent),this.sessionManager=new W(e,t,this.recordEvent,this.pageManager),this.installationMethod=t.client,this.applicationAttributes=Object.freeze(V(t.applicationAttributes,"application"))}enable(){this.enabled=!0}disable(){this.enabled=!1}setPluginFlushHook(e){this.pluginFlushHook=e}isSessionSampled(){return this.sessionManager.isSampled()}hasEvents(){if(this.sessionLimitExceeded>0){const e=this.events.length+this.sessionLimitExceeded;this.sessionManager.isSampled()?c.warn(`Dropped ${this.sessionLimitExceeded} of ${e} recently observed events (${(this.sessionLimitExceeded/e*100).toFixed(2)}%) because the session limit has exceeded. Consider increasing sessionEventLimit (currently ${this.config.sessionEventLimit}) to ${e} or more to avoid data loss.`):c.warn(`Dropped ${this.sessionLimitExceeded} of ${e} recently observed events (${(this.sessionLimitExceeded/e*100).toFixed(2)}%) because current session is not sampled. Consider increasing sessionSampleRate (currently ${this.config.sessionSampleRate}) to capture more user sessions.`),this.sessionLimitExceeded=0}return 0!==this.events.length}hasCandidates(){return 0!==this.candidates.size}getEventBatch(e=!1){var t;if(this.droppedEvent>0){const e=this.events.length+this.droppedEvent;c.warn(`Dropped ${this.droppedEvent} of ${e} recently observed events (${(this.droppedEvent/e*100).toFixed(2)}%) due to insufficient in-memory queue. Increase eventCacheSize to ${e} (currently ${this.config.eventCacheSize}) to avoid data loss.`),this.droppedEvent=0}let n=[];if(e&&(null===(t=this.pluginFlushHook)||void 0===t||t.call(this)),e&&this.hasCandidates())if(this.candidates.size<=this.config.batchLimit)n=Array.from(this.candidates.values()),this.candidates.clear();else{let e=0;for(const t of Array.from(this.candidates.keys())){if(e++>=this.config.batchLimit)break;const r=this.candidates.get(t);r&&(n.push(r),this.candidates.delete(t))}}return this.events.length&&(this.events.length<=this.config.batchLimit-n.length?(n.push(...this.events),this.events=[]):n.push(...this.events.splice(0,this.config.batchLimit-n.length))),n}getAppMonitorDetails(){return this.appMonitorDetails}getUserDetails(){return{userId:this.sessionManager.getUserId(),sessionId:this.sessionManager.getSession().sessionId}}addSessionAttributes(e){this.sessionManager.addSessionAttributes(e)}getCommonMetadata(){return Object.assign(Object.assign(Object.assign({},this.sessionManager.getAttributes()),this.applicationAttributes),{version:"1.0.0","aws:client":this.installationMethod,"aws:clientVersion":"3.2.1"})}setEventMetadataHook(e){this.eventMetadataHook=e}clearEventMetadataHook(){this.eventMetadataHook=void 0}isCurrentUrlAllowed(){const e=document.location.toString(),t=this.config.pagesToExclude.some(t=>t.test(e));return this.config.pagesToInclude.some(t=>t.test(e))&&!t}}class q{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.slice(-1)?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const t=new q({...e,headers:{...e.headers}});var n;return t.query&&(t.query=(n=t.query,Object.keys(n).reduce((e,t)=>
2{const r=n[t];return{...e,[t]:Array.isArray(r)?[...r]:r}},{}))),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return q.clone(this)}}const G=async e=>{const t=e.length;if(c.debug(`compressIfBeneficial called, payload size: ${t}B`),"undefined"==typeof CompressionStream)return c.debug("CompressionStream not supported, skipping compression"),{body:e,compressed:!1};if(t<2048)return c.debug(`Payload size ${t}B below threshold 2048B, skipping compression`),{body:e,compressed:!1};const n=await(async e=>{const t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(t).arrayBuffer())})(e),r=1-n.length/t;return r>=.2?(c.debug(`Compressed ${t}B -> ${n.length}B (${(100*r).toFixed(1)}% reduction)`),{body:n,compressed:!0}):(c.debug(`Compression ratio ${(100*r).toFixed(1)}% below threshold 20%, skipping`),{body:e,compressed:!1})};class ${constructor(e,t){this.sendFetch=async e=>{var t,n;const r=JSON.stringify(K(e)),i=null!==(n=null===(t=this.config.compressionStrategy)||void 0===t?void 0:t.enabled)&&void 0!==n&&n,{body:s,compressed:o}=i?await G(r):{body:r,compressed:!1},a=await this.getHttpRequestOptions(e,s,"application/json",o);let c=new q(a);return this.signing&&(c=await this.signing.sign(c)),this.config.fetchRequestHandler.handle(c)},this.sendBeacon=async e=>{const t=JSON.stringify(K(e));if(t.length>64e3)throw new Error("Payload too large for sendBeacon");const n=await this.getHttpRequestOptions(e,t,"text/plain;charset=UTF-8",!1);let r=new q(n);return this.signing&&(r=await this.signing.presign(r)),this.config.beaconRequestHandler.handle(r)},this.getHttpRequestOptions=async(e,t,n,r)=>{const i=this.config.endpoint.pathname.replace(/\/$/,""),s=Object.assign({"content-type":n,host:this.config.endpoint.host},this.config.headers);r&&(s["Content-Encoding"]="gzip");const o={method:"POST",protocol:this.config.endpoint.protocol,port:Number(this.config.endpoint.port)||void 0,headers:s,hostname:this.config.endpoint.hostname,path:`${i}/appmonitors/${e.AppMonitorDetails.id}`,body:t};return this.signing?Object.assign(Object.assign({},o),{headers:Object.assign(Object.assign({},o.headers),{"X-Amz-Content-Sha256":await this.signing.hashAndEncode(t)})}):o},this.config=e,this.signing=t}}const K=e=>{const t=[];e.RumEvents.forEach(e=>t.push(Z(e)));let n={BatchId:e.BatchId,AppMonitorDetails:e.AppMonitorDetails,UserDetails:e.UserDetails,RumEvents:t};return e.SessionMetadata&&(n=Object.assign(Object.assign({},n),{SessionMetadata:e.SessionMetadata})),e.Alias&&(n=Object.assign(Object.assign({},n),{Alias:e.Alias})),n},Z=e=>({id:e.id,timestamp:Math.round(e.timestamp.getTime()/1e3),type:e.type,metadata:e.metadata,details:e.details});class z{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}}const J=e=>encodeURIComponent(e).replace(/[!'()*]/g,Y),Y=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function X(e){const t=[];for(let n of Object.keys(e).sort()){const r=e[n];if(n=J(n),Array.isArray(r))for(let e=0,i=r.length;e<i;e++)t.push(`${n}=${J(r[e])}`);else{let e=n;(r||"string"==typeof r)&&(e+=`=${J(r)}`),t.push(e)}}return t.join("&")}class Q{handle(e){const t=this.sendBeacon(e);return new Promise((e,n)=>{t?e({response:new z({statusCode:200})}):n()})}updateHttpClientConfig(e,t){}httpHandlerConfigs(){return{}}sendBeacon(e){let t=e.path;if(e.query){const n=X(e.query);n&&(t+=`?${n}`)}const{port:n}=e,r=`${e.protocol}//${e.hostname}${n?`:${n}`:""}${t}`;return navigator.sendBeacon(r,e.body)}}const ee=(e=0)=>new Promise((t,n)=>{e&&setTimeout(()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",n(t)},e)});class te{constructor({fetchFunction:e,requestTimeout:t}={}){this.requestTimeout=t,this.fetchFunction=e}destroy(){}handle(e,{abortSignal:t}={}){const n=this.requestTimeout;if(null==t?void 0:t.aborted){const e=new Error("Request aborted");return e.name="AbortError",Promise.reject(e)}let r=e.path;if(e.query){const t=X(e.query);t&&(r+=`?${t}`)}const{port:i,method:s}=e,o=`${e.protocol}//${e.hostname}${i?`:${i}`:""}${r}`,a={body:"GET"===s||"HEAD"===s?void 0:e.body,headers:new Headers(e.headers),method:s};"undefined"!=typeof AbortController&&(a.signal=t);
2const c=new Request(o,a),d=[this.fetchFunction.apply(window,[c]).then(e=>{const t=e.headers,n={};for(const e of t.entries())n[e[0]]=e[1];return void 0!==e.body?{response:new z({headers:n,statusCode:e.status,body:e.body})}:e.blob().then(t=>({response:new z({headers:n,statusCode:e.status,body:t})}))}),ee(n)];return t&&d.push(new Promise((e,n)=>{t.onabort=()=>{const e=new Error("Request aborted");e.name="AbortError",n(e)}})),Promise.race(d)}updateHttpClientConfig(e,t){}httpHandlerConfigs(){return{}}}const ne=e=>{if(crypto)return crypto.getRandomValues(e);if(msCrypto)return msCrypto.getRandomValues(e);throw new Error("No crypto library found.")},re=[];for(let e=0;e<256;e++)re[e]=(e+256).toString(16).substr(1);const ie="X-Amzn-Trace-Id",se="traceparent",oe=(e,t)=>Array.isArray(t)?t.some(t=>t.test(e)):t,ae={logicalServiceName:"rum.aws.amazon.com",urlsToInclude:[/.*/],urlsToExclude:[/cognito\-identity\.([^\.]*\.)?amazonaws\.com/,/sts\.([^\.]*\.)?amazonaws\.com/],stackTraceLength:200,recordAllRequests:!1,addXRayTraceIdHeader:!1},ce=e=>200<=e&&e<300,de=e=>4===Math.floor(e/100),le=e=>5===Math.floor(e/100),ue=e=>429===e,he=(e,t)=>{const n=t.urlsToInclude.some(t=>t.test(e)),r=t.urlsToExclude.some(t=>t.test(e));return n&&!r},ge=()=>Date.now()/1e3,pe=(e,t,n,r)=>{const i={version:"1.0.0",name:e,origin:"AWS::RUM::AppMonitor",id:Se(),start_time:t,trace_id:n?Ce():Ie(),end_time:void 0,subsegments:[],in_progress:!1};return r&&(i.http=r),i},me=(e,t,n)=>{const r={id:Se(),name:e,start_time:t,end_time:void 0,in_progress:!1,namespace:e.endsWith(".amazonaws.com")?"aws":"remote"};return n&&(r.http=n),r},fe=e=>{try{return e.hostname?e.hostname:e.url?new URL(e.url).hostname:new URL(e.toString()).hostname}catch(e){return window.location.hostname}},ve=(e,t)=>"Root="+e+";Parent="+t+";Sampled=1",ye=(e,t)=>"00-"+e+"-"+t+"-01",be=e=>e.url?e.url:e.toString(),Ie=()=>`1-${we()}-${Ae()}`,Ce=()=>{const e=new Uint8Array(16);return ne(e),`${Ee(e)}`},Se=()=>{const e=new Uint8Array(8);return ne(e),Ee(e)},we=()=>Math.floor(Date.now()/1e3).toString(16),Ae=()=>{const e=new Uint8Array(12);return ne(e),Ee(e)},Ee=e=>{let t="";for(let n=0;n<e.length;n++)t+=re[e[n]];return t};class Te{constructor(e,t,n=e=>2e3*Math.pow(2,e-1)){this.handler=e,this.retries=t,this.backoff=n}async handle(e){let t=this.retries;for(;;)try{const t=await this.handler.handle(e);if(ce(t.response.statusCode))return t;throw t.response.statusCode}catch(e){if("number"==typeof e&&!ue(e)&&!le(e))throw new Error(`${e}`);if(t<=0)throw e;t--,await this.sleep(this.backoff(this.retries-t))}}async sleep(e){return new Promise(t=>setTimeout(t,e))}updateHttpClientConfig(e,t){}httpHandlerConfigs(){return{}}}const ke="CWR: Cannot dispatch; no AWS credentials.";class Re{constructor(e,t,i,s,o){this.disableCodes=["403","404"],this.shouldPurgeCredentials=!0,this.dispatchFetch=async()=>{if(this.doRequest()){const e=this.createRequest();return c.info(`Dispatching ${e.RumEvents.length} events via fetch`),this.rum.sendFetch(e).catch(this.handleReject)}},this.dispatchBeacon=async()=>{if(this.doRequest()){const e=this.createRequest();return c.info(`Dispatching ${e.RumEvents.length} events via beacon`),this.rum.sendBeacon(e).catch(()=>this.rum.sendFetch(e))}},this.dispatchFetchFailSilent=async()=>this.dispatchFetch().catch(e=>{c.error("Dispatch fetch failed silently:",e)}),this.dispatchBeaconFailSilent=async()=>this.dispatchBeacon().catch(e=>{c.error("Dispatch beacon failed silently:",e)}),this.flushSync=()=>{if("hidden"===document.visibilityState&&this.doRequest(!0)){let e=this.rum.sendBeacon,t=this.rum.sendFetch;this.config.useBeacon||([e,t]=[t,e]);const n=this.createRequest(!0);c.debug(`Flushing ${n.RumEvents.length} events on page hide`),e(n).catch(()=>t(n)).catch(e=>{c.error("Page hide flush failed:",e)})}},this.handleReject=e=>{throw e instanceof Error&&("403"===e.message&&this.config.signing&&this.shouldPurgeCredentials?(this.shouldPurgeCredentials=!1,this.forceRebuildClient()):this.disableCodes.includes(e.message)&&(c.error("Dispatch failed with status code:",e.message),this.disable())),e},this.defaultClientBuilder=(e,t,n,r)=>{const i=n&&this.signingConfigFactory?this.signingConfigFactory(n,t):void 0;return new $({fetchRequestHandler:new Te(new te({fetchFunction:this.config.fetchFunction}),this.config.retries),beaconRequestHandler:new Q,endpoint:e,region:t,credentials:n,headers:this.headers,compressionStrategy:r},i)},this.applicationId=e,this.region=t,this.endpoint=i,this.eventCache=s,this.enabled=!0,this.buildClient=o.clientBuilder||this.defaultClientBuilder,this.config=o,this.headers=o.headers,this.startDispatchTimer(),o.signing?this.rum={sendFetch:()=>Promise.reject(new Error(ke)),sendBeacon:()=>Promise.reject(new Error(ke))}:this.rum=this.buildClient(this.endpoint,this.region,void 0,this.config.compressionStrategy),this.credentialStorageKey=this.config.cookieAttributes.unique?`${n}_${e}`:n,this.identityStorageKey=this.config.cookieAttributes.unique?`${r}_${e}`:r}enable(){this.enabled=!0,this.startDispatchTimer()}disable(){this.stopDispatchTimer(),this.enabled=!1,c.warn("Dispatch disabled")}setAwsCredentials(e){this.credentialProvider=e,this.rum=this.buildClient(this.endpoint,this.region,e,this.config.compressionStrategy),"function"==typeof e&&e()}setCognitoCredentialProviderFactory(e){this.cognitoCredentialProviderFactory=e}setSigningConfigFactory(e){this.signingConfigFactory=e}setCognitoCredentials(e,t){this.identityPoolId=e,this.guestRoleArn=t,this.cognitoCredentialProviderFactory&&this.setAwsCredentials(this.cognitoCredentialProviderFactory(this.config,this.applicationId,e,t))}startDispatchTimer(){document.addEventListener("visibilitychange",this.flushSync),document.addEventListener("pagehide",this.flushSync),this.config.dispatchInterval<=0||this.dispatchTimerId||(this.dispatchTimerId=window.setInterval(this.dispatchFetchFailSilent,this.config.dispatchInterval))}stopDispatchTimer(){document.removeEventListener("visibilitychange",this.flushSync),document.removeEventListener("pagehide",this.flushSync),this.dispatchTimerId&&(window.clearInterval(this.dispatchTimerId),this.dispatchTimerId=void 0)}doRequest(e=!1){return!!this.enabled&&(!(!e||!this.eventCache.hasCandidates())||this.eventCache.hasEvents())}createRequest(e=!1){return{BatchId:I(),AppMonitorDetails:this.eventCache.getAppMonitorDetails(),UserDetails:this.eventCache.getUserDetails(),SessionMetadata:JSON.stringify(this.eventCache.getCommonMetadata()),RumEvents:this.eventCache.getEventBatch(e),Alias:this.config.alias}}forceRebuildClient(){c.warn("Removing credentials from local storage"),localStorage.removeItem(this.credentialStorageKey),this.identityPoolId?(c.info("Rebuilding client with fresh cognito credentials"),localStorage.removeItem(this.identityStorageKey),this.setCognitoCredentials(this.identityPoolId,this.guestRoleArn)):this.credentialProvider&&(c.info("Rebuilding client with most recently passed provider"),this.setAwsCredentials(this.credentialProvider))}}class Me{constructor(e){this.enabled=!0,this.pluginId=Me.generatePluginId(e)}static generatePluginId(e){return`${Me.idPrefix}.${e}`}load(e){var t;this.context=e,null===(t=this.onload)||void 0===t||t.call(this)}getPluginId(){return this.pluginId}}Me.idPrefix="com.amazonaws.rum";class Le{constructor(e){this.context=e,this.plugins=new Map}addPlugin(e){const t=e.getPluginId();if(this.hasPlugin(t))throw new Error(`Plugin "${t}" already defined in the PluginManager`);this.plugins.set(t,e),e.load(this.context),c.debug(`Plugin loaded: ${t}`)}updatePlugin(e,t){var n;const r=this.getPlugin(e);null===(n=null==r?void 0:r.update)||void 0===n||n.call(r,t)}
2enable(){this.plugins.forEach(e=>e.enable())}disable(){this.plugins.forEach(e=>e.disable())}flush(){this.plugins.forEach(e=>{var t;return null===(t=e.flush)||void 0===t?void 0:t.call(e)})}hasPlugin(e){return Boolean(this.getPlugin(e))}record(e,t){const n=this.getPlugin(e);if(!((null==n?void 0:n.record)instanceof Function))throw new Error("AWS RUM Client record: Invalid plugin ID");n.record(t)}getPlugin(e){var t;return null!==(t=this.plugins.get(e))&&void 0!==t?t:this.plugins.get(Me.generatePluginId(e))}}var Oe=function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}(821);class xe extends Me{constructor(){super(...arguments),this.enable=this.patch.bind(this,!0),this.disable=this.patch.bind(this,!1),this.enabled=!1}patchAll(){const e=Oe.wrap.bind(Oe);for(const t of this.patches)e(t.nodule,t.name,t.wrapper())}unpatchAll(){const e=Oe.unwrap.bind(Oe);for(const t of this.patches)e(t.nodule,t.name)}patch(e=!0){this.enabled!==e&&(this.enabled=e,e?this.patchAll():this.unpatchAll())}}class De extends xe{constructor(){super("page-view"),this.pushState=()=>{const e=this;return t=>function(n,r,i){const s=t.apply(this,arguments);return e.recordPageView(),s}},this.replaceState=()=>{const e=this;return t=>function(n,r,i){const s=t.apply(this,arguments);return e.recordPageView(),s}},this.popstateListener=e=>{this.recordPageView()},this.recordPageView=()=>{this.context.recordPageView(this.createIdForCurrentPage())},this.enable()}onload(){this.addListener(),this.recordPageView()}get patches(){return[{nodule:History.prototype,name:"pushState",wrapper:this.pushState},{nodule:History.prototype,name:"replaceState",wrapper:this.replaceState}]}addListener(){window.addEventListener("popstate",this.popstateListener)}createIdForCurrentPage(){const e=window.location.pathname,t=window.location.hash;switch(this.context.config.pageIdFormat){case C.PathAndHash:return e&&t?e+t:e||(t||"");case C.Hash:return t||"";case C.Path:default:return e||""}}}var Ne,Pe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};!function(e){e.Path="PATH",e.Hash="HASH",e.PathAndHash="PATH_AND_HASH"}(Ne||(Ne={}));const Fe="us-west-2",Ue=`https://dataplane.rum.${Fe}.amazonaws.com`,Be=()=>({unique:!1,domain:window.location.hostname,path:"/",sameSite:"Strict",secure:!0}),We=e=>({allowCookies:!1,batchLimit:100,client:"arw-module",compressionStrategy:{enabled:!0},cookieAttributes:e,debug:!1,disableAutoPageView:!1,dispatchInterval:5e3,enableRumClient:!0,enableXRay:!1,endpoint:Ue,endpointUrl:new URL(Ue),eventCacheSize:1e3,eventPluginsToLoad:[],pageIdFormat:Ne.Path,pagesToExclude:[],pagesToInclude:[/.*/],signing:!1,recordResourceUrl:!0,retries:2,routeChangeComplete:100,routeChangeTimeout:1e4,sessionAttributes:{},sessionEventLimit:200,sessionLengthSeconds:1800,sessionSampleRate:1,suppressSessionStartEvent:!1,useBeacon:!0,userIdRetentionDays:30,enableW3CTraceId:!1,candidatesCacheSize:10});class He{constructor(e,t,n,r={}){var{cookieAttributes:i}=r,s=Pe(r,["cookieAttributes"]);this.eventBus=new l,void 0===n&&(n="us-west-2"),this.applicationId=e;const o=Object.assign(Object.assign({},Be()),i);this.config=Object.assign(Object.assign({fetchFunction:fetch},We(o)),s),this.config.sessionId&&(this.config.suppressSessionStartEvent=!0),this.config.endpoint=s.endpoint?s.endpoint:Ue.replace(Fe,n),this.config.endpointUrl=new URL(this.config.endpoint),c.configure(this.config.debug),c.info("Initialized RUM Slim"),this.eventCache=new _({id:e,version:t},this.config,this.eventBus),this.dispatchManager=this.initDispatch(n,e),this.pluginManager=this.initPluginManager(e,t),this.eventCache.setPluginFlushHook(()=>this.pluginManager.flush()),this.config.enableRumClient?this.enable():this.disable()}setAwsCredentials(e){this.dispatchManager.setAwsCredentials(e)}setSigningConfigFactory(e){this.dispatchManager.setSigningConfigFactory(e)}addSessionAttributes(e){this.eventCache.addSessionAttributes(e)}getSessionId(){return this.eventCache.getSessionId()}pinSessionId(e){this.eventCache.pinSessionId(e)}startSession(e){return this.eventCache.startSession(e)}getUserId(){return this.eventCache.getUserId()}pinUserId(e){this.eventCache.pinUserId(e)}setEventMetadataHook(e){this.eventCache.setEventMetadataHook(e)}clearEventMetadataHook(){this.eventCache.clearEventMetadataHook()}
2addPlugin(e){this.pluginManager.addPlugin(e)}dispatch(){this.dispatchManager.dispatchFetch()}dispatchBeacon(){this.dispatchManager.dispatchBeacon()}enable(){this.eventCache.enable(),this.pluginManager.enable(),this.dispatchManager.enable()}disable(){this.dispatchManager.disable(),this.pluginManager.disable(),this.eventCache.disable()}allowCookies(e){this.config.allowCookies=e}clearCookies(){const e=this.config.cookieAttributes;[i,s,n,`${i}_${this.applicationId}`,`${s}_${this.applicationId}`,`${n}_${this.applicationId}`].forEach(t=>((e,t)=>{let n=e+"=";n+=`; Expires=${new Date(0)}`,n+=`; Domain=${t.domain}`,n+=`; Path=${t.path}`,n+=`; SameSite=${t.sameSite}`,n+=t.secure?"Secure":"",document.cookie=n})(t,e))}recordPageView(e){this.eventCache.recordPageView(e)}recordError(e){this.pluginManager.record("com.amazonaws.rum.js-error",e)}registerDomEvents(e){this.pluginManager.updatePlugin("com.amazonaws.rum.dom-event",e)}recordEvent(e,t,n){this.eventCache.recordEvent(e,t,n)}initDispatch(e,t){return new Re(t,e,this.config.endpointUrl,this.eventCache,this.config)}initPluginManager(e,t){const n={applicationId:e,applicationVersion:t,config:this.config,record:this.eventCache.recordEvent,recordCandidate:this.eventCache.recordCandidate,recordPageView:this.eventCache.recordPageView,getSession:this.eventCache.getSession,eventBus:this.eventBus},r=new Le(n);return this.config.disableAutoPageView||r.addPlugin(new De),this.config.eventPluginsToLoad.forEach(e=>{r.addPlugin(e)}),r}}class je{constructor(){this.commandHandlerMap={addSessionAttributes:e=>{this.orchestration.addSessionAttributes(e)},recordPageView:e=>{this.orchestration.recordPageView(e)},recordError:e=>{this.orchestration.recordError(e)},registerDomEvents:e=>{this.orchestration.registerDomEvents(e)},recordEvent:e=>{if("object"!=typeof e||"string"!=typeof e.type||"object"!=typeof e.data)throw new Error("IncorrectParametersException");if(void 0!==e.metadata&&("object"!=typeof e.metadata||null===e.metadata||Array.isArray(e.metadata)))throw new Error("IncorrectParametersException");this.orchestration.recordEvent(e.type,e.data,e.metadata)},clearEventMetadataHook:()=>{this.orchestration.clearEventMetadataHook()},dispatch:()=>{this.orchestration.dispatch()},dispatchBeacon:()=>{this.orchestration.dispatchBeacon()},enable:()=>{this.orchestration.enable()},disable:()=>{this.orchestration.disable()},clearCookies:()=>{this.orchestration.clearCookies()},allowCookies:e=>{if("boolean"!=typeof e)throw new Error("IncorrectParametersException");this.orchestration.allowCookies(e)},setAwsCredentials:e=>{this.orchestration.setAwsCredentials(e)},pinSessionId:e=>{"string"==typeof e?this.orchestration.pinSessionId(e):c.warn("pinSessionId expects a string; ignoring")},pinUserId:e=>{"string"==typeof e?this.orchestration.pinUserId(e):c.warn("pinUserId expects a string; ignoring")},startSession:e=>{void 0===e||"object"==typeof e&&null!==e&&!Array.isArray(e)?this.orchestration.startSession(e):c.warn("startSession expects undefined or an options object; ignoring")}}}async init(e){this.initCwr(e)}async push(e){const t=this.commandHandlerMap[e.c];if(!t)throw new Error(`CWR: UnsupportedOperationException: ${e.c}`);t(e.p)}initCwr(e){e.c?e.c.client=o:e.c={client:o},e.c.signing=!1,this.orchestration=new He(e.i,e.v,e.r,e.c),window[e.n]=(e,t)=>{this.push({c:e,p:t})},e.q.forEach(e=>{this.push(e)}),e.q=[]}}const Ve={},_e={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),Ve[e]=t,_e[t]=e}const qe={},Ge={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),qe[e]=t,Ge[t]=e}function $e(e){let t="";for(let n=0;n<e.byteLength;n++)t+=qe[e[n]];return t}const Ke=e=>(new TextEncoder).encode(e),Ze=e=>"string"==typeof e?Ke(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),ze="X-Amz-Date",Je="X-Amz-Signature",Ye="X-Amz-Security-Token",Xe="authorization",Qe=ze.toLowerCase(),et=[Xe,Qe,"date"],tt=Je.toLowerCase(),nt="x-amz-content-sha256",rt=Ye.toLowerCase(),it={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},st=/^proxy-/,ot=/^sec-/,at="AWS4-HMAC-SHA256",ct="AWS4-HMAC-SHA256-PAYLOAD",dt="aws4_request",lt={}
vendor: 4,074 bytes, line 2
2,ut=[],ht=(e,t,n)=>`${e}/${t}/${n}/${dt}`,gt=(e,t,n)=>{const r=new e(t);return r.update(Ze(n)),r.digest()},pt=({headers:e},t,n)=>{const r={};for(const i of Object.keys(e).sort()){if(null==e[i])continue;const s=i.toLowerCase();(s in it||t?.has(s)||st.test(s)||ot.test(s))&&(!n||n&&!n.has(s))||(r[s]=e[i].trim().replace(/\s+/g," "))}return r},mt=async({headers:e,body:t},n)=>{for(const t of Object.keys(e))if(t.toLowerCase()===nt)return e[t];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||(r=t,"function"==typeof ArrayBuffer&&r instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(r))){const e=new n;return e.update(Ze(t)),$e(await e.digest())}var r;return"UNSIGNED-PAYLOAD"};class ft{format(e){const t=[];for(const n of Object.keys(e)){const r=Ke(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}const n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let r=0;for(const e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case"binary":const i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);const s=new Uint8Array(i.buffer);return s.set(e.value,3),s;case"string":const o=Ke(e.value),a=new DataView(new ArrayBuffer(3+o.byteLength));a.setUint8(0,7),a.setUint16(1,o.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(o,3),c;case"timestamp":const d=new Uint8Array(9);return d[0]=8,d.set(bt.fromNumber(e.value.valueOf()).bytes,1),d;case"uuid":if(!yt.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const l=new Uint8Array(17);return l[0]=9,l.set(function(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const r=e.slice(n,n+2).toLowerCase();if(!(r in Ge))throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`);t[n/2]=Ge[r]}return t}(e.value.replace(/\-/g,"")),1),l}}}var vt;!function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"}(vt||(vt={}));const yt=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class bt{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let n=7,r=Math.abs(Math.round(e));n>-1&&r>0;n--,r/=256)t[n]=r;return e<0&&It(t),new bt(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&It(e),parseInt($e(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function It(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const Ct=e=>{e=q.clone(e);for(const t of Object.keys(e.headers))et.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},St=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},wt=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class At{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:s=!0}){this.service=r,this.sha256=i,this.uriEscapePath=s,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=St(n),this.credentialProvider=St(t)}
2createCanonicalRequest(e,t,n){const r=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${(({query:e={}})=>{const t=[],n={};for(const r of Object.keys(e)){if(r.toLowerCase()===tt)continue;const i=J(r);t.push(i);const s=e[r];"string"==typeof s?n[i]=`${i}=${J(s)}`:Array.isArray(s)&&(n[i]=s.slice(0).reduce((e,t)=>e.concat([`${i}=${J(t)}`]),[]).sort().join("&"))}return t.sort().map(e=>n[e]).filter(e=>e).join("&")})(e)}\n${r.map(e=>`${e}:${t[e]}`).join("\n")}\n\n${r.join(";")}\n${n}`}async createStringToSign(e,t,n,r){const i=new this.sha256;i.update(Ze(n));return`${r}\n${e}\n${t}\n${$e(await i.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))0!==n?.length&&"."!==n&&(".."===n?t.pop():t.push(n));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return J(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}formatDate(e){const t=(n=e,wt(n).toISOString().replace(/\.\d{3}Z$/,"Z")).replace(/[\-:]/g,"");var n;return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}class Et extends At{headerFormatter=new ft;constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:s=!0}){super({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:s})}async presign(e,t={}
vendor: 8,934 bytes, line 2
2){const{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:i,unhoistableHeaders:s,signableHeaders:o,hoistableHeaders:a,signingRegion:c,signingService:d}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);const u=c??await this.regionProvider(),{longDate:h,shortDate:g}=this.formatDate(n);if(r>604800)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const p=ht(g,u,d??this.service),m=((e,t={})=>{const{headers:n,query:r={}}=q.clone(e);for(const e of Object.keys(n)){const i=e.toLowerCase();("x-amz-"===i.slice(0,6)&&!t.unhoistableHeaders?.has(i)||t.hoistableHeaders?.has(i))&&(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}})(Ct(e),{unhoistableHeaders:s,hoistableHeaders:a});l.sessionToken&&(m.query[Ye]=l.sessionToken),m.query["X-Amz-Algorithm"]=at,m.query["X-Amz-Credential"]=`${l.accessKeyId}/${p}`,m.query[ze]=h,m.query["X-Amz-Expires"]=r.toString(10);const f=pt(m,i,o);return m.query["X-Amz-SignedHeaders"]=this.getCanonicalHeaderList(f),m.query[Je]=await this.getSignature(h,p,this.getSigningKey(l,u,g,d),this.createCanonicalRequest(m,f,await mt(e,this.sha256))),m}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:r,signingRegion:i,signingService:s}){const o=i??await this.regionProvider(),{shortDate:a,longDate:c}=this.formatDate(n),d=ht(a,o,s??this.service),l=await mt({headers:{},body:t},this.sha256),u=new this.sha256;u.update(e);const h=$e(await u.digest()),g=[ct,c,d,r,h,l].join("\n");return this.signString(g,{signingDate:n,signingRegion:o,signingService:s})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:r}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:r,priorSignature:e.priorSignature}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:r}={}){const i=await this.credentialProvider();this.validateResolvedCredentials(i);const s=n??await this.regionProvider(),{shortDate:o}=this.formatDate(t),a=new this.sha256(await this.getSigningKey(i,s,o,r));return a.update(Ze(e)),$e(await a.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:r,signingRegion:i,signingService:s}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const a=i??await this.regionProvider(),c=Ct(e),{longDate:d,shortDate:l}=this.formatDate(t),u=ht(l,a,s??this.service);c.headers[Qe]=d,o.sessionToken&&(c.headers[rt]=o.sessionToken);const h=await mt(c,this.sha256);!((e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1})(nt,c.headers)&&this.applyChecksum&&(c.headers[nt]=h);const g=pt(c,r,n),p=await this.getSignature(d,u,this.getSigningKey(o,a,l,s),this.createCanonicalRequest(c,g,h));return c.headers[Xe]=`${at} Credential=${o.accessKeyId}/${u}, SignedHeaders=${this.getCanonicalHeaderList(g)}, Signature=${p}`,c}async getSignature(e,t,n,r){const i=await this.createStringToSign(e,t,r,at),s=new this.sha256(await n);return s.update(Ze(i)),$e(await s.digest())}getSigningKey(e,t,n,r){return(async(e,t,n,r,i)=>{const s=`${n}:${r}:${i}:${$e(await gt(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(s in lt)return lt[s];for(ut.push(s);ut.length>50;)delete lt[ut.shift()];let o=`AWS4${t.secretAccessKey}`;for(const t of[n,r,i,dt])o=await gt(e,o,t);return lt[s]=o})(this.sha256,e,n,t,r||this.service)}}function Tt(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}c((r=r.apply(e,t||[])).next())})}function kt(e,t){var n,r,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;var Rt=64,Mt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Lt=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],Ot=Math.pow(2,53)-1,xt=function(){function e(){this.state=Int32Array.from(Lt),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>Ot)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===Rt&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%Rt>=56){for(var r=this.bufferLength;r<Rt;r++)t.setUint8(r,0);this.hashBuffer(),this.bufferLength=0}for(r=this.bufferLength;r<56;r++)t.setUint8(r,0);t.setUint32(56,Math.floor(e/4294967296),!0),t.setUint32(60,e),this.hashBuffer(),this.finished=!0}var i=new Uint8Array(32);for(r=0;r<8;r++)i[4*r]=this.state[r]>>>24&255,i[4*r+1]=this.state[r]>>>16&255,i[4*r+2]=this.state[r]>>>8&255,i[4*r+3]=this.state[r]>>>0&255;return i},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],r=t[1],i=t[2],s=t[3],o=t[4],a=t[5],c=t[6],d=t[7],l=0;l<Rt;l++){if(l<16)this.temp[l]=(255&e[4*l])<<24|(255&e[4*l+1])<<16|(255&e[4*l+2])<<8|255&e[4*l+3];else{var u=this.temp[l-2],h=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,g=((u=this.temp[l-15])>>>7|u<<25)^(u>>>18|u<<14)^u>>>3;this.temp[l]=(h+this.temp[l-7]|0)+(g+this.temp[l-16]|0)}var p=(((o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7))+(o&a^~o&c)|0)+(d+(Mt[l]+this.temp[l]|0)|0)|0,m=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&r^n&i^r&i)|0;d=c,c=a,a=o,o=s+p|0,s=i,i=r,r=n,n=p+m|0}t[0]+=n,t[1]+=r,t[2]+=i,t[3]+=s,t[4]+=o,t[5]+=a,t[6]+=c,t[7]+=d},e}();var Dt="undefined"!=typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:e=>(new TextEncoder).encode(e);function Nt(e){return e instanceof Uint8Array?e:"string"==typeof e?Dt(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}var Pt=function(){function e(e){this.secret=e,this.hash=new xt,this.reset()}return e.prototype.update=function(e){var t;if(("string"==typeof(t=e)?0!==t.length:0!==t.byteLength)&&!this.error)try{this.hash.update(Nt(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return Tt(this,void 0,void 0,function(){return kt(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new xt,this.secret){this.outer=new xt;var e=function(e){var t=Nt(e);if(t.byteLength>Rt){var n=new xt;n.update(t),t=n.digest()}
2var r=new Uint8Array(Rt);return r.set(t),r}(this.secret),t=new Uint8Array(Rt);t.set(e);for(var n=0;n<Rt;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(n=0;n<e.byteLength;n++)e[n]=0}},e}();const Ft={expiresIn:60},Ut=(e,t)=>{const n=new Et({applyChecksum:!0,credentials:e,region:t,service:"rum",uriEscapePath:!0,sha256:Pt});return{sign:async e=>await n.sign(e),presign:async e=>await n.presign(e,Ft),hashAndEncode:async e=>{const t=new Pt;return t.update(e),function(e){let t="";for(let n=0;n<e.byteLength;n++)t+=Ve[e[n]];return t}(await t.digest()).toLowerCase()}}};function Bt(e,t){return new Request(e,t)}function Wt(e=0){return new Promise((t,n)=>{e&&setTimeout(()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",n(t)},e)})}const Ht={supported:void 0};class jt{config;configProvider;static create(e){return"function"==typeof e?.handle?e:new jt(e)}constructor(e){"function"==typeof e?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),void 0===Ht.supported&&(Ht.supported=Boolean("undefined"!=typeof Request&&"keepalive"in Bt("https://[::1]")))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);const r=n??this.config.requestTimeout,i=!0===this.config.keepAlive,s=this.config.credentials;if(t?.aborted){const e=Vt(t);return Promise.reject(e)}let o=e.path;const a=X(e.query||{});a&&(o+=`?${a}`),e.fragment&&(o+=`#${e.fragment}`);let c="";if(null!=e.username||null!=e.password){c=`${e.username??""}:${e.password??""}@`}const{port:d,method:l}=e,u=`${e.protocol}//${c}${e.hostname}${d?`:${d}`:""}${o}`,h="GET"===l||"HEAD"===l?void 0:e.body,g={body:h,headers:new Headers(e.headers),method:l,credentials:s};this.config?.cache&&(g.cache=this.config.cache),h&&(g.duplex="half"),"undefined"!=typeof AbortController&&(g.signal=t),Ht.supported&&(g.keepalive=i),"function"==typeof this.config.requestInit&&Object.assign(g,this.config.requestInit(e));let p=()=>{};const m=Bt(u,g),f=[fetch(m).then(e=>{const t=e.headers,n={};for(const e of t.entries())n[e[0]]=e[1];return null!=e.body?{response:new z({headers:n,reason:e.statusText,statusCode:e.status,body:e.body})}:e.blob().then(t=>({response:new z({headers:n,reason:e.statusText,statusCode:e.status,body:t})}))}),Wt(r)];return t&&f.push(new Promise((e,n)=>{const r=()=>{const e=Vt(t);n(e)};if("function"==typeof t.addEventListener){const e=t;e.addEventListener("abort",r,{once:!0}),p=()=>e.removeEventListener("abort",r)}else t.onabort=r})),Promise.race(f).finally(p)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}}function Vt(e){const t=e&&"object"==typeof e&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){const e=new Error("Request aborted");return e.name="AbortError",e.cause=t,e}const e=new Error(String(t));return e.name="AbortError",e}const n=new Error("Request aborted");return n.name="AbortError",n}const _t=async e=>{const{value:t}=await e.body.getReader().read();return JSON.parse(String.fromCharCode.apply(null,t))};class qt{constructor(e){this.assumeRoleWithWebIdentity=async e=>{try{const t=Object.assign(Object.assign({},e),{Action:"AssumeRoleWithWebIdentity",Version:"2011-06-15"}),n=new URLSearchParams(Object.entries(t)).toString(),r=new q({method:"POST",headers:{"content-type":"application/x-www-form-urlencoded",host:this.hostname},protocol:"https:",hostname:this.hostname,body:n}),{response:i}=await this.fetchRequestHandler.handle(r),s=await(async e=>{const{value:t}=await e.body.getReader().read();return String.fromCharCode.apply(null,t)})(i);return{accessKeyId:s.split("<AccessKeyId>")[1].split("</AccessKeyId>")[0],secretAccessKey:s.split("<SecretAccessKey>")[1].split("</SecretAccessKey>")[0],sessionToken:s.split("<SessionToken>")[1].split("</SessionToken>")[0],expiration:new Date(s.split("<Expiration>")[1].split("</Expiration>")[0])}}catch(e){throw new Error(`CWR: Failed to retrieve credentials from STS: ${e}`)}}
2,this.hostname=`sts.${e.region}.amazonaws.com`,this.fetchRequestHandler=e.fetchRequestHandler}}class Gt{constructor(e){var t;this.getId=async e=>{var t;let n=null;try{n=JSON.parse(localStorage.getItem(this.identityStorageKey))}catch(e){(null===(t=this.config)||void 0===t?void 0:t.debug)&&c.error("Failed to parse stored identity:",e)}if(n&&n.IdentityId)return Promise.resolve(n);try{const t=JSON.stringify(e),n=this.getHttpRequest("AWSCognitoIdentityService.GetId",t),r=await _t((await this.fetchRequestHandler.handle(n)).response);try{localStorage.setItem(this.identityStorageKey,JSON.stringify({IdentityId:r.IdentityId}))}catch(e){c.error("Failed to store identity:",e)}return r}catch(e){throw new Error(`CWR: Failed to retrieve Cognito identity: ${e}`)}},this.getOpenIdToken=async e=>{try{const t=JSON.stringify(e),n=this.getHttpRequest("AWSCognitoIdentityService.GetOpenIdToken",t),{response:r}=await this.fetchRequestHandler.handle(n);return this.validateOpenIdTokenResponse(await _t(r))}catch(e){throw localStorage.removeItem(this.identityStorageKey),new Error(`CWR: Failed to retrieve Cognito OpenId token: ${e}`)}},this.getCredentialsForIdentity=async e=>{try{const t=JSON.stringify({IdentityId:e}),n=this.getHttpRequest("AWSCognitoIdentityService.GetCredentialsForIdentity",t),{response:r}=await this.fetchRequestHandler.handle(n),{AccessKeyId:i,Expiration:s,SecretKey:o,SessionToken:a}=this.validateCredenentialsResponse(await _t(r));return{accessKeyId:i,secretAccessKey:o,sessionToken:a,expiration:new Date(1e3*s)}}catch(e){throw localStorage.removeItem(this.identityStorageKey),new Error(`CWR: Failed to retrieve credentials for Cognito identity: ${e}`)}},this.validateOpenIdTokenResponse=e=>{if("IdentityId"in e&&"Token"in e)return e;throw e&&"__type"in e&&"message"in e?new Error(`${e.__type}: ${e.message}`):new Error("Unknown OpenIdToken response")},this.validateCredenentialsResponse=e=>{if("IdentityId"in e&&"Credentials"in e)return e.Credentials;throw e&&"__type"in e&&"message"in e?new Error(`${e.__type}: ${e.message}`):new Error("Unknown Credentials response")},this.getHttpRequest=(e,t)=>new q({method:"POST",headers:{"content-type":"application/x-amz-json-1.1","x-amz-target":e},protocol:"https:",hostname:this.hostname,body:t}),this.hostname=`cognito-identity.${e.region}.amazonaws.com`,this.fetchRequestHandler=e.fetchRequestHandler,this.config=e.clientConfig,this.identityStorageKey=(null===(t=e.clientConfig)||void 0===t?void 0:t.cookieAttributes.unique)?`${r}_${e.applicationId}`:r}}class $t{constructor(e,t){this.ChainAnonymousCredentialsProvider=async()=>this.AnonymousCredentialsProvider().catch(this.AnonymousStorageCredentialsProvider).catch(this.AnonymousCognitoCredentialsProvider),this.AnonymousCredentialsProvider=async()=>new Promise((e,t)=>{if(this.renewCredentials())return t();e(this.credentials)}),this.AnonymousStorageCredentialsProvider=async()=>new Promise((e,t)=>{let n;try{n=JSON.parse(localStorage.getItem(this.credentialStorageKey))}catch(e){return t()}if(this.credentials=Object.assign(Object.assign({},n),{expiration:new Date(n.expiration)}),this.renewCredentials())return t();e(this.credentials)});const r=e.identityPoolId.split(":")[0];this.config=e,this.cognitoIdentityClient=new Gt({fetchRequestHandler:new jt,region:r,clientConfig:e,applicationId:t}),this.credentialStorageKey=this.config.cookieAttributes.unique?`${n}_${t}`:n}renewCredentials(){if(!this.credentials||!this.credentials.expiration)return!0;const e=new Date(this.credentials.expiration.getTime()-3e4);return new Date>e}}class Kt extends $t{constructor(e,t){super(e,t),this.AnonymousCognitoCredentialsProvider=async()=>{let e=1;for(;;)try{const e=await this.cognitoIdentityClient.getId({IdentityPoolId:this.config.identityPoolId}),t=await this.cognitoIdentityClient.getOpenIdToken(e),n=await this.stsClient.assumeRoleWithWebIdentity({RoleArn:this.config.guestRoleArn,RoleSessionName:"
2cwr",WebIdentityToken:t.Token});this.credentials=n;try{localStorage.setItem(this.credentialStorageKey,JSON.stringify(n))}catch(e){}return c.debug("AWS credentials fetched successfully"),n}catch(t){if(!e)throw c.error("AWS credential fetch failed:",t),t;e--,c.warn("AWS credential fetch failed, retrying")}};const n=e.identityPoolId.split(":")[0];this.stsClient=new qt({fetchRequestHandler:new jt,region:n})}}class Zt extends $t{constructor(e,t){super(e,t),this.AnonymousCognitoCredentialsProvider=async()=>{let e=1;for(;;)try{const e=await this.cognitoIdentityClient.getId({IdentityPoolId:this.config.identityPoolId}),t=await this.cognitoIdentityClient.getCredentialsForIdentity(e.IdentityId);this.credentials=t;try{localStorage.setItem(this.credentialStorageKey,JSON.stringify(t))}catch(e){}return c.debug("AWS credentials fetched successfully"),t}catch(t){if(!e)throw c.error("AWS credential fetch failed:",t),t;e--,c.warn("AWS credential fetch failed, retrying")}}}}const zt=e=>e!==Object(e)&&null!=e,Jt=(e,t)=>{const n=(e=>{const t={version:"1.0.0",type:"undefined",message:"undefined"};return void 0!==e.type&&(t.type=e.type),void 0!==e.message&&(t.message=e.message),void 0!==e.filename&&(t.filename=e.filename),void 0!==e.lineno&&(t.lineno=e.lineno),void 0!==e.colno&&(t.colno=e.colno),t})(e),r=e.error;return(e=>{const t=typeof e;return("object"===t||"function"===t)&&!!e})(r)?((e,t,n)=>{t.name&&(e.type=t.name),t.message&&(e.message=t.message),t.fileName&&(e.filename=t.fileName),t.lineNumber&&(e.lineno=t.lineNumber),t.columnNumber&&(e.colno=t.columnNumber),n&&t.stack&&(e.stack=t.stack.length>n?t.stack.substring(0,n)+"...":t.stack)})(n,r,t):zt(r)&&((e,t)=>{"unhandledrejection"!==e.type&&(e.type=t.toString()),e.message=t.toString()})(n,r),n},Yt="js-error",Xt={stackTraceLength:1e3,ignore:()=>!1};class Qt extends Me{constructor(e){super(Yt),this.eventHandler=e=>{this.config.ignore(e)||this.recordJsErrorEvent(e)}
2,this.promiseRejectEventHandler=e=>{this.config.ignore(e)||this.recordJsErrorEvent({type:e.type,error:e.reason})},this.config=Object.assign(Object.assign({},Xt),e)}enable(){this.enabled||(this.addEventHandler(),this.enabled=!0)}disable(){this.enabled&&(this.removeEventHandler(),this.enabled=!1)}record(e){e instanceof ErrorEvent?this.recordJsErrorEvent(e):this.recordJsErrorEvent({type:"error",error:e})}onload(){this.addEventHandler()}recordJsErrorEvent(e){var t;null===(t=this.context)||void 0===t||t.record(N,Jt(e,this.config.stackTraceLength))}addEventHandler(){window.addEventListener("error",this.eventHandler),window.addEventListener("unhandledrejection",this.promiseRejectEventHandler)}removeEventHandler(){window.removeEventListener("error",this.eventHandler),window.removeEventListener("unhandledrejection",this.promiseRejectEventHandler)}}const en="dom-event",tn={interactionId:()=>"",enableMutationObserver:!1,events:[]};class nn extends Me{constructor(e){super(en),this.enabled=!1,this.eventListenerMap=new Map,this.config=Object.assign(Object.assign({},tn),e)}static getElementInfo(e){const t={name:"UNKNOWN"};return e.target instanceof Node&&(t.name=e.target.nodeName),e.target instanceof Element&&e.target.id&&(t.id=e.target.id),t}enable(){"complete"===document.readyState?this.enabled||(this.addListeners(),this.config.enableMutationObserver&&this.observeDOMMutation(),this.enabled=!0):window.addEventListener("load",()=>this.enable())}disable(){this.enabled&&(this.removeListeners(),this.observer&&this.observer.disconnect(),this.enabled=!1)}update(e){e.forEach(e=>{this.addEventHandler(e),this.config.events.push(e)})}onload(){this.enable()}removeListeners(){this.config.events.forEach(e=>this.removeEventHandler(e))}addListeners(){this.config.events.forEach(e=>this.addEventHandler(e))}getEventListener(e){return t=>{var n;const r=nn.getElementInfo(t),i=this.config.interactionId(t),s=Object.assign(Object.assign(Object.assign({version:"1.1.0",event:t.type,element:r.name},r.id?{elementId:r.id}:{}),i?{interactionId:i}:{}),e?{cssLocator:e}:{});(null===(n=this.context)||void 0===n?void 0:n.record)&&this.context.record(D,s)}}addEventHandler(e){const t=e.event,n=this.getEventListener(e.cssLocator),r=[],i=this.eventListenerMap.has(e)?this.eventListenerMap.get(e):[];if(e.cssLocator){document.querySelectorAll(e.cssLocator).forEach(e=>{r.push(e)})}else if(e.elementId){const t=document.getElementById(e.elementId);t&&r.push(t)}else e.element&&r.push(e.element);r.forEach(e=>{e.addEventListener(t,n),i.push({element:e,eventListener:n})}),this.eventListenerMap.set(e,i)}removeEventHandler(e){const t=this.eventListenerMap.get(e);t&&(t.forEach(t=>{const n=t.element,r=t.eventListener;n.removeEventListener(e.event,r)}),this.eventListenerMap.delete(e))}observeDOMMutation(){this.observer=new MutationObserver(()=>{this.removeListeners(),this.addListeners()}),this.observer.observe(document,{childList:!0,subtree:!0})}}var rn,sn;!function(e){e.OTHER="other",e.STYLESHEET="stylesheet",e.DOCUMENT="document",e.SCRIPT="script",e.IMAGE="image",e.FONT="font"}(rn||(rn={})),function(e){e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.FRAME="frame",e.SCRIPT="script",e.CSS="css"}(sn||(sn={}));const on=e=>[e.startTime,e.duration].join("#"),an=[{name:rn.STYLESHEET,list:["css","less"]},{name:rn.DOCUMENT,list:["htm","html","ts","doc","docx","pdf","xls","xlsx"]},{name:rn.SCRIPT,list:["js"]},{name:rn.IMAGE,list:["ai","bmp","gif","ico","jpeg","jpg","png","ps","psd","svg","tif","tiff"]},{name:rn.FONT,list:["fnt","fon","otf","ttf","woff"]}],cn=(e,t)=>{let n=rn.OTHER;if(e){const t=e.substring(e.lastIndexOf("/")+1),r=t.substring(t.lastIndexOf(".")+1).split(/[?#]/)[0];an.forEach(e=>{e.list.indexOf(r)>-1&&(n=e.name)})}if(t&&n===rn.OTHER)switch(t){case sn.IMAGE:case sn.IMG:case sn.INPUT:n=rn.IMAGE;break;case sn.IFRAME:case sn.FRAME:n=rn.DOCUMENT;break;case sn.SCRIPT:n=rn.SCRIPT;break;case sn.CSS:n=rn.STYLESHEET}return n},dn=/\/appmonitors\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,ln={eventLimit:10,ignore:e=>"resource"===e.entryType&&(!/^https?:/.test(e.name)||/^(fetch|xmlhttprequest)$/.test(e.initiatorType)),recordAllTypes:[rn.DOCUMENT,rn.SCRIPT,rn.STYLESHEET,rn.FONT],sampleTypes:[rn.IMAGE,rn.OTHER],reportAllLCP:!1,reportAllCLS:!1,reportAllINP:!1},un="navigation",hn="load";class gn extends Me{constructor(e){super("navigation"),this.eventListener=()=>
2{if(0===performance.getEntriesByType(un).length)this.performanceNavigationEventHandlerTimingLevel1();else{const e=new PerformanceObserver(e=>{e.getEntries().filter(e=>e.entryType===un).filter(e=>!this.config.ignore(e)).forEach(e=>{this.performanceNavigationEventHandlerTimingLevel2(e)})});e.observe({entryTypes:[un]})}},this.performanceNavigationEventHandlerTimingLevel1=()=>{setTimeout(()=>{var e;const t=performance.timing,n=t.navigationStart,r={version:"1.0.0",initiatorType:"navigation",startTime:0,unloadEventStart:t.unloadEventStart>0?t.unloadEventStart-n:0,promptForUnload:t.unloadEventEnd-t.unloadEventStart,redirectStart:t.redirectStart>0?t.redirectStart-n:0,redirectTime:t.redirectEnd-t.redirectStart,fetchStart:t.fetchStart>0?t.fetchStart-n:0,domainLookupStart:t.domainLookupStart>0?t.domainLookupStart-n:0,dns:t.domainLookupEnd-t.domainLookupStart,connectStart:t.connectStart>0?t.connectStart-n:0,connect:t.connectEnd-t.connectStart,secureConnectionStart:t.secureConnectionStart>0?t.secureConnectionStart-n:0,tlsTime:t.secureConnectionStart>0?t.connectEnd-t.secureConnectionStart:0,requestStart:t.requestStart>0?t.requestStart-n:0,timeToFirstByte:t.responseStart-t.requestStart,responseStart:t.responseStart>0?t.responseStart-n:0,responseTime:t.responseStart>0?t.responseEnd-t.responseStart:0,domInteractive:t.domInteractive>0?t.domInteractive-n:0,domContentLoadedEventStart:t.domContentLoadedEventStart>0?t.domContentLoadedEventStart-n:0,domContentLoaded:t.domContentLoadedEventEnd-t.domContentLoadedEventStart,domComplete:t.domComplete>0?t.domComplete-n:0,domProcessingTime:t.loadEventStart-t.responseEnd,loadEventStart:t.loadEventStart>0?t.loadEventStart-n:0,loadEventTime:t.loadEventEnd-t.loadEventStart,duration:t.loadEventEnd-t.navigationStart,navigationTimingLevel:1};(null===(e=this.context)||void 0===e?void 0:e.record)&&this.context.record(O,r)},0)},this.performanceNavigationEventHandlerTimingLevel2=e=>{var t;const n={version:"1.0.0",initiatorType:e.initiatorType,navigationType:e.type,startTime:e.startTime,unloadEventStart:e.unloadEventStart,promptForUnload:e.unloadEventEnd-e.unloadEventStart,redirectCount:e.redirectCount,redirectStart:e.redirectStart,redirectTime:e.redirectEnd-e.redirectStart,workerStart:e.workerStart,workerTime:e.workerStart>0?e.fetchStart-e.workerStart:0,fetchStart:e.fetchStart,domainLookupStart:e.domainLookupStart,dns:e.domainLookupEnd-e.domainLookupStart,nextHopProtocol:e.nextHopProtocol,connectStart:e.connectStart,connect:e.connectEnd-e.connectStart,secureConnectionStart:e.secureConnectionStart,tlsTime:e.secureConnectionStart>0?e.connectEnd-e.secureConnectionStart:0,requestStart:e.requestStart,timeToFirstByte:e.responseStart-e.requestStart,responseStart:e.responseStart,responseTime:e.responseStart>0?e.responseEnd-e.responseStart:0,domInteractive:e.domInteractive,domContentLoadedEventStart:e.domContentLoadedEventStart,domContentLoaded:e.domContentLoadedEventEnd-e.domContentLoadedEventStart,domComplete:e.domComplete,domProcessingTime:e.loadEventStart-e.responseEnd,loadEventStart:e.loadEventStart,loadEventTime:e.loadEventEnd-e.loadEventStart,duration:e.duration,headerSize:e.transferSize>0?e.transferSize-e.encodedBodySize:0,transferSize:e.transferSize,compressionRatio:e.encodedBodySize>0?e.decodedBodySize/e.encodedBodySize:0,navigationTimingLevel:2};(null===(t=this.context)||void 0===t?void 0:t.record)&&this.context.record(O,n)},this.config=Object.assign(Object.assign({},ln),e)}enable(){this.enabled||(this.enabled=!0,window.addEventListener(hn,this.eventListener))}disable(){this.enabled&&(this.enabled=!1,this.eventListener&&window.removeEventListener(hn,this.eventListener))}hasTheWindowLoadEventFired(){if(window.performance&&window.performance.getEntriesByType(un).length){const e=window.performance.getEntriesByType(un)[0];return Boolean(e.loadEventEnd)}return!1}onload(){this.enabled&&(this.hasTheWindowLoadEventFired()?window.performance.getEntriesByType(un).filter(e=>
2!this.config.ignore(e)).forEach(e=>this.performanceNavigationEventHandlerTimingLevel2(e)):window.addEventListener(hn,this.eventListener))}}const pn="resource";class mn extends Me{constructor(e){super("resource"),this.performanceEntryHandler=e=>{this.recordPerformanceEntries(e.getEntries())},this.recordPerformanceEntries=e=>{e.forEach(e=>{if(e.entryType!==pn||this.config.ignore(e))return;const{name:t,initiatorType:n}=e,r=cn(t,n);this.config.recordAllTypes.includes(r)?this.recordResourceEvent(e):this.config.sampleTypes.includes(r)&&this.eventCount<this.config.eventLimit&&(this.recordResourceEvent(e),this.eventCount++)})},this.recordResourceEvent=({name:e,startTime:t,initiatorType:n,duration:r,transferSize:i})=>{var s;if(!((e,t)=>{try{return new URL(e).hostname===t&&dn.test(e)}catch(e){return!1}})(e,this.context.config.endpointUrl.hostname)&&(null===(s=this.context)||void 0===s?void 0:s.record)){const s={version:"1.0.0",initiatorType:n,startTime:t,duration:r,fileType:cn(e,n),transferSize:i};this.context.config.recordResourceUrl&&(s.targetUrl=e),this.context.record(x,s)}},this.config=Object.assign(Object.assign({},ln),e),this.eventCount=0,this.resourceObserver=new PerformanceObserver(this.performanceEntryHandler)}enable(){this.enabled||(this.enabled=!0,this.resourceObserver.observe({type:pn,buffered:!0}))}disable(){this.enabled&&(this.enabled=!1,this.resourceObserver.disconnect())}onload(){this.resourceObserver.observe({type:pn,buffered:!0})}}var fn,vn,yn=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},bn=function(e){if("loading"===document.readyState)return"loading";var t=yn();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},In=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Cn=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var r=e,i=r.id?"#"+r.id:In(r)+(r.classList&&r.classList.value&&r.classList.value.trim()&&r.classList.value.trim().length?"."+r.classList.value.trim().replace(/\s+/g,"."):"");if(n.length+i.length>(t||100)-1)return n||i;if(n=n?i+">"+n:i,r.id)break;e=r.parentNode}}catch(e){}return n},Sn=-1,wn=function(){return Sn},An=function(e){addEventListener("pageshow",function(t){t.persisted&&(Sn=t.timeStamp,e(t))},!0)},En=function(){var e=yn();return e&&e.activationStart||0},Tn=function(e,t){var n=yn(),r="navigate";return wn()>=0?r="back-forward-cache":n&&(document.prerendering||En()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},kn=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver(function(e){Promise.resolve().then(function(){t(e.getEntries())})});return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},Rn=function(e,t,n,r){var i,s;return function(o){t.value>=0&&(o||r)&&((s=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=s,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Mn=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},Ln=function(e){document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e()})},On=function(e){var t=!1;return function(){t||(e(),t=!0)}},xn=-1,Dn=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Nn=function(e){"hidden"===document.visibilityState&&xn>-1&&(xn="visibilitychange"===e.type?e.timeStamp:0,Fn())},Pn=function(){addEventListener("visibilitychange",Nn,!0),addEventListener("prerenderingchange",Nn,!0)},Fn=function(){removeEventListener("visibilitychange",Nn,!0),removeEventListener("prerenderingchange",Nn,!0)},Un=function(){return xn<0&&(xn=Dn(),Pn(),An(function(){setTimeout(function(){xn=Dn(),Pn()},0)})),{get firstHiddenTime(){return xn}}},Bn=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},Wn=[1800,3e3],Hn=function(e,t){t=t||{},Bn(function(){var n,r=Un(),i=Tn("FCP"),s=kn("paint",function(e){e.forEach(function(e){"first-contentful-paint"===e.name&&(s.disconnect(),e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-En(),0),i.entries.push(e),n(!0)))})});s&&(n=Rn(e,i,Wn,t.reportAllChanges),An(function(r){i=Tn("FCP"),n=Rn(e,i,Wn,t.reportAllChanges),Mn(function(){i.value=performance.now()-r.timeStamp,n(!0)})}))})},jn=[.1,.25],Vn=0,_n=1/0,qn=0,Gn=function(e){e.forEach(function(e){e.interactionId&&(_n=Math.min(_n,e.interactionId),qn=Math.max(qn,e.interactionId),Vn=qn?(qn-_n)/7+1:0)})},$n=function(){return fn?Vn:performance.interactionCount||0},Kn=function(){"interactionCount"in performance||fn||(fn=kn("event",Gn,{type:"event",buffered:!0,durationThreshold:0}))}
2,Zn=[],zn=new Map,Jn=0,Yn=[],Xn=function(e){if(Yn.forEach(function(t){return t(e)}),e.interactionId||"first-input"===e.entryType){var t=Zn[Zn.length-1],n=zn.get(e.interactionId);if(n||Zn.length<10||e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};zn.set(r.id,r),Zn.push(r)}Zn.sort(function(e,t){return t.latency-e.latency}),Zn.length>10&&Zn.splice(10).forEach(function(e){return zn.delete(e.id)})}}},Qn=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=On(e),"hidden"===document.visibilityState?e():(n=t(e),Ln(e)),n},er=[200,500],tr=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},Bn(function(){var n;Kn();var r,i=Tn("INP"),s=function(e){Qn(function(){e.forEach(Xn);var t=function(){var e=Math.min(Zn.length-1,Math.floor(($n()-Jn)/50));return Zn[e]}();t&&t.latency!==i.value&&(i.value=t.latency,i.entries=t.entries,r())})},o=kn("event",s,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});r=Rn(e,i,er,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),Ln(function(){s(o.takeRecords()),r(!0)}),An(function(){Jn=$n(),Zn.length=0,zn.clear(),i=Tn("INP"),r=Rn(e,i,er,t.reportAllChanges)}))}))},nr=[],rr=[],ir=0,sr=new WeakMap,or=new Map,ar=-1,cr=function(e){nr=nr.concat(e),dr()},dr=function(){ar<0&&(ar=Qn(lr))},lr=function(){or.size>10&&or.forEach(function(e,t){zn.has(t)||or.delete(t)});var e=Zn.map(function(e){return sr.get(e.entries[0])}),t=rr.length-50;rr=rr.filter(function(n,r){return r>=t||e.includes(n)});for(var n=new Set,r=0;r<rr.length;r++){var i=rr[r];mr(i.startTime,i.processingEnd).forEach(function(e){n.add(e)})}var s=nr.length-1-50;nr=nr.filter(function(e,t){return e.startTime>ir&&t>s||n.has(e)}),ar=-1};
2Yn.push(function(e){e.interactionId&&e.target&&!or.has(e.interactionId)&&or.set(e.interactionId,e.target)},function(e){var t,n=e.startTime+e.duration;ir=Math.max(ir,e.processingEnd);for(var r=rr.length-1;r>=0;r--){var i=rr[r];if(Math.abs(n-i.renderTime)<=8){(t=i).startTime=Math.min(e.startTime,t.startTime),t.processingStart=Math.min(e.processingStart,t.processingStart),t.processingEnd=Math.max(e.processingEnd,t.processingEnd),t.entries.push(e);break}}t||(t={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:[e]},rr.push(t)),(e.interactionId||"first-input"===e.entryType)&&sr.set(e,t),dr()});var ur,hr,gr,pr,mr=function(e,t){for(var n,r=[],i=0;n=nr[i];i++)if(!(n.startTime+n.duration<e)){if(n.startTime>t)break;r.push(n)}return r},fr=[2500,4e3],vr={},yr=[800,1800],br=function e(t){document.prerendering?Bn(function(){return e(t)}):"complete"!==document.readyState?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},Ir=function(e,t){t=t||{};var n=Tn("TTFB"),r=Rn(e,n,yr,t.reportAllChanges);br(function(){var i=yn();i&&(n.value=Math.max(i.responseStart-En(),0),n.entries=[i],r(!0),An(function(){n=Tn("TTFB",0),(r=Rn(e,n,yr,t.reportAllChanges))(!0)}))})},Cr={passive:!0,capture:!0},Sr=new Date,wr=function(e,t){ur||(ur=t,hr=e,gr=new Date,Tr(removeEventListener),Ar())},Ar=function(){if(hr>=0&&hr<gr-Sr){var e={entryType:"first-input",name:ur.type,target:ur.target,cancelable:ur.cancelable,startTime:ur.timeStamp,processingStart:ur.timeStamp+hr};pr.forEach(function(t){t(e)}),pr=[]}},Er=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){wr(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,Cr),removeEventListener("pointercancel",r,Cr)};addEventListener("pointerup",n,Cr),addEventListener("pointercancel",r,Cr)}(t,e):wr(t,e)}},Tr=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach(function(t){return e(t,Er,Cr)})},kr=[100,300],Rr=function(e,t){!function(e,t){t=t||{},Bn(function(){var n,r=Un(),i=Tn("FID"),s=function(e){e.startTime<r.firstHiddenTime&&(i.value=e.processingStart-e.startTime,i.entries.push(e),n(!0))},o=function(e){e.forEach(s)},a=kn("first-input",o);n=Rn(e,i,kr,t.reportAllChanges),a&&(Ln(On(function(){o(a.takeRecords()),a.disconnect()})),An(function(){var r;i=Tn("FID"),n=Rn(e,i,kr,t.reportAllChanges),pr=[],hr=-1,ur=null,Tr(addEventListener),r=s,pr.push(r),Ar()}))})}(function(t){var n=function(e){var t=e.entries[0],n={eventTarget:Cn(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:bn(t.startTime)};return Object.assign(e,{attribution:n})}(t);e(n)},t)};class Mr extends Me{constructor(e){super("web-vitals"),this.resourceEventIds=new Map,this.cacheLCPCandidates=PerformanceObserver.supportedEntryTypes.includes("largest-contentful-paint"),this.handleEvent=e=>{switch(e.type){case x:const t=e.details;this.cacheLCPCandidates&&t.fileType===rn.IMAGE&&this.resourceEventIds.set(on(e.details),e.id);break;case O:this.navigationEventId=e.id}},this.config=Object.assign(Object.assign({},ln),e)}enable(){}disable(){}onload(){this.context.eventBus.subscribe(d.EVENT,this.handleEvent),function(e,t){!function(e,t){t=t||{},Bn(function(){var n,r=Un(),i=Tn("LCP"),s=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach(function(e){e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-En(),0),i.entries=[e],n())})},o=kn("largest-contentful-paint",s);if(o){n=Rn(e,i,fr,t.reportAllChanges);var a=On(function(){vr[i.id]||(s(o.takeRecords()),o.disconnect(),vr[i.id]=!0,n(!0))});["keydown","click"].forEach(function(e){addEventListener(e,function(){return Qn(a)},{once:!0,capture:!0})}),Ln(a),An(function(r){i=Tn("LCP"),n=Rn(e,i,fr,t.reportAllChanges),Mn(function(){i.value=performance.now()-r.timeStamp,vr[i.id]=!0,n(!0)})})}})}(function(t){var n=function(e){var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var n=yn();if(n){var r=n.activationStart||0,i=e.entries[e.entries.length-1],s=i.url&&performance.getEntriesByType("resource").filter(function(e){return e.name===i.url})[0],o=Math.max(0,n.responseStart-r),a=Math.max(o,s?(s.requestStart||s.startTime)-r:0),c=Math.max(a,s?s.responseEnd-r:0),d=Math.max(c,i.startTime-r);t={element:Cn(i.element),timeToFirstByte:o,resourceLoadDelay:a-o,resourceLoadDuration:c-a,elementRenderDelay:d-c,navigationEntry:n,lcpEntry:i},i.url&&(t.url=i.url),s&&(t.lcpResourceEntry=s)}}return Object.assign(e,{attribution:t})}(t);e(n)},t)}(e=>this.handleLCP(e),{reportAllChanges:this.config.reportAllLCP}),Rr(e=>this.handleFID(e)),function(e,t){!function(e,t){t=t||{},Hn(On(function(){var n,r=Tn("CLS",0),i=0,s=[],o=function(e){e.forEach(function(e){if(!e.hadRecentInput){var t=s[0],n=s[s.length-1];i&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(i+=e.value,s.push(e)):(i=e.value,s=[e])}}),i>r.value&&(r.value=i,r.entries=s,n())},a=kn("layout-shift",o);a&&(n=Rn(e,r,jn,t.reportAllChanges),Ln(function(){o(a.takeRecords()),n(!0)}),An(function(){i=0,r=Tn("CLS",0),n=Rn(e,r,jn,t.reportAllChanges),Mn(function(){return n()})}),setTimeout(n,0))}
2))}(function(t){var n=function(e){var t,n={};if(e.entries.length){var r=e.entries.reduce(function(e,t){return e&&e.value>t.value?e:t});if(r&&r.sources&&r.sources.length){var i=(t=r.sources).find(function(e){return e.node&&1===e.node.nodeType})||t[0];i&&(n={largestShiftTarget:Cn(i.node),largestShiftTime:r.startTime,largestShiftValue:r.value,largestShiftSource:i,largestShiftEntry:r,loadState:bn(r.startTime)})}}return Object.assign(e,{attribution:n})}(t);e(n)},t)}(e=>this.handleCLS(e),{reportAllChanges:!0}),function(e,t){vn||(vn=kn("long-animation-frame",cr)),tr(function(t){var n=function(e){var t=e.entries[0],n=sr.get(t),r=t.processingStart,i=n.processingEnd,s=n.entries.sort(function(e,t){return e.processingStart-t.processingStart}),o=mr(t.startTime,i),a=e.entries.find(function(e){return e.target}),c=a&&a.target||or.get(t.interactionId),d=[t.startTime+t.duration,i].concat(o.map(function(e){return e.startTime+e.duration})),l=Math.max.apply(Math,d),u={interactionTarget:Cn(c),interactionTargetElement:c,interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:l,processedEventEntries:s,longAnimationFrameEntries:o,inputDelay:r-t.startTime,processingDuration:i-r,presentationDelay:Math.max(l-i,0),loadState:bn(t.startTime)};return Object.assign(e,{attribution:u})}(t);e(n)},t)}(e=>this.handleINP(e),{reportAllChanges:!0}),function(e,t){Hn(function(t){var n=function(e){var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:bn(wn())};if(e.entries.length){var n=yn(),r=e.entries[e.entries.length-1];if(n){var i=n.activationStart||0,s=Math.max(0,n.responseStart-i);t={timeToFirstByte:s,firstByteToFCP:e.value-s,loadState:bn(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})}(t);e(n)},t)}(e=>this.handleFCP(e)),function(e,t){Ir(function(t){var n=function(e){var t={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(e.entries.length){var n=e.entries[0],r=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-r,0),s=Math.max(n.domainLookupStart-r,0),o=Math.max(n.connectStart-r,0),a=Math.max(n.connectEnd-r,0);t={waitingDuration:i,cacheDuration:s-i,dnsDuration:o-s,connectionDuration:a-o,requestDuration:e.value-a,navigationEntry:n}}return Object.assign(e,{attribution:t})}(t);e(n)},t)}(e=>this.handleTTFB(e))}handleLCP(e){var t,n;const r=e.attribution,i={element:null==r?void 0:r.element,url:null==r?void 0:r.url,t
2imeToFirstByte:null==r?void 0:r.timeToFirstByte,resourceLoadDelay:null==r?void 0:r.resourceLoadDelay,resourceLoadTime:null==r?void 0:r.resourceLoadDuration,elementRenderDelay:null==r?void 0:r.elementRenderDelay};if(null==r?void 0:r.lcpResourceEntry){const e=on(null==r?void 0:r.lcpResourceEntry);i.lcpResourceEntry=this.resourceEventIds.get(e)}this.navigationEventId&&(i.navigationEntry=this.navigationEventId),null===(t=this.context)||void 0===t||t.record(E,{version:"1.0.0",value:e.value,attribution:i}),null===(n=this.context)||void 0===n||n.eventBus.unsubscribe(d.EVENT,this.handleEvent),this.resourceEventIds.clear(),this.navigationEventId=void 0}handleCLS(e){const t=e.attribution,{record:n,recordCandidate:r}=this.context;(this.config.reportAllCLS?n:r)(k,{version:"1.0.0",value:e.value,attribution:{largestShiftTarget:null==t?void 0:t.largestShiftTarget,largestShiftValue:null==t?void 0:t.largestShiftValue,largestShiftTime:null==t?void 0:t.largestShiftTime,loadState:null==t?void 0:t.loadState}})}handleFID(e){var t;const n=e.attribution;null===(t=this.context)||void 0===t||t.record(T,{version:"1.0.0",value:e.value,attribution:{eventTarget:null==n?void 0:n.eventTarget,eventType:null==n?void 0:n.eventType,eventTime:null==n?void 0:n.eventTime,loadState:null==n?void 0:n.loadState}})}handleINP(e){const t=e.attribution,{record:n,recordCandidate:r}=this.context;(this.config.reportAllINP?n:r)(R,{version:"1.0.0",value:e.value,attribution:{interactionTarget:null==t?void 0:t.interactionTarget,interactionTime:null==t?void 0:t.interactionTime,nextPaintTime:null==t?void 0:t.nextPaintTime,interactionType:null==t?void 0:t.interactionType,inputDelay:null==t?void 0:t.inputDelay,processingDuration:null==t?void 0:t.processingDuration,presentationDelay:null==t?void 0:t.presentationDelay,loadState:null==t?void 0:t.loadState}})}handleFCP(e){var t;const n=e.attribution;null===(t=this.context)||void 0===t||t.record(M,{version:"1.0.0",value:e.value,attribution:{timeToFirstByte:null==n?void 0:n.timeToFirstByte,firstByteToFCP:null==n?void 0:n.firstByteToFCP,loadState:null==n?void 0:n.loadState}})}handleTTFB(e){var t;const n=e.attribution;null===(t=this.context)||void 0===t||t.record(L,{version:"1.0.0",value:e.value,attribution:{waitingDuration:null==n?void 0:n.waitingDuration,cacheDuration:null==n?void 0:n.cacheDuration,dnsDuration:null==n?void 0:n.dnsDuration,connectionDuration:null==n?void 0:n.connectionDuration,requestDuration:null==n?void 0:n.requestDuration}})}}class Lr extends Error{constructor(e){super(e),this.name="XMLHttpRequest error"}}class Or extends xe{constructor(e){super("xhr"),this.addXRayTraceIdHeader=e=>oe(e,this.config.addXRayTraceIdHeader),this.isTracingEnabled=()=>this.context.config.enableXRay,this.isSessionRecorded=()=>{var e;return(null===(e=this.context.getSession())||void 0===e?void 0:e.record)||!1},this.handleXhrLoadEvent=e=>{const t=e.target,n=this.xhrMap.get(t);if(n){const e=ge();n.trace.end_time=e,n.trace.subsegments[0].end_time=e,n.trace.subsegments[0].http.response={status:t.status},ue(t.status)?(n.trace.subsegments[0].throttle=!0,n.trace.throttle=!0):de(t.status)?(n.trace.subsegments[0].error=!0,n.trace.error=!0):le(t.status)&&(n.trace.subsegments[0].fault=!0,n.trace.fault=!0);const r=t.getResponseHeader("Content-Length"),i=r?parseInt(r,10):NaN;isNaN(i)||(n.trace.subsegments[0].http.response.content_length=i),this.recordTraceEvent(n.trace),this.recordHttpEventWithResponse(n,t)}},this.handleXhrErrorEvent=e=>{const t=e.target,n=this.xhrMap.get(t),r=t.statusText?t.status.toString()+": "+t.statusText:t.status.toString();if(n){const e=ge();n.trace.fault=!0,n.trace.end_time=e,n.trace.subsegments[0].end_time=e,n.trace.subsegments[0].fault=!0,n.trace.subsegments[0].cause={exceptions:[{type:"XMLHttpRequest error",message:r}]},this.recordTraceEvent(n.trace),this.recordHttpEventWithError(n,t,new Lr(r))}},this.handleXhrAbortEvent=e=>{const t=e.target,n=this.xhrMap.get(t);n&&this.handleXhrDetailsOnError(n,t,"XMLHttpRequest abort")},this.handleXhrTimeoutEvent=e=>{const t=e.target,n=this.xhrMap.get(t);this.handleXhrDetailsOnError(n,t,"XMLHttpRequest timeout")},this.initializeTrace=e=>{const t=ge();e.trace=pe(this.config.logicalServiceName,t,this.context.config.enableW3CTraceId),e.trace.subsegments.push(me(fe(e.url),t,{request:{method:e.method,url:e.url,traced:!0}}))},this.sendWrapper=()=>{const e=this;return t=>function(){const n=e.xhrMap.get(this);return n&&(this.addEventListener("load",e.handleXhrLoadEvent),this.addEventListener("error",e.handleXhrErrorEvent),this.addEventListener("abort",e.handleXhrAbortEvent),this.addEventListener("timeout",e.handleXhrTimeoutEvent),e.initializeTrace(n),!e.isSyntheticsUA&&e.isTracingEnabled()&&e.addXRayTraceIdHeader(n.url)&&e.isSessionRecorded()&&(e.context.config.enableW3CTraceId?this.setRequestHeader(se,ye(n.trace.trace_id,n.trace.subsegments[0].id)):this.setRequestHeader(ie,ve(n.trace.trace_id,n.trace.subsegments[0].id)))),t.apply(this,arguments)}},this.openWrapper=()=>{const e=this;return t=>function(n,r,i){return he(r,e.config)&&e.xhrMap.set(this,{url:r,method:n,async:i}),t.apply(this,arguments)}},this.config=Object.assign(Object.assign({},ae),e),this.xhrMap=new Map,this.isSyntheticsUA=navigator.userAgent.includes("CloudWatchSynthetics")}onload(){this.enable()}get patches(){return[{nodule:XMLHttpRequest.prototype,name:"send",wrapper:this.sendWrapper},{nodule:XMLHttpRequest.prototype,name:"open",wrapper:this.openWrapper}]}handleXhrDetailsOnError(e,t,n){if(e){const r=ge();e.trace.end_time=r,e.trace.subsegments[0].end_time=r,e.trace.subsegments[0].error=!0,e.trace.subsegments[0].cause={exceptions:[{type:n}]},this.recordTraceEvent(e.trace),this.recordHttpEventWithError(e,t,n)}}statusOk(e){return e>=200&&e<300}recordHttpEventWithResponse(e,t){this.xhrMap.delete(t);const n={version:"1.0.0",request:{method:e.method,url:e.url},response:{status:t.status,statusText:t.statusText}};this.isTracingEnabled()&&(n.trace_id=e.trace.trace_id,n.segment_id=e.trace.subsegments[0].id),!this.config.recordAllRequests&&this.statusOk(t.status)||this.context.record(w,n)}recordHttpEventWithError(e,t,n){this.xhrMap.delete(t);const r={version:"1.0.0",request:{method:e.method,url:e.url},error:Jt({type:"error",error:n},this.config.stackTraceLength)};this.isTracingEnabled()&&(r.trace_id=e.trace.trace_id,r.segment_id=e.trace.subsegments[0].id),this.context.record(w,r)}recordTraceEvent(e){!this.isSyntheticsUA&&this.isTracingEnabled()&&this.isSessionRecorded()&&this.context.record(A,e)}}class xr extends xe{constructor(e){super("fetch"),this.isTracingEnabled=()=>this.context.config.enableXRay,this.isSessionRecorded=()=>{var e;return(null===(e=this.context.getSession())||void 0===e?void 0:e.record)||!1},this.beginTrace=(e,t,n)=>{const r=ge(),i=((e,t,n)=>{const r={request:{}};return r.request.method=(null==t?void 0:t.method)?t.method:"GET",r.request.traced=n,r.request.url=be(e),r})(e,t,!0),s=pe(this.config.logicalServiceName,r,this.context.config.enableW3CTraceId),o=me(fe(e),r,i);return s.subsegments.push(o),this.isTraceIdHeaderEnabled(e)&&this.addXRayTraceIdHeader(e,t,n,s),s},this.addXRayTraceIdHeader=(e,t,n,r)=>{if(e.headers)return i=e.headers,s=r.trace_id,o=r.subsegments[0].id,void(this.context.config.enableW3CTraceId?i.set(se,ye(s,o)):i.set(ie,ve(s,o)));var i,s,o;t||(t={},[].push.call(n,t)),((e,t,n,r)=>{e.headers||(e.headers={}),r?e.headers[se]=ye(t,n):e.headers[ie]=ve(t,n)})(t,r.trace_id,r.subsegments[0].id,this.context.config.enableW3CTraceId)},this.endTrace=(e,t,n)=>{if(e){const r=ge();if(e.subsegments[0].end_time=r,e.end_time=r,t){e.subsegments[0].http.response={status:t.status},ue(t.status)?(e.subsegments[0].throttle=!0,e.throttle=!0):de(t.
2status)?(e.subsegments[0].error=!0,e.error=!0):le(t.status)&&(e.subsegments[0].fault=!0,e.fault=!0);const n=t.headers.get("Content-Length"),r=n?parseInt(n,10):NaN;isNaN(r)||(e.subsegments[0].http.response.content_length=r)}n&&(e.fault=!0,e.subsegments[0].fault=!0,n instanceof Object?this.appendErrorCauseFromObject(e.subsegments[0],n):zt(n)&&this.appendErrorCauseFromPrimitive(e.subsegments[0],n.toString())),this.context.record(A,e)}},this.createHttpEvent=(e,t)=>{const n=e;return{version:"1.0.0",request:{url:be(e),method:(null==t?void 0:t.method)?t.method:n.method?n.method:"GET"}}},this.recordHttpEventWithResponse=(e,t)=>{!this.config.recordAllRequests&&t.ok||(e.response={status:t.status,statusText:t.statusText},this.context.record(w,e))},this.recordHttpEventWithError=(e,t)=>{e.error=Jt({type:"error",error:t},this.config.stackTraceLength),this.context.record(w,e)},this.fetch=(e,t,n,r,i)=>{const s=this.createHttpEvent(r,i);let o;if(!he(be(r),this.config))return e.apply(t,n);const a=((e,t)=>{var n,r;const i={};if(e)if(t){const t=null===(n=e.get(se))||void 0===n?void 0:n.split("-");t&&(e=>4===(null==e?void 0:e.length)&&2===e[0].length&&32===e[1].length&&16===e[2].length&&("00"===e[3]||"01"===e[3]))(t)&&(i.traceId=t[1],i.segmentId=t[2])}else{const t=null===(r=e.get(ie))||void 0===r?void 0:r.split(";");3===(null==t?void 0:t.length)&&(i.traceId=t[0].split("Root=")[1],i.segmentId=t[1].split("Parent=")[1])}return i})(r.headers,this.context.config.enableW3CTraceId);return a.traceId&&a.segmentId?(s.trace_id=a.traceId,s.segment_id=a.segmentId):this.isTracingEnabled()&&this.isSessionRecorded()&&(o=this.beginTrace(r,i,n),s.trace_id=o.trace_id,s.segment_id=o.subsegments[0].id),e.apply(t,n).then(e=>(this.endTrace(o,e,void 0),this.recordHttpEventWithResponse(s,e),e)).catch(e=>{throw this.endTrace(o,void 0,e),this.recordHttpEventWithError(s,e),e})},this.fetchWrapper=()=>{const e=this;return t=>function(n,r){return e.fetch(t,this,arguments,n,r)}},this.config=Object.assign(Object.assign({},ae),e)}get patches(){return[{nodule:window,name:"fetch",wrapper:this.fetchWrapper}]}onload(){this.enable()}isTraceIdHeaderEnabled(e){const t=be(e);return oe(t,this.config.addXRayTraceIdHeader)}appendErrorCauseFromPrimitive(e,t){e.cause={exceptions:[{type:t}]}}appendErrorCauseFromObject(e,t){e.cause={exceptions:[{type:t.name,message:t.message}]}}}var Dr;function Nr(e){return e.nodeType===e.ELEMENT_NODE}function Pr(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function Fr(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function Ur(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(Br).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function Br(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=Ur(e.styleSheet)||t}catch(e){}return t}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(Dr||(Dr={}));var Wr=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(function(e){return t.removeNodeFromMap(e)})},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Hr(e){var t=e.maskInputOptions,n=e.tagName,r=e.type,i=e.value,s=e.maskInputFn,o=i||"";return(t[n.toLowerCase()]||t[r])&&(o=s?s(o):"*".repeat(o.length)),o}var jr="__rrweb_original__";var Vr,_r,qr=1,Gr=new RegExp("[^a-z0-9-_:]");function $r(){return qr++}var Kr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Zr=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,zr=/^(data:)([^,]*),(.*)/i;function Jr(e,t){return(e||"").replace(Kr,function(e,n,r,i,s,o){var a,c=r||s||o,d=n||i||"";if(!c)return e;
2if(!Zr.test(c))return"url(".concat(d).concat(c).concat(d,")");if(zr.test(c))return"url(".concat(d).concat(c).concat(d,")");if("/"===c[0])return"url(".concat(d).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(d,")");var l=t.split("/"),u=c.split("/");l.pop();for(var h=0,g=u;h<g.length;h++){var p=g[h];"."!==p&&(".."===p?l.pop():l.push(p))}return"url(".concat(d).concat(l.join("/")).concat(d,")")})}var Yr=/^[^ \t\n\r\u000c]+/,Xr=/^[, \t\n\r\u000c]+/;function Qr(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function ei(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function ti(){var e=document.createElement("a");return e.href="",e.href}function ni(e,t,n,r){return"src"===n||"href"===n&&r&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&r&&"#"!==r[0]?Qr(e,r):"background"!==n||!r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&r?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}for(var i=[];r(Xr),!(n>=t.length);){var s=r(Yr);if(","===s.slice(-1))s=Qr(e,s.substring(0,s.length-1)),i.push(s);else{var o="";s=Qr(e,s);for(var a=!1;;){var c=t.charAt(n);if(""===c){i.push((s+o).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,i.push((s+o).trim());break}"("===c&&(a=!0)}o+=c,n+=1}}}return i.join(", ")}(e,r):"style"===n&&r?Jr(r,ti()):"object"===t&&"data"===n&&r?Qr(e,r):r:Qr(e,r)}function ri(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&ri(e.parentNode,t,n);for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return!!n&&ri(e.parentNode,t,n)}function ii(e,t,n){var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(r.closest(".".concat(t)))return!0}else if(ri(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}return!1}function si(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,s=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,c=t.inlineStylesheet,d=t.maskInputOptions,l=void 0===d?{}:d,u=t.maskTextFn,h=t.maskInputFn,g=t.dataURLOptions,p=void 0===g?{}:g,m=t.inlineImages,f=t.recordCanvas,v=t.keepIframeSrcFn,y=t.newlyAddedElement,b=void 0!==y&&y,I=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Dr.Document,childNodes:[],compatMode:e.compatMode}:{type:Dr.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Dr.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:I};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,s=t.inlineStylesheet,o=t.maskInputOptions,a=void 0===o?{}:o,c=t.maskInputFn,d=t.dataURLOptions,l=void 0===d?{}:d,u=t.inlineImages,h=t.recordCanvas,g=t.keepIframeSrcFn,p=t.newlyAddedElement,m=void 0!==p&&p,f=t.rootId,v=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return!!n&&e.matches(n)}(e,r,i),y=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return Gr.test(t)?"div":t}(e),b={},I=e.attributes.length,C=0;C<I;C++){var S=e.attributes[C];b[S.name]=ni(n,y,S.name,S.value)}if("link"===y&&s){var w=Array.from(n.styleSheets).find(function(t){return t.href===e.href}),A=null;w&&(A=Ur(w)),A&&(delete b.rel,delete b.href,b._cssText=Jr(A,w.href))}if("style"===y&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(A=Ur(e.sheet))&&(b._cssText=Jr(A,ti()))}if("input"===y||"textarea"===y||"select"===y){var E=e.value,T=e.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&E?b.value=Hr({type:b.type,tagName:y,value:E,maskInputOptions:a,maskInputFn:c}):T&&(b.checked=T)}"option"===y&&(e.selected&&!a.select?b.selected=!0:delete b.selected);if("canvas"===y&&h)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var i=t.getImageData,s=jr in i?i[jr]:i;
2if(new Uint32Array(s.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some(function(e){return 0!==e}))return!1}return!0})(e)||(b.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){var k=e.toDataURL(l.type,l.quality),R=document.createElement("canvas");R.width=e.width,R.height=e.height,k!==R.toDataURL(l.type,l.quality)&&(b.rr_dataURL=k)}if("img"===y&&u){Vr||(Vr=n.createElement("canvas"),_r=Vr.getContext("2d"));var M=e,L=M.crossOrigin;M.crossOrigin="anonymous";var O=function(){try{Vr.width=M.naturalWidth,Vr.height=M.naturalHeight,_r.drawImage(M,0,0),b.rr_dataURL=Vr.toDataURL(l.type,l.quality)}catch(e){console.warn("Cannot inline img src=".concat(M.currentSrc,"! Error: ").concat(e))}L?b.crossOrigin=L:M.removeAttribute("crossorigin")};M.complete&&0!==M.naturalWidth?O():M.onload=O}"audio"!==y&&"video"!==y||(b.rr_mediaState=e.paused?"paused":"played",b.rr_mediaCurrentTime=e.currentTime);m||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop));if(v){var x=e.getBoundingClientRect(),D=x.width,N=x.height;b={class:b.class,rr_width:"".concat(D,"px"),rr_height:"".concat(N,"px")}}"iframe"!==y||g(b.src)||(e.contentDocument||(b.rr_src=b.src),delete b.src);return{type:Dr.Element,tagName:y,attributes:b,childNodes:[],isSVG:ei(e)||void 0,needBlock:v,rootId:f}}(e,{doc:n,blockClass:i,blockSelector:s,inlineStylesheet:c,maskInputOptions:l,maskInputFn:h,dataURLOptions:p,inlineImages:m,recordCanvas:f,keepIframeSrcFn:v,newlyAddedElement:b,rootId:I});case e.TEXT_NODE:return function(e,t){var n,r=t.maskTextClass,i=t.maskTextSelector,s=t.maskTextFn,o=t.rootId,a=e.parentNode&&e.parentNode.tagName,c=e.textContent,d="STYLE"===a||void 0,l="SCRIPT"===a||void 0;if(d&&c){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(c=(u=e.parentNode.sheet).cssRules?Array.from(u.cssRules).map(function(e){return e.cssText||""}).join(""):"")}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=Jr(c,ti())}var u;l&&(c="SCRIPT_PLACEHOLDER");!d&&!l&&c&&ii(e,r,i)&&(c=s?s(c):c.replace(/[\S]/g,"*"));return{type:Dr.Text,textContent:c||"",isStyle:d,rootId:o}}(e,{maskTextClass:o,maskTextSelector:a,maskTextFn:u,rootId:I});case e.CDATA_SECTION_NODE:return{type:Dr.CDATA,textContent:"",rootId:I};case e.COMMENT_NODE:return{type:Dr.Comment,textContent:e.textContent||"",rootId:I};default:return!1}}function oi(e){return void 0===e?"":e.toLowerCase()}function ai(e,t){var n,r=t.doc,i=t.mirror,s=t.blockClass,o=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,d=t.skipChild,l=void 0!==d&&d,u=t.inlineStylesheet,h=void 0===u||u,g=t.maskInputOptions,p=void 0===g?{}:g,m=t.maskTextFn,f=t.maskInputFn,v=t.slimDOMOptions,y=t.dataURLOptions,b=void 0===y?{}:y,I=t.inlineImages,C=void 0!==I&&I,S=t.recordCanvas,w=void 0!==S&&S,A=t.onSerialize,E=t.onIframeLoad,T=t.iframeLoadTimeout,k=void 0===T?5e3:T,R=t.onStylesheetLoad,M=t.stylesheetLoadTimeout,L=void 0===M?5e3:M,O=t.keepIframeSrcFn,x=void 0===O?function(){return!1}:O,D=t.newlyAddedElement,N=void 0!==D&&D,P=t.preserveWhiteSpace,F=void 0===P||P,U=si(e,{doc:r,mirror:i,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:p,maskTextFn:m,maskInputFn:f,dataURLOptions:b,inlineImages:C,recordCanvas:w,keepIframeSrcFn:x,newlyAddedElement:N});if(!U)return console.warn(e,"not serialized"),null;n=i.hasNode(e)?i.getId(e):!function(e,t){if(t.comment&&e.type===Dr.Comment)return!0;if(e.type===Dr.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(oi(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===oi(e.attributes.name)||"icon"===oi(e.attributes.rel)||"apple-touch-icon"===oi(e.attributes.rel)||"shortcut icon"===oi(e.attributes.rel))))return!0;
2if("meta"===e.tagName){if(t.headMetaDescKeywords&&oi(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(oi(e.attributes.property).match(/^(og|twitter|fb):/)||oi(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===oi(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===oi(e.attributes.name)||"googlebot"===oi(e.attributes.name)||"bingbot"===oi(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===oi(e.attributes.name)||"generator"===oi(e.attributes.name)||"framework"===oi(e.attributes.name)||"publisher"===oi(e.attributes.name)||"progid"===oi(e.attributes.name)||oi(e.attributes.property).match(/^article:/)||oi(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===oi(e.attributes.name)||"yandex-verification"===oi(e.attributes.name)||"csrf-token"===oi(e.attributes.name)||"p:domain_verify"===oi(e.attributes.name)||"verify-v1"===oi(e.attributes.name)||"verification"===oi(e.attributes.name)||"shopify-checkout-api-token"===oi(e.attributes.name)))return!0}}return!1}(U,v)&&(F||U.type!==Dr.Text||U.isStyle||U.textContent.replace(/^\s+|\s+$/gm,"").length)?$r():-2;var B=Object.assign(U,{id:n});if(i.add(e,B),-2===n)return null;A&&A(e);var W=!l;if(B.type===Dr.Element){W=W&&!B.needBlock,delete B.needBlock;var H=e.shadowRoot;H&&Fr(H)&&(B.isShadowHost=!0)}if((B.type===Dr.Document||B.type===Dr.Element)&&W){v.headWhitespace&&B.type===Dr.Element&&"head"===B.tagName&&(F=!1);for(var j={doc:r,mirror:i,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:l,inlineStylesheet:h,maskInputOptions:p,maskTextFn:m,maskInputFn:f,slimDOMOptions:v,dataURLOptions:b,inlineImages:C,recordCanvas:w,preserveWhiteSpace:F,onSerialize:A,onIframeLoad:E,iframeLoadTimeout:k,onStylesheetLoad:R,stylesheetLoadTimeout:L,keepIframeSrcFn:x},V=0,_=Array.from(e.childNodes);V<_.length;V++){($=ai(_[V],j))&&B.childNodes.push($)}if(Nr(e)&&e.shadowRoot)for(var q=0,G=Array.from(e.shadowRoot.childNodes);q<G.length;q++){var $;($=ai(G[q],j))&&(Fr(e.shadowRoot)&&($.isShadow=!0),B.childNodes.push($))}}return e.parentNode&&Pr(e.parentNode)&&Fr(e.parentNode)&&(B.isShadow=!0),B.type===Dr.Element&&"iframe"===B.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var i,s=!1;try{i=r.document.readyState}catch(e){return}if("complete"===i){var o="about:blank";if(r.location.href!==o||e.src===o||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout(function(){s||(t(),s=!0)},n);e.addEventListener("load",function(){clearTimeout(a),s=!0,t()})}}}(e,function(){var t=e.contentDocument;if(t&&E){var n=ai(t,{doc:t,mirror:i,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:p,maskTextFn:m,maskInputFn:f,slimDOMOptions:v,dataURLOptions:b,inlineImages:C,recordCanvas:w,preserveWhiteSpace:F,onSerialize:A,onIframeLoad:E,iframeLoadTimeout:k,onStylesheetLoad:R,stylesheetLoadTimeout:L,keepIframeSrcFn:x});n&&E(e,n)}},k),B.type===Dr.Element&&"link"===B.tagName&&"stylesheet"===B.attributes.rel&&function(e,t,n){var r,i=!1;try{r=e.sheet}catch(e){return}if(!r){var s=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(s),i=!0,t()})}}(e,function(){if(R){var t=ai(e,{doc:r,mirror:i,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:p,maskTextFn:m,maskInputFn:f,slimDOMOptions:v,dataURLOptions:b,inlineImages:C,recordCanvas:w,preserveWhiteSpace:F,onSerialize:A,onIframeLoad:E,iframeLoadTimeout:k,onStylesheetLoad:R,stylesheetLoadTimeout:L,keepIframeSrcFn:x});t&&R(e,t)}},L),B}var ci=/([^\\]):hover/;new RegExp(ci.source,"g");function di(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const li="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let ui={map:{},getId:()=>(console.error(li),-1),getNode:()=>(console.error(li),null),removeNodeFromMap(){console.error(li)},has:()=>(console.error(li),!1),reset(){console.error(li)}};function hi(e,t,n={}){let r=null,i=0;return function(...s){const o=Date.now();i||!1!==n.leading||(i=o);const a=t-(o-i),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=o,e.apply(c,s)):r||!1===n.trailing||(r=setTimeout(()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(c,s)},a))}}function gi(e,t,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(e,t);
2return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),s&&s.set&&s.set.call(this,e)}}),()=>gi(e,t,s||{},!0)}function pi(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch(e){return()=>{}}}function mi(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function fi(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function vi(e,t,n,r){if(!e)return!1;const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!i)return!1;if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(ri(i,t,r))return!0;if(n){if(e.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1}function yi(e,t){return-2===t.getId(e)}function bi(e,t){if(Pr(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||bi(e.parentNode,t))}function Ii(e){return Boolean(e.changedTouches)}function Ci(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Si(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function wi(e){return Boolean(null==e?void 0:e.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(ui=new Proxy(ui,{get:(e,t,n)=>("map"===t&&console.error(li),Reflect.get(e,t,n))}));class Ai{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var Ei=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Ei||{}),Ti=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(Ti||{}),ki=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ki||{}),Ri=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ri||{});function Mi(e){return"__ln"in e}class Li{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Mi(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&Mi(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++}removeNode(e){const t=e.__ln;
2this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const Oi=(e,t)=>`${e}@${t}`;class xi{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Li,n=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},r=r=>{var i,s,o,a;let c=null;(null===(s=null===(i=r.getRootNode)||void 0===i?void 0:i.call(r))||void 0===s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&r.getRootNode().host&&(c=r.getRootNode().host);let d=c;for(;(null===(a=null===(o=null==d?void 0:d.getRootNode)||void 0===o?void 0:o.call(d))||void 0===a?void 0:a.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&d.getRootNode().host;)d=d.getRootNode().host;const l=!(this.doc.contains(r)||d&&this.doc.contains(d));if(!r.parentNode||l)return;const u=Pr(r.parentNode)?this.mirror.getId(c):this.mirror.getId(r.parentNode),h=n(r);if(-1===u||-1===h)return t.addNode(r);const g=ai(r,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Ci(e,this.mirror)&&this.iframeManager.addIframe(e),Si(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),wi(r)&&this.shadowDomManager.addShadowRoot(r.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});g&&e.push({parentId:u,nextId:h,node:g})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))Ni(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||r(e);for(const e of Array.from(this.addedSet.values()))Fi(this.droppedSet,e)||Ni(this.removes,e,this.mirror)?Fi(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let i=null;for(;t.length;){let e=null;if(i){const t=this.mirror.getId(i.value.parentNode),r=n(i.value);-1!==t&&-1!==r&&(e=i)}if(!e)for(let r=t.length-1;r>=0;r--){const i=t.get(r);if(i){const t=this.mirror.getId(i.value.parentNode);if(-1===n(i.value))continue;if(-1!==t){e=i;break}{const t=i.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=t.parentNode.host;if(-1!==this.mirror.getId(n)){e=i;break}}}}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}i=e.previous,t.removeNode(e.value),r(e.value)}const s={texts:this.texts.map(e=>({id:this.mirror.getId(e.node),value:e.value})).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>({id:this.mirror.getId(e.node),attributes:e.attributes})).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=e=>{if(!yi(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;vi(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:ii(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(n=Hr({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),vi(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let r=this.attributes.find(t=>t.node===e.target);
2if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(n)){if(t.contentDocument)return;e.attributeName="rr_src"}if(r||(r={node:e.target,attributes:{}},this.attributes.push(r)),"style"===e.attributeName){const n=this.doc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue),void 0!==r.attributes.style&&null!==r.attributes.style||(r.attributes.style={});const i=r.attributes.style;for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);r===n.style.getPropertyValue(e)&&s===n.style.getPropertyPriority(e)||(i[e]=""===s?r:[r,s])}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(i[e]=!1)}else r.attributes[e.attributeName]=ni(this.doc,t.tagName,e.attributeName,n);break}case"childList":if(vi(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const n=this.mirror.getId(t),r=Pr(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);vi(e.target,this.blockClass,this.blockSelector,!1)||yi(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Di(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||bi(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Oi(n,r)]?Di(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!Pr(e.target)||!Fr(e.target))||void 0})),this.mapRemoves.push(t))})}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(yi(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Oi(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);vi(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(e=>this.genAdds(e))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Di(e,t){e.delete(t),t.childNodes.forEach(t=>Di(e,t))}function Ni(e,t,n){return 0!==e.length&&Pi(e,t,n)}function Pi(e,t,n){const{parentNode:r}=t;if(!r)return!1;const i=n.getId(r);return!!e.some(e=>e.id===i)||Pi(e,r,n)}function Fi(e,t){return 0!==e.size&&Ui(e,t)}function Ui(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Ui(e,n))}const Bi=[],Wi="undefined"!=typeof CSSGroupingRule,Hi="undefined"!=typeof CSSMediaRule,ji="undefined"!=typeof CSSSupportsRule,Vi="undefined"!=typeof CSSConditionRule;function _i(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function qi(e,t){var n,r;const i=new xi;Bi.push(i),i.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const o=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");o&&window[o]&&(s=window[o]);const a=new s(i.processMutations.bind(i));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Gi({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const o=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,a=[];return Object.keys(ki).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(s=>{const o=s.toLowerCase(),c=(t=>s=>{const o=_i(s);if(vi(o,r,i,!0))return;const a=Ii(s)?s.changedTouches[0]:s;if(!a)return;const c=n.getId(o),{clientX:d,clientY:l}=a;e({type:ki[t],id:c,x:d,y:l})})(s);a.push(di(o,c,t))}),()=>
2{a.forEach(e=>e())}}function $i({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:s}){return di("scroll",hi(s=>{const o=_i(s);if(!o||vi(o,r,i,!0))return;const a=n.getId(o);if(o===t){const n=t.scrollingElement||t.documentElement;e({id:a,x:n.scrollLeft,y:n.scrollTop})}else e({id:a,x:o.scrollLeft,y:o.scrollTop})},s.scroll||100),t)}function Ki(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const Zi=["INPUT","TEXTAREA","SELECT"],zi=new WeakMap;function Ji(e){return function(e,t){if(Wi&&e.parentRule instanceof CSSGroupingRule||Hi&&e.parentRule instanceof CSSMediaRule||ji&&e.parentRule instanceof CSSSupportsRule||Vi&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function Yi(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Xi({mirror:e,stylesheetManager:t},n){var r,i,s;let o=null;o="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(s=null===(i=n.ownerDocument)||void 0===i?void 0:i.defaultView)||void 0===s?void 0:s.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==o&&-1!==o&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const r=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==o&&-1!==o)try{t.adoptStyleSheets(e,o)}catch(e){}return r}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}):()=>{}}function Qi(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:s,viewportResizeCb:o,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:d,styleDeclarationCb:l,canvasMutationCb:u,fontCb:h,selectionCb:g}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),d(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),l(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),g(...e)}}(e,t);const r=qi(e,e.doc),i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const c=hi(t=>{const n=Date.now()-o;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],o=null},s),d=hi(e=>{const t=_i(e),{clientX:n,clientY:i}=Ii(e)?e.changedTouches[0]:e;o||(o=Date.now()),a.push({x:n,y:i,id:r.getId(t),timeOffset:Date.now()-o}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?Ti.Drag:e instanceof MouseEvent?Ti.MouseMove:Ti.TouchMove)},i,{trailing:!1}),l=[di("mousemove",d,n),di("touchmove",d,n),di("drag",d,n)];return()=>{l.forEach(e=>e())}}(e),s=Gi(e),o=$i(e),a=function({viewportResizeCb:e}){let t=-1,n=-1;return di("resize",hi(()=>{const r=mi(),i=fi();t===r&&n===i||(e({width:Number(i),height:Number(r)}),t=r,n=i)},200),window)}(e),c=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:s,maskInputOptions:o,maskInputFn:a,sampling:c,userTriggeredOnInput:d}){function l(e){let n=_i(e);const c=e.isTrusted;if(n&&"OPTION"===n.tagName&&(n=n.parentElement),!n||!n.tagName||Zi.indexOf(n.tagName)<0||vi(n,r,i,!0))return;const l=n.type;if(n.classList.contains(s))return;let h=n.value,g=!1;"radio"===l||"checkbox"===l?g=n.checked:(o[n.tagName.toLowerCase()]||o[l])&&(h=Hr({maskInputOptions:o,tagName:n.tagName,type:l,value:h,maskInputFn:a})),u(n,Ki({text:h,isChecked:g,userTriggered:c},d));const p=n.name;"radio"===l&&p&&g&&t.querySelectorAll(`input[type="radio"][name="${p}
2"]`).forEach(e=>{e!==n&&u(e,Ki({text:e.value,isChecked:!g,userTriggered:!1},d))})}function u(t,r){const i=zi.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){zi.set(t,r);const i=n.getId(t);e(Object.assign(Object.assign({},r),{id:i}))}}const h=("last"===c.input?["change"]:["input","change"]).map(e=>di(e,l,t)),g=t.defaultView;if(!g)return()=>{h.forEach(e=>e())};const p=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),m=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return p&&p.set&&h.push(...m.map(e=>gi(e[0],e[1],{set(){l({target:this})}},!1,g))),()=>{h.forEach(e=>e())}}(e),d=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i}){const s=s=>hi(i=>{const o=_i(i);if(!o||vi(o,t,n,!0))return;const{currentTime:a,volume:c,muted:d,playbackRate:l}=o;e({type:s,id:r.getId(o),currentTime:a,volume:c,muted:d,playbackRate:l})},i.media||500),o=[di("play",s(0)),di("pause",s(1)),di("seeked",s(2)),di("volumechange",s(3)),di("ratechange",s(4))];return()=>{o.forEach(e=>e())}}(e),l=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=function(r,s){const{id:o,styleId:a}=Yi(this,t,n.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:r,index:s}]}),i.apply(this,[r,s])};const s=r.CSSStyleSheet.prototype.deleteRule;let o,a;r.CSSStyleSheet.prototype.deleteRule=function(r){const{id:i,styleId:o}=Yi(this,t,n.styleMirror);return(i&&-1!==i||o&&-1!==o)&&e({id:i,styleId:o,removes:[{index:r}]}),s.apply(this,[r])},r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=function(r){const{id:i,styleId:s}=Yi(this,t,n.styleMirror);return(i&&-1!==i||s&&-1!==s)&&e({id:i,styleId:s,replace:r}),o.apply(this,[r])}),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=function(r){const{id:i,styleId:s}=Yi(this,t,n.styleMirror);return(i&&-1!==i||s&&-1!==s)&&e({id:i,styleId:s,replaceSync:r}),a.apply(this,[r])});const c={};Wi?c.CSSGroupingRule=r.CSSGroupingRule:(Hi&&(c.CSSMediaRule=r.CSSMediaRule),Vi&&(c.CSSConditionRule=r.CSSConditionRule),ji&&(c.CSSSupportsRule=r.CSSSupportsRule));const d={};return Object.entries(c).forEach(([r,i])=>{d[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=function(i,s){const{id:o,styleId:a}=Yi(this.parentStyleSheet,t,n.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:i,index:[...Ji(this),s||0]}]}),d[r].insertRule.apply(this,[i,s])},i.prototype.deleteRule=function(i){const{id:s,styleId:o}=Yi(this.parentStyleSheet,t,n.styleMirror);return(s&&-1!==s||o&&-1!==o)&&e({id:s,styleId:o,removes:[{index:[...Ji(this),i]}]}),d[r].deleteRule.apply(this,[i])}}),()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=s,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=d[e].insertRule,t.prototype.deleteRule=d[e].deleteRule})}}(e,{win:n}),u=Xi(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(i,o,a){var c;if(n.has(i))return s.apply(this,[i,o,a]);const{id:d,styleId:l}=Yi(null===(c=this.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||l&&-1!==l)&&e({id:d,styleId:l,set:{property:i,value:o,priority:a},index:Ji(this.parentRule)}),s.apply(this,[i,o,a])};const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(i){var s;if(n.has(i))return o.apply(this,[i]);const{id:a,styleId:c}=Yi(null===(s=this.parentRule)||void 0===s?void 0:s.parentStyleSheet,t,r.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,remove:{property:i},index:Ji(this.parentRule)}),o.apply(this,[i])},()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o}}(e,{win:n}),g=e.collectFonts?function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,s=n.FontFace;n.FontFace=function(e,t,n){const r=new s(e,t,n);return i.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const o=pi(t.fonts,"add",function(t){return function(n){return setTimeout(()=>{const t=i.get(n);t&&(e(t),i.delete(n))},0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=s}),r.push(o),()=>
2{r.forEach(e=>e())}}(e):()=>{},p=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:s}=e;let o=!0;const a=()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const s=e.getRangeAt(t),{startContainer:o,startOffset:c,endContainer:d,endOffset:l}=s;vi(o,r,i,!0)||vi(d,r,i,!0)||a.push({start:n.getId(o),startOffset:c,end:n.getId(d),endOffset:l})}s({ranges:a})};return a(),di("selectionchange",a)}(e),m=[];for(const t of e.plugins)m.push(t.observer(t.callback,n,t.options));return()=>{Bi.forEach(e=>e.reset()),r.disconnect(),i(),s(),o(),a(),c(),d(),l(),u(),h(),g(),p(),m.forEach(e=>e())}}class es{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const i=n||this.getIdToRemoteIdMap(e),s=r||this.getRemoteIdToIdMap(e);let o=i.get(t);return o||(o=this.generateIdFn(),i.set(t,o),s.set(o,t)),o}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}
2getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=r.get(t);return i||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class ts{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new es($r),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new es(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const n=this.transformCrossOriginEvent(t,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var n;switch(t.type){case Ei.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:Ei.IncrementalSnapshot,data:{source:Ti.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case Ei.Meta:case Ei.Load:case Ei.DomContentLoaded:return!1;case Ei.Plugin:return t;case Ei.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Ei.IncrementalSnapshot:switch(t.data.source){case Ti.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Ti.Drag:case Ti.TouchMove:case Ti.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Ti.ViewportResize:return!1;case Ti.MediaInteraction:case Ti.MouseInteraction:case Ti.Scroll:case Ti.CanvasMutation:case Ti.Input:return this.replaceIds(t.data,e,["id"]),t;case Ti.StyleSheetRule:case Ti.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Ti.Font:return t;case Ti.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case Ti.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}}replace(e,t,n,r){for(const i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}}class ns{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;
2const t=this;this.restorePatches.push(pi(Element.prototype,"attachShadow",function(e){return function(n){const r=e.call(this,n);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),r}}))}addShadowRoot(e,t){Fr(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),qi(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),$i(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Xi({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;this.restorePatches.push(pi(e.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(r){const i=n.call(this,r);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),i}}))}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet}}function rs(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}c((r=r.apply(e,t||[])).next())})}for(var is="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ss="undefined"==typeof Uint8Array?[]:new Uint8Array(256),os=0;os<64;os++)ss[is.charCodeAt(os)]=os;const as=new Map;const cs=(e,t,n)=>{if(!e||!us(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=as.get(e);return n||(n=new Map,as.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i};function ds(e,t,n){if(e instanceof Array)return e.map(e=>ds(e,t,n));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=is[n[t]>>2],i+=is[(3&n[t])<<4|n[t+1]>>4],i+=is[(15&n[t+1])<<2|n[t+2]>>6],i+=is[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[ds(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[ds(e.data,t,n),e.width,e.height]}}if(us(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:cs(e,t,n)}}return e}const ls=(e,t,n)=>[...e].map(e=>ds(e,t,n)),us=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(n.find(n=>e instanceof t[n]))};function hs(e,t,n){const r=[];try{const i=pi(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(r,...i){return vi(this,t,n,!0)||"__context"in this||(this.__context=r),e.apply(this,[r,...i])}});r.push(i)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{r.forEach(e=>e())}}function gs(e,t,n,r,i,s,o){const a=[],c=Object.getOwnPropertyNames(e);for(const s of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const c=pi(e,s,function(e){return function(...a){const c=e.apply(this,a);if(cs(c,o,this),!vi(this.canvas,r,i,!0)){const e=ls([...a],o,this),r={type:t,property:s,args:e};n(this.canvas,r)}return c}});a.push(c)}catch(r){const i=gi(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(i)}return a}var ps=null;try{var ms="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof require&&require("worker_threads")||"function"==typeof require&&require("worker_threads");ps=ms.Worker}catch(vn){}function fs(e,t,n){var r=void 0===t?null:t,i=function(e,t){return Buffer.from(e,"base64").toString(t?"utf16":"utf8")}(e,void 0!==n&&n),s=i.indexOf("\n",10)+1,o=i.substring(s)+(r?"//# sourceMappingURL="+r:"");return function(e){return new ps(o,Object.assign({},e,{eval:!0}))}}
vendor: 4,996 bytes, line 2
2function vs(e,t,n){var r=void 0===t?null:t,i=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),i=0,s=n.length;i<s;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(e,void 0!==n&&n),s=i.indexOf("\n",10)+1,o=i.substring(s)+(r?"//# sourceMappingURL="+r:""),a=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(a)}var ys="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);var bs,Is,Cs,Ss=(bs="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9i
2ID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",Is=null,Cs=!1,ys?fs(bs,Is,Cs):function(e,t,n){var r;return function(i){return r=r||vs(e,t,n),new Worker(r,i)}}(bs,Is,Cs));class ws{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:r,blockSelector:i,recordCanvas:s,dataURLOptions:o}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(n,r,i),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,i,{dataURLOptions:o})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,r,i){const s=hs(t,n,r),o=new Map,a=new Ss;a.onmessage=e=>{const{id:t}=e.data;if(o.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:i,height:s}=e.data;this.mutationCb({id:t,type:Ri["2D"],commands:[{property:"clearRect",args:[0,0,i,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let d,l=0;const u=e=>{l&&e-l<c||(l=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{vi(t,n,r,!0)||e.push(t)}),e}
2)().forEach(e=>rs(this,void 0,void 0,function*(){var t;const n=this.mirror.getId(e);if(o.get(n))return;if(o.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&(null==n||n.clear(n.COLOR_BUFFER_BIT))}const r=yield createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[r])}))),d=requestAnimationFrame(u)};d=requestAnimationFrame(u),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=hs(e,t,n),i=function(e,t,n,r){const i=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const o of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;const s=pi(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...s){return vi(this.canvas,n,r,!0)||setTimeout(()=>{const n=ls([...s],t,this);e(this.canvas,{type:Ri["2D"],property:o,args:n})},0),i.apply(this,s)}});i.push(s)}catch(n){const r=gi(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:Ri["2D"],property:o,args:[t],setter:!0})}});i.push(r)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),s=function(e,t,n,r){const i=[];return i.push(...gs(t.WebGLRenderingContext.prototype,Ri.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&i.push(...gs(t.WebGL2RenderingContext.prototype,Ri.WebGL2,e,n,r,0,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),i(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map(e=>{const t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["type"]);return t}),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}class As{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Ai,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);r.push({styleId:e,rules:n.map((e,t)=>({rule:Br(e),index:t}))})}n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function Es(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let Ts,ks,Rs,Ms=!1;const Ls=new Wr;function Os(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:s=null,ignoreClass:o="rr-ignore",maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,maskAllInputs:l,maskInputOptions:u,slimDOMOptions:h,maskInputFn:g,maskTextFn:p,hooks:m,packFn:f,sampling:v={},dataURLOptions:y={},mousemoveWait:b,recordCanvas:I=!1,recordCrossOriginIframes:C=!1,userTriggeredOnInput:S=!1,collectFonts:w=!1,inlineImages:A=!1,plugins:E,keepIframeSrcFn:T=()=>!1,ignoreCSSAttributes:k=new Set([])}=e,R=!C||window.parent===window;let M=!1;if(!R)try{window.parent.document,M=!1}catch(e){M=!0}if(R&&!t)throw new Error("emit function is required");void 0!==b&&void 0===v.mousemove&&(v.mousemove=b),Ls.reset();const L=!0===l?{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!==u?u:{password:!0},O=!0===h||"all"===h?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===h,headMetaDescKeywords:"all"===h}:h||{};let x;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let D=0;const N=e=>{for(const t of E||[])t.eventProcessor&&(e=t.eventProcessor(e));return f&&(e=f(e)),e};Ts=(e,i)=>{var s;if(!(null===(s=Bi[0])||void 0===s?void 0:s.isFrozen())||e.type===Ei.FullSnapshot||e.type===Ei.IncrementalSnapshot&&e.data.source===Ti.Mutation||Bi.forEach(e
2=>e.unfreeze()),R)null==t||t(N(e),i);else if(M){const t={type:"rrweb",event:N(e),isCheckout:i};window.parent.postMessage(t,"*")}if(e.type===Ei.FullSnapshot)x=e,D=0;else if(e.type===Ei.IncrementalSnapshot){if(e.data.source===Ti.Mutation&&e.data.isAttachIframe)return;D++;const t=r&&D>=r,i=n&&e.timestamp-x.timestamp>n;(t||i)&&ks(!0)}};const P=e=>{Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.Mutation},e)}))},F=e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.Scroll},e)})),U=e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.CanvasMutation},e)})),B=new As({mutationCb:P,adoptedStyleSheetCb:e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.AdoptedStyleSheet},e)}))}),W=new ts({mirror:Ls,mutationCb:P,stylesheetManager:B,recordCrossOriginIframes:C,wrappedEmit:Ts});for(const e of E||[])e.getMirror&&e.getMirror({nodeMirror:Ls,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});Rs=new ws({recordCanvas:I,mutationCb:U,win:window,blockClass:i,blockSelector:s,mirror:Ls,sampling:v.canvas,dataURLOptions:y});const H=new ns({mutationCb:P,scrollCb:F,bypassOptions:{blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:L,dataURLOptions:y,maskTextFn:p,maskInputFn:g,recordCanvas:I,inlineImages:A,sampling:v,slimDOMOptions:O,iframeManager:W,stylesheetManager:B,canvasManager:Rs,keepIframeSrcFn:T},mirror:Ls});ks=(e=!1)=>{var t,n,r,o,l,u;Ts(Es({type:Ei.Meta,data:{href:window.location.href,width:fi(),height:mi()}}),e),B.reset(),Bi.forEach(e=>e.lock());const h=function(e,t){var n=t||{},r=n.mirror,i=void 0===r?new Wr:r,s=n.blockClass,o=void 0===s?"rr-block":s,a=n.blockSelector,c=void 0===a?null:a,d=n.maskTextClass,l=void 0===d?"rr-mask":d,u=n.maskTextSelector,h=void 0===u?null:u,g=n.inlineStylesheet,p=void 0===g||g,m=n.inlineImages,f=void 0!==m&&m,v=n.recordCanvas,y=void 0!==v&&v,b=n.maskAllInputs,I=void 0!==b&&b,C=n.maskTextFn,S=n.maskInputFn,w=n.slimDOM,A=void 0!==w&&w,E=n.dataURLOptions,T=n.preserveWhiteSpace,k=n.onSerialize,R=n.onIframeLoad,M=n.iframeLoadTimeout,L=n.onStylesheetLoad,O=n.stylesheetLoadTimeout,x=n.keepIframeSrcFn;return ai(e,{doc:e,mirror:i,blockClass:o,blockSelector:c,maskTextClass:l,maskTextSelector:h,skipChild:!1,inlineStylesheet:p,maskInputOptions:!0===I?{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===I?{password:!0}:I,maskTextFn:C,maskInputFn:S,slimDOMOptions:!0===A||"all"===A?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===A,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===A?{}:A,dataURLOptions:E,inlineImages:f,recordCanvas:y,preserveWhiteSpace:T,onSerialize:k,onIframeLoad:R,iframeLoadTimeout:M,onStylesheetLoad:L,stylesheetLoadTimeout:O,keepIframeSrcFn:void 0===x?function(){return!1}:x,newlyAddedElement:!1})}(document,{mirror:Ls,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:L,maskTextFn:p,slimDOM:O,dataURLOptions:y,recordCanvas:I,inlineImages:A,onSerialize:e=>{Ci(e,Ls)&&W.addIframe(e),Si(e,Ls)&&B.trackLinkElement(e),wi(e)&&H.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),H.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{B.attachLinkElement(e,t)},keepIframeSrcFn:T});if(!h)return console.warn("Failed to snapshot the document");Ts(Es({type:Ei.FullSnapshot,data:{node:h,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(l=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===l?void 0:l.scrollTop)||(null===(u=null===document||void 0===document?void 0:document.body)||void 0===u?void 0:u.scrollTop)||0}}}
2)),Bi.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&B.adoptStyleSheets(document.adoptedStyleSheets,Ls.getId(document))};try{const e=[];e.push(di("DOMContentLoaded",()=>{Ts(Es({type:Ei.DomContentLoaded,data:{}}))}));const t=e=>{var t;return Qi({mutationCb:P,mousemoveCb:(e,t)=>Ts(Es({type:Ei.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.MouseInteraction},e)})),scrollCb:F,viewportResizeCb:e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.ViewportResize},e)})),inputCb:e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.Input},e)})),mediaInteractionCb:e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.MediaInteraction},e)})),styleSheetRuleCb:e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.StyleSheetRule},e)})),styleDeclarationCb:e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.StyleDeclaration},e)})),canvasMutationCb:U,fontCb:e=>Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.Font},e)})),selectionCb:e=>{Ts(Es({type:Ei.IncrementalSnapshot,data:Object.assign({source:Ti.Selection},e)}))},blockClass:i,ignoreClass:o,maskTextClass:a,maskTextSelector:c,maskInputOptions:L,inlineStylesheet:d,sampling:v,recordCanvas:I,inlineImages:A,userTriggeredOnInput:S,collectFonts:w,doc:e,maskInputFn:g,maskTextFn:p,keepIframeSrcFn:T,blockSelector:s,slimDOMOptions:O,dataURLOptions:y,mirror:Ls,iframeManager:W,stylesheetManager:B,shadowDomManager:H,canvasManager:Rs,ignoreCSSAttributes:k,plugins:(null===(t=null==E?void 0:E.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>Ts(Es({type:Ei.Plugin,data:{plugin:e.name,payload:t}}))})))||[]},m)};W.addLoadListener(n=>{e.push(t(n.contentDocument))});const n=()=>{ks(),e.push(t(document)),Ms=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():e.push(di("load",()=>{Ts(Es({type:Ei.Load,data:{}})),n()},window)),()=>{e.forEach(e=>e()),Ms=!1}}catch(e){console.warn(e)}}Os.addCustomEvent=(e,t)=>{if(!Ms)throw new Error("please add custom event after start recording");Ts(Es({type:Ei.Custom,data:{tag:e,payload:t}}))},Os.freezePage=()=>{Bi.forEach(e=>e.freeze())},Os.takeFullSnapshot=e=>{if(!Ms)throw new Error("please take full snapshot after start recording");ks(e)},Os.mirror=Ls;const xs={maskAllInputs:!0,maskTextSelector:"*",maskInputOptions:void 0},Ds={additionalSampleRate:1,batchSize:50,flushInterval:5e3,recordOptions:{slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,recordCrossOriginIframes:!1}};class Ns extends Me{constructor(e){super("rrweb"),this.recordingEvents=[],this.isRecording=!1,this.recordingStartTime=null,this.flushTimer=null,this.stopRecording=null,this.enabled=!1;const t=Object.assign(Object.assign(Object.assign({},Ds.recordOptions),null==e?void 0:e.recordOptions),xs);this.config=Object.assign(Object.assign(Object.assign({},Ds),e),{recordOptions:t}),c.info("RRWebPlugin initialized",{additionalSampleRate:this.config.additionalSampleRate,batchSize:this.config.batchSize,flushInterval:this.config.flushInterval})}enable(){var e;if(this.enabled)return void c.info("RRWebPlugin already enabled");const t=null===(e=this.context)||void 0===e?void 0:e.getSession();if(!t||!t.record)return void c.warn("RRWebPlugin skipping - session not being recorded",{hasSession:!!t,sessionRecord:null==t?void 0:t.record});const n=Math.random();n>this.config.additionalSampleRate?c.warn("RRWebPlugin skipping - session replay additionalSampleRate",{randomValue:n,samplingRate:this.config.additionalSampleRate}):(this.enabled=!0,c.info("RRWebPlugin enabled - starting recording"),this.startRecording())}disable(){this.enabled?(c.info("RRWebPlugin disabled - stopping recording"),this.enabled=!1,this.stopCurrentRecording()):c.info("RRWebPlugin already disabled")}record(e){const t=null==e?void 0:e.action;"start"===t?(c.info("RRWebPlugin manual start recording"),this.startRecording()):"stop"===t&&(c.info("RRWebPlugin manual stop recording"),this.stopCurrentRecording())}onload(){}startRecording(){this.recordingStartTime=Date.now(),this.recordingEvents=[],this.isRecording=!0,c.info("RRWebPlugin starting rrweb recording",{startTime:this.recordingStartTime});const e=Os(Object.assign(Object.assign({},this.config.recordOptions),{emit:this.handleRRWebEvent.bind(this)}));e?(this.stopRecording=e,c.info("RRWebPlugin rrweb recording initialized successfully")):c.warn("RRWebPlugin failed to initialize rrweb recording"),this.flushTimer=window.setInterval(()=>{this.flush()},this.config.flushInterval)}stopCurrentRecording(){this.isRecording?(c.info("RRWebPlugin stopping current recording"),this.isRecording=!1,this.stopRecording&&(this.stopRecording(),this.stopRecording=null,c.info("RRWebPlugin rrweb recording stopped")),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null,c.info("RRWebPlugin flush timer cleared")),this.flush()):c.info("RRWebPlugin stopCurrentRecording called but not recording")}handleRRWebEvent(e){this.isRecording&&(this.recordingEvents.push(e),this.recordingEvents.length>=this.config.batchSize&&(c.info("RRWebPlugin flushing events due to batch size",{eventCount:this.recordingEvents.length,batchSize:this.config.batchSize}),this.flush()))}flush(){if(0===this.recordingEvents.length)return void c.info("RRWebPlugin flushEvent called but no events to flush");c.info("RRWebPlugin flushing events",{eventCount:this.recordingEvents.length});const e=[...this.recordingEvents],t={version:"1.0.0",events:e,eventCount:e.length};this.context.record(U,t),c.info("RRWebPlugin events sent to RUM",{eventType:U,eventCount:this.recordingEvents.length}),this.recordingEvents=[]}}var Ps,Fs;!function(e){e.Errors="errors",e.Performance="performance",e.Interaction="interaction",e.Http="http",e.Replay="replay"}(Ps||(Ps={}
2)),function(e){e.Path="PATH",e.Hash="HASH",e.PathAndHash="PATH_AND_HASH"}(Fs||(Fs={}));class Us extends He{constructor(e,t,n,r={}){const{signing:i,telemetries:s}=(o=Be(),Object.assign(Object.assign({},We(o)),{signing:!0,telemetries:[Ps.Errors,Ps.Performance,Ps.Http,Ps.Replay]}));var o;super(e,t,n,Object.assign({signing:i,telemetries:s},r)),c.info(`RUM client initialized for app: ${e}`),c.info(`Telemetries enabled: ${this.config.telemetries.join(", ")||"none"}`)}initDispatch(e,t){const n=super.initDispatch(e,t);return n.setSigningConfigFactory(Ut),n.setCognitoCredentialProviderFactory((e,t,n,r)=>{const i={identityPoolId:n,guestRoleArn:r,cookieAttributes:e.cookieAttributes};return n&&r?new Kt(i,t).ChainAnonymousCredentialsProvider:new Zt(i,t).ChainAnonymousCredentialsProvider}),this.config.signing&&this.config.identityPoolId&&n.setCognitoCredentials(this.config.identityPoolId,this.config.guestRoleArn),n}initPluginManager(e,t){const n=super.initPluginManager(e,t);return this.constructBuiltinPlugins().forEach(e=>{n.addPlugin(e)}),n}recordError(e){this.pluginManager.record(Yt,e)}registerDomEvents(e){this.pluginManager.updatePlugin(en,e)}constructBuiltinPlugins(){let e=[];const t=this.telemetryFunctor();return this.config.telemetries.forEach(n=>{"string"==typeof n&&t[n.toLowerCase()]?e=[...e,...t[n.toLowerCase()]({})]:Array.isArray(n)&&t[n[0].toLowerCase()]&&(e=[...e,...t[n[0].toLowerCase()](n[1])])}),e}telemetryFunctor(){return{[Ps.Errors]:e=>[new Qt(e)],[Ps.Performance]:e=>[new gn(e),new mn(e),new Mr(e)],[Ps.Interaction]:e=>[new nn(e)],[Ps.Http]:e=>[new Or(e),new xr(e)],[Ps.Replay]:e=>[new Ns(e)]}}}const Bs=async e=>{let t={},n={};return void 0!==e.u?(n=await(async e=>{try{const t=await fetch(e,{mode:"cors",method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}});return await t.json()}catch(e){throw new Error(`CWR: Failed to load remote config: ${e}`)}})(e.u),t=Object.assign(Object.assign({},n.clientConfig),e.c)):void 0!==e.c&&(t=e.c),t};class Ws extends je{constructor(){super()}async init(e){if(void 0!==e.u){const t=await Bs(e);e.c=t}this.initCwr(e)}initCwr(e){e.c?e.c.client=o:e.c={client:o},this.orchestration=new Us(e.i,e.v,e.r,e.c),window[e.n]=(e,t)=>{this.push({c:e,p:t})},e.q.forEach(e=>{this.push(e)}),e.q=[]}}!window.AwsRumClient&&window.AwsNexusTelemetry&&(window.AwsRumClient=window.AwsNexusTelemetry),"function"==typeof fetch&&"function"==typeof navigator.sendBeacon?(new Ws).init(window.AwsRumClient):window[window.AwsRumClient.n]=()=>{}})();
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.