var _wshook=function(){"use strict";const e=null==(o=()=>{const e=new Proxy(window.WebSocket,{construct(e,o){console.log("Proxying WebSocket connection",...o);const n=new e(...o);n.hooks={beforeSend:()=>null,beforeReceive:e=>{"receiveHook"in window&&window.receiveHook(e)}};const t=new Proxy(n.send,{apply(e,o,t){if(!1!==n.hooks.beforeSend(t))return e.apply(o,t)}});n.send=t;const s=new Proxy(n.addEventListener,{apply(e,o,t){if("message"!==t[0]||!1!==n.hooks.beforeReceive(t))return e.apply(o,t)}});return n.addEventListener=s,Object.defineProperty(n,"onmessage",{set(e){return s.apply(this,["message",function(o){!1!==n.hooks.beforeReceive(o)&&e.call(this,o)},!1])}}),window._websockets=window._websockets||[],window._websockets.push(n),n}});window.WebSocket=e})||"function"==typeof o?{main:o}:o;var o;const n=(...e)=>{console.error};return(async()=>{try{return await e.main()}catch(o){throw n('The unlisted script "wsHook" crashed on startup!',o),o}})()}();
