@thebase/ui
Version:
CDN-installable Owl and Bootstrap 5 UI component library.
3 lines • 109 kB
JavaScript
import{a as vt,b as Et,c as Ct,d as St,e as Tt,f as ze,g as At,h as kt,i as Ot}from"./chunk-CFWAU3WN.js";import{a as Rt}from"./chunk-BJC3HW5B.js";import{a as Lt,b as Ge,c as xe,d as xt}from"./chunk-Y4CBBIL4.js";import{$ as wt,A as Pe,B as pt,C as gt,E as yt,F as Me,G as mt,H as Le,S as bt,T as _t,X as oe,Y as we,Z as He,_ as Ye,b as Ie,d as ot,e as at,f as ct,g as ut,h as lt,k as We,l as Q,n as te,o as Ve,p as re,q as Ae,r as de,s as ht,t as Ue,w as ke,x as Oe,y as dt,z as ft}from"./chunk-VJBGANAS.js";import{a as Te,b as Ht,d as Yt}from"./chunk-23NN352E.js";var Dt=Ht((Nt,$e)=>{(function(O){if(typeof Nt=="object"&&typeof $e<"u")$e.exports=O();else if(typeof define=="function"&&define.amd)define([],O);else{var D;D=typeof window>"u"?typeof global>"u"?typeof self>"u"?this:self:global:window,D.SimplePeer=O()}})(function(){var O=Math.floor,D=Math.abs,I=Math.pow;return(function(){function E(A,p,s){function w(l,d){if(!p[l]){if(!A[l]){var o=typeof Te=="function"&&Te;if(!d&&o)return o(l,!0);if(k)return k(l,!0);var b=new Error("Cannot find module '"+l+"'");throw b.code="MODULE_NOT_FOUND",b}var C=p[l]={exports:{}};A[l][0].call(C.exports,function(S){var L=A[l][1][S];return w(L||S)},C,C.exports,E,A,p,s)}return p[l].exports}for(var k=typeof Te=="function"&&Te,n=0;n<s.length;n++)w(s[n]);return w}return E})()({1:[function(E,A,p){"use strict";function s(c){var u=c.length;if(0<u%4)throw new Error("Invalid string. Length must be a multiple of 4");var g=c.indexOf("=");g===-1&&(g=u);var h=g===u?0:4-g%4;return[g,h]}function w(c,u,g){return 3*(u+g)/4-g}function k(c){var u,g,h=s(c),_=h[0],x=h[1],f=new C(w(c,_,x)),y=0,N=0<x?_-4:_;for(g=0;g<N;g+=4)u=b[c.charCodeAt(g)]<<18|b[c.charCodeAt(g+1)]<<12|b[c.charCodeAt(g+2)]<<6|b[c.charCodeAt(g+3)],f[y++]=255&u>>16,f[y++]=255&u>>8,f[y++]=255&u;return x===2&&(u=b[c.charCodeAt(g)]<<2|b[c.charCodeAt(g+1)]>>4,f[y++]=255&u),x===1&&(u=b[c.charCodeAt(g)]<<10|b[c.charCodeAt(g+1)]<<4|b[c.charCodeAt(g+2)]>>2,f[y++]=255&u>>8,f[y++]=255&u),f}function n(c){return o[63&c>>18]+o[63&c>>12]+o[63&c>>6]+o[63&c]}function l(c,u,g){for(var h,_=[],x=u;x<g;x+=3)h=(16711680&c[x]<<16)+(65280&c[x+1]<<8)+(255&c[x+2]),_.push(n(h));return _.join("")}function d(c){for(var u,g=c.length,h=g%3,_=[],x=16383,f=0,y=g-h;f<y;f+=x)_.push(l(c,f,f+x>y?y:f+x));return h===1?(u=c[g-1],_.push(o[u>>2]+o[63&u<<4]+"==")):h===2&&(u=(c[g-2]<<8)+c[g-1],_.push(o[u>>10]+o[63&u>>4]+o[63&u<<2]+"=")),_.join("")}p.byteLength=function(c){var u=s(c),g=u[0],h=u[1];return 3*(g+h)/4-h},p.toByteArray=k,p.fromByteArray=d;for(var o=[],b=[],C=typeof Uint8Array>"u"?Array:Uint8Array,S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L=0,i=S.length;L<i;++L)o[L]=S[L],b[S.charCodeAt(L)]=L;b[45]=62,b[95]=63},{}],2:[function(){},{}],3:[function(E,A,p){(function(){(function(){"use strict";var s=String.fromCharCode,w=Math.min;function k(e){if(2147483647<e)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=n.prototype,t}function n(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return b(e)}return l(e,t,r)}function l(e,t,r){if(typeof e=="string")return C(e,t);if(ArrayBuffer.isView(e))return S(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(m(e,ArrayBuffer)||e&&m(e.buffer,ArrayBuffer))return L(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(a!=null&&a!==e)return n.from(a,t,r);var v=i(e);if(v)return v;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return n.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(0>e)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function o(e,t,r){return d(e),0>=e||t===void 0?k(e):typeof r=="string"?k(e).fill(t,r):k(e).fill(t)}function b(e){return d(e),k(0>e?0:0|c(e))}function C(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!n.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|u(e,t),a=k(r),v=a.write(e,t);return v!==r&&(a=a.slice(0,v)),a}function S(e){for(var t=0>e.length?0:0|c(e.length),r=k(t),a=0;a<t;a+=1)r[a]=255&e[a];return r}function L(e,t,r){if(0>t||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var a;return a=t===void 0&&r===void 0?new Uint8Array(e):r===void 0?new Uint8Array(e,t):new Uint8Array(e,t,r),a.__proto__=n.prototype,a}function i(e){if(n.isBuffer(e)){var t=0|c(e.length),r=k(t);return r.length===0||e.copy(r,0,0,t),r}return e.length===void 0?e.type==="Buffer"&&Array.isArray(e.data)?S(e.data):void 0:typeof e.length!="number"||T(e.length)?k(0):S(e)}function c(e){if(e>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function u(e,t){if(n.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||m(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=2<arguments.length&&arguments[2]===!0;if(!a&&r===0)return 0;for(var v=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ce(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return ee(e).length;default:if(v)return a?-1:ce(e).length;t=(""+t).toLowerCase(),v=!0}}function g(e,t,r){var a=!1;if((t===void 0||0>t)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),0>=r)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return ue(this,t,r);case"utf8":case"utf-8":return X(this,t,r);case"ascii":return F(this,t,r);case"latin1":case"binary":return De(this,t,r);case"base64":return H(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function h(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function _(e,t,r,a,v){if(e.length===0)return-1;if(typeof r=="string"?(a=r,r=0):2147483647<r?r=2147483647:-2147483648>r&&(r=-2147483648),r=+r,T(r)&&(r=v?0:e.length-1),0>r&&(r=e.length+r),r>=e.length){if(v)return-1;r=e.length-1}else if(0>r)if(v)r=0;else return-1;if(typeof t=="string"&&(t=n.from(t,a)),n.isBuffer(t))return t.length===0?-1:x(e,t,r,a,v);if(typeof t=="number")return t&=255,typeof Uint8Array.prototype.indexOf=="function"?v?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):x(e,[t],r,a,v);throw new TypeError("val must be string, number or Buffer")}function x(e,t,r,a,v){function R(Se,me){return P===1?Se[me]:Se.readUInt16BE(me*P)}var P=1,V=e.length,J=t.length;if(a!==void 0&&(a=(a+"").toLowerCase(),a==="ucs2"||a==="ucs-2"||a==="utf16le"||a==="utf-16le")){if(2>e.length||2>t.length)return-1;P=2,V/=2,J/=2,r/=2}var G;if(v){var Y=-1;for(G=r;G<V;G++)if(R(e,G)!==R(t,Y===-1?0:G-Y))Y!==-1&&(G-=G-Y),Y=-1;else if(Y===-1&&(Y=G),G-Y+1===J)return Y*P}else for(r+J>V&&(r=V-J),G=r;0<=G;G--){for(var z=!0,ye=0;ye<J;ye++)if(R(e,G+ye)!==R(t,ye)){z=!1;break}if(z)return G}return-1}function f(e,t,r,a){r=+r||0;var v=e.length-r;a?(a=+a,a>v&&(a=v)):a=v;var R=t.length;a>R/2&&(a=R/2);for(var P,V=0;V<a;++V){if(P=parseInt(t.substr(2*V,2),16),T(P))return V;e[r+V]=P}return V}function y(e,t,r,a){return se(ce(t,e.length-r),e,r,a)}function N(e,t,r,a){return se(Ce(t),e,r,a)}function M(e,t,r,a){return N(e,t,r,a)}function j(e,t,r,a){return se(ee(t),e,r,a)}function q(e,t,r,a){return se(Re(t,e.length-r),e,r,a)}function H(e,t,r){return t===0&&r===e.length?U.fromByteArray(e):U.fromByteArray(e.slice(t,r))}function X(e,t,r){r=w(e.length,r);for(var a=[],v=t;v<r;){var R=e[v],P=null,V=239<R?4:223<R?3:191<R?2:1;if(v+V<=r){var J,G,Y,z;V===1?128>R&&(P=R):V===2?(J=e[v+1],(192&J)==128&&(z=(31&R)<<6|63&J,127<z&&(P=z))):V===3?(J=e[v+1],G=e[v+2],(192&J)==128&&(192&G)==128&&(z=(15&R)<<12|(63&J)<<6|63&G,2047<z&&(55296>z||57343<z)&&(P=z))):V===4&&(J=e[v+1],G=e[v+2],Y=e[v+3],(192&J)==128&&(192&G)==128&&(192&Y)==128&&(z=(15&R)<<18|(63&J)<<12|(63&G)<<6|63&Y,65535<z&&1114112>z&&(P=z)))}P===null?(P=65533,V=1):65535<P&&(P-=65536,a.push(55296|1023&P>>>10),P=56320|1023&P),a.push(P),v+=V}return Z(a)}function Z(e){var t=e.length;if(t<=4096)return s.apply(String,e);for(var r="",a=0;a<t;)r+=s.apply(String,e.slice(a,a+=4096));return r}function F(e,t,r){var a="";r=w(e.length,r);for(var v=t;v<r;++v)a+=s(127&e[v]);return a}function De(e,t,r){var a="";r=w(e.length,r);for(var v=t;v<r;++v)a+=s(e[v]);return a}function ue(e,t,r){var a=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>a)&&(r=a);for(var v="",R=t;R<r;++R)v+=Ee(e[R]);return v}function ae(e,t,r){for(var a=e.slice(t,r),v="",R=0;R<a.length;R+=2)v+=s(a[R]+256*a[R+1]);return v}function K(e,t,r){if(e%1!=0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function $(e,t,r,a,v,R){if(!n.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>v||t<R)throw new RangeError('"value" argument is out of bounds');if(r+a>e.length)throw new RangeError("Index out of range")}function le(e,t,r,a){if(r+a>e.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function ie(e,t,r,a,v){return t=+t,r>>>=0,v||le(e,t,r,4,34028234663852886e22,-34028234663852886e22),B.write(e,t,r,a,23,4),r+4}function he(e,t,r,a,v){return t=+t,r>>>=0,v||le(e,t,r,8,17976931348623157e292,-17976931348623157e292),B.write(e,t,r,a,52,8),r+8}function pe(e){if(e=e.split("=")[0],e=e.trim().replace(W,""),2>e.length)return"";for(;e.length%4!=0;)e+="=";return e}function Ee(e){return 16>e?"0"+e.toString(16):e.toString(16)}function ce(e,t){t=t||1/0;for(var r,a=e.length,v=null,R=[],P=0;P<a;++P){if(r=e.charCodeAt(P),55295<r&&57344>r){if(!v){if(56319<r){-1<(t-=3)&&R.push(239,191,189);continue}else if(P+1===a){-1<(t-=3)&&R.push(239,191,189);continue}v=r;continue}if(56320>r){-1<(t-=3)&&R.push(239,191,189),v=r;continue}r=(v-55296<<10|r-56320)+65536}else v&&-1<(t-=3)&&R.push(239,191,189);if(v=null,128>r){if(0>(t-=1))break;R.push(r)}else if(2048>r){if(0>(t-=2))break;R.push(192|r>>6,128|63&r)}else if(65536>r){if(0>(t-=3))break;R.push(224|r>>12,128|63&r>>6,128|63&r)}else if(1114112>r){if(0>(t-=4))break;R.push(240|r>>18,128|63&r>>12,128|63&r>>6,128|63&r)}else throw new Error("Invalid code point")}return R}function Ce(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function Re(e,t){for(var r,a,v,R=[],P=0;P<e.length&&!(0>(t-=2));++P)r=e.charCodeAt(P),a=r>>8,v=r%256,R.push(v),R.push(a);return R}function ee(e){return U.toByteArray(pe(e))}function se(e,t,r,a){for(var v=0;v<a&&!(v+r>=t.length||v>=e.length);++v)t[v+r]=e[v];return v}function m(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function T(e){return e!==e}var U=E("base64-js"),B=E("ieee754");p.Buffer=n,p.SlowBuffer=function(e){return+e!=e&&(e=0),n.alloc(+e)},p.INSPECT_MAX_BYTES=50,p.kMaxLength=2147483647,n.TYPED_ARRAY_SUPPORT=(function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},e.foo()===42}catch{return!1}})(),n.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."),Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){return n.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){return n.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&Symbol.species!=null&&n[Symbol.species]===n&&Object.defineProperty(n,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),n.poolSize=8192,n.from=function(e,t,r){return l(e,t,r)},n.prototype.__proto__=Uint8Array.prototype,n.__proto__=Uint8Array,n.alloc=function(e,t,r){return o(e,t,r)},n.allocUnsafe=function(e){return b(e)},n.allocUnsafeSlow=function(e){return b(e)},n.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==n.prototype},n.compare=function(e,t){if(m(e,Uint8Array)&&(e=n.from(e,e.offset,e.byteLength)),m(t,Uint8Array)&&(t=n.from(t,t.offset,t.byteLength)),!n.isBuffer(e)||!n.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,a=t.length,v=0,R=w(r,a);v<R;++v)if(e[v]!==t[v]){r=e[v],a=t[v];break}return r<a?-1:a<r?1:0},n.isEncoding=function(e){switch((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}},n.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return n.alloc(0);var r;if(t===void 0)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var a=n.allocUnsafe(t),v=0;for(r=0;r<e.length;++r){var R=e[r];if(m(R,Uint8Array)&&(R=n.from(R)),!n.isBuffer(R))throw new TypeError('"list" argument must be an Array of Buffers');R.copy(a,v),v+=R.length}return a},n.byteLength=u,n.prototype._isBuffer=!0,n.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},n.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},n.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},n.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?X(this,0,e):g.apply(this,arguments)},n.prototype.toLocaleString=n.prototype.toString,n.prototype.equals=function(e){if(!n.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||n.compare(this,e)===0},n.prototype.inspect=function(){var e="",t=p.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},n.prototype.compare=function(e,t,r,a,v){if(m(e,Uint8Array)&&(e=n.from(e,e.offset,e.byteLength)),!n.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),r===void 0&&(r=e?e.length:0),a===void 0&&(a=0),v===void 0&&(v=this.length),0>t||r>e.length||0>a||v>this.length)throw new RangeError("out of range index");if(a>=v&&t>=r)return 0;if(a>=v)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,a>>>=0,v>>>=0,this===e)return 0;for(var R=v-a,P=r-t,V=w(R,P),J=this.slice(a,v),G=e.slice(t,r),Y=0;Y<V;++Y)if(J[Y]!==G[Y]){R=J[Y],P=G[Y];break}return R<P?-1:P<R?1:0},n.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1},n.prototype.indexOf=function(e,t,r){return _(this,e,t,r,!0)},n.prototype.lastIndexOf=function(e,t,r){return _(this,e,t,r,!1)},n.prototype.write=function(e,t,r,a){if(t===void 0)a="utf8",r=this.length,t=0;else if(r===void 0&&typeof t=="string")a=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,a===void 0&&(a="utf8")):(a=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var v=this.length-t;if((r===void 0||r>v)&&(r=v),0<e.length&&(0>r||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var R=!1;;)switch(a){case"hex":return f(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":return N(this,e,t,r);case"latin1":case"binary":return M(this,e,t,r);case"base64":return j(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,e,t,r);default:if(R)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),R=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},n.prototype.slice=function(e,t){var r=this.length;e=~~e,t=t===void 0?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),t<e&&(t=e);var a=this.subarray(e,t);return a.__proto__=n.prototype,a},n.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||K(e,t,this.length);for(var a=this[e],v=1,R=0;++R<t&&(v*=256);)a+=this[e+R]*v;return a},n.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||K(e,t,this.length);for(var a=this[e+--t],v=1;0<t&&(v*=256);)a+=this[e+--t]*v;return a},n.prototype.readUInt8=function(e,t){return e>>>=0,t||K(e,1,this.length),this[e]},n.prototype.readUInt16LE=function(e,t){return e>>>=0,t||K(e,2,this.length),this[e]|this[e+1]<<8},n.prototype.readUInt16BE=function(e,t){return e>>>=0,t||K(e,2,this.length),this[e]<<8|this[e+1]},n.prototype.readUInt32LE=function(e,t){return e>>>=0,t||K(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},n.prototype.readUInt32BE=function(e,t){return e>>>=0,t||K(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},n.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||K(e,t,this.length);for(var a=this[e],v=1,R=0;++R<t&&(v*=256);)a+=this[e+R]*v;return v*=128,a>=v&&(a-=I(2,8*t)),a},n.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||K(e,t,this.length);for(var a=t,v=1,R=this[e+--a];0<a&&(v*=256);)R+=this[e+--a]*v;return v*=128,R>=v&&(R-=I(2,8*t)),R},n.prototype.readInt8=function(e,t){return e>>>=0,t||K(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},n.prototype.readInt16LE=function(e,t){e>>>=0,t||K(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt16BE=function(e,t){e>>>=0,t||K(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt32LE=function(e,t){return e>>>=0,t||K(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},n.prototype.readInt32BE=function(e,t){return e>>>=0,t||K(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},n.prototype.readFloatLE=function(e,t){return e>>>=0,t||K(e,4,this.length),B.read(this,e,!0,23,4)},n.prototype.readFloatBE=function(e,t){return e>>>=0,t||K(e,4,this.length),B.read(this,e,!1,23,4)},n.prototype.readDoubleLE=function(e,t){return e>>>=0,t||K(e,8,this.length),B.read(this,e,!0,52,8)},n.prototype.readDoubleBE=function(e,t){return e>>>=0,t||K(e,8,this.length),B.read(this,e,!1,52,8)},n.prototype.writeUIntLE=function(e,t,r,a){if(e=+e,t>>>=0,r>>>=0,!a){var v=I(2,8*r)-1;$(this,e,t,r,v,0)}var R=1,P=0;for(this[t]=255&e;++P<r&&(R*=256);)this[t+P]=255&e/R;return t+r},n.prototype.writeUIntBE=function(e,t,r,a){if(e=+e,t>>>=0,r>>>=0,!a){var v=I(2,8*r)-1;$(this,e,t,r,v,0)}var R=r-1,P=1;for(this[t+R]=255&e;0<=--R&&(P*=256);)this[t+R]=255&e/P;return t+r},n.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,255,0),this[t]=255&e,t+1},n.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},n.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},n.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},n.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},n.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var v=I(2,8*r-1);$(this,e,t,r,v-1,-v)}var R=0,P=1,V=0;for(this[t]=255&e;++R<r&&(P*=256);)0>e&&V===0&&this[t+R-1]!==0&&(V=1),this[t+R]=255&(e/P>>0)-V;return t+r},n.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t>>>=0,!a){var v=I(2,8*r-1);$(this,e,t,r,v-1,-v)}var R=r-1,P=1,V=0;for(this[t+R]=255&e;0<=--R&&(P*=256);)0>e&&V===0&&this[t+R+1]!==0&&(V=1),this[t+R]=255&(e/P>>0)-V;return t+r},n.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,127,-128),0>e&&(e=255+e+1),this[t]=255&e,t+1},n.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},n.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},n.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},n.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},n.prototype.writeFloatLE=function(e,t,r){return ie(this,e,t,!0,r)},n.prototype.writeFloatBE=function(e,t,r){return ie(this,e,t,!1,r)},n.prototype.writeDoubleLE=function(e,t,r){return he(this,e,t,!0,r)},n.prototype.writeDoubleBE=function(e,t,r){return he(this,e,t,!1,r)},n.prototype.copy=function(e,t,r,a){if(!n.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||a===0||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),0<a&&a<r&&(a=r),a===r||e.length===0||this.length===0)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("Index out of range");if(0>a)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t<a-r&&(a=e.length-t+r);var v=a-r;if(this===e&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(t,r,a);else if(this===e&&r<t&&t<a)for(var R=v-1;0<=R;--R)e[R+t]=this[R+r];else Uint8Array.prototype.set.call(e,this.subarray(r,a),t);return v},n.prototype.fill=function(e,t,r,a){if(typeof e=="string"){if(typeof t=="string"?(a=t,t=0,r=this.length):typeof r=="string"&&(a=r,r=this.length),a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!n.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(e.length===1){var v=e.charCodeAt(0);(a==="utf8"&&128>v||a==="latin1")&&(e=v)}}else typeof e=="number"&&(e&=255);if(0>t||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;t>>>=0,r=r===void 0?this.length:r>>>0,e||(e=0);var R;if(typeof e=="number")for(R=t;R<r;++R)this[R]=e;else{var P=n.isBuffer(e)?e:n.from(e,a),V=P.length;if(V===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(R=0;R<r-t;++R)this[R+t]=P[R%V]}return this};var W=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,E("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:9}],4:[function(E,A,p){(function(s){(function(){function w(){let n;try{n=p.storage.getItem("debug")}catch{}return!n&&typeof s<"u"&&"env"in s&&(n=s.env.DEBUG),n}p.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+A.exports.humanize(this.diff),!this.useColors)return;let l="color: "+this.color;n.splice(1,0,l,"color: inherit");let d=0,o=0;n[0].replace(/%[a-zA-Z%]/g,b=>{b==="%%"||(d++,b==="%c"&&(o=d))}),n.splice(o,0,l)},p.save=function(n){try{n?p.storage.setItem("debug",n):p.storage.removeItem("debug")}catch{}},p.load=w,p.useColors=function(){return!!(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(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&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},p.storage=(function(){try{return localStorage}catch{}})(),p.destroy=(()=>{let n=!1;return()=>{n||(n=!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`."))}})(),p.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"],p.log=console.debug||console.log||(()=>{}),A.exports=E("./common")(p);let{formatters:k}=A.exports;k.j=function(n){try{return JSON.stringify(n)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}).call(this)}).call(this,E("_process"))},{"./common":5,_process:12}],5:[function(E,A){A.exports=function(p){function s(n){function l(...b){if(!l.enabled)return;let C=l,S=+new Date,L=S-(d||S);C.diff=L,C.prev=d,C.curr=S,d=S,b[0]=s.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let i=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(u,g)=>{if(u==="%%")return"%";i++;let h=s.formatters[g];if(typeof h=="function"){let _=b[i];u=h.call(C,_),b.splice(i,1),i--}return u}),s.formatArgs.call(C,b),(C.log||s.log).apply(C,b)}let d,o=null;return l.namespace=n,l.useColors=s.useColors(),l.color=s.selectColor(n),l.extend=w,l.destroy=s.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>o===null?s.enabled(n):o,set:b=>{o=b}}),typeof s.init=="function"&&s.init(l),l}function w(n,l){let d=s(this.namespace+(typeof l>"u"?":":l)+n);return d.log=this.log,d}function k(n){return n.toString().substring(2,n.toString().length-2).replace(/\.\*\?$/,"*")}return s.debug=s,s.default=s,s.coerce=function(n){return n instanceof Error?n.stack||n.message:n},s.disable=function(){let n=[...s.names.map(k),...s.skips.map(k).map(l=>"-"+l)].join(",");return s.enable(""),n},s.enable=function(n){s.save(n),s.names=[],s.skips=[];let l,d=(typeof n=="string"?n:"").split(/[\s,]+/),o=d.length;for(l=0;l<o;l++)d[l]&&(n=d[l].replace(/\*/g,".*?"),n[0]==="-"?s.skips.push(new RegExp("^"+n.substr(1)+"$")):s.names.push(new RegExp("^"+n+"$")))},s.enabled=function(n){if(n[n.length-1]==="*")return!0;let l,d;for(l=0,d=s.skips.length;l<d;l++)if(s.skips[l].test(n))return!1;for(l=0,d=s.names.length;l<d;l++)if(s.names[l].test(n))return!0;return!1},s.humanize=E("ms"),s.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(p).forEach(n=>{s[n]=p[n]}),s.names=[],s.skips=[],s.formatters={},s.selectColor=function(n){let l=0;for(let d=0;d<n.length;d++)l=(l<<5)-l+n.charCodeAt(d),l|=0;return s.colors[D(l)%s.colors.length]},s.enable(s.load()),s}},{ms:11}],6:[function(E,A){"use strict";function p(s,w){for(let k in w)Object.defineProperty(s,k,{value:w[k],enumerable:!0,configurable:!0});return s}A.exports=function(s,w,k){if(!s||typeof s=="string")throw new TypeError("Please pass an Error to err-code");k||(k={}),typeof w=="object"&&(k=w,w=""),w&&(k.code=w);try{return p(s,k)}catch{k.message=s.message,k.stack=s.stack;let l=function(){};return l.prototype=Object.create(Object.getPrototypeOf(s)),p(new l,k)}}},{}],7:[function(E,A){"use strict";function p(f){console&&console.warn&&console.warn(f)}function s(){s.init.call(this)}function w(f){if(typeof f!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof f)}function k(f){return f._maxListeners===void 0?s.defaultMaxListeners:f._maxListeners}function n(f,y,N,M){var j,q,H;if(w(N),q=f._events,q===void 0?(q=f._events=Object.create(null),f._eventsCount=0):(q.newListener!==void 0&&(f.emit("newListener",y,N.listener?N.listener:N),q=f._events),H=q[y]),H===void 0)H=q[y]=N,++f._eventsCount;else if(typeof H=="function"?H=q[y]=M?[N,H]:[H,N]:M?H.unshift(N):H.push(N),j=k(f),0<j&&H.length>j&&!H.warned){H.warned=!0;var X=new Error("Possible EventEmitter memory leak detected. "+H.length+" "+(y+" listeners added. Use emitter.setMaxListeners() to increase limit"));X.name="MaxListenersExceededWarning",X.emitter=f,X.type=y,X.count=H.length,p(X)}return f}function l(){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 d(f,y,N){var M={fired:!1,wrapFn:void 0,target:f,type:y,listener:N},j=l.bind(M);return j.listener=N,M.wrapFn=j,j}function o(f,y,N){var M=f._events;if(M===void 0)return[];var j=M[y];return j===void 0?[]:typeof j=="function"?N?[j.listener||j]:[j]:N?L(j):C(j,j.length)}function b(f){var y=this._events;if(y!==void 0){var N=y[f];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}function C(f,y){for(var N=Array(y),M=0;M<y;++M)N[M]=f[M];return N}function S(f,y){for(;y+1<f.length;y++)f[y]=f[y+1];f.pop()}function L(f){for(var y=Array(f.length),N=0;N<y.length;++N)y[N]=f[N].listener||f[N];return y}function i(f,y,N){typeof f.on=="function"&&c(f,"error",y,N)}function c(f,y,N,M){if(typeof f.on=="function")M.once?f.once(y,N):f.on(y,N);else if(typeof f.addEventListener=="function")f.addEventListener(y,function j(q){M.once&&f.removeEventListener(y,j),N(q)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof f)}var u,g=typeof Reflect=="object"?Reflect:null,h=g&&typeof g.apply=="function"?g.apply:function(f,y,N){return Function.prototype.apply.call(f,y,N)};u=g&&typeof g.ownKeys=="function"?g.ownKeys:Object.getOwnPropertySymbols?function(f){return Object.getOwnPropertyNames(f).concat(Object.getOwnPropertySymbols(f))}:function(f){return Object.getOwnPropertyNames(f)};var _=Number.isNaN||function(f){return f!==f};A.exports=s,A.exports.once=function(f,y){return new Promise(function(N,M){function j(H){f.removeListener(y,q),M(H)}function q(){typeof f.removeListener=="function"&&f.removeListener("error",j),N([].slice.call(arguments))}c(f,y,q,{once:!0}),y!=="error"&&i(f,j,{once:!0})})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var x=10;Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return x},set:function(f){if(typeof f!="number"||0>f||_(f))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+f+".");x=f}}),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(f){if(typeof f!="number"||0>f||_(f))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+f+".");return this._maxListeners=f,this},s.prototype.getMaxListeners=function(){return k(this)},s.prototype.emit=function(f){for(var y=[],N=1;N<arguments.length;N++)y.push(arguments[N]);var M=f==="error",j=this._events;if(j!==void 0)M=M&&j.error===void 0;else if(!M)return!1;if(M){var q;if(0<y.length&&(q=y[0]),q instanceof Error)throw q;var H=new Error("Unhandled error."+(q?" ("+q.message+")":""));throw H.context=q,H}var X=j[f];if(X===void 0)return!1;if(typeof X=="function")h(X,this,y);else for(var Z=X.length,F=C(X,Z),N=0;N<Z;++N)h(F[N],this,y);return!0},s.prototype.addListener=function(f,y){return n(this,f,y,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(f,y){return n(this,f,y,!0)},s.prototype.once=function(f,y){return w(y),this.on(f,d(this,f,y)),this},s.prototype.prependOnceListener=function(f,y){return w(y),this.prependListener(f,d(this,f,y)),this},s.prototype.removeListener=function(f,y){var N,M,j,q,H;if(w(y),M=this._events,M===void 0)return this;if(N=M[f],N===void 0)return this;if(N===y||N.listener===y)--this._eventsCount==0?this._events=Object.create(null):(delete M[f],M.removeListener&&this.emit("removeListener",f,N.listener||y));else if(typeof N!="function"){for(j=-1,q=N.length-1;0<=q;q--)if(N[q]===y||N[q].listener===y){H=N[q].listener,j=q;break}if(0>j)return this;j===0?N.shift():S(N,j),N.length===1&&(M[f]=N[0]),M.removeListener!==void 0&&this.emit("removeListener",f,H||y)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(f){var y,N,M;if(N=this._events,N===void 0)return this;if(N.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):N[f]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete N[f]),this;if(arguments.length===0){var j,q=Object.keys(N);for(M=0;M<q.length;++M)j=q[M],j!=="removeListener"&&this.removeAllListeners(j);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(y=N[f],typeof y=="function")this.removeListener(f,y);else if(y!==void 0)for(M=y.length-1;0<=M;M--)this.removeListener(f,y[M]);return this},s.prototype.listeners=function(f){return o(this,f,!0)},s.prototype.rawListeners=function(f){return o(this,f,!1)},s.listenerCount=function(f,y){return typeof f.listenerCount=="function"?f.listenerCount(y):b.call(f,y)},s.prototype.listenerCount=b,s.prototype.eventNames=function(){return 0<this._eventsCount?u(this._events):[]}},{}],8:[function(E,A){A.exports=function(){if(typeof globalThis>"u")return null;var p={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return p.RTCPeerConnection?p:null}},{}],9:[function(E,A,p){p.read=function(s,w,k,n,l){var d,o,b=8*l-n-1,C=(1<<b)-1,S=C>>1,L=-7,i=k?l-1:0,c=k?-1:1,u=s[w+i];for(i+=c,d=u&(1<<-L)-1,u>>=-L,L+=b;0<L;d=256*d+s[w+i],i+=c,L-=8);for(o=d&(1<<-L)-1,d>>=-L,L+=n;0<L;o=256*o+s[w+i],i+=c,L-=8);if(d===0)d=1-S;else{if(d===C)return o?NaN:(u?-1:1)*(1/0);o+=I(2,n),d-=S}return(u?-1:1)*o*I(2,d-n)},p.write=function(s,w,k,n,l,d){var o,b,C,S=Math.LN2,L=Math.log,i=8*d-l-1,c=(1<<i)-1,u=c>>1,g=l===23?I(2,-24)-I(2,-77):0,h=n?0:d-1,_=n?1:-1,x=0>w||w===0&&0>1/w?1:0;for(w=D(w),isNaN(w)||w===1/0?(b=isNaN(w)?1:0,o=c):(o=O(L(w)/S),1>w*(C=I(2,-o))&&(o--,C*=2),w+=1<=o+u?g/C:g*I(2,1-u),2<=w*C&&(o++,C/=2),o+u>=c?(b=0,o=c):1<=o+u?(b=(w*C-1)*I(2,l),o+=u):(b=w*I(2,u-1)*I(2,l),o=0));8<=l;s[k+h]=255&b,h+=_,b/=256,l-=8);for(o=o<<l|b,i+=l;0<i;s[k+h]=255&o,h+=_,o/=256,i-=8);s[k+h-_]|=128*x}},{}],10:[function(E,A){A.exports=typeof Object.create=="function"?function(p,s){s&&(p.super_=s,p.prototype=Object.create(s.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}))}:function(p,s){if(s){p.super_=s;var w=function(){};w.prototype=s.prototype,p.prototype=new w,p.prototype.constructor=p}}},{}],11:[function(E,A){var p=Math.round;function s(d){if(d+="",!(100<d.length)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(o){var b=parseFloat(o[1]),C=(o[2]||"ms").toLowerCase();return C==="years"||C==="year"||C==="yrs"||C==="yr"||C==="y"?315576e5*b:C==="weeks"||C==="week"||C==="w"?6048e5*b:C==="days"||C==="day"||C==="d"?864e5*b:C==="hours"||C==="hour"||C==="hrs"||C==="hr"||C==="h"?36e5*b:C==="minutes"||C==="minute"||C==="mins"||C==="min"||C==="m"?6e4*b:C==="seconds"||C==="second"||C==="secs"||C==="sec"||C==="s"?1e3*b:C==="milliseconds"||C==="millisecond"||C==="msecs"||C==="msec"||C==="ms"?b:void 0}}}function w(d){var o=D(d);return 864e5<=o?p(d/864e5)+"d":36e5<=o?p(d/36e5)+"h":6e4<=o?p(d/6e4)+"m":1e3<=o?p(d/1e3)+"s":d+"ms"}function k(d){var o=D(d);return 864e5<=o?n(d,o,864e5,"day"):36e5<=o?n(d,o,36e5,"hour"):6e4<=o?n(d,o,6e4,"minute"):1e3<=o?n(d,o,1e3,"second"):d+" ms"}function n(d,o,b,C){return p(d/b)+" "+C+(o>=1.5*b?"s":"")}var l=24*(60*6e4);A.exports=function(d,o){o=o||{};var b=typeof d;if(b=="string"&&0<d.length)return s(d);if(b==="number"&&isFinite(d))return o.long?k(d):w(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))}},{}],12:[function(E,A){function p(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function w(g){if(b===setTimeout)return setTimeout(g,0);if((b===p||!b)&&setTimeout)return b=setTimeout,setTimeout(g,0);try{return b(g,0)}catch{try{return b.call(null,g,0)}catch{return b.call(this,g,0)}}}function k(g){if(C===clearTimeout)return clearTimeout(g);if((C===s||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(g);try{return C(g)}catch{try{return C.call(null,g)}catch{return C.call(this,g)}}}function n(){c&&L&&(c=!1,L.length?i=L.concat(i):u=-1,i.length&&l())}function l(){if(!c){var g=w(n);c=!0;for(var h=i.length;h;){for(L=i,i=[];++u<h;)L&&L[u].run();u=-1,h=i.length}L=null,c=!1,k(g)}}function d(g,h){this.fun=g,this.array=h}function o(){}var b,C,S=A.exports={};(function(){try{b=typeof setTimeout=="function"?setTimeout:p}catch{b=p}try{C=typeof clearTimeout=="function"?clearTimeout:s}catch{C=s}})();var L,i=[],c=!1,u=-1;S.nextTick=function(g){var h=Array(arguments.length-1);if(1<arguments.length)for(var _=1;_<arguments.length;_++)h[_-1]=arguments[_];i.push(new d(g,h)),i.length!==1||c||w(l)},d.prototype.run=function(){this.fun.apply(null,this.array)},S.title="browser",S.browser=!0,S.env={},S.argv=[],S.version="",S.versions={},S.on=o,S.addListener=o,S.once=o,S.off=o,S.removeListener=o,S.removeAllListeners=o,S.emit=o,S.prependListener=o,S.prependOnceListener=o,S.listeners=function(){return[]},S.binding=function(){throw new Error("process.binding is not supported")},S.cwd=function(){return"/"},S.chdir=function(){throw new Error("process.chdir is not supported")},S.umask=function(){return 0}},{}],13:[function(E,A){(function(p){(function(){let s;A.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window>"u"?p:window):w=>(s||(s=Promise.resolve())).then(w).catch(k=>setTimeout(()=>{throw k},0))}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],14:[function(E,A){(function(p,s){(function(){"use strict";var w=E("safe-buffer").Buffer,k=s.crypto||s.msCrypto;A.exports=k&&k.getRandomValues?function(n,l){if(n>4294967295)throw new RangeError("requested too many random bytes");var d=w.allocUnsafe(n);if(0<n)if(65536<n)for(var o=0;o<n;o+=65536)k.getRandomValues(d.slice(o,o+65536));else k.getRandomValues(d);return typeof l=="function"?p.nextTick(function(){l(null,d)}):d}:function(){throw new Error(`Secure random number generation is not supported by this browser.
Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,E("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{_process:12,"safe-buffer":30}],15:[function(E,A){"use strict";function p(o,b){o.prototype=Object.create(b.prototype),o.prototype.constructor=o,o.__proto__=b}function s(o,b,C){function S(i,c,u){return typeof b=="string"?b:b(i,c,u)}C||(C=Error);var L=(function(i){function c(u,g,h){return i.call(this,S(u,g,h))||this}return p(c,i),c})(C);L.prototype.name=C.name,L.prototype.code=o,d[o]=L}function w(o,b){if(Array.isArray(o)){var C=o.length;return o=o.map(function(S){return S+""}),2<C?"one of ".concat(b," ").concat(o.slice(0,C-1).join(", "),", or ")+o[C-1]:C===2?"one of ".concat(b," ").concat(o[0]," or ").concat(o[1]):"of ".concat(b," ").concat(o[0])}return"of ".concat(b," ").concat(o+"")}function k(o,b,C){return o.substr(!C||0>C?0:+C,b.length)===b}function n(o,b,C){return(C===void 0||C>o.length)&&(C=o.length),o.substring(C-b.length,C)===b}function l(o,b,C){return typeof C!="number"&&(C=0),!(C+b.length>o.length)&&o.indexOf(b,C)!==-1}var d={};s("ERR_INVALID_OPT_VALUE",function(o,b){return'The value "'+b+'" is invalid for option "'+o+'"'},TypeError),s("ERR_INVALID_ARG_TYPE",function(o,b,C){var S;typeof b=="string"&&k(b,"not ")?(S="must not be",b=b.replace(/^not /,"")):S="must be";var L;if(n(o," argument"))L="The ".concat(o," ").concat(S," ").concat(w(b,"type"));else{var i=l(o,".")?"property":"argument";L='The "'.concat(o,'" ').concat(i," ").concat(S," ").concat(w(b,"type"))}return L+=". Received type ".concat(typeof C),L},TypeError),s("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),s("ERR_METHOD_NOT_IMPLEMENTED",function(o){return"The "+o+" method is not implemented"}),s("ERR_STREAM_PREMATURE_CLOSE","Premature close"),s("ERR_STREAM_DESTROYED",function(o){return"Cannot call "+o+" after a stream was destroyed"}),s("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),s("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),s("ERR_STREAM_WRITE_AFTER_END","write after end"),s("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),s("ERR_UNKNOWN_ENCODING",function(o){return"Unknown encoding: "+o},TypeError),s("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),A.exports.codes=d},{}],16:[function(E,A){(function(p){(function(){"use strict";function s(S){return this instanceof s?(l.call(this,S),d.call(this,S),this.allowHalfOpen=!0,void(S&&(S.readable===!1&&(this.readable=!1),S.writable===!1&&(this.writable=!1),S.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",w))))):new s(S)}function w(){this._writableState.ended||p.nextTick(k,this)}function k(S){S.end()}var n=Object.keys||function(S){var L=[];for(var i in S)L.push(i);return L};A.exports=s;var l=E("./_stream_readable"),d=E("./_stream_writable");E("inherits")(s,l);for(var o,b=n(d.prototype),C=0;C<b.length;C++)o=b[C],s.prototype[o]||(s.prototype[o]=d.prototype[o]);Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(S){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=S,this._writableState.destroyed=S)}})}).call(this)}).call(this,E("_process"))},{"./_stream_readable":18,"./_stream_writable":20,_process:12,inherits:10}],17:[function(E,A){"use strict";function p(w){return this instanceof p?void s.call(this,w):new p(w)}A.exports=p;var s=E("./_stream_transform");E("inherits")(p,s),p.prototype._transform=function(w,k,n){n(null,w)}},{"./_stream_transform":19,inherits:10}],18:[function(E,A){(function(p,s){(function(){"use strict";function w(e){return K.from(e)}function k(e){return K.isBuffer(e)||e instanceof $}function n(e,t,r){return typeof e.prependListener=="function"?e.prependListener(t,r):void(e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r))}function l(e,t,r){Z=Z||E("./_stream_duplex"),e=e||{},typeof r!="boolean"&&(r=t instanceof Z),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=Re(this,e,"readableHighWaterMark",r),this.buffer=new Ee,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&&(!ie&&(ie=E("string_decoder/").StringDecoder),this.decoder=new ie(e.encoding),this.encoding=e.encoding)}function d(e){if(Z=Z||E("./_stream_duplex"),!(this instanceof d))return new d(e);var t=this instanceof Z;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)),ae.call(this)}function o(e,t,r,a,v){F("readableAddChunk",t);var R=e._readableState;if(t===null)R.reading=!1,i(e,R);else{var P;if(v||(P=C(R,t)),P)B(e,P);else if(!(R.objectMode||t&&0<t.length))a||(R.reading=!1,g(e,R));else if(typeof t=="string"||R.objectMode||Object.getPrototypeOf(t)===K.prototype||(t=w(t)),a)R.endEmitted?B(e,new U):b(e,R,t,!0);else if(R.ended)B(e,new m);else{if(R.destroyed)return!1;R.reading=!1,R.decoder&&!r?(t=R.decoder.write(t),R.objectMode||t.length!==0?b(e,R,t,!1):g(e,R)):b(e,R,t,!1)}}return!R.ended&&(R.length<R.highWaterMark||R.length===0)}function b(e,t,r,a){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,a?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&c(e)),g(e,t)}function C(e,t){var r;return k(t)||typeof t=="string"||t===void 0||e.objectMode||(r=new se("chunk",["string","Buffer","Uint8Array"],t)),r}function S(e){return 1073741824<=e?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function L(e,t){return 0>=e||t.length===0&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=S(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function i(e,t){if(F("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?c(e):(t.needReadable=!1,!t.emittedReadable&&(t.emittedReadable=!0,u(e)))}}function c(e){var t=e._readableState;F("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(F("emitReadable",t.flowing),t.emittedReadable=!0,p.nextTick(u,e))}function u(e){var t=e._readableState;F("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,M(e)}function g(e,t){t.readingMore||(t.readingMore=!0,p.nextTick(h,e,t))}function h(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(F("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function _(e){return function(){var t=e._readableState;F("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&ue(e,"data")&&(t.flowing=!0,M(e))}}function x(e){var t=e._readableState;t.readableListening=0<e.listenerCount("readable"),t.resumeScheduled&&!t.paused?t.flowing=!0:0<e.listenerCount("data")&&e.resume()}function f(e){F("readable nexttick read 0"),e.read(0)}function y(e,t){t.resumeScheduled||(t.resumeScheduled=!0,p.nextTick(N,e,t))}function N(e,t){F("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),M(e),t.flowing&&!t.reading&&e.read(0)}function M(e){var t=e._readableState;for(F("flow",t.flowing);t.flowing&&e.read()!==null;);}function j(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function q(e){var t=e._readableState;F("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,p.nextTick(H,t,e))}function H(e,t){if(F("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function X(e,t){for(var r=0,a=e.length;r<a;r++)if(e[r]===t)return r;return-1}A.exports=d;var Z;d.ReadableState=l;var F,De=E("events").EventEmitter,ue=function(e,t){return e.listeners(t).length},ae=E("./internal/streams/stream"),K=E("buffer").Buffer,$=s.Uint8Array||function(){},le=E("util");F=le&&le.debuglog?le.debuglog("stream"):function(){};var ie,he,pe,Ee=E("./internal/streams/buffer_list"),ce=E("./internal/streams/destroy"),Ce=E("./internal/streams/state"),Re=Ce.getHighWaterMark,ee=E("../errors").codes,se=ee.ERR_INVALID_ARG_TYPE,m=ee.ERR_STREAM_PUSH_AFTER_EOF,T=ee.ERR_METHOD_NOT_IMPLEMENTED,U=ee.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;E("inherits")(d,ae);var B=ce.errorOrDestroy,W=["error","close","destroy","pause","resume"];Object.defineProperty(d.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),d.prototype.destroy=ce.destroy,d.prototype._undestroy=ce.undestroy,d.prototype._destroy=function(e,t){t(e)},d.prototype.push=function(e,t){var r,a=this._readableState;return a.objectMode?r=!0:typeof e=="string"&&(t=t||a.defaultEncoding,t!==a.encoding&&(e=K.from(e,t),t=""),r=!0),o(this,e,t,!1,r)},d.prototype.unshift=function(e){return o(this,e,null,!0,!1)},d.prototype.isPaused=function(){return this._readableState.flowing===!1},d.prototype.setEncoding=function(e){ie||(ie=E("string_decoder/").StringDecoder);var t=new ie(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,a="";r!==null;)a+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),a!==""&&this._readableState.buffer.push(a),this._readableState.length=a.length,this},d.prototype.read=function(e){F("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark===0?0<t.length:t.length>=t.highWaterMark)||t.ended))return F("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?q(this):c(this),null;if(e=L(e,t),e===0&&t.ended)return t.length===0&&q(this),null;var a=t.needReadable;F("need readable",a),(t.length===0||t.length-e<t.highWaterMark)&&(a=!0,F("length less than watermark",a)),t.ended||t.reading?(a=!1,F("reading or ended",a)):a&&(F("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,!t.reading&&(e=L(r,t)));var v;return v=0<e?j(e,t):null,v===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(!t.ended&&(t.needReadable=!0),r!==e&&t.ended&&q(this)),v!==null&&this.emit("data",v),v},d.prototype._read=function(){B(this,new T("_read()"))},d.prototype.pipe=function(e,t){function r(be,_e){F("onunpipe"),be===Y&&_e&&_e.hasUnpiped===!1&&(_e.hasUnpiped=!0,v())}function a(){F("onend"),e.end()}function v(){F("cleanup"),e.removeListener("close",V),e.removeListener("finish",J),e.removeListener("drain",me),e.removeListener("error",P),e.removeListener("unpipe",r),Y.removeListener("end",a),Y.removeListener("end",G),Y.removeListener("data",R),st=!0,z.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&me()}function R(be){F("ondata");var _e=e.write(be);F("dest.write",_e),_e===!1&&((z.pipesCount===1&&z.pipes===e||1<z.pipesCount&&X(z.pipes,e)!==-1)&&!st&&(F("false write response, pause",z.awaitDrain),z.awaitDrain++),Y.pause())}function P(be){F("onerror",be),G(),e.removeListener("error",P),ue(e,"error")===0&&B(e,be)}function V(){e.removeListener("finish",J),G()}function J(){F("onfinish"),e.removeListener("close",V),G()}function G(){F("unpipe"),Y.unpipe(e)}var Y=this,z=this._readableState;switch(z.pipesCount){case 0:z.pipes=e;break;case 1:z.pipes=[z.pipes,e];break;default:z.pipes.push(e)}z.pipesCount+=1,F("pipe count=%d opts=%j",z.pipesCount,t);var ye=(!t||t.end!==!1)&&e!==p.stdout&&e!==p.stderr,Se=ye?a:G;z.endEmitted?p.nextTick(Se):Y.once("end",Se),e.on("unpipe",r);var me=_(Y);e.on("drain",me);var st=!1;return Y.on("data",R),n(e,"error",P),e.once("close",V),e.once("finish",J),e.emit("pipe",Y),z.flowing||(F("pipe resume"),Y.resume()),e},d.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var a=t.pipes,v=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var R=0;R<v;R++)a[R].emit("unpipe",this,{hasUnpiped:!1});return this}var P=X(t.pipes,e);return P===-1?this:(t.pipes.splice(P,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)},d.prototype.on=function(e,t){var r=ae.prototype.on.call(this,e,t),a=this._readableState;return e==="data"?(a.readableListening=0<this.listenerCount("readable"),a.flowing!==!1&&this.resume()):e=="readable"&&!a.endEmitted&&!a.readableListening&&(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,F("on readable",a.length,a.reading),a.length?c(this):!a.reading&&p.nextTick(f,this)),r},d.prototype.addListener=d.prototype.on,d.prototype.removeListener=function(e,t){var r=ae.prototype.removeListener.call(this,e,t);return e==="readable"&&p.nextTick(x,this),r},d.prototype.removeAllListeners=function(e){var t=ae.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&p.nextTick(x,this),t},d.prototype.resume=function(){var e=this._readableState;return e.flowing||(F("resume"),e.flowing=!e.readableListening,y(this,e)),e.paused=!1,this},d.prototype.pause=function(){return F("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(F("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},d.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var v in e.on("end",function(){if(F("wrapped end"),r.decoder&&!r.ended){var P=r.decoder.end();P&&P.length&&t.push(P)}t.push(null)}),e.on("data",function(P){if(F("wrapped data"),r.decoder&&(P=r.decoder.write(P)),!(r.objectMode&&P==null)&&(r.objectMode||P&&P.length)){var V=t.push(P);V||(a=!0,e.pause())}}),e)this[v]===void 0&&typeof e[v]=="function"&&(this[v]=(function(P){return function(){return e[P].apply(e,arguments)}})(v));for(var R=0;R<W.length;R++)e.on(W[R],this.emit.bind(this,W[R]));return this._read=function(P){F("wrapped _read",P),a&&(a=!1,e.resume())},this},typeof Symbol=="function"&&(d.prototype[Symbol.asyncIterator]=function(){return he===void 0&&(he=E("./internal/streams/async_iterator")),he(this)}),Object.defineProperty(d.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(d.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(d.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),d._fromList=j,Object.defineProperty(d.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(d.from=function(e,t){return pe===void 0&&(pe=E("./internal/streams/from")),pe(d,e,t)})}).call(this)}).call(this,E("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/async_iterator":21,"./internal/streams/buffer_list":22,"./internal/streams/destroy":23,"./internal/streams/from":25,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,events:7,inherits:10,"string_decoder/":31,util:2}],19:[function(E,A){"use strict";function p(S,L){var i=this._transformState;i.transforming=!1;var c=i.writecb;if(c===null)return this.emit("error",new d);i.writechunk=null,i.writecb=null,L!=null&&this.push(L),c(S);var u=this._readableState;u.reading=!1,(u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}function s(S){return this instanceof s?(C.call(this,S),this._transformState={afterTransform:p.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,S&&(typeof S.transform=="function"&&(this._transform=S.transform),typeof S.flush=="function"&&(this._flush=S.flush)),void this.on("prefinish",w)):new s(S)}function w(){var S=this;typeof this._flush!="function"||this._readableState.destroyed?k(this,null,null):this._flush(function(L,i){k(S,L,i)})}function k(S,L,i){if(L)return S.emit("error",L);if(i!=null&&S.push(i),S._writableState.length)throw new b;if(S._transformState.transforming)throw new o;return S.push(null)}A.exports=s;var n=E("../errors").codes,l=n.ERR_METHOD_NOT_IMPLEMENTED,d=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,b=n.ERR_TRANSFORM_WITH_LENGTH_0,C=E("./_stream_duplex");E("inherits")(s,C),s.prototype.push=function(S,L){return this._transformState.needTransform=!1,C.prototype.push.call(this,S,L)},s.prototype._transform=function(S,L,i){i(new l("_transform()"))},s.prototype._write=function(S,L,i){var c=this._transformState;if(c.writecb=i,c.writechunk=S,c.writeencoding=L,!c.transforming){var u=this._readableState;(c.needTransform||u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}},s.prototype._read=function(){var S=this._transformState;S.writechunk===null||S.transforming?S.needTransform=!0:(S.transforming=!0,this._transform(S.writechunk,S.writeencoding,S.afterTransform))},s.prototype._destroy=function(S,L){C.prototype._destroy.call(this,S,function(i){L(i)})}},{"../errors":15,"./_stream_duplex":16,inherits:10}],20:[function(E,A){(function(p,s){(function(){"use strict";function w(m){var T=this;this.next=null,this.entry=null,this.finish=function(){q(T,m)}}function k(m){return F.from(m)}function n(m){return F.isBuffer(m)||m instanceof De}function l(){}function d(m,T,U){H=H||E("./_stream_duplex"),m=m||{},typeof U!="boolean"&&(U=T instanceof H),this.objectMode=!!m.objectMode,U&&(this.objectMode=this.objectMode||!!m.writableObjectMode),this.highWaterMark=K(this,m,"writableHighWaterMark",U),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var B=m.decodeStrings===!1;this.decodeStrings=!B,this.defaultEncoding=m.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(W){g(T,W)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=m.emitClose!==!1,this.autoDestroy=!!m.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new w(this)}function o(m){H=H||E("./_stream_duplex");var T=this instanceof H;return T||se.call(o,this)?(this._writableState=new d(m,this,T),this.writable=!0,m&&(typeof m.write=="function"&&(this._write=m.write),typeof m.writev=="function"&&(this._writev=m.writev),typeof m.destroy=="function"&&(this._destroy=m.destroy),typeof m.final=="function"&&(this._final=m.final)),void Z.call(this)):new o(m)}function b(m,T){var U=new Ce;ee(m,U),p.nextTick(T,U)}function C(m,T,U,B){var W;return U===null?W=new ce:typeof U!="string"&&!T.objectMode&&(W=new le("chunk",["string","Buffer"],U)),!W||(ee(m,W),p.nextTick(B,W),!1)}function S(m,T,U){return m.objectMode||m.decodeStrings===!1||typeof T!="string"||(T=F.from(T,U)),T}function L(m,T,U,B,W,e){if(!U){var t=S(T,B,W);B!==t&&(U=!0,W="buffer",B=t)}var r=T.objectMode?1:B.length;T.length+=r;var a=T.length<T.highWaterMark;if(a||(T.needDrain=!0),T.writing||T.corked){var v=T.lastBufferedRequest;T.lastBufferedRequest={chunk:B,encoding:W,isBuf:U,callback:e,next:null},v?v.next=T.lastBufferedRequest:T.bufferedRequest=T.lastBufferedRequest,T.bufferedRequestCount+=1}else i(m,T,!1,r,B,W,e);return a}function i(m,T,U,B,W,e,t){T.writelen=B,T.writecb=t,T.writing=!0,T.sync=!0,T.destroyed?T.onwrite(new Ee("write")):U?m._writev(W,T.onwrite):m._write(W,e,T.onwrite),T.sync=!1}function c(m,T,U,B,W){--T.pendingcb,U?(p.nextTick(W,B),p.nextTick(M,m,T),m._writableState.errorEmitted=!0,ee(m,B)):(W(B),m._writableState.errorEmitted=!0,ee(m,B),M(m,T))}function u(m){m.writing=!1,m.writecb=null,m.length-=m.writelen,m.writelen=0}function g(m,T){var U=m._writableState,B=U.sync,W=U.writecb;if(typeof W!="function")throw new he;if(u(U),T)c(m,U,B,T,W);else{var e=f(U)||m.destroyed;e||U.corked||U.bufferProcessing||!U.bufferedRequest||x(m,U),B?p.nextTick(h,m,U,e,W):h(m,U,e,W)}}function h(m,T,U,B){U||_(m,T),T.pendingcb--,B(),M(m,T)}function _(m,T){T.length===0&&T.needDrain&&(T.needDrain=!1,m.emit("drain"))}function x(m,T){T.bufferProcessing=!0;var U=T.bufferedRequest;if(m._writev&&U&&U.next){var B=T.bufferedRequestCount,W=Array(B),e=T.corkedRequestsFree;e.entry=U;for(var t=0,r=!0;U;)W[t]=U,U.isBuf||(r=!1),U=U.next,t+=1;W.allBuffers=r,i(m,T,!0,T.length,W,"",e.finish),T.pendingcb++,T.lastBufferedRequest=null,e.next?(T.corkedRequestsFree=e.next,e.next=null):T.corkedRequestsFree=new w(T),T.bufferedRequestCount=0}else{for(;U;){var a=U.chunk,v=U.encoding,R=U.callback,P=T.objectMode?1:a.length;if(i(m,T,!1,P,a,v,R),U=U.next,T.bufferedRequestCount--,T.writing)break}U===null&&(T.lastBufferedRequest=null)}T.bufferedRequest=U,T.bufferProcessing=!1}function f(m){return m.ending&&m.length===0&&m.bufferedRequest===null&&!m.finished&&!m.writing}function y(m,T){m._final(function(U){T.pendingcb--,U&&ee(m,U),T.prefinished=!0,m.emit("prefinish"),M(m,T)})}function N(m,T){T.prefinished||T.finalCalled||(typeof m._final!="function"||T.destroyed?(T.prefinished=!0,m.emit("prefinish")):(T.pendingcb++,T.finalCalled=!0,p.nextTick(y,m,T)))}function M(m,T){var U=f(T);if(U&&(N(m,T),T.pendingcb===0&&(T.finished=!0,m.emit("finish"),T.autoDestroy))){var B=m._readableState;(!B||B.autoDestroy&&B.endEmitted)&&m.destroy()}return U}function j(m,T,U){T.ending=!0,M(m,T),U&&(T.finished?p.nextTick(U):m.once("finish",U)),T.ended=!0,m.writable=!1}function q(m,T,U){var B=m.entry;for(m.entry=null;B;){var W=B.callback;T.pendingcb--,W(U),B=B.next}T.corkedRequestsFree.next=m}A.exports=o;var H;o.WritableState=d;var X={deprecate:E("util-deprecate")},Z=E("./internal/streams/stream"),F=E("buffer").Buffer,De=s.Uint8Array||function(){},ue=E("./internal/streams/destroy"),ae=E("./internal/streams/state"),K=ae.getHighWaterMark,$=E("../errors").codes,le=$.ERR_INVALID_ARG_TYPE,ie=$.ERR_METHOD_NOT_IMPLEMENTED,he=$.ERR_MULTIPLE_CALLBACK,pe=$.ERR_STREAM_CANNOT_PIPE,Ee=$.ERR_STREAM_DESTROYED,ce=$.ERR_STREAM_NULL_VALUES,Ce=$.ERR_STREAM_WRITE_AFTER_END,Re=$.ERR_UNKNOWN_ENCODING,ee=ue.errorOrDestroy;E("inherits")(o,Z),d.prototype.getBuffer=function(){for(var m=this.bufferedRequest,T=[];m;)T.push(m),m=m.next;return T},(function(){try{Object.defineProperty(d.prototype,"buffer",{get:X.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var se;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(se=Function.prototype[Symbol.hasInstance],Object.defineProperty(o,Symbol.hasInstance,{value:function(m){return!!se.call(this,m)||this===o&&m&&m._writableState instanceof d}})):se=function(m){return m instanceof this},o.prototype.pipe=function(){ee(this,new pe)},o.prototype.write=function(m,T,U){var B=this._writableState,W=!1,e=!B.objectMode&&n(m);return e&&!F.isBuffer(m)&&(m=k(m)),typeof T=="function"&&(U=T,T=null),e?T="buffer":!T&&(T=B.defaultEncoding),typeof U!="function"&&(U=l),B.ending?b(this,U):(e||C(this,B,m,U))&&(B.pendingcb++,W=L(this,B,e,m,T,U)),W},o.prototype.cork=function(){this._writableState.corked++},o.prototype.uncork=function(){var m=this._writableState;m.corked&&(m.corked--,!m.writing&&!m.corked&&!m.bufferProcessing&&m.bufferedRequest&&x(this,m))},o.prototype.setDefaultEncoding=function(m){if(typeof m=="string"&&(m=m.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((m+"").toLowerCase())))throw new Re(m);return this._writableState.defaultEncoding=m,this},Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),o.prototype._write=function(m,T,U){U(new ie("_write()"))},o.prototype._writev=null,o.prototype.end=function(m,T,U){var B=this._writableState;return typeof m=="function"?(U=m,m=null,T=null):typeof T=="function"&&(U=T,T=null),m!=null&&this.write(m,T),B.corked&&(B.corked=1,this.uncork()),B.ending||j(this,B,U),this},Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(m){this._writableState&&(this._writableState.destroyed=m)}}),o.prototype.destroy=ue.destroy,o.prototype._undestroy=ue.undestroy,o.prototype._destroy=function(m,T){T(m)}}).call(this)}).call(this,E("_process"),typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/destroy":23,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,inherits:10,"util-deprecate":32}],21:[function(E,A){(function(p){(function(){"use strict";function s(_,x,f){return x in _?Object.defineProperty(_,x,{value:f,enumerable:!0,configurable:!0,writable:!0}):_[x]=f,_}function w(_,x){return{value:_,done:x}}function k(_){var x=_[b];if(x!==null){var f=_[u].read();f!==null&&(_[i]=null,_[b]=null,_[C]=null,x(w(f,!1)))}}function n(_){p.nextTick(k,_)}function l(_,x){return function(f,y){_.then(function(){return x[L]?void f(w(void 0,!0)):void x[c](f,y)},y)}}var d,o=E("./end-of-stream"),b=Symbol("lastResolve"),C=Symbol("lastReject"),S=Symbol("error"),L=Symbol("ended"),i=Symbol("lastPromise"),c=Symbol("handlePromise"),u=Symbol("stream"),g=Object.getPrototypeOf(function(){}),h=Object.setPrototypeOf((d={get stream(){return this[u]},next:function(){var _=this,x=this[S];if(x!==null)return Promise.reject(x);if(this[L])return Promise.resolve(w(void 0,!0));if(this[u].destroyed)return new Promise(function(M,j){p.nextTick(function(){_[S]?j(_[S]):M(w(void 0,!0))})});var f,y=this[i];if(y)f=new Promise(l(y,this));else{var N=this[u].read();if(N!==null)return Promise.resolve(w(N,!1));f=new Promise(this[c])}return this[i]=f,f}},s(d,Symbol.asyncIterator,function(){return this}),s(d,"return",function(){var _=this;return new Promise(function(x,f){_[u].destroy(null,function(y){return y?void f(y):void x(w(void 0,!0))})})}),d),g);A.exports=function(_){var x,f=Object.create(h,(x={},s(x,u,{value:_,writable:!0}),s(x,b,{value:null,writable:!0}),s(x,C,{value:null,writable:!0}),s(x,S,{value:null,writable:!0}),s(x,L,{value:_._readableState.endEmitted,writable:!0}),s(x,c,{value:function(y,N){var M=f[u].read();M?(f[i]=null,f[b]=null,f[C]=null,y(w(M,!1))):(f[b]=y,f[C]=N)},writable:!0}),x));return f[i]=null,o(_,function(y){if(y&&y.code!=="ERR_STREAM_PREMATURE_CLOSE"){var N=f[C];return N!==null&&(f[i]=null,f[b]=null,f[C]=null,N(y)),void(f[S]=y)}var M=f[b];M!==null&&(f[i]=null,f[b]=null,f[C]=null,M(w(void 0,!0))),f[L]=!0}),_.on("readable",n.bind(null,f)),f}}).call(this)}).call(this,E("_process"))},{"./end-of-stream":24,_process:12}],22:[function(E,A){"use strict";function p(i,c){var u=Object.keys(i);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(i);c&&(g=g.filter(function(h){return Object.getOwnPropertyDescriptor(i,h).enumerable})),u.push.apply(u,g)}return u}function s(i){for(var c,u=1;u<arguments.length;u++)c=arguments[u]==null?{}:arguments[u],u%2?p(Object(c),!0).forEach(function(g){w(i,g,c[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):p(Object(c)).forEach(function(g){Object.defineProperty(i,g,Object.getOwnPropertyDescriptor(c,g))});return i}function w(i,c,u){return c in i?Object.defineProperty(i,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[c]=u,i}function k(i,c){if(!(i instanceof c))throw new TypeError("Cannot call a class as a function")}function n(i,c){for(var u,g=0;g<c.length;g++)u=c[g],u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(i,u.key,u)}function l(i,c,u){return c&&n(i.prototype,c),u&&n(i,u),i}function d(i,c,u){b.prototype.copy.call(i,c,u)}var o=E("buffer"),b=o.Buffer,C=E("util"),S=C.inspect,L=S&&S.custom||"inspect";A.exports=(function(){function i(){k(this,i),this.head=null,this.tail=null,this.length=0}return l(i,[{key:"push",value:function(c){var u={data:c,next:null};0<this.length?this.tail.next=u:this.head=u,this.tail=u,++this.length}},{key:"unshift",value:function(c){var u={data:c,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}},{key:"shift",value:function(){if(this.length!==0){var c=this.head.data;return this.head=this.length===1?this.tail=null:this.head.next,--this.length,c}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(c){if(this.length===0)return"";for(var u=this.head,g=""+u.data;u=u.next;)g+=c+u.data;return g}},{key:"concat",value:function(c){if(this.length===0)return b.alloc(0);for(var u=b.allocUnsafe(c>>>0),g=this.head,h=0;g;)d(g.data,u,h),h+=g.data.length,g=g.next;return u}},{key:"consume",value:function(c,u){var g;return c<this.head.data.length?(g=this.head.data.slice(0,c),this.head.data=this.head.data.slice(c)):c===this.head.data.length?g=this.shift():g=u?this._getString(c):this._getBuffer(c),g}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(c){var u=this.head,g=1,h=u.data;for(c-=h.length;u=u.next;){var _=u.data,x=c>_.length?_.length:c;if(h+=x===_.length?_:_.slice(0,c),c-=x,c===0){x===_.length?(++g,this.head=u.next?u.next:this.tail=null):(this.head=u,u.data=_.slice(x));break}++g}return this.length-=g,h}},{key:"_getBuffer",value:function(c){var u=b.allocUnsafe(c),g=this.head,h=1;for(g.data.copy(u),c-=g.data.length;g=g.next;){var _=g.data,x=c>_.length?_.length:c;if(_.copy(u,u.length-c,0,x),c-=x,c===0){x===_.length?(++h,this.head=g.next?g.next:this.tail=null):(this.head=g,g.data=_.slice(x));break}++h}return this.length-=h,u}},{key:L,value:function(c,u){return S(this,s({},u,{depth:0,customInspect:!1}))}}]),i})()},{buffer:3,util:2}],23:[function(E,A){(function(p){(function(){"use strict";function s(n,l){k(n,l),w(n)}function w(n){n._writableState&&!n._writableState.emitClose||n._readableState&&!n._readableState.emitClose||n.emit("close")}function k(n,l){n.emit("error",l)}A.exports={destroy:function(n,l){var d=this,o=this._readableState&&this._readableState.destroyed,b=this._writableState&&this._writableState.destroyed;return o||b?(l?l(n):n&&(this._writableState?!this._writableState.errorEmitted&&(this._writableState.errorEmitted=!0,p.nextTick(k,this,n)):p.nextTick(k,this,n)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(n||null,function(C){!l&&C?d._writableState?d._writableState.errorEmitted?p.nextTick(w,d):(d._writableState.errorEmitted=!0,p.nextTick(s,d,C)):p.nextTick(s,d,C):l?(p.nextTick(w,d),l(C)):p.nextTick(w,d)}),this)},undestroy:function(){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)},errorOrDestroy:function(n,l){var d=n._readableState,o=n._writableState;d&&d.autoDestroy||o&&o.autoDestroy?n.destroy(l):n.emit("error",l)}}}).call(this)}).call(this,E("_process"))},{_process:12}],24:[function(E,A){"use strict";function p(l){var d=!1;return function(){if(!d){d=!0;for(var o=arguments.length,b=Array(o),C=0;C<o;C++)b[C]=arguments[C];l.apply(this,b)}}}function s(){}function w(l){return l.setHeader&&typeof l.abort=="function"}function k(l,d,o){if(typeof d=="function")return k(l,null,d);d||(d={}),o=p(o||s);var b=d.readable||d.readable!==!1&&l.readable,C=d.writable||d.writable!==!1&&l.writable,S=function(){l.writable||i()},L=l._writableState&&l._writableState.finished,i=function(){C=!1,L=!0,b||o.call(l)},c=l._readableState&&l._readableState.endEmitted,u=function(){b=!1,c=!0,C||o.call(l)},g=function(x){o.call(l,x)},h=function(){var x;return b&&!c?(l._readableState&&l._readableState.ended||(x=new n),o.call(l,x)):C&&!L?(l._writableState&&l._writableState.ended||(x=new n),o.call(l,x)):void 0},_=function(){l.req.on("finish",i)};return w(l)?(l.on("complete",i),l.on("abort",h),l.req?_():l.on("request",_)):C&&!l._writableState&&(l.on("end",S),l.on("close",S)),l.on("end",u),l.on("finish",i),d.error!==!1&&l.on("error",g),l.on("close",h),function(){l.removeListener("complete",i),l.removeListener("abort",h),l.removeListener("request",_),l.req&&l.req.removeListener("finish",i),l.removeListener("end",S),l.removeListener("close",S),l.removeListener("finish",i),l.removeListener("end",u),l.removeListener("error",g),l.removeListener("close",h)}}var n=E("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;A.exports=k},{"../../../errors":15}],25:[function(E,A){A.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],26:[function(E,A){"use strict";function p(L){var i=!1;return function(){i||(i=!0,L.apply(void 0,arguments))}}function s(L){if(L)throw L}function w(L){return L.setHeader&&typeof L.abort=="function"}function k(L,i,c,u){u=p(u);var g=!1;L.on("close",function(){g=!0}),o===void 0&&(o=E("./end-of-stream")),o(L,{readable:i,writable:c},function(_){return _?u(_):(g=!0,void u())});var h=!1;return function(_){if(!g)return h?void 0:(h=!0,w(L)?L.abort():typeof L.destroy=="function"?L.destroy():void u(_||new S("pipe")))}}function n(L){L()}function l(L,i){return L.pipe(i)}function d(L){return L.length&&typeof L[L.length-1]=="function"?L.pop():s}var o,b=E("../../../errors").codes,C=b.ERR_MISSING_ARGS,S=b.ERR_STREAM_DESTROYED;A.exports=function(){for(var L=arguments.length,i=Array(L),c=0;c<L;c++)i[c]=arguments[c];var u=d(i);if(Array.isArray(i[0])&&(i=i[0]),2>i.length)throw new C("streams");var g,h=i.map(function(_,x){var f=x<i.length-1;return k(_,f,0<x,function(y){g||(g=y),y&&h.forEach(n),f||(h.forEach(n),u(g))})});return i.reduce(l)}},{"../../../errors":15,"./end-of-stream":24}],27:[function(E,A){"use strict";function p(w,k,n){return w.highWaterMark==null?k?w[n]:null:w.highWaterMark}var s=E("../../../errors").codes.ERR_INVALID_OPT_VALUE;A.exports={getHighWaterMark:function(w,k,n,l){var d=p(k,l,n);if(d!=null){if(!(isFinite(d)&&O(d)===d)||0>d){var o=l?n:"highWaterMark";throw new s(o,d)}return O(d)}return w.objectMode?16:16384}}},{"../../../errors":15}],28:[function(E,A){A.exports=E("events").EventEmitter},{events:7}],29:[function(E,A,p){p=A.exports=E("./lib/_stream_readable.js"),p.Stream=p,p.Readable=p,p.Writable=E("./lib/_stream_writable.js"),p.Duplex=E("./lib/_stream_duplex.js"),p.Transform=E("./lib/_stream_transform.js"),p.PassThrough=E("./lib/_stream_passthrough.js"),p.finished=E("./lib/internal/streams/end-of-stream.js"),p.pipeline=E("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"./lib/internal/streams/end-of-stream.js":24,"./lib/internal/streams/pipeline.js":26}],30:[function(E,A,p){function s(l,d){for(var o in l)d[o]=l[o]}function w(l,d,o){return n(l,d,o)}var k=E("buffer"),n=k.Buffer;n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?A.exports=k:(s(k,p),p.Buffer=w),w.prototype=Object.create(n.prototype),s(n,w),w.from=function(l,d,o){if(typeof l=="number")throw new TypeError("Argument must not be a number");return n(l,d,o)},w.alloc=function(l,d,o){if(typeof l!="number")throw new TypeError("Argument must be a number");var b=n(l);return d===void 0?b.fill(0):typeof o=="string"?b.fill(d,o):b.fill(d),b},w.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n(l)},w.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return k.SlowBuffer(l)}},{buffer:3}],31:[function(E,A,p){"use strict";function s(h){if(!h)return"utf8";for(var _;;)switch(h){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 h;default:if(_)return;h=(""+h).toLowerCase(),_=!0}}function w(h){var _=s(h);if(typeof _!="string"&&(u.isEncoding===g||!g(h)))throw new Error("Unknown encoding: "+h);return _||h}function k(h){this.encoding=w(h);var _;switch(this.encoding){case"utf16le":this.text=b,this.end=C,_=4;break;case"utf8":this.fillLast=o,_=4;break;case"base64":this.text=S,this.end=L,_=3;break;default:return this.write=i,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=u.allocUnsafe(_)}function n(h){return 127>=h?0:h>>5==6?2:h>>4==14?3:h>>3==30?4:h>>6==2?-1:-2}function l(h,_,x){var f=_.length-1;if(f<x)return 0;var y=n(_[f]);return 0<=y?(0<y&&(h.lastNeed=y-1),y):--f<x||y===-2?0:(y=n(_[f]),0<=y?(0<y&&(h.lastNeed=y-2),y):--f<x||y===-2?0:(y=n(_[f]),0<=y?(0<y&&(y===2?y=0:h.lastNeed=y-3),y):0))}function d(h,_){if((192&_[0])!=128)return h.lastNeed=0,"\uFFFD";if(1<h.lastNeed&&1<_.length){if((192&_[1])!=128)return h.lastNeed=1,"\uFFFD";if(2<h.lastNeed&&2<_.length&&(192&_[2])!=128)return h.lastNeed=2,"\uFFFD"}}function o(h){var _=this.lastTotal-this.lastNeed,x=d(this,h,_);return x===void 0?this.lastNeed<=h.length?(h.copy(this.lastChar,_,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(h.copy(this.lastChar,_,0,h.length),void(this.lastNeed-=h.length)):x}function b(h,_){if((h.length-_)%2==0){var x=h.toString("utf16le",_);if(x){var f=x.charCodeAt(x.length-1);if(55296<=f&&56319>=f)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1],x.slice(0,-1)}return x}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=h[h.length-1],h.toString("utf16le",_,h.length-1)}function C(h){var _=h&&h.length?this.write(h):"";if(this.lastNeed){var x=this.lastTotal-this.lastNeed;return _+this.lastChar.toString("utf16le",0,x)}return _}function S(h,_){var x=(h.length-_)%3;return x==0?h.toString("base64",_):(this.lastNeed=3-x,this.lastTotal=3,x==1?this.lastChar[0]=h[h.length-1]:(this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1]),h.toString("base64",_,h.length-x))}function L(h){var _=h&&h.length?this.write(h):"";return this.lastNeed?_+this.lastChar.toString("base64",0,3-this.lastNeed):_}function i(h){return h.toString(this.encoding)}function c(h){return h&&h.length?this.write(h):""}var u=E("safe-buffer").Buffer,g=u.isEncoding||function(h){switch(h=""+h,h&&h.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}};p.StringDecoder=k,k.prototype.write=function(h){if(h.length===0)return"";var _,x;if(this.lastNeed){if(_=this.fillLast(h),_===void 0)return"";x=this.lastNeed,this.lastNeed=0}else x=0;return x<h.length?_?_+this.text(h,x):this.text(h,x):_||""},k.prototype.end=function(h){var _=h&&h.length?this.write(h):"";return this.lastNeed?_+"\uFFFD":_},k.prototype.text=function(h,_){var x=l(this,h,_);if(!this.lastNeed)return h.toString("utf8",_);this.lastTotal=x;var f=h.length-(x-this.lastNeed);return h.copy(this.lastChar,0,f),h.toString("utf8",_,f)},k.prototype.fillLast=function(h){return this.lastNeed<=h.length?(h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,h.length),void(this.lastNeed-=h.length))}},{"safe-buffer":30}],32:[function(E,A){(function(p){(function(){function s(w){try{if(!p.localStorage)return!1}catch{return!1}var k=p.localStorage[w];return k!=null&&(k+"").toLowerCase()==="true"}A.exports=function(w,k){function n(){if(!l){if(s("throwDeprecation"))throw new Error(k);s("traceDeprecation")?console.trace(k):console.warn(k),l=!0}return w.apply(this,arguments)}if(s("noDeprecation"))return w;var l=!1;return n}}).call(this)}).call(this,typeof global>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:global)},{}],"/":[function(E,A){function p(L){return L.replace(/a=ice-options:trickle\s\n/g,"")}function s(L){console.warn(L)}let w=E("debug")("simple-peer"),k=E("get-browser-rtc"),n=E("randombytes"),l=E("readable-stream"),d=E("queue-microtask"),o=E("err-code"),{Buffer:b}=E("buffer"),C=65536;class S extends l.Duplex{constructor(i){if(i=Object.assign({allowHalfOpen:!1},i),super(i),this._id=n(4).toString("hex").slice(0,7),this._debug("new peer %o",i),this.channelName=i.initiator?i.channelName||n(20).toString("hex"):null,this.initiator=i.initiator||!1,this.channelConfig=i.channelConfig||S.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},S.config,i.config),this.offerOptions=i.offerOptions||{},this.answerOptions=i.answerOptions||{},this.sdpTransform=i.sdpTransform||(c=>c),this.streams=i.streams||(i.stream?[i.stream]:[]),this.trickle=i.trickle===void 0||i.trickle,this.allowHalfTrickle=i.allowHalfTrickle!==void 0&&i.allowHalfTrickle,this.iceCompleteTimeout=i.iceCompleteTimeout||5e3,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=i.wrtc&&typeof i.wrtc=="object"?i.wrtc:k(),!this._wrtc)throw o(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new 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(c){return void this.destroy(o(c,"ERR_PC_CONSTRUCTOR"))}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=c=>{this._onIceCandidate(c)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(c=>{this.destroy(o(c,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=c=>{this._setupData(c)},this.streams&&this.streams.forEach(c=>{this.addStream(c)}),this._pc.ontrack=c=>{this._onTrack(c)},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(i){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof i=="string")try{i=JSON.parse(i)}catch{i={}}this._debug("signal()"),i.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),i.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(i.transceiverRequest.kind,i.transceiverRequest.init)),i.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(i.candidate):this._pendingCandidates.push(i.candidate)),i.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(i)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(c=>{this._addIceCandidate(c)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(c=>{this.destroy(o(c,"ERR_SET_REMOTE_DESCRIPTION"))}),i.sdp||i.candidate||i.renegotiate||i.transceiverRequest||this.destroy(o(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(i){let c=new this._wrtc.RTCIceCandidate(i);this._pc.addIceCandidate(c).catch(u=>{!c.address||c.address.endsWith(".local")?s("Ignoring unsupported ICE candidate."):this.destroy(o(u,"ERR_ADD_ICE_CANDIDATE"))})}send(i){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(i)}}addTransceiver(i,c){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(i,c),this._needsNegotiation()}catch(u){this.destroy(o(u,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:i,init:c}})}}addStream(i){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),i.getTracks().forEach(c=>{this.addTrack(c,i)})}}addTrack(i,c){if(this.destroying)return;if(this.destroyed)throw o(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");let u=this._senderMap.get(i)||new Map,g=u.get(c);if(!g)g=this._pc.addTrack(i,c),u.set(c,g),this._senderMap.set(i,u),this._needsNegotiation();else throw g.removed?o(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):o(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(i,c,u){if(this.destroying)return;if(this.destroyed)throw o(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");let g=this._senderMap.get(i),h=g?g.get(u):null;if(!h)throw o(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");c&&this._senderMap.set(c,g),h.replaceTrack==null?this.destroy(o(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):h.replaceTrack(c)}removeTrack(i,c){if(this.destroying)return;if(this.destroyed)throw o(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");let u=this._senderMap.get(i),g=u?u.get(c):null;if(!g)throw o(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{g.removed=!0,this._pc.removeTrack(g)}catch(h){h.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(g):this.destroy(o(h,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(i){if(!this.destroying){if(this.destroyed)throw o(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),i.getTracks().forEach(c=>{this.removeTrack(c,i)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,d(()=>{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 o(new 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(i){this._destroy(i,()=>{})}_destroy(i,c){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",i&&(i.message||i)),d(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",i&&(i.message||i)),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,i&&this.emit("error",i),this.emit("close"),c()}))}_setupData(i){if(!i.channel)return this.destroy(o(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=i.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=C),this.channelName=this._channel.label,this._channel.onmessage=u=>{this._onChannelMessage(u)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=u=>{let g=u.error instanceof Error?u.error:new Error(`Datachannel error: ${u.message} ${u.filename}:${u.lineno}:${u.colno}`);this.destroy(o(g,"ERR_DATA_CHANNEL"))};let c=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(c&&this._onChannelClose(),c=!0):c=!1},5e3)}_read(){}_write(i,c,u){if(this.destroyed)return u(o(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(i)}catch(g){return this.destroy(o(g,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>C?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=u):u(null)}else this._debug("write before connect"),this._chunk=i,this._cb=u}_onFinish(){if(!this.destroyed){let i=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?i():this.once("connect",i)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=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(i=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(i.sdp=p(i.sdp)),i.sdp=this.sdpTransform(i.sdp);let c=()=>{if(!this.destroyed){let u=this._pc.localDescription||i;this._debug("signal"),this.emit("signal",{type:u.type,sdp:u.sdp})}};this._pc.setLocalDescription(i).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?c():this.once("_iceComplete",c))}).catch(u=>{this.destroy(o(u,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(i=>{this.destroy(o(i,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(i=>{i.mid||!i.sender.track||i.requested||(i.requested=!0,this.addTransceiver(i.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(i=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(i.sdp=p(i.sdp)),i.sdp=this.sdpTransform(i.sdp);let c=()=>{if(!this.destroyed){let u=this._pc.localDescription||i;this._debug("signal"),this.emit("signal",{type:u.type,sdp:u.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(i).then(()=>{this.destroyed||(this.trickle||this._iceComplete?c():this.once("_iceComplete",c))}).catch(u=>{this.destroy(o(u,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(i=>{this.destroy(o(i,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(o(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;let i=this._pc.iceConnectionState,c=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",i,c),this.emit("iceStateChange",i,c),(i==="connected"||i==="completed")&&(this._pcReady=!0,this._maybeReady()),i==="failed"&&this.destroy(o(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),i==="closed"&&this.destroy(o(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(i){let c=u=>(Object.prototype.toString.call(u.values)==="[object Array]"&&u.values.forEach(g=>{Object.assign(u,g)}),u);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(u=>{let g=[];u.forEach(h=>{g.push(c(h))}),i(null,g)},u=>i(u)):0<this._pc.getStats.length?this._pc.getStats(u=>{if(this.destroyed)return;let g=[];u.result().forEach(h=>{let _={};h.names().forEach(x=>{_[x]=h.stat(x)}),_.id=h.id,_.type=h.type,_.timestamp=h.timestamp,g.push(c(_))}),i(null,g)},u=>i(u)):i(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 i=()=>{this.destroyed||this.getStats((c,u)=>{if(this.destroyed)return;c&&(u=[]);let g={},h={},_={},x=!1;u.forEach(y=>{(y.type==="remotecandidate"||y.type==="remote-candidate")&&(g[y.id]=y),(y.type==="localcandidate"||y.type==="local-candidate")&&(h[y.id]=y),(y.type==="candidatepair"||y.type==="candidate-pair")&&(_[y.id]=y)});let f=y=>{x=!0;let N=h[y.localCandidateId];N&&(N.ip||N.address)?(this.localAddress=N.ip||N.address,this.localPort=+N.port):N&&N.ipAddress?(this.localAddress=N.ipAddress,this.localPort=+N.portNumber):typeof y.googLocalAddress=="string"&&(N=y.googLocalAddress.split(":"),this.localAddress=N[0],this.localPort=+N[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let M=g[y.remoteCandidateId];M&&(M.ip||M.address)?(this.remoteAddress=M.ip||M.address,this.remotePort=+M.port):M&&M.ipAddress?(this.remoteAddress=M.ipAddress,this.remotePort=+M.portNumber):typeof y.googRemoteAddress=="string"&&(M=y.googRemoteAddress.split(":"),this.remoteAddress=M[0],this.remotePort=+M[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(u.forEach(y=>{y.type==="transport"&&y.selectedCandidatePairId&&f(_[y.selectedCandidatePairId]),(y.type==="googCandidatePair"&&y.googActiveConnection==="true"||(y.type==="candidatepair"||y.type==="candidate-pair")&&y.selected)&&f(y)}),!x&&(!Object.keys(_).length||Object.keys(h).length))return void setTimeout(i,100);if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(N){return this.destroy(o(N,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');let y=this._cb;this._cb=null,y(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};i()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>C)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(i=>{this._pc.removeTrack(i),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(i){this.destroyed||(i.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:i.candidate.candidate,sdpMLineIndex:i.candidate.sdpMLineIndex,sdpMid:i.candidate.sdpMid}}):!i.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),i.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(i){if(this.destroyed)return;let c=i.data;c instanceof ArrayBuffer&&(c=b.from(c)),this.push(c)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);let i=this._cb;this._cb=null,i(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(i){this.destroyed||i.streams.forEach(c=>{this._debug("on track"),this.emit("track",i.track,c),this._remoteTracks.push({track:i.track,stream:c}),this._remoteStreams.some(u=>u.id===c.id)||(this._remoteStreams.push(c),d(()=>{this._debug("on stream"),this.emit("stream",c)}))})}_debug(){let i=[].slice.call(arguments);i[0]="["+this._id+"] "+i[0],w.apply(null,i)}}S.WEBRTC_SUPPORT=!!k(),S.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},S.channelConfig={},A.exports=S},{buffer:3,debug:4,"err-code":6,"get-browser-rtc":8,"queue-microtask":13,randombytes:14,"readable-stream":29}]},{},[])("/")})});var Gt=1200,Kt=2500,Be=3e4,Ke=O=>{if(O.shouldConnect&&O.ws===null){let D=new WebSocket(O.url),I=O.binaryType,E=null;I&&(D.binaryType=I),O.ws=D,O.connecting=!0,O.connected=!1,D.onmessage=s=>{O.lastMessageReceived=Me();let w=s.data,k=typeof w=="string"?JSON.parse(w):w;k&&k.type==="pong"&&(clearTimeout(E),E=setTimeout(p,Be/2)),O.emit("message",[k,O])};let A=s=>{O.ws!==null&&(O.ws=null,O.connecting=!1,O.connected?(O.connected=!1,O.emit("disconnect",[{type:"disconnect",error:s},O])):O.unsuccessfulReconnects++,setTimeout(Ke,lt(ut(O.unsuccessfulReconnects+1)*Gt,Kt),O)),clearTimeout(E)},p=()=>{O.ws===D&&O.send({type:"ping"})};D.onclose=()=>A(null),D.onerror=s=>A(s),D.onopen=()=>{O.lastMessageReceived=Me(),O.connecting=!1,O.connected=!0,O.unsuccessfulReconnects=0,O.emit("connect",[{type:"connect"},O]),E=setTimeout(p,Be/2)}}},Fe=class extends at{constructor(D,{binaryType:I}={}){super(),this.url=D,this.ws=null,this.binaryType=I||null,this.connected=!1,this.connecting=!1,this.unsuccessfulReconnects=0,this.lastMessageReceived=0,this.shouldConnect=!0,this._checkInterval=setInterval(()=>{this.connected&&Be<Me()-this.lastMessageReceived&&this.ws.close()},Be/2),Ke(this)}send(D){this.ws&&this.ws.send(JSON.stringify(D))}destroy(){clearInterval(this._checkInterval),this.disconnect(),super.destroy()}disconnect(){this.shouldConnect=!1,this.ws!==null&&this.ws.close()}connect(){this.shouldConnect=!0,!this.connected&&this.ws===null&&Ke(this)}};var Ft=Yt(Dt(),1);var It=(O,D)=>{let I=We(O).buffer,E=We(D).buffer;return crypto.subtle.importKey("raw",I,"PBKDF2",!1,["deriveKey"]).then(A=>crypto.subtle.deriveKey({name:"PBKDF2",salt:E,iterations:1e5,hash:"SHA-256"},A,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]))},Je=(O,D)=>{if(!D)return Le(O);let I=crypto.getRandomValues(new Uint8Array(12));return crypto.subtle.encrypt({name:"AES-GCM",iv:I},D,O).then(E=>{let A=Q();return Ae(A,"AES-GCM"),de(A,I),de(A,new Uint8Array(E)),te(A)})},Ut=(O,D)=>{let I=Q();return ht(I,O),Je(te(I),D)},Xe=(O,D)=>{if(!D)return Le(O);let I=ke(O);Pe(I)!=="AES-GCM"&&mt(Ue("Unknown encryption algorithm"));let A=Oe(I),p=Oe(I);return crypto.subtle.decrypt({name:"AES-GCM",iv:A},D,p).then(s=>new Uint8Array(s))},Pt=(O,D)=>Xe(O,D).then(I=>pt(ke(new Uint8Array(I))));var ne=wt("y-webrtc"),ve=0,jt=3,Ne=1,nt=4,je=new Map,ge=new Map,qt=O=>{let D=!0;O.webrtcConns.forEach(I=>{I.synced||(D=!1)}),(!D&&O.synced||D&&!O.synced)&&(O.synced=D,O.provider.emit("synced",[{synced:D}]),ne("synced ",oe,O.name,we," with all peers"))},Wt=(O,D,I)=>{let E=ke(D),A=Q(),p=ft(E);if(O===void 0)return null;let s=O.awareness,w=O.doc,k=!1;switch(p){case ve:{re(A,ve);let n=Ot(E,A,w,O);n===Tt&&!O.synced&&I(),n===St&&(k=!0);break}case jt:re(A,Ne),de(A,xe(s,Array.from(s.getStates().keys()))),k=!0;break;case Ne:xt(s,Oe(E),O);break;case nt:{let n=dt(E)===1,l=Pe(E);if(l!==O.peerId&&(O.bcConns.has(l)&&!n||!O.bcConns.has(l)&&n)){let d=[],o=[];n?(O.bcConns.add(l),o.push(l)):(O.bcConns.delete(l),d.push(l)),O.provider.emit("peers",[{added:o,removed:d,webrtcPeers:Array.from(O.webrtcConns.keys()),bcPeers:Array.from(O.bcConns)}]),Vt(O)}break}default:return console.error("Unable to compute message"),A}return k?A:null},tr=(O,D)=>{let I=O.room;return ne("received message from ",oe,O.remotePeerId,He," (",I.name,")",we,Ye),Wt(I,D,()=>{O.synced=!0,ne("synced ",oe,I.name,we," with ",oe,O.remotePeerId),qt(I)})},Qe=(O,D)=>{ne("send message to ",oe,O.remotePeerId,we,He," (",O.room.name,")",Ye);try{O.peer.send(te(D))}catch{}},rr=(O,D)=>{ne("broadcast message in ",oe,O.name,we),O.webrtcConns.forEach(I=>{try{I.peer.send(D)}catch{}})},qe=class{constructor(D,I,E,A){ne("establishing connection to ",oe,E),this.room=A,this.remotePeerId=E,this.glareToken=void 0,this.closed=!1,this.connected=!1,this.synced=!1,this.peer=new Ft.default({initiator:I,...A.provider.peerOpts}),this.peer.on("signal",p=>{this.glareToken===void 0&&(this.glareToken=Date.now()+Math.random()),it(D,A,{to:E,from:A.peerId,type:"signal",token:this.glareToken,signal:p})}),this.peer.on("connect",()=>{ne("connected to ",oe,E),this.connected=!0;let s=A.provider.doc,w=A.awareness,k=Q();re(k,ve),ze(k,s),Qe(this,k);let n=w.getStates();if(n.size>0){let l=Q();re(l,Ne),de(l,xe(w,Array.from(n.keys()))),Qe(this,l)}}),this.peer.on("close",()=>{this.connected=!1,this.closed=!0,A.webrtcConns.has(this.remotePeerId)&&(A.webrtcConns.delete(this.remotePeerId),A.provider.emit("peers",[{removed:[this.remotePeerId],added:[],webrtcPeers:Array.from(A.webrtcConns.keys()),bcPeers:Array.from(A.bcConns)}])),qt(A),this.peer.destroy(),ne("closed connection to ",oe,E),et(A)}),this.peer.on("error",p=>{ne("Error in connection to ",oe,E,": ",p),et(A)}),this.peer.on("data",p=>{let s=tr(this,p);s!==null&&Qe(this,s)})}destroy(){this.peer.destroy()}},fe=(O,D)=>Je(D,O.key).then(I=>O.mux(()=>Ct(O.name,I))),Mt=(O,D)=>{O.bcconnected&&fe(O,D),rr(O,D)},et=O=>{je.forEach(D=>{D.connected&&(D.send({type:"subscribe",topics:[O.name]}),O.webrtcConns.size<O.provider.maxConns&&it(D,O,{type:"announce",from:O.peerId}))})},Vt=O=>{if(O.provider.filterBcConns){let D=Q();re(D,nt),Ve(D,1),Ae(D,O.peerId),fe(O,te(D))}},tt=class{constructor(D,I,E,A){this.peerId=yt(),this.doc=D,this.awareness=I.awareness,this.provider=I,this.synced=!1,this.name=E,this.key=A,this.webrtcConns=new Map,this.bcConns=new Set,this.mux=Rt(),this.bcconnected=!1,this._bcSubscriber=p=>Xe(new Uint8Array(p),A).then(s=>this.mux(()=>{let w=Wt(this,s,()=>{});w&&fe(this,te(w))})),this._docUpdateHandler=(p,s)=>{let w=Q();re(w,ve),kt(w,p),Mt(this,te(w))},this._awarenessUpdateHandler=({added:p,updated:s,removed:w},k)=>{let n=p.concat(s).concat(w),l=Q();re(l,Ne),de(l,xe(this.awareness,n)),Mt(this,te(l))},this._beforeUnloadHandler=()=>{Ge(this.awareness,[D.clientID],"window unload"),ge.forEach(p=>{p.disconnect()})},typeof window<"u"?window.addEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.on("exit",this._beforeUnloadHandler)}connect(){this.doc.on("update",this._docUpdateHandler),this.awareness.on("update",this._awarenessUpdateHandler),et(this);let D=this.name;vt(D,this._bcSubscriber),this.bcconnected=!0,Vt(this);let I=Q();re(I,ve),ze(I,this.doc),fe(this,te(I));let E=Q();re(E,ve),At(E,this.doc),fe(this,te(E));let A=Q();re(A,jt),fe(this,te(A));let p=Q();re(p,Ne),de(p,xe(this.awareness,[this.doc.clientID])),fe(this,te(p))}disconnect(){je.forEach(I=>{I.connected&&I.send({type:"unsubscribe",topics:[this.name]})}),Ge(this.awareness,[this.doc.clientID],"disconnect");let D=Q();re(D,nt),Ve(D,0),Ae(D,this.peerId),fe(this,te(D)),Et(this.name,this._bcSubscriber),this.bcconnected=!1,this.doc.off("update",this._docUpdateHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.webrtcConns.forEach(I=>I.destroy())}destroy(){this.disconnect(),typeof window<"u"?window.removeEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.off("exit",this._beforeUnloadHandler)}},nr=(O,D,I,E)=>{if(ge.has(I))throw Ue(`A Yjs Doc connected to room "${I}" already exists!`);let A=new tt(O,D,I,E);return ge.set(I,A),A},it=(O,D,I)=>{D.key?Ut(I,D.key).then(E=>{O.send({type:"publish",topic:D.name,data:bt(E)})}):O.send({type:"publish",topic:D.name,data:I})},rt=class extends Fe{constructor(D){super(D),this.providers=new Set,this.on("connect",()=>{ne(`connected (${D})`);let I=Array.from(ge.keys());this.send({type:"subscribe",topics:I}),ge.forEach(E=>it(this,E,{type:"announce",from:E.peerId}))}),this.on("message",I=>{switch(I.type){case"publish":{let E=I.topic,A=ge.get(E);if(A==null||typeof E!="string")return;let p=s=>{let w=A.webrtcConns,k=A.peerId;if(s==null||s.from===k||s.to!==void 0&&s.to!==k||A.bcConns.has(s.from))return;let n=w.has(s.from)?()=>{}:()=>A.provider.emit("peers",[{removed:[],added:[s.from],webrtcPeers:Array.from(A.webrtcConns.keys()),bcPeers:Array.from(A.bcConns)}]);switch(s.type){case"announce":w.size<A.provider.maxConns&&(Ie(w,s.from,()=>new qe(this,!0,s.from,A)),n());break;case"signal":if(s.signal.type==="offer"){let l=w.get(s.from);if(l){let d=s.token,o=l.glareToken;if(o&&o>d){ne("offer rejected: ",s.from);return}l.glareToken=void 0}}if(s.signal.type==="answer"){ne("offer answered by: ",s.from);let l=w.get(s.from);l.glareToken=void 0}s.to===k&&(Ie(w,s.from,()=>new qe(this,!1,s.from,A)).peer.signal(s.signal),n());break}};A.key?typeof I.data=="string"&&Pt(_t(I.data),A.key).then(p):p(I.data)}}}),this.on("disconnect",()=>ne(`disconnect (${D})`))}},Ze=O=>{O.emit("status",[{connected:O.connected}])},Bt=class extends ot{constructor(D,I,{signaling:E=["wss://y-webrtc-eu.fly.dev"],password:A=null,awareness:p=new Lt(I),maxConns:s=20+ct(gt()*15),filterBcConns:w=!0,peerOpts:k={}}={}){super(),this.roomName=D,this.doc=I,this.filterBcConns=w,this.awareness=p,this.shouldConnect=!1,this.signalingUrls=E,this.signalingConns=[],this.maxConns=s,this.peerOpts=k,this.key=A?It(A,D):Le(null),this.room=null,this.key.then(n=>{this.room=nr(I,this,D,n),this.shouldConnect?this.room.connect():this.room.disconnect(),Ze(this)}),this.connect(),this.destroy=this.destroy.bind(this),I.on("destroy",this.destroy)}get connected(){return this.room!==null&&this.shouldConnect}connect(){this.shouldConnect=!0,this.signalingUrls.forEach(D=>{let I=Ie(je,D,()=>new rt(D));this.signalingConns.push(I),I.providers.add(this)}),this.room&&(this.room.connect(),Ze(this))}disconnect(){this.shouldConnect=!1,this.signalingConns.forEach(D=>{D.providers.delete(this),D.providers.size===0&&(D.destroy(),je.delete(D.url))}),this.room&&(this.room.disconnect(),Ze(this))}destroy(){this.doc.off("destroy",this.destroy),this.key.then(()=>{this.room.destroy(),ge.delete(this.roomName)}),super.destroy()}};export{tt as Room,rt as SignalingConn,qe as WebrtcConn,Bt as WebrtcProvider};