const sessionId=uuidv4().toString();let stopRecording,wsInitialized=!1;const stopRecordingAfter=18e5;class EventBuff{constructor(e){this._buff=[];const t=new URL("/info-ws/",location.href);t.protocol="wss",this.ws=new WebSocket(t),this.ws.onopen=()=>{let t=JSON.stringify({session_id:e,loc:window.location.toString()});this.ws.send(t),this.flush(),wsInitialized=!0}}flush=()=>{for(;this._buff.length>0;){let e=this._buff.pop();this.ws.send(e)}};emit=e=>{const t=new Blob([e]);try{if(!wsInitialized)throw InvalidStateError;this.ws.send(t)}catch(e){this._buff.push(t)}}}const buff=new EventBuff(sessionId);stopRecording=rrweb.record({emit(e){buff.emit(e)},sampling:{media:5e3},recordCanvas:!0,inlineImages:!0,inlineStylesheet:!0,recordAfter:"DOMContentLoaded",packFn:rrweb.pack,plugins:[rrweb.getRecordConsolePlugin()]});let recording=!0;setTimeout((()=>{recording=!1,stopRecording(),buff.flush(),buff.ws.close()}),18e5);const goBtn=document.querySelector(".step:last-child a");goBtn.addEventListener("click",(e=>{recording&&rrweb.record.addCustomEvent("submit-go",{})})),document.querySelectorAll(".step:not(:last-child) a").forEach((e=>{e.addEventListener("click",(e=>{recording&&rrweb.record.addCustomEvent("click-next",{})}))})),window.addEventListener("keydown",(e=>{recording&&rrweb.record.addCustomEvent("key-pressed",{key:e.key,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey})})),window.addEventListener("pagehide",(()=>{recording&&rrweb.record.addCustomEvent("close-tab",{})}));