var v=Object.defineProperty;var c=s=>{throw TypeError(s)};var E=(s,e,t)=>e in s?v(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var a=(s,e,t)=>E(s,typeof e!="symbol"?e+"":e,t),d=(s,e,t)=>e.has(s)||c("Cannot "+t);var i=(s,e,t)=>(d(s,e,"read from private field"),t?t.call(s):e.get(s)),h=(s,e,t)=>e.has(s)?c("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),m=(s,e,t,o)=>(d(s,e,"write to private field"),o?o.call(s,t):e.set(s,t),t);var n;const l=class l{constructor(e){h(this,n);a(this,"onmessage");a(this,"onclose");m(this,n,e),i(this,n).addEventListener("message",t=>{this.onmessage&&this.onmessage.call(null,t.data)}),i(this,n).addEventListener("close",()=>{this.onclose&&this.onclose.call(null)}),i(this,n).addEventListener("error",()=>{})}static create(e){return new Promise((t,o)=>{const r=new WebSocket(e);r.addEventListener("open",()=>t(new l(r))),r.addEventListener("error",o)})}send(e){i(this,n).send(e)}close(){i(this,n).close()}};n=new WeakMap;let u=l;export{u as BrowserWebSocketTransport};
