lobbyc 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lobbyc.d.ts +141 -0
- package/lobbyc.js +2 -0
- package/package.json +9 -0
package/lobbyc.d.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a connection to a room on a specific floor/application.
|
|
3
|
+
*/
|
|
4
|
+
export interface Room {
|
|
5
|
+
/** Unique identifier for the room */
|
|
6
|
+
roomCode: string;
|
|
7
|
+
/** Unique identifier for the host peer */
|
|
8
|
+
hostId: string;
|
|
9
|
+
/** Timestamp when the room automatically locks */
|
|
10
|
+
lockAt: Date;
|
|
11
|
+
/**
|
|
12
|
+
* Leave the room voluntarily.
|
|
13
|
+
* @throws {Error} If the server communication fails
|
|
14
|
+
*/
|
|
15
|
+
leave(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Register a callback for when a peer disconnects from the room.
|
|
18
|
+
* @param callback - Function called with the ID of the disconnected peer
|
|
19
|
+
*/
|
|
20
|
+
onDisconnected(callback: (peerId: string) => void): void;
|
|
21
|
+
/**
|
|
22
|
+
* Send a message to a specific peer in the room.
|
|
23
|
+
* @param peerId - Target peer's unique identifier
|
|
24
|
+
* @param data - Data to transmit
|
|
25
|
+
* @throws {Error} If the peer doesn't exist or communication fails
|
|
26
|
+
*/
|
|
27
|
+
sendMessage(peerId: string, data: any): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Register a callback for incoming messages from other peers.
|
|
30
|
+
* @param callback - Function called with sender's peer ID and message data
|
|
31
|
+
*/
|
|
32
|
+
onMessage(callback: (peerId: string, data: any) => void): void;
|
|
33
|
+
/**
|
|
34
|
+
* Register a callback for room lock events.
|
|
35
|
+
* @param callback - Function called when the room is locked
|
|
36
|
+
*/
|
|
37
|
+
onLock(callback: () => void): void;
|
|
38
|
+
/**
|
|
39
|
+
* Register a callback for room-level errors.
|
|
40
|
+
* @param callback - Function called when an error occurs in room operations
|
|
41
|
+
*/
|
|
42
|
+
onError(callback: (error: Error) => void): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for creating a new room as a host.
|
|
46
|
+
*/
|
|
47
|
+
export interface HostRoomOptions {
|
|
48
|
+
/** Optional password to restrict room access */
|
|
49
|
+
password?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Represents a room that the current peer is hosting.
|
|
53
|
+
* Provides host-specific functionality like broadcasting and guest management.
|
|
54
|
+
*/
|
|
55
|
+
export interface HostedRoom extends Room {
|
|
56
|
+
/** Maximum number of guests allowed in this room */
|
|
57
|
+
maxGuests: number;
|
|
58
|
+
/**
|
|
59
|
+
* Lock the room to prevent new guests from joining.
|
|
60
|
+
* Existing guests remain connected.
|
|
61
|
+
* @throws {Error} If server communication fails
|
|
62
|
+
*/
|
|
63
|
+
lock(): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Send a message to all connected guests in the room.
|
|
66
|
+
* @param data - Data to broadcast to all guests
|
|
67
|
+
* @throws {Error} If server communication fails
|
|
68
|
+
*/
|
|
69
|
+
broadcastMessage(data: any): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Register a callback for when a new guest successfully joins the room and WebRTC connection is established.
|
|
72
|
+
* @param callback - Function called with the new guest's ID
|
|
73
|
+
*/
|
|
74
|
+
onGuestJoined(callback: (guestId: string) => void): void;
|
|
75
|
+
/**
|
|
76
|
+
* Register a callback for when a guest leaves the room.
|
|
77
|
+
* @param callback - Function called with the departing guest's ID
|
|
78
|
+
*/
|
|
79
|
+
onGuestLeft(callback: (guestId: string) => void): void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Options for joining an existing room as a guest.
|
|
83
|
+
*/
|
|
84
|
+
export interface JoinRoomOptions {
|
|
85
|
+
/** Password required if the room is password-protected */
|
|
86
|
+
password?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Represents a room that the current peer has joined as a guest.
|
|
90
|
+
*/
|
|
91
|
+
export interface JoinedRoom extends Room {
|
|
92
|
+
/** Unique identifier assigned to this guest in the room */
|
|
93
|
+
guestId: string;
|
|
94
|
+
/**
|
|
95
|
+
* Register a callback for when the host disconnects from the room.
|
|
96
|
+
* @param callback - Function called when the host leaves
|
|
97
|
+
*/
|
|
98
|
+
onHostDisconnected(callback: () => void): void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Represents a floor - a configured application/use case domain.
|
|
102
|
+
* Provides methods to create or join rooms on this specific floor.
|
|
103
|
+
*/
|
|
104
|
+
export interface Floor {
|
|
105
|
+
/**
|
|
106
|
+
* Create a new room as a host on this floor.
|
|
107
|
+
* @param options - Optional configuration including password protection
|
|
108
|
+
* @returns Promise resolving to a HostedRoom instance
|
|
109
|
+
* @throws {Error} If floor configuration is invalid, server is unreachable, or room creation fails
|
|
110
|
+
*/
|
|
111
|
+
createRoom(options?: HostRoomOptions): Promise<HostedRoom>;
|
|
112
|
+
/**
|
|
113
|
+
* Join an existing room as a guest on this floor.
|
|
114
|
+
* @param roomCode - Unique code identifying the room to join
|
|
115
|
+
* @param options - Optional configuration including password if required
|
|
116
|
+
* @returns Promise resolving to a JoinedRoom instance
|
|
117
|
+
* @throws {Error} If room doesn't exist, password is incorrect, room is full,
|
|
118
|
+
* room has expired, or server communication fails
|
|
119
|
+
*/
|
|
120
|
+
joinRoom(roomCode: string, options?: JoinRoomOptions): Promise<JoinedRoom>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Main entry point for creating a connection to a specific floor on the Lobby server.
|
|
124
|
+
* Floor is automatically identified based on the client origin.
|
|
125
|
+
* @param serverUrl - Base URL of the server (e.g., "https://lobby.example.com")
|
|
126
|
+
* @returns Promise resolving to a Floor instance for the specified server
|
|
127
|
+
* @throws {Error} If the server URL is invalid or the floor doesn't exist
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* // Connect to the chat application floor
|
|
132
|
+
* const floor = await reachFloor("https://lobby.example.com");
|
|
133
|
+
*
|
|
134
|
+
* // Create a new room
|
|
135
|
+
* const hostedRoom = await floor.createRoom({ password: "secret123" });
|
|
136
|
+
*
|
|
137
|
+
* // Or join an existing room
|
|
138
|
+
* const joinedRoom = await floor.joinRoom("ABC123", { password: "secret123" });
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare function reachFloor(serverUrl: string): Promise<Floor>;
|
package/lobbyc.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=o(((e,t)=>{var n=t.exports={},r,i;function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}(function(){try{r=typeof setTimeout==`function`?setTimeout:a}catch{r=a}try{i=typeof clearTimeout==`function`?clearTimeout:o}catch{i=o}})();function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch{try{return r.call(null,e,0)}catch{return r.call(this,e,0)}}}function c(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch{try{return i.call(null,e)}catch{return i.call(this,e)}}}var l=[],u=!1,d,f=-1;function p(){!u||!d||(u=!1,d.length?l=d.concat(l):f=-1,l.length&&m())}function m(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(d=l,l=[];++f<t;)d&&d[f].run();f=-1,t=l.length}d=null,u=!1,c(e)}}n.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),l.length===1&&!u&&s(m)};function h(e,t){this.fun=e,this.array=t}h.prototype.run=function(){this.fun.apply(null,this.array)},n.title=`browser`,n.browser=!0,n.env={},n.argv=[],n.version=``,n.versions={};function g(){}n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw Error(`process.binding is not supported`)},n.cwd=function(){return`/`},n.chdir=function(e){throw Error(`process.chdir is not supported`)},n.umask=function(){return 0}})),u=o(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),d=o(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=u(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,`enabled`,{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),f=o(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&(globalThis.process||l())!==void 0&&`env`in(globalThis.process||l())&&(t=(globalThis.process||l()).env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=d()(e);var{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),p=c(f(),1);const m=(0,p.default)(`lobby:user`),h=(0,p.default)(`lobby:internal`);var g=o(((e,t)=>{t.exports=function(){if(typeof globalThis>`u`)return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}})),_=o((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t={},n={};n.byteLength=u,n.toByteArray=f,n.fromByteArray=h;for(var r=[],i=[],a=typeof Uint8Array<`u`?Uint8Array:Array,o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,s=0,c=o.length;s<c;++s)r[s]=o[s],i[o.charCodeAt(s)]=s;i[45]=62,i[95]=63;function l(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function u(e){var t=l(e),n=t[0],r=t[1];return(n+r)*3/4-r}function d(e,t,n){return(t+n)*3/4-n}function f(e){var t,n=l(e),r=n[0],o=n[1],s=new a(d(e,r,o)),c=0,u=o>0?r-4:r,f;for(f=0;f<u;f+=4)t=i[e.charCodeAt(f)]<<18|i[e.charCodeAt(f+1)]<<12|i[e.charCodeAt(f+2)]<<6|i[e.charCodeAt(f+3)],s[c++]=t>>16&255,s[c++]=t>>8&255,s[c++]=t&255;return o===2&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,s[c++]=t&255),o===1&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,s[c++]=t>>8&255,s[c++]=t&255),s}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[e&63]}function m(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(p(r));return i.join(``)}function h(e){for(var t,n=e.length,i=n%3,a=[],o=16383,s=0,c=n-i;s<c;s+=o)a.push(m(e,s,s+o>c?c:s+o));return i===1?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+`==`)):i===2&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+`=`)),a.join(``)}var g={};g.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},g.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128},(function(e){let t=n,r=g,i=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=d,e.SlowBuffer=ee,e.INSPECT_MAX_BYTES=50;let a=2147483647;e.kMaxLength=a;let{Uint8Array:o,ArrayBuffer:s,SharedArrayBuffer:c}=globalThis;d.TYPED_ARRAY_SUPPORT=l(),!d.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let e=new o(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,o.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,`parent`,{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,`offset`,{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function u(e){if(e>a)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new o(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return h(e)}return f(e,t,n)}d.poolSize=8192;function f(e,t,n){if(typeof e==`string`)return _(e,t);if(s.isView(e))return y(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Q(e,s)||e&&Q(e.buffer,s)||c!==void 0&&(Q(e,c)||e&&Q(e.buffer,c)))return b(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return d.from(r,t,n);let i=x(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return d.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}d.from=function(e,t,n){return f(e,t,n)},Object.setPrototypeOf(d.prototype,o.prototype),Object.setPrototypeOf(d,o);function p(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function m(e,t,n){return p(e),e<=0||t===void 0?u(e):typeof n==`string`?u(e).fill(t,n):u(e).fill(t)}d.alloc=function(e,t,n){return m(e,t,n)};function h(e){return p(e),u(e<0?0:S(e)|0)}d.allocUnsafe=function(e){return h(e)},d.allocUnsafeSlow=function(e){return h(e)};function _(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!d.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=C(e,t)|0,r=u(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function v(e){let t=e.length<0?0:S(e.length)|0,n=u(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function y(e){if(Q(e,o)){let t=new o(e);return b(t.buffer,t.byteOffset,t.byteLength)}return v(e)}function b(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new o(e):n===void 0?new o(e,t):new o(e,t,n),Object.setPrototypeOf(r,d.prototype),r}function x(e){if(d.isBuffer(e)){let t=S(e.length)|0,n=u(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||de(e.length)?u(0):v(e);if(e.type===`Buffer`&&Array.isArray(e.data))return v(e.data)}function S(e){if(e>=a)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+a.toString(16)+` bytes`);return e|0}function ee(e){return+e!=e&&(e=0),d.alloc(+e)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype},d.compare=function(e,t){if(Q(e,o)&&(e=d.from(e,e.offset,e.byteLength)),Q(t,o)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},d.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},d.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return d.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=d.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Q(t,o))i+t.length>r.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(r,i)):o.prototype.set.call(r,t,i);else if(d.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function C(e,t){if(d.isBuffer(e))return e.length;if(s.isView(e)||Q(e,s))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return Z(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return le(e).length;default:if(i)return r?-1:Z(e).length;t=(``+t).toLowerCase(),i=!0}}d.byteLength=C;function w(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return R(this,t,n);case`utf8`:case`utf-8`:return N(this,t,n);case`ascii`:return I(this,t,n);case`latin1`:case`binary`:return L(this,t,n);case`base64`:return M(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return z(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function T(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}d.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)T(this,t,t+1);return this},d.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)T(this,t,t+3),T(this,t+1,t+2);return this},d.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)T(this,t,t+7),T(this,t+1,t+6),T(this,t+2,t+5),T(this,t+3,t+4);return this},d.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?N(this,0,e):w.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:d.compare(this,e)===0},d.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},i&&(d.prototype[i]=d.prototype.inspect),d.prototype.compare=function(e,t,n,r,i){if(Q(e,o)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,s=n-t,c=Math.min(a,s),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],s=u[e];break}return a<s?-1:s<a?1:0};function E(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,de(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=d.from(t,r)),d.isBuffer(t))return t.length===0?-1:te(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof o.prototype.indexOf==`function`?i?o.prototype.indexOf.call(e,t,n):o.prototype.lastIndexOf.call(e,t,n):te(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function te(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}d.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},d.prototype.indexOf=function(e,t,n){return E(this,e,t,n,!0)},d.prototype.lastIndexOf=function(e,t,n){return E(this,e,t,n,!1)};function D(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(de(r))return o;e[n+o]=r}return o}function O(e,t,n,r){return ue(Z(t,e.length-n),e,n,r)}function k(e,t,n,r){return ue(se(t),e,n,r)}function A(e,t,n,r){return ue(le(t),e,n,r)}function j(e,t,n,r){return ue(ce(t,e.length-n),e,n,r)}d.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return D(this,e,t,n);case`utf8`:case`utf-8`:return O(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return k(this,e,t,n);case`base64`:return A(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return j(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},d.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function M(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function N(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return F(r)}let P=4096;function F(e){let t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=P));return n}function I(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function L(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function R(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=fe[e[r]];return i}function z(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}d.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,d.prototype),r};function B(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=$(function(e){e>>>=0,Y(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&X(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),d.prototype.readBigUInt64BE=$(function(e){e>>>=0,Y(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&X(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),d.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},d.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},d.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},d.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=$(function(e){e>>>=0,Y(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&X(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),d.prototype.readBigInt64BE=$(function(e){e>>>=0,Y(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&X(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),d.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),r.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),r.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),r.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),r.read(this,e,!1,52,8)};function V(e,t,n,r,i,a){if(!d.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,255,0),this[t]=e&255,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function H(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function U(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}d.prototype.writeBigUInt64LE=$(function(e,t=0){return H(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeBigUInt64BE=$(function(e,t=0){return U(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},d.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},d.prototype.writeBigInt64LE=$(function(e,t=0){return H(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),d.prototype.writeBigInt64BE=$(function(e,t=0){return U(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function W(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function G(e,t,n,i,a){return t=+t,n>>>=0,a||W(e,t,n,4),r.write(e,t,n,i,23,4),n+4}d.prototype.writeFloatLE=function(e,t,n){return G(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return G(this,e,t,!1,n)};function K(e,t,n,i,a){return t=+t,n>>>=0,a||W(e,t,n,8),r.write(e,t,n,i,52,8),n+8}d.prototype.writeDoubleLE=function(e,t,n){return K(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return K(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,r){if(!d.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof o.prototype.copyWithin==`function`?this.copyWithin(t,n,r):o.prototype.set.call(e,this.subarray(n,r),t),i},d.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!d.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=d.isBuffer(e)?e:d.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let q={};function J(e,t,n){q[e]=class extends n{constructor(){super(),Object.defineProperty(this,`message`,{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,`code`,{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}J(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),J(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),J(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ne(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ne(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ne(e){let t=``,n=e.length,r=e[0]===`-`?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function re(e,t,n){Y(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&X(t,e.length-(n+1))}function ie(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new q.ERR_OUT_OF_RANGE(`value`,i,e)}re(r,i,a)}function Y(e,t){if(typeof e!=`number`)throw new q.ERR_INVALID_ARG_TYPE(t,`number`,e)}function X(e,t,n){throw Math.floor(e)===e?t<0?new q.ERR_BUFFER_OUT_OF_BOUNDS:new q.ERR_OUT_OF_RANGE(n||`offset`,`>= ${n?1:0} and <= ${t}`,e):(Y(e,n),new q.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ae=/[^+/0-9A-Za-z-_]/g;function oe(e){if(e=e.split(`=`)[0],e=e.trim().replace(ae,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function Z(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function se(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ce(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function le(e){return t.toByteArray(oe(e))}function ue(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function de(e){return e!==e}let fe=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function $(e){return typeof BigInt>`u`?pe:e}function pe(){throw Error(`BigInt not supported`)}})(t);var _=t.Buffer;e.Blob=t.Blob,e.BlobOptions=t.BlobOptions,e.Buffer=t.Buffer,e.File=t.File,e.FileOptions=t.FileOptions,e.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,e.SlowBuffer=t.SlowBuffer,e.TranscodeEncoding=t.TranscodeEncoding,e.atob=t.atob,e.btoa=t.btoa,e.constants=t.constants,e.default=_,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode})),v=o(((e,t)=>{var n=_(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),y=o(((e,t)=>{var n=65536,r=4294967295;function i(){throw Error(`Secure random number generation is not supported by this browser.
|
|
2
|
+
Use Chrome, Firefox or Internet Explorer 11`)}var a=v().Buffer,o=globalThis.crypto||globalThis.msCrypto;o&&o.getRandomValues?t.exports=s:t.exports=i;function s(e,t){if(e>r)throw RangeError(`requested too many random bytes`);var i=a.allocUnsafe(e);if(e>0)if(e>n)for(var s=0;s<e;s+=n)o.getRandomValues(i.slice(s,s+n));else o.getRandomValues(i);return typeof t==`function`?(globalThis.process||l()).nextTick(function(){t(null,i)}):i}})),b=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),x=o(((e,t)=>{t.exports=b().EventEmitter})),S=o(((e,t)=>{t.exports={}})),ee=o(((e,t)=>{function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]==null?{}:arguments[t];t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,n){return t=c(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function c(e){var t=l(e,`string`);return typeof t==`symbol`?t:String(t)}function l(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var u=_().Buffer,d=S().inspect,f=d&&d.custom||`inspect`;function p(e,t,n){u.prototype.copy.call(e,t,n)}t.exports=function(){function e(){a(this,e),this.head=null,this.tail=null,this.length=0}return s(e,[{key:`push`,value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:`unshift`,value:function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}},{key:`shift`,value:function(){if(this.length!==0){var e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:`clear`,value:function(){this.head=this.tail=null,this.length=0}},{key:`join`,value:function(e){if(this.length===0)return``;for(var t=this.head,n=``+t.data;t=t.next;)n+=e+t.data;return n}},{key:`concat`,value:function(e){if(this.length===0)return u.alloc(0);for(var t=u.allocUnsafe(e>>>0),n=this.head,r=0;n;)p(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:`consume`,value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:`first`,value:function(){return this.head.data}},{key:`_getString`,value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,a=e>i.length?i.length:e;if(a===i.length?r+=i:r+=i.slice(0,e),e-=a,e===0){a===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(a));break}++n}return this.length-=n,r}},{key:`_getBuffer`,value:function(e){var t=u.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,a=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,a),e-=a,e===0){a===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(a));break}++r}return this.length-=r,t}},{key:f,value:function(e,t){return d(this,r(r({},t),{},{depth:0,customInspect:!1}))}}]),e}()})),C=o(((e,t)=>{function n(e,t){var n=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,(globalThis.process||l()).nextTick(o,this,e)):(globalThis.process||l()).nextTick(o,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?n._writableState?n._writableState.errorEmitted?(globalThis.process||l()).nextTick(i,n):(n._writableState.errorEmitted=!0,(globalThis.process||l()).nextTick(r,n,e)):(globalThis.process||l()).nextTick(r,n,e):t?((globalThis.process||l()).nextTick(i,n),t(e)):(globalThis.process||l()).nextTick(i,n)}),this)}function r(e,t){o(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit(`close`)}function a(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(e,t){e.emit(`error`,t)}function s(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit(`error`,t)}t.exports={destroy:n,undestroy:a,errorOrDestroy:s}})),w=o(((e,t)=>{function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var r={};function i(e,t,i){i||=Error;function a(e,n,r){return typeof t==`string`?t:t(e,n,r)}var o=function(e){n(t,e);function t(t,n,r){return e.call(this,a(t,n,r))||this}return t}(i);o.prototype.name=i.name,o.prototype.code=e,r[e]=o}function a(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?`one of ${t} ${e.slice(0,n-1).join(`, `)}, or `+e[n-1]:n===2?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}function o(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}function s(e,t,n){return(n===void 0||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function c(e,t,n){return typeof n!=`number`&&(n=0),n+t.length>e.length?!1:e.indexOf(t,n)!==-1}i(`ERR_INVALID_OPT_VALUE`,function(e,t){return`The value "`+t+`" is invalid for option "`+e+`"`},TypeError),i(`ERR_INVALID_ARG_TYPE`,function(e,t,n){var r;typeof t==`string`&&o(t,`not `)?(r=`must not be`,t=t.replace(/^not /,``)):r=`must be`;var i=s(e,` argument`)?`The ${e} ${r} ${a(t,`type`)}`:`The "${e}" ${c(e,`.`)?`property`:`argument`} ${r} ${a(t,`type`)}`;return i+=`. Received type ${typeof n}`,i},TypeError),i(`ERR_STREAM_PUSH_AFTER_EOF`,`stream.push() after EOF`),i(`ERR_METHOD_NOT_IMPLEMENTED`,function(e){return`The `+e+` method is not implemented`}),i(`ERR_STREAM_PREMATURE_CLOSE`,`Premature close`),i(`ERR_STREAM_DESTROYED`,function(e){return`Cannot call `+e+` after a stream was destroyed`}),i(`ERR_MULTIPLE_CALLBACK`,`Callback called multiple times`),i(`ERR_STREAM_CANNOT_PIPE`,`Cannot pipe, not readable`),i(`ERR_STREAM_WRITE_AFTER_END`,`write after end`),i(`ERR_STREAM_NULL_VALUES`,`May not write null values to stream`,TypeError),i(`ERR_UNKNOWN_ENCODING`,function(e){return`Unknown encoding: `+e},TypeError),i(`ERR_STREAM_UNSHIFT_AFTER_END_EVENT`,`stream.unshift() after end event`),t.exports.codes=r})),T=o(((e,t)=>{var n=w().codes.ERR_INVALID_OPT_VALUE;function r(e,t,n){return e.highWaterMark==null?t?e[n]:null:e.highWaterMark}function i(e,t,i,a){var o=r(t,a,i);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0)throw new n(a?i:`highWaterMark`,o);return Math.floor(o)}return e.objectMode?16:16*1024}t.exports={getHighWaterMark:i}})),E=o(((e,t)=>{typeof Object.create==`function`?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),te=o(((e,t)=>{t.exports=n;function n(e,t){if(r(`noDeprecation`))return e;var n=!1;function i(){if(!n){if(r(`throwDeprecation`))throw Error(t);r(`traceDeprecation`)?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}return i}function r(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()===`true`}})),D=o(((e,t)=>{t.exports=M;function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){ne(t,e)}}var r;M.WritableState=A;var i={deprecate:te()},a=x(),o=_().Buffer,s=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function c(e){return o.from(e)}function u(e){return o.isBuffer(e)||e instanceof s}var d=C(),f=T().getHighWaterMark,p=w().codes,m=p.ERR_INVALID_ARG_TYPE,h=p.ERR_METHOD_NOT_IMPLEMENTED,g=p.ERR_MULTIPLE_CALLBACK,v=p.ERR_STREAM_CANNOT_PIPE,y=p.ERR_STREAM_DESTROYED,b=p.ERR_STREAM_NULL_VALUES,S=p.ERR_STREAM_WRITE_AFTER_END,ee=p.ERR_UNKNOWN_ENCODING,D=d.errorOrDestroy;E()(M,a);function k(){}function A(e,t,i){r||=O(),e||={},typeof i!=`boolean`&&(i=t instanceof r),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,`writableHighWaterMark`,i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1,this.decodeStrings=e.decodeStrings!==!1,this.defaultEncoding=e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){B(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}A.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},(function(){try{Object.defineProperty(A.prototype,`buffer`,{get:i.deprecate(function(){return this.getBuffer()},`_writableState.buffer is deprecated. Use _writableState.getBuffer instead.`,`DEP0003`)})}catch{}})();var j;typeof Symbol==`function`&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==`function`?(j=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(e){return j.call(this,e)?!0:this===M?e&&e._writableState instanceof A:!1}})):j=function(e){return e instanceof this};function M(e){r||=O();var t=this instanceof r;if(!t&&!j.call(M,this))return new M(e);this._writableState=new A(e,this,t),this.writable=!0,e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final)),a.call(this)}M.prototype.pipe=function(){D(this,new v)};function N(e,t){var n=new S;D(e,n),(globalThis.process||l()).nextTick(t,n)}function P(e,t,n,r){var i;return n===null?i=new b:typeof n!=`string`&&!t.objectMode&&(i=new m(`chunk`,[`string`,`Buffer`],n)),i?(D(e,i),(globalThis.process||l()).nextTick(r,i),!1):!0}M.prototype.write=function(e,t,n){var r=this._writableState,i=!1,a=!r.objectMode&&u(e);return a&&!o.isBuffer(e)&&(e=c(e)),typeof t==`function`&&(n=t,t=null),a?t=`buffer`:t||=r.defaultEncoding,typeof n!=`function`&&(n=k),r.ending?N(this,n):(a||P(this,r,e,n))&&(r.pendingcb++,i=I(this,r,a,e,t,n)),i},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&U(this,e))},M.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=e.toLowerCase()),!([`hex`,`utf8`,`utf-8`,`ascii`,`binary`,`base64`,`ucs2`,`ucs-2`,`utf16le`,`utf-16le`,`raw`].indexOf((e+``).toLowerCase())>-1))throw new ee(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(M.prototype,`writableBuffer`,{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function F(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t==`string`&&(t=o.from(t,n)),t}Object.defineProperty(M.prototype,`writableHighWaterMark`,{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function I(e,t,n,r,i,a){if(!n){var o=F(t,r,i);r!==o&&(n=!0,i=`buffer`,r=o)}var s=t.objectMode?1:r.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else L(e,t,!1,s,r,i,a);return c}function L(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new y(`write`)):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function R(e,t,n,r,i){--t.pendingcb,n?((globalThis.process||l()).nextTick(i,r),(globalThis.process||l()).nextTick(q,e,t),e._writableState.errorEmitted=!0,D(e,r)):(i(r),e._writableState.errorEmitted=!0,D(e,r),q(e,t))}function z(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function B(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(typeof i!=`function`)throw new g;if(z(n),t)R(e,n,r,t,i);else{var a=W(n)||e.destroyed;!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&U(e,n),r?(globalThis.process||l()).nextTick(V,e,n,a,i):V(e,n,a,i)}}function V(e,t,n,r){n||H(e,t),t.pendingcb--,r(),q(e,t)}function H(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`))}function U(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,a=Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)a[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;a.allBuffers=c,L(e,t,!0,t.length,a,``,o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,d=r.callback;if(L(e,t,!1,t.objectMode?1:l.length,l,u,d),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}M.prototype._write=function(e,t,n){n(new h(`_write()`))},M.prototype._writev=null,M.prototype.end=function(e,t,n){var r=this._writableState;return typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null),e!=null&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||J(this,r,n),this},Object.defineProperty(M.prototype,`writableLength`,{enumerable:!1,get:function(){return this._writableState.length}});function W(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function G(e,t){e._final(function(n){t.pendingcb--,n&&D(e,n),t.prefinished=!0,e.emit(`prefinish`),q(e,t)})}function K(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,(globalThis.process||l()).nextTick(G,e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function q(e,t){var n=W(t);if(n&&(K(e,t),t.pendingcb===0&&(t.finished=!0,e.emit(`finish`),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}function J(e,t,n){t.ending=!0,q(e,t),n&&(t.finished?(globalThis.process||l()).nextTick(n):e.once(`finish`,n)),t.ended=!0,e.writable=!1}function ne(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}Object.defineProperty(M.prototype,`destroyed`,{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),M.prototype.destroy=d.destroy,M.prototype._undestroy=d.undestroy,M.prototype._destroy=function(e,t){t(e)}})),O=o(((e,t)=>{var n=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=c;var r=N(),i=D();E()(c,r);for(var a=n(i.prototype),o=0;o<a.length;o++){var s=a[o];c.prototype[s]||(c.prototype[s]=i.prototype[s])}function c(e){if(!(this instanceof c))return new c(e);r.call(this,e),i.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once(`end`,u)))}Object.defineProperty(c.prototype,`writableHighWaterMark`,{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,`writableBuffer`,{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,`writableLength`,{enumerable:!1,get:function(){return this._writableState.length}});function u(){this._writableState.ended||(globalThis.process||l()).nextTick(d,this)}function d(e){e.end()}Object.defineProperty(c.prototype,`destroyed`,{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})})),k=o((e=>{var t=v().Buffer,n=t.isEncoding||function(e){switch(e=``+e,e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function r(e){if(!e)return`utf8`;for(var t;;)switch(e){case`utf8`:case`utf-8`:return`utf8`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;case`latin1`:case`binary`:return`latin1`;case`base64`:case`ascii`:case`hex`:return e;default:if(t)return;e=(``+e).toLowerCase(),t=!0}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString(`base64`,t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+this.lastChar.toString(`base64`,0,3-this.lastNeed):t}function g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),A=o(((e,t)=>{var n=w().codes.ERR_STREAM_PREMATURE_CLOSE;function r(e){var t=!1;return function(){if(!t){t=!0;var n=[...arguments];e.apply(this,n)}}}function i(){}function a(e){return e.setHeader&&typeof e.abort==`function`}function o(e,t,s){if(typeof t==`function`)return o(e,null,t);t||={},s=r(s||i);var c=t.readable||t.readable!==!1&&e.readable,l=t.writable||t.writable!==!1&&e.writable,u=function(){e.writable||f()},d=e._writableState&&e._writableState.finished,f=function(){l=!1,d=!0,c||s.call(e)},p=e._readableState&&e._readableState.endEmitted,m=function(){c=!1,p=!0,l||s.call(e)},h=function(t){s.call(e,t)},g=function(){var t;if(c&&!p)return(!e._readableState||!e._readableState.ended)&&(t=new n),s.call(e,t);if(l&&!d)return(!e._writableState||!e._writableState.ended)&&(t=new n),s.call(e,t)},_=function(){e.req.on(`finish`,f)};return a(e)?(e.on(`complete`,f),e.on(`abort`,g),e.req?_():e.on(`request`,_)):l&&!e._writableState&&(e.on(`end`,u),e.on(`close`,u)),e.on(`end`,m),e.on(`finish`,f),t.error!==!1&&e.on(`error`,h),e.on(`close`,g),function(){e.removeListener(`complete`,f),e.removeListener(`abort`,g),e.removeListener(`request`,_),e.req&&e.req.removeListener(`finish`,f),e.removeListener(`end`,u),e.removeListener(`close`,u),e.removeListener(`finish`,f),e.removeListener(`end`,m),e.removeListener(`error`,h),e.removeListener(`close`,g)}}t.exports=o})),j=o(((e,t)=>{var n;function r(e,t,n){return t=i(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=a(e,`string`);return typeof t==`symbol`?t:String(t)}function a(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var o=A(),s=Symbol(`lastResolve`),c=Symbol(`lastReject`),u=Symbol(`error`),d=Symbol(`ended`),f=Symbol(`lastPromise`),p=Symbol(`handlePromise`),m=Symbol(`stream`);function h(e,t){return{value:e,done:t}}function g(e){var t=e[s];if(t!==null){var n=e[m].read();n!==null&&(e[f]=null,e[s]=null,e[c]=null,t(h(n,!1)))}}function _(e){(globalThis.process||l()).nextTick(g,e)}function v(e,t){return function(n,r){e.then(function(){if(t[d]){n(h(void 0,!0));return}t[p](n,r)},r)}}var y=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((n={get stream(){return this[m]},next:function(){var e=this,t=this[u];if(t!==null)return Promise.reject(t);if(this[d])return Promise.resolve(h(void 0,!0));if(this[m].destroyed)return new Promise(function(t,n){(globalThis.process||l()).nextTick(function(){e[u]?n(e[u]):t(h(void 0,!0))})});var n=this[f],r;if(n)r=new Promise(v(n,this));else{var i=this[m].read();if(i!==null)return Promise.resolve(h(i,!1));r=new Promise(this[p])}return this[f]=r,r}},r(n,Symbol.asyncIterator,function(){return this}),r(n,`return`,function(){var e=this;return new Promise(function(t,n){e[m].destroy(null,function(e){if(e){n(e);return}t(h(void 0,!0))})})}),n),y);t.exports=function(e){var t,n=Object.create(b,(t={},r(t,m,{value:e,writable:!0}),r(t,s,{value:null,writable:!0}),r(t,c,{value:null,writable:!0}),r(t,u,{value:null,writable:!0}),r(t,d,{value:e._readableState.endEmitted,writable:!0}),r(t,p,{value:function(e,t){var r=n[m].read();r?(n[f]=null,n[s]=null,n[c]=null,e(h(r,!1))):(n[s]=e,n[c]=t)},writable:!0}),t));return n[f]=null,o(e,function(e){if(e&&e.code!==`ERR_STREAM_PREMATURE_CLOSE`){var t=n[c];t!==null&&(n[f]=null,n[s]=null,n[c]=null,t(e)),n[u]=e;return}var r=n[s];r!==null&&(n[f]=null,n[s]=null,n[c]=null,r(h(void 0,!0))),n[d]=!0}),e.on(`readable`,_.bind(null,n)),n}})),M=o(((e,t)=>{t.exports=function(){throw Error(`Readable.from is not available in the browser`)}})),N=o(((e,t)=>{t.exports=R;var n;R.ReadableState=L,b().EventEmitter;var r=function(e,t){return e.listeners(t).length},i=x(),a=_().Buffer,o=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function s(e){return a.from(e)}function c(e){return a.isBuffer(e)||e instanceof o}var u=S(),d=u&&u.debuglog?u.debuglog(`stream`):function(){},f=ee(),p=C(),m=T().getHighWaterMark,h=w().codes,g=h.ERR_INVALID_ARG_TYPE,v=h.ERR_STREAM_PUSH_AFTER_EOF,y=h.ERR_METHOD_NOT_IMPLEMENTED,te=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,D,A,N;E()(R,i);var P=p.errorOrDestroy,F=[`error`,`close`,`destroy`,`pause`,`resume`];function I(e,t,n){if(typeof e.prependListener==`function`)return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function L(e,t,r){n||=O(),e||={},typeof r!=`boolean`&&(r=t instanceof n),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,`readableHighWaterMark`,r),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||`utf8`,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(D||=k().StringDecoder,this.decoder=new D(e.encoding),this.encoding=e.encoding)}function R(e){if(n||=O(),!(this instanceof R))return new R(e);var t=this instanceof n;this._readableState=new L(e,this,t),this.readable=!0,e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy)),i.call(this)}Object.defineProperty(R.prototype,`destroyed`,{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),R.prototype.destroy=p.destroy,R.prototype._undestroy=p.undestroy,R.prototype._destroy=function(e,t){t(e)},R.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:typeof e==`string`&&(t||=n.defaultEncoding,t!==n.encoding&&(e=a.from(e,t),t=``),r=!0),z(this,e,t,!1,r)},R.prototype.unshift=function(e){return z(this,e,null,!0,!1)};function z(e,t,n,r,i){d(`readableAddChunk`,t);var o=e._readableState;if(t===null)o.reading=!1,G(e,o);else{var c;if(i||(c=V(o,t)),c)P(e,c);else if(o.objectMode||t&&t.length>0)if(typeof t!=`string`&&!o.objectMode&&Object.getPrototypeOf(t)!==a.prototype&&(t=s(t)),r)o.endEmitted?P(e,new te):B(e,o,t,!0);else if(o.ended)P(e,new v);else if(o.destroyed)return!1;else o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||t.length!==0?B(e,o,t,!1):J(e,o)):B(e,o,t,!1);else r||(o.reading=!1,J(e,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function B(e,t,n,r){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit(`data`,n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&K(e)),J(e,t)}function V(e,t){var n;return!c(t)&&typeof t!=`string`&&t!==void 0&&!e.objectMode&&(n=new g(`chunk`,[`string`,`Buffer`,`Uint8Array`],t)),n}R.prototype.isPaused=function(){return this._readableState.flowing===!1},R.prototype.setEncoding=function(e){D||=k().StringDecoder;var t=new D(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r=``;n!==null;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),r!==``&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var H=1073741824;function U(e){return e>=H?e=H:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function W(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=U(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}R.prototype.read=function(e){d(`read`,e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark===0?t.length>0:t.length>=t.highWaterMark)||t.ended))return d(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?se(this):K(this),null;if(e=W(e,t),e===0&&t.ended)return t.length===0&&se(this),null;var r=t.needReadable;d(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,d(`length less than watermark`,r)),t.ended||t.reading?(r=!1,d(`reading or ended`,r)):r&&(d(`do read`),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=W(n,t)));var i=e>0?Z(e,t):null;return i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&se(this)),i!==null&&this.emit(`data`,i),i};function G(e,t){if(d(`onEofChunk`),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?K(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,q(e)))}}function K(e){var t=e._readableState;d(`emitReadable`,t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(d(`emitReadable`,t.flowing),t.emittedReadable=!0,(globalThis.process||l()).nextTick(q,e))}function q(e){var t=e._readableState;d(`emitReadable_`,t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit(`readable`),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,oe(e)}function J(e,t){t.readingMore||(t.readingMore=!0,(globalThis.process||l()).nextTick(ne,e,t))}function ne(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var n=t.length;if(d(`maybeReadMore read 0`),e.read(0),n===t.length)break}t.readingMore=!1}R.prototype._read=function(e){P(this,new y(`_read()`))},R.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,d(`pipe count=%d opts=%j`,i.pipesCount,t);var a=(!t||t.end!==!1)&&e!==(globalThis.process||l()).stdout&&e!==(globalThis.process||l()).stderr?s:_;i.endEmitted?(globalThis.process||l()).nextTick(a):n.once(`end`,a),e.on(`unpipe`,o);function o(e,t){d(`onunpipe`),e===n&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,f())}function s(){d(`onend`),e.end()}var c=re(n);e.on(`drain`,c);var u=!1;function f(){d(`cleanup`),e.removeListener(`close`,h),e.removeListener(`finish`,g),e.removeListener(`drain`,c),e.removeListener(`error`,m),e.removeListener(`unpipe`,o),n.removeListener(`end`,s),n.removeListener(`end`,_),n.removeListener(`data`,p),u=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}n.on(`data`,p);function p(t){d(`ondata`);var r=e.write(t);d(`dest.write`,r),r===!1&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&le(i.pipes,e)!==-1)&&!u&&(d(`false write response, pause`,i.awaitDrain),i.awaitDrain++),n.pause())}function m(t){d(`onerror`,t),_(),e.removeListener(`error`,m),r(e,`error`)===0&&P(e,t)}I(e,`error`,m);function h(){e.removeListener(`finish`,g),_()}e.once(`close`,h);function g(){d(`onfinish`),e.removeListener(`close`,h),_()}e.once(`finish`,g);function _(){d(`unpipe`),n.unpipe(e)}return e.emit(`pipe`,n),i.flowing||(d(`pipe resume`),n.resume()),e};function re(e){return function(){var t=e._readableState;d(`pipeOnDrain`,t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&r(e,`data`)&&(t.flowing=!0,oe(e))}}R.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||=t.pipes,t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit(`unpipe`,this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit(`unpipe`,this,{hasUnpiped:!1});return this}var o=le(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),--t.pipesCount,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit(`unpipe`,this,n),this)},R.prototype.on=function(e,t){var n=i.prototype.on.call(this,e,t),r=this._readableState;return e===`data`?(r.readableListening=this.listenerCount(`readable`)>0,r.flowing!==!1&&this.resume()):e===`readable`&&!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,d(`on readable`,r.length,r.reading),r.length?K(this):r.reading||(globalThis.process||l()).nextTick(Y,this)),n},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(e,t){var n=i.prototype.removeListener.call(this,e,t);return e===`readable`&&(globalThis.process||l()).nextTick(ie,this),n},R.prototype.removeAllListeners=function(e){var t=i.prototype.removeAllListeners.apply(this,arguments);return(e===`readable`||e===void 0)&&(globalThis.process||l()).nextTick(ie,this),t};function ie(e){var t=e._readableState;t.readableListening=e.listenerCount(`readable`)>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount(`data`)>0&&e.resume()}function Y(e){d(`readable nexttick read 0`),e.read(0)}R.prototype.resume=function(){var e=this._readableState;return e.flowing||(d(`resume`),e.flowing=!e.readableListening,X(this,e)),e.paused=!1,this};function X(e,t){t.resumeScheduled||(t.resumeScheduled=!0,(globalThis.process||l()).nextTick(ae,e,t))}function ae(e,t){d(`resume`,t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit(`resume`),oe(e),t.flowing&&!t.reading&&e.read(0)}R.prototype.pause=function(){return d(`call pause flowing=%j`,this._readableState.flowing),this._readableState.flowing!==!1&&(d(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this._readableState.paused=!0,this};function oe(e){var t=e._readableState;for(d(`flow`,t.flowing);t.flowing&&e.read()!==null;);}R.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on(`end`,function(){if(d(`wrapped end`),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on(`data`,function(i){d(`wrapped data`),n.decoder&&(i=n.decoder.write(i)),!(n.objectMode&&i==null)&&(!n.objectMode&&(!i||!i.length)||t.push(i)||(r=!0,e.pause()))}),e)this[i]===void 0&&typeof e[i]==`function`&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<F.length;a++)e.on(F[a],this.emit.bind(this,F[a]));return this._read=function(t){d(`wrapped _read`,t),r&&(r=!1,e.resume())},this},typeof Symbol==`function`&&(R.prototype[Symbol.asyncIterator]=function(){return A===void 0&&(A=j()),A(this)}),Object.defineProperty(R.prototype,`readableHighWaterMark`,{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,`readableBuffer`,{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,`readableFlowing`,{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),R._fromList=Z,Object.defineProperty(R.prototype,`readableLength`,{enumerable:!1,get:function(){return this._readableState.length}});function Z(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function se(e){var t=e._readableState;d(`endReadable`,t.endEmitted),t.endEmitted||(t.ended=!0,(globalThis.process||l()).nextTick(ce,t,e))}function ce(e,t){if(d(`endReadableNT`,e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit(`end`),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}typeof Symbol==`function`&&(R.from=function(e,t){return N===void 0&&(N=M()),N(R,e,t)});function le(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}})),P=o(((e,t)=>{t.exports=l;var n=w().codes,r=n.ERR_METHOD_NOT_IMPLEMENTED,i=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=n.ERR_TRANSFORM_WITH_LENGTH_0,s=O();E()(l,s);function c(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit(`error`,new i);n.writechunk=null,n.writecb=null,t!=null&&this.push(t),r(e);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function l(e){if(!(this instanceof l))return new l(e);s.call(this,e),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,u)}function u(){var e=this;typeof this._flush==`function`&&!this._readableState.destroyed?this._flush(function(t,n){d(e,t,n)}):d(this,null,null)}l.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},l.prototype._transform=function(e,t,n){n(new r(`_transform()`))},l.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},l.prototype._destroy=function(e,t){s.prototype._destroy.call(this,e,function(e){t(e)})};function d(e,t,n){if(t)return e.emit(`error`,t);if(n!=null&&e.push(n),e._writableState.length)throw new o;if(e._transformState.transforming)throw new a;return e.push(null)}})),F=o(((e,t)=>{t.exports=r;var n=P();E()(r,n);function r(e){if(!(this instanceof r))return new r(e);n.call(this,e)}r.prototype._transform=function(e,t,n){n(null,e)}})),I=o(((e,t)=>{var n;function r(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var i=w().codes,a=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function c(e){return e.setHeader&&typeof e.abort==`function`}function l(e,t,i,a){a=r(a);var s=!1;e.on(`close`,function(){s=!0}),n===void 0&&(n=A()),n(e,{readable:t,writable:i},function(e){if(e)return a(e);s=!0,a()});var l=!1;return function(t){if(!s&&!l){if(l=!0,c(e))return e.abort();if(typeof e.destroy==`function`)return e.destroy();a(t||new o(`pipe`))}}}function u(e){e()}function d(e,t){return e.pipe(t)}function f(e){return!e.length||typeof e[e.length-1]!=`function`?s:e.pop()}function p(){var e=[...arguments],t=f(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new a(`streams`);var n,r=e.map(function(i,a){var o=a<e.length-1;return l(i,o,a>0,function(e){n||=e,e&&r.forEach(u),!o&&(r.forEach(u),t(n))})});return e.reduce(d)}t.exports=p})),L=o(((e,t)=>{e=t.exports=N(),e.Stream=e,e.Readable=e,e.Writable=D(),e.Duplex=O(),e.Transform=P(),e.PassThrough=F(),e.finished=A(),e.pipeline=I()})),R=o(((e,t)=>{var n;t.exports=typeof queueMicrotask==`function`?queueMicrotask.bind(typeof window<`u`?window:globalThis):e=>(n||=Promise.resolve()).then(e).catch(e=>setTimeout(()=>{throw e},0))})),z=o(((e,t)=>{function n(e,t){for(let n in t)Object.defineProperty(e,n,{value:t[n],enumerable:!0,configurable:!0});return e}function r(e,t,r){if(!e||typeof e==`string`)throw TypeError(`Please pass an Error to err-code`);r||={},typeof t==`object`&&(r=t,t=``),t&&(r.code=t);try{return n(e,r)}catch{r.message=e.message,r.stack=e.stack;let t=function(){};return t.prototype=Object.create(Object.getPrototypeOf(e)),n(new t,r)}}t.exports=r})),B=c(o(((e,t)=>{var n=f()(`simple-peer`),r=g(),i=y(),a=L(),o=R(),s=z(),{Buffer:c}=_(),l=64*1024,u=5*1e3,d=5*1e3;function p(e){return e.replace(/a=ice-options:trickle\s\n/g,``)}function m(e){console.warn(e)}var h=class e extends a.Duplex{constructor(t){if(t=Object.assign({allowHalfOpen:!1},t),super(t),this._id=i(4).toString(`hex`).slice(0,7),this._debug(`new peer %o`,t),this.channelName=t.initiator?t.channelName||i(20).toString(`hex`):null,this.initiator=t.initiator||!1,this.channelConfig=t.channelConfig||e.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},e.config,t.config),this.offerOptions=t.offerOptions||{},this.answerOptions=t.answerOptions||{},this.sdpTransform=t.sdpTransform||(e=>e),this.streams=t.streams||(t.stream?[t.stream]:[]),this.trickle=t.trickle===void 0?!0:t.trickle,this.allowHalfTrickle=t.allowHalfTrickle===void 0?!1:t.allowHalfTrickle,this.iceCompleteTimeout=t.iceCompleteTimeout||u,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=t.wrtc&&typeof t.wrtc==`object`?t.wrtc:r(),!this._wrtc)throw s(typeof window>`u`?Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):Error(`No WebRTC support: Not a supported browser`),`ERR_WEBRTC_SUPPORT`);this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(e){this.destroy(s(e,`ERR_PC_CONSTRUCTOR`));return}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId==`number`,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=e=>{this._onIceCandidate(e)},typeof this._pc.peerIdentity==`object`&&this._pc.peerIdentity.catch(e=>{this.destroy(s(e,`ERR_PC_PEER_IDENTITY`))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach(e=>{this.addStream(e)}),this._pc.ontrack=e=>{this._onTrack(e)},this._debug(`initial negotiation`),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once(`finish`,this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState===`open`}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(!this.destroying){if(this.destroyed)throw s(Error(`cannot signal after peer is destroyed`),`ERR_DESTROYED`);if(typeof e==`string`)try{e=JSON.parse(e)}catch{e={}}this._debug(`signal()`),e.renegotiate&&this.initiator&&(this._debug(`got request to renegotiate`),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug(`got request for transceiver`),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(e=>{this._addIceCandidate(e)}),this._pendingCandidates=[],this._pc.remoteDescription.type===`offer`&&this._createAnswer())}).catch(e=>{this.destroy(s(e,`ERR_SET_REMOTE_DESCRIPTION`))}),!e.sdp&&!e.candidate&&!e.renegotiate&&!e.transceiverRequest&&this.destroy(s(Error(`signal() called with invalid signal data`),`ERR_SIGNALING`))}}_addIceCandidate(e){let t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch(e=>{!t.address||t.address.endsWith(`.local`)?m(`Ignoring unsupported ICE candidate.`):this.destroy(s(e,`ERR_ADD_ICE_CANDIDATE`))})}send(e){if(!this.destroying){if(this.destroyed)throw s(Error(`cannot send after peer is destroyed`),`ERR_DESTROYED`);this._channel.send(e)}}addTransceiver(e,t){if(!this.destroying){if(this.destroyed)throw s(Error(`cannot addTransceiver after peer is destroyed`),`ERR_DESTROYED`);if(this._debug(`addTransceiver()`),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(s(e,`ERR_ADD_TRANSCEIVER`))}else this.emit(`signal`,{type:`transceiverRequest`,transceiverRequest:{kind:e,init:t}})}}addStream(e){if(!this.destroying){if(this.destroyed)throw s(Error(`cannot addStream after peer is destroyed`),`ERR_DESTROYED`);this._debug(`addStream()`),e.getTracks().forEach(t=>{this.addTrack(t,e)})}}addTrack(e,t){if(this.destroying)return;if(this.destroyed)throw s(Error(`cannot addTrack after peer is destroyed`),`ERR_DESTROYED`);this._debug(`addTrack()`);let n=this._senderMap.get(e)||new Map,r=n.get(t);if(!r)r=this._pc.addTrack(e,t),n.set(t,r),this._senderMap.set(e,n),this._needsNegotiation();else if(r.removed)throw s(Error(`Track has been removed. You should enable/disable tracks that you want to re-add.`),`ERR_SENDER_REMOVED`);else throw s(Error(`Track has already been added to that stream.`),`ERR_SENDER_ALREADY_ADDED`)}replaceTrack(e,t,n){if(this.destroying)return;if(this.destroyed)throw s(Error(`cannot replaceTrack after peer is destroyed`),`ERR_DESTROYED`);this._debug(`replaceTrack()`);let r=this._senderMap.get(e),i=r?r.get(n):null;if(!i)throw s(Error(`Cannot replace track that was never added.`),`ERR_TRACK_NOT_ADDED`);t&&this._senderMap.set(t,r),i.replaceTrack==null?this.destroy(s(Error(`replaceTrack is not supported in this browser`),`ERR_UNSUPPORTED_REPLACETRACK`)):i.replaceTrack(t)}removeTrack(e,t){if(this.destroying)return;if(this.destroyed)throw s(Error(`cannot removeTrack after peer is destroyed`),`ERR_DESTROYED`);this._debug(`removeSender()`);let n=this._senderMap.get(e),r=n?n.get(t):null;if(!r)throw s(Error(`Cannot remove track that was never added.`),`ERR_TRACK_NOT_ADDED`);try{r.removed=!0,this._pc.removeTrack(r)}catch(e){e.name===`NS_ERROR_UNEXPECTED`?this._sendersAwaitingStable.push(r):this.destroy(s(e,`ERR_REMOVE_TRACK`))}this._needsNegotiation()}removeStream(e){if(!this.destroying){if(this.destroyed)throw s(Error(`cannot removeStream after peer is destroyed`),`ERR_DESTROYED`);this._debug(`removeSenders()`),e.getTracks().forEach(t=>{this.removeTrack(t,e)})}}_needsNegotiation(){this._debug(`_needsNegotiation`),!this._batchedNegotiation&&(this._batchedNegotiation=!0,o(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug(`starting batched negotiation`),this.negotiate()):this._debug(`non-initiator initial negotiation request discarded`),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw s(Error(`cannot negotiate after peer is destroyed`),`ERR_DESTROYED`);this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug(`already negotiating, queueing`)):(this._debug(`start negotiation`),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug(`already negotiating, queueing`)):(this._debug(`requesting negotiation from initiator`),this.emit(`signal`,{type:`renegotiate`,renegotiate:!0})),this._isNegotiating=!0}}destroy(e){this._destroy(e,()=>{})}_destroy(e,t){this.destroyed||this.destroying||(this.destroying=!0,this._debug(`destroying (error: %s)`,e&&(e.message||e)),o(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug(`destroy (error: %s)`,e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener(`finish`,this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit(`error`,e),this.emit(`close`),t()}))}_setupData(e){if(!e.channel)return this.destroy(s(Error("Data channel event is missing `channel` property"),`ERR_DATA_CHANNEL`));this._channel=e.channel,this._channel.binaryType=`arraybuffer`,typeof this._channel.bufferedAmountLowThreshold==`number`&&(this._channel.bufferedAmountLowThreshold=l),this.channelName=this._channel.label,this._channel.onmessage=e=>{this._onChannelMessage(e)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=e=>{let t=e.error instanceof Error?e.error:Error(`Datachannel error: ${e.message} ${e.filename}:${e.lineno}:${e.colno}`);this.destroy(s(t,`ERR_DATA_CHANNEL`))};let t=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState===`closing`?(t&&this._onChannelClose(),t=!0):t=!1},d)}_read(){}_write(e,t,n){if(this.destroyed)return n(s(Error(`cannot write after peer is destroyed`),`ERR_DATA_CHANNEL`));if(this._connected){try{this.send(e)}catch(e){return this.destroy(s(e,`ERR_DATA_CHANNEL`))}this._channel.bufferedAmount>l?(this._debug(`start backpressure: bufferedAmount %d`,this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug(`write before connect`),this._chunk=e,this._cb=n}_onFinish(){if(this.destroyed)return;let e=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?e():this.once(`connect`,e)}_startIceCompleteTimeout(){this.destroyed||(this._iceCompleteTimer||=(this._debug(`started iceComplete timeout`),setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug(`iceComplete timeout completed`),this.emit(`iceTimeout`),this.emit(`_iceComplete`))},this.iceCompleteTimeout)))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(e=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(e.sdp=p(e.sdp)),e.sdp=this.sdpTransform(e.sdp);let t=()=>{if(this.destroyed)return;let t=this._pc.localDescription||e;this._debug(`signal`),this.emit(`signal`,{type:t.type,sdp:t.sdp})};this._pc.setLocalDescription(e).then(()=>{this._debug(`createOffer success`),!this.destroyed&&(this.trickle||this._iceComplete?t():this.once(`_iceComplete`,t))}).catch(e=>{this.destroy(s(e,`ERR_SET_LOCAL_DESCRIPTION`))})}).catch(e=>{this.destroy(s(e,`ERR_CREATE_OFFER`))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(e=>{!e.mid&&e.sender.track&&!e.requested&&(e.requested=!0,this.addTransceiver(e.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(e=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(e.sdp=p(e.sdp)),e.sdp=this.sdpTransform(e.sdp);let t=()=>{if(this.destroyed)return;let t=this._pc.localDescription||e;this._debug(`signal`),this.emit(`signal`,{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()};this._pc.setLocalDescription(e).then(()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once(`_iceComplete`,t))}).catch(e=>{this.destroy(s(e,`ERR_SET_LOCAL_DESCRIPTION`))})}).catch(e=>{this.destroy(s(e,`ERR_CREATE_ANSWER`))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState===`failed`&&this.destroy(s(Error(`Connection failed.`),`ERR_CONNECTION_FAILURE`))}_onIceStateChange(){if(this.destroyed)return;let e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug(`iceStateChange (connection: %s) (gathering: %s)`,e,t),this.emit(`iceStateChange`,e,t),(e===`connected`||e===`completed`)&&(this._pcReady=!0,this._maybeReady()),e===`failed`&&this.destroy(s(Error(`Ice connection failed.`),`ERR_ICE_CONNECTION_FAILURE`)),e===`closed`&&this.destroy(s(Error(`Ice connection closed.`),`ERR_ICE_CONNECTION_CLOSED`))}getStats(e){let t=e=>(Object.prototype.toString.call(e.values)===`[object Array]`&&e.values.forEach(t=>{Object.assign(e,t)}),e);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(n=>{let r=[];n.forEach(e=>{r.push(t(e))}),e(null,r)},t=>e(t)):this._pc.getStats.length>0?this._pc.getStats(n=>{if(this.destroyed)return;let r=[];n.result().forEach(e=>{let n={};e.names().forEach(t=>{n[t]=e.stat(t)}),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,r.push(t(n))}),e(null,r)},t=>e(t)):e(null,[])}_maybeReady(){if(this._debug(`maybeReady pc %s channel %s`,this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;let e=()=>{this.destroyed||this.getStats((t,n)=>{if(this.destroyed)return;t&&(n=[]);let r={},i={},a={},o=!1;n.forEach(e=>{(e.type===`remotecandidate`||e.type===`remote-candidate`)&&(r[e.id]=e),(e.type===`localcandidate`||e.type===`local-candidate`)&&(i[e.id]=e),(e.type===`candidatepair`||e.type===`candidate-pair`)&&(a[e.id]=e)});let c=e=>{o=!0;let t=i[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):typeof e.googLocalAddress==`string`&&(t=e.googLocalAddress.split(`:`),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(`:`)?`IPv6`:`IPv4`);let n=r[e.remoteCandidateId];n&&(n.ip||n.address)?(this.remoteAddress=n.ip||n.address,this.remotePort=Number(n.port)):n&&n.ipAddress?(this.remoteAddress=n.ipAddress,this.remotePort=Number(n.portNumber)):typeof e.googRemoteAddress==`string`&&(n=e.googRemoteAddress.split(`:`),this.remoteAddress=n[0],this.remotePort=Number(n[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(`:`)?`IPv6`:`IPv4`),this._debug(`connect local: %s:%s remote: %s:%s`,this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(n.forEach(e=>{e.type===`transport`&&e.selectedCandidatePairId&&c(a[e.selectedCandidatePairId]),(e.type===`googCandidatePair`&&e.googActiveConnection===`true`||(e.type===`candidatepair`||e.type===`candidate-pair`)&&e.selected)&&c(e)}),!o&&(!Object.keys(a).length||Object.keys(i).length)){setTimeout(e,100);return}else this._connecting=!1,this._connected=!0;if(this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(s(e,`ERR_DATA_CHANNEL`))}this._chunk=null,this._debug(`sent chunk from "write before connect"`);let e=this._cb;this._cb=null,e(null)}typeof this._channel.bufferedAmountLowThreshold!=`number`&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug(`connect`),this.emit(`connect`)})};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>l||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState===`stable`&&(this._isNegotiating=!1,this._debug(`flushing sender queue`,this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug(`flushing negotiation queue`),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug(`negotiated`),this.emit(`negotiated`))),this._debug(`signalingStateChange %s`,this._pc.signalingState),this.emit(`signalingStateChange`,this._pc.signalingState))}_onIceCandidate(e){this.destroyed||(e.candidate&&this.trickle?this.emit(`signal`,{type:`candidate`,candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):!e.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit(`_iceComplete`)),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=c.from(t)),this.push(t)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug(`ending backpressure: bufferedAmount %d`,this._channel.bufferedAmount);let e=this._cb;this._cb=null,e(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug(`on channel open`),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug(`on channel close`),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach(t=>{this._debug(`on track`),this.emit(`track`,e.track,t),this._remoteTracks.push({track:e.track,stream:t}),!this._remoteStreams.some(e=>e.id===t.id)&&(this._remoteStreams.push(t),o(()=>{this._debug(`on stream`),this.emit(`stream`,t)}))})}_debug(){let e=[].slice.call(arguments);e[0]=`[`+this._id+`] `+e[0],n.apply(null,e)}};h.WEBRTC_SUPPORT=!!r(),h.config={iceServers:[{urls:[`stun:stun.l.google.com:19302`,`stun:global.stun.twilio.com:3478`]}],sdpSemantics:`unified-plan`},h.channelConfig={},t.exports=h}))(),1),V=class{state;onDisconnectedCallbacks=[];onMessageCallbacks=[];onLockCallbacks=[];onErrorCallbacks=[];isDestroyed=!1;constructor(e){this.state=e,this.setupSSEConnection()}get roomCode(){return this.state.roomCode}get hostId(){return this.state.hostId}get lockAt(){return this.state.locksAt}async leave(){if(m(`Leaving voluntarily room ${this.state.roomCode}`),!this.isDestroyed){for(let[e,t]of this.state.peerConnections)t.peer&&t.peer.destroy();this.state.sseConnection&&this.state.sseConnection.close(),this.isDestroyed=!0}}onDisconnected(e){this.onDisconnectedCallbacks.push(e)}async sendMessage(e,t){let n=this.state.peerConnections.get(e);if(!n||!n.peer||!n.isConnected)throw Error(`Peer ${e} is not connected`);try{n.peer.send(JSON.stringify(t))}catch(t){throw Error(`Failed to send message to peer ${e}: ${t}`)}}onMessage(e){this.onMessageCallbacks.push(e)}onLock(e){this.onLockCallbacks.push(e)}onError(e){this.onErrorCallbacks.push(e)}async sendSignalingMessage(e,t){let n={fromPeerId:this.state.myPeerId,toPeerId:e,message:t};m(`Sending signaling message:`,n);let r=await fetch(`${this.state.serverUrl}/rooms/${this.state.roomCode}/signaling`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!r.ok){let e=await r.json();throw Error(`Signaling failed: ${e.message}`)}}setupSSEConnection(){let e=`${this.state.serverUrl}/rooms/events?peerId=${this.state.myPeerId}`,t=new EventSource(e);t.addEventListener(`keepalive`,()=>{h(`Keepalive at`,new Date)}),t.addEventListener(`signaling`,async e=>{let t=JSON.parse(e.data);await this.handleSignalingMessage(t)}),t.addEventListener(`room_expired`,()=>{m(`Received room lock message at`,new Date),this.handleRoomExpired()}),t.addEventListener(`room_deleted`,()=>{m(`Received room deleted message at`,new Date),this.handleRoomDeleted()}),t.addEventListener(`error`,e=>{this.handleError(Error(`SSE connection error: ${e}`))}),this.state.sseConnection=t}async handleSignalingMessage(e){m(`Received signaling message:`,e);let{fromPeerId:t,message:n}=e,r=this.state.peerConnections.get(t);for(;!r;)await this.createPeerConnection(t,!1),r=this.state.peerConnections.get(t);r.peer.signal(n)}async createPeerConnection(e,t){m(`Creating peer connection with ${e} as ${t?`initiator`:`responder`}`);let n=new B.default({initiator:t}),r={peerId:e,isConnected:!1,peer:n};this.state.peerConnections.set(e,r),n.on(`signal`,async t=>{await this.sendSignalingMessage(e,t)}),n.on(`connect`,()=>{r.isConnected=!0,this.handlePeerConnected(e)}),n.on(`data`,t=>{h(`Received data`,t);try{let n=JSON.parse(t.toString());h(`Parsed as`,n),this.onMessageCallbacks.forEach(t=>t(e,n))}catch(t){m(`Failed to parse message from ${e}`,t),this.handleError(Error(`Failed to parse message from ${e}: ${t}`))}}),n.on(`error`,t=>{m(`Peer connection error with ${e}`,t),this.handleError(Error(`Peer connection error with ${e}: ${t}`))}),n.on(`close`,()=>{r.isConnected=!1,this.handlePeerDisconnected(e)})}handlePeerConnected(e){m(`Peer ${e} connected`)}handlePeerDisconnected(e){m(`Peer ${e} disconnected`),this.onDisconnectedCallbacks.forEach(t=>t(e));let t=this.state.peerConnections.get(e);t?.peer&&t.peer.destroy(),this.state.peerConnections.delete(e)}handleRoomExpired(){this.onLockCallbacks.forEach(e=>e())}handleRoomDeleted(){this.state.sseConnection&&(this.state.sseConnection.close(),this.state.sseConnection=void 0)}handleError(e){this.onErrorCallbacks.forEach(t=>t(e))}},H=class extends V{onGuestJoinedCallbacks=[];onGuestLeftCallbacks=[];isLocked=!1;maxGuests;constructor(e,t){super(e),this.maxGuests=t}async lock(){if(this.isLocked)throw Error(`Room is already locked`);if(this.isDestroyed)throw Error(`Room has been destroyed`);let e={peerId:this.state.myPeerId};try{let t=await fetch(`${this.state.serverUrl}/rooms/${this.state.roomCode}`,{method:`DELETE`,headers:{"Content-Type":`application/json`,Origin:window.location.origin},body:JSON.stringify(e)});if(!t.ok)throw await t.json();this.isLocked=!0,m(`Room ${this.state.roomCode} locked`)}catch(e){throw e instanceof Error?Error(`Failed to lock room: ${e.message}`):Error(`Failed to lock room: Unknown error`)}}async broadcastMessage(e){let t=[];for(let[n,r]of this.state.peerConnections)r.isConnected&&n!==this.state.myPeerId&&t.push(this.sendMessage(n,e));await Promise.all(t)}async leave(){if(!this.isDestroyed){if(!this.isLocked)try{await this.lock()}catch(e){h(`Failed to delete room from server on leave:`,e)}await super.leave()}}onGuestJoined(e){this.onGuestJoinedCallbacks.push(e)}onGuestLeft(e){this.onGuestLeftCallbacks.push(e)}handleSignalingMessage(e){return this.isLocked?(m(`Received signaling message in locked room, ignoring`),Promise.resolve()):super.handleSignalingMessage(e)}handlePeerConnected(e){e!==this.state.hostId&&this.onGuestJoinedCallbacks.forEach(t=>t(e))}handlePeerDisconnected(e){super.handlePeerDisconnected(e),e!==this.state.hostId&&this.onGuestLeftCallbacks.forEach(t=>t(e))}handleRoomExpired(){this.isLocked||super.handleRoomExpired()}},U=class extends V{onHostDisconnectedCallbacks=[];get guestId(){return this.state.myPeerId}onHostDisconnected(e){this.onHostDisconnectedCallbacks.push(e)}handlePeerDisconnected(e){super.handlePeerDisconnected(e),e===this.state.hostId&&this.onHostDisconnectedCallbacks.forEach(e=>e())}},W=class{serverUrl;constructor(e){this.serverUrl=e.replace(/\/$/,``)}async createRoom(e){let t={password:e?.password},n=await fetch(`${this.serverUrl}/rooms`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(`Failed to create room: ${e.message}`)}let r=await n.json();return new H({roomCode:r.roomCode,locksAt:new Date(r.autoLockAt),hostId:r.peerId,myPeerId:r.peerId,serverUrl:this.serverUrl,peerConnections:new Map},r.maxGuests)}async joinRoom(e,t){let n={password:t?.password},r=await fetch(`${this.serverUrl}/rooms/${e}/join`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!r.ok){let e=await r.json();throw Error(`Failed to join room: ${e.message}`)}let i=await r.json(),a={roomCode:e,locksAt:new Date(i.autoLockAt),hostId:i.hostId,myPeerId:i.peerId,serverUrl:this.serverUrl,peerConnections:new Map},o=new U(a);return await o.createPeerConnection(a.hostId,!0),o}};async function G(e){try{return await fetch(`${e}/health`,{method:`HEAD`})}catch(t){throw Error(`Failed to reach server at ${e}: ${t}`)}}async function K(e){if(!e||!e.startsWith(`http`))throw Error(`Invalid server URL`);if(!(await G(e)).ok)throw Error(`Cannot connect to server at ${e}`);return new W(e)}export{K as reachFloor};
|